From c43b5c511507025c152a1ef4fc5b50355bc29369 Mon Sep 17 00:00:00 2001 From: JiHong88 <0125ses@hanmail.net> Date: Tue, 1 Sep 2020 01:11:53 +0900 Subject: [PATCH 01/38] add: #450 options-rtl --- src/assets/css/suneditor-contents.css | 16 ++++++++++++++-- src/assets/css/suneditor.css | 8 +++++++- src/lib/constructor.js | 8 ++++++-- test/dev/suneditor_build_test.js | 3 ++- 4 files changed, 29 insertions(+), 6 deletions(-) diff --git a/src/assets/css/suneditor-contents.css b/src/assets/css/suneditor-contents.css index eba8d0555..7f62c460f 100644 --- a/src/assets/css/suneditor-contents.css +++ b/src/assets/css/suneditor-contents.css @@ -11,7 +11,6 @@ font-size: 13px; color: #333; line-height: 1.5; - text-align: left; background-color: #fff; word-break: normal; word-wrap: break-word; @@ -28,6 +27,11 @@ color: inherit; } +/* RTL - editable */ +.sun-editor-editable.se-rtl { + direction: rtl; +} + /** controllers on tag */ .sun-editor-editable td, .sun-editor-editable th, .sun-editor-editable figure, .sun-editor-editable figcaption, .sun-editor-editable img, @@ -172,10 +176,11 @@ border-width: 0; padding-top: 0; padding-bottom: 0; + border-color: #b1b1b1; padding-left: 20px; padding-right: 5px; border-left-width: 5px; - border-color: #b1b1b1; + border-right-width: 0px; } .sun-editor-editable blockquote blockquote { border-color: #c1c1c1; @@ -186,6 +191,13 @@ .sun-editor-editable blockquote blockquote blockquote blockquote { border-color: #e1e1e1; } +/* RTL - blockquote */ +.sun-editor-editable.se-rtl blockquote { + padding-left: 5px; + padding-right: 20px; + border-left-width: 0px; + border-right-width: 5px; +} /* h1 */ .sun-editor-editable h1 { diff --git a/src/assets/css/suneditor.css b/src/assets/css/suneditor.css index f7fe01e6d..d76da1b01 100755 --- a/src/assets/css/suneditor.css +++ b/src/assets/css/suneditor.css @@ -5,7 +5,7 @@ /* red color #b94a48 , #f2dede , #eed3d7 */ /** --- suneditor main */ -.sun-editor {width:auto; height:auto; box-sizing:border-box; font-family:Helvetica Neue, sans-serif; border:1px solid #dadada; text-align:left; background-color:#FFF; color:#000; user-select:none; -o-user-select:none; -moz-user-select:none; -khtml-user-select:none; -webkit-user-select:none; -ms-user-select:none;} +.sun-editor {width:auto; height:auto; box-sizing:border-box; font-family:Helvetica Neue, sans-serif; border:1px solid #dadada; background-color:#FFF; color:#000; user-select:none; -o-user-select:none; -moz-user-select:none; -khtml-user-select:none; -webkit-user-select:none; -ms-user-select:none;} .sun-editor * {box-sizing:border-box; -webkit-user-drag:none; overflow:visible;} .sun-editor-common input, .sun-editor-common select, .sun-editor-common textarea, .sun-editor-common button {font-size:14px; line-height:1.5;} .sun-editor-common body, .sun-editor-common div, .sun-editor-common dl, .sun-editor-common dt, .sun-editor-common dd, .sun-editor-common ul, .sun-editor-common ol, .sun-editor-common li, @@ -63,6 +63,10 @@ width: 24px; height: 24px; } +/* RTL - button */ +.sun-editor.se-rtl button { + transform: rotate(0deg) rotateY(180deg); +} /* icon class */ .sun-editor button > i::before { @@ -172,6 +176,8 @@ /** --- menu tray -------------------------------------------------------------- */ .sun-editor .se-btn-tray {position:relative; width:100%; height:100%; margin:0; padding:0;} .sun-editor .se-menu-tray {position:absolute; top:0px; left:0px; width:100%; height:0px;} +/* RTL - button tray */ +.sun-editor.se-rtl .se-btn-tray {direction: rtl;} /** --- submenu layer ---------------------------------------------------------- */ .sun-editor .se-submenu {overflow-x:hidden; overflow-y:auto;} diff --git a/src/lib/constructor.js b/src/lib/constructor.js index 5e5ffb958..192567436 100755 --- a/src/lib/constructor.js +++ b/src/lib/constructor.js @@ -28,7 +28,7 @@ export default { // suneditor div const top_div = doc.createElement('DIV'); - top_div.className = 'sun-editor'; + top_div.className = 'sun-editor' + (options.rtl ? ' se-rtl' : ''); if (element.id) top_div.id = 'suneditor_' + element.id; // relative div @@ -252,6 +252,9 @@ export default { el.code = code; el.placeholder = placeholder_span; + if (mergeOptions.rtl) util.addClass(el.topArea, 'se-rtl'); + else util.removeClass(el.topArea, 'se-rtl'); + return { callButtons: isNewToolbar ? tool_bar.pluginCallButtons : null, plugins: isNewToolbar || isNewPlugins ? tool_bar.plugins : null, @@ -290,7 +293,7 @@ export default { if (!options.iframe) { wysiwygDiv.setAttribute('contenteditable', true); wysiwygDiv.setAttribute('scrolling', 'auto'); - wysiwygDiv.className += ' sun-editor-editable'; + wysiwygDiv.className += ' sun-editor-editable' + (options.rtl ? ' se-rtl' : ''); wysiwygDiv.style.cssText = options._editorStyles.frame + options._editorStyles.editor; } else { wysiwygDiv.allowFullscreen = true; @@ -383,6 +386,7 @@ export default { options.attributesWhitelist = (!options.attributesWhitelist || typeof options.attributesWhitelist !== 'object') ? null : options.attributesWhitelist; /** Layout */ options.mode = options.mode || 'classic'; // classic, inline, balloon, balloon-always + options.rtl = !!options.rtl; options.toolbarWidth = options.toolbarWidth ? (util.isNumber(options.toolbarWidth) ? options.toolbarWidth + 'px' : options.toolbarWidth) : 'auto'; options.toolbarContainer = /balloon/i.test(options.mode) ? null : (typeof options.toolbarContainer === 'string' ? document.querySelector(options.toolbarContainer) : options.toolbarContainer); options.stickyToolbar = (/balloon/i.test(options.mode) || !!options.toolbarContainer) ? -1 : options.stickyToolbar === undefined ? 0 : (/^\d+/.test(options.stickyToolbar) ? util.getNumber(options.stickyToolbar, 0) : -1); diff --git a/test/dev/suneditor_build_test.js b/test/dev/suneditor_build_test.js index fac32e98b..06ba4ec6e 100644 --- a/test/dev/suneditor_build_test.js +++ b/test/dev/suneditor_build_test.js @@ -262,6 +262,7 @@ s1.onKeyDown = function (e, core) { } let ss = window.ss = suneditor.create(document.getElementById('editor1'), { + rtl: true, lang: lang.ko, plugins: plugins, katex: Katex, @@ -297,7 +298,7 @@ let ss = window.ss = suneditor.create(document.getElementById('editor1'), { expansion: "A", reduction: "Z" }, - iframe: true, + // iframe: true, videoFileInput: true, audioFileInput: true, placeholder: 'Start typing something...', From 24ca13150b68051940b1b2dc97a3ba0e170b38fe Mon Sep 17 00:00:00 2001 From: JiHong88 <0125ses@hanmail.net> Date: Wed, 16 Sep 2020 00:05:16 +0900 Subject: [PATCH 02/38] modify: rtl --- src/assets/css/suneditor-contents.css | 2 +- src/assets/css/suneditor.css | 16 +- test/dev/suneditor_build_test.js | 220 +++++++++++++------------- 3 files changed, 123 insertions(+), 115 deletions(-) diff --git a/src/assets/css/suneditor-contents.css b/src/assets/css/suneditor-contents.css index 7f62c460f..25c58a124 100644 --- a/src/assets/css/suneditor-contents.css +++ b/src/assets/css/suneditor-contents.css @@ -28,7 +28,7 @@ } /* RTL - editable */ -.sun-editor-editable.se-rtl { +.sun-editor-editable.se-rtl * { direction: rtl; } diff --git a/src/assets/css/suneditor.css b/src/assets/css/suneditor.css index d76da1b01..8e228be31 100755 --- a/src/assets/css/suneditor.css +++ b/src/assets/css/suneditor.css @@ -21,7 +21,6 @@ .sun-editor button .txt {display:block; margin-top:0; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;} -/** --- Icons ---------------------------------------------------------- */ /* button children are pointer event none */ .sun-editor button * { pointer-events: none; @@ -29,6 +28,15 @@ -webkit-backface-visibility: hidden; -moz-backface-visibility: hidden; } +/* RTL - button */ +.sun-editor.se-rtl button { + transform: rotate(0deg) rotateY(180deg); +} +.sun-editor.se-rtl * { + direction: rtl; +} + +/** --- Icons ---------------------------------------------------------- */ /* default svg */ .sun-editor button > svg, .sun-editor .se-svg { width: 16px; @@ -63,10 +71,6 @@ width: 24px; height: 24px; } -/* RTL - button */ -.sun-editor.se-rtl button { - transform: rotate(0deg) rotateY(180deg); -} /* icon class */ .sun-editor button > i::before { @@ -241,7 +245,7 @@ /* submenu layer - form group (color selector) */ .sun-editor .se-submenu-form-group {display:flex; width:100%; height:auto; padding:4px;} .sun-editor .se-submenu-form-group input {flex:auto; display:inline-block; width:auto; height:33px; color:#555; font-size:12px; margin:1px 0 1px 0; padding:0; border-radius:0.25rem; border:1px solid #ccc;} -.sun-editor .se-submenu-form-group button {float:right; width:34px; height:34px; margin:0 0 0 4px !important;} +.sun-editor .se-submenu-form-group button {float:right; width:34px; height:34px; margin:0 2px !important;} .sun-editor .se-submenu-form-group button.se-btn {border:1px solid #ccc;} .sun-editor .se-submenu-form-group > div {position:relative;} /** submenu layer - color input */ diff --git a/test/dev/suneditor_build_test.js b/test/dev/suneditor_build_test.js index 06ba4ec6e..7574e76a6 100644 --- a/test/dev/suneditor_build_test.js +++ b/test/dev/suneditor_build_test.js @@ -262,6 +262,7 @@ s1.onKeyDown = function (e, core) { } let ss = window.ss = suneditor.create(document.getElementById('editor1'), { + value: "", rtl: true, lang: lang.ko, plugins: plugins, @@ -329,103 +330,103 @@ let ss = window.ss = suneditor.create(document.getElementById('editor1'), { ['fullScreen', 'showBlocks', 'codeView'], ['preview', 'print'], ['save', 'template'], - // (min-width: 1565) - ['%1565', [ - ['undo', 'redo'], - ['font', 'fontSize', 'formatBlock'], - ['paragraphStyle', 'blockquote'], - ['bold', 'underline', 'italic', 'strike', 'subscript', 'superscript'], - ['fontColor', 'hiliteColor', 'textStyle'], - ['removeFormat'], - ['outdent', 'indent'], - ['align', 'horizontalRule', 'list', 'lineHeight'], - ['table', 'link', 'image', 'video', 'audio', 'math'], - ['imageGallery'], - ['fullScreen', 'showBlocks', 'codeView'], - ['-right', ':i-More Misc-default.more_vertical', 'preview', 'print', 'save', 'template'] - ]], - // (min-width: 1455) - ['%1455', [ - ['undo', 'redo'], - ['font', 'fontSize', 'formatBlock'], - ['paragraphStyle', 'blockquote'], - ['bold', 'underline', 'italic', 'strike', 'subscript', 'superscript'], - ['fontColor', 'hiliteColor', 'textStyle'], - ['removeFormat'], - ['outdent', 'indent'], - ['align', 'horizontalRule', 'list', 'lineHeight'], - ['table', 'link', 'image', 'video', 'audio', 'math'], - ['imageGallery'], - ['-right', ':i-More Misc-default.more_vertical', 'fullScreen', 'showBlocks', 'codeView', 'preview', 'print', 'save', 'template'] - ]], - // (min-width: 1326) - ['%1326', [ - ['undo', 'redo'], - ['font', 'fontSize', 'formatBlock'], - ['paragraphStyle', 'blockquote'], - ['bold', 'underline', 'italic', 'strike', 'subscript', 'superscript'], - ['fontColor', 'hiliteColor', 'textStyle'], - ['removeFormat'], - ['outdent', 'indent'], - ['align', 'horizontalRule', 'list', 'lineHeight'], - ['-right', ':i-More Misc-default.more_vertical', 'fullScreen', 'showBlocks', 'codeView', 'preview', 'print', 'save', 'template'], - ['-right', ':r-More Rich-default.more_plus', 'table', 'link', 'image', 'video', 'audio', 'math', 'imageGallery'] - ]], - // (min-width: 1123) - ['%1123', [ - ['undo', 'redo'], - [':p-More Paragraph-default.more_paragraph', 'font', 'fontSize', 'formatBlock', 'paragraphStyle', 'blockquote'], - ['bold', 'underline', 'italic', 'strike', 'subscript', 'superscript'], - ['fontColor', 'hiliteColor', 'textStyle'], - ['removeFormat'], - ['outdent', 'indent'], - ['align', 'horizontalRule', 'list', 'lineHeight'], - ['-right', ':i-More Misc-default.more_vertical', 'fullScreen', 'showBlocks', 'codeView', 'preview', 'print', 'save', 'template'], - ['-right', ':r-More Rich-default.more_plus', 'table', 'link', 'image', 'video', 'audio', 'math', 'imageGallery'] - ]], - // (min-width: 817) - ['%817', [ - ['undo', 'redo'], - [':p-More Paragraph-default.more_paragraph', 'font', 'fontSize', 'formatBlock', 'paragraphStyle', 'blockquote'], - ['bold', 'underline', 'italic', 'strike'], - [':t-More Text-default.more_text', 'subscript', 'superscript', 'fontColor', 'hiliteColor', 'textStyle'], - ['removeFormat'], - ['outdent', 'indent'], - ['align', 'horizontalRule', 'list', 'lineHeight'], - ['-right', ':i-More Misc-default.more_vertical', 'fullScreen', 'showBlocks', 'codeView', 'preview', 'print', 'save', 'template'], - ['-right', ':r-More Rich-default.more_plus', 'table', 'link', 'image', 'video', 'audio', 'math', 'imageGallery'] - ]], - // (min-width: 673) - ['%673', [ - ['undo', 'redo'], - [':p-More Paragraph-default.more_paragraph', 'font', 'fontSize', 'formatBlock', 'paragraphStyle', 'blockquote'], - [':t-More Text-default.more_text', 'bold', 'underline', 'italic', 'strike', 'subscript', 'superscript', 'fontColor', 'hiliteColor', 'textStyle'], - ['removeFormat'], - ['outdent', 'indent'], - ['align', 'horizontalRule', 'list', 'lineHeight'], - [':r-More Rich-default.more_plus', 'table', 'link', 'image', 'video', 'audio', 'math', 'imageGallery'], - ['-right', ':i-More Misc-default.more_vertical', 'fullScreen', 'showBlocks', 'codeView', 'preview', 'print', 'save', 'template'] - ]], - // (min-width: 525) - ['%525', [ - ['undo', 'redo'], - [':p-More Paragraph-default.more_paragraph', 'font', 'fontSize', 'formatBlock', 'paragraphStyle', 'blockquote'], - [':t-More Text-default.more_text', 'bold', 'underline', 'italic', 'strike', 'subscript', 'superscript', 'fontColor', 'hiliteColor', 'textStyle'], - ['removeFormat'], - ['outdent', 'indent'], - [':e-More Line-default.more_horizontal', 'align', 'horizontalRule', 'list', 'lineHeight'], - [':r-More Rich-default.more_plus', 'table', 'link', 'image', 'video', 'audio', 'math', 'imageGallery'], - ['-right', ':i-More Misc-default.more_vertical', 'fullScreen', 'showBlocks', 'codeView', 'preview', 'print', 'save', 'template'] - ]], - // (min-width: 420) - ['%420', [ - ['undo', 'redo'], - [':p-More Paragraph-default.more_paragraph', 'font', 'fontSize', 'formatBlock', 'paragraphStyle', 'blockquote'], - [':t-More Text-default.more_text', 'bold', 'underline', 'italic', 'strike', 'subscript', 'superscript', 'fontColor', 'hiliteColor', 'textStyle', 'removeFormat'], - [':e-More Line-default.more_horizontal', 'outdent', 'indent', 'align', 'horizontalRule', 'list', 'lineHeight'], - [':r-More Rich-default.more_plus', 'table', 'link', 'image', 'video', 'audio', 'math', 'imageGallery'], - ['-right', ':i-More Misc-default.more_vertical', 'fullScreen', 'showBlocks', 'codeView', 'preview', 'print', 'save', 'template'] - ]] + // // (min-width: 1565) + // ['%1565', [ + // ['undo', 'redo'], + // ['font', 'fontSize', 'formatBlock'], + // ['paragraphStyle', 'blockquote'], + // ['bold', 'underline', 'italic', 'strike', 'subscript', 'superscript'], + // ['fontColor', 'hiliteColor', 'textStyle'], + // ['removeFormat'], + // ['outdent', 'indent'], + // ['align', 'horizontalRule', 'list', 'lineHeight'], + // ['table', 'link', 'image', 'video', 'audio', 'math'], + // ['imageGallery'], + // ['fullScreen', 'showBlocks', 'codeView'], + // ['-right', ':i-More Misc-default.more_vertical', 'preview', 'print', 'save', 'template'] + // ]], + // // (min-width: 1455) + // ['%1455', [ + // ['undo', 'redo'], + // ['font', 'fontSize', 'formatBlock'], + // ['paragraphStyle', 'blockquote'], + // ['bold', 'underline', 'italic', 'strike', 'subscript', 'superscript'], + // ['fontColor', 'hiliteColor', 'textStyle'], + // ['removeFormat'], + // ['outdent', 'indent'], + // ['align', 'horizontalRule', 'list', 'lineHeight'], + // ['table', 'link', 'image', 'video', 'audio', 'math'], + // ['imageGallery'], + // ['-right', ':i-More Misc-default.more_vertical', 'fullScreen', 'showBlocks', 'codeView', 'preview', 'print', 'save', 'template'] + // ]], + // // (min-width: 1326) + // ['%1326', [ + // ['undo', 'redo'], + // ['font', 'fontSize', 'formatBlock'], + // ['paragraphStyle', 'blockquote'], + // ['bold', 'underline', 'italic', 'strike', 'subscript', 'superscript'], + // ['fontColor', 'hiliteColor', 'textStyle'], + // ['removeFormat'], + // ['outdent', 'indent'], + // ['align', 'horizontalRule', 'list', 'lineHeight'], + // ['-right', ':i-More Misc-default.more_vertical', 'fullScreen', 'showBlocks', 'codeView', 'preview', 'print', 'save', 'template'], + // ['-right', ':r-More Rich-default.more_plus', 'table', 'link', 'image', 'video', 'audio', 'math', 'imageGallery'] + // ]], + // // (min-width: 1123) + // ['%1123', [ + // ['undo', 'redo'], + // [':p-More Paragraph-default.more_paragraph', 'font', 'fontSize', 'formatBlock', 'paragraphStyle', 'blockquote'], + // ['bold', 'underline', 'italic', 'strike', 'subscript', 'superscript'], + // ['fontColor', 'hiliteColor', 'textStyle'], + // ['removeFormat'], + // ['outdent', 'indent'], + // ['align', 'horizontalRule', 'list', 'lineHeight'], + // ['-right', ':i-More Misc-default.more_vertical', 'fullScreen', 'showBlocks', 'codeView', 'preview', 'print', 'save', 'template'], + // ['-right', ':r-More Rich-default.more_plus', 'table', 'link', 'image', 'video', 'audio', 'math', 'imageGallery'] + // ]], + // // (min-width: 817) + // ['%817', [ + // ['undo', 'redo'], + // [':p-More Paragraph-default.more_paragraph', 'font', 'fontSize', 'formatBlock', 'paragraphStyle', 'blockquote'], + // ['bold', 'underline', 'italic', 'strike'], + // [':t-More Text-default.more_text', 'subscript', 'superscript', 'fontColor', 'hiliteColor', 'textStyle'], + // ['removeFormat'], + // ['outdent', 'indent'], + // ['align', 'horizontalRule', 'list', 'lineHeight'], + // ['-right', ':i-More Misc-default.more_vertical', 'fullScreen', 'showBlocks', 'codeView', 'preview', 'print', 'save', 'template'], + // ['-right', ':r-More Rich-default.more_plus', 'table', 'link', 'image', 'video', 'audio', 'math', 'imageGallery'] + // ]], + // // (min-width: 673) + // ['%673', [ + // ['undo', 'redo'], + // [':p-More Paragraph-default.more_paragraph', 'font', 'fontSize', 'formatBlock', 'paragraphStyle', 'blockquote'], + // [':t-More Text-default.more_text', 'bold', 'underline', 'italic', 'strike', 'subscript', 'superscript', 'fontColor', 'hiliteColor', 'textStyle'], + // ['removeFormat'], + // ['outdent', 'indent'], + // ['align', 'horizontalRule', 'list', 'lineHeight'], + // [':r-More Rich-default.more_plus', 'table', 'link', 'image', 'video', 'audio', 'math', 'imageGallery'], + // ['-right', ':i-More Misc-default.more_vertical', 'fullScreen', 'showBlocks', 'codeView', 'preview', 'print', 'save', 'template'] + // ]], + // // (min-width: 525) + // ['%525', [ + // ['undo', 'redo'], + // [':p-More Paragraph-default.more_paragraph', 'font', 'fontSize', 'formatBlock', 'paragraphStyle', 'blockquote'], + // [':t-More Text-default.more_text', 'bold', 'underline', 'italic', 'strike', 'subscript', 'superscript', 'fontColor', 'hiliteColor', 'textStyle'], + // ['removeFormat'], + // ['outdent', 'indent'], + // [':e-More Line-default.more_horizontal', 'align', 'horizontalRule', 'list', 'lineHeight'], + // [':r-More Rich-default.more_plus', 'table', 'link', 'image', 'video', 'audio', 'math', 'imageGallery'], + // ['-right', ':i-More Misc-default.more_vertical', 'fullScreen', 'showBlocks', 'codeView', 'preview', 'print', 'save', 'template'] + // ]], + // // (min-width: 420) + // ['%420', [ + // ['undo', 'redo'], + // [':p-More Paragraph-default.more_paragraph', 'font', 'fontSize', 'formatBlock', 'paragraphStyle', 'blockquote'], + // [':t-More Text-default.more_text', 'bold', 'underline', 'italic', 'strike', 'subscript', 'superscript', 'fontColor', 'hiliteColor', 'textStyle', 'removeFormat'], + // [':e-More Line-default.more_horizontal', 'outdent', 'indent', 'align', 'horizontalRule', 'list', 'lineHeight'], + // [':r-More Rich-default.more_plus', 'table', 'link', 'image', 'video', 'audio', 'math', 'imageGallery'], + // ['-right', ':i-More Misc-default.more_vertical', 'fullScreen', 'showBlocks', 'codeView', 'preview', 'print', 'save', 'template'] + // ]] ], }); // ss.setContents('fsafsa') @@ -657,11 +658,13 @@ const editor = suneditor.init({ let s2 = window.s2 = editor.create(document.getElementById('editor2'), { // lang: lang.ru, // mode: 'inline', + value: "", // toolbarWidth: 150, attributesWhitelist: {'all': 'uk-icon'}, plugins: plugins, fontSize: fs, // maxHeight: '400px', + katex: Katex, height: '700px', defaultStyle: 'height: 500px; font-size:10px;', imageGalleryUrl: 'http://localhost:3000/editor/gallery', @@ -670,18 +673,19 @@ let s2 = window.s2 = editor.create(document.getElementById('editor2'), { imageResizing: true, // imageWidth: '400', buttonList: [ - // ['undo', 'redo'], - // ['font', 'fontSize', 'formatBlock'], - // ['paragraphStyle'], - // ['bold', 'underline', 'italic', 'strike', 'subscript', 'superscript'], + ['undo', 'redo'], + ['font', 'fontSize', 'formatBlock'], + ['paragraphStyle', 'blockquote'], + ['bold', 'underline', 'italic', 'strike', 'subscript', 'superscript'], ['fontColor', 'hiliteColor', 'textStyle'], - // ['removeFormat'], - // ['outdent', 'indent'], - // ['align', 'horizontalRule', 'list', 'lineHeight', 'table'], - ['link', 'image', 'video'], - // ['fullScreen', 'showBlocks', 'codeView'], - // ['preview', 'print'], - // ['save', 'template'], + ['removeFormat'], + ['outdent', 'indent'], + ['align', 'horizontalRule', 'list', 'lineHeight'], + ['table', 'link', 'image', 'video', 'audio', 'math'], + ['imageGallery'], + ['fullScreen', 'showBlocks', 'codeView'], + ['preview', 'print'], + ['save', 'template'], ], icons: { underline: '', From afd54bc8461b79e512ee189fed1a90b307fde44a Mon Sep 17 00:00:00 2001 From: JiHong88 <0125ses@hanmail.net> Date: Mon, 21 Sep 2020 20:09:47 +0900 Subject: [PATCH 03/38] modify: #450 options - rtl --- src/assets/css/suneditor.css | 61 +++++++++++++++++++++++++++--------- src/lib/constructor.js | 6 ++-- src/lib/core.js | 7 +++-- src/plugins/submenu/list.js | 4 +-- 4 files changed, 55 insertions(+), 23 deletions(-) diff --git a/src/assets/css/suneditor.css b/src/assets/css/suneditor.css index 8e228be31..22948f474 100755 --- a/src/assets/css/suneditor.css +++ b/src/assets/css/suneditor.css @@ -28,13 +28,6 @@ -webkit-backface-visibility: hidden; -moz-backface-visibility: hidden; } -/* RTL - button */ -.sun-editor.se-rtl button { - transform: rotate(0deg) rotateY(180deg); -} -.sun-editor.se-rtl * { - direction: rtl; -} /** --- Icons ---------------------------------------------------------- */ /* default svg */ @@ -171,8 +164,8 @@ .sun-editor .se-menu-list {float:left; padding:0; margin:0;} .sun-editor .se-menu-list li {position:relative; float:left; padding:0; margin:0;} /* tool bar select button (font, fontSize, formatBlock) */ -.sun-editor .se-btn-select {width:auto; display:flex; text-align:left; padding:4px 6px;} -.sun-editor .se-btn-select .txt {flex:auto; float:left; text-align:left;} +.sun-editor .se-btn-select {width:auto; display:flex; padding:4px 6px;} +.sun-editor .se-btn-select .txt {flex:auto; text-align:left;} .sun-editor .se-btn-select.se-btn-tool-font {width:100px;} .sun-editor .se-btn-select.se-btn-tool-format {width:80px;} .sun-editor .se-btn-select.se-btn-tool-size {width:80px;} @@ -180,8 +173,6 @@ /** --- menu tray -------------------------------------------------------------- */ .sun-editor .se-btn-tray {position:relative; width:100%; height:100%; margin:0; padding:0;} .sun-editor .se-menu-tray {position:absolute; top:0px; left:0px; width:100%; height:0px;} -/* RTL - button tray */ -.sun-editor.se-rtl .se-btn-tray {direction: rtl;} /** --- submenu layer ---------------------------------------------------------- */ .sun-editor .se-submenu {overflow-x:hidden; overflow-y:auto;} @@ -243,7 +234,7 @@ .sun-editor .se-list-layer .se-selector-color .se-color-pallet button:hover, .sun-editor .se-list-layer .se-selector-color .se-color-pallet button:focus {border:3px solid #fff;} /* submenu layer - form group (color selector) */ -.sun-editor .se-submenu-form-group {display:flex; width:100%; height:auto; padding:4px;} +.sun-editor .se-submenu-form-group {display:flex; width:100%; min-height:40px; height:auto; padding:4px;} .sun-editor .se-submenu-form-group input {flex:auto; display:inline-block; width:auto; height:33px; color:#555; font-size:12px; margin:1px 0 1px 0; padding:0; border-radius:0.25rem; border:1px solid #ccc;} .sun-editor .se-submenu-form-group button {float:right; width:34px; height:34px; margin:0 2px !important;} .sun-editor .se-submenu-form-group button.se-btn {border:1px solid #ccc;} @@ -285,7 +276,7 @@ .sun-editor .se-dialog .se-dialog-inner .se-dialog-content .se-btn-primary {display:inline-block; padding:6px 12px; margin:0 0 10px 0 !important; font-size:14px; font-weight:normal; line-height:1.42857143; text-align:center; white-space:nowrap; vertical-align:middle; -ms-touch-action:manipulation; touch-action:manipulation; border-radius:4px;} .sun-editor .se-dialog .se-dialog-inner .se-dialog-header {height:50px; padding:6px 15px 6px 15px; border-bottom:1px solid #e5e5e5;} .sun-editor .se-dialog .se-dialog-inner .se-dialog-header .se-dialog-close {float:right; font-weight:bold; text-shadow:0 1px 0 #fff; -webkit-appearance:none; filter:alpha(opacity=100); opacity:1;} -.sun-editor .se-dialog .se-dialog-inner .se-dialog-header .se-modal-title {font-size:14px; font-weight:bold; margin:0; padding:0; line-height:2.5;} +.sun-editor .se-dialog .se-dialog-inner .se-dialog-header .se-modal-title {float:left; font-size:14px; font-weight:bold; margin:0; padding:0; line-height:2.5;} .sun-editor .se-dialog .se-dialog-inner .se-dialog-body {position:relative; padding:15px;} .sun-editor .se-dialog .se-dialog-inner .se-dialog-form {margin-bottom:10px;} .sun-editor .se-dialog .se-dialog-inner .se-dialog-form-footer {margin-top:10px; margin-bottom:0;} @@ -294,9 +285,9 @@ .sun-editor .se-dialog .se-dialog-inner .se-dialog-size-text .size-w {width:70px; text-align:center;} .sun-editor .se-dialog .se-dialog-inner .se-dialog-size-text .size-h {width:70px; text-align:center;} .sun-editor .se-dialog .se-dialog-inner .se-dialog-size-x {margin:0 8px 0 8px; width:25px; text-align:center;} -.sun-editor .se-dialog .se-dialog-inner .se-dialog-footer {padding:10px 15px 0px 15px; text-align:right; border-top:1px solid #e5e5e5;} +.sun-editor .se-dialog .se-dialog-inner .se-dialog-footer {height:55px; padding:10px 15px 0px 15px; text-align:right; border-top:1px solid #e5e5e5;} .sun-editor .se-dialog .se-dialog-inner .se-dialog-footer > div {float:left;} -.sun-editor .se-dialog .se-dialog-inner .se-dialog-footer > div > label {margin-top:5px;} +.sun-editor .se-dialog .se-dialog-inner .se-dialog-footer > div > label {margin:0 5px 0 0;} .sun-editor .se-dialog .se-dialog-inner .se-dialog-btn-radio {margin-left:12px; margin-right:6px;} .sun-editor .se-dialog .se-dialog-inner .se-dialog-btn-check {margin-left:12px; margin-right:4px;} .sun-editor .se-dialog .se-dialog-inner .se-dialog-form-footer .se-dialog-btn-check {margin-left:0; margin-right:4px;} @@ -427,6 +418,46 @@ .sun-editor .se-tooltip .se-tooltip-inner .se-tooltip-text::after {content:""; position:absolute; bottom:100%; left:50%; margin-left:-5px; border-width:5px; border-style:solid; border-color:transparent transparent #333 transparent;} .sun-editor .se-tooltip:hover .se-tooltip-inner {visibility:visible; opacity:1;} + +/** --- RTL ---------------------------------------------------------- */ +/* tray */ +.sun-editor.se-rtl .se-btn-tray {direction:rtl;} +/* button - se-rtl-icon */ +.sun-editor.se-rtl button.se-rtl-icon {transform:rotate(0deg) rotateY(180deg);} +/* button - select text */ +.sun-editor.se-rtl .se-btn-select .txt {flex:auto; text-align:right; direction:rtl;} +/* button - se-menu-list */ +.sun-editor .se-btn-list {text-align:right;} +/* button - se-menu-list - li */ +.sun-editor .se-menu-list li {float:right;} +/* menu list */ +.sun-editor .se-list-layer * {direction:rtl;} +/* menu list - format block */ +.sun-editor .se-list-layer.se-list-format ul blockquote {padding:0 7px 0 0; border-right-width:5px; border-left-width:0;} +/* menu list - color picker */ +.sun-editor .se-list-layer .se-selector-color .se-color-pallet li {float:right;} +/* placeholder */ +.sun-editor.se-rtl .se-wrapper .se-placeholder {direction:rtl;} +/* dialog */ +.sun-editor.se-rtl .se-dialog * {direction:rtl;} +/* dialog - header */ +.sun-editor.se-rtl .se-dialog .se-dialog-inner .se-dialog-header .se-dialog-close {float:left;} +.sun-editor.se-rtl .se-dialog .se-dialog-inner .se-dialog-header .se-modal-title {float:right;} +/* dialog - tabs */ +.sun-editor.se-rtl .se-dialog-tabs button {float:right;} +.sun-editor.se-rtl .se-dialog .se-dialog-inner .se-dialog-size-text {padding-right:34px;} +/* dialog - footer */ +.sun-editor.se-rtl .se-dialog .se-dialog-inner .se-dialog-content .se-btn-primary {float:left} +.sun-editor.se-rtl .se-dialog .se-dialog-inner .se-dialog-footer > div {float:right;} +.sun-editor.se-rtl .se-dialog .se-dialog-inner .se-dialog-footer > div > label {margin:0 0 0 5px;} +/* fileBrowser */ +.sun-editor .se-file-browser * {direction:rtl;} +/* fileBrowser - header */ +.sun-editor .se-file-browser .se-file-browser-tags {text-align:right;} +.sun-editor .se-file-browser .se-file-browser-tags a {margin: 8px 8px 0 8px;} +.sun-editor.se-rtl .se-file-browser .se-file-browser-header .se-file-browser-close {float:left;} + + /** animation */ @keyframes blinker { 50% {opacity:0;} } @keyframes spinner { to {transform:rotate(361deg);} } \ No newline at end of file diff --git a/src/lib/constructor.js b/src/lib/constructor.js index b57bec7d1..f65e16cd6 100755 --- a/src/lib/constructor.js +++ b/src/lib/constructor.js @@ -532,8 +532,8 @@ export default { subscript: ['_se_command_subscript', lang.toolbar.subscript, 'SUB', '', icons.subscript], superscript: ['_se_command_superscript', lang.toolbar.superscript, 'SUP', '', icons.superscript], removeFormat: ['', lang.toolbar.removeFormat, 'removeFormat', '', icons.erase], - indent: ['_se_command_indent', lang.toolbar.indent + (shortcutsDisable.indexOf('indent') > -1 ? '' : ' (' + cmd + '+])'), 'indent', '', icons.outdent], - outdent: ['_se_command_outdent', lang.toolbar.outdent + (shortcutsDisable.indexOf('indent') > -1 ? '' : ' (' + cmd + '+[)'), 'outdent', '', icons.indent], + indent: ['_se_command_indent se-rtl-icon', lang.toolbar.indent + (shortcutsDisable.indexOf('indent') > -1 ? '' : ' (' + cmd + '+])'), 'indent', '', icons.outdent], + outdent: ['_se_command_outdent se-rtl-icon', lang.toolbar.outdent + (shortcutsDisable.indexOf('indent') > -1 ? '' : ' (' + cmd + '+[)'), 'outdent', '', icons.indent], fullScreen: ['se-code-view-enabled se-resizing-enabled _se_command_fullScreen', lang.toolbar.fullScreen, 'fullScreen', '', icons.expansion], showBlocks: ['_se_command_showBlocks', lang.toolbar.showBlocks, 'showBlocks', '', icons.show_blocks], codeView: ['se-code-view-enabled se-resizing-enabled _se_command_codeView', lang.toolbar.codeView, 'codeView', '', icons.code_view], @@ -551,7 +551,7 @@ export default { fontColor: ['', lang.toolbar.fontColor, 'fontColor', 'submenu', icons.font_color], hiliteColor: ['', lang.toolbar.hiliteColor, 'hiliteColor', 'submenu', icons.highlight_color], align: ['se-btn-align', lang.toolbar.align, 'align', 'submenu', icons.align_left], - list: ['', lang.toolbar.list, 'list', 'submenu', icons.list_number], + list: ['se-rtl-icon', lang.toolbar.list, 'list', 'submenu', icons.list_number], horizontalRule: ['btn_line', lang.toolbar.horizontalRule, 'horizontalRule', 'submenu', icons.horizontal_rule], table: ['', lang.toolbar.table, 'table', 'submenu', icons.table], lineHeight: ['', lang.toolbar.lineHeight, 'lineHeight', 'submenu', icons.line_height], diff --git a/src/lib/core.js b/src/lib/core.js index 525e1f978..909a21997 100755 --- a/src/lib/core.js +++ b/src/lib/core.js @@ -3929,6 +3929,7 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re const rangeLines = this.getSelectedElements(null); const cells = []; const shift = 'indent' !== command; + const marginDir = options.rtl ? 'marginRight' : 'marginLeft'; let sc = range.startContainer; let ec = range.endContainer; let so = range.startOffset; @@ -3938,13 +3939,13 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re f = rangeLines[i]; if (!util.isListCell(f) || !this.plugins.list) { - margin = /\d+/.test(f.style.marginLeft) ? util.getNumber(f.style.marginLeft, 0) : 0; + margin = /\d+/.test(f.style[marginDir]) ? util.getNumber(f.style[marginDir], 0) : 0; if (shift) { margin -= 25; } else { margin += 25; } - util.setStyle(f, 'marginLeft', (margin <= 0 ? '' : margin + 'px')); + util.setStyle(f, marginDir, (margin <= 0 ? '' : margin + 'px')); } else { if (shift || f.previousElementSibling) { cells.push(f); @@ -6276,7 +6277,7 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re }, onBlur_wysiwyg: function (e) { - if (core._antiBlur) return; + if (core._antiBlur || core._variable.isCodeView) return; core.hasFocus = false; core.controllersOff(); if (core._isInline || core._isBalloon) event._hideToolbar(); diff --git a/src/plugins/submenu/list.js b/src/plugins/submenu/list.js index 2f5b2d3a4..cb7df6f7f 100644 --- a/src/plugins/submenu/list.js +++ b/src/plugins/submenu/list.js @@ -45,10 +45,10 @@ export default { listDiv.innerHTML = '' + '
' + '' + From 839ff7e6cc328bc49c970d4a98c51e3fa6f40016 Mon Sep 17 00:00:00 2001 From: JiHong88 <0125ses@hanmail.net> Date: Mon, 21 Sep 2020 20:11:29 +0900 Subject: [PATCH 04/38] fix: options-rtl --- src/assets/css/suneditor.css | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/assets/css/suneditor.css b/src/assets/css/suneditor.css index 22948f474..38512400e 100755 --- a/src/assets/css/suneditor.css +++ b/src/assets/css/suneditor.css @@ -427,15 +427,15 @@ /* button - select text */ .sun-editor.se-rtl .se-btn-select .txt {flex:auto; text-align:right; direction:rtl;} /* button - se-menu-list */ -.sun-editor .se-btn-list {text-align:right;} +.sun-editor.se-rtl .se-btn-list {text-align:right;} /* button - se-menu-list - li */ -.sun-editor .se-menu-list li {float:right;} +.sun-editor.se-rtl .se-menu-list li {float:right;} /* menu list */ -.sun-editor .se-list-layer * {direction:rtl;} +.sun-editor.se-rtl .se-list-layer * {direction:rtl;} /* menu list - format block */ -.sun-editor .se-list-layer.se-list-format ul blockquote {padding:0 7px 0 0; border-right-width:5px; border-left-width:0;} +.sun-editor.se-rtl .se-list-layer.se-list-format ul blockquote {padding:0 7px 0 0; border-right-width:5px; border-left-width:0;} /* menu list - color picker */ -.sun-editor .se-list-layer .se-selector-color .se-color-pallet li {float:right;} +.sun-editor.se-rtl .se-list-layer .se-selector-color .se-color-pallet li {float:right;} /* placeholder */ .sun-editor.se-rtl .se-wrapper .se-placeholder {direction:rtl;} /* dialog */ @@ -451,10 +451,10 @@ .sun-editor.se-rtl .se-dialog .se-dialog-inner .se-dialog-footer > div {float:right;} .sun-editor.se-rtl .se-dialog .se-dialog-inner .se-dialog-footer > div > label {margin:0 0 0 5px;} /* fileBrowser */ -.sun-editor .se-file-browser * {direction:rtl;} +.sun-editor.se-rtl .se-file-browser * {direction:rtl;} /* fileBrowser - header */ -.sun-editor .se-file-browser .se-file-browser-tags {text-align:right;} -.sun-editor .se-file-browser .se-file-browser-tags a {margin: 8px 8px 0 8px;} +.sun-editor.se-rtl .se-file-browser .se-file-browser-tags {text-align:right;} +.sun-editor.se-rtl .se-file-browser .se-file-browser-tags a {margin: 8px 8px 0 8px;} .sun-editor.se-rtl .se-file-browser .se-file-browser-header .se-file-browser-close {float:left;} From 423e523f3b049a45a858ab4d3f932281138ece7a Mon Sep 17 00:00:00 2001 From: JiHong88 <0125ses@hanmail.net> Date: Wed, 23 Sep 2020 01:18:39 +0900 Subject: [PATCH 05/38] fix rtl --- src/assets/css/suneditor.css | 10 +++++++--- src/lib/constructor.js | 18 +++++++++--------- src/plugins/submenu/list.js | 8 ++++---- 3 files changed, 20 insertions(+), 16 deletions(-) diff --git a/src/assets/css/suneditor.css b/src/assets/css/suneditor.css index 38512400e..0bcc4a30a 100755 --- a/src/assets/css/suneditor.css +++ b/src/assets/css/suneditor.css @@ -29,9 +29,10 @@ -moz-backface-visibility: hidden; } + /** --- Icons ---------------------------------------------------------- */ /* default svg */ -.sun-editor button > svg, .sun-editor .se-svg { +.sun-editor button > svg, .sun-editor .se-svg, .sun-editor span > svg { width: 16px; height: 16px; margin: auto; @@ -421,9 +422,9 @@ /** --- RTL ---------------------------------------------------------- */ /* tray */ -.sun-editor.se-rtl .se-btn-tray {direction:rtl;} +/* .sun-editor.se-rtl .se-btn-tray {direction:rtl;} */ /* button - se-rtl-icon */ -.sun-editor.se-rtl button.se-rtl-icon {transform:rotate(0deg) rotateY(180deg);} +.sun-editor.se-rtl button .se-rtl-icon {display:initial; transform:rotate(0deg) rotateY(180deg);} /* button - select text */ .sun-editor.se-rtl .se-btn-select .txt {flex:auto; text-align:right; direction:rtl;} /* button - se-menu-list */ @@ -438,6 +439,9 @@ .sun-editor.se-rtl .se-list-layer .se-selector-color .se-color-pallet li {float:right;} /* placeholder */ .sun-editor.se-rtl .se-wrapper .se-placeholder {direction:rtl;} +/* tooltip */ +.sun-editor.se-rtl .se-tooltip .se-tooltip-inner .se-tooltip-text {direction:rtl;} +.sun-editor.se-rtl .se-tooltip .se-tooltip-inner .se-tooltip-text .se-shortcut {direction:ltr;} /* dialog */ .sun-editor.se-rtl .se-dialog * {direction:rtl;} /* dialog - header */ diff --git a/src/lib/constructor.js b/src/lib/constructor.js index f65e16cd6..d22dcff34 100755 --- a/src/lib/constructor.js +++ b/src/lib/constructor.js @@ -525,20 +525,20 @@ export default { return { /** default command */ - bold: ['_se_command_bold', lang.toolbar.bold + (shortcutsDisable.indexOf('bold') > -1 ? '' : ' (' + cmd + '+B)'), 'STRONG', '', icons.bold], - underline: ['_se_command_underline', lang.toolbar.underline + (shortcutsDisable.indexOf('underline') > -1 ? '' : ' (' + cmd + '+U)'), 'U', '', icons.underline], - italic: ['_se_command_italic', lang.toolbar.italic + (shortcutsDisable.indexOf('italic') > -1 ? '' : ' (' + cmd + '+I)'), 'EM', '', icons.italic], - strike: ['_se_command_strike', lang.toolbar.strike + (shortcutsDisable.indexOf('strike') > -1 ? '' : ' (' + cmd + '+SHIFT+S)'), 'DEL', '', icons.strike], + bold: ['_se_command_bold', lang.toolbar.bold + '' + (shortcutsDisable.indexOf('bold') > -1 ? '' : ' (' + cmd + '+B)') + '', 'STRONG', '', icons.bold], + underline: ['_se_command_underline', lang.toolbar.underline + '' + (shortcutsDisable.indexOf('underline') > -1 ? '' : ' (' + cmd + '+U)') + '', 'U', '', icons.underline], + italic: ['_se_command_italic', lang.toolbar.italic + '' + (shortcutsDisable.indexOf('italic') > -1 ? '' : ' (' + cmd + '+I)') + '', 'EM', '', icons.italic], + strike: ['_se_command_strike', lang.toolbar.strike + '' + (shortcutsDisable.indexOf('strike') > -1 ? '' : ' (' + cmd + '+SHIFT+S)') + '', 'DEL', '', icons.strike], subscript: ['_se_command_subscript', lang.toolbar.subscript, 'SUB', '', icons.subscript], superscript: ['_se_command_superscript', lang.toolbar.superscript, 'SUP', '', icons.superscript], removeFormat: ['', lang.toolbar.removeFormat, 'removeFormat', '', icons.erase], - indent: ['_se_command_indent se-rtl-icon', lang.toolbar.indent + (shortcutsDisable.indexOf('indent') > -1 ? '' : ' (' + cmd + '+])'), 'indent', '', icons.outdent], - outdent: ['_se_command_outdent se-rtl-icon', lang.toolbar.outdent + (shortcutsDisable.indexOf('indent') > -1 ? '' : ' (' + cmd + '+[)'), 'outdent', '', icons.indent], + indent: ['_se_command_indent', lang.toolbar.indent + '' + (shortcutsDisable.indexOf('indent') > -1 ? '' : ' (' + cmd + '+])') + '', 'indent', '', '' + icons.outdent + ''], + outdent: ['_se_command_outdent', lang.toolbar.outdent + '' + (shortcutsDisable.indexOf('indent') > -1 ? '' : ' (' + cmd + '+[)') + '', 'outdent', '', '' + icons.indent + ''], fullScreen: ['se-code-view-enabled se-resizing-enabled _se_command_fullScreen', lang.toolbar.fullScreen, 'fullScreen', '', icons.expansion], showBlocks: ['_se_command_showBlocks', lang.toolbar.showBlocks, 'showBlocks', '', icons.show_blocks], codeView: ['se-code-view-enabled se-resizing-enabled _se_command_codeView', lang.toolbar.codeView, 'codeView', '', icons.code_view], - undo: ['_se_command_undo se-resizing-enabled', lang.toolbar.undo + (shortcutsDisable.indexOf('undo') > -1 ? '' : ' (' + cmd + '+Z)'), 'undo', '', icons.undo], - redo: ['_se_command_redo se-resizing-enabled', lang.toolbar.redo + (shortcutsDisable.indexOf('undo') > -1 ? '' : ' (' + cmd + '+Y / ' + cmd + '+SHIFT+Z)'), 'redo', '', icons.redo], + undo: ['_se_command_undo se-resizing-enabled', lang.toolbar.undo + '' + (shortcutsDisable.indexOf('undo') > -1 ? '' : ' (' + cmd + '+Z)') + '', 'undo', '', icons.undo], + redo: ['_se_command_redo se-resizing-enabled', lang.toolbar.redo + '' + (shortcutsDisable.indexOf('undo') > -1 ? '' : ' (' + cmd + '+Y / ' + cmd + '+SHIFT+Z)') + '', 'redo', '', icons.redo], preview: ['se-resizing-enabled', lang.toolbar.preview, 'preview', '', icons.preview], print: ['se-resizing-enabled', lang.toolbar.print, 'print', '', icons.print], save: ['_se_command_save se-resizing-enabled', lang.toolbar.save, 'save', '', icons.save], @@ -551,7 +551,7 @@ export default { fontColor: ['', lang.toolbar.fontColor, 'fontColor', 'submenu', icons.font_color], hiliteColor: ['', lang.toolbar.hiliteColor, 'hiliteColor', 'submenu', icons.highlight_color], align: ['se-btn-align', lang.toolbar.align, 'align', 'submenu', icons.align_left], - list: ['se-rtl-icon', lang.toolbar.list, 'list', 'submenu', icons.list_number], + list: ['', lang.toolbar.list, 'list', 'submenu', '' + icons.list_number + ''], horizontalRule: ['btn_line', lang.toolbar.horizontalRule, 'horizontalRule', 'submenu', icons.horizontal_rule], table: ['', lang.toolbar.table, 'table', 'submenu', icons.table], lineHeight: ['', lang.toolbar.lineHeight, 'lineHeight', 'submenu', icons.line_height], diff --git a/src/plugins/submenu/list.js b/src/plugins/submenu/list.js index cb7df6f7f..3d3ef93f1 100644 --- a/src/plugins/submenu/list.js +++ b/src/plugins/submenu/list.js @@ -45,11 +45,11 @@ export default { listDiv.innerHTML = '' + '
' + '' + '
'; From 94997969a907b9c7a982c7526b4e06377186a23b Mon Sep 17 00:00:00 2001 From: JiHong88 <0125ses@hanmail.net> Date: Sun, 4 Oct 2020 23:32:54 +0900 Subject: [PATCH 06/38] update: #450 rtl - align, modify: options.rtl > direction, fix: list style --- src/assets/css/suneditor-contents.css | 2 ++ src/assets/css/suneditor.css | 3 ++- src/lib/constructor.js | 4 +-- src/lib/core.js | 3 ++- src/plugins/submenu/align.js | 38 ++++++++++++++++----------- test/dev/suneditor_build_test.js | 2 +- 6 files changed, 32 insertions(+), 20 deletions(-) diff --git a/src/assets/css/suneditor-contents.css b/src/assets/css/suneditor-contents.css index 25c58a124..3ca14d59d 100644 --- a/src/assets/css/suneditor-contents.css +++ b/src/assets/css/suneditor-contents.css @@ -97,6 +97,7 @@ /* ol, ul */ .sun-editor-editable ol { + list-style-position: inside; display: block; list-style-type: decimal; margin-block-start: 1em; @@ -106,6 +107,7 @@ padding-inline-start: 40px; } .sun-editor-editable ul { + list-style-position: inside; display: block; list-style-type: disc; margin-block-start: 1em; diff --git a/src/assets/css/suneditor.css b/src/assets/css/suneditor.css index 0bcc4a30a..266502549 100755 --- a/src/assets/css/suneditor.css +++ b/src/assets/css/suneditor.css @@ -422,13 +422,14 @@ /** --- RTL ---------------------------------------------------------- */ /* tray */ -/* .sun-editor.se-rtl .se-btn-tray {direction:rtl;} */ +.sun-editor.se-rtl .se-btn-tray {direction:rtl;} /* button - se-rtl-icon */ .sun-editor.se-rtl button .se-rtl-icon {display:initial; transform:rotate(0deg) rotateY(180deg);} /* button - select text */ .sun-editor.se-rtl .se-btn-select .txt {flex:auto; text-align:right; direction:rtl;} /* button - se-menu-list */ .sun-editor.se-rtl .se-btn-list {text-align:right;} +.sun-editor.se-rtl .se-btn-list > .se-list-icon {margin:-1px 0 0 10px;} /* button - se-menu-list - li */ .sun-editor.se-rtl .se-menu-list li {float:right;} /* menu list */ diff --git a/src/lib/constructor.js b/src/lib/constructor.js index d22dcff34..81aeb7067 100755 --- a/src/lib/constructor.js +++ b/src/lib/constructor.js @@ -387,7 +387,7 @@ export default { options.attributesWhitelist = (!options.attributesWhitelist || typeof options.attributesWhitelist !== 'object') ? null : options.attributesWhitelist; /** Layout */ options.mode = options.mode || 'classic'; // classic, inline, balloon, balloon-always - options.rtl = !!options.rtl; + options.rtl = /rtl/i.test(options.direction); options.toolbarWidth = options.toolbarWidth ? (util.isNumber(options.toolbarWidth) ? options.toolbarWidth + 'px' : options.toolbarWidth) : 'auto'; options.toolbarContainer = /balloon/i.test(options.mode) ? null : (typeof options.toolbarContainer === 'string' ? document.querySelector(options.toolbarContainer) : options.toolbarContainer); options.stickyToolbar = (/balloon/i.test(options.mode) || !!options.toolbarContainer) ? -1 : options.stickyToolbar === undefined ? 0 : (/^\d+/.test(options.stickyToolbar) ? util.getNumber(options.stickyToolbar, 0) : -1); @@ -550,7 +550,7 @@ export default { fontSize: ['se-btn-select se-btn-tool-size', lang.toolbar.fontSize, 'fontSize', 'submenu', '' + lang.toolbar.fontSize + '' + icons.arrow_down], fontColor: ['', lang.toolbar.fontColor, 'fontColor', 'submenu', icons.font_color], hiliteColor: ['', lang.toolbar.hiliteColor, 'hiliteColor', 'submenu', icons.highlight_color], - align: ['se-btn-align', lang.toolbar.align, 'align', 'submenu', icons.align_left], + align: ['se-btn-align', lang.toolbar.align, 'align', 'submenu', (options.rtl ? icons.align_right : icons.align_left)], list: ['', lang.toolbar.list, 'list', 'submenu', '' + icons.list_number + ''], horizontalRule: ['btn_line', lang.toolbar.horizontalRule, 'horizontalRule', 'submenu', icons.horizontal_rule], table: ['', lang.toolbar.table, 'table', 'submenu', icons.table], diff --git a/src/lib/core.js b/src/lib/core.js index 909a21997..57104150a 100755 --- a/src/lib/core.js +++ b/src/lib/core.js @@ -5201,6 +5201,7 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re if (selectionNode === core.effectNode) return; core.effectNode = selectionNode; + const marginDir = options.rtl ? 'marginRight' : 'marginLeft'; const commandMap = core.commandMap; const classOnCheck = this._onButtonsCheck; const commandMapNodes = []; @@ -5231,7 +5232,7 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re if (util.isFormatElement(element)) { /* Outdent */ if (commandMapNodes.indexOf('OUTDENT') === -1 && commandMap.OUTDENT) { - if (util.isListCell(element) || (element.style.marginLeft && util.getNumber(element.style.marginLeft, 0) > 0)) { + if (util.isListCell(element) || (element.style[marginDir] && util.getNumber(element.style[marginDir], 0) > 0)) { commandMapNodes.push('OUTDENT'); commandMap.OUTDENT.removeAttribute('disabled'); } diff --git a/src/plugins/submenu/align.js b/src/plugins/submenu/align.js index c9a238ab7..3c21c1b8b 100644 --- a/src/plugins/submenu/align.js +++ b/src/plugins/submenu/align.js @@ -17,6 +17,7 @@ export default { targetButton: targetElement, _alignList: null, currentAlign: '', + defaultDir: context.options.rtl ? 'right' : 'left', icons: { justify: icons.align_justify, left: icons.align_left, @@ -44,26 +45,31 @@ export default { const lang = this.lang; const icons = this.icons; const listDiv = this.util.createElement('DIV'); + const leftDir = this.context.align.defaultDir === 'left'; + + const leftMenu = '
  • ' + + '' + + '
  • '; + + const rightMenu = '
  • ' + + '' + + '
  • '; listDiv.className = 'se-submenu se-list-layer se-list-align'; listDiv.innerHTML = '' + '
    ' + '' + '
    '; From 485c5266cf7fb3d4dfff1d287dda12b1b8ef3bbc Mon Sep 17 00:00:00 2001 From: JiHong88 <0125ses@hanmail.net> Date: Tue, 6 Oct 2020 14:27:48 +0900 Subject: [PATCH 09/38] fix: rtl-icons --- src/assets/defaultIcons.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/assets/defaultIcons.js b/src/assets/defaultIcons.js index b11d8575f..6f8ef1f00 100644 --- a/src/assets/defaultIcons.js +++ b/src/assets/defaultIcons.js @@ -16,8 +16,8 @@ export default { outdent: '', list_bullets: '', list_number: '', - link: '', - unlink: '' + link: '', + unlink: '' }, // common, ltr icon redo: '', From 595afc53066eba7a287db2b25908cc72e968366f Mon Sep 17 00:00:00 2001 From: NickyTope Date: Thu, 8 Oct 2020 13:21:14 +1100 Subject: [PATCH 10/38] add mention plugin --- README.md | 53 ++++++++- src/assets/css/suneditor.css | 5 +- src/lang/da.js | 3 + src/lang/de.js | 5 +- src/lang/en.js | 5 +- src/lang/es.js | 5 +- src/lang/fr.js | 3 + src/lang/it.js | 3 + src/lang/ja.js | 5 +- src/lang/ko.js | 5 +- src/lang/lv.js | 5 +- src/lang/pl.js | 5 +- src/lang/pt_br.js | 5 +- src/lang/ro.js | 5 +- src/lang/ru.js | 5 +- src/lang/zh_cn.js | 3 + src/plugins/dialog/mention.d.ts | 5 + src/plugins/dialog/mention.js | 196 +++++++++++++++++++++++++++++++ src/plugins/index.js | 5 +- test/dev/suneditor_build_test.js | 22 +++- 20 files changed, 333 insertions(+), 15 deletions(-) create mode 100644 src/plugins/dialog/mention.d.ts create mode 100644 src/plugins/dialog/mention.js diff --git a/README.md b/README.md index 8f779c35d..df484e008 100644 --- a/README.md +++ b/README.md @@ -294,6 +294,57 @@ suneditor.create('sample', { }); ``` +## Use mention plugin +```javascript +import { mention } from 'suneditor/dist/plugins'; + +// implement your api to find the user to mention. +mention.getItems = async function(term) { + return callApi('/users?q='+escape(term)); +} + +// renderItem shows a user in the list +mention.renderItem = function(user) { + return '' + user.name + ''; +} + +// getId should return a unique id +mention.getId = function(user) { + return user.id; +} + +// getValue should return what you want to display in the editor +mention.getValue = function(user) { + return '@' + user.name; +} + +// getLinkHref should return the link target +mention.getLinkHref = function(user) { + return user.profile; +} + +let editor = suneditor.create('sample', { + plugins: [mention], + buttonList: [ + ['mention'] + ] +}) + +// if you would like to have this triggered when pressing @ +editor.core.callPlugin('mention'); +editor.onKeyDown = e => { + if (e.key === '@') { + editor.core.context.mention.open(); + e.preventDefault(); + e.stopPropagation(); + } +} + +// when saving changes from the editor you will want to obtain the mentions added +let newMentions = editor.core.getMentions(); + +``` + ## Options ```java plugins: [ @@ -1355,4 +1406,4 @@ editor.showController = function (name, controllers, core) { [SunEditor-React](https://github.com/mkhstar/suneditor-react) ([@mkhstar](https://github.com/mkhstar)) - Pure React Component for SunEditor. ## License -Suneditor may be freely distributed under the MIT license. \ No newline at end of file +Suneditor may be freely distributed under the MIT license. diff --git a/src/assets/css/suneditor.css b/src/assets/css/suneditor.css index f7fe01e6d..5dc2a5384 100755 --- a/src/assets/css/suneditor.css +++ b/src/assets/css/suneditor.css @@ -321,6 +321,9 @@ .sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-math-preview > span {display:inline-block; -webkit-box-shadow:0 0 0 0.1rem #c7deff; box-shadow:0 0 0 0.1rem #c7deff;} /* dialog - modal - se-link-preview */ .sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-link-preview {display:block; height:auto; max-height:18px; margin:4px 0 0 4px; font-size:13px; font-weight:normal; font-family:inherit; color:#666; background-color:transparent; overflow:hidden; text-overflow:ellipsis; word-break:break-all; white-space:pre;} +.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-mention-item {line-height:28px;height:25px;padding:0 5px;} +.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-mention-item.se-mention-active {background-color: #ccc; border-radius:3px;} +.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-mention-search {margin-bottom: 10px;} /** --- controller ---------------------------------------------------------- */ .sun-editor .se-controller .se-arrow.se-arrow-up {border-bottom-color:rgba(0, 0, 0, .25);} @@ -419,4 +422,4 @@ /** animation */ @keyframes blinker { 50% {opacity:0;} } -@keyframes spinner { to {transform:rotate(361deg);} } \ No newline at end of file +@keyframes spinner { to {transform:rotate(361deg);} } diff --git a/src/lang/da.js b/src/lang/da.js index 0fd2a00a5..936bcf670 100644 --- a/src/lang/da.js +++ b/src/lang/da.js @@ -112,6 +112,9 @@ tags: 'Tags', search: 'Søg', }, + mentionBox: { + title: 'Tilføj omtale', + }, caption: 'Indsæt beskrivelse', close: 'Luk', submitButton: 'Gennemfør', diff --git a/src/lang/de.js b/src/lang/de.js index 072b39a5d..39c8efc5a 100644 --- a/src/lang/de.js +++ b/src/lang/de.js @@ -109,6 +109,9 @@ tags: 'Stichworte', search: 'Suche', }, + mentionBox: { + title: 'Erwähnung hinzufügen', + }, caption: 'Beschreibung eingeben', close: 'Schließen', submitButton: 'Übernehmen', @@ -180,4 +183,4 @@ } return lang; -})); \ No newline at end of file +})); diff --git a/src/lang/en.js b/src/lang/en.js index 77a93be5d..d51d5420a 100644 --- a/src/lang/en.js +++ b/src/lang/en.js @@ -109,6 +109,9 @@ tags: 'Tags', search: 'Search', }, + mentionBox: { + title: 'Add Mention', + }, caption: 'Insert description', close: 'Close', submitButton: 'Submit', @@ -180,4 +183,4 @@ } return lang; -})); \ No newline at end of file +})); diff --git a/src/lang/es.js b/src/lang/es.js index 5b40e17ae..4d53d216f 100644 --- a/src/lang/es.js +++ b/src/lang/es.js @@ -108,6 +108,9 @@ browser: { tags: 'Etiquetas', search: 'Buscar', + }, + mentionBox: { + title: 'Agregar mención', }, caption: 'Insertar descripción', close: 'Cerrar', @@ -180,4 +183,4 @@ } return lang; -})); \ No newline at end of file +})); diff --git a/src/lang/fr.js b/src/lang/fr.js index 25f43ffa4..1f3219dbe 100644 --- a/src/lang/fr.js +++ b/src/lang/fr.js @@ -109,6 +109,9 @@ tags: 'Mots clés', search: 'Chercher', }, + mentionBox: { + title: 'Ajouter une mention', + }, caption: 'Insérer une description', close: 'Fermer', submitButton: 'Appliquer', diff --git a/src/lang/it.js b/src/lang/it.js index 643d92865..e50231657 100644 --- a/src/lang/it.js +++ b/src/lang/it.js @@ -109,6 +109,9 @@ tags: 'tag', search: 'Ricerca', }, + mentionBox: { + title: 'Aggiungi menzione', + }, caption: 'Inserisci descrizione', close: 'ClChiudiose', submitButton: 'Invia', diff --git a/src/lang/ja.js b/src/lang/ja.js index 9b85d2b3e..60b073b2a 100644 --- a/src/lang/ja.js +++ b/src/lang/ja.js @@ -109,6 +109,9 @@ tags: 'タグ', search: '探す', }, + mentionBox: { + title: '言及を追加', + }, caption: '説明付け', close: '閉じる', submitButton: '確認', @@ -180,4 +183,4 @@ } return lang; -})); \ No newline at end of file +})); diff --git a/src/lang/ko.js b/src/lang/ko.js index cdba34765..4c9d737c5 100644 --- a/src/lang/ko.js +++ b/src/lang/ko.js @@ -109,6 +109,9 @@ tags: '태그', search: '검색', }, + mentionBox: { + title: '언급 추가', + }, caption: '설명 넣기', close: '닫기', submitButton: '확인', @@ -180,4 +183,4 @@ } return lang; -})); \ No newline at end of file +})); diff --git a/src/lang/lv.js b/src/lang/lv.js index dd807f994..6b7f774fa 100644 --- a/src/lang/lv.js +++ b/src/lang/lv.js @@ -109,6 +109,9 @@ tags: 'Tagi', search: 'Meklēt' }, + mentionBox: { + title: 'Pievienot pieminēšanu', + }, caption: 'Ievietot aprakstu', close: 'Aizvērt', submitButton: 'Iesniegt', @@ -180,4 +183,4 @@ } return lang; -})); \ No newline at end of file +})); diff --git a/src/lang/pl.js b/src/lang/pl.js index 1048eba6c..30afbb5ce 100644 --- a/src/lang/pl.js +++ b/src/lang/pl.js @@ -109,6 +109,9 @@ tags: 'Tagi', search: 'Szukaj', }, + mentionBox: { + title: 'Dodaj wzmiankę', + }, caption: 'Wstaw opis', close: 'Zamknij', submitButton: 'Zatwierdź', @@ -180,4 +183,4 @@ } return lang; -})); \ No newline at end of file +})); diff --git a/src/lang/pt_br.js b/src/lang/pt_br.js index 32651d6bd..15346a43d 100644 --- a/src/lang/pt_br.js +++ b/src/lang/pt_br.js @@ -110,6 +110,9 @@ tags: 'Tag', search: 'Procurar', }, + mentionBox: { + title: 'Adicionar menção', + }, caption: 'Inserir descrição', close: 'Fechar', submitButton: 'Enviar', @@ -181,4 +184,4 @@ } return lang; -})); \ No newline at end of file +})); diff --git a/src/lang/ro.js b/src/lang/ro.js index 258e71529..172a7604f 100644 --- a/src/lang/ro.js +++ b/src/lang/ro.js @@ -109,6 +109,9 @@ tags: 'Etichete', search: 'Căutareim', }, + mentionBox: { + title: 'Adăugați mențiune', + }, caption: 'Inserează descriere', close: 'Închide', submitButton: 'Salvează', @@ -180,4 +183,4 @@ } return lang; -})); \ No newline at end of file +})); diff --git a/src/lang/ru.js b/src/lang/ru.js index 62bd21b0f..07a6f1d3b 100644 --- a/src/lang/ru.js +++ b/src/lang/ru.js @@ -109,6 +109,9 @@ tags: 'Теги', search: 'Поиск', }, + mentionBox: { + title: 'Добавить упоминание', + }, caption: 'Добавить подпись', close: 'Закрыть', submitButton: 'Подтвердить', @@ -180,4 +183,4 @@ } return lang; -})); \ No newline at end of file +})); diff --git a/src/lang/zh_cn.js b/src/lang/zh_cn.js index 44f287a84..adb980bd6 100644 --- a/src/lang/zh_cn.js +++ b/src/lang/zh_cn.js @@ -109,6 +109,9 @@ tags: '标签', search: '搜索', }, + mentionBox: { + title: '添加提及', + }, caption: '标题', close: '取消', submitButton: '确定', diff --git a/src/plugins/dialog/mention.d.ts b/src/plugins/dialog/mention.d.ts new file mode 100644 index 000000000..57c462efd --- /dev/null +++ b/src/plugins/dialog/mention.d.ts @@ -0,0 +1,5 @@ +import { DialogPlugin } from '../DialogPlugin'; + +declare const mention: DialogPlugin; + +export default mention; diff --git a/src/plugins/dialog/mention.js b/src/plugins/dialog/mention.js new file mode 100644 index 000000000..8794f540b --- /dev/null +++ b/src/plugins/dialog/mention.js @@ -0,0 +1,196 @@ +/* + * wysiwyg web editor + * + * suneditor.js + * Copyright 2017 JiHong Lee. + * MIT license. + */ +'use strict'; + +import dialog from '../modules/dialog'; + +export default { + name: 'mention', + display: 'dialog', + title: 'mention', + buttonClass: '', + innerHTML: '@', + focussed: 0, + + renderItem: function(item) { + return `${item}`; + }, + + getItems: function(term) { + return Promise.resolve([ + 'overwite', + 'the', + 'mention', + 'plugin', + 'getItems', + 'method', + ].filter(w => w.includes(term.toLowerCase()))); + }, + + renderList: function(term) { + const { mention } = this.context; + mention.getItems(term).then(items => { + mention.items = items; + mention.list.innerHTML = items.map((item, idx) => + `
  • + ${mention.renderItem(item)} +
  • ` + ).join('') + }) + }, + + setDialog: function() { + const mention_dialog = this.util.createElement('DIV'); + const lang = this.lang; + mention_dialog.className = 'se-dialog-content'; + mention_dialog.style.display = 'none'; + const html = ` +
    +
    + + ${lang.dialogBox.mentionBox.title} +
    +
    + +
      +
    +
    +
    + ` + mention_dialog.innerHTML = html; + return mention_dialog; + }, + + getId(mention) { + return mention; + }, + + getValue(mention) { + return `@${mention}`; + }, + + getLinkHref(mention) { + return ''; + }, + + open: function() { + const { mention } = this.context; + this.plugins.dialog.open.call(this, 'mention', 'mention' === this.currentControllerName); + mention.search.focus(); + mention.renderList(''); + }, + + on: function(update) { + if (update) return; + this.plugins.mention.init.call(this); + }, + + init: function() { + const { mention } = this.context; + mention.search.value = ''; + mention.focussed = 0; + }, + + onKeyPress: function(e) { + const { mention } = this.context; + switch (e.key) { + case 'ArrowDown': + mention.focussed += 1; + e.preventDefault(); + e.stopPropagation(); + break; + + case 'ArrowUp': + if (mention.focussed > 0) { + mention.focussed -= 1; + } + e.preventDefault(); + e.stopPropagation(); + break; + + case 'Enter': + mention.add(); + e.preventDefault(); + e.stopPropagation(); + break; + + default: + mention.focussed = 0; + } + + }, + + onKeyUp: function(e) { + const { mention } = this.context; + mention.renderList(e.target.value); + }, + + getMentions: function() { + const { mentions, getId } = this.context.mention; + return mentions.filter(mention => { + const id = getId(mention); + return this.context.element.wysiwyg.querySelector(`[data-mention="${id}"]`) + } + ) + }, + + addMention: function() { + const { mention } = this.context; + const new_mention = mention.items[mention.focussed]; + if (new_mention) { + if (!mention.mentions.find(m => mention.getId(m) === mention.getId(new_mention))) { + mention.mentions.push(new_mention); + } + const el = this.util.createElement('A') + el.href = mention.getLinkHref(new_mention); + el.target = '_blank'; + el.innerHTML = mention.getValue(new_mention); + el.setAttribute('data-mention', mention.getId(new_mention)); + this.insertNode(el, null, false); + const spacer =this.util.createElement('SPAN'); + spacer.innerHTML = ' '; + this.insertNode(spacer, el, false) + } + this.plugins.dialog.close.call(this); + }, + add: function(core) { + core.addModule([dialog]); + const _dialog = this.setDialog.call(core); + core.getMentions = this.getMentions.bind(core); + + const search = _dialog.querySelector('.se-mention-search'); + search.addEventListener('keyup', this.onKeyUp.bind(core)); + search.addEventListener('keydown', this.onKeyPress.bind(core)); + const list = _dialog.querySelector('.se-mention-list'); + + core.context.mention = { + modal: _dialog, + search, + list, + triggerKey: this.triggerKey, + visible: false, + add: this.addMention.bind(core), + mentions: [], + items: [], + renderList: this.renderList.bind(core), + getId: this.getId.bind(core), + getValue: this.getValue.bind(core), + getLinkHref: this.getLinkHref.bind(core), + open: this.open.bind(core), + focussed: this.focussed, + renderItem: this.renderItem, + getItems: this.getItems, + } + core.context.dialog.modal.appendChild(_dialog); + }, + action: function() { } +}; diff --git a/src/plugins/index.js b/src/plugins/index.js index f8c44a2b1..8a9bc2a0a 100644 --- a/src/plugins/index.js +++ b/src/plugins/index.js @@ -24,9 +24,10 @@ import image from './dialog/image'; import video from './dialog/video'; import audio from './dialog/audio'; import math from './dialog/math'; +import mention from './dialog/mention'; // file browser import imageGallery from './fileBrowser/imageGallery'; -export { blockquote, align, font, fontSize, fontColor, hiliteColor, horizontalRule, list, table, formatBlock, lineHeight, template, paragraphStyle, textStyle, link, image, video, audio, math, imageGallery }; -export default { blockquote, align, font, fontSize, fontColor, hiliteColor, horizontalRule, list, table, formatBlock, lineHeight, template, paragraphStyle, textStyle, link, image, video, audio, math, imageGallery }; +export { blockquote, align, font, fontSize, fontColor, hiliteColor, horizontalRule, list, table, formatBlock, lineHeight, template, paragraphStyle, textStyle, link, image, video, audio, math, imageGallery, mention }; +export default { blockquote, align, font, fontSize, fontColor, hiliteColor, horizontalRule, list, table, formatBlock, lineHeight, template, paragraphStyle, textStyle, link, image, video, audio, math, imageGallery, mention }; diff --git a/test/dev/suneditor_build_test.js b/test/dev/suneditor_build_test.js index 9bd41b787..38968c230 100644 --- a/test/dev/suneditor_build_test.js +++ b/test/dev/suneditor_build_test.js @@ -261,6 +261,16 @@ s1.onKeyDown = function (e, core) { } } +plugins.mention.getItems = async term => + [ + {name: 'user1'}, + {name: 'user2'} + ].filter(u => u.name.includes(term)); + +plugins.mention.getValue = ({ name }) => `@${name}`; +plugins.mention.getId = ({ name }) => name; +plugins.mention.renderItem = ({name}) => `${name}`; + let ss = window.ss = suneditor.create(document.getElementById('editor1'), { lang: lang.ko, plugins: plugins, @@ -677,6 +687,7 @@ let s2 = window.s2 = editor.create(document.getElementById('editor2'), { // ['paragraphStyle'], // ['bold', 'underline', 'italic', 'strike', 'subscript', 'superscript'], ['fontColor', 'hiliteColor', 'textStyle'], + ['mention'], // ['removeFormat'], // ['outdent', 'indent'], // ['align', 'horizontalRule', 'list', 'lineHeight', 'table'], @@ -727,6 +738,15 @@ let s2 = window.s2 = editor.create(document.getElementById('editor2'), { // imageUploadSizeLimit: 30000 }); +s2.core.callPlugin('mention'); +s2.onKeyDown = e => { + if (e.key === '@') { + s2.core.context.mention.open(); + e.preventDefault(); + e.stopPropagation(); + } +} + const newOption = { mode: 'balloon', iframe: false, @@ -1016,4 +1036,4 @@ window.sun_create4 = function() { // console.log('callback') // } }); -} \ No newline at end of file +} From 94a2d5016beac9066002043e6e8075f5c9b45518 Mon Sep 17 00:00:00 2001 From: NickyTope Date: Thu, 8 Oct 2020 13:30:59 +1100 Subject: [PATCH 11/38] prettier, lint passing --- src/plugins/dialog/mention.js | 114 ++++++++++++++++++---------------- 1 file changed, 61 insertions(+), 53 deletions(-) diff --git a/src/plugins/dialog/mention.js b/src/plugins/dialog/mention.js index 8794f540b..f93a423da 100644 --- a/src/plugins/dialog/mention.js +++ b/src/plugins/dialog/mention.js @@ -5,16 +5,16 @@ * Copyright 2017 JiHong Lee. * MIT license. */ -'use strict'; +"use strict"; -import dialog from '../modules/dialog'; +import dialog from "../modules/dialog"; export default { - name: 'mention', - display: 'dialog', - title: 'mention', - buttonClass: '', - innerHTML: '@', + name: "mention", + display: "dialog", + title: "mention", + buttonClass: "", + innerHTML: "@", focussed: 0, renderItem: function(item) { @@ -22,35 +22,35 @@ export default { }, getItems: function(term) { - return Promise.resolve([ - 'overwite', - 'the', - 'mention', - 'plugin', - 'getItems', - 'method', - ].filter(w => w.includes(term.toLowerCase()))); + return Promise.resolve( + ["overwite", "the", "mention", "plugin", "getItems", "method"].filter( + (w) => w.includes(term.toLowerCase()) + ) + ); }, renderList: function(term) { const { mention } = this.context; - mention.getItems(term).then(items => { + mention.getItems(term).then((items) => { mention.items = items; - mention.list.innerHTML = items.map((item, idx) => - `
  • + mention.list.innerHTML = items + .map( + (item, idx) => + `
  • ${mention.renderItem(item)}
  • ` - ).join('') - }) + ) + .join(""); + }); }, setDialog: function() { - const mention_dialog = this.util.createElement('DIV'); + const mention_dialog = this.util.createElement("DIV"); const lang = this.lang; - mention_dialog.className = 'se-dialog-content'; - mention_dialog.style.display = 'none'; + mention_dialog.className = "se-dialog-content"; + mention_dialog.style.display = "none"; const html = `
    @@ -65,7 +65,7 @@ export default {
    - ` + `; mention_dialog.innerHTML = html; return mention_dialog; }, @@ -78,15 +78,19 @@ export default { return `@${mention}`; }, - getLinkHref(mention) { - return ''; + getLinkHref(/*mention*/) { + return ""; }, open: function() { const { mention } = this.context; - this.plugins.dialog.open.call(this, 'mention', 'mention' === this.currentControllerName); + this.plugins.dialog.open.call( + this, + "mention", + "mention" === this.currentControllerName + ); mention.search.focus(); - mention.renderList(''); + mention.renderList(""); }, on: function(update) { @@ -96,20 +100,20 @@ export default { init: function() { const { mention } = this.context; - mention.search.value = ''; + mention.search.value = ""; mention.focussed = 0; }, onKeyPress: function(e) { const { mention } = this.context; switch (e.key) { - case 'ArrowDown': + case "ArrowDown": mention.focussed += 1; e.preventDefault(); e.stopPropagation(); break; - case 'ArrowUp': + case "ArrowUp": if (mention.focussed > 0) { mention.focussed -= 1; } @@ -117,16 +121,15 @@ export default { e.stopPropagation(); break; - case 'Enter': + case "Enter": mention.add(); e.preventDefault(); e.stopPropagation(); break; - + default: mention.focussed = 0; } - }, onKeyUp: function(e) { @@ -136,29 +139,34 @@ export default { getMentions: function() { const { mentions, getId } = this.context.mention; - return mentions.filter(mention => { + return mentions.filter((mention) => { const id = getId(mention); - return this.context.element.wysiwyg.querySelector(`[data-mention="${id}"]`) - } - ) + return this.context.element.wysiwyg.querySelector( + `[data-mention="${id}"]` + ); + }); }, addMention: function() { const { mention } = this.context; const new_mention = mention.items[mention.focussed]; if (new_mention) { - if (!mention.mentions.find(m => mention.getId(m) === mention.getId(new_mention))) { + if ( + !mention.mentions.find( + (m) => mention.getId(m) === mention.getId(new_mention) + ) + ) { mention.mentions.push(new_mention); } - const el = this.util.createElement('A') + const el = this.util.createElement("A"); el.href = mention.getLinkHref(new_mention); - el.target = '_blank'; + el.target = "_blank"; el.innerHTML = mention.getValue(new_mention); - el.setAttribute('data-mention', mention.getId(new_mention)); + el.setAttribute("data-mention", mention.getId(new_mention)); this.insertNode(el, null, false); - const spacer =this.util.createElement('SPAN'); - spacer.innerHTML = ' '; - this.insertNode(spacer, el, false) + const spacer = this.util.createElement("SPAN"); + spacer.innerHTML = " "; + this.insertNode(spacer, el, false); } this.plugins.dialog.close.call(this); }, @@ -167,10 +175,10 @@ export default { const _dialog = this.setDialog.call(core); core.getMentions = this.getMentions.bind(core); - const search = _dialog.querySelector('.se-mention-search'); - search.addEventListener('keyup', this.onKeyUp.bind(core)); - search.addEventListener('keydown', this.onKeyPress.bind(core)); - const list = _dialog.querySelector('.se-mention-list'); + const search = _dialog.querySelector(".se-mention-search"); + search.addEventListener("keyup", this.onKeyUp.bind(core)); + search.addEventListener("keydown", this.onKeyPress.bind(core)); + const list = _dialog.querySelector(".se-mention-list"); core.context.mention = { modal: _dialog, @@ -189,8 +197,8 @@ export default { focussed: this.focussed, renderItem: this.renderItem, getItems: this.getItems, - } + }; core.context.dialog.modal.appendChild(_dialog); }, - action: function() { } + action: function() {}, }; From 55b3c4600910e9936d870a7ecf81c1f40b7dd3c5 Mon Sep 17 00:00:00 2001 From: NickyTope Date: Thu, 8 Oct 2020 13:31:20 +1100 Subject: [PATCH 12/38] build --- dist/css/suneditor.min.css | 2 +- dist/suneditor.min.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dist/css/suneditor.min.css b/dist/css/suneditor.min.css index c2db424cd..eaf9c8117 100644 --- a/dist/css/suneditor.min.css +++ b/dist/css/suneditor.min.css @@ -1 +1 @@ -.sun-editor{width:auto;height:auto;box-sizing:border-box;font-family:Helvetica Neue,sans-serif;border:1px solid #dadada;text-align:left;background-color:#fff;color:#000;user-select:none;-o-user-select:none;-moz-user-select:none;-khtml-user-select:none;-webkit-user-select:none;-ms-user-select:none}.sun-editor *{box-sizing:border-box;-webkit-user-drag:none;overflow:visible}.sun-editor-common button,.sun-editor-common input,.sun-editor-common select,.sun-editor-common textarea{font-size:14px;line-height:1.5}.sun-editor-common blockquote,.sun-editor-common body,.sun-editor-common button,.sun-editor-common code,.sun-editor-common dd,.sun-editor-common div,.sun-editor-common dl,.sun-editor-common dt,.sun-editor-common fieldset,.sun-editor-common form,.sun-editor-common h1,.sun-editor-common h2,.sun-editor-common h3,.sun-editor-common h4,.sun-editor-common h5,.sun-editor-common h6,.sun-editor-common input,.sun-editor-common legend,.sun-editor-common li,.sun-editor-common ol,.sun-editor-common p,.sun-editor-common pre,.sun-editor-common select,.sun-editor-common td,.sun-editor-common textarea,.sun-editor-common th,.sun-editor-common ul{margin:0;padding:0;border:0}.sun-editor-common dl,.sun-editor-common li,.sun-editor-common menu,.sun-editor-common ol,.sun-editor-common ul{list-style:none!important}.sun-editor-common hr{margin:6px 0!important}.sun-editor textarea{resize:none;border:0;padding:0}.sun-editor button{border:0;background-color:transparent;touch-action:manipulation;cursor:pointer;outline:none}.sun-editor button,.sun-editor input,.sun-editor select,.sun-editor textarea{vertical-align:middle}.sun-editor button span{display:block;margin:0;padding:0}.sun-editor button .txt{display:block;margin-top:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.sun-editor button *{pointer-events:none;backface-visibility:hidden;-webkit-backface-visibility:hidden;-moz-backface-visibility:hidden}.sun-editor .se-svg,.sun-editor button>svg{width:16px;height:16px;margin:auto;fill:currentColor;display:block;text-align:center;float:none}.sun-editor .close>svg,.sun-editor .se-dialog-close>svg{width:10px;height:10px}.sun-editor .se-btn-select>svg{float:right;width:10px;height:10px}.sun-editor .se-btn-list>.se-list-icon{display:inline-block;width:16px;height:16px;margin:-1px 10px 0 0;vertical-align:middle}.sun-editor .se-line-breaker>button>svg{width:24px;height:24px}.sun-editor button>i:before{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;display:inline-block;font-style:normal;font-variant:normal;text-rendering:auto;font-size:15px;line-height:2}.sun-editor button>[class=se-icon-text]{font-size:20px;line-height:1}.sun-editor .se-arrow,.sun-editor .se-arrow:after{position:absolute;display:block;width:0;height:0;border:11px solid transparent}.sun-editor .se-arrow.se-arrow-up{top:-11px;left:20px;margin-left:-11px;border-top-width:0;border-bottom-color:rgba(0,0,0,.25)}.sun-editor .se-arrow.se-arrow-up:after{top:1px;margin-left:-11px;content:" ";border-top-width:0;border-bottom-color:#fff}.sun-editor .se-toolbar .se-arrow.se-arrow-up:after{border-bottom-color:#fafafa}.sun-editor .se-arrow.se-arrow-down{top:0;left:0;margin-left:-11px;border-bottom-width:0;border-top-color:rgba(0,0,0,.25)}.sun-editor .se-arrow.se-arrow-down:after{top:-12px;margin-left:-11px;content:" ";border-bottom-width:0;border-top-color:#fff}.sun-editor .se-toolbar .se-arrow.se-arrow-down:after{border-top-color:#fafafa}.sun-editor .se-container{position:relative;width:100%;height:100%}.sun-editor button{color:#000}.sun-editor .se-btn{float:left;width:34px;height:34px;border:0;border-radius:4px;margin:1px!important;padding:0;font-size:12px;line-height:27px}.sun-editor .se-btn:enabled:focus,.sun-editor .se-btn:enabled:hover{background-color:#e1e1e1;border-color:#d1d1d1;outline:0 none}.sun-editor .se-btn:enabled:active{background-color:#d1d1d1;border-color:#c1c1c1;-webkit-box-shadow:inset 0 3px 5px #c1c1c1;box-shadow:inset 0 3px 5px #c1c1c1}.sun-editor .se-btn-primary{color:#000;background-color:#c7deff;border:1px solid #80bdff;border-radius:4px}.sun-editor .se-btn-primary:focus,.sun-editor .se-btn-primary:hover{color:#000;background-color:#80bdff;border-color:#3f9dff;outline:0 none}.sun-editor .se-btn-primary:active{color:#fff;background-color:#3f9dff;border-color:#4592ff;-webkit-box-shadow:inset 0 3px 5px #4592ff;box-shadow:inset 0 3px 5px #4592ff}.sun-editor input,.sun-editor select,.sun-editor textarea{color:#000;border:1px solid #ccc;border-radius:4px}.sun-editor input:focus,.sun-editor select:focus,.sun-editor textarea:focus{border:1px solid #80bdff;outline:0;-webkit-box-shadow:0 0 0 .2rem #c7deff;box-shadow:0 0 0 .2rem #c7deff;transition:border-color .15s ease-in-out,box-shadow .15s ease-in-out}.sun-editor .se-btn:enabled.active{color:#4592ff;outline:0 none}.sun-editor .se-btn:enabled.active:focus,.sun-editor .se-btn:enabled.active:hover{background-color:#e1e1e1;border-color:#d1d1d1;outline:0 none}.sun-editor .se-btn:enabled.active:active{background-color:#d1d1d1;border-color:#c1c1c1;-webkit-box-shadow:inset 0 3px 5px #c1c1c1;box-shadow:inset 0 3px 5px #c1c1c1}.sun-editor .se-btn:enabled.on{background-color:#e1e1e1;border-color:#d1d1d1;outline:0 none}.sun-editor .se-btn:enabled.on:focus,.sun-editor .se-btn:enabled.on:hover{background-color:#d1d1d1;border-color:#c1c1c1;outline:0 none}.sun-editor .se-btn:enabled.on:active{background-color:#c1c1c1;border-color:#b1b1b1;-webkit-box-shadow:inset 0 3px 5px #b1b1b1;box-shadow:inset 0 3px 5px #b1b1b1}.sun-editor .se-btn-list:disabled,.sun-editor .se-btn:disabled,.sun-editor button:disabled{cursor:not-allowed;background-color:inherit;color:#bdbdbd}.sun-editor .se-loading-box{position:absolute;display:none;width:100%;height:100%;top:0;left:0;background-color:#fff;opacity:.7;filter:alpha(opacity=70);z-index:2147483647}.sun-editor .se-loading-box .se-loading-effect{position:absolute;display:block;top:50%;left:50%;height:25px;width:25px;border-top:2px solid #07d;border-right:2px solid transparent;border-radius:50%;animation:spinner .8s linear infinite;margin:-25px 0 0 -25px}.sun-editor .se-line-breaker{position:absolute;display:none;width:100%;height:1px;cursor:text;border-top:1px solid #3288ff;z-index:7}.sun-editor .se-line-breaker>button.se-btn{position:relative;display:inline-block;width:30px;height:30px;top:-15px;float:none;left:-50%;background-color:#fff;border:1px solid #0c2240;opacity:.6;cursor:pointer}.sun-editor .se-line-breaker>button.se-btn:hover{opacity:.9;background-color:#fff;border-color:#041b39}.sun-editor .se-line-breaker-component{position:absolute;display:none;width:24px;height:24px;background-color:#fff;border:1px solid #0c2240;opacity:.6;border-radius:4px;cursor:pointer;z-index:7}.sun-editor .se-line-breaker-component:hover{opacity:.9}.sun-editor .se-toolbar{display:block;position:relative;height:auto;width:100%;overflow:visible;padding:4px 3px 0;margin:0;background-color:#fafafa;outline:1px solid #dadada;z-index:5}.sun-editor .se-toolbar-cover{position:absolute;display:none;font-size:36px;width:100%;height:100%;top:0;left:0;background-color:#fefefe;opacity:.5;filter:alpha(opacity=50);cursor:not-allowed;z-index:4}.sun-editor .se-toolbar-separator-vertical{display:inline-block;height:0;width:0;margin:1px;vertical-align:top}.sun-editor .se-toolbar.se-toolbar-balloon,.sun-editor .se-toolbar.se-toolbar-inline{display:none;position:absolute;z-index:2147483647;box-shadow:0 3px 9px rgba(0,0,0,.5);-webkit-box-shadow:0 3px 9px rgba(0,0,0,.5)}.sun-editor .se-toolbar.se-toolbar-balloon{width:auto}.sun-editor .se-toolbar.se-toolbar-sticky{position:fixed;top:0}.sun-editor .se-toolbar-sticky-dummy{display:none;position:static;z-index:-1}.sun-editor .se-btn-module{display:inline-block}.sun-editor .se-btn-module-border{border:1px solid #dadada;border-radius:4px}.sun-editor .se-btn-module-enter{display:block;width:100%;height:1px;margin-bottom:5px;background-color:transparent}.sun-editor .se-toolbar-more-layer{margin:0 -3px;background-color:#f3f3f3}.sun-editor .se-toolbar-more-layer .se-more-layer{display:none;border-top:1px solid #dadada}.sun-editor .se-toolbar-more-layer .se-more-layer .se-more-form{display:inline-block;width:100%;height:auto;padding:4px 3px 0}.sun-editor .se-btn-module .se-btn-more.se-btn-more-text{width:auto;padding:0 4px}.sun-editor .se-btn-module .se-btn-more:focus,.sun-editor .se-btn-module .se-btn-more:hover{color:#000;background-color:#d1d1d1;border-color:#c1c1c1;outline:0 none}.sun-editor .se-btn-module .se-btn-more.on{color:#333;background-color:#d1d1d1;border-color:#c1c1c1;outline:0 none}.sun-editor .se-btn-module .se-btn-more.on:hover{color:#000;background-color:#c1c1c1;border-color:#b1b1b1;outline:0 none}.sun-editor .se-menu-list,.sun-editor .se-menu-list li{float:left;padding:0;margin:0}.sun-editor .se-menu-list li{position:relative}.sun-editor .se-btn-select{width:auto;display:flex;text-align:left;padding:4px 6px}.sun-editor .se-btn-select .txt{flex:auto;float:left;text-align:left}.sun-editor .se-btn-select.se-btn-tool-font{width:100px}.sun-editor .se-btn-select.se-btn-tool-format,.sun-editor .se-btn-select.se-btn-tool-size{width:80px}.sun-editor .se-btn-tray{position:relative;width:100%;height:100%;margin:0;padding:0}.sun-editor .se-menu-tray{position:absolute;top:0;left:0;width:100%;height:0}.sun-editor .se-submenu{overflow-x:hidden;overflow-y:auto}.sun-editor .se-list-layer{display:none;position:absolute;top:0;left:0;height:auto;z-index:5;border:1px solid #bababa;border-radius:4px;padding:6px 0;background-color:#fff;-webkit-box-shadow:0 3px 9px rgba(0,0,0,.5);box-shadow:0 3px 9px rgba(0,0,0,.5);outline:0 none}.sun-editor .se-list-layer .se-list-inner{padding:0;margin:0;overflow-x:initial;overflow-y:initial;overflow:visible}.sun-editor .se-list-layer button{margin:0;width:100%}.sun-editor .se-list-inner .se-list-basic{width:100%;padding:0}.sun-editor .se-list-inner .se-list-basic li{width:100%}.sun-editor .se-list-inner .se-list-basic li>button{min-width:100%;width:max-content}.sun-editor .se-list-inner .se-list-basic li button.active{background-color:#80bdff;border:1px solid #3f9dff;border-left:0;border-right:0}.sun-editor .se-list-inner .se-list-basic li button.active:hover{background-color:#3f9dff;border:1px solid #4592ff;border-left:0;border-right:0}.sun-editor .se-list-inner .se-list-basic li button.active:active{background-color:#4592ff;border:1px solid #407dd1;border-left:0;border-right:0;-webkit-box-shadow:inset 0 3px 5px #407dd1;box-shadow:inset 0 3px 5px #407dd1}.sun-editor .se-btn-list{width:100%;height:auto;min-height:32px;padding:0 14px;cursor:pointer;font-size:12px;line-height:normal;text-indent:0;text-decoration:none;text-align:left}.sun-editor .se-btn-list.default_value{background-color:#f3f3f3;border-top:1px dotted #b1b1b1;border-bottom:1px dotted #b1b1b1}.sun-editor .se-btn-list:focus,.sun-editor .se-btn-list:hover{background-color:#e1e1e1;border-color:#d1d1d1;outline:0 none}.sun-editor .se-btn-list:active{background-color:#d1d1d1;border-color:#c1c1c1;-webkit-box-shadow:inset 0 3px 5px #c1c1c1;box-shadow:inset 0 3px 5px #c1c1c1}.sun-editor .se-list-layer.se-list-font-size{min-width:140px;max-height:300px}.sun-editor .se-list-layer.se-list-font-family{min-width:156px}.sun-editor .se-list-layer.se-list-font-family .default{border-bottom:1px solid #ccc}.sun-editor .se-list-layer.se-list-line{width:125px}.sun-editor .se-list-layer.se-list-align .se-list-inner{left:9px;width:125px}.sun-editor .se-list-layer.se-list-format{min-width:156px}.sun-editor .se-list-layer.se-list-format li{padding:0;width:100%}.sun-editor .se-list-layer.se-list-format ul .se-btn-list{line-height:100%}.sun-editor .se-list-layer.se-list-format ul .se-btn-list[data-value=h1]{height:40px}.sun-editor .se-list-layer.se-list-format ul .se-btn-list[data-value=h2]{height:34px}.sun-editor .se-list-layer.se-list-format ul p{font-size:13px}.sun-editor .se-list-layer.se-list-format ul div{font-size:13px;padding:4px 2px}.sun-editor .se-list-layer.se-list-format ul h1{font-size:2em;font-weight:700;color:#333}.sun-editor .se-list-layer.se-list-format ul h2{font-size:1.5em;font-weight:700;color:#333}.sun-editor .se-list-layer.se-list-format ul h3{font-size:1.17em;font-weight:700;color:#333}.sun-editor .se-list-layer.se-list-format ul h4{font-size:1em;font-weight:700;color:#333}.sun-editor .se-list-layer.se-list-format ul h5{font-size:.83em;font-weight:700;color:#333}.sun-editor .se-list-layer.se-list-format ul h6{font-size:.67em;font-weight:700;color:#333}.sun-editor .se-list-layer.se-list-format ul blockquote{font-size:13px;color:#999;height:22px;margin:0;background-color:transparent;line-height:1.5;border-color:#b1b1b1;padding:0 0 0 7px;border-left:5px #b1b1b1;border-style:solid}.sun-editor .se-list-layer.se-list-format ul pre{font-size:13px;color:#666;padding:4px 11px;margin:0;background-color:#f9f9f9;border:1px solid #e1e1e1;border-radius:4px}.sun-editor .se-selector-table{display:none;position:absolute;top:34px;left:1px;z-index:5;padding:5px 0;float:left;margin:2px 0 0;font-size:14px;text-align:left;list-style:none;background-color:#fff;-webkit-background-clip:padding-box;background-clip:padding-box;border:1px solid #ccc;border-radius:4px;-webkit-box-shadow:0 6px 12px rgba(0,0,0,.175);box-shadow:0 6px 12px rgba(0,0,0,.175)}.sun-editor .se-selector-table .se-table-size{font-size:18px;padding:0 5px}.sun-editor .se-selector-table .se-table-size-picker{position:absolute!important;z-index:3;font-size:18px;width:10em;height:10em;cursor:pointer}.sun-editor .se-selector-table .se-table-size-highlighted{position:absolute!important;z-index:2;font-size:18px;width:1em;height:1em;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAAZdEVYdFNvZnR3YXJlAEFkb2JlIEltYWdlUmVhZHlxyWU8AAADJmlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNS42LWMxNDIgNzkuMTYwOTI0LCAyMDE3LzA3LzEzLTAxOjA2OjM5ICAgICAgICAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPiA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDo4QTZCNzMzN0I3RUYxMUU4ODcwQ0QwMjM1NTgzRTJDNyIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDo4QTZCNzMzNkI3RUYxMUU4ODcwQ0QwMjM1NTgzRTJDNyIgeG1wOkNyZWF0b3JUb29sPSJBZG9iZSBQaG90b3Nob3AgQ0MgMjAxOCAoV2luZG93cykiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDo0MzYyNEUxRUI3RUUxMUU4ODZGQzgwRjNBODgyNTdFOSIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDo0MzYyNEUxRkI3RUUxMUU4ODZGQzgwRjNBODgyNTdFOSIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/Pl0yAuwAAABBSURBVDhPY/wPBAxUAGCDGvdBeWSAeicIDTfIXREiQArYeR9hEBOEohyMGkQYjBpEGAxjg6ib+yFMygCVvMbAAABj0hwMTNeKJwAAAABJRU5ErkJggg==") repeat}.sun-editor .se-selector-table .se-table-size-unhighlighted{position:relative!important;z-index:1;font-size:18px;width:10em;height:10em;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASAgMAAAAroGbEAAAACVBMVEUAAIj4+Pjp6ekKlAqjAAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAACxMAAAsTAQCanBgAAAAHdElNRQfYAR0BKhmnaJzPAAAAG0lEQVQI12NgAAOtVatWMTCohoaGUY+EmIkEAEruEzK2J7tvAAAAAElFTkSuQmCC") repeat}.sun-editor .se-selector-table .se-table-size-display{padding-left:5px}.sun-editor .se-list-layer .se-selector-color{display:flex;width:max-content;max-width:270px;height:auto;padding:0;margin:auto}.sun-editor .se-list-layer .se-selector-color .se-color-pallet{width:100%;height:100%;padding:0}.sun-editor .se-list-layer .se-selector-color .se-color-pallet li{display:flex;float:left;position:relative;margin:0}.sun-editor .se-list-layer .se-selector-color .se-color-pallet button{display:block;cursor:default;width:30px;height:30px;text-indent:-9999px}.sun-editor .se-list-layer .se-selector-color .se-color-pallet button.active,.sun-editor .se-list-layer .se-selector-color .se-color-pallet button:focus,.sun-editor .se-list-layer .se-selector-color .se-color-pallet button:hover{border:3px solid #fff}.sun-editor .se-submenu-form-group{display:flex;width:100%;height:auto;padding:4px}.sun-editor .se-submenu-form-group input{flex:auto;display:inline-block;width:auto;height:33px;color:#555;font-size:12px;margin:1px 0;padding:0;border-radius:.25rem;border:1px solid #ccc}.sun-editor .se-submenu-form-group button{float:right;width:34px;height:34px;margin:0 0 0 4px!important}.sun-editor .se-submenu-form-group button.se-btn{border:1px solid #ccc}.sun-editor .se-submenu-form-group>div{position:relative}.sun-editor .se-submenu-form-group .se-color-input{width:72px;text-transform:uppercase;border:none;border-bottom:2px solid #b1b1b1;outline:none}.sun-editor .se-submenu-form-group .se-color-input:focus{border-bottom:3px solid #b1b1b1}.sun-editor .se-wrapper{position:relative!important;width:100%;height:auto;overflow:hidden;z-index:1}.sun-editor .se-wrapper .se-wrapper-inner{width:100%;height:100%;min-height:65px;overflow-y:auto;overflow-x:auto;-webkit-overflow-scrolling:touch;user-select:text;-o-user-select:text;-moz-user-select:text;-khtml-user-select:text;-webkit-user-select:text;-ms-user-select:text}.sun-editor .se-wrapper .se-wrapper-inner:focus{outline:none}.sun-editor .se-wrapper .se-wrapper-code{background-color:#191919;color:#fff;font-size:13px;word-break:break-all;padding:4px;margin:0;resize:none!important}.sun-editor .se-wrapper .se-wrapper-wysiwyg{background-color:#fff;display:block}.sun-editor .se-wrapper .se-wrapper-code-mirror{font-size:13px}.sun-editor .se-wrapper .se-placeholder{position:absolute;display:none;white-space:nowrap;text-overflow:ellipsis;z-index:1;color:#b1b1b1;font-size:13px;line-height:1.5;top:0;left:0;right:0;overflow:hidden;margin-top:0;padding-top:16px;padding-left:16px;margin-left:0;padding-right:16px;margin-right:0;pointer-events:none;backface-visibility:hidden;-webkit-backface-visibility:hidden;-moz-backface-visibility:hidden}.sun-editor .se-resizing-bar{display:flex;width:auto;height:auto;min-height:16px;border-top:1px solid #dadada;padding:0 4px;background-color:#fafafa;cursor:ns-resize}.sun-editor .se-resizing-bar.se-resizing-none{cursor:default}.sun-editor .se-resizing-back{position:absolute;display:none;cursor:default;top:0;left:0;width:100%;height:100%;z-index:2147483647}.sun-editor .se-resizing-bar .se-navigation{flex:auto;position:relative;width:auto;height:auto;color:#666;margin:0;padding:0;font-size:10px;font-weight:700;line-height:1.5;background:transparent}.sun-editor .se-resizing-bar .se-char-counter-wrapper{flex:none;position:relative;display:block;width:auto;height:auto;margin:0;padding:0;color:#999;font-size:13px;background:transparent}.sun-editor .se-resizing-bar .se-char-counter-wrapper.se-blink{color:#b94a48;animation:blinker .2s linear infinite}.sun-editor .se-resizing-bar .se-char-counter-wrapper .se-char-label{margin-right:4px}.sun-editor .se-dialog{position:absolute;display:none;top:0;left:0;width:100%;height:100%;z-index:2147483647}.sun-editor .se-dialog button,.sun-editor .se-dialog input,.sun-editor .se-dialog label{font-size:14px;line-height:1.5;color:#111;margin:0}.sun-editor .se-dialog .se-dialog-back{background-color:#222;opacity:.5}.sun-editor .se-dialog .se-dialog-back,.sun-editor .se-dialog .se-dialog-inner{position:absolute;width:100%;height:100%;top:0;left:0}.sun-editor .se-dialog .se-dialog-inner .se-dialog-content{position:relative;width:auto;max-width:500px;margin:20px auto;background-color:#fff;-webkit-background-clip:padding-box;background-clip:padding-box;border:1px solid rgba(0,0,0,.2);border-radius:4px;outline:0;-webkit-box-shadow:0 3px 9px rgba(0,0,0,.5);box-shadow:0 3px 9px rgba(0,0,0,.5)}@media screen and (max-width:509px){.sun-editor .se-dialog .se-dialog-inner .se-dialog-content{width:100%}}.sun-editor .se-dialog .se-dialog-inner .se-dialog-content label{display:inline-block;max-width:100%;margin-bottom:5px;font-weight:700}.sun-editor .se-dialog .se-dialog-inner .se-dialog-content .se-btn-primary{display:inline-block;padding:6px 12px;margin:0 0 10px!important;font-size:14px;font-weight:400;line-height:1.42857143;text-align:center;white-space:nowrap;vertical-align:middle;-ms-touch-action:manipulation;touch-action:manipulation;border-radius:4px}.sun-editor .se-dialog .se-dialog-inner .se-dialog-header{height:50px;padding:6px 15px;border-bottom:1px solid #e5e5e5}.sun-editor .se-dialog .se-dialog-inner .se-dialog-header .se-dialog-close{float:right;font-weight:700;text-shadow:0 1px 0 #fff;-webkit-appearance:none;filter:alpha(opacity=100);opacity:1}.sun-editor .se-dialog .se-dialog-inner .se-dialog-header .se-modal-title{font-size:14px;font-weight:700;margin:0;padding:0;line-height:2.5}.sun-editor .se-dialog .se-dialog-inner .se-dialog-body{position:relative;padding:15px}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form{margin-bottom:10px}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form-footer{margin-top:10px;margin-bottom:0}.sun-editor .se-dialog .se-dialog-inner input:disabled{background-color:#f3f3f3}.sun-editor .se-dialog .se-dialog-inner .se-dialog-size-text{width:100%}.sun-editor .se-dialog .se-dialog-inner .se-dialog-size-text .size-h,.sun-editor .se-dialog .se-dialog-inner .se-dialog-size-text .size-w{width:70px;text-align:center}.sun-editor .se-dialog .se-dialog-inner .se-dialog-size-x{margin:0 8px;width:25px;text-align:center}.sun-editor .se-dialog .se-dialog-inner .se-dialog-footer{padding:10px 15px 0;text-align:right;border-top:1px solid #e5e5e5}.sun-editor .se-dialog .se-dialog-inner .se-dialog-footer>div{float:left}.sun-editor .se-dialog .se-dialog-inner .se-dialog-footer>div>label{margin-top:5px}.sun-editor .se-dialog .se-dialog-inner .se-dialog-btn-radio{margin-left:12px;margin-right:6px}.sun-editor .se-dialog .se-dialog-inner .se-dialog-btn-check{margin-left:12px;margin-right:4px}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form-footer .se-dialog-btn-check{margin-left:0;margin-right:4px}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-dialog-form-files{position:relative;display:flex;align-items:center}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-dialog-form-files>input{flex:auto}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-dialog-form-files .se-dialog-files-edge-button{flex:auto;opacity:.8;border:1px solid #ccc}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-dialog-form-files .se-dialog-files-edge-button.se-file-remove>svg{width:8px;height:8px}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-dialog-form-files .se-dialog-files-edge-button:hover{background-color:#f0f0f0;outline:0 none}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-dialog-form-files .se-dialog-files-edge-button:active{background-color:#e9e9e9;-webkit-box-shadow:inset 0 3px 5px #d6d6d6;box-shadow:inset 0 3px 5px #d6d6d6}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-input-select{display:inline-block;width:auto;height:34px;font-size:14px;text-align:center;line-height:1.42857143}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-input-control{display:inline-block;width:70px;height:34px;font-size:14px;text-align:center;line-height:1.42857143}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-input-form{display:block;width:100%;height:34px;font-size:14px;line-height:1.42857143;padding:0 4px}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-input-form.se-input-url:disabled{text-decoration:line-through;color:#999}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-video-ratio{width:70px;margin-left:4px}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form a{color:#004cff}.sun-editor .se-dialog .se-dialog-inner .se-dialog-btn-revert{border:1px solid #ccc}.sun-editor .se-dialog .se-dialog-inner .se-dialog-btn-revert:hover{background-color:#e1e1e1;border-color:#d1d1d1;outline:0 none}.sun-editor .se-dialog .se-dialog-inner .se-dialog-btn-revert:active{background-color:#d1d1d1;border-color:#c1c1c1;-webkit-box-shadow:inset 0 3px 5px #c1c1c1;box-shadow:inset 0 3px 5px #c1c1c1}.sun-editor .se-dialog-tabs{width:100%;height:25px;border-bottom:1px solid #e5e5e5}.sun-editor .se-dialog-tabs button{background-color:#e5e5e5;border-right:1px solid #e5e5e5;float:left;outline:none;padding:2px 13px;transition:.3s}.sun-editor .se-dialog-tabs button:hover{background-color:#fff}.sun-editor .se-dialog-tabs button.active{background-color:#fff;border-bottom:0}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-input-form.se-math-exp{resize:vertical;height:4rem;border:1px solid #ccc;font-size:13px;padding:4px}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-input-select.se-math-size{width:6em;height:28px;margin-left:1em}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-math-preview{font-size:13px}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-math-preview>span{display:inline-block;-webkit-box-shadow:0 0 0 .1rem #c7deff;box-shadow:0 0 0 .1rem #c7deff}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-link-preview{display:block;height:auto;max-height:18px;margin:4px 0 0 4px;font-size:13px;font-weight:400;font-family:inherit;color:#666;background-color:transparent;overflow:hidden;text-overflow:ellipsis;word-break:break-all;white-space:pre}.sun-editor .se-controller .se-arrow.se-arrow-up{border-bottom-color:rgba(0,0,0,.25)}.sun-editor .se-controller{position:absolute;display:none;overflow:visible;z-index:6;border:1px solid rgba(0,0,0,.25);border-radius:4px;text-align:start;text-decoration:none;text-shadow:none;text-transform:none;letter-spacing:normal;word-break:normal;word-spacing:normal;word-wrap:normal;white-space:normal;background-color:#fff;-webkit-background-clip:padding-box;background-clip:padding-box;-webkit-box-shadow:0 5px 10px rgba(0,0,0,.2);box-shadow:0 5px 10px rgba(0,0,0,.2);line-break:auto}.sun-editor .se-controller .se-btn-group{position:relative;display:flex;vertical-align:middle;padding:2px;top:0;left:0}.sun-editor .se-controller .se-btn-group .se-btn-group-sub{left:50%;min-width:auto;width:max-content;display:none}.sun-editor .se-controller .se-btn-group .se-btn-group-sub button{margin:0;min-width:72px}.sun-editor .se-controller .se-btn-group button{position:relative;min-height:34px;height:auto;border:none;border-radius:4px;margin:1px;padding:5px 10px;font-size:12px;line-height:1.5;display:inline-block;font-weight:400;text-align:center;white-space:nowrap;vertical-align:middle;-ms-touch-action:manipulation;touch-action:manipulation}.sun-editor .se-controller .se-btn-group button:focus:enabled,.sun-editor .se-controller .se-btn-group button:hover:enabled{background-color:#e1e1e1;border-color:#d1d1d1;outline:0 none}.sun-editor .se-controller .se-btn-group button:active:enabled{background-color:#d1d1d1;border-color:#c1c1c1;-webkit-box-shadow:inset 0 3px 5px #c1c1c1;box-shadow:inset 0 3px 5px #c1c1c1}.sun-editor .se-controller .se-btn-group button span{display:block;padding:0;margin:0}.sun-editor .se-controller .se-btn-group button:enabled.active{color:#4592ff;outline:0 none}.sun-editor .se-controller .se-btn-group button:enabled.active:focus,.sun-editor .se-controller .se-btn-group button:enabled.active:hover{background-color:#e1e1e1;border-color:#d1d1d1;outline:0 none}.sun-editor .se-controller .se-btn-group button:enabled.active:active{background-color:#d1d1d1;border-color:#c1c1c1;-webkit-box-shadow:inset 0 3px 5px #c1c1c1;box-shadow:inset 0 3px 5px #c1c1c1}.sun-editor .se-controller .se-btn-group button:enabled.on{background-color:#e1e1e1;border-color:#d1d1d1;outline:0 none}.sun-editor .se-controller .se-btn-group button:enabled.on:focus,.sun-editor .se-controller .se-btn-group button:enabled.on:hover{background-color:#d1d1d1;border-color:#c1c1c1;outline:0 none}.sun-editor .se-controller .se-btn-group button:enabled.on:active{background-color:#c1c1c1;border-color:#b1b1b1;-webkit-box-shadow:inset 0 3px 5px #b1b1b1;box-shadow:inset 0 3px 5px #b1b1b1}.sun-editor .se-controller-resizing{margin-top:-50px!important;padding:0;font-size:14px;font-style:normal;font-weight:400;line-height:1.42857143}.sun-editor .se-controller-resizing .se-btn-group .se-btn-group-sub.se-resizing-align-list{left:57px;width:74px}.sun-editor .se-resizing-container{position:absolute;display:none;outline:1px solid #3f9dff;background-color:transparent}.sun-editor .se-resizing-container .se-modal-resize{position:absolute;display:inline-block;background-color:#3f9dff;opacity:.3}.sun-editor .se-resizing-container .se-resize-dot{position:absolute;top:0;left:0;width:100%;height:100%}.sun-editor .se-resizing-container .se-resize-dot>span{position:absolute;width:7px;height:7px;background-color:#3f9dff;border:1px solid #4592ff}.sun-editor .se-resizing-container .se-resize-dot>span.tl{top:-5px;left:-5px;cursor:nw-resize}.sun-editor .se-resizing-container .se-resize-dot>span.tr{top:-5px;right:-5px;cursor:ne-resize}.sun-editor .se-resizing-container .se-resize-dot>span.bl{bottom:-5px;left:-5px;cursor:sw-resize}.sun-editor .se-resizing-container .se-resize-dot>span.br{right:-5px;bottom:-5px;cursor:se-resize}.sun-editor .se-resizing-container .se-resize-dot>span.lw{left:-7px;bottom:50%;cursor:w-resize}.sun-editor .se-resizing-container .se-resize-dot>span.th{left:50%;top:-7px;cursor:n-resize}.sun-editor .se-resizing-container .se-resize-dot>span.rw{right:-7px;bottom:50%;cursor:e-resize}.sun-editor .se-resizing-container .se-resize-dot>span.bh{right:50%;bottom:-7px;cursor:s-resize}.sun-editor .se-resizing-container .se-resize-display{position:absolute;right:0;bottom:0;padding:5px;margin:5px;font-size:12px;color:#fff;background-color:#333;border-radius:4px}.sun-editor .se-controller-table,.sun-editor .se-controller-table-cell{width:auto}.sun-editor .se-controller-link,.sun-editor .se-controller-table,.sun-editor .se-controller-table-cell{padding:0;font-size:14px;font-style:normal;font-weight:400;line-height:1.42857143}.sun-editor .se-controller-link:after,.sun-editor .se-controller-link:before{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.sun-editor .se-controller-link .link-content{padding:0;margin:0}.sun-editor .se-controller-link .link-content a{display:inline-block;color:#4592ff;max-width:200px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;vertical-align:middle;margin-left:5px}.sun-editor .se-file-browser{position:absolute;display:none;top:0;left:0;width:100%;height:100%;z-index:2147483647}.sun-editor .se-file-browser button,.sun-editor .se-file-browser input,.sun-editor .se-file-browser label{font-size:14px;line-height:1.5;color:#111;margin:0}.sun-editor .se-file-browser .se-file-browser-back{background-color:#222;opacity:.5}.sun-editor .se-file-browser .se-file-browser-back,.sun-editor .se-file-browser .se-file-browser-inner{position:absolute;display:block;width:100%;height:100%;top:0;left:0}.sun-editor .se-file-browser .se-file-browser-inner .se-file-browser-content{position:relative;width:960px;max-width:100%;margin:20px auto;background-color:#fff;-webkit-background-clip:padding-box;background-clip:padding-box;border:1px solid rgba(0,0,0,.2);border-radius:4px;outline:0;-webkit-box-shadow:0 3px 9px rgba(0,0,0,.5);box-shadow:0 3px 9px rgba(0,0,0,.5)}.sun-editor .se-file-browser .se-file-browser-header{height:auto;min-height:50px;padding:6px 15px;border-bottom:1px solid #e5e5e5}.sun-editor .se-file-browser .se-file-browser-header .se-file-browser-close{float:right;font-weight:700;text-shadow:0 1px 0 #fff;-webkit-appearance:none;filter:alpha(opacity=100);opacity:1}.sun-editor .se-file-browser .se-file-browser-header .se-file-browser-close>svg{width:12px;height:12px}.sun-editor .se-file-browser .se-file-browser-header .se-file-browser-title{font-size:16px;font-weight:700;margin:0;padding:0;line-height:2.2}.sun-editor .se-file-browser .se-file-browser-tags{display:block;width:100%;padding:0;text-align:left;margin:0 -15px}.sun-editor .se-file-browser .se-file-browser-tags a{display:inline-block;background-color:#f5f5f5;padding:6px 12px;margin:8px 0 8px 8px;color:#333;text-decoration:none;border-radius:32px;-moz-border-radius:32px;-webkit-border-radius:32px;-moz-background-clip:padding;-webkit-background-clip:padding-box;background-clip:padding-box;cursor:pointer}.sun-editor .se-file-browser .se-file-browser-tags a:hover{background-color:#e1e1e1}.sun-editor .se-file-browser .se-file-browser-tags a:active{background-color:#d1d1d1}.sun-editor .se-file-browser .se-file-browser-tags a.on{background-color:#ebf3fe;color:#4592ff}.sun-editor .se-file-browser .se-file-browser-tags a.on:hover{background-color:#d8e8fe}.sun-editor .se-file-browser .se-file-browser-tags a.on:active{background-color:#c7deff}.sun-editor .se-file-browser .se-file-browser-body{position:relative;height:auto;min-height:350px;padding:20px;overflow-y:auto}.sun-editor .se-file-browser .se-file-browser-body .se-file-browser-list{position:relative;width:100%}@media screen and (max-width:992px){.sun-editor .se-file-browser .se-file-browser-inner .se-file-browser-content{width:748px}}@media screen and (max-width:768px){.sun-editor .se-file-browser .se-file-browser-inner .se-file-browser-content{width:600px}}.sun-editor .se-file-browser .se-file-browser-list .se-file-item-column{position:relative;display:block;height:auto;float:left}.sun-editor .se-file-browser .se-file-browser-list.se-image-list .se-file-item-column{width:calc(25% - 20px);margin:0 10px}@media screen and (max-width:992px){.sun-editor .se-file-browser .se-file-browser-list.se-image-list .se-file-item-column{width:calc(33% - 20px)}}@media screen and (max-width:768px){.sun-editor .se-file-browser .se-file-browser-list.se-image-list .se-file-item-column{width:calc(50% - 20px)}}.sun-editor .se-file-browser .se-file-browser-list.se-image-list .se-file-item-img{position:relative;display:block;cursor:pointer;width:100%;height:auto;border-radius:4px;outline:0;margin:10px 0}.sun-editor .se-file-browser .se-file-browser-list.se-image-list .se-file-item-img:hover{opacity:.8;-webkit-box-shadow:0 0 0 .2rem #3288ff;box-shadow:0 0 0 .2rem #3288ff}.sun-editor .se-file-browser .se-file-browser-list.se-image-list .se-file-item-img>img{position:relative;display:block;width:100%;border-radius:4px;outline:0;height:auto}.sun-editor .se-file-browser .se-file-browser-list.se-image-list .se-file-item-img>.se-file-img-name{position:absolute;z-index:1;font-size:13px;color:#fff;left:0;bottom:0;padding:5px 10px;background-color:transparent;width:100%;height:30px;border-bottom-right-radius:4px;border-bottom-left-radius:4px}.sun-editor .se-file-browser .se-file-browser-list.se-image-list .se-file-item-img>.se-file-img-name.se-file-name-back{background-color:#333;opacity:.6}.sun-editor .se-notice{position:absolute;top:0;display:none;z-index:7;width:100%;height:auto;word-break:break-all;font-size:13px;color:#b94a48;background-color:#f2dede;padding:15px;margin:0;border:1px solid #eed3d7;user-select:text;-o-user-select:text;-moz-user-select:text;-khtml-user-select:text;-webkit-user-select:text;-ms-user-select:text}.sun-editor .se-notice button{float:right;padding:7px}.sun-editor .se-tooltip{position:relative;overflow:visible}.sun-editor .se-tooltip .se-tooltip-inner{visibility:hidden;position:absolute;display:block;width:auto;top:120%;left:50%;background:transparent;opacity:0;z-index:1;line-height:1.5;transition:opacity .5s;margin:0;padding:0;bottom:auto;float:none;pointer-events:none;backface-visibility:hidden;-webkit-backface-visibility:hidden;-moz-backface-visibility:hidden}.sun-editor .se-tooltip .se-tooltip-inner .se-tooltip-text{position:relative;display:inline-block;width:auto;left:-50%;font-size:.9em;margin:0;padding:4px 6px;border-radius:2px;background-color:#333;color:#fff;text-align:center;line-height:unset;white-space:nowrap;cursor:auto}.sun-editor .se-tooltip .se-tooltip-inner .se-tooltip-text:after{content:"";position:absolute;bottom:100%;left:50%;margin-left:-5px;border:5px solid transparent;border-bottom-color:#333}.sun-editor .se-tooltip:hover .se-tooltip-inner{visibility:visible;opacity:1}@keyframes blinker{50%{opacity:0}}@keyframes spinner{to{transform:rotate(361deg)}}.sun-editor-editable{font-family:Helvetica Neue,sans-serif;font-size:13px;color:#333;line-height:1.5;text-align:left;background-color:#fff;word-break:normal;word-wrap:break-word;padding:16px;margin:0}.sun-editor-editable *{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;font-family:inherit;font-size:inherit;color:inherit}.sun-editor-editable audio,.sun-editor-editable figcaption,.sun-editor-editable figure,.sun-editor-editable iframe,.sun-editor-editable img,.sun-editor-editable td,.sun-editor-editable th,.sun-editor-editable video{position:relative}.sun-editor-editable .__se__float-left{float:left}.sun-editor-editable .__se__float-right{float:right}.sun-editor-editable .__se__float-center{float:center}.sun-editor-editable .__se__float-none{float:none}.sun-editor-editable :not(.se-code-language .katex) span{display:inline;vertical-align:baseline;margin:0;padding:0}.sun-editor-editable span.katex{display:inline-block}.sun-editor-editable a{color:#004cff;text-decoration:none}.sun-editor-editable span[style~="color:"] a{color:inherit}.sun-editor-editable a:focus,.sun-editor-editable a:hover{cursor:pointer;color:#0093ff;text-decoration:underline}.sun-editor-editable pre{display:block;padding:8px;margin:0 0 10px;font-family:monospace;color:#666;line-height:1.45;background-color:#f9f9f9;border:1px solid #e1e1e1;border-radius:2px;white-space:pre-wrap;word-wrap:break-word;overflow:visible}.sun-editor-editable ol{list-style-type:decimal}.sun-editor-editable ol,.sun-editor-editable ul{display:block;margin-block-start:1em;margin-block-end:1em;margin-inline-start:0;margin-inline-end:0;padding-inline-start:40px}.sun-editor-editable ul{list-style-type:disc}.sun-editor-editable li{display:list-item;text-align:-webkit-match-parent;margin-bottom:5px}.sun-editor-editable ol ol,.sun-editor-editable ol ul,.sun-editor-editable ul ol,.sun-editor-editable ul ul{margin:0}.sun-editor-editable ol ol,.sun-editor-editable ul ol{list-style-type:lower-alpha}.sun-editor-editable ol ol ol,.sun-editor-editable ul ol ol,.sun-editor-editable ul ul ol{list-style-type:upper-roman}.sun-editor-editable ol ul,.sun-editor-editable ul ul{list-style-type:circle}.sun-editor-editable ol ol ul,.sun-editor-editable ol ul ul,.sun-editor-editable ul ul ul{list-style-type:square}.sun-editor-editable sub,.sun-editor-editable sup{font-size:75%;line-height:0}.sun-editor-editable sub{vertical-align:sub}.sun-editor-editable sup{vertical-align:super}.sun-editor-editable p{display:block;margin:0 0 10px}.sun-editor-editable div{display:block;margin:0;padding:0}.sun-editor-editable blockquote{display:block;font-family:inherit;font-size:inherit;color:#999;margin-block-start:1em;margin-block-end:1em;margin-inline-start:0;margin-inline-end:0;padding:0 5px 0 20px;border:solid #b1b1b1;border-width:0 0 0 5px}.sun-editor-editable blockquote blockquote{border-color:#c1c1c1}.sun-editor-editable blockquote blockquote blockquote{border-color:#d1d1d1}.sun-editor-editable blockquote blockquote blockquote blockquote{border-color:#e1e1e1}.sun-editor-editable h1{font-size:2em;margin-block-start:.67em;margin-block-end:.67em}.sun-editor-editable h1,.sun-editor-editable h2{display:block;margin-inline-start:0;margin-inline-end:0;font-weight:700}.sun-editor-editable h2{font-size:1.5em;margin-block-start:.83em;margin-block-end:.83em}.sun-editor-editable h3{font-size:1.17em;margin-block-start:1em;margin-block-end:1em}.sun-editor-editable h3,.sun-editor-editable h4{display:block;margin-inline-start:0;margin-inline-end:0;font-weight:700}.sun-editor-editable h4{font-size:1em;margin-block-start:1.33em;margin-block-end:1.33em}.sun-editor-editable h5{font-size:.83em;margin-block-start:1.67em;margin-block-end:1.67em}.sun-editor-editable h5,.sun-editor-editable h6{display:block;margin-inline-start:0;margin-inline-end:0;font-weight:700}.sun-editor-editable h6{font-size:.67em;margin-block-start:2.33em;margin-block-end:2.33em}.sun-editor-editable hr{display:flex;border-width:1px 0 0;border-color:#000;border-image:initial;height:1px}.sun-editor-editable hr.__se__solid{border-style:solid none none}.sun-editor-editable hr.__se__dotted{border-style:dotted none none}.sun-editor-editable hr.__se__dashed{border-style:dashed none none}.sun-editor-editable table{display:table;table-layout:auto;border:1px solid #ccc;width:100%;max-width:100%;margin:0 0 10px;background-color:transparent;border-spacing:0;border-collapse:collapse}.sun-editor-editable table thead{border-bottom:2px solid #333}.sun-editor-editable table tr{border:1px solid #efefef}.sun-editor-editable table th{background-color:#f3f3f3}.sun-editor-editable table td,.sun-editor-editable table th{border:1px solid #e1e1e1;padding:.4em;background-clip:padding-box}.sun-editor-editable table.se-table-size-auto{width:auto!important}.sun-editor-editable table.se-table-size-100{width:100%!important}.sun-editor-editable table.se-table-layout-auto{table-layout:auto!important}.sun-editor-editable table.se-table-layout-fixed{table-layout:fixed!important}.sun-editor-editable table td.se-table-selected-cell,.sun-editor-editable table th.se-table-selected-cell{border:1px double #4592ff;background-color:#f1f7ff}.sun-editor-editable.se-disabled *{user-select:none;-o-user-select:none;-moz-user-select:none;-khtml-user-select:none;-webkit-user-select:none;-ms-user-select:none}.sun-editor-editable .se-component{display:flex;padding:1px;margin:0 0 10px}.sun-editor-editable .se-component.__se__float-left{margin:0 20px 10px 0}.sun-editor-editable .se-component.__se__float-right{margin:0 0 10px 20px}.sun-editor-editable[contenteditable=true] .se-component{outline:1px dashed #e1e1e1}.sun-editor-editable[contenteditable=true] .se-component.se-component-copy{-webkit-box-shadow:0 0 0 .2rem #80bdff;box-shadow:0 0 0 .2rem #3f9dff;transition:border-color .15s ease-in-out,box-shadow .15s ease-in-out}.sun-editor-editable audio,.sun-editor-editable iframe,.sun-editor-editable img,.sun-editor-editable video{display:block;margin:0;padding:0;width:auto;height:auto;max-width:100%}.sun-editor-editable[contenteditable=true] figure:after{position:absolute;content:"";z-index:1;top:0;left:0;right:0;bottom:0;cursor:default;display:block;background:transparent}.sun-editor-editable[contenteditable=true] figure a,.sun-editor-editable[contenteditable=true] figure iframe,.sun-editor-editable[contenteditable=true] figure img,.sun-editor-editable[contenteditable=true] figure video{z-index:0}.sun-editor-editable[contenteditable=true] figure figcaption{display:block;z-index:2}.sun-editor-editable[contenteditable=true] figure figcaption:focus{border-color:#80bdff;outline:0;-webkit-box-shadow:0 0 0 .2rem #c7deff;box-shadow:0 0 0 .2rem #c7deff}.sun-editor-editable .se-image-container,.sun-editor-editable .se-video-container{width:auto;height:auto;max-width:100%}.sun-editor-editable figure{display:block;outline:none;margin:0;padding:0}.sun-editor-editable figure figcaption{padding:1em .5em;margin:0;background-color:#f9f9f9;outline:none}.sun-editor-editable figure figcaption p{line-height:2;margin:0}.sun-editor-editable .se-image-container a img{padding:1px;margin:1px;outline:1px solid #4592ff}.sun-editor-editable .se-video-container iframe,.sun-editor-editable .se-video-container video{outline:1px solid #9e9e9e;position:absolute;top:0;left:0;border:0;width:100%;height:100%}.sun-editor-editable .se-video-container figure{left:0;width:100%;max-width:100%}.sun-editor-editable audio{width:300px;height:54px}.sun-editor-editable audio.active{outline:2px solid #80bdff}.sun-editor-editable.se-show-block div,.sun-editor-editable.se-show-block h1,.sun-editor-editable.se-show-block h2,.sun-editor-editable.se-show-block h3,.sun-editor-editable.se-show-block h4,.sun-editor-editable.se-show-block h5,.sun-editor-editable.se-show-block h6,.sun-editor-editable.se-show-block li,.sun-editor-editable.se-show-block ol,.sun-editor-editable.se-show-block p,.sun-editor-editable.se-show-block pre,.sun-editor-editable.se-show-block ul{border:1px dashed #3f9dff!important;padding:14px 8px 8px!important}.sun-editor-editable.se-show-block ol,.sun-editor-editable.se-show-block ul{border:1px dashed #d539ff!important}.sun-editor-editable.se-show-block pre{border:1px dashed #27c022!important}.se-show-block p{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAAPAQMAAAAF7dc0AAAABlBMVEWAgID////n1o2sAAAAAnRSTlP/AOW3MEoAAAAaSURBVAjXY/j/gwGCPvxg+F4BQiAGDP1HQQByxxw0gqOzIwAAAABJRU5ErkJggg==") no-repeat}.se-show-block div{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABUAAAAPAQMAAAAxlBYoAAAABlBMVEWAgID////n1o2sAAAAAnRSTlP/AOW3MEoAAAAmSURBVAjXY/j//wcDDH+8XsHwDYi/hwNx1A8w/nYLKH4XoQYJAwCXnSgcl2MOPgAAAABJRU5ErkJggg==") no-repeat}.se-show-block h1{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAPAQMAAAA4f7ZSAAAABlBMVEWAgID////n1o2sAAAAAnRSTlP/AOW3MEoAAAAfSURBVAjXY/j/v4EBhr+9B+LzEPrDeygfhI8j1CBhAEhmJGY4Rf6uAAAAAElFTkSuQmCC") no-repeat}.se-show-block h2{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAPAQMAAAA4f7ZSAAAABlBMVEWAgID////n1o2sAAAAAnRSTlP/AOW3MEoAAAAmSURBVAjXY/j/v4EBhr+dB+LtQPy9geEDEH97D8T3gbgdoQYJAwA51iPuD2haEAAAAABJRU5ErkJggg==") no-repeat}.se-show-block h3{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAPAQMAAAA4f7ZSAAAABlBMVEWAgID////n1o2sAAAAAnRSTlP/AOW3MEoAAAAiSURBVAjXY/j/v4EBhr+dB+LtQPy9geHDeQgN5p9HqEHCADeWI+69VG2MAAAAAElFTkSuQmCC") no-repeat}.se-show-block h4{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAAPAQMAAADTSA1RAAAABlBMVEWAgID////n1o2sAAAAAnRSTlP/AOW3MEoAAAAiSURBVAjXY/j//wADDH97DsTXIfjDdiDdDMTfIRhZHRQDAKJOJ6L+K3y7AAAAAElFTkSuQmCC") no-repeat}.se-show-block h5{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAPAQMAAAA4f7ZSAAAABlBMVEWAgID////n1o2sAAAAAnRSTlP/AOW3MEoAAAAlSURBVAjXY/j/v4EBhr+1A/F+IO5vYPiwHUh/B2IQfR6hBgkDABlWIy5uM+9GAAAAAElFTkSuQmCC") no-repeat}.se-show-block h6{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAPAQMAAAA4f7ZSAAAABlBMVEWAgID////n1o2sAAAAAnRSTlP/AOW3MEoAAAAiSURBVAjXY/j/v4EBhr+dB+LtQLy/geFDP5S9HSKOrA6KAR9GIza1ptJnAAAAAElFTkSuQmCC") no-repeat}.se-show-block li{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAPCAYAAADkmO9VAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAA7SURBVDhPYxgFcNDQ0PAfykQBIHEYhgoRB/BpwCfHBKWpBkaggYxQGgOgBzyQD1aLLA4TGwWDGjAwAACR3RcEU9Ui+wAAAABJRU5ErkJggg==") no-repeat}.se-show-block ol{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAMCAYAAABiDJ37AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAABHSURBVDhPYxgFcNDQ0PAfhKFcFIBLHCdA1oBNM0kGEmMAPgOZoDTVANUNxAqQvURMECADRiiNAWCagDSGGhyW4DRrMAEGBgAu0SX6WpGgjAAAAABJRU5ErkJggg==") no-repeat}.se-show-block ul{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAMCAYAAABiDJ37AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAA1SURBVDhPYxgFDA0NDf+hTBSALI5LDQgwQWmqgVEDKQcsUBoF4ItFGEBXA+QzQpmDGjAwAAA8DQ4Lni6gdAAAAABJRU5ErkJggg==") no-repeat}.sun-editor-editable .__se__p-bordered,.sun-editor .__se__p-bordered{border-top:1px solid #b1b1b1;border-bottom:1px solid #b1b1b1;padding:4px 0}.sun-editor-editable .__se__p-spaced,.sun-editor .__se__p-spaced{letter-spacing:1px}.sun-editor-editable .__se__p-neon,.sun-editor .__se__p-neon{font-weight:200;font-style:italic;background:#000;color:#fff;padding:6px 4px;border:2px solid #fff;border-radius:6px;text-transform:uppercase;animation:neonFlicker 1.5s infinite alternate}@keyframes neonFlicker{0%,19%,21%,23%,25%,54%,56%,to{text-shadow:-.2rem -.2rem 1rem #fff,.2rem .2rem 1rem #fff,0 0 2px #f40,0 0 4px #f40,0 0 6px #f40,0 0 8px #f40,0 0 10px #f40;box-shadow:0 0 .5px #fff,inset 0 0 .5px #fff,0 0 2px #08f,inset 0 0 2px #08f,0 0 4px #08f,inset 0 0 4px #08f}20%,24%,55%{text-shadow:none;box-shadow:none}}.sun-editor-editable .__se__t-shadow,.sun-editor .__se__t-shadow{text-shadow:-.2rem -.2rem 1rem #fff,.2rem .2rem 1rem #fff,0 0 .2rem #999,0 0 .4rem #888,0 0 .6rem #777,0 0 .8rem #666,0 0 1rem #555}.sun-editor-editable .__se__t-code,.sun-editor .__se__t-code{font-family:monospace;color:#666;background-color:rgba(27,31,35,.05);border-radius:6px;padding:.2em .4em} \ No newline at end of file +.sun-editor{width:auto;height:auto;box-sizing:border-box;font-family:Helvetica Neue,sans-serif;border:1px solid #dadada;text-align:left;background-color:#fff;color:#000;user-select:none;-o-user-select:none;-moz-user-select:none;-khtml-user-select:none;-webkit-user-select:none;-ms-user-select:none}.sun-editor *{box-sizing:border-box;-webkit-user-drag:none;overflow:visible}.sun-editor-common button,.sun-editor-common input,.sun-editor-common select,.sun-editor-common textarea{font-size:14px;line-height:1.5}.sun-editor-common blockquote,.sun-editor-common body,.sun-editor-common button,.sun-editor-common code,.sun-editor-common dd,.sun-editor-common div,.sun-editor-common dl,.sun-editor-common dt,.sun-editor-common fieldset,.sun-editor-common form,.sun-editor-common h1,.sun-editor-common h2,.sun-editor-common h3,.sun-editor-common h4,.sun-editor-common h5,.sun-editor-common h6,.sun-editor-common input,.sun-editor-common legend,.sun-editor-common li,.sun-editor-common ol,.sun-editor-common p,.sun-editor-common pre,.sun-editor-common select,.sun-editor-common td,.sun-editor-common textarea,.sun-editor-common th,.sun-editor-common ul{margin:0;padding:0;border:0}.sun-editor-common dl,.sun-editor-common li,.sun-editor-common menu,.sun-editor-common ol,.sun-editor-common ul{list-style:none!important}.sun-editor-common hr{margin:6px 0!important}.sun-editor textarea{resize:none;border:0;padding:0}.sun-editor button{border:0;background-color:transparent;touch-action:manipulation;cursor:pointer;outline:none}.sun-editor button,.sun-editor input,.sun-editor select,.sun-editor textarea{vertical-align:middle}.sun-editor button span{display:block;margin:0;padding:0}.sun-editor button .txt{display:block;margin-top:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.sun-editor button *{pointer-events:none;backface-visibility:hidden;-webkit-backface-visibility:hidden;-moz-backface-visibility:hidden}.sun-editor .se-svg,.sun-editor button>svg{width:16px;height:16px;margin:auto;fill:currentColor;display:block;text-align:center;float:none}.sun-editor .close>svg,.sun-editor .se-dialog-close>svg{width:10px;height:10px}.sun-editor .se-btn-select>svg{float:right;width:10px;height:10px}.sun-editor .se-btn-list>.se-list-icon{display:inline-block;width:16px;height:16px;margin:-1px 10px 0 0;vertical-align:middle}.sun-editor .se-line-breaker>button>svg{width:24px;height:24px}.sun-editor button>i:before{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;display:inline-block;font-style:normal;font-variant:normal;text-rendering:auto;font-size:15px;line-height:2}.sun-editor button>[class=se-icon-text]{font-size:20px;line-height:1}.sun-editor .se-arrow,.sun-editor .se-arrow:after{position:absolute;display:block;width:0;height:0;border:11px solid transparent}.sun-editor .se-arrow.se-arrow-up{top:-11px;left:20px;margin-left:-11px;border-top-width:0;border-bottom-color:rgba(0,0,0,.25)}.sun-editor .se-arrow.se-arrow-up:after{top:1px;margin-left:-11px;content:" ";border-top-width:0;border-bottom-color:#fff}.sun-editor .se-toolbar .se-arrow.se-arrow-up:after{border-bottom-color:#fafafa}.sun-editor .se-arrow.se-arrow-down{top:0;left:0;margin-left:-11px;border-bottom-width:0;border-top-color:rgba(0,0,0,.25)}.sun-editor .se-arrow.se-arrow-down:after{top:-12px;margin-left:-11px;content:" ";border-bottom-width:0;border-top-color:#fff}.sun-editor .se-toolbar .se-arrow.se-arrow-down:after{border-top-color:#fafafa}.sun-editor .se-container{position:relative;width:100%;height:100%}.sun-editor button{color:#000}.sun-editor .se-btn{float:left;width:34px;height:34px;border:0;border-radius:4px;margin:1px!important;padding:0;font-size:12px;line-height:27px}.sun-editor .se-btn:enabled:focus,.sun-editor .se-btn:enabled:hover{background-color:#e1e1e1;border-color:#d1d1d1;outline:0 none}.sun-editor .se-btn:enabled:active{background-color:#d1d1d1;border-color:#c1c1c1;-webkit-box-shadow:inset 0 3px 5px #c1c1c1;box-shadow:inset 0 3px 5px #c1c1c1}.sun-editor .se-btn-primary{color:#000;background-color:#c7deff;border:1px solid #80bdff;border-radius:4px}.sun-editor .se-btn-primary:focus,.sun-editor .se-btn-primary:hover{color:#000;background-color:#80bdff;border-color:#3f9dff;outline:0 none}.sun-editor .se-btn-primary:active{color:#fff;background-color:#3f9dff;border-color:#4592ff;-webkit-box-shadow:inset 0 3px 5px #4592ff;box-shadow:inset 0 3px 5px #4592ff}.sun-editor input,.sun-editor select,.sun-editor textarea{color:#000;border:1px solid #ccc;border-radius:4px}.sun-editor input:focus,.sun-editor select:focus,.sun-editor textarea:focus{border:1px solid #80bdff;outline:0;-webkit-box-shadow:0 0 0 .2rem #c7deff;box-shadow:0 0 0 .2rem #c7deff;transition:border-color .15s ease-in-out,box-shadow .15s ease-in-out}.sun-editor .se-btn:enabled.active{color:#4592ff;outline:0 none}.sun-editor .se-btn:enabled.active:focus,.sun-editor .se-btn:enabled.active:hover{background-color:#e1e1e1;border-color:#d1d1d1;outline:0 none}.sun-editor .se-btn:enabled.active:active{background-color:#d1d1d1;border-color:#c1c1c1;-webkit-box-shadow:inset 0 3px 5px #c1c1c1;box-shadow:inset 0 3px 5px #c1c1c1}.sun-editor .se-btn:enabled.on{background-color:#e1e1e1;border-color:#d1d1d1;outline:0 none}.sun-editor .se-btn:enabled.on:focus,.sun-editor .se-btn:enabled.on:hover{background-color:#d1d1d1;border-color:#c1c1c1;outline:0 none}.sun-editor .se-btn:enabled.on:active{background-color:#c1c1c1;border-color:#b1b1b1;-webkit-box-shadow:inset 0 3px 5px #b1b1b1;box-shadow:inset 0 3px 5px #b1b1b1}.sun-editor .se-btn-list:disabled,.sun-editor .se-btn:disabled,.sun-editor button:disabled{cursor:not-allowed;background-color:inherit;color:#bdbdbd}.sun-editor .se-loading-box{position:absolute;display:none;width:100%;height:100%;top:0;left:0;background-color:#fff;opacity:.7;filter:alpha(opacity=70);z-index:2147483647}.sun-editor .se-loading-box .se-loading-effect{position:absolute;display:block;top:50%;left:50%;height:25px;width:25px;border-top:2px solid #07d;border-right:2px solid transparent;border-radius:50%;animation:spinner .8s linear infinite;margin:-25px 0 0 -25px}.sun-editor .se-line-breaker{position:absolute;display:none;width:100%;height:1px;cursor:text;border-top:1px solid #3288ff;z-index:7}.sun-editor .se-line-breaker>button.se-btn{position:relative;display:inline-block;width:30px;height:30px;top:-15px;float:none;left:-50%;background-color:#fff;border:1px solid #0c2240;opacity:.6;cursor:pointer}.sun-editor .se-line-breaker>button.se-btn:hover{opacity:.9;background-color:#fff;border-color:#041b39}.sun-editor .se-line-breaker-component{position:absolute;display:none;width:24px;height:24px;background-color:#fff;border:1px solid #0c2240;opacity:.6;border-radius:4px;cursor:pointer;z-index:7}.sun-editor .se-line-breaker-component:hover{opacity:.9}.sun-editor .se-toolbar{display:block;position:relative;height:auto;width:100%;overflow:visible;padding:4px 3px 0;margin:0;background-color:#fafafa;outline:1px solid #dadada;z-index:5}.sun-editor .se-toolbar-cover{position:absolute;display:none;font-size:36px;width:100%;height:100%;top:0;left:0;background-color:#fefefe;opacity:.5;filter:alpha(opacity=50);cursor:not-allowed;z-index:4}.sun-editor .se-toolbar-separator-vertical{display:inline-block;height:0;width:0;margin:1px;vertical-align:top}.sun-editor .se-toolbar.se-toolbar-balloon,.sun-editor .se-toolbar.se-toolbar-inline{display:none;position:absolute;z-index:2147483647;box-shadow:0 3px 9px rgba(0,0,0,.5);-webkit-box-shadow:0 3px 9px rgba(0,0,0,.5)}.sun-editor .se-toolbar.se-toolbar-balloon{width:auto}.sun-editor .se-toolbar.se-toolbar-sticky{position:fixed;top:0}.sun-editor .se-toolbar-sticky-dummy{display:none;position:static;z-index:-1}.sun-editor .se-btn-module{display:inline-block}.sun-editor .se-btn-module-border{border:1px solid #dadada;border-radius:4px}.sun-editor .se-btn-module-enter{display:block;width:100%;height:1px;margin-bottom:5px;background-color:transparent}.sun-editor .se-toolbar-more-layer{margin:0 -3px;background-color:#f3f3f3}.sun-editor .se-toolbar-more-layer .se-more-layer{display:none;border-top:1px solid #dadada}.sun-editor .se-toolbar-more-layer .se-more-layer .se-more-form{display:inline-block;width:100%;height:auto;padding:4px 3px 0}.sun-editor .se-btn-module .se-btn-more.se-btn-more-text{width:auto;padding:0 4px}.sun-editor .se-btn-module .se-btn-more:focus,.sun-editor .se-btn-module .se-btn-more:hover{color:#000;background-color:#d1d1d1;border-color:#c1c1c1;outline:0 none}.sun-editor .se-btn-module .se-btn-more.on{color:#333;background-color:#d1d1d1;border-color:#c1c1c1;outline:0 none}.sun-editor .se-btn-module .se-btn-more.on:hover{color:#000;background-color:#c1c1c1;border-color:#b1b1b1;outline:0 none}.sun-editor .se-menu-list,.sun-editor .se-menu-list li{float:left;padding:0;margin:0}.sun-editor .se-menu-list li{position:relative}.sun-editor .se-btn-select{width:auto;display:flex;text-align:left;padding:4px 6px}.sun-editor .se-btn-select .txt{flex:auto;float:left;text-align:left}.sun-editor .se-btn-select.se-btn-tool-font{width:100px}.sun-editor .se-btn-select.se-btn-tool-format,.sun-editor .se-btn-select.se-btn-tool-size{width:80px}.sun-editor .se-btn-tray{position:relative;width:100%;height:100%;margin:0;padding:0}.sun-editor .se-menu-tray{position:absolute;top:0;left:0;width:100%;height:0}.sun-editor .se-submenu{overflow-x:hidden;overflow-y:auto}.sun-editor .se-list-layer{display:none;position:absolute;top:0;left:0;height:auto;z-index:5;border:1px solid #bababa;border-radius:4px;padding:6px 0;background-color:#fff;-webkit-box-shadow:0 3px 9px rgba(0,0,0,.5);box-shadow:0 3px 9px rgba(0,0,0,.5);outline:0 none}.sun-editor .se-list-layer .se-list-inner{padding:0;margin:0;overflow-x:initial;overflow-y:initial;overflow:visible}.sun-editor .se-list-layer button{margin:0;width:100%}.sun-editor .se-list-inner .se-list-basic{width:100%;padding:0}.sun-editor .se-list-inner .se-list-basic li{width:100%}.sun-editor .se-list-inner .se-list-basic li>button{min-width:100%;width:max-content}.sun-editor .se-list-inner .se-list-basic li button.active{background-color:#80bdff;border:1px solid #3f9dff;border-left:0;border-right:0}.sun-editor .se-list-inner .se-list-basic li button.active:hover{background-color:#3f9dff;border:1px solid #4592ff;border-left:0;border-right:0}.sun-editor .se-list-inner .se-list-basic li button.active:active{background-color:#4592ff;border:1px solid #407dd1;border-left:0;border-right:0;-webkit-box-shadow:inset 0 3px 5px #407dd1;box-shadow:inset 0 3px 5px #407dd1}.sun-editor .se-btn-list{width:100%;height:auto;min-height:32px;padding:0 14px;cursor:pointer;font-size:12px;line-height:normal;text-indent:0;text-decoration:none;text-align:left}.sun-editor .se-btn-list.default_value{background-color:#f3f3f3;border-top:1px dotted #b1b1b1;border-bottom:1px dotted #b1b1b1}.sun-editor .se-btn-list:focus,.sun-editor .se-btn-list:hover{background-color:#e1e1e1;border-color:#d1d1d1;outline:0 none}.sun-editor .se-btn-list:active{background-color:#d1d1d1;border-color:#c1c1c1;-webkit-box-shadow:inset 0 3px 5px #c1c1c1;box-shadow:inset 0 3px 5px #c1c1c1}.sun-editor .se-list-layer.se-list-font-size{min-width:140px;max-height:300px}.sun-editor .se-list-layer.se-list-font-family{min-width:156px}.sun-editor .se-list-layer.se-list-font-family .default{border-bottom:1px solid #ccc}.sun-editor .se-list-layer.se-list-line{width:125px}.sun-editor .se-list-layer.se-list-align .se-list-inner{left:9px;width:125px}.sun-editor .se-list-layer.se-list-format{min-width:156px}.sun-editor .se-list-layer.se-list-format li{padding:0;width:100%}.sun-editor .se-list-layer.se-list-format ul .se-btn-list{line-height:100%}.sun-editor .se-list-layer.se-list-format ul .se-btn-list[data-value=h1]{height:40px}.sun-editor .se-list-layer.se-list-format ul .se-btn-list[data-value=h2]{height:34px}.sun-editor .se-list-layer.se-list-format ul p{font-size:13px}.sun-editor .se-list-layer.se-list-format ul div{font-size:13px;padding:4px 2px}.sun-editor .se-list-layer.se-list-format ul h1{font-size:2em;font-weight:700;color:#333}.sun-editor .se-list-layer.se-list-format ul h2{font-size:1.5em;font-weight:700;color:#333}.sun-editor .se-list-layer.se-list-format ul h3{font-size:1.17em;font-weight:700;color:#333}.sun-editor .se-list-layer.se-list-format ul h4{font-size:1em;font-weight:700;color:#333}.sun-editor .se-list-layer.se-list-format ul h5{font-size:.83em;font-weight:700;color:#333}.sun-editor .se-list-layer.se-list-format ul h6{font-size:.67em;font-weight:700;color:#333}.sun-editor .se-list-layer.se-list-format ul blockquote{font-size:13px;color:#999;height:22px;margin:0;background-color:transparent;line-height:1.5;border-color:#b1b1b1;padding:0 0 0 7px;border-left:5px #b1b1b1;border-style:solid}.sun-editor .se-list-layer.se-list-format ul pre{font-size:13px;color:#666;padding:4px 11px;margin:0;background-color:#f9f9f9;border:1px solid #e1e1e1;border-radius:4px}.sun-editor .se-selector-table{display:none;position:absolute;top:34px;left:1px;z-index:5;padding:5px 0;float:left;margin:2px 0 0;font-size:14px;text-align:left;list-style:none;background-color:#fff;-webkit-background-clip:padding-box;background-clip:padding-box;border:1px solid #ccc;border-radius:4px;-webkit-box-shadow:0 6px 12px rgba(0,0,0,.175);box-shadow:0 6px 12px rgba(0,0,0,.175)}.sun-editor .se-selector-table .se-table-size{font-size:18px;padding:0 5px}.sun-editor .se-selector-table .se-table-size-picker{position:absolute!important;z-index:3;font-size:18px;width:10em;height:10em;cursor:pointer}.sun-editor .se-selector-table .se-table-size-highlighted{position:absolute!important;z-index:2;font-size:18px;width:1em;height:1em;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAAZdEVYdFNvZnR3YXJlAEFkb2JlIEltYWdlUmVhZHlxyWU8AAADJmlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNS42LWMxNDIgNzkuMTYwOTI0LCAyMDE3LzA3LzEzLTAxOjA2OjM5ICAgICAgICAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPiA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDo4QTZCNzMzN0I3RUYxMUU4ODcwQ0QwMjM1NTgzRTJDNyIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDo4QTZCNzMzNkI3RUYxMUU4ODcwQ0QwMjM1NTgzRTJDNyIgeG1wOkNyZWF0b3JUb29sPSJBZG9iZSBQaG90b3Nob3AgQ0MgMjAxOCAoV2luZG93cykiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDo0MzYyNEUxRUI3RUUxMUU4ODZGQzgwRjNBODgyNTdFOSIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDo0MzYyNEUxRkI3RUUxMUU4ODZGQzgwRjNBODgyNTdFOSIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/Pl0yAuwAAABBSURBVDhPY/wPBAxUAGCDGvdBeWSAeicIDTfIXREiQArYeR9hEBOEohyMGkQYjBpEGAxjg6ib+yFMygCVvMbAAABj0hwMTNeKJwAAAABJRU5ErkJggg==") repeat}.sun-editor .se-selector-table .se-table-size-unhighlighted{position:relative!important;z-index:1;font-size:18px;width:10em;height:10em;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASAgMAAAAroGbEAAAACVBMVEUAAIj4+Pjp6ekKlAqjAAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAACxMAAAsTAQCanBgAAAAHdElNRQfYAR0BKhmnaJzPAAAAG0lEQVQI12NgAAOtVatWMTCohoaGUY+EmIkEAEruEzK2J7tvAAAAAElFTkSuQmCC") repeat}.sun-editor .se-selector-table .se-table-size-display{padding-left:5px}.sun-editor .se-list-layer .se-selector-color{display:flex;width:max-content;max-width:270px;height:auto;padding:0;margin:auto}.sun-editor .se-list-layer .se-selector-color .se-color-pallet{width:100%;height:100%;padding:0}.sun-editor .se-list-layer .se-selector-color .se-color-pallet li{display:flex;float:left;position:relative;margin:0}.sun-editor .se-list-layer .se-selector-color .se-color-pallet button{display:block;cursor:default;width:30px;height:30px;text-indent:-9999px}.sun-editor .se-list-layer .se-selector-color .se-color-pallet button.active,.sun-editor .se-list-layer .se-selector-color .se-color-pallet button:focus,.sun-editor .se-list-layer .se-selector-color .se-color-pallet button:hover{border:3px solid #fff}.sun-editor .se-submenu-form-group{display:flex;width:100%;height:auto;padding:4px}.sun-editor .se-submenu-form-group input{flex:auto;display:inline-block;width:auto;height:33px;color:#555;font-size:12px;margin:1px 0;padding:0;border-radius:.25rem;border:1px solid #ccc}.sun-editor .se-submenu-form-group button{float:right;width:34px;height:34px;margin:0 0 0 4px!important}.sun-editor .se-submenu-form-group button.se-btn{border:1px solid #ccc}.sun-editor .se-submenu-form-group>div{position:relative}.sun-editor .se-submenu-form-group .se-color-input{width:72px;text-transform:uppercase;border:none;border-bottom:2px solid #b1b1b1;outline:none}.sun-editor .se-submenu-form-group .se-color-input:focus{border-bottom:3px solid #b1b1b1}.sun-editor .se-wrapper{position:relative!important;width:100%;height:auto;overflow:hidden;z-index:1}.sun-editor .se-wrapper .se-wrapper-inner{width:100%;height:100%;min-height:65px;overflow-y:auto;overflow-x:auto;-webkit-overflow-scrolling:touch;user-select:text;-o-user-select:text;-moz-user-select:text;-khtml-user-select:text;-webkit-user-select:text;-ms-user-select:text}.sun-editor .se-wrapper .se-wrapper-inner:focus{outline:none}.sun-editor .se-wrapper .se-wrapper-code{background-color:#191919;color:#fff;font-size:13px;word-break:break-all;padding:4px;margin:0;resize:none!important}.sun-editor .se-wrapper .se-wrapper-wysiwyg{background-color:#fff;display:block}.sun-editor .se-wrapper .se-wrapper-code-mirror{font-size:13px}.sun-editor .se-wrapper .se-placeholder{position:absolute;display:none;white-space:nowrap;text-overflow:ellipsis;z-index:1;color:#b1b1b1;font-size:13px;line-height:1.5;top:0;left:0;right:0;overflow:hidden;margin-top:0;padding-top:16px;padding-left:16px;margin-left:0;padding-right:16px;margin-right:0;pointer-events:none;backface-visibility:hidden;-webkit-backface-visibility:hidden;-moz-backface-visibility:hidden}.sun-editor .se-resizing-bar{display:flex;width:auto;height:auto;min-height:16px;border-top:1px solid #dadada;padding:0 4px;background-color:#fafafa;cursor:ns-resize}.sun-editor .se-resizing-bar.se-resizing-none{cursor:default}.sun-editor .se-resizing-back{position:absolute;display:none;cursor:default;top:0;left:0;width:100%;height:100%;z-index:2147483647}.sun-editor .se-resizing-bar .se-navigation{flex:auto;position:relative;width:auto;height:auto;color:#666;margin:0;padding:0;font-size:10px;font-weight:700;line-height:1.5;background:transparent}.sun-editor .se-resizing-bar .se-char-counter-wrapper{flex:none;position:relative;display:block;width:auto;height:auto;margin:0;padding:0;color:#999;font-size:13px;background:transparent}.sun-editor .se-resizing-bar .se-char-counter-wrapper.se-blink{color:#b94a48;animation:blinker .2s linear infinite}.sun-editor .se-resizing-bar .se-char-counter-wrapper .se-char-label{margin-right:4px}.sun-editor .se-dialog{position:absolute;display:none;top:0;left:0;width:100%;height:100%;z-index:2147483647}.sun-editor .se-dialog button,.sun-editor .se-dialog input,.sun-editor .se-dialog label{font-size:14px;line-height:1.5;color:#111;margin:0}.sun-editor .se-dialog .se-dialog-back{background-color:#222;opacity:.5}.sun-editor .se-dialog .se-dialog-back,.sun-editor .se-dialog .se-dialog-inner{position:absolute;width:100%;height:100%;top:0;left:0}.sun-editor .se-dialog .se-dialog-inner .se-dialog-content{position:relative;width:auto;max-width:500px;margin:20px auto;background-color:#fff;-webkit-background-clip:padding-box;background-clip:padding-box;border:1px solid rgba(0,0,0,.2);border-radius:4px;outline:0;-webkit-box-shadow:0 3px 9px rgba(0,0,0,.5);box-shadow:0 3px 9px rgba(0,0,0,.5)}@media screen and (max-width:509px){.sun-editor .se-dialog .se-dialog-inner .se-dialog-content{width:100%}}.sun-editor .se-dialog .se-dialog-inner .se-dialog-content label{display:inline-block;max-width:100%;margin-bottom:5px;font-weight:700}.sun-editor .se-dialog .se-dialog-inner .se-dialog-content .se-btn-primary{display:inline-block;padding:6px 12px;margin:0 0 10px!important;font-size:14px;font-weight:400;line-height:1.42857143;text-align:center;white-space:nowrap;vertical-align:middle;-ms-touch-action:manipulation;touch-action:manipulation;border-radius:4px}.sun-editor .se-dialog .se-dialog-inner .se-dialog-header{height:50px;padding:6px 15px;border-bottom:1px solid #e5e5e5}.sun-editor .se-dialog .se-dialog-inner .se-dialog-header .se-dialog-close{float:right;font-weight:700;text-shadow:0 1px 0 #fff;-webkit-appearance:none;filter:alpha(opacity=100);opacity:1}.sun-editor .se-dialog .se-dialog-inner .se-dialog-header .se-modal-title{font-size:14px;font-weight:700;margin:0;padding:0;line-height:2.5}.sun-editor .se-dialog .se-dialog-inner .se-dialog-body{position:relative;padding:15px}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form{margin-bottom:10px}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form-footer{margin-top:10px;margin-bottom:0}.sun-editor .se-dialog .se-dialog-inner input:disabled{background-color:#f3f3f3}.sun-editor .se-dialog .se-dialog-inner .se-dialog-size-text{width:100%}.sun-editor .se-dialog .se-dialog-inner .se-dialog-size-text .size-h,.sun-editor .se-dialog .se-dialog-inner .se-dialog-size-text .size-w{width:70px;text-align:center}.sun-editor .se-dialog .se-dialog-inner .se-dialog-size-x{margin:0 8px;width:25px;text-align:center}.sun-editor .se-dialog .se-dialog-inner .se-dialog-footer{padding:10px 15px 0;text-align:right;border-top:1px solid #e5e5e5}.sun-editor .se-dialog .se-dialog-inner .se-dialog-footer>div{float:left}.sun-editor .se-dialog .se-dialog-inner .se-dialog-footer>div>label{margin-top:5px}.sun-editor .se-dialog .se-dialog-inner .se-dialog-btn-radio{margin-left:12px;margin-right:6px}.sun-editor .se-dialog .se-dialog-inner .se-dialog-btn-check{margin-left:12px;margin-right:4px}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form-footer .se-dialog-btn-check{margin-left:0;margin-right:4px}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-dialog-form-files{position:relative;display:flex;align-items:center}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-dialog-form-files>input{flex:auto}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-dialog-form-files .se-dialog-files-edge-button{flex:auto;opacity:.8;border:1px solid #ccc}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-dialog-form-files .se-dialog-files-edge-button.se-file-remove>svg{width:8px;height:8px}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-dialog-form-files .se-dialog-files-edge-button:hover{background-color:#f0f0f0;outline:0 none}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-dialog-form-files .se-dialog-files-edge-button:active{background-color:#e9e9e9;-webkit-box-shadow:inset 0 3px 5px #d6d6d6;box-shadow:inset 0 3px 5px #d6d6d6}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-input-select{display:inline-block;width:auto;height:34px;font-size:14px;text-align:center;line-height:1.42857143}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-input-control{display:inline-block;width:70px;height:34px;font-size:14px;text-align:center;line-height:1.42857143}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-input-form{display:block;width:100%;height:34px;font-size:14px;line-height:1.42857143;padding:0 4px}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-input-form.se-input-url:disabled{text-decoration:line-through;color:#999}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-video-ratio{width:70px;margin-left:4px}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form a{color:#004cff}.sun-editor .se-dialog .se-dialog-inner .se-dialog-btn-revert{border:1px solid #ccc}.sun-editor .se-dialog .se-dialog-inner .se-dialog-btn-revert:hover{background-color:#e1e1e1;border-color:#d1d1d1;outline:0 none}.sun-editor .se-dialog .se-dialog-inner .se-dialog-btn-revert:active{background-color:#d1d1d1;border-color:#c1c1c1;-webkit-box-shadow:inset 0 3px 5px #c1c1c1;box-shadow:inset 0 3px 5px #c1c1c1}.sun-editor .se-dialog-tabs{width:100%;height:25px;border-bottom:1px solid #e5e5e5}.sun-editor .se-dialog-tabs button{background-color:#e5e5e5;border-right:1px solid #e5e5e5;float:left;outline:none;padding:2px 13px;transition:.3s}.sun-editor .se-dialog-tabs button:hover{background-color:#fff}.sun-editor .se-dialog-tabs button.active{background-color:#fff;border-bottom:0}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-input-form.se-math-exp{resize:vertical;height:4rem;border:1px solid #ccc;font-size:13px;padding:4px}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-input-select.se-math-size{width:6em;height:28px;margin-left:1em}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-math-preview{font-size:13px}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-math-preview>span{display:inline-block;-webkit-box-shadow:0 0 0 .1rem #c7deff;box-shadow:0 0 0 .1rem #c7deff}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-link-preview{display:block;height:auto;max-height:18px;margin:4px 0 0 4px;font-size:13px;font-weight:400;font-family:inherit;color:#666;background-color:transparent;overflow:hidden;text-overflow:ellipsis;word-break:break-all;white-space:pre}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-mention-item{line-height:28px;height:25px;padding:0 5px}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-mention-item.se-mention-active{background-color:#ccc;border-radius:3px}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-mention-search{margin-bottom:10px}.sun-editor .se-controller .se-arrow.se-arrow-up{border-bottom-color:rgba(0,0,0,.25)}.sun-editor .se-controller{position:absolute;display:none;overflow:visible;z-index:6;border:1px solid rgba(0,0,0,.25);border-radius:4px;text-align:start;text-decoration:none;text-shadow:none;text-transform:none;letter-spacing:normal;word-break:normal;word-spacing:normal;word-wrap:normal;white-space:normal;background-color:#fff;-webkit-background-clip:padding-box;background-clip:padding-box;-webkit-box-shadow:0 5px 10px rgba(0,0,0,.2);box-shadow:0 5px 10px rgba(0,0,0,.2);line-break:auto}.sun-editor .se-controller .se-btn-group{position:relative;display:flex;vertical-align:middle;padding:2px;top:0;left:0}.sun-editor .se-controller .se-btn-group .se-btn-group-sub{left:50%;min-width:auto;width:max-content;display:none}.sun-editor .se-controller .se-btn-group .se-btn-group-sub button{margin:0;min-width:72px}.sun-editor .se-controller .se-btn-group button{position:relative;min-height:34px;height:auto;border:none;border-radius:4px;margin:1px;padding:5px 10px;font-size:12px;line-height:1.5;display:inline-block;font-weight:400;text-align:center;white-space:nowrap;vertical-align:middle;-ms-touch-action:manipulation;touch-action:manipulation}.sun-editor .se-controller .se-btn-group button:focus:enabled,.sun-editor .se-controller .se-btn-group button:hover:enabled{background-color:#e1e1e1;border-color:#d1d1d1;outline:0 none}.sun-editor .se-controller .se-btn-group button:active:enabled{background-color:#d1d1d1;border-color:#c1c1c1;-webkit-box-shadow:inset 0 3px 5px #c1c1c1;box-shadow:inset 0 3px 5px #c1c1c1}.sun-editor .se-controller .se-btn-group button span{display:block;padding:0;margin:0}.sun-editor .se-controller .se-btn-group button:enabled.active{color:#4592ff;outline:0 none}.sun-editor .se-controller .se-btn-group button:enabled.active:focus,.sun-editor .se-controller .se-btn-group button:enabled.active:hover{background-color:#e1e1e1;border-color:#d1d1d1;outline:0 none}.sun-editor .se-controller .se-btn-group button:enabled.active:active{background-color:#d1d1d1;border-color:#c1c1c1;-webkit-box-shadow:inset 0 3px 5px #c1c1c1;box-shadow:inset 0 3px 5px #c1c1c1}.sun-editor .se-controller .se-btn-group button:enabled.on{background-color:#e1e1e1;border-color:#d1d1d1;outline:0 none}.sun-editor .se-controller .se-btn-group button:enabled.on:focus,.sun-editor .se-controller .se-btn-group button:enabled.on:hover{background-color:#d1d1d1;border-color:#c1c1c1;outline:0 none}.sun-editor .se-controller .se-btn-group button:enabled.on:active{background-color:#c1c1c1;border-color:#b1b1b1;-webkit-box-shadow:inset 0 3px 5px #b1b1b1;box-shadow:inset 0 3px 5px #b1b1b1}.sun-editor .se-controller-resizing{margin-top:-50px!important;padding:0;font-size:14px;font-style:normal;font-weight:400;line-height:1.42857143}.sun-editor .se-controller-resizing .se-btn-group .se-btn-group-sub.se-resizing-align-list{left:57px;width:74px}.sun-editor .se-resizing-container{position:absolute;display:none;outline:1px solid #3f9dff;background-color:transparent}.sun-editor .se-resizing-container .se-modal-resize{position:absolute;display:inline-block;background-color:#3f9dff;opacity:.3}.sun-editor .se-resizing-container .se-resize-dot{position:absolute;top:0;left:0;width:100%;height:100%}.sun-editor .se-resizing-container .se-resize-dot>span{position:absolute;width:7px;height:7px;background-color:#3f9dff;border:1px solid #4592ff}.sun-editor .se-resizing-container .se-resize-dot>span.tl{top:-5px;left:-5px;cursor:nw-resize}.sun-editor .se-resizing-container .se-resize-dot>span.tr{top:-5px;right:-5px;cursor:ne-resize}.sun-editor .se-resizing-container .se-resize-dot>span.bl{bottom:-5px;left:-5px;cursor:sw-resize}.sun-editor .se-resizing-container .se-resize-dot>span.br{right:-5px;bottom:-5px;cursor:se-resize}.sun-editor .se-resizing-container .se-resize-dot>span.lw{left:-7px;bottom:50%;cursor:w-resize}.sun-editor .se-resizing-container .se-resize-dot>span.th{left:50%;top:-7px;cursor:n-resize}.sun-editor .se-resizing-container .se-resize-dot>span.rw{right:-7px;bottom:50%;cursor:e-resize}.sun-editor .se-resizing-container .se-resize-dot>span.bh{right:50%;bottom:-7px;cursor:s-resize}.sun-editor .se-resizing-container .se-resize-display{position:absolute;right:0;bottom:0;padding:5px;margin:5px;font-size:12px;color:#fff;background-color:#333;border-radius:4px}.sun-editor .se-controller-table,.sun-editor .se-controller-table-cell{width:auto}.sun-editor .se-controller-link,.sun-editor .se-controller-table,.sun-editor .se-controller-table-cell{padding:0;font-size:14px;font-style:normal;font-weight:400;line-height:1.42857143}.sun-editor .se-controller-link:after,.sun-editor .se-controller-link:before{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.sun-editor .se-controller-link .link-content{padding:0;margin:0}.sun-editor .se-controller-link .link-content a{display:inline-block;color:#4592ff;max-width:200px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;vertical-align:middle;margin-left:5px}.sun-editor .se-file-browser{position:absolute;display:none;top:0;left:0;width:100%;height:100%;z-index:2147483647}.sun-editor .se-file-browser button,.sun-editor .se-file-browser input,.sun-editor .se-file-browser label{font-size:14px;line-height:1.5;color:#111;margin:0}.sun-editor .se-file-browser .se-file-browser-back{background-color:#222;opacity:.5}.sun-editor .se-file-browser .se-file-browser-back,.sun-editor .se-file-browser .se-file-browser-inner{position:absolute;display:block;width:100%;height:100%;top:0;left:0}.sun-editor .se-file-browser .se-file-browser-inner .se-file-browser-content{position:relative;width:960px;max-width:100%;margin:20px auto;background-color:#fff;-webkit-background-clip:padding-box;background-clip:padding-box;border:1px solid rgba(0,0,0,.2);border-radius:4px;outline:0;-webkit-box-shadow:0 3px 9px rgba(0,0,0,.5);box-shadow:0 3px 9px rgba(0,0,0,.5)}.sun-editor .se-file-browser .se-file-browser-header{height:auto;min-height:50px;padding:6px 15px;border-bottom:1px solid #e5e5e5}.sun-editor .se-file-browser .se-file-browser-header .se-file-browser-close{float:right;font-weight:700;text-shadow:0 1px 0 #fff;-webkit-appearance:none;filter:alpha(opacity=100);opacity:1}.sun-editor .se-file-browser .se-file-browser-header .se-file-browser-close>svg{width:12px;height:12px}.sun-editor .se-file-browser .se-file-browser-header .se-file-browser-title{font-size:16px;font-weight:700;margin:0;padding:0;line-height:2.2}.sun-editor .se-file-browser .se-file-browser-tags{display:block;width:100%;padding:0;text-align:left;margin:0 -15px}.sun-editor .se-file-browser .se-file-browser-tags a{display:inline-block;background-color:#f5f5f5;padding:6px 12px;margin:8px 0 8px 8px;color:#333;text-decoration:none;border-radius:32px;-moz-border-radius:32px;-webkit-border-radius:32px;-moz-background-clip:padding;-webkit-background-clip:padding-box;background-clip:padding-box;cursor:pointer}.sun-editor .se-file-browser .se-file-browser-tags a:hover{background-color:#e1e1e1}.sun-editor .se-file-browser .se-file-browser-tags a:active{background-color:#d1d1d1}.sun-editor .se-file-browser .se-file-browser-tags a.on{background-color:#ebf3fe;color:#4592ff}.sun-editor .se-file-browser .se-file-browser-tags a.on:hover{background-color:#d8e8fe}.sun-editor .se-file-browser .se-file-browser-tags a.on:active{background-color:#c7deff}.sun-editor .se-file-browser .se-file-browser-body{position:relative;height:auto;min-height:350px;padding:20px;overflow-y:auto}.sun-editor .se-file-browser .se-file-browser-body .se-file-browser-list{position:relative;width:100%}@media screen and (max-width:992px){.sun-editor .se-file-browser .se-file-browser-inner .se-file-browser-content{width:748px}}@media screen and (max-width:768px){.sun-editor .se-file-browser .se-file-browser-inner .se-file-browser-content{width:600px}}.sun-editor .se-file-browser .se-file-browser-list .se-file-item-column{position:relative;display:block;height:auto;float:left}.sun-editor .se-file-browser .se-file-browser-list.se-image-list .se-file-item-column{width:calc(25% - 20px);margin:0 10px}@media screen and (max-width:992px){.sun-editor .se-file-browser .se-file-browser-list.se-image-list .se-file-item-column{width:calc(33% - 20px)}}@media screen and (max-width:768px){.sun-editor .se-file-browser .se-file-browser-list.se-image-list .se-file-item-column{width:calc(50% - 20px)}}.sun-editor .se-file-browser .se-file-browser-list.se-image-list .se-file-item-img{position:relative;display:block;cursor:pointer;width:100%;height:auto;border-radius:4px;outline:0;margin:10px 0}.sun-editor .se-file-browser .se-file-browser-list.se-image-list .se-file-item-img:hover{opacity:.8;-webkit-box-shadow:0 0 0 .2rem #3288ff;box-shadow:0 0 0 .2rem #3288ff}.sun-editor .se-file-browser .se-file-browser-list.se-image-list .se-file-item-img>img{position:relative;display:block;width:100%;border-radius:4px;outline:0;height:auto}.sun-editor .se-file-browser .se-file-browser-list.se-image-list .se-file-item-img>.se-file-img-name{position:absolute;z-index:1;font-size:13px;color:#fff;left:0;bottom:0;padding:5px 10px;background-color:transparent;width:100%;height:30px;border-bottom-right-radius:4px;border-bottom-left-radius:4px}.sun-editor .se-file-browser .se-file-browser-list.se-image-list .se-file-item-img>.se-file-img-name.se-file-name-back{background-color:#333;opacity:.6}.sun-editor .se-notice{position:absolute;top:0;display:none;z-index:7;width:100%;height:auto;word-break:break-all;font-size:13px;color:#b94a48;background-color:#f2dede;padding:15px;margin:0;border:1px solid #eed3d7;user-select:text;-o-user-select:text;-moz-user-select:text;-khtml-user-select:text;-webkit-user-select:text;-ms-user-select:text}.sun-editor .se-notice button{float:right;padding:7px}.sun-editor .se-tooltip{position:relative;overflow:visible}.sun-editor .se-tooltip .se-tooltip-inner{visibility:hidden;position:absolute;display:block;width:auto;top:120%;left:50%;background:transparent;opacity:0;z-index:1;line-height:1.5;transition:opacity .5s;margin:0;padding:0;bottom:auto;float:none;pointer-events:none;backface-visibility:hidden;-webkit-backface-visibility:hidden;-moz-backface-visibility:hidden}.sun-editor .se-tooltip .se-tooltip-inner .se-tooltip-text{position:relative;display:inline-block;width:auto;left:-50%;font-size:.9em;margin:0;padding:4px 6px;border-radius:2px;background-color:#333;color:#fff;text-align:center;line-height:unset;white-space:nowrap;cursor:auto}.sun-editor .se-tooltip .se-tooltip-inner .se-tooltip-text:after{content:"";position:absolute;bottom:100%;left:50%;margin-left:-5px;border:5px solid transparent;border-bottom-color:#333}.sun-editor .se-tooltip:hover .se-tooltip-inner{visibility:visible;opacity:1}@keyframes blinker{50%{opacity:0}}@keyframes spinner{to{transform:rotate(361deg)}}.sun-editor-editable{font-family:Helvetica Neue,sans-serif;font-size:13px;color:#333;line-height:1.5;text-align:left;background-color:#fff;word-break:normal;word-wrap:break-word;padding:16px;margin:0}.sun-editor-editable *{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;font-family:inherit;font-size:inherit;color:inherit}.sun-editor-editable audio,.sun-editor-editable figcaption,.sun-editor-editable figure,.sun-editor-editable iframe,.sun-editor-editable img,.sun-editor-editable td,.sun-editor-editable th,.sun-editor-editable video{position:relative}.sun-editor-editable .__se__float-left{float:left}.sun-editor-editable .__se__float-right{float:right}.sun-editor-editable .__se__float-center{float:center}.sun-editor-editable .__se__float-none{float:none}.sun-editor-editable :not(.se-code-language .katex) span{display:inline;vertical-align:baseline;margin:0;padding:0}.sun-editor-editable span.katex{display:inline-block}.sun-editor-editable a{color:#004cff;text-decoration:none}.sun-editor-editable span[style~="color:"] a{color:inherit}.sun-editor-editable a:focus,.sun-editor-editable a:hover{cursor:pointer;color:#0093ff;text-decoration:underline}.sun-editor-editable pre{display:block;padding:8px;margin:0 0 10px;font-family:monospace;color:#666;line-height:1.45;background-color:#f9f9f9;border:1px solid #e1e1e1;border-radius:2px;white-space:pre-wrap;word-wrap:break-word;overflow:visible}.sun-editor-editable ol{list-style-type:decimal}.sun-editor-editable ol,.sun-editor-editable ul{display:block;margin-block-start:1em;margin-block-end:1em;margin-inline-start:0;margin-inline-end:0;padding-inline-start:40px}.sun-editor-editable ul{list-style-type:disc}.sun-editor-editable li{display:list-item;text-align:-webkit-match-parent;margin-bottom:5px}.sun-editor-editable ol ol,.sun-editor-editable ol ul,.sun-editor-editable ul ol,.sun-editor-editable ul ul{margin:0}.sun-editor-editable ol ol,.sun-editor-editable ul ol{list-style-type:lower-alpha}.sun-editor-editable ol ol ol,.sun-editor-editable ul ol ol,.sun-editor-editable ul ul ol{list-style-type:upper-roman}.sun-editor-editable ol ul,.sun-editor-editable ul ul{list-style-type:circle}.sun-editor-editable ol ol ul,.sun-editor-editable ol ul ul,.sun-editor-editable ul ul ul{list-style-type:square}.sun-editor-editable sub,.sun-editor-editable sup{font-size:75%;line-height:0}.sun-editor-editable sub{vertical-align:sub}.sun-editor-editable sup{vertical-align:super}.sun-editor-editable p{display:block;margin:0 0 10px}.sun-editor-editable div{display:block;margin:0;padding:0}.sun-editor-editable blockquote{display:block;font-family:inherit;font-size:inherit;color:#999;margin-block-start:1em;margin-block-end:1em;margin-inline-start:0;margin-inline-end:0;padding:0 5px 0 20px;border:solid #b1b1b1;border-width:0 0 0 5px}.sun-editor-editable blockquote blockquote{border-color:#c1c1c1}.sun-editor-editable blockquote blockquote blockquote{border-color:#d1d1d1}.sun-editor-editable blockquote blockquote blockquote blockquote{border-color:#e1e1e1}.sun-editor-editable h1{font-size:2em;margin-block-start:.67em;margin-block-end:.67em}.sun-editor-editable h1,.sun-editor-editable h2{display:block;margin-inline-start:0;margin-inline-end:0;font-weight:700}.sun-editor-editable h2{font-size:1.5em;margin-block-start:.83em;margin-block-end:.83em}.sun-editor-editable h3{font-size:1.17em;margin-block-start:1em;margin-block-end:1em}.sun-editor-editable h3,.sun-editor-editable h4{display:block;margin-inline-start:0;margin-inline-end:0;font-weight:700}.sun-editor-editable h4{font-size:1em;margin-block-start:1.33em;margin-block-end:1.33em}.sun-editor-editable h5{font-size:.83em;margin-block-start:1.67em;margin-block-end:1.67em}.sun-editor-editable h5,.sun-editor-editable h6{display:block;margin-inline-start:0;margin-inline-end:0;font-weight:700}.sun-editor-editable h6{font-size:.67em;margin-block-start:2.33em;margin-block-end:2.33em}.sun-editor-editable hr{display:flex;border-width:1px 0 0;border-color:#000;border-image:initial;height:1px}.sun-editor-editable hr.__se__solid{border-style:solid none none}.sun-editor-editable hr.__se__dotted{border-style:dotted none none}.sun-editor-editable hr.__se__dashed{border-style:dashed none none}.sun-editor-editable table{display:table;table-layout:auto;border:1px solid #ccc;width:100%;max-width:100%;margin:0 0 10px;background-color:transparent;border-spacing:0;border-collapse:collapse}.sun-editor-editable table thead{border-bottom:2px solid #333}.sun-editor-editable table tr{border:1px solid #efefef}.sun-editor-editable table th{background-color:#f3f3f3}.sun-editor-editable table td,.sun-editor-editable table th{border:1px solid #e1e1e1;padding:.4em;background-clip:padding-box}.sun-editor-editable table.se-table-size-auto{width:auto!important}.sun-editor-editable table.se-table-size-100{width:100%!important}.sun-editor-editable table.se-table-layout-auto{table-layout:auto!important}.sun-editor-editable table.se-table-layout-fixed{table-layout:fixed!important}.sun-editor-editable table td.se-table-selected-cell,.sun-editor-editable table th.se-table-selected-cell{border:1px double #4592ff;background-color:#f1f7ff}.sun-editor-editable.se-disabled *{user-select:none;-o-user-select:none;-moz-user-select:none;-khtml-user-select:none;-webkit-user-select:none;-ms-user-select:none}.sun-editor-editable .se-component{display:flex;padding:1px;margin:0 0 10px}.sun-editor-editable .se-component.__se__float-left{margin:0 20px 10px 0}.sun-editor-editable .se-component.__se__float-right{margin:0 0 10px 20px}.sun-editor-editable[contenteditable=true] .se-component{outline:1px dashed #e1e1e1}.sun-editor-editable[contenteditable=true] .se-component.se-component-copy{-webkit-box-shadow:0 0 0 .2rem #80bdff;box-shadow:0 0 0 .2rem #3f9dff;transition:border-color .15s ease-in-out,box-shadow .15s ease-in-out}.sun-editor-editable audio,.sun-editor-editable iframe,.sun-editor-editable img,.sun-editor-editable video{display:block;margin:0;padding:0;width:auto;height:auto;max-width:100%}.sun-editor-editable[contenteditable=true] figure:after{position:absolute;content:"";z-index:1;top:0;left:0;right:0;bottom:0;cursor:default;display:block;background:transparent}.sun-editor-editable[contenteditable=true] figure a,.sun-editor-editable[contenteditable=true] figure iframe,.sun-editor-editable[contenteditable=true] figure img,.sun-editor-editable[contenteditable=true] figure video{z-index:0}.sun-editor-editable[contenteditable=true] figure figcaption{display:block;z-index:2}.sun-editor-editable[contenteditable=true] figure figcaption:focus{border-color:#80bdff;outline:0;-webkit-box-shadow:0 0 0 .2rem #c7deff;box-shadow:0 0 0 .2rem #c7deff}.sun-editor-editable .se-image-container,.sun-editor-editable .se-video-container{width:auto;height:auto;max-width:100%}.sun-editor-editable figure{display:block;outline:none;margin:0;padding:0}.sun-editor-editable figure figcaption{padding:1em .5em;margin:0;background-color:#f9f9f9;outline:none}.sun-editor-editable figure figcaption p{line-height:2;margin:0}.sun-editor-editable .se-image-container a img{padding:1px;margin:1px;outline:1px solid #4592ff}.sun-editor-editable .se-video-container iframe,.sun-editor-editable .se-video-container video{outline:1px solid #9e9e9e;position:absolute;top:0;left:0;border:0;width:100%;height:100%}.sun-editor-editable .se-video-container figure{left:0;width:100%;max-width:100%}.sun-editor-editable audio{width:300px;height:54px}.sun-editor-editable audio.active{outline:2px solid #80bdff}.sun-editor-editable.se-show-block div,.sun-editor-editable.se-show-block h1,.sun-editor-editable.se-show-block h2,.sun-editor-editable.se-show-block h3,.sun-editor-editable.se-show-block h4,.sun-editor-editable.se-show-block h5,.sun-editor-editable.se-show-block h6,.sun-editor-editable.se-show-block li,.sun-editor-editable.se-show-block ol,.sun-editor-editable.se-show-block p,.sun-editor-editable.se-show-block pre,.sun-editor-editable.se-show-block ul{border:1px dashed #3f9dff!important;padding:14px 8px 8px!important}.sun-editor-editable.se-show-block ol,.sun-editor-editable.se-show-block ul{border:1px dashed #d539ff!important}.sun-editor-editable.se-show-block pre{border:1px dashed #27c022!important}.se-show-block p{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAAPAQMAAAAF7dc0AAAABlBMVEWAgID////n1o2sAAAAAnRSTlP/AOW3MEoAAAAaSURBVAjXY/j/gwGCPvxg+F4BQiAGDP1HQQByxxw0gqOzIwAAAABJRU5ErkJggg==") no-repeat}.se-show-block div{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABUAAAAPAQMAAAAxlBYoAAAABlBMVEWAgID////n1o2sAAAAAnRSTlP/AOW3MEoAAAAmSURBVAjXY/j//wcDDH+8XsHwDYi/hwNx1A8w/nYLKH4XoQYJAwCXnSgcl2MOPgAAAABJRU5ErkJggg==") no-repeat}.se-show-block h1{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAPAQMAAAA4f7ZSAAAABlBMVEWAgID////n1o2sAAAAAnRSTlP/AOW3MEoAAAAfSURBVAjXY/j/v4EBhr+9B+LzEPrDeygfhI8j1CBhAEhmJGY4Rf6uAAAAAElFTkSuQmCC") no-repeat}.se-show-block h2{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAPAQMAAAA4f7ZSAAAABlBMVEWAgID////n1o2sAAAAAnRSTlP/AOW3MEoAAAAmSURBVAjXY/j/v4EBhr+dB+LtQPy9geEDEH97D8T3gbgdoQYJAwA51iPuD2haEAAAAABJRU5ErkJggg==") no-repeat}.se-show-block h3{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAPAQMAAAA4f7ZSAAAABlBMVEWAgID////n1o2sAAAAAnRSTlP/AOW3MEoAAAAiSURBVAjXY/j/v4EBhr+dB+LtQPy9geHDeQgN5p9HqEHCADeWI+69VG2MAAAAAElFTkSuQmCC") no-repeat}.se-show-block h4{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAAPAQMAAADTSA1RAAAABlBMVEWAgID////n1o2sAAAAAnRSTlP/AOW3MEoAAAAiSURBVAjXY/j//wADDH97DsTXIfjDdiDdDMTfIRhZHRQDAKJOJ6L+K3y7AAAAAElFTkSuQmCC") no-repeat}.se-show-block h5{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAPAQMAAAA4f7ZSAAAABlBMVEWAgID////n1o2sAAAAAnRSTlP/AOW3MEoAAAAlSURBVAjXY/j/v4EBhr+1A/F+IO5vYPiwHUh/B2IQfR6hBgkDABlWIy5uM+9GAAAAAElFTkSuQmCC") no-repeat}.se-show-block h6{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAPAQMAAAA4f7ZSAAAABlBMVEWAgID////n1o2sAAAAAnRSTlP/AOW3MEoAAAAiSURBVAjXY/j/v4EBhr+dB+LtQLy/geFDP5S9HSKOrA6KAR9GIza1ptJnAAAAAElFTkSuQmCC") no-repeat}.se-show-block li{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAPCAYAAADkmO9VAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAA7SURBVDhPYxgFcNDQ0PAfykQBIHEYhgoRB/BpwCfHBKWpBkaggYxQGgOgBzyQD1aLLA4TGwWDGjAwAACR3RcEU9Ui+wAAAABJRU5ErkJggg==") no-repeat}.se-show-block ol{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAMCAYAAABiDJ37AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAABHSURBVDhPYxgFcNDQ0PAfhKFcFIBLHCdA1oBNM0kGEmMAPgOZoDTVANUNxAqQvURMECADRiiNAWCagDSGGhyW4DRrMAEGBgAu0SX6WpGgjAAAAABJRU5ErkJggg==") no-repeat}.se-show-block ul{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAMCAYAAABiDJ37AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAA1SURBVDhPYxgFDA0NDf+hTBSALI5LDQgwQWmqgVEDKQcsUBoF4ItFGEBXA+QzQpmDGjAwAAA8DQ4Lni6gdAAAAABJRU5ErkJggg==") no-repeat}.sun-editor-editable .__se__p-bordered,.sun-editor .__se__p-bordered{border-top:1px solid #b1b1b1;border-bottom:1px solid #b1b1b1;padding:4px 0}.sun-editor-editable .__se__p-spaced,.sun-editor .__se__p-spaced{letter-spacing:1px}.sun-editor-editable .__se__p-neon,.sun-editor .__se__p-neon{font-weight:200;font-style:italic;background:#000;color:#fff;padding:6px 4px;border:2px solid #fff;border-radius:6px;text-transform:uppercase;animation:neonFlicker 1.5s infinite alternate}@keyframes neonFlicker{0%,19%,21%,23%,25%,54%,56%,to{text-shadow:-.2rem -.2rem 1rem #fff,.2rem .2rem 1rem #fff,0 0 2px #f40,0 0 4px #f40,0 0 6px #f40,0 0 8px #f40,0 0 10px #f40;box-shadow:0 0 .5px #fff,inset 0 0 .5px #fff,0 0 2px #08f,inset 0 0 2px #08f,0 0 4px #08f,inset 0 0 4px #08f}20%,24%,55%{text-shadow:none;box-shadow:none}}.sun-editor-editable .__se__t-shadow,.sun-editor .__se__t-shadow{text-shadow:-.2rem -.2rem 1rem #fff,.2rem .2rem 1rem #fff,0 0 .2rem #999,0 0 .4rem #888,0 0 .6rem #777,0 0 .8rem #666,0 0 1rem #555}.sun-editor-editable .__se__t-code,.sun-editor .__se__t-code{font-family:monospace;color:#666;background-color:rgba(27,31,35,.05);border-radius:6px;padding:.2em .4em} \ No newline at end of file diff --git a/dist/suneditor.min.js b/dist/suneditor.min.js index 96e8b1e4c..fb4be9c88 100644 --- a/dist/suneditor.min.js +++ b/dist/suneditor.min.js @@ -1,2 +1,2 @@ -!function(e){var t={};function n(i){if(t[i])return t[i].exports;var l=t[i]={i:i,l:!1,exports:{}};return e[i].call(l.exports,l,l.exports,n),l.l=!0,l.exports}n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var l in e)n.d(i,l,function(t){return e[t]}.bind(null,l));return i},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s="XJR1")}({"1kvd":function(e,t,n){"use strict";var i,l;i="undefined"!=typeof window?window:this,l=function(e,t){const n={name:"dialog",add:function(e){const t=e.context;t.dialog={kind:"",updateModal:!1,_closeSignal:!1};let n=e.util.createElement("DIV");n.className="se-dialog sun-editor-common";let i=e.util.createElement("DIV");i.className="se-dialog-back",i.style.display="none";let l=e.util.createElement("DIV");l.className="se-dialog-inner",l.style.display="none",n.appendChild(i),n.appendChild(l),t.dialog.modalArea=n,t.dialog.back=i,t.dialog.modal=l,t.dialog.modal.addEventListener("mousedown",this._onMouseDown_dialog.bind(e)),t.dialog.modal.addEventListener("click",this._onClick_dialog.bind(e)),t.element.relative.appendChild(n),n=null,i=null,l=null},_onMouseDown_dialog:function(e){/se-dialog-inner/.test(e.target.className)?this.context.dialog._closeSignal=!0:this.context.dialog._closeSignal=!1},_onClick_dialog:function(e){e.stopPropagation(),(/close/.test(e.target.getAttribute("data-command"))||this.context.dialog._closeSignal)&&this.plugins.dialog.close.call(this)},open:function(e,t){if(this.modalForm)return!1;this.plugins.dialog._bindClose&&(this._d.removeEventListener("keydown",this.plugins.dialog._bindClose),this.plugins.dialog._bindClose=null),this.plugins.dialog._bindClose=function(e){/27/.test(e.keyCode)&&this.plugins.dialog.close.call(this)}.bind(this),this._d.addEventListener("keydown",this.plugins.dialog._bindClose),this.context.dialog.updateModal=t,"full"===this.context.option.popupDisplay?this.context.dialog.modalArea.style.position="fixed":this.context.dialog.modalArea.style.position="absolute",this.context.dialog.kind=e,this.modalForm=this.context[e].modal;const n=this.context[e].focusElement;"function"==typeof this.plugins[e].on&&this.plugins[e].on.call(this,t),this.context.dialog.modalArea.style.display="block",this.context.dialog.back.style.display="block",this.context.dialog.modal.style.display="block",this.modalForm.style.display="block",n&&n.focus()},_bindClose:null,close:function(){this.plugins.dialog._bindClose&&(this._d.removeEventListener("keydown",this.plugins.dialog._bindClose),this.plugins.dialog._bindClose=null);const e=this.context.dialog.kind;this.modalForm.style.display="none",this.context.dialog.back.style.display="none",this.context.dialog.modalArea.style.display="none",this.context.dialog.updateModal=!1,"function"==typeof this.plugins[e].init&&this.plugins[e].init.call(this),this.context.dialog.kind="",this.modalForm=null,this.focus()}};return void 0===t&&(e.SUNEDITOR_MODULES||Object.defineProperty(e,"SUNEDITOR_MODULES",{enumerable:!0,writable:!1,configurable:!1,value:{}}),Object.defineProperty(e.SUNEDITOR_MODULES,"dialog",{enumerable:!0,writable:!1,configurable:!1,value:n})),n},"object"==typeof e.exports?e.exports=i.document?l(i,!0):function(e){if(!e.document)throw new Error("SUNEDITOR_MODULES a window with a document");return l(e)}:l(i)},"3FqI":function(e,t,n){},JhlZ:function(e,t,n){"use strict";var i,l;i="undefined"!=typeof window?window:this,l=function(e,t){const n={name:"fileBrowser",_xmlHttp:null,_loading:null,add:function(e){const t=e.context;t.fileBrowser={_closeSignal:!1,area:null,header:null,tagArea:null,body:null,list:null,tagElements:null,items:[],selectedTags:[],selectorHandler:null,contextPlugin:"",columnSize:4};let n=e.util.createElement("DIV");n.className="se-file-browser sun-editor-common";let i=e.util.createElement("DIV");i.className="se-file-browser-back";let l=e.util.createElement("DIV");l.className="se-file-browser-inner",l.innerHTML=this.set_browser(e),n.appendChild(i),n.appendChild(l),this._loading=n.querySelector(".se-loading-box"),t.fileBrowser.area=n,t.fileBrowser.header=l.querySelector(".se-file-browser-header"),t.fileBrowser.titleArea=l.querySelector(".se-file-browser-title"),t.fileBrowser.tagArea=l.querySelector(".se-file-browser-tags"),t.fileBrowser.body=l.querySelector(".se-file-browser-body"),t.fileBrowser.list=l.querySelector(".se-file-browser-list"),t.fileBrowser.tagArea.addEventListener("click",this.onClickTag.bind(e)),t.fileBrowser.list.addEventListener("click",this.onClickFile.bind(e)),l.addEventListener("mousedown",this._onMouseDown_browser.bind(e)),l.addEventListener("click",this._onClick_browser.bind(e)),t.element.relative.appendChild(n),n=null,i=null,l=null},set_browser:function(e){return'
    '},_onMouseDown_browser:function(e){/se-file-browser-inner/.test(e.target.className)?this.context.fileBrowser._closeSignal=!0:this.context.fileBrowser._closeSignal=!1},_onClick_browser:function(e){e.stopPropagation(),(/close/.test(e.target.getAttribute("data-command"))||this.context.fileBrowser._closeSignal)&&this.plugins.fileBrowser.close.call(this)},open:function(e,t){this.plugins.fileBrowser._bindClose&&(this._d.removeEventListener("keydown",this.plugins.fileBrowser._bindClose),this.plugins.fileBrowser._bindClose=null),this.plugins.fileBrowser._bindClose=function(e){/27/.test(e.keyCode)&&this.plugins.fileBrowser.close.call(this)}.bind(this),this._d.addEventListener("keydown",this.plugins.fileBrowser._bindClose);const n=this.context.fileBrowser;n.contextPlugin=e,n.selectorHandler=t;const i=this.context[e],l=i.listClass;this.util.hasClass(n.list,l)||(n.list.className="se-file-browser-list "+l),"full"===this.context.option.popupDisplay?n.area.style.position="fixed":n.area.style.position="absolute",n.titleArea.textContent=i.title,n.area.style.display="block",this.plugins.fileBrowser._drawFileList.call(this,this.context[e].url)},_bindClose:null,close:function(){const e=this.plugins.fileBrowser;e._xmlHttp&&e._xmlHttp.abort(),e._bindClose&&(this._d.removeEventListener("keydown",e._bindClose),e._bindClose=null);const t=this.context.fileBrowser;t.area.style.display="none",t.selectorHandler=null,t.selectedTags=[],t.items=[],t.list.innerHTML=t.tagArea.innerHTML=t.titleArea.textContent="","function"==typeof this.plugins[t.contextPlugin].init&&this.plugins[t.contextPlugin].init.call(this),t.contextPlugin=""},showBrowserLoading:function(){this._loading.style.display="block"},closeBrowserLoading:function(){this._loading.style.display="none"},_drawFileList:function(e){const t=this.plugins.fileBrowser,n=t._xmlHttp=this.util.getXMLHttpRequest();n.onreadystatechange=t._callBackGet.bind(this,n),n.open("get",e,!0),n.send(null),this.plugins.fileBrowser.showBrowserLoading()},_callBackGet:function(e){if(4===e.readyState)if(this.plugins.fileBrowser._xmlHttp=null,200===e.status)try{this.plugins.fileBrowser._drawListItem.call(this,JSON.parse(e.responseText).result,!0)}catch(e){throw Error('[SUNEDITOR.fileBrowser.drawList.fail] cause : "'+e.message+'"')}finally{this.plugins.fileBrowser.closeBrowserLoading(),this.context.fileBrowser.body.style.maxHeight=this._w.innerHeight-this.context.fileBrowser.header.offsetHeight-50+"px"}else if(this.plugins.fileBrowser.closeBrowserLoading(),0!==e.status){const t=e.responseText?JSON.parse(e.responseText):e,n="[SUNEDITOR.fileBrowser.get.serverException] status: "+e.status+", response: "+(t.errorMessage||e.responseText);throw Error(n)}},_drawListItem:function(e,t){const n=this.context.fileBrowser,i=this.context[n.contextPlugin],l=[],o=e.length,s=i.columnSize||n.columnSize,a=s<=1?1:Math.round(o/s)||1,r=i.itemTemplateHandler;let c="",d='
    ',u=1;for(let n,i,h=0;h
    '),t&&i.length>0)for(let e,t=0,n=i.length;t'+e+"");d+="
    ",n.list.innerHTML=d,t&&(n.items=e,n.tagArea.innerHTML=c,n.tagElements=n.tagArea.querySelectorAll("A"))},onClickTag:function(e){const t=e.target;if(!this.util.isAnchor(t))return;const n=t.textContent,i=this.plugins.fileBrowser,l=this.context.fileBrowser,o=l.tagArea.querySelector('a[title="'+n+'"]'),s=l.selectedTags,a=s.indexOf(n);a>-1?(s.splice(a,1),this.util.removeClass(o,"on")):(s.push(n),this.util.addClass(o,"on")),i._drawListItem.call(this,0===s.length?l.items:l.items.filter((function(e){return e.tag.some((function(e){return s.indexOf(e)>-1}))})),!1)},onClickFile:function(e){e.preventDefault(),e.stopPropagation();const t=this.context.fileBrowser,n=t.list;let i=e.target,l=null;if(i===n)return;for(;n!==i.parentNode&&(l=i.getAttribute("data-command"),!l);)i=i.parentNode;if(!l)return;const o=t.selectorHandler||this.context[t.contextPlugin].selectorHandler;this.plugins.fileBrowser.close.call(this),o(i)}};return void 0===t&&(e.SUNEDITOR_MODULES||Object.defineProperty(e,"SUNEDITOR_MODULES",{enumerable:!0,writable:!1,configurable:!1,value:{}}),Object.defineProperty(e.SUNEDITOR_MODULES,"fileBrowser",{enumerable:!0,writable:!1,configurable:!1,value:n})),n},"object"==typeof e.exports?e.exports=i.document?l(i,!0):function(e){if(!e.document)throw new Error("SUNEDITOR_MODULES a window with a document");return l(e)}:l(i)},P6u4:function(e,t,n){"use strict";var i,l;i="undefined"!=typeof window?window:this,l=function(e,t){const n={code:"en",toolbar:{default:"Default",save:"Save",font:"Font",formats:"Formats",fontSize:"Size",bold:"Bold",underline:"Underline",italic:"Italic",strike:"Strike",subscript:"Subscript",superscript:"Superscript",removeFormat:"Remove Format",fontColor:"Font Color",hiliteColor:"Highlight Color",indent:"Indent",outdent:"Outdent",align:"Align",alignLeft:"Align left",alignRight:"Align right",alignCenter:"Align center",alignJustify:"Align justify",list:"List",orderList:"Ordered list",unorderList:"Unordered list",horizontalRule:"Horizontal line",hr_solid:"Solid",hr_dotted:"Dotted",hr_dashed:"Dashed",table:"Table",link:"Link",math:"Math",image:"Image",video:"Video",audio:"Audio",fullScreen:"Full screen",showBlocks:"Show blocks",codeView:"Code view",undo:"Undo",redo:"Redo",preview:"Preview",print:"print",tag_p:"Paragraph",tag_div:"Normal (DIV)",tag_h:"Header",tag_blockquote:"Quote",tag_pre:"Code",template:"Template",lineHeight:"Line height",paragraphStyle:"Paragraph style",textStyle:"Text style",imageGallery:"Image gallery"},dialogBox:{linkBox:{title:"Insert Link",url:"URL to link",text:"Text to display",newWindowCheck:"Open in new window"},mathBox:{title:"Math",inputLabel:"Mathematical Notation",fontSizeLabel:"Font Size",previewLabel:"Preview"},imageBox:{title:"Insert image",file:"Select from files",url:"Image URL",altText:"Alternative text"},videoBox:{title:"Insert Video",file:"Select from files",url:"Media embed URL, YouTube/Vimeo"},audioBox:{title:"Insert Audio",file:"Select from files",url:"Audio URL"},browser:{tags:"Tags",search:"Search"},caption:"Insert description",close:"Close",submitButton:"Submit",revertButton:"Revert",proportion:"Constrain proportions",basic:"Basic",left:"Left",right:"Right",center:"Center",width:"Width",height:"Height",size:"Size",ratio:"Ratio"},controller:{edit:"Edit",unlink:"Unlink",remove:"Remove",insertRowAbove:"Insert row above",insertRowBelow:"Insert row below",deleteRow:"Delete row",insertColumnBefore:"Insert column before",insertColumnAfter:"Insert column after",deleteColumn:"Delete column",fixedColumnWidth:"Fixed column width",resize100:"Resize 100%",resize75:"Resize 75%",resize50:"Resize 50%",resize25:"Resize 25%",autoSize:"Auto size",mirrorHorizontal:"Mirror, Horizontal",mirrorVertical:"Mirror, Vertical",rotateLeft:"Rotate left",rotateRight:"Rotate right",maxSize:"Max size",minSize:"Min size",tableHeader:"Table header",mergeCells:"Merge cells",splitCells:"Split Cells",HorizontalSplit:"Horizontal split",VerticalSplit:"Vertical split"},menu:{spaced:"Spaced",bordered:"Bordered",neon:"Neon",translucent:"Translucent",shadow:"Shadow",code:"Code"}};return void 0===t&&(e.SUNEDITOR_LANG||Object.defineProperty(e,"SUNEDITOR_LANG",{enumerable:!0,writable:!1,configurable:!1,value:{}}),Object.defineProperty(e.SUNEDITOR_LANG,"en",{enumerable:!0,writable:!0,configurable:!0,value:n})),n},"object"==typeof e.exports?e.exports=i.document?l(i,!0):function(e){if(!e.document)throw new Error("SUNEDITOR_LANG a window with a document");return l(e)}:l(i)},WUQj:function(e,t,n){},XJR1:function(e,t,n){"use strict";n.r(t);n("3FqI"),n("WUQj");var i={name:"colorPicker",add:function(e){const t=e.context;t.colorPicker={colorListHTML:"",_colorInput:"",_defaultColor:"#000",_styleProperty:"color",_currentColor:"",_colorList:[]};let n=this.createColorList(e,this._makeColorList);t.colorPicker.colorListHTML=n,n=null},createColorList:function(e,t){const n=e.context.option,i=e.lang,l=n.colorList&&0!==n.colorList.length?n.colorList:["#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"];let o=[],s='
    ';for(let e,n=0,i=l.length;n0&&(s+='
    '+t(o)+"
    ",o=[]),"object"==typeof e&&(s+='
    '+t(e)+"
    ")));return s+='
    ",s},_makeColorList:function(e){let t="";t+='
      ';for(let n,i=0,l=e.length;i');return t+="
    ",t},init:function(e,t){const n=this.plugins.colorPicker;let i=t||(n.getColorInNode.call(this,e)||this.context.colorPicker._defaultColor);i=n.isHexColor(i)?i:n.rgb2hex(i)||i;const l=this.context.colorPicker._colorList;if(l)for(let e=0,t=l.length;e=3&&"#"+((1<<24)+(n[0]<<16)+(n[1]<<8)+n[2]).toString(16).substr(1)}},l={name:"fontColor",display:"submenu",add:function(e,t){e.addModule([i]);const n=e.context;n.fontColor={previewEl:null,colorInput:null,colorList:null};let l=this.setSubmenu.call(e);n.fontColor.colorInput=l.querySelector("._se_color_picker_input"),n.fontColor.colorInput.addEventListener("keyup",this.onChangeInput.bind(e)),l.querySelector("._se_color_picker_submit").addEventListener("click",this.submit.bind(e)),l.querySelector("._se_color_picker_remove").addEventListener("click",this.remove.bind(e)),l.addEventListener("click",this.pickup.bind(e)),n.fontColor.colorList=l.querySelectorAll("li button"),e.initMenuTarget(this.name,t,l),l=null},setSubmenu:function(){const e=this.context.colorPicker.colorListHTML,t=this.util.createElement("DIV");return t.className="se-submenu se-list-layer",t.innerHTML=e,t},on:function(){const e=this.context.colorPicker,t=this.context.fontColor;e._colorInput=t.colorInput,e._defaultColor="#333333",e._styleProperty="color",e._colorList=t.colorList,this.plugins.colorPicker.init.call(this,this.getSelectionNode(),null)},onChangeInput:function(e){this.plugins.colorPicker.setCurrentColor.call(this,e.target.value)},submit:function(){this.plugins.fontColor.applyColor.call(this,this.context.colorPicker._currentColor)},pickup:function(e){e.preventDefault(),e.stopPropagation(),this.plugins.fontColor.applyColor.call(this,e.target.getAttribute("data-value"))},remove:function(){this.nodeChange(null,["color"],["span"],!0),this.submenuOff()},applyColor:function(e){if(!e)return;const t=this.util.createElement("SPAN");t.style.color=e,this.nodeChange(t,["color"],null,null),this.submenuOff()}},o={name:"hiliteColor",display:"submenu",add:function(e,t){e.addModule([i]);const n=e.context;n.hiliteColor={previewEl:null,colorInput:null,colorList:null};let l=this.setSubmenu.call(e);n.hiliteColor.colorInput=l.querySelector("._se_color_picker_input"),n.hiliteColor.colorInput.addEventListener("keyup",this.onChangeInput.bind(e)),l.querySelector("._se_color_picker_submit").addEventListener("click",this.submit.bind(e)),l.querySelector("._se_color_picker_remove").addEventListener("click",this.remove.bind(e)),l.addEventListener("click",this.pickup.bind(e)),n.hiliteColor.colorList=l.querySelectorAll("li button"),e.initMenuTarget(this.name,t,l),l=null},setSubmenu:function(){const e=this.context.colorPicker.colorListHTML,t=this.util.createElement("DIV");return t.className="se-submenu se-list-layer",t.innerHTML=e,t},on:function(){const e=this.context.colorPicker,t=this.context.hiliteColor;e._colorInput=t.colorInput,e._defaultColor="#FFFFFF",e._styleProperty="backgroundColor",e._colorList=t.colorList,this.plugins.colorPicker.init.call(this,this.getSelectionNode(),null)},onChangeInput:function(e){this.plugins.colorPicker.setCurrentColor.call(this,e.target.value)},submit:function(){this.plugins.hiliteColor.applyColor.call(this,this.context.colorPicker._currentColor)},pickup:function(e){e.preventDefault(),e.stopPropagation(),this.plugins.hiliteColor.applyColor.call(this,e.target.getAttribute("data-value"))},remove:function(){this.nodeChange(null,["background-color"],["span"],!0),this.submenuOff()},applyColor:function(e){if(!e)return;const t=this.util.createElement("SPAN");t.style.backgroundColor=e,this.nodeChange(t,["background-color"],null,null),this.submenuOff()}},s={name:"template",display:"submenu",add:function(e,t){e.context.template={};let n=this.setSubmenu.call(e);n.querySelector("ul").addEventListener("click",this.pickup.bind(e)),e.initMenuTarget(this.name,t,n),n=null},setSubmenu:function(){const e=this.context.option.templates;if(!e||0===e.length)throw Error('[SUNEDITOR.plugins.template.fail] To use the "template" plugin, please define the "templates" option.');const t=this.util.createElement("DIV");t.className="se-list-layer";let n='
      ';for(let t,i=0,l=e.length;i";return n+="
    ",t.innerHTML=n,t},pickup:function(e){if(!/^BUTTON$/i.test(e.target.tagName))return!1;e.preventDefault(),e.stopPropagation();const t=this.context.option.templates[e.target.getAttribute("data-value")];if(!t.html)throw this.submenuOff(),Error('[SUNEDITOR.template.fail] cause : "templates[i].html not found"');this.setContents(t.html),this.submenuOff()}},a=n("1kvd"),r=n.n(a),c={name:"link",display:"dialog",add:function(e){e.addModule([r.a]);const t=e.context;t.link={focusElement:null,linkNewWindowCheck:null,linkAnchorText:null,_linkAnchor:null,_linkValue:""};let n=this.setDialog.call(e);t.link.modal=n,t.link.focusElement=n.querySelector("._se_link_url"),t.link.linkAnchorText=n.querySelector("._se_link_text"),t.link.linkNewWindowCheck=n.querySelector("._se_link_check"),t.link.preview=n.querySelector(".se-link-preview");let i=this.setController_LinkButton.call(e);t.link.linkController=i,t.link._linkAnchor=null,i.addEventListener("mousedown",e.eventStop),n.querySelector(".se-btn-primary").addEventListener("click",this.submit.bind(e)),i.addEventListener("click",this.onClick_linkController.bind(e)),t.link.focusElement.addEventListener("input",this._onLinkPreview.bind(t.link.preview,t.link,t.options.linkProtocol)),t.dialog.modal.appendChild(n),t.element.relative.appendChild(i),n=null,i=null},setDialog:function(){const e=this.lang,t=this.util.createElement("DIV");return t.className="se-dialog-content",t.style.display="none",t.innerHTML='",t},setController_LinkButton:function(){const e=this.lang,t=this.icons,n=this.util.createElement("DIV");return n.className="se-controller se-controller-link",n.innerHTML='
    ",n},open:function(){this.plugins.dialog.open.call(this,"link","link"===this.currentControllerName)},_onLinkPreview:function(e,t,n){const i=n.target.value.trim();e._linkValue=this.textContent=i?t&&-1===i.indexOf("://")&&0!==i.indexOf("#")?t+i:-1===i.indexOf("://")?"/"+i:i:""},submit:function(e){this.showLoading(),e.preventDefault(),e.stopPropagation();const t=function(){const e=this.context.link;if(0===e._linkValue.length)return!1;const t=e._linkValue,n=e.linkAnchorText,i=0===n.value.length?t:n.value;if(this.context.dialog.updateModal){e._linkAnchor.href=t,e._linkAnchor.textContent=i,e._linkAnchor.target=e.linkNewWindowCheck.checked?"_blank":"";const n=e._linkAnchor.childNodes[0];this.setRange(n,0,n,n.textContent.length)}else{const n=this.util.createElement("A");n.href=t,n.textContent=i,n.target=e.linkNewWindowCheck.checked?"_blank":"";const l=this.getSelectedElements();if(l.length>1){const e=this.util.createElement(l[0].nodeName);if(e.appendChild(n),!this.insertNode(e,null,!0))return}else if(!this.insertNode(n,null,!0))return;this.setRange(n.childNodes[0],0,n.childNodes[0],n.textContent.length)}e._linkValue=e.preview.textContent=e.focusElement.value=e.linkAnchorText.value=""}.bind(this);try{t()}finally{this.plugins.dialog.close.call(this),this.closeLoading(),this.history.push(!1)}return!1},active:function(e){if(e){if(this.util.isAnchor(e)&&null===e.getAttribute("data-image-link"))return this.controllerArray.indexOf(this.context.link.linkController)<0&&this.plugins.link.call_controller.call(this,e),!0}else this.controllerArray.indexOf(this.context.link.linkController)>-1&&this.controllersOff();return!1},on:function(e){const t=this.context.link;e?t._linkAnchor&&(this.context.dialog.updateModal=!0,t._linkValue=t.preview.textContent=t.focusElement.value=t._linkAnchor.href,t.linkAnchorText.value=t._linkAnchor.textContent,t.linkNewWindowCheck.checked=!!/_blank/i.test(t._linkAnchor.target)):(this.plugins.link.init.call(this),t.linkAnchorText.value=this.getSelection().toString())},call_controller:function(e){this.editLink=this.context.link._linkAnchor=e;const t=this.context.link.linkController,n=t.querySelector("a");n.href=e.href,n.title=e.textContent,n.textContent=e.textContent;const i=this.util.getOffset(e,this.context.element.wysiwygFrame);t.style.top=i.top+e.offsetHeight+10+"px",t.style.left=i.left-this.context.element.wysiwygFrame.scrollLeft+"px",t.style.display="block";const l=this.context.element.wysiwygFrame.offsetWidth-(t.offsetLeft+t.offsetWidth);l<0?(t.style.left=t.offsetLeft+l+"px",t.firstElementChild.style.left=20-l+"px"):t.firstElementChild.style.left="20px",this.controllersOn(t,e,"link")},onClick_linkController:function(e){e.stopPropagation();const t=e.target.getAttribute("data-command")||e.target.parentNode.getAttribute("data-command");if(t){if(e.preventDefault(),/update/.test(t)){const e=this.context.link;e._linkValue=e.preview.textContent=e.focusElement.value=e._linkAnchor.href,e.linkAnchorText.value=e._linkAnchor.textContent,e.linkNewWindowCheck.checked=!!/_blank/i.test(e._linkAnchor.target),this.plugins.dialog.open.call(this,"link",!0)}else if(/unlink/.test(t)){const e=this.util.getChildElement(this.context.link._linkAnchor,(function(e){return 0===e.childNodes.length||3===e.nodeType}),!1),t=this.util.getChildElement(this.context.link._linkAnchor,(function(e){return 0===e.childNodes.length||3===e.nodeType}),!0);this.setRange(e,0,t,t.textContent.length),this.nodeChange(null,null,["A"],!1)}else this.util.removeItem(this.context.link._linkAnchor),this.context.link._linkAnchor=null,this.focus(),this.history.push(!1);this.controllersOff()}},init:function(){const e=this.context.link;e.linkController.style.display="none",e._linkAnchor=null,e._linkValue=e.preview.textContent=e.focusElement.value="",e.linkAnchorText.value="",e.linkNewWindowCheck.checked=!1}},d=n("ZED3"),u=n.n(d),h=n("ee5k"),g=n.n(h),p=n("gjS+"),m=n.n(p),f={name:"image",display:"dialog",add:function(e){e.addModule([r.a,u.a,g.a,m.a]);const t=e.context,n=t.image={_infoList:[],_infoIndex:0,_uploadFileLength:0,sizeUnit:t.option._imageSizeUnit,_altText:"",_linkElement:null,_align:"none",_floatClassRegExp:"__se__float\\-[a-z]+",_v_link:{_linkValue:""},_v_src:{_linkValue:""},svgDefaultSize:"30%",_element:null,_cover:null,_container:null,inputX:null,inputY:null,_element_w:1,_element_h:1,_element_l:0,_element_t:0,_defaultSizeX:"auto",_defaultSizeY:"auto",_origin_w:"auto"===t.option.imageWidth?"":t.option.imageWidth,_origin_h:"auto"===t.option.imageHeight?"":t.option.imageHeight,_proportionChecked:!0,_resizing:t.option.imageResizing,_resizeDotHide:!t.option.imageHeightShow,_rotation:t.option.imageRotation,_onlyPercentage:t.option.imageSizeOnlyPercentage,_ratio:!1,_ratioX:1,_ratioY:1,_captionShow:!0,_captionChecked:!1,_caption:null,captionCheckEl:null};let i=this.setDialog.call(e);n.modal=i,n.imgInputFile=i.querySelector("._se_image_file"),n.imgUrlFile=i.querySelector(".se-input-url"),n.focusElement=n.imgInputFile||n.imgUrlFile,n.altText=i.querySelector("._se_image_alt"),n.imgLink=i.querySelector("._se_image_link"),n.imgLinkNewWindowCheck=i.querySelector("._se_image_link_check"),n.captionCheckEl=i.querySelector("._se_image_check_caption"),n.previewLink=i.querySelector("._se_tab_content_url .se-link-preview"),n.previewSrc=i.querySelector("._se_tab_content_image .se-link-preview"),i.querySelector(".se-dialog-tabs").addEventListener("click",this.openTab.bind(e)),i.querySelector(".se-btn-primary").addEventListener("click",this.submit.bind(e)),n.imgInputFile&&i.querySelector(".se-file-remove").addEventListener("click",this._removeSelectedFiles.bind(n.imgInputFile,n.imgUrlFile,n.previewSrc)),n.imgInputFile&&n.imgUrlFile&&n.imgInputFile.addEventListener("change",this._fileInputChange.bind(n)),n.imgLink.addEventListener("input",this._onLinkPreview.bind(n.previewLink,n._v_link,t.options.linkProtocol)),n.imgUrlFile&&n.imgUrlFile.addEventListener("input",this._onLinkPreview.bind(n.previewSrc,n._v_src,t.options.linkProtocol));const l=i.querySelector(".__se__gallery");l&&l.addEventListener("click",this._openGallery.bind(e)),n.proportion={},n.inputX={},n.inputY={},t.option.imageResizing&&(n.proportion=i.querySelector("._se_image_check_proportion"),n.inputX=i.querySelector("._se_image_size_x"),n.inputY=i.querySelector("._se_image_size_y"),n.inputX.value=t.option.imageWidth,n.inputY.value=t.option.imageHeight,n.inputX.addEventListener("keyup",this.setInputSize.bind(e,"x")),n.inputY.addEventListener("keyup",this.setInputSize.bind(e,"y")),n.inputX.addEventListener("change",this.setRatio.bind(e)),n.inputY.addEventListener("change",this.setRatio.bind(e)),n.proportion.addEventListener("change",this.setRatio.bind(e)),i.querySelector(".se-dialog-btn-revert").addEventListener("click",this.sizeRevert.bind(e))),t.dialog.modal.appendChild(i),i=null},setDialog:function(){const e=this.context.option,t=this.lang,n=this.util.createElement("DIV");n.className="se-dialog-content",n.style.display="none";let i='
    '+t.dialogBox.imageBox.title+'
    ';if(e.imageFileInput&&(i+='
    "),e.imageUrlInput&&(i+='
    '+(e.imageGalleryUrl&&this.plugins.imageGallery?'":"")+'
    '),i+='
    ',e.imageResizing){const n=e.imageSizeOnlyPercentage,l=n?' style="display: none !important;"':"",o=e.imageHeightShow?"":' style="display: none !important;"';i+='
    ',n||!e.imageHeightShow?i+='
    ":i+='
    ",i+=' '+t.dialogBox.proportion+'
    "}return i+='
    ",n.innerHTML=i,n},_fileInputChange:function(){this.imgInputFile.value?(this.imgUrlFile.setAttribute("disabled",!0),this.previewSrc.style.textDecoration="line-through"):(this.imgUrlFile.removeAttribute("disabled"),this.previewSrc.style.textDecoration="")},_removeSelectedFiles:function(e,t){this.value="",e&&(e.removeAttribute("disabled"),t.style.textDecoration="")},_openGallery:function(){this.callPlugin("imageGallery",this.plugins.imageGallery.open.bind(this,this.plugins.image._setUrlInput.bind(this.context.image)),null)},_setUrlInput:function(e){this.altText.value=e.alt,this._v_src._linkValue=this.previewSrc.textContent=this.imgUrlFile.value=e.src,this.imgUrlFile.focus()},_onLinkPreview:function(e,t,n){const i=n.target.value.trim();e._linkValue=this.textContent=i?t&&-1===i.indexOf("://")&&0!==i.indexOf("#")?t+i:-1===i.indexOf("://")?"/"+i:i:""},fileTags:["img"],select:function(e){this.plugins.image.onModifyMode.call(this,e,this.plugins.resizing.call_controller_resize.call(this,e,"image"))},destroy:function(e){const t=e||this.context.image._element,n=this.util.getParentElement(t,this.util.isMediaComponent)||t,i=1*t.getAttribute("data-index");let l=n.previousElementSibling||n.nextElementSibling;const o=n.parentNode;this.util.removeItem(n),this.plugins.image.init.call(this),this.controllersOff(),o!==this.context.element.wysiwyg&&this.util.removeItemAllParents(o,(function(e){return 0===e.childNodes.length}),null),this.focusEdge(l),this.plugins.fileManager.deleteInfo.call(this,"image",i,this.functions.onImageUpload),this.history.push(!1)},on:function(e){const t=this.context.image;e?t.imgInputFile&&this.context.options.imageMultipleFile&&t.imgInputFile.removeAttribute("multiple"):(t.inputX.value=t._origin_w=this.context.option.imageWidth===t._defaultSizeX?"":this.context.option.imageWidth,t.inputY.value=t._origin_h=this.context.option.imageHeight===t._defaultSizeY?"":this.context.option.imageHeight,t.imgInputFile&&this.context.options.imageMultipleFile&&t.imgInputFile.setAttribute("multiple","multiple"))},open:function(){this.plugins.dialog.open.call(this,"image","image"===this.currentControllerName)},openTab:function(e){const t=this.context.image.modal,n="init"===e?t.querySelector("._se_tab_link"):e.target;if(!/^BUTTON$/i.test(n.tagName))return!1;const i=n.getAttribute("data-tab-link");let l,o,s;for(o=t.getElementsByClassName("_se_tab_content"),l=0;l0?(this.showLoading(),n.submitAction.call(this,this.context.image.imgInputFile.files)):t.imgUrlFile&&t._v_src._linkValue.length>0&&(this.showLoading(),n.onRender_imgUrl.call(this))}catch(e){throw this.closeLoading(),Error('[SUNEDITOR.image.submit.fail] cause : "'+e.message+'"')}finally{this.plugins.dialog.close.call(this)}return!1},submitAction:function(e){if(0===e.length)return;let t=0,n=[];for(let i=0,l=e.length;i0){let e=0;const n=this.context.image._infoList;for(let t=0,i=n.length;ti){this.closeLoading();const n="[SUNEDITOR.imageUpload.fail] Size of uploadable total images: "+i/1e3+"KB";return void(("function"!==this.functions.onImageUploadError||this.functions.onImageUploadError(n,{limitSize:i,currentSize:e,uploadSize:t},this))&&this.functions.noticeOpen(n))}}const l=this.context.image;l._uploadFileLength=n.length;const o={linkValue:l._v_link._linkValue,linkNewWindow:l.imgLinkNewWindowCheck.checked,inputWidth:l.inputX.value,inputHeight:l.inputY.value,align:l._align,isUpdate:this.context.dialog.updateModal,element:l._element};if("function"==typeof this.functions.onImageUploadBefore){const e=this.functions.onImageUploadBefore(n,o,this,function(e){e&&this._w.Array.isArray(e.result)?this.plugins.image.register.call(this,o,e):this.plugins.image.upload.call(this,o,e)}.bind(this));if(void 0===e)return;if(!e)return void this.closeLoading();this._w.Array.isArray(e)&&e.length>0&&(n=e)}this.plugins.image.upload.call(this,o,n)},error:function(e,t){if(this.closeLoading(),"function"!=typeof this.functions.onImageUploadError||this.functions.onImageUploadError(e,t,this))throw this.functions.noticeOpen(e),Error("[SUNEDITOR.plugin.image.error] response: "+e)},upload:function(e,t){if(!t)return void this.closeLoading();if("string"==typeof t)return void this.plugins.image.error.call(this,t,null);const n=this.context.option.imageUploadUrl,i=this.context.dialog.updateModal?1:t.length;if("string"==typeof n&&n.length>0){const l=new FormData;for(let e=0;e0){const i=this.util.createElement("A");return i.href=/^https?:\/\//.test(t)?t:"http://"+t,i.target=n?"_blank":"",i.setAttribute("data-image-link","image"),e.setAttribute("data-image-link",t),i.appendChild(e),i}return e},setInputSize:function(e,t){t&&32===t.keyCode?t.preventDefault():this.plugins.resizing._module_setInputSize.call(this,this.context.image,e)},setRatio:function(){this.plugins.resizing._module_setRatio.call(this,this.context.image)},checkFileInfo:function(){const e=this.plugins.image,t=function(t){e.onModifyMode.call(this,t,null),e.openModify.call(this,!0),e.update_image.call(this,!0,!1,!0)}.bind(this);this.plugins.fileManager.checkInfo.call(this,"image",["img"],this.functions.onImageUpload,t,!0)},resetFileInfo:function(){this.plugins.fileManager.resetInfo.call(this,"image",this.functions.onImageUpload)},create_image:function(e,t,n,i,l,o,s){const a=this.plugins.image,r=this.context.image;this.context.resizing._resize_plugin="image";let c=this.util.createElement("IMG");c.src=e,c.alt=r._altText,c=a.onRender_link.call(this,c,t,n),c.setAttribute("data-rotate","0"),r._resizing&&c.setAttribute("data-proportion",r._proportionChecked);const d=this.plugins.component.set_cover.call(this,c),u=this.plugins.component.set_container.call(this,d,"se-image-container");r._captionChecked&&(r._caption=this.plugins.component.create_caption.call(this),r._caption.setAttribute("contenteditable",!1),d.appendChild(r._caption)),r._element=c,r._cover=d,r._container=u,a.applySize.call(this,i,l),a.setAlign.call(this,o,c,d,u),c.onload=a._image_create_onload.bind(this,c,r.svgDefaultSize),this.insertComponent(u,!0,!0,!0)&&this.plugins.fileManager.setInfo.call(this,"image",c,this.functions.onImageUpload,s,!0),this.context.resizing._resize_plugin=""},_image_create_onload:function(e,t){0===e.offsetWidth&&this.plugins.image.applySize.call(this,t,""),this.selectComponent.call(this,e,"image")},update_image:function(e,t,n){const i=this.context.image,l=i._v_link._linkValue;let o,s=i._element,a=i._cover,r=i._container,c=!1;null===a&&(c=!0,s=i._element.cloneNode(!0),a=this.plugins.component.set_cover.call(this,s)),null===r?(a=a.cloneNode(!0),s=a.querySelector("img"),c=!0,r=this.plugins.component.set_container.call(this,a,"se-image-container")):c&&(r.innerHTML="",r.appendChild(a),i._cover=a,i._element=s,c=!1);const d=this.util.isNumber(i.inputX.value)?i.inputX.value+i.sizeUnit:i.inputX.value,u=this.util.isNumber(i.inputY.value)?i.inputY.value+i.sizeUnit:i.inputY.value;o=/%$/.test(s.style.width)?d!==r.style.width||u!==r.style.height:d!==s.style.width||u!==s.style.height,s.alt=i._altText;let h=!1;if(i._captionChecked?i._caption||(i._caption=this.plugins.component.create_caption.call(this),a.appendChild(i._caption),h=!0):i._caption&&(this.util.removeItem(i._caption),i._caption=null,h=!0),l.trim().length>0)if(null!==i._linkElement&&a.contains(i._linkElement))i._linkElement.href=l,i._linkElement.target=i.imgLinkNewWindowCheck.checked?"_blank":"",s.setAttribute("data-image-link",l);else{let e=this.plugins.image.onRender_link.call(this,s,l,this.context.image.imgLinkNewWindowCheck.checked);a.insertBefore(e,i._caption)}else if(null!==i._linkElement){const e=s;e.setAttribute("data-image-link","");let t=e.cloneNode(!0);a.removeChild(i._linkElement),a.insertBefore(t,i._caption),s=t}if(c){const e=this.util.isRangeFormatElement(i._element.parentNode)||this.util.isWysiwygDiv(i._element.parentNode)?i._element:/^A$/i.test(i._element.parentNode.nodeName)?i._element.parentNode:this.util.getFormatElement(i._element)||i._element;e.parentNode.replaceChild(r,e),s=r.querySelector("img"),i._element=s,i._cover=a,i._container=r}(h||!i._onlyPercentage&&o)&&!e&&(/\d+/.test(s.style.height)||this.context.resizing._rotateVertical&&i._captionChecked)&&(/%$/.test(i.inputX.value)||/%$/.test(i.inputY.value)?this.plugins.resizing.resetTransform.call(this,s):this.plugins.resizing.setTransformSize.call(this,s,this.util.getNumber(i.inputX.value,0),this.util.getNumber(i.inputY.value,0)));i._resizing&&(s.setAttribute("data-proportion",i._proportionChecked),o&&this.plugins.image.applySize.call(this)),this.plugins.image.setAlign.call(this,null,s,null,null),e&&this.plugins.fileManager.setInfo.call(this,"image",s,this.functions.onImageUpload,null,!0),t&&this.selectComponent(s,"image"),n||this.history.push(!1)},update_src:function(e,t,n){t.src=e,this._w.setTimeout(this.plugins.fileManager.setInfo.bind(this,"image",t,this.functions.onImageUpload,n,!0)),this.selectComponent(t,"image")},onModifyMode:function(e,t){if(!e)return;const n=this.context.image;n._linkElement=/^A$/i.test(e.parentNode.nodeName)?e.parentNode:null,n._element=e,n._cover=this.util.getParentElement(e,"FIGURE"),n._container=this.util.getParentElement(e,this.util.isMediaComponent),n._caption=this.util.getChildElement(n._cover,"FIGCAPTION"),n._align=e.getAttribute("data-align")||"none",t&&(n._element_w=t.w,n._element_h=t.h,n._element_t=t.t,n._element_l=t.l);let i=n._element.getAttribute("data-size")||n._element.getAttribute("data-origin");i?(i=i.split(","),n._origin_w=i[0],n._origin_h=i[1]):t&&(n._origin_w=t.w,n._origin_h=t.h)},openModify:function(e){const t=this.context.image;t.imgUrlFile&&(t._v_src._linkValue=t.previewSrc.textContent=t.imgUrlFile.value=t._element.src),t._altText=t.altText.value=t._element.alt,t._v_link._linkValue=t.previewLink.textContent=t.imgLink.value=null===t._linkElement?"":t._linkElement.href,t.imgLinkNewWindowCheck.checked=t._linkElement&&"_blank"===t._linkElement.target,t.modal.querySelector('input[name="suneditor_image_radio"][value="'+t._align+'"]').checked=!0,t._align=t.modal.querySelector('input[name="suneditor_image_radio"]:checked').value,t._captionChecked=t.captionCheckEl.checked=!!t._caption,t._resizing&&this.plugins.resizing._module_setModifyInputSize.call(this,t,this.plugins.image),e||this.plugins.dialog.open.call(this,"image",!0)},sizeRevert:function(){this.plugins.resizing._module_sizeRevert.call(this,this.context.image)},applySize:function(e,t){const n=this.context.image;return e||(e=n.inputX.value||this.context.option.imageWidth),t||(t=n.inputY.value||this.context.option.imageHeight),n._onlyPercentage&&e||/%$/.test(e)?(this.plugins.image.setPercentSize.call(this,e,t),!0):(e&&"auto"!==e||t&&"auto"!==t?this.plugins.image.setSize.call(this,e,t,!1):this.plugins.image.setAutoSize.call(this),!1)},setSize:function(e,t,n,i){const l=this.context.image,o=/^(rw|lw)$/.test(i),s=/^(th|bh)$/.test(i);this.plugins.image.cancelPercentAttr.call(this),s||(l._element.style.width=this.util.isNumber(e)?e+l.sizeUnit:e),o||(l._element.style.height=this.util.isNumber(t)?t+l.sizeUnit:/%$/.test(t)?"":t),"center"===l._align&&this.plugins.image.setAlign.call(this,null,null,null,null),n||l._element.removeAttribute("data-percentage"),this.plugins.resizing._module_saveCurrentSize.call(this,l)},setAutoSize:function(){const e=this.context.image;this.plugins.resizing.resetTransform.call(this,e._element),this.plugins.image.cancelPercentAttr.call(this),e._element.style.maxWidth="",e._element.style.width="",e._element.style.height="",e._cover.style.width="",e._cover.style.height="",this.plugins.image.setAlign.call(this,null,null,null,null),e._element.setAttribute("data-percentage","auto,auto"),this.plugins.resizing._module_saveCurrentSize.call(this,e)},setOriginSize:function(){const e=this.context.image;e._element.removeAttribute("data-percentage"),this.plugins.resizing.resetTransform.call(this,e._element),this.plugins.image.cancelPercentAttr.call(this);const t=(e._element.getAttribute("data-origin")||"").split(","),n=t[0],i=t[1];t&&(e._onlyPercentage||/%$/.test(n)&&(/%$/.test(i)||!/\d/.test(i))?this.plugins.image.setPercentSize.call(this,n,i):this.plugins.image.setSize.call(this,n,i),this.plugins.resizing._module_saveCurrentSize.call(this,e))},setPercentSize:function(e,t){const n=this.context.image;t=!t||/%$/.test(t)||this.util.getNumber(t,0)?this.util.isNumber(t)?t+n.sizeUnit:t||"":this.util.isNumber(t)?t+"%":t;const i=/%$/.test(t);n._container.style.width=this.util.isNumber(e)?e+"%":e,n._container.style.height="",n._cover.style.width="100%",n._cover.style.height=i?t:"",n._element.style.width="100%",n._element.style.height=i?"":t,n._element.style.maxWidth="","center"===n._align&&this.plugins.image.setAlign.call(this,null,null,null,null),n._element.setAttribute("data-percentage",e+","+t),this.plugins.resizing.setCaptionPosition.call(this,n._element),this.plugins.resizing._module_saveCurrentSize.call(this,n)},cancelPercentAttr:function(){const e=this.context.image;e._cover.style.width="",e._cover.style.height="",e._container.style.width="",e._container.style.height="",this.util.removeClass(e._container,this.context.image._floatClassRegExp),this.util.addClass(e._container,"__se__float-"+e._align),"center"===e._align&&this.plugins.image.setAlign.call(this,null,null,null,null)},setAlign:function(e,t,n,i){const l=this.context.image;e||(e=l._align),t||(t=l._element),n||(n=l._cover),i||(i=l._container),n.style.margin=e&&"none"!==e?"auto":"0",/%$/.test(t.style.width)&&"center"===e?(i.style.minWidth="100%",n.style.width=i.style.width):(i.style.minWidth="",n.style.width=this.context.resizing._rotateVertical?t.style.height||t.offsetHeight:t.style.width&&"auto"!==t.style.width?t.style.width||"100%":""),this.util.hasClass(i,"__se__float-"+e)||(this.util.removeClass(i,l._floatClassRegExp),this.util.addClass(i,"__se__float-"+e)),t.setAttribute("data-align",e)},resetAlign:function(){const e=this.context.image;e._element.setAttribute("data-align",""),e._align="none",e._cover.style.margin="0",this.util.removeClass(e._container,e._floatClassRegExp)},init:function(){const e=this.context.image;e.imgInputFile&&(e.imgInputFile.value=""),e.imgUrlFile&&(e._v_src._linkValue=e.previewSrc.textContent=e.imgUrlFile.value=""),e.imgInputFile&&e.imgUrlFile&&(e.imgUrlFile.removeAttribute("disabled"),e.previewSrc.style.textDecoration=""),e.altText.value="",e._v_link._linkValue=e.previewLink.textContent=e.imgLink.value="",e.imgLinkNewWindowCheck.checked=!1,e.modal.querySelector('input[name="suneditor_image_radio"][value="none"]').checked=!0,e.captionCheckEl.checked=!1,e._element=null,this.plugins.image.openTab.call(this,"init"),e._resizing&&(e.inputX.value=this.context.option.imageWidth===e._defaultSizeX?"":this.context.option.imageWidth,e.inputY.value=this.context.option.imageHeight===e._defaultSizeY?"":this.context.option.imageHeight,e.proportion.checked=!0,e._ratio=!1,e._ratioX=1,e._ratioY=1)}},_={name:"video",display:"dialog",add:function(e){e.addModule([r.a,u.a,g.a,m.a]);const t=e.context,n=t.video={_infoList:[],_infoIndex:0,_uploadFileLength:0,sizeUnit:t.option._videoSizeUnit,_align:"none",_floatClassRegExp:"__se__float\\-[a-z]+",_youtubeQuery:t.option.youtubeQuery,_videoRatio:100*t.option.videoRatio+"%",_defaultRatio:100*t.option.videoRatio+"%",_linkValue:"",_element:null,_cover:null,_container:null,inputX:null,inputY:null,_element_w:1,_element_h:1,_element_l:0,_element_t:0,_defaultSizeX:"100%",_defaultSizeY:100*t.option.videoRatio+"%",_origin_w:"100%"===t.option.videoWidth?"":t.option.videoWidth,_origin_h:"56.25%"===t.option.videoHeight?"":t.option.videoHeight,_proportionChecked:!0,_resizing:t.option.videoResizing,_resizeDotHide:!t.option.videoHeightShow,_rotation:t.option.videoRotation,_onlyPercentage:t.option.videoSizeOnlyPercentage,_ratio:!1,_ratioX:1,_ratioY:1,_captionShow:!1};let i=this.setDialog.call(e);n.modal=i,n.videoInputFile=i.querySelector("._se_video_file"),n.videoUrlFile=i.querySelector(".se-input-url"),n.focusElement=n.videoUrlFile||n.videoInputFile,n.preview=i.querySelector(".se-link-preview"),i.querySelector(".se-btn-primary").addEventListener("click",this.submit.bind(e)),n.videoInputFile&&i.querySelector(".se-dialog-files-edge-button").addEventListener("click",this._removeSelectedFiles.bind(n.videoInputFile,n.videoUrlFile,n.preview)),n.videoInputFile&&n.videoUrlFile&&n.videoInputFile.addEventListener("change",this._fileInputChange.bind(n)),n.videoUrlFile&&n.videoUrlFile.addEventListener("input",this._onLinkPreview.bind(n.preview,n,t.options.linkProtocol)),n.proportion={},n.videoRatioOption={},n.inputX={},n.inputY={},t.option.videoResizing&&(n.proportion=i.querySelector("._se_video_check_proportion"),n.videoRatioOption=i.querySelector(".se-video-ratio"),n.inputX=i.querySelector("._se_video_size_x"),n.inputY=i.querySelector("._se_video_size_y"),n.inputX.value=t.option.videoWidth,n.inputY.value=t.option.videoHeight,n.inputX.addEventListener("keyup",this.setInputSize.bind(e,"x")),n.inputY.addEventListener("keyup",this.setInputSize.bind(e,"y")),n.inputX.addEventListener("change",this.setRatio.bind(e)),n.inputY.addEventListener("change",this.setRatio.bind(e)),n.proportion.addEventListener("change",this.setRatio.bind(e)),n.videoRatioOption.addEventListener("change",this.setVideoRatio.bind(e)),i.querySelector(".se-dialog-btn-revert").addEventListener("click",this.sizeRevert.bind(e))),t.dialog.modal.appendChild(i),i=null},setDialog:function(){const e=this.context.option,t=this.lang,n=this.util.createElement("DIV");n.className="se-dialog-content",n.style.display="none";let i='
    '+t.dialogBox.videoBox.title+'
    ';if(e.videoFileInput&&(i+='
    "),e.videoUrlInput&&(i+='
    '),e.videoResizing){const n=e.videoRatioList||[{name:"16:9",value:.5625},{name:"4:3",value:.75},{name:"21:9",value:.4285}],l=e.videoRatio,o=e.videoSizeOnlyPercentage,s=o?' style="display: none !important;"':"",a=e.videoHeightShow?"":' style="display: none !important;"',r=e.videoRatioShow?"":' style="display: none !important;"',c=o||e.videoHeightShow||e.videoRatioShow?"":' style="display: none !important;"';i+='
    "}return i+='
    ",n.innerHTML=i,n},_fileInputChange:function(){this.videoInputFile.value?(this.videoUrlFile.setAttribute("disabled",!0),this.preview.style.textDecoration="line-through"):(this.videoUrlFile.removeAttribute("disabled"),this.preview.style.textDecoration="")},_removeSelectedFiles:function(e,t){this.value="",e&&(e.removeAttribute("disabled"),t.style.textDecoration="")},_onLinkPreview:function(e,t,n){const i=n.target.value.trim();/^$/.test(i)?(e._linkValue=i,this.textContent=''):e._linkValue=this.textContent=i?t&&-1===i.indexOf("://")&&0!==i.indexOf("#")?t+i:-1===i.indexOf("://")?"/"+i:i:""},_setTagAttrs:function(e){e.setAttribute("controls",!0);const t=this.context.options.videoTagAttrs;if(t)for(let n in t)this.util.hasOwn(t,n)&&e.setAttribute(n,t[n])},createVideoTag:function(){const e=this.util.createElement("VIDEO");return this.plugins.video._setTagAttrs.call(this,e),e},_setIframeAttrs:function(e){e.frameBorder="0",e.allowFullscreen=!0;const t=this.context.options.videoIframeAttrs;if(t)for(let n in t)this.util.hasOwn(t,n)&&e.setAttribute(n,t[n])},createIframeTag:function(){const e=this.util.createElement("IFRAME");return this.plugins.video._setIframeAttrs.call(this,e),e},fileTags:["iframe","video"],select:function(e){this.plugins.video.onModifyMode.call(this,e,this.plugins.resizing.call_controller_resize.call(this,e,"video"))},destroy:function(e){const t=e||this.context.video._element,n=this.context.video._container,i=1*t.getAttribute("data-index");let l=n.previousElementSibling||n.nextElementSibling;const o=n.parentNode;this.util.removeItem(n),this.plugins.video.init.call(this),this.controllersOff(),o!==this.context.element.wysiwyg&&this.util.removeItemAllParents(o,(function(e){return 0===e.childNodes.length}),null),this.focusEdge(l),this.plugins.fileManager.deleteInfo.call(this,"video",i,this.functions.onVideoUpload),this.history.push(!1)},on:function(e){const t=this.context.video;e?t.videoInputFile&&this.context.options.videoMultipleFile&&t.videoInputFile.removeAttribute("multiple"):(t.inputX.value=t._origin_w=this.context.option.videoWidth===t._defaultSizeX?"":this.context.option.videoWidth,t.inputY.value=t._origin_h=this.context.option.videoHeight===t._defaultSizeY?"":this.context.option.videoHeight,t.proportion.disabled=!0,t.videoInputFile&&this.context.options.videoMultipleFile&&t.videoInputFile.setAttribute("multiple","multiple")),t._resizing&&this.plugins.video.setVideoRatioSelect.call(this,t._origin_h||t._defaultRatio)},open:function(){this.plugins.dialog.open.call(this,"video","video"===this.currentControllerName)},setVideoRatio:function(e){const t=this.context.video,n=e.target.options[e.target.selectedIndex].value;t._defaultSizeY=t._videoRatio=n?100*n+"%":t._defaultSizeY,t.inputY.placeholder=n?100*n+"%":"",t.inputY.value=""},setInputSize:function(e,t){if(t&&32===t.keyCode)return void t.preventDefault();const n=this.context.video;this.plugins.resizing._module_setInputSize.call(this,n,e),"y"===e&&this.plugins.video.setVideoRatioSelect.call(this,t.target.value||n._defaultRatio)},setRatio:function(){this.plugins.resizing._module_setRatio.call(this,this.context.video)},submit:function(e){const t=this.context.video,n=this.plugins.video;e.preventDefault(),e.stopPropagation(),t._align=t.modal.querySelector('input[name="suneditor_video_radio"]:checked').value;try{t.videoInputFile&&t.videoInputFile.files.length>0?(this.showLoading(),n.submitAction.call(this,this.context.video.videoInputFile.files)):t.videoUrlFile&&t._linkValue.length>0&&(this.showLoading(),n.setup_url.call(this))}catch(e){throw this.closeLoading(),Error('[SUNEDITOR.video.submit.fail] cause : "'+e.message+'"')}finally{this.plugins.dialog.close.call(this)}return!1},submitAction:function(e){if(0===e.length)return;let t=0,n=[];for(let i=0,l=e.length;i0){let e=0;const n=this.context.video._infoList;for(let t=0,i=n.length;ti){this.closeLoading();const n="[SUNEDITOR.videoUpload.fail] Size of uploadable total videos: "+i/1e3+"KB";return void(("function"!==this.functions.onVideoUploadError||this.functions.onVideoUploadError(n,{limitSize:i,currentSize:e,uploadSize:t},this))&&this.functions.noticeOpen(n))}}const l=this.context.video;l._uploadFileLength=n.length;const o={inputWidth:l.inputX.value,inputHeight:l.inputY.value,align:l._align,isUpdate:this.context.dialog.updateModal,element:l._element};if("function"==typeof this.functions.onVideoUploadBefore){const e=this.functions.onVideoUploadBefore(n,o,this,function(e){e&&this._w.Array.isArray(e.result)?this.plugins.video.register.call(this,o,e):this.plugins.video.upload.call(this,o,e)}.bind(this));if(void 0===e)return;if(!e)return void this.closeLoading();"object"==typeof e&&e.length>0&&(n=e)}this.plugins.video.upload.call(this,o,n)},error:function(e,t){if(this.closeLoading(),"function"!=typeof this.functions.onVideoUploadError||this.functions.onVideoUploadError(e,t,this))throw this.functions.noticeOpen(e),Error("[SUNEDITOR.plugin.video.error] response: "+e)},upload:function(e,t){if(!t)return void this.closeLoading();if("string"==typeof t)return void this.plugins.video.error.call(this,t,null);const n=this.context.option.videoUploadUrl,i=this.context.dialog.updateModal?1:t.length;if(!("string"==typeof n&&n.length>0))throw Error('[SUNEDITOR.videoUpload.fail] cause : There is no "videoUploadUrl" option.');{const l=new FormData;for(let e=0;e$/.test(t)){if(t=(new this._w.DOMParser).parseFromString(t,"text/html").querySelector("iframe").src,0===t.length)return!1}if(/youtu\.?be/.test(t)){if(/^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("&","?&")),e._youtubeQuery.length>0)if(/\?/.test(t)){const n=t.split("?");t=n[0]+"?"+e._youtubeQuery+"&"+n[1]}else t+="?"+e._youtubeQuery}else/vimeo\.com/.test(t)&&(t.endsWith("/")&&(t=t.slice(0,-1)),t="https://player.vimeo.com/video/"+t.slice(t.lastIndexOf("/")+1));this.plugins.video.create_video.call(this,this.plugins.video.createIframeTag.call(this),t,e.inputX.value,e.inputY.value,e._align,null,this.context.dialog.updateModal)}catch(e){throw Error('[SUNEDITOR.video.upload.fail] cause : "'+e.message+'"')}finally{this.closeLoading()}},create_video:function(e,t,n,i,l,o,s){this.context.resizing._resize_plugin="video";const a=this.context.video;let r=null,c=null,d=!1;if(s){if((e=a._element).src!==t){d=!0;const n=/youtu\.?be/.test(t),i=/vimeo\.com/.test(t);if(!n&&!i||/^iframe$/i.test(e.nodeName))if(n||i||/^videoo$/i.test(e.nodeName))e.src=t;else{const n=this.plugins.video.createVideoTag.call(this);n.src=t,e.parentNode.replaceChild(n,e),a._element=e=n}else{const n=this.plugins.video.createIframeTag.call(this);n.src=t,e.parentNode.replaceChild(n,e),a._element=e=n}}c=a._container,r=this.util.getParentElement(e,"FIGURE")}else d=!0,e.src=t,a._element=e,r=this.plugins.component.set_cover.call(this,e),c=this.plugins.component.set_container.call(this,r,"se-video-container");a._cover=r,a._container=c;const u=this.plugins.resizing._module_getSizeX.call(this,a)!==(n||a._defaultSizeX)||this.plugins.resizing._module_getSizeY.call(this,a)!==(i||a._videoRatio),h=!s||u;a._resizing&&(this.context.video._proportionChecked=a.proportion.checked,e.setAttribute("data-proportion",a._proportionChecked));let g=!1;h&&(g=this.plugins.video.applySize.call(this)),g&&"center"===l||this.plugins.video.setAlign.call(this,null,e,r,c);let p=!0;s?a._resizing&&this.context.resizing._rotateVertical&&h&&this.plugins.resizing.setTransformSize.call(this,e,null,null):p=this.insertComponent(c,!1,!0,!1),p&&(d&&this.plugins.fileManager.setInfo.call(this,"video",e,this.functions.onVideoUpload,o,!0),s&&(this.selectComponent(e,"video"),this.history.push(!1))),this.context.resizing._resize_plugin=""},_update_videoCover:function(e){if(!e)return;const t=this.context.video;/^video$/i.test(e.nodeName)?this.plugins.video._setTagAttrs.call(this,e):this.plugins.video._setIframeAttrs.call(this,e);const n=this.util.getParentElement(e,this.util.isMediaComponent)||this.util.getParentElement(e,function(e){return this.isWysiwygDiv(e.parentNode)}.bind(this.util));t._element=e=e.cloneNode(!0);const i=t._cover=this.plugins.component.set_cover.call(this,e),l=t._container=this.plugins.component.set_container.call(this,i,"se-video-container"),o=n.querySelector("figcaption");let s=null;o&&(s=this.util.createElement("DIV"),s.innerHTML=o.innerHTML,this.util.removeItem(o));const a=(e.getAttribute("data-size")||e.getAttribute("data-origin")||"").split(",");this.plugins.video.applySize.call(this,a[0],a[1]),n.parentNode.replaceChild(l,n),s&&n.parentNode.insertBefore(s,l.nextElementSibling),this.plugins.fileManager.setInfo.call(this,"video",e,this.functions.onVideoUpload,null,!0)},onModifyMode:function(e,t){const n=this.context.video;n._element=e,n._cover=this.util.getParentElement(e,"FIGURE"),n._container=this.util.getParentElement(e,this.util.isMediaComponent),n._align=e.getAttribute("data-align")||"none",t&&(n._element_w=t.w,n._element_h=t.h,n._element_t=t.t,n._element_l=t.l);let i=n._element.getAttribute("data-size")||n._element.getAttribute("data-origin");i?(i=i.split(","),n._origin_w=i[0],n._origin_h=i[1]):t&&(n._origin_w=t.w,n._origin_h=t.h)},openModify:function(e){const t=this.context.video;if(t.videoUrlFile&&(t._linkValue=t.preview.textContent=t.videoUrlFile.value=t._element.src||(t._element.querySelector("source")||"").src||""),t.modal.querySelector('input[name="suneditor_video_radio"][value="'+t._align+'"]').checked=!0,t._resizing){this.plugins.resizing._module_setModifyInputSize.call(this,t,this.plugins.video);const e=t._videoRatio=this.plugins.resizing._module_getSizeY.call(this,t);this.plugins.video.setVideoRatioSelect.call(this,e)||(t.inputY.value=t._onlyPercentage?this.util.getNumber(e,2):e)}e||this.plugins.dialog.open.call(this,"video",!0)},setVideoRatioSelect:function(e){let t=!1;const n=this.context.video,i=n.videoRatioOption.options;/%$/.test(e)||n._onlyPercentage?e=this.util.getNumber(e,2)/100+"":(!this.util.isNumber(e)||1*e>=1)&&(e=""),n.inputY.placeholder="";for(let l=0,o=i.length;l'+this.icons.cancel+''+t.dialogBox.audioBox.title+'
    ';return e.audioFileInput&&(i+='
    "),e.audioUrlInput&&(i+='
    '),i+='
    ",n.innerHTML=i,n},setController:function(){const e=this.lang,t=this.icons,n=this.util.createElement("DIV");return n.className="se-controller se-controller-link",n.innerHTML='
    ",n},_fileInputChange:function(){this.audioInputFile.value?(this.audioUrlFile.setAttribute("disabled",!0),this.preview.style.textDecoration="line-through"):(this.audioUrlFile.removeAttribute("disabled"),this.preview.style.textDecoration="")},_removeSelectedFiles:function(e,t){this.value="",e&&(e.removeAttribute("disabled"),t.style.textDecoration="")},_createAudioTag:function(){const e=this.util.createElement("AUDIO");this.plugins.audio._setTagAttrs.call(this,e);const t=this.context.audio._origin_w,n=this.context.audio._origin_h;return e.setAttribute("origin-size",t+","+n),e.style.cssText=(t?"width:"+t+"; ":"")+(n?"height:"+n+";":""),e},_setTagAttrs:function(e){e.setAttribute("controls",!0);const t=this.context.options.audioTagAttrs;if(t)for(let n in t)this.util.hasOwn(t,n)&&e.setAttribute(n,t[n])},_onLinkPreview:function(e,t,n){const i=n.target.value.trim();e._linkValue=this.textContent=i?t&&-1===i.indexOf("://")&&0!==i.indexOf("#")?t+i:-1===i.indexOf("://")?"/"+i:i:""},fileTags:["audio"],select:function(e){this.plugins.audio.onModifyMode.call(this,e)},destroy:function(e){e=e||this.context.audio._element;const t=this.util.getParentElement(e,this.util.isComponent)||e,n=1*e.getAttribute("data-index"),i=t.previousElementSibling||t.nextElementSibling,l=t.parentNode;this.util.removeItem(t),this.plugins.audio.init.call(this),this.controllersOff(),l!==this.context.element.wysiwyg&&this.util.removeItemAllParents(l,(function(e){return 0===e.childNodes.length}),null),this.focusEdge(i),this.plugins.fileManager.deleteInfo.call(this,"audio",n,this.functions.onAudioUpload),this.history.push(!1)},checkFileInfo:function(){this.plugins.fileManager.checkInfo.call(this,"audio",["audio"],this.functions.onAudioUpload,this.plugins.audio.updateCover.bind(this),!1)},resetFileInfo:function(){this.plugins.fileManager.resetInfo.call(this,"audio",this.functions.onAudioUpload)},on:function(e){const t=this.context.audio;e?t._element?(this.context.dialog.updateModal=!0,t._linkValue=t.preview.textContent=t.audioUrlFile.value=t._element.src,t.audioInputFile&&this.context.options.audioMultipleFile&&t.audioInputFile.removeAttribute("multiple")):t.audioInputFile&&this.context.options.audioMultipleFile&&t.audioInputFile.removeAttribute("multiple"):(this.plugins.audio.init.call(this),t.audioInputFile&&this.context.options.audioMultipleFile&&t.audioInputFile.setAttribute("multiple","multiple"))},open:function(){this.plugins.dialog.open.call(this,"audio","audio"===this.currentControllerName)},submit:function(e){const t=this.context.audio;e.preventDefault(),e.stopPropagation();try{t.audioInputFile&&t.audioInputFile.files.length>0?(this.showLoading(),this.plugins.audio.submitAction.call(this,t.audioInputFile.files)):t.audioUrlFile&&t._linkValue.length>0&&(this.showLoading(),this.plugins.audio.setupUrl.call(this,t._linkValue))}catch(e){throw this.closeLoading(),Error('[SUNEDITOR.audio.submit.fail] cause : "'+e.message+'"')}finally{this.plugins.dialog.close.call(this)}return!1},submitAction:function(e){if(0===e.length)return;let t=0,n=[];for(let i=0,l=e.length;i0){let e=0;const n=this.context.audio._infoList;for(let t=0,i=n.length;ti){this.closeLoading();const n="[SUNEDITOR.audioUpload.fail] Size of uploadable total audios: "+i/1e3+"KB";return void(("function"!==this.functions.onAudioUploadError||this.functions.onAudioUploadError(n,{limitSize:i,currentSize:e,uploadSize:t},this))&&this.functions.noticeOpen(n))}}const l=this.context.audio;l._uploadFileLength=n.length;const o={isUpdate:this.context.dialog.updateModal,element:l._element};if("function"==typeof this.functions.onAudioUploadBefore){const e=this.functions.onAudioUploadBefore(n,o,this,function(e){e&&this._w.Array.isArray(e.result)?this.plugins.audio.register.call(this,o,e):this.plugins.audio.upload.call(this,o,e)}.bind(this));if(void 0===e)return;if(!e)return void this.closeLoading();"object"==typeof e&&e.length>0&&(n=e)}this.plugins.audio.upload.call(this,o,n)},error:function(e,t){if(this.closeLoading(),"function"!=typeof this.functions.onAudioUploadError||this.functions.onAudioUploadError(e,t,this))throw this.functions.noticeOpen(e),Error("[SUNEDITOR.plugin.audio.exception] response: "+e)},upload:function(e,t){if(!t)return void this.closeLoading();if("string"==typeof t)return void this.plugins.audio.error.call(this,t,null);const n=this.context.option.audioUploadUrl,i=this.context.dialog.updateModal?1:t.length,l=new FormData;for(let e=0;e'+this.icons.cancel+''+e.dialogBox.mathBox.title+'

    ",t},setController_MathButton:function(){const e=this.lang,t=this.util.createElement("DIV");return t.className="se-controller se-controller-link",t.innerHTML='
    ",t},open:function(){this.plugins.dialog.open.call(this,"math","math"===this.currentControllerName)},managedTags:function(){return{className:"katex",method:function(e){if(!e.getAttribute("data-exp"))return;const t=this._d.createRange().createContextualFragment(this.plugins.math._renderer.call(this,this.util.HTMLDecoder(e.getAttribute("data-exp"))));e.innerHTML=t.querySelector(".katex").innerHTML}}},_renderer:function(e){const t=this.context.option.katex;return t.src.renderToString(e,t.options)},_renderMathExp:function(e,t){e.previewElement.innerHTML=this.plugins.math._renderer.call(this,t.target.value)},submit:function(e){this.showLoading(),e.preventDefault(),e.stopPropagation();const t=function(){if(0===this.context.math.focusElement.value.trim().length)return!1;const e=this.context.math,t=e.focusElement.value,n=e.previewElement.querySelector(".katex");if(!n)return!1;if(n.className="__se__katex "+n.className,n.setAttribute("contenteditable",!1),n.setAttribute("data-exp",this.util.HTMLEncoder(t)),n.setAttribute("data-font-size",e.fontSizeElement.value),n.style.fontSize=e.fontSizeElement.value,this.context.dialog.updateModal){const t=this.util.getParentElement(e._mathExp,".katex");t.parentNode.replaceChild(n,t),this.setRange(n,0,n,1)}else{const e=this.getSelectedElements();if(e.length>1){const t=this.util.createElement(e[0].nodeName);if(t.appendChild(n),!this.insertNode(t,null,!0))return!1}else if(!this.insertNode(n,null,!0))return!1;const t=this.util.createTextNode(this.util.zeroWidthSpace);n.parentNode.insertBefore(t,n.nextSibling),this.setRange(n,0,n,1)}return e.focusElement.value="",e.fontSizeElement.value="1em",e.previewElement.style.fontSize="1em",e.previewElement.innerHTML="",!0}.bind(this);try{t()&&(this.plugins.dialog.close.call(this),this.history.push(!1))}catch(e){this.plugins.dialog.close.call(this)}finally{this.closeLoading()}return!1},active:function(e){if(e){if(e.getAttribute("data-exp"))return this.controllerArray.indexOf(this.context.math.mathController)<0&&(this.setRange(e,0,e,1),this.plugins.math.call_controller.call(this,e)),!0}else this.controllerArray.indexOf(this.context.math.mathController)>-1&&this.controllersOff();return!1},on:function(e){if(e){const e=this.context.math;if(e._mathExp){const t=this.util.HTMLDecoder(e._mathExp.getAttribute("data-exp")),n=e._mathExp.getAttribute("data-font-size")||"1em";this.context.dialog.updateModal=!0,e.focusElement.value=t,e.fontSizeElement.value=n,e.previewElement.innerHTML=this.plugins.math._renderer.call(this,t),e.previewElement.style.fontSize=n}}else this.plugins.math.init.call(this)},call_controller:function(e){this.context.math._mathExp=e;const t=this.context.math.mathController,n=this.util.getOffset(e,this.context.element.wysiwygFrame);t.style.top=n.top+e.offsetHeight+10+"px",t.style.left=n.left-this.context.element.wysiwygFrame.scrollLeft+"px",t.style.display="block";const i=this.context.element.wysiwygFrame.offsetWidth-(t.offsetLeft+t.offsetWidth);i<0?(t.style.left=t.offsetLeft+i+"px",t.firstElementChild.style.left=20-i+"px"):t.firstElementChild.style.left="20px",this.controllersOn(t,e,"math")},onClick_mathController:function(e){e.stopPropagation();const t=e.target.getAttribute("data-command")||e.target.parentNode.getAttribute("data-command");t&&(e.preventDefault(),/update/.test(t)?(this.context.math.focusElement.value=this.util.HTMLDecoder(this.context.math._mathExp.getAttribute("data-exp")),this.plugins.dialog.open.call(this,"math",!0)):(this.util.removeItem(this.context.math._mathExp),this.context.math._mathExp=null,this.focus(),this.history.push(!1)),this.controllersOff())},init:function(){const e=this.context.math;e.mathController.style.display="none",e._mathExp=null,e.focusElement.value="",e.previewElement.innerHTML=""}},y=n("JhlZ"),C=n.n(y),w={blockquote:{name:"blockquote",display:"command",add:function(e,t){e.context.blockquote={targetButton:t,tag:e.util.createElement("BLOCKQUOTE")}},active:function(e){if(e){if(/blockquote/i.test(e.nodeName))return this.util.addClass(this.context.blockquote.targetButton,"active"),!0}else this.util.removeClass(this.context.blockquote.targetButton,"active");return!1},action:function(){const e=this.util.getParentElement(this.getSelectionNode(),"blockquote");e?this.detachRangeFormatElement(e,null,null,!1,!1):this.applyRangeFormatElement(this.context.blockquote.tag.cloneNode(!1))}},align:{name:"align",display:"submenu",add:function(e,t){const n=e.icons,i=e.context;i.align={targetButton:t,_alignList:null,currentAlign:"",icons:{justify:n.align_justify,left:n.align_left,right:n.align_right,center:n.align_center}};let l=this.setSubmenu.call(e),o=l.querySelector("ul");o.addEventListener("click",this.pickup.bind(e)),i.align._alignList=o.querySelectorAll("li button"),e.initMenuTarget(this.name,t,l),l=null,o=null},setSubmenu:function(){const e=this.lang,t=this.icons,n=this.util.createElement("DIV");return n.className="se-submenu se-list-layer se-list-align",n.innerHTML='
    ",n},active:function(e){const t=this.context.align.targetButton,n=t.firstElementChild;if(e){if(this.util.isFormatElement(e)){const i=e.style.textAlign;if(i)return this.util.changeElement(n,this.context.align.icons[i]),t.setAttribute("data-focus",i),!0}}else this.util.changeElement(n,this.context.align.icons.left),t.removeAttribute("data-focus");return!1},on:function(){const e=this.context.align,t=e._alignList,n=e.targetButton.getAttribute("data-focus")||"left";if(n!==e.currentAlign){for(let e=0,i=t.length;e('+t.toolbar.default+")";for(o=0,s=a.length;o";return r+="",n.innerHTML=r,n},active:function(e){const t=this.context.font.targetText,n=this.context.font.targetTooltip;if(e){if(e.style&&e.style.fontFamily.length>0){const i=e.style.fontFamily.replace(/["']/g,"");return this.util.changeTxt(t,i),this.util.changeTxt(n,i),!0}}else{const e=this.lang.toolbar.font;this.util.changeTxt(t,e),this.util.changeTxt(n,e)}return!1},on:function(){const e=this.context.font,t=e._fontList,n=e.targetText.textContent;if(n!==e.currentFont){for(let e=0,i=t.length;e('+t.toolbar.default+")";for(let t,n=0,o=e.fontSizeUnit,s=i.length;n";return l+="",n.innerHTML=l,n},active:function(e){if(e){if(e.style&&e.style.fontSize.length>0)return this.util.changeTxt(this.context.fontSize.targetText,e.style.fontSize),!0}else this.util.changeTxt(this.context.fontSize.targetText,this.lang.toolbar.fontSize);return!1},on:function(){const e=this.context.fontSize,t=e._sizeList,n=e.targetText.textContent;if(n!==e.currentSize){for(let e=0,i=t.length;e
  • ',t},appendHr:function(e){const t=this.util.createElement("HR");return t.className=e,this.focus(),this.insertComponent(t,!1,!0,!1)},horizontalRulePick:function(e){e.preventDefault(),e.stopPropagation();let t=e.target,n=null;for(;!n&&!/UL/i.test(t.tagName);)n=t.getAttribute("data-value"),t=t.parentNode;if(!n)return;const i=this.plugins.horizontalRule.appendHr.call(this,"__se__"+n);i&&(this.setRange(i,0,i,0),this.submenuOff())}},list:{name:"list",display:"submenu",add:function(e,t){const n=e.context;n.list={targetButton:t,_list:null,currentList:"",icons:{bullets:e.icons.list_bullets,number:e.icons.list_number}};let i=this.setSubmenu.call(e),l=i.querySelector("ul");l.addEventListener("click",this.pickup.bind(e)),n.list._list=l.querySelectorAll("li button"),e.initMenuTarget(this.name,t,i),i=null,l=null},setSubmenu:function(){const e=this.lang,t=this.util.createElement("DIV");return t.className="se-submenu se-list-layer",t.innerHTML='
    ",t},active:function(e){const t=this.context.list.targetButton,n=t.firstElementChild,i=this.util;if(e){if(i.isList(e)){const l=e.nodeName;return t.setAttribute("data-focus",l),i.addClass(t,"active"),/UL/i.test(l)?i.changeElement(n,this.context.list.icons.bullets):i.changeElement(n,this.context.list.icons.number),!0}}else t.removeAttribute("data-focus"),i.changeElement(n,this.context.list.icons.number),i.removeClass(t,"active");return!1},on:function(){const e=this.context.list,t=e._list,n=e.targetButton.getAttribute("data-focus")||"";if(n!==e.currentList){for(let e=0,i=t.length;e"),t.innerHTML+=n.outerHTML,e&&(t.innerHTML+="
    ")}else{const e=n.childNodes;for(;e[0];)t.appendChild(e[0])}a.appendChild(t),r||(u=a),r&&m===g&&!o.isRangeFormatElement(f)||(d||(d=a),i&&r&&m===g||r&&o.isList(g)&&g===c||a.parentNode!==m&&m.insertBefore(a,f)),o.removeItem(n),i&&null===h&&(h=a.children.length-1),r&&(o.getRangeFormatElement(g,p)!==o.getRangeFormatElement(c,p)||o.isList(g)&&o.isList(c)&&o.getElementDepth(g)!==o.getElementDepth(c))&&(a=o.createElement(e)),_&&0===_.children.length&&o.removeItem(_)}else o.removeItem(n);h&&(d=d.children[h]),s&&(g=a.children.length-1,a.innerHTML+=c.innerHTML,u=a.children[g],o.removeItem(c))}else{if(n)for(let e=0,t=l.length;e=0;n--)if(l[n].contains(l[e])){l.splice(e,1),e--,t--;break}const t=o.getRangeFormatElement(s),i=t&&t.tagName===e;let a,r;const c=function(e){return!this.isComponent(e)}.bind(o);i||(r=o.createElement(e));for(let t,s,d=0,u=l.length;d0){const e=l.cloneNode(!1),t=l.childNodes,o=this.util.getPositionIndex(i);for(;t[o];)e.appendChild(t[o]);n.appendChild(e)}0===l.children.length&&this.util.removeItem(l),this.util.mergeSameTags(s);const a=this.util.getEdgeChildNodes(t,n);return{cc:t.parentNode,sc:a.sc,ec:a.ec}},editInsideList:function(e,t){const n=(t=t||this.getSelectedElements().filter(function(e){return this.isListCell(e)}.bind(this.util))).length;if(0===n||!e&&!this.util.isListCell(t[0].previousElementSibling)&&!this.util.isListCell(t[n-1].nextElementSibling))return{sc:t[0],so:0,ec:t[n-1],eo:1};let i=t[0].parentNode,l=t[n-1],o=null;if(e){if(i!==l.parentNode&&this.util.isList(l.parentNode.parentNode)&&l.nextElementSibling)for(l=l.nextElementSibling;l;)t.push(l),l=l.nextElementSibling;o=this.plugins.list.editList.call(this,i.nodeName.toUpperCase(),t,!0)}else{let e=this.util.createElement(i.nodeName),s=t[0].previousElementSibling,a=l.nextElementSibling;const r={s:null,e:null,sl:i,el:i};for(let l,o=0,c=n;o span > span"),n.table.columnFixedButton=o.querySelector("._se_table_fixed_column"),n.table.headerButton=o.querySelector("._se_table_header"),o.addEventListener("mousedown",e.eventStop);let s=this.setController_tableEditor.call(e,n.table.cellControllerTop);n.table.resizeDiv=s,n.table.splitMenu=s.querySelector(".se-btn-group-sub"),n.table.mergeButton=s.querySelector("._se_table_merge_button"),n.table.splitButton=s.querySelector("._se_table_split_button"),n.table.insertRowAboveButton=s.querySelector("._se_table_insert_row_a"),n.table.insertRowBelowButton=s.querySelector("._se_table_insert_row_b"),s.addEventListener("mousedown",e.eventStop),l.addEventListener("mousemove",this.onMouseMove_tablePicker.bind(e)),l.addEventListener("click",this.appendTable.bind(e)),s.addEventListener("click",this.onClick_tableController.bind(e)),o.addEventListener("click",this.onClick_tableController.bind(e)),e.initMenuTarget(this.name,t,i),n.element.relative.appendChild(s),n.element.relative.appendChild(o),i=null,l=null,s=null,o=null},setSubmenu:function(){const e=this.util.createElement("DIV");return e.className="se-submenu se-selector-table",e.innerHTML='
    1 x 1
    ',e},setController_table:function(){const e=this.lang,t=this.icons,n=this.util.createElement("DIV");return n.className="se-controller se-controller-table",n.innerHTML='
    ",n},setController_tableEditor:function(e){const t=this.lang,n=this.icons,i=this.util.createElement("DIV");return i.className="se-controller se-controller-table-cell",i.innerHTML=(e?"":'
    ')+'
    • '+t.controller.VerticalSplit+'
    • '+t.controller.HorizontalSplit+"
    ",i},appendTable:function(){const e=this.util.createElement("TABLE"),t=this.plugins.table.createCells,n=this.context.table._tableXY[0];let i=this.context.table._tableXY[1],l="";for(;i>0;)l+=""+t.call(this,"td",n)+"",--i;l+="",e.innerHTML=l;if(this.insertComponent(e,!1,!0,!1)){const t=e.querySelector("td div");this.setRange(t,0,t,0),this.plugins.table.reset_table_picker.call(this)}},createCells:function(e,t,n){if(e=e.toLowerCase(),n){const t=this.util.createElement(e);return t.innerHTML="

    ",t}{let n="";for(;t>0;)n+="<"+e+">

    ",t--;return n}},onMouseMove_tablePicker:function(e){e.stopPropagation();let t=this._w.Math.ceil(e.offsetX/18),n=this._w.Math.ceil(e.offsetY/18);t=t<1?1:t,n=n<1?1:n,this.context.table.tableHighlight.style.width=t+"em",this.context.table.tableHighlight.style.height=n+"em";this.context.table.tableUnHighlight.style.width="10em",this.context.table.tableUnHighlight.style.height="10em",this.util.changeTxt(this.context.table.tableDisplay,t+" x "+n),this.context.table._tableXY=[t,n]},reset_table_picker:function(){if(!this.context.table.tableHighlight)return;const e=this.context.table.tableHighlight.style,t=this.context.table.tableUnHighlight.style;e.width="1em",e.height="1em",t.width="10em",t.height="10em",this.util.changeTxt(this.context.table.tableDisplay,"1 x 1"),this.submenuOff()},init:function(){const e=this.context.table,t=this.plugins.table;if(t._removeEvents.call(this),t._selectedTable){const e=t._selectedTable.querySelectorAll(".se-table-selected-cell");for(let t=0,n=e.length;t0)for(let e,t=0;to||(u>=e.index?(i+=e.cs,u+=e.cs,e.rs-=1,e.row=o+1,e.rs<1&&(r.splice(t,1),t--)):h===g-1&&(e.rs-=1,e.row=o+1,e.rs<1&&(r.splice(t,1),t--)));if(o===s&&h===l){n._logical_cellIndex=u;break}d>0&&a.push({index:u,cs:c+1,rs:d,row:-1}),i+=c}r=r.concat(a).sort((function(e,t){return e.index-t.index})),a=[]}a=null,r=null}},editTable:function(e,t){const n=this.plugins.table,i=this.context.table,l=i._element,o="row"===e;if(o){const e=i._trElement.parentNode;if(/^THEAD$/i.test(e.nodeName)){if("up"===t)return;if(!e.nextElementSibling||!/^TBODY$/i.test(e.nextElementSibling.nodeName))return void(l.innerHTML+=""+n.createCells.call(this,"td",i._logical_cellCnt,!1)+"")}}if(n._ref){const e=i._tdElement,l=n._selectedCells;if(o)if(t)n.setCellInfo.call(this,"up"===t?l[0]:l[l.length-1],!0),n.editRow.call(this,t,e);else{let e=l[0].parentNode;const i=[l[0]];for(let t,n=1,o=l.length;ns&&s>t&&(e[l].rowSpan=n+a,c-=i)}if(i){const e=r[o+1];if(e){const t=[];let n=r[o].cells,i=0;for(let e,l,o=0,s=n.length;o1&&(e.rowSpan-=1,t.push({cell:e.cloneNode(!1),index:l}));if(t.length>0){let l=t.shift();n=e.cells,i=0;for(let o,s,a=0,r=n.length;a=l.index)||(a--,i--,i+=l.cell.colSpan-1,e.insertBefore(l.cell,o),l=t.shift(),l));a++);if(l){e.appendChild(l.cell);for(let n=0,i=t.length;n0){const e=!o[b+1];for(let t,n=0;n_||(p>=t.index?(f+=t.cs,p=b+f,t.rs-=1,t.row=_+1,t.rs<1&&(d.splice(n,1),n--)):e&&(t.rs-=1,t.row=_+1,t.rs<1&&(d.splice(n,1),n--)))}n>0&&c.push({rs:n,cs:r+1,index:p,row:-1}),p>=t&&p+r<=t+s?h.push(e):p<=t+s&&p+r>=t?e.colSpan-=i.getOverlapRangeAtIndex(a,a+s,p,p+r):n>0&&(pt+s)&&g.push({cell:e,i:_,rs:_+n}),f+=r}else{if(b>=t)break;if(r>0){if(u<1&&r+b>=t){e.colSpan+=1,t=null,u=n+1;break}t-=r}if(!m){for(let e,n=0;n0){u-=1;continue}null!==t&&o.length>0&&(p=this.plugins.table.createCells.call(this,o[0].nodeName,0,!0),p=e.insertBefore(p,o[t]))}}if(l){let e,t;for(let n,l=0,o=h.length;l1)c.colSpan=this._w.Math.floor(e/2),l.colSpan=e-c.colSpan,s.insertBefore(c,l.nextElementSibling);else{let t=[],n=[];for(let s,r,c=0,d=i._rowCnt;c0)for(let e,t=0;tc||(u>=e.index?(r+=e.cs,u+=e.cs,e.rs-=1,e.row=c+1,e.rs<1&&(n.splice(t,1),t--)):h===g-1&&(e.rs-=1,e.row=c+1,e.rs<1&&(n.splice(t,1),t--)));if(u<=a&&d>0&&t.push({index:u,cs:o+1,rs:d,row:-1}),i!==l&&u<=a&&u+o>=a+e-1){i.colSpan+=1;break}if(u>a)break;r+=o}n=n.concat(t).sort((function(e,t){return e.index-t.index})),t=[]}s.insertBefore(c,l.nextElementSibling)}}else{const e=l.rowSpan;if(c.colSpan=l.colSpan,e>1){c.rowSpan=this._w.Math.floor(e/2);const n=e-c.rowSpan,i=[],r=t.getArrayIndex(o,s)+n;for(let e,t,n=0;n=a));c++)l=e[c],o=l.rowSpan-1,o>0&&o+n>=r&&s=h.index&&(r+=h.cs,l+=h.cs,h=i.shift()),l>=a||o===s-1){d.insertBefore(c,e.nextElementSibling);break}r+=t}l.rowSpan=n}else{c.rowSpan=l.rowSpan;const e=t.createElement("TR");e.appendChild(c);for(let e,t=0;t=r&&(e[n].rowSpan+=1)}const n=i._physical_cellIndex,a=s.cells;for(let e=0,t=a.length;e0&&s+o>=i&&(e.rowSpan-=n.getOverlapRangeAtIndex(i,l,s,s+o));else o.push(e[s]);for(let e=0,t=o.length;e"+this.plugins.table.createCells.call(this,"th",this.context.table._logical_cellCnt,!1)+"",i.insertBefore(t,i.firstElementChild)}e.toggleClass(t,"active"),/TH/i.test(this.context.table._tdElement.nodeName)?this.controllersOff():this.plugins.table.setPositionControllerDiv.call(this,this.context.table._tdElement,!1)},setTableStyle:function(e){const t=this.context.table,n=t._element;let i,l,o,s;e.indexOf("width")>-1&&(i=t.resizeButton.firstElementChild,l=t.resizeText,t._maxWidth?(o=t.icons.reduction,s=t.minText,t.columnFixedButton.style.display="block",this.util.removeClass(n,"se-table-size-auto"),this.util.addClass(n,"se-table-size-100")):(o=t.icons.expansion,s=t.maxText,t.columnFixedButton.style.display="none",this.util.removeClass(n,"se-table-size-100"),this.util.addClass(n,"se-table-size-auto")),this.util.changeElement(i,o),this.util.changeTxt(l,s)),e.indexOf("column")>-1&&(t._fixedColumn?(this.util.removeClass(n,"se-table-layout-auto"),this.util.addClass(n,"se-table-layout-fixed"),this.util.addClass(t.columnFixedButton,"active")):(this.util.removeClass(n,"se-table-layout-fixed"),this.util.addClass(n,"se-table-layout-auto"),this.util.removeClass(t.columnFixedButton,"active")))},setActiveButton:function(e,t){const n=this.context.table;/^TH$/i.test(e.nodeName)?(n.insertRowAboveButton.setAttribute("disabled",!0),n.insertRowBelowButton.setAttribute("disabled",!0)):(n.insertRowAboveButton.removeAttribute("disabled"),n.insertRowBelowButton.removeAttribute("disabled")),t&&e!==t?(n.splitButton.setAttribute("disabled",!0),n.mergeButton.removeAttribute("disabled")):(n.splitButton.removeAttribute("disabled"),n.mergeButton.setAttribute("disabled",!0))},_bindOnSelect:null,_bindOffSelect:null,_bindOffShift:null,_selectedCells:null,_shift:!1,_fixedCell:null,_fixedCellName:null,_selectedCell:null,_selectedTable:null,_ref:null,_toggleEditor:function(e){this.context.element.wysiwyg.setAttribute("contenteditable",e),e?this.util.removeClass(this.context.element.wysiwyg,"se-disabled"):this.util.addClass(this.context.element.wysiwyg,"se-disabled")},_offCellMultiSelect:function(e){e.stopPropagation();const t=this.plugins.table;t._shift?t._initBind&&(this._wd.removeEventListener("touchmove",t._initBind),t._initBind=null):(t._removeEvents.call(this),t._toggleEditor.call(this,!0)),t._fixedCell&&t._selectedTable&&(t.setActiveButton.call(this,t._fixedCell,t._selectedCell),t.call_controller_tableEdit.call(this,t._selectedCell||t._fixedCell),t._selectedCells=t._selectedTable.querySelectorAll(".se-table-selected-cell"),t._selectedCell&&t._fixedCell&&this.focusEdge(t._selectedCell),t._shift||(t._fixedCell=null,t._selectedCell=null,t._fixedCellName=null))},_onCellMultiSelect:function(e){this._antiBlur=!0;const t=this.plugins.table,n=this.util.getParentElement(e.target,this.util.isCell);if(t._shift)n===t._fixedCell?t._toggleEditor.call(this,!0):t._toggleEditor.call(this,!1);else if(!t._ref){if(n===t._fixedCell)return;t._toggleEditor.call(this,!1)}n&&n!==t._selectedCell&&t._fixedCellName===n.nodeName&&t._selectedTable===this.util.getParentElement(n,"TABLE")&&(t._selectedCell=n,t._setMultiCells.call(this,t._fixedCell,n))},_setMultiCells:function(e,t){const n=this.plugins.table,i=n._selectedTable.rows,l=this.util,o=n._selectedTable.querySelectorAll(".se-table-selected-cell");for(let e=0,t=o.length;e0)for(let e,t=0;td||(u>=e.index?(o+=e.cs,u+=e.cs,e.rs-=1,e.row=d+1,e.rs<1&&(a.splice(t,1),t--)):p===m-1&&(e.rs-=1,e.row=d+1,e.rs<1&&(a.splice(t,1),t--)));if(s){if(i!==e&&i!==t||(c.cs=null!==c.cs&&c.csu+h?c.ce:u+h,c.rs=null!==c.rs&&c.rsd+g?c.re:d+g,c._i+=1),2===c._i){s=!1,a=[],r=[],d=-1;break}}else if(l.getOverlapRangeAtIndex(c.cs,c.ce,u,u+h)&&l.getOverlapRangeAtIndex(c.rs,c.re,d,d+g)){const e=c.csu+h?c.ce:u+h,n=c.rsd+g?c.re:d+g;if(c.cs!==e||c.ce!==t||c.rs!==n||c.re!==o){c.cs=e,c.ce=t,c.rs=n,c.re=o,d=-1,a=[],r=[];break}l.addClass(i,"se-table-selected-cell")}g>0&&r.push({index:u,cs:h+1,rs:g,row:-1}),o+=i.colSpan-1}a=a.concat(r).sort((function(e,t){return e.index-t.index})),r=[]}},_removeEvents:function(){const e=this.plugins.table;e._initBind&&(this._wd.removeEventListener("touchmove",e._initBind),e._initBind=null),e._bindOnSelect&&(this._wd.removeEventListener("mousedown",e._bindOnSelect),this._wd.removeEventListener("mousemove",e._bindOnSelect),e._bindOnSelect=null),e._bindOffSelect&&(this._wd.removeEventListener("mouseup",e._bindOffSelect),e._bindOffSelect=null),e._bindOffShift&&(this._wd.removeEventListener("keyup",e._bindOffShift),e._bindOffShift=null)},_initBind:null,onTableCellMultiSelect:function(e,t){const n=this.plugins.table;n._removeEvents.call(this),this.controllersOff(),n._shift=t,n._fixedCell=e,n._fixedCellName=e.nodeName,n._selectedTable=this.util.getParentElement(e,"TABLE");const i=n._selectedTable.querySelectorAll(".se-table-selected-cell");for(let e=0,t=i.length;e-1?(n=e.toLowerCase(),s="blockquote"===n?"range":"pre"===n?"free":"replace",r=/^h/.test(n)?n.match(/\d+/)[0]:"",a=t["tag_"+(r?"h":n)]+r,d="",c=""):(n=e.tag.toLowerCase(),s=e.command,a=e.name||n,d=e.class,c=d?' class="'+d+'"':""),o+='
  • ";return o+="",n.innerHTML=o,n},active:function(e){let t=this.lang.toolbar.formats;const n=this.context.formatBlock.targetText,i=this.context.formatBlock.targetTooltip;if(e){if(this.util.isFormatElement(e)){const l=this.context.formatBlock._formatList,o=e.nodeName.toLowerCase(),s=(e.className.match(/(\s|^)__se__format__[^\s]+/)||[""])[0].trim();for(let e,n=0,i=l.length;n=0;u--)if(i=p[u],i!==(p[u+1]?p[u+1].parentNode:null)){if(d=r.isComponent(i),o=d?"":i.innerHTML.replace(/(?!>)\s+(?=<)|\n/g," "),s=r.getParentElement(i,(function(e){return e.parentNode===t})),(t!==i.parentNode||d)&&(r.isFormatElement(t)?(t.parentNode.insertBefore(n,t.nextSibling),t=t.parentNode):(t.insertBefore(n,s?s.nextSibling:null),t=i.parentNode),a=n.nextSibling,a&&n.nodeName===a.nodeName&&r.isSameAttributes(n,a)&&(n.innerHTML+="
    "+a.innerHTML,r.removeItem(a)),n=l.cloneNode(!1),h=!0),c=n.innerHTML,n.innerHTML=(h||!o||!c||/
    $/i.test(o)?o:o+"
    ")+c,0===u){t.insertBefore(n,i),a=i.nextSibling,a&&n.nodeName===a.nodeName&&r.isSameAttributes(n,a)&&(n.innerHTML+="
    "+a.innerHTML,r.removeItem(a));const e=n.previousSibling;e&&n.nodeName===e.nodeName&&r.isSameAttributes(n,e)&&(e.innerHTML+="
    "+n.innerHTML,r.removeItem(n))}d||r.removeItem(i),o&&(h=!1)}this.setRange(i,0,i,0)}else{for(let e,t,n=0,s=p.length;n('+t.toolbar.default+")";for(let e,t=0,n=i.length;t";return l+="",n.innerHTML=l,n},on:function(){const e=this.context.lineHeight,t=e._sizeList,n=this.util.getFormatElement(this.getSelectionNode()),i=n?n.style.lineHeight+"":"";if(i!==e.currentSize){for(let e=0,n=t.length;e"}return o+="",t.innerHTML=o,t},on:function(){const e=this.context.paragraphStyle._classList,t=this.util.getFormatElement(this.getSelectionNode());for(let n=0,i=e.length;n"}return l+="",t.innerHTML=l,t},on:function(){const e=this.util,t=this.context.textStyle._styleList,n=this.getSelectionNode();for(let i,l,o,s=0,a=t.length;s'+(e.alt||t)+'
    '+(e.name||t)+"
    "},setImage:function(e){this.callPlugin("image",function(){const t={name:e.parentNode.querySelector(".__se__img_name").textContent,size:0};this.context.image._altText=e.alt,this.plugins.image.create_image.call(this,e.src,"",!1,this.context.image._origin_w,this.context.image._origin_h,"none",t)}.bind(this),null)}}},x={redo:'',undo:'',bold:'',underline:'',italic:'',strike:'',subscript:'',superscript:'',erase:'',indent:'',outdent:'',expansion:'',reduction:'',code_view:'',preview:'',print:'',template:'',line_height:'',paragraph_style:'',text_style:'',save:'',blockquote:'',arrow_down:'',align_justify:'',align_left:'',align_right:'',align_center:'',font_color:'',highlight_color:'',list_bullets:'',list_number:'',table:'',horizontal_rule:'',show_blocks:'',cancel:'',image:'',video:'',link:'',math:'',unlink:'',table_header:'',merge_cell:'',split_cell:'',caption:'',edit:'',delete:'',modify:'',revert:'',auto_size:'',insert_row_below:'',insert_row_above:'',insert_column_left:'',insert_column_right:'',delete_row:'',delete_column:'',fixed_column_width:'',rotate_left:'',rotate_right:'',mirror_horizontal:'',mirror_vertical:'',checked:'',line_break:'',audio:'',image_gallery:'',more_text:'',more_paragraph:'',more_plus:'',more_horizontal:'',more_vertical:'',attachment:'',map:'',magic_stick:'',empty_file:''},E=n("P6u4"),S=n.n(E);const N={_d:null,_w:null,isIE:null,isIE_Edge:null,isOSX_IOS:null,_propertiesInit:function(){this._d||(this._d=document,this._w=window,this.isIE=navigator.userAgent.indexOf("Trident")>-1,this.isIE_Edge=navigator.userAgent.indexOf("Trident")>-1||navigator.appVersion.indexOf("Edge")>-1,this.isOSX_IOS=/(Mac|iPhone|iPod|iPad)/.test(navigator.platform))},_HTMLConvertor:function(e){const t={"&":"&"," ":" ","'":"'",'"':""","<":"<",">":">"};return e.replace(/&|\u00A0|'|"|<|>/g,(function(e){return"string"==typeof t[e]?t[e]:e}))},zeroWidthSpace:String.fromCharCode(8203),zeroWidthRegExp:new RegExp(String.fromCharCode(8203),"g"),onlyZeroWidthRegExp:new RegExp("^"+String.fromCharCode(8203)+"+$"),onlyZeroWidthSpace:function(e){return"string"!=typeof e&&(e=e.textContent),""===e||this.onlyZeroWidthRegExp.test(e)},getXMLHttpRequest:function(){if(!this._w.ActiveXObject)return this._w.XMLHttpRequest?new XMLHttpRequest:null;try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(e){try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(e){return null}}},createElement:function(e){return this._d.createElement(e)},createTextNode:function(e){return this._d.createTextNode(e||"")},HTMLEncoder:function(e){const t={"<":"$lt;",">":"$gt;"};return e.replace(/<|>/g,(function(e){return"string"==typeof t[e]?t[e]:e}))},HTMLDecoder:function(e){const t={"$lt;":"<","$gt;":">"};return e.replace(/\$lt;|\$gt;/g,(function(e){return"string"==typeof t[e]?t[e]:e}))},hasOwn:function(e,t){return this._hasOwn.call(e,t)},_hasOwn:Object.prototype.hasOwnProperty,getIncludePath:function(e,t){let n="";const i=[],l="js"===t?"script":"link",o="js"===t?"src":"href";let s="(?:";for(let t=0,n=e.length;t0?i[0][o]:""),-1===n.indexOf(":/")&&"//"!==n.slice(0,2)&&(n=0===n.indexOf("/")?location.href.match(/^.*?:\/\/[^\/]*/)[0]+n:location.href.match(/^[^\?]*\/(?:)/)[0]+n),!n)throw"[SUNEDITOR.util.getIncludePath.fail] The SUNEDITOR installation path could not be automatically detected. (name: +"+name+", extension: "+t+")";return n},getPageStyle:function(e){let t="";const n=(e||this._d).styleSheets;for(let e,i=0,l=n.length;i-1||(i+=n[e].name+'="'+n[e].value+'" ');return i},getByteLength:function(e){const t=this._w.encodeURIComponent;let n,i;return this.isIE_Edge?(i=this._w.unescape(t(e.toString())).length,n=0,null!==t(e.toString()).match(/(%0A|%0D)/gi)&&(n=t(e.toString()).match(/(%0A|%0D)/gi).length),i+n):(i=new this._w.TextEncoder("utf-8").encode(e.toString()).length,n=0,null!==t(e.toString()).match(/(%0A|%0D)/gi)&&(n=t(e.toString()).match(/(%0A|%0D)/gi).length),i+n)},isWysiwygDiv:function(e){return e&&1===e.nodeType&&(this.hasClass(e,"se-wrapper-wysiwyg")||/^BODY$/i.test(e.nodeName))},isNonEditable:function(e){return e&&1===e.nodeType&&"false"===e.getAttribute("contenteditable")},isTextStyleElement:function(e){return e&&3!==e.nodeType&&/^(strong|span|font|b|var|i|em|u|ins|s|strike|del|sub|sup|mark|a|label|code)$/i.test(e.nodeName)},isFormatElement:function(e){return e&&1===e.nodeType&&(/^(P|DIV|H[1-6]|PRE|LI|TH|TD)$/i.test(e.nodeName)||this.hasClass(e,"(\\s|^)__se__format__replace_.+(\\s|$)|(\\s|^)__se__format__free_.+(\\s|$)"))&&!this.isComponent(e)&&!this.isWysiwygDiv(e)},isRangeFormatElement:function(e){return e&&1===e.nodeType&&(/^(BLOCKQUOTE|OL|UL|FIGCAPTION|TABLE|THEAD|TBODY|TR|TH|TD)$/i.test(e.nodeName)||this.hasClass(e,"(\\s|^)__se__format__range_.+(\\s|$)"))},isClosureRangeFormatElement:function(e){return e&&1===e.nodeType&&(/^(TH|TD)$/i.test(e.nodeName)||this.hasClass(e,"(\\s|^)__se__format__range__closure_.+(\\s|$)"))},isFreeFormatElement:function(e){return e&&1===e.nodeType&&(/^PRE$/i.test(e.nodeName)||this.hasClass(e,"(\\s|^)__se__format__free_.+(\\s|$)"))&&!this.isComponent(e)&&!this.isWysiwygDiv(e)},isClosureFreeFormatElement:function(e){return e&&1===e.nodeType&&this.hasClass(e,"(\\s|^)__se__format__free__closure_.+(\\s|$)")},isComponent:function(e){return e&&(/se-component/.test(e.className)||/^(TABLE|HR)$/.test(e.nodeName))},isMediaComponent:function(e){return e&&/se-component/.test(e.className)},isNotCheckingNode:function(e){return e&&/katex|__se__tag/.test(e.className)},getFormatElement:function(e,t){if(!e)return null;for(t||(t=function(){return!0});e;){if(this.isWysiwygDiv(e))return null;if(this.isRangeFormatElement(e)&&e.firstElementChild,this.isFormatElement(e)&&t(e))return e;e=e.parentNode}return null},getRangeFormatElement:function(e,t){if(!e)return null;for(t||(t=function(){return!0});e;){if(this.isWysiwygDiv(e))return null;if(this.isRangeFormatElement(e)&&!/^(THEAD|TBODY|TR)$/i.test(e.nodeName)&&t(e))return e;e=e.parentNode}return null},getFreeFormatElement:function(e,t){if(!e)return null;for(t||(t=function(){return!0});e;){if(this.isWysiwygDiv(e))return null;if(this.isFreeFormatElement(e)&&t(e))return e;e=e.parentNode}return null},getClosureFreeFormatElement:function(e,t){if(!e)return null;for(t||(t=function(){return!0});e;){if(this.isWysiwygDiv(e))return null;if(this.isClosureFreeFormatElement(e)&&t(e))return e;e=e.parentNode}return null},copyTagAttributes:function(e,t){t.style.cssText&&(e.style.cssText+=t.style.cssText);const n=t.classList;for(let t=0,i=n.length;ts?1:o0&&!this.isBreak(e);)e=e.firstChild;for(;t&&1===t.nodeType&&t.childNodes.length>0&&!this.isBreak(t);)t=t.lastChild;return{sc:e,ec:t||e}}},getOffset:function(e,t){let n=0,i=0,l=3===e.nodeType?e.parentElement:e;const o=this.getParentElement(e,this.isWysiwygDiv.bind(this));for(;l&&!this.hasClass(l,"se-container")&&l!==o;)n+=l.offsetLeft,i+=l.offsetTop,l=l.offsetParent;const s=t&&/iframe/i.test(t.nodeName);return{left:n+(s?t.parentElement.offsetLeft:0),top:i-o.scrollTop+(s?t.parentElement.offsetTop:0)}},getOverlapRangeAtIndex:function(e,t,n,i){if(e<=i?tn)return 0;const l=(e>n?e:n)-(t0?" ":"")+t)},removeClass:function(e,t){if(!e)return;const n=new this._w.RegExp("(\\s|^)"+t+"(\\s|$)");e.className=e.className.replace(n," ").trim(),e.className.trim()||e.removeAttribute("class")},toggleClass:function(e,t){if(!e)return;const n=new this._w.RegExp("(\\s|^)"+t+"(\\s|$)");n.test(e.className)?e.className=e.className.replace(n," ").trim():e.className+=" "+t,e.className.trim()||e.removeAttribute("class")},setDisabledButtons:function(e,t){for(let n=0,i=t.length;n=0){e.splitText(t);const n=this.getNodeFromPath([a+1],i);this.onlyZeroWidthSpace(n)&&(n.data=this.zeroWidthSpace)}}else 1===e.nodeType&&(e.previousSibling?e=e.previousSibling:this.getElementDepth(e)===n&&(r=!1));let c=e;for(;this.getElementDepth(c)>n;)for(a=this.getPositionIndex(c)+1,c=c.parentNode,s=l,l=c.cloneNode(!1),o=c.childNodes,s&&(this.isListCell(l)&&this.isList(s)&&s.firstElementChild?(l.innerHTML=s.firstElementChild.innerHTML,N.removeItem(s.firstElementChild),s.children.length>0&&l.appendChild(s)):l.appendChild(s));o[a];)l.appendChild(o[a]);c.childNodes.length<=1&&(!c.firstChild||0===c.firstChild.textContent.length)&&(c.innerHTML="
    ");const d=c.parentNode;return r&&(c=c.nextSibling),l?(this.mergeSameTags(l,null,!1),this.mergeNestedTags(l,function(e){return this.isList(e)}.bind(this)),l.childNodes.length>0?d.insertBefore(l,c):l=c,0===i.childNodes.length&&this.removeItem(i),l):c},mergeSameTags:function(e,t,n){const i=this,l=t?t.length:0;let o=null;return l&&(o=this._w.Array.apply(null,new this._w.Array(l)).map(this._w.Number.prototype.valueOf,0)),function e(s,a,r){const c=s.childNodes;for(let d,u,h=0,g=c.length;h=0;){if(i.getArrayIndex(o.childNodes,n)!==e[r]){c=!1;break}n=d.parentNode,o=n.parentNode,r--}c&&(e.splice(a,1),e[a]=h)}}i.copyTagAttributes(d,s),s.parentNode.insertBefore(d,s),i.removeItem(s)}if(!u){1===d.nodeType&&e(d,a+1,h);break}if(d.nodeName===u.nodeName&&i.isSameAttributes(d,u)&&d.href===u.href){const e=d.childNodes;let n=0;for(let t=0,i=e.length;t0&&n++;const s=d.lastChild,c=u.firstChild;let g=0;if(s&&c){const e=3===s.nodeType&&3===c.nodeType;g=s.textContent.length;let i=s.previousSibling;for(;i&&3===i.nodeType;)g+=i.textContent.length,i=i.previousSibling;if(n>0&&3===s.nodeType&&3===c.nodeType&&(s.textContent.length>0||c.textContent.length>0)&&n--,l){let i=null;for(let d=0;dh){if(a>0&&i[a-1]!==r)continue;i[a]-=1,i[a+1]>=0&&i[a]===h&&(i[a+1]+=n,e&&s&&3===s.nodeType&&c&&3===c.nodeType&&(o[d]+=g))}}}if(3===d.nodeType){if(g=d.textContent.length,d.textContent+=u.textContent,l){let e=null;for(let i=0;ih){if(a>0&&e[a-1]!==r)continue;e[a]-=1,e[a+1]>=0&&e[a]===h&&(e[a+1]+=n,o[i]+=g)}}}else d.innerHTML+=u.innerHTML;i.removeItem(u),h--}else 1===d.nodeType&&e(d,a+1,h)}}(e,0,0),o},mergeNestedTags:function(e,t){"string"==typeof t?t=function(e){return this.test(e.tagName)}.bind(new this._w.RegExp("^("+(t||".+")+")$","i")):"function"!=typeof t&&(t=function(){return!0}),function e(n){let i=n.children;if(1===i.length&&i[0].nodeName===n.nodeName&&t(n)){const e=i[0];for(i=e.children;i[0];)n.appendChild(i[0]);n.removeChild(e)}for(let t=0,i=n.children.length;t")},htmlRemoveWhiteSpace:function(e){return e?e.trim().replace(/<\/?(?!strong|span|font|b|var|i|em|u|ins|s|strike|del|sub|sup|mark|a|label|code)[^>^<]+>\s+(?=<)/gi,(function(e){return e.trim()})):""},sortByDepth:function(e,t){const n=t?1:-1,i=-1*n;e.sort(function(e,t){return this.isListCell(e)&&this.isListCell(t)?(e=this.getElementDepth(e))>(t=this.getElementDepth(t))?n:e":e.innerHTML,e.innerHTML=t.outerHTML},_setDefaultOptionStyle:function(e,t){let n="";e.height&&(n+="height:"+e.height+";"),e.minHeight&&(n+="min-height:"+e.minHeight+";"),e.maxHeight&&(n+="max-height:"+e.maxHeight+";"),e.position&&(n+="position:"+e.position+";"),e.width&&(n+="width:"+e.width+";"),e.minWidth&&(n+="min-width:"+e.minWidth+";"),e.maxWidth&&(n+="max-width:"+e.maxWidth+";");let i="",l="",o="";const s=(t=n+t).split(";");for(let t,n=0,a=s.length;n'+this._setIframeCssTags(t),e.contentDocument.body.className="sun-editor-editable",e.contentDocument.body.setAttribute("contenteditable",!0)},_setIframeCssTags:function(e){const t=e.iframeCSSFileName,n=this._w.RegExp;let i="";for(let e,l=0,o=t.length;l'}return i+("auto"===e.height?"":"")}};var T=N,L={init:function(e,t){"object"!=typeof t&&(t={});const n=document;this._initOptions(e,t);const i=n.createElement("DIV");i.className="sun-editor",e.id&&(i.id="suneditor_"+e.id);const l=n.createElement("DIV");l.className="se-container";const o=this._createToolBar(n,t.buttonList,t.plugins,t);o.element.style.visibility="hidden",o.pluginCallButtons.math&&this._checkKatexMath(t.katex);const s=n.createElement("DIV");s.className="se-arrow";const a=n.createElement("DIV");a.className="se-toolbar-sticky-dummy";const r=n.createElement("DIV");r.className="se-wrapper";const c=this._initElements(t,i,o.element,s),d=c.bottomBar,u=c.wysiwygFrame,h=c.placeholder;let g=c.codeView;const p=d.resizingBar,m=d.navigation,f=d.charWrapper,_=d.charCounter,b=n.createElement("DIV");b.className="se-loading-box sun-editor-common",b.innerHTML='
    ';const v=n.createElement("DIV");v.className="se-line-breaker",v.innerHTML='";const y=n.createElement("DIV");y.className+="se-line-breaker-component";const C=y.cloneNode(!0);y.innerHTML=C.innerHTML=t.icons.line_break;const w=n.createElement("DIV");w.className="se-resizing-back";const x=t.toolbarContainer;return x&&x.appendChild(o.element),r.appendChild(g),h&&r.appendChild(h),x||l.appendChild(o.element),l.appendChild(a),l.appendChild(r),l.appendChild(w),l.appendChild(b),l.appendChild(v),l.appendChild(y),l.appendChild(C),p&&l.appendChild(p),i.appendChild(l),g=this._checkCodeMirror(t,g),{constructed:{_top:i,_relative:l,_toolBar:o.element,_menuTray:o._menuTray,_editorArea:r,_wysiwygArea:u,_codeArea:g,_placeholder:h,_resizingBar:p,_navigation:m,_charWrapper:f,_charCounter:_,_loading:b,_lineBreaker:v,_lineBreaker_t:y,_lineBreaker_b:C,_resizeBack:w,_stickyDummy:a,_arrow:s},options:t,plugins:o.plugins,pluginCallButtons:o.pluginCallButtons,_responsiveButtons:o.responsiveButtons}},_checkCodeMirror:function(e,t){if(e.codeMirror){const n=[{mode:"htmlmixed",htmlMode:!0,lineNumbers:!0,lineWrapping:!0},e.codeMirror.options||{}].reduce((function(e,t){for(let n in t)T.hasOwn(t,n)&&(e[n]=t[n]);return e}),{});"auto"===e.height&&(n.viewportMargin=1/0,n.height="auto");const i=e.codeMirror.src.fromTextArea(t,n);i.display.wrapper.style.cssText=t.style.cssText,e.codeMirrorEditor=i,(t=i.display.wrapper).className+=" se-wrapper-code-mirror"}return t},_checkKatexMath:function(e){if(!e)throw Error('[SUNEDITOR.create.fail] To use the math button you need to add a "katex" object to the options.');const t=[{throwOnError:!1},e.options||{}].reduce((function(e,t){for(let n in t)T.hasOwn(t,n)&&(e[n]=t[n]);return e}),{});e.options=t},_setOptions:function(e,t,n,i){this._initOptions(t.element.originElement,e);const l=t.element,o=l.relative,s=l.editorArea,a=e.toolbarContainer&&e.toolbarContainer!==i.toolbarContainer,r=!!e.buttonList||e.mode!==i.mode||a,c=!!e.plugins,d=this._createToolBar(document,r?e.buttonList:i.buttonList,c?e.plugins:n,e);d.pluginCallButtons.math&&this._checkKatexMath(e.katex);const u=document.createElement("DIV");u.className="se-arrow",r&&(d.element.style.visibility="hidden",a?(e.toolbarContainer.appendChild(d.element),l.toolbar.parentElement.removeChild(l.toolbar)):l.toolbar.parentElement.replaceChild(d.element,l.toolbar),l.toolbar=d.element,l._menuTray=d._menuTray,l._arrow=u);const h=this._initElements(e,l.topArea,r?d.element:l.toolbar,u),g=h.bottomBar,p=h.wysiwygFrame,m=h.placeholder;let f=h.codeView;return l.resizingBar&&o.removeChild(l.resizingBar),g.resizingBar&&o.appendChild(g.resizingBar),s.innerHTML="",s.appendChild(f),m&&s.appendChild(m),f=this._checkCodeMirror(e,f),l.resizingBar=g.resizingBar,l.navigation=g.navigation,l.charWrapper=g.charWrapper,l.charCounter=g.charCounter,l.wysiwygFrame=p,l.code=f,l.placeholder=m,{callButtons:r?d.pluginCallButtons:null,plugins:r||c?d.plugins:null,toolbar:d}},_initElements:function(e,t,n,i){t.style.cssText=e._editorStyles.top,/inline/i.test(e.mode)?(n.className+=" se-toolbar-inline",n.style.width=e.toolbarWidth):/balloon/i.test(e.mode)&&(n.className+=" se-toolbar-balloon",n.style.width=e.toolbarWidth,n.appendChild(i));const l=document.createElement(e.iframe?"IFRAME":"DIV");l.className="se-wrapper-inner se-wrapper-wysiwyg",e.iframe?(l.allowFullscreen=!0,l.frameBorder=0,l.style.cssText=e._editorStyles.frame):(l.setAttribute("contenteditable",!0),l.setAttribute("scrolling","auto"),l.className+=" sun-editor-editable",l.style.cssText=e._editorStyles.frame+e._editorStyles.editor);const o=document.createElement("TEXTAREA");o.className="se-wrapper-inner se-wrapper-code",o.style.cssText=e._editorStyles.frame,o.style.display="none","auto"===e.height&&(o.style.overflow="hidden");let s=null,a=null,r=null,c=null;if(e.resizingBar&&(s=document.createElement("DIV"),s.className="se-resizing-bar sun-editor-common",a=document.createElement("DIV"),a.className="se-navigation sun-editor-common",s.appendChild(a),e.charCounter)){if(r=document.createElement("DIV"),r.className="se-char-counter-wrapper",e.charCounterLabel){const t=document.createElement("SPAN");t.className="se-char-label",t.textContent=e.charCounterLabel,r.appendChild(t)}if(c=document.createElement("SPAN"),c.className="se-char-counter",c.textContent="0",r.appendChild(c),e.maxCharCount>0){const t=document.createElement("SPAN");t.textContent=" / "+e.maxCharCount,r.appendChild(t)}s.appendChild(r)}let d=null;return e.placeholder&&(d=document.createElement("SPAN"),d.className="se-placeholder",d.innerText=e.placeholder),{bottomBar:{resizingBar:s,navigation:a,charWrapper:r,charCounter:c},wysiwygFrame:l,codeView:o,placeholder:d}},_initOptions:function(e,t){t.lang=t.lang||S.a,t.value="string"==typeof t.value?t.value:null,t.historyStackDelayTime="number"==typeof t.historyStackDelayTime?t.historyStackDelayTime:400,t._defaultTagsWhitelist="string"==typeof t._defaultTagsWhitelist?t._defaultTagsWhitelist:"br|p|div|pre|blockquote|h[1-6]|ol|ul|li|hr|figure|figcaption|img|iframe|audio|video|source|table|thead|tbody|tr|th|td|a|b|strong|var|i|em|u|ins|s|span|strike|del|sub|sup|code",t._editorTagsWhitelist=t._defaultTagsWhitelist+("string"==typeof t.addTagsWhitelist&&t.addTagsWhitelist.length>0?"|"+t.addTagsWhitelist:""),t.pasteTagsWhitelist="string"==typeof t.pasteTagsWhitelist?t.pasteTagsWhitelist:t._editorTagsWhitelist,t.attributesWhitelist=t.attributesWhitelist&&"object"==typeof t.attributesWhitelist?t.attributesWhitelist:null,t.mode=t.mode||"classic",t.toolbarWidth=t.toolbarWidth?T.isNumber(t.toolbarWidth)?t.toolbarWidth+"px":t.toolbarWidth:"auto",t.toolbarContainer=/balloon/i.test(t.mode)?null:"string"==typeof t.toolbarContainer?document.querySelector(t.toolbarContainer):t.toolbarContainer,t.stickyToolbar=/balloon/i.test(t.mode)||t.toolbarContainer?-1:void 0===t.stickyToolbar?0:/^\d+/.test(t.stickyToolbar)?T.getNumber(t.stickyToolbar,0):-1,t.fullPage=!!t.fullPage,t.iframe=t.fullPage||t.iframe,t.iframeCSSFileName=t.iframe?"string"==typeof t.iframeCSSFileName?[t.iframeCSSFileName]:t.iframeCSSFileName||["suneditor"]:null,t.codeMirror=t.codeMirror?t.codeMirror.src?t.codeMirror:{src:t.codeMirror}:null,t.position="string"==typeof t.position?t.position:null,t.display=t.display||("none"!==e.style.display&&e.style.display?e.style.display:"block"),t.popupDisplay=t.popupDisplay||"full",t.resizingBar=void 0===t.resizingBar?!/inline|balloon/i.test(t.mode):t.resizingBar,t.showPathLabel=!!t.resizingBar&&("boolean"!=typeof t.showPathLabel||t.showPathLabel),t.charCounter=t.maxCharCount>0||"boolean"==typeof t.charCounter&&t.charCounter,t.charCounterType="string"==typeof t.charCounterType?t.charCounterType:"char",t.charCounterLabel="string"==typeof t.charCounterLabel?t.charCounterLabel.trim():null,t.maxCharCount=T.isNumber(t.maxCharCount)&&t.maxCharCount>-1?1*t.maxCharCount:null,t.width=t.width?T.isNumber(t.width)?t.width+"px":t.width:e.clientWidth?e.clientWidth+"px":"100%",t.minWidth=(T.isNumber(t.minWidth)?t.minWidth+"px":t.minWidth)||"",t.maxWidth=(T.isNumber(t.maxWidth)?t.maxWidth+"px":t.maxWidth)||"",t.height=t.height?T.isNumber(t.height)?t.height+"px":t.height:e.clientHeight?e.clientHeight+"px":"auto",t.minHeight=(T.isNumber(t.minHeight)?t.minHeight+"px":t.minHeight)||"",t.maxHeight=(T.isNumber(t.maxHeight)?t.maxHeight+"px":t.maxHeight)||"",t.defaultStyle="string"==typeof t.defaultStyle?t.defaultStyle:"",t.font=t.font?t.font:null,t.fontSize=t.fontSize?t.fontSize:null,t.formats=t.formats?t.formats:null,t.colorList=t.colorList?t.colorList:null,t.lineHeights=t.lineHeights?t.lineHeights:null,t.paragraphStyles=t.paragraphStyles?t.paragraphStyles:null,t.textStyles=t.textStyles?t.textStyles:null,t.fontSizeUnit="string"==typeof t.fontSizeUnit&&t.fontSizeUnit.trim()||"px",t.imageResizing=void 0===t.imageResizing||t.imageResizing,t.imageHeightShow=void 0===t.imageHeightShow||!!t.imageHeightShow,t.imageWidth=t.imageWidth?T.isNumber(t.imageWidth)?t.imageWidth+"px":t.imageWidth:"auto",t.imageHeight=t.imageHeight?T.isNumber(t.imageHeight)?t.imageHeight+"px":t.imageHeight:"auto",t.imageSizeOnlyPercentage=!!t.imageSizeOnlyPercentage,t._imageSizeUnit=t.imageSizeOnlyPercentage?"%":"px",t.imageRotation=void 0!==t.imageRotation?t.imageRotation:!(t.imageSizeOnlyPercentage||!t.imageHeightShow),t.imageFileInput=void 0===t.imageFileInput||t.imageFileInput,t.imageUrlInput=void 0===t.imageUrlInput||!t.imageFileInput||t.imageUrlInput,t.imageUploadHeader=t.imageUploadHeader||null,t.imageUploadUrl="string"==typeof t.imageUploadUrl?t.imageUploadUrl:null,t.imageUploadSizeLimit=/\d+/.test(t.imageUploadSizeLimit)?T.getNumber(t.imageUploadSizeLimit,0):null,t.imageMultipleFile=!!t.imageMultipleFile,t.imageAccept="string"!=typeof t.imageAccept||"*"===t.imageAccept.trim()?"image/*":t.imageAccept.trim()||"image/*",t.imageGalleryUrl="string"==typeof t.imageGalleryUrl?t.imageGalleryUrl:null,t.videoResizing=void 0===t.videoResizing||t.videoResizing,t.videoHeightShow=void 0===t.videoHeightShow||!!t.videoHeightShow,t.videoRatioShow=void 0===t.videoRatioShow||!!t.videoRatioShow,t.videoWidth=t.videoWidth&&T.getNumber(t.videoWidth,0)?T.isNumber(t.videoWidth)?t.videoWidth+"px":t.videoWidth:"",t.videoHeight=t.videoHeight&&T.getNumber(t.videoHeight,0)?T.isNumber(t.videoHeight)?t.videoHeight+"px":t.videoHeight:"",t.videoSizeOnlyPercentage=!!t.videoSizeOnlyPercentage,t._videoSizeUnit=t.videoSizeOnlyPercentage?"%":"px",t.videoRotation=void 0!==t.videoRotation?t.videoRotation:!(t.videoSizeOnlyPercentage||!t.videoHeightShow),t.videoRatio=T.getNumber(t.videoRatio,4)||.5625,t.videoRatioList=t.videoRatioList?t.videoRatioList:null,t.youtubeQuery=(t.youtubeQuery||"").replace("?",""),t.videoFileInput=!!t.videoFileInput,t.videoUrlInput=void 0===t.videoUrlInput||!t.videoFileInput||t.videoUrlInput,t.videoUploadHeader=t.videoUploadHeader||null,t.videoUploadUrl="string"==typeof t.videoUploadUrl?t.videoUploadUrl:null,t.videoUploadSizeLimit=/\d+/.test(t.videoUploadSizeLimit)?T.getNumber(t.videoUploadSizeLimit,0):null,t.videoMultipleFile=!!t.videoMultipleFile,t.videoTagAttrs=t.videoTagAttrs||null,t.videoIframeAttrs=t.videoIframeAttrs||null,t.videoAccept="string"!=typeof t.videoAccept||"*"===t.videoAccept.trim()?"video/*":t.videoAccept.trim()||"video/*",t.audioWidth=t.audioWidth?T.isNumber(t.audioWidth)?t.audioWidth+"px":t.audioWidth:"",t.audioHeight=t.audioHeight?T.isNumber(t.audioHeight)?t.audioHeight+"px":t.audioHeight:"",t.audioFileInput=!!t.audioFileInput,t.audioUrlInput=void 0===t.audioUrlInput||!t.audioFileInput||t.audioUrlInput,t.audioUploadHeader=t.audioUploadHeader||null,t.audioUploadUrl="string"==typeof t.audioUploadUrl?t.audioUploadUrl:null,t.audioUploadSizeLimit=/\d+/.test(t.audioUploadSizeLimit)?T.getNumber(t.audioUploadSizeLimit,0):null,t.audioMultipleFile=!!t.audioMultipleFile,t.audioTagAttrs=t.audioTagAttrs||null,t.audioAccept="string"!=typeof t.audioAccept||"*"===t.audioAccept.trim()?"audio/*":t.audioAccept.trim()||"audio/*",t.tableCellControllerPosition="string"==typeof t.tableCellControllerPosition?t.tableCellControllerPosition.toLowerCase():"cell",t.tabDisable=!!t.tabDisable,t.shortcutsDisable=Array.isArray(t.shortcutsDisable)&&t.shortcutsDisable.length>0?t.shortcutsDisable.map((function(e){return e.toLowerCase()})):[],t.shortcutsHint=void 0===t.shortcutsHint||!!t.shortcutsHint,t.callBackSave=t.callBackSave?t.callBackSave:null,t.templates=t.templates?t.templates:null,t.placeholder="string"==typeof t.placeholder?t.placeholder:null,t.linkProtocol="string"==typeof t.linkProtocol?t.linkProtocol:null,t.katex=t.katex?t.katex.src?t.katex:{src:t.katex}:null,t.buttonList=t.buttonList||[["undo","redo"],["bold","underline","italic","strike","subscript","superscript"],["removeFormat"],["outdent","indent"],["fullScreen","showBlocks","codeView"],["preview","print"]],t.icons=t.icons&&"object"==typeof t.icons?[x,t.icons].reduce((function(e,t){for(let n in t)T.hasOwn(t,n)&&(e[n]=t[n]);return e}),{}):x,t._editorStyles=T._setDefaultOptionStyle(t,t.defaultStyle)},_defaultButtons:function(e){const t=e.icons,n=e.lang,i=T.isOSX_IOS?"⌘":"CTRL",l=e.shortcutsHint?e.shortcutsDisable:["bold","strike","underline","italic","undo","indent"];return{bold:["_se_command_bold",n.toolbar.bold+(l.indexOf("bold")>-1?"":" ("+i+"+B)"),"STRONG","",t.bold],underline:["_se_command_underline",n.toolbar.underline+(l.indexOf("underline")>-1?"":" ("+i+"+U)"),"U","",t.underline],italic:["_se_command_italic",n.toolbar.italic+(l.indexOf("italic")>-1?"":" ("+i+"+I)"),"EM","",t.italic],strike:["_se_command_strike",n.toolbar.strike+(l.indexOf("strike")>-1?"":" ("+i+"+SHIFT+S)"),"DEL","",t.strike],subscript:["_se_command_subscript",n.toolbar.subscript,"SUB","",t.subscript],superscript:["_se_command_superscript",n.toolbar.superscript,"SUP","",t.superscript],removeFormat:["",n.toolbar.removeFormat,"removeFormat","",t.erase],indent:["_se_command_indent",n.toolbar.indent+(l.indexOf("indent")>-1?"":" ("+i+"+])"),"indent","",t.outdent],outdent:["_se_command_outdent",n.toolbar.outdent+(l.indexOf("indent")>-1?"":" ("+i+"+[)"),"outdent","",t.indent],fullScreen:["se-code-view-enabled se-resizing-enabled _se_command_fullScreen",n.toolbar.fullScreen,"fullScreen","",t.expansion],showBlocks:["_se_command_showBlocks",n.toolbar.showBlocks,"showBlocks","",t.show_blocks],codeView:["se-code-view-enabled se-resizing-enabled _se_command_codeView",n.toolbar.codeView,"codeView","",t.code_view],undo:["_se_command_undo se-resizing-enabled",n.toolbar.undo+(l.indexOf("undo")>-1?"":" ("+i+"+Z)"),"undo","",t.undo],redo:["_se_command_redo se-resizing-enabled",n.toolbar.redo+(l.indexOf("undo")>-1?"":" ("+i+"+Y / "+i+"+SHIFT+Z)"),"redo","",t.redo],preview:["se-resizing-enabled",n.toolbar.preview,"preview","",t.preview],print:["se-resizing-enabled",n.toolbar.print,"print","",t.print],save:["_se_command_save se-resizing-enabled",n.toolbar.save,"save","",t.save],blockquote:["",n.toolbar.tag_blockquote,"blockquote","command",t.blockquote],font:["se-btn-select se-btn-tool-font",n.toolbar.font,"font","submenu",''+n.toolbar.font+""+t.arrow_down],formatBlock:["se-btn-select se-btn-tool-format",n.toolbar.formats,"formatBlock","submenu",''+n.toolbar.formats+""+t.arrow_down],fontSize:["se-btn-select se-btn-tool-size",n.toolbar.fontSize,"fontSize","submenu",''+n.toolbar.fontSize+""+t.arrow_down],fontColor:["",n.toolbar.fontColor,"fontColor","submenu",t.font_color],hiliteColor:["",n.toolbar.hiliteColor,"hiliteColor","submenu",t.highlight_color],align:["se-btn-align",n.toolbar.align,"align","submenu",t.align_left],list:["",n.toolbar.list,"list","submenu",t.list_number],horizontalRule:["btn_line",n.toolbar.horizontalRule,"horizontalRule","submenu",t.horizontal_rule],table:["",n.toolbar.table,"table","submenu",t.table],lineHeight:["",n.toolbar.lineHeight,"lineHeight","submenu",t.line_height],template:["",n.toolbar.template,"template","submenu",t.template],paragraphStyle:["",n.toolbar.paragraphStyle,"paragraphStyle","submenu",t.paragraph_style],textStyle:["",n.toolbar.textStyle,"textStyle","submenu",t.text_style],link:["",n.toolbar.link,"link","dialog",t.link],image:["",n.toolbar.image,"image","dialog",t.image],video:["",n.toolbar.video,"video","dialog",t.video],audio:["",n.toolbar.audio,"audio","dialog",t.audio],math:["",n.toolbar.math,"math","dialog",t.math],imageGallery:["",n.toolbar.imageGallery,"imageGallery","fileBrowser",t.image_gallery]}},_createModuleGroup:function(){const e=T.createElement("DIV");e.className="se-btn-module se-btn-module-border";const t=T.createElement("UL");return t.className="se-menu-list",e.appendChild(t),{div:e,ul:t}},_createButton:function(e,t,n,i,l,o,s){const a=T.createElement("LI"),r=T.createElement("BUTTON");return r.setAttribute("type","button"),r.setAttribute("class","se-btn"+(e?" "+e:"")+" se-tooltip"),r.setAttribute("data-command",n),r.setAttribute("data-display",i),r.setAttribute("tabindex","-1"),l||(l='!'),/^default\./i.test(l)&&(l=s[l.replace(/^default\./i,"")]),/^text\./i.test(l)&&(l=l.replace(/^text\./i,""),r.className+=" se-btn-more-text"),l+=''+(t||n)+"",o&&r.setAttribute("disabled",!0),r.innerHTML=l,a.appendChild(r),{li:a,button:r}},_createToolBar:function(e,t,n,i){const l=e.createElement("DIV");l.className="se-toolbar-separator-vertical";const o=e.createElement("DIV");o.className="se-toolbar sun-editor-common";const s=e.createElement("DIV");s.className="se-btn-tray",o.appendChild(s);const a=i.icons,r=this._defaultButtons(i),c={},d=[],u={};if(n){const e=n.length?n:Object.keys(n).map((function(e){return n[e]}));for(let t,n=0,i=e.length;n",b.appendChild(i),i=i.firstElementChild.firstElementChild)}if(_){const e=l.cloneNode(!1);y&&(e.style.float=y),s.appendChild(e)}s.appendChild(p.div),_=!0}else if(/^\/$/.test(v)){const t=e.createElement("DIV");t.className="se-btn-module-enter",s.appendChild(t),_=!1}1===s.children.length&&T.removeClass(s.firstElementChild,"se-btn-module-border"),d.length>0&&d.unshift(t),b.children.length>0&&s.appendChild(b);const v=e.createElement("DIV");v.className="se-menu-tray",o.appendChild(v);const y=e.createElement("DIV");return y.className="se-toolbar-cover",o.appendChild(y),{element:o,plugins:u,pluginCallButtons:c,responsiveButtons:d,_menuTray:v,_buttonTray:s}}};var k=function(e,t,n){return{element:{originElement:e,topArea:t._top,relative:t._relative,toolbar:t._toolBar,_buttonTray:t._toolBar.querySelector(".se-btn-tray"),_menuTray:t._menuTray,resizingBar:t._resizingBar,navigation:t._navigation,charWrapper:t._charWrapper,charCounter:t._charCounter,editorArea:t._editorArea,wysiwygFrame:t._wysiwygArea,wysiwyg:t._wysiwygArea,code:t._codeArea,placeholder:t._placeholder,loading:t._loading,lineBreaker:t._lineBreaker,lineBreaker_t:t._lineBreaker_t,lineBreaker_b:t._lineBreaker_b,resizeBackground:t._resizeBack,_stickyDummy:t._stickyDummy,_arrow:t._arrow},tool:{cover:t._toolBar.querySelector(".se-toolbar-cover"),bold:t._toolBar.querySelector("._se_command_bold"),underline:t._toolBar.querySelector("._se_command_underline"),italic:t._toolBar.querySelector("._se_command_italic"),strike:t._toolBar.querySelector("._se_command_strike"),subscript:t._toolBar.querySelector("._se_command_subscript"),superscript:t._toolBar.querySelector("._se_command_superscript"),undo:t._toolBar.querySelector("._se_command_undo"),redo:t._toolBar.querySelector("._se_command_redo"),save:t._toolBar.querySelector("._se_command_save"),outdent:t._toolBar.querySelector("._se_command_outdent"),indent:t._toolBar.querySelector("._se_command_indent"),fullScreen:t._toolBar.querySelector("._se_command_fullScreen"),showBlocks:t._toolBar.querySelector("._se_command_showBlocks"),codeView:t._toolBar.querySelector("._se_command_codeView")},options:n,option:n}},A={name:"notice",add:function(e){const t=e.context;t.notice={};let n=e.util.createElement("DIV"),i=e.util.createElement("SPAN"),l=e.util.createElement("BUTTON");n.className="se-notice",l.className="close",l.setAttribute("aria-label","Close"),l.setAttribute("title",e.lang.dialogBox.close),l.innerHTML=e.icons.cancel,n.appendChild(i),n.appendChild(l),t.notice.modal=n,t.notice.message=i,l.addEventListener("click",this.onClick_cancel.bind(e)),t.element.editorArea.appendChild(n),n=null},onClick_cancel:function(e){e.preventDefault(),e.stopPropagation(),this.plugins.notice.close.call(this)},open:function(e){this.context.notice.message.textContent=e,this.context.notice.modal.style.display="block"},close:function(){this.context.notice.modal.style.display="none"}},B={init:function(e){return{create:function(t,n){return this.create(t,n,e)}.bind(this)}},create:function(e,t,n){T._propertiesInit(),"object"!=typeof t&&(t={}),n&&(t=[n,t].reduce((function(e,t){for(let n in t)if(T.hasOwn(t,n))if("plugins"===n&&t[n]&&e[n]){let i=e[n],l=t[n];i=i.length?i:Object.keys(i).map((function(e){return i[e]})),l=l.length?l:Object.keys(l).map((function(e){return l[e]})),e[n]=l.filter((function(e){return-1===i.indexOf(e)})).concat(i)}else e[n]=t[n];return e}),{}));const i="string"==typeof e?document.getElementById(e):e;if(!i){if("string"==typeof e)throw Error('[SUNEDITOR.create.fail] The element for that id was not found (ID:"'+e+'")');throw Error("[SUNEDITOR.create.fail] suneditor requires textarea's element or id value")}const l=L.init(i,t);if(l.constructed._top.id&&document.getElementById(l.constructed._top.id))throw Error('[SUNEDITOR.create.fail] The ID of the suneditor you are trying to create already exists (ID:"'+l.constructed._top.id+'")');return function(e,t,n,i,l,o){const s=e.element.originElement.ownerDocument||document,a=s.defaultView||window,r=T,c=l.icons,d={_d:s,_w:a,_parser:new a.DOMParser,_wd:null,_ww:null,_shadowRoot:null,util:r,functions:null,notice:A,icons:c,history:null,context:e,pluginCallButtons:t,plugins:n||{},initPlugins:{},_targetPlugins:{},_menuTray:{},lang:i,effectNode:null,submenu:null,container:null,_submenuName:"",_bindedSubmenuOff:null,_bindedContainerOff:null,submenuActiveButton:null,containerActiveButton:null,controllerArray:[],currentControllerName:"",currentControllerTarget:null,currentFileComponentInfo:null,codeViewDisabledButtons:null,resizingDisabledButtons:null,_moreLayerActiveButton:null,_htmlCheckWhitelistRegExp:null,_disallowedTextTagsRegExp:null,editorTagsWhitelistRegExp:null,pasteTagsWhitelistRegExp:null,hasFocus:!1,isDisabled:!1,_attributesWhitelistRegExp:null,_attributesTagsWhitelist:null,_bindControllersOff:null,_isInline:null,_isBalloon:null,_isBalloonAlways:null,_inlineToolbarAttr:{top:"",width:"",isShow:!1},_notHideToolbar:!1,_sticky:!1,_antiBlur:!1,_lineBreaker:null,_lineBreakerButton:null,_componentsInfoInit:!0,_componentsInfoReset:!1,activePlugins:null,managedTagsInfo:null,_charTypeHTML:!1,_fileInfoPluginsCheck:null,_fileInfoPluginsReset:null,_fileManager:{tags:null,regExp:null,queryString:null,pluginRegExp:null,pluginMap:null},commandMap:null,_styleCommandMap:null,_defaultCommand:{bold:"STRONG",underline:"U",italic:"EM",strike:"DEL",subscript:"SUB",superscript:"SUP"},_variable:{isCodeView:!1,isFullScreen:!1,innerHeight_fullScreen:0,resizeClientY:0,tabSize:4,codeIndent:4,minResizingSize:r.getNumber(e.element.wysiwygFrame.style.minHeight||"65",0),currentNodes:[],currentNodesMap:[],_range:null,_selectionNode:null,_originCssText:e.element.topArea.style.cssText,_bodyOverflow:"",_editorAreaOriginCssText:"",_wysiwygOriginCssText:"",_codeOriginCssText:"",_fullScreenAttrs:{sticky:!1,balloon:!1,inline:!1},_lineBreakComp:null,_lineBreakDir:""},callPlugin:function(e,n,i){if(i=i||t[e],!this.plugins[e])throw Error('[SUNEDITOR.core.callPlugin.fail] The called plugin does not exist or is in an invalid format. (pluginName:"'+e+'")');this.initPlugins[e]?"object"==typeof this._targetPlugins[e]&&i&&this.initMenuTarget(e,i,this._targetPlugins[e]):(this.plugins[e].add(this,i),this.initPlugins[e]=!0),this.plugins[e].active&&!this.commandMap[e]&&i&&(this.commandMap[e]=i,this.activePlugins.push(e)),"function"==typeof n&&n()},addModule:function(e){for(let t,n=0,i=e.length;nb?(n.style.height=l+"px",e=-1*(l-g+3)):(n.style.height=b+"px",e=g+t.parentElement.offsetHeight),n.style.top=e+"px"}else n.style.top=g+t.parentElement.offsetHeight+"px";n.style.visibility=""},controllersOn:function(){this._bindControllersOff&&this._bindControllersOff(),this.controllerArray=[];for(let e,t=0;t0){for(let e=0;e":n),this.history.push(!0)},nativeFocus:function(){const t=r.getParentElement(this.getSelectionNode(),"figcaption");t?t.focus():e.element.wysiwyg.focus(),this._editorRange()},focus:function(){if("none"!==e.element.wysiwygFrame.style.display){if(l.iframe)this.nativeFocus();else try{const t=this.getRange();if(t.startContainer===t.endContainer&&r.isWysiwygDiv(t.startContainer)){const t=r.createElement("P"),n=r.createElement("BR");t.appendChild(n),e.element.wysiwyg.appendChild(t),this.setRange(n,0,n,0)}else this.setRange(t.startContainer,t.startOffset,t.endContainer,t.endOffset)}catch(e){this.nativeFocus()}u._applyTagEffects(),this._isBalloon&&u._toggleToolbarBalloon()}},focusEdge:function(t){t||(t=e.element.wysiwyg.lastElementChild);const n=this.getFileComponent(t);n?this.selectComponent(n.target,n.pluginName):t?(t=r.getChildElement(t,(function(e){return 0===e.childNodes.length||3===e.nodeType}),!0))?this.setRange(t,t.textContent.length,t,t.textContent.length):this.nativeFocus():this.focus()},setRange:function(e,t,n,i){if(!e||!n)return;t>e.textContent.length&&(t=e.textContent.length),i>n.textContent.length&&(i=n.textContent.length);const o=this._wd.createRange();try{o.setStart(e,t),o.setEnd(n,i)}catch(e){return console.warn("[SUNEDITOR.core.focus.error] "+e),void this.nativeFocus()}const s=this.getSelection();return s.removeAllRanges&&s.removeAllRanges(),s.addRange(o),this._editorRange(),l.iframe&&this.nativeFocus(),o},removeRange:function(){this._variable._range=null,this._variable._selectionNode=null,this.getSelection().removeAllRanges();const e=this.commandMap,t=this.activePlugins;for(let i in e)r.hasOwn(e,i)&&(t.indexOf(i)>-1?n[i].active.call(this,null):e.OUTDENT&&/^OUTDENT$/i.test(i)?e.OUTDENT.setAttribute("disabled",!0):e.INDENT&&/^INDENT$/i.test(i)?e.INDENT.removeAttribute("disabled"):r.removeClass(e[i],"active"))},getRange:function(){const t=this._variable._range||this._createDefaultRange(),n=this.getSelection();if(t.collapsed===n.isCollapsed||!e.element.wysiwyg.contains(n.focusNode))return t;if(n.rangeCount>0)return this._variable._range=n.getRangeAt(0),this._variable._range;{const e=n.anchorNode,t=n.focusNode,i=n.anchorOffset,l=n.focusOffset,o=r.compareElements(e,t),s=o.ancestor&&(0===o.result?i<=l:o.result>1);return this.setRange(s?e:t,s?i:l,s?t:e,s?l:i)}},getRange_addLine:function(t){if(this._selectionVoid(t)){const n=e.element.wysiwyg,i=r.createElement("P");i.innerHTML="
    ",n.insertBefore(i,n.firstElementChild),this.setRange(i.firstElementChild,0,i.firstElementChild,1),t=this._variable._range}return t},getSelection:function(){return this._shadowRoot&&this._shadowRoot.getSelection?this._shadowRoot.getSelection():this._ww.getSelection()},getSelectionNode:function(){if(r.isWysiwygDiv(this._variable._selectionNode)&&this._editorRange(),!this._variable._selectionNode){const t=r.getChildElement(e.element.wysiwyg.firstChild,(function(e){return 0===e.childNodes.length||3===e.nodeType}),!1);if(t)return this._variable._selectionNode=t,t;this._editorRange()}return this._variable._selectionNode},_editorRange:function(){const e=this.getSelection();if(!e)return null;let t=null,n=null;t=e.rangeCount>0?e.getRangeAt(0):this._createDefaultRange(),this._variable._range=t,n=t.collapsed?t.commonAncestorContainer:e.extentNode||e.anchorNode,this._variable._selectionNode=n},_createDefaultRange:function(){const t=e.element.wysiwyg;t.focus();const n=this._wd.createRange();let i=t.firstElementChild;return i||(i=r.createElement("P"),i.innerHTML="
    ",t.appendChild(i)),n.setStart(i,0),n.setEnd(i,0),n},_selectionVoid:function(e){const t=e.commonAncestorContainer;return r.isWysiwygDiv(e.startContainer)&&r.isWysiwygDiv(e.endContainer)||/FIGURE/i.test(t.nodeName)||this._fileManager.regExp.test(t.nodeName)||r.isMediaComponent(t)},_resetRangeToTextNode:function(){const t=this.getRange();if(this._selectionVoid(t))return!1;let n,i,l,o=t.startContainer,s=t.startOffset,a=t.endContainer,c=t.endOffset;if(r.isFormatElement(o)&&(o=o.childNodes[s]||o.lastChild,s=o.textContent.length),r.isFormatElement(a)&&(a=a.childNodes[c]||a.lastChild,c=a.textContent.length),n=r.isWysiwygDiv(o)?e.element.wysiwyg.firstChild:o,i=s,r.isBreak(n)||1===n.nodeType&&n.childNodes.length>0){const e=r.isBreak(n);if(!e){for(;n&&!r.isBreak(n)&&1===n.nodeType;)n=n.childNodes[i]||n.nextElementSibling||n.nextSibling,i=0;let e=r.getFormatElement(n,null);e===r.getRangeFormatElement(e,null)&&(e=r.createElement(r.getParentElement(n,r.isCell)?"DIV":"P"),n.parentNode.insertBefore(e,n),e.appendChild(n))}if(r.isBreak(n)){const t=r.createTextNode(r.zeroWidthSpace);n.parentNode.insertBefore(t,n),n=t,e&&o===a&&(a=n,c=1)}}if(o=n,s=i,n=r.isWysiwygDiv(a)?e.element.wysiwyg.lastChild:a,i=c,r.isBreak(n)||1===n.nodeType&&n.childNodes.length>0){const e=r.isBreak(n);if(!e){for(;n&&!r.isBreak(n)&&1===n.nodeType&&(l=n.childNodes,0!==l.length);)n=l[i>0?i-1:i]||!/FIGURE/i.test(l[0].nodeName)?l[0]:n.previousElementSibling||n.previousSibling||o,i=i>0?n.textContent.length:i;let e=r.getFormatElement(n,null);e===r.getRangeFormatElement(e,null)&&(e=r.createElement(r.isCell(e)?"DIV":"P"),n.parentNode.insertBefore(e,n),e.appendChild(n))}if(r.isBreak(n)){const t=r.createTextNode(r.zeroWidthSpace);n.parentNode.insertBefore(t,n),n=t,i=1,e&&!n.previousSibling&&r.removeItem(a)}}return a=n,c=i,this.setRange(o,s,a,c),!0},getSelectedElements:function(t){if(!this._resetRangeToTextNode())return[];let n=this.getRange();if(r.isWysiwygDiv(n.startContainer)){const t=e.element.wysiwyg.children;if(0===t.length)return[];this.setRange(t[0],0,t[t.length-1],t[t.length-1].textContent.trim().length),n=this.getRange()}const i=n.startContainer,l=n.endContainer,o=n.commonAncestorContainer,s=r.getListChildren(o,(function(e){return t?t(e):r.isFormatElement(e)}));if(r.isWysiwygDiv(o)||r.isRangeFormatElement(o)||s.unshift(r.getFormatElement(o,null)),i===l||1===s.length)return s;let a=r.getFormatElement(i,null),c=r.getFormatElement(l,null),d=null,u=null;const h=function(e){return!r.isTable(e)||/^TABLE$/i.test(e.nodeName)};let g=r.getRangeFormatElement(a,h),p=r.getRangeFormatElement(c,h);r.isTable(g)&&r.isListCell(g.parentNode)&&(g=g.parentNode),r.isTable(p)&&r.isListCell(p.parentNode)&&(p=p.parentNode);const m=g===p;for(let e,t=0,n=s.length;t=0;n--)if(i[n].contains(i[e])){i.splice(e,1),e--,t--;break}return i},isEdgePoint:function(e,t){return 0===t||!e.nodeValue&&1===t||t===e.nodeValue.length},showLoading:function(){e.element.loading.style.display="block"},closeLoading:function(){e.element.loading.style.display="none"},appendFormatTag:function(e,t){const n=r.getFormatElement(this.getSelectionNode(),null),i=t?"string"==typeof t?t:t.nodeName:r.isFormatElement(n)&&!r.isFreeFormatElement(n)?n.nodeName:"P",l=r.createElement(i);return l.innerHTML="
    ",(t&&"string"!=typeof t||!t&&r.isFormatElement(n))&&r.copyTagAttributes(l,t||n),r.isCell(e)?e.insertBefore(l,e.nextElementSibling):e.parentNode.insertBefore(l,e.nextElementSibling),l},insertComponent:function(e,t,n,i){if(n&&!this.checkCharCount(e,null))return null;const l=this.removeNode();this.getRange_addLine(this.getRange());let o=null,s=this.getSelectionNode(),a=r.getFormatElement(s,null);if(r.isListCell(a))this.insertNode(e,s===a?null:l.container.nextSibling,!1),e.nextSibling||e.parentNode.appendChild(r.createElement("BR"));else{if(this.getRange().collapsed&&(3===l.container.nodeType||r.isBreak(l.container))){const e=r.getParentElement(l.container,function(e){return this.isRangeFormatElement(e)}.bind(r));o=r.splitElement(l.container,l.offset,e?r.getElementDepth(e)+1:0),o&&(a=o.previousSibling)}this.insertNode(e,a,!1),a&&r.onlyZeroWidthSpace(a)&&r.removeItem(a)}if(!i){const t=this.getFileComponent(e);t?this.selectComponent(t.target,t.pluginName):o&&(o=r.getEdgeChildNodes(o,null).sc||o,this.setRange(o,0,o,0))}return t||this.history.push(1),o||e},getFileComponent:function(e){if(!this._fileManager.queryString||!e)return null;let t,n;return(/^FIGURE$/i.test(e.nodeName)||/se-component/.test(e.className))&&(t=e.querySelector(this._fileManager.queryString)),!t&&e.nodeName&&this._fileManager.regExp.test(e.nodeName)&&(t=e),t&&(n=this._fileManager.pluginMap[t.nodeName.toLowerCase()],n)?{target:t,component:r.getParentElement(t,r.isComponent),pluginName:n}:null},selectComponent:function(e,t){this.hasFocus||this.focus();const n=this.plugins[t];n&&a.setTimeout(function(){"function"==typeof n.select&&this.callPlugin(t,n.select.bind(this,e),null),this._setComponentLineBreaker(e)}.bind(this))},_setComponentLineBreaker:function(t){this._lineBreaker.style.display="none";const n=r.getParentElement(t,r.isComponent),i=e.element.lineBreaker_t.style,l=e.element.lineBreaker_b.style,o="block"===this.context.resizing.resizeContainer.style.display?this.context.resizing.resizeContainer:t,s=r.isListCell(n.parentNode);let a,c,d;(s?n.previousSibling:r.isFormatElement(n.previousElementSibling))?i.display="none":(this._variable._lineBreakComp=n,c=e.element.wysiwyg.scrollTop,a=r.getOffset(t,e.element.wysiwygFrame).top+c,d=o.offsetWidth/2/2,i.top=a-c-12+"px",i.left=r.getOffset(o).left+d+"px",i.display="block"),(s?n.nextSibling:r.isFormatElement(n.nextElementSibling))?l.display="none":(a||(this._variable._lineBreakComp=n,c=e.element.wysiwyg.scrollTop,a=r.getOffset(t,e.element.wysiwygFrame).top+c,d=o.offsetWidth/2/2),l.top=a+o.offsetHeight-c-12+"px",l.left=r.getOffset(o).left+o.offsetWidth-d-24+"px",l.display="block")},insertNode:function(e,t,n){if(n&&!this.checkCharCount(e,null))return null;const i=r.getFreeFormatElement(this.getSelectionNode(),null),l=!i&&(r.isFormatElement(e)||r.isRangeFormatElement(e))||r.isComponent(e);if(!t&&l){const e=this.removeNode();if(3===e.container.nodeType||r.isBreak(e.container)){const n=r.getParentElement(e.container,function(e){return this.isRangeFormatElement(e)||this.isListCell(e)}.bind(r));(t=r.splitElement(e.container,e.offset,n?r.getElementDepth(n)+1:0))&&(t=t.previousSibling)}}const o=t||l?this.getRange():this.getRange_addLine(this.getRange()),s=o.commonAncestorContainer,a=o.startOffset,c=o.endOffset,d=o.startContainer===s&&r.isFormatElement(s),u=d?s.childNodes[a]:o.startContainer,h=d?s.childNodes[c]:o.endContainer;let g,p=null;if(t)g=t.parentNode,t=t.nextSibling,p=!0;else if(g=u,3===u.nodeType&&(g=u.parentNode),o.collapsed)if(3===s.nodeType)t=s.textContent.length>c?s.splitText(c):s.nextSibling;else if(r.isBreak(g))t=g,g=g.parentNode;else{let n=g.childNodes[a];const i=n&&3===n.nodeType&&r.onlyZeroWidthSpace(n)&&r.isBreak(n.nextSibling)?n.nextSibling:n;i?i.nextSibling?t=r.isBreak(i)&&!r.isBreak(e)?i:i.nextSibling:(g.removeChild(i),t=null):t=null}else{if(u===h){t=this.isEdgePoint(h,c)?h.nextSibling:h.splitText(c);let e=u;this.isEdgePoint(u,a)||(e=u.splitText(a)),g.removeChild(e),0===g.childNodes.length&&l&&(g.innerHTML="
    ")}else{const e=this.removeNode(),n=e.container,i=e.prevContainer;if(n&&0===n.childNodes.length&&l&&(r.isFormatElement(n)?n.innerHTML="
    ":r.isRangeFormatElement(n)&&(n.innerHTML="


    ")),!l&&i)if(g=3===i.nodeType?i.parentNode:i,g.contains(n))for(t=n;t.parentNode===g;)t=t.parentNode;else t=null;else g=l?s:n,t=l?h:null;for(;t&&!r.isFormatElement(t)&&t.parentNode!==s;)t=t.parentNode}}try{if(r.isFormatElement(e)||r.isRangeFormatElement(e)||!r.isListCell(g)&&r.isComponent(e)){const e=g;if(r.isList(t))g=t,t=null;else if(r.isListCell(t))g=t.previousElementSibling||t;else if(!p&&!t){const e=this.removeNode(),n=3===e.container.nodeType?r.isListCell(r.getFormatElement(e.container,null))?e.container:r.getFormatElement(e.container,null)||e.container.parentNode:e.container,i=r.isWysiwygDiv(n)||r.isRangeFormatElement(n);g=i?n:n.parentNode,t=i?null:n.nextSibling}0===e.childNodes.length&&g!==e&&r.removeItem(e)}!l||i||r.isRangeFormatElement(g)||r.isListCell(g)||r.isWysiwygDiv(g)||(t=g.nextElementSibling,g=g.parentNode),g.insertBefore(e,g===t?g.lastChild:t)}catch(t){g.appendChild(e)}finally{if(i&&(r.isFormatElement(e)||r.isRangeFormatElement(e))&&(e=this._setIntoFreeFormat(e)),!r.isComponent(e)){let t=1;if(3===e.nodeType){const t=e.previousSibling,n=e.nextSibling,i=!t||1===t.nodeType||r.onlyZeroWidthSpace(t)?"":t.textContent,l=!n||1===n.nodeType||r.onlyZeroWidthSpace(n)?"":n.textContent;t&&i.length>0&&(e.textContent=i+e.textContent,r.removeItem(t)),n&&n.length>0&&(e.textContent+=l,r.removeItem(n));const o={container:e,startOffset:i.length,endOffset:e.textContent.length-l.length};return this.setRange(e,o.startOffset,e,o.endOffset),o}if(!r.isBreak(e)&&r.isFormatElement(g)){let n=null;e.previousSibling||(n=r.createTextNode(r.zeroWidthSpace),e.parentNode.insertBefore(n,e)),e.nextSibling||(n=r.createTextNode(r.zeroWidthSpace),e.parentNode.appendChild(n)),r._isIgnoreNodeChange(e)&&(e=e.nextSibling,t=0)}this.setRange(e,t,e,t)}return this.history.push(!0),e}},_setIntoFreeFormat:function(e){const t=e.parentNode;let n,i;for(;r.isFormatElement(e)||r.isRangeFormatElement(e);){for(n=e.childNodes,i=null;n[0];)if(i=n[0],r.isFormatElement(i)||r.isRangeFormatElement(i)){if(this._setIntoFreeFormat(i),!e.parentNode)break;n=e.childNodes}else t.insertBefore(i,e);0===e.childNodes.length&&r.removeItem(e),e=r.createElement("BR"),t.insertBefore(e,i.nextSibling)}return e},removeNode:function(){this._resetRangeToTextNode()||console.warn('[SUNEDITOR.core.removeNode.exception] An exception occurred while resetting the "Range" object.');const t=this.getRange();let n,i=0,l=t.startContainer,o=t.endContainer;const s=t.startOffset,a=t.endOffset,c=t.commonAncestorContainer;let d=null,u=null;const h=r.getListChildNodes(c,null);let g=r.getArrayIndex(h,l),p=r.getArrayIndex(h,o);if(h.length>0&&g>-1&&p>-1){for(let e=g+1,t=l;e>=0;e--)h[e]===t.parentNode&&h[e].firstChild===t&&0===s&&(g=e,t=t.parentNode);for(let e=p-1,t=o;e>g;e--)h[e]===t.parentNode&&1===h[e].nodeType&&(h.splice(e,1),t=t.parentNode,--p)}else{if(0===h.length){if(r.isFormatElement(c)||r.isRangeFormatElement(c)||r.isWysiwygDiv(c)||r.isBreak(c)||r.isMedia(c))return{container:c,offset:0};h.push(c),l=o=c}else if(l=o=h[0],r.isBreak(l)||r.onlyZeroWidthSpace(l))return{container:l,offset:0};g=p=0}function m(e){const t=r.getFormatElement(e,null);if(r.removeItem(e),r.isListCell(t)){const e=r.getArrayItem(t.children,r.isList,!1);if(e){const n=e.firstElementChild,i=n.childNodes;for(;i[0];)t.insertBefore(i[0],e);r.removeItemAllParents(n,null,null)}}}for(let e=g;e<=p;e++){const t=h[e];if(0===t.length||3===t.nodeType&&void 0===t.data)m(t);else if(t!==l)t!==o?m(t):(u=1===o.nodeType?r.createTextNode(o.textContent):r.createTextNode(o.substringData(a,o.length-a)),u.length>0?o.data=u.data:m(o));else if(1===l.nodeType?d=r.createTextNode(l.textContent):t===o?(d=r.createTextNode(l.substringData(0,s)+o.substringData(a,o.length-a)),i=s):d=r.createTextNode(l.substringData(0,s)),d.length>0?l.data=d.data:m(l),t===o)break}if(n=o&&o.parentNode?o:l&&l.parentNode?l:t.endContainer||t.startContainer,!r.isWysiwygDiv(n)){const t=r.removeItemAllParents(n,function(e){if(this.isComponent(e))return!1;const t=e.textContent;return 0===t.length||/^(\n|\u200B)+$/.test(t)}.bind(r),null);t&&(n=t.sc||t.ec||e.element.wysiwyg)}return this.setRange(n,i,n,i),this.history.push(!0),{container:n,offset:i,prevContainer:l&&l.parentNode?l:null}},applyRangeFormatElement:function(e){this.getRange_addLine(this.getRange());const t=this.getSelectedElementsAndComponents(!1);if(!t||0===t.length)return;e:for(let e,n,i,l,o,s,a=0,c=t.length;a-1&&(l=n.lastElementChild,t.indexOf(l)>-1)){let e=null;for(;e=l.lastElementChild;)if(r.isList(e)){if(!(t.indexOf(e.lastElementChild)>-1))continue e;l=e.lastElementChild}i=n.firstElementChild,o=t.indexOf(i),s=t.indexOf(l),t.splice(o,s-o+1),c=t.length}else;let n,i,l,o=t[t.length-1];n=r.isRangeFormatElement(o)||r.isFormatElement(o)?o:r.getRangeFormatElement(o,null)||r.getFormatElement(o,null),r.isCell(n)?(i=null,l=n):(i=n.nextSibling,l=n.parentNode);let s=r.getElementDepth(n),a=null;const c=[],d=function(e,t,n){let i=null;if(e!==t&&!r.isTable(t)){if(t&&r.getElementDepth(e)===r.getElementDepth(t))return n;i=r.removeItemAllParents(t,null,e)}return i?i.ec:n};for(let n,o,u,h,g,p,m,f=0,_=t.length;f<_;f++)if(n=t[f],o=n.parentNode,o&&!e.contains(o))if(u=r.getElementDepth(n),r.isList(o)){if(null===a&&(p?(a=p,m=!0,p=null):a=o.cloneNode(!1)),c.push(n),g=t[f+1],f===_-1||g&&g.parentNode!==o){g&&n.contains(g.parentNode)&&(p=g.parentNode.cloneNode(!1));let t,f=o.parentNode;for(;r.isList(f);)t=r.createElement(f.nodeName),t.appendChild(a),a=t,f=f.parentNode;const _=this.detachRangeFormatElement(o,c,null,!0,!0);s>=u?(s=u,l=_.cc,i=d(l,o,_.ec),i&&(l=i.parentNode)):l===_.cc&&(i=_.ec),l!==_.cc&&(h=d(l,_.cc,h),i=void 0!==h?h:_.cc);for(let e=0,t=_.removeArray.length;e=u&&(s=u,l=o,i=n.nextSibling),e.appendChild(n),l!==o&&(h=d(l,o),void 0!==h&&(i=h));if(this.effectNode=null,r.mergeSameTags(e,null,!1),r.mergeNestedTags(e,function(e){return this.isList(e)}.bind(r)),i&&r.getElementDepth(i)>0&&(r.isList(i.parentNode)||r.isList(i.parentNode.parentNode))){const t=r.getParentElement(i,function(e){return this.isRangeFormatElement(e)&&!this.isList(e)}.bind(r)),n=r.splitElement(i,null,t?r.getElementDepth(t)+1:0);n.parentNode.insertBefore(e,n)}else l.insertBefore(e,i),d(e,i);const u=r.getEdgeChildNodes(e.firstElementChild,e.lastElementChild);t.length>1?this.setRange(u.sc,0,u.ec,u.ec.textContent.length):this.setRange(u.ec,u.ec.textContent.length,u.ec,u.ec.textContent.length),this.history.push(!1)},detachRangeFormatElement:function(e,t,n,i,l){const o=this.getRange(),s=o.startOffset,a=o.endOffset;let c=r.getListChildNodes(e,(function(t){return t.parentNode===e})),d=e.parentNode,u=null,h=null,g=e.cloneNode(!1);const p=[],m=r.isList(n);let f=!1,_=!1,b=!1;function v(t,n,i,l){if(r.onlyZeroWidthSpace(n)&&(n.innerHTML=r.zeroWidthSpace),3===n.nodeType)return t.insertBefore(n,i),n;const o=(b?n:l).childNodes;let s=n.cloneNode(!1),a=null,c=null;for(;o[0];)c=o[0],!r._notTextNode(c)||r.isBreak(c)||r.isListCell(s)?s.appendChild(c):(s.childNodes.length>0&&(a||(a=s),t.insertBefore(s,i),s=n.cloneNode(!1)),t.insertBefore(c,i),a||(a=c));if(s.childNodes.length>0){if(r.isListCell(t)&&r.isListCell(s)&&r.isList(i))if(m){for(a=i;i;)s.appendChild(i),i=i.nextSibling;t.parentNode.insertBefore(s,t.nextElementSibling)}else{const t=l.nextElementSibling,n=r.detachNestedList(l,!1);if(e!==n||t!==l.nextElementSibling){const t=s.childNodes;for(;t[0];)l.appendChild(t[0]);e=n,_=!0}}else t.insertBefore(s,i);a||(a=s)}return a}for(let l,o,s,a=0,y=c.length;a0&&(d.insertBefore(g,e),g=null),!m&&r.isListCell(l))if(s&&r.getElementDepth(l)!==r.getElementDepth(s)&&(r.isListCell(d)||r.getArrayItem(l.children,r.isList,!1))){const t=l.nextElementSibling,n=r.detachNestedList(l,!1);e===n&&t===l.nextElementSibling||(e=n,_=!0)}else{const t=l;l=r.createElement(i?t.nodeName:r.isList(e.parentNode)||r.isListCell(e.parentNode)?"LI":r.isCell(e.parentNode)?"DIV":"P");const n=r.isListCell(l),o=t.childNodes;for(;o[0]&&(!r.isList(o[0])||n);)l.appendChild(o[0]);r.copyFormatAttributes(l,t),b=!0}else l=l.cloneNode(!1);if(!_&&(i?(p.push(l),r.removeItem(c[a])):(n?(f||(d.insertBefore(n,e),f=!0),l=v(n,l,null,c[a])):l=v(d,l,e,c[a]),_||(t?(h=l,u||(u=l)):u||(u=h=l))),_)){_=b=!1,c=r.getListChildNodes(e,(function(t){return t.parentNode===e})),g=e.cloneNode(!1),d=e.parentNode,a=-1,y=c.length;continue}}const y=e.parentNode;let C=e.nextSibling;g&&g.children.length>0&&y.insertBefore(g,C),n?u=n.previousSibling:u||(u=e.previousSibling),C=e.nextSibling,0===e.children.length||0===e.textContent.length?r.removeItem(e):r.removeEmptyNode(e,null);let w=null;if(i)w={cc:y,sc:u,ec:C,removeArray:p};else{u||(u=h),h||(h=u);const e=r.getEdgeChildNodes(u,h.parentNode?u:h);w={cc:(e.sc||e.ec).parentNode,sc:e.sc,ec:e.ec}}if(this.effectNode=null,l)return w;!i&&w&&(t?this.setRange(w.sc,s,w.ec,a):this.setRange(w.sc,0,w.sc,0)),this.history.push(!1)},detachList:function(e,t){let n={},i=!1,l=!1,o=null,s=null;const a=function(e){return!this.isComponent(e)}.bind(r);for(let c,d,u,h,g=0,p=e.length;g0)&&t,n=!!(n&&n.length>0)&&n;const o=!e,s=o&&!n&&!t;let c=l.startContainer,d=l.startOffset,u=l.endContainer,h=l.endOffset;if(s&&l.collapsed&&r.isFormatElement(c.parentNode)&&r.isFormatElement(u.parentNode)||c===u&&1===c.nodeType&&r.isNonEditable(c))return;if(l.collapsed&&!s&&1===c.nodeType&&!r.isBreak(c)&&!r.isComponent(c)){let e=null;const t=c.childNodes[d];t&&(e=t.nextSibling?r.isBreak(t)?t:t.nextSibling:null);const n=r.createTextNode(r.zeroWidthSpace);c.insertBefore(n,e),this.setRange(n,1,n,1),l=this.getRange(),c=l.startContainer,d=l.startOffset,u=l.endContainer,h=l.endOffset}r.isFormatElement(c)&&(c=c.childNodes[d]||c.firstChild,d=0),r.isFormatElement(u)&&(u=u.childNodes[h]||u.lastChild,h=u.textContent.length),o&&(e=r.createElement("DIV"));const g=a.RegExp,p=e.nodeName;if(!s&&c===u&&!n&&e){let t=c,n=0;const i=[],l=e.style;for(let e=0,t=l.length;e0){for(;!r.isFormatElement(t)&&!r.isWysiwygDiv(t);){for(let l=0;l=i.length)return}}let m,f={},_={},b="",v="",y="";if(t){for(let e,n=0,i=t.length;n0&&(a=l.replace(b,"").trim(),a!==l&&(w.v=!0));const c=t.className;let d="";return v&&c.length>0&&(d=c.replace(v,"").trim(),d!==c&&(w.v=!0)),(!o||!v&&c||!b&&l||a||d||!n)&&(a||d||t.nodeName!==p||C(b)!==C(l)||C(v)!==C(c))?(b&&l.length>0&&(t.style.cssText=a),t.style.cssText||t.removeAttribute("style"),v&&c.length>0&&(t.className=d.trim()),t.className.trim()||t.removeAttribute("class"),t.style.cssText||t.className||t.nodeName!==p&&!n?t:(w.v=!0,null)):(w.v=!0,null)},E=this.getSelectedElements(null);l=this.getRange(),c=l.startContainer,d=l.startOffset,u=l.endContainer,h=l.endOffset,r.getFormatElement(c,null)||(c=r.getChildElement(E[0],(function(e){return 3===e.nodeType}),!1),d=0),r.getFormatElement(u,null)||(u=r.getChildElement(E[E.length-1],(function(e){return 3===e.nodeType}),!1),h=u.textContent.length);const S=r.getFormatElement(c,null)===r.getFormatElement(u,null),N=E.length-(S?0:1);m=e.cloneNode(!1);const T=s||o&&function(e){for(let t=0,n=e.length;t0&&(m=e.cloneNode(!1),_=this._nodeChange_endLine(E[N],m,x,u,h,s,o,w,k,A));for(let t,n=N-1;n>0;n--)m=e.cloneNode(!1),t=this._nodeChange_middleLine(E[n],m,x,s,o,w,_.container),t.endContainer&&(_.ancestor=null,_.container=t.endContainer),this._setCommonListStyle(t.ancestor,null);m=e.cloneNode(!1),f=this._nodeChange_startLine(E[0],m,x,c,d,s,o,w,k,A,_.container),f.endContainer&&(_.ancestor=null,_.container=f.endContainer),N<=0?_=f:_.container||(_.ancestor=null,_.container=f.container,_.offset=f.container.textContent.length),this._setCommonListStyle(f.ancestor,null),this._setCommonListStyle(_.ancestor||r.getFormatElement(_.container),null)}this.controllersOff(),this.setRange(f.container,f.offset,_.container,_.offset),this.history.push(!1)},_setCommonListStyle:function(e,t){if(!r.isListCell(e))return;t||e.removeAttribute("style");const n=r.getArrayItem((t||e).childNodes,(function(e){return!r.isBreak(e)&&!r.onlyZeroWidthSpace(e.textContent.trim())}),!0);if(n[0]&&1===n.length){if(!(t=n[0])||1!==t.nodeType)return;const i=t.style,l=e.style;/STRONG/i.test(t.nodeName)?l.fontWeight="bold":i.fontWeight&&(l.fontWeight=i.fontWeight),i.color&&(l.color=i.color),i.fontSize&&(l.fontSize=i.fontSize),this._setCommonListStyle(e,t)}},_stripRemoveNode:function(e){const t=e.parentNode;if(!e||3===e.nodeType||!t)return;const n=e.childNodes;for(;n[0];)t.insertBefore(n[0],e);t.removeChild(e)},_util_getMaintainedNode:function(e,t,n){return!n||e?null:this.getParentElement(n,this._isMaintainedNode.bind(this))||(t?null:this.getParentElement(n,this._isSizeNode.bind(this)))},_util_isMaintainedNode:function(e,t,n){if(!n||e||1!==n.nodeType)return!1;const i=this._isMaintainedNode(n);return this.getParentElement(n,this._isMaintainedNode.bind(this))?i:i||!t&&this._isSizeNode(n)},_nodeChange_oneLine:function(e,t,n,i,l,o,s,c,d,u,h,g,p){let m=i.parentNode;for(;!(m.nextSibling||m.previousSibling||r.isFormatElement(m.parentNode)||r.isWysiwygDiv(m.parentNode))&&m.nodeName!==t.nodeName;)m=m.parentNode;if(!d&&m===o.parentNode&&m.nodeName===t.nodeName&&r.onlyZeroWidthSpace(i.textContent.slice(0,l))&&r.onlyZeroWidthSpace(o.textContent.slice(s))){const e=m.childNodes;let n=!0;for(let t,l,s,a,c=0,d=e.length;c0&&(n=t.test(e.style.cssText)),!n}if(function e(i,l){const o=i.childNodes;for(let i,s=0,a=o.length;s=N?L-N:S.data.length-N));if(E){const t=g(l);if(t&&t.parentNode!==e){let n=t,i=null;for(;n.parentNode!==e;){for(l=i=n.parentNode.cloneNode(!1);n.childNodes[0];)i.appendChild(n.childNodes[0]);n.appendChild(i),n=n.parentNode}n.parentNode.appendChild(t)}E=E.cloneNode(!1)}r.onlyZeroWidthSpace(o)||l.appendChild(o);const c=g(l);for(c&&(E=c),E&&(e=E),C=a,y=[],x="";C!==e&&C!==f&&null!==C;)i=p(C)?null:n(C),i&&1===C.nodeType&&z(C)&&(y.push(i),x+=C.style.cssText.substr(0,C.style.cssText.indexOf(":"))+"|"),C=C.parentNode;const d=y.pop()||s;for(w=C=d;y.length>0;)C=y.pop(),w.appendChild(C),w=C;if(t.appendChild(d),e.appendChild(t),E&&!g(T)&&(t=t.cloneNode(!1),b.appendChild(t),_.push(t)),S=s,N=0,k=!0,C!==s&&C.appendChild(S),!v)continue}if(A||a!==T){if(k){if(1===a.nodeType&&!r.isBreak(a)){r._isIgnoreNodeChange(a)?(b.appendChild(a.cloneNode(!0)),u||(t=t.cloneNode(!1),b.appendChild(t),_.push(t))):e(a,a);continue}C=a,y=[],x="";const o=[];for(;null!==C.parentNode&&C!==f&&C!==t;)i=A?C.cloneNode(!1):n(C),1===C.nodeType&&!r.isBreak(a)&&i&&z(C)&&(p(C)?E||o.push(i):y.push(i),x+=C.style.cssText.substr(0,C.style.cssText.indexOf(":"))+"|"),C=C.parentNode;y=y.concat(o);const s=y.pop()||a;for(w=C=s;y.length>0;)C=y.pop(),w.appendChild(C),w=C;if(p(t.parentNode)&&!p(s)&&(t=t.cloneNode(!1),b.appendChild(t),_.push(t)),A||E||!p(s))s===a?l=A?b:t:A?(b.appendChild(s),l=C):(t.appendChild(s),l=C);else{t=t.cloneNode(!1);const e=s.childNodes;for(let n=0,i=e.length;n0?C:t}if(E&&3===a.nodeType)if(g(a)){const e=r.getParentElement(l,function(e){return this._isMaintainedNode(e.parentNode)||e.parentNode===b}.bind(r));E.appendChild(e),t=e.cloneNode(!1),_.push(t),b.appendChild(t)}else E=null}d=a.cloneNode(!1),l.appendChild(d),1!==a.nodeType||r.isBreak(a)||(h=d),e(a,h)}else{E=g(a);const e=r.createTextNode(1===T.nodeType?"":T.substringData(L,T.length-L)),l=r.createTextNode(v||1===T.nodeType?"":T.substringData(0,L));if(E?E=E.cloneNode(!1):p(t.parentNode)&&!E&&(t=t.cloneNode(!1),b.appendChild(t),_.push(t)),!r.onlyZeroWidthSpace(e)){C=a,x="",y=[];const t=[];for(;C!==b&&C!==f&&null!==C;)1===C.nodeType&&z(C)&&(p(C)?t.push(C.cloneNode(!1)):y.push(C.cloneNode(!1)),x+=C.style.cssText.substr(0,C.style.cssText.indexOf(":"))+"|"),C=C.parentNode;for(y=y.concat(t),d=w=C=y.pop()||e;y.length>0;)C=y.pop(),w.appendChild(C),w=C;b.appendChild(d),C.textContent=e.data}if(E&&d){const e=g(d);e&&(E=e)}for(C=a,y=[],x="";C!==b&&C!==f&&null!==C;)i=p(C)?null:n(C),i&&1===C.nodeType&&z(C)&&(y.push(i),x+=C.style.cssText.substr(0,C.style.cssText.indexOf(":"))+"|"),C=C.parentNode;const o=y.pop()||l;for(w=C=o;y.length>0;)C=y.pop(),w.appendChild(C),w=C;E?((t=t.cloneNode(!1)).appendChild(o),E.insertBefore(t,E.firstChild),b.appendChild(E),_.push(t),E=null):t.appendChild(o),T=l,L=l.data.length,A=!0,!c&&u&&(t=l,l.textContent=r.zeroWidthSpace),C!==l&&C.appendChild(T)}}}(e,b),d&&!c&&!h.v)return{ancestor:e,startContainer:i,startOffset:l,endContainer:o,endOffset:s};if(c=c&&d)for(let e=0;e<_.length;e++){let t,n,i,l=_[e];if(u)t=r.createTextNode(r.zeroWidthSpace),b.replaceChild(t,l);else{const e=l.childNodes;for(n=e[0];e[0];)i=e[0],b.insertBefore(i,l);r.removeItem(l)}0===e&&(u?S=T=t:(S=n,T=i))}else{if(d)for(let e=0;e<_.length;e++)this._stripRemoveNode(_[e]);u&&(S=T=t)}r.removeEmptyNode(b,t),u&&(N=S.textContent.length,L=T.textContent.length);const M=c||0===T.textContent.length;r.isBreak(T)||0!==T.textContent.length||(r.removeItem(T),T=S),L=M?T.textContent.length:L;const H={s:0,e:0},I=r.getNodePath(S,b,H),D=!T.parentNode;D&&(T=S);const O={s:0,e:0},F=r.getNodePath(T,b,D||M?null:O);N+=H.s,L=u?N:D?S.textContent.length:M?L+H.s:L+O.s;const R=r.mergeSameTags(b,[I,F],!0);return e.parentNode.replaceChild(b,e),S=r.getNodeFromPath(I,b),T=r.getNodeFromPath(F,b),{ancestor:b,startContainer:S,startOffset:N+R[0],endContainer:T,endOffset:L+R[1]}},_nodeChange_startLine:function(e,t,n,i,l,o,s,a,c,d,u){let h=i.parentNode;for(;!(h.nextSibling||h.previousSibling||r.isFormatElement(h.parentNode)||r.isWysiwygDiv(h.parentNode))&&h.nodeName!==t.nodeName;)h=h.parentNode;if(!s&&h.nodeName===t.nodeName&&!r.isFormatElement(h)&&!h.nextSibling&&r.onlyZeroWidthSpace(i.textContent.slice(0,l))){let n=!0,o=i.previousSibling;for(;o;){if(!r.onlyZeroWidthSpace(o)){n=!1;break}o=o.previousSibling}if(n)return r.copyTagAttributes(h,t),{ancestor:e,container:i,offset:l}}a.v=!1;const g=e,p=[t],m=e.cloneNode(!1);let f,_,b,v,y=i,C=l,w=!1;if(function e(i,l){const o=i.childNodes;for(let i,s,a=0,h=o.length;a0,y=f.pop()||h;for(b=_=y;f.length>0;)_=f.pop(),b.appendChild(_),b=_;if(d(t.parentNode)&&!d(y)&&(t=t.cloneNode(!1),m.appendChild(t),p.push(t)),!v&&d(y)){t=t.cloneNode(!1);const e=y.childNodes;for(let n=0,i=e.length;n0;)_=f.pop(),b.appendChild(_),b=_;d!==l?(t.appendChild(d),l=_):l=t,r.isBreak(h)&&t.appendChild(h.cloneNode(!1)),e.appendChild(t),y=s,C=0,w=!0,l.appendChild(y)}}}(e,m),s&&!o&&!a.v)return{ancestor:e,container:i,offset:l,endContainer:u};if(o=o&&s)for(let e=0;e0&&u===h)return e.innerHTML=i.innerHTML,{ancestor:e,endContainer:n?r.getNodeFromPath(n,e):null}}o.v=!1;const a=e.cloneNode(!1),c=[t];let d=!0;if(function e(i,l){const o=i.childNodes;for(let i,u,h=0,g=o.length;h0&&(a.appendChild(t),t=t.cloneNode(!1)),u=g.cloneNode(!0),a.appendChild(u),a.appendChild(t),c.push(t),l=t,s&&g.contains(s)){const e=r.getNodePath(s,g);s=r.getNodeFromPath(e,u)}}}(e,t),d||l&&!i&&!o.v)return{ancestor:e,endContainer:s};if(a.appendChild(t),i&&l)for(let e=0;e0,u=m.pop()||a;for(_=f=u;m.length>0;)f=m.pop(),_.appendChild(f),_=f;if(d(t.parentNode)&&!d(u)&&(t=t.cloneNode(!1),p.insertBefore(t,p.firstChild),g.push(t)),!b&&d(u)){t=t.cloneNode(!1);const e=u.childNodes;for(let n=0,i=e.length;n0?f:t}else s?(t.insertBefore(u,t.firstChild),l=f):l=t;if(b&&3===a.nodeType)if(c(a)){const e=r.getParentElement(l,function(e){return this._isMaintainedNode(e.parentNode)||e.parentNode===p}.bind(r));b.appendChild(e),t=e.cloneNode(!1),g.push(t),p.insertBefore(t,p.firstChild)}else b=null}if(C||a!==v)i=C?n(a):a.cloneNode(!1),i&&(l.insertBefore(i,l.firstChild),1!==a.nodeType||r.isBreak(a)||(u=i)),e(a,u);else{b=c(a);const e=r.createTextNode(1===v.nodeType?"":v.substringData(y,v.length-y)),o=r.createTextNode(1===v.nodeType?"":v.substringData(0,y));if(b){b=b.cloneNode(!1);const e=c(l);if(e&&e.parentNode!==p){let t=e,n=null;for(;t.parentNode!==p;){for(l=n=t.parentNode.cloneNode(!1);t.childNodes[0];)n.appendChild(t.childNodes[0]);t.appendChild(n),t=t.parentNode}t.parentNode.insertBefore(e,t.parentNode.firstChild)}b=b.cloneNode(!1)}else d(t.parentNode)&&!b&&(t=t.cloneNode(!1),p.appendChild(t),g.push(t));for(r.onlyZeroWidthSpace(e)||l.insertBefore(e,l.firstChild),f=l,m=[];f!==p&&null!==f;)i=d(f)?null:n(f),i&&1===f.nodeType&&m.push(i),f=f.parentNode;const s=m.pop()||l;for(_=f=s;m.length>0;)f=m.pop(),_.appendChild(f),_=f;s!==l?(t.insertBefore(s,t.firstChild),l=f):l=t,r.isBreak(a)&&t.appendChild(a.cloneNode(!1)),b?(b.insertBefore(t,b.firstChild),p.insertBefore(b,p.firstChild),b=null):p.insertBefore(t,p.firstChild),v=o,y=o.data.length,C=!0,l.insertBefore(v,l.firstChild)}}}(e,p),s&&!o&&!a.v)return{ancestor:e,container:i,offset:l};if(o=o&&s)for(let e=0;e-1?null:r.createElement(n);let d=n;/^SUB$/i.test(n)&&a.indexOf("SUP")>-1?d="SUP":/^SUP$/i.test(n)&&a.indexOf("SUB")>-1&&(d="SUB"),this.nodeChange(c,null,[d],!1),this.focus()}},removeFormat:function(){this.nodeChange(null,null,null,null)},indent:function(e){const t=this.getRange(),n=this.getSelectedElements(null),i=[],l="indent"!==e;let o=t.startContainer,s=t.endContainer,a=t.startOffset,c=t.endOffset;for(let e,t,o=0,s=n.length;o0&&this.plugins.list.editInsideList.call(this,l,i),this.effectNode=null,this.setRange(o,a,s,c),this.history.push(!1)},toggleDisplayBlocks:function(){const t=e.element.wysiwyg;r.toggleClass(t,"se-show-block"),r.hasClass(t,"se-show-block")?r.addClass(this._styleCommandMap.showBlocks,"active"):r.removeClass(this._styleCommandMap.showBlocks,"active"),this._resourcesStateChange()},toggleCodeView:function(){const t=this._variable.isCodeView;this.controllersOff(),r.setDisabledButtons(!t,this.codeViewDisabledButtons),t?(this._setCodeDataToEditor(),e.element.wysiwygFrame.scrollTop=0,e.element.code.style.display="none",e.element.wysiwygFrame.style.display="block",this._variable._codeOriginCssText=this._variable._codeOriginCssText.replace(/(\s?display(\s+)?:(\s+)?)[a-zA-Z]+(?=;)/,"display: none"),this._variable._wysiwygOriginCssText=this._variable._wysiwygOriginCssText.replace(/(\s?display(\s+)?:(\s+)?)[a-zA-Z]+(?=;)/,"display: block"),"auto"!==l.height||l.codeMirrorEditor||(e.element.code.style.height="0px"),this._variable.isCodeView=!1,this._variable.isFullScreen||(this._notHideToolbar=!1,/balloon|balloon-always/i.test(l.mode)&&(e.element._arrow.style.display="",this._isInline=!1,this._isBalloon=!0,u._hideToolbar())),this.nativeFocus(),r.removeClass(this._styleCommandMap.codeView,"active"),this.history.push(!1)):(this._setEditorDataToCodeView(),this._variable._codeOriginCssText=this._variable._codeOriginCssText.replace(/(\s?display(\s+)?:(\s+)?)[a-zA-Z]+(?=;)/,"display: block"),this._variable._wysiwygOriginCssText=this._variable._wysiwygOriginCssText.replace(/(\s?display(\s+)?:(\s+)?)[a-zA-Z]+(?=;)/,"display: none"),"auto"!==l.height||l.codeMirrorEditor||(e.element.code.style.height=e.element.code.scrollHeight>0?e.element.code.scrollHeight+"px":"auto"),l.codeMirrorEditor&&l.codeMirrorEditor.refresh(),this._variable.isCodeView=!0,this._variable.isFullScreen||(this._notHideToolbar=!0,this._isBalloon&&(e.element._arrow.style.display="none",e.element.toolbar.style.left="",this._isInline=!0,this._isBalloon=!1,u._showToolbarInline())),this._variable._range=null,e.element.code.focus(),r.addClass(this._styleCommandMap.codeView,"active")),this._checkPlaceholder(),"function"==typeof h.toggleCodeView&&h.toggleCodeView(this._variable.isCodeView,this)},_setCodeDataToEditor:function(){const t=this._getCodeView();if(l.fullPage){const e=this._parser.parseFromString(t,"text/html"),n=e.head.children;for(let t=0,i=n.length;t0?this.convertContentsForEditor(t):"


    "},_setEditorDataToCodeView:function(){const t=this.convertHTMLForCodeView(e.element.wysiwyg);let n="";if(l.fullPage){const e=r.getAttributesToString(this._wd.body,null);n="\n\n"+this._wd.head.outerHTML.replace(/>(?!\n)/g,">\n")+"\n"+t+"\n"}else n=t;e.element.code.style.display="block",e.element.wysiwygFrame.style.display="none",this._setCodeView(n)},toggleFullScreen:function(t){const n=e.element.topArea,i=e.element.toolbar,o=e.element.editorArea,d=e.element.wysiwygFrame,g=e.element.code,p=this._variable;this.controllersOff(),p.isFullScreen?(p.isFullScreen=!1,d.style.cssText=p._wysiwygOriginCssText,g.style.cssText=p._codeOriginCssText,i.style.cssText="",o.style.cssText=p._editorAreaOriginCssText,n.style.cssText=p._originCssText,s.body.style.overflow=p._bodyOverflow,l.toolbarContainer&&l.toolbarContainer.appendChild(i),l.stickyToolbar>-1&&r.removeClass(i,"se-toolbar-sticky"),p._fullScreenAttrs.sticky&&!l.toolbarContainer&&(p._fullScreenAttrs.sticky=!1,e.element._stickyDummy.style.display="block",r.addClass(i,"se-toolbar-sticky")),this._isInline=p._fullScreenAttrs.inline,this._isBalloon=p._fullScreenAttrs.balloon,this._isInline&&u._showToolbarInline(),l.toolbarContainer&&r.removeClass(i,"se-toolbar-balloon"),u.onScroll_window(),r.changeElement(t.firstElementChild,c.expansion),r.removeClass(this._styleCommandMap.fullScreen,"active")):(p.isFullScreen=!0,p._fullScreenAttrs.inline=this._isInline,p._fullScreenAttrs.balloon=this._isBalloon,(this._isInline||this._isBalloon)&&(this._isInline=!1,this._isBalloon=!1),l.toolbarContainer&&e.element.relative.insertBefore(i,o),n.style.position="fixed",n.style.top="0",n.style.left="0",n.style.width="100%",n.style.maxWidth="100%",n.style.height="100%",n.style.zIndex="2147483647",""!==e.element._stickyDummy.style.display&&(p._fullScreenAttrs.sticky=!0,e.element._stickyDummy.style.display="none",r.removeClass(i,"se-toolbar-sticky")),p._bodyOverflow=s.body.style.overflow,s.body.style.overflow="hidden",p._editorAreaOriginCssText=o.style.cssText,p._wysiwygOriginCssText=d.style.cssText,p._codeOriginCssText=g.style.cssText,o.style.cssText=i.style.cssText="",d.style.cssText=(d.style.cssText.match(/\s?display(\s+)?:(\s+)?[a-zA-Z]+;/)||[""])[0],g.style.cssText=(g.style.cssText.match(/\s?display(\s+)?:(\s+)?[a-zA-Z]+;/)||[""])[0],i.style.width=d.style.height=g.style.height="100%",i.style.position="relative",i.style.display="block",p.innerHeight_fullScreen=a.innerHeight-i.offsetHeight,o.style.height=p.innerHeight_fullScreen+"px",r.changeElement(t.firstElementChild,c.reduction),l.iframe&&"auto"===l.height&&(o.style.overflow="auto",this._iframeAutoHeight()),r.addClass(this._styleCommandMap.fullScreen,"active")),"function"==typeof h.toggleFullScreen&&h.toggleFullScreen(this._variable.isFullScreen,this)},print:function(){const e=r.createElement("IFRAME");e.style.display="none",s.body.appendChild(e);const t=r.getIframeDocument(e),n=this.getContents(!0),i=this._wd;if(l.iframe){const e=l.fullPage?r.getAttributesToString(i.body,["contenteditable"]):'class="sun-editor-editable"';t.write(""+i.head.innerHTML+""+n+"")}else{const e=s.head.getElementsByTagName("link"),i=s.head.getElementsByTagName("style");let l="";for(let t=0,n=e.length;t"+l+''+n+"")}this.showLoading(),a.setTimeout((function(){try{if(e.focus(),r.isIE_Edge||s.documentMode||a.StyleMedia)try{e.contentWindow.document.execCommand("print",!1,null)}catch(t){e.contentWindow.print()}else e.contentWindow.print()}catch(e){throw Error("[SUNEDITOR.core.print.fail] error: "+e)}finally{d.closeLoading(),r.removeItem(e)}}),1e3)},preview:function(){d.submenuOff(),d.containerOff(),d.controllersOff();const t=this.getContents(!0),n=a.open("","_blank");n.mimeType="text/html";const o=e.element.wysiwygFrame.offsetWidth+"px !important",c=this._wd;if(l.iframe){const e=l.fullPage?r.getAttributesToString(c.body,["contenteditable"]):'class="sun-editor-editable"';n.document.write(""+c.head.innerHTML+""+t+"")}else{const e=s.head.getElementsByTagName("link"),l=s.head.getElementsByTagName("style");let a="";for(let t=0,n=e.length;t'+i.toolbar.preview+""+a+''+t+"")}},setContents:function(t){const n=this.convertContentsForEditor(t);if(this._resetComponents(),this._variable.isCodeView){const e=this.convertHTMLForCodeView(n);this._setCodeView(e)}else e.element.wysiwyg.innerHTML=n,this.history.push(!1)},getContents:function(t){const n=e.element.wysiwyg.innerHTML,i=r.createElement("DIV");i.innerHTML=n;const o=r.getListChildren(i,(function(e){return/FIGCAPTION/i.test(e.nodeName)}));for(let e=0,t=o.length;e"+this._wd.head.outerHTML+""+i.innerHTML+""}return i.innerHTML},_makeLine:function(e,t){if(1===e.nodeType)return r._disallowedTags(e)?"":!t||r.isFormatElement(e)||r.isRangeFormatElement(e)||r.isComponent(e)||r.isMedia(e)||r.isAnchor(e)&&r.isMedia(e.firstElementChild)?e.outerHTML:"

    "+e.outerHTML+"

    ";if(3===e.nodeType){if(!t)return e.textContent;const n=e.textContent.split(/\n/g);let i="";for(let e,t=0,l=n.length;t0&&(i+="

    "+e+"

    ");return i}return 8===e.nodeType&&this._allowHTMLComments?"\x3c!--"+e.textContent.trim()+"--\x3e":""},_tagConvertor:function(e){if(!this._disallowedTextTagsRegExp)return e;const t={b:"strong",i:"em",ins:"u",strike:"del",s:"del"};return e.replace(this._disallowedTextTagsRegExp,(function(e,n,i){return n+("string"==typeof t[i]?t[i]:i)}))},_deleteDisallowedTags:function(e){return e.replace(/\n/g,"").replace(/<(script|style).*>(\n|.)*<\/(script|style)>/gi,"").replace(/<[a-z0-9]+\:[a-z0-9]+[^>^\/]*>[^>]*<\/[a-z0-9]+\:[a-z0-9]+>/gi,"").replace(this.editorTagsWhitelistRegExp,"")},cleanHTML:function(e,t){e=this._deleteDisallowedTags(e).replace(/(<[a-zA-Z0-9]+)[^>]*(?=>)/g,function(e,t){if(/^<[a-z0-9]+\:[a-z0-9]+/i.test(e))return e;let n=null;const i=this._attributesTagsWhitelist[t.match(/(?!<)[a-zA-Z0-9]+/)[0].toLowerCase()];if(n=i?e.match(i):e.match(this._attributesWhitelistRegExp),/

    ":(i=r.htmlRemoveWhiteSpace(i),this._tagConvertor(i))},convertHTMLForCodeView:function(e){let t="";const n=a.RegExp,i=new n("^(BLOCKQUOTE|PRE|TABLE|THEAD|TBODY|TR|TH|TD|OL|UL|IMG|IFRAME|VIDEO|AUDIO|FIGURE|FIGCAPTION|HR|BR|CANVAS|SELECT)$","i"),l=r.isFormatElement.bind(r),o="string"==typeof e?s.createRange().createContextualFragment(e):e;let c=1*this._variable.codeIndent;return c=c>0?new a.Array(c+1).join(" "):"",function e(o,s,a){const d=o.childNodes,u=i.test(o.nodeName),h=u?s:"";for(let g,p,m,f=0,_=d.length;f<_;f++){if(g=d[f],m=i.test(g.nodeName),p=m?"\n":"",a=!l(g)||u||/^(TH|TD)$/i.test(o.nodeName)?"":"\n",8===g.nodeType){t+="\n\x3c!-- "+g.textContent.trim()+" --\x3e"+p;continue}if(3===g.nodeType){t+=r._HTMLConvertor(/^\n+$/.test(g.data)?"":g.data);continue}if(0===g.childNodes.length){t+=(/^HR$/i.test(g.nodeName)?"\n":"")+h+g.outerHTML+p;continue}g.innerHTML=g.innerHTML;const _=g.nodeName.toLowerCase();t+=(a||(u?"":p))+(h||m?s:"")+g.outerHTML.match(n("<"+_+"[^>]*>","i"))[0]+p,e(g,s+c,""),t+=(m?s:"")+""+(a||p||u||/^(TH|TD)$/i.test(g.nodeName)?"\n":"")}}(o,"","\n"),t.trim()+"\n"},addDocEvent:function(e,t,n){s.addEventListener(e,t,n),l.iframe&&this._wd.addEventListener(e,t)},removeDocEvent:function(e,t){s.removeEventListener(e,t),l.iframe&&this._wd.removeEventListener(e,t)},_charCount:function(e){const t=l.maxCharCount,n=l.charCounterType;let i=0;if(e&&(i=this.getCharLength(e,n)),this._setCharCount(),t>0){let e=!1;const l=h.getCharCount(n);if(l>t){if(e=!0,i>0){this._editorRange();const e=this.getRange(),n=e.endOffset-1,i=this.getSelectionNode().textContent,o=e.endOffset-(l-t);this.getSelectionNode().textContent=i.slice(0,o<0?0:o)+i.slice(e.endOffset,i.length),this.setRange(e.endContainer,n,e.endContainer,n)}}else l+i>t&&(e=!0);if(e&&(this._callCounterBlink(),i>0))return!1}return!0},checkCharCount:function(e,t){if(l.maxCharCount){const n=t||l.charCounterType,i=this.getCharLength("string"==typeof e?e:this._charTypeHTML?e.outerHTML:e.textContent,n);if(i>0&&i+h.getCharCount(n)>l.maxCharCount)return this._callCounterBlink(),!1}return!0},getCharLength:function(e,t){return/byte/.test(t)?r.getByteLength(e):e.length},_setCharCount:function(){e.element.charCounter&&a.setTimeout((function(){e.element.charCounter.textContent=h.getCharCount(l.charCounterType)}))},_callCounterBlink:function(){const t=e.element.charWrapper;t&&!r.hasClass(t,"se-blink")&&(r.addClass(t,"se-blink"),a.setTimeout((function(){r.removeClass(t,"se-blink")}),600))},_checkComponents:function(){for(let e=0,t=this._fileInfoPluginsCheck.length;e^<]+)?\\s*(?=>)","gi");const h="contenteditable|colspan|rowspan|target|href|src|class|type|controls|data-format|data-size|data-file-size|data-file-name|data-origin|data-align|data-image-link|data-rotate|data-proportion|data-percentage|origin-size|data-exp|data-font-size";this._allowHTMLComments=l._editorTagsWhitelist.indexOf("//")>-1,this._htmlCheckWhitelistRegExp=new c("^("+l._editorTagsWhitelist.replace("|//","")+")$","i"),this.editorTagsWhitelistRegExp=r.createTagsWhitelist(l._editorTagsWhitelist.replace("|//","|\x3c!--|--\x3e")),this.pasteTagsWhitelistRegExp=r.createTagsWhitelist(l.pasteTagsWhitelist);const g=l.attributesWhitelist,p={};let m="";if(g)for(let e in g)r.hasOwn(g,e)&&("all"===e?m=g[e]+"|":p[e]=new c("((?:"+g[e]+"|"+h+')s*=s*"[^"]*")',"ig"));this._attributesWhitelistRegExp=new c("((?:"+m+h+')s*=s*"[^"]*")',"ig"),this._attributesTagsWhitelist=p,this._isInline=/inline/i.test(l.mode),this._isBalloon=/balloon|balloon-always/i.test(l.mode),this._isBalloonAlways=/balloon-always/i.test(l.mode),this._cachingButtons(),this._fileInfoPluginsCheck=[],this._fileInfoPluginsReset=[],this.managedTagsInfo={query:"",map:{}};const f=[];this.activePlugins=[],this._fileManager.tags=[],this._fileManager.pluginMap={};let _,b,v=[];for(let e in n)if(r.hasOwn(n,e)){if(_=n[e],b=t[e],_.active&&b&&this.callPlugin(e,null,b),"function"==typeof _.checkFileInfo&&"function"==typeof _.resetFileInfo&&(this.callPlugin(e,null,b),this._fileInfoPluginsCheck.push(_.checkFileInfo.bind(this)),this._fileInfoPluginsReset.push(_.resetFileInfo.bind(this))),a.Array.isArray(_.fileTags)){const t=_.fileTags;this.callPlugin(e,null,b),this._fileManager.tags=this._fileManager.tags.concat(t),v.push(e);for(let n=0,i=t.length;nc&&(d=d.slice(0,c),a&&a.setAttribute("disabled",!0)),d[c]=l?{contents:n,s:{path:i.getNodePath(l.startContainer,null,null),offset:l.startOffset},e:{path:i.getNodePath(l.endContainer,null,null),offset:l.endOffset}}:{contents:n,s:{path:[0,0],offset:[0,0]},e:{path:0,offset:0}},1===c&&s&&s.removeAttribute("disabled"),e._setCharCount(),t()}return{stack:d,push:function(t){n.setTimeout(e._resourcesStateChange.bind(e));const i="number"==typeof t?t>0?t:0:t?l:0;i&&!r||(n.clearTimeout(r),i)?r=n.setTimeout((function(){n.clearTimeout(r),r=null,h()}),i):h()},undo:function(){c>0&&(c--,u())},redo:function(){d.length-1>c&&(c++,u())},go:function(e){c=e<0?d.length-1:e,u()},reset:function(n){s&&s.setAttribute("disabled",!0),a&&a.setAttribute("disabled",!0),e.context.tool.save&&e.context.tool.save.setAttribute("disabled",!0),d.splice(0),c=0,d[c]={contents:e.getContents(!0),s:{path:[0,0],offset:0},e:{path:[0,0],offset:0}},n||t()},_resetCachingButton:function(){o=e.context.element,s=e.context.tool.undo,a=e.context.tool.redo,0===c?(s&&s.setAttribute("disabled",!0),a&&c===d.length-1&&a.setAttribute("disabled",!0),e.context.tool.save&&e.context.tool.save.setAttribute("disabled",!0)):c===d.length-1&&a&&a.setAttribute("disabled",!0)},_destroy:function(){r&&n.clearTimeout(r),d=null}}}(this,this._onChange_historyStack.bind(this)),this.addModule([A]),l.iframe&&(this._wd=e.element.wysiwygFrame.contentDocument,e.element.wysiwyg=this._wd.body,l._editorStyles.editor&&(e.element.wysiwyg.style.cssText=l._editorStyles.editor),"auto"===l.height&&(this._iframeAuto=this._wd.body)),this._initWysiwygArea(i,o)},_cachingButtons:function(){this.codeViewDisabledButtons=e.element.toolbar.querySelectorAll('.se-toolbar button:not([class~="se-code-view-enabled"])'),this.resizingDisabledButtons=e.element.toolbar.querySelectorAll('.se-toolbar button:not([class~="se-resizing-enabled"])');const t=e.tool;this.commandMap={STRONG:t.bold,U:t.underline,EM:t.italic,DEL:t.strike,SUB:t.subscript,SUP:t.superscript,OUTDENT:t.outdent,INDENT:t.indent},this._styleCommandMap={fullScreen:t.fullScreen,showBlocks:t.showBlocks,codeView:t.codeView}},_initWysiwygArea:function(t,n){e.element.wysiwyg.innerHTML=t?n:this.convertContentsForEditor("string"==typeof n?n:e.element.originElement.value)},_resourcesStateChange:function(){this._iframeAutoHeight(),this._checkPlaceholder()},_onChange_historyStack:function(){u._applyTagEffects(),e.tool.save&&e.tool.save.removeAttribute("disabled"),h.onChange&&h.onChange(this.getContents(!0),this)},_iframeAutoHeight:function(){this._iframeAuto&&a.setTimeout((function(){e.element.wysiwygFrame.style.height=d._iframeAuto.offsetHeight+"px"}))},_checkPlaceholder:function(){if(this._placeholder){if(this._variable.isCodeView)return void(this._placeholder.style.display="none");const t=e.element.wysiwyg;!r.onlyZeroWidthSpace(t.textContent)||t.querySelector(".se-component, pre, blockquote, hr, li, table, img, iframe, video")||(t.innerText.match(/\n/g)||"").length>1?this._placeholder.style.display="none":this._placeholder.style.display="block"}},_setDefaultFormat:function(e){if(this._fileManager.pluginRegExp.test(this.currentControllerName))return;const t=this.getRange(),n=t.commonAncestorContainer,i=t.startContainer,l=r.getRangeFormatElement(n,null);let o,s,a;const c=r.getParentElement(n,r.isComponent);if((!c||r.isTable(c))&&(!r.isRangeFormatElement(i)&&!r.isWysiwygDiv(i)||!r.isComponent(i.childNodes[t.startOffset]))){if(l)return a=r.createElement(e||"P"),a.innerHTML=l.innerHTML,0===a.childNodes.length&&(a.innerHTML=r.zeroWidthSpace),l.innerHTML=a.outerHTML,a=l.firstChild,o=r.getEdgeChildNodes(a,null).sc,o||(o=r.createTextNode(r.zeroWidthSpace),a.insertBefore(o,a.firstChild)),s=o.textContent.length,void this.setRange(o,s,o,s);if(r.isRangeFormatElement(n)&&n.childNodes.length<=1){let e=null;return 1===n.childNodes.length&&r.isBreak(n.firstChild)?e=n.firstChild:(e=r.createTextNode(r.zeroWidthSpace),n.appendChild(e)),void this.setRange(e,1,e,1)}if(this.execCommand("formatBlock",!1,e||"P"),o=r.getEdgeChildNodes(n,n),o=o?o.ec:n,a=r.getFormatElement(o,null),!a)return this.removeRange(),void this._editorRange();if(r.isBreak(a.nextSibling)&&r.removeItem(a.nextSibling),r.isBreak(a.previousSibling)&&r.removeItem(a.previousSibling),r.isBreak(o)){const e=r.createTextNode(r.zeroWidthSpace);o.parentNode.insertBefore(e,o),o=e}this.effectNode=null,this.nativeFocus()}},_setOptionsInit:function(t,n){this.context=e=k(t.originElement,this._getConstructed(t),l),this._componentsInfoReset=!0,this._editorInit(!0,n)},_editorInit:function(t,n){this._init(t,n),u._addEvent(),this._setCharCount(),u._offStickyToolbar(),u.onResize_window(),e.element.toolbar.style.visibility="",this._checkComponents(),this._componentsInfoInit=!1,this._componentsInfoReset=!1,this.history.reset(!0),this._resourcesStateChange(),a.setTimeout((function(){"function"==typeof h.onload&&h.onload(d,t)}))},_getConstructed:function(e){return{_top:e.topArea,_relative:e.relative,_toolBar:e.toolbar,_menuTray:e._menuTray,_editorArea:e.editorArea,_wysiwygArea:e.wysiwygFrame,_codeArea:e.code,_placeholder:e.placeholder,_resizingBar:e.resizingBar,_navigation:e.navigation,_charCounter:e.charCounter,_charWrapper:e.charWrapper,_loading:e.loading,_lineBreaker:e.lineBreaker,_lineBreaker_t:e.lineBreaker_t,_lineBreaker_b:e.lineBreaker_b,_resizeBack:e.resizeBackground,_stickyDummy:e._stickyDummy,_arrow:e._arrow}}},u={_IEisComposing:!1,_lineBreakerBind:null,_responsiveCurrentSize:"default",_responsiveButtonSize:null,_responsiveButtons:null,_directionKeyCode:new a.RegExp("^(8|13|3[2-9]|40|46)$"),_nonTextKeyCode:new a.RegExp("^(8|13|1[6-9]|20|27|3[3-9]|40|45|46|11[2-9]|12[0-3]|144|145)$"),_historyIgnoreKeyCode:new a.RegExp("^(1[6-9]|20|27|3[3-9]|40|45|11[2-9]|12[0-3]|144|145)$"),_onButtonsCheck:new a.RegExp("^(STRONG|U|EM|DEL|SUB|SUP)$"),_frontZeroWidthReg:new a.RegExp(r.zeroWidthSpace+"+",""),_keyCodeShortcut:{65:"A",66:"B",83:"S",85:"U",73:"I",89:"Y",90:"Z",219:"[",221:"]"},_shortcutCommand:function(e,t){let n=null;switch(u._keyCodeShortcut[e]){case"A":n="selectAll";break;case"B":-1===l.shortcutsDisable.indexOf("bold")&&(n="STRONG");break;case"S":t&&-1===l.shortcutsDisable.indexOf("strike")&&(n="DEL");break;case"U":-1===l.shortcutsDisable.indexOf("underline")&&(n="U");break;case"I":-1===l.shortcutsDisable.indexOf("italic")&&(n="EM");break;case"Z":-1===l.shortcutsDisable.indexOf("undo")&&(n=t?"redo":"undo");break;case"Y":-1===l.shortcutsDisable.indexOf("undo")&&(n="redo");break;case"[":-1===l.shortcutsDisable.indexOf("indent")&&(n="outdent");break;case"]":-1===l.shortcutsDisable.indexOf("indent")&&(n="indent")}return!!n&&(d.commandHandler(d.commandMap[n],n),!0)},_applyTagEffects:function(){let t=d.getSelectionNode();if(t===d.effectNode)return;d.effectNode=t;const i=d.commandMap,o=this._onButtonsCheck,s=[],a=[],c=d.activePlugins,u=c.length;let h="";for(;t.firstChild;)t=t.firstChild;for(let e=t;!r.isWysiwygDiv(e)&&e;e=e.parentNode)if(1===e.nodeType&&!r.isBreak(e)){h=e.nodeName.toUpperCase(),a.push(h);for(let t,i=0;i0)&&(s.push("OUTDENT"),i.OUTDENT.removeAttribute("disabled")),-1===s.indexOf("INDENT")&&i.INDENT&&r.isListCell(e)&&!e.previousElementSibling&&(s.push("INDENT"),i.INDENT.setAttribute("disabled",!0))):o.test(h)&&(s.push(h),r.addClass(i[h],"active"))}for(let e in i)s.indexOf(e)>-1||!r.hasOwn(i,e)||(c.indexOf(e)>-1?n[e].active.call(d,null):i.OUTDENT&&/^OUTDENT$/i.test(e)?i.OUTDENT.setAttribute("disabled",!0):i.INDENT&&/^INDENT$/i.test(e)?i.INDENT.removeAttribute("disabled"):r.removeClass(i[e],"active"));d._variable.currentNodes=a.reverse(),d._variable.currentNodesMap=s,l.showPathLabel&&(e.element.navigation.textContent=d._variable.currentNodes.join(" > "))},_cancelCaptionEdit:function(){this.setAttribute("contenteditable",!1),this.removeEventListener("blur",u._cancelCaptionEdit)},_buttonsEventHandler:function(e){let t=e.target;if(d._bindControllersOff&&e.stopPropagation(),/^(input|textarea|select|option)$/i.test(t.nodeName)?d._antiBlur=!1:e.preventDefault(),r.getParentElement(t,".se-submenu"))e.stopPropagation(),d._notHideToolbar=!0;else{let n=t.getAttribute("data-command"),i=t.className;for(;!n&&!/se-menu-list/.test(i)&&!/sun-editor-common/.test(i);)t=t.parentNode,n=t.getAttribute("data-command"),i=t.className;n!==d._submenuName&&n!==d._containerName||e.stopPropagation()}},onClick_toolbar:function(e){let t=e.target,n=t.getAttribute("data-display"),i=t.getAttribute("data-command"),l=t.className;for(;t.parentNode&&!i&&!/se-menu-list/.test(l)&&!/se-toolbar/.test(l);)t=t.parentNode,i=t.getAttribute("data-command"),n=t.getAttribute("data-display"),l=t.className;(i||n)&&(t.disabled||(d.hasFocus||d.nativeFocus(),d._variable.isCodeView||d._editorRange(),d.actionCall(i,n,t)))},onMouseDown_wysiwyg:function(t){if(r.isNonEditable(e.element.wysiwyg))return;const n=r.getParentElement(t.target,r.isCell);if(n){const e=d.plugins.table;e&&n!==e._fixedCell&&!e._shift&&d.callPlugin("table",(function(){e.onTableCellMultiSelect.call(d,n,!1)}),null)}d._isBalloon&&u._hideToolbar(),/FIGURE/i.test(t.target.nodeName)&&t.preventDefault(),"function"==typeof h.onMouseDown&&h.onMouseDown(t,d)},onClick_wysiwyg:function(t){const n=t.target;if(r.isNonEditable(e.element.wysiwyg))return;const i=d.getFileComponent(n);if(i)return t.preventDefault(),void d.selectComponent(i.target,i.pluginName);const l=r.getParentElement(n,"FIGCAPTION");if(r.isNonEditable(l)&&(t.preventDefault(),l.setAttribute("contenteditable",!0),l.focus(),d._isInline&&!d._inlineToolbarAttr.isShow)){u._showToolbarInline();const e=function(){u._hideToolbar(),l.removeEventListener("blur",e)};l.addEventListener("blur",e)}a.setTimeout(d._editorRange.bind(d)),d._editorRange();const o=d.getSelectionNode(),s=r.getFormatElement(o,null),c=r.getRangeFormatElement(o,null);if(s&&s!==c||r.isNonEditable(n)||r.isList(c))u._applyTagEffects();else{const e=d.getRange();if(r.getFormatElement(e.startContainer)===r.getFormatElement(e.endContainer)){if(r.isList(c)){const e=r.createElement("LI"),t=o.nextElementSibling;e.appendChild(o),c.insertBefore(e,t)}else r.isWysiwygDiv(o)||r.isComponent(o)||r.isTable(o)&&!r.isCell(o)||d._setDefaultFormat(r.isRangeFormatElement(c)?"DIV":"P");t.preventDefault(),d.focus()}}d._isBalloon&&a.setTimeout(u._toggleToolbarBalloon),"function"==typeof h.onClick&&h.onClick(t,d)},_balloonDelay:null,_showToolbarBalloonDelay:function(){u._balloonDelay&&a.clearTimeout(u._balloonDelay),u._balloonDelay=a.setTimeout(function(){a.clearTimeout(this._balloonDelay),this._balloonDelay=null,this._showToolbarBalloon()}.bind(u),350)},_toggleToolbarBalloon:function(){d._editorRange();const e=d.getRange();d._bindControllersOff||!d._isBalloonAlways&&e.collapsed?u._hideToolbar():u._showToolbarBalloon(e)},_showToolbarBalloon:function(t){if(!d._isBalloon)return;const n=t||d.getRange(),i=e.element.toolbar,l=d.getSelection();let o;if(d._isBalloonAlways&&n.collapsed)o=!0;else if(l.focusNode===l.anchorNode)o=l.focusOffset0&&u._getPageBottomSpace()C&&(t=!1,y=!0),y&&(b=(t?n.top-m-g:n.bottom+g)-(n.noText?0:h)+d),i.style.left=a.Math.floor(v)+"px",i.style.top=a.Math.floor(b)+"px",t?(r.removeClass(e.element._arrow,"se-arrow-up"),r.addClass(e.element._arrow,"se-arrow-down"),e.element._arrow.style.top=m+"px"):(r.removeClass(e.element._arrow,"se-arrow-down"),r.addClass(e.element._arrow,"se-arrow-up"),e.element._arrow.style.top=-g+"px");const w=a.Math.floor(p/2+(f-v));e.element._arrow.style.left=(w+g>i.offsetWidth?i.offsetWidth-g:w";const e=f.attributes;for(;e[0];)f.removeAttribute(e[0].name);return d.nativeFocus(),!1}}if(f&&g.startContainer===g.endContainer&&3===c.nodeType&&!r.isFormatElement(c.parentNode)&&(g.collapsed?1===c.textContent.length:g.endOffset-g.startOffset===c.textContent.length)){t.preventDefault();let e=null,n=c.parentNode.previousSibling;const i=c.parentNode.nextSibling;n||(i?(n=i,e=0):(n=r.createElement("BR"),f.appendChild(n))),c.textContent="",r.removeItemAllParents(c,null,f),e="number"==typeof e?e:3===n.nodeType?n.textContent.length:1,d.setRange(n,e,n,e);break}const n=g.commonAncestorContainer;if(f=r.getFormatElement(g.startContainer,null),_=r.getRangeFormatElement(f,null),_&&f&&!r.isCell(_)&&!/^FIGCAPTION$/i.test(_.nodeName)){if(r.isListCell(f)&&r.isList(_)&&(r.isListCell(_.parentNode)||f.previousElementSibling)&&(c===f||3===c.nodeType&&(!c.previousSibling||r.isList(c.previousSibling)))&&(r.getFormatElement(g.startContainer,null)!==r.getFormatElement(g.endContainer,null)?_.contains(g.startContainer):0===g.startOffset&&g.collapsed)){if(g.startContainer!==g.endContainer)t.preventDefault(),d.removeNode(),3===g.startContainer.nodeType&&d.setRange(g.startContainer,g.startContainer.textContent.length,g.startContainer,g.startContainer.textContent.length),d.history.push(!0);else{let e=f.previousElementSibling||_.parentNode;if(r.isListCell(e)){t.preventDefault();let n=e;if(!e.contains(f)&&r.isListCell(n)&&r.isList(n.lastElementChild)){for(n=n.lastElementChild.lastElementChild;r.isListCell(n)&&r.isList(n.lastElementChild);)n=n.lastElementChild&&n.lastElementChild.lastElementChild;e=n}let i=e===_.parentNode?_.previousSibling:e.lastChild;i||(i=r.createTextNode(r.zeroWidthSpace),_.parentNode.insertBefore(i,_.parentNode.firstChild));const l=3===i.nodeType?i.textContent.length:1,o=f.childNodes;let s=i,a=o[0];for(;a=o[0];)e.insertBefore(a,s.nextSibling),s=a;r.removeItem(f),0===_.children.length&&r.removeItem(_),d.setRange(i,l,i,l),d.history.push(!0)}}break}if(!p&&0===g.startOffset){let e=!0,i=n;for(;i&&i!==_&&!r.isWysiwygDiv(i);){if(i.previousSibling&&(1===i.previousSibling.nodeType||!r.onlyZeroWidthSpace(i.previousSibling.textContent.trim()))){e=!1;break}i=i.parentNode}if(e&&_.parentNode){t.preventDefault(),d.detachRangeFormatElement(_,r.isListCell(f)?[f]:null,null,!1,!1),d.history.push(!0);break}}}if(!p&&(0===g.startOffset||c===f&&f.childNodes[g.startOffset])){const e=c===f?f.childNodes[g.startOffset]:c,i=(3===n.nodeType||r.isBreak(n))&&!n.previousSibling&&0===g.startOffset;if(!e.previousSibling&&(r.isComponent(n.previousSibling)||i&&r.isComponent(f.previousSibling))){const e=d.getFileComponent(f.previousSibling);e&&(t.preventDefault(),t.stopPropagation(),0===f.textContent.length&&r.removeItem(f),d.selectComponent(e.target,e.pluginName));break}if(r.isNonEditable(e.previousSibling)){t.preventDefault(),t.stopPropagation(),r.removeItem(e.previousSibling);break}}break;case 46:if(m){t.preventDefault(),t.stopPropagation(),d.plugins[m].destroy.call(d);break}if(p&&u._hardDelete()){t.preventDefault(),t.stopPropagation();break}if((r.isFormatElement(c)||null===c.nextSibling||r.onlyZeroWidthSpace(c.nextSibling)&&null===c.nextSibling.nextSibling)&&g.startOffset===c.textContent.length){let e=f.nextElementSibling;if(!e){t.preventDefault();break}if(r.isComponent(e)){if(t.preventDefault(),r.onlyZeroWidthSpace(f)&&(r.removeItem(f),r.isTable(e))){let t=r.getChildElement(e,r.isCell,!1);t=t.firstElementChild||t,d.setRange(t,0,t,0);break}const n=d.getFileComponent(e);n&&(t.stopPropagation(),d.selectComponent(n.target,n.pluginName));break}}if(!p&&(d.isEdgePoint(g.endContainer,g.endOffset)||c===f&&f.childNodes[g.startOffset])){const e=c===f?f.childNodes[g.startOffset]:c;if(r.isNonEditable(e.nextSibling)){t.preventDefault(),t.stopPropagation(),r.removeItem(e.nextSibling);break}}if(f=r.getFormatElement(g.startContainer,null),_=r.getRangeFormatElement(f,null),r.isListCell(f)&&r.isList(_)&&(c===f||3===c.nodeType&&(!c.nextSibling||r.isList(c.nextSibling))&&(r.getFormatElement(g.startContainer,null)!==r.getFormatElement(g.endContainer,null)?_.contains(g.endContainer):g.endOffset===c.textContent.length&&g.collapsed))){g.startContainer!==g.endContainer&&d.removeNode();let e=r.getArrayItem(f.children,r.isList,!1);if(e=e||f.nextElementSibling||_.parentNode.nextElementSibling,e&&(r.isList(e)||r.getArrayItem(e.children,r.isList,!1))){let n,i;if(t.preventDefault(),r.isList(e)){const t=e.firstElementChild;for(i=t.childNodes,n=i[0];i[0];)f.insertBefore(i[0],e);r.removeItem(t)}else{for(n=e.firstChild,i=e.childNodes;i[0];)f.appendChild(i[0]);r.removeItem(e)}d.setRange(n,0,n,0),d.history.push(!0)}break}break;case 9:if(m||l.tabDisable)break;if(t.preventDefault(),o||s||r.isWysiwygDiv(c))break;const b=!g.collapsed||d.isEdgePoint(g.startContainer,g.startOffset),v=d.getSelectedElements(null);c=d.getSelectionNode();const y=[];let C=[],w=r.isListCell(v[0]),x=r.isListCell(v[v.length-1]),E={sc:g.startContainer,so:g.startOffset,ec:g.endContainer,eo:g.endOffset};for(let e,t=0,n=v.length;t0&&b&&d.plugins.list)E=d.plugins.list.editInsideList.call(d,i,y);else{const e=r.getParentElement(c,r.isCell);if(e&&b){const t=r.getParentElement(e,"table"),n=r.getListChildren(t,r.isCell);let l=i?r.prevIdx(n,e):r.nextIdx(n,e);l!==n.length||i||(l=0),-1===l&&i&&(l=n.length-1);let o=n[l];if(!o)break;o=o.firstElementChild||o,d.setRange(o,0,o,0);break}C=C.concat(y),w=x=null}if(C.length>0)if(i){const e=C.length-1;for(let t,n=0;n<=e;n++){t=C[n].childNodes;for(let e,n=0,i=t.length;n":"<"+f.nodeName+">
    ",!d.checkCharCount(e,"byte-html"))return t.preventDefault(),!1}if(!i&&S){t.preventDefault();const e=c===S,n=d.getSelection(),i=c.childNodes,l=n.focusOffset,o=c.previousElementSibling,s=c.nextSibling;if(!r.isClosureFreeFormatElement(S)&&i&&(e&&g.collapsed&&i.length-1<=l+1&&r.isBreak(i[l])&&(!i[l+1]||(!i[l+2]||r.onlyZeroWidthSpace(i[l+2].textContent))&&3===i[l+1].nodeType&&r.onlyZeroWidthSpace(i[l+1].textContent))&&l>0&&r.isBreak(i[l-1])||!e&&r.onlyZeroWidthSpace(c.textContent)&&r.isBreak(o)&&(r.isBreak(o.previousSibling)||!r.onlyZeroWidthSpace(o.previousSibling.textContent))&&(!s||!r.isBreak(s)&&r.onlyZeroWidthSpace(s.textContent)))){e?r.removeItem(i[l-1]):r.removeItem(c);const t=d.appendFormatTag(S,r.isFormatElement(S.nextElementSibling)?S.nextElementSibling:null);r.copyFormatAttributes(t,S),d.setRange(t,1,t,1);break}if(e){h.insertHTML(g.collapsed&&r.isBreak(g.startContainer.childNodes[g.startOffset-1])?"
    ":"

    ",!0,!1);let e=n.focusNode;const t=n.focusOffset;S===e&&(e=e.childNodes[t-l>1?t-1:t]),d.setRange(e,1,e,1)}else{const e=n.focusNode.nextSibling,t=r.createElement("BR");d.insertNode(t,null,!1);const i=t.previousSibling,l=t.nextSibling;r.isBreak(e)||r.isBreak(i)||l&&!r.onlyZeroWidthSpace(l)?d.setRange(l,0,l,0):(t.parentNode.insertBefore(t.cloneNode(!1),t),d.setRange(t,1,t,1))}u._onShortcutKey=!0;break}if(p)break;if(_&&f&&!r.isCell(_)&&!/^FIGCAPTION$/i.test(_.nodeName)){const e=d.getRange();if(d.isEdgePoint(e.endContainer,e.endOffset)&&r.isList(c.nextSibling)){t.preventDefault();const e=r.createElement("LI"),n=r.createElement("BR");e.appendChild(n),f.parentNode.insertBefore(e,f.nextElementSibling),e.appendChild(c.nextSibling),d.setRange(n,1,n,1);break}if((3!==e.commonAncestorContainer.nodeType||!e.commonAncestorContainer.nextElementSibling)&&r.onlyZeroWidthSpace(f.innerText.trim())){t.preventDefault();let e=null;if(r.isListCell(_.parentNode)){if(_=f.parentNode.parentNode.parentNode,e=r.splitElement(f,null,r.getElementDepth(f)-2),!e){const t=r.createElement("LI");t.innerHTML="
    ",_.insertBefore(t,e),e=t}}else{const t=r.isCell(_.parentNode)?"DIV":r.isList(_.parentNode)?"LI":r.isFormatElement(_.nextElementSibling)?_.nextElementSibling.nodeName:r.isFormatElement(_.previousElementSibling)?_.previousElementSibling.nodeName:"P";e=r.createElement(t);const n=d.detachRangeFormatElement(_,[f],null,!0,!0);n.cc.insertBefore(e,n.ec)}e.innerHTML="
    ",r.copyFormatAttributes(e,f),r.removeItemAllParents(f,null,null),d.setRange(e,1,e,1);break}}if(_&&r.getParentElement(_,"FIGCAPTION")&&r.getParentElement(_,r.isList)&&(t.preventDefault(),f=d.appendFormatTag(f,null),d.setRange(f,0,f,0)),m){t.preventDefault(),t.stopPropagation();const n=e[m],i=n._container,l=i.previousElementSibling||i.nextElementSibling;let o=null;r.isListCell(i.parentNode)?o=r.createElement("BR"):(o=r.createElement(r.isFormatElement(l)?l.nodeName:"P"),o.innerHTML="
    "),i.parentNode.insertBefore(o,i),d.callPlugin(m,(function(){d.selectComponent(n._element,m)}),null)}break;case 27:if(m)return t.preventDefault(),t.stopPropagation(),d.controllersOff(),!1}if(i&&/16/.test(n)){t.preventDefault(),t.stopPropagation();const e=d.plugins.table;if(e&&!e._shift&&!e._ref){const t=r.getParentElement(f,r.isCell);if(t)return void e.onTableCellMultiSelect.call(d,t,!0)}}if(!(o||s||p||u._nonTextKeyCode.test(n))&&g.collapsed&&g.startContainer===g.endContainer&&r.isBreak(g.commonAncestorContainer)){const e=r.createTextNode(r.zeroWidthSpace);d.insertNode(e,null,!1),d.setRange(e,1,e,1)}"function"==typeof h.onKeyDown&&h.onKeyDown(t,d)},onKeyUp_wysiwyg:function(e){if(u._onShortcutKey)return;d._editorRange();const t=d.getRange(),n=e.keyCode,i=e.ctrlKey||e.metaKey||91===n||92===n||224===n,l=e.altKey;let o=d.getSelectionNode();if(d._isBalloon&&(d._isBalloonAlways&&27!==n||!t.collapsed)){if(!d._isBalloonAlways)return void u._showToolbarBalloon();27!==n&&u._showToolbarBalloonDelay()}if(8===n&&r.isWysiwygDiv(o)&&""===o.textContent&&0===o.children.length){e.preventDefault(),e.stopPropagation(),o.innerHTML="";const t=r.createElement(r.isFormatElement(d._variable.currentNodes[0])?d._variable.currentNodes[0]:"P");return t.innerHTML="
    ",o.appendChild(t),d.setRange(t,0,t,0),u._applyTagEffects(),void d.history.push(!1)}const s=r.getFormatElement(o,null),a=r.getRangeFormatElement(o,null);(s||!t.collapsed)&&s!==a||r.isComponent(o)||r.isList(o)||(d._setDefaultFormat(r.isRangeFormatElement(a)?"DIV":"P"),o=d.getSelectionNode()),u._directionKeyCode.test(n)&&u._applyTagEffects();if(!i&&!l&&!u._nonTextKeyCode.test(n)&&3===o.nodeType&&r.zeroWidthRegExp.test(o.textContent)&&!(void 0!==e.isComposing?e.isComposing:u._IEisComposing)){let e=t.startOffset,n=t.endOffset;const i=(o.textContent.substring(0,n).match(u._frontZeroWidthReg)||"").length;e=t.startOffset-i,n=t.endOffset-i,o.textContent=o.textContent.replace(r.zeroWidthRegExp,""),d.setRange(o,e<0?0:e,o,n<0?0:n)}d._charCount(""),d.history.push(!0),"function"==typeof h.onKeyUp&&h.onKeyUp(e,d)},onScroll_wysiwyg:function(e){d.controllersOff(),d._lineBreaker.style.display="none",d._isBalloon&&u._hideToolbar(),"function"==typeof h.onScroll&&h.onScroll(e,d)},onFocus_wysiwyg:function(e){d._antiBlur||(d.hasFocus=!0,d._isInline&&u._showToolbarInline(),"function"==typeof h.onFocus&&h.onFocus(e,d))},onBlur_wysiwyg:function(t){if(d._antiBlur)return;d.hasFocus=!1,d.controllersOff(),(d._isInline||d._isBalloon)&&u._hideToolbar(),"function"==typeof h.onBlur&&h.onBlur(t,d);const i=d.commandMap,o=d.activePlugins;for(let e in i)r.hasOwn(i,e)&&(o.indexOf(e)>-1?n[e].active.call(d,null):i.OUTDENT&&/^OUTDENT$/i.test(e)?i.OUTDENT.setAttribute("disabled",!0):i.INDENT&&/^INDENT$/i.test(e)?i.INDENT.removeAttribute("disabled"):r.removeClass(i[e],"active"));d._variable.currentNodes=[],d._variable.currentNodesMap=[],l.showPathLabel&&(e.element.navigation.textContent="")},onMouseDown_resizingBar:function(t){t.stopPropagation(),d._variable.resizeClientY=t.clientY,e.element.resizeBackground.style.display="block",s.addEventListener("mousemove",u._resize_editor),s.addEventListener("mouseup",(function t(){e.element.resizeBackground.style.display="none",s.removeEventListener("mousemove",u._resize_editor),s.removeEventListener("mouseup",t)}))},_resize_editor:function(t){const n=e.element.editorArea.offsetHeight+(t.clientY-d._variable.resizeClientY);e.element.wysiwygFrame.style.height=e.element.code.style.height=(n=n+o?(d._sticky||u._onStickyToolbar(),t.toolbar.style.top=n+o+l.stickyToolbar-i-d._variable.minResizingSize+"px"):i>=o&&u._onStickyToolbar()},_getEditorOffsets:function(t){let n=t||e.element.topArea,i=0,l=0,o=0;for(;n;)i+=n.offsetTop,l+=n.offsetLeft,o+=n.scrollTop,n=n.offsetParent;return{top:i,left:l,scroll:o}},_getPageBottomSpace:function(){return s.documentElement.scrollHeight-(u._getEditorOffsets(null).top+e.element.topArea.offsetHeight)},_onStickyToolbar:function(){const t=e.element;d._isInline||l.toolbarContainer||(t._stickyDummy.style.height=t.toolbar.offsetHeight+"px",t._stickyDummy.style.display="block"),t.toolbar.style.top=l.stickyToolbar+"px",t.toolbar.style.width=d._isInline?d._inlineToolbarAttr.width:t.toolbar.offsetWidth+"px",r.addClass(t.toolbar,"se-toolbar-sticky"),d._sticky=!0},_offStickyToolbar:function(){const t=e.element;t._stickyDummy.style.display="none",t.toolbar.style.top=d._isInline?d._inlineToolbarAttr.top:"",t.toolbar.style.width=d._isInline?d._inlineToolbarAttr.width:"",t.editorArea.style.marginTop="",r.removeClass(t.toolbar,"se-toolbar-sticky"),d._sticky=!1},_codeViewAutoHeight:function(){e.element.code.style.height=e.element.code.scrollHeight+"px"},_hardDelete:function(){const e=d.getRange(),t=e.startContainer,n=e.endContainer,i=r.getRangeFormatElement(t),l=r.getRangeFormatElement(n),o=r.isCell(i),s=r.isCell(l);if((o&&!i.previousElementSibling&&!i.parentElement.previousElementSibling||s&&!l.nextElementSibling&&!l.parentElement.nextElementSibling)&&i!==l)if(o){if(s)return r.removeItem(r.getParentElement(i,r.isComponent)),d.nativeFocus(),!0;r.removeItem(r.getParentElement(i,r.isComponent))}else r.removeItem(r.getParentElement(l,r.isComponent));const a=1===t.nodeType?r.getParentElement(t,".se-component"):null,c=1===n.nodeType?r.getParentElement(n,".se-component"):null;return a&&r.removeItem(a),c&&r.removeItem(c),!1},onPaste_wysiwyg:function(e){const t=r.isIE?a.clipboardData:e.clipboardData;return!t||u._dataTransferAction("paste",e,t)},_setClipboardComponent:function(e,t,n){e.preventDefault(),e.stopPropagation(),n.setData("text/html",t.component.outerHTML)},onCopy_wysiwyg:function(e){const t=r.isIE?a.clipboardData:e.clipboardData;if("function"==typeof h.onCopy&&!h.onCopy(e,t,d))return e.preventDefault(),e.stopPropagation(),!1;const n=d.currentFileComponentInfo;n&&!r.isIE&&(u._setClipboardComponent(e,n,t),r.addClass(n.component,"se-component-copy"),a.setTimeout((function(){r.removeClass(n.component,"se-component-copy")}),150))},onCut_wysiwyg:function(e){const t=r.isIE?a.clipboardData:e.clipboardData;if("function"==typeof h.onCut&&!h.onCut(e,t,d))return e.preventDefault(),e.stopPropagation(),!1;const n=d.currentFileComponentInfo;n&&!r.isIE&&(u._setClipboardComponent(e,n,t),r.removeItem(n.component),d.controllersOff()),a.setTimeout((function(){d.history.push(!1)}))},onDrop_wysiwyg:function(e){const t=e.dataTransfer;return!t||(r.isIE?(e.preventDefault(),e.stopPropagation(),!1):(d.removeNode(),u._setDropLocationSelection(e),u._dataTransferAction("drop",e,t)))},_setDropLocationSelection:function(e){if(e.rangeParent)d.setRange(e.rangeParent,e.rangeOffset,e.rangeParent,e.rangeOffset);else if(d._wd.caretRangeFromPoint){const t=d._wd.caretRangeFromPoint(e.clientX,e.clientY);d.setRange(t.startContainer,t.startOffset,t.endContainer,t.endOffset)}else{const e=d.getRange();d.setRange(e.startContainer,e.startOffset,e.endContainer,e.endOffset)}},_dataTransferAction:function(t,n,i){let l,o;if(r.isIE){l=i.getData("Text");const s=d.getRange(),c=r.createElement("DIV"),h={sc:s.startContainer,so:s.startOffset,ec:s.endContainer,eo:s.endOffset};return c.setAttribute("contenteditable",!0),c.style.cssText="position:absolute; top:0; left:0; width:1px; height:1px; overflow:hidden;",e.element.relative.appendChild(c),c.focus(),a.setTimeout((function(){o=c.innerHTML,r.removeItem(c),d.setRange(h.sc,h.so,h.ec,h.eo),u._setClipboardData(t,n,l,o,i)})),!0}if(l=i.getData("text/plain"),o=i.getData("text/html"),!1===u._setClipboardData(t,n,l,o,i))return n.preventDefault(),n.stopPropagation(),!1},_setClipboardData:function(e,t,n,i,l){/class=["']*Mso(Normal|List)/i.test(i)||/content=["']*Word.Document/i.test(i)||/content=["']*OneNote.File/i.test(i)?(i=i.replace(/\n/g," "),n=n.replace(/\n/g," ")):n=n.replace(/\n/g,""),i=d.cleanHTML(i,d.pasteTagsWhitelistRegExp);const o=d._charCount(d._charTypeHTML?i:n);if("paste"===e&&"function"==typeof h.onPaste&&!h.onPaste(t,i,o,d))return!1;if("drop"===e&&"function"==typeof h.onDrop&&!h.onDrop(t,l,d))return!1;const s=l.files;return s.length>0?(/^image/.test(s[0].type)&&d.plugins.image&&h.insertImage(s),!1):!!o&&(i?(h.insertHTML(i,!0,!1),!1):void 0)},onMouseMove_wysiwyg:function(t){if(d.isDisabled)return;const n=r.getParentElement(t.target,r.isComponent),i=d._lineBreaker.style;if(n&&!d.currentControllerName){let o=0,s=e.element.wysiwyg;do{o+=s.scrollTop,s=s.parentElement}while(s&&!/^(BODY|HTML)$/i.test(s.nodeName));const a=e.element.wysiwyg.scrollTop,c=u._getEditorOffsets(null),h=r.getOffset(n,e.element.wysiwygFrame).top+a,g=t.pageY+o+(l.iframe&&!l.toolbarContainer?e.element.toolbar.offsetHeight:0),p=h+(l.iframe?o:c.top),m=r.isListCell(n.parentNode);let f="",_="";if((m?!n.previousSibling:!r.isFormatElement(n.previousElementSibling))&&gp+n.offsetHeight-20))return void(i.display="none");_=h+n.offsetHeight,f="b"}d._variable._lineBreakComp=n,d._variable._lineBreakDir=f,i.top=_-a+"px",d._lineBreakerButton.style.left=r.getOffset(n).left+n.offsetWidth/2-15+"px",i.display="block"}else"none"!==i.display&&(i.display="none")},_onMouseDown_lineBreak:function(e){e.preventDefault()},_onLineBreak:function(e){e.preventDefault();const t=d._variable._lineBreakComp,n=this?this:d._variable._lineBreakDir,i=r.isListCell(t.parentNode),l=r.createElement(i?"BR":r.isCell(t.parentNode)?"DIV":"P");if(i||(l.innerHTML="
    "),d._charTypeHTML&&!d.checkCharCount(l.outerHTML,"byte-html"))return;t.parentNode.insertBefore(l,"t"===n?t:t.nextSibling),d._lineBreaker.style.display="none",d._variable._lineBreakComp=null;const o=i?l:l.firstChild;d.setRange(o,1,o,1),d.history.push(!1)},_addEvent:function(){const t=l.iframe?d._ww:e.element.wysiwyg;e.element.toolbar.addEventListener("mousedown",u._buttonsEventHandler,!1),e.element._menuTray.addEventListener("mousedown",u._buttonsEventHandler,!1),e.element.toolbar.addEventListener("click",u.onClick_toolbar,!1),t.addEventListener("mousedown",u.onMouseDown_wysiwyg,!1),t.addEventListener("click",u.onClick_wysiwyg,!1),t.addEventListener(r.isIE?"textinput":"input",u.onInput_wysiwyg,!1),t.addEventListener("keydown",u.onKeyDown_wysiwyg,!1),t.addEventListener("keyup",u.onKeyUp_wysiwyg,!1),t.addEventListener("paste",u.onPaste_wysiwyg,!1),t.addEventListener("copy",u.onCopy_wysiwyg,!1),t.addEventListener("cut",u.onCut_wysiwyg,!1),t.addEventListener("drop",u.onDrop_wysiwyg,!1),t.addEventListener("scroll",u.onScroll_wysiwyg,!1),t.addEventListener("focus",u.onFocus_wysiwyg,!1),t.addEventListener("blur",u.onBlur_wysiwyg,!1),u._lineBreakerBind={a:u._onLineBreak.bind(""),t:u._onLineBreak.bind("t"),b:u._onLineBreak.bind("b")},t.addEventListener("mousemove",u.onMouseMove_wysiwyg,!1),d._lineBreakerButton.addEventListener("mousedown",u._onMouseDown_lineBreak,!1),d._lineBreakerButton.addEventListener("click",u._lineBreakerBind.a,!1),e.element.lineBreaker_t.addEventListener("mousedown",u._lineBreakerBind.t,!1),e.element.lineBreaker_b.addEventListener("mousedown",u._lineBreakerBind.b,!1),d.plugins.table&&t.addEventListener("touchstart",u.onMouseDown_wysiwyg,{passive:!0,useCapture:!1}),"auto"!==l.height||l.codeMirrorEditor||(e.element.code.addEventListener("keydown",u._codeViewAutoHeight,!1),e.element.code.addEventListener("keyup",u._codeViewAutoHeight,!1),e.element.code.addEventListener("paste",u._codeViewAutoHeight,!1)),e.element.resizingBar&&(/\d+/.test(l.height)?e.element.resizingBar.addEventListener("mousedown",u.onMouseDown_resizingBar,!1):r.addClass(e.element.resizingBar,"se-resizing-none")),u._setResponsiveToolbar(),a.removeEventListener("resize",u.onResize_window),a.removeEventListener("scroll",u.onScroll_window),a.addEventListener("resize",u.onResize_window,!1),l.stickyToolbar>-1&&a.addEventListener("scroll",u.onScroll_window,!1)},_removeEvent:function(){const t=l.iframe?d._ww:e.element.wysiwyg;e.element.toolbar.removeEventListener("mousedown",u._buttonsEventHandler),e.element._menuTray.removeEventListener("mousedown",u._buttonsEventHandler),e.element.toolbar.removeEventListener("click",u.onClick_toolbar),t.removeEventListener("mousedown",u.onMouseDown_wysiwyg),t.removeEventListener("click",u.onClick_wysiwyg),t.removeEventListener(r.isIE?"textinput":"input",u.onInput_wysiwyg),t.removeEventListener("keydown",u.onKeyDown_wysiwyg),t.removeEventListener("keyup",u.onKeyUp_wysiwyg),t.removeEventListener("paste",u.onPaste_wysiwyg),t.removeEventListener("copy",u.onCopy_wysiwyg),t.removeEventListener("cut",u.onCut_wysiwyg),t.removeEventListener("drop",u.onDrop_wysiwyg),t.removeEventListener("scroll",u.onScroll_wysiwyg),t.removeEventListener("mousemove",u.onMouseMove_wysiwyg),d._lineBreakerButton.removeEventListener("mousedown",u._onMouseDown_lineBreak),d._lineBreakerButton.removeEventListener("click",u._lineBreakerBind.a),e.element.lineBreaker_t.removeEventListener("mousedown",u._lineBreakerBind.t),e.element.lineBreaker_b.removeEventListener("mousedown",u._lineBreakerBind.b),u._lineBreakerBind=null,t.removeEventListener("touchstart",u.onMouseDown_wysiwyg,{passive:!0,useCapture:!1}),t.removeEventListener("focus",u.onFocus_wysiwyg),t.removeEventListener("blur",u.onBlur_wysiwyg),e.element.code.removeEventListener("keydown",u._codeViewAutoHeight),e.element.code.removeEventListener("keyup",u._codeViewAutoHeight),e.element.code.removeEventListener("paste",u._codeViewAutoHeight),e.element.resizingBar&&e.element.resizingBar.removeEventListener("mousedown",u.onMouseDown_resizingBar),a.removeEventListener("resize",u.onResize_window),a.removeEventListener("scroll",u.onScroll_window)},_setResponsiveToolbar:function(){if(0===o.length)return void(o=null);const e=u._responsiveButtonSize=["default"],t=u._responsiveButtons={default:o[0]};for(let n,i,l=1,s=o.length;l",e}};return void 0===t&&(e.SUNEDITOR_MODULES||Object.defineProperty(e,"SUNEDITOR_MODULES",{enumerable:!0,writable:!1,configurable:!1,value:{}}),Object.defineProperty(e.SUNEDITOR_MODULES,"component",{enumerable:!0,writable:!1,configurable:!1,value:n})),n},"object"==typeof e.exports?e.exports=i.document?l(i,!0):function(e){if(!e.document)throw new Error("SUNEDITOR_MODULES a window with a document");return l(e)}:l(i)},ee5k:function(e,t,n){"use strict";var i,l;i="undefined"!=typeof window?window:this,l=function(e,t){const n={name:"resizing",add:function(e){const t=e.icons,n=e.context;n.resizing={_resizeClientX:0,_resizeClientY:0,_resize_plugin:"",_resize_w:0,_resize_h:0,_origin_w:0,_origin_h:0,_rotateVertical:!1,_resize_direction:"",_move_path:null,_isChange:!1,alignIcons:{basic:t.align_justify,left:t.align_left,right:t.align_right,center:t.align_center}};let i=this.setController_resize.call(e);n.resizing.resizeContainer=i,n.resizing.resizeDiv=i.querySelector(".se-modal-resize"),n.resizing.resizeDot=i.querySelector(".se-resize-dot"),n.resizing.resizeDisplay=i.querySelector(".se-resize-display");let l=this.setController_button.call(e);n.resizing.resizeButton=l;let o=n.resizing.resizeHandles=n.resizing.resizeDot.querySelectorAll("span");n.resizing.resizeButtonGroup=l.querySelector("._se_resizing_btn_group"),n.resizing.rotationButtons=l.querySelectorAll("._se_resizing_btn_group ._se_rotation"),n.resizing.percentageButtons=l.querySelectorAll("._se_resizing_btn_group ._se_percentage"),n.resizing.alignMenu=l.querySelector(".se-resizing-align-list"),n.resizing.alignMenuList=n.resizing.alignMenu.querySelectorAll("button"),n.resizing.alignButton=l.querySelector("._se_resizing_align_button"),n.resizing.autoSizeButton=l.querySelector("._se_resizing_btn_group ._se_auto_size"),n.resizing.captionButton=l.querySelector("._se_resizing_caption_button"),i.addEventListener("mousedown",(function(e){e.preventDefault()})),l.addEventListener("mousedown",e.eventStop),o[0].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),o[1].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),o[2].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),o[3].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),o[4].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),o[5].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),o[6].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),o[7].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),l.addEventListener("click",this.onClick_resizeButton.bind(e)),n.element.relative.appendChild(i),n.element.relative.appendChild(l),i=null,l=null,o=null},setController_resize:function(){const e=this.util.createElement("DIV");return e.className="se-controller se-resizing-container",e.style.display="none",e.innerHTML='
    ',e},setController_button:function(){const e=this.lang,t=this.icons,n=this.util.createElement("DIV");return n.className="se-controller se-controller-resizing",n.innerHTML='
    ",n},_module_getSizeX:function(e,t,n,i){return t||(t=e._element),n||(n=e._cover),i||(i=e._container),t?/%$/.test(t.style.width)?(i&&this.util.getNumber(i.style.width,2)||100)+"%":t.style.width:""},_module_getSizeY:function(e,t,n,i){return t||(t=e._element),n||(n=e._cover),i||(i=e._container),i&&n?this.util.getNumber(n.style.paddingBottom,0)>0&&!this.context.resizing._rotateVertical?n.style.height:/%$/.test(t.style.height)&&/%$/.test(t.style.width)?(i&&this.util.getNumber(i.style.height,2)||100)+"%":t.style.height:t&&t.style.height||""},_module_setModifyInputSize:function(e,t){const n=e._onlyPercentage&&this.context.resizing._rotateVertical;e.proportion.checked=e._proportionChecked="false"!==e._element.getAttribute("data-proportion");let i=n?"":this.plugins.resizing._module_getSizeX.call(this,e);if(i===e._defaultSizeX&&(i=""),e._onlyPercentage&&(i=this.util.getNumber(i,2)),e.inputX.value=i,t.setInputSize.call(this,"x"),!e._onlyPercentage){let t=n?"":this.plugins.resizing._module_getSizeY.call(this,e);t===e._defaultSizeY&&(t=""),e._onlyPercentage&&(t=this.util.getNumber(t,2)),e.inputY.value=t}e.inputX.disabled=!!n,e.inputY.disabled=!!n,e.proportion.disabled=!!n,t.setRatio.call(this)},_module_setInputSize:function(e,t){if(e._onlyPercentage)"x"===t&&e.inputX.value>100&&(e.inputX.value=100);else if(e.proportion.checked&&e._ratio&&/\d/.test(e.inputX.value)&&/\d/.test(e.inputY.value)){const n=e.inputX.value.replace(/\d+|\./g,"")||e.sizeUnit,i=e.inputY.value.replace(/\d+|\./g,"")||e.sizeUnit;if(n!==i)return;const l="%"===n?2:0;"x"===t?e.inputY.value=this.util.getNumber(e._ratioY*this.util.getNumber(e.inputX.value,l),l)+i:e.inputX.value=this.util.getNumber(e._ratioX*this.util.getNumber(e.inputY.value,l),l)+n}},_module_setRatio:function(e){const t=e.inputX.value,n=e.inputY.value;if(e.proportion.checked&&/\d+/.test(t)&&/\d+/.test(n)){if((t.replace(/\d+|\./g,"")||e.sizeUnit)!==(n.replace(/\d+|\./g,"")||e.sizeUnit))e._ratio=!1;else if(!e._ratio){const i=this.util.getNumber(t,0),l=this.util.getNumber(n,0);e._ratio=!0,e._ratioX=i/l,e._ratioY=l/i}}else e._ratio=!1},_module_sizeRevert:function(e){e._onlyPercentage?e.inputX.value=e._origin_w>100?100:e._origin_w:(e.inputX.value=e._origin_w,e.inputY.value=e._origin_h)},_module_saveCurrentSize:function(e){const t=this.plugins.resizing._module_getSizeX.call(this,e),n=this.plugins.resizing._module_getSizeY.call(this,e);e._element.setAttribute("data-size",t+","+n),e._videoRatio&&(e._videoRatio=n)},call_controller_resize:function(e,t){const n=this.context.resizing,i=this.context[t];n._resize_plugin=t;const l=n.resizeContainer,o=n.resizeDiv,s=this.util.getOffset(e,this.context.element.wysiwygFrame),a=n._rotateVertical=/^(90|270)$/.test(Math.abs(e.getAttribute("data-rotate")).toString()),r=a?e.offsetHeight:e.offsetWidth,c=a?e.offsetWidth:e.offsetHeight,d=s.top,u=s.left-this.context.element.wysiwygFrame.scrollLeft;l.style.top=d+"px",l.style.left=u+"px",l.style.width=r+"px",l.style.height=c+"px",o.style.top="0px",o.style.left="0px",o.style.width=r+"px",o.style.height=c+"px";let h=e.getAttribute("data-align")||"basic";h="none"===h?"basic":h;const g=this.util.getParentElement(e,this.util.isComponent),p=this.util.getParentElement(e,"FIGURE"),m=this.plugins.resizing._module_getSizeX.call(this,i,e,p,g)||"auto",f=i._onlyPercentage&&"image"===t?"":", "+(this.plugins.resizing._module_getSizeY.call(this,i,e,p,g)||"auto");this.util.changeTxt(n.resizeDisplay,this.lang.dialogBox[h]+" ("+m+f+")"),n.resizeButtonGroup.style.display=i._resizing?"":"none";const _=!i._resizing||i._resizeDotHide||i._onlyPercentage?"none":"flex",b=n.resizeHandles;for(let e=0,t=b.length;e=360?0:d;s.setAttribute("data-rotate",u),c._rotateVertical=/^(90|270)$/.test(this._w.Math.abs(u).toString()),this.plugins.resizing.setTransformSize.call(this,s,null,null),this.selectComponent(s,l);break;case"onalign":return void this.plugins.resizing.openAlignMenu.call(this);case"align":const h="basic"===i?"none":i;a.setAlign.call(this,h,null,null,null),this.selectComponent(s,l);break;case"caption":const g=!o._captionChecked;if(a.openModify.call(this,!0),o._captionChecked=o.captionCheckEl.checked=g,a.update_image.call(this,!1,!1,!1),g){const e=this.util.getChildElement(o._caption,(function(e){return 3===e.nodeType}));e?this.setRange(e,0,e,e.textContent.length):o._caption.focus(),this.controllersOff()}else this.selectComponent(s,l),a.openModify.call(this,!0);break;case"revert":a.setOriginSize.call(this),this.selectComponent(s,l);break;case"update":a.openModify.call(this),this.controllersOff();break;case"delete":a.destroy.call(this)}this.history.push(!1)}},resetTransform:function(e){const t=(e.getAttribute("data-size")||e.getAttribute("data-origin")||"").split(",");this.context.resizing._rotateVertical=!1,e.style.maxWidth="",e.style.transform="",e.style.transformOrigin="",e.setAttribute("data-rotate",""),e.setAttribute("data-rotateX",""),e.setAttribute("data-rotateY",""),this.plugins[this.context.resizing._resize_plugin].setSize.call(this,t[0]?t[0]:"auto",t[1]?t[1]:"",!0)},setTransformSize:function(e,t,n){let i=e.getAttribute("data-percentage");const l=this.context.resizing._rotateVertical,o=1*e.getAttribute("data-rotate");let s="";if(i&&!l)i=i.split(","),"auto"===i[0]&&"auto"===i[1]?this.plugins[this.context.resizing._resize_plugin].setAutoSize.call(this):this.plugins[this.context.resizing._resize_plugin].setPercentSize.call(this,i[0],i[1]);else{const i=this.util.getParentElement(e,"FIGURE"),a=t||e.offsetWidth,r=n||e.offsetHeight,c=(l?r:a)+"px",d=(l?a:r)+"px";if(this.plugins[this.context.resizing._resize_plugin].cancelPercentAttr.call(this),this.plugins[this.context.resizing._resize_plugin].setSize.call(this,a+"px",r+"px",!0),i.style.width=c,i.style.height=this.context[this.context.resizing._resize_plugin]._caption?"":d,l){let e=a/2+"px "+a/2+"px 0",t=r/2+"px "+r/2+"px 0";s=90===o||-270===o?t:e}}e.style.transformOrigin=s,this.plugins.resizing._setTransForm(e,o.toString(),e.getAttribute("data-rotateX")||"",e.getAttribute("data-rotateY")||""),e.style.maxWidth=l?"none":"",this.plugins.resizing.setCaptionPosition.call(this,e)},_setTransForm:function(e,t,n,i){let l=(e.offsetWidth-e.offsetHeight)*(/-/.test(t)?1:-1),o="";if(/[1-9]/.test(t)&&(n||i))switch(o=n?"Y":"X",t){case"90":o=n&&i?"X":i?o:"";break;case"270":l*=-1,o=n&&i?"Y":n?o:"";break;case"-90":o=n&&i?"Y":n?o:"";break;case"-270":l*=-1,o=n&&i?"X":i?o:"";break;default:o=""}t%180==0&&(e.style.maxWidth=""),e.style.transform="rotate("+t+"deg)"+(n?" rotateX("+n+"deg)":"")+(i?" rotateY("+i+"deg)":"")+(o?" translate"+o+"("+l+"px)":"")},setCaptionPosition:function(e){const t=this.util.getChildElement(this.util.getParentElement(e,"FIGURE"),"FIGCAPTION");t&&(t.style.marginTop=(this.context.resizing._rotateVertical?e.offsetWidth-e.offsetHeight:0)+"px")},onMouseDown_resize_handle:function(e){e.stopPropagation(),e.preventDefault();const t=this.context.resizing,n=t._resize_direction=e.target.classList[0];t._resizeClientX=e.clientX,t._resizeClientY=e.clientY,this.context.element.resizeBackground.style.display="block",t.resizeButton.style.display="none",t.resizeDiv.style.float=/l/.test(n)?"right":/r/.test(n)?"left":"none";const i=function(e){if("keydown"===e.type&&27!==e.keyCode)return;const o=t._isChange;t._isChange=!1,this.removeDocEvent("mousemove",l),this.removeDocEvent("mouseup",i),this.removeDocEvent("keydown",i),"keydown"===e.type?(this.controllersOff(),this.context.element.resizeBackground.style.display="none",this.plugins[this.context.resizing._resize_plugin].init.call(this)):(this.plugins.resizing.cancel_controller_resize.call(this,n),o&&this.history.push(!1))}.bind(this),l=this.plugins.resizing.resizing_element.bind(this,t,n,this.context[t._resize_plugin]);this.addDocEvent("mousemove",l),this.addDocEvent("mouseup",i),this.addDocEvent("keydown",i)},resizing_element:function(e,t,n,i){const l=i.clientX,o=i.clientY;let s=n._element_w,a=n._element_h;const r=n._element_w+(/r/.test(t)?l-e._resizeClientX:e._resizeClientX-l),c=n._element_h+(/b/.test(t)?o-e._resizeClientY:e._resizeClientY-o),d=n._element_h/n._element_w*r;/t/.test(t)&&(e.resizeDiv.style.top=n._element_h-(/h/.test(t)?c:d)+"px"),/l/.test(t)&&(e.resizeDiv.style.left=n._element_w-r+"px"),/r|l/.test(t)&&(e.resizeDiv.style.width=r+"px",s=r),/^(t|b)[^h]$/.test(t)?(e.resizeDiv.style.height=d+"px",a=d):/^(t|b)h$/.test(t)&&(e.resizeDiv.style.height=c+"px",a=c),e._resize_w=s,e._resize_h=a,this.util.changeTxt(e.resizeDisplay,this._w.Math.round(s)+" x "+this._w.Math.round(a)),e._isChange=!0},cancel_controller_resize:function(e){const t=this.context.resizing._rotateVertical;this.controllersOff(),this.context.element.resizeBackground.style.display="none";let n=this._w.Math.round(t?this.context.resizing._resize_h:this.context.resizing._resize_w),i=this._w.Math.round(t?this.context.resizing._resize_w:this.context.resizing._resize_h);if(!t&&!/%$/.test(n)){const e=16,t=this.context.element.wysiwygFrame.clientWidth-2*e-2;this.util.getNumber(n,0)>t&&(i=this._w.Math.round(i/n*t),n=t)}const l=this.context.resizing._resize_plugin;this.plugins[l].setSize.call(this,n,i,!1,e),this.selectComponent(this.context[l]._element,l)}};return void 0===t&&(e.SUNEDITOR_MODULES||Object.defineProperty(e,"SUNEDITOR_MODULES",{enumerable:!0,writable:!1,configurable:!1,value:{}}),Object.defineProperty(e.SUNEDITOR_MODULES,"resizing",{enumerable:!0,writable:!1,configurable:!1,value:n})),n},"object"==typeof e.exports?e.exports=i.document?l(i,!0):function(e){if(!e.document)throw new Error("SUNEDITOR_MODULES a window with a document");return l(e)}:l(i)},"gjS+":function(e,t,n){"use strict";var i,l;i="undefined"!=typeof window?window:this,l=function(e,t){const n={name:"fileManager",_xmlHttp:null,upload:function(e,t,n,i,l){this.showLoading();const o=this.plugins.fileManager,s=o._xmlHttp=this.util.getXMLHttpRequest();if(s.onreadystatechange=o._callBackUpload.bind(this,s,i,l),s.open("post",e,!0),null!==t&&"object"==typeof t&&this._w.Object.keys(t).length>0)for(let e in t)s.setRequestHeader(e,t[e]);s.send(n)},_callBackUpload:function(e,t,n){if(4===e.readyState)if(200===e.status)try{t(e)}catch(e){throw Error('[SUNEDITOR.fileManager.upload.callBack.fail] cause : "'+e.message+'"')}finally{this.closeLoading()}else{this.closeLoading();const t=e.responseText?JSON.parse(e.responseText):e;if("function"!=typeof n||n("",t,this)){const n="[SUNEDITOR.fileManager.upload.serverException] status: "+e.status+", response: "+(t.errorMessage||e.responseText);throw this.functions.noticeOpen(n),Error(n)}}},checkInfo:function(e,t,n,i,l){let o=[];for(let e=0,n=t.length;e-1||(a.splice(t,1),"function"==typeof n&&n(null,e,"delete",null,0,this),t--);l&&(this.context.resizing._resize_plugin=c)},setInfo:function(e,t,n,i,l){const o=l?this.context.resizing._resize_plugin:"";l&&(this.context.resizing._resize_plugin=e);const s=this.plugins[e],a=this.context[e],r=a._infoList;let c=t.getAttribute("data-index"),d=null,u="";if(i||(i={name:t.getAttribute("data-file-name")||("string"==typeof t.src?t.src.split("/").pop():""),size:t.getAttribute("data-file-size")||0}),!c||this._componentsInfoInit)u="create",c=a._infoIndex++,t.setAttribute("data-index",c),t.setAttribute("data-file-name",i.name),t.setAttribute("data-file-size",i.size),d={src:t.src,index:1*c,name:i.name,size:i.size},r.push(d);else{u="update",c*=1;for(let e=0,t=r.length;e=0){const i=this.context[e]._infoList;for(let e=0,l=i.length;e
    '},_onMouseDown_browser:function(e){/se-file-browser-inner/.test(e.target.className)?this.context.fileBrowser._closeSignal=!0:this.context.fileBrowser._closeSignal=!1},_onClick_browser:function(e){e.stopPropagation(),(/close/.test(e.target.getAttribute("data-command"))||this.context.fileBrowser._closeSignal)&&this.plugins.fileBrowser.close.call(this)},open:function(e,t){this.plugins.fileBrowser._bindClose&&(this._d.removeEventListener("keydown",this.plugins.fileBrowser._bindClose),this.plugins.fileBrowser._bindClose=null),this.plugins.fileBrowser._bindClose=function(e){/27/.test(e.keyCode)&&this.plugins.fileBrowser.close.call(this)}.bind(this),this._d.addEventListener("keydown",this.plugins.fileBrowser._bindClose);const n=this.context.fileBrowser;n.contextPlugin=e,n.selectorHandler=t;const i=this.context[e],l=i.listClass;this.util.hasClass(n.list,l)||(n.list.className="se-file-browser-list "+l),"full"===this.context.option.popupDisplay?n.area.style.position="fixed":n.area.style.position="absolute",n.titleArea.textContent=i.title,n.area.style.display="block",this.plugins.fileBrowser._drawFileList.call(this,this.context[e].url)},_bindClose:null,close:function(){const e=this.plugins.fileBrowser;e._xmlHttp&&e._xmlHttp.abort(),e._bindClose&&(this._d.removeEventListener("keydown",e._bindClose),e._bindClose=null);const t=this.context.fileBrowser;t.area.style.display="none",t.selectorHandler=null,t.selectedTags=[],t.items=[],t.list.innerHTML=t.tagArea.innerHTML=t.titleArea.textContent="","function"==typeof this.plugins[t.contextPlugin].init&&this.plugins[t.contextPlugin].init.call(this),t.contextPlugin=""},showBrowserLoading:function(){this._loading.style.display="block"},closeBrowserLoading:function(){this._loading.style.display="none"},_drawFileList:function(e){const t=this.plugins.fileBrowser,n=t._xmlHttp=this.util.getXMLHttpRequest();n.onreadystatechange=t._callBackGet.bind(this,n),n.open("get",e,!0),n.send(null),this.plugins.fileBrowser.showBrowserLoading()},_callBackGet:function(e){if(4===e.readyState)if(this.plugins.fileBrowser._xmlHttp=null,200===e.status)try{this.plugins.fileBrowser._drawListItem.call(this,JSON.parse(e.responseText).result,!0)}catch(e){throw Error('[SUNEDITOR.fileBrowser.drawList.fail] cause : "'+e.message+'"')}finally{this.plugins.fileBrowser.closeBrowserLoading(),this.context.fileBrowser.body.style.maxHeight=this._w.innerHeight-this.context.fileBrowser.header.offsetHeight-50+"px"}else if(this.plugins.fileBrowser.closeBrowserLoading(),0!==e.status){const t=e.responseText?JSON.parse(e.responseText):e,n="[SUNEDITOR.fileBrowser.get.serverException] status: "+e.status+", response: "+(t.errorMessage||e.responseText);throw Error(n)}},_drawListItem:function(e,t){const n=this.context.fileBrowser,i=this.context[n.contextPlugin],l=[],o=e.length,s=i.columnSize||n.columnSize,a=s<=1?1:Math.round(o/s)||1,r=i.itemTemplateHandler;let c="",d='
    ',u=1;for(let n,i,h=0;h
    '),t&&i.length>0)for(let e,t=0,n=i.length;t'+e+"");d+="
    ",n.list.innerHTML=d,t&&(n.items=e,n.tagArea.innerHTML=c,n.tagElements=n.tagArea.querySelectorAll("A"))},onClickTag:function(e){const t=e.target;if(!this.util.isAnchor(t))return;const n=t.textContent,i=this.plugins.fileBrowser,l=this.context.fileBrowser,o=l.tagArea.querySelector('a[title="'+n+'"]'),s=l.selectedTags,a=s.indexOf(n);a>-1?(s.splice(a,1),this.util.removeClass(o,"on")):(s.push(n),this.util.addClass(o,"on")),i._drawListItem.call(this,0===s.length?l.items:l.items.filter((function(e){return e.tag.some((function(e){return s.indexOf(e)>-1}))})),!1)},onClickFile:function(e){e.preventDefault(),e.stopPropagation();const t=this.context.fileBrowser,n=t.list;let i=e.target,l=null;if(i===n)return;for(;n!==i.parentNode&&(l=i.getAttribute("data-command"),!l);)i=i.parentNode;if(!l)return;const o=t.selectorHandler||this.context[t.contextPlugin].selectorHandler;this.plugins.fileBrowser.close.call(this),o(i)}};return void 0===t&&(e.SUNEDITOR_MODULES||Object.defineProperty(e,"SUNEDITOR_MODULES",{enumerable:!0,writable:!1,configurable:!1,value:{}}),Object.defineProperty(e.SUNEDITOR_MODULES,"fileBrowser",{enumerable:!0,writable:!1,configurable:!1,value:n})),n},"object"==typeof e.exports?e.exports=i.document?l(i,!0):function(e){if(!e.document)throw new Error("SUNEDITOR_MODULES a window with a document");return l(e)}:l(i)},P6u4:function(e,t,n){"use strict";var i,l;i="undefined"!=typeof window?window:this,l=function(e,t){const n={code:"en",toolbar:{default:"Default",save:"Save",font:"Font",formats:"Formats",fontSize:"Size",bold:"Bold",underline:"Underline",italic:"Italic",strike:"Strike",subscript:"Subscript",superscript:"Superscript",removeFormat:"Remove Format",fontColor:"Font Color",hiliteColor:"Highlight Color",indent:"Indent",outdent:"Outdent",align:"Align",alignLeft:"Align left",alignRight:"Align right",alignCenter:"Align center",alignJustify:"Align justify",list:"List",orderList:"Ordered list",unorderList:"Unordered list",horizontalRule:"Horizontal line",hr_solid:"Solid",hr_dotted:"Dotted",hr_dashed:"Dashed",table:"Table",link:"Link",math:"Math",image:"Image",video:"Video",audio:"Audio",fullScreen:"Full screen",showBlocks:"Show blocks",codeView:"Code view",undo:"Undo",redo:"Redo",preview:"Preview",print:"print",tag_p:"Paragraph",tag_div:"Normal (DIV)",tag_h:"Header",tag_blockquote:"Quote",tag_pre:"Code",template:"Template",lineHeight:"Line height",paragraphStyle:"Paragraph style",textStyle:"Text style",imageGallery:"Image gallery"},dialogBox:{linkBox:{title:"Insert Link",url:"URL to link",text:"Text to display",newWindowCheck:"Open in new window"},mathBox:{title:"Math",inputLabel:"Mathematical Notation",fontSizeLabel:"Font Size",previewLabel:"Preview"},imageBox:{title:"Insert image",file:"Select from files",url:"Image URL",altText:"Alternative text"},videoBox:{title:"Insert Video",file:"Select from files",url:"Media embed URL, YouTube/Vimeo"},audioBox:{title:"Insert Audio",file:"Select from files",url:"Audio URL"},browser:{tags:"Tags",search:"Search"},mentionBox:{title:"Add Mention"},caption:"Insert description",close:"Close",submitButton:"Submit",revertButton:"Revert",proportion:"Constrain proportions",basic:"Basic",left:"Left",right:"Right",center:"Center",width:"Width",height:"Height",size:"Size",ratio:"Ratio"},controller:{edit:"Edit",unlink:"Unlink",remove:"Remove",insertRowAbove:"Insert row above",insertRowBelow:"Insert row below",deleteRow:"Delete row",insertColumnBefore:"Insert column before",insertColumnAfter:"Insert column after",deleteColumn:"Delete column",fixedColumnWidth:"Fixed column width",resize100:"Resize 100%",resize75:"Resize 75%",resize50:"Resize 50%",resize25:"Resize 25%",autoSize:"Auto size",mirrorHorizontal:"Mirror, Horizontal",mirrorVertical:"Mirror, Vertical",rotateLeft:"Rotate left",rotateRight:"Rotate right",maxSize:"Max size",minSize:"Min size",tableHeader:"Table header",mergeCells:"Merge cells",splitCells:"Split Cells",HorizontalSplit:"Horizontal split",VerticalSplit:"Vertical split"},menu:{spaced:"Spaced",bordered:"Bordered",neon:"Neon",translucent:"Translucent",shadow:"Shadow",code:"Code"}};return void 0===t&&(e.SUNEDITOR_LANG||Object.defineProperty(e,"SUNEDITOR_LANG",{enumerable:!0,writable:!1,configurable:!1,value:{}}),Object.defineProperty(e.SUNEDITOR_LANG,"en",{enumerable:!0,writable:!0,configurable:!0,value:n})),n},"object"==typeof e.exports?e.exports=i.document?l(i,!0):function(e){if(!e.document)throw new Error("SUNEDITOR_LANG a window with a document");return l(e)}:l(i)},WUQj:function(e,t,n){},XJR1:function(e,t,n){"use strict";n.r(t);n("3FqI"),n("WUQj");var i={name:"colorPicker",add:function(e){const t=e.context;t.colorPicker={colorListHTML:"",_colorInput:"",_defaultColor:"#000",_styleProperty:"color",_currentColor:"",_colorList:[]};let n=this.createColorList(e,this._makeColorList);t.colorPicker.colorListHTML=n,n=null},createColorList:function(e,t){const n=e.context.option,i=e.lang,l=n.colorList&&0!==n.colorList.length?n.colorList:["#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"];let o=[],s='
    ';for(let e,n=0,i=l.length;n0&&(s+='
    '+t(o)+"
    ",o=[]),"object"==typeof e&&(s+='
    '+t(e)+"
    ")));return s+='
    ",s},_makeColorList:function(e){let t="";t+='
      ';for(let n,i=0,l=e.length;i');return t+="
    ",t},init:function(e,t){const n=this.plugins.colorPicker;let i=t||(n.getColorInNode.call(this,e)||this.context.colorPicker._defaultColor);i=n.isHexColor(i)?i:n.rgb2hex(i)||i;const l=this.context.colorPicker._colorList;if(l)for(let e=0,t=l.length;e=3&&"#"+((1<<24)+(n[0]<<16)+(n[1]<<8)+n[2]).toString(16).substr(1)}},l={name:"fontColor",display:"submenu",add:function(e,t){e.addModule([i]);const n=e.context;n.fontColor={previewEl:null,colorInput:null,colorList:null};let l=this.setSubmenu.call(e);n.fontColor.colorInput=l.querySelector("._se_color_picker_input"),n.fontColor.colorInput.addEventListener("keyup",this.onChangeInput.bind(e)),l.querySelector("._se_color_picker_submit").addEventListener("click",this.submit.bind(e)),l.querySelector("._se_color_picker_remove").addEventListener("click",this.remove.bind(e)),l.addEventListener("click",this.pickup.bind(e)),n.fontColor.colorList=l.querySelectorAll("li button"),e.initMenuTarget(this.name,t,l),l=null},setSubmenu:function(){const e=this.context.colorPicker.colorListHTML,t=this.util.createElement("DIV");return t.className="se-submenu se-list-layer",t.innerHTML=e,t},on:function(){const e=this.context.colorPicker,t=this.context.fontColor;e._colorInput=t.colorInput,e._defaultColor="#333333",e._styleProperty="color",e._colorList=t.colorList,this.plugins.colorPicker.init.call(this,this.getSelectionNode(),null)},onChangeInput:function(e){this.plugins.colorPicker.setCurrentColor.call(this,e.target.value)},submit:function(){this.plugins.fontColor.applyColor.call(this,this.context.colorPicker._currentColor)},pickup:function(e){e.preventDefault(),e.stopPropagation(),this.plugins.fontColor.applyColor.call(this,e.target.getAttribute("data-value"))},remove:function(){this.nodeChange(null,["color"],["span"],!0),this.submenuOff()},applyColor:function(e){if(!e)return;const t=this.util.createElement("SPAN");t.style.color=e,this.nodeChange(t,["color"],null,null),this.submenuOff()}},o={name:"hiliteColor",display:"submenu",add:function(e,t){e.addModule([i]);const n=e.context;n.hiliteColor={previewEl:null,colorInput:null,colorList:null};let l=this.setSubmenu.call(e);n.hiliteColor.colorInput=l.querySelector("._se_color_picker_input"),n.hiliteColor.colorInput.addEventListener("keyup",this.onChangeInput.bind(e)),l.querySelector("._se_color_picker_submit").addEventListener("click",this.submit.bind(e)),l.querySelector("._se_color_picker_remove").addEventListener("click",this.remove.bind(e)),l.addEventListener("click",this.pickup.bind(e)),n.hiliteColor.colorList=l.querySelectorAll("li button"),e.initMenuTarget(this.name,t,l),l=null},setSubmenu:function(){const e=this.context.colorPicker.colorListHTML,t=this.util.createElement("DIV");return t.className="se-submenu se-list-layer",t.innerHTML=e,t},on:function(){const e=this.context.colorPicker,t=this.context.hiliteColor;e._colorInput=t.colorInput,e._defaultColor="#FFFFFF",e._styleProperty="backgroundColor",e._colorList=t.colorList,this.plugins.colorPicker.init.call(this,this.getSelectionNode(),null)},onChangeInput:function(e){this.plugins.colorPicker.setCurrentColor.call(this,e.target.value)},submit:function(){this.plugins.hiliteColor.applyColor.call(this,this.context.colorPicker._currentColor)},pickup:function(e){e.preventDefault(),e.stopPropagation(),this.plugins.hiliteColor.applyColor.call(this,e.target.getAttribute("data-value"))},remove:function(){this.nodeChange(null,["background-color"],["span"],!0),this.submenuOff()},applyColor:function(e){if(!e)return;const t=this.util.createElement("SPAN");t.style.backgroundColor=e,this.nodeChange(t,["background-color"],null,null),this.submenuOff()}},s={name:"template",display:"submenu",add:function(e,t){e.context.template={};let n=this.setSubmenu.call(e);n.querySelector("ul").addEventListener("click",this.pickup.bind(e)),e.initMenuTarget(this.name,t,n),n=null},setSubmenu:function(){const e=this.context.option.templates;if(!e||0===e.length)throw Error('[SUNEDITOR.plugins.template.fail] To use the "template" plugin, please define the "templates" option.');const t=this.util.createElement("DIV");t.className="se-list-layer";let n='
      ';for(let t,i=0,l=e.length;i";return n+="
    ",t.innerHTML=n,t},pickup:function(e){if(!/^BUTTON$/i.test(e.target.tagName))return!1;e.preventDefault(),e.stopPropagation();const t=this.context.option.templates[e.target.getAttribute("data-value")];if(!t.html)throw this.submenuOff(),Error('[SUNEDITOR.template.fail] cause : "templates[i].html not found"');this.setContents(t.html),this.submenuOff()}},a=n("1kvd"),r=n.n(a),c={name:"link",display:"dialog",add:function(e){e.addModule([r.a]);const t=e.context;t.link={focusElement:null,linkNewWindowCheck:null,linkAnchorText:null,_linkAnchor:null,_linkValue:""};let n=this.setDialog.call(e);t.link.modal=n,t.link.focusElement=n.querySelector("._se_link_url"),t.link.linkAnchorText=n.querySelector("._se_link_text"),t.link.linkNewWindowCheck=n.querySelector("._se_link_check"),t.link.preview=n.querySelector(".se-link-preview");let i=this.setController_LinkButton.call(e);t.link.linkController=i,t.link._linkAnchor=null,i.addEventListener("mousedown",e.eventStop),n.querySelector(".se-btn-primary").addEventListener("click",this.submit.bind(e)),i.addEventListener("click",this.onClick_linkController.bind(e)),t.link.focusElement.addEventListener("input",this._onLinkPreview.bind(t.link.preview,t.link,t.options.linkProtocol)),t.dialog.modal.appendChild(n),t.element.relative.appendChild(i),n=null,i=null},setDialog:function(){const e=this.lang,t=this.util.createElement("DIV");return t.className="se-dialog-content",t.style.display="none",t.innerHTML='",t},setController_LinkButton:function(){const e=this.lang,t=this.icons,n=this.util.createElement("DIV");return n.className="se-controller se-controller-link",n.innerHTML='
    ",n},open:function(){this.plugins.dialog.open.call(this,"link","link"===this.currentControllerName)},_onLinkPreview:function(e,t,n){const i=n.target.value.trim();e._linkValue=this.textContent=i?t&&-1===i.indexOf("://")&&0!==i.indexOf("#")?t+i:-1===i.indexOf("://")?"/"+i:i:""},submit:function(e){this.showLoading(),e.preventDefault(),e.stopPropagation();const t=function(){const e=this.context.link;if(0===e._linkValue.length)return!1;const t=e._linkValue,n=e.linkAnchorText,i=0===n.value.length?t:n.value;if(this.context.dialog.updateModal){e._linkAnchor.href=t,e._linkAnchor.textContent=i,e._linkAnchor.target=e.linkNewWindowCheck.checked?"_blank":"";const n=e._linkAnchor.childNodes[0];this.setRange(n,0,n,n.textContent.length)}else{const n=this.util.createElement("A");n.href=t,n.textContent=i,n.target=e.linkNewWindowCheck.checked?"_blank":"";const l=this.getSelectedElements();if(l.length>1){const e=this.util.createElement(l[0].nodeName);if(e.appendChild(n),!this.insertNode(e,null,!0))return}else if(!this.insertNode(n,null,!0))return;this.setRange(n.childNodes[0],0,n.childNodes[0],n.textContent.length)}e._linkValue=e.preview.textContent=e.focusElement.value=e.linkAnchorText.value=""}.bind(this);try{t()}finally{this.plugins.dialog.close.call(this),this.closeLoading(),this.history.push(!1)}return!1},active:function(e){if(e){if(this.util.isAnchor(e)&&null===e.getAttribute("data-image-link"))return this.controllerArray.indexOf(this.context.link.linkController)<0&&this.plugins.link.call_controller.call(this,e),!0}else this.controllerArray.indexOf(this.context.link.linkController)>-1&&this.controllersOff();return!1},on:function(e){const t=this.context.link;e?t._linkAnchor&&(this.context.dialog.updateModal=!0,t._linkValue=t.preview.textContent=t.focusElement.value=t._linkAnchor.href,t.linkAnchorText.value=t._linkAnchor.textContent,t.linkNewWindowCheck.checked=!!/_blank/i.test(t._linkAnchor.target)):(this.plugins.link.init.call(this),t.linkAnchorText.value=this.getSelection().toString())},call_controller:function(e){this.editLink=this.context.link._linkAnchor=e;const t=this.context.link.linkController,n=t.querySelector("a");n.href=e.href,n.title=e.textContent,n.textContent=e.textContent;const i=this.util.getOffset(e,this.context.element.wysiwygFrame);t.style.top=i.top+e.offsetHeight+10+"px",t.style.left=i.left-this.context.element.wysiwygFrame.scrollLeft+"px",t.style.display="block";const l=this.context.element.wysiwygFrame.offsetWidth-(t.offsetLeft+t.offsetWidth);l<0?(t.style.left=t.offsetLeft+l+"px",t.firstElementChild.style.left=20-l+"px"):t.firstElementChild.style.left="20px",this.controllersOn(t,e,"link")},onClick_linkController:function(e){e.stopPropagation();const t=e.target.getAttribute("data-command")||e.target.parentNode.getAttribute("data-command");if(t){if(e.preventDefault(),/update/.test(t)){const e=this.context.link;e._linkValue=e.preview.textContent=e.focusElement.value=e._linkAnchor.href,e.linkAnchorText.value=e._linkAnchor.textContent,e.linkNewWindowCheck.checked=!!/_blank/i.test(e._linkAnchor.target),this.plugins.dialog.open.call(this,"link",!0)}else if(/unlink/.test(t)){const e=this.util.getChildElement(this.context.link._linkAnchor,(function(e){return 0===e.childNodes.length||3===e.nodeType}),!1),t=this.util.getChildElement(this.context.link._linkAnchor,(function(e){return 0===e.childNodes.length||3===e.nodeType}),!0);this.setRange(e,0,t,t.textContent.length),this.nodeChange(null,null,["A"],!1)}else this.util.removeItem(this.context.link._linkAnchor),this.context.link._linkAnchor=null,this.focus(),this.history.push(!1);this.controllersOff()}},init:function(){const e=this.context.link;e.linkController.style.display="none",e._linkAnchor=null,e._linkValue=e.preview.textContent=e.focusElement.value="",e.linkAnchorText.value="",e.linkNewWindowCheck.checked=!1}},d=n("ZED3"),u=n.n(d),h=n("ee5k"),g=n.n(h),p=n("gjS+"),m=n.n(p),f={name:"image",display:"dialog",add:function(e){e.addModule([r.a,u.a,g.a,m.a]);const t=e.context,n=t.image={_infoList:[],_infoIndex:0,_uploadFileLength:0,sizeUnit:t.option._imageSizeUnit,_altText:"",_linkElement:null,_align:"none",_floatClassRegExp:"__se__float\\-[a-z]+",_v_link:{_linkValue:""},_v_src:{_linkValue:""},svgDefaultSize:"30%",_element:null,_cover:null,_container:null,inputX:null,inputY:null,_element_w:1,_element_h:1,_element_l:0,_element_t:0,_defaultSizeX:"auto",_defaultSizeY:"auto",_origin_w:"auto"===t.option.imageWidth?"":t.option.imageWidth,_origin_h:"auto"===t.option.imageHeight?"":t.option.imageHeight,_proportionChecked:!0,_resizing:t.option.imageResizing,_resizeDotHide:!t.option.imageHeightShow,_rotation:t.option.imageRotation,_onlyPercentage:t.option.imageSizeOnlyPercentage,_ratio:!1,_ratioX:1,_ratioY:1,_captionShow:!0,_captionChecked:!1,_caption:null,captionCheckEl:null};let i=this.setDialog.call(e);n.modal=i,n.imgInputFile=i.querySelector("._se_image_file"),n.imgUrlFile=i.querySelector(".se-input-url"),n.focusElement=n.imgInputFile||n.imgUrlFile,n.altText=i.querySelector("._se_image_alt"),n.imgLink=i.querySelector("._se_image_link"),n.imgLinkNewWindowCheck=i.querySelector("._se_image_link_check"),n.captionCheckEl=i.querySelector("._se_image_check_caption"),n.previewLink=i.querySelector("._se_tab_content_url .se-link-preview"),n.previewSrc=i.querySelector("._se_tab_content_image .se-link-preview"),i.querySelector(".se-dialog-tabs").addEventListener("click",this.openTab.bind(e)),i.querySelector(".se-btn-primary").addEventListener("click",this.submit.bind(e)),n.imgInputFile&&i.querySelector(".se-file-remove").addEventListener("click",this._removeSelectedFiles.bind(n.imgInputFile,n.imgUrlFile,n.previewSrc)),n.imgInputFile&&n.imgUrlFile&&n.imgInputFile.addEventListener("change",this._fileInputChange.bind(n)),n.imgLink.addEventListener("input",this._onLinkPreview.bind(n.previewLink,n._v_link,t.options.linkProtocol)),n.imgUrlFile&&n.imgUrlFile.addEventListener("input",this._onLinkPreview.bind(n.previewSrc,n._v_src,t.options.linkProtocol));const l=i.querySelector(".__se__gallery");l&&l.addEventListener("click",this._openGallery.bind(e)),n.proportion={},n.inputX={},n.inputY={},t.option.imageResizing&&(n.proportion=i.querySelector("._se_image_check_proportion"),n.inputX=i.querySelector("._se_image_size_x"),n.inputY=i.querySelector("._se_image_size_y"),n.inputX.value=t.option.imageWidth,n.inputY.value=t.option.imageHeight,n.inputX.addEventListener("keyup",this.setInputSize.bind(e,"x")),n.inputY.addEventListener("keyup",this.setInputSize.bind(e,"y")),n.inputX.addEventListener("change",this.setRatio.bind(e)),n.inputY.addEventListener("change",this.setRatio.bind(e)),n.proportion.addEventListener("change",this.setRatio.bind(e)),i.querySelector(".se-dialog-btn-revert").addEventListener("click",this.sizeRevert.bind(e))),t.dialog.modal.appendChild(i),i=null},setDialog:function(){const e=this.context.option,t=this.lang,n=this.util.createElement("DIV");n.className="se-dialog-content",n.style.display="none";let i='
    '+t.dialogBox.imageBox.title+'
    ';if(e.imageFileInput&&(i+='
    "),e.imageUrlInput&&(i+='
    '+(e.imageGalleryUrl&&this.plugins.imageGallery?'":"")+'
    '),i+='
    ',e.imageResizing){const n=e.imageSizeOnlyPercentage,l=n?' style="display: none !important;"':"",o=e.imageHeightShow?"":' style="display: none !important;"';i+='
    ',n||!e.imageHeightShow?i+='
    ":i+='
    ",i+=' '+t.dialogBox.proportion+'
    "}return i+='
    ",n.innerHTML=i,n},_fileInputChange:function(){this.imgInputFile.value?(this.imgUrlFile.setAttribute("disabled",!0),this.previewSrc.style.textDecoration="line-through"):(this.imgUrlFile.removeAttribute("disabled"),this.previewSrc.style.textDecoration="")},_removeSelectedFiles:function(e,t){this.value="",e&&(e.removeAttribute("disabled"),t.style.textDecoration="")},_openGallery:function(){this.callPlugin("imageGallery",this.plugins.imageGallery.open.bind(this,this.plugins.image._setUrlInput.bind(this.context.image)),null)},_setUrlInput:function(e){this.altText.value=e.alt,this._v_src._linkValue=this.previewSrc.textContent=this.imgUrlFile.value=e.src,this.imgUrlFile.focus()},_onLinkPreview:function(e,t,n){const i=n.target.value.trim();e._linkValue=this.textContent=i?t&&-1===i.indexOf("://")&&0!==i.indexOf("#")?t+i:-1===i.indexOf("://")?"/"+i:i:""},fileTags:["img"],select:function(e){this.plugins.image.onModifyMode.call(this,e,this.plugins.resizing.call_controller_resize.call(this,e,"image"))},destroy:function(e){const t=e||this.context.image._element,n=this.util.getParentElement(t,this.util.isMediaComponent)||t,i=1*t.getAttribute("data-index");let l=n.previousElementSibling||n.nextElementSibling;const o=n.parentNode;this.util.removeItem(n),this.plugins.image.init.call(this),this.controllersOff(),o!==this.context.element.wysiwyg&&this.util.removeItemAllParents(o,(function(e){return 0===e.childNodes.length}),null),this.focusEdge(l),this.plugins.fileManager.deleteInfo.call(this,"image",i,this.functions.onImageUpload),this.history.push(!1)},on:function(e){const t=this.context.image;e?t.imgInputFile&&this.context.options.imageMultipleFile&&t.imgInputFile.removeAttribute("multiple"):(t.inputX.value=t._origin_w=this.context.option.imageWidth===t._defaultSizeX?"":this.context.option.imageWidth,t.inputY.value=t._origin_h=this.context.option.imageHeight===t._defaultSizeY?"":this.context.option.imageHeight,t.imgInputFile&&this.context.options.imageMultipleFile&&t.imgInputFile.setAttribute("multiple","multiple"))},open:function(){this.plugins.dialog.open.call(this,"image","image"===this.currentControllerName)},openTab:function(e){const t=this.context.image.modal,n="init"===e?t.querySelector("._se_tab_link"):e.target;if(!/^BUTTON$/i.test(n.tagName))return!1;const i=n.getAttribute("data-tab-link");let l,o,s;for(o=t.getElementsByClassName("_se_tab_content"),l=0;l0?(this.showLoading(),n.submitAction.call(this,this.context.image.imgInputFile.files)):t.imgUrlFile&&t._v_src._linkValue.length>0&&(this.showLoading(),n.onRender_imgUrl.call(this))}catch(e){throw this.closeLoading(),Error('[SUNEDITOR.image.submit.fail] cause : "'+e.message+'"')}finally{this.plugins.dialog.close.call(this)}return!1},submitAction:function(e){if(0===e.length)return;let t=0,n=[];for(let i=0,l=e.length;i0){let e=0;const n=this.context.image._infoList;for(let t=0,i=n.length;ti){this.closeLoading();const n="[SUNEDITOR.imageUpload.fail] Size of uploadable total images: "+i/1e3+"KB";return void(("function"!==this.functions.onImageUploadError||this.functions.onImageUploadError(n,{limitSize:i,currentSize:e,uploadSize:t},this))&&this.functions.noticeOpen(n))}}const l=this.context.image;l._uploadFileLength=n.length;const o={linkValue:l._v_link._linkValue,linkNewWindow:l.imgLinkNewWindowCheck.checked,inputWidth:l.inputX.value,inputHeight:l.inputY.value,align:l._align,isUpdate:this.context.dialog.updateModal,element:l._element};if("function"==typeof this.functions.onImageUploadBefore){const e=this.functions.onImageUploadBefore(n,o,this,function(e){e&&this._w.Array.isArray(e.result)?this.plugins.image.register.call(this,o,e):this.plugins.image.upload.call(this,o,e)}.bind(this));if(void 0===e)return;if(!e)return void this.closeLoading();this._w.Array.isArray(e)&&e.length>0&&(n=e)}this.plugins.image.upload.call(this,o,n)},error:function(e,t){if(this.closeLoading(),"function"!=typeof this.functions.onImageUploadError||this.functions.onImageUploadError(e,t,this))throw this.functions.noticeOpen(e),Error("[SUNEDITOR.plugin.image.error] response: "+e)},upload:function(e,t){if(!t)return void this.closeLoading();if("string"==typeof t)return void this.plugins.image.error.call(this,t,null);const n=this.context.option.imageUploadUrl,i=this.context.dialog.updateModal?1:t.length;if("string"==typeof n&&n.length>0){const l=new FormData;for(let e=0;e0){const i=this.util.createElement("A");return i.href=/^https?:\/\//.test(t)?t:"http://"+t,i.target=n?"_blank":"",i.setAttribute("data-image-link","image"),e.setAttribute("data-image-link",t),i.appendChild(e),i}return e},setInputSize:function(e,t){t&&32===t.keyCode?t.preventDefault():this.plugins.resizing._module_setInputSize.call(this,this.context.image,e)},setRatio:function(){this.plugins.resizing._module_setRatio.call(this,this.context.image)},checkFileInfo:function(){const e=this.plugins.image,t=function(t){e.onModifyMode.call(this,t,null),e.openModify.call(this,!0),e.update_image.call(this,!0,!1,!0)}.bind(this);this.plugins.fileManager.checkInfo.call(this,"image",["img"],this.functions.onImageUpload,t,!0)},resetFileInfo:function(){this.plugins.fileManager.resetInfo.call(this,"image",this.functions.onImageUpload)},create_image:function(e,t,n,i,l,o,s){const a=this.plugins.image,r=this.context.image;this.context.resizing._resize_plugin="image";let c=this.util.createElement("IMG");c.src=e,c.alt=r._altText,c=a.onRender_link.call(this,c,t,n),c.setAttribute("data-rotate","0"),r._resizing&&c.setAttribute("data-proportion",r._proportionChecked);const d=this.plugins.component.set_cover.call(this,c),u=this.plugins.component.set_container.call(this,d,"se-image-container");r._captionChecked&&(r._caption=this.plugins.component.create_caption.call(this),r._caption.setAttribute("contenteditable",!1),d.appendChild(r._caption)),r._element=c,r._cover=d,r._container=u,a.applySize.call(this,i,l),a.setAlign.call(this,o,c,d,u),c.onload=a._image_create_onload.bind(this,c,r.svgDefaultSize),this.insertComponent(u,!0,!0,!0)&&this.plugins.fileManager.setInfo.call(this,"image",c,this.functions.onImageUpload,s,!0),this.context.resizing._resize_plugin=""},_image_create_onload:function(e,t){0===e.offsetWidth&&this.plugins.image.applySize.call(this,t,""),this.selectComponent.call(this,e,"image")},update_image:function(e,t,n){const i=this.context.image,l=i._v_link._linkValue;let o,s=i._element,a=i._cover,r=i._container,c=!1;null===a&&(c=!0,s=i._element.cloneNode(!0),a=this.plugins.component.set_cover.call(this,s)),null===r?(a=a.cloneNode(!0),s=a.querySelector("img"),c=!0,r=this.plugins.component.set_container.call(this,a,"se-image-container")):c&&(r.innerHTML="",r.appendChild(a),i._cover=a,i._element=s,c=!1);const d=this.util.isNumber(i.inputX.value)?i.inputX.value+i.sizeUnit:i.inputX.value,u=this.util.isNumber(i.inputY.value)?i.inputY.value+i.sizeUnit:i.inputY.value;o=/%$/.test(s.style.width)?d!==r.style.width||u!==r.style.height:d!==s.style.width||u!==s.style.height,s.alt=i._altText;let h=!1;if(i._captionChecked?i._caption||(i._caption=this.plugins.component.create_caption.call(this),a.appendChild(i._caption),h=!0):i._caption&&(this.util.removeItem(i._caption),i._caption=null,h=!0),l.trim().length>0)if(null!==i._linkElement&&a.contains(i._linkElement))i._linkElement.href=l,i._linkElement.target=i.imgLinkNewWindowCheck.checked?"_blank":"",s.setAttribute("data-image-link",l);else{let e=this.plugins.image.onRender_link.call(this,s,l,this.context.image.imgLinkNewWindowCheck.checked);a.insertBefore(e,i._caption)}else if(null!==i._linkElement){const e=s;e.setAttribute("data-image-link","");let t=e.cloneNode(!0);a.removeChild(i._linkElement),a.insertBefore(t,i._caption),s=t}if(c){const e=this.util.isRangeFormatElement(i._element.parentNode)||this.util.isWysiwygDiv(i._element.parentNode)?i._element:/^A$/i.test(i._element.parentNode.nodeName)?i._element.parentNode:this.util.getFormatElement(i._element)||i._element;e.parentNode.replaceChild(r,e),s=r.querySelector("img"),i._element=s,i._cover=a,i._container=r}(h||!i._onlyPercentage&&o)&&!e&&(/\d+/.test(s.style.height)||this.context.resizing._rotateVertical&&i._captionChecked)&&(/%$/.test(i.inputX.value)||/%$/.test(i.inputY.value)?this.plugins.resizing.resetTransform.call(this,s):this.plugins.resizing.setTransformSize.call(this,s,this.util.getNumber(i.inputX.value,0),this.util.getNumber(i.inputY.value,0)));i._resizing&&(s.setAttribute("data-proportion",i._proportionChecked),o&&this.plugins.image.applySize.call(this)),this.plugins.image.setAlign.call(this,null,s,null,null),e&&this.plugins.fileManager.setInfo.call(this,"image",s,this.functions.onImageUpload,null,!0),t&&this.selectComponent(s,"image"),n||this.history.push(!1)},update_src:function(e,t,n){t.src=e,this._w.setTimeout(this.plugins.fileManager.setInfo.bind(this,"image",t,this.functions.onImageUpload,n,!0)),this.selectComponent(t,"image")},onModifyMode:function(e,t){if(!e)return;const n=this.context.image;n._linkElement=/^A$/i.test(e.parentNode.nodeName)?e.parentNode:null,n._element=e,n._cover=this.util.getParentElement(e,"FIGURE"),n._container=this.util.getParentElement(e,this.util.isMediaComponent),n._caption=this.util.getChildElement(n._cover,"FIGCAPTION"),n._align=e.getAttribute("data-align")||"none",t&&(n._element_w=t.w,n._element_h=t.h,n._element_t=t.t,n._element_l=t.l);let i=n._element.getAttribute("data-size")||n._element.getAttribute("data-origin");i?(i=i.split(","),n._origin_w=i[0],n._origin_h=i[1]):t&&(n._origin_w=t.w,n._origin_h=t.h)},openModify:function(e){const t=this.context.image;t.imgUrlFile&&(t._v_src._linkValue=t.previewSrc.textContent=t.imgUrlFile.value=t._element.src),t._altText=t.altText.value=t._element.alt,t._v_link._linkValue=t.previewLink.textContent=t.imgLink.value=null===t._linkElement?"":t._linkElement.href,t.imgLinkNewWindowCheck.checked=t._linkElement&&"_blank"===t._linkElement.target,t.modal.querySelector('input[name="suneditor_image_radio"][value="'+t._align+'"]').checked=!0,t._align=t.modal.querySelector('input[name="suneditor_image_radio"]:checked').value,t._captionChecked=t.captionCheckEl.checked=!!t._caption,t._resizing&&this.plugins.resizing._module_setModifyInputSize.call(this,t,this.plugins.image),e||this.plugins.dialog.open.call(this,"image",!0)},sizeRevert:function(){this.plugins.resizing._module_sizeRevert.call(this,this.context.image)},applySize:function(e,t){const n=this.context.image;return e||(e=n.inputX.value||this.context.option.imageWidth),t||(t=n.inputY.value||this.context.option.imageHeight),n._onlyPercentage&&e||/%$/.test(e)?(this.plugins.image.setPercentSize.call(this,e,t),!0):(e&&"auto"!==e||t&&"auto"!==t?this.plugins.image.setSize.call(this,e,t,!1):this.plugins.image.setAutoSize.call(this),!1)},setSize:function(e,t,n,i){const l=this.context.image,o=/^(rw|lw)$/.test(i),s=/^(th|bh)$/.test(i);this.plugins.image.cancelPercentAttr.call(this),s||(l._element.style.width=this.util.isNumber(e)?e+l.sizeUnit:e),o||(l._element.style.height=this.util.isNumber(t)?t+l.sizeUnit:/%$/.test(t)?"":t),"center"===l._align&&this.plugins.image.setAlign.call(this,null,null,null,null),n||l._element.removeAttribute("data-percentage"),this.plugins.resizing._module_saveCurrentSize.call(this,l)},setAutoSize:function(){const e=this.context.image;this.plugins.resizing.resetTransform.call(this,e._element),this.plugins.image.cancelPercentAttr.call(this),e._element.style.maxWidth="",e._element.style.width="",e._element.style.height="",e._cover.style.width="",e._cover.style.height="",this.plugins.image.setAlign.call(this,null,null,null,null),e._element.setAttribute("data-percentage","auto,auto"),this.plugins.resizing._module_saveCurrentSize.call(this,e)},setOriginSize:function(){const e=this.context.image;e._element.removeAttribute("data-percentage"),this.plugins.resizing.resetTransform.call(this,e._element),this.plugins.image.cancelPercentAttr.call(this);const t=(e._element.getAttribute("data-origin")||"").split(","),n=t[0],i=t[1];t&&(e._onlyPercentage||/%$/.test(n)&&(/%$/.test(i)||!/\d/.test(i))?this.plugins.image.setPercentSize.call(this,n,i):this.plugins.image.setSize.call(this,n,i),this.plugins.resizing._module_saveCurrentSize.call(this,e))},setPercentSize:function(e,t){const n=this.context.image;t=!t||/%$/.test(t)||this.util.getNumber(t,0)?this.util.isNumber(t)?t+n.sizeUnit:t||"":this.util.isNumber(t)?t+"%":t;const i=/%$/.test(t);n._container.style.width=this.util.isNumber(e)?e+"%":e,n._container.style.height="",n._cover.style.width="100%",n._cover.style.height=i?t:"",n._element.style.width="100%",n._element.style.height=i?"":t,n._element.style.maxWidth="","center"===n._align&&this.plugins.image.setAlign.call(this,null,null,null,null),n._element.setAttribute("data-percentage",e+","+t),this.plugins.resizing.setCaptionPosition.call(this,n._element),this.plugins.resizing._module_saveCurrentSize.call(this,n)},cancelPercentAttr:function(){const e=this.context.image;e._cover.style.width="",e._cover.style.height="",e._container.style.width="",e._container.style.height="",this.util.removeClass(e._container,this.context.image._floatClassRegExp),this.util.addClass(e._container,"__se__float-"+e._align),"center"===e._align&&this.plugins.image.setAlign.call(this,null,null,null,null)},setAlign:function(e,t,n,i){const l=this.context.image;e||(e=l._align),t||(t=l._element),n||(n=l._cover),i||(i=l._container),n.style.margin=e&&"none"!==e?"auto":"0",/%$/.test(t.style.width)&&"center"===e?(i.style.minWidth="100%",n.style.width=i.style.width):(i.style.minWidth="",n.style.width=this.context.resizing._rotateVertical?t.style.height||t.offsetHeight:t.style.width&&"auto"!==t.style.width?t.style.width||"100%":""),this.util.hasClass(i,"__se__float-"+e)||(this.util.removeClass(i,l._floatClassRegExp),this.util.addClass(i,"__se__float-"+e)),t.setAttribute("data-align",e)},resetAlign:function(){const e=this.context.image;e._element.setAttribute("data-align",""),e._align="none",e._cover.style.margin="0",this.util.removeClass(e._container,e._floatClassRegExp)},init:function(){const e=this.context.image;e.imgInputFile&&(e.imgInputFile.value=""),e.imgUrlFile&&(e._v_src._linkValue=e.previewSrc.textContent=e.imgUrlFile.value=""),e.imgInputFile&&e.imgUrlFile&&(e.imgUrlFile.removeAttribute("disabled"),e.previewSrc.style.textDecoration=""),e.altText.value="",e._v_link._linkValue=e.previewLink.textContent=e.imgLink.value="",e.imgLinkNewWindowCheck.checked=!1,e.modal.querySelector('input[name="suneditor_image_radio"][value="none"]').checked=!0,e.captionCheckEl.checked=!1,e._element=null,this.plugins.image.openTab.call(this,"init"),e._resizing&&(e.inputX.value=this.context.option.imageWidth===e._defaultSizeX?"":this.context.option.imageWidth,e.inputY.value=this.context.option.imageHeight===e._defaultSizeY?"":this.context.option.imageHeight,e.proportion.checked=!0,e._ratio=!1,e._ratioX=1,e._ratioY=1)}},_={name:"video",display:"dialog",add:function(e){e.addModule([r.a,u.a,g.a,m.a]);const t=e.context,n=t.video={_infoList:[],_infoIndex:0,_uploadFileLength:0,sizeUnit:t.option._videoSizeUnit,_align:"none",_floatClassRegExp:"__se__float\\-[a-z]+",_youtubeQuery:t.option.youtubeQuery,_videoRatio:100*t.option.videoRatio+"%",_defaultRatio:100*t.option.videoRatio+"%",_linkValue:"",_element:null,_cover:null,_container:null,inputX:null,inputY:null,_element_w:1,_element_h:1,_element_l:0,_element_t:0,_defaultSizeX:"100%",_defaultSizeY:100*t.option.videoRatio+"%",_origin_w:"100%"===t.option.videoWidth?"":t.option.videoWidth,_origin_h:"56.25%"===t.option.videoHeight?"":t.option.videoHeight,_proportionChecked:!0,_resizing:t.option.videoResizing,_resizeDotHide:!t.option.videoHeightShow,_rotation:t.option.videoRotation,_onlyPercentage:t.option.videoSizeOnlyPercentage,_ratio:!1,_ratioX:1,_ratioY:1,_captionShow:!1};let i=this.setDialog.call(e);n.modal=i,n.videoInputFile=i.querySelector("._se_video_file"),n.videoUrlFile=i.querySelector(".se-input-url"),n.focusElement=n.videoUrlFile||n.videoInputFile,n.preview=i.querySelector(".se-link-preview"),i.querySelector(".se-btn-primary").addEventListener("click",this.submit.bind(e)),n.videoInputFile&&i.querySelector(".se-dialog-files-edge-button").addEventListener("click",this._removeSelectedFiles.bind(n.videoInputFile,n.videoUrlFile,n.preview)),n.videoInputFile&&n.videoUrlFile&&n.videoInputFile.addEventListener("change",this._fileInputChange.bind(n)),n.videoUrlFile&&n.videoUrlFile.addEventListener("input",this._onLinkPreview.bind(n.preview,n,t.options.linkProtocol)),n.proportion={},n.videoRatioOption={},n.inputX={},n.inputY={},t.option.videoResizing&&(n.proportion=i.querySelector("._se_video_check_proportion"),n.videoRatioOption=i.querySelector(".se-video-ratio"),n.inputX=i.querySelector("._se_video_size_x"),n.inputY=i.querySelector("._se_video_size_y"),n.inputX.value=t.option.videoWidth,n.inputY.value=t.option.videoHeight,n.inputX.addEventListener("keyup",this.setInputSize.bind(e,"x")),n.inputY.addEventListener("keyup",this.setInputSize.bind(e,"y")),n.inputX.addEventListener("change",this.setRatio.bind(e)),n.inputY.addEventListener("change",this.setRatio.bind(e)),n.proportion.addEventListener("change",this.setRatio.bind(e)),n.videoRatioOption.addEventListener("change",this.setVideoRatio.bind(e)),i.querySelector(".se-dialog-btn-revert").addEventListener("click",this.sizeRevert.bind(e))),t.dialog.modal.appendChild(i),i=null},setDialog:function(){const e=this.context.option,t=this.lang,n=this.util.createElement("DIV");n.className="se-dialog-content",n.style.display="none";let i='
    '+t.dialogBox.videoBox.title+'
    ';if(e.videoFileInput&&(i+='
    "),e.videoUrlInput&&(i+='
    '),e.videoResizing){const n=e.videoRatioList||[{name:"16:9",value:.5625},{name:"4:3",value:.75},{name:"21:9",value:.4285}],l=e.videoRatio,o=e.videoSizeOnlyPercentage,s=o?' style="display: none !important;"':"",a=e.videoHeightShow?"":' style="display: none !important;"',r=e.videoRatioShow?"":' style="display: none !important;"',c=o||e.videoHeightShow||e.videoRatioShow?"":' style="display: none !important;"';i+='
    "}return i+='
    ",n.innerHTML=i,n},_fileInputChange:function(){this.videoInputFile.value?(this.videoUrlFile.setAttribute("disabled",!0),this.preview.style.textDecoration="line-through"):(this.videoUrlFile.removeAttribute("disabled"),this.preview.style.textDecoration="")},_removeSelectedFiles:function(e,t){this.value="",e&&(e.removeAttribute("disabled"),t.style.textDecoration="")},_onLinkPreview:function(e,t,n){const i=n.target.value.trim();/^$/.test(i)?(e._linkValue=i,this.textContent=''):e._linkValue=this.textContent=i?t&&-1===i.indexOf("://")&&0!==i.indexOf("#")?t+i:-1===i.indexOf("://")?"/"+i:i:""},_setTagAttrs:function(e){e.setAttribute("controls",!0);const t=this.context.options.videoTagAttrs;if(t)for(let n in t)this.util.hasOwn(t,n)&&e.setAttribute(n,t[n])},createVideoTag:function(){const e=this.util.createElement("VIDEO");return this.plugins.video._setTagAttrs.call(this,e),e},_setIframeAttrs:function(e){e.frameBorder="0",e.allowFullscreen=!0;const t=this.context.options.videoIframeAttrs;if(t)for(let n in t)this.util.hasOwn(t,n)&&e.setAttribute(n,t[n])},createIframeTag:function(){const e=this.util.createElement("IFRAME");return this.plugins.video._setIframeAttrs.call(this,e),e},fileTags:["iframe","video"],select:function(e){this.plugins.video.onModifyMode.call(this,e,this.plugins.resizing.call_controller_resize.call(this,e,"video"))},destroy:function(e){const t=e||this.context.video._element,n=this.context.video._container,i=1*t.getAttribute("data-index");let l=n.previousElementSibling||n.nextElementSibling;const o=n.parentNode;this.util.removeItem(n),this.plugins.video.init.call(this),this.controllersOff(),o!==this.context.element.wysiwyg&&this.util.removeItemAllParents(o,(function(e){return 0===e.childNodes.length}),null),this.focusEdge(l),this.plugins.fileManager.deleteInfo.call(this,"video",i,this.functions.onVideoUpload),this.history.push(!1)},on:function(e){const t=this.context.video;e?t.videoInputFile&&this.context.options.videoMultipleFile&&t.videoInputFile.removeAttribute("multiple"):(t.inputX.value=t._origin_w=this.context.option.videoWidth===t._defaultSizeX?"":this.context.option.videoWidth,t.inputY.value=t._origin_h=this.context.option.videoHeight===t._defaultSizeY?"":this.context.option.videoHeight,t.proportion.disabled=!0,t.videoInputFile&&this.context.options.videoMultipleFile&&t.videoInputFile.setAttribute("multiple","multiple")),t._resizing&&this.plugins.video.setVideoRatioSelect.call(this,t._origin_h||t._defaultRatio)},open:function(){this.plugins.dialog.open.call(this,"video","video"===this.currentControllerName)},setVideoRatio:function(e){const t=this.context.video,n=e.target.options[e.target.selectedIndex].value;t._defaultSizeY=t._videoRatio=n?100*n+"%":t._defaultSizeY,t.inputY.placeholder=n?100*n+"%":"",t.inputY.value=""},setInputSize:function(e,t){if(t&&32===t.keyCode)return void t.preventDefault();const n=this.context.video;this.plugins.resizing._module_setInputSize.call(this,n,e),"y"===e&&this.plugins.video.setVideoRatioSelect.call(this,t.target.value||n._defaultRatio)},setRatio:function(){this.plugins.resizing._module_setRatio.call(this,this.context.video)},submit:function(e){const t=this.context.video,n=this.plugins.video;e.preventDefault(),e.stopPropagation(),t._align=t.modal.querySelector('input[name="suneditor_video_radio"]:checked').value;try{t.videoInputFile&&t.videoInputFile.files.length>0?(this.showLoading(),n.submitAction.call(this,this.context.video.videoInputFile.files)):t.videoUrlFile&&t._linkValue.length>0&&(this.showLoading(),n.setup_url.call(this))}catch(e){throw this.closeLoading(),Error('[SUNEDITOR.video.submit.fail] cause : "'+e.message+'"')}finally{this.plugins.dialog.close.call(this)}return!1},submitAction:function(e){if(0===e.length)return;let t=0,n=[];for(let i=0,l=e.length;i0){let e=0;const n=this.context.video._infoList;for(let t=0,i=n.length;ti){this.closeLoading();const n="[SUNEDITOR.videoUpload.fail] Size of uploadable total videos: "+i/1e3+"KB";return void(("function"!==this.functions.onVideoUploadError||this.functions.onVideoUploadError(n,{limitSize:i,currentSize:e,uploadSize:t},this))&&this.functions.noticeOpen(n))}}const l=this.context.video;l._uploadFileLength=n.length;const o={inputWidth:l.inputX.value,inputHeight:l.inputY.value,align:l._align,isUpdate:this.context.dialog.updateModal,element:l._element};if("function"==typeof this.functions.onVideoUploadBefore){const e=this.functions.onVideoUploadBefore(n,o,this,function(e){e&&this._w.Array.isArray(e.result)?this.plugins.video.register.call(this,o,e):this.plugins.video.upload.call(this,o,e)}.bind(this));if(void 0===e)return;if(!e)return void this.closeLoading();"object"==typeof e&&e.length>0&&(n=e)}this.plugins.video.upload.call(this,o,n)},error:function(e,t){if(this.closeLoading(),"function"!=typeof this.functions.onVideoUploadError||this.functions.onVideoUploadError(e,t,this))throw this.functions.noticeOpen(e),Error("[SUNEDITOR.plugin.video.error] response: "+e)},upload:function(e,t){if(!t)return void this.closeLoading();if("string"==typeof t)return void this.plugins.video.error.call(this,t,null);const n=this.context.option.videoUploadUrl,i=this.context.dialog.updateModal?1:t.length;if(!("string"==typeof n&&n.length>0))throw Error('[SUNEDITOR.videoUpload.fail] cause : There is no "videoUploadUrl" option.');{const l=new FormData;for(let e=0;e$/.test(t)){if(t=(new this._w.DOMParser).parseFromString(t,"text/html").querySelector("iframe").src,0===t.length)return!1}if(/youtu\.?be/.test(t)){if(/^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("&","?&")),e._youtubeQuery.length>0)if(/\?/.test(t)){const n=t.split("?");t=n[0]+"?"+e._youtubeQuery+"&"+n[1]}else t+="?"+e._youtubeQuery}else/vimeo\.com/.test(t)&&(t.endsWith("/")&&(t=t.slice(0,-1)),t="https://player.vimeo.com/video/"+t.slice(t.lastIndexOf("/")+1));this.plugins.video.create_video.call(this,this.plugins.video.createIframeTag.call(this),t,e.inputX.value,e.inputY.value,e._align,null,this.context.dialog.updateModal)}catch(e){throw Error('[SUNEDITOR.video.upload.fail] cause : "'+e.message+'"')}finally{this.closeLoading()}},create_video:function(e,t,n,i,l,o,s){this.context.resizing._resize_plugin="video";const a=this.context.video;let r=null,c=null,d=!1;if(s){if((e=a._element).src!==t){d=!0;const n=/youtu\.?be/.test(t),i=/vimeo\.com/.test(t);if(!n&&!i||/^iframe$/i.test(e.nodeName))if(n||i||/^videoo$/i.test(e.nodeName))e.src=t;else{const n=this.plugins.video.createVideoTag.call(this);n.src=t,e.parentNode.replaceChild(n,e),a._element=e=n}else{const n=this.plugins.video.createIframeTag.call(this);n.src=t,e.parentNode.replaceChild(n,e),a._element=e=n}}c=a._container,r=this.util.getParentElement(e,"FIGURE")}else d=!0,e.src=t,a._element=e,r=this.plugins.component.set_cover.call(this,e),c=this.plugins.component.set_container.call(this,r,"se-video-container");a._cover=r,a._container=c;const u=this.plugins.resizing._module_getSizeX.call(this,a)!==(n||a._defaultSizeX)||this.plugins.resizing._module_getSizeY.call(this,a)!==(i||a._videoRatio),h=!s||u;a._resizing&&(this.context.video._proportionChecked=a.proportion.checked,e.setAttribute("data-proportion",a._proportionChecked));let g=!1;h&&(g=this.plugins.video.applySize.call(this)),g&&"center"===l||this.plugins.video.setAlign.call(this,null,e,r,c);let p=!0;s?a._resizing&&this.context.resizing._rotateVertical&&h&&this.plugins.resizing.setTransformSize.call(this,e,null,null):p=this.insertComponent(c,!1,!0,!1),p&&(d&&this.plugins.fileManager.setInfo.call(this,"video",e,this.functions.onVideoUpload,o,!0),s&&(this.selectComponent(e,"video"),this.history.push(!1))),this.context.resizing._resize_plugin=""},_update_videoCover:function(e){if(!e)return;const t=this.context.video;/^video$/i.test(e.nodeName)?this.plugins.video._setTagAttrs.call(this,e):this.plugins.video._setIframeAttrs.call(this,e);const n=this.util.getParentElement(e,this.util.isMediaComponent)||this.util.getParentElement(e,function(e){return this.isWysiwygDiv(e.parentNode)}.bind(this.util));t._element=e=e.cloneNode(!0);const i=t._cover=this.plugins.component.set_cover.call(this,e),l=t._container=this.plugins.component.set_container.call(this,i,"se-video-container"),o=n.querySelector("figcaption");let s=null;o&&(s=this.util.createElement("DIV"),s.innerHTML=o.innerHTML,this.util.removeItem(o));const a=(e.getAttribute("data-size")||e.getAttribute("data-origin")||"").split(",");this.plugins.video.applySize.call(this,a[0],a[1]),n.parentNode.replaceChild(l,n),s&&n.parentNode.insertBefore(s,l.nextElementSibling),this.plugins.fileManager.setInfo.call(this,"video",e,this.functions.onVideoUpload,null,!0)},onModifyMode:function(e,t){const n=this.context.video;n._element=e,n._cover=this.util.getParentElement(e,"FIGURE"),n._container=this.util.getParentElement(e,this.util.isMediaComponent),n._align=e.getAttribute("data-align")||"none",t&&(n._element_w=t.w,n._element_h=t.h,n._element_t=t.t,n._element_l=t.l);let i=n._element.getAttribute("data-size")||n._element.getAttribute("data-origin");i?(i=i.split(","),n._origin_w=i[0],n._origin_h=i[1]):t&&(n._origin_w=t.w,n._origin_h=t.h)},openModify:function(e){const t=this.context.video;if(t.videoUrlFile&&(t._linkValue=t.preview.textContent=t.videoUrlFile.value=t._element.src||(t._element.querySelector("source")||"").src||""),t.modal.querySelector('input[name="suneditor_video_radio"][value="'+t._align+'"]').checked=!0,t._resizing){this.plugins.resizing._module_setModifyInputSize.call(this,t,this.plugins.video);const e=t._videoRatio=this.plugins.resizing._module_getSizeY.call(this,t);this.plugins.video.setVideoRatioSelect.call(this,e)||(t.inputY.value=t._onlyPercentage?this.util.getNumber(e,2):e)}e||this.plugins.dialog.open.call(this,"video",!0)},setVideoRatioSelect:function(e){let t=!1;const n=this.context.video,i=n.videoRatioOption.options;/%$/.test(e)||n._onlyPercentage?e=this.util.getNumber(e,2)/100+"":(!this.util.isNumber(e)||1*e>=1)&&(e=""),n.inputY.placeholder="";for(let l=0,o=i.length;l'+this.icons.cancel+''+t.dialogBox.audioBox.title+'
    ';return e.audioFileInput&&(i+='
    "),e.audioUrlInput&&(i+='
    '),i+='
    ",n.innerHTML=i,n},setController:function(){const e=this.lang,t=this.icons,n=this.util.createElement("DIV");return n.className="se-controller se-controller-link",n.innerHTML='
    ",n},_fileInputChange:function(){this.audioInputFile.value?(this.audioUrlFile.setAttribute("disabled",!0),this.preview.style.textDecoration="line-through"):(this.audioUrlFile.removeAttribute("disabled"),this.preview.style.textDecoration="")},_removeSelectedFiles:function(e,t){this.value="",e&&(e.removeAttribute("disabled"),t.style.textDecoration="")},_createAudioTag:function(){const e=this.util.createElement("AUDIO");this.plugins.audio._setTagAttrs.call(this,e);const t=this.context.audio._origin_w,n=this.context.audio._origin_h;return e.setAttribute("origin-size",t+","+n),e.style.cssText=(t?"width:"+t+"; ":"")+(n?"height:"+n+";":""),e},_setTagAttrs:function(e){e.setAttribute("controls",!0);const t=this.context.options.audioTagAttrs;if(t)for(let n in t)this.util.hasOwn(t,n)&&e.setAttribute(n,t[n])},_onLinkPreview:function(e,t,n){const i=n.target.value.trim();e._linkValue=this.textContent=i?t&&-1===i.indexOf("://")&&0!==i.indexOf("#")?t+i:-1===i.indexOf("://")?"/"+i:i:""},fileTags:["audio"],select:function(e){this.plugins.audio.onModifyMode.call(this,e)},destroy:function(e){e=e||this.context.audio._element;const t=this.util.getParentElement(e,this.util.isComponent)||e,n=1*e.getAttribute("data-index"),i=t.previousElementSibling||t.nextElementSibling,l=t.parentNode;this.util.removeItem(t),this.plugins.audio.init.call(this),this.controllersOff(),l!==this.context.element.wysiwyg&&this.util.removeItemAllParents(l,(function(e){return 0===e.childNodes.length}),null),this.focusEdge(i),this.plugins.fileManager.deleteInfo.call(this,"audio",n,this.functions.onAudioUpload),this.history.push(!1)},checkFileInfo:function(){this.plugins.fileManager.checkInfo.call(this,"audio",["audio"],this.functions.onAudioUpload,this.plugins.audio.updateCover.bind(this),!1)},resetFileInfo:function(){this.plugins.fileManager.resetInfo.call(this,"audio",this.functions.onAudioUpload)},on:function(e){const t=this.context.audio;e?t._element?(this.context.dialog.updateModal=!0,t._linkValue=t.preview.textContent=t.audioUrlFile.value=t._element.src,t.audioInputFile&&this.context.options.audioMultipleFile&&t.audioInputFile.removeAttribute("multiple")):t.audioInputFile&&this.context.options.audioMultipleFile&&t.audioInputFile.removeAttribute("multiple"):(this.plugins.audio.init.call(this),t.audioInputFile&&this.context.options.audioMultipleFile&&t.audioInputFile.setAttribute("multiple","multiple"))},open:function(){this.plugins.dialog.open.call(this,"audio","audio"===this.currentControllerName)},submit:function(e){const t=this.context.audio;e.preventDefault(),e.stopPropagation();try{t.audioInputFile&&t.audioInputFile.files.length>0?(this.showLoading(),this.plugins.audio.submitAction.call(this,t.audioInputFile.files)):t.audioUrlFile&&t._linkValue.length>0&&(this.showLoading(),this.plugins.audio.setupUrl.call(this,t._linkValue))}catch(e){throw this.closeLoading(),Error('[SUNEDITOR.audio.submit.fail] cause : "'+e.message+'"')}finally{this.plugins.dialog.close.call(this)}return!1},submitAction:function(e){if(0===e.length)return;let t=0,n=[];for(let i=0,l=e.length;i0){let e=0;const n=this.context.audio._infoList;for(let t=0,i=n.length;ti){this.closeLoading();const n="[SUNEDITOR.audioUpload.fail] Size of uploadable total audios: "+i/1e3+"KB";return void(("function"!==this.functions.onAudioUploadError||this.functions.onAudioUploadError(n,{limitSize:i,currentSize:e,uploadSize:t},this))&&this.functions.noticeOpen(n))}}const l=this.context.audio;l._uploadFileLength=n.length;const o={isUpdate:this.context.dialog.updateModal,element:l._element};if("function"==typeof this.functions.onAudioUploadBefore){const e=this.functions.onAudioUploadBefore(n,o,this,function(e){e&&this._w.Array.isArray(e.result)?this.plugins.audio.register.call(this,o,e):this.plugins.audio.upload.call(this,o,e)}.bind(this));if(void 0===e)return;if(!e)return void this.closeLoading();"object"==typeof e&&e.length>0&&(n=e)}this.plugins.audio.upload.call(this,o,n)},error:function(e,t){if(this.closeLoading(),"function"!=typeof this.functions.onAudioUploadError||this.functions.onAudioUploadError(e,t,this))throw this.functions.noticeOpen(e),Error("[SUNEDITOR.plugin.audio.exception] response: "+e)},upload:function(e,t){if(!t)return void this.closeLoading();if("string"==typeof t)return void this.plugins.audio.error.call(this,t,null);const n=this.context.option.audioUploadUrl,i=this.context.dialog.updateModal?1:t.length,l=new FormData;for(let e=0;e'+this.icons.cancel+''+e.dialogBox.mathBox.title+'

    ",t},setController_MathButton:function(){const e=this.lang,t=this.util.createElement("DIV");return t.className="se-controller se-controller-link",t.innerHTML='
    ",t},open:function(){this.plugins.dialog.open.call(this,"math","math"===this.currentControllerName)},managedTags:function(){return{className:"katex",method:function(e){if(!e.getAttribute("data-exp"))return;const t=this._d.createRange().createContextualFragment(this.plugins.math._renderer.call(this,this.util.HTMLDecoder(e.getAttribute("data-exp"))));e.innerHTML=t.querySelector(".katex").innerHTML}}},_renderer:function(e){const t=this.context.option.katex;return t.src.renderToString(e,t.options)},_renderMathExp:function(e,t){e.previewElement.innerHTML=this.plugins.math._renderer.call(this,t.target.value)},submit:function(e){this.showLoading(),e.preventDefault(),e.stopPropagation();const t=function(){if(0===this.context.math.focusElement.value.trim().length)return!1;const e=this.context.math,t=e.focusElement.value,n=e.previewElement.querySelector(".katex");if(!n)return!1;if(n.className="__se__katex "+n.className,n.setAttribute("contenteditable",!1),n.setAttribute("data-exp",this.util.HTMLEncoder(t)),n.setAttribute("data-font-size",e.fontSizeElement.value),n.style.fontSize=e.fontSizeElement.value,this.context.dialog.updateModal){const t=this.util.getParentElement(e._mathExp,".katex");t.parentNode.replaceChild(n,t),this.setRange(n,0,n,1)}else{const e=this.getSelectedElements();if(e.length>1){const t=this.util.createElement(e[0].nodeName);if(t.appendChild(n),!this.insertNode(t,null,!0))return!1}else if(!this.insertNode(n,null,!0))return!1;const t=this.util.createTextNode(this.util.zeroWidthSpace);n.parentNode.insertBefore(t,n.nextSibling),this.setRange(n,0,n,1)}return e.focusElement.value="",e.fontSizeElement.value="1em",e.previewElement.style.fontSize="1em",e.previewElement.innerHTML="",!0}.bind(this);try{t()&&(this.plugins.dialog.close.call(this),this.history.push(!1))}catch(e){this.plugins.dialog.close.call(this)}finally{this.closeLoading()}return!1},active:function(e){if(e){if(e.getAttribute("data-exp"))return this.controllerArray.indexOf(this.context.math.mathController)<0&&(this.setRange(e,0,e,1),this.plugins.math.call_controller.call(this,e)),!0}else this.controllerArray.indexOf(this.context.math.mathController)>-1&&this.controllersOff();return!1},on:function(e){if(e){const e=this.context.math;if(e._mathExp){const t=this.util.HTMLDecoder(e._mathExp.getAttribute("data-exp")),n=e._mathExp.getAttribute("data-font-size")||"1em";this.context.dialog.updateModal=!0,e.focusElement.value=t,e.fontSizeElement.value=n,e.previewElement.innerHTML=this.plugins.math._renderer.call(this,t),e.previewElement.style.fontSize=n}}else this.plugins.math.init.call(this)},call_controller:function(e){this.context.math._mathExp=e;const t=this.context.math.mathController,n=this.util.getOffset(e,this.context.element.wysiwygFrame);t.style.top=n.top+e.offsetHeight+10+"px",t.style.left=n.left-this.context.element.wysiwygFrame.scrollLeft+"px",t.style.display="block";const i=this.context.element.wysiwygFrame.offsetWidth-(t.offsetLeft+t.offsetWidth);i<0?(t.style.left=t.offsetLeft+i+"px",t.firstElementChild.style.left=20-i+"px"):t.firstElementChild.style.left="20px",this.controllersOn(t,e,"math")},onClick_mathController:function(e){e.stopPropagation();const t=e.target.getAttribute("data-command")||e.target.parentNode.getAttribute("data-command");t&&(e.preventDefault(),/update/.test(t)?(this.context.math.focusElement.value=this.util.HTMLDecoder(this.context.math._mathExp.getAttribute("data-exp")),this.plugins.dialog.open.call(this,"math",!0)):(this.util.removeItem(this.context.math._mathExp),this.context.math._mathExp=null,this.focus(),this.history.push(!1)),this.controllersOff())},init:function(){const e=this.context.math;e.mathController.style.display="none",e._mathExp=null,e.focusElement.value="",e.previewElement.innerHTML=""}},y={name:"mention",display:"dialog",title:"mention",buttonClass:"",innerHTML:"@",focussed:0,renderItem:function(e){return`${e}`},getItems:function(e){return Promise.resolve(["overwite","the","mention","plugin","getItems","method"].filter(t=>t.includes(e.toLowerCase())))},renderList:function(e){const{mention:t}=this.context;t.getItems(e).then(e=>{t.items=e,t.list.innerHTML=e.map((e,n)=>`
  • \n ${t.renderItem(e)}\n
  • `).join("")})},setDialog:function(){const e=this.util.createElement("DIV"),t=this.lang;e.className="se-dialog-content",e.style.display="none";const n=`\n
    \n
    \n \n ${t.dialogBox.mentionBox.title}\n
    \n
    \n \n
      \n
    \n
    \n
    \n `;return e.innerHTML=n,e},getId:e=>e,getValue:e=>"@"+e,getLinkHref:()=>"",open:function(){const{mention:e}=this.context;this.plugins.dialog.open.call(this,"mention","mention"===this.currentControllerName),e.search.focus(),e.renderList("")},on:function(e){e||this.plugins.mention.init.call(this)},init:function(){const{mention:e}=this.context;e.search.value="",e.focussed=0},onKeyPress:function(e){const{mention:t}=this.context;switch(e.key){case"ArrowDown":t.focussed+=1,e.preventDefault(),e.stopPropagation();break;case"ArrowUp":t.focussed>0&&(t.focussed-=1),e.preventDefault(),e.stopPropagation();break;case"Enter":t.add(),e.preventDefault(),e.stopPropagation();break;default:t.focussed=0}},onKeyUp:function(e){const{mention:t}=this.context;t.renderList(e.target.value)},getMentions:function(){const{mentions:e,getId:t}=this.context.mention;return e.filter(e=>{const n=t(e);return this.context.element.wysiwyg.querySelector(`[data-mention="${n}"]`)})},addMention:function(){const{mention:e}=this.context,t=e.items[e.focussed];if(t){e.mentions.find(n=>e.getId(n)===e.getId(t))||e.mentions.push(t);const n=this.util.createElement("A");n.href=e.getLinkHref(t),n.target="_blank",n.innerHTML=e.getValue(t),n.setAttribute("data-mention",e.getId(t)),this.insertNode(n,null,!1);const i=this.util.createElement("SPAN");i.innerHTML=" ",this.insertNode(i,n,!1)}this.plugins.dialog.close.call(this)},add:function(e){e.addModule([r.a]);const t=this.setDialog.call(e);e.getMentions=this.getMentions.bind(e);const n=t.querySelector(".se-mention-search");n.addEventListener("keyup",this.onKeyUp.bind(e)),n.addEventListener("keydown",this.onKeyPress.bind(e));const i=t.querySelector(".se-mention-list");e.context.mention={modal:t,search:n,list:i,triggerKey:this.triggerKey,visible:!1,add:this.addMention.bind(e),mentions:[],items:[],renderList:this.renderList.bind(e),getId:this.getId.bind(e),getValue:this.getValue.bind(e),getLinkHref:this.getLinkHref.bind(e),open:this.open.bind(e),focussed:this.focussed,renderItem:this.renderItem,getItems:this.getItems},e.context.dialog.modal.appendChild(t)},action:function(){}},C=n("JhlZ"),w=n.n(C),x={blockquote:{name:"blockquote",display:"command",add:function(e,t){e.context.blockquote={targetButton:t,tag:e.util.createElement("BLOCKQUOTE")}},active:function(e){if(e){if(/blockquote/i.test(e.nodeName))return this.util.addClass(this.context.blockquote.targetButton,"active"),!0}else this.util.removeClass(this.context.blockquote.targetButton,"active");return!1},action:function(){const e=this.util.getParentElement(this.getSelectionNode(),"blockquote");e?this.detachRangeFormatElement(e,null,null,!1,!1):this.applyRangeFormatElement(this.context.blockquote.tag.cloneNode(!1))}},align:{name:"align",display:"submenu",add:function(e,t){const n=e.icons,i=e.context;i.align={targetButton:t,_alignList:null,currentAlign:"",icons:{justify:n.align_justify,left:n.align_left,right:n.align_right,center:n.align_center}};let l=this.setSubmenu.call(e),o=l.querySelector("ul");o.addEventListener("click",this.pickup.bind(e)),i.align._alignList=o.querySelectorAll("li button"),e.initMenuTarget(this.name,t,l),l=null,o=null},setSubmenu:function(){const e=this.lang,t=this.icons,n=this.util.createElement("DIV");return n.className="se-submenu se-list-layer se-list-align",n.innerHTML='
    ",n},active:function(e){const t=this.context.align.targetButton,n=t.firstElementChild;if(e){if(this.util.isFormatElement(e)){const i=e.style.textAlign;if(i)return this.util.changeElement(n,this.context.align.icons[i]),t.setAttribute("data-focus",i),!0}}else this.util.changeElement(n,this.context.align.icons.left),t.removeAttribute("data-focus");return!1},on:function(){const e=this.context.align,t=e._alignList,n=e.targetButton.getAttribute("data-focus")||"left";if(n!==e.currentAlign){for(let e=0,i=t.length;e('+t.toolbar.default+")";for(o=0,s=a.length;o";return r+="",n.innerHTML=r,n},active:function(e){const t=this.context.font.targetText,n=this.context.font.targetTooltip;if(e){if(e.style&&e.style.fontFamily.length>0){const i=e.style.fontFamily.replace(/["']/g,"");return this.util.changeTxt(t,i),this.util.changeTxt(n,i),!0}}else{const e=this.lang.toolbar.font;this.util.changeTxt(t,e),this.util.changeTxt(n,e)}return!1},on:function(){const e=this.context.font,t=e._fontList,n=e.targetText.textContent;if(n!==e.currentFont){for(let e=0,i=t.length;e('+t.toolbar.default+")";for(let t,n=0,o=e.fontSizeUnit,s=i.length;n";return l+="",n.innerHTML=l,n},active:function(e){if(e){if(e.style&&e.style.fontSize.length>0)return this.util.changeTxt(this.context.fontSize.targetText,e.style.fontSize),!0}else this.util.changeTxt(this.context.fontSize.targetText,this.lang.toolbar.fontSize);return!1},on:function(){const e=this.context.fontSize,t=e._sizeList,n=e.targetText.textContent;if(n!==e.currentSize){for(let e=0,i=t.length;e
  • ',t},appendHr:function(e){const t=this.util.createElement("HR");return t.className=e,this.focus(),this.insertComponent(t,!1,!0,!1)},horizontalRulePick:function(e){e.preventDefault(),e.stopPropagation();let t=e.target,n=null;for(;!n&&!/UL/i.test(t.tagName);)n=t.getAttribute("data-value"),t=t.parentNode;if(!n)return;const i=this.plugins.horizontalRule.appendHr.call(this,"__se__"+n);i&&(this.setRange(i,0,i,0),this.submenuOff())}},list:{name:"list",display:"submenu",add:function(e,t){const n=e.context;n.list={targetButton:t,_list:null,currentList:"",icons:{bullets:e.icons.list_bullets,number:e.icons.list_number}};let i=this.setSubmenu.call(e),l=i.querySelector("ul");l.addEventListener("click",this.pickup.bind(e)),n.list._list=l.querySelectorAll("li button"),e.initMenuTarget(this.name,t,i),i=null,l=null},setSubmenu:function(){const e=this.lang,t=this.util.createElement("DIV");return t.className="se-submenu se-list-layer",t.innerHTML='
    ",t},active:function(e){const t=this.context.list.targetButton,n=t.firstElementChild,i=this.util;if(e){if(i.isList(e)){const l=e.nodeName;return t.setAttribute("data-focus",l),i.addClass(t,"active"),/UL/i.test(l)?i.changeElement(n,this.context.list.icons.bullets):i.changeElement(n,this.context.list.icons.number),!0}}else t.removeAttribute("data-focus"),i.changeElement(n,this.context.list.icons.number),i.removeClass(t,"active");return!1},on:function(){const e=this.context.list,t=e._list,n=e.targetButton.getAttribute("data-focus")||"";if(n!==e.currentList){for(let e=0,i=t.length;e"),t.innerHTML+=n.outerHTML,e&&(t.innerHTML+="
    ")}else{const e=n.childNodes;for(;e[0];)t.appendChild(e[0])}a.appendChild(t),r||(u=a),r&&m===g&&!o.isRangeFormatElement(f)||(d||(d=a),i&&r&&m===g||r&&o.isList(g)&&g===c||a.parentNode!==m&&m.insertBefore(a,f)),o.removeItem(n),i&&null===h&&(h=a.children.length-1),r&&(o.getRangeFormatElement(g,p)!==o.getRangeFormatElement(c,p)||o.isList(g)&&o.isList(c)&&o.getElementDepth(g)!==o.getElementDepth(c))&&(a=o.createElement(e)),_&&0===_.children.length&&o.removeItem(_)}else o.removeItem(n);h&&(d=d.children[h]),s&&(g=a.children.length-1,a.innerHTML+=c.innerHTML,u=a.children[g],o.removeItem(c))}else{if(n)for(let e=0,t=l.length;e=0;n--)if(l[n].contains(l[e])){l.splice(e,1),e--,t--;break}const t=o.getRangeFormatElement(s),i=t&&t.tagName===e;let a,r;const c=function(e){return!this.isComponent(e)}.bind(o);i||(r=o.createElement(e));for(let t,s,d=0,u=l.length;d0){const e=l.cloneNode(!1),t=l.childNodes,o=this.util.getPositionIndex(i);for(;t[o];)e.appendChild(t[o]);n.appendChild(e)}0===l.children.length&&this.util.removeItem(l),this.util.mergeSameTags(s);const a=this.util.getEdgeChildNodes(t,n);return{cc:t.parentNode,sc:a.sc,ec:a.ec}},editInsideList:function(e,t){const n=(t=t||this.getSelectedElements().filter(function(e){return this.isListCell(e)}.bind(this.util))).length;if(0===n||!e&&!this.util.isListCell(t[0].previousElementSibling)&&!this.util.isListCell(t[n-1].nextElementSibling))return{sc:t[0],so:0,ec:t[n-1],eo:1};let i=t[0].parentNode,l=t[n-1],o=null;if(e){if(i!==l.parentNode&&this.util.isList(l.parentNode.parentNode)&&l.nextElementSibling)for(l=l.nextElementSibling;l;)t.push(l),l=l.nextElementSibling;o=this.plugins.list.editList.call(this,i.nodeName.toUpperCase(),t,!0)}else{let e=this.util.createElement(i.nodeName),s=t[0].previousElementSibling,a=l.nextElementSibling;const r={s:null,e:null,sl:i,el:i};for(let l,o=0,c=n;o span > span"),n.table.columnFixedButton=o.querySelector("._se_table_fixed_column"),n.table.headerButton=o.querySelector("._se_table_header"),o.addEventListener("mousedown",e.eventStop);let s=this.setController_tableEditor.call(e,n.table.cellControllerTop);n.table.resizeDiv=s,n.table.splitMenu=s.querySelector(".se-btn-group-sub"),n.table.mergeButton=s.querySelector("._se_table_merge_button"),n.table.splitButton=s.querySelector("._se_table_split_button"),n.table.insertRowAboveButton=s.querySelector("._se_table_insert_row_a"),n.table.insertRowBelowButton=s.querySelector("._se_table_insert_row_b"),s.addEventListener("mousedown",e.eventStop),l.addEventListener("mousemove",this.onMouseMove_tablePicker.bind(e)),l.addEventListener("click",this.appendTable.bind(e)),s.addEventListener("click",this.onClick_tableController.bind(e)),o.addEventListener("click",this.onClick_tableController.bind(e)),e.initMenuTarget(this.name,t,i),n.element.relative.appendChild(s),n.element.relative.appendChild(o),i=null,l=null,s=null,o=null},setSubmenu:function(){const e=this.util.createElement("DIV");return e.className="se-submenu se-selector-table",e.innerHTML='
    1 x 1
    ',e},setController_table:function(){const e=this.lang,t=this.icons,n=this.util.createElement("DIV");return n.className="se-controller se-controller-table",n.innerHTML='
    ",n},setController_tableEditor:function(e){const t=this.lang,n=this.icons,i=this.util.createElement("DIV");return i.className="se-controller se-controller-table-cell",i.innerHTML=(e?"":'
    ')+'
    • '+t.controller.VerticalSplit+'
    • '+t.controller.HorizontalSplit+"
    ",i},appendTable:function(){const e=this.util.createElement("TABLE"),t=this.plugins.table.createCells,n=this.context.table._tableXY[0];let i=this.context.table._tableXY[1],l="";for(;i>0;)l+=""+t.call(this,"td",n)+"",--i;l+="",e.innerHTML=l;if(this.insertComponent(e,!1,!0,!1)){const t=e.querySelector("td div");this.setRange(t,0,t,0),this.plugins.table.reset_table_picker.call(this)}},createCells:function(e,t,n){if(e=e.toLowerCase(),n){const t=this.util.createElement(e);return t.innerHTML="

    ",t}{let n="";for(;t>0;)n+="<"+e+">

    ",t--;return n}},onMouseMove_tablePicker:function(e){e.stopPropagation();let t=this._w.Math.ceil(e.offsetX/18),n=this._w.Math.ceil(e.offsetY/18);t=t<1?1:t,n=n<1?1:n,this.context.table.tableHighlight.style.width=t+"em",this.context.table.tableHighlight.style.height=n+"em";this.context.table.tableUnHighlight.style.width="10em",this.context.table.tableUnHighlight.style.height="10em",this.util.changeTxt(this.context.table.tableDisplay,t+" x "+n),this.context.table._tableXY=[t,n]},reset_table_picker:function(){if(!this.context.table.tableHighlight)return;const e=this.context.table.tableHighlight.style,t=this.context.table.tableUnHighlight.style;e.width="1em",e.height="1em",t.width="10em",t.height="10em",this.util.changeTxt(this.context.table.tableDisplay,"1 x 1"),this.submenuOff()},init:function(){const e=this.context.table,t=this.plugins.table;if(t._removeEvents.call(this),t._selectedTable){const e=t._selectedTable.querySelectorAll(".se-table-selected-cell");for(let t=0,n=e.length;t0)for(let e,t=0;to||(u>=e.index?(i+=e.cs,u+=e.cs,e.rs-=1,e.row=o+1,e.rs<1&&(r.splice(t,1),t--)):h===g-1&&(e.rs-=1,e.row=o+1,e.rs<1&&(r.splice(t,1),t--)));if(o===s&&h===l){n._logical_cellIndex=u;break}d>0&&a.push({index:u,cs:c+1,rs:d,row:-1}),i+=c}r=r.concat(a).sort((function(e,t){return e.index-t.index})),a=[]}a=null,r=null}},editTable:function(e,t){const n=this.plugins.table,i=this.context.table,l=i._element,o="row"===e;if(o){const e=i._trElement.parentNode;if(/^THEAD$/i.test(e.nodeName)){if("up"===t)return;if(!e.nextElementSibling||!/^TBODY$/i.test(e.nextElementSibling.nodeName))return void(l.innerHTML+=""+n.createCells.call(this,"td",i._logical_cellCnt,!1)+"")}}if(n._ref){const e=i._tdElement,l=n._selectedCells;if(o)if(t)n.setCellInfo.call(this,"up"===t?l[0]:l[l.length-1],!0),n.editRow.call(this,t,e);else{let e=l[0].parentNode;const i=[l[0]];for(let t,n=1,o=l.length;ns&&s>t&&(e[l].rowSpan=n+a,c-=i)}if(i){const e=r[o+1];if(e){const t=[];let n=r[o].cells,i=0;for(let e,l,o=0,s=n.length;o1&&(e.rowSpan-=1,t.push({cell:e.cloneNode(!1),index:l}));if(t.length>0){let l=t.shift();n=e.cells,i=0;for(let o,s,a=0,r=n.length;a=l.index)||(a--,i--,i+=l.cell.colSpan-1,e.insertBefore(l.cell,o),l=t.shift(),l));a++);if(l){e.appendChild(l.cell);for(let n=0,i=t.length;n0){const e=!o[b+1];for(let t,n=0;n_||(p>=t.index?(f+=t.cs,p=b+f,t.rs-=1,t.row=_+1,t.rs<1&&(d.splice(n,1),n--)):e&&(t.rs-=1,t.row=_+1,t.rs<1&&(d.splice(n,1),n--)))}n>0&&c.push({rs:n,cs:r+1,index:p,row:-1}),p>=t&&p+r<=t+s?h.push(e):p<=t+s&&p+r>=t?e.colSpan-=i.getOverlapRangeAtIndex(a,a+s,p,p+r):n>0&&(pt+s)&&g.push({cell:e,i:_,rs:_+n}),f+=r}else{if(b>=t)break;if(r>0){if(u<1&&r+b>=t){e.colSpan+=1,t=null,u=n+1;break}t-=r}if(!m){for(let e,n=0;n0){u-=1;continue}null!==t&&o.length>0&&(p=this.plugins.table.createCells.call(this,o[0].nodeName,0,!0),p=e.insertBefore(p,o[t]))}}if(l){let e,t;for(let n,l=0,o=h.length;l1)c.colSpan=this._w.Math.floor(e/2),l.colSpan=e-c.colSpan,s.insertBefore(c,l.nextElementSibling);else{let t=[],n=[];for(let s,r,c=0,d=i._rowCnt;c0)for(let e,t=0;tc||(u>=e.index?(r+=e.cs,u+=e.cs,e.rs-=1,e.row=c+1,e.rs<1&&(n.splice(t,1),t--)):h===g-1&&(e.rs-=1,e.row=c+1,e.rs<1&&(n.splice(t,1),t--)));if(u<=a&&d>0&&t.push({index:u,cs:o+1,rs:d,row:-1}),i!==l&&u<=a&&u+o>=a+e-1){i.colSpan+=1;break}if(u>a)break;r+=o}n=n.concat(t).sort((function(e,t){return e.index-t.index})),t=[]}s.insertBefore(c,l.nextElementSibling)}}else{const e=l.rowSpan;if(c.colSpan=l.colSpan,e>1){c.rowSpan=this._w.Math.floor(e/2);const n=e-c.rowSpan,i=[],r=t.getArrayIndex(o,s)+n;for(let e,t,n=0;n=a));c++)l=e[c],o=l.rowSpan-1,o>0&&o+n>=r&&s=h.index&&(r+=h.cs,l+=h.cs,h=i.shift()),l>=a||o===s-1){d.insertBefore(c,e.nextElementSibling);break}r+=t}l.rowSpan=n}else{c.rowSpan=l.rowSpan;const e=t.createElement("TR");e.appendChild(c);for(let e,t=0;t=r&&(e[n].rowSpan+=1)}const n=i._physical_cellIndex,a=s.cells;for(let e=0,t=a.length;e0&&s+o>=i&&(e.rowSpan-=n.getOverlapRangeAtIndex(i,l,s,s+o));else o.push(e[s]);for(let e=0,t=o.length;e"+this.plugins.table.createCells.call(this,"th",this.context.table._logical_cellCnt,!1)+"",i.insertBefore(t,i.firstElementChild)}e.toggleClass(t,"active"),/TH/i.test(this.context.table._tdElement.nodeName)?this.controllersOff():this.plugins.table.setPositionControllerDiv.call(this,this.context.table._tdElement,!1)},setTableStyle:function(e){const t=this.context.table,n=t._element;let i,l,o,s;e.indexOf("width")>-1&&(i=t.resizeButton.firstElementChild,l=t.resizeText,t._maxWidth?(o=t.icons.reduction,s=t.minText,t.columnFixedButton.style.display="block",this.util.removeClass(n,"se-table-size-auto"),this.util.addClass(n,"se-table-size-100")):(o=t.icons.expansion,s=t.maxText,t.columnFixedButton.style.display="none",this.util.removeClass(n,"se-table-size-100"),this.util.addClass(n,"se-table-size-auto")),this.util.changeElement(i,o),this.util.changeTxt(l,s)),e.indexOf("column")>-1&&(t._fixedColumn?(this.util.removeClass(n,"se-table-layout-auto"),this.util.addClass(n,"se-table-layout-fixed"),this.util.addClass(t.columnFixedButton,"active")):(this.util.removeClass(n,"se-table-layout-fixed"),this.util.addClass(n,"se-table-layout-auto"),this.util.removeClass(t.columnFixedButton,"active")))},setActiveButton:function(e,t){const n=this.context.table;/^TH$/i.test(e.nodeName)?(n.insertRowAboveButton.setAttribute("disabled",!0),n.insertRowBelowButton.setAttribute("disabled",!0)):(n.insertRowAboveButton.removeAttribute("disabled"),n.insertRowBelowButton.removeAttribute("disabled")),t&&e!==t?(n.splitButton.setAttribute("disabled",!0),n.mergeButton.removeAttribute("disabled")):(n.splitButton.removeAttribute("disabled"),n.mergeButton.setAttribute("disabled",!0))},_bindOnSelect:null,_bindOffSelect:null,_bindOffShift:null,_selectedCells:null,_shift:!1,_fixedCell:null,_fixedCellName:null,_selectedCell:null,_selectedTable:null,_ref:null,_toggleEditor:function(e){this.context.element.wysiwyg.setAttribute("contenteditable",e),e?this.util.removeClass(this.context.element.wysiwyg,"se-disabled"):this.util.addClass(this.context.element.wysiwyg,"se-disabled")},_offCellMultiSelect:function(e){e.stopPropagation();const t=this.plugins.table;t._shift?t._initBind&&(this._wd.removeEventListener("touchmove",t._initBind),t._initBind=null):(t._removeEvents.call(this),t._toggleEditor.call(this,!0)),t._fixedCell&&t._selectedTable&&(t.setActiveButton.call(this,t._fixedCell,t._selectedCell),t.call_controller_tableEdit.call(this,t._selectedCell||t._fixedCell),t._selectedCells=t._selectedTable.querySelectorAll(".se-table-selected-cell"),t._selectedCell&&t._fixedCell&&this.focusEdge(t._selectedCell),t._shift||(t._fixedCell=null,t._selectedCell=null,t._fixedCellName=null))},_onCellMultiSelect:function(e){this._antiBlur=!0;const t=this.plugins.table,n=this.util.getParentElement(e.target,this.util.isCell);if(t._shift)n===t._fixedCell?t._toggleEditor.call(this,!0):t._toggleEditor.call(this,!1);else if(!t._ref){if(n===t._fixedCell)return;t._toggleEditor.call(this,!1)}n&&n!==t._selectedCell&&t._fixedCellName===n.nodeName&&t._selectedTable===this.util.getParentElement(n,"TABLE")&&(t._selectedCell=n,t._setMultiCells.call(this,t._fixedCell,n))},_setMultiCells:function(e,t){const n=this.plugins.table,i=n._selectedTable.rows,l=this.util,o=n._selectedTable.querySelectorAll(".se-table-selected-cell");for(let e=0,t=o.length;e0)for(let e,t=0;td||(u>=e.index?(o+=e.cs,u+=e.cs,e.rs-=1,e.row=d+1,e.rs<1&&(a.splice(t,1),t--)):p===m-1&&(e.rs-=1,e.row=d+1,e.rs<1&&(a.splice(t,1),t--)));if(s){if(i!==e&&i!==t||(c.cs=null!==c.cs&&c.csu+h?c.ce:u+h,c.rs=null!==c.rs&&c.rsd+g?c.re:d+g,c._i+=1),2===c._i){s=!1,a=[],r=[],d=-1;break}}else if(l.getOverlapRangeAtIndex(c.cs,c.ce,u,u+h)&&l.getOverlapRangeAtIndex(c.rs,c.re,d,d+g)){const e=c.csu+h?c.ce:u+h,n=c.rsd+g?c.re:d+g;if(c.cs!==e||c.ce!==t||c.rs!==n||c.re!==o){c.cs=e,c.ce=t,c.rs=n,c.re=o,d=-1,a=[],r=[];break}l.addClass(i,"se-table-selected-cell")}g>0&&r.push({index:u,cs:h+1,rs:g,row:-1}),o+=i.colSpan-1}a=a.concat(r).sort((function(e,t){return e.index-t.index})),r=[]}},_removeEvents:function(){const e=this.plugins.table;e._initBind&&(this._wd.removeEventListener("touchmove",e._initBind),e._initBind=null),e._bindOnSelect&&(this._wd.removeEventListener("mousedown",e._bindOnSelect),this._wd.removeEventListener("mousemove",e._bindOnSelect),e._bindOnSelect=null),e._bindOffSelect&&(this._wd.removeEventListener("mouseup",e._bindOffSelect),e._bindOffSelect=null),e._bindOffShift&&(this._wd.removeEventListener("keyup",e._bindOffShift),e._bindOffShift=null)},_initBind:null,onTableCellMultiSelect:function(e,t){const n=this.plugins.table;n._removeEvents.call(this),this.controllersOff(),n._shift=t,n._fixedCell=e,n._fixedCellName=e.nodeName,n._selectedTable=this.util.getParentElement(e,"TABLE");const i=n._selectedTable.querySelectorAll(".se-table-selected-cell");for(let e=0,t=i.length;e-1?(n=e.toLowerCase(),s="blockquote"===n?"range":"pre"===n?"free":"replace",r=/^h/.test(n)?n.match(/\d+/)[0]:"",a=t["tag_"+(r?"h":n)]+r,d="",c=""):(n=e.tag.toLowerCase(),s=e.command,a=e.name||n,d=e.class,c=d?' class="'+d+'"':""),o+='
  • ";return o+="",n.innerHTML=o,n},active:function(e){let t=this.lang.toolbar.formats;const n=this.context.formatBlock.targetText,i=this.context.formatBlock.targetTooltip;if(e){if(this.util.isFormatElement(e)){const l=this.context.formatBlock._formatList,o=e.nodeName.toLowerCase(),s=(e.className.match(/(\s|^)__se__format__[^\s]+/)||[""])[0].trim();for(let e,n=0,i=l.length;n=0;u--)if(i=p[u],i!==(p[u+1]?p[u+1].parentNode:null)){if(d=r.isComponent(i),o=d?"":i.innerHTML.replace(/(?!>)\s+(?=<)|\n/g," "),s=r.getParentElement(i,(function(e){return e.parentNode===t})),(t!==i.parentNode||d)&&(r.isFormatElement(t)?(t.parentNode.insertBefore(n,t.nextSibling),t=t.parentNode):(t.insertBefore(n,s?s.nextSibling:null),t=i.parentNode),a=n.nextSibling,a&&n.nodeName===a.nodeName&&r.isSameAttributes(n,a)&&(n.innerHTML+="
    "+a.innerHTML,r.removeItem(a)),n=l.cloneNode(!1),h=!0),c=n.innerHTML,n.innerHTML=(h||!o||!c||/
    $/i.test(o)?o:o+"
    ")+c,0===u){t.insertBefore(n,i),a=i.nextSibling,a&&n.nodeName===a.nodeName&&r.isSameAttributes(n,a)&&(n.innerHTML+="
    "+a.innerHTML,r.removeItem(a));const e=n.previousSibling;e&&n.nodeName===e.nodeName&&r.isSameAttributes(n,e)&&(e.innerHTML+="
    "+n.innerHTML,r.removeItem(n))}d||r.removeItem(i),o&&(h=!1)}this.setRange(i,0,i,0)}else{for(let e,t,n=0,s=p.length;n('+t.toolbar.default+")";for(let e,t=0,n=i.length;t";return l+="",n.innerHTML=l,n},on:function(){const e=this.context.lineHeight,t=e._sizeList,n=this.util.getFormatElement(this.getSelectionNode()),i=n?n.style.lineHeight+"":"";if(i!==e.currentSize){for(let e=0,n=t.length;e"}return o+="",t.innerHTML=o,t},on:function(){const e=this.context.paragraphStyle._classList,t=this.util.getFormatElement(this.getSelectionNode());for(let n=0,i=e.length;n"}return l+="",t.innerHTML=l,t},on:function(){const e=this.util,t=this.context.textStyle._styleList,n=this.getSelectionNode();for(let i,l,o,s=0,a=t.length;s'+(e.alt||t)+'
    '+(e.name||t)+"
    "},setImage:function(e){this.callPlugin("image",function(){const t={name:e.parentNode.querySelector(".__se__img_name").textContent,size:0};this.context.image._altText=e.alt,this.plugins.image.create_image.call(this,e.src,"",!1,this.context.image._origin_w,this.context.image._origin_h,"none",t)}.bind(this),null)}},mention:y},E={redo:'',undo:'',bold:'',underline:'',italic:'',strike:'',subscript:'',superscript:'',erase:'',indent:'',outdent:'',expansion:'',reduction:'',code_view:'',preview:'',print:'',template:'',line_height:'',paragraph_style:'',text_style:'',save:'',blockquote:'',arrow_down:'',align_justify:'',align_left:'',align_right:'',align_center:'',font_color:'',highlight_color:'',list_bullets:'',list_number:'',table:'',horizontal_rule:'',show_blocks:'',cancel:'',image:'',video:'',link:'',math:'',unlink:'',table_header:'',merge_cell:'',split_cell:'',caption:'',edit:'',delete:'',modify:'',revert:'',auto_size:'',insert_row_below:'',insert_row_above:'',insert_column_left:'',insert_column_right:'',delete_row:'',delete_column:'',fixed_column_width:'',rotate_left:'',rotate_right:'',mirror_horizontal:'',mirror_vertical:'',checked:'',line_break:'',audio:'',image_gallery:'',more_text:'',more_paragraph:'',more_plus:'',more_horizontal:'',more_vertical:'',attachment:'',map:'',magic_stick:'',empty_file:''},S=n("P6u4"),N=n.n(S);const T={_d:null,_w:null,isIE:null,isIE_Edge:null,isOSX_IOS:null,_propertiesInit:function(){this._d||(this._d=document,this._w=window,this.isIE=navigator.userAgent.indexOf("Trident")>-1,this.isIE_Edge=navigator.userAgent.indexOf("Trident")>-1||navigator.appVersion.indexOf("Edge")>-1,this.isOSX_IOS=/(Mac|iPhone|iPod|iPad)/.test(navigator.platform))},_HTMLConvertor:function(e){const t={"&":"&"," ":" ","'":"'",'"':""","<":"<",">":">"};return e.replace(/&|\u00A0|'|"|<|>/g,(function(e){return"string"==typeof t[e]?t[e]:e}))},zeroWidthSpace:String.fromCharCode(8203),zeroWidthRegExp:new RegExp(String.fromCharCode(8203),"g"),onlyZeroWidthRegExp:new RegExp("^"+String.fromCharCode(8203)+"+$"),onlyZeroWidthSpace:function(e){return"string"!=typeof e&&(e=e.textContent),""===e||this.onlyZeroWidthRegExp.test(e)},getXMLHttpRequest:function(){if(!this._w.ActiveXObject)return this._w.XMLHttpRequest?new XMLHttpRequest:null;try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(e){try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(e){return null}}},createElement:function(e){return this._d.createElement(e)},createTextNode:function(e){return this._d.createTextNode(e||"")},HTMLEncoder:function(e){const t={"<":"$lt;",">":"$gt;"};return e.replace(/<|>/g,(function(e){return"string"==typeof t[e]?t[e]:e}))},HTMLDecoder:function(e){const t={"$lt;":"<","$gt;":">"};return e.replace(/\$lt;|\$gt;/g,(function(e){return"string"==typeof t[e]?t[e]:e}))},hasOwn:function(e,t){return this._hasOwn.call(e,t)},_hasOwn:Object.prototype.hasOwnProperty,getIncludePath:function(e,t){let n="";const i=[],l="js"===t?"script":"link",o="js"===t?"src":"href";let s="(?:";for(let t=0,n=e.length;t0?i[0][o]:""),-1===n.indexOf(":/")&&"//"!==n.slice(0,2)&&(n=0===n.indexOf("/")?location.href.match(/^.*?:\/\/[^\/]*/)[0]+n:location.href.match(/^[^\?]*\/(?:)/)[0]+n),!n)throw"[SUNEDITOR.util.getIncludePath.fail] The SUNEDITOR installation path could not be automatically detected. (name: +"+name+", extension: "+t+")";return n},getPageStyle:function(e){let t="";const n=(e||this._d).styleSheets;for(let e,i=0,l=n.length;i-1||(i+=n[e].name+'="'+n[e].value+'" ');return i},getByteLength:function(e){const t=this._w.encodeURIComponent;let n,i;return this.isIE_Edge?(i=this._w.unescape(t(e.toString())).length,n=0,null!==t(e.toString()).match(/(%0A|%0D)/gi)&&(n=t(e.toString()).match(/(%0A|%0D)/gi).length),i+n):(i=new this._w.TextEncoder("utf-8").encode(e.toString()).length,n=0,null!==t(e.toString()).match(/(%0A|%0D)/gi)&&(n=t(e.toString()).match(/(%0A|%0D)/gi).length),i+n)},isWysiwygDiv:function(e){return e&&1===e.nodeType&&(this.hasClass(e,"se-wrapper-wysiwyg")||/^BODY$/i.test(e.nodeName))},isNonEditable:function(e){return e&&1===e.nodeType&&"false"===e.getAttribute("contenteditable")},isTextStyleElement:function(e){return e&&3!==e.nodeType&&/^(strong|span|font|b|var|i|em|u|ins|s|strike|del|sub|sup|mark|a|label|code)$/i.test(e.nodeName)},isFormatElement:function(e){return e&&1===e.nodeType&&(/^(P|DIV|H[1-6]|PRE|LI|TH|TD)$/i.test(e.nodeName)||this.hasClass(e,"(\\s|^)__se__format__replace_.+(\\s|$)|(\\s|^)__se__format__free_.+(\\s|$)"))&&!this.isComponent(e)&&!this.isWysiwygDiv(e)},isRangeFormatElement:function(e){return e&&1===e.nodeType&&(/^(BLOCKQUOTE|OL|UL|FIGCAPTION|TABLE|THEAD|TBODY|TR|TH|TD)$/i.test(e.nodeName)||this.hasClass(e,"(\\s|^)__se__format__range_.+(\\s|$)"))},isClosureRangeFormatElement:function(e){return e&&1===e.nodeType&&(/^(TH|TD)$/i.test(e.nodeName)||this.hasClass(e,"(\\s|^)__se__format__range__closure_.+(\\s|$)"))},isFreeFormatElement:function(e){return e&&1===e.nodeType&&(/^PRE$/i.test(e.nodeName)||this.hasClass(e,"(\\s|^)__se__format__free_.+(\\s|$)"))&&!this.isComponent(e)&&!this.isWysiwygDiv(e)},isClosureFreeFormatElement:function(e){return e&&1===e.nodeType&&this.hasClass(e,"(\\s|^)__se__format__free__closure_.+(\\s|$)")},isComponent:function(e){return e&&(/se-component/.test(e.className)||/^(TABLE|HR)$/.test(e.nodeName))},isMediaComponent:function(e){return e&&/se-component/.test(e.className)},isNotCheckingNode:function(e){return e&&/katex|__se__tag/.test(e.className)},getFormatElement:function(e,t){if(!e)return null;for(t||(t=function(){return!0});e;){if(this.isWysiwygDiv(e))return null;if(this.isRangeFormatElement(e)&&e.firstElementChild,this.isFormatElement(e)&&t(e))return e;e=e.parentNode}return null},getRangeFormatElement:function(e,t){if(!e)return null;for(t||(t=function(){return!0});e;){if(this.isWysiwygDiv(e))return null;if(this.isRangeFormatElement(e)&&!/^(THEAD|TBODY|TR)$/i.test(e.nodeName)&&t(e))return e;e=e.parentNode}return null},getFreeFormatElement:function(e,t){if(!e)return null;for(t||(t=function(){return!0});e;){if(this.isWysiwygDiv(e))return null;if(this.isFreeFormatElement(e)&&t(e))return e;e=e.parentNode}return null},getClosureFreeFormatElement:function(e,t){if(!e)return null;for(t||(t=function(){return!0});e;){if(this.isWysiwygDiv(e))return null;if(this.isClosureFreeFormatElement(e)&&t(e))return e;e=e.parentNode}return null},copyTagAttributes:function(e,t){t.style.cssText&&(e.style.cssText+=t.style.cssText);const n=t.classList;for(let t=0,i=n.length;ts?1:o0&&!this.isBreak(e);)e=e.firstChild;for(;t&&1===t.nodeType&&t.childNodes.length>0&&!this.isBreak(t);)t=t.lastChild;return{sc:e,ec:t||e}}},getOffset:function(e,t){let n=0,i=0,l=3===e.nodeType?e.parentElement:e;const o=this.getParentElement(e,this.isWysiwygDiv.bind(this));for(;l&&!this.hasClass(l,"se-container")&&l!==o;)n+=l.offsetLeft,i+=l.offsetTop,l=l.offsetParent;const s=t&&/iframe/i.test(t.nodeName);return{left:n+(s?t.parentElement.offsetLeft:0),top:i-o.scrollTop+(s?t.parentElement.offsetTop:0)}},getOverlapRangeAtIndex:function(e,t,n,i){if(e<=i?tn)return 0;const l=(e>n?e:n)-(t0?" ":"")+t)},removeClass:function(e,t){if(!e)return;const n=new this._w.RegExp("(\\s|^)"+t+"(\\s|$)");e.className=e.className.replace(n," ").trim(),e.className.trim()||e.removeAttribute("class")},toggleClass:function(e,t){if(!e)return;const n=new this._w.RegExp("(\\s|^)"+t+"(\\s|$)");n.test(e.className)?e.className=e.className.replace(n," ").trim():e.className+=" "+t,e.className.trim()||e.removeAttribute("class")},setDisabledButtons:function(e,t){for(let n=0,i=t.length;n=0){e.splitText(t);const n=this.getNodeFromPath([a+1],i);this.onlyZeroWidthSpace(n)&&(n.data=this.zeroWidthSpace)}}else 1===e.nodeType&&(e.previousSibling?e=e.previousSibling:this.getElementDepth(e)===n&&(r=!1));let c=e;for(;this.getElementDepth(c)>n;)for(a=this.getPositionIndex(c)+1,c=c.parentNode,s=l,l=c.cloneNode(!1),o=c.childNodes,s&&(this.isListCell(l)&&this.isList(s)&&s.firstElementChild?(l.innerHTML=s.firstElementChild.innerHTML,T.removeItem(s.firstElementChild),s.children.length>0&&l.appendChild(s)):l.appendChild(s));o[a];)l.appendChild(o[a]);c.childNodes.length<=1&&(!c.firstChild||0===c.firstChild.textContent.length)&&(c.innerHTML="
    ");const d=c.parentNode;return r&&(c=c.nextSibling),l?(this.mergeSameTags(l,null,!1),this.mergeNestedTags(l,function(e){return this.isList(e)}.bind(this)),l.childNodes.length>0?d.insertBefore(l,c):l=c,0===i.childNodes.length&&this.removeItem(i),l):c},mergeSameTags:function(e,t,n){const i=this,l=t?t.length:0;let o=null;return l&&(o=this._w.Array.apply(null,new this._w.Array(l)).map(this._w.Number.prototype.valueOf,0)),function e(s,a,r){const c=s.childNodes;for(let d,u,h=0,g=c.length;h=0;){if(i.getArrayIndex(o.childNodes,n)!==e[r]){c=!1;break}n=d.parentNode,o=n.parentNode,r--}c&&(e.splice(a,1),e[a]=h)}}i.copyTagAttributes(d,s),s.parentNode.insertBefore(d,s),i.removeItem(s)}if(!u){1===d.nodeType&&e(d,a+1,h);break}if(d.nodeName===u.nodeName&&i.isSameAttributes(d,u)&&d.href===u.href){const e=d.childNodes;let n=0;for(let t=0,i=e.length;t0&&n++;const s=d.lastChild,c=u.firstChild;let g=0;if(s&&c){const e=3===s.nodeType&&3===c.nodeType;g=s.textContent.length;let i=s.previousSibling;for(;i&&3===i.nodeType;)g+=i.textContent.length,i=i.previousSibling;if(n>0&&3===s.nodeType&&3===c.nodeType&&(s.textContent.length>0||c.textContent.length>0)&&n--,l){let i=null;for(let d=0;dh){if(a>0&&i[a-1]!==r)continue;i[a]-=1,i[a+1]>=0&&i[a]===h&&(i[a+1]+=n,e&&s&&3===s.nodeType&&c&&3===c.nodeType&&(o[d]+=g))}}}if(3===d.nodeType){if(g=d.textContent.length,d.textContent+=u.textContent,l){let e=null;for(let i=0;ih){if(a>0&&e[a-1]!==r)continue;e[a]-=1,e[a+1]>=0&&e[a]===h&&(e[a+1]+=n,o[i]+=g)}}}else d.innerHTML+=u.innerHTML;i.removeItem(u),h--}else 1===d.nodeType&&e(d,a+1,h)}}(e,0,0),o},mergeNestedTags:function(e,t){"string"==typeof t?t=function(e){return this.test(e.tagName)}.bind(new this._w.RegExp("^("+(t||".+")+")$","i")):"function"!=typeof t&&(t=function(){return!0}),function e(n){let i=n.children;if(1===i.length&&i[0].nodeName===n.nodeName&&t(n)){const e=i[0];for(i=e.children;i[0];)n.appendChild(i[0]);n.removeChild(e)}for(let t=0,i=n.children.length;t")},htmlRemoveWhiteSpace:function(e){return e?e.trim().replace(/<\/?(?!strong|span|font|b|var|i|em|u|ins|s|strike|del|sub|sup|mark|a|label|code)[^>^<]+>\s+(?=<)/gi,(function(e){return e.trim()})):""},sortByDepth:function(e,t){const n=t?1:-1,i=-1*n;e.sort(function(e,t){return this.isListCell(e)&&this.isListCell(t)?(e=this.getElementDepth(e))>(t=this.getElementDepth(t))?n:e":e.innerHTML,e.innerHTML=t.outerHTML},_setDefaultOptionStyle:function(e,t){let n="";e.height&&(n+="height:"+e.height+";"),e.minHeight&&(n+="min-height:"+e.minHeight+";"),e.maxHeight&&(n+="max-height:"+e.maxHeight+";"),e.position&&(n+="position:"+e.position+";"),e.width&&(n+="width:"+e.width+";"),e.minWidth&&(n+="min-width:"+e.minWidth+";"),e.maxWidth&&(n+="max-width:"+e.maxWidth+";");let i="",l="",o="";const s=(t=n+t).split(";");for(let t,n=0,a=s.length;n'+this._setIframeCssTags(t),e.contentDocument.body.className="sun-editor-editable",e.contentDocument.body.setAttribute("contenteditable",!0)},_setIframeCssTags:function(e){const t=e.iframeCSSFileName,n=this._w.RegExp;let i="";for(let e,l=0,o=t.length;l'}return i+("auto"===e.height?"":"")}};var L=T,k={init:function(e,t){"object"!=typeof t&&(t={});const n=document;this._initOptions(e,t);const i=n.createElement("DIV");i.className="sun-editor",e.id&&(i.id="suneditor_"+e.id);const l=n.createElement("DIV");l.className="se-container";const o=this._createToolBar(n,t.buttonList,t.plugins,t);o.element.style.visibility="hidden",o.pluginCallButtons.math&&this._checkKatexMath(t.katex);const s=n.createElement("DIV");s.className="se-arrow";const a=n.createElement("DIV");a.className="se-toolbar-sticky-dummy";const r=n.createElement("DIV");r.className="se-wrapper";const c=this._initElements(t,i,o.element,s),d=c.bottomBar,u=c.wysiwygFrame,h=c.placeholder;let g=c.codeView;const p=d.resizingBar,m=d.navigation,f=d.charWrapper,_=d.charCounter,b=n.createElement("DIV");b.className="se-loading-box sun-editor-common",b.innerHTML='
    ';const v=n.createElement("DIV");v.className="se-line-breaker",v.innerHTML='";const y=n.createElement("DIV");y.className+="se-line-breaker-component";const C=y.cloneNode(!0);y.innerHTML=C.innerHTML=t.icons.line_break;const w=n.createElement("DIV");w.className="se-resizing-back";const x=t.toolbarContainer;return x&&x.appendChild(o.element),r.appendChild(g),h&&r.appendChild(h),x||l.appendChild(o.element),l.appendChild(a),l.appendChild(r),l.appendChild(w),l.appendChild(b),l.appendChild(v),l.appendChild(y),l.appendChild(C),p&&l.appendChild(p),i.appendChild(l),g=this._checkCodeMirror(t,g),{constructed:{_top:i,_relative:l,_toolBar:o.element,_menuTray:o._menuTray,_editorArea:r,_wysiwygArea:u,_codeArea:g,_placeholder:h,_resizingBar:p,_navigation:m,_charWrapper:f,_charCounter:_,_loading:b,_lineBreaker:v,_lineBreaker_t:y,_lineBreaker_b:C,_resizeBack:w,_stickyDummy:a,_arrow:s},options:t,plugins:o.plugins,pluginCallButtons:o.pluginCallButtons,_responsiveButtons:o.responsiveButtons}},_checkCodeMirror:function(e,t){if(e.codeMirror){const n=[{mode:"htmlmixed",htmlMode:!0,lineNumbers:!0,lineWrapping:!0},e.codeMirror.options||{}].reduce((function(e,t){for(let n in t)L.hasOwn(t,n)&&(e[n]=t[n]);return e}),{});"auto"===e.height&&(n.viewportMargin=1/0,n.height="auto");const i=e.codeMirror.src.fromTextArea(t,n);i.display.wrapper.style.cssText=t.style.cssText,e.codeMirrorEditor=i,(t=i.display.wrapper).className+=" se-wrapper-code-mirror"}return t},_checkKatexMath:function(e){if(!e)throw Error('[SUNEDITOR.create.fail] To use the math button you need to add a "katex" object to the options.');const t=[{throwOnError:!1},e.options||{}].reduce((function(e,t){for(let n in t)L.hasOwn(t,n)&&(e[n]=t[n]);return e}),{});e.options=t},_setOptions:function(e,t,n,i){this._initOptions(t.element.originElement,e);const l=t.element,o=l.relative,s=l.editorArea,a=e.toolbarContainer&&e.toolbarContainer!==i.toolbarContainer,r=!!e.buttonList||e.mode!==i.mode||a,c=!!e.plugins,d=this._createToolBar(document,r?e.buttonList:i.buttonList,c?e.plugins:n,e);d.pluginCallButtons.math&&this._checkKatexMath(e.katex);const u=document.createElement("DIV");u.className="se-arrow",r&&(d.element.style.visibility="hidden",a?(e.toolbarContainer.appendChild(d.element),l.toolbar.parentElement.removeChild(l.toolbar)):l.toolbar.parentElement.replaceChild(d.element,l.toolbar),l.toolbar=d.element,l._menuTray=d._menuTray,l._arrow=u);const h=this._initElements(e,l.topArea,r?d.element:l.toolbar,u),g=h.bottomBar,p=h.wysiwygFrame,m=h.placeholder;let f=h.codeView;return l.resizingBar&&o.removeChild(l.resizingBar),g.resizingBar&&o.appendChild(g.resizingBar),s.innerHTML="",s.appendChild(f),m&&s.appendChild(m),f=this._checkCodeMirror(e,f),l.resizingBar=g.resizingBar,l.navigation=g.navigation,l.charWrapper=g.charWrapper,l.charCounter=g.charCounter,l.wysiwygFrame=p,l.code=f,l.placeholder=m,{callButtons:r?d.pluginCallButtons:null,plugins:r||c?d.plugins:null,toolbar:d}},_initElements:function(e,t,n,i){t.style.cssText=e._editorStyles.top,/inline/i.test(e.mode)?(n.className+=" se-toolbar-inline",n.style.width=e.toolbarWidth):/balloon/i.test(e.mode)&&(n.className+=" se-toolbar-balloon",n.style.width=e.toolbarWidth,n.appendChild(i));const l=document.createElement(e.iframe?"IFRAME":"DIV");l.className="se-wrapper-inner se-wrapper-wysiwyg",e.iframe?(l.allowFullscreen=!0,l.frameBorder=0,l.style.cssText=e._editorStyles.frame):(l.setAttribute("contenteditable",!0),l.setAttribute("scrolling","auto"),l.className+=" sun-editor-editable",l.style.cssText=e._editorStyles.frame+e._editorStyles.editor);const o=document.createElement("TEXTAREA");o.className="se-wrapper-inner se-wrapper-code",o.style.cssText=e._editorStyles.frame,o.style.display="none","auto"===e.height&&(o.style.overflow="hidden");let s=null,a=null,r=null,c=null;if(e.resizingBar&&(s=document.createElement("DIV"),s.className="se-resizing-bar sun-editor-common",a=document.createElement("DIV"),a.className="se-navigation sun-editor-common",s.appendChild(a),e.charCounter)){if(r=document.createElement("DIV"),r.className="se-char-counter-wrapper",e.charCounterLabel){const t=document.createElement("SPAN");t.className="se-char-label",t.textContent=e.charCounterLabel,r.appendChild(t)}if(c=document.createElement("SPAN"),c.className="se-char-counter",c.textContent="0",r.appendChild(c),e.maxCharCount>0){const t=document.createElement("SPAN");t.textContent=" / "+e.maxCharCount,r.appendChild(t)}s.appendChild(r)}let d=null;return e.placeholder&&(d=document.createElement("SPAN"),d.className="se-placeholder",d.innerText=e.placeholder),{bottomBar:{resizingBar:s,navigation:a,charWrapper:r,charCounter:c},wysiwygFrame:l,codeView:o,placeholder:d}},_initOptions:function(e,t){t.lang=t.lang||N.a,t.value="string"==typeof t.value?t.value:null,t.historyStackDelayTime="number"==typeof t.historyStackDelayTime?t.historyStackDelayTime:400,t._defaultTagsWhitelist="string"==typeof t._defaultTagsWhitelist?t._defaultTagsWhitelist:"br|p|div|pre|blockquote|h[1-6]|ol|ul|li|hr|figure|figcaption|img|iframe|audio|video|source|table|thead|tbody|tr|th|td|a|b|strong|var|i|em|u|ins|s|span|strike|del|sub|sup|code",t._editorTagsWhitelist=t._defaultTagsWhitelist+("string"==typeof t.addTagsWhitelist&&t.addTagsWhitelist.length>0?"|"+t.addTagsWhitelist:""),t.pasteTagsWhitelist="string"==typeof t.pasteTagsWhitelist?t.pasteTagsWhitelist:t._editorTagsWhitelist,t.attributesWhitelist=t.attributesWhitelist&&"object"==typeof t.attributesWhitelist?t.attributesWhitelist:null,t.mode=t.mode||"classic",t.toolbarWidth=t.toolbarWidth?L.isNumber(t.toolbarWidth)?t.toolbarWidth+"px":t.toolbarWidth:"auto",t.toolbarContainer=/balloon/i.test(t.mode)?null:"string"==typeof t.toolbarContainer?document.querySelector(t.toolbarContainer):t.toolbarContainer,t.stickyToolbar=/balloon/i.test(t.mode)||t.toolbarContainer?-1:void 0===t.stickyToolbar?0:/^\d+/.test(t.stickyToolbar)?L.getNumber(t.stickyToolbar,0):-1,t.fullPage=!!t.fullPage,t.iframe=t.fullPage||t.iframe,t.iframeCSSFileName=t.iframe?"string"==typeof t.iframeCSSFileName?[t.iframeCSSFileName]:t.iframeCSSFileName||["suneditor"]:null,t.codeMirror=t.codeMirror?t.codeMirror.src?t.codeMirror:{src:t.codeMirror}:null,t.position="string"==typeof t.position?t.position:null,t.display=t.display||("none"!==e.style.display&&e.style.display?e.style.display:"block"),t.popupDisplay=t.popupDisplay||"full",t.resizingBar=void 0===t.resizingBar?!/inline|balloon/i.test(t.mode):t.resizingBar,t.showPathLabel=!!t.resizingBar&&("boolean"!=typeof t.showPathLabel||t.showPathLabel),t.charCounter=t.maxCharCount>0||"boolean"==typeof t.charCounter&&t.charCounter,t.charCounterType="string"==typeof t.charCounterType?t.charCounterType:"char",t.charCounterLabel="string"==typeof t.charCounterLabel?t.charCounterLabel.trim():null,t.maxCharCount=L.isNumber(t.maxCharCount)&&t.maxCharCount>-1?1*t.maxCharCount:null,t.width=t.width?L.isNumber(t.width)?t.width+"px":t.width:e.clientWidth?e.clientWidth+"px":"100%",t.minWidth=(L.isNumber(t.minWidth)?t.minWidth+"px":t.minWidth)||"",t.maxWidth=(L.isNumber(t.maxWidth)?t.maxWidth+"px":t.maxWidth)||"",t.height=t.height?L.isNumber(t.height)?t.height+"px":t.height:e.clientHeight?e.clientHeight+"px":"auto",t.minHeight=(L.isNumber(t.minHeight)?t.minHeight+"px":t.minHeight)||"",t.maxHeight=(L.isNumber(t.maxHeight)?t.maxHeight+"px":t.maxHeight)||"",t.defaultStyle="string"==typeof t.defaultStyle?t.defaultStyle:"",t.font=t.font?t.font:null,t.fontSize=t.fontSize?t.fontSize:null,t.formats=t.formats?t.formats:null,t.colorList=t.colorList?t.colorList:null,t.lineHeights=t.lineHeights?t.lineHeights:null,t.paragraphStyles=t.paragraphStyles?t.paragraphStyles:null,t.textStyles=t.textStyles?t.textStyles:null,t.fontSizeUnit="string"==typeof t.fontSizeUnit&&t.fontSizeUnit.trim()||"px",t.imageResizing=void 0===t.imageResizing||t.imageResizing,t.imageHeightShow=void 0===t.imageHeightShow||!!t.imageHeightShow,t.imageWidth=t.imageWidth?L.isNumber(t.imageWidth)?t.imageWidth+"px":t.imageWidth:"auto",t.imageHeight=t.imageHeight?L.isNumber(t.imageHeight)?t.imageHeight+"px":t.imageHeight:"auto",t.imageSizeOnlyPercentage=!!t.imageSizeOnlyPercentage,t._imageSizeUnit=t.imageSizeOnlyPercentage?"%":"px",t.imageRotation=void 0!==t.imageRotation?t.imageRotation:!(t.imageSizeOnlyPercentage||!t.imageHeightShow),t.imageFileInput=void 0===t.imageFileInput||t.imageFileInput,t.imageUrlInput=void 0===t.imageUrlInput||!t.imageFileInput||t.imageUrlInput,t.imageUploadHeader=t.imageUploadHeader||null,t.imageUploadUrl="string"==typeof t.imageUploadUrl?t.imageUploadUrl:null,t.imageUploadSizeLimit=/\d+/.test(t.imageUploadSizeLimit)?L.getNumber(t.imageUploadSizeLimit,0):null,t.imageMultipleFile=!!t.imageMultipleFile,t.imageAccept="string"!=typeof t.imageAccept||"*"===t.imageAccept.trim()?"image/*":t.imageAccept.trim()||"image/*",t.imageGalleryUrl="string"==typeof t.imageGalleryUrl?t.imageGalleryUrl:null,t.videoResizing=void 0===t.videoResizing||t.videoResizing,t.videoHeightShow=void 0===t.videoHeightShow||!!t.videoHeightShow,t.videoRatioShow=void 0===t.videoRatioShow||!!t.videoRatioShow,t.videoWidth=t.videoWidth&&L.getNumber(t.videoWidth,0)?L.isNumber(t.videoWidth)?t.videoWidth+"px":t.videoWidth:"",t.videoHeight=t.videoHeight&&L.getNumber(t.videoHeight,0)?L.isNumber(t.videoHeight)?t.videoHeight+"px":t.videoHeight:"",t.videoSizeOnlyPercentage=!!t.videoSizeOnlyPercentage,t._videoSizeUnit=t.videoSizeOnlyPercentage?"%":"px",t.videoRotation=void 0!==t.videoRotation?t.videoRotation:!(t.videoSizeOnlyPercentage||!t.videoHeightShow),t.videoRatio=L.getNumber(t.videoRatio,4)||.5625,t.videoRatioList=t.videoRatioList?t.videoRatioList:null,t.youtubeQuery=(t.youtubeQuery||"").replace("?",""),t.videoFileInput=!!t.videoFileInput,t.videoUrlInput=void 0===t.videoUrlInput||!t.videoFileInput||t.videoUrlInput,t.videoUploadHeader=t.videoUploadHeader||null,t.videoUploadUrl="string"==typeof t.videoUploadUrl?t.videoUploadUrl:null,t.videoUploadSizeLimit=/\d+/.test(t.videoUploadSizeLimit)?L.getNumber(t.videoUploadSizeLimit,0):null,t.videoMultipleFile=!!t.videoMultipleFile,t.videoTagAttrs=t.videoTagAttrs||null,t.videoIframeAttrs=t.videoIframeAttrs||null,t.videoAccept="string"!=typeof t.videoAccept||"*"===t.videoAccept.trim()?"video/*":t.videoAccept.trim()||"video/*",t.audioWidth=t.audioWidth?L.isNumber(t.audioWidth)?t.audioWidth+"px":t.audioWidth:"",t.audioHeight=t.audioHeight?L.isNumber(t.audioHeight)?t.audioHeight+"px":t.audioHeight:"",t.audioFileInput=!!t.audioFileInput,t.audioUrlInput=void 0===t.audioUrlInput||!t.audioFileInput||t.audioUrlInput,t.audioUploadHeader=t.audioUploadHeader||null,t.audioUploadUrl="string"==typeof t.audioUploadUrl?t.audioUploadUrl:null,t.audioUploadSizeLimit=/\d+/.test(t.audioUploadSizeLimit)?L.getNumber(t.audioUploadSizeLimit,0):null,t.audioMultipleFile=!!t.audioMultipleFile,t.audioTagAttrs=t.audioTagAttrs||null,t.audioAccept="string"!=typeof t.audioAccept||"*"===t.audioAccept.trim()?"audio/*":t.audioAccept.trim()||"audio/*",t.tableCellControllerPosition="string"==typeof t.tableCellControllerPosition?t.tableCellControllerPosition.toLowerCase():"cell",t.tabDisable=!!t.tabDisable,t.shortcutsDisable=Array.isArray(t.shortcutsDisable)&&t.shortcutsDisable.length>0?t.shortcutsDisable.map((function(e){return e.toLowerCase()})):[],t.shortcutsHint=void 0===t.shortcutsHint||!!t.shortcutsHint,t.callBackSave=t.callBackSave?t.callBackSave:null,t.templates=t.templates?t.templates:null,t.placeholder="string"==typeof t.placeholder?t.placeholder:null,t.linkProtocol="string"==typeof t.linkProtocol?t.linkProtocol:null,t.katex=t.katex?t.katex.src?t.katex:{src:t.katex}:null,t.buttonList=t.buttonList||[["undo","redo"],["bold","underline","italic","strike","subscript","superscript"],["removeFormat"],["outdent","indent"],["fullScreen","showBlocks","codeView"],["preview","print"]],t.icons=t.icons&&"object"==typeof t.icons?[E,t.icons].reduce((function(e,t){for(let n in t)L.hasOwn(t,n)&&(e[n]=t[n]);return e}),{}):E,t._editorStyles=L._setDefaultOptionStyle(t,t.defaultStyle)},_defaultButtons:function(e){const t=e.icons,n=e.lang,i=L.isOSX_IOS?"⌘":"CTRL",l=e.shortcutsHint?e.shortcutsDisable:["bold","strike","underline","italic","undo","indent"];return{bold:["_se_command_bold",n.toolbar.bold+(l.indexOf("bold")>-1?"":" ("+i+"+B)"),"STRONG","",t.bold],underline:["_se_command_underline",n.toolbar.underline+(l.indexOf("underline")>-1?"":" ("+i+"+U)"),"U","",t.underline],italic:["_se_command_italic",n.toolbar.italic+(l.indexOf("italic")>-1?"":" ("+i+"+I)"),"EM","",t.italic],strike:["_se_command_strike",n.toolbar.strike+(l.indexOf("strike")>-1?"":" ("+i+"+SHIFT+S)"),"DEL","",t.strike],subscript:["_se_command_subscript",n.toolbar.subscript,"SUB","",t.subscript],superscript:["_se_command_superscript",n.toolbar.superscript,"SUP","",t.superscript],removeFormat:["",n.toolbar.removeFormat,"removeFormat","",t.erase],indent:["_se_command_indent",n.toolbar.indent+(l.indexOf("indent")>-1?"":" ("+i+"+])"),"indent","",t.outdent],outdent:["_se_command_outdent",n.toolbar.outdent+(l.indexOf("indent")>-1?"":" ("+i+"+[)"),"outdent","",t.indent],fullScreen:["se-code-view-enabled se-resizing-enabled _se_command_fullScreen",n.toolbar.fullScreen,"fullScreen","",t.expansion],showBlocks:["_se_command_showBlocks",n.toolbar.showBlocks,"showBlocks","",t.show_blocks],codeView:["se-code-view-enabled se-resizing-enabled _se_command_codeView",n.toolbar.codeView,"codeView","",t.code_view],undo:["_se_command_undo se-resizing-enabled",n.toolbar.undo+(l.indexOf("undo")>-1?"":" ("+i+"+Z)"),"undo","",t.undo],redo:["_se_command_redo se-resizing-enabled",n.toolbar.redo+(l.indexOf("undo")>-1?"":" ("+i+"+Y / "+i+"+SHIFT+Z)"),"redo","",t.redo],preview:["se-resizing-enabled",n.toolbar.preview,"preview","",t.preview],print:["se-resizing-enabled",n.toolbar.print,"print","",t.print],save:["_se_command_save se-resizing-enabled",n.toolbar.save,"save","",t.save],blockquote:["",n.toolbar.tag_blockquote,"blockquote","command",t.blockquote],font:["se-btn-select se-btn-tool-font",n.toolbar.font,"font","submenu",''+n.toolbar.font+""+t.arrow_down],formatBlock:["se-btn-select se-btn-tool-format",n.toolbar.formats,"formatBlock","submenu",''+n.toolbar.formats+""+t.arrow_down],fontSize:["se-btn-select se-btn-tool-size",n.toolbar.fontSize,"fontSize","submenu",''+n.toolbar.fontSize+""+t.arrow_down],fontColor:["",n.toolbar.fontColor,"fontColor","submenu",t.font_color],hiliteColor:["",n.toolbar.hiliteColor,"hiliteColor","submenu",t.highlight_color],align:["se-btn-align",n.toolbar.align,"align","submenu",t.align_left],list:["",n.toolbar.list,"list","submenu",t.list_number],horizontalRule:["btn_line",n.toolbar.horizontalRule,"horizontalRule","submenu",t.horizontal_rule],table:["",n.toolbar.table,"table","submenu",t.table],lineHeight:["",n.toolbar.lineHeight,"lineHeight","submenu",t.line_height],template:["",n.toolbar.template,"template","submenu",t.template],paragraphStyle:["",n.toolbar.paragraphStyle,"paragraphStyle","submenu",t.paragraph_style],textStyle:["",n.toolbar.textStyle,"textStyle","submenu",t.text_style],link:["",n.toolbar.link,"link","dialog",t.link],image:["",n.toolbar.image,"image","dialog",t.image],video:["",n.toolbar.video,"video","dialog",t.video],audio:["",n.toolbar.audio,"audio","dialog",t.audio],math:["",n.toolbar.math,"math","dialog",t.math],imageGallery:["",n.toolbar.imageGallery,"imageGallery","fileBrowser",t.image_gallery]}},_createModuleGroup:function(){const e=L.createElement("DIV");e.className="se-btn-module se-btn-module-border";const t=L.createElement("UL");return t.className="se-menu-list",e.appendChild(t),{div:e,ul:t}},_createButton:function(e,t,n,i,l,o,s){const a=L.createElement("LI"),r=L.createElement("BUTTON");return r.setAttribute("type","button"),r.setAttribute("class","se-btn"+(e?" "+e:"")+" se-tooltip"),r.setAttribute("data-command",n),r.setAttribute("data-display",i),r.setAttribute("tabindex","-1"),l||(l='!'),/^default\./i.test(l)&&(l=s[l.replace(/^default\./i,"")]),/^text\./i.test(l)&&(l=l.replace(/^text\./i,""),r.className+=" se-btn-more-text"),l+=''+(t||n)+"",o&&r.setAttribute("disabled",!0),r.innerHTML=l,a.appendChild(r),{li:a,button:r}},_createToolBar:function(e,t,n,i){const l=e.createElement("DIV");l.className="se-toolbar-separator-vertical";const o=e.createElement("DIV");o.className="se-toolbar sun-editor-common";const s=e.createElement("DIV");s.className="se-btn-tray",o.appendChild(s);const a=i.icons,r=this._defaultButtons(i),c={},d=[],u={};if(n){const e=n.length?n:Object.keys(n).map((function(e){return n[e]}));for(let t,n=0,i=e.length;n",b.appendChild(i),i=i.firstElementChild.firstElementChild)}if(_){const e=l.cloneNode(!1);y&&(e.style.float=y),s.appendChild(e)}s.appendChild(p.div),_=!0}else if(/^\/$/.test(v)){const t=e.createElement("DIV");t.className="se-btn-module-enter",s.appendChild(t),_=!1}1===s.children.length&&L.removeClass(s.firstElementChild,"se-btn-module-border"),d.length>0&&d.unshift(t),b.children.length>0&&s.appendChild(b);const v=e.createElement("DIV");v.className="se-menu-tray",o.appendChild(v);const y=e.createElement("DIV");return y.className="se-toolbar-cover",o.appendChild(y),{element:o,plugins:u,pluginCallButtons:c,responsiveButtons:d,_menuTray:v,_buttonTray:s}}};var A=function(e,t,n){return{element:{originElement:e,topArea:t._top,relative:t._relative,toolbar:t._toolBar,_buttonTray:t._toolBar.querySelector(".se-btn-tray"),_menuTray:t._menuTray,resizingBar:t._resizingBar,navigation:t._navigation,charWrapper:t._charWrapper,charCounter:t._charCounter,editorArea:t._editorArea,wysiwygFrame:t._wysiwygArea,wysiwyg:t._wysiwygArea,code:t._codeArea,placeholder:t._placeholder,loading:t._loading,lineBreaker:t._lineBreaker,lineBreaker_t:t._lineBreaker_t,lineBreaker_b:t._lineBreaker_b,resizeBackground:t._resizeBack,_stickyDummy:t._stickyDummy,_arrow:t._arrow},tool:{cover:t._toolBar.querySelector(".se-toolbar-cover"),bold:t._toolBar.querySelector("._se_command_bold"),underline:t._toolBar.querySelector("._se_command_underline"),italic:t._toolBar.querySelector("._se_command_italic"),strike:t._toolBar.querySelector("._se_command_strike"),subscript:t._toolBar.querySelector("._se_command_subscript"),superscript:t._toolBar.querySelector("._se_command_superscript"),undo:t._toolBar.querySelector("._se_command_undo"),redo:t._toolBar.querySelector("._se_command_redo"),save:t._toolBar.querySelector("._se_command_save"),outdent:t._toolBar.querySelector("._se_command_outdent"),indent:t._toolBar.querySelector("._se_command_indent"),fullScreen:t._toolBar.querySelector("._se_command_fullScreen"),showBlocks:t._toolBar.querySelector("._se_command_showBlocks"),codeView:t._toolBar.querySelector("._se_command_codeView")},options:n,option:n}},B={name:"notice",add:function(e){const t=e.context;t.notice={};let n=e.util.createElement("DIV"),i=e.util.createElement("SPAN"),l=e.util.createElement("BUTTON");n.className="se-notice",l.className="close",l.setAttribute("aria-label","Close"),l.setAttribute("title",e.lang.dialogBox.close),l.innerHTML=e.icons.cancel,n.appendChild(i),n.appendChild(l),t.notice.modal=n,t.notice.message=i,l.addEventListener("click",this.onClick_cancel.bind(e)),t.element.editorArea.appendChild(n),n=null},onClick_cancel:function(e){e.preventDefault(),e.stopPropagation(),this.plugins.notice.close.call(this)},open:function(e){this.context.notice.message.textContent=e,this.context.notice.modal.style.display="block"},close:function(){this.context.notice.modal.style.display="none"}},z={init:function(e){return{create:function(t,n){return this.create(t,n,e)}.bind(this)}},create:function(e,t,n){L._propertiesInit(),"object"!=typeof t&&(t={}),n&&(t=[n,t].reduce((function(e,t){for(let n in t)if(L.hasOwn(t,n))if("plugins"===n&&t[n]&&e[n]){let i=e[n],l=t[n];i=i.length?i:Object.keys(i).map((function(e){return i[e]})),l=l.length?l:Object.keys(l).map((function(e){return l[e]})),e[n]=l.filter((function(e){return-1===i.indexOf(e)})).concat(i)}else e[n]=t[n];return e}),{}));const i="string"==typeof e?document.getElementById(e):e;if(!i){if("string"==typeof e)throw Error('[SUNEDITOR.create.fail] The element for that id was not found (ID:"'+e+'")');throw Error("[SUNEDITOR.create.fail] suneditor requires textarea's element or id value")}const l=k.init(i,t);if(l.constructed._top.id&&document.getElementById(l.constructed._top.id))throw Error('[SUNEDITOR.create.fail] The ID of the suneditor you are trying to create already exists (ID:"'+l.constructed._top.id+'")');return function(e,t,n,i,l,o){const s=e.element.originElement.ownerDocument||document,a=s.defaultView||window,r=L,c=l.icons,d={_d:s,_w:a,_parser:new a.DOMParser,_wd:null,_ww:null,_shadowRoot:null,util:r,functions:null,notice:B,icons:c,history:null,context:e,pluginCallButtons:t,plugins:n||{},initPlugins:{},_targetPlugins:{},_menuTray:{},lang:i,effectNode:null,submenu:null,container:null,_submenuName:"",_bindedSubmenuOff:null,_bindedContainerOff:null,submenuActiveButton:null,containerActiveButton:null,controllerArray:[],currentControllerName:"",currentControllerTarget:null,currentFileComponentInfo:null,codeViewDisabledButtons:null,resizingDisabledButtons:null,_moreLayerActiveButton:null,_htmlCheckWhitelistRegExp:null,_disallowedTextTagsRegExp:null,editorTagsWhitelistRegExp:null,pasteTagsWhitelistRegExp:null,hasFocus:!1,isDisabled:!1,_attributesWhitelistRegExp:null,_attributesTagsWhitelist:null,_bindControllersOff:null,_isInline:null,_isBalloon:null,_isBalloonAlways:null,_inlineToolbarAttr:{top:"",width:"",isShow:!1},_notHideToolbar:!1,_sticky:!1,_antiBlur:!1,_lineBreaker:null,_lineBreakerButton:null,_componentsInfoInit:!0,_componentsInfoReset:!1,activePlugins:null,managedTagsInfo:null,_charTypeHTML:!1,_fileInfoPluginsCheck:null,_fileInfoPluginsReset:null,_fileManager:{tags:null,regExp:null,queryString:null,pluginRegExp:null,pluginMap:null},commandMap:null,_styleCommandMap:null,_defaultCommand:{bold:"STRONG",underline:"U",italic:"EM",strike:"DEL",subscript:"SUB",superscript:"SUP"},_variable:{isCodeView:!1,isFullScreen:!1,innerHeight_fullScreen:0,resizeClientY:0,tabSize:4,codeIndent:4,minResizingSize:r.getNumber(e.element.wysiwygFrame.style.minHeight||"65",0),currentNodes:[],currentNodesMap:[],_range:null,_selectionNode:null,_originCssText:e.element.topArea.style.cssText,_bodyOverflow:"",_editorAreaOriginCssText:"",_wysiwygOriginCssText:"",_codeOriginCssText:"",_fullScreenAttrs:{sticky:!1,balloon:!1,inline:!1},_lineBreakComp:null,_lineBreakDir:""},callPlugin:function(e,n,i){if(i=i||t[e],!this.plugins[e])throw Error('[SUNEDITOR.core.callPlugin.fail] The called plugin does not exist or is in an invalid format. (pluginName:"'+e+'")');this.initPlugins[e]?"object"==typeof this._targetPlugins[e]&&i&&this.initMenuTarget(e,i,this._targetPlugins[e]):(this.plugins[e].add(this,i),this.initPlugins[e]=!0),this.plugins[e].active&&!this.commandMap[e]&&i&&(this.commandMap[e]=i,this.activePlugins.push(e)),"function"==typeof n&&n()},addModule:function(e){for(let t,n=0,i=e.length;nb?(n.style.height=l+"px",e=-1*(l-g+3)):(n.style.height=b+"px",e=g+t.parentElement.offsetHeight),n.style.top=e+"px"}else n.style.top=g+t.parentElement.offsetHeight+"px";n.style.visibility=""},controllersOn:function(){this._bindControllersOff&&this._bindControllersOff(),this.controllerArray=[];for(let e,t=0;t0){for(let e=0;e":n),this.history.push(!0)},nativeFocus:function(){const t=r.getParentElement(this.getSelectionNode(),"figcaption");t?t.focus():e.element.wysiwyg.focus(),this._editorRange()},focus:function(){if("none"!==e.element.wysiwygFrame.style.display){if(l.iframe)this.nativeFocus();else try{const t=this.getRange();if(t.startContainer===t.endContainer&&r.isWysiwygDiv(t.startContainer)){const t=r.createElement("P"),n=r.createElement("BR");t.appendChild(n),e.element.wysiwyg.appendChild(t),this.setRange(n,0,n,0)}else this.setRange(t.startContainer,t.startOffset,t.endContainer,t.endOffset)}catch(e){this.nativeFocus()}u._applyTagEffects(),this._isBalloon&&u._toggleToolbarBalloon()}},focusEdge:function(t){t||(t=e.element.wysiwyg.lastElementChild);const n=this.getFileComponent(t);n?this.selectComponent(n.target,n.pluginName):t?(t=r.getChildElement(t,(function(e){return 0===e.childNodes.length||3===e.nodeType}),!0))?this.setRange(t,t.textContent.length,t,t.textContent.length):this.nativeFocus():this.focus()},setRange:function(e,t,n,i){if(!e||!n)return;t>e.textContent.length&&(t=e.textContent.length),i>n.textContent.length&&(i=n.textContent.length);const o=this._wd.createRange();try{o.setStart(e,t),o.setEnd(n,i)}catch(e){return console.warn("[SUNEDITOR.core.focus.error] "+e),void this.nativeFocus()}const s=this.getSelection();return s.removeAllRanges&&s.removeAllRanges(),s.addRange(o),this._editorRange(),l.iframe&&this.nativeFocus(),o},removeRange:function(){this._variable._range=null,this._variable._selectionNode=null,this.getSelection().removeAllRanges();const e=this.commandMap,t=this.activePlugins;for(let i in e)r.hasOwn(e,i)&&(t.indexOf(i)>-1?n[i].active.call(this,null):e.OUTDENT&&/^OUTDENT$/i.test(i)?e.OUTDENT.setAttribute("disabled",!0):e.INDENT&&/^INDENT$/i.test(i)?e.INDENT.removeAttribute("disabled"):r.removeClass(e[i],"active"))},getRange:function(){const t=this._variable._range||this._createDefaultRange(),n=this.getSelection();if(t.collapsed===n.isCollapsed||!e.element.wysiwyg.contains(n.focusNode))return t;if(n.rangeCount>0)return this._variable._range=n.getRangeAt(0),this._variable._range;{const e=n.anchorNode,t=n.focusNode,i=n.anchorOffset,l=n.focusOffset,o=r.compareElements(e,t),s=o.ancestor&&(0===o.result?i<=l:o.result>1);return this.setRange(s?e:t,s?i:l,s?t:e,s?l:i)}},getRange_addLine:function(t){if(this._selectionVoid(t)){const n=e.element.wysiwyg,i=r.createElement("P");i.innerHTML="
    ",n.insertBefore(i,n.firstElementChild),this.setRange(i.firstElementChild,0,i.firstElementChild,1),t=this._variable._range}return t},getSelection:function(){return this._shadowRoot&&this._shadowRoot.getSelection?this._shadowRoot.getSelection():this._ww.getSelection()},getSelectionNode:function(){if(r.isWysiwygDiv(this._variable._selectionNode)&&this._editorRange(),!this._variable._selectionNode){const t=r.getChildElement(e.element.wysiwyg.firstChild,(function(e){return 0===e.childNodes.length||3===e.nodeType}),!1);if(t)return this._variable._selectionNode=t,t;this._editorRange()}return this._variable._selectionNode},_editorRange:function(){const e=this.getSelection();if(!e)return null;let t=null,n=null;t=e.rangeCount>0?e.getRangeAt(0):this._createDefaultRange(),this._variable._range=t,n=t.collapsed?t.commonAncestorContainer:e.extentNode||e.anchorNode,this._variable._selectionNode=n},_createDefaultRange:function(){const t=e.element.wysiwyg;t.focus();const n=this._wd.createRange();let i=t.firstElementChild;return i||(i=r.createElement("P"),i.innerHTML="
    ",t.appendChild(i)),n.setStart(i,0),n.setEnd(i,0),n},_selectionVoid:function(e){const t=e.commonAncestorContainer;return r.isWysiwygDiv(e.startContainer)&&r.isWysiwygDiv(e.endContainer)||/FIGURE/i.test(t.nodeName)||this._fileManager.regExp.test(t.nodeName)||r.isMediaComponent(t)},_resetRangeToTextNode:function(){const t=this.getRange();if(this._selectionVoid(t))return!1;let n,i,l,o=t.startContainer,s=t.startOffset,a=t.endContainer,c=t.endOffset;if(r.isFormatElement(o)&&(o=o.childNodes[s]||o.lastChild,s=o.textContent.length),r.isFormatElement(a)&&(a=a.childNodes[c]||a.lastChild,c=a.textContent.length),n=r.isWysiwygDiv(o)?e.element.wysiwyg.firstChild:o,i=s,r.isBreak(n)||1===n.nodeType&&n.childNodes.length>0){const e=r.isBreak(n);if(!e){for(;n&&!r.isBreak(n)&&1===n.nodeType;)n=n.childNodes[i]||n.nextElementSibling||n.nextSibling,i=0;let e=r.getFormatElement(n,null);e===r.getRangeFormatElement(e,null)&&(e=r.createElement(r.getParentElement(n,r.isCell)?"DIV":"P"),n.parentNode.insertBefore(e,n),e.appendChild(n))}if(r.isBreak(n)){const t=r.createTextNode(r.zeroWidthSpace);n.parentNode.insertBefore(t,n),n=t,e&&o===a&&(a=n,c=1)}}if(o=n,s=i,n=r.isWysiwygDiv(a)?e.element.wysiwyg.lastChild:a,i=c,r.isBreak(n)||1===n.nodeType&&n.childNodes.length>0){const e=r.isBreak(n);if(!e){for(;n&&!r.isBreak(n)&&1===n.nodeType&&(l=n.childNodes,0!==l.length);)n=l[i>0?i-1:i]||!/FIGURE/i.test(l[0].nodeName)?l[0]:n.previousElementSibling||n.previousSibling||o,i=i>0?n.textContent.length:i;let e=r.getFormatElement(n,null);e===r.getRangeFormatElement(e,null)&&(e=r.createElement(r.isCell(e)?"DIV":"P"),n.parentNode.insertBefore(e,n),e.appendChild(n))}if(r.isBreak(n)){const t=r.createTextNode(r.zeroWidthSpace);n.parentNode.insertBefore(t,n),n=t,i=1,e&&!n.previousSibling&&r.removeItem(a)}}return a=n,c=i,this.setRange(o,s,a,c),!0},getSelectedElements:function(t){if(!this._resetRangeToTextNode())return[];let n=this.getRange();if(r.isWysiwygDiv(n.startContainer)){const t=e.element.wysiwyg.children;if(0===t.length)return[];this.setRange(t[0],0,t[t.length-1],t[t.length-1].textContent.trim().length),n=this.getRange()}const i=n.startContainer,l=n.endContainer,o=n.commonAncestorContainer,s=r.getListChildren(o,(function(e){return t?t(e):r.isFormatElement(e)}));if(r.isWysiwygDiv(o)||r.isRangeFormatElement(o)||s.unshift(r.getFormatElement(o,null)),i===l||1===s.length)return s;let a=r.getFormatElement(i,null),c=r.getFormatElement(l,null),d=null,u=null;const h=function(e){return!r.isTable(e)||/^TABLE$/i.test(e.nodeName)};let g=r.getRangeFormatElement(a,h),p=r.getRangeFormatElement(c,h);r.isTable(g)&&r.isListCell(g.parentNode)&&(g=g.parentNode),r.isTable(p)&&r.isListCell(p.parentNode)&&(p=p.parentNode);const m=g===p;for(let e,t=0,n=s.length;t=0;n--)if(i[n].contains(i[e])){i.splice(e,1),e--,t--;break}return i},isEdgePoint:function(e,t){return 0===t||!e.nodeValue&&1===t||t===e.nodeValue.length},showLoading:function(){e.element.loading.style.display="block"},closeLoading:function(){e.element.loading.style.display="none"},appendFormatTag:function(e,t){const n=r.getFormatElement(this.getSelectionNode(),null),i=t?"string"==typeof t?t:t.nodeName:r.isFormatElement(n)&&!r.isFreeFormatElement(n)?n.nodeName:"P",l=r.createElement(i);return l.innerHTML="
    ",(t&&"string"!=typeof t||!t&&r.isFormatElement(n))&&r.copyTagAttributes(l,t||n),r.isCell(e)?e.insertBefore(l,e.nextElementSibling):e.parentNode.insertBefore(l,e.nextElementSibling),l},insertComponent:function(e,t,n,i){if(n&&!this.checkCharCount(e,null))return null;const l=this.removeNode();this.getRange_addLine(this.getRange());let o=null,s=this.getSelectionNode(),a=r.getFormatElement(s,null);if(r.isListCell(a))this.insertNode(e,s===a?null:l.container.nextSibling,!1),e.nextSibling||e.parentNode.appendChild(r.createElement("BR"));else{if(this.getRange().collapsed&&(3===l.container.nodeType||r.isBreak(l.container))){const e=r.getParentElement(l.container,function(e){return this.isRangeFormatElement(e)}.bind(r));o=r.splitElement(l.container,l.offset,e?r.getElementDepth(e)+1:0),o&&(a=o.previousSibling)}this.insertNode(e,a,!1),a&&r.onlyZeroWidthSpace(a)&&r.removeItem(a)}if(!i){const t=this.getFileComponent(e);t?this.selectComponent(t.target,t.pluginName):o&&(o=r.getEdgeChildNodes(o,null).sc||o,this.setRange(o,0,o,0))}return t||this.history.push(1),o||e},getFileComponent:function(e){if(!this._fileManager.queryString||!e)return null;let t,n;return(/^FIGURE$/i.test(e.nodeName)||/se-component/.test(e.className))&&(t=e.querySelector(this._fileManager.queryString)),!t&&e.nodeName&&this._fileManager.regExp.test(e.nodeName)&&(t=e),t&&(n=this._fileManager.pluginMap[t.nodeName.toLowerCase()],n)?{target:t,component:r.getParentElement(t,r.isComponent),pluginName:n}:null},selectComponent:function(e,t){this.hasFocus||this.focus();const n=this.plugins[t];n&&a.setTimeout(function(){"function"==typeof n.select&&this.callPlugin(t,n.select.bind(this,e),null),this._setComponentLineBreaker(e)}.bind(this))},_setComponentLineBreaker:function(t){this._lineBreaker.style.display="none";const n=r.getParentElement(t,r.isComponent),i=e.element.lineBreaker_t.style,l=e.element.lineBreaker_b.style,o="block"===this.context.resizing.resizeContainer.style.display?this.context.resizing.resizeContainer:t,s=r.isListCell(n.parentNode);let a,c,d;(s?n.previousSibling:r.isFormatElement(n.previousElementSibling))?i.display="none":(this._variable._lineBreakComp=n,c=e.element.wysiwyg.scrollTop,a=r.getOffset(t,e.element.wysiwygFrame).top+c,d=o.offsetWidth/2/2,i.top=a-c-12+"px",i.left=r.getOffset(o).left+d+"px",i.display="block"),(s?n.nextSibling:r.isFormatElement(n.nextElementSibling))?l.display="none":(a||(this._variable._lineBreakComp=n,c=e.element.wysiwyg.scrollTop,a=r.getOffset(t,e.element.wysiwygFrame).top+c,d=o.offsetWidth/2/2),l.top=a+o.offsetHeight-c-12+"px",l.left=r.getOffset(o).left+o.offsetWidth-d-24+"px",l.display="block")},insertNode:function(e,t,n){if(n&&!this.checkCharCount(e,null))return null;const i=r.getFreeFormatElement(this.getSelectionNode(),null),l=!i&&(r.isFormatElement(e)||r.isRangeFormatElement(e))||r.isComponent(e);if(!t&&l){const e=this.removeNode();if(3===e.container.nodeType||r.isBreak(e.container)){const n=r.getParentElement(e.container,function(e){return this.isRangeFormatElement(e)||this.isListCell(e)}.bind(r));(t=r.splitElement(e.container,e.offset,n?r.getElementDepth(n)+1:0))&&(t=t.previousSibling)}}const o=t||l?this.getRange():this.getRange_addLine(this.getRange()),s=o.commonAncestorContainer,a=o.startOffset,c=o.endOffset,d=o.startContainer===s&&r.isFormatElement(s),u=d?s.childNodes[a]:o.startContainer,h=d?s.childNodes[c]:o.endContainer;let g,p=null;if(t)g=t.parentNode,t=t.nextSibling,p=!0;else if(g=u,3===u.nodeType&&(g=u.parentNode),o.collapsed)if(3===s.nodeType)t=s.textContent.length>c?s.splitText(c):s.nextSibling;else if(r.isBreak(g))t=g,g=g.parentNode;else{let n=g.childNodes[a];const i=n&&3===n.nodeType&&r.onlyZeroWidthSpace(n)&&r.isBreak(n.nextSibling)?n.nextSibling:n;i?i.nextSibling?t=r.isBreak(i)&&!r.isBreak(e)?i:i.nextSibling:(g.removeChild(i),t=null):t=null}else{if(u===h){t=this.isEdgePoint(h,c)?h.nextSibling:h.splitText(c);let e=u;this.isEdgePoint(u,a)||(e=u.splitText(a)),g.removeChild(e),0===g.childNodes.length&&l&&(g.innerHTML="
    ")}else{const e=this.removeNode(),n=e.container,i=e.prevContainer;if(n&&0===n.childNodes.length&&l&&(r.isFormatElement(n)?n.innerHTML="
    ":r.isRangeFormatElement(n)&&(n.innerHTML="


    ")),!l&&i)if(g=3===i.nodeType?i.parentNode:i,g.contains(n))for(t=n;t.parentNode===g;)t=t.parentNode;else t=null;else g=l?s:n,t=l?h:null;for(;t&&!r.isFormatElement(t)&&t.parentNode!==s;)t=t.parentNode}}try{if(r.isFormatElement(e)||r.isRangeFormatElement(e)||!r.isListCell(g)&&r.isComponent(e)){const e=g;if(r.isList(t))g=t,t=null;else if(r.isListCell(t))g=t.previousElementSibling||t;else if(!p&&!t){const e=this.removeNode(),n=3===e.container.nodeType?r.isListCell(r.getFormatElement(e.container,null))?e.container:r.getFormatElement(e.container,null)||e.container.parentNode:e.container,i=r.isWysiwygDiv(n)||r.isRangeFormatElement(n);g=i?n:n.parentNode,t=i?null:n.nextSibling}0===e.childNodes.length&&g!==e&&r.removeItem(e)}!l||i||r.isRangeFormatElement(g)||r.isListCell(g)||r.isWysiwygDiv(g)||(t=g.nextElementSibling,g=g.parentNode),g.insertBefore(e,g===t?g.lastChild:t)}catch(t){g.appendChild(e)}finally{if(i&&(r.isFormatElement(e)||r.isRangeFormatElement(e))&&(e=this._setIntoFreeFormat(e)),!r.isComponent(e)){let t=1;if(3===e.nodeType){const t=e.previousSibling,n=e.nextSibling,i=!t||1===t.nodeType||r.onlyZeroWidthSpace(t)?"":t.textContent,l=!n||1===n.nodeType||r.onlyZeroWidthSpace(n)?"":n.textContent;t&&i.length>0&&(e.textContent=i+e.textContent,r.removeItem(t)),n&&n.length>0&&(e.textContent+=l,r.removeItem(n));const o={container:e,startOffset:i.length,endOffset:e.textContent.length-l.length};return this.setRange(e,o.startOffset,e,o.endOffset),o}if(!r.isBreak(e)&&r.isFormatElement(g)){let n=null;e.previousSibling||(n=r.createTextNode(r.zeroWidthSpace),e.parentNode.insertBefore(n,e)),e.nextSibling||(n=r.createTextNode(r.zeroWidthSpace),e.parentNode.appendChild(n)),r._isIgnoreNodeChange(e)&&(e=e.nextSibling,t=0)}this.setRange(e,t,e,t)}return this.history.push(!0),e}},_setIntoFreeFormat:function(e){const t=e.parentNode;let n,i;for(;r.isFormatElement(e)||r.isRangeFormatElement(e);){for(n=e.childNodes,i=null;n[0];)if(i=n[0],r.isFormatElement(i)||r.isRangeFormatElement(i)){if(this._setIntoFreeFormat(i),!e.parentNode)break;n=e.childNodes}else t.insertBefore(i,e);0===e.childNodes.length&&r.removeItem(e),e=r.createElement("BR"),t.insertBefore(e,i.nextSibling)}return e},removeNode:function(){this._resetRangeToTextNode()||console.warn('[SUNEDITOR.core.removeNode.exception] An exception occurred while resetting the "Range" object.');const t=this.getRange();let n,i=0,l=t.startContainer,o=t.endContainer;const s=t.startOffset,a=t.endOffset,c=t.commonAncestorContainer;let d=null,u=null;const h=r.getListChildNodes(c,null);let g=r.getArrayIndex(h,l),p=r.getArrayIndex(h,o);if(h.length>0&&g>-1&&p>-1){for(let e=g+1,t=l;e>=0;e--)h[e]===t.parentNode&&h[e].firstChild===t&&0===s&&(g=e,t=t.parentNode);for(let e=p-1,t=o;e>g;e--)h[e]===t.parentNode&&1===h[e].nodeType&&(h.splice(e,1),t=t.parentNode,--p)}else{if(0===h.length){if(r.isFormatElement(c)||r.isRangeFormatElement(c)||r.isWysiwygDiv(c)||r.isBreak(c)||r.isMedia(c))return{container:c,offset:0};h.push(c),l=o=c}else if(l=o=h[0],r.isBreak(l)||r.onlyZeroWidthSpace(l))return{container:l,offset:0};g=p=0}function m(e){const t=r.getFormatElement(e,null);if(r.removeItem(e),r.isListCell(t)){const e=r.getArrayItem(t.children,r.isList,!1);if(e){const n=e.firstElementChild,i=n.childNodes;for(;i[0];)t.insertBefore(i[0],e);r.removeItemAllParents(n,null,null)}}}for(let e=g;e<=p;e++){const t=h[e];if(0===t.length||3===t.nodeType&&void 0===t.data)m(t);else if(t!==l)t!==o?m(t):(u=1===o.nodeType?r.createTextNode(o.textContent):r.createTextNode(o.substringData(a,o.length-a)),u.length>0?o.data=u.data:m(o));else if(1===l.nodeType?d=r.createTextNode(l.textContent):t===o?(d=r.createTextNode(l.substringData(0,s)+o.substringData(a,o.length-a)),i=s):d=r.createTextNode(l.substringData(0,s)),d.length>0?l.data=d.data:m(l),t===o)break}if(n=o&&o.parentNode?o:l&&l.parentNode?l:t.endContainer||t.startContainer,!r.isWysiwygDiv(n)){const t=r.removeItemAllParents(n,function(e){if(this.isComponent(e))return!1;const t=e.textContent;return 0===t.length||/^(\n|\u200B)+$/.test(t)}.bind(r),null);t&&(n=t.sc||t.ec||e.element.wysiwyg)}return this.setRange(n,i,n,i),this.history.push(!0),{container:n,offset:i,prevContainer:l&&l.parentNode?l:null}},applyRangeFormatElement:function(e){this.getRange_addLine(this.getRange());const t=this.getSelectedElementsAndComponents(!1);if(!t||0===t.length)return;e:for(let e,n,i,l,o,s,a=0,c=t.length;a-1&&(l=n.lastElementChild,t.indexOf(l)>-1)){let e=null;for(;e=l.lastElementChild;)if(r.isList(e)){if(!(t.indexOf(e.lastElementChild)>-1))continue e;l=e.lastElementChild}i=n.firstElementChild,o=t.indexOf(i),s=t.indexOf(l),t.splice(o,s-o+1),c=t.length}else;let n,i,l,o=t[t.length-1];n=r.isRangeFormatElement(o)||r.isFormatElement(o)?o:r.getRangeFormatElement(o,null)||r.getFormatElement(o,null),r.isCell(n)?(i=null,l=n):(i=n.nextSibling,l=n.parentNode);let s=r.getElementDepth(n),a=null;const c=[],d=function(e,t,n){let i=null;if(e!==t&&!r.isTable(t)){if(t&&r.getElementDepth(e)===r.getElementDepth(t))return n;i=r.removeItemAllParents(t,null,e)}return i?i.ec:n};for(let n,o,u,h,g,p,m,f=0,_=t.length;f<_;f++)if(n=t[f],o=n.parentNode,o&&!e.contains(o))if(u=r.getElementDepth(n),r.isList(o)){if(null===a&&(p?(a=p,m=!0,p=null):a=o.cloneNode(!1)),c.push(n),g=t[f+1],f===_-1||g&&g.parentNode!==o){g&&n.contains(g.parentNode)&&(p=g.parentNode.cloneNode(!1));let t,f=o.parentNode;for(;r.isList(f);)t=r.createElement(f.nodeName),t.appendChild(a),a=t,f=f.parentNode;const _=this.detachRangeFormatElement(o,c,null,!0,!0);s>=u?(s=u,l=_.cc,i=d(l,o,_.ec),i&&(l=i.parentNode)):l===_.cc&&(i=_.ec),l!==_.cc&&(h=d(l,_.cc,h),i=void 0!==h?h:_.cc);for(let e=0,t=_.removeArray.length;e=u&&(s=u,l=o,i=n.nextSibling),e.appendChild(n),l!==o&&(h=d(l,o),void 0!==h&&(i=h));if(this.effectNode=null,r.mergeSameTags(e,null,!1),r.mergeNestedTags(e,function(e){return this.isList(e)}.bind(r)),i&&r.getElementDepth(i)>0&&(r.isList(i.parentNode)||r.isList(i.parentNode.parentNode))){const t=r.getParentElement(i,function(e){return this.isRangeFormatElement(e)&&!this.isList(e)}.bind(r)),n=r.splitElement(i,null,t?r.getElementDepth(t)+1:0);n.parentNode.insertBefore(e,n)}else l.insertBefore(e,i),d(e,i);const u=r.getEdgeChildNodes(e.firstElementChild,e.lastElementChild);t.length>1?this.setRange(u.sc,0,u.ec,u.ec.textContent.length):this.setRange(u.ec,u.ec.textContent.length,u.ec,u.ec.textContent.length),this.history.push(!1)},detachRangeFormatElement:function(e,t,n,i,l){const o=this.getRange(),s=o.startOffset,a=o.endOffset;let c=r.getListChildNodes(e,(function(t){return t.parentNode===e})),d=e.parentNode,u=null,h=null,g=e.cloneNode(!1);const p=[],m=r.isList(n);let f=!1,_=!1,b=!1;function v(t,n,i,l){if(r.onlyZeroWidthSpace(n)&&(n.innerHTML=r.zeroWidthSpace),3===n.nodeType)return t.insertBefore(n,i),n;const o=(b?n:l).childNodes;let s=n.cloneNode(!1),a=null,c=null;for(;o[0];)c=o[0],!r._notTextNode(c)||r.isBreak(c)||r.isListCell(s)?s.appendChild(c):(s.childNodes.length>0&&(a||(a=s),t.insertBefore(s,i),s=n.cloneNode(!1)),t.insertBefore(c,i),a||(a=c));if(s.childNodes.length>0){if(r.isListCell(t)&&r.isListCell(s)&&r.isList(i))if(m){for(a=i;i;)s.appendChild(i),i=i.nextSibling;t.parentNode.insertBefore(s,t.nextElementSibling)}else{const t=l.nextElementSibling,n=r.detachNestedList(l,!1);if(e!==n||t!==l.nextElementSibling){const t=s.childNodes;for(;t[0];)l.appendChild(t[0]);e=n,_=!0}}else t.insertBefore(s,i);a||(a=s)}return a}for(let l,o,s,a=0,y=c.length;a0&&(d.insertBefore(g,e),g=null),!m&&r.isListCell(l))if(s&&r.getElementDepth(l)!==r.getElementDepth(s)&&(r.isListCell(d)||r.getArrayItem(l.children,r.isList,!1))){const t=l.nextElementSibling,n=r.detachNestedList(l,!1);e===n&&t===l.nextElementSibling||(e=n,_=!0)}else{const t=l;l=r.createElement(i?t.nodeName:r.isList(e.parentNode)||r.isListCell(e.parentNode)?"LI":r.isCell(e.parentNode)?"DIV":"P");const n=r.isListCell(l),o=t.childNodes;for(;o[0]&&(!r.isList(o[0])||n);)l.appendChild(o[0]);r.copyFormatAttributes(l,t),b=!0}else l=l.cloneNode(!1);if(!_&&(i?(p.push(l),r.removeItem(c[a])):(n?(f||(d.insertBefore(n,e),f=!0),l=v(n,l,null,c[a])):l=v(d,l,e,c[a]),_||(t?(h=l,u||(u=l)):u||(u=h=l))),_)){_=b=!1,c=r.getListChildNodes(e,(function(t){return t.parentNode===e})),g=e.cloneNode(!1),d=e.parentNode,a=-1,y=c.length;continue}}const y=e.parentNode;let C=e.nextSibling;g&&g.children.length>0&&y.insertBefore(g,C),n?u=n.previousSibling:u||(u=e.previousSibling),C=e.nextSibling,0===e.children.length||0===e.textContent.length?r.removeItem(e):r.removeEmptyNode(e,null);let w=null;if(i)w={cc:y,sc:u,ec:C,removeArray:p};else{u||(u=h),h||(h=u);const e=r.getEdgeChildNodes(u,h.parentNode?u:h);w={cc:(e.sc||e.ec).parentNode,sc:e.sc,ec:e.ec}}if(this.effectNode=null,l)return w;!i&&w&&(t?this.setRange(w.sc,s,w.ec,a):this.setRange(w.sc,0,w.sc,0)),this.history.push(!1)},detachList:function(e,t){let n={},i=!1,l=!1,o=null,s=null;const a=function(e){return!this.isComponent(e)}.bind(r);for(let c,d,u,h,g=0,p=e.length;g0)&&t,n=!!(n&&n.length>0)&&n;const o=!e,s=o&&!n&&!t;let c=l.startContainer,d=l.startOffset,u=l.endContainer,h=l.endOffset;if(s&&l.collapsed&&r.isFormatElement(c.parentNode)&&r.isFormatElement(u.parentNode)||c===u&&1===c.nodeType&&r.isNonEditable(c))return;if(l.collapsed&&!s&&1===c.nodeType&&!r.isBreak(c)&&!r.isComponent(c)){let e=null;const t=c.childNodes[d];t&&(e=t.nextSibling?r.isBreak(t)?t:t.nextSibling:null);const n=r.createTextNode(r.zeroWidthSpace);c.insertBefore(n,e),this.setRange(n,1,n,1),l=this.getRange(),c=l.startContainer,d=l.startOffset,u=l.endContainer,h=l.endOffset}r.isFormatElement(c)&&(c=c.childNodes[d]||c.firstChild,d=0),r.isFormatElement(u)&&(u=u.childNodes[h]||u.lastChild,h=u.textContent.length),o&&(e=r.createElement("DIV"));const g=a.RegExp,p=e.nodeName;if(!s&&c===u&&!n&&e){let t=c,n=0;const i=[],l=e.style;for(let e=0,t=l.length;e0){for(;!r.isFormatElement(t)&&!r.isWysiwygDiv(t);){for(let l=0;l=i.length)return}}let m,f={},_={},b="",v="",y="";if(t){for(let e,n=0,i=t.length;n0&&(a=l.replace(b,"").trim(),a!==l&&(w.v=!0));const c=t.className;let d="";return v&&c.length>0&&(d=c.replace(v,"").trim(),d!==c&&(w.v=!0)),(!o||!v&&c||!b&&l||a||d||!n)&&(a||d||t.nodeName!==p||C(b)!==C(l)||C(v)!==C(c))?(b&&l.length>0&&(t.style.cssText=a),t.style.cssText||t.removeAttribute("style"),v&&c.length>0&&(t.className=d.trim()),t.className.trim()||t.removeAttribute("class"),t.style.cssText||t.className||t.nodeName!==p&&!n?t:(w.v=!0,null)):(w.v=!0,null)},E=this.getSelectedElements(null);l=this.getRange(),c=l.startContainer,d=l.startOffset,u=l.endContainer,h=l.endOffset,r.getFormatElement(c,null)||(c=r.getChildElement(E[0],(function(e){return 3===e.nodeType}),!1),d=0),r.getFormatElement(u,null)||(u=r.getChildElement(E[E.length-1],(function(e){return 3===e.nodeType}),!1),h=u.textContent.length);const S=r.getFormatElement(c,null)===r.getFormatElement(u,null),N=E.length-(S?0:1);m=e.cloneNode(!1);const T=s||o&&function(e){for(let t=0,n=e.length;t0&&(m=e.cloneNode(!1),_=this._nodeChange_endLine(E[N],m,x,u,h,s,o,w,k,A));for(let t,n=N-1;n>0;n--)m=e.cloneNode(!1),t=this._nodeChange_middleLine(E[n],m,x,s,o,w,_.container),t.endContainer&&(_.ancestor=null,_.container=t.endContainer),this._setCommonListStyle(t.ancestor,null);m=e.cloneNode(!1),f=this._nodeChange_startLine(E[0],m,x,c,d,s,o,w,k,A,_.container),f.endContainer&&(_.ancestor=null,_.container=f.endContainer),N<=0?_=f:_.container||(_.ancestor=null,_.container=f.container,_.offset=f.container.textContent.length),this._setCommonListStyle(f.ancestor,null),this._setCommonListStyle(_.ancestor||r.getFormatElement(_.container),null)}this.controllersOff(),this.setRange(f.container,f.offset,_.container,_.offset),this.history.push(!1)},_setCommonListStyle:function(e,t){if(!r.isListCell(e))return;t||e.removeAttribute("style");const n=r.getArrayItem((t||e).childNodes,(function(e){return!r.isBreak(e)&&!r.onlyZeroWidthSpace(e.textContent.trim())}),!0);if(n[0]&&1===n.length){if(!(t=n[0])||1!==t.nodeType)return;const i=t.style,l=e.style;/STRONG/i.test(t.nodeName)?l.fontWeight="bold":i.fontWeight&&(l.fontWeight=i.fontWeight),i.color&&(l.color=i.color),i.fontSize&&(l.fontSize=i.fontSize),this._setCommonListStyle(e,t)}},_stripRemoveNode:function(e){const t=e.parentNode;if(!e||3===e.nodeType||!t)return;const n=e.childNodes;for(;n[0];)t.insertBefore(n[0],e);t.removeChild(e)},_util_getMaintainedNode:function(e,t,n){return!n||e?null:this.getParentElement(n,this._isMaintainedNode.bind(this))||(t?null:this.getParentElement(n,this._isSizeNode.bind(this)))},_util_isMaintainedNode:function(e,t,n){if(!n||e||1!==n.nodeType)return!1;const i=this._isMaintainedNode(n);return this.getParentElement(n,this._isMaintainedNode.bind(this))?i:i||!t&&this._isSizeNode(n)},_nodeChange_oneLine:function(e,t,n,i,l,o,s,c,d,u,h,g,p){let m=i.parentNode;for(;!(m.nextSibling||m.previousSibling||r.isFormatElement(m.parentNode)||r.isWysiwygDiv(m.parentNode))&&m.nodeName!==t.nodeName;)m=m.parentNode;if(!d&&m===o.parentNode&&m.nodeName===t.nodeName&&r.onlyZeroWidthSpace(i.textContent.slice(0,l))&&r.onlyZeroWidthSpace(o.textContent.slice(s))){const e=m.childNodes;let n=!0;for(let t,l,s,a,c=0,d=e.length;c0&&(n=t.test(e.style.cssText)),!n}if(function e(i,l){const o=i.childNodes;for(let i,s=0,a=o.length;s=N?L-N:S.data.length-N));if(E){const t=g(l);if(t&&t.parentNode!==e){let n=t,i=null;for(;n.parentNode!==e;){for(l=i=n.parentNode.cloneNode(!1);n.childNodes[0];)i.appendChild(n.childNodes[0]);n.appendChild(i),n=n.parentNode}n.parentNode.appendChild(t)}E=E.cloneNode(!1)}r.onlyZeroWidthSpace(o)||l.appendChild(o);const c=g(l);for(c&&(E=c),E&&(e=E),C=a,y=[],x="";C!==e&&C!==f&&null!==C;)i=p(C)?null:n(C),i&&1===C.nodeType&&z(C)&&(y.push(i),x+=C.style.cssText.substr(0,C.style.cssText.indexOf(":"))+"|"),C=C.parentNode;const d=y.pop()||s;for(w=C=d;y.length>0;)C=y.pop(),w.appendChild(C),w=C;if(t.appendChild(d),e.appendChild(t),E&&!g(T)&&(t=t.cloneNode(!1),b.appendChild(t),_.push(t)),S=s,N=0,k=!0,C!==s&&C.appendChild(S),!v)continue}if(A||a!==T){if(k){if(1===a.nodeType&&!r.isBreak(a)){r._isIgnoreNodeChange(a)?(b.appendChild(a.cloneNode(!0)),u||(t=t.cloneNode(!1),b.appendChild(t),_.push(t))):e(a,a);continue}C=a,y=[],x="";const o=[];for(;null!==C.parentNode&&C!==f&&C!==t;)i=A?C.cloneNode(!1):n(C),1===C.nodeType&&!r.isBreak(a)&&i&&z(C)&&(p(C)?E||o.push(i):y.push(i),x+=C.style.cssText.substr(0,C.style.cssText.indexOf(":"))+"|"),C=C.parentNode;y=y.concat(o);const s=y.pop()||a;for(w=C=s;y.length>0;)C=y.pop(),w.appendChild(C),w=C;if(p(t.parentNode)&&!p(s)&&(t=t.cloneNode(!1),b.appendChild(t),_.push(t)),A||E||!p(s))s===a?l=A?b:t:A?(b.appendChild(s),l=C):(t.appendChild(s),l=C);else{t=t.cloneNode(!1);const e=s.childNodes;for(let n=0,i=e.length;n0?C:t}if(E&&3===a.nodeType)if(g(a)){const e=r.getParentElement(l,function(e){return this._isMaintainedNode(e.parentNode)||e.parentNode===b}.bind(r));E.appendChild(e),t=e.cloneNode(!1),_.push(t),b.appendChild(t)}else E=null}d=a.cloneNode(!1),l.appendChild(d),1!==a.nodeType||r.isBreak(a)||(h=d),e(a,h)}else{E=g(a);const e=r.createTextNode(1===T.nodeType?"":T.substringData(L,T.length-L)),l=r.createTextNode(v||1===T.nodeType?"":T.substringData(0,L));if(E?E=E.cloneNode(!1):p(t.parentNode)&&!E&&(t=t.cloneNode(!1),b.appendChild(t),_.push(t)),!r.onlyZeroWidthSpace(e)){C=a,x="",y=[];const t=[];for(;C!==b&&C!==f&&null!==C;)1===C.nodeType&&z(C)&&(p(C)?t.push(C.cloneNode(!1)):y.push(C.cloneNode(!1)),x+=C.style.cssText.substr(0,C.style.cssText.indexOf(":"))+"|"),C=C.parentNode;for(y=y.concat(t),d=w=C=y.pop()||e;y.length>0;)C=y.pop(),w.appendChild(C),w=C;b.appendChild(d),C.textContent=e.data}if(E&&d){const e=g(d);e&&(E=e)}for(C=a,y=[],x="";C!==b&&C!==f&&null!==C;)i=p(C)?null:n(C),i&&1===C.nodeType&&z(C)&&(y.push(i),x+=C.style.cssText.substr(0,C.style.cssText.indexOf(":"))+"|"),C=C.parentNode;const o=y.pop()||l;for(w=C=o;y.length>0;)C=y.pop(),w.appendChild(C),w=C;E?((t=t.cloneNode(!1)).appendChild(o),E.insertBefore(t,E.firstChild),b.appendChild(E),_.push(t),E=null):t.appendChild(o),T=l,L=l.data.length,A=!0,!c&&u&&(t=l,l.textContent=r.zeroWidthSpace),C!==l&&C.appendChild(T)}}}(e,b),d&&!c&&!h.v)return{ancestor:e,startContainer:i,startOffset:l,endContainer:o,endOffset:s};if(c=c&&d)for(let e=0;e<_.length;e++){let t,n,i,l=_[e];if(u)t=r.createTextNode(r.zeroWidthSpace),b.replaceChild(t,l);else{const e=l.childNodes;for(n=e[0];e[0];)i=e[0],b.insertBefore(i,l);r.removeItem(l)}0===e&&(u?S=T=t:(S=n,T=i))}else{if(d)for(let e=0;e<_.length;e++)this._stripRemoveNode(_[e]);u&&(S=T=t)}r.removeEmptyNode(b,t),u&&(N=S.textContent.length,L=T.textContent.length);const M=c||0===T.textContent.length;r.isBreak(T)||0!==T.textContent.length||(r.removeItem(T),T=S),L=M?T.textContent.length:L;const H={s:0,e:0},I=r.getNodePath(S,b,H),D=!T.parentNode;D&&(T=S);const O={s:0,e:0},F=r.getNodePath(T,b,D||M?null:O);N+=H.s,L=u?N:D?S.textContent.length:M?L+H.s:L+O.s;const R=r.mergeSameTags(b,[I,F],!0);return e.parentNode.replaceChild(b,e),S=r.getNodeFromPath(I,b),T=r.getNodeFromPath(F,b),{ancestor:b,startContainer:S,startOffset:N+R[0],endContainer:T,endOffset:L+R[1]}},_nodeChange_startLine:function(e,t,n,i,l,o,s,a,c,d,u){let h=i.parentNode;for(;!(h.nextSibling||h.previousSibling||r.isFormatElement(h.parentNode)||r.isWysiwygDiv(h.parentNode))&&h.nodeName!==t.nodeName;)h=h.parentNode;if(!s&&h.nodeName===t.nodeName&&!r.isFormatElement(h)&&!h.nextSibling&&r.onlyZeroWidthSpace(i.textContent.slice(0,l))){let n=!0,o=i.previousSibling;for(;o;){if(!r.onlyZeroWidthSpace(o)){n=!1;break}o=o.previousSibling}if(n)return r.copyTagAttributes(h,t),{ancestor:e,container:i,offset:l}}a.v=!1;const g=e,p=[t],m=e.cloneNode(!1);let f,_,b,v,y=i,C=l,w=!1;if(function e(i,l){const o=i.childNodes;for(let i,s,a=0,h=o.length;a0,y=f.pop()||h;for(b=_=y;f.length>0;)_=f.pop(),b.appendChild(_),b=_;if(d(t.parentNode)&&!d(y)&&(t=t.cloneNode(!1),m.appendChild(t),p.push(t)),!v&&d(y)){t=t.cloneNode(!1);const e=y.childNodes;for(let n=0,i=e.length;n0;)_=f.pop(),b.appendChild(_),b=_;d!==l?(t.appendChild(d),l=_):l=t,r.isBreak(h)&&t.appendChild(h.cloneNode(!1)),e.appendChild(t),y=s,C=0,w=!0,l.appendChild(y)}}}(e,m),s&&!o&&!a.v)return{ancestor:e,container:i,offset:l,endContainer:u};if(o=o&&s)for(let e=0;e0&&u===h)return e.innerHTML=i.innerHTML,{ancestor:e,endContainer:n?r.getNodeFromPath(n,e):null}}o.v=!1;const a=e.cloneNode(!1),c=[t];let d=!0;if(function e(i,l){const o=i.childNodes;for(let i,u,h=0,g=o.length;h0&&(a.appendChild(t),t=t.cloneNode(!1)),u=g.cloneNode(!0),a.appendChild(u),a.appendChild(t),c.push(t),l=t,s&&g.contains(s)){const e=r.getNodePath(s,g);s=r.getNodeFromPath(e,u)}}}(e,t),d||l&&!i&&!o.v)return{ancestor:e,endContainer:s};if(a.appendChild(t),i&&l)for(let e=0;e0,u=m.pop()||a;for(_=f=u;m.length>0;)f=m.pop(),_.appendChild(f),_=f;if(d(t.parentNode)&&!d(u)&&(t=t.cloneNode(!1),p.insertBefore(t,p.firstChild),g.push(t)),!b&&d(u)){t=t.cloneNode(!1);const e=u.childNodes;for(let n=0,i=e.length;n0?f:t}else s?(t.insertBefore(u,t.firstChild),l=f):l=t;if(b&&3===a.nodeType)if(c(a)){const e=r.getParentElement(l,function(e){return this._isMaintainedNode(e.parentNode)||e.parentNode===p}.bind(r));b.appendChild(e),t=e.cloneNode(!1),g.push(t),p.insertBefore(t,p.firstChild)}else b=null}if(C||a!==v)i=C?n(a):a.cloneNode(!1),i&&(l.insertBefore(i,l.firstChild),1!==a.nodeType||r.isBreak(a)||(u=i)),e(a,u);else{b=c(a);const e=r.createTextNode(1===v.nodeType?"":v.substringData(y,v.length-y)),o=r.createTextNode(1===v.nodeType?"":v.substringData(0,y));if(b){b=b.cloneNode(!1);const e=c(l);if(e&&e.parentNode!==p){let t=e,n=null;for(;t.parentNode!==p;){for(l=n=t.parentNode.cloneNode(!1);t.childNodes[0];)n.appendChild(t.childNodes[0]);t.appendChild(n),t=t.parentNode}t.parentNode.insertBefore(e,t.parentNode.firstChild)}b=b.cloneNode(!1)}else d(t.parentNode)&&!b&&(t=t.cloneNode(!1),p.appendChild(t),g.push(t));for(r.onlyZeroWidthSpace(e)||l.insertBefore(e,l.firstChild),f=l,m=[];f!==p&&null!==f;)i=d(f)?null:n(f),i&&1===f.nodeType&&m.push(i),f=f.parentNode;const s=m.pop()||l;for(_=f=s;m.length>0;)f=m.pop(),_.appendChild(f),_=f;s!==l?(t.insertBefore(s,t.firstChild),l=f):l=t,r.isBreak(a)&&t.appendChild(a.cloneNode(!1)),b?(b.insertBefore(t,b.firstChild),p.insertBefore(b,p.firstChild),b=null):p.insertBefore(t,p.firstChild),v=o,y=o.data.length,C=!0,l.insertBefore(v,l.firstChild)}}}(e,p),s&&!o&&!a.v)return{ancestor:e,container:i,offset:l};if(o=o&&s)for(let e=0;e-1?null:r.createElement(n);let d=n;/^SUB$/i.test(n)&&a.indexOf("SUP")>-1?d="SUP":/^SUP$/i.test(n)&&a.indexOf("SUB")>-1&&(d="SUB"),this.nodeChange(c,null,[d],!1),this.focus()}},removeFormat:function(){this.nodeChange(null,null,null,null)},indent:function(e){const t=this.getRange(),n=this.getSelectedElements(null),i=[],l="indent"!==e;let o=t.startContainer,s=t.endContainer,a=t.startOffset,c=t.endOffset;for(let e,t,o=0,s=n.length;o0&&this.plugins.list.editInsideList.call(this,l,i),this.effectNode=null,this.setRange(o,a,s,c),this.history.push(!1)},toggleDisplayBlocks:function(){const t=e.element.wysiwyg;r.toggleClass(t,"se-show-block"),r.hasClass(t,"se-show-block")?r.addClass(this._styleCommandMap.showBlocks,"active"):r.removeClass(this._styleCommandMap.showBlocks,"active"),this._resourcesStateChange()},toggleCodeView:function(){const t=this._variable.isCodeView;this.controllersOff(),r.setDisabledButtons(!t,this.codeViewDisabledButtons),t?(this._setCodeDataToEditor(),e.element.wysiwygFrame.scrollTop=0,e.element.code.style.display="none",e.element.wysiwygFrame.style.display="block",this._variable._codeOriginCssText=this._variable._codeOriginCssText.replace(/(\s?display(\s+)?:(\s+)?)[a-zA-Z]+(?=;)/,"display: none"),this._variable._wysiwygOriginCssText=this._variable._wysiwygOriginCssText.replace(/(\s?display(\s+)?:(\s+)?)[a-zA-Z]+(?=;)/,"display: block"),"auto"!==l.height||l.codeMirrorEditor||(e.element.code.style.height="0px"),this._variable.isCodeView=!1,this._variable.isFullScreen||(this._notHideToolbar=!1,/balloon|balloon-always/i.test(l.mode)&&(e.element._arrow.style.display="",this._isInline=!1,this._isBalloon=!0,u._hideToolbar())),this.nativeFocus(),r.removeClass(this._styleCommandMap.codeView,"active"),this.history.push(!1)):(this._setEditorDataToCodeView(),this._variable._codeOriginCssText=this._variable._codeOriginCssText.replace(/(\s?display(\s+)?:(\s+)?)[a-zA-Z]+(?=;)/,"display: block"),this._variable._wysiwygOriginCssText=this._variable._wysiwygOriginCssText.replace(/(\s?display(\s+)?:(\s+)?)[a-zA-Z]+(?=;)/,"display: none"),"auto"!==l.height||l.codeMirrorEditor||(e.element.code.style.height=e.element.code.scrollHeight>0?e.element.code.scrollHeight+"px":"auto"),l.codeMirrorEditor&&l.codeMirrorEditor.refresh(),this._variable.isCodeView=!0,this._variable.isFullScreen||(this._notHideToolbar=!0,this._isBalloon&&(e.element._arrow.style.display="none",e.element.toolbar.style.left="",this._isInline=!0,this._isBalloon=!1,u._showToolbarInline())),this._variable._range=null,e.element.code.focus(),r.addClass(this._styleCommandMap.codeView,"active")),this._checkPlaceholder(),"function"==typeof h.toggleCodeView&&h.toggleCodeView(this._variable.isCodeView,this)},_setCodeDataToEditor:function(){const t=this._getCodeView();if(l.fullPage){const e=this._parser.parseFromString(t,"text/html"),n=e.head.children;for(let t=0,i=n.length;t0?this.convertContentsForEditor(t):"


    "},_setEditorDataToCodeView:function(){const t=this.convertHTMLForCodeView(e.element.wysiwyg);let n="";if(l.fullPage){const e=r.getAttributesToString(this._wd.body,null);n="\n\n"+this._wd.head.outerHTML.replace(/>(?!\n)/g,">\n")+"\n"+t+"\n"}else n=t;e.element.code.style.display="block",e.element.wysiwygFrame.style.display="none",this._setCodeView(n)},toggleFullScreen:function(t){const n=e.element.topArea,i=e.element.toolbar,o=e.element.editorArea,d=e.element.wysiwygFrame,g=e.element.code,p=this._variable;this.controllersOff(),p.isFullScreen?(p.isFullScreen=!1,d.style.cssText=p._wysiwygOriginCssText,g.style.cssText=p._codeOriginCssText,i.style.cssText="",o.style.cssText=p._editorAreaOriginCssText,n.style.cssText=p._originCssText,s.body.style.overflow=p._bodyOverflow,l.toolbarContainer&&l.toolbarContainer.appendChild(i),l.stickyToolbar>-1&&r.removeClass(i,"se-toolbar-sticky"),p._fullScreenAttrs.sticky&&!l.toolbarContainer&&(p._fullScreenAttrs.sticky=!1,e.element._stickyDummy.style.display="block",r.addClass(i,"se-toolbar-sticky")),this._isInline=p._fullScreenAttrs.inline,this._isBalloon=p._fullScreenAttrs.balloon,this._isInline&&u._showToolbarInline(),l.toolbarContainer&&r.removeClass(i,"se-toolbar-balloon"),u.onScroll_window(),r.changeElement(t.firstElementChild,c.expansion),r.removeClass(this._styleCommandMap.fullScreen,"active")):(p.isFullScreen=!0,p._fullScreenAttrs.inline=this._isInline,p._fullScreenAttrs.balloon=this._isBalloon,(this._isInline||this._isBalloon)&&(this._isInline=!1,this._isBalloon=!1),l.toolbarContainer&&e.element.relative.insertBefore(i,o),n.style.position="fixed",n.style.top="0",n.style.left="0",n.style.width="100%",n.style.maxWidth="100%",n.style.height="100%",n.style.zIndex="2147483647",""!==e.element._stickyDummy.style.display&&(p._fullScreenAttrs.sticky=!0,e.element._stickyDummy.style.display="none",r.removeClass(i,"se-toolbar-sticky")),p._bodyOverflow=s.body.style.overflow,s.body.style.overflow="hidden",p._editorAreaOriginCssText=o.style.cssText,p._wysiwygOriginCssText=d.style.cssText,p._codeOriginCssText=g.style.cssText,o.style.cssText=i.style.cssText="",d.style.cssText=(d.style.cssText.match(/\s?display(\s+)?:(\s+)?[a-zA-Z]+;/)||[""])[0],g.style.cssText=(g.style.cssText.match(/\s?display(\s+)?:(\s+)?[a-zA-Z]+;/)||[""])[0],i.style.width=d.style.height=g.style.height="100%",i.style.position="relative",i.style.display="block",p.innerHeight_fullScreen=a.innerHeight-i.offsetHeight,o.style.height=p.innerHeight_fullScreen+"px",r.changeElement(t.firstElementChild,c.reduction),l.iframe&&"auto"===l.height&&(o.style.overflow="auto",this._iframeAutoHeight()),r.addClass(this._styleCommandMap.fullScreen,"active")),"function"==typeof h.toggleFullScreen&&h.toggleFullScreen(this._variable.isFullScreen,this)},print:function(){const e=r.createElement("IFRAME");e.style.display="none",s.body.appendChild(e);const t=r.getIframeDocument(e),n=this.getContents(!0),i=this._wd;if(l.iframe){const e=l.fullPage?r.getAttributesToString(i.body,["contenteditable"]):'class="sun-editor-editable"';t.write(""+i.head.innerHTML+""+n+"")}else{const e=s.head.getElementsByTagName("link"),i=s.head.getElementsByTagName("style");let l="";for(let t=0,n=e.length;t"+l+''+n+"")}this.showLoading(),a.setTimeout((function(){try{if(e.focus(),r.isIE_Edge||s.documentMode||a.StyleMedia)try{e.contentWindow.document.execCommand("print",!1,null)}catch(t){e.contentWindow.print()}else e.contentWindow.print()}catch(e){throw Error("[SUNEDITOR.core.print.fail] error: "+e)}finally{d.closeLoading(),r.removeItem(e)}}),1e3)},preview:function(){d.submenuOff(),d.containerOff(),d.controllersOff();const t=this.getContents(!0),n=a.open("","_blank");n.mimeType="text/html";const o=e.element.wysiwygFrame.offsetWidth+"px !important",c=this._wd;if(l.iframe){const e=l.fullPage?r.getAttributesToString(c.body,["contenteditable"]):'class="sun-editor-editable"';n.document.write(""+c.head.innerHTML+""+t+"")}else{const e=s.head.getElementsByTagName("link"),l=s.head.getElementsByTagName("style");let a="";for(let t=0,n=e.length;t'+i.toolbar.preview+""+a+''+t+"")}},setContents:function(t){const n=this.convertContentsForEditor(t);if(this._resetComponents(),this._variable.isCodeView){const e=this.convertHTMLForCodeView(n);this._setCodeView(e)}else e.element.wysiwyg.innerHTML=n,this.history.push(!1)},getContents:function(t){const n=e.element.wysiwyg.innerHTML,i=r.createElement("DIV");i.innerHTML=n;const o=r.getListChildren(i,(function(e){return/FIGCAPTION/i.test(e.nodeName)}));for(let e=0,t=o.length;e"+this._wd.head.outerHTML+""+i.innerHTML+""}return i.innerHTML},_makeLine:function(e,t){if(1===e.nodeType)return r._disallowedTags(e)?"":!t||r.isFormatElement(e)||r.isRangeFormatElement(e)||r.isComponent(e)||r.isMedia(e)||r.isAnchor(e)&&r.isMedia(e.firstElementChild)?e.outerHTML:"

    "+e.outerHTML+"

    ";if(3===e.nodeType){if(!t)return e.textContent;const n=e.textContent.split(/\n/g);let i="";for(let e,t=0,l=n.length;t0&&(i+="

    "+e+"

    ");return i}return 8===e.nodeType&&this._allowHTMLComments?"\x3c!--"+e.textContent.trim()+"--\x3e":""},_tagConvertor:function(e){if(!this._disallowedTextTagsRegExp)return e;const t={b:"strong",i:"em",ins:"u",strike:"del",s:"del"};return e.replace(this._disallowedTextTagsRegExp,(function(e,n,i){return n+("string"==typeof t[i]?t[i]:i)}))},_deleteDisallowedTags:function(e){return e.replace(/\n/g,"").replace(/<(script|style).*>(\n|.)*<\/(script|style)>/gi,"").replace(/<[a-z0-9]+\:[a-z0-9]+[^>^\/]*>[^>]*<\/[a-z0-9]+\:[a-z0-9]+>/gi,"").replace(this.editorTagsWhitelistRegExp,"")},cleanHTML:function(e,t){e=this._deleteDisallowedTags(e).replace(/(<[a-zA-Z0-9]+)[^>]*(?=>)/g,function(e,t){if(/^<[a-z0-9]+\:[a-z0-9]+/i.test(e))return e;let n=null;const i=this._attributesTagsWhitelist[t.match(/(?!<)[a-zA-Z0-9]+/)[0].toLowerCase()];if(n=i?e.match(i):e.match(this._attributesWhitelistRegExp),/

    ":(i=r.htmlRemoveWhiteSpace(i),this._tagConvertor(i))},convertHTMLForCodeView:function(e){let t="";const n=a.RegExp,i=new n("^(BLOCKQUOTE|PRE|TABLE|THEAD|TBODY|TR|TH|TD|OL|UL|IMG|IFRAME|VIDEO|AUDIO|FIGURE|FIGCAPTION|HR|BR|CANVAS|SELECT)$","i"),l=r.isFormatElement.bind(r),o="string"==typeof e?s.createRange().createContextualFragment(e):e;let c=1*this._variable.codeIndent;return c=c>0?new a.Array(c+1).join(" "):"",function e(o,s,a){const d=o.childNodes,u=i.test(o.nodeName),h=u?s:"";for(let g,p,m,f=0,_=d.length;f<_;f++){if(g=d[f],m=i.test(g.nodeName),p=m?"\n":"",a=!l(g)||u||/^(TH|TD)$/i.test(o.nodeName)?"":"\n",8===g.nodeType){t+="\n\x3c!-- "+g.textContent.trim()+" --\x3e"+p;continue}if(3===g.nodeType){t+=r._HTMLConvertor(/^\n+$/.test(g.data)?"":g.data);continue}if(0===g.childNodes.length){t+=(/^HR$/i.test(g.nodeName)?"\n":"")+h+g.outerHTML+p;continue}g.innerHTML=g.innerHTML;const _=g.nodeName.toLowerCase();t+=(a||(u?"":p))+(h||m?s:"")+g.outerHTML.match(n("<"+_+"[^>]*>","i"))[0]+p,e(g,s+c,""),t+=(m?s:"")+""+(a||p||u||/^(TH|TD)$/i.test(g.nodeName)?"\n":"")}}(o,"","\n"),t.trim()+"\n"},addDocEvent:function(e,t,n){s.addEventListener(e,t,n),l.iframe&&this._wd.addEventListener(e,t)},removeDocEvent:function(e,t){s.removeEventListener(e,t),l.iframe&&this._wd.removeEventListener(e,t)},_charCount:function(e){const t=l.maxCharCount,n=l.charCounterType;let i=0;if(e&&(i=this.getCharLength(e,n)),this._setCharCount(),t>0){let e=!1;const l=h.getCharCount(n);if(l>t){if(e=!0,i>0){this._editorRange();const e=this.getRange(),n=e.endOffset-1,i=this.getSelectionNode().textContent,o=e.endOffset-(l-t);this.getSelectionNode().textContent=i.slice(0,o<0?0:o)+i.slice(e.endOffset,i.length),this.setRange(e.endContainer,n,e.endContainer,n)}}else l+i>t&&(e=!0);if(e&&(this._callCounterBlink(),i>0))return!1}return!0},checkCharCount:function(e,t){if(l.maxCharCount){const n=t||l.charCounterType,i=this.getCharLength("string"==typeof e?e:this._charTypeHTML?e.outerHTML:e.textContent,n);if(i>0&&i+h.getCharCount(n)>l.maxCharCount)return this._callCounterBlink(),!1}return!0},getCharLength:function(e,t){return/byte/.test(t)?r.getByteLength(e):e.length},_setCharCount:function(){e.element.charCounter&&a.setTimeout((function(){e.element.charCounter.textContent=h.getCharCount(l.charCounterType)}))},_callCounterBlink:function(){const t=e.element.charWrapper;t&&!r.hasClass(t,"se-blink")&&(r.addClass(t,"se-blink"),a.setTimeout((function(){r.removeClass(t,"se-blink")}),600))},_checkComponents:function(){for(let e=0,t=this._fileInfoPluginsCheck.length;e^<]+)?\\s*(?=>)","gi");const h="contenteditable|colspan|rowspan|target|href|src|class|type|controls|data-format|data-size|data-file-size|data-file-name|data-origin|data-align|data-image-link|data-rotate|data-proportion|data-percentage|origin-size|data-exp|data-font-size";this._allowHTMLComments=l._editorTagsWhitelist.indexOf("//")>-1,this._htmlCheckWhitelistRegExp=new c("^("+l._editorTagsWhitelist.replace("|//","")+")$","i"),this.editorTagsWhitelistRegExp=r.createTagsWhitelist(l._editorTagsWhitelist.replace("|//","|\x3c!--|--\x3e")),this.pasteTagsWhitelistRegExp=r.createTagsWhitelist(l.pasteTagsWhitelist);const g=l.attributesWhitelist,p={};let m="";if(g)for(let e in g)r.hasOwn(g,e)&&("all"===e?m=g[e]+"|":p[e]=new c("((?:"+g[e]+"|"+h+')s*=s*"[^"]*")',"ig"));this._attributesWhitelistRegExp=new c("((?:"+m+h+')s*=s*"[^"]*")',"ig"),this._attributesTagsWhitelist=p,this._isInline=/inline/i.test(l.mode),this._isBalloon=/balloon|balloon-always/i.test(l.mode),this._isBalloonAlways=/balloon-always/i.test(l.mode),this._cachingButtons(),this._fileInfoPluginsCheck=[],this._fileInfoPluginsReset=[],this.managedTagsInfo={query:"",map:{}};const f=[];this.activePlugins=[],this._fileManager.tags=[],this._fileManager.pluginMap={};let _,b,v=[];for(let e in n)if(r.hasOwn(n,e)){if(_=n[e],b=t[e],_.active&&b&&this.callPlugin(e,null,b),"function"==typeof _.checkFileInfo&&"function"==typeof _.resetFileInfo&&(this.callPlugin(e,null,b),this._fileInfoPluginsCheck.push(_.checkFileInfo.bind(this)),this._fileInfoPluginsReset.push(_.resetFileInfo.bind(this))),a.Array.isArray(_.fileTags)){const t=_.fileTags;this.callPlugin(e,null,b),this._fileManager.tags=this._fileManager.tags.concat(t),v.push(e);for(let n=0,i=t.length;nc&&(d=d.slice(0,c),a&&a.setAttribute("disabled",!0)),d[c]=l?{contents:n,s:{path:i.getNodePath(l.startContainer,null,null),offset:l.startOffset},e:{path:i.getNodePath(l.endContainer,null,null),offset:l.endOffset}}:{contents:n,s:{path:[0,0],offset:[0,0]},e:{path:0,offset:0}},1===c&&s&&s.removeAttribute("disabled"),e._setCharCount(),t()}return{stack:d,push:function(t){n.setTimeout(e._resourcesStateChange.bind(e));const i="number"==typeof t?t>0?t:0:t?l:0;i&&!r||(n.clearTimeout(r),i)?r=n.setTimeout((function(){n.clearTimeout(r),r=null,h()}),i):h()},undo:function(){c>0&&(c--,u())},redo:function(){d.length-1>c&&(c++,u())},go:function(e){c=e<0?d.length-1:e,u()},reset:function(n){s&&s.setAttribute("disabled",!0),a&&a.setAttribute("disabled",!0),e.context.tool.save&&e.context.tool.save.setAttribute("disabled",!0),d.splice(0),c=0,d[c]={contents:e.getContents(!0),s:{path:[0,0],offset:0},e:{path:[0,0],offset:0}},n||t()},_resetCachingButton:function(){o=e.context.element,s=e.context.tool.undo,a=e.context.tool.redo,0===c?(s&&s.setAttribute("disabled",!0),a&&c===d.length-1&&a.setAttribute("disabled",!0),e.context.tool.save&&e.context.tool.save.setAttribute("disabled",!0)):c===d.length-1&&a&&a.setAttribute("disabled",!0)},_destroy:function(){r&&n.clearTimeout(r),d=null}}}(this,this._onChange_historyStack.bind(this)),this.addModule([B]),l.iframe&&(this._wd=e.element.wysiwygFrame.contentDocument,e.element.wysiwyg=this._wd.body,l._editorStyles.editor&&(e.element.wysiwyg.style.cssText=l._editorStyles.editor),"auto"===l.height&&(this._iframeAuto=this._wd.body)),this._initWysiwygArea(i,o)},_cachingButtons:function(){this.codeViewDisabledButtons=e.element.toolbar.querySelectorAll('.se-toolbar button:not([class~="se-code-view-enabled"])'),this.resizingDisabledButtons=e.element.toolbar.querySelectorAll('.se-toolbar button:not([class~="se-resizing-enabled"])');const t=e.tool;this.commandMap={STRONG:t.bold,U:t.underline,EM:t.italic,DEL:t.strike,SUB:t.subscript,SUP:t.superscript,OUTDENT:t.outdent,INDENT:t.indent},this._styleCommandMap={fullScreen:t.fullScreen,showBlocks:t.showBlocks,codeView:t.codeView}},_initWysiwygArea:function(t,n){e.element.wysiwyg.innerHTML=t?n:this.convertContentsForEditor("string"==typeof n?n:e.element.originElement.value)},_resourcesStateChange:function(){this._iframeAutoHeight(),this._checkPlaceholder()},_onChange_historyStack:function(){u._applyTagEffects(),e.tool.save&&e.tool.save.removeAttribute("disabled"),h.onChange&&h.onChange(this.getContents(!0),this)},_iframeAutoHeight:function(){this._iframeAuto&&a.setTimeout((function(){e.element.wysiwygFrame.style.height=d._iframeAuto.offsetHeight+"px"}))},_checkPlaceholder:function(){if(this._placeholder){if(this._variable.isCodeView)return void(this._placeholder.style.display="none");const t=e.element.wysiwyg;!r.onlyZeroWidthSpace(t.textContent)||t.querySelector(".se-component, pre, blockquote, hr, li, table, img, iframe, video")||(t.innerText.match(/\n/g)||"").length>1?this._placeholder.style.display="none":this._placeholder.style.display="block"}},_setDefaultFormat:function(e){if(this._fileManager.pluginRegExp.test(this.currentControllerName))return;const t=this.getRange(),n=t.commonAncestorContainer,i=t.startContainer,l=r.getRangeFormatElement(n,null);let o,s,a;const c=r.getParentElement(n,r.isComponent);if((!c||r.isTable(c))&&(!r.isRangeFormatElement(i)&&!r.isWysiwygDiv(i)||!r.isComponent(i.childNodes[t.startOffset]))){if(l)return a=r.createElement(e||"P"),a.innerHTML=l.innerHTML,0===a.childNodes.length&&(a.innerHTML=r.zeroWidthSpace),l.innerHTML=a.outerHTML,a=l.firstChild,o=r.getEdgeChildNodes(a,null).sc,o||(o=r.createTextNode(r.zeroWidthSpace),a.insertBefore(o,a.firstChild)),s=o.textContent.length,void this.setRange(o,s,o,s);if(r.isRangeFormatElement(n)&&n.childNodes.length<=1){let e=null;return 1===n.childNodes.length&&r.isBreak(n.firstChild)?e=n.firstChild:(e=r.createTextNode(r.zeroWidthSpace),n.appendChild(e)),void this.setRange(e,1,e,1)}if(this.execCommand("formatBlock",!1,e||"P"),o=r.getEdgeChildNodes(n,n),o=o?o.ec:n,a=r.getFormatElement(o,null),!a)return this.removeRange(),void this._editorRange();if(r.isBreak(a.nextSibling)&&r.removeItem(a.nextSibling),r.isBreak(a.previousSibling)&&r.removeItem(a.previousSibling),r.isBreak(o)){const e=r.createTextNode(r.zeroWidthSpace);o.parentNode.insertBefore(e,o),o=e}this.effectNode=null,this.nativeFocus()}},_setOptionsInit:function(t,n){this.context=e=A(t.originElement,this._getConstructed(t),l),this._componentsInfoReset=!0,this._editorInit(!0,n)},_editorInit:function(t,n){this._init(t,n),u._addEvent(),this._setCharCount(),u._offStickyToolbar(),u.onResize_window(),e.element.toolbar.style.visibility="",this._checkComponents(),this._componentsInfoInit=!1,this._componentsInfoReset=!1,this.history.reset(!0),this._resourcesStateChange(),a.setTimeout((function(){"function"==typeof h.onload&&h.onload(d,t)}))},_getConstructed:function(e){return{_top:e.topArea,_relative:e.relative,_toolBar:e.toolbar,_menuTray:e._menuTray,_editorArea:e.editorArea,_wysiwygArea:e.wysiwygFrame,_codeArea:e.code,_placeholder:e.placeholder,_resizingBar:e.resizingBar,_navigation:e.navigation,_charCounter:e.charCounter,_charWrapper:e.charWrapper,_loading:e.loading,_lineBreaker:e.lineBreaker,_lineBreaker_t:e.lineBreaker_t,_lineBreaker_b:e.lineBreaker_b,_resizeBack:e.resizeBackground,_stickyDummy:e._stickyDummy,_arrow:e._arrow}}},u={_IEisComposing:!1,_lineBreakerBind:null,_responsiveCurrentSize:"default",_responsiveButtonSize:null,_responsiveButtons:null,_directionKeyCode:new a.RegExp("^(8|13|3[2-9]|40|46)$"),_nonTextKeyCode:new a.RegExp("^(8|13|1[6-9]|20|27|3[3-9]|40|45|46|11[2-9]|12[0-3]|144|145)$"),_historyIgnoreKeyCode:new a.RegExp("^(1[6-9]|20|27|3[3-9]|40|45|11[2-9]|12[0-3]|144|145)$"),_onButtonsCheck:new a.RegExp("^(STRONG|U|EM|DEL|SUB|SUP)$"),_frontZeroWidthReg:new a.RegExp(r.zeroWidthSpace+"+",""),_keyCodeShortcut:{65:"A",66:"B",83:"S",85:"U",73:"I",89:"Y",90:"Z",219:"[",221:"]"},_shortcutCommand:function(e,t){let n=null;switch(u._keyCodeShortcut[e]){case"A":n="selectAll";break;case"B":-1===l.shortcutsDisable.indexOf("bold")&&(n="STRONG");break;case"S":t&&-1===l.shortcutsDisable.indexOf("strike")&&(n="DEL");break;case"U":-1===l.shortcutsDisable.indexOf("underline")&&(n="U");break;case"I":-1===l.shortcutsDisable.indexOf("italic")&&(n="EM");break;case"Z":-1===l.shortcutsDisable.indexOf("undo")&&(n=t?"redo":"undo");break;case"Y":-1===l.shortcutsDisable.indexOf("undo")&&(n="redo");break;case"[":-1===l.shortcutsDisable.indexOf("indent")&&(n="outdent");break;case"]":-1===l.shortcutsDisable.indexOf("indent")&&(n="indent")}return!!n&&(d.commandHandler(d.commandMap[n],n),!0)},_applyTagEffects:function(){let t=d.getSelectionNode();if(t===d.effectNode)return;d.effectNode=t;const i=d.commandMap,o=this._onButtonsCheck,s=[],a=[],c=d.activePlugins,u=c.length;let h="";for(;t.firstChild;)t=t.firstChild;for(let e=t;!r.isWysiwygDiv(e)&&e;e=e.parentNode)if(1===e.nodeType&&!r.isBreak(e)){h=e.nodeName.toUpperCase(),a.push(h);for(let t,i=0;i0)&&(s.push("OUTDENT"),i.OUTDENT.removeAttribute("disabled")),-1===s.indexOf("INDENT")&&i.INDENT&&r.isListCell(e)&&!e.previousElementSibling&&(s.push("INDENT"),i.INDENT.setAttribute("disabled",!0))):o.test(h)&&(s.push(h),r.addClass(i[h],"active"))}for(let e in i)s.indexOf(e)>-1||!r.hasOwn(i,e)||(c.indexOf(e)>-1?n[e].active.call(d,null):i.OUTDENT&&/^OUTDENT$/i.test(e)?i.OUTDENT.setAttribute("disabled",!0):i.INDENT&&/^INDENT$/i.test(e)?i.INDENT.removeAttribute("disabled"):r.removeClass(i[e],"active"));d._variable.currentNodes=a.reverse(),d._variable.currentNodesMap=s,l.showPathLabel&&(e.element.navigation.textContent=d._variable.currentNodes.join(" > "))},_cancelCaptionEdit:function(){this.setAttribute("contenteditable",!1),this.removeEventListener("blur",u._cancelCaptionEdit)},_buttonsEventHandler:function(e){let t=e.target;if(d._bindControllersOff&&e.stopPropagation(),/^(input|textarea|select|option)$/i.test(t.nodeName)?d._antiBlur=!1:e.preventDefault(),r.getParentElement(t,".se-submenu"))e.stopPropagation(),d._notHideToolbar=!0;else{let n=t.getAttribute("data-command"),i=t.className;for(;!n&&!/se-menu-list/.test(i)&&!/sun-editor-common/.test(i);)t=t.parentNode,n=t.getAttribute("data-command"),i=t.className;n!==d._submenuName&&n!==d._containerName||e.stopPropagation()}},onClick_toolbar:function(e){let t=e.target,n=t.getAttribute("data-display"),i=t.getAttribute("data-command"),l=t.className;for(;t.parentNode&&!i&&!/se-menu-list/.test(l)&&!/se-toolbar/.test(l);)t=t.parentNode,i=t.getAttribute("data-command"),n=t.getAttribute("data-display"),l=t.className;(i||n)&&(t.disabled||(d.hasFocus||d.nativeFocus(),d._variable.isCodeView||d._editorRange(),d.actionCall(i,n,t)))},onMouseDown_wysiwyg:function(t){if(r.isNonEditable(e.element.wysiwyg))return;const n=r.getParentElement(t.target,r.isCell);if(n){const e=d.plugins.table;e&&n!==e._fixedCell&&!e._shift&&d.callPlugin("table",(function(){e.onTableCellMultiSelect.call(d,n,!1)}),null)}d._isBalloon&&u._hideToolbar(),/FIGURE/i.test(t.target.nodeName)&&t.preventDefault(),"function"==typeof h.onMouseDown&&h.onMouseDown(t,d)},onClick_wysiwyg:function(t){const n=t.target;if(r.isNonEditable(e.element.wysiwyg))return;const i=d.getFileComponent(n);if(i)return t.preventDefault(),void d.selectComponent(i.target,i.pluginName);const l=r.getParentElement(n,"FIGCAPTION");if(r.isNonEditable(l)&&(t.preventDefault(),l.setAttribute("contenteditable",!0),l.focus(),d._isInline&&!d._inlineToolbarAttr.isShow)){u._showToolbarInline();const e=function(){u._hideToolbar(),l.removeEventListener("blur",e)};l.addEventListener("blur",e)}a.setTimeout(d._editorRange.bind(d)),d._editorRange();const o=d.getSelectionNode(),s=r.getFormatElement(o,null),c=r.getRangeFormatElement(o,null);if(s&&s!==c||r.isNonEditable(n)||r.isList(c))u._applyTagEffects();else{const e=d.getRange();if(r.getFormatElement(e.startContainer)===r.getFormatElement(e.endContainer)){if(r.isList(c)){const e=r.createElement("LI"),t=o.nextElementSibling;e.appendChild(o),c.insertBefore(e,t)}else r.isWysiwygDiv(o)||r.isComponent(o)||r.isTable(o)&&!r.isCell(o)||d._setDefaultFormat(r.isRangeFormatElement(c)?"DIV":"P");t.preventDefault(),d.focus()}}d._isBalloon&&a.setTimeout(u._toggleToolbarBalloon),"function"==typeof h.onClick&&h.onClick(t,d)},_balloonDelay:null,_showToolbarBalloonDelay:function(){u._balloonDelay&&a.clearTimeout(u._balloonDelay),u._balloonDelay=a.setTimeout(function(){a.clearTimeout(this._balloonDelay),this._balloonDelay=null,this._showToolbarBalloon()}.bind(u),350)},_toggleToolbarBalloon:function(){d._editorRange();const e=d.getRange();d._bindControllersOff||!d._isBalloonAlways&&e.collapsed?u._hideToolbar():u._showToolbarBalloon(e)},_showToolbarBalloon:function(t){if(!d._isBalloon)return;const n=t||d.getRange(),i=e.element.toolbar,l=d.getSelection();let o;if(d._isBalloonAlways&&n.collapsed)o=!0;else if(l.focusNode===l.anchorNode)o=l.focusOffset0&&u._getPageBottomSpace()C&&(t=!1,y=!0),y&&(b=(t?n.top-m-g:n.bottom+g)-(n.noText?0:h)+d),i.style.left=a.Math.floor(v)+"px",i.style.top=a.Math.floor(b)+"px",t?(r.removeClass(e.element._arrow,"se-arrow-up"),r.addClass(e.element._arrow,"se-arrow-down"),e.element._arrow.style.top=m+"px"):(r.removeClass(e.element._arrow,"se-arrow-down"),r.addClass(e.element._arrow,"se-arrow-up"),e.element._arrow.style.top=-g+"px");const w=a.Math.floor(p/2+(f-v));e.element._arrow.style.left=(w+g>i.offsetWidth?i.offsetWidth-g:w";const e=f.attributes;for(;e[0];)f.removeAttribute(e[0].name);return d.nativeFocus(),!1}}if(f&&g.startContainer===g.endContainer&&3===c.nodeType&&!r.isFormatElement(c.parentNode)&&(g.collapsed?1===c.textContent.length:g.endOffset-g.startOffset===c.textContent.length)){t.preventDefault();let e=null,n=c.parentNode.previousSibling;const i=c.parentNode.nextSibling;n||(i?(n=i,e=0):(n=r.createElement("BR"),f.appendChild(n))),c.textContent="",r.removeItemAllParents(c,null,f),e="number"==typeof e?e:3===n.nodeType?n.textContent.length:1,d.setRange(n,e,n,e);break}const n=g.commonAncestorContainer;if(f=r.getFormatElement(g.startContainer,null),_=r.getRangeFormatElement(f,null),_&&f&&!r.isCell(_)&&!/^FIGCAPTION$/i.test(_.nodeName)){if(r.isListCell(f)&&r.isList(_)&&(r.isListCell(_.parentNode)||f.previousElementSibling)&&(c===f||3===c.nodeType&&(!c.previousSibling||r.isList(c.previousSibling)))&&(r.getFormatElement(g.startContainer,null)!==r.getFormatElement(g.endContainer,null)?_.contains(g.startContainer):0===g.startOffset&&g.collapsed)){if(g.startContainer!==g.endContainer)t.preventDefault(),d.removeNode(),3===g.startContainer.nodeType&&d.setRange(g.startContainer,g.startContainer.textContent.length,g.startContainer,g.startContainer.textContent.length),d.history.push(!0);else{let e=f.previousElementSibling||_.parentNode;if(r.isListCell(e)){t.preventDefault();let n=e;if(!e.contains(f)&&r.isListCell(n)&&r.isList(n.lastElementChild)){for(n=n.lastElementChild.lastElementChild;r.isListCell(n)&&r.isList(n.lastElementChild);)n=n.lastElementChild&&n.lastElementChild.lastElementChild;e=n}let i=e===_.parentNode?_.previousSibling:e.lastChild;i||(i=r.createTextNode(r.zeroWidthSpace),_.parentNode.insertBefore(i,_.parentNode.firstChild));const l=3===i.nodeType?i.textContent.length:1,o=f.childNodes;let s=i,a=o[0];for(;a=o[0];)e.insertBefore(a,s.nextSibling),s=a;r.removeItem(f),0===_.children.length&&r.removeItem(_),d.setRange(i,l,i,l),d.history.push(!0)}}break}if(!p&&0===g.startOffset){let e=!0,i=n;for(;i&&i!==_&&!r.isWysiwygDiv(i);){if(i.previousSibling&&(1===i.previousSibling.nodeType||!r.onlyZeroWidthSpace(i.previousSibling.textContent.trim()))){e=!1;break}i=i.parentNode}if(e&&_.parentNode){t.preventDefault(),d.detachRangeFormatElement(_,r.isListCell(f)?[f]:null,null,!1,!1),d.history.push(!0);break}}}if(!p&&(0===g.startOffset||c===f&&f.childNodes[g.startOffset])){const e=c===f?f.childNodes[g.startOffset]:c,i=(3===n.nodeType||r.isBreak(n))&&!n.previousSibling&&0===g.startOffset;if(!e.previousSibling&&(r.isComponent(n.previousSibling)||i&&r.isComponent(f.previousSibling))){const e=d.getFileComponent(f.previousSibling);e&&(t.preventDefault(),t.stopPropagation(),0===f.textContent.length&&r.removeItem(f),d.selectComponent(e.target,e.pluginName));break}if(r.isNonEditable(e.previousSibling)){t.preventDefault(),t.stopPropagation(),r.removeItem(e.previousSibling);break}}break;case 46:if(m){t.preventDefault(),t.stopPropagation(),d.plugins[m].destroy.call(d);break}if(p&&u._hardDelete()){t.preventDefault(),t.stopPropagation();break}if((r.isFormatElement(c)||null===c.nextSibling||r.onlyZeroWidthSpace(c.nextSibling)&&null===c.nextSibling.nextSibling)&&g.startOffset===c.textContent.length){let e=f.nextElementSibling;if(!e){t.preventDefault();break}if(r.isComponent(e)){if(t.preventDefault(),r.onlyZeroWidthSpace(f)&&(r.removeItem(f),r.isTable(e))){let t=r.getChildElement(e,r.isCell,!1);t=t.firstElementChild||t,d.setRange(t,0,t,0);break}const n=d.getFileComponent(e);n&&(t.stopPropagation(),d.selectComponent(n.target,n.pluginName));break}}if(!p&&(d.isEdgePoint(g.endContainer,g.endOffset)||c===f&&f.childNodes[g.startOffset])){const e=c===f?f.childNodes[g.startOffset]:c;if(r.isNonEditable(e.nextSibling)){t.preventDefault(),t.stopPropagation(),r.removeItem(e.nextSibling);break}}if(f=r.getFormatElement(g.startContainer,null),_=r.getRangeFormatElement(f,null),r.isListCell(f)&&r.isList(_)&&(c===f||3===c.nodeType&&(!c.nextSibling||r.isList(c.nextSibling))&&(r.getFormatElement(g.startContainer,null)!==r.getFormatElement(g.endContainer,null)?_.contains(g.endContainer):g.endOffset===c.textContent.length&&g.collapsed))){g.startContainer!==g.endContainer&&d.removeNode();let e=r.getArrayItem(f.children,r.isList,!1);if(e=e||f.nextElementSibling||_.parentNode.nextElementSibling,e&&(r.isList(e)||r.getArrayItem(e.children,r.isList,!1))){let n,i;if(t.preventDefault(),r.isList(e)){const t=e.firstElementChild;for(i=t.childNodes,n=i[0];i[0];)f.insertBefore(i[0],e);r.removeItem(t)}else{for(n=e.firstChild,i=e.childNodes;i[0];)f.appendChild(i[0]);r.removeItem(e)}d.setRange(n,0,n,0),d.history.push(!0)}break}break;case 9:if(m||l.tabDisable)break;if(t.preventDefault(),o||s||r.isWysiwygDiv(c))break;const b=!g.collapsed||d.isEdgePoint(g.startContainer,g.startOffset),v=d.getSelectedElements(null);c=d.getSelectionNode();const y=[];let C=[],w=r.isListCell(v[0]),x=r.isListCell(v[v.length-1]),E={sc:g.startContainer,so:g.startOffset,ec:g.endContainer,eo:g.endOffset};for(let e,t=0,n=v.length;t0&&b&&d.plugins.list)E=d.plugins.list.editInsideList.call(d,i,y);else{const e=r.getParentElement(c,r.isCell);if(e&&b){const t=r.getParentElement(e,"table"),n=r.getListChildren(t,r.isCell);let l=i?r.prevIdx(n,e):r.nextIdx(n,e);l!==n.length||i||(l=0),-1===l&&i&&(l=n.length-1);let o=n[l];if(!o)break;o=o.firstElementChild||o,d.setRange(o,0,o,0);break}C=C.concat(y),w=x=null}if(C.length>0)if(i){const e=C.length-1;for(let t,n=0;n<=e;n++){t=C[n].childNodes;for(let e,n=0,i=t.length;n":"<"+f.nodeName+">
    ",!d.checkCharCount(e,"byte-html"))return t.preventDefault(),!1}if(!i&&S){t.preventDefault();const e=c===S,n=d.getSelection(),i=c.childNodes,l=n.focusOffset,o=c.previousElementSibling,s=c.nextSibling;if(!r.isClosureFreeFormatElement(S)&&i&&(e&&g.collapsed&&i.length-1<=l+1&&r.isBreak(i[l])&&(!i[l+1]||(!i[l+2]||r.onlyZeroWidthSpace(i[l+2].textContent))&&3===i[l+1].nodeType&&r.onlyZeroWidthSpace(i[l+1].textContent))&&l>0&&r.isBreak(i[l-1])||!e&&r.onlyZeroWidthSpace(c.textContent)&&r.isBreak(o)&&(r.isBreak(o.previousSibling)||!r.onlyZeroWidthSpace(o.previousSibling.textContent))&&(!s||!r.isBreak(s)&&r.onlyZeroWidthSpace(s.textContent)))){e?r.removeItem(i[l-1]):r.removeItem(c);const t=d.appendFormatTag(S,r.isFormatElement(S.nextElementSibling)?S.nextElementSibling:null);r.copyFormatAttributes(t,S),d.setRange(t,1,t,1);break}if(e){h.insertHTML(g.collapsed&&r.isBreak(g.startContainer.childNodes[g.startOffset-1])?"
    ":"

    ",!0,!1);let e=n.focusNode;const t=n.focusOffset;S===e&&(e=e.childNodes[t-l>1?t-1:t]),d.setRange(e,1,e,1)}else{const e=n.focusNode.nextSibling,t=r.createElement("BR");d.insertNode(t,null,!1);const i=t.previousSibling,l=t.nextSibling;r.isBreak(e)||r.isBreak(i)||l&&!r.onlyZeroWidthSpace(l)?d.setRange(l,0,l,0):(t.parentNode.insertBefore(t.cloneNode(!1),t),d.setRange(t,1,t,1))}u._onShortcutKey=!0;break}if(p)break;if(_&&f&&!r.isCell(_)&&!/^FIGCAPTION$/i.test(_.nodeName)){const e=d.getRange();if(d.isEdgePoint(e.endContainer,e.endOffset)&&r.isList(c.nextSibling)){t.preventDefault();const e=r.createElement("LI"),n=r.createElement("BR");e.appendChild(n),f.parentNode.insertBefore(e,f.nextElementSibling),e.appendChild(c.nextSibling),d.setRange(n,1,n,1);break}if((3!==e.commonAncestorContainer.nodeType||!e.commonAncestorContainer.nextElementSibling)&&r.onlyZeroWidthSpace(f.innerText.trim())){t.preventDefault();let e=null;if(r.isListCell(_.parentNode)){if(_=f.parentNode.parentNode.parentNode,e=r.splitElement(f,null,r.getElementDepth(f)-2),!e){const t=r.createElement("LI");t.innerHTML="
    ",_.insertBefore(t,e),e=t}}else{const t=r.isCell(_.parentNode)?"DIV":r.isList(_.parentNode)?"LI":r.isFormatElement(_.nextElementSibling)?_.nextElementSibling.nodeName:r.isFormatElement(_.previousElementSibling)?_.previousElementSibling.nodeName:"P";e=r.createElement(t);const n=d.detachRangeFormatElement(_,[f],null,!0,!0);n.cc.insertBefore(e,n.ec)}e.innerHTML="
    ",r.copyFormatAttributes(e,f),r.removeItemAllParents(f,null,null),d.setRange(e,1,e,1);break}}if(_&&r.getParentElement(_,"FIGCAPTION")&&r.getParentElement(_,r.isList)&&(t.preventDefault(),f=d.appendFormatTag(f,null),d.setRange(f,0,f,0)),m){t.preventDefault(),t.stopPropagation();const n=e[m],i=n._container,l=i.previousElementSibling||i.nextElementSibling;let o=null;r.isListCell(i.parentNode)?o=r.createElement("BR"):(o=r.createElement(r.isFormatElement(l)?l.nodeName:"P"),o.innerHTML="
    "),i.parentNode.insertBefore(o,i),d.callPlugin(m,(function(){d.selectComponent(n._element,m)}),null)}break;case 27:if(m)return t.preventDefault(),t.stopPropagation(),d.controllersOff(),!1}if(i&&/16/.test(n)){t.preventDefault(),t.stopPropagation();const e=d.plugins.table;if(e&&!e._shift&&!e._ref){const t=r.getParentElement(f,r.isCell);if(t)return void e.onTableCellMultiSelect.call(d,t,!0)}}if(!(o||s||p||u._nonTextKeyCode.test(n))&&g.collapsed&&g.startContainer===g.endContainer&&r.isBreak(g.commonAncestorContainer)){const e=r.createTextNode(r.zeroWidthSpace);d.insertNode(e,null,!1),d.setRange(e,1,e,1)}"function"==typeof h.onKeyDown&&h.onKeyDown(t,d)},onKeyUp_wysiwyg:function(e){if(u._onShortcutKey)return;d._editorRange();const t=d.getRange(),n=e.keyCode,i=e.ctrlKey||e.metaKey||91===n||92===n||224===n,l=e.altKey;let o=d.getSelectionNode();if(d._isBalloon&&(d._isBalloonAlways&&27!==n||!t.collapsed)){if(!d._isBalloonAlways)return void u._showToolbarBalloon();27!==n&&u._showToolbarBalloonDelay()}if(8===n&&r.isWysiwygDiv(o)&&""===o.textContent&&0===o.children.length){e.preventDefault(),e.stopPropagation(),o.innerHTML="";const t=r.createElement(r.isFormatElement(d._variable.currentNodes[0])?d._variable.currentNodes[0]:"P");return t.innerHTML="
    ",o.appendChild(t),d.setRange(t,0,t,0),u._applyTagEffects(),void d.history.push(!1)}const s=r.getFormatElement(o,null),a=r.getRangeFormatElement(o,null);(s||!t.collapsed)&&s!==a||r.isComponent(o)||r.isList(o)||(d._setDefaultFormat(r.isRangeFormatElement(a)?"DIV":"P"),o=d.getSelectionNode()),u._directionKeyCode.test(n)&&u._applyTagEffects();if(!i&&!l&&!u._nonTextKeyCode.test(n)&&3===o.nodeType&&r.zeroWidthRegExp.test(o.textContent)&&!(void 0!==e.isComposing?e.isComposing:u._IEisComposing)){let e=t.startOffset,n=t.endOffset;const i=(o.textContent.substring(0,n).match(u._frontZeroWidthReg)||"").length;e=t.startOffset-i,n=t.endOffset-i,o.textContent=o.textContent.replace(r.zeroWidthRegExp,""),d.setRange(o,e<0?0:e,o,n<0?0:n)}d._charCount(""),d.history.push(!0),"function"==typeof h.onKeyUp&&h.onKeyUp(e,d)},onScroll_wysiwyg:function(e){d.controllersOff(),d._lineBreaker.style.display="none",d._isBalloon&&u._hideToolbar(),"function"==typeof h.onScroll&&h.onScroll(e,d)},onFocus_wysiwyg:function(e){d._antiBlur||(d.hasFocus=!0,d._isInline&&u._showToolbarInline(),"function"==typeof h.onFocus&&h.onFocus(e,d))},onBlur_wysiwyg:function(t){if(d._antiBlur)return;d.hasFocus=!1,d.controllersOff(),(d._isInline||d._isBalloon)&&u._hideToolbar(),"function"==typeof h.onBlur&&h.onBlur(t,d);const i=d.commandMap,o=d.activePlugins;for(let e in i)r.hasOwn(i,e)&&(o.indexOf(e)>-1?n[e].active.call(d,null):i.OUTDENT&&/^OUTDENT$/i.test(e)?i.OUTDENT.setAttribute("disabled",!0):i.INDENT&&/^INDENT$/i.test(e)?i.INDENT.removeAttribute("disabled"):r.removeClass(i[e],"active"));d._variable.currentNodes=[],d._variable.currentNodesMap=[],l.showPathLabel&&(e.element.navigation.textContent="")},onMouseDown_resizingBar:function(t){t.stopPropagation(),d._variable.resizeClientY=t.clientY,e.element.resizeBackground.style.display="block",s.addEventListener("mousemove",u._resize_editor),s.addEventListener("mouseup",(function t(){e.element.resizeBackground.style.display="none",s.removeEventListener("mousemove",u._resize_editor),s.removeEventListener("mouseup",t)}))},_resize_editor:function(t){const n=e.element.editorArea.offsetHeight+(t.clientY-d._variable.resizeClientY);e.element.wysiwygFrame.style.height=e.element.code.style.height=(n=n+o?(d._sticky||u._onStickyToolbar(),t.toolbar.style.top=n+o+l.stickyToolbar-i-d._variable.minResizingSize+"px"):i>=o&&u._onStickyToolbar()},_getEditorOffsets:function(t){let n=t||e.element.topArea,i=0,l=0,o=0;for(;n;)i+=n.offsetTop,l+=n.offsetLeft,o+=n.scrollTop,n=n.offsetParent;return{top:i,left:l,scroll:o}},_getPageBottomSpace:function(){return s.documentElement.scrollHeight-(u._getEditorOffsets(null).top+e.element.topArea.offsetHeight)},_onStickyToolbar:function(){const t=e.element;d._isInline||l.toolbarContainer||(t._stickyDummy.style.height=t.toolbar.offsetHeight+"px",t._stickyDummy.style.display="block"),t.toolbar.style.top=l.stickyToolbar+"px",t.toolbar.style.width=d._isInline?d._inlineToolbarAttr.width:t.toolbar.offsetWidth+"px",r.addClass(t.toolbar,"se-toolbar-sticky"),d._sticky=!0},_offStickyToolbar:function(){const t=e.element;t._stickyDummy.style.display="none",t.toolbar.style.top=d._isInline?d._inlineToolbarAttr.top:"",t.toolbar.style.width=d._isInline?d._inlineToolbarAttr.width:"",t.editorArea.style.marginTop="",r.removeClass(t.toolbar,"se-toolbar-sticky"),d._sticky=!1},_codeViewAutoHeight:function(){e.element.code.style.height=e.element.code.scrollHeight+"px"},_hardDelete:function(){const e=d.getRange(),t=e.startContainer,n=e.endContainer,i=r.getRangeFormatElement(t),l=r.getRangeFormatElement(n),o=r.isCell(i),s=r.isCell(l);if((o&&!i.previousElementSibling&&!i.parentElement.previousElementSibling||s&&!l.nextElementSibling&&!l.parentElement.nextElementSibling)&&i!==l)if(o){if(s)return r.removeItem(r.getParentElement(i,r.isComponent)),d.nativeFocus(),!0;r.removeItem(r.getParentElement(i,r.isComponent))}else r.removeItem(r.getParentElement(l,r.isComponent));const a=1===t.nodeType?r.getParentElement(t,".se-component"):null,c=1===n.nodeType?r.getParentElement(n,".se-component"):null;return a&&r.removeItem(a),c&&r.removeItem(c),!1},onPaste_wysiwyg:function(e){const t=r.isIE?a.clipboardData:e.clipboardData;return!t||u._dataTransferAction("paste",e,t)},_setClipboardComponent:function(e,t,n){e.preventDefault(),e.stopPropagation(),n.setData("text/html",t.component.outerHTML)},onCopy_wysiwyg:function(e){const t=r.isIE?a.clipboardData:e.clipboardData;if("function"==typeof h.onCopy&&!h.onCopy(e,t,d))return e.preventDefault(),e.stopPropagation(),!1;const n=d.currentFileComponentInfo;n&&!r.isIE&&(u._setClipboardComponent(e,n,t),r.addClass(n.component,"se-component-copy"),a.setTimeout((function(){r.removeClass(n.component,"se-component-copy")}),150))},onCut_wysiwyg:function(e){const t=r.isIE?a.clipboardData:e.clipboardData;if("function"==typeof h.onCut&&!h.onCut(e,t,d))return e.preventDefault(),e.stopPropagation(),!1;const n=d.currentFileComponentInfo;n&&!r.isIE&&(u._setClipboardComponent(e,n,t),r.removeItem(n.component),d.controllersOff()),a.setTimeout((function(){d.history.push(!1)}))},onDrop_wysiwyg:function(e){const t=e.dataTransfer;return!t||(r.isIE?(e.preventDefault(),e.stopPropagation(),!1):(d.removeNode(),u._setDropLocationSelection(e),u._dataTransferAction("drop",e,t)))},_setDropLocationSelection:function(e){if(e.rangeParent)d.setRange(e.rangeParent,e.rangeOffset,e.rangeParent,e.rangeOffset);else if(d._wd.caretRangeFromPoint){const t=d._wd.caretRangeFromPoint(e.clientX,e.clientY);d.setRange(t.startContainer,t.startOffset,t.endContainer,t.endOffset)}else{const e=d.getRange();d.setRange(e.startContainer,e.startOffset,e.endContainer,e.endOffset)}},_dataTransferAction:function(t,n,i){let l,o;if(r.isIE){l=i.getData("Text");const s=d.getRange(),c=r.createElement("DIV"),h={sc:s.startContainer,so:s.startOffset,ec:s.endContainer,eo:s.endOffset};return c.setAttribute("contenteditable",!0),c.style.cssText="position:absolute; top:0; left:0; width:1px; height:1px; overflow:hidden;",e.element.relative.appendChild(c),c.focus(),a.setTimeout((function(){o=c.innerHTML,r.removeItem(c),d.setRange(h.sc,h.so,h.ec,h.eo),u._setClipboardData(t,n,l,o,i)})),!0}if(l=i.getData("text/plain"),o=i.getData("text/html"),!1===u._setClipboardData(t,n,l,o,i))return n.preventDefault(),n.stopPropagation(),!1},_setClipboardData:function(e,t,n,i,l){/class=["']*Mso(Normal|List)/i.test(i)||/content=["']*Word.Document/i.test(i)||/content=["']*OneNote.File/i.test(i)?(i=i.replace(/\n/g," "),n=n.replace(/\n/g," ")):n=n.replace(/\n/g,""),i=d.cleanHTML(i,d.pasteTagsWhitelistRegExp);const o=d._charCount(d._charTypeHTML?i:n);if("paste"===e&&"function"==typeof h.onPaste&&!h.onPaste(t,i,o,d))return!1;if("drop"===e&&"function"==typeof h.onDrop&&!h.onDrop(t,l,d))return!1;const s=l.files;return s.length>0?(/^image/.test(s[0].type)&&d.plugins.image&&h.insertImage(s),!1):!!o&&(i?(h.insertHTML(i,!0,!1),!1):void 0)},onMouseMove_wysiwyg:function(t){if(d.isDisabled)return;const n=r.getParentElement(t.target,r.isComponent),i=d._lineBreaker.style;if(n&&!d.currentControllerName){let o=0,s=e.element.wysiwyg;do{o+=s.scrollTop,s=s.parentElement}while(s&&!/^(BODY|HTML)$/i.test(s.nodeName));const a=e.element.wysiwyg.scrollTop,c=u._getEditorOffsets(null),h=r.getOffset(n,e.element.wysiwygFrame).top+a,g=t.pageY+o+(l.iframe&&!l.toolbarContainer?e.element.toolbar.offsetHeight:0),p=h+(l.iframe?o:c.top),m=r.isListCell(n.parentNode);let f="",_="";if((m?!n.previousSibling:!r.isFormatElement(n.previousElementSibling))&&gp+n.offsetHeight-20))return void(i.display="none");_=h+n.offsetHeight,f="b"}d._variable._lineBreakComp=n,d._variable._lineBreakDir=f,i.top=_-a+"px",d._lineBreakerButton.style.left=r.getOffset(n).left+n.offsetWidth/2-15+"px",i.display="block"}else"none"!==i.display&&(i.display="none")},_onMouseDown_lineBreak:function(e){e.preventDefault()},_onLineBreak:function(e){e.preventDefault();const t=d._variable._lineBreakComp,n=this?this:d._variable._lineBreakDir,i=r.isListCell(t.parentNode),l=r.createElement(i?"BR":r.isCell(t.parentNode)?"DIV":"P");if(i||(l.innerHTML="
    "),d._charTypeHTML&&!d.checkCharCount(l.outerHTML,"byte-html"))return;t.parentNode.insertBefore(l,"t"===n?t:t.nextSibling),d._lineBreaker.style.display="none",d._variable._lineBreakComp=null;const o=i?l:l.firstChild;d.setRange(o,1,o,1),d.history.push(!1)},_addEvent:function(){const t=l.iframe?d._ww:e.element.wysiwyg;e.element.toolbar.addEventListener("mousedown",u._buttonsEventHandler,!1),e.element._menuTray.addEventListener("mousedown",u._buttonsEventHandler,!1),e.element.toolbar.addEventListener("click",u.onClick_toolbar,!1),t.addEventListener("mousedown",u.onMouseDown_wysiwyg,!1),t.addEventListener("click",u.onClick_wysiwyg,!1),t.addEventListener(r.isIE?"textinput":"input",u.onInput_wysiwyg,!1),t.addEventListener("keydown",u.onKeyDown_wysiwyg,!1),t.addEventListener("keyup",u.onKeyUp_wysiwyg,!1),t.addEventListener("paste",u.onPaste_wysiwyg,!1),t.addEventListener("copy",u.onCopy_wysiwyg,!1),t.addEventListener("cut",u.onCut_wysiwyg,!1),t.addEventListener("drop",u.onDrop_wysiwyg,!1),t.addEventListener("scroll",u.onScroll_wysiwyg,!1),t.addEventListener("focus",u.onFocus_wysiwyg,!1),t.addEventListener("blur",u.onBlur_wysiwyg,!1),u._lineBreakerBind={a:u._onLineBreak.bind(""),t:u._onLineBreak.bind("t"),b:u._onLineBreak.bind("b")},t.addEventListener("mousemove",u.onMouseMove_wysiwyg,!1),d._lineBreakerButton.addEventListener("mousedown",u._onMouseDown_lineBreak,!1),d._lineBreakerButton.addEventListener("click",u._lineBreakerBind.a,!1),e.element.lineBreaker_t.addEventListener("mousedown",u._lineBreakerBind.t,!1),e.element.lineBreaker_b.addEventListener("mousedown",u._lineBreakerBind.b,!1),d.plugins.table&&t.addEventListener("touchstart",u.onMouseDown_wysiwyg,{passive:!0,useCapture:!1}),"auto"!==l.height||l.codeMirrorEditor||(e.element.code.addEventListener("keydown",u._codeViewAutoHeight,!1),e.element.code.addEventListener("keyup",u._codeViewAutoHeight,!1),e.element.code.addEventListener("paste",u._codeViewAutoHeight,!1)),e.element.resizingBar&&(/\d+/.test(l.height)?e.element.resizingBar.addEventListener("mousedown",u.onMouseDown_resizingBar,!1):r.addClass(e.element.resizingBar,"se-resizing-none")),u._setResponsiveToolbar(),a.removeEventListener("resize",u.onResize_window),a.removeEventListener("scroll",u.onScroll_window),a.addEventListener("resize",u.onResize_window,!1),l.stickyToolbar>-1&&a.addEventListener("scroll",u.onScroll_window,!1)},_removeEvent:function(){const t=l.iframe?d._ww:e.element.wysiwyg;e.element.toolbar.removeEventListener("mousedown",u._buttonsEventHandler),e.element._menuTray.removeEventListener("mousedown",u._buttonsEventHandler),e.element.toolbar.removeEventListener("click",u.onClick_toolbar),t.removeEventListener("mousedown",u.onMouseDown_wysiwyg),t.removeEventListener("click",u.onClick_wysiwyg),t.removeEventListener(r.isIE?"textinput":"input",u.onInput_wysiwyg),t.removeEventListener("keydown",u.onKeyDown_wysiwyg),t.removeEventListener("keyup",u.onKeyUp_wysiwyg),t.removeEventListener("paste",u.onPaste_wysiwyg),t.removeEventListener("copy",u.onCopy_wysiwyg),t.removeEventListener("cut",u.onCut_wysiwyg),t.removeEventListener("drop",u.onDrop_wysiwyg),t.removeEventListener("scroll",u.onScroll_wysiwyg),t.removeEventListener("mousemove",u.onMouseMove_wysiwyg),d._lineBreakerButton.removeEventListener("mousedown",u._onMouseDown_lineBreak),d._lineBreakerButton.removeEventListener("click",u._lineBreakerBind.a),e.element.lineBreaker_t.removeEventListener("mousedown",u._lineBreakerBind.t),e.element.lineBreaker_b.removeEventListener("mousedown",u._lineBreakerBind.b),u._lineBreakerBind=null,t.removeEventListener("touchstart",u.onMouseDown_wysiwyg,{passive:!0,useCapture:!1}),t.removeEventListener("focus",u.onFocus_wysiwyg),t.removeEventListener("blur",u.onBlur_wysiwyg),e.element.code.removeEventListener("keydown",u._codeViewAutoHeight),e.element.code.removeEventListener("keyup",u._codeViewAutoHeight),e.element.code.removeEventListener("paste",u._codeViewAutoHeight),e.element.resizingBar&&e.element.resizingBar.removeEventListener("mousedown",u.onMouseDown_resizingBar),a.removeEventListener("resize",u.onResize_window),a.removeEventListener("scroll",u.onScroll_window)},_setResponsiveToolbar:function(){if(0===o.length)return void(o=null);const e=u._responsiveButtonSize=["default"],t=u._responsiveButtons={default:o[0]};for(let n,i,l=1,s=o.length;l",e}};return void 0===t&&(e.SUNEDITOR_MODULES||Object.defineProperty(e,"SUNEDITOR_MODULES",{enumerable:!0,writable:!1,configurable:!1,value:{}}),Object.defineProperty(e.SUNEDITOR_MODULES,"component",{enumerable:!0,writable:!1,configurable:!1,value:n})),n},"object"==typeof e.exports?e.exports=i.document?l(i,!0):function(e){if(!e.document)throw new Error("SUNEDITOR_MODULES a window with a document");return l(e)}:l(i)},ee5k:function(e,t,n){"use strict";var i,l;i="undefined"!=typeof window?window:this,l=function(e,t){const n={name:"resizing",add:function(e){const t=e.icons,n=e.context;n.resizing={_resizeClientX:0,_resizeClientY:0,_resize_plugin:"",_resize_w:0,_resize_h:0,_origin_w:0,_origin_h:0,_rotateVertical:!1,_resize_direction:"",_move_path:null,_isChange:!1,alignIcons:{basic:t.align_justify,left:t.align_left,right:t.align_right,center:t.align_center}};let i=this.setController_resize.call(e);n.resizing.resizeContainer=i,n.resizing.resizeDiv=i.querySelector(".se-modal-resize"),n.resizing.resizeDot=i.querySelector(".se-resize-dot"),n.resizing.resizeDisplay=i.querySelector(".se-resize-display");let l=this.setController_button.call(e);n.resizing.resizeButton=l;let o=n.resizing.resizeHandles=n.resizing.resizeDot.querySelectorAll("span");n.resizing.resizeButtonGroup=l.querySelector("._se_resizing_btn_group"),n.resizing.rotationButtons=l.querySelectorAll("._se_resizing_btn_group ._se_rotation"),n.resizing.percentageButtons=l.querySelectorAll("._se_resizing_btn_group ._se_percentage"),n.resizing.alignMenu=l.querySelector(".se-resizing-align-list"),n.resizing.alignMenuList=n.resizing.alignMenu.querySelectorAll("button"),n.resizing.alignButton=l.querySelector("._se_resizing_align_button"),n.resizing.autoSizeButton=l.querySelector("._se_resizing_btn_group ._se_auto_size"),n.resizing.captionButton=l.querySelector("._se_resizing_caption_button"),i.addEventListener("mousedown",(function(e){e.preventDefault()})),l.addEventListener("mousedown",e.eventStop),o[0].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),o[1].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),o[2].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),o[3].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),o[4].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),o[5].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),o[6].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),o[7].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),l.addEventListener("click",this.onClick_resizeButton.bind(e)),n.element.relative.appendChild(i),n.element.relative.appendChild(l),i=null,l=null,o=null},setController_resize:function(){const e=this.util.createElement("DIV");return e.className="se-controller se-resizing-container",e.style.display="none",e.innerHTML='
    ',e},setController_button:function(){const e=this.lang,t=this.icons,n=this.util.createElement("DIV");return n.className="se-controller se-controller-resizing",n.innerHTML='
    ",n},_module_getSizeX:function(e,t,n,i){return t||(t=e._element),n||(n=e._cover),i||(i=e._container),t?/%$/.test(t.style.width)?(i&&this.util.getNumber(i.style.width,2)||100)+"%":t.style.width:""},_module_getSizeY:function(e,t,n,i){return t||(t=e._element),n||(n=e._cover),i||(i=e._container),i&&n?this.util.getNumber(n.style.paddingBottom,0)>0&&!this.context.resizing._rotateVertical?n.style.height:/%$/.test(t.style.height)&&/%$/.test(t.style.width)?(i&&this.util.getNumber(i.style.height,2)||100)+"%":t.style.height:t&&t.style.height||""},_module_setModifyInputSize:function(e,t){const n=e._onlyPercentage&&this.context.resizing._rotateVertical;e.proportion.checked=e._proportionChecked="false"!==e._element.getAttribute("data-proportion");let i=n?"":this.plugins.resizing._module_getSizeX.call(this,e);if(i===e._defaultSizeX&&(i=""),e._onlyPercentage&&(i=this.util.getNumber(i,2)),e.inputX.value=i,t.setInputSize.call(this,"x"),!e._onlyPercentage){let t=n?"":this.plugins.resizing._module_getSizeY.call(this,e);t===e._defaultSizeY&&(t=""),e._onlyPercentage&&(t=this.util.getNumber(t,2)),e.inputY.value=t}e.inputX.disabled=!!n,e.inputY.disabled=!!n,e.proportion.disabled=!!n,t.setRatio.call(this)},_module_setInputSize:function(e,t){if(e._onlyPercentage)"x"===t&&e.inputX.value>100&&(e.inputX.value=100);else if(e.proportion.checked&&e._ratio&&/\d/.test(e.inputX.value)&&/\d/.test(e.inputY.value)){const n=e.inputX.value.replace(/\d+|\./g,"")||e.sizeUnit,i=e.inputY.value.replace(/\d+|\./g,"")||e.sizeUnit;if(n!==i)return;const l="%"===n?2:0;"x"===t?e.inputY.value=this.util.getNumber(e._ratioY*this.util.getNumber(e.inputX.value,l),l)+i:e.inputX.value=this.util.getNumber(e._ratioX*this.util.getNumber(e.inputY.value,l),l)+n}},_module_setRatio:function(e){const t=e.inputX.value,n=e.inputY.value;if(e.proportion.checked&&/\d+/.test(t)&&/\d+/.test(n)){if((t.replace(/\d+|\./g,"")||e.sizeUnit)!==(n.replace(/\d+|\./g,"")||e.sizeUnit))e._ratio=!1;else if(!e._ratio){const i=this.util.getNumber(t,0),l=this.util.getNumber(n,0);e._ratio=!0,e._ratioX=i/l,e._ratioY=l/i}}else e._ratio=!1},_module_sizeRevert:function(e){e._onlyPercentage?e.inputX.value=e._origin_w>100?100:e._origin_w:(e.inputX.value=e._origin_w,e.inputY.value=e._origin_h)},_module_saveCurrentSize:function(e){const t=this.plugins.resizing._module_getSizeX.call(this,e),n=this.plugins.resizing._module_getSizeY.call(this,e);e._element.setAttribute("data-size",t+","+n),e._videoRatio&&(e._videoRatio=n)},call_controller_resize:function(e,t){const n=this.context.resizing,i=this.context[t];n._resize_plugin=t;const l=n.resizeContainer,o=n.resizeDiv,s=this.util.getOffset(e,this.context.element.wysiwygFrame),a=n._rotateVertical=/^(90|270)$/.test(Math.abs(e.getAttribute("data-rotate")).toString()),r=a?e.offsetHeight:e.offsetWidth,c=a?e.offsetWidth:e.offsetHeight,d=s.top,u=s.left-this.context.element.wysiwygFrame.scrollLeft;l.style.top=d+"px",l.style.left=u+"px",l.style.width=r+"px",l.style.height=c+"px",o.style.top="0px",o.style.left="0px",o.style.width=r+"px",o.style.height=c+"px";let h=e.getAttribute("data-align")||"basic";h="none"===h?"basic":h;const g=this.util.getParentElement(e,this.util.isComponent),p=this.util.getParentElement(e,"FIGURE"),m=this.plugins.resizing._module_getSizeX.call(this,i,e,p,g)||"auto",f=i._onlyPercentage&&"image"===t?"":", "+(this.plugins.resizing._module_getSizeY.call(this,i,e,p,g)||"auto");this.util.changeTxt(n.resizeDisplay,this.lang.dialogBox[h]+" ("+m+f+")"),n.resizeButtonGroup.style.display=i._resizing?"":"none";const _=!i._resizing||i._resizeDotHide||i._onlyPercentage?"none":"flex",b=n.resizeHandles;for(let e=0,t=b.length;e=360?0:d;s.setAttribute("data-rotate",u),c._rotateVertical=/^(90|270)$/.test(this._w.Math.abs(u).toString()),this.plugins.resizing.setTransformSize.call(this,s,null,null),this.selectComponent(s,l);break;case"onalign":return void this.plugins.resizing.openAlignMenu.call(this);case"align":const h="basic"===i?"none":i;a.setAlign.call(this,h,null,null,null),this.selectComponent(s,l);break;case"caption":const g=!o._captionChecked;if(a.openModify.call(this,!0),o._captionChecked=o.captionCheckEl.checked=g,a.update_image.call(this,!1,!1,!1),g){const e=this.util.getChildElement(o._caption,(function(e){return 3===e.nodeType}));e?this.setRange(e,0,e,e.textContent.length):o._caption.focus(),this.controllersOff()}else this.selectComponent(s,l),a.openModify.call(this,!0);break;case"revert":a.setOriginSize.call(this),this.selectComponent(s,l);break;case"update":a.openModify.call(this),this.controllersOff();break;case"delete":a.destroy.call(this)}this.history.push(!1)}},resetTransform:function(e){const t=(e.getAttribute("data-size")||e.getAttribute("data-origin")||"").split(",");this.context.resizing._rotateVertical=!1,e.style.maxWidth="",e.style.transform="",e.style.transformOrigin="",e.setAttribute("data-rotate",""),e.setAttribute("data-rotateX",""),e.setAttribute("data-rotateY",""),this.plugins[this.context.resizing._resize_plugin].setSize.call(this,t[0]?t[0]:"auto",t[1]?t[1]:"",!0)},setTransformSize:function(e,t,n){let i=e.getAttribute("data-percentage");const l=this.context.resizing._rotateVertical,o=1*e.getAttribute("data-rotate");let s="";if(i&&!l)i=i.split(","),"auto"===i[0]&&"auto"===i[1]?this.plugins[this.context.resizing._resize_plugin].setAutoSize.call(this):this.plugins[this.context.resizing._resize_plugin].setPercentSize.call(this,i[0],i[1]);else{const i=this.util.getParentElement(e,"FIGURE"),a=t||e.offsetWidth,r=n||e.offsetHeight,c=(l?r:a)+"px",d=(l?a:r)+"px";if(this.plugins[this.context.resizing._resize_plugin].cancelPercentAttr.call(this),this.plugins[this.context.resizing._resize_plugin].setSize.call(this,a+"px",r+"px",!0),i.style.width=c,i.style.height=this.context[this.context.resizing._resize_plugin]._caption?"":d,l){let e=a/2+"px "+a/2+"px 0",t=r/2+"px "+r/2+"px 0";s=90===o||-270===o?t:e}}e.style.transformOrigin=s,this.plugins.resizing._setTransForm(e,o.toString(),e.getAttribute("data-rotateX")||"",e.getAttribute("data-rotateY")||""),e.style.maxWidth=l?"none":"",this.plugins.resizing.setCaptionPosition.call(this,e)},_setTransForm:function(e,t,n,i){let l=(e.offsetWidth-e.offsetHeight)*(/-/.test(t)?1:-1),o="";if(/[1-9]/.test(t)&&(n||i))switch(o=n?"Y":"X",t){case"90":o=n&&i?"X":i?o:"";break;case"270":l*=-1,o=n&&i?"Y":n?o:"";break;case"-90":o=n&&i?"Y":n?o:"";break;case"-270":l*=-1,o=n&&i?"X":i?o:"";break;default:o=""}t%180==0&&(e.style.maxWidth=""),e.style.transform="rotate("+t+"deg)"+(n?" rotateX("+n+"deg)":"")+(i?" rotateY("+i+"deg)":"")+(o?" translate"+o+"("+l+"px)":"")},setCaptionPosition:function(e){const t=this.util.getChildElement(this.util.getParentElement(e,"FIGURE"),"FIGCAPTION");t&&(t.style.marginTop=(this.context.resizing._rotateVertical?e.offsetWidth-e.offsetHeight:0)+"px")},onMouseDown_resize_handle:function(e){e.stopPropagation(),e.preventDefault();const t=this.context.resizing,n=t._resize_direction=e.target.classList[0];t._resizeClientX=e.clientX,t._resizeClientY=e.clientY,this.context.element.resizeBackground.style.display="block",t.resizeButton.style.display="none",t.resizeDiv.style.float=/l/.test(n)?"right":/r/.test(n)?"left":"none";const i=function(e){if("keydown"===e.type&&27!==e.keyCode)return;const o=t._isChange;t._isChange=!1,this.removeDocEvent("mousemove",l),this.removeDocEvent("mouseup",i),this.removeDocEvent("keydown",i),"keydown"===e.type?(this.controllersOff(),this.context.element.resizeBackground.style.display="none",this.plugins[this.context.resizing._resize_plugin].init.call(this)):(this.plugins.resizing.cancel_controller_resize.call(this,n),o&&this.history.push(!1))}.bind(this),l=this.plugins.resizing.resizing_element.bind(this,t,n,this.context[t._resize_plugin]);this.addDocEvent("mousemove",l),this.addDocEvent("mouseup",i),this.addDocEvent("keydown",i)},resizing_element:function(e,t,n,i){const l=i.clientX,o=i.clientY;let s=n._element_w,a=n._element_h;const r=n._element_w+(/r/.test(t)?l-e._resizeClientX:e._resizeClientX-l),c=n._element_h+(/b/.test(t)?o-e._resizeClientY:e._resizeClientY-o),d=n._element_h/n._element_w*r;/t/.test(t)&&(e.resizeDiv.style.top=n._element_h-(/h/.test(t)?c:d)+"px"),/l/.test(t)&&(e.resizeDiv.style.left=n._element_w-r+"px"),/r|l/.test(t)&&(e.resizeDiv.style.width=r+"px",s=r),/^(t|b)[^h]$/.test(t)?(e.resizeDiv.style.height=d+"px",a=d):/^(t|b)h$/.test(t)&&(e.resizeDiv.style.height=c+"px",a=c),e._resize_w=s,e._resize_h=a,this.util.changeTxt(e.resizeDisplay,this._w.Math.round(s)+" x "+this._w.Math.round(a)),e._isChange=!0},cancel_controller_resize:function(e){const t=this.context.resizing._rotateVertical;this.controllersOff(),this.context.element.resizeBackground.style.display="none";let n=this._w.Math.round(t?this.context.resizing._resize_h:this.context.resizing._resize_w),i=this._w.Math.round(t?this.context.resizing._resize_w:this.context.resizing._resize_h);if(!t&&!/%$/.test(n)){const e=16,t=this.context.element.wysiwygFrame.clientWidth-2*e-2;this.util.getNumber(n,0)>t&&(i=this._w.Math.round(i/n*t),n=t)}const l=this.context.resizing._resize_plugin;this.plugins[l].setSize.call(this,n,i,!1,e),this.selectComponent(this.context[l]._element,l)}};return void 0===t&&(e.SUNEDITOR_MODULES||Object.defineProperty(e,"SUNEDITOR_MODULES",{enumerable:!0,writable:!1,configurable:!1,value:{}}),Object.defineProperty(e.SUNEDITOR_MODULES,"resizing",{enumerable:!0,writable:!1,configurable:!1,value:n})),n},"object"==typeof e.exports?e.exports=i.document?l(i,!0):function(e){if(!e.document)throw new Error("SUNEDITOR_MODULES a window with a document");return l(e)}:l(i)},"gjS+":function(e,t,n){"use strict";var i,l;i="undefined"!=typeof window?window:this,l=function(e,t){const n={name:"fileManager",_xmlHttp:null,upload:function(e,t,n,i,l){this.showLoading();const o=this.plugins.fileManager,s=o._xmlHttp=this.util.getXMLHttpRequest();if(s.onreadystatechange=o._callBackUpload.bind(this,s,i,l),s.open("post",e,!0),null!==t&&"object"==typeof t&&this._w.Object.keys(t).length>0)for(let e in t)s.setRequestHeader(e,t[e]);s.send(n)},_callBackUpload:function(e,t,n){if(4===e.readyState)if(200===e.status)try{t(e)}catch(e){throw Error('[SUNEDITOR.fileManager.upload.callBack.fail] cause : "'+e.message+'"')}finally{this.closeLoading()}else{this.closeLoading();const t=e.responseText?JSON.parse(e.responseText):e;if("function"!=typeof n||n("",t,this)){const n="[SUNEDITOR.fileManager.upload.serverException] status: "+e.status+", response: "+(t.errorMessage||e.responseText);throw this.functions.noticeOpen(n),Error(n)}}},checkInfo:function(e,t,n,i,l){let o=[];for(let e=0,n=t.length;e-1||(a.splice(t,1),"function"==typeof n&&n(null,e,"delete",null,0,this),t--);l&&(this.context.resizing._resize_plugin=c)},setInfo:function(e,t,n,i,l){const o=l?this.context.resizing._resize_plugin:"";l&&(this.context.resizing._resize_plugin=e);const s=this.plugins[e],a=this.context[e],r=a._infoList;let c=t.getAttribute("data-index"),d=null,u="";if(i||(i={name:t.getAttribute("data-file-name")||("string"==typeof t.src?t.src.split("/").pop():""),size:t.getAttribute("data-file-size")||0}),!c||this._componentsInfoInit)u="create",c=a._infoIndex++,t.setAttribute("data-index",c),t.setAttribute("data-file-name",i.name),t.setAttribute("data-file-size",i.size),d={src:t.src,index:1*c,name:i.name,size:i.size},r.push(d);else{u="update",c*=1;for(let e=0,t=r.length;e=0){const i=this.context[e]._infoList;for(let e=0,l=i.length;e Date: Thu, 8 Oct 2020 14:14:59 +1100 Subject: [PATCH 13/38] reset items --- src/plugins/dialog/mention.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/dialog/mention.js b/src/plugins/dialog/mention.js index f93a423da..2838d792f 100644 --- a/src/plugins/dialog/mention.js +++ b/src/plugins/dialog/mention.js @@ -102,6 +102,7 @@ export default { const { mention } = this.context; mention.search.value = ""; mention.focussed = 0; + mention.items = []; }, onKeyPress: function(e) { From af4c615fe43775f30e8c76204dae039292fb352d Mon Sep 17 00:00:00 2001 From: NickyTope Date: Thu, 8 Oct 2020 14:15:10 +1100 Subject: [PATCH 14/38] mention item use min-height --- src/assets/css/suneditor.css | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/assets/css/suneditor.css b/src/assets/css/suneditor.css index 5dc2a5384..2ca207392 100755 --- a/src/assets/css/suneditor.css +++ b/src/assets/css/suneditor.css @@ -321,8 +321,8 @@ .sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-math-preview > span {display:inline-block; -webkit-box-shadow:0 0 0 0.1rem #c7deff; box-shadow:0 0 0 0.1rem #c7deff;} /* dialog - modal - se-link-preview */ .sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-link-preview {display:block; height:auto; max-height:18px; margin:4px 0 0 4px; font-size:13px; font-weight:normal; font-family:inherit; color:#666; background-color:transparent; overflow:hidden; text-overflow:ellipsis; word-break:break-all; white-space:pre;} -.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-mention-item {line-height:28px;height:25px;padding:0 5px;} -.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-mention-item.se-mention-active {background-color: #ccc; border-radius:3px;} +.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-mention-item {line-height:28px;min-height:25px;padding:0 5px;} +.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-mention-item.se-mention-active {background-color: #d1d1d1; border-radius:3px;} .sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-mention-search {margin-bottom: 10px;} /** --- controller ---------------------------------------------------------- */ From 124959983601033deaf40d205f2ed003a792a11e Mon Sep 17 00:00:00 2001 From: NickyTope Date: Thu, 8 Oct 2020 14:22:22 +1100 Subject: [PATCH 15/38] rebuild --- dist/css/suneditor.min.css | 2 +- dist/suneditor.min.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dist/css/suneditor.min.css b/dist/css/suneditor.min.css index eaf9c8117..5a912becb 100644 --- a/dist/css/suneditor.min.css +++ b/dist/css/suneditor.min.css @@ -1 +1 @@ -.sun-editor{width:auto;height:auto;box-sizing:border-box;font-family:Helvetica Neue,sans-serif;border:1px solid #dadada;text-align:left;background-color:#fff;color:#000;user-select:none;-o-user-select:none;-moz-user-select:none;-khtml-user-select:none;-webkit-user-select:none;-ms-user-select:none}.sun-editor *{box-sizing:border-box;-webkit-user-drag:none;overflow:visible}.sun-editor-common button,.sun-editor-common input,.sun-editor-common select,.sun-editor-common textarea{font-size:14px;line-height:1.5}.sun-editor-common blockquote,.sun-editor-common body,.sun-editor-common button,.sun-editor-common code,.sun-editor-common dd,.sun-editor-common div,.sun-editor-common dl,.sun-editor-common dt,.sun-editor-common fieldset,.sun-editor-common form,.sun-editor-common h1,.sun-editor-common h2,.sun-editor-common h3,.sun-editor-common h4,.sun-editor-common h5,.sun-editor-common h6,.sun-editor-common input,.sun-editor-common legend,.sun-editor-common li,.sun-editor-common ol,.sun-editor-common p,.sun-editor-common pre,.sun-editor-common select,.sun-editor-common td,.sun-editor-common textarea,.sun-editor-common th,.sun-editor-common ul{margin:0;padding:0;border:0}.sun-editor-common dl,.sun-editor-common li,.sun-editor-common menu,.sun-editor-common ol,.sun-editor-common ul{list-style:none!important}.sun-editor-common hr{margin:6px 0!important}.sun-editor textarea{resize:none;border:0;padding:0}.sun-editor button{border:0;background-color:transparent;touch-action:manipulation;cursor:pointer;outline:none}.sun-editor button,.sun-editor input,.sun-editor select,.sun-editor textarea{vertical-align:middle}.sun-editor button span{display:block;margin:0;padding:0}.sun-editor button .txt{display:block;margin-top:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.sun-editor button *{pointer-events:none;backface-visibility:hidden;-webkit-backface-visibility:hidden;-moz-backface-visibility:hidden}.sun-editor .se-svg,.sun-editor button>svg{width:16px;height:16px;margin:auto;fill:currentColor;display:block;text-align:center;float:none}.sun-editor .close>svg,.sun-editor .se-dialog-close>svg{width:10px;height:10px}.sun-editor .se-btn-select>svg{float:right;width:10px;height:10px}.sun-editor .se-btn-list>.se-list-icon{display:inline-block;width:16px;height:16px;margin:-1px 10px 0 0;vertical-align:middle}.sun-editor .se-line-breaker>button>svg{width:24px;height:24px}.sun-editor button>i:before{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;display:inline-block;font-style:normal;font-variant:normal;text-rendering:auto;font-size:15px;line-height:2}.sun-editor button>[class=se-icon-text]{font-size:20px;line-height:1}.sun-editor .se-arrow,.sun-editor .se-arrow:after{position:absolute;display:block;width:0;height:0;border:11px solid transparent}.sun-editor .se-arrow.se-arrow-up{top:-11px;left:20px;margin-left:-11px;border-top-width:0;border-bottom-color:rgba(0,0,0,.25)}.sun-editor .se-arrow.se-arrow-up:after{top:1px;margin-left:-11px;content:" ";border-top-width:0;border-bottom-color:#fff}.sun-editor .se-toolbar .se-arrow.se-arrow-up:after{border-bottom-color:#fafafa}.sun-editor .se-arrow.se-arrow-down{top:0;left:0;margin-left:-11px;border-bottom-width:0;border-top-color:rgba(0,0,0,.25)}.sun-editor .se-arrow.se-arrow-down:after{top:-12px;margin-left:-11px;content:" ";border-bottom-width:0;border-top-color:#fff}.sun-editor .se-toolbar .se-arrow.se-arrow-down:after{border-top-color:#fafafa}.sun-editor .se-container{position:relative;width:100%;height:100%}.sun-editor button{color:#000}.sun-editor .se-btn{float:left;width:34px;height:34px;border:0;border-radius:4px;margin:1px!important;padding:0;font-size:12px;line-height:27px}.sun-editor .se-btn:enabled:focus,.sun-editor .se-btn:enabled:hover{background-color:#e1e1e1;border-color:#d1d1d1;outline:0 none}.sun-editor .se-btn:enabled:active{background-color:#d1d1d1;border-color:#c1c1c1;-webkit-box-shadow:inset 0 3px 5px #c1c1c1;box-shadow:inset 0 3px 5px #c1c1c1}.sun-editor .se-btn-primary{color:#000;background-color:#c7deff;border:1px solid #80bdff;border-radius:4px}.sun-editor .se-btn-primary:focus,.sun-editor .se-btn-primary:hover{color:#000;background-color:#80bdff;border-color:#3f9dff;outline:0 none}.sun-editor .se-btn-primary:active{color:#fff;background-color:#3f9dff;border-color:#4592ff;-webkit-box-shadow:inset 0 3px 5px #4592ff;box-shadow:inset 0 3px 5px #4592ff}.sun-editor input,.sun-editor select,.sun-editor textarea{color:#000;border:1px solid #ccc;border-radius:4px}.sun-editor input:focus,.sun-editor select:focus,.sun-editor textarea:focus{border:1px solid #80bdff;outline:0;-webkit-box-shadow:0 0 0 .2rem #c7deff;box-shadow:0 0 0 .2rem #c7deff;transition:border-color .15s ease-in-out,box-shadow .15s ease-in-out}.sun-editor .se-btn:enabled.active{color:#4592ff;outline:0 none}.sun-editor .se-btn:enabled.active:focus,.sun-editor .se-btn:enabled.active:hover{background-color:#e1e1e1;border-color:#d1d1d1;outline:0 none}.sun-editor .se-btn:enabled.active:active{background-color:#d1d1d1;border-color:#c1c1c1;-webkit-box-shadow:inset 0 3px 5px #c1c1c1;box-shadow:inset 0 3px 5px #c1c1c1}.sun-editor .se-btn:enabled.on{background-color:#e1e1e1;border-color:#d1d1d1;outline:0 none}.sun-editor .se-btn:enabled.on:focus,.sun-editor .se-btn:enabled.on:hover{background-color:#d1d1d1;border-color:#c1c1c1;outline:0 none}.sun-editor .se-btn:enabled.on:active{background-color:#c1c1c1;border-color:#b1b1b1;-webkit-box-shadow:inset 0 3px 5px #b1b1b1;box-shadow:inset 0 3px 5px #b1b1b1}.sun-editor .se-btn-list:disabled,.sun-editor .se-btn:disabled,.sun-editor button:disabled{cursor:not-allowed;background-color:inherit;color:#bdbdbd}.sun-editor .se-loading-box{position:absolute;display:none;width:100%;height:100%;top:0;left:0;background-color:#fff;opacity:.7;filter:alpha(opacity=70);z-index:2147483647}.sun-editor .se-loading-box .se-loading-effect{position:absolute;display:block;top:50%;left:50%;height:25px;width:25px;border-top:2px solid #07d;border-right:2px solid transparent;border-radius:50%;animation:spinner .8s linear infinite;margin:-25px 0 0 -25px}.sun-editor .se-line-breaker{position:absolute;display:none;width:100%;height:1px;cursor:text;border-top:1px solid #3288ff;z-index:7}.sun-editor .se-line-breaker>button.se-btn{position:relative;display:inline-block;width:30px;height:30px;top:-15px;float:none;left:-50%;background-color:#fff;border:1px solid #0c2240;opacity:.6;cursor:pointer}.sun-editor .se-line-breaker>button.se-btn:hover{opacity:.9;background-color:#fff;border-color:#041b39}.sun-editor .se-line-breaker-component{position:absolute;display:none;width:24px;height:24px;background-color:#fff;border:1px solid #0c2240;opacity:.6;border-radius:4px;cursor:pointer;z-index:7}.sun-editor .se-line-breaker-component:hover{opacity:.9}.sun-editor .se-toolbar{display:block;position:relative;height:auto;width:100%;overflow:visible;padding:4px 3px 0;margin:0;background-color:#fafafa;outline:1px solid #dadada;z-index:5}.sun-editor .se-toolbar-cover{position:absolute;display:none;font-size:36px;width:100%;height:100%;top:0;left:0;background-color:#fefefe;opacity:.5;filter:alpha(opacity=50);cursor:not-allowed;z-index:4}.sun-editor .se-toolbar-separator-vertical{display:inline-block;height:0;width:0;margin:1px;vertical-align:top}.sun-editor .se-toolbar.se-toolbar-balloon,.sun-editor .se-toolbar.se-toolbar-inline{display:none;position:absolute;z-index:2147483647;box-shadow:0 3px 9px rgba(0,0,0,.5);-webkit-box-shadow:0 3px 9px rgba(0,0,0,.5)}.sun-editor .se-toolbar.se-toolbar-balloon{width:auto}.sun-editor .se-toolbar.se-toolbar-sticky{position:fixed;top:0}.sun-editor .se-toolbar-sticky-dummy{display:none;position:static;z-index:-1}.sun-editor .se-btn-module{display:inline-block}.sun-editor .se-btn-module-border{border:1px solid #dadada;border-radius:4px}.sun-editor .se-btn-module-enter{display:block;width:100%;height:1px;margin-bottom:5px;background-color:transparent}.sun-editor .se-toolbar-more-layer{margin:0 -3px;background-color:#f3f3f3}.sun-editor .se-toolbar-more-layer .se-more-layer{display:none;border-top:1px solid #dadada}.sun-editor .se-toolbar-more-layer .se-more-layer .se-more-form{display:inline-block;width:100%;height:auto;padding:4px 3px 0}.sun-editor .se-btn-module .se-btn-more.se-btn-more-text{width:auto;padding:0 4px}.sun-editor .se-btn-module .se-btn-more:focus,.sun-editor .se-btn-module .se-btn-more:hover{color:#000;background-color:#d1d1d1;border-color:#c1c1c1;outline:0 none}.sun-editor .se-btn-module .se-btn-more.on{color:#333;background-color:#d1d1d1;border-color:#c1c1c1;outline:0 none}.sun-editor .se-btn-module .se-btn-more.on:hover{color:#000;background-color:#c1c1c1;border-color:#b1b1b1;outline:0 none}.sun-editor .se-menu-list,.sun-editor .se-menu-list li{float:left;padding:0;margin:0}.sun-editor .se-menu-list li{position:relative}.sun-editor .se-btn-select{width:auto;display:flex;text-align:left;padding:4px 6px}.sun-editor .se-btn-select .txt{flex:auto;float:left;text-align:left}.sun-editor .se-btn-select.se-btn-tool-font{width:100px}.sun-editor .se-btn-select.se-btn-tool-format,.sun-editor .se-btn-select.se-btn-tool-size{width:80px}.sun-editor .se-btn-tray{position:relative;width:100%;height:100%;margin:0;padding:0}.sun-editor .se-menu-tray{position:absolute;top:0;left:0;width:100%;height:0}.sun-editor .se-submenu{overflow-x:hidden;overflow-y:auto}.sun-editor .se-list-layer{display:none;position:absolute;top:0;left:0;height:auto;z-index:5;border:1px solid #bababa;border-radius:4px;padding:6px 0;background-color:#fff;-webkit-box-shadow:0 3px 9px rgba(0,0,0,.5);box-shadow:0 3px 9px rgba(0,0,0,.5);outline:0 none}.sun-editor .se-list-layer .se-list-inner{padding:0;margin:0;overflow-x:initial;overflow-y:initial;overflow:visible}.sun-editor .se-list-layer button{margin:0;width:100%}.sun-editor .se-list-inner .se-list-basic{width:100%;padding:0}.sun-editor .se-list-inner .se-list-basic li{width:100%}.sun-editor .se-list-inner .se-list-basic li>button{min-width:100%;width:max-content}.sun-editor .se-list-inner .se-list-basic li button.active{background-color:#80bdff;border:1px solid #3f9dff;border-left:0;border-right:0}.sun-editor .se-list-inner .se-list-basic li button.active:hover{background-color:#3f9dff;border:1px solid #4592ff;border-left:0;border-right:0}.sun-editor .se-list-inner .se-list-basic li button.active:active{background-color:#4592ff;border:1px solid #407dd1;border-left:0;border-right:0;-webkit-box-shadow:inset 0 3px 5px #407dd1;box-shadow:inset 0 3px 5px #407dd1}.sun-editor .se-btn-list{width:100%;height:auto;min-height:32px;padding:0 14px;cursor:pointer;font-size:12px;line-height:normal;text-indent:0;text-decoration:none;text-align:left}.sun-editor .se-btn-list.default_value{background-color:#f3f3f3;border-top:1px dotted #b1b1b1;border-bottom:1px dotted #b1b1b1}.sun-editor .se-btn-list:focus,.sun-editor .se-btn-list:hover{background-color:#e1e1e1;border-color:#d1d1d1;outline:0 none}.sun-editor .se-btn-list:active{background-color:#d1d1d1;border-color:#c1c1c1;-webkit-box-shadow:inset 0 3px 5px #c1c1c1;box-shadow:inset 0 3px 5px #c1c1c1}.sun-editor .se-list-layer.se-list-font-size{min-width:140px;max-height:300px}.sun-editor .se-list-layer.se-list-font-family{min-width:156px}.sun-editor .se-list-layer.se-list-font-family .default{border-bottom:1px solid #ccc}.sun-editor .se-list-layer.se-list-line{width:125px}.sun-editor .se-list-layer.se-list-align .se-list-inner{left:9px;width:125px}.sun-editor .se-list-layer.se-list-format{min-width:156px}.sun-editor .se-list-layer.se-list-format li{padding:0;width:100%}.sun-editor .se-list-layer.se-list-format ul .se-btn-list{line-height:100%}.sun-editor .se-list-layer.se-list-format ul .se-btn-list[data-value=h1]{height:40px}.sun-editor .se-list-layer.se-list-format ul .se-btn-list[data-value=h2]{height:34px}.sun-editor .se-list-layer.se-list-format ul p{font-size:13px}.sun-editor .se-list-layer.se-list-format ul div{font-size:13px;padding:4px 2px}.sun-editor .se-list-layer.se-list-format ul h1{font-size:2em;font-weight:700;color:#333}.sun-editor .se-list-layer.se-list-format ul h2{font-size:1.5em;font-weight:700;color:#333}.sun-editor .se-list-layer.se-list-format ul h3{font-size:1.17em;font-weight:700;color:#333}.sun-editor .se-list-layer.se-list-format ul h4{font-size:1em;font-weight:700;color:#333}.sun-editor .se-list-layer.se-list-format ul h5{font-size:.83em;font-weight:700;color:#333}.sun-editor .se-list-layer.se-list-format ul h6{font-size:.67em;font-weight:700;color:#333}.sun-editor .se-list-layer.se-list-format ul blockquote{font-size:13px;color:#999;height:22px;margin:0;background-color:transparent;line-height:1.5;border-color:#b1b1b1;padding:0 0 0 7px;border-left:5px #b1b1b1;border-style:solid}.sun-editor .se-list-layer.se-list-format ul pre{font-size:13px;color:#666;padding:4px 11px;margin:0;background-color:#f9f9f9;border:1px solid #e1e1e1;border-radius:4px}.sun-editor .se-selector-table{display:none;position:absolute;top:34px;left:1px;z-index:5;padding:5px 0;float:left;margin:2px 0 0;font-size:14px;text-align:left;list-style:none;background-color:#fff;-webkit-background-clip:padding-box;background-clip:padding-box;border:1px solid #ccc;border-radius:4px;-webkit-box-shadow:0 6px 12px rgba(0,0,0,.175);box-shadow:0 6px 12px rgba(0,0,0,.175)}.sun-editor .se-selector-table .se-table-size{font-size:18px;padding:0 5px}.sun-editor .se-selector-table .se-table-size-picker{position:absolute!important;z-index:3;font-size:18px;width:10em;height:10em;cursor:pointer}.sun-editor .se-selector-table .se-table-size-highlighted{position:absolute!important;z-index:2;font-size:18px;width:1em;height:1em;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAAZdEVYdFNvZnR3YXJlAEFkb2JlIEltYWdlUmVhZHlxyWU8AAADJmlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNS42LWMxNDIgNzkuMTYwOTI0LCAyMDE3LzA3LzEzLTAxOjA2OjM5ICAgICAgICAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPiA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDo4QTZCNzMzN0I3RUYxMUU4ODcwQ0QwMjM1NTgzRTJDNyIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDo4QTZCNzMzNkI3RUYxMUU4ODcwQ0QwMjM1NTgzRTJDNyIgeG1wOkNyZWF0b3JUb29sPSJBZG9iZSBQaG90b3Nob3AgQ0MgMjAxOCAoV2luZG93cykiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDo0MzYyNEUxRUI3RUUxMUU4ODZGQzgwRjNBODgyNTdFOSIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDo0MzYyNEUxRkI3RUUxMUU4ODZGQzgwRjNBODgyNTdFOSIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/Pl0yAuwAAABBSURBVDhPY/wPBAxUAGCDGvdBeWSAeicIDTfIXREiQArYeR9hEBOEohyMGkQYjBpEGAxjg6ib+yFMygCVvMbAAABj0hwMTNeKJwAAAABJRU5ErkJggg==") repeat}.sun-editor .se-selector-table .se-table-size-unhighlighted{position:relative!important;z-index:1;font-size:18px;width:10em;height:10em;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASAgMAAAAroGbEAAAACVBMVEUAAIj4+Pjp6ekKlAqjAAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAACxMAAAsTAQCanBgAAAAHdElNRQfYAR0BKhmnaJzPAAAAG0lEQVQI12NgAAOtVatWMTCohoaGUY+EmIkEAEruEzK2J7tvAAAAAElFTkSuQmCC") repeat}.sun-editor .se-selector-table .se-table-size-display{padding-left:5px}.sun-editor .se-list-layer .se-selector-color{display:flex;width:max-content;max-width:270px;height:auto;padding:0;margin:auto}.sun-editor .se-list-layer .se-selector-color .se-color-pallet{width:100%;height:100%;padding:0}.sun-editor .se-list-layer .se-selector-color .se-color-pallet li{display:flex;float:left;position:relative;margin:0}.sun-editor .se-list-layer .se-selector-color .se-color-pallet button{display:block;cursor:default;width:30px;height:30px;text-indent:-9999px}.sun-editor .se-list-layer .se-selector-color .se-color-pallet button.active,.sun-editor .se-list-layer .se-selector-color .se-color-pallet button:focus,.sun-editor .se-list-layer .se-selector-color .se-color-pallet button:hover{border:3px solid #fff}.sun-editor .se-submenu-form-group{display:flex;width:100%;height:auto;padding:4px}.sun-editor .se-submenu-form-group input{flex:auto;display:inline-block;width:auto;height:33px;color:#555;font-size:12px;margin:1px 0;padding:0;border-radius:.25rem;border:1px solid #ccc}.sun-editor .se-submenu-form-group button{float:right;width:34px;height:34px;margin:0 0 0 4px!important}.sun-editor .se-submenu-form-group button.se-btn{border:1px solid #ccc}.sun-editor .se-submenu-form-group>div{position:relative}.sun-editor .se-submenu-form-group .se-color-input{width:72px;text-transform:uppercase;border:none;border-bottom:2px solid #b1b1b1;outline:none}.sun-editor .se-submenu-form-group .se-color-input:focus{border-bottom:3px solid #b1b1b1}.sun-editor .se-wrapper{position:relative!important;width:100%;height:auto;overflow:hidden;z-index:1}.sun-editor .se-wrapper .se-wrapper-inner{width:100%;height:100%;min-height:65px;overflow-y:auto;overflow-x:auto;-webkit-overflow-scrolling:touch;user-select:text;-o-user-select:text;-moz-user-select:text;-khtml-user-select:text;-webkit-user-select:text;-ms-user-select:text}.sun-editor .se-wrapper .se-wrapper-inner:focus{outline:none}.sun-editor .se-wrapper .se-wrapper-code{background-color:#191919;color:#fff;font-size:13px;word-break:break-all;padding:4px;margin:0;resize:none!important}.sun-editor .se-wrapper .se-wrapper-wysiwyg{background-color:#fff;display:block}.sun-editor .se-wrapper .se-wrapper-code-mirror{font-size:13px}.sun-editor .se-wrapper .se-placeholder{position:absolute;display:none;white-space:nowrap;text-overflow:ellipsis;z-index:1;color:#b1b1b1;font-size:13px;line-height:1.5;top:0;left:0;right:0;overflow:hidden;margin-top:0;padding-top:16px;padding-left:16px;margin-left:0;padding-right:16px;margin-right:0;pointer-events:none;backface-visibility:hidden;-webkit-backface-visibility:hidden;-moz-backface-visibility:hidden}.sun-editor .se-resizing-bar{display:flex;width:auto;height:auto;min-height:16px;border-top:1px solid #dadada;padding:0 4px;background-color:#fafafa;cursor:ns-resize}.sun-editor .se-resizing-bar.se-resizing-none{cursor:default}.sun-editor .se-resizing-back{position:absolute;display:none;cursor:default;top:0;left:0;width:100%;height:100%;z-index:2147483647}.sun-editor .se-resizing-bar .se-navigation{flex:auto;position:relative;width:auto;height:auto;color:#666;margin:0;padding:0;font-size:10px;font-weight:700;line-height:1.5;background:transparent}.sun-editor .se-resizing-bar .se-char-counter-wrapper{flex:none;position:relative;display:block;width:auto;height:auto;margin:0;padding:0;color:#999;font-size:13px;background:transparent}.sun-editor .se-resizing-bar .se-char-counter-wrapper.se-blink{color:#b94a48;animation:blinker .2s linear infinite}.sun-editor .se-resizing-bar .se-char-counter-wrapper .se-char-label{margin-right:4px}.sun-editor .se-dialog{position:absolute;display:none;top:0;left:0;width:100%;height:100%;z-index:2147483647}.sun-editor .se-dialog button,.sun-editor .se-dialog input,.sun-editor .se-dialog label{font-size:14px;line-height:1.5;color:#111;margin:0}.sun-editor .se-dialog .se-dialog-back{background-color:#222;opacity:.5}.sun-editor .se-dialog .se-dialog-back,.sun-editor .se-dialog .se-dialog-inner{position:absolute;width:100%;height:100%;top:0;left:0}.sun-editor .se-dialog .se-dialog-inner .se-dialog-content{position:relative;width:auto;max-width:500px;margin:20px auto;background-color:#fff;-webkit-background-clip:padding-box;background-clip:padding-box;border:1px solid rgba(0,0,0,.2);border-radius:4px;outline:0;-webkit-box-shadow:0 3px 9px rgba(0,0,0,.5);box-shadow:0 3px 9px rgba(0,0,0,.5)}@media screen and (max-width:509px){.sun-editor .se-dialog .se-dialog-inner .se-dialog-content{width:100%}}.sun-editor .se-dialog .se-dialog-inner .se-dialog-content label{display:inline-block;max-width:100%;margin-bottom:5px;font-weight:700}.sun-editor .se-dialog .se-dialog-inner .se-dialog-content .se-btn-primary{display:inline-block;padding:6px 12px;margin:0 0 10px!important;font-size:14px;font-weight:400;line-height:1.42857143;text-align:center;white-space:nowrap;vertical-align:middle;-ms-touch-action:manipulation;touch-action:manipulation;border-radius:4px}.sun-editor .se-dialog .se-dialog-inner .se-dialog-header{height:50px;padding:6px 15px;border-bottom:1px solid #e5e5e5}.sun-editor .se-dialog .se-dialog-inner .se-dialog-header .se-dialog-close{float:right;font-weight:700;text-shadow:0 1px 0 #fff;-webkit-appearance:none;filter:alpha(opacity=100);opacity:1}.sun-editor .se-dialog .se-dialog-inner .se-dialog-header .se-modal-title{font-size:14px;font-weight:700;margin:0;padding:0;line-height:2.5}.sun-editor .se-dialog .se-dialog-inner .se-dialog-body{position:relative;padding:15px}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form{margin-bottom:10px}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form-footer{margin-top:10px;margin-bottom:0}.sun-editor .se-dialog .se-dialog-inner input:disabled{background-color:#f3f3f3}.sun-editor .se-dialog .se-dialog-inner .se-dialog-size-text{width:100%}.sun-editor .se-dialog .se-dialog-inner .se-dialog-size-text .size-h,.sun-editor .se-dialog .se-dialog-inner .se-dialog-size-text .size-w{width:70px;text-align:center}.sun-editor .se-dialog .se-dialog-inner .se-dialog-size-x{margin:0 8px;width:25px;text-align:center}.sun-editor .se-dialog .se-dialog-inner .se-dialog-footer{padding:10px 15px 0;text-align:right;border-top:1px solid #e5e5e5}.sun-editor .se-dialog .se-dialog-inner .se-dialog-footer>div{float:left}.sun-editor .se-dialog .se-dialog-inner .se-dialog-footer>div>label{margin-top:5px}.sun-editor .se-dialog .se-dialog-inner .se-dialog-btn-radio{margin-left:12px;margin-right:6px}.sun-editor .se-dialog .se-dialog-inner .se-dialog-btn-check{margin-left:12px;margin-right:4px}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form-footer .se-dialog-btn-check{margin-left:0;margin-right:4px}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-dialog-form-files{position:relative;display:flex;align-items:center}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-dialog-form-files>input{flex:auto}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-dialog-form-files .se-dialog-files-edge-button{flex:auto;opacity:.8;border:1px solid #ccc}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-dialog-form-files .se-dialog-files-edge-button.se-file-remove>svg{width:8px;height:8px}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-dialog-form-files .se-dialog-files-edge-button:hover{background-color:#f0f0f0;outline:0 none}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-dialog-form-files .se-dialog-files-edge-button:active{background-color:#e9e9e9;-webkit-box-shadow:inset 0 3px 5px #d6d6d6;box-shadow:inset 0 3px 5px #d6d6d6}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-input-select{display:inline-block;width:auto;height:34px;font-size:14px;text-align:center;line-height:1.42857143}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-input-control{display:inline-block;width:70px;height:34px;font-size:14px;text-align:center;line-height:1.42857143}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-input-form{display:block;width:100%;height:34px;font-size:14px;line-height:1.42857143;padding:0 4px}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-input-form.se-input-url:disabled{text-decoration:line-through;color:#999}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-video-ratio{width:70px;margin-left:4px}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form a{color:#004cff}.sun-editor .se-dialog .se-dialog-inner .se-dialog-btn-revert{border:1px solid #ccc}.sun-editor .se-dialog .se-dialog-inner .se-dialog-btn-revert:hover{background-color:#e1e1e1;border-color:#d1d1d1;outline:0 none}.sun-editor .se-dialog .se-dialog-inner .se-dialog-btn-revert:active{background-color:#d1d1d1;border-color:#c1c1c1;-webkit-box-shadow:inset 0 3px 5px #c1c1c1;box-shadow:inset 0 3px 5px #c1c1c1}.sun-editor .se-dialog-tabs{width:100%;height:25px;border-bottom:1px solid #e5e5e5}.sun-editor .se-dialog-tabs button{background-color:#e5e5e5;border-right:1px solid #e5e5e5;float:left;outline:none;padding:2px 13px;transition:.3s}.sun-editor .se-dialog-tabs button:hover{background-color:#fff}.sun-editor .se-dialog-tabs button.active{background-color:#fff;border-bottom:0}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-input-form.se-math-exp{resize:vertical;height:4rem;border:1px solid #ccc;font-size:13px;padding:4px}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-input-select.se-math-size{width:6em;height:28px;margin-left:1em}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-math-preview{font-size:13px}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-math-preview>span{display:inline-block;-webkit-box-shadow:0 0 0 .1rem #c7deff;box-shadow:0 0 0 .1rem #c7deff}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-link-preview{display:block;height:auto;max-height:18px;margin:4px 0 0 4px;font-size:13px;font-weight:400;font-family:inherit;color:#666;background-color:transparent;overflow:hidden;text-overflow:ellipsis;word-break:break-all;white-space:pre}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-mention-item{line-height:28px;height:25px;padding:0 5px}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-mention-item.se-mention-active{background-color:#ccc;border-radius:3px}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-mention-search{margin-bottom:10px}.sun-editor .se-controller .se-arrow.se-arrow-up{border-bottom-color:rgba(0,0,0,.25)}.sun-editor .se-controller{position:absolute;display:none;overflow:visible;z-index:6;border:1px solid rgba(0,0,0,.25);border-radius:4px;text-align:start;text-decoration:none;text-shadow:none;text-transform:none;letter-spacing:normal;word-break:normal;word-spacing:normal;word-wrap:normal;white-space:normal;background-color:#fff;-webkit-background-clip:padding-box;background-clip:padding-box;-webkit-box-shadow:0 5px 10px rgba(0,0,0,.2);box-shadow:0 5px 10px rgba(0,0,0,.2);line-break:auto}.sun-editor .se-controller .se-btn-group{position:relative;display:flex;vertical-align:middle;padding:2px;top:0;left:0}.sun-editor .se-controller .se-btn-group .se-btn-group-sub{left:50%;min-width:auto;width:max-content;display:none}.sun-editor .se-controller .se-btn-group .se-btn-group-sub button{margin:0;min-width:72px}.sun-editor .se-controller .se-btn-group button{position:relative;min-height:34px;height:auto;border:none;border-radius:4px;margin:1px;padding:5px 10px;font-size:12px;line-height:1.5;display:inline-block;font-weight:400;text-align:center;white-space:nowrap;vertical-align:middle;-ms-touch-action:manipulation;touch-action:manipulation}.sun-editor .se-controller .se-btn-group button:focus:enabled,.sun-editor .se-controller .se-btn-group button:hover:enabled{background-color:#e1e1e1;border-color:#d1d1d1;outline:0 none}.sun-editor .se-controller .se-btn-group button:active:enabled{background-color:#d1d1d1;border-color:#c1c1c1;-webkit-box-shadow:inset 0 3px 5px #c1c1c1;box-shadow:inset 0 3px 5px #c1c1c1}.sun-editor .se-controller .se-btn-group button span{display:block;padding:0;margin:0}.sun-editor .se-controller .se-btn-group button:enabled.active{color:#4592ff;outline:0 none}.sun-editor .se-controller .se-btn-group button:enabled.active:focus,.sun-editor .se-controller .se-btn-group button:enabled.active:hover{background-color:#e1e1e1;border-color:#d1d1d1;outline:0 none}.sun-editor .se-controller .se-btn-group button:enabled.active:active{background-color:#d1d1d1;border-color:#c1c1c1;-webkit-box-shadow:inset 0 3px 5px #c1c1c1;box-shadow:inset 0 3px 5px #c1c1c1}.sun-editor .se-controller .se-btn-group button:enabled.on{background-color:#e1e1e1;border-color:#d1d1d1;outline:0 none}.sun-editor .se-controller .se-btn-group button:enabled.on:focus,.sun-editor .se-controller .se-btn-group button:enabled.on:hover{background-color:#d1d1d1;border-color:#c1c1c1;outline:0 none}.sun-editor .se-controller .se-btn-group button:enabled.on:active{background-color:#c1c1c1;border-color:#b1b1b1;-webkit-box-shadow:inset 0 3px 5px #b1b1b1;box-shadow:inset 0 3px 5px #b1b1b1}.sun-editor .se-controller-resizing{margin-top:-50px!important;padding:0;font-size:14px;font-style:normal;font-weight:400;line-height:1.42857143}.sun-editor .se-controller-resizing .se-btn-group .se-btn-group-sub.se-resizing-align-list{left:57px;width:74px}.sun-editor .se-resizing-container{position:absolute;display:none;outline:1px solid #3f9dff;background-color:transparent}.sun-editor .se-resizing-container .se-modal-resize{position:absolute;display:inline-block;background-color:#3f9dff;opacity:.3}.sun-editor .se-resizing-container .se-resize-dot{position:absolute;top:0;left:0;width:100%;height:100%}.sun-editor .se-resizing-container .se-resize-dot>span{position:absolute;width:7px;height:7px;background-color:#3f9dff;border:1px solid #4592ff}.sun-editor .se-resizing-container .se-resize-dot>span.tl{top:-5px;left:-5px;cursor:nw-resize}.sun-editor .se-resizing-container .se-resize-dot>span.tr{top:-5px;right:-5px;cursor:ne-resize}.sun-editor .se-resizing-container .se-resize-dot>span.bl{bottom:-5px;left:-5px;cursor:sw-resize}.sun-editor .se-resizing-container .se-resize-dot>span.br{right:-5px;bottom:-5px;cursor:se-resize}.sun-editor .se-resizing-container .se-resize-dot>span.lw{left:-7px;bottom:50%;cursor:w-resize}.sun-editor .se-resizing-container .se-resize-dot>span.th{left:50%;top:-7px;cursor:n-resize}.sun-editor .se-resizing-container .se-resize-dot>span.rw{right:-7px;bottom:50%;cursor:e-resize}.sun-editor .se-resizing-container .se-resize-dot>span.bh{right:50%;bottom:-7px;cursor:s-resize}.sun-editor .se-resizing-container .se-resize-display{position:absolute;right:0;bottom:0;padding:5px;margin:5px;font-size:12px;color:#fff;background-color:#333;border-radius:4px}.sun-editor .se-controller-table,.sun-editor .se-controller-table-cell{width:auto}.sun-editor .se-controller-link,.sun-editor .se-controller-table,.sun-editor .se-controller-table-cell{padding:0;font-size:14px;font-style:normal;font-weight:400;line-height:1.42857143}.sun-editor .se-controller-link:after,.sun-editor .se-controller-link:before{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.sun-editor .se-controller-link .link-content{padding:0;margin:0}.sun-editor .se-controller-link .link-content a{display:inline-block;color:#4592ff;max-width:200px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;vertical-align:middle;margin-left:5px}.sun-editor .se-file-browser{position:absolute;display:none;top:0;left:0;width:100%;height:100%;z-index:2147483647}.sun-editor .se-file-browser button,.sun-editor .se-file-browser input,.sun-editor .se-file-browser label{font-size:14px;line-height:1.5;color:#111;margin:0}.sun-editor .se-file-browser .se-file-browser-back{background-color:#222;opacity:.5}.sun-editor .se-file-browser .se-file-browser-back,.sun-editor .se-file-browser .se-file-browser-inner{position:absolute;display:block;width:100%;height:100%;top:0;left:0}.sun-editor .se-file-browser .se-file-browser-inner .se-file-browser-content{position:relative;width:960px;max-width:100%;margin:20px auto;background-color:#fff;-webkit-background-clip:padding-box;background-clip:padding-box;border:1px solid rgba(0,0,0,.2);border-radius:4px;outline:0;-webkit-box-shadow:0 3px 9px rgba(0,0,0,.5);box-shadow:0 3px 9px rgba(0,0,0,.5)}.sun-editor .se-file-browser .se-file-browser-header{height:auto;min-height:50px;padding:6px 15px;border-bottom:1px solid #e5e5e5}.sun-editor .se-file-browser .se-file-browser-header .se-file-browser-close{float:right;font-weight:700;text-shadow:0 1px 0 #fff;-webkit-appearance:none;filter:alpha(opacity=100);opacity:1}.sun-editor .se-file-browser .se-file-browser-header .se-file-browser-close>svg{width:12px;height:12px}.sun-editor .se-file-browser .se-file-browser-header .se-file-browser-title{font-size:16px;font-weight:700;margin:0;padding:0;line-height:2.2}.sun-editor .se-file-browser .se-file-browser-tags{display:block;width:100%;padding:0;text-align:left;margin:0 -15px}.sun-editor .se-file-browser .se-file-browser-tags a{display:inline-block;background-color:#f5f5f5;padding:6px 12px;margin:8px 0 8px 8px;color:#333;text-decoration:none;border-radius:32px;-moz-border-radius:32px;-webkit-border-radius:32px;-moz-background-clip:padding;-webkit-background-clip:padding-box;background-clip:padding-box;cursor:pointer}.sun-editor .se-file-browser .se-file-browser-tags a:hover{background-color:#e1e1e1}.sun-editor .se-file-browser .se-file-browser-tags a:active{background-color:#d1d1d1}.sun-editor .se-file-browser .se-file-browser-tags a.on{background-color:#ebf3fe;color:#4592ff}.sun-editor .se-file-browser .se-file-browser-tags a.on:hover{background-color:#d8e8fe}.sun-editor .se-file-browser .se-file-browser-tags a.on:active{background-color:#c7deff}.sun-editor .se-file-browser .se-file-browser-body{position:relative;height:auto;min-height:350px;padding:20px;overflow-y:auto}.sun-editor .se-file-browser .se-file-browser-body .se-file-browser-list{position:relative;width:100%}@media screen and (max-width:992px){.sun-editor .se-file-browser .se-file-browser-inner .se-file-browser-content{width:748px}}@media screen and (max-width:768px){.sun-editor .se-file-browser .se-file-browser-inner .se-file-browser-content{width:600px}}.sun-editor .se-file-browser .se-file-browser-list .se-file-item-column{position:relative;display:block;height:auto;float:left}.sun-editor .se-file-browser .se-file-browser-list.se-image-list .se-file-item-column{width:calc(25% - 20px);margin:0 10px}@media screen and (max-width:992px){.sun-editor .se-file-browser .se-file-browser-list.se-image-list .se-file-item-column{width:calc(33% - 20px)}}@media screen and (max-width:768px){.sun-editor .se-file-browser .se-file-browser-list.se-image-list .se-file-item-column{width:calc(50% - 20px)}}.sun-editor .se-file-browser .se-file-browser-list.se-image-list .se-file-item-img{position:relative;display:block;cursor:pointer;width:100%;height:auto;border-radius:4px;outline:0;margin:10px 0}.sun-editor .se-file-browser .se-file-browser-list.se-image-list .se-file-item-img:hover{opacity:.8;-webkit-box-shadow:0 0 0 .2rem #3288ff;box-shadow:0 0 0 .2rem #3288ff}.sun-editor .se-file-browser .se-file-browser-list.se-image-list .se-file-item-img>img{position:relative;display:block;width:100%;border-radius:4px;outline:0;height:auto}.sun-editor .se-file-browser .se-file-browser-list.se-image-list .se-file-item-img>.se-file-img-name{position:absolute;z-index:1;font-size:13px;color:#fff;left:0;bottom:0;padding:5px 10px;background-color:transparent;width:100%;height:30px;border-bottom-right-radius:4px;border-bottom-left-radius:4px}.sun-editor .se-file-browser .se-file-browser-list.se-image-list .se-file-item-img>.se-file-img-name.se-file-name-back{background-color:#333;opacity:.6}.sun-editor .se-notice{position:absolute;top:0;display:none;z-index:7;width:100%;height:auto;word-break:break-all;font-size:13px;color:#b94a48;background-color:#f2dede;padding:15px;margin:0;border:1px solid #eed3d7;user-select:text;-o-user-select:text;-moz-user-select:text;-khtml-user-select:text;-webkit-user-select:text;-ms-user-select:text}.sun-editor .se-notice button{float:right;padding:7px}.sun-editor .se-tooltip{position:relative;overflow:visible}.sun-editor .se-tooltip .se-tooltip-inner{visibility:hidden;position:absolute;display:block;width:auto;top:120%;left:50%;background:transparent;opacity:0;z-index:1;line-height:1.5;transition:opacity .5s;margin:0;padding:0;bottom:auto;float:none;pointer-events:none;backface-visibility:hidden;-webkit-backface-visibility:hidden;-moz-backface-visibility:hidden}.sun-editor .se-tooltip .se-tooltip-inner .se-tooltip-text{position:relative;display:inline-block;width:auto;left:-50%;font-size:.9em;margin:0;padding:4px 6px;border-radius:2px;background-color:#333;color:#fff;text-align:center;line-height:unset;white-space:nowrap;cursor:auto}.sun-editor .se-tooltip .se-tooltip-inner .se-tooltip-text:after{content:"";position:absolute;bottom:100%;left:50%;margin-left:-5px;border:5px solid transparent;border-bottom-color:#333}.sun-editor .se-tooltip:hover .se-tooltip-inner{visibility:visible;opacity:1}@keyframes blinker{50%{opacity:0}}@keyframes spinner{to{transform:rotate(361deg)}}.sun-editor-editable{font-family:Helvetica Neue,sans-serif;font-size:13px;color:#333;line-height:1.5;text-align:left;background-color:#fff;word-break:normal;word-wrap:break-word;padding:16px;margin:0}.sun-editor-editable *{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;font-family:inherit;font-size:inherit;color:inherit}.sun-editor-editable audio,.sun-editor-editable figcaption,.sun-editor-editable figure,.sun-editor-editable iframe,.sun-editor-editable img,.sun-editor-editable td,.sun-editor-editable th,.sun-editor-editable video{position:relative}.sun-editor-editable .__se__float-left{float:left}.sun-editor-editable .__se__float-right{float:right}.sun-editor-editable .__se__float-center{float:center}.sun-editor-editable .__se__float-none{float:none}.sun-editor-editable :not(.se-code-language .katex) span{display:inline;vertical-align:baseline;margin:0;padding:0}.sun-editor-editable span.katex{display:inline-block}.sun-editor-editable a{color:#004cff;text-decoration:none}.sun-editor-editable span[style~="color:"] a{color:inherit}.sun-editor-editable a:focus,.sun-editor-editable a:hover{cursor:pointer;color:#0093ff;text-decoration:underline}.sun-editor-editable pre{display:block;padding:8px;margin:0 0 10px;font-family:monospace;color:#666;line-height:1.45;background-color:#f9f9f9;border:1px solid #e1e1e1;border-radius:2px;white-space:pre-wrap;word-wrap:break-word;overflow:visible}.sun-editor-editable ol{list-style-type:decimal}.sun-editor-editable ol,.sun-editor-editable ul{display:block;margin-block-start:1em;margin-block-end:1em;margin-inline-start:0;margin-inline-end:0;padding-inline-start:40px}.sun-editor-editable ul{list-style-type:disc}.sun-editor-editable li{display:list-item;text-align:-webkit-match-parent;margin-bottom:5px}.sun-editor-editable ol ol,.sun-editor-editable ol ul,.sun-editor-editable ul ol,.sun-editor-editable ul ul{margin:0}.sun-editor-editable ol ol,.sun-editor-editable ul ol{list-style-type:lower-alpha}.sun-editor-editable ol ol ol,.sun-editor-editable ul ol ol,.sun-editor-editable ul ul ol{list-style-type:upper-roman}.sun-editor-editable ol ul,.sun-editor-editable ul ul{list-style-type:circle}.sun-editor-editable ol ol ul,.sun-editor-editable ol ul ul,.sun-editor-editable ul ul ul{list-style-type:square}.sun-editor-editable sub,.sun-editor-editable sup{font-size:75%;line-height:0}.sun-editor-editable sub{vertical-align:sub}.sun-editor-editable sup{vertical-align:super}.sun-editor-editable p{display:block;margin:0 0 10px}.sun-editor-editable div{display:block;margin:0;padding:0}.sun-editor-editable blockquote{display:block;font-family:inherit;font-size:inherit;color:#999;margin-block-start:1em;margin-block-end:1em;margin-inline-start:0;margin-inline-end:0;padding:0 5px 0 20px;border:solid #b1b1b1;border-width:0 0 0 5px}.sun-editor-editable blockquote blockquote{border-color:#c1c1c1}.sun-editor-editable blockquote blockquote blockquote{border-color:#d1d1d1}.sun-editor-editable blockquote blockquote blockquote blockquote{border-color:#e1e1e1}.sun-editor-editable h1{font-size:2em;margin-block-start:.67em;margin-block-end:.67em}.sun-editor-editable h1,.sun-editor-editable h2{display:block;margin-inline-start:0;margin-inline-end:0;font-weight:700}.sun-editor-editable h2{font-size:1.5em;margin-block-start:.83em;margin-block-end:.83em}.sun-editor-editable h3{font-size:1.17em;margin-block-start:1em;margin-block-end:1em}.sun-editor-editable h3,.sun-editor-editable h4{display:block;margin-inline-start:0;margin-inline-end:0;font-weight:700}.sun-editor-editable h4{font-size:1em;margin-block-start:1.33em;margin-block-end:1.33em}.sun-editor-editable h5{font-size:.83em;margin-block-start:1.67em;margin-block-end:1.67em}.sun-editor-editable h5,.sun-editor-editable h6{display:block;margin-inline-start:0;margin-inline-end:0;font-weight:700}.sun-editor-editable h6{font-size:.67em;margin-block-start:2.33em;margin-block-end:2.33em}.sun-editor-editable hr{display:flex;border-width:1px 0 0;border-color:#000;border-image:initial;height:1px}.sun-editor-editable hr.__se__solid{border-style:solid none none}.sun-editor-editable hr.__se__dotted{border-style:dotted none none}.sun-editor-editable hr.__se__dashed{border-style:dashed none none}.sun-editor-editable table{display:table;table-layout:auto;border:1px solid #ccc;width:100%;max-width:100%;margin:0 0 10px;background-color:transparent;border-spacing:0;border-collapse:collapse}.sun-editor-editable table thead{border-bottom:2px solid #333}.sun-editor-editable table tr{border:1px solid #efefef}.sun-editor-editable table th{background-color:#f3f3f3}.sun-editor-editable table td,.sun-editor-editable table th{border:1px solid #e1e1e1;padding:.4em;background-clip:padding-box}.sun-editor-editable table.se-table-size-auto{width:auto!important}.sun-editor-editable table.se-table-size-100{width:100%!important}.sun-editor-editable table.se-table-layout-auto{table-layout:auto!important}.sun-editor-editable table.se-table-layout-fixed{table-layout:fixed!important}.sun-editor-editable table td.se-table-selected-cell,.sun-editor-editable table th.se-table-selected-cell{border:1px double #4592ff;background-color:#f1f7ff}.sun-editor-editable.se-disabled *{user-select:none;-o-user-select:none;-moz-user-select:none;-khtml-user-select:none;-webkit-user-select:none;-ms-user-select:none}.sun-editor-editable .se-component{display:flex;padding:1px;margin:0 0 10px}.sun-editor-editable .se-component.__se__float-left{margin:0 20px 10px 0}.sun-editor-editable .se-component.__se__float-right{margin:0 0 10px 20px}.sun-editor-editable[contenteditable=true] .se-component{outline:1px dashed #e1e1e1}.sun-editor-editable[contenteditable=true] .se-component.se-component-copy{-webkit-box-shadow:0 0 0 .2rem #80bdff;box-shadow:0 0 0 .2rem #3f9dff;transition:border-color .15s ease-in-out,box-shadow .15s ease-in-out}.sun-editor-editable audio,.sun-editor-editable iframe,.sun-editor-editable img,.sun-editor-editable video{display:block;margin:0;padding:0;width:auto;height:auto;max-width:100%}.sun-editor-editable[contenteditable=true] figure:after{position:absolute;content:"";z-index:1;top:0;left:0;right:0;bottom:0;cursor:default;display:block;background:transparent}.sun-editor-editable[contenteditable=true] figure a,.sun-editor-editable[contenteditable=true] figure iframe,.sun-editor-editable[contenteditable=true] figure img,.sun-editor-editable[contenteditable=true] figure video{z-index:0}.sun-editor-editable[contenteditable=true] figure figcaption{display:block;z-index:2}.sun-editor-editable[contenteditable=true] figure figcaption:focus{border-color:#80bdff;outline:0;-webkit-box-shadow:0 0 0 .2rem #c7deff;box-shadow:0 0 0 .2rem #c7deff}.sun-editor-editable .se-image-container,.sun-editor-editable .se-video-container{width:auto;height:auto;max-width:100%}.sun-editor-editable figure{display:block;outline:none;margin:0;padding:0}.sun-editor-editable figure figcaption{padding:1em .5em;margin:0;background-color:#f9f9f9;outline:none}.sun-editor-editable figure figcaption p{line-height:2;margin:0}.sun-editor-editable .se-image-container a img{padding:1px;margin:1px;outline:1px solid #4592ff}.sun-editor-editable .se-video-container iframe,.sun-editor-editable .se-video-container video{outline:1px solid #9e9e9e;position:absolute;top:0;left:0;border:0;width:100%;height:100%}.sun-editor-editable .se-video-container figure{left:0;width:100%;max-width:100%}.sun-editor-editable audio{width:300px;height:54px}.sun-editor-editable audio.active{outline:2px solid #80bdff}.sun-editor-editable.se-show-block div,.sun-editor-editable.se-show-block h1,.sun-editor-editable.se-show-block h2,.sun-editor-editable.se-show-block h3,.sun-editor-editable.se-show-block h4,.sun-editor-editable.se-show-block h5,.sun-editor-editable.se-show-block h6,.sun-editor-editable.se-show-block li,.sun-editor-editable.se-show-block ol,.sun-editor-editable.se-show-block p,.sun-editor-editable.se-show-block pre,.sun-editor-editable.se-show-block ul{border:1px dashed #3f9dff!important;padding:14px 8px 8px!important}.sun-editor-editable.se-show-block ol,.sun-editor-editable.se-show-block ul{border:1px dashed #d539ff!important}.sun-editor-editable.se-show-block pre{border:1px dashed #27c022!important}.se-show-block p{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAAPAQMAAAAF7dc0AAAABlBMVEWAgID////n1o2sAAAAAnRSTlP/AOW3MEoAAAAaSURBVAjXY/j/gwGCPvxg+F4BQiAGDP1HQQByxxw0gqOzIwAAAABJRU5ErkJggg==") no-repeat}.se-show-block div{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABUAAAAPAQMAAAAxlBYoAAAABlBMVEWAgID////n1o2sAAAAAnRSTlP/AOW3MEoAAAAmSURBVAjXY/j//wcDDH+8XsHwDYi/hwNx1A8w/nYLKH4XoQYJAwCXnSgcl2MOPgAAAABJRU5ErkJggg==") no-repeat}.se-show-block h1{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAPAQMAAAA4f7ZSAAAABlBMVEWAgID////n1o2sAAAAAnRSTlP/AOW3MEoAAAAfSURBVAjXY/j/v4EBhr+9B+LzEPrDeygfhI8j1CBhAEhmJGY4Rf6uAAAAAElFTkSuQmCC") no-repeat}.se-show-block h2{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAPAQMAAAA4f7ZSAAAABlBMVEWAgID////n1o2sAAAAAnRSTlP/AOW3MEoAAAAmSURBVAjXY/j/v4EBhr+dB+LtQPy9geEDEH97D8T3gbgdoQYJAwA51iPuD2haEAAAAABJRU5ErkJggg==") no-repeat}.se-show-block h3{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAPAQMAAAA4f7ZSAAAABlBMVEWAgID////n1o2sAAAAAnRSTlP/AOW3MEoAAAAiSURBVAjXY/j/v4EBhr+dB+LtQPy9geHDeQgN5p9HqEHCADeWI+69VG2MAAAAAElFTkSuQmCC") no-repeat}.se-show-block h4{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAAPAQMAAADTSA1RAAAABlBMVEWAgID////n1o2sAAAAAnRSTlP/AOW3MEoAAAAiSURBVAjXY/j//wADDH97DsTXIfjDdiDdDMTfIRhZHRQDAKJOJ6L+K3y7AAAAAElFTkSuQmCC") no-repeat}.se-show-block h5{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAPAQMAAAA4f7ZSAAAABlBMVEWAgID////n1o2sAAAAAnRSTlP/AOW3MEoAAAAlSURBVAjXY/j/v4EBhr+1A/F+IO5vYPiwHUh/B2IQfR6hBgkDABlWIy5uM+9GAAAAAElFTkSuQmCC") no-repeat}.se-show-block h6{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAPAQMAAAA4f7ZSAAAABlBMVEWAgID////n1o2sAAAAAnRSTlP/AOW3MEoAAAAiSURBVAjXY/j/v4EBhr+dB+LtQLy/geFDP5S9HSKOrA6KAR9GIza1ptJnAAAAAElFTkSuQmCC") no-repeat}.se-show-block li{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAPCAYAAADkmO9VAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAA7SURBVDhPYxgFcNDQ0PAfykQBIHEYhgoRB/BpwCfHBKWpBkaggYxQGgOgBzyQD1aLLA4TGwWDGjAwAACR3RcEU9Ui+wAAAABJRU5ErkJggg==") no-repeat}.se-show-block ol{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAMCAYAAABiDJ37AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAABHSURBVDhPYxgFcNDQ0PAfhKFcFIBLHCdA1oBNM0kGEmMAPgOZoDTVANUNxAqQvURMECADRiiNAWCagDSGGhyW4DRrMAEGBgAu0SX6WpGgjAAAAABJRU5ErkJggg==") no-repeat}.se-show-block ul{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAMCAYAAABiDJ37AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAA1SURBVDhPYxgFDA0NDf+hTBSALI5LDQgwQWmqgVEDKQcsUBoF4ItFGEBXA+QzQpmDGjAwAAA8DQ4Lni6gdAAAAABJRU5ErkJggg==") no-repeat}.sun-editor-editable .__se__p-bordered,.sun-editor .__se__p-bordered{border-top:1px solid #b1b1b1;border-bottom:1px solid #b1b1b1;padding:4px 0}.sun-editor-editable .__se__p-spaced,.sun-editor .__se__p-spaced{letter-spacing:1px}.sun-editor-editable .__se__p-neon,.sun-editor .__se__p-neon{font-weight:200;font-style:italic;background:#000;color:#fff;padding:6px 4px;border:2px solid #fff;border-radius:6px;text-transform:uppercase;animation:neonFlicker 1.5s infinite alternate}@keyframes neonFlicker{0%,19%,21%,23%,25%,54%,56%,to{text-shadow:-.2rem -.2rem 1rem #fff,.2rem .2rem 1rem #fff,0 0 2px #f40,0 0 4px #f40,0 0 6px #f40,0 0 8px #f40,0 0 10px #f40;box-shadow:0 0 .5px #fff,inset 0 0 .5px #fff,0 0 2px #08f,inset 0 0 2px #08f,0 0 4px #08f,inset 0 0 4px #08f}20%,24%,55%{text-shadow:none;box-shadow:none}}.sun-editor-editable .__se__t-shadow,.sun-editor .__se__t-shadow{text-shadow:-.2rem -.2rem 1rem #fff,.2rem .2rem 1rem #fff,0 0 .2rem #999,0 0 .4rem #888,0 0 .6rem #777,0 0 .8rem #666,0 0 1rem #555}.sun-editor-editable .__se__t-code,.sun-editor .__se__t-code{font-family:monospace;color:#666;background-color:rgba(27,31,35,.05);border-radius:6px;padding:.2em .4em} \ No newline at end of file +.sun-editor{width:auto;height:auto;box-sizing:border-box;font-family:Helvetica Neue,sans-serif;border:1px solid #dadada;text-align:left;background-color:#fff;color:#000;user-select:none;-o-user-select:none;-moz-user-select:none;-khtml-user-select:none;-webkit-user-select:none;-ms-user-select:none}.sun-editor *{box-sizing:border-box;-webkit-user-drag:none;overflow:visible}.sun-editor-common button,.sun-editor-common input,.sun-editor-common select,.sun-editor-common textarea{font-size:14px;line-height:1.5}.sun-editor-common blockquote,.sun-editor-common body,.sun-editor-common button,.sun-editor-common code,.sun-editor-common dd,.sun-editor-common div,.sun-editor-common dl,.sun-editor-common dt,.sun-editor-common fieldset,.sun-editor-common form,.sun-editor-common h1,.sun-editor-common h2,.sun-editor-common h3,.sun-editor-common h4,.sun-editor-common h5,.sun-editor-common h6,.sun-editor-common input,.sun-editor-common legend,.sun-editor-common li,.sun-editor-common ol,.sun-editor-common p,.sun-editor-common pre,.sun-editor-common select,.sun-editor-common td,.sun-editor-common textarea,.sun-editor-common th,.sun-editor-common ul{margin:0;padding:0;border:0}.sun-editor-common dl,.sun-editor-common li,.sun-editor-common menu,.sun-editor-common ol,.sun-editor-common ul{list-style:none!important}.sun-editor-common hr{margin:6px 0!important}.sun-editor textarea{resize:none;border:0;padding:0}.sun-editor button{border:0;background-color:transparent;touch-action:manipulation;cursor:pointer;outline:none}.sun-editor button,.sun-editor input,.sun-editor select,.sun-editor textarea{vertical-align:middle}.sun-editor button span{display:block;margin:0;padding:0}.sun-editor button .txt{display:block;margin-top:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.sun-editor button *{pointer-events:none;backface-visibility:hidden;-webkit-backface-visibility:hidden;-moz-backface-visibility:hidden}.sun-editor .se-svg,.sun-editor button>svg{width:16px;height:16px;margin:auto;fill:currentColor;display:block;text-align:center;float:none}.sun-editor .close>svg,.sun-editor .se-dialog-close>svg{width:10px;height:10px}.sun-editor .se-btn-select>svg{float:right;width:10px;height:10px}.sun-editor .se-btn-list>.se-list-icon{display:inline-block;width:16px;height:16px;margin:-1px 10px 0 0;vertical-align:middle}.sun-editor .se-line-breaker>button>svg{width:24px;height:24px}.sun-editor button>i:before{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;display:inline-block;font-style:normal;font-variant:normal;text-rendering:auto;font-size:15px;line-height:2}.sun-editor button>[class=se-icon-text]{font-size:20px;line-height:1}.sun-editor .se-arrow,.sun-editor .se-arrow:after{position:absolute;display:block;width:0;height:0;border:11px solid transparent}.sun-editor .se-arrow.se-arrow-up{top:-11px;left:20px;margin-left:-11px;border-top-width:0;border-bottom-color:rgba(0,0,0,.25)}.sun-editor .se-arrow.se-arrow-up:after{top:1px;margin-left:-11px;content:" ";border-top-width:0;border-bottom-color:#fff}.sun-editor .se-toolbar .se-arrow.se-arrow-up:after{border-bottom-color:#fafafa}.sun-editor .se-arrow.se-arrow-down{top:0;left:0;margin-left:-11px;border-bottom-width:0;border-top-color:rgba(0,0,0,.25)}.sun-editor .se-arrow.se-arrow-down:after{top:-12px;margin-left:-11px;content:" ";border-bottom-width:0;border-top-color:#fff}.sun-editor .se-toolbar .se-arrow.se-arrow-down:after{border-top-color:#fafafa}.sun-editor .se-container{position:relative;width:100%;height:100%}.sun-editor button{color:#000}.sun-editor .se-btn{float:left;width:34px;height:34px;border:0;border-radius:4px;margin:1px!important;padding:0;font-size:12px;line-height:27px}.sun-editor .se-btn:enabled:focus,.sun-editor .se-btn:enabled:hover{background-color:#e1e1e1;border-color:#d1d1d1;outline:0 none}.sun-editor .se-btn:enabled:active{background-color:#d1d1d1;border-color:#c1c1c1;-webkit-box-shadow:inset 0 3px 5px #c1c1c1;box-shadow:inset 0 3px 5px #c1c1c1}.sun-editor .se-btn-primary{color:#000;background-color:#c7deff;border:1px solid #80bdff;border-radius:4px}.sun-editor .se-btn-primary:focus,.sun-editor .se-btn-primary:hover{color:#000;background-color:#80bdff;border-color:#3f9dff;outline:0 none}.sun-editor .se-btn-primary:active{color:#fff;background-color:#3f9dff;border-color:#4592ff;-webkit-box-shadow:inset 0 3px 5px #4592ff;box-shadow:inset 0 3px 5px #4592ff}.sun-editor input,.sun-editor select,.sun-editor textarea{color:#000;border:1px solid #ccc;border-radius:4px}.sun-editor input:focus,.sun-editor select:focus,.sun-editor textarea:focus{border:1px solid #80bdff;outline:0;-webkit-box-shadow:0 0 0 .2rem #c7deff;box-shadow:0 0 0 .2rem #c7deff;transition:border-color .15s ease-in-out,box-shadow .15s ease-in-out}.sun-editor .se-btn:enabled.active{color:#4592ff;outline:0 none}.sun-editor .se-btn:enabled.active:focus,.sun-editor .se-btn:enabled.active:hover{background-color:#e1e1e1;border-color:#d1d1d1;outline:0 none}.sun-editor .se-btn:enabled.active:active{background-color:#d1d1d1;border-color:#c1c1c1;-webkit-box-shadow:inset 0 3px 5px #c1c1c1;box-shadow:inset 0 3px 5px #c1c1c1}.sun-editor .se-btn:enabled.on{background-color:#e1e1e1;border-color:#d1d1d1;outline:0 none}.sun-editor .se-btn:enabled.on:focus,.sun-editor .se-btn:enabled.on:hover{background-color:#d1d1d1;border-color:#c1c1c1;outline:0 none}.sun-editor .se-btn:enabled.on:active{background-color:#c1c1c1;border-color:#b1b1b1;-webkit-box-shadow:inset 0 3px 5px #b1b1b1;box-shadow:inset 0 3px 5px #b1b1b1}.sun-editor .se-btn-list:disabled,.sun-editor .se-btn:disabled,.sun-editor button:disabled{cursor:not-allowed;background-color:inherit;color:#bdbdbd}.sun-editor .se-loading-box{position:absolute;display:none;width:100%;height:100%;top:0;left:0;background-color:#fff;opacity:.7;filter:alpha(opacity=70);z-index:2147483647}.sun-editor .se-loading-box .se-loading-effect{position:absolute;display:block;top:50%;left:50%;height:25px;width:25px;border-top:2px solid #07d;border-right:2px solid transparent;border-radius:50%;animation:spinner .8s linear infinite;margin:-25px 0 0 -25px}.sun-editor .se-line-breaker{position:absolute;display:none;width:100%;height:1px;cursor:text;border-top:1px solid #3288ff;z-index:7}.sun-editor .se-line-breaker>button.se-btn{position:relative;display:inline-block;width:30px;height:30px;top:-15px;float:none;left:-50%;background-color:#fff;border:1px solid #0c2240;opacity:.6;cursor:pointer}.sun-editor .se-line-breaker>button.se-btn:hover{opacity:.9;background-color:#fff;border-color:#041b39}.sun-editor .se-line-breaker-component{position:absolute;display:none;width:24px;height:24px;background-color:#fff;border:1px solid #0c2240;opacity:.6;border-radius:4px;cursor:pointer;z-index:7}.sun-editor .se-line-breaker-component:hover{opacity:.9}.sun-editor .se-toolbar{display:block;position:relative;height:auto;width:100%;overflow:visible;padding:4px 3px 0;margin:0;background-color:#fafafa;outline:1px solid #dadada;z-index:5}.sun-editor .se-toolbar-cover{position:absolute;display:none;font-size:36px;width:100%;height:100%;top:0;left:0;background-color:#fefefe;opacity:.5;filter:alpha(opacity=50);cursor:not-allowed;z-index:4}.sun-editor .se-toolbar-separator-vertical{display:inline-block;height:0;width:0;margin:1px;vertical-align:top}.sun-editor .se-toolbar.se-toolbar-balloon,.sun-editor .se-toolbar.se-toolbar-inline{display:none;position:absolute;z-index:2147483647;box-shadow:0 3px 9px rgba(0,0,0,.5);-webkit-box-shadow:0 3px 9px rgba(0,0,0,.5)}.sun-editor .se-toolbar.se-toolbar-balloon{width:auto}.sun-editor .se-toolbar.se-toolbar-sticky{position:fixed;top:0}.sun-editor .se-toolbar-sticky-dummy{display:none;position:static;z-index:-1}.sun-editor .se-btn-module{display:inline-block}.sun-editor .se-btn-module-border{border:1px solid #dadada;border-radius:4px}.sun-editor .se-btn-module-enter{display:block;width:100%;height:1px;margin-bottom:5px;background-color:transparent}.sun-editor .se-toolbar-more-layer{margin:0 -3px;background-color:#f3f3f3}.sun-editor .se-toolbar-more-layer .se-more-layer{display:none;border-top:1px solid #dadada}.sun-editor .se-toolbar-more-layer .se-more-layer .se-more-form{display:inline-block;width:100%;height:auto;padding:4px 3px 0}.sun-editor .se-btn-module .se-btn-more.se-btn-more-text{width:auto;padding:0 4px}.sun-editor .se-btn-module .se-btn-more:focus,.sun-editor .se-btn-module .se-btn-more:hover{color:#000;background-color:#d1d1d1;border-color:#c1c1c1;outline:0 none}.sun-editor .se-btn-module .se-btn-more.on{color:#333;background-color:#d1d1d1;border-color:#c1c1c1;outline:0 none}.sun-editor .se-btn-module .se-btn-more.on:hover{color:#000;background-color:#c1c1c1;border-color:#b1b1b1;outline:0 none}.sun-editor .se-menu-list,.sun-editor .se-menu-list li{float:left;padding:0;margin:0}.sun-editor .se-menu-list li{position:relative}.sun-editor .se-btn-select{width:auto;display:flex;text-align:left;padding:4px 6px}.sun-editor .se-btn-select .txt{flex:auto;float:left;text-align:left}.sun-editor .se-btn-select.se-btn-tool-font{width:100px}.sun-editor .se-btn-select.se-btn-tool-format,.sun-editor .se-btn-select.se-btn-tool-size{width:80px}.sun-editor .se-btn-tray{position:relative;width:100%;height:100%;margin:0;padding:0}.sun-editor .se-menu-tray{position:absolute;top:0;left:0;width:100%;height:0}.sun-editor .se-submenu{overflow-x:hidden;overflow-y:auto}.sun-editor .se-list-layer{display:none;position:absolute;top:0;left:0;height:auto;z-index:5;border:1px solid #bababa;border-radius:4px;padding:6px 0;background-color:#fff;-webkit-box-shadow:0 3px 9px rgba(0,0,0,.5);box-shadow:0 3px 9px rgba(0,0,0,.5);outline:0 none}.sun-editor .se-list-layer .se-list-inner{padding:0;margin:0;overflow-x:initial;overflow-y:initial;overflow:visible}.sun-editor .se-list-layer button{margin:0;width:100%}.sun-editor .se-list-inner .se-list-basic{width:100%;padding:0}.sun-editor .se-list-inner .se-list-basic li{width:100%}.sun-editor .se-list-inner .se-list-basic li>button{min-width:100%;width:max-content}.sun-editor .se-list-inner .se-list-basic li button.active{background-color:#80bdff;border:1px solid #3f9dff;border-left:0;border-right:0}.sun-editor .se-list-inner .se-list-basic li button.active:hover{background-color:#3f9dff;border:1px solid #4592ff;border-left:0;border-right:0}.sun-editor .se-list-inner .se-list-basic li button.active:active{background-color:#4592ff;border:1px solid #407dd1;border-left:0;border-right:0;-webkit-box-shadow:inset 0 3px 5px #407dd1;box-shadow:inset 0 3px 5px #407dd1}.sun-editor .se-btn-list{width:100%;height:auto;min-height:32px;padding:0 14px;cursor:pointer;font-size:12px;line-height:normal;text-indent:0;text-decoration:none;text-align:left}.sun-editor .se-btn-list.default_value{background-color:#f3f3f3;border-top:1px dotted #b1b1b1;border-bottom:1px dotted #b1b1b1}.sun-editor .se-btn-list:focus,.sun-editor .se-btn-list:hover{background-color:#e1e1e1;border-color:#d1d1d1;outline:0 none}.sun-editor .se-btn-list:active{background-color:#d1d1d1;border-color:#c1c1c1;-webkit-box-shadow:inset 0 3px 5px #c1c1c1;box-shadow:inset 0 3px 5px #c1c1c1}.sun-editor .se-list-layer.se-list-font-size{min-width:140px;max-height:300px}.sun-editor .se-list-layer.se-list-font-family{min-width:156px}.sun-editor .se-list-layer.se-list-font-family .default{border-bottom:1px solid #ccc}.sun-editor .se-list-layer.se-list-line{width:125px}.sun-editor .se-list-layer.se-list-align .se-list-inner{left:9px;width:125px}.sun-editor .se-list-layer.se-list-format{min-width:156px}.sun-editor .se-list-layer.se-list-format li{padding:0;width:100%}.sun-editor .se-list-layer.se-list-format ul .se-btn-list{line-height:100%}.sun-editor .se-list-layer.se-list-format ul .se-btn-list[data-value=h1]{height:40px}.sun-editor .se-list-layer.se-list-format ul .se-btn-list[data-value=h2]{height:34px}.sun-editor .se-list-layer.se-list-format ul p{font-size:13px}.sun-editor .se-list-layer.se-list-format ul div{font-size:13px;padding:4px 2px}.sun-editor .se-list-layer.se-list-format ul h1{font-size:2em;font-weight:700;color:#333}.sun-editor .se-list-layer.se-list-format ul h2{font-size:1.5em;font-weight:700;color:#333}.sun-editor .se-list-layer.se-list-format ul h3{font-size:1.17em;font-weight:700;color:#333}.sun-editor .se-list-layer.se-list-format ul h4{font-size:1em;font-weight:700;color:#333}.sun-editor .se-list-layer.se-list-format ul h5{font-size:.83em;font-weight:700;color:#333}.sun-editor .se-list-layer.se-list-format ul h6{font-size:.67em;font-weight:700;color:#333}.sun-editor .se-list-layer.se-list-format ul blockquote{font-size:13px;color:#999;height:22px;margin:0;background-color:transparent;line-height:1.5;border-color:#b1b1b1;padding:0 0 0 7px;border-left:5px #b1b1b1;border-style:solid}.sun-editor .se-list-layer.se-list-format ul pre{font-size:13px;color:#666;padding:4px 11px;margin:0;background-color:#f9f9f9;border:1px solid #e1e1e1;border-radius:4px}.sun-editor .se-selector-table{display:none;position:absolute;top:34px;left:1px;z-index:5;padding:5px 0;float:left;margin:2px 0 0;font-size:14px;text-align:left;list-style:none;background-color:#fff;-webkit-background-clip:padding-box;background-clip:padding-box;border:1px solid #ccc;border-radius:4px;-webkit-box-shadow:0 6px 12px rgba(0,0,0,.175);box-shadow:0 6px 12px rgba(0,0,0,.175)}.sun-editor .se-selector-table .se-table-size{font-size:18px;padding:0 5px}.sun-editor .se-selector-table .se-table-size-picker{position:absolute!important;z-index:3;font-size:18px;width:10em;height:10em;cursor:pointer}.sun-editor .se-selector-table .se-table-size-highlighted{position:absolute!important;z-index:2;font-size:18px;width:1em;height:1em;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAAZdEVYdFNvZnR3YXJlAEFkb2JlIEltYWdlUmVhZHlxyWU8AAADJmlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNS42LWMxNDIgNzkuMTYwOTI0LCAyMDE3LzA3LzEzLTAxOjA2OjM5ICAgICAgICAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPiA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDo4QTZCNzMzN0I3RUYxMUU4ODcwQ0QwMjM1NTgzRTJDNyIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDo4QTZCNzMzNkI3RUYxMUU4ODcwQ0QwMjM1NTgzRTJDNyIgeG1wOkNyZWF0b3JUb29sPSJBZG9iZSBQaG90b3Nob3AgQ0MgMjAxOCAoV2luZG93cykiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDo0MzYyNEUxRUI3RUUxMUU4ODZGQzgwRjNBODgyNTdFOSIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDo0MzYyNEUxRkI3RUUxMUU4ODZGQzgwRjNBODgyNTdFOSIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/Pl0yAuwAAABBSURBVDhPY/wPBAxUAGCDGvdBeWSAeicIDTfIXREiQArYeR9hEBOEohyMGkQYjBpEGAxjg6ib+yFMygCVvMbAAABj0hwMTNeKJwAAAABJRU5ErkJggg==") repeat}.sun-editor .se-selector-table .se-table-size-unhighlighted{position:relative!important;z-index:1;font-size:18px;width:10em;height:10em;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASAgMAAAAroGbEAAAACVBMVEUAAIj4+Pjp6ekKlAqjAAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAACxMAAAsTAQCanBgAAAAHdElNRQfYAR0BKhmnaJzPAAAAG0lEQVQI12NgAAOtVatWMTCohoaGUY+EmIkEAEruEzK2J7tvAAAAAElFTkSuQmCC") repeat}.sun-editor .se-selector-table .se-table-size-display{padding-left:5px}.sun-editor .se-list-layer .se-selector-color{display:flex;width:max-content;max-width:270px;height:auto;padding:0;margin:auto}.sun-editor .se-list-layer .se-selector-color .se-color-pallet{width:100%;height:100%;padding:0}.sun-editor .se-list-layer .se-selector-color .se-color-pallet li{display:flex;float:left;position:relative;margin:0}.sun-editor .se-list-layer .se-selector-color .se-color-pallet button{display:block;cursor:default;width:30px;height:30px;text-indent:-9999px}.sun-editor .se-list-layer .se-selector-color .se-color-pallet button.active,.sun-editor .se-list-layer .se-selector-color .se-color-pallet button:focus,.sun-editor .se-list-layer .se-selector-color .se-color-pallet button:hover{border:3px solid #fff}.sun-editor .se-submenu-form-group{display:flex;width:100%;height:auto;padding:4px}.sun-editor .se-submenu-form-group input{flex:auto;display:inline-block;width:auto;height:33px;color:#555;font-size:12px;margin:1px 0;padding:0;border-radius:.25rem;border:1px solid #ccc}.sun-editor .se-submenu-form-group button{float:right;width:34px;height:34px;margin:0 0 0 4px!important}.sun-editor .se-submenu-form-group button.se-btn{border:1px solid #ccc}.sun-editor .se-submenu-form-group>div{position:relative}.sun-editor .se-submenu-form-group .se-color-input{width:72px;text-transform:uppercase;border:none;border-bottom:2px solid #b1b1b1;outline:none}.sun-editor .se-submenu-form-group .se-color-input:focus{border-bottom:3px solid #b1b1b1}.sun-editor .se-wrapper{position:relative!important;width:100%;height:auto;overflow:hidden;z-index:1}.sun-editor .se-wrapper .se-wrapper-inner{width:100%;height:100%;min-height:65px;overflow-y:auto;overflow-x:auto;-webkit-overflow-scrolling:touch;user-select:text;-o-user-select:text;-moz-user-select:text;-khtml-user-select:text;-webkit-user-select:text;-ms-user-select:text}.sun-editor .se-wrapper .se-wrapper-inner:focus{outline:none}.sun-editor .se-wrapper .se-wrapper-code{background-color:#191919;color:#fff;font-size:13px;word-break:break-all;padding:4px;margin:0;resize:none!important}.sun-editor .se-wrapper .se-wrapper-wysiwyg{background-color:#fff;display:block}.sun-editor .se-wrapper .se-wrapper-code-mirror{font-size:13px}.sun-editor .se-wrapper .se-placeholder{position:absolute;display:none;white-space:nowrap;text-overflow:ellipsis;z-index:1;color:#b1b1b1;font-size:13px;line-height:1.5;top:0;left:0;right:0;overflow:hidden;margin-top:0;padding-top:16px;padding-left:16px;margin-left:0;padding-right:16px;margin-right:0;pointer-events:none;backface-visibility:hidden;-webkit-backface-visibility:hidden;-moz-backface-visibility:hidden}.sun-editor .se-resizing-bar{display:flex;width:auto;height:auto;min-height:16px;border-top:1px solid #dadada;padding:0 4px;background-color:#fafafa;cursor:ns-resize}.sun-editor .se-resizing-bar.se-resizing-none{cursor:default}.sun-editor .se-resizing-back{position:absolute;display:none;cursor:default;top:0;left:0;width:100%;height:100%;z-index:2147483647}.sun-editor .se-resizing-bar .se-navigation{flex:auto;position:relative;width:auto;height:auto;color:#666;margin:0;padding:0;font-size:10px;font-weight:700;line-height:1.5;background:transparent}.sun-editor .se-resizing-bar .se-char-counter-wrapper{flex:none;position:relative;display:block;width:auto;height:auto;margin:0;padding:0;color:#999;font-size:13px;background:transparent}.sun-editor .se-resizing-bar .se-char-counter-wrapper.se-blink{color:#b94a48;animation:blinker .2s linear infinite}.sun-editor .se-resizing-bar .se-char-counter-wrapper .se-char-label{margin-right:4px}.sun-editor .se-dialog{position:absolute;display:none;top:0;left:0;width:100%;height:100%;z-index:2147483647}.sun-editor .se-dialog button,.sun-editor .se-dialog input,.sun-editor .se-dialog label{font-size:14px;line-height:1.5;color:#111;margin:0}.sun-editor .se-dialog .se-dialog-back{background-color:#222;opacity:.5}.sun-editor .se-dialog .se-dialog-back,.sun-editor .se-dialog .se-dialog-inner{position:absolute;width:100%;height:100%;top:0;left:0}.sun-editor .se-dialog .se-dialog-inner .se-dialog-content{position:relative;width:auto;max-width:500px;margin:20px auto;background-color:#fff;-webkit-background-clip:padding-box;background-clip:padding-box;border:1px solid rgba(0,0,0,.2);border-radius:4px;outline:0;-webkit-box-shadow:0 3px 9px rgba(0,0,0,.5);box-shadow:0 3px 9px rgba(0,0,0,.5)}@media screen and (max-width:509px){.sun-editor .se-dialog .se-dialog-inner .se-dialog-content{width:100%}}.sun-editor .se-dialog .se-dialog-inner .se-dialog-content label{display:inline-block;max-width:100%;margin-bottom:5px;font-weight:700}.sun-editor .se-dialog .se-dialog-inner .se-dialog-content .se-btn-primary{display:inline-block;padding:6px 12px;margin:0 0 10px!important;font-size:14px;font-weight:400;line-height:1.42857143;text-align:center;white-space:nowrap;vertical-align:middle;-ms-touch-action:manipulation;touch-action:manipulation;border-radius:4px}.sun-editor .se-dialog .se-dialog-inner .se-dialog-header{height:50px;padding:6px 15px;border-bottom:1px solid #e5e5e5}.sun-editor .se-dialog .se-dialog-inner .se-dialog-header .se-dialog-close{float:right;font-weight:700;text-shadow:0 1px 0 #fff;-webkit-appearance:none;filter:alpha(opacity=100);opacity:1}.sun-editor .se-dialog .se-dialog-inner .se-dialog-header .se-modal-title{font-size:14px;font-weight:700;margin:0;padding:0;line-height:2.5}.sun-editor .se-dialog .se-dialog-inner .se-dialog-body{position:relative;padding:15px}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form{margin-bottom:10px}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form-footer{margin-top:10px;margin-bottom:0}.sun-editor .se-dialog .se-dialog-inner input:disabled{background-color:#f3f3f3}.sun-editor .se-dialog .se-dialog-inner .se-dialog-size-text{width:100%}.sun-editor .se-dialog .se-dialog-inner .se-dialog-size-text .size-h,.sun-editor .se-dialog .se-dialog-inner .se-dialog-size-text .size-w{width:70px;text-align:center}.sun-editor .se-dialog .se-dialog-inner .se-dialog-size-x{margin:0 8px;width:25px;text-align:center}.sun-editor .se-dialog .se-dialog-inner .se-dialog-footer{padding:10px 15px 0;text-align:right;border-top:1px solid #e5e5e5}.sun-editor .se-dialog .se-dialog-inner .se-dialog-footer>div{float:left}.sun-editor .se-dialog .se-dialog-inner .se-dialog-footer>div>label{margin-top:5px}.sun-editor .se-dialog .se-dialog-inner .se-dialog-btn-radio{margin-left:12px;margin-right:6px}.sun-editor .se-dialog .se-dialog-inner .se-dialog-btn-check{margin-left:12px;margin-right:4px}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form-footer .se-dialog-btn-check{margin-left:0;margin-right:4px}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-dialog-form-files{position:relative;display:flex;align-items:center}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-dialog-form-files>input{flex:auto}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-dialog-form-files .se-dialog-files-edge-button{flex:auto;opacity:.8;border:1px solid #ccc}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-dialog-form-files .se-dialog-files-edge-button.se-file-remove>svg{width:8px;height:8px}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-dialog-form-files .se-dialog-files-edge-button:hover{background-color:#f0f0f0;outline:0 none}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-dialog-form-files .se-dialog-files-edge-button:active{background-color:#e9e9e9;-webkit-box-shadow:inset 0 3px 5px #d6d6d6;box-shadow:inset 0 3px 5px #d6d6d6}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-input-select{display:inline-block;width:auto;height:34px;font-size:14px;text-align:center;line-height:1.42857143}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-input-control{display:inline-block;width:70px;height:34px;font-size:14px;text-align:center;line-height:1.42857143}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-input-form{display:block;width:100%;height:34px;font-size:14px;line-height:1.42857143;padding:0 4px}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-input-form.se-input-url:disabled{text-decoration:line-through;color:#999}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-video-ratio{width:70px;margin-left:4px}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form a{color:#004cff}.sun-editor .se-dialog .se-dialog-inner .se-dialog-btn-revert{border:1px solid #ccc}.sun-editor .se-dialog .se-dialog-inner .se-dialog-btn-revert:hover{background-color:#e1e1e1;border-color:#d1d1d1;outline:0 none}.sun-editor .se-dialog .se-dialog-inner .se-dialog-btn-revert:active{background-color:#d1d1d1;border-color:#c1c1c1;-webkit-box-shadow:inset 0 3px 5px #c1c1c1;box-shadow:inset 0 3px 5px #c1c1c1}.sun-editor .se-dialog-tabs{width:100%;height:25px;border-bottom:1px solid #e5e5e5}.sun-editor .se-dialog-tabs button{background-color:#e5e5e5;border-right:1px solid #e5e5e5;float:left;outline:none;padding:2px 13px;transition:.3s}.sun-editor .se-dialog-tabs button:hover{background-color:#fff}.sun-editor .se-dialog-tabs button.active{background-color:#fff;border-bottom:0}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-input-form.se-math-exp{resize:vertical;height:4rem;border:1px solid #ccc;font-size:13px;padding:4px}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-input-select.se-math-size{width:6em;height:28px;margin-left:1em}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-math-preview{font-size:13px}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-math-preview>span{display:inline-block;-webkit-box-shadow:0 0 0 .1rem #c7deff;box-shadow:0 0 0 .1rem #c7deff}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-link-preview{display:block;height:auto;max-height:18px;margin:4px 0 0 4px;font-size:13px;font-weight:400;font-family:inherit;color:#666;background-color:transparent;overflow:hidden;text-overflow:ellipsis;word-break:break-all;white-space:pre}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-mention-item{line-height:28px;min-height:25px;padding:0 5px}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-mention-item.se-mention-active{background-color:#d1d1d1;border-radius:3px}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-mention-search{margin-bottom:10px}.sun-editor .se-controller .se-arrow.se-arrow-up{border-bottom-color:rgba(0,0,0,.25)}.sun-editor .se-controller{position:absolute;display:none;overflow:visible;z-index:6;border:1px solid rgba(0,0,0,.25);border-radius:4px;text-align:start;text-decoration:none;text-shadow:none;text-transform:none;letter-spacing:normal;word-break:normal;word-spacing:normal;word-wrap:normal;white-space:normal;background-color:#fff;-webkit-background-clip:padding-box;background-clip:padding-box;-webkit-box-shadow:0 5px 10px rgba(0,0,0,.2);box-shadow:0 5px 10px rgba(0,0,0,.2);line-break:auto}.sun-editor .se-controller .se-btn-group{position:relative;display:flex;vertical-align:middle;padding:2px;top:0;left:0}.sun-editor .se-controller .se-btn-group .se-btn-group-sub{left:50%;min-width:auto;width:max-content;display:none}.sun-editor .se-controller .se-btn-group .se-btn-group-sub button{margin:0;min-width:72px}.sun-editor .se-controller .se-btn-group button{position:relative;min-height:34px;height:auto;border:none;border-radius:4px;margin:1px;padding:5px 10px;font-size:12px;line-height:1.5;display:inline-block;font-weight:400;text-align:center;white-space:nowrap;vertical-align:middle;-ms-touch-action:manipulation;touch-action:manipulation}.sun-editor .se-controller .se-btn-group button:focus:enabled,.sun-editor .se-controller .se-btn-group button:hover:enabled{background-color:#e1e1e1;border-color:#d1d1d1;outline:0 none}.sun-editor .se-controller .se-btn-group button:active:enabled{background-color:#d1d1d1;border-color:#c1c1c1;-webkit-box-shadow:inset 0 3px 5px #c1c1c1;box-shadow:inset 0 3px 5px #c1c1c1}.sun-editor .se-controller .se-btn-group button span{display:block;padding:0;margin:0}.sun-editor .se-controller .se-btn-group button:enabled.active{color:#4592ff;outline:0 none}.sun-editor .se-controller .se-btn-group button:enabled.active:focus,.sun-editor .se-controller .se-btn-group button:enabled.active:hover{background-color:#e1e1e1;border-color:#d1d1d1;outline:0 none}.sun-editor .se-controller .se-btn-group button:enabled.active:active{background-color:#d1d1d1;border-color:#c1c1c1;-webkit-box-shadow:inset 0 3px 5px #c1c1c1;box-shadow:inset 0 3px 5px #c1c1c1}.sun-editor .se-controller .se-btn-group button:enabled.on{background-color:#e1e1e1;border-color:#d1d1d1;outline:0 none}.sun-editor .se-controller .se-btn-group button:enabled.on:focus,.sun-editor .se-controller .se-btn-group button:enabled.on:hover{background-color:#d1d1d1;border-color:#c1c1c1;outline:0 none}.sun-editor .se-controller .se-btn-group button:enabled.on:active{background-color:#c1c1c1;border-color:#b1b1b1;-webkit-box-shadow:inset 0 3px 5px #b1b1b1;box-shadow:inset 0 3px 5px #b1b1b1}.sun-editor .se-controller-resizing{margin-top:-50px!important;padding:0;font-size:14px;font-style:normal;font-weight:400;line-height:1.42857143}.sun-editor .se-controller-resizing .se-btn-group .se-btn-group-sub.se-resizing-align-list{left:57px;width:74px}.sun-editor .se-resizing-container{position:absolute;display:none;outline:1px solid #3f9dff;background-color:transparent}.sun-editor .se-resizing-container .se-modal-resize{position:absolute;display:inline-block;background-color:#3f9dff;opacity:.3}.sun-editor .se-resizing-container .se-resize-dot{position:absolute;top:0;left:0;width:100%;height:100%}.sun-editor .se-resizing-container .se-resize-dot>span{position:absolute;width:7px;height:7px;background-color:#3f9dff;border:1px solid #4592ff}.sun-editor .se-resizing-container .se-resize-dot>span.tl{top:-5px;left:-5px;cursor:nw-resize}.sun-editor .se-resizing-container .se-resize-dot>span.tr{top:-5px;right:-5px;cursor:ne-resize}.sun-editor .se-resizing-container .se-resize-dot>span.bl{bottom:-5px;left:-5px;cursor:sw-resize}.sun-editor .se-resizing-container .se-resize-dot>span.br{right:-5px;bottom:-5px;cursor:se-resize}.sun-editor .se-resizing-container .se-resize-dot>span.lw{left:-7px;bottom:50%;cursor:w-resize}.sun-editor .se-resizing-container .se-resize-dot>span.th{left:50%;top:-7px;cursor:n-resize}.sun-editor .se-resizing-container .se-resize-dot>span.rw{right:-7px;bottom:50%;cursor:e-resize}.sun-editor .se-resizing-container .se-resize-dot>span.bh{right:50%;bottom:-7px;cursor:s-resize}.sun-editor .se-resizing-container .se-resize-display{position:absolute;right:0;bottom:0;padding:5px;margin:5px;font-size:12px;color:#fff;background-color:#333;border-radius:4px}.sun-editor .se-controller-table,.sun-editor .se-controller-table-cell{width:auto}.sun-editor .se-controller-link,.sun-editor .se-controller-table,.sun-editor .se-controller-table-cell{padding:0;font-size:14px;font-style:normal;font-weight:400;line-height:1.42857143}.sun-editor .se-controller-link:after,.sun-editor .se-controller-link:before{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.sun-editor .se-controller-link .link-content{padding:0;margin:0}.sun-editor .se-controller-link .link-content a{display:inline-block;color:#4592ff;max-width:200px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;vertical-align:middle;margin-left:5px}.sun-editor .se-file-browser{position:absolute;display:none;top:0;left:0;width:100%;height:100%;z-index:2147483647}.sun-editor .se-file-browser button,.sun-editor .se-file-browser input,.sun-editor .se-file-browser label{font-size:14px;line-height:1.5;color:#111;margin:0}.sun-editor .se-file-browser .se-file-browser-back{background-color:#222;opacity:.5}.sun-editor .se-file-browser .se-file-browser-back,.sun-editor .se-file-browser .se-file-browser-inner{position:absolute;display:block;width:100%;height:100%;top:0;left:0}.sun-editor .se-file-browser .se-file-browser-inner .se-file-browser-content{position:relative;width:960px;max-width:100%;margin:20px auto;background-color:#fff;-webkit-background-clip:padding-box;background-clip:padding-box;border:1px solid rgba(0,0,0,.2);border-radius:4px;outline:0;-webkit-box-shadow:0 3px 9px rgba(0,0,0,.5);box-shadow:0 3px 9px rgba(0,0,0,.5)}.sun-editor .se-file-browser .se-file-browser-header{height:auto;min-height:50px;padding:6px 15px;border-bottom:1px solid #e5e5e5}.sun-editor .se-file-browser .se-file-browser-header .se-file-browser-close{float:right;font-weight:700;text-shadow:0 1px 0 #fff;-webkit-appearance:none;filter:alpha(opacity=100);opacity:1}.sun-editor .se-file-browser .se-file-browser-header .se-file-browser-close>svg{width:12px;height:12px}.sun-editor .se-file-browser .se-file-browser-header .se-file-browser-title{font-size:16px;font-weight:700;margin:0;padding:0;line-height:2.2}.sun-editor .se-file-browser .se-file-browser-tags{display:block;width:100%;padding:0;text-align:left;margin:0 -15px}.sun-editor .se-file-browser .se-file-browser-tags a{display:inline-block;background-color:#f5f5f5;padding:6px 12px;margin:8px 0 8px 8px;color:#333;text-decoration:none;border-radius:32px;-moz-border-radius:32px;-webkit-border-radius:32px;-moz-background-clip:padding;-webkit-background-clip:padding-box;background-clip:padding-box;cursor:pointer}.sun-editor .se-file-browser .se-file-browser-tags a:hover{background-color:#e1e1e1}.sun-editor .se-file-browser .se-file-browser-tags a:active{background-color:#d1d1d1}.sun-editor .se-file-browser .se-file-browser-tags a.on{background-color:#ebf3fe;color:#4592ff}.sun-editor .se-file-browser .se-file-browser-tags a.on:hover{background-color:#d8e8fe}.sun-editor .se-file-browser .se-file-browser-tags a.on:active{background-color:#c7deff}.sun-editor .se-file-browser .se-file-browser-body{position:relative;height:auto;min-height:350px;padding:20px;overflow-y:auto}.sun-editor .se-file-browser .se-file-browser-body .se-file-browser-list{position:relative;width:100%}@media screen and (max-width:992px){.sun-editor .se-file-browser .se-file-browser-inner .se-file-browser-content{width:748px}}@media screen and (max-width:768px){.sun-editor .se-file-browser .se-file-browser-inner .se-file-browser-content{width:600px}}.sun-editor .se-file-browser .se-file-browser-list .se-file-item-column{position:relative;display:block;height:auto;float:left}.sun-editor .se-file-browser .se-file-browser-list.se-image-list .se-file-item-column{width:calc(25% - 20px);margin:0 10px}@media screen and (max-width:992px){.sun-editor .se-file-browser .se-file-browser-list.se-image-list .se-file-item-column{width:calc(33% - 20px)}}@media screen and (max-width:768px){.sun-editor .se-file-browser .se-file-browser-list.se-image-list .se-file-item-column{width:calc(50% - 20px)}}.sun-editor .se-file-browser .se-file-browser-list.se-image-list .se-file-item-img{position:relative;display:block;cursor:pointer;width:100%;height:auto;border-radius:4px;outline:0;margin:10px 0}.sun-editor .se-file-browser .se-file-browser-list.se-image-list .se-file-item-img:hover{opacity:.8;-webkit-box-shadow:0 0 0 .2rem #3288ff;box-shadow:0 0 0 .2rem #3288ff}.sun-editor .se-file-browser .se-file-browser-list.se-image-list .se-file-item-img>img{position:relative;display:block;width:100%;border-radius:4px;outline:0;height:auto}.sun-editor .se-file-browser .se-file-browser-list.se-image-list .se-file-item-img>.se-file-img-name{position:absolute;z-index:1;font-size:13px;color:#fff;left:0;bottom:0;padding:5px 10px;background-color:transparent;width:100%;height:30px;border-bottom-right-radius:4px;border-bottom-left-radius:4px}.sun-editor .se-file-browser .se-file-browser-list.se-image-list .se-file-item-img>.se-file-img-name.se-file-name-back{background-color:#333;opacity:.6}.sun-editor .se-notice{position:absolute;top:0;display:none;z-index:7;width:100%;height:auto;word-break:break-all;font-size:13px;color:#b94a48;background-color:#f2dede;padding:15px;margin:0;border:1px solid #eed3d7;user-select:text;-o-user-select:text;-moz-user-select:text;-khtml-user-select:text;-webkit-user-select:text;-ms-user-select:text}.sun-editor .se-notice button{float:right;padding:7px}.sun-editor .se-tooltip{position:relative;overflow:visible}.sun-editor .se-tooltip .se-tooltip-inner{visibility:hidden;position:absolute;display:block;width:auto;top:120%;left:50%;background:transparent;opacity:0;z-index:1;line-height:1.5;transition:opacity .5s;margin:0;padding:0;bottom:auto;float:none;pointer-events:none;backface-visibility:hidden;-webkit-backface-visibility:hidden;-moz-backface-visibility:hidden}.sun-editor .se-tooltip .se-tooltip-inner .se-tooltip-text{position:relative;display:inline-block;width:auto;left:-50%;font-size:.9em;margin:0;padding:4px 6px;border-radius:2px;background-color:#333;color:#fff;text-align:center;line-height:unset;white-space:nowrap;cursor:auto}.sun-editor .se-tooltip .se-tooltip-inner .se-tooltip-text:after{content:"";position:absolute;bottom:100%;left:50%;margin-left:-5px;border:5px solid transparent;border-bottom-color:#333}.sun-editor .se-tooltip:hover .se-tooltip-inner{visibility:visible;opacity:1}@keyframes blinker{50%{opacity:0}}@keyframes spinner{to{transform:rotate(361deg)}}.sun-editor-editable{font-family:Helvetica Neue,sans-serif;font-size:13px;color:#333;line-height:1.5;text-align:left;background-color:#fff;word-break:normal;word-wrap:break-word;padding:16px;margin:0}.sun-editor-editable *{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;font-family:inherit;font-size:inherit;color:inherit}.sun-editor-editable audio,.sun-editor-editable figcaption,.sun-editor-editable figure,.sun-editor-editable iframe,.sun-editor-editable img,.sun-editor-editable td,.sun-editor-editable th,.sun-editor-editable video{position:relative}.sun-editor-editable .__se__float-left{float:left}.sun-editor-editable .__se__float-right{float:right}.sun-editor-editable .__se__float-center{float:center}.sun-editor-editable .__se__float-none{float:none}.sun-editor-editable :not(.se-code-language .katex) span{display:inline;vertical-align:baseline;margin:0;padding:0}.sun-editor-editable span.katex{display:inline-block}.sun-editor-editable a{color:#004cff;text-decoration:none}.sun-editor-editable span[style~="color:"] a{color:inherit}.sun-editor-editable a:focus,.sun-editor-editable a:hover{cursor:pointer;color:#0093ff;text-decoration:underline}.sun-editor-editable pre{display:block;padding:8px;margin:0 0 10px;font-family:monospace;color:#666;line-height:1.45;background-color:#f9f9f9;border:1px solid #e1e1e1;border-radius:2px;white-space:pre-wrap;word-wrap:break-word;overflow:visible}.sun-editor-editable ol{list-style-type:decimal}.sun-editor-editable ol,.sun-editor-editable ul{display:block;margin-block-start:1em;margin-block-end:1em;margin-inline-start:0;margin-inline-end:0;padding-inline-start:40px}.sun-editor-editable ul{list-style-type:disc}.sun-editor-editable li{display:list-item;text-align:-webkit-match-parent;margin-bottom:5px}.sun-editor-editable ol ol,.sun-editor-editable ol ul,.sun-editor-editable ul ol,.sun-editor-editable ul ul{margin:0}.sun-editor-editable ol ol,.sun-editor-editable ul ol{list-style-type:lower-alpha}.sun-editor-editable ol ol ol,.sun-editor-editable ul ol ol,.sun-editor-editable ul ul ol{list-style-type:upper-roman}.sun-editor-editable ol ul,.sun-editor-editable ul ul{list-style-type:circle}.sun-editor-editable ol ol ul,.sun-editor-editable ol ul ul,.sun-editor-editable ul ul ul{list-style-type:square}.sun-editor-editable sub,.sun-editor-editable sup{font-size:75%;line-height:0}.sun-editor-editable sub{vertical-align:sub}.sun-editor-editable sup{vertical-align:super}.sun-editor-editable p{display:block;margin:0 0 10px}.sun-editor-editable div{display:block;margin:0;padding:0}.sun-editor-editable blockquote{display:block;font-family:inherit;font-size:inherit;color:#999;margin-block-start:1em;margin-block-end:1em;margin-inline-start:0;margin-inline-end:0;padding:0 5px 0 20px;border:solid #b1b1b1;border-width:0 0 0 5px}.sun-editor-editable blockquote blockquote{border-color:#c1c1c1}.sun-editor-editable blockquote blockquote blockquote{border-color:#d1d1d1}.sun-editor-editable blockquote blockquote blockquote blockquote{border-color:#e1e1e1}.sun-editor-editable h1{font-size:2em;margin-block-start:.67em;margin-block-end:.67em}.sun-editor-editable h1,.sun-editor-editable h2{display:block;margin-inline-start:0;margin-inline-end:0;font-weight:700}.sun-editor-editable h2{font-size:1.5em;margin-block-start:.83em;margin-block-end:.83em}.sun-editor-editable h3{font-size:1.17em;margin-block-start:1em;margin-block-end:1em}.sun-editor-editable h3,.sun-editor-editable h4{display:block;margin-inline-start:0;margin-inline-end:0;font-weight:700}.sun-editor-editable h4{font-size:1em;margin-block-start:1.33em;margin-block-end:1.33em}.sun-editor-editable h5{font-size:.83em;margin-block-start:1.67em;margin-block-end:1.67em}.sun-editor-editable h5,.sun-editor-editable h6{display:block;margin-inline-start:0;margin-inline-end:0;font-weight:700}.sun-editor-editable h6{font-size:.67em;margin-block-start:2.33em;margin-block-end:2.33em}.sun-editor-editable hr{display:flex;border-width:1px 0 0;border-color:#000;border-image:initial;height:1px}.sun-editor-editable hr.__se__solid{border-style:solid none none}.sun-editor-editable hr.__se__dotted{border-style:dotted none none}.sun-editor-editable hr.__se__dashed{border-style:dashed none none}.sun-editor-editable table{display:table;table-layout:auto;border:1px solid #ccc;width:100%;max-width:100%;margin:0 0 10px;background-color:transparent;border-spacing:0;border-collapse:collapse}.sun-editor-editable table thead{border-bottom:2px solid #333}.sun-editor-editable table tr{border:1px solid #efefef}.sun-editor-editable table th{background-color:#f3f3f3}.sun-editor-editable table td,.sun-editor-editable table th{border:1px solid #e1e1e1;padding:.4em;background-clip:padding-box}.sun-editor-editable table.se-table-size-auto{width:auto!important}.sun-editor-editable table.se-table-size-100{width:100%!important}.sun-editor-editable table.se-table-layout-auto{table-layout:auto!important}.sun-editor-editable table.se-table-layout-fixed{table-layout:fixed!important}.sun-editor-editable table td.se-table-selected-cell,.sun-editor-editable table th.se-table-selected-cell{border:1px double #4592ff;background-color:#f1f7ff}.sun-editor-editable.se-disabled *{user-select:none;-o-user-select:none;-moz-user-select:none;-khtml-user-select:none;-webkit-user-select:none;-ms-user-select:none}.sun-editor-editable .se-component{display:flex;padding:1px;margin:0 0 10px}.sun-editor-editable .se-component.__se__float-left{margin:0 20px 10px 0}.sun-editor-editable .se-component.__se__float-right{margin:0 0 10px 20px}.sun-editor-editable[contenteditable=true] .se-component{outline:1px dashed #e1e1e1}.sun-editor-editable[contenteditable=true] .se-component.se-component-copy{-webkit-box-shadow:0 0 0 .2rem #80bdff;box-shadow:0 0 0 .2rem #3f9dff;transition:border-color .15s ease-in-out,box-shadow .15s ease-in-out}.sun-editor-editable audio,.sun-editor-editable iframe,.sun-editor-editable img,.sun-editor-editable video{display:block;margin:0;padding:0;width:auto;height:auto;max-width:100%}.sun-editor-editable[contenteditable=true] figure:after{position:absolute;content:"";z-index:1;top:0;left:0;right:0;bottom:0;cursor:default;display:block;background:transparent}.sun-editor-editable[contenteditable=true] figure a,.sun-editor-editable[contenteditable=true] figure iframe,.sun-editor-editable[contenteditable=true] figure img,.sun-editor-editable[contenteditable=true] figure video{z-index:0}.sun-editor-editable[contenteditable=true] figure figcaption{display:block;z-index:2}.sun-editor-editable[contenteditable=true] figure figcaption:focus{border-color:#80bdff;outline:0;-webkit-box-shadow:0 0 0 .2rem #c7deff;box-shadow:0 0 0 .2rem #c7deff}.sun-editor-editable .se-image-container,.sun-editor-editable .se-video-container{width:auto;height:auto;max-width:100%}.sun-editor-editable figure{display:block;outline:none;margin:0;padding:0}.sun-editor-editable figure figcaption{padding:1em .5em;margin:0;background-color:#f9f9f9;outline:none}.sun-editor-editable figure figcaption p{line-height:2;margin:0}.sun-editor-editable .se-image-container a img{padding:1px;margin:1px;outline:1px solid #4592ff}.sun-editor-editable .se-video-container iframe,.sun-editor-editable .se-video-container video{outline:1px solid #9e9e9e;position:absolute;top:0;left:0;border:0;width:100%;height:100%}.sun-editor-editable .se-video-container figure{left:0;width:100%;max-width:100%}.sun-editor-editable audio{width:300px;height:54px}.sun-editor-editable audio.active{outline:2px solid #80bdff}.sun-editor-editable.se-show-block div,.sun-editor-editable.se-show-block h1,.sun-editor-editable.se-show-block h2,.sun-editor-editable.se-show-block h3,.sun-editor-editable.se-show-block h4,.sun-editor-editable.se-show-block h5,.sun-editor-editable.se-show-block h6,.sun-editor-editable.se-show-block li,.sun-editor-editable.se-show-block ol,.sun-editor-editable.se-show-block p,.sun-editor-editable.se-show-block pre,.sun-editor-editable.se-show-block ul{border:1px dashed #3f9dff!important;padding:14px 8px 8px!important}.sun-editor-editable.se-show-block ol,.sun-editor-editable.se-show-block ul{border:1px dashed #d539ff!important}.sun-editor-editable.se-show-block pre{border:1px dashed #27c022!important}.se-show-block p{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAAPAQMAAAAF7dc0AAAABlBMVEWAgID////n1o2sAAAAAnRSTlP/AOW3MEoAAAAaSURBVAjXY/j/gwGCPvxg+F4BQiAGDP1HQQByxxw0gqOzIwAAAABJRU5ErkJggg==") no-repeat}.se-show-block div{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABUAAAAPAQMAAAAxlBYoAAAABlBMVEWAgID////n1o2sAAAAAnRSTlP/AOW3MEoAAAAmSURBVAjXY/j//wcDDH+8XsHwDYi/hwNx1A8w/nYLKH4XoQYJAwCXnSgcl2MOPgAAAABJRU5ErkJggg==") no-repeat}.se-show-block h1{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAPAQMAAAA4f7ZSAAAABlBMVEWAgID////n1o2sAAAAAnRSTlP/AOW3MEoAAAAfSURBVAjXY/j/v4EBhr+9B+LzEPrDeygfhI8j1CBhAEhmJGY4Rf6uAAAAAElFTkSuQmCC") no-repeat}.se-show-block h2{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAPAQMAAAA4f7ZSAAAABlBMVEWAgID////n1o2sAAAAAnRSTlP/AOW3MEoAAAAmSURBVAjXY/j/v4EBhr+dB+LtQPy9geEDEH97D8T3gbgdoQYJAwA51iPuD2haEAAAAABJRU5ErkJggg==") no-repeat}.se-show-block h3{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAPAQMAAAA4f7ZSAAAABlBMVEWAgID////n1o2sAAAAAnRSTlP/AOW3MEoAAAAiSURBVAjXY/j/v4EBhr+dB+LtQPy9geHDeQgN5p9HqEHCADeWI+69VG2MAAAAAElFTkSuQmCC") no-repeat}.se-show-block h4{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAAPAQMAAADTSA1RAAAABlBMVEWAgID////n1o2sAAAAAnRSTlP/AOW3MEoAAAAiSURBVAjXY/j//wADDH97DsTXIfjDdiDdDMTfIRhZHRQDAKJOJ6L+K3y7AAAAAElFTkSuQmCC") no-repeat}.se-show-block h5{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAPAQMAAAA4f7ZSAAAABlBMVEWAgID////n1o2sAAAAAnRSTlP/AOW3MEoAAAAlSURBVAjXY/j/v4EBhr+1A/F+IO5vYPiwHUh/B2IQfR6hBgkDABlWIy5uM+9GAAAAAElFTkSuQmCC") no-repeat}.se-show-block h6{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAPAQMAAAA4f7ZSAAAABlBMVEWAgID////n1o2sAAAAAnRSTlP/AOW3MEoAAAAiSURBVAjXY/j/v4EBhr+dB+LtQLy/geFDP5S9HSKOrA6KAR9GIza1ptJnAAAAAElFTkSuQmCC") no-repeat}.se-show-block li{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAPCAYAAADkmO9VAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAA7SURBVDhPYxgFcNDQ0PAfykQBIHEYhgoRB/BpwCfHBKWpBkaggYxQGgOgBzyQD1aLLA4TGwWDGjAwAACR3RcEU9Ui+wAAAABJRU5ErkJggg==") no-repeat}.se-show-block ol{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAMCAYAAABiDJ37AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAABHSURBVDhPYxgFcNDQ0PAfhKFcFIBLHCdA1oBNM0kGEmMAPgOZoDTVANUNxAqQvURMECADRiiNAWCagDSGGhyW4DRrMAEGBgAu0SX6WpGgjAAAAABJRU5ErkJggg==") no-repeat}.se-show-block ul{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAMCAYAAABiDJ37AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAA1SURBVDhPYxgFDA0NDf+hTBSALI5LDQgwQWmqgVEDKQcsUBoF4ItFGEBXA+QzQpmDGjAwAAA8DQ4Lni6gdAAAAABJRU5ErkJggg==") no-repeat}.sun-editor-editable .__se__p-bordered,.sun-editor .__se__p-bordered{border-top:1px solid #b1b1b1;border-bottom:1px solid #b1b1b1;padding:4px 0}.sun-editor-editable .__se__p-spaced,.sun-editor .__se__p-spaced{letter-spacing:1px}.sun-editor-editable .__se__p-neon,.sun-editor .__se__p-neon{font-weight:200;font-style:italic;background:#000;color:#fff;padding:6px 4px;border:2px solid #fff;border-radius:6px;text-transform:uppercase;animation:neonFlicker 1.5s infinite alternate}@keyframes neonFlicker{0%,19%,21%,23%,25%,54%,56%,to{text-shadow:-.2rem -.2rem 1rem #fff,.2rem .2rem 1rem #fff,0 0 2px #f40,0 0 4px #f40,0 0 6px #f40,0 0 8px #f40,0 0 10px #f40;box-shadow:0 0 .5px #fff,inset 0 0 .5px #fff,0 0 2px #08f,inset 0 0 2px #08f,0 0 4px #08f,inset 0 0 4px #08f}20%,24%,55%{text-shadow:none;box-shadow:none}}.sun-editor-editable .__se__t-shadow,.sun-editor .__se__t-shadow{text-shadow:-.2rem -.2rem 1rem #fff,.2rem .2rem 1rem #fff,0 0 .2rem #999,0 0 .4rem #888,0 0 .6rem #777,0 0 .8rem #666,0 0 1rem #555}.sun-editor-editable .__se__t-code,.sun-editor .__se__t-code{font-family:monospace;color:#666;background-color:rgba(27,31,35,.05);border-radius:6px;padding:.2em .4em} \ No newline at end of file diff --git a/dist/suneditor.min.js b/dist/suneditor.min.js index fb4be9c88..068923523 100644 --- a/dist/suneditor.min.js +++ b/dist/suneditor.min.js @@ -1,2 +1,2 @@ -!function(e){var t={};function n(i){if(t[i])return t[i].exports;var l=t[i]={i:i,l:!1,exports:{}};return e[i].call(l.exports,l,l.exports,n),l.l=!0,l.exports}n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var l in e)n.d(i,l,function(t){return e[t]}.bind(null,l));return i},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s="XJR1")}({"1kvd":function(e,t,n){"use strict";var i,l;i="undefined"!=typeof window?window:this,l=function(e,t){const n={name:"dialog",add:function(e){const t=e.context;t.dialog={kind:"",updateModal:!1,_closeSignal:!1};let n=e.util.createElement("DIV");n.className="se-dialog sun-editor-common";let i=e.util.createElement("DIV");i.className="se-dialog-back",i.style.display="none";let l=e.util.createElement("DIV");l.className="se-dialog-inner",l.style.display="none",n.appendChild(i),n.appendChild(l),t.dialog.modalArea=n,t.dialog.back=i,t.dialog.modal=l,t.dialog.modal.addEventListener("mousedown",this._onMouseDown_dialog.bind(e)),t.dialog.modal.addEventListener("click",this._onClick_dialog.bind(e)),t.element.relative.appendChild(n),n=null,i=null,l=null},_onMouseDown_dialog:function(e){/se-dialog-inner/.test(e.target.className)?this.context.dialog._closeSignal=!0:this.context.dialog._closeSignal=!1},_onClick_dialog:function(e){e.stopPropagation(),(/close/.test(e.target.getAttribute("data-command"))||this.context.dialog._closeSignal)&&this.plugins.dialog.close.call(this)},open:function(e,t){if(this.modalForm)return!1;this.plugins.dialog._bindClose&&(this._d.removeEventListener("keydown",this.plugins.dialog._bindClose),this.plugins.dialog._bindClose=null),this.plugins.dialog._bindClose=function(e){/27/.test(e.keyCode)&&this.plugins.dialog.close.call(this)}.bind(this),this._d.addEventListener("keydown",this.plugins.dialog._bindClose),this.context.dialog.updateModal=t,"full"===this.context.option.popupDisplay?this.context.dialog.modalArea.style.position="fixed":this.context.dialog.modalArea.style.position="absolute",this.context.dialog.kind=e,this.modalForm=this.context[e].modal;const n=this.context[e].focusElement;"function"==typeof this.plugins[e].on&&this.plugins[e].on.call(this,t),this.context.dialog.modalArea.style.display="block",this.context.dialog.back.style.display="block",this.context.dialog.modal.style.display="block",this.modalForm.style.display="block",n&&n.focus()},_bindClose:null,close:function(){this.plugins.dialog._bindClose&&(this._d.removeEventListener("keydown",this.plugins.dialog._bindClose),this.plugins.dialog._bindClose=null);const e=this.context.dialog.kind;this.modalForm.style.display="none",this.context.dialog.back.style.display="none",this.context.dialog.modalArea.style.display="none",this.context.dialog.updateModal=!1,"function"==typeof this.plugins[e].init&&this.plugins[e].init.call(this),this.context.dialog.kind="",this.modalForm=null,this.focus()}};return void 0===t&&(e.SUNEDITOR_MODULES||Object.defineProperty(e,"SUNEDITOR_MODULES",{enumerable:!0,writable:!1,configurable:!1,value:{}}),Object.defineProperty(e.SUNEDITOR_MODULES,"dialog",{enumerable:!0,writable:!1,configurable:!1,value:n})),n},"object"==typeof e.exports?e.exports=i.document?l(i,!0):function(e){if(!e.document)throw new Error("SUNEDITOR_MODULES a window with a document");return l(e)}:l(i)},"3FqI":function(e,t,n){},JhlZ:function(e,t,n){"use strict";var i,l;i="undefined"!=typeof window?window:this,l=function(e,t){const n={name:"fileBrowser",_xmlHttp:null,_loading:null,add:function(e){const t=e.context;t.fileBrowser={_closeSignal:!1,area:null,header:null,tagArea:null,body:null,list:null,tagElements:null,items:[],selectedTags:[],selectorHandler:null,contextPlugin:"",columnSize:4};let n=e.util.createElement("DIV");n.className="se-file-browser sun-editor-common";let i=e.util.createElement("DIV");i.className="se-file-browser-back";let l=e.util.createElement("DIV");l.className="se-file-browser-inner",l.innerHTML=this.set_browser(e),n.appendChild(i),n.appendChild(l),this._loading=n.querySelector(".se-loading-box"),t.fileBrowser.area=n,t.fileBrowser.header=l.querySelector(".se-file-browser-header"),t.fileBrowser.titleArea=l.querySelector(".se-file-browser-title"),t.fileBrowser.tagArea=l.querySelector(".se-file-browser-tags"),t.fileBrowser.body=l.querySelector(".se-file-browser-body"),t.fileBrowser.list=l.querySelector(".se-file-browser-list"),t.fileBrowser.tagArea.addEventListener("click",this.onClickTag.bind(e)),t.fileBrowser.list.addEventListener("click",this.onClickFile.bind(e)),l.addEventListener("mousedown",this._onMouseDown_browser.bind(e)),l.addEventListener("click",this._onClick_browser.bind(e)),t.element.relative.appendChild(n),n=null,i=null,l=null},set_browser:function(e){return'
    '},_onMouseDown_browser:function(e){/se-file-browser-inner/.test(e.target.className)?this.context.fileBrowser._closeSignal=!0:this.context.fileBrowser._closeSignal=!1},_onClick_browser:function(e){e.stopPropagation(),(/close/.test(e.target.getAttribute("data-command"))||this.context.fileBrowser._closeSignal)&&this.plugins.fileBrowser.close.call(this)},open:function(e,t){this.plugins.fileBrowser._bindClose&&(this._d.removeEventListener("keydown",this.plugins.fileBrowser._bindClose),this.plugins.fileBrowser._bindClose=null),this.plugins.fileBrowser._bindClose=function(e){/27/.test(e.keyCode)&&this.plugins.fileBrowser.close.call(this)}.bind(this),this._d.addEventListener("keydown",this.plugins.fileBrowser._bindClose);const n=this.context.fileBrowser;n.contextPlugin=e,n.selectorHandler=t;const i=this.context[e],l=i.listClass;this.util.hasClass(n.list,l)||(n.list.className="se-file-browser-list "+l),"full"===this.context.option.popupDisplay?n.area.style.position="fixed":n.area.style.position="absolute",n.titleArea.textContent=i.title,n.area.style.display="block",this.plugins.fileBrowser._drawFileList.call(this,this.context[e].url)},_bindClose:null,close:function(){const e=this.plugins.fileBrowser;e._xmlHttp&&e._xmlHttp.abort(),e._bindClose&&(this._d.removeEventListener("keydown",e._bindClose),e._bindClose=null);const t=this.context.fileBrowser;t.area.style.display="none",t.selectorHandler=null,t.selectedTags=[],t.items=[],t.list.innerHTML=t.tagArea.innerHTML=t.titleArea.textContent="","function"==typeof this.plugins[t.contextPlugin].init&&this.plugins[t.contextPlugin].init.call(this),t.contextPlugin=""},showBrowserLoading:function(){this._loading.style.display="block"},closeBrowserLoading:function(){this._loading.style.display="none"},_drawFileList:function(e){const t=this.plugins.fileBrowser,n=t._xmlHttp=this.util.getXMLHttpRequest();n.onreadystatechange=t._callBackGet.bind(this,n),n.open("get",e,!0),n.send(null),this.plugins.fileBrowser.showBrowserLoading()},_callBackGet:function(e){if(4===e.readyState)if(this.plugins.fileBrowser._xmlHttp=null,200===e.status)try{this.plugins.fileBrowser._drawListItem.call(this,JSON.parse(e.responseText).result,!0)}catch(e){throw Error('[SUNEDITOR.fileBrowser.drawList.fail] cause : "'+e.message+'"')}finally{this.plugins.fileBrowser.closeBrowserLoading(),this.context.fileBrowser.body.style.maxHeight=this._w.innerHeight-this.context.fileBrowser.header.offsetHeight-50+"px"}else if(this.plugins.fileBrowser.closeBrowserLoading(),0!==e.status){const t=e.responseText?JSON.parse(e.responseText):e,n="[SUNEDITOR.fileBrowser.get.serverException] status: "+e.status+", response: "+(t.errorMessage||e.responseText);throw Error(n)}},_drawListItem:function(e,t){const n=this.context.fileBrowser,i=this.context[n.contextPlugin],l=[],o=e.length,s=i.columnSize||n.columnSize,a=s<=1?1:Math.round(o/s)||1,r=i.itemTemplateHandler;let c="",d='
    ',u=1;for(let n,i,h=0;h
    '),t&&i.length>0)for(let e,t=0,n=i.length;t'+e+"");d+="
    ",n.list.innerHTML=d,t&&(n.items=e,n.tagArea.innerHTML=c,n.tagElements=n.tagArea.querySelectorAll("A"))},onClickTag:function(e){const t=e.target;if(!this.util.isAnchor(t))return;const n=t.textContent,i=this.plugins.fileBrowser,l=this.context.fileBrowser,o=l.tagArea.querySelector('a[title="'+n+'"]'),s=l.selectedTags,a=s.indexOf(n);a>-1?(s.splice(a,1),this.util.removeClass(o,"on")):(s.push(n),this.util.addClass(o,"on")),i._drawListItem.call(this,0===s.length?l.items:l.items.filter((function(e){return e.tag.some((function(e){return s.indexOf(e)>-1}))})),!1)},onClickFile:function(e){e.preventDefault(),e.stopPropagation();const t=this.context.fileBrowser,n=t.list;let i=e.target,l=null;if(i===n)return;for(;n!==i.parentNode&&(l=i.getAttribute("data-command"),!l);)i=i.parentNode;if(!l)return;const o=t.selectorHandler||this.context[t.contextPlugin].selectorHandler;this.plugins.fileBrowser.close.call(this),o(i)}};return void 0===t&&(e.SUNEDITOR_MODULES||Object.defineProperty(e,"SUNEDITOR_MODULES",{enumerable:!0,writable:!1,configurable:!1,value:{}}),Object.defineProperty(e.SUNEDITOR_MODULES,"fileBrowser",{enumerable:!0,writable:!1,configurable:!1,value:n})),n},"object"==typeof e.exports?e.exports=i.document?l(i,!0):function(e){if(!e.document)throw new Error("SUNEDITOR_MODULES a window with a document");return l(e)}:l(i)},P6u4:function(e,t,n){"use strict";var i,l;i="undefined"!=typeof window?window:this,l=function(e,t){const n={code:"en",toolbar:{default:"Default",save:"Save",font:"Font",formats:"Formats",fontSize:"Size",bold:"Bold",underline:"Underline",italic:"Italic",strike:"Strike",subscript:"Subscript",superscript:"Superscript",removeFormat:"Remove Format",fontColor:"Font Color",hiliteColor:"Highlight Color",indent:"Indent",outdent:"Outdent",align:"Align",alignLeft:"Align left",alignRight:"Align right",alignCenter:"Align center",alignJustify:"Align justify",list:"List",orderList:"Ordered list",unorderList:"Unordered list",horizontalRule:"Horizontal line",hr_solid:"Solid",hr_dotted:"Dotted",hr_dashed:"Dashed",table:"Table",link:"Link",math:"Math",image:"Image",video:"Video",audio:"Audio",fullScreen:"Full screen",showBlocks:"Show blocks",codeView:"Code view",undo:"Undo",redo:"Redo",preview:"Preview",print:"print",tag_p:"Paragraph",tag_div:"Normal (DIV)",tag_h:"Header",tag_blockquote:"Quote",tag_pre:"Code",template:"Template",lineHeight:"Line height",paragraphStyle:"Paragraph style",textStyle:"Text style",imageGallery:"Image gallery"},dialogBox:{linkBox:{title:"Insert Link",url:"URL to link",text:"Text to display",newWindowCheck:"Open in new window"},mathBox:{title:"Math",inputLabel:"Mathematical Notation",fontSizeLabel:"Font Size",previewLabel:"Preview"},imageBox:{title:"Insert image",file:"Select from files",url:"Image URL",altText:"Alternative text"},videoBox:{title:"Insert Video",file:"Select from files",url:"Media embed URL, YouTube/Vimeo"},audioBox:{title:"Insert Audio",file:"Select from files",url:"Audio URL"},browser:{tags:"Tags",search:"Search"},mentionBox:{title:"Add Mention"},caption:"Insert description",close:"Close",submitButton:"Submit",revertButton:"Revert",proportion:"Constrain proportions",basic:"Basic",left:"Left",right:"Right",center:"Center",width:"Width",height:"Height",size:"Size",ratio:"Ratio"},controller:{edit:"Edit",unlink:"Unlink",remove:"Remove",insertRowAbove:"Insert row above",insertRowBelow:"Insert row below",deleteRow:"Delete row",insertColumnBefore:"Insert column before",insertColumnAfter:"Insert column after",deleteColumn:"Delete column",fixedColumnWidth:"Fixed column width",resize100:"Resize 100%",resize75:"Resize 75%",resize50:"Resize 50%",resize25:"Resize 25%",autoSize:"Auto size",mirrorHorizontal:"Mirror, Horizontal",mirrorVertical:"Mirror, Vertical",rotateLeft:"Rotate left",rotateRight:"Rotate right",maxSize:"Max size",minSize:"Min size",tableHeader:"Table header",mergeCells:"Merge cells",splitCells:"Split Cells",HorizontalSplit:"Horizontal split",VerticalSplit:"Vertical split"},menu:{spaced:"Spaced",bordered:"Bordered",neon:"Neon",translucent:"Translucent",shadow:"Shadow",code:"Code"}};return void 0===t&&(e.SUNEDITOR_LANG||Object.defineProperty(e,"SUNEDITOR_LANG",{enumerable:!0,writable:!1,configurable:!1,value:{}}),Object.defineProperty(e.SUNEDITOR_LANG,"en",{enumerable:!0,writable:!0,configurable:!0,value:n})),n},"object"==typeof e.exports?e.exports=i.document?l(i,!0):function(e){if(!e.document)throw new Error("SUNEDITOR_LANG a window with a document");return l(e)}:l(i)},WUQj:function(e,t,n){},XJR1:function(e,t,n){"use strict";n.r(t);n("3FqI"),n("WUQj");var i={name:"colorPicker",add:function(e){const t=e.context;t.colorPicker={colorListHTML:"",_colorInput:"",_defaultColor:"#000",_styleProperty:"color",_currentColor:"",_colorList:[]};let n=this.createColorList(e,this._makeColorList);t.colorPicker.colorListHTML=n,n=null},createColorList:function(e,t){const n=e.context.option,i=e.lang,l=n.colorList&&0!==n.colorList.length?n.colorList:["#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"];let o=[],s='
    ';for(let e,n=0,i=l.length;n0&&(s+='
    '+t(o)+"
    ",o=[]),"object"==typeof e&&(s+='
    '+t(e)+"
    ")));return s+='
    ",s},_makeColorList:function(e){let t="";t+='
      ';for(let n,i=0,l=e.length;i');return t+="
    ",t},init:function(e,t){const n=this.plugins.colorPicker;let i=t||(n.getColorInNode.call(this,e)||this.context.colorPicker._defaultColor);i=n.isHexColor(i)?i:n.rgb2hex(i)||i;const l=this.context.colorPicker._colorList;if(l)for(let e=0,t=l.length;e=3&&"#"+((1<<24)+(n[0]<<16)+(n[1]<<8)+n[2]).toString(16).substr(1)}},l={name:"fontColor",display:"submenu",add:function(e,t){e.addModule([i]);const n=e.context;n.fontColor={previewEl:null,colorInput:null,colorList:null};let l=this.setSubmenu.call(e);n.fontColor.colorInput=l.querySelector("._se_color_picker_input"),n.fontColor.colorInput.addEventListener("keyup",this.onChangeInput.bind(e)),l.querySelector("._se_color_picker_submit").addEventListener("click",this.submit.bind(e)),l.querySelector("._se_color_picker_remove").addEventListener("click",this.remove.bind(e)),l.addEventListener("click",this.pickup.bind(e)),n.fontColor.colorList=l.querySelectorAll("li button"),e.initMenuTarget(this.name,t,l),l=null},setSubmenu:function(){const e=this.context.colorPicker.colorListHTML,t=this.util.createElement("DIV");return t.className="se-submenu se-list-layer",t.innerHTML=e,t},on:function(){const e=this.context.colorPicker,t=this.context.fontColor;e._colorInput=t.colorInput,e._defaultColor="#333333",e._styleProperty="color",e._colorList=t.colorList,this.plugins.colorPicker.init.call(this,this.getSelectionNode(),null)},onChangeInput:function(e){this.plugins.colorPicker.setCurrentColor.call(this,e.target.value)},submit:function(){this.plugins.fontColor.applyColor.call(this,this.context.colorPicker._currentColor)},pickup:function(e){e.preventDefault(),e.stopPropagation(),this.plugins.fontColor.applyColor.call(this,e.target.getAttribute("data-value"))},remove:function(){this.nodeChange(null,["color"],["span"],!0),this.submenuOff()},applyColor:function(e){if(!e)return;const t=this.util.createElement("SPAN");t.style.color=e,this.nodeChange(t,["color"],null,null),this.submenuOff()}},o={name:"hiliteColor",display:"submenu",add:function(e,t){e.addModule([i]);const n=e.context;n.hiliteColor={previewEl:null,colorInput:null,colorList:null};let l=this.setSubmenu.call(e);n.hiliteColor.colorInput=l.querySelector("._se_color_picker_input"),n.hiliteColor.colorInput.addEventListener("keyup",this.onChangeInput.bind(e)),l.querySelector("._se_color_picker_submit").addEventListener("click",this.submit.bind(e)),l.querySelector("._se_color_picker_remove").addEventListener("click",this.remove.bind(e)),l.addEventListener("click",this.pickup.bind(e)),n.hiliteColor.colorList=l.querySelectorAll("li button"),e.initMenuTarget(this.name,t,l),l=null},setSubmenu:function(){const e=this.context.colorPicker.colorListHTML,t=this.util.createElement("DIV");return t.className="se-submenu se-list-layer",t.innerHTML=e,t},on:function(){const e=this.context.colorPicker,t=this.context.hiliteColor;e._colorInput=t.colorInput,e._defaultColor="#FFFFFF",e._styleProperty="backgroundColor",e._colorList=t.colorList,this.plugins.colorPicker.init.call(this,this.getSelectionNode(),null)},onChangeInput:function(e){this.plugins.colorPicker.setCurrentColor.call(this,e.target.value)},submit:function(){this.plugins.hiliteColor.applyColor.call(this,this.context.colorPicker._currentColor)},pickup:function(e){e.preventDefault(),e.stopPropagation(),this.plugins.hiliteColor.applyColor.call(this,e.target.getAttribute("data-value"))},remove:function(){this.nodeChange(null,["background-color"],["span"],!0),this.submenuOff()},applyColor:function(e){if(!e)return;const t=this.util.createElement("SPAN");t.style.backgroundColor=e,this.nodeChange(t,["background-color"],null,null),this.submenuOff()}},s={name:"template",display:"submenu",add:function(e,t){e.context.template={};let n=this.setSubmenu.call(e);n.querySelector("ul").addEventListener("click",this.pickup.bind(e)),e.initMenuTarget(this.name,t,n),n=null},setSubmenu:function(){const e=this.context.option.templates;if(!e||0===e.length)throw Error('[SUNEDITOR.plugins.template.fail] To use the "template" plugin, please define the "templates" option.');const t=this.util.createElement("DIV");t.className="se-list-layer";let n='
      ';for(let t,i=0,l=e.length;i";return n+="
    ",t.innerHTML=n,t},pickup:function(e){if(!/^BUTTON$/i.test(e.target.tagName))return!1;e.preventDefault(),e.stopPropagation();const t=this.context.option.templates[e.target.getAttribute("data-value")];if(!t.html)throw this.submenuOff(),Error('[SUNEDITOR.template.fail] cause : "templates[i].html not found"');this.setContents(t.html),this.submenuOff()}},a=n("1kvd"),r=n.n(a),c={name:"link",display:"dialog",add:function(e){e.addModule([r.a]);const t=e.context;t.link={focusElement:null,linkNewWindowCheck:null,linkAnchorText:null,_linkAnchor:null,_linkValue:""};let n=this.setDialog.call(e);t.link.modal=n,t.link.focusElement=n.querySelector("._se_link_url"),t.link.linkAnchorText=n.querySelector("._se_link_text"),t.link.linkNewWindowCheck=n.querySelector("._se_link_check"),t.link.preview=n.querySelector(".se-link-preview");let i=this.setController_LinkButton.call(e);t.link.linkController=i,t.link._linkAnchor=null,i.addEventListener("mousedown",e.eventStop),n.querySelector(".se-btn-primary").addEventListener("click",this.submit.bind(e)),i.addEventListener("click",this.onClick_linkController.bind(e)),t.link.focusElement.addEventListener("input",this._onLinkPreview.bind(t.link.preview,t.link,t.options.linkProtocol)),t.dialog.modal.appendChild(n),t.element.relative.appendChild(i),n=null,i=null},setDialog:function(){const e=this.lang,t=this.util.createElement("DIV");return t.className="se-dialog-content",t.style.display="none",t.innerHTML='",t},setController_LinkButton:function(){const e=this.lang,t=this.icons,n=this.util.createElement("DIV");return n.className="se-controller se-controller-link",n.innerHTML='
    ",n},open:function(){this.plugins.dialog.open.call(this,"link","link"===this.currentControllerName)},_onLinkPreview:function(e,t,n){const i=n.target.value.trim();e._linkValue=this.textContent=i?t&&-1===i.indexOf("://")&&0!==i.indexOf("#")?t+i:-1===i.indexOf("://")?"/"+i:i:""},submit:function(e){this.showLoading(),e.preventDefault(),e.stopPropagation();const t=function(){const e=this.context.link;if(0===e._linkValue.length)return!1;const t=e._linkValue,n=e.linkAnchorText,i=0===n.value.length?t:n.value;if(this.context.dialog.updateModal){e._linkAnchor.href=t,e._linkAnchor.textContent=i,e._linkAnchor.target=e.linkNewWindowCheck.checked?"_blank":"";const n=e._linkAnchor.childNodes[0];this.setRange(n,0,n,n.textContent.length)}else{const n=this.util.createElement("A");n.href=t,n.textContent=i,n.target=e.linkNewWindowCheck.checked?"_blank":"";const l=this.getSelectedElements();if(l.length>1){const e=this.util.createElement(l[0].nodeName);if(e.appendChild(n),!this.insertNode(e,null,!0))return}else if(!this.insertNode(n,null,!0))return;this.setRange(n.childNodes[0],0,n.childNodes[0],n.textContent.length)}e._linkValue=e.preview.textContent=e.focusElement.value=e.linkAnchorText.value=""}.bind(this);try{t()}finally{this.plugins.dialog.close.call(this),this.closeLoading(),this.history.push(!1)}return!1},active:function(e){if(e){if(this.util.isAnchor(e)&&null===e.getAttribute("data-image-link"))return this.controllerArray.indexOf(this.context.link.linkController)<0&&this.plugins.link.call_controller.call(this,e),!0}else this.controllerArray.indexOf(this.context.link.linkController)>-1&&this.controllersOff();return!1},on:function(e){const t=this.context.link;e?t._linkAnchor&&(this.context.dialog.updateModal=!0,t._linkValue=t.preview.textContent=t.focusElement.value=t._linkAnchor.href,t.linkAnchorText.value=t._linkAnchor.textContent,t.linkNewWindowCheck.checked=!!/_blank/i.test(t._linkAnchor.target)):(this.plugins.link.init.call(this),t.linkAnchorText.value=this.getSelection().toString())},call_controller:function(e){this.editLink=this.context.link._linkAnchor=e;const t=this.context.link.linkController,n=t.querySelector("a");n.href=e.href,n.title=e.textContent,n.textContent=e.textContent;const i=this.util.getOffset(e,this.context.element.wysiwygFrame);t.style.top=i.top+e.offsetHeight+10+"px",t.style.left=i.left-this.context.element.wysiwygFrame.scrollLeft+"px",t.style.display="block";const l=this.context.element.wysiwygFrame.offsetWidth-(t.offsetLeft+t.offsetWidth);l<0?(t.style.left=t.offsetLeft+l+"px",t.firstElementChild.style.left=20-l+"px"):t.firstElementChild.style.left="20px",this.controllersOn(t,e,"link")},onClick_linkController:function(e){e.stopPropagation();const t=e.target.getAttribute("data-command")||e.target.parentNode.getAttribute("data-command");if(t){if(e.preventDefault(),/update/.test(t)){const e=this.context.link;e._linkValue=e.preview.textContent=e.focusElement.value=e._linkAnchor.href,e.linkAnchorText.value=e._linkAnchor.textContent,e.linkNewWindowCheck.checked=!!/_blank/i.test(e._linkAnchor.target),this.plugins.dialog.open.call(this,"link",!0)}else if(/unlink/.test(t)){const e=this.util.getChildElement(this.context.link._linkAnchor,(function(e){return 0===e.childNodes.length||3===e.nodeType}),!1),t=this.util.getChildElement(this.context.link._linkAnchor,(function(e){return 0===e.childNodes.length||3===e.nodeType}),!0);this.setRange(e,0,t,t.textContent.length),this.nodeChange(null,null,["A"],!1)}else this.util.removeItem(this.context.link._linkAnchor),this.context.link._linkAnchor=null,this.focus(),this.history.push(!1);this.controllersOff()}},init:function(){const e=this.context.link;e.linkController.style.display="none",e._linkAnchor=null,e._linkValue=e.preview.textContent=e.focusElement.value="",e.linkAnchorText.value="",e.linkNewWindowCheck.checked=!1}},d=n("ZED3"),u=n.n(d),h=n("ee5k"),g=n.n(h),p=n("gjS+"),m=n.n(p),f={name:"image",display:"dialog",add:function(e){e.addModule([r.a,u.a,g.a,m.a]);const t=e.context,n=t.image={_infoList:[],_infoIndex:0,_uploadFileLength:0,sizeUnit:t.option._imageSizeUnit,_altText:"",_linkElement:null,_align:"none",_floatClassRegExp:"__se__float\\-[a-z]+",_v_link:{_linkValue:""},_v_src:{_linkValue:""},svgDefaultSize:"30%",_element:null,_cover:null,_container:null,inputX:null,inputY:null,_element_w:1,_element_h:1,_element_l:0,_element_t:0,_defaultSizeX:"auto",_defaultSizeY:"auto",_origin_w:"auto"===t.option.imageWidth?"":t.option.imageWidth,_origin_h:"auto"===t.option.imageHeight?"":t.option.imageHeight,_proportionChecked:!0,_resizing:t.option.imageResizing,_resizeDotHide:!t.option.imageHeightShow,_rotation:t.option.imageRotation,_onlyPercentage:t.option.imageSizeOnlyPercentage,_ratio:!1,_ratioX:1,_ratioY:1,_captionShow:!0,_captionChecked:!1,_caption:null,captionCheckEl:null};let i=this.setDialog.call(e);n.modal=i,n.imgInputFile=i.querySelector("._se_image_file"),n.imgUrlFile=i.querySelector(".se-input-url"),n.focusElement=n.imgInputFile||n.imgUrlFile,n.altText=i.querySelector("._se_image_alt"),n.imgLink=i.querySelector("._se_image_link"),n.imgLinkNewWindowCheck=i.querySelector("._se_image_link_check"),n.captionCheckEl=i.querySelector("._se_image_check_caption"),n.previewLink=i.querySelector("._se_tab_content_url .se-link-preview"),n.previewSrc=i.querySelector("._se_tab_content_image .se-link-preview"),i.querySelector(".se-dialog-tabs").addEventListener("click",this.openTab.bind(e)),i.querySelector(".se-btn-primary").addEventListener("click",this.submit.bind(e)),n.imgInputFile&&i.querySelector(".se-file-remove").addEventListener("click",this._removeSelectedFiles.bind(n.imgInputFile,n.imgUrlFile,n.previewSrc)),n.imgInputFile&&n.imgUrlFile&&n.imgInputFile.addEventListener("change",this._fileInputChange.bind(n)),n.imgLink.addEventListener("input",this._onLinkPreview.bind(n.previewLink,n._v_link,t.options.linkProtocol)),n.imgUrlFile&&n.imgUrlFile.addEventListener("input",this._onLinkPreview.bind(n.previewSrc,n._v_src,t.options.linkProtocol));const l=i.querySelector(".__se__gallery");l&&l.addEventListener("click",this._openGallery.bind(e)),n.proportion={},n.inputX={},n.inputY={},t.option.imageResizing&&(n.proportion=i.querySelector("._se_image_check_proportion"),n.inputX=i.querySelector("._se_image_size_x"),n.inputY=i.querySelector("._se_image_size_y"),n.inputX.value=t.option.imageWidth,n.inputY.value=t.option.imageHeight,n.inputX.addEventListener("keyup",this.setInputSize.bind(e,"x")),n.inputY.addEventListener("keyup",this.setInputSize.bind(e,"y")),n.inputX.addEventListener("change",this.setRatio.bind(e)),n.inputY.addEventListener("change",this.setRatio.bind(e)),n.proportion.addEventListener("change",this.setRatio.bind(e)),i.querySelector(".se-dialog-btn-revert").addEventListener("click",this.sizeRevert.bind(e))),t.dialog.modal.appendChild(i),i=null},setDialog:function(){const e=this.context.option,t=this.lang,n=this.util.createElement("DIV");n.className="se-dialog-content",n.style.display="none";let i='
    '+t.dialogBox.imageBox.title+'
    ';if(e.imageFileInput&&(i+='
    "),e.imageUrlInput&&(i+='
    '+(e.imageGalleryUrl&&this.plugins.imageGallery?'":"")+'
    '),i+='
    ',e.imageResizing){const n=e.imageSizeOnlyPercentage,l=n?' style="display: none !important;"':"",o=e.imageHeightShow?"":' style="display: none !important;"';i+='
    ',n||!e.imageHeightShow?i+='
    ":i+='
    ",i+=' '+t.dialogBox.proportion+'
    "}return i+='
    ",n.innerHTML=i,n},_fileInputChange:function(){this.imgInputFile.value?(this.imgUrlFile.setAttribute("disabled",!0),this.previewSrc.style.textDecoration="line-through"):(this.imgUrlFile.removeAttribute("disabled"),this.previewSrc.style.textDecoration="")},_removeSelectedFiles:function(e,t){this.value="",e&&(e.removeAttribute("disabled"),t.style.textDecoration="")},_openGallery:function(){this.callPlugin("imageGallery",this.plugins.imageGallery.open.bind(this,this.plugins.image._setUrlInput.bind(this.context.image)),null)},_setUrlInput:function(e){this.altText.value=e.alt,this._v_src._linkValue=this.previewSrc.textContent=this.imgUrlFile.value=e.src,this.imgUrlFile.focus()},_onLinkPreview:function(e,t,n){const i=n.target.value.trim();e._linkValue=this.textContent=i?t&&-1===i.indexOf("://")&&0!==i.indexOf("#")?t+i:-1===i.indexOf("://")?"/"+i:i:""},fileTags:["img"],select:function(e){this.plugins.image.onModifyMode.call(this,e,this.plugins.resizing.call_controller_resize.call(this,e,"image"))},destroy:function(e){const t=e||this.context.image._element,n=this.util.getParentElement(t,this.util.isMediaComponent)||t,i=1*t.getAttribute("data-index");let l=n.previousElementSibling||n.nextElementSibling;const o=n.parentNode;this.util.removeItem(n),this.plugins.image.init.call(this),this.controllersOff(),o!==this.context.element.wysiwyg&&this.util.removeItemAllParents(o,(function(e){return 0===e.childNodes.length}),null),this.focusEdge(l),this.plugins.fileManager.deleteInfo.call(this,"image",i,this.functions.onImageUpload),this.history.push(!1)},on:function(e){const t=this.context.image;e?t.imgInputFile&&this.context.options.imageMultipleFile&&t.imgInputFile.removeAttribute("multiple"):(t.inputX.value=t._origin_w=this.context.option.imageWidth===t._defaultSizeX?"":this.context.option.imageWidth,t.inputY.value=t._origin_h=this.context.option.imageHeight===t._defaultSizeY?"":this.context.option.imageHeight,t.imgInputFile&&this.context.options.imageMultipleFile&&t.imgInputFile.setAttribute("multiple","multiple"))},open:function(){this.plugins.dialog.open.call(this,"image","image"===this.currentControllerName)},openTab:function(e){const t=this.context.image.modal,n="init"===e?t.querySelector("._se_tab_link"):e.target;if(!/^BUTTON$/i.test(n.tagName))return!1;const i=n.getAttribute("data-tab-link");let l,o,s;for(o=t.getElementsByClassName("_se_tab_content"),l=0;l0?(this.showLoading(),n.submitAction.call(this,this.context.image.imgInputFile.files)):t.imgUrlFile&&t._v_src._linkValue.length>0&&(this.showLoading(),n.onRender_imgUrl.call(this))}catch(e){throw this.closeLoading(),Error('[SUNEDITOR.image.submit.fail] cause : "'+e.message+'"')}finally{this.plugins.dialog.close.call(this)}return!1},submitAction:function(e){if(0===e.length)return;let t=0,n=[];for(let i=0,l=e.length;i0){let e=0;const n=this.context.image._infoList;for(let t=0,i=n.length;ti){this.closeLoading();const n="[SUNEDITOR.imageUpload.fail] Size of uploadable total images: "+i/1e3+"KB";return void(("function"!==this.functions.onImageUploadError||this.functions.onImageUploadError(n,{limitSize:i,currentSize:e,uploadSize:t},this))&&this.functions.noticeOpen(n))}}const l=this.context.image;l._uploadFileLength=n.length;const o={linkValue:l._v_link._linkValue,linkNewWindow:l.imgLinkNewWindowCheck.checked,inputWidth:l.inputX.value,inputHeight:l.inputY.value,align:l._align,isUpdate:this.context.dialog.updateModal,element:l._element};if("function"==typeof this.functions.onImageUploadBefore){const e=this.functions.onImageUploadBefore(n,o,this,function(e){e&&this._w.Array.isArray(e.result)?this.plugins.image.register.call(this,o,e):this.plugins.image.upload.call(this,o,e)}.bind(this));if(void 0===e)return;if(!e)return void this.closeLoading();this._w.Array.isArray(e)&&e.length>0&&(n=e)}this.plugins.image.upload.call(this,o,n)},error:function(e,t){if(this.closeLoading(),"function"!=typeof this.functions.onImageUploadError||this.functions.onImageUploadError(e,t,this))throw this.functions.noticeOpen(e),Error("[SUNEDITOR.plugin.image.error] response: "+e)},upload:function(e,t){if(!t)return void this.closeLoading();if("string"==typeof t)return void this.plugins.image.error.call(this,t,null);const n=this.context.option.imageUploadUrl,i=this.context.dialog.updateModal?1:t.length;if("string"==typeof n&&n.length>0){const l=new FormData;for(let e=0;e0){const i=this.util.createElement("A");return i.href=/^https?:\/\//.test(t)?t:"http://"+t,i.target=n?"_blank":"",i.setAttribute("data-image-link","image"),e.setAttribute("data-image-link",t),i.appendChild(e),i}return e},setInputSize:function(e,t){t&&32===t.keyCode?t.preventDefault():this.plugins.resizing._module_setInputSize.call(this,this.context.image,e)},setRatio:function(){this.plugins.resizing._module_setRatio.call(this,this.context.image)},checkFileInfo:function(){const e=this.plugins.image,t=function(t){e.onModifyMode.call(this,t,null),e.openModify.call(this,!0),e.update_image.call(this,!0,!1,!0)}.bind(this);this.plugins.fileManager.checkInfo.call(this,"image",["img"],this.functions.onImageUpload,t,!0)},resetFileInfo:function(){this.plugins.fileManager.resetInfo.call(this,"image",this.functions.onImageUpload)},create_image:function(e,t,n,i,l,o,s){const a=this.plugins.image,r=this.context.image;this.context.resizing._resize_plugin="image";let c=this.util.createElement("IMG");c.src=e,c.alt=r._altText,c=a.onRender_link.call(this,c,t,n),c.setAttribute("data-rotate","0"),r._resizing&&c.setAttribute("data-proportion",r._proportionChecked);const d=this.plugins.component.set_cover.call(this,c),u=this.plugins.component.set_container.call(this,d,"se-image-container");r._captionChecked&&(r._caption=this.plugins.component.create_caption.call(this),r._caption.setAttribute("contenteditable",!1),d.appendChild(r._caption)),r._element=c,r._cover=d,r._container=u,a.applySize.call(this,i,l),a.setAlign.call(this,o,c,d,u),c.onload=a._image_create_onload.bind(this,c,r.svgDefaultSize),this.insertComponent(u,!0,!0,!0)&&this.plugins.fileManager.setInfo.call(this,"image",c,this.functions.onImageUpload,s,!0),this.context.resizing._resize_plugin=""},_image_create_onload:function(e,t){0===e.offsetWidth&&this.plugins.image.applySize.call(this,t,""),this.selectComponent.call(this,e,"image")},update_image:function(e,t,n){const i=this.context.image,l=i._v_link._linkValue;let o,s=i._element,a=i._cover,r=i._container,c=!1;null===a&&(c=!0,s=i._element.cloneNode(!0),a=this.plugins.component.set_cover.call(this,s)),null===r?(a=a.cloneNode(!0),s=a.querySelector("img"),c=!0,r=this.plugins.component.set_container.call(this,a,"se-image-container")):c&&(r.innerHTML="",r.appendChild(a),i._cover=a,i._element=s,c=!1);const d=this.util.isNumber(i.inputX.value)?i.inputX.value+i.sizeUnit:i.inputX.value,u=this.util.isNumber(i.inputY.value)?i.inputY.value+i.sizeUnit:i.inputY.value;o=/%$/.test(s.style.width)?d!==r.style.width||u!==r.style.height:d!==s.style.width||u!==s.style.height,s.alt=i._altText;let h=!1;if(i._captionChecked?i._caption||(i._caption=this.plugins.component.create_caption.call(this),a.appendChild(i._caption),h=!0):i._caption&&(this.util.removeItem(i._caption),i._caption=null,h=!0),l.trim().length>0)if(null!==i._linkElement&&a.contains(i._linkElement))i._linkElement.href=l,i._linkElement.target=i.imgLinkNewWindowCheck.checked?"_blank":"",s.setAttribute("data-image-link",l);else{let e=this.plugins.image.onRender_link.call(this,s,l,this.context.image.imgLinkNewWindowCheck.checked);a.insertBefore(e,i._caption)}else if(null!==i._linkElement){const e=s;e.setAttribute("data-image-link","");let t=e.cloneNode(!0);a.removeChild(i._linkElement),a.insertBefore(t,i._caption),s=t}if(c){const e=this.util.isRangeFormatElement(i._element.parentNode)||this.util.isWysiwygDiv(i._element.parentNode)?i._element:/^A$/i.test(i._element.parentNode.nodeName)?i._element.parentNode:this.util.getFormatElement(i._element)||i._element;e.parentNode.replaceChild(r,e),s=r.querySelector("img"),i._element=s,i._cover=a,i._container=r}(h||!i._onlyPercentage&&o)&&!e&&(/\d+/.test(s.style.height)||this.context.resizing._rotateVertical&&i._captionChecked)&&(/%$/.test(i.inputX.value)||/%$/.test(i.inputY.value)?this.plugins.resizing.resetTransform.call(this,s):this.plugins.resizing.setTransformSize.call(this,s,this.util.getNumber(i.inputX.value,0),this.util.getNumber(i.inputY.value,0)));i._resizing&&(s.setAttribute("data-proportion",i._proportionChecked),o&&this.plugins.image.applySize.call(this)),this.plugins.image.setAlign.call(this,null,s,null,null),e&&this.plugins.fileManager.setInfo.call(this,"image",s,this.functions.onImageUpload,null,!0),t&&this.selectComponent(s,"image"),n||this.history.push(!1)},update_src:function(e,t,n){t.src=e,this._w.setTimeout(this.plugins.fileManager.setInfo.bind(this,"image",t,this.functions.onImageUpload,n,!0)),this.selectComponent(t,"image")},onModifyMode:function(e,t){if(!e)return;const n=this.context.image;n._linkElement=/^A$/i.test(e.parentNode.nodeName)?e.parentNode:null,n._element=e,n._cover=this.util.getParentElement(e,"FIGURE"),n._container=this.util.getParentElement(e,this.util.isMediaComponent),n._caption=this.util.getChildElement(n._cover,"FIGCAPTION"),n._align=e.getAttribute("data-align")||"none",t&&(n._element_w=t.w,n._element_h=t.h,n._element_t=t.t,n._element_l=t.l);let i=n._element.getAttribute("data-size")||n._element.getAttribute("data-origin");i?(i=i.split(","),n._origin_w=i[0],n._origin_h=i[1]):t&&(n._origin_w=t.w,n._origin_h=t.h)},openModify:function(e){const t=this.context.image;t.imgUrlFile&&(t._v_src._linkValue=t.previewSrc.textContent=t.imgUrlFile.value=t._element.src),t._altText=t.altText.value=t._element.alt,t._v_link._linkValue=t.previewLink.textContent=t.imgLink.value=null===t._linkElement?"":t._linkElement.href,t.imgLinkNewWindowCheck.checked=t._linkElement&&"_blank"===t._linkElement.target,t.modal.querySelector('input[name="suneditor_image_radio"][value="'+t._align+'"]').checked=!0,t._align=t.modal.querySelector('input[name="suneditor_image_radio"]:checked').value,t._captionChecked=t.captionCheckEl.checked=!!t._caption,t._resizing&&this.plugins.resizing._module_setModifyInputSize.call(this,t,this.plugins.image),e||this.plugins.dialog.open.call(this,"image",!0)},sizeRevert:function(){this.plugins.resizing._module_sizeRevert.call(this,this.context.image)},applySize:function(e,t){const n=this.context.image;return e||(e=n.inputX.value||this.context.option.imageWidth),t||(t=n.inputY.value||this.context.option.imageHeight),n._onlyPercentage&&e||/%$/.test(e)?(this.plugins.image.setPercentSize.call(this,e,t),!0):(e&&"auto"!==e||t&&"auto"!==t?this.plugins.image.setSize.call(this,e,t,!1):this.plugins.image.setAutoSize.call(this),!1)},setSize:function(e,t,n,i){const l=this.context.image,o=/^(rw|lw)$/.test(i),s=/^(th|bh)$/.test(i);this.plugins.image.cancelPercentAttr.call(this),s||(l._element.style.width=this.util.isNumber(e)?e+l.sizeUnit:e),o||(l._element.style.height=this.util.isNumber(t)?t+l.sizeUnit:/%$/.test(t)?"":t),"center"===l._align&&this.plugins.image.setAlign.call(this,null,null,null,null),n||l._element.removeAttribute("data-percentage"),this.plugins.resizing._module_saveCurrentSize.call(this,l)},setAutoSize:function(){const e=this.context.image;this.plugins.resizing.resetTransform.call(this,e._element),this.plugins.image.cancelPercentAttr.call(this),e._element.style.maxWidth="",e._element.style.width="",e._element.style.height="",e._cover.style.width="",e._cover.style.height="",this.plugins.image.setAlign.call(this,null,null,null,null),e._element.setAttribute("data-percentage","auto,auto"),this.plugins.resizing._module_saveCurrentSize.call(this,e)},setOriginSize:function(){const e=this.context.image;e._element.removeAttribute("data-percentage"),this.plugins.resizing.resetTransform.call(this,e._element),this.plugins.image.cancelPercentAttr.call(this);const t=(e._element.getAttribute("data-origin")||"").split(","),n=t[0],i=t[1];t&&(e._onlyPercentage||/%$/.test(n)&&(/%$/.test(i)||!/\d/.test(i))?this.plugins.image.setPercentSize.call(this,n,i):this.plugins.image.setSize.call(this,n,i),this.plugins.resizing._module_saveCurrentSize.call(this,e))},setPercentSize:function(e,t){const n=this.context.image;t=!t||/%$/.test(t)||this.util.getNumber(t,0)?this.util.isNumber(t)?t+n.sizeUnit:t||"":this.util.isNumber(t)?t+"%":t;const i=/%$/.test(t);n._container.style.width=this.util.isNumber(e)?e+"%":e,n._container.style.height="",n._cover.style.width="100%",n._cover.style.height=i?t:"",n._element.style.width="100%",n._element.style.height=i?"":t,n._element.style.maxWidth="","center"===n._align&&this.plugins.image.setAlign.call(this,null,null,null,null),n._element.setAttribute("data-percentage",e+","+t),this.plugins.resizing.setCaptionPosition.call(this,n._element),this.plugins.resizing._module_saveCurrentSize.call(this,n)},cancelPercentAttr:function(){const e=this.context.image;e._cover.style.width="",e._cover.style.height="",e._container.style.width="",e._container.style.height="",this.util.removeClass(e._container,this.context.image._floatClassRegExp),this.util.addClass(e._container,"__se__float-"+e._align),"center"===e._align&&this.plugins.image.setAlign.call(this,null,null,null,null)},setAlign:function(e,t,n,i){const l=this.context.image;e||(e=l._align),t||(t=l._element),n||(n=l._cover),i||(i=l._container),n.style.margin=e&&"none"!==e?"auto":"0",/%$/.test(t.style.width)&&"center"===e?(i.style.minWidth="100%",n.style.width=i.style.width):(i.style.minWidth="",n.style.width=this.context.resizing._rotateVertical?t.style.height||t.offsetHeight:t.style.width&&"auto"!==t.style.width?t.style.width||"100%":""),this.util.hasClass(i,"__se__float-"+e)||(this.util.removeClass(i,l._floatClassRegExp),this.util.addClass(i,"__se__float-"+e)),t.setAttribute("data-align",e)},resetAlign:function(){const e=this.context.image;e._element.setAttribute("data-align",""),e._align="none",e._cover.style.margin="0",this.util.removeClass(e._container,e._floatClassRegExp)},init:function(){const e=this.context.image;e.imgInputFile&&(e.imgInputFile.value=""),e.imgUrlFile&&(e._v_src._linkValue=e.previewSrc.textContent=e.imgUrlFile.value=""),e.imgInputFile&&e.imgUrlFile&&(e.imgUrlFile.removeAttribute("disabled"),e.previewSrc.style.textDecoration=""),e.altText.value="",e._v_link._linkValue=e.previewLink.textContent=e.imgLink.value="",e.imgLinkNewWindowCheck.checked=!1,e.modal.querySelector('input[name="suneditor_image_radio"][value="none"]').checked=!0,e.captionCheckEl.checked=!1,e._element=null,this.plugins.image.openTab.call(this,"init"),e._resizing&&(e.inputX.value=this.context.option.imageWidth===e._defaultSizeX?"":this.context.option.imageWidth,e.inputY.value=this.context.option.imageHeight===e._defaultSizeY?"":this.context.option.imageHeight,e.proportion.checked=!0,e._ratio=!1,e._ratioX=1,e._ratioY=1)}},_={name:"video",display:"dialog",add:function(e){e.addModule([r.a,u.a,g.a,m.a]);const t=e.context,n=t.video={_infoList:[],_infoIndex:0,_uploadFileLength:0,sizeUnit:t.option._videoSizeUnit,_align:"none",_floatClassRegExp:"__se__float\\-[a-z]+",_youtubeQuery:t.option.youtubeQuery,_videoRatio:100*t.option.videoRatio+"%",_defaultRatio:100*t.option.videoRatio+"%",_linkValue:"",_element:null,_cover:null,_container:null,inputX:null,inputY:null,_element_w:1,_element_h:1,_element_l:0,_element_t:0,_defaultSizeX:"100%",_defaultSizeY:100*t.option.videoRatio+"%",_origin_w:"100%"===t.option.videoWidth?"":t.option.videoWidth,_origin_h:"56.25%"===t.option.videoHeight?"":t.option.videoHeight,_proportionChecked:!0,_resizing:t.option.videoResizing,_resizeDotHide:!t.option.videoHeightShow,_rotation:t.option.videoRotation,_onlyPercentage:t.option.videoSizeOnlyPercentage,_ratio:!1,_ratioX:1,_ratioY:1,_captionShow:!1};let i=this.setDialog.call(e);n.modal=i,n.videoInputFile=i.querySelector("._se_video_file"),n.videoUrlFile=i.querySelector(".se-input-url"),n.focusElement=n.videoUrlFile||n.videoInputFile,n.preview=i.querySelector(".se-link-preview"),i.querySelector(".se-btn-primary").addEventListener("click",this.submit.bind(e)),n.videoInputFile&&i.querySelector(".se-dialog-files-edge-button").addEventListener("click",this._removeSelectedFiles.bind(n.videoInputFile,n.videoUrlFile,n.preview)),n.videoInputFile&&n.videoUrlFile&&n.videoInputFile.addEventListener("change",this._fileInputChange.bind(n)),n.videoUrlFile&&n.videoUrlFile.addEventListener("input",this._onLinkPreview.bind(n.preview,n,t.options.linkProtocol)),n.proportion={},n.videoRatioOption={},n.inputX={},n.inputY={},t.option.videoResizing&&(n.proportion=i.querySelector("._se_video_check_proportion"),n.videoRatioOption=i.querySelector(".se-video-ratio"),n.inputX=i.querySelector("._se_video_size_x"),n.inputY=i.querySelector("._se_video_size_y"),n.inputX.value=t.option.videoWidth,n.inputY.value=t.option.videoHeight,n.inputX.addEventListener("keyup",this.setInputSize.bind(e,"x")),n.inputY.addEventListener("keyup",this.setInputSize.bind(e,"y")),n.inputX.addEventListener("change",this.setRatio.bind(e)),n.inputY.addEventListener("change",this.setRatio.bind(e)),n.proportion.addEventListener("change",this.setRatio.bind(e)),n.videoRatioOption.addEventListener("change",this.setVideoRatio.bind(e)),i.querySelector(".se-dialog-btn-revert").addEventListener("click",this.sizeRevert.bind(e))),t.dialog.modal.appendChild(i),i=null},setDialog:function(){const e=this.context.option,t=this.lang,n=this.util.createElement("DIV");n.className="se-dialog-content",n.style.display="none";let i='
    '+t.dialogBox.videoBox.title+'
    ';if(e.videoFileInput&&(i+='
    "),e.videoUrlInput&&(i+='
    '),e.videoResizing){const n=e.videoRatioList||[{name:"16:9",value:.5625},{name:"4:3",value:.75},{name:"21:9",value:.4285}],l=e.videoRatio,o=e.videoSizeOnlyPercentage,s=o?' style="display: none !important;"':"",a=e.videoHeightShow?"":' style="display: none !important;"',r=e.videoRatioShow?"":' style="display: none !important;"',c=o||e.videoHeightShow||e.videoRatioShow?"":' style="display: none !important;"';i+='
    "}return i+='
    ",n.innerHTML=i,n},_fileInputChange:function(){this.videoInputFile.value?(this.videoUrlFile.setAttribute("disabled",!0),this.preview.style.textDecoration="line-through"):(this.videoUrlFile.removeAttribute("disabled"),this.preview.style.textDecoration="")},_removeSelectedFiles:function(e,t){this.value="",e&&(e.removeAttribute("disabled"),t.style.textDecoration="")},_onLinkPreview:function(e,t,n){const i=n.target.value.trim();/^$/.test(i)?(e._linkValue=i,this.textContent=''):e._linkValue=this.textContent=i?t&&-1===i.indexOf("://")&&0!==i.indexOf("#")?t+i:-1===i.indexOf("://")?"/"+i:i:""},_setTagAttrs:function(e){e.setAttribute("controls",!0);const t=this.context.options.videoTagAttrs;if(t)for(let n in t)this.util.hasOwn(t,n)&&e.setAttribute(n,t[n])},createVideoTag:function(){const e=this.util.createElement("VIDEO");return this.plugins.video._setTagAttrs.call(this,e),e},_setIframeAttrs:function(e){e.frameBorder="0",e.allowFullscreen=!0;const t=this.context.options.videoIframeAttrs;if(t)for(let n in t)this.util.hasOwn(t,n)&&e.setAttribute(n,t[n])},createIframeTag:function(){const e=this.util.createElement("IFRAME");return this.plugins.video._setIframeAttrs.call(this,e),e},fileTags:["iframe","video"],select:function(e){this.plugins.video.onModifyMode.call(this,e,this.plugins.resizing.call_controller_resize.call(this,e,"video"))},destroy:function(e){const t=e||this.context.video._element,n=this.context.video._container,i=1*t.getAttribute("data-index");let l=n.previousElementSibling||n.nextElementSibling;const o=n.parentNode;this.util.removeItem(n),this.plugins.video.init.call(this),this.controllersOff(),o!==this.context.element.wysiwyg&&this.util.removeItemAllParents(o,(function(e){return 0===e.childNodes.length}),null),this.focusEdge(l),this.plugins.fileManager.deleteInfo.call(this,"video",i,this.functions.onVideoUpload),this.history.push(!1)},on:function(e){const t=this.context.video;e?t.videoInputFile&&this.context.options.videoMultipleFile&&t.videoInputFile.removeAttribute("multiple"):(t.inputX.value=t._origin_w=this.context.option.videoWidth===t._defaultSizeX?"":this.context.option.videoWidth,t.inputY.value=t._origin_h=this.context.option.videoHeight===t._defaultSizeY?"":this.context.option.videoHeight,t.proportion.disabled=!0,t.videoInputFile&&this.context.options.videoMultipleFile&&t.videoInputFile.setAttribute("multiple","multiple")),t._resizing&&this.plugins.video.setVideoRatioSelect.call(this,t._origin_h||t._defaultRatio)},open:function(){this.plugins.dialog.open.call(this,"video","video"===this.currentControllerName)},setVideoRatio:function(e){const t=this.context.video,n=e.target.options[e.target.selectedIndex].value;t._defaultSizeY=t._videoRatio=n?100*n+"%":t._defaultSizeY,t.inputY.placeholder=n?100*n+"%":"",t.inputY.value=""},setInputSize:function(e,t){if(t&&32===t.keyCode)return void t.preventDefault();const n=this.context.video;this.plugins.resizing._module_setInputSize.call(this,n,e),"y"===e&&this.plugins.video.setVideoRatioSelect.call(this,t.target.value||n._defaultRatio)},setRatio:function(){this.plugins.resizing._module_setRatio.call(this,this.context.video)},submit:function(e){const t=this.context.video,n=this.plugins.video;e.preventDefault(),e.stopPropagation(),t._align=t.modal.querySelector('input[name="suneditor_video_radio"]:checked').value;try{t.videoInputFile&&t.videoInputFile.files.length>0?(this.showLoading(),n.submitAction.call(this,this.context.video.videoInputFile.files)):t.videoUrlFile&&t._linkValue.length>0&&(this.showLoading(),n.setup_url.call(this))}catch(e){throw this.closeLoading(),Error('[SUNEDITOR.video.submit.fail] cause : "'+e.message+'"')}finally{this.plugins.dialog.close.call(this)}return!1},submitAction:function(e){if(0===e.length)return;let t=0,n=[];for(let i=0,l=e.length;i0){let e=0;const n=this.context.video._infoList;for(let t=0,i=n.length;ti){this.closeLoading();const n="[SUNEDITOR.videoUpload.fail] Size of uploadable total videos: "+i/1e3+"KB";return void(("function"!==this.functions.onVideoUploadError||this.functions.onVideoUploadError(n,{limitSize:i,currentSize:e,uploadSize:t},this))&&this.functions.noticeOpen(n))}}const l=this.context.video;l._uploadFileLength=n.length;const o={inputWidth:l.inputX.value,inputHeight:l.inputY.value,align:l._align,isUpdate:this.context.dialog.updateModal,element:l._element};if("function"==typeof this.functions.onVideoUploadBefore){const e=this.functions.onVideoUploadBefore(n,o,this,function(e){e&&this._w.Array.isArray(e.result)?this.plugins.video.register.call(this,o,e):this.plugins.video.upload.call(this,o,e)}.bind(this));if(void 0===e)return;if(!e)return void this.closeLoading();"object"==typeof e&&e.length>0&&(n=e)}this.plugins.video.upload.call(this,o,n)},error:function(e,t){if(this.closeLoading(),"function"!=typeof this.functions.onVideoUploadError||this.functions.onVideoUploadError(e,t,this))throw this.functions.noticeOpen(e),Error("[SUNEDITOR.plugin.video.error] response: "+e)},upload:function(e,t){if(!t)return void this.closeLoading();if("string"==typeof t)return void this.plugins.video.error.call(this,t,null);const n=this.context.option.videoUploadUrl,i=this.context.dialog.updateModal?1:t.length;if(!("string"==typeof n&&n.length>0))throw Error('[SUNEDITOR.videoUpload.fail] cause : There is no "videoUploadUrl" option.');{const l=new FormData;for(let e=0;e$/.test(t)){if(t=(new this._w.DOMParser).parseFromString(t,"text/html").querySelector("iframe").src,0===t.length)return!1}if(/youtu\.?be/.test(t)){if(/^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("&","?&")),e._youtubeQuery.length>0)if(/\?/.test(t)){const n=t.split("?");t=n[0]+"?"+e._youtubeQuery+"&"+n[1]}else t+="?"+e._youtubeQuery}else/vimeo\.com/.test(t)&&(t.endsWith("/")&&(t=t.slice(0,-1)),t="https://player.vimeo.com/video/"+t.slice(t.lastIndexOf("/")+1));this.plugins.video.create_video.call(this,this.plugins.video.createIframeTag.call(this),t,e.inputX.value,e.inputY.value,e._align,null,this.context.dialog.updateModal)}catch(e){throw Error('[SUNEDITOR.video.upload.fail] cause : "'+e.message+'"')}finally{this.closeLoading()}},create_video:function(e,t,n,i,l,o,s){this.context.resizing._resize_plugin="video";const a=this.context.video;let r=null,c=null,d=!1;if(s){if((e=a._element).src!==t){d=!0;const n=/youtu\.?be/.test(t),i=/vimeo\.com/.test(t);if(!n&&!i||/^iframe$/i.test(e.nodeName))if(n||i||/^videoo$/i.test(e.nodeName))e.src=t;else{const n=this.plugins.video.createVideoTag.call(this);n.src=t,e.parentNode.replaceChild(n,e),a._element=e=n}else{const n=this.plugins.video.createIframeTag.call(this);n.src=t,e.parentNode.replaceChild(n,e),a._element=e=n}}c=a._container,r=this.util.getParentElement(e,"FIGURE")}else d=!0,e.src=t,a._element=e,r=this.plugins.component.set_cover.call(this,e),c=this.plugins.component.set_container.call(this,r,"se-video-container");a._cover=r,a._container=c;const u=this.plugins.resizing._module_getSizeX.call(this,a)!==(n||a._defaultSizeX)||this.plugins.resizing._module_getSizeY.call(this,a)!==(i||a._videoRatio),h=!s||u;a._resizing&&(this.context.video._proportionChecked=a.proportion.checked,e.setAttribute("data-proportion",a._proportionChecked));let g=!1;h&&(g=this.plugins.video.applySize.call(this)),g&&"center"===l||this.plugins.video.setAlign.call(this,null,e,r,c);let p=!0;s?a._resizing&&this.context.resizing._rotateVertical&&h&&this.plugins.resizing.setTransformSize.call(this,e,null,null):p=this.insertComponent(c,!1,!0,!1),p&&(d&&this.plugins.fileManager.setInfo.call(this,"video",e,this.functions.onVideoUpload,o,!0),s&&(this.selectComponent(e,"video"),this.history.push(!1))),this.context.resizing._resize_plugin=""},_update_videoCover:function(e){if(!e)return;const t=this.context.video;/^video$/i.test(e.nodeName)?this.plugins.video._setTagAttrs.call(this,e):this.plugins.video._setIframeAttrs.call(this,e);const n=this.util.getParentElement(e,this.util.isMediaComponent)||this.util.getParentElement(e,function(e){return this.isWysiwygDiv(e.parentNode)}.bind(this.util));t._element=e=e.cloneNode(!0);const i=t._cover=this.plugins.component.set_cover.call(this,e),l=t._container=this.plugins.component.set_container.call(this,i,"se-video-container"),o=n.querySelector("figcaption");let s=null;o&&(s=this.util.createElement("DIV"),s.innerHTML=o.innerHTML,this.util.removeItem(o));const a=(e.getAttribute("data-size")||e.getAttribute("data-origin")||"").split(",");this.plugins.video.applySize.call(this,a[0],a[1]),n.parentNode.replaceChild(l,n),s&&n.parentNode.insertBefore(s,l.nextElementSibling),this.plugins.fileManager.setInfo.call(this,"video",e,this.functions.onVideoUpload,null,!0)},onModifyMode:function(e,t){const n=this.context.video;n._element=e,n._cover=this.util.getParentElement(e,"FIGURE"),n._container=this.util.getParentElement(e,this.util.isMediaComponent),n._align=e.getAttribute("data-align")||"none",t&&(n._element_w=t.w,n._element_h=t.h,n._element_t=t.t,n._element_l=t.l);let i=n._element.getAttribute("data-size")||n._element.getAttribute("data-origin");i?(i=i.split(","),n._origin_w=i[0],n._origin_h=i[1]):t&&(n._origin_w=t.w,n._origin_h=t.h)},openModify:function(e){const t=this.context.video;if(t.videoUrlFile&&(t._linkValue=t.preview.textContent=t.videoUrlFile.value=t._element.src||(t._element.querySelector("source")||"").src||""),t.modal.querySelector('input[name="suneditor_video_radio"][value="'+t._align+'"]').checked=!0,t._resizing){this.plugins.resizing._module_setModifyInputSize.call(this,t,this.plugins.video);const e=t._videoRatio=this.plugins.resizing._module_getSizeY.call(this,t);this.plugins.video.setVideoRatioSelect.call(this,e)||(t.inputY.value=t._onlyPercentage?this.util.getNumber(e,2):e)}e||this.plugins.dialog.open.call(this,"video",!0)},setVideoRatioSelect:function(e){let t=!1;const n=this.context.video,i=n.videoRatioOption.options;/%$/.test(e)||n._onlyPercentage?e=this.util.getNumber(e,2)/100+"":(!this.util.isNumber(e)||1*e>=1)&&(e=""),n.inputY.placeholder="";for(let l=0,o=i.length;l'+this.icons.cancel+''+t.dialogBox.audioBox.title+'
    ';return e.audioFileInput&&(i+='
    "),e.audioUrlInput&&(i+='
    '),i+='
    ",n.innerHTML=i,n},setController:function(){const e=this.lang,t=this.icons,n=this.util.createElement("DIV");return n.className="se-controller se-controller-link",n.innerHTML='
    ",n},_fileInputChange:function(){this.audioInputFile.value?(this.audioUrlFile.setAttribute("disabled",!0),this.preview.style.textDecoration="line-through"):(this.audioUrlFile.removeAttribute("disabled"),this.preview.style.textDecoration="")},_removeSelectedFiles:function(e,t){this.value="",e&&(e.removeAttribute("disabled"),t.style.textDecoration="")},_createAudioTag:function(){const e=this.util.createElement("AUDIO");this.plugins.audio._setTagAttrs.call(this,e);const t=this.context.audio._origin_w,n=this.context.audio._origin_h;return e.setAttribute("origin-size",t+","+n),e.style.cssText=(t?"width:"+t+"; ":"")+(n?"height:"+n+";":""),e},_setTagAttrs:function(e){e.setAttribute("controls",!0);const t=this.context.options.audioTagAttrs;if(t)for(let n in t)this.util.hasOwn(t,n)&&e.setAttribute(n,t[n])},_onLinkPreview:function(e,t,n){const i=n.target.value.trim();e._linkValue=this.textContent=i?t&&-1===i.indexOf("://")&&0!==i.indexOf("#")?t+i:-1===i.indexOf("://")?"/"+i:i:""},fileTags:["audio"],select:function(e){this.plugins.audio.onModifyMode.call(this,e)},destroy:function(e){e=e||this.context.audio._element;const t=this.util.getParentElement(e,this.util.isComponent)||e,n=1*e.getAttribute("data-index"),i=t.previousElementSibling||t.nextElementSibling,l=t.parentNode;this.util.removeItem(t),this.plugins.audio.init.call(this),this.controllersOff(),l!==this.context.element.wysiwyg&&this.util.removeItemAllParents(l,(function(e){return 0===e.childNodes.length}),null),this.focusEdge(i),this.plugins.fileManager.deleteInfo.call(this,"audio",n,this.functions.onAudioUpload),this.history.push(!1)},checkFileInfo:function(){this.plugins.fileManager.checkInfo.call(this,"audio",["audio"],this.functions.onAudioUpload,this.plugins.audio.updateCover.bind(this),!1)},resetFileInfo:function(){this.plugins.fileManager.resetInfo.call(this,"audio",this.functions.onAudioUpload)},on:function(e){const t=this.context.audio;e?t._element?(this.context.dialog.updateModal=!0,t._linkValue=t.preview.textContent=t.audioUrlFile.value=t._element.src,t.audioInputFile&&this.context.options.audioMultipleFile&&t.audioInputFile.removeAttribute("multiple")):t.audioInputFile&&this.context.options.audioMultipleFile&&t.audioInputFile.removeAttribute("multiple"):(this.plugins.audio.init.call(this),t.audioInputFile&&this.context.options.audioMultipleFile&&t.audioInputFile.setAttribute("multiple","multiple"))},open:function(){this.plugins.dialog.open.call(this,"audio","audio"===this.currentControllerName)},submit:function(e){const t=this.context.audio;e.preventDefault(),e.stopPropagation();try{t.audioInputFile&&t.audioInputFile.files.length>0?(this.showLoading(),this.plugins.audio.submitAction.call(this,t.audioInputFile.files)):t.audioUrlFile&&t._linkValue.length>0&&(this.showLoading(),this.plugins.audio.setupUrl.call(this,t._linkValue))}catch(e){throw this.closeLoading(),Error('[SUNEDITOR.audio.submit.fail] cause : "'+e.message+'"')}finally{this.plugins.dialog.close.call(this)}return!1},submitAction:function(e){if(0===e.length)return;let t=0,n=[];for(let i=0,l=e.length;i0){let e=0;const n=this.context.audio._infoList;for(let t=0,i=n.length;ti){this.closeLoading();const n="[SUNEDITOR.audioUpload.fail] Size of uploadable total audios: "+i/1e3+"KB";return void(("function"!==this.functions.onAudioUploadError||this.functions.onAudioUploadError(n,{limitSize:i,currentSize:e,uploadSize:t},this))&&this.functions.noticeOpen(n))}}const l=this.context.audio;l._uploadFileLength=n.length;const o={isUpdate:this.context.dialog.updateModal,element:l._element};if("function"==typeof this.functions.onAudioUploadBefore){const e=this.functions.onAudioUploadBefore(n,o,this,function(e){e&&this._w.Array.isArray(e.result)?this.plugins.audio.register.call(this,o,e):this.plugins.audio.upload.call(this,o,e)}.bind(this));if(void 0===e)return;if(!e)return void this.closeLoading();"object"==typeof e&&e.length>0&&(n=e)}this.plugins.audio.upload.call(this,o,n)},error:function(e,t){if(this.closeLoading(),"function"!=typeof this.functions.onAudioUploadError||this.functions.onAudioUploadError(e,t,this))throw this.functions.noticeOpen(e),Error("[SUNEDITOR.plugin.audio.exception] response: "+e)},upload:function(e,t){if(!t)return void this.closeLoading();if("string"==typeof t)return void this.plugins.audio.error.call(this,t,null);const n=this.context.option.audioUploadUrl,i=this.context.dialog.updateModal?1:t.length,l=new FormData;for(let e=0;e'+this.icons.cancel+''+e.dialogBox.mathBox.title+'

    ",t},setController_MathButton:function(){const e=this.lang,t=this.util.createElement("DIV");return t.className="se-controller se-controller-link",t.innerHTML='
    ",t},open:function(){this.plugins.dialog.open.call(this,"math","math"===this.currentControllerName)},managedTags:function(){return{className:"katex",method:function(e){if(!e.getAttribute("data-exp"))return;const t=this._d.createRange().createContextualFragment(this.plugins.math._renderer.call(this,this.util.HTMLDecoder(e.getAttribute("data-exp"))));e.innerHTML=t.querySelector(".katex").innerHTML}}},_renderer:function(e){const t=this.context.option.katex;return t.src.renderToString(e,t.options)},_renderMathExp:function(e,t){e.previewElement.innerHTML=this.plugins.math._renderer.call(this,t.target.value)},submit:function(e){this.showLoading(),e.preventDefault(),e.stopPropagation();const t=function(){if(0===this.context.math.focusElement.value.trim().length)return!1;const e=this.context.math,t=e.focusElement.value,n=e.previewElement.querySelector(".katex");if(!n)return!1;if(n.className="__se__katex "+n.className,n.setAttribute("contenteditable",!1),n.setAttribute("data-exp",this.util.HTMLEncoder(t)),n.setAttribute("data-font-size",e.fontSizeElement.value),n.style.fontSize=e.fontSizeElement.value,this.context.dialog.updateModal){const t=this.util.getParentElement(e._mathExp,".katex");t.parentNode.replaceChild(n,t),this.setRange(n,0,n,1)}else{const e=this.getSelectedElements();if(e.length>1){const t=this.util.createElement(e[0].nodeName);if(t.appendChild(n),!this.insertNode(t,null,!0))return!1}else if(!this.insertNode(n,null,!0))return!1;const t=this.util.createTextNode(this.util.zeroWidthSpace);n.parentNode.insertBefore(t,n.nextSibling),this.setRange(n,0,n,1)}return e.focusElement.value="",e.fontSizeElement.value="1em",e.previewElement.style.fontSize="1em",e.previewElement.innerHTML="",!0}.bind(this);try{t()&&(this.plugins.dialog.close.call(this),this.history.push(!1))}catch(e){this.plugins.dialog.close.call(this)}finally{this.closeLoading()}return!1},active:function(e){if(e){if(e.getAttribute("data-exp"))return this.controllerArray.indexOf(this.context.math.mathController)<0&&(this.setRange(e,0,e,1),this.plugins.math.call_controller.call(this,e)),!0}else this.controllerArray.indexOf(this.context.math.mathController)>-1&&this.controllersOff();return!1},on:function(e){if(e){const e=this.context.math;if(e._mathExp){const t=this.util.HTMLDecoder(e._mathExp.getAttribute("data-exp")),n=e._mathExp.getAttribute("data-font-size")||"1em";this.context.dialog.updateModal=!0,e.focusElement.value=t,e.fontSizeElement.value=n,e.previewElement.innerHTML=this.plugins.math._renderer.call(this,t),e.previewElement.style.fontSize=n}}else this.plugins.math.init.call(this)},call_controller:function(e){this.context.math._mathExp=e;const t=this.context.math.mathController,n=this.util.getOffset(e,this.context.element.wysiwygFrame);t.style.top=n.top+e.offsetHeight+10+"px",t.style.left=n.left-this.context.element.wysiwygFrame.scrollLeft+"px",t.style.display="block";const i=this.context.element.wysiwygFrame.offsetWidth-(t.offsetLeft+t.offsetWidth);i<0?(t.style.left=t.offsetLeft+i+"px",t.firstElementChild.style.left=20-i+"px"):t.firstElementChild.style.left="20px",this.controllersOn(t,e,"math")},onClick_mathController:function(e){e.stopPropagation();const t=e.target.getAttribute("data-command")||e.target.parentNode.getAttribute("data-command");t&&(e.preventDefault(),/update/.test(t)?(this.context.math.focusElement.value=this.util.HTMLDecoder(this.context.math._mathExp.getAttribute("data-exp")),this.plugins.dialog.open.call(this,"math",!0)):(this.util.removeItem(this.context.math._mathExp),this.context.math._mathExp=null,this.focus(),this.history.push(!1)),this.controllersOff())},init:function(){const e=this.context.math;e.mathController.style.display="none",e._mathExp=null,e.focusElement.value="",e.previewElement.innerHTML=""}},y={name:"mention",display:"dialog",title:"mention",buttonClass:"",innerHTML:"@",focussed:0,renderItem:function(e){return`${e}`},getItems:function(e){return Promise.resolve(["overwite","the","mention","plugin","getItems","method"].filter(t=>t.includes(e.toLowerCase())))},renderList:function(e){const{mention:t}=this.context;t.getItems(e).then(e=>{t.items=e,t.list.innerHTML=e.map((e,n)=>`
  • \n ${t.renderItem(e)}\n
  • `).join("")})},setDialog:function(){const e=this.util.createElement("DIV"),t=this.lang;e.className="se-dialog-content",e.style.display="none";const n=`\n
    \n
    \n \n ${t.dialogBox.mentionBox.title}\n
    \n
    \n \n
      \n
    \n
    \n
    \n `;return e.innerHTML=n,e},getId:e=>e,getValue:e=>"@"+e,getLinkHref:()=>"",open:function(){const{mention:e}=this.context;this.plugins.dialog.open.call(this,"mention","mention"===this.currentControllerName),e.search.focus(),e.renderList("")},on:function(e){e||this.plugins.mention.init.call(this)},init:function(){const{mention:e}=this.context;e.search.value="",e.focussed=0},onKeyPress:function(e){const{mention:t}=this.context;switch(e.key){case"ArrowDown":t.focussed+=1,e.preventDefault(),e.stopPropagation();break;case"ArrowUp":t.focussed>0&&(t.focussed-=1),e.preventDefault(),e.stopPropagation();break;case"Enter":t.add(),e.preventDefault(),e.stopPropagation();break;default:t.focussed=0}},onKeyUp:function(e){const{mention:t}=this.context;t.renderList(e.target.value)},getMentions:function(){const{mentions:e,getId:t}=this.context.mention;return e.filter(e=>{const n=t(e);return this.context.element.wysiwyg.querySelector(`[data-mention="${n}"]`)})},addMention:function(){const{mention:e}=this.context,t=e.items[e.focussed];if(t){e.mentions.find(n=>e.getId(n)===e.getId(t))||e.mentions.push(t);const n=this.util.createElement("A");n.href=e.getLinkHref(t),n.target="_blank",n.innerHTML=e.getValue(t),n.setAttribute("data-mention",e.getId(t)),this.insertNode(n,null,!1);const i=this.util.createElement("SPAN");i.innerHTML=" ",this.insertNode(i,n,!1)}this.plugins.dialog.close.call(this)},add:function(e){e.addModule([r.a]);const t=this.setDialog.call(e);e.getMentions=this.getMentions.bind(e);const n=t.querySelector(".se-mention-search");n.addEventListener("keyup",this.onKeyUp.bind(e)),n.addEventListener("keydown",this.onKeyPress.bind(e));const i=t.querySelector(".se-mention-list");e.context.mention={modal:t,search:n,list:i,triggerKey:this.triggerKey,visible:!1,add:this.addMention.bind(e),mentions:[],items:[],renderList:this.renderList.bind(e),getId:this.getId.bind(e),getValue:this.getValue.bind(e),getLinkHref:this.getLinkHref.bind(e),open:this.open.bind(e),focussed:this.focussed,renderItem:this.renderItem,getItems:this.getItems},e.context.dialog.modal.appendChild(t)},action:function(){}},C=n("JhlZ"),w=n.n(C),x={blockquote:{name:"blockquote",display:"command",add:function(e,t){e.context.blockquote={targetButton:t,tag:e.util.createElement("BLOCKQUOTE")}},active:function(e){if(e){if(/blockquote/i.test(e.nodeName))return this.util.addClass(this.context.blockquote.targetButton,"active"),!0}else this.util.removeClass(this.context.blockquote.targetButton,"active");return!1},action:function(){const e=this.util.getParentElement(this.getSelectionNode(),"blockquote");e?this.detachRangeFormatElement(e,null,null,!1,!1):this.applyRangeFormatElement(this.context.blockquote.tag.cloneNode(!1))}},align:{name:"align",display:"submenu",add:function(e,t){const n=e.icons,i=e.context;i.align={targetButton:t,_alignList:null,currentAlign:"",icons:{justify:n.align_justify,left:n.align_left,right:n.align_right,center:n.align_center}};let l=this.setSubmenu.call(e),o=l.querySelector("ul");o.addEventListener("click",this.pickup.bind(e)),i.align._alignList=o.querySelectorAll("li button"),e.initMenuTarget(this.name,t,l),l=null,o=null},setSubmenu:function(){const e=this.lang,t=this.icons,n=this.util.createElement("DIV");return n.className="se-submenu se-list-layer se-list-align",n.innerHTML='
    ",n},active:function(e){const t=this.context.align.targetButton,n=t.firstElementChild;if(e){if(this.util.isFormatElement(e)){const i=e.style.textAlign;if(i)return this.util.changeElement(n,this.context.align.icons[i]),t.setAttribute("data-focus",i),!0}}else this.util.changeElement(n,this.context.align.icons.left),t.removeAttribute("data-focus");return!1},on:function(){const e=this.context.align,t=e._alignList,n=e.targetButton.getAttribute("data-focus")||"left";if(n!==e.currentAlign){for(let e=0,i=t.length;e('+t.toolbar.default+")";for(o=0,s=a.length;o";return r+="",n.innerHTML=r,n},active:function(e){const t=this.context.font.targetText,n=this.context.font.targetTooltip;if(e){if(e.style&&e.style.fontFamily.length>0){const i=e.style.fontFamily.replace(/["']/g,"");return this.util.changeTxt(t,i),this.util.changeTxt(n,i),!0}}else{const e=this.lang.toolbar.font;this.util.changeTxt(t,e),this.util.changeTxt(n,e)}return!1},on:function(){const e=this.context.font,t=e._fontList,n=e.targetText.textContent;if(n!==e.currentFont){for(let e=0,i=t.length;e('+t.toolbar.default+")";for(let t,n=0,o=e.fontSizeUnit,s=i.length;n";return l+="",n.innerHTML=l,n},active:function(e){if(e){if(e.style&&e.style.fontSize.length>0)return this.util.changeTxt(this.context.fontSize.targetText,e.style.fontSize),!0}else this.util.changeTxt(this.context.fontSize.targetText,this.lang.toolbar.fontSize);return!1},on:function(){const e=this.context.fontSize,t=e._sizeList,n=e.targetText.textContent;if(n!==e.currentSize){for(let e=0,i=t.length;e
  • ',t},appendHr:function(e){const t=this.util.createElement("HR");return t.className=e,this.focus(),this.insertComponent(t,!1,!0,!1)},horizontalRulePick:function(e){e.preventDefault(),e.stopPropagation();let t=e.target,n=null;for(;!n&&!/UL/i.test(t.tagName);)n=t.getAttribute("data-value"),t=t.parentNode;if(!n)return;const i=this.plugins.horizontalRule.appendHr.call(this,"__se__"+n);i&&(this.setRange(i,0,i,0),this.submenuOff())}},list:{name:"list",display:"submenu",add:function(e,t){const n=e.context;n.list={targetButton:t,_list:null,currentList:"",icons:{bullets:e.icons.list_bullets,number:e.icons.list_number}};let i=this.setSubmenu.call(e),l=i.querySelector("ul");l.addEventListener("click",this.pickup.bind(e)),n.list._list=l.querySelectorAll("li button"),e.initMenuTarget(this.name,t,i),i=null,l=null},setSubmenu:function(){const e=this.lang,t=this.util.createElement("DIV");return t.className="se-submenu se-list-layer",t.innerHTML='
    ",t},active:function(e){const t=this.context.list.targetButton,n=t.firstElementChild,i=this.util;if(e){if(i.isList(e)){const l=e.nodeName;return t.setAttribute("data-focus",l),i.addClass(t,"active"),/UL/i.test(l)?i.changeElement(n,this.context.list.icons.bullets):i.changeElement(n,this.context.list.icons.number),!0}}else t.removeAttribute("data-focus"),i.changeElement(n,this.context.list.icons.number),i.removeClass(t,"active");return!1},on:function(){const e=this.context.list,t=e._list,n=e.targetButton.getAttribute("data-focus")||"";if(n!==e.currentList){for(let e=0,i=t.length;e"),t.innerHTML+=n.outerHTML,e&&(t.innerHTML+="
    ")}else{const e=n.childNodes;for(;e[0];)t.appendChild(e[0])}a.appendChild(t),r||(u=a),r&&m===g&&!o.isRangeFormatElement(f)||(d||(d=a),i&&r&&m===g||r&&o.isList(g)&&g===c||a.parentNode!==m&&m.insertBefore(a,f)),o.removeItem(n),i&&null===h&&(h=a.children.length-1),r&&(o.getRangeFormatElement(g,p)!==o.getRangeFormatElement(c,p)||o.isList(g)&&o.isList(c)&&o.getElementDepth(g)!==o.getElementDepth(c))&&(a=o.createElement(e)),_&&0===_.children.length&&o.removeItem(_)}else o.removeItem(n);h&&(d=d.children[h]),s&&(g=a.children.length-1,a.innerHTML+=c.innerHTML,u=a.children[g],o.removeItem(c))}else{if(n)for(let e=0,t=l.length;e=0;n--)if(l[n].contains(l[e])){l.splice(e,1),e--,t--;break}const t=o.getRangeFormatElement(s),i=t&&t.tagName===e;let a,r;const c=function(e){return!this.isComponent(e)}.bind(o);i||(r=o.createElement(e));for(let t,s,d=0,u=l.length;d0){const e=l.cloneNode(!1),t=l.childNodes,o=this.util.getPositionIndex(i);for(;t[o];)e.appendChild(t[o]);n.appendChild(e)}0===l.children.length&&this.util.removeItem(l),this.util.mergeSameTags(s);const a=this.util.getEdgeChildNodes(t,n);return{cc:t.parentNode,sc:a.sc,ec:a.ec}},editInsideList:function(e,t){const n=(t=t||this.getSelectedElements().filter(function(e){return this.isListCell(e)}.bind(this.util))).length;if(0===n||!e&&!this.util.isListCell(t[0].previousElementSibling)&&!this.util.isListCell(t[n-1].nextElementSibling))return{sc:t[0],so:0,ec:t[n-1],eo:1};let i=t[0].parentNode,l=t[n-1],o=null;if(e){if(i!==l.parentNode&&this.util.isList(l.parentNode.parentNode)&&l.nextElementSibling)for(l=l.nextElementSibling;l;)t.push(l),l=l.nextElementSibling;o=this.plugins.list.editList.call(this,i.nodeName.toUpperCase(),t,!0)}else{let e=this.util.createElement(i.nodeName),s=t[0].previousElementSibling,a=l.nextElementSibling;const r={s:null,e:null,sl:i,el:i};for(let l,o=0,c=n;o span > span"),n.table.columnFixedButton=o.querySelector("._se_table_fixed_column"),n.table.headerButton=o.querySelector("._se_table_header"),o.addEventListener("mousedown",e.eventStop);let s=this.setController_tableEditor.call(e,n.table.cellControllerTop);n.table.resizeDiv=s,n.table.splitMenu=s.querySelector(".se-btn-group-sub"),n.table.mergeButton=s.querySelector("._se_table_merge_button"),n.table.splitButton=s.querySelector("._se_table_split_button"),n.table.insertRowAboveButton=s.querySelector("._se_table_insert_row_a"),n.table.insertRowBelowButton=s.querySelector("._se_table_insert_row_b"),s.addEventListener("mousedown",e.eventStop),l.addEventListener("mousemove",this.onMouseMove_tablePicker.bind(e)),l.addEventListener("click",this.appendTable.bind(e)),s.addEventListener("click",this.onClick_tableController.bind(e)),o.addEventListener("click",this.onClick_tableController.bind(e)),e.initMenuTarget(this.name,t,i),n.element.relative.appendChild(s),n.element.relative.appendChild(o),i=null,l=null,s=null,o=null},setSubmenu:function(){const e=this.util.createElement("DIV");return e.className="se-submenu se-selector-table",e.innerHTML='
    1 x 1
    ',e},setController_table:function(){const e=this.lang,t=this.icons,n=this.util.createElement("DIV");return n.className="se-controller se-controller-table",n.innerHTML='
    ",n},setController_tableEditor:function(e){const t=this.lang,n=this.icons,i=this.util.createElement("DIV");return i.className="se-controller se-controller-table-cell",i.innerHTML=(e?"":'
    ')+'
    • '+t.controller.VerticalSplit+'
    • '+t.controller.HorizontalSplit+"
    ",i},appendTable:function(){const e=this.util.createElement("TABLE"),t=this.plugins.table.createCells,n=this.context.table._tableXY[0];let i=this.context.table._tableXY[1],l="";for(;i>0;)l+=""+t.call(this,"td",n)+"",--i;l+="",e.innerHTML=l;if(this.insertComponent(e,!1,!0,!1)){const t=e.querySelector("td div");this.setRange(t,0,t,0),this.plugins.table.reset_table_picker.call(this)}},createCells:function(e,t,n){if(e=e.toLowerCase(),n){const t=this.util.createElement(e);return t.innerHTML="

    ",t}{let n="";for(;t>0;)n+="<"+e+">

    ",t--;return n}},onMouseMove_tablePicker:function(e){e.stopPropagation();let t=this._w.Math.ceil(e.offsetX/18),n=this._w.Math.ceil(e.offsetY/18);t=t<1?1:t,n=n<1?1:n,this.context.table.tableHighlight.style.width=t+"em",this.context.table.tableHighlight.style.height=n+"em";this.context.table.tableUnHighlight.style.width="10em",this.context.table.tableUnHighlight.style.height="10em",this.util.changeTxt(this.context.table.tableDisplay,t+" x "+n),this.context.table._tableXY=[t,n]},reset_table_picker:function(){if(!this.context.table.tableHighlight)return;const e=this.context.table.tableHighlight.style,t=this.context.table.tableUnHighlight.style;e.width="1em",e.height="1em",t.width="10em",t.height="10em",this.util.changeTxt(this.context.table.tableDisplay,"1 x 1"),this.submenuOff()},init:function(){const e=this.context.table,t=this.plugins.table;if(t._removeEvents.call(this),t._selectedTable){const e=t._selectedTable.querySelectorAll(".se-table-selected-cell");for(let t=0,n=e.length;t0)for(let e,t=0;to||(u>=e.index?(i+=e.cs,u+=e.cs,e.rs-=1,e.row=o+1,e.rs<1&&(r.splice(t,1),t--)):h===g-1&&(e.rs-=1,e.row=o+1,e.rs<1&&(r.splice(t,1),t--)));if(o===s&&h===l){n._logical_cellIndex=u;break}d>0&&a.push({index:u,cs:c+1,rs:d,row:-1}),i+=c}r=r.concat(a).sort((function(e,t){return e.index-t.index})),a=[]}a=null,r=null}},editTable:function(e,t){const n=this.plugins.table,i=this.context.table,l=i._element,o="row"===e;if(o){const e=i._trElement.parentNode;if(/^THEAD$/i.test(e.nodeName)){if("up"===t)return;if(!e.nextElementSibling||!/^TBODY$/i.test(e.nextElementSibling.nodeName))return void(l.innerHTML+=""+n.createCells.call(this,"td",i._logical_cellCnt,!1)+"")}}if(n._ref){const e=i._tdElement,l=n._selectedCells;if(o)if(t)n.setCellInfo.call(this,"up"===t?l[0]:l[l.length-1],!0),n.editRow.call(this,t,e);else{let e=l[0].parentNode;const i=[l[0]];for(let t,n=1,o=l.length;ns&&s>t&&(e[l].rowSpan=n+a,c-=i)}if(i){const e=r[o+1];if(e){const t=[];let n=r[o].cells,i=0;for(let e,l,o=0,s=n.length;o1&&(e.rowSpan-=1,t.push({cell:e.cloneNode(!1),index:l}));if(t.length>0){let l=t.shift();n=e.cells,i=0;for(let o,s,a=0,r=n.length;a=l.index)||(a--,i--,i+=l.cell.colSpan-1,e.insertBefore(l.cell,o),l=t.shift(),l));a++);if(l){e.appendChild(l.cell);for(let n=0,i=t.length;n0){const e=!o[b+1];for(let t,n=0;n_||(p>=t.index?(f+=t.cs,p=b+f,t.rs-=1,t.row=_+1,t.rs<1&&(d.splice(n,1),n--)):e&&(t.rs-=1,t.row=_+1,t.rs<1&&(d.splice(n,1),n--)))}n>0&&c.push({rs:n,cs:r+1,index:p,row:-1}),p>=t&&p+r<=t+s?h.push(e):p<=t+s&&p+r>=t?e.colSpan-=i.getOverlapRangeAtIndex(a,a+s,p,p+r):n>0&&(pt+s)&&g.push({cell:e,i:_,rs:_+n}),f+=r}else{if(b>=t)break;if(r>0){if(u<1&&r+b>=t){e.colSpan+=1,t=null,u=n+1;break}t-=r}if(!m){for(let e,n=0;n0){u-=1;continue}null!==t&&o.length>0&&(p=this.plugins.table.createCells.call(this,o[0].nodeName,0,!0),p=e.insertBefore(p,o[t]))}}if(l){let e,t;for(let n,l=0,o=h.length;l1)c.colSpan=this._w.Math.floor(e/2),l.colSpan=e-c.colSpan,s.insertBefore(c,l.nextElementSibling);else{let t=[],n=[];for(let s,r,c=0,d=i._rowCnt;c0)for(let e,t=0;tc||(u>=e.index?(r+=e.cs,u+=e.cs,e.rs-=1,e.row=c+1,e.rs<1&&(n.splice(t,1),t--)):h===g-1&&(e.rs-=1,e.row=c+1,e.rs<1&&(n.splice(t,1),t--)));if(u<=a&&d>0&&t.push({index:u,cs:o+1,rs:d,row:-1}),i!==l&&u<=a&&u+o>=a+e-1){i.colSpan+=1;break}if(u>a)break;r+=o}n=n.concat(t).sort((function(e,t){return e.index-t.index})),t=[]}s.insertBefore(c,l.nextElementSibling)}}else{const e=l.rowSpan;if(c.colSpan=l.colSpan,e>1){c.rowSpan=this._w.Math.floor(e/2);const n=e-c.rowSpan,i=[],r=t.getArrayIndex(o,s)+n;for(let e,t,n=0;n=a));c++)l=e[c],o=l.rowSpan-1,o>0&&o+n>=r&&s=h.index&&(r+=h.cs,l+=h.cs,h=i.shift()),l>=a||o===s-1){d.insertBefore(c,e.nextElementSibling);break}r+=t}l.rowSpan=n}else{c.rowSpan=l.rowSpan;const e=t.createElement("TR");e.appendChild(c);for(let e,t=0;t=r&&(e[n].rowSpan+=1)}const n=i._physical_cellIndex,a=s.cells;for(let e=0,t=a.length;e0&&s+o>=i&&(e.rowSpan-=n.getOverlapRangeAtIndex(i,l,s,s+o));else o.push(e[s]);for(let e=0,t=o.length;e"+this.plugins.table.createCells.call(this,"th",this.context.table._logical_cellCnt,!1)+"",i.insertBefore(t,i.firstElementChild)}e.toggleClass(t,"active"),/TH/i.test(this.context.table._tdElement.nodeName)?this.controllersOff():this.plugins.table.setPositionControllerDiv.call(this,this.context.table._tdElement,!1)},setTableStyle:function(e){const t=this.context.table,n=t._element;let i,l,o,s;e.indexOf("width")>-1&&(i=t.resizeButton.firstElementChild,l=t.resizeText,t._maxWidth?(o=t.icons.reduction,s=t.minText,t.columnFixedButton.style.display="block",this.util.removeClass(n,"se-table-size-auto"),this.util.addClass(n,"se-table-size-100")):(o=t.icons.expansion,s=t.maxText,t.columnFixedButton.style.display="none",this.util.removeClass(n,"se-table-size-100"),this.util.addClass(n,"se-table-size-auto")),this.util.changeElement(i,o),this.util.changeTxt(l,s)),e.indexOf("column")>-1&&(t._fixedColumn?(this.util.removeClass(n,"se-table-layout-auto"),this.util.addClass(n,"se-table-layout-fixed"),this.util.addClass(t.columnFixedButton,"active")):(this.util.removeClass(n,"se-table-layout-fixed"),this.util.addClass(n,"se-table-layout-auto"),this.util.removeClass(t.columnFixedButton,"active")))},setActiveButton:function(e,t){const n=this.context.table;/^TH$/i.test(e.nodeName)?(n.insertRowAboveButton.setAttribute("disabled",!0),n.insertRowBelowButton.setAttribute("disabled",!0)):(n.insertRowAboveButton.removeAttribute("disabled"),n.insertRowBelowButton.removeAttribute("disabled")),t&&e!==t?(n.splitButton.setAttribute("disabled",!0),n.mergeButton.removeAttribute("disabled")):(n.splitButton.removeAttribute("disabled"),n.mergeButton.setAttribute("disabled",!0))},_bindOnSelect:null,_bindOffSelect:null,_bindOffShift:null,_selectedCells:null,_shift:!1,_fixedCell:null,_fixedCellName:null,_selectedCell:null,_selectedTable:null,_ref:null,_toggleEditor:function(e){this.context.element.wysiwyg.setAttribute("contenteditable",e),e?this.util.removeClass(this.context.element.wysiwyg,"se-disabled"):this.util.addClass(this.context.element.wysiwyg,"se-disabled")},_offCellMultiSelect:function(e){e.stopPropagation();const t=this.plugins.table;t._shift?t._initBind&&(this._wd.removeEventListener("touchmove",t._initBind),t._initBind=null):(t._removeEvents.call(this),t._toggleEditor.call(this,!0)),t._fixedCell&&t._selectedTable&&(t.setActiveButton.call(this,t._fixedCell,t._selectedCell),t.call_controller_tableEdit.call(this,t._selectedCell||t._fixedCell),t._selectedCells=t._selectedTable.querySelectorAll(".se-table-selected-cell"),t._selectedCell&&t._fixedCell&&this.focusEdge(t._selectedCell),t._shift||(t._fixedCell=null,t._selectedCell=null,t._fixedCellName=null))},_onCellMultiSelect:function(e){this._antiBlur=!0;const t=this.plugins.table,n=this.util.getParentElement(e.target,this.util.isCell);if(t._shift)n===t._fixedCell?t._toggleEditor.call(this,!0):t._toggleEditor.call(this,!1);else if(!t._ref){if(n===t._fixedCell)return;t._toggleEditor.call(this,!1)}n&&n!==t._selectedCell&&t._fixedCellName===n.nodeName&&t._selectedTable===this.util.getParentElement(n,"TABLE")&&(t._selectedCell=n,t._setMultiCells.call(this,t._fixedCell,n))},_setMultiCells:function(e,t){const n=this.plugins.table,i=n._selectedTable.rows,l=this.util,o=n._selectedTable.querySelectorAll(".se-table-selected-cell");for(let e=0,t=o.length;e0)for(let e,t=0;td||(u>=e.index?(o+=e.cs,u+=e.cs,e.rs-=1,e.row=d+1,e.rs<1&&(a.splice(t,1),t--)):p===m-1&&(e.rs-=1,e.row=d+1,e.rs<1&&(a.splice(t,1),t--)));if(s){if(i!==e&&i!==t||(c.cs=null!==c.cs&&c.csu+h?c.ce:u+h,c.rs=null!==c.rs&&c.rsd+g?c.re:d+g,c._i+=1),2===c._i){s=!1,a=[],r=[],d=-1;break}}else if(l.getOverlapRangeAtIndex(c.cs,c.ce,u,u+h)&&l.getOverlapRangeAtIndex(c.rs,c.re,d,d+g)){const e=c.csu+h?c.ce:u+h,n=c.rsd+g?c.re:d+g;if(c.cs!==e||c.ce!==t||c.rs!==n||c.re!==o){c.cs=e,c.ce=t,c.rs=n,c.re=o,d=-1,a=[],r=[];break}l.addClass(i,"se-table-selected-cell")}g>0&&r.push({index:u,cs:h+1,rs:g,row:-1}),o+=i.colSpan-1}a=a.concat(r).sort((function(e,t){return e.index-t.index})),r=[]}},_removeEvents:function(){const e=this.plugins.table;e._initBind&&(this._wd.removeEventListener("touchmove",e._initBind),e._initBind=null),e._bindOnSelect&&(this._wd.removeEventListener("mousedown",e._bindOnSelect),this._wd.removeEventListener("mousemove",e._bindOnSelect),e._bindOnSelect=null),e._bindOffSelect&&(this._wd.removeEventListener("mouseup",e._bindOffSelect),e._bindOffSelect=null),e._bindOffShift&&(this._wd.removeEventListener("keyup",e._bindOffShift),e._bindOffShift=null)},_initBind:null,onTableCellMultiSelect:function(e,t){const n=this.plugins.table;n._removeEvents.call(this),this.controllersOff(),n._shift=t,n._fixedCell=e,n._fixedCellName=e.nodeName,n._selectedTable=this.util.getParentElement(e,"TABLE");const i=n._selectedTable.querySelectorAll(".se-table-selected-cell");for(let e=0,t=i.length;e-1?(n=e.toLowerCase(),s="blockquote"===n?"range":"pre"===n?"free":"replace",r=/^h/.test(n)?n.match(/\d+/)[0]:"",a=t["tag_"+(r?"h":n)]+r,d="",c=""):(n=e.tag.toLowerCase(),s=e.command,a=e.name||n,d=e.class,c=d?' class="'+d+'"':""),o+='
  • ";return o+="",n.innerHTML=o,n},active:function(e){let t=this.lang.toolbar.formats;const n=this.context.formatBlock.targetText,i=this.context.formatBlock.targetTooltip;if(e){if(this.util.isFormatElement(e)){const l=this.context.formatBlock._formatList,o=e.nodeName.toLowerCase(),s=(e.className.match(/(\s|^)__se__format__[^\s]+/)||[""])[0].trim();for(let e,n=0,i=l.length;n=0;u--)if(i=p[u],i!==(p[u+1]?p[u+1].parentNode:null)){if(d=r.isComponent(i),o=d?"":i.innerHTML.replace(/(?!>)\s+(?=<)|\n/g," "),s=r.getParentElement(i,(function(e){return e.parentNode===t})),(t!==i.parentNode||d)&&(r.isFormatElement(t)?(t.parentNode.insertBefore(n,t.nextSibling),t=t.parentNode):(t.insertBefore(n,s?s.nextSibling:null),t=i.parentNode),a=n.nextSibling,a&&n.nodeName===a.nodeName&&r.isSameAttributes(n,a)&&(n.innerHTML+="
    "+a.innerHTML,r.removeItem(a)),n=l.cloneNode(!1),h=!0),c=n.innerHTML,n.innerHTML=(h||!o||!c||/
    $/i.test(o)?o:o+"
    ")+c,0===u){t.insertBefore(n,i),a=i.nextSibling,a&&n.nodeName===a.nodeName&&r.isSameAttributes(n,a)&&(n.innerHTML+="
    "+a.innerHTML,r.removeItem(a));const e=n.previousSibling;e&&n.nodeName===e.nodeName&&r.isSameAttributes(n,e)&&(e.innerHTML+="
    "+n.innerHTML,r.removeItem(n))}d||r.removeItem(i),o&&(h=!1)}this.setRange(i,0,i,0)}else{for(let e,t,n=0,s=p.length;n('+t.toolbar.default+")";for(let e,t=0,n=i.length;t";return l+="",n.innerHTML=l,n},on:function(){const e=this.context.lineHeight,t=e._sizeList,n=this.util.getFormatElement(this.getSelectionNode()),i=n?n.style.lineHeight+"":"";if(i!==e.currentSize){for(let e=0,n=t.length;e"}return o+="",t.innerHTML=o,t},on:function(){const e=this.context.paragraphStyle._classList,t=this.util.getFormatElement(this.getSelectionNode());for(let n=0,i=e.length;n"}return l+="",t.innerHTML=l,t},on:function(){const e=this.util,t=this.context.textStyle._styleList,n=this.getSelectionNode();for(let i,l,o,s=0,a=t.length;s'+(e.alt||t)+'
    '+(e.name||t)+"
    "},setImage:function(e){this.callPlugin("image",function(){const t={name:e.parentNode.querySelector(".__se__img_name").textContent,size:0};this.context.image._altText=e.alt,this.plugins.image.create_image.call(this,e.src,"",!1,this.context.image._origin_w,this.context.image._origin_h,"none",t)}.bind(this),null)}},mention:y},E={redo:'',undo:'',bold:'',underline:'',italic:'',strike:'',subscript:'',superscript:'',erase:'',indent:'',outdent:'',expansion:'',reduction:'',code_view:'',preview:'',print:'',template:'',line_height:'',paragraph_style:'',text_style:'',save:'',blockquote:'',arrow_down:'',align_justify:'',align_left:'',align_right:'',align_center:'',font_color:'',highlight_color:'',list_bullets:'',list_number:'',table:'',horizontal_rule:'',show_blocks:'',cancel:'',image:'',video:'',link:'',math:'',unlink:'',table_header:'',merge_cell:'',split_cell:'',caption:'',edit:'',delete:'',modify:'',revert:'',auto_size:'',insert_row_below:'',insert_row_above:'',insert_column_left:'',insert_column_right:'',delete_row:'',delete_column:'',fixed_column_width:'',rotate_left:'',rotate_right:'',mirror_horizontal:'',mirror_vertical:'',checked:'',line_break:'',audio:'',image_gallery:'',more_text:'',more_paragraph:'',more_plus:'',more_horizontal:'',more_vertical:'',attachment:'',map:'',magic_stick:'',empty_file:''},S=n("P6u4"),N=n.n(S);const T={_d:null,_w:null,isIE:null,isIE_Edge:null,isOSX_IOS:null,_propertiesInit:function(){this._d||(this._d=document,this._w=window,this.isIE=navigator.userAgent.indexOf("Trident")>-1,this.isIE_Edge=navigator.userAgent.indexOf("Trident")>-1||navigator.appVersion.indexOf("Edge")>-1,this.isOSX_IOS=/(Mac|iPhone|iPod|iPad)/.test(navigator.platform))},_HTMLConvertor:function(e){const t={"&":"&"," ":" ","'":"'",'"':""","<":"<",">":">"};return e.replace(/&|\u00A0|'|"|<|>/g,(function(e){return"string"==typeof t[e]?t[e]:e}))},zeroWidthSpace:String.fromCharCode(8203),zeroWidthRegExp:new RegExp(String.fromCharCode(8203),"g"),onlyZeroWidthRegExp:new RegExp("^"+String.fromCharCode(8203)+"+$"),onlyZeroWidthSpace:function(e){return"string"!=typeof e&&(e=e.textContent),""===e||this.onlyZeroWidthRegExp.test(e)},getXMLHttpRequest:function(){if(!this._w.ActiveXObject)return this._w.XMLHttpRequest?new XMLHttpRequest:null;try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(e){try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(e){return null}}},createElement:function(e){return this._d.createElement(e)},createTextNode:function(e){return this._d.createTextNode(e||"")},HTMLEncoder:function(e){const t={"<":"$lt;",">":"$gt;"};return e.replace(/<|>/g,(function(e){return"string"==typeof t[e]?t[e]:e}))},HTMLDecoder:function(e){const t={"$lt;":"<","$gt;":">"};return e.replace(/\$lt;|\$gt;/g,(function(e){return"string"==typeof t[e]?t[e]:e}))},hasOwn:function(e,t){return this._hasOwn.call(e,t)},_hasOwn:Object.prototype.hasOwnProperty,getIncludePath:function(e,t){let n="";const i=[],l="js"===t?"script":"link",o="js"===t?"src":"href";let s="(?:";for(let t=0,n=e.length;t0?i[0][o]:""),-1===n.indexOf(":/")&&"//"!==n.slice(0,2)&&(n=0===n.indexOf("/")?location.href.match(/^.*?:\/\/[^\/]*/)[0]+n:location.href.match(/^[^\?]*\/(?:)/)[0]+n),!n)throw"[SUNEDITOR.util.getIncludePath.fail] The SUNEDITOR installation path could not be automatically detected. (name: +"+name+", extension: "+t+")";return n},getPageStyle:function(e){let t="";const n=(e||this._d).styleSheets;for(let e,i=0,l=n.length;i-1||(i+=n[e].name+'="'+n[e].value+'" ');return i},getByteLength:function(e){const t=this._w.encodeURIComponent;let n,i;return this.isIE_Edge?(i=this._w.unescape(t(e.toString())).length,n=0,null!==t(e.toString()).match(/(%0A|%0D)/gi)&&(n=t(e.toString()).match(/(%0A|%0D)/gi).length),i+n):(i=new this._w.TextEncoder("utf-8").encode(e.toString()).length,n=0,null!==t(e.toString()).match(/(%0A|%0D)/gi)&&(n=t(e.toString()).match(/(%0A|%0D)/gi).length),i+n)},isWysiwygDiv:function(e){return e&&1===e.nodeType&&(this.hasClass(e,"se-wrapper-wysiwyg")||/^BODY$/i.test(e.nodeName))},isNonEditable:function(e){return e&&1===e.nodeType&&"false"===e.getAttribute("contenteditable")},isTextStyleElement:function(e){return e&&3!==e.nodeType&&/^(strong|span|font|b|var|i|em|u|ins|s|strike|del|sub|sup|mark|a|label|code)$/i.test(e.nodeName)},isFormatElement:function(e){return e&&1===e.nodeType&&(/^(P|DIV|H[1-6]|PRE|LI|TH|TD)$/i.test(e.nodeName)||this.hasClass(e,"(\\s|^)__se__format__replace_.+(\\s|$)|(\\s|^)__se__format__free_.+(\\s|$)"))&&!this.isComponent(e)&&!this.isWysiwygDiv(e)},isRangeFormatElement:function(e){return e&&1===e.nodeType&&(/^(BLOCKQUOTE|OL|UL|FIGCAPTION|TABLE|THEAD|TBODY|TR|TH|TD)$/i.test(e.nodeName)||this.hasClass(e,"(\\s|^)__se__format__range_.+(\\s|$)"))},isClosureRangeFormatElement:function(e){return e&&1===e.nodeType&&(/^(TH|TD)$/i.test(e.nodeName)||this.hasClass(e,"(\\s|^)__se__format__range__closure_.+(\\s|$)"))},isFreeFormatElement:function(e){return e&&1===e.nodeType&&(/^PRE$/i.test(e.nodeName)||this.hasClass(e,"(\\s|^)__se__format__free_.+(\\s|$)"))&&!this.isComponent(e)&&!this.isWysiwygDiv(e)},isClosureFreeFormatElement:function(e){return e&&1===e.nodeType&&this.hasClass(e,"(\\s|^)__se__format__free__closure_.+(\\s|$)")},isComponent:function(e){return e&&(/se-component/.test(e.className)||/^(TABLE|HR)$/.test(e.nodeName))},isMediaComponent:function(e){return e&&/se-component/.test(e.className)},isNotCheckingNode:function(e){return e&&/katex|__se__tag/.test(e.className)},getFormatElement:function(e,t){if(!e)return null;for(t||(t=function(){return!0});e;){if(this.isWysiwygDiv(e))return null;if(this.isRangeFormatElement(e)&&e.firstElementChild,this.isFormatElement(e)&&t(e))return e;e=e.parentNode}return null},getRangeFormatElement:function(e,t){if(!e)return null;for(t||(t=function(){return!0});e;){if(this.isWysiwygDiv(e))return null;if(this.isRangeFormatElement(e)&&!/^(THEAD|TBODY|TR)$/i.test(e.nodeName)&&t(e))return e;e=e.parentNode}return null},getFreeFormatElement:function(e,t){if(!e)return null;for(t||(t=function(){return!0});e;){if(this.isWysiwygDiv(e))return null;if(this.isFreeFormatElement(e)&&t(e))return e;e=e.parentNode}return null},getClosureFreeFormatElement:function(e,t){if(!e)return null;for(t||(t=function(){return!0});e;){if(this.isWysiwygDiv(e))return null;if(this.isClosureFreeFormatElement(e)&&t(e))return e;e=e.parentNode}return null},copyTagAttributes:function(e,t){t.style.cssText&&(e.style.cssText+=t.style.cssText);const n=t.classList;for(let t=0,i=n.length;ts?1:o0&&!this.isBreak(e);)e=e.firstChild;for(;t&&1===t.nodeType&&t.childNodes.length>0&&!this.isBreak(t);)t=t.lastChild;return{sc:e,ec:t||e}}},getOffset:function(e,t){let n=0,i=0,l=3===e.nodeType?e.parentElement:e;const o=this.getParentElement(e,this.isWysiwygDiv.bind(this));for(;l&&!this.hasClass(l,"se-container")&&l!==o;)n+=l.offsetLeft,i+=l.offsetTop,l=l.offsetParent;const s=t&&/iframe/i.test(t.nodeName);return{left:n+(s?t.parentElement.offsetLeft:0),top:i-o.scrollTop+(s?t.parentElement.offsetTop:0)}},getOverlapRangeAtIndex:function(e,t,n,i){if(e<=i?tn)return 0;const l=(e>n?e:n)-(t0?" ":"")+t)},removeClass:function(e,t){if(!e)return;const n=new this._w.RegExp("(\\s|^)"+t+"(\\s|$)");e.className=e.className.replace(n," ").trim(),e.className.trim()||e.removeAttribute("class")},toggleClass:function(e,t){if(!e)return;const n=new this._w.RegExp("(\\s|^)"+t+"(\\s|$)");n.test(e.className)?e.className=e.className.replace(n," ").trim():e.className+=" "+t,e.className.trim()||e.removeAttribute("class")},setDisabledButtons:function(e,t){for(let n=0,i=t.length;n=0){e.splitText(t);const n=this.getNodeFromPath([a+1],i);this.onlyZeroWidthSpace(n)&&(n.data=this.zeroWidthSpace)}}else 1===e.nodeType&&(e.previousSibling?e=e.previousSibling:this.getElementDepth(e)===n&&(r=!1));let c=e;for(;this.getElementDepth(c)>n;)for(a=this.getPositionIndex(c)+1,c=c.parentNode,s=l,l=c.cloneNode(!1),o=c.childNodes,s&&(this.isListCell(l)&&this.isList(s)&&s.firstElementChild?(l.innerHTML=s.firstElementChild.innerHTML,T.removeItem(s.firstElementChild),s.children.length>0&&l.appendChild(s)):l.appendChild(s));o[a];)l.appendChild(o[a]);c.childNodes.length<=1&&(!c.firstChild||0===c.firstChild.textContent.length)&&(c.innerHTML="
    ");const d=c.parentNode;return r&&(c=c.nextSibling),l?(this.mergeSameTags(l,null,!1),this.mergeNestedTags(l,function(e){return this.isList(e)}.bind(this)),l.childNodes.length>0?d.insertBefore(l,c):l=c,0===i.childNodes.length&&this.removeItem(i),l):c},mergeSameTags:function(e,t,n){const i=this,l=t?t.length:0;let o=null;return l&&(o=this._w.Array.apply(null,new this._w.Array(l)).map(this._w.Number.prototype.valueOf,0)),function e(s,a,r){const c=s.childNodes;for(let d,u,h=0,g=c.length;h=0;){if(i.getArrayIndex(o.childNodes,n)!==e[r]){c=!1;break}n=d.parentNode,o=n.parentNode,r--}c&&(e.splice(a,1),e[a]=h)}}i.copyTagAttributes(d,s),s.parentNode.insertBefore(d,s),i.removeItem(s)}if(!u){1===d.nodeType&&e(d,a+1,h);break}if(d.nodeName===u.nodeName&&i.isSameAttributes(d,u)&&d.href===u.href){const e=d.childNodes;let n=0;for(let t=0,i=e.length;t0&&n++;const s=d.lastChild,c=u.firstChild;let g=0;if(s&&c){const e=3===s.nodeType&&3===c.nodeType;g=s.textContent.length;let i=s.previousSibling;for(;i&&3===i.nodeType;)g+=i.textContent.length,i=i.previousSibling;if(n>0&&3===s.nodeType&&3===c.nodeType&&(s.textContent.length>0||c.textContent.length>0)&&n--,l){let i=null;for(let d=0;dh){if(a>0&&i[a-1]!==r)continue;i[a]-=1,i[a+1]>=0&&i[a]===h&&(i[a+1]+=n,e&&s&&3===s.nodeType&&c&&3===c.nodeType&&(o[d]+=g))}}}if(3===d.nodeType){if(g=d.textContent.length,d.textContent+=u.textContent,l){let e=null;for(let i=0;ih){if(a>0&&e[a-1]!==r)continue;e[a]-=1,e[a+1]>=0&&e[a]===h&&(e[a+1]+=n,o[i]+=g)}}}else d.innerHTML+=u.innerHTML;i.removeItem(u),h--}else 1===d.nodeType&&e(d,a+1,h)}}(e,0,0),o},mergeNestedTags:function(e,t){"string"==typeof t?t=function(e){return this.test(e.tagName)}.bind(new this._w.RegExp("^("+(t||".+")+")$","i")):"function"!=typeof t&&(t=function(){return!0}),function e(n){let i=n.children;if(1===i.length&&i[0].nodeName===n.nodeName&&t(n)){const e=i[0];for(i=e.children;i[0];)n.appendChild(i[0]);n.removeChild(e)}for(let t=0,i=n.children.length;t")},htmlRemoveWhiteSpace:function(e){return e?e.trim().replace(/<\/?(?!strong|span|font|b|var|i|em|u|ins|s|strike|del|sub|sup|mark|a|label|code)[^>^<]+>\s+(?=<)/gi,(function(e){return e.trim()})):""},sortByDepth:function(e,t){const n=t?1:-1,i=-1*n;e.sort(function(e,t){return this.isListCell(e)&&this.isListCell(t)?(e=this.getElementDepth(e))>(t=this.getElementDepth(t))?n:e":e.innerHTML,e.innerHTML=t.outerHTML},_setDefaultOptionStyle:function(e,t){let n="";e.height&&(n+="height:"+e.height+";"),e.minHeight&&(n+="min-height:"+e.minHeight+";"),e.maxHeight&&(n+="max-height:"+e.maxHeight+";"),e.position&&(n+="position:"+e.position+";"),e.width&&(n+="width:"+e.width+";"),e.minWidth&&(n+="min-width:"+e.minWidth+";"),e.maxWidth&&(n+="max-width:"+e.maxWidth+";");let i="",l="",o="";const s=(t=n+t).split(";");for(let t,n=0,a=s.length;n'+this._setIframeCssTags(t),e.contentDocument.body.className="sun-editor-editable",e.contentDocument.body.setAttribute("contenteditable",!0)},_setIframeCssTags:function(e){const t=e.iframeCSSFileName,n=this._w.RegExp;let i="";for(let e,l=0,o=t.length;l'}return i+("auto"===e.height?"":"")}};var L=T,k={init:function(e,t){"object"!=typeof t&&(t={});const n=document;this._initOptions(e,t);const i=n.createElement("DIV");i.className="sun-editor",e.id&&(i.id="suneditor_"+e.id);const l=n.createElement("DIV");l.className="se-container";const o=this._createToolBar(n,t.buttonList,t.plugins,t);o.element.style.visibility="hidden",o.pluginCallButtons.math&&this._checkKatexMath(t.katex);const s=n.createElement("DIV");s.className="se-arrow";const a=n.createElement("DIV");a.className="se-toolbar-sticky-dummy";const r=n.createElement("DIV");r.className="se-wrapper";const c=this._initElements(t,i,o.element,s),d=c.bottomBar,u=c.wysiwygFrame,h=c.placeholder;let g=c.codeView;const p=d.resizingBar,m=d.navigation,f=d.charWrapper,_=d.charCounter,b=n.createElement("DIV");b.className="se-loading-box sun-editor-common",b.innerHTML='
    ';const v=n.createElement("DIV");v.className="se-line-breaker",v.innerHTML='";const y=n.createElement("DIV");y.className+="se-line-breaker-component";const C=y.cloneNode(!0);y.innerHTML=C.innerHTML=t.icons.line_break;const w=n.createElement("DIV");w.className="se-resizing-back";const x=t.toolbarContainer;return x&&x.appendChild(o.element),r.appendChild(g),h&&r.appendChild(h),x||l.appendChild(o.element),l.appendChild(a),l.appendChild(r),l.appendChild(w),l.appendChild(b),l.appendChild(v),l.appendChild(y),l.appendChild(C),p&&l.appendChild(p),i.appendChild(l),g=this._checkCodeMirror(t,g),{constructed:{_top:i,_relative:l,_toolBar:o.element,_menuTray:o._menuTray,_editorArea:r,_wysiwygArea:u,_codeArea:g,_placeholder:h,_resizingBar:p,_navigation:m,_charWrapper:f,_charCounter:_,_loading:b,_lineBreaker:v,_lineBreaker_t:y,_lineBreaker_b:C,_resizeBack:w,_stickyDummy:a,_arrow:s},options:t,plugins:o.plugins,pluginCallButtons:o.pluginCallButtons,_responsiveButtons:o.responsiveButtons}},_checkCodeMirror:function(e,t){if(e.codeMirror){const n=[{mode:"htmlmixed",htmlMode:!0,lineNumbers:!0,lineWrapping:!0},e.codeMirror.options||{}].reduce((function(e,t){for(let n in t)L.hasOwn(t,n)&&(e[n]=t[n]);return e}),{});"auto"===e.height&&(n.viewportMargin=1/0,n.height="auto");const i=e.codeMirror.src.fromTextArea(t,n);i.display.wrapper.style.cssText=t.style.cssText,e.codeMirrorEditor=i,(t=i.display.wrapper).className+=" se-wrapper-code-mirror"}return t},_checkKatexMath:function(e){if(!e)throw Error('[SUNEDITOR.create.fail] To use the math button you need to add a "katex" object to the options.');const t=[{throwOnError:!1},e.options||{}].reduce((function(e,t){for(let n in t)L.hasOwn(t,n)&&(e[n]=t[n]);return e}),{});e.options=t},_setOptions:function(e,t,n,i){this._initOptions(t.element.originElement,e);const l=t.element,o=l.relative,s=l.editorArea,a=e.toolbarContainer&&e.toolbarContainer!==i.toolbarContainer,r=!!e.buttonList||e.mode!==i.mode||a,c=!!e.plugins,d=this._createToolBar(document,r?e.buttonList:i.buttonList,c?e.plugins:n,e);d.pluginCallButtons.math&&this._checkKatexMath(e.katex);const u=document.createElement("DIV");u.className="se-arrow",r&&(d.element.style.visibility="hidden",a?(e.toolbarContainer.appendChild(d.element),l.toolbar.parentElement.removeChild(l.toolbar)):l.toolbar.parentElement.replaceChild(d.element,l.toolbar),l.toolbar=d.element,l._menuTray=d._menuTray,l._arrow=u);const h=this._initElements(e,l.topArea,r?d.element:l.toolbar,u),g=h.bottomBar,p=h.wysiwygFrame,m=h.placeholder;let f=h.codeView;return l.resizingBar&&o.removeChild(l.resizingBar),g.resizingBar&&o.appendChild(g.resizingBar),s.innerHTML="",s.appendChild(f),m&&s.appendChild(m),f=this._checkCodeMirror(e,f),l.resizingBar=g.resizingBar,l.navigation=g.navigation,l.charWrapper=g.charWrapper,l.charCounter=g.charCounter,l.wysiwygFrame=p,l.code=f,l.placeholder=m,{callButtons:r?d.pluginCallButtons:null,plugins:r||c?d.plugins:null,toolbar:d}},_initElements:function(e,t,n,i){t.style.cssText=e._editorStyles.top,/inline/i.test(e.mode)?(n.className+=" se-toolbar-inline",n.style.width=e.toolbarWidth):/balloon/i.test(e.mode)&&(n.className+=" se-toolbar-balloon",n.style.width=e.toolbarWidth,n.appendChild(i));const l=document.createElement(e.iframe?"IFRAME":"DIV");l.className="se-wrapper-inner se-wrapper-wysiwyg",e.iframe?(l.allowFullscreen=!0,l.frameBorder=0,l.style.cssText=e._editorStyles.frame):(l.setAttribute("contenteditable",!0),l.setAttribute("scrolling","auto"),l.className+=" sun-editor-editable",l.style.cssText=e._editorStyles.frame+e._editorStyles.editor);const o=document.createElement("TEXTAREA");o.className="se-wrapper-inner se-wrapper-code",o.style.cssText=e._editorStyles.frame,o.style.display="none","auto"===e.height&&(o.style.overflow="hidden");let s=null,a=null,r=null,c=null;if(e.resizingBar&&(s=document.createElement("DIV"),s.className="se-resizing-bar sun-editor-common",a=document.createElement("DIV"),a.className="se-navigation sun-editor-common",s.appendChild(a),e.charCounter)){if(r=document.createElement("DIV"),r.className="se-char-counter-wrapper",e.charCounterLabel){const t=document.createElement("SPAN");t.className="se-char-label",t.textContent=e.charCounterLabel,r.appendChild(t)}if(c=document.createElement("SPAN"),c.className="se-char-counter",c.textContent="0",r.appendChild(c),e.maxCharCount>0){const t=document.createElement("SPAN");t.textContent=" / "+e.maxCharCount,r.appendChild(t)}s.appendChild(r)}let d=null;return e.placeholder&&(d=document.createElement("SPAN"),d.className="se-placeholder",d.innerText=e.placeholder),{bottomBar:{resizingBar:s,navigation:a,charWrapper:r,charCounter:c},wysiwygFrame:l,codeView:o,placeholder:d}},_initOptions:function(e,t){t.lang=t.lang||N.a,t.value="string"==typeof t.value?t.value:null,t.historyStackDelayTime="number"==typeof t.historyStackDelayTime?t.historyStackDelayTime:400,t._defaultTagsWhitelist="string"==typeof t._defaultTagsWhitelist?t._defaultTagsWhitelist:"br|p|div|pre|blockquote|h[1-6]|ol|ul|li|hr|figure|figcaption|img|iframe|audio|video|source|table|thead|tbody|tr|th|td|a|b|strong|var|i|em|u|ins|s|span|strike|del|sub|sup|code",t._editorTagsWhitelist=t._defaultTagsWhitelist+("string"==typeof t.addTagsWhitelist&&t.addTagsWhitelist.length>0?"|"+t.addTagsWhitelist:""),t.pasteTagsWhitelist="string"==typeof t.pasteTagsWhitelist?t.pasteTagsWhitelist:t._editorTagsWhitelist,t.attributesWhitelist=t.attributesWhitelist&&"object"==typeof t.attributesWhitelist?t.attributesWhitelist:null,t.mode=t.mode||"classic",t.toolbarWidth=t.toolbarWidth?L.isNumber(t.toolbarWidth)?t.toolbarWidth+"px":t.toolbarWidth:"auto",t.toolbarContainer=/balloon/i.test(t.mode)?null:"string"==typeof t.toolbarContainer?document.querySelector(t.toolbarContainer):t.toolbarContainer,t.stickyToolbar=/balloon/i.test(t.mode)||t.toolbarContainer?-1:void 0===t.stickyToolbar?0:/^\d+/.test(t.stickyToolbar)?L.getNumber(t.stickyToolbar,0):-1,t.fullPage=!!t.fullPage,t.iframe=t.fullPage||t.iframe,t.iframeCSSFileName=t.iframe?"string"==typeof t.iframeCSSFileName?[t.iframeCSSFileName]:t.iframeCSSFileName||["suneditor"]:null,t.codeMirror=t.codeMirror?t.codeMirror.src?t.codeMirror:{src:t.codeMirror}:null,t.position="string"==typeof t.position?t.position:null,t.display=t.display||("none"!==e.style.display&&e.style.display?e.style.display:"block"),t.popupDisplay=t.popupDisplay||"full",t.resizingBar=void 0===t.resizingBar?!/inline|balloon/i.test(t.mode):t.resizingBar,t.showPathLabel=!!t.resizingBar&&("boolean"!=typeof t.showPathLabel||t.showPathLabel),t.charCounter=t.maxCharCount>0||"boolean"==typeof t.charCounter&&t.charCounter,t.charCounterType="string"==typeof t.charCounterType?t.charCounterType:"char",t.charCounterLabel="string"==typeof t.charCounterLabel?t.charCounterLabel.trim():null,t.maxCharCount=L.isNumber(t.maxCharCount)&&t.maxCharCount>-1?1*t.maxCharCount:null,t.width=t.width?L.isNumber(t.width)?t.width+"px":t.width:e.clientWidth?e.clientWidth+"px":"100%",t.minWidth=(L.isNumber(t.minWidth)?t.minWidth+"px":t.minWidth)||"",t.maxWidth=(L.isNumber(t.maxWidth)?t.maxWidth+"px":t.maxWidth)||"",t.height=t.height?L.isNumber(t.height)?t.height+"px":t.height:e.clientHeight?e.clientHeight+"px":"auto",t.minHeight=(L.isNumber(t.minHeight)?t.minHeight+"px":t.minHeight)||"",t.maxHeight=(L.isNumber(t.maxHeight)?t.maxHeight+"px":t.maxHeight)||"",t.defaultStyle="string"==typeof t.defaultStyle?t.defaultStyle:"",t.font=t.font?t.font:null,t.fontSize=t.fontSize?t.fontSize:null,t.formats=t.formats?t.formats:null,t.colorList=t.colorList?t.colorList:null,t.lineHeights=t.lineHeights?t.lineHeights:null,t.paragraphStyles=t.paragraphStyles?t.paragraphStyles:null,t.textStyles=t.textStyles?t.textStyles:null,t.fontSizeUnit="string"==typeof t.fontSizeUnit&&t.fontSizeUnit.trim()||"px",t.imageResizing=void 0===t.imageResizing||t.imageResizing,t.imageHeightShow=void 0===t.imageHeightShow||!!t.imageHeightShow,t.imageWidth=t.imageWidth?L.isNumber(t.imageWidth)?t.imageWidth+"px":t.imageWidth:"auto",t.imageHeight=t.imageHeight?L.isNumber(t.imageHeight)?t.imageHeight+"px":t.imageHeight:"auto",t.imageSizeOnlyPercentage=!!t.imageSizeOnlyPercentage,t._imageSizeUnit=t.imageSizeOnlyPercentage?"%":"px",t.imageRotation=void 0!==t.imageRotation?t.imageRotation:!(t.imageSizeOnlyPercentage||!t.imageHeightShow),t.imageFileInput=void 0===t.imageFileInput||t.imageFileInput,t.imageUrlInput=void 0===t.imageUrlInput||!t.imageFileInput||t.imageUrlInput,t.imageUploadHeader=t.imageUploadHeader||null,t.imageUploadUrl="string"==typeof t.imageUploadUrl?t.imageUploadUrl:null,t.imageUploadSizeLimit=/\d+/.test(t.imageUploadSizeLimit)?L.getNumber(t.imageUploadSizeLimit,0):null,t.imageMultipleFile=!!t.imageMultipleFile,t.imageAccept="string"!=typeof t.imageAccept||"*"===t.imageAccept.trim()?"image/*":t.imageAccept.trim()||"image/*",t.imageGalleryUrl="string"==typeof t.imageGalleryUrl?t.imageGalleryUrl:null,t.videoResizing=void 0===t.videoResizing||t.videoResizing,t.videoHeightShow=void 0===t.videoHeightShow||!!t.videoHeightShow,t.videoRatioShow=void 0===t.videoRatioShow||!!t.videoRatioShow,t.videoWidth=t.videoWidth&&L.getNumber(t.videoWidth,0)?L.isNumber(t.videoWidth)?t.videoWidth+"px":t.videoWidth:"",t.videoHeight=t.videoHeight&&L.getNumber(t.videoHeight,0)?L.isNumber(t.videoHeight)?t.videoHeight+"px":t.videoHeight:"",t.videoSizeOnlyPercentage=!!t.videoSizeOnlyPercentage,t._videoSizeUnit=t.videoSizeOnlyPercentage?"%":"px",t.videoRotation=void 0!==t.videoRotation?t.videoRotation:!(t.videoSizeOnlyPercentage||!t.videoHeightShow),t.videoRatio=L.getNumber(t.videoRatio,4)||.5625,t.videoRatioList=t.videoRatioList?t.videoRatioList:null,t.youtubeQuery=(t.youtubeQuery||"").replace("?",""),t.videoFileInput=!!t.videoFileInput,t.videoUrlInput=void 0===t.videoUrlInput||!t.videoFileInput||t.videoUrlInput,t.videoUploadHeader=t.videoUploadHeader||null,t.videoUploadUrl="string"==typeof t.videoUploadUrl?t.videoUploadUrl:null,t.videoUploadSizeLimit=/\d+/.test(t.videoUploadSizeLimit)?L.getNumber(t.videoUploadSizeLimit,0):null,t.videoMultipleFile=!!t.videoMultipleFile,t.videoTagAttrs=t.videoTagAttrs||null,t.videoIframeAttrs=t.videoIframeAttrs||null,t.videoAccept="string"!=typeof t.videoAccept||"*"===t.videoAccept.trim()?"video/*":t.videoAccept.trim()||"video/*",t.audioWidth=t.audioWidth?L.isNumber(t.audioWidth)?t.audioWidth+"px":t.audioWidth:"",t.audioHeight=t.audioHeight?L.isNumber(t.audioHeight)?t.audioHeight+"px":t.audioHeight:"",t.audioFileInput=!!t.audioFileInput,t.audioUrlInput=void 0===t.audioUrlInput||!t.audioFileInput||t.audioUrlInput,t.audioUploadHeader=t.audioUploadHeader||null,t.audioUploadUrl="string"==typeof t.audioUploadUrl?t.audioUploadUrl:null,t.audioUploadSizeLimit=/\d+/.test(t.audioUploadSizeLimit)?L.getNumber(t.audioUploadSizeLimit,0):null,t.audioMultipleFile=!!t.audioMultipleFile,t.audioTagAttrs=t.audioTagAttrs||null,t.audioAccept="string"!=typeof t.audioAccept||"*"===t.audioAccept.trim()?"audio/*":t.audioAccept.trim()||"audio/*",t.tableCellControllerPosition="string"==typeof t.tableCellControllerPosition?t.tableCellControllerPosition.toLowerCase():"cell",t.tabDisable=!!t.tabDisable,t.shortcutsDisable=Array.isArray(t.shortcutsDisable)&&t.shortcutsDisable.length>0?t.shortcutsDisable.map((function(e){return e.toLowerCase()})):[],t.shortcutsHint=void 0===t.shortcutsHint||!!t.shortcutsHint,t.callBackSave=t.callBackSave?t.callBackSave:null,t.templates=t.templates?t.templates:null,t.placeholder="string"==typeof t.placeholder?t.placeholder:null,t.linkProtocol="string"==typeof t.linkProtocol?t.linkProtocol:null,t.katex=t.katex?t.katex.src?t.katex:{src:t.katex}:null,t.buttonList=t.buttonList||[["undo","redo"],["bold","underline","italic","strike","subscript","superscript"],["removeFormat"],["outdent","indent"],["fullScreen","showBlocks","codeView"],["preview","print"]],t.icons=t.icons&&"object"==typeof t.icons?[E,t.icons].reduce((function(e,t){for(let n in t)L.hasOwn(t,n)&&(e[n]=t[n]);return e}),{}):E,t._editorStyles=L._setDefaultOptionStyle(t,t.defaultStyle)},_defaultButtons:function(e){const t=e.icons,n=e.lang,i=L.isOSX_IOS?"⌘":"CTRL",l=e.shortcutsHint?e.shortcutsDisable:["bold","strike","underline","italic","undo","indent"];return{bold:["_se_command_bold",n.toolbar.bold+(l.indexOf("bold")>-1?"":" ("+i+"+B)"),"STRONG","",t.bold],underline:["_se_command_underline",n.toolbar.underline+(l.indexOf("underline")>-1?"":" ("+i+"+U)"),"U","",t.underline],italic:["_se_command_italic",n.toolbar.italic+(l.indexOf("italic")>-1?"":" ("+i+"+I)"),"EM","",t.italic],strike:["_se_command_strike",n.toolbar.strike+(l.indexOf("strike")>-1?"":" ("+i+"+SHIFT+S)"),"DEL","",t.strike],subscript:["_se_command_subscript",n.toolbar.subscript,"SUB","",t.subscript],superscript:["_se_command_superscript",n.toolbar.superscript,"SUP","",t.superscript],removeFormat:["",n.toolbar.removeFormat,"removeFormat","",t.erase],indent:["_se_command_indent",n.toolbar.indent+(l.indexOf("indent")>-1?"":" ("+i+"+])"),"indent","",t.outdent],outdent:["_se_command_outdent",n.toolbar.outdent+(l.indexOf("indent")>-1?"":" ("+i+"+[)"),"outdent","",t.indent],fullScreen:["se-code-view-enabled se-resizing-enabled _se_command_fullScreen",n.toolbar.fullScreen,"fullScreen","",t.expansion],showBlocks:["_se_command_showBlocks",n.toolbar.showBlocks,"showBlocks","",t.show_blocks],codeView:["se-code-view-enabled se-resizing-enabled _se_command_codeView",n.toolbar.codeView,"codeView","",t.code_view],undo:["_se_command_undo se-resizing-enabled",n.toolbar.undo+(l.indexOf("undo")>-1?"":" ("+i+"+Z)"),"undo","",t.undo],redo:["_se_command_redo se-resizing-enabled",n.toolbar.redo+(l.indexOf("undo")>-1?"":" ("+i+"+Y / "+i+"+SHIFT+Z)"),"redo","",t.redo],preview:["se-resizing-enabled",n.toolbar.preview,"preview","",t.preview],print:["se-resizing-enabled",n.toolbar.print,"print","",t.print],save:["_se_command_save se-resizing-enabled",n.toolbar.save,"save","",t.save],blockquote:["",n.toolbar.tag_blockquote,"blockquote","command",t.blockquote],font:["se-btn-select se-btn-tool-font",n.toolbar.font,"font","submenu",''+n.toolbar.font+""+t.arrow_down],formatBlock:["se-btn-select se-btn-tool-format",n.toolbar.formats,"formatBlock","submenu",''+n.toolbar.formats+""+t.arrow_down],fontSize:["se-btn-select se-btn-tool-size",n.toolbar.fontSize,"fontSize","submenu",''+n.toolbar.fontSize+""+t.arrow_down],fontColor:["",n.toolbar.fontColor,"fontColor","submenu",t.font_color],hiliteColor:["",n.toolbar.hiliteColor,"hiliteColor","submenu",t.highlight_color],align:["se-btn-align",n.toolbar.align,"align","submenu",t.align_left],list:["",n.toolbar.list,"list","submenu",t.list_number],horizontalRule:["btn_line",n.toolbar.horizontalRule,"horizontalRule","submenu",t.horizontal_rule],table:["",n.toolbar.table,"table","submenu",t.table],lineHeight:["",n.toolbar.lineHeight,"lineHeight","submenu",t.line_height],template:["",n.toolbar.template,"template","submenu",t.template],paragraphStyle:["",n.toolbar.paragraphStyle,"paragraphStyle","submenu",t.paragraph_style],textStyle:["",n.toolbar.textStyle,"textStyle","submenu",t.text_style],link:["",n.toolbar.link,"link","dialog",t.link],image:["",n.toolbar.image,"image","dialog",t.image],video:["",n.toolbar.video,"video","dialog",t.video],audio:["",n.toolbar.audio,"audio","dialog",t.audio],math:["",n.toolbar.math,"math","dialog",t.math],imageGallery:["",n.toolbar.imageGallery,"imageGallery","fileBrowser",t.image_gallery]}},_createModuleGroup:function(){const e=L.createElement("DIV");e.className="se-btn-module se-btn-module-border";const t=L.createElement("UL");return t.className="se-menu-list",e.appendChild(t),{div:e,ul:t}},_createButton:function(e,t,n,i,l,o,s){const a=L.createElement("LI"),r=L.createElement("BUTTON");return r.setAttribute("type","button"),r.setAttribute("class","se-btn"+(e?" "+e:"")+" se-tooltip"),r.setAttribute("data-command",n),r.setAttribute("data-display",i),r.setAttribute("tabindex","-1"),l||(l='!'),/^default\./i.test(l)&&(l=s[l.replace(/^default\./i,"")]),/^text\./i.test(l)&&(l=l.replace(/^text\./i,""),r.className+=" se-btn-more-text"),l+=''+(t||n)+"",o&&r.setAttribute("disabled",!0),r.innerHTML=l,a.appendChild(r),{li:a,button:r}},_createToolBar:function(e,t,n,i){const l=e.createElement("DIV");l.className="se-toolbar-separator-vertical";const o=e.createElement("DIV");o.className="se-toolbar sun-editor-common";const s=e.createElement("DIV");s.className="se-btn-tray",o.appendChild(s);const a=i.icons,r=this._defaultButtons(i),c={},d=[],u={};if(n){const e=n.length?n:Object.keys(n).map((function(e){return n[e]}));for(let t,n=0,i=e.length;n",b.appendChild(i),i=i.firstElementChild.firstElementChild)}if(_){const e=l.cloneNode(!1);y&&(e.style.float=y),s.appendChild(e)}s.appendChild(p.div),_=!0}else if(/^\/$/.test(v)){const t=e.createElement("DIV");t.className="se-btn-module-enter",s.appendChild(t),_=!1}1===s.children.length&&L.removeClass(s.firstElementChild,"se-btn-module-border"),d.length>0&&d.unshift(t),b.children.length>0&&s.appendChild(b);const v=e.createElement("DIV");v.className="se-menu-tray",o.appendChild(v);const y=e.createElement("DIV");return y.className="se-toolbar-cover",o.appendChild(y),{element:o,plugins:u,pluginCallButtons:c,responsiveButtons:d,_menuTray:v,_buttonTray:s}}};var A=function(e,t,n){return{element:{originElement:e,topArea:t._top,relative:t._relative,toolbar:t._toolBar,_buttonTray:t._toolBar.querySelector(".se-btn-tray"),_menuTray:t._menuTray,resizingBar:t._resizingBar,navigation:t._navigation,charWrapper:t._charWrapper,charCounter:t._charCounter,editorArea:t._editorArea,wysiwygFrame:t._wysiwygArea,wysiwyg:t._wysiwygArea,code:t._codeArea,placeholder:t._placeholder,loading:t._loading,lineBreaker:t._lineBreaker,lineBreaker_t:t._lineBreaker_t,lineBreaker_b:t._lineBreaker_b,resizeBackground:t._resizeBack,_stickyDummy:t._stickyDummy,_arrow:t._arrow},tool:{cover:t._toolBar.querySelector(".se-toolbar-cover"),bold:t._toolBar.querySelector("._se_command_bold"),underline:t._toolBar.querySelector("._se_command_underline"),italic:t._toolBar.querySelector("._se_command_italic"),strike:t._toolBar.querySelector("._se_command_strike"),subscript:t._toolBar.querySelector("._se_command_subscript"),superscript:t._toolBar.querySelector("._se_command_superscript"),undo:t._toolBar.querySelector("._se_command_undo"),redo:t._toolBar.querySelector("._se_command_redo"),save:t._toolBar.querySelector("._se_command_save"),outdent:t._toolBar.querySelector("._se_command_outdent"),indent:t._toolBar.querySelector("._se_command_indent"),fullScreen:t._toolBar.querySelector("._se_command_fullScreen"),showBlocks:t._toolBar.querySelector("._se_command_showBlocks"),codeView:t._toolBar.querySelector("._se_command_codeView")},options:n,option:n}},B={name:"notice",add:function(e){const t=e.context;t.notice={};let n=e.util.createElement("DIV"),i=e.util.createElement("SPAN"),l=e.util.createElement("BUTTON");n.className="se-notice",l.className="close",l.setAttribute("aria-label","Close"),l.setAttribute("title",e.lang.dialogBox.close),l.innerHTML=e.icons.cancel,n.appendChild(i),n.appendChild(l),t.notice.modal=n,t.notice.message=i,l.addEventListener("click",this.onClick_cancel.bind(e)),t.element.editorArea.appendChild(n),n=null},onClick_cancel:function(e){e.preventDefault(),e.stopPropagation(),this.plugins.notice.close.call(this)},open:function(e){this.context.notice.message.textContent=e,this.context.notice.modal.style.display="block"},close:function(){this.context.notice.modal.style.display="none"}},z={init:function(e){return{create:function(t,n){return this.create(t,n,e)}.bind(this)}},create:function(e,t,n){L._propertiesInit(),"object"!=typeof t&&(t={}),n&&(t=[n,t].reduce((function(e,t){for(let n in t)if(L.hasOwn(t,n))if("plugins"===n&&t[n]&&e[n]){let i=e[n],l=t[n];i=i.length?i:Object.keys(i).map((function(e){return i[e]})),l=l.length?l:Object.keys(l).map((function(e){return l[e]})),e[n]=l.filter((function(e){return-1===i.indexOf(e)})).concat(i)}else e[n]=t[n];return e}),{}));const i="string"==typeof e?document.getElementById(e):e;if(!i){if("string"==typeof e)throw Error('[SUNEDITOR.create.fail] The element for that id was not found (ID:"'+e+'")');throw Error("[SUNEDITOR.create.fail] suneditor requires textarea's element or id value")}const l=k.init(i,t);if(l.constructed._top.id&&document.getElementById(l.constructed._top.id))throw Error('[SUNEDITOR.create.fail] The ID of the suneditor you are trying to create already exists (ID:"'+l.constructed._top.id+'")');return function(e,t,n,i,l,o){const s=e.element.originElement.ownerDocument||document,a=s.defaultView||window,r=L,c=l.icons,d={_d:s,_w:a,_parser:new a.DOMParser,_wd:null,_ww:null,_shadowRoot:null,util:r,functions:null,notice:B,icons:c,history:null,context:e,pluginCallButtons:t,plugins:n||{},initPlugins:{},_targetPlugins:{},_menuTray:{},lang:i,effectNode:null,submenu:null,container:null,_submenuName:"",_bindedSubmenuOff:null,_bindedContainerOff:null,submenuActiveButton:null,containerActiveButton:null,controllerArray:[],currentControllerName:"",currentControllerTarget:null,currentFileComponentInfo:null,codeViewDisabledButtons:null,resizingDisabledButtons:null,_moreLayerActiveButton:null,_htmlCheckWhitelistRegExp:null,_disallowedTextTagsRegExp:null,editorTagsWhitelistRegExp:null,pasteTagsWhitelistRegExp:null,hasFocus:!1,isDisabled:!1,_attributesWhitelistRegExp:null,_attributesTagsWhitelist:null,_bindControllersOff:null,_isInline:null,_isBalloon:null,_isBalloonAlways:null,_inlineToolbarAttr:{top:"",width:"",isShow:!1},_notHideToolbar:!1,_sticky:!1,_antiBlur:!1,_lineBreaker:null,_lineBreakerButton:null,_componentsInfoInit:!0,_componentsInfoReset:!1,activePlugins:null,managedTagsInfo:null,_charTypeHTML:!1,_fileInfoPluginsCheck:null,_fileInfoPluginsReset:null,_fileManager:{tags:null,regExp:null,queryString:null,pluginRegExp:null,pluginMap:null},commandMap:null,_styleCommandMap:null,_defaultCommand:{bold:"STRONG",underline:"U",italic:"EM",strike:"DEL",subscript:"SUB",superscript:"SUP"},_variable:{isCodeView:!1,isFullScreen:!1,innerHeight_fullScreen:0,resizeClientY:0,tabSize:4,codeIndent:4,minResizingSize:r.getNumber(e.element.wysiwygFrame.style.minHeight||"65",0),currentNodes:[],currentNodesMap:[],_range:null,_selectionNode:null,_originCssText:e.element.topArea.style.cssText,_bodyOverflow:"",_editorAreaOriginCssText:"",_wysiwygOriginCssText:"",_codeOriginCssText:"",_fullScreenAttrs:{sticky:!1,balloon:!1,inline:!1},_lineBreakComp:null,_lineBreakDir:""},callPlugin:function(e,n,i){if(i=i||t[e],!this.plugins[e])throw Error('[SUNEDITOR.core.callPlugin.fail] The called plugin does not exist or is in an invalid format. (pluginName:"'+e+'")');this.initPlugins[e]?"object"==typeof this._targetPlugins[e]&&i&&this.initMenuTarget(e,i,this._targetPlugins[e]):(this.plugins[e].add(this,i),this.initPlugins[e]=!0),this.plugins[e].active&&!this.commandMap[e]&&i&&(this.commandMap[e]=i,this.activePlugins.push(e)),"function"==typeof n&&n()},addModule:function(e){for(let t,n=0,i=e.length;nb?(n.style.height=l+"px",e=-1*(l-g+3)):(n.style.height=b+"px",e=g+t.parentElement.offsetHeight),n.style.top=e+"px"}else n.style.top=g+t.parentElement.offsetHeight+"px";n.style.visibility=""},controllersOn:function(){this._bindControllersOff&&this._bindControllersOff(),this.controllerArray=[];for(let e,t=0;t0){for(let e=0;e":n),this.history.push(!0)},nativeFocus:function(){const t=r.getParentElement(this.getSelectionNode(),"figcaption");t?t.focus():e.element.wysiwyg.focus(),this._editorRange()},focus:function(){if("none"!==e.element.wysiwygFrame.style.display){if(l.iframe)this.nativeFocus();else try{const t=this.getRange();if(t.startContainer===t.endContainer&&r.isWysiwygDiv(t.startContainer)){const t=r.createElement("P"),n=r.createElement("BR");t.appendChild(n),e.element.wysiwyg.appendChild(t),this.setRange(n,0,n,0)}else this.setRange(t.startContainer,t.startOffset,t.endContainer,t.endOffset)}catch(e){this.nativeFocus()}u._applyTagEffects(),this._isBalloon&&u._toggleToolbarBalloon()}},focusEdge:function(t){t||(t=e.element.wysiwyg.lastElementChild);const n=this.getFileComponent(t);n?this.selectComponent(n.target,n.pluginName):t?(t=r.getChildElement(t,(function(e){return 0===e.childNodes.length||3===e.nodeType}),!0))?this.setRange(t,t.textContent.length,t,t.textContent.length):this.nativeFocus():this.focus()},setRange:function(e,t,n,i){if(!e||!n)return;t>e.textContent.length&&(t=e.textContent.length),i>n.textContent.length&&(i=n.textContent.length);const o=this._wd.createRange();try{o.setStart(e,t),o.setEnd(n,i)}catch(e){return console.warn("[SUNEDITOR.core.focus.error] "+e),void this.nativeFocus()}const s=this.getSelection();return s.removeAllRanges&&s.removeAllRanges(),s.addRange(o),this._editorRange(),l.iframe&&this.nativeFocus(),o},removeRange:function(){this._variable._range=null,this._variable._selectionNode=null,this.getSelection().removeAllRanges();const e=this.commandMap,t=this.activePlugins;for(let i in e)r.hasOwn(e,i)&&(t.indexOf(i)>-1?n[i].active.call(this,null):e.OUTDENT&&/^OUTDENT$/i.test(i)?e.OUTDENT.setAttribute("disabled",!0):e.INDENT&&/^INDENT$/i.test(i)?e.INDENT.removeAttribute("disabled"):r.removeClass(e[i],"active"))},getRange:function(){const t=this._variable._range||this._createDefaultRange(),n=this.getSelection();if(t.collapsed===n.isCollapsed||!e.element.wysiwyg.contains(n.focusNode))return t;if(n.rangeCount>0)return this._variable._range=n.getRangeAt(0),this._variable._range;{const e=n.anchorNode,t=n.focusNode,i=n.anchorOffset,l=n.focusOffset,o=r.compareElements(e,t),s=o.ancestor&&(0===o.result?i<=l:o.result>1);return this.setRange(s?e:t,s?i:l,s?t:e,s?l:i)}},getRange_addLine:function(t){if(this._selectionVoid(t)){const n=e.element.wysiwyg,i=r.createElement("P");i.innerHTML="
    ",n.insertBefore(i,n.firstElementChild),this.setRange(i.firstElementChild,0,i.firstElementChild,1),t=this._variable._range}return t},getSelection:function(){return this._shadowRoot&&this._shadowRoot.getSelection?this._shadowRoot.getSelection():this._ww.getSelection()},getSelectionNode:function(){if(r.isWysiwygDiv(this._variable._selectionNode)&&this._editorRange(),!this._variable._selectionNode){const t=r.getChildElement(e.element.wysiwyg.firstChild,(function(e){return 0===e.childNodes.length||3===e.nodeType}),!1);if(t)return this._variable._selectionNode=t,t;this._editorRange()}return this._variable._selectionNode},_editorRange:function(){const e=this.getSelection();if(!e)return null;let t=null,n=null;t=e.rangeCount>0?e.getRangeAt(0):this._createDefaultRange(),this._variable._range=t,n=t.collapsed?t.commonAncestorContainer:e.extentNode||e.anchorNode,this._variable._selectionNode=n},_createDefaultRange:function(){const t=e.element.wysiwyg;t.focus();const n=this._wd.createRange();let i=t.firstElementChild;return i||(i=r.createElement("P"),i.innerHTML="
    ",t.appendChild(i)),n.setStart(i,0),n.setEnd(i,0),n},_selectionVoid:function(e){const t=e.commonAncestorContainer;return r.isWysiwygDiv(e.startContainer)&&r.isWysiwygDiv(e.endContainer)||/FIGURE/i.test(t.nodeName)||this._fileManager.regExp.test(t.nodeName)||r.isMediaComponent(t)},_resetRangeToTextNode:function(){const t=this.getRange();if(this._selectionVoid(t))return!1;let n,i,l,o=t.startContainer,s=t.startOffset,a=t.endContainer,c=t.endOffset;if(r.isFormatElement(o)&&(o=o.childNodes[s]||o.lastChild,s=o.textContent.length),r.isFormatElement(a)&&(a=a.childNodes[c]||a.lastChild,c=a.textContent.length),n=r.isWysiwygDiv(o)?e.element.wysiwyg.firstChild:o,i=s,r.isBreak(n)||1===n.nodeType&&n.childNodes.length>0){const e=r.isBreak(n);if(!e){for(;n&&!r.isBreak(n)&&1===n.nodeType;)n=n.childNodes[i]||n.nextElementSibling||n.nextSibling,i=0;let e=r.getFormatElement(n,null);e===r.getRangeFormatElement(e,null)&&(e=r.createElement(r.getParentElement(n,r.isCell)?"DIV":"P"),n.parentNode.insertBefore(e,n),e.appendChild(n))}if(r.isBreak(n)){const t=r.createTextNode(r.zeroWidthSpace);n.parentNode.insertBefore(t,n),n=t,e&&o===a&&(a=n,c=1)}}if(o=n,s=i,n=r.isWysiwygDiv(a)?e.element.wysiwyg.lastChild:a,i=c,r.isBreak(n)||1===n.nodeType&&n.childNodes.length>0){const e=r.isBreak(n);if(!e){for(;n&&!r.isBreak(n)&&1===n.nodeType&&(l=n.childNodes,0!==l.length);)n=l[i>0?i-1:i]||!/FIGURE/i.test(l[0].nodeName)?l[0]:n.previousElementSibling||n.previousSibling||o,i=i>0?n.textContent.length:i;let e=r.getFormatElement(n,null);e===r.getRangeFormatElement(e,null)&&(e=r.createElement(r.isCell(e)?"DIV":"P"),n.parentNode.insertBefore(e,n),e.appendChild(n))}if(r.isBreak(n)){const t=r.createTextNode(r.zeroWidthSpace);n.parentNode.insertBefore(t,n),n=t,i=1,e&&!n.previousSibling&&r.removeItem(a)}}return a=n,c=i,this.setRange(o,s,a,c),!0},getSelectedElements:function(t){if(!this._resetRangeToTextNode())return[];let n=this.getRange();if(r.isWysiwygDiv(n.startContainer)){const t=e.element.wysiwyg.children;if(0===t.length)return[];this.setRange(t[0],0,t[t.length-1],t[t.length-1].textContent.trim().length),n=this.getRange()}const i=n.startContainer,l=n.endContainer,o=n.commonAncestorContainer,s=r.getListChildren(o,(function(e){return t?t(e):r.isFormatElement(e)}));if(r.isWysiwygDiv(o)||r.isRangeFormatElement(o)||s.unshift(r.getFormatElement(o,null)),i===l||1===s.length)return s;let a=r.getFormatElement(i,null),c=r.getFormatElement(l,null),d=null,u=null;const h=function(e){return!r.isTable(e)||/^TABLE$/i.test(e.nodeName)};let g=r.getRangeFormatElement(a,h),p=r.getRangeFormatElement(c,h);r.isTable(g)&&r.isListCell(g.parentNode)&&(g=g.parentNode),r.isTable(p)&&r.isListCell(p.parentNode)&&(p=p.parentNode);const m=g===p;for(let e,t=0,n=s.length;t=0;n--)if(i[n].contains(i[e])){i.splice(e,1),e--,t--;break}return i},isEdgePoint:function(e,t){return 0===t||!e.nodeValue&&1===t||t===e.nodeValue.length},showLoading:function(){e.element.loading.style.display="block"},closeLoading:function(){e.element.loading.style.display="none"},appendFormatTag:function(e,t){const n=r.getFormatElement(this.getSelectionNode(),null),i=t?"string"==typeof t?t:t.nodeName:r.isFormatElement(n)&&!r.isFreeFormatElement(n)?n.nodeName:"P",l=r.createElement(i);return l.innerHTML="
    ",(t&&"string"!=typeof t||!t&&r.isFormatElement(n))&&r.copyTagAttributes(l,t||n),r.isCell(e)?e.insertBefore(l,e.nextElementSibling):e.parentNode.insertBefore(l,e.nextElementSibling),l},insertComponent:function(e,t,n,i){if(n&&!this.checkCharCount(e,null))return null;const l=this.removeNode();this.getRange_addLine(this.getRange());let o=null,s=this.getSelectionNode(),a=r.getFormatElement(s,null);if(r.isListCell(a))this.insertNode(e,s===a?null:l.container.nextSibling,!1),e.nextSibling||e.parentNode.appendChild(r.createElement("BR"));else{if(this.getRange().collapsed&&(3===l.container.nodeType||r.isBreak(l.container))){const e=r.getParentElement(l.container,function(e){return this.isRangeFormatElement(e)}.bind(r));o=r.splitElement(l.container,l.offset,e?r.getElementDepth(e)+1:0),o&&(a=o.previousSibling)}this.insertNode(e,a,!1),a&&r.onlyZeroWidthSpace(a)&&r.removeItem(a)}if(!i){const t=this.getFileComponent(e);t?this.selectComponent(t.target,t.pluginName):o&&(o=r.getEdgeChildNodes(o,null).sc||o,this.setRange(o,0,o,0))}return t||this.history.push(1),o||e},getFileComponent:function(e){if(!this._fileManager.queryString||!e)return null;let t,n;return(/^FIGURE$/i.test(e.nodeName)||/se-component/.test(e.className))&&(t=e.querySelector(this._fileManager.queryString)),!t&&e.nodeName&&this._fileManager.regExp.test(e.nodeName)&&(t=e),t&&(n=this._fileManager.pluginMap[t.nodeName.toLowerCase()],n)?{target:t,component:r.getParentElement(t,r.isComponent),pluginName:n}:null},selectComponent:function(e,t){this.hasFocus||this.focus();const n=this.plugins[t];n&&a.setTimeout(function(){"function"==typeof n.select&&this.callPlugin(t,n.select.bind(this,e),null),this._setComponentLineBreaker(e)}.bind(this))},_setComponentLineBreaker:function(t){this._lineBreaker.style.display="none";const n=r.getParentElement(t,r.isComponent),i=e.element.lineBreaker_t.style,l=e.element.lineBreaker_b.style,o="block"===this.context.resizing.resizeContainer.style.display?this.context.resizing.resizeContainer:t,s=r.isListCell(n.parentNode);let a,c,d;(s?n.previousSibling:r.isFormatElement(n.previousElementSibling))?i.display="none":(this._variable._lineBreakComp=n,c=e.element.wysiwyg.scrollTop,a=r.getOffset(t,e.element.wysiwygFrame).top+c,d=o.offsetWidth/2/2,i.top=a-c-12+"px",i.left=r.getOffset(o).left+d+"px",i.display="block"),(s?n.nextSibling:r.isFormatElement(n.nextElementSibling))?l.display="none":(a||(this._variable._lineBreakComp=n,c=e.element.wysiwyg.scrollTop,a=r.getOffset(t,e.element.wysiwygFrame).top+c,d=o.offsetWidth/2/2),l.top=a+o.offsetHeight-c-12+"px",l.left=r.getOffset(o).left+o.offsetWidth-d-24+"px",l.display="block")},insertNode:function(e,t,n){if(n&&!this.checkCharCount(e,null))return null;const i=r.getFreeFormatElement(this.getSelectionNode(),null),l=!i&&(r.isFormatElement(e)||r.isRangeFormatElement(e))||r.isComponent(e);if(!t&&l){const e=this.removeNode();if(3===e.container.nodeType||r.isBreak(e.container)){const n=r.getParentElement(e.container,function(e){return this.isRangeFormatElement(e)||this.isListCell(e)}.bind(r));(t=r.splitElement(e.container,e.offset,n?r.getElementDepth(n)+1:0))&&(t=t.previousSibling)}}const o=t||l?this.getRange():this.getRange_addLine(this.getRange()),s=o.commonAncestorContainer,a=o.startOffset,c=o.endOffset,d=o.startContainer===s&&r.isFormatElement(s),u=d?s.childNodes[a]:o.startContainer,h=d?s.childNodes[c]:o.endContainer;let g,p=null;if(t)g=t.parentNode,t=t.nextSibling,p=!0;else if(g=u,3===u.nodeType&&(g=u.parentNode),o.collapsed)if(3===s.nodeType)t=s.textContent.length>c?s.splitText(c):s.nextSibling;else if(r.isBreak(g))t=g,g=g.parentNode;else{let n=g.childNodes[a];const i=n&&3===n.nodeType&&r.onlyZeroWidthSpace(n)&&r.isBreak(n.nextSibling)?n.nextSibling:n;i?i.nextSibling?t=r.isBreak(i)&&!r.isBreak(e)?i:i.nextSibling:(g.removeChild(i),t=null):t=null}else{if(u===h){t=this.isEdgePoint(h,c)?h.nextSibling:h.splitText(c);let e=u;this.isEdgePoint(u,a)||(e=u.splitText(a)),g.removeChild(e),0===g.childNodes.length&&l&&(g.innerHTML="
    ")}else{const e=this.removeNode(),n=e.container,i=e.prevContainer;if(n&&0===n.childNodes.length&&l&&(r.isFormatElement(n)?n.innerHTML="
    ":r.isRangeFormatElement(n)&&(n.innerHTML="


    ")),!l&&i)if(g=3===i.nodeType?i.parentNode:i,g.contains(n))for(t=n;t.parentNode===g;)t=t.parentNode;else t=null;else g=l?s:n,t=l?h:null;for(;t&&!r.isFormatElement(t)&&t.parentNode!==s;)t=t.parentNode}}try{if(r.isFormatElement(e)||r.isRangeFormatElement(e)||!r.isListCell(g)&&r.isComponent(e)){const e=g;if(r.isList(t))g=t,t=null;else if(r.isListCell(t))g=t.previousElementSibling||t;else if(!p&&!t){const e=this.removeNode(),n=3===e.container.nodeType?r.isListCell(r.getFormatElement(e.container,null))?e.container:r.getFormatElement(e.container,null)||e.container.parentNode:e.container,i=r.isWysiwygDiv(n)||r.isRangeFormatElement(n);g=i?n:n.parentNode,t=i?null:n.nextSibling}0===e.childNodes.length&&g!==e&&r.removeItem(e)}!l||i||r.isRangeFormatElement(g)||r.isListCell(g)||r.isWysiwygDiv(g)||(t=g.nextElementSibling,g=g.parentNode),g.insertBefore(e,g===t?g.lastChild:t)}catch(t){g.appendChild(e)}finally{if(i&&(r.isFormatElement(e)||r.isRangeFormatElement(e))&&(e=this._setIntoFreeFormat(e)),!r.isComponent(e)){let t=1;if(3===e.nodeType){const t=e.previousSibling,n=e.nextSibling,i=!t||1===t.nodeType||r.onlyZeroWidthSpace(t)?"":t.textContent,l=!n||1===n.nodeType||r.onlyZeroWidthSpace(n)?"":n.textContent;t&&i.length>0&&(e.textContent=i+e.textContent,r.removeItem(t)),n&&n.length>0&&(e.textContent+=l,r.removeItem(n));const o={container:e,startOffset:i.length,endOffset:e.textContent.length-l.length};return this.setRange(e,o.startOffset,e,o.endOffset),o}if(!r.isBreak(e)&&r.isFormatElement(g)){let n=null;e.previousSibling||(n=r.createTextNode(r.zeroWidthSpace),e.parentNode.insertBefore(n,e)),e.nextSibling||(n=r.createTextNode(r.zeroWidthSpace),e.parentNode.appendChild(n)),r._isIgnoreNodeChange(e)&&(e=e.nextSibling,t=0)}this.setRange(e,t,e,t)}return this.history.push(!0),e}},_setIntoFreeFormat:function(e){const t=e.parentNode;let n,i;for(;r.isFormatElement(e)||r.isRangeFormatElement(e);){for(n=e.childNodes,i=null;n[0];)if(i=n[0],r.isFormatElement(i)||r.isRangeFormatElement(i)){if(this._setIntoFreeFormat(i),!e.parentNode)break;n=e.childNodes}else t.insertBefore(i,e);0===e.childNodes.length&&r.removeItem(e),e=r.createElement("BR"),t.insertBefore(e,i.nextSibling)}return e},removeNode:function(){this._resetRangeToTextNode()||console.warn('[SUNEDITOR.core.removeNode.exception] An exception occurred while resetting the "Range" object.');const t=this.getRange();let n,i=0,l=t.startContainer,o=t.endContainer;const s=t.startOffset,a=t.endOffset,c=t.commonAncestorContainer;let d=null,u=null;const h=r.getListChildNodes(c,null);let g=r.getArrayIndex(h,l),p=r.getArrayIndex(h,o);if(h.length>0&&g>-1&&p>-1){for(let e=g+1,t=l;e>=0;e--)h[e]===t.parentNode&&h[e].firstChild===t&&0===s&&(g=e,t=t.parentNode);for(let e=p-1,t=o;e>g;e--)h[e]===t.parentNode&&1===h[e].nodeType&&(h.splice(e,1),t=t.parentNode,--p)}else{if(0===h.length){if(r.isFormatElement(c)||r.isRangeFormatElement(c)||r.isWysiwygDiv(c)||r.isBreak(c)||r.isMedia(c))return{container:c,offset:0};h.push(c),l=o=c}else if(l=o=h[0],r.isBreak(l)||r.onlyZeroWidthSpace(l))return{container:l,offset:0};g=p=0}function m(e){const t=r.getFormatElement(e,null);if(r.removeItem(e),r.isListCell(t)){const e=r.getArrayItem(t.children,r.isList,!1);if(e){const n=e.firstElementChild,i=n.childNodes;for(;i[0];)t.insertBefore(i[0],e);r.removeItemAllParents(n,null,null)}}}for(let e=g;e<=p;e++){const t=h[e];if(0===t.length||3===t.nodeType&&void 0===t.data)m(t);else if(t!==l)t!==o?m(t):(u=1===o.nodeType?r.createTextNode(o.textContent):r.createTextNode(o.substringData(a,o.length-a)),u.length>0?o.data=u.data:m(o));else if(1===l.nodeType?d=r.createTextNode(l.textContent):t===o?(d=r.createTextNode(l.substringData(0,s)+o.substringData(a,o.length-a)),i=s):d=r.createTextNode(l.substringData(0,s)),d.length>0?l.data=d.data:m(l),t===o)break}if(n=o&&o.parentNode?o:l&&l.parentNode?l:t.endContainer||t.startContainer,!r.isWysiwygDiv(n)){const t=r.removeItemAllParents(n,function(e){if(this.isComponent(e))return!1;const t=e.textContent;return 0===t.length||/^(\n|\u200B)+$/.test(t)}.bind(r),null);t&&(n=t.sc||t.ec||e.element.wysiwyg)}return this.setRange(n,i,n,i),this.history.push(!0),{container:n,offset:i,prevContainer:l&&l.parentNode?l:null}},applyRangeFormatElement:function(e){this.getRange_addLine(this.getRange());const t=this.getSelectedElementsAndComponents(!1);if(!t||0===t.length)return;e:for(let e,n,i,l,o,s,a=0,c=t.length;a-1&&(l=n.lastElementChild,t.indexOf(l)>-1)){let e=null;for(;e=l.lastElementChild;)if(r.isList(e)){if(!(t.indexOf(e.lastElementChild)>-1))continue e;l=e.lastElementChild}i=n.firstElementChild,o=t.indexOf(i),s=t.indexOf(l),t.splice(o,s-o+1),c=t.length}else;let n,i,l,o=t[t.length-1];n=r.isRangeFormatElement(o)||r.isFormatElement(o)?o:r.getRangeFormatElement(o,null)||r.getFormatElement(o,null),r.isCell(n)?(i=null,l=n):(i=n.nextSibling,l=n.parentNode);let s=r.getElementDepth(n),a=null;const c=[],d=function(e,t,n){let i=null;if(e!==t&&!r.isTable(t)){if(t&&r.getElementDepth(e)===r.getElementDepth(t))return n;i=r.removeItemAllParents(t,null,e)}return i?i.ec:n};for(let n,o,u,h,g,p,m,f=0,_=t.length;f<_;f++)if(n=t[f],o=n.parentNode,o&&!e.contains(o))if(u=r.getElementDepth(n),r.isList(o)){if(null===a&&(p?(a=p,m=!0,p=null):a=o.cloneNode(!1)),c.push(n),g=t[f+1],f===_-1||g&&g.parentNode!==o){g&&n.contains(g.parentNode)&&(p=g.parentNode.cloneNode(!1));let t,f=o.parentNode;for(;r.isList(f);)t=r.createElement(f.nodeName),t.appendChild(a),a=t,f=f.parentNode;const _=this.detachRangeFormatElement(o,c,null,!0,!0);s>=u?(s=u,l=_.cc,i=d(l,o,_.ec),i&&(l=i.parentNode)):l===_.cc&&(i=_.ec),l!==_.cc&&(h=d(l,_.cc,h),i=void 0!==h?h:_.cc);for(let e=0,t=_.removeArray.length;e=u&&(s=u,l=o,i=n.nextSibling),e.appendChild(n),l!==o&&(h=d(l,o),void 0!==h&&(i=h));if(this.effectNode=null,r.mergeSameTags(e,null,!1),r.mergeNestedTags(e,function(e){return this.isList(e)}.bind(r)),i&&r.getElementDepth(i)>0&&(r.isList(i.parentNode)||r.isList(i.parentNode.parentNode))){const t=r.getParentElement(i,function(e){return this.isRangeFormatElement(e)&&!this.isList(e)}.bind(r)),n=r.splitElement(i,null,t?r.getElementDepth(t)+1:0);n.parentNode.insertBefore(e,n)}else l.insertBefore(e,i),d(e,i);const u=r.getEdgeChildNodes(e.firstElementChild,e.lastElementChild);t.length>1?this.setRange(u.sc,0,u.ec,u.ec.textContent.length):this.setRange(u.ec,u.ec.textContent.length,u.ec,u.ec.textContent.length),this.history.push(!1)},detachRangeFormatElement:function(e,t,n,i,l){const o=this.getRange(),s=o.startOffset,a=o.endOffset;let c=r.getListChildNodes(e,(function(t){return t.parentNode===e})),d=e.parentNode,u=null,h=null,g=e.cloneNode(!1);const p=[],m=r.isList(n);let f=!1,_=!1,b=!1;function v(t,n,i,l){if(r.onlyZeroWidthSpace(n)&&(n.innerHTML=r.zeroWidthSpace),3===n.nodeType)return t.insertBefore(n,i),n;const o=(b?n:l).childNodes;let s=n.cloneNode(!1),a=null,c=null;for(;o[0];)c=o[0],!r._notTextNode(c)||r.isBreak(c)||r.isListCell(s)?s.appendChild(c):(s.childNodes.length>0&&(a||(a=s),t.insertBefore(s,i),s=n.cloneNode(!1)),t.insertBefore(c,i),a||(a=c));if(s.childNodes.length>0){if(r.isListCell(t)&&r.isListCell(s)&&r.isList(i))if(m){for(a=i;i;)s.appendChild(i),i=i.nextSibling;t.parentNode.insertBefore(s,t.nextElementSibling)}else{const t=l.nextElementSibling,n=r.detachNestedList(l,!1);if(e!==n||t!==l.nextElementSibling){const t=s.childNodes;for(;t[0];)l.appendChild(t[0]);e=n,_=!0}}else t.insertBefore(s,i);a||(a=s)}return a}for(let l,o,s,a=0,y=c.length;a0&&(d.insertBefore(g,e),g=null),!m&&r.isListCell(l))if(s&&r.getElementDepth(l)!==r.getElementDepth(s)&&(r.isListCell(d)||r.getArrayItem(l.children,r.isList,!1))){const t=l.nextElementSibling,n=r.detachNestedList(l,!1);e===n&&t===l.nextElementSibling||(e=n,_=!0)}else{const t=l;l=r.createElement(i?t.nodeName:r.isList(e.parentNode)||r.isListCell(e.parentNode)?"LI":r.isCell(e.parentNode)?"DIV":"P");const n=r.isListCell(l),o=t.childNodes;for(;o[0]&&(!r.isList(o[0])||n);)l.appendChild(o[0]);r.copyFormatAttributes(l,t),b=!0}else l=l.cloneNode(!1);if(!_&&(i?(p.push(l),r.removeItem(c[a])):(n?(f||(d.insertBefore(n,e),f=!0),l=v(n,l,null,c[a])):l=v(d,l,e,c[a]),_||(t?(h=l,u||(u=l)):u||(u=h=l))),_)){_=b=!1,c=r.getListChildNodes(e,(function(t){return t.parentNode===e})),g=e.cloneNode(!1),d=e.parentNode,a=-1,y=c.length;continue}}const y=e.parentNode;let C=e.nextSibling;g&&g.children.length>0&&y.insertBefore(g,C),n?u=n.previousSibling:u||(u=e.previousSibling),C=e.nextSibling,0===e.children.length||0===e.textContent.length?r.removeItem(e):r.removeEmptyNode(e,null);let w=null;if(i)w={cc:y,sc:u,ec:C,removeArray:p};else{u||(u=h),h||(h=u);const e=r.getEdgeChildNodes(u,h.parentNode?u:h);w={cc:(e.sc||e.ec).parentNode,sc:e.sc,ec:e.ec}}if(this.effectNode=null,l)return w;!i&&w&&(t?this.setRange(w.sc,s,w.ec,a):this.setRange(w.sc,0,w.sc,0)),this.history.push(!1)},detachList:function(e,t){let n={},i=!1,l=!1,o=null,s=null;const a=function(e){return!this.isComponent(e)}.bind(r);for(let c,d,u,h,g=0,p=e.length;g0)&&t,n=!!(n&&n.length>0)&&n;const o=!e,s=o&&!n&&!t;let c=l.startContainer,d=l.startOffset,u=l.endContainer,h=l.endOffset;if(s&&l.collapsed&&r.isFormatElement(c.parentNode)&&r.isFormatElement(u.parentNode)||c===u&&1===c.nodeType&&r.isNonEditable(c))return;if(l.collapsed&&!s&&1===c.nodeType&&!r.isBreak(c)&&!r.isComponent(c)){let e=null;const t=c.childNodes[d];t&&(e=t.nextSibling?r.isBreak(t)?t:t.nextSibling:null);const n=r.createTextNode(r.zeroWidthSpace);c.insertBefore(n,e),this.setRange(n,1,n,1),l=this.getRange(),c=l.startContainer,d=l.startOffset,u=l.endContainer,h=l.endOffset}r.isFormatElement(c)&&(c=c.childNodes[d]||c.firstChild,d=0),r.isFormatElement(u)&&(u=u.childNodes[h]||u.lastChild,h=u.textContent.length),o&&(e=r.createElement("DIV"));const g=a.RegExp,p=e.nodeName;if(!s&&c===u&&!n&&e){let t=c,n=0;const i=[],l=e.style;for(let e=0,t=l.length;e0){for(;!r.isFormatElement(t)&&!r.isWysiwygDiv(t);){for(let l=0;l=i.length)return}}let m,f={},_={},b="",v="",y="";if(t){for(let e,n=0,i=t.length;n0&&(a=l.replace(b,"").trim(),a!==l&&(w.v=!0));const c=t.className;let d="";return v&&c.length>0&&(d=c.replace(v,"").trim(),d!==c&&(w.v=!0)),(!o||!v&&c||!b&&l||a||d||!n)&&(a||d||t.nodeName!==p||C(b)!==C(l)||C(v)!==C(c))?(b&&l.length>0&&(t.style.cssText=a),t.style.cssText||t.removeAttribute("style"),v&&c.length>0&&(t.className=d.trim()),t.className.trim()||t.removeAttribute("class"),t.style.cssText||t.className||t.nodeName!==p&&!n?t:(w.v=!0,null)):(w.v=!0,null)},E=this.getSelectedElements(null);l=this.getRange(),c=l.startContainer,d=l.startOffset,u=l.endContainer,h=l.endOffset,r.getFormatElement(c,null)||(c=r.getChildElement(E[0],(function(e){return 3===e.nodeType}),!1),d=0),r.getFormatElement(u,null)||(u=r.getChildElement(E[E.length-1],(function(e){return 3===e.nodeType}),!1),h=u.textContent.length);const S=r.getFormatElement(c,null)===r.getFormatElement(u,null),N=E.length-(S?0:1);m=e.cloneNode(!1);const T=s||o&&function(e){for(let t=0,n=e.length;t0&&(m=e.cloneNode(!1),_=this._nodeChange_endLine(E[N],m,x,u,h,s,o,w,k,A));for(let t,n=N-1;n>0;n--)m=e.cloneNode(!1),t=this._nodeChange_middleLine(E[n],m,x,s,o,w,_.container),t.endContainer&&(_.ancestor=null,_.container=t.endContainer),this._setCommonListStyle(t.ancestor,null);m=e.cloneNode(!1),f=this._nodeChange_startLine(E[0],m,x,c,d,s,o,w,k,A,_.container),f.endContainer&&(_.ancestor=null,_.container=f.endContainer),N<=0?_=f:_.container||(_.ancestor=null,_.container=f.container,_.offset=f.container.textContent.length),this._setCommonListStyle(f.ancestor,null),this._setCommonListStyle(_.ancestor||r.getFormatElement(_.container),null)}this.controllersOff(),this.setRange(f.container,f.offset,_.container,_.offset),this.history.push(!1)},_setCommonListStyle:function(e,t){if(!r.isListCell(e))return;t||e.removeAttribute("style");const n=r.getArrayItem((t||e).childNodes,(function(e){return!r.isBreak(e)&&!r.onlyZeroWidthSpace(e.textContent.trim())}),!0);if(n[0]&&1===n.length){if(!(t=n[0])||1!==t.nodeType)return;const i=t.style,l=e.style;/STRONG/i.test(t.nodeName)?l.fontWeight="bold":i.fontWeight&&(l.fontWeight=i.fontWeight),i.color&&(l.color=i.color),i.fontSize&&(l.fontSize=i.fontSize),this._setCommonListStyle(e,t)}},_stripRemoveNode:function(e){const t=e.parentNode;if(!e||3===e.nodeType||!t)return;const n=e.childNodes;for(;n[0];)t.insertBefore(n[0],e);t.removeChild(e)},_util_getMaintainedNode:function(e,t,n){return!n||e?null:this.getParentElement(n,this._isMaintainedNode.bind(this))||(t?null:this.getParentElement(n,this._isSizeNode.bind(this)))},_util_isMaintainedNode:function(e,t,n){if(!n||e||1!==n.nodeType)return!1;const i=this._isMaintainedNode(n);return this.getParentElement(n,this._isMaintainedNode.bind(this))?i:i||!t&&this._isSizeNode(n)},_nodeChange_oneLine:function(e,t,n,i,l,o,s,c,d,u,h,g,p){let m=i.parentNode;for(;!(m.nextSibling||m.previousSibling||r.isFormatElement(m.parentNode)||r.isWysiwygDiv(m.parentNode))&&m.nodeName!==t.nodeName;)m=m.parentNode;if(!d&&m===o.parentNode&&m.nodeName===t.nodeName&&r.onlyZeroWidthSpace(i.textContent.slice(0,l))&&r.onlyZeroWidthSpace(o.textContent.slice(s))){const e=m.childNodes;let n=!0;for(let t,l,s,a,c=0,d=e.length;c0&&(n=t.test(e.style.cssText)),!n}if(function e(i,l){const o=i.childNodes;for(let i,s=0,a=o.length;s=N?L-N:S.data.length-N));if(E){const t=g(l);if(t&&t.parentNode!==e){let n=t,i=null;for(;n.parentNode!==e;){for(l=i=n.parentNode.cloneNode(!1);n.childNodes[0];)i.appendChild(n.childNodes[0]);n.appendChild(i),n=n.parentNode}n.parentNode.appendChild(t)}E=E.cloneNode(!1)}r.onlyZeroWidthSpace(o)||l.appendChild(o);const c=g(l);for(c&&(E=c),E&&(e=E),C=a,y=[],x="";C!==e&&C!==f&&null!==C;)i=p(C)?null:n(C),i&&1===C.nodeType&&z(C)&&(y.push(i),x+=C.style.cssText.substr(0,C.style.cssText.indexOf(":"))+"|"),C=C.parentNode;const d=y.pop()||s;for(w=C=d;y.length>0;)C=y.pop(),w.appendChild(C),w=C;if(t.appendChild(d),e.appendChild(t),E&&!g(T)&&(t=t.cloneNode(!1),b.appendChild(t),_.push(t)),S=s,N=0,k=!0,C!==s&&C.appendChild(S),!v)continue}if(A||a!==T){if(k){if(1===a.nodeType&&!r.isBreak(a)){r._isIgnoreNodeChange(a)?(b.appendChild(a.cloneNode(!0)),u||(t=t.cloneNode(!1),b.appendChild(t),_.push(t))):e(a,a);continue}C=a,y=[],x="";const o=[];for(;null!==C.parentNode&&C!==f&&C!==t;)i=A?C.cloneNode(!1):n(C),1===C.nodeType&&!r.isBreak(a)&&i&&z(C)&&(p(C)?E||o.push(i):y.push(i),x+=C.style.cssText.substr(0,C.style.cssText.indexOf(":"))+"|"),C=C.parentNode;y=y.concat(o);const s=y.pop()||a;for(w=C=s;y.length>0;)C=y.pop(),w.appendChild(C),w=C;if(p(t.parentNode)&&!p(s)&&(t=t.cloneNode(!1),b.appendChild(t),_.push(t)),A||E||!p(s))s===a?l=A?b:t:A?(b.appendChild(s),l=C):(t.appendChild(s),l=C);else{t=t.cloneNode(!1);const e=s.childNodes;for(let n=0,i=e.length;n0?C:t}if(E&&3===a.nodeType)if(g(a)){const e=r.getParentElement(l,function(e){return this._isMaintainedNode(e.parentNode)||e.parentNode===b}.bind(r));E.appendChild(e),t=e.cloneNode(!1),_.push(t),b.appendChild(t)}else E=null}d=a.cloneNode(!1),l.appendChild(d),1!==a.nodeType||r.isBreak(a)||(h=d),e(a,h)}else{E=g(a);const e=r.createTextNode(1===T.nodeType?"":T.substringData(L,T.length-L)),l=r.createTextNode(v||1===T.nodeType?"":T.substringData(0,L));if(E?E=E.cloneNode(!1):p(t.parentNode)&&!E&&(t=t.cloneNode(!1),b.appendChild(t),_.push(t)),!r.onlyZeroWidthSpace(e)){C=a,x="",y=[];const t=[];for(;C!==b&&C!==f&&null!==C;)1===C.nodeType&&z(C)&&(p(C)?t.push(C.cloneNode(!1)):y.push(C.cloneNode(!1)),x+=C.style.cssText.substr(0,C.style.cssText.indexOf(":"))+"|"),C=C.parentNode;for(y=y.concat(t),d=w=C=y.pop()||e;y.length>0;)C=y.pop(),w.appendChild(C),w=C;b.appendChild(d),C.textContent=e.data}if(E&&d){const e=g(d);e&&(E=e)}for(C=a,y=[],x="";C!==b&&C!==f&&null!==C;)i=p(C)?null:n(C),i&&1===C.nodeType&&z(C)&&(y.push(i),x+=C.style.cssText.substr(0,C.style.cssText.indexOf(":"))+"|"),C=C.parentNode;const o=y.pop()||l;for(w=C=o;y.length>0;)C=y.pop(),w.appendChild(C),w=C;E?((t=t.cloneNode(!1)).appendChild(o),E.insertBefore(t,E.firstChild),b.appendChild(E),_.push(t),E=null):t.appendChild(o),T=l,L=l.data.length,A=!0,!c&&u&&(t=l,l.textContent=r.zeroWidthSpace),C!==l&&C.appendChild(T)}}}(e,b),d&&!c&&!h.v)return{ancestor:e,startContainer:i,startOffset:l,endContainer:o,endOffset:s};if(c=c&&d)for(let e=0;e<_.length;e++){let t,n,i,l=_[e];if(u)t=r.createTextNode(r.zeroWidthSpace),b.replaceChild(t,l);else{const e=l.childNodes;for(n=e[0];e[0];)i=e[0],b.insertBefore(i,l);r.removeItem(l)}0===e&&(u?S=T=t:(S=n,T=i))}else{if(d)for(let e=0;e<_.length;e++)this._stripRemoveNode(_[e]);u&&(S=T=t)}r.removeEmptyNode(b,t),u&&(N=S.textContent.length,L=T.textContent.length);const M=c||0===T.textContent.length;r.isBreak(T)||0!==T.textContent.length||(r.removeItem(T),T=S),L=M?T.textContent.length:L;const H={s:0,e:0},I=r.getNodePath(S,b,H),D=!T.parentNode;D&&(T=S);const O={s:0,e:0},F=r.getNodePath(T,b,D||M?null:O);N+=H.s,L=u?N:D?S.textContent.length:M?L+H.s:L+O.s;const R=r.mergeSameTags(b,[I,F],!0);return e.parentNode.replaceChild(b,e),S=r.getNodeFromPath(I,b),T=r.getNodeFromPath(F,b),{ancestor:b,startContainer:S,startOffset:N+R[0],endContainer:T,endOffset:L+R[1]}},_nodeChange_startLine:function(e,t,n,i,l,o,s,a,c,d,u){let h=i.parentNode;for(;!(h.nextSibling||h.previousSibling||r.isFormatElement(h.parentNode)||r.isWysiwygDiv(h.parentNode))&&h.nodeName!==t.nodeName;)h=h.parentNode;if(!s&&h.nodeName===t.nodeName&&!r.isFormatElement(h)&&!h.nextSibling&&r.onlyZeroWidthSpace(i.textContent.slice(0,l))){let n=!0,o=i.previousSibling;for(;o;){if(!r.onlyZeroWidthSpace(o)){n=!1;break}o=o.previousSibling}if(n)return r.copyTagAttributes(h,t),{ancestor:e,container:i,offset:l}}a.v=!1;const g=e,p=[t],m=e.cloneNode(!1);let f,_,b,v,y=i,C=l,w=!1;if(function e(i,l){const o=i.childNodes;for(let i,s,a=0,h=o.length;a0,y=f.pop()||h;for(b=_=y;f.length>0;)_=f.pop(),b.appendChild(_),b=_;if(d(t.parentNode)&&!d(y)&&(t=t.cloneNode(!1),m.appendChild(t),p.push(t)),!v&&d(y)){t=t.cloneNode(!1);const e=y.childNodes;for(let n=0,i=e.length;n0;)_=f.pop(),b.appendChild(_),b=_;d!==l?(t.appendChild(d),l=_):l=t,r.isBreak(h)&&t.appendChild(h.cloneNode(!1)),e.appendChild(t),y=s,C=0,w=!0,l.appendChild(y)}}}(e,m),s&&!o&&!a.v)return{ancestor:e,container:i,offset:l,endContainer:u};if(o=o&&s)for(let e=0;e0&&u===h)return e.innerHTML=i.innerHTML,{ancestor:e,endContainer:n?r.getNodeFromPath(n,e):null}}o.v=!1;const a=e.cloneNode(!1),c=[t];let d=!0;if(function e(i,l){const o=i.childNodes;for(let i,u,h=0,g=o.length;h0&&(a.appendChild(t),t=t.cloneNode(!1)),u=g.cloneNode(!0),a.appendChild(u),a.appendChild(t),c.push(t),l=t,s&&g.contains(s)){const e=r.getNodePath(s,g);s=r.getNodeFromPath(e,u)}}}(e,t),d||l&&!i&&!o.v)return{ancestor:e,endContainer:s};if(a.appendChild(t),i&&l)for(let e=0;e0,u=m.pop()||a;for(_=f=u;m.length>0;)f=m.pop(),_.appendChild(f),_=f;if(d(t.parentNode)&&!d(u)&&(t=t.cloneNode(!1),p.insertBefore(t,p.firstChild),g.push(t)),!b&&d(u)){t=t.cloneNode(!1);const e=u.childNodes;for(let n=0,i=e.length;n0?f:t}else s?(t.insertBefore(u,t.firstChild),l=f):l=t;if(b&&3===a.nodeType)if(c(a)){const e=r.getParentElement(l,function(e){return this._isMaintainedNode(e.parentNode)||e.parentNode===p}.bind(r));b.appendChild(e),t=e.cloneNode(!1),g.push(t),p.insertBefore(t,p.firstChild)}else b=null}if(C||a!==v)i=C?n(a):a.cloneNode(!1),i&&(l.insertBefore(i,l.firstChild),1!==a.nodeType||r.isBreak(a)||(u=i)),e(a,u);else{b=c(a);const e=r.createTextNode(1===v.nodeType?"":v.substringData(y,v.length-y)),o=r.createTextNode(1===v.nodeType?"":v.substringData(0,y));if(b){b=b.cloneNode(!1);const e=c(l);if(e&&e.parentNode!==p){let t=e,n=null;for(;t.parentNode!==p;){for(l=n=t.parentNode.cloneNode(!1);t.childNodes[0];)n.appendChild(t.childNodes[0]);t.appendChild(n),t=t.parentNode}t.parentNode.insertBefore(e,t.parentNode.firstChild)}b=b.cloneNode(!1)}else d(t.parentNode)&&!b&&(t=t.cloneNode(!1),p.appendChild(t),g.push(t));for(r.onlyZeroWidthSpace(e)||l.insertBefore(e,l.firstChild),f=l,m=[];f!==p&&null!==f;)i=d(f)?null:n(f),i&&1===f.nodeType&&m.push(i),f=f.parentNode;const s=m.pop()||l;for(_=f=s;m.length>0;)f=m.pop(),_.appendChild(f),_=f;s!==l?(t.insertBefore(s,t.firstChild),l=f):l=t,r.isBreak(a)&&t.appendChild(a.cloneNode(!1)),b?(b.insertBefore(t,b.firstChild),p.insertBefore(b,p.firstChild),b=null):p.insertBefore(t,p.firstChild),v=o,y=o.data.length,C=!0,l.insertBefore(v,l.firstChild)}}}(e,p),s&&!o&&!a.v)return{ancestor:e,container:i,offset:l};if(o=o&&s)for(let e=0;e-1?null:r.createElement(n);let d=n;/^SUB$/i.test(n)&&a.indexOf("SUP")>-1?d="SUP":/^SUP$/i.test(n)&&a.indexOf("SUB")>-1&&(d="SUB"),this.nodeChange(c,null,[d],!1),this.focus()}},removeFormat:function(){this.nodeChange(null,null,null,null)},indent:function(e){const t=this.getRange(),n=this.getSelectedElements(null),i=[],l="indent"!==e;let o=t.startContainer,s=t.endContainer,a=t.startOffset,c=t.endOffset;for(let e,t,o=0,s=n.length;o0&&this.plugins.list.editInsideList.call(this,l,i),this.effectNode=null,this.setRange(o,a,s,c),this.history.push(!1)},toggleDisplayBlocks:function(){const t=e.element.wysiwyg;r.toggleClass(t,"se-show-block"),r.hasClass(t,"se-show-block")?r.addClass(this._styleCommandMap.showBlocks,"active"):r.removeClass(this._styleCommandMap.showBlocks,"active"),this._resourcesStateChange()},toggleCodeView:function(){const t=this._variable.isCodeView;this.controllersOff(),r.setDisabledButtons(!t,this.codeViewDisabledButtons),t?(this._setCodeDataToEditor(),e.element.wysiwygFrame.scrollTop=0,e.element.code.style.display="none",e.element.wysiwygFrame.style.display="block",this._variable._codeOriginCssText=this._variable._codeOriginCssText.replace(/(\s?display(\s+)?:(\s+)?)[a-zA-Z]+(?=;)/,"display: none"),this._variable._wysiwygOriginCssText=this._variable._wysiwygOriginCssText.replace(/(\s?display(\s+)?:(\s+)?)[a-zA-Z]+(?=;)/,"display: block"),"auto"!==l.height||l.codeMirrorEditor||(e.element.code.style.height="0px"),this._variable.isCodeView=!1,this._variable.isFullScreen||(this._notHideToolbar=!1,/balloon|balloon-always/i.test(l.mode)&&(e.element._arrow.style.display="",this._isInline=!1,this._isBalloon=!0,u._hideToolbar())),this.nativeFocus(),r.removeClass(this._styleCommandMap.codeView,"active"),this.history.push(!1)):(this._setEditorDataToCodeView(),this._variable._codeOriginCssText=this._variable._codeOriginCssText.replace(/(\s?display(\s+)?:(\s+)?)[a-zA-Z]+(?=;)/,"display: block"),this._variable._wysiwygOriginCssText=this._variable._wysiwygOriginCssText.replace(/(\s?display(\s+)?:(\s+)?)[a-zA-Z]+(?=;)/,"display: none"),"auto"!==l.height||l.codeMirrorEditor||(e.element.code.style.height=e.element.code.scrollHeight>0?e.element.code.scrollHeight+"px":"auto"),l.codeMirrorEditor&&l.codeMirrorEditor.refresh(),this._variable.isCodeView=!0,this._variable.isFullScreen||(this._notHideToolbar=!0,this._isBalloon&&(e.element._arrow.style.display="none",e.element.toolbar.style.left="",this._isInline=!0,this._isBalloon=!1,u._showToolbarInline())),this._variable._range=null,e.element.code.focus(),r.addClass(this._styleCommandMap.codeView,"active")),this._checkPlaceholder(),"function"==typeof h.toggleCodeView&&h.toggleCodeView(this._variable.isCodeView,this)},_setCodeDataToEditor:function(){const t=this._getCodeView();if(l.fullPage){const e=this._parser.parseFromString(t,"text/html"),n=e.head.children;for(let t=0,i=n.length;t0?this.convertContentsForEditor(t):"


    "},_setEditorDataToCodeView:function(){const t=this.convertHTMLForCodeView(e.element.wysiwyg);let n="";if(l.fullPage){const e=r.getAttributesToString(this._wd.body,null);n="\n\n"+this._wd.head.outerHTML.replace(/>(?!\n)/g,">\n")+"\n"+t+"\n"}else n=t;e.element.code.style.display="block",e.element.wysiwygFrame.style.display="none",this._setCodeView(n)},toggleFullScreen:function(t){const n=e.element.topArea,i=e.element.toolbar,o=e.element.editorArea,d=e.element.wysiwygFrame,g=e.element.code,p=this._variable;this.controllersOff(),p.isFullScreen?(p.isFullScreen=!1,d.style.cssText=p._wysiwygOriginCssText,g.style.cssText=p._codeOriginCssText,i.style.cssText="",o.style.cssText=p._editorAreaOriginCssText,n.style.cssText=p._originCssText,s.body.style.overflow=p._bodyOverflow,l.toolbarContainer&&l.toolbarContainer.appendChild(i),l.stickyToolbar>-1&&r.removeClass(i,"se-toolbar-sticky"),p._fullScreenAttrs.sticky&&!l.toolbarContainer&&(p._fullScreenAttrs.sticky=!1,e.element._stickyDummy.style.display="block",r.addClass(i,"se-toolbar-sticky")),this._isInline=p._fullScreenAttrs.inline,this._isBalloon=p._fullScreenAttrs.balloon,this._isInline&&u._showToolbarInline(),l.toolbarContainer&&r.removeClass(i,"se-toolbar-balloon"),u.onScroll_window(),r.changeElement(t.firstElementChild,c.expansion),r.removeClass(this._styleCommandMap.fullScreen,"active")):(p.isFullScreen=!0,p._fullScreenAttrs.inline=this._isInline,p._fullScreenAttrs.balloon=this._isBalloon,(this._isInline||this._isBalloon)&&(this._isInline=!1,this._isBalloon=!1),l.toolbarContainer&&e.element.relative.insertBefore(i,o),n.style.position="fixed",n.style.top="0",n.style.left="0",n.style.width="100%",n.style.maxWidth="100%",n.style.height="100%",n.style.zIndex="2147483647",""!==e.element._stickyDummy.style.display&&(p._fullScreenAttrs.sticky=!0,e.element._stickyDummy.style.display="none",r.removeClass(i,"se-toolbar-sticky")),p._bodyOverflow=s.body.style.overflow,s.body.style.overflow="hidden",p._editorAreaOriginCssText=o.style.cssText,p._wysiwygOriginCssText=d.style.cssText,p._codeOriginCssText=g.style.cssText,o.style.cssText=i.style.cssText="",d.style.cssText=(d.style.cssText.match(/\s?display(\s+)?:(\s+)?[a-zA-Z]+;/)||[""])[0],g.style.cssText=(g.style.cssText.match(/\s?display(\s+)?:(\s+)?[a-zA-Z]+;/)||[""])[0],i.style.width=d.style.height=g.style.height="100%",i.style.position="relative",i.style.display="block",p.innerHeight_fullScreen=a.innerHeight-i.offsetHeight,o.style.height=p.innerHeight_fullScreen+"px",r.changeElement(t.firstElementChild,c.reduction),l.iframe&&"auto"===l.height&&(o.style.overflow="auto",this._iframeAutoHeight()),r.addClass(this._styleCommandMap.fullScreen,"active")),"function"==typeof h.toggleFullScreen&&h.toggleFullScreen(this._variable.isFullScreen,this)},print:function(){const e=r.createElement("IFRAME");e.style.display="none",s.body.appendChild(e);const t=r.getIframeDocument(e),n=this.getContents(!0),i=this._wd;if(l.iframe){const e=l.fullPage?r.getAttributesToString(i.body,["contenteditable"]):'class="sun-editor-editable"';t.write(""+i.head.innerHTML+""+n+"")}else{const e=s.head.getElementsByTagName("link"),i=s.head.getElementsByTagName("style");let l="";for(let t=0,n=e.length;t"+l+''+n+"")}this.showLoading(),a.setTimeout((function(){try{if(e.focus(),r.isIE_Edge||s.documentMode||a.StyleMedia)try{e.contentWindow.document.execCommand("print",!1,null)}catch(t){e.contentWindow.print()}else e.contentWindow.print()}catch(e){throw Error("[SUNEDITOR.core.print.fail] error: "+e)}finally{d.closeLoading(),r.removeItem(e)}}),1e3)},preview:function(){d.submenuOff(),d.containerOff(),d.controllersOff();const t=this.getContents(!0),n=a.open("","_blank");n.mimeType="text/html";const o=e.element.wysiwygFrame.offsetWidth+"px !important",c=this._wd;if(l.iframe){const e=l.fullPage?r.getAttributesToString(c.body,["contenteditable"]):'class="sun-editor-editable"';n.document.write(""+c.head.innerHTML+""+t+"")}else{const e=s.head.getElementsByTagName("link"),l=s.head.getElementsByTagName("style");let a="";for(let t=0,n=e.length;t'+i.toolbar.preview+""+a+''+t+"")}},setContents:function(t){const n=this.convertContentsForEditor(t);if(this._resetComponents(),this._variable.isCodeView){const e=this.convertHTMLForCodeView(n);this._setCodeView(e)}else e.element.wysiwyg.innerHTML=n,this.history.push(!1)},getContents:function(t){const n=e.element.wysiwyg.innerHTML,i=r.createElement("DIV");i.innerHTML=n;const o=r.getListChildren(i,(function(e){return/FIGCAPTION/i.test(e.nodeName)}));for(let e=0,t=o.length;e"+this._wd.head.outerHTML+""+i.innerHTML+""}return i.innerHTML},_makeLine:function(e,t){if(1===e.nodeType)return r._disallowedTags(e)?"":!t||r.isFormatElement(e)||r.isRangeFormatElement(e)||r.isComponent(e)||r.isMedia(e)||r.isAnchor(e)&&r.isMedia(e.firstElementChild)?e.outerHTML:"

    "+e.outerHTML+"

    ";if(3===e.nodeType){if(!t)return e.textContent;const n=e.textContent.split(/\n/g);let i="";for(let e,t=0,l=n.length;t0&&(i+="

    "+e+"

    ");return i}return 8===e.nodeType&&this._allowHTMLComments?"\x3c!--"+e.textContent.trim()+"--\x3e":""},_tagConvertor:function(e){if(!this._disallowedTextTagsRegExp)return e;const t={b:"strong",i:"em",ins:"u",strike:"del",s:"del"};return e.replace(this._disallowedTextTagsRegExp,(function(e,n,i){return n+("string"==typeof t[i]?t[i]:i)}))},_deleteDisallowedTags:function(e){return e.replace(/\n/g,"").replace(/<(script|style).*>(\n|.)*<\/(script|style)>/gi,"").replace(/<[a-z0-9]+\:[a-z0-9]+[^>^\/]*>[^>]*<\/[a-z0-9]+\:[a-z0-9]+>/gi,"").replace(this.editorTagsWhitelistRegExp,"")},cleanHTML:function(e,t){e=this._deleteDisallowedTags(e).replace(/(<[a-zA-Z0-9]+)[^>]*(?=>)/g,function(e,t){if(/^<[a-z0-9]+\:[a-z0-9]+/i.test(e))return e;let n=null;const i=this._attributesTagsWhitelist[t.match(/(?!<)[a-zA-Z0-9]+/)[0].toLowerCase()];if(n=i?e.match(i):e.match(this._attributesWhitelistRegExp),/

    ":(i=r.htmlRemoveWhiteSpace(i),this._tagConvertor(i))},convertHTMLForCodeView:function(e){let t="";const n=a.RegExp,i=new n("^(BLOCKQUOTE|PRE|TABLE|THEAD|TBODY|TR|TH|TD|OL|UL|IMG|IFRAME|VIDEO|AUDIO|FIGURE|FIGCAPTION|HR|BR|CANVAS|SELECT)$","i"),l=r.isFormatElement.bind(r),o="string"==typeof e?s.createRange().createContextualFragment(e):e;let c=1*this._variable.codeIndent;return c=c>0?new a.Array(c+1).join(" "):"",function e(o,s,a){const d=o.childNodes,u=i.test(o.nodeName),h=u?s:"";for(let g,p,m,f=0,_=d.length;f<_;f++){if(g=d[f],m=i.test(g.nodeName),p=m?"\n":"",a=!l(g)||u||/^(TH|TD)$/i.test(o.nodeName)?"":"\n",8===g.nodeType){t+="\n\x3c!-- "+g.textContent.trim()+" --\x3e"+p;continue}if(3===g.nodeType){t+=r._HTMLConvertor(/^\n+$/.test(g.data)?"":g.data);continue}if(0===g.childNodes.length){t+=(/^HR$/i.test(g.nodeName)?"\n":"")+h+g.outerHTML+p;continue}g.innerHTML=g.innerHTML;const _=g.nodeName.toLowerCase();t+=(a||(u?"":p))+(h||m?s:"")+g.outerHTML.match(n("<"+_+"[^>]*>","i"))[0]+p,e(g,s+c,""),t+=(m?s:"")+""+(a||p||u||/^(TH|TD)$/i.test(g.nodeName)?"\n":"")}}(o,"","\n"),t.trim()+"\n"},addDocEvent:function(e,t,n){s.addEventListener(e,t,n),l.iframe&&this._wd.addEventListener(e,t)},removeDocEvent:function(e,t){s.removeEventListener(e,t),l.iframe&&this._wd.removeEventListener(e,t)},_charCount:function(e){const t=l.maxCharCount,n=l.charCounterType;let i=0;if(e&&(i=this.getCharLength(e,n)),this._setCharCount(),t>0){let e=!1;const l=h.getCharCount(n);if(l>t){if(e=!0,i>0){this._editorRange();const e=this.getRange(),n=e.endOffset-1,i=this.getSelectionNode().textContent,o=e.endOffset-(l-t);this.getSelectionNode().textContent=i.slice(0,o<0?0:o)+i.slice(e.endOffset,i.length),this.setRange(e.endContainer,n,e.endContainer,n)}}else l+i>t&&(e=!0);if(e&&(this._callCounterBlink(),i>0))return!1}return!0},checkCharCount:function(e,t){if(l.maxCharCount){const n=t||l.charCounterType,i=this.getCharLength("string"==typeof e?e:this._charTypeHTML?e.outerHTML:e.textContent,n);if(i>0&&i+h.getCharCount(n)>l.maxCharCount)return this._callCounterBlink(),!1}return!0},getCharLength:function(e,t){return/byte/.test(t)?r.getByteLength(e):e.length},_setCharCount:function(){e.element.charCounter&&a.setTimeout((function(){e.element.charCounter.textContent=h.getCharCount(l.charCounterType)}))},_callCounterBlink:function(){const t=e.element.charWrapper;t&&!r.hasClass(t,"se-blink")&&(r.addClass(t,"se-blink"),a.setTimeout((function(){r.removeClass(t,"se-blink")}),600))},_checkComponents:function(){for(let e=0,t=this._fileInfoPluginsCheck.length;e^<]+)?\\s*(?=>)","gi");const h="contenteditable|colspan|rowspan|target|href|src|class|type|controls|data-format|data-size|data-file-size|data-file-name|data-origin|data-align|data-image-link|data-rotate|data-proportion|data-percentage|origin-size|data-exp|data-font-size";this._allowHTMLComments=l._editorTagsWhitelist.indexOf("//")>-1,this._htmlCheckWhitelistRegExp=new c("^("+l._editorTagsWhitelist.replace("|//","")+")$","i"),this.editorTagsWhitelistRegExp=r.createTagsWhitelist(l._editorTagsWhitelist.replace("|//","|\x3c!--|--\x3e")),this.pasteTagsWhitelistRegExp=r.createTagsWhitelist(l.pasteTagsWhitelist);const g=l.attributesWhitelist,p={};let m="";if(g)for(let e in g)r.hasOwn(g,e)&&("all"===e?m=g[e]+"|":p[e]=new c("((?:"+g[e]+"|"+h+')s*=s*"[^"]*")',"ig"));this._attributesWhitelistRegExp=new c("((?:"+m+h+')s*=s*"[^"]*")',"ig"),this._attributesTagsWhitelist=p,this._isInline=/inline/i.test(l.mode),this._isBalloon=/balloon|balloon-always/i.test(l.mode),this._isBalloonAlways=/balloon-always/i.test(l.mode),this._cachingButtons(),this._fileInfoPluginsCheck=[],this._fileInfoPluginsReset=[],this.managedTagsInfo={query:"",map:{}};const f=[];this.activePlugins=[],this._fileManager.tags=[],this._fileManager.pluginMap={};let _,b,v=[];for(let e in n)if(r.hasOwn(n,e)){if(_=n[e],b=t[e],_.active&&b&&this.callPlugin(e,null,b),"function"==typeof _.checkFileInfo&&"function"==typeof _.resetFileInfo&&(this.callPlugin(e,null,b),this._fileInfoPluginsCheck.push(_.checkFileInfo.bind(this)),this._fileInfoPluginsReset.push(_.resetFileInfo.bind(this))),a.Array.isArray(_.fileTags)){const t=_.fileTags;this.callPlugin(e,null,b),this._fileManager.tags=this._fileManager.tags.concat(t),v.push(e);for(let n=0,i=t.length;nc&&(d=d.slice(0,c),a&&a.setAttribute("disabled",!0)),d[c]=l?{contents:n,s:{path:i.getNodePath(l.startContainer,null,null),offset:l.startOffset},e:{path:i.getNodePath(l.endContainer,null,null),offset:l.endOffset}}:{contents:n,s:{path:[0,0],offset:[0,0]},e:{path:0,offset:0}},1===c&&s&&s.removeAttribute("disabled"),e._setCharCount(),t()}return{stack:d,push:function(t){n.setTimeout(e._resourcesStateChange.bind(e));const i="number"==typeof t?t>0?t:0:t?l:0;i&&!r||(n.clearTimeout(r),i)?r=n.setTimeout((function(){n.clearTimeout(r),r=null,h()}),i):h()},undo:function(){c>0&&(c--,u())},redo:function(){d.length-1>c&&(c++,u())},go:function(e){c=e<0?d.length-1:e,u()},reset:function(n){s&&s.setAttribute("disabled",!0),a&&a.setAttribute("disabled",!0),e.context.tool.save&&e.context.tool.save.setAttribute("disabled",!0),d.splice(0),c=0,d[c]={contents:e.getContents(!0),s:{path:[0,0],offset:0},e:{path:[0,0],offset:0}},n||t()},_resetCachingButton:function(){o=e.context.element,s=e.context.tool.undo,a=e.context.tool.redo,0===c?(s&&s.setAttribute("disabled",!0),a&&c===d.length-1&&a.setAttribute("disabled",!0),e.context.tool.save&&e.context.tool.save.setAttribute("disabled",!0)):c===d.length-1&&a&&a.setAttribute("disabled",!0)},_destroy:function(){r&&n.clearTimeout(r),d=null}}}(this,this._onChange_historyStack.bind(this)),this.addModule([B]),l.iframe&&(this._wd=e.element.wysiwygFrame.contentDocument,e.element.wysiwyg=this._wd.body,l._editorStyles.editor&&(e.element.wysiwyg.style.cssText=l._editorStyles.editor),"auto"===l.height&&(this._iframeAuto=this._wd.body)),this._initWysiwygArea(i,o)},_cachingButtons:function(){this.codeViewDisabledButtons=e.element.toolbar.querySelectorAll('.se-toolbar button:not([class~="se-code-view-enabled"])'),this.resizingDisabledButtons=e.element.toolbar.querySelectorAll('.se-toolbar button:not([class~="se-resizing-enabled"])');const t=e.tool;this.commandMap={STRONG:t.bold,U:t.underline,EM:t.italic,DEL:t.strike,SUB:t.subscript,SUP:t.superscript,OUTDENT:t.outdent,INDENT:t.indent},this._styleCommandMap={fullScreen:t.fullScreen,showBlocks:t.showBlocks,codeView:t.codeView}},_initWysiwygArea:function(t,n){e.element.wysiwyg.innerHTML=t?n:this.convertContentsForEditor("string"==typeof n?n:e.element.originElement.value)},_resourcesStateChange:function(){this._iframeAutoHeight(),this._checkPlaceholder()},_onChange_historyStack:function(){u._applyTagEffects(),e.tool.save&&e.tool.save.removeAttribute("disabled"),h.onChange&&h.onChange(this.getContents(!0),this)},_iframeAutoHeight:function(){this._iframeAuto&&a.setTimeout((function(){e.element.wysiwygFrame.style.height=d._iframeAuto.offsetHeight+"px"}))},_checkPlaceholder:function(){if(this._placeholder){if(this._variable.isCodeView)return void(this._placeholder.style.display="none");const t=e.element.wysiwyg;!r.onlyZeroWidthSpace(t.textContent)||t.querySelector(".se-component, pre, blockquote, hr, li, table, img, iframe, video")||(t.innerText.match(/\n/g)||"").length>1?this._placeholder.style.display="none":this._placeholder.style.display="block"}},_setDefaultFormat:function(e){if(this._fileManager.pluginRegExp.test(this.currentControllerName))return;const t=this.getRange(),n=t.commonAncestorContainer,i=t.startContainer,l=r.getRangeFormatElement(n,null);let o,s,a;const c=r.getParentElement(n,r.isComponent);if((!c||r.isTable(c))&&(!r.isRangeFormatElement(i)&&!r.isWysiwygDiv(i)||!r.isComponent(i.childNodes[t.startOffset]))){if(l)return a=r.createElement(e||"P"),a.innerHTML=l.innerHTML,0===a.childNodes.length&&(a.innerHTML=r.zeroWidthSpace),l.innerHTML=a.outerHTML,a=l.firstChild,o=r.getEdgeChildNodes(a,null).sc,o||(o=r.createTextNode(r.zeroWidthSpace),a.insertBefore(o,a.firstChild)),s=o.textContent.length,void this.setRange(o,s,o,s);if(r.isRangeFormatElement(n)&&n.childNodes.length<=1){let e=null;return 1===n.childNodes.length&&r.isBreak(n.firstChild)?e=n.firstChild:(e=r.createTextNode(r.zeroWidthSpace),n.appendChild(e)),void this.setRange(e,1,e,1)}if(this.execCommand("formatBlock",!1,e||"P"),o=r.getEdgeChildNodes(n,n),o=o?o.ec:n,a=r.getFormatElement(o,null),!a)return this.removeRange(),void this._editorRange();if(r.isBreak(a.nextSibling)&&r.removeItem(a.nextSibling),r.isBreak(a.previousSibling)&&r.removeItem(a.previousSibling),r.isBreak(o)){const e=r.createTextNode(r.zeroWidthSpace);o.parentNode.insertBefore(e,o),o=e}this.effectNode=null,this.nativeFocus()}},_setOptionsInit:function(t,n){this.context=e=A(t.originElement,this._getConstructed(t),l),this._componentsInfoReset=!0,this._editorInit(!0,n)},_editorInit:function(t,n){this._init(t,n),u._addEvent(),this._setCharCount(),u._offStickyToolbar(),u.onResize_window(),e.element.toolbar.style.visibility="",this._checkComponents(),this._componentsInfoInit=!1,this._componentsInfoReset=!1,this.history.reset(!0),this._resourcesStateChange(),a.setTimeout((function(){"function"==typeof h.onload&&h.onload(d,t)}))},_getConstructed:function(e){return{_top:e.topArea,_relative:e.relative,_toolBar:e.toolbar,_menuTray:e._menuTray,_editorArea:e.editorArea,_wysiwygArea:e.wysiwygFrame,_codeArea:e.code,_placeholder:e.placeholder,_resizingBar:e.resizingBar,_navigation:e.navigation,_charCounter:e.charCounter,_charWrapper:e.charWrapper,_loading:e.loading,_lineBreaker:e.lineBreaker,_lineBreaker_t:e.lineBreaker_t,_lineBreaker_b:e.lineBreaker_b,_resizeBack:e.resizeBackground,_stickyDummy:e._stickyDummy,_arrow:e._arrow}}},u={_IEisComposing:!1,_lineBreakerBind:null,_responsiveCurrentSize:"default",_responsiveButtonSize:null,_responsiveButtons:null,_directionKeyCode:new a.RegExp("^(8|13|3[2-9]|40|46)$"),_nonTextKeyCode:new a.RegExp("^(8|13|1[6-9]|20|27|3[3-9]|40|45|46|11[2-9]|12[0-3]|144|145)$"),_historyIgnoreKeyCode:new a.RegExp("^(1[6-9]|20|27|3[3-9]|40|45|11[2-9]|12[0-3]|144|145)$"),_onButtonsCheck:new a.RegExp("^(STRONG|U|EM|DEL|SUB|SUP)$"),_frontZeroWidthReg:new a.RegExp(r.zeroWidthSpace+"+",""),_keyCodeShortcut:{65:"A",66:"B",83:"S",85:"U",73:"I",89:"Y",90:"Z",219:"[",221:"]"},_shortcutCommand:function(e,t){let n=null;switch(u._keyCodeShortcut[e]){case"A":n="selectAll";break;case"B":-1===l.shortcutsDisable.indexOf("bold")&&(n="STRONG");break;case"S":t&&-1===l.shortcutsDisable.indexOf("strike")&&(n="DEL");break;case"U":-1===l.shortcutsDisable.indexOf("underline")&&(n="U");break;case"I":-1===l.shortcutsDisable.indexOf("italic")&&(n="EM");break;case"Z":-1===l.shortcutsDisable.indexOf("undo")&&(n=t?"redo":"undo");break;case"Y":-1===l.shortcutsDisable.indexOf("undo")&&(n="redo");break;case"[":-1===l.shortcutsDisable.indexOf("indent")&&(n="outdent");break;case"]":-1===l.shortcutsDisable.indexOf("indent")&&(n="indent")}return!!n&&(d.commandHandler(d.commandMap[n],n),!0)},_applyTagEffects:function(){let t=d.getSelectionNode();if(t===d.effectNode)return;d.effectNode=t;const i=d.commandMap,o=this._onButtonsCheck,s=[],a=[],c=d.activePlugins,u=c.length;let h="";for(;t.firstChild;)t=t.firstChild;for(let e=t;!r.isWysiwygDiv(e)&&e;e=e.parentNode)if(1===e.nodeType&&!r.isBreak(e)){h=e.nodeName.toUpperCase(),a.push(h);for(let t,i=0;i0)&&(s.push("OUTDENT"),i.OUTDENT.removeAttribute("disabled")),-1===s.indexOf("INDENT")&&i.INDENT&&r.isListCell(e)&&!e.previousElementSibling&&(s.push("INDENT"),i.INDENT.setAttribute("disabled",!0))):o.test(h)&&(s.push(h),r.addClass(i[h],"active"))}for(let e in i)s.indexOf(e)>-1||!r.hasOwn(i,e)||(c.indexOf(e)>-1?n[e].active.call(d,null):i.OUTDENT&&/^OUTDENT$/i.test(e)?i.OUTDENT.setAttribute("disabled",!0):i.INDENT&&/^INDENT$/i.test(e)?i.INDENT.removeAttribute("disabled"):r.removeClass(i[e],"active"));d._variable.currentNodes=a.reverse(),d._variable.currentNodesMap=s,l.showPathLabel&&(e.element.navigation.textContent=d._variable.currentNodes.join(" > "))},_cancelCaptionEdit:function(){this.setAttribute("contenteditable",!1),this.removeEventListener("blur",u._cancelCaptionEdit)},_buttonsEventHandler:function(e){let t=e.target;if(d._bindControllersOff&&e.stopPropagation(),/^(input|textarea|select|option)$/i.test(t.nodeName)?d._antiBlur=!1:e.preventDefault(),r.getParentElement(t,".se-submenu"))e.stopPropagation(),d._notHideToolbar=!0;else{let n=t.getAttribute("data-command"),i=t.className;for(;!n&&!/se-menu-list/.test(i)&&!/sun-editor-common/.test(i);)t=t.parentNode,n=t.getAttribute("data-command"),i=t.className;n!==d._submenuName&&n!==d._containerName||e.stopPropagation()}},onClick_toolbar:function(e){let t=e.target,n=t.getAttribute("data-display"),i=t.getAttribute("data-command"),l=t.className;for(;t.parentNode&&!i&&!/se-menu-list/.test(l)&&!/se-toolbar/.test(l);)t=t.parentNode,i=t.getAttribute("data-command"),n=t.getAttribute("data-display"),l=t.className;(i||n)&&(t.disabled||(d.hasFocus||d.nativeFocus(),d._variable.isCodeView||d._editorRange(),d.actionCall(i,n,t)))},onMouseDown_wysiwyg:function(t){if(r.isNonEditable(e.element.wysiwyg))return;const n=r.getParentElement(t.target,r.isCell);if(n){const e=d.plugins.table;e&&n!==e._fixedCell&&!e._shift&&d.callPlugin("table",(function(){e.onTableCellMultiSelect.call(d,n,!1)}),null)}d._isBalloon&&u._hideToolbar(),/FIGURE/i.test(t.target.nodeName)&&t.preventDefault(),"function"==typeof h.onMouseDown&&h.onMouseDown(t,d)},onClick_wysiwyg:function(t){const n=t.target;if(r.isNonEditable(e.element.wysiwyg))return;const i=d.getFileComponent(n);if(i)return t.preventDefault(),void d.selectComponent(i.target,i.pluginName);const l=r.getParentElement(n,"FIGCAPTION");if(r.isNonEditable(l)&&(t.preventDefault(),l.setAttribute("contenteditable",!0),l.focus(),d._isInline&&!d._inlineToolbarAttr.isShow)){u._showToolbarInline();const e=function(){u._hideToolbar(),l.removeEventListener("blur",e)};l.addEventListener("blur",e)}a.setTimeout(d._editorRange.bind(d)),d._editorRange();const o=d.getSelectionNode(),s=r.getFormatElement(o,null),c=r.getRangeFormatElement(o,null);if(s&&s!==c||r.isNonEditable(n)||r.isList(c))u._applyTagEffects();else{const e=d.getRange();if(r.getFormatElement(e.startContainer)===r.getFormatElement(e.endContainer)){if(r.isList(c)){const e=r.createElement("LI"),t=o.nextElementSibling;e.appendChild(o),c.insertBefore(e,t)}else r.isWysiwygDiv(o)||r.isComponent(o)||r.isTable(o)&&!r.isCell(o)||d._setDefaultFormat(r.isRangeFormatElement(c)?"DIV":"P");t.preventDefault(),d.focus()}}d._isBalloon&&a.setTimeout(u._toggleToolbarBalloon),"function"==typeof h.onClick&&h.onClick(t,d)},_balloonDelay:null,_showToolbarBalloonDelay:function(){u._balloonDelay&&a.clearTimeout(u._balloonDelay),u._balloonDelay=a.setTimeout(function(){a.clearTimeout(this._balloonDelay),this._balloonDelay=null,this._showToolbarBalloon()}.bind(u),350)},_toggleToolbarBalloon:function(){d._editorRange();const e=d.getRange();d._bindControllersOff||!d._isBalloonAlways&&e.collapsed?u._hideToolbar():u._showToolbarBalloon(e)},_showToolbarBalloon:function(t){if(!d._isBalloon)return;const n=t||d.getRange(),i=e.element.toolbar,l=d.getSelection();let o;if(d._isBalloonAlways&&n.collapsed)o=!0;else if(l.focusNode===l.anchorNode)o=l.focusOffset0&&u._getPageBottomSpace()C&&(t=!1,y=!0),y&&(b=(t?n.top-m-g:n.bottom+g)-(n.noText?0:h)+d),i.style.left=a.Math.floor(v)+"px",i.style.top=a.Math.floor(b)+"px",t?(r.removeClass(e.element._arrow,"se-arrow-up"),r.addClass(e.element._arrow,"se-arrow-down"),e.element._arrow.style.top=m+"px"):(r.removeClass(e.element._arrow,"se-arrow-down"),r.addClass(e.element._arrow,"se-arrow-up"),e.element._arrow.style.top=-g+"px");const w=a.Math.floor(p/2+(f-v));e.element._arrow.style.left=(w+g>i.offsetWidth?i.offsetWidth-g:w";const e=f.attributes;for(;e[0];)f.removeAttribute(e[0].name);return d.nativeFocus(),!1}}if(f&&g.startContainer===g.endContainer&&3===c.nodeType&&!r.isFormatElement(c.parentNode)&&(g.collapsed?1===c.textContent.length:g.endOffset-g.startOffset===c.textContent.length)){t.preventDefault();let e=null,n=c.parentNode.previousSibling;const i=c.parentNode.nextSibling;n||(i?(n=i,e=0):(n=r.createElement("BR"),f.appendChild(n))),c.textContent="",r.removeItemAllParents(c,null,f),e="number"==typeof e?e:3===n.nodeType?n.textContent.length:1,d.setRange(n,e,n,e);break}const n=g.commonAncestorContainer;if(f=r.getFormatElement(g.startContainer,null),_=r.getRangeFormatElement(f,null),_&&f&&!r.isCell(_)&&!/^FIGCAPTION$/i.test(_.nodeName)){if(r.isListCell(f)&&r.isList(_)&&(r.isListCell(_.parentNode)||f.previousElementSibling)&&(c===f||3===c.nodeType&&(!c.previousSibling||r.isList(c.previousSibling)))&&(r.getFormatElement(g.startContainer,null)!==r.getFormatElement(g.endContainer,null)?_.contains(g.startContainer):0===g.startOffset&&g.collapsed)){if(g.startContainer!==g.endContainer)t.preventDefault(),d.removeNode(),3===g.startContainer.nodeType&&d.setRange(g.startContainer,g.startContainer.textContent.length,g.startContainer,g.startContainer.textContent.length),d.history.push(!0);else{let e=f.previousElementSibling||_.parentNode;if(r.isListCell(e)){t.preventDefault();let n=e;if(!e.contains(f)&&r.isListCell(n)&&r.isList(n.lastElementChild)){for(n=n.lastElementChild.lastElementChild;r.isListCell(n)&&r.isList(n.lastElementChild);)n=n.lastElementChild&&n.lastElementChild.lastElementChild;e=n}let i=e===_.parentNode?_.previousSibling:e.lastChild;i||(i=r.createTextNode(r.zeroWidthSpace),_.parentNode.insertBefore(i,_.parentNode.firstChild));const l=3===i.nodeType?i.textContent.length:1,o=f.childNodes;let s=i,a=o[0];for(;a=o[0];)e.insertBefore(a,s.nextSibling),s=a;r.removeItem(f),0===_.children.length&&r.removeItem(_),d.setRange(i,l,i,l),d.history.push(!0)}}break}if(!p&&0===g.startOffset){let e=!0,i=n;for(;i&&i!==_&&!r.isWysiwygDiv(i);){if(i.previousSibling&&(1===i.previousSibling.nodeType||!r.onlyZeroWidthSpace(i.previousSibling.textContent.trim()))){e=!1;break}i=i.parentNode}if(e&&_.parentNode){t.preventDefault(),d.detachRangeFormatElement(_,r.isListCell(f)?[f]:null,null,!1,!1),d.history.push(!0);break}}}if(!p&&(0===g.startOffset||c===f&&f.childNodes[g.startOffset])){const e=c===f?f.childNodes[g.startOffset]:c,i=(3===n.nodeType||r.isBreak(n))&&!n.previousSibling&&0===g.startOffset;if(!e.previousSibling&&(r.isComponent(n.previousSibling)||i&&r.isComponent(f.previousSibling))){const e=d.getFileComponent(f.previousSibling);e&&(t.preventDefault(),t.stopPropagation(),0===f.textContent.length&&r.removeItem(f),d.selectComponent(e.target,e.pluginName));break}if(r.isNonEditable(e.previousSibling)){t.preventDefault(),t.stopPropagation(),r.removeItem(e.previousSibling);break}}break;case 46:if(m){t.preventDefault(),t.stopPropagation(),d.plugins[m].destroy.call(d);break}if(p&&u._hardDelete()){t.preventDefault(),t.stopPropagation();break}if((r.isFormatElement(c)||null===c.nextSibling||r.onlyZeroWidthSpace(c.nextSibling)&&null===c.nextSibling.nextSibling)&&g.startOffset===c.textContent.length){let e=f.nextElementSibling;if(!e){t.preventDefault();break}if(r.isComponent(e)){if(t.preventDefault(),r.onlyZeroWidthSpace(f)&&(r.removeItem(f),r.isTable(e))){let t=r.getChildElement(e,r.isCell,!1);t=t.firstElementChild||t,d.setRange(t,0,t,0);break}const n=d.getFileComponent(e);n&&(t.stopPropagation(),d.selectComponent(n.target,n.pluginName));break}}if(!p&&(d.isEdgePoint(g.endContainer,g.endOffset)||c===f&&f.childNodes[g.startOffset])){const e=c===f?f.childNodes[g.startOffset]:c;if(r.isNonEditable(e.nextSibling)){t.preventDefault(),t.stopPropagation(),r.removeItem(e.nextSibling);break}}if(f=r.getFormatElement(g.startContainer,null),_=r.getRangeFormatElement(f,null),r.isListCell(f)&&r.isList(_)&&(c===f||3===c.nodeType&&(!c.nextSibling||r.isList(c.nextSibling))&&(r.getFormatElement(g.startContainer,null)!==r.getFormatElement(g.endContainer,null)?_.contains(g.endContainer):g.endOffset===c.textContent.length&&g.collapsed))){g.startContainer!==g.endContainer&&d.removeNode();let e=r.getArrayItem(f.children,r.isList,!1);if(e=e||f.nextElementSibling||_.parentNode.nextElementSibling,e&&(r.isList(e)||r.getArrayItem(e.children,r.isList,!1))){let n,i;if(t.preventDefault(),r.isList(e)){const t=e.firstElementChild;for(i=t.childNodes,n=i[0];i[0];)f.insertBefore(i[0],e);r.removeItem(t)}else{for(n=e.firstChild,i=e.childNodes;i[0];)f.appendChild(i[0]);r.removeItem(e)}d.setRange(n,0,n,0),d.history.push(!0)}break}break;case 9:if(m||l.tabDisable)break;if(t.preventDefault(),o||s||r.isWysiwygDiv(c))break;const b=!g.collapsed||d.isEdgePoint(g.startContainer,g.startOffset),v=d.getSelectedElements(null);c=d.getSelectionNode();const y=[];let C=[],w=r.isListCell(v[0]),x=r.isListCell(v[v.length-1]),E={sc:g.startContainer,so:g.startOffset,ec:g.endContainer,eo:g.endOffset};for(let e,t=0,n=v.length;t0&&b&&d.plugins.list)E=d.plugins.list.editInsideList.call(d,i,y);else{const e=r.getParentElement(c,r.isCell);if(e&&b){const t=r.getParentElement(e,"table"),n=r.getListChildren(t,r.isCell);let l=i?r.prevIdx(n,e):r.nextIdx(n,e);l!==n.length||i||(l=0),-1===l&&i&&(l=n.length-1);let o=n[l];if(!o)break;o=o.firstElementChild||o,d.setRange(o,0,o,0);break}C=C.concat(y),w=x=null}if(C.length>0)if(i){const e=C.length-1;for(let t,n=0;n<=e;n++){t=C[n].childNodes;for(let e,n=0,i=t.length;n":"<"+f.nodeName+">
    ",!d.checkCharCount(e,"byte-html"))return t.preventDefault(),!1}if(!i&&S){t.preventDefault();const e=c===S,n=d.getSelection(),i=c.childNodes,l=n.focusOffset,o=c.previousElementSibling,s=c.nextSibling;if(!r.isClosureFreeFormatElement(S)&&i&&(e&&g.collapsed&&i.length-1<=l+1&&r.isBreak(i[l])&&(!i[l+1]||(!i[l+2]||r.onlyZeroWidthSpace(i[l+2].textContent))&&3===i[l+1].nodeType&&r.onlyZeroWidthSpace(i[l+1].textContent))&&l>0&&r.isBreak(i[l-1])||!e&&r.onlyZeroWidthSpace(c.textContent)&&r.isBreak(o)&&(r.isBreak(o.previousSibling)||!r.onlyZeroWidthSpace(o.previousSibling.textContent))&&(!s||!r.isBreak(s)&&r.onlyZeroWidthSpace(s.textContent)))){e?r.removeItem(i[l-1]):r.removeItem(c);const t=d.appendFormatTag(S,r.isFormatElement(S.nextElementSibling)?S.nextElementSibling:null);r.copyFormatAttributes(t,S),d.setRange(t,1,t,1);break}if(e){h.insertHTML(g.collapsed&&r.isBreak(g.startContainer.childNodes[g.startOffset-1])?"
    ":"

    ",!0,!1);let e=n.focusNode;const t=n.focusOffset;S===e&&(e=e.childNodes[t-l>1?t-1:t]),d.setRange(e,1,e,1)}else{const e=n.focusNode.nextSibling,t=r.createElement("BR");d.insertNode(t,null,!1);const i=t.previousSibling,l=t.nextSibling;r.isBreak(e)||r.isBreak(i)||l&&!r.onlyZeroWidthSpace(l)?d.setRange(l,0,l,0):(t.parentNode.insertBefore(t.cloneNode(!1),t),d.setRange(t,1,t,1))}u._onShortcutKey=!0;break}if(p)break;if(_&&f&&!r.isCell(_)&&!/^FIGCAPTION$/i.test(_.nodeName)){const e=d.getRange();if(d.isEdgePoint(e.endContainer,e.endOffset)&&r.isList(c.nextSibling)){t.preventDefault();const e=r.createElement("LI"),n=r.createElement("BR");e.appendChild(n),f.parentNode.insertBefore(e,f.nextElementSibling),e.appendChild(c.nextSibling),d.setRange(n,1,n,1);break}if((3!==e.commonAncestorContainer.nodeType||!e.commonAncestorContainer.nextElementSibling)&&r.onlyZeroWidthSpace(f.innerText.trim())){t.preventDefault();let e=null;if(r.isListCell(_.parentNode)){if(_=f.parentNode.parentNode.parentNode,e=r.splitElement(f,null,r.getElementDepth(f)-2),!e){const t=r.createElement("LI");t.innerHTML="
    ",_.insertBefore(t,e),e=t}}else{const t=r.isCell(_.parentNode)?"DIV":r.isList(_.parentNode)?"LI":r.isFormatElement(_.nextElementSibling)?_.nextElementSibling.nodeName:r.isFormatElement(_.previousElementSibling)?_.previousElementSibling.nodeName:"P";e=r.createElement(t);const n=d.detachRangeFormatElement(_,[f],null,!0,!0);n.cc.insertBefore(e,n.ec)}e.innerHTML="
    ",r.copyFormatAttributes(e,f),r.removeItemAllParents(f,null,null),d.setRange(e,1,e,1);break}}if(_&&r.getParentElement(_,"FIGCAPTION")&&r.getParentElement(_,r.isList)&&(t.preventDefault(),f=d.appendFormatTag(f,null),d.setRange(f,0,f,0)),m){t.preventDefault(),t.stopPropagation();const n=e[m],i=n._container,l=i.previousElementSibling||i.nextElementSibling;let o=null;r.isListCell(i.parentNode)?o=r.createElement("BR"):(o=r.createElement(r.isFormatElement(l)?l.nodeName:"P"),o.innerHTML="
    "),i.parentNode.insertBefore(o,i),d.callPlugin(m,(function(){d.selectComponent(n._element,m)}),null)}break;case 27:if(m)return t.preventDefault(),t.stopPropagation(),d.controllersOff(),!1}if(i&&/16/.test(n)){t.preventDefault(),t.stopPropagation();const e=d.plugins.table;if(e&&!e._shift&&!e._ref){const t=r.getParentElement(f,r.isCell);if(t)return void e.onTableCellMultiSelect.call(d,t,!0)}}if(!(o||s||p||u._nonTextKeyCode.test(n))&&g.collapsed&&g.startContainer===g.endContainer&&r.isBreak(g.commonAncestorContainer)){const e=r.createTextNode(r.zeroWidthSpace);d.insertNode(e,null,!1),d.setRange(e,1,e,1)}"function"==typeof h.onKeyDown&&h.onKeyDown(t,d)},onKeyUp_wysiwyg:function(e){if(u._onShortcutKey)return;d._editorRange();const t=d.getRange(),n=e.keyCode,i=e.ctrlKey||e.metaKey||91===n||92===n||224===n,l=e.altKey;let o=d.getSelectionNode();if(d._isBalloon&&(d._isBalloonAlways&&27!==n||!t.collapsed)){if(!d._isBalloonAlways)return void u._showToolbarBalloon();27!==n&&u._showToolbarBalloonDelay()}if(8===n&&r.isWysiwygDiv(o)&&""===o.textContent&&0===o.children.length){e.preventDefault(),e.stopPropagation(),o.innerHTML="";const t=r.createElement(r.isFormatElement(d._variable.currentNodes[0])?d._variable.currentNodes[0]:"P");return t.innerHTML="
    ",o.appendChild(t),d.setRange(t,0,t,0),u._applyTagEffects(),void d.history.push(!1)}const s=r.getFormatElement(o,null),a=r.getRangeFormatElement(o,null);(s||!t.collapsed)&&s!==a||r.isComponent(o)||r.isList(o)||(d._setDefaultFormat(r.isRangeFormatElement(a)?"DIV":"P"),o=d.getSelectionNode()),u._directionKeyCode.test(n)&&u._applyTagEffects();if(!i&&!l&&!u._nonTextKeyCode.test(n)&&3===o.nodeType&&r.zeroWidthRegExp.test(o.textContent)&&!(void 0!==e.isComposing?e.isComposing:u._IEisComposing)){let e=t.startOffset,n=t.endOffset;const i=(o.textContent.substring(0,n).match(u._frontZeroWidthReg)||"").length;e=t.startOffset-i,n=t.endOffset-i,o.textContent=o.textContent.replace(r.zeroWidthRegExp,""),d.setRange(o,e<0?0:e,o,n<0?0:n)}d._charCount(""),d.history.push(!0),"function"==typeof h.onKeyUp&&h.onKeyUp(e,d)},onScroll_wysiwyg:function(e){d.controllersOff(),d._lineBreaker.style.display="none",d._isBalloon&&u._hideToolbar(),"function"==typeof h.onScroll&&h.onScroll(e,d)},onFocus_wysiwyg:function(e){d._antiBlur||(d.hasFocus=!0,d._isInline&&u._showToolbarInline(),"function"==typeof h.onFocus&&h.onFocus(e,d))},onBlur_wysiwyg:function(t){if(d._antiBlur)return;d.hasFocus=!1,d.controllersOff(),(d._isInline||d._isBalloon)&&u._hideToolbar(),"function"==typeof h.onBlur&&h.onBlur(t,d);const i=d.commandMap,o=d.activePlugins;for(let e in i)r.hasOwn(i,e)&&(o.indexOf(e)>-1?n[e].active.call(d,null):i.OUTDENT&&/^OUTDENT$/i.test(e)?i.OUTDENT.setAttribute("disabled",!0):i.INDENT&&/^INDENT$/i.test(e)?i.INDENT.removeAttribute("disabled"):r.removeClass(i[e],"active"));d._variable.currentNodes=[],d._variable.currentNodesMap=[],l.showPathLabel&&(e.element.navigation.textContent="")},onMouseDown_resizingBar:function(t){t.stopPropagation(),d._variable.resizeClientY=t.clientY,e.element.resizeBackground.style.display="block",s.addEventListener("mousemove",u._resize_editor),s.addEventListener("mouseup",(function t(){e.element.resizeBackground.style.display="none",s.removeEventListener("mousemove",u._resize_editor),s.removeEventListener("mouseup",t)}))},_resize_editor:function(t){const n=e.element.editorArea.offsetHeight+(t.clientY-d._variable.resizeClientY);e.element.wysiwygFrame.style.height=e.element.code.style.height=(n=n+o?(d._sticky||u._onStickyToolbar(),t.toolbar.style.top=n+o+l.stickyToolbar-i-d._variable.minResizingSize+"px"):i>=o&&u._onStickyToolbar()},_getEditorOffsets:function(t){let n=t||e.element.topArea,i=0,l=0,o=0;for(;n;)i+=n.offsetTop,l+=n.offsetLeft,o+=n.scrollTop,n=n.offsetParent;return{top:i,left:l,scroll:o}},_getPageBottomSpace:function(){return s.documentElement.scrollHeight-(u._getEditorOffsets(null).top+e.element.topArea.offsetHeight)},_onStickyToolbar:function(){const t=e.element;d._isInline||l.toolbarContainer||(t._stickyDummy.style.height=t.toolbar.offsetHeight+"px",t._stickyDummy.style.display="block"),t.toolbar.style.top=l.stickyToolbar+"px",t.toolbar.style.width=d._isInline?d._inlineToolbarAttr.width:t.toolbar.offsetWidth+"px",r.addClass(t.toolbar,"se-toolbar-sticky"),d._sticky=!0},_offStickyToolbar:function(){const t=e.element;t._stickyDummy.style.display="none",t.toolbar.style.top=d._isInline?d._inlineToolbarAttr.top:"",t.toolbar.style.width=d._isInline?d._inlineToolbarAttr.width:"",t.editorArea.style.marginTop="",r.removeClass(t.toolbar,"se-toolbar-sticky"),d._sticky=!1},_codeViewAutoHeight:function(){e.element.code.style.height=e.element.code.scrollHeight+"px"},_hardDelete:function(){const e=d.getRange(),t=e.startContainer,n=e.endContainer,i=r.getRangeFormatElement(t),l=r.getRangeFormatElement(n),o=r.isCell(i),s=r.isCell(l);if((o&&!i.previousElementSibling&&!i.parentElement.previousElementSibling||s&&!l.nextElementSibling&&!l.parentElement.nextElementSibling)&&i!==l)if(o){if(s)return r.removeItem(r.getParentElement(i,r.isComponent)),d.nativeFocus(),!0;r.removeItem(r.getParentElement(i,r.isComponent))}else r.removeItem(r.getParentElement(l,r.isComponent));const a=1===t.nodeType?r.getParentElement(t,".se-component"):null,c=1===n.nodeType?r.getParentElement(n,".se-component"):null;return a&&r.removeItem(a),c&&r.removeItem(c),!1},onPaste_wysiwyg:function(e){const t=r.isIE?a.clipboardData:e.clipboardData;return!t||u._dataTransferAction("paste",e,t)},_setClipboardComponent:function(e,t,n){e.preventDefault(),e.stopPropagation(),n.setData("text/html",t.component.outerHTML)},onCopy_wysiwyg:function(e){const t=r.isIE?a.clipboardData:e.clipboardData;if("function"==typeof h.onCopy&&!h.onCopy(e,t,d))return e.preventDefault(),e.stopPropagation(),!1;const n=d.currentFileComponentInfo;n&&!r.isIE&&(u._setClipboardComponent(e,n,t),r.addClass(n.component,"se-component-copy"),a.setTimeout((function(){r.removeClass(n.component,"se-component-copy")}),150))},onCut_wysiwyg:function(e){const t=r.isIE?a.clipboardData:e.clipboardData;if("function"==typeof h.onCut&&!h.onCut(e,t,d))return e.preventDefault(),e.stopPropagation(),!1;const n=d.currentFileComponentInfo;n&&!r.isIE&&(u._setClipboardComponent(e,n,t),r.removeItem(n.component),d.controllersOff()),a.setTimeout((function(){d.history.push(!1)}))},onDrop_wysiwyg:function(e){const t=e.dataTransfer;return!t||(r.isIE?(e.preventDefault(),e.stopPropagation(),!1):(d.removeNode(),u._setDropLocationSelection(e),u._dataTransferAction("drop",e,t)))},_setDropLocationSelection:function(e){if(e.rangeParent)d.setRange(e.rangeParent,e.rangeOffset,e.rangeParent,e.rangeOffset);else if(d._wd.caretRangeFromPoint){const t=d._wd.caretRangeFromPoint(e.clientX,e.clientY);d.setRange(t.startContainer,t.startOffset,t.endContainer,t.endOffset)}else{const e=d.getRange();d.setRange(e.startContainer,e.startOffset,e.endContainer,e.endOffset)}},_dataTransferAction:function(t,n,i){let l,o;if(r.isIE){l=i.getData("Text");const s=d.getRange(),c=r.createElement("DIV"),h={sc:s.startContainer,so:s.startOffset,ec:s.endContainer,eo:s.endOffset};return c.setAttribute("contenteditable",!0),c.style.cssText="position:absolute; top:0; left:0; width:1px; height:1px; overflow:hidden;",e.element.relative.appendChild(c),c.focus(),a.setTimeout((function(){o=c.innerHTML,r.removeItem(c),d.setRange(h.sc,h.so,h.ec,h.eo),u._setClipboardData(t,n,l,o,i)})),!0}if(l=i.getData("text/plain"),o=i.getData("text/html"),!1===u._setClipboardData(t,n,l,o,i))return n.preventDefault(),n.stopPropagation(),!1},_setClipboardData:function(e,t,n,i,l){/class=["']*Mso(Normal|List)/i.test(i)||/content=["']*Word.Document/i.test(i)||/content=["']*OneNote.File/i.test(i)?(i=i.replace(/\n/g," "),n=n.replace(/\n/g," ")):n=n.replace(/\n/g,""),i=d.cleanHTML(i,d.pasteTagsWhitelistRegExp);const o=d._charCount(d._charTypeHTML?i:n);if("paste"===e&&"function"==typeof h.onPaste&&!h.onPaste(t,i,o,d))return!1;if("drop"===e&&"function"==typeof h.onDrop&&!h.onDrop(t,l,d))return!1;const s=l.files;return s.length>0?(/^image/.test(s[0].type)&&d.plugins.image&&h.insertImage(s),!1):!!o&&(i?(h.insertHTML(i,!0,!1),!1):void 0)},onMouseMove_wysiwyg:function(t){if(d.isDisabled)return;const n=r.getParentElement(t.target,r.isComponent),i=d._lineBreaker.style;if(n&&!d.currentControllerName){let o=0,s=e.element.wysiwyg;do{o+=s.scrollTop,s=s.parentElement}while(s&&!/^(BODY|HTML)$/i.test(s.nodeName));const a=e.element.wysiwyg.scrollTop,c=u._getEditorOffsets(null),h=r.getOffset(n,e.element.wysiwygFrame).top+a,g=t.pageY+o+(l.iframe&&!l.toolbarContainer?e.element.toolbar.offsetHeight:0),p=h+(l.iframe?o:c.top),m=r.isListCell(n.parentNode);let f="",_="";if((m?!n.previousSibling:!r.isFormatElement(n.previousElementSibling))&&gp+n.offsetHeight-20))return void(i.display="none");_=h+n.offsetHeight,f="b"}d._variable._lineBreakComp=n,d._variable._lineBreakDir=f,i.top=_-a+"px",d._lineBreakerButton.style.left=r.getOffset(n).left+n.offsetWidth/2-15+"px",i.display="block"}else"none"!==i.display&&(i.display="none")},_onMouseDown_lineBreak:function(e){e.preventDefault()},_onLineBreak:function(e){e.preventDefault();const t=d._variable._lineBreakComp,n=this?this:d._variable._lineBreakDir,i=r.isListCell(t.parentNode),l=r.createElement(i?"BR":r.isCell(t.parentNode)?"DIV":"P");if(i||(l.innerHTML="
    "),d._charTypeHTML&&!d.checkCharCount(l.outerHTML,"byte-html"))return;t.parentNode.insertBefore(l,"t"===n?t:t.nextSibling),d._lineBreaker.style.display="none",d._variable._lineBreakComp=null;const o=i?l:l.firstChild;d.setRange(o,1,o,1),d.history.push(!1)},_addEvent:function(){const t=l.iframe?d._ww:e.element.wysiwyg;e.element.toolbar.addEventListener("mousedown",u._buttonsEventHandler,!1),e.element._menuTray.addEventListener("mousedown",u._buttonsEventHandler,!1),e.element.toolbar.addEventListener("click",u.onClick_toolbar,!1),t.addEventListener("mousedown",u.onMouseDown_wysiwyg,!1),t.addEventListener("click",u.onClick_wysiwyg,!1),t.addEventListener(r.isIE?"textinput":"input",u.onInput_wysiwyg,!1),t.addEventListener("keydown",u.onKeyDown_wysiwyg,!1),t.addEventListener("keyup",u.onKeyUp_wysiwyg,!1),t.addEventListener("paste",u.onPaste_wysiwyg,!1),t.addEventListener("copy",u.onCopy_wysiwyg,!1),t.addEventListener("cut",u.onCut_wysiwyg,!1),t.addEventListener("drop",u.onDrop_wysiwyg,!1),t.addEventListener("scroll",u.onScroll_wysiwyg,!1),t.addEventListener("focus",u.onFocus_wysiwyg,!1),t.addEventListener("blur",u.onBlur_wysiwyg,!1),u._lineBreakerBind={a:u._onLineBreak.bind(""),t:u._onLineBreak.bind("t"),b:u._onLineBreak.bind("b")},t.addEventListener("mousemove",u.onMouseMove_wysiwyg,!1),d._lineBreakerButton.addEventListener("mousedown",u._onMouseDown_lineBreak,!1),d._lineBreakerButton.addEventListener("click",u._lineBreakerBind.a,!1),e.element.lineBreaker_t.addEventListener("mousedown",u._lineBreakerBind.t,!1),e.element.lineBreaker_b.addEventListener("mousedown",u._lineBreakerBind.b,!1),d.plugins.table&&t.addEventListener("touchstart",u.onMouseDown_wysiwyg,{passive:!0,useCapture:!1}),"auto"!==l.height||l.codeMirrorEditor||(e.element.code.addEventListener("keydown",u._codeViewAutoHeight,!1),e.element.code.addEventListener("keyup",u._codeViewAutoHeight,!1),e.element.code.addEventListener("paste",u._codeViewAutoHeight,!1)),e.element.resizingBar&&(/\d+/.test(l.height)?e.element.resizingBar.addEventListener("mousedown",u.onMouseDown_resizingBar,!1):r.addClass(e.element.resizingBar,"se-resizing-none")),u._setResponsiveToolbar(),a.removeEventListener("resize",u.onResize_window),a.removeEventListener("scroll",u.onScroll_window),a.addEventListener("resize",u.onResize_window,!1),l.stickyToolbar>-1&&a.addEventListener("scroll",u.onScroll_window,!1)},_removeEvent:function(){const t=l.iframe?d._ww:e.element.wysiwyg;e.element.toolbar.removeEventListener("mousedown",u._buttonsEventHandler),e.element._menuTray.removeEventListener("mousedown",u._buttonsEventHandler),e.element.toolbar.removeEventListener("click",u.onClick_toolbar),t.removeEventListener("mousedown",u.onMouseDown_wysiwyg),t.removeEventListener("click",u.onClick_wysiwyg),t.removeEventListener(r.isIE?"textinput":"input",u.onInput_wysiwyg),t.removeEventListener("keydown",u.onKeyDown_wysiwyg),t.removeEventListener("keyup",u.onKeyUp_wysiwyg),t.removeEventListener("paste",u.onPaste_wysiwyg),t.removeEventListener("copy",u.onCopy_wysiwyg),t.removeEventListener("cut",u.onCut_wysiwyg),t.removeEventListener("drop",u.onDrop_wysiwyg),t.removeEventListener("scroll",u.onScroll_wysiwyg),t.removeEventListener("mousemove",u.onMouseMove_wysiwyg),d._lineBreakerButton.removeEventListener("mousedown",u._onMouseDown_lineBreak),d._lineBreakerButton.removeEventListener("click",u._lineBreakerBind.a),e.element.lineBreaker_t.removeEventListener("mousedown",u._lineBreakerBind.t),e.element.lineBreaker_b.removeEventListener("mousedown",u._lineBreakerBind.b),u._lineBreakerBind=null,t.removeEventListener("touchstart",u.onMouseDown_wysiwyg,{passive:!0,useCapture:!1}),t.removeEventListener("focus",u.onFocus_wysiwyg),t.removeEventListener("blur",u.onBlur_wysiwyg),e.element.code.removeEventListener("keydown",u._codeViewAutoHeight),e.element.code.removeEventListener("keyup",u._codeViewAutoHeight),e.element.code.removeEventListener("paste",u._codeViewAutoHeight),e.element.resizingBar&&e.element.resizingBar.removeEventListener("mousedown",u.onMouseDown_resizingBar),a.removeEventListener("resize",u.onResize_window),a.removeEventListener("scroll",u.onScroll_window)},_setResponsiveToolbar:function(){if(0===o.length)return void(o=null);const e=u._responsiveButtonSize=["default"],t=u._responsiveButtons={default:o[0]};for(let n,i,l=1,s=o.length;l",e}};return void 0===t&&(e.SUNEDITOR_MODULES||Object.defineProperty(e,"SUNEDITOR_MODULES",{enumerable:!0,writable:!1,configurable:!1,value:{}}),Object.defineProperty(e.SUNEDITOR_MODULES,"component",{enumerable:!0,writable:!1,configurable:!1,value:n})),n},"object"==typeof e.exports?e.exports=i.document?l(i,!0):function(e){if(!e.document)throw new Error("SUNEDITOR_MODULES a window with a document");return l(e)}:l(i)},ee5k:function(e,t,n){"use strict";var i,l;i="undefined"!=typeof window?window:this,l=function(e,t){const n={name:"resizing",add:function(e){const t=e.icons,n=e.context;n.resizing={_resizeClientX:0,_resizeClientY:0,_resize_plugin:"",_resize_w:0,_resize_h:0,_origin_w:0,_origin_h:0,_rotateVertical:!1,_resize_direction:"",_move_path:null,_isChange:!1,alignIcons:{basic:t.align_justify,left:t.align_left,right:t.align_right,center:t.align_center}};let i=this.setController_resize.call(e);n.resizing.resizeContainer=i,n.resizing.resizeDiv=i.querySelector(".se-modal-resize"),n.resizing.resizeDot=i.querySelector(".se-resize-dot"),n.resizing.resizeDisplay=i.querySelector(".se-resize-display");let l=this.setController_button.call(e);n.resizing.resizeButton=l;let o=n.resizing.resizeHandles=n.resizing.resizeDot.querySelectorAll("span");n.resizing.resizeButtonGroup=l.querySelector("._se_resizing_btn_group"),n.resizing.rotationButtons=l.querySelectorAll("._se_resizing_btn_group ._se_rotation"),n.resizing.percentageButtons=l.querySelectorAll("._se_resizing_btn_group ._se_percentage"),n.resizing.alignMenu=l.querySelector(".se-resizing-align-list"),n.resizing.alignMenuList=n.resizing.alignMenu.querySelectorAll("button"),n.resizing.alignButton=l.querySelector("._se_resizing_align_button"),n.resizing.autoSizeButton=l.querySelector("._se_resizing_btn_group ._se_auto_size"),n.resizing.captionButton=l.querySelector("._se_resizing_caption_button"),i.addEventListener("mousedown",(function(e){e.preventDefault()})),l.addEventListener("mousedown",e.eventStop),o[0].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),o[1].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),o[2].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),o[3].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),o[4].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),o[5].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),o[6].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),o[7].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),l.addEventListener("click",this.onClick_resizeButton.bind(e)),n.element.relative.appendChild(i),n.element.relative.appendChild(l),i=null,l=null,o=null},setController_resize:function(){const e=this.util.createElement("DIV");return e.className="se-controller se-resizing-container",e.style.display="none",e.innerHTML='
    ',e},setController_button:function(){const e=this.lang,t=this.icons,n=this.util.createElement("DIV");return n.className="se-controller se-controller-resizing",n.innerHTML='
    ",n},_module_getSizeX:function(e,t,n,i){return t||(t=e._element),n||(n=e._cover),i||(i=e._container),t?/%$/.test(t.style.width)?(i&&this.util.getNumber(i.style.width,2)||100)+"%":t.style.width:""},_module_getSizeY:function(e,t,n,i){return t||(t=e._element),n||(n=e._cover),i||(i=e._container),i&&n?this.util.getNumber(n.style.paddingBottom,0)>0&&!this.context.resizing._rotateVertical?n.style.height:/%$/.test(t.style.height)&&/%$/.test(t.style.width)?(i&&this.util.getNumber(i.style.height,2)||100)+"%":t.style.height:t&&t.style.height||""},_module_setModifyInputSize:function(e,t){const n=e._onlyPercentage&&this.context.resizing._rotateVertical;e.proportion.checked=e._proportionChecked="false"!==e._element.getAttribute("data-proportion");let i=n?"":this.plugins.resizing._module_getSizeX.call(this,e);if(i===e._defaultSizeX&&(i=""),e._onlyPercentage&&(i=this.util.getNumber(i,2)),e.inputX.value=i,t.setInputSize.call(this,"x"),!e._onlyPercentage){let t=n?"":this.plugins.resizing._module_getSizeY.call(this,e);t===e._defaultSizeY&&(t=""),e._onlyPercentage&&(t=this.util.getNumber(t,2)),e.inputY.value=t}e.inputX.disabled=!!n,e.inputY.disabled=!!n,e.proportion.disabled=!!n,t.setRatio.call(this)},_module_setInputSize:function(e,t){if(e._onlyPercentage)"x"===t&&e.inputX.value>100&&(e.inputX.value=100);else if(e.proportion.checked&&e._ratio&&/\d/.test(e.inputX.value)&&/\d/.test(e.inputY.value)){const n=e.inputX.value.replace(/\d+|\./g,"")||e.sizeUnit,i=e.inputY.value.replace(/\d+|\./g,"")||e.sizeUnit;if(n!==i)return;const l="%"===n?2:0;"x"===t?e.inputY.value=this.util.getNumber(e._ratioY*this.util.getNumber(e.inputX.value,l),l)+i:e.inputX.value=this.util.getNumber(e._ratioX*this.util.getNumber(e.inputY.value,l),l)+n}},_module_setRatio:function(e){const t=e.inputX.value,n=e.inputY.value;if(e.proportion.checked&&/\d+/.test(t)&&/\d+/.test(n)){if((t.replace(/\d+|\./g,"")||e.sizeUnit)!==(n.replace(/\d+|\./g,"")||e.sizeUnit))e._ratio=!1;else if(!e._ratio){const i=this.util.getNumber(t,0),l=this.util.getNumber(n,0);e._ratio=!0,e._ratioX=i/l,e._ratioY=l/i}}else e._ratio=!1},_module_sizeRevert:function(e){e._onlyPercentage?e.inputX.value=e._origin_w>100?100:e._origin_w:(e.inputX.value=e._origin_w,e.inputY.value=e._origin_h)},_module_saveCurrentSize:function(e){const t=this.plugins.resizing._module_getSizeX.call(this,e),n=this.plugins.resizing._module_getSizeY.call(this,e);e._element.setAttribute("data-size",t+","+n),e._videoRatio&&(e._videoRatio=n)},call_controller_resize:function(e,t){const n=this.context.resizing,i=this.context[t];n._resize_plugin=t;const l=n.resizeContainer,o=n.resizeDiv,s=this.util.getOffset(e,this.context.element.wysiwygFrame),a=n._rotateVertical=/^(90|270)$/.test(Math.abs(e.getAttribute("data-rotate")).toString()),r=a?e.offsetHeight:e.offsetWidth,c=a?e.offsetWidth:e.offsetHeight,d=s.top,u=s.left-this.context.element.wysiwygFrame.scrollLeft;l.style.top=d+"px",l.style.left=u+"px",l.style.width=r+"px",l.style.height=c+"px",o.style.top="0px",o.style.left="0px",o.style.width=r+"px",o.style.height=c+"px";let h=e.getAttribute("data-align")||"basic";h="none"===h?"basic":h;const g=this.util.getParentElement(e,this.util.isComponent),p=this.util.getParentElement(e,"FIGURE"),m=this.plugins.resizing._module_getSizeX.call(this,i,e,p,g)||"auto",f=i._onlyPercentage&&"image"===t?"":", "+(this.plugins.resizing._module_getSizeY.call(this,i,e,p,g)||"auto");this.util.changeTxt(n.resizeDisplay,this.lang.dialogBox[h]+" ("+m+f+")"),n.resizeButtonGroup.style.display=i._resizing?"":"none";const _=!i._resizing||i._resizeDotHide||i._onlyPercentage?"none":"flex",b=n.resizeHandles;for(let e=0,t=b.length;e=360?0:d;s.setAttribute("data-rotate",u),c._rotateVertical=/^(90|270)$/.test(this._w.Math.abs(u).toString()),this.plugins.resizing.setTransformSize.call(this,s,null,null),this.selectComponent(s,l);break;case"onalign":return void this.plugins.resizing.openAlignMenu.call(this);case"align":const h="basic"===i?"none":i;a.setAlign.call(this,h,null,null,null),this.selectComponent(s,l);break;case"caption":const g=!o._captionChecked;if(a.openModify.call(this,!0),o._captionChecked=o.captionCheckEl.checked=g,a.update_image.call(this,!1,!1,!1),g){const e=this.util.getChildElement(o._caption,(function(e){return 3===e.nodeType}));e?this.setRange(e,0,e,e.textContent.length):o._caption.focus(),this.controllersOff()}else this.selectComponent(s,l),a.openModify.call(this,!0);break;case"revert":a.setOriginSize.call(this),this.selectComponent(s,l);break;case"update":a.openModify.call(this),this.controllersOff();break;case"delete":a.destroy.call(this)}this.history.push(!1)}},resetTransform:function(e){const t=(e.getAttribute("data-size")||e.getAttribute("data-origin")||"").split(",");this.context.resizing._rotateVertical=!1,e.style.maxWidth="",e.style.transform="",e.style.transformOrigin="",e.setAttribute("data-rotate",""),e.setAttribute("data-rotateX",""),e.setAttribute("data-rotateY",""),this.plugins[this.context.resizing._resize_plugin].setSize.call(this,t[0]?t[0]:"auto",t[1]?t[1]:"",!0)},setTransformSize:function(e,t,n){let i=e.getAttribute("data-percentage");const l=this.context.resizing._rotateVertical,o=1*e.getAttribute("data-rotate");let s="";if(i&&!l)i=i.split(","),"auto"===i[0]&&"auto"===i[1]?this.plugins[this.context.resizing._resize_plugin].setAutoSize.call(this):this.plugins[this.context.resizing._resize_plugin].setPercentSize.call(this,i[0],i[1]);else{const i=this.util.getParentElement(e,"FIGURE"),a=t||e.offsetWidth,r=n||e.offsetHeight,c=(l?r:a)+"px",d=(l?a:r)+"px";if(this.plugins[this.context.resizing._resize_plugin].cancelPercentAttr.call(this),this.plugins[this.context.resizing._resize_plugin].setSize.call(this,a+"px",r+"px",!0),i.style.width=c,i.style.height=this.context[this.context.resizing._resize_plugin]._caption?"":d,l){let e=a/2+"px "+a/2+"px 0",t=r/2+"px "+r/2+"px 0";s=90===o||-270===o?t:e}}e.style.transformOrigin=s,this.plugins.resizing._setTransForm(e,o.toString(),e.getAttribute("data-rotateX")||"",e.getAttribute("data-rotateY")||""),e.style.maxWidth=l?"none":"",this.plugins.resizing.setCaptionPosition.call(this,e)},_setTransForm:function(e,t,n,i){let l=(e.offsetWidth-e.offsetHeight)*(/-/.test(t)?1:-1),o="";if(/[1-9]/.test(t)&&(n||i))switch(o=n?"Y":"X",t){case"90":o=n&&i?"X":i?o:"";break;case"270":l*=-1,o=n&&i?"Y":n?o:"";break;case"-90":o=n&&i?"Y":n?o:"";break;case"-270":l*=-1,o=n&&i?"X":i?o:"";break;default:o=""}t%180==0&&(e.style.maxWidth=""),e.style.transform="rotate("+t+"deg)"+(n?" rotateX("+n+"deg)":"")+(i?" rotateY("+i+"deg)":"")+(o?" translate"+o+"("+l+"px)":"")},setCaptionPosition:function(e){const t=this.util.getChildElement(this.util.getParentElement(e,"FIGURE"),"FIGCAPTION");t&&(t.style.marginTop=(this.context.resizing._rotateVertical?e.offsetWidth-e.offsetHeight:0)+"px")},onMouseDown_resize_handle:function(e){e.stopPropagation(),e.preventDefault();const t=this.context.resizing,n=t._resize_direction=e.target.classList[0];t._resizeClientX=e.clientX,t._resizeClientY=e.clientY,this.context.element.resizeBackground.style.display="block",t.resizeButton.style.display="none",t.resizeDiv.style.float=/l/.test(n)?"right":/r/.test(n)?"left":"none";const i=function(e){if("keydown"===e.type&&27!==e.keyCode)return;const o=t._isChange;t._isChange=!1,this.removeDocEvent("mousemove",l),this.removeDocEvent("mouseup",i),this.removeDocEvent("keydown",i),"keydown"===e.type?(this.controllersOff(),this.context.element.resizeBackground.style.display="none",this.plugins[this.context.resizing._resize_plugin].init.call(this)):(this.plugins.resizing.cancel_controller_resize.call(this,n),o&&this.history.push(!1))}.bind(this),l=this.plugins.resizing.resizing_element.bind(this,t,n,this.context[t._resize_plugin]);this.addDocEvent("mousemove",l),this.addDocEvent("mouseup",i),this.addDocEvent("keydown",i)},resizing_element:function(e,t,n,i){const l=i.clientX,o=i.clientY;let s=n._element_w,a=n._element_h;const r=n._element_w+(/r/.test(t)?l-e._resizeClientX:e._resizeClientX-l),c=n._element_h+(/b/.test(t)?o-e._resizeClientY:e._resizeClientY-o),d=n._element_h/n._element_w*r;/t/.test(t)&&(e.resizeDiv.style.top=n._element_h-(/h/.test(t)?c:d)+"px"),/l/.test(t)&&(e.resizeDiv.style.left=n._element_w-r+"px"),/r|l/.test(t)&&(e.resizeDiv.style.width=r+"px",s=r),/^(t|b)[^h]$/.test(t)?(e.resizeDiv.style.height=d+"px",a=d):/^(t|b)h$/.test(t)&&(e.resizeDiv.style.height=c+"px",a=c),e._resize_w=s,e._resize_h=a,this.util.changeTxt(e.resizeDisplay,this._w.Math.round(s)+" x "+this._w.Math.round(a)),e._isChange=!0},cancel_controller_resize:function(e){const t=this.context.resizing._rotateVertical;this.controllersOff(),this.context.element.resizeBackground.style.display="none";let n=this._w.Math.round(t?this.context.resizing._resize_h:this.context.resizing._resize_w),i=this._w.Math.round(t?this.context.resizing._resize_w:this.context.resizing._resize_h);if(!t&&!/%$/.test(n)){const e=16,t=this.context.element.wysiwygFrame.clientWidth-2*e-2;this.util.getNumber(n,0)>t&&(i=this._w.Math.round(i/n*t),n=t)}const l=this.context.resizing._resize_plugin;this.plugins[l].setSize.call(this,n,i,!1,e),this.selectComponent(this.context[l]._element,l)}};return void 0===t&&(e.SUNEDITOR_MODULES||Object.defineProperty(e,"SUNEDITOR_MODULES",{enumerable:!0,writable:!1,configurable:!1,value:{}}),Object.defineProperty(e.SUNEDITOR_MODULES,"resizing",{enumerable:!0,writable:!1,configurable:!1,value:n})),n},"object"==typeof e.exports?e.exports=i.document?l(i,!0):function(e){if(!e.document)throw new Error("SUNEDITOR_MODULES a window with a document");return l(e)}:l(i)},"gjS+":function(e,t,n){"use strict";var i,l;i="undefined"!=typeof window?window:this,l=function(e,t){const n={name:"fileManager",_xmlHttp:null,upload:function(e,t,n,i,l){this.showLoading();const o=this.plugins.fileManager,s=o._xmlHttp=this.util.getXMLHttpRequest();if(s.onreadystatechange=o._callBackUpload.bind(this,s,i,l),s.open("post",e,!0),null!==t&&"object"==typeof t&&this._w.Object.keys(t).length>0)for(let e in t)s.setRequestHeader(e,t[e]);s.send(n)},_callBackUpload:function(e,t,n){if(4===e.readyState)if(200===e.status)try{t(e)}catch(e){throw Error('[SUNEDITOR.fileManager.upload.callBack.fail] cause : "'+e.message+'"')}finally{this.closeLoading()}else{this.closeLoading();const t=e.responseText?JSON.parse(e.responseText):e;if("function"!=typeof n||n("",t,this)){const n="[SUNEDITOR.fileManager.upload.serverException] status: "+e.status+", response: "+(t.errorMessage||e.responseText);throw this.functions.noticeOpen(n),Error(n)}}},checkInfo:function(e,t,n,i,l){let o=[];for(let e=0,n=t.length;e-1||(a.splice(t,1),"function"==typeof n&&n(null,e,"delete",null,0,this),t--);l&&(this.context.resizing._resize_plugin=c)},setInfo:function(e,t,n,i,l){const o=l?this.context.resizing._resize_plugin:"";l&&(this.context.resizing._resize_plugin=e);const s=this.plugins[e],a=this.context[e],r=a._infoList;let c=t.getAttribute("data-index"),d=null,u="";if(i||(i={name:t.getAttribute("data-file-name")||("string"==typeof t.src?t.src.split("/").pop():""),size:t.getAttribute("data-file-size")||0}),!c||this._componentsInfoInit)u="create",c=a._infoIndex++,t.setAttribute("data-index",c),t.setAttribute("data-file-name",i.name),t.setAttribute("data-file-size",i.size),d={src:t.src,index:1*c,name:i.name,size:i.size},r.push(d);else{u="update",c*=1;for(let e=0,t=r.length;e=0){const i=this.context[e]._infoList;for(let e=0,l=i.length;e
    '},_onMouseDown_browser:function(e){/se-file-browser-inner/.test(e.target.className)?this.context.fileBrowser._closeSignal=!0:this.context.fileBrowser._closeSignal=!1},_onClick_browser:function(e){e.stopPropagation(),(/close/.test(e.target.getAttribute("data-command"))||this.context.fileBrowser._closeSignal)&&this.plugins.fileBrowser.close.call(this)},open:function(e,t){this.plugins.fileBrowser._bindClose&&(this._d.removeEventListener("keydown",this.plugins.fileBrowser._bindClose),this.plugins.fileBrowser._bindClose=null),this.plugins.fileBrowser._bindClose=function(e){/27/.test(e.keyCode)&&this.plugins.fileBrowser.close.call(this)}.bind(this),this._d.addEventListener("keydown",this.plugins.fileBrowser._bindClose);const n=this.context.fileBrowser;n.contextPlugin=e,n.selectorHandler=t;const i=this.context[e],l=i.listClass;this.util.hasClass(n.list,l)||(n.list.className="se-file-browser-list "+l),"full"===this.context.option.popupDisplay?n.area.style.position="fixed":n.area.style.position="absolute",n.titleArea.textContent=i.title,n.area.style.display="block",this.plugins.fileBrowser._drawFileList.call(this,this.context[e].url)},_bindClose:null,close:function(){const e=this.plugins.fileBrowser;e._xmlHttp&&e._xmlHttp.abort(),e._bindClose&&(this._d.removeEventListener("keydown",e._bindClose),e._bindClose=null);const t=this.context.fileBrowser;t.area.style.display="none",t.selectorHandler=null,t.selectedTags=[],t.items=[],t.list.innerHTML=t.tagArea.innerHTML=t.titleArea.textContent="","function"==typeof this.plugins[t.contextPlugin].init&&this.plugins[t.contextPlugin].init.call(this),t.contextPlugin=""},showBrowserLoading:function(){this._loading.style.display="block"},closeBrowserLoading:function(){this._loading.style.display="none"},_drawFileList:function(e){const t=this.plugins.fileBrowser,n=t._xmlHttp=this.util.getXMLHttpRequest();n.onreadystatechange=t._callBackGet.bind(this,n),n.open("get",e,!0),n.send(null),this.plugins.fileBrowser.showBrowserLoading()},_callBackGet:function(e){if(4===e.readyState)if(this.plugins.fileBrowser._xmlHttp=null,200===e.status)try{this.plugins.fileBrowser._drawListItem.call(this,JSON.parse(e.responseText).result,!0)}catch(e){throw Error('[SUNEDITOR.fileBrowser.drawList.fail] cause : "'+e.message+'"')}finally{this.plugins.fileBrowser.closeBrowserLoading(),this.context.fileBrowser.body.style.maxHeight=this._w.innerHeight-this.context.fileBrowser.header.offsetHeight-50+"px"}else if(this.plugins.fileBrowser.closeBrowserLoading(),0!==e.status){const t=e.responseText?JSON.parse(e.responseText):e,n="[SUNEDITOR.fileBrowser.get.serverException] status: "+e.status+", response: "+(t.errorMessage||e.responseText);throw Error(n)}},_drawListItem:function(e,t){const n=this.context.fileBrowser,i=this.context[n.contextPlugin],l=[],o=e.length,s=i.columnSize||n.columnSize,a=s<=1?1:Math.round(o/s)||1,r=i.itemTemplateHandler;let c="",d='
    ',u=1;for(let n,i,h=0;h
    '),t&&i.length>0)for(let e,t=0,n=i.length;t'+e+"");d+="
    ",n.list.innerHTML=d,t&&(n.items=e,n.tagArea.innerHTML=c,n.tagElements=n.tagArea.querySelectorAll("A"))},onClickTag:function(e){const t=e.target;if(!this.util.isAnchor(t))return;const n=t.textContent,i=this.plugins.fileBrowser,l=this.context.fileBrowser,o=l.tagArea.querySelector('a[title="'+n+'"]'),s=l.selectedTags,a=s.indexOf(n);a>-1?(s.splice(a,1),this.util.removeClass(o,"on")):(s.push(n),this.util.addClass(o,"on")),i._drawListItem.call(this,0===s.length?l.items:l.items.filter((function(e){return e.tag.some((function(e){return s.indexOf(e)>-1}))})),!1)},onClickFile:function(e){e.preventDefault(),e.stopPropagation();const t=this.context.fileBrowser,n=t.list;let i=e.target,l=null;if(i===n)return;for(;n!==i.parentNode&&(l=i.getAttribute("data-command"),!l);)i=i.parentNode;if(!l)return;const o=t.selectorHandler||this.context[t.contextPlugin].selectorHandler;this.plugins.fileBrowser.close.call(this),o(i)}};return void 0===t&&(e.SUNEDITOR_MODULES||Object.defineProperty(e,"SUNEDITOR_MODULES",{enumerable:!0,writable:!1,configurable:!1,value:{}}),Object.defineProperty(e.SUNEDITOR_MODULES,"fileBrowser",{enumerable:!0,writable:!1,configurable:!1,value:n})),n},"object"==typeof e.exports?e.exports=i.document?l(i,!0):function(e){if(!e.document)throw new Error("SUNEDITOR_MODULES a window with a document");return l(e)}:l(i)},P6u4:function(e,t,n){"use strict";var i,l;i="undefined"!=typeof window?window:this,l=function(e,t){const n={code:"en",toolbar:{default:"Default",save:"Save",font:"Font",formats:"Formats",fontSize:"Size",bold:"Bold",underline:"Underline",italic:"Italic",strike:"Strike",subscript:"Subscript",superscript:"Superscript",removeFormat:"Remove Format",fontColor:"Font Color",hiliteColor:"Highlight Color",indent:"Indent",outdent:"Outdent",align:"Align",alignLeft:"Align left",alignRight:"Align right",alignCenter:"Align center",alignJustify:"Align justify",list:"List",orderList:"Ordered list",unorderList:"Unordered list",horizontalRule:"Horizontal line",hr_solid:"Solid",hr_dotted:"Dotted",hr_dashed:"Dashed",table:"Table",link:"Link",math:"Math",image:"Image",video:"Video",audio:"Audio",fullScreen:"Full screen",showBlocks:"Show blocks",codeView:"Code view",undo:"Undo",redo:"Redo",preview:"Preview",print:"print",tag_p:"Paragraph",tag_div:"Normal (DIV)",tag_h:"Header",tag_blockquote:"Quote",tag_pre:"Code",template:"Template",lineHeight:"Line height",paragraphStyle:"Paragraph style",textStyle:"Text style",imageGallery:"Image gallery"},dialogBox:{linkBox:{title:"Insert Link",url:"URL to link",text:"Text to display",newWindowCheck:"Open in new window"},mathBox:{title:"Math",inputLabel:"Mathematical Notation",fontSizeLabel:"Font Size",previewLabel:"Preview"},imageBox:{title:"Insert image",file:"Select from files",url:"Image URL",altText:"Alternative text"},videoBox:{title:"Insert Video",file:"Select from files",url:"Media embed URL, YouTube/Vimeo"},audioBox:{title:"Insert Audio",file:"Select from files",url:"Audio URL"},browser:{tags:"Tags",search:"Search"},mentionBox:{title:"Add Mention"},caption:"Insert description",close:"Close",submitButton:"Submit",revertButton:"Revert",proportion:"Constrain proportions",basic:"Basic",left:"Left",right:"Right",center:"Center",width:"Width",height:"Height",size:"Size",ratio:"Ratio"},controller:{edit:"Edit",unlink:"Unlink",remove:"Remove",insertRowAbove:"Insert row above",insertRowBelow:"Insert row below",deleteRow:"Delete row",insertColumnBefore:"Insert column before",insertColumnAfter:"Insert column after",deleteColumn:"Delete column",fixedColumnWidth:"Fixed column width",resize100:"Resize 100%",resize75:"Resize 75%",resize50:"Resize 50%",resize25:"Resize 25%",autoSize:"Auto size",mirrorHorizontal:"Mirror, Horizontal",mirrorVertical:"Mirror, Vertical",rotateLeft:"Rotate left",rotateRight:"Rotate right",maxSize:"Max size",minSize:"Min size",tableHeader:"Table header",mergeCells:"Merge cells",splitCells:"Split Cells",HorizontalSplit:"Horizontal split",VerticalSplit:"Vertical split"},menu:{spaced:"Spaced",bordered:"Bordered",neon:"Neon",translucent:"Translucent",shadow:"Shadow",code:"Code"}};return void 0===t&&(e.SUNEDITOR_LANG||Object.defineProperty(e,"SUNEDITOR_LANG",{enumerable:!0,writable:!1,configurable:!1,value:{}}),Object.defineProperty(e.SUNEDITOR_LANG,"en",{enumerable:!0,writable:!0,configurable:!0,value:n})),n},"object"==typeof e.exports?e.exports=i.document?l(i,!0):function(e){if(!e.document)throw new Error("SUNEDITOR_LANG a window with a document");return l(e)}:l(i)},WUQj:function(e,t,n){},XJR1:function(e,t,n){"use strict";n.r(t);n("3FqI"),n("WUQj");var i={name:"colorPicker",add:function(e){const t=e.context;t.colorPicker={colorListHTML:"",_colorInput:"",_defaultColor:"#000",_styleProperty:"color",_currentColor:"",_colorList:[]};let n=this.createColorList(e,this._makeColorList);t.colorPicker.colorListHTML=n,n=null},createColorList:function(e,t){const n=e.context.option,i=e.lang,l=n.colorList&&0!==n.colorList.length?n.colorList:["#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"];let o=[],s='
    ';for(let e,n=0,i=l.length;n0&&(s+='
    '+t(o)+"
    ",o=[]),"object"==typeof e&&(s+='
    '+t(e)+"
    ")));return s+='
    ",s},_makeColorList:function(e){let t="";t+='
      ';for(let n,i=0,l=e.length;i');return t+="
    ",t},init:function(e,t){const n=this.plugins.colorPicker;let i=t||(n.getColorInNode.call(this,e)||this.context.colorPicker._defaultColor);i=n.isHexColor(i)?i:n.rgb2hex(i)||i;const l=this.context.colorPicker._colorList;if(l)for(let e=0,t=l.length;e=3&&"#"+((1<<24)+(n[0]<<16)+(n[1]<<8)+n[2]).toString(16).substr(1)}},l={name:"fontColor",display:"submenu",add:function(e,t){e.addModule([i]);const n=e.context;n.fontColor={previewEl:null,colorInput:null,colorList:null};let l=this.setSubmenu.call(e);n.fontColor.colorInput=l.querySelector("._se_color_picker_input"),n.fontColor.colorInput.addEventListener("keyup",this.onChangeInput.bind(e)),l.querySelector("._se_color_picker_submit").addEventListener("click",this.submit.bind(e)),l.querySelector("._se_color_picker_remove").addEventListener("click",this.remove.bind(e)),l.addEventListener("click",this.pickup.bind(e)),n.fontColor.colorList=l.querySelectorAll("li button"),e.initMenuTarget(this.name,t,l),l=null},setSubmenu:function(){const e=this.context.colorPicker.colorListHTML,t=this.util.createElement("DIV");return t.className="se-submenu se-list-layer",t.innerHTML=e,t},on:function(){const e=this.context.colorPicker,t=this.context.fontColor;e._colorInput=t.colorInput,e._defaultColor="#333333",e._styleProperty="color",e._colorList=t.colorList,this.plugins.colorPicker.init.call(this,this.getSelectionNode(),null)},onChangeInput:function(e){this.plugins.colorPicker.setCurrentColor.call(this,e.target.value)},submit:function(){this.plugins.fontColor.applyColor.call(this,this.context.colorPicker._currentColor)},pickup:function(e){e.preventDefault(),e.stopPropagation(),this.plugins.fontColor.applyColor.call(this,e.target.getAttribute("data-value"))},remove:function(){this.nodeChange(null,["color"],["span"],!0),this.submenuOff()},applyColor:function(e){if(!e)return;const t=this.util.createElement("SPAN");t.style.color=e,this.nodeChange(t,["color"],null,null),this.submenuOff()}},o={name:"hiliteColor",display:"submenu",add:function(e,t){e.addModule([i]);const n=e.context;n.hiliteColor={previewEl:null,colorInput:null,colorList:null};let l=this.setSubmenu.call(e);n.hiliteColor.colorInput=l.querySelector("._se_color_picker_input"),n.hiliteColor.colorInput.addEventListener("keyup",this.onChangeInput.bind(e)),l.querySelector("._se_color_picker_submit").addEventListener("click",this.submit.bind(e)),l.querySelector("._se_color_picker_remove").addEventListener("click",this.remove.bind(e)),l.addEventListener("click",this.pickup.bind(e)),n.hiliteColor.colorList=l.querySelectorAll("li button"),e.initMenuTarget(this.name,t,l),l=null},setSubmenu:function(){const e=this.context.colorPicker.colorListHTML,t=this.util.createElement("DIV");return t.className="se-submenu se-list-layer",t.innerHTML=e,t},on:function(){const e=this.context.colorPicker,t=this.context.hiliteColor;e._colorInput=t.colorInput,e._defaultColor="#FFFFFF",e._styleProperty="backgroundColor",e._colorList=t.colorList,this.plugins.colorPicker.init.call(this,this.getSelectionNode(),null)},onChangeInput:function(e){this.plugins.colorPicker.setCurrentColor.call(this,e.target.value)},submit:function(){this.plugins.hiliteColor.applyColor.call(this,this.context.colorPicker._currentColor)},pickup:function(e){e.preventDefault(),e.stopPropagation(),this.plugins.hiliteColor.applyColor.call(this,e.target.getAttribute("data-value"))},remove:function(){this.nodeChange(null,["background-color"],["span"],!0),this.submenuOff()},applyColor:function(e){if(!e)return;const t=this.util.createElement("SPAN");t.style.backgroundColor=e,this.nodeChange(t,["background-color"],null,null),this.submenuOff()}},s={name:"template",display:"submenu",add:function(e,t){e.context.template={};let n=this.setSubmenu.call(e);n.querySelector("ul").addEventListener("click",this.pickup.bind(e)),e.initMenuTarget(this.name,t,n),n=null},setSubmenu:function(){const e=this.context.option.templates;if(!e||0===e.length)throw Error('[SUNEDITOR.plugins.template.fail] To use the "template" plugin, please define the "templates" option.');const t=this.util.createElement("DIV");t.className="se-list-layer";let n='
      ';for(let t,i=0,l=e.length;i";return n+="
    ",t.innerHTML=n,t},pickup:function(e){if(!/^BUTTON$/i.test(e.target.tagName))return!1;e.preventDefault(),e.stopPropagation();const t=this.context.option.templates[e.target.getAttribute("data-value")];if(!t.html)throw this.submenuOff(),Error('[SUNEDITOR.template.fail] cause : "templates[i].html not found"');this.setContents(t.html),this.submenuOff()}},a=n("1kvd"),r=n.n(a),c={name:"link",display:"dialog",add:function(e){e.addModule([r.a]);const t=e.context;t.link={focusElement:null,linkNewWindowCheck:null,linkAnchorText:null,_linkAnchor:null,_linkValue:""};let n=this.setDialog.call(e);t.link.modal=n,t.link.focusElement=n.querySelector("._se_link_url"),t.link.linkAnchorText=n.querySelector("._se_link_text"),t.link.linkNewWindowCheck=n.querySelector("._se_link_check"),t.link.preview=n.querySelector(".se-link-preview");let i=this.setController_LinkButton.call(e);t.link.linkController=i,t.link._linkAnchor=null,i.addEventListener("mousedown",e.eventStop),n.querySelector(".se-btn-primary").addEventListener("click",this.submit.bind(e)),i.addEventListener("click",this.onClick_linkController.bind(e)),t.link.focusElement.addEventListener("input",this._onLinkPreview.bind(t.link.preview,t.link,t.options.linkProtocol)),t.dialog.modal.appendChild(n),t.element.relative.appendChild(i),n=null,i=null},setDialog:function(){const e=this.lang,t=this.util.createElement("DIV");return t.className="se-dialog-content",t.style.display="none",t.innerHTML='",t},setController_LinkButton:function(){const e=this.lang,t=this.icons,n=this.util.createElement("DIV");return n.className="se-controller se-controller-link",n.innerHTML='
    ",n},open:function(){this.plugins.dialog.open.call(this,"link","link"===this.currentControllerName)},_onLinkPreview:function(e,t,n){const i=n.target.value.trim();e._linkValue=this.textContent=i?t&&-1===i.indexOf("://")&&0!==i.indexOf("#")?t+i:-1===i.indexOf("://")?"/"+i:i:""},submit:function(e){this.showLoading(),e.preventDefault(),e.stopPropagation();const t=function(){const e=this.context.link;if(0===e._linkValue.length)return!1;const t=e._linkValue,n=e.linkAnchorText,i=0===n.value.length?t:n.value;if(this.context.dialog.updateModal){e._linkAnchor.href=t,e._linkAnchor.textContent=i,e._linkAnchor.target=e.linkNewWindowCheck.checked?"_blank":"";const n=e._linkAnchor.childNodes[0];this.setRange(n,0,n,n.textContent.length)}else{const n=this.util.createElement("A");n.href=t,n.textContent=i,n.target=e.linkNewWindowCheck.checked?"_blank":"";const l=this.getSelectedElements();if(l.length>1){const e=this.util.createElement(l[0].nodeName);if(e.appendChild(n),!this.insertNode(e,null,!0))return}else if(!this.insertNode(n,null,!0))return;this.setRange(n.childNodes[0],0,n.childNodes[0],n.textContent.length)}e._linkValue=e.preview.textContent=e.focusElement.value=e.linkAnchorText.value=""}.bind(this);try{t()}finally{this.plugins.dialog.close.call(this),this.closeLoading(),this.history.push(!1)}return!1},active:function(e){if(e){if(this.util.isAnchor(e)&&null===e.getAttribute("data-image-link"))return this.controllerArray.indexOf(this.context.link.linkController)<0&&this.plugins.link.call_controller.call(this,e),!0}else this.controllerArray.indexOf(this.context.link.linkController)>-1&&this.controllersOff();return!1},on:function(e){const t=this.context.link;e?t._linkAnchor&&(this.context.dialog.updateModal=!0,t._linkValue=t.preview.textContent=t.focusElement.value=t._linkAnchor.href,t.linkAnchorText.value=t._linkAnchor.textContent,t.linkNewWindowCheck.checked=!!/_blank/i.test(t._linkAnchor.target)):(this.plugins.link.init.call(this),t.linkAnchorText.value=this.getSelection().toString())},call_controller:function(e){this.editLink=this.context.link._linkAnchor=e;const t=this.context.link.linkController,n=t.querySelector("a");n.href=e.href,n.title=e.textContent,n.textContent=e.textContent;const i=this.util.getOffset(e,this.context.element.wysiwygFrame);t.style.top=i.top+e.offsetHeight+10+"px",t.style.left=i.left-this.context.element.wysiwygFrame.scrollLeft+"px",t.style.display="block";const l=this.context.element.wysiwygFrame.offsetWidth-(t.offsetLeft+t.offsetWidth);l<0?(t.style.left=t.offsetLeft+l+"px",t.firstElementChild.style.left=20-l+"px"):t.firstElementChild.style.left="20px",this.controllersOn(t,e,"link")},onClick_linkController:function(e){e.stopPropagation();const t=e.target.getAttribute("data-command")||e.target.parentNode.getAttribute("data-command");if(t){if(e.preventDefault(),/update/.test(t)){const e=this.context.link;e._linkValue=e.preview.textContent=e.focusElement.value=e._linkAnchor.href,e.linkAnchorText.value=e._linkAnchor.textContent,e.linkNewWindowCheck.checked=!!/_blank/i.test(e._linkAnchor.target),this.plugins.dialog.open.call(this,"link",!0)}else if(/unlink/.test(t)){const e=this.util.getChildElement(this.context.link._linkAnchor,(function(e){return 0===e.childNodes.length||3===e.nodeType}),!1),t=this.util.getChildElement(this.context.link._linkAnchor,(function(e){return 0===e.childNodes.length||3===e.nodeType}),!0);this.setRange(e,0,t,t.textContent.length),this.nodeChange(null,null,["A"],!1)}else this.util.removeItem(this.context.link._linkAnchor),this.context.link._linkAnchor=null,this.focus(),this.history.push(!1);this.controllersOff()}},init:function(){const e=this.context.link;e.linkController.style.display="none",e._linkAnchor=null,e._linkValue=e.preview.textContent=e.focusElement.value="",e.linkAnchorText.value="",e.linkNewWindowCheck.checked=!1}},d=n("ZED3"),u=n.n(d),h=n("ee5k"),g=n.n(h),p=n("gjS+"),m=n.n(p),f={name:"image",display:"dialog",add:function(e){e.addModule([r.a,u.a,g.a,m.a]);const t=e.context,n=t.image={_infoList:[],_infoIndex:0,_uploadFileLength:0,sizeUnit:t.option._imageSizeUnit,_altText:"",_linkElement:null,_align:"none",_floatClassRegExp:"__se__float\\-[a-z]+",_v_link:{_linkValue:""},_v_src:{_linkValue:""},svgDefaultSize:"30%",_element:null,_cover:null,_container:null,inputX:null,inputY:null,_element_w:1,_element_h:1,_element_l:0,_element_t:0,_defaultSizeX:"auto",_defaultSizeY:"auto",_origin_w:"auto"===t.option.imageWidth?"":t.option.imageWidth,_origin_h:"auto"===t.option.imageHeight?"":t.option.imageHeight,_proportionChecked:!0,_resizing:t.option.imageResizing,_resizeDotHide:!t.option.imageHeightShow,_rotation:t.option.imageRotation,_onlyPercentage:t.option.imageSizeOnlyPercentage,_ratio:!1,_ratioX:1,_ratioY:1,_captionShow:!0,_captionChecked:!1,_caption:null,captionCheckEl:null};let i=this.setDialog.call(e);n.modal=i,n.imgInputFile=i.querySelector("._se_image_file"),n.imgUrlFile=i.querySelector(".se-input-url"),n.focusElement=n.imgInputFile||n.imgUrlFile,n.altText=i.querySelector("._se_image_alt"),n.imgLink=i.querySelector("._se_image_link"),n.imgLinkNewWindowCheck=i.querySelector("._se_image_link_check"),n.captionCheckEl=i.querySelector("._se_image_check_caption"),n.previewLink=i.querySelector("._se_tab_content_url .se-link-preview"),n.previewSrc=i.querySelector("._se_tab_content_image .se-link-preview"),i.querySelector(".se-dialog-tabs").addEventListener("click",this.openTab.bind(e)),i.querySelector(".se-btn-primary").addEventListener("click",this.submit.bind(e)),n.imgInputFile&&i.querySelector(".se-file-remove").addEventListener("click",this._removeSelectedFiles.bind(n.imgInputFile,n.imgUrlFile,n.previewSrc)),n.imgInputFile&&n.imgUrlFile&&n.imgInputFile.addEventListener("change",this._fileInputChange.bind(n)),n.imgLink.addEventListener("input",this._onLinkPreview.bind(n.previewLink,n._v_link,t.options.linkProtocol)),n.imgUrlFile&&n.imgUrlFile.addEventListener("input",this._onLinkPreview.bind(n.previewSrc,n._v_src,t.options.linkProtocol));const l=i.querySelector(".__se__gallery");l&&l.addEventListener("click",this._openGallery.bind(e)),n.proportion={},n.inputX={},n.inputY={},t.option.imageResizing&&(n.proportion=i.querySelector("._se_image_check_proportion"),n.inputX=i.querySelector("._se_image_size_x"),n.inputY=i.querySelector("._se_image_size_y"),n.inputX.value=t.option.imageWidth,n.inputY.value=t.option.imageHeight,n.inputX.addEventListener("keyup",this.setInputSize.bind(e,"x")),n.inputY.addEventListener("keyup",this.setInputSize.bind(e,"y")),n.inputX.addEventListener("change",this.setRatio.bind(e)),n.inputY.addEventListener("change",this.setRatio.bind(e)),n.proportion.addEventListener("change",this.setRatio.bind(e)),i.querySelector(".se-dialog-btn-revert").addEventListener("click",this.sizeRevert.bind(e))),t.dialog.modal.appendChild(i),i=null},setDialog:function(){const e=this.context.option,t=this.lang,n=this.util.createElement("DIV");n.className="se-dialog-content",n.style.display="none";let i='
    '+t.dialogBox.imageBox.title+'
    ';if(e.imageFileInput&&(i+='
    "),e.imageUrlInput&&(i+='
    '+(e.imageGalleryUrl&&this.plugins.imageGallery?'":"")+'
    '),i+='
    ',e.imageResizing){const n=e.imageSizeOnlyPercentage,l=n?' style="display: none !important;"':"",o=e.imageHeightShow?"":' style="display: none !important;"';i+='
    ',n||!e.imageHeightShow?i+='
    ":i+='
    ",i+=' '+t.dialogBox.proportion+'
    "}return i+='
    ",n.innerHTML=i,n},_fileInputChange:function(){this.imgInputFile.value?(this.imgUrlFile.setAttribute("disabled",!0),this.previewSrc.style.textDecoration="line-through"):(this.imgUrlFile.removeAttribute("disabled"),this.previewSrc.style.textDecoration="")},_removeSelectedFiles:function(e,t){this.value="",e&&(e.removeAttribute("disabled"),t.style.textDecoration="")},_openGallery:function(){this.callPlugin("imageGallery",this.plugins.imageGallery.open.bind(this,this.plugins.image._setUrlInput.bind(this.context.image)),null)},_setUrlInput:function(e){this.altText.value=e.alt,this._v_src._linkValue=this.previewSrc.textContent=this.imgUrlFile.value=e.src,this.imgUrlFile.focus()},_onLinkPreview:function(e,t,n){const i=n.target.value.trim();e._linkValue=this.textContent=i?t&&-1===i.indexOf("://")&&0!==i.indexOf("#")?t+i:-1===i.indexOf("://")?"/"+i:i:""},fileTags:["img"],select:function(e){this.plugins.image.onModifyMode.call(this,e,this.plugins.resizing.call_controller_resize.call(this,e,"image"))},destroy:function(e){const t=e||this.context.image._element,n=this.util.getParentElement(t,this.util.isMediaComponent)||t,i=1*t.getAttribute("data-index");let l=n.previousElementSibling||n.nextElementSibling;const o=n.parentNode;this.util.removeItem(n),this.plugins.image.init.call(this),this.controllersOff(),o!==this.context.element.wysiwyg&&this.util.removeItemAllParents(o,(function(e){return 0===e.childNodes.length}),null),this.focusEdge(l),this.plugins.fileManager.deleteInfo.call(this,"image",i,this.functions.onImageUpload),this.history.push(!1)},on:function(e){const t=this.context.image;e?t.imgInputFile&&this.context.options.imageMultipleFile&&t.imgInputFile.removeAttribute("multiple"):(t.inputX.value=t._origin_w=this.context.option.imageWidth===t._defaultSizeX?"":this.context.option.imageWidth,t.inputY.value=t._origin_h=this.context.option.imageHeight===t._defaultSizeY?"":this.context.option.imageHeight,t.imgInputFile&&this.context.options.imageMultipleFile&&t.imgInputFile.setAttribute("multiple","multiple"))},open:function(){this.plugins.dialog.open.call(this,"image","image"===this.currentControllerName)},openTab:function(e){const t=this.context.image.modal,n="init"===e?t.querySelector("._se_tab_link"):e.target;if(!/^BUTTON$/i.test(n.tagName))return!1;const i=n.getAttribute("data-tab-link");let l,o,s;for(o=t.getElementsByClassName("_se_tab_content"),l=0;l0?(this.showLoading(),n.submitAction.call(this,this.context.image.imgInputFile.files)):t.imgUrlFile&&t._v_src._linkValue.length>0&&(this.showLoading(),n.onRender_imgUrl.call(this))}catch(e){throw this.closeLoading(),Error('[SUNEDITOR.image.submit.fail] cause : "'+e.message+'"')}finally{this.plugins.dialog.close.call(this)}return!1},submitAction:function(e){if(0===e.length)return;let t=0,n=[];for(let i=0,l=e.length;i0){let e=0;const n=this.context.image._infoList;for(let t=0,i=n.length;ti){this.closeLoading();const n="[SUNEDITOR.imageUpload.fail] Size of uploadable total images: "+i/1e3+"KB";return void(("function"!==this.functions.onImageUploadError||this.functions.onImageUploadError(n,{limitSize:i,currentSize:e,uploadSize:t},this))&&this.functions.noticeOpen(n))}}const l=this.context.image;l._uploadFileLength=n.length;const o={linkValue:l._v_link._linkValue,linkNewWindow:l.imgLinkNewWindowCheck.checked,inputWidth:l.inputX.value,inputHeight:l.inputY.value,align:l._align,isUpdate:this.context.dialog.updateModal,element:l._element};if("function"==typeof this.functions.onImageUploadBefore){const e=this.functions.onImageUploadBefore(n,o,this,function(e){e&&this._w.Array.isArray(e.result)?this.plugins.image.register.call(this,o,e):this.plugins.image.upload.call(this,o,e)}.bind(this));if(void 0===e)return;if(!e)return void this.closeLoading();this._w.Array.isArray(e)&&e.length>0&&(n=e)}this.plugins.image.upload.call(this,o,n)},error:function(e,t){if(this.closeLoading(),"function"!=typeof this.functions.onImageUploadError||this.functions.onImageUploadError(e,t,this))throw this.functions.noticeOpen(e),Error("[SUNEDITOR.plugin.image.error] response: "+e)},upload:function(e,t){if(!t)return void this.closeLoading();if("string"==typeof t)return void this.plugins.image.error.call(this,t,null);const n=this.context.option.imageUploadUrl,i=this.context.dialog.updateModal?1:t.length;if("string"==typeof n&&n.length>0){const l=new FormData;for(let e=0;e0){const i=this.util.createElement("A");return i.href=/^https?:\/\//.test(t)?t:"http://"+t,i.target=n?"_blank":"",i.setAttribute("data-image-link","image"),e.setAttribute("data-image-link",t),i.appendChild(e),i}return e},setInputSize:function(e,t){t&&32===t.keyCode?t.preventDefault():this.plugins.resizing._module_setInputSize.call(this,this.context.image,e)},setRatio:function(){this.plugins.resizing._module_setRatio.call(this,this.context.image)},checkFileInfo:function(){const e=this.plugins.image,t=function(t){e.onModifyMode.call(this,t,null),e.openModify.call(this,!0),e.update_image.call(this,!0,!1,!0)}.bind(this);this.plugins.fileManager.checkInfo.call(this,"image",["img"],this.functions.onImageUpload,t,!0)},resetFileInfo:function(){this.plugins.fileManager.resetInfo.call(this,"image",this.functions.onImageUpload)},create_image:function(e,t,n,i,l,o,s){const a=this.plugins.image,r=this.context.image;this.context.resizing._resize_plugin="image";let c=this.util.createElement("IMG");c.src=e,c.alt=r._altText,c=a.onRender_link.call(this,c,t,n),c.setAttribute("data-rotate","0"),r._resizing&&c.setAttribute("data-proportion",r._proportionChecked);const d=this.plugins.component.set_cover.call(this,c),u=this.plugins.component.set_container.call(this,d,"se-image-container");r._captionChecked&&(r._caption=this.plugins.component.create_caption.call(this),r._caption.setAttribute("contenteditable",!1),d.appendChild(r._caption)),r._element=c,r._cover=d,r._container=u,a.applySize.call(this,i,l),a.setAlign.call(this,o,c,d,u),c.onload=a._image_create_onload.bind(this,c,r.svgDefaultSize),this.insertComponent(u,!0,!0,!0)&&this.plugins.fileManager.setInfo.call(this,"image",c,this.functions.onImageUpload,s,!0),this.context.resizing._resize_plugin=""},_image_create_onload:function(e,t){0===e.offsetWidth&&this.plugins.image.applySize.call(this,t,""),this.selectComponent.call(this,e,"image")},update_image:function(e,t,n){const i=this.context.image,l=i._v_link._linkValue;let o,s=i._element,a=i._cover,r=i._container,c=!1;null===a&&(c=!0,s=i._element.cloneNode(!0),a=this.plugins.component.set_cover.call(this,s)),null===r?(a=a.cloneNode(!0),s=a.querySelector("img"),c=!0,r=this.plugins.component.set_container.call(this,a,"se-image-container")):c&&(r.innerHTML="",r.appendChild(a),i._cover=a,i._element=s,c=!1);const d=this.util.isNumber(i.inputX.value)?i.inputX.value+i.sizeUnit:i.inputX.value,u=this.util.isNumber(i.inputY.value)?i.inputY.value+i.sizeUnit:i.inputY.value;o=/%$/.test(s.style.width)?d!==r.style.width||u!==r.style.height:d!==s.style.width||u!==s.style.height,s.alt=i._altText;let h=!1;if(i._captionChecked?i._caption||(i._caption=this.plugins.component.create_caption.call(this),a.appendChild(i._caption),h=!0):i._caption&&(this.util.removeItem(i._caption),i._caption=null,h=!0),l.trim().length>0)if(null!==i._linkElement&&a.contains(i._linkElement))i._linkElement.href=l,i._linkElement.target=i.imgLinkNewWindowCheck.checked?"_blank":"",s.setAttribute("data-image-link",l);else{let e=this.plugins.image.onRender_link.call(this,s,l,this.context.image.imgLinkNewWindowCheck.checked);a.insertBefore(e,i._caption)}else if(null!==i._linkElement){const e=s;e.setAttribute("data-image-link","");let t=e.cloneNode(!0);a.removeChild(i._linkElement),a.insertBefore(t,i._caption),s=t}if(c){const e=this.util.isRangeFormatElement(i._element.parentNode)||this.util.isWysiwygDiv(i._element.parentNode)?i._element:/^A$/i.test(i._element.parentNode.nodeName)?i._element.parentNode:this.util.getFormatElement(i._element)||i._element;e.parentNode.replaceChild(r,e),s=r.querySelector("img"),i._element=s,i._cover=a,i._container=r}(h||!i._onlyPercentage&&o)&&!e&&(/\d+/.test(s.style.height)||this.context.resizing._rotateVertical&&i._captionChecked)&&(/%$/.test(i.inputX.value)||/%$/.test(i.inputY.value)?this.plugins.resizing.resetTransform.call(this,s):this.plugins.resizing.setTransformSize.call(this,s,this.util.getNumber(i.inputX.value,0),this.util.getNumber(i.inputY.value,0)));i._resizing&&(s.setAttribute("data-proportion",i._proportionChecked),o&&this.plugins.image.applySize.call(this)),this.plugins.image.setAlign.call(this,null,s,null,null),e&&this.plugins.fileManager.setInfo.call(this,"image",s,this.functions.onImageUpload,null,!0),t&&this.selectComponent(s,"image"),n||this.history.push(!1)},update_src:function(e,t,n){t.src=e,this._w.setTimeout(this.plugins.fileManager.setInfo.bind(this,"image",t,this.functions.onImageUpload,n,!0)),this.selectComponent(t,"image")},onModifyMode:function(e,t){if(!e)return;const n=this.context.image;n._linkElement=/^A$/i.test(e.parentNode.nodeName)?e.parentNode:null,n._element=e,n._cover=this.util.getParentElement(e,"FIGURE"),n._container=this.util.getParentElement(e,this.util.isMediaComponent),n._caption=this.util.getChildElement(n._cover,"FIGCAPTION"),n._align=e.getAttribute("data-align")||"none",t&&(n._element_w=t.w,n._element_h=t.h,n._element_t=t.t,n._element_l=t.l);let i=n._element.getAttribute("data-size")||n._element.getAttribute("data-origin");i?(i=i.split(","),n._origin_w=i[0],n._origin_h=i[1]):t&&(n._origin_w=t.w,n._origin_h=t.h)},openModify:function(e){const t=this.context.image;t.imgUrlFile&&(t._v_src._linkValue=t.previewSrc.textContent=t.imgUrlFile.value=t._element.src),t._altText=t.altText.value=t._element.alt,t._v_link._linkValue=t.previewLink.textContent=t.imgLink.value=null===t._linkElement?"":t._linkElement.href,t.imgLinkNewWindowCheck.checked=t._linkElement&&"_blank"===t._linkElement.target,t.modal.querySelector('input[name="suneditor_image_radio"][value="'+t._align+'"]').checked=!0,t._align=t.modal.querySelector('input[name="suneditor_image_radio"]:checked').value,t._captionChecked=t.captionCheckEl.checked=!!t._caption,t._resizing&&this.plugins.resizing._module_setModifyInputSize.call(this,t,this.plugins.image),e||this.plugins.dialog.open.call(this,"image",!0)},sizeRevert:function(){this.plugins.resizing._module_sizeRevert.call(this,this.context.image)},applySize:function(e,t){const n=this.context.image;return e||(e=n.inputX.value||this.context.option.imageWidth),t||(t=n.inputY.value||this.context.option.imageHeight),n._onlyPercentage&&e||/%$/.test(e)?(this.plugins.image.setPercentSize.call(this,e,t),!0):(e&&"auto"!==e||t&&"auto"!==t?this.plugins.image.setSize.call(this,e,t,!1):this.plugins.image.setAutoSize.call(this),!1)},setSize:function(e,t,n,i){const l=this.context.image,o=/^(rw|lw)$/.test(i),s=/^(th|bh)$/.test(i);this.plugins.image.cancelPercentAttr.call(this),s||(l._element.style.width=this.util.isNumber(e)?e+l.sizeUnit:e),o||(l._element.style.height=this.util.isNumber(t)?t+l.sizeUnit:/%$/.test(t)?"":t),"center"===l._align&&this.plugins.image.setAlign.call(this,null,null,null,null),n||l._element.removeAttribute("data-percentage"),this.plugins.resizing._module_saveCurrentSize.call(this,l)},setAutoSize:function(){const e=this.context.image;this.plugins.resizing.resetTransform.call(this,e._element),this.plugins.image.cancelPercentAttr.call(this),e._element.style.maxWidth="",e._element.style.width="",e._element.style.height="",e._cover.style.width="",e._cover.style.height="",this.plugins.image.setAlign.call(this,null,null,null,null),e._element.setAttribute("data-percentage","auto,auto"),this.plugins.resizing._module_saveCurrentSize.call(this,e)},setOriginSize:function(){const e=this.context.image;e._element.removeAttribute("data-percentage"),this.plugins.resizing.resetTransform.call(this,e._element),this.plugins.image.cancelPercentAttr.call(this);const t=(e._element.getAttribute("data-origin")||"").split(","),n=t[0],i=t[1];t&&(e._onlyPercentage||/%$/.test(n)&&(/%$/.test(i)||!/\d/.test(i))?this.plugins.image.setPercentSize.call(this,n,i):this.plugins.image.setSize.call(this,n,i),this.plugins.resizing._module_saveCurrentSize.call(this,e))},setPercentSize:function(e,t){const n=this.context.image;t=!t||/%$/.test(t)||this.util.getNumber(t,0)?this.util.isNumber(t)?t+n.sizeUnit:t||"":this.util.isNumber(t)?t+"%":t;const i=/%$/.test(t);n._container.style.width=this.util.isNumber(e)?e+"%":e,n._container.style.height="",n._cover.style.width="100%",n._cover.style.height=i?t:"",n._element.style.width="100%",n._element.style.height=i?"":t,n._element.style.maxWidth="","center"===n._align&&this.plugins.image.setAlign.call(this,null,null,null,null),n._element.setAttribute("data-percentage",e+","+t),this.plugins.resizing.setCaptionPosition.call(this,n._element),this.plugins.resizing._module_saveCurrentSize.call(this,n)},cancelPercentAttr:function(){const e=this.context.image;e._cover.style.width="",e._cover.style.height="",e._container.style.width="",e._container.style.height="",this.util.removeClass(e._container,this.context.image._floatClassRegExp),this.util.addClass(e._container,"__se__float-"+e._align),"center"===e._align&&this.plugins.image.setAlign.call(this,null,null,null,null)},setAlign:function(e,t,n,i){const l=this.context.image;e||(e=l._align),t||(t=l._element),n||(n=l._cover),i||(i=l._container),n.style.margin=e&&"none"!==e?"auto":"0",/%$/.test(t.style.width)&&"center"===e?(i.style.minWidth="100%",n.style.width=i.style.width):(i.style.minWidth="",n.style.width=this.context.resizing._rotateVertical?t.style.height||t.offsetHeight:t.style.width&&"auto"!==t.style.width?t.style.width||"100%":""),this.util.hasClass(i,"__se__float-"+e)||(this.util.removeClass(i,l._floatClassRegExp),this.util.addClass(i,"__se__float-"+e)),t.setAttribute("data-align",e)},resetAlign:function(){const e=this.context.image;e._element.setAttribute("data-align",""),e._align="none",e._cover.style.margin="0",this.util.removeClass(e._container,e._floatClassRegExp)},init:function(){const e=this.context.image;e.imgInputFile&&(e.imgInputFile.value=""),e.imgUrlFile&&(e._v_src._linkValue=e.previewSrc.textContent=e.imgUrlFile.value=""),e.imgInputFile&&e.imgUrlFile&&(e.imgUrlFile.removeAttribute("disabled"),e.previewSrc.style.textDecoration=""),e.altText.value="",e._v_link._linkValue=e.previewLink.textContent=e.imgLink.value="",e.imgLinkNewWindowCheck.checked=!1,e.modal.querySelector('input[name="suneditor_image_radio"][value="none"]').checked=!0,e.captionCheckEl.checked=!1,e._element=null,this.plugins.image.openTab.call(this,"init"),e._resizing&&(e.inputX.value=this.context.option.imageWidth===e._defaultSizeX?"":this.context.option.imageWidth,e.inputY.value=this.context.option.imageHeight===e._defaultSizeY?"":this.context.option.imageHeight,e.proportion.checked=!0,e._ratio=!1,e._ratioX=1,e._ratioY=1)}},_={name:"video",display:"dialog",add:function(e){e.addModule([r.a,u.a,g.a,m.a]);const t=e.context,n=t.video={_infoList:[],_infoIndex:0,_uploadFileLength:0,sizeUnit:t.option._videoSizeUnit,_align:"none",_floatClassRegExp:"__se__float\\-[a-z]+",_youtubeQuery:t.option.youtubeQuery,_videoRatio:100*t.option.videoRatio+"%",_defaultRatio:100*t.option.videoRatio+"%",_linkValue:"",_element:null,_cover:null,_container:null,inputX:null,inputY:null,_element_w:1,_element_h:1,_element_l:0,_element_t:0,_defaultSizeX:"100%",_defaultSizeY:100*t.option.videoRatio+"%",_origin_w:"100%"===t.option.videoWidth?"":t.option.videoWidth,_origin_h:"56.25%"===t.option.videoHeight?"":t.option.videoHeight,_proportionChecked:!0,_resizing:t.option.videoResizing,_resizeDotHide:!t.option.videoHeightShow,_rotation:t.option.videoRotation,_onlyPercentage:t.option.videoSizeOnlyPercentage,_ratio:!1,_ratioX:1,_ratioY:1,_captionShow:!1};let i=this.setDialog.call(e);n.modal=i,n.videoInputFile=i.querySelector("._se_video_file"),n.videoUrlFile=i.querySelector(".se-input-url"),n.focusElement=n.videoUrlFile||n.videoInputFile,n.preview=i.querySelector(".se-link-preview"),i.querySelector(".se-btn-primary").addEventListener("click",this.submit.bind(e)),n.videoInputFile&&i.querySelector(".se-dialog-files-edge-button").addEventListener("click",this._removeSelectedFiles.bind(n.videoInputFile,n.videoUrlFile,n.preview)),n.videoInputFile&&n.videoUrlFile&&n.videoInputFile.addEventListener("change",this._fileInputChange.bind(n)),n.videoUrlFile&&n.videoUrlFile.addEventListener("input",this._onLinkPreview.bind(n.preview,n,t.options.linkProtocol)),n.proportion={},n.videoRatioOption={},n.inputX={},n.inputY={},t.option.videoResizing&&(n.proportion=i.querySelector("._se_video_check_proportion"),n.videoRatioOption=i.querySelector(".se-video-ratio"),n.inputX=i.querySelector("._se_video_size_x"),n.inputY=i.querySelector("._se_video_size_y"),n.inputX.value=t.option.videoWidth,n.inputY.value=t.option.videoHeight,n.inputX.addEventListener("keyup",this.setInputSize.bind(e,"x")),n.inputY.addEventListener("keyup",this.setInputSize.bind(e,"y")),n.inputX.addEventListener("change",this.setRatio.bind(e)),n.inputY.addEventListener("change",this.setRatio.bind(e)),n.proportion.addEventListener("change",this.setRatio.bind(e)),n.videoRatioOption.addEventListener("change",this.setVideoRatio.bind(e)),i.querySelector(".se-dialog-btn-revert").addEventListener("click",this.sizeRevert.bind(e))),t.dialog.modal.appendChild(i),i=null},setDialog:function(){const e=this.context.option,t=this.lang,n=this.util.createElement("DIV");n.className="se-dialog-content",n.style.display="none";let i='
    '+t.dialogBox.videoBox.title+'
    ';if(e.videoFileInput&&(i+='
    "),e.videoUrlInput&&(i+='
    '),e.videoResizing){const n=e.videoRatioList||[{name:"16:9",value:.5625},{name:"4:3",value:.75},{name:"21:9",value:.4285}],l=e.videoRatio,o=e.videoSizeOnlyPercentage,s=o?' style="display: none !important;"':"",a=e.videoHeightShow?"":' style="display: none !important;"',r=e.videoRatioShow?"":' style="display: none !important;"',c=o||e.videoHeightShow||e.videoRatioShow?"":' style="display: none !important;"';i+='
    "}return i+='
    ",n.innerHTML=i,n},_fileInputChange:function(){this.videoInputFile.value?(this.videoUrlFile.setAttribute("disabled",!0),this.preview.style.textDecoration="line-through"):(this.videoUrlFile.removeAttribute("disabled"),this.preview.style.textDecoration="")},_removeSelectedFiles:function(e,t){this.value="",e&&(e.removeAttribute("disabled"),t.style.textDecoration="")},_onLinkPreview:function(e,t,n){const i=n.target.value.trim();/^$/.test(i)?(e._linkValue=i,this.textContent=''):e._linkValue=this.textContent=i?t&&-1===i.indexOf("://")&&0!==i.indexOf("#")?t+i:-1===i.indexOf("://")?"/"+i:i:""},_setTagAttrs:function(e){e.setAttribute("controls",!0);const t=this.context.options.videoTagAttrs;if(t)for(let n in t)this.util.hasOwn(t,n)&&e.setAttribute(n,t[n])},createVideoTag:function(){const e=this.util.createElement("VIDEO");return this.plugins.video._setTagAttrs.call(this,e),e},_setIframeAttrs:function(e){e.frameBorder="0",e.allowFullscreen=!0;const t=this.context.options.videoIframeAttrs;if(t)for(let n in t)this.util.hasOwn(t,n)&&e.setAttribute(n,t[n])},createIframeTag:function(){const e=this.util.createElement("IFRAME");return this.plugins.video._setIframeAttrs.call(this,e),e},fileTags:["iframe","video"],select:function(e){this.plugins.video.onModifyMode.call(this,e,this.plugins.resizing.call_controller_resize.call(this,e,"video"))},destroy:function(e){const t=e||this.context.video._element,n=this.context.video._container,i=1*t.getAttribute("data-index");let l=n.previousElementSibling||n.nextElementSibling;const o=n.parentNode;this.util.removeItem(n),this.plugins.video.init.call(this),this.controllersOff(),o!==this.context.element.wysiwyg&&this.util.removeItemAllParents(o,(function(e){return 0===e.childNodes.length}),null),this.focusEdge(l),this.plugins.fileManager.deleteInfo.call(this,"video",i,this.functions.onVideoUpload),this.history.push(!1)},on:function(e){const t=this.context.video;e?t.videoInputFile&&this.context.options.videoMultipleFile&&t.videoInputFile.removeAttribute("multiple"):(t.inputX.value=t._origin_w=this.context.option.videoWidth===t._defaultSizeX?"":this.context.option.videoWidth,t.inputY.value=t._origin_h=this.context.option.videoHeight===t._defaultSizeY?"":this.context.option.videoHeight,t.proportion.disabled=!0,t.videoInputFile&&this.context.options.videoMultipleFile&&t.videoInputFile.setAttribute("multiple","multiple")),t._resizing&&this.plugins.video.setVideoRatioSelect.call(this,t._origin_h||t._defaultRatio)},open:function(){this.plugins.dialog.open.call(this,"video","video"===this.currentControllerName)},setVideoRatio:function(e){const t=this.context.video,n=e.target.options[e.target.selectedIndex].value;t._defaultSizeY=t._videoRatio=n?100*n+"%":t._defaultSizeY,t.inputY.placeholder=n?100*n+"%":"",t.inputY.value=""},setInputSize:function(e,t){if(t&&32===t.keyCode)return void t.preventDefault();const n=this.context.video;this.plugins.resizing._module_setInputSize.call(this,n,e),"y"===e&&this.plugins.video.setVideoRatioSelect.call(this,t.target.value||n._defaultRatio)},setRatio:function(){this.plugins.resizing._module_setRatio.call(this,this.context.video)},submit:function(e){const t=this.context.video,n=this.plugins.video;e.preventDefault(),e.stopPropagation(),t._align=t.modal.querySelector('input[name="suneditor_video_radio"]:checked').value;try{t.videoInputFile&&t.videoInputFile.files.length>0?(this.showLoading(),n.submitAction.call(this,this.context.video.videoInputFile.files)):t.videoUrlFile&&t._linkValue.length>0&&(this.showLoading(),n.setup_url.call(this))}catch(e){throw this.closeLoading(),Error('[SUNEDITOR.video.submit.fail] cause : "'+e.message+'"')}finally{this.plugins.dialog.close.call(this)}return!1},submitAction:function(e){if(0===e.length)return;let t=0,n=[];for(let i=0,l=e.length;i0){let e=0;const n=this.context.video._infoList;for(let t=0,i=n.length;ti){this.closeLoading();const n="[SUNEDITOR.videoUpload.fail] Size of uploadable total videos: "+i/1e3+"KB";return void(("function"!==this.functions.onVideoUploadError||this.functions.onVideoUploadError(n,{limitSize:i,currentSize:e,uploadSize:t},this))&&this.functions.noticeOpen(n))}}const l=this.context.video;l._uploadFileLength=n.length;const o={inputWidth:l.inputX.value,inputHeight:l.inputY.value,align:l._align,isUpdate:this.context.dialog.updateModal,element:l._element};if("function"==typeof this.functions.onVideoUploadBefore){const e=this.functions.onVideoUploadBefore(n,o,this,function(e){e&&this._w.Array.isArray(e.result)?this.plugins.video.register.call(this,o,e):this.plugins.video.upload.call(this,o,e)}.bind(this));if(void 0===e)return;if(!e)return void this.closeLoading();"object"==typeof e&&e.length>0&&(n=e)}this.plugins.video.upload.call(this,o,n)},error:function(e,t){if(this.closeLoading(),"function"!=typeof this.functions.onVideoUploadError||this.functions.onVideoUploadError(e,t,this))throw this.functions.noticeOpen(e),Error("[SUNEDITOR.plugin.video.error] response: "+e)},upload:function(e,t){if(!t)return void this.closeLoading();if("string"==typeof t)return void this.plugins.video.error.call(this,t,null);const n=this.context.option.videoUploadUrl,i=this.context.dialog.updateModal?1:t.length;if(!("string"==typeof n&&n.length>0))throw Error('[SUNEDITOR.videoUpload.fail] cause : There is no "videoUploadUrl" option.');{const l=new FormData;for(let e=0;e$/.test(t)){if(t=(new this._w.DOMParser).parseFromString(t,"text/html").querySelector("iframe").src,0===t.length)return!1}if(/youtu\.?be/.test(t)){if(/^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("&","?&")),e._youtubeQuery.length>0)if(/\?/.test(t)){const n=t.split("?");t=n[0]+"?"+e._youtubeQuery+"&"+n[1]}else t+="?"+e._youtubeQuery}else/vimeo\.com/.test(t)&&(t.endsWith("/")&&(t=t.slice(0,-1)),t="https://player.vimeo.com/video/"+t.slice(t.lastIndexOf("/")+1));this.plugins.video.create_video.call(this,this.plugins.video.createIframeTag.call(this),t,e.inputX.value,e.inputY.value,e._align,null,this.context.dialog.updateModal)}catch(e){throw Error('[SUNEDITOR.video.upload.fail] cause : "'+e.message+'"')}finally{this.closeLoading()}},create_video:function(e,t,n,i,l,o,s){this.context.resizing._resize_plugin="video";const a=this.context.video;let r=null,c=null,d=!1;if(s){if((e=a._element).src!==t){d=!0;const n=/youtu\.?be/.test(t),i=/vimeo\.com/.test(t);if(!n&&!i||/^iframe$/i.test(e.nodeName))if(n||i||/^videoo$/i.test(e.nodeName))e.src=t;else{const n=this.plugins.video.createVideoTag.call(this);n.src=t,e.parentNode.replaceChild(n,e),a._element=e=n}else{const n=this.plugins.video.createIframeTag.call(this);n.src=t,e.parentNode.replaceChild(n,e),a._element=e=n}}c=a._container,r=this.util.getParentElement(e,"FIGURE")}else d=!0,e.src=t,a._element=e,r=this.plugins.component.set_cover.call(this,e),c=this.plugins.component.set_container.call(this,r,"se-video-container");a._cover=r,a._container=c;const u=this.plugins.resizing._module_getSizeX.call(this,a)!==(n||a._defaultSizeX)||this.plugins.resizing._module_getSizeY.call(this,a)!==(i||a._videoRatio),h=!s||u;a._resizing&&(this.context.video._proportionChecked=a.proportion.checked,e.setAttribute("data-proportion",a._proportionChecked));let g=!1;h&&(g=this.plugins.video.applySize.call(this)),g&&"center"===l||this.plugins.video.setAlign.call(this,null,e,r,c);let p=!0;s?a._resizing&&this.context.resizing._rotateVertical&&h&&this.plugins.resizing.setTransformSize.call(this,e,null,null):p=this.insertComponent(c,!1,!0,!1),p&&(d&&this.plugins.fileManager.setInfo.call(this,"video",e,this.functions.onVideoUpload,o,!0),s&&(this.selectComponent(e,"video"),this.history.push(!1))),this.context.resizing._resize_plugin=""},_update_videoCover:function(e){if(!e)return;const t=this.context.video;/^video$/i.test(e.nodeName)?this.plugins.video._setTagAttrs.call(this,e):this.plugins.video._setIframeAttrs.call(this,e);const n=this.util.getParentElement(e,this.util.isMediaComponent)||this.util.getParentElement(e,function(e){return this.isWysiwygDiv(e.parentNode)}.bind(this.util));t._element=e=e.cloneNode(!0);const i=t._cover=this.plugins.component.set_cover.call(this,e),l=t._container=this.plugins.component.set_container.call(this,i,"se-video-container"),o=n.querySelector("figcaption");let s=null;o&&(s=this.util.createElement("DIV"),s.innerHTML=o.innerHTML,this.util.removeItem(o));const a=(e.getAttribute("data-size")||e.getAttribute("data-origin")||"").split(",");this.plugins.video.applySize.call(this,a[0],a[1]),n.parentNode.replaceChild(l,n),s&&n.parentNode.insertBefore(s,l.nextElementSibling),this.plugins.fileManager.setInfo.call(this,"video",e,this.functions.onVideoUpload,null,!0)},onModifyMode:function(e,t){const n=this.context.video;n._element=e,n._cover=this.util.getParentElement(e,"FIGURE"),n._container=this.util.getParentElement(e,this.util.isMediaComponent),n._align=e.getAttribute("data-align")||"none",t&&(n._element_w=t.w,n._element_h=t.h,n._element_t=t.t,n._element_l=t.l);let i=n._element.getAttribute("data-size")||n._element.getAttribute("data-origin");i?(i=i.split(","),n._origin_w=i[0],n._origin_h=i[1]):t&&(n._origin_w=t.w,n._origin_h=t.h)},openModify:function(e){const t=this.context.video;if(t.videoUrlFile&&(t._linkValue=t.preview.textContent=t.videoUrlFile.value=t._element.src||(t._element.querySelector("source")||"").src||""),t.modal.querySelector('input[name="suneditor_video_radio"][value="'+t._align+'"]').checked=!0,t._resizing){this.plugins.resizing._module_setModifyInputSize.call(this,t,this.plugins.video);const e=t._videoRatio=this.plugins.resizing._module_getSizeY.call(this,t);this.plugins.video.setVideoRatioSelect.call(this,e)||(t.inputY.value=t._onlyPercentage?this.util.getNumber(e,2):e)}e||this.plugins.dialog.open.call(this,"video",!0)},setVideoRatioSelect:function(e){let t=!1;const n=this.context.video,i=n.videoRatioOption.options;/%$/.test(e)||n._onlyPercentage?e=this.util.getNumber(e,2)/100+"":(!this.util.isNumber(e)||1*e>=1)&&(e=""),n.inputY.placeholder="";for(let l=0,o=i.length;l'+this.icons.cancel+''+t.dialogBox.audioBox.title+'
    ';return e.audioFileInput&&(i+='
    "),e.audioUrlInput&&(i+='
    '),i+='
    ",n.innerHTML=i,n},setController:function(){const e=this.lang,t=this.icons,n=this.util.createElement("DIV");return n.className="se-controller se-controller-link",n.innerHTML='
    ",n},_fileInputChange:function(){this.audioInputFile.value?(this.audioUrlFile.setAttribute("disabled",!0),this.preview.style.textDecoration="line-through"):(this.audioUrlFile.removeAttribute("disabled"),this.preview.style.textDecoration="")},_removeSelectedFiles:function(e,t){this.value="",e&&(e.removeAttribute("disabled"),t.style.textDecoration="")},_createAudioTag:function(){const e=this.util.createElement("AUDIO");this.plugins.audio._setTagAttrs.call(this,e);const t=this.context.audio._origin_w,n=this.context.audio._origin_h;return e.setAttribute("origin-size",t+","+n),e.style.cssText=(t?"width:"+t+"; ":"")+(n?"height:"+n+";":""),e},_setTagAttrs:function(e){e.setAttribute("controls",!0);const t=this.context.options.audioTagAttrs;if(t)for(let n in t)this.util.hasOwn(t,n)&&e.setAttribute(n,t[n])},_onLinkPreview:function(e,t,n){const i=n.target.value.trim();e._linkValue=this.textContent=i?t&&-1===i.indexOf("://")&&0!==i.indexOf("#")?t+i:-1===i.indexOf("://")?"/"+i:i:""},fileTags:["audio"],select:function(e){this.plugins.audio.onModifyMode.call(this,e)},destroy:function(e){e=e||this.context.audio._element;const t=this.util.getParentElement(e,this.util.isComponent)||e,n=1*e.getAttribute("data-index"),i=t.previousElementSibling||t.nextElementSibling,l=t.parentNode;this.util.removeItem(t),this.plugins.audio.init.call(this),this.controllersOff(),l!==this.context.element.wysiwyg&&this.util.removeItemAllParents(l,(function(e){return 0===e.childNodes.length}),null),this.focusEdge(i),this.plugins.fileManager.deleteInfo.call(this,"audio",n,this.functions.onAudioUpload),this.history.push(!1)},checkFileInfo:function(){this.plugins.fileManager.checkInfo.call(this,"audio",["audio"],this.functions.onAudioUpload,this.plugins.audio.updateCover.bind(this),!1)},resetFileInfo:function(){this.plugins.fileManager.resetInfo.call(this,"audio",this.functions.onAudioUpload)},on:function(e){const t=this.context.audio;e?t._element?(this.context.dialog.updateModal=!0,t._linkValue=t.preview.textContent=t.audioUrlFile.value=t._element.src,t.audioInputFile&&this.context.options.audioMultipleFile&&t.audioInputFile.removeAttribute("multiple")):t.audioInputFile&&this.context.options.audioMultipleFile&&t.audioInputFile.removeAttribute("multiple"):(this.plugins.audio.init.call(this),t.audioInputFile&&this.context.options.audioMultipleFile&&t.audioInputFile.setAttribute("multiple","multiple"))},open:function(){this.plugins.dialog.open.call(this,"audio","audio"===this.currentControllerName)},submit:function(e){const t=this.context.audio;e.preventDefault(),e.stopPropagation();try{t.audioInputFile&&t.audioInputFile.files.length>0?(this.showLoading(),this.plugins.audio.submitAction.call(this,t.audioInputFile.files)):t.audioUrlFile&&t._linkValue.length>0&&(this.showLoading(),this.plugins.audio.setupUrl.call(this,t._linkValue))}catch(e){throw this.closeLoading(),Error('[SUNEDITOR.audio.submit.fail] cause : "'+e.message+'"')}finally{this.plugins.dialog.close.call(this)}return!1},submitAction:function(e){if(0===e.length)return;let t=0,n=[];for(let i=0,l=e.length;i0){let e=0;const n=this.context.audio._infoList;for(let t=0,i=n.length;ti){this.closeLoading();const n="[SUNEDITOR.audioUpload.fail] Size of uploadable total audios: "+i/1e3+"KB";return void(("function"!==this.functions.onAudioUploadError||this.functions.onAudioUploadError(n,{limitSize:i,currentSize:e,uploadSize:t},this))&&this.functions.noticeOpen(n))}}const l=this.context.audio;l._uploadFileLength=n.length;const o={isUpdate:this.context.dialog.updateModal,element:l._element};if("function"==typeof this.functions.onAudioUploadBefore){const e=this.functions.onAudioUploadBefore(n,o,this,function(e){e&&this._w.Array.isArray(e.result)?this.plugins.audio.register.call(this,o,e):this.plugins.audio.upload.call(this,o,e)}.bind(this));if(void 0===e)return;if(!e)return void this.closeLoading();"object"==typeof e&&e.length>0&&(n=e)}this.plugins.audio.upload.call(this,o,n)},error:function(e,t){if(this.closeLoading(),"function"!=typeof this.functions.onAudioUploadError||this.functions.onAudioUploadError(e,t,this))throw this.functions.noticeOpen(e),Error("[SUNEDITOR.plugin.audio.exception] response: "+e)},upload:function(e,t){if(!t)return void this.closeLoading();if("string"==typeof t)return void this.plugins.audio.error.call(this,t,null);const n=this.context.option.audioUploadUrl,i=this.context.dialog.updateModal?1:t.length,l=new FormData;for(let e=0;e'+this.icons.cancel+''+e.dialogBox.mathBox.title+'

    ",t},setController_MathButton:function(){const e=this.lang,t=this.util.createElement("DIV");return t.className="se-controller se-controller-link",t.innerHTML='
    ",t},open:function(){this.plugins.dialog.open.call(this,"math","math"===this.currentControllerName)},managedTags:function(){return{className:"katex",method:function(e){if(!e.getAttribute("data-exp"))return;const t=this._d.createRange().createContextualFragment(this.plugins.math._renderer.call(this,this.util.HTMLDecoder(e.getAttribute("data-exp"))));e.innerHTML=t.querySelector(".katex").innerHTML}}},_renderer:function(e){const t=this.context.option.katex;return t.src.renderToString(e,t.options)},_renderMathExp:function(e,t){e.previewElement.innerHTML=this.plugins.math._renderer.call(this,t.target.value)},submit:function(e){this.showLoading(),e.preventDefault(),e.stopPropagation();const t=function(){if(0===this.context.math.focusElement.value.trim().length)return!1;const e=this.context.math,t=e.focusElement.value,n=e.previewElement.querySelector(".katex");if(!n)return!1;if(n.className="__se__katex "+n.className,n.setAttribute("contenteditable",!1),n.setAttribute("data-exp",this.util.HTMLEncoder(t)),n.setAttribute("data-font-size",e.fontSizeElement.value),n.style.fontSize=e.fontSizeElement.value,this.context.dialog.updateModal){const t=this.util.getParentElement(e._mathExp,".katex");t.parentNode.replaceChild(n,t),this.setRange(n,0,n,1)}else{const e=this.getSelectedElements();if(e.length>1){const t=this.util.createElement(e[0].nodeName);if(t.appendChild(n),!this.insertNode(t,null,!0))return!1}else if(!this.insertNode(n,null,!0))return!1;const t=this.util.createTextNode(this.util.zeroWidthSpace);n.parentNode.insertBefore(t,n.nextSibling),this.setRange(n,0,n,1)}return e.focusElement.value="",e.fontSizeElement.value="1em",e.previewElement.style.fontSize="1em",e.previewElement.innerHTML="",!0}.bind(this);try{t()&&(this.plugins.dialog.close.call(this),this.history.push(!1))}catch(e){this.plugins.dialog.close.call(this)}finally{this.closeLoading()}return!1},active:function(e){if(e){if(e.getAttribute("data-exp"))return this.controllerArray.indexOf(this.context.math.mathController)<0&&(this.setRange(e,0,e,1),this.plugins.math.call_controller.call(this,e)),!0}else this.controllerArray.indexOf(this.context.math.mathController)>-1&&this.controllersOff();return!1},on:function(e){if(e){const e=this.context.math;if(e._mathExp){const t=this.util.HTMLDecoder(e._mathExp.getAttribute("data-exp")),n=e._mathExp.getAttribute("data-font-size")||"1em";this.context.dialog.updateModal=!0,e.focusElement.value=t,e.fontSizeElement.value=n,e.previewElement.innerHTML=this.plugins.math._renderer.call(this,t),e.previewElement.style.fontSize=n}}else this.plugins.math.init.call(this)},call_controller:function(e){this.context.math._mathExp=e;const t=this.context.math.mathController,n=this.util.getOffset(e,this.context.element.wysiwygFrame);t.style.top=n.top+e.offsetHeight+10+"px",t.style.left=n.left-this.context.element.wysiwygFrame.scrollLeft+"px",t.style.display="block";const i=this.context.element.wysiwygFrame.offsetWidth-(t.offsetLeft+t.offsetWidth);i<0?(t.style.left=t.offsetLeft+i+"px",t.firstElementChild.style.left=20-i+"px"):t.firstElementChild.style.left="20px",this.controllersOn(t,e,"math")},onClick_mathController:function(e){e.stopPropagation();const t=e.target.getAttribute("data-command")||e.target.parentNode.getAttribute("data-command");t&&(e.preventDefault(),/update/.test(t)?(this.context.math.focusElement.value=this.util.HTMLDecoder(this.context.math._mathExp.getAttribute("data-exp")),this.plugins.dialog.open.call(this,"math",!0)):(this.util.removeItem(this.context.math._mathExp),this.context.math._mathExp=null,this.focus(),this.history.push(!1)),this.controllersOff())},init:function(){const e=this.context.math;e.mathController.style.display="none",e._mathExp=null,e.focusElement.value="",e.previewElement.innerHTML=""}},y={name:"mention",display:"dialog",title:"mention",buttonClass:"",innerHTML:"@",focussed:0,renderItem:function(e){return`${e}`},getItems:function(e){return Promise.resolve(["overwite","the","mention","plugin","getItems","method"].filter(t=>t.includes(e.toLowerCase())))},renderList:function(e){const{mention:t}=this.context;t.getItems(e).then(e=>{t.items=e,t.list.innerHTML=e.map((e,n)=>`
  • \n ${t.renderItem(e)}\n
  • `).join("")})},setDialog:function(){const e=this.util.createElement("DIV"),t=this.lang;e.className="se-dialog-content",e.style.display="none";const n=`\n
    \n
    \n \n ${t.dialogBox.mentionBox.title}\n
    \n
    \n \n
      \n
    \n
    \n
    \n `;return e.innerHTML=n,e},getId:e=>e,getValue:e=>"@"+e,getLinkHref:()=>"",open:function(){const{mention:e}=this.context;this.plugins.dialog.open.call(this,"mention","mention"===this.currentControllerName),e.search.focus(),e.renderList("")},on:function(e){e||this.plugins.mention.init.call(this)},init:function(){const{mention:e}=this.context;e.search.value="",e.focussed=0,e.items=[]},onKeyPress:function(e){const{mention:t}=this.context;switch(e.key){case"ArrowDown":t.focussed+=1,e.preventDefault(),e.stopPropagation();break;case"ArrowUp":t.focussed>0&&(t.focussed-=1),e.preventDefault(),e.stopPropagation();break;case"Enter":t.add(),e.preventDefault(),e.stopPropagation();break;default:t.focussed=0}},onKeyUp:function(e){const{mention:t}=this.context;t.renderList(e.target.value)},getMentions:function(){const{mentions:e,getId:t}=this.context.mention;return e.filter(e=>{const n=t(e);return this.context.element.wysiwyg.querySelector(`[data-mention="${n}"]`)})},addMention:function(){const{mention:e}=this.context,t=e.items[e.focussed];if(t){e.mentions.find(n=>e.getId(n)===e.getId(t))||e.mentions.push(t);const n=this.util.createElement("A");n.href=e.getLinkHref(t),n.target="_blank",n.innerHTML=e.getValue(t),n.setAttribute("data-mention",e.getId(t)),this.insertNode(n,null,!1);const i=this.util.createElement("SPAN");i.innerHTML=" ",this.insertNode(i,n,!1)}this.plugins.dialog.close.call(this)},add:function(e){e.addModule([r.a]);const t=this.setDialog.call(e);e.getMentions=this.getMentions.bind(e);const n=t.querySelector(".se-mention-search");n.addEventListener("keyup",this.onKeyUp.bind(e)),n.addEventListener("keydown",this.onKeyPress.bind(e));const i=t.querySelector(".se-mention-list");e.context.mention={modal:t,search:n,list:i,triggerKey:this.triggerKey,visible:!1,add:this.addMention.bind(e),mentions:[],items:[],renderList:this.renderList.bind(e),getId:this.getId.bind(e),getValue:this.getValue.bind(e),getLinkHref:this.getLinkHref.bind(e),open:this.open.bind(e),focussed:this.focussed,renderItem:this.renderItem,getItems:this.getItems},e.context.dialog.modal.appendChild(t)},action:function(){}},C=n("JhlZ"),w=n.n(C),x={blockquote:{name:"blockquote",display:"command",add:function(e,t){e.context.blockquote={targetButton:t,tag:e.util.createElement("BLOCKQUOTE")}},active:function(e){if(e){if(/blockquote/i.test(e.nodeName))return this.util.addClass(this.context.blockquote.targetButton,"active"),!0}else this.util.removeClass(this.context.blockquote.targetButton,"active");return!1},action:function(){const e=this.util.getParentElement(this.getSelectionNode(),"blockquote");e?this.detachRangeFormatElement(e,null,null,!1,!1):this.applyRangeFormatElement(this.context.blockquote.tag.cloneNode(!1))}},align:{name:"align",display:"submenu",add:function(e,t){const n=e.icons,i=e.context;i.align={targetButton:t,_alignList:null,currentAlign:"",icons:{justify:n.align_justify,left:n.align_left,right:n.align_right,center:n.align_center}};let l=this.setSubmenu.call(e),o=l.querySelector("ul");o.addEventListener("click",this.pickup.bind(e)),i.align._alignList=o.querySelectorAll("li button"),e.initMenuTarget(this.name,t,l),l=null,o=null},setSubmenu:function(){const e=this.lang,t=this.icons,n=this.util.createElement("DIV");return n.className="se-submenu se-list-layer se-list-align",n.innerHTML='
    ",n},active:function(e){const t=this.context.align.targetButton,n=t.firstElementChild;if(e){if(this.util.isFormatElement(e)){const i=e.style.textAlign;if(i)return this.util.changeElement(n,this.context.align.icons[i]),t.setAttribute("data-focus",i),!0}}else this.util.changeElement(n,this.context.align.icons.left),t.removeAttribute("data-focus");return!1},on:function(){const e=this.context.align,t=e._alignList,n=e.targetButton.getAttribute("data-focus")||"left";if(n!==e.currentAlign){for(let e=0,i=t.length;e('+t.toolbar.default+")";for(o=0,s=a.length;o";return r+="",n.innerHTML=r,n},active:function(e){const t=this.context.font.targetText,n=this.context.font.targetTooltip;if(e){if(e.style&&e.style.fontFamily.length>0){const i=e.style.fontFamily.replace(/["']/g,"");return this.util.changeTxt(t,i),this.util.changeTxt(n,i),!0}}else{const e=this.lang.toolbar.font;this.util.changeTxt(t,e),this.util.changeTxt(n,e)}return!1},on:function(){const e=this.context.font,t=e._fontList,n=e.targetText.textContent;if(n!==e.currentFont){for(let e=0,i=t.length;e('+t.toolbar.default+")";for(let t,n=0,o=e.fontSizeUnit,s=i.length;n";return l+="",n.innerHTML=l,n},active:function(e){if(e){if(e.style&&e.style.fontSize.length>0)return this.util.changeTxt(this.context.fontSize.targetText,e.style.fontSize),!0}else this.util.changeTxt(this.context.fontSize.targetText,this.lang.toolbar.fontSize);return!1},on:function(){const e=this.context.fontSize,t=e._sizeList,n=e.targetText.textContent;if(n!==e.currentSize){for(let e=0,i=t.length;e
  • ',t},appendHr:function(e){const t=this.util.createElement("HR");return t.className=e,this.focus(),this.insertComponent(t,!1,!0,!1)},horizontalRulePick:function(e){e.preventDefault(),e.stopPropagation();let t=e.target,n=null;for(;!n&&!/UL/i.test(t.tagName);)n=t.getAttribute("data-value"),t=t.parentNode;if(!n)return;const i=this.plugins.horizontalRule.appendHr.call(this,"__se__"+n);i&&(this.setRange(i,0,i,0),this.submenuOff())}},list:{name:"list",display:"submenu",add:function(e,t){const n=e.context;n.list={targetButton:t,_list:null,currentList:"",icons:{bullets:e.icons.list_bullets,number:e.icons.list_number}};let i=this.setSubmenu.call(e),l=i.querySelector("ul");l.addEventListener("click",this.pickup.bind(e)),n.list._list=l.querySelectorAll("li button"),e.initMenuTarget(this.name,t,i),i=null,l=null},setSubmenu:function(){const e=this.lang,t=this.util.createElement("DIV");return t.className="se-submenu se-list-layer",t.innerHTML='
    ",t},active:function(e){const t=this.context.list.targetButton,n=t.firstElementChild,i=this.util;if(e){if(i.isList(e)){const l=e.nodeName;return t.setAttribute("data-focus",l),i.addClass(t,"active"),/UL/i.test(l)?i.changeElement(n,this.context.list.icons.bullets):i.changeElement(n,this.context.list.icons.number),!0}}else t.removeAttribute("data-focus"),i.changeElement(n,this.context.list.icons.number),i.removeClass(t,"active");return!1},on:function(){const e=this.context.list,t=e._list,n=e.targetButton.getAttribute("data-focus")||"";if(n!==e.currentList){for(let e=0,i=t.length;e"),t.innerHTML+=n.outerHTML,e&&(t.innerHTML+="
    ")}else{const e=n.childNodes;for(;e[0];)t.appendChild(e[0])}a.appendChild(t),r||(u=a),r&&m===g&&!o.isRangeFormatElement(f)||(d||(d=a),i&&r&&m===g||r&&o.isList(g)&&g===c||a.parentNode!==m&&m.insertBefore(a,f)),o.removeItem(n),i&&null===h&&(h=a.children.length-1),r&&(o.getRangeFormatElement(g,p)!==o.getRangeFormatElement(c,p)||o.isList(g)&&o.isList(c)&&o.getElementDepth(g)!==o.getElementDepth(c))&&(a=o.createElement(e)),_&&0===_.children.length&&o.removeItem(_)}else o.removeItem(n);h&&(d=d.children[h]),s&&(g=a.children.length-1,a.innerHTML+=c.innerHTML,u=a.children[g],o.removeItem(c))}else{if(n)for(let e=0,t=l.length;e=0;n--)if(l[n].contains(l[e])){l.splice(e,1),e--,t--;break}const t=o.getRangeFormatElement(s),i=t&&t.tagName===e;let a,r;const c=function(e){return!this.isComponent(e)}.bind(o);i||(r=o.createElement(e));for(let t,s,d=0,u=l.length;d0){const e=l.cloneNode(!1),t=l.childNodes,o=this.util.getPositionIndex(i);for(;t[o];)e.appendChild(t[o]);n.appendChild(e)}0===l.children.length&&this.util.removeItem(l),this.util.mergeSameTags(s);const a=this.util.getEdgeChildNodes(t,n);return{cc:t.parentNode,sc:a.sc,ec:a.ec}},editInsideList:function(e,t){const n=(t=t||this.getSelectedElements().filter(function(e){return this.isListCell(e)}.bind(this.util))).length;if(0===n||!e&&!this.util.isListCell(t[0].previousElementSibling)&&!this.util.isListCell(t[n-1].nextElementSibling))return{sc:t[0],so:0,ec:t[n-1],eo:1};let i=t[0].parentNode,l=t[n-1],o=null;if(e){if(i!==l.parentNode&&this.util.isList(l.parentNode.parentNode)&&l.nextElementSibling)for(l=l.nextElementSibling;l;)t.push(l),l=l.nextElementSibling;o=this.plugins.list.editList.call(this,i.nodeName.toUpperCase(),t,!0)}else{let e=this.util.createElement(i.nodeName),s=t[0].previousElementSibling,a=l.nextElementSibling;const r={s:null,e:null,sl:i,el:i};for(let l,o=0,c=n;o span > span"),n.table.columnFixedButton=o.querySelector("._se_table_fixed_column"),n.table.headerButton=o.querySelector("._se_table_header"),o.addEventListener("mousedown",e.eventStop);let s=this.setController_tableEditor.call(e,n.table.cellControllerTop);n.table.resizeDiv=s,n.table.splitMenu=s.querySelector(".se-btn-group-sub"),n.table.mergeButton=s.querySelector("._se_table_merge_button"),n.table.splitButton=s.querySelector("._se_table_split_button"),n.table.insertRowAboveButton=s.querySelector("._se_table_insert_row_a"),n.table.insertRowBelowButton=s.querySelector("._se_table_insert_row_b"),s.addEventListener("mousedown",e.eventStop),l.addEventListener("mousemove",this.onMouseMove_tablePicker.bind(e)),l.addEventListener("click",this.appendTable.bind(e)),s.addEventListener("click",this.onClick_tableController.bind(e)),o.addEventListener("click",this.onClick_tableController.bind(e)),e.initMenuTarget(this.name,t,i),n.element.relative.appendChild(s),n.element.relative.appendChild(o),i=null,l=null,s=null,o=null},setSubmenu:function(){const e=this.util.createElement("DIV");return e.className="se-submenu se-selector-table",e.innerHTML='
    1 x 1
    ',e},setController_table:function(){const e=this.lang,t=this.icons,n=this.util.createElement("DIV");return n.className="se-controller se-controller-table",n.innerHTML='
    ",n},setController_tableEditor:function(e){const t=this.lang,n=this.icons,i=this.util.createElement("DIV");return i.className="se-controller se-controller-table-cell",i.innerHTML=(e?"":'
    ')+'
    • '+t.controller.VerticalSplit+'
    • '+t.controller.HorizontalSplit+"
    ",i},appendTable:function(){const e=this.util.createElement("TABLE"),t=this.plugins.table.createCells,n=this.context.table._tableXY[0];let i=this.context.table._tableXY[1],l="";for(;i>0;)l+=""+t.call(this,"td",n)+"",--i;l+="",e.innerHTML=l;if(this.insertComponent(e,!1,!0,!1)){const t=e.querySelector("td div");this.setRange(t,0,t,0),this.plugins.table.reset_table_picker.call(this)}},createCells:function(e,t,n){if(e=e.toLowerCase(),n){const t=this.util.createElement(e);return t.innerHTML="

    ",t}{let n="";for(;t>0;)n+="<"+e+">

    ",t--;return n}},onMouseMove_tablePicker:function(e){e.stopPropagation();let t=this._w.Math.ceil(e.offsetX/18),n=this._w.Math.ceil(e.offsetY/18);t=t<1?1:t,n=n<1?1:n,this.context.table.tableHighlight.style.width=t+"em",this.context.table.tableHighlight.style.height=n+"em";this.context.table.tableUnHighlight.style.width="10em",this.context.table.tableUnHighlight.style.height="10em",this.util.changeTxt(this.context.table.tableDisplay,t+" x "+n),this.context.table._tableXY=[t,n]},reset_table_picker:function(){if(!this.context.table.tableHighlight)return;const e=this.context.table.tableHighlight.style,t=this.context.table.tableUnHighlight.style;e.width="1em",e.height="1em",t.width="10em",t.height="10em",this.util.changeTxt(this.context.table.tableDisplay,"1 x 1"),this.submenuOff()},init:function(){const e=this.context.table,t=this.plugins.table;if(t._removeEvents.call(this),t._selectedTable){const e=t._selectedTable.querySelectorAll(".se-table-selected-cell");for(let t=0,n=e.length;t0)for(let e,t=0;to||(u>=e.index?(i+=e.cs,u+=e.cs,e.rs-=1,e.row=o+1,e.rs<1&&(r.splice(t,1),t--)):h===g-1&&(e.rs-=1,e.row=o+1,e.rs<1&&(r.splice(t,1),t--)));if(o===s&&h===l){n._logical_cellIndex=u;break}d>0&&a.push({index:u,cs:c+1,rs:d,row:-1}),i+=c}r=r.concat(a).sort((function(e,t){return e.index-t.index})),a=[]}a=null,r=null}},editTable:function(e,t){const n=this.plugins.table,i=this.context.table,l=i._element,o="row"===e;if(o){const e=i._trElement.parentNode;if(/^THEAD$/i.test(e.nodeName)){if("up"===t)return;if(!e.nextElementSibling||!/^TBODY$/i.test(e.nextElementSibling.nodeName))return void(l.innerHTML+=""+n.createCells.call(this,"td",i._logical_cellCnt,!1)+"")}}if(n._ref){const e=i._tdElement,l=n._selectedCells;if(o)if(t)n.setCellInfo.call(this,"up"===t?l[0]:l[l.length-1],!0),n.editRow.call(this,t,e);else{let e=l[0].parentNode;const i=[l[0]];for(let t,n=1,o=l.length;ns&&s>t&&(e[l].rowSpan=n+a,c-=i)}if(i){const e=r[o+1];if(e){const t=[];let n=r[o].cells,i=0;for(let e,l,o=0,s=n.length;o1&&(e.rowSpan-=1,t.push({cell:e.cloneNode(!1),index:l}));if(t.length>0){let l=t.shift();n=e.cells,i=0;for(let o,s,a=0,r=n.length;a=l.index)||(a--,i--,i+=l.cell.colSpan-1,e.insertBefore(l.cell,o),l=t.shift(),l));a++);if(l){e.appendChild(l.cell);for(let n=0,i=t.length;n0){const e=!o[b+1];for(let t,n=0;n_||(p>=t.index?(f+=t.cs,p=b+f,t.rs-=1,t.row=_+1,t.rs<1&&(d.splice(n,1),n--)):e&&(t.rs-=1,t.row=_+1,t.rs<1&&(d.splice(n,1),n--)))}n>0&&c.push({rs:n,cs:r+1,index:p,row:-1}),p>=t&&p+r<=t+s?h.push(e):p<=t+s&&p+r>=t?e.colSpan-=i.getOverlapRangeAtIndex(a,a+s,p,p+r):n>0&&(pt+s)&&g.push({cell:e,i:_,rs:_+n}),f+=r}else{if(b>=t)break;if(r>0){if(u<1&&r+b>=t){e.colSpan+=1,t=null,u=n+1;break}t-=r}if(!m){for(let e,n=0;n0){u-=1;continue}null!==t&&o.length>0&&(p=this.plugins.table.createCells.call(this,o[0].nodeName,0,!0),p=e.insertBefore(p,o[t]))}}if(l){let e,t;for(let n,l=0,o=h.length;l1)c.colSpan=this._w.Math.floor(e/2),l.colSpan=e-c.colSpan,s.insertBefore(c,l.nextElementSibling);else{let t=[],n=[];for(let s,r,c=0,d=i._rowCnt;c0)for(let e,t=0;tc||(u>=e.index?(r+=e.cs,u+=e.cs,e.rs-=1,e.row=c+1,e.rs<1&&(n.splice(t,1),t--)):h===g-1&&(e.rs-=1,e.row=c+1,e.rs<1&&(n.splice(t,1),t--)));if(u<=a&&d>0&&t.push({index:u,cs:o+1,rs:d,row:-1}),i!==l&&u<=a&&u+o>=a+e-1){i.colSpan+=1;break}if(u>a)break;r+=o}n=n.concat(t).sort((function(e,t){return e.index-t.index})),t=[]}s.insertBefore(c,l.nextElementSibling)}}else{const e=l.rowSpan;if(c.colSpan=l.colSpan,e>1){c.rowSpan=this._w.Math.floor(e/2);const n=e-c.rowSpan,i=[],r=t.getArrayIndex(o,s)+n;for(let e,t,n=0;n=a));c++)l=e[c],o=l.rowSpan-1,o>0&&o+n>=r&&s=h.index&&(r+=h.cs,l+=h.cs,h=i.shift()),l>=a||o===s-1){d.insertBefore(c,e.nextElementSibling);break}r+=t}l.rowSpan=n}else{c.rowSpan=l.rowSpan;const e=t.createElement("TR");e.appendChild(c);for(let e,t=0;t=r&&(e[n].rowSpan+=1)}const n=i._physical_cellIndex,a=s.cells;for(let e=0,t=a.length;e0&&s+o>=i&&(e.rowSpan-=n.getOverlapRangeAtIndex(i,l,s,s+o));else o.push(e[s]);for(let e=0,t=o.length;e"+this.plugins.table.createCells.call(this,"th",this.context.table._logical_cellCnt,!1)+"",i.insertBefore(t,i.firstElementChild)}e.toggleClass(t,"active"),/TH/i.test(this.context.table._tdElement.nodeName)?this.controllersOff():this.plugins.table.setPositionControllerDiv.call(this,this.context.table._tdElement,!1)},setTableStyle:function(e){const t=this.context.table,n=t._element;let i,l,o,s;e.indexOf("width")>-1&&(i=t.resizeButton.firstElementChild,l=t.resizeText,t._maxWidth?(o=t.icons.reduction,s=t.minText,t.columnFixedButton.style.display="block",this.util.removeClass(n,"se-table-size-auto"),this.util.addClass(n,"se-table-size-100")):(o=t.icons.expansion,s=t.maxText,t.columnFixedButton.style.display="none",this.util.removeClass(n,"se-table-size-100"),this.util.addClass(n,"se-table-size-auto")),this.util.changeElement(i,o),this.util.changeTxt(l,s)),e.indexOf("column")>-1&&(t._fixedColumn?(this.util.removeClass(n,"se-table-layout-auto"),this.util.addClass(n,"se-table-layout-fixed"),this.util.addClass(t.columnFixedButton,"active")):(this.util.removeClass(n,"se-table-layout-fixed"),this.util.addClass(n,"se-table-layout-auto"),this.util.removeClass(t.columnFixedButton,"active")))},setActiveButton:function(e,t){const n=this.context.table;/^TH$/i.test(e.nodeName)?(n.insertRowAboveButton.setAttribute("disabled",!0),n.insertRowBelowButton.setAttribute("disabled",!0)):(n.insertRowAboveButton.removeAttribute("disabled"),n.insertRowBelowButton.removeAttribute("disabled")),t&&e!==t?(n.splitButton.setAttribute("disabled",!0),n.mergeButton.removeAttribute("disabled")):(n.splitButton.removeAttribute("disabled"),n.mergeButton.setAttribute("disabled",!0))},_bindOnSelect:null,_bindOffSelect:null,_bindOffShift:null,_selectedCells:null,_shift:!1,_fixedCell:null,_fixedCellName:null,_selectedCell:null,_selectedTable:null,_ref:null,_toggleEditor:function(e){this.context.element.wysiwyg.setAttribute("contenteditable",e),e?this.util.removeClass(this.context.element.wysiwyg,"se-disabled"):this.util.addClass(this.context.element.wysiwyg,"se-disabled")},_offCellMultiSelect:function(e){e.stopPropagation();const t=this.plugins.table;t._shift?t._initBind&&(this._wd.removeEventListener("touchmove",t._initBind),t._initBind=null):(t._removeEvents.call(this),t._toggleEditor.call(this,!0)),t._fixedCell&&t._selectedTable&&(t.setActiveButton.call(this,t._fixedCell,t._selectedCell),t.call_controller_tableEdit.call(this,t._selectedCell||t._fixedCell),t._selectedCells=t._selectedTable.querySelectorAll(".se-table-selected-cell"),t._selectedCell&&t._fixedCell&&this.focusEdge(t._selectedCell),t._shift||(t._fixedCell=null,t._selectedCell=null,t._fixedCellName=null))},_onCellMultiSelect:function(e){this._antiBlur=!0;const t=this.plugins.table,n=this.util.getParentElement(e.target,this.util.isCell);if(t._shift)n===t._fixedCell?t._toggleEditor.call(this,!0):t._toggleEditor.call(this,!1);else if(!t._ref){if(n===t._fixedCell)return;t._toggleEditor.call(this,!1)}n&&n!==t._selectedCell&&t._fixedCellName===n.nodeName&&t._selectedTable===this.util.getParentElement(n,"TABLE")&&(t._selectedCell=n,t._setMultiCells.call(this,t._fixedCell,n))},_setMultiCells:function(e,t){const n=this.plugins.table,i=n._selectedTable.rows,l=this.util,o=n._selectedTable.querySelectorAll(".se-table-selected-cell");for(let e=0,t=o.length;e0)for(let e,t=0;td||(u>=e.index?(o+=e.cs,u+=e.cs,e.rs-=1,e.row=d+1,e.rs<1&&(a.splice(t,1),t--)):p===m-1&&(e.rs-=1,e.row=d+1,e.rs<1&&(a.splice(t,1),t--)));if(s){if(i!==e&&i!==t||(c.cs=null!==c.cs&&c.csu+h?c.ce:u+h,c.rs=null!==c.rs&&c.rsd+g?c.re:d+g,c._i+=1),2===c._i){s=!1,a=[],r=[],d=-1;break}}else if(l.getOverlapRangeAtIndex(c.cs,c.ce,u,u+h)&&l.getOverlapRangeAtIndex(c.rs,c.re,d,d+g)){const e=c.csu+h?c.ce:u+h,n=c.rsd+g?c.re:d+g;if(c.cs!==e||c.ce!==t||c.rs!==n||c.re!==o){c.cs=e,c.ce=t,c.rs=n,c.re=o,d=-1,a=[],r=[];break}l.addClass(i,"se-table-selected-cell")}g>0&&r.push({index:u,cs:h+1,rs:g,row:-1}),o+=i.colSpan-1}a=a.concat(r).sort((function(e,t){return e.index-t.index})),r=[]}},_removeEvents:function(){const e=this.plugins.table;e._initBind&&(this._wd.removeEventListener("touchmove",e._initBind),e._initBind=null),e._bindOnSelect&&(this._wd.removeEventListener("mousedown",e._bindOnSelect),this._wd.removeEventListener("mousemove",e._bindOnSelect),e._bindOnSelect=null),e._bindOffSelect&&(this._wd.removeEventListener("mouseup",e._bindOffSelect),e._bindOffSelect=null),e._bindOffShift&&(this._wd.removeEventListener("keyup",e._bindOffShift),e._bindOffShift=null)},_initBind:null,onTableCellMultiSelect:function(e,t){const n=this.plugins.table;n._removeEvents.call(this),this.controllersOff(),n._shift=t,n._fixedCell=e,n._fixedCellName=e.nodeName,n._selectedTable=this.util.getParentElement(e,"TABLE");const i=n._selectedTable.querySelectorAll(".se-table-selected-cell");for(let e=0,t=i.length;e-1?(n=e.toLowerCase(),s="blockquote"===n?"range":"pre"===n?"free":"replace",r=/^h/.test(n)?n.match(/\d+/)[0]:"",a=t["tag_"+(r?"h":n)]+r,d="",c=""):(n=e.tag.toLowerCase(),s=e.command,a=e.name||n,d=e.class,c=d?' class="'+d+'"':""),o+='
  • ";return o+="",n.innerHTML=o,n},active:function(e){let t=this.lang.toolbar.formats;const n=this.context.formatBlock.targetText,i=this.context.formatBlock.targetTooltip;if(e){if(this.util.isFormatElement(e)){const l=this.context.formatBlock._formatList,o=e.nodeName.toLowerCase(),s=(e.className.match(/(\s|^)__se__format__[^\s]+/)||[""])[0].trim();for(let e,n=0,i=l.length;n=0;u--)if(i=p[u],i!==(p[u+1]?p[u+1].parentNode:null)){if(d=r.isComponent(i),o=d?"":i.innerHTML.replace(/(?!>)\s+(?=<)|\n/g," "),s=r.getParentElement(i,(function(e){return e.parentNode===t})),(t!==i.parentNode||d)&&(r.isFormatElement(t)?(t.parentNode.insertBefore(n,t.nextSibling),t=t.parentNode):(t.insertBefore(n,s?s.nextSibling:null),t=i.parentNode),a=n.nextSibling,a&&n.nodeName===a.nodeName&&r.isSameAttributes(n,a)&&(n.innerHTML+="
    "+a.innerHTML,r.removeItem(a)),n=l.cloneNode(!1),h=!0),c=n.innerHTML,n.innerHTML=(h||!o||!c||/
    $/i.test(o)?o:o+"
    ")+c,0===u){t.insertBefore(n,i),a=i.nextSibling,a&&n.nodeName===a.nodeName&&r.isSameAttributes(n,a)&&(n.innerHTML+="
    "+a.innerHTML,r.removeItem(a));const e=n.previousSibling;e&&n.nodeName===e.nodeName&&r.isSameAttributes(n,e)&&(e.innerHTML+="
    "+n.innerHTML,r.removeItem(n))}d||r.removeItem(i),o&&(h=!1)}this.setRange(i,0,i,0)}else{for(let e,t,n=0,s=p.length;n('+t.toolbar.default+")";for(let e,t=0,n=i.length;t";return l+="",n.innerHTML=l,n},on:function(){const e=this.context.lineHeight,t=e._sizeList,n=this.util.getFormatElement(this.getSelectionNode()),i=n?n.style.lineHeight+"":"";if(i!==e.currentSize){for(let e=0,n=t.length;e"}return o+="",t.innerHTML=o,t},on:function(){const e=this.context.paragraphStyle._classList,t=this.util.getFormatElement(this.getSelectionNode());for(let n=0,i=e.length;n"}return l+="",t.innerHTML=l,t},on:function(){const e=this.util,t=this.context.textStyle._styleList,n=this.getSelectionNode();for(let i,l,o,s=0,a=t.length;s'+(e.alt||t)+'
    '+(e.name||t)+"
    "},setImage:function(e){this.callPlugin("image",function(){const t={name:e.parentNode.querySelector(".__se__img_name").textContent,size:0};this.context.image._altText=e.alt,this.plugins.image.create_image.call(this,e.src,"",!1,this.context.image._origin_w,this.context.image._origin_h,"none",t)}.bind(this),null)}},mention:y},E={redo:'',undo:'',bold:'',underline:'',italic:'',strike:'',subscript:'',superscript:'',erase:'',indent:'',outdent:'',expansion:'',reduction:'',code_view:'',preview:'',print:'',template:'',line_height:'',paragraph_style:'',text_style:'',save:'',blockquote:'',arrow_down:'',align_justify:'',align_left:'',align_right:'',align_center:'',font_color:'',highlight_color:'',list_bullets:'',list_number:'',table:'',horizontal_rule:'',show_blocks:'',cancel:'',image:'',video:'',link:'',math:'',unlink:'',table_header:'',merge_cell:'',split_cell:'',caption:'',edit:'',delete:'',modify:'',revert:'',auto_size:'',insert_row_below:'',insert_row_above:'',insert_column_left:'',insert_column_right:'',delete_row:'',delete_column:'',fixed_column_width:'',rotate_left:'',rotate_right:'',mirror_horizontal:'',mirror_vertical:'',checked:'',line_break:'',audio:'',image_gallery:'',more_text:'',more_paragraph:'',more_plus:'',more_horizontal:'',more_vertical:'',attachment:'',map:'',magic_stick:'',empty_file:''},S=n("P6u4"),N=n.n(S);const T={_d:null,_w:null,isIE:null,isIE_Edge:null,isOSX_IOS:null,_propertiesInit:function(){this._d||(this._d=document,this._w=window,this.isIE=navigator.userAgent.indexOf("Trident")>-1,this.isIE_Edge=navigator.userAgent.indexOf("Trident")>-1||navigator.appVersion.indexOf("Edge")>-1,this.isOSX_IOS=/(Mac|iPhone|iPod|iPad)/.test(navigator.platform))},_HTMLConvertor:function(e){const t={"&":"&"," ":" ","'":"'",'"':""","<":"<",">":">"};return e.replace(/&|\u00A0|'|"|<|>/g,(function(e){return"string"==typeof t[e]?t[e]:e}))},zeroWidthSpace:String.fromCharCode(8203),zeroWidthRegExp:new RegExp(String.fromCharCode(8203),"g"),onlyZeroWidthRegExp:new RegExp("^"+String.fromCharCode(8203)+"+$"),onlyZeroWidthSpace:function(e){return"string"!=typeof e&&(e=e.textContent),""===e||this.onlyZeroWidthRegExp.test(e)},getXMLHttpRequest:function(){if(!this._w.ActiveXObject)return this._w.XMLHttpRequest?new XMLHttpRequest:null;try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(e){try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(e){return null}}},createElement:function(e){return this._d.createElement(e)},createTextNode:function(e){return this._d.createTextNode(e||"")},HTMLEncoder:function(e){const t={"<":"$lt;",">":"$gt;"};return e.replace(/<|>/g,(function(e){return"string"==typeof t[e]?t[e]:e}))},HTMLDecoder:function(e){const t={"$lt;":"<","$gt;":">"};return e.replace(/\$lt;|\$gt;/g,(function(e){return"string"==typeof t[e]?t[e]:e}))},hasOwn:function(e,t){return this._hasOwn.call(e,t)},_hasOwn:Object.prototype.hasOwnProperty,getIncludePath:function(e,t){let n="";const i=[],l="js"===t?"script":"link",o="js"===t?"src":"href";let s="(?:";for(let t=0,n=e.length;t0?i[0][o]:""),-1===n.indexOf(":/")&&"//"!==n.slice(0,2)&&(n=0===n.indexOf("/")?location.href.match(/^.*?:\/\/[^\/]*/)[0]+n:location.href.match(/^[^\?]*\/(?:)/)[0]+n),!n)throw"[SUNEDITOR.util.getIncludePath.fail] The SUNEDITOR installation path could not be automatically detected. (name: +"+name+", extension: "+t+")";return n},getPageStyle:function(e){let t="";const n=(e||this._d).styleSheets;for(let e,i=0,l=n.length;i-1||(i+=n[e].name+'="'+n[e].value+'" ');return i},getByteLength:function(e){const t=this._w.encodeURIComponent;let n,i;return this.isIE_Edge?(i=this._w.unescape(t(e.toString())).length,n=0,null!==t(e.toString()).match(/(%0A|%0D)/gi)&&(n=t(e.toString()).match(/(%0A|%0D)/gi).length),i+n):(i=new this._w.TextEncoder("utf-8").encode(e.toString()).length,n=0,null!==t(e.toString()).match(/(%0A|%0D)/gi)&&(n=t(e.toString()).match(/(%0A|%0D)/gi).length),i+n)},isWysiwygDiv:function(e){return e&&1===e.nodeType&&(this.hasClass(e,"se-wrapper-wysiwyg")||/^BODY$/i.test(e.nodeName))},isNonEditable:function(e){return e&&1===e.nodeType&&"false"===e.getAttribute("contenteditable")},isTextStyleElement:function(e){return e&&3!==e.nodeType&&/^(strong|span|font|b|var|i|em|u|ins|s|strike|del|sub|sup|mark|a|label|code)$/i.test(e.nodeName)},isFormatElement:function(e){return e&&1===e.nodeType&&(/^(P|DIV|H[1-6]|PRE|LI|TH|TD)$/i.test(e.nodeName)||this.hasClass(e,"(\\s|^)__se__format__replace_.+(\\s|$)|(\\s|^)__se__format__free_.+(\\s|$)"))&&!this.isComponent(e)&&!this.isWysiwygDiv(e)},isRangeFormatElement:function(e){return e&&1===e.nodeType&&(/^(BLOCKQUOTE|OL|UL|FIGCAPTION|TABLE|THEAD|TBODY|TR|TH|TD)$/i.test(e.nodeName)||this.hasClass(e,"(\\s|^)__se__format__range_.+(\\s|$)"))},isClosureRangeFormatElement:function(e){return e&&1===e.nodeType&&(/^(TH|TD)$/i.test(e.nodeName)||this.hasClass(e,"(\\s|^)__se__format__range__closure_.+(\\s|$)"))},isFreeFormatElement:function(e){return e&&1===e.nodeType&&(/^PRE$/i.test(e.nodeName)||this.hasClass(e,"(\\s|^)__se__format__free_.+(\\s|$)"))&&!this.isComponent(e)&&!this.isWysiwygDiv(e)},isClosureFreeFormatElement:function(e){return e&&1===e.nodeType&&this.hasClass(e,"(\\s|^)__se__format__free__closure_.+(\\s|$)")},isComponent:function(e){return e&&(/se-component/.test(e.className)||/^(TABLE|HR)$/.test(e.nodeName))},isMediaComponent:function(e){return e&&/se-component/.test(e.className)},isNotCheckingNode:function(e){return e&&/katex|__se__tag/.test(e.className)},getFormatElement:function(e,t){if(!e)return null;for(t||(t=function(){return!0});e;){if(this.isWysiwygDiv(e))return null;if(this.isRangeFormatElement(e)&&e.firstElementChild,this.isFormatElement(e)&&t(e))return e;e=e.parentNode}return null},getRangeFormatElement:function(e,t){if(!e)return null;for(t||(t=function(){return!0});e;){if(this.isWysiwygDiv(e))return null;if(this.isRangeFormatElement(e)&&!/^(THEAD|TBODY|TR)$/i.test(e.nodeName)&&t(e))return e;e=e.parentNode}return null},getFreeFormatElement:function(e,t){if(!e)return null;for(t||(t=function(){return!0});e;){if(this.isWysiwygDiv(e))return null;if(this.isFreeFormatElement(e)&&t(e))return e;e=e.parentNode}return null},getClosureFreeFormatElement:function(e,t){if(!e)return null;for(t||(t=function(){return!0});e;){if(this.isWysiwygDiv(e))return null;if(this.isClosureFreeFormatElement(e)&&t(e))return e;e=e.parentNode}return null},copyTagAttributes:function(e,t){t.style.cssText&&(e.style.cssText+=t.style.cssText);const n=t.classList;for(let t=0,i=n.length;ts?1:o0&&!this.isBreak(e);)e=e.firstChild;for(;t&&1===t.nodeType&&t.childNodes.length>0&&!this.isBreak(t);)t=t.lastChild;return{sc:e,ec:t||e}}},getOffset:function(e,t){let n=0,i=0,l=3===e.nodeType?e.parentElement:e;const o=this.getParentElement(e,this.isWysiwygDiv.bind(this));for(;l&&!this.hasClass(l,"se-container")&&l!==o;)n+=l.offsetLeft,i+=l.offsetTop,l=l.offsetParent;const s=t&&/iframe/i.test(t.nodeName);return{left:n+(s?t.parentElement.offsetLeft:0),top:i-o.scrollTop+(s?t.parentElement.offsetTop:0)}},getOverlapRangeAtIndex:function(e,t,n,i){if(e<=i?tn)return 0;const l=(e>n?e:n)-(t0?" ":"")+t)},removeClass:function(e,t){if(!e)return;const n=new this._w.RegExp("(\\s|^)"+t+"(\\s|$)");e.className=e.className.replace(n," ").trim(),e.className.trim()||e.removeAttribute("class")},toggleClass:function(e,t){if(!e)return;const n=new this._w.RegExp("(\\s|^)"+t+"(\\s|$)");n.test(e.className)?e.className=e.className.replace(n," ").trim():e.className+=" "+t,e.className.trim()||e.removeAttribute("class")},setDisabledButtons:function(e,t){for(let n=0,i=t.length;n=0){e.splitText(t);const n=this.getNodeFromPath([a+1],i);this.onlyZeroWidthSpace(n)&&(n.data=this.zeroWidthSpace)}}else 1===e.nodeType&&(e.previousSibling?e=e.previousSibling:this.getElementDepth(e)===n&&(r=!1));let c=e;for(;this.getElementDepth(c)>n;)for(a=this.getPositionIndex(c)+1,c=c.parentNode,s=l,l=c.cloneNode(!1),o=c.childNodes,s&&(this.isListCell(l)&&this.isList(s)&&s.firstElementChild?(l.innerHTML=s.firstElementChild.innerHTML,T.removeItem(s.firstElementChild),s.children.length>0&&l.appendChild(s)):l.appendChild(s));o[a];)l.appendChild(o[a]);c.childNodes.length<=1&&(!c.firstChild||0===c.firstChild.textContent.length)&&(c.innerHTML="
    ");const d=c.parentNode;return r&&(c=c.nextSibling),l?(this.mergeSameTags(l,null,!1),this.mergeNestedTags(l,function(e){return this.isList(e)}.bind(this)),l.childNodes.length>0?d.insertBefore(l,c):l=c,0===i.childNodes.length&&this.removeItem(i),l):c},mergeSameTags:function(e,t,n){const i=this,l=t?t.length:0;let o=null;return l&&(o=this._w.Array.apply(null,new this._w.Array(l)).map(this._w.Number.prototype.valueOf,0)),function e(s,a,r){const c=s.childNodes;for(let d,u,h=0,g=c.length;h=0;){if(i.getArrayIndex(o.childNodes,n)!==e[r]){c=!1;break}n=d.parentNode,o=n.parentNode,r--}c&&(e.splice(a,1),e[a]=h)}}i.copyTagAttributes(d,s),s.parentNode.insertBefore(d,s),i.removeItem(s)}if(!u){1===d.nodeType&&e(d,a+1,h);break}if(d.nodeName===u.nodeName&&i.isSameAttributes(d,u)&&d.href===u.href){const e=d.childNodes;let n=0;for(let t=0,i=e.length;t0&&n++;const s=d.lastChild,c=u.firstChild;let g=0;if(s&&c){const e=3===s.nodeType&&3===c.nodeType;g=s.textContent.length;let i=s.previousSibling;for(;i&&3===i.nodeType;)g+=i.textContent.length,i=i.previousSibling;if(n>0&&3===s.nodeType&&3===c.nodeType&&(s.textContent.length>0||c.textContent.length>0)&&n--,l){let i=null;for(let d=0;dh){if(a>0&&i[a-1]!==r)continue;i[a]-=1,i[a+1]>=0&&i[a]===h&&(i[a+1]+=n,e&&s&&3===s.nodeType&&c&&3===c.nodeType&&(o[d]+=g))}}}if(3===d.nodeType){if(g=d.textContent.length,d.textContent+=u.textContent,l){let e=null;for(let i=0;ih){if(a>0&&e[a-1]!==r)continue;e[a]-=1,e[a+1]>=0&&e[a]===h&&(e[a+1]+=n,o[i]+=g)}}}else d.innerHTML+=u.innerHTML;i.removeItem(u),h--}else 1===d.nodeType&&e(d,a+1,h)}}(e,0,0),o},mergeNestedTags:function(e,t){"string"==typeof t?t=function(e){return this.test(e.tagName)}.bind(new this._w.RegExp("^("+(t||".+")+")$","i")):"function"!=typeof t&&(t=function(){return!0}),function e(n){let i=n.children;if(1===i.length&&i[0].nodeName===n.nodeName&&t(n)){const e=i[0];for(i=e.children;i[0];)n.appendChild(i[0]);n.removeChild(e)}for(let t=0,i=n.children.length;t")},htmlRemoveWhiteSpace:function(e){return e?e.trim().replace(/<\/?(?!strong|span|font|b|var|i|em|u|ins|s|strike|del|sub|sup|mark|a|label|code)[^>^<]+>\s+(?=<)/gi,(function(e){return e.trim()})):""},sortByDepth:function(e,t){const n=t?1:-1,i=-1*n;e.sort(function(e,t){return this.isListCell(e)&&this.isListCell(t)?(e=this.getElementDepth(e))>(t=this.getElementDepth(t))?n:e":e.innerHTML,e.innerHTML=t.outerHTML},_setDefaultOptionStyle:function(e,t){let n="";e.height&&(n+="height:"+e.height+";"),e.minHeight&&(n+="min-height:"+e.minHeight+";"),e.maxHeight&&(n+="max-height:"+e.maxHeight+";"),e.position&&(n+="position:"+e.position+";"),e.width&&(n+="width:"+e.width+";"),e.minWidth&&(n+="min-width:"+e.minWidth+";"),e.maxWidth&&(n+="max-width:"+e.maxWidth+";");let i="",l="",o="";const s=(t=n+t).split(";");for(let t,n=0,a=s.length;n'+this._setIframeCssTags(t),e.contentDocument.body.className="sun-editor-editable",e.contentDocument.body.setAttribute("contenteditable",!0)},_setIframeCssTags:function(e){const t=e.iframeCSSFileName,n=this._w.RegExp;let i="";for(let e,l=0,o=t.length;l'}return i+("auto"===e.height?"":"")}};var L=T,k={init:function(e,t){"object"!=typeof t&&(t={});const n=document;this._initOptions(e,t);const i=n.createElement("DIV");i.className="sun-editor",e.id&&(i.id="suneditor_"+e.id);const l=n.createElement("DIV");l.className="se-container";const o=this._createToolBar(n,t.buttonList,t.plugins,t);o.element.style.visibility="hidden",o.pluginCallButtons.math&&this._checkKatexMath(t.katex);const s=n.createElement("DIV");s.className="se-arrow";const a=n.createElement("DIV");a.className="se-toolbar-sticky-dummy";const r=n.createElement("DIV");r.className="se-wrapper";const c=this._initElements(t,i,o.element,s),d=c.bottomBar,u=c.wysiwygFrame,h=c.placeholder;let g=c.codeView;const p=d.resizingBar,m=d.navigation,f=d.charWrapper,_=d.charCounter,b=n.createElement("DIV");b.className="se-loading-box sun-editor-common",b.innerHTML='
    ';const v=n.createElement("DIV");v.className="se-line-breaker",v.innerHTML='";const y=n.createElement("DIV");y.className+="se-line-breaker-component";const C=y.cloneNode(!0);y.innerHTML=C.innerHTML=t.icons.line_break;const w=n.createElement("DIV");w.className="se-resizing-back";const x=t.toolbarContainer;return x&&x.appendChild(o.element),r.appendChild(g),h&&r.appendChild(h),x||l.appendChild(o.element),l.appendChild(a),l.appendChild(r),l.appendChild(w),l.appendChild(b),l.appendChild(v),l.appendChild(y),l.appendChild(C),p&&l.appendChild(p),i.appendChild(l),g=this._checkCodeMirror(t,g),{constructed:{_top:i,_relative:l,_toolBar:o.element,_menuTray:o._menuTray,_editorArea:r,_wysiwygArea:u,_codeArea:g,_placeholder:h,_resizingBar:p,_navigation:m,_charWrapper:f,_charCounter:_,_loading:b,_lineBreaker:v,_lineBreaker_t:y,_lineBreaker_b:C,_resizeBack:w,_stickyDummy:a,_arrow:s},options:t,plugins:o.plugins,pluginCallButtons:o.pluginCallButtons,_responsiveButtons:o.responsiveButtons}},_checkCodeMirror:function(e,t){if(e.codeMirror){const n=[{mode:"htmlmixed",htmlMode:!0,lineNumbers:!0,lineWrapping:!0},e.codeMirror.options||{}].reduce((function(e,t){for(let n in t)L.hasOwn(t,n)&&(e[n]=t[n]);return e}),{});"auto"===e.height&&(n.viewportMargin=1/0,n.height="auto");const i=e.codeMirror.src.fromTextArea(t,n);i.display.wrapper.style.cssText=t.style.cssText,e.codeMirrorEditor=i,(t=i.display.wrapper).className+=" se-wrapper-code-mirror"}return t},_checkKatexMath:function(e){if(!e)throw Error('[SUNEDITOR.create.fail] To use the math button you need to add a "katex" object to the options.');const t=[{throwOnError:!1},e.options||{}].reduce((function(e,t){for(let n in t)L.hasOwn(t,n)&&(e[n]=t[n]);return e}),{});e.options=t},_setOptions:function(e,t,n,i){this._initOptions(t.element.originElement,e);const l=t.element,o=l.relative,s=l.editorArea,a=e.toolbarContainer&&e.toolbarContainer!==i.toolbarContainer,r=!!e.buttonList||e.mode!==i.mode||a,c=!!e.plugins,d=this._createToolBar(document,r?e.buttonList:i.buttonList,c?e.plugins:n,e);d.pluginCallButtons.math&&this._checkKatexMath(e.katex);const u=document.createElement("DIV");u.className="se-arrow",r&&(d.element.style.visibility="hidden",a?(e.toolbarContainer.appendChild(d.element),l.toolbar.parentElement.removeChild(l.toolbar)):l.toolbar.parentElement.replaceChild(d.element,l.toolbar),l.toolbar=d.element,l._menuTray=d._menuTray,l._arrow=u);const h=this._initElements(e,l.topArea,r?d.element:l.toolbar,u),g=h.bottomBar,p=h.wysiwygFrame,m=h.placeholder;let f=h.codeView;return l.resizingBar&&o.removeChild(l.resizingBar),g.resizingBar&&o.appendChild(g.resizingBar),s.innerHTML="",s.appendChild(f),m&&s.appendChild(m),f=this._checkCodeMirror(e,f),l.resizingBar=g.resizingBar,l.navigation=g.navigation,l.charWrapper=g.charWrapper,l.charCounter=g.charCounter,l.wysiwygFrame=p,l.code=f,l.placeholder=m,{callButtons:r?d.pluginCallButtons:null,plugins:r||c?d.plugins:null,toolbar:d}},_initElements:function(e,t,n,i){t.style.cssText=e._editorStyles.top,/inline/i.test(e.mode)?(n.className+=" se-toolbar-inline",n.style.width=e.toolbarWidth):/balloon/i.test(e.mode)&&(n.className+=" se-toolbar-balloon",n.style.width=e.toolbarWidth,n.appendChild(i));const l=document.createElement(e.iframe?"IFRAME":"DIV");l.className="se-wrapper-inner se-wrapper-wysiwyg",e.iframe?(l.allowFullscreen=!0,l.frameBorder=0,l.style.cssText=e._editorStyles.frame):(l.setAttribute("contenteditable",!0),l.setAttribute("scrolling","auto"),l.className+=" sun-editor-editable",l.style.cssText=e._editorStyles.frame+e._editorStyles.editor);const o=document.createElement("TEXTAREA");o.className="se-wrapper-inner se-wrapper-code",o.style.cssText=e._editorStyles.frame,o.style.display="none","auto"===e.height&&(o.style.overflow="hidden");let s=null,a=null,r=null,c=null;if(e.resizingBar&&(s=document.createElement("DIV"),s.className="se-resizing-bar sun-editor-common",a=document.createElement("DIV"),a.className="se-navigation sun-editor-common",s.appendChild(a),e.charCounter)){if(r=document.createElement("DIV"),r.className="se-char-counter-wrapper",e.charCounterLabel){const t=document.createElement("SPAN");t.className="se-char-label",t.textContent=e.charCounterLabel,r.appendChild(t)}if(c=document.createElement("SPAN"),c.className="se-char-counter",c.textContent="0",r.appendChild(c),e.maxCharCount>0){const t=document.createElement("SPAN");t.textContent=" / "+e.maxCharCount,r.appendChild(t)}s.appendChild(r)}let d=null;return e.placeholder&&(d=document.createElement("SPAN"),d.className="se-placeholder",d.innerText=e.placeholder),{bottomBar:{resizingBar:s,navigation:a,charWrapper:r,charCounter:c},wysiwygFrame:l,codeView:o,placeholder:d}},_initOptions:function(e,t){t.lang=t.lang||N.a,t.value="string"==typeof t.value?t.value:null,t.historyStackDelayTime="number"==typeof t.historyStackDelayTime?t.historyStackDelayTime:400,t._defaultTagsWhitelist="string"==typeof t._defaultTagsWhitelist?t._defaultTagsWhitelist:"br|p|div|pre|blockquote|h[1-6]|ol|ul|li|hr|figure|figcaption|img|iframe|audio|video|source|table|thead|tbody|tr|th|td|a|b|strong|var|i|em|u|ins|s|span|strike|del|sub|sup|code",t._editorTagsWhitelist=t._defaultTagsWhitelist+("string"==typeof t.addTagsWhitelist&&t.addTagsWhitelist.length>0?"|"+t.addTagsWhitelist:""),t.pasteTagsWhitelist="string"==typeof t.pasteTagsWhitelist?t.pasteTagsWhitelist:t._editorTagsWhitelist,t.attributesWhitelist=t.attributesWhitelist&&"object"==typeof t.attributesWhitelist?t.attributesWhitelist:null,t.mode=t.mode||"classic",t.toolbarWidth=t.toolbarWidth?L.isNumber(t.toolbarWidth)?t.toolbarWidth+"px":t.toolbarWidth:"auto",t.toolbarContainer=/balloon/i.test(t.mode)?null:"string"==typeof t.toolbarContainer?document.querySelector(t.toolbarContainer):t.toolbarContainer,t.stickyToolbar=/balloon/i.test(t.mode)||t.toolbarContainer?-1:void 0===t.stickyToolbar?0:/^\d+/.test(t.stickyToolbar)?L.getNumber(t.stickyToolbar,0):-1,t.fullPage=!!t.fullPage,t.iframe=t.fullPage||t.iframe,t.iframeCSSFileName=t.iframe?"string"==typeof t.iframeCSSFileName?[t.iframeCSSFileName]:t.iframeCSSFileName||["suneditor"]:null,t.codeMirror=t.codeMirror?t.codeMirror.src?t.codeMirror:{src:t.codeMirror}:null,t.position="string"==typeof t.position?t.position:null,t.display=t.display||("none"!==e.style.display&&e.style.display?e.style.display:"block"),t.popupDisplay=t.popupDisplay||"full",t.resizingBar=void 0===t.resizingBar?!/inline|balloon/i.test(t.mode):t.resizingBar,t.showPathLabel=!!t.resizingBar&&("boolean"!=typeof t.showPathLabel||t.showPathLabel),t.charCounter=t.maxCharCount>0||"boolean"==typeof t.charCounter&&t.charCounter,t.charCounterType="string"==typeof t.charCounterType?t.charCounterType:"char",t.charCounterLabel="string"==typeof t.charCounterLabel?t.charCounterLabel.trim():null,t.maxCharCount=L.isNumber(t.maxCharCount)&&t.maxCharCount>-1?1*t.maxCharCount:null,t.width=t.width?L.isNumber(t.width)?t.width+"px":t.width:e.clientWidth?e.clientWidth+"px":"100%",t.minWidth=(L.isNumber(t.minWidth)?t.minWidth+"px":t.minWidth)||"",t.maxWidth=(L.isNumber(t.maxWidth)?t.maxWidth+"px":t.maxWidth)||"",t.height=t.height?L.isNumber(t.height)?t.height+"px":t.height:e.clientHeight?e.clientHeight+"px":"auto",t.minHeight=(L.isNumber(t.minHeight)?t.minHeight+"px":t.minHeight)||"",t.maxHeight=(L.isNumber(t.maxHeight)?t.maxHeight+"px":t.maxHeight)||"",t.defaultStyle="string"==typeof t.defaultStyle?t.defaultStyle:"",t.font=t.font?t.font:null,t.fontSize=t.fontSize?t.fontSize:null,t.formats=t.formats?t.formats:null,t.colorList=t.colorList?t.colorList:null,t.lineHeights=t.lineHeights?t.lineHeights:null,t.paragraphStyles=t.paragraphStyles?t.paragraphStyles:null,t.textStyles=t.textStyles?t.textStyles:null,t.fontSizeUnit="string"==typeof t.fontSizeUnit&&t.fontSizeUnit.trim()||"px",t.imageResizing=void 0===t.imageResizing||t.imageResizing,t.imageHeightShow=void 0===t.imageHeightShow||!!t.imageHeightShow,t.imageWidth=t.imageWidth?L.isNumber(t.imageWidth)?t.imageWidth+"px":t.imageWidth:"auto",t.imageHeight=t.imageHeight?L.isNumber(t.imageHeight)?t.imageHeight+"px":t.imageHeight:"auto",t.imageSizeOnlyPercentage=!!t.imageSizeOnlyPercentage,t._imageSizeUnit=t.imageSizeOnlyPercentage?"%":"px",t.imageRotation=void 0!==t.imageRotation?t.imageRotation:!(t.imageSizeOnlyPercentage||!t.imageHeightShow),t.imageFileInput=void 0===t.imageFileInput||t.imageFileInput,t.imageUrlInput=void 0===t.imageUrlInput||!t.imageFileInput||t.imageUrlInput,t.imageUploadHeader=t.imageUploadHeader||null,t.imageUploadUrl="string"==typeof t.imageUploadUrl?t.imageUploadUrl:null,t.imageUploadSizeLimit=/\d+/.test(t.imageUploadSizeLimit)?L.getNumber(t.imageUploadSizeLimit,0):null,t.imageMultipleFile=!!t.imageMultipleFile,t.imageAccept="string"!=typeof t.imageAccept||"*"===t.imageAccept.trim()?"image/*":t.imageAccept.trim()||"image/*",t.imageGalleryUrl="string"==typeof t.imageGalleryUrl?t.imageGalleryUrl:null,t.videoResizing=void 0===t.videoResizing||t.videoResizing,t.videoHeightShow=void 0===t.videoHeightShow||!!t.videoHeightShow,t.videoRatioShow=void 0===t.videoRatioShow||!!t.videoRatioShow,t.videoWidth=t.videoWidth&&L.getNumber(t.videoWidth,0)?L.isNumber(t.videoWidth)?t.videoWidth+"px":t.videoWidth:"",t.videoHeight=t.videoHeight&&L.getNumber(t.videoHeight,0)?L.isNumber(t.videoHeight)?t.videoHeight+"px":t.videoHeight:"",t.videoSizeOnlyPercentage=!!t.videoSizeOnlyPercentage,t._videoSizeUnit=t.videoSizeOnlyPercentage?"%":"px",t.videoRotation=void 0!==t.videoRotation?t.videoRotation:!(t.videoSizeOnlyPercentage||!t.videoHeightShow),t.videoRatio=L.getNumber(t.videoRatio,4)||.5625,t.videoRatioList=t.videoRatioList?t.videoRatioList:null,t.youtubeQuery=(t.youtubeQuery||"").replace("?",""),t.videoFileInput=!!t.videoFileInput,t.videoUrlInput=void 0===t.videoUrlInput||!t.videoFileInput||t.videoUrlInput,t.videoUploadHeader=t.videoUploadHeader||null,t.videoUploadUrl="string"==typeof t.videoUploadUrl?t.videoUploadUrl:null,t.videoUploadSizeLimit=/\d+/.test(t.videoUploadSizeLimit)?L.getNumber(t.videoUploadSizeLimit,0):null,t.videoMultipleFile=!!t.videoMultipleFile,t.videoTagAttrs=t.videoTagAttrs||null,t.videoIframeAttrs=t.videoIframeAttrs||null,t.videoAccept="string"!=typeof t.videoAccept||"*"===t.videoAccept.trim()?"video/*":t.videoAccept.trim()||"video/*",t.audioWidth=t.audioWidth?L.isNumber(t.audioWidth)?t.audioWidth+"px":t.audioWidth:"",t.audioHeight=t.audioHeight?L.isNumber(t.audioHeight)?t.audioHeight+"px":t.audioHeight:"",t.audioFileInput=!!t.audioFileInput,t.audioUrlInput=void 0===t.audioUrlInput||!t.audioFileInput||t.audioUrlInput,t.audioUploadHeader=t.audioUploadHeader||null,t.audioUploadUrl="string"==typeof t.audioUploadUrl?t.audioUploadUrl:null,t.audioUploadSizeLimit=/\d+/.test(t.audioUploadSizeLimit)?L.getNumber(t.audioUploadSizeLimit,0):null,t.audioMultipleFile=!!t.audioMultipleFile,t.audioTagAttrs=t.audioTagAttrs||null,t.audioAccept="string"!=typeof t.audioAccept||"*"===t.audioAccept.trim()?"audio/*":t.audioAccept.trim()||"audio/*",t.tableCellControllerPosition="string"==typeof t.tableCellControllerPosition?t.tableCellControllerPosition.toLowerCase():"cell",t.tabDisable=!!t.tabDisable,t.shortcutsDisable=Array.isArray(t.shortcutsDisable)&&t.shortcutsDisable.length>0?t.shortcutsDisable.map((function(e){return e.toLowerCase()})):[],t.shortcutsHint=void 0===t.shortcutsHint||!!t.shortcutsHint,t.callBackSave=t.callBackSave?t.callBackSave:null,t.templates=t.templates?t.templates:null,t.placeholder="string"==typeof t.placeholder?t.placeholder:null,t.linkProtocol="string"==typeof t.linkProtocol?t.linkProtocol:null,t.katex=t.katex?t.katex.src?t.katex:{src:t.katex}:null,t.buttonList=t.buttonList||[["undo","redo"],["bold","underline","italic","strike","subscript","superscript"],["removeFormat"],["outdent","indent"],["fullScreen","showBlocks","codeView"],["preview","print"]],t.icons=t.icons&&"object"==typeof t.icons?[E,t.icons].reduce((function(e,t){for(let n in t)L.hasOwn(t,n)&&(e[n]=t[n]);return e}),{}):E,t._editorStyles=L._setDefaultOptionStyle(t,t.defaultStyle)},_defaultButtons:function(e){const t=e.icons,n=e.lang,i=L.isOSX_IOS?"⌘":"CTRL",l=e.shortcutsHint?e.shortcutsDisable:["bold","strike","underline","italic","undo","indent"];return{bold:["_se_command_bold",n.toolbar.bold+(l.indexOf("bold")>-1?"":" ("+i+"+B)"),"STRONG","",t.bold],underline:["_se_command_underline",n.toolbar.underline+(l.indexOf("underline")>-1?"":" ("+i+"+U)"),"U","",t.underline],italic:["_se_command_italic",n.toolbar.italic+(l.indexOf("italic")>-1?"":" ("+i+"+I)"),"EM","",t.italic],strike:["_se_command_strike",n.toolbar.strike+(l.indexOf("strike")>-1?"":" ("+i+"+SHIFT+S)"),"DEL","",t.strike],subscript:["_se_command_subscript",n.toolbar.subscript,"SUB","",t.subscript],superscript:["_se_command_superscript",n.toolbar.superscript,"SUP","",t.superscript],removeFormat:["",n.toolbar.removeFormat,"removeFormat","",t.erase],indent:["_se_command_indent",n.toolbar.indent+(l.indexOf("indent")>-1?"":" ("+i+"+])"),"indent","",t.outdent],outdent:["_se_command_outdent",n.toolbar.outdent+(l.indexOf("indent")>-1?"":" ("+i+"+[)"),"outdent","",t.indent],fullScreen:["se-code-view-enabled se-resizing-enabled _se_command_fullScreen",n.toolbar.fullScreen,"fullScreen","",t.expansion],showBlocks:["_se_command_showBlocks",n.toolbar.showBlocks,"showBlocks","",t.show_blocks],codeView:["se-code-view-enabled se-resizing-enabled _se_command_codeView",n.toolbar.codeView,"codeView","",t.code_view],undo:["_se_command_undo se-resizing-enabled",n.toolbar.undo+(l.indexOf("undo")>-1?"":" ("+i+"+Z)"),"undo","",t.undo],redo:["_se_command_redo se-resizing-enabled",n.toolbar.redo+(l.indexOf("undo")>-1?"":" ("+i+"+Y / "+i+"+SHIFT+Z)"),"redo","",t.redo],preview:["se-resizing-enabled",n.toolbar.preview,"preview","",t.preview],print:["se-resizing-enabled",n.toolbar.print,"print","",t.print],save:["_se_command_save se-resizing-enabled",n.toolbar.save,"save","",t.save],blockquote:["",n.toolbar.tag_blockquote,"blockquote","command",t.blockquote],font:["se-btn-select se-btn-tool-font",n.toolbar.font,"font","submenu",''+n.toolbar.font+""+t.arrow_down],formatBlock:["se-btn-select se-btn-tool-format",n.toolbar.formats,"formatBlock","submenu",''+n.toolbar.formats+""+t.arrow_down],fontSize:["se-btn-select se-btn-tool-size",n.toolbar.fontSize,"fontSize","submenu",''+n.toolbar.fontSize+""+t.arrow_down],fontColor:["",n.toolbar.fontColor,"fontColor","submenu",t.font_color],hiliteColor:["",n.toolbar.hiliteColor,"hiliteColor","submenu",t.highlight_color],align:["se-btn-align",n.toolbar.align,"align","submenu",t.align_left],list:["",n.toolbar.list,"list","submenu",t.list_number],horizontalRule:["btn_line",n.toolbar.horizontalRule,"horizontalRule","submenu",t.horizontal_rule],table:["",n.toolbar.table,"table","submenu",t.table],lineHeight:["",n.toolbar.lineHeight,"lineHeight","submenu",t.line_height],template:["",n.toolbar.template,"template","submenu",t.template],paragraphStyle:["",n.toolbar.paragraphStyle,"paragraphStyle","submenu",t.paragraph_style],textStyle:["",n.toolbar.textStyle,"textStyle","submenu",t.text_style],link:["",n.toolbar.link,"link","dialog",t.link],image:["",n.toolbar.image,"image","dialog",t.image],video:["",n.toolbar.video,"video","dialog",t.video],audio:["",n.toolbar.audio,"audio","dialog",t.audio],math:["",n.toolbar.math,"math","dialog",t.math],imageGallery:["",n.toolbar.imageGallery,"imageGallery","fileBrowser",t.image_gallery]}},_createModuleGroup:function(){const e=L.createElement("DIV");e.className="se-btn-module se-btn-module-border";const t=L.createElement("UL");return t.className="se-menu-list",e.appendChild(t),{div:e,ul:t}},_createButton:function(e,t,n,i,l,o,s){const a=L.createElement("LI"),r=L.createElement("BUTTON");return r.setAttribute("type","button"),r.setAttribute("class","se-btn"+(e?" "+e:"")+" se-tooltip"),r.setAttribute("data-command",n),r.setAttribute("data-display",i),r.setAttribute("tabindex","-1"),l||(l='!'),/^default\./i.test(l)&&(l=s[l.replace(/^default\./i,"")]),/^text\./i.test(l)&&(l=l.replace(/^text\./i,""),r.className+=" se-btn-more-text"),l+=''+(t||n)+"",o&&r.setAttribute("disabled",!0),r.innerHTML=l,a.appendChild(r),{li:a,button:r}},_createToolBar:function(e,t,n,i){const l=e.createElement("DIV");l.className="se-toolbar-separator-vertical";const o=e.createElement("DIV");o.className="se-toolbar sun-editor-common";const s=e.createElement("DIV");s.className="se-btn-tray",o.appendChild(s);const a=i.icons,r=this._defaultButtons(i),c={},d=[],u={};if(n){const e=n.length?n:Object.keys(n).map((function(e){return n[e]}));for(let t,n=0,i=e.length;n",b.appendChild(i),i=i.firstElementChild.firstElementChild)}if(_){const e=l.cloneNode(!1);y&&(e.style.float=y),s.appendChild(e)}s.appendChild(p.div),_=!0}else if(/^\/$/.test(v)){const t=e.createElement("DIV");t.className="se-btn-module-enter",s.appendChild(t),_=!1}1===s.children.length&&L.removeClass(s.firstElementChild,"se-btn-module-border"),d.length>0&&d.unshift(t),b.children.length>0&&s.appendChild(b);const v=e.createElement("DIV");v.className="se-menu-tray",o.appendChild(v);const y=e.createElement("DIV");return y.className="se-toolbar-cover",o.appendChild(y),{element:o,plugins:u,pluginCallButtons:c,responsiveButtons:d,_menuTray:v,_buttonTray:s}}};var A=function(e,t,n){return{element:{originElement:e,topArea:t._top,relative:t._relative,toolbar:t._toolBar,_buttonTray:t._toolBar.querySelector(".se-btn-tray"),_menuTray:t._menuTray,resizingBar:t._resizingBar,navigation:t._navigation,charWrapper:t._charWrapper,charCounter:t._charCounter,editorArea:t._editorArea,wysiwygFrame:t._wysiwygArea,wysiwyg:t._wysiwygArea,code:t._codeArea,placeholder:t._placeholder,loading:t._loading,lineBreaker:t._lineBreaker,lineBreaker_t:t._lineBreaker_t,lineBreaker_b:t._lineBreaker_b,resizeBackground:t._resizeBack,_stickyDummy:t._stickyDummy,_arrow:t._arrow},tool:{cover:t._toolBar.querySelector(".se-toolbar-cover"),bold:t._toolBar.querySelector("._se_command_bold"),underline:t._toolBar.querySelector("._se_command_underline"),italic:t._toolBar.querySelector("._se_command_italic"),strike:t._toolBar.querySelector("._se_command_strike"),subscript:t._toolBar.querySelector("._se_command_subscript"),superscript:t._toolBar.querySelector("._se_command_superscript"),undo:t._toolBar.querySelector("._se_command_undo"),redo:t._toolBar.querySelector("._se_command_redo"),save:t._toolBar.querySelector("._se_command_save"),outdent:t._toolBar.querySelector("._se_command_outdent"),indent:t._toolBar.querySelector("._se_command_indent"),fullScreen:t._toolBar.querySelector("._se_command_fullScreen"),showBlocks:t._toolBar.querySelector("._se_command_showBlocks"),codeView:t._toolBar.querySelector("._se_command_codeView")},options:n,option:n}},B={name:"notice",add:function(e){const t=e.context;t.notice={};let n=e.util.createElement("DIV"),i=e.util.createElement("SPAN"),l=e.util.createElement("BUTTON");n.className="se-notice",l.className="close",l.setAttribute("aria-label","Close"),l.setAttribute("title",e.lang.dialogBox.close),l.innerHTML=e.icons.cancel,n.appendChild(i),n.appendChild(l),t.notice.modal=n,t.notice.message=i,l.addEventListener("click",this.onClick_cancel.bind(e)),t.element.editorArea.appendChild(n),n=null},onClick_cancel:function(e){e.preventDefault(),e.stopPropagation(),this.plugins.notice.close.call(this)},open:function(e){this.context.notice.message.textContent=e,this.context.notice.modal.style.display="block"},close:function(){this.context.notice.modal.style.display="none"}},z={init:function(e){return{create:function(t,n){return this.create(t,n,e)}.bind(this)}},create:function(e,t,n){L._propertiesInit(),"object"!=typeof t&&(t={}),n&&(t=[n,t].reduce((function(e,t){for(let n in t)if(L.hasOwn(t,n))if("plugins"===n&&t[n]&&e[n]){let i=e[n],l=t[n];i=i.length?i:Object.keys(i).map((function(e){return i[e]})),l=l.length?l:Object.keys(l).map((function(e){return l[e]})),e[n]=l.filter((function(e){return-1===i.indexOf(e)})).concat(i)}else e[n]=t[n];return e}),{}));const i="string"==typeof e?document.getElementById(e):e;if(!i){if("string"==typeof e)throw Error('[SUNEDITOR.create.fail] The element for that id was not found (ID:"'+e+'")');throw Error("[SUNEDITOR.create.fail] suneditor requires textarea's element or id value")}const l=k.init(i,t);if(l.constructed._top.id&&document.getElementById(l.constructed._top.id))throw Error('[SUNEDITOR.create.fail] The ID of the suneditor you are trying to create already exists (ID:"'+l.constructed._top.id+'")');return function(e,t,n,i,l,o){const s=e.element.originElement.ownerDocument||document,a=s.defaultView||window,r=L,c=l.icons,d={_d:s,_w:a,_parser:new a.DOMParser,_wd:null,_ww:null,_shadowRoot:null,util:r,functions:null,notice:B,icons:c,history:null,context:e,pluginCallButtons:t,plugins:n||{},initPlugins:{},_targetPlugins:{},_menuTray:{},lang:i,effectNode:null,submenu:null,container:null,_submenuName:"",_bindedSubmenuOff:null,_bindedContainerOff:null,submenuActiveButton:null,containerActiveButton:null,controllerArray:[],currentControllerName:"",currentControllerTarget:null,currentFileComponentInfo:null,codeViewDisabledButtons:null,resizingDisabledButtons:null,_moreLayerActiveButton:null,_htmlCheckWhitelistRegExp:null,_disallowedTextTagsRegExp:null,editorTagsWhitelistRegExp:null,pasteTagsWhitelistRegExp:null,hasFocus:!1,isDisabled:!1,_attributesWhitelistRegExp:null,_attributesTagsWhitelist:null,_bindControllersOff:null,_isInline:null,_isBalloon:null,_isBalloonAlways:null,_inlineToolbarAttr:{top:"",width:"",isShow:!1},_notHideToolbar:!1,_sticky:!1,_antiBlur:!1,_lineBreaker:null,_lineBreakerButton:null,_componentsInfoInit:!0,_componentsInfoReset:!1,activePlugins:null,managedTagsInfo:null,_charTypeHTML:!1,_fileInfoPluginsCheck:null,_fileInfoPluginsReset:null,_fileManager:{tags:null,regExp:null,queryString:null,pluginRegExp:null,pluginMap:null},commandMap:null,_styleCommandMap:null,_defaultCommand:{bold:"STRONG",underline:"U",italic:"EM",strike:"DEL",subscript:"SUB",superscript:"SUP"},_variable:{isCodeView:!1,isFullScreen:!1,innerHeight_fullScreen:0,resizeClientY:0,tabSize:4,codeIndent:4,minResizingSize:r.getNumber(e.element.wysiwygFrame.style.minHeight||"65",0),currentNodes:[],currentNodesMap:[],_range:null,_selectionNode:null,_originCssText:e.element.topArea.style.cssText,_bodyOverflow:"",_editorAreaOriginCssText:"",_wysiwygOriginCssText:"",_codeOriginCssText:"",_fullScreenAttrs:{sticky:!1,balloon:!1,inline:!1},_lineBreakComp:null,_lineBreakDir:""},callPlugin:function(e,n,i){if(i=i||t[e],!this.plugins[e])throw Error('[SUNEDITOR.core.callPlugin.fail] The called plugin does not exist or is in an invalid format. (pluginName:"'+e+'")');this.initPlugins[e]?"object"==typeof this._targetPlugins[e]&&i&&this.initMenuTarget(e,i,this._targetPlugins[e]):(this.plugins[e].add(this,i),this.initPlugins[e]=!0),this.plugins[e].active&&!this.commandMap[e]&&i&&(this.commandMap[e]=i,this.activePlugins.push(e)),"function"==typeof n&&n()},addModule:function(e){for(let t,n=0,i=e.length;nb?(n.style.height=l+"px",e=-1*(l-g+3)):(n.style.height=b+"px",e=g+t.parentElement.offsetHeight),n.style.top=e+"px"}else n.style.top=g+t.parentElement.offsetHeight+"px";n.style.visibility=""},controllersOn:function(){this._bindControllersOff&&this._bindControllersOff(),this.controllerArray=[];for(let e,t=0;t0){for(let e=0;e":n),this.history.push(!0)},nativeFocus:function(){const t=r.getParentElement(this.getSelectionNode(),"figcaption");t?t.focus():e.element.wysiwyg.focus(),this._editorRange()},focus:function(){if("none"!==e.element.wysiwygFrame.style.display){if(l.iframe)this.nativeFocus();else try{const t=this.getRange();if(t.startContainer===t.endContainer&&r.isWysiwygDiv(t.startContainer)){const t=r.createElement("P"),n=r.createElement("BR");t.appendChild(n),e.element.wysiwyg.appendChild(t),this.setRange(n,0,n,0)}else this.setRange(t.startContainer,t.startOffset,t.endContainer,t.endOffset)}catch(e){this.nativeFocus()}u._applyTagEffects(),this._isBalloon&&u._toggleToolbarBalloon()}},focusEdge:function(t){t||(t=e.element.wysiwyg.lastElementChild);const n=this.getFileComponent(t);n?this.selectComponent(n.target,n.pluginName):t?(t=r.getChildElement(t,(function(e){return 0===e.childNodes.length||3===e.nodeType}),!0))?this.setRange(t,t.textContent.length,t,t.textContent.length):this.nativeFocus():this.focus()},setRange:function(e,t,n,i){if(!e||!n)return;t>e.textContent.length&&(t=e.textContent.length),i>n.textContent.length&&(i=n.textContent.length);const o=this._wd.createRange();try{o.setStart(e,t),o.setEnd(n,i)}catch(e){return console.warn("[SUNEDITOR.core.focus.error] "+e),void this.nativeFocus()}const s=this.getSelection();return s.removeAllRanges&&s.removeAllRanges(),s.addRange(o),this._editorRange(),l.iframe&&this.nativeFocus(),o},removeRange:function(){this._variable._range=null,this._variable._selectionNode=null,this.getSelection().removeAllRanges();const e=this.commandMap,t=this.activePlugins;for(let i in e)r.hasOwn(e,i)&&(t.indexOf(i)>-1?n[i].active.call(this,null):e.OUTDENT&&/^OUTDENT$/i.test(i)?e.OUTDENT.setAttribute("disabled",!0):e.INDENT&&/^INDENT$/i.test(i)?e.INDENT.removeAttribute("disabled"):r.removeClass(e[i],"active"))},getRange:function(){const t=this._variable._range||this._createDefaultRange(),n=this.getSelection();if(t.collapsed===n.isCollapsed||!e.element.wysiwyg.contains(n.focusNode))return t;if(n.rangeCount>0)return this._variable._range=n.getRangeAt(0),this._variable._range;{const e=n.anchorNode,t=n.focusNode,i=n.anchorOffset,l=n.focusOffset,o=r.compareElements(e,t),s=o.ancestor&&(0===o.result?i<=l:o.result>1);return this.setRange(s?e:t,s?i:l,s?t:e,s?l:i)}},getRange_addLine:function(t){if(this._selectionVoid(t)){const n=e.element.wysiwyg,i=r.createElement("P");i.innerHTML="
    ",n.insertBefore(i,n.firstElementChild),this.setRange(i.firstElementChild,0,i.firstElementChild,1),t=this._variable._range}return t},getSelection:function(){return this._shadowRoot&&this._shadowRoot.getSelection?this._shadowRoot.getSelection():this._ww.getSelection()},getSelectionNode:function(){if(r.isWysiwygDiv(this._variable._selectionNode)&&this._editorRange(),!this._variable._selectionNode){const t=r.getChildElement(e.element.wysiwyg.firstChild,(function(e){return 0===e.childNodes.length||3===e.nodeType}),!1);if(t)return this._variable._selectionNode=t,t;this._editorRange()}return this._variable._selectionNode},_editorRange:function(){const e=this.getSelection();if(!e)return null;let t=null,n=null;t=e.rangeCount>0?e.getRangeAt(0):this._createDefaultRange(),this._variable._range=t,n=t.collapsed?t.commonAncestorContainer:e.extentNode||e.anchorNode,this._variable._selectionNode=n},_createDefaultRange:function(){const t=e.element.wysiwyg;t.focus();const n=this._wd.createRange();let i=t.firstElementChild;return i||(i=r.createElement("P"),i.innerHTML="
    ",t.appendChild(i)),n.setStart(i,0),n.setEnd(i,0),n},_selectionVoid:function(e){const t=e.commonAncestorContainer;return r.isWysiwygDiv(e.startContainer)&&r.isWysiwygDiv(e.endContainer)||/FIGURE/i.test(t.nodeName)||this._fileManager.regExp.test(t.nodeName)||r.isMediaComponent(t)},_resetRangeToTextNode:function(){const t=this.getRange();if(this._selectionVoid(t))return!1;let n,i,l,o=t.startContainer,s=t.startOffset,a=t.endContainer,c=t.endOffset;if(r.isFormatElement(o)&&(o=o.childNodes[s]||o.lastChild,s=o.textContent.length),r.isFormatElement(a)&&(a=a.childNodes[c]||a.lastChild,c=a.textContent.length),n=r.isWysiwygDiv(o)?e.element.wysiwyg.firstChild:o,i=s,r.isBreak(n)||1===n.nodeType&&n.childNodes.length>0){const e=r.isBreak(n);if(!e){for(;n&&!r.isBreak(n)&&1===n.nodeType;)n=n.childNodes[i]||n.nextElementSibling||n.nextSibling,i=0;let e=r.getFormatElement(n,null);e===r.getRangeFormatElement(e,null)&&(e=r.createElement(r.getParentElement(n,r.isCell)?"DIV":"P"),n.parentNode.insertBefore(e,n),e.appendChild(n))}if(r.isBreak(n)){const t=r.createTextNode(r.zeroWidthSpace);n.parentNode.insertBefore(t,n),n=t,e&&o===a&&(a=n,c=1)}}if(o=n,s=i,n=r.isWysiwygDiv(a)?e.element.wysiwyg.lastChild:a,i=c,r.isBreak(n)||1===n.nodeType&&n.childNodes.length>0){const e=r.isBreak(n);if(!e){for(;n&&!r.isBreak(n)&&1===n.nodeType&&(l=n.childNodes,0!==l.length);)n=l[i>0?i-1:i]||!/FIGURE/i.test(l[0].nodeName)?l[0]:n.previousElementSibling||n.previousSibling||o,i=i>0?n.textContent.length:i;let e=r.getFormatElement(n,null);e===r.getRangeFormatElement(e,null)&&(e=r.createElement(r.isCell(e)?"DIV":"P"),n.parentNode.insertBefore(e,n),e.appendChild(n))}if(r.isBreak(n)){const t=r.createTextNode(r.zeroWidthSpace);n.parentNode.insertBefore(t,n),n=t,i=1,e&&!n.previousSibling&&r.removeItem(a)}}return a=n,c=i,this.setRange(o,s,a,c),!0},getSelectedElements:function(t){if(!this._resetRangeToTextNode())return[];let n=this.getRange();if(r.isWysiwygDiv(n.startContainer)){const t=e.element.wysiwyg.children;if(0===t.length)return[];this.setRange(t[0],0,t[t.length-1],t[t.length-1].textContent.trim().length),n=this.getRange()}const i=n.startContainer,l=n.endContainer,o=n.commonAncestorContainer,s=r.getListChildren(o,(function(e){return t?t(e):r.isFormatElement(e)}));if(r.isWysiwygDiv(o)||r.isRangeFormatElement(o)||s.unshift(r.getFormatElement(o,null)),i===l||1===s.length)return s;let a=r.getFormatElement(i,null),c=r.getFormatElement(l,null),d=null,u=null;const h=function(e){return!r.isTable(e)||/^TABLE$/i.test(e.nodeName)};let g=r.getRangeFormatElement(a,h),p=r.getRangeFormatElement(c,h);r.isTable(g)&&r.isListCell(g.parentNode)&&(g=g.parentNode),r.isTable(p)&&r.isListCell(p.parentNode)&&(p=p.parentNode);const m=g===p;for(let e,t=0,n=s.length;t=0;n--)if(i[n].contains(i[e])){i.splice(e,1),e--,t--;break}return i},isEdgePoint:function(e,t){return 0===t||!e.nodeValue&&1===t||t===e.nodeValue.length},showLoading:function(){e.element.loading.style.display="block"},closeLoading:function(){e.element.loading.style.display="none"},appendFormatTag:function(e,t){const n=r.getFormatElement(this.getSelectionNode(),null),i=t?"string"==typeof t?t:t.nodeName:r.isFormatElement(n)&&!r.isFreeFormatElement(n)?n.nodeName:"P",l=r.createElement(i);return l.innerHTML="
    ",(t&&"string"!=typeof t||!t&&r.isFormatElement(n))&&r.copyTagAttributes(l,t||n),r.isCell(e)?e.insertBefore(l,e.nextElementSibling):e.parentNode.insertBefore(l,e.nextElementSibling),l},insertComponent:function(e,t,n,i){if(n&&!this.checkCharCount(e,null))return null;const l=this.removeNode();this.getRange_addLine(this.getRange());let o=null,s=this.getSelectionNode(),a=r.getFormatElement(s,null);if(r.isListCell(a))this.insertNode(e,s===a?null:l.container.nextSibling,!1),e.nextSibling||e.parentNode.appendChild(r.createElement("BR"));else{if(this.getRange().collapsed&&(3===l.container.nodeType||r.isBreak(l.container))){const e=r.getParentElement(l.container,function(e){return this.isRangeFormatElement(e)}.bind(r));o=r.splitElement(l.container,l.offset,e?r.getElementDepth(e)+1:0),o&&(a=o.previousSibling)}this.insertNode(e,a,!1),a&&r.onlyZeroWidthSpace(a)&&r.removeItem(a)}if(!i){const t=this.getFileComponent(e);t?this.selectComponent(t.target,t.pluginName):o&&(o=r.getEdgeChildNodes(o,null).sc||o,this.setRange(o,0,o,0))}return t||this.history.push(1),o||e},getFileComponent:function(e){if(!this._fileManager.queryString||!e)return null;let t,n;return(/^FIGURE$/i.test(e.nodeName)||/se-component/.test(e.className))&&(t=e.querySelector(this._fileManager.queryString)),!t&&e.nodeName&&this._fileManager.regExp.test(e.nodeName)&&(t=e),t&&(n=this._fileManager.pluginMap[t.nodeName.toLowerCase()],n)?{target:t,component:r.getParentElement(t,r.isComponent),pluginName:n}:null},selectComponent:function(e,t){this.hasFocus||this.focus();const n=this.plugins[t];n&&a.setTimeout(function(){"function"==typeof n.select&&this.callPlugin(t,n.select.bind(this,e),null),this._setComponentLineBreaker(e)}.bind(this))},_setComponentLineBreaker:function(t){this._lineBreaker.style.display="none";const n=r.getParentElement(t,r.isComponent),i=e.element.lineBreaker_t.style,l=e.element.lineBreaker_b.style,o="block"===this.context.resizing.resizeContainer.style.display?this.context.resizing.resizeContainer:t,s=r.isListCell(n.parentNode);let a,c,d;(s?n.previousSibling:r.isFormatElement(n.previousElementSibling))?i.display="none":(this._variable._lineBreakComp=n,c=e.element.wysiwyg.scrollTop,a=r.getOffset(t,e.element.wysiwygFrame).top+c,d=o.offsetWidth/2/2,i.top=a-c-12+"px",i.left=r.getOffset(o).left+d+"px",i.display="block"),(s?n.nextSibling:r.isFormatElement(n.nextElementSibling))?l.display="none":(a||(this._variable._lineBreakComp=n,c=e.element.wysiwyg.scrollTop,a=r.getOffset(t,e.element.wysiwygFrame).top+c,d=o.offsetWidth/2/2),l.top=a+o.offsetHeight-c-12+"px",l.left=r.getOffset(o).left+o.offsetWidth-d-24+"px",l.display="block")},insertNode:function(e,t,n){if(n&&!this.checkCharCount(e,null))return null;const i=r.getFreeFormatElement(this.getSelectionNode(),null),l=!i&&(r.isFormatElement(e)||r.isRangeFormatElement(e))||r.isComponent(e);if(!t&&l){const e=this.removeNode();if(3===e.container.nodeType||r.isBreak(e.container)){const n=r.getParentElement(e.container,function(e){return this.isRangeFormatElement(e)||this.isListCell(e)}.bind(r));(t=r.splitElement(e.container,e.offset,n?r.getElementDepth(n)+1:0))&&(t=t.previousSibling)}}const o=t||l?this.getRange():this.getRange_addLine(this.getRange()),s=o.commonAncestorContainer,a=o.startOffset,c=o.endOffset,d=o.startContainer===s&&r.isFormatElement(s),u=d?s.childNodes[a]:o.startContainer,h=d?s.childNodes[c]:o.endContainer;let g,p=null;if(t)g=t.parentNode,t=t.nextSibling,p=!0;else if(g=u,3===u.nodeType&&(g=u.parentNode),o.collapsed)if(3===s.nodeType)t=s.textContent.length>c?s.splitText(c):s.nextSibling;else if(r.isBreak(g))t=g,g=g.parentNode;else{let n=g.childNodes[a];const i=n&&3===n.nodeType&&r.onlyZeroWidthSpace(n)&&r.isBreak(n.nextSibling)?n.nextSibling:n;i?i.nextSibling?t=r.isBreak(i)&&!r.isBreak(e)?i:i.nextSibling:(g.removeChild(i),t=null):t=null}else{if(u===h){t=this.isEdgePoint(h,c)?h.nextSibling:h.splitText(c);let e=u;this.isEdgePoint(u,a)||(e=u.splitText(a)),g.removeChild(e),0===g.childNodes.length&&l&&(g.innerHTML="
    ")}else{const e=this.removeNode(),n=e.container,i=e.prevContainer;if(n&&0===n.childNodes.length&&l&&(r.isFormatElement(n)?n.innerHTML="
    ":r.isRangeFormatElement(n)&&(n.innerHTML="


    ")),!l&&i)if(g=3===i.nodeType?i.parentNode:i,g.contains(n))for(t=n;t.parentNode===g;)t=t.parentNode;else t=null;else g=l?s:n,t=l?h:null;for(;t&&!r.isFormatElement(t)&&t.parentNode!==s;)t=t.parentNode}}try{if(r.isFormatElement(e)||r.isRangeFormatElement(e)||!r.isListCell(g)&&r.isComponent(e)){const e=g;if(r.isList(t))g=t,t=null;else if(r.isListCell(t))g=t.previousElementSibling||t;else if(!p&&!t){const e=this.removeNode(),n=3===e.container.nodeType?r.isListCell(r.getFormatElement(e.container,null))?e.container:r.getFormatElement(e.container,null)||e.container.parentNode:e.container,i=r.isWysiwygDiv(n)||r.isRangeFormatElement(n);g=i?n:n.parentNode,t=i?null:n.nextSibling}0===e.childNodes.length&&g!==e&&r.removeItem(e)}!l||i||r.isRangeFormatElement(g)||r.isListCell(g)||r.isWysiwygDiv(g)||(t=g.nextElementSibling,g=g.parentNode),g.insertBefore(e,g===t?g.lastChild:t)}catch(t){g.appendChild(e)}finally{if(i&&(r.isFormatElement(e)||r.isRangeFormatElement(e))&&(e=this._setIntoFreeFormat(e)),!r.isComponent(e)){let t=1;if(3===e.nodeType){const t=e.previousSibling,n=e.nextSibling,i=!t||1===t.nodeType||r.onlyZeroWidthSpace(t)?"":t.textContent,l=!n||1===n.nodeType||r.onlyZeroWidthSpace(n)?"":n.textContent;t&&i.length>0&&(e.textContent=i+e.textContent,r.removeItem(t)),n&&n.length>0&&(e.textContent+=l,r.removeItem(n));const o={container:e,startOffset:i.length,endOffset:e.textContent.length-l.length};return this.setRange(e,o.startOffset,e,o.endOffset),o}if(!r.isBreak(e)&&r.isFormatElement(g)){let n=null;e.previousSibling||(n=r.createTextNode(r.zeroWidthSpace),e.parentNode.insertBefore(n,e)),e.nextSibling||(n=r.createTextNode(r.zeroWidthSpace),e.parentNode.appendChild(n)),r._isIgnoreNodeChange(e)&&(e=e.nextSibling,t=0)}this.setRange(e,t,e,t)}return this.history.push(!0),e}},_setIntoFreeFormat:function(e){const t=e.parentNode;let n,i;for(;r.isFormatElement(e)||r.isRangeFormatElement(e);){for(n=e.childNodes,i=null;n[0];)if(i=n[0],r.isFormatElement(i)||r.isRangeFormatElement(i)){if(this._setIntoFreeFormat(i),!e.parentNode)break;n=e.childNodes}else t.insertBefore(i,e);0===e.childNodes.length&&r.removeItem(e),e=r.createElement("BR"),t.insertBefore(e,i.nextSibling)}return e},removeNode:function(){this._resetRangeToTextNode()||console.warn('[SUNEDITOR.core.removeNode.exception] An exception occurred while resetting the "Range" object.');const t=this.getRange();let n,i=0,l=t.startContainer,o=t.endContainer;const s=t.startOffset,a=t.endOffset,c=t.commonAncestorContainer;let d=null,u=null;const h=r.getListChildNodes(c,null);let g=r.getArrayIndex(h,l),p=r.getArrayIndex(h,o);if(h.length>0&&g>-1&&p>-1){for(let e=g+1,t=l;e>=0;e--)h[e]===t.parentNode&&h[e].firstChild===t&&0===s&&(g=e,t=t.parentNode);for(let e=p-1,t=o;e>g;e--)h[e]===t.parentNode&&1===h[e].nodeType&&(h.splice(e,1),t=t.parentNode,--p)}else{if(0===h.length){if(r.isFormatElement(c)||r.isRangeFormatElement(c)||r.isWysiwygDiv(c)||r.isBreak(c)||r.isMedia(c))return{container:c,offset:0};h.push(c),l=o=c}else if(l=o=h[0],r.isBreak(l)||r.onlyZeroWidthSpace(l))return{container:l,offset:0};g=p=0}function m(e){const t=r.getFormatElement(e,null);if(r.removeItem(e),r.isListCell(t)){const e=r.getArrayItem(t.children,r.isList,!1);if(e){const n=e.firstElementChild,i=n.childNodes;for(;i[0];)t.insertBefore(i[0],e);r.removeItemAllParents(n,null,null)}}}for(let e=g;e<=p;e++){const t=h[e];if(0===t.length||3===t.nodeType&&void 0===t.data)m(t);else if(t!==l)t!==o?m(t):(u=1===o.nodeType?r.createTextNode(o.textContent):r.createTextNode(o.substringData(a,o.length-a)),u.length>0?o.data=u.data:m(o));else if(1===l.nodeType?d=r.createTextNode(l.textContent):t===o?(d=r.createTextNode(l.substringData(0,s)+o.substringData(a,o.length-a)),i=s):d=r.createTextNode(l.substringData(0,s)),d.length>0?l.data=d.data:m(l),t===o)break}if(n=o&&o.parentNode?o:l&&l.parentNode?l:t.endContainer||t.startContainer,!r.isWysiwygDiv(n)){const t=r.removeItemAllParents(n,function(e){if(this.isComponent(e))return!1;const t=e.textContent;return 0===t.length||/^(\n|\u200B)+$/.test(t)}.bind(r),null);t&&(n=t.sc||t.ec||e.element.wysiwyg)}return this.setRange(n,i,n,i),this.history.push(!0),{container:n,offset:i,prevContainer:l&&l.parentNode?l:null}},applyRangeFormatElement:function(e){this.getRange_addLine(this.getRange());const t=this.getSelectedElementsAndComponents(!1);if(!t||0===t.length)return;e:for(let e,n,i,l,o,s,a=0,c=t.length;a-1&&(l=n.lastElementChild,t.indexOf(l)>-1)){let e=null;for(;e=l.lastElementChild;)if(r.isList(e)){if(!(t.indexOf(e.lastElementChild)>-1))continue e;l=e.lastElementChild}i=n.firstElementChild,o=t.indexOf(i),s=t.indexOf(l),t.splice(o,s-o+1),c=t.length}else;let n,i,l,o=t[t.length-1];n=r.isRangeFormatElement(o)||r.isFormatElement(o)?o:r.getRangeFormatElement(o,null)||r.getFormatElement(o,null),r.isCell(n)?(i=null,l=n):(i=n.nextSibling,l=n.parentNode);let s=r.getElementDepth(n),a=null;const c=[],d=function(e,t,n){let i=null;if(e!==t&&!r.isTable(t)){if(t&&r.getElementDepth(e)===r.getElementDepth(t))return n;i=r.removeItemAllParents(t,null,e)}return i?i.ec:n};for(let n,o,u,h,g,p,m,f=0,_=t.length;f<_;f++)if(n=t[f],o=n.parentNode,o&&!e.contains(o))if(u=r.getElementDepth(n),r.isList(o)){if(null===a&&(p?(a=p,m=!0,p=null):a=o.cloneNode(!1)),c.push(n),g=t[f+1],f===_-1||g&&g.parentNode!==o){g&&n.contains(g.parentNode)&&(p=g.parentNode.cloneNode(!1));let t,f=o.parentNode;for(;r.isList(f);)t=r.createElement(f.nodeName),t.appendChild(a),a=t,f=f.parentNode;const _=this.detachRangeFormatElement(o,c,null,!0,!0);s>=u?(s=u,l=_.cc,i=d(l,o,_.ec),i&&(l=i.parentNode)):l===_.cc&&(i=_.ec),l!==_.cc&&(h=d(l,_.cc,h),i=void 0!==h?h:_.cc);for(let e=0,t=_.removeArray.length;e=u&&(s=u,l=o,i=n.nextSibling),e.appendChild(n),l!==o&&(h=d(l,o),void 0!==h&&(i=h));if(this.effectNode=null,r.mergeSameTags(e,null,!1),r.mergeNestedTags(e,function(e){return this.isList(e)}.bind(r)),i&&r.getElementDepth(i)>0&&(r.isList(i.parentNode)||r.isList(i.parentNode.parentNode))){const t=r.getParentElement(i,function(e){return this.isRangeFormatElement(e)&&!this.isList(e)}.bind(r)),n=r.splitElement(i,null,t?r.getElementDepth(t)+1:0);n.parentNode.insertBefore(e,n)}else l.insertBefore(e,i),d(e,i);const u=r.getEdgeChildNodes(e.firstElementChild,e.lastElementChild);t.length>1?this.setRange(u.sc,0,u.ec,u.ec.textContent.length):this.setRange(u.ec,u.ec.textContent.length,u.ec,u.ec.textContent.length),this.history.push(!1)},detachRangeFormatElement:function(e,t,n,i,l){const o=this.getRange(),s=o.startOffset,a=o.endOffset;let c=r.getListChildNodes(e,(function(t){return t.parentNode===e})),d=e.parentNode,u=null,h=null,g=e.cloneNode(!1);const p=[],m=r.isList(n);let f=!1,_=!1,b=!1;function v(t,n,i,l){if(r.onlyZeroWidthSpace(n)&&(n.innerHTML=r.zeroWidthSpace),3===n.nodeType)return t.insertBefore(n,i),n;const o=(b?n:l).childNodes;let s=n.cloneNode(!1),a=null,c=null;for(;o[0];)c=o[0],!r._notTextNode(c)||r.isBreak(c)||r.isListCell(s)?s.appendChild(c):(s.childNodes.length>0&&(a||(a=s),t.insertBefore(s,i),s=n.cloneNode(!1)),t.insertBefore(c,i),a||(a=c));if(s.childNodes.length>0){if(r.isListCell(t)&&r.isListCell(s)&&r.isList(i))if(m){for(a=i;i;)s.appendChild(i),i=i.nextSibling;t.parentNode.insertBefore(s,t.nextElementSibling)}else{const t=l.nextElementSibling,n=r.detachNestedList(l,!1);if(e!==n||t!==l.nextElementSibling){const t=s.childNodes;for(;t[0];)l.appendChild(t[0]);e=n,_=!0}}else t.insertBefore(s,i);a||(a=s)}return a}for(let l,o,s,a=0,y=c.length;a0&&(d.insertBefore(g,e),g=null),!m&&r.isListCell(l))if(s&&r.getElementDepth(l)!==r.getElementDepth(s)&&(r.isListCell(d)||r.getArrayItem(l.children,r.isList,!1))){const t=l.nextElementSibling,n=r.detachNestedList(l,!1);e===n&&t===l.nextElementSibling||(e=n,_=!0)}else{const t=l;l=r.createElement(i?t.nodeName:r.isList(e.parentNode)||r.isListCell(e.parentNode)?"LI":r.isCell(e.parentNode)?"DIV":"P");const n=r.isListCell(l),o=t.childNodes;for(;o[0]&&(!r.isList(o[0])||n);)l.appendChild(o[0]);r.copyFormatAttributes(l,t),b=!0}else l=l.cloneNode(!1);if(!_&&(i?(p.push(l),r.removeItem(c[a])):(n?(f||(d.insertBefore(n,e),f=!0),l=v(n,l,null,c[a])):l=v(d,l,e,c[a]),_||(t?(h=l,u||(u=l)):u||(u=h=l))),_)){_=b=!1,c=r.getListChildNodes(e,(function(t){return t.parentNode===e})),g=e.cloneNode(!1),d=e.parentNode,a=-1,y=c.length;continue}}const y=e.parentNode;let C=e.nextSibling;g&&g.children.length>0&&y.insertBefore(g,C),n?u=n.previousSibling:u||(u=e.previousSibling),C=e.nextSibling,0===e.children.length||0===e.textContent.length?r.removeItem(e):r.removeEmptyNode(e,null);let w=null;if(i)w={cc:y,sc:u,ec:C,removeArray:p};else{u||(u=h),h||(h=u);const e=r.getEdgeChildNodes(u,h.parentNode?u:h);w={cc:(e.sc||e.ec).parentNode,sc:e.sc,ec:e.ec}}if(this.effectNode=null,l)return w;!i&&w&&(t?this.setRange(w.sc,s,w.ec,a):this.setRange(w.sc,0,w.sc,0)),this.history.push(!1)},detachList:function(e,t){let n={},i=!1,l=!1,o=null,s=null;const a=function(e){return!this.isComponent(e)}.bind(r);for(let c,d,u,h,g=0,p=e.length;g0)&&t,n=!!(n&&n.length>0)&&n;const o=!e,s=o&&!n&&!t;let c=l.startContainer,d=l.startOffset,u=l.endContainer,h=l.endOffset;if(s&&l.collapsed&&r.isFormatElement(c.parentNode)&&r.isFormatElement(u.parentNode)||c===u&&1===c.nodeType&&r.isNonEditable(c))return;if(l.collapsed&&!s&&1===c.nodeType&&!r.isBreak(c)&&!r.isComponent(c)){let e=null;const t=c.childNodes[d];t&&(e=t.nextSibling?r.isBreak(t)?t:t.nextSibling:null);const n=r.createTextNode(r.zeroWidthSpace);c.insertBefore(n,e),this.setRange(n,1,n,1),l=this.getRange(),c=l.startContainer,d=l.startOffset,u=l.endContainer,h=l.endOffset}r.isFormatElement(c)&&(c=c.childNodes[d]||c.firstChild,d=0),r.isFormatElement(u)&&(u=u.childNodes[h]||u.lastChild,h=u.textContent.length),o&&(e=r.createElement("DIV"));const g=a.RegExp,p=e.nodeName;if(!s&&c===u&&!n&&e){let t=c,n=0;const i=[],l=e.style;for(let e=0,t=l.length;e0){for(;!r.isFormatElement(t)&&!r.isWysiwygDiv(t);){for(let l=0;l=i.length)return}}let m,f={},_={},b="",v="",y="";if(t){for(let e,n=0,i=t.length;n0&&(a=l.replace(b,"").trim(),a!==l&&(w.v=!0));const c=t.className;let d="";return v&&c.length>0&&(d=c.replace(v,"").trim(),d!==c&&(w.v=!0)),(!o||!v&&c||!b&&l||a||d||!n)&&(a||d||t.nodeName!==p||C(b)!==C(l)||C(v)!==C(c))?(b&&l.length>0&&(t.style.cssText=a),t.style.cssText||t.removeAttribute("style"),v&&c.length>0&&(t.className=d.trim()),t.className.trim()||t.removeAttribute("class"),t.style.cssText||t.className||t.nodeName!==p&&!n?t:(w.v=!0,null)):(w.v=!0,null)},E=this.getSelectedElements(null);l=this.getRange(),c=l.startContainer,d=l.startOffset,u=l.endContainer,h=l.endOffset,r.getFormatElement(c,null)||(c=r.getChildElement(E[0],(function(e){return 3===e.nodeType}),!1),d=0),r.getFormatElement(u,null)||(u=r.getChildElement(E[E.length-1],(function(e){return 3===e.nodeType}),!1),h=u.textContent.length);const S=r.getFormatElement(c,null)===r.getFormatElement(u,null),N=E.length-(S?0:1);m=e.cloneNode(!1);const T=s||o&&function(e){for(let t=0,n=e.length;t0&&(m=e.cloneNode(!1),_=this._nodeChange_endLine(E[N],m,x,u,h,s,o,w,k,A));for(let t,n=N-1;n>0;n--)m=e.cloneNode(!1),t=this._nodeChange_middleLine(E[n],m,x,s,o,w,_.container),t.endContainer&&(_.ancestor=null,_.container=t.endContainer),this._setCommonListStyle(t.ancestor,null);m=e.cloneNode(!1),f=this._nodeChange_startLine(E[0],m,x,c,d,s,o,w,k,A,_.container),f.endContainer&&(_.ancestor=null,_.container=f.endContainer),N<=0?_=f:_.container||(_.ancestor=null,_.container=f.container,_.offset=f.container.textContent.length),this._setCommonListStyle(f.ancestor,null),this._setCommonListStyle(_.ancestor||r.getFormatElement(_.container),null)}this.controllersOff(),this.setRange(f.container,f.offset,_.container,_.offset),this.history.push(!1)},_setCommonListStyle:function(e,t){if(!r.isListCell(e))return;t||e.removeAttribute("style");const n=r.getArrayItem((t||e).childNodes,(function(e){return!r.isBreak(e)&&!r.onlyZeroWidthSpace(e.textContent.trim())}),!0);if(n[0]&&1===n.length){if(!(t=n[0])||1!==t.nodeType)return;const i=t.style,l=e.style;/STRONG/i.test(t.nodeName)?l.fontWeight="bold":i.fontWeight&&(l.fontWeight=i.fontWeight),i.color&&(l.color=i.color),i.fontSize&&(l.fontSize=i.fontSize),this._setCommonListStyle(e,t)}},_stripRemoveNode:function(e){const t=e.parentNode;if(!e||3===e.nodeType||!t)return;const n=e.childNodes;for(;n[0];)t.insertBefore(n[0],e);t.removeChild(e)},_util_getMaintainedNode:function(e,t,n){return!n||e?null:this.getParentElement(n,this._isMaintainedNode.bind(this))||(t?null:this.getParentElement(n,this._isSizeNode.bind(this)))},_util_isMaintainedNode:function(e,t,n){if(!n||e||1!==n.nodeType)return!1;const i=this._isMaintainedNode(n);return this.getParentElement(n,this._isMaintainedNode.bind(this))?i:i||!t&&this._isSizeNode(n)},_nodeChange_oneLine:function(e,t,n,i,l,o,s,c,d,u,h,g,p){let m=i.parentNode;for(;!(m.nextSibling||m.previousSibling||r.isFormatElement(m.parentNode)||r.isWysiwygDiv(m.parentNode))&&m.nodeName!==t.nodeName;)m=m.parentNode;if(!d&&m===o.parentNode&&m.nodeName===t.nodeName&&r.onlyZeroWidthSpace(i.textContent.slice(0,l))&&r.onlyZeroWidthSpace(o.textContent.slice(s))){const e=m.childNodes;let n=!0;for(let t,l,s,a,c=0,d=e.length;c0&&(n=t.test(e.style.cssText)),!n}if(function e(i,l){const o=i.childNodes;for(let i,s=0,a=o.length;s=N?L-N:S.data.length-N));if(E){const t=g(l);if(t&&t.parentNode!==e){let n=t,i=null;for(;n.parentNode!==e;){for(l=i=n.parentNode.cloneNode(!1);n.childNodes[0];)i.appendChild(n.childNodes[0]);n.appendChild(i),n=n.parentNode}n.parentNode.appendChild(t)}E=E.cloneNode(!1)}r.onlyZeroWidthSpace(o)||l.appendChild(o);const c=g(l);for(c&&(E=c),E&&(e=E),C=a,y=[],x="";C!==e&&C!==f&&null!==C;)i=p(C)?null:n(C),i&&1===C.nodeType&&z(C)&&(y.push(i),x+=C.style.cssText.substr(0,C.style.cssText.indexOf(":"))+"|"),C=C.parentNode;const d=y.pop()||s;for(w=C=d;y.length>0;)C=y.pop(),w.appendChild(C),w=C;if(t.appendChild(d),e.appendChild(t),E&&!g(T)&&(t=t.cloneNode(!1),b.appendChild(t),_.push(t)),S=s,N=0,k=!0,C!==s&&C.appendChild(S),!v)continue}if(A||a!==T){if(k){if(1===a.nodeType&&!r.isBreak(a)){r._isIgnoreNodeChange(a)?(b.appendChild(a.cloneNode(!0)),u||(t=t.cloneNode(!1),b.appendChild(t),_.push(t))):e(a,a);continue}C=a,y=[],x="";const o=[];for(;null!==C.parentNode&&C!==f&&C!==t;)i=A?C.cloneNode(!1):n(C),1===C.nodeType&&!r.isBreak(a)&&i&&z(C)&&(p(C)?E||o.push(i):y.push(i),x+=C.style.cssText.substr(0,C.style.cssText.indexOf(":"))+"|"),C=C.parentNode;y=y.concat(o);const s=y.pop()||a;for(w=C=s;y.length>0;)C=y.pop(),w.appendChild(C),w=C;if(p(t.parentNode)&&!p(s)&&(t=t.cloneNode(!1),b.appendChild(t),_.push(t)),A||E||!p(s))s===a?l=A?b:t:A?(b.appendChild(s),l=C):(t.appendChild(s),l=C);else{t=t.cloneNode(!1);const e=s.childNodes;for(let n=0,i=e.length;n0?C:t}if(E&&3===a.nodeType)if(g(a)){const e=r.getParentElement(l,function(e){return this._isMaintainedNode(e.parentNode)||e.parentNode===b}.bind(r));E.appendChild(e),t=e.cloneNode(!1),_.push(t),b.appendChild(t)}else E=null}d=a.cloneNode(!1),l.appendChild(d),1!==a.nodeType||r.isBreak(a)||(h=d),e(a,h)}else{E=g(a);const e=r.createTextNode(1===T.nodeType?"":T.substringData(L,T.length-L)),l=r.createTextNode(v||1===T.nodeType?"":T.substringData(0,L));if(E?E=E.cloneNode(!1):p(t.parentNode)&&!E&&(t=t.cloneNode(!1),b.appendChild(t),_.push(t)),!r.onlyZeroWidthSpace(e)){C=a,x="",y=[];const t=[];for(;C!==b&&C!==f&&null!==C;)1===C.nodeType&&z(C)&&(p(C)?t.push(C.cloneNode(!1)):y.push(C.cloneNode(!1)),x+=C.style.cssText.substr(0,C.style.cssText.indexOf(":"))+"|"),C=C.parentNode;for(y=y.concat(t),d=w=C=y.pop()||e;y.length>0;)C=y.pop(),w.appendChild(C),w=C;b.appendChild(d),C.textContent=e.data}if(E&&d){const e=g(d);e&&(E=e)}for(C=a,y=[],x="";C!==b&&C!==f&&null!==C;)i=p(C)?null:n(C),i&&1===C.nodeType&&z(C)&&(y.push(i),x+=C.style.cssText.substr(0,C.style.cssText.indexOf(":"))+"|"),C=C.parentNode;const o=y.pop()||l;for(w=C=o;y.length>0;)C=y.pop(),w.appendChild(C),w=C;E?((t=t.cloneNode(!1)).appendChild(o),E.insertBefore(t,E.firstChild),b.appendChild(E),_.push(t),E=null):t.appendChild(o),T=l,L=l.data.length,A=!0,!c&&u&&(t=l,l.textContent=r.zeroWidthSpace),C!==l&&C.appendChild(T)}}}(e,b),d&&!c&&!h.v)return{ancestor:e,startContainer:i,startOffset:l,endContainer:o,endOffset:s};if(c=c&&d)for(let e=0;e<_.length;e++){let t,n,i,l=_[e];if(u)t=r.createTextNode(r.zeroWidthSpace),b.replaceChild(t,l);else{const e=l.childNodes;for(n=e[0];e[0];)i=e[0],b.insertBefore(i,l);r.removeItem(l)}0===e&&(u?S=T=t:(S=n,T=i))}else{if(d)for(let e=0;e<_.length;e++)this._stripRemoveNode(_[e]);u&&(S=T=t)}r.removeEmptyNode(b,t),u&&(N=S.textContent.length,L=T.textContent.length);const M=c||0===T.textContent.length;r.isBreak(T)||0!==T.textContent.length||(r.removeItem(T),T=S),L=M?T.textContent.length:L;const H={s:0,e:0},I=r.getNodePath(S,b,H),D=!T.parentNode;D&&(T=S);const O={s:0,e:0},F=r.getNodePath(T,b,D||M?null:O);N+=H.s,L=u?N:D?S.textContent.length:M?L+H.s:L+O.s;const R=r.mergeSameTags(b,[I,F],!0);return e.parentNode.replaceChild(b,e),S=r.getNodeFromPath(I,b),T=r.getNodeFromPath(F,b),{ancestor:b,startContainer:S,startOffset:N+R[0],endContainer:T,endOffset:L+R[1]}},_nodeChange_startLine:function(e,t,n,i,l,o,s,a,c,d,u){let h=i.parentNode;for(;!(h.nextSibling||h.previousSibling||r.isFormatElement(h.parentNode)||r.isWysiwygDiv(h.parentNode))&&h.nodeName!==t.nodeName;)h=h.parentNode;if(!s&&h.nodeName===t.nodeName&&!r.isFormatElement(h)&&!h.nextSibling&&r.onlyZeroWidthSpace(i.textContent.slice(0,l))){let n=!0,o=i.previousSibling;for(;o;){if(!r.onlyZeroWidthSpace(o)){n=!1;break}o=o.previousSibling}if(n)return r.copyTagAttributes(h,t),{ancestor:e,container:i,offset:l}}a.v=!1;const g=e,p=[t],m=e.cloneNode(!1);let f,_,b,v,y=i,C=l,w=!1;if(function e(i,l){const o=i.childNodes;for(let i,s,a=0,h=o.length;a0,y=f.pop()||h;for(b=_=y;f.length>0;)_=f.pop(),b.appendChild(_),b=_;if(d(t.parentNode)&&!d(y)&&(t=t.cloneNode(!1),m.appendChild(t),p.push(t)),!v&&d(y)){t=t.cloneNode(!1);const e=y.childNodes;for(let n=0,i=e.length;n0;)_=f.pop(),b.appendChild(_),b=_;d!==l?(t.appendChild(d),l=_):l=t,r.isBreak(h)&&t.appendChild(h.cloneNode(!1)),e.appendChild(t),y=s,C=0,w=!0,l.appendChild(y)}}}(e,m),s&&!o&&!a.v)return{ancestor:e,container:i,offset:l,endContainer:u};if(o=o&&s)for(let e=0;e0&&u===h)return e.innerHTML=i.innerHTML,{ancestor:e,endContainer:n?r.getNodeFromPath(n,e):null}}o.v=!1;const a=e.cloneNode(!1),c=[t];let d=!0;if(function e(i,l){const o=i.childNodes;for(let i,u,h=0,g=o.length;h0&&(a.appendChild(t),t=t.cloneNode(!1)),u=g.cloneNode(!0),a.appendChild(u),a.appendChild(t),c.push(t),l=t,s&&g.contains(s)){const e=r.getNodePath(s,g);s=r.getNodeFromPath(e,u)}}}(e,t),d||l&&!i&&!o.v)return{ancestor:e,endContainer:s};if(a.appendChild(t),i&&l)for(let e=0;e0,u=m.pop()||a;for(_=f=u;m.length>0;)f=m.pop(),_.appendChild(f),_=f;if(d(t.parentNode)&&!d(u)&&(t=t.cloneNode(!1),p.insertBefore(t,p.firstChild),g.push(t)),!b&&d(u)){t=t.cloneNode(!1);const e=u.childNodes;for(let n=0,i=e.length;n0?f:t}else s?(t.insertBefore(u,t.firstChild),l=f):l=t;if(b&&3===a.nodeType)if(c(a)){const e=r.getParentElement(l,function(e){return this._isMaintainedNode(e.parentNode)||e.parentNode===p}.bind(r));b.appendChild(e),t=e.cloneNode(!1),g.push(t),p.insertBefore(t,p.firstChild)}else b=null}if(C||a!==v)i=C?n(a):a.cloneNode(!1),i&&(l.insertBefore(i,l.firstChild),1!==a.nodeType||r.isBreak(a)||(u=i)),e(a,u);else{b=c(a);const e=r.createTextNode(1===v.nodeType?"":v.substringData(y,v.length-y)),o=r.createTextNode(1===v.nodeType?"":v.substringData(0,y));if(b){b=b.cloneNode(!1);const e=c(l);if(e&&e.parentNode!==p){let t=e,n=null;for(;t.parentNode!==p;){for(l=n=t.parentNode.cloneNode(!1);t.childNodes[0];)n.appendChild(t.childNodes[0]);t.appendChild(n),t=t.parentNode}t.parentNode.insertBefore(e,t.parentNode.firstChild)}b=b.cloneNode(!1)}else d(t.parentNode)&&!b&&(t=t.cloneNode(!1),p.appendChild(t),g.push(t));for(r.onlyZeroWidthSpace(e)||l.insertBefore(e,l.firstChild),f=l,m=[];f!==p&&null!==f;)i=d(f)?null:n(f),i&&1===f.nodeType&&m.push(i),f=f.parentNode;const s=m.pop()||l;for(_=f=s;m.length>0;)f=m.pop(),_.appendChild(f),_=f;s!==l?(t.insertBefore(s,t.firstChild),l=f):l=t,r.isBreak(a)&&t.appendChild(a.cloneNode(!1)),b?(b.insertBefore(t,b.firstChild),p.insertBefore(b,p.firstChild),b=null):p.insertBefore(t,p.firstChild),v=o,y=o.data.length,C=!0,l.insertBefore(v,l.firstChild)}}}(e,p),s&&!o&&!a.v)return{ancestor:e,container:i,offset:l};if(o=o&&s)for(let e=0;e-1?null:r.createElement(n);let d=n;/^SUB$/i.test(n)&&a.indexOf("SUP")>-1?d="SUP":/^SUP$/i.test(n)&&a.indexOf("SUB")>-1&&(d="SUB"),this.nodeChange(c,null,[d],!1),this.focus()}},removeFormat:function(){this.nodeChange(null,null,null,null)},indent:function(e){const t=this.getRange(),n=this.getSelectedElements(null),i=[],l="indent"!==e;let o=t.startContainer,s=t.endContainer,a=t.startOffset,c=t.endOffset;for(let e,t,o=0,s=n.length;o0&&this.plugins.list.editInsideList.call(this,l,i),this.effectNode=null,this.setRange(o,a,s,c),this.history.push(!1)},toggleDisplayBlocks:function(){const t=e.element.wysiwyg;r.toggleClass(t,"se-show-block"),r.hasClass(t,"se-show-block")?r.addClass(this._styleCommandMap.showBlocks,"active"):r.removeClass(this._styleCommandMap.showBlocks,"active"),this._resourcesStateChange()},toggleCodeView:function(){const t=this._variable.isCodeView;this.controllersOff(),r.setDisabledButtons(!t,this.codeViewDisabledButtons),t?(this._setCodeDataToEditor(),e.element.wysiwygFrame.scrollTop=0,e.element.code.style.display="none",e.element.wysiwygFrame.style.display="block",this._variable._codeOriginCssText=this._variable._codeOriginCssText.replace(/(\s?display(\s+)?:(\s+)?)[a-zA-Z]+(?=;)/,"display: none"),this._variable._wysiwygOriginCssText=this._variable._wysiwygOriginCssText.replace(/(\s?display(\s+)?:(\s+)?)[a-zA-Z]+(?=;)/,"display: block"),"auto"!==l.height||l.codeMirrorEditor||(e.element.code.style.height="0px"),this._variable.isCodeView=!1,this._variable.isFullScreen||(this._notHideToolbar=!1,/balloon|balloon-always/i.test(l.mode)&&(e.element._arrow.style.display="",this._isInline=!1,this._isBalloon=!0,u._hideToolbar())),this.nativeFocus(),r.removeClass(this._styleCommandMap.codeView,"active"),this.history.push(!1)):(this._setEditorDataToCodeView(),this._variable._codeOriginCssText=this._variable._codeOriginCssText.replace(/(\s?display(\s+)?:(\s+)?)[a-zA-Z]+(?=;)/,"display: block"),this._variable._wysiwygOriginCssText=this._variable._wysiwygOriginCssText.replace(/(\s?display(\s+)?:(\s+)?)[a-zA-Z]+(?=;)/,"display: none"),"auto"!==l.height||l.codeMirrorEditor||(e.element.code.style.height=e.element.code.scrollHeight>0?e.element.code.scrollHeight+"px":"auto"),l.codeMirrorEditor&&l.codeMirrorEditor.refresh(),this._variable.isCodeView=!0,this._variable.isFullScreen||(this._notHideToolbar=!0,this._isBalloon&&(e.element._arrow.style.display="none",e.element.toolbar.style.left="",this._isInline=!0,this._isBalloon=!1,u._showToolbarInline())),this._variable._range=null,e.element.code.focus(),r.addClass(this._styleCommandMap.codeView,"active")),this._checkPlaceholder(),"function"==typeof h.toggleCodeView&&h.toggleCodeView(this._variable.isCodeView,this)},_setCodeDataToEditor:function(){const t=this._getCodeView();if(l.fullPage){const e=this._parser.parseFromString(t,"text/html"),n=e.head.children;for(let t=0,i=n.length;t0?this.convertContentsForEditor(t):"


    "},_setEditorDataToCodeView:function(){const t=this.convertHTMLForCodeView(e.element.wysiwyg);let n="";if(l.fullPage){const e=r.getAttributesToString(this._wd.body,null);n="\n\n"+this._wd.head.outerHTML.replace(/>(?!\n)/g,">\n")+"\n"+t+"\n"}else n=t;e.element.code.style.display="block",e.element.wysiwygFrame.style.display="none",this._setCodeView(n)},toggleFullScreen:function(t){const n=e.element.topArea,i=e.element.toolbar,o=e.element.editorArea,d=e.element.wysiwygFrame,g=e.element.code,p=this._variable;this.controllersOff(),p.isFullScreen?(p.isFullScreen=!1,d.style.cssText=p._wysiwygOriginCssText,g.style.cssText=p._codeOriginCssText,i.style.cssText="",o.style.cssText=p._editorAreaOriginCssText,n.style.cssText=p._originCssText,s.body.style.overflow=p._bodyOverflow,l.toolbarContainer&&l.toolbarContainer.appendChild(i),l.stickyToolbar>-1&&r.removeClass(i,"se-toolbar-sticky"),p._fullScreenAttrs.sticky&&!l.toolbarContainer&&(p._fullScreenAttrs.sticky=!1,e.element._stickyDummy.style.display="block",r.addClass(i,"se-toolbar-sticky")),this._isInline=p._fullScreenAttrs.inline,this._isBalloon=p._fullScreenAttrs.balloon,this._isInline&&u._showToolbarInline(),l.toolbarContainer&&r.removeClass(i,"se-toolbar-balloon"),u.onScroll_window(),r.changeElement(t.firstElementChild,c.expansion),r.removeClass(this._styleCommandMap.fullScreen,"active")):(p.isFullScreen=!0,p._fullScreenAttrs.inline=this._isInline,p._fullScreenAttrs.balloon=this._isBalloon,(this._isInline||this._isBalloon)&&(this._isInline=!1,this._isBalloon=!1),l.toolbarContainer&&e.element.relative.insertBefore(i,o),n.style.position="fixed",n.style.top="0",n.style.left="0",n.style.width="100%",n.style.maxWidth="100%",n.style.height="100%",n.style.zIndex="2147483647",""!==e.element._stickyDummy.style.display&&(p._fullScreenAttrs.sticky=!0,e.element._stickyDummy.style.display="none",r.removeClass(i,"se-toolbar-sticky")),p._bodyOverflow=s.body.style.overflow,s.body.style.overflow="hidden",p._editorAreaOriginCssText=o.style.cssText,p._wysiwygOriginCssText=d.style.cssText,p._codeOriginCssText=g.style.cssText,o.style.cssText=i.style.cssText="",d.style.cssText=(d.style.cssText.match(/\s?display(\s+)?:(\s+)?[a-zA-Z]+;/)||[""])[0],g.style.cssText=(g.style.cssText.match(/\s?display(\s+)?:(\s+)?[a-zA-Z]+;/)||[""])[0],i.style.width=d.style.height=g.style.height="100%",i.style.position="relative",i.style.display="block",p.innerHeight_fullScreen=a.innerHeight-i.offsetHeight,o.style.height=p.innerHeight_fullScreen+"px",r.changeElement(t.firstElementChild,c.reduction),l.iframe&&"auto"===l.height&&(o.style.overflow="auto",this._iframeAutoHeight()),r.addClass(this._styleCommandMap.fullScreen,"active")),"function"==typeof h.toggleFullScreen&&h.toggleFullScreen(this._variable.isFullScreen,this)},print:function(){const e=r.createElement("IFRAME");e.style.display="none",s.body.appendChild(e);const t=r.getIframeDocument(e),n=this.getContents(!0),i=this._wd;if(l.iframe){const e=l.fullPage?r.getAttributesToString(i.body,["contenteditable"]):'class="sun-editor-editable"';t.write(""+i.head.innerHTML+""+n+"")}else{const e=s.head.getElementsByTagName("link"),i=s.head.getElementsByTagName("style");let l="";for(let t=0,n=e.length;t"+l+''+n+"")}this.showLoading(),a.setTimeout((function(){try{if(e.focus(),r.isIE_Edge||s.documentMode||a.StyleMedia)try{e.contentWindow.document.execCommand("print",!1,null)}catch(t){e.contentWindow.print()}else e.contentWindow.print()}catch(e){throw Error("[SUNEDITOR.core.print.fail] error: "+e)}finally{d.closeLoading(),r.removeItem(e)}}),1e3)},preview:function(){d.submenuOff(),d.containerOff(),d.controllersOff();const t=this.getContents(!0),n=a.open("","_blank");n.mimeType="text/html";const o=e.element.wysiwygFrame.offsetWidth+"px !important",c=this._wd;if(l.iframe){const e=l.fullPage?r.getAttributesToString(c.body,["contenteditable"]):'class="sun-editor-editable"';n.document.write(""+c.head.innerHTML+""+t+"")}else{const e=s.head.getElementsByTagName("link"),l=s.head.getElementsByTagName("style");let a="";for(let t=0,n=e.length;t'+i.toolbar.preview+""+a+''+t+"")}},setContents:function(t){const n=this.convertContentsForEditor(t);if(this._resetComponents(),this._variable.isCodeView){const e=this.convertHTMLForCodeView(n);this._setCodeView(e)}else e.element.wysiwyg.innerHTML=n,this.history.push(!1)},getContents:function(t){const n=e.element.wysiwyg.innerHTML,i=r.createElement("DIV");i.innerHTML=n;const o=r.getListChildren(i,(function(e){return/FIGCAPTION/i.test(e.nodeName)}));for(let e=0,t=o.length;e"+this._wd.head.outerHTML+""+i.innerHTML+""}return i.innerHTML},_makeLine:function(e,t){if(1===e.nodeType)return r._disallowedTags(e)?"":!t||r.isFormatElement(e)||r.isRangeFormatElement(e)||r.isComponent(e)||r.isMedia(e)||r.isAnchor(e)&&r.isMedia(e.firstElementChild)?e.outerHTML:"

    "+e.outerHTML+"

    ";if(3===e.nodeType){if(!t)return e.textContent;const n=e.textContent.split(/\n/g);let i="";for(let e,t=0,l=n.length;t0&&(i+="

    "+e+"

    ");return i}return 8===e.nodeType&&this._allowHTMLComments?"\x3c!--"+e.textContent.trim()+"--\x3e":""},_tagConvertor:function(e){if(!this._disallowedTextTagsRegExp)return e;const t={b:"strong",i:"em",ins:"u",strike:"del",s:"del"};return e.replace(this._disallowedTextTagsRegExp,(function(e,n,i){return n+("string"==typeof t[i]?t[i]:i)}))},_deleteDisallowedTags:function(e){return e.replace(/\n/g,"").replace(/<(script|style).*>(\n|.)*<\/(script|style)>/gi,"").replace(/<[a-z0-9]+\:[a-z0-9]+[^>^\/]*>[^>]*<\/[a-z0-9]+\:[a-z0-9]+>/gi,"").replace(this.editorTagsWhitelistRegExp,"")},cleanHTML:function(e,t){e=this._deleteDisallowedTags(e).replace(/(<[a-zA-Z0-9]+)[^>]*(?=>)/g,function(e,t){if(/^<[a-z0-9]+\:[a-z0-9]+/i.test(e))return e;let n=null;const i=this._attributesTagsWhitelist[t.match(/(?!<)[a-zA-Z0-9]+/)[0].toLowerCase()];if(n=i?e.match(i):e.match(this._attributesWhitelistRegExp),/

    ":(i=r.htmlRemoveWhiteSpace(i),this._tagConvertor(i))},convertHTMLForCodeView:function(e){let t="";const n=a.RegExp,i=new n("^(BLOCKQUOTE|PRE|TABLE|THEAD|TBODY|TR|TH|TD|OL|UL|IMG|IFRAME|VIDEO|AUDIO|FIGURE|FIGCAPTION|HR|BR|CANVAS|SELECT)$","i"),l=r.isFormatElement.bind(r),o="string"==typeof e?s.createRange().createContextualFragment(e):e;let c=1*this._variable.codeIndent;return c=c>0?new a.Array(c+1).join(" "):"",function e(o,s,a){const d=o.childNodes,u=i.test(o.nodeName),h=u?s:"";for(let g,p,m,f=0,_=d.length;f<_;f++){if(g=d[f],m=i.test(g.nodeName),p=m?"\n":"",a=!l(g)||u||/^(TH|TD)$/i.test(o.nodeName)?"":"\n",8===g.nodeType){t+="\n\x3c!-- "+g.textContent.trim()+" --\x3e"+p;continue}if(3===g.nodeType){t+=r._HTMLConvertor(/^\n+$/.test(g.data)?"":g.data);continue}if(0===g.childNodes.length){t+=(/^HR$/i.test(g.nodeName)?"\n":"")+h+g.outerHTML+p;continue}g.innerHTML=g.innerHTML;const _=g.nodeName.toLowerCase();t+=(a||(u?"":p))+(h||m?s:"")+g.outerHTML.match(n("<"+_+"[^>]*>","i"))[0]+p,e(g,s+c,""),t+=(m?s:"")+""+(a||p||u||/^(TH|TD)$/i.test(g.nodeName)?"\n":"")}}(o,"","\n"),t.trim()+"\n"},addDocEvent:function(e,t,n){s.addEventListener(e,t,n),l.iframe&&this._wd.addEventListener(e,t)},removeDocEvent:function(e,t){s.removeEventListener(e,t),l.iframe&&this._wd.removeEventListener(e,t)},_charCount:function(e){const t=l.maxCharCount,n=l.charCounterType;let i=0;if(e&&(i=this.getCharLength(e,n)),this._setCharCount(),t>0){let e=!1;const l=h.getCharCount(n);if(l>t){if(e=!0,i>0){this._editorRange();const e=this.getRange(),n=e.endOffset-1,i=this.getSelectionNode().textContent,o=e.endOffset-(l-t);this.getSelectionNode().textContent=i.slice(0,o<0?0:o)+i.slice(e.endOffset,i.length),this.setRange(e.endContainer,n,e.endContainer,n)}}else l+i>t&&(e=!0);if(e&&(this._callCounterBlink(),i>0))return!1}return!0},checkCharCount:function(e,t){if(l.maxCharCount){const n=t||l.charCounterType,i=this.getCharLength("string"==typeof e?e:this._charTypeHTML?e.outerHTML:e.textContent,n);if(i>0&&i+h.getCharCount(n)>l.maxCharCount)return this._callCounterBlink(),!1}return!0},getCharLength:function(e,t){return/byte/.test(t)?r.getByteLength(e):e.length},_setCharCount:function(){e.element.charCounter&&a.setTimeout((function(){e.element.charCounter.textContent=h.getCharCount(l.charCounterType)}))},_callCounterBlink:function(){const t=e.element.charWrapper;t&&!r.hasClass(t,"se-blink")&&(r.addClass(t,"se-blink"),a.setTimeout((function(){r.removeClass(t,"se-blink")}),600))},_checkComponents:function(){for(let e=0,t=this._fileInfoPluginsCheck.length;e^<]+)?\\s*(?=>)","gi");const h="contenteditable|colspan|rowspan|target|href|src|class|type|controls|data-format|data-size|data-file-size|data-file-name|data-origin|data-align|data-image-link|data-rotate|data-proportion|data-percentage|origin-size|data-exp|data-font-size";this._allowHTMLComments=l._editorTagsWhitelist.indexOf("//")>-1,this._htmlCheckWhitelistRegExp=new c("^("+l._editorTagsWhitelist.replace("|//","")+")$","i"),this.editorTagsWhitelistRegExp=r.createTagsWhitelist(l._editorTagsWhitelist.replace("|//","|\x3c!--|--\x3e")),this.pasteTagsWhitelistRegExp=r.createTagsWhitelist(l.pasteTagsWhitelist);const g=l.attributesWhitelist,p={};let m="";if(g)for(let e in g)r.hasOwn(g,e)&&("all"===e?m=g[e]+"|":p[e]=new c("((?:"+g[e]+"|"+h+')s*=s*"[^"]*")',"ig"));this._attributesWhitelistRegExp=new c("((?:"+m+h+')s*=s*"[^"]*")',"ig"),this._attributesTagsWhitelist=p,this._isInline=/inline/i.test(l.mode),this._isBalloon=/balloon|balloon-always/i.test(l.mode),this._isBalloonAlways=/balloon-always/i.test(l.mode),this._cachingButtons(),this._fileInfoPluginsCheck=[],this._fileInfoPluginsReset=[],this.managedTagsInfo={query:"",map:{}};const f=[];this.activePlugins=[],this._fileManager.tags=[],this._fileManager.pluginMap={};let _,b,v=[];for(let e in n)if(r.hasOwn(n,e)){if(_=n[e],b=t[e],_.active&&b&&this.callPlugin(e,null,b),"function"==typeof _.checkFileInfo&&"function"==typeof _.resetFileInfo&&(this.callPlugin(e,null,b),this._fileInfoPluginsCheck.push(_.checkFileInfo.bind(this)),this._fileInfoPluginsReset.push(_.resetFileInfo.bind(this))),a.Array.isArray(_.fileTags)){const t=_.fileTags;this.callPlugin(e,null,b),this._fileManager.tags=this._fileManager.tags.concat(t),v.push(e);for(let n=0,i=t.length;nc&&(d=d.slice(0,c),a&&a.setAttribute("disabled",!0)),d[c]=l?{contents:n,s:{path:i.getNodePath(l.startContainer,null,null),offset:l.startOffset},e:{path:i.getNodePath(l.endContainer,null,null),offset:l.endOffset}}:{contents:n,s:{path:[0,0],offset:[0,0]},e:{path:0,offset:0}},1===c&&s&&s.removeAttribute("disabled"),e._setCharCount(),t()}return{stack:d,push:function(t){n.setTimeout(e._resourcesStateChange.bind(e));const i="number"==typeof t?t>0?t:0:t?l:0;i&&!r||(n.clearTimeout(r),i)?r=n.setTimeout((function(){n.clearTimeout(r),r=null,h()}),i):h()},undo:function(){c>0&&(c--,u())},redo:function(){d.length-1>c&&(c++,u())},go:function(e){c=e<0?d.length-1:e,u()},reset:function(n){s&&s.setAttribute("disabled",!0),a&&a.setAttribute("disabled",!0),e.context.tool.save&&e.context.tool.save.setAttribute("disabled",!0),d.splice(0),c=0,d[c]={contents:e.getContents(!0),s:{path:[0,0],offset:0},e:{path:[0,0],offset:0}},n||t()},_resetCachingButton:function(){o=e.context.element,s=e.context.tool.undo,a=e.context.tool.redo,0===c?(s&&s.setAttribute("disabled",!0),a&&c===d.length-1&&a.setAttribute("disabled",!0),e.context.tool.save&&e.context.tool.save.setAttribute("disabled",!0)):c===d.length-1&&a&&a.setAttribute("disabled",!0)},_destroy:function(){r&&n.clearTimeout(r),d=null}}}(this,this._onChange_historyStack.bind(this)),this.addModule([B]),l.iframe&&(this._wd=e.element.wysiwygFrame.contentDocument,e.element.wysiwyg=this._wd.body,l._editorStyles.editor&&(e.element.wysiwyg.style.cssText=l._editorStyles.editor),"auto"===l.height&&(this._iframeAuto=this._wd.body)),this._initWysiwygArea(i,o)},_cachingButtons:function(){this.codeViewDisabledButtons=e.element.toolbar.querySelectorAll('.se-toolbar button:not([class~="se-code-view-enabled"])'),this.resizingDisabledButtons=e.element.toolbar.querySelectorAll('.se-toolbar button:not([class~="se-resizing-enabled"])');const t=e.tool;this.commandMap={STRONG:t.bold,U:t.underline,EM:t.italic,DEL:t.strike,SUB:t.subscript,SUP:t.superscript,OUTDENT:t.outdent,INDENT:t.indent},this._styleCommandMap={fullScreen:t.fullScreen,showBlocks:t.showBlocks,codeView:t.codeView}},_initWysiwygArea:function(t,n){e.element.wysiwyg.innerHTML=t?n:this.convertContentsForEditor("string"==typeof n?n:e.element.originElement.value)},_resourcesStateChange:function(){this._iframeAutoHeight(),this._checkPlaceholder()},_onChange_historyStack:function(){u._applyTagEffects(),e.tool.save&&e.tool.save.removeAttribute("disabled"),h.onChange&&h.onChange(this.getContents(!0),this)},_iframeAutoHeight:function(){this._iframeAuto&&a.setTimeout((function(){e.element.wysiwygFrame.style.height=d._iframeAuto.offsetHeight+"px"}))},_checkPlaceholder:function(){if(this._placeholder){if(this._variable.isCodeView)return void(this._placeholder.style.display="none");const t=e.element.wysiwyg;!r.onlyZeroWidthSpace(t.textContent)||t.querySelector(".se-component, pre, blockquote, hr, li, table, img, iframe, video")||(t.innerText.match(/\n/g)||"").length>1?this._placeholder.style.display="none":this._placeholder.style.display="block"}},_setDefaultFormat:function(e){if(this._fileManager.pluginRegExp.test(this.currentControllerName))return;const t=this.getRange(),n=t.commonAncestorContainer,i=t.startContainer,l=r.getRangeFormatElement(n,null);let o,s,a;const c=r.getParentElement(n,r.isComponent);if((!c||r.isTable(c))&&(!r.isRangeFormatElement(i)&&!r.isWysiwygDiv(i)||!r.isComponent(i.childNodes[t.startOffset]))){if(l)return a=r.createElement(e||"P"),a.innerHTML=l.innerHTML,0===a.childNodes.length&&(a.innerHTML=r.zeroWidthSpace),l.innerHTML=a.outerHTML,a=l.firstChild,o=r.getEdgeChildNodes(a,null).sc,o||(o=r.createTextNode(r.zeroWidthSpace),a.insertBefore(o,a.firstChild)),s=o.textContent.length,void this.setRange(o,s,o,s);if(r.isRangeFormatElement(n)&&n.childNodes.length<=1){let e=null;return 1===n.childNodes.length&&r.isBreak(n.firstChild)?e=n.firstChild:(e=r.createTextNode(r.zeroWidthSpace),n.appendChild(e)),void this.setRange(e,1,e,1)}if(this.execCommand("formatBlock",!1,e||"P"),o=r.getEdgeChildNodes(n,n),o=o?o.ec:n,a=r.getFormatElement(o,null),!a)return this.removeRange(),void this._editorRange();if(r.isBreak(a.nextSibling)&&r.removeItem(a.nextSibling),r.isBreak(a.previousSibling)&&r.removeItem(a.previousSibling),r.isBreak(o)){const e=r.createTextNode(r.zeroWidthSpace);o.parentNode.insertBefore(e,o),o=e}this.effectNode=null,this.nativeFocus()}},_setOptionsInit:function(t,n){this.context=e=A(t.originElement,this._getConstructed(t),l),this._componentsInfoReset=!0,this._editorInit(!0,n)},_editorInit:function(t,n){this._init(t,n),u._addEvent(),this._setCharCount(),u._offStickyToolbar(),u.onResize_window(),e.element.toolbar.style.visibility="",this._checkComponents(),this._componentsInfoInit=!1,this._componentsInfoReset=!1,this.history.reset(!0),this._resourcesStateChange(),a.setTimeout((function(){"function"==typeof h.onload&&h.onload(d,t)}))},_getConstructed:function(e){return{_top:e.topArea,_relative:e.relative,_toolBar:e.toolbar,_menuTray:e._menuTray,_editorArea:e.editorArea,_wysiwygArea:e.wysiwygFrame,_codeArea:e.code,_placeholder:e.placeholder,_resizingBar:e.resizingBar,_navigation:e.navigation,_charCounter:e.charCounter,_charWrapper:e.charWrapper,_loading:e.loading,_lineBreaker:e.lineBreaker,_lineBreaker_t:e.lineBreaker_t,_lineBreaker_b:e.lineBreaker_b,_resizeBack:e.resizeBackground,_stickyDummy:e._stickyDummy,_arrow:e._arrow}}},u={_IEisComposing:!1,_lineBreakerBind:null,_responsiveCurrentSize:"default",_responsiveButtonSize:null,_responsiveButtons:null,_directionKeyCode:new a.RegExp("^(8|13|3[2-9]|40|46)$"),_nonTextKeyCode:new a.RegExp("^(8|13|1[6-9]|20|27|3[3-9]|40|45|46|11[2-9]|12[0-3]|144|145)$"),_historyIgnoreKeyCode:new a.RegExp("^(1[6-9]|20|27|3[3-9]|40|45|11[2-9]|12[0-3]|144|145)$"),_onButtonsCheck:new a.RegExp("^(STRONG|U|EM|DEL|SUB|SUP)$"),_frontZeroWidthReg:new a.RegExp(r.zeroWidthSpace+"+",""),_keyCodeShortcut:{65:"A",66:"B",83:"S",85:"U",73:"I",89:"Y",90:"Z",219:"[",221:"]"},_shortcutCommand:function(e,t){let n=null;switch(u._keyCodeShortcut[e]){case"A":n="selectAll";break;case"B":-1===l.shortcutsDisable.indexOf("bold")&&(n="STRONG");break;case"S":t&&-1===l.shortcutsDisable.indexOf("strike")&&(n="DEL");break;case"U":-1===l.shortcutsDisable.indexOf("underline")&&(n="U");break;case"I":-1===l.shortcutsDisable.indexOf("italic")&&(n="EM");break;case"Z":-1===l.shortcutsDisable.indexOf("undo")&&(n=t?"redo":"undo");break;case"Y":-1===l.shortcutsDisable.indexOf("undo")&&(n="redo");break;case"[":-1===l.shortcutsDisable.indexOf("indent")&&(n="outdent");break;case"]":-1===l.shortcutsDisable.indexOf("indent")&&(n="indent")}return!!n&&(d.commandHandler(d.commandMap[n],n),!0)},_applyTagEffects:function(){let t=d.getSelectionNode();if(t===d.effectNode)return;d.effectNode=t;const i=d.commandMap,o=this._onButtonsCheck,s=[],a=[],c=d.activePlugins,u=c.length;let h="";for(;t.firstChild;)t=t.firstChild;for(let e=t;!r.isWysiwygDiv(e)&&e;e=e.parentNode)if(1===e.nodeType&&!r.isBreak(e)){h=e.nodeName.toUpperCase(),a.push(h);for(let t,i=0;i0)&&(s.push("OUTDENT"),i.OUTDENT.removeAttribute("disabled")),-1===s.indexOf("INDENT")&&i.INDENT&&r.isListCell(e)&&!e.previousElementSibling&&(s.push("INDENT"),i.INDENT.setAttribute("disabled",!0))):o.test(h)&&(s.push(h),r.addClass(i[h],"active"))}for(let e in i)s.indexOf(e)>-1||!r.hasOwn(i,e)||(c.indexOf(e)>-1?n[e].active.call(d,null):i.OUTDENT&&/^OUTDENT$/i.test(e)?i.OUTDENT.setAttribute("disabled",!0):i.INDENT&&/^INDENT$/i.test(e)?i.INDENT.removeAttribute("disabled"):r.removeClass(i[e],"active"));d._variable.currentNodes=a.reverse(),d._variable.currentNodesMap=s,l.showPathLabel&&(e.element.navigation.textContent=d._variable.currentNodes.join(" > "))},_cancelCaptionEdit:function(){this.setAttribute("contenteditable",!1),this.removeEventListener("blur",u._cancelCaptionEdit)},_buttonsEventHandler:function(e){let t=e.target;if(d._bindControllersOff&&e.stopPropagation(),/^(input|textarea|select|option)$/i.test(t.nodeName)?d._antiBlur=!1:e.preventDefault(),r.getParentElement(t,".se-submenu"))e.stopPropagation(),d._notHideToolbar=!0;else{let n=t.getAttribute("data-command"),i=t.className;for(;!n&&!/se-menu-list/.test(i)&&!/sun-editor-common/.test(i);)t=t.parentNode,n=t.getAttribute("data-command"),i=t.className;n!==d._submenuName&&n!==d._containerName||e.stopPropagation()}},onClick_toolbar:function(e){let t=e.target,n=t.getAttribute("data-display"),i=t.getAttribute("data-command"),l=t.className;for(;t.parentNode&&!i&&!/se-menu-list/.test(l)&&!/se-toolbar/.test(l);)t=t.parentNode,i=t.getAttribute("data-command"),n=t.getAttribute("data-display"),l=t.className;(i||n)&&(t.disabled||(d.hasFocus||d.nativeFocus(),d._variable.isCodeView||d._editorRange(),d.actionCall(i,n,t)))},onMouseDown_wysiwyg:function(t){if(r.isNonEditable(e.element.wysiwyg))return;const n=r.getParentElement(t.target,r.isCell);if(n){const e=d.plugins.table;e&&n!==e._fixedCell&&!e._shift&&d.callPlugin("table",(function(){e.onTableCellMultiSelect.call(d,n,!1)}),null)}d._isBalloon&&u._hideToolbar(),/FIGURE/i.test(t.target.nodeName)&&t.preventDefault(),"function"==typeof h.onMouseDown&&h.onMouseDown(t,d)},onClick_wysiwyg:function(t){const n=t.target;if(r.isNonEditable(e.element.wysiwyg))return;const i=d.getFileComponent(n);if(i)return t.preventDefault(),void d.selectComponent(i.target,i.pluginName);const l=r.getParentElement(n,"FIGCAPTION");if(r.isNonEditable(l)&&(t.preventDefault(),l.setAttribute("contenteditable",!0),l.focus(),d._isInline&&!d._inlineToolbarAttr.isShow)){u._showToolbarInline();const e=function(){u._hideToolbar(),l.removeEventListener("blur",e)};l.addEventListener("blur",e)}a.setTimeout(d._editorRange.bind(d)),d._editorRange();const o=d.getSelectionNode(),s=r.getFormatElement(o,null),c=r.getRangeFormatElement(o,null);if(s&&s!==c||r.isNonEditable(n)||r.isList(c))u._applyTagEffects();else{const e=d.getRange();if(r.getFormatElement(e.startContainer)===r.getFormatElement(e.endContainer)){if(r.isList(c)){const e=r.createElement("LI"),t=o.nextElementSibling;e.appendChild(o),c.insertBefore(e,t)}else r.isWysiwygDiv(o)||r.isComponent(o)||r.isTable(o)&&!r.isCell(o)||d._setDefaultFormat(r.isRangeFormatElement(c)?"DIV":"P");t.preventDefault(),d.focus()}}d._isBalloon&&a.setTimeout(u._toggleToolbarBalloon),"function"==typeof h.onClick&&h.onClick(t,d)},_balloonDelay:null,_showToolbarBalloonDelay:function(){u._balloonDelay&&a.clearTimeout(u._balloonDelay),u._balloonDelay=a.setTimeout(function(){a.clearTimeout(this._balloonDelay),this._balloonDelay=null,this._showToolbarBalloon()}.bind(u),350)},_toggleToolbarBalloon:function(){d._editorRange();const e=d.getRange();d._bindControllersOff||!d._isBalloonAlways&&e.collapsed?u._hideToolbar():u._showToolbarBalloon(e)},_showToolbarBalloon:function(t){if(!d._isBalloon)return;const n=t||d.getRange(),i=e.element.toolbar,l=d.getSelection();let o;if(d._isBalloonAlways&&n.collapsed)o=!0;else if(l.focusNode===l.anchorNode)o=l.focusOffset0&&u._getPageBottomSpace()C&&(t=!1,y=!0),y&&(b=(t?n.top-m-g:n.bottom+g)-(n.noText?0:h)+d),i.style.left=a.Math.floor(v)+"px",i.style.top=a.Math.floor(b)+"px",t?(r.removeClass(e.element._arrow,"se-arrow-up"),r.addClass(e.element._arrow,"se-arrow-down"),e.element._arrow.style.top=m+"px"):(r.removeClass(e.element._arrow,"se-arrow-down"),r.addClass(e.element._arrow,"se-arrow-up"),e.element._arrow.style.top=-g+"px");const w=a.Math.floor(p/2+(f-v));e.element._arrow.style.left=(w+g>i.offsetWidth?i.offsetWidth-g:w";const e=f.attributes;for(;e[0];)f.removeAttribute(e[0].name);return d.nativeFocus(),!1}}if(f&&g.startContainer===g.endContainer&&3===c.nodeType&&!r.isFormatElement(c.parentNode)&&(g.collapsed?1===c.textContent.length:g.endOffset-g.startOffset===c.textContent.length)){t.preventDefault();let e=null,n=c.parentNode.previousSibling;const i=c.parentNode.nextSibling;n||(i?(n=i,e=0):(n=r.createElement("BR"),f.appendChild(n))),c.textContent="",r.removeItemAllParents(c,null,f),e="number"==typeof e?e:3===n.nodeType?n.textContent.length:1,d.setRange(n,e,n,e);break}const n=g.commonAncestorContainer;if(f=r.getFormatElement(g.startContainer,null),_=r.getRangeFormatElement(f,null),_&&f&&!r.isCell(_)&&!/^FIGCAPTION$/i.test(_.nodeName)){if(r.isListCell(f)&&r.isList(_)&&(r.isListCell(_.parentNode)||f.previousElementSibling)&&(c===f||3===c.nodeType&&(!c.previousSibling||r.isList(c.previousSibling)))&&(r.getFormatElement(g.startContainer,null)!==r.getFormatElement(g.endContainer,null)?_.contains(g.startContainer):0===g.startOffset&&g.collapsed)){if(g.startContainer!==g.endContainer)t.preventDefault(),d.removeNode(),3===g.startContainer.nodeType&&d.setRange(g.startContainer,g.startContainer.textContent.length,g.startContainer,g.startContainer.textContent.length),d.history.push(!0);else{let e=f.previousElementSibling||_.parentNode;if(r.isListCell(e)){t.preventDefault();let n=e;if(!e.contains(f)&&r.isListCell(n)&&r.isList(n.lastElementChild)){for(n=n.lastElementChild.lastElementChild;r.isListCell(n)&&r.isList(n.lastElementChild);)n=n.lastElementChild&&n.lastElementChild.lastElementChild;e=n}let i=e===_.parentNode?_.previousSibling:e.lastChild;i||(i=r.createTextNode(r.zeroWidthSpace),_.parentNode.insertBefore(i,_.parentNode.firstChild));const l=3===i.nodeType?i.textContent.length:1,o=f.childNodes;let s=i,a=o[0];for(;a=o[0];)e.insertBefore(a,s.nextSibling),s=a;r.removeItem(f),0===_.children.length&&r.removeItem(_),d.setRange(i,l,i,l),d.history.push(!0)}}break}if(!p&&0===g.startOffset){let e=!0,i=n;for(;i&&i!==_&&!r.isWysiwygDiv(i);){if(i.previousSibling&&(1===i.previousSibling.nodeType||!r.onlyZeroWidthSpace(i.previousSibling.textContent.trim()))){e=!1;break}i=i.parentNode}if(e&&_.parentNode){t.preventDefault(),d.detachRangeFormatElement(_,r.isListCell(f)?[f]:null,null,!1,!1),d.history.push(!0);break}}}if(!p&&(0===g.startOffset||c===f&&f.childNodes[g.startOffset])){const e=c===f?f.childNodes[g.startOffset]:c,i=(3===n.nodeType||r.isBreak(n))&&!n.previousSibling&&0===g.startOffset;if(!e.previousSibling&&(r.isComponent(n.previousSibling)||i&&r.isComponent(f.previousSibling))){const e=d.getFileComponent(f.previousSibling);e&&(t.preventDefault(),t.stopPropagation(),0===f.textContent.length&&r.removeItem(f),d.selectComponent(e.target,e.pluginName));break}if(r.isNonEditable(e.previousSibling)){t.preventDefault(),t.stopPropagation(),r.removeItem(e.previousSibling);break}}break;case 46:if(m){t.preventDefault(),t.stopPropagation(),d.plugins[m].destroy.call(d);break}if(p&&u._hardDelete()){t.preventDefault(),t.stopPropagation();break}if((r.isFormatElement(c)||null===c.nextSibling||r.onlyZeroWidthSpace(c.nextSibling)&&null===c.nextSibling.nextSibling)&&g.startOffset===c.textContent.length){let e=f.nextElementSibling;if(!e){t.preventDefault();break}if(r.isComponent(e)){if(t.preventDefault(),r.onlyZeroWidthSpace(f)&&(r.removeItem(f),r.isTable(e))){let t=r.getChildElement(e,r.isCell,!1);t=t.firstElementChild||t,d.setRange(t,0,t,0);break}const n=d.getFileComponent(e);n&&(t.stopPropagation(),d.selectComponent(n.target,n.pluginName));break}}if(!p&&(d.isEdgePoint(g.endContainer,g.endOffset)||c===f&&f.childNodes[g.startOffset])){const e=c===f?f.childNodes[g.startOffset]:c;if(r.isNonEditable(e.nextSibling)){t.preventDefault(),t.stopPropagation(),r.removeItem(e.nextSibling);break}}if(f=r.getFormatElement(g.startContainer,null),_=r.getRangeFormatElement(f,null),r.isListCell(f)&&r.isList(_)&&(c===f||3===c.nodeType&&(!c.nextSibling||r.isList(c.nextSibling))&&(r.getFormatElement(g.startContainer,null)!==r.getFormatElement(g.endContainer,null)?_.contains(g.endContainer):g.endOffset===c.textContent.length&&g.collapsed))){g.startContainer!==g.endContainer&&d.removeNode();let e=r.getArrayItem(f.children,r.isList,!1);if(e=e||f.nextElementSibling||_.parentNode.nextElementSibling,e&&(r.isList(e)||r.getArrayItem(e.children,r.isList,!1))){let n,i;if(t.preventDefault(),r.isList(e)){const t=e.firstElementChild;for(i=t.childNodes,n=i[0];i[0];)f.insertBefore(i[0],e);r.removeItem(t)}else{for(n=e.firstChild,i=e.childNodes;i[0];)f.appendChild(i[0]);r.removeItem(e)}d.setRange(n,0,n,0),d.history.push(!0)}break}break;case 9:if(m||l.tabDisable)break;if(t.preventDefault(),o||s||r.isWysiwygDiv(c))break;const b=!g.collapsed||d.isEdgePoint(g.startContainer,g.startOffset),v=d.getSelectedElements(null);c=d.getSelectionNode();const y=[];let C=[],w=r.isListCell(v[0]),x=r.isListCell(v[v.length-1]),E={sc:g.startContainer,so:g.startOffset,ec:g.endContainer,eo:g.endOffset};for(let e,t=0,n=v.length;t0&&b&&d.plugins.list)E=d.plugins.list.editInsideList.call(d,i,y);else{const e=r.getParentElement(c,r.isCell);if(e&&b){const t=r.getParentElement(e,"table"),n=r.getListChildren(t,r.isCell);let l=i?r.prevIdx(n,e):r.nextIdx(n,e);l!==n.length||i||(l=0),-1===l&&i&&(l=n.length-1);let o=n[l];if(!o)break;o=o.firstElementChild||o,d.setRange(o,0,o,0);break}C=C.concat(y),w=x=null}if(C.length>0)if(i){const e=C.length-1;for(let t,n=0;n<=e;n++){t=C[n].childNodes;for(let e,n=0,i=t.length;n":"<"+f.nodeName+">
    ",!d.checkCharCount(e,"byte-html"))return t.preventDefault(),!1}if(!i&&S){t.preventDefault();const e=c===S,n=d.getSelection(),i=c.childNodes,l=n.focusOffset,o=c.previousElementSibling,s=c.nextSibling;if(!r.isClosureFreeFormatElement(S)&&i&&(e&&g.collapsed&&i.length-1<=l+1&&r.isBreak(i[l])&&(!i[l+1]||(!i[l+2]||r.onlyZeroWidthSpace(i[l+2].textContent))&&3===i[l+1].nodeType&&r.onlyZeroWidthSpace(i[l+1].textContent))&&l>0&&r.isBreak(i[l-1])||!e&&r.onlyZeroWidthSpace(c.textContent)&&r.isBreak(o)&&(r.isBreak(o.previousSibling)||!r.onlyZeroWidthSpace(o.previousSibling.textContent))&&(!s||!r.isBreak(s)&&r.onlyZeroWidthSpace(s.textContent)))){e?r.removeItem(i[l-1]):r.removeItem(c);const t=d.appendFormatTag(S,r.isFormatElement(S.nextElementSibling)?S.nextElementSibling:null);r.copyFormatAttributes(t,S),d.setRange(t,1,t,1);break}if(e){h.insertHTML(g.collapsed&&r.isBreak(g.startContainer.childNodes[g.startOffset-1])?"
    ":"

    ",!0,!1);let e=n.focusNode;const t=n.focusOffset;S===e&&(e=e.childNodes[t-l>1?t-1:t]),d.setRange(e,1,e,1)}else{const e=n.focusNode.nextSibling,t=r.createElement("BR");d.insertNode(t,null,!1);const i=t.previousSibling,l=t.nextSibling;r.isBreak(e)||r.isBreak(i)||l&&!r.onlyZeroWidthSpace(l)?d.setRange(l,0,l,0):(t.parentNode.insertBefore(t.cloneNode(!1),t),d.setRange(t,1,t,1))}u._onShortcutKey=!0;break}if(p)break;if(_&&f&&!r.isCell(_)&&!/^FIGCAPTION$/i.test(_.nodeName)){const e=d.getRange();if(d.isEdgePoint(e.endContainer,e.endOffset)&&r.isList(c.nextSibling)){t.preventDefault();const e=r.createElement("LI"),n=r.createElement("BR");e.appendChild(n),f.parentNode.insertBefore(e,f.nextElementSibling),e.appendChild(c.nextSibling),d.setRange(n,1,n,1);break}if((3!==e.commonAncestorContainer.nodeType||!e.commonAncestorContainer.nextElementSibling)&&r.onlyZeroWidthSpace(f.innerText.trim())){t.preventDefault();let e=null;if(r.isListCell(_.parentNode)){if(_=f.parentNode.parentNode.parentNode,e=r.splitElement(f,null,r.getElementDepth(f)-2),!e){const t=r.createElement("LI");t.innerHTML="
    ",_.insertBefore(t,e),e=t}}else{const t=r.isCell(_.parentNode)?"DIV":r.isList(_.parentNode)?"LI":r.isFormatElement(_.nextElementSibling)?_.nextElementSibling.nodeName:r.isFormatElement(_.previousElementSibling)?_.previousElementSibling.nodeName:"P";e=r.createElement(t);const n=d.detachRangeFormatElement(_,[f],null,!0,!0);n.cc.insertBefore(e,n.ec)}e.innerHTML="
    ",r.copyFormatAttributes(e,f),r.removeItemAllParents(f,null,null),d.setRange(e,1,e,1);break}}if(_&&r.getParentElement(_,"FIGCAPTION")&&r.getParentElement(_,r.isList)&&(t.preventDefault(),f=d.appendFormatTag(f,null),d.setRange(f,0,f,0)),m){t.preventDefault(),t.stopPropagation();const n=e[m],i=n._container,l=i.previousElementSibling||i.nextElementSibling;let o=null;r.isListCell(i.parentNode)?o=r.createElement("BR"):(o=r.createElement(r.isFormatElement(l)?l.nodeName:"P"),o.innerHTML="
    "),i.parentNode.insertBefore(o,i),d.callPlugin(m,(function(){d.selectComponent(n._element,m)}),null)}break;case 27:if(m)return t.preventDefault(),t.stopPropagation(),d.controllersOff(),!1}if(i&&/16/.test(n)){t.preventDefault(),t.stopPropagation();const e=d.plugins.table;if(e&&!e._shift&&!e._ref){const t=r.getParentElement(f,r.isCell);if(t)return void e.onTableCellMultiSelect.call(d,t,!0)}}if(!(o||s||p||u._nonTextKeyCode.test(n))&&g.collapsed&&g.startContainer===g.endContainer&&r.isBreak(g.commonAncestorContainer)){const e=r.createTextNode(r.zeroWidthSpace);d.insertNode(e,null,!1),d.setRange(e,1,e,1)}"function"==typeof h.onKeyDown&&h.onKeyDown(t,d)},onKeyUp_wysiwyg:function(e){if(u._onShortcutKey)return;d._editorRange();const t=d.getRange(),n=e.keyCode,i=e.ctrlKey||e.metaKey||91===n||92===n||224===n,l=e.altKey;let o=d.getSelectionNode();if(d._isBalloon&&(d._isBalloonAlways&&27!==n||!t.collapsed)){if(!d._isBalloonAlways)return void u._showToolbarBalloon();27!==n&&u._showToolbarBalloonDelay()}if(8===n&&r.isWysiwygDiv(o)&&""===o.textContent&&0===o.children.length){e.preventDefault(),e.stopPropagation(),o.innerHTML="";const t=r.createElement(r.isFormatElement(d._variable.currentNodes[0])?d._variable.currentNodes[0]:"P");return t.innerHTML="
    ",o.appendChild(t),d.setRange(t,0,t,0),u._applyTagEffects(),void d.history.push(!1)}const s=r.getFormatElement(o,null),a=r.getRangeFormatElement(o,null);(s||!t.collapsed)&&s!==a||r.isComponent(o)||r.isList(o)||(d._setDefaultFormat(r.isRangeFormatElement(a)?"DIV":"P"),o=d.getSelectionNode()),u._directionKeyCode.test(n)&&u._applyTagEffects();if(!i&&!l&&!u._nonTextKeyCode.test(n)&&3===o.nodeType&&r.zeroWidthRegExp.test(o.textContent)&&!(void 0!==e.isComposing?e.isComposing:u._IEisComposing)){let e=t.startOffset,n=t.endOffset;const i=(o.textContent.substring(0,n).match(u._frontZeroWidthReg)||"").length;e=t.startOffset-i,n=t.endOffset-i,o.textContent=o.textContent.replace(r.zeroWidthRegExp,""),d.setRange(o,e<0?0:e,o,n<0?0:n)}d._charCount(""),d.history.push(!0),"function"==typeof h.onKeyUp&&h.onKeyUp(e,d)},onScroll_wysiwyg:function(e){d.controllersOff(),d._lineBreaker.style.display="none",d._isBalloon&&u._hideToolbar(),"function"==typeof h.onScroll&&h.onScroll(e,d)},onFocus_wysiwyg:function(e){d._antiBlur||(d.hasFocus=!0,d._isInline&&u._showToolbarInline(),"function"==typeof h.onFocus&&h.onFocus(e,d))},onBlur_wysiwyg:function(t){if(d._antiBlur)return;d.hasFocus=!1,d.controllersOff(),(d._isInline||d._isBalloon)&&u._hideToolbar(),"function"==typeof h.onBlur&&h.onBlur(t,d);const i=d.commandMap,o=d.activePlugins;for(let e in i)r.hasOwn(i,e)&&(o.indexOf(e)>-1?n[e].active.call(d,null):i.OUTDENT&&/^OUTDENT$/i.test(e)?i.OUTDENT.setAttribute("disabled",!0):i.INDENT&&/^INDENT$/i.test(e)?i.INDENT.removeAttribute("disabled"):r.removeClass(i[e],"active"));d._variable.currentNodes=[],d._variable.currentNodesMap=[],l.showPathLabel&&(e.element.navigation.textContent="")},onMouseDown_resizingBar:function(t){t.stopPropagation(),d._variable.resizeClientY=t.clientY,e.element.resizeBackground.style.display="block",s.addEventListener("mousemove",u._resize_editor),s.addEventListener("mouseup",(function t(){e.element.resizeBackground.style.display="none",s.removeEventListener("mousemove",u._resize_editor),s.removeEventListener("mouseup",t)}))},_resize_editor:function(t){const n=e.element.editorArea.offsetHeight+(t.clientY-d._variable.resizeClientY);e.element.wysiwygFrame.style.height=e.element.code.style.height=(n=n+o?(d._sticky||u._onStickyToolbar(),t.toolbar.style.top=n+o+l.stickyToolbar-i-d._variable.minResizingSize+"px"):i>=o&&u._onStickyToolbar()},_getEditorOffsets:function(t){let n=t||e.element.topArea,i=0,l=0,o=0;for(;n;)i+=n.offsetTop,l+=n.offsetLeft,o+=n.scrollTop,n=n.offsetParent;return{top:i,left:l,scroll:o}},_getPageBottomSpace:function(){return s.documentElement.scrollHeight-(u._getEditorOffsets(null).top+e.element.topArea.offsetHeight)},_onStickyToolbar:function(){const t=e.element;d._isInline||l.toolbarContainer||(t._stickyDummy.style.height=t.toolbar.offsetHeight+"px",t._stickyDummy.style.display="block"),t.toolbar.style.top=l.stickyToolbar+"px",t.toolbar.style.width=d._isInline?d._inlineToolbarAttr.width:t.toolbar.offsetWidth+"px",r.addClass(t.toolbar,"se-toolbar-sticky"),d._sticky=!0},_offStickyToolbar:function(){const t=e.element;t._stickyDummy.style.display="none",t.toolbar.style.top=d._isInline?d._inlineToolbarAttr.top:"",t.toolbar.style.width=d._isInline?d._inlineToolbarAttr.width:"",t.editorArea.style.marginTop="",r.removeClass(t.toolbar,"se-toolbar-sticky"),d._sticky=!1},_codeViewAutoHeight:function(){e.element.code.style.height=e.element.code.scrollHeight+"px"},_hardDelete:function(){const e=d.getRange(),t=e.startContainer,n=e.endContainer,i=r.getRangeFormatElement(t),l=r.getRangeFormatElement(n),o=r.isCell(i),s=r.isCell(l);if((o&&!i.previousElementSibling&&!i.parentElement.previousElementSibling||s&&!l.nextElementSibling&&!l.parentElement.nextElementSibling)&&i!==l)if(o){if(s)return r.removeItem(r.getParentElement(i,r.isComponent)),d.nativeFocus(),!0;r.removeItem(r.getParentElement(i,r.isComponent))}else r.removeItem(r.getParentElement(l,r.isComponent));const a=1===t.nodeType?r.getParentElement(t,".se-component"):null,c=1===n.nodeType?r.getParentElement(n,".se-component"):null;return a&&r.removeItem(a),c&&r.removeItem(c),!1},onPaste_wysiwyg:function(e){const t=r.isIE?a.clipboardData:e.clipboardData;return!t||u._dataTransferAction("paste",e,t)},_setClipboardComponent:function(e,t,n){e.preventDefault(),e.stopPropagation(),n.setData("text/html",t.component.outerHTML)},onCopy_wysiwyg:function(e){const t=r.isIE?a.clipboardData:e.clipboardData;if("function"==typeof h.onCopy&&!h.onCopy(e,t,d))return e.preventDefault(),e.stopPropagation(),!1;const n=d.currentFileComponentInfo;n&&!r.isIE&&(u._setClipboardComponent(e,n,t),r.addClass(n.component,"se-component-copy"),a.setTimeout((function(){r.removeClass(n.component,"se-component-copy")}),150))},onCut_wysiwyg:function(e){const t=r.isIE?a.clipboardData:e.clipboardData;if("function"==typeof h.onCut&&!h.onCut(e,t,d))return e.preventDefault(),e.stopPropagation(),!1;const n=d.currentFileComponentInfo;n&&!r.isIE&&(u._setClipboardComponent(e,n,t),r.removeItem(n.component),d.controllersOff()),a.setTimeout((function(){d.history.push(!1)}))},onDrop_wysiwyg:function(e){const t=e.dataTransfer;return!t||(r.isIE?(e.preventDefault(),e.stopPropagation(),!1):(d.removeNode(),u._setDropLocationSelection(e),u._dataTransferAction("drop",e,t)))},_setDropLocationSelection:function(e){if(e.rangeParent)d.setRange(e.rangeParent,e.rangeOffset,e.rangeParent,e.rangeOffset);else if(d._wd.caretRangeFromPoint){const t=d._wd.caretRangeFromPoint(e.clientX,e.clientY);d.setRange(t.startContainer,t.startOffset,t.endContainer,t.endOffset)}else{const e=d.getRange();d.setRange(e.startContainer,e.startOffset,e.endContainer,e.endOffset)}},_dataTransferAction:function(t,n,i){let l,o;if(r.isIE){l=i.getData("Text");const s=d.getRange(),c=r.createElement("DIV"),h={sc:s.startContainer,so:s.startOffset,ec:s.endContainer,eo:s.endOffset};return c.setAttribute("contenteditable",!0),c.style.cssText="position:absolute; top:0; left:0; width:1px; height:1px; overflow:hidden;",e.element.relative.appendChild(c),c.focus(),a.setTimeout((function(){o=c.innerHTML,r.removeItem(c),d.setRange(h.sc,h.so,h.ec,h.eo),u._setClipboardData(t,n,l,o,i)})),!0}if(l=i.getData("text/plain"),o=i.getData("text/html"),!1===u._setClipboardData(t,n,l,o,i))return n.preventDefault(),n.stopPropagation(),!1},_setClipboardData:function(e,t,n,i,l){/class=["']*Mso(Normal|List)/i.test(i)||/content=["']*Word.Document/i.test(i)||/content=["']*OneNote.File/i.test(i)?(i=i.replace(/\n/g," "),n=n.replace(/\n/g," ")):n=n.replace(/\n/g,""),i=d.cleanHTML(i,d.pasteTagsWhitelistRegExp);const o=d._charCount(d._charTypeHTML?i:n);if("paste"===e&&"function"==typeof h.onPaste&&!h.onPaste(t,i,o,d))return!1;if("drop"===e&&"function"==typeof h.onDrop&&!h.onDrop(t,l,d))return!1;const s=l.files;return s.length>0?(/^image/.test(s[0].type)&&d.plugins.image&&h.insertImage(s),!1):!!o&&(i?(h.insertHTML(i,!0,!1),!1):void 0)},onMouseMove_wysiwyg:function(t){if(d.isDisabled)return;const n=r.getParentElement(t.target,r.isComponent),i=d._lineBreaker.style;if(n&&!d.currentControllerName){let o=0,s=e.element.wysiwyg;do{o+=s.scrollTop,s=s.parentElement}while(s&&!/^(BODY|HTML)$/i.test(s.nodeName));const a=e.element.wysiwyg.scrollTop,c=u._getEditorOffsets(null),h=r.getOffset(n,e.element.wysiwygFrame).top+a,g=t.pageY+o+(l.iframe&&!l.toolbarContainer?e.element.toolbar.offsetHeight:0),p=h+(l.iframe?o:c.top),m=r.isListCell(n.parentNode);let f="",_="";if((m?!n.previousSibling:!r.isFormatElement(n.previousElementSibling))&&gp+n.offsetHeight-20))return void(i.display="none");_=h+n.offsetHeight,f="b"}d._variable._lineBreakComp=n,d._variable._lineBreakDir=f,i.top=_-a+"px",d._lineBreakerButton.style.left=r.getOffset(n).left+n.offsetWidth/2-15+"px",i.display="block"}else"none"!==i.display&&(i.display="none")},_onMouseDown_lineBreak:function(e){e.preventDefault()},_onLineBreak:function(e){e.preventDefault();const t=d._variable._lineBreakComp,n=this?this:d._variable._lineBreakDir,i=r.isListCell(t.parentNode),l=r.createElement(i?"BR":r.isCell(t.parentNode)?"DIV":"P");if(i||(l.innerHTML="
    "),d._charTypeHTML&&!d.checkCharCount(l.outerHTML,"byte-html"))return;t.parentNode.insertBefore(l,"t"===n?t:t.nextSibling),d._lineBreaker.style.display="none",d._variable._lineBreakComp=null;const o=i?l:l.firstChild;d.setRange(o,1,o,1),d.history.push(!1)},_addEvent:function(){const t=l.iframe?d._ww:e.element.wysiwyg;e.element.toolbar.addEventListener("mousedown",u._buttonsEventHandler,!1),e.element._menuTray.addEventListener("mousedown",u._buttonsEventHandler,!1),e.element.toolbar.addEventListener("click",u.onClick_toolbar,!1),t.addEventListener("mousedown",u.onMouseDown_wysiwyg,!1),t.addEventListener("click",u.onClick_wysiwyg,!1),t.addEventListener(r.isIE?"textinput":"input",u.onInput_wysiwyg,!1),t.addEventListener("keydown",u.onKeyDown_wysiwyg,!1),t.addEventListener("keyup",u.onKeyUp_wysiwyg,!1),t.addEventListener("paste",u.onPaste_wysiwyg,!1),t.addEventListener("copy",u.onCopy_wysiwyg,!1),t.addEventListener("cut",u.onCut_wysiwyg,!1),t.addEventListener("drop",u.onDrop_wysiwyg,!1),t.addEventListener("scroll",u.onScroll_wysiwyg,!1),t.addEventListener("focus",u.onFocus_wysiwyg,!1),t.addEventListener("blur",u.onBlur_wysiwyg,!1),u._lineBreakerBind={a:u._onLineBreak.bind(""),t:u._onLineBreak.bind("t"),b:u._onLineBreak.bind("b")},t.addEventListener("mousemove",u.onMouseMove_wysiwyg,!1),d._lineBreakerButton.addEventListener("mousedown",u._onMouseDown_lineBreak,!1),d._lineBreakerButton.addEventListener("click",u._lineBreakerBind.a,!1),e.element.lineBreaker_t.addEventListener("mousedown",u._lineBreakerBind.t,!1),e.element.lineBreaker_b.addEventListener("mousedown",u._lineBreakerBind.b,!1),d.plugins.table&&t.addEventListener("touchstart",u.onMouseDown_wysiwyg,{passive:!0,useCapture:!1}),"auto"!==l.height||l.codeMirrorEditor||(e.element.code.addEventListener("keydown",u._codeViewAutoHeight,!1),e.element.code.addEventListener("keyup",u._codeViewAutoHeight,!1),e.element.code.addEventListener("paste",u._codeViewAutoHeight,!1)),e.element.resizingBar&&(/\d+/.test(l.height)?e.element.resizingBar.addEventListener("mousedown",u.onMouseDown_resizingBar,!1):r.addClass(e.element.resizingBar,"se-resizing-none")),u._setResponsiveToolbar(),a.removeEventListener("resize",u.onResize_window),a.removeEventListener("scroll",u.onScroll_window),a.addEventListener("resize",u.onResize_window,!1),l.stickyToolbar>-1&&a.addEventListener("scroll",u.onScroll_window,!1)},_removeEvent:function(){const t=l.iframe?d._ww:e.element.wysiwyg;e.element.toolbar.removeEventListener("mousedown",u._buttonsEventHandler),e.element._menuTray.removeEventListener("mousedown",u._buttonsEventHandler),e.element.toolbar.removeEventListener("click",u.onClick_toolbar),t.removeEventListener("mousedown",u.onMouseDown_wysiwyg),t.removeEventListener("click",u.onClick_wysiwyg),t.removeEventListener(r.isIE?"textinput":"input",u.onInput_wysiwyg),t.removeEventListener("keydown",u.onKeyDown_wysiwyg),t.removeEventListener("keyup",u.onKeyUp_wysiwyg),t.removeEventListener("paste",u.onPaste_wysiwyg),t.removeEventListener("copy",u.onCopy_wysiwyg),t.removeEventListener("cut",u.onCut_wysiwyg),t.removeEventListener("drop",u.onDrop_wysiwyg),t.removeEventListener("scroll",u.onScroll_wysiwyg),t.removeEventListener("mousemove",u.onMouseMove_wysiwyg),d._lineBreakerButton.removeEventListener("mousedown",u._onMouseDown_lineBreak),d._lineBreakerButton.removeEventListener("click",u._lineBreakerBind.a),e.element.lineBreaker_t.removeEventListener("mousedown",u._lineBreakerBind.t),e.element.lineBreaker_b.removeEventListener("mousedown",u._lineBreakerBind.b),u._lineBreakerBind=null,t.removeEventListener("touchstart",u.onMouseDown_wysiwyg,{passive:!0,useCapture:!1}),t.removeEventListener("focus",u.onFocus_wysiwyg),t.removeEventListener("blur",u.onBlur_wysiwyg),e.element.code.removeEventListener("keydown",u._codeViewAutoHeight),e.element.code.removeEventListener("keyup",u._codeViewAutoHeight),e.element.code.removeEventListener("paste",u._codeViewAutoHeight),e.element.resizingBar&&e.element.resizingBar.removeEventListener("mousedown",u.onMouseDown_resizingBar),a.removeEventListener("resize",u.onResize_window),a.removeEventListener("scroll",u.onScroll_window)},_setResponsiveToolbar:function(){if(0===o.length)return void(o=null);const e=u._responsiveButtonSize=["default"],t=u._responsiveButtons={default:o[0]};for(let n,i,l=1,s=o.length;l",e}};return void 0===t&&(e.SUNEDITOR_MODULES||Object.defineProperty(e,"SUNEDITOR_MODULES",{enumerable:!0,writable:!1,configurable:!1,value:{}}),Object.defineProperty(e.SUNEDITOR_MODULES,"component",{enumerable:!0,writable:!1,configurable:!1,value:n})),n},"object"==typeof e.exports?e.exports=i.document?l(i,!0):function(e){if(!e.document)throw new Error("SUNEDITOR_MODULES a window with a document");return l(e)}:l(i)},ee5k:function(e,t,n){"use strict";var i,l;i="undefined"!=typeof window?window:this,l=function(e,t){const n={name:"resizing",add:function(e){const t=e.icons,n=e.context;n.resizing={_resizeClientX:0,_resizeClientY:0,_resize_plugin:"",_resize_w:0,_resize_h:0,_origin_w:0,_origin_h:0,_rotateVertical:!1,_resize_direction:"",_move_path:null,_isChange:!1,alignIcons:{basic:t.align_justify,left:t.align_left,right:t.align_right,center:t.align_center}};let i=this.setController_resize.call(e);n.resizing.resizeContainer=i,n.resizing.resizeDiv=i.querySelector(".se-modal-resize"),n.resizing.resizeDot=i.querySelector(".se-resize-dot"),n.resizing.resizeDisplay=i.querySelector(".se-resize-display");let l=this.setController_button.call(e);n.resizing.resizeButton=l;let o=n.resizing.resizeHandles=n.resizing.resizeDot.querySelectorAll("span");n.resizing.resizeButtonGroup=l.querySelector("._se_resizing_btn_group"),n.resizing.rotationButtons=l.querySelectorAll("._se_resizing_btn_group ._se_rotation"),n.resizing.percentageButtons=l.querySelectorAll("._se_resizing_btn_group ._se_percentage"),n.resizing.alignMenu=l.querySelector(".se-resizing-align-list"),n.resizing.alignMenuList=n.resizing.alignMenu.querySelectorAll("button"),n.resizing.alignButton=l.querySelector("._se_resizing_align_button"),n.resizing.autoSizeButton=l.querySelector("._se_resizing_btn_group ._se_auto_size"),n.resizing.captionButton=l.querySelector("._se_resizing_caption_button"),i.addEventListener("mousedown",(function(e){e.preventDefault()})),l.addEventListener("mousedown",e.eventStop),o[0].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),o[1].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),o[2].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),o[3].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),o[4].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),o[5].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),o[6].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),o[7].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),l.addEventListener("click",this.onClick_resizeButton.bind(e)),n.element.relative.appendChild(i),n.element.relative.appendChild(l),i=null,l=null,o=null},setController_resize:function(){const e=this.util.createElement("DIV");return e.className="se-controller se-resizing-container",e.style.display="none",e.innerHTML='
    ',e},setController_button:function(){const e=this.lang,t=this.icons,n=this.util.createElement("DIV");return n.className="se-controller se-controller-resizing",n.innerHTML='
    ",n},_module_getSizeX:function(e,t,n,i){return t||(t=e._element),n||(n=e._cover),i||(i=e._container),t?/%$/.test(t.style.width)?(i&&this.util.getNumber(i.style.width,2)||100)+"%":t.style.width:""},_module_getSizeY:function(e,t,n,i){return t||(t=e._element),n||(n=e._cover),i||(i=e._container),i&&n?this.util.getNumber(n.style.paddingBottom,0)>0&&!this.context.resizing._rotateVertical?n.style.height:/%$/.test(t.style.height)&&/%$/.test(t.style.width)?(i&&this.util.getNumber(i.style.height,2)||100)+"%":t.style.height:t&&t.style.height||""},_module_setModifyInputSize:function(e,t){const n=e._onlyPercentage&&this.context.resizing._rotateVertical;e.proportion.checked=e._proportionChecked="false"!==e._element.getAttribute("data-proportion");let i=n?"":this.plugins.resizing._module_getSizeX.call(this,e);if(i===e._defaultSizeX&&(i=""),e._onlyPercentage&&(i=this.util.getNumber(i,2)),e.inputX.value=i,t.setInputSize.call(this,"x"),!e._onlyPercentage){let t=n?"":this.plugins.resizing._module_getSizeY.call(this,e);t===e._defaultSizeY&&(t=""),e._onlyPercentage&&(t=this.util.getNumber(t,2)),e.inputY.value=t}e.inputX.disabled=!!n,e.inputY.disabled=!!n,e.proportion.disabled=!!n,t.setRatio.call(this)},_module_setInputSize:function(e,t){if(e._onlyPercentage)"x"===t&&e.inputX.value>100&&(e.inputX.value=100);else if(e.proportion.checked&&e._ratio&&/\d/.test(e.inputX.value)&&/\d/.test(e.inputY.value)){const n=e.inputX.value.replace(/\d+|\./g,"")||e.sizeUnit,i=e.inputY.value.replace(/\d+|\./g,"")||e.sizeUnit;if(n!==i)return;const l="%"===n?2:0;"x"===t?e.inputY.value=this.util.getNumber(e._ratioY*this.util.getNumber(e.inputX.value,l),l)+i:e.inputX.value=this.util.getNumber(e._ratioX*this.util.getNumber(e.inputY.value,l),l)+n}},_module_setRatio:function(e){const t=e.inputX.value,n=e.inputY.value;if(e.proportion.checked&&/\d+/.test(t)&&/\d+/.test(n)){if((t.replace(/\d+|\./g,"")||e.sizeUnit)!==(n.replace(/\d+|\./g,"")||e.sizeUnit))e._ratio=!1;else if(!e._ratio){const i=this.util.getNumber(t,0),l=this.util.getNumber(n,0);e._ratio=!0,e._ratioX=i/l,e._ratioY=l/i}}else e._ratio=!1},_module_sizeRevert:function(e){e._onlyPercentage?e.inputX.value=e._origin_w>100?100:e._origin_w:(e.inputX.value=e._origin_w,e.inputY.value=e._origin_h)},_module_saveCurrentSize:function(e){const t=this.plugins.resizing._module_getSizeX.call(this,e),n=this.plugins.resizing._module_getSizeY.call(this,e);e._element.setAttribute("data-size",t+","+n),e._videoRatio&&(e._videoRatio=n)},call_controller_resize:function(e,t){const n=this.context.resizing,i=this.context[t];n._resize_plugin=t;const l=n.resizeContainer,o=n.resizeDiv,s=this.util.getOffset(e,this.context.element.wysiwygFrame),a=n._rotateVertical=/^(90|270)$/.test(Math.abs(e.getAttribute("data-rotate")).toString()),r=a?e.offsetHeight:e.offsetWidth,c=a?e.offsetWidth:e.offsetHeight,d=s.top,u=s.left-this.context.element.wysiwygFrame.scrollLeft;l.style.top=d+"px",l.style.left=u+"px",l.style.width=r+"px",l.style.height=c+"px",o.style.top="0px",o.style.left="0px",o.style.width=r+"px",o.style.height=c+"px";let h=e.getAttribute("data-align")||"basic";h="none"===h?"basic":h;const g=this.util.getParentElement(e,this.util.isComponent),p=this.util.getParentElement(e,"FIGURE"),m=this.plugins.resizing._module_getSizeX.call(this,i,e,p,g)||"auto",f=i._onlyPercentage&&"image"===t?"":", "+(this.plugins.resizing._module_getSizeY.call(this,i,e,p,g)||"auto");this.util.changeTxt(n.resizeDisplay,this.lang.dialogBox[h]+" ("+m+f+")"),n.resizeButtonGroup.style.display=i._resizing?"":"none";const _=!i._resizing||i._resizeDotHide||i._onlyPercentage?"none":"flex",b=n.resizeHandles;for(let e=0,t=b.length;e=360?0:d;s.setAttribute("data-rotate",u),c._rotateVertical=/^(90|270)$/.test(this._w.Math.abs(u).toString()),this.plugins.resizing.setTransformSize.call(this,s,null,null),this.selectComponent(s,l);break;case"onalign":return void this.plugins.resizing.openAlignMenu.call(this);case"align":const h="basic"===i?"none":i;a.setAlign.call(this,h,null,null,null),this.selectComponent(s,l);break;case"caption":const g=!o._captionChecked;if(a.openModify.call(this,!0),o._captionChecked=o.captionCheckEl.checked=g,a.update_image.call(this,!1,!1,!1),g){const e=this.util.getChildElement(o._caption,(function(e){return 3===e.nodeType}));e?this.setRange(e,0,e,e.textContent.length):o._caption.focus(),this.controllersOff()}else this.selectComponent(s,l),a.openModify.call(this,!0);break;case"revert":a.setOriginSize.call(this),this.selectComponent(s,l);break;case"update":a.openModify.call(this),this.controllersOff();break;case"delete":a.destroy.call(this)}this.history.push(!1)}},resetTransform:function(e){const t=(e.getAttribute("data-size")||e.getAttribute("data-origin")||"").split(",");this.context.resizing._rotateVertical=!1,e.style.maxWidth="",e.style.transform="",e.style.transformOrigin="",e.setAttribute("data-rotate",""),e.setAttribute("data-rotateX",""),e.setAttribute("data-rotateY",""),this.plugins[this.context.resizing._resize_plugin].setSize.call(this,t[0]?t[0]:"auto",t[1]?t[1]:"",!0)},setTransformSize:function(e,t,n){let i=e.getAttribute("data-percentage");const l=this.context.resizing._rotateVertical,o=1*e.getAttribute("data-rotate");let s="";if(i&&!l)i=i.split(","),"auto"===i[0]&&"auto"===i[1]?this.plugins[this.context.resizing._resize_plugin].setAutoSize.call(this):this.plugins[this.context.resizing._resize_plugin].setPercentSize.call(this,i[0],i[1]);else{const i=this.util.getParentElement(e,"FIGURE"),a=t||e.offsetWidth,r=n||e.offsetHeight,c=(l?r:a)+"px",d=(l?a:r)+"px";if(this.plugins[this.context.resizing._resize_plugin].cancelPercentAttr.call(this),this.plugins[this.context.resizing._resize_plugin].setSize.call(this,a+"px",r+"px",!0),i.style.width=c,i.style.height=this.context[this.context.resizing._resize_plugin]._caption?"":d,l){let e=a/2+"px "+a/2+"px 0",t=r/2+"px "+r/2+"px 0";s=90===o||-270===o?t:e}}e.style.transformOrigin=s,this.plugins.resizing._setTransForm(e,o.toString(),e.getAttribute("data-rotateX")||"",e.getAttribute("data-rotateY")||""),e.style.maxWidth=l?"none":"",this.plugins.resizing.setCaptionPosition.call(this,e)},_setTransForm:function(e,t,n,i){let l=(e.offsetWidth-e.offsetHeight)*(/-/.test(t)?1:-1),o="";if(/[1-9]/.test(t)&&(n||i))switch(o=n?"Y":"X",t){case"90":o=n&&i?"X":i?o:"";break;case"270":l*=-1,o=n&&i?"Y":n?o:"";break;case"-90":o=n&&i?"Y":n?o:"";break;case"-270":l*=-1,o=n&&i?"X":i?o:"";break;default:o=""}t%180==0&&(e.style.maxWidth=""),e.style.transform="rotate("+t+"deg)"+(n?" rotateX("+n+"deg)":"")+(i?" rotateY("+i+"deg)":"")+(o?" translate"+o+"("+l+"px)":"")},setCaptionPosition:function(e){const t=this.util.getChildElement(this.util.getParentElement(e,"FIGURE"),"FIGCAPTION");t&&(t.style.marginTop=(this.context.resizing._rotateVertical?e.offsetWidth-e.offsetHeight:0)+"px")},onMouseDown_resize_handle:function(e){e.stopPropagation(),e.preventDefault();const t=this.context.resizing,n=t._resize_direction=e.target.classList[0];t._resizeClientX=e.clientX,t._resizeClientY=e.clientY,this.context.element.resizeBackground.style.display="block",t.resizeButton.style.display="none",t.resizeDiv.style.float=/l/.test(n)?"right":/r/.test(n)?"left":"none";const i=function(e){if("keydown"===e.type&&27!==e.keyCode)return;const o=t._isChange;t._isChange=!1,this.removeDocEvent("mousemove",l),this.removeDocEvent("mouseup",i),this.removeDocEvent("keydown",i),"keydown"===e.type?(this.controllersOff(),this.context.element.resizeBackground.style.display="none",this.plugins[this.context.resizing._resize_plugin].init.call(this)):(this.plugins.resizing.cancel_controller_resize.call(this,n),o&&this.history.push(!1))}.bind(this),l=this.plugins.resizing.resizing_element.bind(this,t,n,this.context[t._resize_plugin]);this.addDocEvent("mousemove",l),this.addDocEvent("mouseup",i),this.addDocEvent("keydown",i)},resizing_element:function(e,t,n,i){const l=i.clientX,o=i.clientY;let s=n._element_w,a=n._element_h;const r=n._element_w+(/r/.test(t)?l-e._resizeClientX:e._resizeClientX-l),c=n._element_h+(/b/.test(t)?o-e._resizeClientY:e._resizeClientY-o),d=n._element_h/n._element_w*r;/t/.test(t)&&(e.resizeDiv.style.top=n._element_h-(/h/.test(t)?c:d)+"px"),/l/.test(t)&&(e.resizeDiv.style.left=n._element_w-r+"px"),/r|l/.test(t)&&(e.resizeDiv.style.width=r+"px",s=r),/^(t|b)[^h]$/.test(t)?(e.resizeDiv.style.height=d+"px",a=d):/^(t|b)h$/.test(t)&&(e.resizeDiv.style.height=c+"px",a=c),e._resize_w=s,e._resize_h=a,this.util.changeTxt(e.resizeDisplay,this._w.Math.round(s)+" x "+this._w.Math.round(a)),e._isChange=!0},cancel_controller_resize:function(e){const t=this.context.resizing._rotateVertical;this.controllersOff(),this.context.element.resizeBackground.style.display="none";let n=this._w.Math.round(t?this.context.resizing._resize_h:this.context.resizing._resize_w),i=this._w.Math.round(t?this.context.resizing._resize_w:this.context.resizing._resize_h);if(!t&&!/%$/.test(n)){const e=16,t=this.context.element.wysiwygFrame.clientWidth-2*e-2;this.util.getNumber(n,0)>t&&(i=this._w.Math.round(i/n*t),n=t)}const l=this.context.resizing._resize_plugin;this.plugins[l].setSize.call(this,n,i,!1,e),this.selectComponent(this.context[l]._element,l)}};return void 0===t&&(e.SUNEDITOR_MODULES||Object.defineProperty(e,"SUNEDITOR_MODULES",{enumerable:!0,writable:!1,configurable:!1,value:{}}),Object.defineProperty(e.SUNEDITOR_MODULES,"resizing",{enumerable:!0,writable:!1,configurable:!1,value:n})),n},"object"==typeof e.exports?e.exports=i.document?l(i,!0):function(e){if(!e.document)throw new Error("SUNEDITOR_MODULES a window with a document");return l(e)}:l(i)},"gjS+":function(e,t,n){"use strict";var i,l;i="undefined"!=typeof window?window:this,l=function(e,t){const n={name:"fileManager",_xmlHttp:null,upload:function(e,t,n,i,l){this.showLoading();const o=this.plugins.fileManager,s=o._xmlHttp=this.util.getXMLHttpRequest();if(s.onreadystatechange=o._callBackUpload.bind(this,s,i,l),s.open("post",e,!0),null!==t&&"object"==typeof t&&this._w.Object.keys(t).length>0)for(let e in t)s.setRequestHeader(e,t[e]);s.send(n)},_callBackUpload:function(e,t,n){if(4===e.readyState)if(200===e.status)try{t(e)}catch(e){throw Error('[SUNEDITOR.fileManager.upload.callBack.fail] cause : "'+e.message+'"')}finally{this.closeLoading()}else{this.closeLoading();const t=e.responseText?JSON.parse(e.responseText):e;if("function"!=typeof n||n("",t,this)){const n="[SUNEDITOR.fileManager.upload.serverException] status: "+e.status+", response: "+(t.errorMessage||e.responseText);throw this.functions.noticeOpen(n),Error(n)}}},checkInfo:function(e,t,n,i,l){let o=[];for(let e=0,n=t.length;e-1||(a.splice(t,1),"function"==typeof n&&n(null,e,"delete",null,0,this),t--);l&&(this.context.resizing._resize_plugin=c)},setInfo:function(e,t,n,i,l){const o=l?this.context.resizing._resize_plugin:"";l&&(this.context.resizing._resize_plugin=e);const s=this.plugins[e],a=this.context[e],r=a._infoList;let c=t.getAttribute("data-index"),d=null,u="";if(i||(i={name:t.getAttribute("data-file-name")||("string"==typeof t.src?t.src.split("/").pop():""),size:t.getAttribute("data-file-size")||0}),!c||this._componentsInfoInit)u="create",c=a._infoIndex++,t.setAttribute("data-index",c),t.setAttribute("data-file-name",i.name),t.setAttribute("data-file-size",i.size),d={src:t.src,index:1*c,name:i.name,size:i.size},r.push(d);else{u="update",c*=1;for(let e=0,t=r.length;e=0){const i=this.context[e]._infoList;for(let e=0,l=i.length;e Date: Thu, 8 Oct 2020 16:46:26 +1100 Subject: [PATCH 16/38] mention render improvements, add click listener --- src/assets/css/suneditor.css | 3 +- src/plugins/dialog/mention.js | 83 ++++++++++++++++++++++++-------- test/dev/suneditor_build_test.js | 5 +- 3 files changed, 68 insertions(+), 23 deletions(-) diff --git a/src/assets/css/suneditor.css b/src/assets/css/suneditor.css index 2ca207392..fd486ae30 100755 --- a/src/assets/css/suneditor.css +++ b/src/assets/css/suneditor.css @@ -321,7 +321,8 @@ .sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-math-preview > span {display:inline-block; -webkit-box-shadow:0 0 0 0.1rem #c7deff; box-shadow:0 0 0 0.1rem #c7deff;} /* dialog - modal - se-link-preview */ .sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-link-preview {display:block; height:auto; max-height:18px; margin:4px 0 0 4px; font-size:13px; font-weight:normal; font-family:inherit; color:#666; background-color:transparent; overflow:hidden; text-overflow:ellipsis; word-break:break-all; white-space:pre;} -.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-mention-item {line-height:28px;min-height:25px;padding:0 5px;} +.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-mention-item {line-height:28px;min-height:25px;padding:0 5px;cursor:pointer;} +.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-mention-item:hover {background-color:#e1e1e1} .sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-mention-item.se-mention-active {background-color: #d1d1d1; border-radius:3px;} .sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-mention-search {margin-bottom: 10px;} diff --git a/src/plugins/dialog/mention.js b/src/plugins/dialog/mention.js index 2838d792f..3cdaef45c 100644 --- a/src/plugins/dialog/mention.js +++ b/src/plugins/dialog/mention.js @@ -9,13 +9,22 @@ import dialog from "../modules/dialog"; +const icon = ''; + +function insertAt(parent, child, index) { + if (!index) index = 0; + if (index >= parent.children.length) { + parent.appendChild(child); + } else { + parent.insertBefore(child, parent.children[index]); + } +} + export default { name: "mention", display: "dialog", - title: "mention", - buttonClass: "", - innerHTML: "@", - focussed: 0, + title: "Mention", //TODO: how do i translate this? + innerHTML: icon, renderItem: function(item) { return `${item}`; @@ -31,18 +40,48 @@ export default { renderList: function(term) { const { mention } = this.context; - mention.getItems(term).then((items) => { - mention.items = items; - mention.list.innerHTML = items - .map( - (item, idx) => - `
  • - ${mention.renderItem(item)} -
  • ` - ) - .join(""); + let promise = Promise.resolve(); + if (mention.term !== term) { + mention.focussed = 0; + mention.term = term; + promise = mention.getItems(term).then((items) => { + mention.items = items; + + Object.keys(mention._itemElements).forEach((id) => { + if (!items.find((i) => mention.getId(i) === id)) { + const child = mention._itemElements[id]; + child.parentNode.removeChild(child); + delete mention._itemElements[id]; + } + }); + + items.forEach((item, idx) => { + const id = mention.getId(item); + if (!mention._itemElements[id]) { + const el = this.util.createElement("LI"); + el.setAttribute("data-mention", id); + this.util.addClass(el, 'se-mention-item'); + el.innerHTML = mention.renderItem(item); + el.addEventListener("click", () => { + mention.focussed = idx; + mention.addMention(); + }); + insertAt(mention.list, el, idx); + mention._itemElements[id] = el; + } + }); + }); + } + + promise.then(() => { + const current = mention.list.querySelectorAll(".se-mention-item")[ + mention.focussed + ]; + if (current && !this.util.hasClass(current, "se-mention-active")) { + const prev = mention.list.querySelector(".se-mention-active"); + if (prev) this.util.removeClass(prev, "se-mention-active"); + this.util.addClass(current, "se-mention-active"); + } }); }, @@ -103,6 +142,9 @@ export default { mention.search.value = ""; mention.focussed = 0; mention.items = []; + mention._itemElements = {}; + mention.list.innerHTML = ""; + delete mention.term; }, onKeyPress: function(e) { @@ -123,13 +165,12 @@ export default { break; case "Enter": - mention.add(); + mention.addMention(); e.preventDefault(); e.stopPropagation(); break; default: - mention.focussed = 0; } }, @@ -173,6 +214,7 @@ export default { }, add: function(core) { core.addModule([dialog]); + this.title = core.lang.toolbar.mention; const _dialog = this.setDialog.call(core); core.getMentions = this.getMentions.bind(core); @@ -187,15 +229,16 @@ export default { list, triggerKey: this.triggerKey, visible: false, - add: this.addMention.bind(core), + addMention: this.addMention.bind(core), mentions: [], items: [], + _itemElements: {}, renderList: this.renderList.bind(core), getId: this.getId.bind(core), getValue: this.getValue.bind(core), getLinkHref: this.getLinkHref.bind(core), open: this.open.bind(core), - focussed: this.focussed, + focussed: 0, renderItem: this.renderItem, getItems: this.getItems, }; diff --git a/test/dev/suneditor_build_test.js b/test/dev/suneditor_build_test.js index 38968c230..b22982411 100644 --- a/test/dev/suneditor_build_test.js +++ b/test/dev/suneditor_build_test.js @@ -263,8 +263,9 @@ s1.onKeyDown = function (e, core) { plugins.mention.getItems = async term => [ - {name: 'user1'}, - {name: 'user2'} + {name: 'auser1'}, + {name: 'buser2'}, + {name: 'cuser2'}, ].filter(u => u.name.includes(term)); plugins.mention.getValue = ({ name }) => `@${name}`; From 4c8f25d5157e763937af734e793d20270cf32e49 Mon Sep 17 00:00:00 2001 From: NickyTope Date: Thu, 8 Oct 2020 16:47:27 +1100 Subject: [PATCH 17/38] rebuild --- dist/css/suneditor.min.css | 2 +- dist/suneditor.min.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dist/css/suneditor.min.css b/dist/css/suneditor.min.css index 5a912becb..c8b1c4de1 100644 --- a/dist/css/suneditor.min.css +++ b/dist/css/suneditor.min.css @@ -1 +1 @@ -.sun-editor{width:auto;height:auto;box-sizing:border-box;font-family:Helvetica Neue,sans-serif;border:1px solid #dadada;text-align:left;background-color:#fff;color:#000;user-select:none;-o-user-select:none;-moz-user-select:none;-khtml-user-select:none;-webkit-user-select:none;-ms-user-select:none}.sun-editor *{box-sizing:border-box;-webkit-user-drag:none;overflow:visible}.sun-editor-common button,.sun-editor-common input,.sun-editor-common select,.sun-editor-common textarea{font-size:14px;line-height:1.5}.sun-editor-common blockquote,.sun-editor-common body,.sun-editor-common button,.sun-editor-common code,.sun-editor-common dd,.sun-editor-common div,.sun-editor-common dl,.sun-editor-common dt,.sun-editor-common fieldset,.sun-editor-common form,.sun-editor-common h1,.sun-editor-common h2,.sun-editor-common h3,.sun-editor-common h4,.sun-editor-common h5,.sun-editor-common h6,.sun-editor-common input,.sun-editor-common legend,.sun-editor-common li,.sun-editor-common ol,.sun-editor-common p,.sun-editor-common pre,.sun-editor-common select,.sun-editor-common td,.sun-editor-common textarea,.sun-editor-common th,.sun-editor-common ul{margin:0;padding:0;border:0}.sun-editor-common dl,.sun-editor-common li,.sun-editor-common menu,.sun-editor-common ol,.sun-editor-common ul{list-style:none!important}.sun-editor-common hr{margin:6px 0!important}.sun-editor textarea{resize:none;border:0;padding:0}.sun-editor button{border:0;background-color:transparent;touch-action:manipulation;cursor:pointer;outline:none}.sun-editor button,.sun-editor input,.sun-editor select,.sun-editor textarea{vertical-align:middle}.sun-editor button span{display:block;margin:0;padding:0}.sun-editor button .txt{display:block;margin-top:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.sun-editor button *{pointer-events:none;backface-visibility:hidden;-webkit-backface-visibility:hidden;-moz-backface-visibility:hidden}.sun-editor .se-svg,.sun-editor button>svg{width:16px;height:16px;margin:auto;fill:currentColor;display:block;text-align:center;float:none}.sun-editor .close>svg,.sun-editor .se-dialog-close>svg{width:10px;height:10px}.sun-editor .se-btn-select>svg{float:right;width:10px;height:10px}.sun-editor .se-btn-list>.se-list-icon{display:inline-block;width:16px;height:16px;margin:-1px 10px 0 0;vertical-align:middle}.sun-editor .se-line-breaker>button>svg{width:24px;height:24px}.sun-editor button>i:before{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;display:inline-block;font-style:normal;font-variant:normal;text-rendering:auto;font-size:15px;line-height:2}.sun-editor button>[class=se-icon-text]{font-size:20px;line-height:1}.sun-editor .se-arrow,.sun-editor .se-arrow:after{position:absolute;display:block;width:0;height:0;border:11px solid transparent}.sun-editor .se-arrow.se-arrow-up{top:-11px;left:20px;margin-left:-11px;border-top-width:0;border-bottom-color:rgba(0,0,0,.25)}.sun-editor .se-arrow.se-arrow-up:after{top:1px;margin-left:-11px;content:" ";border-top-width:0;border-bottom-color:#fff}.sun-editor .se-toolbar .se-arrow.se-arrow-up:after{border-bottom-color:#fafafa}.sun-editor .se-arrow.se-arrow-down{top:0;left:0;margin-left:-11px;border-bottom-width:0;border-top-color:rgba(0,0,0,.25)}.sun-editor .se-arrow.se-arrow-down:after{top:-12px;margin-left:-11px;content:" ";border-bottom-width:0;border-top-color:#fff}.sun-editor .se-toolbar .se-arrow.se-arrow-down:after{border-top-color:#fafafa}.sun-editor .se-container{position:relative;width:100%;height:100%}.sun-editor button{color:#000}.sun-editor .se-btn{float:left;width:34px;height:34px;border:0;border-radius:4px;margin:1px!important;padding:0;font-size:12px;line-height:27px}.sun-editor .se-btn:enabled:focus,.sun-editor .se-btn:enabled:hover{background-color:#e1e1e1;border-color:#d1d1d1;outline:0 none}.sun-editor .se-btn:enabled:active{background-color:#d1d1d1;border-color:#c1c1c1;-webkit-box-shadow:inset 0 3px 5px #c1c1c1;box-shadow:inset 0 3px 5px #c1c1c1}.sun-editor .se-btn-primary{color:#000;background-color:#c7deff;border:1px solid #80bdff;border-radius:4px}.sun-editor .se-btn-primary:focus,.sun-editor .se-btn-primary:hover{color:#000;background-color:#80bdff;border-color:#3f9dff;outline:0 none}.sun-editor .se-btn-primary:active{color:#fff;background-color:#3f9dff;border-color:#4592ff;-webkit-box-shadow:inset 0 3px 5px #4592ff;box-shadow:inset 0 3px 5px #4592ff}.sun-editor input,.sun-editor select,.sun-editor textarea{color:#000;border:1px solid #ccc;border-radius:4px}.sun-editor input:focus,.sun-editor select:focus,.sun-editor textarea:focus{border:1px solid #80bdff;outline:0;-webkit-box-shadow:0 0 0 .2rem #c7deff;box-shadow:0 0 0 .2rem #c7deff;transition:border-color .15s ease-in-out,box-shadow .15s ease-in-out}.sun-editor .se-btn:enabled.active{color:#4592ff;outline:0 none}.sun-editor .se-btn:enabled.active:focus,.sun-editor .se-btn:enabled.active:hover{background-color:#e1e1e1;border-color:#d1d1d1;outline:0 none}.sun-editor .se-btn:enabled.active:active{background-color:#d1d1d1;border-color:#c1c1c1;-webkit-box-shadow:inset 0 3px 5px #c1c1c1;box-shadow:inset 0 3px 5px #c1c1c1}.sun-editor .se-btn:enabled.on{background-color:#e1e1e1;border-color:#d1d1d1;outline:0 none}.sun-editor .se-btn:enabled.on:focus,.sun-editor .se-btn:enabled.on:hover{background-color:#d1d1d1;border-color:#c1c1c1;outline:0 none}.sun-editor .se-btn:enabled.on:active{background-color:#c1c1c1;border-color:#b1b1b1;-webkit-box-shadow:inset 0 3px 5px #b1b1b1;box-shadow:inset 0 3px 5px #b1b1b1}.sun-editor .se-btn-list:disabled,.sun-editor .se-btn:disabled,.sun-editor button:disabled{cursor:not-allowed;background-color:inherit;color:#bdbdbd}.sun-editor .se-loading-box{position:absolute;display:none;width:100%;height:100%;top:0;left:0;background-color:#fff;opacity:.7;filter:alpha(opacity=70);z-index:2147483647}.sun-editor .se-loading-box .se-loading-effect{position:absolute;display:block;top:50%;left:50%;height:25px;width:25px;border-top:2px solid #07d;border-right:2px solid transparent;border-radius:50%;animation:spinner .8s linear infinite;margin:-25px 0 0 -25px}.sun-editor .se-line-breaker{position:absolute;display:none;width:100%;height:1px;cursor:text;border-top:1px solid #3288ff;z-index:7}.sun-editor .se-line-breaker>button.se-btn{position:relative;display:inline-block;width:30px;height:30px;top:-15px;float:none;left:-50%;background-color:#fff;border:1px solid #0c2240;opacity:.6;cursor:pointer}.sun-editor .se-line-breaker>button.se-btn:hover{opacity:.9;background-color:#fff;border-color:#041b39}.sun-editor .se-line-breaker-component{position:absolute;display:none;width:24px;height:24px;background-color:#fff;border:1px solid #0c2240;opacity:.6;border-radius:4px;cursor:pointer;z-index:7}.sun-editor .se-line-breaker-component:hover{opacity:.9}.sun-editor .se-toolbar{display:block;position:relative;height:auto;width:100%;overflow:visible;padding:4px 3px 0;margin:0;background-color:#fafafa;outline:1px solid #dadada;z-index:5}.sun-editor .se-toolbar-cover{position:absolute;display:none;font-size:36px;width:100%;height:100%;top:0;left:0;background-color:#fefefe;opacity:.5;filter:alpha(opacity=50);cursor:not-allowed;z-index:4}.sun-editor .se-toolbar-separator-vertical{display:inline-block;height:0;width:0;margin:1px;vertical-align:top}.sun-editor .se-toolbar.se-toolbar-balloon,.sun-editor .se-toolbar.se-toolbar-inline{display:none;position:absolute;z-index:2147483647;box-shadow:0 3px 9px rgba(0,0,0,.5);-webkit-box-shadow:0 3px 9px rgba(0,0,0,.5)}.sun-editor .se-toolbar.se-toolbar-balloon{width:auto}.sun-editor .se-toolbar.se-toolbar-sticky{position:fixed;top:0}.sun-editor .se-toolbar-sticky-dummy{display:none;position:static;z-index:-1}.sun-editor .se-btn-module{display:inline-block}.sun-editor .se-btn-module-border{border:1px solid #dadada;border-radius:4px}.sun-editor .se-btn-module-enter{display:block;width:100%;height:1px;margin-bottom:5px;background-color:transparent}.sun-editor .se-toolbar-more-layer{margin:0 -3px;background-color:#f3f3f3}.sun-editor .se-toolbar-more-layer .se-more-layer{display:none;border-top:1px solid #dadada}.sun-editor .se-toolbar-more-layer .se-more-layer .se-more-form{display:inline-block;width:100%;height:auto;padding:4px 3px 0}.sun-editor .se-btn-module .se-btn-more.se-btn-more-text{width:auto;padding:0 4px}.sun-editor .se-btn-module .se-btn-more:focus,.sun-editor .se-btn-module .se-btn-more:hover{color:#000;background-color:#d1d1d1;border-color:#c1c1c1;outline:0 none}.sun-editor .se-btn-module .se-btn-more.on{color:#333;background-color:#d1d1d1;border-color:#c1c1c1;outline:0 none}.sun-editor .se-btn-module .se-btn-more.on:hover{color:#000;background-color:#c1c1c1;border-color:#b1b1b1;outline:0 none}.sun-editor .se-menu-list,.sun-editor .se-menu-list li{float:left;padding:0;margin:0}.sun-editor .se-menu-list li{position:relative}.sun-editor .se-btn-select{width:auto;display:flex;text-align:left;padding:4px 6px}.sun-editor .se-btn-select .txt{flex:auto;float:left;text-align:left}.sun-editor .se-btn-select.se-btn-tool-font{width:100px}.sun-editor .se-btn-select.se-btn-tool-format,.sun-editor .se-btn-select.se-btn-tool-size{width:80px}.sun-editor .se-btn-tray{position:relative;width:100%;height:100%;margin:0;padding:0}.sun-editor .se-menu-tray{position:absolute;top:0;left:0;width:100%;height:0}.sun-editor .se-submenu{overflow-x:hidden;overflow-y:auto}.sun-editor .se-list-layer{display:none;position:absolute;top:0;left:0;height:auto;z-index:5;border:1px solid #bababa;border-radius:4px;padding:6px 0;background-color:#fff;-webkit-box-shadow:0 3px 9px rgba(0,0,0,.5);box-shadow:0 3px 9px rgba(0,0,0,.5);outline:0 none}.sun-editor .se-list-layer .se-list-inner{padding:0;margin:0;overflow-x:initial;overflow-y:initial;overflow:visible}.sun-editor .se-list-layer button{margin:0;width:100%}.sun-editor .se-list-inner .se-list-basic{width:100%;padding:0}.sun-editor .se-list-inner .se-list-basic li{width:100%}.sun-editor .se-list-inner .se-list-basic li>button{min-width:100%;width:max-content}.sun-editor .se-list-inner .se-list-basic li button.active{background-color:#80bdff;border:1px solid #3f9dff;border-left:0;border-right:0}.sun-editor .se-list-inner .se-list-basic li button.active:hover{background-color:#3f9dff;border:1px solid #4592ff;border-left:0;border-right:0}.sun-editor .se-list-inner .se-list-basic li button.active:active{background-color:#4592ff;border:1px solid #407dd1;border-left:0;border-right:0;-webkit-box-shadow:inset 0 3px 5px #407dd1;box-shadow:inset 0 3px 5px #407dd1}.sun-editor .se-btn-list{width:100%;height:auto;min-height:32px;padding:0 14px;cursor:pointer;font-size:12px;line-height:normal;text-indent:0;text-decoration:none;text-align:left}.sun-editor .se-btn-list.default_value{background-color:#f3f3f3;border-top:1px dotted #b1b1b1;border-bottom:1px dotted #b1b1b1}.sun-editor .se-btn-list:focus,.sun-editor .se-btn-list:hover{background-color:#e1e1e1;border-color:#d1d1d1;outline:0 none}.sun-editor .se-btn-list:active{background-color:#d1d1d1;border-color:#c1c1c1;-webkit-box-shadow:inset 0 3px 5px #c1c1c1;box-shadow:inset 0 3px 5px #c1c1c1}.sun-editor .se-list-layer.se-list-font-size{min-width:140px;max-height:300px}.sun-editor .se-list-layer.se-list-font-family{min-width:156px}.sun-editor .se-list-layer.se-list-font-family .default{border-bottom:1px solid #ccc}.sun-editor .se-list-layer.se-list-line{width:125px}.sun-editor .se-list-layer.se-list-align .se-list-inner{left:9px;width:125px}.sun-editor .se-list-layer.se-list-format{min-width:156px}.sun-editor .se-list-layer.se-list-format li{padding:0;width:100%}.sun-editor .se-list-layer.se-list-format ul .se-btn-list{line-height:100%}.sun-editor .se-list-layer.se-list-format ul .se-btn-list[data-value=h1]{height:40px}.sun-editor .se-list-layer.se-list-format ul .se-btn-list[data-value=h2]{height:34px}.sun-editor .se-list-layer.se-list-format ul p{font-size:13px}.sun-editor .se-list-layer.se-list-format ul div{font-size:13px;padding:4px 2px}.sun-editor .se-list-layer.se-list-format ul h1{font-size:2em;font-weight:700;color:#333}.sun-editor .se-list-layer.se-list-format ul h2{font-size:1.5em;font-weight:700;color:#333}.sun-editor .se-list-layer.se-list-format ul h3{font-size:1.17em;font-weight:700;color:#333}.sun-editor .se-list-layer.se-list-format ul h4{font-size:1em;font-weight:700;color:#333}.sun-editor .se-list-layer.se-list-format ul h5{font-size:.83em;font-weight:700;color:#333}.sun-editor .se-list-layer.se-list-format ul h6{font-size:.67em;font-weight:700;color:#333}.sun-editor .se-list-layer.se-list-format ul blockquote{font-size:13px;color:#999;height:22px;margin:0;background-color:transparent;line-height:1.5;border-color:#b1b1b1;padding:0 0 0 7px;border-left:5px #b1b1b1;border-style:solid}.sun-editor .se-list-layer.se-list-format ul pre{font-size:13px;color:#666;padding:4px 11px;margin:0;background-color:#f9f9f9;border:1px solid #e1e1e1;border-radius:4px}.sun-editor .se-selector-table{display:none;position:absolute;top:34px;left:1px;z-index:5;padding:5px 0;float:left;margin:2px 0 0;font-size:14px;text-align:left;list-style:none;background-color:#fff;-webkit-background-clip:padding-box;background-clip:padding-box;border:1px solid #ccc;border-radius:4px;-webkit-box-shadow:0 6px 12px rgba(0,0,0,.175);box-shadow:0 6px 12px rgba(0,0,0,.175)}.sun-editor .se-selector-table .se-table-size{font-size:18px;padding:0 5px}.sun-editor .se-selector-table .se-table-size-picker{position:absolute!important;z-index:3;font-size:18px;width:10em;height:10em;cursor:pointer}.sun-editor .se-selector-table .se-table-size-highlighted{position:absolute!important;z-index:2;font-size:18px;width:1em;height:1em;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAAZdEVYdFNvZnR3YXJlAEFkb2JlIEltYWdlUmVhZHlxyWU8AAADJmlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNS42LWMxNDIgNzkuMTYwOTI0LCAyMDE3LzA3LzEzLTAxOjA2OjM5ICAgICAgICAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPiA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDo4QTZCNzMzN0I3RUYxMUU4ODcwQ0QwMjM1NTgzRTJDNyIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDo4QTZCNzMzNkI3RUYxMUU4ODcwQ0QwMjM1NTgzRTJDNyIgeG1wOkNyZWF0b3JUb29sPSJBZG9iZSBQaG90b3Nob3AgQ0MgMjAxOCAoV2luZG93cykiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDo0MzYyNEUxRUI3RUUxMUU4ODZGQzgwRjNBODgyNTdFOSIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDo0MzYyNEUxRkI3RUUxMUU4ODZGQzgwRjNBODgyNTdFOSIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/Pl0yAuwAAABBSURBVDhPY/wPBAxUAGCDGvdBeWSAeicIDTfIXREiQArYeR9hEBOEohyMGkQYjBpEGAxjg6ib+yFMygCVvMbAAABj0hwMTNeKJwAAAABJRU5ErkJggg==") repeat}.sun-editor .se-selector-table .se-table-size-unhighlighted{position:relative!important;z-index:1;font-size:18px;width:10em;height:10em;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASAgMAAAAroGbEAAAACVBMVEUAAIj4+Pjp6ekKlAqjAAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAACxMAAAsTAQCanBgAAAAHdElNRQfYAR0BKhmnaJzPAAAAG0lEQVQI12NgAAOtVatWMTCohoaGUY+EmIkEAEruEzK2J7tvAAAAAElFTkSuQmCC") repeat}.sun-editor .se-selector-table .se-table-size-display{padding-left:5px}.sun-editor .se-list-layer .se-selector-color{display:flex;width:max-content;max-width:270px;height:auto;padding:0;margin:auto}.sun-editor .se-list-layer .se-selector-color .se-color-pallet{width:100%;height:100%;padding:0}.sun-editor .se-list-layer .se-selector-color .se-color-pallet li{display:flex;float:left;position:relative;margin:0}.sun-editor .se-list-layer .se-selector-color .se-color-pallet button{display:block;cursor:default;width:30px;height:30px;text-indent:-9999px}.sun-editor .se-list-layer .se-selector-color .se-color-pallet button.active,.sun-editor .se-list-layer .se-selector-color .se-color-pallet button:focus,.sun-editor .se-list-layer .se-selector-color .se-color-pallet button:hover{border:3px solid #fff}.sun-editor .se-submenu-form-group{display:flex;width:100%;height:auto;padding:4px}.sun-editor .se-submenu-form-group input{flex:auto;display:inline-block;width:auto;height:33px;color:#555;font-size:12px;margin:1px 0;padding:0;border-radius:.25rem;border:1px solid #ccc}.sun-editor .se-submenu-form-group button{float:right;width:34px;height:34px;margin:0 0 0 4px!important}.sun-editor .se-submenu-form-group button.se-btn{border:1px solid #ccc}.sun-editor .se-submenu-form-group>div{position:relative}.sun-editor .se-submenu-form-group .se-color-input{width:72px;text-transform:uppercase;border:none;border-bottom:2px solid #b1b1b1;outline:none}.sun-editor .se-submenu-form-group .se-color-input:focus{border-bottom:3px solid #b1b1b1}.sun-editor .se-wrapper{position:relative!important;width:100%;height:auto;overflow:hidden;z-index:1}.sun-editor .se-wrapper .se-wrapper-inner{width:100%;height:100%;min-height:65px;overflow-y:auto;overflow-x:auto;-webkit-overflow-scrolling:touch;user-select:text;-o-user-select:text;-moz-user-select:text;-khtml-user-select:text;-webkit-user-select:text;-ms-user-select:text}.sun-editor .se-wrapper .se-wrapper-inner:focus{outline:none}.sun-editor .se-wrapper .se-wrapper-code{background-color:#191919;color:#fff;font-size:13px;word-break:break-all;padding:4px;margin:0;resize:none!important}.sun-editor .se-wrapper .se-wrapper-wysiwyg{background-color:#fff;display:block}.sun-editor .se-wrapper .se-wrapper-code-mirror{font-size:13px}.sun-editor .se-wrapper .se-placeholder{position:absolute;display:none;white-space:nowrap;text-overflow:ellipsis;z-index:1;color:#b1b1b1;font-size:13px;line-height:1.5;top:0;left:0;right:0;overflow:hidden;margin-top:0;padding-top:16px;padding-left:16px;margin-left:0;padding-right:16px;margin-right:0;pointer-events:none;backface-visibility:hidden;-webkit-backface-visibility:hidden;-moz-backface-visibility:hidden}.sun-editor .se-resizing-bar{display:flex;width:auto;height:auto;min-height:16px;border-top:1px solid #dadada;padding:0 4px;background-color:#fafafa;cursor:ns-resize}.sun-editor .se-resizing-bar.se-resizing-none{cursor:default}.sun-editor .se-resizing-back{position:absolute;display:none;cursor:default;top:0;left:0;width:100%;height:100%;z-index:2147483647}.sun-editor .se-resizing-bar .se-navigation{flex:auto;position:relative;width:auto;height:auto;color:#666;margin:0;padding:0;font-size:10px;font-weight:700;line-height:1.5;background:transparent}.sun-editor .se-resizing-bar .se-char-counter-wrapper{flex:none;position:relative;display:block;width:auto;height:auto;margin:0;padding:0;color:#999;font-size:13px;background:transparent}.sun-editor .se-resizing-bar .se-char-counter-wrapper.se-blink{color:#b94a48;animation:blinker .2s linear infinite}.sun-editor .se-resizing-bar .se-char-counter-wrapper .se-char-label{margin-right:4px}.sun-editor .se-dialog{position:absolute;display:none;top:0;left:0;width:100%;height:100%;z-index:2147483647}.sun-editor .se-dialog button,.sun-editor .se-dialog input,.sun-editor .se-dialog label{font-size:14px;line-height:1.5;color:#111;margin:0}.sun-editor .se-dialog .se-dialog-back{background-color:#222;opacity:.5}.sun-editor .se-dialog .se-dialog-back,.sun-editor .se-dialog .se-dialog-inner{position:absolute;width:100%;height:100%;top:0;left:0}.sun-editor .se-dialog .se-dialog-inner .se-dialog-content{position:relative;width:auto;max-width:500px;margin:20px auto;background-color:#fff;-webkit-background-clip:padding-box;background-clip:padding-box;border:1px solid rgba(0,0,0,.2);border-radius:4px;outline:0;-webkit-box-shadow:0 3px 9px rgba(0,0,0,.5);box-shadow:0 3px 9px rgba(0,0,0,.5)}@media screen and (max-width:509px){.sun-editor .se-dialog .se-dialog-inner .se-dialog-content{width:100%}}.sun-editor .se-dialog .se-dialog-inner .se-dialog-content label{display:inline-block;max-width:100%;margin-bottom:5px;font-weight:700}.sun-editor .se-dialog .se-dialog-inner .se-dialog-content .se-btn-primary{display:inline-block;padding:6px 12px;margin:0 0 10px!important;font-size:14px;font-weight:400;line-height:1.42857143;text-align:center;white-space:nowrap;vertical-align:middle;-ms-touch-action:manipulation;touch-action:manipulation;border-radius:4px}.sun-editor .se-dialog .se-dialog-inner .se-dialog-header{height:50px;padding:6px 15px;border-bottom:1px solid #e5e5e5}.sun-editor .se-dialog .se-dialog-inner .se-dialog-header .se-dialog-close{float:right;font-weight:700;text-shadow:0 1px 0 #fff;-webkit-appearance:none;filter:alpha(opacity=100);opacity:1}.sun-editor .se-dialog .se-dialog-inner .se-dialog-header .se-modal-title{font-size:14px;font-weight:700;margin:0;padding:0;line-height:2.5}.sun-editor .se-dialog .se-dialog-inner .se-dialog-body{position:relative;padding:15px}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form{margin-bottom:10px}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form-footer{margin-top:10px;margin-bottom:0}.sun-editor .se-dialog .se-dialog-inner input:disabled{background-color:#f3f3f3}.sun-editor .se-dialog .se-dialog-inner .se-dialog-size-text{width:100%}.sun-editor .se-dialog .se-dialog-inner .se-dialog-size-text .size-h,.sun-editor .se-dialog .se-dialog-inner .se-dialog-size-text .size-w{width:70px;text-align:center}.sun-editor .se-dialog .se-dialog-inner .se-dialog-size-x{margin:0 8px;width:25px;text-align:center}.sun-editor .se-dialog .se-dialog-inner .se-dialog-footer{padding:10px 15px 0;text-align:right;border-top:1px solid #e5e5e5}.sun-editor .se-dialog .se-dialog-inner .se-dialog-footer>div{float:left}.sun-editor .se-dialog .se-dialog-inner .se-dialog-footer>div>label{margin-top:5px}.sun-editor .se-dialog .se-dialog-inner .se-dialog-btn-radio{margin-left:12px;margin-right:6px}.sun-editor .se-dialog .se-dialog-inner .se-dialog-btn-check{margin-left:12px;margin-right:4px}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form-footer .se-dialog-btn-check{margin-left:0;margin-right:4px}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-dialog-form-files{position:relative;display:flex;align-items:center}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-dialog-form-files>input{flex:auto}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-dialog-form-files .se-dialog-files-edge-button{flex:auto;opacity:.8;border:1px solid #ccc}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-dialog-form-files .se-dialog-files-edge-button.se-file-remove>svg{width:8px;height:8px}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-dialog-form-files .se-dialog-files-edge-button:hover{background-color:#f0f0f0;outline:0 none}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-dialog-form-files .se-dialog-files-edge-button:active{background-color:#e9e9e9;-webkit-box-shadow:inset 0 3px 5px #d6d6d6;box-shadow:inset 0 3px 5px #d6d6d6}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-input-select{display:inline-block;width:auto;height:34px;font-size:14px;text-align:center;line-height:1.42857143}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-input-control{display:inline-block;width:70px;height:34px;font-size:14px;text-align:center;line-height:1.42857143}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-input-form{display:block;width:100%;height:34px;font-size:14px;line-height:1.42857143;padding:0 4px}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-input-form.se-input-url:disabled{text-decoration:line-through;color:#999}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-video-ratio{width:70px;margin-left:4px}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form a{color:#004cff}.sun-editor .se-dialog .se-dialog-inner .se-dialog-btn-revert{border:1px solid #ccc}.sun-editor .se-dialog .se-dialog-inner .se-dialog-btn-revert:hover{background-color:#e1e1e1;border-color:#d1d1d1;outline:0 none}.sun-editor .se-dialog .se-dialog-inner .se-dialog-btn-revert:active{background-color:#d1d1d1;border-color:#c1c1c1;-webkit-box-shadow:inset 0 3px 5px #c1c1c1;box-shadow:inset 0 3px 5px #c1c1c1}.sun-editor .se-dialog-tabs{width:100%;height:25px;border-bottom:1px solid #e5e5e5}.sun-editor .se-dialog-tabs button{background-color:#e5e5e5;border-right:1px solid #e5e5e5;float:left;outline:none;padding:2px 13px;transition:.3s}.sun-editor .se-dialog-tabs button:hover{background-color:#fff}.sun-editor .se-dialog-tabs button.active{background-color:#fff;border-bottom:0}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-input-form.se-math-exp{resize:vertical;height:4rem;border:1px solid #ccc;font-size:13px;padding:4px}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-input-select.se-math-size{width:6em;height:28px;margin-left:1em}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-math-preview{font-size:13px}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-math-preview>span{display:inline-block;-webkit-box-shadow:0 0 0 .1rem #c7deff;box-shadow:0 0 0 .1rem #c7deff}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-link-preview{display:block;height:auto;max-height:18px;margin:4px 0 0 4px;font-size:13px;font-weight:400;font-family:inherit;color:#666;background-color:transparent;overflow:hidden;text-overflow:ellipsis;word-break:break-all;white-space:pre}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-mention-item{line-height:28px;min-height:25px;padding:0 5px}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-mention-item.se-mention-active{background-color:#d1d1d1;border-radius:3px}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-mention-search{margin-bottom:10px}.sun-editor .se-controller .se-arrow.se-arrow-up{border-bottom-color:rgba(0,0,0,.25)}.sun-editor .se-controller{position:absolute;display:none;overflow:visible;z-index:6;border:1px solid rgba(0,0,0,.25);border-radius:4px;text-align:start;text-decoration:none;text-shadow:none;text-transform:none;letter-spacing:normal;word-break:normal;word-spacing:normal;word-wrap:normal;white-space:normal;background-color:#fff;-webkit-background-clip:padding-box;background-clip:padding-box;-webkit-box-shadow:0 5px 10px rgba(0,0,0,.2);box-shadow:0 5px 10px rgba(0,0,0,.2);line-break:auto}.sun-editor .se-controller .se-btn-group{position:relative;display:flex;vertical-align:middle;padding:2px;top:0;left:0}.sun-editor .se-controller .se-btn-group .se-btn-group-sub{left:50%;min-width:auto;width:max-content;display:none}.sun-editor .se-controller .se-btn-group .se-btn-group-sub button{margin:0;min-width:72px}.sun-editor .se-controller .se-btn-group button{position:relative;min-height:34px;height:auto;border:none;border-radius:4px;margin:1px;padding:5px 10px;font-size:12px;line-height:1.5;display:inline-block;font-weight:400;text-align:center;white-space:nowrap;vertical-align:middle;-ms-touch-action:manipulation;touch-action:manipulation}.sun-editor .se-controller .se-btn-group button:focus:enabled,.sun-editor .se-controller .se-btn-group button:hover:enabled{background-color:#e1e1e1;border-color:#d1d1d1;outline:0 none}.sun-editor .se-controller .se-btn-group button:active:enabled{background-color:#d1d1d1;border-color:#c1c1c1;-webkit-box-shadow:inset 0 3px 5px #c1c1c1;box-shadow:inset 0 3px 5px #c1c1c1}.sun-editor .se-controller .se-btn-group button span{display:block;padding:0;margin:0}.sun-editor .se-controller .se-btn-group button:enabled.active{color:#4592ff;outline:0 none}.sun-editor .se-controller .se-btn-group button:enabled.active:focus,.sun-editor .se-controller .se-btn-group button:enabled.active:hover{background-color:#e1e1e1;border-color:#d1d1d1;outline:0 none}.sun-editor .se-controller .se-btn-group button:enabled.active:active{background-color:#d1d1d1;border-color:#c1c1c1;-webkit-box-shadow:inset 0 3px 5px #c1c1c1;box-shadow:inset 0 3px 5px #c1c1c1}.sun-editor .se-controller .se-btn-group button:enabled.on{background-color:#e1e1e1;border-color:#d1d1d1;outline:0 none}.sun-editor .se-controller .se-btn-group button:enabled.on:focus,.sun-editor .se-controller .se-btn-group button:enabled.on:hover{background-color:#d1d1d1;border-color:#c1c1c1;outline:0 none}.sun-editor .se-controller .se-btn-group button:enabled.on:active{background-color:#c1c1c1;border-color:#b1b1b1;-webkit-box-shadow:inset 0 3px 5px #b1b1b1;box-shadow:inset 0 3px 5px #b1b1b1}.sun-editor .se-controller-resizing{margin-top:-50px!important;padding:0;font-size:14px;font-style:normal;font-weight:400;line-height:1.42857143}.sun-editor .se-controller-resizing .se-btn-group .se-btn-group-sub.se-resizing-align-list{left:57px;width:74px}.sun-editor .se-resizing-container{position:absolute;display:none;outline:1px solid #3f9dff;background-color:transparent}.sun-editor .se-resizing-container .se-modal-resize{position:absolute;display:inline-block;background-color:#3f9dff;opacity:.3}.sun-editor .se-resizing-container .se-resize-dot{position:absolute;top:0;left:0;width:100%;height:100%}.sun-editor .se-resizing-container .se-resize-dot>span{position:absolute;width:7px;height:7px;background-color:#3f9dff;border:1px solid #4592ff}.sun-editor .se-resizing-container .se-resize-dot>span.tl{top:-5px;left:-5px;cursor:nw-resize}.sun-editor .se-resizing-container .se-resize-dot>span.tr{top:-5px;right:-5px;cursor:ne-resize}.sun-editor .se-resizing-container .se-resize-dot>span.bl{bottom:-5px;left:-5px;cursor:sw-resize}.sun-editor .se-resizing-container .se-resize-dot>span.br{right:-5px;bottom:-5px;cursor:se-resize}.sun-editor .se-resizing-container .se-resize-dot>span.lw{left:-7px;bottom:50%;cursor:w-resize}.sun-editor .se-resizing-container .se-resize-dot>span.th{left:50%;top:-7px;cursor:n-resize}.sun-editor .se-resizing-container .se-resize-dot>span.rw{right:-7px;bottom:50%;cursor:e-resize}.sun-editor .se-resizing-container .se-resize-dot>span.bh{right:50%;bottom:-7px;cursor:s-resize}.sun-editor .se-resizing-container .se-resize-display{position:absolute;right:0;bottom:0;padding:5px;margin:5px;font-size:12px;color:#fff;background-color:#333;border-radius:4px}.sun-editor .se-controller-table,.sun-editor .se-controller-table-cell{width:auto}.sun-editor .se-controller-link,.sun-editor .se-controller-table,.sun-editor .se-controller-table-cell{padding:0;font-size:14px;font-style:normal;font-weight:400;line-height:1.42857143}.sun-editor .se-controller-link:after,.sun-editor .se-controller-link:before{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.sun-editor .se-controller-link .link-content{padding:0;margin:0}.sun-editor .se-controller-link .link-content a{display:inline-block;color:#4592ff;max-width:200px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;vertical-align:middle;margin-left:5px}.sun-editor .se-file-browser{position:absolute;display:none;top:0;left:0;width:100%;height:100%;z-index:2147483647}.sun-editor .se-file-browser button,.sun-editor .se-file-browser input,.sun-editor .se-file-browser label{font-size:14px;line-height:1.5;color:#111;margin:0}.sun-editor .se-file-browser .se-file-browser-back{background-color:#222;opacity:.5}.sun-editor .se-file-browser .se-file-browser-back,.sun-editor .se-file-browser .se-file-browser-inner{position:absolute;display:block;width:100%;height:100%;top:0;left:0}.sun-editor .se-file-browser .se-file-browser-inner .se-file-browser-content{position:relative;width:960px;max-width:100%;margin:20px auto;background-color:#fff;-webkit-background-clip:padding-box;background-clip:padding-box;border:1px solid rgba(0,0,0,.2);border-radius:4px;outline:0;-webkit-box-shadow:0 3px 9px rgba(0,0,0,.5);box-shadow:0 3px 9px rgba(0,0,0,.5)}.sun-editor .se-file-browser .se-file-browser-header{height:auto;min-height:50px;padding:6px 15px;border-bottom:1px solid #e5e5e5}.sun-editor .se-file-browser .se-file-browser-header .se-file-browser-close{float:right;font-weight:700;text-shadow:0 1px 0 #fff;-webkit-appearance:none;filter:alpha(opacity=100);opacity:1}.sun-editor .se-file-browser .se-file-browser-header .se-file-browser-close>svg{width:12px;height:12px}.sun-editor .se-file-browser .se-file-browser-header .se-file-browser-title{font-size:16px;font-weight:700;margin:0;padding:0;line-height:2.2}.sun-editor .se-file-browser .se-file-browser-tags{display:block;width:100%;padding:0;text-align:left;margin:0 -15px}.sun-editor .se-file-browser .se-file-browser-tags a{display:inline-block;background-color:#f5f5f5;padding:6px 12px;margin:8px 0 8px 8px;color:#333;text-decoration:none;border-radius:32px;-moz-border-radius:32px;-webkit-border-radius:32px;-moz-background-clip:padding;-webkit-background-clip:padding-box;background-clip:padding-box;cursor:pointer}.sun-editor .se-file-browser .se-file-browser-tags a:hover{background-color:#e1e1e1}.sun-editor .se-file-browser .se-file-browser-tags a:active{background-color:#d1d1d1}.sun-editor .se-file-browser .se-file-browser-tags a.on{background-color:#ebf3fe;color:#4592ff}.sun-editor .se-file-browser .se-file-browser-tags a.on:hover{background-color:#d8e8fe}.sun-editor .se-file-browser .se-file-browser-tags a.on:active{background-color:#c7deff}.sun-editor .se-file-browser .se-file-browser-body{position:relative;height:auto;min-height:350px;padding:20px;overflow-y:auto}.sun-editor .se-file-browser .se-file-browser-body .se-file-browser-list{position:relative;width:100%}@media screen and (max-width:992px){.sun-editor .se-file-browser .se-file-browser-inner .se-file-browser-content{width:748px}}@media screen and (max-width:768px){.sun-editor .se-file-browser .se-file-browser-inner .se-file-browser-content{width:600px}}.sun-editor .se-file-browser .se-file-browser-list .se-file-item-column{position:relative;display:block;height:auto;float:left}.sun-editor .se-file-browser .se-file-browser-list.se-image-list .se-file-item-column{width:calc(25% - 20px);margin:0 10px}@media screen and (max-width:992px){.sun-editor .se-file-browser .se-file-browser-list.se-image-list .se-file-item-column{width:calc(33% - 20px)}}@media screen and (max-width:768px){.sun-editor .se-file-browser .se-file-browser-list.se-image-list .se-file-item-column{width:calc(50% - 20px)}}.sun-editor .se-file-browser .se-file-browser-list.se-image-list .se-file-item-img{position:relative;display:block;cursor:pointer;width:100%;height:auto;border-radius:4px;outline:0;margin:10px 0}.sun-editor .se-file-browser .se-file-browser-list.se-image-list .se-file-item-img:hover{opacity:.8;-webkit-box-shadow:0 0 0 .2rem #3288ff;box-shadow:0 0 0 .2rem #3288ff}.sun-editor .se-file-browser .se-file-browser-list.se-image-list .se-file-item-img>img{position:relative;display:block;width:100%;border-radius:4px;outline:0;height:auto}.sun-editor .se-file-browser .se-file-browser-list.se-image-list .se-file-item-img>.se-file-img-name{position:absolute;z-index:1;font-size:13px;color:#fff;left:0;bottom:0;padding:5px 10px;background-color:transparent;width:100%;height:30px;border-bottom-right-radius:4px;border-bottom-left-radius:4px}.sun-editor .se-file-browser .se-file-browser-list.se-image-list .se-file-item-img>.se-file-img-name.se-file-name-back{background-color:#333;opacity:.6}.sun-editor .se-notice{position:absolute;top:0;display:none;z-index:7;width:100%;height:auto;word-break:break-all;font-size:13px;color:#b94a48;background-color:#f2dede;padding:15px;margin:0;border:1px solid #eed3d7;user-select:text;-o-user-select:text;-moz-user-select:text;-khtml-user-select:text;-webkit-user-select:text;-ms-user-select:text}.sun-editor .se-notice button{float:right;padding:7px}.sun-editor .se-tooltip{position:relative;overflow:visible}.sun-editor .se-tooltip .se-tooltip-inner{visibility:hidden;position:absolute;display:block;width:auto;top:120%;left:50%;background:transparent;opacity:0;z-index:1;line-height:1.5;transition:opacity .5s;margin:0;padding:0;bottom:auto;float:none;pointer-events:none;backface-visibility:hidden;-webkit-backface-visibility:hidden;-moz-backface-visibility:hidden}.sun-editor .se-tooltip .se-tooltip-inner .se-tooltip-text{position:relative;display:inline-block;width:auto;left:-50%;font-size:.9em;margin:0;padding:4px 6px;border-radius:2px;background-color:#333;color:#fff;text-align:center;line-height:unset;white-space:nowrap;cursor:auto}.sun-editor .se-tooltip .se-tooltip-inner .se-tooltip-text:after{content:"";position:absolute;bottom:100%;left:50%;margin-left:-5px;border:5px solid transparent;border-bottom-color:#333}.sun-editor .se-tooltip:hover .se-tooltip-inner{visibility:visible;opacity:1}@keyframes blinker{50%{opacity:0}}@keyframes spinner{to{transform:rotate(361deg)}}.sun-editor-editable{font-family:Helvetica Neue,sans-serif;font-size:13px;color:#333;line-height:1.5;text-align:left;background-color:#fff;word-break:normal;word-wrap:break-word;padding:16px;margin:0}.sun-editor-editable *{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;font-family:inherit;font-size:inherit;color:inherit}.sun-editor-editable audio,.sun-editor-editable figcaption,.sun-editor-editable figure,.sun-editor-editable iframe,.sun-editor-editable img,.sun-editor-editable td,.sun-editor-editable th,.sun-editor-editable video{position:relative}.sun-editor-editable .__se__float-left{float:left}.sun-editor-editable .__se__float-right{float:right}.sun-editor-editable .__se__float-center{float:center}.sun-editor-editable .__se__float-none{float:none}.sun-editor-editable :not(.se-code-language .katex) span{display:inline;vertical-align:baseline;margin:0;padding:0}.sun-editor-editable span.katex{display:inline-block}.sun-editor-editable a{color:#004cff;text-decoration:none}.sun-editor-editable span[style~="color:"] a{color:inherit}.sun-editor-editable a:focus,.sun-editor-editable a:hover{cursor:pointer;color:#0093ff;text-decoration:underline}.sun-editor-editable pre{display:block;padding:8px;margin:0 0 10px;font-family:monospace;color:#666;line-height:1.45;background-color:#f9f9f9;border:1px solid #e1e1e1;border-radius:2px;white-space:pre-wrap;word-wrap:break-word;overflow:visible}.sun-editor-editable ol{list-style-type:decimal}.sun-editor-editable ol,.sun-editor-editable ul{display:block;margin-block-start:1em;margin-block-end:1em;margin-inline-start:0;margin-inline-end:0;padding-inline-start:40px}.sun-editor-editable ul{list-style-type:disc}.sun-editor-editable li{display:list-item;text-align:-webkit-match-parent;margin-bottom:5px}.sun-editor-editable ol ol,.sun-editor-editable ol ul,.sun-editor-editable ul ol,.sun-editor-editable ul ul{margin:0}.sun-editor-editable ol ol,.sun-editor-editable ul ol{list-style-type:lower-alpha}.sun-editor-editable ol ol ol,.sun-editor-editable ul ol ol,.sun-editor-editable ul ul ol{list-style-type:upper-roman}.sun-editor-editable ol ul,.sun-editor-editable ul ul{list-style-type:circle}.sun-editor-editable ol ol ul,.sun-editor-editable ol ul ul,.sun-editor-editable ul ul ul{list-style-type:square}.sun-editor-editable sub,.sun-editor-editable sup{font-size:75%;line-height:0}.sun-editor-editable sub{vertical-align:sub}.sun-editor-editable sup{vertical-align:super}.sun-editor-editable p{display:block;margin:0 0 10px}.sun-editor-editable div{display:block;margin:0;padding:0}.sun-editor-editable blockquote{display:block;font-family:inherit;font-size:inherit;color:#999;margin-block-start:1em;margin-block-end:1em;margin-inline-start:0;margin-inline-end:0;padding:0 5px 0 20px;border:solid #b1b1b1;border-width:0 0 0 5px}.sun-editor-editable blockquote blockquote{border-color:#c1c1c1}.sun-editor-editable blockquote blockquote blockquote{border-color:#d1d1d1}.sun-editor-editable blockquote blockquote blockquote blockquote{border-color:#e1e1e1}.sun-editor-editable h1{font-size:2em;margin-block-start:.67em;margin-block-end:.67em}.sun-editor-editable h1,.sun-editor-editable h2{display:block;margin-inline-start:0;margin-inline-end:0;font-weight:700}.sun-editor-editable h2{font-size:1.5em;margin-block-start:.83em;margin-block-end:.83em}.sun-editor-editable h3{font-size:1.17em;margin-block-start:1em;margin-block-end:1em}.sun-editor-editable h3,.sun-editor-editable h4{display:block;margin-inline-start:0;margin-inline-end:0;font-weight:700}.sun-editor-editable h4{font-size:1em;margin-block-start:1.33em;margin-block-end:1.33em}.sun-editor-editable h5{font-size:.83em;margin-block-start:1.67em;margin-block-end:1.67em}.sun-editor-editable h5,.sun-editor-editable h6{display:block;margin-inline-start:0;margin-inline-end:0;font-weight:700}.sun-editor-editable h6{font-size:.67em;margin-block-start:2.33em;margin-block-end:2.33em}.sun-editor-editable hr{display:flex;border-width:1px 0 0;border-color:#000;border-image:initial;height:1px}.sun-editor-editable hr.__se__solid{border-style:solid none none}.sun-editor-editable hr.__se__dotted{border-style:dotted none none}.sun-editor-editable hr.__se__dashed{border-style:dashed none none}.sun-editor-editable table{display:table;table-layout:auto;border:1px solid #ccc;width:100%;max-width:100%;margin:0 0 10px;background-color:transparent;border-spacing:0;border-collapse:collapse}.sun-editor-editable table thead{border-bottom:2px solid #333}.sun-editor-editable table tr{border:1px solid #efefef}.sun-editor-editable table th{background-color:#f3f3f3}.sun-editor-editable table td,.sun-editor-editable table th{border:1px solid #e1e1e1;padding:.4em;background-clip:padding-box}.sun-editor-editable table.se-table-size-auto{width:auto!important}.sun-editor-editable table.se-table-size-100{width:100%!important}.sun-editor-editable table.se-table-layout-auto{table-layout:auto!important}.sun-editor-editable table.se-table-layout-fixed{table-layout:fixed!important}.sun-editor-editable table td.se-table-selected-cell,.sun-editor-editable table th.se-table-selected-cell{border:1px double #4592ff;background-color:#f1f7ff}.sun-editor-editable.se-disabled *{user-select:none;-o-user-select:none;-moz-user-select:none;-khtml-user-select:none;-webkit-user-select:none;-ms-user-select:none}.sun-editor-editable .se-component{display:flex;padding:1px;margin:0 0 10px}.sun-editor-editable .se-component.__se__float-left{margin:0 20px 10px 0}.sun-editor-editable .se-component.__se__float-right{margin:0 0 10px 20px}.sun-editor-editable[contenteditable=true] .se-component{outline:1px dashed #e1e1e1}.sun-editor-editable[contenteditable=true] .se-component.se-component-copy{-webkit-box-shadow:0 0 0 .2rem #80bdff;box-shadow:0 0 0 .2rem #3f9dff;transition:border-color .15s ease-in-out,box-shadow .15s ease-in-out}.sun-editor-editable audio,.sun-editor-editable iframe,.sun-editor-editable img,.sun-editor-editable video{display:block;margin:0;padding:0;width:auto;height:auto;max-width:100%}.sun-editor-editable[contenteditable=true] figure:after{position:absolute;content:"";z-index:1;top:0;left:0;right:0;bottom:0;cursor:default;display:block;background:transparent}.sun-editor-editable[contenteditable=true] figure a,.sun-editor-editable[contenteditable=true] figure iframe,.sun-editor-editable[contenteditable=true] figure img,.sun-editor-editable[contenteditable=true] figure video{z-index:0}.sun-editor-editable[contenteditable=true] figure figcaption{display:block;z-index:2}.sun-editor-editable[contenteditable=true] figure figcaption:focus{border-color:#80bdff;outline:0;-webkit-box-shadow:0 0 0 .2rem #c7deff;box-shadow:0 0 0 .2rem #c7deff}.sun-editor-editable .se-image-container,.sun-editor-editable .se-video-container{width:auto;height:auto;max-width:100%}.sun-editor-editable figure{display:block;outline:none;margin:0;padding:0}.sun-editor-editable figure figcaption{padding:1em .5em;margin:0;background-color:#f9f9f9;outline:none}.sun-editor-editable figure figcaption p{line-height:2;margin:0}.sun-editor-editable .se-image-container a img{padding:1px;margin:1px;outline:1px solid #4592ff}.sun-editor-editable .se-video-container iframe,.sun-editor-editable .se-video-container video{outline:1px solid #9e9e9e;position:absolute;top:0;left:0;border:0;width:100%;height:100%}.sun-editor-editable .se-video-container figure{left:0;width:100%;max-width:100%}.sun-editor-editable audio{width:300px;height:54px}.sun-editor-editable audio.active{outline:2px solid #80bdff}.sun-editor-editable.se-show-block div,.sun-editor-editable.se-show-block h1,.sun-editor-editable.se-show-block h2,.sun-editor-editable.se-show-block h3,.sun-editor-editable.se-show-block h4,.sun-editor-editable.se-show-block h5,.sun-editor-editable.se-show-block h6,.sun-editor-editable.se-show-block li,.sun-editor-editable.se-show-block ol,.sun-editor-editable.se-show-block p,.sun-editor-editable.se-show-block pre,.sun-editor-editable.se-show-block ul{border:1px dashed #3f9dff!important;padding:14px 8px 8px!important}.sun-editor-editable.se-show-block ol,.sun-editor-editable.se-show-block ul{border:1px dashed #d539ff!important}.sun-editor-editable.se-show-block pre{border:1px dashed #27c022!important}.se-show-block p{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAAPAQMAAAAF7dc0AAAABlBMVEWAgID////n1o2sAAAAAnRSTlP/AOW3MEoAAAAaSURBVAjXY/j/gwGCPvxg+F4BQiAGDP1HQQByxxw0gqOzIwAAAABJRU5ErkJggg==") no-repeat}.se-show-block div{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABUAAAAPAQMAAAAxlBYoAAAABlBMVEWAgID////n1o2sAAAAAnRSTlP/AOW3MEoAAAAmSURBVAjXY/j//wcDDH+8XsHwDYi/hwNx1A8w/nYLKH4XoQYJAwCXnSgcl2MOPgAAAABJRU5ErkJggg==") no-repeat}.se-show-block h1{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAPAQMAAAA4f7ZSAAAABlBMVEWAgID////n1o2sAAAAAnRSTlP/AOW3MEoAAAAfSURBVAjXY/j/v4EBhr+9B+LzEPrDeygfhI8j1CBhAEhmJGY4Rf6uAAAAAElFTkSuQmCC") no-repeat}.se-show-block h2{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAPAQMAAAA4f7ZSAAAABlBMVEWAgID////n1o2sAAAAAnRSTlP/AOW3MEoAAAAmSURBVAjXY/j/v4EBhr+dB+LtQPy9geEDEH97D8T3gbgdoQYJAwA51iPuD2haEAAAAABJRU5ErkJggg==") no-repeat}.se-show-block h3{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAPAQMAAAA4f7ZSAAAABlBMVEWAgID////n1o2sAAAAAnRSTlP/AOW3MEoAAAAiSURBVAjXY/j/v4EBhr+dB+LtQPy9geHDeQgN5p9HqEHCADeWI+69VG2MAAAAAElFTkSuQmCC") no-repeat}.se-show-block h4{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAAPAQMAAADTSA1RAAAABlBMVEWAgID////n1o2sAAAAAnRSTlP/AOW3MEoAAAAiSURBVAjXY/j//wADDH97DsTXIfjDdiDdDMTfIRhZHRQDAKJOJ6L+K3y7AAAAAElFTkSuQmCC") no-repeat}.se-show-block h5{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAPAQMAAAA4f7ZSAAAABlBMVEWAgID////n1o2sAAAAAnRSTlP/AOW3MEoAAAAlSURBVAjXY/j/v4EBhr+1A/F+IO5vYPiwHUh/B2IQfR6hBgkDABlWIy5uM+9GAAAAAElFTkSuQmCC") no-repeat}.se-show-block h6{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAPAQMAAAA4f7ZSAAAABlBMVEWAgID////n1o2sAAAAAnRSTlP/AOW3MEoAAAAiSURBVAjXY/j/v4EBhr+dB+LtQLy/geFDP5S9HSKOrA6KAR9GIza1ptJnAAAAAElFTkSuQmCC") no-repeat}.se-show-block li{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAPCAYAAADkmO9VAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAA7SURBVDhPYxgFcNDQ0PAfykQBIHEYhgoRB/BpwCfHBKWpBkaggYxQGgOgBzyQD1aLLA4TGwWDGjAwAACR3RcEU9Ui+wAAAABJRU5ErkJggg==") no-repeat}.se-show-block ol{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAMCAYAAABiDJ37AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAABHSURBVDhPYxgFcNDQ0PAfhKFcFIBLHCdA1oBNM0kGEmMAPgOZoDTVANUNxAqQvURMECADRiiNAWCagDSGGhyW4DRrMAEGBgAu0SX6WpGgjAAAAABJRU5ErkJggg==") no-repeat}.se-show-block ul{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAMCAYAAABiDJ37AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAA1SURBVDhPYxgFDA0NDf+hTBSALI5LDQgwQWmqgVEDKQcsUBoF4ItFGEBXA+QzQpmDGjAwAAA8DQ4Lni6gdAAAAABJRU5ErkJggg==") no-repeat}.sun-editor-editable .__se__p-bordered,.sun-editor .__se__p-bordered{border-top:1px solid #b1b1b1;border-bottom:1px solid #b1b1b1;padding:4px 0}.sun-editor-editable .__se__p-spaced,.sun-editor .__se__p-spaced{letter-spacing:1px}.sun-editor-editable .__se__p-neon,.sun-editor .__se__p-neon{font-weight:200;font-style:italic;background:#000;color:#fff;padding:6px 4px;border:2px solid #fff;border-radius:6px;text-transform:uppercase;animation:neonFlicker 1.5s infinite alternate}@keyframes neonFlicker{0%,19%,21%,23%,25%,54%,56%,to{text-shadow:-.2rem -.2rem 1rem #fff,.2rem .2rem 1rem #fff,0 0 2px #f40,0 0 4px #f40,0 0 6px #f40,0 0 8px #f40,0 0 10px #f40;box-shadow:0 0 .5px #fff,inset 0 0 .5px #fff,0 0 2px #08f,inset 0 0 2px #08f,0 0 4px #08f,inset 0 0 4px #08f}20%,24%,55%{text-shadow:none;box-shadow:none}}.sun-editor-editable .__se__t-shadow,.sun-editor .__se__t-shadow{text-shadow:-.2rem -.2rem 1rem #fff,.2rem .2rem 1rem #fff,0 0 .2rem #999,0 0 .4rem #888,0 0 .6rem #777,0 0 .8rem #666,0 0 1rem #555}.sun-editor-editable .__se__t-code,.sun-editor .__se__t-code{font-family:monospace;color:#666;background-color:rgba(27,31,35,.05);border-radius:6px;padding:.2em .4em} \ No newline at end of file +.sun-editor{width:auto;height:auto;box-sizing:border-box;font-family:Helvetica Neue,sans-serif;border:1px solid #dadada;text-align:left;background-color:#fff;color:#000;user-select:none;-o-user-select:none;-moz-user-select:none;-khtml-user-select:none;-webkit-user-select:none;-ms-user-select:none}.sun-editor *{box-sizing:border-box;-webkit-user-drag:none;overflow:visible}.sun-editor-common button,.sun-editor-common input,.sun-editor-common select,.sun-editor-common textarea{font-size:14px;line-height:1.5}.sun-editor-common blockquote,.sun-editor-common body,.sun-editor-common button,.sun-editor-common code,.sun-editor-common dd,.sun-editor-common div,.sun-editor-common dl,.sun-editor-common dt,.sun-editor-common fieldset,.sun-editor-common form,.sun-editor-common h1,.sun-editor-common h2,.sun-editor-common h3,.sun-editor-common h4,.sun-editor-common h5,.sun-editor-common h6,.sun-editor-common input,.sun-editor-common legend,.sun-editor-common li,.sun-editor-common ol,.sun-editor-common p,.sun-editor-common pre,.sun-editor-common select,.sun-editor-common td,.sun-editor-common textarea,.sun-editor-common th,.sun-editor-common ul{margin:0;padding:0;border:0}.sun-editor-common dl,.sun-editor-common li,.sun-editor-common menu,.sun-editor-common ol,.sun-editor-common ul{list-style:none!important}.sun-editor-common hr{margin:6px 0!important}.sun-editor textarea{resize:none;border:0;padding:0}.sun-editor button{border:0;background-color:transparent;touch-action:manipulation;cursor:pointer;outline:none}.sun-editor button,.sun-editor input,.sun-editor select,.sun-editor textarea{vertical-align:middle}.sun-editor button span{display:block;margin:0;padding:0}.sun-editor button .txt{display:block;margin-top:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.sun-editor button *{pointer-events:none;backface-visibility:hidden;-webkit-backface-visibility:hidden;-moz-backface-visibility:hidden}.sun-editor .se-svg,.sun-editor button>svg{width:16px;height:16px;margin:auto;fill:currentColor;display:block;text-align:center;float:none}.sun-editor .close>svg,.sun-editor .se-dialog-close>svg{width:10px;height:10px}.sun-editor .se-btn-select>svg{float:right;width:10px;height:10px}.sun-editor .se-btn-list>.se-list-icon{display:inline-block;width:16px;height:16px;margin:-1px 10px 0 0;vertical-align:middle}.sun-editor .se-line-breaker>button>svg{width:24px;height:24px}.sun-editor button>i:before{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;display:inline-block;font-style:normal;font-variant:normal;text-rendering:auto;font-size:15px;line-height:2}.sun-editor button>[class=se-icon-text]{font-size:20px;line-height:1}.sun-editor .se-arrow,.sun-editor .se-arrow:after{position:absolute;display:block;width:0;height:0;border:11px solid transparent}.sun-editor .se-arrow.se-arrow-up{top:-11px;left:20px;margin-left:-11px;border-top-width:0;border-bottom-color:rgba(0,0,0,.25)}.sun-editor .se-arrow.se-arrow-up:after{top:1px;margin-left:-11px;content:" ";border-top-width:0;border-bottom-color:#fff}.sun-editor .se-toolbar .se-arrow.se-arrow-up:after{border-bottom-color:#fafafa}.sun-editor .se-arrow.se-arrow-down{top:0;left:0;margin-left:-11px;border-bottom-width:0;border-top-color:rgba(0,0,0,.25)}.sun-editor .se-arrow.se-arrow-down:after{top:-12px;margin-left:-11px;content:" ";border-bottom-width:0;border-top-color:#fff}.sun-editor .se-toolbar .se-arrow.se-arrow-down:after{border-top-color:#fafafa}.sun-editor .se-container{position:relative;width:100%;height:100%}.sun-editor button{color:#000}.sun-editor .se-btn{float:left;width:34px;height:34px;border:0;border-radius:4px;margin:1px!important;padding:0;font-size:12px;line-height:27px}.sun-editor .se-btn:enabled:focus,.sun-editor .se-btn:enabled:hover{background-color:#e1e1e1;border-color:#d1d1d1;outline:0 none}.sun-editor .se-btn:enabled:active{background-color:#d1d1d1;border-color:#c1c1c1;-webkit-box-shadow:inset 0 3px 5px #c1c1c1;box-shadow:inset 0 3px 5px #c1c1c1}.sun-editor .se-btn-primary{color:#000;background-color:#c7deff;border:1px solid #80bdff;border-radius:4px}.sun-editor .se-btn-primary:focus,.sun-editor .se-btn-primary:hover{color:#000;background-color:#80bdff;border-color:#3f9dff;outline:0 none}.sun-editor .se-btn-primary:active{color:#fff;background-color:#3f9dff;border-color:#4592ff;-webkit-box-shadow:inset 0 3px 5px #4592ff;box-shadow:inset 0 3px 5px #4592ff}.sun-editor input,.sun-editor select,.sun-editor textarea{color:#000;border:1px solid #ccc;border-radius:4px}.sun-editor input:focus,.sun-editor select:focus,.sun-editor textarea:focus{border:1px solid #80bdff;outline:0;-webkit-box-shadow:0 0 0 .2rem #c7deff;box-shadow:0 0 0 .2rem #c7deff;transition:border-color .15s ease-in-out,box-shadow .15s ease-in-out}.sun-editor .se-btn:enabled.active{color:#4592ff;outline:0 none}.sun-editor .se-btn:enabled.active:focus,.sun-editor .se-btn:enabled.active:hover{background-color:#e1e1e1;border-color:#d1d1d1;outline:0 none}.sun-editor .se-btn:enabled.active:active{background-color:#d1d1d1;border-color:#c1c1c1;-webkit-box-shadow:inset 0 3px 5px #c1c1c1;box-shadow:inset 0 3px 5px #c1c1c1}.sun-editor .se-btn:enabled.on{background-color:#e1e1e1;border-color:#d1d1d1;outline:0 none}.sun-editor .se-btn:enabled.on:focus,.sun-editor .se-btn:enabled.on:hover{background-color:#d1d1d1;border-color:#c1c1c1;outline:0 none}.sun-editor .se-btn:enabled.on:active{background-color:#c1c1c1;border-color:#b1b1b1;-webkit-box-shadow:inset 0 3px 5px #b1b1b1;box-shadow:inset 0 3px 5px #b1b1b1}.sun-editor .se-btn-list:disabled,.sun-editor .se-btn:disabled,.sun-editor button:disabled{cursor:not-allowed;background-color:inherit;color:#bdbdbd}.sun-editor .se-loading-box{position:absolute;display:none;width:100%;height:100%;top:0;left:0;background-color:#fff;opacity:.7;filter:alpha(opacity=70);z-index:2147483647}.sun-editor .se-loading-box .se-loading-effect{position:absolute;display:block;top:50%;left:50%;height:25px;width:25px;border-top:2px solid #07d;border-right:2px solid transparent;border-radius:50%;animation:spinner .8s linear infinite;margin:-25px 0 0 -25px}.sun-editor .se-line-breaker{position:absolute;display:none;width:100%;height:1px;cursor:text;border-top:1px solid #3288ff;z-index:7}.sun-editor .se-line-breaker>button.se-btn{position:relative;display:inline-block;width:30px;height:30px;top:-15px;float:none;left:-50%;background-color:#fff;border:1px solid #0c2240;opacity:.6;cursor:pointer}.sun-editor .se-line-breaker>button.se-btn:hover{opacity:.9;background-color:#fff;border-color:#041b39}.sun-editor .se-line-breaker-component{position:absolute;display:none;width:24px;height:24px;background-color:#fff;border:1px solid #0c2240;opacity:.6;border-radius:4px;cursor:pointer;z-index:7}.sun-editor .se-line-breaker-component:hover{opacity:.9}.sun-editor .se-toolbar{display:block;position:relative;height:auto;width:100%;overflow:visible;padding:4px 3px 0;margin:0;background-color:#fafafa;outline:1px solid #dadada;z-index:5}.sun-editor .se-toolbar-cover{position:absolute;display:none;font-size:36px;width:100%;height:100%;top:0;left:0;background-color:#fefefe;opacity:.5;filter:alpha(opacity=50);cursor:not-allowed;z-index:4}.sun-editor .se-toolbar-separator-vertical{display:inline-block;height:0;width:0;margin:1px;vertical-align:top}.sun-editor .se-toolbar.se-toolbar-balloon,.sun-editor .se-toolbar.se-toolbar-inline{display:none;position:absolute;z-index:2147483647;box-shadow:0 3px 9px rgba(0,0,0,.5);-webkit-box-shadow:0 3px 9px rgba(0,0,0,.5)}.sun-editor .se-toolbar.se-toolbar-balloon{width:auto}.sun-editor .se-toolbar.se-toolbar-sticky{position:fixed;top:0}.sun-editor .se-toolbar-sticky-dummy{display:none;position:static;z-index:-1}.sun-editor .se-btn-module{display:inline-block}.sun-editor .se-btn-module-border{border:1px solid #dadada;border-radius:4px}.sun-editor .se-btn-module-enter{display:block;width:100%;height:1px;margin-bottom:5px;background-color:transparent}.sun-editor .se-toolbar-more-layer{margin:0 -3px;background-color:#f3f3f3}.sun-editor .se-toolbar-more-layer .se-more-layer{display:none;border-top:1px solid #dadada}.sun-editor .se-toolbar-more-layer .se-more-layer .se-more-form{display:inline-block;width:100%;height:auto;padding:4px 3px 0}.sun-editor .se-btn-module .se-btn-more.se-btn-more-text{width:auto;padding:0 4px}.sun-editor .se-btn-module .se-btn-more:focus,.sun-editor .se-btn-module .se-btn-more:hover{color:#000;background-color:#d1d1d1;border-color:#c1c1c1;outline:0 none}.sun-editor .se-btn-module .se-btn-more.on{color:#333;background-color:#d1d1d1;border-color:#c1c1c1;outline:0 none}.sun-editor .se-btn-module .se-btn-more.on:hover{color:#000;background-color:#c1c1c1;border-color:#b1b1b1;outline:0 none}.sun-editor .se-menu-list,.sun-editor .se-menu-list li{float:left;padding:0;margin:0}.sun-editor .se-menu-list li{position:relative}.sun-editor .se-btn-select{width:auto;display:flex;text-align:left;padding:4px 6px}.sun-editor .se-btn-select .txt{flex:auto;float:left;text-align:left}.sun-editor .se-btn-select.se-btn-tool-font{width:100px}.sun-editor .se-btn-select.se-btn-tool-format,.sun-editor .se-btn-select.se-btn-tool-size{width:80px}.sun-editor .se-btn-tray{position:relative;width:100%;height:100%;margin:0;padding:0}.sun-editor .se-menu-tray{position:absolute;top:0;left:0;width:100%;height:0}.sun-editor .se-submenu{overflow-x:hidden;overflow-y:auto}.sun-editor .se-list-layer{display:none;position:absolute;top:0;left:0;height:auto;z-index:5;border:1px solid #bababa;border-radius:4px;padding:6px 0;background-color:#fff;-webkit-box-shadow:0 3px 9px rgba(0,0,0,.5);box-shadow:0 3px 9px rgba(0,0,0,.5);outline:0 none}.sun-editor .se-list-layer .se-list-inner{padding:0;margin:0;overflow-x:initial;overflow-y:initial;overflow:visible}.sun-editor .se-list-layer button{margin:0;width:100%}.sun-editor .se-list-inner .se-list-basic{width:100%;padding:0}.sun-editor .se-list-inner .se-list-basic li{width:100%}.sun-editor .se-list-inner .se-list-basic li>button{min-width:100%;width:max-content}.sun-editor .se-list-inner .se-list-basic li button.active{background-color:#80bdff;border:1px solid #3f9dff;border-left:0;border-right:0}.sun-editor .se-list-inner .se-list-basic li button.active:hover{background-color:#3f9dff;border:1px solid #4592ff;border-left:0;border-right:0}.sun-editor .se-list-inner .se-list-basic li button.active:active{background-color:#4592ff;border:1px solid #407dd1;border-left:0;border-right:0;-webkit-box-shadow:inset 0 3px 5px #407dd1;box-shadow:inset 0 3px 5px #407dd1}.sun-editor .se-btn-list{width:100%;height:auto;min-height:32px;padding:0 14px;cursor:pointer;font-size:12px;line-height:normal;text-indent:0;text-decoration:none;text-align:left}.sun-editor .se-btn-list.default_value{background-color:#f3f3f3;border-top:1px dotted #b1b1b1;border-bottom:1px dotted #b1b1b1}.sun-editor .se-btn-list:focus,.sun-editor .se-btn-list:hover{background-color:#e1e1e1;border-color:#d1d1d1;outline:0 none}.sun-editor .se-btn-list:active{background-color:#d1d1d1;border-color:#c1c1c1;-webkit-box-shadow:inset 0 3px 5px #c1c1c1;box-shadow:inset 0 3px 5px #c1c1c1}.sun-editor .se-list-layer.se-list-font-size{min-width:140px;max-height:300px}.sun-editor .se-list-layer.se-list-font-family{min-width:156px}.sun-editor .se-list-layer.se-list-font-family .default{border-bottom:1px solid #ccc}.sun-editor .se-list-layer.se-list-line{width:125px}.sun-editor .se-list-layer.se-list-align .se-list-inner{left:9px;width:125px}.sun-editor .se-list-layer.se-list-format{min-width:156px}.sun-editor .se-list-layer.se-list-format li{padding:0;width:100%}.sun-editor .se-list-layer.se-list-format ul .se-btn-list{line-height:100%}.sun-editor .se-list-layer.se-list-format ul .se-btn-list[data-value=h1]{height:40px}.sun-editor .se-list-layer.se-list-format ul .se-btn-list[data-value=h2]{height:34px}.sun-editor .se-list-layer.se-list-format ul p{font-size:13px}.sun-editor .se-list-layer.se-list-format ul div{font-size:13px;padding:4px 2px}.sun-editor .se-list-layer.se-list-format ul h1{font-size:2em;font-weight:700;color:#333}.sun-editor .se-list-layer.se-list-format ul h2{font-size:1.5em;font-weight:700;color:#333}.sun-editor .se-list-layer.se-list-format ul h3{font-size:1.17em;font-weight:700;color:#333}.sun-editor .se-list-layer.se-list-format ul h4{font-size:1em;font-weight:700;color:#333}.sun-editor .se-list-layer.se-list-format ul h5{font-size:.83em;font-weight:700;color:#333}.sun-editor .se-list-layer.se-list-format ul h6{font-size:.67em;font-weight:700;color:#333}.sun-editor .se-list-layer.se-list-format ul blockquote{font-size:13px;color:#999;height:22px;margin:0;background-color:transparent;line-height:1.5;border-color:#b1b1b1;padding:0 0 0 7px;border-left:5px #b1b1b1;border-style:solid}.sun-editor .se-list-layer.se-list-format ul pre{font-size:13px;color:#666;padding:4px 11px;margin:0;background-color:#f9f9f9;border:1px solid #e1e1e1;border-radius:4px}.sun-editor .se-selector-table{display:none;position:absolute;top:34px;left:1px;z-index:5;padding:5px 0;float:left;margin:2px 0 0;font-size:14px;text-align:left;list-style:none;background-color:#fff;-webkit-background-clip:padding-box;background-clip:padding-box;border:1px solid #ccc;border-radius:4px;-webkit-box-shadow:0 6px 12px rgba(0,0,0,.175);box-shadow:0 6px 12px rgba(0,0,0,.175)}.sun-editor .se-selector-table .se-table-size{font-size:18px;padding:0 5px}.sun-editor .se-selector-table .se-table-size-picker{position:absolute!important;z-index:3;font-size:18px;width:10em;height:10em;cursor:pointer}.sun-editor .se-selector-table .se-table-size-highlighted{position:absolute!important;z-index:2;font-size:18px;width:1em;height:1em;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAAZdEVYdFNvZnR3YXJlAEFkb2JlIEltYWdlUmVhZHlxyWU8AAADJmlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNS42LWMxNDIgNzkuMTYwOTI0LCAyMDE3LzA3LzEzLTAxOjA2OjM5ICAgICAgICAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPiA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDo4QTZCNzMzN0I3RUYxMUU4ODcwQ0QwMjM1NTgzRTJDNyIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDo4QTZCNzMzNkI3RUYxMUU4ODcwQ0QwMjM1NTgzRTJDNyIgeG1wOkNyZWF0b3JUb29sPSJBZG9iZSBQaG90b3Nob3AgQ0MgMjAxOCAoV2luZG93cykiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDo0MzYyNEUxRUI3RUUxMUU4ODZGQzgwRjNBODgyNTdFOSIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDo0MzYyNEUxRkI3RUUxMUU4ODZGQzgwRjNBODgyNTdFOSIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/Pl0yAuwAAABBSURBVDhPY/wPBAxUAGCDGvdBeWSAeicIDTfIXREiQArYeR9hEBOEohyMGkQYjBpEGAxjg6ib+yFMygCVvMbAAABj0hwMTNeKJwAAAABJRU5ErkJggg==") repeat}.sun-editor .se-selector-table .se-table-size-unhighlighted{position:relative!important;z-index:1;font-size:18px;width:10em;height:10em;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASAgMAAAAroGbEAAAACVBMVEUAAIj4+Pjp6ekKlAqjAAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAACxMAAAsTAQCanBgAAAAHdElNRQfYAR0BKhmnaJzPAAAAG0lEQVQI12NgAAOtVatWMTCohoaGUY+EmIkEAEruEzK2J7tvAAAAAElFTkSuQmCC") repeat}.sun-editor .se-selector-table .se-table-size-display{padding-left:5px}.sun-editor .se-list-layer .se-selector-color{display:flex;width:max-content;max-width:270px;height:auto;padding:0;margin:auto}.sun-editor .se-list-layer .se-selector-color .se-color-pallet{width:100%;height:100%;padding:0}.sun-editor .se-list-layer .se-selector-color .se-color-pallet li{display:flex;float:left;position:relative;margin:0}.sun-editor .se-list-layer .se-selector-color .se-color-pallet button{display:block;cursor:default;width:30px;height:30px;text-indent:-9999px}.sun-editor .se-list-layer .se-selector-color .se-color-pallet button.active,.sun-editor .se-list-layer .se-selector-color .se-color-pallet button:focus,.sun-editor .se-list-layer .se-selector-color .se-color-pallet button:hover{border:3px solid #fff}.sun-editor .se-submenu-form-group{display:flex;width:100%;height:auto;padding:4px}.sun-editor .se-submenu-form-group input{flex:auto;display:inline-block;width:auto;height:33px;color:#555;font-size:12px;margin:1px 0;padding:0;border-radius:.25rem;border:1px solid #ccc}.sun-editor .se-submenu-form-group button{float:right;width:34px;height:34px;margin:0 0 0 4px!important}.sun-editor .se-submenu-form-group button.se-btn{border:1px solid #ccc}.sun-editor .se-submenu-form-group>div{position:relative}.sun-editor .se-submenu-form-group .se-color-input{width:72px;text-transform:uppercase;border:none;border-bottom:2px solid #b1b1b1;outline:none}.sun-editor .se-submenu-form-group .se-color-input:focus{border-bottom:3px solid #b1b1b1}.sun-editor .se-wrapper{position:relative!important;width:100%;height:auto;overflow:hidden;z-index:1}.sun-editor .se-wrapper .se-wrapper-inner{width:100%;height:100%;min-height:65px;overflow-y:auto;overflow-x:auto;-webkit-overflow-scrolling:touch;user-select:text;-o-user-select:text;-moz-user-select:text;-khtml-user-select:text;-webkit-user-select:text;-ms-user-select:text}.sun-editor .se-wrapper .se-wrapper-inner:focus{outline:none}.sun-editor .se-wrapper .se-wrapper-code{background-color:#191919;color:#fff;font-size:13px;word-break:break-all;padding:4px;margin:0;resize:none!important}.sun-editor .se-wrapper .se-wrapper-wysiwyg{background-color:#fff;display:block}.sun-editor .se-wrapper .se-wrapper-code-mirror{font-size:13px}.sun-editor .se-wrapper .se-placeholder{position:absolute;display:none;white-space:nowrap;text-overflow:ellipsis;z-index:1;color:#b1b1b1;font-size:13px;line-height:1.5;top:0;left:0;right:0;overflow:hidden;margin-top:0;padding-top:16px;padding-left:16px;margin-left:0;padding-right:16px;margin-right:0;pointer-events:none;backface-visibility:hidden;-webkit-backface-visibility:hidden;-moz-backface-visibility:hidden}.sun-editor .se-resizing-bar{display:flex;width:auto;height:auto;min-height:16px;border-top:1px solid #dadada;padding:0 4px;background-color:#fafafa;cursor:ns-resize}.sun-editor .se-resizing-bar.se-resizing-none{cursor:default}.sun-editor .se-resizing-back{position:absolute;display:none;cursor:default;top:0;left:0;width:100%;height:100%;z-index:2147483647}.sun-editor .se-resizing-bar .se-navigation{flex:auto;position:relative;width:auto;height:auto;color:#666;margin:0;padding:0;font-size:10px;font-weight:700;line-height:1.5;background:transparent}.sun-editor .se-resizing-bar .se-char-counter-wrapper{flex:none;position:relative;display:block;width:auto;height:auto;margin:0;padding:0;color:#999;font-size:13px;background:transparent}.sun-editor .se-resizing-bar .se-char-counter-wrapper.se-blink{color:#b94a48;animation:blinker .2s linear infinite}.sun-editor .se-resizing-bar .se-char-counter-wrapper .se-char-label{margin-right:4px}.sun-editor .se-dialog{position:absolute;display:none;top:0;left:0;width:100%;height:100%;z-index:2147483647}.sun-editor .se-dialog button,.sun-editor .se-dialog input,.sun-editor .se-dialog label{font-size:14px;line-height:1.5;color:#111;margin:0}.sun-editor .se-dialog .se-dialog-back{background-color:#222;opacity:.5}.sun-editor .se-dialog .se-dialog-back,.sun-editor .se-dialog .se-dialog-inner{position:absolute;width:100%;height:100%;top:0;left:0}.sun-editor .se-dialog .se-dialog-inner .se-dialog-content{position:relative;width:auto;max-width:500px;margin:20px auto;background-color:#fff;-webkit-background-clip:padding-box;background-clip:padding-box;border:1px solid rgba(0,0,0,.2);border-radius:4px;outline:0;-webkit-box-shadow:0 3px 9px rgba(0,0,0,.5);box-shadow:0 3px 9px rgba(0,0,0,.5)}@media screen and (max-width:509px){.sun-editor .se-dialog .se-dialog-inner .se-dialog-content{width:100%}}.sun-editor .se-dialog .se-dialog-inner .se-dialog-content label{display:inline-block;max-width:100%;margin-bottom:5px;font-weight:700}.sun-editor .se-dialog .se-dialog-inner .se-dialog-content .se-btn-primary{display:inline-block;padding:6px 12px;margin:0 0 10px!important;font-size:14px;font-weight:400;line-height:1.42857143;text-align:center;white-space:nowrap;vertical-align:middle;-ms-touch-action:manipulation;touch-action:manipulation;border-radius:4px}.sun-editor .se-dialog .se-dialog-inner .se-dialog-header{height:50px;padding:6px 15px;border-bottom:1px solid #e5e5e5}.sun-editor .se-dialog .se-dialog-inner .se-dialog-header .se-dialog-close{float:right;font-weight:700;text-shadow:0 1px 0 #fff;-webkit-appearance:none;filter:alpha(opacity=100);opacity:1}.sun-editor .se-dialog .se-dialog-inner .se-dialog-header .se-modal-title{font-size:14px;font-weight:700;margin:0;padding:0;line-height:2.5}.sun-editor .se-dialog .se-dialog-inner .se-dialog-body{position:relative;padding:15px}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form{margin-bottom:10px}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form-footer{margin-top:10px;margin-bottom:0}.sun-editor .se-dialog .se-dialog-inner input:disabled{background-color:#f3f3f3}.sun-editor .se-dialog .se-dialog-inner .se-dialog-size-text{width:100%}.sun-editor .se-dialog .se-dialog-inner .se-dialog-size-text .size-h,.sun-editor .se-dialog .se-dialog-inner .se-dialog-size-text .size-w{width:70px;text-align:center}.sun-editor .se-dialog .se-dialog-inner .se-dialog-size-x{margin:0 8px;width:25px;text-align:center}.sun-editor .se-dialog .se-dialog-inner .se-dialog-footer{padding:10px 15px 0;text-align:right;border-top:1px solid #e5e5e5}.sun-editor .se-dialog .se-dialog-inner .se-dialog-footer>div{float:left}.sun-editor .se-dialog .se-dialog-inner .se-dialog-footer>div>label{margin-top:5px}.sun-editor .se-dialog .se-dialog-inner .se-dialog-btn-radio{margin-left:12px;margin-right:6px}.sun-editor .se-dialog .se-dialog-inner .se-dialog-btn-check{margin-left:12px;margin-right:4px}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form-footer .se-dialog-btn-check{margin-left:0;margin-right:4px}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-dialog-form-files{position:relative;display:flex;align-items:center}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-dialog-form-files>input{flex:auto}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-dialog-form-files .se-dialog-files-edge-button{flex:auto;opacity:.8;border:1px solid #ccc}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-dialog-form-files .se-dialog-files-edge-button.se-file-remove>svg{width:8px;height:8px}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-dialog-form-files .se-dialog-files-edge-button:hover{background-color:#f0f0f0;outline:0 none}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-dialog-form-files .se-dialog-files-edge-button:active{background-color:#e9e9e9;-webkit-box-shadow:inset 0 3px 5px #d6d6d6;box-shadow:inset 0 3px 5px #d6d6d6}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-input-select{display:inline-block;width:auto;height:34px;font-size:14px;text-align:center;line-height:1.42857143}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-input-control{display:inline-block;width:70px;height:34px;font-size:14px;text-align:center;line-height:1.42857143}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-input-form{display:block;width:100%;height:34px;font-size:14px;line-height:1.42857143;padding:0 4px}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-input-form.se-input-url:disabled{text-decoration:line-through;color:#999}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-video-ratio{width:70px;margin-left:4px}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form a{color:#004cff}.sun-editor .se-dialog .se-dialog-inner .se-dialog-btn-revert{border:1px solid #ccc}.sun-editor .se-dialog .se-dialog-inner .se-dialog-btn-revert:hover{background-color:#e1e1e1;border-color:#d1d1d1;outline:0 none}.sun-editor .se-dialog .se-dialog-inner .se-dialog-btn-revert:active{background-color:#d1d1d1;border-color:#c1c1c1;-webkit-box-shadow:inset 0 3px 5px #c1c1c1;box-shadow:inset 0 3px 5px #c1c1c1}.sun-editor .se-dialog-tabs{width:100%;height:25px;border-bottom:1px solid #e5e5e5}.sun-editor .se-dialog-tabs button{background-color:#e5e5e5;border-right:1px solid #e5e5e5;float:left;outline:none;padding:2px 13px;transition:.3s}.sun-editor .se-dialog-tabs button:hover{background-color:#fff}.sun-editor .se-dialog-tabs button.active{background-color:#fff;border-bottom:0}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-input-form.se-math-exp{resize:vertical;height:4rem;border:1px solid #ccc;font-size:13px;padding:4px}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-input-select.se-math-size{width:6em;height:28px;margin-left:1em}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-math-preview{font-size:13px}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-math-preview>span{display:inline-block;-webkit-box-shadow:0 0 0 .1rem #c7deff;box-shadow:0 0 0 .1rem #c7deff}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-link-preview{display:block;height:auto;max-height:18px;margin:4px 0 0 4px;font-size:13px;font-weight:400;font-family:inherit;color:#666;background-color:transparent;overflow:hidden;text-overflow:ellipsis;word-break:break-all;white-space:pre}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-mention-item{line-height:28px;min-height:25px;padding:0 5px;cursor:pointer}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-mention-item:hover{background-color:#e1e1e1}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-mention-item.se-mention-active{background-color:#d1d1d1;border-radius:3px}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-mention-search{margin-bottom:10px}.sun-editor .se-controller .se-arrow.se-arrow-up{border-bottom-color:rgba(0,0,0,.25)}.sun-editor .se-controller{position:absolute;display:none;overflow:visible;z-index:6;border:1px solid rgba(0,0,0,.25);border-radius:4px;text-align:start;text-decoration:none;text-shadow:none;text-transform:none;letter-spacing:normal;word-break:normal;word-spacing:normal;word-wrap:normal;white-space:normal;background-color:#fff;-webkit-background-clip:padding-box;background-clip:padding-box;-webkit-box-shadow:0 5px 10px rgba(0,0,0,.2);box-shadow:0 5px 10px rgba(0,0,0,.2);line-break:auto}.sun-editor .se-controller .se-btn-group{position:relative;display:flex;vertical-align:middle;padding:2px;top:0;left:0}.sun-editor .se-controller .se-btn-group .se-btn-group-sub{left:50%;min-width:auto;width:max-content;display:none}.sun-editor .se-controller .se-btn-group .se-btn-group-sub button{margin:0;min-width:72px}.sun-editor .se-controller .se-btn-group button{position:relative;min-height:34px;height:auto;border:none;border-radius:4px;margin:1px;padding:5px 10px;font-size:12px;line-height:1.5;display:inline-block;font-weight:400;text-align:center;white-space:nowrap;vertical-align:middle;-ms-touch-action:manipulation;touch-action:manipulation}.sun-editor .se-controller .se-btn-group button:focus:enabled,.sun-editor .se-controller .se-btn-group button:hover:enabled{background-color:#e1e1e1;border-color:#d1d1d1;outline:0 none}.sun-editor .se-controller .se-btn-group button:active:enabled{background-color:#d1d1d1;border-color:#c1c1c1;-webkit-box-shadow:inset 0 3px 5px #c1c1c1;box-shadow:inset 0 3px 5px #c1c1c1}.sun-editor .se-controller .se-btn-group button span{display:block;padding:0;margin:0}.sun-editor .se-controller .se-btn-group button:enabled.active{color:#4592ff;outline:0 none}.sun-editor .se-controller .se-btn-group button:enabled.active:focus,.sun-editor .se-controller .se-btn-group button:enabled.active:hover{background-color:#e1e1e1;border-color:#d1d1d1;outline:0 none}.sun-editor .se-controller .se-btn-group button:enabled.active:active{background-color:#d1d1d1;border-color:#c1c1c1;-webkit-box-shadow:inset 0 3px 5px #c1c1c1;box-shadow:inset 0 3px 5px #c1c1c1}.sun-editor .se-controller .se-btn-group button:enabled.on{background-color:#e1e1e1;border-color:#d1d1d1;outline:0 none}.sun-editor .se-controller .se-btn-group button:enabled.on:focus,.sun-editor .se-controller .se-btn-group button:enabled.on:hover{background-color:#d1d1d1;border-color:#c1c1c1;outline:0 none}.sun-editor .se-controller .se-btn-group button:enabled.on:active{background-color:#c1c1c1;border-color:#b1b1b1;-webkit-box-shadow:inset 0 3px 5px #b1b1b1;box-shadow:inset 0 3px 5px #b1b1b1}.sun-editor .se-controller-resizing{margin-top:-50px!important;padding:0;font-size:14px;font-style:normal;font-weight:400;line-height:1.42857143}.sun-editor .se-controller-resizing .se-btn-group .se-btn-group-sub.se-resizing-align-list{left:57px;width:74px}.sun-editor .se-resizing-container{position:absolute;display:none;outline:1px solid #3f9dff;background-color:transparent}.sun-editor .se-resizing-container .se-modal-resize{position:absolute;display:inline-block;background-color:#3f9dff;opacity:.3}.sun-editor .se-resizing-container .se-resize-dot{position:absolute;top:0;left:0;width:100%;height:100%}.sun-editor .se-resizing-container .se-resize-dot>span{position:absolute;width:7px;height:7px;background-color:#3f9dff;border:1px solid #4592ff}.sun-editor .se-resizing-container .se-resize-dot>span.tl{top:-5px;left:-5px;cursor:nw-resize}.sun-editor .se-resizing-container .se-resize-dot>span.tr{top:-5px;right:-5px;cursor:ne-resize}.sun-editor .se-resizing-container .se-resize-dot>span.bl{bottom:-5px;left:-5px;cursor:sw-resize}.sun-editor .se-resizing-container .se-resize-dot>span.br{right:-5px;bottom:-5px;cursor:se-resize}.sun-editor .se-resizing-container .se-resize-dot>span.lw{left:-7px;bottom:50%;cursor:w-resize}.sun-editor .se-resizing-container .se-resize-dot>span.th{left:50%;top:-7px;cursor:n-resize}.sun-editor .se-resizing-container .se-resize-dot>span.rw{right:-7px;bottom:50%;cursor:e-resize}.sun-editor .se-resizing-container .se-resize-dot>span.bh{right:50%;bottom:-7px;cursor:s-resize}.sun-editor .se-resizing-container .se-resize-display{position:absolute;right:0;bottom:0;padding:5px;margin:5px;font-size:12px;color:#fff;background-color:#333;border-radius:4px}.sun-editor .se-controller-table,.sun-editor .se-controller-table-cell{width:auto}.sun-editor .se-controller-link,.sun-editor .se-controller-table,.sun-editor .se-controller-table-cell{padding:0;font-size:14px;font-style:normal;font-weight:400;line-height:1.42857143}.sun-editor .se-controller-link:after,.sun-editor .se-controller-link:before{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.sun-editor .se-controller-link .link-content{padding:0;margin:0}.sun-editor .se-controller-link .link-content a{display:inline-block;color:#4592ff;max-width:200px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;vertical-align:middle;margin-left:5px}.sun-editor .se-file-browser{position:absolute;display:none;top:0;left:0;width:100%;height:100%;z-index:2147483647}.sun-editor .se-file-browser button,.sun-editor .se-file-browser input,.sun-editor .se-file-browser label{font-size:14px;line-height:1.5;color:#111;margin:0}.sun-editor .se-file-browser .se-file-browser-back{background-color:#222;opacity:.5}.sun-editor .se-file-browser .se-file-browser-back,.sun-editor .se-file-browser .se-file-browser-inner{position:absolute;display:block;width:100%;height:100%;top:0;left:0}.sun-editor .se-file-browser .se-file-browser-inner .se-file-browser-content{position:relative;width:960px;max-width:100%;margin:20px auto;background-color:#fff;-webkit-background-clip:padding-box;background-clip:padding-box;border:1px solid rgba(0,0,0,.2);border-radius:4px;outline:0;-webkit-box-shadow:0 3px 9px rgba(0,0,0,.5);box-shadow:0 3px 9px rgba(0,0,0,.5)}.sun-editor .se-file-browser .se-file-browser-header{height:auto;min-height:50px;padding:6px 15px;border-bottom:1px solid #e5e5e5}.sun-editor .se-file-browser .se-file-browser-header .se-file-browser-close{float:right;font-weight:700;text-shadow:0 1px 0 #fff;-webkit-appearance:none;filter:alpha(opacity=100);opacity:1}.sun-editor .se-file-browser .se-file-browser-header .se-file-browser-close>svg{width:12px;height:12px}.sun-editor .se-file-browser .se-file-browser-header .se-file-browser-title{font-size:16px;font-weight:700;margin:0;padding:0;line-height:2.2}.sun-editor .se-file-browser .se-file-browser-tags{display:block;width:100%;padding:0;text-align:left;margin:0 -15px}.sun-editor .se-file-browser .se-file-browser-tags a{display:inline-block;background-color:#f5f5f5;padding:6px 12px;margin:8px 0 8px 8px;color:#333;text-decoration:none;border-radius:32px;-moz-border-radius:32px;-webkit-border-radius:32px;-moz-background-clip:padding;-webkit-background-clip:padding-box;background-clip:padding-box;cursor:pointer}.sun-editor .se-file-browser .se-file-browser-tags a:hover{background-color:#e1e1e1}.sun-editor .se-file-browser .se-file-browser-tags a:active{background-color:#d1d1d1}.sun-editor .se-file-browser .se-file-browser-tags a.on{background-color:#ebf3fe;color:#4592ff}.sun-editor .se-file-browser .se-file-browser-tags a.on:hover{background-color:#d8e8fe}.sun-editor .se-file-browser .se-file-browser-tags a.on:active{background-color:#c7deff}.sun-editor .se-file-browser .se-file-browser-body{position:relative;height:auto;min-height:350px;padding:20px;overflow-y:auto}.sun-editor .se-file-browser .se-file-browser-body .se-file-browser-list{position:relative;width:100%}@media screen and (max-width:992px){.sun-editor .se-file-browser .se-file-browser-inner .se-file-browser-content{width:748px}}@media screen and (max-width:768px){.sun-editor .se-file-browser .se-file-browser-inner .se-file-browser-content{width:600px}}.sun-editor .se-file-browser .se-file-browser-list .se-file-item-column{position:relative;display:block;height:auto;float:left}.sun-editor .se-file-browser .se-file-browser-list.se-image-list .se-file-item-column{width:calc(25% - 20px);margin:0 10px}@media screen and (max-width:992px){.sun-editor .se-file-browser .se-file-browser-list.se-image-list .se-file-item-column{width:calc(33% - 20px)}}@media screen and (max-width:768px){.sun-editor .se-file-browser .se-file-browser-list.se-image-list .se-file-item-column{width:calc(50% - 20px)}}.sun-editor .se-file-browser .se-file-browser-list.se-image-list .se-file-item-img{position:relative;display:block;cursor:pointer;width:100%;height:auto;border-radius:4px;outline:0;margin:10px 0}.sun-editor .se-file-browser .se-file-browser-list.se-image-list .se-file-item-img:hover{opacity:.8;-webkit-box-shadow:0 0 0 .2rem #3288ff;box-shadow:0 0 0 .2rem #3288ff}.sun-editor .se-file-browser .se-file-browser-list.se-image-list .se-file-item-img>img{position:relative;display:block;width:100%;border-radius:4px;outline:0;height:auto}.sun-editor .se-file-browser .se-file-browser-list.se-image-list .se-file-item-img>.se-file-img-name{position:absolute;z-index:1;font-size:13px;color:#fff;left:0;bottom:0;padding:5px 10px;background-color:transparent;width:100%;height:30px;border-bottom-right-radius:4px;border-bottom-left-radius:4px}.sun-editor .se-file-browser .se-file-browser-list.se-image-list .se-file-item-img>.se-file-img-name.se-file-name-back{background-color:#333;opacity:.6}.sun-editor .se-notice{position:absolute;top:0;display:none;z-index:7;width:100%;height:auto;word-break:break-all;font-size:13px;color:#b94a48;background-color:#f2dede;padding:15px;margin:0;border:1px solid #eed3d7;user-select:text;-o-user-select:text;-moz-user-select:text;-khtml-user-select:text;-webkit-user-select:text;-ms-user-select:text}.sun-editor .se-notice button{float:right;padding:7px}.sun-editor .se-tooltip{position:relative;overflow:visible}.sun-editor .se-tooltip .se-tooltip-inner{visibility:hidden;position:absolute;display:block;width:auto;top:120%;left:50%;background:transparent;opacity:0;z-index:1;line-height:1.5;transition:opacity .5s;margin:0;padding:0;bottom:auto;float:none;pointer-events:none;backface-visibility:hidden;-webkit-backface-visibility:hidden;-moz-backface-visibility:hidden}.sun-editor .se-tooltip .se-tooltip-inner .se-tooltip-text{position:relative;display:inline-block;width:auto;left:-50%;font-size:.9em;margin:0;padding:4px 6px;border-radius:2px;background-color:#333;color:#fff;text-align:center;line-height:unset;white-space:nowrap;cursor:auto}.sun-editor .se-tooltip .se-tooltip-inner .se-tooltip-text:after{content:"";position:absolute;bottom:100%;left:50%;margin-left:-5px;border:5px solid transparent;border-bottom-color:#333}.sun-editor .se-tooltip:hover .se-tooltip-inner{visibility:visible;opacity:1}@keyframes blinker{50%{opacity:0}}@keyframes spinner{to{transform:rotate(361deg)}}.sun-editor-editable{font-family:Helvetica Neue,sans-serif;font-size:13px;color:#333;line-height:1.5;text-align:left;background-color:#fff;word-break:normal;word-wrap:break-word;padding:16px;margin:0}.sun-editor-editable *{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;font-family:inherit;font-size:inherit;color:inherit}.sun-editor-editable audio,.sun-editor-editable figcaption,.sun-editor-editable figure,.sun-editor-editable iframe,.sun-editor-editable img,.sun-editor-editable td,.sun-editor-editable th,.sun-editor-editable video{position:relative}.sun-editor-editable .__se__float-left{float:left}.sun-editor-editable .__se__float-right{float:right}.sun-editor-editable .__se__float-center{float:center}.sun-editor-editable .__se__float-none{float:none}.sun-editor-editable :not(.se-code-language .katex) span{display:inline;vertical-align:baseline;margin:0;padding:0}.sun-editor-editable span.katex{display:inline-block}.sun-editor-editable a{color:#004cff;text-decoration:none}.sun-editor-editable span[style~="color:"] a{color:inherit}.sun-editor-editable a:focus,.sun-editor-editable a:hover{cursor:pointer;color:#0093ff;text-decoration:underline}.sun-editor-editable pre{display:block;padding:8px;margin:0 0 10px;font-family:monospace;color:#666;line-height:1.45;background-color:#f9f9f9;border:1px solid #e1e1e1;border-radius:2px;white-space:pre-wrap;word-wrap:break-word;overflow:visible}.sun-editor-editable ol{list-style-type:decimal}.sun-editor-editable ol,.sun-editor-editable ul{display:block;margin-block-start:1em;margin-block-end:1em;margin-inline-start:0;margin-inline-end:0;padding-inline-start:40px}.sun-editor-editable ul{list-style-type:disc}.sun-editor-editable li{display:list-item;text-align:-webkit-match-parent;margin-bottom:5px}.sun-editor-editable ol ol,.sun-editor-editable ol ul,.sun-editor-editable ul ol,.sun-editor-editable ul ul{margin:0}.sun-editor-editable ol ol,.sun-editor-editable ul ol{list-style-type:lower-alpha}.sun-editor-editable ol ol ol,.sun-editor-editable ul ol ol,.sun-editor-editable ul ul ol{list-style-type:upper-roman}.sun-editor-editable ol ul,.sun-editor-editable ul ul{list-style-type:circle}.sun-editor-editable ol ol ul,.sun-editor-editable ol ul ul,.sun-editor-editable ul ul ul{list-style-type:square}.sun-editor-editable sub,.sun-editor-editable sup{font-size:75%;line-height:0}.sun-editor-editable sub{vertical-align:sub}.sun-editor-editable sup{vertical-align:super}.sun-editor-editable p{display:block;margin:0 0 10px}.sun-editor-editable div{display:block;margin:0;padding:0}.sun-editor-editable blockquote{display:block;font-family:inherit;font-size:inherit;color:#999;margin-block-start:1em;margin-block-end:1em;margin-inline-start:0;margin-inline-end:0;padding:0 5px 0 20px;border:solid #b1b1b1;border-width:0 0 0 5px}.sun-editor-editable blockquote blockquote{border-color:#c1c1c1}.sun-editor-editable blockquote blockquote blockquote{border-color:#d1d1d1}.sun-editor-editable blockquote blockquote blockquote blockquote{border-color:#e1e1e1}.sun-editor-editable h1{font-size:2em;margin-block-start:.67em;margin-block-end:.67em}.sun-editor-editable h1,.sun-editor-editable h2{display:block;margin-inline-start:0;margin-inline-end:0;font-weight:700}.sun-editor-editable h2{font-size:1.5em;margin-block-start:.83em;margin-block-end:.83em}.sun-editor-editable h3{font-size:1.17em;margin-block-start:1em;margin-block-end:1em}.sun-editor-editable h3,.sun-editor-editable h4{display:block;margin-inline-start:0;margin-inline-end:0;font-weight:700}.sun-editor-editable h4{font-size:1em;margin-block-start:1.33em;margin-block-end:1.33em}.sun-editor-editable h5{font-size:.83em;margin-block-start:1.67em;margin-block-end:1.67em}.sun-editor-editable h5,.sun-editor-editable h6{display:block;margin-inline-start:0;margin-inline-end:0;font-weight:700}.sun-editor-editable h6{font-size:.67em;margin-block-start:2.33em;margin-block-end:2.33em}.sun-editor-editable hr{display:flex;border-width:1px 0 0;border-color:#000;border-image:initial;height:1px}.sun-editor-editable hr.__se__solid{border-style:solid none none}.sun-editor-editable hr.__se__dotted{border-style:dotted none none}.sun-editor-editable hr.__se__dashed{border-style:dashed none none}.sun-editor-editable table{display:table;table-layout:auto;border:1px solid #ccc;width:100%;max-width:100%;margin:0 0 10px;background-color:transparent;border-spacing:0;border-collapse:collapse}.sun-editor-editable table thead{border-bottom:2px solid #333}.sun-editor-editable table tr{border:1px solid #efefef}.sun-editor-editable table th{background-color:#f3f3f3}.sun-editor-editable table td,.sun-editor-editable table th{border:1px solid #e1e1e1;padding:.4em;background-clip:padding-box}.sun-editor-editable table.se-table-size-auto{width:auto!important}.sun-editor-editable table.se-table-size-100{width:100%!important}.sun-editor-editable table.se-table-layout-auto{table-layout:auto!important}.sun-editor-editable table.se-table-layout-fixed{table-layout:fixed!important}.sun-editor-editable table td.se-table-selected-cell,.sun-editor-editable table th.se-table-selected-cell{border:1px double #4592ff;background-color:#f1f7ff}.sun-editor-editable.se-disabled *{user-select:none;-o-user-select:none;-moz-user-select:none;-khtml-user-select:none;-webkit-user-select:none;-ms-user-select:none}.sun-editor-editable .se-component{display:flex;padding:1px;margin:0 0 10px}.sun-editor-editable .se-component.__se__float-left{margin:0 20px 10px 0}.sun-editor-editable .se-component.__se__float-right{margin:0 0 10px 20px}.sun-editor-editable[contenteditable=true] .se-component{outline:1px dashed #e1e1e1}.sun-editor-editable[contenteditable=true] .se-component.se-component-copy{-webkit-box-shadow:0 0 0 .2rem #80bdff;box-shadow:0 0 0 .2rem #3f9dff;transition:border-color .15s ease-in-out,box-shadow .15s ease-in-out}.sun-editor-editable audio,.sun-editor-editable iframe,.sun-editor-editable img,.sun-editor-editable video{display:block;margin:0;padding:0;width:auto;height:auto;max-width:100%}.sun-editor-editable[contenteditable=true] figure:after{position:absolute;content:"";z-index:1;top:0;left:0;right:0;bottom:0;cursor:default;display:block;background:transparent}.sun-editor-editable[contenteditable=true] figure a,.sun-editor-editable[contenteditable=true] figure iframe,.sun-editor-editable[contenteditable=true] figure img,.sun-editor-editable[contenteditable=true] figure video{z-index:0}.sun-editor-editable[contenteditable=true] figure figcaption{display:block;z-index:2}.sun-editor-editable[contenteditable=true] figure figcaption:focus{border-color:#80bdff;outline:0;-webkit-box-shadow:0 0 0 .2rem #c7deff;box-shadow:0 0 0 .2rem #c7deff}.sun-editor-editable .se-image-container,.sun-editor-editable .se-video-container{width:auto;height:auto;max-width:100%}.sun-editor-editable figure{display:block;outline:none;margin:0;padding:0}.sun-editor-editable figure figcaption{padding:1em .5em;margin:0;background-color:#f9f9f9;outline:none}.sun-editor-editable figure figcaption p{line-height:2;margin:0}.sun-editor-editable .se-image-container a img{padding:1px;margin:1px;outline:1px solid #4592ff}.sun-editor-editable .se-video-container iframe,.sun-editor-editable .se-video-container video{outline:1px solid #9e9e9e;position:absolute;top:0;left:0;border:0;width:100%;height:100%}.sun-editor-editable .se-video-container figure{left:0;width:100%;max-width:100%}.sun-editor-editable audio{width:300px;height:54px}.sun-editor-editable audio.active{outline:2px solid #80bdff}.sun-editor-editable.se-show-block div,.sun-editor-editable.se-show-block h1,.sun-editor-editable.se-show-block h2,.sun-editor-editable.se-show-block h3,.sun-editor-editable.se-show-block h4,.sun-editor-editable.se-show-block h5,.sun-editor-editable.se-show-block h6,.sun-editor-editable.se-show-block li,.sun-editor-editable.se-show-block ol,.sun-editor-editable.se-show-block p,.sun-editor-editable.se-show-block pre,.sun-editor-editable.se-show-block ul{border:1px dashed #3f9dff!important;padding:14px 8px 8px!important}.sun-editor-editable.se-show-block ol,.sun-editor-editable.se-show-block ul{border:1px dashed #d539ff!important}.sun-editor-editable.se-show-block pre{border:1px dashed #27c022!important}.se-show-block p{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAAPAQMAAAAF7dc0AAAABlBMVEWAgID////n1o2sAAAAAnRSTlP/AOW3MEoAAAAaSURBVAjXY/j/gwGCPvxg+F4BQiAGDP1HQQByxxw0gqOzIwAAAABJRU5ErkJggg==") no-repeat}.se-show-block div{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABUAAAAPAQMAAAAxlBYoAAAABlBMVEWAgID////n1o2sAAAAAnRSTlP/AOW3MEoAAAAmSURBVAjXY/j//wcDDH+8XsHwDYi/hwNx1A8w/nYLKH4XoQYJAwCXnSgcl2MOPgAAAABJRU5ErkJggg==") no-repeat}.se-show-block h1{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAPAQMAAAA4f7ZSAAAABlBMVEWAgID////n1o2sAAAAAnRSTlP/AOW3MEoAAAAfSURBVAjXY/j/v4EBhr+9B+LzEPrDeygfhI8j1CBhAEhmJGY4Rf6uAAAAAElFTkSuQmCC") no-repeat}.se-show-block h2{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAPAQMAAAA4f7ZSAAAABlBMVEWAgID////n1o2sAAAAAnRSTlP/AOW3MEoAAAAmSURBVAjXY/j/v4EBhr+dB+LtQPy9geEDEH97D8T3gbgdoQYJAwA51iPuD2haEAAAAABJRU5ErkJggg==") no-repeat}.se-show-block h3{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAPAQMAAAA4f7ZSAAAABlBMVEWAgID////n1o2sAAAAAnRSTlP/AOW3MEoAAAAiSURBVAjXY/j/v4EBhr+dB+LtQPy9geHDeQgN5p9HqEHCADeWI+69VG2MAAAAAElFTkSuQmCC") no-repeat}.se-show-block h4{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAAPAQMAAADTSA1RAAAABlBMVEWAgID////n1o2sAAAAAnRSTlP/AOW3MEoAAAAiSURBVAjXY/j//wADDH97DsTXIfjDdiDdDMTfIRhZHRQDAKJOJ6L+K3y7AAAAAElFTkSuQmCC") no-repeat}.se-show-block h5{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAPAQMAAAA4f7ZSAAAABlBMVEWAgID////n1o2sAAAAAnRSTlP/AOW3MEoAAAAlSURBVAjXY/j/v4EBhr+1A/F+IO5vYPiwHUh/B2IQfR6hBgkDABlWIy5uM+9GAAAAAElFTkSuQmCC") no-repeat}.se-show-block h6{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAPAQMAAAA4f7ZSAAAABlBMVEWAgID////n1o2sAAAAAnRSTlP/AOW3MEoAAAAiSURBVAjXY/j/v4EBhr+dB+LtQLy/geFDP5S9HSKOrA6KAR9GIza1ptJnAAAAAElFTkSuQmCC") no-repeat}.se-show-block li{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAPCAYAAADkmO9VAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAA7SURBVDhPYxgFcNDQ0PAfykQBIHEYhgoRB/BpwCfHBKWpBkaggYxQGgOgBzyQD1aLLA4TGwWDGjAwAACR3RcEU9Ui+wAAAABJRU5ErkJggg==") no-repeat}.se-show-block ol{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAMCAYAAABiDJ37AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAABHSURBVDhPYxgFcNDQ0PAfhKFcFIBLHCdA1oBNM0kGEmMAPgOZoDTVANUNxAqQvURMECADRiiNAWCagDSGGhyW4DRrMAEGBgAu0SX6WpGgjAAAAABJRU5ErkJggg==") no-repeat}.se-show-block ul{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAMCAYAAABiDJ37AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAA1SURBVDhPYxgFDA0NDf+hTBSALI5LDQgwQWmqgVEDKQcsUBoF4ItFGEBXA+QzQpmDGjAwAAA8DQ4Lni6gdAAAAABJRU5ErkJggg==") no-repeat}.sun-editor-editable .__se__p-bordered,.sun-editor .__se__p-bordered{border-top:1px solid #b1b1b1;border-bottom:1px solid #b1b1b1;padding:4px 0}.sun-editor-editable .__se__p-spaced,.sun-editor .__se__p-spaced{letter-spacing:1px}.sun-editor-editable .__se__p-neon,.sun-editor .__se__p-neon{font-weight:200;font-style:italic;background:#000;color:#fff;padding:6px 4px;border:2px solid #fff;border-radius:6px;text-transform:uppercase;animation:neonFlicker 1.5s infinite alternate}@keyframes neonFlicker{0%,19%,21%,23%,25%,54%,56%,to{text-shadow:-.2rem -.2rem 1rem #fff,.2rem .2rem 1rem #fff,0 0 2px #f40,0 0 4px #f40,0 0 6px #f40,0 0 8px #f40,0 0 10px #f40;box-shadow:0 0 .5px #fff,inset 0 0 .5px #fff,0 0 2px #08f,inset 0 0 2px #08f,0 0 4px #08f,inset 0 0 4px #08f}20%,24%,55%{text-shadow:none;box-shadow:none}}.sun-editor-editable .__se__t-shadow,.sun-editor .__se__t-shadow{text-shadow:-.2rem -.2rem 1rem #fff,.2rem .2rem 1rem #fff,0 0 .2rem #999,0 0 .4rem #888,0 0 .6rem #777,0 0 .8rem #666,0 0 1rem #555}.sun-editor-editable .__se__t-code,.sun-editor .__se__t-code{font-family:monospace;color:#666;background-color:rgba(27,31,35,.05);border-radius:6px;padding:.2em .4em} \ No newline at end of file diff --git a/dist/suneditor.min.js b/dist/suneditor.min.js index 068923523..fb1dc1706 100644 --- a/dist/suneditor.min.js +++ b/dist/suneditor.min.js @@ -1,2 +1,2 @@ -!function(e){var t={};function n(i){if(t[i])return t[i].exports;var l=t[i]={i:i,l:!1,exports:{}};return e[i].call(l.exports,l,l.exports,n),l.l=!0,l.exports}n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var l in e)n.d(i,l,function(t){return e[t]}.bind(null,l));return i},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s="XJR1")}({"1kvd":function(e,t,n){"use strict";var i,l;i="undefined"!=typeof window?window:this,l=function(e,t){const n={name:"dialog",add:function(e){const t=e.context;t.dialog={kind:"",updateModal:!1,_closeSignal:!1};let n=e.util.createElement("DIV");n.className="se-dialog sun-editor-common";let i=e.util.createElement("DIV");i.className="se-dialog-back",i.style.display="none";let l=e.util.createElement("DIV");l.className="se-dialog-inner",l.style.display="none",n.appendChild(i),n.appendChild(l),t.dialog.modalArea=n,t.dialog.back=i,t.dialog.modal=l,t.dialog.modal.addEventListener("mousedown",this._onMouseDown_dialog.bind(e)),t.dialog.modal.addEventListener("click",this._onClick_dialog.bind(e)),t.element.relative.appendChild(n),n=null,i=null,l=null},_onMouseDown_dialog:function(e){/se-dialog-inner/.test(e.target.className)?this.context.dialog._closeSignal=!0:this.context.dialog._closeSignal=!1},_onClick_dialog:function(e){e.stopPropagation(),(/close/.test(e.target.getAttribute("data-command"))||this.context.dialog._closeSignal)&&this.plugins.dialog.close.call(this)},open:function(e,t){if(this.modalForm)return!1;this.plugins.dialog._bindClose&&(this._d.removeEventListener("keydown",this.plugins.dialog._bindClose),this.plugins.dialog._bindClose=null),this.plugins.dialog._bindClose=function(e){/27/.test(e.keyCode)&&this.plugins.dialog.close.call(this)}.bind(this),this._d.addEventListener("keydown",this.plugins.dialog._bindClose),this.context.dialog.updateModal=t,"full"===this.context.option.popupDisplay?this.context.dialog.modalArea.style.position="fixed":this.context.dialog.modalArea.style.position="absolute",this.context.dialog.kind=e,this.modalForm=this.context[e].modal;const n=this.context[e].focusElement;"function"==typeof this.plugins[e].on&&this.plugins[e].on.call(this,t),this.context.dialog.modalArea.style.display="block",this.context.dialog.back.style.display="block",this.context.dialog.modal.style.display="block",this.modalForm.style.display="block",n&&n.focus()},_bindClose:null,close:function(){this.plugins.dialog._bindClose&&(this._d.removeEventListener("keydown",this.plugins.dialog._bindClose),this.plugins.dialog._bindClose=null);const e=this.context.dialog.kind;this.modalForm.style.display="none",this.context.dialog.back.style.display="none",this.context.dialog.modalArea.style.display="none",this.context.dialog.updateModal=!1,"function"==typeof this.plugins[e].init&&this.plugins[e].init.call(this),this.context.dialog.kind="",this.modalForm=null,this.focus()}};return void 0===t&&(e.SUNEDITOR_MODULES||Object.defineProperty(e,"SUNEDITOR_MODULES",{enumerable:!0,writable:!1,configurable:!1,value:{}}),Object.defineProperty(e.SUNEDITOR_MODULES,"dialog",{enumerable:!0,writable:!1,configurable:!1,value:n})),n},"object"==typeof e.exports?e.exports=i.document?l(i,!0):function(e){if(!e.document)throw new Error("SUNEDITOR_MODULES a window with a document");return l(e)}:l(i)},"3FqI":function(e,t,n){},JhlZ:function(e,t,n){"use strict";var i,l;i="undefined"!=typeof window?window:this,l=function(e,t){const n={name:"fileBrowser",_xmlHttp:null,_loading:null,add:function(e){const t=e.context;t.fileBrowser={_closeSignal:!1,area:null,header:null,tagArea:null,body:null,list:null,tagElements:null,items:[],selectedTags:[],selectorHandler:null,contextPlugin:"",columnSize:4};let n=e.util.createElement("DIV");n.className="se-file-browser sun-editor-common";let i=e.util.createElement("DIV");i.className="se-file-browser-back";let l=e.util.createElement("DIV");l.className="se-file-browser-inner",l.innerHTML=this.set_browser(e),n.appendChild(i),n.appendChild(l),this._loading=n.querySelector(".se-loading-box"),t.fileBrowser.area=n,t.fileBrowser.header=l.querySelector(".se-file-browser-header"),t.fileBrowser.titleArea=l.querySelector(".se-file-browser-title"),t.fileBrowser.tagArea=l.querySelector(".se-file-browser-tags"),t.fileBrowser.body=l.querySelector(".se-file-browser-body"),t.fileBrowser.list=l.querySelector(".se-file-browser-list"),t.fileBrowser.tagArea.addEventListener("click",this.onClickTag.bind(e)),t.fileBrowser.list.addEventListener("click",this.onClickFile.bind(e)),l.addEventListener("mousedown",this._onMouseDown_browser.bind(e)),l.addEventListener("click",this._onClick_browser.bind(e)),t.element.relative.appendChild(n),n=null,i=null,l=null},set_browser:function(e){return'
    '},_onMouseDown_browser:function(e){/se-file-browser-inner/.test(e.target.className)?this.context.fileBrowser._closeSignal=!0:this.context.fileBrowser._closeSignal=!1},_onClick_browser:function(e){e.stopPropagation(),(/close/.test(e.target.getAttribute("data-command"))||this.context.fileBrowser._closeSignal)&&this.plugins.fileBrowser.close.call(this)},open:function(e,t){this.plugins.fileBrowser._bindClose&&(this._d.removeEventListener("keydown",this.plugins.fileBrowser._bindClose),this.plugins.fileBrowser._bindClose=null),this.plugins.fileBrowser._bindClose=function(e){/27/.test(e.keyCode)&&this.plugins.fileBrowser.close.call(this)}.bind(this),this._d.addEventListener("keydown",this.plugins.fileBrowser._bindClose);const n=this.context.fileBrowser;n.contextPlugin=e,n.selectorHandler=t;const i=this.context[e],l=i.listClass;this.util.hasClass(n.list,l)||(n.list.className="se-file-browser-list "+l),"full"===this.context.option.popupDisplay?n.area.style.position="fixed":n.area.style.position="absolute",n.titleArea.textContent=i.title,n.area.style.display="block",this.plugins.fileBrowser._drawFileList.call(this,this.context[e].url)},_bindClose:null,close:function(){const e=this.plugins.fileBrowser;e._xmlHttp&&e._xmlHttp.abort(),e._bindClose&&(this._d.removeEventListener("keydown",e._bindClose),e._bindClose=null);const t=this.context.fileBrowser;t.area.style.display="none",t.selectorHandler=null,t.selectedTags=[],t.items=[],t.list.innerHTML=t.tagArea.innerHTML=t.titleArea.textContent="","function"==typeof this.plugins[t.contextPlugin].init&&this.plugins[t.contextPlugin].init.call(this),t.contextPlugin=""},showBrowserLoading:function(){this._loading.style.display="block"},closeBrowserLoading:function(){this._loading.style.display="none"},_drawFileList:function(e){const t=this.plugins.fileBrowser,n=t._xmlHttp=this.util.getXMLHttpRequest();n.onreadystatechange=t._callBackGet.bind(this,n),n.open("get",e,!0),n.send(null),this.plugins.fileBrowser.showBrowserLoading()},_callBackGet:function(e){if(4===e.readyState)if(this.plugins.fileBrowser._xmlHttp=null,200===e.status)try{this.plugins.fileBrowser._drawListItem.call(this,JSON.parse(e.responseText).result,!0)}catch(e){throw Error('[SUNEDITOR.fileBrowser.drawList.fail] cause : "'+e.message+'"')}finally{this.plugins.fileBrowser.closeBrowserLoading(),this.context.fileBrowser.body.style.maxHeight=this._w.innerHeight-this.context.fileBrowser.header.offsetHeight-50+"px"}else if(this.plugins.fileBrowser.closeBrowserLoading(),0!==e.status){const t=e.responseText?JSON.parse(e.responseText):e,n="[SUNEDITOR.fileBrowser.get.serverException] status: "+e.status+", response: "+(t.errorMessage||e.responseText);throw Error(n)}},_drawListItem:function(e,t){const n=this.context.fileBrowser,i=this.context[n.contextPlugin],l=[],o=e.length,s=i.columnSize||n.columnSize,a=s<=1?1:Math.round(o/s)||1,r=i.itemTemplateHandler;let c="",d='
    ',u=1;for(let n,i,h=0;h
    '),t&&i.length>0)for(let e,t=0,n=i.length;t'+e+"");d+="
    ",n.list.innerHTML=d,t&&(n.items=e,n.tagArea.innerHTML=c,n.tagElements=n.tagArea.querySelectorAll("A"))},onClickTag:function(e){const t=e.target;if(!this.util.isAnchor(t))return;const n=t.textContent,i=this.plugins.fileBrowser,l=this.context.fileBrowser,o=l.tagArea.querySelector('a[title="'+n+'"]'),s=l.selectedTags,a=s.indexOf(n);a>-1?(s.splice(a,1),this.util.removeClass(o,"on")):(s.push(n),this.util.addClass(o,"on")),i._drawListItem.call(this,0===s.length?l.items:l.items.filter((function(e){return e.tag.some((function(e){return s.indexOf(e)>-1}))})),!1)},onClickFile:function(e){e.preventDefault(),e.stopPropagation();const t=this.context.fileBrowser,n=t.list;let i=e.target,l=null;if(i===n)return;for(;n!==i.parentNode&&(l=i.getAttribute("data-command"),!l);)i=i.parentNode;if(!l)return;const o=t.selectorHandler||this.context[t.contextPlugin].selectorHandler;this.plugins.fileBrowser.close.call(this),o(i)}};return void 0===t&&(e.SUNEDITOR_MODULES||Object.defineProperty(e,"SUNEDITOR_MODULES",{enumerable:!0,writable:!1,configurable:!1,value:{}}),Object.defineProperty(e.SUNEDITOR_MODULES,"fileBrowser",{enumerable:!0,writable:!1,configurable:!1,value:n})),n},"object"==typeof e.exports?e.exports=i.document?l(i,!0):function(e){if(!e.document)throw new Error("SUNEDITOR_MODULES a window with a document");return l(e)}:l(i)},P6u4:function(e,t,n){"use strict";var i,l;i="undefined"!=typeof window?window:this,l=function(e,t){const n={code:"en",toolbar:{default:"Default",save:"Save",font:"Font",formats:"Formats",fontSize:"Size",bold:"Bold",underline:"Underline",italic:"Italic",strike:"Strike",subscript:"Subscript",superscript:"Superscript",removeFormat:"Remove Format",fontColor:"Font Color",hiliteColor:"Highlight Color",indent:"Indent",outdent:"Outdent",align:"Align",alignLeft:"Align left",alignRight:"Align right",alignCenter:"Align center",alignJustify:"Align justify",list:"List",orderList:"Ordered list",unorderList:"Unordered list",horizontalRule:"Horizontal line",hr_solid:"Solid",hr_dotted:"Dotted",hr_dashed:"Dashed",table:"Table",link:"Link",math:"Math",image:"Image",video:"Video",audio:"Audio",fullScreen:"Full screen",showBlocks:"Show blocks",codeView:"Code view",undo:"Undo",redo:"Redo",preview:"Preview",print:"print",tag_p:"Paragraph",tag_div:"Normal (DIV)",tag_h:"Header",tag_blockquote:"Quote",tag_pre:"Code",template:"Template",lineHeight:"Line height",paragraphStyle:"Paragraph style",textStyle:"Text style",imageGallery:"Image gallery"},dialogBox:{linkBox:{title:"Insert Link",url:"URL to link",text:"Text to display",newWindowCheck:"Open in new window"},mathBox:{title:"Math",inputLabel:"Mathematical Notation",fontSizeLabel:"Font Size",previewLabel:"Preview"},imageBox:{title:"Insert image",file:"Select from files",url:"Image URL",altText:"Alternative text"},videoBox:{title:"Insert Video",file:"Select from files",url:"Media embed URL, YouTube/Vimeo"},audioBox:{title:"Insert Audio",file:"Select from files",url:"Audio URL"},browser:{tags:"Tags",search:"Search"},mentionBox:{title:"Add Mention"},caption:"Insert description",close:"Close",submitButton:"Submit",revertButton:"Revert",proportion:"Constrain proportions",basic:"Basic",left:"Left",right:"Right",center:"Center",width:"Width",height:"Height",size:"Size",ratio:"Ratio"},controller:{edit:"Edit",unlink:"Unlink",remove:"Remove",insertRowAbove:"Insert row above",insertRowBelow:"Insert row below",deleteRow:"Delete row",insertColumnBefore:"Insert column before",insertColumnAfter:"Insert column after",deleteColumn:"Delete column",fixedColumnWidth:"Fixed column width",resize100:"Resize 100%",resize75:"Resize 75%",resize50:"Resize 50%",resize25:"Resize 25%",autoSize:"Auto size",mirrorHorizontal:"Mirror, Horizontal",mirrorVertical:"Mirror, Vertical",rotateLeft:"Rotate left",rotateRight:"Rotate right",maxSize:"Max size",minSize:"Min size",tableHeader:"Table header",mergeCells:"Merge cells",splitCells:"Split Cells",HorizontalSplit:"Horizontal split",VerticalSplit:"Vertical split"},menu:{spaced:"Spaced",bordered:"Bordered",neon:"Neon",translucent:"Translucent",shadow:"Shadow",code:"Code"}};return void 0===t&&(e.SUNEDITOR_LANG||Object.defineProperty(e,"SUNEDITOR_LANG",{enumerable:!0,writable:!1,configurable:!1,value:{}}),Object.defineProperty(e.SUNEDITOR_LANG,"en",{enumerable:!0,writable:!0,configurable:!0,value:n})),n},"object"==typeof e.exports?e.exports=i.document?l(i,!0):function(e){if(!e.document)throw new Error("SUNEDITOR_LANG a window with a document");return l(e)}:l(i)},WUQj:function(e,t,n){},XJR1:function(e,t,n){"use strict";n.r(t);n("3FqI"),n("WUQj");var i={name:"colorPicker",add:function(e){const t=e.context;t.colorPicker={colorListHTML:"",_colorInput:"",_defaultColor:"#000",_styleProperty:"color",_currentColor:"",_colorList:[]};let n=this.createColorList(e,this._makeColorList);t.colorPicker.colorListHTML=n,n=null},createColorList:function(e,t){const n=e.context.option,i=e.lang,l=n.colorList&&0!==n.colorList.length?n.colorList:["#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"];let o=[],s='
    ';for(let e,n=0,i=l.length;n0&&(s+='
    '+t(o)+"
    ",o=[]),"object"==typeof e&&(s+='
    '+t(e)+"
    ")));return s+='
    ",s},_makeColorList:function(e){let t="";t+='
      ';for(let n,i=0,l=e.length;i');return t+="
    ",t},init:function(e,t){const n=this.plugins.colorPicker;let i=t||(n.getColorInNode.call(this,e)||this.context.colorPicker._defaultColor);i=n.isHexColor(i)?i:n.rgb2hex(i)||i;const l=this.context.colorPicker._colorList;if(l)for(let e=0,t=l.length;e=3&&"#"+((1<<24)+(n[0]<<16)+(n[1]<<8)+n[2]).toString(16).substr(1)}},l={name:"fontColor",display:"submenu",add:function(e,t){e.addModule([i]);const n=e.context;n.fontColor={previewEl:null,colorInput:null,colorList:null};let l=this.setSubmenu.call(e);n.fontColor.colorInput=l.querySelector("._se_color_picker_input"),n.fontColor.colorInput.addEventListener("keyup",this.onChangeInput.bind(e)),l.querySelector("._se_color_picker_submit").addEventListener("click",this.submit.bind(e)),l.querySelector("._se_color_picker_remove").addEventListener("click",this.remove.bind(e)),l.addEventListener("click",this.pickup.bind(e)),n.fontColor.colorList=l.querySelectorAll("li button"),e.initMenuTarget(this.name,t,l),l=null},setSubmenu:function(){const e=this.context.colorPicker.colorListHTML,t=this.util.createElement("DIV");return t.className="se-submenu se-list-layer",t.innerHTML=e,t},on:function(){const e=this.context.colorPicker,t=this.context.fontColor;e._colorInput=t.colorInput,e._defaultColor="#333333",e._styleProperty="color",e._colorList=t.colorList,this.plugins.colorPicker.init.call(this,this.getSelectionNode(),null)},onChangeInput:function(e){this.plugins.colorPicker.setCurrentColor.call(this,e.target.value)},submit:function(){this.plugins.fontColor.applyColor.call(this,this.context.colorPicker._currentColor)},pickup:function(e){e.preventDefault(),e.stopPropagation(),this.plugins.fontColor.applyColor.call(this,e.target.getAttribute("data-value"))},remove:function(){this.nodeChange(null,["color"],["span"],!0),this.submenuOff()},applyColor:function(e){if(!e)return;const t=this.util.createElement("SPAN");t.style.color=e,this.nodeChange(t,["color"],null,null),this.submenuOff()}},o={name:"hiliteColor",display:"submenu",add:function(e,t){e.addModule([i]);const n=e.context;n.hiliteColor={previewEl:null,colorInput:null,colorList:null};let l=this.setSubmenu.call(e);n.hiliteColor.colorInput=l.querySelector("._se_color_picker_input"),n.hiliteColor.colorInput.addEventListener("keyup",this.onChangeInput.bind(e)),l.querySelector("._se_color_picker_submit").addEventListener("click",this.submit.bind(e)),l.querySelector("._se_color_picker_remove").addEventListener("click",this.remove.bind(e)),l.addEventListener("click",this.pickup.bind(e)),n.hiliteColor.colorList=l.querySelectorAll("li button"),e.initMenuTarget(this.name,t,l),l=null},setSubmenu:function(){const e=this.context.colorPicker.colorListHTML,t=this.util.createElement("DIV");return t.className="se-submenu se-list-layer",t.innerHTML=e,t},on:function(){const e=this.context.colorPicker,t=this.context.hiliteColor;e._colorInput=t.colorInput,e._defaultColor="#FFFFFF",e._styleProperty="backgroundColor",e._colorList=t.colorList,this.plugins.colorPicker.init.call(this,this.getSelectionNode(),null)},onChangeInput:function(e){this.plugins.colorPicker.setCurrentColor.call(this,e.target.value)},submit:function(){this.plugins.hiliteColor.applyColor.call(this,this.context.colorPicker._currentColor)},pickup:function(e){e.preventDefault(),e.stopPropagation(),this.plugins.hiliteColor.applyColor.call(this,e.target.getAttribute("data-value"))},remove:function(){this.nodeChange(null,["background-color"],["span"],!0),this.submenuOff()},applyColor:function(e){if(!e)return;const t=this.util.createElement("SPAN");t.style.backgroundColor=e,this.nodeChange(t,["background-color"],null,null),this.submenuOff()}},s={name:"template",display:"submenu",add:function(e,t){e.context.template={};let n=this.setSubmenu.call(e);n.querySelector("ul").addEventListener("click",this.pickup.bind(e)),e.initMenuTarget(this.name,t,n),n=null},setSubmenu:function(){const e=this.context.option.templates;if(!e||0===e.length)throw Error('[SUNEDITOR.plugins.template.fail] To use the "template" plugin, please define the "templates" option.');const t=this.util.createElement("DIV");t.className="se-list-layer";let n='
      ';for(let t,i=0,l=e.length;i";return n+="
    ",t.innerHTML=n,t},pickup:function(e){if(!/^BUTTON$/i.test(e.target.tagName))return!1;e.preventDefault(),e.stopPropagation();const t=this.context.option.templates[e.target.getAttribute("data-value")];if(!t.html)throw this.submenuOff(),Error('[SUNEDITOR.template.fail] cause : "templates[i].html not found"');this.setContents(t.html),this.submenuOff()}},a=n("1kvd"),r=n.n(a),c={name:"link",display:"dialog",add:function(e){e.addModule([r.a]);const t=e.context;t.link={focusElement:null,linkNewWindowCheck:null,linkAnchorText:null,_linkAnchor:null,_linkValue:""};let n=this.setDialog.call(e);t.link.modal=n,t.link.focusElement=n.querySelector("._se_link_url"),t.link.linkAnchorText=n.querySelector("._se_link_text"),t.link.linkNewWindowCheck=n.querySelector("._se_link_check"),t.link.preview=n.querySelector(".se-link-preview");let i=this.setController_LinkButton.call(e);t.link.linkController=i,t.link._linkAnchor=null,i.addEventListener("mousedown",e.eventStop),n.querySelector(".se-btn-primary").addEventListener("click",this.submit.bind(e)),i.addEventListener("click",this.onClick_linkController.bind(e)),t.link.focusElement.addEventListener("input",this._onLinkPreview.bind(t.link.preview,t.link,t.options.linkProtocol)),t.dialog.modal.appendChild(n),t.element.relative.appendChild(i),n=null,i=null},setDialog:function(){const e=this.lang,t=this.util.createElement("DIV");return t.className="se-dialog-content",t.style.display="none",t.innerHTML='",t},setController_LinkButton:function(){const e=this.lang,t=this.icons,n=this.util.createElement("DIV");return n.className="se-controller se-controller-link",n.innerHTML='
    ",n},open:function(){this.plugins.dialog.open.call(this,"link","link"===this.currentControllerName)},_onLinkPreview:function(e,t,n){const i=n.target.value.trim();e._linkValue=this.textContent=i?t&&-1===i.indexOf("://")&&0!==i.indexOf("#")?t+i:-1===i.indexOf("://")?"/"+i:i:""},submit:function(e){this.showLoading(),e.preventDefault(),e.stopPropagation();const t=function(){const e=this.context.link;if(0===e._linkValue.length)return!1;const t=e._linkValue,n=e.linkAnchorText,i=0===n.value.length?t:n.value;if(this.context.dialog.updateModal){e._linkAnchor.href=t,e._linkAnchor.textContent=i,e._linkAnchor.target=e.linkNewWindowCheck.checked?"_blank":"";const n=e._linkAnchor.childNodes[0];this.setRange(n,0,n,n.textContent.length)}else{const n=this.util.createElement("A");n.href=t,n.textContent=i,n.target=e.linkNewWindowCheck.checked?"_blank":"";const l=this.getSelectedElements();if(l.length>1){const e=this.util.createElement(l[0].nodeName);if(e.appendChild(n),!this.insertNode(e,null,!0))return}else if(!this.insertNode(n,null,!0))return;this.setRange(n.childNodes[0],0,n.childNodes[0],n.textContent.length)}e._linkValue=e.preview.textContent=e.focusElement.value=e.linkAnchorText.value=""}.bind(this);try{t()}finally{this.plugins.dialog.close.call(this),this.closeLoading(),this.history.push(!1)}return!1},active:function(e){if(e){if(this.util.isAnchor(e)&&null===e.getAttribute("data-image-link"))return this.controllerArray.indexOf(this.context.link.linkController)<0&&this.plugins.link.call_controller.call(this,e),!0}else this.controllerArray.indexOf(this.context.link.linkController)>-1&&this.controllersOff();return!1},on:function(e){const t=this.context.link;e?t._linkAnchor&&(this.context.dialog.updateModal=!0,t._linkValue=t.preview.textContent=t.focusElement.value=t._linkAnchor.href,t.linkAnchorText.value=t._linkAnchor.textContent,t.linkNewWindowCheck.checked=!!/_blank/i.test(t._linkAnchor.target)):(this.plugins.link.init.call(this),t.linkAnchorText.value=this.getSelection().toString())},call_controller:function(e){this.editLink=this.context.link._linkAnchor=e;const t=this.context.link.linkController,n=t.querySelector("a");n.href=e.href,n.title=e.textContent,n.textContent=e.textContent;const i=this.util.getOffset(e,this.context.element.wysiwygFrame);t.style.top=i.top+e.offsetHeight+10+"px",t.style.left=i.left-this.context.element.wysiwygFrame.scrollLeft+"px",t.style.display="block";const l=this.context.element.wysiwygFrame.offsetWidth-(t.offsetLeft+t.offsetWidth);l<0?(t.style.left=t.offsetLeft+l+"px",t.firstElementChild.style.left=20-l+"px"):t.firstElementChild.style.left="20px",this.controllersOn(t,e,"link")},onClick_linkController:function(e){e.stopPropagation();const t=e.target.getAttribute("data-command")||e.target.parentNode.getAttribute("data-command");if(t){if(e.preventDefault(),/update/.test(t)){const e=this.context.link;e._linkValue=e.preview.textContent=e.focusElement.value=e._linkAnchor.href,e.linkAnchorText.value=e._linkAnchor.textContent,e.linkNewWindowCheck.checked=!!/_blank/i.test(e._linkAnchor.target),this.plugins.dialog.open.call(this,"link",!0)}else if(/unlink/.test(t)){const e=this.util.getChildElement(this.context.link._linkAnchor,(function(e){return 0===e.childNodes.length||3===e.nodeType}),!1),t=this.util.getChildElement(this.context.link._linkAnchor,(function(e){return 0===e.childNodes.length||3===e.nodeType}),!0);this.setRange(e,0,t,t.textContent.length),this.nodeChange(null,null,["A"],!1)}else this.util.removeItem(this.context.link._linkAnchor),this.context.link._linkAnchor=null,this.focus(),this.history.push(!1);this.controllersOff()}},init:function(){const e=this.context.link;e.linkController.style.display="none",e._linkAnchor=null,e._linkValue=e.preview.textContent=e.focusElement.value="",e.linkAnchorText.value="",e.linkNewWindowCheck.checked=!1}},d=n("ZED3"),u=n.n(d),h=n("ee5k"),g=n.n(h),p=n("gjS+"),m=n.n(p),f={name:"image",display:"dialog",add:function(e){e.addModule([r.a,u.a,g.a,m.a]);const t=e.context,n=t.image={_infoList:[],_infoIndex:0,_uploadFileLength:0,sizeUnit:t.option._imageSizeUnit,_altText:"",_linkElement:null,_align:"none",_floatClassRegExp:"__se__float\\-[a-z]+",_v_link:{_linkValue:""},_v_src:{_linkValue:""},svgDefaultSize:"30%",_element:null,_cover:null,_container:null,inputX:null,inputY:null,_element_w:1,_element_h:1,_element_l:0,_element_t:0,_defaultSizeX:"auto",_defaultSizeY:"auto",_origin_w:"auto"===t.option.imageWidth?"":t.option.imageWidth,_origin_h:"auto"===t.option.imageHeight?"":t.option.imageHeight,_proportionChecked:!0,_resizing:t.option.imageResizing,_resizeDotHide:!t.option.imageHeightShow,_rotation:t.option.imageRotation,_onlyPercentage:t.option.imageSizeOnlyPercentage,_ratio:!1,_ratioX:1,_ratioY:1,_captionShow:!0,_captionChecked:!1,_caption:null,captionCheckEl:null};let i=this.setDialog.call(e);n.modal=i,n.imgInputFile=i.querySelector("._se_image_file"),n.imgUrlFile=i.querySelector(".se-input-url"),n.focusElement=n.imgInputFile||n.imgUrlFile,n.altText=i.querySelector("._se_image_alt"),n.imgLink=i.querySelector("._se_image_link"),n.imgLinkNewWindowCheck=i.querySelector("._se_image_link_check"),n.captionCheckEl=i.querySelector("._se_image_check_caption"),n.previewLink=i.querySelector("._se_tab_content_url .se-link-preview"),n.previewSrc=i.querySelector("._se_tab_content_image .se-link-preview"),i.querySelector(".se-dialog-tabs").addEventListener("click",this.openTab.bind(e)),i.querySelector(".se-btn-primary").addEventListener("click",this.submit.bind(e)),n.imgInputFile&&i.querySelector(".se-file-remove").addEventListener("click",this._removeSelectedFiles.bind(n.imgInputFile,n.imgUrlFile,n.previewSrc)),n.imgInputFile&&n.imgUrlFile&&n.imgInputFile.addEventListener("change",this._fileInputChange.bind(n)),n.imgLink.addEventListener("input",this._onLinkPreview.bind(n.previewLink,n._v_link,t.options.linkProtocol)),n.imgUrlFile&&n.imgUrlFile.addEventListener("input",this._onLinkPreview.bind(n.previewSrc,n._v_src,t.options.linkProtocol));const l=i.querySelector(".__se__gallery");l&&l.addEventListener("click",this._openGallery.bind(e)),n.proportion={},n.inputX={},n.inputY={},t.option.imageResizing&&(n.proportion=i.querySelector("._se_image_check_proportion"),n.inputX=i.querySelector("._se_image_size_x"),n.inputY=i.querySelector("._se_image_size_y"),n.inputX.value=t.option.imageWidth,n.inputY.value=t.option.imageHeight,n.inputX.addEventListener("keyup",this.setInputSize.bind(e,"x")),n.inputY.addEventListener("keyup",this.setInputSize.bind(e,"y")),n.inputX.addEventListener("change",this.setRatio.bind(e)),n.inputY.addEventListener("change",this.setRatio.bind(e)),n.proportion.addEventListener("change",this.setRatio.bind(e)),i.querySelector(".se-dialog-btn-revert").addEventListener("click",this.sizeRevert.bind(e))),t.dialog.modal.appendChild(i),i=null},setDialog:function(){const e=this.context.option,t=this.lang,n=this.util.createElement("DIV");n.className="se-dialog-content",n.style.display="none";let i='
    '+t.dialogBox.imageBox.title+'
    ';if(e.imageFileInput&&(i+='
    "),e.imageUrlInput&&(i+='
    '+(e.imageGalleryUrl&&this.plugins.imageGallery?'":"")+'
    '),i+='
    ',e.imageResizing){const n=e.imageSizeOnlyPercentage,l=n?' style="display: none !important;"':"",o=e.imageHeightShow?"":' style="display: none !important;"';i+='
    ',n||!e.imageHeightShow?i+='
    ":i+='
    ",i+=' '+t.dialogBox.proportion+'
    "}return i+='
    ",n.innerHTML=i,n},_fileInputChange:function(){this.imgInputFile.value?(this.imgUrlFile.setAttribute("disabled",!0),this.previewSrc.style.textDecoration="line-through"):(this.imgUrlFile.removeAttribute("disabled"),this.previewSrc.style.textDecoration="")},_removeSelectedFiles:function(e,t){this.value="",e&&(e.removeAttribute("disabled"),t.style.textDecoration="")},_openGallery:function(){this.callPlugin("imageGallery",this.plugins.imageGallery.open.bind(this,this.plugins.image._setUrlInput.bind(this.context.image)),null)},_setUrlInput:function(e){this.altText.value=e.alt,this._v_src._linkValue=this.previewSrc.textContent=this.imgUrlFile.value=e.src,this.imgUrlFile.focus()},_onLinkPreview:function(e,t,n){const i=n.target.value.trim();e._linkValue=this.textContent=i?t&&-1===i.indexOf("://")&&0!==i.indexOf("#")?t+i:-1===i.indexOf("://")?"/"+i:i:""},fileTags:["img"],select:function(e){this.plugins.image.onModifyMode.call(this,e,this.plugins.resizing.call_controller_resize.call(this,e,"image"))},destroy:function(e){const t=e||this.context.image._element,n=this.util.getParentElement(t,this.util.isMediaComponent)||t,i=1*t.getAttribute("data-index");let l=n.previousElementSibling||n.nextElementSibling;const o=n.parentNode;this.util.removeItem(n),this.plugins.image.init.call(this),this.controllersOff(),o!==this.context.element.wysiwyg&&this.util.removeItemAllParents(o,(function(e){return 0===e.childNodes.length}),null),this.focusEdge(l),this.plugins.fileManager.deleteInfo.call(this,"image",i,this.functions.onImageUpload),this.history.push(!1)},on:function(e){const t=this.context.image;e?t.imgInputFile&&this.context.options.imageMultipleFile&&t.imgInputFile.removeAttribute("multiple"):(t.inputX.value=t._origin_w=this.context.option.imageWidth===t._defaultSizeX?"":this.context.option.imageWidth,t.inputY.value=t._origin_h=this.context.option.imageHeight===t._defaultSizeY?"":this.context.option.imageHeight,t.imgInputFile&&this.context.options.imageMultipleFile&&t.imgInputFile.setAttribute("multiple","multiple"))},open:function(){this.plugins.dialog.open.call(this,"image","image"===this.currentControllerName)},openTab:function(e){const t=this.context.image.modal,n="init"===e?t.querySelector("._se_tab_link"):e.target;if(!/^BUTTON$/i.test(n.tagName))return!1;const i=n.getAttribute("data-tab-link");let l,o,s;for(o=t.getElementsByClassName("_se_tab_content"),l=0;l0?(this.showLoading(),n.submitAction.call(this,this.context.image.imgInputFile.files)):t.imgUrlFile&&t._v_src._linkValue.length>0&&(this.showLoading(),n.onRender_imgUrl.call(this))}catch(e){throw this.closeLoading(),Error('[SUNEDITOR.image.submit.fail] cause : "'+e.message+'"')}finally{this.plugins.dialog.close.call(this)}return!1},submitAction:function(e){if(0===e.length)return;let t=0,n=[];for(let i=0,l=e.length;i0){let e=0;const n=this.context.image._infoList;for(let t=0,i=n.length;ti){this.closeLoading();const n="[SUNEDITOR.imageUpload.fail] Size of uploadable total images: "+i/1e3+"KB";return void(("function"!==this.functions.onImageUploadError||this.functions.onImageUploadError(n,{limitSize:i,currentSize:e,uploadSize:t},this))&&this.functions.noticeOpen(n))}}const l=this.context.image;l._uploadFileLength=n.length;const o={linkValue:l._v_link._linkValue,linkNewWindow:l.imgLinkNewWindowCheck.checked,inputWidth:l.inputX.value,inputHeight:l.inputY.value,align:l._align,isUpdate:this.context.dialog.updateModal,element:l._element};if("function"==typeof this.functions.onImageUploadBefore){const e=this.functions.onImageUploadBefore(n,o,this,function(e){e&&this._w.Array.isArray(e.result)?this.plugins.image.register.call(this,o,e):this.plugins.image.upload.call(this,o,e)}.bind(this));if(void 0===e)return;if(!e)return void this.closeLoading();this._w.Array.isArray(e)&&e.length>0&&(n=e)}this.plugins.image.upload.call(this,o,n)},error:function(e,t){if(this.closeLoading(),"function"!=typeof this.functions.onImageUploadError||this.functions.onImageUploadError(e,t,this))throw this.functions.noticeOpen(e),Error("[SUNEDITOR.plugin.image.error] response: "+e)},upload:function(e,t){if(!t)return void this.closeLoading();if("string"==typeof t)return void this.plugins.image.error.call(this,t,null);const n=this.context.option.imageUploadUrl,i=this.context.dialog.updateModal?1:t.length;if("string"==typeof n&&n.length>0){const l=new FormData;for(let e=0;e0){const i=this.util.createElement("A");return i.href=/^https?:\/\//.test(t)?t:"http://"+t,i.target=n?"_blank":"",i.setAttribute("data-image-link","image"),e.setAttribute("data-image-link",t),i.appendChild(e),i}return e},setInputSize:function(e,t){t&&32===t.keyCode?t.preventDefault():this.plugins.resizing._module_setInputSize.call(this,this.context.image,e)},setRatio:function(){this.plugins.resizing._module_setRatio.call(this,this.context.image)},checkFileInfo:function(){const e=this.plugins.image,t=function(t){e.onModifyMode.call(this,t,null),e.openModify.call(this,!0),e.update_image.call(this,!0,!1,!0)}.bind(this);this.plugins.fileManager.checkInfo.call(this,"image",["img"],this.functions.onImageUpload,t,!0)},resetFileInfo:function(){this.plugins.fileManager.resetInfo.call(this,"image",this.functions.onImageUpload)},create_image:function(e,t,n,i,l,o,s){const a=this.plugins.image,r=this.context.image;this.context.resizing._resize_plugin="image";let c=this.util.createElement("IMG");c.src=e,c.alt=r._altText,c=a.onRender_link.call(this,c,t,n),c.setAttribute("data-rotate","0"),r._resizing&&c.setAttribute("data-proportion",r._proportionChecked);const d=this.plugins.component.set_cover.call(this,c),u=this.plugins.component.set_container.call(this,d,"se-image-container");r._captionChecked&&(r._caption=this.plugins.component.create_caption.call(this),r._caption.setAttribute("contenteditable",!1),d.appendChild(r._caption)),r._element=c,r._cover=d,r._container=u,a.applySize.call(this,i,l),a.setAlign.call(this,o,c,d,u),c.onload=a._image_create_onload.bind(this,c,r.svgDefaultSize),this.insertComponent(u,!0,!0,!0)&&this.plugins.fileManager.setInfo.call(this,"image",c,this.functions.onImageUpload,s,!0),this.context.resizing._resize_plugin=""},_image_create_onload:function(e,t){0===e.offsetWidth&&this.plugins.image.applySize.call(this,t,""),this.selectComponent.call(this,e,"image")},update_image:function(e,t,n){const i=this.context.image,l=i._v_link._linkValue;let o,s=i._element,a=i._cover,r=i._container,c=!1;null===a&&(c=!0,s=i._element.cloneNode(!0),a=this.plugins.component.set_cover.call(this,s)),null===r?(a=a.cloneNode(!0),s=a.querySelector("img"),c=!0,r=this.plugins.component.set_container.call(this,a,"se-image-container")):c&&(r.innerHTML="",r.appendChild(a),i._cover=a,i._element=s,c=!1);const d=this.util.isNumber(i.inputX.value)?i.inputX.value+i.sizeUnit:i.inputX.value,u=this.util.isNumber(i.inputY.value)?i.inputY.value+i.sizeUnit:i.inputY.value;o=/%$/.test(s.style.width)?d!==r.style.width||u!==r.style.height:d!==s.style.width||u!==s.style.height,s.alt=i._altText;let h=!1;if(i._captionChecked?i._caption||(i._caption=this.plugins.component.create_caption.call(this),a.appendChild(i._caption),h=!0):i._caption&&(this.util.removeItem(i._caption),i._caption=null,h=!0),l.trim().length>0)if(null!==i._linkElement&&a.contains(i._linkElement))i._linkElement.href=l,i._linkElement.target=i.imgLinkNewWindowCheck.checked?"_blank":"",s.setAttribute("data-image-link",l);else{let e=this.plugins.image.onRender_link.call(this,s,l,this.context.image.imgLinkNewWindowCheck.checked);a.insertBefore(e,i._caption)}else if(null!==i._linkElement){const e=s;e.setAttribute("data-image-link","");let t=e.cloneNode(!0);a.removeChild(i._linkElement),a.insertBefore(t,i._caption),s=t}if(c){const e=this.util.isRangeFormatElement(i._element.parentNode)||this.util.isWysiwygDiv(i._element.parentNode)?i._element:/^A$/i.test(i._element.parentNode.nodeName)?i._element.parentNode:this.util.getFormatElement(i._element)||i._element;e.parentNode.replaceChild(r,e),s=r.querySelector("img"),i._element=s,i._cover=a,i._container=r}(h||!i._onlyPercentage&&o)&&!e&&(/\d+/.test(s.style.height)||this.context.resizing._rotateVertical&&i._captionChecked)&&(/%$/.test(i.inputX.value)||/%$/.test(i.inputY.value)?this.plugins.resizing.resetTransform.call(this,s):this.plugins.resizing.setTransformSize.call(this,s,this.util.getNumber(i.inputX.value,0),this.util.getNumber(i.inputY.value,0)));i._resizing&&(s.setAttribute("data-proportion",i._proportionChecked),o&&this.plugins.image.applySize.call(this)),this.plugins.image.setAlign.call(this,null,s,null,null),e&&this.plugins.fileManager.setInfo.call(this,"image",s,this.functions.onImageUpload,null,!0),t&&this.selectComponent(s,"image"),n||this.history.push(!1)},update_src:function(e,t,n){t.src=e,this._w.setTimeout(this.plugins.fileManager.setInfo.bind(this,"image",t,this.functions.onImageUpload,n,!0)),this.selectComponent(t,"image")},onModifyMode:function(e,t){if(!e)return;const n=this.context.image;n._linkElement=/^A$/i.test(e.parentNode.nodeName)?e.parentNode:null,n._element=e,n._cover=this.util.getParentElement(e,"FIGURE"),n._container=this.util.getParentElement(e,this.util.isMediaComponent),n._caption=this.util.getChildElement(n._cover,"FIGCAPTION"),n._align=e.getAttribute("data-align")||"none",t&&(n._element_w=t.w,n._element_h=t.h,n._element_t=t.t,n._element_l=t.l);let i=n._element.getAttribute("data-size")||n._element.getAttribute("data-origin");i?(i=i.split(","),n._origin_w=i[0],n._origin_h=i[1]):t&&(n._origin_w=t.w,n._origin_h=t.h)},openModify:function(e){const t=this.context.image;t.imgUrlFile&&(t._v_src._linkValue=t.previewSrc.textContent=t.imgUrlFile.value=t._element.src),t._altText=t.altText.value=t._element.alt,t._v_link._linkValue=t.previewLink.textContent=t.imgLink.value=null===t._linkElement?"":t._linkElement.href,t.imgLinkNewWindowCheck.checked=t._linkElement&&"_blank"===t._linkElement.target,t.modal.querySelector('input[name="suneditor_image_radio"][value="'+t._align+'"]').checked=!0,t._align=t.modal.querySelector('input[name="suneditor_image_radio"]:checked').value,t._captionChecked=t.captionCheckEl.checked=!!t._caption,t._resizing&&this.plugins.resizing._module_setModifyInputSize.call(this,t,this.plugins.image),e||this.plugins.dialog.open.call(this,"image",!0)},sizeRevert:function(){this.plugins.resizing._module_sizeRevert.call(this,this.context.image)},applySize:function(e,t){const n=this.context.image;return e||(e=n.inputX.value||this.context.option.imageWidth),t||(t=n.inputY.value||this.context.option.imageHeight),n._onlyPercentage&&e||/%$/.test(e)?(this.plugins.image.setPercentSize.call(this,e,t),!0):(e&&"auto"!==e||t&&"auto"!==t?this.plugins.image.setSize.call(this,e,t,!1):this.plugins.image.setAutoSize.call(this),!1)},setSize:function(e,t,n,i){const l=this.context.image,o=/^(rw|lw)$/.test(i),s=/^(th|bh)$/.test(i);this.plugins.image.cancelPercentAttr.call(this),s||(l._element.style.width=this.util.isNumber(e)?e+l.sizeUnit:e),o||(l._element.style.height=this.util.isNumber(t)?t+l.sizeUnit:/%$/.test(t)?"":t),"center"===l._align&&this.plugins.image.setAlign.call(this,null,null,null,null),n||l._element.removeAttribute("data-percentage"),this.plugins.resizing._module_saveCurrentSize.call(this,l)},setAutoSize:function(){const e=this.context.image;this.plugins.resizing.resetTransform.call(this,e._element),this.plugins.image.cancelPercentAttr.call(this),e._element.style.maxWidth="",e._element.style.width="",e._element.style.height="",e._cover.style.width="",e._cover.style.height="",this.plugins.image.setAlign.call(this,null,null,null,null),e._element.setAttribute("data-percentage","auto,auto"),this.plugins.resizing._module_saveCurrentSize.call(this,e)},setOriginSize:function(){const e=this.context.image;e._element.removeAttribute("data-percentage"),this.plugins.resizing.resetTransform.call(this,e._element),this.plugins.image.cancelPercentAttr.call(this);const t=(e._element.getAttribute("data-origin")||"").split(","),n=t[0],i=t[1];t&&(e._onlyPercentage||/%$/.test(n)&&(/%$/.test(i)||!/\d/.test(i))?this.plugins.image.setPercentSize.call(this,n,i):this.plugins.image.setSize.call(this,n,i),this.plugins.resizing._module_saveCurrentSize.call(this,e))},setPercentSize:function(e,t){const n=this.context.image;t=!t||/%$/.test(t)||this.util.getNumber(t,0)?this.util.isNumber(t)?t+n.sizeUnit:t||"":this.util.isNumber(t)?t+"%":t;const i=/%$/.test(t);n._container.style.width=this.util.isNumber(e)?e+"%":e,n._container.style.height="",n._cover.style.width="100%",n._cover.style.height=i?t:"",n._element.style.width="100%",n._element.style.height=i?"":t,n._element.style.maxWidth="","center"===n._align&&this.plugins.image.setAlign.call(this,null,null,null,null),n._element.setAttribute("data-percentage",e+","+t),this.plugins.resizing.setCaptionPosition.call(this,n._element),this.plugins.resizing._module_saveCurrentSize.call(this,n)},cancelPercentAttr:function(){const e=this.context.image;e._cover.style.width="",e._cover.style.height="",e._container.style.width="",e._container.style.height="",this.util.removeClass(e._container,this.context.image._floatClassRegExp),this.util.addClass(e._container,"__se__float-"+e._align),"center"===e._align&&this.plugins.image.setAlign.call(this,null,null,null,null)},setAlign:function(e,t,n,i){const l=this.context.image;e||(e=l._align),t||(t=l._element),n||(n=l._cover),i||(i=l._container),n.style.margin=e&&"none"!==e?"auto":"0",/%$/.test(t.style.width)&&"center"===e?(i.style.minWidth="100%",n.style.width=i.style.width):(i.style.minWidth="",n.style.width=this.context.resizing._rotateVertical?t.style.height||t.offsetHeight:t.style.width&&"auto"!==t.style.width?t.style.width||"100%":""),this.util.hasClass(i,"__se__float-"+e)||(this.util.removeClass(i,l._floatClassRegExp),this.util.addClass(i,"__se__float-"+e)),t.setAttribute("data-align",e)},resetAlign:function(){const e=this.context.image;e._element.setAttribute("data-align",""),e._align="none",e._cover.style.margin="0",this.util.removeClass(e._container,e._floatClassRegExp)},init:function(){const e=this.context.image;e.imgInputFile&&(e.imgInputFile.value=""),e.imgUrlFile&&(e._v_src._linkValue=e.previewSrc.textContent=e.imgUrlFile.value=""),e.imgInputFile&&e.imgUrlFile&&(e.imgUrlFile.removeAttribute("disabled"),e.previewSrc.style.textDecoration=""),e.altText.value="",e._v_link._linkValue=e.previewLink.textContent=e.imgLink.value="",e.imgLinkNewWindowCheck.checked=!1,e.modal.querySelector('input[name="suneditor_image_radio"][value="none"]').checked=!0,e.captionCheckEl.checked=!1,e._element=null,this.plugins.image.openTab.call(this,"init"),e._resizing&&(e.inputX.value=this.context.option.imageWidth===e._defaultSizeX?"":this.context.option.imageWidth,e.inputY.value=this.context.option.imageHeight===e._defaultSizeY?"":this.context.option.imageHeight,e.proportion.checked=!0,e._ratio=!1,e._ratioX=1,e._ratioY=1)}},_={name:"video",display:"dialog",add:function(e){e.addModule([r.a,u.a,g.a,m.a]);const t=e.context,n=t.video={_infoList:[],_infoIndex:0,_uploadFileLength:0,sizeUnit:t.option._videoSizeUnit,_align:"none",_floatClassRegExp:"__se__float\\-[a-z]+",_youtubeQuery:t.option.youtubeQuery,_videoRatio:100*t.option.videoRatio+"%",_defaultRatio:100*t.option.videoRatio+"%",_linkValue:"",_element:null,_cover:null,_container:null,inputX:null,inputY:null,_element_w:1,_element_h:1,_element_l:0,_element_t:0,_defaultSizeX:"100%",_defaultSizeY:100*t.option.videoRatio+"%",_origin_w:"100%"===t.option.videoWidth?"":t.option.videoWidth,_origin_h:"56.25%"===t.option.videoHeight?"":t.option.videoHeight,_proportionChecked:!0,_resizing:t.option.videoResizing,_resizeDotHide:!t.option.videoHeightShow,_rotation:t.option.videoRotation,_onlyPercentage:t.option.videoSizeOnlyPercentage,_ratio:!1,_ratioX:1,_ratioY:1,_captionShow:!1};let i=this.setDialog.call(e);n.modal=i,n.videoInputFile=i.querySelector("._se_video_file"),n.videoUrlFile=i.querySelector(".se-input-url"),n.focusElement=n.videoUrlFile||n.videoInputFile,n.preview=i.querySelector(".se-link-preview"),i.querySelector(".se-btn-primary").addEventListener("click",this.submit.bind(e)),n.videoInputFile&&i.querySelector(".se-dialog-files-edge-button").addEventListener("click",this._removeSelectedFiles.bind(n.videoInputFile,n.videoUrlFile,n.preview)),n.videoInputFile&&n.videoUrlFile&&n.videoInputFile.addEventListener("change",this._fileInputChange.bind(n)),n.videoUrlFile&&n.videoUrlFile.addEventListener("input",this._onLinkPreview.bind(n.preview,n,t.options.linkProtocol)),n.proportion={},n.videoRatioOption={},n.inputX={},n.inputY={},t.option.videoResizing&&(n.proportion=i.querySelector("._se_video_check_proportion"),n.videoRatioOption=i.querySelector(".se-video-ratio"),n.inputX=i.querySelector("._se_video_size_x"),n.inputY=i.querySelector("._se_video_size_y"),n.inputX.value=t.option.videoWidth,n.inputY.value=t.option.videoHeight,n.inputX.addEventListener("keyup",this.setInputSize.bind(e,"x")),n.inputY.addEventListener("keyup",this.setInputSize.bind(e,"y")),n.inputX.addEventListener("change",this.setRatio.bind(e)),n.inputY.addEventListener("change",this.setRatio.bind(e)),n.proportion.addEventListener("change",this.setRatio.bind(e)),n.videoRatioOption.addEventListener("change",this.setVideoRatio.bind(e)),i.querySelector(".se-dialog-btn-revert").addEventListener("click",this.sizeRevert.bind(e))),t.dialog.modal.appendChild(i),i=null},setDialog:function(){const e=this.context.option,t=this.lang,n=this.util.createElement("DIV");n.className="se-dialog-content",n.style.display="none";let i='
    '+t.dialogBox.videoBox.title+'
    ';if(e.videoFileInput&&(i+='
    "),e.videoUrlInput&&(i+='
    '),e.videoResizing){const n=e.videoRatioList||[{name:"16:9",value:.5625},{name:"4:3",value:.75},{name:"21:9",value:.4285}],l=e.videoRatio,o=e.videoSizeOnlyPercentage,s=o?' style="display: none !important;"':"",a=e.videoHeightShow?"":' style="display: none !important;"',r=e.videoRatioShow?"":' style="display: none !important;"',c=o||e.videoHeightShow||e.videoRatioShow?"":' style="display: none !important;"';i+='
    "}return i+='
    ",n.innerHTML=i,n},_fileInputChange:function(){this.videoInputFile.value?(this.videoUrlFile.setAttribute("disabled",!0),this.preview.style.textDecoration="line-through"):(this.videoUrlFile.removeAttribute("disabled"),this.preview.style.textDecoration="")},_removeSelectedFiles:function(e,t){this.value="",e&&(e.removeAttribute("disabled"),t.style.textDecoration="")},_onLinkPreview:function(e,t,n){const i=n.target.value.trim();/^$/.test(i)?(e._linkValue=i,this.textContent=''):e._linkValue=this.textContent=i?t&&-1===i.indexOf("://")&&0!==i.indexOf("#")?t+i:-1===i.indexOf("://")?"/"+i:i:""},_setTagAttrs:function(e){e.setAttribute("controls",!0);const t=this.context.options.videoTagAttrs;if(t)for(let n in t)this.util.hasOwn(t,n)&&e.setAttribute(n,t[n])},createVideoTag:function(){const e=this.util.createElement("VIDEO");return this.plugins.video._setTagAttrs.call(this,e),e},_setIframeAttrs:function(e){e.frameBorder="0",e.allowFullscreen=!0;const t=this.context.options.videoIframeAttrs;if(t)for(let n in t)this.util.hasOwn(t,n)&&e.setAttribute(n,t[n])},createIframeTag:function(){const e=this.util.createElement("IFRAME");return this.plugins.video._setIframeAttrs.call(this,e),e},fileTags:["iframe","video"],select:function(e){this.plugins.video.onModifyMode.call(this,e,this.plugins.resizing.call_controller_resize.call(this,e,"video"))},destroy:function(e){const t=e||this.context.video._element,n=this.context.video._container,i=1*t.getAttribute("data-index");let l=n.previousElementSibling||n.nextElementSibling;const o=n.parentNode;this.util.removeItem(n),this.plugins.video.init.call(this),this.controllersOff(),o!==this.context.element.wysiwyg&&this.util.removeItemAllParents(o,(function(e){return 0===e.childNodes.length}),null),this.focusEdge(l),this.plugins.fileManager.deleteInfo.call(this,"video",i,this.functions.onVideoUpload),this.history.push(!1)},on:function(e){const t=this.context.video;e?t.videoInputFile&&this.context.options.videoMultipleFile&&t.videoInputFile.removeAttribute("multiple"):(t.inputX.value=t._origin_w=this.context.option.videoWidth===t._defaultSizeX?"":this.context.option.videoWidth,t.inputY.value=t._origin_h=this.context.option.videoHeight===t._defaultSizeY?"":this.context.option.videoHeight,t.proportion.disabled=!0,t.videoInputFile&&this.context.options.videoMultipleFile&&t.videoInputFile.setAttribute("multiple","multiple")),t._resizing&&this.plugins.video.setVideoRatioSelect.call(this,t._origin_h||t._defaultRatio)},open:function(){this.plugins.dialog.open.call(this,"video","video"===this.currentControllerName)},setVideoRatio:function(e){const t=this.context.video,n=e.target.options[e.target.selectedIndex].value;t._defaultSizeY=t._videoRatio=n?100*n+"%":t._defaultSizeY,t.inputY.placeholder=n?100*n+"%":"",t.inputY.value=""},setInputSize:function(e,t){if(t&&32===t.keyCode)return void t.preventDefault();const n=this.context.video;this.plugins.resizing._module_setInputSize.call(this,n,e),"y"===e&&this.plugins.video.setVideoRatioSelect.call(this,t.target.value||n._defaultRatio)},setRatio:function(){this.plugins.resizing._module_setRatio.call(this,this.context.video)},submit:function(e){const t=this.context.video,n=this.plugins.video;e.preventDefault(),e.stopPropagation(),t._align=t.modal.querySelector('input[name="suneditor_video_radio"]:checked').value;try{t.videoInputFile&&t.videoInputFile.files.length>0?(this.showLoading(),n.submitAction.call(this,this.context.video.videoInputFile.files)):t.videoUrlFile&&t._linkValue.length>0&&(this.showLoading(),n.setup_url.call(this))}catch(e){throw this.closeLoading(),Error('[SUNEDITOR.video.submit.fail] cause : "'+e.message+'"')}finally{this.plugins.dialog.close.call(this)}return!1},submitAction:function(e){if(0===e.length)return;let t=0,n=[];for(let i=0,l=e.length;i0){let e=0;const n=this.context.video._infoList;for(let t=0,i=n.length;ti){this.closeLoading();const n="[SUNEDITOR.videoUpload.fail] Size of uploadable total videos: "+i/1e3+"KB";return void(("function"!==this.functions.onVideoUploadError||this.functions.onVideoUploadError(n,{limitSize:i,currentSize:e,uploadSize:t},this))&&this.functions.noticeOpen(n))}}const l=this.context.video;l._uploadFileLength=n.length;const o={inputWidth:l.inputX.value,inputHeight:l.inputY.value,align:l._align,isUpdate:this.context.dialog.updateModal,element:l._element};if("function"==typeof this.functions.onVideoUploadBefore){const e=this.functions.onVideoUploadBefore(n,o,this,function(e){e&&this._w.Array.isArray(e.result)?this.plugins.video.register.call(this,o,e):this.plugins.video.upload.call(this,o,e)}.bind(this));if(void 0===e)return;if(!e)return void this.closeLoading();"object"==typeof e&&e.length>0&&(n=e)}this.plugins.video.upload.call(this,o,n)},error:function(e,t){if(this.closeLoading(),"function"!=typeof this.functions.onVideoUploadError||this.functions.onVideoUploadError(e,t,this))throw this.functions.noticeOpen(e),Error("[SUNEDITOR.plugin.video.error] response: "+e)},upload:function(e,t){if(!t)return void this.closeLoading();if("string"==typeof t)return void this.plugins.video.error.call(this,t,null);const n=this.context.option.videoUploadUrl,i=this.context.dialog.updateModal?1:t.length;if(!("string"==typeof n&&n.length>0))throw Error('[SUNEDITOR.videoUpload.fail] cause : There is no "videoUploadUrl" option.');{const l=new FormData;for(let e=0;e$/.test(t)){if(t=(new this._w.DOMParser).parseFromString(t,"text/html").querySelector("iframe").src,0===t.length)return!1}if(/youtu\.?be/.test(t)){if(/^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("&","?&")),e._youtubeQuery.length>0)if(/\?/.test(t)){const n=t.split("?");t=n[0]+"?"+e._youtubeQuery+"&"+n[1]}else t+="?"+e._youtubeQuery}else/vimeo\.com/.test(t)&&(t.endsWith("/")&&(t=t.slice(0,-1)),t="https://player.vimeo.com/video/"+t.slice(t.lastIndexOf("/")+1));this.plugins.video.create_video.call(this,this.plugins.video.createIframeTag.call(this),t,e.inputX.value,e.inputY.value,e._align,null,this.context.dialog.updateModal)}catch(e){throw Error('[SUNEDITOR.video.upload.fail] cause : "'+e.message+'"')}finally{this.closeLoading()}},create_video:function(e,t,n,i,l,o,s){this.context.resizing._resize_plugin="video";const a=this.context.video;let r=null,c=null,d=!1;if(s){if((e=a._element).src!==t){d=!0;const n=/youtu\.?be/.test(t),i=/vimeo\.com/.test(t);if(!n&&!i||/^iframe$/i.test(e.nodeName))if(n||i||/^videoo$/i.test(e.nodeName))e.src=t;else{const n=this.plugins.video.createVideoTag.call(this);n.src=t,e.parentNode.replaceChild(n,e),a._element=e=n}else{const n=this.plugins.video.createIframeTag.call(this);n.src=t,e.parentNode.replaceChild(n,e),a._element=e=n}}c=a._container,r=this.util.getParentElement(e,"FIGURE")}else d=!0,e.src=t,a._element=e,r=this.plugins.component.set_cover.call(this,e),c=this.plugins.component.set_container.call(this,r,"se-video-container");a._cover=r,a._container=c;const u=this.plugins.resizing._module_getSizeX.call(this,a)!==(n||a._defaultSizeX)||this.plugins.resizing._module_getSizeY.call(this,a)!==(i||a._videoRatio),h=!s||u;a._resizing&&(this.context.video._proportionChecked=a.proportion.checked,e.setAttribute("data-proportion",a._proportionChecked));let g=!1;h&&(g=this.plugins.video.applySize.call(this)),g&&"center"===l||this.plugins.video.setAlign.call(this,null,e,r,c);let p=!0;s?a._resizing&&this.context.resizing._rotateVertical&&h&&this.plugins.resizing.setTransformSize.call(this,e,null,null):p=this.insertComponent(c,!1,!0,!1),p&&(d&&this.plugins.fileManager.setInfo.call(this,"video",e,this.functions.onVideoUpload,o,!0),s&&(this.selectComponent(e,"video"),this.history.push(!1))),this.context.resizing._resize_plugin=""},_update_videoCover:function(e){if(!e)return;const t=this.context.video;/^video$/i.test(e.nodeName)?this.plugins.video._setTagAttrs.call(this,e):this.plugins.video._setIframeAttrs.call(this,e);const n=this.util.getParentElement(e,this.util.isMediaComponent)||this.util.getParentElement(e,function(e){return this.isWysiwygDiv(e.parentNode)}.bind(this.util));t._element=e=e.cloneNode(!0);const i=t._cover=this.plugins.component.set_cover.call(this,e),l=t._container=this.plugins.component.set_container.call(this,i,"se-video-container"),o=n.querySelector("figcaption");let s=null;o&&(s=this.util.createElement("DIV"),s.innerHTML=o.innerHTML,this.util.removeItem(o));const a=(e.getAttribute("data-size")||e.getAttribute("data-origin")||"").split(",");this.plugins.video.applySize.call(this,a[0],a[1]),n.parentNode.replaceChild(l,n),s&&n.parentNode.insertBefore(s,l.nextElementSibling),this.plugins.fileManager.setInfo.call(this,"video",e,this.functions.onVideoUpload,null,!0)},onModifyMode:function(e,t){const n=this.context.video;n._element=e,n._cover=this.util.getParentElement(e,"FIGURE"),n._container=this.util.getParentElement(e,this.util.isMediaComponent),n._align=e.getAttribute("data-align")||"none",t&&(n._element_w=t.w,n._element_h=t.h,n._element_t=t.t,n._element_l=t.l);let i=n._element.getAttribute("data-size")||n._element.getAttribute("data-origin");i?(i=i.split(","),n._origin_w=i[0],n._origin_h=i[1]):t&&(n._origin_w=t.w,n._origin_h=t.h)},openModify:function(e){const t=this.context.video;if(t.videoUrlFile&&(t._linkValue=t.preview.textContent=t.videoUrlFile.value=t._element.src||(t._element.querySelector("source")||"").src||""),t.modal.querySelector('input[name="suneditor_video_radio"][value="'+t._align+'"]').checked=!0,t._resizing){this.plugins.resizing._module_setModifyInputSize.call(this,t,this.plugins.video);const e=t._videoRatio=this.plugins.resizing._module_getSizeY.call(this,t);this.plugins.video.setVideoRatioSelect.call(this,e)||(t.inputY.value=t._onlyPercentage?this.util.getNumber(e,2):e)}e||this.plugins.dialog.open.call(this,"video",!0)},setVideoRatioSelect:function(e){let t=!1;const n=this.context.video,i=n.videoRatioOption.options;/%$/.test(e)||n._onlyPercentage?e=this.util.getNumber(e,2)/100+"":(!this.util.isNumber(e)||1*e>=1)&&(e=""),n.inputY.placeholder="";for(let l=0,o=i.length;l'+this.icons.cancel+''+t.dialogBox.audioBox.title+'
    ';return e.audioFileInput&&(i+='
    "),e.audioUrlInput&&(i+='
    '),i+='
    ",n.innerHTML=i,n},setController:function(){const e=this.lang,t=this.icons,n=this.util.createElement("DIV");return n.className="se-controller se-controller-link",n.innerHTML='
    ",n},_fileInputChange:function(){this.audioInputFile.value?(this.audioUrlFile.setAttribute("disabled",!0),this.preview.style.textDecoration="line-through"):(this.audioUrlFile.removeAttribute("disabled"),this.preview.style.textDecoration="")},_removeSelectedFiles:function(e,t){this.value="",e&&(e.removeAttribute("disabled"),t.style.textDecoration="")},_createAudioTag:function(){const e=this.util.createElement("AUDIO");this.plugins.audio._setTagAttrs.call(this,e);const t=this.context.audio._origin_w,n=this.context.audio._origin_h;return e.setAttribute("origin-size",t+","+n),e.style.cssText=(t?"width:"+t+"; ":"")+(n?"height:"+n+";":""),e},_setTagAttrs:function(e){e.setAttribute("controls",!0);const t=this.context.options.audioTagAttrs;if(t)for(let n in t)this.util.hasOwn(t,n)&&e.setAttribute(n,t[n])},_onLinkPreview:function(e,t,n){const i=n.target.value.trim();e._linkValue=this.textContent=i?t&&-1===i.indexOf("://")&&0!==i.indexOf("#")?t+i:-1===i.indexOf("://")?"/"+i:i:""},fileTags:["audio"],select:function(e){this.plugins.audio.onModifyMode.call(this,e)},destroy:function(e){e=e||this.context.audio._element;const t=this.util.getParentElement(e,this.util.isComponent)||e,n=1*e.getAttribute("data-index"),i=t.previousElementSibling||t.nextElementSibling,l=t.parentNode;this.util.removeItem(t),this.plugins.audio.init.call(this),this.controllersOff(),l!==this.context.element.wysiwyg&&this.util.removeItemAllParents(l,(function(e){return 0===e.childNodes.length}),null),this.focusEdge(i),this.plugins.fileManager.deleteInfo.call(this,"audio",n,this.functions.onAudioUpload),this.history.push(!1)},checkFileInfo:function(){this.plugins.fileManager.checkInfo.call(this,"audio",["audio"],this.functions.onAudioUpload,this.plugins.audio.updateCover.bind(this),!1)},resetFileInfo:function(){this.plugins.fileManager.resetInfo.call(this,"audio",this.functions.onAudioUpload)},on:function(e){const t=this.context.audio;e?t._element?(this.context.dialog.updateModal=!0,t._linkValue=t.preview.textContent=t.audioUrlFile.value=t._element.src,t.audioInputFile&&this.context.options.audioMultipleFile&&t.audioInputFile.removeAttribute("multiple")):t.audioInputFile&&this.context.options.audioMultipleFile&&t.audioInputFile.removeAttribute("multiple"):(this.plugins.audio.init.call(this),t.audioInputFile&&this.context.options.audioMultipleFile&&t.audioInputFile.setAttribute("multiple","multiple"))},open:function(){this.plugins.dialog.open.call(this,"audio","audio"===this.currentControllerName)},submit:function(e){const t=this.context.audio;e.preventDefault(),e.stopPropagation();try{t.audioInputFile&&t.audioInputFile.files.length>0?(this.showLoading(),this.plugins.audio.submitAction.call(this,t.audioInputFile.files)):t.audioUrlFile&&t._linkValue.length>0&&(this.showLoading(),this.plugins.audio.setupUrl.call(this,t._linkValue))}catch(e){throw this.closeLoading(),Error('[SUNEDITOR.audio.submit.fail] cause : "'+e.message+'"')}finally{this.plugins.dialog.close.call(this)}return!1},submitAction:function(e){if(0===e.length)return;let t=0,n=[];for(let i=0,l=e.length;i0){let e=0;const n=this.context.audio._infoList;for(let t=0,i=n.length;ti){this.closeLoading();const n="[SUNEDITOR.audioUpload.fail] Size of uploadable total audios: "+i/1e3+"KB";return void(("function"!==this.functions.onAudioUploadError||this.functions.onAudioUploadError(n,{limitSize:i,currentSize:e,uploadSize:t},this))&&this.functions.noticeOpen(n))}}const l=this.context.audio;l._uploadFileLength=n.length;const o={isUpdate:this.context.dialog.updateModal,element:l._element};if("function"==typeof this.functions.onAudioUploadBefore){const e=this.functions.onAudioUploadBefore(n,o,this,function(e){e&&this._w.Array.isArray(e.result)?this.plugins.audio.register.call(this,o,e):this.plugins.audio.upload.call(this,o,e)}.bind(this));if(void 0===e)return;if(!e)return void this.closeLoading();"object"==typeof e&&e.length>0&&(n=e)}this.plugins.audio.upload.call(this,o,n)},error:function(e,t){if(this.closeLoading(),"function"!=typeof this.functions.onAudioUploadError||this.functions.onAudioUploadError(e,t,this))throw this.functions.noticeOpen(e),Error("[SUNEDITOR.plugin.audio.exception] response: "+e)},upload:function(e,t){if(!t)return void this.closeLoading();if("string"==typeof t)return void this.plugins.audio.error.call(this,t,null);const n=this.context.option.audioUploadUrl,i=this.context.dialog.updateModal?1:t.length,l=new FormData;for(let e=0;e'+this.icons.cancel+''+e.dialogBox.mathBox.title+'

    ",t},setController_MathButton:function(){const e=this.lang,t=this.util.createElement("DIV");return t.className="se-controller se-controller-link",t.innerHTML='
    ",t},open:function(){this.plugins.dialog.open.call(this,"math","math"===this.currentControllerName)},managedTags:function(){return{className:"katex",method:function(e){if(!e.getAttribute("data-exp"))return;const t=this._d.createRange().createContextualFragment(this.plugins.math._renderer.call(this,this.util.HTMLDecoder(e.getAttribute("data-exp"))));e.innerHTML=t.querySelector(".katex").innerHTML}}},_renderer:function(e){const t=this.context.option.katex;return t.src.renderToString(e,t.options)},_renderMathExp:function(e,t){e.previewElement.innerHTML=this.plugins.math._renderer.call(this,t.target.value)},submit:function(e){this.showLoading(),e.preventDefault(),e.stopPropagation();const t=function(){if(0===this.context.math.focusElement.value.trim().length)return!1;const e=this.context.math,t=e.focusElement.value,n=e.previewElement.querySelector(".katex");if(!n)return!1;if(n.className="__se__katex "+n.className,n.setAttribute("contenteditable",!1),n.setAttribute("data-exp",this.util.HTMLEncoder(t)),n.setAttribute("data-font-size",e.fontSizeElement.value),n.style.fontSize=e.fontSizeElement.value,this.context.dialog.updateModal){const t=this.util.getParentElement(e._mathExp,".katex");t.parentNode.replaceChild(n,t),this.setRange(n,0,n,1)}else{const e=this.getSelectedElements();if(e.length>1){const t=this.util.createElement(e[0].nodeName);if(t.appendChild(n),!this.insertNode(t,null,!0))return!1}else if(!this.insertNode(n,null,!0))return!1;const t=this.util.createTextNode(this.util.zeroWidthSpace);n.parentNode.insertBefore(t,n.nextSibling),this.setRange(n,0,n,1)}return e.focusElement.value="",e.fontSizeElement.value="1em",e.previewElement.style.fontSize="1em",e.previewElement.innerHTML="",!0}.bind(this);try{t()&&(this.plugins.dialog.close.call(this),this.history.push(!1))}catch(e){this.plugins.dialog.close.call(this)}finally{this.closeLoading()}return!1},active:function(e){if(e){if(e.getAttribute("data-exp"))return this.controllerArray.indexOf(this.context.math.mathController)<0&&(this.setRange(e,0,e,1),this.plugins.math.call_controller.call(this,e)),!0}else this.controllerArray.indexOf(this.context.math.mathController)>-1&&this.controllersOff();return!1},on:function(e){if(e){const e=this.context.math;if(e._mathExp){const t=this.util.HTMLDecoder(e._mathExp.getAttribute("data-exp")),n=e._mathExp.getAttribute("data-font-size")||"1em";this.context.dialog.updateModal=!0,e.focusElement.value=t,e.fontSizeElement.value=n,e.previewElement.innerHTML=this.plugins.math._renderer.call(this,t),e.previewElement.style.fontSize=n}}else this.plugins.math.init.call(this)},call_controller:function(e){this.context.math._mathExp=e;const t=this.context.math.mathController,n=this.util.getOffset(e,this.context.element.wysiwygFrame);t.style.top=n.top+e.offsetHeight+10+"px",t.style.left=n.left-this.context.element.wysiwygFrame.scrollLeft+"px",t.style.display="block";const i=this.context.element.wysiwygFrame.offsetWidth-(t.offsetLeft+t.offsetWidth);i<0?(t.style.left=t.offsetLeft+i+"px",t.firstElementChild.style.left=20-i+"px"):t.firstElementChild.style.left="20px",this.controllersOn(t,e,"math")},onClick_mathController:function(e){e.stopPropagation();const t=e.target.getAttribute("data-command")||e.target.parentNode.getAttribute("data-command");t&&(e.preventDefault(),/update/.test(t)?(this.context.math.focusElement.value=this.util.HTMLDecoder(this.context.math._mathExp.getAttribute("data-exp")),this.plugins.dialog.open.call(this,"math",!0)):(this.util.removeItem(this.context.math._mathExp),this.context.math._mathExp=null,this.focus(),this.history.push(!1)),this.controllersOff())},init:function(){const e=this.context.math;e.mathController.style.display="none",e._mathExp=null,e.focusElement.value="",e.previewElement.innerHTML=""}},y={name:"mention",display:"dialog",title:"mention",buttonClass:"",innerHTML:"@",focussed:0,renderItem:function(e){return`${e}`},getItems:function(e){return Promise.resolve(["overwite","the","mention","plugin","getItems","method"].filter(t=>t.includes(e.toLowerCase())))},renderList:function(e){const{mention:t}=this.context;t.getItems(e).then(e=>{t.items=e,t.list.innerHTML=e.map((e,n)=>`
  • \n ${t.renderItem(e)}\n
  • `).join("")})},setDialog:function(){const e=this.util.createElement("DIV"),t=this.lang;e.className="se-dialog-content",e.style.display="none";const n=`\n
    \n
    \n \n ${t.dialogBox.mentionBox.title}\n
    \n
    \n \n
      \n
    \n
    \n
    \n `;return e.innerHTML=n,e},getId:e=>e,getValue:e=>"@"+e,getLinkHref:()=>"",open:function(){const{mention:e}=this.context;this.plugins.dialog.open.call(this,"mention","mention"===this.currentControllerName),e.search.focus(),e.renderList("")},on:function(e){e||this.plugins.mention.init.call(this)},init:function(){const{mention:e}=this.context;e.search.value="",e.focussed=0,e.items=[]},onKeyPress:function(e){const{mention:t}=this.context;switch(e.key){case"ArrowDown":t.focussed+=1,e.preventDefault(),e.stopPropagation();break;case"ArrowUp":t.focussed>0&&(t.focussed-=1),e.preventDefault(),e.stopPropagation();break;case"Enter":t.add(),e.preventDefault(),e.stopPropagation();break;default:t.focussed=0}},onKeyUp:function(e){const{mention:t}=this.context;t.renderList(e.target.value)},getMentions:function(){const{mentions:e,getId:t}=this.context.mention;return e.filter(e=>{const n=t(e);return this.context.element.wysiwyg.querySelector(`[data-mention="${n}"]`)})},addMention:function(){const{mention:e}=this.context,t=e.items[e.focussed];if(t){e.mentions.find(n=>e.getId(n)===e.getId(t))||e.mentions.push(t);const n=this.util.createElement("A");n.href=e.getLinkHref(t),n.target="_blank",n.innerHTML=e.getValue(t),n.setAttribute("data-mention",e.getId(t)),this.insertNode(n,null,!1);const i=this.util.createElement("SPAN");i.innerHTML=" ",this.insertNode(i,n,!1)}this.plugins.dialog.close.call(this)},add:function(e){e.addModule([r.a]);const t=this.setDialog.call(e);e.getMentions=this.getMentions.bind(e);const n=t.querySelector(".se-mention-search");n.addEventListener("keyup",this.onKeyUp.bind(e)),n.addEventListener("keydown",this.onKeyPress.bind(e));const i=t.querySelector(".se-mention-list");e.context.mention={modal:t,search:n,list:i,triggerKey:this.triggerKey,visible:!1,add:this.addMention.bind(e),mentions:[],items:[],renderList:this.renderList.bind(e),getId:this.getId.bind(e),getValue:this.getValue.bind(e),getLinkHref:this.getLinkHref.bind(e),open:this.open.bind(e),focussed:this.focussed,renderItem:this.renderItem,getItems:this.getItems},e.context.dialog.modal.appendChild(t)},action:function(){}},C=n("JhlZ"),w=n.n(C),x={blockquote:{name:"blockquote",display:"command",add:function(e,t){e.context.blockquote={targetButton:t,tag:e.util.createElement("BLOCKQUOTE")}},active:function(e){if(e){if(/blockquote/i.test(e.nodeName))return this.util.addClass(this.context.blockquote.targetButton,"active"),!0}else this.util.removeClass(this.context.blockquote.targetButton,"active");return!1},action:function(){const e=this.util.getParentElement(this.getSelectionNode(),"blockquote");e?this.detachRangeFormatElement(e,null,null,!1,!1):this.applyRangeFormatElement(this.context.blockquote.tag.cloneNode(!1))}},align:{name:"align",display:"submenu",add:function(e,t){const n=e.icons,i=e.context;i.align={targetButton:t,_alignList:null,currentAlign:"",icons:{justify:n.align_justify,left:n.align_left,right:n.align_right,center:n.align_center}};let l=this.setSubmenu.call(e),o=l.querySelector("ul");o.addEventListener("click",this.pickup.bind(e)),i.align._alignList=o.querySelectorAll("li button"),e.initMenuTarget(this.name,t,l),l=null,o=null},setSubmenu:function(){const e=this.lang,t=this.icons,n=this.util.createElement("DIV");return n.className="se-submenu se-list-layer se-list-align",n.innerHTML='
    ",n},active:function(e){const t=this.context.align.targetButton,n=t.firstElementChild;if(e){if(this.util.isFormatElement(e)){const i=e.style.textAlign;if(i)return this.util.changeElement(n,this.context.align.icons[i]),t.setAttribute("data-focus",i),!0}}else this.util.changeElement(n,this.context.align.icons.left),t.removeAttribute("data-focus");return!1},on:function(){const e=this.context.align,t=e._alignList,n=e.targetButton.getAttribute("data-focus")||"left";if(n!==e.currentAlign){for(let e=0,i=t.length;e('+t.toolbar.default+")";for(o=0,s=a.length;o";return r+="",n.innerHTML=r,n},active:function(e){const t=this.context.font.targetText,n=this.context.font.targetTooltip;if(e){if(e.style&&e.style.fontFamily.length>0){const i=e.style.fontFamily.replace(/["']/g,"");return this.util.changeTxt(t,i),this.util.changeTxt(n,i),!0}}else{const e=this.lang.toolbar.font;this.util.changeTxt(t,e),this.util.changeTxt(n,e)}return!1},on:function(){const e=this.context.font,t=e._fontList,n=e.targetText.textContent;if(n!==e.currentFont){for(let e=0,i=t.length;e('+t.toolbar.default+")";for(let t,n=0,o=e.fontSizeUnit,s=i.length;n";return l+="",n.innerHTML=l,n},active:function(e){if(e){if(e.style&&e.style.fontSize.length>0)return this.util.changeTxt(this.context.fontSize.targetText,e.style.fontSize),!0}else this.util.changeTxt(this.context.fontSize.targetText,this.lang.toolbar.fontSize);return!1},on:function(){const e=this.context.fontSize,t=e._sizeList,n=e.targetText.textContent;if(n!==e.currentSize){for(let e=0,i=t.length;e
  • ',t},appendHr:function(e){const t=this.util.createElement("HR");return t.className=e,this.focus(),this.insertComponent(t,!1,!0,!1)},horizontalRulePick:function(e){e.preventDefault(),e.stopPropagation();let t=e.target,n=null;for(;!n&&!/UL/i.test(t.tagName);)n=t.getAttribute("data-value"),t=t.parentNode;if(!n)return;const i=this.plugins.horizontalRule.appendHr.call(this,"__se__"+n);i&&(this.setRange(i,0,i,0),this.submenuOff())}},list:{name:"list",display:"submenu",add:function(e,t){const n=e.context;n.list={targetButton:t,_list:null,currentList:"",icons:{bullets:e.icons.list_bullets,number:e.icons.list_number}};let i=this.setSubmenu.call(e),l=i.querySelector("ul");l.addEventListener("click",this.pickup.bind(e)),n.list._list=l.querySelectorAll("li button"),e.initMenuTarget(this.name,t,i),i=null,l=null},setSubmenu:function(){const e=this.lang,t=this.util.createElement("DIV");return t.className="se-submenu se-list-layer",t.innerHTML='
    ",t},active:function(e){const t=this.context.list.targetButton,n=t.firstElementChild,i=this.util;if(e){if(i.isList(e)){const l=e.nodeName;return t.setAttribute("data-focus",l),i.addClass(t,"active"),/UL/i.test(l)?i.changeElement(n,this.context.list.icons.bullets):i.changeElement(n,this.context.list.icons.number),!0}}else t.removeAttribute("data-focus"),i.changeElement(n,this.context.list.icons.number),i.removeClass(t,"active");return!1},on:function(){const e=this.context.list,t=e._list,n=e.targetButton.getAttribute("data-focus")||"";if(n!==e.currentList){for(let e=0,i=t.length;e"),t.innerHTML+=n.outerHTML,e&&(t.innerHTML+="
    ")}else{const e=n.childNodes;for(;e[0];)t.appendChild(e[0])}a.appendChild(t),r||(u=a),r&&m===g&&!o.isRangeFormatElement(f)||(d||(d=a),i&&r&&m===g||r&&o.isList(g)&&g===c||a.parentNode!==m&&m.insertBefore(a,f)),o.removeItem(n),i&&null===h&&(h=a.children.length-1),r&&(o.getRangeFormatElement(g,p)!==o.getRangeFormatElement(c,p)||o.isList(g)&&o.isList(c)&&o.getElementDepth(g)!==o.getElementDepth(c))&&(a=o.createElement(e)),_&&0===_.children.length&&o.removeItem(_)}else o.removeItem(n);h&&(d=d.children[h]),s&&(g=a.children.length-1,a.innerHTML+=c.innerHTML,u=a.children[g],o.removeItem(c))}else{if(n)for(let e=0,t=l.length;e=0;n--)if(l[n].contains(l[e])){l.splice(e,1),e--,t--;break}const t=o.getRangeFormatElement(s),i=t&&t.tagName===e;let a,r;const c=function(e){return!this.isComponent(e)}.bind(o);i||(r=o.createElement(e));for(let t,s,d=0,u=l.length;d0){const e=l.cloneNode(!1),t=l.childNodes,o=this.util.getPositionIndex(i);for(;t[o];)e.appendChild(t[o]);n.appendChild(e)}0===l.children.length&&this.util.removeItem(l),this.util.mergeSameTags(s);const a=this.util.getEdgeChildNodes(t,n);return{cc:t.parentNode,sc:a.sc,ec:a.ec}},editInsideList:function(e,t){const n=(t=t||this.getSelectedElements().filter(function(e){return this.isListCell(e)}.bind(this.util))).length;if(0===n||!e&&!this.util.isListCell(t[0].previousElementSibling)&&!this.util.isListCell(t[n-1].nextElementSibling))return{sc:t[0],so:0,ec:t[n-1],eo:1};let i=t[0].parentNode,l=t[n-1],o=null;if(e){if(i!==l.parentNode&&this.util.isList(l.parentNode.parentNode)&&l.nextElementSibling)for(l=l.nextElementSibling;l;)t.push(l),l=l.nextElementSibling;o=this.plugins.list.editList.call(this,i.nodeName.toUpperCase(),t,!0)}else{let e=this.util.createElement(i.nodeName),s=t[0].previousElementSibling,a=l.nextElementSibling;const r={s:null,e:null,sl:i,el:i};for(let l,o=0,c=n;o span > span"),n.table.columnFixedButton=o.querySelector("._se_table_fixed_column"),n.table.headerButton=o.querySelector("._se_table_header"),o.addEventListener("mousedown",e.eventStop);let s=this.setController_tableEditor.call(e,n.table.cellControllerTop);n.table.resizeDiv=s,n.table.splitMenu=s.querySelector(".se-btn-group-sub"),n.table.mergeButton=s.querySelector("._se_table_merge_button"),n.table.splitButton=s.querySelector("._se_table_split_button"),n.table.insertRowAboveButton=s.querySelector("._se_table_insert_row_a"),n.table.insertRowBelowButton=s.querySelector("._se_table_insert_row_b"),s.addEventListener("mousedown",e.eventStop),l.addEventListener("mousemove",this.onMouseMove_tablePicker.bind(e)),l.addEventListener("click",this.appendTable.bind(e)),s.addEventListener("click",this.onClick_tableController.bind(e)),o.addEventListener("click",this.onClick_tableController.bind(e)),e.initMenuTarget(this.name,t,i),n.element.relative.appendChild(s),n.element.relative.appendChild(o),i=null,l=null,s=null,o=null},setSubmenu:function(){const e=this.util.createElement("DIV");return e.className="se-submenu se-selector-table",e.innerHTML='
    1 x 1
    ',e},setController_table:function(){const e=this.lang,t=this.icons,n=this.util.createElement("DIV");return n.className="se-controller se-controller-table",n.innerHTML='
    ",n},setController_tableEditor:function(e){const t=this.lang,n=this.icons,i=this.util.createElement("DIV");return i.className="se-controller se-controller-table-cell",i.innerHTML=(e?"":'
    ')+'
    • '+t.controller.VerticalSplit+'
    • '+t.controller.HorizontalSplit+"
    ",i},appendTable:function(){const e=this.util.createElement("TABLE"),t=this.plugins.table.createCells,n=this.context.table._tableXY[0];let i=this.context.table._tableXY[1],l="";for(;i>0;)l+=""+t.call(this,"td",n)+"",--i;l+="",e.innerHTML=l;if(this.insertComponent(e,!1,!0,!1)){const t=e.querySelector("td div");this.setRange(t,0,t,0),this.plugins.table.reset_table_picker.call(this)}},createCells:function(e,t,n){if(e=e.toLowerCase(),n){const t=this.util.createElement(e);return t.innerHTML="

    ",t}{let n="";for(;t>0;)n+="<"+e+">

    ",t--;return n}},onMouseMove_tablePicker:function(e){e.stopPropagation();let t=this._w.Math.ceil(e.offsetX/18),n=this._w.Math.ceil(e.offsetY/18);t=t<1?1:t,n=n<1?1:n,this.context.table.tableHighlight.style.width=t+"em",this.context.table.tableHighlight.style.height=n+"em";this.context.table.tableUnHighlight.style.width="10em",this.context.table.tableUnHighlight.style.height="10em",this.util.changeTxt(this.context.table.tableDisplay,t+" x "+n),this.context.table._tableXY=[t,n]},reset_table_picker:function(){if(!this.context.table.tableHighlight)return;const e=this.context.table.tableHighlight.style,t=this.context.table.tableUnHighlight.style;e.width="1em",e.height="1em",t.width="10em",t.height="10em",this.util.changeTxt(this.context.table.tableDisplay,"1 x 1"),this.submenuOff()},init:function(){const e=this.context.table,t=this.plugins.table;if(t._removeEvents.call(this),t._selectedTable){const e=t._selectedTable.querySelectorAll(".se-table-selected-cell");for(let t=0,n=e.length;t0)for(let e,t=0;to||(u>=e.index?(i+=e.cs,u+=e.cs,e.rs-=1,e.row=o+1,e.rs<1&&(r.splice(t,1),t--)):h===g-1&&(e.rs-=1,e.row=o+1,e.rs<1&&(r.splice(t,1),t--)));if(o===s&&h===l){n._logical_cellIndex=u;break}d>0&&a.push({index:u,cs:c+1,rs:d,row:-1}),i+=c}r=r.concat(a).sort((function(e,t){return e.index-t.index})),a=[]}a=null,r=null}},editTable:function(e,t){const n=this.plugins.table,i=this.context.table,l=i._element,o="row"===e;if(o){const e=i._trElement.parentNode;if(/^THEAD$/i.test(e.nodeName)){if("up"===t)return;if(!e.nextElementSibling||!/^TBODY$/i.test(e.nextElementSibling.nodeName))return void(l.innerHTML+=""+n.createCells.call(this,"td",i._logical_cellCnt,!1)+"")}}if(n._ref){const e=i._tdElement,l=n._selectedCells;if(o)if(t)n.setCellInfo.call(this,"up"===t?l[0]:l[l.length-1],!0),n.editRow.call(this,t,e);else{let e=l[0].parentNode;const i=[l[0]];for(let t,n=1,o=l.length;ns&&s>t&&(e[l].rowSpan=n+a,c-=i)}if(i){const e=r[o+1];if(e){const t=[];let n=r[o].cells,i=0;for(let e,l,o=0,s=n.length;o1&&(e.rowSpan-=1,t.push({cell:e.cloneNode(!1),index:l}));if(t.length>0){let l=t.shift();n=e.cells,i=0;for(let o,s,a=0,r=n.length;a=l.index)||(a--,i--,i+=l.cell.colSpan-1,e.insertBefore(l.cell,o),l=t.shift(),l));a++);if(l){e.appendChild(l.cell);for(let n=0,i=t.length;n0){const e=!o[b+1];for(let t,n=0;n_||(p>=t.index?(f+=t.cs,p=b+f,t.rs-=1,t.row=_+1,t.rs<1&&(d.splice(n,1),n--)):e&&(t.rs-=1,t.row=_+1,t.rs<1&&(d.splice(n,1),n--)))}n>0&&c.push({rs:n,cs:r+1,index:p,row:-1}),p>=t&&p+r<=t+s?h.push(e):p<=t+s&&p+r>=t?e.colSpan-=i.getOverlapRangeAtIndex(a,a+s,p,p+r):n>0&&(pt+s)&&g.push({cell:e,i:_,rs:_+n}),f+=r}else{if(b>=t)break;if(r>0){if(u<1&&r+b>=t){e.colSpan+=1,t=null,u=n+1;break}t-=r}if(!m){for(let e,n=0;n0){u-=1;continue}null!==t&&o.length>0&&(p=this.plugins.table.createCells.call(this,o[0].nodeName,0,!0),p=e.insertBefore(p,o[t]))}}if(l){let e,t;for(let n,l=0,o=h.length;l1)c.colSpan=this._w.Math.floor(e/2),l.colSpan=e-c.colSpan,s.insertBefore(c,l.nextElementSibling);else{let t=[],n=[];for(let s,r,c=0,d=i._rowCnt;c0)for(let e,t=0;tc||(u>=e.index?(r+=e.cs,u+=e.cs,e.rs-=1,e.row=c+1,e.rs<1&&(n.splice(t,1),t--)):h===g-1&&(e.rs-=1,e.row=c+1,e.rs<1&&(n.splice(t,1),t--)));if(u<=a&&d>0&&t.push({index:u,cs:o+1,rs:d,row:-1}),i!==l&&u<=a&&u+o>=a+e-1){i.colSpan+=1;break}if(u>a)break;r+=o}n=n.concat(t).sort((function(e,t){return e.index-t.index})),t=[]}s.insertBefore(c,l.nextElementSibling)}}else{const e=l.rowSpan;if(c.colSpan=l.colSpan,e>1){c.rowSpan=this._w.Math.floor(e/2);const n=e-c.rowSpan,i=[],r=t.getArrayIndex(o,s)+n;for(let e,t,n=0;n=a));c++)l=e[c],o=l.rowSpan-1,o>0&&o+n>=r&&s=h.index&&(r+=h.cs,l+=h.cs,h=i.shift()),l>=a||o===s-1){d.insertBefore(c,e.nextElementSibling);break}r+=t}l.rowSpan=n}else{c.rowSpan=l.rowSpan;const e=t.createElement("TR");e.appendChild(c);for(let e,t=0;t=r&&(e[n].rowSpan+=1)}const n=i._physical_cellIndex,a=s.cells;for(let e=0,t=a.length;e0&&s+o>=i&&(e.rowSpan-=n.getOverlapRangeAtIndex(i,l,s,s+o));else o.push(e[s]);for(let e=0,t=o.length;e"+this.plugins.table.createCells.call(this,"th",this.context.table._logical_cellCnt,!1)+"",i.insertBefore(t,i.firstElementChild)}e.toggleClass(t,"active"),/TH/i.test(this.context.table._tdElement.nodeName)?this.controllersOff():this.plugins.table.setPositionControllerDiv.call(this,this.context.table._tdElement,!1)},setTableStyle:function(e){const t=this.context.table,n=t._element;let i,l,o,s;e.indexOf("width")>-1&&(i=t.resizeButton.firstElementChild,l=t.resizeText,t._maxWidth?(o=t.icons.reduction,s=t.minText,t.columnFixedButton.style.display="block",this.util.removeClass(n,"se-table-size-auto"),this.util.addClass(n,"se-table-size-100")):(o=t.icons.expansion,s=t.maxText,t.columnFixedButton.style.display="none",this.util.removeClass(n,"se-table-size-100"),this.util.addClass(n,"se-table-size-auto")),this.util.changeElement(i,o),this.util.changeTxt(l,s)),e.indexOf("column")>-1&&(t._fixedColumn?(this.util.removeClass(n,"se-table-layout-auto"),this.util.addClass(n,"se-table-layout-fixed"),this.util.addClass(t.columnFixedButton,"active")):(this.util.removeClass(n,"se-table-layout-fixed"),this.util.addClass(n,"se-table-layout-auto"),this.util.removeClass(t.columnFixedButton,"active")))},setActiveButton:function(e,t){const n=this.context.table;/^TH$/i.test(e.nodeName)?(n.insertRowAboveButton.setAttribute("disabled",!0),n.insertRowBelowButton.setAttribute("disabled",!0)):(n.insertRowAboveButton.removeAttribute("disabled"),n.insertRowBelowButton.removeAttribute("disabled")),t&&e!==t?(n.splitButton.setAttribute("disabled",!0),n.mergeButton.removeAttribute("disabled")):(n.splitButton.removeAttribute("disabled"),n.mergeButton.setAttribute("disabled",!0))},_bindOnSelect:null,_bindOffSelect:null,_bindOffShift:null,_selectedCells:null,_shift:!1,_fixedCell:null,_fixedCellName:null,_selectedCell:null,_selectedTable:null,_ref:null,_toggleEditor:function(e){this.context.element.wysiwyg.setAttribute("contenteditable",e),e?this.util.removeClass(this.context.element.wysiwyg,"se-disabled"):this.util.addClass(this.context.element.wysiwyg,"se-disabled")},_offCellMultiSelect:function(e){e.stopPropagation();const t=this.plugins.table;t._shift?t._initBind&&(this._wd.removeEventListener("touchmove",t._initBind),t._initBind=null):(t._removeEvents.call(this),t._toggleEditor.call(this,!0)),t._fixedCell&&t._selectedTable&&(t.setActiveButton.call(this,t._fixedCell,t._selectedCell),t.call_controller_tableEdit.call(this,t._selectedCell||t._fixedCell),t._selectedCells=t._selectedTable.querySelectorAll(".se-table-selected-cell"),t._selectedCell&&t._fixedCell&&this.focusEdge(t._selectedCell),t._shift||(t._fixedCell=null,t._selectedCell=null,t._fixedCellName=null))},_onCellMultiSelect:function(e){this._antiBlur=!0;const t=this.plugins.table,n=this.util.getParentElement(e.target,this.util.isCell);if(t._shift)n===t._fixedCell?t._toggleEditor.call(this,!0):t._toggleEditor.call(this,!1);else if(!t._ref){if(n===t._fixedCell)return;t._toggleEditor.call(this,!1)}n&&n!==t._selectedCell&&t._fixedCellName===n.nodeName&&t._selectedTable===this.util.getParentElement(n,"TABLE")&&(t._selectedCell=n,t._setMultiCells.call(this,t._fixedCell,n))},_setMultiCells:function(e,t){const n=this.plugins.table,i=n._selectedTable.rows,l=this.util,o=n._selectedTable.querySelectorAll(".se-table-selected-cell");for(let e=0,t=o.length;e0)for(let e,t=0;td||(u>=e.index?(o+=e.cs,u+=e.cs,e.rs-=1,e.row=d+1,e.rs<1&&(a.splice(t,1),t--)):p===m-1&&(e.rs-=1,e.row=d+1,e.rs<1&&(a.splice(t,1),t--)));if(s){if(i!==e&&i!==t||(c.cs=null!==c.cs&&c.csu+h?c.ce:u+h,c.rs=null!==c.rs&&c.rsd+g?c.re:d+g,c._i+=1),2===c._i){s=!1,a=[],r=[],d=-1;break}}else if(l.getOverlapRangeAtIndex(c.cs,c.ce,u,u+h)&&l.getOverlapRangeAtIndex(c.rs,c.re,d,d+g)){const e=c.csu+h?c.ce:u+h,n=c.rsd+g?c.re:d+g;if(c.cs!==e||c.ce!==t||c.rs!==n||c.re!==o){c.cs=e,c.ce=t,c.rs=n,c.re=o,d=-1,a=[],r=[];break}l.addClass(i,"se-table-selected-cell")}g>0&&r.push({index:u,cs:h+1,rs:g,row:-1}),o+=i.colSpan-1}a=a.concat(r).sort((function(e,t){return e.index-t.index})),r=[]}},_removeEvents:function(){const e=this.plugins.table;e._initBind&&(this._wd.removeEventListener("touchmove",e._initBind),e._initBind=null),e._bindOnSelect&&(this._wd.removeEventListener("mousedown",e._bindOnSelect),this._wd.removeEventListener("mousemove",e._bindOnSelect),e._bindOnSelect=null),e._bindOffSelect&&(this._wd.removeEventListener("mouseup",e._bindOffSelect),e._bindOffSelect=null),e._bindOffShift&&(this._wd.removeEventListener("keyup",e._bindOffShift),e._bindOffShift=null)},_initBind:null,onTableCellMultiSelect:function(e,t){const n=this.plugins.table;n._removeEvents.call(this),this.controllersOff(),n._shift=t,n._fixedCell=e,n._fixedCellName=e.nodeName,n._selectedTable=this.util.getParentElement(e,"TABLE");const i=n._selectedTable.querySelectorAll(".se-table-selected-cell");for(let e=0,t=i.length;e-1?(n=e.toLowerCase(),s="blockquote"===n?"range":"pre"===n?"free":"replace",r=/^h/.test(n)?n.match(/\d+/)[0]:"",a=t["tag_"+(r?"h":n)]+r,d="",c=""):(n=e.tag.toLowerCase(),s=e.command,a=e.name||n,d=e.class,c=d?' class="'+d+'"':""),o+='
  • ";return o+="",n.innerHTML=o,n},active:function(e){let t=this.lang.toolbar.formats;const n=this.context.formatBlock.targetText,i=this.context.formatBlock.targetTooltip;if(e){if(this.util.isFormatElement(e)){const l=this.context.formatBlock._formatList,o=e.nodeName.toLowerCase(),s=(e.className.match(/(\s|^)__se__format__[^\s]+/)||[""])[0].trim();for(let e,n=0,i=l.length;n=0;u--)if(i=p[u],i!==(p[u+1]?p[u+1].parentNode:null)){if(d=r.isComponent(i),o=d?"":i.innerHTML.replace(/(?!>)\s+(?=<)|\n/g," "),s=r.getParentElement(i,(function(e){return e.parentNode===t})),(t!==i.parentNode||d)&&(r.isFormatElement(t)?(t.parentNode.insertBefore(n,t.nextSibling),t=t.parentNode):(t.insertBefore(n,s?s.nextSibling:null),t=i.parentNode),a=n.nextSibling,a&&n.nodeName===a.nodeName&&r.isSameAttributes(n,a)&&(n.innerHTML+="
    "+a.innerHTML,r.removeItem(a)),n=l.cloneNode(!1),h=!0),c=n.innerHTML,n.innerHTML=(h||!o||!c||/
    $/i.test(o)?o:o+"
    ")+c,0===u){t.insertBefore(n,i),a=i.nextSibling,a&&n.nodeName===a.nodeName&&r.isSameAttributes(n,a)&&(n.innerHTML+="
    "+a.innerHTML,r.removeItem(a));const e=n.previousSibling;e&&n.nodeName===e.nodeName&&r.isSameAttributes(n,e)&&(e.innerHTML+="
    "+n.innerHTML,r.removeItem(n))}d||r.removeItem(i),o&&(h=!1)}this.setRange(i,0,i,0)}else{for(let e,t,n=0,s=p.length;n('+t.toolbar.default+")";for(let e,t=0,n=i.length;t";return l+="",n.innerHTML=l,n},on:function(){const e=this.context.lineHeight,t=e._sizeList,n=this.util.getFormatElement(this.getSelectionNode()),i=n?n.style.lineHeight+"":"";if(i!==e.currentSize){for(let e=0,n=t.length;e"}return o+="",t.innerHTML=o,t},on:function(){const e=this.context.paragraphStyle._classList,t=this.util.getFormatElement(this.getSelectionNode());for(let n=0,i=e.length;n"}return l+="",t.innerHTML=l,t},on:function(){const e=this.util,t=this.context.textStyle._styleList,n=this.getSelectionNode();for(let i,l,o,s=0,a=t.length;s'+(e.alt||t)+'
    '+(e.name||t)+"
    "},setImage:function(e){this.callPlugin("image",function(){const t={name:e.parentNode.querySelector(".__se__img_name").textContent,size:0};this.context.image._altText=e.alt,this.plugins.image.create_image.call(this,e.src,"",!1,this.context.image._origin_w,this.context.image._origin_h,"none",t)}.bind(this),null)}},mention:y},E={redo:'',undo:'',bold:'',underline:'',italic:'',strike:'',subscript:'',superscript:'',erase:'',indent:'',outdent:'',expansion:'',reduction:'',code_view:'',preview:'',print:'',template:'',line_height:'',paragraph_style:'',text_style:'',save:'',blockquote:'',arrow_down:'',align_justify:'',align_left:'',align_right:'',align_center:'',font_color:'',highlight_color:'',list_bullets:'',list_number:'',table:'',horizontal_rule:'',show_blocks:'',cancel:'',image:'',video:'',link:'',math:'',unlink:'',table_header:'',merge_cell:'',split_cell:'',caption:'',edit:'',delete:'',modify:'',revert:'',auto_size:'',insert_row_below:'',insert_row_above:'',insert_column_left:'',insert_column_right:'',delete_row:'',delete_column:'',fixed_column_width:'',rotate_left:'',rotate_right:'',mirror_horizontal:'',mirror_vertical:'',checked:'',line_break:'',audio:'',image_gallery:'',more_text:'',more_paragraph:'',more_plus:'',more_horizontal:'',more_vertical:'',attachment:'',map:'',magic_stick:'',empty_file:''},S=n("P6u4"),N=n.n(S);const T={_d:null,_w:null,isIE:null,isIE_Edge:null,isOSX_IOS:null,_propertiesInit:function(){this._d||(this._d=document,this._w=window,this.isIE=navigator.userAgent.indexOf("Trident")>-1,this.isIE_Edge=navigator.userAgent.indexOf("Trident")>-1||navigator.appVersion.indexOf("Edge")>-1,this.isOSX_IOS=/(Mac|iPhone|iPod|iPad)/.test(navigator.platform))},_HTMLConvertor:function(e){const t={"&":"&"," ":" ","'":"'",'"':""","<":"<",">":">"};return e.replace(/&|\u00A0|'|"|<|>/g,(function(e){return"string"==typeof t[e]?t[e]:e}))},zeroWidthSpace:String.fromCharCode(8203),zeroWidthRegExp:new RegExp(String.fromCharCode(8203),"g"),onlyZeroWidthRegExp:new RegExp("^"+String.fromCharCode(8203)+"+$"),onlyZeroWidthSpace:function(e){return"string"!=typeof e&&(e=e.textContent),""===e||this.onlyZeroWidthRegExp.test(e)},getXMLHttpRequest:function(){if(!this._w.ActiveXObject)return this._w.XMLHttpRequest?new XMLHttpRequest:null;try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(e){try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(e){return null}}},createElement:function(e){return this._d.createElement(e)},createTextNode:function(e){return this._d.createTextNode(e||"")},HTMLEncoder:function(e){const t={"<":"$lt;",">":"$gt;"};return e.replace(/<|>/g,(function(e){return"string"==typeof t[e]?t[e]:e}))},HTMLDecoder:function(e){const t={"$lt;":"<","$gt;":">"};return e.replace(/\$lt;|\$gt;/g,(function(e){return"string"==typeof t[e]?t[e]:e}))},hasOwn:function(e,t){return this._hasOwn.call(e,t)},_hasOwn:Object.prototype.hasOwnProperty,getIncludePath:function(e,t){let n="";const i=[],l="js"===t?"script":"link",o="js"===t?"src":"href";let s="(?:";for(let t=0,n=e.length;t0?i[0][o]:""),-1===n.indexOf(":/")&&"//"!==n.slice(0,2)&&(n=0===n.indexOf("/")?location.href.match(/^.*?:\/\/[^\/]*/)[0]+n:location.href.match(/^[^\?]*\/(?:)/)[0]+n),!n)throw"[SUNEDITOR.util.getIncludePath.fail] The SUNEDITOR installation path could not be automatically detected. (name: +"+name+", extension: "+t+")";return n},getPageStyle:function(e){let t="";const n=(e||this._d).styleSheets;for(let e,i=0,l=n.length;i-1||(i+=n[e].name+'="'+n[e].value+'" ');return i},getByteLength:function(e){const t=this._w.encodeURIComponent;let n,i;return this.isIE_Edge?(i=this._w.unescape(t(e.toString())).length,n=0,null!==t(e.toString()).match(/(%0A|%0D)/gi)&&(n=t(e.toString()).match(/(%0A|%0D)/gi).length),i+n):(i=new this._w.TextEncoder("utf-8").encode(e.toString()).length,n=0,null!==t(e.toString()).match(/(%0A|%0D)/gi)&&(n=t(e.toString()).match(/(%0A|%0D)/gi).length),i+n)},isWysiwygDiv:function(e){return e&&1===e.nodeType&&(this.hasClass(e,"se-wrapper-wysiwyg")||/^BODY$/i.test(e.nodeName))},isNonEditable:function(e){return e&&1===e.nodeType&&"false"===e.getAttribute("contenteditable")},isTextStyleElement:function(e){return e&&3!==e.nodeType&&/^(strong|span|font|b|var|i|em|u|ins|s|strike|del|sub|sup|mark|a|label|code)$/i.test(e.nodeName)},isFormatElement:function(e){return e&&1===e.nodeType&&(/^(P|DIV|H[1-6]|PRE|LI|TH|TD)$/i.test(e.nodeName)||this.hasClass(e,"(\\s|^)__se__format__replace_.+(\\s|$)|(\\s|^)__se__format__free_.+(\\s|$)"))&&!this.isComponent(e)&&!this.isWysiwygDiv(e)},isRangeFormatElement:function(e){return e&&1===e.nodeType&&(/^(BLOCKQUOTE|OL|UL|FIGCAPTION|TABLE|THEAD|TBODY|TR|TH|TD)$/i.test(e.nodeName)||this.hasClass(e,"(\\s|^)__se__format__range_.+(\\s|$)"))},isClosureRangeFormatElement:function(e){return e&&1===e.nodeType&&(/^(TH|TD)$/i.test(e.nodeName)||this.hasClass(e,"(\\s|^)__se__format__range__closure_.+(\\s|$)"))},isFreeFormatElement:function(e){return e&&1===e.nodeType&&(/^PRE$/i.test(e.nodeName)||this.hasClass(e,"(\\s|^)__se__format__free_.+(\\s|$)"))&&!this.isComponent(e)&&!this.isWysiwygDiv(e)},isClosureFreeFormatElement:function(e){return e&&1===e.nodeType&&this.hasClass(e,"(\\s|^)__se__format__free__closure_.+(\\s|$)")},isComponent:function(e){return e&&(/se-component/.test(e.className)||/^(TABLE|HR)$/.test(e.nodeName))},isMediaComponent:function(e){return e&&/se-component/.test(e.className)},isNotCheckingNode:function(e){return e&&/katex|__se__tag/.test(e.className)},getFormatElement:function(e,t){if(!e)return null;for(t||(t=function(){return!0});e;){if(this.isWysiwygDiv(e))return null;if(this.isRangeFormatElement(e)&&e.firstElementChild,this.isFormatElement(e)&&t(e))return e;e=e.parentNode}return null},getRangeFormatElement:function(e,t){if(!e)return null;for(t||(t=function(){return!0});e;){if(this.isWysiwygDiv(e))return null;if(this.isRangeFormatElement(e)&&!/^(THEAD|TBODY|TR)$/i.test(e.nodeName)&&t(e))return e;e=e.parentNode}return null},getFreeFormatElement:function(e,t){if(!e)return null;for(t||(t=function(){return!0});e;){if(this.isWysiwygDiv(e))return null;if(this.isFreeFormatElement(e)&&t(e))return e;e=e.parentNode}return null},getClosureFreeFormatElement:function(e,t){if(!e)return null;for(t||(t=function(){return!0});e;){if(this.isWysiwygDiv(e))return null;if(this.isClosureFreeFormatElement(e)&&t(e))return e;e=e.parentNode}return null},copyTagAttributes:function(e,t){t.style.cssText&&(e.style.cssText+=t.style.cssText);const n=t.classList;for(let t=0,i=n.length;ts?1:o0&&!this.isBreak(e);)e=e.firstChild;for(;t&&1===t.nodeType&&t.childNodes.length>0&&!this.isBreak(t);)t=t.lastChild;return{sc:e,ec:t||e}}},getOffset:function(e,t){let n=0,i=0,l=3===e.nodeType?e.parentElement:e;const o=this.getParentElement(e,this.isWysiwygDiv.bind(this));for(;l&&!this.hasClass(l,"se-container")&&l!==o;)n+=l.offsetLeft,i+=l.offsetTop,l=l.offsetParent;const s=t&&/iframe/i.test(t.nodeName);return{left:n+(s?t.parentElement.offsetLeft:0),top:i-o.scrollTop+(s?t.parentElement.offsetTop:0)}},getOverlapRangeAtIndex:function(e,t,n,i){if(e<=i?tn)return 0;const l=(e>n?e:n)-(t0?" ":"")+t)},removeClass:function(e,t){if(!e)return;const n=new this._w.RegExp("(\\s|^)"+t+"(\\s|$)");e.className=e.className.replace(n," ").trim(),e.className.trim()||e.removeAttribute("class")},toggleClass:function(e,t){if(!e)return;const n=new this._w.RegExp("(\\s|^)"+t+"(\\s|$)");n.test(e.className)?e.className=e.className.replace(n," ").trim():e.className+=" "+t,e.className.trim()||e.removeAttribute("class")},setDisabledButtons:function(e,t){for(let n=0,i=t.length;n=0){e.splitText(t);const n=this.getNodeFromPath([a+1],i);this.onlyZeroWidthSpace(n)&&(n.data=this.zeroWidthSpace)}}else 1===e.nodeType&&(e.previousSibling?e=e.previousSibling:this.getElementDepth(e)===n&&(r=!1));let c=e;for(;this.getElementDepth(c)>n;)for(a=this.getPositionIndex(c)+1,c=c.parentNode,s=l,l=c.cloneNode(!1),o=c.childNodes,s&&(this.isListCell(l)&&this.isList(s)&&s.firstElementChild?(l.innerHTML=s.firstElementChild.innerHTML,T.removeItem(s.firstElementChild),s.children.length>0&&l.appendChild(s)):l.appendChild(s));o[a];)l.appendChild(o[a]);c.childNodes.length<=1&&(!c.firstChild||0===c.firstChild.textContent.length)&&(c.innerHTML="
    ");const d=c.parentNode;return r&&(c=c.nextSibling),l?(this.mergeSameTags(l,null,!1),this.mergeNestedTags(l,function(e){return this.isList(e)}.bind(this)),l.childNodes.length>0?d.insertBefore(l,c):l=c,0===i.childNodes.length&&this.removeItem(i),l):c},mergeSameTags:function(e,t,n){const i=this,l=t?t.length:0;let o=null;return l&&(o=this._w.Array.apply(null,new this._w.Array(l)).map(this._w.Number.prototype.valueOf,0)),function e(s,a,r){const c=s.childNodes;for(let d,u,h=0,g=c.length;h=0;){if(i.getArrayIndex(o.childNodes,n)!==e[r]){c=!1;break}n=d.parentNode,o=n.parentNode,r--}c&&(e.splice(a,1),e[a]=h)}}i.copyTagAttributes(d,s),s.parentNode.insertBefore(d,s),i.removeItem(s)}if(!u){1===d.nodeType&&e(d,a+1,h);break}if(d.nodeName===u.nodeName&&i.isSameAttributes(d,u)&&d.href===u.href){const e=d.childNodes;let n=0;for(let t=0,i=e.length;t0&&n++;const s=d.lastChild,c=u.firstChild;let g=0;if(s&&c){const e=3===s.nodeType&&3===c.nodeType;g=s.textContent.length;let i=s.previousSibling;for(;i&&3===i.nodeType;)g+=i.textContent.length,i=i.previousSibling;if(n>0&&3===s.nodeType&&3===c.nodeType&&(s.textContent.length>0||c.textContent.length>0)&&n--,l){let i=null;for(let d=0;dh){if(a>0&&i[a-1]!==r)continue;i[a]-=1,i[a+1]>=0&&i[a]===h&&(i[a+1]+=n,e&&s&&3===s.nodeType&&c&&3===c.nodeType&&(o[d]+=g))}}}if(3===d.nodeType){if(g=d.textContent.length,d.textContent+=u.textContent,l){let e=null;for(let i=0;ih){if(a>0&&e[a-1]!==r)continue;e[a]-=1,e[a+1]>=0&&e[a]===h&&(e[a+1]+=n,o[i]+=g)}}}else d.innerHTML+=u.innerHTML;i.removeItem(u),h--}else 1===d.nodeType&&e(d,a+1,h)}}(e,0,0),o},mergeNestedTags:function(e,t){"string"==typeof t?t=function(e){return this.test(e.tagName)}.bind(new this._w.RegExp("^("+(t||".+")+")$","i")):"function"!=typeof t&&(t=function(){return!0}),function e(n){let i=n.children;if(1===i.length&&i[0].nodeName===n.nodeName&&t(n)){const e=i[0];for(i=e.children;i[0];)n.appendChild(i[0]);n.removeChild(e)}for(let t=0,i=n.children.length;t")},htmlRemoveWhiteSpace:function(e){return e?e.trim().replace(/<\/?(?!strong|span|font|b|var|i|em|u|ins|s|strike|del|sub|sup|mark|a|label|code)[^>^<]+>\s+(?=<)/gi,(function(e){return e.trim()})):""},sortByDepth:function(e,t){const n=t?1:-1,i=-1*n;e.sort(function(e,t){return this.isListCell(e)&&this.isListCell(t)?(e=this.getElementDepth(e))>(t=this.getElementDepth(t))?n:e":e.innerHTML,e.innerHTML=t.outerHTML},_setDefaultOptionStyle:function(e,t){let n="";e.height&&(n+="height:"+e.height+";"),e.minHeight&&(n+="min-height:"+e.minHeight+";"),e.maxHeight&&(n+="max-height:"+e.maxHeight+";"),e.position&&(n+="position:"+e.position+";"),e.width&&(n+="width:"+e.width+";"),e.minWidth&&(n+="min-width:"+e.minWidth+";"),e.maxWidth&&(n+="max-width:"+e.maxWidth+";");let i="",l="",o="";const s=(t=n+t).split(";");for(let t,n=0,a=s.length;n'+this._setIframeCssTags(t),e.contentDocument.body.className="sun-editor-editable",e.contentDocument.body.setAttribute("contenteditable",!0)},_setIframeCssTags:function(e){const t=e.iframeCSSFileName,n=this._w.RegExp;let i="";for(let e,l=0,o=t.length;l'}return i+("auto"===e.height?"":"")}};var L=T,k={init:function(e,t){"object"!=typeof t&&(t={});const n=document;this._initOptions(e,t);const i=n.createElement("DIV");i.className="sun-editor",e.id&&(i.id="suneditor_"+e.id);const l=n.createElement("DIV");l.className="se-container";const o=this._createToolBar(n,t.buttonList,t.plugins,t);o.element.style.visibility="hidden",o.pluginCallButtons.math&&this._checkKatexMath(t.katex);const s=n.createElement("DIV");s.className="se-arrow";const a=n.createElement("DIV");a.className="se-toolbar-sticky-dummy";const r=n.createElement("DIV");r.className="se-wrapper";const c=this._initElements(t,i,o.element,s),d=c.bottomBar,u=c.wysiwygFrame,h=c.placeholder;let g=c.codeView;const p=d.resizingBar,m=d.navigation,f=d.charWrapper,_=d.charCounter,b=n.createElement("DIV");b.className="se-loading-box sun-editor-common",b.innerHTML='
    ';const v=n.createElement("DIV");v.className="se-line-breaker",v.innerHTML='";const y=n.createElement("DIV");y.className+="se-line-breaker-component";const C=y.cloneNode(!0);y.innerHTML=C.innerHTML=t.icons.line_break;const w=n.createElement("DIV");w.className="se-resizing-back";const x=t.toolbarContainer;return x&&x.appendChild(o.element),r.appendChild(g),h&&r.appendChild(h),x||l.appendChild(o.element),l.appendChild(a),l.appendChild(r),l.appendChild(w),l.appendChild(b),l.appendChild(v),l.appendChild(y),l.appendChild(C),p&&l.appendChild(p),i.appendChild(l),g=this._checkCodeMirror(t,g),{constructed:{_top:i,_relative:l,_toolBar:o.element,_menuTray:o._menuTray,_editorArea:r,_wysiwygArea:u,_codeArea:g,_placeholder:h,_resizingBar:p,_navigation:m,_charWrapper:f,_charCounter:_,_loading:b,_lineBreaker:v,_lineBreaker_t:y,_lineBreaker_b:C,_resizeBack:w,_stickyDummy:a,_arrow:s},options:t,plugins:o.plugins,pluginCallButtons:o.pluginCallButtons,_responsiveButtons:o.responsiveButtons}},_checkCodeMirror:function(e,t){if(e.codeMirror){const n=[{mode:"htmlmixed",htmlMode:!0,lineNumbers:!0,lineWrapping:!0},e.codeMirror.options||{}].reduce((function(e,t){for(let n in t)L.hasOwn(t,n)&&(e[n]=t[n]);return e}),{});"auto"===e.height&&(n.viewportMargin=1/0,n.height="auto");const i=e.codeMirror.src.fromTextArea(t,n);i.display.wrapper.style.cssText=t.style.cssText,e.codeMirrorEditor=i,(t=i.display.wrapper).className+=" se-wrapper-code-mirror"}return t},_checkKatexMath:function(e){if(!e)throw Error('[SUNEDITOR.create.fail] To use the math button you need to add a "katex" object to the options.');const t=[{throwOnError:!1},e.options||{}].reduce((function(e,t){for(let n in t)L.hasOwn(t,n)&&(e[n]=t[n]);return e}),{});e.options=t},_setOptions:function(e,t,n,i){this._initOptions(t.element.originElement,e);const l=t.element,o=l.relative,s=l.editorArea,a=e.toolbarContainer&&e.toolbarContainer!==i.toolbarContainer,r=!!e.buttonList||e.mode!==i.mode||a,c=!!e.plugins,d=this._createToolBar(document,r?e.buttonList:i.buttonList,c?e.plugins:n,e);d.pluginCallButtons.math&&this._checkKatexMath(e.katex);const u=document.createElement("DIV");u.className="se-arrow",r&&(d.element.style.visibility="hidden",a?(e.toolbarContainer.appendChild(d.element),l.toolbar.parentElement.removeChild(l.toolbar)):l.toolbar.parentElement.replaceChild(d.element,l.toolbar),l.toolbar=d.element,l._menuTray=d._menuTray,l._arrow=u);const h=this._initElements(e,l.topArea,r?d.element:l.toolbar,u),g=h.bottomBar,p=h.wysiwygFrame,m=h.placeholder;let f=h.codeView;return l.resizingBar&&o.removeChild(l.resizingBar),g.resizingBar&&o.appendChild(g.resizingBar),s.innerHTML="",s.appendChild(f),m&&s.appendChild(m),f=this._checkCodeMirror(e,f),l.resizingBar=g.resizingBar,l.navigation=g.navigation,l.charWrapper=g.charWrapper,l.charCounter=g.charCounter,l.wysiwygFrame=p,l.code=f,l.placeholder=m,{callButtons:r?d.pluginCallButtons:null,plugins:r||c?d.plugins:null,toolbar:d}},_initElements:function(e,t,n,i){t.style.cssText=e._editorStyles.top,/inline/i.test(e.mode)?(n.className+=" se-toolbar-inline",n.style.width=e.toolbarWidth):/balloon/i.test(e.mode)&&(n.className+=" se-toolbar-balloon",n.style.width=e.toolbarWidth,n.appendChild(i));const l=document.createElement(e.iframe?"IFRAME":"DIV");l.className="se-wrapper-inner se-wrapper-wysiwyg",e.iframe?(l.allowFullscreen=!0,l.frameBorder=0,l.style.cssText=e._editorStyles.frame):(l.setAttribute("contenteditable",!0),l.setAttribute("scrolling","auto"),l.className+=" sun-editor-editable",l.style.cssText=e._editorStyles.frame+e._editorStyles.editor);const o=document.createElement("TEXTAREA");o.className="se-wrapper-inner se-wrapper-code",o.style.cssText=e._editorStyles.frame,o.style.display="none","auto"===e.height&&(o.style.overflow="hidden");let s=null,a=null,r=null,c=null;if(e.resizingBar&&(s=document.createElement("DIV"),s.className="se-resizing-bar sun-editor-common",a=document.createElement("DIV"),a.className="se-navigation sun-editor-common",s.appendChild(a),e.charCounter)){if(r=document.createElement("DIV"),r.className="se-char-counter-wrapper",e.charCounterLabel){const t=document.createElement("SPAN");t.className="se-char-label",t.textContent=e.charCounterLabel,r.appendChild(t)}if(c=document.createElement("SPAN"),c.className="se-char-counter",c.textContent="0",r.appendChild(c),e.maxCharCount>0){const t=document.createElement("SPAN");t.textContent=" / "+e.maxCharCount,r.appendChild(t)}s.appendChild(r)}let d=null;return e.placeholder&&(d=document.createElement("SPAN"),d.className="se-placeholder",d.innerText=e.placeholder),{bottomBar:{resizingBar:s,navigation:a,charWrapper:r,charCounter:c},wysiwygFrame:l,codeView:o,placeholder:d}},_initOptions:function(e,t){t.lang=t.lang||N.a,t.value="string"==typeof t.value?t.value:null,t.historyStackDelayTime="number"==typeof t.historyStackDelayTime?t.historyStackDelayTime:400,t._defaultTagsWhitelist="string"==typeof t._defaultTagsWhitelist?t._defaultTagsWhitelist:"br|p|div|pre|blockquote|h[1-6]|ol|ul|li|hr|figure|figcaption|img|iframe|audio|video|source|table|thead|tbody|tr|th|td|a|b|strong|var|i|em|u|ins|s|span|strike|del|sub|sup|code",t._editorTagsWhitelist=t._defaultTagsWhitelist+("string"==typeof t.addTagsWhitelist&&t.addTagsWhitelist.length>0?"|"+t.addTagsWhitelist:""),t.pasteTagsWhitelist="string"==typeof t.pasteTagsWhitelist?t.pasteTagsWhitelist:t._editorTagsWhitelist,t.attributesWhitelist=t.attributesWhitelist&&"object"==typeof t.attributesWhitelist?t.attributesWhitelist:null,t.mode=t.mode||"classic",t.toolbarWidth=t.toolbarWidth?L.isNumber(t.toolbarWidth)?t.toolbarWidth+"px":t.toolbarWidth:"auto",t.toolbarContainer=/balloon/i.test(t.mode)?null:"string"==typeof t.toolbarContainer?document.querySelector(t.toolbarContainer):t.toolbarContainer,t.stickyToolbar=/balloon/i.test(t.mode)||t.toolbarContainer?-1:void 0===t.stickyToolbar?0:/^\d+/.test(t.stickyToolbar)?L.getNumber(t.stickyToolbar,0):-1,t.fullPage=!!t.fullPage,t.iframe=t.fullPage||t.iframe,t.iframeCSSFileName=t.iframe?"string"==typeof t.iframeCSSFileName?[t.iframeCSSFileName]:t.iframeCSSFileName||["suneditor"]:null,t.codeMirror=t.codeMirror?t.codeMirror.src?t.codeMirror:{src:t.codeMirror}:null,t.position="string"==typeof t.position?t.position:null,t.display=t.display||("none"!==e.style.display&&e.style.display?e.style.display:"block"),t.popupDisplay=t.popupDisplay||"full",t.resizingBar=void 0===t.resizingBar?!/inline|balloon/i.test(t.mode):t.resizingBar,t.showPathLabel=!!t.resizingBar&&("boolean"!=typeof t.showPathLabel||t.showPathLabel),t.charCounter=t.maxCharCount>0||"boolean"==typeof t.charCounter&&t.charCounter,t.charCounterType="string"==typeof t.charCounterType?t.charCounterType:"char",t.charCounterLabel="string"==typeof t.charCounterLabel?t.charCounterLabel.trim():null,t.maxCharCount=L.isNumber(t.maxCharCount)&&t.maxCharCount>-1?1*t.maxCharCount:null,t.width=t.width?L.isNumber(t.width)?t.width+"px":t.width:e.clientWidth?e.clientWidth+"px":"100%",t.minWidth=(L.isNumber(t.minWidth)?t.minWidth+"px":t.minWidth)||"",t.maxWidth=(L.isNumber(t.maxWidth)?t.maxWidth+"px":t.maxWidth)||"",t.height=t.height?L.isNumber(t.height)?t.height+"px":t.height:e.clientHeight?e.clientHeight+"px":"auto",t.minHeight=(L.isNumber(t.minHeight)?t.minHeight+"px":t.minHeight)||"",t.maxHeight=(L.isNumber(t.maxHeight)?t.maxHeight+"px":t.maxHeight)||"",t.defaultStyle="string"==typeof t.defaultStyle?t.defaultStyle:"",t.font=t.font?t.font:null,t.fontSize=t.fontSize?t.fontSize:null,t.formats=t.formats?t.formats:null,t.colorList=t.colorList?t.colorList:null,t.lineHeights=t.lineHeights?t.lineHeights:null,t.paragraphStyles=t.paragraphStyles?t.paragraphStyles:null,t.textStyles=t.textStyles?t.textStyles:null,t.fontSizeUnit="string"==typeof t.fontSizeUnit&&t.fontSizeUnit.trim()||"px",t.imageResizing=void 0===t.imageResizing||t.imageResizing,t.imageHeightShow=void 0===t.imageHeightShow||!!t.imageHeightShow,t.imageWidth=t.imageWidth?L.isNumber(t.imageWidth)?t.imageWidth+"px":t.imageWidth:"auto",t.imageHeight=t.imageHeight?L.isNumber(t.imageHeight)?t.imageHeight+"px":t.imageHeight:"auto",t.imageSizeOnlyPercentage=!!t.imageSizeOnlyPercentage,t._imageSizeUnit=t.imageSizeOnlyPercentage?"%":"px",t.imageRotation=void 0!==t.imageRotation?t.imageRotation:!(t.imageSizeOnlyPercentage||!t.imageHeightShow),t.imageFileInput=void 0===t.imageFileInput||t.imageFileInput,t.imageUrlInput=void 0===t.imageUrlInput||!t.imageFileInput||t.imageUrlInput,t.imageUploadHeader=t.imageUploadHeader||null,t.imageUploadUrl="string"==typeof t.imageUploadUrl?t.imageUploadUrl:null,t.imageUploadSizeLimit=/\d+/.test(t.imageUploadSizeLimit)?L.getNumber(t.imageUploadSizeLimit,0):null,t.imageMultipleFile=!!t.imageMultipleFile,t.imageAccept="string"!=typeof t.imageAccept||"*"===t.imageAccept.trim()?"image/*":t.imageAccept.trim()||"image/*",t.imageGalleryUrl="string"==typeof t.imageGalleryUrl?t.imageGalleryUrl:null,t.videoResizing=void 0===t.videoResizing||t.videoResizing,t.videoHeightShow=void 0===t.videoHeightShow||!!t.videoHeightShow,t.videoRatioShow=void 0===t.videoRatioShow||!!t.videoRatioShow,t.videoWidth=t.videoWidth&&L.getNumber(t.videoWidth,0)?L.isNumber(t.videoWidth)?t.videoWidth+"px":t.videoWidth:"",t.videoHeight=t.videoHeight&&L.getNumber(t.videoHeight,0)?L.isNumber(t.videoHeight)?t.videoHeight+"px":t.videoHeight:"",t.videoSizeOnlyPercentage=!!t.videoSizeOnlyPercentage,t._videoSizeUnit=t.videoSizeOnlyPercentage?"%":"px",t.videoRotation=void 0!==t.videoRotation?t.videoRotation:!(t.videoSizeOnlyPercentage||!t.videoHeightShow),t.videoRatio=L.getNumber(t.videoRatio,4)||.5625,t.videoRatioList=t.videoRatioList?t.videoRatioList:null,t.youtubeQuery=(t.youtubeQuery||"").replace("?",""),t.videoFileInput=!!t.videoFileInput,t.videoUrlInput=void 0===t.videoUrlInput||!t.videoFileInput||t.videoUrlInput,t.videoUploadHeader=t.videoUploadHeader||null,t.videoUploadUrl="string"==typeof t.videoUploadUrl?t.videoUploadUrl:null,t.videoUploadSizeLimit=/\d+/.test(t.videoUploadSizeLimit)?L.getNumber(t.videoUploadSizeLimit,0):null,t.videoMultipleFile=!!t.videoMultipleFile,t.videoTagAttrs=t.videoTagAttrs||null,t.videoIframeAttrs=t.videoIframeAttrs||null,t.videoAccept="string"!=typeof t.videoAccept||"*"===t.videoAccept.trim()?"video/*":t.videoAccept.trim()||"video/*",t.audioWidth=t.audioWidth?L.isNumber(t.audioWidth)?t.audioWidth+"px":t.audioWidth:"",t.audioHeight=t.audioHeight?L.isNumber(t.audioHeight)?t.audioHeight+"px":t.audioHeight:"",t.audioFileInput=!!t.audioFileInput,t.audioUrlInput=void 0===t.audioUrlInput||!t.audioFileInput||t.audioUrlInput,t.audioUploadHeader=t.audioUploadHeader||null,t.audioUploadUrl="string"==typeof t.audioUploadUrl?t.audioUploadUrl:null,t.audioUploadSizeLimit=/\d+/.test(t.audioUploadSizeLimit)?L.getNumber(t.audioUploadSizeLimit,0):null,t.audioMultipleFile=!!t.audioMultipleFile,t.audioTagAttrs=t.audioTagAttrs||null,t.audioAccept="string"!=typeof t.audioAccept||"*"===t.audioAccept.trim()?"audio/*":t.audioAccept.trim()||"audio/*",t.tableCellControllerPosition="string"==typeof t.tableCellControllerPosition?t.tableCellControllerPosition.toLowerCase():"cell",t.tabDisable=!!t.tabDisable,t.shortcutsDisable=Array.isArray(t.shortcutsDisable)&&t.shortcutsDisable.length>0?t.shortcutsDisable.map((function(e){return e.toLowerCase()})):[],t.shortcutsHint=void 0===t.shortcutsHint||!!t.shortcutsHint,t.callBackSave=t.callBackSave?t.callBackSave:null,t.templates=t.templates?t.templates:null,t.placeholder="string"==typeof t.placeholder?t.placeholder:null,t.linkProtocol="string"==typeof t.linkProtocol?t.linkProtocol:null,t.katex=t.katex?t.katex.src?t.katex:{src:t.katex}:null,t.buttonList=t.buttonList||[["undo","redo"],["bold","underline","italic","strike","subscript","superscript"],["removeFormat"],["outdent","indent"],["fullScreen","showBlocks","codeView"],["preview","print"]],t.icons=t.icons&&"object"==typeof t.icons?[E,t.icons].reduce((function(e,t){for(let n in t)L.hasOwn(t,n)&&(e[n]=t[n]);return e}),{}):E,t._editorStyles=L._setDefaultOptionStyle(t,t.defaultStyle)},_defaultButtons:function(e){const t=e.icons,n=e.lang,i=L.isOSX_IOS?"⌘":"CTRL",l=e.shortcutsHint?e.shortcutsDisable:["bold","strike","underline","italic","undo","indent"];return{bold:["_se_command_bold",n.toolbar.bold+(l.indexOf("bold")>-1?"":" ("+i+"+B)"),"STRONG","",t.bold],underline:["_se_command_underline",n.toolbar.underline+(l.indexOf("underline")>-1?"":" ("+i+"+U)"),"U","",t.underline],italic:["_se_command_italic",n.toolbar.italic+(l.indexOf("italic")>-1?"":" ("+i+"+I)"),"EM","",t.italic],strike:["_se_command_strike",n.toolbar.strike+(l.indexOf("strike")>-1?"":" ("+i+"+SHIFT+S)"),"DEL","",t.strike],subscript:["_se_command_subscript",n.toolbar.subscript,"SUB","",t.subscript],superscript:["_se_command_superscript",n.toolbar.superscript,"SUP","",t.superscript],removeFormat:["",n.toolbar.removeFormat,"removeFormat","",t.erase],indent:["_se_command_indent",n.toolbar.indent+(l.indexOf("indent")>-1?"":" ("+i+"+])"),"indent","",t.outdent],outdent:["_se_command_outdent",n.toolbar.outdent+(l.indexOf("indent")>-1?"":" ("+i+"+[)"),"outdent","",t.indent],fullScreen:["se-code-view-enabled se-resizing-enabled _se_command_fullScreen",n.toolbar.fullScreen,"fullScreen","",t.expansion],showBlocks:["_se_command_showBlocks",n.toolbar.showBlocks,"showBlocks","",t.show_blocks],codeView:["se-code-view-enabled se-resizing-enabled _se_command_codeView",n.toolbar.codeView,"codeView","",t.code_view],undo:["_se_command_undo se-resizing-enabled",n.toolbar.undo+(l.indexOf("undo")>-1?"":" ("+i+"+Z)"),"undo","",t.undo],redo:["_se_command_redo se-resizing-enabled",n.toolbar.redo+(l.indexOf("undo")>-1?"":" ("+i+"+Y / "+i+"+SHIFT+Z)"),"redo","",t.redo],preview:["se-resizing-enabled",n.toolbar.preview,"preview","",t.preview],print:["se-resizing-enabled",n.toolbar.print,"print","",t.print],save:["_se_command_save se-resizing-enabled",n.toolbar.save,"save","",t.save],blockquote:["",n.toolbar.tag_blockquote,"blockquote","command",t.blockquote],font:["se-btn-select se-btn-tool-font",n.toolbar.font,"font","submenu",''+n.toolbar.font+""+t.arrow_down],formatBlock:["se-btn-select se-btn-tool-format",n.toolbar.formats,"formatBlock","submenu",''+n.toolbar.formats+""+t.arrow_down],fontSize:["se-btn-select se-btn-tool-size",n.toolbar.fontSize,"fontSize","submenu",''+n.toolbar.fontSize+""+t.arrow_down],fontColor:["",n.toolbar.fontColor,"fontColor","submenu",t.font_color],hiliteColor:["",n.toolbar.hiliteColor,"hiliteColor","submenu",t.highlight_color],align:["se-btn-align",n.toolbar.align,"align","submenu",t.align_left],list:["",n.toolbar.list,"list","submenu",t.list_number],horizontalRule:["btn_line",n.toolbar.horizontalRule,"horizontalRule","submenu",t.horizontal_rule],table:["",n.toolbar.table,"table","submenu",t.table],lineHeight:["",n.toolbar.lineHeight,"lineHeight","submenu",t.line_height],template:["",n.toolbar.template,"template","submenu",t.template],paragraphStyle:["",n.toolbar.paragraphStyle,"paragraphStyle","submenu",t.paragraph_style],textStyle:["",n.toolbar.textStyle,"textStyle","submenu",t.text_style],link:["",n.toolbar.link,"link","dialog",t.link],image:["",n.toolbar.image,"image","dialog",t.image],video:["",n.toolbar.video,"video","dialog",t.video],audio:["",n.toolbar.audio,"audio","dialog",t.audio],math:["",n.toolbar.math,"math","dialog",t.math],imageGallery:["",n.toolbar.imageGallery,"imageGallery","fileBrowser",t.image_gallery]}},_createModuleGroup:function(){const e=L.createElement("DIV");e.className="se-btn-module se-btn-module-border";const t=L.createElement("UL");return t.className="se-menu-list",e.appendChild(t),{div:e,ul:t}},_createButton:function(e,t,n,i,l,o,s){const a=L.createElement("LI"),r=L.createElement("BUTTON");return r.setAttribute("type","button"),r.setAttribute("class","se-btn"+(e?" "+e:"")+" se-tooltip"),r.setAttribute("data-command",n),r.setAttribute("data-display",i),r.setAttribute("tabindex","-1"),l||(l='!'),/^default\./i.test(l)&&(l=s[l.replace(/^default\./i,"")]),/^text\./i.test(l)&&(l=l.replace(/^text\./i,""),r.className+=" se-btn-more-text"),l+=''+(t||n)+"",o&&r.setAttribute("disabled",!0),r.innerHTML=l,a.appendChild(r),{li:a,button:r}},_createToolBar:function(e,t,n,i){const l=e.createElement("DIV");l.className="se-toolbar-separator-vertical";const o=e.createElement("DIV");o.className="se-toolbar sun-editor-common";const s=e.createElement("DIV");s.className="se-btn-tray",o.appendChild(s);const a=i.icons,r=this._defaultButtons(i),c={},d=[],u={};if(n){const e=n.length?n:Object.keys(n).map((function(e){return n[e]}));for(let t,n=0,i=e.length;n",b.appendChild(i),i=i.firstElementChild.firstElementChild)}if(_){const e=l.cloneNode(!1);y&&(e.style.float=y),s.appendChild(e)}s.appendChild(p.div),_=!0}else if(/^\/$/.test(v)){const t=e.createElement("DIV");t.className="se-btn-module-enter",s.appendChild(t),_=!1}1===s.children.length&&L.removeClass(s.firstElementChild,"se-btn-module-border"),d.length>0&&d.unshift(t),b.children.length>0&&s.appendChild(b);const v=e.createElement("DIV");v.className="se-menu-tray",o.appendChild(v);const y=e.createElement("DIV");return y.className="se-toolbar-cover",o.appendChild(y),{element:o,plugins:u,pluginCallButtons:c,responsiveButtons:d,_menuTray:v,_buttonTray:s}}};var A=function(e,t,n){return{element:{originElement:e,topArea:t._top,relative:t._relative,toolbar:t._toolBar,_buttonTray:t._toolBar.querySelector(".se-btn-tray"),_menuTray:t._menuTray,resizingBar:t._resizingBar,navigation:t._navigation,charWrapper:t._charWrapper,charCounter:t._charCounter,editorArea:t._editorArea,wysiwygFrame:t._wysiwygArea,wysiwyg:t._wysiwygArea,code:t._codeArea,placeholder:t._placeholder,loading:t._loading,lineBreaker:t._lineBreaker,lineBreaker_t:t._lineBreaker_t,lineBreaker_b:t._lineBreaker_b,resizeBackground:t._resizeBack,_stickyDummy:t._stickyDummy,_arrow:t._arrow},tool:{cover:t._toolBar.querySelector(".se-toolbar-cover"),bold:t._toolBar.querySelector("._se_command_bold"),underline:t._toolBar.querySelector("._se_command_underline"),italic:t._toolBar.querySelector("._se_command_italic"),strike:t._toolBar.querySelector("._se_command_strike"),subscript:t._toolBar.querySelector("._se_command_subscript"),superscript:t._toolBar.querySelector("._se_command_superscript"),undo:t._toolBar.querySelector("._se_command_undo"),redo:t._toolBar.querySelector("._se_command_redo"),save:t._toolBar.querySelector("._se_command_save"),outdent:t._toolBar.querySelector("._se_command_outdent"),indent:t._toolBar.querySelector("._se_command_indent"),fullScreen:t._toolBar.querySelector("._se_command_fullScreen"),showBlocks:t._toolBar.querySelector("._se_command_showBlocks"),codeView:t._toolBar.querySelector("._se_command_codeView")},options:n,option:n}},B={name:"notice",add:function(e){const t=e.context;t.notice={};let n=e.util.createElement("DIV"),i=e.util.createElement("SPAN"),l=e.util.createElement("BUTTON");n.className="se-notice",l.className="close",l.setAttribute("aria-label","Close"),l.setAttribute("title",e.lang.dialogBox.close),l.innerHTML=e.icons.cancel,n.appendChild(i),n.appendChild(l),t.notice.modal=n,t.notice.message=i,l.addEventListener("click",this.onClick_cancel.bind(e)),t.element.editorArea.appendChild(n),n=null},onClick_cancel:function(e){e.preventDefault(),e.stopPropagation(),this.plugins.notice.close.call(this)},open:function(e){this.context.notice.message.textContent=e,this.context.notice.modal.style.display="block"},close:function(){this.context.notice.modal.style.display="none"}},z={init:function(e){return{create:function(t,n){return this.create(t,n,e)}.bind(this)}},create:function(e,t,n){L._propertiesInit(),"object"!=typeof t&&(t={}),n&&(t=[n,t].reduce((function(e,t){for(let n in t)if(L.hasOwn(t,n))if("plugins"===n&&t[n]&&e[n]){let i=e[n],l=t[n];i=i.length?i:Object.keys(i).map((function(e){return i[e]})),l=l.length?l:Object.keys(l).map((function(e){return l[e]})),e[n]=l.filter((function(e){return-1===i.indexOf(e)})).concat(i)}else e[n]=t[n];return e}),{}));const i="string"==typeof e?document.getElementById(e):e;if(!i){if("string"==typeof e)throw Error('[SUNEDITOR.create.fail] The element for that id was not found (ID:"'+e+'")');throw Error("[SUNEDITOR.create.fail] suneditor requires textarea's element or id value")}const l=k.init(i,t);if(l.constructed._top.id&&document.getElementById(l.constructed._top.id))throw Error('[SUNEDITOR.create.fail] The ID of the suneditor you are trying to create already exists (ID:"'+l.constructed._top.id+'")');return function(e,t,n,i,l,o){const s=e.element.originElement.ownerDocument||document,a=s.defaultView||window,r=L,c=l.icons,d={_d:s,_w:a,_parser:new a.DOMParser,_wd:null,_ww:null,_shadowRoot:null,util:r,functions:null,notice:B,icons:c,history:null,context:e,pluginCallButtons:t,plugins:n||{},initPlugins:{},_targetPlugins:{},_menuTray:{},lang:i,effectNode:null,submenu:null,container:null,_submenuName:"",_bindedSubmenuOff:null,_bindedContainerOff:null,submenuActiveButton:null,containerActiveButton:null,controllerArray:[],currentControllerName:"",currentControllerTarget:null,currentFileComponentInfo:null,codeViewDisabledButtons:null,resizingDisabledButtons:null,_moreLayerActiveButton:null,_htmlCheckWhitelistRegExp:null,_disallowedTextTagsRegExp:null,editorTagsWhitelistRegExp:null,pasteTagsWhitelistRegExp:null,hasFocus:!1,isDisabled:!1,_attributesWhitelistRegExp:null,_attributesTagsWhitelist:null,_bindControllersOff:null,_isInline:null,_isBalloon:null,_isBalloonAlways:null,_inlineToolbarAttr:{top:"",width:"",isShow:!1},_notHideToolbar:!1,_sticky:!1,_antiBlur:!1,_lineBreaker:null,_lineBreakerButton:null,_componentsInfoInit:!0,_componentsInfoReset:!1,activePlugins:null,managedTagsInfo:null,_charTypeHTML:!1,_fileInfoPluginsCheck:null,_fileInfoPluginsReset:null,_fileManager:{tags:null,regExp:null,queryString:null,pluginRegExp:null,pluginMap:null},commandMap:null,_styleCommandMap:null,_defaultCommand:{bold:"STRONG",underline:"U",italic:"EM",strike:"DEL",subscript:"SUB",superscript:"SUP"},_variable:{isCodeView:!1,isFullScreen:!1,innerHeight_fullScreen:0,resizeClientY:0,tabSize:4,codeIndent:4,minResizingSize:r.getNumber(e.element.wysiwygFrame.style.minHeight||"65",0),currentNodes:[],currentNodesMap:[],_range:null,_selectionNode:null,_originCssText:e.element.topArea.style.cssText,_bodyOverflow:"",_editorAreaOriginCssText:"",_wysiwygOriginCssText:"",_codeOriginCssText:"",_fullScreenAttrs:{sticky:!1,balloon:!1,inline:!1},_lineBreakComp:null,_lineBreakDir:""},callPlugin:function(e,n,i){if(i=i||t[e],!this.plugins[e])throw Error('[SUNEDITOR.core.callPlugin.fail] The called plugin does not exist or is in an invalid format. (pluginName:"'+e+'")');this.initPlugins[e]?"object"==typeof this._targetPlugins[e]&&i&&this.initMenuTarget(e,i,this._targetPlugins[e]):(this.plugins[e].add(this,i),this.initPlugins[e]=!0),this.plugins[e].active&&!this.commandMap[e]&&i&&(this.commandMap[e]=i,this.activePlugins.push(e)),"function"==typeof n&&n()},addModule:function(e){for(let t,n=0,i=e.length;nb?(n.style.height=l+"px",e=-1*(l-g+3)):(n.style.height=b+"px",e=g+t.parentElement.offsetHeight),n.style.top=e+"px"}else n.style.top=g+t.parentElement.offsetHeight+"px";n.style.visibility=""},controllersOn:function(){this._bindControllersOff&&this._bindControllersOff(),this.controllerArray=[];for(let e,t=0;t0){for(let e=0;e":n),this.history.push(!0)},nativeFocus:function(){const t=r.getParentElement(this.getSelectionNode(),"figcaption");t?t.focus():e.element.wysiwyg.focus(),this._editorRange()},focus:function(){if("none"!==e.element.wysiwygFrame.style.display){if(l.iframe)this.nativeFocus();else try{const t=this.getRange();if(t.startContainer===t.endContainer&&r.isWysiwygDiv(t.startContainer)){const t=r.createElement("P"),n=r.createElement("BR");t.appendChild(n),e.element.wysiwyg.appendChild(t),this.setRange(n,0,n,0)}else this.setRange(t.startContainer,t.startOffset,t.endContainer,t.endOffset)}catch(e){this.nativeFocus()}u._applyTagEffects(),this._isBalloon&&u._toggleToolbarBalloon()}},focusEdge:function(t){t||(t=e.element.wysiwyg.lastElementChild);const n=this.getFileComponent(t);n?this.selectComponent(n.target,n.pluginName):t?(t=r.getChildElement(t,(function(e){return 0===e.childNodes.length||3===e.nodeType}),!0))?this.setRange(t,t.textContent.length,t,t.textContent.length):this.nativeFocus():this.focus()},setRange:function(e,t,n,i){if(!e||!n)return;t>e.textContent.length&&(t=e.textContent.length),i>n.textContent.length&&(i=n.textContent.length);const o=this._wd.createRange();try{o.setStart(e,t),o.setEnd(n,i)}catch(e){return console.warn("[SUNEDITOR.core.focus.error] "+e),void this.nativeFocus()}const s=this.getSelection();return s.removeAllRanges&&s.removeAllRanges(),s.addRange(o),this._editorRange(),l.iframe&&this.nativeFocus(),o},removeRange:function(){this._variable._range=null,this._variable._selectionNode=null,this.getSelection().removeAllRanges();const e=this.commandMap,t=this.activePlugins;for(let i in e)r.hasOwn(e,i)&&(t.indexOf(i)>-1?n[i].active.call(this,null):e.OUTDENT&&/^OUTDENT$/i.test(i)?e.OUTDENT.setAttribute("disabled",!0):e.INDENT&&/^INDENT$/i.test(i)?e.INDENT.removeAttribute("disabled"):r.removeClass(e[i],"active"))},getRange:function(){const t=this._variable._range||this._createDefaultRange(),n=this.getSelection();if(t.collapsed===n.isCollapsed||!e.element.wysiwyg.contains(n.focusNode))return t;if(n.rangeCount>0)return this._variable._range=n.getRangeAt(0),this._variable._range;{const e=n.anchorNode,t=n.focusNode,i=n.anchorOffset,l=n.focusOffset,o=r.compareElements(e,t),s=o.ancestor&&(0===o.result?i<=l:o.result>1);return this.setRange(s?e:t,s?i:l,s?t:e,s?l:i)}},getRange_addLine:function(t){if(this._selectionVoid(t)){const n=e.element.wysiwyg,i=r.createElement("P");i.innerHTML="
    ",n.insertBefore(i,n.firstElementChild),this.setRange(i.firstElementChild,0,i.firstElementChild,1),t=this._variable._range}return t},getSelection:function(){return this._shadowRoot&&this._shadowRoot.getSelection?this._shadowRoot.getSelection():this._ww.getSelection()},getSelectionNode:function(){if(r.isWysiwygDiv(this._variable._selectionNode)&&this._editorRange(),!this._variable._selectionNode){const t=r.getChildElement(e.element.wysiwyg.firstChild,(function(e){return 0===e.childNodes.length||3===e.nodeType}),!1);if(t)return this._variable._selectionNode=t,t;this._editorRange()}return this._variable._selectionNode},_editorRange:function(){const e=this.getSelection();if(!e)return null;let t=null,n=null;t=e.rangeCount>0?e.getRangeAt(0):this._createDefaultRange(),this._variable._range=t,n=t.collapsed?t.commonAncestorContainer:e.extentNode||e.anchorNode,this._variable._selectionNode=n},_createDefaultRange:function(){const t=e.element.wysiwyg;t.focus();const n=this._wd.createRange();let i=t.firstElementChild;return i||(i=r.createElement("P"),i.innerHTML="
    ",t.appendChild(i)),n.setStart(i,0),n.setEnd(i,0),n},_selectionVoid:function(e){const t=e.commonAncestorContainer;return r.isWysiwygDiv(e.startContainer)&&r.isWysiwygDiv(e.endContainer)||/FIGURE/i.test(t.nodeName)||this._fileManager.regExp.test(t.nodeName)||r.isMediaComponent(t)},_resetRangeToTextNode:function(){const t=this.getRange();if(this._selectionVoid(t))return!1;let n,i,l,o=t.startContainer,s=t.startOffset,a=t.endContainer,c=t.endOffset;if(r.isFormatElement(o)&&(o=o.childNodes[s]||o.lastChild,s=o.textContent.length),r.isFormatElement(a)&&(a=a.childNodes[c]||a.lastChild,c=a.textContent.length),n=r.isWysiwygDiv(o)?e.element.wysiwyg.firstChild:o,i=s,r.isBreak(n)||1===n.nodeType&&n.childNodes.length>0){const e=r.isBreak(n);if(!e){for(;n&&!r.isBreak(n)&&1===n.nodeType;)n=n.childNodes[i]||n.nextElementSibling||n.nextSibling,i=0;let e=r.getFormatElement(n,null);e===r.getRangeFormatElement(e,null)&&(e=r.createElement(r.getParentElement(n,r.isCell)?"DIV":"P"),n.parentNode.insertBefore(e,n),e.appendChild(n))}if(r.isBreak(n)){const t=r.createTextNode(r.zeroWidthSpace);n.parentNode.insertBefore(t,n),n=t,e&&o===a&&(a=n,c=1)}}if(o=n,s=i,n=r.isWysiwygDiv(a)?e.element.wysiwyg.lastChild:a,i=c,r.isBreak(n)||1===n.nodeType&&n.childNodes.length>0){const e=r.isBreak(n);if(!e){for(;n&&!r.isBreak(n)&&1===n.nodeType&&(l=n.childNodes,0!==l.length);)n=l[i>0?i-1:i]||!/FIGURE/i.test(l[0].nodeName)?l[0]:n.previousElementSibling||n.previousSibling||o,i=i>0?n.textContent.length:i;let e=r.getFormatElement(n,null);e===r.getRangeFormatElement(e,null)&&(e=r.createElement(r.isCell(e)?"DIV":"P"),n.parentNode.insertBefore(e,n),e.appendChild(n))}if(r.isBreak(n)){const t=r.createTextNode(r.zeroWidthSpace);n.parentNode.insertBefore(t,n),n=t,i=1,e&&!n.previousSibling&&r.removeItem(a)}}return a=n,c=i,this.setRange(o,s,a,c),!0},getSelectedElements:function(t){if(!this._resetRangeToTextNode())return[];let n=this.getRange();if(r.isWysiwygDiv(n.startContainer)){const t=e.element.wysiwyg.children;if(0===t.length)return[];this.setRange(t[0],0,t[t.length-1],t[t.length-1].textContent.trim().length),n=this.getRange()}const i=n.startContainer,l=n.endContainer,o=n.commonAncestorContainer,s=r.getListChildren(o,(function(e){return t?t(e):r.isFormatElement(e)}));if(r.isWysiwygDiv(o)||r.isRangeFormatElement(o)||s.unshift(r.getFormatElement(o,null)),i===l||1===s.length)return s;let a=r.getFormatElement(i,null),c=r.getFormatElement(l,null),d=null,u=null;const h=function(e){return!r.isTable(e)||/^TABLE$/i.test(e.nodeName)};let g=r.getRangeFormatElement(a,h),p=r.getRangeFormatElement(c,h);r.isTable(g)&&r.isListCell(g.parentNode)&&(g=g.parentNode),r.isTable(p)&&r.isListCell(p.parentNode)&&(p=p.parentNode);const m=g===p;for(let e,t=0,n=s.length;t=0;n--)if(i[n].contains(i[e])){i.splice(e,1),e--,t--;break}return i},isEdgePoint:function(e,t){return 0===t||!e.nodeValue&&1===t||t===e.nodeValue.length},showLoading:function(){e.element.loading.style.display="block"},closeLoading:function(){e.element.loading.style.display="none"},appendFormatTag:function(e,t){const n=r.getFormatElement(this.getSelectionNode(),null),i=t?"string"==typeof t?t:t.nodeName:r.isFormatElement(n)&&!r.isFreeFormatElement(n)?n.nodeName:"P",l=r.createElement(i);return l.innerHTML="
    ",(t&&"string"!=typeof t||!t&&r.isFormatElement(n))&&r.copyTagAttributes(l,t||n),r.isCell(e)?e.insertBefore(l,e.nextElementSibling):e.parentNode.insertBefore(l,e.nextElementSibling),l},insertComponent:function(e,t,n,i){if(n&&!this.checkCharCount(e,null))return null;const l=this.removeNode();this.getRange_addLine(this.getRange());let o=null,s=this.getSelectionNode(),a=r.getFormatElement(s,null);if(r.isListCell(a))this.insertNode(e,s===a?null:l.container.nextSibling,!1),e.nextSibling||e.parentNode.appendChild(r.createElement("BR"));else{if(this.getRange().collapsed&&(3===l.container.nodeType||r.isBreak(l.container))){const e=r.getParentElement(l.container,function(e){return this.isRangeFormatElement(e)}.bind(r));o=r.splitElement(l.container,l.offset,e?r.getElementDepth(e)+1:0),o&&(a=o.previousSibling)}this.insertNode(e,a,!1),a&&r.onlyZeroWidthSpace(a)&&r.removeItem(a)}if(!i){const t=this.getFileComponent(e);t?this.selectComponent(t.target,t.pluginName):o&&(o=r.getEdgeChildNodes(o,null).sc||o,this.setRange(o,0,o,0))}return t||this.history.push(1),o||e},getFileComponent:function(e){if(!this._fileManager.queryString||!e)return null;let t,n;return(/^FIGURE$/i.test(e.nodeName)||/se-component/.test(e.className))&&(t=e.querySelector(this._fileManager.queryString)),!t&&e.nodeName&&this._fileManager.regExp.test(e.nodeName)&&(t=e),t&&(n=this._fileManager.pluginMap[t.nodeName.toLowerCase()],n)?{target:t,component:r.getParentElement(t,r.isComponent),pluginName:n}:null},selectComponent:function(e,t){this.hasFocus||this.focus();const n=this.plugins[t];n&&a.setTimeout(function(){"function"==typeof n.select&&this.callPlugin(t,n.select.bind(this,e),null),this._setComponentLineBreaker(e)}.bind(this))},_setComponentLineBreaker:function(t){this._lineBreaker.style.display="none";const n=r.getParentElement(t,r.isComponent),i=e.element.lineBreaker_t.style,l=e.element.lineBreaker_b.style,o="block"===this.context.resizing.resizeContainer.style.display?this.context.resizing.resizeContainer:t,s=r.isListCell(n.parentNode);let a,c,d;(s?n.previousSibling:r.isFormatElement(n.previousElementSibling))?i.display="none":(this._variable._lineBreakComp=n,c=e.element.wysiwyg.scrollTop,a=r.getOffset(t,e.element.wysiwygFrame).top+c,d=o.offsetWidth/2/2,i.top=a-c-12+"px",i.left=r.getOffset(o).left+d+"px",i.display="block"),(s?n.nextSibling:r.isFormatElement(n.nextElementSibling))?l.display="none":(a||(this._variable._lineBreakComp=n,c=e.element.wysiwyg.scrollTop,a=r.getOffset(t,e.element.wysiwygFrame).top+c,d=o.offsetWidth/2/2),l.top=a+o.offsetHeight-c-12+"px",l.left=r.getOffset(o).left+o.offsetWidth-d-24+"px",l.display="block")},insertNode:function(e,t,n){if(n&&!this.checkCharCount(e,null))return null;const i=r.getFreeFormatElement(this.getSelectionNode(),null),l=!i&&(r.isFormatElement(e)||r.isRangeFormatElement(e))||r.isComponent(e);if(!t&&l){const e=this.removeNode();if(3===e.container.nodeType||r.isBreak(e.container)){const n=r.getParentElement(e.container,function(e){return this.isRangeFormatElement(e)||this.isListCell(e)}.bind(r));(t=r.splitElement(e.container,e.offset,n?r.getElementDepth(n)+1:0))&&(t=t.previousSibling)}}const o=t||l?this.getRange():this.getRange_addLine(this.getRange()),s=o.commonAncestorContainer,a=o.startOffset,c=o.endOffset,d=o.startContainer===s&&r.isFormatElement(s),u=d?s.childNodes[a]:o.startContainer,h=d?s.childNodes[c]:o.endContainer;let g,p=null;if(t)g=t.parentNode,t=t.nextSibling,p=!0;else if(g=u,3===u.nodeType&&(g=u.parentNode),o.collapsed)if(3===s.nodeType)t=s.textContent.length>c?s.splitText(c):s.nextSibling;else if(r.isBreak(g))t=g,g=g.parentNode;else{let n=g.childNodes[a];const i=n&&3===n.nodeType&&r.onlyZeroWidthSpace(n)&&r.isBreak(n.nextSibling)?n.nextSibling:n;i?i.nextSibling?t=r.isBreak(i)&&!r.isBreak(e)?i:i.nextSibling:(g.removeChild(i),t=null):t=null}else{if(u===h){t=this.isEdgePoint(h,c)?h.nextSibling:h.splitText(c);let e=u;this.isEdgePoint(u,a)||(e=u.splitText(a)),g.removeChild(e),0===g.childNodes.length&&l&&(g.innerHTML="
    ")}else{const e=this.removeNode(),n=e.container,i=e.prevContainer;if(n&&0===n.childNodes.length&&l&&(r.isFormatElement(n)?n.innerHTML="
    ":r.isRangeFormatElement(n)&&(n.innerHTML="


    ")),!l&&i)if(g=3===i.nodeType?i.parentNode:i,g.contains(n))for(t=n;t.parentNode===g;)t=t.parentNode;else t=null;else g=l?s:n,t=l?h:null;for(;t&&!r.isFormatElement(t)&&t.parentNode!==s;)t=t.parentNode}}try{if(r.isFormatElement(e)||r.isRangeFormatElement(e)||!r.isListCell(g)&&r.isComponent(e)){const e=g;if(r.isList(t))g=t,t=null;else if(r.isListCell(t))g=t.previousElementSibling||t;else if(!p&&!t){const e=this.removeNode(),n=3===e.container.nodeType?r.isListCell(r.getFormatElement(e.container,null))?e.container:r.getFormatElement(e.container,null)||e.container.parentNode:e.container,i=r.isWysiwygDiv(n)||r.isRangeFormatElement(n);g=i?n:n.parentNode,t=i?null:n.nextSibling}0===e.childNodes.length&&g!==e&&r.removeItem(e)}!l||i||r.isRangeFormatElement(g)||r.isListCell(g)||r.isWysiwygDiv(g)||(t=g.nextElementSibling,g=g.parentNode),g.insertBefore(e,g===t?g.lastChild:t)}catch(t){g.appendChild(e)}finally{if(i&&(r.isFormatElement(e)||r.isRangeFormatElement(e))&&(e=this._setIntoFreeFormat(e)),!r.isComponent(e)){let t=1;if(3===e.nodeType){const t=e.previousSibling,n=e.nextSibling,i=!t||1===t.nodeType||r.onlyZeroWidthSpace(t)?"":t.textContent,l=!n||1===n.nodeType||r.onlyZeroWidthSpace(n)?"":n.textContent;t&&i.length>0&&(e.textContent=i+e.textContent,r.removeItem(t)),n&&n.length>0&&(e.textContent+=l,r.removeItem(n));const o={container:e,startOffset:i.length,endOffset:e.textContent.length-l.length};return this.setRange(e,o.startOffset,e,o.endOffset),o}if(!r.isBreak(e)&&r.isFormatElement(g)){let n=null;e.previousSibling||(n=r.createTextNode(r.zeroWidthSpace),e.parentNode.insertBefore(n,e)),e.nextSibling||(n=r.createTextNode(r.zeroWidthSpace),e.parentNode.appendChild(n)),r._isIgnoreNodeChange(e)&&(e=e.nextSibling,t=0)}this.setRange(e,t,e,t)}return this.history.push(!0),e}},_setIntoFreeFormat:function(e){const t=e.parentNode;let n,i;for(;r.isFormatElement(e)||r.isRangeFormatElement(e);){for(n=e.childNodes,i=null;n[0];)if(i=n[0],r.isFormatElement(i)||r.isRangeFormatElement(i)){if(this._setIntoFreeFormat(i),!e.parentNode)break;n=e.childNodes}else t.insertBefore(i,e);0===e.childNodes.length&&r.removeItem(e),e=r.createElement("BR"),t.insertBefore(e,i.nextSibling)}return e},removeNode:function(){this._resetRangeToTextNode()||console.warn('[SUNEDITOR.core.removeNode.exception] An exception occurred while resetting the "Range" object.');const t=this.getRange();let n,i=0,l=t.startContainer,o=t.endContainer;const s=t.startOffset,a=t.endOffset,c=t.commonAncestorContainer;let d=null,u=null;const h=r.getListChildNodes(c,null);let g=r.getArrayIndex(h,l),p=r.getArrayIndex(h,o);if(h.length>0&&g>-1&&p>-1){for(let e=g+1,t=l;e>=0;e--)h[e]===t.parentNode&&h[e].firstChild===t&&0===s&&(g=e,t=t.parentNode);for(let e=p-1,t=o;e>g;e--)h[e]===t.parentNode&&1===h[e].nodeType&&(h.splice(e,1),t=t.parentNode,--p)}else{if(0===h.length){if(r.isFormatElement(c)||r.isRangeFormatElement(c)||r.isWysiwygDiv(c)||r.isBreak(c)||r.isMedia(c))return{container:c,offset:0};h.push(c),l=o=c}else if(l=o=h[0],r.isBreak(l)||r.onlyZeroWidthSpace(l))return{container:l,offset:0};g=p=0}function m(e){const t=r.getFormatElement(e,null);if(r.removeItem(e),r.isListCell(t)){const e=r.getArrayItem(t.children,r.isList,!1);if(e){const n=e.firstElementChild,i=n.childNodes;for(;i[0];)t.insertBefore(i[0],e);r.removeItemAllParents(n,null,null)}}}for(let e=g;e<=p;e++){const t=h[e];if(0===t.length||3===t.nodeType&&void 0===t.data)m(t);else if(t!==l)t!==o?m(t):(u=1===o.nodeType?r.createTextNode(o.textContent):r.createTextNode(o.substringData(a,o.length-a)),u.length>0?o.data=u.data:m(o));else if(1===l.nodeType?d=r.createTextNode(l.textContent):t===o?(d=r.createTextNode(l.substringData(0,s)+o.substringData(a,o.length-a)),i=s):d=r.createTextNode(l.substringData(0,s)),d.length>0?l.data=d.data:m(l),t===o)break}if(n=o&&o.parentNode?o:l&&l.parentNode?l:t.endContainer||t.startContainer,!r.isWysiwygDiv(n)){const t=r.removeItemAllParents(n,function(e){if(this.isComponent(e))return!1;const t=e.textContent;return 0===t.length||/^(\n|\u200B)+$/.test(t)}.bind(r),null);t&&(n=t.sc||t.ec||e.element.wysiwyg)}return this.setRange(n,i,n,i),this.history.push(!0),{container:n,offset:i,prevContainer:l&&l.parentNode?l:null}},applyRangeFormatElement:function(e){this.getRange_addLine(this.getRange());const t=this.getSelectedElementsAndComponents(!1);if(!t||0===t.length)return;e:for(let e,n,i,l,o,s,a=0,c=t.length;a-1&&(l=n.lastElementChild,t.indexOf(l)>-1)){let e=null;for(;e=l.lastElementChild;)if(r.isList(e)){if(!(t.indexOf(e.lastElementChild)>-1))continue e;l=e.lastElementChild}i=n.firstElementChild,o=t.indexOf(i),s=t.indexOf(l),t.splice(o,s-o+1),c=t.length}else;let n,i,l,o=t[t.length-1];n=r.isRangeFormatElement(o)||r.isFormatElement(o)?o:r.getRangeFormatElement(o,null)||r.getFormatElement(o,null),r.isCell(n)?(i=null,l=n):(i=n.nextSibling,l=n.parentNode);let s=r.getElementDepth(n),a=null;const c=[],d=function(e,t,n){let i=null;if(e!==t&&!r.isTable(t)){if(t&&r.getElementDepth(e)===r.getElementDepth(t))return n;i=r.removeItemAllParents(t,null,e)}return i?i.ec:n};for(let n,o,u,h,g,p,m,f=0,_=t.length;f<_;f++)if(n=t[f],o=n.parentNode,o&&!e.contains(o))if(u=r.getElementDepth(n),r.isList(o)){if(null===a&&(p?(a=p,m=!0,p=null):a=o.cloneNode(!1)),c.push(n),g=t[f+1],f===_-1||g&&g.parentNode!==o){g&&n.contains(g.parentNode)&&(p=g.parentNode.cloneNode(!1));let t,f=o.parentNode;for(;r.isList(f);)t=r.createElement(f.nodeName),t.appendChild(a),a=t,f=f.parentNode;const _=this.detachRangeFormatElement(o,c,null,!0,!0);s>=u?(s=u,l=_.cc,i=d(l,o,_.ec),i&&(l=i.parentNode)):l===_.cc&&(i=_.ec),l!==_.cc&&(h=d(l,_.cc,h),i=void 0!==h?h:_.cc);for(let e=0,t=_.removeArray.length;e=u&&(s=u,l=o,i=n.nextSibling),e.appendChild(n),l!==o&&(h=d(l,o),void 0!==h&&(i=h));if(this.effectNode=null,r.mergeSameTags(e,null,!1),r.mergeNestedTags(e,function(e){return this.isList(e)}.bind(r)),i&&r.getElementDepth(i)>0&&(r.isList(i.parentNode)||r.isList(i.parentNode.parentNode))){const t=r.getParentElement(i,function(e){return this.isRangeFormatElement(e)&&!this.isList(e)}.bind(r)),n=r.splitElement(i,null,t?r.getElementDepth(t)+1:0);n.parentNode.insertBefore(e,n)}else l.insertBefore(e,i),d(e,i);const u=r.getEdgeChildNodes(e.firstElementChild,e.lastElementChild);t.length>1?this.setRange(u.sc,0,u.ec,u.ec.textContent.length):this.setRange(u.ec,u.ec.textContent.length,u.ec,u.ec.textContent.length),this.history.push(!1)},detachRangeFormatElement:function(e,t,n,i,l){const o=this.getRange(),s=o.startOffset,a=o.endOffset;let c=r.getListChildNodes(e,(function(t){return t.parentNode===e})),d=e.parentNode,u=null,h=null,g=e.cloneNode(!1);const p=[],m=r.isList(n);let f=!1,_=!1,b=!1;function v(t,n,i,l){if(r.onlyZeroWidthSpace(n)&&(n.innerHTML=r.zeroWidthSpace),3===n.nodeType)return t.insertBefore(n,i),n;const o=(b?n:l).childNodes;let s=n.cloneNode(!1),a=null,c=null;for(;o[0];)c=o[0],!r._notTextNode(c)||r.isBreak(c)||r.isListCell(s)?s.appendChild(c):(s.childNodes.length>0&&(a||(a=s),t.insertBefore(s,i),s=n.cloneNode(!1)),t.insertBefore(c,i),a||(a=c));if(s.childNodes.length>0){if(r.isListCell(t)&&r.isListCell(s)&&r.isList(i))if(m){for(a=i;i;)s.appendChild(i),i=i.nextSibling;t.parentNode.insertBefore(s,t.nextElementSibling)}else{const t=l.nextElementSibling,n=r.detachNestedList(l,!1);if(e!==n||t!==l.nextElementSibling){const t=s.childNodes;for(;t[0];)l.appendChild(t[0]);e=n,_=!0}}else t.insertBefore(s,i);a||(a=s)}return a}for(let l,o,s,a=0,y=c.length;a0&&(d.insertBefore(g,e),g=null),!m&&r.isListCell(l))if(s&&r.getElementDepth(l)!==r.getElementDepth(s)&&(r.isListCell(d)||r.getArrayItem(l.children,r.isList,!1))){const t=l.nextElementSibling,n=r.detachNestedList(l,!1);e===n&&t===l.nextElementSibling||(e=n,_=!0)}else{const t=l;l=r.createElement(i?t.nodeName:r.isList(e.parentNode)||r.isListCell(e.parentNode)?"LI":r.isCell(e.parentNode)?"DIV":"P");const n=r.isListCell(l),o=t.childNodes;for(;o[0]&&(!r.isList(o[0])||n);)l.appendChild(o[0]);r.copyFormatAttributes(l,t),b=!0}else l=l.cloneNode(!1);if(!_&&(i?(p.push(l),r.removeItem(c[a])):(n?(f||(d.insertBefore(n,e),f=!0),l=v(n,l,null,c[a])):l=v(d,l,e,c[a]),_||(t?(h=l,u||(u=l)):u||(u=h=l))),_)){_=b=!1,c=r.getListChildNodes(e,(function(t){return t.parentNode===e})),g=e.cloneNode(!1),d=e.parentNode,a=-1,y=c.length;continue}}const y=e.parentNode;let C=e.nextSibling;g&&g.children.length>0&&y.insertBefore(g,C),n?u=n.previousSibling:u||(u=e.previousSibling),C=e.nextSibling,0===e.children.length||0===e.textContent.length?r.removeItem(e):r.removeEmptyNode(e,null);let w=null;if(i)w={cc:y,sc:u,ec:C,removeArray:p};else{u||(u=h),h||(h=u);const e=r.getEdgeChildNodes(u,h.parentNode?u:h);w={cc:(e.sc||e.ec).parentNode,sc:e.sc,ec:e.ec}}if(this.effectNode=null,l)return w;!i&&w&&(t?this.setRange(w.sc,s,w.ec,a):this.setRange(w.sc,0,w.sc,0)),this.history.push(!1)},detachList:function(e,t){let n={},i=!1,l=!1,o=null,s=null;const a=function(e){return!this.isComponent(e)}.bind(r);for(let c,d,u,h,g=0,p=e.length;g0)&&t,n=!!(n&&n.length>0)&&n;const o=!e,s=o&&!n&&!t;let c=l.startContainer,d=l.startOffset,u=l.endContainer,h=l.endOffset;if(s&&l.collapsed&&r.isFormatElement(c.parentNode)&&r.isFormatElement(u.parentNode)||c===u&&1===c.nodeType&&r.isNonEditable(c))return;if(l.collapsed&&!s&&1===c.nodeType&&!r.isBreak(c)&&!r.isComponent(c)){let e=null;const t=c.childNodes[d];t&&(e=t.nextSibling?r.isBreak(t)?t:t.nextSibling:null);const n=r.createTextNode(r.zeroWidthSpace);c.insertBefore(n,e),this.setRange(n,1,n,1),l=this.getRange(),c=l.startContainer,d=l.startOffset,u=l.endContainer,h=l.endOffset}r.isFormatElement(c)&&(c=c.childNodes[d]||c.firstChild,d=0),r.isFormatElement(u)&&(u=u.childNodes[h]||u.lastChild,h=u.textContent.length),o&&(e=r.createElement("DIV"));const g=a.RegExp,p=e.nodeName;if(!s&&c===u&&!n&&e){let t=c,n=0;const i=[],l=e.style;for(let e=0,t=l.length;e0){for(;!r.isFormatElement(t)&&!r.isWysiwygDiv(t);){for(let l=0;l=i.length)return}}let m,f={},_={},b="",v="",y="";if(t){for(let e,n=0,i=t.length;n0&&(a=l.replace(b,"").trim(),a!==l&&(w.v=!0));const c=t.className;let d="";return v&&c.length>0&&(d=c.replace(v,"").trim(),d!==c&&(w.v=!0)),(!o||!v&&c||!b&&l||a||d||!n)&&(a||d||t.nodeName!==p||C(b)!==C(l)||C(v)!==C(c))?(b&&l.length>0&&(t.style.cssText=a),t.style.cssText||t.removeAttribute("style"),v&&c.length>0&&(t.className=d.trim()),t.className.trim()||t.removeAttribute("class"),t.style.cssText||t.className||t.nodeName!==p&&!n?t:(w.v=!0,null)):(w.v=!0,null)},E=this.getSelectedElements(null);l=this.getRange(),c=l.startContainer,d=l.startOffset,u=l.endContainer,h=l.endOffset,r.getFormatElement(c,null)||(c=r.getChildElement(E[0],(function(e){return 3===e.nodeType}),!1),d=0),r.getFormatElement(u,null)||(u=r.getChildElement(E[E.length-1],(function(e){return 3===e.nodeType}),!1),h=u.textContent.length);const S=r.getFormatElement(c,null)===r.getFormatElement(u,null),N=E.length-(S?0:1);m=e.cloneNode(!1);const T=s||o&&function(e){for(let t=0,n=e.length;t0&&(m=e.cloneNode(!1),_=this._nodeChange_endLine(E[N],m,x,u,h,s,o,w,k,A));for(let t,n=N-1;n>0;n--)m=e.cloneNode(!1),t=this._nodeChange_middleLine(E[n],m,x,s,o,w,_.container),t.endContainer&&(_.ancestor=null,_.container=t.endContainer),this._setCommonListStyle(t.ancestor,null);m=e.cloneNode(!1),f=this._nodeChange_startLine(E[0],m,x,c,d,s,o,w,k,A,_.container),f.endContainer&&(_.ancestor=null,_.container=f.endContainer),N<=0?_=f:_.container||(_.ancestor=null,_.container=f.container,_.offset=f.container.textContent.length),this._setCommonListStyle(f.ancestor,null),this._setCommonListStyle(_.ancestor||r.getFormatElement(_.container),null)}this.controllersOff(),this.setRange(f.container,f.offset,_.container,_.offset),this.history.push(!1)},_setCommonListStyle:function(e,t){if(!r.isListCell(e))return;t||e.removeAttribute("style");const n=r.getArrayItem((t||e).childNodes,(function(e){return!r.isBreak(e)&&!r.onlyZeroWidthSpace(e.textContent.trim())}),!0);if(n[0]&&1===n.length){if(!(t=n[0])||1!==t.nodeType)return;const i=t.style,l=e.style;/STRONG/i.test(t.nodeName)?l.fontWeight="bold":i.fontWeight&&(l.fontWeight=i.fontWeight),i.color&&(l.color=i.color),i.fontSize&&(l.fontSize=i.fontSize),this._setCommonListStyle(e,t)}},_stripRemoveNode:function(e){const t=e.parentNode;if(!e||3===e.nodeType||!t)return;const n=e.childNodes;for(;n[0];)t.insertBefore(n[0],e);t.removeChild(e)},_util_getMaintainedNode:function(e,t,n){return!n||e?null:this.getParentElement(n,this._isMaintainedNode.bind(this))||(t?null:this.getParentElement(n,this._isSizeNode.bind(this)))},_util_isMaintainedNode:function(e,t,n){if(!n||e||1!==n.nodeType)return!1;const i=this._isMaintainedNode(n);return this.getParentElement(n,this._isMaintainedNode.bind(this))?i:i||!t&&this._isSizeNode(n)},_nodeChange_oneLine:function(e,t,n,i,l,o,s,c,d,u,h,g,p){let m=i.parentNode;for(;!(m.nextSibling||m.previousSibling||r.isFormatElement(m.parentNode)||r.isWysiwygDiv(m.parentNode))&&m.nodeName!==t.nodeName;)m=m.parentNode;if(!d&&m===o.parentNode&&m.nodeName===t.nodeName&&r.onlyZeroWidthSpace(i.textContent.slice(0,l))&&r.onlyZeroWidthSpace(o.textContent.slice(s))){const e=m.childNodes;let n=!0;for(let t,l,s,a,c=0,d=e.length;c0&&(n=t.test(e.style.cssText)),!n}if(function e(i,l){const o=i.childNodes;for(let i,s=0,a=o.length;s=N?L-N:S.data.length-N));if(E){const t=g(l);if(t&&t.parentNode!==e){let n=t,i=null;for(;n.parentNode!==e;){for(l=i=n.parentNode.cloneNode(!1);n.childNodes[0];)i.appendChild(n.childNodes[0]);n.appendChild(i),n=n.parentNode}n.parentNode.appendChild(t)}E=E.cloneNode(!1)}r.onlyZeroWidthSpace(o)||l.appendChild(o);const c=g(l);for(c&&(E=c),E&&(e=E),C=a,y=[],x="";C!==e&&C!==f&&null!==C;)i=p(C)?null:n(C),i&&1===C.nodeType&&z(C)&&(y.push(i),x+=C.style.cssText.substr(0,C.style.cssText.indexOf(":"))+"|"),C=C.parentNode;const d=y.pop()||s;for(w=C=d;y.length>0;)C=y.pop(),w.appendChild(C),w=C;if(t.appendChild(d),e.appendChild(t),E&&!g(T)&&(t=t.cloneNode(!1),b.appendChild(t),_.push(t)),S=s,N=0,k=!0,C!==s&&C.appendChild(S),!v)continue}if(A||a!==T){if(k){if(1===a.nodeType&&!r.isBreak(a)){r._isIgnoreNodeChange(a)?(b.appendChild(a.cloneNode(!0)),u||(t=t.cloneNode(!1),b.appendChild(t),_.push(t))):e(a,a);continue}C=a,y=[],x="";const o=[];for(;null!==C.parentNode&&C!==f&&C!==t;)i=A?C.cloneNode(!1):n(C),1===C.nodeType&&!r.isBreak(a)&&i&&z(C)&&(p(C)?E||o.push(i):y.push(i),x+=C.style.cssText.substr(0,C.style.cssText.indexOf(":"))+"|"),C=C.parentNode;y=y.concat(o);const s=y.pop()||a;for(w=C=s;y.length>0;)C=y.pop(),w.appendChild(C),w=C;if(p(t.parentNode)&&!p(s)&&(t=t.cloneNode(!1),b.appendChild(t),_.push(t)),A||E||!p(s))s===a?l=A?b:t:A?(b.appendChild(s),l=C):(t.appendChild(s),l=C);else{t=t.cloneNode(!1);const e=s.childNodes;for(let n=0,i=e.length;n0?C:t}if(E&&3===a.nodeType)if(g(a)){const e=r.getParentElement(l,function(e){return this._isMaintainedNode(e.parentNode)||e.parentNode===b}.bind(r));E.appendChild(e),t=e.cloneNode(!1),_.push(t),b.appendChild(t)}else E=null}d=a.cloneNode(!1),l.appendChild(d),1!==a.nodeType||r.isBreak(a)||(h=d),e(a,h)}else{E=g(a);const e=r.createTextNode(1===T.nodeType?"":T.substringData(L,T.length-L)),l=r.createTextNode(v||1===T.nodeType?"":T.substringData(0,L));if(E?E=E.cloneNode(!1):p(t.parentNode)&&!E&&(t=t.cloneNode(!1),b.appendChild(t),_.push(t)),!r.onlyZeroWidthSpace(e)){C=a,x="",y=[];const t=[];for(;C!==b&&C!==f&&null!==C;)1===C.nodeType&&z(C)&&(p(C)?t.push(C.cloneNode(!1)):y.push(C.cloneNode(!1)),x+=C.style.cssText.substr(0,C.style.cssText.indexOf(":"))+"|"),C=C.parentNode;for(y=y.concat(t),d=w=C=y.pop()||e;y.length>0;)C=y.pop(),w.appendChild(C),w=C;b.appendChild(d),C.textContent=e.data}if(E&&d){const e=g(d);e&&(E=e)}for(C=a,y=[],x="";C!==b&&C!==f&&null!==C;)i=p(C)?null:n(C),i&&1===C.nodeType&&z(C)&&(y.push(i),x+=C.style.cssText.substr(0,C.style.cssText.indexOf(":"))+"|"),C=C.parentNode;const o=y.pop()||l;for(w=C=o;y.length>0;)C=y.pop(),w.appendChild(C),w=C;E?((t=t.cloneNode(!1)).appendChild(o),E.insertBefore(t,E.firstChild),b.appendChild(E),_.push(t),E=null):t.appendChild(o),T=l,L=l.data.length,A=!0,!c&&u&&(t=l,l.textContent=r.zeroWidthSpace),C!==l&&C.appendChild(T)}}}(e,b),d&&!c&&!h.v)return{ancestor:e,startContainer:i,startOffset:l,endContainer:o,endOffset:s};if(c=c&&d)for(let e=0;e<_.length;e++){let t,n,i,l=_[e];if(u)t=r.createTextNode(r.zeroWidthSpace),b.replaceChild(t,l);else{const e=l.childNodes;for(n=e[0];e[0];)i=e[0],b.insertBefore(i,l);r.removeItem(l)}0===e&&(u?S=T=t:(S=n,T=i))}else{if(d)for(let e=0;e<_.length;e++)this._stripRemoveNode(_[e]);u&&(S=T=t)}r.removeEmptyNode(b,t),u&&(N=S.textContent.length,L=T.textContent.length);const M=c||0===T.textContent.length;r.isBreak(T)||0!==T.textContent.length||(r.removeItem(T),T=S),L=M?T.textContent.length:L;const H={s:0,e:0},I=r.getNodePath(S,b,H),D=!T.parentNode;D&&(T=S);const O={s:0,e:0},F=r.getNodePath(T,b,D||M?null:O);N+=H.s,L=u?N:D?S.textContent.length:M?L+H.s:L+O.s;const R=r.mergeSameTags(b,[I,F],!0);return e.parentNode.replaceChild(b,e),S=r.getNodeFromPath(I,b),T=r.getNodeFromPath(F,b),{ancestor:b,startContainer:S,startOffset:N+R[0],endContainer:T,endOffset:L+R[1]}},_nodeChange_startLine:function(e,t,n,i,l,o,s,a,c,d,u){let h=i.parentNode;for(;!(h.nextSibling||h.previousSibling||r.isFormatElement(h.parentNode)||r.isWysiwygDiv(h.parentNode))&&h.nodeName!==t.nodeName;)h=h.parentNode;if(!s&&h.nodeName===t.nodeName&&!r.isFormatElement(h)&&!h.nextSibling&&r.onlyZeroWidthSpace(i.textContent.slice(0,l))){let n=!0,o=i.previousSibling;for(;o;){if(!r.onlyZeroWidthSpace(o)){n=!1;break}o=o.previousSibling}if(n)return r.copyTagAttributes(h,t),{ancestor:e,container:i,offset:l}}a.v=!1;const g=e,p=[t],m=e.cloneNode(!1);let f,_,b,v,y=i,C=l,w=!1;if(function e(i,l){const o=i.childNodes;for(let i,s,a=0,h=o.length;a0,y=f.pop()||h;for(b=_=y;f.length>0;)_=f.pop(),b.appendChild(_),b=_;if(d(t.parentNode)&&!d(y)&&(t=t.cloneNode(!1),m.appendChild(t),p.push(t)),!v&&d(y)){t=t.cloneNode(!1);const e=y.childNodes;for(let n=0,i=e.length;n0;)_=f.pop(),b.appendChild(_),b=_;d!==l?(t.appendChild(d),l=_):l=t,r.isBreak(h)&&t.appendChild(h.cloneNode(!1)),e.appendChild(t),y=s,C=0,w=!0,l.appendChild(y)}}}(e,m),s&&!o&&!a.v)return{ancestor:e,container:i,offset:l,endContainer:u};if(o=o&&s)for(let e=0;e0&&u===h)return e.innerHTML=i.innerHTML,{ancestor:e,endContainer:n?r.getNodeFromPath(n,e):null}}o.v=!1;const a=e.cloneNode(!1),c=[t];let d=!0;if(function e(i,l){const o=i.childNodes;for(let i,u,h=0,g=o.length;h0&&(a.appendChild(t),t=t.cloneNode(!1)),u=g.cloneNode(!0),a.appendChild(u),a.appendChild(t),c.push(t),l=t,s&&g.contains(s)){const e=r.getNodePath(s,g);s=r.getNodeFromPath(e,u)}}}(e,t),d||l&&!i&&!o.v)return{ancestor:e,endContainer:s};if(a.appendChild(t),i&&l)for(let e=0;e0,u=m.pop()||a;for(_=f=u;m.length>0;)f=m.pop(),_.appendChild(f),_=f;if(d(t.parentNode)&&!d(u)&&(t=t.cloneNode(!1),p.insertBefore(t,p.firstChild),g.push(t)),!b&&d(u)){t=t.cloneNode(!1);const e=u.childNodes;for(let n=0,i=e.length;n0?f:t}else s?(t.insertBefore(u,t.firstChild),l=f):l=t;if(b&&3===a.nodeType)if(c(a)){const e=r.getParentElement(l,function(e){return this._isMaintainedNode(e.parentNode)||e.parentNode===p}.bind(r));b.appendChild(e),t=e.cloneNode(!1),g.push(t),p.insertBefore(t,p.firstChild)}else b=null}if(C||a!==v)i=C?n(a):a.cloneNode(!1),i&&(l.insertBefore(i,l.firstChild),1!==a.nodeType||r.isBreak(a)||(u=i)),e(a,u);else{b=c(a);const e=r.createTextNode(1===v.nodeType?"":v.substringData(y,v.length-y)),o=r.createTextNode(1===v.nodeType?"":v.substringData(0,y));if(b){b=b.cloneNode(!1);const e=c(l);if(e&&e.parentNode!==p){let t=e,n=null;for(;t.parentNode!==p;){for(l=n=t.parentNode.cloneNode(!1);t.childNodes[0];)n.appendChild(t.childNodes[0]);t.appendChild(n),t=t.parentNode}t.parentNode.insertBefore(e,t.parentNode.firstChild)}b=b.cloneNode(!1)}else d(t.parentNode)&&!b&&(t=t.cloneNode(!1),p.appendChild(t),g.push(t));for(r.onlyZeroWidthSpace(e)||l.insertBefore(e,l.firstChild),f=l,m=[];f!==p&&null!==f;)i=d(f)?null:n(f),i&&1===f.nodeType&&m.push(i),f=f.parentNode;const s=m.pop()||l;for(_=f=s;m.length>0;)f=m.pop(),_.appendChild(f),_=f;s!==l?(t.insertBefore(s,t.firstChild),l=f):l=t,r.isBreak(a)&&t.appendChild(a.cloneNode(!1)),b?(b.insertBefore(t,b.firstChild),p.insertBefore(b,p.firstChild),b=null):p.insertBefore(t,p.firstChild),v=o,y=o.data.length,C=!0,l.insertBefore(v,l.firstChild)}}}(e,p),s&&!o&&!a.v)return{ancestor:e,container:i,offset:l};if(o=o&&s)for(let e=0;e-1?null:r.createElement(n);let d=n;/^SUB$/i.test(n)&&a.indexOf("SUP")>-1?d="SUP":/^SUP$/i.test(n)&&a.indexOf("SUB")>-1&&(d="SUB"),this.nodeChange(c,null,[d],!1),this.focus()}},removeFormat:function(){this.nodeChange(null,null,null,null)},indent:function(e){const t=this.getRange(),n=this.getSelectedElements(null),i=[],l="indent"!==e;let o=t.startContainer,s=t.endContainer,a=t.startOffset,c=t.endOffset;for(let e,t,o=0,s=n.length;o0&&this.plugins.list.editInsideList.call(this,l,i),this.effectNode=null,this.setRange(o,a,s,c),this.history.push(!1)},toggleDisplayBlocks:function(){const t=e.element.wysiwyg;r.toggleClass(t,"se-show-block"),r.hasClass(t,"se-show-block")?r.addClass(this._styleCommandMap.showBlocks,"active"):r.removeClass(this._styleCommandMap.showBlocks,"active"),this._resourcesStateChange()},toggleCodeView:function(){const t=this._variable.isCodeView;this.controllersOff(),r.setDisabledButtons(!t,this.codeViewDisabledButtons),t?(this._setCodeDataToEditor(),e.element.wysiwygFrame.scrollTop=0,e.element.code.style.display="none",e.element.wysiwygFrame.style.display="block",this._variable._codeOriginCssText=this._variable._codeOriginCssText.replace(/(\s?display(\s+)?:(\s+)?)[a-zA-Z]+(?=;)/,"display: none"),this._variable._wysiwygOriginCssText=this._variable._wysiwygOriginCssText.replace(/(\s?display(\s+)?:(\s+)?)[a-zA-Z]+(?=;)/,"display: block"),"auto"!==l.height||l.codeMirrorEditor||(e.element.code.style.height="0px"),this._variable.isCodeView=!1,this._variable.isFullScreen||(this._notHideToolbar=!1,/balloon|balloon-always/i.test(l.mode)&&(e.element._arrow.style.display="",this._isInline=!1,this._isBalloon=!0,u._hideToolbar())),this.nativeFocus(),r.removeClass(this._styleCommandMap.codeView,"active"),this.history.push(!1)):(this._setEditorDataToCodeView(),this._variable._codeOriginCssText=this._variable._codeOriginCssText.replace(/(\s?display(\s+)?:(\s+)?)[a-zA-Z]+(?=;)/,"display: block"),this._variable._wysiwygOriginCssText=this._variable._wysiwygOriginCssText.replace(/(\s?display(\s+)?:(\s+)?)[a-zA-Z]+(?=;)/,"display: none"),"auto"!==l.height||l.codeMirrorEditor||(e.element.code.style.height=e.element.code.scrollHeight>0?e.element.code.scrollHeight+"px":"auto"),l.codeMirrorEditor&&l.codeMirrorEditor.refresh(),this._variable.isCodeView=!0,this._variable.isFullScreen||(this._notHideToolbar=!0,this._isBalloon&&(e.element._arrow.style.display="none",e.element.toolbar.style.left="",this._isInline=!0,this._isBalloon=!1,u._showToolbarInline())),this._variable._range=null,e.element.code.focus(),r.addClass(this._styleCommandMap.codeView,"active")),this._checkPlaceholder(),"function"==typeof h.toggleCodeView&&h.toggleCodeView(this._variable.isCodeView,this)},_setCodeDataToEditor:function(){const t=this._getCodeView();if(l.fullPage){const e=this._parser.parseFromString(t,"text/html"),n=e.head.children;for(let t=0,i=n.length;t0?this.convertContentsForEditor(t):"


    "},_setEditorDataToCodeView:function(){const t=this.convertHTMLForCodeView(e.element.wysiwyg);let n="";if(l.fullPage){const e=r.getAttributesToString(this._wd.body,null);n="\n\n"+this._wd.head.outerHTML.replace(/>(?!\n)/g,">\n")+"\n"+t+"\n"}else n=t;e.element.code.style.display="block",e.element.wysiwygFrame.style.display="none",this._setCodeView(n)},toggleFullScreen:function(t){const n=e.element.topArea,i=e.element.toolbar,o=e.element.editorArea,d=e.element.wysiwygFrame,g=e.element.code,p=this._variable;this.controllersOff(),p.isFullScreen?(p.isFullScreen=!1,d.style.cssText=p._wysiwygOriginCssText,g.style.cssText=p._codeOriginCssText,i.style.cssText="",o.style.cssText=p._editorAreaOriginCssText,n.style.cssText=p._originCssText,s.body.style.overflow=p._bodyOverflow,l.toolbarContainer&&l.toolbarContainer.appendChild(i),l.stickyToolbar>-1&&r.removeClass(i,"se-toolbar-sticky"),p._fullScreenAttrs.sticky&&!l.toolbarContainer&&(p._fullScreenAttrs.sticky=!1,e.element._stickyDummy.style.display="block",r.addClass(i,"se-toolbar-sticky")),this._isInline=p._fullScreenAttrs.inline,this._isBalloon=p._fullScreenAttrs.balloon,this._isInline&&u._showToolbarInline(),l.toolbarContainer&&r.removeClass(i,"se-toolbar-balloon"),u.onScroll_window(),r.changeElement(t.firstElementChild,c.expansion),r.removeClass(this._styleCommandMap.fullScreen,"active")):(p.isFullScreen=!0,p._fullScreenAttrs.inline=this._isInline,p._fullScreenAttrs.balloon=this._isBalloon,(this._isInline||this._isBalloon)&&(this._isInline=!1,this._isBalloon=!1),l.toolbarContainer&&e.element.relative.insertBefore(i,o),n.style.position="fixed",n.style.top="0",n.style.left="0",n.style.width="100%",n.style.maxWidth="100%",n.style.height="100%",n.style.zIndex="2147483647",""!==e.element._stickyDummy.style.display&&(p._fullScreenAttrs.sticky=!0,e.element._stickyDummy.style.display="none",r.removeClass(i,"se-toolbar-sticky")),p._bodyOverflow=s.body.style.overflow,s.body.style.overflow="hidden",p._editorAreaOriginCssText=o.style.cssText,p._wysiwygOriginCssText=d.style.cssText,p._codeOriginCssText=g.style.cssText,o.style.cssText=i.style.cssText="",d.style.cssText=(d.style.cssText.match(/\s?display(\s+)?:(\s+)?[a-zA-Z]+;/)||[""])[0],g.style.cssText=(g.style.cssText.match(/\s?display(\s+)?:(\s+)?[a-zA-Z]+;/)||[""])[0],i.style.width=d.style.height=g.style.height="100%",i.style.position="relative",i.style.display="block",p.innerHeight_fullScreen=a.innerHeight-i.offsetHeight,o.style.height=p.innerHeight_fullScreen+"px",r.changeElement(t.firstElementChild,c.reduction),l.iframe&&"auto"===l.height&&(o.style.overflow="auto",this._iframeAutoHeight()),r.addClass(this._styleCommandMap.fullScreen,"active")),"function"==typeof h.toggleFullScreen&&h.toggleFullScreen(this._variable.isFullScreen,this)},print:function(){const e=r.createElement("IFRAME");e.style.display="none",s.body.appendChild(e);const t=r.getIframeDocument(e),n=this.getContents(!0),i=this._wd;if(l.iframe){const e=l.fullPage?r.getAttributesToString(i.body,["contenteditable"]):'class="sun-editor-editable"';t.write(""+i.head.innerHTML+""+n+"")}else{const e=s.head.getElementsByTagName("link"),i=s.head.getElementsByTagName("style");let l="";for(let t=0,n=e.length;t"+l+''+n+"")}this.showLoading(),a.setTimeout((function(){try{if(e.focus(),r.isIE_Edge||s.documentMode||a.StyleMedia)try{e.contentWindow.document.execCommand("print",!1,null)}catch(t){e.contentWindow.print()}else e.contentWindow.print()}catch(e){throw Error("[SUNEDITOR.core.print.fail] error: "+e)}finally{d.closeLoading(),r.removeItem(e)}}),1e3)},preview:function(){d.submenuOff(),d.containerOff(),d.controllersOff();const t=this.getContents(!0),n=a.open("","_blank");n.mimeType="text/html";const o=e.element.wysiwygFrame.offsetWidth+"px !important",c=this._wd;if(l.iframe){const e=l.fullPage?r.getAttributesToString(c.body,["contenteditable"]):'class="sun-editor-editable"';n.document.write(""+c.head.innerHTML+""+t+"")}else{const e=s.head.getElementsByTagName("link"),l=s.head.getElementsByTagName("style");let a="";for(let t=0,n=e.length;t'+i.toolbar.preview+""+a+''+t+"")}},setContents:function(t){const n=this.convertContentsForEditor(t);if(this._resetComponents(),this._variable.isCodeView){const e=this.convertHTMLForCodeView(n);this._setCodeView(e)}else e.element.wysiwyg.innerHTML=n,this.history.push(!1)},getContents:function(t){const n=e.element.wysiwyg.innerHTML,i=r.createElement("DIV");i.innerHTML=n;const o=r.getListChildren(i,(function(e){return/FIGCAPTION/i.test(e.nodeName)}));for(let e=0,t=o.length;e"+this._wd.head.outerHTML+""+i.innerHTML+""}return i.innerHTML},_makeLine:function(e,t){if(1===e.nodeType)return r._disallowedTags(e)?"":!t||r.isFormatElement(e)||r.isRangeFormatElement(e)||r.isComponent(e)||r.isMedia(e)||r.isAnchor(e)&&r.isMedia(e.firstElementChild)?e.outerHTML:"

    "+e.outerHTML+"

    ";if(3===e.nodeType){if(!t)return e.textContent;const n=e.textContent.split(/\n/g);let i="";for(let e,t=0,l=n.length;t0&&(i+="

    "+e+"

    ");return i}return 8===e.nodeType&&this._allowHTMLComments?"\x3c!--"+e.textContent.trim()+"--\x3e":""},_tagConvertor:function(e){if(!this._disallowedTextTagsRegExp)return e;const t={b:"strong",i:"em",ins:"u",strike:"del",s:"del"};return e.replace(this._disallowedTextTagsRegExp,(function(e,n,i){return n+("string"==typeof t[i]?t[i]:i)}))},_deleteDisallowedTags:function(e){return e.replace(/\n/g,"").replace(/<(script|style).*>(\n|.)*<\/(script|style)>/gi,"").replace(/<[a-z0-9]+\:[a-z0-9]+[^>^\/]*>[^>]*<\/[a-z0-9]+\:[a-z0-9]+>/gi,"").replace(this.editorTagsWhitelistRegExp,"")},cleanHTML:function(e,t){e=this._deleteDisallowedTags(e).replace(/(<[a-zA-Z0-9]+)[^>]*(?=>)/g,function(e,t){if(/^<[a-z0-9]+\:[a-z0-9]+/i.test(e))return e;let n=null;const i=this._attributesTagsWhitelist[t.match(/(?!<)[a-zA-Z0-9]+/)[0].toLowerCase()];if(n=i?e.match(i):e.match(this._attributesWhitelistRegExp),/

    ":(i=r.htmlRemoveWhiteSpace(i),this._tagConvertor(i))},convertHTMLForCodeView:function(e){let t="";const n=a.RegExp,i=new n("^(BLOCKQUOTE|PRE|TABLE|THEAD|TBODY|TR|TH|TD|OL|UL|IMG|IFRAME|VIDEO|AUDIO|FIGURE|FIGCAPTION|HR|BR|CANVAS|SELECT)$","i"),l=r.isFormatElement.bind(r),o="string"==typeof e?s.createRange().createContextualFragment(e):e;let c=1*this._variable.codeIndent;return c=c>0?new a.Array(c+1).join(" "):"",function e(o,s,a){const d=o.childNodes,u=i.test(o.nodeName),h=u?s:"";for(let g,p,m,f=0,_=d.length;f<_;f++){if(g=d[f],m=i.test(g.nodeName),p=m?"\n":"",a=!l(g)||u||/^(TH|TD)$/i.test(o.nodeName)?"":"\n",8===g.nodeType){t+="\n\x3c!-- "+g.textContent.trim()+" --\x3e"+p;continue}if(3===g.nodeType){t+=r._HTMLConvertor(/^\n+$/.test(g.data)?"":g.data);continue}if(0===g.childNodes.length){t+=(/^HR$/i.test(g.nodeName)?"\n":"")+h+g.outerHTML+p;continue}g.innerHTML=g.innerHTML;const _=g.nodeName.toLowerCase();t+=(a||(u?"":p))+(h||m?s:"")+g.outerHTML.match(n("<"+_+"[^>]*>","i"))[0]+p,e(g,s+c,""),t+=(m?s:"")+""+(a||p||u||/^(TH|TD)$/i.test(g.nodeName)?"\n":"")}}(o,"","\n"),t.trim()+"\n"},addDocEvent:function(e,t,n){s.addEventListener(e,t,n),l.iframe&&this._wd.addEventListener(e,t)},removeDocEvent:function(e,t){s.removeEventListener(e,t),l.iframe&&this._wd.removeEventListener(e,t)},_charCount:function(e){const t=l.maxCharCount,n=l.charCounterType;let i=0;if(e&&(i=this.getCharLength(e,n)),this._setCharCount(),t>0){let e=!1;const l=h.getCharCount(n);if(l>t){if(e=!0,i>0){this._editorRange();const e=this.getRange(),n=e.endOffset-1,i=this.getSelectionNode().textContent,o=e.endOffset-(l-t);this.getSelectionNode().textContent=i.slice(0,o<0?0:o)+i.slice(e.endOffset,i.length),this.setRange(e.endContainer,n,e.endContainer,n)}}else l+i>t&&(e=!0);if(e&&(this._callCounterBlink(),i>0))return!1}return!0},checkCharCount:function(e,t){if(l.maxCharCount){const n=t||l.charCounterType,i=this.getCharLength("string"==typeof e?e:this._charTypeHTML?e.outerHTML:e.textContent,n);if(i>0&&i+h.getCharCount(n)>l.maxCharCount)return this._callCounterBlink(),!1}return!0},getCharLength:function(e,t){return/byte/.test(t)?r.getByteLength(e):e.length},_setCharCount:function(){e.element.charCounter&&a.setTimeout((function(){e.element.charCounter.textContent=h.getCharCount(l.charCounterType)}))},_callCounterBlink:function(){const t=e.element.charWrapper;t&&!r.hasClass(t,"se-blink")&&(r.addClass(t,"se-blink"),a.setTimeout((function(){r.removeClass(t,"se-blink")}),600))},_checkComponents:function(){for(let e=0,t=this._fileInfoPluginsCheck.length;e^<]+)?\\s*(?=>)","gi");const h="contenteditable|colspan|rowspan|target|href|src|class|type|controls|data-format|data-size|data-file-size|data-file-name|data-origin|data-align|data-image-link|data-rotate|data-proportion|data-percentage|origin-size|data-exp|data-font-size";this._allowHTMLComments=l._editorTagsWhitelist.indexOf("//")>-1,this._htmlCheckWhitelistRegExp=new c("^("+l._editorTagsWhitelist.replace("|//","")+")$","i"),this.editorTagsWhitelistRegExp=r.createTagsWhitelist(l._editorTagsWhitelist.replace("|//","|\x3c!--|--\x3e")),this.pasteTagsWhitelistRegExp=r.createTagsWhitelist(l.pasteTagsWhitelist);const g=l.attributesWhitelist,p={};let m="";if(g)for(let e in g)r.hasOwn(g,e)&&("all"===e?m=g[e]+"|":p[e]=new c("((?:"+g[e]+"|"+h+')s*=s*"[^"]*")',"ig"));this._attributesWhitelistRegExp=new c("((?:"+m+h+')s*=s*"[^"]*")',"ig"),this._attributesTagsWhitelist=p,this._isInline=/inline/i.test(l.mode),this._isBalloon=/balloon|balloon-always/i.test(l.mode),this._isBalloonAlways=/balloon-always/i.test(l.mode),this._cachingButtons(),this._fileInfoPluginsCheck=[],this._fileInfoPluginsReset=[],this.managedTagsInfo={query:"",map:{}};const f=[];this.activePlugins=[],this._fileManager.tags=[],this._fileManager.pluginMap={};let _,b,v=[];for(let e in n)if(r.hasOwn(n,e)){if(_=n[e],b=t[e],_.active&&b&&this.callPlugin(e,null,b),"function"==typeof _.checkFileInfo&&"function"==typeof _.resetFileInfo&&(this.callPlugin(e,null,b),this._fileInfoPluginsCheck.push(_.checkFileInfo.bind(this)),this._fileInfoPluginsReset.push(_.resetFileInfo.bind(this))),a.Array.isArray(_.fileTags)){const t=_.fileTags;this.callPlugin(e,null,b),this._fileManager.tags=this._fileManager.tags.concat(t),v.push(e);for(let n=0,i=t.length;nc&&(d=d.slice(0,c),a&&a.setAttribute("disabled",!0)),d[c]=l?{contents:n,s:{path:i.getNodePath(l.startContainer,null,null),offset:l.startOffset},e:{path:i.getNodePath(l.endContainer,null,null),offset:l.endOffset}}:{contents:n,s:{path:[0,0],offset:[0,0]},e:{path:0,offset:0}},1===c&&s&&s.removeAttribute("disabled"),e._setCharCount(),t()}return{stack:d,push:function(t){n.setTimeout(e._resourcesStateChange.bind(e));const i="number"==typeof t?t>0?t:0:t?l:0;i&&!r||(n.clearTimeout(r),i)?r=n.setTimeout((function(){n.clearTimeout(r),r=null,h()}),i):h()},undo:function(){c>0&&(c--,u())},redo:function(){d.length-1>c&&(c++,u())},go:function(e){c=e<0?d.length-1:e,u()},reset:function(n){s&&s.setAttribute("disabled",!0),a&&a.setAttribute("disabled",!0),e.context.tool.save&&e.context.tool.save.setAttribute("disabled",!0),d.splice(0),c=0,d[c]={contents:e.getContents(!0),s:{path:[0,0],offset:0},e:{path:[0,0],offset:0}},n||t()},_resetCachingButton:function(){o=e.context.element,s=e.context.tool.undo,a=e.context.tool.redo,0===c?(s&&s.setAttribute("disabled",!0),a&&c===d.length-1&&a.setAttribute("disabled",!0),e.context.tool.save&&e.context.tool.save.setAttribute("disabled",!0)):c===d.length-1&&a&&a.setAttribute("disabled",!0)},_destroy:function(){r&&n.clearTimeout(r),d=null}}}(this,this._onChange_historyStack.bind(this)),this.addModule([B]),l.iframe&&(this._wd=e.element.wysiwygFrame.contentDocument,e.element.wysiwyg=this._wd.body,l._editorStyles.editor&&(e.element.wysiwyg.style.cssText=l._editorStyles.editor),"auto"===l.height&&(this._iframeAuto=this._wd.body)),this._initWysiwygArea(i,o)},_cachingButtons:function(){this.codeViewDisabledButtons=e.element.toolbar.querySelectorAll('.se-toolbar button:not([class~="se-code-view-enabled"])'),this.resizingDisabledButtons=e.element.toolbar.querySelectorAll('.se-toolbar button:not([class~="se-resizing-enabled"])');const t=e.tool;this.commandMap={STRONG:t.bold,U:t.underline,EM:t.italic,DEL:t.strike,SUB:t.subscript,SUP:t.superscript,OUTDENT:t.outdent,INDENT:t.indent},this._styleCommandMap={fullScreen:t.fullScreen,showBlocks:t.showBlocks,codeView:t.codeView}},_initWysiwygArea:function(t,n){e.element.wysiwyg.innerHTML=t?n:this.convertContentsForEditor("string"==typeof n?n:e.element.originElement.value)},_resourcesStateChange:function(){this._iframeAutoHeight(),this._checkPlaceholder()},_onChange_historyStack:function(){u._applyTagEffects(),e.tool.save&&e.tool.save.removeAttribute("disabled"),h.onChange&&h.onChange(this.getContents(!0),this)},_iframeAutoHeight:function(){this._iframeAuto&&a.setTimeout((function(){e.element.wysiwygFrame.style.height=d._iframeAuto.offsetHeight+"px"}))},_checkPlaceholder:function(){if(this._placeholder){if(this._variable.isCodeView)return void(this._placeholder.style.display="none");const t=e.element.wysiwyg;!r.onlyZeroWidthSpace(t.textContent)||t.querySelector(".se-component, pre, blockquote, hr, li, table, img, iframe, video")||(t.innerText.match(/\n/g)||"").length>1?this._placeholder.style.display="none":this._placeholder.style.display="block"}},_setDefaultFormat:function(e){if(this._fileManager.pluginRegExp.test(this.currentControllerName))return;const t=this.getRange(),n=t.commonAncestorContainer,i=t.startContainer,l=r.getRangeFormatElement(n,null);let o,s,a;const c=r.getParentElement(n,r.isComponent);if((!c||r.isTable(c))&&(!r.isRangeFormatElement(i)&&!r.isWysiwygDiv(i)||!r.isComponent(i.childNodes[t.startOffset]))){if(l)return a=r.createElement(e||"P"),a.innerHTML=l.innerHTML,0===a.childNodes.length&&(a.innerHTML=r.zeroWidthSpace),l.innerHTML=a.outerHTML,a=l.firstChild,o=r.getEdgeChildNodes(a,null).sc,o||(o=r.createTextNode(r.zeroWidthSpace),a.insertBefore(o,a.firstChild)),s=o.textContent.length,void this.setRange(o,s,o,s);if(r.isRangeFormatElement(n)&&n.childNodes.length<=1){let e=null;return 1===n.childNodes.length&&r.isBreak(n.firstChild)?e=n.firstChild:(e=r.createTextNode(r.zeroWidthSpace),n.appendChild(e)),void this.setRange(e,1,e,1)}if(this.execCommand("formatBlock",!1,e||"P"),o=r.getEdgeChildNodes(n,n),o=o?o.ec:n,a=r.getFormatElement(o,null),!a)return this.removeRange(),void this._editorRange();if(r.isBreak(a.nextSibling)&&r.removeItem(a.nextSibling),r.isBreak(a.previousSibling)&&r.removeItem(a.previousSibling),r.isBreak(o)){const e=r.createTextNode(r.zeroWidthSpace);o.parentNode.insertBefore(e,o),o=e}this.effectNode=null,this.nativeFocus()}},_setOptionsInit:function(t,n){this.context=e=A(t.originElement,this._getConstructed(t),l),this._componentsInfoReset=!0,this._editorInit(!0,n)},_editorInit:function(t,n){this._init(t,n),u._addEvent(),this._setCharCount(),u._offStickyToolbar(),u.onResize_window(),e.element.toolbar.style.visibility="",this._checkComponents(),this._componentsInfoInit=!1,this._componentsInfoReset=!1,this.history.reset(!0),this._resourcesStateChange(),a.setTimeout((function(){"function"==typeof h.onload&&h.onload(d,t)}))},_getConstructed:function(e){return{_top:e.topArea,_relative:e.relative,_toolBar:e.toolbar,_menuTray:e._menuTray,_editorArea:e.editorArea,_wysiwygArea:e.wysiwygFrame,_codeArea:e.code,_placeholder:e.placeholder,_resizingBar:e.resizingBar,_navigation:e.navigation,_charCounter:e.charCounter,_charWrapper:e.charWrapper,_loading:e.loading,_lineBreaker:e.lineBreaker,_lineBreaker_t:e.lineBreaker_t,_lineBreaker_b:e.lineBreaker_b,_resizeBack:e.resizeBackground,_stickyDummy:e._stickyDummy,_arrow:e._arrow}}},u={_IEisComposing:!1,_lineBreakerBind:null,_responsiveCurrentSize:"default",_responsiveButtonSize:null,_responsiveButtons:null,_directionKeyCode:new a.RegExp("^(8|13|3[2-9]|40|46)$"),_nonTextKeyCode:new a.RegExp("^(8|13|1[6-9]|20|27|3[3-9]|40|45|46|11[2-9]|12[0-3]|144|145)$"),_historyIgnoreKeyCode:new a.RegExp("^(1[6-9]|20|27|3[3-9]|40|45|11[2-9]|12[0-3]|144|145)$"),_onButtonsCheck:new a.RegExp("^(STRONG|U|EM|DEL|SUB|SUP)$"),_frontZeroWidthReg:new a.RegExp(r.zeroWidthSpace+"+",""),_keyCodeShortcut:{65:"A",66:"B",83:"S",85:"U",73:"I",89:"Y",90:"Z",219:"[",221:"]"},_shortcutCommand:function(e,t){let n=null;switch(u._keyCodeShortcut[e]){case"A":n="selectAll";break;case"B":-1===l.shortcutsDisable.indexOf("bold")&&(n="STRONG");break;case"S":t&&-1===l.shortcutsDisable.indexOf("strike")&&(n="DEL");break;case"U":-1===l.shortcutsDisable.indexOf("underline")&&(n="U");break;case"I":-1===l.shortcutsDisable.indexOf("italic")&&(n="EM");break;case"Z":-1===l.shortcutsDisable.indexOf("undo")&&(n=t?"redo":"undo");break;case"Y":-1===l.shortcutsDisable.indexOf("undo")&&(n="redo");break;case"[":-1===l.shortcutsDisable.indexOf("indent")&&(n="outdent");break;case"]":-1===l.shortcutsDisable.indexOf("indent")&&(n="indent")}return!!n&&(d.commandHandler(d.commandMap[n],n),!0)},_applyTagEffects:function(){let t=d.getSelectionNode();if(t===d.effectNode)return;d.effectNode=t;const i=d.commandMap,o=this._onButtonsCheck,s=[],a=[],c=d.activePlugins,u=c.length;let h="";for(;t.firstChild;)t=t.firstChild;for(let e=t;!r.isWysiwygDiv(e)&&e;e=e.parentNode)if(1===e.nodeType&&!r.isBreak(e)){h=e.nodeName.toUpperCase(),a.push(h);for(let t,i=0;i0)&&(s.push("OUTDENT"),i.OUTDENT.removeAttribute("disabled")),-1===s.indexOf("INDENT")&&i.INDENT&&r.isListCell(e)&&!e.previousElementSibling&&(s.push("INDENT"),i.INDENT.setAttribute("disabled",!0))):o.test(h)&&(s.push(h),r.addClass(i[h],"active"))}for(let e in i)s.indexOf(e)>-1||!r.hasOwn(i,e)||(c.indexOf(e)>-1?n[e].active.call(d,null):i.OUTDENT&&/^OUTDENT$/i.test(e)?i.OUTDENT.setAttribute("disabled",!0):i.INDENT&&/^INDENT$/i.test(e)?i.INDENT.removeAttribute("disabled"):r.removeClass(i[e],"active"));d._variable.currentNodes=a.reverse(),d._variable.currentNodesMap=s,l.showPathLabel&&(e.element.navigation.textContent=d._variable.currentNodes.join(" > "))},_cancelCaptionEdit:function(){this.setAttribute("contenteditable",!1),this.removeEventListener("blur",u._cancelCaptionEdit)},_buttonsEventHandler:function(e){let t=e.target;if(d._bindControllersOff&&e.stopPropagation(),/^(input|textarea|select|option)$/i.test(t.nodeName)?d._antiBlur=!1:e.preventDefault(),r.getParentElement(t,".se-submenu"))e.stopPropagation(),d._notHideToolbar=!0;else{let n=t.getAttribute("data-command"),i=t.className;for(;!n&&!/se-menu-list/.test(i)&&!/sun-editor-common/.test(i);)t=t.parentNode,n=t.getAttribute("data-command"),i=t.className;n!==d._submenuName&&n!==d._containerName||e.stopPropagation()}},onClick_toolbar:function(e){let t=e.target,n=t.getAttribute("data-display"),i=t.getAttribute("data-command"),l=t.className;for(;t.parentNode&&!i&&!/se-menu-list/.test(l)&&!/se-toolbar/.test(l);)t=t.parentNode,i=t.getAttribute("data-command"),n=t.getAttribute("data-display"),l=t.className;(i||n)&&(t.disabled||(d.hasFocus||d.nativeFocus(),d._variable.isCodeView||d._editorRange(),d.actionCall(i,n,t)))},onMouseDown_wysiwyg:function(t){if(r.isNonEditable(e.element.wysiwyg))return;const n=r.getParentElement(t.target,r.isCell);if(n){const e=d.plugins.table;e&&n!==e._fixedCell&&!e._shift&&d.callPlugin("table",(function(){e.onTableCellMultiSelect.call(d,n,!1)}),null)}d._isBalloon&&u._hideToolbar(),/FIGURE/i.test(t.target.nodeName)&&t.preventDefault(),"function"==typeof h.onMouseDown&&h.onMouseDown(t,d)},onClick_wysiwyg:function(t){const n=t.target;if(r.isNonEditable(e.element.wysiwyg))return;const i=d.getFileComponent(n);if(i)return t.preventDefault(),void d.selectComponent(i.target,i.pluginName);const l=r.getParentElement(n,"FIGCAPTION");if(r.isNonEditable(l)&&(t.preventDefault(),l.setAttribute("contenteditable",!0),l.focus(),d._isInline&&!d._inlineToolbarAttr.isShow)){u._showToolbarInline();const e=function(){u._hideToolbar(),l.removeEventListener("blur",e)};l.addEventListener("blur",e)}a.setTimeout(d._editorRange.bind(d)),d._editorRange();const o=d.getSelectionNode(),s=r.getFormatElement(o,null),c=r.getRangeFormatElement(o,null);if(s&&s!==c||r.isNonEditable(n)||r.isList(c))u._applyTagEffects();else{const e=d.getRange();if(r.getFormatElement(e.startContainer)===r.getFormatElement(e.endContainer)){if(r.isList(c)){const e=r.createElement("LI"),t=o.nextElementSibling;e.appendChild(o),c.insertBefore(e,t)}else r.isWysiwygDiv(o)||r.isComponent(o)||r.isTable(o)&&!r.isCell(o)||d._setDefaultFormat(r.isRangeFormatElement(c)?"DIV":"P");t.preventDefault(),d.focus()}}d._isBalloon&&a.setTimeout(u._toggleToolbarBalloon),"function"==typeof h.onClick&&h.onClick(t,d)},_balloonDelay:null,_showToolbarBalloonDelay:function(){u._balloonDelay&&a.clearTimeout(u._balloonDelay),u._balloonDelay=a.setTimeout(function(){a.clearTimeout(this._balloonDelay),this._balloonDelay=null,this._showToolbarBalloon()}.bind(u),350)},_toggleToolbarBalloon:function(){d._editorRange();const e=d.getRange();d._bindControllersOff||!d._isBalloonAlways&&e.collapsed?u._hideToolbar():u._showToolbarBalloon(e)},_showToolbarBalloon:function(t){if(!d._isBalloon)return;const n=t||d.getRange(),i=e.element.toolbar,l=d.getSelection();let o;if(d._isBalloonAlways&&n.collapsed)o=!0;else if(l.focusNode===l.anchorNode)o=l.focusOffset0&&u._getPageBottomSpace()C&&(t=!1,y=!0),y&&(b=(t?n.top-m-g:n.bottom+g)-(n.noText?0:h)+d),i.style.left=a.Math.floor(v)+"px",i.style.top=a.Math.floor(b)+"px",t?(r.removeClass(e.element._arrow,"se-arrow-up"),r.addClass(e.element._arrow,"se-arrow-down"),e.element._arrow.style.top=m+"px"):(r.removeClass(e.element._arrow,"se-arrow-down"),r.addClass(e.element._arrow,"se-arrow-up"),e.element._arrow.style.top=-g+"px");const w=a.Math.floor(p/2+(f-v));e.element._arrow.style.left=(w+g>i.offsetWidth?i.offsetWidth-g:w";const e=f.attributes;for(;e[0];)f.removeAttribute(e[0].name);return d.nativeFocus(),!1}}if(f&&g.startContainer===g.endContainer&&3===c.nodeType&&!r.isFormatElement(c.parentNode)&&(g.collapsed?1===c.textContent.length:g.endOffset-g.startOffset===c.textContent.length)){t.preventDefault();let e=null,n=c.parentNode.previousSibling;const i=c.parentNode.nextSibling;n||(i?(n=i,e=0):(n=r.createElement("BR"),f.appendChild(n))),c.textContent="",r.removeItemAllParents(c,null,f),e="number"==typeof e?e:3===n.nodeType?n.textContent.length:1,d.setRange(n,e,n,e);break}const n=g.commonAncestorContainer;if(f=r.getFormatElement(g.startContainer,null),_=r.getRangeFormatElement(f,null),_&&f&&!r.isCell(_)&&!/^FIGCAPTION$/i.test(_.nodeName)){if(r.isListCell(f)&&r.isList(_)&&(r.isListCell(_.parentNode)||f.previousElementSibling)&&(c===f||3===c.nodeType&&(!c.previousSibling||r.isList(c.previousSibling)))&&(r.getFormatElement(g.startContainer,null)!==r.getFormatElement(g.endContainer,null)?_.contains(g.startContainer):0===g.startOffset&&g.collapsed)){if(g.startContainer!==g.endContainer)t.preventDefault(),d.removeNode(),3===g.startContainer.nodeType&&d.setRange(g.startContainer,g.startContainer.textContent.length,g.startContainer,g.startContainer.textContent.length),d.history.push(!0);else{let e=f.previousElementSibling||_.parentNode;if(r.isListCell(e)){t.preventDefault();let n=e;if(!e.contains(f)&&r.isListCell(n)&&r.isList(n.lastElementChild)){for(n=n.lastElementChild.lastElementChild;r.isListCell(n)&&r.isList(n.lastElementChild);)n=n.lastElementChild&&n.lastElementChild.lastElementChild;e=n}let i=e===_.parentNode?_.previousSibling:e.lastChild;i||(i=r.createTextNode(r.zeroWidthSpace),_.parentNode.insertBefore(i,_.parentNode.firstChild));const l=3===i.nodeType?i.textContent.length:1,o=f.childNodes;let s=i,a=o[0];for(;a=o[0];)e.insertBefore(a,s.nextSibling),s=a;r.removeItem(f),0===_.children.length&&r.removeItem(_),d.setRange(i,l,i,l),d.history.push(!0)}}break}if(!p&&0===g.startOffset){let e=!0,i=n;for(;i&&i!==_&&!r.isWysiwygDiv(i);){if(i.previousSibling&&(1===i.previousSibling.nodeType||!r.onlyZeroWidthSpace(i.previousSibling.textContent.trim()))){e=!1;break}i=i.parentNode}if(e&&_.parentNode){t.preventDefault(),d.detachRangeFormatElement(_,r.isListCell(f)?[f]:null,null,!1,!1),d.history.push(!0);break}}}if(!p&&(0===g.startOffset||c===f&&f.childNodes[g.startOffset])){const e=c===f?f.childNodes[g.startOffset]:c,i=(3===n.nodeType||r.isBreak(n))&&!n.previousSibling&&0===g.startOffset;if(!e.previousSibling&&(r.isComponent(n.previousSibling)||i&&r.isComponent(f.previousSibling))){const e=d.getFileComponent(f.previousSibling);e&&(t.preventDefault(),t.stopPropagation(),0===f.textContent.length&&r.removeItem(f),d.selectComponent(e.target,e.pluginName));break}if(r.isNonEditable(e.previousSibling)){t.preventDefault(),t.stopPropagation(),r.removeItem(e.previousSibling);break}}break;case 46:if(m){t.preventDefault(),t.stopPropagation(),d.plugins[m].destroy.call(d);break}if(p&&u._hardDelete()){t.preventDefault(),t.stopPropagation();break}if((r.isFormatElement(c)||null===c.nextSibling||r.onlyZeroWidthSpace(c.nextSibling)&&null===c.nextSibling.nextSibling)&&g.startOffset===c.textContent.length){let e=f.nextElementSibling;if(!e){t.preventDefault();break}if(r.isComponent(e)){if(t.preventDefault(),r.onlyZeroWidthSpace(f)&&(r.removeItem(f),r.isTable(e))){let t=r.getChildElement(e,r.isCell,!1);t=t.firstElementChild||t,d.setRange(t,0,t,0);break}const n=d.getFileComponent(e);n&&(t.stopPropagation(),d.selectComponent(n.target,n.pluginName));break}}if(!p&&(d.isEdgePoint(g.endContainer,g.endOffset)||c===f&&f.childNodes[g.startOffset])){const e=c===f?f.childNodes[g.startOffset]:c;if(r.isNonEditable(e.nextSibling)){t.preventDefault(),t.stopPropagation(),r.removeItem(e.nextSibling);break}}if(f=r.getFormatElement(g.startContainer,null),_=r.getRangeFormatElement(f,null),r.isListCell(f)&&r.isList(_)&&(c===f||3===c.nodeType&&(!c.nextSibling||r.isList(c.nextSibling))&&(r.getFormatElement(g.startContainer,null)!==r.getFormatElement(g.endContainer,null)?_.contains(g.endContainer):g.endOffset===c.textContent.length&&g.collapsed))){g.startContainer!==g.endContainer&&d.removeNode();let e=r.getArrayItem(f.children,r.isList,!1);if(e=e||f.nextElementSibling||_.parentNode.nextElementSibling,e&&(r.isList(e)||r.getArrayItem(e.children,r.isList,!1))){let n,i;if(t.preventDefault(),r.isList(e)){const t=e.firstElementChild;for(i=t.childNodes,n=i[0];i[0];)f.insertBefore(i[0],e);r.removeItem(t)}else{for(n=e.firstChild,i=e.childNodes;i[0];)f.appendChild(i[0]);r.removeItem(e)}d.setRange(n,0,n,0),d.history.push(!0)}break}break;case 9:if(m||l.tabDisable)break;if(t.preventDefault(),o||s||r.isWysiwygDiv(c))break;const b=!g.collapsed||d.isEdgePoint(g.startContainer,g.startOffset),v=d.getSelectedElements(null);c=d.getSelectionNode();const y=[];let C=[],w=r.isListCell(v[0]),x=r.isListCell(v[v.length-1]),E={sc:g.startContainer,so:g.startOffset,ec:g.endContainer,eo:g.endOffset};for(let e,t=0,n=v.length;t0&&b&&d.plugins.list)E=d.plugins.list.editInsideList.call(d,i,y);else{const e=r.getParentElement(c,r.isCell);if(e&&b){const t=r.getParentElement(e,"table"),n=r.getListChildren(t,r.isCell);let l=i?r.prevIdx(n,e):r.nextIdx(n,e);l!==n.length||i||(l=0),-1===l&&i&&(l=n.length-1);let o=n[l];if(!o)break;o=o.firstElementChild||o,d.setRange(o,0,o,0);break}C=C.concat(y),w=x=null}if(C.length>0)if(i){const e=C.length-1;for(let t,n=0;n<=e;n++){t=C[n].childNodes;for(let e,n=0,i=t.length;n":"<"+f.nodeName+">
    ",!d.checkCharCount(e,"byte-html"))return t.preventDefault(),!1}if(!i&&S){t.preventDefault();const e=c===S,n=d.getSelection(),i=c.childNodes,l=n.focusOffset,o=c.previousElementSibling,s=c.nextSibling;if(!r.isClosureFreeFormatElement(S)&&i&&(e&&g.collapsed&&i.length-1<=l+1&&r.isBreak(i[l])&&(!i[l+1]||(!i[l+2]||r.onlyZeroWidthSpace(i[l+2].textContent))&&3===i[l+1].nodeType&&r.onlyZeroWidthSpace(i[l+1].textContent))&&l>0&&r.isBreak(i[l-1])||!e&&r.onlyZeroWidthSpace(c.textContent)&&r.isBreak(o)&&(r.isBreak(o.previousSibling)||!r.onlyZeroWidthSpace(o.previousSibling.textContent))&&(!s||!r.isBreak(s)&&r.onlyZeroWidthSpace(s.textContent)))){e?r.removeItem(i[l-1]):r.removeItem(c);const t=d.appendFormatTag(S,r.isFormatElement(S.nextElementSibling)?S.nextElementSibling:null);r.copyFormatAttributes(t,S),d.setRange(t,1,t,1);break}if(e){h.insertHTML(g.collapsed&&r.isBreak(g.startContainer.childNodes[g.startOffset-1])?"
    ":"

    ",!0,!1);let e=n.focusNode;const t=n.focusOffset;S===e&&(e=e.childNodes[t-l>1?t-1:t]),d.setRange(e,1,e,1)}else{const e=n.focusNode.nextSibling,t=r.createElement("BR");d.insertNode(t,null,!1);const i=t.previousSibling,l=t.nextSibling;r.isBreak(e)||r.isBreak(i)||l&&!r.onlyZeroWidthSpace(l)?d.setRange(l,0,l,0):(t.parentNode.insertBefore(t.cloneNode(!1),t),d.setRange(t,1,t,1))}u._onShortcutKey=!0;break}if(p)break;if(_&&f&&!r.isCell(_)&&!/^FIGCAPTION$/i.test(_.nodeName)){const e=d.getRange();if(d.isEdgePoint(e.endContainer,e.endOffset)&&r.isList(c.nextSibling)){t.preventDefault();const e=r.createElement("LI"),n=r.createElement("BR");e.appendChild(n),f.parentNode.insertBefore(e,f.nextElementSibling),e.appendChild(c.nextSibling),d.setRange(n,1,n,1);break}if((3!==e.commonAncestorContainer.nodeType||!e.commonAncestorContainer.nextElementSibling)&&r.onlyZeroWidthSpace(f.innerText.trim())){t.preventDefault();let e=null;if(r.isListCell(_.parentNode)){if(_=f.parentNode.parentNode.parentNode,e=r.splitElement(f,null,r.getElementDepth(f)-2),!e){const t=r.createElement("LI");t.innerHTML="
    ",_.insertBefore(t,e),e=t}}else{const t=r.isCell(_.parentNode)?"DIV":r.isList(_.parentNode)?"LI":r.isFormatElement(_.nextElementSibling)?_.nextElementSibling.nodeName:r.isFormatElement(_.previousElementSibling)?_.previousElementSibling.nodeName:"P";e=r.createElement(t);const n=d.detachRangeFormatElement(_,[f],null,!0,!0);n.cc.insertBefore(e,n.ec)}e.innerHTML="
    ",r.copyFormatAttributes(e,f),r.removeItemAllParents(f,null,null),d.setRange(e,1,e,1);break}}if(_&&r.getParentElement(_,"FIGCAPTION")&&r.getParentElement(_,r.isList)&&(t.preventDefault(),f=d.appendFormatTag(f,null),d.setRange(f,0,f,0)),m){t.preventDefault(),t.stopPropagation();const n=e[m],i=n._container,l=i.previousElementSibling||i.nextElementSibling;let o=null;r.isListCell(i.parentNode)?o=r.createElement("BR"):(o=r.createElement(r.isFormatElement(l)?l.nodeName:"P"),o.innerHTML="
    "),i.parentNode.insertBefore(o,i),d.callPlugin(m,(function(){d.selectComponent(n._element,m)}),null)}break;case 27:if(m)return t.preventDefault(),t.stopPropagation(),d.controllersOff(),!1}if(i&&/16/.test(n)){t.preventDefault(),t.stopPropagation();const e=d.plugins.table;if(e&&!e._shift&&!e._ref){const t=r.getParentElement(f,r.isCell);if(t)return void e.onTableCellMultiSelect.call(d,t,!0)}}if(!(o||s||p||u._nonTextKeyCode.test(n))&&g.collapsed&&g.startContainer===g.endContainer&&r.isBreak(g.commonAncestorContainer)){const e=r.createTextNode(r.zeroWidthSpace);d.insertNode(e,null,!1),d.setRange(e,1,e,1)}"function"==typeof h.onKeyDown&&h.onKeyDown(t,d)},onKeyUp_wysiwyg:function(e){if(u._onShortcutKey)return;d._editorRange();const t=d.getRange(),n=e.keyCode,i=e.ctrlKey||e.metaKey||91===n||92===n||224===n,l=e.altKey;let o=d.getSelectionNode();if(d._isBalloon&&(d._isBalloonAlways&&27!==n||!t.collapsed)){if(!d._isBalloonAlways)return void u._showToolbarBalloon();27!==n&&u._showToolbarBalloonDelay()}if(8===n&&r.isWysiwygDiv(o)&&""===o.textContent&&0===o.children.length){e.preventDefault(),e.stopPropagation(),o.innerHTML="";const t=r.createElement(r.isFormatElement(d._variable.currentNodes[0])?d._variable.currentNodes[0]:"P");return t.innerHTML="
    ",o.appendChild(t),d.setRange(t,0,t,0),u._applyTagEffects(),void d.history.push(!1)}const s=r.getFormatElement(o,null),a=r.getRangeFormatElement(o,null);(s||!t.collapsed)&&s!==a||r.isComponent(o)||r.isList(o)||(d._setDefaultFormat(r.isRangeFormatElement(a)?"DIV":"P"),o=d.getSelectionNode()),u._directionKeyCode.test(n)&&u._applyTagEffects();if(!i&&!l&&!u._nonTextKeyCode.test(n)&&3===o.nodeType&&r.zeroWidthRegExp.test(o.textContent)&&!(void 0!==e.isComposing?e.isComposing:u._IEisComposing)){let e=t.startOffset,n=t.endOffset;const i=(o.textContent.substring(0,n).match(u._frontZeroWidthReg)||"").length;e=t.startOffset-i,n=t.endOffset-i,o.textContent=o.textContent.replace(r.zeroWidthRegExp,""),d.setRange(o,e<0?0:e,o,n<0?0:n)}d._charCount(""),d.history.push(!0),"function"==typeof h.onKeyUp&&h.onKeyUp(e,d)},onScroll_wysiwyg:function(e){d.controllersOff(),d._lineBreaker.style.display="none",d._isBalloon&&u._hideToolbar(),"function"==typeof h.onScroll&&h.onScroll(e,d)},onFocus_wysiwyg:function(e){d._antiBlur||(d.hasFocus=!0,d._isInline&&u._showToolbarInline(),"function"==typeof h.onFocus&&h.onFocus(e,d))},onBlur_wysiwyg:function(t){if(d._antiBlur)return;d.hasFocus=!1,d.controllersOff(),(d._isInline||d._isBalloon)&&u._hideToolbar(),"function"==typeof h.onBlur&&h.onBlur(t,d);const i=d.commandMap,o=d.activePlugins;for(let e in i)r.hasOwn(i,e)&&(o.indexOf(e)>-1?n[e].active.call(d,null):i.OUTDENT&&/^OUTDENT$/i.test(e)?i.OUTDENT.setAttribute("disabled",!0):i.INDENT&&/^INDENT$/i.test(e)?i.INDENT.removeAttribute("disabled"):r.removeClass(i[e],"active"));d._variable.currentNodes=[],d._variable.currentNodesMap=[],l.showPathLabel&&(e.element.navigation.textContent="")},onMouseDown_resizingBar:function(t){t.stopPropagation(),d._variable.resizeClientY=t.clientY,e.element.resizeBackground.style.display="block",s.addEventListener("mousemove",u._resize_editor),s.addEventListener("mouseup",(function t(){e.element.resizeBackground.style.display="none",s.removeEventListener("mousemove",u._resize_editor),s.removeEventListener("mouseup",t)}))},_resize_editor:function(t){const n=e.element.editorArea.offsetHeight+(t.clientY-d._variable.resizeClientY);e.element.wysiwygFrame.style.height=e.element.code.style.height=(n=n+o?(d._sticky||u._onStickyToolbar(),t.toolbar.style.top=n+o+l.stickyToolbar-i-d._variable.minResizingSize+"px"):i>=o&&u._onStickyToolbar()},_getEditorOffsets:function(t){let n=t||e.element.topArea,i=0,l=0,o=0;for(;n;)i+=n.offsetTop,l+=n.offsetLeft,o+=n.scrollTop,n=n.offsetParent;return{top:i,left:l,scroll:o}},_getPageBottomSpace:function(){return s.documentElement.scrollHeight-(u._getEditorOffsets(null).top+e.element.topArea.offsetHeight)},_onStickyToolbar:function(){const t=e.element;d._isInline||l.toolbarContainer||(t._stickyDummy.style.height=t.toolbar.offsetHeight+"px",t._stickyDummy.style.display="block"),t.toolbar.style.top=l.stickyToolbar+"px",t.toolbar.style.width=d._isInline?d._inlineToolbarAttr.width:t.toolbar.offsetWidth+"px",r.addClass(t.toolbar,"se-toolbar-sticky"),d._sticky=!0},_offStickyToolbar:function(){const t=e.element;t._stickyDummy.style.display="none",t.toolbar.style.top=d._isInline?d._inlineToolbarAttr.top:"",t.toolbar.style.width=d._isInline?d._inlineToolbarAttr.width:"",t.editorArea.style.marginTop="",r.removeClass(t.toolbar,"se-toolbar-sticky"),d._sticky=!1},_codeViewAutoHeight:function(){e.element.code.style.height=e.element.code.scrollHeight+"px"},_hardDelete:function(){const e=d.getRange(),t=e.startContainer,n=e.endContainer,i=r.getRangeFormatElement(t),l=r.getRangeFormatElement(n),o=r.isCell(i),s=r.isCell(l);if((o&&!i.previousElementSibling&&!i.parentElement.previousElementSibling||s&&!l.nextElementSibling&&!l.parentElement.nextElementSibling)&&i!==l)if(o){if(s)return r.removeItem(r.getParentElement(i,r.isComponent)),d.nativeFocus(),!0;r.removeItem(r.getParentElement(i,r.isComponent))}else r.removeItem(r.getParentElement(l,r.isComponent));const a=1===t.nodeType?r.getParentElement(t,".se-component"):null,c=1===n.nodeType?r.getParentElement(n,".se-component"):null;return a&&r.removeItem(a),c&&r.removeItem(c),!1},onPaste_wysiwyg:function(e){const t=r.isIE?a.clipboardData:e.clipboardData;return!t||u._dataTransferAction("paste",e,t)},_setClipboardComponent:function(e,t,n){e.preventDefault(),e.stopPropagation(),n.setData("text/html",t.component.outerHTML)},onCopy_wysiwyg:function(e){const t=r.isIE?a.clipboardData:e.clipboardData;if("function"==typeof h.onCopy&&!h.onCopy(e,t,d))return e.preventDefault(),e.stopPropagation(),!1;const n=d.currentFileComponentInfo;n&&!r.isIE&&(u._setClipboardComponent(e,n,t),r.addClass(n.component,"se-component-copy"),a.setTimeout((function(){r.removeClass(n.component,"se-component-copy")}),150))},onCut_wysiwyg:function(e){const t=r.isIE?a.clipboardData:e.clipboardData;if("function"==typeof h.onCut&&!h.onCut(e,t,d))return e.preventDefault(),e.stopPropagation(),!1;const n=d.currentFileComponentInfo;n&&!r.isIE&&(u._setClipboardComponent(e,n,t),r.removeItem(n.component),d.controllersOff()),a.setTimeout((function(){d.history.push(!1)}))},onDrop_wysiwyg:function(e){const t=e.dataTransfer;return!t||(r.isIE?(e.preventDefault(),e.stopPropagation(),!1):(d.removeNode(),u._setDropLocationSelection(e),u._dataTransferAction("drop",e,t)))},_setDropLocationSelection:function(e){if(e.rangeParent)d.setRange(e.rangeParent,e.rangeOffset,e.rangeParent,e.rangeOffset);else if(d._wd.caretRangeFromPoint){const t=d._wd.caretRangeFromPoint(e.clientX,e.clientY);d.setRange(t.startContainer,t.startOffset,t.endContainer,t.endOffset)}else{const e=d.getRange();d.setRange(e.startContainer,e.startOffset,e.endContainer,e.endOffset)}},_dataTransferAction:function(t,n,i){let l,o;if(r.isIE){l=i.getData("Text");const s=d.getRange(),c=r.createElement("DIV"),h={sc:s.startContainer,so:s.startOffset,ec:s.endContainer,eo:s.endOffset};return c.setAttribute("contenteditable",!0),c.style.cssText="position:absolute; top:0; left:0; width:1px; height:1px; overflow:hidden;",e.element.relative.appendChild(c),c.focus(),a.setTimeout((function(){o=c.innerHTML,r.removeItem(c),d.setRange(h.sc,h.so,h.ec,h.eo),u._setClipboardData(t,n,l,o,i)})),!0}if(l=i.getData("text/plain"),o=i.getData("text/html"),!1===u._setClipboardData(t,n,l,o,i))return n.preventDefault(),n.stopPropagation(),!1},_setClipboardData:function(e,t,n,i,l){/class=["']*Mso(Normal|List)/i.test(i)||/content=["']*Word.Document/i.test(i)||/content=["']*OneNote.File/i.test(i)?(i=i.replace(/\n/g," "),n=n.replace(/\n/g," ")):n=n.replace(/\n/g,""),i=d.cleanHTML(i,d.pasteTagsWhitelistRegExp);const o=d._charCount(d._charTypeHTML?i:n);if("paste"===e&&"function"==typeof h.onPaste&&!h.onPaste(t,i,o,d))return!1;if("drop"===e&&"function"==typeof h.onDrop&&!h.onDrop(t,l,d))return!1;const s=l.files;return s.length>0?(/^image/.test(s[0].type)&&d.plugins.image&&h.insertImage(s),!1):!!o&&(i?(h.insertHTML(i,!0,!1),!1):void 0)},onMouseMove_wysiwyg:function(t){if(d.isDisabled)return;const n=r.getParentElement(t.target,r.isComponent),i=d._lineBreaker.style;if(n&&!d.currentControllerName){let o=0,s=e.element.wysiwyg;do{o+=s.scrollTop,s=s.parentElement}while(s&&!/^(BODY|HTML)$/i.test(s.nodeName));const a=e.element.wysiwyg.scrollTop,c=u._getEditorOffsets(null),h=r.getOffset(n,e.element.wysiwygFrame).top+a,g=t.pageY+o+(l.iframe&&!l.toolbarContainer?e.element.toolbar.offsetHeight:0),p=h+(l.iframe?o:c.top),m=r.isListCell(n.parentNode);let f="",_="";if((m?!n.previousSibling:!r.isFormatElement(n.previousElementSibling))&&gp+n.offsetHeight-20))return void(i.display="none");_=h+n.offsetHeight,f="b"}d._variable._lineBreakComp=n,d._variable._lineBreakDir=f,i.top=_-a+"px",d._lineBreakerButton.style.left=r.getOffset(n).left+n.offsetWidth/2-15+"px",i.display="block"}else"none"!==i.display&&(i.display="none")},_onMouseDown_lineBreak:function(e){e.preventDefault()},_onLineBreak:function(e){e.preventDefault();const t=d._variable._lineBreakComp,n=this?this:d._variable._lineBreakDir,i=r.isListCell(t.parentNode),l=r.createElement(i?"BR":r.isCell(t.parentNode)?"DIV":"P");if(i||(l.innerHTML="
    "),d._charTypeHTML&&!d.checkCharCount(l.outerHTML,"byte-html"))return;t.parentNode.insertBefore(l,"t"===n?t:t.nextSibling),d._lineBreaker.style.display="none",d._variable._lineBreakComp=null;const o=i?l:l.firstChild;d.setRange(o,1,o,1),d.history.push(!1)},_addEvent:function(){const t=l.iframe?d._ww:e.element.wysiwyg;e.element.toolbar.addEventListener("mousedown",u._buttonsEventHandler,!1),e.element._menuTray.addEventListener("mousedown",u._buttonsEventHandler,!1),e.element.toolbar.addEventListener("click",u.onClick_toolbar,!1),t.addEventListener("mousedown",u.onMouseDown_wysiwyg,!1),t.addEventListener("click",u.onClick_wysiwyg,!1),t.addEventListener(r.isIE?"textinput":"input",u.onInput_wysiwyg,!1),t.addEventListener("keydown",u.onKeyDown_wysiwyg,!1),t.addEventListener("keyup",u.onKeyUp_wysiwyg,!1),t.addEventListener("paste",u.onPaste_wysiwyg,!1),t.addEventListener("copy",u.onCopy_wysiwyg,!1),t.addEventListener("cut",u.onCut_wysiwyg,!1),t.addEventListener("drop",u.onDrop_wysiwyg,!1),t.addEventListener("scroll",u.onScroll_wysiwyg,!1),t.addEventListener("focus",u.onFocus_wysiwyg,!1),t.addEventListener("blur",u.onBlur_wysiwyg,!1),u._lineBreakerBind={a:u._onLineBreak.bind(""),t:u._onLineBreak.bind("t"),b:u._onLineBreak.bind("b")},t.addEventListener("mousemove",u.onMouseMove_wysiwyg,!1),d._lineBreakerButton.addEventListener("mousedown",u._onMouseDown_lineBreak,!1),d._lineBreakerButton.addEventListener("click",u._lineBreakerBind.a,!1),e.element.lineBreaker_t.addEventListener("mousedown",u._lineBreakerBind.t,!1),e.element.lineBreaker_b.addEventListener("mousedown",u._lineBreakerBind.b,!1),d.plugins.table&&t.addEventListener("touchstart",u.onMouseDown_wysiwyg,{passive:!0,useCapture:!1}),"auto"!==l.height||l.codeMirrorEditor||(e.element.code.addEventListener("keydown",u._codeViewAutoHeight,!1),e.element.code.addEventListener("keyup",u._codeViewAutoHeight,!1),e.element.code.addEventListener("paste",u._codeViewAutoHeight,!1)),e.element.resizingBar&&(/\d+/.test(l.height)?e.element.resizingBar.addEventListener("mousedown",u.onMouseDown_resizingBar,!1):r.addClass(e.element.resizingBar,"se-resizing-none")),u._setResponsiveToolbar(),a.removeEventListener("resize",u.onResize_window),a.removeEventListener("scroll",u.onScroll_window),a.addEventListener("resize",u.onResize_window,!1),l.stickyToolbar>-1&&a.addEventListener("scroll",u.onScroll_window,!1)},_removeEvent:function(){const t=l.iframe?d._ww:e.element.wysiwyg;e.element.toolbar.removeEventListener("mousedown",u._buttonsEventHandler),e.element._menuTray.removeEventListener("mousedown",u._buttonsEventHandler),e.element.toolbar.removeEventListener("click",u.onClick_toolbar),t.removeEventListener("mousedown",u.onMouseDown_wysiwyg),t.removeEventListener("click",u.onClick_wysiwyg),t.removeEventListener(r.isIE?"textinput":"input",u.onInput_wysiwyg),t.removeEventListener("keydown",u.onKeyDown_wysiwyg),t.removeEventListener("keyup",u.onKeyUp_wysiwyg),t.removeEventListener("paste",u.onPaste_wysiwyg),t.removeEventListener("copy",u.onCopy_wysiwyg),t.removeEventListener("cut",u.onCut_wysiwyg),t.removeEventListener("drop",u.onDrop_wysiwyg),t.removeEventListener("scroll",u.onScroll_wysiwyg),t.removeEventListener("mousemove",u.onMouseMove_wysiwyg),d._lineBreakerButton.removeEventListener("mousedown",u._onMouseDown_lineBreak),d._lineBreakerButton.removeEventListener("click",u._lineBreakerBind.a),e.element.lineBreaker_t.removeEventListener("mousedown",u._lineBreakerBind.t),e.element.lineBreaker_b.removeEventListener("mousedown",u._lineBreakerBind.b),u._lineBreakerBind=null,t.removeEventListener("touchstart",u.onMouseDown_wysiwyg,{passive:!0,useCapture:!1}),t.removeEventListener("focus",u.onFocus_wysiwyg),t.removeEventListener("blur",u.onBlur_wysiwyg),e.element.code.removeEventListener("keydown",u._codeViewAutoHeight),e.element.code.removeEventListener("keyup",u._codeViewAutoHeight),e.element.code.removeEventListener("paste",u._codeViewAutoHeight),e.element.resizingBar&&e.element.resizingBar.removeEventListener("mousedown",u.onMouseDown_resizingBar),a.removeEventListener("resize",u.onResize_window),a.removeEventListener("scroll",u.onScroll_window)},_setResponsiveToolbar:function(){if(0===o.length)return void(o=null);const e=u._responsiveButtonSize=["default"],t=u._responsiveButtons={default:o[0]};for(let n,i,l=1,s=o.length;l",e}};return void 0===t&&(e.SUNEDITOR_MODULES||Object.defineProperty(e,"SUNEDITOR_MODULES",{enumerable:!0,writable:!1,configurable:!1,value:{}}),Object.defineProperty(e.SUNEDITOR_MODULES,"component",{enumerable:!0,writable:!1,configurable:!1,value:n})),n},"object"==typeof e.exports?e.exports=i.document?l(i,!0):function(e){if(!e.document)throw new Error("SUNEDITOR_MODULES a window with a document");return l(e)}:l(i)},ee5k:function(e,t,n){"use strict";var i,l;i="undefined"!=typeof window?window:this,l=function(e,t){const n={name:"resizing",add:function(e){const t=e.icons,n=e.context;n.resizing={_resizeClientX:0,_resizeClientY:0,_resize_plugin:"",_resize_w:0,_resize_h:0,_origin_w:0,_origin_h:0,_rotateVertical:!1,_resize_direction:"",_move_path:null,_isChange:!1,alignIcons:{basic:t.align_justify,left:t.align_left,right:t.align_right,center:t.align_center}};let i=this.setController_resize.call(e);n.resizing.resizeContainer=i,n.resizing.resizeDiv=i.querySelector(".se-modal-resize"),n.resizing.resizeDot=i.querySelector(".se-resize-dot"),n.resizing.resizeDisplay=i.querySelector(".se-resize-display");let l=this.setController_button.call(e);n.resizing.resizeButton=l;let o=n.resizing.resizeHandles=n.resizing.resizeDot.querySelectorAll("span");n.resizing.resizeButtonGroup=l.querySelector("._se_resizing_btn_group"),n.resizing.rotationButtons=l.querySelectorAll("._se_resizing_btn_group ._se_rotation"),n.resizing.percentageButtons=l.querySelectorAll("._se_resizing_btn_group ._se_percentage"),n.resizing.alignMenu=l.querySelector(".se-resizing-align-list"),n.resizing.alignMenuList=n.resizing.alignMenu.querySelectorAll("button"),n.resizing.alignButton=l.querySelector("._se_resizing_align_button"),n.resizing.autoSizeButton=l.querySelector("._se_resizing_btn_group ._se_auto_size"),n.resizing.captionButton=l.querySelector("._se_resizing_caption_button"),i.addEventListener("mousedown",(function(e){e.preventDefault()})),l.addEventListener("mousedown",e.eventStop),o[0].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),o[1].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),o[2].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),o[3].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),o[4].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),o[5].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),o[6].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),o[7].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),l.addEventListener("click",this.onClick_resizeButton.bind(e)),n.element.relative.appendChild(i),n.element.relative.appendChild(l),i=null,l=null,o=null},setController_resize:function(){const e=this.util.createElement("DIV");return e.className="se-controller se-resizing-container",e.style.display="none",e.innerHTML='
    ',e},setController_button:function(){const e=this.lang,t=this.icons,n=this.util.createElement("DIV");return n.className="se-controller se-controller-resizing",n.innerHTML='
    ",n},_module_getSizeX:function(e,t,n,i){return t||(t=e._element),n||(n=e._cover),i||(i=e._container),t?/%$/.test(t.style.width)?(i&&this.util.getNumber(i.style.width,2)||100)+"%":t.style.width:""},_module_getSizeY:function(e,t,n,i){return t||(t=e._element),n||(n=e._cover),i||(i=e._container),i&&n?this.util.getNumber(n.style.paddingBottom,0)>0&&!this.context.resizing._rotateVertical?n.style.height:/%$/.test(t.style.height)&&/%$/.test(t.style.width)?(i&&this.util.getNumber(i.style.height,2)||100)+"%":t.style.height:t&&t.style.height||""},_module_setModifyInputSize:function(e,t){const n=e._onlyPercentage&&this.context.resizing._rotateVertical;e.proportion.checked=e._proportionChecked="false"!==e._element.getAttribute("data-proportion");let i=n?"":this.plugins.resizing._module_getSizeX.call(this,e);if(i===e._defaultSizeX&&(i=""),e._onlyPercentage&&(i=this.util.getNumber(i,2)),e.inputX.value=i,t.setInputSize.call(this,"x"),!e._onlyPercentage){let t=n?"":this.plugins.resizing._module_getSizeY.call(this,e);t===e._defaultSizeY&&(t=""),e._onlyPercentage&&(t=this.util.getNumber(t,2)),e.inputY.value=t}e.inputX.disabled=!!n,e.inputY.disabled=!!n,e.proportion.disabled=!!n,t.setRatio.call(this)},_module_setInputSize:function(e,t){if(e._onlyPercentage)"x"===t&&e.inputX.value>100&&(e.inputX.value=100);else if(e.proportion.checked&&e._ratio&&/\d/.test(e.inputX.value)&&/\d/.test(e.inputY.value)){const n=e.inputX.value.replace(/\d+|\./g,"")||e.sizeUnit,i=e.inputY.value.replace(/\d+|\./g,"")||e.sizeUnit;if(n!==i)return;const l="%"===n?2:0;"x"===t?e.inputY.value=this.util.getNumber(e._ratioY*this.util.getNumber(e.inputX.value,l),l)+i:e.inputX.value=this.util.getNumber(e._ratioX*this.util.getNumber(e.inputY.value,l),l)+n}},_module_setRatio:function(e){const t=e.inputX.value,n=e.inputY.value;if(e.proportion.checked&&/\d+/.test(t)&&/\d+/.test(n)){if((t.replace(/\d+|\./g,"")||e.sizeUnit)!==(n.replace(/\d+|\./g,"")||e.sizeUnit))e._ratio=!1;else if(!e._ratio){const i=this.util.getNumber(t,0),l=this.util.getNumber(n,0);e._ratio=!0,e._ratioX=i/l,e._ratioY=l/i}}else e._ratio=!1},_module_sizeRevert:function(e){e._onlyPercentage?e.inputX.value=e._origin_w>100?100:e._origin_w:(e.inputX.value=e._origin_w,e.inputY.value=e._origin_h)},_module_saveCurrentSize:function(e){const t=this.plugins.resizing._module_getSizeX.call(this,e),n=this.plugins.resizing._module_getSizeY.call(this,e);e._element.setAttribute("data-size",t+","+n),e._videoRatio&&(e._videoRatio=n)},call_controller_resize:function(e,t){const n=this.context.resizing,i=this.context[t];n._resize_plugin=t;const l=n.resizeContainer,o=n.resizeDiv,s=this.util.getOffset(e,this.context.element.wysiwygFrame),a=n._rotateVertical=/^(90|270)$/.test(Math.abs(e.getAttribute("data-rotate")).toString()),r=a?e.offsetHeight:e.offsetWidth,c=a?e.offsetWidth:e.offsetHeight,d=s.top,u=s.left-this.context.element.wysiwygFrame.scrollLeft;l.style.top=d+"px",l.style.left=u+"px",l.style.width=r+"px",l.style.height=c+"px",o.style.top="0px",o.style.left="0px",o.style.width=r+"px",o.style.height=c+"px";let h=e.getAttribute("data-align")||"basic";h="none"===h?"basic":h;const g=this.util.getParentElement(e,this.util.isComponent),p=this.util.getParentElement(e,"FIGURE"),m=this.plugins.resizing._module_getSizeX.call(this,i,e,p,g)||"auto",f=i._onlyPercentage&&"image"===t?"":", "+(this.plugins.resizing._module_getSizeY.call(this,i,e,p,g)||"auto");this.util.changeTxt(n.resizeDisplay,this.lang.dialogBox[h]+" ("+m+f+")"),n.resizeButtonGroup.style.display=i._resizing?"":"none";const _=!i._resizing||i._resizeDotHide||i._onlyPercentage?"none":"flex",b=n.resizeHandles;for(let e=0,t=b.length;e=360?0:d;s.setAttribute("data-rotate",u),c._rotateVertical=/^(90|270)$/.test(this._w.Math.abs(u).toString()),this.plugins.resizing.setTransformSize.call(this,s,null,null),this.selectComponent(s,l);break;case"onalign":return void this.plugins.resizing.openAlignMenu.call(this);case"align":const h="basic"===i?"none":i;a.setAlign.call(this,h,null,null,null),this.selectComponent(s,l);break;case"caption":const g=!o._captionChecked;if(a.openModify.call(this,!0),o._captionChecked=o.captionCheckEl.checked=g,a.update_image.call(this,!1,!1,!1),g){const e=this.util.getChildElement(o._caption,(function(e){return 3===e.nodeType}));e?this.setRange(e,0,e,e.textContent.length):o._caption.focus(),this.controllersOff()}else this.selectComponent(s,l),a.openModify.call(this,!0);break;case"revert":a.setOriginSize.call(this),this.selectComponent(s,l);break;case"update":a.openModify.call(this),this.controllersOff();break;case"delete":a.destroy.call(this)}this.history.push(!1)}},resetTransform:function(e){const t=(e.getAttribute("data-size")||e.getAttribute("data-origin")||"").split(",");this.context.resizing._rotateVertical=!1,e.style.maxWidth="",e.style.transform="",e.style.transformOrigin="",e.setAttribute("data-rotate",""),e.setAttribute("data-rotateX",""),e.setAttribute("data-rotateY",""),this.plugins[this.context.resizing._resize_plugin].setSize.call(this,t[0]?t[0]:"auto",t[1]?t[1]:"",!0)},setTransformSize:function(e,t,n){let i=e.getAttribute("data-percentage");const l=this.context.resizing._rotateVertical,o=1*e.getAttribute("data-rotate");let s="";if(i&&!l)i=i.split(","),"auto"===i[0]&&"auto"===i[1]?this.plugins[this.context.resizing._resize_plugin].setAutoSize.call(this):this.plugins[this.context.resizing._resize_plugin].setPercentSize.call(this,i[0],i[1]);else{const i=this.util.getParentElement(e,"FIGURE"),a=t||e.offsetWidth,r=n||e.offsetHeight,c=(l?r:a)+"px",d=(l?a:r)+"px";if(this.plugins[this.context.resizing._resize_plugin].cancelPercentAttr.call(this),this.plugins[this.context.resizing._resize_plugin].setSize.call(this,a+"px",r+"px",!0),i.style.width=c,i.style.height=this.context[this.context.resizing._resize_plugin]._caption?"":d,l){let e=a/2+"px "+a/2+"px 0",t=r/2+"px "+r/2+"px 0";s=90===o||-270===o?t:e}}e.style.transformOrigin=s,this.plugins.resizing._setTransForm(e,o.toString(),e.getAttribute("data-rotateX")||"",e.getAttribute("data-rotateY")||""),e.style.maxWidth=l?"none":"",this.plugins.resizing.setCaptionPosition.call(this,e)},_setTransForm:function(e,t,n,i){let l=(e.offsetWidth-e.offsetHeight)*(/-/.test(t)?1:-1),o="";if(/[1-9]/.test(t)&&(n||i))switch(o=n?"Y":"X",t){case"90":o=n&&i?"X":i?o:"";break;case"270":l*=-1,o=n&&i?"Y":n?o:"";break;case"-90":o=n&&i?"Y":n?o:"";break;case"-270":l*=-1,o=n&&i?"X":i?o:"";break;default:o=""}t%180==0&&(e.style.maxWidth=""),e.style.transform="rotate("+t+"deg)"+(n?" rotateX("+n+"deg)":"")+(i?" rotateY("+i+"deg)":"")+(o?" translate"+o+"("+l+"px)":"")},setCaptionPosition:function(e){const t=this.util.getChildElement(this.util.getParentElement(e,"FIGURE"),"FIGCAPTION");t&&(t.style.marginTop=(this.context.resizing._rotateVertical?e.offsetWidth-e.offsetHeight:0)+"px")},onMouseDown_resize_handle:function(e){e.stopPropagation(),e.preventDefault();const t=this.context.resizing,n=t._resize_direction=e.target.classList[0];t._resizeClientX=e.clientX,t._resizeClientY=e.clientY,this.context.element.resizeBackground.style.display="block",t.resizeButton.style.display="none",t.resizeDiv.style.float=/l/.test(n)?"right":/r/.test(n)?"left":"none";const i=function(e){if("keydown"===e.type&&27!==e.keyCode)return;const o=t._isChange;t._isChange=!1,this.removeDocEvent("mousemove",l),this.removeDocEvent("mouseup",i),this.removeDocEvent("keydown",i),"keydown"===e.type?(this.controllersOff(),this.context.element.resizeBackground.style.display="none",this.plugins[this.context.resizing._resize_plugin].init.call(this)):(this.plugins.resizing.cancel_controller_resize.call(this,n),o&&this.history.push(!1))}.bind(this),l=this.plugins.resizing.resizing_element.bind(this,t,n,this.context[t._resize_plugin]);this.addDocEvent("mousemove",l),this.addDocEvent("mouseup",i),this.addDocEvent("keydown",i)},resizing_element:function(e,t,n,i){const l=i.clientX,o=i.clientY;let s=n._element_w,a=n._element_h;const r=n._element_w+(/r/.test(t)?l-e._resizeClientX:e._resizeClientX-l),c=n._element_h+(/b/.test(t)?o-e._resizeClientY:e._resizeClientY-o),d=n._element_h/n._element_w*r;/t/.test(t)&&(e.resizeDiv.style.top=n._element_h-(/h/.test(t)?c:d)+"px"),/l/.test(t)&&(e.resizeDiv.style.left=n._element_w-r+"px"),/r|l/.test(t)&&(e.resizeDiv.style.width=r+"px",s=r),/^(t|b)[^h]$/.test(t)?(e.resizeDiv.style.height=d+"px",a=d):/^(t|b)h$/.test(t)&&(e.resizeDiv.style.height=c+"px",a=c),e._resize_w=s,e._resize_h=a,this.util.changeTxt(e.resizeDisplay,this._w.Math.round(s)+" x "+this._w.Math.round(a)),e._isChange=!0},cancel_controller_resize:function(e){const t=this.context.resizing._rotateVertical;this.controllersOff(),this.context.element.resizeBackground.style.display="none";let n=this._w.Math.round(t?this.context.resizing._resize_h:this.context.resizing._resize_w),i=this._w.Math.round(t?this.context.resizing._resize_w:this.context.resizing._resize_h);if(!t&&!/%$/.test(n)){const e=16,t=this.context.element.wysiwygFrame.clientWidth-2*e-2;this.util.getNumber(n,0)>t&&(i=this._w.Math.round(i/n*t),n=t)}const l=this.context.resizing._resize_plugin;this.plugins[l].setSize.call(this,n,i,!1,e),this.selectComponent(this.context[l]._element,l)}};return void 0===t&&(e.SUNEDITOR_MODULES||Object.defineProperty(e,"SUNEDITOR_MODULES",{enumerable:!0,writable:!1,configurable:!1,value:{}}),Object.defineProperty(e.SUNEDITOR_MODULES,"resizing",{enumerable:!0,writable:!1,configurable:!1,value:n})),n},"object"==typeof e.exports?e.exports=i.document?l(i,!0):function(e){if(!e.document)throw new Error("SUNEDITOR_MODULES a window with a document");return l(e)}:l(i)},"gjS+":function(e,t,n){"use strict";var i,l;i="undefined"!=typeof window?window:this,l=function(e,t){const n={name:"fileManager",_xmlHttp:null,upload:function(e,t,n,i,l){this.showLoading();const o=this.plugins.fileManager,s=o._xmlHttp=this.util.getXMLHttpRequest();if(s.onreadystatechange=o._callBackUpload.bind(this,s,i,l),s.open("post",e,!0),null!==t&&"object"==typeof t&&this._w.Object.keys(t).length>0)for(let e in t)s.setRequestHeader(e,t[e]);s.send(n)},_callBackUpload:function(e,t,n){if(4===e.readyState)if(200===e.status)try{t(e)}catch(e){throw Error('[SUNEDITOR.fileManager.upload.callBack.fail] cause : "'+e.message+'"')}finally{this.closeLoading()}else{this.closeLoading();const t=e.responseText?JSON.parse(e.responseText):e;if("function"!=typeof n||n("",t,this)){const n="[SUNEDITOR.fileManager.upload.serverException] status: "+e.status+", response: "+(t.errorMessage||e.responseText);throw this.functions.noticeOpen(n),Error(n)}}},checkInfo:function(e,t,n,i,l){let o=[];for(let e=0,n=t.length;e-1||(a.splice(t,1),"function"==typeof n&&n(null,e,"delete",null,0,this),t--);l&&(this.context.resizing._resize_plugin=c)},setInfo:function(e,t,n,i,l){const o=l?this.context.resizing._resize_plugin:"";l&&(this.context.resizing._resize_plugin=e);const s=this.plugins[e],a=this.context[e],r=a._infoList;let c=t.getAttribute("data-index"),d=null,u="";if(i||(i={name:t.getAttribute("data-file-name")||("string"==typeof t.src?t.src.split("/").pop():""),size:t.getAttribute("data-file-size")||0}),!c||this._componentsInfoInit)u="create",c=a._infoIndex++,t.setAttribute("data-index",c),t.setAttribute("data-file-name",i.name),t.setAttribute("data-file-size",i.size),d={src:t.src,index:1*c,name:i.name,size:i.size},r.push(d);else{u="update",c*=1;for(let e=0,t=r.length;e=0){const i=this.context[e]._infoList;for(let e=0,l=i.length;e
    '},_onMouseDown_browser:function(e){/se-file-browser-inner/.test(e.target.className)?this.context.fileBrowser._closeSignal=!0:this.context.fileBrowser._closeSignal=!1},_onClick_browser:function(e){e.stopPropagation(),(/close/.test(e.target.getAttribute("data-command"))||this.context.fileBrowser._closeSignal)&&this.plugins.fileBrowser.close.call(this)},open:function(e,t){this.plugins.fileBrowser._bindClose&&(this._d.removeEventListener("keydown",this.plugins.fileBrowser._bindClose),this.plugins.fileBrowser._bindClose=null),this.plugins.fileBrowser._bindClose=function(e){/27/.test(e.keyCode)&&this.plugins.fileBrowser.close.call(this)}.bind(this),this._d.addEventListener("keydown",this.plugins.fileBrowser._bindClose);const n=this.context.fileBrowser;n.contextPlugin=e,n.selectorHandler=t;const i=this.context[e],l=i.listClass;this.util.hasClass(n.list,l)||(n.list.className="se-file-browser-list "+l),"full"===this.context.option.popupDisplay?n.area.style.position="fixed":n.area.style.position="absolute",n.titleArea.textContent=i.title,n.area.style.display="block",this.plugins.fileBrowser._drawFileList.call(this,this.context[e].url)},_bindClose:null,close:function(){const e=this.plugins.fileBrowser;e._xmlHttp&&e._xmlHttp.abort(),e._bindClose&&(this._d.removeEventListener("keydown",e._bindClose),e._bindClose=null);const t=this.context.fileBrowser;t.area.style.display="none",t.selectorHandler=null,t.selectedTags=[],t.items=[],t.list.innerHTML=t.tagArea.innerHTML=t.titleArea.textContent="","function"==typeof this.plugins[t.contextPlugin].init&&this.plugins[t.contextPlugin].init.call(this),t.contextPlugin=""},showBrowserLoading:function(){this._loading.style.display="block"},closeBrowserLoading:function(){this._loading.style.display="none"},_drawFileList:function(e){const t=this.plugins.fileBrowser,n=t._xmlHttp=this.util.getXMLHttpRequest();n.onreadystatechange=t._callBackGet.bind(this,n),n.open("get",e,!0),n.send(null),this.plugins.fileBrowser.showBrowserLoading()},_callBackGet:function(e){if(4===e.readyState)if(this.plugins.fileBrowser._xmlHttp=null,200===e.status)try{this.plugins.fileBrowser._drawListItem.call(this,JSON.parse(e.responseText).result,!0)}catch(e){throw Error('[SUNEDITOR.fileBrowser.drawList.fail] cause : "'+e.message+'"')}finally{this.plugins.fileBrowser.closeBrowserLoading(),this.context.fileBrowser.body.style.maxHeight=this._w.innerHeight-this.context.fileBrowser.header.offsetHeight-50+"px"}else if(this.plugins.fileBrowser.closeBrowserLoading(),0!==e.status){const t=e.responseText?JSON.parse(e.responseText):e,n="[SUNEDITOR.fileBrowser.get.serverException] status: "+e.status+", response: "+(t.errorMessage||e.responseText);throw Error(n)}},_drawListItem:function(e,t){const n=this.context.fileBrowser,i=this.context[n.contextPlugin],l=[],o=e.length,s=i.columnSize||n.columnSize,a=s<=1?1:Math.round(o/s)||1,r=i.itemTemplateHandler;let c="",d='
    ',u=1;for(let n,i,h=0;h
    '),t&&i.length>0)for(let e,t=0,n=i.length;t'+e+"");d+="
    ",n.list.innerHTML=d,t&&(n.items=e,n.tagArea.innerHTML=c,n.tagElements=n.tagArea.querySelectorAll("A"))},onClickTag:function(e){const t=e.target;if(!this.util.isAnchor(t))return;const n=t.textContent,i=this.plugins.fileBrowser,l=this.context.fileBrowser,o=l.tagArea.querySelector('a[title="'+n+'"]'),s=l.selectedTags,a=s.indexOf(n);a>-1?(s.splice(a,1),this.util.removeClass(o,"on")):(s.push(n),this.util.addClass(o,"on")),i._drawListItem.call(this,0===s.length?l.items:l.items.filter((function(e){return e.tag.some((function(e){return s.indexOf(e)>-1}))})),!1)},onClickFile:function(e){e.preventDefault(),e.stopPropagation();const t=this.context.fileBrowser,n=t.list;let i=e.target,l=null;if(i===n)return;for(;n!==i.parentNode&&(l=i.getAttribute("data-command"),!l);)i=i.parentNode;if(!l)return;const o=t.selectorHandler||this.context[t.contextPlugin].selectorHandler;this.plugins.fileBrowser.close.call(this),o(i)}};return void 0===t&&(e.SUNEDITOR_MODULES||Object.defineProperty(e,"SUNEDITOR_MODULES",{enumerable:!0,writable:!1,configurable:!1,value:{}}),Object.defineProperty(e.SUNEDITOR_MODULES,"fileBrowser",{enumerable:!0,writable:!1,configurable:!1,value:n})),n},"object"==typeof e.exports?e.exports=i.document?l(i,!0):function(e){if(!e.document)throw new Error("SUNEDITOR_MODULES a window with a document");return l(e)}:l(i)},P6u4:function(e,t,n){"use strict";var i,l;i="undefined"!=typeof window?window:this,l=function(e,t){const n={code:"en",toolbar:{default:"Default",save:"Save",font:"Font",formats:"Formats",fontSize:"Size",bold:"Bold",underline:"Underline",italic:"Italic",strike:"Strike",subscript:"Subscript",superscript:"Superscript",removeFormat:"Remove Format",fontColor:"Font Color",hiliteColor:"Highlight Color",indent:"Indent",outdent:"Outdent",align:"Align",alignLeft:"Align left",alignRight:"Align right",alignCenter:"Align center",alignJustify:"Align justify",list:"List",orderList:"Ordered list",unorderList:"Unordered list",horizontalRule:"Horizontal line",hr_solid:"Solid",hr_dotted:"Dotted",hr_dashed:"Dashed",table:"Table",link:"Link",math:"Math",image:"Image",video:"Video",audio:"Audio",fullScreen:"Full screen",showBlocks:"Show blocks",codeView:"Code view",undo:"Undo",redo:"Redo",preview:"Preview",print:"print",tag_p:"Paragraph",tag_div:"Normal (DIV)",tag_h:"Header",tag_blockquote:"Quote",tag_pre:"Code",template:"Template",lineHeight:"Line height",paragraphStyle:"Paragraph style",textStyle:"Text style",imageGallery:"Image gallery"},dialogBox:{linkBox:{title:"Insert Link",url:"URL to link",text:"Text to display",newWindowCheck:"Open in new window"},mathBox:{title:"Math",inputLabel:"Mathematical Notation",fontSizeLabel:"Font Size",previewLabel:"Preview"},imageBox:{title:"Insert image",file:"Select from files",url:"Image URL",altText:"Alternative text"},videoBox:{title:"Insert Video",file:"Select from files",url:"Media embed URL, YouTube/Vimeo"},audioBox:{title:"Insert Audio",file:"Select from files",url:"Audio URL"},browser:{tags:"Tags",search:"Search"},mentionBox:{title:"Add Mention"},caption:"Insert description",close:"Close",submitButton:"Submit",revertButton:"Revert",proportion:"Constrain proportions",basic:"Basic",left:"Left",right:"Right",center:"Center",width:"Width",height:"Height",size:"Size",ratio:"Ratio"},controller:{edit:"Edit",unlink:"Unlink",remove:"Remove",insertRowAbove:"Insert row above",insertRowBelow:"Insert row below",deleteRow:"Delete row",insertColumnBefore:"Insert column before",insertColumnAfter:"Insert column after",deleteColumn:"Delete column",fixedColumnWidth:"Fixed column width",resize100:"Resize 100%",resize75:"Resize 75%",resize50:"Resize 50%",resize25:"Resize 25%",autoSize:"Auto size",mirrorHorizontal:"Mirror, Horizontal",mirrorVertical:"Mirror, Vertical",rotateLeft:"Rotate left",rotateRight:"Rotate right",maxSize:"Max size",minSize:"Min size",tableHeader:"Table header",mergeCells:"Merge cells",splitCells:"Split Cells",HorizontalSplit:"Horizontal split",VerticalSplit:"Vertical split"},menu:{spaced:"Spaced",bordered:"Bordered",neon:"Neon",translucent:"Translucent",shadow:"Shadow",code:"Code"}};return void 0===t&&(e.SUNEDITOR_LANG||Object.defineProperty(e,"SUNEDITOR_LANG",{enumerable:!0,writable:!1,configurable:!1,value:{}}),Object.defineProperty(e.SUNEDITOR_LANG,"en",{enumerable:!0,writable:!0,configurable:!0,value:n})),n},"object"==typeof e.exports?e.exports=i.document?l(i,!0):function(e){if(!e.document)throw new Error("SUNEDITOR_LANG a window with a document");return l(e)}:l(i)},WUQj:function(e,t,n){},XJR1:function(e,t,n){"use strict";n.r(t);n("3FqI"),n("WUQj");var i={name:"colorPicker",add:function(e){const t=e.context;t.colorPicker={colorListHTML:"",_colorInput:"",_defaultColor:"#000",_styleProperty:"color",_currentColor:"",_colorList:[]};let n=this.createColorList(e,this._makeColorList);t.colorPicker.colorListHTML=n,n=null},createColorList:function(e,t){const n=e.context.option,i=e.lang,l=n.colorList&&0!==n.colorList.length?n.colorList:["#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"];let o=[],s='
    ';for(let e,n=0,i=l.length;n0&&(s+='
    '+t(o)+"
    ",o=[]),"object"==typeof e&&(s+='
    '+t(e)+"
    ")));return s+='
    ",s},_makeColorList:function(e){let t="";t+='
      ';for(let n,i=0,l=e.length;i');return t+="
    ",t},init:function(e,t){const n=this.plugins.colorPicker;let i=t||(n.getColorInNode.call(this,e)||this.context.colorPicker._defaultColor);i=n.isHexColor(i)?i:n.rgb2hex(i)||i;const l=this.context.colorPicker._colorList;if(l)for(let e=0,t=l.length;e=3&&"#"+((1<<24)+(n[0]<<16)+(n[1]<<8)+n[2]).toString(16).substr(1)}},l={name:"fontColor",display:"submenu",add:function(e,t){e.addModule([i]);const n=e.context;n.fontColor={previewEl:null,colorInput:null,colorList:null};let l=this.setSubmenu.call(e);n.fontColor.colorInput=l.querySelector("._se_color_picker_input"),n.fontColor.colorInput.addEventListener("keyup",this.onChangeInput.bind(e)),l.querySelector("._se_color_picker_submit").addEventListener("click",this.submit.bind(e)),l.querySelector("._se_color_picker_remove").addEventListener("click",this.remove.bind(e)),l.addEventListener("click",this.pickup.bind(e)),n.fontColor.colorList=l.querySelectorAll("li button"),e.initMenuTarget(this.name,t,l),l=null},setSubmenu:function(){const e=this.context.colorPicker.colorListHTML,t=this.util.createElement("DIV");return t.className="se-submenu se-list-layer",t.innerHTML=e,t},on:function(){const e=this.context.colorPicker,t=this.context.fontColor;e._colorInput=t.colorInput,e._defaultColor="#333333",e._styleProperty="color",e._colorList=t.colorList,this.plugins.colorPicker.init.call(this,this.getSelectionNode(),null)},onChangeInput:function(e){this.plugins.colorPicker.setCurrentColor.call(this,e.target.value)},submit:function(){this.plugins.fontColor.applyColor.call(this,this.context.colorPicker._currentColor)},pickup:function(e){e.preventDefault(),e.stopPropagation(),this.plugins.fontColor.applyColor.call(this,e.target.getAttribute("data-value"))},remove:function(){this.nodeChange(null,["color"],["span"],!0),this.submenuOff()},applyColor:function(e){if(!e)return;const t=this.util.createElement("SPAN");t.style.color=e,this.nodeChange(t,["color"],null,null),this.submenuOff()}},o={name:"hiliteColor",display:"submenu",add:function(e,t){e.addModule([i]);const n=e.context;n.hiliteColor={previewEl:null,colorInput:null,colorList:null};let l=this.setSubmenu.call(e);n.hiliteColor.colorInput=l.querySelector("._se_color_picker_input"),n.hiliteColor.colorInput.addEventListener("keyup",this.onChangeInput.bind(e)),l.querySelector("._se_color_picker_submit").addEventListener("click",this.submit.bind(e)),l.querySelector("._se_color_picker_remove").addEventListener("click",this.remove.bind(e)),l.addEventListener("click",this.pickup.bind(e)),n.hiliteColor.colorList=l.querySelectorAll("li button"),e.initMenuTarget(this.name,t,l),l=null},setSubmenu:function(){const e=this.context.colorPicker.colorListHTML,t=this.util.createElement("DIV");return t.className="se-submenu se-list-layer",t.innerHTML=e,t},on:function(){const e=this.context.colorPicker,t=this.context.hiliteColor;e._colorInput=t.colorInput,e._defaultColor="#FFFFFF",e._styleProperty="backgroundColor",e._colorList=t.colorList,this.plugins.colorPicker.init.call(this,this.getSelectionNode(),null)},onChangeInput:function(e){this.plugins.colorPicker.setCurrentColor.call(this,e.target.value)},submit:function(){this.plugins.hiliteColor.applyColor.call(this,this.context.colorPicker._currentColor)},pickup:function(e){e.preventDefault(),e.stopPropagation(),this.plugins.hiliteColor.applyColor.call(this,e.target.getAttribute("data-value"))},remove:function(){this.nodeChange(null,["background-color"],["span"],!0),this.submenuOff()},applyColor:function(e){if(!e)return;const t=this.util.createElement("SPAN");t.style.backgroundColor=e,this.nodeChange(t,["background-color"],null,null),this.submenuOff()}},s={name:"template",display:"submenu",add:function(e,t){e.context.template={};let n=this.setSubmenu.call(e);n.querySelector("ul").addEventListener("click",this.pickup.bind(e)),e.initMenuTarget(this.name,t,n),n=null},setSubmenu:function(){const e=this.context.option.templates;if(!e||0===e.length)throw Error('[SUNEDITOR.plugins.template.fail] To use the "template" plugin, please define the "templates" option.');const t=this.util.createElement("DIV");t.className="se-list-layer";let n='
      ';for(let t,i=0,l=e.length;i";return n+="
    ",t.innerHTML=n,t},pickup:function(e){if(!/^BUTTON$/i.test(e.target.tagName))return!1;e.preventDefault(),e.stopPropagation();const t=this.context.option.templates[e.target.getAttribute("data-value")];if(!t.html)throw this.submenuOff(),Error('[SUNEDITOR.template.fail] cause : "templates[i].html not found"');this.setContents(t.html),this.submenuOff()}},a=n("1kvd"),r=n.n(a),c={name:"link",display:"dialog",add:function(e){e.addModule([r.a]);const t=e.context;t.link={focusElement:null,linkNewWindowCheck:null,linkAnchorText:null,_linkAnchor:null,_linkValue:""};let n=this.setDialog.call(e);t.link.modal=n,t.link.focusElement=n.querySelector("._se_link_url"),t.link.linkAnchorText=n.querySelector("._se_link_text"),t.link.linkNewWindowCheck=n.querySelector("._se_link_check"),t.link.preview=n.querySelector(".se-link-preview");let i=this.setController_LinkButton.call(e);t.link.linkController=i,t.link._linkAnchor=null,i.addEventListener("mousedown",e.eventStop),n.querySelector(".se-btn-primary").addEventListener("click",this.submit.bind(e)),i.addEventListener("click",this.onClick_linkController.bind(e)),t.link.focusElement.addEventListener("input",this._onLinkPreview.bind(t.link.preview,t.link,t.options.linkProtocol)),t.dialog.modal.appendChild(n),t.element.relative.appendChild(i),n=null,i=null},setDialog:function(){const e=this.lang,t=this.util.createElement("DIV");return t.className="se-dialog-content",t.style.display="none",t.innerHTML='",t},setController_LinkButton:function(){const e=this.lang,t=this.icons,n=this.util.createElement("DIV");return n.className="se-controller se-controller-link",n.innerHTML='
    ",n},open:function(){this.plugins.dialog.open.call(this,"link","link"===this.currentControllerName)},_onLinkPreview:function(e,t,n){const i=n.target.value.trim();e._linkValue=this.textContent=i?t&&-1===i.indexOf("://")&&0!==i.indexOf("#")?t+i:-1===i.indexOf("://")?"/"+i:i:""},submit:function(e){this.showLoading(),e.preventDefault(),e.stopPropagation();const t=function(){const e=this.context.link;if(0===e._linkValue.length)return!1;const t=e._linkValue,n=e.linkAnchorText,i=0===n.value.length?t:n.value;if(this.context.dialog.updateModal){e._linkAnchor.href=t,e._linkAnchor.textContent=i,e._linkAnchor.target=e.linkNewWindowCheck.checked?"_blank":"";const n=e._linkAnchor.childNodes[0];this.setRange(n,0,n,n.textContent.length)}else{const n=this.util.createElement("A");n.href=t,n.textContent=i,n.target=e.linkNewWindowCheck.checked?"_blank":"";const l=this.getSelectedElements();if(l.length>1){const e=this.util.createElement(l[0].nodeName);if(e.appendChild(n),!this.insertNode(e,null,!0))return}else if(!this.insertNode(n,null,!0))return;this.setRange(n.childNodes[0],0,n.childNodes[0],n.textContent.length)}e._linkValue=e.preview.textContent=e.focusElement.value=e.linkAnchorText.value=""}.bind(this);try{t()}finally{this.plugins.dialog.close.call(this),this.closeLoading(),this.history.push(!1)}return!1},active:function(e){if(e){if(this.util.isAnchor(e)&&null===e.getAttribute("data-image-link"))return this.controllerArray.indexOf(this.context.link.linkController)<0&&this.plugins.link.call_controller.call(this,e),!0}else this.controllerArray.indexOf(this.context.link.linkController)>-1&&this.controllersOff();return!1},on:function(e){const t=this.context.link;e?t._linkAnchor&&(this.context.dialog.updateModal=!0,t._linkValue=t.preview.textContent=t.focusElement.value=t._linkAnchor.href,t.linkAnchorText.value=t._linkAnchor.textContent,t.linkNewWindowCheck.checked=!!/_blank/i.test(t._linkAnchor.target)):(this.plugins.link.init.call(this),t.linkAnchorText.value=this.getSelection().toString())},call_controller:function(e){this.editLink=this.context.link._linkAnchor=e;const t=this.context.link.linkController,n=t.querySelector("a");n.href=e.href,n.title=e.textContent,n.textContent=e.textContent;const i=this.util.getOffset(e,this.context.element.wysiwygFrame);t.style.top=i.top+e.offsetHeight+10+"px",t.style.left=i.left-this.context.element.wysiwygFrame.scrollLeft+"px",t.style.display="block";const l=this.context.element.wysiwygFrame.offsetWidth-(t.offsetLeft+t.offsetWidth);l<0?(t.style.left=t.offsetLeft+l+"px",t.firstElementChild.style.left=20-l+"px"):t.firstElementChild.style.left="20px",this.controllersOn(t,e,"link")},onClick_linkController:function(e){e.stopPropagation();const t=e.target.getAttribute("data-command")||e.target.parentNode.getAttribute("data-command");if(t){if(e.preventDefault(),/update/.test(t)){const e=this.context.link;e._linkValue=e.preview.textContent=e.focusElement.value=e._linkAnchor.href,e.linkAnchorText.value=e._linkAnchor.textContent,e.linkNewWindowCheck.checked=!!/_blank/i.test(e._linkAnchor.target),this.plugins.dialog.open.call(this,"link",!0)}else if(/unlink/.test(t)){const e=this.util.getChildElement(this.context.link._linkAnchor,(function(e){return 0===e.childNodes.length||3===e.nodeType}),!1),t=this.util.getChildElement(this.context.link._linkAnchor,(function(e){return 0===e.childNodes.length||3===e.nodeType}),!0);this.setRange(e,0,t,t.textContent.length),this.nodeChange(null,null,["A"],!1)}else this.util.removeItem(this.context.link._linkAnchor),this.context.link._linkAnchor=null,this.focus(),this.history.push(!1);this.controllersOff()}},init:function(){const e=this.context.link;e.linkController.style.display="none",e._linkAnchor=null,e._linkValue=e.preview.textContent=e.focusElement.value="",e.linkAnchorText.value="",e.linkNewWindowCheck.checked=!1}},d=n("ZED3"),u=n.n(d),h=n("ee5k"),g=n.n(h),p=n("gjS+"),m=n.n(p),f={name:"image",display:"dialog",add:function(e){e.addModule([r.a,u.a,g.a,m.a]);const t=e.context,n=t.image={_infoList:[],_infoIndex:0,_uploadFileLength:0,sizeUnit:t.option._imageSizeUnit,_altText:"",_linkElement:null,_align:"none",_floatClassRegExp:"__se__float\\-[a-z]+",_v_link:{_linkValue:""},_v_src:{_linkValue:""},svgDefaultSize:"30%",_element:null,_cover:null,_container:null,inputX:null,inputY:null,_element_w:1,_element_h:1,_element_l:0,_element_t:0,_defaultSizeX:"auto",_defaultSizeY:"auto",_origin_w:"auto"===t.option.imageWidth?"":t.option.imageWidth,_origin_h:"auto"===t.option.imageHeight?"":t.option.imageHeight,_proportionChecked:!0,_resizing:t.option.imageResizing,_resizeDotHide:!t.option.imageHeightShow,_rotation:t.option.imageRotation,_onlyPercentage:t.option.imageSizeOnlyPercentage,_ratio:!1,_ratioX:1,_ratioY:1,_captionShow:!0,_captionChecked:!1,_caption:null,captionCheckEl:null};let i=this.setDialog.call(e);n.modal=i,n.imgInputFile=i.querySelector("._se_image_file"),n.imgUrlFile=i.querySelector(".se-input-url"),n.focusElement=n.imgInputFile||n.imgUrlFile,n.altText=i.querySelector("._se_image_alt"),n.imgLink=i.querySelector("._se_image_link"),n.imgLinkNewWindowCheck=i.querySelector("._se_image_link_check"),n.captionCheckEl=i.querySelector("._se_image_check_caption"),n.previewLink=i.querySelector("._se_tab_content_url .se-link-preview"),n.previewSrc=i.querySelector("._se_tab_content_image .se-link-preview"),i.querySelector(".se-dialog-tabs").addEventListener("click",this.openTab.bind(e)),i.querySelector(".se-btn-primary").addEventListener("click",this.submit.bind(e)),n.imgInputFile&&i.querySelector(".se-file-remove").addEventListener("click",this._removeSelectedFiles.bind(n.imgInputFile,n.imgUrlFile,n.previewSrc)),n.imgInputFile&&n.imgUrlFile&&n.imgInputFile.addEventListener("change",this._fileInputChange.bind(n)),n.imgLink.addEventListener("input",this._onLinkPreview.bind(n.previewLink,n._v_link,t.options.linkProtocol)),n.imgUrlFile&&n.imgUrlFile.addEventListener("input",this._onLinkPreview.bind(n.previewSrc,n._v_src,t.options.linkProtocol));const l=i.querySelector(".__se__gallery");l&&l.addEventListener("click",this._openGallery.bind(e)),n.proportion={},n.inputX={},n.inputY={},t.option.imageResizing&&(n.proportion=i.querySelector("._se_image_check_proportion"),n.inputX=i.querySelector("._se_image_size_x"),n.inputY=i.querySelector("._se_image_size_y"),n.inputX.value=t.option.imageWidth,n.inputY.value=t.option.imageHeight,n.inputX.addEventListener("keyup",this.setInputSize.bind(e,"x")),n.inputY.addEventListener("keyup",this.setInputSize.bind(e,"y")),n.inputX.addEventListener("change",this.setRatio.bind(e)),n.inputY.addEventListener("change",this.setRatio.bind(e)),n.proportion.addEventListener("change",this.setRatio.bind(e)),i.querySelector(".se-dialog-btn-revert").addEventListener("click",this.sizeRevert.bind(e))),t.dialog.modal.appendChild(i),i=null},setDialog:function(){const e=this.context.option,t=this.lang,n=this.util.createElement("DIV");n.className="se-dialog-content",n.style.display="none";let i='
    '+t.dialogBox.imageBox.title+'
    ';if(e.imageFileInput&&(i+='
    "),e.imageUrlInput&&(i+='
    '+(e.imageGalleryUrl&&this.plugins.imageGallery?'":"")+'
    '),i+='
    ',e.imageResizing){const n=e.imageSizeOnlyPercentage,l=n?' style="display: none !important;"':"",o=e.imageHeightShow?"":' style="display: none !important;"';i+='
    ',n||!e.imageHeightShow?i+='
    ":i+='
    ",i+=' '+t.dialogBox.proportion+'
    "}return i+='
    ",n.innerHTML=i,n},_fileInputChange:function(){this.imgInputFile.value?(this.imgUrlFile.setAttribute("disabled",!0),this.previewSrc.style.textDecoration="line-through"):(this.imgUrlFile.removeAttribute("disabled"),this.previewSrc.style.textDecoration="")},_removeSelectedFiles:function(e,t){this.value="",e&&(e.removeAttribute("disabled"),t.style.textDecoration="")},_openGallery:function(){this.callPlugin("imageGallery",this.plugins.imageGallery.open.bind(this,this.plugins.image._setUrlInput.bind(this.context.image)),null)},_setUrlInput:function(e){this.altText.value=e.alt,this._v_src._linkValue=this.previewSrc.textContent=this.imgUrlFile.value=e.src,this.imgUrlFile.focus()},_onLinkPreview:function(e,t,n){const i=n.target.value.trim();e._linkValue=this.textContent=i?t&&-1===i.indexOf("://")&&0!==i.indexOf("#")?t+i:-1===i.indexOf("://")?"/"+i:i:""},fileTags:["img"],select:function(e){this.plugins.image.onModifyMode.call(this,e,this.plugins.resizing.call_controller_resize.call(this,e,"image"))},destroy:function(e){const t=e||this.context.image._element,n=this.util.getParentElement(t,this.util.isMediaComponent)||t,i=1*t.getAttribute("data-index");let l=n.previousElementSibling||n.nextElementSibling;const o=n.parentNode;this.util.removeItem(n),this.plugins.image.init.call(this),this.controllersOff(),o!==this.context.element.wysiwyg&&this.util.removeItemAllParents(o,(function(e){return 0===e.childNodes.length}),null),this.focusEdge(l),this.plugins.fileManager.deleteInfo.call(this,"image",i,this.functions.onImageUpload),this.history.push(!1)},on:function(e){const t=this.context.image;e?t.imgInputFile&&this.context.options.imageMultipleFile&&t.imgInputFile.removeAttribute("multiple"):(t.inputX.value=t._origin_w=this.context.option.imageWidth===t._defaultSizeX?"":this.context.option.imageWidth,t.inputY.value=t._origin_h=this.context.option.imageHeight===t._defaultSizeY?"":this.context.option.imageHeight,t.imgInputFile&&this.context.options.imageMultipleFile&&t.imgInputFile.setAttribute("multiple","multiple"))},open:function(){this.plugins.dialog.open.call(this,"image","image"===this.currentControllerName)},openTab:function(e){const t=this.context.image.modal,n="init"===e?t.querySelector("._se_tab_link"):e.target;if(!/^BUTTON$/i.test(n.tagName))return!1;const i=n.getAttribute("data-tab-link");let l,o,s;for(o=t.getElementsByClassName("_se_tab_content"),l=0;l0?(this.showLoading(),n.submitAction.call(this,this.context.image.imgInputFile.files)):t.imgUrlFile&&t._v_src._linkValue.length>0&&(this.showLoading(),n.onRender_imgUrl.call(this))}catch(e){throw this.closeLoading(),Error('[SUNEDITOR.image.submit.fail] cause : "'+e.message+'"')}finally{this.plugins.dialog.close.call(this)}return!1},submitAction:function(e){if(0===e.length)return;let t=0,n=[];for(let i=0,l=e.length;i0){let e=0;const n=this.context.image._infoList;for(let t=0,i=n.length;ti){this.closeLoading();const n="[SUNEDITOR.imageUpload.fail] Size of uploadable total images: "+i/1e3+"KB";return void(("function"!==this.functions.onImageUploadError||this.functions.onImageUploadError(n,{limitSize:i,currentSize:e,uploadSize:t},this))&&this.functions.noticeOpen(n))}}const l=this.context.image;l._uploadFileLength=n.length;const o={linkValue:l._v_link._linkValue,linkNewWindow:l.imgLinkNewWindowCheck.checked,inputWidth:l.inputX.value,inputHeight:l.inputY.value,align:l._align,isUpdate:this.context.dialog.updateModal,element:l._element};if("function"==typeof this.functions.onImageUploadBefore){const e=this.functions.onImageUploadBefore(n,o,this,function(e){e&&this._w.Array.isArray(e.result)?this.plugins.image.register.call(this,o,e):this.plugins.image.upload.call(this,o,e)}.bind(this));if(void 0===e)return;if(!e)return void this.closeLoading();this._w.Array.isArray(e)&&e.length>0&&(n=e)}this.plugins.image.upload.call(this,o,n)},error:function(e,t){if(this.closeLoading(),"function"!=typeof this.functions.onImageUploadError||this.functions.onImageUploadError(e,t,this))throw this.functions.noticeOpen(e),Error("[SUNEDITOR.plugin.image.error] response: "+e)},upload:function(e,t){if(!t)return void this.closeLoading();if("string"==typeof t)return void this.plugins.image.error.call(this,t,null);const n=this.context.option.imageUploadUrl,i=this.context.dialog.updateModal?1:t.length;if("string"==typeof n&&n.length>0){const l=new FormData;for(let e=0;e0){const i=this.util.createElement("A");return i.href=/^https?:\/\//.test(t)?t:"http://"+t,i.target=n?"_blank":"",i.setAttribute("data-image-link","image"),e.setAttribute("data-image-link",t),i.appendChild(e),i}return e},setInputSize:function(e,t){t&&32===t.keyCode?t.preventDefault():this.plugins.resizing._module_setInputSize.call(this,this.context.image,e)},setRatio:function(){this.plugins.resizing._module_setRatio.call(this,this.context.image)},checkFileInfo:function(){const e=this.plugins.image,t=function(t){e.onModifyMode.call(this,t,null),e.openModify.call(this,!0),e.update_image.call(this,!0,!1,!0)}.bind(this);this.plugins.fileManager.checkInfo.call(this,"image",["img"],this.functions.onImageUpload,t,!0)},resetFileInfo:function(){this.plugins.fileManager.resetInfo.call(this,"image",this.functions.onImageUpload)},create_image:function(e,t,n,i,l,o,s){const a=this.plugins.image,r=this.context.image;this.context.resizing._resize_plugin="image";let c=this.util.createElement("IMG");c.src=e,c.alt=r._altText,c=a.onRender_link.call(this,c,t,n),c.setAttribute("data-rotate","0"),r._resizing&&c.setAttribute("data-proportion",r._proportionChecked);const d=this.plugins.component.set_cover.call(this,c),u=this.plugins.component.set_container.call(this,d,"se-image-container");r._captionChecked&&(r._caption=this.plugins.component.create_caption.call(this),r._caption.setAttribute("contenteditable",!1),d.appendChild(r._caption)),r._element=c,r._cover=d,r._container=u,a.applySize.call(this,i,l),a.setAlign.call(this,o,c,d,u),c.onload=a._image_create_onload.bind(this,c,r.svgDefaultSize),this.insertComponent(u,!0,!0,!0)&&this.plugins.fileManager.setInfo.call(this,"image",c,this.functions.onImageUpload,s,!0),this.context.resizing._resize_plugin=""},_image_create_onload:function(e,t){0===e.offsetWidth&&this.plugins.image.applySize.call(this,t,""),this.selectComponent.call(this,e,"image")},update_image:function(e,t,n){const i=this.context.image,l=i._v_link._linkValue;let o,s=i._element,a=i._cover,r=i._container,c=!1;null===a&&(c=!0,s=i._element.cloneNode(!0),a=this.plugins.component.set_cover.call(this,s)),null===r?(a=a.cloneNode(!0),s=a.querySelector("img"),c=!0,r=this.plugins.component.set_container.call(this,a,"se-image-container")):c&&(r.innerHTML="",r.appendChild(a),i._cover=a,i._element=s,c=!1);const d=this.util.isNumber(i.inputX.value)?i.inputX.value+i.sizeUnit:i.inputX.value,u=this.util.isNumber(i.inputY.value)?i.inputY.value+i.sizeUnit:i.inputY.value;o=/%$/.test(s.style.width)?d!==r.style.width||u!==r.style.height:d!==s.style.width||u!==s.style.height,s.alt=i._altText;let h=!1;if(i._captionChecked?i._caption||(i._caption=this.plugins.component.create_caption.call(this),a.appendChild(i._caption),h=!0):i._caption&&(this.util.removeItem(i._caption),i._caption=null,h=!0),l.trim().length>0)if(null!==i._linkElement&&a.contains(i._linkElement))i._linkElement.href=l,i._linkElement.target=i.imgLinkNewWindowCheck.checked?"_blank":"",s.setAttribute("data-image-link",l);else{let e=this.plugins.image.onRender_link.call(this,s,l,this.context.image.imgLinkNewWindowCheck.checked);a.insertBefore(e,i._caption)}else if(null!==i._linkElement){const e=s;e.setAttribute("data-image-link","");let t=e.cloneNode(!0);a.removeChild(i._linkElement),a.insertBefore(t,i._caption),s=t}if(c){const e=this.util.isRangeFormatElement(i._element.parentNode)||this.util.isWysiwygDiv(i._element.parentNode)?i._element:/^A$/i.test(i._element.parentNode.nodeName)?i._element.parentNode:this.util.getFormatElement(i._element)||i._element;e.parentNode.replaceChild(r,e),s=r.querySelector("img"),i._element=s,i._cover=a,i._container=r}(h||!i._onlyPercentage&&o)&&!e&&(/\d+/.test(s.style.height)||this.context.resizing._rotateVertical&&i._captionChecked)&&(/%$/.test(i.inputX.value)||/%$/.test(i.inputY.value)?this.plugins.resizing.resetTransform.call(this,s):this.plugins.resizing.setTransformSize.call(this,s,this.util.getNumber(i.inputX.value,0),this.util.getNumber(i.inputY.value,0)));i._resizing&&(s.setAttribute("data-proportion",i._proportionChecked),o&&this.plugins.image.applySize.call(this)),this.plugins.image.setAlign.call(this,null,s,null,null),e&&this.plugins.fileManager.setInfo.call(this,"image",s,this.functions.onImageUpload,null,!0),t&&this.selectComponent(s,"image"),n||this.history.push(!1)},update_src:function(e,t,n){t.src=e,this._w.setTimeout(this.plugins.fileManager.setInfo.bind(this,"image",t,this.functions.onImageUpload,n,!0)),this.selectComponent(t,"image")},onModifyMode:function(e,t){if(!e)return;const n=this.context.image;n._linkElement=/^A$/i.test(e.parentNode.nodeName)?e.parentNode:null,n._element=e,n._cover=this.util.getParentElement(e,"FIGURE"),n._container=this.util.getParentElement(e,this.util.isMediaComponent),n._caption=this.util.getChildElement(n._cover,"FIGCAPTION"),n._align=e.getAttribute("data-align")||"none",t&&(n._element_w=t.w,n._element_h=t.h,n._element_t=t.t,n._element_l=t.l);let i=n._element.getAttribute("data-size")||n._element.getAttribute("data-origin");i?(i=i.split(","),n._origin_w=i[0],n._origin_h=i[1]):t&&(n._origin_w=t.w,n._origin_h=t.h)},openModify:function(e){const t=this.context.image;t.imgUrlFile&&(t._v_src._linkValue=t.previewSrc.textContent=t.imgUrlFile.value=t._element.src),t._altText=t.altText.value=t._element.alt,t._v_link._linkValue=t.previewLink.textContent=t.imgLink.value=null===t._linkElement?"":t._linkElement.href,t.imgLinkNewWindowCheck.checked=t._linkElement&&"_blank"===t._linkElement.target,t.modal.querySelector('input[name="suneditor_image_radio"][value="'+t._align+'"]').checked=!0,t._align=t.modal.querySelector('input[name="suneditor_image_radio"]:checked').value,t._captionChecked=t.captionCheckEl.checked=!!t._caption,t._resizing&&this.plugins.resizing._module_setModifyInputSize.call(this,t,this.plugins.image),e||this.plugins.dialog.open.call(this,"image",!0)},sizeRevert:function(){this.plugins.resizing._module_sizeRevert.call(this,this.context.image)},applySize:function(e,t){const n=this.context.image;return e||(e=n.inputX.value||this.context.option.imageWidth),t||(t=n.inputY.value||this.context.option.imageHeight),n._onlyPercentage&&e||/%$/.test(e)?(this.plugins.image.setPercentSize.call(this,e,t),!0):(e&&"auto"!==e||t&&"auto"!==t?this.plugins.image.setSize.call(this,e,t,!1):this.plugins.image.setAutoSize.call(this),!1)},setSize:function(e,t,n,i){const l=this.context.image,o=/^(rw|lw)$/.test(i),s=/^(th|bh)$/.test(i);this.plugins.image.cancelPercentAttr.call(this),s||(l._element.style.width=this.util.isNumber(e)?e+l.sizeUnit:e),o||(l._element.style.height=this.util.isNumber(t)?t+l.sizeUnit:/%$/.test(t)?"":t),"center"===l._align&&this.plugins.image.setAlign.call(this,null,null,null,null),n||l._element.removeAttribute("data-percentage"),this.plugins.resizing._module_saveCurrentSize.call(this,l)},setAutoSize:function(){const e=this.context.image;this.plugins.resizing.resetTransform.call(this,e._element),this.plugins.image.cancelPercentAttr.call(this),e._element.style.maxWidth="",e._element.style.width="",e._element.style.height="",e._cover.style.width="",e._cover.style.height="",this.plugins.image.setAlign.call(this,null,null,null,null),e._element.setAttribute("data-percentage","auto,auto"),this.plugins.resizing._module_saveCurrentSize.call(this,e)},setOriginSize:function(){const e=this.context.image;e._element.removeAttribute("data-percentage"),this.plugins.resizing.resetTransform.call(this,e._element),this.plugins.image.cancelPercentAttr.call(this);const t=(e._element.getAttribute("data-origin")||"").split(","),n=t[0],i=t[1];t&&(e._onlyPercentage||/%$/.test(n)&&(/%$/.test(i)||!/\d/.test(i))?this.plugins.image.setPercentSize.call(this,n,i):this.plugins.image.setSize.call(this,n,i),this.plugins.resizing._module_saveCurrentSize.call(this,e))},setPercentSize:function(e,t){const n=this.context.image;t=!t||/%$/.test(t)||this.util.getNumber(t,0)?this.util.isNumber(t)?t+n.sizeUnit:t||"":this.util.isNumber(t)?t+"%":t;const i=/%$/.test(t);n._container.style.width=this.util.isNumber(e)?e+"%":e,n._container.style.height="",n._cover.style.width="100%",n._cover.style.height=i?t:"",n._element.style.width="100%",n._element.style.height=i?"":t,n._element.style.maxWidth="","center"===n._align&&this.plugins.image.setAlign.call(this,null,null,null,null),n._element.setAttribute("data-percentage",e+","+t),this.plugins.resizing.setCaptionPosition.call(this,n._element),this.plugins.resizing._module_saveCurrentSize.call(this,n)},cancelPercentAttr:function(){const e=this.context.image;e._cover.style.width="",e._cover.style.height="",e._container.style.width="",e._container.style.height="",this.util.removeClass(e._container,this.context.image._floatClassRegExp),this.util.addClass(e._container,"__se__float-"+e._align),"center"===e._align&&this.plugins.image.setAlign.call(this,null,null,null,null)},setAlign:function(e,t,n,i){const l=this.context.image;e||(e=l._align),t||(t=l._element),n||(n=l._cover),i||(i=l._container),n.style.margin=e&&"none"!==e?"auto":"0",/%$/.test(t.style.width)&&"center"===e?(i.style.minWidth="100%",n.style.width=i.style.width):(i.style.minWidth="",n.style.width=this.context.resizing._rotateVertical?t.style.height||t.offsetHeight:t.style.width&&"auto"!==t.style.width?t.style.width||"100%":""),this.util.hasClass(i,"__se__float-"+e)||(this.util.removeClass(i,l._floatClassRegExp),this.util.addClass(i,"__se__float-"+e)),t.setAttribute("data-align",e)},resetAlign:function(){const e=this.context.image;e._element.setAttribute("data-align",""),e._align="none",e._cover.style.margin="0",this.util.removeClass(e._container,e._floatClassRegExp)},init:function(){const e=this.context.image;e.imgInputFile&&(e.imgInputFile.value=""),e.imgUrlFile&&(e._v_src._linkValue=e.previewSrc.textContent=e.imgUrlFile.value=""),e.imgInputFile&&e.imgUrlFile&&(e.imgUrlFile.removeAttribute("disabled"),e.previewSrc.style.textDecoration=""),e.altText.value="",e._v_link._linkValue=e.previewLink.textContent=e.imgLink.value="",e.imgLinkNewWindowCheck.checked=!1,e.modal.querySelector('input[name="suneditor_image_radio"][value="none"]').checked=!0,e.captionCheckEl.checked=!1,e._element=null,this.plugins.image.openTab.call(this,"init"),e._resizing&&(e.inputX.value=this.context.option.imageWidth===e._defaultSizeX?"":this.context.option.imageWidth,e.inputY.value=this.context.option.imageHeight===e._defaultSizeY?"":this.context.option.imageHeight,e.proportion.checked=!0,e._ratio=!1,e._ratioX=1,e._ratioY=1)}},_={name:"video",display:"dialog",add:function(e){e.addModule([r.a,u.a,g.a,m.a]);const t=e.context,n=t.video={_infoList:[],_infoIndex:0,_uploadFileLength:0,sizeUnit:t.option._videoSizeUnit,_align:"none",_floatClassRegExp:"__se__float\\-[a-z]+",_youtubeQuery:t.option.youtubeQuery,_videoRatio:100*t.option.videoRatio+"%",_defaultRatio:100*t.option.videoRatio+"%",_linkValue:"",_element:null,_cover:null,_container:null,inputX:null,inputY:null,_element_w:1,_element_h:1,_element_l:0,_element_t:0,_defaultSizeX:"100%",_defaultSizeY:100*t.option.videoRatio+"%",_origin_w:"100%"===t.option.videoWidth?"":t.option.videoWidth,_origin_h:"56.25%"===t.option.videoHeight?"":t.option.videoHeight,_proportionChecked:!0,_resizing:t.option.videoResizing,_resizeDotHide:!t.option.videoHeightShow,_rotation:t.option.videoRotation,_onlyPercentage:t.option.videoSizeOnlyPercentage,_ratio:!1,_ratioX:1,_ratioY:1,_captionShow:!1};let i=this.setDialog.call(e);n.modal=i,n.videoInputFile=i.querySelector("._se_video_file"),n.videoUrlFile=i.querySelector(".se-input-url"),n.focusElement=n.videoUrlFile||n.videoInputFile,n.preview=i.querySelector(".se-link-preview"),i.querySelector(".se-btn-primary").addEventListener("click",this.submit.bind(e)),n.videoInputFile&&i.querySelector(".se-dialog-files-edge-button").addEventListener("click",this._removeSelectedFiles.bind(n.videoInputFile,n.videoUrlFile,n.preview)),n.videoInputFile&&n.videoUrlFile&&n.videoInputFile.addEventListener("change",this._fileInputChange.bind(n)),n.videoUrlFile&&n.videoUrlFile.addEventListener("input",this._onLinkPreview.bind(n.preview,n,t.options.linkProtocol)),n.proportion={},n.videoRatioOption={},n.inputX={},n.inputY={},t.option.videoResizing&&(n.proportion=i.querySelector("._se_video_check_proportion"),n.videoRatioOption=i.querySelector(".se-video-ratio"),n.inputX=i.querySelector("._se_video_size_x"),n.inputY=i.querySelector("._se_video_size_y"),n.inputX.value=t.option.videoWidth,n.inputY.value=t.option.videoHeight,n.inputX.addEventListener("keyup",this.setInputSize.bind(e,"x")),n.inputY.addEventListener("keyup",this.setInputSize.bind(e,"y")),n.inputX.addEventListener("change",this.setRatio.bind(e)),n.inputY.addEventListener("change",this.setRatio.bind(e)),n.proportion.addEventListener("change",this.setRatio.bind(e)),n.videoRatioOption.addEventListener("change",this.setVideoRatio.bind(e)),i.querySelector(".se-dialog-btn-revert").addEventListener("click",this.sizeRevert.bind(e))),t.dialog.modal.appendChild(i),i=null},setDialog:function(){const e=this.context.option,t=this.lang,n=this.util.createElement("DIV");n.className="se-dialog-content",n.style.display="none";let i='
    '+t.dialogBox.videoBox.title+'
    ';if(e.videoFileInput&&(i+='
    "),e.videoUrlInput&&(i+='
    '),e.videoResizing){const n=e.videoRatioList||[{name:"16:9",value:.5625},{name:"4:3",value:.75},{name:"21:9",value:.4285}],l=e.videoRatio,o=e.videoSizeOnlyPercentage,s=o?' style="display: none !important;"':"",a=e.videoHeightShow?"":' style="display: none !important;"',r=e.videoRatioShow?"":' style="display: none !important;"',c=o||e.videoHeightShow||e.videoRatioShow?"":' style="display: none !important;"';i+='
    "}return i+='
    ",n.innerHTML=i,n},_fileInputChange:function(){this.videoInputFile.value?(this.videoUrlFile.setAttribute("disabled",!0),this.preview.style.textDecoration="line-through"):(this.videoUrlFile.removeAttribute("disabled"),this.preview.style.textDecoration="")},_removeSelectedFiles:function(e,t){this.value="",e&&(e.removeAttribute("disabled"),t.style.textDecoration="")},_onLinkPreview:function(e,t,n){const i=n.target.value.trim();/^$/.test(i)?(e._linkValue=i,this.textContent=''):e._linkValue=this.textContent=i?t&&-1===i.indexOf("://")&&0!==i.indexOf("#")?t+i:-1===i.indexOf("://")?"/"+i:i:""},_setTagAttrs:function(e){e.setAttribute("controls",!0);const t=this.context.options.videoTagAttrs;if(t)for(let n in t)this.util.hasOwn(t,n)&&e.setAttribute(n,t[n])},createVideoTag:function(){const e=this.util.createElement("VIDEO");return this.plugins.video._setTagAttrs.call(this,e),e},_setIframeAttrs:function(e){e.frameBorder="0",e.allowFullscreen=!0;const t=this.context.options.videoIframeAttrs;if(t)for(let n in t)this.util.hasOwn(t,n)&&e.setAttribute(n,t[n])},createIframeTag:function(){const e=this.util.createElement("IFRAME");return this.plugins.video._setIframeAttrs.call(this,e),e},fileTags:["iframe","video"],select:function(e){this.plugins.video.onModifyMode.call(this,e,this.plugins.resizing.call_controller_resize.call(this,e,"video"))},destroy:function(e){const t=e||this.context.video._element,n=this.context.video._container,i=1*t.getAttribute("data-index");let l=n.previousElementSibling||n.nextElementSibling;const o=n.parentNode;this.util.removeItem(n),this.plugins.video.init.call(this),this.controllersOff(),o!==this.context.element.wysiwyg&&this.util.removeItemAllParents(o,(function(e){return 0===e.childNodes.length}),null),this.focusEdge(l),this.plugins.fileManager.deleteInfo.call(this,"video",i,this.functions.onVideoUpload),this.history.push(!1)},on:function(e){const t=this.context.video;e?t.videoInputFile&&this.context.options.videoMultipleFile&&t.videoInputFile.removeAttribute("multiple"):(t.inputX.value=t._origin_w=this.context.option.videoWidth===t._defaultSizeX?"":this.context.option.videoWidth,t.inputY.value=t._origin_h=this.context.option.videoHeight===t._defaultSizeY?"":this.context.option.videoHeight,t.proportion.disabled=!0,t.videoInputFile&&this.context.options.videoMultipleFile&&t.videoInputFile.setAttribute("multiple","multiple")),t._resizing&&this.plugins.video.setVideoRatioSelect.call(this,t._origin_h||t._defaultRatio)},open:function(){this.plugins.dialog.open.call(this,"video","video"===this.currentControllerName)},setVideoRatio:function(e){const t=this.context.video,n=e.target.options[e.target.selectedIndex].value;t._defaultSizeY=t._videoRatio=n?100*n+"%":t._defaultSizeY,t.inputY.placeholder=n?100*n+"%":"",t.inputY.value=""},setInputSize:function(e,t){if(t&&32===t.keyCode)return void t.preventDefault();const n=this.context.video;this.plugins.resizing._module_setInputSize.call(this,n,e),"y"===e&&this.plugins.video.setVideoRatioSelect.call(this,t.target.value||n._defaultRatio)},setRatio:function(){this.plugins.resizing._module_setRatio.call(this,this.context.video)},submit:function(e){const t=this.context.video,n=this.plugins.video;e.preventDefault(),e.stopPropagation(),t._align=t.modal.querySelector('input[name="suneditor_video_radio"]:checked').value;try{t.videoInputFile&&t.videoInputFile.files.length>0?(this.showLoading(),n.submitAction.call(this,this.context.video.videoInputFile.files)):t.videoUrlFile&&t._linkValue.length>0&&(this.showLoading(),n.setup_url.call(this))}catch(e){throw this.closeLoading(),Error('[SUNEDITOR.video.submit.fail] cause : "'+e.message+'"')}finally{this.plugins.dialog.close.call(this)}return!1},submitAction:function(e){if(0===e.length)return;let t=0,n=[];for(let i=0,l=e.length;i0){let e=0;const n=this.context.video._infoList;for(let t=0,i=n.length;ti){this.closeLoading();const n="[SUNEDITOR.videoUpload.fail] Size of uploadable total videos: "+i/1e3+"KB";return void(("function"!==this.functions.onVideoUploadError||this.functions.onVideoUploadError(n,{limitSize:i,currentSize:e,uploadSize:t},this))&&this.functions.noticeOpen(n))}}const l=this.context.video;l._uploadFileLength=n.length;const o={inputWidth:l.inputX.value,inputHeight:l.inputY.value,align:l._align,isUpdate:this.context.dialog.updateModal,element:l._element};if("function"==typeof this.functions.onVideoUploadBefore){const e=this.functions.onVideoUploadBefore(n,o,this,function(e){e&&this._w.Array.isArray(e.result)?this.plugins.video.register.call(this,o,e):this.plugins.video.upload.call(this,o,e)}.bind(this));if(void 0===e)return;if(!e)return void this.closeLoading();"object"==typeof e&&e.length>0&&(n=e)}this.plugins.video.upload.call(this,o,n)},error:function(e,t){if(this.closeLoading(),"function"!=typeof this.functions.onVideoUploadError||this.functions.onVideoUploadError(e,t,this))throw this.functions.noticeOpen(e),Error("[SUNEDITOR.plugin.video.error] response: "+e)},upload:function(e,t){if(!t)return void this.closeLoading();if("string"==typeof t)return void this.plugins.video.error.call(this,t,null);const n=this.context.option.videoUploadUrl,i=this.context.dialog.updateModal?1:t.length;if(!("string"==typeof n&&n.length>0))throw Error('[SUNEDITOR.videoUpload.fail] cause : There is no "videoUploadUrl" option.');{const l=new FormData;for(let e=0;e$/.test(t)){if(t=(new this._w.DOMParser).parseFromString(t,"text/html").querySelector("iframe").src,0===t.length)return!1}if(/youtu\.?be/.test(t)){if(/^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("&","?&")),e._youtubeQuery.length>0)if(/\?/.test(t)){const n=t.split("?");t=n[0]+"?"+e._youtubeQuery+"&"+n[1]}else t+="?"+e._youtubeQuery}else/vimeo\.com/.test(t)&&(t.endsWith("/")&&(t=t.slice(0,-1)),t="https://player.vimeo.com/video/"+t.slice(t.lastIndexOf("/")+1));this.plugins.video.create_video.call(this,this.plugins.video.createIframeTag.call(this),t,e.inputX.value,e.inputY.value,e._align,null,this.context.dialog.updateModal)}catch(e){throw Error('[SUNEDITOR.video.upload.fail] cause : "'+e.message+'"')}finally{this.closeLoading()}},create_video:function(e,t,n,i,l,o,s){this.context.resizing._resize_plugin="video";const a=this.context.video;let r=null,c=null,d=!1;if(s){if((e=a._element).src!==t){d=!0;const n=/youtu\.?be/.test(t),i=/vimeo\.com/.test(t);if(!n&&!i||/^iframe$/i.test(e.nodeName))if(n||i||/^videoo$/i.test(e.nodeName))e.src=t;else{const n=this.plugins.video.createVideoTag.call(this);n.src=t,e.parentNode.replaceChild(n,e),a._element=e=n}else{const n=this.plugins.video.createIframeTag.call(this);n.src=t,e.parentNode.replaceChild(n,e),a._element=e=n}}c=a._container,r=this.util.getParentElement(e,"FIGURE")}else d=!0,e.src=t,a._element=e,r=this.plugins.component.set_cover.call(this,e),c=this.plugins.component.set_container.call(this,r,"se-video-container");a._cover=r,a._container=c;const u=this.plugins.resizing._module_getSizeX.call(this,a)!==(n||a._defaultSizeX)||this.plugins.resizing._module_getSizeY.call(this,a)!==(i||a._videoRatio),h=!s||u;a._resizing&&(this.context.video._proportionChecked=a.proportion.checked,e.setAttribute("data-proportion",a._proportionChecked));let g=!1;h&&(g=this.plugins.video.applySize.call(this)),g&&"center"===l||this.plugins.video.setAlign.call(this,null,e,r,c);let p=!0;s?a._resizing&&this.context.resizing._rotateVertical&&h&&this.plugins.resizing.setTransformSize.call(this,e,null,null):p=this.insertComponent(c,!1,!0,!1),p&&(d&&this.plugins.fileManager.setInfo.call(this,"video",e,this.functions.onVideoUpload,o,!0),s&&(this.selectComponent(e,"video"),this.history.push(!1))),this.context.resizing._resize_plugin=""},_update_videoCover:function(e){if(!e)return;const t=this.context.video;/^video$/i.test(e.nodeName)?this.plugins.video._setTagAttrs.call(this,e):this.plugins.video._setIframeAttrs.call(this,e);const n=this.util.getParentElement(e,this.util.isMediaComponent)||this.util.getParentElement(e,function(e){return this.isWysiwygDiv(e.parentNode)}.bind(this.util));t._element=e=e.cloneNode(!0);const i=t._cover=this.plugins.component.set_cover.call(this,e),l=t._container=this.plugins.component.set_container.call(this,i,"se-video-container"),o=n.querySelector("figcaption");let s=null;o&&(s=this.util.createElement("DIV"),s.innerHTML=o.innerHTML,this.util.removeItem(o));const a=(e.getAttribute("data-size")||e.getAttribute("data-origin")||"").split(",");this.plugins.video.applySize.call(this,a[0],a[1]),n.parentNode.replaceChild(l,n),s&&n.parentNode.insertBefore(s,l.nextElementSibling),this.plugins.fileManager.setInfo.call(this,"video",e,this.functions.onVideoUpload,null,!0)},onModifyMode:function(e,t){const n=this.context.video;n._element=e,n._cover=this.util.getParentElement(e,"FIGURE"),n._container=this.util.getParentElement(e,this.util.isMediaComponent),n._align=e.getAttribute("data-align")||"none",t&&(n._element_w=t.w,n._element_h=t.h,n._element_t=t.t,n._element_l=t.l);let i=n._element.getAttribute("data-size")||n._element.getAttribute("data-origin");i?(i=i.split(","),n._origin_w=i[0],n._origin_h=i[1]):t&&(n._origin_w=t.w,n._origin_h=t.h)},openModify:function(e){const t=this.context.video;if(t.videoUrlFile&&(t._linkValue=t.preview.textContent=t.videoUrlFile.value=t._element.src||(t._element.querySelector("source")||"").src||""),t.modal.querySelector('input[name="suneditor_video_radio"][value="'+t._align+'"]').checked=!0,t._resizing){this.plugins.resizing._module_setModifyInputSize.call(this,t,this.plugins.video);const e=t._videoRatio=this.plugins.resizing._module_getSizeY.call(this,t);this.plugins.video.setVideoRatioSelect.call(this,e)||(t.inputY.value=t._onlyPercentage?this.util.getNumber(e,2):e)}e||this.plugins.dialog.open.call(this,"video",!0)},setVideoRatioSelect:function(e){let t=!1;const n=this.context.video,i=n.videoRatioOption.options;/%$/.test(e)||n._onlyPercentage?e=this.util.getNumber(e,2)/100+"":(!this.util.isNumber(e)||1*e>=1)&&(e=""),n.inputY.placeholder="";for(let l=0,o=i.length;l'+this.icons.cancel+''+t.dialogBox.audioBox.title+'
    ';return e.audioFileInput&&(i+='
    "),e.audioUrlInput&&(i+='
    '),i+='
    ",n.innerHTML=i,n},setController:function(){const e=this.lang,t=this.icons,n=this.util.createElement("DIV");return n.className="se-controller se-controller-link",n.innerHTML='
    ",n},_fileInputChange:function(){this.audioInputFile.value?(this.audioUrlFile.setAttribute("disabled",!0),this.preview.style.textDecoration="line-through"):(this.audioUrlFile.removeAttribute("disabled"),this.preview.style.textDecoration="")},_removeSelectedFiles:function(e,t){this.value="",e&&(e.removeAttribute("disabled"),t.style.textDecoration="")},_createAudioTag:function(){const e=this.util.createElement("AUDIO");this.plugins.audio._setTagAttrs.call(this,e);const t=this.context.audio._origin_w,n=this.context.audio._origin_h;return e.setAttribute("origin-size",t+","+n),e.style.cssText=(t?"width:"+t+"; ":"")+(n?"height:"+n+";":""),e},_setTagAttrs:function(e){e.setAttribute("controls",!0);const t=this.context.options.audioTagAttrs;if(t)for(let n in t)this.util.hasOwn(t,n)&&e.setAttribute(n,t[n])},_onLinkPreview:function(e,t,n){const i=n.target.value.trim();e._linkValue=this.textContent=i?t&&-1===i.indexOf("://")&&0!==i.indexOf("#")?t+i:-1===i.indexOf("://")?"/"+i:i:""},fileTags:["audio"],select:function(e){this.plugins.audio.onModifyMode.call(this,e)},destroy:function(e){e=e||this.context.audio._element;const t=this.util.getParentElement(e,this.util.isComponent)||e,n=1*e.getAttribute("data-index"),i=t.previousElementSibling||t.nextElementSibling,l=t.parentNode;this.util.removeItem(t),this.plugins.audio.init.call(this),this.controllersOff(),l!==this.context.element.wysiwyg&&this.util.removeItemAllParents(l,(function(e){return 0===e.childNodes.length}),null),this.focusEdge(i),this.plugins.fileManager.deleteInfo.call(this,"audio",n,this.functions.onAudioUpload),this.history.push(!1)},checkFileInfo:function(){this.plugins.fileManager.checkInfo.call(this,"audio",["audio"],this.functions.onAudioUpload,this.plugins.audio.updateCover.bind(this),!1)},resetFileInfo:function(){this.plugins.fileManager.resetInfo.call(this,"audio",this.functions.onAudioUpload)},on:function(e){const t=this.context.audio;e?t._element?(this.context.dialog.updateModal=!0,t._linkValue=t.preview.textContent=t.audioUrlFile.value=t._element.src,t.audioInputFile&&this.context.options.audioMultipleFile&&t.audioInputFile.removeAttribute("multiple")):t.audioInputFile&&this.context.options.audioMultipleFile&&t.audioInputFile.removeAttribute("multiple"):(this.plugins.audio.init.call(this),t.audioInputFile&&this.context.options.audioMultipleFile&&t.audioInputFile.setAttribute("multiple","multiple"))},open:function(){this.plugins.dialog.open.call(this,"audio","audio"===this.currentControllerName)},submit:function(e){const t=this.context.audio;e.preventDefault(),e.stopPropagation();try{t.audioInputFile&&t.audioInputFile.files.length>0?(this.showLoading(),this.plugins.audio.submitAction.call(this,t.audioInputFile.files)):t.audioUrlFile&&t._linkValue.length>0&&(this.showLoading(),this.plugins.audio.setupUrl.call(this,t._linkValue))}catch(e){throw this.closeLoading(),Error('[SUNEDITOR.audio.submit.fail] cause : "'+e.message+'"')}finally{this.plugins.dialog.close.call(this)}return!1},submitAction:function(e){if(0===e.length)return;let t=0,n=[];for(let i=0,l=e.length;i0){let e=0;const n=this.context.audio._infoList;for(let t=0,i=n.length;ti){this.closeLoading();const n="[SUNEDITOR.audioUpload.fail] Size of uploadable total audios: "+i/1e3+"KB";return void(("function"!==this.functions.onAudioUploadError||this.functions.onAudioUploadError(n,{limitSize:i,currentSize:e,uploadSize:t},this))&&this.functions.noticeOpen(n))}}const l=this.context.audio;l._uploadFileLength=n.length;const o={isUpdate:this.context.dialog.updateModal,element:l._element};if("function"==typeof this.functions.onAudioUploadBefore){const e=this.functions.onAudioUploadBefore(n,o,this,function(e){e&&this._w.Array.isArray(e.result)?this.plugins.audio.register.call(this,o,e):this.plugins.audio.upload.call(this,o,e)}.bind(this));if(void 0===e)return;if(!e)return void this.closeLoading();"object"==typeof e&&e.length>0&&(n=e)}this.plugins.audio.upload.call(this,o,n)},error:function(e,t){if(this.closeLoading(),"function"!=typeof this.functions.onAudioUploadError||this.functions.onAudioUploadError(e,t,this))throw this.functions.noticeOpen(e),Error("[SUNEDITOR.plugin.audio.exception] response: "+e)},upload:function(e,t){if(!t)return void this.closeLoading();if("string"==typeof t)return void this.plugins.audio.error.call(this,t,null);const n=this.context.option.audioUploadUrl,i=this.context.dialog.updateModal?1:t.length,l=new FormData;for(let e=0;e'+this.icons.cancel+''+e.dialogBox.mathBox.title+'

    ",t},setController_MathButton:function(){const e=this.lang,t=this.util.createElement("DIV");return t.className="se-controller se-controller-link",t.innerHTML='
    ",t},open:function(){this.plugins.dialog.open.call(this,"math","math"===this.currentControllerName)},managedTags:function(){return{className:"katex",method:function(e){if(!e.getAttribute("data-exp"))return;const t=this._d.createRange().createContextualFragment(this.plugins.math._renderer.call(this,this.util.HTMLDecoder(e.getAttribute("data-exp"))));e.innerHTML=t.querySelector(".katex").innerHTML}}},_renderer:function(e){const t=this.context.option.katex;return t.src.renderToString(e,t.options)},_renderMathExp:function(e,t){e.previewElement.innerHTML=this.plugins.math._renderer.call(this,t.target.value)},submit:function(e){this.showLoading(),e.preventDefault(),e.stopPropagation();const t=function(){if(0===this.context.math.focusElement.value.trim().length)return!1;const e=this.context.math,t=e.focusElement.value,n=e.previewElement.querySelector(".katex");if(!n)return!1;if(n.className="__se__katex "+n.className,n.setAttribute("contenteditable",!1),n.setAttribute("data-exp",this.util.HTMLEncoder(t)),n.setAttribute("data-font-size",e.fontSizeElement.value),n.style.fontSize=e.fontSizeElement.value,this.context.dialog.updateModal){const t=this.util.getParentElement(e._mathExp,".katex");t.parentNode.replaceChild(n,t),this.setRange(n,0,n,1)}else{const e=this.getSelectedElements();if(e.length>1){const t=this.util.createElement(e[0].nodeName);if(t.appendChild(n),!this.insertNode(t,null,!0))return!1}else if(!this.insertNode(n,null,!0))return!1;const t=this.util.createTextNode(this.util.zeroWidthSpace);n.parentNode.insertBefore(t,n.nextSibling),this.setRange(n,0,n,1)}return e.focusElement.value="",e.fontSizeElement.value="1em",e.previewElement.style.fontSize="1em",e.previewElement.innerHTML="",!0}.bind(this);try{t()&&(this.plugins.dialog.close.call(this),this.history.push(!1))}catch(e){this.plugins.dialog.close.call(this)}finally{this.closeLoading()}return!1},active:function(e){if(e){if(e.getAttribute("data-exp"))return this.controllerArray.indexOf(this.context.math.mathController)<0&&(this.setRange(e,0,e,1),this.plugins.math.call_controller.call(this,e)),!0}else this.controllerArray.indexOf(this.context.math.mathController)>-1&&this.controllersOff();return!1},on:function(e){if(e){const e=this.context.math;if(e._mathExp){const t=this.util.HTMLDecoder(e._mathExp.getAttribute("data-exp")),n=e._mathExp.getAttribute("data-font-size")||"1em";this.context.dialog.updateModal=!0,e.focusElement.value=t,e.fontSizeElement.value=n,e.previewElement.innerHTML=this.plugins.math._renderer.call(this,t),e.previewElement.style.fontSize=n}}else this.plugins.math.init.call(this)},call_controller:function(e){this.context.math._mathExp=e;const t=this.context.math.mathController,n=this.util.getOffset(e,this.context.element.wysiwygFrame);t.style.top=n.top+e.offsetHeight+10+"px",t.style.left=n.left-this.context.element.wysiwygFrame.scrollLeft+"px",t.style.display="block";const i=this.context.element.wysiwygFrame.offsetWidth-(t.offsetLeft+t.offsetWidth);i<0?(t.style.left=t.offsetLeft+i+"px",t.firstElementChild.style.left=20-i+"px"):t.firstElementChild.style.left="20px",this.controllersOn(t,e,"math")},onClick_mathController:function(e){e.stopPropagation();const t=e.target.getAttribute("data-command")||e.target.parentNode.getAttribute("data-command");t&&(e.preventDefault(),/update/.test(t)?(this.context.math.focusElement.value=this.util.HTMLDecoder(this.context.math._mathExp.getAttribute("data-exp")),this.plugins.dialog.open.call(this,"math",!0)):(this.util.removeItem(this.context.math._mathExp),this.context.math._mathExp=null,this.focus(),this.history.push(!1)),this.controllersOff())},init:function(){const e=this.context.math;e.mathController.style.display="none",e._mathExp=null,e.focusElement.value="",e.previewElement.innerHTML=""}};var y={name:"mention",display:"dialog",title:"Mention",innerHTML:'',renderItem:function(e){return`${e}`},getItems:function(e){return Promise.resolve(["overwite","the","mention","plugin","getItems","method"].filter(t=>t.includes(e.toLowerCase())))},renderList:function(e){const{mention:t}=this.context;let n=Promise.resolve();t.term!==e&&(t.focussed=0,t.term=e,n=t.getItems(e).then(e=>{t.items=e,Object.keys(t._itemElements).forEach(n=>{if(!e.find(e=>t.getId(e)===n)){const e=t._itemElements[n];e.parentNode.removeChild(e),delete t._itemElements[n]}}),e.forEach((e,n)=>{const i=t.getId(e);if(!t._itemElements[i]){const a=this.util.createElement("LI");a.setAttribute("data-mention",i),this.util.addClass(a,"se-mention-item"),a.innerHTML=t.renderItem(e),a.addEventListener("click",()=>{t.focussed=n,t.addMention()}),l=t.list,o=a,(s=n)||(s=0),s>=l.children.length?l.appendChild(o):l.insertBefore(o,l.children[s]),t._itemElements[i]=a}var l,o,s})})),n.then(()=>{const e=t.list.querySelectorAll(".se-mention-item")[t.focussed];if(e&&!this.util.hasClass(e,"se-mention-active")){const n=t.list.querySelector(".se-mention-active");n&&this.util.removeClass(n,"se-mention-active"),this.util.addClass(e,"se-mention-active")}})},setDialog:function(){const e=this.util.createElement("DIV"),t=this.lang;e.className="se-dialog-content",e.style.display="none";const n=`\n
    \n
    \n \n ${t.dialogBox.mentionBox.title}\n
    \n
    \n \n
      \n
    \n
    \n
    \n `;return e.innerHTML=n,e},getId:e=>e,getValue:e=>"@"+e,getLinkHref:()=>"",open:function(){const{mention:e}=this.context;this.plugins.dialog.open.call(this,"mention","mention"===this.currentControllerName),e.search.focus(),e.renderList("")},on:function(e){e||this.plugins.mention.init.call(this)},init:function(){const{mention:e}=this.context;e.search.value="",e.focussed=0,e.items=[],e._itemElements={},e.list.innerHTML="",delete e.term},onKeyPress:function(e){const{mention:t}=this.context;switch(e.key){case"ArrowDown":t.focussed+=1,e.preventDefault(),e.stopPropagation();break;case"ArrowUp":t.focussed>0&&(t.focussed-=1),e.preventDefault(),e.stopPropagation();break;case"Enter":t.addMention(),e.preventDefault(),e.stopPropagation()}},onKeyUp:function(e){const{mention:t}=this.context;t.renderList(e.target.value)},getMentions:function(){const{mentions:e,getId:t}=this.context.mention;return e.filter(e=>{const n=t(e);return this.context.element.wysiwyg.querySelector(`[data-mention="${n}"]`)})},addMention:function(){const{mention:e}=this.context,t=e.items[e.focussed];if(t){e.mentions.find(n=>e.getId(n)===e.getId(t))||e.mentions.push(t);const n=this.util.createElement("A");n.href=e.getLinkHref(t),n.target="_blank",n.innerHTML=e.getValue(t),n.setAttribute("data-mention",e.getId(t)),this.insertNode(n,null,!1);const i=this.util.createElement("SPAN");i.innerHTML=" ",this.insertNode(i,n,!1)}this.plugins.dialog.close.call(this)},add:function(e){e.addModule([r.a]),this.title=e.lang.toolbar.mention;const t=this.setDialog.call(e);e.getMentions=this.getMentions.bind(e);const n=t.querySelector(".se-mention-search");n.addEventListener("keyup",this.onKeyUp.bind(e)),n.addEventListener("keydown",this.onKeyPress.bind(e));const i=t.querySelector(".se-mention-list");e.context.mention={modal:t,search:n,list:i,triggerKey:this.triggerKey,visible:!1,addMention:this.addMention.bind(e),mentions:[],items:[],_itemElements:{},renderList:this.renderList.bind(e),getId:this.getId.bind(e),getValue:this.getValue.bind(e),getLinkHref:this.getLinkHref.bind(e),open:this.open.bind(e),focussed:0,renderItem:this.renderItem,getItems:this.getItems},e.context.dialog.modal.appendChild(t)},action:function(){}},C=n("JhlZ"),w=n.n(C),x={blockquote:{name:"blockquote",display:"command",add:function(e,t){e.context.blockquote={targetButton:t,tag:e.util.createElement("BLOCKQUOTE")}},active:function(e){if(e){if(/blockquote/i.test(e.nodeName))return this.util.addClass(this.context.blockquote.targetButton,"active"),!0}else this.util.removeClass(this.context.blockquote.targetButton,"active");return!1},action:function(){const e=this.util.getParentElement(this.getSelectionNode(),"blockquote");e?this.detachRangeFormatElement(e,null,null,!1,!1):this.applyRangeFormatElement(this.context.blockquote.tag.cloneNode(!1))}},align:{name:"align",display:"submenu",add:function(e,t){const n=e.icons,i=e.context;i.align={targetButton:t,_alignList:null,currentAlign:"",icons:{justify:n.align_justify,left:n.align_left,right:n.align_right,center:n.align_center}};let l=this.setSubmenu.call(e),o=l.querySelector("ul");o.addEventListener("click",this.pickup.bind(e)),i.align._alignList=o.querySelectorAll("li button"),e.initMenuTarget(this.name,t,l),l=null,o=null},setSubmenu:function(){const e=this.lang,t=this.icons,n=this.util.createElement("DIV");return n.className="se-submenu se-list-layer se-list-align",n.innerHTML='
    ",n},active:function(e){const t=this.context.align.targetButton,n=t.firstElementChild;if(e){if(this.util.isFormatElement(e)){const i=e.style.textAlign;if(i)return this.util.changeElement(n,this.context.align.icons[i]),t.setAttribute("data-focus",i),!0}}else this.util.changeElement(n,this.context.align.icons.left),t.removeAttribute("data-focus");return!1},on:function(){const e=this.context.align,t=e._alignList,n=e.targetButton.getAttribute("data-focus")||"left";if(n!==e.currentAlign){for(let e=0,i=t.length;e('+t.toolbar.default+")";for(o=0,s=a.length;o";return r+="",n.innerHTML=r,n},active:function(e){const t=this.context.font.targetText,n=this.context.font.targetTooltip;if(e){if(e.style&&e.style.fontFamily.length>0){const i=e.style.fontFamily.replace(/["']/g,"");return this.util.changeTxt(t,i),this.util.changeTxt(n,i),!0}}else{const e=this.lang.toolbar.font;this.util.changeTxt(t,e),this.util.changeTxt(n,e)}return!1},on:function(){const e=this.context.font,t=e._fontList,n=e.targetText.textContent;if(n!==e.currentFont){for(let e=0,i=t.length;e('+t.toolbar.default+")";for(let t,n=0,o=e.fontSizeUnit,s=i.length;n";return l+="",n.innerHTML=l,n},active:function(e){if(e){if(e.style&&e.style.fontSize.length>0)return this.util.changeTxt(this.context.fontSize.targetText,e.style.fontSize),!0}else this.util.changeTxt(this.context.fontSize.targetText,this.lang.toolbar.fontSize);return!1},on:function(){const e=this.context.fontSize,t=e._sizeList,n=e.targetText.textContent;if(n!==e.currentSize){for(let e=0,i=t.length;e
  • ',t},appendHr:function(e){const t=this.util.createElement("HR");return t.className=e,this.focus(),this.insertComponent(t,!1,!0,!1)},horizontalRulePick:function(e){e.preventDefault(),e.stopPropagation();let t=e.target,n=null;for(;!n&&!/UL/i.test(t.tagName);)n=t.getAttribute("data-value"),t=t.parentNode;if(!n)return;const i=this.plugins.horizontalRule.appendHr.call(this,"__se__"+n);i&&(this.setRange(i,0,i,0),this.submenuOff())}},list:{name:"list",display:"submenu",add:function(e,t){const n=e.context;n.list={targetButton:t,_list:null,currentList:"",icons:{bullets:e.icons.list_bullets,number:e.icons.list_number}};let i=this.setSubmenu.call(e),l=i.querySelector("ul");l.addEventListener("click",this.pickup.bind(e)),n.list._list=l.querySelectorAll("li button"),e.initMenuTarget(this.name,t,i),i=null,l=null},setSubmenu:function(){const e=this.lang,t=this.util.createElement("DIV");return t.className="se-submenu se-list-layer",t.innerHTML='
    ",t},active:function(e){const t=this.context.list.targetButton,n=t.firstElementChild,i=this.util;if(e){if(i.isList(e)){const l=e.nodeName;return t.setAttribute("data-focus",l),i.addClass(t,"active"),/UL/i.test(l)?i.changeElement(n,this.context.list.icons.bullets):i.changeElement(n,this.context.list.icons.number),!0}}else t.removeAttribute("data-focus"),i.changeElement(n,this.context.list.icons.number),i.removeClass(t,"active");return!1},on:function(){const e=this.context.list,t=e._list,n=e.targetButton.getAttribute("data-focus")||"";if(n!==e.currentList){for(let e=0,i=t.length;e"),t.innerHTML+=n.outerHTML,e&&(t.innerHTML+="
    ")}else{const e=n.childNodes;for(;e[0];)t.appendChild(e[0])}a.appendChild(t),r||(u=a),r&&m===g&&!o.isRangeFormatElement(f)||(d||(d=a),i&&r&&m===g||r&&o.isList(g)&&g===c||a.parentNode!==m&&m.insertBefore(a,f)),o.removeItem(n),i&&null===h&&(h=a.children.length-1),r&&(o.getRangeFormatElement(g,p)!==o.getRangeFormatElement(c,p)||o.isList(g)&&o.isList(c)&&o.getElementDepth(g)!==o.getElementDepth(c))&&(a=o.createElement(e)),_&&0===_.children.length&&o.removeItem(_)}else o.removeItem(n);h&&(d=d.children[h]),s&&(g=a.children.length-1,a.innerHTML+=c.innerHTML,u=a.children[g],o.removeItem(c))}else{if(n)for(let e=0,t=l.length;e=0;n--)if(l[n].contains(l[e])){l.splice(e,1),e--,t--;break}const t=o.getRangeFormatElement(s),i=t&&t.tagName===e;let a,r;const c=function(e){return!this.isComponent(e)}.bind(o);i||(r=o.createElement(e));for(let t,s,d=0,u=l.length;d0){const e=l.cloneNode(!1),t=l.childNodes,o=this.util.getPositionIndex(i);for(;t[o];)e.appendChild(t[o]);n.appendChild(e)}0===l.children.length&&this.util.removeItem(l),this.util.mergeSameTags(s);const a=this.util.getEdgeChildNodes(t,n);return{cc:t.parentNode,sc:a.sc,ec:a.ec}},editInsideList:function(e,t){const n=(t=t||this.getSelectedElements().filter(function(e){return this.isListCell(e)}.bind(this.util))).length;if(0===n||!e&&!this.util.isListCell(t[0].previousElementSibling)&&!this.util.isListCell(t[n-1].nextElementSibling))return{sc:t[0],so:0,ec:t[n-1],eo:1};let i=t[0].parentNode,l=t[n-1],o=null;if(e){if(i!==l.parentNode&&this.util.isList(l.parentNode.parentNode)&&l.nextElementSibling)for(l=l.nextElementSibling;l;)t.push(l),l=l.nextElementSibling;o=this.plugins.list.editList.call(this,i.nodeName.toUpperCase(),t,!0)}else{let e=this.util.createElement(i.nodeName),s=t[0].previousElementSibling,a=l.nextElementSibling;const r={s:null,e:null,sl:i,el:i};for(let l,o=0,c=n;o span > span"),n.table.columnFixedButton=o.querySelector("._se_table_fixed_column"),n.table.headerButton=o.querySelector("._se_table_header"),o.addEventListener("mousedown",e.eventStop);let s=this.setController_tableEditor.call(e,n.table.cellControllerTop);n.table.resizeDiv=s,n.table.splitMenu=s.querySelector(".se-btn-group-sub"),n.table.mergeButton=s.querySelector("._se_table_merge_button"),n.table.splitButton=s.querySelector("._se_table_split_button"),n.table.insertRowAboveButton=s.querySelector("._se_table_insert_row_a"),n.table.insertRowBelowButton=s.querySelector("._se_table_insert_row_b"),s.addEventListener("mousedown",e.eventStop),l.addEventListener("mousemove",this.onMouseMove_tablePicker.bind(e)),l.addEventListener("click",this.appendTable.bind(e)),s.addEventListener("click",this.onClick_tableController.bind(e)),o.addEventListener("click",this.onClick_tableController.bind(e)),e.initMenuTarget(this.name,t,i),n.element.relative.appendChild(s),n.element.relative.appendChild(o),i=null,l=null,s=null,o=null},setSubmenu:function(){const e=this.util.createElement("DIV");return e.className="se-submenu se-selector-table",e.innerHTML='
    1 x 1
    ',e},setController_table:function(){const e=this.lang,t=this.icons,n=this.util.createElement("DIV");return n.className="se-controller se-controller-table",n.innerHTML='
    ",n},setController_tableEditor:function(e){const t=this.lang,n=this.icons,i=this.util.createElement("DIV");return i.className="se-controller se-controller-table-cell",i.innerHTML=(e?"":'
    ')+'
    • '+t.controller.VerticalSplit+'
    • '+t.controller.HorizontalSplit+"
    ",i},appendTable:function(){const e=this.util.createElement("TABLE"),t=this.plugins.table.createCells,n=this.context.table._tableXY[0];let i=this.context.table._tableXY[1],l="";for(;i>0;)l+=""+t.call(this,"td",n)+"",--i;l+="",e.innerHTML=l;if(this.insertComponent(e,!1,!0,!1)){const t=e.querySelector("td div");this.setRange(t,0,t,0),this.plugins.table.reset_table_picker.call(this)}},createCells:function(e,t,n){if(e=e.toLowerCase(),n){const t=this.util.createElement(e);return t.innerHTML="

    ",t}{let n="";for(;t>0;)n+="<"+e+">

    ",t--;return n}},onMouseMove_tablePicker:function(e){e.stopPropagation();let t=this._w.Math.ceil(e.offsetX/18),n=this._w.Math.ceil(e.offsetY/18);t=t<1?1:t,n=n<1?1:n,this.context.table.tableHighlight.style.width=t+"em",this.context.table.tableHighlight.style.height=n+"em";this.context.table.tableUnHighlight.style.width="10em",this.context.table.tableUnHighlight.style.height="10em",this.util.changeTxt(this.context.table.tableDisplay,t+" x "+n),this.context.table._tableXY=[t,n]},reset_table_picker:function(){if(!this.context.table.tableHighlight)return;const e=this.context.table.tableHighlight.style,t=this.context.table.tableUnHighlight.style;e.width="1em",e.height="1em",t.width="10em",t.height="10em",this.util.changeTxt(this.context.table.tableDisplay,"1 x 1"),this.submenuOff()},init:function(){const e=this.context.table,t=this.plugins.table;if(t._removeEvents.call(this),t._selectedTable){const e=t._selectedTable.querySelectorAll(".se-table-selected-cell");for(let t=0,n=e.length;t0)for(let e,t=0;to||(u>=e.index?(i+=e.cs,u+=e.cs,e.rs-=1,e.row=o+1,e.rs<1&&(r.splice(t,1),t--)):h===g-1&&(e.rs-=1,e.row=o+1,e.rs<1&&(r.splice(t,1),t--)));if(o===s&&h===l){n._logical_cellIndex=u;break}d>0&&a.push({index:u,cs:c+1,rs:d,row:-1}),i+=c}r=r.concat(a).sort((function(e,t){return e.index-t.index})),a=[]}a=null,r=null}},editTable:function(e,t){const n=this.plugins.table,i=this.context.table,l=i._element,o="row"===e;if(o){const e=i._trElement.parentNode;if(/^THEAD$/i.test(e.nodeName)){if("up"===t)return;if(!e.nextElementSibling||!/^TBODY$/i.test(e.nextElementSibling.nodeName))return void(l.innerHTML+=""+n.createCells.call(this,"td",i._logical_cellCnt,!1)+"")}}if(n._ref){const e=i._tdElement,l=n._selectedCells;if(o)if(t)n.setCellInfo.call(this,"up"===t?l[0]:l[l.length-1],!0),n.editRow.call(this,t,e);else{let e=l[0].parentNode;const i=[l[0]];for(let t,n=1,o=l.length;ns&&s>t&&(e[l].rowSpan=n+a,c-=i)}if(i){const e=r[o+1];if(e){const t=[];let n=r[o].cells,i=0;for(let e,l,o=0,s=n.length;o1&&(e.rowSpan-=1,t.push({cell:e.cloneNode(!1),index:l}));if(t.length>0){let l=t.shift();n=e.cells,i=0;for(let o,s,a=0,r=n.length;a=l.index)||(a--,i--,i+=l.cell.colSpan-1,e.insertBefore(l.cell,o),l=t.shift(),l));a++);if(l){e.appendChild(l.cell);for(let n=0,i=t.length;n0){const e=!o[b+1];for(let t,n=0;n_||(p>=t.index?(f+=t.cs,p=b+f,t.rs-=1,t.row=_+1,t.rs<1&&(d.splice(n,1),n--)):e&&(t.rs-=1,t.row=_+1,t.rs<1&&(d.splice(n,1),n--)))}n>0&&c.push({rs:n,cs:r+1,index:p,row:-1}),p>=t&&p+r<=t+s?h.push(e):p<=t+s&&p+r>=t?e.colSpan-=i.getOverlapRangeAtIndex(a,a+s,p,p+r):n>0&&(pt+s)&&g.push({cell:e,i:_,rs:_+n}),f+=r}else{if(b>=t)break;if(r>0){if(u<1&&r+b>=t){e.colSpan+=1,t=null,u=n+1;break}t-=r}if(!m){for(let e,n=0;n0){u-=1;continue}null!==t&&o.length>0&&(p=this.plugins.table.createCells.call(this,o[0].nodeName,0,!0),p=e.insertBefore(p,o[t]))}}if(l){let e,t;for(let n,l=0,o=h.length;l1)c.colSpan=this._w.Math.floor(e/2),l.colSpan=e-c.colSpan,s.insertBefore(c,l.nextElementSibling);else{let t=[],n=[];for(let s,r,c=0,d=i._rowCnt;c0)for(let e,t=0;tc||(u>=e.index?(r+=e.cs,u+=e.cs,e.rs-=1,e.row=c+1,e.rs<1&&(n.splice(t,1),t--)):h===g-1&&(e.rs-=1,e.row=c+1,e.rs<1&&(n.splice(t,1),t--)));if(u<=a&&d>0&&t.push({index:u,cs:o+1,rs:d,row:-1}),i!==l&&u<=a&&u+o>=a+e-1){i.colSpan+=1;break}if(u>a)break;r+=o}n=n.concat(t).sort((function(e,t){return e.index-t.index})),t=[]}s.insertBefore(c,l.nextElementSibling)}}else{const e=l.rowSpan;if(c.colSpan=l.colSpan,e>1){c.rowSpan=this._w.Math.floor(e/2);const n=e-c.rowSpan,i=[],r=t.getArrayIndex(o,s)+n;for(let e,t,n=0;n=a));c++)l=e[c],o=l.rowSpan-1,o>0&&o+n>=r&&s=h.index&&(r+=h.cs,l+=h.cs,h=i.shift()),l>=a||o===s-1){d.insertBefore(c,e.nextElementSibling);break}r+=t}l.rowSpan=n}else{c.rowSpan=l.rowSpan;const e=t.createElement("TR");e.appendChild(c);for(let e,t=0;t=r&&(e[n].rowSpan+=1)}const n=i._physical_cellIndex,a=s.cells;for(let e=0,t=a.length;e0&&s+o>=i&&(e.rowSpan-=n.getOverlapRangeAtIndex(i,l,s,s+o));else o.push(e[s]);for(let e=0,t=o.length;e"+this.plugins.table.createCells.call(this,"th",this.context.table._logical_cellCnt,!1)+"",i.insertBefore(t,i.firstElementChild)}e.toggleClass(t,"active"),/TH/i.test(this.context.table._tdElement.nodeName)?this.controllersOff():this.plugins.table.setPositionControllerDiv.call(this,this.context.table._tdElement,!1)},setTableStyle:function(e){const t=this.context.table,n=t._element;let i,l,o,s;e.indexOf("width")>-1&&(i=t.resizeButton.firstElementChild,l=t.resizeText,t._maxWidth?(o=t.icons.reduction,s=t.minText,t.columnFixedButton.style.display="block",this.util.removeClass(n,"se-table-size-auto"),this.util.addClass(n,"se-table-size-100")):(o=t.icons.expansion,s=t.maxText,t.columnFixedButton.style.display="none",this.util.removeClass(n,"se-table-size-100"),this.util.addClass(n,"se-table-size-auto")),this.util.changeElement(i,o),this.util.changeTxt(l,s)),e.indexOf("column")>-1&&(t._fixedColumn?(this.util.removeClass(n,"se-table-layout-auto"),this.util.addClass(n,"se-table-layout-fixed"),this.util.addClass(t.columnFixedButton,"active")):(this.util.removeClass(n,"se-table-layout-fixed"),this.util.addClass(n,"se-table-layout-auto"),this.util.removeClass(t.columnFixedButton,"active")))},setActiveButton:function(e,t){const n=this.context.table;/^TH$/i.test(e.nodeName)?(n.insertRowAboveButton.setAttribute("disabled",!0),n.insertRowBelowButton.setAttribute("disabled",!0)):(n.insertRowAboveButton.removeAttribute("disabled"),n.insertRowBelowButton.removeAttribute("disabled")),t&&e!==t?(n.splitButton.setAttribute("disabled",!0),n.mergeButton.removeAttribute("disabled")):(n.splitButton.removeAttribute("disabled"),n.mergeButton.setAttribute("disabled",!0))},_bindOnSelect:null,_bindOffSelect:null,_bindOffShift:null,_selectedCells:null,_shift:!1,_fixedCell:null,_fixedCellName:null,_selectedCell:null,_selectedTable:null,_ref:null,_toggleEditor:function(e){this.context.element.wysiwyg.setAttribute("contenteditable",e),e?this.util.removeClass(this.context.element.wysiwyg,"se-disabled"):this.util.addClass(this.context.element.wysiwyg,"se-disabled")},_offCellMultiSelect:function(e){e.stopPropagation();const t=this.plugins.table;t._shift?t._initBind&&(this._wd.removeEventListener("touchmove",t._initBind),t._initBind=null):(t._removeEvents.call(this),t._toggleEditor.call(this,!0)),t._fixedCell&&t._selectedTable&&(t.setActiveButton.call(this,t._fixedCell,t._selectedCell),t.call_controller_tableEdit.call(this,t._selectedCell||t._fixedCell),t._selectedCells=t._selectedTable.querySelectorAll(".se-table-selected-cell"),t._selectedCell&&t._fixedCell&&this.focusEdge(t._selectedCell),t._shift||(t._fixedCell=null,t._selectedCell=null,t._fixedCellName=null))},_onCellMultiSelect:function(e){this._antiBlur=!0;const t=this.plugins.table,n=this.util.getParentElement(e.target,this.util.isCell);if(t._shift)n===t._fixedCell?t._toggleEditor.call(this,!0):t._toggleEditor.call(this,!1);else if(!t._ref){if(n===t._fixedCell)return;t._toggleEditor.call(this,!1)}n&&n!==t._selectedCell&&t._fixedCellName===n.nodeName&&t._selectedTable===this.util.getParentElement(n,"TABLE")&&(t._selectedCell=n,t._setMultiCells.call(this,t._fixedCell,n))},_setMultiCells:function(e,t){const n=this.plugins.table,i=n._selectedTable.rows,l=this.util,o=n._selectedTable.querySelectorAll(".se-table-selected-cell");for(let e=0,t=o.length;e0)for(let e,t=0;td||(u>=e.index?(o+=e.cs,u+=e.cs,e.rs-=1,e.row=d+1,e.rs<1&&(a.splice(t,1),t--)):p===m-1&&(e.rs-=1,e.row=d+1,e.rs<1&&(a.splice(t,1),t--)));if(s){if(i!==e&&i!==t||(c.cs=null!==c.cs&&c.csu+h?c.ce:u+h,c.rs=null!==c.rs&&c.rsd+g?c.re:d+g,c._i+=1),2===c._i){s=!1,a=[],r=[],d=-1;break}}else if(l.getOverlapRangeAtIndex(c.cs,c.ce,u,u+h)&&l.getOverlapRangeAtIndex(c.rs,c.re,d,d+g)){const e=c.csu+h?c.ce:u+h,n=c.rsd+g?c.re:d+g;if(c.cs!==e||c.ce!==t||c.rs!==n||c.re!==o){c.cs=e,c.ce=t,c.rs=n,c.re=o,d=-1,a=[],r=[];break}l.addClass(i,"se-table-selected-cell")}g>0&&r.push({index:u,cs:h+1,rs:g,row:-1}),o+=i.colSpan-1}a=a.concat(r).sort((function(e,t){return e.index-t.index})),r=[]}},_removeEvents:function(){const e=this.plugins.table;e._initBind&&(this._wd.removeEventListener("touchmove",e._initBind),e._initBind=null),e._bindOnSelect&&(this._wd.removeEventListener("mousedown",e._bindOnSelect),this._wd.removeEventListener("mousemove",e._bindOnSelect),e._bindOnSelect=null),e._bindOffSelect&&(this._wd.removeEventListener("mouseup",e._bindOffSelect),e._bindOffSelect=null),e._bindOffShift&&(this._wd.removeEventListener("keyup",e._bindOffShift),e._bindOffShift=null)},_initBind:null,onTableCellMultiSelect:function(e,t){const n=this.plugins.table;n._removeEvents.call(this),this.controllersOff(),n._shift=t,n._fixedCell=e,n._fixedCellName=e.nodeName,n._selectedTable=this.util.getParentElement(e,"TABLE");const i=n._selectedTable.querySelectorAll(".se-table-selected-cell");for(let e=0,t=i.length;e-1?(n=e.toLowerCase(),s="blockquote"===n?"range":"pre"===n?"free":"replace",r=/^h/.test(n)?n.match(/\d+/)[0]:"",a=t["tag_"+(r?"h":n)]+r,d="",c=""):(n=e.tag.toLowerCase(),s=e.command,a=e.name||n,d=e.class,c=d?' class="'+d+'"':""),o+='
  • ";return o+="",n.innerHTML=o,n},active:function(e){let t=this.lang.toolbar.formats;const n=this.context.formatBlock.targetText,i=this.context.formatBlock.targetTooltip;if(e){if(this.util.isFormatElement(e)){const l=this.context.formatBlock._formatList,o=e.nodeName.toLowerCase(),s=(e.className.match(/(\s|^)__se__format__[^\s]+/)||[""])[0].trim();for(let e,n=0,i=l.length;n=0;u--)if(i=p[u],i!==(p[u+1]?p[u+1].parentNode:null)){if(d=r.isComponent(i),o=d?"":i.innerHTML.replace(/(?!>)\s+(?=<)|\n/g," "),s=r.getParentElement(i,(function(e){return e.parentNode===t})),(t!==i.parentNode||d)&&(r.isFormatElement(t)?(t.parentNode.insertBefore(n,t.nextSibling),t=t.parentNode):(t.insertBefore(n,s?s.nextSibling:null),t=i.parentNode),a=n.nextSibling,a&&n.nodeName===a.nodeName&&r.isSameAttributes(n,a)&&(n.innerHTML+="
    "+a.innerHTML,r.removeItem(a)),n=l.cloneNode(!1),h=!0),c=n.innerHTML,n.innerHTML=(h||!o||!c||/
    $/i.test(o)?o:o+"
    ")+c,0===u){t.insertBefore(n,i),a=i.nextSibling,a&&n.nodeName===a.nodeName&&r.isSameAttributes(n,a)&&(n.innerHTML+="
    "+a.innerHTML,r.removeItem(a));const e=n.previousSibling;e&&n.nodeName===e.nodeName&&r.isSameAttributes(n,e)&&(e.innerHTML+="
    "+n.innerHTML,r.removeItem(n))}d||r.removeItem(i),o&&(h=!1)}this.setRange(i,0,i,0)}else{for(let e,t,n=0,s=p.length;n('+t.toolbar.default+")";for(let e,t=0,n=i.length;t";return l+="",n.innerHTML=l,n},on:function(){const e=this.context.lineHeight,t=e._sizeList,n=this.util.getFormatElement(this.getSelectionNode()),i=n?n.style.lineHeight+"":"";if(i!==e.currentSize){for(let e=0,n=t.length;e"}return o+="",t.innerHTML=o,t},on:function(){const e=this.context.paragraphStyle._classList,t=this.util.getFormatElement(this.getSelectionNode());for(let n=0,i=e.length;n"}return l+="",t.innerHTML=l,t},on:function(){const e=this.util,t=this.context.textStyle._styleList,n=this.getSelectionNode();for(let i,l,o,s=0,a=t.length;s'+(e.alt||t)+'
    '+(e.name||t)+"
    "},setImage:function(e){this.callPlugin("image",function(){const t={name:e.parentNode.querySelector(".__se__img_name").textContent,size:0};this.context.image._altText=e.alt,this.plugins.image.create_image.call(this,e.src,"",!1,this.context.image._origin_w,this.context.image._origin_h,"none",t)}.bind(this),null)}},mention:y},E={redo:'',undo:'',bold:'',underline:'',italic:'',strike:'',subscript:'',superscript:'',erase:'',indent:'',outdent:'',expansion:'',reduction:'',code_view:'',preview:'',print:'',template:'',line_height:'',paragraph_style:'',text_style:'',save:'',blockquote:'',arrow_down:'',align_justify:'',align_left:'',align_right:'',align_center:'',font_color:'',highlight_color:'',list_bullets:'',list_number:'',table:'',horizontal_rule:'',show_blocks:'',cancel:'',image:'',video:'',link:'',math:'',unlink:'',table_header:'',merge_cell:'',split_cell:'',caption:'',edit:'',delete:'',modify:'',revert:'',auto_size:'',insert_row_below:'',insert_row_above:'',insert_column_left:'',insert_column_right:'',delete_row:'',delete_column:'',fixed_column_width:'',rotate_left:'',rotate_right:'',mirror_horizontal:'',mirror_vertical:'',checked:'',line_break:'',audio:'',image_gallery:'',more_text:'',more_paragraph:'',more_plus:'',more_horizontal:'',more_vertical:'',attachment:'',map:'',magic_stick:'',empty_file:''},S=n("P6u4"),N=n.n(S);const T={_d:null,_w:null,isIE:null,isIE_Edge:null,isOSX_IOS:null,_propertiesInit:function(){this._d||(this._d=document,this._w=window,this.isIE=navigator.userAgent.indexOf("Trident")>-1,this.isIE_Edge=navigator.userAgent.indexOf("Trident")>-1||navigator.appVersion.indexOf("Edge")>-1,this.isOSX_IOS=/(Mac|iPhone|iPod|iPad)/.test(navigator.platform))},_HTMLConvertor:function(e){const t={"&":"&"," ":" ","'":"'",'"':""","<":"<",">":">"};return e.replace(/&|\u00A0|'|"|<|>/g,(function(e){return"string"==typeof t[e]?t[e]:e}))},zeroWidthSpace:String.fromCharCode(8203),zeroWidthRegExp:new RegExp(String.fromCharCode(8203),"g"),onlyZeroWidthRegExp:new RegExp("^"+String.fromCharCode(8203)+"+$"),onlyZeroWidthSpace:function(e){return"string"!=typeof e&&(e=e.textContent),""===e||this.onlyZeroWidthRegExp.test(e)},getXMLHttpRequest:function(){if(!this._w.ActiveXObject)return this._w.XMLHttpRequest?new XMLHttpRequest:null;try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(e){try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(e){return null}}},createElement:function(e){return this._d.createElement(e)},createTextNode:function(e){return this._d.createTextNode(e||"")},HTMLEncoder:function(e){const t={"<":"$lt;",">":"$gt;"};return e.replace(/<|>/g,(function(e){return"string"==typeof t[e]?t[e]:e}))},HTMLDecoder:function(e){const t={"$lt;":"<","$gt;":">"};return e.replace(/\$lt;|\$gt;/g,(function(e){return"string"==typeof t[e]?t[e]:e}))},hasOwn:function(e,t){return this._hasOwn.call(e,t)},_hasOwn:Object.prototype.hasOwnProperty,getIncludePath:function(e,t){let n="";const i=[],l="js"===t?"script":"link",o="js"===t?"src":"href";let s="(?:";for(let t=0,n=e.length;t0?i[0][o]:""),-1===n.indexOf(":/")&&"//"!==n.slice(0,2)&&(n=0===n.indexOf("/")?location.href.match(/^.*?:\/\/[^\/]*/)[0]+n:location.href.match(/^[^\?]*\/(?:)/)[0]+n),!n)throw"[SUNEDITOR.util.getIncludePath.fail] The SUNEDITOR installation path could not be automatically detected. (name: +"+name+", extension: "+t+")";return n},getPageStyle:function(e){let t="";const n=(e||this._d).styleSheets;for(let e,i=0,l=n.length;i-1||(i+=n[e].name+'="'+n[e].value+'" ');return i},getByteLength:function(e){const t=this._w.encodeURIComponent;let n,i;return this.isIE_Edge?(i=this._w.unescape(t(e.toString())).length,n=0,null!==t(e.toString()).match(/(%0A|%0D)/gi)&&(n=t(e.toString()).match(/(%0A|%0D)/gi).length),i+n):(i=new this._w.TextEncoder("utf-8").encode(e.toString()).length,n=0,null!==t(e.toString()).match(/(%0A|%0D)/gi)&&(n=t(e.toString()).match(/(%0A|%0D)/gi).length),i+n)},isWysiwygDiv:function(e){return e&&1===e.nodeType&&(this.hasClass(e,"se-wrapper-wysiwyg")||/^BODY$/i.test(e.nodeName))},isNonEditable:function(e){return e&&1===e.nodeType&&"false"===e.getAttribute("contenteditable")},isTextStyleElement:function(e){return e&&3!==e.nodeType&&/^(strong|span|font|b|var|i|em|u|ins|s|strike|del|sub|sup|mark|a|label|code)$/i.test(e.nodeName)},isFormatElement:function(e){return e&&1===e.nodeType&&(/^(P|DIV|H[1-6]|PRE|LI|TH|TD)$/i.test(e.nodeName)||this.hasClass(e,"(\\s|^)__se__format__replace_.+(\\s|$)|(\\s|^)__se__format__free_.+(\\s|$)"))&&!this.isComponent(e)&&!this.isWysiwygDiv(e)},isRangeFormatElement:function(e){return e&&1===e.nodeType&&(/^(BLOCKQUOTE|OL|UL|FIGCAPTION|TABLE|THEAD|TBODY|TR|TH|TD)$/i.test(e.nodeName)||this.hasClass(e,"(\\s|^)__se__format__range_.+(\\s|$)"))},isClosureRangeFormatElement:function(e){return e&&1===e.nodeType&&(/^(TH|TD)$/i.test(e.nodeName)||this.hasClass(e,"(\\s|^)__se__format__range__closure_.+(\\s|$)"))},isFreeFormatElement:function(e){return e&&1===e.nodeType&&(/^PRE$/i.test(e.nodeName)||this.hasClass(e,"(\\s|^)__se__format__free_.+(\\s|$)"))&&!this.isComponent(e)&&!this.isWysiwygDiv(e)},isClosureFreeFormatElement:function(e){return e&&1===e.nodeType&&this.hasClass(e,"(\\s|^)__se__format__free__closure_.+(\\s|$)")},isComponent:function(e){return e&&(/se-component/.test(e.className)||/^(TABLE|HR)$/.test(e.nodeName))},isMediaComponent:function(e){return e&&/se-component/.test(e.className)},isNotCheckingNode:function(e){return e&&/katex|__se__tag/.test(e.className)},getFormatElement:function(e,t){if(!e)return null;for(t||(t=function(){return!0});e;){if(this.isWysiwygDiv(e))return null;if(this.isRangeFormatElement(e)&&e.firstElementChild,this.isFormatElement(e)&&t(e))return e;e=e.parentNode}return null},getRangeFormatElement:function(e,t){if(!e)return null;for(t||(t=function(){return!0});e;){if(this.isWysiwygDiv(e))return null;if(this.isRangeFormatElement(e)&&!/^(THEAD|TBODY|TR)$/i.test(e.nodeName)&&t(e))return e;e=e.parentNode}return null},getFreeFormatElement:function(e,t){if(!e)return null;for(t||(t=function(){return!0});e;){if(this.isWysiwygDiv(e))return null;if(this.isFreeFormatElement(e)&&t(e))return e;e=e.parentNode}return null},getClosureFreeFormatElement:function(e,t){if(!e)return null;for(t||(t=function(){return!0});e;){if(this.isWysiwygDiv(e))return null;if(this.isClosureFreeFormatElement(e)&&t(e))return e;e=e.parentNode}return null},copyTagAttributes:function(e,t){t.style.cssText&&(e.style.cssText+=t.style.cssText);const n=t.classList;for(let t=0,i=n.length;ts?1:o0&&!this.isBreak(e);)e=e.firstChild;for(;t&&1===t.nodeType&&t.childNodes.length>0&&!this.isBreak(t);)t=t.lastChild;return{sc:e,ec:t||e}}},getOffset:function(e,t){let n=0,i=0,l=3===e.nodeType?e.parentElement:e;const o=this.getParentElement(e,this.isWysiwygDiv.bind(this));for(;l&&!this.hasClass(l,"se-container")&&l!==o;)n+=l.offsetLeft,i+=l.offsetTop,l=l.offsetParent;const s=t&&/iframe/i.test(t.nodeName);return{left:n+(s?t.parentElement.offsetLeft:0),top:i-o.scrollTop+(s?t.parentElement.offsetTop:0)}},getOverlapRangeAtIndex:function(e,t,n,i){if(e<=i?tn)return 0;const l=(e>n?e:n)-(t0?" ":"")+t)},removeClass:function(e,t){if(!e)return;const n=new this._w.RegExp("(\\s|^)"+t+"(\\s|$)");e.className=e.className.replace(n," ").trim(),e.className.trim()||e.removeAttribute("class")},toggleClass:function(e,t){if(!e)return;const n=new this._w.RegExp("(\\s|^)"+t+"(\\s|$)");n.test(e.className)?e.className=e.className.replace(n," ").trim():e.className+=" "+t,e.className.trim()||e.removeAttribute("class")},setDisabledButtons:function(e,t){for(let n=0,i=t.length;n=0){e.splitText(t);const n=this.getNodeFromPath([a+1],i);this.onlyZeroWidthSpace(n)&&(n.data=this.zeroWidthSpace)}}else 1===e.nodeType&&(e.previousSibling?e=e.previousSibling:this.getElementDepth(e)===n&&(r=!1));let c=e;for(;this.getElementDepth(c)>n;)for(a=this.getPositionIndex(c)+1,c=c.parentNode,s=l,l=c.cloneNode(!1),o=c.childNodes,s&&(this.isListCell(l)&&this.isList(s)&&s.firstElementChild?(l.innerHTML=s.firstElementChild.innerHTML,T.removeItem(s.firstElementChild),s.children.length>0&&l.appendChild(s)):l.appendChild(s));o[a];)l.appendChild(o[a]);c.childNodes.length<=1&&(!c.firstChild||0===c.firstChild.textContent.length)&&(c.innerHTML="
    ");const d=c.parentNode;return r&&(c=c.nextSibling),l?(this.mergeSameTags(l,null,!1),this.mergeNestedTags(l,function(e){return this.isList(e)}.bind(this)),l.childNodes.length>0?d.insertBefore(l,c):l=c,0===i.childNodes.length&&this.removeItem(i),l):c},mergeSameTags:function(e,t,n){const i=this,l=t?t.length:0;let o=null;return l&&(o=this._w.Array.apply(null,new this._w.Array(l)).map(this._w.Number.prototype.valueOf,0)),function e(s,a,r){const c=s.childNodes;for(let d,u,h=0,g=c.length;h=0;){if(i.getArrayIndex(o.childNodes,n)!==e[r]){c=!1;break}n=d.parentNode,o=n.parentNode,r--}c&&(e.splice(a,1),e[a]=h)}}i.copyTagAttributes(d,s),s.parentNode.insertBefore(d,s),i.removeItem(s)}if(!u){1===d.nodeType&&e(d,a+1,h);break}if(d.nodeName===u.nodeName&&i.isSameAttributes(d,u)&&d.href===u.href){const e=d.childNodes;let n=0;for(let t=0,i=e.length;t0&&n++;const s=d.lastChild,c=u.firstChild;let g=0;if(s&&c){const e=3===s.nodeType&&3===c.nodeType;g=s.textContent.length;let i=s.previousSibling;for(;i&&3===i.nodeType;)g+=i.textContent.length,i=i.previousSibling;if(n>0&&3===s.nodeType&&3===c.nodeType&&(s.textContent.length>0||c.textContent.length>0)&&n--,l){let i=null;for(let d=0;dh){if(a>0&&i[a-1]!==r)continue;i[a]-=1,i[a+1]>=0&&i[a]===h&&(i[a+1]+=n,e&&s&&3===s.nodeType&&c&&3===c.nodeType&&(o[d]+=g))}}}if(3===d.nodeType){if(g=d.textContent.length,d.textContent+=u.textContent,l){let e=null;for(let i=0;ih){if(a>0&&e[a-1]!==r)continue;e[a]-=1,e[a+1]>=0&&e[a]===h&&(e[a+1]+=n,o[i]+=g)}}}else d.innerHTML+=u.innerHTML;i.removeItem(u),h--}else 1===d.nodeType&&e(d,a+1,h)}}(e,0,0),o},mergeNestedTags:function(e,t){"string"==typeof t?t=function(e){return this.test(e.tagName)}.bind(new this._w.RegExp("^("+(t||".+")+")$","i")):"function"!=typeof t&&(t=function(){return!0}),function e(n){let i=n.children;if(1===i.length&&i[0].nodeName===n.nodeName&&t(n)){const e=i[0];for(i=e.children;i[0];)n.appendChild(i[0]);n.removeChild(e)}for(let t=0,i=n.children.length;t")},htmlRemoveWhiteSpace:function(e){return e?e.trim().replace(/<\/?(?!strong|span|font|b|var|i|em|u|ins|s|strike|del|sub|sup|mark|a|label|code)[^>^<]+>\s+(?=<)/gi,(function(e){return e.trim()})):""},sortByDepth:function(e,t){const n=t?1:-1,i=-1*n;e.sort(function(e,t){return this.isListCell(e)&&this.isListCell(t)?(e=this.getElementDepth(e))>(t=this.getElementDepth(t))?n:e":e.innerHTML,e.innerHTML=t.outerHTML},_setDefaultOptionStyle:function(e,t){let n="";e.height&&(n+="height:"+e.height+";"),e.minHeight&&(n+="min-height:"+e.minHeight+";"),e.maxHeight&&(n+="max-height:"+e.maxHeight+";"),e.position&&(n+="position:"+e.position+";"),e.width&&(n+="width:"+e.width+";"),e.minWidth&&(n+="min-width:"+e.minWidth+";"),e.maxWidth&&(n+="max-width:"+e.maxWidth+";");let i="",l="",o="";const s=(t=n+t).split(";");for(let t,n=0,a=s.length;n'+this._setIframeCssTags(t),e.contentDocument.body.className="sun-editor-editable",e.contentDocument.body.setAttribute("contenteditable",!0)},_setIframeCssTags:function(e){const t=e.iframeCSSFileName,n=this._w.RegExp;let i="";for(let e,l=0,o=t.length;l'}return i+("auto"===e.height?"":"")}};var L=T,k={init:function(e,t){"object"!=typeof t&&(t={});const n=document;this._initOptions(e,t);const i=n.createElement("DIV");i.className="sun-editor",e.id&&(i.id="suneditor_"+e.id);const l=n.createElement("DIV");l.className="se-container";const o=this._createToolBar(n,t.buttonList,t.plugins,t);o.element.style.visibility="hidden",o.pluginCallButtons.math&&this._checkKatexMath(t.katex);const s=n.createElement("DIV");s.className="se-arrow";const a=n.createElement("DIV");a.className="se-toolbar-sticky-dummy";const r=n.createElement("DIV");r.className="se-wrapper";const c=this._initElements(t,i,o.element,s),d=c.bottomBar,u=c.wysiwygFrame,h=c.placeholder;let g=c.codeView;const p=d.resizingBar,m=d.navigation,f=d.charWrapper,_=d.charCounter,b=n.createElement("DIV");b.className="se-loading-box sun-editor-common",b.innerHTML='
    ';const v=n.createElement("DIV");v.className="se-line-breaker",v.innerHTML='";const y=n.createElement("DIV");y.className+="se-line-breaker-component";const C=y.cloneNode(!0);y.innerHTML=C.innerHTML=t.icons.line_break;const w=n.createElement("DIV");w.className="se-resizing-back";const x=t.toolbarContainer;return x&&x.appendChild(o.element),r.appendChild(g),h&&r.appendChild(h),x||l.appendChild(o.element),l.appendChild(a),l.appendChild(r),l.appendChild(w),l.appendChild(b),l.appendChild(v),l.appendChild(y),l.appendChild(C),p&&l.appendChild(p),i.appendChild(l),g=this._checkCodeMirror(t,g),{constructed:{_top:i,_relative:l,_toolBar:o.element,_menuTray:o._menuTray,_editorArea:r,_wysiwygArea:u,_codeArea:g,_placeholder:h,_resizingBar:p,_navigation:m,_charWrapper:f,_charCounter:_,_loading:b,_lineBreaker:v,_lineBreaker_t:y,_lineBreaker_b:C,_resizeBack:w,_stickyDummy:a,_arrow:s},options:t,plugins:o.plugins,pluginCallButtons:o.pluginCallButtons,_responsiveButtons:o.responsiveButtons}},_checkCodeMirror:function(e,t){if(e.codeMirror){const n=[{mode:"htmlmixed",htmlMode:!0,lineNumbers:!0,lineWrapping:!0},e.codeMirror.options||{}].reduce((function(e,t){for(let n in t)L.hasOwn(t,n)&&(e[n]=t[n]);return e}),{});"auto"===e.height&&(n.viewportMargin=1/0,n.height="auto");const i=e.codeMirror.src.fromTextArea(t,n);i.display.wrapper.style.cssText=t.style.cssText,e.codeMirrorEditor=i,(t=i.display.wrapper).className+=" se-wrapper-code-mirror"}return t},_checkKatexMath:function(e){if(!e)throw Error('[SUNEDITOR.create.fail] To use the math button you need to add a "katex" object to the options.');const t=[{throwOnError:!1},e.options||{}].reduce((function(e,t){for(let n in t)L.hasOwn(t,n)&&(e[n]=t[n]);return e}),{});e.options=t},_setOptions:function(e,t,n,i){this._initOptions(t.element.originElement,e);const l=t.element,o=l.relative,s=l.editorArea,a=e.toolbarContainer&&e.toolbarContainer!==i.toolbarContainer,r=!!e.buttonList||e.mode!==i.mode||a,c=!!e.plugins,d=this._createToolBar(document,r?e.buttonList:i.buttonList,c?e.plugins:n,e);d.pluginCallButtons.math&&this._checkKatexMath(e.katex);const u=document.createElement("DIV");u.className="se-arrow",r&&(d.element.style.visibility="hidden",a?(e.toolbarContainer.appendChild(d.element),l.toolbar.parentElement.removeChild(l.toolbar)):l.toolbar.parentElement.replaceChild(d.element,l.toolbar),l.toolbar=d.element,l._menuTray=d._menuTray,l._arrow=u);const h=this._initElements(e,l.topArea,r?d.element:l.toolbar,u),g=h.bottomBar,p=h.wysiwygFrame,m=h.placeholder;let f=h.codeView;return l.resizingBar&&o.removeChild(l.resizingBar),g.resizingBar&&o.appendChild(g.resizingBar),s.innerHTML="",s.appendChild(f),m&&s.appendChild(m),f=this._checkCodeMirror(e,f),l.resizingBar=g.resizingBar,l.navigation=g.navigation,l.charWrapper=g.charWrapper,l.charCounter=g.charCounter,l.wysiwygFrame=p,l.code=f,l.placeholder=m,{callButtons:r?d.pluginCallButtons:null,plugins:r||c?d.plugins:null,toolbar:d}},_initElements:function(e,t,n,i){t.style.cssText=e._editorStyles.top,/inline/i.test(e.mode)?(n.className+=" se-toolbar-inline",n.style.width=e.toolbarWidth):/balloon/i.test(e.mode)&&(n.className+=" se-toolbar-balloon",n.style.width=e.toolbarWidth,n.appendChild(i));const l=document.createElement(e.iframe?"IFRAME":"DIV");l.className="se-wrapper-inner se-wrapper-wysiwyg",e.iframe?(l.allowFullscreen=!0,l.frameBorder=0,l.style.cssText=e._editorStyles.frame):(l.setAttribute("contenteditable",!0),l.setAttribute("scrolling","auto"),l.className+=" sun-editor-editable",l.style.cssText=e._editorStyles.frame+e._editorStyles.editor);const o=document.createElement("TEXTAREA");o.className="se-wrapper-inner se-wrapper-code",o.style.cssText=e._editorStyles.frame,o.style.display="none","auto"===e.height&&(o.style.overflow="hidden");let s=null,a=null,r=null,c=null;if(e.resizingBar&&(s=document.createElement("DIV"),s.className="se-resizing-bar sun-editor-common",a=document.createElement("DIV"),a.className="se-navigation sun-editor-common",s.appendChild(a),e.charCounter)){if(r=document.createElement("DIV"),r.className="se-char-counter-wrapper",e.charCounterLabel){const t=document.createElement("SPAN");t.className="se-char-label",t.textContent=e.charCounterLabel,r.appendChild(t)}if(c=document.createElement("SPAN"),c.className="se-char-counter",c.textContent="0",r.appendChild(c),e.maxCharCount>0){const t=document.createElement("SPAN");t.textContent=" / "+e.maxCharCount,r.appendChild(t)}s.appendChild(r)}let d=null;return e.placeholder&&(d=document.createElement("SPAN"),d.className="se-placeholder",d.innerText=e.placeholder),{bottomBar:{resizingBar:s,navigation:a,charWrapper:r,charCounter:c},wysiwygFrame:l,codeView:o,placeholder:d}},_initOptions:function(e,t){t.lang=t.lang||N.a,t.value="string"==typeof t.value?t.value:null,t.historyStackDelayTime="number"==typeof t.historyStackDelayTime?t.historyStackDelayTime:400,t._defaultTagsWhitelist="string"==typeof t._defaultTagsWhitelist?t._defaultTagsWhitelist:"br|p|div|pre|blockquote|h[1-6]|ol|ul|li|hr|figure|figcaption|img|iframe|audio|video|source|table|thead|tbody|tr|th|td|a|b|strong|var|i|em|u|ins|s|span|strike|del|sub|sup|code",t._editorTagsWhitelist=t._defaultTagsWhitelist+("string"==typeof t.addTagsWhitelist&&t.addTagsWhitelist.length>0?"|"+t.addTagsWhitelist:""),t.pasteTagsWhitelist="string"==typeof t.pasteTagsWhitelist?t.pasteTagsWhitelist:t._editorTagsWhitelist,t.attributesWhitelist=t.attributesWhitelist&&"object"==typeof t.attributesWhitelist?t.attributesWhitelist:null,t.mode=t.mode||"classic",t.toolbarWidth=t.toolbarWidth?L.isNumber(t.toolbarWidth)?t.toolbarWidth+"px":t.toolbarWidth:"auto",t.toolbarContainer=/balloon/i.test(t.mode)?null:"string"==typeof t.toolbarContainer?document.querySelector(t.toolbarContainer):t.toolbarContainer,t.stickyToolbar=/balloon/i.test(t.mode)||t.toolbarContainer?-1:void 0===t.stickyToolbar?0:/^\d+/.test(t.stickyToolbar)?L.getNumber(t.stickyToolbar,0):-1,t.fullPage=!!t.fullPage,t.iframe=t.fullPage||t.iframe,t.iframeCSSFileName=t.iframe?"string"==typeof t.iframeCSSFileName?[t.iframeCSSFileName]:t.iframeCSSFileName||["suneditor"]:null,t.codeMirror=t.codeMirror?t.codeMirror.src?t.codeMirror:{src:t.codeMirror}:null,t.position="string"==typeof t.position?t.position:null,t.display=t.display||("none"!==e.style.display&&e.style.display?e.style.display:"block"),t.popupDisplay=t.popupDisplay||"full",t.resizingBar=void 0===t.resizingBar?!/inline|balloon/i.test(t.mode):t.resizingBar,t.showPathLabel=!!t.resizingBar&&("boolean"!=typeof t.showPathLabel||t.showPathLabel),t.charCounter=t.maxCharCount>0||"boolean"==typeof t.charCounter&&t.charCounter,t.charCounterType="string"==typeof t.charCounterType?t.charCounterType:"char",t.charCounterLabel="string"==typeof t.charCounterLabel?t.charCounterLabel.trim():null,t.maxCharCount=L.isNumber(t.maxCharCount)&&t.maxCharCount>-1?1*t.maxCharCount:null,t.width=t.width?L.isNumber(t.width)?t.width+"px":t.width:e.clientWidth?e.clientWidth+"px":"100%",t.minWidth=(L.isNumber(t.minWidth)?t.minWidth+"px":t.minWidth)||"",t.maxWidth=(L.isNumber(t.maxWidth)?t.maxWidth+"px":t.maxWidth)||"",t.height=t.height?L.isNumber(t.height)?t.height+"px":t.height:e.clientHeight?e.clientHeight+"px":"auto",t.minHeight=(L.isNumber(t.minHeight)?t.minHeight+"px":t.minHeight)||"",t.maxHeight=(L.isNumber(t.maxHeight)?t.maxHeight+"px":t.maxHeight)||"",t.defaultStyle="string"==typeof t.defaultStyle?t.defaultStyle:"",t.font=t.font?t.font:null,t.fontSize=t.fontSize?t.fontSize:null,t.formats=t.formats?t.formats:null,t.colorList=t.colorList?t.colorList:null,t.lineHeights=t.lineHeights?t.lineHeights:null,t.paragraphStyles=t.paragraphStyles?t.paragraphStyles:null,t.textStyles=t.textStyles?t.textStyles:null,t.fontSizeUnit="string"==typeof t.fontSizeUnit&&t.fontSizeUnit.trim()||"px",t.imageResizing=void 0===t.imageResizing||t.imageResizing,t.imageHeightShow=void 0===t.imageHeightShow||!!t.imageHeightShow,t.imageWidth=t.imageWidth?L.isNumber(t.imageWidth)?t.imageWidth+"px":t.imageWidth:"auto",t.imageHeight=t.imageHeight?L.isNumber(t.imageHeight)?t.imageHeight+"px":t.imageHeight:"auto",t.imageSizeOnlyPercentage=!!t.imageSizeOnlyPercentage,t._imageSizeUnit=t.imageSizeOnlyPercentage?"%":"px",t.imageRotation=void 0!==t.imageRotation?t.imageRotation:!(t.imageSizeOnlyPercentage||!t.imageHeightShow),t.imageFileInput=void 0===t.imageFileInput||t.imageFileInput,t.imageUrlInput=void 0===t.imageUrlInput||!t.imageFileInput||t.imageUrlInput,t.imageUploadHeader=t.imageUploadHeader||null,t.imageUploadUrl="string"==typeof t.imageUploadUrl?t.imageUploadUrl:null,t.imageUploadSizeLimit=/\d+/.test(t.imageUploadSizeLimit)?L.getNumber(t.imageUploadSizeLimit,0):null,t.imageMultipleFile=!!t.imageMultipleFile,t.imageAccept="string"!=typeof t.imageAccept||"*"===t.imageAccept.trim()?"image/*":t.imageAccept.trim()||"image/*",t.imageGalleryUrl="string"==typeof t.imageGalleryUrl?t.imageGalleryUrl:null,t.videoResizing=void 0===t.videoResizing||t.videoResizing,t.videoHeightShow=void 0===t.videoHeightShow||!!t.videoHeightShow,t.videoRatioShow=void 0===t.videoRatioShow||!!t.videoRatioShow,t.videoWidth=t.videoWidth&&L.getNumber(t.videoWidth,0)?L.isNumber(t.videoWidth)?t.videoWidth+"px":t.videoWidth:"",t.videoHeight=t.videoHeight&&L.getNumber(t.videoHeight,0)?L.isNumber(t.videoHeight)?t.videoHeight+"px":t.videoHeight:"",t.videoSizeOnlyPercentage=!!t.videoSizeOnlyPercentage,t._videoSizeUnit=t.videoSizeOnlyPercentage?"%":"px",t.videoRotation=void 0!==t.videoRotation?t.videoRotation:!(t.videoSizeOnlyPercentage||!t.videoHeightShow),t.videoRatio=L.getNumber(t.videoRatio,4)||.5625,t.videoRatioList=t.videoRatioList?t.videoRatioList:null,t.youtubeQuery=(t.youtubeQuery||"").replace("?",""),t.videoFileInput=!!t.videoFileInput,t.videoUrlInput=void 0===t.videoUrlInput||!t.videoFileInput||t.videoUrlInput,t.videoUploadHeader=t.videoUploadHeader||null,t.videoUploadUrl="string"==typeof t.videoUploadUrl?t.videoUploadUrl:null,t.videoUploadSizeLimit=/\d+/.test(t.videoUploadSizeLimit)?L.getNumber(t.videoUploadSizeLimit,0):null,t.videoMultipleFile=!!t.videoMultipleFile,t.videoTagAttrs=t.videoTagAttrs||null,t.videoIframeAttrs=t.videoIframeAttrs||null,t.videoAccept="string"!=typeof t.videoAccept||"*"===t.videoAccept.trim()?"video/*":t.videoAccept.trim()||"video/*",t.audioWidth=t.audioWidth?L.isNumber(t.audioWidth)?t.audioWidth+"px":t.audioWidth:"",t.audioHeight=t.audioHeight?L.isNumber(t.audioHeight)?t.audioHeight+"px":t.audioHeight:"",t.audioFileInput=!!t.audioFileInput,t.audioUrlInput=void 0===t.audioUrlInput||!t.audioFileInput||t.audioUrlInput,t.audioUploadHeader=t.audioUploadHeader||null,t.audioUploadUrl="string"==typeof t.audioUploadUrl?t.audioUploadUrl:null,t.audioUploadSizeLimit=/\d+/.test(t.audioUploadSizeLimit)?L.getNumber(t.audioUploadSizeLimit,0):null,t.audioMultipleFile=!!t.audioMultipleFile,t.audioTagAttrs=t.audioTagAttrs||null,t.audioAccept="string"!=typeof t.audioAccept||"*"===t.audioAccept.trim()?"audio/*":t.audioAccept.trim()||"audio/*",t.tableCellControllerPosition="string"==typeof t.tableCellControllerPosition?t.tableCellControllerPosition.toLowerCase():"cell",t.tabDisable=!!t.tabDisable,t.shortcutsDisable=Array.isArray(t.shortcutsDisable)&&t.shortcutsDisable.length>0?t.shortcutsDisable.map((function(e){return e.toLowerCase()})):[],t.shortcutsHint=void 0===t.shortcutsHint||!!t.shortcutsHint,t.callBackSave=t.callBackSave?t.callBackSave:null,t.templates=t.templates?t.templates:null,t.placeholder="string"==typeof t.placeholder?t.placeholder:null,t.linkProtocol="string"==typeof t.linkProtocol?t.linkProtocol:null,t.katex=t.katex?t.katex.src?t.katex:{src:t.katex}:null,t.buttonList=t.buttonList||[["undo","redo"],["bold","underline","italic","strike","subscript","superscript"],["removeFormat"],["outdent","indent"],["fullScreen","showBlocks","codeView"],["preview","print"]],t.icons=t.icons&&"object"==typeof t.icons?[E,t.icons].reduce((function(e,t){for(let n in t)L.hasOwn(t,n)&&(e[n]=t[n]);return e}),{}):E,t._editorStyles=L._setDefaultOptionStyle(t,t.defaultStyle)},_defaultButtons:function(e){const t=e.icons,n=e.lang,i=L.isOSX_IOS?"⌘":"CTRL",l=e.shortcutsHint?e.shortcutsDisable:["bold","strike","underline","italic","undo","indent"];return{bold:["_se_command_bold",n.toolbar.bold+(l.indexOf("bold")>-1?"":" ("+i+"+B)"),"STRONG","",t.bold],underline:["_se_command_underline",n.toolbar.underline+(l.indexOf("underline")>-1?"":" ("+i+"+U)"),"U","",t.underline],italic:["_se_command_italic",n.toolbar.italic+(l.indexOf("italic")>-1?"":" ("+i+"+I)"),"EM","",t.italic],strike:["_se_command_strike",n.toolbar.strike+(l.indexOf("strike")>-1?"":" ("+i+"+SHIFT+S)"),"DEL","",t.strike],subscript:["_se_command_subscript",n.toolbar.subscript,"SUB","",t.subscript],superscript:["_se_command_superscript",n.toolbar.superscript,"SUP","",t.superscript],removeFormat:["",n.toolbar.removeFormat,"removeFormat","",t.erase],indent:["_se_command_indent",n.toolbar.indent+(l.indexOf("indent")>-1?"":" ("+i+"+])"),"indent","",t.outdent],outdent:["_se_command_outdent",n.toolbar.outdent+(l.indexOf("indent")>-1?"":" ("+i+"+[)"),"outdent","",t.indent],fullScreen:["se-code-view-enabled se-resizing-enabled _se_command_fullScreen",n.toolbar.fullScreen,"fullScreen","",t.expansion],showBlocks:["_se_command_showBlocks",n.toolbar.showBlocks,"showBlocks","",t.show_blocks],codeView:["se-code-view-enabled se-resizing-enabled _se_command_codeView",n.toolbar.codeView,"codeView","",t.code_view],undo:["_se_command_undo se-resizing-enabled",n.toolbar.undo+(l.indexOf("undo")>-1?"":" ("+i+"+Z)"),"undo","",t.undo],redo:["_se_command_redo se-resizing-enabled",n.toolbar.redo+(l.indexOf("undo")>-1?"":" ("+i+"+Y / "+i+"+SHIFT+Z)"),"redo","",t.redo],preview:["se-resizing-enabled",n.toolbar.preview,"preview","",t.preview],print:["se-resizing-enabled",n.toolbar.print,"print","",t.print],save:["_se_command_save se-resizing-enabled",n.toolbar.save,"save","",t.save],blockquote:["",n.toolbar.tag_blockquote,"blockquote","command",t.blockquote],font:["se-btn-select se-btn-tool-font",n.toolbar.font,"font","submenu",''+n.toolbar.font+""+t.arrow_down],formatBlock:["se-btn-select se-btn-tool-format",n.toolbar.formats,"formatBlock","submenu",''+n.toolbar.formats+""+t.arrow_down],fontSize:["se-btn-select se-btn-tool-size",n.toolbar.fontSize,"fontSize","submenu",''+n.toolbar.fontSize+""+t.arrow_down],fontColor:["",n.toolbar.fontColor,"fontColor","submenu",t.font_color],hiliteColor:["",n.toolbar.hiliteColor,"hiliteColor","submenu",t.highlight_color],align:["se-btn-align",n.toolbar.align,"align","submenu",t.align_left],list:["",n.toolbar.list,"list","submenu",t.list_number],horizontalRule:["btn_line",n.toolbar.horizontalRule,"horizontalRule","submenu",t.horizontal_rule],table:["",n.toolbar.table,"table","submenu",t.table],lineHeight:["",n.toolbar.lineHeight,"lineHeight","submenu",t.line_height],template:["",n.toolbar.template,"template","submenu",t.template],paragraphStyle:["",n.toolbar.paragraphStyle,"paragraphStyle","submenu",t.paragraph_style],textStyle:["",n.toolbar.textStyle,"textStyle","submenu",t.text_style],link:["",n.toolbar.link,"link","dialog",t.link],image:["",n.toolbar.image,"image","dialog",t.image],video:["",n.toolbar.video,"video","dialog",t.video],audio:["",n.toolbar.audio,"audio","dialog",t.audio],math:["",n.toolbar.math,"math","dialog",t.math],imageGallery:["",n.toolbar.imageGallery,"imageGallery","fileBrowser",t.image_gallery]}},_createModuleGroup:function(){const e=L.createElement("DIV");e.className="se-btn-module se-btn-module-border";const t=L.createElement("UL");return t.className="se-menu-list",e.appendChild(t),{div:e,ul:t}},_createButton:function(e,t,n,i,l,o,s){const a=L.createElement("LI"),r=L.createElement("BUTTON");return r.setAttribute("type","button"),r.setAttribute("class","se-btn"+(e?" "+e:"")+" se-tooltip"),r.setAttribute("data-command",n),r.setAttribute("data-display",i),r.setAttribute("tabindex","-1"),l||(l='!'),/^default\./i.test(l)&&(l=s[l.replace(/^default\./i,"")]),/^text\./i.test(l)&&(l=l.replace(/^text\./i,""),r.className+=" se-btn-more-text"),l+=''+(t||n)+"",o&&r.setAttribute("disabled",!0),r.innerHTML=l,a.appendChild(r),{li:a,button:r}},_createToolBar:function(e,t,n,i){const l=e.createElement("DIV");l.className="se-toolbar-separator-vertical";const o=e.createElement("DIV");o.className="se-toolbar sun-editor-common";const s=e.createElement("DIV");s.className="se-btn-tray",o.appendChild(s);const a=i.icons,r=this._defaultButtons(i),c={},d=[],u={};if(n){const e=n.length?n:Object.keys(n).map((function(e){return n[e]}));for(let t,n=0,i=e.length;n",b.appendChild(i),i=i.firstElementChild.firstElementChild)}if(_){const e=l.cloneNode(!1);y&&(e.style.float=y),s.appendChild(e)}s.appendChild(p.div),_=!0}else if(/^\/$/.test(v)){const t=e.createElement("DIV");t.className="se-btn-module-enter",s.appendChild(t),_=!1}1===s.children.length&&L.removeClass(s.firstElementChild,"se-btn-module-border"),d.length>0&&d.unshift(t),b.children.length>0&&s.appendChild(b);const v=e.createElement("DIV");v.className="se-menu-tray",o.appendChild(v);const y=e.createElement("DIV");return y.className="se-toolbar-cover",o.appendChild(y),{element:o,plugins:u,pluginCallButtons:c,responsiveButtons:d,_menuTray:v,_buttonTray:s}}};var A=function(e,t,n){return{element:{originElement:e,topArea:t._top,relative:t._relative,toolbar:t._toolBar,_buttonTray:t._toolBar.querySelector(".se-btn-tray"),_menuTray:t._menuTray,resizingBar:t._resizingBar,navigation:t._navigation,charWrapper:t._charWrapper,charCounter:t._charCounter,editorArea:t._editorArea,wysiwygFrame:t._wysiwygArea,wysiwyg:t._wysiwygArea,code:t._codeArea,placeholder:t._placeholder,loading:t._loading,lineBreaker:t._lineBreaker,lineBreaker_t:t._lineBreaker_t,lineBreaker_b:t._lineBreaker_b,resizeBackground:t._resizeBack,_stickyDummy:t._stickyDummy,_arrow:t._arrow},tool:{cover:t._toolBar.querySelector(".se-toolbar-cover"),bold:t._toolBar.querySelector("._se_command_bold"),underline:t._toolBar.querySelector("._se_command_underline"),italic:t._toolBar.querySelector("._se_command_italic"),strike:t._toolBar.querySelector("._se_command_strike"),subscript:t._toolBar.querySelector("._se_command_subscript"),superscript:t._toolBar.querySelector("._se_command_superscript"),undo:t._toolBar.querySelector("._se_command_undo"),redo:t._toolBar.querySelector("._se_command_redo"),save:t._toolBar.querySelector("._se_command_save"),outdent:t._toolBar.querySelector("._se_command_outdent"),indent:t._toolBar.querySelector("._se_command_indent"),fullScreen:t._toolBar.querySelector("._se_command_fullScreen"),showBlocks:t._toolBar.querySelector("._se_command_showBlocks"),codeView:t._toolBar.querySelector("._se_command_codeView")},options:n,option:n}},B={name:"notice",add:function(e){const t=e.context;t.notice={};let n=e.util.createElement("DIV"),i=e.util.createElement("SPAN"),l=e.util.createElement("BUTTON");n.className="se-notice",l.className="close",l.setAttribute("aria-label","Close"),l.setAttribute("title",e.lang.dialogBox.close),l.innerHTML=e.icons.cancel,n.appendChild(i),n.appendChild(l),t.notice.modal=n,t.notice.message=i,l.addEventListener("click",this.onClick_cancel.bind(e)),t.element.editorArea.appendChild(n),n=null},onClick_cancel:function(e){e.preventDefault(),e.stopPropagation(),this.plugins.notice.close.call(this)},open:function(e){this.context.notice.message.textContent=e,this.context.notice.modal.style.display="block"},close:function(){this.context.notice.modal.style.display="none"}},z={init:function(e){return{create:function(t,n){return this.create(t,n,e)}.bind(this)}},create:function(e,t,n){L._propertiesInit(),"object"!=typeof t&&(t={}),n&&(t=[n,t].reduce((function(e,t){for(let n in t)if(L.hasOwn(t,n))if("plugins"===n&&t[n]&&e[n]){let i=e[n],l=t[n];i=i.length?i:Object.keys(i).map((function(e){return i[e]})),l=l.length?l:Object.keys(l).map((function(e){return l[e]})),e[n]=l.filter((function(e){return-1===i.indexOf(e)})).concat(i)}else e[n]=t[n];return e}),{}));const i="string"==typeof e?document.getElementById(e):e;if(!i){if("string"==typeof e)throw Error('[SUNEDITOR.create.fail] The element for that id was not found (ID:"'+e+'")');throw Error("[SUNEDITOR.create.fail] suneditor requires textarea's element or id value")}const l=k.init(i,t);if(l.constructed._top.id&&document.getElementById(l.constructed._top.id))throw Error('[SUNEDITOR.create.fail] The ID of the suneditor you are trying to create already exists (ID:"'+l.constructed._top.id+'")');return function(e,t,n,i,l,o){const s=e.element.originElement.ownerDocument||document,a=s.defaultView||window,r=L,c=l.icons,d={_d:s,_w:a,_parser:new a.DOMParser,_wd:null,_ww:null,_shadowRoot:null,util:r,functions:null,notice:B,icons:c,history:null,context:e,pluginCallButtons:t,plugins:n||{},initPlugins:{},_targetPlugins:{},_menuTray:{},lang:i,effectNode:null,submenu:null,container:null,_submenuName:"",_bindedSubmenuOff:null,_bindedContainerOff:null,submenuActiveButton:null,containerActiveButton:null,controllerArray:[],currentControllerName:"",currentControllerTarget:null,currentFileComponentInfo:null,codeViewDisabledButtons:null,resizingDisabledButtons:null,_moreLayerActiveButton:null,_htmlCheckWhitelistRegExp:null,_disallowedTextTagsRegExp:null,editorTagsWhitelistRegExp:null,pasteTagsWhitelistRegExp:null,hasFocus:!1,isDisabled:!1,_attributesWhitelistRegExp:null,_attributesTagsWhitelist:null,_bindControllersOff:null,_isInline:null,_isBalloon:null,_isBalloonAlways:null,_inlineToolbarAttr:{top:"",width:"",isShow:!1},_notHideToolbar:!1,_sticky:!1,_antiBlur:!1,_lineBreaker:null,_lineBreakerButton:null,_componentsInfoInit:!0,_componentsInfoReset:!1,activePlugins:null,managedTagsInfo:null,_charTypeHTML:!1,_fileInfoPluginsCheck:null,_fileInfoPluginsReset:null,_fileManager:{tags:null,regExp:null,queryString:null,pluginRegExp:null,pluginMap:null},commandMap:null,_styleCommandMap:null,_defaultCommand:{bold:"STRONG",underline:"U",italic:"EM",strike:"DEL",subscript:"SUB",superscript:"SUP"},_variable:{isCodeView:!1,isFullScreen:!1,innerHeight_fullScreen:0,resizeClientY:0,tabSize:4,codeIndent:4,minResizingSize:r.getNumber(e.element.wysiwygFrame.style.minHeight||"65",0),currentNodes:[],currentNodesMap:[],_range:null,_selectionNode:null,_originCssText:e.element.topArea.style.cssText,_bodyOverflow:"",_editorAreaOriginCssText:"",_wysiwygOriginCssText:"",_codeOriginCssText:"",_fullScreenAttrs:{sticky:!1,balloon:!1,inline:!1},_lineBreakComp:null,_lineBreakDir:""},callPlugin:function(e,n,i){if(i=i||t[e],!this.plugins[e])throw Error('[SUNEDITOR.core.callPlugin.fail] The called plugin does not exist or is in an invalid format. (pluginName:"'+e+'")');this.initPlugins[e]?"object"==typeof this._targetPlugins[e]&&i&&this.initMenuTarget(e,i,this._targetPlugins[e]):(this.plugins[e].add(this,i),this.initPlugins[e]=!0),this.plugins[e].active&&!this.commandMap[e]&&i&&(this.commandMap[e]=i,this.activePlugins.push(e)),"function"==typeof n&&n()},addModule:function(e){for(let t,n=0,i=e.length;nb?(n.style.height=l+"px",e=-1*(l-g+3)):(n.style.height=b+"px",e=g+t.parentElement.offsetHeight),n.style.top=e+"px"}else n.style.top=g+t.parentElement.offsetHeight+"px";n.style.visibility=""},controllersOn:function(){this._bindControllersOff&&this._bindControllersOff(),this.controllerArray=[];for(let e,t=0;t0){for(let e=0;e":n),this.history.push(!0)},nativeFocus:function(){const t=r.getParentElement(this.getSelectionNode(),"figcaption");t?t.focus():e.element.wysiwyg.focus(),this._editorRange()},focus:function(){if("none"!==e.element.wysiwygFrame.style.display){if(l.iframe)this.nativeFocus();else try{const t=this.getRange();if(t.startContainer===t.endContainer&&r.isWysiwygDiv(t.startContainer)){const t=r.createElement("P"),n=r.createElement("BR");t.appendChild(n),e.element.wysiwyg.appendChild(t),this.setRange(n,0,n,0)}else this.setRange(t.startContainer,t.startOffset,t.endContainer,t.endOffset)}catch(e){this.nativeFocus()}u._applyTagEffects(),this._isBalloon&&u._toggleToolbarBalloon()}},focusEdge:function(t){t||(t=e.element.wysiwyg.lastElementChild);const n=this.getFileComponent(t);n?this.selectComponent(n.target,n.pluginName):t?(t=r.getChildElement(t,(function(e){return 0===e.childNodes.length||3===e.nodeType}),!0))?this.setRange(t,t.textContent.length,t,t.textContent.length):this.nativeFocus():this.focus()},setRange:function(e,t,n,i){if(!e||!n)return;t>e.textContent.length&&(t=e.textContent.length),i>n.textContent.length&&(i=n.textContent.length);const o=this._wd.createRange();try{o.setStart(e,t),o.setEnd(n,i)}catch(e){return console.warn("[SUNEDITOR.core.focus.error] "+e),void this.nativeFocus()}const s=this.getSelection();return s.removeAllRanges&&s.removeAllRanges(),s.addRange(o),this._editorRange(),l.iframe&&this.nativeFocus(),o},removeRange:function(){this._variable._range=null,this._variable._selectionNode=null,this.getSelection().removeAllRanges();const e=this.commandMap,t=this.activePlugins;for(let i in e)r.hasOwn(e,i)&&(t.indexOf(i)>-1?n[i].active.call(this,null):e.OUTDENT&&/^OUTDENT$/i.test(i)?e.OUTDENT.setAttribute("disabled",!0):e.INDENT&&/^INDENT$/i.test(i)?e.INDENT.removeAttribute("disabled"):r.removeClass(e[i],"active"))},getRange:function(){const t=this._variable._range||this._createDefaultRange(),n=this.getSelection();if(t.collapsed===n.isCollapsed||!e.element.wysiwyg.contains(n.focusNode))return t;if(n.rangeCount>0)return this._variable._range=n.getRangeAt(0),this._variable._range;{const e=n.anchorNode,t=n.focusNode,i=n.anchorOffset,l=n.focusOffset,o=r.compareElements(e,t),s=o.ancestor&&(0===o.result?i<=l:o.result>1);return this.setRange(s?e:t,s?i:l,s?t:e,s?l:i)}},getRange_addLine:function(t){if(this._selectionVoid(t)){const n=e.element.wysiwyg,i=r.createElement("P");i.innerHTML="
    ",n.insertBefore(i,n.firstElementChild),this.setRange(i.firstElementChild,0,i.firstElementChild,1),t=this._variable._range}return t},getSelection:function(){return this._shadowRoot&&this._shadowRoot.getSelection?this._shadowRoot.getSelection():this._ww.getSelection()},getSelectionNode:function(){if(r.isWysiwygDiv(this._variable._selectionNode)&&this._editorRange(),!this._variable._selectionNode){const t=r.getChildElement(e.element.wysiwyg.firstChild,(function(e){return 0===e.childNodes.length||3===e.nodeType}),!1);if(t)return this._variable._selectionNode=t,t;this._editorRange()}return this._variable._selectionNode},_editorRange:function(){const e=this.getSelection();if(!e)return null;let t=null,n=null;t=e.rangeCount>0?e.getRangeAt(0):this._createDefaultRange(),this._variable._range=t,n=t.collapsed?t.commonAncestorContainer:e.extentNode||e.anchorNode,this._variable._selectionNode=n},_createDefaultRange:function(){const t=e.element.wysiwyg;t.focus();const n=this._wd.createRange();let i=t.firstElementChild;return i||(i=r.createElement("P"),i.innerHTML="
    ",t.appendChild(i)),n.setStart(i,0),n.setEnd(i,0),n},_selectionVoid:function(e){const t=e.commonAncestorContainer;return r.isWysiwygDiv(e.startContainer)&&r.isWysiwygDiv(e.endContainer)||/FIGURE/i.test(t.nodeName)||this._fileManager.regExp.test(t.nodeName)||r.isMediaComponent(t)},_resetRangeToTextNode:function(){const t=this.getRange();if(this._selectionVoid(t))return!1;let n,i,l,o=t.startContainer,s=t.startOffset,a=t.endContainer,c=t.endOffset;if(r.isFormatElement(o)&&(o=o.childNodes[s]||o.lastChild,s=o.textContent.length),r.isFormatElement(a)&&(a=a.childNodes[c]||a.lastChild,c=a.textContent.length),n=r.isWysiwygDiv(o)?e.element.wysiwyg.firstChild:o,i=s,r.isBreak(n)||1===n.nodeType&&n.childNodes.length>0){const e=r.isBreak(n);if(!e){for(;n&&!r.isBreak(n)&&1===n.nodeType;)n=n.childNodes[i]||n.nextElementSibling||n.nextSibling,i=0;let e=r.getFormatElement(n,null);e===r.getRangeFormatElement(e,null)&&(e=r.createElement(r.getParentElement(n,r.isCell)?"DIV":"P"),n.parentNode.insertBefore(e,n),e.appendChild(n))}if(r.isBreak(n)){const t=r.createTextNode(r.zeroWidthSpace);n.parentNode.insertBefore(t,n),n=t,e&&o===a&&(a=n,c=1)}}if(o=n,s=i,n=r.isWysiwygDiv(a)?e.element.wysiwyg.lastChild:a,i=c,r.isBreak(n)||1===n.nodeType&&n.childNodes.length>0){const e=r.isBreak(n);if(!e){for(;n&&!r.isBreak(n)&&1===n.nodeType&&(l=n.childNodes,0!==l.length);)n=l[i>0?i-1:i]||!/FIGURE/i.test(l[0].nodeName)?l[0]:n.previousElementSibling||n.previousSibling||o,i=i>0?n.textContent.length:i;let e=r.getFormatElement(n,null);e===r.getRangeFormatElement(e,null)&&(e=r.createElement(r.isCell(e)?"DIV":"P"),n.parentNode.insertBefore(e,n),e.appendChild(n))}if(r.isBreak(n)){const t=r.createTextNode(r.zeroWidthSpace);n.parentNode.insertBefore(t,n),n=t,i=1,e&&!n.previousSibling&&r.removeItem(a)}}return a=n,c=i,this.setRange(o,s,a,c),!0},getSelectedElements:function(t){if(!this._resetRangeToTextNode())return[];let n=this.getRange();if(r.isWysiwygDiv(n.startContainer)){const t=e.element.wysiwyg.children;if(0===t.length)return[];this.setRange(t[0],0,t[t.length-1],t[t.length-1].textContent.trim().length),n=this.getRange()}const i=n.startContainer,l=n.endContainer,o=n.commonAncestorContainer,s=r.getListChildren(o,(function(e){return t?t(e):r.isFormatElement(e)}));if(r.isWysiwygDiv(o)||r.isRangeFormatElement(o)||s.unshift(r.getFormatElement(o,null)),i===l||1===s.length)return s;let a=r.getFormatElement(i,null),c=r.getFormatElement(l,null),d=null,u=null;const h=function(e){return!r.isTable(e)||/^TABLE$/i.test(e.nodeName)};let g=r.getRangeFormatElement(a,h),p=r.getRangeFormatElement(c,h);r.isTable(g)&&r.isListCell(g.parentNode)&&(g=g.parentNode),r.isTable(p)&&r.isListCell(p.parentNode)&&(p=p.parentNode);const m=g===p;for(let e,t=0,n=s.length;t=0;n--)if(i[n].contains(i[e])){i.splice(e,1),e--,t--;break}return i},isEdgePoint:function(e,t){return 0===t||!e.nodeValue&&1===t||t===e.nodeValue.length},showLoading:function(){e.element.loading.style.display="block"},closeLoading:function(){e.element.loading.style.display="none"},appendFormatTag:function(e,t){const n=r.getFormatElement(this.getSelectionNode(),null),i=t?"string"==typeof t?t:t.nodeName:r.isFormatElement(n)&&!r.isFreeFormatElement(n)?n.nodeName:"P",l=r.createElement(i);return l.innerHTML="
    ",(t&&"string"!=typeof t||!t&&r.isFormatElement(n))&&r.copyTagAttributes(l,t||n),r.isCell(e)?e.insertBefore(l,e.nextElementSibling):e.parentNode.insertBefore(l,e.nextElementSibling),l},insertComponent:function(e,t,n,i){if(n&&!this.checkCharCount(e,null))return null;const l=this.removeNode();this.getRange_addLine(this.getRange());let o=null,s=this.getSelectionNode(),a=r.getFormatElement(s,null);if(r.isListCell(a))this.insertNode(e,s===a?null:l.container.nextSibling,!1),e.nextSibling||e.parentNode.appendChild(r.createElement("BR"));else{if(this.getRange().collapsed&&(3===l.container.nodeType||r.isBreak(l.container))){const e=r.getParentElement(l.container,function(e){return this.isRangeFormatElement(e)}.bind(r));o=r.splitElement(l.container,l.offset,e?r.getElementDepth(e)+1:0),o&&(a=o.previousSibling)}this.insertNode(e,a,!1),a&&r.onlyZeroWidthSpace(a)&&r.removeItem(a)}if(!i){const t=this.getFileComponent(e);t?this.selectComponent(t.target,t.pluginName):o&&(o=r.getEdgeChildNodes(o,null).sc||o,this.setRange(o,0,o,0))}return t||this.history.push(1),o||e},getFileComponent:function(e){if(!this._fileManager.queryString||!e)return null;let t,n;return(/^FIGURE$/i.test(e.nodeName)||/se-component/.test(e.className))&&(t=e.querySelector(this._fileManager.queryString)),!t&&e.nodeName&&this._fileManager.regExp.test(e.nodeName)&&(t=e),t&&(n=this._fileManager.pluginMap[t.nodeName.toLowerCase()],n)?{target:t,component:r.getParentElement(t,r.isComponent),pluginName:n}:null},selectComponent:function(e,t){this.hasFocus||this.focus();const n=this.plugins[t];n&&a.setTimeout(function(){"function"==typeof n.select&&this.callPlugin(t,n.select.bind(this,e),null),this._setComponentLineBreaker(e)}.bind(this))},_setComponentLineBreaker:function(t){this._lineBreaker.style.display="none";const n=r.getParentElement(t,r.isComponent),i=e.element.lineBreaker_t.style,l=e.element.lineBreaker_b.style,o="block"===this.context.resizing.resizeContainer.style.display?this.context.resizing.resizeContainer:t,s=r.isListCell(n.parentNode);let a,c,d;(s?n.previousSibling:r.isFormatElement(n.previousElementSibling))?i.display="none":(this._variable._lineBreakComp=n,c=e.element.wysiwyg.scrollTop,a=r.getOffset(t,e.element.wysiwygFrame).top+c,d=o.offsetWidth/2/2,i.top=a-c-12+"px",i.left=r.getOffset(o).left+d+"px",i.display="block"),(s?n.nextSibling:r.isFormatElement(n.nextElementSibling))?l.display="none":(a||(this._variable._lineBreakComp=n,c=e.element.wysiwyg.scrollTop,a=r.getOffset(t,e.element.wysiwygFrame).top+c,d=o.offsetWidth/2/2),l.top=a+o.offsetHeight-c-12+"px",l.left=r.getOffset(o).left+o.offsetWidth-d-24+"px",l.display="block")},insertNode:function(e,t,n){if(n&&!this.checkCharCount(e,null))return null;const i=r.getFreeFormatElement(this.getSelectionNode(),null),l=!i&&(r.isFormatElement(e)||r.isRangeFormatElement(e))||r.isComponent(e);if(!t&&l){const e=this.removeNode();if(3===e.container.nodeType||r.isBreak(e.container)){const n=r.getParentElement(e.container,function(e){return this.isRangeFormatElement(e)||this.isListCell(e)}.bind(r));(t=r.splitElement(e.container,e.offset,n?r.getElementDepth(n)+1:0))&&(t=t.previousSibling)}}const o=t||l?this.getRange():this.getRange_addLine(this.getRange()),s=o.commonAncestorContainer,a=o.startOffset,c=o.endOffset,d=o.startContainer===s&&r.isFormatElement(s),u=d?s.childNodes[a]:o.startContainer,h=d?s.childNodes[c]:o.endContainer;let g,p=null;if(t)g=t.parentNode,t=t.nextSibling,p=!0;else if(g=u,3===u.nodeType&&(g=u.parentNode),o.collapsed)if(3===s.nodeType)t=s.textContent.length>c?s.splitText(c):s.nextSibling;else if(r.isBreak(g))t=g,g=g.parentNode;else{let n=g.childNodes[a];const i=n&&3===n.nodeType&&r.onlyZeroWidthSpace(n)&&r.isBreak(n.nextSibling)?n.nextSibling:n;i?i.nextSibling?t=r.isBreak(i)&&!r.isBreak(e)?i:i.nextSibling:(g.removeChild(i),t=null):t=null}else{if(u===h){t=this.isEdgePoint(h,c)?h.nextSibling:h.splitText(c);let e=u;this.isEdgePoint(u,a)||(e=u.splitText(a)),g.removeChild(e),0===g.childNodes.length&&l&&(g.innerHTML="
    ")}else{const e=this.removeNode(),n=e.container,i=e.prevContainer;if(n&&0===n.childNodes.length&&l&&(r.isFormatElement(n)?n.innerHTML="
    ":r.isRangeFormatElement(n)&&(n.innerHTML="


    ")),!l&&i)if(g=3===i.nodeType?i.parentNode:i,g.contains(n))for(t=n;t.parentNode===g;)t=t.parentNode;else t=null;else g=l?s:n,t=l?h:null;for(;t&&!r.isFormatElement(t)&&t.parentNode!==s;)t=t.parentNode}}try{if(r.isFormatElement(e)||r.isRangeFormatElement(e)||!r.isListCell(g)&&r.isComponent(e)){const e=g;if(r.isList(t))g=t,t=null;else if(r.isListCell(t))g=t.previousElementSibling||t;else if(!p&&!t){const e=this.removeNode(),n=3===e.container.nodeType?r.isListCell(r.getFormatElement(e.container,null))?e.container:r.getFormatElement(e.container,null)||e.container.parentNode:e.container,i=r.isWysiwygDiv(n)||r.isRangeFormatElement(n);g=i?n:n.parentNode,t=i?null:n.nextSibling}0===e.childNodes.length&&g!==e&&r.removeItem(e)}!l||i||r.isRangeFormatElement(g)||r.isListCell(g)||r.isWysiwygDiv(g)||(t=g.nextElementSibling,g=g.parentNode),g.insertBefore(e,g===t?g.lastChild:t)}catch(t){g.appendChild(e)}finally{if(i&&(r.isFormatElement(e)||r.isRangeFormatElement(e))&&(e=this._setIntoFreeFormat(e)),!r.isComponent(e)){let t=1;if(3===e.nodeType){const t=e.previousSibling,n=e.nextSibling,i=!t||1===t.nodeType||r.onlyZeroWidthSpace(t)?"":t.textContent,l=!n||1===n.nodeType||r.onlyZeroWidthSpace(n)?"":n.textContent;t&&i.length>0&&(e.textContent=i+e.textContent,r.removeItem(t)),n&&n.length>0&&(e.textContent+=l,r.removeItem(n));const o={container:e,startOffset:i.length,endOffset:e.textContent.length-l.length};return this.setRange(e,o.startOffset,e,o.endOffset),o}if(!r.isBreak(e)&&r.isFormatElement(g)){let n=null;e.previousSibling||(n=r.createTextNode(r.zeroWidthSpace),e.parentNode.insertBefore(n,e)),e.nextSibling||(n=r.createTextNode(r.zeroWidthSpace),e.parentNode.appendChild(n)),r._isIgnoreNodeChange(e)&&(e=e.nextSibling,t=0)}this.setRange(e,t,e,t)}return this.history.push(!0),e}},_setIntoFreeFormat:function(e){const t=e.parentNode;let n,i;for(;r.isFormatElement(e)||r.isRangeFormatElement(e);){for(n=e.childNodes,i=null;n[0];)if(i=n[0],r.isFormatElement(i)||r.isRangeFormatElement(i)){if(this._setIntoFreeFormat(i),!e.parentNode)break;n=e.childNodes}else t.insertBefore(i,e);0===e.childNodes.length&&r.removeItem(e),e=r.createElement("BR"),t.insertBefore(e,i.nextSibling)}return e},removeNode:function(){this._resetRangeToTextNode()||console.warn('[SUNEDITOR.core.removeNode.exception] An exception occurred while resetting the "Range" object.');const t=this.getRange();let n,i=0,l=t.startContainer,o=t.endContainer;const s=t.startOffset,a=t.endOffset,c=t.commonAncestorContainer;let d=null,u=null;const h=r.getListChildNodes(c,null);let g=r.getArrayIndex(h,l),p=r.getArrayIndex(h,o);if(h.length>0&&g>-1&&p>-1){for(let e=g+1,t=l;e>=0;e--)h[e]===t.parentNode&&h[e].firstChild===t&&0===s&&(g=e,t=t.parentNode);for(let e=p-1,t=o;e>g;e--)h[e]===t.parentNode&&1===h[e].nodeType&&(h.splice(e,1),t=t.parentNode,--p)}else{if(0===h.length){if(r.isFormatElement(c)||r.isRangeFormatElement(c)||r.isWysiwygDiv(c)||r.isBreak(c)||r.isMedia(c))return{container:c,offset:0};h.push(c),l=o=c}else if(l=o=h[0],r.isBreak(l)||r.onlyZeroWidthSpace(l))return{container:l,offset:0};g=p=0}function m(e){const t=r.getFormatElement(e,null);if(r.removeItem(e),r.isListCell(t)){const e=r.getArrayItem(t.children,r.isList,!1);if(e){const n=e.firstElementChild,i=n.childNodes;for(;i[0];)t.insertBefore(i[0],e);r.removeItemAllParents(n,null,null)}}}for(let e=g;e<=p;e++){const t=h[e];if(0===t.length||3===t.nodeType&&void 0===t.data)m(t);else if(t!==l)t!==o?m(t):(u=1===o.nodeType?r.createTextNode(o.textContent):r.createTextNode(o.substringData(a,o.length-a)),u.length>0?o.data=u.data:m(o));else if(1===l.nodeType?d=r.createTextNode(l.textContent):t===o?(d=r.createTextNode(l.substringData(0,s)+o.substringData(a,o.length-a)),i=s):d=r.createTextNode(l.substringData(0,s)),d.length>0?l.data=d.data:m(l),t===o)break}if(n=o&&o.parentNode?o:l&&l.parentNode?l:t.endContainer||t.startContainer,!r.isWysiwygDiv(n)){const t=r.removeItemAllParents(n,function(e){if(this.isComponent(e))return!1;const t=e.textContent;return 0===t.length||/^(\n|\u200B)+$/.test(t)}.bind(r),null);t&&(n=t.sc||t.ec||e.element.wysiwyg)}return this.setRange(n,i,n,i),this.history.push(!0),{container:n,offset:i,prevContainer:l&&l.parentNode?l:null}},applyRangeFormatElement:function(e){this.getRange_addLine(this.getRange());const t=this.getSelectedElementsAndComponents(!1);if(!t||0===t.length)return;e:for(let e,n,i,l,o,s,a=0,c=t.length;a-1&&(l=n.lastElementChild,t.indexOf(l)>-1)){let e=null;for(;e=l.lastElementChild;)if(r.isList(e)){if(!(t.indexOf(e.lastElementChild)>-1))continue e;l=e.lastElementChild}i=n.firstElementChild,o=t.indexOf(i),s=t.indexOf(l),t.splice(o,s-o+1),c=t.length}else;let n,i,l,o=t[t.length-1];n=r.isRangeFormatElement(o)||r.isFormatElement(o)?o:r.getRangeFormatElement(o,null)||r.getFormatElement(o,null),r.isCell(n)?(i=null,l=n):(i=n.nextSibling,l=n.parentNode);let s=r.getElementDepth(n),a=null;const c=[],d=function(e,t,n){let i=null;if(e!==t&&!r.isTable(t)){if(t&&r.getElementDepth(e)===r.getElementDepth(t))return n;i=r.removeItemAllParents(t,null,e)}return i?i.ec:n};for(let n,o,u,h,g,p,m,f=0,_=t.length;f<_;f++)if(n=t[f],o=n.parentNode,o&&!e.contains(o))if(u=r.getElementDepth(n),r.isList(o)){if(null===a&&(p?(a=p,m=!0,p=null):a=o.cloneNode(!1)),c.push(n),g=t[f+1],f===_-1||g&&g.parentNode!==o){g&&n.contains(g.parentNode)&&(p=g.parentNode.cloneNode(!1));let t,f=o.parentNode;for(;r.isList(f);)t=r.createElement(f.nodeName),t.appendChild(a),a=t,f=f.parentNode;const _=this.detachRangeFormatElement(o,c,null,!0,!0);s>=u?(s=u,l=_.cc,i=d(l,o,_.ec),i&&(l=i.parentNode)):l===_.cc&&(i=_.ec),l!==_.cc&&(h=d(l,_.cc,h),i=void 0!==h?h:_.cc);for(let e=0,t=_.removeArray.length;e=u&&(s=u,l=o,i=n.nextSibling),e.appendChild(n),l!==o&&(h=d(l,o),void 0!==h&&(i=h));if(this.effectNode=null,r.mergeSameTags(e,null,!1),r.mergeNestedTags(e,function(e){return this.isList(e)}.bind(r)),i&&r.getElementDepth(i)>0&&(r.isList(i.parentNode)||r.isList(i.parentNode.parentNode))){const t=r.getParentElement(i,function(e){return this.isRangeFormatElement(e)&&!this.isList(e)}.bind(r)),n=r.splitElement(i,null,t?r.getElementDepth(t)+1:0);n.parentNode.insertBefore(e,n)}else l.insertBefore(e,i),d(e,i);const u=r.getEdgeChildNodes(e.firstElementChild,e.lastElementChild);t.length>1?this.setRange(u.sc,0,u.ec,u.ec.textContent.length):this.setRange(u.ec,u.ec.textContent.length,u.ec,u.ec.textContent.length),this.history.push(!1)},detachRangeFormatElement:function(e,t,n,i,l){const o=this.getRange(),s=o.startOffset,a=o.endOffset;let c=r.getListChildNodes(e,(function(t){return t.parentNode===e})),d=e.parentNode,u=null,h=null,g=e.cloneNode(!1);const p=[],m=r.isList(n);let f=!1,_=!1,b=!1;function v(t,n,i,l){if(r.onlyZeroWidthSpace(n)&&(n.innerHTML=r.zeroWidthSpace),3===n.nodeType)return t.insertBefore(n,i),n;const o=(b?n:l).childNodes;let s=n.cloneNode(!1),a=null,c=null;for(;o[0];)c=o[0],!r._notTextNode(c)||r.isBreak(c)||r.isListCell(s)?s.appendChild(c):(s.childNodes.length>0&&(a||(a=s),t.insertBefore(s,i),s=n.cloneNode(!1)),t.insertBefore(c,i),a||(a=c));if(s.childNodes.length>0){if(r.isListCell(t)&&r.isListCell(s)&&r.isList(i))if(m){for(a=i;i;)s.appendChild(i),i=i.nextSibling;t.parentNode.insertBefore(s,t.nextElementSibling)}else{const t=l.nextElementSibling,n=r.detachNestedList(l,!1);if(e!==n||t!==l.nextElementSibling){const t=s.childNodes;for(;t[0];)l.appendChild(t[0]);e=n,_=!0}}else t.insertBefore(s,i);a||(a=s)}return a}for(let l,o,s,a=0,y=c.length;a0&&(d.insertBefore(g,e),g=null),!m&&r.isListCell(l))if(s&&r.getElementDepth(l)!==r.getElementDepth(s)&&(r.isListCell(d)||r.getArrayItem(l.children,r.isList,!1))){const t=l.nextElementSibling,n=r.detachNestedList(l,!1);e===n&&t===l.nextElementSibling||(e=n,_=!0)}else{const t=l;l=r.createElement(i?t.nodeName:r.isList(e.parentNode)||r.isListCell(e.parentNode)?"LI":r.isCell(e.parentNode)?"DIV":"P");const n=r.isListCell(l),o=t.childNodes;for(;o[0]&&(!r.isList(o[0])||n);)l.appendChild(o[0]);r.copyFormatAttributes(l,t),b=!0}else l=l.cloneNode(!1);if(!_&&(i?(p.push(l),r.removeItem(c[a])):(n?(f||(d.insertBefore(n,e),f=!0),l=v(n,l,null,c[a])):l=v(d,l,e,c[a]),_||(t?(h=l,u||(u=l)):u||(u=h=l))),_)){_=b=!1,c=r.getListChildNodes(e,(function(t){return t.parentNode===e})),g=e.cloneNode(!1),d=e.parentNode,a=-1,y=c.length;continue}}const y=e.parentNode;let C=e.nextSibling;g&&g.children.length>0&&y.insertBefore(g,C),n?u=n.previousSibling:u||(u=e.previousSibling),C=e.nextSibling,0===e.children.length||0===e.textContent.length?r.removeItem(e):r.removeEmptyNode(e,null);let w=null;if(i)w={cc:y,sc:u,ec:C,removeArray:p};else{u||(u=h),h||(h=u);const e=r.getEdgeChildNodes(u,h.parentNode?u:h);w={cc:(e.sc||e.ec).parentNode,sc:e.sc,ec:e.ec}}if(this.effectNode=null,l)return w;!i&&w&&(t?this.setRange(w.sc,s,w.ec,a):this.setRange(w.sc,0,w.sc,0)),this.history.push(!1)},detachList:function(e,t){let n={},i=!1,l=!1,o=null,s=null;const a=function(e){return!this.isComponent(e)}.bind(r);for(let c,d,u,h,g=0,p=e.length;g0)&&t,n=!!(n&&n.length>0)&&n;const o=!e,s=o&&!n&&!t;let c=l.startContainer,d=l.startOffset,u=l.endContainer,h=l.endOffset;if(s&&l.collapsed&&r.isFormatElement(c.parentNode)&&r.isFormatElement(u.parentNode)||c===u&&1===c.nodeType&&r.isNonEditable(c))return;if(l.collapsed&&!s&&1===c.nodeType&&!r.isBreak(c)&&!r.isComponent(c)){let e=null;const t=c.childNodes[d];t&&(e=t.nextSibling?r.isBreak(t)?t:t.nextSibling:null);const n=r.createTextNode(r.zeroWidthSpace);c.insertBefore(n,e),this.setRange(n,1,n,1),l=this.getRange(),c=l.startContainer,d=l.startOffset,u=l.endContainer,h=l.endOffset}r.isFormatElement(c)&&(c=c.childNodes[d]||c.firstChild,d=0),r.isFormatElement(u)&&(u=u.childNodes[h]||u.lastChild,h=u.textContent.length),o&&(e=r.createElement("DIV"));const g=a.RegExp,p=e.nodeName;if(!s&&c===u&&!n&&e){let t=c,n=0;const i=[],l=e.style;for(let e=0,t=l.length;e0){for(;!r.isFormatElement(t)&&!r.isWysiwygDiv(t);){for(let l=0;l=i.length)return}}let m,f={},_={},b="",v="",y="";if(t){for(let e,n=0,i=t.length;n0&&(a=l.replace(b,"").trim(),a!==l&&(w.v=!0));const c=t.className;let d="";return v&&c.length>0&&(d=c.replace(v,"").trim(),d!==c&&(w.v=!0)),(!o||!v&&c||!b&&l||a||d||!n)&&(a||d||t.nodeName!==p||C(b)!==C(l)||C(v)!==C(c))?(b&&l.length>0&&(t.style.cssText=a),t.style.cssText||t.removeAttribute("style"),v&&c.length>0&&(t.className=d.trim()),t.className.trim()||t.removeAttribute("class"),t.style.cssText||t.className||t.nodeName!==p&&!n?t:(w.v=!0,null)):(w.v=!0,null)},E=this.getSelectedElements(null);l=this.getRange(),c=l.startContainer,d=l.startOffset,u=l.endContainer,h=l.endOffset,r.getFormatElement(c,null)||(c=r.getChildElement(E[0],(function(e){return 3===e.nodeType}),!1),d=0),r.getFormatElement(u,null)||(u=r.getChildElement(E[E.length-1],(function(e){return 3===e.nodeType}),!1),h=u.textContent.length);const S=r.getFormatElement(c,null)===r.getFormatElement(u,null),N=E.length-(S?0:1);m=e.cloneNode(!1);const T=s||o&&function(e){for(let t=0,n=e.length;t0&&(m=e.cloneNode(!1),_=this._nodeChange_endLine(E[N],m,x,u,h,s,o,w,k,A));for(let t,n=N-1;n>0;n--)m=e.cloneNode(!1),t=this._nodeChange_middleLine(E[n],m,x,s,o,w,_.container),t.endContainer&&(_.ancestor=null,_.container=t.endContainer),this._setCommonListStyle(t.ancestor,null);m=e.cloneNode(!1),f=this._nodeChange_startLine(E[0],m,x,c,d,s,o,w,k,A,_.container),f.endContainer&&(_.ancestor=null,_.container=f.endContainer),N<=0?_=f:_.container||(_.ancestor=null,_.container=f.container,_.offset=f.container.textContent.length),this._setCommonListStyle(f.ancestor,null),this._setCommonListStyle(_.ancestor||r.getFormatElement(_.container),null)}this.controllersOff(),this.setRange(f.container,f.offset,_.container,_.offset),this.history.push(!1)},_setCommonListStyle:function(e,t){if(!r.isListCell(e))return;t||e.removeAttribute("style");const n=r.getArrayItem((t||e).childNodes,(function(e){return!r.isBreak(e)&&!r.onlyZeroWidthSpace(e.textContent.trim())}),!0);if(n[0]&&1===n.length){if(!(t=n[0])||1!==t.nodeType)return;const i=t.style,l=e.style;/STRONG/i.test(t.nodeName)?l.fontWeight="bold":i.fontWeight&&(l.fontWeight=i.fontWeight),i.color&&(l.color=i.color),i.fontSize&&(l.fontSize=i.fontSize),this._setCommonListStyle(e,t)}},_stripRemoveNode:function(e){const t=e.parentNode;if(!e||3===e.nodeType||!t)return;const n=e.childNodes;for(;n[0];)t.insertBefore(n[0],e);t.removeChild(e)},_util_getMaintainedNode:function(e,t,n){return!n||e?null:this.getParentElement(n,this._isMaintainedNode.bind(this))||(t?null:this.getParentElement(n,this._isSizeNode.bind(this)))},_util_isMaintainedNode:function(e,t,n){if(!n||e||1!==n.nodeType)return!1;const i=this._isMaintainedNode(n);return this.getParentElement(n,this._isMaintainedNode.bind(this))?i:i||!t&&this._isSizeNode(n)},_nodeChange_oneLine:function(e,t,n,i,l,o,s,c,d,u,h,g,p){let m=i.parentNode;for(;!(m.nextSibling||m.previousSibling||r.isFormatElement(m.parentNode)||r.isWysiwygDiv(m.parentNode))&&m.nodeName!==t.nodeName;)m=m.parentNode;if(!d&&m===o.parentNode&&m.nodeName===t.nodeName&&r.onlyZeroWidthSpace(i.textContent.slice(0,l))&&r.onlyZeroWidthSpace(o.textContent.slice(s))){const e=m.childNodes;let n=!0;for(let t,l,s,a,c=0,d=e.length;c0&&(n=t.test(e.style.cssText)),!n}if(function e(i,l){const o=i.childNodes;for(let i,s=0,a=o.length;s=N?L-N:S.data.length-N));if(E){const t=g(l);if(t&&t.parentNode!==e){let n=t,i=null;for(;n.parentNode!==e;){for(l=i=n.parentNode.cloneNode(!1);n.childNodes[0];)i.appendChild(n.childNodes[0]);n.appendChild(i),n=n.parentNode}n.parentNode.appendChild(t)}E=E.cloneNode(!1)}r.onlyZeroWidthSpace(o)||l.appendChild(o);const c=g(l);for(c&&(E=c),E&&(e=E),C=a,y=[],x="";C!==e&&C!==f&&null!==C;)i=p(C)?null:n(C),i&&1===C.nodeType&&z(C)&&(y.push(i),x+=C.style.cssText.substr(0,C.style.cssText.indexOf(":"))+"|"),C=C.parentNode;const d=y.pop()||s;for(w=C=d;y.length>0;)C=y.pop(),w.appendChild(C),w=C;if(t.appendChild(d),e.appendChild(t),E&&!g(T)&&(t=t.cloneNode(!1),b.appendChild(t),_.push(t)),S=s,N=0,k=!0,C!==s&&C.appendChild(S),!v)continue}if(A||a!==T){if(k){if(1===a.nodeType&&!r.isBreak(a)){r._isIgnoreNodeChange(a)?(b.appendChild(a.cloneNode(!0)),u||(t=t.cloneNode(!1),b.appendChild(t),_.push(t))):e(a,a);continue}C=a,y=[],x="";const o=[];for(;null!==C.parentNode&&C!==f&&C!==t;)i=A?C.cloneNode(!1):n(C),1===C.nodeType&&!r.isBreak(a)&&i&&z(C)&&(p(C)?E||o.push(i):y.push(i),x+=C.style.cssText.substr(0,C.style.cssText.indexOf(":"))+"|"),C=C.parentNode;y=y.concat(o);const s=y.pop()||a;for(w=C=s;y.length>0;)C=y.pop(),w.appendChild(C),w=C;if(p(t.parentNode)&&!p(s)&&(t=t.cloneNode(!1),b.appendChild(t),_.push(t)),A||E||!p(s))s===a?l=A?b:t:A?(b.appendChild(s),l=C):(t.appendChild(s),l=C);else{t=t.cloneNode(!1);const e=s.childNodes;for(let n=0,i=e.length;n0?C:t}if(E&&3===a.nodeType)if(g(a)){const e=r.getParentElement(l,function(e){return this._isMaintainedNode(e.parentNode)||e.parentNode===b}.bind(r));E.appendChild(e),t=e.cloneNode(!1),_.push(t),b.appendChild(t)}else E=null}d=a.cloneNode(!1),l.appendChild(d),1!==a.nodeType||r.isBreak(a)||(h=d),e(a,h)}else{E=g(a);const e=r.createTextNode(1===T.nodeType?"":T.substringData(L,T.length-L)),l=r.createTextNode(v||1===T.nodeType?"":T.substringData(0,L));if(E?E=E.cloneNode(!1):p(t.parentNode)&&!E&&(t=t.cloneNode(!1),b.appendChild(t),_.push(t)),!r.onlyZeroWidthSpace(e)){C=a,x="",y=[];const t=[];for(;C!==b&&C!==f&&null!==C;)1===C.nodeType&&z(C)&&(p(C)?t.push(C.cloneNode(!1)):y.push(C.cloneNode(!1)),x+=C.style.cssText.substr(0,C.style.cssText.indexOf(":"))+"|"),C=C.parentNode;for(y=y.concat(t),d=w=C=y.pop()||e;y.length>0;)C=y.pop(),w.appendChild(C),w=C;b.appendChild(d),C.textContent=e.data}if(E&&d){const e=g(d);e&&(E=e)}for(C=a,y=[],x="";C!==b&&C!==f&&null!==C;)i=p(C)?null:n(C),i&&1===C.nodeType&&z(C)&&(y.push(i),x+=C.style.cssText.substr(0,C.style.cssText.indexOf(":"))+"|"),C=C.parentNode;const o=y.pop()||l;for(w=C=o;y.length>0;)C=y.pop(),w.appendChild(C),w=C;E?((t=t.cloneNode(!1)).appendChild(o),E.insertBefore(t,E.firstChild),b.appendChild(E),_.push(t),E=null):t.appendChild(o),T=l,L=l.data.length,A=!0,!c&&u&&(t=l,l.textContent=r.zeroWidthSpace),C!==l&&C.appendChild(T)}}}(e,b),d&&!c&&!h.v)return{ancestor:e,startContainer:i,startOffset:l,endContainer:o,endOffset:s};if(c=c&&d)for(let e=0;e<_.length;e++){let t,n,i,l=_[e];if(u)t=r.createTextNode(r.zeroWidthSpace),b.replaceChild(t,l);else{const e=l.childNodes;for(n=e[0];e[0];)i=e[0],b.insertBefore(i,l);r.removeItem(l)}0===e&&(u?S=T=t:(S=n,T=i))}else{if(d)for(let e=0;e<_.length;e++)this._stripRemoveNode(_[e]);u&&(S=T=t)}r.removeEmptyNode(b,t),u&&(N=S.textContent.length,L=T.textContent.length);const M=c||0===T.textContent.length;r.isBreak(T)||0!==T.textContent.length||(r.removeItem(T),T=S),L=M?T.textContent.length:L;const H={s:0,e:0},I=r.getNodePath(S,b,H),D=!T.parentNode;D&&(T=S);const O={s:0,e:0},F=r.getNodePath(T,b,D||M?null:O);N+=H.s,L=u?N:D?S.textContent.length:M?L+H.s:L+O.s;const R=r.mergeSameTags(b,[I,F],!0);return e.parentNode.replaceChild(b,e),S=r.getNodeFromPath(I,b),T=r.getNodeFromPath(F,b),{ancestor:b,startContainer:S,startOffset:N+R[0],endContainer:T,endOffset:L+R[1]}},_nodeChange_startLine:function(e,t,n,i,l,o,s,a,c,d,u){let h=i.parentNode;for(;!(h.nextSibling||h.previousSibling||r.isFormatElement(h.parentNode)||r.isWysiwygDiv(h.parentNode))&&h.nodeName!==t.nodeName;)h=h.parentNode;if(!s&&h.nodeName===t.nodeName&&!r.isFormatElement(h)&&!h.nextSibling&&r.onlyZeroWidthSpace(i.textContent.slice(0,l))){let n=!0,o=i.previousSibling;for(;o;){if(!r.onlyZeroWidthSpace(o)){n=!1;break}o=o.previousSibling}if(n)return r.copyTagAttributes(h,t),{ancestor:e,container:i,offset:l}}a.v=!1;const g=e,p=[t],m=e.cloneNode(!1);let f,_,b,v,y=i,C=l,w=!1;if(function e(i,l){const o=i.childNodes;for(let i,s,a=0,h=o.length;a0,y=f.pop()||h;for(b=_=y;f.length>0;)_=f.pop(),b.appendChild(_),b=_;if(d(t.parentNode)&&!d(y)&&(t=t.cloneNode(!1),m.appendChild(t),p.push(t)),!v&&d(y)){t=t.cloneNode(!1);const e=y.childNodes;for(let n=0,i=e.length;n0;)_=f.pop(),b.appendChild(_),b=_;d!==l?(t.appendChild(d),l=_):l=t,r.isBreak(h)&&t.appendChild(h.cloneNode(!1)),e.appendChild(t),y=s,C=0,w=!0,l.appendChild(y)}}}(e,m),s&&!o&&!a.v)return{ancestor:e,container:i,offset:l,endContainer:u};if(o=o&&s)for(let e=0;e0&&u===h)return e.innerHTML=i.innerHTML,{ancestor:e,endContainer:n?r.getNodeFromPath(n,e):null}}o.v=!1;const a=e.cloneNode(!1),c=[t];let d=!0;if(function e(i,l){const o=i.childNodes;for(let i,u,h=0,g=o.length;h0&&(a.appendChild(t),t=t.cloneNode(!1)),u=g.cloneNode(!0),a.appendChild(u),a.appendChild(t),c.push(t),l=t,s&&g.contains(s)){const e=r.getNodePath(s,g);s=r.getNodeFromPath(e,u)}}}(e,t),d||l&&!i&&!o.v)return{ancestor:e,endContainer:s};if(a.appendChild(t),i&&l)for(let e=0;e0,u=m.pop()||a;for(_=f=u;m.length>0;)f=m.pop(),_.appendChild(f),_=f;if(d(t.parentNode)&&!d(u)&&(t=t.cloneNode(!1),p.insertBefore(t,p.firstChild),g.push(t)),!b&&d(u)){t=t.cloneNode(!1);const e=u.childNodes;for(let n=0,i=e.length;n0?f:t}else s?(t.insertBefore(u,t.firstChild),l=f):l=t;if(b&&3===a.nodeType)if(c(a)){const e=r.getParentElement(l,function(e){return this._isMaintainedNode(e.parentNode)||e.parentNode===p}.bind(r));b.appendChild(e),t=e.cloneNode(!1),g.push(t),p.insertBefore(t,p.firstChild)}else b=null}if(C||a!==v)i=C?n(a):a.cloneNode(!1),i&&(l.insertBefore(i,l.firstChild),1!==a.nodeType||r.isBreak(a)||(u=i)),e(a,u);else{b=c(a);const e=r.createTextNode(1===v.nodeType?"":v.substringData(y,v.length-y)),o=r.createTextNode(1===v.nodeType?"":v.substringData(0,y));if(b){b=b.cloneNode(!1);const e=c(l);if(e&&e.parentNode!==p){let t=e,n=null;for(;t.parentNode!==p;){for(l=n=t.parentNode.cloneNode(!1);t.childNodes[0];)n.appendChild(t.childNodes[0]);t.appendChild(n),t=t.parentNode}t.parentNode.insertBefore(e,t.parentNode.firstChild)}b=b.cloneNode(!1)}else d(t.parentNode)&&!b&&(t=t.cloneNode(!1),p.appendChild(t),g.push(t));for(r.onlyZeroWidthSpace(e)||l.insertBefore(e,l.firstChild),f=l,m=[];f!==p&&null!==f;)i=d(f)?null:n(f),i&&1===f.nodeType&&m.push(i),f=f.parentNode;const s=m.pop()||l;for(_=f=s;m.length>0;)f=m.pop(),_.appendChild(f),_=f;s!==l?(t.insertBefore(s,t.firstChild),l=f):l=t,r.isBreak(a)&&t.appendChild(a.cloneNode(!1)),b?(b.insertBefore(t,b.firstChild),p.insertBefore(b,p.firstChild),b=null):p.insertBefore(t,p.firstChild),v=o,y=o.data.length,C=!0,l.insertBefore(v,l.firstChild)}}}(e,p),s&&!o&&!a.v)return{ancestor:e,container:i,offset:l};if(o=o&&s)for(let e=0;e-1?null:r.createElement(n);let d=n;/^SUB$/i.test(n)&&a.indexOf("SUP")>-1?d="SUP":/^SUP$/i.test(n)&&a.indexOf("SUB")>-1&&(d="SUB"),this.nodeChange(c,null,[d],!1),this.focus()}},removeFormat:function(){this.nodeChange(null,null,null,null)},indent:function(e){const t=this.getRange(),n=this.getSelectedElements(null),i=[],l="indent"!==e;let o=t.startContainer,s=t.endContainer,a=t.startOffset,c=t.endOffset;for(let e,t,o=0,s=n.length;o0&&this.plugins.list.editInsideList.call(this,l,i),this.effectNode=null,this.setRange(o,a,s,c),this.history.push(!1)},toggleDisplayBlocks:function(){const t=e.element.wysiwyg;r.toggleClass(t,"se-show-block"),r.hasClass(t,"se-show-block")?r.addClass(this._styleCommandMap.showBlocks,"active"):r.removeClass(this._styleCommandMap.showBlocks,"active"),this._resourcesStateChange()},toggleCodeView:function(){const t=this._variable.isCodeView;this.controllersOff(),r.setDisabledButtons(!t,this.codeViewDisabledButtons),t?(this._setCodeDataToEditor(),e.element.wysiwygFrame.scrollTop=0,e.element.code.style.display="none",e.element.wysiwygFrame.style.display="block",this._variable._codeOriginCssText=this._variable._codeOriginCssText.replace(/(\s?display(\s+)?:(\s+)?)[a-zA-Z]+(?=;)/,"display: none"),this._variable._wysiwygOriginCssText=this._variable._wysiwygOriginCssText.replace(/(\s?display(\s+)?:(\s+)?)[a-zA-Z]+(?=;)/,"display: block"),"auto"!==l.height||l.codeMirrorEditor||(e.element.code.style.height="0px"),this._variable.isCodeView=!1,this._variable.isFullScreen||(this._notHideToolbar=!1,/balloon|balloon-always/i.test(l.mode)&&(e.element._arrow.style.display="",this._isInline=!1,this._isBalloon=!0,u._hideToolbar())),this.nativeFocus(),r.removeClass(this._styleCommandMap.codeView,"active"),this.history.push(!1)):(this._setEditorDataToCodeView(),this._variable._codeOriginCssText=this._variable._codeOriginCssText.replace(/(\s?display(\s+)?:(\s+)?)[a-zA-Z]+(?=;)/,"display: block"),this._variable._wysiwygOriginCssText=this._variable._wysiwygOriginCssText.replace(/(\s?display(\s+)?:(\s+)?)[a-zA-Z]+(?=;)/,"display: none"),"auto"!==l.height||l.codeMirrorEditor||(e.element.code.style.height=e.element.code.scrollHeight>0?e.element.code.scrollHeight+"px":"auto"),l.codeMirrorEditor&&l.codeMirrorEditor.refresh(),this._variable.isCodeView=!0,this._variable.isFullScreen||(this._notHideToolbar=!0,this._isBalloon&&(e.element._arrow.style.display="none",e.element.toolbar.style.left="",this._isInline=!0,this._isBalloon=!1,u._showToolbarInline())),this._variable._range=null,e.element.code.focus(),r.addClass(this._styleCommandMap.codeView,"active")),this._checkPlaceholder(),"function"==typeof h.toggleCodeView&&h.toggleCodeView(this._variable.isCodeView,this)},_setCodeDataToEditor:function(){const t=this._getCodeView();if(l.fullPage){const e=this._parser.parseFromString(t,"text/html"),n=e.head.children;for(let t=0,i=n.length;t0?this.convertContentsForEditor(t):"


    "},_setEditorDataToCodeView:function(){const t=this.convertHTMLForCodeView(e.element.wysiwyg);let n="";if(l.fullPage){const e=r.getAttributesToString(this._wd.body,null);n="\n\n"+this._wd.head.outerHTML.replace(/>(?!\n)/g,">\n")+"\n"+t+"\n"}else n=t;e.element.code.style.display="block",e.element.wysiwygFrame.style.display="none",this._setCodeView(n)},toggleFullScreen:function(t){const n=e.element.topArea,i=e.element.toolbar,o=e.element.editorArea,d=e.element.wysiwygFrame,g=e.element.code,p=this._variable;this.controllersOff(),p.isFullScreen?(p.isFullScreen=!1,d.style.cssText=p._wysiwygOriginCssText,g.style.cssText=p._codeOriginCssText,i.style.cssText="",o.style.cssText=p._editorAreaOriginCssText,n.style.cssText=p._originCssText,s.body.style.overflow=p._bodyOverflow,l.toolbarContainer&&l.toolbarContainer.appendChild(i),l.stickyToolbar>-1&&r.removeClass(i,"se-toolbar-sticky"),p._fullScreenAttrs.sticky&&!l.toolbarContainer&&(p._fullScreenAttrs.sticky=!1,e.element._stickyDummy.style.display="block",r.addClass(i,"se-toolbar-sticky")),this._isInline=p._fullScreenAttrs.inline,this._isBalloon=p._fullScreenAttrs.balloon,this._isInline&&u._showToolbarInline(),l.toolbarContainer&&r.removeClass(i,"se-toolbar-balloon"),u.onScroll_window(),r.changeElement(t.firstElementChild,c.expansion),r.removeClass(this._styleCommandMap.fullScreen,"active")):(p.isFullScreen=!0,p._fullScreenAttrs.inline=this._isInline,p._fullScreenAttrs.balloon=this._isBalloon,(this._isInline||this._isBalloon)&&(this._isInline=!1,this._isBalloon=!1),l.toolbarContainer&&e.element.relative.insertBefore(i,o),n.style.position="fixed",n.style.top="0",n.style.left="0",n.style.width="100%",n.style.maxWidth="100%",n.style.height="100%",n.style.zIndex="2147483647",""!==e.element._stickyDummy.style.display&&(p._fullScreenAttrs.sticky=!0,e.element._stickyDummy.style.display="none",r.removeClass(i,"se-toolbar-sticky")),p._bodyOverflow=s.body.style.overflow,s.body.style.overflow="hidden",p._editorAreaOriginCssText=o.style.cssText,p._wysiwygOriginCssText=d.style.cssText,p._codeOriginCssText=g.style.cssText,o.style.cssText=i.style.cssText="",d.style.cssText=(d.style.cssText.match(/\s?display(\s+)?:(\s+)?[a-zA-Z]+;/)||[""])[0],g.style.cssText=(g.style.cssText.match(/\s?display(\s+)?:(\s+)?[a-zA-Z]+;/)||[""])[0],i.style.width=d.style.height=g.style.height="100%",i.style.position="relative",i.style.display="block",p.innerHeight_fullScreen=a.innerHeight-i.offsetHeight,o.style.height=p.innerHeight_fullScreen+"px",r.changeElement(t.firstElementChild,c.reduction),l.iframe&&"auto"===l.height&&(o.style.overflow="auto",this._iframeAutoHeight()),r.addClass(this._styleCommandMap.fullScreen,"active")),"function"==typeof h.toggleFullScreen&&h.toggleFullScreen(this._variable.isFullScreen,this)},print:function(){const e=r.createElement("IFRAME");e.style.display="none",s.body.appendChild(e);const t=r.getIframeDocument(e),n=this.getContents(!0),i=this._wd;if(l.iframe){const e=l.fullPage?r.getAttributesToString(i.body,["contenteditable"]):'class="sun-editor-editable"';t.write(""+i.head.innerHTML+""+n+"")}else{const e=s.head.getElementsByTagName("link"),i=s.head.getElementsByTagName("style");let l="";for(let t=0,n=e.length;t"+l+''+n+"")}this.showLoading(),a.setTimeout((function(){try{if(e.focus(),r.isIE_Edge||s.documentMode||a.StyleMedia)try{e.contentWindow.document.execCommand("print",!1,null)}catch(t){e.contentWindow.print()}else e.contentWindow.print()}catch(e){throw Error("[SUNEDITOR.core.print.fail] error: "+e)}finally{d.closeLoading(),r.removeItem(e)}}),1e3)},preview:function(){d.submenuOff(),d.containerOff(),d.controllersOff();const t=this.getContents(!0),n=a.open("","_blank");n.mimeType="text/html";const o=e.element.wysiwygFrame.offsetWidth+"px !important",c=this._wd;if(l.iframe){const e=l.fullPage?r.getAttributesToString(c.body,["contenteditable"]):'class="sun-editor-editable"';n.document.write(""+c.head.innerHTML+""+t+"")}else{const e=s.head.getElementsByTagName("link"),l=s.head.getElementsByTagName("style");let a="";for(let t=0,n=e.length;t'+i.toolbar.preview+""+a+''+t+"")}},setContents:function(t){const n=this.convertContentsForEditor(t);if(this._resetComponents(),this._variable.isCodeView){const e=this.convertHTMLForCodeView(n);this._setCodeView(e)}else e.element.wysiwyg.innerHTML=n,this.history.push(!1)},getContents:function(t){const n=e.element.wysiwyg.innerHTML,i=r.createElement("DIV");i.innerHTML=n;const o=r.getListChildren(i,(function(e){return/FIGCAPTION/i.test(e.nodeName)}));for(let e=0,t=o.length;e"+this._wd.head.outerHTML+""+i.innerHTML+""}return i.innerHTML},_makeLine:function(e,t){if(1===e.nodeType)return r._disallowedTags(e)?"":!t||r.isFormatElement(e)||r.isRangeFormatElement(e)||r.isComponent(e)||r.isMedia(e)||r.isAnchor(e)&&r.isMedia(e.firstElementChild)?e.outerHTML:"

    "+e.outerHTML+"

    ";if(3===e.nodeType){if(!t)return e.textContent;const n=e.textContent.split(/\n/g);let i="";for(let e,t=0,l=n.length;t0&&(i+="

    "+e+"

    ");return i}return 8===e.nodeType&&this._allowHTMLComments?"\x3c!--"+e.textContent.trim()+"--\x3e":""},_tagConvertor:function(e){if(!this._disallowedTextTagsRegExp)return e;const t={b:"strong",i:"em",ins:"u",strike:"del",s:"del"};return e.replace(this._disallowedTextTagsRegExp,(function(e,n,i){return n+("string"==typeof t[i]?t[i]:i)}))},_deleteDisallowedTags:function(e){return e.replace(/\n/g,"").replace(/<(script|style).*>(\n|.)*<\/(script|style)>/gi,"").replace(/<[a-z0-9]+\:[a-z0-9]+[^>^\/]*>[^>]*<\/[a-z0-9]+\:[a-z0-9]+>/gi,"").replace(this.editorTagsWhitelistRegExp,"")},cleanHTML:function(e,t){e=this._deleteDisallowedTags(e).replace(/(<[a-zA-Z0-9]+)[^>]*(?=>)/g,function(e,t){if(/^<[a-z0-9]+\:[a-z0-9]+/i.test(e))return e;let n=null;const i=this._attributesTagsWhitelist[t.match(/(?!<)[a-zA-Z0-9]+/)[0].toLowerCase()];if(n=i?e.match(i):e.match(this._attributesWhitelistRegExp),/

    ":(i=r.htmlRemoveWhiteSpace(i),this._tagConvertor(i))},convertHTMLForCodeView:function(e){let t="";const n=a.RegExp,i=new n("^(BLOCKQUOTE|PRE|TABLE|THEAD|TBODY|TR|TH|TD|OL|UL|IMG|IFRAME|VIDEO|AUDIO|FIGURE|FIGCAPTION|HR|BR|CANVAS|SELECT)$","i"),l=r.isFormatElement.bind(r),o="string"==typeof e?s.createRange().createContextualFragment(e):e;let c=1*this._variable.codeIndent;return c=c>0?new a.Array(c+1).join(" "):"",function e(o,s,a){const d=o.childNodes,u=i.test(o.nodeName),h=u?s:"";for(let g,p,m,f=0,_=d.length;f<_;f++){if(g=d[f],m=i.test(g.nodeName),p=m?"\n":"",a=!l(g)||u||/^(TH|TD)$/i.test(o.nodeName)?"":"\n",8===g.nodeType){t+="\n\x3c!-- "+g.textContent.trim()+" --\x3e"+p;continue}if(3===g.nodeType){t+=r._HTMLConvertor(/^\n+$/.test(g.data)?"":g.data);continue}if(0===g.childNodes.length){t+=(/^HR$/i.test(g.nodeName)?"\n":"")+h+g.outerHTML+p;continue}g.innerHTML=g.innerHTML;const _=g.nodeName.toLowerCase();t+=(a||(u?"":p))+(h||m?s:"")+g.outerHTML.match(n("<"+_+"[^>]*>","i"))[0]+p,e(g,s+c,""),t+=(m?s:"")+""+(a||p||u||/^(TH|TD)$/i.test(g.nodeName)?"\n":"")}}(o,"","\n"),t.trim()+"\n"},addDocEvent:function(e,t,n){s.addEventListener(e,t,n),l.iframe&&this._wd.addEventListener(e,t)},removeDocEvent:function(e,t){s.removeEventListener(e,t),l.iframe&&this._wd.removeEventListener(e,t)},_charCount:function(e){const t=l.maxCharCount,n=l.charCounterType;let i=0;if(e&&(i=this.getCharLength(e,n)),this._setCharCount(),t>0){let e=!1;const l=h.getCharCount(n);if(l>t){if(e=!0,i>0){this._editorRange();const e=this.getRange(),n=e.endOffset-1,i=this.getSelectionNode().textContent,o=e.endOffset-(l-t);this.getSelectionNode().textContent=i.slice(0,o<0?0:o)+i.slice(e.endOffset,i.length),this.setRange(e.endContainer,n,e.endContainer,n)}}else l+i>t&&(e=!0);if(e&&(this._callCounterBlink(),i>0))return!1}return!0},checkCharCount:function(e,t){if(l.maxCharCount){const n=t||l.charCounterType,i=this.getCharLength("string"==typeof e?e:this._charTypeHTML?e.outerHTML:e.textContent,n);if(i>0&&i+h.getCharCount(n)>l.maxCharCount)return this._callCounterBlink(),!1}return!0},getCharLength:function(e,t){return/byte/.test(t)?r.getByteLength(e):e.length},_setCharCount:function(){e.element.charCounter&&a.setTimeout((function(){e.element.charCounter.textContent=h.getCharCount(l.charCounterType)}))},_callCounterBlink:function(){const t=e.element.charWrapper;t&&!r.hasClass(t,"se-blink")&&(r.addClass(t,"se-blink"),a.setTimeout((function(){r.removeClass(t,"se-blink")}),600))},_checkComponents:function(){for(let e=0,t=this._fileInfoPluginsCheck.length;e^<]+)?\\s*(?=>)","gi");const h="contenteditable|colspan|rowspan|target|href|src|class|type|controls|data-format|data-size|data-file-size|data-file-name|data-origin|data-align|data-image-link|data-rotate|data-proportion|data-percentage|origin-size|data-exp|data-font-size";this._allowHTMLComments=l._editorTagsWhitelist.indexOf("//")>-1,this._htmlCheckWhitelistRegExp=new c("^("+l._editorTagsWhitelist.replace("|//","")+")$","i"),this.editorTagsWhitelistRegExp=r.createTagsWhitelist(l._editorTagsWhitelist.replace("|//","|\x3c!--|--\x3e")),this.pasteTagsWhitelistRegExp=r.createTagsWhitelist(l.pasteTagsWhitelist);const g=l.attributesWhitelist,p={};let m="";if(g)for(let e in g)r.hasOwn(g,e)&&("all"===e?m=g[e]+"|":p[e]=new c("((?:"+g[e]+"|"+h+')s*=s*"[^"]*")',"ig"));this._attributesWhitelistRegExp=new c("((?:"+m+h+')s*=s*"[^"]*")',"ig"),this._attributesTagsWhitelist=p,this._isInline=/inline/i.test(l.mode),this._isBalloon=/balloon|balloon-always/i.test(l.mode),this._isBalloonAlways=/balloon-always/i.test(l.mode),this._cachingButtons(),this._fileInfoPluginsCheck=[],this._fileInfoPluginsReset=[],this.managedTagsInfo={query:"",map:{}};const f=[];this.activePlugins=[],this._fileManager.tags=[],this._fileManager.pluginMap={};let _,b,v=[];for(let e in n)if(r.hasOwn(n,e)){if(_=n[e],b=t[e],_.active&&b&&this.callPlugin(e,null,b),"function"==typeof _.checkFileInfo&&"function"==typeof _.resetFileInfo&&(this.callPlugin(e,null,b),this._fileInfoPluginsCheck.push(_.checkFileInfo.bind(this)),this._fileInfoPluginsReset.push(_.resetFileInfo.bind(this))),a.Array.isArray(_.fileTags)){const t=_.fileTags;this.callPlugin(e,null,b),this._fileManager.tags=this._fileManager.tags.concat(t),v.push(e);for(let n=0,i=t.length;nc&&(d=d.slice(0,c),a&&a.setAttribute("disabled",!0)),d[c]=l?{contents:n,s:{path:i.getNodePath(l.startContainer,null,null),offset:l.startOffset},e:{path:i.getNodePath(l.endContainer,null,null),offset:l.endOffset}}:{contents:n,s:{path:[0,0],offset:[0,0]},e:{path:0,offset:0}},1===c&&s&&s.removeAttribute("disabled"),e._setCharCount(),t()}return{stack:d,push:function(t){n.setTimeout(e._resourcesStateChange.bind(e));const i="number"==typeof t?t>0?t:0:t?l:0;i&&!r||(n.clearTimeout(r),i)?r=n.setTimeout((function(){n.clearTimeout(r),r=null,h()}),i):h()},undo:function(){c>0&&(c--,u())},redo:function(){d.length-1>c&&(c++,u())},go:function(e){c=e<0?d.length-1:e,u()},reset:function(n){s&&s.setAttribute("disabled",!0),a&&a.setAttribute("disabled",!0),e.context.tool.save&&e.context.tool.save.setAttribute("disabled",!0),d.splice(0),c=0,d[c]={contents:e.getContents(!0),s:{path:[0,0],offset:0},e:{path:[0,0],offset:0}},n||t()},_resetCachingButton:function(){o=e.context.element,s=e.context.tool.undo,a=e.context.tool.redo,0===c?(s&&s.setAttribute("disabled",!0),a&&c===d.length-1&&a.setAttribute("disabled",!0),e.context.tool.save&&e.context.tool.save.setAttribute("disabled",!0)):c===d.length-1&&a&&a.setAttribute("disabled",!0)},_destroy:function(){r&&n.clearTimeout(r),d=null}}}(this,this._onChange_historyStack.bind(this)),this.addModule([B]),l.iframe&&(this._wd=e.element.wysiwygFrame.contentDocument,e.element.wysiwyg=this._wd.body,l._editorStyles.editor&&(e.element.wysiwyg.style.cssText=l._editorStyles.editor),"auto"===l.height&&(this._iframeAuto=this._wd.body)),this._initWysiwygArea(i,o)},_cachingButtons:function(){this.codeViewDisabledButtons=e.element.toolbar.querySelectorAll('.se-toolbar button:not([class~="se-code-view-enabled"])'),this.resizingDisabledButtons=e.element.toolbar.querySelectorAll('.se-toolbar button:not([class~="se-resizing-enabled"])');const t=e.tool;this.commandMap={STRONG:t.bold,U:t.underline,EM:t.italic,DEL:t.strike,SUB:t.subscript,SUP:t.superscript,OUTDENT:t.outdent,INDENT:t.indent},this._styleCommandMap={fullScreen:t.fullScreen,showBlocks:t.showBlocks,codeView:t.codeView}},_initWysiwygArea:function(t,n){e.element.wysiwyg.innerHTML=t?n:this.convertContentsForEditor("string"==typeof n?n:e.element.originElement.value)},_resourcesStateChange:function(){this._iframeAutoHeight(),this._checkPlaceholder()},_onChange_historyStack:function(){u._applyTagEffects(),e.tool.save&&e.tool.save.removeAttribute("disabled"),h.onChange&&h.onChange(this.getContents(!0),this)},_iframeAutoHeight:function(){this._iframeAuto&&a.setTimeout((function(){e.element.wysiwygFrame.style.height=d._iframeAuto.offsetHeight+"px"}))},_checkPlaceholder:function(){if(this._placeholder){if(this._variable.isCodeView)return void(this._placeholder.style.display="none");const t=e.element.wysiwyg;!r.onlyZeroWidthSpace(t.textContent)||t.querySelector(".se-component, pre, blockquote, hr, li, table, img, iframe, video")||(t.innerText.match(/\n/g)||"").length>1?this._placeholder.style.display="none":this._placeholder.style.display="block"}},_setDefaultFormat:function(e){if(this._fileManager.pluginRegExp.test(this.currentControllerName))return;const t=this.getRange(),n=t.commonAncestorContainer,i=t.startContainer,l=r.getRangeFormatElement(n,null);let o,s,a;const c=r.getParentElement(n,r.isComponent);if((!c||r.isTable(c))&&(!r.isRangeFormatElement(i)&&!r.isWysiwygDiv(i)||!r.isComponent(i.childNodes[t.startOffset]))){if(l)return a=r.createElement(e||"P"),a.innerHTML=l.innerHTML,0===a.childNodes.length&&(a.innerHTML=r.zeroWidthSpace),l.innerHTML=a.outerHTML,a=l.firstChild,o=r.getEdgeChildNodes(a,null).sc,o||(o=r.createTextNode(r.zeroWidthSpace),a.insertBefore(o,a.firstChild)),s=o.textContent.length,void this.setRange(o,s,o,s);if(r.isRangeFormatElement(n)&&n.childNodes.length<=1){let e=null;return 1===n.childNodes.length&&r.isBreak(n.firstChild)?e=n.firstChild:(e=r.createTextNode(r.zeroWidthSpace),n.appendChild(e)),void this.setRange(e,1,e,1)}if(this.execCommand("formatBlock",!1,e||"P"),o=r.getEdgeChildNodes(n,n),o=o?o.ec:n,a=r.getFormatElement(o,null),!a)return this.removeRange(),void this._editorRange();if(r.isBreak(a.nextSibling)&&r.removeItem(a.nextSibling),r.isBreak(a.previousSibling)&&r.removeItem(a.previousSibling),r.isBreak(o)){const e=r.createTextNode(r.zeroWidthSpace);o.parentNode.insertBefore(e,o),o=e}this.effectNode=null,this.nativeFocus()}},_setOptionsInit:function(t,n){this.context=e=A(t.originElement,this._getConstructed(t),l),this._componentsInfoReset=!0,this._editorInit(!0,n)},_editorInit:function(t,n){this._init(t,n),u._addEvent(),this._setCharCount(),u._offStickyToolbar(),u.onResize_window(),e.element.toolbar.style.visibility="",this._checkComponents(),this._componentsInfoInit=!1,this._componentsInfoReset=!1,this.history.reset(!0),this._resourcesStateChange(),a.setTimeout((function(){"function"==typeof h.onload&&h.onload(d,t)}))},_getConstructed:function(e){return{_top:e.topArea,_relative:e.relative,_toolBar:e.toolbar,_menuTray:e._menuTray,_editorArea:e.editorArea,_wysiwygArea:e.wysiwygFrame,_codeArea:e.code,_placeholder:e.placeholder,_resizingBar:e.resizingBar,_navigation:e.navigation,_charCounter:e.charCounter,_charWrapper:e.charWrapper,_loading:e.loading,_lineBreaker:e.lineBreaker,_lineBreaker_t:e.lineBreaker_t,_lineBreaker_b:e.lineBreaker_b,_resizeBack:e.resizeBackground,_stickyDummy:e._stickyDummy,_arrow:e._arrow}}},u={_IEisComposing:!1,_lineBreakerBind:null,_responsiveCurrentSize:"default",_responsiveButtonSize:null,_responsiveButtons:null,_directionKeyCode:new a.RegExp("^(8|13|3[2-9]|40|46)$"),_nonTextKeyCode:new a.RegExp("^(8|13|1[6-9]|20|27|3[3-9]|40|45|46|11[2-9]|12[0-3]|144|145)$"),_historyIgnoreKeyCode:new a.RegExp("^(1[6-9]|20|27|3[3-9]|40|45|11[2-9]|12[0-3]|144|145)$"),_onButtonsCheck:new a.RegExp("^(STRONG|U|EM|DEL|SUB|SUP)$"),_frontZeroWidthReg:new a.RegExp(r.zeroWidthSpace+"+",""),_keyCodeShortcut:{65:"A",66:"B",83:"S",85:"U",73:"I",89:"Y",90:"Z",219:"[",221:"]"},_shortcutCommand:function(e,t){let n=null;switch(u._keyCodeShortcut[e]){case"A":n="selectAll";break;case"B":-1===l.shortcutsDisable.indexOf("bold")&&(n="STRONG");break;case"S":t&&-1===l.shortcutsDisable.indexOf("strike")&&(n="DEL");break;case"U":-1===l.shortcutsDisable.indexOf("underline")&&(n="U");break;case"I":-1===l.shortcutsDisable.indexOf("italic")&&(n="EM");break;case"Z":-1===l.shortcutsDisable.indexOf("undo")&&(n=t?"redo":"undo");break;case"Y":-1===l.shortcutsDisable.indexOf("undo")&&(n="redo");break;case"[":-1===l.shortcutsDisable.indexOf("indent")&&(n="outdent");break;case"]":-1===l.shortcutsDisable.indexOf("indent")&&(n="indent")}return!!n&&(d.commandHandler(d.commandMap[n],n),!0)},_applyTagEffects:function(){let t=d.getSelectionNode();if(t===d.effectNode)return;d.effectNode=t;const i=d.commandMap,o=this._onButtonsCheck,s=[],a=[],c=d.activePlugins,u=c.length;let h="";for(;t.firstChild;)t=t.firstChild;for(let e=t;!r.isWysiwygDiv(e)&&e;e=e.parentNode)if(1===e.nodeType&&!r.isBreak(e)){h=e.nodeName.toUpperCase(),a.push(h);for(let t,i=0;i0)&&(s.push("OUTDENT"),i.OUTDENT.removeAttribute("disabled")),-1===s.indexOf("INDENT")&&i.INDENT&&r.isListCell(e)&&!e.previousElementSibling&&(s.push("INDENT"),i.INDENT.setAttribute("disabled",!0))):o.test(h)&&(s.push(h),r.addClass(i[h],"active"))}for(let e in i)s.indexOf(e)>-1||!r.hasOwn(i,e)||(c.indexOf(e)>-1?n[e].active.call(d,null):i.OUTDENT&&/^OUTDENT$/i.test(e)?i.OUTDENT.setAttribute("disabled",!0):i.INDENT&&/^INDENT$/i.test(e)?i.INDENT.removeAttribute("disabled"):r.removeClass(i[e],"active"));d._variable.currentNodes=a.reverse(),d._variable.currentNodesMap=s,l.showPathLabel&&(e.element.navigation.textContent=d._variable.currentNodes.join(" > "))},_cancelCaptionEdit:function(){this.setAttribute("contenteditable",!1),this.removeEventListener("blur",u._cancelCaptionEdit)},_buttonsEventHandler:function(e){let t=e.target;if(d._bindControllersOff&&e.stopPropagation(),/^(input|textarea|select|option)$/i.test(t.nodeName)?d._antiBlur=!1:e.preventDefault(),r.getParentElement(t,".se-submenu"))e.stopPropagation(),d._notHideToolbar=!0;else{let n=t.getAttribute("data-command"),i=t.className;for(;!n&&!/se-menu-list/.test(i)&&!/sun-editor-common/.test(i);)t=t.parentNode,n=t.getAttribute("data-command"),i=t.className;n!==d._submenuName&&n!==d._containerName||e.stopPropagation()}},onClick_toolbar:function(e){let t=e.target,n=t.getAttribute("data-display"),i=t.getAttribute("data-command"),l=t.className;for(;t.parentNode&&!i&&!/se-menu-list/.test(l)&&!/se-toolbar/.test(l);)t=t.parentNode,i=t.getAttribute("data-command"),n=t.getAttribute("data-display"),l=t.className;(i||n)&&(t.disabled||(d.hasFocus||d.nativeFocus(),d._variable.isCodeView||d._editorRange(),d.actionCall(i,n,t)))},onMouseDown_wysiwyg:function(t){if(r.isNonEditable(e.element.wysiwyg))return;const n=r.getParentElement(t.target,r.isCell);if(n){const e=d.plugins.table;e&&n!==e._fixedCell&&!e._shift&&d.callPlugin("table",(function(){e.onTableCellMultiSelect.call(d,n,!1)}),null)}d._isBalloon&&u._hideToolbar(),/FIGURE/i.test(t.target.nodeName)&&t.preventDefault(),"function"==typeof h.onMouseDown&&h.onMouseDown(t,d)},onClick_wysiwyg:function(t){const n=t.target;if(r.isNonEditable(e.element.wysiwyg))return;const i=d.getFileComponent(n);if(i)return t.preventDefault(),void d.selectComponent(i.target,i.pluginName);const l=r.getParentElement(n,"FIGCAPTION");if(r.isNonEditable(l)&&(t.preventDefault(),l.setAttribute("contenteditable",!0),l.focus(),d._isInline&&!d._inlineToolbarAttr.isShow)){u._showToolbarInline();const e=function(){u._hideToolbar(),l.removeEventListener("blur",e)};l.addEventListener("blur",e)}a.setTimeout(d._editorRange.bind(d)),d._editorRange();const o=d.getSelectionNode(),s=r.getFormatElement(o,null),c=r.getRangeFormatElement(o,null);if(s&&s!==c||r.isNonEditable(n)||r.isList(c))u._applyTagEffects();else{const e=d.getRange();if(r.getFormatElement(e.startContainer)===r.getFormatElement(e.endContainer)){if(r.isList(c)){const e=r.createElement("LI"),t=o.nextElementSibling;e.appendChild(o),c.insertBefore(e,t)}else r.isWysiwygDiv(o)||r.isComponent(o)||r.isTable(o)&&!r.isCell(o)||d._setDefaultFormat(r.isRangeFormatElement(c)?"DIV":"P");t.preventDefault(),d.focus()}}d._isBalloon&&a.setTimeout(u._toggleToolbarBalloon),"function"==typeof h.onClick&&h.onClick(t,d)},_balloonDelay:null,_showToolbarBalloonDelay:function(){u._balloonDelay&&a.clearTimeout(u._balloonDelay),u._balloonDelay=a.setTimeout(function(){a.clearTimeout(this._balloonDelay),this._balloonDelay=null,this._showToolbarBalloon()}.bind(u),350)},_toggleToolbarBalloon:function(){d._editorRange();const e=d.getRange();d._bindControllersOff||!d._isBalloonAlways&&e.collapsed?u._hideToolbar():u._showToolbarBalloon(e)},_showToolbarBalloon:function(t){if(!d._isBalloon)return;const n=t||d.getRange(),i=e.element.toolbar,l=d.getSelection();let o;if(d._isBalloonAlways&&n.collapsed)o=!0;else if(l.focusNode===l.anchorNode)o=l.focusOffset0&&u._getPageBottomSpace()C&&(t=!1,y=!0),y&&(b=(t?n.top-m-g:n.bottom+g)-(n.noText?0:h)+d),i.style.left=a.Math.floor(v)+"px",i.style.top=a.Math.floor(b)+"px",t?(r.removeClass(e.element._arrow,"se-arrow-up"),r.addClass(e.element._arrow,"se-arrow-down"),e.element._arrow.style.top=m+"px"):(r.removeClass(e.element._arrow,"se-arrow-down"),r.addClass(e.element._arrow,"se-arrow-up"),e.element._arrow.style.top=-g+"px");const w=a.Math.floor(p/2+(f-v));e.element._arrow.style.left=(w+g>i.offsetWidth?i.offsetWidth-g:w";const e=f.attributes;for(;e[0];)f.removeAttribute(e[0].name);return d.nativeFocus(),!1}}if(f&&g.startContainer===g.endContainer&&3===c.nodeType&&!r.isFormatElement(c.parentNode)&&(g.collapsed?1===c.textContent.length:g.endOffset-g.startOffset===c.textContent.length)){t.preventDefault();let e=null,n=c.parentNode.previousSibling;const i=c.parentNode.nextSibling;n||(i?(n=i,e=0):(n=r.createElement("BR"),f.appendChild(n))),c.textContent="",r.removeItemAllParents(c,null,f),e="number"==typeof e?e:3===n.nodeType?n.textContent.length:1,d.setRange(n,e,n,e);break}const n=g.commonAncestorContainer;if(f=r.getFormatElement(g.startContainer,null),_=r.getRangeFormatElement(f,null),_&&f&&!r.isCell(_)&&!/^FIGCAPTION$/i.test(_.nodeName)){if(r.isListCell(f)&&r.isList(_)&&(r.isListCell(_.parentNode)||f.previousElementSibling)&&(c===f||3===c.nodeType&&(!c.previousSibling||r.isList(c.previousSibling)))&&(r.getFormatElement(g.startContainer,null)!==r.getFormatElement(g.endContainer,null)?_.contains(g.startContainer):0===g.startOffset&&g.collapsed)){if(g.startContainer!==g.endContainer)t.preventDefault(),d.removeNode(),3===g.startContainer.nodeType&&d.setRange(g.startContainer,g.startContainer.textContent.length,g.startContainer,g.startContainer.textContent.length),d.history.push(!0);else{let e=f.previousElementSibling||_.parentNode;if(r.isListCell(e)){t.preventDefault();let n=e;if(!e.contains(f)&&r.isListCell(n)&&r.isList(n.lastElementChild)){for(n=n.lastElementChild.lastElementChild;r.isListCell(n)&&r.isList(n.lastElementChild);)n=n.lastElementChild&&n.lastElementChild.lastElementChild;e=n}let i=e===_.parentNode?_.previousSibling:e.lastChild;i||(i=r.createTextNode(r.zeroWidthSpace),_.parentNode.insertBefore(i,_.parentNode.firstChild));const l=3===i.nodeType?i.textContent.length:1,o=f.childNodes;let s=i,a=o[0];for(;a=o[0];)e.insertBefore(a,s.nextSibling),s=a;r.removeItem(f),0===_.children.length&&r.removeItem(_),d.setRange(i,l,i,l),d.history.push(!0)}}break}if(!p&&0===g.startOffset){let e=!0,i=n;for(;i&&i!==_&&!r.isWysiwygDiv(i);){if(i.previousSibling&&(1===i.previousSibling.nodeType||!r.onlyZeroWidthSpace(i.previousSibling.textContent.trim()))){e=!1;break}i=i.parentNode}if(e&&_.parentNode){t.preventDefault(),d.detachRangeFormatElement(_,r.isListCell(f)?[f]:null,null,!1,!1),d.history.push(!0);break}}}if(!p&&(0===g.startOffset||c===f&&f.childNodes[g.startOffset])){const e=c===f?f.childNodes[g.startOffset]:c,i=(3===n.nodeType||r.isBreak(n))&&!n.previousSibling&&0===g.startOffset;if(!e.previousSibling&&(r.isComponent(n.previousSibling)||i&&r.isComponent(f.previousSibling))){const e=d.getFileComponent(f.previousSibling);e&&(t.preventDefault(),t.stopPropagation(),0===f.textContent.length&&r.removeItem(f),d.selectComponent(e.target,e.pluginName));break}if(r.isNonEditable(e.previousSibling)){t.preventDefault(),t.stopPropagation(),r.removeItem(e.previousSibling);break}}break;case 46:if(m){t.preventDefault(),t.stopPropagation(),d.plugins[m].destroy.call(d);break}if(p&&u._hardDelete()){t.preventDefault(),t.stopPropagation();break}if((r.isFormatElement(c)||null===c.nextSibling||r.onlyZeroWidthSpace(c.nextSibling)&&null===c.nextSibling.nextSibling)&&g.startOffset===c.textContent.length){let e=f.nextElementSibling;if(!e){t.preventDefault();break}if(r.isComponent(e)){if(t.preventDefault(),r.onlyZeroWidthSpace(f)&&(r.removeItem(f),r.isTable(e))){let t=r.getChildElement(e,r.isCell,!1);t=t.firstElementChild||t,d.setRange(t,0,t,0);break}const n=d.getFileComponent(e);n&&(t.stopPropagation(),d.selectComponent(n.target,n.pluginName));break}}if(!p&&(d.isEdgePoint(g.endContainer,g.endOffset)||c===f&&f.childNodes[g.startOffset])){const e=c===f?f.childNodes[g.startOffset]:c;if(r.isNonEditable(e.nextSibling)){t.preventDefault(),t.stopPropagation(),r.removeItem(e.nextSibling);break}}if(f=r.getFormatElement(g.startContainer,null),_=r.getRangeFormatElement(f,null),r.isListCell(f)&&r.isList(_)&&(c===f||3===c.nodeType&&(!c.nextSibling||r.isList(c.nextSibling))&&(r.getFormatElement(g.startContainer,null)!==r.getFormatElement(g.endContainer,null)?_.contains(g.endContainer):g.endOffset===c.textContent.length&&g.collapsed))){g.startContainer!==g.endContainer&&d.removeNode();let e=r.getArrayItem(f.children,r.isList,!1);if(e=e||f.nextElementSibling||_.parentNode.nextElementSibling,e&&(r.isList(e)||r.getArrayItem(e.children,r.isList,!1))){let n,i;if(t.preventDefault(),r.isList(e)){const t=e.firstElementChild;for(i=t.childNodes,n=i[0];i[0];)f.insertBefore(i[0],e);r.removeItem(t)}else{for(n=e.firstChild,i=e.childNodes;i[0];)f.appendChild(i[0]);r.removeItem(e)}d.setRange(n,0,n,0),d.history.push(!0)}break}break;case 9:if(m||l.tabDisable)break;if(t.preventDefault(),o||s||r.isWysiwygDiv(c))break;const b=!g.collapsed||d.isEdgePoint(g.startContainer,g.startOffset),v=d.getSelectedElements(null);c=d.getSelectionNode();const y=[];let C=[],w=r.isListCell(v[0]),x=r.isListCell(v[v.length-1]),E={sc:g.startContainer,so:g.startOffset,ec:g.endContainer,eo:g.endOffset};for(let e,t=0,n=v.length;t0&&b&&d.plugins.list)E=d.plugins.list.editInsideList.call(d,i,y);else{const e=r.getParentElement(c,r.isCell);if(e&&b){const t=r.getParentElement(e,"table"),n=r.getListChildren(t,r.isCell);let l=i?r.prevIdx(n,e):r.nextIdx(n,e);l!==n.length||i||(l=0),-1===l&&i&&(l=n.length-1);let o=n[l];if(!o)break;o=o.firstElementChild||o,d.setRange(o,0,o,0);break}C=C.concat(y),w=x=null}if(C.length>0)if(i){const e=C.length-1;for(let t,n=0;n<=e;n++){t=C[n].childNodes;for(let e,n=0,i=t.length;n":"<"+f.nodeName+">
    ",!d.checkCharCount(e,"byte-html"))return t.preventDefault(),!1}if(!i&&S){t.preventDefault();const e=c===S,n=d.getSelection(),i=c.childNodes,l=n.focusOffset,o=c.previousElementSibling,s=c.nextSibling;if(!r.isClosureFreeFormatElement(S)&&i&&(e&&g.collapsed&&i.length-1<=l+1&&r.isBreak(i[l])&&(!i[l+1]||(!i[l+2]||r.onlyZeroWidthSpace(i[l+2].textContent))&&3===i[l+1].nodeType&&r.onlyZeroWidthSpace(i[l+1].textContent))&&l>0&&r.isBreak(i[l-1])||!e&&r.onlyZeroWidthSpace(c.textContent)&&r.isBreak(o)&&(r.isBreak(o.previousSibling)||!r.onlyZeroWidthSpace(o.previousSibling.textContent))&&(!s||!r.isBreak(s)&&r.onlyZeroWidthSpace(s.textContent)))){e?r.removeItem(i[l-1]):r.removeItem(c);const t=d.appendFormatTag(S,r.isFormatElement(S.nextElementSibling)?S.nextElementSibling:null);r.copyFormatAttributes(t,S),d.setRange(t,1,t,1);break}if(e){h.insertHTML(g.collapsed&&r.isBreak(g.startContainer.childNodes[g.startOffset-1])?"
    ":"

    ",!0,!1);let e=n.focusNode;const t=n.focusOffset;S===e&&(e=e.childNodes[t-l>1?t-1:t]),d.setRange(e,1,e,1)}else{const e=n.focusNode.nextSibling,t=r.createElement("BR");d.insertNode(t,null,!1);const i=t.previousSibling,l=t.nextSibling;r.isBreak(e)||r.isBreak(i)||l&&!r.onlyZeroWidthSpace(l)?d.setRange(l,0,l,0):(t.parentNode.insertBefore(t.cloneNode(!1),t),d.setRange(t,1,t,1))}u._onShortcutKey=!0;break}if(p)break;if(_&&f&&!r.isCell(_)&&!/^FIGCAPTION$/i.test(_.nodeName)){const e=d.getRange();if(d.isEdgePoint(e.endContainer,e.endOffset)&&r.isList(c.nextSibling)){t.preventDefault();const e=r.createElement("LI"),n=r.createElement("BR");e.appendChild(n),f.parentNode.insertBefore(e,f.nextElementSibling),e.appendChild(c.nextSibling),d.setRange(n,1,n,1);break}if((3!==e.commonAncestorContainer.nodeType||!e.commonAncestorContainer.nextElementSibling)&&r.onlyZeroWidthSpace(f.innerText.trim())){t.preventDefault();let e=null;if(r.isListCell(_.parentNode)){if(_=f.parentNode.parentNode.parentNode,e=r.splitElement(f,null,r.getElementDepth(f)-2),!e){const t=r.createElement("LI");t.innerHTML="
    ",_.insertBefore(t,e),e=t}}else{const t=r.isCell(_.parentNode)?"DIV":r.isList(_.parentNode)?"LI":r.isFormatElement(_.nextElementSibling)?_.nextElementSibling.nodeName:r.isFormatElement(_.previousElementSibling)?_.previousElementSibling.nodeName:"P";e=r.createElement(t);const n=d.detachRangeFormatElement(_,[f],null,!0,!0);n.cc.insertBefore(e,n.ec)}e.innerHTML="
    ",r.copyFormatAttributes(e,f),r.removeItemAllParents(f,null,null),d.setRange(e,1,e,1);break}}if(_&&r.getParentElement(_,"FIGCAPTION")&&r.getParentElement(_,r.isList)&&(t.preventDefault(),f=d.appendFormatTag(f,null),d.setRange(f,0,f,0)),m){t.preventDefault(),t.stopPropagation();const n=e[m],i=n._container,l=i.previousElementSibling||i.nextElementSibling;let o=null;r.isListCell(i.parentNode)?o=r.createElement("BR"):(o=r.createElement(r.isFormatElement(l)?l.nodeName:"P"),o.innerHTML="
    "),i.parentNode.insertBefore(o,i),d.callPlugin(m,(function(){d.selectComponent(n._element,m)}),null)}break;case 27:if(m)return t.preventDefault(),t.stopPropagation(),d.controllersOff(),!1}if(i&&/16/.test(n)){t.preventDefault(),t.stopPropagation();const e=d.plugins.table;if(e&&!e._shift&&!e._ref){const t=r.getParentElement(f,r.isCell);if(t)return void e.onTableCellMultiSelect.call(d,t,!0)}}if(!(o||s||p||u._nonTextKeyCode.test(n))&&g.collapsed&&g.startContainer===g.endContainer&&r.isBreak(g.commonAncestorContainer)){const e=r.createTextNode(r.zeroWidthSpace);d.insertNode(e,null,!1),d.setRange(e,1,e,1)}"function"==typeof h.onKeyDown&&h.onKeyDown(t,d)},onKeyUp_wysiwyg:function(e){if(u._onShortcutKey)return;d._editorRange();const t=d.getRange(),n=e.keyCode,i=e.ctrlKey||e.metaKey||91===n||92===n||224===n,l=e.altKey;let o=d.getSelectionNode();if(d._isBalloon&&(d._isBalloonAlways&&27!==n||!t.collapsed)){if(!d._isBalloonAlways)return void u._showToolbarBalloon();27!==n&&u._showToolbarBalloonDelay()}if(8===n&&r.isWysiwygDiv(o)&&""===o.textContent&&0===o.children.length){e.preventDefault(),e.stopPropagation(),o.innerHTML="";const t=r.createElement(r.isFormatElement(d._variable.currentNodes[0])?d._variable.currentNodes[0]:"P");return t.innerHTML="
    ",o.appendChild(t),d.setRange(t,0,t,0),u._applyTagEffects(),void d.history.push(!1)}const s=r.getFormatElement(o,null),a=r.getRangeFormatElement(o,null);(s||!t.collapsed)&&s!==a||r.isComponent(o)||r.isList(o)||(d._setDefaultFormat(r.isRangeFormatElement(a)?"DIV":"P"),o=d.getSelectionNode()),u._directionKeyCode.test(n)&&u._applyTagEffects();if(!i&&!l&&!u._nonTextKeyCode.test(n)&&3===o.nodeType&&r.zeroWidthRegExp.test(o.textContent)&&!(void 0!==e.isComposing?e.isComposing:u._IEisComposing)){let e=t.startOffset,n=t.endOffset;const i=(o.textContent.substring(0,n).match(u._frontZeroWidthReg)||"").length;e=t.startOffset-i,n=t.endOffset-i,o.textContent=o.textContent.replace(r.zeroWidthRegExp,""),d.setRange(o,e<0?0:e,o,n<0?0:n)}d._charCount(""),d.history.push(!0),"function"==typeof h.onKeyUp&&h.onKeyUp(e,d)},onScroll_wysiwyg:function(e){d.controllersOff(),d._lineBreaker.style.display="none",d._isBalloon&&u._hideToolbar(),"function"==typeof h.onScroll&&h.onScroll(e,d)},onFocus_wysiwyg:function(e){d._antiBlur||(d.hasFocus=!0,d._isInline&&u._showToolbarInline(),"function"==typeof h.onFocus&&h.onFocus(e,d))},onBlur_wysiwyg:function(t){if(d._antiBlur)return;d.hasFocus=!1,d.controllersOff(),(d._isInline||d._isBalloon)&&u._hideToolbar(),"function"==typeof h.onBlur&&h.onBlur(t,d);const i=d.commandMap,o=d.activePlugins;for(let e in i)r.hasOwn(i,e)&&(o.indexOf(e)>-1?n[e].active.call(d,null):i.OUTDENT&&/^OUTDENT$/i.test(e)?i.OUTDENT.setAttribute("disabled",!0):i.INDENT&&/^INDENT$/i.test(e)?i.INDENT.removeAttribute("disabled"):r.removeClass(i[e],"active"));d._variable.currentNodes=[],d._variable.currentNodesMap=[],l.showPathLabel&&(e.element.navigation.textContent="")},onMouseDown_resizingBar:function(t){t.stopPropagation(),d._variable.resizeClientY=t.clientY,e.element.resizeBackground.style.display="block",s.addEventListener("mousemove",u._resize_editor),s.addEventListener("mouseup",(function t(){e.element.resizeBackground.style.display="none",s.removeEventListener("mousemove",u._resize_editor),s.removeEventListener("mouseup",t)}))},_resize_editor:function(t){const n=e.element.editorArea.offsetHeight+(t.clientY-d._variable.resizeClientY);e.element.wysiwygFrame.style.height=e.element.code.style.height=(n=n+o?(d._sticky||u._onStickyToolbar(),t.toolbar.style.top=n+o+l.stickyToolbar-i-d._variable.minResizingSize+"px"):i>=o&&u._onStickyToolbar()},_getEditorOffsets:function(t){let n=t||e.element.topArea,i=0,l=0,o=0;for(;n;)i+=n.offsetTop,l+=n.offsetLeft,o+=n.scrollTop,n=n.offsetParent;return{top:i,left:l,scroll:o}},_getPageBottomSpace:function(){return s.documentElement.scrollHeight-(u._getEditorOffsets(null).top+e.element.topArea.offsetHeight)},_onStickyToolbar:function(){const t=e.element;d._isInline||l.toolbarContainer||(t._stickyDummy.style.height=t.toolbar.offsetHeight+"px",t._stickyDummy.style.display="block"),t.toolbar.style.top=l.stickyToolbar+"px",t.toolbar.style.width=d._isInline?d._inlineToolbarAttr.width:t.toolbar.offsetWidth+"px",r.addClass(t.toolbar,"se-toolbar-sticky"),d._sticky=!0},_offStickyToolbar:function(){const t=e.element;t._stickyDummy.style.display="none",t.toolbar.style.top=d._isInline?d._inlineToolbarAttr.top:"",t.toolbar.style.width=d._isInline?d._inlineToolbarAttr.width:"",t.editorArea.style.marginTop="",r.removeClass(t.toolbar,"se-toolbar-sticky"),d._sticky=!1},_codeViewAutoHeight:function(){e.element.code.style.height=e.element.code.scrollHeight+"px"},_hardDelete:function(){const e=d.getRange(),t=e.startContainer,n=e.endContainer,i=r.getRangeFormatElement(t),l=r.getRangeFormatElement(n),o=r.isCell(i),s=r.isCell(l);if((o&&!i.previousElementSibling&&!i.parentElement.previousElementSibling||s&&!l.nextElementSibling&&!l.parentElement.nextElementSibling)&&i!==l)if(o){if(s)return r.removeItem(r.getParentElement(i,r.isComponent)),d.nativeFocus(),!0;r.removeItem(r.getParentElement(i,r.isComponent))}else r.removeItem(r.getParentElement(l,r.isComponent));const a=1===t.nodeType?r.getParentElement(t,".se-component"):null,c=1===n.nodeType?r.getParentElement(n,".se-component"):null;return a&&r.removeItem(a),c&&r.removeItem(c),!1},onPaste_wysiwyg:function(e){const t=r.isIE?a.clipboardData:e.clipboardData;return!t||u._dataTransferAction("paste",e,t)},_setClipboardComponent:function(e,t,n){e.preventDefault(),e.stopPropagation(),n.setData("text/html",t.component.outerHTML)},onCopy_wysiwyg:function(e){const t=r.isIE?a.clipboardData:e.clipboardData;if("function"==typeof h.onCopy&&!h.onCopy(e,t,d))return e.preventDefault(),e.stopPropagation(),!1;const n=d.currentFileComponentInfo;n&&!r.isIE&&(u._setClipboardComponent(e,n,t),r.addClass(n.component,"se-component-copy"),a.setTimeout((function(){r.removeClass(n.component,"se-component-copy")}),150))},onCut_wysiwyg:function(e){const t=r.isIE?a.clipboardData:e.clipboardData;if("function"==typeof h.onCut&&!h.onCut(e,t,d))return e.preventDefault(),e.stopPropagation(),!1;const n=d.currentFileComponentInfo;n&&!r.isIE&&(u._setClipboardComponent(e,n,t),r.removeItem(n.component),d.controllersOff()),a.setTimeout((function(){d.history.push(!1)}))},onDrop_wysiwyg:function(e){const t=e.dataTransfer;return!t||(r.isIE?(e.preventDefault(),e.stopPropagation(),!1):(d.removeNode(),u._setDropLocationSelection(e),u._dataTransferAction("drop",e,t)))},_setDropLocationSelection:function(e){if(e.rangeParent)d.setRange(e.rangeParent,e.rangeOffset,e.rangeParent,e.rangeOffset);else if(d._wd.caretRangeFromPoint){const t=d._wd.caretRangeFromPoint(e.clientX,e.clientY);d.setRange(t.startContainer,t.startOffset,t.endContainer,t.endOffset)}else{const e=d.getRange();d.setRange(e.startContainer,e.startOffset,e.endContainer,e.endOffset)}},_dataTransferAction:function(t,n,i){let l,o;if(r.isIE){l=i.getData("Text");const s=d.getRange(),c=r.createElement("DIV"),h={sc:s.startContainer,so:s.startOffset,ec:s.endContainer,eo:s.endOffset};return c.setAttribute("contenteditable",!0),c.style.cssText="position:absolute; top:0; left:0; width:1px; height:1px; overflow:hidden;",e.element.relative.appendChild(c),c.focus(),a.setTimeout((function(){o=c.innerHTML,r.removeItem(c),d.setRange(h.sc,h.so,h.ec,h.eo),u._setClipboardData(t,n,l,o,i)})),!0}if(l=i.getData("text/plain"),o=i.getData("text/html"),!1===u._setClipboardData(t,n,l,o,i))return n.preventDefault(),n.stopPropagation(),!1},_setClipboardData:function(e,t,n,i,l){/class=["']*Mso(Normal|List)/i.test(i)||/content=["']*Word.Document/i.test(i)||/content=["']*OneNote.File/i.test(i)?(i=i.replace(/\n/g," "),n=n.replace(/\n/g," ")):n=n.replace(/\n/g,""),i=d.cleanHTML(i,d.pasteTagsWhitelistRegExp);const o=d._charCount(d._charTypeHTML?i:n);if("paste"===e&&"function"==typeof h.onPaste&&!h.onPaste(t,i,o,d))return!1;if("drop"===e&&"function"==typeof h.onDrop&&!h.onDrop(t,l,d))return!1;const s=l.files;return s.length>0?(/^image/.test(s[0].type)&&d.plugins.image&&h.insertImage(s),!1):!!o&&(i?(h.insertHTML(i,!0,!1),!1):void 0)},onMouseMove_wysiwyg:function(t){if(d.isDisabled)return;const n=r.getParentElement(t.target,r.isComponent),i=d._lineBreaker.style;if(n&&!d.currentControllerName){let o=0,s=e.element.wysiwyg;do{o+=s.scrollTop,s=s.parentElement}while(s&&!/^(BODY|HTML)$/i.test(s.nodeName));const a=e.element.wysiwyg.scrollTop,c=u._getEditorOffsets(null),h=r.getOffset(n,e.element.wysiwygFrame).top+a,g=t.pageY+o+(l.iframe&&!l.toolbarContainer?e.element.toolbar.offsetHeight:0),p=h+(l.iframe?o:c.top),m=r.isListCell(n.parentNode);let f="",_="";if((m?!n.previousSibling:!r.isFormatElement(n.previousElementSibling))&&gp+n.offsetHeight-20))return void(i.display="none");_=h+n.offsetHeight,f="b"}d._variable._lineBreakComp=n,d._variable._lineBreakDir=f,i.top=_-a+"px",d._lineBreakerButton.style.left=r.getOffset(n).left+n.offsetWidth/2-15+"px",i.display="block"}else"none"!==i.display&&(i.display="none")},_onMouseDown_lineBreak:function(e){e.preventDefault()},_onLineBreak:function(e){e.preventDefault();const t=d._variable._lineBreakComp,n=this?this:d._variable._lineBreakDir,i=r.isListCell(t.parentNode),l=r.createElement(i?"BR":r.isCell(t.parentNode)?"DIV":"P");if(i||(l.innerHTML="
    "),d._charTypeHTML&&!d.checkCharCount(l.outerHTML,"byte-html"))return;t.parentNode.insertBefore(l,"t"===n?t:t.nextSibling),d._lineBreaker.style.display="none",d._variable._lineBreakComp=null;const o=i?l:l.firstChild;d.setRange(o,1,o,1),d.history.push(!1)},_addEvent:function(){const t=l.iframe?d._ww:e.element.wysiwyg;e.element.toolbar.addEventListener("mousedown",u._buttonsEventHandler,!1),e.element._menuTray.addEventListener("mousedown",u._buttonsEventHandler,!1),e.element.toolbar.addEventListener("click",u.onClick_toolbar,!1),t.addEventListener("mousedown",u.onMouseDown_wysiwyg,!1),t.addEventListener("click",u.onClick_wysiwyg,!1),t.addEventListener(r.isIE?"textinput":"input",u.onInput_wysiwyg,!1),t.addEventListener("keydown",u.onKeyDown_wysiwyg,!1),t.addEventListener("keyup",u.onKeyUp_wysiwyg,!1),t.addEventListener("paste",u.onPaste_wysiwyg,!1),t.addEventListener("copy",u.onCopy_wysiwyg,!1),t.addEventListener("cut",u.onCut_wysiwyg,!1),t.addEventListener("drop",u.onDrop_wysiwyg,!1),t.addEventListener("scroll",u.onScroll_wysiwyg,!1),t.addEventListener("focus",u.onFocus_wysiwyg,!1),t.addEventListener("blur",u.onBlur_wysiwyg,!1),u._lineBreakerBind={a:u._onLineBreak.bind(""),t:u._onLineBreak.bind("t"),b:u._onLineBreak.bind("b")},t.addEventListener("mousemove",u.onMouseMove_wysiwyg,!1),d._lineBreakerButton.addEventListener("mousedown",u._onMouseDown_lineBreak,!1),d._lineBreakerButton.addEventListener("click",u._lineBreakerBind.a,!1),e.element.lineBreaker_t.addEventListener("mousedown",u._lineBreakerBind.t,!1),e.element.lineBreaker_b.addEventListener("mousedown",u._lineBreakerBind.b,!1),d.plugins.table&&t.addEventListener("touchstart",u.onMouseDown_wysiwyg,{passive:!0,useCapture:!1}),"auto"!==l.height||l.codeMirrorEditor||(e.element.code.addEventListener("keydown",u._codeViewAutoHeight,!1),e.element.code.addEventListener("keyup",u._codeViewAutoHeight,!1),e.element.code.addEventListener("paste",u._codeViewAutoHeight,!1)),e.element.resizingBar&&(/\d+/.test(l.height)?e.element.resizingBar.addEventListener("mousedown",u.onMouseDown_resizingBar,!1):r.addClass(e.element.resizingBar,"se-resizing-none")),u._setResponsiveToolbar(),a.removeEventListener("resize",u.onResize_window),a.removeEventListener("scroll",u.onScroll_window),a.addEventListener("resize",u.onResize_window,!1),l.stickyToolbar>-1&&a.addEventListener("scroll",u.onScroll_window,!1)},_removeEvent:function(){const t=l.iframe?d._ww:e.element.wysiwyg;e.element.toolbar.removeEventListener("mousedown",u._buttonsEventHandler),e.element._menuTray.removeEventListener("mousedown",u._buttonsEventHandler),e.element.toolbar.removeEventListener("click",u.onClick_toolbar),t.removeEventListener("mousedown",u.onMouseDown_wysiwyg),t.removeEventListener("click",u.onClick_wysiwyg),t.removeEventListener(r.isIE?"textinput":"input",u.onInput_wysiwyg),t.removeEventListener("keydown",u.onKeyDown_wysiwyg),t.removeEventListener("keyup",u.onKeyUp_wysiwyg),t.removeEventListener("paste",u.onPaste_wysiwyg),t.removeEventListener("copy",u.onCopy_wysiwyg),t.removeEventListener("cut",u.onCut_wysiwyg),t.removeEventListener("drop",u.onDrop_wysiwyg),t.removeEventListener("scroll",u.onScroll_wysiwyg),t.removeEventListener("mousemove",u.onMouseMove_wysiwyg),d._lineBreakerButton.removeEventListener("mousedown",u._onMouseDown_lineBreak),d._lineBreakerButton.removeEventListener("click",u._lineBreakerBind.a),e.element.lineBreaker_t.removeEventListener("mousedown",u._lineBreakerBind.t),e.element.lineBreaker_b.removeEventListener("mousedown",u._lineBreakerBind.b),u._lineBreakerBind=null,t.removeEventListener("touchstart",u.onMouseDown_wysiwyg,{passive:!0,useCapture:!1}),t.removeEventListener("focus",u.onFocus_wysiwyg),t.removeEventListener("blur",u.onBlur_wysiwyg),e.element.code.removeEventListener("keydown",u._codeViewAutoHeight),e.element.code.removeEventListener("keyup",u._codeViewAutoHeight),e.element.code.removeEventListener("paste",u._codeViewAutoHeight),e.element.resizingBar&&e.element.resizingBar.removeEventListener("mousedown",u.onMouseDown_resizingBar),a.removeEventListener("resize",u.onResize_window),a.removeEventListener("scroll",u.onScroll_window)},_setResponsiveToolbar:function(){if(0===o.length)return void(o=null);const e=u._responsiveButtonSize=["default"],t=u._responsiveButtons={default:o[0]};for(let n,i,l=1,s=o.length;l",e}};return void 0===t&&(e.SUNEDITOR_MODULES||Object.defineProperty(e,"SUNEDITOR_MODULES",{enumerable:!0,writable:!1,configurable:!1,value:{}}),Object.defineProperty(e.SUNEDITOR_MODULES,"component",{enumerable:!0,writable:!1,configurable:!1,value:n})),n},"object"==typeof e.exports?e.exports=i.document?l(i,!0):function(e){if(!e.document)throw new Error("SUNEDITOR_MODULES a window with a document");return l(e)}:l(i)},ee5k:function(e,t,n){"use strict";var i,l;i="undefined"!=typeof window?window:this,l=function(e,t){const n={name:"resizing",add:function(e){const t=e.icons,n=e.context;n.resizing={_resizeClientX:0,_resizeClientY:0,_resize_plugin:"",_resize_w:0,_resize_h:0,_origin_w:0,_origin_h:0,_rotateVertical:!1,_resize_direction:"",_move_path:null,_isChange:!1,alignIcons:{basic:t.align_justify,left:t.align_left,right:t.align_right,center:t.align_center}};let i=this.setController_resize.call(e);n.resizing.resizeContainer=i,n.resizing.resizeDiv=i.querySelector(".se-modal-resize"),n.resizing.resizeDot=i.querySelector(".se-resize-dot"),n.resizing.resizeDisplay=i.querySelector(".se-resize-display");let l=this.setController_button.call(e);n.resizing.resizeButton=l;let o=n.resizing.resizeHandles=n.resizing.resizeDot.querySelectorAll("span");n.resizing.resizeButtonGroup=l.querySelector("._se_resizing_btn_group"),n.resizing.rotationButtons=l.querySelectorAll("._se_resizing_btn_group ._se_rotation"),n.resizing.percentageButtons=l.querySelectorAll("._se_resizing_btn_group ._se_percentage"),n.resizing.alignMenu=l.querySelector(".se-resizing-align-list"),n.resizing.alignMenuList=n.resizing.alignMenu.querySelectorAll("button"),n.resizing.alignButton=l.querySelector("._se_resizing_align_button"),n.resizing.autoSizeButton=l.querySelector("._se_resizing_btn_group ._se_auto_size"),n.resizing.captionButton=l.querySelector("._se_resizing_caption_button"),i.addEventListener("mousedown",(function(e){e.preventDefault()})),l.addEventListener("mousedown",e.eventStop),o[0].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),o[1].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),o[2].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),o[3].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),o[4].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),o[5].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),o[6].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),o[7].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),l.addEventListener("click",this.onClick_resizeButton.bind(e)),n.element.relative.appendChild(i),n.element.relative.appendChild(l),i=null,l=null,o=null},setController_resize:function(){const e=this.util.createElement("DIV");return e.className="se-controller se-resizing-container",e.style.display="none",e.innerHTML='
    ',e},setController_button:function(){const e=this.lang,t=this.icons,n=this.util.createElement("DIV");return n.className="se-controller se-controller-resizing",n.innerHTML='
    ",n},_module_getSizeX:function(e,t,n,i){return t||(t=e._element),n||(n=e._cover),i||(i=e._container),t?/%$/.test(t.style.width)?(i&&this.util.getNumber(i.style.width,2)||100)+"%":t.style.width:""},_module_getSizeY:function(e,t,n,i){return t||(t=e._element),n||(n=e._cover),i||(i=e._container),i&&n?this.util.getNumber(n.style.paddingBottom,0)>0&&!this.context.resizing._rotateVertical?n.style.height:/%$/.test(t.style.height)&&/%$/.test(t.style.width)?(i&&this.util.getNumber(i.style.height,2)||100)+"%":t.style.height:t&&t.style.height||""},_module_setModifyInputSize:function(e,t){const n=e._onlyPercentage&&this.context.resizing._rotateVertical;e.proportion.checked=e._proportionChecked="false"!==e._element.getAttribute("data-proportion");let i=n?"":this.plugins.resizing._module_getSizeX.call(this,e);if(i===e._defaultSizeX&&(i=""),e._onlyPercentage&&(i=this.util.getNumber(i,2)),e.inputX.value=i,t.setInputSize.call(this,"x"),!e._onlyPercentage){let t=n?"":this.plugins.resizing._module_getSizeY.call(this,e);t===e._defaultSizeY&&(t=""),e._onlyPercentage&&(t=this.util.getNumber(t,2)),e.inputY.value=t}e.inputX.disabled=!!n,e.inputY.disabled=!!n,e.proportion.disabled=!!n,t.setRatio.call(this)},_module_setInputSize:function(e,t){if(e._onlyPercentage)"x"===t&&e.inputX.value>100&&(e.inputX.value=100);else if(e.proportion.checked&&e._ratio&&/\d/.test(e.inputX.value)&&/\d/.test(e.inputY.value)){const n=e.inputX.value.replace(/\d+|\./g,"")||e.sizeUnit,i=e.inputY.value.replace(/\d+|\./g,"")||e.sizeUnit;if(n!==i)return;const l="%"===n?2:0;"x"===t?e.inputY.value=this.util.getNumber(e._ratioY*this.util.getNumber(e.inputX.value,l),l)+i:e.inputX.value=this.util.getNumber(e._ratioX*this.util.getNumber(e.inputY.value,l),l)+n}},_module_setRatio:function(e){const t=e.inputX.value,n=e.inputY.value;if(e.proportion.checked&&/\d+/.test(t)&&/\d+/.test(n)){if((t.replace(/\d+|\./g,"")||e.sizeUnit)!==(n.replace(/\d+|\./g,"")||e.sizeUnit))e._ratio=!1;else if(!e._ratio){const i=this.util.getNumber(t,0),l=this.util.getNumber(n,0);e._ratio=!0,e._ratioX=i/l,e._ratioY=l/i}}else e._ratio=!1},_module_sizeRevert:function(e){e._onlyPercentage?e.inputX.value=e._origin_w>100?100:e._origin_w:(e.inputX.value=e._origin_w,e.inputY.value=e._origin_h)},_module_saveCurrentSize:function(e){const t=this.plugins.resizing._module_getSizeX.call(this,e),n=this.plugins.resizing._module_getSizeY.call(this,e);e._element.setAttribute("data-size",t+","+n),e._videoRatio&&(e._videoRatio=n)},call_controller_resize:function(e,t){const n=this.context.resizing,i=this.context[t];n._resize_plugin=t;const l=n.resizeContainer,o=n.resizeDiv,s=this.util.getOffset(e,this.context.element.wysiwygFrame),a=n._rotateVertical=/^(90|270)$/.test(Math.abs(e.getAttribute("data-rotate")).toString()),r=a?e.offsetHeight:e.offsetWidth,c=a?e.offsetWidth:e.offsetHeight,d=s.top,u=s.left-this.context.element.wysiwygFrame.scrollLeft;l.style.top=d+"px",l.style.left=u+"px",l.style.width=r+"px",l.style.height=c+"px",o.style.top="0px",o.style.left="0px",o.style.width=r+"px",o.style.height=c+"px";let h=e.getAttribute("data-align")||"basic";h="none"===h?"basic":h;const g=this.util.getParentElement(e,this.util.isComponent),p=this.util.getParentElement(e,"FIGURE"),m=this.plugins.resizing._module_getSizeX.call(this,i,e,p,g)||"auto",f=i._onlyPercentage&&"image"===t?"":", "+(this.plugins.resizing._module_getSizeY.call(this,i,e,p,g)||"auto");this.util.changeTxt(n.resizeDisplay,this.lang.dialogBox[h]+" ("+m+f+")"),n.resizeButtonGroup.style.display=i._resizing?"":"none";const _=!i._resizing||i._resizeDotHide||i._onlyPercentage?"none":"flex",b=n.resizeHandles;for(let e=0,t=b.length;e=360?0:d;s.setAttribute("data-rotate",u),c._rotateVertical=/^(90|270)$/.test(this._w.Math.abs(u).toString()),this.plugins.resizing.setTransformSize.call(this,s,null,null),this.selectComponent(s,l);break;case"onalign":return void this.plugins.resizing.openAlignMenu.call(this);case"align":const h="basic"===i?"none":i;a.setAlign.call(this,h,null,null,null),this.selectComponent(s,l);break;case"caption":const g=!o._captionChecked;if(a.openModify.call(this,!0),o._captionChecked=o.captionCheckEl.checked=g,a.update_image.call(this,!1,!1,!1),g){const e=this.util.getChildElement(o._caption,(function(e){return 3===e.nodeType}));e?this.setRange(e,0,e,e.textContent.length):o._caption.focus(),this.controllersOff()}else this.selectComponent(s,l),a.openModify.call(this,!0);break;case"revert":a.setOriginSize.call(this),this.selectComponent(s,l);break;case"update":a.openModify.call(this),this.controllersOff();break;case"delete":a.destroy.call(this)}this.history.push(!1)}},resetTransform:function(e){const t=(e.getAttribute("data-size")||e.getAttribute("data-origin")||"").split(",");this.context.resizing._rotateVertical=!1,e.style.maxWidth="",e.style.transform="",e.style.transformOrigin="",e.setAttribute("data-rotate",""),e.setAttribute("data-rotateX",""),e.setAttribute("data-rotateY",""),this.plugins[this.context.resizing._resize_plugin].setSize.call(this,t[0]?t[0]:"auto",t[1]?t[1]:"",!0)},setTransformSize:function(e,t,n){let i=e.getAttribute("data-percentage");const l=this.context.resizing._rotateVertical,o=1*e.getAttribute("data-rotate");let s="";if(i&&!l)i=i.split(","),"auto"===i[0]&&"auto"===i[1]?this.plugins[this.context.resizing._resize_plugin].setAutoSize.call(this):this.plugins[this.context.resizing._resize_plugin].setPercentSize.call(this,i[0],i[1]);else{const i=this.util.getParentElement(e,"FIGURE"),a=t||e.offsetWidth,r=n||e.offsetHeight,c=(l?r:a)+"px",d=(l?a:r)+"px";if(this.plugins[this.context.resizing._resize_plugin].cancelPercentAttr.call(this),this.plugins[this.context.resizing._resize_plugin].setSize.call(this,a+"px",r+"px",!0),i.style.width=c,i.style.height=this.context[this.context.resizing._resize_plugin]._caption?"":d,l){let e=a/2+"px "+a/2+"px 0",t=r/2+"px "+r/2+"px 0";s=90===o||-270===o?t:e}}e.style.transformOrigin=s,this.plugins.resizing._setTransForm(e,o.toString(),e.getAttribute("data-rotateX")||"",e.getAttribute("data-rotateY")||""),e.style.maxWidth=l?"none":"",this.plugins.resizing.setCaptionPosition.call(this,e)},_setTransForm:function(e,t,n,i){let l=(e.offsetWidth-e.offsetHeight)*(/-/.test(t)?1:-1),o="";if(/[1-9]/.test(t)&&(n||i))switch(o=n?"Y":"X",t){case"90":o=n&&i?"X":i?o:"";break;case"270":l*=-1,o=n&&i?"Y":n?o:"";break;case"-90":o=n&&i?"Y":n?o:"";break;case"-270":l*=-1,o=n&&i?"X":i?o:"";break;default:o=""}t%180==0&&(e.style.maxWidth=""),e.style.transform="rotate("+t+"deg)"+(n?" rotateX("+n+"deg)":"")+(i?" rotateY("+i+"deg)":"")+(o?" translate"+o+"("+l+"px)":"")},setCaptionPosition:function(e){const t=this.util.getChildElement(this.util.getParentElement(e,"FIGURE"),"FIGCAPTION");t&&(t.style.marginTop=(this.context.resizing._rotateVertical?e.offsetWidth-e.offsetHeight:0)+"px")},onMouseDown_resize_handle:function(e){e.stopPropagation(),e.preventDefault();const t=this.context.resizing,n=t._resize_direction=e.target.classList[0];t._resizeClientX=e.clientX,t._resizeClientY=e.clientY,this.context.element.resizeBackground.style.display="block",t.resizeButton.style.display="none",t.resizeDiv.style.float=/l/.test(n)?"right":/r/.test(n)?"left":"none";const i=function(e){if("keydown"===e.type&&27!==e.keyCode)return;const o=t._isChange;t._isChange=!1,this.removeDocEvent("mousemove",l),this.removeDocEvent("mouseup",i),this.removeDocEvent("keydown",i),"keydown"===e.type?(this.controllersOff(),this.context.element.resizeBackground.style.display="none",this.plugins[this.context.resizing._resize_plugin].init.call(this)):(this.plugins.resizing.cancel_controller_resize.call(this,n),o&&this.history.push(!1))}.bind(this),l=this.plugins.resizing.resizing_element.bind(this,t,n,this.context[t._resize_plugin]);this.addDocEvent("mousemove",l),this.addDocEvent("mouseup",i),this.addDocEvent("keydown",i)},resizing_element:function(e,t,n,i){const l=i.clientX,o=i.clientY;let s=n._element_w,a=n._element_h;const r=n._element_w+(/r/.test(t)?l-e._resizeClientX:e._resizeClientX-l),c=n._element_h+(/b/.test(t)?o-e._resizeClientY:e._resizeClientY-o),d=n._element_h/n._element_w*r;/t/.test(t)&&(e.resizeDiv.style.top=n._element_h-(/h/.test(t)?c:d)+"px"),/l/.test(t)&&(e.resizeDiv.style.left=n._element_w-r+"px"),/r|l/.test(t)&&(e.resizeDiv.style.width=r+"px",s=r),/^(t|b)[^h]$/.test(t)?(e.resizeDiv.style.height=d+"px",a=d):/^(t|b)h$/.test(t)&&(e.resizeDiv.style.height=c+"px",a=c),e._resize_w=s,e._resize_h=a,this.util.changeTxt(e.resizeDisplay,this._w.Math.round(s)+" x "+this._w.Math.round(a)),e._isChange=!0},cancel_controller_resize:function(e){const t=this.context.resizing._rotateVertical;this.controllersOff(),this.context.element.resizeBackground.style.display="none";let n=this._w.Math.round(t?this.context.resizing._resize_h:this.context.resizing._resize_w),i=this._w.Math.round(t?this.context.resizing._resize_w:this.context.resizing._resize_h);if(!t&&!/%$/.test(n)){const e=16,t=this.context.element.wysiwygFrame.clientWidth-2*e-2;this.util.getNumber(n,0)>t&&(i=this._w.Math.round(i/n*t),n=t)}const l=this.context.resizing._resize_plugin;this.plugins[l].setSize.call(this,n,i,!1,e),this.selectComponent(this.context[l]._element,l)}};return void 0===t&&(e.SUNEDITOR_MODULES||Object.defineProperty(e,"SUNEDITOR_MODULES",{enumerable:!0,writable:!1,configurable:!1,value:{}}),Object.defineProperty(e.SUNEDITOR_MODULES,"resizing",{enumerable:!0,writable:!1,configurable:!1,value:n})),n},"object"==typeof e.exports?e.exports=i.document?l(i,!0):function(e){if(!e.document)throw new Error("SUNEDITOR_MODULES a window with a document");return l(e)}:l(i)},"gjS+":function(e,t,n){"use strict";var i,l;i="undefined"!=typeof window?window:this,l=function(e,t){const n={name:"fileManager",_xmlHttp:null,upload:function(e,t,n,i,l){this.showLoading();const o=this.plugins.fileManager,s=o._xmlHttp=this.util.getXMLHttpRequest();if(s.onreadystatechange=o._callBackUpload.bind(this,s,i,l),s.open("post",e,!0),null!==t&&"object"==typeof t&&this._w.Object.keys(t).length>0)for(let e in t)s.setRequestHeader(e,t[e]);s.send(n)},_callBackUpload:function(e,t,n){if(4===e.readyState)if(200===e.status)try{t(e)}catch(e){throw Error('[SUNEDITOR.fileManager.upload.callBack.fail] cause : "'+e.message+'"')}finally{this.closeLoading()}else{this.closeLoading();const t=e.responseText?JSON.parse(e.responseText):e;if("function"!=typeof n||n("",t,this)){const n="[SUNEDITOR.fileManager.upload.serverException] status: "+e.status+", response: "+(t.errorMessage||e.responseText);throw this.functions.noticeOpen(n),Error(n)}}},checkInfo:function(e,t,n,i,l){let o=[];for(let e=0,n=t.length;e-1||(a.splice(t,1),"function"==typeof n&&n(null,e,"delete",null,0,this),t--);l&&(this.context.resizing._resize_plugin=c)},setInfo:function(e,t,n,i,l){const o=l?this.context.resizing._resize_plugin:"";l&&(this.context.resizing._resize_plugin=e);const s=this.plugins[e],a=this.context[e],r=a._infoList;let c=t.getAttribute("data-index"),d=null,u="";if(i||(i={name:t.getAttribute("data-file-name")||("string"==typeof t.src?t.src.split("/").pop():""),size:t.getAttribute("data-file-size")||0}),!c||this._componentsInfoInit)u="create",c=a._infoIndex++,t.setAttribute("data-index",c),t.setAttribute("data-file-name",i.name),t.setAttribute("data-file-size",i.size),d={src:t.src,index:1*c,name:i.name,size:i.size},r.push(d);else{u="update",c*=1;for(let e=0,t=r.length;e=0){const i=this.context[e]._infoList;for(let e=0,l=i.length;e Date: Fri, 9 Oct 2020 10:22:46 +1100 Subject: [PATCH 18/38] translations, move "private" methods to _method --- src/assets/defaultIcons.js | 5 +-- src/lang/da.js | 3 +- src/lang/de.js | 3 +- src/lang/en.js | 3 +- src/lang/es.js | 3 +- src/lang/fr.js | 3 +- src/lang/it.js | 3 +- src/lang/ja.js | 3 +- src/lang/ko.js | 3 +- src/lang/lv.js | 3 +- src/lang/pl.js | 3 +- src/lang/pt_br.js | 3 +- src/lang/ro.js | 3 +- src/lang/ru.js | 3 +- src/lang/zh_cn.js | 3 +- src/lib/constructor.js | 6 ++-- src/plugins/dialog/mention.js | 57 ++++++++++++++++------------------- 17 files changed, 61 insertions(+), 49 deletions(-) diff --git a/src/assets/defaultIcons.js b/src/assets/defaultIcons.js index 282be3991..05ee45946 100644 --- a/src/assets/defaultIcons.js +++ b/src/assets/defaultIcons.js @@ -82,5 +82,6 @@ export default { attachment: '', map: '', magic_stick: '', - empty_file: '' -}; \ No newline at end of file + empty_file: '', + mention: '' +}; diff --git a/src/lang/da.js b/src/lang/da.js index 936bcf670..531eba9b0 100644 --- a/src/lang/da.js +++ b/src/lang/da.js @@ -77,7 +77,8 @@ lineHeight: 'Linjehøjde', paragraphStyle: 'Afsnitstil', textStyle: 'Tekststil', - imageGallery: 'Billedgalleri' + imageGallery: 'Billedgalleri', + mention: 'Nævne' }, dialogBox: { linkBox: { diff --git a/src/lang/de.js b/src/lang/de.js index 39c8efc5a..3a5470949 100644 --- a/src/lang/de.js +++ b/src/lang/de.js @@ -74,7 +74,8 @@ lineHeight: 'Zeilenhöhe', paragraphStyle: 'Absatzstil', textStyle: 'Textstil', - imageGallery: 'Bildergalerie' + imageGallery: 'Bildergalerie', + mention: 'Erwähnen', }, dialogBox: { linkBox: { diff --git a/src/lang/en.js b/src/lang/en.js index d51d5420a..01b454623 100644 --- a/src/lang/en.js +++ b/src/lang/en.js @@ -74,7 +74,8 @@ lineHeight: 'Line height', paragraphStyle: 'Paragraph style', textStyle: 'Text style', - imageGallery: 'Image gallery' + imageGallery: 'Image gallery', + mention: 'Mention', }, dialogBox: { linkBox: { diff --git a/src/lang/es.js b/src/lang/es.js index 4d53d216f..5160b2c7b 100644 --- a/src/lang/es.js +++ b/src/lang/es.js @@ -74,7 +74,8 @@ lineHeight: 'Altura de la línea', paragraphStyle: 'Estilo del parrafo', textStyle: 'Estilo del texto', - imageGallery: 'Galería de imágenes' + imageGallery: 'Galería de imágenes', + mention: 'Mencionar', }, dialogBox: { linkBox: { diff --git a/src/lang/fr.js b/src/lang/fr.js index 1f3219dbe..81f1afa04 100644 --- a/src/lang/fr.js +++ b/src/lang/fr.js @@ -74,7 +74,8 @@ lineHeight: 'Hauteur de la ligne', paragraphStyle: 'Style de paragraphe', textStyle: 'Style de texte', - imageGallery: 'Galerie d\'images' + imageGallery: 'Galerie d\'images', + mention: 'Mention', }, dialogBox: { linkBox: { diff --git a/src/lang/it.js b/src/lang/it.js index e50231657..696492632 100644 --- a/src/lang/it.js +++ b/src/lang/it.js @@ -74,7 +74,8 @@ lineHeight: 'Altezza linea', paragraphStyle: 'Stile Paragrafo', textStyle: 'Stile Testo', - imageGallery: 'Galleria di immagini' + imageGallery: 'Galleria di immagini', + mention: 'Citare', }, dialogBox: { linkBox: { diff --git a/src/lang/ja.js b/src/lang/ja.js index 60b073b2a..ba7694b55 100644 --- a/src/lang/ja.js +++ b/src/lang/ja.js @@ -74,7 +74,8 @@ lineHeight: '行の高さ', paragraphStyle: '段落スタイル', textStyle: 'テキストスタイル', - imageGallery: 'イメージギャラリー' + imageGallery: 'イメージギャラリー', + mention: '言及する', }, dialogBox: { linkBox: { diff --git a/src/lang/ko.js b/src/lang/ko.js index 4c9d737c5..b05d2369f 100644 --- a/src/lang/ko.js +++ b/src/lang/ko.js @@ -74,7 +74,8 @@ lineHeight: '줄 높이', paragraphStyle: '문단 스타일', textStyle: '글자 스타일', - imageGallery: '이미지 갤러리' + imageGallery: '이미지 갤러리', + mention: '언급하다', }, dialogBox: { linkBox: { diff --git a/src/lang/lv.js b/src/lang/lv.js index 6b7f774fa..1ecc8bdde 100644 --- a/src/lang/lv.js +++ b/src/lang/lv.js @@ -74,7 +74,8 @@ lineHeight: 'Līnijas augstums', paragraphStyle: 'Paragrāfa stils', textStyle: 'Teksta stils', - imageGallery: 'Attēlu galerija' + imageGallery: 'Attēlu galerija', + mention: 'Pieminēt', }, dialogBox: { linkBox: { diff --git a/src/lang/pl.js b/src/lang/pl.js index 30afbb5ce..3af9cabb0 100644 --- a/src/lang/pl.js +++ b/src/lang/pl.js @@ -74,7 +74,8 @@ lineHeight: 'Odstęp między wierszami', paragraphStyle: 'Styl akapitu', textStyle: 'Styl tekstu', - imageGallery: 'Galeria obrazów' + imageGallery: 'Galeria obrazów', + mention: 'Wzmianka', }, dialogBox: { linkBox: { diff --git a/src/lang/pt_br.js b/src/lang/pt_br.js index 15346a43d..d523f0fec 100644 --- a/src/lang/pt_br.js +++ b/src/lang/pt_br.js @@ -75,7 +75,8 @@ lineHeight: 'Altura da linha', paragraphStyle: 'Estilo do parágrafo', textStyle: 'Estilo do texto', - imageGallery: 'Galeria de imagens' + imageGallery: 'Galeria de imagens', + mention: 'Menção', }, dialogBox: { linkBox: { diff --git a/src/lang/ro.js b/src/lang/ro.js index 172a7604f..b1eb3f281 100644 --- a/src/lang/ro.js +++ b/src/lang/ro.js @@ -74,7 +74,8 @@ lineHeight: 'Înălțime linie', paragraphStyle: 'Stil paragraf', textStyle: 'Stil text', - imageGallery: 'Galerie de imagini' + imageGallery: 'Galerie de imagini', + mention: 'Mentiune', }, dialogBox: { linkBox: { diff --git a/src/lang/ru.js b/src/lang/ru.js index 07a6f1d3b..2842b9641 100644 --- a/src/lang/ru.js +++ b/src/lang/ru.js @@ -74,7 +74,8 @@ lineHeight: 'Высота линии', paragraphStyle: 'Стиль абзаца', textStyle: 'Стиль текста', - imageGallery: 'Галерея' + imageGallery: 'Галерея', + mention: 'Упоминание', }, dialogBox: { linkBox: { diff --git a/src/lang/zh_cn.js b/src/lang/zh_cn.js index adb980bd6..17c01202c 100644 --- a/src/lang/zh_cn.js +++ b/src/lang/zh_cn.js @@ -74,7 +74,8 @@ lineHeight: '行高', paragraphStyle: '段落样式', textStyle: '文字样式', - imageGallery: '图片库' + imageGallery: '图片库', + mention: '提到', }, dialogBox: { linkBox: { diff --git a/src/lib/constructor.js b/src/lib/constructor.js index 5abab4e1c..9bcf04b48 100755 --- a/src/lib/constructor.js +++ b/src/lib/constructor.js @@ -561,7 +561,9 @@ export default { audio: ['', lang.toolbar.audio, 'audio', 'dialog', icons.audio], math: ['', lang.toolbar.math, 'math', 'dialog', icons.math], /** plugins - fileBrowser */ - imageGallery: ['', lang.toolbar.imageGallery, 'imageGallery', 'fileBrowser', icons.image_gallery] + imageGallery: ['', lang.toolbar.imageGallery, 'imageGallery', 'fileBrowser', icons.image_gallery], + /** plugins - mention */ + mention: ['', lang.toolbar.mention, 'mention', 'dialog', icons.mention] }; }, @@ -790,4 +792,4 @@ export default { '_buttonTray': _buttonTray }; } -}; \ No newline at end of file +}; diff --git a/src/plugins/dialog/mention.js b/src/plugins/dialog/mention.js index 3cdaef45c..302e1eb25 100644 --- a/src/plugins/dialog/mention.js +++ b/src/plugins/dialog/mention.js @@ -9,7 +9,6 @@ import dialog from "../modules/dialog"; -const icon = ''; function insertAt(parent, child, index) { if (!index) index = 0; @@ -23,8 +22,6 @@ function insertAt(parent, child, index) { export default { name: "mention", display: "dialog", - title: "Mention", //TODO: how do i translate this? - innerHTML: icon, renderItem: function(item) { return `${item}`; @@ -45,7 +42,7 @@ export default { mention.focussed = 0; mention.term = term; promise = mention.getItems(term).then((items) => { - mention.items = items; + mention._items = items; Object.keys(mention._itemElements).forEach((id) => { if (!items.find((i) => mention.getId(i) === id)) { @@ -64,9 +61,9 @@ export default { el.innerHTML = mention.renderItem(item); el.addEventListener("click", () => { mention.focussed = idx; - mention.addMention(); + mention._addMention(); }); - insertAt(mention.list, el, idx); + insertAt(mention._list, el, idx); mention._itemElements[id] = el; } }); @@ -74,11 +71,11 @@ export default { } promise.then(() => { - const current = mention.list.querySelectorAll(".se-mention-item")[ + const current = mention._list.querySelectorAll(".se-mention-item")[ mention.focussed ]; if (current && !this.util.hasClass(current, "se-mention-active")) { - const prev = mention.list.querySelector(".se-mention-active"); + const prev = mention._list.querySelector(".se-mention-active"); if (prev) this.util.removeClass(prev, "se-mention-active"); this.util.addClass(current, "se-mention-active"); } @@ -128,7 +125,7 @@ export default { "mention", "mention" === this.currentControllerName ); - mention.search.focus(); + mention._search.focus(); mention.renderList(""); }, @@ -139,11 +136,11 @@ export default { init: function() { const { mention } = this.context; - mention.search.value = ""; + mention._search.value = ""; mention.focussed = 0; - mention.items = []; + mention._items = []; mention._itemElements = {}; - mention.list.innerHTML = ""; + mention._list.innerHTML = ""; delete mention.term; }, @@ -165,7 +162,7 @@ export default { break; case "Enter": - mention.addMention(); + mention._addMention(); e.preventDefault(); e.stopPropagation(); break; @@ -189,9 +186,9 @@ export default { }); }, - addMention: function() { + _addMention: function() { const { mention } = this.context; - const new_mention = mention.items[mention.focussed]; + const new_mention = mention._items[mention.focussed]; if (new_mention) { if ( !mention.mentions.find( @@ -218,29 +215,27 @@ export default { const _dialog = this.setDialog.call(core); core.getMentions = this.getMentions.bind(core); - const search = _dialog.querySelector(".se-mention-search"); - search.addEventListener("keyup", this.onKeyUp.bind(core)); - search.addEventListener("keydown", this.onKeyPress.bind(core)); - const list = _dialog.querySelector(".se-mention-list"); + const _search = _dialog.querySelector(".se-mention-search"); + _search.addEventListener("keyup", this.onKeyUp.bind(core)); + _search.addEventListener("keydown", this.onKeyPress.bind(core)); + const _list = _dialog.querySelector(".se-mention-list"); core.context.mention = { - modal: _dialog, - search, - list, - triggerKey: this.triggerKey, - visible: false, - addMention: this.addMention.bind(core), - mentions: [], - items: [], + _addMention: this._addMention.bind(core), _itemElements: {}, - renderList: this.renderList.bind(core), + _items: [], + _list, + _search, + focussed: 0, getId: this.getId.bind(core), - getValue: this.getValue.bind(core), + getItems: this.getItems, getLinkHref: this.getLinkHref.bind(core), + getValue: this.getValue.bind(core), + mentions: [], + modal: _dialog, open: this.open.bind(core), - focussed: 0, renderItem: this.renderItem, - getItems: this.getItems, + renderList: this.renderList.bind(core), }; core.context.dialog.modal.appendChild(_dialog); }, From bfa9db5afe54cee3184f89595bedd65cdf329c79 Mon Sep 17 00:00:00 2001 From: NickyTope Date: Fri, 9 Oct 2020 10:43:34 +1100 Subject: [PATCH 19/38] build --- dist/suneditor.min.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dist/suneditor.min.js b/dist/suneditor.min.js index fb1dc1706..2062d2417 100644 --- a/dist/suneditor.min.js +++ b/dist/suneditor.min.js @@ -1,2 +1,2 @@ -!function(e){var t={};function n(i){if(t[i])return t[i].exports;var l=t[i]={i:i,l:!1,exports:{}};return e[i].call(l.exports,l,l.exports,n),l.l=!0,l.exports}n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var l in e)n.d(i,l,function(t){return e[t]}.bind(null,l));return i},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s="XJR1")}({"1kvd":function(e,t,n){"use strict";var i,l;i="undefined"!=typeof window?window:this,l=function(e,t){const n={name:"dialog",add:function(e){const t=e.context;t.dialog={kind:"",updateModal:!1,_closeSignal:!1};let n=e.util.createElement("DIV");n.className="se-dialog sun-editor-common";let i=e.util.createElement("DIV");i.className="se-dialog-back",i.style.display="none";let l=e.util.createElement("DIV");l.className="se-dialog-inner",l.style.display="none",n.appendChild(i),n.appendChild(l),t.dialog.modalArea=n,t.dialog.back=i,t.dialog.modal=l,t.dialog.modal.addEventListener("mousedown",this._onMouseDown_dialog.bind(e)),t.dialog.modal.addEventListener("click",this._onClick_dialog.bind(e)),t.element.relative.appendChild(n),n=null,i=null,l=null},_onMouseDown_dialog:function(e){/se-dialog-inner/.test(e.target.className)?this.context.dialog._closeSignal=!0:this.context.dialog._closeSignal=!1},_onClick_dialog:function(e){e.stopPropagation(),(/close/.test(e.target.getAttribute("data-command"))||this.context.dialog._closeSignal)&&this.plugins.dialog.close.call(this)},open:function(e,t){if(this.modalForm)return!1;this.plugins.dialog._bindClose&&(this._d.removeEventListener("keydown",this.plugins.dialog._bindClose),this.plugins.dialog._bindClose=null),this.plugins.dialog._bindClose=function(e){/27/.test(e.keyCode)&&this.plugins.dialog.close.call(this)}.bind(this),this._d.addEventListener("keydown",this.plugins.dialog._bindClose),this.context.dialog.updateModal=t,"full"===this.context.option.popupDisplay?this.context.dialog.modalArea.style.position="fixed":this.context.dialog.modalArea.style.position="absolute",this.context.dialog.kind=e,this.modalForm=this.context[e].modal;const n=this.context[e].focusElement;"function"==typeof this.plugins[e].on&&this.plugins[e].on.call(this,t),this.context.dialog.modalArea.style.display="block",this.context.dialog.back.style.display="block",this.context.dialog.modal.style.display="block",this.modalForm.style.display="block",n&&n.focus()},_bindClose:null,close:function(){this.plugins.dialog._bindClose&&(this._d.removeEventListener("keydown",this.plugins.dialog._bindClose),this.plugins.dialog._bindClose=null);const e=this.context.dialog.kind;this.modalForm.style.display="none",this.context.dialog.back.style.display="none",this.context.dialog.modalArea.style.display="none",this.context.dialog.updateModal=!1,"function"==typeof this.plugins[e].init&&this.plugins[e].init.call(this),this.context.dialog.kind="",this.modalForm=null,this.focus()}};return void 0===t&&(e.SUNEDITOR_MODULES||Object.defineProperty(e,"SUNEDITOR_MODULES",{enumerable:!0,writable:!1,configurable:!1,value:{}}),Object.defineProperty(e.SUNEDITOR_MODULES,"dialog",{enumerable:!0,writable:!1,configurable:!1,value:n})),n},"object"==typeof e.exports?e.exports=i.document?l(i,!0):function(e){if(!e.document)throw new Error("SUNEDITOR_MODULES a window with a document");return l(e)}:l(i)},"3FqI":function(e,t,n){},JhlZ:function(e,t,n){"use strict";var i,l;i="undefined"!=typeof window?window:this,l=function(e,t){const n={name:"fileBrowser",_xmlHttp:null,_loading:null,add:function(e){const t=e.context;t.fileBrowser={_closeSignal:!1,area:null,header:null,tagArea:null,body:null,list:null,tagElements:null,items:[],selectedTags:[],selectorHandler:null,contextPlugin:"",columnSize:4};let n=e.util.createElement("DIV");n.className="se-file-browser sun-editor-common";let i=e.util.createElement("DIV");i.className="se-file-browser-back";let l=e.util.createElement("DIV");l.className="se-file-browser-inner",l.innerHTML=this.set_browser(e),n.appendChild(i),n.appendChild(l),this._loading=n.querySelector(".se-loading-box"),t.fileBrowser.area=n,t.fileBrowser.header=l.querySelector(".se-file-browser-header"),t.fileBrowser.titleArea=l.querySelector(".se-file-browser-title"),t.fileBrowser.tagArea=l.querySelector(".se-file-browser-tags"),t.fileBrowser.body=l.querySelector(".se-file-browser-body"),t.fileBrowser.list=l.querySelector(".se-file-browser-list"),t.fileBrowser.tagArea.addEventListener("click",this.onClickTag.bind(e)),t.fileBrowser.list.addEventListener("click",this.onClickFile.bind(e)),l.addEventListener("mousedown",this._onMouseDown_browser.bind(e)),l.addEventListener("click",this._onClick_browser.bind(e)),t.element.relative.appendChild(n),n=null,i=null,l=null},set_browser:function(e){return'
    '},_onMouseDown_browser:function(e){/se-file-browser-inner/.test(e.target.className)?this.context.fileBrowser._closeSignal=!0:this.context.fileBrowser._closeSignal=!1},_onClick_browser:function(e){e.stopPropagation(),(/close/.test(e.target.getAttribute("data-command"))||this.context.fileBrowser._closeSignal)&&this.plugins.fileBrowser.close.call(this)},open:function(e,t){this.plugins.fileBrowser._bindClose&&(this._d.removeEventListener("keydown",this.plugins.fileBrowser._bindClose),this.plugins.fileBrowser._bindClose=null),this.plugins.fileBrowser._bindClose=function(e){/27/.test(e.keyCode)&&this.plugins.fileBrowser.close.call(this)}.bind(this),this._d.addEventListener("keydown",this.plugins.fileBrowser._bindClose);const n=this.context.fileBrowser;n.contextPlugin=e,n.selectorHandler=t;const i=this.context[e],l=i.listClass;this.util.hasClass(n.list,l)||(n.list.className="se-file-browser-list "+l),"full"===this.context.option.popupDisplay?n.area.style.position="fixed":n.area.style.position="absolute",n.titleArea.textContent=i.title,n.area.style.display="block",this.plugins.fileBrowser._drawFileList.call(this,this.context[e].url)},_bindClose:null,close:function(){const e=this.plugins.fileBrowser;e._xmlHttp&&e._xmlHttp.abort(),e._bindClose&&(this._d.removeEventListener("keydown",e._bindClose),e._bindClose=null);const t=this.context.fileBrowser;t.area.style.display="none",t.selectorHandler=null,t.selectedTags=[],t.items=[],t.list.innerHTML=t.tagArea.innerHTML=t.titleArea.textContent="","function"==typeof this.plugins[t.contextPlugin].init&&this.plugins[t.contextPlugin].init.call(this),t.contextPlugin=""},showBrowserLoading:function(){this._loading.style.display="block"},closeBrowserLoading:function(){this._loading.style.display="none"},_drawFileList:function(e){const t=this.plugins.fileBrowser,n=t._xmlHttp=this.util.getXMLHttpRequest();n.onreadystatechange=t._callBackGet.bind(this,n),n.open("get",e,!0),n.send(null),this.plugins.fileBrowser.showBrowserLoading()},_callBackGet:function(e){if(4===e.readyState)if(this.plugins.fileBrowser._xmlHttp=null,200===e.status)try{this.plugins.fileBrowser._drawListItem.call(this,JSON.parse(e.responseText).result,!0)}catch(e){throw Error('[SUNEDITOR.fileBrowser.drawList.fail] cause : "'+e.message+'"')}finally{this.plugins.fileBrowser.closeBrowserLoading(),this.context.fileBrowser.body.style.maxHeight=this._w.innerHeight-this.context.fileBrowser.header.offsetHeight-50+"px"}else if(this.plugins.fileBrowser.closeBrowserLoading(),0!==e.status){const t=e.responseText?JSON.parse(e.responseText):e,n="[SUNEDITOR.fileBrowser.get.serverException] status: "+e.status+", response: "+(t.errorMessage||e.responseText);throw Error(n)}},_drawListItem:function(e,t){const n=this.context.fileBrowser,i=this.context[n.contextPlugin],l=[],o=e.length,s=i.columnSize||n.columnSize,a=s<=1?1:Math.round(o/s)||1,r=i.itemTemplateHandler;let c="",d='
    ',u=1;for(let n,i,h=0;h
    '),t&&i.length>0)for(let e,t=0,n=i.length;t'+e+"");d+="
    ",n.list.innerHTML=d,t&&(n.items=e,n.tagArea.innerHTML=c,n.tagElements=n.tagArea.querySelectorAll("A"))},onClickTag:function(e){const t=e.target;if(!this.util.isAnchor(t))return;const n=t.textContent,i=this.plugins.fileBrowser,l=this.context.fileBrowser,o=l.tagArea.querySelector('a[title="'+n+'"]'),s=l.selectedTags,a=s.indexOf(n);a>-1?(s.splice(a,1),this.util.removeClass(o,"on")):(s.push(n),this.util.addClass(o,"on")),i._drawListItem.call(this,0===s.length?l.items:l.items.filter((function(e){return e.tag.some((function(e){return s.indexOf(e)>-1}))})),!1)},onClickFile:function(e){e.preventDefault(),e.stopPropagation();const t=this.context.fileBrowser,n=t.list;let i=e.target,l=null;if(i===n)return;for(;n!==i.parentNode&&(l=i.getAttribute("data-command"),!l);)i=i.parentNode;if(!l)return;const o=t.selectorHandler||this.context[t.contextPlugin].selectorHandler;this.plugins.fileBrowser.close.call(this),o(i)}};return void 0===t&&(e.SUNEDITOR_MODULES||Object.defineProperty(e,"SUNEDITOR_MODULES",{enumerable:!0,writable:!1,configurable:!1,value:{}}),Object.defineProperty(e.SUNEDITOR_MODULES,"fileBrowser",{enumerable:!0,writable:!1,configurable:!1,value:n})),n},"object"==typeof e.exports?e.exports=i.document?l(i,!0):function(e){if(!e.document)throw new Error("SUNEDITOR_MODULES a window with a document");return l(e)}:l(i)},P6u4:function(e,t,n){"use strict";var i,l;i="undefined"!=typeof window?window:this,l=function(e,t){const n={code:"en",toolbar:{default:"Default",save:"Save",font:"Font",formats:"Formats",fontSize:"Size",bold:"Bold",underline:"Underline",italic:"Italic",strike:"Strike",subscript:"Subscript",superscript:"Superscript",removeFormat:"Remove Format",fontColor:"Font Color",hiliteColor:"Highlight Color",indent:"Indent",outdent:"Outdent",align:"Align",alignLeft:"Align left",alignRight:"Align right",alignCenter:"Align center",alignJustify:"Align justify",list:"List",orderList:"Ordered list",unorderList:"Unordered list",horizontalRule:"Horizontal line",hr_solid:"Solid",hr_dotted:"Dotted",hr_dashed:"Dashed",table:"Table",link:"Link",math:"Math",image:"Image",video:"Video",audio:"Audio",fullScreen:"Full screen",showBlocks:"Show blocks",codeView:"Code view",undo:"Undo",redo:"Redo",preview:"Preview",print:"print",tag_p:"Paragraph",tag_div:"Normal (DIV)",tag_h:"Header",tag_blockquote:"Quote",tag_pre:"Code",template:"Template",lineHeight:"Line height",paragraphStyle:"Paragraph style",textStyle:"Text style",imageGallery:"Image gallery"},dialogBox:{linkBox:{title:"Insert Link",url:"URL to link",text:"Text to display",newWindowCheck:"Open in new window"},mathBox:{title:"Math",inputLabel:"Mathematical Notation",fontSizeLabel:"Font Size",previewLabel:"Preview"},imageBox:{title:"Insert image",file:"Select from files",url:"Image URL",altText:"Alternative text"},videoBox:{title:"Insert Video",file:"Select from files",url:"Media embed URL, YouTube/Vimeo"},audioBox:{title:"Insert Audio",file:"Select from files",url:"Audio URL"},browser:{tags:"Tags",search:"Search"},mentionBox:{title:"Add Mention"},caption:"Insert description",close:"Close",submitButton:"Submit",revertButton:"Revert",proportion:"Constrain proportions",basic:"Basic",left:"Left",right:"Right",center:"Center",width:"Width",height:"Height",size:"Size",ratio:"Ratio"},controller:{edit:"Edit",unlink:"Unlink",remove:"Remove",insertRowAbove:"Insert row above",insertRowBelow:"Insert row below",deleteRow:"Delete row",insertColumnBefore:"Insert column before",insertColumnAfter:"Insert column after",deleteColumn:"Delete column",fixedColumnWidth:"Fixed column width",resize100:"Resize 100%",resize75:"Resize 75%",resize50:"Resize 50%",resize25:"Resize 25%",autoSize:"Auto size",mirrorHorizontal:"Mirror, Horizontal",mirrorVertical:"Mirror, Vertical",rotateLeft:"Rotate left",rotateRight:"Rotate right",maxSize:"Max size",minSize:"Min size",tableHeader:"Table header",mergeCells:"Merge cells",splitCells:"Split Cells",HorizontalSplit:"Horizontal split",VerticalSplit:"Vertical split"},menu:{spaced:"Spaced",bordered:"Bordered",neon:"Neon",translucent:"Translucent",shadow:"Shadow",code:"Code"}};return void 0===t&&(e.SUNEDITOR_LANG||Object.defineProperty(e,"SUNEDITOR_LANG",{enumerable:!0,writable:!1,configurable:!1,value:{}}),Object.defineProperty(e.SUNEDITOR_LANG,"en",{enumerable:!0,writable:!0,configurable:!0,value:n})),n},"object"==typeof e.exports?e.exports=i.document?l(i,!0):function(e){if(!e.document)throw new Error("SUNEDITOR_LANG a window with a document");return l(e)}:l(i)},WUQj:function(e,t,n){},XJR1:function(e,t,n){"use strict";n.r(t);n("3FqI"),n("WUQj");var i={name:"colorPicker",add:function(e){const t=e.context;t.colorPicker={colorListHTML:"",_colorInput:"",_defaultColor:"#000",_styleProperty:"color",_currentColor:"",_colorList:[]};let n=this.createColorList(e,this._makeColorList);t.colorPicker.colorListHTML=n,n=null},createColorList:function(e,t){const n=e.context.option,i=e.lang,l=n.colorList&&0!==n.colorList.length?n.colorList:["#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"];let o=[],s='
    ';for(let e,n=0,i=l.length;n0&&(s+='
    '+t(o)+"
    ",o=[]),"object"==typeof e&&(s+='
    '+t(e)+"
    ")));return s+='
    ",s},_makeColorList:function(e){let t="";t+='
      ';for(let n,i=0,l=e.length;i');return t+="
    ",t},init:function(e,t){const n=this.plugins.colorPicker;let i=t||(n.getColorInNode.call(this,e)||this.context.colorPicker._defaultColor);i=n.isHexColor(i)?i:n.rgb2hex(i)||i;const l=this.context.colorPicker._colorList;if(l)for(let e=0,t=l.length;e=3&&"#"+((1<<24)+(n[0]<<16)+(n[1]<<8)+n[2]).toString(16).substr(1)}},l={name:"fontColor",display:"submenu",add:function(e,t){e.addModule([i]);const n=e.context;n.fontColor={previewEl:null,colorInput:null,colorList:null};let l=this.setSubmenu.call(e);n.fontColor.colorInput=l.querySelector("._se_color_picker_input"),n.fontColor.colorInput.addEventListener("keyup",this.onChangeInput.bind(e)),l.querySelector("._se_color_picker_submit").addEventListener("click",this.submit.bind(e)),l.querySelector("._se_color_picker_remove").addEventListener("click",this.remove.bind(e)),l.addEventListener("click",this.pickup.bind(e)),n.fontColor.colorList=l.querySelectorAll("li button"),e.initMenuTarget(this.name,t,l),l=null},setSubmenu:function(){const e=this.context.colorPicker.colorListHTML,t=this.util.createElement("DIV");return t.className="se-submenu se-list-layer",t.innerHTML=e,t},on:function(){const e=this.context.colorPicker,t=this.context.fontColor;e._colorInput=t.colorInput,e._defaultColor="#333333",e._styleProperty="color",e._colorList=t.colorList,this.plugins.colorPicker.init.call(this,this.getSelectionNode(),null)},onChangeInput:function(e){this.plugins.colorPicker.setCurrentColor.call(this,e.target.value)},submit:function(){this.plugins.fontColor.applyColor.call(this,this.context.colorPicker._currentColor)},pickup:function(e){e.preventDefault(),e.stopPropagation(),this.plugins.fontColor.applyColor.call(this,e.target.getAttribute("data-value"))},remove:function(){this.nodeChange(null,["color"],["span"],!0),this.submenuOff()},applyColor:function(e){if(!e)return;const t=this.util.createElement("SPAN");t.style.color=e,this.nodeChange(t,["color"],null,null),this.submenuOff()}},o={name:"hiliteColor",display:"submenu",add:function(e,t){e.addModule([i]);const n=e.context;n.hiliteColor={previewEl:null,colorInput:null,colorList:null};let l=this.setSubmenu.call(e);n.hiliteColor.colorInput=l.querySelector("._se_color_picker_input"),n.hiliteColor.colorInput.addEventListener("keyup",this.onChangeInput.bind(e)),l.querySelector("._se_color_picker_submit").addEventListener("click",this.submit.bind(e)),l.querySelector("._se_color_picker_remove").addEventListener("click",this.remove.bind(e)),l.addEventListener("click",this.pickup.bind(e)),n.hiliteColor.colorList=l.querySelectorAll("li button"),e.initMenuTarget(this.name,t,l),l=null},setSubmenu:function(){const e=this.context.colorPicker.colorListHTML,t=this.util.createElement("DIV");return t.className="se-submenu se-list-layer",t.innerHTML=e,t},on:function(){const e=this.context.colorPicker,t=this.context.hiliteColor;e._colorInput=t.colorInput,e._defaultColor="#FFFFFF",e._styleProperty="backgroundColor",e._colorList=t.colorList,this.plugins.colorPicker.init.call(this,this.getSelectionNode(),null)},onChangeInput:function(e){this.plugins.colorPicker.setCurrentColor.call(this,e.target.value)},submit:function(){this.plugins.hiliteColor.applyColor.call(this,this.context.colorPicker._currentColor)},pickup:function(e){e.preventDefault(),e.stopPropagation(),this.plugins.hiliteColor.applyColor.call(this,e.target.getAttribute("data-value"))},remove:function(){this.nodeChange(null,["background-color"],["span"],!0),this.submenuOff()},applyColor:function(e){if(!e)return;const t=this.util.createElement("SPAN");t.style.backgroundColor=e,this.nodeChange(t,["background-color"],null,null),this.submenuOff()}},s={name:"template",display:"submenu",add:function(e,t){e.context.template={};let n=this.setSubmenu.call(e);n.querySelector("ul").addEventListener("click",this.pickup.bind(e)),e.initMenuTarget(this.name,t,n),n=null},setSubmenu:function(){const e=this.context.option.templates;if(!e||0===e.length)throw Error('[SUNEDITOR.plugins.template.fail] To use the "template" plugin, please define the "templates" option.');const t=this.util.createElement("DIV");t.className="se-list-layer";let n='
      ';for(let t,i=0,l=e.length;i";return n+="
    ",t.innerHTML=n,t},pickup:function(e){if(!/^BUTTON$/i.test(e.target.tagName))return!1;e.preventDefault(),e.stopPropagation();const t=this.context.option.templates[e.target.getAttribute("data-value")];if(!t.html)throw this.submenuOff(),Error('[SUNEDITOR.template.fail] cause : "templates[i].html not found"');this.setContents(t.html),this.submenuOff()}},a=n("1kvd"),r=n.n(a),c={name:"link",display:"dialog",add:function(e){e.addModule([r.a]);const t=e.context;t.link={focusElement:null,linkNewWindowCheck:null,linkAnchorText:null,_linkAnchor:null,_linkValue:""};let n=this.setDialog.call(e);t.link.modal=n,t.link.focusElement=n.querySelector("._se_link_url"),t.link.linkAnchorText=n.querySelector("._se_link_text"),t.link.linkNewWindowCheck=n.querySelector("._se_link_check"),t.link.preview=n.querySelector(".se-link-preview");let i=this.setController_LinkButton.call(e);t.link.linkController=i,t.link._linkAnchor=null,i.addEventListener("mousedown",e.eventStop),n.querySelector(".se-btn-primary").addEventListener("click",this.submit.bind(e)),i.addEventListener("click",this.onClick_linkController.bind(e)),t.link.focusElement.addEventListener("input",this._onLinkPreview.bind(t.link.preview,t.link,t.options.linkProtocol)),t.dialog.modal.appendChild(n),t.element.relative.appendChild(i),n=null,i=null},setDialog:function(){const e=this.lang,t=this.util.createElement("DIV");return t.className="se-dialog-content",t.style.display="none",t.innerHTML='",t},setController_LinkButton:function(){const e=this.lang,t=this.icons,n=this.util.createElement("DIV");return n.className="se-controller se-controller-link",n.innerHTML='
    ",n},open:function(){this.plugins.dialog.open.call(this,"link","link"===this.currentControllerName)},_onLinkPreview:function(e,t,n){const i=n.target.value.trim();e._linkValue=this.textContent=i?t&&-1===i.indexOf("://")&&0!==i.indexOf("#")?t+i:-1===i.indexOf("://")?"/"+i:i:""},submit:function(e){this.showLoading(),e.preventDefault(),e.stopPropagation();const t=function(){const e=this.context.link;if(0===e._linkValue.length)return!1;const t=e._linkValue,n=e.linkAnchorText,i=0===n.value.length?t:n.value;if(this.context.dialog.updateModal){e._linkAnchor.href=t,e._linkAnchor.textContent=i,e._linkAnchor.target=e.linkNewWindowCheck.checked?"_blank":"";const n=e._linkAnchor.childNodes[0];this.setRange(n,0,n,n.textContent.length)}else{const n=this.util.createElement("A");n.href=t,n.textContent=i,n.target=e.linkNewWindowCheck.checked?"_blank":"";const l=this.getSelectedElements();if(l.length>1){const e=this.util.createElement(l[0].nodeName);if(e.appendChild(n),!this.insertNode(e,null,!0))return}else if(!this.insertNode(n,null,!0))return;this.setRange(n.childNodes[0],0,n.childNodes[0],n.textContent.length)}e._linkValue=e.preview.textContent=e.focusElement.value=e.linkAnchorText.value=""}.bind(this);try{t()}finally{this.plugins.dialog.close.call(this),this.closeLoading(),this.history.push(!1)}return!1},active:function(e){if(e){if(this.util.isAnchor(e)&&null===e.getAttribute("data-image-link"))return this.controllerArray.indexOf(this.context.link.linkController)<0&&this.plugins.link.call_controller.call(this,e),!0}else this.controllerArray.indexOf(this.context.link.linkController)>-1&&this.controllersOff();return!1},on:function(e){const t=this.context.link;e?t._linkAnchor&&(this.context.dialog.updateModal=!0,t._linkValue=t.preview.textContent=t.focusElement.value=t._linkAnchor.href,t.linkAnchorText.value=t._linkAnchor.textContent,t.linkNewWindowCheck.checked=!!/_blank/i.test(t._linkAnchor.target)):(this.plugins.link.init.call(this),t.linkAnchorText.value=this.getSelection().toString())},call_controller:function(e){this.editLink=this.context.link._linkAnchor=e;const t=this.context.link.linkController,n=t.querySelector("a");n.href=e.href,n.title=e.textContent,n.textContent=e.textContent;const i=this.util.getOffset(e,this.context.element.wysiwygFrame);t.style.top=i.top+e.offsetHeight+10+"px",t.style.left=i.left-this.context.element.wysiwygFrame.scrollLeft+"px",t.style.display="block";const l=this.context.element.wysiwygFrame.offsetWidth-(t.offsetLeft+t.offsetWidth);l<0?(t.style.left=t.offsetLeft+l+"px",t.firstElementChild.style.left=20-l+"px"):t.firstElementChild.style.left="20px",this.controllersOn(t,e,"link")},onClick_linkController:function(e){e.stopPropagation();const t=e.target.getAttribute("data-command")||e.target.parentNode.getAttribute("data-command");if(t){if(e.preventDefault(),/update/.test(t)){const e=this.context.link;e._linkValue=e.preview.textContent=e.focusElement.value=e._linkAnchor.href,e.linkAnchorText.value=e._linkAnchor.textContent,e.linkNewWindowCheck.checked=!!/_blank/i.test(e._linkAnchor.target),this.plugins.dialog.open.call(this,"link",!0)}else if(/unlink/.test(t)){const e=this.util.getChildElement(this.context.link._linkAnchor,(function(e){return 0===e.childNodes.length||3===e.nodeType}),!1),t=this.util.getChildElement(this.context.link._linkAnchor,(function(e){return 0===e.childNodes.length||3===e.nodeType}),!0);this.setRange(e,0,t,t.textContent.length),this.nodeChange(null,null,["A"],!1)}else this.util.removeItem(this.context.link._linkAnchor),this.context.link._linkAnchor=null,this.focus(),this.history.push(!1);this.controllersOff()}},init:function(){const e=this.context.link;e.linkController.style.display="none",e._linkAnchor=null,e._linkValue=e.preview.textContent=e.focusElement.value="",e.linkAnchorText.value="",e.linkNewWindowCheck.checked=!1}},d=n("ZED3"),u=n.n(d),h=n("ee5k"),g=n.n(h),p=n("gjS+"),m=n.n(p),f={name:"image",display:"dialog",add:function(e){e.addModule([r.a,u.a,g.a,m.a]);const t=e.context,n=t.image={_infoList:[],_infoIndex:0,_uploadFileLength:0,sizeUnit:t.option._imageSizeUnit,_altText:"",_linkElement:null,_align:"none",_floatClassRegExp:"__se__float\\-[a-z]+",_v_link:{_linkValue:""},_v_src:{_linkValue:""},svgDefaultSize:"30%",_element:null,_cover:null,_container:null,inputX:null,inputY:null,_element_w:1,_element_h:1,_element_l:0,_element_t:0,_defaultSizeX:"auto",_defaultSizeY:"auto",_origin_w:"auto"===t.option.imageWidth?"":t.option.imageWidth,_origin_h:"auto"===t.option.imageHeight?"":t.option.imageHeight,_proportionChecked:!0,_resizing:t.option.imageResizing,_resizeDotHide:!t.option.imageHeightShow,_rotation:t.option.imageRotation,_onlyPercentage:t.option.imageSizeOnlyPercentage,_ratio:!1,_ratioX:1,_ratioY:1,_captionShow:!0,_captionChecked:!1,_caption:null,captionCheckEl:null};let i=this.setDialog.call(e);n.modal=i,n.imgInputFile=i.querySelector("._se_image_file"),n.imgUrlFile=i.querySelector(".se-input-url"),n.focusElement=n.imgInputFile||n.imgUrlFile,n.altText=i.querySelector("._se_image_alt"),n.imgLink=i.querySelector("._se_image_link"),n.imgLinkNewWindowCheck=i.querySelector("._se_image_link_check"),n.captionCheckEl=i.querySelector("._se_image_check_caption"),n.previewLink=i.querySelector("._se_tab_content_url .se-link-preview"),n.previewSrc=i.querySelector("._se_tab_content_image .se-link-preview"),i.querySelector(".se-dialog-tabs").addEventListener("click",this.openTab.bind(e)),i.querySelector(".se-btn-primary").addEventListener("click",this.submit.bind(e)),n.imgInputFile&&i.querySelector(".se-file-remove").addEventListener("click",this._removeSelectedFiles.bind(n.imgInputFile,n.imgUrlFile,n.previewSrc)),n.imgInputFile&&n.imgUrlFile&&n.imgInputFile.addEventListener("change",this._fileInputChange.bind(n)),n.imgLink.addEventListener("input",this._onLinkPreview.bind(n.previewLink,n._v_link,t.options.linkProtocol)),n.imgUrlFile&&n.imgUrlFile.addEventListener("input",this._onLinkPreview.bind(n.previewSrc,n._v_src,t.options.linkProtocol));const l=i.querySelector(".__se__gallery");l&&l.addEventListener("click",this._openGallery.bind(e)),n.proportion={},n.inputX={},n.inputY={},t.option.imageResizing&&(n.proportion=i.querySelector("._se_image_check_proportion"),n.inputX=i.querySelector("._se_image_size_x"),n.inputY=i.querySelector("._se_image_size_y"),n.inputX.value=t.option.imageWidth,n.inputY.value=t.option.imageHeight,n.inputX.addEventListener("keyup",this.setInputSize.bind(e,"x")),n.inputY.addEventListener("keyup",this.setInputSize.bind(e,"y")),n.inputX.addEventListener("change",this.setRatio.bind(e)),n.inputY.addEventListener("change",this.setRatio.bind(e)),n.proportion.addEventListener("change",this.setRatio.bind(e)),i.querySelector(".se-dialog-btn-revert").addEventListener("click",this.sizeRevert.bind(e))),t.dialog.modal.appendChild(i),i=null},setDialog:function(){const e=this.context.option,t=this.lang,n=this.util.createElement("DIV");n.className="se-dialog-content",n.style.display="none";let i='
    '+t.dialogBox.imageBox.title+'
    ';if(e.imageFileInput&&(i+='
    "),e.imageUrlInput&&(i+='
    '+(e.imageGalleryUrl&&this.plugins.imageGallery?'":"")+'
    '),i+='
    ',e.imageResizing){const n=e.imageSizeOnlyPercentage,l=n?' style="display: none !important;"':"",o=e.imageHeightShow?"":' style="display: none !important;"';i+='
    ',n||!e.imageHeightShow?i+='
    ":i+='
    ",i+=' '+t.dialogBox.proportion+'
    "}return i+='
    ",n.innerHTML=i,n},_fileInputChange:function(){this.imgInputFile.value?(this.imgUrlFile.setAttribute("disabled",!0),this.previewSrc.style.textDecoration="line-through"):(this.imgUrlFile.removeAttribute("disabled"),this.previewSrc.style.textDecoration="")},_removeSelectedFiles:function(e,t){this.value="",e&&(e.removeAttribute("disabled"),t.style.textDecoration="")},_openGallery:function(){this.callPlugin("imageGallery",this.plugins.imageGallery.open.bind(this,this.plugins.image._setUrlInput.bind(this.context.image)),null)},_setUrlInput:function(e){this.altText.value=e.alt,this._v_src._linkValue=this.previewSrc.textContent=this.imgUrlFile.value=e.src,this.imgUrlFile.focus()},_onLinkPreview:function(e,t,n){const i=n.target.value.trim();e._linkValue=this.textContent=i?t&&-1===i.indexOf("://")&&0!==i.indexOf("#")?t+i:-1===i.indexOf("://")?"/"+i:i:""},fileTags:["img"],select:function(e){this.plugins.image.onModifyMode.call(this,e,this.plugins.resizing.call_controller_resize.call(this,e,"image"))},destroy:function(e){const t=e||this.context.image._element,n=this.util.getParentElement(t,this.util.isMediaComponent)||t,i=1*t.getAttribute("data-index");let l=n.previousElementSibling||n.nextElementSibling;const o=n.parentNode;this.util.removeItem(n),this.plugins.image.init.call(this),this.controllersOff(),o!==this.context.element.wysiwyg&&this.util.removeItemAllParents(o,(function(e){return 0===e.childNodes.length}),null),this.focusEdge(l),this.plugins.fileManager.deleteInfo.call(this,"image",i,this.functions.onImageUpload),this.history.push(!1)},on:function(e){const t=this.context.image;e?t.imgInputFile&&this.context.options.imageMultipleFile&&t.imgInputFile.removeAttribute("multiple"):(t.inputX.value=t._origin_w=this.context.option.imageWidth===t._defaultSizeX?"":this.context.option.imageWidth,t.inputY.value=t._origin_h=this.context.option.imageHeight===t._defaultSizeY?"":this.context.option.imageHeight,t.imgInputFile&&this.context.options.imageMultipleFile&&t.imgInputFile.setAttribute("multiple","multiple"))},open:function(){this.plugins.dialog.open.call(this,"image","image"===this.currentControllerName)},openTab:function(e){const t=this.context.image.modal,n="init"===e?t.querySelector("._se_tab_link"):e.target;if(!/^BUTTON$/i.test(n.tagName))return!1;const i=n.getAttribute("data-tab-link");let l,o,s;for(o=t.getElementsByClassName("_se_tab_content"),l=0;l0?(this.showLoading(),n.submitAction.call(this,this.context.image.imgInputFile.files)):t.imgUrlFile&&t._v_src._linkValue.length>0&&(this.showLoading(),n.onRender_imgUrl.call(this))}catch(e){throw this.closeLoading(),Error('[SUNEDITOR.image.submit.fail] cause : "'+e.message+'"')}finally{this.plugins.dialog.close.call(this)}return!1},submitAction:function(e){if(0===e.length)return;let t=0,n=[];for(let i=0,l=e.length;i0){let e=0;const n=this.context.image._infoList;for(let t=0,i=n.length;ti){this.closeLoading();const n="[SUNEDITOR.imageUpload.fail] Size of uploadable total images: "+i/1e3+"KB";return void(("function"!==this.functions.onImageUploadError||this.functions.onImageUploadError(n,{limitSize:i,currentSize:e,uploadSize:t},this))&&this.functions.noticeOpen(n))}}const l=this.context.image;l._uploadFileLength=n.length;const o={linkValue:l._v_link._linkValue,linkNewWindow:l.imgLinkNewWindowCheck.checked,inputWidth:l.inputX.value,inputHeight:l.inputY.value,align:l._align,isUpdate:this.context.dialog.updateModal,element:l._element};if("function"==typeof this.functions.onImageUploadBefore){const e=this.functions.onImageUploadBefore(n,o,this,function(e){e&&this._w.Array.isArray(e.result)?this.plugins.image.register.call(this,o,e):this.plugins.image.upload.call(this,o,e)}.bind(this));if(void 0===e)return;if(!e)return void this.closeLoading();this._w.Array.isArray(e)&&e.length>0&&(n=e)}this.plugins.image.upload.call(this,o,n)},error:function(e,t){if(this.closeLoading(),"function"!=typeof this.functions.onImageUploadError||this.functions.onImageUploadError(e,t,this))throw this.functions.noticeOpen(e),Error("[SUNEDITOR.plugin.image.error] response: "+e)},upload:function(e,t){if(!t)return void this.closeLoading();if("string"==typeof t)return void this.plugins.image.error.call(this,t,null);const n=this.context.option.imageUploadUrl,i=this.context.dialog.updateModal?1:t.length;if("string"==typeof n&&n.length>0){const l=new FormData;for(let e=0;e0){const i=this.util.createElement("A");return i.href=/^https?:\/\//.test(t)?t:"http://"+t,i.target=n?"_blank":"",i.setAttribute("data-image-link","image"),e.setAttribute("data-image-link",t),i.appendChild(e),i}return e},setInputSize:function(e,t){t&&32===t.keyCode?t.preventDefault():this.plugins.resizing._module_setInputSize.call(this,this.context.image,e)},setRatio:function(){this.plugins.resizing._module_setRatio.call(this,this.context.image)},checkFileInfo:function(){const e=this.plugins.image,t=function(t){e.onModifyMode.call(this,t,null),e.openModify.call(this,!0),e.update_image.call(this,!0,!1,!0)}.bind(this);this.plugins.fileManager.checkInfo.call(this,"image",["img"],this.functions.onImageUpload,t,!0)},resetFileInfo:function(){this.plugins.fileManager.resetInfo.call(this,"image",this.functions.onImageUpload)},create_image:function(e,t,n,i,l,o,s){const a=this.plugins.image,r=this.context.image;this.context.resizing._resize_plugin="image";let c=this.util.createElement("IMG");c.src=e,c.alt=r._altText,c=a.onRender_link.call(this,c,t,n),c.setAttribute("data-rotate","0"),r._resizing&&c.setAttribute("data-proportion",r._proportionChecked);const d=this.plugins.component.set_cover.call(this,c),u=this.plugins.component.set_container.call(this,d,"se-image-container");r._captionChecked&&(r._caption=this.plugins.component.create_caption.call(this),r._caption.setAttribute("contenteditable",!1),d.appendChild(r._caption)),r._element=c,r._cover=d,r._container=u,a.applySize.call(this,i,l),a.setAlign.call(this,o,c,d,u),c.onload=a._image_create_onload.bind(this,c,r.svgDefaultSize),this.insertComponent(u,!0,!0,!0)&&this.plugins.fileManager.setInfo.call(this,"image",c,this.functions.onImageUpload,s,!0),this.context.resizing._resize_plugin=""},_image_create_onload:function(e,t){0===e.offsetWidth&&this.plugins.image.applySize.call(this,t,""),this.selectComponent.call(this,e,"image")},update_image:function(e,t,n){const i=this.context.image,l=i._v_link._linkValue;let o,s=i._element,a=i._cover,r=i._container,c=!1;null===a&&(c=!0,s=i._element.cloneNode(!0),a=this.plugins.component.set_cover.call(this,s)),null===r?(a=a.cloneNode(!0),s=a.querySelector("img"),c=!0,r=this.plugins.component.set_container.call(this,a,"se-image-container")):c&&(r.innerHTML="",r.appendChild(a),i._cover=a,i._element=s,c=!1);const d=this.util.isNumber(i.inputX.value)?i.inputX.value+i.sizeUnit:i.inputX.value,u=this.util.isNumber(i.inputY.value)?i.inputY.value+i.sizeUnit:i.inputY.value;o=/%$/.test(s.style.width)?d!==r.style.width||u!==r.style.height:d!==s.style.width||u!==s.style.height,s.alt=i._altText;let h=!1;if(i._captionChecked?i._caption||(i._caption=this.plugins.component.create_caption.call(this),a.appendChild(i._caption),h=!0):i._caption&&(this.util.removeItem(i._caption),i._caption=null,h=!0),l.trim().length>0)if(null!==i._linkElement&&a.contains(i._linkElement))i._linkElement.href=l,i._linkElement.target=i.imgLinkNewWindowCheck.checked?"_blank":"",s.setAttribute("data-image-link",l);else{let e=this.plugins.image.onRender_link.call(this,s,l,this.context.image.imgLinkNewWindowCheck.checked);a.insertBefore(e,i._caption)}else if(null!==i._linkElement){const e=s;e.setAttribute("data-image-link","");let t=e.cloneNode(!0);a.removeChild(i._linkElement),a.insertBefore(t,i._caption),s=t}if(c){const e=this.util.isRangeFormatElement(i._element.parentNode)||this.util.isWysiwygDiv(i._element.parentNode)?i._element:/^A$/i.test(i._element.parentNode.nodeName)?i._element.parentNode:this.util.getFormatElement(i._element)||i._element;e.parentNode.replaceChild(r,e),s=r.querySelector("img"),i._element=s,i._cover=a,i._container=r}(h||!i._onlyPercentage&&o)&&!e&&(/\d+/.test(s.style.height)||this.context.resizing._rotateVertical&&i._captionChecked)&&(/%$/.test(i.inputX.value)||/%$/.test(i.inputY.value)?this.plugins.resizing.resetTransform.call(this,s):this.plugins.resizing.setTransformSize.call(this,s,this.util.getNumber(i.inputX.value,0),this.util.getNumber(i.inputY.value,0)));i._resizing&&(s.setAttribute("data-proportion",i._proportionChecked),o&&this.plugins.image.applySize.call(this)),this.plugins.image.setAlign.call(this,null,s,null,null),e&&this.plugins.fileManager.setInfo.call(this,"image",s,this.functions.onImageUpload,null,!0),t&&this.selectComponent(s,"image"),n||this.history.push(!1)},update_src:function(e,t,n){t.src=e,this._w.setTimeout(this.plugins.fileManager.setInfo.bind(this,"image",t,this.functions.onImageUpload,n,!0)),this.selectComponent(t,"image")},onModifyMode:function(e,t){if(!e)return;const n=this.context.image;n._linkElement=/^A$/i.test(e.parentNode.nodeName)?e.parentNode:null,n._element=e,n._cover=this.util.getParentElement(e,"FIGURE"),n._container=this.util.getParentElement(e,this.util.isMediaComponent),n._caption=this.util.getChildElement(n._cover,"FIGCAPTION"),n._align=e.getAttribute("data-align")||"none",t&&(n._element_w=t.w,n._element_h=t.h,n._element_t=t.t,n._element_l=t.l);let i=n._element.getAttribute("data-size")||n._element.getAttribute("data-origin");i?(i=i.split(","),n._origin_w=i[0],n._origin_h=i[1]):t&&(n._origin_w=t.w,n._origin_h=t.h)},openModify:function(e){const t=this.context.image;t.imgUrlFile&&(t._v_src._linkValue=t.previewSrc.textContent=t.imgUrlFile.value=t._element.src),t._altText=t.altText.value=t._element.alt,t._v_link._linkValue=t.previewLink.textContent=t.imgLink.value=null===t._linkElement?"":t._linkElement.href,t.imgLinkNewWindowCheck.checked=t._linkElement&&"_blank"===t._linkElement.target,t.modal.querySelector('input[name="suneditor_image_radio"][value="'+t._align+'"]').checked=!0,t._align=t.modal.querySelector('input[name="suneditor_image_radio"]:checked').value,t._captionChecked=t.captionCheckEl.checked=!!t._caption,t._resizing&&this.plugins.resizing._module_setModifyInputSize.call(this,t,this.plugins.image),e||this.plugins.dialog.open.call(this,"image",!0)},sizeRevert:function(){this.plugins.resizing._module_sizeRevert.call(this,this.context.image)},applySize:function(e,t){const n=this.context.image;return e||(e=n.inputX.value||this.context.option.imageWidth),t||(t=n.inputY.value||this.context.option.imageHeight),n._onlyPercentage&&e||/%$/.test(e)?(this.plugins.image.setPercentSize.call(this,e,t),!0):(e&&"auto"!==e||t&&"auto"!==t?this.plugins.image.setSize.call(this,e,t,!1):this.plugins.image.setAutoSize.call(this),!1)},setSize:function(e,t,n,i){const l=this.context.image,o=/^(rw|lw)$/.test(i),s=/^(th|bh)$/.test(i);this.plugins.image.cancelPercentAttr.call(this),s||(l._element.style.width=this.util.isNumber(e)?e+l.sizeUnit:e),o||(l._element.style.height=this.util.isNumber(t)?t+l.sizeUnit:/%$/.test(t)?"":t),"center"===l._align&&this.plugins.image.setAlign.call(this,null,null,null,null),n||l._element.removeAttribute("data-percentage"),this.plugins.resizing._module_saveCurrentSize.call(this,l)},setAutoSize:function(){const e=this.context.image;this.plugins.resizing.resetTransform.call(this,e._element),this.plugins.image.cancelPercentAttr.call(this),e._element.style.maxWidth="",e._element.style.width="",e._element.style.height="",e._cover.style.width="",e._cover.style.height="",this.plugins.image.setAlign.call(this,null,null,null,null),e._element.setAttribute("data-percentage","auto,auto"),this.plugins.resizing._module_saveCurrentSize.call(this,e)},setOriginSize:function(){const e=this.context.image;e._element.removeAttribute("data-percentage"),this.plugins.resizing.resetTransform.call(this,e._element),this.plugins.image.cancelPercentAttr.call(this);const t=(e._element.getAttribute("data-origin")||"").split(","),n=t[0],i=t[1];t&&(e._onlyPercentage||/%$/.test(n)&&(/%$/.test(i)||!/\d/.test(i))?this.plugins.image.setPercentSize.call(this,n,i):this.plugins.image.setSize.call(this,n,i),this.plugins.resizing._module_saveCurrentSize.call(this,e))},setPercentSize:function(e,t){const n=this.context.image;t=!t||/%$/.test(t)||this.util.getNumber(t,0)?this.util.isNumber(t)?t+n.sizeUnit:t||"":this.util.isNumber(t)?t+"%":t;const i=/%$/.test(t);n._container.style.width=this.util.isNumber(e)?e+"%":e,n._container.style.height="",n._cover.style.width="100%",n._cover.style.height=i?t:"",n._element.style.width="100%",n._element.style.height=i?"":t,n._element.style.maxWidth="","center"===n._align&&this.plugins.image.setAlign.call(this,null,null,null,null),n._element.setAttribute("data-percentage",e+","+t),this.plugins.resizing.setCaptionPosition.call(this,n._element),this.plugins.resizing._module_saveCurrentSize.call(this,n)},cancelPercentAttr:function(){const e=this.context.image;e._cover.style.width="",e._cover.style.height="",e._container.style.width="",e._container.style.height="",this.util.removeClass(e._container,this.context.image._floatClassRegExp),this.util.addClass(e._container,"__se__float-"+e._align),"center"===e._align&&this.plugins.image.setAlign.call(this,null,null,null,null)},setAlign:function(e,t,n,i){const l=this.context.image;e||(e=l._align),t||(t=l._element),n||(n=l._cover),i||(i=l._container),n.style.margin=e&&"none"!==e?"auto":"0",/%$/.test(t.style.width)&&"center"===e?(i.style.minWidth="100%",n.style.width=i.style.width):(i.style.minWidth="",n.style.width=this.context.resizing._rotateVertical?t.style.height||t.offsetHeight:t.style.width&&"auto"!==t.style.width?t.style.width||"100%":""),this.util.hasClass(i,"__se__float-"+e)||(this.util.removeClass(i,l._floatClassRegExp),this.util.addClass(i,"__se__float-"+e)),t.setAttribute("data-align",e)},resetAlign:function(){const e=this.context.image;e._element.setAttribute("data-align",""),e._align="none",e._cover.style.margin="0",this.util.removeClass(e._container,e._floatClassRegExp)},init:function(){const e=this.context.image;e.imgInputFile&&(e.imgInputFile.value=""),e.imgUrlFile&&(e._v_src._linkValue=e.previewSrc.textContent=e.imgUrlFile.value=""),e.imgInputFile&&e.imgUrlFile&&(e.imgUrlFile.removeAttribute("disabled"),e.previewSrc.style.textDecoration=""),e.altText.value="",e._v_link._linkValue=e.previewLink.textContent=e.imgLink.value="",e.imgLinkNewWindowCheck.checked=!1,e.modal.querySelector('input[name="suneditor_image_radio"][value="none"]').checked=!0,e.captionCheckEl.checked=!1,e._element=null,this.plugins.image.openTab.call(this,"init"),e._resizing&&(e.inputX.value=this.context.option.imageWidth===e._defaultSizeX?"":this.context.option.imageWidth,e.inputY.value=this.context.option.imageHeight===e._defaultSizeY?"":this.context.option.imageHeight,e.proportion.checked=!0,e._ratio=!1,e._ratioX=1,e._ratioY=1)}},_={name:"video",display:"dialog",add:function(e){e.addModule([r.a,u.a,g.a,m.a]);const t=e.context,n=t.video={_infoList:[],_infoIndex:0,_uploadFileLength:0,sizeUnit:t.option._videoSizeUnit,_align:"none",_floatClassRegExp:"__se__float\\-[a-z]+",_youtubeQuery:t.option.youtubeQuery,_videoRatio:100*t.option.videoRatio+"%",_defaultRatio:100*t.option.videoRatio+"%",_linkValue:"",_element:null,_cover:null,_container:null,inputX:null,inputY:null,_element_w:1,_element_h:1,_element_l:0,_element_t:0,_defaultSizeX:"100%",_defaultSizeY:100*t.option.videoRatio+"%",_origin_w:"100%"===t.option.videoWidth?"":t.option.videoWidth,_origin_h:"56.25%"===t.option.videoHeight?"":t.option.videoHeight,_proportionChecked:!0,_resizing:t.option.videoResizing,_resizeDotHide:!t.option.videoHeightShow,_rotation:t.option.videoRotation,_onlyPercentage:t.option.videoSizeOnlyPercentage,_ratio:!1,_ratioX:1,_ratioY:1,_captionShow:!1};let i=this.setDialog.call(e);n.modal=i,n.videoInputFile=i.querySelector("._se_video_file"),n.videoUrlFile=i.querySelector(".se-input-url"),n.focusElement=n.videoUrlFile||n.videoInputFile,n.preview=i.querySelector(".se-link-preview"),i.querySelector(".se-btn-primary").addEventListener("click",this.submit.bind(e)),n.videoInputFile&&i.querySelector(".se-dialog-files-edge-button").addEventListener("click",this._removeSelectedFiles.bind(n.videoInputFile,n.videoUrlFile,n.preview)),n.videoInputFile&&n.videoUrlFile&&n.videoInputFile.addEventListener("change",this._fileInputChange.bind(n)),n.videoUrlFile&&n.videoUrlFile.addEventListener("input",this._onLinkPreview.bind(n.preview,n,t.options.linkProtocol)),n.proportion={},n.videoRatioOption={},n.inputX={},n.inputY={},t.option.videoResizing&&(n.proportion=i.querySelector("._se_video_check_proportion"),n.videoRatioOption=i.querySelector(".se-video-ratio"),n.inputX=i.querySelector("._se_video_size_x"),n.inputY=i.querySelector("._se_video_size_y"),n.inputX.value=t.option.videoWidth,n.inputY.value=t.option.videoHeight,n.inputX.addEventListener("keyup",this.setInputSize.bind(e,"x")),n.inputY.addEventListener("keyup",this.setInputSize.bind(e,"y")),n.inputX.addEventListener("change",this.setRatio.bind(e)),n.inputY.addEventListener("change",this.setRatio.bind(e)),n.proportion.addEventListener("change",this.setRatio.bind(e)),n.videoRatioOption.addEventListener("change",this.setVideoRatio.bind(e)),i.querySelector(".se-dialog-btn-revert").addEventListener("click",this.sizeRevert.bind(e))),t.dialog.modal.appendChild(i),i=null},setDialog:function(){const e=this.context.option,t=this.lang,n=this.util.createElement("DIV");n.className="se-dialog-content",n.style.display="none";let i='
    '+t.dialogBox.videoBox.title+'
    ';if(e.videoFileInput&&(i+='
    "),e.videoUrlInput&&(i+='
    '),e.videoResizing){const n=e.videoRatioList||[{name:"16:9",value:.5625},{name:"4:3",value:.75},{name:"21:9",value:.4285}],l=e.videoRatio,o=e.videoSizeOnlyPercentage,s=o?' style="display: none !important;"':"",a=e.videoHeightShow?"":' style="display: none !important;"',r=e.videoRatioShow?"":' style="display: none !important;"',c=o||e.videoHeightShow||e.videoRatioShow?"":' style="display: none !important;"';i+='
    "}return i+='
    ",n.innerHTML=i,n},_fileInputChange:function(){this.videoInputFile.value?(this.videoUrlFile.setAttribute("disabled",!0),this.preview.style.textDecoration="line-through"):(this.videoUrlFile.removeAttribute("disabled"),this.preview.style.textDecoration="")},_removeSelectedFiles:function(e,t){this.value="",e&&(e.removeAttribute("disabled"),t.style.textDecoration="")},_onLinkPreview:function(e,t,n){const i=n.target.value.trim();/^$/.test(i)?(e._linkValue=i,this.textContent=''):e._linkValue=this.textContent=i?t&&-1===i.indexOf("://")&&0!==i.indexOf("#")?t+i:-1===i.indexOf("://")?"/"+i:i:""},_setTagAttrs:function(e){e.setAttribute("controls",!0);const t=this.context.options.videoTagAttrs;if(t)for(let n in t)this.util.hasOwn(t,n)&&e.setAttribute(n,t[n])},createVideoTag:function(){const e=this.util.createElement("VIDEO");return this.plugins.video._setTagAttrs.call(this,e),e},_setIframeAttrs:function(e){e.frameBorder="0",e.allowFullscreen=!0;const t=this.context.options.videoIframeAttrs;if(t)for(let n in t)this.util.hasOwn(t,n)&&e.setAttribute(n,t[n])},createIframeTag:function(){const e=this.util.createElement("IFRAME");return this.plugins.video._setIframeAttrs.call(this,e),e},fileTags:["iframe","video"],select:function(e){this.plugins.video.onModifyMode.call(this,e,this.plugins.resizing.call_controller_resize.call(this,e,"video"))},destroy:function(e){const t=e||this.context.video._element,n=this.context.video._container,i=1*t.getAttribute("data-index");let l=n.previousElementSibling||n.nextElementSibling;const o=n.parentNode;this.util.removeItem(n),this.plugins.video.init.call(this),this.controllersOff(),o!==this.context.element.wysiwyg&&this.util.removeItemAllParents(o,(function(e){return 0===e.childNodes.length}),null),this.focusEdge(l),this.plugins.fileManager.deleteInfo.call(this,"video",i,this.functions.onVideoUpload),this.history.push(!1)},on:function(e){const t=this.context.video;e?t.videoInputFile&&this.context.options.videoMultipleFile&&t.videoInputFile.removeAttribute("multiple"):(t.inputX.value=t._origin_w=this.context.option.videoWidth===t._defaultSizeX?"":this.context.option.videoWidth,t.inputY.value=t._origin_h=this.context.option.videoHeight===t._defaultSizeY?"":this.context.option.videoHeight,t.proportion.disabled=!0,t.videoInputFile&&this.context.options.videoMultipleFile&&t.videoInputFile.setAttribute("multiple","multiple")),t._resizing&&this.plugins.video.setVideoRatioSelect.call(this,t._origin_h||t._defaultRatio)},open:function(){this.plugins.dialog.open.call(this,"video","video"===this.currentControllerName)},setVideoRatio:function(e){const t=this.context.video,n=e.target.options[e.target.selectedIndex].value;t._defaultSizeY=t._videoRatio=n?100*n+"%":t._defaultSizeY,t.inputY.placeholder=n?100*n+"%":"",t.inputY.value=""},setInputSize:function(e,t){if(t&&32===t.keyCode)return void t.preventDefault();const n=this.context.video;this.plugins.resizing._module_setInputSize.call(this,n,e),"y"===e&&this.plugins.video.setVideoRatioSelect.call(this,t.target.value||n._defaultRatio)},setRatio:function(){this.plugins.resizing._module_setRatio.call(this,this.context.video)},submit:function(e){const t=this.context.video,n=this.plugins.video;e.preventDefault(),e.stopPropagation(),t._align=t.modal.querySelector('input[name="suneditor_video_radio"]:checked').value;try{t.videoInputFile&&t.videoInputFile.files.length>0?(this.showLoading(),n.submitAction.call(this,this.context.video.videoInputFile.files)):t.videoUrlFile&&t._linkValue.length>0&&(this.showLoading(),n.setup_url.call(this))}catch(e){throw this.closeLoading(),Error('[SUNEDITOR.video.submit.fail] cause : "'+e.message+'"')}finally{this.plugins.dialog.close.call(this)}return!1},submitAction:function(e){if(0===e.length)return;let t=0,n=[];for(let i=0,l=e.length;i0){let e=0;const n=this.context.video._infoList;for(let t=0,i=n.length;ti){this.closeLoading();const n="[SUNEDITOR.videoUpload.fail] Size of uploadable total videos: "+i/1e3+"KB";return void(("function"!==this.functions.onVideoUploadError||this.functions.onVideoUploadError(n,{limitSize:i,currentSize:e,uploadSize:t},this))&&this.functions.noticeOpen(n))}}const l=this.context.video;l._uploadFileLength=n.length;const o={inputWidth:l.inputX.value,inputHeight:l.inputY.value,align:l._align,isUpdate:this.context.dialog.updateModal,element:l._element};if("function"==typeof this.functions.onVideoUploadBefore){const e=this.functions.onVideoUploadBefore(n,o,this,function(e){e&&this._w.Array.isArray(e.result)?this.plugins.video.register.call(this,o,e):this.plugins.video.upload.call(this,o,e)}.bind(this));if(void 0===e)return;if(!e)return void this.closeLoading();"object"==typeof e&&e.length>0&&(n=e)}this.plugins.video.upload.call(this,o,n)},error:function(e,t){if(this.closeLoading(),"function"!=typeof this.functions.onVideoUploadError||this.functions.onVideoUploadError(e,t,this))throw this.functions.noticeOpen(e),Error("[SUNEDITOR.plugin.video.error] response: "+e)},upload:function(e,t){if(!t)return void this.closeLoading();if("string"==typeof t)return void this.plugins.video.error.call(this,t,null);const n=this.context.option.videoUploadUrl,i=this.context.dialog.updateModal?1:t.length;if(!("string"==typeof n&&n.length>0))throw Error('[SUNEDITOR.videoUpload.fail] cause : There is no "videoUploadUrl" option.');{const l=new FormData;for(let e=0;e$/.test(t)){if(t=(new this._w.DOMParser).parseFromString(t,"text/html").querySelector("iframe").src,0===t.length)return!1}if(/youtu\.?be/.test(t)){if(/^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("&","?&")),e._youtubeQuery.length>0)if(/\?/.test(t)){const n=t.split("?");t=n[0]+"?"+e._youtubeQuery+"&"+n[1]}else t+="?"+e._youtubeQuery}else/vimeo\.com/.test(t)&&(t.endsWith("/")&&(t=t.slice(0,-1)),t="https://player.vimeo.com/video/"+t.slice(t.lastIndexOf("/")+1));this.plugins.video.create_video.call(this,this.plugins.video.createIframeTag.call(this),t,e.inputX.value,e.inputY.value,e._align,null,this.context.dialog.updateModal)}catch(e){throw Error('[SUNEDITOR.video.upload.fail] cause : "'+e.message+'"')}finally{this.closeLoading()}},create_video:function(e,t,n,i,l,o,s){this.context.resizing._resize_plugin="video";const a=this.context.video;let r=null,c=null,d=!1;if(s){if((e=a._element).src!==t){d=!0;const n=/youtu\.?be/.test(t),i=/vimeo\.com/.test(t);if(!n&&!i||/^iframe$/i.test(e.nodeName))if(n||i||/^videoo$/i.test(e.nodeName))e.src=t;else{const n=this.plugins.video.createVideoTag.call(this);n.src=t,e.parentNode.replaceChild(n,e),a._element=e=n}else{const n=this.plugins.video.createIframeTag.call(this);n.src=t,e.parentNode.replaceChild(n,e),a._element=e=n}}c=a._container,r=this.util.getParentElement(e,"FIGURE")}else d=!0,e.src=t,a._element=e,r=this.plugins.component.set_cover.call(this,e),c=this.plugins.component.set_container.call(this,r,"se-video-container");a._cover=r,a._container=c;const u=this.plugins.resizing._module_getSizeX.call(this,a)!==(n||a._defaultSizeX)||this.plugins.resizing._module_getSizeY.call(this,a)!==(i||a._videoRatio),h=!s||u;a._resizing&&(this.context.video._proportionChecked=a.proportion.checked,e.setAttribute("data-proportion",a._proportionChecked));let g=!1;h&&(g=this.plugins.video.applySize.call(this)),g&&"center"===l||this.plugins.video.setAlign.call(this,null,e,r,c);let p=!0;s?a._resizing&&this.context.resizing._rotateVertical&&h&&this.plugins.resizing.setTransformSize.call(this,e,null,null):p=this.insertComponent(c,!1,!0,!1),p&&(d&&this.plugins.fileManager.setInfo.call(this,"video",e,this.functions.onVideoUpload,o,!0),s&&(this.selectComponent(e,"video"),this.history.push(!1))),this.context.resizing._resize_plugin=""},_update_videoCover:function(e){if(!e)return;const t=this.context.video;/^video$/i.test(e.nodeName)?this.plugins.video._setTagAttrs.call(this,e):this.plugins.video._setIframeAttrs.call(this,e);const n=this.util.getParentElement(e,this.util.isMediaComponent)||this.util.getParentElement(e,function(e){return this.isWysiwygDiv(e.parentNode)}.bind(this.util));t._element=e=e.cloneNode(!0);const i=t._cover=this.plugins.component.set_cover.call(this,e),l=t._container=this.plugins.component.set_container.call(this,i,"se-video-container"),o=n.querySelector("figcaption");let s=null;o&&(s=this.util.createElement("DIV"),s.innerHTML=o.innerHTML,this.util.removeItem(o));const a=(e.getAttribute("data-size")||e.getAttribute("data-origin")||"").split(",");this.plugins.video.applySize.call(this,a[0],a[1]),n.parentNode.replaceChild(l,n),s&&n.parentNode.insertBefore(s,l.nextElementSibling),this.plugins.fileManager.setInfo.call(this,"video",e,this.functions.onVideoUpload,null,!0)},onModifyMode:function(e,t){const n=this.context.video;n._element=e,n._cover=this.util.getParentElement(e,"FIGURE"),n._container=this.util.getParentElement(e,this.util.isMediaComponent),n._align=e.getAttribute("data-align")||"none",t&&(n._element_w=t.w,n._element_h=t.h,n._element_t=t.t,n._element_l=t.l);let i=n._element.getAttribute("data-size")||n._element.getAttribute("data-origin");i?(i=i.split(","),n._origin_w=i[0],n._origin_h=i[1]):t&&(n._origin_w=t.w,n._origin_h=t.h)},openModify:function(e){const t=this.context.video;if(t.videoUrlFile&&(t._linkValue=t.preview.textContent=t.videoUrlFile.value=t._element.src||(t._element.querySelector("source")||"").src||""),t.modal.querySelector('input[name="suneditor_video_radio"][value="'+t._align+'"]').checked=!0,t._resizing){this.plugins.resizing._module_setModifyInputSize.call(this,t,this.plugins.video);const e=t._videoRatio=this.plugins.resizing._module_getSizeY.call(this,t);this.plugins.video.setVideoRatioSelect.call(this,e)||(t.inputY.value=t._onlyPercentage?this.util.getNumber(e,2):e)}e||this.plugins.dialog.open.call(this,"video",!0)},setVideoRatioSelect:function(e){let t=!1;const n=this.context.video,i=n.videoRatioOption.options;/%$/.test(e)||n._onlyPercentage?e=this.util.getNumber(e,2)/100+"":(!this.util.isNumber(e)||1*e>=1)&&(e=""),n.inputY.placeholder="";for(let l=0,o=i.length;l'+this.icons.cancel+''+t.dialogBox.audioBox.title+'
    ';return e.audioFileInput&&(i+='
    "),e.audioUrlInput&&(i+='
    '),i+='
    ",n.innerHTML=i,n},setController:function(){const e=this.lang,t=this.icons,n=this.util.createElement("DIV");return n.className="se-controller se-controller-link",n.innerHTML='
    ",n},_fileInputChange:function(){this.audioInputFile.value?(this.audioUrlFile.setAttribute("disabled",!0),this.preview.style.textDecoration="line-through"):(this.audioUrlFile.removeAttribute("disabled"),this.preview.style.textDecoration="")},_removeSelectedFiles:function(e,t){this.value="",e&&(e.removeAttribute("disabled"),t.style.textDecoration="")},_createAudioTag:function(){const e=this.util.createElement("AUDIO");this.plugins.audio._setTagAttrs.call(this,e);const t=this.context.audio._origin_w,n=this.context.audio._origin_h;return e.setAttribute("origin-size",t+","+n),e.style.cssText=(t?"width:"+t+"; ":"")+(n?"height:"+n+";":""),e},_setTagAttrs:function(e){e.setAttribute("controls",!0);const t=this.context.options.audioTagAttrs;if(t)for(let n in t)this.util.hasOwn(t,n)&&e.setAttribute(n,t[n])},_onLinkPreview:function(e,t,n){const i=n.target.value.trim();e._linkValue=this.textContent=i?t&&-1===i.indexOf("://")&&0!==i.indexOf("#")?t+i:-1===i.indexOf("://")?"/"+i:i:""},fileTags:["audio"],select:function(e){this.plugins.audio.onModifyMode.call(this,e)},destroy:function(e){e=e||this.context.audio._element;const t=this.util.getParentElement(e,this.util.isComponent)||e,n=1*e.getAttribute("data-index"),i=t.previousElementSibling||t.nextElementSibling,l=t.parentNode;this.util.removeItem(t),this.plugins.audio.init.call(this),this.controllersOff(),l!==this.context.element.wysiwyg&&this.util.removeItemAllParents(l,(function(e){return 0===e.childNodes.length}),null),this.focusEdge(i),this.plugins.fileManager.deleteInfo.call(this,"audio",n,this.functions.onAudioUpload),this.history.push(!1)},checkFileInfo:function(){this.plugins.fileManager.checkInfo.call(this,"audio",["audio"],this.functions.onAudioUpload,this.plugins.audio.updateCover.bind(this),!1)},resetFileInfo:function(){this.plugins.fileManager.resetInfo.call(this,"audio",this.functions.onAudioUpload)},on:function(e){const t=this.context.audio;e?t._element?(this.context.dialog.updateModal=!0,t._linkValue=t.preview.textContent=t.audioUrlFile.value=t._element.src,t.audioInputFile&&this.context.options.audioMultipleFile&&t.audioInputFile.removeAttribute("multiple")):t.audioInputFile&&this.context.options.audioMultipleFile&&t.audioInputFile.removeAttribute("multiple"):(this.plugins.audio.init.call(this),t.audioInputFile&&this.context.options.audioMultipleFile&&t.audioInputFile.setAttribute("multiple","multiple"))},open:function(){this.plugins.dialog.open.call(this,"audio","audio"===this.currentControllerName)},submit:function(e){const t=this.context.audio;e.preventDefault(),e.stopPropagation();try{t.audioInputFile&&t.audioInputFile.files.length>0?(this.showLoading(),this.plugins.audio.submitAction.call(this,t.audioInputFile.files)):t.audioUrlFile&&t._linkValue.length>0&&(this.showLoading(),this.plugins.audio.setupUrl.call(this,t._linkValue))}catch(e){throw this.closeLoading(),Error('[SUNEDITOR.audio.submit.fail] cause : "'+e.message+'"')}finally{this.plugins.dialog.close.call(this)}return!1},submitAction:function(e){if(0===e.length)return;let t=0,n=[];for(let i=0,l=e.length;i0){let e=0;const n=this.context.audio._infoList;for(let t=0,i=n.length;ti){this.closeLoading();const n="[SUNEDITOR.audioUpload.fail] Size of uploadable total audios: "+i/1e3+"KB";return void(("function"!==this.functions.onAudioUploadError||this.functions.onAudioUploadError(n,{limitSize:i,currentSize:e,uploadSize:t},this))&&this.functions.noticeOpen(n))}}const l=this.context.audio;l._uploadFileLength=n.length;const o={isUpdate:this.context.dialog.updateModal,element:l._element};if("function"==typeof this.functions.onAudioUploadBefore){const e=this.functions.onAudioUploadBefore(n,o,this,function(e){e&&this._w.Array.isArray(e.result)?this.plugins.audio.register.call(this,o,e):this.plugins.audio.upload.call(this,o,e)}.bind(this));if(void 0===e)return;if(!e)return void this.closeLoading();"object"==typeof e&&e.length>0&&(n=e)}this.plugins.audio.upload.call(this,o,n)},error:function(e,t){if(this.closeLoading(),"function"!=typeof this.functions.onAudioUploadError||this.functions.onAudioUploadError(e,t,this))throw this.functions.noticeOpen(e),Error("[SUNEDITOR.plugin.audio.exception] response: "+e)},upload:function(e,t){if(!t)return void this.closeLoading();if("string"==typeof t)return void this.plugins.audio.error.call(this,t,null);const n=this.context.option.audioUploadUrl,i=this.context.dialog.updateModal?1:t.length,l=new FormData;for(let e=0;e'+this.icons.cancel+''+e.dialogBox.mathBox.title+'

    ",t},setController_MathButton:function(){const e=this.lang,t=this.util.createElement("DIV");return t.className="se-controller se-controller-link",t.innerHTML='
    ",t},open:function(){this.plugins.dialog.open.call(this,"math","math"===this.currentControllerName)},managedTags:function(){return{className:"katex",method:function(e){if(!e.getAttribute("data-exp"))return;const t=this._d.createRange().createContextualFragment(this.plugins.math._renderer.call(this,this.util.HTMLDecoder(e.getAttribute("data-exp"))));e.innerHTML=t.querySelector(".katex").innerHTML}}},_renderer:function(e){const t=this.context.option.katex;return t.src.renderToString(e,t.options)},_renderMathExp:function(e,t){e.previewElement.innerHTML=this.plugins.math._renderer.call(this,t.target.value)},submit:function(e){this.showLoading(),e.preventDefault(),e.stopPropagation();const t=function(){if(0===this.context.math.focusElement.value.trim().length)return!1;const e=this.context.math,t=e.focusElement.value,n=e.previewElement.querySelector(".katex");if(!n)return!1;if(n.className="__se__katex "+n.className,n.setAttribute("contenteditable",!1),n.setAttribute("data-exp",this.util.HTMLEncoder(t)),n.setAttribute("data-font-size",e.fontSizeElement.value),n.style.fontSize=e.fontSizeElement.value,this.context.dialog.updateModal){const t=this.util.getParentElement(e._mathExp,".katex");t.parentNode.replaceChild(n,t),this.setRange(n,0,n,1)}else{const e=this.getSelectedElements();if(e.length>1){const t=this.util.createElement(e[0].nodeName);if(t.appendChild(n),!this.insertNode(t,null,!0))return!1}else if(!this.insertNode(n,null,!0))return!1;const t=this.util.createTextNode(this.util.zeroWidthSpace);n.parentNode.insertBefore(t,n.nextSibling),this.setRange(n,0,n,1)}return e.focusElement.value="",e.fontSizeElement.value="1em",e.previewElement.style.fontSize="1em",e.previewElement.innerHTML="",!0}.bind(this);try{t()&&(this.plugins.dialog.close.call(this),this.history.push(!1))}catch(e){this.plugins.dialog.close.call(this)}finally{this.closeLoading()}return!1},active:function(e){if(e){if(e.getAttribute("data-exp"))return this.controllerArray.indexOf(this.context.math.mathController)<0&&(this.setRange(e,0,e,1),this.plugins.math.call_controller.call(this,e)),!0}else this.controllerArray.indexOf(this.context.math.mathController)>-1&&this.controllersOff();return!1},on:function(e){if(e){const e=this.context.math;if(e._mathExp){const t=this.util.HTMLDecoder(e._mathExp.getAttribute("data-exp")),n=e._mathExp.getAttribute("data-font-size")||"1em";this.context.dialog.updateModal=!0,e.focusElement.value=t,e.fontSizeElement.value=n,e.previewElement.innerHTML=this.plugins.math._renderer.call(this,t),e.previewElement.style.fontSize=n}}else this.plugins.math.init.call(this)},call_controller:function(e){this.context.math._mathExp=e;const t=this.context.math.mathController,n=this.util.getOffset(e,this.context.element.wysiwygFrame);t.style.top=n.top+e.offsetHeight+10+"px",t.style.left=n.left-this.context.element.wysiwygFrame.scrollLeft+"px",t.style.display="block";const i=this.context.element.wysiwygFrame.offsetWidth-(t.offsetLeft+t.offsetWidth);i<0?(t.style.left=t.offsetLeft+i+"px",t.firstElementChild.style.left=20-i+"px"):t.firstElementChild.style.left="20px",this.controllersOn(t,e,"math")},onClick_mathController:function(e){e.stopPropagation();const t=e.target.getAttribute("data-command")||e.target.parentNode.getAttribute("data-command");t&&(e.preventDefault(),/update/.test(t)?(this.context.math.focusElement.value=this.util.HTMLDecoder(this.context.math._mathExp.getAttribute("data-exp")),this.plugins.dialog.open.call(this,"math",!0)):(this.util.removeItem(this.context.math._mathExp),this.context.math._mathExp=null,this.focus(),this.history.push(!1)),this.controllersOff())},init:function(){const e=this.context.math;e.mathController.style.display="none",e._mathExp=null,e.focusElement.value="",e.previewElement.innerHTML=""}};var y={name:"mention",display:"dialog",title:"Mention",innerHTML:'',renderItem:function(e){return`${e}`},getItems:function(e){return Promise.resolve(["overwite","the","mention","plugin","getItems","method"].filter(t=>t.includes(e.toLowerCase())))},renderList:function(e){const{mention:t}=this.context;let n=Promise.resolve();t.term!==e&&(t.focussed=0,t.term=e,n=t.getItems(e).then(e=>{t.items=e,Object.keys(t._itemElements).forEach(n=>{if(!e.find(e=>t.getId(e)===n)){const e=t._itemElements[n];e.parentNode.removeChild(e),delete t._itemElements[n]}}),e.forEach((e,n)=>{const i=t.getId(e);if(!t._itemElements[i]){const a=this.util.createElement("LI");a.setAttribute("data-mention",i),this.util.addClass(a,"se-mention-item"),a.innerHTML=t.renderItem(e),a.addEventListener("click",()=>{t.focussed=n,t.addMention()}),l=t.list,o=a,(s=n)||(s=0),s>=l.children.length?l.appendChild(o):l.insertBefore(o,l.children[s]),t._itemElements[i]=a}var l,o,s})})),n.then(()=>{const e=t.list.querySelectorAll(".se-mention-item")[t.focussed];if(e&&!this.util.hasClass(e,"se-mention-active")){const n=t.list.querySelector(".se-mention-active");n&&this.util.removeClass(n,"se-mention-active"),this.util.addClass(e,"se-mention-active")}})},setDialog:function(){const e=this.util.createElement("DIV"),t=this.lang;e.className="se-dialog-content",e.style.display="none";const n=`\n
    \n
    \n \n ${t.dialogBox.mentionBox.title}\n
    \n
    \n \n
      \n
    \n
    \n
    \n `;return e.innerHTML=n,e},getId:e=>e,getValue:e=>"@"+e,getLinkHref:()=>"",open:function(){const{mention:e}=this.context;this.plugins.dialog.open.call(this,"mention","mention"===this.currentControllerName),e.search.focus(),e.renderList("")},on:function(e){e||this.plugins.mention.init.call(this)},init:function(){const{mention:e}=this.context;e.search.value="",e.focussed=0,e.items=[],e._itemElements={},e.list.innerHTML="",delete e.term},onKeyPress:function(e){const{mention:t}=this.context;switch(e.key){case"ArrowDown":t.focussed+=1,e.preventDefault(),e.stopPropagation();break;case"ArrowUp":t.focussed>0&&(t.focussed-=1),e.preventDefault(),e.stopPropagation();break;case"Enter":t.addMention(),e.preventDefault(),e.stopPropagation()}},onKeyUp:function(e){const{mention:t}=this.context;t.renderList(e.target.value)},getMentions:function(){const{mentions:e,getId:t}=this.context.mention;return e.filter(e=>{const n=t(e);return this.context.element.wysiwyg.querySelector(`[data-mention="${n}"]`)})},addMention:function(){const{mention:e}=this.context,t=e.items[e.focussed];if(t){e.mentions.find(n=>e.getId(n)===e.getId(t))||e.mentions.push(t);const n=this.util.createElement("A");n.href=e.getLinkHref(t),n.target="_blank",n.innerHTML=e.getValue(t),n.setAttribute("data-mention",e.getId(t)),this.insertNode(n,null,!1);const i=this.util.createElement("SPAN");i.innerHTML=" ",this.insertNode(i,n,!1)}this.plugins.dialog.close.call(this)},add:function(e){e.addModule([r.a]),this.title=e.lang.toolbar.mention;const t=this.setDialog.call(e);e.getMentions=this.getMentions.bind(e);const n=t.querySelector(".se-mention-search");n.addEventListener("keyup",this.onKeyUp.bind(e)),n.addEventListener("keydown",this.onKeyPress.bind(e));const i=t.querySelector(".se-mention-list");e.context.mention={modal:t,search:n,list:i,triggerKey:this.triggerKey,visible:!1,addMention:this.addMention.bind(e),mentions:[],items:[],_itemElements:{},renderList:this.renderList.bind(e),getId:this.getId.bind(e),getValue:this.getValue.bind(e),getLinkHref:this.getLinkHref.bind(e),open:this.open.bind(e),focussed:0,renderItem:this.renderItem,getItems:this.getItems},e.context.dialog.modal.appendChild(t)},action:function(){}},C=n("JhlZ"),w=n.n(C),x={blockquote:{name:"blockquote",display:"command",add:function(e,t){e.context.blockquote={targetButton:t,tag:e.util.createElement("BLOCKQUOTE")}},active:function(e){if(e){if(/blockquote/i.test(e.nodeName))return this.util.addClass(this.context.blockquote.targetButton,"active"),!0}else this.util.removeClass(this.context.blockquote.targetButton,"active");return!1},action:function(){const e=this.util.getParentElement(this.getSelectionNode(),"blockquote");e?this.detachRangeFormatElement(e,null,null,!1,!1):this.applyRangeFormatElement(this.context.blockquote.tag.cloneNode(!1))}},align:{name:"align",display:"submenu",add:function(e,t){const n=e.icons,i=e.context;i.align={targetButton:t,_alignList:null,currentAlign:"",icons:{justify:n.align_justify,left:n.align_left,right:n.align_right,center:n.align_center}};let l=this.setSubmenu.call(e),o=l.querySelector("ul");o.addEventListener("click",this.pickup.bind(e)),i.align._alignList=o.querySelectorAll("li button"),e.initMenuTarget(this.name,t,l),l=null,o=null},setSubmenu:function(){const e=this.lang,t=this.icons,n=this.util.createElement("DIV");return n.className="se-submenu se-list-layer se-list-align",n.innerHTML='
    ",n},active:function(e){const t=this.context.align.targetButton,n=t.firstElementChild;if(e){if(this.util.isFormatElement(e)){const i=e.style.textAlign;if(i)return this.util.changeElement(n,this.context.align.icons[i]),t.setAttribute("data-focus",i),!0}}else this.util.changeElement(n,this.context.align.icons.left),t.removeAttribute("data-focus");return!1},on:function(){const e=this.context.align,t=e._alignList,n=e.targetButton.getAttribute("data-focus")||"left";if(n!==e.currentAlign){for(let e=0,i=t.length;e('+t.toolbar.default+")";for(o=0,s=a.length;o";return r+="",n.innerHTML=r,n},active:function(e){const t=this.context.font.targetText,n=this.context.font.targetTooltip;if(e){if(e.style&&e.style.fontFamily.length>0){const i=e.style.fontFamily.replace(/["']/g,"");return this.util.changeTxt(t,i),this.util.changeTxt(n,i),!0}}else{const e=this.lang.toolbar.font;this.util.changeTxt(t,e),this.util.changeTxt(n,e)}return!1},on:function(){const e=this.context.font,t=e._fontList,n=e.targetText.textContent;if(n!==e.currentFont){for(let e=0,i=t.length;e('+t.toolbar.default+")";for(let t,n=0,o=e.fontSizeUnit,s=i.length;n";return l+="",n.innerHTML=l,n},active:function(e){if(e){if(e.style&&e.style.fontSize.length>0)return this.util.changeTxt(this.context.fontSize.targetText,e.style.fontSize),!0}else this.util.changeTxt(this.context.fontSize.targetText,this.lang.toolbar.fontSize);return!1},on:function(){const e=this.context.fontSize,t=e._sizeList,n=e.targetText.textContent;if(n!==e.currentSize){for(let e=0,i=t.length;e
  • ',t},appendHr:function(e){const t=this.util.createElement("HR");return t.className=e,this.focus(),this.insertComponent(t,!1,!0,!1)},horizontalRulePick:function(e){e.preventDefault(),e.stopPropagation();let t=e.target,n=null;for(;!n&&!/UL/i.test(t.tagName);)n=t.getAttribute("data-value"),t=t.parentNode;if(!n)return;const i=this.plugins.horizontalRule.appendHr.call(this,"__se__"+n);i&&(this.setRange(i,0,i,0),this.submenuOff())}},list:{name:"list",display:"submenu",add:function(e,t){const n=e.context;n.list={targetButton:t,_list:null,currentList:"",icons:{bullets:e.icons.list_bullets,number:e.icons.list_number}};let i=this.setSubmenu.call(e),l=i.querySelector("ul");l.addEventListener("click",this.pickup.bind(e)),n.list._list=l.querySelectorAll("li button"),e.initMenuTarget(this.name,t,i),i=null,l=null},setSubmenu:function(){const e=this.lang,t=this.util.createElement("DIV");return t.className="se-submenu se-list-layer",t.innerHTML='
    ",t},active:function(e){const t=this.context.list.targetButton,n=t.firstElementChild,i=this.util;if(e){if(i.isList(e)){const l=e.nodeName;return t.setAttribute("data-focus",l),i.addClass(t,"active"),/UL/i.test(l)?i.changeElement(n,this.context.list.icons.bullets):i.changeElement(n,this.context.list.icons.number),!0}}else t.removeAttribute("data-focus"),i.changeElement(n,this.context.list.icons.number),i.removeClass(t,"active");return!1},on:function(){const e=this.context.list,t=e._list,n=e.targetButton.getAttribute("data-focus")||"";if(n!==e.currentList){for(let e=0,i=t.length;e"),t.innerHTML+=n.outerHTML,e&&(t.innerHTML+="
    ")}else{const e=n.childNodes;for(;e[0];)t.appendChild(e[0])}a.appendChild(t),r||(u=a),r&&m===g&&!o.isRangeFormatElement(f)||(d||(d=a),i&&r&&m===g||r&&o.isList(g)&&g===c||a.parentNode!==m&&m.insertBefore(a,f)),o.removeItem(n),i&&null===h&&(h=a.children.length-1),r&&(o.getRangeFormatElement(g,p)!==o.getRangeFormatElement(c,p)||o.isList(g)&&o.isList(c)&&o.getElementDepth(g)!==o.getElementDepth(c))&&(a=o.createElement(e)),_&&0===_.children.length&&o.removeItem(_)}else o.removeItem(n);h&&(d=d.children[h]),s&&(g=a.children.length-1,a.innerHTML+=c.innerHTML,u=a.children[g],o.removeItem(c))}else{if(n)for(let e=0,t=l.length;e=0;n--)if(l[n].contains(l[e])){l.splice(e,1),e--,t--;break}const t=o.getRangeFormatElement(s),i=t&&t.tagName===e;let a,r;const c=function(e){return!this.isComponent(e)}.bind(o);i||(r=o.createElement(e));for(let t,s,d=0,u=l.length;d0){const e=l.cloneNode(!1),t=l.childNodes,o=this.util.getPositionIndex(i);for(;t[o];)e.appendChild(t[o]);n.appendChild(e)}0===l.children.length&&this.util.removeItem(l),this.util.mergeSameTags(s);const a=this.util.getEdgeChildNodes(t,n);return{cc:t.parentNode,sc:a.sc,ec:a.ec}},editInsideList:function(e,t){const n=(t=t||this.getSelectedElements().filter(function(e){return this.isListCell(e)}.bind(this.util))).length;if(0===n||!e&&!this.util.isListCell(t[0].previousElementSibling)&&!this.util.isListCell(t[n-1].nextElementSibling))return{sc:t[0],so:0,ec:t[n-1],eo:1};let i=t[0].parentNode,l=t[n-1],o=null;if(e){if(i!==l.parentNode&&this.util.isList(l.parentNode.parentNode)&&l.nextElementSibling)for(l=l.nextElementSibling;l;)t.push(l),l=l.nextElementSibling;o=this.plugins.list.editList.call(this,i.nodeName.toUpperCase(),t,!0)}else{let e=this.util.createElement(i.nodeName),s=t[0].previousElementSibling,a=l.nextElementSibling;const r={s:null,e:null,sl:i,el:i};for(let l,o=0,c=n;o span > span"),n.table.columnFixedButton=o.querySelector("._se_table_fixed_column"),n.table.headerButton=o.querySelector("._se_table_header"),o.addEventListener("mousedown",e.eventStop);let s=this.setController_tableEditor.call(e,n.table.cellControllerTop);n.table.resizeDiv=s,n.table.splitMenu=s.querySelector(".se-btn-group-sub"),n.table.mergeButton=s.querySelector("._se_table_merge_button"),n.table.splitButton=s.querySelector("._se_table_split_button"),n.table.insertRowAboveButton=s.querySelector("._se_table_insert_row_a"),n.table.insertRowBelowButton=s.querySelector("._se_table_insert_row_b"),s.addEventListener("mousedown",e.eventStop),l.addEventListener("mousemove",this.onMouseMove_tablePicker.bind(e)),l.addEventListener("click",this.appendTable.bind(e)),s.addEventListener("click",this.onClick_tableController.bind(e)),o.addEventListener("click",this.onClick_tableController.bind(e)),e.initMenuTarget(this.name,t,i),n.element.relative.appendChild(s),n.element.relative.appendChild(o),i=null,l=null,s=null,o=null},setSubmenu:function(){const e=this.util.createElement("DIV");return e.className="se-submenu se-selector-table",e.innerHTML='
    1 x 1
    ',e},setController_table:function(){const e=this.lang,t=this.icons,n=this.util.createElement("DIV");return n.className="se-controller se-controller-table",n.innerHTML='
    ",n},setController_tableEditor:function(e){const t=this.lang,n=this.icons,i=this.util.createElement("DIV");return i.className="se-controller se-controller-table-cell",i.innerHTML=(e?"":'
    ')+'
    • '+t.controller.VerticalSplit+'
    • '+t.controller.HorizontalSplit+"
    ",i},appendTable:function(){const e=this.util.createElement("TABLE"),t=this.plugins.table.createCells,n=this.context.table._tableXY[0];let i=this.context.table._tableXY[1],l="";for(;i>0;)l+=""+t.call(this,"td",n)+"",--i;l+="",e.innerHTML=l;if(this.insertComponent(e,!1,!0,!1)){const t=e.querySelector("td div");this.setRange(t,0,t,0),this.plugins.table.reset_table_picker.call(this)}},createCells:function(e,t,n){if(e=e.toLowerCase(),n){const t=this.util.createElement(e);return t.innerHTML="

    ",t}{let n="";for(;t>0;)n+="<"+e+">

    ",t--;return n}},onMouseMove_tablePicker:function(e){e.stopPropagation();let t=this._w.Math.ceil(e.offsetX/18),n=this._w.Math.ceil(e.offsetY/18);t=t<1?1:t,n=n<1?1:n,this.context.table.tableHighlight.style.width=t+"em",this.context.table.tableHighlight.style.height=n+"em";this.context.table.tableUnHighlight.style.width="10em",this.context.table.tableUnHighlight.style.height="10em",this.util.changeTxt(this.context.table.tableDisplay,t+" x "+n),this.context.table._tableXY=[t,n]},reset_table_picker:function(){if(!this.context.table.tableHighlight)return;const e=this.context.table.tableHighlight.style,t=this.context.table.tableUnHighlight.style;e.width="1em",e.height="1em",t.width="10em",t.height="10em",this.util.changeTxt(this.context.table.tableDisplay,"1 x 1"),this.submenuOff()},init:function(){const e=this.context.table,t=this.plugins.table;if(t._removeEvents.call(this),t._selectedTable){const e=t._selectedTable.querySelectorAll(".se-table-selected-cell");for(let t=0,n=e.length;t0)for(let e,t=0;to||(u>=e.index?(i+=e.cs,u+=e.cs,e.rs-=1,e.row=o+1,e.rs<1&&(r.splice(t,1),t--)):h===g-1&&(e.rs-=1,e.row=o+1,e.rs<1&&(r.splice(t,1),t--)));if(o===s&&h===l){n._logical_cellIndex=u;break}d>0&&a.push({index:u,cs:c+1,rs:d,row:-1}),i+=c}r=r.concat(a).sort((function(e,t){return e.index-t.index})),a=[]}a=null,r=null}},editTable:function(e,t){const n=this.plugins.table,i=this.context.table,l=i._element,o="row"===e;if(o){const e=i._trElement.parentNode;if(/^THEAD$/i.test(e.nodeName)){if("up"===t)return;if(!e.nextElementSibling||!/^TBODY$/i.test(e.nextElementSibling.nodeName))return void(l.innerHTML+=""+n.createCells.call(this,"td",i._logical_cellCnt,!1)+"")}}if(n._ref){const e=i._tdElement,l=n._selectedCells;if(o)if(t)n.setCellInfo.call(this,"up"===t?l[0]:l[l.length-1],!0),n.editRow.call(this,t,e);else{let e=l[0].parentNode;const i=[l[0]];for(let t,n=1,o=l.length;ns&&s>t&&(e[l].rowSpan=n+a,c-=i)}if(i){const e=r[o+1];if(e){const t=[];let n=r[o].cells,i=0;for(let e,l,o=0,s=n.length;o1&&(e.rowSpan-=1,t.push({cell:e.cloneNode(!1),index:l}));if(t.length>0){let l=t.shift();n=e.cells,i=0;for(let o,s,a=0,r=n.length;a=l.index)||(a--,i--,i+=l.cell.colSpan-1,e.insertBefore(l.cell,o),l=t.shift(),l));a++);if(l){e.appendChild(l.cell);for(let n=0,i=t.length;n0){const e=!o[b+1];for(let t,n=0;n_||(p>=t.index?(f+=t.cs,p=b+f,t.rs-=1,t.row=_+1,t.rs<1&&(d.splice(n,1),n--)):e&&(t.rs-=1,t.row=_+1,t.rs<1&&(d.splice(n,1),n--)))}n>0&&c.push({rs:n,cs:r+1,index:p,row:-1}),p>=t&&p+r<=t+s?h.push(e):p<=t+s&&p+r>=t?e.colSpan-=i.getOverlapRangeAtIndex(a,a+s,p,p+r):n>0&&(pt+s)&&g.push({cell:e,i:_,rs:_+n}),f+=r}else{if(b>=t)break;if(r>0){if(u<1&&r+b>=t){e.colSpan+=1,t=null,u=n+1;break}t-=r}if(!m){for(let e,n=0;n0){u-=1;continue}null!==t&&o.length>0&&(p=this.plugins.table.createCells.call(this,o[0].nodeName,0,!0),p=e.insertBefore(p,o[t]))}}if(l){let e,t;for(let n,l=0,o=h.length;l1)c.colSpan=this._w.Math.floor(e/2),l.colSpan=e-c.colSpan,s.insertBefore(c,l.nextElementSibling);else{let t=[],n=[];for(let s,r,c=0,d=i._rowCnt;c0)for(let e,t=0;tc||(u>=e.index?(r+=e.cs,u+=e.cs,e.rs-=1,e.row=c+1,e.rs<1&&(n.splice(t,1),t--)):h===g-1&&(e.rs-=1,e.row=c+1,e.rs<1&&(n.splice(t,1),t--)));if(u<=a&&d>0&&t.push({index:u,cs:o+1,rs:d,row:-1}),i!==l&&u<=a&&u+o>=a+e-1){i.colSpan+=1;break}if(u>a)break;r+=o}n=n.concat(t).sort((function(e,t){return e.index-t.index})),t=[]}s.insertBefore(c,l.nextElementSibling)}}else{const e=l.rowSpan;if(c.colSpan=l.colSpan,e>1){c.rowSpan=this._w.Math.floor(e/2);const n=e-c.rowSpan,i=[],r=t.getArrayIndex(o,s)+n;for(let e,t,n=0;n=a));c++)l=e[c],o=l.rowSpan-1,o>0&&o+n>=r&&s=h.index&&(r+=h.cs,l+=h.cs,h=i.shift()),l>=a||o===s-1){d.insertBefore(c,e.nextElementSibling);break}r+=t}l.rowSpan=n}else{c.rowSpan=l.rowSpan;const e=t.createElement("TR");e.appendChild(c);for(let e,t=0;t=r&&(e[n].rowSpan+=1)}const n=i._physical_cellIndex,a=s.cells;for(let e=0,t=a.length;e0&&s+o>=i&&(e.rowSpan-=n.getOverlapRangeAtIndex(i,l,s,s+o));else o.push(e[s]);for(let e=0,t=o.length;e"+this.plugins.table.createCells.call(this,"th",this.context.table._logical_cellCnt,!1)+"",i.insertBefore(t,i.firstElementChild)}e.toggleClass(t,"active"),/TH/i.test(this.context.table._tdElement.nodeName)?this.controllersOff():this.plugins.table.setPositionControllerDiv.call(this,this.context.table._tdElement,!1)},setTableStyle:function(e){const t=this.context.table,n=t._element;let i,l,o,s;e.indexOf("width")>-1&&(i=t.resizeButton.firstElementChild,l=t.resizeText,t._maxWidth?(o=t.icons.reduction,s=t.minText,t.columnFixedButton.style.display="block",this.util.removeClass(n,"se-table-size-auto"),this.util.addClass(n,"se-table-size-100")):(o=t.icons.expansion,s=t.maxText,t.columnFixedButton.style.display="none",this.util.removeClass(n,"se-table-size-100"),this.util.addClass(n,"se-table-size-auto")),this.util.changeElement(i,o),this.util.changeTxt(l,s)),e.indexOf("column")>-1&&(t._fixedColumn?(this.util.removeClass(n,"se-table-layout-auto"),this.util.addClass(n,"se-table-layout-fixed"),this.util.addClass(t.columnFixedButton,"active")):(this.util.removeClass(n,"se-table-layout-fixed"),this.util.addClass(n,"se-table-layout-auto"),this.util.removeClass(t.columnFixedButton,"active")))},setActiveButton:function(e,t){const n=this.context.table;/^TH$/i.test(e.nodeName)?(n.insertRowAboveButton.setAttribute("disabled",!0),n.insertRowBelowButton.setAttribute("disabled",!0)):(n.insertRowAboveButton.removeAttribute("disabled"),n.insertRowBelowButton.removeAttribute("disabled")),t&&e!==t?(n.splitButton.setAttribute("disabled",!0),n.mergeButton.removeAttribute("disabled")):(n.splitButton.removeAttribute("disabled"),n.mergeButton.setAttribute("disabled",!0))},_bindOnSelect:null,_bindOffSelect:null,_bindOffShift:null,_selectedCells:null,_shift:!1,_fixedCell:null,_fixedCellName:null,_selectedCell:null,_selectedTable:null,_ref:null,_toggleEditor:function(e){this.context.element.wysiwyg.setAttribute("contenteditable",e),e?this.util.removeClass(this.context.element.wysiwyg,"se-disabled"):this.util.addClass(this.context.element.wysiwyg,"se-disabled")},_offCellMultiSelect:function(e){e.stopPropagation();const t=this.plugins.table;t._shift?t._initBind&&(this._wd.removeEventListener("touchmove",t._initBind),t._initBind=null):(t._removeEvents.call(this),t._toggleEditor.call(this,!0)),t._fixedCell&&t._selectedTable&&(t.setActiveButton.call(this,t._fixedCell,t._selectedCell),t.call_controller_tableEdit.call(this,t._selectedCell||t._fixedCell),t._selectedCells=t._selectedTable.querySelectorAll(".se-table-selected-cell"),t._selectedCell&&t._fixedCell&&this.focusEdge(t._selectedCell),t._shift||(t._fixedCell=null,t._selectedCell=null,t._fixedCellName=null))},_onCellMultiSelect:function(e){this._antiBlur=!0;const t=this.plugins.table,n=this.util.getParentElement(e.target,this.util.isCell);if(t._shift)n===t._fixedCell?t._toggleEditor.call(this,!0):t._toggleEditor.call(this,!1);else if(!t._ref){if(n===t._fixedCell)return;t._toggleEditor.call(this,!1)}n&&n!==t._selectedCell&&t._fixedCellName===n.nodeName&&t._selectedTable===this.util.getParentElement(n,"TABLE")&&(t._selectedCell=n,t._setMultiCells.call(this,t._fixedCell,n))},_setMultiCells:function(e,t){const n=this.plugins.table,i=n._selectedTable.rows,l=this.util,o=n._selectedTable.querySelectorAll(".se-table-selected-cell");for(let e=0,t=o.length;e0)for(let e,t=0;td||(u>=e.index?(o+=e.cs,u+=e.cs,e.rs-=1,e.row=d+1,e.rs<1&&(a.splice(t,1),t--)):p===m-1&&(e.rs-=1,e.row=d+1,e.rs<1&&(a.splice(t,1),t--)));if(s){if(i!==e&&i!==t||(c.cs=null!==c.cs&&c.csu+h?c.ce:u+h,c.rs=null!==c.rs&&c.rsd+g?c.re:d+g,c._i+=1),2===c._i){s=!1,a=[],r=[],d=-1;break}}else if(l.getOverlapRangeAtIndex(c.cs,c.ce,u,u+h)&&l.getOverlapRangeAtIndex(c.rs,c.re,d,d+g)){const e=c.csu+h?c.ce:u+h,n=c.rsd+g?c.re:d+g;if(c.cs!==e||c.ce!==t||c.rs!==n||c.re!==o){c.cs=e,c.ce=t,c.rs=n,c.re=o,d=-1,a=[],r=[];break}l.addClass(i,"se-table-selected-cell")}g>0&&r.push({index:u,cs:h+1,rs:g,row:-1}),o+=i.colSpan-1}a=a.concat(r).sort((function(e,t){return e.index-t.index})),r=[]}},_removeEvents:function(){const e=this.plugins.table;e._initBind&&(this._wd.removeEventListener("touchmove",e._initBind),e._initBind=null),e._bindOnSelect&&(this._wd.removeEventListener("mousedown",e._bindOnSelect),this._wd.removeEventListener("mousemove",e._bindOnSelect),e._bindOnSelect=null),e._bindOffSelect&&(this._wd.removeEventListener("mouseup",e._bindOffSelect),e._bindOffSelect=null),e._bindOffShift&&(this._wd.removeEventListener("keyup",e._bindOffShift),e._bindOffShift=null)},_initBind:null,onTableCellMultiSelect:function(e,t){const n=this.plugins.table;n._removeEvents.call(this),this.controllersOff(),n._shift=t,n._fixedCell=e,n._fixedCellName=e.nodeName,n._selectedTable=this.util.getParentElement(e,"TABLE");const i=n._selectedTable.querySelectorAll(".se-table-selected-cell");for(let e=0,t=i.length;e-1?(n=e.toLowerCase(),s="blockquote"===n?"range":"pre"===n?"free":"replace",r=/^h/.test(n)?n.match(/\d+/)[0]:"",a=t["tag_"+(r?"h":n)]+r,d="",c=""):(n=e.tag.toLowerCase(),s=e.command,a=e.name||n,d=e.class,c=d?' class="'+d+'"':""),o+='
  • ";return o+="",n.innerHTML=o,n},active:function(e){let t=this.lang.toolbar.formats;const n=this.context.formatBlock.targetText,i=this.context.formatBlock.targetTooltip;if(e){if(this.util.isFormatElement(e)){const l=this.context.formatBlock._formatList,o=e.nodeName.toLowerCase(),s=(e.className.match(/(\s|^)__se__format__[^\s]+/)||[""])[0].trim();for(let e,n=0,i=l.length;n=0;u--)if(i=p[u],i!==(p[u+1]?p[u+1].parentNode:null)){if(d=r.isComponent(i),o=d?"":i.innerHTML.replace(/(?!>)\s+(?=<)|\n/g," "),s=r.getParentElement(i,(function(e){return e.parentNode===t})),(t!==i.parentNode||d)&&(r.isFormatElement(t)?(t.parentNode.insertBefore(n,t.nextSibling),t=t.parentNode):(t.insertBefore(n,s?s.nextSibling:null),t=i.parentNode),a=n.nextSibling,a&&n.nodeName===a.nodeName&&r.isSameAttributes(n,a)&&(n.innerHTML+="
    "+a.innerHTML,r.removeItem(a)),n=l.cloneNode(!1),h=!0),c=n.innerHTML,n.innerHTML=(h||!o||!c||/
    $/i.test(o)?o:o+"
    ")+c,0===u){t.insertBefore(n,i),a=i.nextSibling,a&&n.nodeName===a.nodeName&&r.isSameAttributes(n,a)&&(n.innerHTML+="
    "+a.innerHTML,r.removeItem(a));const e=n.previousSibling;e&&n.nodeName===e.nodeName&&r.isSameAttributes(n,e)&&(e.innerHTML+="
    "+n.innerHTML,r.removeItem(n))}d||r.removeItem(i),o&&(h=!1)}this.setRange(i,0,i,0)}else{for(let e,t,n=0,s=p.length;n('+t.toolbar.default+")";for(let e,t=0,n=i.length;t";return l+="",n.innerHTML=l,n},on:function(){const e=this.context.lineHeight,t=e._sizeList,n=this.util.getFormatElement(this.getSelectionNode()),i=n?n.style.lineHeight+"":"";if(i!==e.currentSize){for(let e=0,n=t.length;e"}return o+="",t.innerHTML=o,t},on:function(){const e=this.context.paragraphStyle._classList,t=this.util.getFormatElement(this.getSelectionNode());for(let n=0,i=e.length;n"}return l+="",t.innerHTML=l,t},on:function(){const e=this.util,t=this.context.textStyle._styleList,n=this.getSelectionNode();for(let i,l,o,s=0,a=t.length;s'+(e.alt||t)+'
    '+(e.name||t)+"
    "},setImage:function(e){this.callPlugin("image",function(){const t={name:e.parentNode.querySelector(".__se__img_name").textContent,size:0};this.context.image._altText=e.alt,this.plugins.image.create_image.call(this,e.src,"",!1,this.context.image._origin_w,this.context.image._origin_h,"none",t)}.bind(this),null)}},mention:y},E={redo:'',undo:'',bold:'',underline:'',italic:'',strike:'',subscript:'',superscript:'',erase:'',indent:'',outdent:'',expansion:'',reduction:'',code_view:'',preview:'',print:'',template:'',line_height:'',paragraph_style:'',text_style:'',save:'',blockquote:'',arrow_down:'',align_justify:'',align_left:'',align_right:'',align_center:'',font_color:'',highlight_color:'',list_bullets:'',list_number:'',table:'',horizontal_rule:'',show_blocks:'',cancel:'',image:'',video:'',link:'',math:'',unlink:'',table_header:'',merge_cell:'',split_cell:'',caption:'',edit:'',delete:'',modify:'',revert:'',auto_size:'',insert_row_below:'',insert_row_above:'',insert_column_left:'',insert_column_right:'',delete_row:'',delete_column:'',fixed_column_width:'',rotate_left:'',rotate_right:'',mirror_horizontal:'',mirror_vertical:'',checked:'',line_break:'',audio:'',image_gallery:'',more_text:'',more_paragraph:'',more_plus:'',more_horizontal:'',more_vertical:'',attachment:'',map:'',magic_stick:'',empty_file:''},S=n("P6u4"),N=n.n(S);const T={_d:null,_w:null,isIE:null,isIE_Edge:null,isOSX_IOS:null,_propertiesInit:function(){this._d||(this._d=document,this._w=window,this.isIE=navigator.userAgent.indexOf("Trident")>-1,this.isIE_Edge=navigator.userAgent.indexOf("Trident")>-1||navigator.appVersion.indexOf("Edge")>-1,this.isOSX_IOS=/(Mac|iPhone|iPod|iPad)/.test(navigator.platform))},_HTMLConvertor:function(e){const t={"&":"&"," ":" ","'":"'",'"':""","<":"<",">":">"};return e.replace(/&|\u00A0|'|"|<|>/g,(function(e){return"string"==typeof t[e]?t[e]:e}))},zeroWidthSpace:String.fromCharCode(8203),zeroWidthRegExp:new RegExp(String.fromCharCode(8203),"g"),onlyZeroWidthRegExp:new RegExp("^"+String.fromCharCode(8203)+"+$"),onlyZeroWidthSpace:function(e){return"string"!=typeof e&&(e=e.textContent),""===e||this.onlyZeroWidthRegExp.test(e)},getXMLHttpRequest:function(){if(!this._w.ActiveXObject)return this._w.XMLHttpRequest?new XMLHttpRequest:null;try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(e){try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(e){return null}}},createElement:function(e){return this._d.createElement(e)},createTextNode:function(e){return this._d.createTextNode(e||"")},HTMLEncoder:function(e){const t={"<":"$lt;",">":"$gt;"};return e.replace(/<|>/g,(function(e){return"string"==typeof t[e]?t[e]:e}))},HTMLDecoder:function(e){const t={"$lt;":"<","$gt;":">"};return e.replace(/\$lt;|\$gt;/g,(function(e){return"string"==typeof t[e]?t[e]:e}))},hasOwn:function(e,t){return this._hasOwn.call(e,t)},_hasOwn:Object.prototype.hasOwnProperty,getIncludePath:function(e,t){let n="";const i=[],l="js"===t?"script":"link",o="js"===t?"src":"href";let s="(?:";for(let t=0,n=e.length;t0?i[0][o]:""),-1===n.indexOf(":/")&&"//"!==n.slice(0,2)&&(n=0===n.indexOf("/")?location.href.match(/^.*?:\/\/[^\/]*/)[0]+n:location.href.match(/^[^\?]*\/(?:)/)[0]+n),!n)throw"[SUNEDITOR.util.getIncludePath.fail] The SUNEDITOR installation path could not be automatically detected. (name: +"+name+", extension: "+t+")";return n},getPageStyle:function(e){let t="";const n=(e||this._d).styleSheets;for(let e,i=0,l=n.length;i-1||(i+=n[e].name+'="'+n[e].value+'" ');return i},getByteLength:function(e){const t=this._w.encodeURIComponent;let n,i;return this.isIE_Edge?(i=this._w.unescape(t(e.toString())).length,n=0,null!==t(e.toString()).match(/(%0A|%0D)/gi)&&(n=t(e.toString()).match(/(%0A|%0D)/gi).length),i+n):(i=new this._w.TextEncoder("utf-8").encode(e.toString()).length,n=0,null!==t(e.toString()).match(/(%0A|%0D)/gi)&&(n=t(e.toString()).match(/(%0A|%0D)/gi).length),i+n)},isWysiwygDiv:function(e){return e&&1===e.nodeType&&(this.hasClass(e,"se-wrapper-wysiwyg")||/^BODY$/i.test(e.nodeName))},isNonEditable:function(e){return e&&1===e.nodeType&&"false"===e.getAttribute("contenteditable")},isTextStyleElement:function(e){return e&&3!==e.nodeType&&/^(strong|span|font|b|var|i|em|u|ins|s|strike|del|sub|sup|mark|a|label|code)$/i.test(e.nodeName)},isFormatElement:function(e){return e&&1===e.nodeType&&(/^(P|DIV|H[1-6]|PRE|LI|TH|TD)$/i.test(e.nodeName)||this.hasClass(e,"(\\s|^)__se__format__replace_.+(\\s|$)|(\\s|^)__se__format__free_.+(\\s|$)"))&&!this.isComponent(e)&&!this.isWysiwygDiv(e)},isRangeFormatElement:function(e){return e&&1===e.nodeType&&(/^(BLOCKQUOTE|OL|UL|FIGCAPTION|TABLE|THEAD|TBODY|TR|TH|TD)$/i.test(e.nodeName)||this.hasClass(e,"(\\s|^)__se__format__range_.+(\\s|$)"))},isClosureRangeFormatElement:function(e){return e&&1===e.nodeType&&(/^(TH|TD)$/i.test(e.nodeName)||this.hasClass(e,"(\\s|^)__se__format__range__closure_.+(\\s|$)"))},isFreeFormatElement:function(e){return e&&1===e.nodeType&&(/^PRE$/i.test(e.nodeName)||this.hasClass(e,"(\\s|^)__se__format__free_.+(\\s|$)"))&&!this.isComponent(e)&&!this.isWysiwygDiv(e)},isClosureFreeFormatElement:function(e){return e&&1===e.nodeType&&this.hasClass(e,"(\\s|^)__se__format__free__closure_.+(\\s|$)")},isComponent:function(e){return e&&(/se-component/.test(e.className)||/^(TABLE|HR)$/.test(e.nodeName))},isMediaComponent:function(e){return e&&/se-component/.test(e.className)},isNotCheckingNode:function(e){return e&&/katex|__se__tag/.test(e.className)},getFormatElement:function(e,t){if(!e)return null;for(t||(t=function(){return!0});e;){if(this.isWysiwygDiv(e))return null;if(this.isRangeFormatElement(e)&&e.firstElementChild,this.isFormatElement(e)&&t(e))return e;e=e.parentNode}return null},getRangeFormatElement:function(e,t){if(!e)return null;for(t||(t=function(){return!0});e;){if(this.isWysiwygDiv(e))return null;if(this.isRangeFormatElement(e)&&!/^(THEAD|TBODY|TR)$/i.test(e.nodeName)&&t(e))return e;e=e.parentNode}return null},getFreeFormatElement:function(e,t){if(!e)return null;for(t||(t=function(){return!0});e;){if(this.isWysiwygDiv(e))return null;if(this.isFreeFormatElement(e)&&t(e))return e;e=e.parentNode}return null},getClosureFreeFormatElement:function(e,t){if(!e)return null;for(t||(t=function(){return!0});e;){if(this.isWysiwygDiv(e))return null;if(this.isClosureFreeFormatElement(e)&&t(e))return e;e=e.parentNode}return null},copyTagAttributes:function(e,t){t.style.cssText&&(e.style.cssText+=t.style.cssText);const n=t.classList;for(let t=0,i=n.length;ts?1:o0&&!this.isBreak(e);)e=e.firstChild;for(;t&&1===t.nodeType&&t.childNodes.length>0&&!this.isBreak(t);)t=t.lastChild;return{sc:e,ec:t||e}}},getOffset:function(e,t){let n=0,i=0,l=3===e.nodeType?e.parentElement:e;const o=this.getParentElement(e,this.isWysiwygDiv.bind(this));for(;l&&!this.hasClass(l,"se-container")&&l!==o;)n+=l.offsetLeft,i+=l.offsetTop,l=l.offsetParent;const s=t&&/iframe/i.test(t.nodeName);return{left:n+(s?t.parentElement.offsetLeft:0),top:i-o.scrollTop+(s?t.parentElement.offsetTop:0)}},getOverlapRangeAtIndex:function(e,t,n,i){if(e<=i?tn)return 0;const l=(e>n?e:n)-(t0?" ":"")+t)},removeClass:function(e,t){if(!e)return;const n=new this._w.RegExp("(\\s|^)"+t+"(\\s|$)");e.className=e.className.replace(n," ").trim(),e.className.trim()||e.removeAttribute("class")},toggleClass:function(e,t){if(!e)return;const n=new this._w.RegExp("(\\s|^)"+t+"(\\s|$)");n.test(e.className)?e.className=e.className.replace(n," ").trim():e.className+=" "+t,e.className.trim()||e.removeAttribute("class")},setDisabledButtons:function(e,t){for(let n=0,i=t.length;n=0){e.splitText(t);const n=this.getNodeFromPath([a+1],i);this.onlyZeroWidthSpace(n)&&(n.data=this.zeroWidthSpace)}}else 1===e.nodeType&&(e.previousSibling?e=e.previousSibling:this.getElementDepth(e)===n&&(r=!1));let c=e;for(;this.getElementDepth(c)>n;)for(a=this.getPositionIndex(c)+1,c=c.parentNode,s=l,l=c.cloneNode(!1),o=c.childNodes,s&&(this.isListCell(l)&&this.isList(s)&&s.firstElementChild?(l.innerHTML=s.firstElementChild.innerHTML,T.removeItem(s.firstElementChild),s.children.length>0&&l.appendChild(s)):l.appendChild(s));o[a];)l.appendChild(o[a]);c.childNodes.length<=1&&(!c.firstChild||0===c.firstChild.textContent.length)&&(c.innerHTML="
    ");const d=c.parentNode;return r&&(c=c.nextSibling),l?(this.mergeSameTags(l,null,!1),this.mergeNestedTags(l,function(e){return this.isList(e)}.bind(this)),l.childNodes.length>0?d.insertBefore(l,c):l=c,0===i.childNodes.length&&this.removeItem(i),l):c},mergeSameTags:function(e,t,n){const i=this,l=t?t.length:0;let o=null;return l&&(o=this._w.Array.apply(null,new this._w.Array(l)).map(this._w.Number.prototype.valueOf,0)),function e(s,a,r){const c=s.childNodes;for(let d,u,h=0,g=c.length;h=0;){if(i.getArrayIndex(o.childNodes,n)!==e[r]){c=!1;break}n=d.parentNode,o=n.parentNode,r--}c&&(e.splice(a,1),e[a]=h)}}i.copyTagAttributes(d,s),s.parentNode.insertBefore(d,s),i.removeItem(s)}if(!u){1===d.nodeType&&e(d,a+1,h);break}if(d.nodeName===u.nodeName&&i.isSameAttributes(d,u)&&d.href===u.href){const e=d.childNodes;let n=0;for(let t=0,i=e.length;t0&&n++;const s=d.lastChild,c=u.firstChild;let g=0;if(s&&c){const e=3===s.nodeType&&3===c.nodeType;g=s.textContent.length;let i=s.previousSibling;for(;i&&3===i.nodeType;)g+=i.textContent.length,i=i.previousSibling;if(n>0&&3===s.nodeType&&3===c.nodeType&&(s.textContent.length>0||c.textContent.length>0)&&n--,l){let i=null;for(let d=0;dh){if(a>0&&i[a-1]!==r)continue;i[a]-=1,i[a+1]>=0&&i[a]===h&&(i[a+1]+=n,e&&s&&3===s.nodeType&&c&&3===c.nodeType&&(o[d]+=g))}}}if(3===d.nodeType){if(g=d.textContent.length,d.textContent+=u.textContent,l){let e=null;for(let i=0;ih){if(a>0&&e[a-1]!==r)continue;e[a]-=1,e[a+1]>=0&&e[a]===h&&(e[a+1]+=n,o[i]+=g)}}}else d.innerHTML+=u.innerHTML;i.removeItem(u),h--}else 1===d.nodeType&&e(d,a+1,h)}}(e,0,0),o},mergeNestedTags:function(e,t){"string"==typeof t?t=function(e){return this.test(e.tagName)}.bind(new this._w.RegExp("^("+(t||".+")+")$","i")):"function"!=typeof t&&(t=function(){return!0}),function e(n){let i=n.children;if(1===i.length&&i[0].nodeName===n.nodeName&&t(n)){const e=i[0];for(i=e.children;i[0];)n.appendChild(i[0]);n.removeChild(e)}for(let t=0,i=n.children.length;t")},htmlRemoveWhiteSpace:function(e){return e?e.trim().replace(/<\/?(?!strong|span|font|b|var|i|em|u|ins|s|strike|del|sub|sup|mark|a|label|code)[^>^<]+>\s+(?=<)/gi,(function(e){return e.trim()})):""},sortByDepth:function(e,t){const n=t?1:-1,i=-1*n;e.sort(function(e,t){return this.isListCell(e)&&this.isListCell(t)?(e=this.getElementDepth(e))>(t=this.getElementDepth(t))?n:e":e.innerHTML,e.innerHTML=t.outerHTML},_setDefaultOptionStyle:function(e,t){let n="";e.height&&(n+="height:"+e.height+";"),e.minHeight&&(n+="min-height:"+e.minHeight+";"),e.maxHeight&&(n+="max-height:"+e.maxHeight+";"),e.position&&(n+="position:"+e.position+";"),e.width&&(n+="width:"+e.width+";"),e.minWidth&&(n+="min-width:"+e.minWidth+";"),e.maxWidth&&(n+="max-width:"+e.maxWidth+";");let i="",l="",o="";const s=(t=n+t).split(";");for(let t,n=0,a=s.length;n'+this._setIframeCssTags(t),e.contentDocument.body.className="sun-editor-editable",e.contentDocument.body.setAttribute("contenteditable",!0)},_setIframeCssTags:function(e){const t=e.iframeCSSFileName,n=this._w.RegExp;let i="";for(let e,l=0,o=t.length;l'}return i+("auto"===e.height?"":"")}};var L=T,k={init:function(e,t){"object"!=typeof t&&(t={});const n=document;this._initOptions(e,t);const i=n.createElement("DIV");i.className="sun-editor",e.id&&(i.id="suneditor_"+e.id);const l=n.createElement("DIV");l.className="se-container";const o=this._createToolBar(n,t.buttonList,t.plugins,t);o.element.style.visibility="hidden",o.pluginCallButtons.math&&this._checkKatexMath(t.katex);const s=n.createElement("DIV");s.className="se-arrow";const a=n.createElement("DIV");a.className="se-toolbar-sticky-dummy";const r=n.createElement("DIV");r.className="se-wrapper";const c=this._initElements(t,i,o.element,s),d=c.bottomBar,u=c.wysiwygFrame,h=c.placeholder;let g=c.codeView;const p=d.resizingBar,m=d.navigation,f=d.charWrapper,_=d.charCounter,b=n.createElement("DIV");b.className="se-loading-box sun-editor-common",b.innerHTML='
    ';const v=n.createElement("DIV");v.className="se-line-breaker",v.innerHTML='";const y=n.createElement("DIV");y.className+="se-line-breaker-component";const C=y.cloneNode(!0);y.innerHTML=C.innerHTML=t.icons.line_break;const w=n.createElement("DIV");w.className="se-resizing-back";const x=t.toolbarContainer;return x&&x.appendChild(o.element),r.appendChild(g),h&&r.appendChild(h),x||l.appendChild(o.element),l.appendChild(a),l.appendChild(r),l.appendChild(w),l.appendChild(b),l.appendChild(v),l.appendChild(y),l.appendChild(C),p&&l.appendChild(p),i.appendChild(l),g=this._checkCodeMirror(t,g),{constructed:{_top:i,_relative:l,_toolBar:o.element,_menuTray:o._menuTray,_editorArea:r,_wysiwygArea:u,_codeArea:g,_placeholder:h,_resizingBar:p,_navigation:m,_charWrapper:f,_charCounter:_,_loading:b,_lineBreaker:v,_lineBreaker_t:y,_lineBreaker_b:C,_resizeBack:w,_stickyDummy:a,_arrow:s},options:t,plugins:o.plugins,pluginCallButtons:o.pluginCallButtons,_responsiveButtons:o.responsiveButtons}},_checkCodeMirror:function(e,t){if(e.codeMirror){const n=[{mode:"htmlmixed",htmlMode:!0,lineNumbers:!0,lineWrapping:!0},e.codeMirror.options||{}].reduce((function(e,t){for(let n in t)L.hasOwn(t,n)&&(e[n]=t[n]);return e}),{});"auto"===e.height&&(n.viewportMargin=1/0,n.height="auto");const i=e.codeMirror.src.fromTextArea(t,n);i.display.wrapper.style.cssText=t.style.cssText,e.codeMirrorEditor=i,(t=i.display.wrapper).className+=" se-wrapper-code-mirror"}return t},_checkKatexMath:function(e){if(!e)throw Error('[SUNEDITOR.create.fail] To use the math button you need to add a "katex" object to the options.');const t=[{throwOnError:!1},e.options||{}].reduce((function(e,t){for(let n in t)L.hasOwn(t,n)&&(e[n]=t[n]);return e}),{});e.options=t},_setOptions:function(e,t,n,i){this._initOptions(t.element.originElement,e);const l=t.element,o=l.relative,s=l.editorArea,a=e.toolbarContainer&&e.toolbarContainer!==i.toolbarContainer,r=!!e.buttonList||e.mode!==i.mode||a,c=!!e.plugins,d=this._createToolBar(document,r?e.buttonList:i.buttonList,c?e.plugins:n,e);d.pluginCallButtons.math&&this._checkKatexMath(e.katex);const u=document.createElement("DIV");u.className="se-arrow",r&&(d.element.style.visibility="hidden",a?(e.toolbarContainer.appendChild(d.element),l.toolbar.parentElement.removeChild(l.toolbar)):l.toolbar.parentElement.replaceChild(d.element,l.toolbar),l.toolbar=d.element,l._menuTray=d._menuTray,l._arrow=u);const h=this._initElements(e,l.topArea,r?d.element:l.toolbar,u),g=h.bottomBar,p=h.wysiwygFrame,m=h.placeholder;let f=h.codeView;return l.resizingBar&&o.removeChild(l.resizingBar),g.resizingBar&&o.appendChild(g.resizingBar),s.innerHTML="",s.appendChild(f),m&&s.appendChild(m),f=this._checkCodeMirror(e,f),l.resizingBar=g.resizingBar,l.navigation=g.navigation,l.charWrapper=g.charWrapper,l.charCounter=g.charCounter,l.wysiwygFrame=p,l.code=f,l.placeholder=m,{callButtons:r?d.pluginCallButtons:null,plugins:r||c?d.plugins:null,toolbar:d}},_initElements:function(e,t,n,i){t.style.cssText=e._editorStyles.top,/inline/i.test(e.mode)?(n.className+=" se-toolbar-inline",n.style.width=e.toolbarWidth):/balloon/i.test(e.mode)&&(n.className+=" se-toolbar-balloon",n.style.width=e.toolbarWidth,n.appendChild(i));const l=document.createElement(e.iframe?"IFRAME":"DIV");l.className="se-wrapper-inner se-wrapper-wysiwyg",e.iframe?(l.allowFullscreen=!0,l.frameBorder=0,l.style.cssText=e._editorStyles.frame):(l.setAttribute("contenteditable",!0),l.setAttribute("scrolling","auto"),l.className+=" sun-editor-editable",l.style.cssText=e._editorStyles.frame+e._editorStyles.editor);const o=document.createElement("TEXTAREA");o.className="se-wrapper-inner se-wrapper-code",o.style.cssText=e._editorStyles.frame,o.style.display="none","auto"===e.height&&(o.style.overflow="hidden");let s=null,a=null,r=null,c=null;if(e.resizingBar&&(s=document.createElement("DIV"),s.className="se-resizing-bar sun-editor-common",a=document.createElement("DIV"),a.className="se-navigation sun-editor-common",s.appendChild(a),e.charCounter)){if(r=document.createElement("DIV"),r.className="se-char-counter-wrapper",e.charCounterLabel){const t=document.createElement("SPAN");t.className="se-char-label",t.textContent=e.charCounterLabel,r.appendChild(t)}if(c=document.createElement("SPAN"),c.className="se-char-counter",c.textContent="0",r.appendChild(c),e.maxCharCount>0){const t=document.createElement("SPAN");t.textContent=" / "+e.maxCharCount,r.appendChild(t)}s.appendChild(r)}let d=null;return e.placeholder&&(d=document.createElement("SPAN"),d.className="se-placeholder",d.innerText=e.placeholder),{bottomBar:{resizingBar:s,navigation:a,charWrapper:r,charCounter:c},wysiwygFrame:l,codeView:o,placeholder:d}},_initOptions:function(e,t){t.lang=t.lang||N.a,t.value="string"==typeof t.value?t.value:null,t.historyStackDelayTime="number"==typeof t.historyStackDelayTime?t.historyStackDelayTime:400,t._defaultTagsWhitelist="string"==typeof t._defaultTagsWhitelist?t._defaultTagsWhitelist:"br|p|div|pre|blockquote|h[1-6]|ol|ul|li|hr|figure|figcaption|img|iframe|audio|video|source|table|thead|tbody|tr|th|td|a|b|strong|var|i|em|u|ins|s|span|strike|del|sub|sup|code",t._editorTagsWhitelist=t._defaultTagsWhitelist+("string"==typeof t.addTagsWhitelist&&t.addTagsWhitelist.length>0?"|"+t.addTagsWhitelist:""),t.pasteTagsWhitelist="string"==typeof t.pasteTagsWhitelist?t.pasteTagsWhitelist:t._editorTagsWhitelist,t.attributesWhitelist=t.attributesWhitelist&&"object"==typeof t.attributesWhitelist?t.attributesWhitelist:null,t.mode=t.mode||"classic",t.toolbarWidth=t.toolbarWidth?L.isNumber(t.toolbarWidth)?t.toolbarWidth+"px":t.toolbarWidth:"auto",t.toolbarContainer=/balloon/i.test(t.mode)?null:"string"==typeof t.toolbarContainer?document.querySelector(t.toolbarContainer):t.toolbarContainer,t.stickyToolbar=/balloon/i.test(t.mode)||t.toolbarContainer?-1:void 0===t.stickyToolbar?0:/^\d+/.test(t.stickyToolbar)?L.getNumber(t.stickyToolbar,0):-1,t.fullPage=!!t.fullPage,t.iframe=t.fullPage||t.iframe,t.iframeCSSFileName=t.iframe?"string"==typeof t.iframeCSSFileName?[t.iframeCSSFileName]:t.iframeCSSFileName||["suneditor"]:null,t.codeMirror=t.codeMirror?t.codeMirror.src?t.codeMirror:{src:t.codeMirror}:null,t.position="string"==typeof t.position?t.position:null,t.display=t.display||("none"!==e.style.display&&e.style.display?e.style.display:"block"),t.popupDisplay=t.popupDisplay||"full",t.resizingBar=void 0===t.resizingBar?!/inline|balloon/i.test(t.mode):t.resizingBar,t.showPathLabel=!!t.resizingBar&&("boolean"!=typeof t.showPathLabel||t.showPathLabel),t.charCounter=t.maxCharCount>0||"boolean"==typeof t.charCounter&&t.charCounter,t.charCounterType="string"==typeof t.charCounterType?t.charCounterType:"char",t.charCounterLabel="string"==typeof t.charCounterLabel?t.charCounterLabel.trim():null,t.maxCharCount=L.isNumber(t.maxCharCount)&&t.maxCharCount>-1?1*t.maxCharCount:null,t.width=t.width?L.isNumber(t.width)?t.width+"px":t.width:e.clientWidth?e.clientWidth+"px":"100%",t.minWidth=(L.isNumber(t.minWidth)?t.minWidth+"px":t.minWidth)||"",t.maxWidth=(L.isNumber(t.maxWidth)?t.maxWidth+"px":t.maxWidth)||"",t.height=t.height?L.isNumber(t.height)?t.height+"px":t.height:e.clientHeight?e.clientHeight+"px":"auto",t.minHeight=(L.isNumber(t.minHeight)?t.minHeight+"px":t.minHeight)||"",t.maxHeight=(L.isNumber(t.maxHeight)?t.maxHeight+"px":t.maxHeight)||"",t.defaultStyle="string"==typeof t.defaultStyle?t.defaultStyle:"",t.font=t.font?t.font:null,t.fontSize=t.fontSize?t.fontSize:null,t.formats=t.formats?t.formats:null,t.colorList=t.colorList?t.colorList:null,t.lineHeights=t.lineHeights?t.lineHeights:null,t.paragraphStyles=t.paragraphStyles?t.paragraphStyles:null,t.textStyles=t.textStyles?t.textStyles:null,t.fontSizeUnit="string"==typeof t.fontSizeUnit&&t.fontSizeUnit.trim()||"px",t.imageResizing=void 0===t.imageResizing||t.imageResizing,t.imageHeightShow=void 0===t.imageHeightShow||!!t.imageHeightShow,t.imageWidth=t.imageWidth?L.isNumber(t.imageWidth)?t.imageWidth+"px":t.imageWidth:"auto",t.imageHeight=t.imageHeight?L.isNumber(t.imageHeight)?t.imageHeight+"px":t.imageHeight:"auto",t.imageSizeOnlyPercentage=!!t.imageSizeOnlyPercentage,t._imageSizeUnit=t.imageSizeOnlyPercentage?"%":"px",t.imageRotation=void 0!==t.imageRotation?t.imageRotation:!(t.imageSizeOnlyPercentage||!t.imageHeightShow),t.imageFileInput=void 0===t.imageFileInput||t.imageFileInput,t.imageUrlInput=void 0===t.imageUrlInput||!t.imageFileInput||t.imageUrlInput,t.imageUploadHeader=t.imageUploadHeader||null,t.imageUploadUrl="string"==typeof t.imageUploadUrl?t.imageUploadUrl:null,t.imageUploadSizeLimit=/\d+/.test(t.imageUploadSizeLimit)?L.getNumber(t.imageUploadSizeLimit,0):null,t.imageMultipleFile=!!t.imageMultipleFile,t.imageAccept="string"!=typeof t.imageAccept||"*"===t.imageAccept.trim()?"image/*":t.imageAccept.trim()||"image/*",t.imageGalleryUrl="string"==typeof t.imageGalleryUrl?t.imageGalleryUrl:null,t.videoResizing=void 0===t.videoResizing||t.videoResizing,t.videoHeightShow=void 0===t.videoHeightShow||!!t.videoHeightShow,t.videoRatioShow=void 0===t.videoRatioShow||!!t.videoRatioShow,t.videoWidth=t.videoWidth&&L.getNumber(t.videoWidth,0)?L.isNumber(t.videoWidth)?t.videoWidth+"px":t.videoWidth:"",t.videoHeight=t.videoHeight&&L.getNumber(t.videoHeight,0)?L.isNumber(t.videoHeight)?t.videoHeight+"px":t.videoHeight:"",t.videoSizeOnlyPercentage=!!t.videoSizeOnlyPercentage,t._videoSizeUnit=t.videoSizeOnlyPercentage?"%":"px",t.videoRotation=void 0!==t.videoRotation?t.videoRotation:!(t.videoSizeOnlyPercentage||!t.videoHeightShow),t.videoRatio=L.getNumber(t.videoRatio,4)||.5625,t.videoRatioList=t.videoRatioList?t.videoRatioList:null,t.youtubeQuery=(t.youtubeQuery||"").replace("?",""),t.videoFileInput=!!t.videoFileInput,t.videoUrlInput=void 0===t.videoUrlInput||!t.videoFileInput||t.videoUrlInput,t.videoUploadHeader=t.videoUploadHeader||null,t.videoUploadUrl="string"==typeof t.videoUploadUrl?t.videoUploadUrl:null,t.videoUploadSizeLimit=/\d+/.test(t.videoUploadSizeLimit)?L.getNumber(t.videoUploadSizeLimit,0):null,t.videoMultipleFile=!!t.videoMultipleFile,t.videoTagAttrs=t.videoTagAttrs||null,t.videoIframeAttrs=t.videoIframeAttrs||null,t.videoAccept="string"!=typeof t.videoAccept||"*"===t.videoAccept.trim()?"video/*":t.videoAccept.trim()||"video/*",t.audioWidth=t.audioWidth?L.isNumber(t.audioWidth)?t.audioWidth+"px":t.audioWidth:"",t.audioHeight=t.audioHeight?L.isNumber(t.audioHeight)?t.audioHeight+"px":t.audioHeight:"",t.audioFileInput=!!t.audioFileInput,t.audioUrlInput=void 0===t.audioUrlInput||!t.audioFileInput||t.audioUrlInput,t.audioUploadHeader=t.audioUploadHeader||null,t.audioUploadUrl="string"==typeof t.audioUploadUrl?t.audioUploadUrl:null,t.audioUploadSizeLimit=/\d+/.test(t.audioUploadSizeLimit)?L.getNumber(t.audioUploadSizeLimit,0):null,t.audioMultipleFile=!!t.audioMultipleFile,t.audioTagAttrs=t.audioTagAttrs||null,t.audioAccept="string"!=typeof t.audioAccept||"*"===t.audioAccept.trim()?"audio/*":t.audioAccept.trim()||"audio/*",t.tableCellControllerPosition="string"==typeof t.tableCellControllerPosition?t.tableCellControllerPosition.toLowerCase():"cell",t.tabDisable=!!t.tabDisable,t.shortcutsDisable=Array.isArray(t.shortcutsDisable)&&t.shortcutsDisable.length>0?t.shortcutsDisable.map((function(e){return e.toLowerCase()})):[],t.shortcutsHint=void 0===t.shortcutsHint||!!t.shortcutsHint,t.callBackSave=t.callBackSave?t.callBackSave:null,t.templates=t.templates?t.templates:null,t.placeholder="string"==typeof t.placeholder?t.placeholder:null,t.linkProtocol="string"==typeof t.linkProtocol?t.linkProtocol:null,t.katex=t.katex?t.katex.src?t.katex:{src:t.katex}:null,t.buttonList=t.buttonList||[["undo","redo"],["bold","underline","italic","strike","subscript","superscript"],["removeFormat"],["outdent","indent"],["fullScreen","showBlocks","codeView"],["preview","print"]],t.icons=t.icons&&"object"==typeof t.icons?[E,t.icons].reduce((function(e,t){for(let n in t)L.hasOwn(t,n)&&(e[n]=t[n]);return e}),{}):E,t._editorStyles=L._setDefaultOptionStyle(t,t.defaultStyle)},_defaultButtons:function(e){const t=e.icons,n=e.lang,i=L.isOSX_IOS?"⌘":"CTRL",l=e.shortcutsHint?e.shortcutsDisable:["bold","strike","underline","italic","undo","indent"];return{bold:["_se_command_bold",n.toolbar.bold+(l.indexOf("bold")>-1?"":" ("+i+"+B)"),"STRONG","",t.bold],underline:["_se_command_underline",n.toolbar.underline+(l.indexOf("underline")>-1?"":" ("+i+"+U)"),"U","",t.underline],italic:["_se_command_italic",n.toolbar.italic+(l.indexOf("italic")>-1?"":" ("+i+"+I)"),"EM","",t.italic],strike:["_se_command_strike",n.toolbar.strike+(l.indexOf("strike")>-1?"":" ("+i+"+SHIFT+S)"),"DEL","",t.strike],subscript:["_se_command_subscript",n.toolbar.subscript,"SUB","",t.subscript],superscript:["_se_command_superscript",n.toolbar.superscript,"SUP","",t.superscript],removeFormat:["",n.toolbar.removeFormat,"removeFormat","",t.erase],indent:["_se_command_indent",n.toolbar.indent+(l.indexOf("indent")>-1?"":" ("+i+"+])"),"indent","",t.outdent],outdent:["_se_command_outdent",n.toolbar.outdent+(l.indexOf("indent")>-1?"":" ("+i+"+[)"),"outdent","",t.indent],fullScreen:["se-code-view-enabled se-resizing-enabled _se_command_fullScreen",n.toolbar.fullScreen,"fullScreen","",t.expansion],showBlocks:["_se_command_showBlocks",n.toolbar.showBlocks,"showBlocks","",t.show_blocks],codeView:["se-code-view-enabled se-resizing-enabled _se_command_codeView",n.toolbar.codeView,"codeView","",t.code_view],undo:["_se_command_undo se-resizing-enabled",n.toolbar.undo+(l.indexOf("undo")>-1?"":" ("+i+"+Z)"),"undo","",t.undo],redo:["_se_command_redo se-resizing-enabled",n.toolbar.redo+(l.indexOf("undo")>-1?"":" ("+i+"+Y / "+i+"+SHIFT+Z)"),"redo","",t.redo],preview:["se-resizing-enabled",n.toolbar.preview,"preview","",t.preview],print:["se-resizing-enabled",n.toolbar.print,"print","",t.print],save:["_se_command_save se-resizing-enabled",n.toolbar.save,"save","",t.save],blockquote:["",n.toolbar.tag_blockquote,"blockquote","command",t.blockquote],font:["se-btn-select se-btn-tool-font",n.toolbar.font,"font","submenu",''+n.toolbar.font+""+t.arrow_down],formatBlock:["se-btn-select se-btn-tool-format",n.toolbar.formats,"formatBlock","submenu",''+n.toolbar.formats+""+t.arrow_down],fontSize:["se-btn-select se-btn-tool-size",n.toolbar.fontSize,"fontSize","submenu",''+n.toolbar.fontSize+""+t.arrow_down],fontColor:["",n.toolbar.fontColor,"fontColor","submenu",t.font_color],hiliteColor:["",n.toolbar.hiliteColor,"hiliteColor","submenu",t.highlight_color],align:["se-btn-align",n.toolbar.align,"align","submenu",t.align_left],list:["",n.toolbar.list,"list","submenu",t.list_number],horizontalRule:["btn_line",n.toolbar.horizontalRule,"horizontalRule","submenu",t.horizontal_rule],table:["",n.toolbar.table,"table","submenu",t.table],lineHeight:["",n.toolbar.lineHeight,"lineHeight","submenu",t.line_height],template:["",n.toolbar.template,"template","submenu",t.template],paragraphStyle:["",n.toolbar.paragraphStyle,"paragraphStyle","submenu",t.paragraph_style],textStyle:["",n.toolbar.textStyle,"textStyle","submenu",t.text_style],link:["",n.toolbar.link,"link","dialog",t.link],image:["",n.toolbar.image,"image","dialog",t.image],video:["",n.toolbar.video,"video","dialog",t.video],audio:["",n.toolbar.audio,"audio","dialog",t.audio],math:["",n.toolbar.math,"math","dialog",t.math],imageGallery:["",n.toolbar.imageGallery,"imageGallery","fileBrowser",t.image_gallery]}},_createModuleGroup:function(){const e=L.createElement("DIV");e.className="se-btn-module se-btn-module-border";const t=L.createElement("UL");return t.className="se-menu-list",e.appendChild(t),{div:e,ul:t}},_createButton:function(e,t,n,i,l,o,s){const a=L.createElement("LI"),r=L.createElement("BUTTON");return r.setAttribute("type","button"),r.setAttribute("class","se-btn"+(e?" "+e:"")+" se-tooltip"),r.setAttribute("data-command",n),r.setAttribute("data-display",i),r.setAttribute("tabindex","-1"),l||(l='!'),/^default\./i.test(l)&&(l=s[l.replace(/^default\./i,"")]),/^text\./i.test(l)&&(l=l.replace(/^text\./i,""),r.className+=" se-btn-more-text"),l+=''+(t||n)+"",o&&r.setAttribute("disabled",!0),r.innerHTML=l,a.appendChild(r),{li:a,button:r}},_createToolBar:function(e,t,n,i){const l=e.createElement("DIV");l.className="se-toolbar-separator-vertical";const o=e.createElement("DIV");o.className="se-toolbar sun-editor-common";const s=e.createElement("DIV");s.className="se-btn-tray",o.appendChild(s);const a=i.icons,r=this._defaultButtons(i),c={},d=[],u={};if(n){const e=n.length?n:Object.keys(n).map((function(e){return n[e]}));for(let t,n=0,i=e.length;n",b.appendChild(i),i=i.firstElementChild.firstElementChild)}if(_){const e=l.cloneNode(!1);y&&(e.style.float=y),s.appendChild(e)}s.appendChild(p.div),_=!0}else if(/^\/$/.test(v)){const t=e.createElement("DIV");t.className="se-btn-module-enter",s.appendChild(t),_=!1}1===s.children.length&&L.removeClass(s.firstElementChild,"se-btn-module-border"),d.length>0&&d.unshift(t),b.children.length>0&&s.appendChild(b);const v=e.createElement("DIV");v.className="se-menu-tray",o.appendChild(v);const y=e.createElement("DIV");return y.className="se-toolbar-cover",o.appendChild(y),{element:o,plugins:u,pluginCallButtons:c,responsiveButtons:d,_menuTray:v,_buttonTray:s}}};var A=function(e,t,n){return{element:{originElement:e,topArea:t._top,relative:t._relative,toolbar:t._toolBar,_buttonTray:t._toolBar.querySelector(".se-btn-tray"),_menuTray:t._menuTray,resizingBar:t._resizingBar,navigation:t._navigation,charWrapper:t._charWrapper,charCounter:t._charCounter,editorArea:t._editorArea,wysiwygFrame:t._wysiwygArea,wysiwyg:t._wysiwygArea,code:t._codeArea,placeholder:t._placeholder,loading:t._loading,lineBreaker:t._lineBreaker,lineBreaker_t:t._lineBreaker_t,lineBreaker_b:t._lineBreaker_b,resizeBackground:t._resizeBack,_stickyDummy:t._stickyDummy,_arrow:t._arrow},tool:{cover:t._toolBar.querySelector(".se-toolbar-cover"),bold:t._toolBar.querySelector("._se_command_bold"),underline:t._toolBar.querySelector("._se_command_underline"),italic:t._toolBar.querySelector("._se_command_italic"),strike:t._toolBar.querySelector("._se_command_strike"),subscript:t._toolBar.querySelector("._se_command_subscript"),superscript:t._toolBar.querySelector("._se_command_superscript"),undo:t._toolBar.querySelector("._se_command_undo"),redo:t._toolBar.querySelector("._se_command_redo"),save:t._toolBar.querySelector("._se_command_save"),outdent:t._toolBar.querySelector("._se_command_outdent"),indent:t._toolBar.querySelector("._se_command_indent"),fullScreen:t._toolBar.querySelector("._se_command_fullScreen"),showBlocks:t._toolBar.querySelector("._se_command_showBlocks"),codeView:t._toolBar.querySelector("._se_command_codeView")},options:n,option:n}},B={name:"notice",add:function(e){const t=e.context;t.notice={};let n=e.util.createElement("DIV"),i=e.util.createElement("SPAN"),l=e.util.createElement("BUTTON");n.className="se-notice",l.className="close",l.setAttribute("aria-label","Close"),l.setAttribute("title",e.lang.dialogBox.close),l.innerHTML=e.icons.cancel,n.appendChild(i),n.appendChild(l),t.notice.modal=n,t.notice.message=i,l.addEventListener("click",this.onClick_cancel.bind(e)),t.element.editorArea.appendChild(n),n=null},onClick_cancel:function(e){e.preventDefault(),e.stopPropagation(),this.plugins.notice.close.call(this)},open:function(e){this.context.notice.message.textContent=e,this.context.notice.modal.style.display="block"},close:function(){this.context.notice.modal.style.display="none"}},z={init:function(e){return{create:function(t,n){return this.create(t,n,e)}.bind(this)}},create:function(e,t,n){L._propertiesInit(),"object"!=typeof t&&(t={}),n&&(t=[n,t].reduce((function(e,t){for(let n in t)if(L.hasOwn(t,n))if("plugins"===n&&t[n]&&e[n]){let i=e[n],l=t[n];i=i.length?i:Object.keys(i).map((function(e){return i[e]})),l=l.length?l:Object.keys(l).map((function(e){return l[e]})),e[n]=l.filter((function(e){return-1===i.indexOf(e)})).concat(i)}else e[n]=t[n];return e}),{}));const i="string"==typeof e?document.getElementById(e):e;if(!i){if("string"==typeof e)throw Error('[SUNEDITOR.create.fail] The element for that id was not found (ID:"'+e+'")');throw Error("[SUNEDITOR.create.fail] suneditor requires textarea's element or id value")}const l=k.init(i,t);if(l.constructed._top.id&&document.getElementById(l.constructed._top.id))throw Error('[SUNEDITOR.create.fail] The ID of the suneditor you are trying to create already exists (ID:"'+l.constructed._top.id+'")');return function(e,t,n,i,l,o){const s=e.element.originElement.ownerDocument||document,a=s.defaultView||window,r=L,c=l.icons,d={_d:s,_w:a,_parser:new a.DOMParser,_wd:null,_ww:null,_shadowRoot:null,util:r,functions:null,notice:B,icons:c,history:null,context:e,pluginCallButtons:t,plugins:n||{},initPlugins:{},_targetPlugins:{},_menuTray:{},lang:i,effectNode:null,submenu:null,container:null,_submenuName:"",_bindedSubmenuOff:null,_bindedContainerOff:null,submenuActiveButton:null,containerActiveButton:null,controllerArray:[],currentControllerName:"",currentControllerTarget:null,currentFileComponentInfo:null,codeViewDisabledButtons:null,resizingDisabledButtons:null,_moreLayerActiveButton:null,_htmlCheckWhitelistRegExp:null,_disallowedTextTagsRegExp:null,editorTagsWhitelistRegExp:null,pasteTagsWhitelistRegExp:null,hasFocus:!1,isDisabled:!1,_attributesWhitelistRegExp:null,_attributesTagsWhitelist:null,_bindControllersOff:null,_isInline:null,_isBalloon:null,_isBalloonAlways:null,_inlineToolbarAttr:{top:"",width:"",isShow:!1},_notHideToolbar:!1,_sticky:!1,_antiBlur:!1,_lineBreaker:null,_lineBreakerButton:null,_componentsInfoInit:!0,_componentsInfoReset:!1,activePlugins:null,managedTagsInfo:null,_charTypeHTML:!1,_fileInfoPluginsCheck:null,_fileInfoPluginsReset:null,_fileManager:{tags:null,regExp:null,queryString:null,pluginRegExp:null,pluginMap:null},commandMap:null,_styleCommandMap:null,_defaultCommand:{bold:"STRONG",underline:"U",italic:"EM",strike:"DEL",subscript:"SUB",superscript:"SUP"},_variable:{isCodeView:!1,isFullScreen:!1,innerHeight_fullScreen:0,resizeClientY:0,tabSize:4,codeIndent:4,minResizingSize:r.getNumber(e.element.wysiwygFrame.style.minHeight||"65",0),currentNodes:[],currentNodesMap:[],_range:null,_selectionNode:null,_originCssText:e.element.topArea.style.cssText,_bodyOverflow:"",_editorAreaOriginCssText:"",_wysiwygOriginCssText:"",_codeOriginCssText:"",_fullScreenAttrs:{sticky:!1,balloon:!1,inline:!1},_lineBreakComp:null,_lineBreakDir:""},callPlugin:function(e,n,i){if(i=i||t[e],!this.plugins[e])throw Error('[SUNEDITOR.core.callPlugin.fail] The called plugin does not exist or is in an invalid format. (pluginName:"'+e+'")');this.initPlugins[e]?"object"==typeof this._targetPlugins[e]&&i&&this.initMenuTarget(e,i,this._targetPlugins[e]):(this.plugins[e].add(this,i),this.initPlugins[e]=!0),this.plugins[e].active&&!this.commandMap[e]&&i&&(this.commandMap[e]=i,this.activePlugins.push(e)),"function"==typeof n&&n()},addModule:function(e){for(let t,n=0,i=e.length;nb?(n.style.height=l+"px",e=-1*(l-g+3)):(n.style.height=b+"px",e=g+t.parentElement.offsetHeight),n.style.top=e+"px"}else n.style.top=g+t.parentElement.offsetHeight+"px";n.style.visibility=""},controllersOn:function(){this._bindControllersOff&&this._bindControllersOff(),this.controllerArray=[];for(let e,t=0;t0){for(let e=0;e":n),this.history.push(!0)},nativeFocus:function(){const t=r.getParentElement(this.getSelectionNode(),"figcaption");t?t.focus():e.element.wysiwyg.focus(),this._editorRange()},focus:function(){if("none"!==e.element.wysiwygFrame.style.display){if(l.iframe)this.nativeFocus();else try{const t=this.getRange();if(t.startContainer===t.endContainer&&r.isWysiwygDiv(t.startContainer)){const t=r.createElement("P"),n=r.createElement("BR");t.appendChild(n),e.element.wysiwyg.appendChild(t),this.setRange(n,0,n,0)}else this.setRange(t.startContainer,t.startOffset,t.endContainer,t.endOffset)}catch(e){this.nativeFocus()}u._applyTagEffects(),this._isBalloon&&u._toggleToolbarBalloon()}},focusEdge:function(t){t||(t=e.element.wysiwyg.lastElementChild);const n=this.getFileComponent(t);n?this.selectComponent(n.target,n.pluginName):t?(t=r.getChildElement(t,(function(e){return 0===e.childNodes.length||3===e.nodeType}),!0))?this.setRange(t,t.textContent.length,t,t.textContent.length):this.nativeFocus():this.focus()},setRange:function(e,t,n,i){if(!e||!n)return;t>e.textContent.length&&(t=e.textContent.length),i>n.textContent.length&&(i=n.textContent.length);const o=this._wd.createRange();try{o.setStart(e,t),o.setEnd(n,i)}catch(e){return console.warn("[SUNEDITOR.core.focus.error] "+e),void this.nativeFocus()}const s=this.getSelection();return s.removeAllRanges&&s.removeAllRanges(),s.addRange(o),this._editorRange(),l.iframe&&this.nativeFocus(),o},removeRange:function(){this._variable._range=null,this._variable._selectionNode=null,this.getSelection().removeAllRanges();const e=this.commandMap,t=this.activePlugins;for(let i in e)r.hasOwn(e,i)&&(t.indexOf(i)>-1?n[i].active.call(this,null):e.OUTDENT&&/^OUTDENT$/i.test(i)?e.OUTDENT.setAttribute("disabled",!0):e.INDENT&&/^INDENT$/i.test(i)?e.INDENT.removeAttribute("disabled"):r.removeClass(e[i],"active"))},getRange:function(){const t=this._variable._range||this._createDefaultRange(),n=this.getSelection();if(t.collapsed===n.isCollapsed||!e.element.wysiwyg.contains(n.focusNode))return t;if(n.rangeCount>0)return this._variable._range=n.getRangeAt(0),this._variable._range;{const e=n.anchorNode,t=n.focusNode,i=n.anchorOffset,l=n.focusOffset,o=r.compareElements(e,t),s=o.ancestor&&(0===o.result?i<=l:o.result>1);return this.setRange(s?e:t,s?i:l,s?t:e,s?l:i)}},getRange_addLine:function(t){if(this._selectionVoid(t)){const n=e.element.wysiwyg,i=r.createElement("P");i.innerHTML="
    ",n.insertBefore(i,n.firstElementChild),this.setRange(i.firstElementChild,0,i.firstElementChild,1),t=this._variable._range}return t},getSelection:function(){return this._shadowRoot&&this._shadowRoot.getSelection?this._shadowRoot.getSelection():this._ww.getSelection()},getSelectionNode:function(){if(r.isWysiwygDiv(this._variable._selectionNode)&&this._editorRange(),!this._variable._selectionNode){const t=r.getChildElement(e.element.wysiwyg.firstChild,(function(e){return 0===e.childNodes.length||3===e.nodeType}),!1);if(t)return this._variable._selectionNode=t,t;this._editorRange()}return this._variable._selectionNode},_editorRange:function(){const e=this.getSelection();if(!e)return null;let t=null,n=null;t=e.rangeCount>0?e.getRangeAt(0):this._createDefaultRange(),this._variable._range=t,n=t.collapsed?t.commonAncestorContainer:e.extentNode||e.anchorNode,this._variable._selectionNode=n},_createDefaultRange:function(){const t=e.element.wysiwyg;t.focus();const n=this._wd.createRange();let i=t.firstElementChild;return i||(i=r.createElement("P"),i.innerHTML="
    ",t.appendChild(i)),n.setStart(i,0),n.setEnd(i,0),n},_selectionVoid:function(e){const t=e.commonAncestorContainer;return r.isWysiwygDiv(e.startContainer)&&r.isWysiwygDiv(e.endContainer)||/FIGURE/i.test(t.nodeName)||this._fileManager.regExp.test(t.nodeName)||r.isMediaComponent(t)},_resetRangeToTextNode:function(){const t=this.getRange();if(this._selectionVoid(t))return!1;let n,i,l,o=t.startContainer,s=t.startOffset,a=t.endContainer,c=t.endOffset;if(r.isFormatElement(o)&&(o=o.childNodes[s]||o.lastChild,s=o.textContent.length),r.isFormatElement(a)&&(a=a.childNodes[c]||a.lastChild,c=a.textContent.length),n=r.isWysiwygDiv(o)?e.element.wysiwyg.firstChild:o,i=s,r.isBreak(n)||1===n.nodeType&&n.childNodes.length>0){const e=r.isBreak(n);if(!e){for(;n&&!r.isBreak(n)&&1===n.nodeType;)n=n.childNodes[i]||n.nextElementSibling||n.nextSibling,i=0;let e=r.getFormatElement(n,null);e===r.getRangeFormatElement(e,null)&&(e=r.createElement(r.getParentElement(n,r.isCell)?"DIV":"P"),n.parentNode.insertBefore(e,n),e.appendChild(n))}if(r.isBreak(n)){const t=r.createTextNode(r.zeroWidthSpace);n.parentNode.insertBefore(t,n),n=t,e&&o===a&&(a=n,c=1)}}if(o=n,s=i,n=r.isWysiwygDiv(a)?e.element.wysiwyg.lastChild:a,i=c,r.isBreak(n)||1===n.nodeType&&n.childNodes.length>0){const e=r.isBreak(n);if(!e){for(;n&&!r.isBreak(n)&&1===n.nodeType&&(l=n.childNodes,0!==l.length);)n=l[i>0?i-1:i]||!/FIGURE/i.test(l[0].nodeName)?l[0]:n.previousElementSibling||n.previousSibling||o,i=i>0?n.textContent.length:i;let e=r.getFormatElement(n,null);e===r.getRangeFormatElement(e,null)&&(e=r.createElement(r.isCell(e)?"DIV":"P"),n.parentNode.insertBefore(e,n),e.appendChild(n))}if(r.isBreak(n)){const t=r.createTextNode(r.zeroWidthSpace);n.parentNode.insertBefore(t,n),n=t,i=1,e&&!n.previousSibling&&r.removeItem(a)}}return a=n,c=i,this.setRange(o,s,a,c),!0},getSelectedElements:function(t){if(!this._resetRangeToTextNode())return[];let n=this.getRange();if(r.isWysiwygDiv(n.startContainer)){const t=e.element.wysiwyg.children;if(0===t.length)return[];this.setRange(t[0],0,t[t.length-1],t[t.length-1].textContent.trim().length),n=this.getRange()}const i=n.startContainer,l=n.endContainer,o=n.commonAncestorContainer,s=r.getListChildren(o,(function(e){return t?t(e):r.isFormatElement(e)}));if(r.isWysiwygDiv(o)||r.isRangeFormatElement(o)||s.unshift(r.getFormatElement(o,null)),i===l||1===s.length)return s;let a=r.getFormatElement(i,null),c=r.getFormatElement(l,null),d=null,u=null;const h=function(e){return!r.isTable(e)||/^TABLE$/i.test(e.nodeName)};let g=r.getRangeFormatElement(a,h),p=r.getRangeFormatElement(c,h);r.isTable(g)&&r.isListCell(g.parentNode)&&(g=g.parentNode),r.isTable(p)&&r.isListCell(p.parentNode)&&(p=p.parentNode);const m=g===p;for(let e,t=0,n=s.length;t=0;n--)if(i[n].contains(i[e])){i.splice(e,1),e--,t--;break}return i},isEdgePoint:function(e,t){return 0===t||!e.nodeValue&&1===t||t===e.nodeValue.length},showLoading:function(){e.element.loading.style.display="block"},closeLoading:function(){e.element.loading.style.display="none"},appendFormatTag:function(e,t){const n=r.getFormatElement(this.getSelectionNode(),null),i=t?"string"==typeof t?t:t.nodeName:r.isFormatElement(n)&&!r.isFreeFormatElement(n)?n.nodeName:"P",l=r.createElement(i);return l.innerHTML="
    ",(t&&"string"!=typeof t||!t&&r.isFormatElement(n))&&r.copyTagAttributes(l,t||n),r.isCell(e)?e.insertBefore(l,e.nextElementSibling):e.parentNode.insertBefore(l,e.nextElementSibling),l},insertComponent:function(e,t,n,i){if(n&&!this.checkCharCount(e,null))return null;const l=this.removeNode();this.getRange_addLine(this.getRange());let o=null,s=this.getSelectionNode(),a=r.getFormatElement(s,null);if(r.isListCell(a))this.insertNode(e,s===a?null:l.container.nextSibling,!1),e.nextSibling||e.parentNode.appendChild(r.createElement("BR"));else{if(this.getRange().collapsed&&(3===l.container.nodeType||r.isBreak(l.container))){const e=r.getParentElement(l.container,function(e){return this.isRangeFormatElement(e)}.bind(r));o=r.splitElement(l.container,l.offset,e?r.getElementDepth(e)+1:0),o&&(a=o.previousSibling)}this.insertNode(e,a,!1),a&&r.onlyZeroWidthSpace(a)&&r.removeItem(a)}if(!i){const t=this.getFileComponent(e);t?this.selectComponent(t.target,t.pluginName):o&&(o=r.getEdgeChildNodes(o,null).sc||o,this.setRange(o,0,o,0))}return t||this.history.push(1),o||e},getFileComponent:function(e){if(!this._fileManager.queryString||!e)return null;let t,n;return(/^FIGURE$/i.test(e.nodeName)||/se-component/.test(e.className))&&(t=e.querySelector(this._fileManager.queryString)),!t&&e.nodeName&&this._fileManager.regExp.test(e.nodeName)&&(t=e),t&&(n=this._fileManager.pluginMap[t.nodeName.toLowerCase()],n)?{target:t,component:r.getParentElement(t,r.isComponent),pluginName:n}:null},selectComponent:function(e,t){this.hasFocus||this.focus();const n=this.plugins[t];n&&a.setTimeout(function(){"function"==typeof n.select&&this.callPlugin(t,n.select.bind(this,e),null),this._setComponentLineBreaker(e)}.bind(this))},_setComponentLineBreaker:function(t){this._lineBreaker.style.display="none";const n=r.getParentElement(t,r.isComponent),i=e.element.lineBreaker_t.style,l=e.element.lineBreaker_b.style,o="block"===this.context.resizing.resizeContainer.style.display?this.context.resizing.resizeContainer:t,s=r.isListCell(n.parentNode);let a,c,d;(s?n.previousSibling:r.isFormatElement(n.previousElementSibling))?i.display="none":(this._variable._lineBreakComp=n,c=e.element.wysiwyg.scrollTop,a=r.getOffset(t,e.element.wysiwygFrame).top+c,d=o.offsetWidth/2/2,i.top=a-c-12+"px",i.left=r.getOffset(o).left+d+"px",i.display="block"),(s?n.nextSibling:r.isFormatElement(n.nextElementSibling))?l.display="none":(a||(this._variable._lineBreakComp=n,c=e.element.wysiwyg.scrollTop,a=r.getOffset(t,e.element.wysiwygFrame).top+c,d=o.offsetWidth/2/2),l.top=a+o.offsetHeight-c-12+"px",l.left=r.getOffset(o).left+o.offsetWidth-d-24+"px",l.display="block")},insertNode:function(e,t,n){if(n&&!this.checkCharCount(e,null))return null;const i=r.getFreeFormatElement(this.getSelectionNode(),null),l=!i&&(r.isFormatElement(e)||r.isRangeFormatElement(e))||r.isComponent(e);if(!t&&l){const e=this.removeNode();if(3===e.container.nodeType||r.isBreak(e.container)){const n=r.getParentElement(e.container,function(e){return this.isRangeFormatElement(e)||this.isListCell(e)}.bind(r));(t=r.splitElement(e.container,e.offset,n?r.getElementDepth(n)+1:0))&&(t=t.previousSibling)}}const o=t||l?this.getRange():this.getRange_addLine(this.getRange()),s=o.commonAncestorContainer,a=o.startOffset,c=o.endOffset,d=o.startContainer===s&&r.isFormatElement(s),u=d?s.childNodes[a]:o.startContainer,h=d?s.childNodes[c]:o.endContainer;let g,p=null;if(t)g=t.parentNode,t=t.nextSibling,p=!0;else if(g=u,3===u.nodeType&&(g=u.parentNode),o.collapsed)if(3===s.nodeType)t=s.textContent.length>c?s.splitText(c):s.nextSibling;else if(r.isBreak(g))t=g,g=g.parentNode;else{let n=g.childNodes[a];const i=n&&3===n.nodeType&&r.onlyZeroWidthSpace(n)&&r.isBreak(n.nextSibling)?n.nextSibling:n;i?i.nextSibling?t=r.isBreak(i)&&!r.isBreak(e)?i:i.nextSibling:(g.removeChild(i),t=null):t=null}else{if(u===h){t=this.isEdgePoint(h,c)?h.nextSibling:h.splitText(c);let e=u;this.isEdgePoint(u,a)||(e=u.splitText(a)),g.removeChild(e),0===g.childNodes.length&&l&&(g.innerHTML="
    ")}else{const e=this.removeNode(),n=e.container,i=e.prevContainer;if(n&&0===n.childNodes.length&&l&&(r.isFormatElement(n)?n.innerHTML="
    ":r.isRangeFormatElement(n)&&(n.innerHTML="


    ")),!l&&i)if(g=3===i.nodeType?i.parentNode:i,g.contains(n))for(t=n;t.parentNode===g;)t=t.parentNode;else t=null;else g=l?s:n,t=l?h:null;for(;t&&!r.isFormatElement(t)&&t.parentNode!==s;)t=t.parentNode}}try{if(r.isFormatElement(e)||r.isRangeFormatElement(e)||!r.isListCell(g)&&r.isComponent(e)){const e=g;if(r.isList(t))g=t,t=null;else if(r.isListCell(t))g=t.previousElementSibling||t;else if(!p&&!t){const e=this.removeNode(),n=3===e.container.nodeType?r.isListCell(r.getFormatElement(e.container,null))?e.container:r.getFormatElement(e.container,null)||e.container.parentNode:e.container,i=r.isWysiwygDiv(n)||r.isRangeFormatElement(n);g=i?n:n.parentNode,t=i?null:n.nextSibling}0===e.childNodes.length&&g!==e&&r.removeItem(e)}!l||i||r.isRangeFormatElement(g)||r.isListCell(g)||r.isWysiwygDiv(g)||(t=g.nextElementSibling,g=g.parentNode),g.insertBefore(e,g===t?g.lastChild:t)}catch(t){g.appendChild(e)}finally{if(i&&(r.isFormatElement(e)||r.isRangeFormatElement(e))&&(e=this._setIntoFreeFormat(e)),!r.isComponent(e)){let t=1;if(3===e.nodeType){const t=e.previousSibling,n=e.nextSibling,i=!t||1===t.nodeType||r.onlyZeroWidthSpace(t)?"":t.textContent,l=!n||1===n.nodeType||r.onlyZeroWidthSpace(n)?"":n.textContent;t&&i.length>0&&(e.textContent=i+e.textContent,r.removeItem(t)),n&&n.length>0&&(e.textContent+=l,r.removeItem(n));const o={container:e,startOffset:i.length,endOffset:e.textContent.length-l.length};return this.setRange(e,o.startOffset,e,o.endOffset),o}if(!r.isBreak(e)&&r.isFormatElement(g)){let n=null;e.previousSibling||(n=r.createTextNode(r.zeroWidthSpace),e.parentNode.insertBefore(n,e)),e.nextSibling||(n=r.createTextNode(r.zeroWidthSpace),e.parentNode.appendChild(n)),r._isIgnoreNodeChange(e)&&(e=e.nextSibling,t=0)}this.setRange(e,t,e,t)}return this.history.push(!0),e}},_setIntoFreeFormat:function(e){const t=e.parentNode;let n,i;for(;r.isFormatElement(e)||r.isRangeFormatElement(e);){for(n=e.childNodes,i=null;n[0];)if(i=n[0],r.isFormatElement(i)||r.isRangeFormatElement(i)){if(this._setIntoFreeFormat(i),!e.parentNode)break;n=e.childNodes}else t.insertBefore(i,e);0===e.childNodes.length&&r.removeItem(e),e=r.createElement("BR"),t.insertBefore(e,i.nextSibling)}return e},removeNode:function(){this._resetRangeToTextNode()||console.warn('[SUNEDITOR.core.removeNode.exception] An exception occurred while resetting the "Range" object.');const t=this.getRange();let n,i=0,l=t.startContainer,o=t.endContainer;const s=t.startOffset,a=t.endOffset,c=t.commonAncestorContainer;let d=null,u=null;const h=r.getListChildNodes(c,null);let g=r.getArrayIndex(h,l),p=r.getArrayIndex(h,o);if(h.length>0&&g>-1&&p>-1){for(let e=g+1,t=l;e>=0;e--)h[e]===t.parentNode&&h[e].firstChild===t&&0===s&&(g=e,t=t.parentNode);for(let e=p-1,t=o;e>g;e--)h[e]===t.parentNode&&1===h[e].nodeType&&(h.splice(e,1),t=t.parentNode,--p)}else{if(0===h.length){if(r.isFormatElement(c)||r.isRangeFormatElement(c)||r.isWysiwygDiv(c)||r.isBreak(c)||r.isMedia(c))return{container:c,offset:0};h.push(c),l=o=c}else if(l=o=h[0],r.isBreak(l)||r.onlyZeroWidthSpace(l))return{container:l,offset:0};g=p=0}function m(e){const t=r.getFormatElement(e,null);if(r.removeItem(e),r.isListCell(t)){const e=r.getArrayItem(t.children,r.isList,!1);if(e){const n=e.firstElementChild,i=n.childNodes;for(;i[0];)t.insertBefore(i[0],e);r.removeItemAllParents(n,null,null)}}}for(let e=g;e<=p;e++){const t=h[e];if(0===t.length||3===t.nodeType&&void 0===t.data)m(t);else if(t!==l)t!==o?m(t):(u=1===o.nodeType?r.createTextNode(o.textContent):r.createTextNode(o.substringData(a,o.length-a)),u.length>0?o.data=u.data:m(o));else if(1===l.nodeType?d=r.createTextNode(l.textContent):t===o?(d=r.createTextNode(l.substringData(0,s)+o.substringData(a,o.length-a)),i=s):d=r.createTextNode(l.substringData(0,s)),d.length>0?l.data=d.data:m(l),t===o)break}if(n=o&&o.parentNode?o:l&&l.parentNode?l:t.endContainer||t.startContainer,!r.isWysiwygDiv(n)){const t=r.removeItemAllParents(n,function(e){if(this.isComponent(e))return!1;const t=e.textContent;return 0===t.length||/^(\n|\u200B)+$/.test(t)}.bind(r),null);t&&(n=t.sc||t.ec||e.element.wysiwyg)}return this.setRange(n,i,n,i),this.history.push(!0),{container:n,offset:i,prevContainer:l&&l.parentNode?l:null}},applyRangeFormatElement:function(e){this.getRange_addLine(this.getRange());const t=this.getSelectedElementsAndComponents(!1);if(!t||0===t.length)return;e:for(let e,n,i,l,o,s,a=0,c=t.length;a-1&&(l=n.lastElementChild,t.indexOf(l)>-1)){let e=null;for(;e=l.lastElementChild;)if(r.isList(e)){if(!(t.indexOf(e.lastElementChild)>-1))continue e;l=e.lastElementChild}i=n.firstElementChild,o=t.indexOf(i),s=t.indexOf(l),t.splice(o,s-o+1),c=t.length}else;let n,i,l,o=t[t.length-1];n=r.isRangeFormatElement(o)||r.isFormatElement(o)?o:r.getRangeFormatElement(o,null)||r.getFormatElement(o,null),r.isCell(n)?(i=null,l=n):(i=n.nextSibling,l=n.parentNode);let s=r.getElementDepth(n),a=null;const c=[],d=function(e,t,n){let i=null;if(e!==t&&!r.isTable(t)){if(t&&r.getElementDepth(e)===r.getElementDepth(t))return n;i=r.removeItemAllParents(t,null,e)}return i?i.ec:n};for(let n,o,u,h,g,p,m,f=0,_=t.length;f<_;f++)if(n=t[f],o=n.parentNode,o&&!e.contains(o))if(u=r.getElementDepth(n),r.isList(o)){if(null===a&&(p?(a=p,m=!0,p=null):a=o.cloneNode(!1)),c.push(n),g=t[f+1],f===_-1||g&&g.parentNode!==o){g&&n.contains(g.parentNode)&&(p=g.parentNode.cloneNode(!1));let t,f=o.parentNode;for(;r.isList(f);)t=r.createElement(f.nodeName),t.appendChild(a),a=t,f=f.parentNode;const _=this.detachRangeFormatElement(o,c,null,!0,!0);s>=u?(s=u,l=_.cc,i=d(l,o,_.ec),i&&(l=i.parentNode)):l===_.cc&&(i=_.ec),l!==_.cc&&(h=d(l,_.cc,h),i=void 0!==h?h:_.cc);for(let e=0,t=_.removeArray.length;e=u&&(s=u,l=o,i=n.nextSibling),e.appendChild(n),l!==o&&(h=d(l,o),void 0!==h&&(i=h));if(this.effectNode=null,r.mergeSameTags(e,null,!1),r.mergeNestedTags(e,function(e){return this.isList(e)}.bind(r)),i&&r.getElementDepth(i)>0&&(r.isList(i.parentNode)||r.isList(i.parentNode.parentNode))){const t=r.getParentElement(i,function(e){return this.isRangeFormatElement(e)&&!this.isList(e)}.bind(r)),n=r.splitElement(i,null,t?r.getElementDepth(t)+1:0);n.parentNode.insertBefore(e,n)}else l.insertBefore(e,i),d(e,i);const u=r.getEdgeChildNodes(e.firstElementChild,e.lastElementChild);t.length>1?this.setRange(u.sc,0,u.ec,u.ec.textContent.length):this.setRange(u.ec,u.ec.textContent.length,u.ec,u.ec.textContent.length),this.history.push(!1)},detachRangeFormatElement:function(e,t,n,i,l){const o=this.getRange(),s=o.startOffset,a=o.endOffset;let c=r.getListChildNodes(e,(function(t){return t.parentNode===e})),d=e.parentNode,u=null,h=null,g=e.cloneNode(!1);const p=[],m=r.isList(n);let f=!1,_=!1,b=!1;function v(t,n,i,l){if(r.onlyZeroWidthSpace(n)&&(n.innerHTML=r.zeroWidthSpace),3===n.nodeType)return t.insertBefore(n,i),n;const o=(b?n:l).childNodes;let s=n.cloneNode(!1),a=null,c=null;for(;o[0];)c=o[0],!r._notTextNode(c)||r.isBreak(c)||r.isListCell(s)?s.appendChild(c):(s.childNodes.length>0&&(a||(a=s),t.insertBefore(s,i),s=n.cloneNode(!1)),t.insertBefore(c,i),a||(a=c));if(s.childNodes.length>0){if(r.isListCell(t)&&r.isListCell(s)&&r.isList(i))if(m){for(a=i;i;)s.appendChild(i),i=i.nextSibling;t.parentNode.insertBefore(s,t.nextElementSibling)}else{const t=l.nextElementSibling,n=r.detachNestedList(l,!1);if(e!==n||t!==l.nextElementSibling){const t=s.childNodes;for(;t[0];)l.appendChild(t[0]);e=n,_=!0}}else t.insertBefore(s,i);a||(a=s)}return a}for(let l,o,s,a=0,y=c.length;a0&&(d.insertBefore(g,e),g=null),!m&&r.isListCell(l))if(s&&r.getElementDepth(l)!==r.getElementDepth(s)&&(r.isListCell(d)||r.getArrayItem(l.children,r.isList,!1))){const t=l.nextElementSibling,n=r.detachNestedList(l,!1);e===n&&t===l.nextElementSibling||(e=n,_=!0)}else{const t=l;l=r.createElement(i?t.nodeName:r.isList(e.parentNode)||r.isListCell(e.parentNode)?"LI":r.isCell(e.parentNode)?"DIV":"P");const n=r.isListCell(l),o=t.childNodes;for(;o[0]&&(!r.isList(o[0])||n);)l.appendChild(o[0]);r.copyFormatAttributes(l,t),b=!0}else l=l.cloneNode(!1);if(!_&&(i?(p.push(l),r.removeItem(c[a])):(n?(f||(d.insertBefore(n,e),f=!0),l=v(n,l,null,c[a])):l=v(d,l,e,c[a]),_||(t?(h=l,u||(u=l)):u||(u=h=l))),_)){_=b=!1,c=r.getListChildNodes(e,(function(t){return t.parentNode===e})),g=e.cloneNode(!1),d=e.parentNode,a=-1,y=c.length;continue}}const y=e.parentNode;let C=e.nextSibling;g&&g.children.length>0&&y.insertBefore(g,C),n?u=n.previousSibling:u||(u=e.previousSibling),C=e.nextSibling,0===e.children.length||0===e.textContent.length?r.removeItem(e):r.removeEmptyNode(e,null);let w=null;if(i)w={cc:y,sc:u,ec:C,removeArray:p};else{u||(u=h),h||(h=u);const e=r.getEdgeChildNodes(u,h.parentNode?u:h);w={cc:(e.sc||e.ec).parentNode,sc:e.sc,ec:e.ec}}if(this.effectNode=null,l)return w;!i&&w&&(t?this.setRange(w.sc,s,w.ec,a):this.setRange(w.sc,0,w.sc,0)),this.history.push(!1)},detachList:function(e,t){let n={},i=!1,l=!1,o=null,s=null;const a=function(e){return!this.isComponent(e)}.bind(r);for(let c,d,u,h,g=0,p=e.length;g0)&&t,n=!!(n&&n.length>0)&&n;const o=!e,s=o&&!n&&!t;let c=l.startContainer,d=l.startOffset,u=l.endContainer,h=l.endOffset;if(s&&l.collapsed&&r.isFormatElement(c.parentNode)&&r.isFormatElement(u.parentNode)||c===u&&1===c.nodeType&&r.isNonEditable(c))return;if(l.collapsed&&!s&&1===c.nodeType&&!r.isBreak(c)&&!r.isComponent(c)){let e=null;const t=c.childNodes[d];t&&(e=t.nextSibling?r.isBreak(t)?t:t.nextSibling:null);const n=r.createTextNode(r.zeroWidthSpace);c.insertBefore(n,e),this.setRange(n,1,n,1),l=this.getRange(),c=l.startContainer,d=l.startOffset,u=l.endContainer,h=l.endOffset}r.isFormatElement(c)&&(c=c.childNodes[d]||c.firstChild,d=0),r.isFormatElement(u)&&(u=u.childNodes[h]||u.lastChild,h=u.textContent.length),o&&(e=r.createElement("DIV"));const g=a.RegExp,p=e.nodeName;if(!s&&c===u&&!n&&e){let t=c,n=0;const i=[],l=e.style;for(let e=0,t=l.length;e0){for(;!r.isFormatElement(t)&&!r.isWysiwygDiv(t);){for(let l=0;l=i.length)return}}let m,f={},_={},b="",v="",y="";if(t){for(let e,n=0,i=t.length;n0&&(a=l.replace(b,"").trim(),a!==l&&(w.v=!0));const c=t.className;let d="";return v&&c.length>0&&(d=c.replace(v,"").trim(),d!==c&&(w.v=!0)),(!o||!v&&c||!b&&l||a||d||!n)&&(a||d||t.nodeName!==p||C(b)!==C(l)||C(v)!==C(c))?(b&&l.length>0&&(t.style.cssText=a),t.style.cssText||t.removeAttribute("style"),v&&c.length>0&&(t.className=d.trim()),t.className.trim()||t.removeAttribute("class"),t.style.cssText||t.className||t.nodeName!==p&&!n?t:(w.v=!0,null)):(w.v=!0,null)},E=this.getSelectedElements(null);l=this.getRange(),c=l.startContainer,d=l.startOffset,u=l.endContainer,h=l.endOffset,r.getFormatElement(c,null)||(c=r.getChildElement(E[0],(function(e){return 3===e.nodeType}),!1),d=0),r.getFormatElement(u,null)||(u=r.getChildElement(E[E.length-1],(function(e){return 3===e.nodeType}),!1),h=u.textContent.length);const S=r.getFormatElement(c,null)===r.getFormatElement(u,null),N=E.length-(S?0:1);m=e.cloneNode(!1);const T=s||o&&function(e){for(let t=0,n=e.length;t0&&(m=e.cloneNode(!1),_=this._nodeChange_endLine(E[N],m,x,u,h,s,o,w,k,A));for(let t,n=N-1;n>0;n--)m=e.cloneNode(!1),t=this._nodeChange_middleLine(E[n],m,x,s,o,w,_.container),t.endContainer&&(_.ancestor=null,_.container=t.endContainer),this._setCommonListStyle(t.ancestor,null);m=e.cloneNode(!1),f=this._nodeChange_startLine(E[0],m,x,c,d,s,o,w,k,A,_.container),f.endContainer&&(_.ancestor=null,_.container=f.endContainer),N<=0?_=f:_.container||(_.ancestor=null,_.container=f.container,_.offset=f.container.textContent.length),this._setCommonListStyle(f.ancestor,null),this._setCommonListStyle(_.ancestor||r.getFormatElement(_.container),null)}this.controllersOff(),this.setRange(f.container,f.offset,_.container,_.offset),this.history.push(!1)},_setCommonListStyle:function(e,t){if(!r.isListCell(e))return;t||e.removeAttribute("style");const n=r.getArrayItem((t||e).childNodes,(function(e){return!r.isBreak(e)&&!r.onlyZeroWidthSpace(e.textContent.trim())}),!0);if(n[0]&&1===n.length){if(!(t=n[0])||1!==t.nodeType)return;const i=t.style,l=e.style;/STRONG/i.test(t.nodeName)?l.fontWeight="bold":i.fontWeight&&(l.fontWeight=i.fontWeight),i.color&&(l.color=i.color),i.fontSize&&(l.fontSize=i.fontSize),this._setCommonListStyle(e,t)}},_stripRemoveNode:function(e){const t=e.parentNode;if(!e||3===e.nodeType||!t)return;const n=e.childNodes;for(;n[0];)t.insertBefore(n[0],e);t.removeChild(e)},_util_getMaintainedNode:function(e,t,n){return!n||e?null:this.getParentElement(n,this._isMaintainedNode.bind(this))||(t?null:this.getParentElement(n,this._isSizeNode.bind(this)))},_util_isMaintainedNode:function(e,t,n){if(!n||e||1!==n.nodeType)return!1;const i=this._isMaintainedNode(n);return this.getParentElement(n,this._isMaintainedNode.bind(this))?i:i||!t&&this._isSizeNode(n)},_nodeChange_oneLine:function(e,t,n,i,l,o,s,c,d,u,h,g,p){let m=i.parentNode;for(;!(m.nextSibling||m.previousSibling||r.isFormatElement(m.parentNode)||r.isWysiwygDiv(m.parentNode))&&m.nodeName!==t.nodeName;)m=m.parentNode;if(!d&&m===o.parentNode&&m.nodeName===t.nodeName&&r.onlyZeroWidthSpace(i.textContent.slice(0,l))&&r.onlyZeroWidthSpace(o.textContent.slice(s))){const e=m.childNodes;let n=!0;for(let t,l,s,a,c=0,d=e.length;c0&&(n=t.test(e.style.cssText)),!n}if(function e(i,l){const o=i.childNodes;for(let i,s=0,a=o.length;s=N?L-N:S.data.length-N));if(E){const t=g(l);if(t&&t.parentNode!==e){let n=t,i=null;for(;n.parentNode!==e;){for(l=i=n.parentNode.cloneNode(!1);n.childNodes[0];)i.appendChild(n.childNodes[0]);n.appendChild(i),n=n.parentNode}n.parentNode.appendChild(t)}E=E.cloneNode(!1)}r.onlyZeroWidthSpace(o)||l.appendChild(o);const c=g(l);for(c&&(E=c),E&&(e=E),C=a,y=[],x="";C!==e&&C!==f&&null!==C;)i=p(C)?null:n(C),i&&1===C.nodeType&&z(C)&&(y.push(i),x+=C.style.cssText.substr(0,C.style.cssText.indexOf(":"))+"|"),C=C.parentNode;const d=y.pop()||s;for(w=C=d;y.length>0;)C=y.pop(),w.appendChild(C),w=C;if(t.appendChild(d),e.appendChild(t),E&&!g(T)&&(t=t.cloneNode(!1),b.appendChild(t),_.push(t)),S=s,N=0,k=!0,C!==s&&C.appendChild(S),!v)continue}if(A||a!==T){if(k){if(1===a.nodeType&&!r.isBreak(a)){r._isIgnoreNodeChange(a)?(b.appendChild(a.cloneNode(!0)),u||(t=t.cloneNode(!1),b.appendChild(t),_.push(t))):e(a,a);continue}C=a,y=[],x="";const o=[];for(;null!==C.parentNode&&C!==f&&C!==t;)i=A?C.cloneNode(!1):n(C),1===C.nodeType&&!r.isBreak(a)&&i&&z(C)&&(p(C)?E||o.push(i):y.push(i),x+=C.style.cssText.substr(0,C.style.cssText.indexOf(":"))+"|"),C=C.parentNode;y=y.concat(o);const s=y.pop()||a;for(w=C=s;y.length>0;)C=y.pop(),w.appendChild(C),w=C;if(p(t.parentNode)&&!p(s)&&(t=t.cloneNode(!1),b.appendChild(t),_.push(t)),A||E||!p(s))s===a?l=A?b:t:A?(b.appendChild(s),l=C):(t.appendChild(s),l=C);else{t=t.cloneNode(!1);const e=s.childNodes;for(let n=0,i=e.length;n0?C:t}if(E&&3===a.nodeType)if(g(a)){const e=r.getParentElement(l,function(e){return this._isMaintainedNode(e.parentNode)||e.parentNode===b}.bind(r));E.appendChild(e),t=e.cloneNode(!1),_.push(t),b.appendChild(t)}else E=null}d=a.cloneNode(!1),l.appendChild(d),1!==a.nodeType||r.isBreak(a)||(h=d),e(a,h)}else{E=g(a);const e=r.createTextNode(1===T.nodeType?"":T.substringData(L,T.length-L)),l=r.createTextNode(v||1===T.nodeType?"":T.substringData(0,L));if(E?E=E.cloneNode(!1):p(t.parentNode)&&!E&&(t=t.cloneNode(!1),b.appendChild(t),_.push(t)),!r.onlyZeroWidthSpace(e)){C=a,x="",y=[];const t=[];for(;C!==b&&C!==f&&null!==C;)1===C.nodeType&&z(C)&&(p(C)?t.push(C.cloneNode(!1)):y.push(C.cloneNode(!1)),x+=C.style.cssText.substr(0,C.style.cssText.indexOf(":"))+"|"),C=C.parentNode;for(y=y.concat(t),d=w=C=y.pop()||e;y.length>0;)C=y.pop(),w.appendChild(C),w=C;b.appendChild(d),C.textContent=e.data}if(E&&d){const e=g(d);e&&(E=e)}for(C=a,y=[],x="";C!==b&&C!==f&&null!==C;)i=p(C)?null:n(C),i&&1===C.nodeType&&z(C)&&(y.push(i),x+=C.style.cssText.substr(0,C.style.cssText.indexOf(":"))+"|"),C=C.parentNode;const o=y.pop()||l;for(w=C=o;y.length>0;)C=y.pop(),w.appendChild(C),w=C;E?((t=t.cloneNode(!1)).appendChild(o),E.insertBefore(t,E.firstChild),b.appendChild(E),_.push(t),E=null):t.appendChild(o),T=l,L=l.data.length,A=!0,!c&&u&&(t=l,l.textContent=r.zeroWidthSpace),C!==l&&C.appendChild(T)}}}(e,b),d&&!c&&!h.v)return{ancestor:e,startContainer:i,startOffset:l,endContainer:o,endOffset:s};if(c=c&&d)for(let e=0;e<_.length;e++){let t,n,i,l=_[e];if(u)t=r.createTextNode(r.zeroWidthSpace),b.replaceChild(t,l);else{const e=l.childNodes;for(n=e[0];e[0];)i=e[0],b.insertBefore(i,l);r.removeItem(l)}0===e&&(u?S=T=t:(S=n,T=i))}else{if(d)for(let e=0;e<_.length;e++)this._stripRemoveNode(_[e]);u&&(S=T=t)}r.removeEmptyNode(b,t),u&&(N=S.textContent.length,L=T.textContent.length);const M=c||0===T.textContent.length;r.isBreak(T)||0!==T.textContent.length||(r.removeItem(T),T=S),L=M?T.textContent.length:L;const H={s:0,e:0},I=r.getNodePath(S,b,H),D=!T.parentNode;D&&(T=S);const O={s:0,e:0},F=r.getNodePath(T,b,D||M?null:O);N+=H.s,L=u?N:D?S.textContent.length:M?L+H.s:L+O.s;const R=r.mergeSameTags(b,[I,F],!0);return e.parentNode.replaceChild(b,e),S=r.getNodeFromPath(I,b),T=r.getNodeFromPath(F,b),{ancestor:b,startContainer:S,startOffset:N+R[0],endContainer:T,endOffset:L+R[1]}},_nodeChange_startLine:function(e,t,n,i,l,o,s,a,c,d,u){let h=i.parentNode;for(;!(h.nextSibling||h.previousSibling||r.isFormatElement(h.parentNode)||r.isWysiwygDiv(h.parentNode))&&h.nodeName!==t.nodeName;)h=h.parentNode;if(!s&&h.nodeName===t.nodeName&&!r.isFormatElement(h)&&!h.nextSibling&&r.onlyZeroWidthSpace(i.textContent.slice(0,l))){let n=!0,o=i.previousSibling;for(;o;){if(!r.onlyZeroWidthSpace(o)){n=!1;break}o=o.previousSibling}if(n)return r.copyTagAttributes(h,t),{ancestor:e,container:i,offset:l}}a.v=!1;const g=e,p=[t],m=e.cloneNode(!1);let f,_,b,v,y=i,C=l,w=!1;if(function e(i,l){const o=i.childNodes;for(let i,s,a=0,h=o.length;a0,y=f.pop()||h;for(b=_=y;f.length>0;)_=f.pop(),b.appendChild(_),b=_;if(d(t.parentNode)&&!d(y)&&(t=t.cloneNode(!1),m.appendChild(t),p.push(t)),!v&&d(y)){t=t.cloneNode(!1);const e=y.childNodes;for(let n=0,i=e.length;n0;)_=f.pop(),b.appendChild(_),b=_;d!==l?(t.appendChild(d),l=_):l=t,r.isBreak(h)&&t.appendChild(h.cloneNode(!1)),e.appendChild(t),y=s,C=0,w=!0,l.appendChild(y)}}}(e,m),s&&!o&&!a.v)return{ancestor:e,container:i,offset:l,endContainer:u};if(o=o&&s)for(let e=0;e0&&u===h)return e.innerHTML=i.innerHTML,{ancestor:e,endContainer:n?r.getNodeFromPath(n,e):null}}o.v=!1;const a=e.cloneNode(!1),c=[t];let d=!0;if(function e(i,l){const o=i.childNodes;for(let i,u,h=0,g=o.length;h0&&(a.appendChild(t),t=t.cloneNode(!1)),u=g.cloneNode(!0),a.appendChild(u),a.appendChild(t),c.push(t),l=t,s&&g.contains(s)){const e=r.getNodePath(s,g);s=r.getNodeFromPath(e,u)}}}(e,t),d||l&&!i&&!o.v)return{ancestor:e,endContainer:s};if(a.appendChild(t),i&&l)for(let e=0;e0,u=m.pop()||a;for(_=f=u;m.length>0;)f=m.pop(),_.appendChild(f),_=f;if(d(t.parentNode)&&!d(u)&&(t=t.cloneNode(!1),p.insertBefore(t,p.firstChild),g.push(t)),!b&&d(u)){t=t.cloneNode(!1);const e=u.childNodes;for(let n=0,i=e.length;n0?f:t}else s?(t.insertBefore(u,t.firstChild),l=f):l=t;if(b&&3===a.nodeType)if(c(a)){const e=r.getParentElement(l,function(e){return this._isMaintainedNode(e.parentNode)||e.parentNode===p}.bind(r));b.appendChild(e),t=e.cloneNode(!1),g.push(t),p.insertBefore(t,p.firstChild)}else b=null}if(C||a!==v)i=C?n(a):a.cloneNode(!1),i&&(l.insertBefore(i,l.firstChild),1!==a.nodeType||r.isBreak(a)||(u=i)),e(a,u);else{b=c(a);const e=r.createTextNode(1===v.nodeType?"":v.substringData(y,v.length-y)),o=r.createTextNode(1===v.nodeType?"":v.substringData(0,y));if(b){b=b.cloneNode(!1);const e=c(l);if(e&&e.parentNode!==p){let t=e,n=null;for(;t.parentNode!==p;){for(l=n=t.parentNode.cloneNode(!1);t.childNodes[0];)n.appendChild(t.childNodes[0]);t.appendChild(n),t=t.parentNode}t.parentNode.insertBefore(e,t.parentNode.firstChild)}b=b.cloneNode(!1)}else d(t.parentNode)&&!b&&(t=t.cloneNode(!1),p.appendChild(t),g.push(t));for(r.onlyZeroWidthSpace(e)||l.insertBefore(e,l.firstChild),f=l,m=[];f!==p&&null!==f;)i=d(f)?null:n(f),i&&1===f.nodeType&&m.push(i),f=f.parentNode;const s=m.pop()||l;for(_=f=s;m.length>0;)f=m.pop(),_.appendChild(f),_=f;s!==l?(t.insertBefore(s,t.firstChild),l=f):l=t,r.isBreak(a)&&t.appendChild(a.cloneNode(!1)),b?(b.insertBefore(t,b.firstChild),p.insertBefore(b,p.firstChild),b=null):p.insertBefore(t,p.firstChild),v=o,y=o.data.length,C=!0,l.insertBefore(v,l.firstChild)}}}(e,p),s&&!o&&!a.v)return{ancestor:e,container:i,offset:l};if(o=o&&s)for(let e=0;e-1?null:r.createElement(n);let d=n;/^SUB$/i.test(n)&&a.indexOf("SUP")>-1?d="SUP":/^SUP$/i.test(n)&&a.indexOf("SUB")>-1&&(d="SUB"),this.nodeChange(c,null,[d],!1),this.focus()}},removeFormat:function(){this.nodeChange(null,null,null,null)},indent:function(e){const t=this.getRange(),n=this.getSelectedElements(null),i=[],l="indent"!==e;let o=t.startContainer,s=t.endContainer,a=t.startOffset,c=t.endOffset;for(let e,t,o=0,s=n.length;o0&&this.plugins.list.editInsideList.call(this,l,i),this.effectNode=null,this.setRange(o,a,s,c),this.history.push(!1)},toggleDisplayBlocks:function(){const t=e.element.wysiwyg;r.toggleClass(t,"se-show-block"),r.hasClass(t,"se-show-block")?r.addClass(this._styleCommandMap.showBlocks,"active"):r.removeClass(this._styleCommandMap.showBlocks,"active"),this._resourcesStateChange()},toggleCodeView:function(){const t=this._variable.isCodeView;this.controllersOff(),r.setDisabledButtons(!t,this.codeViewDisabledButtons),t?(this._setCodeDataToEditor(),e.element.wysiwygFrame.scrollTop=0,e.element.code.style.display="none",e.element.wysiwygFrame.style.display="block",this._variable._codeOriginCssText=this._variable._codeOriginCssText.replace(/(\s?display(\s+)?:(\s+)?)[a-zA-Z]+(?=;)/,"display: none"),this._variable._wysiwygOriginCssText=this._variable._wysiwygOriginCssText.replace(/(\s?display(\s+)?:(\s+)?)[a-zA-Z]+(?=;)/,"display: block"),"auto"!==l.height||l.codeMirrorEditor||(e.element.code.style.height="0px"),this._variable.isCodeView=!1,this._variable.isFullScreen||(this._notHideToolbar=!1,/balloon|balloon-always/i.test(l.mode)&&(e.element._arrow.style.display="",this._isInline=!1,this._isBalloon=!0,u._hideToolbar())),this.nativeFocus(),r.removeClass(this._styleCommandMap.codeView,"active"),this.history.push(!1)):(this._setEditorDataToCodeView(),this._variable._codeOriginCssText=this._variable._codeOriginCssText.replace(/(\s?display(\s+)?:(\s+)?)[a-zA-Z]+(?=;)/,"display: block"),this._variable._wysiwygOriginCssText=this._variable._wysiwygOriginCssText.replace(/(\s?display(\s+)?:(\s+)?)[a-zA-Z]+(?=;)/,"display: none"),"auto"!==l.height||l.codeMirrorEditor||(e.element.code.style.height=e.element.code.scrollHeight>0?e.element.code.scrollHeight+"px":"auto"),l.codeMirrorEditor&&l.codeMirrorEditor.refresh(),this._variable.isCodeView=!0,this._variable.isFullScreen||(this._notHideToolbar=!0,this._isBalloon&&(e.element._arrow.style.display="none",e.element.toolbar.style.left="",this._isInline=!0,this._isBalloon=!1,u._showToolbarInline())),this._variable._range=null,e.element.code.focus(),r.addClass(this._styleCommandMap.codeView,"active")),this._checkPlaceholder(),"function"==typeof h.toggleCodeView&&h.toggleCodeView(this._variable.isCodeView,this)},_setCodeDataToEditor:function(){const t=this._getCodeView();if(l.fullPage){const e=this._parser.parseFromString(t,"text/html"),n=e.head.children;for(let t=0,i=n.length;t0?this.convertContentsForEditor(t):"


    "},_setEditorDataToCodeView:function(){const t=this.convertHTMLForCodeView(e.element.wysiwyg);let n="";if(l.fullPage){const e=r.getAttributesToString(this._wd.body,null);n="\n\n"+this._wd.head.outerHTML.replace(/>(?!\n)/g,">\n")+"\n"+t+"\n"}else n=t;e.element.code.style.display="block",e.element.wysiwygFrame.style.display="none",this._setCodeView(n)},toggleFullScreen:function(t){const n=e.element.topArea,i=e.element.toolbar,o=e.element.editorArea,d=e.element.wysiwygFrame,g=e.element.code,p=this._variable;this.controllersOff(),p.isFullScreen?(p.isFullScreen=!1,d.style.cssText=p._wysiwygOriginCssText,g.style.cssText=p._codeOriginCssText,i.style.cssText="",o.style.cssText=p._editorAreaOriginCssText,n.style.cssText=p._originCssText,s.body.style.overflow=p._bodyOverflow,l.toolbarContainer&&l.toolbarContainer.appendChild(i),l.stickyToolbar>-1&&r.removeClass(i,"se-toolbar-sticky"),p._fullScreenAttrs.sticky&&!l.toolbarContainer&&(p._fullScreenAttrs.sticky=!1,e.element._stickyDummy.style.display="block",r.addClass(i,"se-toolbar-sticky")),this._isInline=p._fullScreenAttrs.inline,this._isBalloon=p._fullScreenAttrs.balloon,this._isInline&&u._showToolbarInline(),l.toolbarContainer&&r.removeClass(i,"se-toolbar-balloon"),u.onScroll_window(),r.changeElement(t.firstElementChild,c.expansion),r.removeClass(this._styleCommandMap.fullScreen,"active")):(p.isFullScreen=!0,p._fullScreenAttrs.inline=this._isInline,p._fullScreenAttrs.balloon=this._isBalloon,(this._isInline||this._isBalloon)&&(this._isInline=!1,this._isBalloon=!1),l.toolbarContainer&&e.element.relative.insertBefore(i,o),n.style.position="fixed",n.style.top="0",n.style.left="0",n.style.width="100%",n.style.maxWidth="100%",n.style.height="100%",n.style.zIndex="2147483647",""!==e.element._stickyDummy.style.display&&(p._fullScreenAttrs.sticky=!0,e.element._stickyDummy.style.display="none",r.removeClass(i,"se-toolbar-sticky")),p._bodyOverflow=s.body.style.overflow,s.body.style.overflow="hidden",p._editorAreaOriginCssText=o.style.cssText,p._wysiwygOriginCssText=d.style.cssText,p._codeOriginCssText=g.style.cssText,o.style.cssText=i.style.cssText="",d.style.cssText=(d.style.cssText.match(/\s?display(\s+)?:(\s+)?[a-zA-Z]+;/)||[""])[0],g.style.cssText=(g.style.cssText.match(/\s?display(\s+)?:(\s+)?[a-zA-Z]+;/)||[""])[0],i.style.width=d.style.height=g.style.height="100%",i.style.position="relative",i.style.display="block",p.innerHeight_fullScreen=a.innerHeight-i.offsetHeight,o.style.height=p.innerHeight_fullScreen+"px",r.changeElement(t.firstElementChild,c.reduction),l.iframe&&"auto"===l.height&&(o.style.overflow="auto",this._iframeAutoHeight()),r.addClass(this._styleCommandMap.fullScreen,"active")),"function"==typeof h.toggleFullScreen&&h.toggleFullScreen(this._variable.isFullScreen,this)},print:function(){const e=r.createElement("IFRAME");e.style.display="none",s.body.appendChild(e);const t=r.getIframeDocument(e),n=this.getContents(!0),i=this._wd;if(l.iframe){const e=l.fullPage?r.getAttributesToString(i.body,["contenteditable"]):'class="sun-editor-editable"';t.write(""+i.head.innerHTML+""+n+"")}else{const e=s.head.getElementsByTagName("link"),i=s.head.getElementsByTagName("style");let l="";for(let t=0,n=e.length;t"+l+''+n+"")}this.showLoading(),a.setTimeout((function(){try{if(e.focus(),r.isIE_Edge||s.documentMode||a.StyleMedia)try{e.contentWindow.document.execCommand("print",!1,null)}catch(t){e.contentWindow.print()}else e.contentWindow.print()}catch(e){throw Error("[SUNEDITOR.core.print.fail] error: "+e)}finally{d.closeLoading(),r.removeItem(e)}}),1e3)},preview:function(){d.submenuOff(),d.containerOff(),d.controllersOff();const t=this.getContents(!0),n=a.open("","_blank");n.mimeType="text/html";const o=e.element.wysiwygFrame.offsetWidth+"px !important",c=this._wd;if(l.iframe){const e=l.fullPage?r.getAttributesToString(c.body,["contenteditable"]):'class="sun-editor-editable"';n.document.write(""+c.head.innerHTML+""+t+"")}else{const e=s.head.getElementsByTagName("link"),l=s.head.getElementsByTagName("style");let a="";for(let t=0,n=e.length;t'+i.toolbar.preview+""+a+''+t+"")}},setContents:function(t){const n=this.convertContentsForEditor(t);if(this._resetComponents(),this._variable.isCodeView){const e=this.convertHTMLForCodeView(n);this._setCodeView(e)}else e.element.wysiwyg.innerHTML=n,this.history.push(!1)},getContents:function(t){const n=e.element.wysiwyg.innerHTML,i=r.createElement("DIV");i.innerHTML=n;const o=r.getListChildren(i,(function(e){return/FIGCAPTION/i.test(e.nodeName)}));for(let e=0,t=o.length;e"+this._wd.head.outerHTML+""+i.innerHTML+""}return i.innerHTML},_makeLine:function(e,t){if(1===e.nodeType)return r._disallowedTags(e)?"":!t||r.isFormatElement(e)||r.isRangeFormatElement(e)||r.isComponent(e)||r.isMedia(e)||r.isAnchor(e)&&r.isMedia(e.firstElementChild)?e.outerHTML:"

    "+e.outerHTML+"

    ";if(3===e.nodeType){if(!t)return e.textContent;const n=e.textContent.split(/\n/g);let i="";for(let e,t=0,l=n.length;t0&&(i+="

    "+e+"

    ");return i}return 8===e.nodeType&&this._allowHTMLComments?"\x3c!--"+e.textContent.trim()+"--\x3e":""},_tagConvertor:function(e){if(!this._disallowedTextTagsRegExp)return e;const t={b:"strong",i:"em",ins:"u",strike:"del",s:"del"};return e.replace(this._disallowedTextTagsRegExp,(function(e,n,i){return n+("string"==typeof t[i]?t[i]:i)}))},_deleteDisallowedTags:function(e){return e.replace(/\n/g,"").replace(/<(script|style).*>(\n|.)*<\/(script|style)>/gi,"").replace(/<[a-z0-9]+\:[a-z0-9]+[^>^\/]*>[^>]*<\/[a-z0-9]+\:[a-z0-9]+>/gi,"").replace(this.editorTagsWhitelistRegExp,"")},cleanHTML:function(e,t){e=this._deleteDisallowedTags(e).replace(/(<[a-zA-Z0-9]+)[^>]*(?=>)/g,function(e,t){if(/^<[a-z0-9]+\:[a-z0-9]+/i.test(e))return e;let n=null;const i=this._attributesTagsWhitelist[t.match(/(?!<)[a-zA-Z0-9]+/)[0].toLowerCase()];if(n=i?e.match(i):e.match(this._attributesWhitelistRegExp),/

    ":(i=r.htmlRemoveWhiteSpace(i),this._tagConvertor(i))},convertHTMLForCodeView:function(e){let t="";const n=a.RegExp,i=new n("^(BLOCKQUOTE|PRE|TABLE|THEAD|TBODY|TR|TH|TD|OL|UL|IMG|IFRAME|VIDEO|AUDIO|FIGURE|FIGCAPTION|HR|BR|CANVAS|SELECT)$","i"),l=r.isFormatElement.bind(r),o="string"==typeof e?s.createRange().createContextualFragment(e):e;let c=1*this._variable.codeIndent;return c=c>0?new a.Array(c+1).join(" "):"",function e(o,s,a){const d=o.childNodes,u=i.test(o.nodeName),h=u?s:"";for(let g,p,m,f=0,_=d.length;f<_;f++){if(g=d[f],m=i.test(g.nodeName),p=m?"\n":"",a=!l(g)||u||/^(TH|TD)$/i.test(o.nodeName)?"":"\n",8===g.nodeType){t+="\n\x3c!-- "+g.textContent.trim()+" --\x3e"+p;continue}if(3===g.nodeType){t+=r._HTMLConvertor(/^\n+$/.test(g.data)?"":g.data);continue}if(0===g.childNodes.length){t+=(/^HR$/i.test(g.nodeName)?"\n":"")+h+g.outerHTML+p;continue}g.innerHTML=g.innerHTML;const _=g.nodeName.toLowerCase();t+=(a||(u?"":p))+(h||m?s:"")+g.outerHTML.match(n("<"+_+"[^>]*>","i"))[0]+p,e(g,s+c,""),t+=(m?s:"")+""+(a||p||u||/^(TH|TD)$/i.test(g.nodeName)?"\n":"")}}(o,"","\n"),t.trim()+"\n"},addDocEvent:function(e,t,n){s.addEventListener(e,t,n),l.iframe&&this._wd.addEventListener(e,t)},removeDocEvent:function(e,t){s.removeEventListener(e,t),l.iframe&&this._wd.removeEventListener(e,t)},_charCount:function(e){const t=l.maxCharCount,n=l.charCounterType;let i=0;if(e&&(i=this.getCharLength(e,n)),this._setCharCount(),t>0){let e=!1;const l=h.getCharCount(n);if(l>t){if(e=!0,i>0){this._editorRange();const e=this.getRange(),n=e.endOffset-1,i=this.getSelectionNode().textContent,o=e.endOffset-(l-t);this.getSelectionNode().textContent=i.slice(0,o<0?0:o)+i.slice(e.endOffset,i.length),this.setRange(e.endContainer,n,e.endContainer,n)}}else l+i>t&&(e=!0);if(e&&(this._callCounterBlink(),i>0))return!1}return!0},checkCharCount:function(e,t){if(l.maxCharCount){const n=t||l.charCounterType,i=this.getCharLength("string"==typeof e?e:this._charTypeHTML?e.outerHTML:e.textContent,n);if(i>0&&i+h.getCharCount(n)>l.maxCharCount)return this._callCounterBlink(),!1}return!0},getCharLength:function(e,t){return/byte/.test(t)?r.getByteLength(e):e.length},_setCharCount:function(){e.element.charCounter&&a.setTimeout((function(){e.element.charCounter.textContent=h.getCharCount(l.charCounterType)}))},_callCounterBlink:function(){const t=e.element.charWrapper;t&&!r.hasClass(t,"se-blink")&&(r.addClass(t,"se-blink"),a.setTimeout((function(){r.removeClass(t,"se-blink")}),600))},_checkComponents:function(){for(let e=0,t=this._fileInfoPluginsCheck.length;e^<]+)?\\s*(?=>)","gi");const h="contenteditable|colspan|rowspan|target|href|src|class|type|controls|data-format|data-size|data-file-size|data-file-name|data-origin|data-align|data-image-link|data-rotate|data-proportion|data-percentage|origin-size|data-exp|data-font-size";this._allowHTMLComments=l._editorTagsWhitelist.indexOf("//")>-1,this._htmlCheckWhitelistRegExp=new c("^("+l._editorTagsWhitelist.replace("|//","")+")$","i"),this.editorTagsWhitelistRegExp=r.createTagsWhitelist(l._editorTagsWhitelist.replace("|//","|\x3c!--|--\x3e")),this.pasteTagsWhitelistRegExp=r.createTagsWhitelist(l.pasteTagsWhitelist);const g=l.attributesWhitelist,p={};let m="";if(g)for(let e in g)r.hasOwn(g,e)&&("all"===e?m=g[e]+"|":p[e]=new c("((?:"+g[e]+"|"+h+')s*=s*"[^"]*")',"ig"));this._attributesWhitelistRegExp=new c("((?:"+m+h+')s*=s*"[^"]*")',"ig"),this._attributesTagsWhitelist=p,this._isInline=/inline/i.test(l.mode),this._isBalloon=/balloon|balloon-always/i.test(l.mode),this._isBalloonAlways=/balloon-always/i.test(l.mode),this._cachingButtons(),this._fileInfoPluginsCheck=[],this._fileInfoPluginsReset=[],this.managedTagsInfo={query:"",map:{}};const f=[];this.activePlugins=[],this._fileManager.tags=[],this._fileManager.pluginMap={};let _,b,v=[];for(let e in n)if(r.hasOwn(n,e)){if(_=n[e],b=t[e],_.active&&b&&this.callPlugin(e,null,b),"function"==typeof _.checkFileInfo&&"function"==typeof _.resetFileInfo&&(this.callPlugin(e,null,b),this._fileInfoPluginsCheck.push(_.checkFileInfo.bind(this)),this._fileInfoPluginsReset.push(_.resetFileInfo.bind(this))),a.Array.isArray(_.fileTags)){const t=_.fileTags;this.callPlugin(e,null,b),this._fileManager.tags=this._fileManager.tags.concat(t),v.push(e);for(let n=0,i=t.length;nc&&(d=d.slice(0,c),a&&a.setAttribute("disabled",!0)),d[c]=l?{contents:n,s:{path:i.getNodePath(l.startContainer,null,null),offset:l.startOffset},e:{path:i.getNodePath(l.endContainer,null,null),offset:l.endOffset}}:{contents:n,s:{path:[0,0],offset:[0,0]},e:{path:0,offset:0}},1===c&&s&&s.removeAttribute("disabled"),e._setCharCount(),t()}return{stack:d,push:function(t){n.setTimeout(e._resourcesStateChange.bind(e));const i="number"==typeof t?t>0?t:0:t?l:0;i&&!r||(n.clearTimeout(r),i)?r=n.setTimeout((function(){n.clearTimeout(r),r=null,h()}),i):h()},undo:function(){c>0&&(c--,u())},redo:function(){d.length-1>c&&(c++,u())},go:function(e){c=e<0?d.length-1:e,u()},reset:function(n){s&&s.setAttribute("disabled",!0),a&&a.setAttribute("disabled",!0),e.context.tool.save&&e.context.tool.save.setAttribute("disabled",!0),d.splice(0),c=0,d[c]={contents:e.getContents(!0),s:{path:[0,0],offset:0},e:{path:[0,0],offset:0}},n||t()},_resetCachingButton:function(){o=e.context.element,s=e.context.tool.undo,a=e.context.tool.redo,0===c?(s&&s.setAttribute("disabled",!0),a&&c===d.length-1&&a.setAttribute("disabled",!0),e.context.tool.save&&e.context.tool.save.setAttribute("disabled",!0)):c===d.length-1&&a&&a.setAttribute("disabled",!0)},_destroy:function(){r&&n.clearTimeout(r),d=null}}}(this,this._onChange_historyStack.bind(this)),this.addModule([B]),l.iframe&&(this._wd=e.element.wysiwygFrame.contentDocument,e.element.wysiwyg=this._wd.body,l._editorStyles.editor&&(e.element.wysiwyg.style.cssText=l._editorStyles.editor),"auto"===l.height&&(this._iframeAuto=this._wd.body)),this._initWysiwygArea(i,o)},_cachingButtons:function(){this.codeViewDisabledButtons=e.element.toolbar.querySelectorAll('.se-toolbar button:not([class~="se-code-view-enabled"])'),this.resizingDisabledButtons=e.element.toolbar.querySelectorAll('.se-toolbar button:not([class~="se-resizing-enabled"])');const t=e.tool;this.commandMap={STRONG:t.bold,U:t.underline,EM:t.italic,DEL:t.strike,SUB:t.subscript,SUP:t.superscript,OUTDENT:t.outdent,INDENT:t.indent},this._styleCommandMap={fullScreen:t.fullScreen,showBlocks:t.showBlocks,codeView:t.codeView}},_initWysiwygArea:function(t,n){e.element.wysiwyg.innerHTML=t?n:this.convertContentsForEditor("string"==typeof n?n:e.element.originElement.value)},_resourcesStateChange:function(){this._iframeAutoHeight(),this._checkPlaceholder()},_onChange_historyStack:function(){u._applyTagEffects(),e.tool.save&&e.tool.save.removeAttribute("disabled"),h.onChange&&h.onChange(this.getContents(!0),this)},_iframeAutoHeight:function(){this._iframeAuto&&a.setTimeout((function(){e.element.wysiwygFrame.style.height=d._iframeAuto.offsetHeight+"px"}))},_checkPlaceholder:function(){if(this._placeholder){if(this._variable.isCodeView)return void(this._placeholder.style.display="none");const t=e.element.wysiwyg;!r.onlyZeroWidthSpace(t.textContent)||t.querySelector(".se-component, pre, blockquote, hr, li, table, img, iframe, video")||(t.innerText.match(/\n/g)||"").length>1?this._placeholder.style.display="none":this._placeholder.style.display="block"}},_setDefaultFormat:function(e){if(this._fileManager.pluginRegExp.test(this.currentControllerName))return;const t=this.getRange(),n=t.commonAncestorContainer,i=t.startContainer,l=r.getRangeFormatElement(n,null);let o,s,a;const c=r.getParentElement(n,r.isComponent);if((!c||r.isTable(c))&&(!r.isRangeFormatElement(i)&&!r.isWysiwygDiv(i)||!r.isComponent(i.childNodes[t.startOffset]))){if(l)return a=r.createElement(e||"P"),a.innerHTML=l.innerHTML,0===a.childNodes.length&&(a.innerHTML=r.zeroWidthSpace),l.innerHTML=a.outerHTML,a=l.firstChild,o=r.getEdgeChildNodes(a,null).sc,o||(o=r.createTextNode(r.zeroWidthSpace),a.insertBefore(o,a.firstChild)),s=o.textContent.length,void this.setRange(o,s,o,s);if(r.isRangeFormatElement(n)&&n.childNodes.length<=1){let e=null;return 1===n.childNodes.length&&r.isBreak(n.firstChild)?e=n.firstChild:(e=r.createTextNode(r.zeroWidthSpace),n.appendChild(e)),void this.setRange(e,1,e,1)}if(this.execCommand("formatBlock",!1,e||"P"),o=r.getEdgeChildNodes(n,n),o=o?o.ec:n,a=r.getFormatElement(o,null),!a)return this.removeRange(),void this._editorRange();if(r.isBreak(a.nextSibling)&&r.removeItem(a.nextSibling),r.isBreak(a.previousSibling)&&r.removeItem(a.previousSibling),r.isBreak(o)){const e=r.createTextNode(r.zeroWidthSpace);o.parentNode.insertBefore(e,o),o=e}this.effectNode=null,this.nativeFocus()}},_setOptionsInit:function(t,n){this.context=e=A(t.originElement,this._getConstructed(t),l),this._componentsInfoReset=!0,this._editorInit(!0,n)},_editorInit:function(t,n){this._init(t,n),u._addEvent(),this._setCharCount(),u._offStickyToolbar(),u.onResize_window(),e.element.toolbar.style.visibility="",this._checkComponents(),this._componentsInfoInit=!1,this._componentsInfoReset=!1,this.history.reset(!0),this._resourcesStateChange(),a.setTimeout((function(){"function"==typeof h.onload&&h.onload(d,t)}))},_getConstructed:function(e){return{_top:e.topArea,_relative:e.relative,_toolBar:e.toolbar,_menuTray:e._menuTray,_editorArea:e.editorArea,_wysiwygArea:e.wysiwygFrame,_codeArea:e.code,_placeholder:e.placeholder,_resizingBar:e.resizingBar,_navigation:e.navigation,_charCounter:e.charCounter,_charWrapper:e.charWrapper,_loading:e.loading,_lineBreaker:e.lineBreaker,_lineBreaker_t:e.lineBreaker_t,_lineBreaker_b:e.lineBreaker_b,_resizeBack:e.resizeBackground,_stickyDummy:e._stickyDummy,_arrow:e._arrow}}},u={_IEisComposing:!1,_lineBreakerBind:null,_responsiveCurrentSize:"default",_responsiveButtonSize:null,_responsiveButtons:null,_directionKeyCode:new a.RegExp("^(8|13|3[2-9]|40|46)$"),_nonTextKeyCode:new a.RegExp("^(8|13|1[6-9]|20|27|3[3-9]|40|45|46|11[2-9]|12[0-3]|144|145)$"),_historyIgnoreKeyCode:new a.RegExp("^(1[6-9]|20|27|3[3-9]|40|45|11[2-9]|12[0-3]|144|145)$"),_onButtonsCheck:new a.RegExp("^(STRONG|U|EM|DEL|SUB|SUP)$"),_frontZeroWidthReg:new a.RegExp(r.zeroWidthSpace+"+",""),_keyCodeShortcut:{65:"A",66:"B",83:"S",85:"U",73:"I",89:"Y",90:"Z",219:"[",221:"]"},_shortcutCommand:function(e,t){let n=null;switch(u._keyCodeShortcut[e]){case"A":n="selectAll";break;case"B":-1===l.shortcutsDisable.indexOf("bold")&&(n="STRONG");break;case"S":t&&-1===l.shortcutsDisable.indexOf("strike")&&(n="DEL");break;case"U":-1===l.shortcutsDisable.indexOf("underline")&&(n="U");break;case"I":-1===l.shortcutsDisable.indexOf("italic")&&(n="EM");break;case"Z":-1===l.shortcutsDisable.indexOf("undo")&&(n=t?"redo":"undo");break;case"Y":-1===l.shortcutsDisable.indexOf("undo")&&(n="redo");break;case"[":-1===l.shortcutsDisable.indexOf("indent")&&(n="outdent");break;case"]":-1===l.shortcutsDisable.indexOf("indent")&&(n="indent")}return!!n&&(d.commandHandler(d.commandMap[n],n),!0)},_applyTagEffects:function(){let t=d.getSelectionNode();if(t===d.effectNode)return;d.effectNode=t;const i=d.commandMap,o=this._onButtonsCheck,s=[],a=[],c=d.activePlugins,u=c.length;let h="";for(;t.firstChild;)t=t.firstChild;for(let e=t;!r.isWysiwygDiv(e)&&e;e=e.parentNode)if(1===e.nodeType&&!r.isBreak(e)){h=e.nodeName.toUpperCase(),a.push(h);for(let t,i=0;i0)&&(s.push("OUTDENT"),i.OUTDENT.removeAttribute("disabled")),-1===s.indexOf("INDENT")&&i.INDENT&&r.isListCell(e)&&!e.previousElementSibling&&(s.push("INDENT"),i.INDENT.setAttribute("disabled",!0))):o.test(h)&&(s.push(h),r.addClass(i[h],"active"))}for(let e in i)s.indexOf(e)>-1||!r.hasOwn(i,e)||(c.indexOf(e)>-1?n[e].active.call(d,null):i.OUTDENT&&/^OUTDENT$/i.test(e)?i.OUTDENT.setAttribute("disabled",!0):i.INDENT&&/^INDENT$/i.test(e)?i.INDENT.removeAttribute("disabled"):r.removeClass(i[e],"active"));d._variable.currentNodes=a.reverse(),d._variable.currentNodesMap=s,l.showPathLabel&&(e.element.navigation.textContent=d._variable.currentNodes.join(" > "))},_cancelCaptionEdit:function(){this.setAttribute("contenteditable",!1),this.removeEventListener("blur",u._cancelCaptionEdit)},_buttonsEventHandler:function(e){let t=e.target;if(d._bindControllersOff&&e.stopPropagation(),/^(input|textarea|select|option)$/i.test(t.nodeName)?d._antiBlur=!1:e.preventDefault(),r.getParentElement(t,".se-submenu"))e.stopPropagation(),d._notHideToolbar=!0;else{let n=t.getAttribute("data-command"),i=t.className;for(;!n&&!/se-menu-list/.test(i)&&!/sun-editor-common/.test(i);)t=t.parentNode,n=t.getAttribute("data-command"),i=t.className;n!==d._submenuName&&n!==d._containerName||e.stopPropagation()}},onClick_toolbar:function(e){let t=e.target,n=t.getAttribute("data-display"),i=t.getAttribute("data-command"),l=t.className;for(;t.parentNode&&!i&&!/se-menu-list/.test(l)&&!/se-toolbar/.test(l);)t=t.parentNode,i=t.getAttribute("data-command"),n=t.getAttribute("data-display"),l=t.className;(i||n)&&(t.disabled||(d.hasFocus||d.nativeFocus(),d._variable.isCodeView||d._editorRange(),d.actionCall(i,n,t)))},onMouseDown_wysiwyg:function(t){if(r.isNonEditable(e.element.wysiwyg))return;const n=r.getParentElement(t.target,r.isCell);if(n){const e=d.plugins.table;e&&n!==e._fixedCell&&!e._shift&&d.callPlugin("table",(function(){e.onTableCellMultiSelect.call(d,n,!1)}),null)}d._isBalloon&&u._hideToolbar(),/FIGURE/i.test(t.target.nodeName)&&t.preventDefault(),"function"==typeof h.onMouseDown&&h.onMouseDown(t,d)},onClick_wysiwyg:function(t){const n=t.target;if(r.isNonEditable(e.element.wysiwyg))return;const i=d.getFileComponent(n);if(i)return t.preventDefault(),void d.selectComponent(i.target,i.pluginName);const l=r.getParentElement(n,"FIGCAPTION");if(r.isNonEditable(l)&&(t.preventDefault(),l.setAttribute("contenteditable",!0),l.focus(),d._isInline&&!d._inlineToolbarAttr.isShow)){u._showToolbarInline();const e=function(){u._hideToolbar(),l.removeEventListener("blur",e)};l.addEventListener("blur",e)}a.setTimeout(d._editorRange.bind(d)),d._editorRange();const o=d.getSelectionNode(),s=r.getFormatElement(o,null),c=r.getRangeFormatElement(o,null);if(s&&s!==c||r.isNonEditable(n)||r.isList(c))u._applyTagEffects();else{const e=d.getRange();if(r.getFormatElement(e.startContainer)===r.getFormatElement(e.endContainer)){if(r.isList(c)){const e=r.createElement("LI"),t=o.nextElementSibling;e.appendChild(o),c.insertBefore(e,t)}else r.isWysiwygDiv(o)||r.isComponent(o)||r.isTable(o)&&!r.isCell(o)||d._setDefaultFormat(r.isRangeFormatElement(c)?"DIV":"P");t.preventDefault(),d.focus()}}d._isBalloon&&a.setTimeout(u._toggleToolbarBalloon),"function"==typeof h.onClick&&h.onClick(t,d)},_balloonDelay:null,_showToolbarBalloonDelay:function(){u._balloonDelay&&a.clearTimeout(u._balloonDelay),u._balloonDelay=a.setTimeout(function(){a.clearTimeout(this._balloonDelay),this._balloonDelay=null,this._showToolbarBalloon()}.bind(u),350)},_toggleToolbarBalloon:function(){d._editorRange();const e=d.getRange();d._bindControllersOff||!d._isBalloonAlways&&e.collapsed?u._hideToolbar():u._showToolbarBalloon(e)},_showToolbarBalloon:function(t){if(!d._isBalloon)return;const n=t||d.getRange(),i=e.element.toolbar,l=d.getSelection();let o;if(d._isBalloonAlways&&n.collapsed)o=!0;else if(l.focusNode===l.anchorNode)o=l.focusOffset0&&u._getPageBottomSpace()C&&(t=!1,y=!0),y&&(b=(t?n.top-m-g:n.bottom+g)-(n.noText?0:h)+d),i.style.left=a.Math.floor(v)+"px",i.style.top=a.Math.floor(b)+"px",t?(r.removeClass(e.element._arrow,"se-arrow-up"),r.addClass(e.element._arrow,"se-arrow-down"),e.element._arrow.style.top=m+"px"):(r.removeClass(e.element._arrow,"se-arrow-down"),r.addClass(e.element._arrow,"se-arrow-up"),e.element._arrow.style.top=-g+"px");const w=a.Math.floor(p/2+(f-v));e.element._arrow.style.left=(w+g>i.offsetWidth?i.offsetWidth-g:w";const e=f.attributes;for(;e[0];)f.removeAttribute(e[0].name);return d.nativeFocus(),!1}}if(f&&g.startContainer===g.endContainer&&3===c.nodeType&&!r.isFormatElement(c.parentNode)&&(g.collapsed?1===c.textContent.length:g.endOffset-g.startOffset===c.textContent.length)){t.preventDefault();let e=null,n=c.parentNode.previousSibling;const i=c.parentNode.nextSibling;n||(i?(n=i,e=0):(n=r.createElement("BR"),f.appendChild(n))),c.textContent="",r.removeItemAllParents(c,null,f),e="number"==typeof e?e:3===n.nodeType?n.textContent.length:1,d.setRange(n,e,n,e);break}const n=g.commonAncestorContainer;if(f=r.getFormatElement(g.startContainer,null),_=r.getRangeFormatElement(f,null),_&&f&&!r.isCell(_)&&!/^FIGCAPTION$/i.test(_.nodeName)){if(r.isListCell(f)&&r.isList(_)&&(r.isListCell(_.parentNode)||f.previousElementSibling)&&(c===f||3===c.nodeType&&(!c.previousSibling||r.isList(c.previousSibling)))&&(r.getFormatElement(g.startContainer,null)!==r.getFormatElement(g.endContainer,null)?_.contains(g.startContainer):0===g.startOffset&&g.collapsed)){if(g.startContainer!==g.endContainer)t.preventDefault(),d.removeNode(),3===g.startContainer.nodeType&&d.setRange(g.startContainer,g.startContainer.textContent.length,g.startContainer,g.startContainer.textContent.length),d.history.push(!0);else{let e=f.previousElementSibling||_.parentNode;if(r.isListCell(e)){t.preventDefault();let n=e;if(!e.contains(f)&&r.isListCell(n)&&r.isList(n.lastElementChild)){for(n=n.lastElementChild.lastElementChild;r.isListCell(n)&&r.isList(n.lastElementChild);)n=n.lastElementChild&&n.lastElementChild.lastElementChild;e=n}let i=e===_.parentNode?_.previousSibling:e.lastChild;i||(i=r.createTextNode(r.zeroWidthSpace),_.parentNode.insertBefore(i,_.parentNode.firstChild));const l=3===i.nodeType?i.textContent.length:1,o=f.childNodes;let s=i,a=o[0];for(;a=o[0];)e.insertBefore(a,s.nextSibling),s=a;r.removeItem(f),0===_.children.length&&r.removeItem(_),d.setRange(i,l,i,l),d.history.push(!0)}}break}if(!p&&0===g.startOffset){let e=!0,i=n;for(;i&&i!==_&&!r.isWysiwygDiv(i);){if(i.previousSibling&&(1===i.previousSibling.nodeType||!r.onlyZeroWidthSpace(i.previousSibling.textContent.trim()))){e=!1;break}i=i.parentNode}if(e&&_.parentNode){t.preventDefault(),d.detachRangeFormatElement(_,r.isListCell(f)?[f]:null,null,!1,!1),d.history.push(!0);break}}}if(!p&&(0===g.startOffset||c===f&&f.childNodes[g.startOffset])){const e=c===f?f.childNodes[g.startOffset]:c,i=(3===n.nodeType||r.isBreak(n))&&!n.previousSibling&&0===g.startOffset;if(!e.previousSibling&&(r.isComponent(n.previousSibling)||i&&r.isComponent(f.previousSibling))){const e=d.getFileComponent(f.previousSibling);e&&(t.preventDefault(),t.stopPropagation(),0===f.textContent.length&&r.removeItem(f),d.selectComponent(e.target,e.pluginName));break}if(r.isNonEditable(e.previousSibling)){t.preventDefault(),t.stopPropagation(),r.removeItem(e.previousSibling);break}}break;case 46:if(m){t.preventDefault(),t.stopPropagation(),d.plugins[m].destroy.call(d);break}if(p&&u._hardDelete()){t.preventDefault(),t.stopPropagation();break}if((r.isFormatElement(c)||null===c.nextSibling||r.onlyZeroWidthSpace(c.nextSibling)&&null===c.nextSibling.nextSibling)&&g.startOffset===c.textContent.length){let e=f.nextElementSibling;if(!e){t.preventDefault();break}if(r.isComponent(e)){if(t.preventDefault(),r.onlyZeroWidthSpace(f)&&(r.removeItem(f),r.isTable(e))){let t=r.getChildElement(e,r.isCell,!1);t=t.firstElementChild||t,d.setRange(t,0,t,0);break}const n=d.getFileComponent(e);n&&(t.stopPropagation(),d.selectComponent(n.target,n.pluginName));break}}if(!p&&(d.isEdgePoint(g.endContainer,g.endOffset)||c===f&&f.childNodes[g.startOffset])){const e=c===f?f.childNodes[g.startOffset]:c;if(r.isNonEditable(e.nextSibling)){t.preventDefault(),t.stopPropagation(),r.removeItem(e.nextSibling);break}}if(f=r.getFormatElement(g.startContainer,null),_=r.getRangeFormatElement(f,null),r.isListCell(f)&&r.isList(_)&&(c===f||3===c.nodeType&&(!c.nextSibling||r.isList(c.nextSibling))&&(r.getFormatElement(g.startContainer,null)!==r.getFormatElement(g.endContainer,null)?_.contains(g.endContainer):g.endOffset===c.textContent.length&&g.collapsed))){g.startContainer!==g.endContainer&&d.removeNode();let e=r.getArrayItem(f.children,r.isList,!1);if(e=e||f.nextElementSibling||_.parentNode.nextElementSibling,e&&(r.isList(e)||r.getArrayItem(e.children,r.isList,!1))){let n,i;if(t.preventDefault(),r.isList(e)){const t=e.firstElementChild;for(i=t.childNodes,n=i[0];i[0];)f.insertBefore(i[0],e);r.removeItem(t)}else{for(n=e.firstChild,i=e.childNodes;i[0];)f.appendChild(i[0]);r.removeItem(e)}d.setRange(n,0,n,0),d.history.push(!0)}break}break;case 9:if(m||l.tabDisable)break;if(t.preventDefault(),o||s||r.isWysiwygDiv(c))break;const b=!g.collapsed||d.isEdgePoint(g.startContainer,g.startOffset),v=d.getSelectedElements(null);c=d.getSelectionNode();const y=[];let C=[],w=r.isListCell(v[0]),x=r.isListCell(v[v.length-1]),E={sc:g.startContainer,so:g.startOffset,ec:g.endContainer,eo:g.endOffset};for(let e,t=0,n=v.length;t0&&b&&d.plugins.list)E=d.plugins.list.editInsideList.call(d,i,y);else{const e=r.getParentElement(c,r.isCell);if(e&&b){const t=r.getParentElement(e,"table"),n=r.getListChildren(t,r.isCell);let l=i?r.prevIdx(n,e):r.nextIdx(n,e);l!==n.length||i||(l=0),-1===l&&i&&(l=n.length-1);let o=n[l];if(!o)break;o=o.firstElementChild||o,d.setRange(o,0,o,0);break}C=C.concat(y),w=x=null}if(C.length>0)if(i){const e=C.length-1;for(let t,n=0;n<=e;n++){t=C[n].childNodes;for(let e,n=0,i=t.length;n":"<"+f.nodeName+">
    ",!d.checkCharCount(e,"byte-html"))return t.preventDefault(),!1}if(!i&&S){t.preventDefault();const e=c===S,n=d.getSelection(),i=c.childNodes,l=n.focusOffset,o=c.previousElementSibling,s=c.nextSibling;if(!r.isClosureFreeFormatElement(S)&&i&&(e&&g.collapsed&&i.length-1<=l+1&&r.isBreak(i[l])&&(!i[l+1]||(!i[l+2]||r.onlyZeroWidthSpace(i[l+2].textContent))&&3===i[l+1].nodeType&&r.onlyZeroWidthSpace(i[l+1].textContent))&&l>0&&r.isBreak(i[l-1])||!e&&r.onlyZeroWidthSpace(c.textContent)&&r.isBreak(o)&&(r.isBreak(o.previousSibling)||!r.onlyZeroWidthSpace(o.previousSibling.textContent))&&(!s||!r.isBreak(s)&&r.onlyZeroWidthSpace(s.textContent)))){e?r.removeItem(i[l-1]):r.removeItem(c);const t=d.appendFormatTag(S,r.isFormatElement(S.nextElementSibling)?S.nextElementSibling:null);r.copyFormatAttributes(t,S),d.setRange(t,1,t,1);break}if(e){h.insertHTML(g.collapsed&&r.isBreak(g.startContainer.childNodes[g.startOffset-1])?"
    ":"

    ",!0,!1);let e=n.focusNode;const t=n.focusOffset;S===e&&(e=e.childNodes[t-l>1?t-1:t]),d.setRange(e,1,e,1)}else{const e=n.focusNode.nextSibling,t=r.createElement("BR");d.insertNode(t,null,!1);const i=t.previousSibling,l=t.nextSibling;r.isBreak(e)||r.isBreak(i)||l&&!r.onlyZeroWidthSpace(l)?d.setRange(l,0,l,0):(t.parentNode.insertBefore(t.cloneNode(!1),t),d.setRange(t,1,t,1))}u._onShortcutKey=!0;break}if(p)break;if(_&&f&&!r.isCell(_)&&!/^FIGCAPTION$/i.test(_.nodeName)){const e=d.getRange();if(d.isEdgePoint(e.endContainer,e.endOffset)&&r.isList(c.nextSibling)){t.preventDefault();const e=r.createElement("LI"),n=r.createElement("BR");e.appendChild(n),f.parentNode.insertBefore(e,f.nextElementSibling),e.appendChild(c.nextSibling),d.setRange(n,1,n,1);break}if((3!==e.commonAncestorContainer.nodeType||!e.commonAncestorContainer.nextElementSibling)&&r.onlyZeroWidthSpace(f.innerText.trim())){t.preventDefault();let e=null;if(r.isListCell(_.parentNode)){if(_=f.parentNode.parentNode.parentNode,e=r.splitElement(f,null,r.getElementDepth(f)-2),!e){const t=r.createElement("LI");t.innerHTML="
    ",_.insertBefore(t,e),e=t}}else{const t=r.isCell(_.parentNode)?"DIV":r.isList(_.parentNode)?"LI":r.isFormatElement(_.nextElementSibling)?_.nextElementSibling.nodeName:r.isFormatElement(_.previousElementSibling)?_.previousElementSibling.nodeName:"P";e=r.createElement(t);const n=d.detachRangeFormatElement(_,[f],null,!0,!0);n.cc.insertBefore(e,n.ec)}e.innerHTML="
    ",r.copyFormatAttributes(e,f),r.removeItemAllParents(f,null,null),d.setRange(e,1,e,1);break}}if(_&&r.getParentElement(_,"FIGCAPTION")&&r.getParentElement(_,r.isList)&&(t.preventDefault(),f=d.appendFormatTag(f,null),d.setRange(f,0,f,0)),m){t.preventDefault(),t.stopPropagation();const n=e[m],i=n._container,l=i.previousElementSibling||i.nextElementSibling;let o=null;r.isListCell(i.parentNode)?o=r.createElement("BR"):(o=r.createElement(r.isFormatElement(l)?l.nodeName:"P"),o.innerHTML="
    "),i.parentNode.insertBefore(o,i),d.callPlugin(m,(function(){d.selectComponent(n._element,m)}),null)}break;case 27:if(m)return t.preventDefault(),t.stopPropagation(),d.controllersOff(),!1}if(i&&/16/.test(n)){t.preventDefault(),t.stopPropagation();const e=d.plugins.table;if(e&&!e._shift&&!e._ref){const t=r.getParentElement(f,r.isCell);if(t)return void e.onTableCellMultiSelect.call(d,t,!0)}}if(!(o||s||p||u._nonTextKeyCode.test(n))&&g.collapsed&&g.startContainer===g.endContainer&&r.isBreak(g.commonAncestorContainer)){const e=r.createTextNode(r.zeroWidthSpace);d.insertNode(e,null,!1),d.setRange(e,1,e,1)}"function"==typeof h.onKeyDown&&h.onKeyDown(t,d)},onKeyUp_wysiwyg:function(e){if(u._onShortcutKey)return;d._editorRange();const t=d.getRange(),n=e.keyCode,i=e.ctrlKey||e.metaKey||91===n||92===n||224===n,l=e.altKey;let o=d.getSelectionNode();if(d._isBalloon&&(d._isBalloonAlways&&27!==n||!t.collapsed)){if(!d._isBalloonAlways)return void u._showToolbarBalloon();27!==n&&u._showToolbarBalloonDelay()}if(8===n&&r.isWysiwygDiv(o)&&""===o.textContent&&0===o.children.length){e.preventDefault(),e.stopPropagation(),o.innerHTML="";const t=r.createElement(r.isFormatElement(d._variable.currentNodes[0])?d._variable.currentNodes[0]:"P");return t.innerHTML="
    ",o.appendChild(t),d.setRange(t,0,t,0),u._applyTagEffects(),void d.history.push(!1)}const s=r.getFormatElement(o,null),a=r.getRangeFormatElement(o,null);(s||!t.collapsed)&&s!==a||r.isComponent(o)||r.isList(o)||(d._setDefaultFormat(r.isRangeFormatElement(a)?"DIV":"P"),o=d.getSelectionNode()),u._directionKeyCode.test(n)&&u._applyTagEffects();if(!i&&!l&&!u._nonTextKeyCode.test(n)&&3===o.nodeType&&r.zeroWidthRegExp.test(o.textContent)&&!(void 0!==e.isComposing?e.isComposing:u._IEisComposing)){let e=t.startOffset,n=t.endOffset;const i=(o.textContent.substring(0,n).match(u._frontZeroWidthReg)||"").length;e=t.startOffset-i,n=t.endOffset-i,o.textContent=o.textContent.replace(r.zeroWidthRegExp,""),d.setRange(o,e<0?0:e,o,n<0?0:n)}d._charCount(""),d.history.push(!0),"function"==typeof h.onKeyUp&&h.onKeyUp(e,d)},onScroll_wysiwyg:function(e){d.controllersOff(),d._lineBreaker.style.display="none",d._isBalloon&&u._hideToolbar(),"function"==typeof h.onScroll&&h.onScroll(e,d)},onFocus_wysiwyg:function(e){d._antiBlur||(d.hasFocus=!0,d._isInline&&u._showToolbarInline(),"function"==typeof h.onFocus&&h.onFocus(e,d))},onBlur_wysiwyg:function(t){if(d._antiBlur)return;d.hasFocus=!1,d.controllersOff(),(d._isInline||d._isBalloon)&&u._hideToolbar(),"function"==typeof h.onBlur&&h.onBlur(t,d);const i=d.commandMap,o=d.activePlugins;for(let e in i)r.hasOwn(i,e)&&(o.indexOf(e)>-1?n[e].active.call(d,null):i.OUTDENT&&/^OUTDENT$/i.test(e)?i.OUTDENT.setAttribute("disabled",!0):i.INDENT&&/^INDENT$/i.test(e)?i.INDENT.removeAttribute("disabled"):r.removeClass(i[e],"active"));d._variable.currentNodes=[],d._variable.currentNodesMap=[],l.showPathLabel&&(e.element.navigation.textContent="")},onMouseDown_resizingBar:function(t){t.stopPropagation(),d._variable.resizeClientY=t.clientY,e.element.resizeBackground.style.display="block",s.addEventListener("mousemove",u._resize_editor),s.addEventListener("mouseup",(function t(){e.element.resizeBackground.style.display="none",s.removeEventListener("mousemove",u._resize_editor),s.removeEventListener("mouseup",t)}))},_resize_editor:function(t){const n=e.element.editorArea.offsetHeight+(t.clientY-d._variable.resizeClientY);e.element.wysiwygFrame.style.height=e.element.code.style.height=(n=n+o?(d._sticky||u._onStickyToolbar(),t.toolbar.style.top=n+o+l.stickyToolbar-i-d._variable.minResizingSize+"px"):i>=o&&u._onStickyToolbar()},_getEditorOffsets:function(t){let n=t||e.element.topArea,i=0,l=0,o=0;for(;n;)i+=n.offsetTop,l+=n.offsetLeft,o+=n.scrollTop,n=n.offsetParent;return{top:i,left:l,scroll:o}},_getPageBottomSpace:function(){return s.documentElement.scrollHeight-(u._getEditorOffsets(null).top+e.element.topArea.offsetHeight)},_onStickyToolbar:function(){const t=e.element;d._isInline||l.toolbarContainer||(t._stickyDummy.style.height=t.toolbar.offsetHeight+"px",t._stickyDummy.style.display="block"),t.toolbar.style.top=l.stickyToolbar+"px",t.toolbar.style.width=d._isInline?d._inlineToolbarAttr.width:t.toolbar.offsetWidth+"px",r.addClass(t.toolbar,"se-toolbar-sticky"),d._sticky=!0},_offStickyToolbar:function(){const t=e.element;t._stickyDummy.style.display="none",t.toolbar.style.top=d._isInline?d._inlineToolbarAttr.top:"",t.toolbar.style.width=d._isInline?d._inlineToolbarAttr.width:"",t.editorArea.style.marginTop="",r.removeClass(t.toolbar,"se-toolbar-sticky"),d._sticky=!1},_codeViewAutoHeight:function(){e.element.code.style.height=e.element.code.scrollHeight+"px"},_hardDelete:function(){const e=d.getRange(),t=e.startContainer,n=e.endContainer,i=r.getRangeFormatElement(t),l=r.getRangeFormatElement(n),o=r.isCell(i),s=r.isCell(l);if((o&&!i.previousElementSibling&&!i.parentElement.previousElementSibling||s&&!l.nextElementSibling&&!l.parentElement.nextElementSibling)&&i!==l)if(o){if(s)return r.removeItem(r.getParentElement(i,r.isComponent)),d.nativeFocus(),!0;r.removeItem(r.getParentElement(i,r.isComponent))}else r.removeItem(r.getParentElement(l,r.isComponent));const a=1===t.nodeType?r.getParentElement(t,".se-component"):null,c=1===n.nodeType?r.getParentElement(n,".se-component"):null;return a&&r.removeItem(a),c&&r.removeItem(c),!1},onPaste_wysiwyg:function(e){const t=r.isIE?a.clipboardData:e.clipboardData;return!t||u._dataTransferAction("paste",e,t)},_setClipboardComponent:function(e,t,n){e.preventDefault(),e.stopPropagation(),n.setData("text/html",t.component.outerHTML)},onCopy_wysiwyg:function(e){const t=r.isIE?a.clipboardData:e.clipboardData;if("function"==typeof h.onCopy&&!h.onCopy(e,t,d))return e.preventDefault(),e.stopPropagation(),!1;const n=d.currentFileComponentInfo;n&&!r.isIE&&(u._setClipboardComponent(e,n,t),r.addClass(n.component,"se-component-copy"),a.setTimeout((function(){r.removeClass(n.component,"se-component-copy")}),150))},onCut_wysiwyg:function(e){const t=r.isIE?a.clipboardData:e.clipboardData;if("function"==typeof h.onCut&&!h.onCut(e,t,d))return e.preventDefault(),e.stopPropagation(),!1;const n=d.currentFileComponentInfo;n&&!r.isIE&&(u._setClipboardComponent(e,n,t),r.removeItem(n.component),d.controllersOff()),a.setTimeout((function(){d.history.push(!1)}))},onDrop_wysiwyg:function(e){const t=e.dataTransfer;return!t||(r.isIE?(e.preventDefault(),e.stopPropagation(),!1):(d.removeNode(),u._setDropLocationSelection(e),u._dataTransferAction("drop",e,t)))},_setDropLocationSelection:function(e){if(e.rangeParent)d.setRange(e.rangeParent,e.rangeOffset,e.rangeParent,e.rangeOffset);else if(d._wd.caretRangeFromPoint){const t=d._wd.caretRangeFromPoint(e.clientX,e.clientY);d.setRange(t.startContainer,t.startOffset,t.endContainer,t.endOffset)}else{const e=d.getRange();d.setRange(e.startContainer,e.startOffset,e.endContainer,e.endOffset)}},_dataTransferAction:function(t,n,i){let l,o;if(r.isIE){l=i.getData("Text");const s=d.getRange(),c=r.createElement("DIV"),h={sc:s.startContainer,so:s.startOffset,ec:s.endContainer,eo:s.endOffset};return c.setAttribute("contenteditable",!0),c.style.cssText="position:absolute; top:0; left:0; width:1px; height:1px; overflow:hidden;",e.element.relative.appendChild(c),c.focus(),a.setTimeout((function(){o=c.innerHTML,r.removeItem(c),d.setRange(h.sc,h.so,h.ec,h.eo),u._setClipboardData(t,n,l,o,i)})),!0}if(l=i.getData("text/plain"),o=i.getData("text/html"),!1===u._setClipboardData(t,n,l,o,i))return n.preventDefault(),n.stopPropagation(),!1},_setClipboardData:function(e,t,n,i,l){/class=["']*Mso(Normal|List)/i.test(i)||/content=["']*Word.Document/i.test(i)||/content=["']*OneNote.File/i.test(i)?(i=i.replace(/\n/g," "),n=n.replace(/\n/g," ")):n=n.replace(/\n/g,""),i=d.cleanHTML(i,d.pasteTagsWhitelistRegExp);const o=d._charCount(d._charTypeHTML?i:n);if("paste"===e&&"function"==typeof h.onPaste&&!h.onPaste(t,i,o,d))return!1;if("drop"===e&&"function"==typeof h.onDrop&&!h.onDrop(t,l,d))return!1;const s=l.files;return s.length>0?(/^image/.test(s[0].type)&&d.plugins.image&&h.insertImage(s),!1):!!o&&(i?(h.insertHTML(i,!0,!1),!1):void 0)},onMouseMove_wysiwyg:function(t){if(d.isDisabled)return;const n=r.getParentElement(t.target,r.isComponent),i=d._lineBreaker.style;if(n&&!d.currentControllerName){let o=0,s=e.element.wysiwyg;do{o+=s.scrollTop,s=s.parentElement}while(s&&!/^(BODY|HTML)$/i.test(s.nodeName));const a=e.element.wysiwyg.scrollTop,c=u._getEditorOffsets(null),h=r.getOffset(n,e.element.wysiwygFrame).top+a,g=t.pageY+o+(l.iframe&&!l.toolbarContainer?e.element.toolbar.offsetHeight:0),p=h+(l.iframe?o:c.top),m=r.isListCell(n.parentNode);let f="",_="";if((m?!n.previousSibling:!r.isFormatElement(n.previousElementSibling))&&gp+n.offsetHeight-20))return void(i.display="none");_=h+n.offsetHeight,f="b"}d._variable._lineBreakComp=n,d._variable._lineBreakDir=f,i.top=_-a+"px",d._lineBreakerButton.style.left=r.getOffset(n).left+n.offsetWidth/2-15+"px",i.display="block"}else"none"!==i.display&&(i.display="none")},_onMouseDown_lineBreak:function(e){e.preventDefault()},_onLineBreak:function(e){e.preventDefault();const t=d._variable._lineBreakComp,n=this?this:d._variable._lineBreakDir,i=r.isListCell(t.parentNode),l=r.createElement(i?"BR":r.isCell(t.parentNode)?"DIV":"P");if(i||(l.innerHTML="
    "),d._charTypeHTML&&!d.checkCharCount(l.outerHTML,"byte-html"))return;t.parentNode.insertBefore(l,"t"===n?t:t.nextSibling),d._lineBreaker.style.display="none",d._variable._lineBreakComp=null;const o=i?l:l.firstChild;d.setRange(o,1,o,1),d.history.push(!1)},_addEvent:function(){const t=l.iframe?d._ww:e.element.wysiwyg;e.element.toolbar.addEventListener("mousedown",u._buttonsEventHandler,!1),e.element._menuTray.addEventListener("mousedown",u._buttonsEventHandler,!1),e.element.toolbar.addEventListener("click",u.onClick_toolbar,!1),t.addEventListener("mousedown",u.onMouseDown_wysiwyg,!1),t.addEventListener("click",u.onClick_wysiwyg,!1),t.addEventListener(r.isIE?"textinput":"input",u.onInput_wysiwyg,!1),t.addEventListener("keydown",u.onKeyDown_wysiwyg,!1),t.addEventListener("keyup",u.onKeyUp_wysiwyg,!1),t.addEventListener("paste",u.onPaste_wysiwyg,!1),t.addEventListener("copy",u.onCopy_wysiwyg,!1),t.addEventListener("cut",u.onCut_wysiwyg,!1),t.addEventListener("drop",u.onDrop_wysiwyg,!1),t.addEventListener("scroll",u.onScroll_wysiwyg,!1),t.addEventListener("focus",u.onFocus_wysiwyg,!1),t.addEventListener("blur",u.onBlur_wysiwyg,!1),u._lineBreakerBind={a:u._onLineBreak.bind(""),t:u._onLineBreak.bind("t"),b:u._onLineBreak.bind("b")},t.addEventListener("mousemove",u.onMouseMove_wysiwyg,!1),d._lineBreakerButton.addEventListener("mousedown",u._onMouseDown_lineBreak,!1),d._lineBreakerButton.addEventListener("click",u._lineBreakerBind.a,!1),e.element.lineBreaker_t.addEventListener("mousedown",u._lineBreakerBind.t,!1),e.element.lineBreaker_b.addEventListener("mousedown",u._lineBreakerBind.b,!1),d.plugins.table&&t.addEventListener("touchstart",u.onMouseDown_wysiwyg,{passive:!0,useCapture:!1}),"auto"!==l.height||l.codeMirrorEditor||(e.element.code.addEventListener("keydown",u._codeViewAutoHeight,!1),e.element.code.addEventListener("keyup",u._codeViewAutoHeight,!1),e.element.code.addEventListener("paste",u._codeViewAutoHeight,!1)),e.element.resizingBar&&(/\d+/.test(l.height)?e.element.resizingBar.addEventListener("mousedown",u.onMouseDown_resizingBar,!1):r.addClass(e.element.resizingBar,"se-resizing-none")),u._setResponsiveToolbar(),a.removeEventListener("resize",u.onResize_window),a.removeEventListener("scroll",u.onScroll_window),a.addEventListener("resize",u.onResize_window,!1),l.stickyToolbar>-1&&a.addEventListener("scroll",u.onScroll_window,!1)},_removeEvent:function(){const t=l.iframe?d._ww:e.element.wysiwyg;e.element.toolbar.removeEventListener("mousedown",u._buttonsEventHandler),e.element._menuTray.removeEventListener("mousedown",u._buttonsEventHandler),e.element.toolbar.removeEventListener("click",u.onClick_toolbar),t.removeEventListener("mousedown",u.onMouseDown_wysiwyg),t.removeEventListener("click",u.onClick_wysiwyg),t.removeEventListener(r.isIE?"textinput":"input",u.onInput_wysiwyg),t.removeEventListener("keydown",u.onKeyDown_wysiwyg),t.removeEventListener("keyup",u.onKeyUp_wysiwyg),t.removeEventListener("paste",u.onPaste_wysiwyg),t.removeEventListener("copy",u.onCopy_wysiwyg),t.removeEventListener("cut",u.onCut_wysiwyg),t.removeEventListener("drop",u.onDrop_wysiwyg),t.removeEventListener("scroll",u.onScroll_wysiwyg),t.removeEventListener("mousemove",u.onMouseMove_wysiwyg),d._lineBreakerButton.removeEventListener("mousedown",u._onMouseDown_lineBreak),d._lineBreakerButton.removeEventListener("click",u._lineBreakerBind.a),e.element.lineBreaker_t.removeEventListener("mousedown",u._lineBreakerBind.t),e.element.lineBreaker_b.removeEventListener("mousedown",u._lineBreakerBind.b),u._lineBreakerBind=null,t.removeEventListener("touchstart",u.onMouseDown_wysiwyg,{passive:!0,useCapture:!1}),t.removeEventListener("focus",u.onFocus_wysiwyg),t.removeEventListener("blur",u.onBlur_wysiwyg),e.element.code.removeEventListener("keydown",u._codeViewAutoHeight),e.element.code.removeEventListener("keyup",u._codeViewAutoHeight),e.element.code.removeEventListener("paste",u._codeViewAutoHeight),e.element.resizingBar&&e.element.resizingBar.removeEventListener("mousedown",u.onMouseDown_resizingBar),a.removeEventListener("resize",u.onResize_window),a.removeEventListener("scroll",u.onScroll_window)},_setResponsiveToolbar:function(){if(0===o.length)return void(o=null);const e=u._responsiveButtonSize=["default"],t=u._responsiveButtons={default:o[0]};for(let n,i,l=1,s=o.length;l",e}};return void 0===t&&(e.SUNEDITOR_MODULES||Object.defineProperty(e,"SUNEDITOR_MODULES",{enumerable:!0,writable:!1,configurable:!1,value:{}}),Object.defineProperty(e.SUNEDITOR_MODULES,"component",{enumerable:!0,writable:!1,configurable:!1,value:n})),n},"object"==typeof e.exports?e.exports=i.document?l(i,!0):function(e){if(!e.document)throw new Error("SUNEDITOR_MODULES a window with a document");return l(e)}:l(i)},ee5k:function(e,t,n){"use strict";var i,l;i="undefined"!=typeof window?window:this,l=function(e,t){const n={name:"resizing",add:function(e){const t=e.icons,n=e.context;n.resizing={_resizeClientX:0,_resizeClientY:0,_resize_plugin:"",_resize_w:0,_resize_h:0,_origin_w:0,_origin_h:0,_rotateVertical:!1,_resize_direction:"",_move_path:null,_isChange:!1,alignIcons:{basic:t.align_justify,left:t.align_left,right:t.align_right,center:t.align_center}};let i=this.setController_resize.call(e);n.resizing.resizeContainer=i,n.resizing.resizeDiv=i.querySelector(".se-modal-resize"),n.resizing.resizeDot=i.querySelector(".se-resize-dot"),n.resizing.resizeDisplay=i.querySelector(".se-resize-display");let l=this.setController_button.call(e);n.resizing.resizeButton=l;let o=n.resizing.resizeHandles=n.resizing.resizeDot.querySelectorAll("span");n.resizing.resizeButtonGroup=l.querySelector("._se_resizing_btn_group"),n.resizing.rotationButtons=l.querySelectorAll("._se_resizing_btn_group ._se_rotation"),n.resizing.percentageButtons=l.querySelectorAll("._se_resizing_btn_group ._se_percentage"),n.resizing.alignMenu=l.querySelector(".se-resizing-align-list"),n.resizing.alignMenuList=n.resizing.alignMenu.querySelectorAll("button"),n.resizing.alignButton=l.querySelector("._se_resizing_align_button"),n.resizing.autoSizeButton=l.querySelector("._se_resizing_btn_group ._se_auto_size"),n.resizing.captionButton=l.querySelector("._se_resizing_caption_button"),i.addEventListener("mousedown",(function(e){e.preventDefault()})),l.addEventListener("mousedown",e.eventStop),o[0].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),o[1].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),o[2].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),o[3].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),o[4].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),o[5].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),o[6].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),o[7].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),l.addEventListener("click",this.onClick_resizeButton.bind(e)),n.element.relative.appendChild(i),n.element.relative.appendChild(l),i=null,l=null,o=null},setController_resize:function(){const e=this.util.createElement("DIV");return e.className="se-controller se-resizing-container",e.style.display="none",e.innerHTML='
    ',e},setController_button:function(){const e=this.lang,t=this.icons,n=this.util.createElement("DIV");return n.className="se-controller se-controller-resizing",n.innerHTML='
    ",n},_module_getSizeX:function(e,t,n,i){return t||(t=e._element),n||(n=e._cover),i||(i=e._container),t?/%$/.test(t.style.width)?(i&&this.util.getNumber(i.style.width,2)||100)+"%":t.style.width:""},_module_getSizeY:function(e,t,n,i){return t||(t=e._element),n||(n=e._cover),i||(i=e._container),i&&n?this.util.getNumber(n.style.paddingBottom,0)>0&&!this.context.resizing._rotateVertical?n.style.height:/%$/.test(t.style.height)&&/%$/.test(t.style.width)?(i&&this.util.getNumber(i.style.height,2)||100)+"%":t.style.height:t&&t.style.height||""},_module_setModifyInputSize:function(e,t){const n=e._onlyPercentage&&this.context.resizing._rotateVertical;e.proportion.checked=e._proportionChecked="false"!==e._element.getAttribute("data-proportion");let i=n?"":this.plugins.resizing._module_getSizeX.call(this,e);if(i===e._defaultSizeX&&(i=""),e._onlyPercentage&&(i=this.util.getNumber(i,2)),e.inputX.value=i,t.setInputSize.call(this,"x"),!e._onlyPercentage){let t=n?"":this.plugins.resizing._module_getSizeY.call(this,e);t===e._defaultSizeY&&(t=""),e._onlyPercentage&&(t=this.util.getNumber(t,2)),e.inputY.value=t}e.inputX.disabled=!!n,e.inputY.disabled=!!n,e.proportion.disabled=!!n,t.setRatio.call(this)},_module_setInputSize:function(e,t){if(e._onlyPercentage)"x"===t&&e.inputX.value>100&&(e.inputX.value=100);else if(e.proportion.checked&&e._ratio&&/\d/.test(e.inputX.value)&&/\d/.test(e.inputY.value)){const n=e.inputX.value.replace(/\d+|\./g,"")||e.sizeUnit,i=e.inputY.value.replace(/\d+|\./g,"")||e.sizeUnit;if(n!==i)return;const l="%"===n?2:0;"x"===t?e.inputY.value=this.util.getNumber(e._ratioY*this.util.getNumber(e.inputX.value,l),l)+i:e.inputX.value=this.util.getNumber(e._ratioX*this.util.getNumber(e.inputY.value,l),l)+n}},_module_setRatio:function(e){const t=e.inputX.value,n=e.inputY.value;if(e.proportion.checked&&/\d+/.test(t)&&/\d+/.test(n)){if((t.replace(/\d+|\./g,"")||e.sizeUnit)!==(n.replace(/\d+|\./g,"")||e.sizeUnit))e._ratio=!1;else if(!e._ratio){const i=this.util.getNumber(t,0),l=this.util.getNumber(n,0);e._ratio=!0,e._ratioX=i/l,e._ratioY=l/i}}else e._ratio=!1},_module_sizeRevert:function(e){e._onlyPercentage?e.inputX.value=e._origin_w>100?100:e._origin_w:(e.inputX.value=e._origin_w,e.inputY.value=e._origin_h)},_module_saveCurrentSize:function(e){const t=this.plugins.resizing._module_getSizeX.call(this,e),n=this.plugins.resizing._module_getSizeY.call(this,e);e._element.setAttribute("data-size",t+","+n),e._videoRatio&&(e._videoRatio=n)},call_controller_resize:function(e,t){const n=this.context.resizing,i=this.context[t];n._resize_plugin=t;const l=n.resizeContainer,o=n.resizeDiv,s=this.util.getOffset(e,this.context.element.wysiwygFrame),a=n._rotateVertical=/^(90|270)$/.test(Math.abs(e.getAttribute("data-rotate")).toString()),r=a?e.offsetHeight:e.offsetWidth,c=a?e.offsetWidth:e.offsetHeight,d=s.top,u=s.left-this.context.element.wysiwygFrame.scrollLeft;l.style.top=d+"px",l.style.left=u+"px",l.style.width=r+"px",l.style.height=c+"px",o.style.top="0px",o.style.left="0px",o.style.width=r+"px",o.style.height=c+"px";let h=e.getAttribute("data-align")||"basic";h="none"===h?"basic":h;const g=this.util.getParentElement(e,this.util.isComponent),p=this.util.getParentElement(e,"FIGURE"),m=this.plugins.resizing._module_getSizeX.call(this,i,e,p,g)||"auto",f=i._onlyPercentage&&"image"===t?"":", "+(this.plugins.resizing._module_getSizeY.call(this,i,e,p,g)||"auto");this.util.changeTxt(n.resizeDisplay,this.lang.dialogBox[h]+" ("+m+f+")"),n.resizeButtonGroup.style.display=i._resizing?"":"none";const _=!i._resizing||i._resizeDotHide||i._onlyPercentage?"none":"flex",b=n.resizeHandles;for(let e=0,t=b.length;e=360?0:d;s.setAttribute("data-rotate",u),c._rotateVertical=/^(90|270)$/.test(this._w.Math.abs(u).toString()),this.plugins.resizing.setTransformSize.call(this,s,null,null),this.selectComponent(s,l);break;case"onalign":return void this.plugins.resizing.openAlignMenu.call(this);case"align":const h="basic"===i?"none":i;a.setAlign.call(this,h,null,null,null),this.selectComponent(s,l);break;case"caption":const g=!o._captionChecked;if(a.openModify.call(this,!0),o._captionChecked=o.captionCheckEl.checked=g,a.update_image.call(this,!1,!1,!1),g){const e=this.util.getChildElement(o._caption,(function(e){return 3===e.nodeType}));e?this.setRange(e,0,e,e.textContent.length):o._caption.focus(),this.controllersOff()}else this.selectComponent(s,l),a.openModify.call(this,!0);break;case"revert":a.setOriginSize.call(this),this.selectComponent(s,l);break;case"update":a.openModify.call(this),this.controllersOff();break;case"delete":a.destroy.call(this)}this.history.push(!1)}},resetTransform:function(e){const t=(e.getAttribute("data-size")||e.getAttribute("data-origin")||"").split(",");this.context.resizing._rotateVertical=!1,e.style.maxWidth="",e.style.transform="",e.style.transformOrigin="",e.setAttribute("data-rotate",""),e.setAttribute("data-rotateX",""),e.setAttribute("data-rotateY",""),this.plugins[this.context.resizing._resize_plugin].setSize.call(this,t[0]?t[0]:"auto",t[1]?t[1]:"",!0)},setTransformSize:function(e,t,n){let i=e.getAttribute("data-percentage");const l=this.context.resizing._rotateVertical,o=1*e.getAttribute("data-rotate");let s="";if(i&&!l)i=i.split(","),"auto"===i[0]&&"auto"===i[1]?this.plugins[this.context.resizing._resize_plugin].setAutoSize.call(this):this.plugins[this.context.resizing._resize_plugin].setPercentSize.call(this,i[0],i[1]);else{const i=this.util.getParentElement(e,"FIGURE"),a=t||e.offsetWidth,r=n||e.offsetHeight,c=(l?r:a)+"px",d=(l?a:r)+"px";if(this.plugins[this.context.resizing._resize_plugin].cancelPercentAttr.call(this),this.plugins[this.context.resizing._resize_plugin].setSize.call(this,a+"px",r+"px",!0),i.style.width=c,i.style.height=this.context[this.context.resizing._resize_plugin]._caption?"":d,l){let e=a/2+"px "+a/2+"px 0",t=r/2+"px "+r/2+"px 0";s=90===o||-270===o?t:e}}e.style.transformOrigin=s,this.plugins.resizing._setTransForm(e,o.toString(),e.getAttribute("data-rotateX")||"",e.getAttribute("data-rotateY")||""),e.style.maxWidth=l?"none":"",this.plugins.resizing.setCaptionPosition.call(this,e)},_setTransForm:function(e,t,n,i){let l=(e.offsetWidth-e.offsetHeight)*(/-/.test(t)?1:-1),o="";if(/[1-9]/.test(t)&&(n||i))switch(o=n?"Y":"X",t){case"90":o=n&&i?"X":i?o:"";break;case"270":l*=-1,o=n&&i?"Y":n?o:"";break;case"-90":o=n&&i?"Y":n?o:"";break;case"-270":l*=-1,o=n&&i?"X":i?o:"";break;default:o=""}t%180==0&&(e.style.maxWidth=""),e.style.transform="rotate("+t+"deg)"+(n?" rotateX("+n+"deg)":"")+(i?" rotateY("+i+"deg)":"")+(o?" translate"+o+"("+l+"px)":"")},setCaptionPosition:function(e){const t=this.util.getChildElement(this.util.getParentElement(e,"FIGURE"),"FIGCAPTION");t&&(t.style.marginTop=(this.context.resizing._rotateVertical?e.offsetWidth-e.offsetHeight:0)+"px")},onMouseDown_resize_handle:function(e){e.stopPropagation(),e.preventDefault();const t=this.context.resizing,n=t._resize_direction=e.target.classList[0];t._resizeClientX=e.clientX,t._resizeClientY=e.clientY,this.context.element.resizeBackground.style.display="block",t.resizeButton.style.display="none",t.resizeDiv.style.float=/l/.test(n)?"right":/r/.test(n)?"left":"none";const i=function(e){if("keydown"===e.type&&27!==e.keyCode)return;const o=t._isChange;t._isChange=!1,this.removeDocEvent("mousemove",l),this.removeDocEvent("mouseup",i),this.removeDocEvent("keydown",i),"keydown"===e.type?(this.controllersOff(),this.context.element.resizeBackground.style.display="none",this.plugins[this.context.resizing._resize_plugin].init.call(this)):(this.plugins.resizing.cancel_controller_resize.call(this,n),o&&this.history.push(!1))}.bind(this),l=this.plugins.resizing.resizing_element.bind(this,t,n,this.context[t._resize_plugin]);this.addDocEvent("mousemove",l),this.addDocEvent("mouseup",i),this.addDocEvent("keydown",i)},resizing_element:function(e,t,n,i){const l=i.clientX,o=i.clientY;let s=n._element_w,a=n._element_h;const r=n._element_w+(/r/.test(t)?l-e._resizeClientX:e._resizeClientX-l),c=n._element_h+(/b/.test(t)?o-e._resizeClientY:e._resizeClientY-o),d=n._element_h/n._element_w*r;/t/.test(t)&&(e.resizeDiv.style.top=n._element_h-(/h/.test(t)?c:d)+"px"),/l/.test(t)&&(e.resizeDiv.style.left=n._element_w-r+"px"),/r|l/.test(t)&&(e.resizeDiv.style.width=r+"px",s=r),/^(t|b)[^h]$/.test(t)?(e.resizeDiv.style.height=d+"px",a=d):/^(t|b)h$/.test(t)&&(e.resizeDiv.style.height=c+"px",a=c),e._resize_w=s,e._resize_h=a,this.util.changeTxt(e.resizeDisplay,this._w.Math.round(s)+" x "+this._w.Math.round(a)),e._isChange=!0},cancel_controller_resize:function(e){const t=this.context.resizing._rotateVertical;this.controllersOff(),this.context.element.resizeBackground.style.display="none";let n=this._w.Math.round(t?this.context.resizing._resize_h:this.context.resizing._resize_w),i=this._w.Math.round(t?this.context.resizing._resize_w:this.context.resizing._resize_h);if(!t&&!/%$/.test(n)){const e=16,t=this.context.element.wysiwygFrame.clientWidth-2*e-2;this.util.getNumber(n,0)>t&&(i=this._w.Math.round(i/n*t),n=t)}const l=this.context.resizing._resize_plugin;this.plugins[l].setSize.call(this,n,i,!1,e),this.selectComponent(this.context[l]._element,l)}};return void 0===t&&(e.SUNEDITOR_MODULES||Object.defineProperty(e,"SUNEDITOR_MODULES",{enumerable:!0,writable:!1,configurable:!1,value:{}}),Object.defineProperty(e.SUNEDITOR_MODULES,"resizing",{enumerable:!0,writable:!1,configurable:!1,value:n})),n},"object"==typeof e.exports?e.exports=i.document?l(i,!0):function(e){if(!e.document)throw new Error("SUNEDITOR_MODULES a window with a document");return l(e)}:l(i)},"gjS+":function(e,t,n){"use strict";var i,l;i="undefined"!=typeof window?window:this,l=function(e,t){const n={name:"fileManager",_xmlHttp:null,upload:function(e,t,n,i,l){this.showLoading();const o=this.plugins.fileManager,s=o._xmlHttp=this.util.getXMLHttpRequest();if(s.onreadystatechange=o._callBackUpload.bind(this,s,i,l),s.open("post",e,!0),null!==t&&"object"==typeof t&&this._w.Object.keys(t).length>0)for(let e in t)s.setRequestHeader(e,t[e]);s.send(n)},_callBackUpload:function(e,t,n){if(4===e.readyState)if(200===e.status)try{t(e)}catch(e){throw Error('[SUNEDITOR.fileManager.upload.callBack.fail] cause : "'+e.message+'"')}finally{this.closeLoading()}else{this.closeLoading();const t=e.responseText?JSON.parse(e.responseText):e;if("function"!=typeof n||n("",t,this)){const n="[SUNEDITOR.fileManager.upload.serverException] status: "+e.status+", response: "+(t.errorMessage||e.responseText);throw this.functions.noticeOpen(n),Error(n)}}},checkInfo:function(e,t,n,i,l){let o=[];for(let e=0,n=t.length;e-1||(a.splice(t,1),"function"==typeof n&&n(null,e,"delete",null,0,this),t--);l&&(this.context.resizing._resize_plugin=c)},setInfo:function(e,t,n,i,l){const o=l?this.context.resizing._resize_plugin:"";l&&(this.context.resizing._resize_plugin=e);const s=this.plugins[e],a=this.context[e],r=a._infoList;let c=t.getAttribute("data-index"),d=null,u="";if(i||(i={name:t.getAttribute("data-file-name")||("string"==typeof t.src?t.src.split("/").pop():""),size:t.getAttribute("data-file-size")||0}),!c||this._componentsInfoInit)u="create",c=a._infoIndex++,t.setAttribute("data-index",c),t.setAttribute("data-file-name",i.name),t.setAttribute("data-file-size",i.size),d={src:t.src,index:1*c,name:i.name,size:i.size},r.push(d);else{u="update",c*=1;for(let e=0,t=r.length;e=0){const i=this.context[e]._infoList;for(let e=0,l=i.length;e
    '},_onMouseDown_browser:function(e){/se-file-browser-inner/.test(e.target.className)?this.context.fileBrowser._closeSignal=!0:this.context.fileBrowser._closeSignal=!1},_onClick_browser:function(e){e.stopPropagation(),(/close/.test(e.target.getAttribute("data-command"))||this.context.fileBrowser._closeSignal)&&this.plugins.fileBrowser.close.call(this)},open:function(e,t){this.plugins.fileBrowser._bindClose&&(this._d.removeEventListener("keydown",this.plugins.fileBrowser._bindClose),this.plugins.fileBrowser._bindClose=null),this.plugins.fileBrowser._bindClose=function(e){/27/.test(e.keyCode)&&this.plugins.fileBrowser.close.call(this)}.bind(this),this._d.addEventListener("keydown",this.plugins.fileBrowser._bindClose);const n=this.context.fileBrowser;n.contextPlugin=e,n.selectorHandler=t;const i=this.context[e],l=i.listClass;this.util.hasClass(n.list,l)||(n.list.className="se-file-browser-list "+l),"full"===this.context.option.popupDisplay?n.area.style.position="fixed":n.area.style.position="absolute",n.titleArea.textContent=i.title,n.area.style.display="block",this.plugins.fileBrowser._drawFileList.call(this,this.context[e].url)},_bindClose:null,close:function(){const e=this.plugins.fileBrowser;e._xmlHttp&&e._xmlHttp.abort(),e._bindClose&&(this._d.removeEventListener("keydown",e._bindClose),e._bindClose=null);const t=this.context.fileBrowser;t.area.style.display="none",t.selectorHandler=null,t.selectedTags=[],t.items=[],t.list.innerHTML=t.tagArea.innerHTML=t.titleArea.textContent="","function"==typeof this.plugins[t.contextPlugin].init&&this.plugins[t.contextPlugin].init.call(this),t.contextPlugin=""},showBrowserLoading:function(){this._loading.style.display="block"},closeBrowserLoading:function(){this._loading.style.display="none"},_drawFileList:function(e){const t=this.plugins.fileBrowser,n=t._xmlHttp=this.util.getXMLHttpRequest();n.onreadystatechange=t._callBackGet.bind(this,n),n.open("get",e,!0),n.send(null),this.plugins.fileBrowser.showBrowserLoading()},_callBackGet:function(e){if(4===e.readyState)if(this.plugins.fileBrowser._xmlHttp=null,200===e.status)try{this.plugins.fileBrowser._drawListItem.call(this,JSON.parse(e.responseText).result,!0)}catch(e){throw Error('[SUNEDITOR.fileBrowser.drawList.fail] cause : "'+e.message+'"')}finally{this.plugins.fileBrowser.closeBrowserLoading(),this.context.fileBrowser.body.style.maxHeight=this._w.innerHeight-this.context.fileBrowser.header.offsetHeight-50+"px"}else if(this.plugins.fileBrowser.closeBrowserLoading(),0!==e.status){const t=e.responseText?JSON.parse(e.responseText):e,n="[SUNEDITOR.fileBrowser.get.serverException] status: "+e.status+", response: "+(t.errorMessage||e.responseText);throw Error(n)}},_drawListItem:function(e,t){const n=this.context.fileBrowser,i=this.context[n.contextPlugin],l=[],o=e.length,s=i.columnSize||n.columnSize,a=s<=1?1:Math.round(o/s)||1,r=i.itemTemplateHandler;let c="",d='
    ',u=1;for(let n,i,h=0;h
    '),t&&i.length>0)for(let e,t=0,n=i.length;t'+e+"");d+="
    ",n.list.innerHTML=d,t&&(n.items=e,n.tagArea.innerHTML=c,n.tagElements=n.tagArea.querySelectorAll("A"))},onClickTag:function(e){const t=e.target;if(!this.util.isAnchor(t))return;const n=t.textContent,i=this.plugins.fileBrowser,l=this.context.fileBrowser,o=l.tagArea.querySelector('a[title="'+n+'"]'),s=l.selectedTags,a=s.indexOf(n);a>-1?(s.splice(a,1),this.util.removeClass(o,"on")):(s.push(n),this.util.addClass(o,"on")),i._drawListItem.call(this,0===s.length?l.items:l.items.filter((function(e){return e.tag.some((function(e){return s.indexOf(e)>-1}))})),!1)},onClickFile:function(e){e.preventDefault(),e.stopPropagation();const t=this.context.fileBrowser,n=t.list;let i=e.target,l=null;if(i===n)return;for(;n!==i.parentNode&&(l=i.getAttribute("data-command"),!l);)i=i.parentNode;if(!l)return;const o=t.selectorHandler||this.context[t.contextPlugin].selectorHandler;this.plugins.fileBrowser.close.call(this),o(i)}};return void 0===t&&(e.SUNEDITOR_MODULES||Object.defineProperty(e,"SUNEDITOR_MODULES",{enumerable:!0,writable:!1,configurable:!1,value:{}}),Object.defineProperty(e.SUNEDITOR_MODULES,"fileBrowser",{enumerable:!0,writable:!1,configurable:!1,value:n})),n},"object"==typeof e.exports?e.exports=i.document?l(i,!0):function(e){if(!e.document)throw new Error("SUNEDITOR_MODULES a window with a document");return l(e)}:l(i)},P6u4:function(e,t,n){"use strict";var i,l;i="undefined"!=typeof window?window:this,l=function(e,t){const n={code:"en",toolbar:{default:"Default",save:"Save",font:"Font",formats:"Formats",fontSize:"Size",bold:"Bold",underline:"Underline",italic:"Italic",strike:"Strike",subscript:"Subscript",superscript:"Superscript",removeFormat:"Remove Format",fontColor:"Font Color",hiliteColor:"Highlight Color",indent:"Indent",outdent:"Outdent",align:"Align",alignLeft:"Align left",alignRight:"Align right",alignCenter:"Align center",alignJustify:"Align justify",list:"List",orderList:"Ordered list",unorderList:"Unordered list",horizontalRule:"Horizontal line",hr_solid:"Solid",hr_dotted:"Dotted",hr_dashed:"Dashed",table:"Table",link:"Link",math:"Math",image:"Image",video:"Video",audio:"Audio",fullScreen:"Full screen",showBlocks:"Show blocks",codeView:"Code view",undo:"Undo",redo:"Redo",preview:"Preview",print:"print",tag_p:"Paragraph",tag_div:"Normal (DIV)",tag_h:"Header",tag_blockquote:"Quote",tag_pre:"Code",template:"Template",lineHeight:"Line height",paragraphStyle:"Paragraph style",textStyle:"Text style",imageGallery:"Image gallery",mention:"Mention"},dialogBox:{linkBox:{title:"Insert Link",url:"URL to link",text:"Text to display",newWindowCheck:"Open in new window"},mathBox:{title:"Math",inputLabel:"Mathematical Notation",fontSizeLabel:"Font Size",previewLabel:"Preview"},imageBox:{title:"Insert image",file:"Select from files",url:"Image URL",altText:"Alternative text"},videoBox:{title:"Insert Video",file:"Select from files",url:"Media embed URL, YouTube/Vimeo"},audioBox:{title:"Insert Audio",file:"Select from files",url:"Audio URL"},browser:{tags:"Tags",search:"Search"},mentionBox:{title:"Add Mention"},caption:"Insert description",close:"Close",submitButton:"Submit",revertButton:"Revert",proportion:"Constrain proportions",basic:"Basic",left:"Left",right:"Right",center:"Center",width:"Width",height:"Height",size:"Size",ratio:"Ratio"},controller:{edit:"Edit",unlink:"Unlink",remove:"Remove",insertRowAbove:"Insert row above",insertRowBelow:"Insert row below",deleteRow:"Delete row",insertColumnBefore:"Insert column before",insertColumnAfter:"Insert column after",deleteColumn:"Delete column",fixedColumnWidth:"Fixed column width",resize100:"Resize 100%",resize75:"Resize 75%",resize50:"Resize 50%",resize25:"Resize 25%",autoSize:"Auto size",mirrorHorizontal:"Mirror, Horizontal",mirrorVertical:"Mirror, Vertical",rotateLeft:"Rotate left",rotateRight:"Rotate right",maxSize:"Max size",minSize:"Min size",tableHeader:"Table header",mergeCells:"Merge cells",splitCells:"Split Cells",HorizontalSplit:"Horizontal split",VerticalSplit:"Vertical split"},menu:{spaced:"Spaced",bordered:"Bordered",neon:"Neon",translucent:"Translucent",shadow:"Shadow",code:"Code"}};return void 0===t&&(e.SUNEDITOR_LANG||Object.defineProperty(e,"SUNEDITOR_LANG",{enumerable:!0,writable:!1,configurable:!1,value:{}}),Object.defineProperty(e.SUNEDITOR_LANG,"en",{enumerable:!0,writable:!0,configurable:!0,value:n})),n},"object"==typeof e.exports?e.exports=i.document?l(i,!0):function(e){if(!e.document)throw new Error("SUNEDITOR_LANG a window with a document");return l(e)}:l(i)},WUQj:function(e,t,n){},XJR1:function(e,t,n){"use strict";n.r(t);n("3FqI"),n("WUQj");var i={name:"colorPicker",add:function(e){const t=e.context;t.colorPicker={colorListHTML:"",_colorInput:"",_defaultColor:"#000",_styleProperty:"color",_currentColor:"",_colorList:[]};let n=this.createColorList(e,this._makeColorList);t.colorPicker.colorListHTML=n,n=null},createColorList:function(e,t){const n=e.context.option,i=e.lang,l=n.colorList&&0!==n.colorList.length?n.colorList:["#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"];let o=[],s='
    ';for(let e,n=0,i=l.length;n0&&(s+='
    '+t(o)+"
    ",o=[]),"object"==typeof e&&(s+='
    '+t(e)+"
    ")));return s+='
    ",s},_makeColorList:function(e){let t="";t+='
      ';for(let n,i=0,l=e.length;i');return t+="
    ",t},init:function(e,t){const n=this.plugins.colorPicker;let i=t||(n.getColorInNode.call(this,e)||this.context.colorPicker._defaultColor);i=n.isHexColor(i)?i:n.rgb2hex(i)||i;const l=this.context.colorPicker._colorList;if(l)for(let e=0,t=l.length;e=3&&"#"+((1<<24)+(n[0]<<16)+(n[1]<<8)+n[2]).toString(16).substr(1)}},l={name:"fontColor",display:"submenu",add:function(e,t){e.addModule([i]);const n=e.context;n.fontColor={previewEl:null,colorInput:null,colorList:null};let l=this.setSubmenu.call(e);n.fontColor.colorInput=l.querySelector("._se_color_picker_input"),n.fontColor.colorInput.addEventListener("keyup",this.onChangeInput.bind(e)),l.querySelector("._se_color_picker_submit").addEventListener("click",this.submit.bind(e)),l.querySelector("._se_color_picker_remove").addEventListener("click",this.remove.bind(e)),l.addEventListener("click",this.pickup.bind(e)),n.fontColor.colorList=l.querySelectorAll("li button"),e.initMenuTarget(this.name,t,l),l=null},setSubmenu:function(){const e=this.context.colorPicker.colorListHTML,t=this.util.createElement("DIV");return t.className="se-submenu se-list-layer",t.innerHTML=e,t},on:function(){const e=this.context.colorPicker,t=this.context.fontColor;e._colorInput=t.colorInput,e._defaultColor="#333333",e._styleProperty="color",e._colorList=t.colorList,this.plugins.colorPicker.init.call(this,this.getSelectionNode(),null)},onChangeInput:function(e){this.plugins.colorPicker.setCurrentColor.call(this,e.target.value)},submit:function(){this.plugins.fontColor.applyColor.call(this,this.context.colorPicker._currentColor)},pickup:function(e){e.preventDefault(),e.stopPropagation(),this.plugins.fontColor.applyColor.call(this,e.target.getAttribute("data-value"))},remove:function(){this.nodeChange(null,["color"],["span"],!0),this.submenuOff()},applyColor:function(e){if(!e)return;const t=this.util.createElement("SPAN");t.style.color=e,this.nodeChange(t,["color"],null,null),this.submenuOff()}},o={name:"hiliteColor",display:"submenu",add:function(e,t){e.addModule([i]);const n=e.context;n.hiliteColor={previewEl:null,colorInput:null,colorList:null};let l=this.setSubmenu.call(e);n.hiliteColor.colorInput=l.querySelector("._se_color_picker_input"),n.hiliteColor.colorInput.addEventListener("keyup",this.onChangeInput.bind(e)),l.querySelector("._se_color_picker_submit").addEventListener("click",this.submit.bind(e)),l.querySelector("._se_color_picker_remove").addEventListener("click",this.remove.bind(e)),l.addEventListener("click",this.pickup.bind(e)),n.hiliteColor.colorList=l.querySelectorAll("li button"),e.initMenuTarget(this.name,t,l),l=null},setSubmenu:function(){const e=this.context.colorPicker.colorListHTML,t=this.util.createElement("DIV");return t.className="se-submenu se-list-layer",t.innerHTML=e,t},on:function(){const e=this.context.colorPicker,t=this.context.hiliteColor;e._colorInput=t.colorInput,e._defaultColor="#FFFFFF",e._styleProperty="backgroundColor",e._colorList=t.colorList,this.plugins.colorPicker.init.call(this,this.getSelectionNode(),null)},onChangeInput:function(e){this.plugins.colorPicker.setCurrentColor.call(this,e.target.value)},submit:function(){this.plugins.hiliteColor.applyColor.call(this,this.context.colorPicker._currentColor)},pickup:function(e){e.preventDefault(),e.stopPropagation(),this.plugins.hiliteColor.applyColor.call(this,e.target.getAttribute("data-value"))},remove:function(){this.nodeChange(null,["background-color"],["span"],!0),this.submenuOff()},applyColor:function(e){if(!e)return;const t=this.util.createElement("SPAN");t.style.backgroundColor=e,this.nodeChange(t,["background-color"],null,null),this.submenuOff()}},s={name:"template",display:"submenu",add:function(e,t){e.context.template={};let n=this.setSubmenu.call(e);n.querySelector("ul").addEventListener("click",this.pickup.bind(e)),e.initMenuTarget(this.name,t,n),n=null},setSubmenu:function(){const e=this.context.option.templates;if(!e||0===e.length)throw Error('[SUNEDITOR.plugins.template.fail] To use the "template" plugin, please define the "templates" option.');const t=this.util.createElement("DIV");t.className="se-list-layer";let n='
      ';for(let t,i=0,l=e.length;i";return n+="
    ",t.innerHTML=n,t},pickup:function(e){if(!/^BUTTON$/i.test(e.target.tagName))return!1;e.preventDefault(),e.stopPropagation();const t=this.context.option.templates[e.target.getAttribute("data-value")];if(!t.html)throw this.submenuOff(),Error('[SUNEDITOR.template.fail] cause : "templates[i].html not found"');this.setContents(t.html),this.submenuOff()}},a=n("1kvd"),r=n.n(a),c={name:"link",display:"dialog",add:function(e){e.addModule([r.a]);const t=e.context;t.link={focusElement:null,linkNewWindowCheck:null,linkAnchorText:null,_linkAnchor:null,_linkValue:""};let n=this.setDialog.call(e);t.link.modal=n,t.link.focusElement=n.querySelector("._se_link_url"),t.link.linkAnchorText=n.querySelector("._se_link_text"),t.link.linkNewWindowCheck=n.querySelector("._se_link_check"),t.link.preview=n.querySelector(".se-link-preview");let i=this.setController_LinkButton.call(e);t.link.linkController=i,t.link._linkAnchor=null,i.addEventListener("mousedown",e.eventStop),n.querySelector(".se-btn-primary").addEventListener("click",this.submit.bind(e)),i.addEventListener("click",this.onClick_linkController.bind(e)),t.link.focusElement.addEventListener("input",this._onLinkPreview.bind(t.link.preview,t.link,t.options.linkProtocol)),t.dialog.modal.appendChild(n),t.element.relative.appendChild(i),n=null,i=null},setDialog:function(){const e=this.lang,t=this.util.createElement("DIV");return t.className="se-dialog-content",t.style.display="none",t.innerHTML='",t},setController_LinkButton:function(){const e=this.lang,t=this.icons,n=this.util.createElement("DIV");return n.className="se-controller se-controller-link",n.innerHTML='
    ",n},open:function(){this.plugins.dialog.open.call(this,"link","link"===this.currentControllerName)},_onLinkPreview:function(e,t,n){const i=n.target.value.trim();e._linkValue=this.textContent=i?t&&-1===i.indexOf("://")&&0!==i.indexOf("#")?t+i:-1===i.indexOf("://")?"/"+i:i:""},submit:function(e){this.showLoading(),e.preventDefault(),e.stopPropagation();const t=function(){const e=this.context.link;if(0===e._linkValue.length)return!1;const t=e._linkValue,n=e.linkAnchorText,i=0===n.value.length?t:n.value;if(this.context.dialog.updateModal){e._linkAnchor.href=t,e._linkAnchor.textContent=i,e._linkAnchor.target=e.linkNewWindowCheck.checked?"_blank":"";const n=e._linkAnchor.childNodes[0];this.setRange(n,0,n,n.textContent.length)}else{const n=this.util.createElement("A");n.href=t,n.textContent=i,n.target=e.linkNewWindowCheck.checked?"_blank":"";const l=this.getSelectedElements();if(l.length>1){const e=this.util.createElement(l[0].nodeName);if(e.appendChild(n),!this.insertNode(e,null,!0))return}else if(!this.insertNode(n,null,!0))return;this.setRange(n.childNodes[0],0,n.childNodes[0],n.textContent.length)}e._linkValue=e.preview.textContent=e.focusElement.value=e.linkAnchorText.value=""}.bind(this);try{t()}finally{this.plugins.dialog.close.call(this),this.closeLoading(),this.history.push(!1)}return!1},active:function(e){if(e){if(this.util.isAnchor(e)&&null===e.getAttribute("data-image-link"))return this.controllerArray.indexOf(this.context.link.linkController)<0&&this.plugins.link.call_controller.call(this,e),!0}else this.controllerArray.indexOf(this.context.link.linkController)>-1&&this.controllersOff();return!1},on:function(e){const t=this.context.link;e?t._linkAnchor&&(this.context.dialog.updateModal=!0,t._linkValue=t.preview.textContent=t.focusElement.value=t._linkAnchor.href,t.linkAnchorText.value=t._linkAnchor.textContent,t.linkNewWindowCheck.checked=!!/_blank/i.test(t._linkAnchor.target)):(this.plugins.link.init.call(this),t.linkAnchorText.value=this.getSelection().toString())},call_controller:function(e){this.editLink=this.context.link._linkAnchor=e;const t=this.context.link.linkController,n=t.querySelector("a");n.href=e.href,n.title=e.textContent,n.textContent=e.textContent;const i=this.util.getOffset(e,this.context.element.wysiwygFrame);t.style.top=i.top+e.offsetHeight+10+"px",t.style.left=i.left-this.context.element.wysiwygFrame.scrollLeft+"px",t.style.display="block";const l=this.context.element.wysiwygFrame.offsetWidth-(t.offsetLeft+t.offsetWidth);l<0?(t.style.left=t.offsetLeft+l+"px",t.firstElementChild.style.left=20-l+"px"):t.firstElementChild.style.left="20px",this.controllersOn(t,e,"link")},onClick_linkController:function(e){e.stopPropagation();const t=e.target.getAttribute("data-command")||e.target.parentNode.getAttribute("data-command");if(t){if(e.preventDefault(),/update/.test(t)){const e=this.context.link;e._linkValue=e.preview.textContent=e.focusElement.value=e._linkAnchor.href,e.linkAnchorText.value=e._linkAnchor.textContent,e.linkNewWindowCheck.checked=!!/_blank/i.test(e._linkAnchor.target),this.plugins.dialog.open.call(this,"link",!0)}else if(/unlink/.test(t)){const e=this.util.getChildElement(this.context.link._linkAnchor,(function(e){return 0===e.childNodes.length||3===e.nodeType}),!1),t=this.util.getChildElement(this.context.link._linkAnchor,(function(e){return 0===e.childNodes.length||3===e.nodeType}),!0);this.setRange(e,0,t,t.textContent.length),this.nodeChange(null,null,["A"],!1)}else this.util.removeItem(this.context.link._linkAnchor),this.context.link._linkAnchor=null,this.focus(),this.history.push(!1);this.controllersOff()}},init:function(){const e=this.context.link;e.linkController.style.display="none",e._linkAnchor=null,e._linkValue=e.preview.textContent=e.focusElement.value="",e.linkAnchorText.value="",e.linkNewWindowCheck.checked=!1}},d=n("ZED3"),u=n.n(d),h=n("ee5k"),g=n.n(h),p=n("gjS+"),m=n.n(p),f={name:"image",display:"dialog",add:function(e){e.addModule([r.a,u.a,g.a,m.a]);const t=e.context,n=t.image={_infoList:[],_infoIndex:0,_uploadFileLength:0,sizeUnit:t.option._imageSizeUnit,_altText:"",_linkElement:null,_align:"none",_floatClassRegExp:"__se__float\\-[a-z]+",_v_link:{_linkValue:""},_v_src:{_linkValue:""},svgDefaultSize:"30%",_element:null,_cover:null,_container:null,inputX:null,inputY:null,_element_w:1,_element_h:1,_element_l:0,_element_t:0,_defaultSizeX:"auto",_defaultSizeY:"auto",_origin_w:"auto"===t.option.imageWidth?"":t.option.imageWidth,_origin_h:"auto"===t.option.imageHeight?"":t.option.imageHeight,_proportionChecked:!0,_resizing:t.option.imageResizing,_resizeDotHide:!t.option.imageHeightShow,_rotation:t.option.imageRotation,_onlyPercentage:t.option.imageSizeOnlyPercentage,_ratio:!1,_ratioX:1,_ratioY:1,_captionShow:!0,_captionChecked:!1,_caption:null,captionCheckEl:null};let i=this.setDialog.call(e);n.modal=i,n.imgInputFile=i.querySelector("._se_image_file"),n.imgUrlFile=i.querySelector(".se-input-url"),n.focusElement=n.imgInputFile||n.imgUrlFile,n.altText=i.querySelector("._se_image_alt"),n.imgLink=i.querySelector("._se_image_link"),n.imgLinkNewWindowCheck=i.querySelector("._se_image_link_check"),n.captionCheckEl=i.querySelector("._se_image_check_caption"),n.previewLink=i.querySelector("._se_tab_content_url .se-link-preview"),n.previewSrc=i.querySelector("._se_tab_content_image .se-link-preview"),i.querySelector(".se-dialog-tabs").addEventListener("click",this.openTab.bind(e)),i.querySelector(".se-btn-primary").addEventListener("click",this.submit.bind(e)),n.imgInputFile&&i.querySelector(".se-file-remove").addEventListener("click",this._removeSelectedFiles.bind(n.imgInputFile,n.imgUrlFile,n.previewSrc)),n.imgInputFile&&n.imgUrlFile&&n.imgInputFile.addEventListener("change",this._fileInputChange.bind(n)),n.imgLink.addEventListener("input",this._onLinkPreview.bind(n.previewLink,n._v_link,t.options.linkProtocol)),n.imgUrlFile&&n.imgUrlFile.addEventListener("input",this._onLinkPreview.bind(n.previewSrc,n._v_src,t.options.linkProtocol));const l=i.querySelector(".__se__gallery");l&&l.addEventListener("click",this._openGallery.bind(e)),n.proportion={},n.inputX={},n.inputY={},t.option.imageResizing&&(n.proportion=i.querySelector("._se_image_check_proportion"),n.inputX=i.querySelector("._se_image_size_x"),n.inputY=i.querySelector("._se_image_size_y"),n.inputX.value=t.option.imageWidth,n.inputY.value=t.option.imageHeight,n.inputX.addEventListener("keyup",this.setInputSize.bind(e,"x")),n.inputY.addEventListener("keyup",this.setInputSize.bind(e,"y")),n.inputX.addEventListener("change",this.setRatio.bind(e)),n.inputY.addEventListener("change",this.setRatio.bind(e)),n.proportion.addEventListener("change",this.setRatio.bind(e)),i.querySelector(".se-dialog-btn-revert").addEventListener("click",this.sizeRevert.bind(e))),t.dialog.modal.appendChild(i),i=null},setDialog:function(){const e=this.context.option,t=this.lang,n=this.util.createElement("DIV");n.className="se-dialog-content",n.style.display="none";let i='
    '+t.dialogBox.imageBox.title+'
    ';if(e.imageFileInput&&(i+='
    "),e.imageUrlInput&&(i+='
    '+(e.imageGalleryUrl&&this.plugins.imageGallery?'":"")+'
    '),i+='
    ',e.imageResizing){const n=e.imageSizeOnlyPercentage,l=n?' style="display: none !important;"':"",o=e.imageHeightShow?"":' style="display: none !important;"';i+='
    ',n||!e.imageHeightShow?i+='
    ":i+='
    ",i+=' '+t.dialogBox.proportion+'
    "}return i+='
    ",n.innerHTML=i,n},_fileInputChange:function(){this.imgInputFile.value?(this.imgUrlFile.setAttribute("disabled",!0),this.previewSrc.style.textDecoration="line-through"):(this.imgUrlFile.removeAttribute("disabled"),this.previewSrc.style.textDecoration="")},_removeSelectedFiles:function(e,t){this.value="",e&&(e.removeAttribute("disabled"),t.style.textDecoration="")},_openGallery:function(){this.callPlugin("imageGallery",this.plugins.imageGallery.open.bind(this,this.plugins.image._setUrlInput.bind(this.context.image)),null)},_setUrlInput:function(e){this.altText.value=e.alt,this._v_src._linkValue=this.previewSrc.textContent=this.imgUrlFile.value=e.src,this.imgUrlFile.focus()},_onLinkPreview:function(e,t,n){const i=n.target.value.trim();e._linkValue=this.textContent=i?t&&-1===i.indexOf("://")&&0!==i.indexOf("#")?t+i:-1===i.indexOf("://")?"/"+i:i:""},fileTags:["img"],select:function(e){this.plugins.image.onModifyMode.call(this,e,this.plugins.resizing.call_controller_resize.call(this,e,"image"))},destroy:function(e){const t=e||this.context.image._element,n=this.util.getParentElement(t,this.util.isMediaComponent)||t,i=1*t.getAttribute("data-index");let l=n.previousElementSibling||n.nextElementSibling;const o=n.parentNode;this.util.removeItem(n),this.plugins.image.init.call(this),this.controllersOff(),o!==this.context.element.wysiwyg&&this.util.removeItemAllParents(o,(function(e){return 0===e.childNodes.length}),null),this.focusEdge(l),this.plugins.fileManager.deleteInfo.call(this,"image",i,this.functions.onImageUpload),this.history.push(!1)},on:function(e){const t=this.context.image;e?t.imgInputFile&&this.context.options.imageMultipleFile&&t.imgInputFile.removeAttribute("multiple"):(t.inputX.value=t._origin_w=this.context.option.imageWidth===t._defaultSizeX?"":this.context.option.imageWidth,t.inputY.value=t._origin_h=this.context.option.imageHeight===t._defaultSizeY?"":this.context.option.imageHeight,t.imgInputFile&&this.context.options.imageMultipleFile&&t.imgInputFile.setAttribute("multiple","multiple"))},open:function(){this.plugins.dialog.open.call(this,"image","image"===this.currentControllerName)},openTab:function(e){const t=this.context.image.modal,n="init"===e?t.querySelector("._se_tab_link"):e.target;if(!/^BUTTON$/i.test(n.tagName))return!1;const i=n.getAttribute("data-tab-link");let l,o,s;for(o=t.getElementsByClassName("_se_tab_content"),l=0;l0?(this.showLoading(),n.submitAction.call(this,this.context.image.imgInputFile.files)):t.imgUrlFile&&t._v_src._linkValue.length>0&&(this.showLoading(),n.onRender_imgUrl.call(this))}catch(e){throw this.closeLoading(),Error('[SUNEDITOR.image.submit.fail] cause : "'+e.message+'"')}finally{this.plugins.dialog.close.call(this)}return!1},submitAction:function(e){if(0===e.length)return;let t=0,n=[];for(let i=0,l=e.length;i0){let e=0;const n=this.context.image._infoList;for(let t=0,i=n.length;ti){this.closeLoading();const n="[SUNEDITOR.imageUpload.fail] Size of uploadable total images: "+i/1e3+"KB";return void(("function"!==this.functions.onImageUploadError||this.functions.onImageUploadError(n,{limitSize:i,currentSize:e,uploadSize:t},this))&&this.functions.noticeOpen(n))}}const l=this.context.image;l._uploadFileLength=n.length;const o={linkValue:l._v_link._linkValue,linkNewWindow:l.imgLinkNewWindowCheck.checked,inputWidth:l.inputX.value,inputHeight:l.inputY.value,align:l._align,isUpdate:this.context.dialog.updateModal,element:l._element};if("function"==typeof this.functions.onImageUploadBefore){const e=this.functions.onImageUploadBefore(n,o,this,function(e){e&&this._w.Array.isArray(e.result)?this.plugins.image.register.call(this,o,e):this.plugins.image.upload.call(this,o,e)}.bind(this));if(void 0===e)return;if(!e)return void this.closeLoading();this._w.Array.isArray(e)&&e.length>0&&(n=e)}this.plugins.image.upload.call(this,o,n)},error:function(e,t){if(this.closeLoading(),"function"!=typeof this.functions.onImageUploadError||this.functions.onImageUploadError(e,t,this))throw this.functions.noticeOpen(e),Error("[SUNEDITOR.plugin.image.error] response: "+e)},upload:function(e,t){if(!t)return void this.closeLoading();if("string"==typeof t)return void this.plugins.image.error.call(this,t,null);const n=this.context.option.imageUploadUrl,i=this.context.dialog.updateModal?1:t.length;if("string"==typeof n&&n.length>0){const l=new FormData;for(let e=0;e0){const i=this.util.createElement("A");return i.href=/^https?:\/\//.test(t)?t:"http://"+t,i.target=n?"_blank":"",i.setAttribute("data-image-link","image"),e.setAttribute("data-image-link",t),i.appendChild(e),i}return e},setInputSize:function(e,t){t&&32===t.keyCode?t.preventDefault():this.plugins.resizing._module_setInputSize.call(this,this.context.image,e)},setRatio:function(){this.plugins.resizing._module_setRatio.call(this,this.context.image)},checkFileInfo:function(){const e=this.plugins.image,t=function(t){e.onModifyMode.call(this,t,null),e.openModify.call(this,!0),e.update_image.call(this,!0,!1,!0)}.bind(this);this.plugins.fileManager.checkInfo.call(this,"image",["img"],this.functions.onImageUpload,t,!0)},resetFileInfo:function(){this.plugins.fileManager.resetInfo.call(this,"image",this.functions.onImageUpload)},create_image:function(e,t,n,i,l,o,s){const a=this.plugins.image,r=this.context.image;this.context.resizing._resize_plugin="image";let c=this.util.createElement("IMG");c.src=e,c.alt=r._altText,c=a.onRender_link.call(this,c,t,n),c.setAttribute("data-rotate","0"),r._resizing&&c.setAttribute("data-proportion",r._proportionChecked);const d=this.plugins.component.set_cover.call(this,c),u=this.plugins.component.set_container.call(this,d,"se-image-container");r._captionChecked&&(r._caption=this.plugins.component.create_caption.call(this),r._caption.setAttribute("contenteditable",!1),d.appendChild(r._caption)),r._element=c,r._cover=d,r._container=u,a.applySize.call(this,i,l),a.setAlign.call(this,o,c,d,u),c.onload=a._image_create_onload.bind(this,c,r.svgDefaultSize),this.insertComponent(u,!0,!0,!0)&&this.plugins.fileManager.setInfo.call(this,"image",c,this.functions.onImageUpload,s,!0),this.context.resizing._resize_plugin=""},_image_create_onload:function(e,t){0===e.offsetWidth&&this.plugins.image.applySize.call(this,t,""),this.selectComponent.call(this,e,"image")},update_image:function(e,t,n){const i=this.context.image,l=i._v_link._linkValue;let o,s=i._element,a=i._cover,r=i._container,c=!1;null===a&&(c=!0,s=i._element.cloneNode(!0),a=this.plugins.component.set_cover.call(this,s)),null===r?(a=a.cloneNode(!0),s=a.querySelector("img"),c=!0,r=this.plugins.component.set_container.call(this,a,"se-image-container")):c&&(r.innerHTML="",r.appendChild(a),i._cover=a,i._element=s,c=!1);const d=this.util.isNumber(i.inputX.value)?i.inputX.value+i.sizeUnit:i.inputX.value,u=this.util.isNumber(i.inputY.value)?i.inputY.value+i.sizeUnit:i.inputY.value;o=/%$/.test(s.style.width)?d!==r.style.width||u!==r.style.height:d!==s.style.width||u!==s.style.height,s.alt=i._altText;let h=!1;if(i._captionChecked?i._caption||(i._caption=this.plugins.component.create_caption.call(this),a.appendChild(i._caption),h=!0):i._caption&&(this.util.removeItem(i._caption),i._caption=null,h=!0),l.trim().length>0)if(null!==i._linkElement&&a.contains(i._linkElement))i._linkElement.href=l,i._linkElement.target=i.imgLinkNewWindowCheck.checked?"_blank":"",s.setAttribute("data-image-link",l);else{let e=this.plugins.image.onRender_link.call(this,s,l,this.context.image.imgLinkNewWindowCheck.checked);a.insertBefore(e,i._caption)}else if(null!==i._linkElement){const e=s;e.setAttribute("data-image-link","");let t=e.cloneNode(!0);a.removeChild(i._linkElement),a.insertBefore(t,i._caption),s=t}if(c){const e=this.util.isRangeFormatElement(i._element.parentNode)||this.util.isWysiwygDiv(i._element.parentNode)?i._element:/^A$/i.test(i._element.parentNode.nodeName)?i._element.parentNode:this.util.getFormatElement(i._element)||i._element;e.parentNode.replaceChild(r,e),s=r.querySelector("img"),i._element=s,i._cover=a,i._container=r}(h||!i._onlyPercentage&&o)&&!e&&(/\d+/.test(s.style.height)||this.context.resizing._rotateVertical&&i._captionChecked)&&(/%$/.test(i.inputX.value)||/%$/.test(i.inputY.value)?this.plugins.resizing.resetTransform.call(this,s):this.plugins.resizing.setTransformSize.call(this,s,this.util.getNumber(i.inputX.value,0),this.util.getNumber(i.inputY.value,0)));i._resizing&&(s.setAttribute("data-proportion",i._proportionChecked),o&&this.plugins.image.applySize.call(this)),this.plugins.image.setAlign.call(this,null,s,null,null),e&&this.plugins.fileManager.setInfo.call(this,"image",s,this.functions.onImageUpload,null,!0),t&&this.selectComponent(s,"image"),n||this.history.push(!1)},update_src:function(e,t,n){t.src=e,this._w.setTimeout(this.plugins.fileManager.setInfo.bind(this,"image",t,this.functions.onImageUpload,n,!0)),this.selectComponent(t,"image")},onModifyMode:function(e,t){if(!e)return;const n=this.context.image;n._linkElement=/^A$/i.test(e.parentNode.nodeName)?e.parentNode:null,n._element=e,n._cover=this.util.getParentElement(e,"FIGURE"),n._container=this.util.getParentElement(e,this.util.isMediaComponent),n._caption=this.util.getChildElement(n._cover,"FIGCAPTION"),n._align=e.getAttribute("data-align")||"none",t&&(n._element_w=t.w,n._element_h=t.h,n._element_t=t.t,n._element_l=t.l);let i=n._element.getAttribute("data-size")||n._element.getAttribute("data-origin");i?(i=i.split(","),n._origin_w=i[0],n._origin_h=i[1]):t&&(n._origin_w=t.w,n._origin_h=t.h)},openModify:function(e){const t=this.context.image;t.imgUrlFile&&(t._v_src._linkValue=t.previewSrc.textContent=t.imgUrlFile.value=t._element.src),t._altText=t.altText.value=t._element.alt,t._v_link._linkValue=t.previewLink.textContent=t.imgLink.value=null===t._linkElement?"":t._linkElement.href,t.imgLinkNewWindowCheck.checked=t._linkElement&&"_blank"===t._linkElement.target,t.modal.querySelector('input[name="suneditor_image_radio"][value="'+t._align+'"]').checked=!0,t._align=t.modal.querySelector('input[name="suneditor_image_radio"]:checked').value,t._captionChecked=t.captionCheckEl.checked=!!t._caption,t._resizing&&this.plugins.resizing._module_setModifyInputSize.call(this,t,this.plugins.image),e||this.plugins.dialog.open.call(this,"image",!0)},sizeRevert:function(){this.plugins.resizing._module_sizeRevert.call(this,this.context.image)},applySize:function(e,t){const n=this.context.image;return e||(e=n.inputX.value||this.context.option.imageWidth),t||(t=n.inputY.value||this.context.option.imageHeight),n._onlyPercentage&&e||/%$/.test(e)?(this.plugins.image.setPercentSize.call(this,e,t),!0):(e&&"auto"!==e||t&&"auto"!==t?this.plugins.image.setSize.call(this,e,t,!1):this.plugins.image.setAutoSize.call(this),!1)},setSize:function(e,t,n,i){const l=this.context.image,o=/^(rw|lw)$/.test(i),s=/^(th|bh)$/.test(i);this.plugins.image.cancelPercentAttr.call(this),s||(l._element.style.width=this.util.isNumber(e)?e+l.sizeUnit:e),o||(l._element.style.height=this.util.isNumber(t)?t+l.sizeUnit:/%$/.test(t)?"":t),"center"===l._align&&this.plugins.image.setAlign.call(this,null,null,null,null),n||l._element.removeAttribute("data-percentage"),this.plugins.resizing._module_saveCurrentSize.call(this,l)},setAutoSize:function(){const e=this.context.image;this.plugins.resizing.resetTransform.call(this,e._element),this.plugins.image.cancelPercentAttr.call(this),e._element.style.maxWidth="",e._element.style.width="",e._element.style.height="",e._cover.style.width="",e._cover.style.height="",this.plugins.image.setAlign.call(this,null,null,null,null),e._element.setAttribute("data-percentage","auto,auto"),this.plugins.resizing._module_saveCurrentSize.call(this,e)},setOriginSize:function(){const e=this.context.image;e._element.removeAttribute("data-percentage"),this.plugins.resizing.resetTransform.call(this,e._element),this.plugins.image.cancelPercentAttr.call(this);const t=(e._element.getAttribute("data-origin")||"").split(","),n=t[0],i=t[1];t&&(e._onlyPercentage||/%$/.test(n)&&(/%$/.test(i)||!/\d/.test(i))?this.plugins.image.setPercentSize.call(this,n,i):this.plugins.image.setSize.call(this,n,i),this.plugins.resizing._module_saveCurrentSize.call(this,e))},setPercentSize:function(e,t){const n=this.context.image;t=!t||/%$/.test(t)||this.util.getNumber(t,0)?this.util.isNumber(t)?t+n.sizeUnit:t||"":this.util.isNumber(t)?t+"%":t;const i=/%$/.test(t);n._container.style.width=this.util.isNumber(e)?e+"%":e,n._container.style.height="",n._cover.style.width="100%",n._cover.style.height=i?t:"",n._element.style.width="100%",n._element.style.height=i?"":t,n._element.style.maxWidth="","center"===n._align&&this.plugins.image.setAlign.call(this,null,null,null,null),n._element.setAttribute("data-percentage",e+","+t),this.plugins.resizing.setCaptionPosition.call(this,n._element),this.plugins.resizing._module_saveCurrentSize.call(this,n)},cancelPercentAttr:function(){const e=this.context.image;e._cover.style.width="",e._cover.style.height="",e._container.style.width="",e._container.style.height="",this.util.removeClass(e._container,this.context.image._floatClassRegExp),this.util.addClass(e._container,"__se__float-"+e._align),"center"===e._align&&this.plugins.image.setAlign.call(this,null,null,null,null)},setAlign:function(e,t,n,i){const l=this.context.image;e||(e=l._align),t||(t=l._element),n||(n=l._cover),i||(i=l._container),n.style.margin=e&&"none"!==e?"auto":"0",/%$/.test(t.style.width)&&"center"===e?(i.style.minWidth="100%",n.style.width=i.style.width):(i.style.minWidth="",n.style.width=this.context.resizing._rotateVertical?t.style.height||t.offsetHeight:t.style.width&&"auto"!==t.style.width?t.style.width||"100%":""),this.util.hasClass(i,"__se__float-"+e)||(this.util.removeClass(i,l._floatClassRegExp),this.util.addClass(i,"__se__float-"+e)),t.setAttribute("data-align",e)},resetAlign:function(){const e=this.context.image;e._element.setAttribute("data-align",""),e._align="none",e._cover.style.margin="0",this.util.removeClass(e._container,e._floatClassRegExp)},init:function(){const e=this.context.image;e.imgInputFile&&(e.imgInputFile.value=""),e.imgUrlFile&&(e._v_src._linkValue=e.previewSrc.textContent=e.imgUrlFile.value=""),e.imgInputFile&&e.imgUrlFile&&(e.imgUrlFile.removeAttribute("disabled"),e.previewSrc.style.textDecoration=""),e.altText.value="",e._v_link._linkValue=e.previewLink.textContent=e.imgLink.value="",e.imgLinkNewWindowCheck.checked=!1,e.modal.querySelector('input[name="suneditor_image_radio"][value="none"]').checked=!0,e.captionCheckEl.checked=!1,e._element=null,this.plugins.image.openTab.call(this,"init"),e._resizing&&(e.inputX.value=this.context.option.imageWidth===e._defaultSizeX?"":this.context.option.imageWidth,e.inputY.value=this.context.option.imageHeight===e._defaultSizeY?"":this.context.option.imageHeight,e.proportion.checked=!0,e._ratio=!1,e._ratioX=1,e._ratioY=1)}},_={name:"video",display:"dialog",add:function(e){e.addModule([r.a,u.a,g.a,m.a]);const t=e.context,n=t.video={_infoList:[],_infoIndex:0,_uploadFileLength:0,sizeUnit:t.option._videoSizeUnit,_align:"none",_floatClassRegExp:"__se__float\\-[a-z]+",_youtubeQuery:t.option.youtubeQuery,_videoRatio:100*t.option.videoRatio+"%",_defaultRatio:100*t.option.videoRatio+"%",_linkValue:"",_element:null,_cover:null,_container:null,inputX:null,inputY:null,_element_w:1,_element_h:1,_element_l:0,_element_t:0,_defaultSizeX:"100%",_defaultSizeY:100*t.option.videoRatio+"%",_origin_w:"100%"===t.option.videoWidth?"":t.option.videoWidth,_origin_h:"56.25%"===t.option.videoHeight?"":t.option.videoHeight,_proportionChecked:!0,_resizing:t.option.videoResizing,_resizeDotHide:!t.option.videoHeightShow,_rotation:t.option.videoRotation,_onlyPercentage:t.option.videoSizeOnlyPercentage,_ratio:!1,_ratioX:1,_ratioY:1,_captionShow:!1};let i=this.setDialog.call(e);n.modal=i,n.videoInputFile=i.querySelector("._se_video_file"),n.videoUrlFile=i.querySelector(".se-input-url"),n.focusElement=n.videoUrlFile||n.videoInputFile,n.preview=i.querySelector(".se-link-preview"),i.querySelector(".se-btn-primary").addEventListener("click",this.submit.bind(e)),n.videoInputFile&&i.querySelector(".se-dialog-files-edge-button").addEventListener("click",this._removeSelectedFiles.bind(n.videoInputFile,n.videoUrlFile,n.preview)),n.videoInputFile&&n.videoUrlFile&&n.videoInputFile.addEventListener("change",this._fileInputChange.bind(n)),n.videoUrlFile&&n.videoUrlFile.addEventListener("input",this._onLinkPreview.bind(n.preview,n,t.options.linkProtocol)),n.proportion={},n.videoRatioOption={},n.inputX={},n.inputY={},t.option.videoResizing&&(n.proportion=i.querySelector("._se_video_check_proportion"),n.videoRatioOption=i.querySelector(".se-video-ratio"),n.inputX=i.querySelector("._se_video_size_x"),n.inputY=i.querySelector("._se_video_size_y"),n.inputX.value=t.option.videoWidth,n.inputY.value=t.option.videoHeight,n.inputX.addEventListener("keyup",this.setInputSize.bind(e,"x")),n.inputY.addEventListener("keyup",this.setInputSize.bind(e,"y")),n.inputX.addEventListener("change",this.setRatio.bind(e)),n.inputY.addEventListener("change",this.setRatio.bind(e)),n.proportion.addEventListener("change",this.setRatio.bind(e)),n.videoRatioOption.addEventListener("change",this.setVideoRatio.bind(e)),i.querySelector(".se-dialog-btn-revert").addEventListener("click",this.sizeRevert.bind(e))),t.dialog.modal.appendChild(i),i=null},setDialog:function(){const e=this.context.option,t=this.lang,n=this.util.createElement("DIV");n.className="se-dialog-content",n.style.display="none";let i='
    '+t.dialogBox.videoBox.title+'
    ';if(e.videoFileInput&&(i+='
    "),e.videoUrlInput&&(i+='
    '),e.videoResizing){const n=e.videoRatioList||[{name:"16:9",value:.5625},{name:"4:3",value:.75},{name:"21:9",value:.4285}],l=e.videoRatio,o=e.videoSizeOnlyPercentage,s=o?' style="display: none !important;"':"",a=e.videoHeightShow?"":' style="display: none !important;"',r=e.videoRatioShow?"":' style="display: none !important;"',c=o||e.videoHeightShow||e.videoRatioShow?"":' style="display: none !important;"';i+='
    "}return i+='
    ",n.innerHTML=i,n},_fileInputChange:function(){this.videoInputFile.value?(this.videoUrlFile.setAttribute("disabled",!0),this.preview.style.textDecoration="line-through"):(this.videoUrlFile.removeAttribute("disabled"),this.preview.style.textDecoration="")},_removeSelectedFiles:function(e,t){this.value="",e&&(e.removeAttribute("disabled"),t.style.textDecoration="")},_onLinkPreview:function(e,t,n){const i=n.target.value.trim();/^$/.test(i)?(e._linkValue=i,this.textContent=''):e._linkValue=this.textContent=i?t&&-1===i.indexOf("://")&&0!==i.indexOf("#")?t+i:-1===i.indexOf("://")?"/"+i:i:""},_setTagAttrs:function(e){e.setAttribute("controls",!0);const t=this.context.options.videoTagAttrs;if(t)for(let n in t)this.util.hasOwn(t,n)&&e.setAttribute(n,t[n])},createVideoTag:function(){const e=this.util.createElement("VIDEO");return this.plugins.video._setTagAttrs.call(this,e),e},_setIframeAttrs:function(e){e.frameBorder="0",e.allowFullscreen=!0;const t=this.context.options.videoIframeAttrs;if(t)for(let n in t)this.util.hasOwn(t,n)&&e.setAttribute(n,t[n])},createIframeTag:function(){const e=this.util.createElement("IFRAME");return this.plugins.video._setIframeAttrs.call(this,e),e},fileTags:["iframe","video"],select:function(e){this.plugins.video.onModifyMode.call(this,e,this.plugins.resizing.call_controller_resize.call(this,e,"video"))},destroy:function(e){const t=e||this.context.video._element,n=this.context.video._container,i=1*t.getAttribute("data-index");let l=n.previousElementSibling||n.nextElementSibling;const o=n.parentNode;this.util.removeItem(n),this.plugins.video.init.call(this),this.controllersOff(),o!==this.context.element.wysiwyg&&this.util.removeItemAllParents(o,(function(e){return 0===e.childNodes.length}),null),this.focusEdge(l),this.plugins.fileManager.deleteInfo.call(this,"video",i,this.functions.onVideoUpload),this.history.push(!1)},on:function(e){const t=this.context.video;e?t.videoInputFile&&this.context.options.videoMultipleFile&&t.videoInputFile.removeAttribute("multiple"):(t.inputX.value=t._origin_w=this.context.option.videoWidth===t._defaultSizeX?"":this.context.option.videoWidth,t.inputY.value=t._origin_h=this.context.option.videoHeight===t._defaultSizeY?"":this.context.option.videoHeight,t.proportion.disabled=!0,t.videoInputFile&&this.context.options.videoMultipleFile&&t.videoInputFile.setAttribute("multiple","multiple")),t._resizing&&this.plugins.video.setVideoRatioSelect.call(this,t._origin_h||t._defaultRatio)},open:function(){this.plugins.dialog.open.call(this,"video","video"===this.currentControllerName)},setVideoRatio:function(e){const t=this.context.video,n=e.target.options[e.target.selectedIndex].value;t._defaultSizeY=t._videoRatio=n?100*n+"%":t._defaultSizeY,t.inputY.placeholder=n?100*n+"%":"",t.inputY.value=""},setInputSize:function(e,t){if(t&&32===t.keyCode)return void t.preventDefault();const n=this.context.video;this.plugins.resizing._module_setInputSize.call(this,n,e),"y"===e&&this.plugins.video.setVideoRatioSelect.call(this,t.target.value||n._defaultRatio)},setRatio:function(){this.plugins.resizing._module_setRatio.call(this,this.context.video)},submit:function(e){const t=this.context.video,n=this.plugins.video;e.preventDefault(),e.stopPropagation(),t._align=t.modal.querySelector('input[name="suneditor_video_radio"]:checked').value;try{t.videoInputFile&&t.videoInputFile.files.length>0?(this.showLoading(),n.submitAction.call(this,this.context.video.videoInputFile.files)):t.videoUrlFile&&t._linkValue.length>0&&(this.showLoading(),n.setup_url.call(this))}catch(e){throw this.closeLoading(),Error('[SUNEDITOR.video.submit.fail] cause : "'+e.message+'"')}finally{this.plugins.dialog.close.call(this)}return!1},submitAction:function(e){if(0===e.length)return;let t=0,n=[];for(let i=0,l=e.length;i0){let e=0;const n=this.context.video._infoList;for(let t=0,i=n.length;ti){this.closeLoading();const n="[SUNEDITOR.videoUpload.fail] Size of uploadable total videos: "+i/1e3+"KB";return void(("function"!==this.functions.onVideoUploadError||this.functions.onVideoUploadError(n,{limitSize:i,currentSize:e,uploadSize:t},this))&&this.functions.noticeOpen(n))}}const l=this.context.video;l._uploadFileLength=n.length;const o={inputWidth:l.inputX.value,inputHeight:l.inputY.value,align:l._align,isUpdate:this.context.dialog.updateModal,element:l._element};if("function"==typeof this.functions.onVideoUploadBefore){const e=this.functions.onVideoUploadBefore(n,o,this,function(e){e&&this._w.Array.isArray(e.result)?this.plugins.video.register.call(this,o,e):this.plugins.video.upload.call(this,o,e)}.bind(this));if(void 0===e)return;if(!e)return void this.closeLoading();"object"==typeof e&&e.length>0&&(n=e)}this.plugins.video.upload.call(this,o,n)},error:function(e,t){if(this.closeLoading(),"function"!=typeof this.functions.onVideoUploadError||this.functions.onVideoUploadError(e,t,this))throw this.functions.noticeOpen(e),Error("[SUNEDITOR.plugin.video.error] response: "+e)},upload:function(e,t){if(!t)return void this.closeLoading();if("string"==typeof t)return void this.plugins.video.error.call(this,t,null);const n=this.context.option.videoUploadUrl,i=this.context.dialog.updateModal?1:t.length;if(!("string"==typeof n&&n.length>0))throw Error('[SUNEDITOR.videoUpload.fail] cause : There is no "videoUploadUrl" option.');{const l=new FormData;for(let e=0;e$/.test(t)){if(t=(new this._w.DOMParser).parseFromString(t,"text/html").querySelector("iframe").src,0===t.length)return!1}if(/youtu\.?be/.test(t)){if(/^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("&","?&")),e._youtubeQuery.length>0)if(/\?/.test(t)){const n=t.split("?");t=n[0]+"?"+e._youtubeQuery+"&"+n[1]}else t+="?"+e._youtubeQuery}else/vimeo\.com/.test(t)&&(t.endsWith("/")&&(t=t.slice(0,-1)),t="https://player.vimeo.com/video/"+t.slice(t.lastIndexOf("/")+1));this.plugins.video.create_video.call(this,this.plugins.video.createIframeTag.call(this),t,e.inputX.value,e.inputY.value,e._align,null,this.context.dialog.updateModal)}catch(e){throw Error('[SUNEDITOR.video.upload.fail] cause : "'+e.message+'"')}finally{this.closeLoading()}},create_video:function(e,t,n,i,l,o,s){this.context.resizing._resize_plugin="video";const a=this.context.video;let r=null,c=null,d=!1;if(s){if((e=a._element).src!==t){d=!0;const n=/youtu\.?be/.test(t),i=/vimeo\.com/.test(t);if(!n&&!i||/^iframe$/i.test(e.nodeName))if(n||i||/^videoo$/i.test(e.nodeName))e.src=t;else{const n=this.plugins.video.createVideoTag.call(this);n.src=t,e.parentNode.replaceChild(n,e),a._element=e=n}else{const n=this.plugins.video.createIframeTag.call(this);n.src=t,e.parentNode.replaceChild(n,e),a._element=e=n}}c=a._container,r=this.util.getParentElement(e,"FIGURE")}else d=!0,e.src=t,a._element=e,r=this.plugins.component.set_cover.call(this,e),c=this.plugins.component.set_container.call(this,r,"se-video-container");a._cover=r,a._container=c;const u=this.plugins.resizing._module_getSizeX.call(this,a)!==(n||a._defaultSizeX)||this.plugins.resizing._module_getSizeY.call(this,a)!==(i||a._videoRatio),h=!s||u;a._resizing&&(this.context.video._proportionChecked=a.proportion.checked,e.setAttribute("data-proportion",a._proportionChecked));let g=!1;h&&(g=this.plugins.video.applySize.call(this)),g&&"center"===l||this.plugins.video.setAlign.call(this,null,e,r,c);let p=!0;s?a._resizing&&this.context.resizing._rotateVertical&&h&&this.plugins.resizing.setTransformSize.call(this,e,null,null):p=this.insertComponent(c,!1,!0,!1),p&&(d&&this.plugins.fileManager.setInfo.call(this,"video",e,this.functions.onVideoUpload,o,!0),s&&(this.selectComponent(e,"video"),this.history.push(!1))),this.context.resizing._resize_plugin=""},_update_videoCover:function(e){if(!e)return;const t=this.context.video;/^video$/i.test(e.nodeName)?this.plugins.video._setTagAttrs.call(this,e):this.plugins.video._setIframeAttrs.call(this,e);const n=this.util.getParentElement(e,this.util.isMediaComponent)||this.util.getParentElement(e,function(e){return this.isWysiwygDiv(e.parentNode)}.bind(this.util));t._element=e=e.cloneNode(!0);const i=t._cover=this.plugins.component.set_cover.call(this,e),l=t._container=this.plugins.component.set_container.call(this,i,"se-video-container"),o=n.querySelector("figcaption");let s=null;o&&(s=this.util.createElement("DIV"),s.innerHTML=o.innerHTML,this.util.removeItem(o));const a=(e.getAttribute("data-size")||e.getAttribute("data-origin")||"").split(",");this.plugins.video.applySize.call(this,a[0],a[1]),n.parentNode.replaceChild(l,n),s&&n.parentNode.insertBefore(s,l.nextElementSibling),this.plugins.fileManager.setInfo.call(this,"video",e,this.functions.onVideoUpload,null,!0)},onModifyMode:function(e,t){const n=this.context.video;n._element=e,n._cover=this.util.getParentElement(e,"FIGURE"),n._container=this.util.getParentElement(e,this.util.isMediaComponent),n._align=e.getAttribute("data-align")||"none",t&&(n._element_w=t.w,n._element_h=t.h,n._element_t=t.t,n._element_l=t.l);let i=n._element.getAttribute("data-size")||n._element.getAttribute("data-origin");i?(i=i.split(","),n._origin_w=i[0],n._origin_h=i[1]):t&&(n._origin_w=t.w,n._origin_h=t.h)},openModify:function(e){const t=this.context.video;if(t.videoUrlFile&&(t._linkValue=t.preview.textContent=t.videoUrlFile.value=t._element.src||(t._element.querySelector("source")||"").src||""),t.modal.querySelector('input[name="suneditor_video_radio"][value="'+t._align+'"]').checked=!0,t._resizing){this.plugins.resizing._module_setModifyInputSize.call(this,t,this.plugins.video);const e=t._videoRatio=this.plugins.resizing._module_getSizeY.call(this,t);this.plugins.video.setVideoRatioSelect.call(this,e)||(t.inputY.value=t._onlyPercentage?this.util.getNumber(e,2):e)}e||this.plugins.dialog.open.call(this,"video",!0)},setVideoRatioSelect:function(e){let t=!1;const n=this.context.video,i=n.videoRatioOption.options;/%$/.test(e)||n._onlyPercentage?e=this.util.getNumber(e,2)/100+"":(!this.util.isNumber(e)||1*e>=1)&&(e=""),n.inputY.placeholder="";for(let l=0,o=i.length;l'+this.icons.cancel+''+t.dialogBox.audioBox.title+'
    ';return e.audioFileInput&&(i+='
    "),e.audioUrlInput&&(i+='
    '),i+='
    ",n.innerHTML=i,n},setController:function(){const e=this.lang,t=this.icons,n=this.util.createElement("DIV");return n.className="se-controller se-controller-link",n.innerHTML='
    ",n},_fileInputChange:function(){this.audioInputFile.value?(this.audioUrlFile.setAttribute("disabled",!0),this.preview.style.textDecoration="line-through"):(this.audioUrlFile.removeAttribute("disabled"),this.preview.style.textDecoration="")},_removeSelectedFiles:function(e,t){this.value="",e&&(e.removeAttribute("disabled"),t.style.textDecoration="")},_createAudioTag:function(){const e=this.util.createElement("AUDIO");this.plugins.audio._setTagAttrs.call(this,e);const t=this.context.audio._origin_w,n=this.context.audio._origin_h;return e.setAttribute("origin-size",t+","+n),e.style.cssText=(t?"width:"+t+"; ":"")+(n?"height:"+n+";":""),e},_setTagAttrs:function(e){e.setAttribute("controls",!0);const t=this.context.options.audioTagAttrs;if(t)for(let n in t)this.util.hasOwn(t,n)&&e.setAttribute(n,t[n])},_onLinkPreview:function(e,t,n){const i=n.target.value.trim();e._linkValue=this.textContent=i?t&&-1===i.indexOf("://")&&0!==i.indexOf("#")?t+i:-1===i.indexOf("://")?"/"+i:i:""},fileTags:["audio"],select:function(e){this.plugins.audio.onModifyMode.call(this,e)},destroy:function(e){e=e||this.context.audio._element;const t=this.util.getParentElement(e,this.util.isComponent)||e,n=1*e.getAttribute("data-index"),i=t.previousElementSibling||t.nextElementSibling,l=t.parentNode;this.util.removeItem(t),this.plugins.audio.init.call(this),this.controllersOff(),l!==this.context.element.wysiwyg&&this.util.removeItemAllParents(l,(function(e){return 0===e.childNodes.length}),null),this.focusEdge(i),this.plugins.fileManager.deleteInfo.call(this,"audio",n,this.functions.onAudioUpload),this.history.push(!1)},checkFileInfo:function(){this.plugins.fileManager.checkInfo.call(this,"audio",["audio"],this.functions.onAudioUpload,this.plugins.audio.updateCover.bind(this),!1)},resetFileInfo:function(){this.plugins.fileManager.resetInfo.call(this,"audio",this.functions.onAudioUpload)},on:function(e){const t=this.context.audio;e?t._element?(this.context.dialog.updateModal=!0,t._linkValue=t.preview.textContent=t.audioUrlFile.value=t._element.src,t.audioInputFile&&this.context.options.audioMultipleFile&&t.audioInputFile.removeAttribute("multiple")):t.audioInputFile&&this.context.options.audioMultipleFile&&t.audioInputFile.removeAttribute("multiple"):(this.plugins.audio.init.call(this),t.audioInputFile&&this.context.options.audioMultipleFile&&t.audioInputFile.setAttribute("multiple","multiple"))},open:function(){this.plugins.dialog.open.call(this,"audio","audio"===this.currentControllerName)},submit:function(e){const t=this.context.audio;e.preventDefault(),e.stopPropagation();try{t.audioInputFile&&t.audioInputFile.files.length>0?(this.showLoading(),this.plugins.audio.submitAction.call(this,t.audioInputFile.files)):t.audioUrlFile&&t._linkValue.length>0&&(this.showLoading(),this.plugins.audio.setupUrl.call(this,t._linkValue))}catch(e){throw this.closeLoading(),Error('[SUNEDITOR.audio.submit.fail] cause : "'+e.message+'"')}finally{this.plugins.dialog.close.call(this)}return!1},submitAction:function(e){if(0===e.length)return;let t=0,n=[];for(let i=0,l=e.length;i0){let e=0;const n=this.context.audio._infoList;for(let t=0,i=n.length;ti){this.closeLoading();const n="[SUNEDITOR.audioUpload.fail] Size of uploadable total audios: "+i/1e3+"KB";return void(("function"!==this.functions.onAudioUploadError||this.functions.onAudioUploadError(n,{limitSize:i,currentSize:e,uploadSize:t},this))&&this.functions.noticeOpen(n))}}const l=this.context.audio;l._uploadFileLength=n.length;const o={isUpdate:this.context.dialog.updateModal,element:l._element};if("function"==typeof this.functions.onAudioUploadBefore){const e=this.functions.onAudioUploadBefore(n,o,this,function(e){e&&this._w.Array.isArray(e.result)?this.plugins.audio.register.call(this,o,e):this.plugins.audio.upload.call(this,o,e)}.bind(this));if(void 0===e)return;if(!e)return void this.closeLoading();"object"==typeof e&&e.length>0&&(n=e)}this.plugins.audio.upload.call(this,o,n)},error:function(e,t){if(this.closeLoading(),"function"!=typeof this.functions.onAudioUploadError||this.functions.onAudioUploadError(e,t,this))throw this.functions.noticeOpen(e),Error("[SUNEDITOR.plugin.audio.exception] response: "+e)},upload:function(e,t){if(!t)return void this.closeLoading();if("string"==typeof t)return void this.plugins.audio.error.call(this,t,null);const n=this.context.option.audioUploadUrl,i=this.context.dialog.updateModal?1:t.length,l=new FormData;for(let e=0;e'+this.icons.cancel+''+e.dialogBox.mathBox.title+'

    ",t},setController_MathButton:function(){const e=this.lang,t=this.util.createElement("DIV");return t.className="se-controller se-controller-link",t.innerHTML='
    ",t},open:function(){this.plugins.dialog.open.call(this,"math","math"===this.currentControllerName)},managedTags:function(){return{className:"katex",method:function(e){if(!e.getAttribute("data-exp"))return;const t=this._d.createRange().createContextualFragment(this.plugins.math._renderer.call(this,this.util.HTMLDecoder(e.getAttribute("data-exp"))));e.innerHTML=t.querySelector(".katex").innerHTML}}},_renderer:function(e){const t=this.context.option.katex;return t.src.renderToString(e,t.options)},_renderMathExp:function(e,t){e.previewElement.innerHTML=this.plugins.math._renderer.call(this,t.target.value)},submit:function(e){this.showLoading(),e.preventDefault(),e.stopPropagation();const t=function(){if(0===this.context.math.focusElement.value.trim().length)return!1;const e=this.context.math,t=e.focusElement.value,n=e.previewElement.querySelector(".katex");if(!n)return!1;if(n.className="__se__katex "+n.className,n.setAttribute("contenteditable",!1),n.setAttribute("data-exp",this.util.HTMLEncoder(t)),n.setAttribute("data-font-size",e.fontSizeElement.value),n.style.fontSize=e.fontSizeElement.value,this.context.dialog.updateModal){const t=this.util.getParentElement(e._mathExp,".katex");t.parentNode.replaceChild(n,t),this.setRange(n,0,n,1)}else{const e=this.getSelectedElements();if(e.length>1){const t=this.util.createElement(e[0].nodeName);if(t.appendChild(n),!this.insertNode(t,null,!0))return!1}else if(!this.insertNode(n,null,!0))return!1;const t=this.util.createTextNode(this.util.zeroWidthSpace);n.parentNode.insertBefore(t,n.nextSibling),this.setRange(n,0,n,1)}return e.focusElement.value="",e.fontSizeElement.value="1em",e.previewElement.style.fontSize="1em",e.previewElement.innerHTML="",!0}.bind(this);try{t()&&(this.plugins.dialog.close.call(this),this.history.push(!1))}catch(e){this.plugins.dialog.close.call(this)}finally{this.closeLoading()}return!1},active:function(e){if(e){if(e.getAttribute("data-exp"))return this.controllerArray.indexOf(this.context.math.mathController)<0&&(this.setRange(e,0,e,1),this.plugins.math.call_controller.call(this,e)),!0}else this.controllerArray.indexOf(this.context.math.mathController)>-1&&this.controllersOff();return!1},on:function(e){if(e){const e=this.context.math;if(e._mathExp){const t=this.util.HTMLDecoder(e._mathExp.getAttribute("data-exp")),n=e._mathExp.getAttribute("data-font-size")||"1em";this.context.dialog.updateModal=!0,e.focusElement.value=t,e.fontSizeElement.value=n,e.previewElement.innerHTML=this.plugins.math._renderer.call(this,t),e.previewElement.style.fontSize=n}}else this.plugins.math.init.call(this)},call_controller:function(e){this.context.math._mathExp=e;const t=this.context.math.mathController,n=this.util.getOffset(e,this.context.element.wysiwygFrame);t.style.top=n.top+e.offsetHeight+10+"px",t.style.left=n.left-this.context.element.wysiwygFrame.scrollLeft+"px",t.style.display="block";const i=this.context.element.wysiwygFrame.offsetWidth-(t.offsetLeft+t.offsetWidth);i<0?(t.style.left=t.offsetLeft+i+"px",t.firstElementChild.style.left=20-i+"px"):t.firstElementChild.style.left="20px",this.controllersOn(t,e,"math")},onClick_mathController:function(e){e.stopPropagation();const t=e.target.getAttribute("data-command")||e.target.parentNode.getAttribute("data-command");t&&(e.preventDefault(),/update/.test(t)?(this.context.math.focusElement.value=this.util.HTMLDecoder(this.context.math._mathExp.getAttribute("data-exp")),this.plugins.dialog.open.call(this,"math",!0)):(this.util.removeItem(this.context.math._mathExp),this.context.math._mathExp=null,this.focus(),this.history.push(!1)),this.controllersOff())},init:function(){const e=this.context.math;e.mathController.style.display="none",e._mathExp=null,e.focusElement.value="",e.previewElement.innerHTML=""}};var y={name:"mention",display:"dialog",renderItem:function(e){return`${e}`},getItems:function(e){return Promise.resolve(["overwite","the","mention","plugin","getItems","method"].filter(t=>t.includes(e.toLowerCase())))},renderList:function(e){const{mention:t}=this.context;let n=Promise.resolve();t.term!==e&&(t.focussed=0,t.term=e,n=t.getItems(e).then(e=>{t._items=e,Object.keys(t._itemElements).forEach(n=>{if(!e.find(e=>t.getId(e)===n)){const e=t._itemElements[n];e.parentNode.removeChild(e),delete t._itemElements[n]}}),e.forEach((e,n)=>{const i=t.getId(e);if(!t._itemElements[i]){const a=this.util.createElement("LI");a.setAttribute("data-mention",i),this.util.addClass(a,"se-mention-item"),a.innerHTML=t.renderItem(e),a.addEventListener("click",()=>{t.focussed=n,t._addMention()}),l=t._list,o=a,(s=n)||(s=0),s>=l.children.length?l.appendChild(o):l.insertBefore(o,l.children[s]),t._itemElements[i]=a}var l,o,s})})),n.then(()=>{const e=t._list.querySelectorAll(".se-mention-item")[t.focussed];if(e&&!this.util.hasClass(e,"se-mention-active")){const n=t._list.querySelector(".se-mention-active");n&&this.util.removeClass(n,"se-mention-active"),this.util.addClass(e,"se-mention-active")}})},setDialog:function(){const e=this.util.createElement("DIV"),t=this.lang;e.className="se-dialog-content",e.style.display="none";const n=`\n
    \n
    \n \n ${t.dialogBox.mentionBox.title}\n
    \n
    \n \n
      \n
    \n
    \n
    \n `;return e.innerHTML=n,e},getId:e=>e,getValue:e=>"@"+e,getLinkHref:()=>"",open:function(){const{mention:e}=this.context;this.plugins.dialog.open.call(this,"mention","mention"===this.currentControllerName),e._search.focus(),e.renderList("")},on:function(e){e||this.plugins.mention.init.call(this)},init:function(){const{mention:e}=this.context;e._search.value="",e.focussed=0,e._items=[],e._itemElements={},e._list.innerHTML="",delete e.term},onKeyPress:function(e){const{mention:t}=this.context;switch(e.key){case"ArrowDown":t.focussed+=1,e.preventDefault(),e.stopPropagation();break;case"ArrowUp":t.focussed>0&&(t.focussed-=1),e.preventDefault(),e.stopPropagation();break;case"Enter":t._addMention(),e.preventDefault(),e.stopPropagation()}},onKeyUp:function(e){const{mention:t}=this.context;t.renderList(e.target.value)},getMentions:function(){const{mentions:e,getId:t}=this.context.mention;return e.filter(e=>{const n=t(e);return this.context.element.wysiwyg.querySelector(`[data-mention="${n}"]`)})},_addMention:function(){const{mention:e}=this.context,t=e._items[e.focussed];if(t){e.mentions.find(n=>e.getId(n)===e.getId(t))||e.mentions.push(t);const n=this.util.createElement("A");n.href=e.getLinkHref(t),n.target="_blank",n.innerHTML=e.getValue(t),n.setAttribute("data-mention",e.getId(t)),this.insertNode(n,null,!1);const i=this.util.createElement("SPAN");i.innerHTML=" ",this.insertNode(i,n,!1)}this.plugins.dialog.close.call(this)},add:function(e){e.addModule([r.a]),this.title=e.lang.toolbar.mention;const t=this.setDialog.call(e);e.getMentions=this.getMentions.bind(e);const n=t.querySelector(".se-mention-search");n.addEventListener("keyup",this.onKeyUp.bind(e)),n.addEventListener("keydown",this.onKeyPress.bind(e));const i=t.querySelector(".se-mention-list");e.context.mention={_addMention:this._addMention.bind(e),_itemElements:{},_items:[],_list:i,_search:n,focussed:0,getId:this.getId.bind(e),getItems:this.getItems,getLinkHref:this.getLinkHref.bind(e),getValue:this.getValue.bind(e),mentions:[],modal:t,open:this.open.bind(e),renderItem:this.renderItem,renderList:this.renderList.bind(e)},e.context.dialog.modal.appendChild(t)},action:function(){}},C=n("JhlZ"),w=n.n(C),x={blockquote:{name:"blockquote",display:"command",add:function(e,t){e.context.blockquote={targetButton:t,tag:e.util.createElement("BLOCKQUOTE")}},active:function(e){if(e){if(/blockquote/i.test(e.nodeName))return this.util.addClass(this.context.blockquote.targetButton,"active"),!0}else this.util.removeClass(this.context.blockquote.targetButton,"active");return!1},action:function(){const e=this.util.getParentElement(this.getSelectionNode(),"blockquote");e?this.detachRangeFormatElement(e,null,null,!1,!1):this.applyRangeFormatElement(this.context.blockquote.tag.cloneNode(!1))}},align:{name:"align",display:"submenu",add:function(e,t){const n=e.icons,i=e.context;i.align={targetButton:t,_alignList:null,currentAlign:"",icons:{justify:n.align_justify,left:n.align_left,right:n.align_right,center:n.align_center}};let l=this.setSubmenu.call(e),o=l.querySelector("ul");o.addEventListener("click",this.pickup.bind(e)),i.align._alignList=o.querySelectorAll("li button"),e.initMenuTarget(this.name,t,l),l=null,o=null},setSubmenu:function(){const e=this.lang,t=this.icons,n=this.util.createElement("DIV");return n.className="se-submenu se-list-layer se-list-align",n.innerHTML='
    ",n},active:function(e){const t=this.context.align.targetButton,n=t.firstElementChild;if(e){if(this.util.isFormatElement(e)){const i=e.style.textAlign;if(i)return this.util.changeElement(n,this.context.align.icons[i]),t.setAttribute("data-focus",i),!0}}else this.util.changeElement(n,this.context.align.icons.left),t.removeAttribute("data-focus");return!1},on:function(){const e=this.context.align,t=e._alignList,n=e.targetButton.getAttribute("data-focus")||"left";if(n!==e.currentAlign){for(let e=0,i=t.length;e('+t.toolbar.default+")";for(o=0,s=a.length;o";return r+="",n.innerHTML=r,n},active:function(e){const t=this.context.font.targetText,n=this.context.font.targetTooltip;if(e){if(e.style&&e.style.fontFamily.length>0){const i=e.style.fontFamily.replace(/["']/g,"");return this.util.changeTxt(t,i),this.util.changeTxt(n,i),!0}}else{const e=this.lang.toolbar.font;this.util.changeTxt(t,e),this.util.changeTxt(n,e)}return!1},on:function(){const e=this.context.font,t=e._fontList,n=e.targetText.textContent;if(n!==e.currentFont){for(let e=0,i=t.length;e('+t.toolbar.default+")";for(let t,n=0,o=e.fontSizeUnit,s=i.length;n";return l+="",n.innerHTML=l,n},active:function(e){if(e){if(e.style&&e.style.fontSize.length>0)return this.util.changeTxt(this.context.fontSize.targetText,e.style.fontSize),!0}else this.util.changeTxt(this.context.fontSize.targetText,this.lang.toolbar.fontSize);return!1},on:function(){const e=this.context.fontSize,t=e._sizeList,n=e.targetText.textContent;if(n!==e.currentSize){for(let e=0,i=t.length;e
  • ',t},appendHr:function(e){const t=this.util.createElement("HR");return t.className=e,this.focus(),this.insertComponent(t,!1,!0,!1)},horizontalRulePick:function(e){e.preventDefault(),e.stopPropagation();let t=e.target,n=null;for(;!n&&!/UL/i.test(t.tagName);)n=t.getAttribute("data-value"),t=t.parentNode;if(!n)return;const i=this.plugins.horizontalRule.appendHr.call(this,"__se__"+n);i&&(this.setRange(i,0,i,0),this.submenuOff())}},list:{name:"list",display:"submenu",add:function(e,t){const n=e.context;n.list={targetButton:t,_list:null,currentList:"",icons:{bullets:e.icons.list_bullets,number:e.icons.list_number}};let i=this.setSubmenu.call(e),l=i.querySelector("ul");l.addEventListener("click",this.pickup.bind(e)),n.list._list=l.querySelectorAll("li button"),e.initMenuTarget(this.name,t,i),i=null,l=null},setSubmenu:function(){const e=this.lang,t=this.util.createElement("DIV");return t.className="se-submenu se-list-layer",t.innerHTML='
    ",t},active:function(e){const t=this.context.list.targetButton,n=t.firstElementChild,i=this.util;if(e){if(i.isList(e)){const l=e.nodeName;return t.setAttribute("data-focus",l),i.addClass(t,"active"),/UL/i.test(l)?i.changeElement(n,this.context.list.icons.bullets):i.changeElement(n,this.context.list.icons.number),!0}}else t.removeAttribute("data-focus"),i.changeElement(n,this.context.list.icons.number),i.removeClass(t,"active");return!1},on:function(){const e=this.context.list,t=e._list,n=e.targetButton.getAttribute("data-focus")||"";if(n!==e.currentList){for(let e=0,i=t.length;e"),t.innerHTML+=n.outerHTML,e&&(t.innerHTML+="
    ")}else{const e=n.childNodes;for(;e[0];)t.appendChild(e[0])}a.appendChild(t),r||(u=a),r&&m===g&&!o.isRangeFormatElement(f)||(d||(d=a),i&&r&&m===g||r&&o.isList(g)&&g===c||a.parentNode!==m&&m.insertBefore(a,f)),o.removeItem(n),i&&null===h&&(h=a.children.length-1),r&&(o.getRangeFormatElement(g,p)!==o.getRangeFormatElement(c,p)||o.isList(g)&&o.isList(c)&&o.getElementDepth(g)!==o.getElementDepth(c))&&(a=o.createElement(e)),_&&0===_.children.length&&o.removeItem(_)}else o.removeItem(n);h&&(d=d.children[h]),s&&(g=a.children.length-1,a.innerHTML+=c.innerHTML,u=a.children[g],o.removeItem(c))}else{if(n)for(let e=0,t=l.length;e=0;n--)if(l[n].contains(l[e])){l.splice(e,1),e--,t--;break}const t=o.getRangeFormatElement(s),i=t&&t.tagName===e;let a,r;const c=function(e){return!this.isComponent(e)}.bind(o);i||(r=o.createElement(e));for(let t,s,d=0,u=l.length;d0){const e=l.cloneNode(!1),t=l.childNodes,o=this.util.getPositionIndex(i);for(;t[o];)e.appendChild(t[o]);n.appendChild(e)}0===l.children.length&&this.util.removeItem(l),this.util.mergeSameTags(s);const a=this.util.getEdgeChildNodes(t,n);return{cc:t.parentNode,sc:a.sc,ec:a.ec}},editInsideList:function(e,t){const n=(t=t||this.getSelectedElements().filter(function(e){return this.isListCell(e)}.bind(this.util))).length;if(0===n||!e&&!this.util.isListCell(t[0].previousElementSibling)&&!this.util.isListCell(t[n-1].nextElementSibling))return{sc:t[0],so:0,ec:t[n-1],eo:1};let i=t[0].parentNode,l=t[n-1],o=null;if(e){if(i!==l.parentNode&&this.util.isList(l.parentNode.parentNode)&&l.nextElementSibling)for(l=l.nextElementSibling;l;)t.push(l),l=l.nextElementSibling;o=this.plugins.list.editList.call(this,i.nodeName.toUpperCase(),t,!0)}else{let e=this.util.createElement(i.nodeName),s=t[0].previousElementSibling,a=l.nextElementSibling;const r={s:null,e:null,sl:i,el:i};for(let l,o=0,c=n;o span > span"),n.table.columnFixedButton=o.querySelector("._se_table_fixed_column"),n.table.headerButton=o.querySelector("._se_table_header"),o.addEventListener("mousedown",e.eventStop);let s=this.setController_tableEditor.call(e,n.table.cellControllerTop);n.table.resizeDiv=s,n.table.splitMenu=s.querySelector(".se-btn-group-sub"),n.table.mergeButton=s.querySelector("._se_table_merge_button"),n.table.splitButton=s.querySelector("._se_table_split_button"),n.table.insertRowAboveButton=s.querySelector("._se_table_insert_row_a"),n.table.insertRowBelowButton=s.querySelector("._se_table_insert_row_b"),s.addEventListener("mousedown",e.eventStop),l.addEventListener("mousemove",this.onMouseMove_tablePicker.bind(e)),l.addEventListener("click",this.appendTable.bind(e)),s.addEventListener("click",this.onClick_tableController.bind(e)),o.addEventListener("click",this.onClick_tableController.bind(e)),e.initMenuTarget(this.name,t,i),n.element.relative.appendChild(s),n.element.relative.appendChild(o),i=null,l=null,s=null,o=null},setSubmenu:function(){const e=this.util.createElement("DIV");return e.className="se-submenu se-selector-table",e.innerHTML='
    1 x 1
    ',e},setController_table:function(){const e=this.lang,t=this.icons,n=this.util.createElement("DIV");return n.className="se-controller se-controller-table",n.innerHTML='
    ",n},setController_tableEditor:function(e){const t=this.lang,n=this.icons,i=this.util.createElement("DIV");return i.className="se-controller se-controller-table-cell",i.innerHTML=(e?"":'
    ')+'
    • '+t.controller.VerticalSplit+'
    • '+t.controller.HorizontalSplit+"
    ",i},appendTable:function(){const e=this.util.createElement("TABLE"),t=this.plugins.table.createCells,n=this.context.table._tableXY[0];let i=this.context.table._tableXY[1],l="";for(;i>0;)l+=""+t.call(this,"td",n)+"",--i;l+="",e.innerHTML=l;if(this.insertComponent(e,!1,!0,!1)){const t=e.querySelector("td div");this.setRange(t,0,t,0),this.plugins.table.reset_table_picker.call(this)}},createCells:function(e,t,n){if(e=e.toLowerCase(),n){const t=this.util.createElement(e);return t.innerHTML="

    ",t}{let n="";for(;t>0;)n+="<"+e+">

    ",t--;return n}},onMouseMove_tablePicker:function(e){e.stopPropagation();let t=this._w.Math.ceil(e.offsetX/18),n=this._w.Math.ceil(e.offsetY/18);t=t<1?1:t,n=n<1?1:n,this.context.table.tableHighlight.style.width=t+"em",this.context.table.tableHighlight.style.height=n+"em";this.context.table.tableUnHighlight.style.width="10em",this.context.table.tableUnHighlight.style.height="10em",this.util.changeTxt(this.context.table.tableDisplay,t+" x "+n),this.context.table._tableXY=[t,n]},reset_table_picker:function(){if(!this.context.table.tableHighlight)return;const e=this.context.table.tableHighlight.style,t=this.context.table.tableUnHighlight.style;e.width="1em",e.height="1em",t.width="10em",t.height="10em",this.util.changeTxt(this.context.table.tableDisplay,"1 x 1"),this.submenuOff()},init:function(){const e=this.context.table,t=this.plugins.table;if(t._removeEvents.call(this),t._selectedTable){const e=t._selectedTable.querySelectorAll(".se-table-selected-cell");for(let t=0,n=e.length;t0)for(let e,t=0;to||(u>=e.index?(i+=e.cs,u+=e.cs,e.rs-=1,e.row=o+1,e.rs<1&&(r.splice(t,1),t--)):h===g-1&&(e.rs-=1,e.row=o+1,e.rs<1&&(r.splice(t,1),t--)));if(o===s&&h===l){n._logical_cellIndex=u;break}d>0&&a.push({index:u,cs:c+1,rs:d,row:-1}),i+=c}r=r.concat(a).sort((function(e,t){return e.index-t.index})),a=[]}a=null,r=null}},editTable:function(e,t){const n=this.plugins.table,i=this.context.table,l=i._element,o="row"===e;if(o){const e=i._trElement.parentNode;if(/^THEAD$/i.test(e.nodeName)){if("up"===t)return;if(!e.nextElementSibling||!/^TBODY$/i.test(e.nextElementSibling.nodeName))return void(l.innerHTML+=""+n.createCells.call(this,"td",i._logical_cellCnt,!1)+"")}}if(n._ref){const e=i._tdElement,l=n._selectedCells;if(o)if(t)n.setCellInfo.call(this,"up"===t?l[0]:l[l.length-1],!0),n.editRow.call(this,t,e);else{let e=l[0].parentNode;const i=[l[0]];for(let t,n=1,o=l.length;ns&&s>t&&(e[l].rowSpan=n+a,c-=i)}if(i){const e=r[o+1];if(e){const t=[];let n=r[o].cells,i=0;for(let e,l,o=0,s=n.length;o1&&(e.rowSpan-=1,t.push({cell:e.cloneNode(!1),index:l}));if(t.length>0){let l=t.shift();n=e.cells,i=0;for(let o,s,a=0,r=n.length;a=l.index)||(a--,i--,i+=l.cell.colSpan-1,e.insertBefore(l.cell,o),l=t.shift(),l));a++);if(l){e.appendChild(l.cell);for(let n=0,i=t.length;n0){const e=!o[b+1];for(let t,n=0;n_||(p>=t.index?(f+=t.cs,p=b+f,t.rs-=1,t.row=_+1,t.rs<1&&(d.splice(n,1),n--)):e&&(t.rs-=1,t.row=_+1,t.rs<1&&(d.splice(n,1),n--)))}n>0&&c.push({rs:n,cs:r+1,index:p,row:-1}),p>=t&&p+r<=t+s?h.push(e):p<=t+s&&p+r>=t?e.colSpan-=i.getOverlapRangeAtIndex(a,a+s,p,p+r):n>0&&(pt+s)&&g.push({cell:e,i:_,rs:_+n}),f+=r}else{if(b>=t)break;if(r>0){if(u<1&&r+b>=t){e.colSpan+=1,t=null,u=n+1;break}t-=r}if(!m){for(let e,n=0;n0){u-=1;continue}null!==t&&o.length>0&&(p=this.plugins.table.createCells.call(this,o[0].nodeName,0,!0),p=e.insertBefore(p,o[t]))}}if(l){let e,t;for(let n,l=0,o=h.length;l1)c.colSpan=this._w.Math.floor(e/2),l.colSpan=e-c.colSpan,s.insertBefore(c,l.nextElementSibling);else{let t=[],n=[];for(let s,r,c=0,d=i._rowCnt;c0)for(let e,t=0;tc||(u>=e.index?(r+=e.cs,u+=e.cs,e.rs-=1,e.row=c+1,e.rs<1&&(n.splice(t,1),t--)):h===g-1&&(e.rs-=1,e.row=c+1,e.rs<1&&(n.splice(t,1),t--)));if(u<=a&&d>0&&t.push({index:u,cs:o+1,rs:d,row:-1}),i!==l&&u<=a&&u+o>=a+e-1){i.colSpan+=1;break}if(u>a)break;r+=o}n=n.concat(t).sort((function(e,t){return e.index-t.index})),t=[]}s.insertBefore(c,l.nextElementSibling)}}else{const e=l.rowSpan;if(c.colSpan=l.colSpan,e>1){c.rowSpan=this._w.Math.floor(e/2);const n=e-c.rowSpan,i=[],r=t.getArrayIndex(o,s)+n;for(let e,t,n=0;n=a));c++)l=e[c],o=l.rowSpan-1,o>0&&o+n>=r&&s=h.index&&(r+=h.cs,l+=h.cs,h=i.shift()),l>=a||o===s-1){d.insertBefore(c,e.nextElementSibling);break}r+=t}l.rowSpan=n}else{c.rowSpan=l.rowSpan;const e=t.createElement("TR");e.appendChild(c);for(let e,t=0;t=r&&(e[n].rowSpan+=1)}const n=i._physical_cellIndex,a=s.cells;for(let e=0,t=a.length;e0&&s+o>=i&&(e.rowSpan-=n.getOverlapRangeAtIndex(i,l,s,s+o));else o.push(e[s]);for(let e=0,t=o.length;e"+this.plugins.table.createCells.call(this,"th",this.context.table._logical_cellCnt,!1)+"",i.insertBefore(t,i.firstElementChild)}e.toggleClass(t,"active"),/TH/i.test(this.context.table._tdElement.nodeName)?this.controllersOff():this.plugins.table.setPositionControllerDiv.call(this,this.context.table._tdElement,!1)},setTableStyle:function(e){const t=this.context.table,n=t._element;let i,l,o,s;e.indexOf("width")>-1&&(i=t.resizeButton.firstElementChild,l=t.resizeText,t._maxWidth?(o=t.icons.reduction,s=t.minText,t.columnFixedButton.style.display="block",this.util.removeClass(n,"se-table-size-auto"),this.util.addClass(n,"se-table-size-100")):(o=t.icons.expansion,s=t.maxText,t.columnFixedButton.style.display="none",this.util.removeClass(n,"se-table-size-100"),this.util.addClass(n,"se-table-size-auto")),this.util.changeElement(i,o),this.util.changeTxt(l,s)),e.indexOf("column")>-1&&(t._fixedColumn?(this.util.removeClass(n,"se-table-layout-auto"),this.util.addClass(n,"se-table-layout-fixed"),this.util.addClass(t.columnFixedButton,"active")):(this.util.removeClass(n,"se-table-layout-fixed"),this.util.addClass(n,"se-table-layout-auto"),this.util.removeClass(t.columnFixedButton,"active")))},setActiveButton:function(e,t){const n=this.context.table;/^TH$/i.test(e.nodeName)?(n.insertRowAboveButton.setAttribute("disabled",!0),n.insertRowBelowButton.setAttribute("disabled",!0)):(n.insertRowAboveButton.removeAttribute("disabled"),n.insertRowBelowButton.removeAttribute("disabled")),t&&e!==t?(n.splitButton.setAttribute("disabled",!0),n.mergeButton.removeAttribute("disabled")):(n.splitButton.removeAttribute("disabled"),n.mergeButton.setAttribute("disabled",!0))},_bindOnSelect:null,_bindOffSelect:null,_bindOffShift:null,_selectedCells:null,_shift:!1,_fixedCell:null,_fixedCellName:null,_selectedCell:null,_selectedTable:null,_ref:null,_toggleEditor:function(e){this.context.element.wysiwyg.setAttribute("contenteditable",e),e?this.util.removeClass(this.context.element.wysiwyg,"se-disabled"):this.util.addClass(this.context.element.wysiwyg,"se-disabled")},_offCellMultiSelect:function(e){e.stopPropagation();const t=this.plugins.table;t._shift?t._initBind&&(this._wd.removeEventListener("touchmove",t._initBind),t._initBind=null):(t._removeEvents.call(this),t._toggleEditor.call(this,!0)),t._fixedCell&&t._selectedTable&&(t.setActiveButton.call(this,t._fixedCell,t._selectedCell),t.call_controller_tableEdit.call(this,t._selectedCell||t._fixedCell),t._selectedCells=t._selectedTable.querySelectorAll(".se-table-selected-cell"),t._selectedCell&&t._fixedCell&&this.focusEdge(t._selectedCell),t._shift||(t._fixedCell=null,t._selectedCell=null,t._fixedCellName=null))},_onCellMultiSelect:function(e){this._antiBlur=!0;const t=this.plugins.table,n=this.util.getParentElement(e.target,this.util.isCell);if(t._shift)n===t._fixedCell?t._toggleEditor.call(this,!0):t._toggleEditor.call(this,!1);else if(!t._ref){if(n===t._fixedCell)return;t._toggleEditor.call(this,!1)}n&&n!==t._selectedCell&&t._fixedCellName===n.nodeName&&t._selectedTable===this.util.getParentElement(n,"TABLE")&&(t._selectedCell=n,t._setMultiCells.call(this,t._fixedCell,n))},_setMultiCells:function(e,t){const n=this.plugins.table,i=n._selectedTable.rows,l=this.util,o=n._selectedTable.querySelectorAll(".se-table-selected-cell");for(let e=0,t=o.length;e0)for(let e,t=0;td||(u>=e.index?(o+=e.cs,u+=e.cs,e.rs-=1,e.row=d+1,e.rs<1&&(a.splice(t,1),t--)):p===m-1&&(e.rs-=1,e.row=d+1,e.rs<1&&(a.splice(t,1),t--)));if(s){if(i!==e&&i!==t||(c.cs=null!==c.cs&&c.csu+h?c.ce:u+h,c.rs=null!==c.rs&&c.rsd+g?c.re:d+g,c._i+=1),2===c._i){s=!1,a=[],r=[],d=-1;break}}else if(l.getOverlapRangeAtIndex(c.cs,c.ce,u,u+h)&&l.getOverlapRangeAtIndex(c.rs,c.re,d,d+g)){const e=c.csu+h?c.ce:u+h,n=c.rsd+g?c.re:d+g;if(c.cs!==e||c.ce!==t||c.rs!==n||c.re!==o){c.cs=e,c.ce=t,c.rs=n,c.re=o,d=-1,a=[],r=[];break}l.addClass(i,"se-table-selected-cell")}g>0&&r.push({index:u,cs:h+1,rs:g,row:-1}),o+=i.colSpan-1}a=a.concat(r).sort((function(e,t){return e.index-t.index})),r=[]}},_removeEvents:function(){const e=this.plugins.table;e._initBind&&(this._wd.removeEventListener("touchmove",e._initBind),e._initBind=null),e._bindOnSelect&&(this._wd.removeEventListener("mousedown",e._bindOnSelect),this._wd.removeEventListener("mousemove",e._bindOnSelect),e._bindOnSelect=null),e._bindOffSelect&&(this._wd.removeEventListener("mouseup",e._bindOffSelect),e._bindOffSelect=null),e._bindOffShift&&(this._wd.removeEventListener("keyup",e._bindOffShift),e._bindOffShift=null)},_initBind:null,onTableCellMultiSelect:function(e,t){const n=this.plugins.table;n._removeEvents.call(this),this.controllersOff(),n._shift=t,n._fixedCell=e,n._fixedCellName=e.nodeName,n._selectedTable=this.util.getParentElement(e,"TABLE");const i=n._selectedTable.querySelectorAll(".se-table-selected-cell");for(let e=0,t=i.length;e-1?(n=e.toLowerCase(),s="blockquote"===n?"range":"pre"===n?"free":"replace",r=/^h/.test(n)?n.match(/\d+/)[0]:"",a=t["tag_"+(r?"h":n)]+r,d="",c=""):(n=e.tag.toLowerCase(),s=e.command,a=e.name||n,d=e.class,c=d?' class="'+d+'"':""),o+='
  • ";return o+="",n.innerHTML=o,n},active:function(e){let t=this.lang.toolbar.formats;const n=this.context.formatBlock.targetText,i=this.context.formatBlock.targetTooltip;if(e){if(this.util.isFormatElement(e)){const l=this.context.formatBlock._formatList,o=e.nodeName.toLowerCase(),s=(e.className.match(/(\s|^)__se__format__[^\s]+/)||[""])[0].trim();for(let e,n=0,i=l.length;n=0;u--)if(i=p[u],i!==(p[u+1]?p[u+1].parentNode:null)){if(d=r.isComponent(i),o=d?"":i.innerHTML.replace(/(?!>)\s+(?=<)|\n/g," "),s=r.getParentElement(i,(function(e){return e.parentNode===t})),(t!==i.parentNode||d)&&(r.isFormatElement(t)?(t.parentNode.insertBefore(n,t.nextSibling),t=t.parentNode):(t.insertBefore(n,s?s.nextSibling:null),t=i.parentNode),a=n.nextSibling,a&&n.nodeName===a.nodeName&&r.isSameAttributes(n,a)&&(n.innerHTML+="
    "+a.innerHTML,r.removeItem(a)),n=l.cloneNode(!1),h=!0),c=n.innerHTML,n.innerHTML=(h||!o||!c||/
    $/i.test(o)?o:o+"
    ")+c,0===u){t.insertBefore(n,i),a=i.nextSibling,a&&n.nodeName===a.nodeName&&r.isSameAttributes(n,a)&&(n.innerHTML+="
    "+a.innerHTML,r.removeItem(a));const e=n.previousSibling;e&&n.nodeName===e.nodeName&&r.isSameAttributes(n,e)&&(e.innerHTML+="
    "+n.innerHTML,r.removeItem(n))}d||r.removeItem(i),o&&(h=!1)}this.setRange(i,0,i,0)}else{for(let e,t,n=0,s=p.length;n('+t.toolbar.default+")";for(let e,t=0,n=i.length;t";return l+="",n.innerHTML=l,n},on:function(){const e=this.context.lineHeight,t=e._sizeList,n=this.util.getFormatElement(this.getSelectionNode()),i=n?n.style.lineHeight+"":"";if(i!==e.currentSize){for(let e=0,n=t.length;e"}return o+="",t.innerHTML=o,t},on:function(){const e=this.context.paragraphStyle._classList,t=this.util.getFormatElement(this.getSelectionNode());for(let n=0,i=e.length;n"}return l+="",t.innerHTML=l,t},on:function(){const e=this.util,t=this.context.textStyle._styleList,n=this.getSelectionNode();for(let i,l,o,s=0,a=t.length;s'+(e.alt||t)+'
    '+(e.name||t)+"
    "},setImage:function(e){this.callPlugin("image",function(){const t={name:e.parentNode.querySelector(".__se__img_name").textContent,size:0};this.context.image._altText=e.alt,this.plugins.image.create_image.call(this,e.src,"",!1,this.context.image._origin_w,this.context.image._origin_h,"none",t)}.bind(this),null)}},mention:y},E={redo:'',undo:'',bold:'',underline:'',italic:'',strike:'',subscript:'',superscript:'',erase:'',indent:'',outdent:'',expansion:'',reduction:'',code_view:'',preview:'',print:'',template:'',line_height:'',paragraph_style:'',text_style:'',save:'',blockquote:'',arrow_down:'',align_justify:'',align_left:'',align_right:'',align_center:'',font_color:'',highlight_color:'',list_bullets:'',list_number:'',table:'',horizontal_rule:'',show_blocks:'',cancel:'',image:'',video:'',link:'',math:'',unlink:'',table_header:'',merge_cell:'',split_cell:'',caption:'',edit:'',delete:'',modify:'',revert:'',auto_size:'',insert_row_below:'',insert_row_above:'',insert_column_left:'',insert_column_right:'',delete_row:'',delete_column:'',fixed_column_width:'',rotate_left:'',rotate_right:'',mirror_horizontal:'',mirror_vertical:'',checked:'',line_break:'',audio:'',image_gallery:'',more_text:'',more_paragraph:'',more_plus:'',more_horizontal:'',more_vertical:'',attachment:'',map:'',magic_stick:'',empty_file:'',mention:''},S=n("P6u4"),N=n.n(S);const T={_d:null,_w:null,isIE:null,isIE_Edge:null,isOSX_IOS:null,_propertiesInit:function(){this._d||(this._d=document,this._w=window,this.isIE=navigator.userAgent.indexOf("Trident")>-1,this.isIE_Edge=navigator.userAgent.indexOf("Trident")>-1||navigator.appVersion.indexOf("Edge")>-1,this.isOSX_IOS=/(Mac|iPhone|iPod|iPad)/.test(navigator.platform))},_HTMLConvertor:function(e){const t={"&":"&"," ":" ","'":"'",'"':""","<":"<",">":">"};return e.replace(/&|\u00A0|'|"|<|>/g,(function(e){return"string"==typeof t[e]?t[e]:e}))},zeroWidthSpace:String.fromCharCode(8203),zeroWidthRegExp:new RegExp(String.fromCharCode(8203),"g"),onlyZeroWidthRegExp:new RegExp("^"+String.fromCharCode(8203)+"+$"),onlyZeroWidthSpace:function(e){return"string"!=typeof e&&(e=e.textContent),""===e||this.onlyZeroWidthRegExp.test(e)},getXMLHttpRequest:function(){if(!this._w.ActiveXObject)return this._w.XMLHttpRequest?new XMLHttpRequest:null;try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(e){try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(e){return null}}},createElement:function(e){return this._d.createElement(e)},createTextNode:function(e){return this._d.createTextNode(e||"")},HTMLEncoder:function(e){const t={"<":"$lt;",">":"$gt;"};return e.replace(/<|>/g,(function(e){return"string"==typeof t[e]?t[e]:e}))},HTMLDecoder:function(e){const t={"$lt;":"<","$gt;":">"};return e.replace(/\$lt;|\$gt;/g,(function(e){return"string"==typeof t[e]?t[e]:e}))},hasOwn:function(e,t){return this._hasOwn.call(e,t)},_hasOwn:Object.prototype.hasOwnProperty,getIncludePath:function(e,t){let n="";const i=[],l="js"===t?"script":"link",o="js"===t?"src":"href";let s="(?:";for(let t=0,n=e.length;t0?i[0][o]:""),-1===n.indexOf(":/")&&"//"!==n.slice(0,2)&&(n=0===n.indexOf("/")?location.href.match(/^.*?:\/\/[^\/]*/)[0]+n:location.href.match(/^[^\?]*\/(?:)/)[0]+n),!n)throw"[SUNEDITOR.util.getIncludePath.fail] The SUNEDITOR installation path could not be automatically detected. (name: +"+name+", extension: "+t+")";return n},getPageStyle:function(e){let t="";const n=(e||this._d).styleSheets;for(let e,i=0,l=n.length;i-1||(i+=n[e].name+'="'+n[e].value+'" ');return i},getByteLength:function(e){const t=this._w.encodeURIComponent;let n,i;return this.isIE_Edge?(i=this._w.unescape(t(e.toString())).length,n=0,null!==t(e.toString()).match(/(%0A|%0D)/gi)&&(n=t(e.toString()).match(/(%0A|%0D)/gi).length),i+n):(i=new this._w.TextEncoder("utf-8").encode(e.toString()).length,n=0,null!==t(e.toString()).match(/(%0A|%0D)/gi)&&(n=t(e.toString()).match(/(%0A|%0D)/gi).length),i+n)},isWysiwygDiv:function(e){return e&&1===e.nodeType&&(this.hasClass(e,"se-wrapper-wysiwyg")||/^BODY$/i.test(e.nodeName))},isNonEditable:function(e){return e&&1===e.nodeType&&"false"===e.getAttribute("contenteditable")},isTextStyleElement:function(e){return e&&3!==e.nodeType&&/^(strong|span|font|b|var|i|em|u|ins|s|strike|del|sub|sup|mark|a|label|code)$/i.test(e.nodeName)},isFormatElement:function(e){return e&&1===e.nodeType&&(/^(P|DIV|H[1-6]|PRE|LI|TH|TD)$/i.test(e.nodeName)||this.hasClass(e,"(\\s|^)__se__format__replace_.+(\\s|$)|(\\s|^)__se__format__free_.+(\\s|$)"))&&!this.isComponent(e)&&!this.isWysiwygDiv(e)},isRangeFormatElement:function(e){return e&&1===e.nodeType&&(/^(BLOCKQUOTE|OL|UL|FIGCAPTION|TABLE|THEAD|TBODY|TR|TH|TD)$/i.test(e.nodeName)||this.hasClass(e,"(\\s|^)__se__format__range_.+(\\s|$)"))},isClosureRangeFormatElement:function(e){return e&&1===e.nodeType&&(/^(TH|TD)$/i.test(e.nodeName)||this.hasClass(e,"(\\s|^)__se__format__range__closure_.+(\\s|$)"))},isFreeFormatElement:function(e){return e&&1===e.nodeType&&(/^PRE$/i.test(e.nodeName)||this.hasClass(e,"(\\s|^)__se__format__free_.+(\\s|$)"))&&!this.isComponent(e)&&!this.isWysiwygDiv(e)},isClosureFreeFormatElement:function(e){return e&&1===e.nodeType&&this.hasClass(e,"(\\s|^)__se__format__free__closure_.+(\\s|$)")},isComponent:function(e){return e&&(/se-component/.test(e.className)||/^(TABLE|HR)$/.test(e.nodeName))},isMediaComponent:function(e){return e&&/se-component/.test(e.className)},isNotCheckingNode:function(e){return e&&/katex|__se__tag/.test(e.className)},getFormatElement:function(e,t){if(!e)return null;for(t||(t=function(){return!0});e;){if(this.isWysiwygDiv(e))return null;if(this.isRangeFormatElement(e)&&e.firstElementChild,this.isFormatElement(e)&&t(e))return e;e=e.parentNode}return null},getRangeFormatElement:function(e,t){if(!e)return null;for(t||(t=function(){return!0});e;){if(this.isWysiwygDiv(e))return null;if(this.isRangeFormatElement(e)&&!/^(THEAD|TBODY|TR)$/i.test(e.nodeName)&&t(e))return e;e=e.parentNode}return null},getFreeFormatElement:function(e,t){if(!e)return null;for(t||(t=function(){return!0});e;){if(this.isWysiwygDiv(e))return null;if(this.isFreeFormatElement(e)&&t(e))return e;e=e.parentNode}return null},getClosureFreeFormatElement:function(e,t){if(!e)return null;for(t||(t=function(){return!0});e;){if(this.isWysiwygDiv(e))return null;if(this.isClosureFreeFormatElement(e)&&t(e))return e;e=e.parentNode}return null},copyTagAttributes:function(e,t){t.style.cssText&&(e.style.cssText+=t.style.cssText);const n=t.classList;for(let t=0,i=n.length;ts?1:o0&&!this.isBreak(e);)e=e.firstChild;for(;t&&1===t.nodeType&&t.childNodes.length>0&&!this.isBreak(t);)t=t.lastChild;return{sc:e,ec:t||e}}},getOffset:function(e,t){let n=0,i=0,l=3===e.nodeType?e.parentElement:e;const o=this.getParentElement(e,this.isWysiwygDiv.bind(this));for(;l&&!this.hasClass(l,"se-container")&&l!==o;)n+=l.offsetLeft,i+=l.offsetTop,l=l.offsetParent;const s=t&&/iframe/i.test(t.nodeName);return{left:n+(s?t.parentElement.offsetLeft:0),top:i-o.scrollTop+(s?t.parentElement.offsetTop:0)}},getOverlapRangeAtIndex:function(e,t,n,i){if(e<=i?tn)return 0;const l=(e>n?e:n)-(t0?" ":"")+t)},removeClass:function(e,t){if(!e)return;const n=new this._w.RegExp("(\\s|^)"+t+"(\\s|$)");e.className=e.className.replace(n," ").trim(),e.className.trim()||e.removeAttribute("class")},toggleClass:function(e,t){if(!e)return;const n=new this._w.RegExp("(\\s|^)"+t+"(\\s|$)");n.test(e.className)?e.className=e.className.replace(n," ").trim():e.className+=" "+t,e.className.trim()||e.removeAttribute("class")},setDisabledButtons:function(e,t){for(let n=0,i=t.length;n=0){e.splitText(t);const n=this.getNodeFromPath([a+1],i);this.onlyZeroWidthSpace(n)&&(n.data=this.zeroWidthSpace)}}else 1===e.nodeType&&(e.previousSibling?e=e.previousSibling:this.getElementDepth(e)===n&&(r=!1));let c=e;for(;this.getElementDepth(c)>n;)for(a=this.getPositionIndex(c)+1,c=c.parentNode,s=l,l=c.cloneNode(!1),o=c.childNodes,s&&(this.isListCell(l)&&this.isList(s)&&s.firstElementChild?(l.innerHTML=s.firstElementChild.innerHTML,T.removeItem(s.firstElementChild),s.children.length>0&&l.appendChild(s)):l.appendChild(s));o[a];)l.appendChild(o[a]);c.childNodes.length<=1&&(!c.firstChild||0===c.firstChild.textContent.length)&&(c.innerHTML="
    ");const d=c.parentNode;return r&&(c=c.nextSibling),l?(this.mergeSameTags(l,null,!1),this.mergeNestedTags(l,function(e){return this.isList(e)}.bind(this)),l.childNodes.length>0?d.insertBefore(l,c):l=c,0===i.childNodes.length&&this.removeItem(i),l):c},mergeSameTags:function(e,t,n){const i=this,l=t?t.length:0;let o=null;return l&&(o=this._w.Array.apply(null,new this._w.Array(l)).map(this._w.Number.prototype.valueOf,0)),function e(s,a,r){const c=s.childNodes;for(let d,u,h=0,g=c.length;h=0;){if(i.getArrayIndex(o.childNodes,n)!==e[r]){c=!1;break}n=d.parentNode,o=n.parentNode,r--}c&&(e.splice(a,1),e[a]=h)}}i.copyTagAttributes(d,s),s.parentNode.insertBefore(d,s),i.removeItem(s)}if(!u){1===d.nodeType&&e(d,a+1,h);break}if(d.nodeName===u.nodeName&&i.isSameAttributes(d,u)&&d.href===u.href){const e=d.childNodes;let n=0;for(let t=0,i=e.length;t0&&n++;const s=d.lastChild,c=u.firstChild;let g=0;if(s&&c){const e=3===s.nodeType&&3===c.nodeType;g=s.textContent.length;let i=s.previousSibling;for(;i&&3===i.nodeType;)g+=i.textContent.length,i=i.previousSibling;if(n>0&&3===s.nodeType&&3===c.nodeType&&(s.textContent.length>0||c.textContent.length>0)&&n--,l){let i=null;for(let d=0;dh){if(a>0&&i[a-1]!==r)continue;i[a]-=1,i[a+1]>=0&&i[a]===h&&(i[a+1]+=n,e&&s&&3===s.nodeType&&c&&3===c.nodeType&&(o[d]+=g))}}}if(3===d.nodeType){if(g=d.textContent.length,d.textContent+=u.textContent,l){let e=null;for(let i=0;ih){if(a>0&&e[a-1]!==r)continue;e[a]-=1,e[a+1]>=0&&e[a]===h&&(e[a+1]+=n,o[i]+=g)}}}else d.innerHTML+=u.innerHTML;i.removeItem(u),h--}else 1===d.nodeType&&e(d,a+1,h)}}(e,0,0),o},mergeNestedTags:function(e,t){"string"==typeof t?t=function(e){return this.test(e.tagName)}.bind(new this._w.RegExp("^("+(t||".+")+")$","i")):"function"!=typeof t&&(t=function(){return!0}),function e(n){let i=n.children;if(1===i.length&&i[0].nodeName===n.nodeName&&t(n)){const e=i[0];for(i=e.children;i[0];)n.appendChild(i[0]);n.removeChild(e)}for(let t=0,i=n.children.length;t")},htmlRemoveWhiteSpace:function(e){return e?e.trim().replace(/<\/?(?!strong|span|font|b|var|i|em|u|ins|s|strike|del|sub|sup|mark|a|label|code)[^>^<]+>\s+(?=<)/gi,(function(e){return e.trim()})):""},sortByDepth:function(e,t){const n=t?1:-1,i=-1*n;e.sort(function(e,t){return this.isListCell(e)&&this.isListCell(t)?(e=this.getElementDepth(e))>(t=this.getElementDepth(t))?n:e":e.innerHTML,e.innerHTML=t.outerHTML},_setDefaultOptionStyle:function(e,t){let n="";e.height&&(n+="height:"+e.height+";"),e.minHeight&&(n+="min-height:"+e.minHeight+";"),e.maxHeight&&(n+="max-height:"+e.maxHeight+";"),e.position&&(n+="position:"+e.position+";"),e.width&&(n+="width:"+e.width+";"),e.minWidth&&(n+="min-width:"+e.minWidth+";"),e.maxWidth&&(n+="max-width:"+e.maxWidth+";");let i="",l="",o="";const s=(t=n+t).split(";");for(let t,n=0,a=s.length;n'+this._setIframeCssTags(t),e.contentDocument.body.className="sun-editor-editable",e.contentDocument.body.setAttribute("contenteditable",!0)},_setIframeCssTags:function(e){const t=e.iframeCSSFileName,n=this._w.RegExp;let i="";for(let e,l=0,o=t.length;l'}return i+("auto"===e.height?"":"")}};var L=T,k={init:function(e,t){"object"!=typeof t&&(t={});const n=document;this._initOptions(e,t);const i=n.createElement("DIV");i.className="sun-editor",e.id&&(i.id="suneditor_"+e.id);const l=n.createElement("DIV");l.className="se-container";const o=this._createToolBar(n,t.buttonList,t.plugins,t);o.element.style.visibility="hidden",o.pluginCallButtons.math&&this._checkKatexMath(t.katex);const s=n.createElement("DIV");s.className="se-arrow";const a=n.createElement("DIV");a.className="se-toolbar-sticky-dummy";const r=n.createElement("DIV");r.className="se-wrapper";const c=this._initElements(t,i,o.element,s),d=c.bottomBar,u=c.wysiwygFrame,h=c.placeholder;let g=c.codeView;const p=d.resizingBar,m=d.navigation,f=d.charWrapper,_=d.charCounter,b=n.createElement("DIV");b.className="se-loading-box sun-editor-common",b.innerHTML='
    ';const v=n.createElement("DIV");v.className="se-line-breaker",v.innerHTML='";const y=n.createElement("DIV");y.className+="se-line-breaker-component";const C=y.cloneNode(!0);y.innerHTML=C.innerHTML=t.icons.line_break;const w=n.createElement("DIV");w.className="se-resizing-back";const x=t.toolbarContainer;return x&&x.appendChild(o.element),r.appendChild(g),h&&r.appendChild(h),x||l.appendChild(o.element),l.appendChild(a),l.appendChild(r),l.appendChild(w),l.appendChild(b),l.appendChild(v),l.appendChild(y),l.appendChild(C),p&&l.appendChild(p),i.appendChild(l),g=this._checkCodeMirror(t,g),{constructed:{_top:i,_relative:l,_toolBar:o.element,_menuTray:o._menuTray,_editorArea:r,_wysiwygArea:u,_codeArea:g,_placeholder:h,_resizingBar:p,_navigation:m,_charWrapper:f,_charCounter:_,_loading:b,_lineBreaker:v,_lineBreaker_t:y,_lineBreaker_b:C,_resizeBack:w,_stickyDummy:a,_arrow:s},options:t,plugins:o.plugins,pluginCallButtons:o.pluginCallButtons,_responsiveButtons:o.responsiveButtons}},_checkCodeMirror:function(e,t){if(e.codeMirror){const n=[{mode:"htmlmixed",htmlMode:!0,lineNumbers:!0,lineWrapping:!0},e.codeMirror.options||{}].reduce((function(e,t){for(let n in t)L.hasOwn(t,n)&&(e[n]=t[n]);return e}),{});"auto"===e.height&&(n.viewportMargin=1/0,n.height="auto");const i=e.codeMirror.src.fromTextArea(t,n);i.display.wrapper.style.cssText=t.style.cssText,e.codeMirrorEditor=i,(t=i.display.wrapper).className+=" se-wrapper-code-mirror"}return t},_checkKatexMath:function(e){if(!e)throw Error('[SUNEDITOR.create.fail] To use the math button you need to add a "katex" object to the options.');const t=[{throwOnError:!1},e.options||{}].reduce((function(e,t){for(let n in t)L.hasOwn(t,n)&&(e[n]=t[n]);return e}),{});e.options=t},_setOptions:function(e,t,n,i){this._initOptions(t.element.originElement,e);const l=t.element,o=l.relative,s=l.editorArea,a=e.toolbarContainer&&e.toolbarContainer!==i.toolbarContainer,r=!!e.buttonList||e.mode!==i.mode||a,c=!!e.plugins,d=this._createToolBar(document,r?e.buttonList:i.buttonList,c?e.plugins:n,e);d.pluginCallButtons.math&&this._checkKatexMath(e.katex);const u=document.createElement("DIV");u.className="se-arrow",r&&(d.element.style.visibility="hidden",a?(e.toolbarContainer.appendChild(d.element),l.toolbar.parentElement.removeChild(l.toolbar)):l.toolbar.parentElement.replaceChild(d.element,l.toolbar),l.toolbar=d.element,l._menuTray=d._menuTray,l._arrow=u);const h=this._initElements(e,l.topArea,r?d.element:l.toolbar,u),g=h.bottomBar,p=h.wysiwygFrame,m=h.placeholder;let f=h.codeView;return l.resizingBar&&o.removeChild(l.resizingBar),g.resizingBar&&o.appendChild(g.resizingBar),s.innerHTML="",s.appendChild(f),m&&s.appendChild(m),f=this._checkCodeMirror(e,f),l.resizingBar=g.resizingBar,l.navigation=g.navigation,l.charWrapper=g.charWrapper,l.charCounter=g.charCounter,l.wysiwygFrame=p,l.code=f,l.placeholder=m,{callButtons:r?d.pluginCallButtons:null,plugins:r||c?d.plugins:null,toolbar:d}},_initElements:function(e,t,n,i){t.style.cssText=e._editorStyles.top,/inline/i.test(e.mode)?(n.className+=" se-toolbar-inline",n.style.width=e.toolbarWidth):/balloon/i.test(e.mode)&&(n.className+=" se-toolbar-balloon",n.style.width=e.toolbarWidth,n.appendChild(i));const l=document.createElement(e.iframe?"IFRAME":"DIV");l.className="se-wrapper-inner se-wrapper-wysiwyg",e.iframe?(l.allowFullscreen=!0,l.frameBorder=0,l.style.cssText=e._editorStyles.frame):(l.setAttribute("contenteditable",!0),l.setAttribute("scrolling","auto"),l.className+=" sun-editor-editable",l.style.cssText=e._editorStyles.frame+e._editorStyles.editor);const o=document.createElement("TEXTAREA");o.className="se-wrapper-inner se-wrapper-code",o.style.cssText=e._editorStyles.frame,o.style.display="none","auto"===e.height&&(o.style.overflow="hidden");let s=null,a=null,r=null,c=null;if(e.resizingBar&&(s=document.createElement("DIV"),s.className="se-resizing-bar sun-editor-common",a=document.createElement("DIV"),a.className="se-navigation sun-editor-common",s.appendChild(a),e.charCounter)){if(r=document.createElement("DIV"),r.className="se-char-counter-wrapper",e.charCounterLabel){const t=document.createElement("SPAN");t.className="se-char-label",t.textContent=e.charCounterLabel,r.appendChild(t)}if(c=document.createElement("SPAN"),c.className="se-char-counter",c.textContent="0",r.appendChild(c),e.maxCharCount>0){const t=document.createElement("SPAN");t.textContent=" / "+e.maxCharCount,r.appendChild(t)}s.appendChild(r)}let d=null;return e.placeholder&&(d=document.createElement("SPAN"),d.className="se-placeholder",d.innerText=e.placeholder),{bottomBar:{resizingBar:s,navigation:a,charWrapper:r,charCounter:c},wysiwygFrame:l,codeView:o,placeholder:d}},_initOptions:function(e,t){t.lang=t.lang||N.a,t.value="string"==typeof t.value?t.value:null,t.historyStackDelayTime="number"==typeof t.historyStackDelayTime?t.historyStackDelayTime:400,t._defaultTagsWhitelist="string"==typeof t._defaultTagsWhitelist?t._defaultTagsWhitelist:"br|p|div|pre|blockquote|h[1-6]|ol|ul|li|hr|figure|figcaption|img|iframe|audio|video|source|table|thead|tbody|tr|th|td|a|b|strong|var|i|em|u|ins|s|span|strike|del|sub|sup|code",t._editorTagsWhitelist=t._defaultTagsWhitelist+("string"==typeof t.addTagsWhitelist&&t.addTagsWhitelist.length>0?"|"+t.addTagsWhitelist:""),t.pasteTagsWhitelist="string"==typeof t.pasteTagsWhitelist?t.pasteTagsWhitelist:t._editorTagsWhitelist,t.attributesWhitelist=t.attributesWhitelist&&"object"==typeof t.attributesWhitelist?t.attributesWhitelist:null,t.mode=t.mode||"classic",t.toolbarWidth=t.toolbarWidth?L.isNumber(t.toolbarWidth)?t.toolbarWidth+"px":t.toolbarWidth:"auto",t.toolbarContainer=/balloon/i.test(t.mode)?null:"string"==typeof t.toolbarContainer?document.querySelector(t.toolbarContainer):t.toolbarContainer,t.stickyToolbar=/balloon/i.test(t.mode)||t.toolbarContainer?-1:void 0===t.stickyToolbar?0:/^\d+/.test(t.stickyToolbar)?L.getNumber(t.stickyToolbar,0):-1,t.fullPage=!!t.fullPage,t.iframe=t.fullPage||t.iframe,t.iframeCSSFileName=t.iframe?"string"==typeof t.iframeCSSFileName?[t.iframeCSSFileName]:t.iframeCSSFileName||["suneditor"]:null,t.codeMirror=t.codeMirror?t.codeMirror.src?t.codeMirror:{src:t.codeMirror}:null,t.position="string"==typeof t.position?t.position:null,t.display=t.display||("none"!==e.style.display&&e.style.display?e.style.display:"block"),t.popupDisplay=t.popupDisplay||"full",t.resizingBar=void 0===t.resizingBar?!/inline|balloon/i.test(t.mode):t.resizingBar,t.showPathLabel=!!t.resizingBar&&("boolean"!=typeof t.showPathLabel||t.showPathLabel),t.charCounter=t.maxCharCount>0||"boolean"==typeof t.charCounter&&t.charCounter,t.charCounterType="string"==typeof t.charCounterType?t.charCounterType:"char",t.charCounterLabel="string"==typeof t.charCounterLabel?t.charCounterLabel.trim():null,t.maxCharCount=L.isNumber(t.maxCharCount)&&t.maxCharCount>-1?1*t.maxCharCount:null,t.width=t.width?L.isNumber(t.width)?t.width+"px":t.width:e.clientWidth?e.clientWidth+"px":"100%",t.minWidth=(L.isNumber(t.minWidth)?t.minWidth+"px":t.minWidth)||"",t.maxWidth=(L.isNumber(t.maxWidth)?t.maxWidth+"px":t.maxWidth)||"",t.height=t.height?L.isNumber(t.height)?t.height+"px":t.height:e.clientHeight?e.clientHeight+"px":"auto",t.minHeight=(L.isNumber(t.minHeight)?t.minHeight+"px":t.minHeight)||"",t.maxHeight=(L.isNumber(t.maxHeight)?t.maxHeight+"px":t.maxHeight)||"",t.defaultStyle="string"==typeof t.defaultStyle?t.defaultStyle:"",t.font=t.font?t.font:null,t.fontSize=t.fontSize?t.fontSize:null,t.formats=t.formats?t.formats:null,t.colorList=t.colorList?t.colorList:null,t.lineHeights=t.lineHeights?t.lineHeights:null,t.paragraphStyles=t.paragraphStyles?t.paragraphStyles:null,t.textStyles=t.textStyles?t.textStyles:null,t.fontSizeUnit="string"==typeof t.fontSizeUnit&&t.fontSizeUnit.trim()||"px",t.imageResizing=void 0===t.imageResizing||t.imageResizing,t.imageHeightShow=void 0===t.imageHeightShow||!!t.imageHeightShow,t.imageWidth=t.imageWidth?L.isNumber(t.imageWidth)?t.imageWidth+"px":t.imageWidth:"auto",t.imageHeight=t.imageHeight?L.isNumber(t.imageHeight)?t.imageHeight+"px":t.imageHeight:"auto",t.imageSizeOnlyPercentage=!!t.imageSizeOnlyPercentage,t._imageSizeUnit=t.imageSizeOnlyPercentage?"%":"px",t.imageRotation=void 0!==t.imageRotation?t.imageRotation:!(t.imageSizeOnlyPercentage||!t.imageHeightShow),t.imageFileInput=void 0===t.imageFileInput||t.imageFileInput,t.imageUrlInput=void 0===t.imageUrlInput||!t.imageFileInput||t.imageUrlInput,t.imageUploadHeader=t.imageUploadHeader||null,t.imageUploadUrl="string"==typeof t.imageUploadUrl?t.imageUploadUrl:null,t.imageUploadSizeLimit=/\d+/.test(t.imageUploadSizeLimit)?L.getNumber(t.imageUploadSizeLimit,0):null,t.imageMultipleFile=!!t.imageMultipleFile,t.imageAccept="string"!=typeof t.imageAccept||"*"===t.imageAccept.trim()?"image/*":t.imageAccept.trim()||"image/*",t.imageGalleryUrl="string"==typeof t.imageGalleryUrl?t.imageGalleryUrl:null,t.videoResizing=void 0===t.videoResizing||t.videoResizing,t.videoHeightShow=void 0===t.videoHeightShow||!!t.videoHeightShow,t.videoRatioShow=void 0===t.videoRatioShow||!!t.videoRatioShow,t.videoWidth=t.videoWidth&&L.getNumber(t.videoWidth,0)?L.isNumber(t.videoWidth)?t.videoWidth+"px":t.videoWidth:"",t.videoHeight=t.videoHeight&&L.getNumber(t.videoHeight,0)?L.isNumber(t.videoHeight)?t.videoHeight+"px":t.videoHeight:"",t.videoSizeOnlyPercentage=!!t.videoSizeOnlyPercentage,t._videoSizeUnit=t.videoSizeOnlyPercentage?"%":"px",t.videoRotation=void 0!==t.videoRotation?t.videoRotation:!(t.videoSizeOnlyPercentage||!t.videoHeightShow),t.videoRatio=L.getNumber(t.videoRatio,4)||.5625,t.videoRatioList=t.videoRatioList?t.videoRatioList:null,t.youtubeQuery=(t.youtubeQuery||"").replace("?",""),t.videoFileInput=!!t.videoFileInput,t.videoUrlInput=void 0===t.videoUrlInput||!t.videoFileInput||t.videoUrlInput,t.videoUploadHeader=t.videoUploadHeader||null,t.videoUploadUrl="string"==typeof t.videoUploadUrl?t.videoUploadUrl:null,t.videoUploadSizeLimit=/\d+/.test(t.videoUploadSizeLimit)?L.getNumber(t.videoUploadSizeLimit,0):null,t.videoMultipleFile=!!t.videoMultipleFile,t.videoTagAttrs=t.videoTagAttrs||null,t.videoIframeAttrs=t.videoIframeAttrs||null,t.videoAccept="string"!=typeof t.videoAccept||"*"===t.videoAccept.trim()?"video/*":t.videoAccept.trim()||"video/*",t.audioWidth=t.audioWidth?L.isNumber(t.audioWidth)?t.audioWidth+"px":t.audioWidth:"",t.audioHeight=t.audioHeight?L.isNumber(t.audioHeight)?t.audioHeight+"px":t.audioHeight:"",t.audioFileInput=!!t.audioFileInput,t.audioUrlInput=void 0===t.audioUrlInput||!t.audioFileInput||t.audioUrlInput,t.audioUploadHeader=t.audioUploadHeader||null,t.audioUploadUrl="string"==typeof t.audioUploadUrl?t.audioUploadUrl:null,t.audioUploadSizeLimit=/\d+/.test(t.audioUploadSizeLimit)?L.getNumber(t.audioUploadSizeLimit,0):null,t.audioMultipleFile=!!t.audioMultipleFile,t.audioTagAttrs=t.audioTagAttrs||null,t.audioAccept="string"!=typeof t.audioAccept||"*"===t.audioAccept.trim()?"audio/*":t.audioAccept.trim()||"audio/*",t.tableCellControllerPosition="string"==typeof t.tableCellControllerPosition?t.tableCellControllerPosition.toLowerCase():"cell",t.tabDisable=!!t.tabDisable,t.shortcutsDisable=Array.isArray(t.shortcutsDisable)&&t.shortcutsDisable.length>0?t.shortcutsDisable.map((function(e){return e.toLowerCase()})):[],t.shortcutsHint=void 0===t.shortcutsHint||!!t.shortcutsHint,t.callBackSave=t.callBackSave?t.callBackSave:null,t.templates=t.templates?t.templates:null,t.placeholder="string"==typeof t.placeholder?t.placeholder:null,t.linkProtocol="string"==typeof t.linkProtocol?t.linkProtocol:null,t.katex=t.katex?t.katex.src?t.katex:{src:t.katex}:null,t.buttonList=t.buttonList||[["undo","redo"],["bold","underline","italic","strike","subscript","superscript"],["removeFormat"],["outdent","indent"],["fullScreen","showBlocks","codeView"],["preview","print"]],t.icons=t.icons&&"object"==typeof t.icons?[E,t.icons].reduce((function(e,t){for(let n in t)L.hasOwn(t,n)&&(e[n]=t[n]);return e}),{}):E,t._editorStyles=L._setDefaultOptionStyle(t,t.defaultStyle)},_defaultButtons:function(e){const t=e.icons,n=e.lang,i=L.isOSX_IOS?"⌘":"CTRL",l=e.shortcutsHint?e.shortcutsDisable:["bold","strike","underline","italic","undo","indent"];return{bold:["_se_command_bold",n.toolbar.bold+(l.indexOf("bold")>-1?"":" ("+i+"+B)"),"STRONG","",t.bold],underline:["_se_command_underline",n.toolbar.underline+(l.indexOf("underline")>-1?"":" ("+i+"+U)"),"U","",t.underline],italic:["_se_command_italic",n.toolbar.italic+(l.indexOf("italic")>-1?"":" ("+i+"+I)"),"EM","",t.italic],strike:["_se_command_strike",n.toolbar.strike+(l.indexOf("strike")>-1?"":" ("+i+"+SHIFT+S)"),"DEL","",t.strike],subscript:["_se_command_subscript",n.toolbar.subscript,"SUB","",t.subscript],superscript:["_se_command_superscript",n.toolbar.superscript,"SUP","",t.superscript],removeFormat:["",n.toolbar.removeFormat,"removeFormat","",t.erase],indent:["_se_command_indent",n.toolbar.indent+(l.indexOf("indent")>-1?"":" ("+i+"+])"),"indent","",t.outdent],outdent:["_se_command_outdent",n.toolbar.outdent+(l.indexOf("indent")>-1?"":" ("+i+"+[)"),"outdent","",t.indent],fullScreen:["se-code-view-enabled se-resizing-enabled _se_command_fullScreen",n.toolbar.fullScreen,"fullScreen","",t.expansion],showBlocks:["_se_command_showBlocks",n.toolbar.showBlocks,"showBlocks","",t.show_blocks],codeView:["se-code-view-enabled se-resizing-enabled _se_command_codeView",n.toolbar.codeView,"codeView","",t.code_view],undo:["_se_command_undo se-resizing-enabled",n.toolbar.undo+(l.indexOf("undo")>-1?"":" ("+i+"+Z)"),"undo","",t.undo],redo:["_se_command_redo se-resizing-enabled",n.toolbar.redo+(l.indexOf("undo")>-1?"":" ("+i+"+Y / "+i+"+SHIFT+Z)"),"redo","",t.redo],preview:["se-resizing-enabled",n.toolbar.preview,"preview","",t.preview],print:["se-resizing-enabled",n.toolbar.print,"print","",t.print],save:["_se_command_save se-resizing-enabled",n.toolbar.save,"save","",t.save],blockquote:["",n.toolbar.tag_blockquote,"blockquote","command",t.blockquote],font:["se-btn-select se-btn-tool-font",n.toolbar.font,"font","submenu",''+n.toolbar.font+""+t.arrow_down],formatBlock:["se-btn-select se-btn-tool-format",n.toolbar.formats,"formatBlock","submenu",''+n.toolbar.formats+""+t.arrow_down],fontSize:["se-btn-select se-btn-tool-size",n.toolbar.fontSize,"fontSize","submenu",''+n.toolbar.fontSize+""+t.arrow_down],fontColor:["",n.toolbar.fontColor,"fontColor","submenu",t.font_color],hiliteColor:["",n.toolbar.hiliteColor,"hiliteColor","submenu",t.highlight_color],align:["se-btn-align",n.toolbar.align,"align","submenu",t.align_left],list:["",n.toolbar.list,"list","submenu",t.list_number],horizontalRule:["btn_line",n.toolbar.horizontalRule,"horizontalRule","submenu",t.horizontal_rule],table:["",n.toolbar.table,"table","submenu",t.table],lineHeight:["",n.toolbar.lineHeight,"lineHeight","submenu",t.line_height],template:["",n.toolbar.template,"template","submenu",t.template],paragraphStyle:["",n.toolbar.paragraphStyle,"paragraphStyle","submenu",t.paragraph_style],textStyle:["",n.toolbar.textStyle,"textStyle","submenu",t.text_style],link:["",n.toolbar.link,"link","dialog",t.link],image:["",n.toolbar.image,"image","dialog",t.image],video:["",n.toolbar.video,"video","dialog",t.video],audio:["",n.toolbar.audio,"audio","dialog",t.audio],math:["",n.toolbar.math,"math","dialog",t.math],imageGallery:["",n.toolbar.imageGallery,"imageGallery","fileBrowser",t.image_gallery],mention:["",n.toolbar.mention,"mention","dialog",t.mention]}},_createModuleGroup:function(){const e=L.createElement("DIV");e.className="se-btn-module se-btn-module-border";const t=L.createElement("UL");return t.className="se-menu-list",e.appendChild(t),{div:e,ul:t}},_createButton:function(e,t,n,i,l,o,s){const a=L.createElement("LI"),r=L.createElement("BUTTON");return r.setAttribute("type","button"),r.setAttribute("class","se-btn"+(e?" "+e:"")+" se-tooltip"),r.setAttribute("data-command",n),r.setAttribute("data-display",i),r.setAttribute("tabindex","-1"),l||(l='!'),/^default\./i.test(l)&&(l=s[l.replace(/^default\./i,"")]),/^text\./i.test(l)&&(l=l.replace(/^text\./i,""),r.className+=" se-btn-more-text"),l+=''+(t||n)+"",o&&r.setAttribute("disabled",!0),r.innerHTML=l,a.appendChild(r),{li:a,button:r}},_createToolBar:function(e,t,n,i){const l=e.createElement("DIV");l.className="se-toolbar-separator-vertical";const o=e.createElement("DIV");o.className="se-toolbar sun-editor-common";const s=e.createElement("DIV");s.className="se-btn-tray",o.appendChild(s);const a=i.icons,r=this._defaultButtons(i),c={},d=[],u={};if(n){const e=n.length?n:Object.keys(n).map((function(e){return n[e]}));for(let t,n=0,i=e.length;n",b.appendChild(i),i=i.firstElementChild.firstElementChild)}if(_){const e=l.cloneNode(!1);y&&(e.style.float=y),s.appendChild(e)}s.appendChild(p.div),_=!0}else if(/^\/$/.test(v)){const t=e.createElement("DIV");t.className="se-btn-module-enter",s.appendChild(t),_=!1}1===s.children.length&&L.removeClass(s.firstElementChild,"se-btn-module-border"),d.length>0&&d.unshift(t),b.children.length>0&&s.appendChild(b);const v=e.createElement("DIV");v.className="se-menu-tray",o.appendChild(v);const y=e.createElement("DIV");return y.className="se-toolbar-cover",o.appendChild(y),{element:o,plugins:u,pluginCallButtons:c,responsiveButtons:d,_menuTray:v,_buttonTray:s}}};var A=function(e,t,n){return{element:{originElement:e,topArea:t._top,relative:t._relative,toolbar:t._toolBar,_buttonTray:t._toolBar.querySelector(".se-btn-tray"),_menuTray:t._menuTray,resizingBar:t._resizingBar,navigation:t._navigation,charWrapper:t._charWrapper,charCounter:t._charCounter,editorArea:t._editorArea,wysiwygFrame:t._wysiwygArea,wysiwyg:t._wysiwygArea,code:t._codeArea,placeholder:t._placeholder,loading:t._loading,lineBreaker:t._lineBreaker,lineBreaker_t:t._lineBreaker_t,lineBreaker_b:t._lineBreaker_b,resizeBackground:t._resizeBack,_stickyDummy:t._stickyDummy,_arrow:t._arrow},tool:{cover:t._toolBar.querySelector(".se-toolbar-cover"),bold:t._toolBar.querySelector("._se_command_bold"),underline:t._toolBar.querySelector("._se_command_underline"),italic:t._toolBar.querySelector("._se_command_italic"),strike:t._toolBar.querySelector("._se_command_strike"),subscript:t._toolBar.querySelector("._se_command_subscript"),superscript:t._toolBar.querySelector("._se_command_superscript"),undo:t._toolBar.querySelector("._se_command_undo"),redo:t._toolBar.querySelector("._se_command_redo"),save:t._toolBar.querySelector("._se_command_save"),outdent:t._toolBar.querySelector("._se_command_outdent"),indent:t._toolBar.querySelector("._se_command_indent"),fullScreen:t._toolBar.querySelector("._se_command_fullScreen"),showBlocks:t._toolBar.querySelector("._se_command_showBlocks"),codeView:t._toolBar.querySelector("._se_command_codeView")},options:n,option:n}},B={name:"notice",add:function(e){const t=e.context;t.notice={};let n=e.util.createElement("DIV"),i=e.util.createElement("SPAN"),l=e.util.createElement("BUTTON");n.className="se-notice",l.className="close",l.setAttribute("aria-label","Close"),l.setAttribute("title",e.lang.dialogBox.close),l.innerHTML=e.icons.cancel,n.appendChild(i),n.appendChild(l),t.notice.modal=n,t.notice.message=i,l.addEventListener("click",this.onClick_cancel.bind(e)),t.element.editorArea.appendChild(n),n=null},onClick_cancel:function(e){e.preventDefault(),e.stopPropagation(),this.plugins.notice.close.call(this)},open:function(e){this.context.notice.message.textContent=e,this.context.notice.modal.style.display="block"},close:function(){this.context.notice.modal.style.display="none"}},z={init:function(e){return{create:function(t,n){return this.create(t,n,e)}.bind(this)}},create:function(e,t,n){L._propertiesInit(),"object"!=typeof t&&(t={}),n&&(t=[n,t].reduce((function(e,t){for(let n in t)if(L.hasOwn(t,n))if("plugins"===n&&t[n]&&e[n]){let i=e[n],l=t[n];i=i.length?i:Object.keys(i).map((function(e){return i[e]})),l=l.length?l:Object.keys(l).map((function(e){return l[e]})),e[n]=l.filter((function(e){return-1===i.indexOf(e)})).concat(i)}else e[n]=t[n];return e}),{}));const i="string"==typeof e?document.getElementById(e):e;if(!i){if("string"==typeof e)throw Error('[SUNEDITOR.create.fail] The element for that id was not found (ID:"'+e+'")');throw Error("[SUNEDITOR.create.fail] suneditor requires textarea's element or id value")}const l=k.init(i,t);if(l.constructed._top.id&&document.getElementById(l.constructed._top.id))throw Error('[SUNEDITOR.create.fail] The ID of the suneditor you are trying to create already exists (ID:"'+l.constructed._top.id+'")');return function(e,t,n,i,l,o){const s=e.element.originElement.ownerDocument||document,a=s.defaultView||window,r=L,c=l.icons,d={_d:s,_w:a,_parser:new a.DOMParser,_wd:null,_ww:null,_shadowRoot:null,util:r,functions:null,notice:B,icons:c,history:null,context:e,pluginCallButtons:t,plugins:n||{},initPlugins:{},_targetPlugins:{},_menuTray:{},lang:i,effectNode:null,submenu:null,container:null,_submenuName:"",_bindedSubmenuOff:null,_bindedContainerOff:null,submenuActiveButton:null,containerActiveButton:null,controllerArray:[],currentControllerName:"",currentControllerTarget:null,currentFileComponentInfo:null,codeViewDisabledButtons:null,resizingDisabledButtons:null,_moreLayerActiveButton:null,_htmlCheckWhitelistRegExp:null,_disallowedTextTagsRegExp:null,editorTagsWhitelistRegExp:null,pasteTagsWhitelistRegExp:null,hasFocus:!1,isDisabled:!1,_attributesWhitelistRegExp:null,_attributesTagsWhitelist:null,_bindControllersOff:null,_isInline:null,_isBalloon:null,_isBalloonAlways:null,_inlineToolbarAttr:{top:"",width:"",isShow:!1},_notHideToolbar:!1,_sticky:!1,_antiBlur:!1,_lineBreaker:null,_lineBreakerButton:null,_componentsInfoInit:!0,_componentsInfoReset:!1,activePlugins:null,managedTagsInfo:null,_charTypeHTML:!1,_fileInfoPluginsCheck:null,_fileInfoPluginsReset:null,_fileManager:{tags:null,regExp:null,queryString:null,pluginRegExp:null,pluginMap:null},commandMap:null,_styleCommandMap:null,_defaultCommand:{bold:"STRONG",underline:"U",italic:"EM",strike:"DEL",subscript:"SUB",superscript:"SUP"},_variable:{isCodeView:!1,isFullScreen:!1,innerHeight_fullScreen:0,resizeClientY:0,tabSize:4,codeIndent:4,minResizingSize:r.getNumber(e.element.wysiwygFrame.style.minHeight||"65",0),currentNodes:[],currentNodesMap:[],_range:null,_selectionNode:null,_originCssText:e.element.topArea.style.cssText,_bodyOverflow:"",_editorAreaOriginCssText:"",_wysiwygOriginCssText:"",_codeOriginCssText:"",_fullScreenAttrs:{sticky:!1,balloon:!1,inline:!1},_lineBreakComp:null,_lineBreakDir:""},callPlugin:function(e,n,i){if(i=i||t[e],!this.plugins[e])throw Error('[SUNEDITOR.core.callPlugin.fail] The called plugin does not exist or is in an invalid format. (pluginName:"'+e+'")');this.initPlugins[e]?"object"==typeof this._targetPlugins[e]&&i&&this.initMenuTarget(e,i,this._targetPlugins[e]):(this.plugins[e].add(this,i),this.initPlugins[e]=!0),this.plugins[e].active&&!this.commandMap[e]&&i&&(this.commandMap[e]=i,this.activePlugins.push(e)),"function"==typeof n&&n()},addModule:function(e){for(let t,n=0,i=e.length;nb?(n.style.height=l+"px",e=-1*(l-g+3)):(n.style.height=b+"px",e=g+t.parentElement.offsetHeight),n.style.top=e+"px"}else n.style.top=g+t.parentElement.offsetHeight+"px";n.style.visibility=""},controllersOn:function(){this._bindControllersOff&&this._bindControllersOff(),this.controllerArray=[];for(let e,t=0;t0){for(let e=0;e":n),this.history.push(!0)},nativeFocus:function(){const t=r.getParentElement(this.getSelectionNode(),"figcaption");t?t.focus():e.element.wysiwyg.focus(),this._editorRange()},focus:function(){if("none"!==e.element.wysiwygFrame.style.display){if(l.iframe)this.nativeFocus();else try{const t=this.getRange();if(t.startContainer===t.endContainer&&r.isWysiwygDiv(t.startContainer)){const t=r.createElement("P"),n=r.createElement("BR");t.appendChild(n),e.element.wysiwyg.appendChild(t),this.setRange(n,0,n,0)}else this.setRange(t.startContainer,t.startOffset,t.endContainer,t.endOffset)}catch(e){this.nativeFocus()}u._applyTagEffects(),this._isBalloon&&u._toggleToolbarBalloon()}},focusEdge:function(t){t||(t=e.element.wysiwyg.lastElementChild);const n=this.getFileComponent(t);n?this.selectComponent(n.target,n.pluginName):t?(t=r.getChildElement(t,(function(e){return 0===e.childNodes.length||3===e.nodeType}),!0))?this.setRange(t,t.textContent.length,t,t.textContent.length):this.nativeFocus():this.focus()},setRange:function(e,t,n,i){if(!e||!n)return;t>e.textContent.length&&(t=e.textContent.length),i>n.textContent.length&&(i=n.textContent.length);const o=this._wd.createRange();try{o.setStart(e,t),o.setEnd(n,i)}catch(e){return console.warn("[SUNEDITOR.core.focus.error] "+e),void this.nativeFocus()}const s=this.getSelection();return s.removeAllRanges&&s.removeAllRanges(),s.addRange(o),this._editorRange(),l.iframe&&this.nativeFocus(),o},removeRange:function(){this._variable._range=null,this._variable._selectionNode=null,this.getSelection().removeAllRanges();const e=this.commandMap,t=this.activePlugins;for(let i in e)r.hasOwn(e,i)&&(t.indexOf(i)>-1?n[i].active.call(this,null):e.OUTDENT&&/^OUTDENT$/i.test(i)?e.OUTDENT.setAttribute("disabled",!0):e.INDENT&&/^INDENT$/i.test(i)?e.INDENT.removeAttribute("disabled"):r.removeClass(e[i],"active"))},getRange:function(){const t=this._variable._range||this._createDefaultRange(),n=this.getSelection();if(t.collapsed===n.isCollapsed||!e.element.wysiwyg.contains(n.focusNode))return t;if(n.rangeCount>0)return this._variable._range=n.getRangeAt(0),this._variable._range;{const e=n.anchorNode,t=n.focusNode,i=n.anchorOffset,l=n.focusOffset,o=r.compareElements(e,t),s=o.ancestor&&(0===o.result?i<=l:o.result>1);return this.setRange(s?e:t,s?i:l,s?t:e,s?l:i)}},getRange_addLine:function(t){if(this._selectionVoid(t)){const n=e.element.wysiwyg,i=r.createElement("P");i.innerHTML="
    ",n.insertBefore(i,n.firstElementChild),this.setRange(i.firstElementChild,0,i.firstElementChild,1),t=this._variable._range}return t},getSelection:function(){return this._shadowRoot&&this._shadowRoot.getSelection?this._shadowRoot.getSelection():this._ww.getSelection()},getSelectionNode:function(){if(r.isWysiwygDiv(this._variable._selectionNode)&&this._editorRange(),!this._variable._selectionNode){const t=r.getChildElement(e.element.wysiwyg.firstChild,(function(e){return 0===e.childNodes.length||3===e.nodeType}),!1);if(t)return this._variable._selectionNode=t,t;this._editorRange()}return this._variable._selectionNode},_editorRange:function(){const e=this.getSelection();if(!e)return null;let t=null,n=null;t=e.rangeCount>0?e.getRangeAt(0):this._createDefaultRange(),this._variable._range=t,n=t.collapsed?t.commonAncestorContainer:e.extentNode||e.anchorNode,this._variable._selectionNode=n},_createDefaultRange:function(){const t=e.element.wysiwyg;t.focus();const n=this._wd.createRange();let i=t.firstElementChild;return i||(i=r.createElement("P"),i.innerHTML="
    ",t.appendChild(i)),n.setStart(i,0),n.setEnd(i,0),n},_selectionVoid:function(e){const t=e.commonAncestorContainer;return r.isWysiwygDiv(e.startContainer)&&r.isWysiwygDiv(e.endContainer)||/FIGURE/i.test(t.nodeName)||this._fileManager.regExp.test(t.nodeName)||r.isMediaComponent(t)},_resetRangeToTextNode:function(){const t=this.getRange();if(this._selectionVoid(t))return!1;let n,i,l,o=t.startContainer,s=t.startOffset,a=t.endContainer,c=t.endOffset;if(r.isFormatElement(o)&&(o=o.childNodes[s]||o.lastChild,s=o.textContent.length),r.isFormatElement(a)&&(a=a.childNodes[c]||a.lastChild,c=a.textContent.length),n=r.isWysiwygDiv(o)?e.element.wysiwyg.firstChild:o,i=s,r.isBreak(n)||1===n.nodeType&&n.childNodes.length>0){const e=r.isBreak(n);if(!e){for(;n&&!r.isBreak(n)&&1===n.nodeType;)n=n.childNodes[i]||n.nextElementSibling||n.nextSibling,i=0;let e=r.getFormatElement(n,null);e===r.getRangeFormatElement(e,null)&&(e=r.createElement(r.getParentElement(n,r.isCell)?"DIV":"P"),n.parentNode.insertBefore(e,n),e.appendChild(n))}if(r.isBreak(n)){const t=r.createTextNode(r.zeroWidthSpace);n.parentNode.insertBefore(t,n),n=t,e&&o===a&&(a=n,c=1)}}if(o=n,s=i,n=r.isWysiwygDiv(a)?e.element.wysiwyg.lastChild:a,i=c,r.isBreak(n)||1===n.nodeType&&n.childNodes.length>0){const e=r.isBreak(n);if(!e){for(;n&&!r.isBreak(n)&&1===n.nodeType&&(l=n.childNodes,0!==l.length);)n=l[i>0?i-1:i]||!/FIGURE/i.test(l[0].nodeName)?l[0]:n.previousElementSibling||n.previousSibling||o,i=i>0?n.textContent.length:i;let e=r.getFormatElement(n,null);e===r.getRangeFormatElement(e,null)&&(e=r.createElement(r.isCell(e)?"DIV":"P"),n.parentNode.insertBefore(e,n),e.appendChild(n))}if(r.isBreak(n)){const t=r.createTextNode(r.zeroWidthSpace);n.parentNode.insertBefore(t,n),n=t,i=1,e&&!n.previousSibling&&r.removeItem(a)}}return a=n,c=i,this.setRange(o,s,a,c),!0},getSelectedElements:function(t){if(!this._resetRangeToTextNode())return[];let n=this.getRange();if(r.isWysiwygDiv(n.startContainer)){const t=e.element.wysiwyg.children;if(0===t.length)return[];this.setRange(t[0],0,t[t.length-1],t[t.length-1].textContent.trim().length),n=this.getRange()}const i=n.startContainer,l=n.endContainer,o=n.commonAncestorContainer,s=r.getListChildren(o,(function(e){return t?t(e):r.isFormatElement(e)}));if(r.isWysiwygDiv(o)||r.isRangeFormatElement(o)||s.unshift(r.getFormatElement(o,null)),i===l||1===s.length)return s;let a=r.getFormatElement(i,null),c=r.getFormatElement(l,null),d=null,u=null;const h=function(e){return!r.isTable(e)||/^TABLE$/i.test(e.nodeName)};let g=r.getRangeFormatElement(a,h),p=r.getRangeFormatElement(c,h);r.isTable(g)&&r.isListCell(g.parentNode)&&(g=g.parentNode),r.isTable(p)&&r.isListCell(p.parentNode)&&(p=p.parentNode);const m=g===p;for(let e,t=0,n=s.length;t=0;n--)if(i[n].contains(i[e])){i.splice(e,1),e--,t--;break}return i},isEdgePoint:function(e,t){return 0===t||!e.nodeValue&&1===t||t===e.nodeValue.length},showLoading:function(){e.element.loading.style.display="block"},closeLoading:function(){e.element.loading.style.display="none"},appendFormatTag:function(e,t){const n=r.getFormatElement(this.getSelectionNode(),null),i=t?"string"==typeof t?t:t.nodeName:r.isFormatElement(n)&&!r.isFreeFormatElement(n)?n.nodeName:"P",l=r.createElement(i);return l.innerHTML="
    ",(t&&"string"!=typeof t||!t&&r.isFormatElement(n))&&r.copyTagAttributes(l,t||n),r.isCell(e)?e.insertBefore(l,e.nextElementSibling):e.parentNode.insertBefore(l,e.nextElementSibling),l},insertComponent:function(e,t,n,i){if(n&&!this.checkCharCount(e,null))return null;const l=this.removeNode();this.getRange_addLine(this.getRange());let o=null,s=this.getSelectionNode(),a=r.getFormatElement(s,null);if(r.isListCell(a))this.insertNode(e,s===a?null:l.container.nextSibling,!1),e.nextSibling||e.parentNode.appendChild(r.createElement("BR"));else{if(this.getRange().collapsed&&(3===l.container.nodeType||r.isBreak(l.container))){const e=r.getParentElement(l.container,function(e){return this.isRangeFormatElement(e)}.bind(r));o=r.splitElement(l.container,l.offset,e?r.getElementDepth(e)+1:0),o&&(a=o.previousSibling)}this.insertNode(e,a,!1),a&&r.onlyZeroWidthSpace(a)&&r.removeItem(a)}if(!i){const t=this.getFileComponent(e);t?this.selectComponent(t.target,t.pluginName):o&&(o=r.getEdgeChildNodes(o,null).sc||o,this.setRange(o,0,o,0))}return t||this.history.push(1),o||e},getFileComponent:function(e){if(!this._fileManager.queryString||!e)return null;let t,n;return(/^FIGURE$/i.test(e.nodeName)||/se-component/.test(e.className))&&(t=e.querySelector(this._fileManager.queryString)),!t&&e.nodeName&&this._fileManager.regExp.test(e.nodeName)&&(t=e),t&&(n=this._fileManager.pluginMap[t.nodeName.toLowerCase()],n)?{target:t,component:r.getParentElement(t,r.isComponent),pluginName:n}:null},selectComponent:function(e,t){this.hasFocus||this.focus();const n=this.plugins[t];n&&a.setTimeout(function(){"function"==typeof n.select&&this.callPlugin(t,n.select.bind(this,e),null),this._setComponentLineBreaker(e)}.bind(this))},_setComponentLineBreaker:function(t){this._lineBreaker.style.display="none";const n=r.getParentElement(t,r.isComponent),i=e.element.lineBreaker_t.style,l=e.element.lineBreaker_b.style,o="block"===this.context.resizing.resizeContainer.style.display?this.context.resizing.resizeContainer:t,s=r.isListCell(n.parentNode);let a,c,d;(s?n.previousSibling:r.isFormatElement(n.previousElementSibling))?i.display="none":(this._variable._lineBreakComp=n,c=e.element.wysiwyg.scrollTop,a=r.getOffset(t,e.element.wysiwygFrame).top+c,d=o.offsetWidth/2/2,i.top=a-c-12+"px",i.left=r.getOffset(o).left+d+"px",i.display="block"),(s?n.nextSibling:r.isFormatElement(n.nextElementSibling))?l.display="none":(a||(this._variable._lineBreakComp=n,c=e.element.wysiwyg.scrollTop,a=r.getOffset(t,e.element.wysiwygFrame).top+c,d=o.offsetWidth/2/2),l.top=a+o.offsetHeight-c-12+"px",l.left=r.getOffset(o).left+o.offsetWidth-d-24+"px",l.display="block")},insertNode:function(e,t,n){if(n&&!this.checkCharCount(e,null))return null;const i=r.getFreeFormatElement(this.getSelectionNode(),null),l=!i&&(r.isFormatElement(e)||r.isRangeFormatElement(e))||r.isComponent(e);if(!t&&l){const e=this.removeNode();if(3===e.container.nodeType||r.isBreak(e.container)){const n=r.getParentElement(e.container,function(e){return this.isRangeFormatElement(e)||this.isListCell(e)}.bind(r));(t=r.splitElement(e.container,e.offset,n?r.getElementDepth(n)+1:0))&&(t=t.previousSibling)}}const o=t||l?this.getRange():this.getRange_addLine(this.getRange()),s=o.commonAncestorContainer,a=o.startOffset,c=o.endOffset,d=o.startContainer===s&&r.isFormatElement(s),u=d?s.childNodes[a]:o.startContainer,h=d?s.childNodes[c]:o.endContainer;let g,p=null;if(t)g=t.parentNode,t=t.nextSibling,p=!0;else if(g=u,3===u.nodeType&&(g=u.parentNode),o.collapsed)if(3===s.nodeType)t=s.textContent.length>c?s.splitText(c):s.nextSibling;else if(r.isBreak(g))t=g,g=g.parentNode;else{let n=g.childNodes[a];const i=n&&3===n.nodeType&&r.onlyZeroWidthSpace(n)&&r.isBreak(n.nextSibling)?n.nextSibling:n;i?i.nextSibling?t=r.isBreak(i)&&!r.isBreak(e)?i:i.nextSibling:(g.removeChild(i),t=null):t=null}else{if(u===h){t=this.isEdgePoint(h,c)?h.nextSibling:h.splitText(c);let e=u;this.isEdgePoint(u,a)||(e=u.splitText(a)),g.removeChild(e),0===g.childNodes.length&&l&&(g.innerHTML="
    ")}else{const e=this.removeNode(),n=e.container,i=e.prevContainer;if(n&&0===n.childNodes.length&&l&&(r.isFormatElement(n)?n.innerHTML="
    ":r.isRangeFormatElement(n)&&(n.innerHTML="


    ")),!l&&i)if(g=3===i.nodeType?i.parentNode:i,g.contains(n))for(t=n;t.parentNode===g;)t=t.parentNode;else t=null;else g=l?s:n,t=l?h:null;for(;t&&!r.isFormatElement(t)&&t.parentNode!==s;)t=t.parentNode}}try{if(r.isFormatElement(e)||r.isRangeFormatElement(e)||!r.isListCell(g)&&r.isComponent(e)){const e=g;if(r.isList(t))g=t,t=null;else if(r.isListCell(t))g=t.previousElementSibling||t;else if(!p&&!t){const e=this.removeNode(),n=3===e.container.nodeType?r.isListCell(r.getFormatElement(e.container,null))?e.container:r.getFormatElement(e.container,null)||e.container.parentNode:e.container,i=r.isWysiwygDiv(n)||r.isRangeFormatElement(n);g=i?n:n.parentNode,t=i?null:n.nextSibling}0===e.childNodes.length&&g!==e&&r.removeItem(e)}!l||i||r.isRangeFormatElement(g)||r.isListCell(g)||r.isWysiwygDiv(g)||(t=g.nextElementSibling,g=g.parentNode),g.insertBefore(e,g===t?g.lastChild:t)}catch(t){g.appendChild(e)}finally{if(i&&(r.isFormatElement(e)||r.isRangeFormatElement(e))&&(e=this._setIntoFreeFormat(e)),!r.isComponent(e)){let t=1;if(3===e.nodeType){const t=e.previousSibling,n=e.nextSibling,i=!t||1===t.nodeType||r.onlyZeroWidthSpace(t)?"":t.textContent,l=!n||1===n.nodeType||r.onlyZeroWidthSpace(n)?"":n.textContent;t&&i.length>0&&(e.textContent=i+e.textContent,r.removeItem(t)),n&&n.length>0&&(e.textContent+=l,r.removeItem(n));const o={container:e,startOffset:i.length,endOffset:e.textContent.length-l.length};return this.setRange(e,o.startOffset,e,o.endOffset),o}if(!r.isBreak(e)&&r.isFormatElement(g)){let n=null;e.previousSibling||(n=r.createTextNode(r.zeroWidthSpace),e.parentNode.insertBefore(n,e)),e.nextSibling||(n=r.createTextNode(r.zeroWidthSpace),e.parentNode.appendChild(n)),r._isIgnoreNodeChange(e)&&(e=e.nextSibling,t=0)}this.setRange(e,t,e,t)}return this.history.push(!0),e}},_setIntoFreeFormat:function(e){const t=e.parentNode;let n,i;for(;r.isFormatElement(e)||r.isRangeFormatElement(e);){for(n=e.childNodes,i=null;n[0];)if(i=n[0],r.isFormatElement(i)||r.isRangeFormatElement(i)){if(this._setIntoFreeFormat(i),!e.parentNode)break;n=e.childNodes}else t.insertBefore(i,e);0===e.childNodes.length&&r.removeItem(e),e=r.createElement("BR"),t.insertBefore(e,i.nextSibling)}return e},removeNode:function(){this._resetRangeToTextNode()||console.warn('[SUNEDITOR.core.removeNode.exception] An exception occurred while resetting the "Range" object.');const t=this.getRange();let n,i=0,l=t.startContainer,o=t.endContainer;const s=t.startOffset,a=t.endOffset,c=t.commonAncestorContainer;let d=null,u=null;const h=r.getListChildNodes(c,null);let g=r.getArrayIndex(h,l),p=r.getArrayIndex(h,o);if(h.length>0&&g>-1&&p>-1){for(let e=g+1,t=l;e>=0;e--)h[e]===t.parentNode&&h[e].firstChild===t&&0===s&&(g=e,t=t.parentNode);for(let e=p-1,t=o;e>g;e--)h[e]===t.parentNode&&1===h[e].nodeType&&(h.splice(e,1),t=t.parentNode,--p)}else{if(0===h.length){if(r.isFormatElement(c)||r.isRangeFormatElement(c)||r.isWysiwygDiv(c)||r.isBreak(c)||r.isMedia(c))return{container:c,offset:0};h.push(c),l=o=c}else if(l=o=h[0],r.isBreak(l)||r.onlyZeroWidthSpace(l))return{container:l,offset:0};g=p=0}function m(e){const t=r.getFormatElement(e,null);if(r.removeItem(e),r.isListCell(t)){const e=r.getArrayItem(t.children,r.isList,!1);if(e){const n=e.firstElementChild,i=n.childNodes;for(;i[0];)t.insertBefore(i[0],e);r.removeItemAllParents(n,null,null)}}}for(let e=g;e<=p;e++){const t=h[e];if(0===t.length||3===t.nodeType&&void 0===t.data)m(t);else if(t!==l)t!==o?m(t):(u=1===o.nodeType?r.createTextNode(o.textContent):r.createTextNode(o.substringData(a,o.length-a)),u.length>0?o.data=u.data:m(o));else if(1===l.nodeType?d=r.createTextNode(l.textContent):t===o?(d=r.createTextNode(l.substringData(0,s)+o.substringData(a,o.length-a)),i=s):d=r.createTextNode(l.substringData(0,s)),d.length>0?l.data=d.data:m(l),t===o)break}if(n=o&&o.parentNode?o:l&&l.parentNode?l:t.endContainer||t.startContainer,!r.isWysiwygDiv(n)){const t=r.removeItemAllParents(n,function(e){if(this.isComponent(e))return!1;const t=e.textContent;return 0===t.length||/^(\n|\u200B)+$/.test(t)}.bind(r),null);t&&(n=t.sc||t.ec||e.element.wysiwyg)}return this.setRange(n,i,n,i),this.history.push(!0),{container:n,offset:i,prevContainer:l&&l.parentNode?l:null}},applyRangeFormatElement:function(e){this.getRange_addLine(this.getRange());const t=this.getSelectedElementsAndComponents(!1);if(!t||0===t.length)return;e:for(let e,n,i,l,o,s,a=0,c=t.length;a-1&&(l=n.lastElementChild,t.indexOf(l)>-1)){let e=null;for(;e=l.lastElementChild;)if(r.isList(e)){if(!(t.indexOf(e.lastElementChild)>-1))continue e;l=e.lastElementChild}i=n.firstElementChild,o=t.indexOf(i),s=t.indexOf(l),t.splice(o,s-o+1),c=t.length}else;let n,i,l,o=t[t.length-1];n=r.isRangeFormatElement(o)||r.isFormatElement(o)?o:r.getRangeFormatElement(o,null)||r.getFormatElement(o,null),r.isCell(n)?(i=null,l=n):(i=n.nextSibling,l=n.parentNode);let s=r.getElementDepth(n),a=null;const c=[],d=function(e,t,n){let i=null;if(e!==t&&!r.isTable(t)){if(t&&r.getElementDepth(e)===r.getElementDepth(t))return n;i=r.removeItemAllParents(t,null,e)}return i?i.ec:n};for(let n,o,u,h,g,p,m,f=0,_=t.length;f<_;f++)if(n=t[f],o=n.parentNode,o&&!e.contains(o))if(u=r.getElementDepth(n),r.isList(o)){if(null===a&&(p?(a=p,m=!0,p=null):a=o.cloneNode(!1)),c.push(n),g=t[f+1],f===_-1||g&&g.parentNode!==o){g&&n.contains(g.parentNode)&&(p=g.parentNode.cloneNode(!1));let t,f=o.parentNode;for(;r.isList(f);)t=r.createElement(f.nodeName),t.appendChild(a),a=t,f=f.parentNode;const _=this.detachRangeFormatElement(o,c,null,!0,!0);s>=u?(s=u,l=_.cc,i=d(l,o,_.ec),i&&(l=i.parentNode)):l===_.cc&&(i=_.ec),l!==_.cc&&(h=d(l,_.cc,h),i=void 0!==h?h:_.cc);for(let e=0,t=_.removeArray.length;e=u&&(s=u,l=o,i=n.nextSibling),e.appendChild(n),l!==o&&(h=d(l,o),void 0!==h&&(i=h));if(this.effectNode=null,r.mergeSameTags(e,null,!1),r.mergeNestedTags(e,function(e){return this.isList(e)}.bind(r)),i&&r.getElementDepth(i)>0&&(r.isList(i.parentNode)||r.isList(i.parentNode.parentNode))){const t=r.getParentElement(i,function(e){return this.isRangeFormatElement(e)&&!this.isList(e)}.bind(r)),n=r.splitElement(i,null,t?r.getElementDepth(t)+1:0);n.parentNode.insertBefore(e,n)}else l.insertBefore(e,i),d(e,i);const u=r.getEdgeChildNodes(e.firstElementChild,e.lastElementChild);t.length>1?this.setRange(u.sc,0,u.ec,u.ec.textContent.length):this.setRange(u.ec,u.ec.textContent.length,u.ec,u.ec.textContent.length),this.history.push(!1)},detachRangeFormatElement:function(e,t,n,i,l){const o=this.getRange(),s=o.startOffset,a=o.endOffset;let c=r.getListChildNodes(e,(function(t){return t.parentNode===e})),d=e.parentNode,u=null,h=null,g=e.cloneNode(!1);const p=[],m=r.isList(n);let f=!1,_=!1,b=!1;function v(t,n,i,l){if(r.onlyZeroWidthSpace(n)&&(n.innerHTML=r.zeroWidthSpace),3===n.nodeType)return t.insertBefore(n,i),n;const o=(b?n:l).childNodes;let s=n.cloneNode(!1),a=null,c=null;for(;o[0];)c=o[0],!r._notTextNode(c)||r.isBreak(c)||r.isListCell(s)?s.appendChild(c):(s.childNodes.length>0&&(a||(a=s),t.insertBefore(s,i),s=n.cloneNode(!1)),t.insertBefore(c,i),a||(a=c));if(s.childNodes.length>0){if(r.isListCell(t)&&r.isListCell(s)&&r.isList(i))if(m){for(a=i;i;)s.appendChild(i),i=i.nextSibling;t.parentNode.insertBefore(s,t.nextElementSibling)}else{const t=l.nextElementSibling,n=r.detachNestedList(l,!1);if(e!==n||t!==l.nextElementSibling){const t=s.childNodes;for(;t[0];)l.appendChild(t[0]);e=n,_=!0}}else t.insertBefore(s,i);a||(a=s)}return a}for(let l,o,s,a=0,y=c.length;a0&&(d.insertBefore(g,e),g=null),!m&&r.isListCell(l))if(s&&r.getElementDepth(l)!==r.getElementDepth(s)&&(r.isListCell(d)||r.getArrayItem(l.children,r.isList,!1))){const t=l.nextElementSibling,n=r.detachNestedList(l,!1);e===n&&t===l.nextElementSibling||(e=n,_=!0)}else{const t=l;l=r.createElement(i?t.nodeName:r.isList(e.parentNode)||r.isListCell(e.parentNode)?"LI":r.isCell(e.parentNode)?"DIV":"P");const n=r.isListCell(l),o=t.childNodes;for(;o[0]&&(!r.isList(o[0])||n);)l.appendChild(o[0]);r.copyFormatAttributes(l,t),b=!0}else l=l.cloneNode(!1);if(!_&&(i?(p.push(l),r.removeItem(c[a])):(n?(f||(d.insertBefore(n,e),f=!0),l=v(n,l,null,c[a])):l=v(d,l,e,c[a]),_||(t?(h=l,u||(u=l)):u||(u=h=l))),_)){_=b=!1,c=r.getListChildNodes(e,(function(t){return t.parentNode===e})),g=e.cloneNode(!1),d=e.parentNode,a=-1,y=c.length;continue}}const y=e.parentNode;let C=e.nextSibling;g&&g.children.length>0&&y.insertBefore(g,C),n?u=n.previousSibling:u||(u=e.previousSibling),C=e.nextSibling,0===e.children.length||0===e.textContent.length?r.removeItem(e):r.removeEmptyNode(e,null);let w=null;if(i)w={cc:y,sc:u,ec:C,removeArray:p};else{u||(u=h),h||(h=u);const e=r.getEdgeChildNodes(u,h.parentNode?u:h);w={cc:(e.sc||e.ec).parentNode,sc:e.sc,ec:e.ec}}if(this.effectNode=null,l)return w;!i&&w&&(t?this.setRange(w.sc,s,w.ec,a):this.setRange(w.sc,0,w.sc,0)),this.history.push(!1)},detachList:function(e,t){let n={},i=!1,l=!1,o=null,s=null;const a=function(e){return!this.isComponent(e)}.bind(r);for(let c,d,u,h,g=0,p=e.length;g0)&&t,n=!!(n&&n.length>0)&&n;const o=!e,s=o&&!n&&!t;let c=l.startContainer,d=l.startOffset,u=l.endContainer,h=l.endOffset;if(s&&l.collapsed&&r.isFormatElement(c.parentNode)&&r.isFormatElement(u.parentNode)||c===u&&1===c.nodeType&&r.isNonEditable(c))return;if(l.collapsed&&!s&&1===c.nodeType&&!r.isBreak(c)&&!r.isComponent(c)){let e=null;const t=c.childNodes[d];t&&(e=t.nextSibling?r.isBreak(t)?t:t.nextSibling:null);const n=r.createTextNode(r.zeroWidthSpace);c.insertBefore(n,e),this.setRange(n,1,n,1),l=this.getRange(),c=l.startContainer,d=l.startOffset,u=l.endContainer,h=l.endOffset}r.isFormatElement(c)&&(c=c.childNodes[d]||c.firstChild,d=0),r.isFormatElement(u)&&(u=u.childNodes[h]||u.lastChild,h=u.textContent.length),o&&(e=r.createElement("DIV"));const g=a.RegExp,p=e.nodeName;if(!s&&c===u&&!n&&e){let t=c,n=0;const i=[],l=e.style;for(let e=0,t=l.length;e0){for(;!r.isFormatElement(t)&&!r.isWysiwygDiv(t);){for(let l=0;l=i.length)return}}let m,f={},_={},b="",v="",y="";if(t){for(let e,n=0,i=t.length;n0&&(a=l.replace(b,"").trim(),a!==l&&(w.v=!0));const c=t.className;let d="";return v&&c.length>0&&(d=c.replace(v,"").trim(),d!==c&&(w.v=!0)),(!o||!v&&c||!b&&l||a||d||!n)&&(a||d||t.nodeName!==p||C(b)!==C(l)||C(v)!==C(c))?(b&&l.length>0&&(t.style.cssText=a),t.style.cssText||t.removeAttribute("style"),v&&c.length>0&&(t.className=d.trim()),t.className.trim()||t.removeAttribute("class"),t.style.cssText||t.className||t.nodeName!==p&&!n?t:(w.v=!0,null)):(w.v=!0,null)},E=this.getSelectedElements(null);l=this.getRange(),c=l.startContainer,d=l.startOffset,u=l.endContainer,h=l.endOffset,r.getFormatElement(c,null)||(c=r.getChildElement(E[0],(function(e){return 3===e.nodeType}),!1),d=0),r.getFormatElement(u,null)||(u=r.getChildElement(E[E.length-1],(function(e){return 3===e.nodeType}),!1),h=u.textContent.length);const S=r.getFormatElement(c,null)===r.getFormatElement(u,null),N=E.length-(S?0:1);m=e.cloneNode(!1);const T=s||o&&function(e){for(let t=0,n=e.length;t0&&(m=e.cloneNode(!1),_=this._nodeChange_endLine(E[N],m,x,u,h,s,o,w,k,A));for(let t,n=N-1;n>0;n--)m=e.cloneNode(!1),t=this._nodeChange_middleLine(E[n],m,x,s,o,w,_.container),t.endContainer&&(_.ancestor=null,_.container=t.endContainer),this._setCommonListStyle(t.ancestor,null);m=e.cloneNode(!1),f=this._nodeChange_startLine(E[0],m,x,c,d,s,o,w,k,A,_.container),f.endContainer&&(_.ancestor=null,_.container=f.endContainer),N<=0?_=f:_.container||(_.ancestor=null,_.container=f.container,_.offset=f.container.textContent.length),this._setCommonListStyle(f.ancestor,null),this._setCommonListStyle(_.ancestor||r.getFormatElement(_.container),null)}this.controllersOff(),this.setRange(f.container,f.offset,_.container,_.offset),this.history.push(!1)},_setCommonListStyle:function(e,t){if(!r.isListCell(e))return;t||e.removeAttribute("style");const n=r.getArrayItem((t||e).childNodes,(function(e){return!r.isBreak(e)&&!r.onlyZeroWidthSpace(e.textContent.trim())}),!0);if(n[0]&&1===n.length){if(!(t=n[0])||1!==t.nodeType)return;const i=t.style,l=e.style;/STRONG/i.test(t.nodeName)?l.fontWeight="bold":i.fontWeight&&(l.fontWeight=i.fontWeight),i.color&&(l.color=i.color),i.fontSize&&(l.fontSize=i.fontSize),this._setCommonListStyle(e,t)}},_stripRemoveNode:function(e){const t=e.parentNode;if(!e||3===e.nodeType||!t)return;const n=e.childNodes;for(;n[0];)t.insertBefore(n[0],e);t.removeChild(e)},_util_getMaintainedNode:function(e,t,n){return!n||e?null:this.getParentElement(n,this._isMaintainedNode.bind(this))||(t?null:this.getParentElement(n,this._isSizeNode.bind(this)))},_util_isMaintainedNode:function(e,t,n){if(!n||e||1!==n.nodeType)return!1;const i=this._isMaintainedNode(n);return this.getParentElement(n,this._isMaintainedNode.bind(this))?i:i||!t&&this._isSizeNode(n)},_nodeChange_oneLine:function(e,t,n,i,l,o,s,c,d,u,h,g,p){let m=i.parentNode;for(;!(m.nextSibling||m.previousSibling||r.isFormatElement(m.parentNode)||r.isWysiwygDiv(m.parentNode))&&m.nodeName!==t.nodeName;)m=m.parentNode;if(!d&&m===o.parentNode&&m.nodeName===t.nodeName&&r.onlyZeroWidthSpace(i.textContent.slice(0,l))&&r.onlyZeroWidthSpace(o.textContent.slice(s))){const e=m.childNodes;let n=!0;for(let t,l,s,a,c=0,d=e.length;c0&&(n=t.test(e.style.cssText)),!n}if(function e(i,l){const o=i.childNodes;for(let i,s=0,a=o.length;s=N?L-N:S.data.length-N));if(E){const t=g(l);if(t&&t.parentNode!==e){let n=t,i=null;for(;n.parentNode!==e;){for(l=i=n.parentNode.cloneNode(!1);n.childNodes[0];)i.appendChild(n.childNodes[0]);n.appendChild(i),n=n.parentNode}n.parentNode.appendChild(t)}E=E.cloneNode(!1)}r.onlyZeroWidthSpace(o)||l.appendChild(o);const c=g(l);for(c&&(E=c),E&&(e=E),C=a,y=[],x="";C!==e&&C!==f&&null!==C;)i=p(C)?null:n(C),i&&1===C.nodeType&&z(C)&&(y.push(i),x+=C.style.cssText.substr(0,C.style.cssText.indexOf(":"))+"|"),C=C.parentNode;const d=y.pop()||s;for(w=C=d;y.length>0;)C=y.pop(),w.appendChild(C),w=C;if(t.appendChild(d),e.appendChild(t),E&&!g(T)&&(t=t.cloneNode(!1),b.appendChild(t),_.push(t)),S=s,N=0,k=!0,C!==s&&C.appendChild(S),!v)continue}if(A||a!==T){if(k){if(1===a.nodeType&&!r.isBreak(a)){r._isIgnoreNodeChange(a)?(b.appendChild(a.cloneNode(!0)),u||(t=t.cloneNode(!1),b.appendChild(t),_.push(t))):e(a,a);continue}C=a,y=[],x="";const o=[];for(;null!==C.parentNode&&C!==f&&C!==t;)i=A?C.cloneNode(!1):n(C),1===C.nodeType&&!r.isBreak(a)&&i&&z(C)&&(p(C)?E||o.push(i):y.push(i),x+=C.style.cssText.substr(0,C.style.cssText.indexOf(":"))+"|"),C=C.parentNode;y=y.concat(o);const s=y.pop()||a;for(w=C=s;y.length>0;)C=y.pop(),w.appendChild(C),w=C;if(p(t.parentNode)&&!p(s)&&(t=t.cloneNode(!1),b.appendChild(t),_.push(t)),A||E||!p(s))s===a?l=A?b:t:A?(b.appendChild(s),l=C):(t.appendChild(s),l=C);else{t=t.cloneNode(!1);const e=s.childNodes;for(let n=0,i=e.length;n0?C:t}if(E&&3===a.nodeType)if(g(a)){const e=r.getParentElement(l,function(e){return this._isMaintainedNode(e.parentNode)||e.parentNode===b}.bind(r));E.appendChild(e),t=e.cloneNode(!1),_.push(t),b.appendChild(t)}else E=null}d=a.cloneNode(!1),l.appendChild(d),1!==a.nodeType||r.isBreak(a)||(h=d),e(a,h)}else{E=g(a);const e=r.createTextNode(1===T.nodeType?"":T.substringData(L,T.length-L)),l=r.createTextNode(v||1===T.nodeType?"":T.substringData(0,L));if(E?E=E.cloneNode(!1):p(t.parentNode)&&!E&&(t=t.cloneNode(!1),b.appendChild(t),_.push(t)),!r.onlyZeroWidthSpace(e)){C=a,x="",y=[];const t=[];for(;C!==b&&C!==f&&null!==C;)1===C.nodeType&&z(C)&&(p(C)?t.push(C.cloneNode(!1)):y.push(C.cloneNode(!1)),x+=C.style.cssText.substr(0,C.style.cssText.indexOf(":"))+"|"),C=C.parentNode;for(y=y.concat(t),d=w=C=y.pop()||e;y.length>0;)C=y.pop(),w.appendChild(C),w=C;b.appendChild(d),C.textContent=e.data}if(E&&d){const e=g(d);e&&(E=e)}for(C=a,y=[],x="";C!==b&&C!==f&&null!==C;)i=p(C)?null:n(C),i&&1===C.nodeType&&z(C)&&(y.push(i),x+=C.style.cssText.substr(0,C.style.cssText.indexOf(":"))+"|"),C=C.parentNode;const o=y.pop()||l;for(w=C=o;y.length>0;)C=y.pop(),w.appendChild(C),w=C;E?((t=t.cloneNode(!1)).appendChild(o),E.insertBefore(t,E.firstChild),b.appendChild(E),_.push(t),E=null):t.appendChild(o),T=l,L=l.data.length,A=!0,!c&&u&&(t=l,l.textContent=r.zeroWidthSpace),C!==l&&C.appendChild(T)}}}(e,b),d&&!c&&!h.v)return{ancestor:e,startContainer:i,startOffset:l,endContainer:o,endOffset:s};if(c=c&&d)for(let e=0;e<_.length;e++){let t,n,i,l=_[e];if(u)t=r.createTextNode(r.zeroWidthSpace),b.replaceChild(t,l);else{const e=l.childNodes;for(n=e[0];e[0];)i=e[0],b.insertBefore(i,l);r.removeItem(l)}0===e&&(u?S=T=t:(S=n,T=i))}else{if(d)for(let e=0;e<_.length;e++)this._stripRemoveNode(_[e]);u&&(S=T=t)}r.removeEmptyNode(b,t),u&&(N=S.textContent.length,L=T.textContent.length);const M=c||0===T.textContent.length;r.isBreak(T)||0!==T.textContent.length||(r.removeItem(T),T=S),L=M?T.textContent.length:L;const H={s:0,e:0},I=r.getNodePath(S,b,H),D=!T.parentNode;D&&(T=S);const O={s:0,e:0},F=r.getNodePath(T,b,D||M?null:O);N+=H.s,L=u?N:D?S.textContent.length:M?L+H.s:L+O.s;const R=r.mergeSameTags(b,[I,F],!0);return e.parentNode.replaceChild(b,e),S=r.getNodeFromPath(I,b),T=r.getNodeFromPath(F,b),{ancestor:b,startContainer:S,startOffset:N+R[0],endContainer:T,endOffset:L+R[1]}},_nodeChange_startLine:function(e,t,n,i,l,o,s,a,c,d,u){let h=i.parentNode;for(;!(h.nextSibling||h.previousSibling||r.isFormatElement(h.parentNode)||r.isWysiwygDiv(h.parentNode))&&h.nodeName!==t.nodeName;)h=h.parentNode;if(!s&&h.nodeName===t.nodeName&&!r.isFormatElement(h)&&!h.nextSibling&&r.onlyZeroWidthSpace(i.textContent.slice(0,l))){let n=!0,o=i.previousSibling;for(;o;){if(!r.onlyZeroWidthSpace(o)){n=!1;break}o=o.previousSibling}if(n)return r.copyTagAttributes(h,t),{ancestor:e,container:i,offset:l}}a.v=!1;const g=e,p=[t],m=e.cloneNode(!1);let f,_,b,v,y=i,C=l,w=!1;if(function e(i,l){const o=i.childNodes;for(let i,s,a=0,h=o.length;a0,y=f.pop()||h;for(b=_=y;f.length>0;)_=f.pop(),b.appendChild(_),b=_;if(d(t.parentNode)&&!d(y)&&(t=t.cloneNode(!1),m.appendChild(t),p.push(t)),!v&&d(y)){t=t.cloneNode(!1);const e=y.childNodes;for(let n=0,i=e.length;n0;)_=f.pop(),b.appendChild(_),b=_;d!==l?(t.appendChild(d),l=_):l=t,r.isBreak(h)&&t.appendChild(h.cloneNode(!1)),e.appendChild(t),y=s,C=0,w=!0,l.appendChild(y)}}}(e,m),s&&!o&&!a.v)return{ancestor:e,container:i,offset:l,endContainer:u};if(o=o&&s)for(let e=0;e0&&u===h)return e.innerHTML=i.innerHTML,{ancestor:e,endContainer:n?r.getNodeFromPath(n,e):null}}o.v=!1;const a=e.cloneNode(!1),c=[t];let d=!0;if(function e(i,l){const o=i.childNodes;for(let i,u,h=0,g=o.length;h0&&(a.appendChild(t),t=t.cloneNode(!1)),u=g.cloneNode(!0),a.appendChild(u),a.appendChild(t),c.push(t),l=t,s&&g.contains(s)){const e=r.getNodePath(s,g);s=r.getNodeFromPath(e,u)}}}(e,t),d||l&&!i&&!o.v)return{ancestor:e,endContainer:s};if(a.appendChild(t),i&&l)for(let e=0;e0,u=m.pop()||a;for(_=f=u;m.length>0;)f=m.pop(),_.appendChild(f),_=f;if(d(t.parentNode)&&!d(u)&&(t=t.cloneNode(!1),p.insertBefore(t,p.firstChild),g.push(t)),!b&&d(u)){t=t.cloneNode(!1);const e=u.childNodes;for(let n=0,i=e.length;n0?f:t}else s?(t.insertBefore(u,t.firstChild),l=f):l=t;if(b&&3===a.nodeType)if(c(a)){const e=r.getParentElement(l,function(e){return this._isMaintainedNode(e.parentNode)||e.parentNode===p}.bind(r));b.appendChild(e),t=e.cloneNode(!1),g.push(t),p.insertBefore(t,p.firstChild)}else b=null}if(C||a!==v)i=C?n(a):a.cloneNode(!1),i&&(l.insertBefore(i,l.firstChild),1!==a.nodeType||r.isBreak(a)||(u=i)),e(a,u);else{b=c(a);const e=r.createTextNode(1===v.nodeType?"":v.substringData(y,v.length-y)),o=r.createTextNode(1===v.nodeType?"":v.substringData(0,y));if(b){b=b.cloneNode(!1);const e=c(l);if(e&&e.parentNode!==p){let t=e,n=null;for(;t.parentNode!==p;){for(l=n=t.parentNode.cloneNode(!1);t.childNodes[0];)n.appendChild(t.childNodes[0]);t.appendChild(n),t=t.parentNode}t.parentNode.insertBefore(e,t.parentNode.firstChild)}b=b.cloneNode(!1)}else d(t.parentNode)&&!b&&(t=t.cloneNode(!1),p.appendChild(t),g.push(t));for(r.onlyZeroWidthSpace(e)||l.insertBefore(e,l.firstChild),f=l,m=[];f!==p&&null!==f;)i=d(f)?null:n(f),i&&1===f.nodeType&&m.push(i),f=f.parentNode;const s=m.pop()||l;for(_=f=s;m.length>0;)f=m.pop(),_.appendChild(f),_=f;s!==l?(t.insertBefore(s,t.firstChild),l=f):l=t,r.isBreak(a)&&t.appendChild(a.cloneNode(!1)),b?(b.insertBefore(t,b.firstChild),p.insertBefore(b,p.firstChild),b=null):p.insertBefore(t,p.firstChild),v=o,y=o.data.length,C=!0,l.insertBefore(v,l.firstChild)}}}(e,p),s&&!o&&!a.v)return{ancestor:e,container:i,offset:l};if(o=o&&s)for(let e=0;e-1?null:r.createElement(n);let d=n;/^SUB$/i.test(n)&&a.indexOf("SUP")>-1?d="SUP":/^SUP$/i.test(n)&&a.indexOf("SUB")>-1&&(d="SUB"),this.nodeChange(c,null,[d],!1),this.focus()}},removeFormat:function(){this.nodeChange(null,null,null,null)},indent:function(e){const t=this.getRange(),n=this.getSelectedElements(null),i=[],l="indent"!==e;let o=t.startContainer,s=t.endContainer,a=t.startOffset,c=t.endOffset;for(let e,t,o=0,s=n.length;o0&&this.plugins.list.editInsideList.call(this,l,i),this.effectNode=null,this.setRange(o,a,s,c),this.history.push(!1)},toggleDisplayBlocks:function(){const t=e.element.wysiwyg;r.toggleClass(t,"se-show-block"),r.hasClass(t,"se-show-block")?r.addClass(this._styleCommandMap.showBlocks,"active"):r.removeClass(this._styleCommandMap.showBlocks,"active"),this._resourcesStateChange()},toggleCodeView:function(){const t=this._variable.isCodeView;this.controllersOff(),r.setDisabledButtons(!t,this.codeViewDisabledButtons),t?(this._setCodeDataToEditor(),e.element.wysiwygFrame.scrollTop=0,e.element.code.style.display="none",e.element.wysiwygFrame.style.display="block",this._variable._codeOriginCssText=this._variable._codeOriginCssText.replace(/(\s?display(\s+)?:(\s+)?)[a-zA-Z]+(?=;)/,"display: none"),this._variable._wysiwygOriginCssText=this._variable._wysiwygOriginCssText.replace(/(\s?display(\s+)?:(\s+)?)[a-zA-Z]+(?=;)/,"display: block"),"auto"!==l.height||l.codeMirrorEditor||(e.element.code.style.height="0px"),this._variable.isCodeView=!1,this._variable.isFullScreen||(this._notHideToolbar=!1,/balloon|balloon-always/i.test(l.mode)&&(e.element._arrow.style.display="",this._isInline=!1,this._isBalloon=!0,u._hideToolbar())),this.nativeFocus(),r.removeClass(this._styleCommandMap.codeView,"active"),this.history.push(!1)):(this._setEditorDataToCodeView(),this._variable._codeOriginCssText=this._variable._codeOriginCssText.replace(/(\s?display(\s+)?:(\s+)?)[a-zA-Z]+(?=;)/,"display: block"),this._variable._wysiwygOriginCssText=this._variable._wysiwygOriginCssText.replace(/(\s?display(\s+)?:(\s+)?)[a-zA-Z]+(?=;)/,"display: none"),"auto"!==l.height||l.codeMirrorEditor||(e.element.code.style.height=e.element.code.scrollHeight>0?e.element.code.scrollHeight+"px":"auto"),l.codeMirrorEditor&&l.codeMirrorEditor.refresh(),this._variable.isCodeView=!0,this._variable.isFullScreen||(this._notHideToolbar=!0,this._isBalloon&&(e.element._arrow.style.display="none",e.element.toolbar.style.left="",this._isInline=!0,this._isBalloon=!1,u._showToolbarInline())),this._variable._range=null,e.element.code.focus(),r.addClass(this._styleCommandMap.codeView,"active")),this._checkPlaceholder(),"function"==typeof h.toggleCodeView&&h.toggleCodeView(this._variable.isCodeView,this)},_setCodeDataToEditor:function(){const t=this._getCodeView();if(l.fullPage){const e=this._parser.parseFromString(t,"text/html"),n=e.head.children;for(let t=0,i=n.length;t0?this.convertContentsForEditor(t):"


    "},_setEditorDataToCodeView:function(){const t=this.convertHTMLForCodeView(e.element.wysiwyg);let n="";if(l.fullPage){const e=r.getAttributesToString(this._wd.body,null);n="\n\n"+this._wd.head.outerHTML.replace(/>(?!\n)/g,">\n")+"\n"+t+"\n"}else n=t;e.element.code.style.display="block",e.element.wysiwygFrame.style.display="none",this._setCodeView(n)},toggleFullScreen:function(t){const n=e.element.topArea,i=e.element.toolbar,o=e.element.editorArea,d=e.element.wysiwygFrame,g=e.element.code,p=this._variable;this.controllersOff(),p.isFullScreen?(p.isFullScreen=!1,d.style.cssText=p._wysiwygOriginCssText,g.style.cssText=p._codeOriginCssText,i.style.cssText="",o.style.cssText=p._editorAreaOriginCssText,n.style.cssText=p._originCssText,s.body.style.overflow=p._bodyOverflow,l.toolbarContainer&&l.toolbarContainer.appendChild(i),l.stickyToolbar>-1&&r.removeClass(i,"se-toolbar-sticky"),p._fullScreenAttrs.sticky&&!l.toolbarContainer&&(p._fullScreenAttrs.sticky=!1,e.element._stickyDummy.style.display="block",r.addClass(i,"se-toolbar-sticky")),this._isInline=p._fullScreenAttrs.inline,this._isBalloon=p._fullScreenAttrs.balloon,this._isInline&&u._showToolbarInline(),l.toolbarContainer&&r.removeClass(i,"se-toolbar-balloon"),u.onScroll_window(),r.changeElement(t.firstElementChild,c.expansion),r.removeClass(this._styleCommandMap.fullScreen,"active")):(p.isFullScreen=!0,p._fullScreenAttrs.inline=this._isInline,p._fullScreenAttrs.balloon=this._isBalloon,(this._isInline||this._isBalloon)&&(this._isInline=!1,this._isBalloon=!1),l.toolbarContainer&&e.element.relative.insertBefore(i,o),n.style.position="fixed",n.style.top="0",n.style.left="0",n.style.width="100%",n.style.maxWidth="100%",n.style.height="100%",n.style.zIndex="2147483647",""!==e.element._stickyDummy.style.display&&(p._fullScreenAttrs.sticky=!0,e.element._stickyDummy.style.display="none",r.removeClass(i,"se-toolbar-sticky")),p._bodyOverflow=s.body.style.overflow,s.body.style.overflow="hidden",p._editorAreaOriginCssText=o.style.cssText,p._wysiwygOriginCssText=d.style.cssText,p._codeOriginCssText=g.style.cssText,o.style.cssText=i.style.cssText="",d.style.cssText=(d.style.cssText.match(/\s?display(\s+)?:(\s+)?[a-zA-Z]+;/)||[""])[0],g.style.cssText=(g.style.cssText.match(/\s?display(\s+)?:(\s+)?[a-zA-Z]+;/)||[""])[0],i.style.width=d.style.height=g.style.height="100%",i.style.position="relative",i.style.display="block",p.innerHeight_fullScreen=a.innerHeight-i.offsetHeight,o.style.height=p.innerHeight_fullScreen+"px",r.changeElement(t.firstElementChild,c.reduction),l.iframe&&"auto"===l.height&&(o.style.overflow="auto",this._iframeAutoHeight()),r.addClass(this._styleCommandMap.fullScreen,"active")),"function"==typeof h.toggleFullScreen&&h.toggleFullScreen(this._variable.isFullScreen,this)},print:function(){const e=r.createElement("IFRAME");e.style.display="none",s.body.appendChild(e);const t=r.getIframeDocument(e),n=this.getContents(!0),i=this._wd;if(l.iframe){const e=l.fullPage?r.getAttributesToString(i.body,["contenteditable"]):'class="sun-editor-editable"';t.write(""+i.head.innerHTML+""+n+"")}else{const e=s.head.getElementsByTagName("link"),i=s.head.getElementsByTagName("style");let l="";for(let t=0,n=e.length;t"+l+''+n+"")}this.showLoading(),a.setTimeout((function(){try{if(e.focus(),r.isIE_Edge||s.documentMode||a.StyleMedia)try{e.contentWindow.document.execCommand("print",!1,null)}catch(t){e.contentWindow.print()}else e.contentWindow.print()}catch(e){throw Error("[SUNEDITOR.core.print.fail] error: "+e)}finally{d.closeLoading(),r.removeItem(e)}}),1e3)},preview:function(){d.submenuOff(),d.containerOff(),d.controllersOff();const t=this.getContents(!0),n=a.open("","_blank");n.mimeType="text/html";const o=e.element.wysiwygFrame.offsetWidth+"px !important",c=this._wd;if(l.iframe){const e=l.fullPage?r.getAttributesToString(c.body,["contenteditable"]):'class="sun-editor-editable"';n.document.write(""+c.head.innerHTML+""+t+"")}else{const e=s.head.getElementsByTagName("link"),l=s.head.getElementsByTagName("style");let a="";for(let t=0,n=e.length;t'+i.toolbar.preview+""+a+''+t+"")}},setContents:function(t){const n=this.convertContentsForEditor(t);if(this._resetComponents(),this._variable.isCodeView){const e=this.convertHTMLForCodeView(n);this._setCodeView(e)}else e.element.wysiwyg.innerHTML=n,this.history.push(!1)},getContents:function(t){const n=e.element.wysiwyg.innerHTML,i=r.createElement("DIV");i.innerHTML=n;const o=r.getListChildren(i,(function(e){return/FIGCAPTION/i.test(e.nodeName)}));for(let e=0,t=o.length;e"+this._wd.head.outerHTML+""+i.innerHTML+""}return i.innerHTML},_makeLine:function(e,t){if(1===e.nodeType)return r._disallowedTags(e)?"":!t||r.isFormatElement(e)||r.isRangeFormatElement(e)||r.isComponent(e)||r.isMedia(e)||r.isAnchor(e)&&r.isMedia(e.firstElementChild)?e.outerHTML:"

    "+e.outerHTML+"

    ";if(3===e.nodeType){if(!t)return e.textContent;const n=e.textContent.split(/\n/g);let i="";for(let e,t=0,l=n.length;t0&&(i+="

    "+e+"

    ");return i}return 8===e.nodeType&&this._allowHTMLComments?"\x3c!--"+e.textContent.trim()+"--\x3e":""},_tagConvertor:function(e){if(!this._disallowedTextTagsRegExp)return e;const t={b:"strong",i:"em",ins:"u",strike:"del",s:"del"};return e.replace(this._disallowedTextTagsRegExp,(function(e,n,i){return n+("string"==typeof t[i]?t[i]:i)}))},_deleteDisallowedTags:function(e){return e.replace(/\n/g,"").replace(/<(script|style).*>(\n|.)*<\/(script|style)>/gi,"").replace(/<[a-z0-9]+\:[a-z0-9]+[^>^\/]*>[^>]*<\/[a-z0-9]+\:[a-z0-9]+>/gi,"").replace(this.editorTagsWhitelistRegExp,"")},cleanHTML:function(e,t){e=this._deleteDisallowedTags(e).replace(/(<[a-zA-Z0-9]+)[^>]*(?=>)/g,function(e,t){if(/^<[a-z0-9]+\:[a-z0-9]+/i.test(e))return e;let n=null;const i=this._attributesTagsWhitelist[t.match(/(?!<)[a-zA-Z0-9]+/)[0].toLowerCase()];if(n=i?e.match(i):e.match(this._attributesWhitelistRegExp),/

    ":(i=r.htmlRemoveWhiteSpace(i),this._tagConvertor(i))},convertHTMLForCodeView:function(e){let t="";const n=a.RegExp,i=new n("^(BLOCKQUOTE|PRE|TABLE|THEAD|TBODY|TR|TH|TD|OL|UL|IMG|IFRAME|VIDEO|AUDIO|FIGURE|FIGCAPTION|HR|BR|CANVAS|SELECT)$","i"),l=r.isFormatElement.bind(r),o="string"==typeof e?s.createRange().createContextualFragment(e):e;let c=1*this._variable.codeIndent;return c=c>0?new a.Array(c+1).join(" "):"",function e(o,s,a){const d=o.childNodes,u=i.test(o.nodeName),h=u?s:"";for(let g,p,m,f=0,_=d.length;f<_;f++){if(g=d[f],m=i.test(g.nodeName),p=m?"\n":"",a=!l(g)||u||/^(TH|TD)$/i.test(o.nodeName)?"":"\n",8===g.nodeType){t+="\n\x3c!-- "+g.textContent.trim()+" --\x3e"+p;continue}if(3===g.nodeType){t+=r._HTMLConvertor(/^\n+$/.test(g.data)?"":g.data);continue}if(0===g.childNodes.length){t+=(/^HR$/i.test(g.nodeName)?"\n":"")+h+g.outerHTML+p;continue}g.innerHTML=g.innerHTML;const _=g.nodeName.toLowerCase();t+=(a||(u?"":p))+(h||m?s:"")+g.outerHTML.match(n("<"+_+"[^>]*>","i"))[0]+p,e(g,s+c,""),t+=(m?s:"")+""+(a||p||u||/^(TH|TD)$/i.test(g.nodeName)?"\n":"")}}(o,"","\n"),t.trim()+"\n"},addDocEvent:function(e,t,n){s.addEventListener(e,t,n),l.iframe&&this._wd.addEventListener(e,t)},removeDocEvent:function(e,t){s.removeEventListener(e,t),l.iframe&&this._wd.removeEventListener(e,t)},_charCount:function(e){const t=l.maxCharCount,n=l.charCounterType;let i=0;if(e&&(i=this.getCharLength(e,n)),this._setCharCount(),t>0){let e=!1;const l=h.getCharCount(n);if(l>t){if(e=!0,i>0){this._editorRange();const e=this.getRange(),n=e.endOffset-1,i=this.getSelectionNode().textContent,o=e.endOffset-(l-t);this.getSelectionNode().textContent=i.slice(0,o<0?0:o)+i.slice(e.endOffset,i.length),this.setRange(e.endContainer,n,e.endContainer,n)}}else l+i>t&&(e=!0);if(e&&(this._callCounterBlink(),i>0))return!1}return!0},checkCharCount:function(e,t){if(l.maxCharCount){const n=t||l.charCounterType,i=this.getCharLength("string"==typeof e?e:this._charTypeHTML?e.outerHTML:e.textContent,n);if(i>0&&i+h.getCharCount(n)>l.maxCharCount)return this._callCounterBlink(),!1}return!0},getCharLength:function(e,t){return/byte/.test(t)?r.getByteLength(e):e.length},_setCharCount:function(){e.element.charCounter&&a.setTimeout((function(){e.element.charCounter.textContent=h.getCharCount(l.charCounterType)}))},_callCounterBlink:function(){const t=e.element.charWrapper;t&&!r.hasClass(t,"se-blink")&&(r.addClass(t,"se-blink"),a.setTimeout((function(){r.removeClass(t,"se-blink")}),600))},_checkComponents:function(){for(let e=0,t=this._fileInfoPluginsCheck.length;e^<]+)?\\s*(?=>)","gi");const h="contenteditable|colspan|rowspan|target|href|src|class|type|controls|data-format|data-size|data-file-size|data-file-name|data-origin|data-align|data-image-link|data-rotate|data-proportion|data-percentage|origin-size|data-exp|data-font-size";this._allowHTMLComments=l._editorTagsWhitelist.indexOf("//")>-1,this._htmlCheckWhitelistRegExp=new c("^("+l._editorTagsWhitelist.replace("|//","")+")$","i"),this.editorTagsWhitelistRegExp=r.createTagsWhitelist(l._editorTagsWhitelist.replace("|//","|\x3c!--|--\x3e")),this.pasteTagsWhitelistRegExp=r.createTagsWhitelist(l.pasteTagsWhitelist);const g=l.attributesWhitelist,p={};let m="";if(g)for(let e in g)r.hasOwn(g,e)&&("all"===e?m=g[e]+"|":p[e]=new c("((?:"+g[e]+"|"+h+')s*=s*"[^"]*")',"ig"));this._attributesWhitelistRegExp=new c("((?:"+m+h+')s*=s*"[^"]*")',"ig"),this._attributesTagsWhitelist=p,this._isInline=/inline/i.test(l.mode),this._isBalloon=/balloon|balloon-always/i.test(l.mode),this._isBalloonAlways=/balloon-always/i.test(l.mode),this._cachingButtons(),this._fileInfoPluginsCheck=[],this._fileInfoPluginsReset=[],this.managedTagsInfo={query:"",map:{}};const f=[];this.activePlugins=[],this._fileManager.tags=[],this._fileManager.pluginMap={};let _,b,v=[];for(let e in n)if(r.hasOwn(n,e)){if(_=n[e],b=t[e],_.active&&b&&this.callPlugin(e,null,b),"function"==typeof _.checkFileInfo&&"function"==typeof _.resetFileInfo&&(this.callPlugin(e,null,b),this._fileInfoPluginsCheck.push(_.checkFileInfo.bind(this)),this._fileInfoPluginsReset.push(_.resetFileInfo.bind(this))),a.Array.isArray(_.fileTags)){const t=_.fileTags;this.callPlugin(e,null,b),this._fileManager.tags=this._fileManager.tags.concat(t),v.push(e);for(let n=0,i=t.length;nc&&(d=d.slice(0,c),a&&a.setAttribute("disabled",!0)),d[c]=l?{contents:n,s:{path:i.getNodePath(l.startContainer,null,null),offset:l.startOffset},e:{path:i.getNodePath(l.endContainer,null,null),offset:l.endOffset}}:{contents:n,s:{path:[0,0],offset:[0,0]},e:{path:0,offset:0}},1===c&&s&&s.removeAttribute("disabled"),e._setCharCount(),t()}return{stack:d,push:function(t){n.setTimeout(e._resourcesStateChange.bind(e));const i="number"==typeof t?t>0?t:0:t?l:0;i&&!r||(n.clearTimeout(r),i)?r=n.setTimeout((function(){n.clearTimeout(r),r=null,h()}),i):h()},undo:function(){c>0&&(c--,u())},redo:function(){d.length-1>c&&(c++,u())},go:function(e){c=e<0?d.length-1:e,u()},reset:function(n){s&&s.setAttribute("disabled",!0),a&&a.setAttribute("disabled",!0),e.context.tool.save&&e.context.tool.save.setAttribute("disabled",!0),d.splice(0),c=0,d[c]={contents:e.getContents(!0),s:{path:[0,0],offset:0},e:{path:[0,0],offset:0}},n||t()},_resetCachingButton:function(){o=e.context.element,s=e.context.tool.undo,a=e.context.tool.redo,0===c?(s&&s.setAttribute("disabled",!0),a&&c===d.length-1&&a.setAttribute("disabled",!0),e.context.tool.save&&e.context.tool.save.setAttribute("disabled",!0)):c===d.length-1&&a&&a.setAttribute("disabled",!0)},_destroy:function(){r&&n.clearTimeout(r),d=null}}}(this,this._onChange_historyStack.bind(this)),this.addModule([B]),l.iframe&&(this._wd=e.element.wysiwygFrame.contentDocument,e.element.wysiwyg=this._wd.body,l._editorStyles.editor&&(e.element.wysiwyg.style.cssText=l._editorStyles.editor),"auto"===l.height&&(this._iframeAuto=this._wd.body)),this._initWysiwygArea(i,o)},_cachingButtons:function(){this.codeViewDisabledButtons=e.element.toolbar.querySelectorAll('.se-toolbar button:not([class~="se-code-view-enabled"])'),this.resizingDisabledButtons=e.element.toolbar.querySelectorAll('.se-toolbar button:not([class~="se-resizing-enabled"])');const t=e.tool;this.commandMap={STRONG:t.bold,U:t.underline,EM:t.italic,DEL:t.strike,SUB:t.subscript,SUP:t.superscript,OUTDENT:t.outdent,INDENT:t.indent},this._styleCommandMap={fullScreen:t.fullScreen,showBlocks:t.showBlocks,codeView:t.codeView}},_initWysiwygArea:function(t,n){e.element.wysiwyg.innerHTML=t?n:this.convertContentsForEditor("string"==typeof n?n:e.element.originElement.value)},_resourcesStateChange:function(){this._iframeAutoHeight(),this._checkPlaceholder()},_onChange_historyStack:function(){u._applyTagEffects(),e.tool.save&&e.tool.save.removeAttribute("disabled"),h.onChange&&h.onChange(this.getContents(!0),this)},_iframeAutoHeight:function(){this._iframeAuto&&a.setTimeout((function(){e.element.wysiwygFrame.style.height=d._iframeAuto.offsetHeight+"px"}))},_checkPlaceholder:function(){if(this._placeholder){if(this._variable.isCodeView)return void(this._placeholder.style.display="none");const t=e.element.wysiwyg;!r.onlyZeroWidthSpace(t.textContent)||t.querySelector(".se-component, pre, blockquote, hr, li, table, img, iframe, video")||(t.innerText.match(/\n/g)||"").length>1?this._placeholder.style.display="none":this._placeholder.style.display="block"}},_setDefaultFormat:function(e){if(this._fileManager.pluginRegExp.test(this.currentControllerName))return;const t=this.getRange(),n=t.commonAncestorContainer,i=t.startContainer,l=r.getRangeFormatElement(n,null);let o,s,a;const c=r.getParentElement(n,r.isComponent);if((!c||r.isTable(c))&&(!r.isRangeFormatElement(i)&&!r.isWysiwygDiv(i)||!r.isComponent(i.childNodes[t.startOffset]))){if(l)return a=r.createElement(e||"P"),a.innerHTML=l.innerHTML,0===a.childNodes.length&&(a.innerHTML=r.zeroWidthSpace),l.innerHTML=a.outerHTML,a=l.firstChild,o=r.getEdgeChildNodes(a,null).sc,o||(o=r.createTextNode(r.zeroWidthSpace),a.insertBefore(o,a.firstChild)),s=o.textContent.length,void this.setRange(o,s,o,s);if(r.isRangeFormatElement(n)&&n.childNodes.length<=1){let e=null;return 1===n.childNodes.length&&r.isBreak(n.firstChild)?e=n.firstChild:(e=r.createTextNode(r.zeroWidthSpace),n.appendChild(e)),void this.setRange(e,1,e,1)}if(this.execCommand("formatBlock",!1,e||"P"),o=r.getEdgeChildNodes(n,n),o=o?o.ec:n,a=r.getFormatElement(o,null),!a)return this.removeRange(),void this._editorRange();if(r.isBreak(a.nextSibling)&&r.removeItem(a.nextSibling),r.isBreak(a.previousSibling)&&r.removeItem(a.previousSibling),r.isBreak(o)){const e=r.createTextNode(r.zeroWidthSpace);o.parentNode.insertBefore(e,o),o=e}this.effectNode=null,this.nativeFocus()}},_setOptionsInit:function(t,n){this.context=e=A(t.originElement,this._getConstructed(t),l),this._componentsInfoReset=!0,this._editorInit(!0,n)},_editorInit:function(t,n){this._init(t,n),u._addEvent(),this._setCharCount(),u._offStickyToolbar(),u.onResize_window(),e.element.toolbar.style.visibility="",this._checkComponents(),this._componentsInfoInit=!1,this._componentsInfoReset=!1,this.history.reset(!0),this._resourcesStateChange(),a.setTimeout((function(){"function"==typeof h.onload&&h.onload(d,t)}))},_getConstructed:function(e){return{_top:e.topArea,_relative:e.relative,_toolBar:e.toolbar,_menuTray:e._menuTray,_editorArea:e.editorArea,_wysiwygArea:e.wysiwygFrame,_codeArea:e.code,_placeholder:e.placeholder,_resizingBar:e.resizingBar,_navigation:e.navigation,_charCounter:e.charCounter,_charWrapper:e.charWrapper,_loading:e.loading,_lineBreaker:e.lineBreaker,_lineBreaker_t:e.lineBreaker_t,_lineBreaker_b:e.lineBreaker_b,_resizeBack:e.resizeBackground,_stickyDummy:e._stickyDummy,_arrow:e._arrow}}},u={_IEisComposing:!1,_lineBreakerBind:null,_responsiveCurrentSize:"default",_responsiveButtonSize:null,_responsiveButtons:null,_directionKeyCode:new a.RegExp("^(8|13|3[2-9]|40|46)$"),_nonTextKeyCode:new a.RegExp("^(8|13|1[6-9]|20|27|3[3-9]|40|45|46|11[2-9]|12[0-3]|144|145)$"),_historyIgnoreKeyCode:new a.RegExp("^(1[6-9]|20|27|3[3-9]|40|45|11[2-9]|12[0-3]|144|145)$"),_onButtonsCheck:new a.RegExp("^(STRONG|U|EM|DEL|SUB|SUP)$"),_frontZeroWidthReg:new a.RegExp(r.zeroWidthSpace+"+",""),_keyCodeShortcut:{65:"A",66:"B",83:"S",85:"U",73:"I",89:"Y",90:"Z",219:"[",221:"]"},_shortcutCommand:function(e,t){let n=null;switch(u._keyCodeShortcut[e]){case"A":n="selectAll";break;case"B":-1===l.shortcutsDisable.indexOf("bold")&&(n="STRONG");break;case"S":t&&-1===l.shortcutsDisable.indexOf("strike")&&(n="DEL");break;case"U":-1===l.shortcutsDisable.indexOf("underline")&&(n="U");break;case"I":-1===l.shortcutsDisable.indexOf("italic")&&(n="EM");break;case"Z":-1===l.shortcutsDisable.indexOf("undo")&&(n=t?"redo":"undo");break;case"Y":-1===l.shortcutsDisable.indexOf("undo")&&(n="redo");break;case"[":-1===l.shortcutsDisable.indexOf("indent")&&(n="outdent");break;case"]":-1===l.shortcutsDisable.indexOf("indent")&&(n="indent")}return!!n&&(d.commandHandler(d.commandMap[n],n),!0)},_applyTagEffects:function(){let t=d.getSelectionNode();if(t===d.effectNode)return;d.effectNode=t;const i=d.commandMap,o=this._onButtonsCheck,s=[],a=[],c=d.activePlugins,u=c.length;let h="";for(;t.firstChild;)t=t.firstChild;for(let e=t;!r.isWysiwygDiv(e)&&e;e=e.parentNode)if(1===e.nodeType&&!r.isBreak(e)){h=e.nodeName.toUpperCase(),a.push(h);for(let t,i=0;i0)&&(s.push("OUTDENT"),i.OUTDENT.removeAttribute("disabled")),-1===s.indexOf("INDENT")&&i.INDENT&&r.isListCell(e)&&!e.previousElementSibling&&(s.push("INDENT"),i.INDENT.setAttribute("disabled",!0))):o.test(h)&&(s.push(h),r.addClass(i[h],"active"))}for(let e in i)s.indexOf(e)>-1||!r.hasOwn(i,e)||(c.indexOf(e)>-1?n[e].active.call(d,null):i.OUTDENT&&/^OUTDENT$/i.test(e)?i.OUTDENT.setAttribute("disabled",!0):i.INDENT&&/^INDENT$/i.test(e)?i.INDENT.removeAttribute("disabled"):r.removeClass(i[e],"active"));d._variable.currentNodes=a.reverse(),d._variable.currentNodesMap=s,l.showPathLabel&&(e.element.navigation.textContent=d._variable.currentNodes.join(" > "))},_cancelCaptionEdit:function(){this.setAttribute("contenteditable",!1),this.removeEventListener("blur",u._cancelCaptionEdit)},_buttonsEventHandler:function(e){let t=e.target;if(d._bindControllersOff&&e.stopPropagation(),/^(input|textarea|select|option)$/i.test(t.nodeName)?d._antiBlur=!1:e.preventDefault(),r.getParentElement(t,".se-submenu"))e.stopPropagation(),d._notHideToolbar=!0;else{let n=t.getAttribute("data-command"),i=t.className;for(;!n&&!/se-menu-list/.test(i)&&!/sun-editor-common/.test(i);)t=t.parentNode,n=t.getAttribute("data-command"),i=t.className;n!==d._submenuName&&n!==d._containerName||e.stopPropagation()}},onClick_toolbar:function(e){let t=e.target,n=t.getAttribute("data-display"),i=t.getAttribute("data-command"),l=t.className;for(;t.parentNode&&!i&&!/se-menu-list/.test(l)&&!/se-toolbar/.test(l);)t=t.parentNode,i=t.getAttribute("data-command"),n=t.getAttribute("data-display"),l=t.className;(i||n)&&(t.disabled||(d.hasFocus||d.nativeFocus(),d._variable.isCodeView||d._editorRange(),d.actionCall(i,n,t)))},onMouseDown_wysiwyg:function(t){if(r.isNonEditable(e.element.wysiwyg))return;const n=r.getParentElement(t.target,r.isCell);if(n){const e=d.plugins.table;e&&n!==e._fixedCell&&!e._shift&&d.callPlugin("table",(function(){e.onTableCellMultiSelect.call(d,n,!1)}),null)}d._isBalloon&&u._hideToolbar(),/FIGURE/i.test(t.target.nodeName)&&t.preventDefault(),"function"==typeof h.onMouseDown&&h.onMouseDown(t,d)},onClick_wysiwyg:function(t){const n=t.target;if(r.isNonEditable(e.element.wysiwyg))return;const i=d.getFileComponent(n);if(i)return t.preventDefault(),void d.selectComponent(i.target,i.pluginName);const l=r.getParentElement(n,"FIGCAPTION");if(r.isNonEditable(l)&&(t.preventDefault(),l.setAttribute("contenteditable",!0),l.focus(),d._isInline&&!d._inlineToolbarAttr.isShow)){u._showToolbarInline();const e=function(){u._hideToolbar(),l.removeEventListener("blur",e)};l.addEventListener("blur",e)}a.setTimeout(d._editorRange.bind(d)),d._editorRange();const o=d.getSelectionNode(),s=r.getFormatElement(o,null),c=r.getRangeFormatElement(o,null);if(s&&s!==c||r.isNonEditable(n)||r.isList(c))u._applyTagEffects();else{const e=d.getRange();if(r.getFormatElement(e.startContainer)===r.getFormatElement(e.endContainer)){if(r.isList(c)){const e=r.createElement("LI"),t=o.nextElementSibling;e.appendChild(o),c.insertBefore(e,t)}else r.isWysiwygDiv(o)||r.isComponent(o)||r.isTable(o)&&!r.isCell(o)||d._setDefaultFormat(r.isRangeFormatElement(c)?"DIV":"P");t.preventDefault(),d.focus()}}d._isBalloon&&a.setTimeout(u._toggleToolbarBalloon),"function"==typeof h.onClick&&h.onClick(t,d)},_balloonDelay:null,_showToolbarBalloonDelay:function(){u._balloonDelay&&a.clearTimeout(u._balloonDelay),u._balloonDelay=a.setTimeout(function(){a.clearTimeout(this._balloonDelay),this._balloonDelay=null,this._showToolbarBalloon()}.bind(u),350)},_toggleToolbarBalloon:function(){d._editorRange();const e=d.getRange();d._bindControllersOff||!d._isBalloonAlways&&e.collapsed?u._hideToolbar():u._showToolbarBalloon(e)},_showToolbarBalloon:function(t){if(!d._isBalloon)return;const n=t||d.getRange(),i=e.element.toolbar,l=d.getSelection();let o;if(d._isBalloonAlways&&n.collapsed)o=!0;else if(l.focusNode===l.anchorNode)o=l.focusOffset0&&u._getPageBottomSpace()C&&(t=!1,y=!0),y&&(b=(t?n.top-m-g:n.bottom+g)-(n.noText?0:h)+d),i.style.left=a.Math.floor(v)+"px",i.style.top=a.Math.floor(b)+"px",t?(r.removeClass(e.element._arrow,"se-arrow-up"),r.addClass(e.element._arrow,"se-arrow-down"),e.element._arrow.style.top=m+"px"):(r.removeClass(e.element._arrow,"se-arrow-down"),r.addClass(e.element._arrow,"se-arrow-up"),e.element._arrow.style.top=-g+"px");const w=a.Math.floor(p/2+(f-v));e.element._arrow.style.left=(w+g>i.offsetWidth?i.offsetWidth-g:w";const e=f.attributes;for(;e[0];)f.removeAttribute(e[0].name);return d.nativeFocus(),!1}}if(f&&g.startContainer===g.endContainer&&3===c.nodeType&&!r.isFormatElement(c.parentNode)&&(g.collapsed?1===c.textContent.length:g.endOffset-g.startOffset===c.textContent.length)){t.preventDefault();let e=null,n=c.parentNode.previousSibling;const i=c.parentNode.nextSibling;n||(i?(n=i,e=0):(n=r.createElement("BR"),f.appendChild(n))),c.textContent="",r.removeItemAllParents(c,null,f),e="number"==typeof e?e:3===n.nodeType?n.textContent.length:1,d.setRange(n,e,n,e);break}const n=g.commonAncestorContainer;if(f=r.getFormatElement(g.startContainer,null),_=r.getRangeFormatElement(f,null),_&&f&&!r.isCell(_)&&!/^FIGCAPTION$/i.test(_.nodeName)){if(r.isListCell(f)&&r.isList(_)&&(r.isListCell(_.parentNode)||f.previousElementSibling)&&(c===f||3===c.nodeType&&(!c.previousSibling||r.isList(c.previousSibling)))&&(r.getFormatElement(g.startContainer,null)!==r.getFormatElement(g.endContainer,null)?_.contains(g.startContainer):0===g.startOffset&&g.collapsed)){if(g.startContainer!==g.endContainer)t.preventDefault(),d.removeNode(),3===g.startContainer.nodeType&&d.setRange(g.startContainer,g.startContainer.textContent.length,g.startContainer,g.startContainer.textContent.length),d.history.push(!0);else{let e=f.previousElementSibling||_.parentNode;if(r.isListCell(e)){t.preventDefault();let n=e;if(!e.contains(f)&&r.isListCell(n)&&r.isList(n.lastElementChild)){for(n=n.lastElementChild.lastElementChild;r.isListCell(n)&&r.isList(n.lastElementChild);)n=n.lastElementChild&&n.lastElementChild.lastElementChild;e=n}let i=e===_.parentNode?_.previousSibling:e.lastChild;i||(i=r.createTextNode(r.zeroWidthSpace),_.parentNode.insertBefore(i,_.parentNode.firstChild));const l=3===i.nodeType?i.textContent.length:1,o=f.childNodes;let s=i,a=o[0];for(;a=o[0];)e.insertBefore(a,s.nextSibling),s=a;r.removeItem(f),0===_.children.length&&r.removeItem(_),d.setRange(i,l,i,l),d.history.push(!0)}}break}if(!p&&0===g.startOffset){let e=!0,i=n;for(;i&&i!==_&&!r.isWysiwygDiv(i);){if(i.previousSibling&&(1===i.previousSibling.nodeType||!r.onlyZeroWidthSpace(i.previousSibling.textContent.trim()))){e=!1;break}i=i.parentNode}if(e&&_.parentNode){t.preventDefault(),d.detachRangeFormatElement(_,r.isListCell(f)?[f]:null,null,!1,!1),d.history.push(!0);break}}}if(!p&&(0===g.startOffset||c===f&&f.childNodes[g.startOffset])){const e=c===f?f.childNodes[g.startOffset]:c,i=(3===n.nodeType||r.isBreak(n))&&!n.previousSibling&&0===g.startOffset;if(!e.previousSibling&&(r.isComponent(n.previousSibling)||i&&r.isComponent(f.previousSibling))){const e=d.getFileComponent(f.previousSibling);e&&(t.preventDefault(),t.stopPropagation(),0===f.textContent.length&&r.removeItem(f),d.selectComponent(e.target,e.pluginName));break}if(r.isNonEditable(e.previousSibling)){t.preventDefault(),t.stopPropagation(),r.removeItem(e.previousSibling);break}}break;case 46:if(m){t.preventDefault(),t.stopPropagation(),d.plugins[m].destroy.call(d);break}if(p&&u._hardDelete()){t.preventDefault(),t.stopPropagation();break}if((r.isFormatElement(c)||null===c.nextSibling||r.onlyZeroWidthSpace(c.nextSibling)&&null===c.nextSibling.nextSibling)&&g.startOffset===c.textContent.length){let e=f.nextElementSibling;if(!e){t.preventDefault();break}if(r.isComponent(e)){if(t.preventDefault(),r.onlyZeroWidthSpace(f)&&(r.removeItem(f),r.isTable(e))){let t=r.getChildElement(e,r.isCell,!1);t=t.firstElementChild||t,d.setRange(t,0,t,0);break}const n=d.getFileComponent(e);n&&(t.stopPropagation(),d.selectComponent(n.target,n.pluginName));break}}if(!p&&(d.isEdgePoint(g.endContainer,g.endOffset)||c===f&&f.childNodes[g.startOffset])){const e=c===f?f.childNodes[g.startOffset]:c;if(r.isNonEditable(e.nextSibling)){t.preventDefault(),t.stopPropagation(),r.removeItem(e.nextSibling);break}}if(f=r.getFormatElement(g.startContainer,null),_=r.getRangeFormatElement(f,null),r.isListCell(f)&&r.isList(_)&&(c===f||3===c.nodeType&&(!c.nextSibling||r.isList(c.nextSibling))&&(r.getFormatElement(g.startContainer,null)!==r.getFormatElement(g.endContainer,null)?_.contains(g.endContainer):g.endOffset===c.textContent.length&&g.collapsed))){g.startContainer!==g.endContainer&&d.removeNode();let e=r.getArrayItem(f.children,r.isList,!1);if(e=e||f.nextElementSibling||_.parentNode.nextElementSibling,e&&(r.isList(e)||r.getArrayItem(e.children,r.isList,!1))){let n,i;if(t.preventDefault(),r.isList(e)){const t=e.firstElementChild;for(i=t.childNodes,n=i[0];i[0];)f.insertBefore(i[0],e);r.removeItem(t)}else{for(n=e.firstChild,i=e.childNodes;i[0];)f.appendChild(i[0]);r.removeItem(e)}d.setRange(n,0,n,0),d.history.push(!0)}break}break;case 9:if(m||l.tabDisable)break;if(t.preventDefault(),o||s||r.isWysiwygDiv(c))break;const b=!g.collapsed||d.isEdgePoint(g.startContainer,g.startOffset),v=d.getSelectedElements(null);c=d.getSelectionNode();const y=[];let C=[],w=r.isListCell(v[0]),x=r.isListCell(v[v.length-1]),E={sc:g.startContainer,so:g.startOffset,ec:g.endContainer,eo:g.endOffset};for(let e,t=0,n=v.length;t0&&b&&d.plugins.list)E=d.plugins.list.editInsideList.call(d,i,y);else{const e=r.getParentElement(c,r.isCell);if(e&&b){const t=r.getParentElement(e,"table"),n=r.getListChildren(t,r.isCell);let l=i?r.prevIdx(n,e):r.nextIdx(n,e);l!==n.length||i||(l=0),-1===l&&i&&(l=n.length-1);let o=n[l];if(!o)break;o=o.firstElementChild||o,d.setRange(o,0,o,0);break}C=C.concat(y),w=x=null}if(C.length>0)if(i){const e=C.length-1;for(let t,n=0;n<=e;n++){t=C[n].childNodes;for(let e,n=0,i=t.length;n":"<"+f.nodeName+">
    ",!d.checkCharCount(e,"byte-html"))return t.preventDefault(),!1}if(!i&&S){t.preventDefault();const e=c===S,n=d.getSelection(),i=c.childNodes,l=n.focusOffset,o=c.previousElementSibling,s=c.nextSibling;if(!r.isClosureFreeFormatElement(S)&&i&&(e&&g.collapsed&&i.length-1<=l+1&&r.isBreak(i[l])&&(!i[l+1]||(!i[l+2]||r.onlyZeroWidthSpace(i[l+2].textContent))&&3===i[l+1].nodeType&&r.onlyZeroWidthSpace(i[l+1].textContent))&&l>0&&r.isBreak(i[l-1])||!e&&r.onlyZeroWidthSpace(c.textContent)&&r.isBreak(o)&&(r.isBreak(o.previousSibling)||!r.onlyZeroWidthSpace(o.previousSibling.textContent))&&(!s||!r.isBreak(s)&&r.onlyZeroWidthSpace(s.textContent)))){e?r.removeItem(i[l-1]):r.removeItem(c);const t=d.appendFormatTag(S,r.isFormatElement(S.nextElementSibling)?S.nextElementSibling:null);r.copyFormatAttributes(t,S),d.setRange(t,1,t,1);break}if(e){h.insertHTML(g.collapsed&&r.isBreak(g.startContainer.childNodes[g.startOffset-1])?"
    ":"

    ",!0,!1);let e=n.focusNode;const t=n.focusOffset;S===e&&(e=e.childNodes[t-l>1?t-1:t]),d.setRange(e,1,e,1)}else{const e=n.focusNode.nextSibling,t=r.createElement("BR");d.insertNode(t,null,!1);const i=t.previousSibling,l=t.nextSibling;r.isBreak(e)||r.isBreak(i)||l&&!r.onlyZeroWidthSpace(l)?d.setRange(l,0,l,0):(t.parentNode.insertBefore(t.cloneNode(!1),t),d.setRange(t,1,t,1))}u._onShortcutKey=!0;break}if(p)break;if(_&&f&&!r.isCell(_)&&!/^FIGCAPTION$/i.test(_.nodeName)){const e=d.getRange();if(d.isEdgePoint(e.endContainer,e.endOffset)&&r.isList(c.nextSibling)){t.preventDefault();const e=r.createElement("LI"),n=r.createElement("BR");e.appendChild(n),f.parentNode.insertBefore(e,f.nextElementSibling),e.appendChild(c.nextSibling),d.setRange(n,1,n,1);break}if((3!==e.commonAncestorContainer.nodeType||!e.commonAncestorContainer.nextElementSibling)&&r.onlyZeroWidthSpace(f.innerText.trim())){t.preventDefault();let e=null;if(r.isListCell(_.parentNode)){if(_=f.parentNode.parentNode.parentNode,e=r.splitElement(f,null,r.getElementDepth(f)-2),!e){const t=r.createElement("LI");t.innerHTML="
    ",_.insertBefore(t,e),e=t}}else{const t=r.isCell(_.parentNode)?"DIV":r.isList(_.parentNode)?"LI":r.isFormatElement(_.nextElementSibling)?_.nextElementSibling.nodeName:r.isFormatElement(_.previousElementSibling)?_.previousElementSibling.nodeName:"P";e=r.createElement(t);const n=d.detachRangeFormatElement(_,[f],null,!0,!0);n.cc.insertBefore(e,n.ec)}e.innerHTML="
    ",r.copyFormatAttributes(e,f),r.removeItemAllParents(f,null,null),d.setRange(e,1,e,1);break}}if(_&&r.getParentElement(_,"FIGCAPTION")&&r.getParentElement(_,r.isList)&&(t.preventDefault(),f=d.appendFormatTag(f,null),d.setRange(f,0,f,0)),m){t.preventDefault(),t.stopPropagation();const n=e[m],i=n._container,l=i.previousElementSibling||i.nextElementSibling;let o=null;r.isListCell(i.parentNode)?o=r.createElement("BR"):(o=r.createElement(r.isFormatElement(l)?l.nodeName:"P"),o.innerHTML="
    "),i.parentNode.insertBefore(o,i),d.callPlugin(m,(function(){d.selectComponent(n._element,m)}),null)}break;case 27:if(m)return t.preventDefault(),t.stopPropagation(),d.controllersOff(),!1}if(i&&/16/.test(n)){t.preventDefault(),t.stopPropagation();const e=d.plugins.table;if(e&&!e._shift&&!e._ref){const t=r.getParentElement(f,r.isCell);if(t)return void e.onTableCellMultiSelect.call(d,t,!0)}}if(!(o||s||p||u._nonTextKeyCode.test(n))&&g.collapsed&&g.startContainer===g.endContainer&&r.isBreak(g.commonAncestorContainer)){const e=r.createTextNode(r.zeroWidthSpace);d.insertNode(e,null,!1),d.setRange(e,1,e,1)}"function"==typeof h.onKeyDown&&h.onKeyDown(t,d)},onKeyUp_wysiwyg:function(e){if(u._onShortcutKey)return;d._editorRange();const t=d.getRange(),n=e.keyCode,i=e.ctrlKey||e.metaKey||91===n||92===n||224===n,l=e.altKey;let o=d.getSelectionNode();if(d._isBalloon&&(d._isBalloonAlways&&27!==n||!t.collapsed)){if(!d._isBalloonAlways)return void u._showToolbarBalloon();27!==n&&u._showToolbarBalloonDelay()}if(8===n&&r.isWysiwygDiv(o)&&""===o.textContent&&0===o.children.length){e.preventDefault(),e.stopPropagation(),o.innerHTML="";const t=r.createElement(r.isFormatElement(d._variable.currentNodes[0])?d._variable.currentNodes[0]:"P");return t.innerHTML="
    ",o.appendChild(t),d.setRange(t,0,t,0),u._applyTagEffects(),void d.history.push(!1)}const s=r.getFormatElement(o,null),a=r.getRangeFormatElement(o,null);(s||!t.collapsed)&&s!==a||r.isComponent(o)||r.isList(o)||(d._setDefaultFormat(r.isRangeFormatElement(a)?"DIV":"P"),o=d.getSelectionNode()),u._directionKeyCode.test(n)&&u._applyTagEffects();if(!i&&!l&&!u._nonTextKeyCode.test(n)&&3===o.nodeType&&r.zeroWidthRegExp.test(o.textContent)&&!(void 0!==e.isComposing?e.isComposing:u._IEisComposing)){let e=t.startOffset,n=t.endOffset;const i=(o.textContent.substring(0,n).match(u._frontZeroWidthReg)||"").length;e=t.startOffset-i,n=t.endOffset-i,o.textContent=o.textContent.replace(r.zeroWidthRegExp,""),d.setRange(o,e<0?0:e,o,n<0?0:n)}d._charCount(""),d.history.push(!0),"function"==typeof h.onKeyUp&&h.onKeyUp(e,d)},onScroll_wysiwyg:function(e){d.controllersOff(),d._lineBreaker.style.display="none",d._isBalloon&&u._hideToolbar(),"function"==typeof h.onScroll&&h.onScroll(e,d)},onFocus_wysiwyg:function(e){d._antiBlur||(d.hasFocus=!0,d._isInline&&u._showToolbarInline(),"function"==typeof h.onFocus&&h.onFocus(e,d))},onBlur_wysiwyg:function(t){if(d._antiBlur)return;d.hasFocus=!1,d.controllersOff(),(d._isInline||d._isBalloon)&&u._hideToolbar(),"function"==typeof h.onBlur&&h.onBlur(t,d);const i=d.commandMap,o=d.activePlugins;for(let e in i)r.hasOwn(i,e)&&(o.indexOf(e)>-1?n[e].active.call(d,null):i.OUTDENT&&/^OUTDENT$/i.test(e)?i.OUTDENT.setAttribute("disabled",!0):i.INDENT&&/^INDENT$/i.test(e)?i.INDENT.removeAttribute("disabled"):r.removeClass(i[e],"active"));d._variable.currentNodes=[],d._variable.currentNodesMap=[],l.showPathLabel&&(e.element.navigation.textContent="")},onMouseDown_resizingBar:function(t){t.stopPropagation(),d._variable.resizeClientY=t.clientY,e.element.resizeBackground.style.display="block",s.addEventListener("mousemove",u._resize_editor),s.addEventListener("mouseup",(function t(){e.element.resizeBackground.style.display="none",s.removeEventListener("mousemove",u._resize_editor),s.removeEventListener("mouseup",t)}))},_resize_editor:function(t){const n=e.element.editorArea.offsetHeight+(t.clientY-d._variable.resizeClientY);e.element.wysiwygFrame.style.height=e.element.code.style.height=(n=n+o?(d._sticky||u._onStickyToolbar(),t.toolbar.style.top=n+o+l.stickyToolbar-i-d._variable.minResizingSize+"px"):i>=o&&u._onStickyToolbar()},_getEditorOffsets:function(t){let n=t||e.element.topArea,i=0,l=0,o=0;for(;n;)i+=n.offsetTop,l+=n.offsetLeft,o+=n.scrollTop,n=n.offsetParent;return{top:i,left:l,scroll:o}},_getPageBottomSpace:function(){return s.documentElement.scrollHeight-(u._getEditorOffsets(null).top+e.element.topArea.offsetHeight)},_onStickyToolbar:function(){const t=e.element;d._isInline||l.toolbarContainer||(t._stickyDummy.style.height=t.toolbar.offsetHeight+"px",t._stickyDummy.style.display="block"),t.toolbar.style.top=l.stickyToolbar+"px",t.toolbar.style.width=d._isInline?d._inlineToolbarAttr.width:t.toolbar.offsetWidth+"px",r.addClass(t.toolbar,"se-toolbar-sticky"),d._sticky=!0},_offStickyToolbar:function(){const t=e.element;t._stickyDummy.style.display="none",t.toolbar.style.top=d._isInline?d._inlineToolbarAttr.top:"",t.toolbar.style.width=d._isInline?d._inlineToolbarAttr.width:"",t.editorArea.style.marginTop="",r.removeClass(t.toolbar,"se-toolbar-sticky"),d._sticky=!1},_codeViewAutoHeight:function(){e.element.code.style.height=e.element.code.scrollHeight+"px"},_hardDelete:function(){const e=d.getRange(),t=e.startContainer,n=e.endContainer,i=r.getRangeFormatElement(t),l=r.getRangeFormatElement(n),o=r.isCell(i),s=r.isCell(l);if((o&&!i.previousElementSibling&&!i.parentElement.previousElementSibling||s&&!l.nextElementSibling&&!l.parentElement.nextElementSibling)&&i!==l)if(o){if(s)return r.removeItem(r.getParentElement(i,r.isComponent)),d.nativeFocus(),!0;r.removeItem(r.getParentElement(i,r.isComponent))}else r.removeItem(r.getParentElement(l,r.isComponent));const a=1===t.nodeType?r.getParentElement(t,".se-component"):null,c=1===n.nodeType?r.getParentElement(n,".se-component"):null;return a&&r.removeItem(a),c&&r.removeItem(c),!1},onPaste_wysiwyg:function(e){const t=r.isIE?a.clipboardData:e.clipboardData;return!t||u._dataTransferAction("paste",e,t)},_setClipboardComponent:function(e,t,n){e.preventDefault(),e.stopPropagation(),n.setData("text/html",t.component.outerHTML)},onCopy_wysiwyg:function(e){const t=r.isIE?a.clipboardData:e.clipboardData;if("function"==typeof h.onCopy&&!h.onCopy(e,t,d))return e.preventDefault(),e.stopPropagation(),!1;const n=d.currentFileComponentInfo;n&&!r.isIE&&(u._setClipboardComponent(e,n,t),r.addClass(n.component,"se-component-copy"),a.setTimeout((function(){r.removeClass(n.component,"se-component-copy")}),150))},onCut_wysiwyg:function(e){const t=r.isIE?a.clipboardData:e.clipboardData;if("function"==typeof h.onCut&&!h.onCut(e,t,d))return e.preventDefault(),e.stopPropagation(),!1;const n=d.currentFileComponentInfo;n&&!r.isIE&&(u._setClipboardComponent(e,n,t),r.removeItem(n.component),d.controllersOff()),a.setTimeout((function(){d.history.push(!1)}))},onDrop_wysiwyg:function(e){const t=e.dataTransfer;return!t||(r.isIE?(e.preventDefault(),e.stopPropagation(),!1):(d.removeNode(),u._setDropLocationSelection(e),u._dataTransferAction("drop",e,t)))},_setDropLocationSelection:function(e){if(e.rangeParent)d.setRange(e.rangeParent,e.rangeOffset,e.rangeParent,e.rangeOffset);else if(d._wd.caretRangeFromPoint){const t=d._wd.caretRangeFromPoint(e.clientX,e.clientY);d.setRange(t.startContainer,t.startOffset,t.endContainer,t.endOffset)}else{const e=d.getRange();d.setRange(e.startContainer,e.startOffset,e.endContainer,e.endOffset)}},_dataTransferAction:function(t,n,i){let l,o;if(r.isIE){l=i.getData("Text");const s=d.getRange(),c=r.createElement("DIV"),h={sc:s.startContainer,so:s.startOffset,ec:s.endContainer,eo:s.endOffset};return c.setAttribute("contenteditable",!0),c.style.cssText="position:absolute; top:0; left:0; width:1px; height:1px; overflow:hidden;",e.element.relative.appendChild(c),c.focus(),a.setTimeout((function(){o=c.innerHTML,r.removeItem(c),d.setRange(h.sc,h.so,h.ec,h.eo),u._setClipboardData(t,n,l,o,i)})),!0}if(l=i.getData("text/plain"),o=i.getData("text/html"),!1===u._setClipboardData(t,n,l,o,i))return n.preventDefault(),n.stopPropagation(),!1},_setClipboardData:function(e,t,n,i,l){/class=["']*Mso(Normal|List)/i.test(i)||/content=["']*Word.Document/i.test(i)||/content=["']*OneNote.File/i.test(i)?(i=i.replace(/\n/g," "),n=n.replace(/\n/g," ")):n=n.replace(/\n/g,""),i=d.cleanHTML(i,d.pasteTagsWhitelistRegExp);const o=d._charCount(d._charTypeHTML?i:n);if("paste"===e&&"function"==typeof h.onPaste&&!h.onPaste(t,i,o,d))return!1;if("drop"===e&&"function"==typeof h.onDrop&&!h.onDrop(t,l,d))return!1;const s=l.files;return s.length>0?(/^image/.test(s[0].type)&&d.plugins.image&&h.insertImage(s),!1):!!o&&(i?(h.insertHTML(i,!0,!1),!1):void 0)},onMouseMove_wysiwyg:function(t){if(d.isDisabled)return;const n=r.getParentElement(t.target,r.isComponent),i=d._lineBreaker.style;if(n&&!d.currentControllerName){let o=0,s=e.element.wysiwyg;do{o+=s.scrollTop,s=s.parentElement}while(s&&!/^(BODY|HTML)$/i.test(s.nodeName));const a=e.element.wysiwyg.scrollTop,c=u._getEditorOffsets(null),h=r.getOffset(n,e.element.wysiwygFrame).top+a,g=t.pageY+o+(l.iframe&&!l.toolbarContainer?e.element.toolbar.offsetHeight:0),p=h+(l.iframe?o:c.top),m=r.isListCell(n.parentNode);let f="",_="";if((m?!n.previousSibling:!r.isFormatElement(n.previousElementSibling))&&gp+n.offsetHeight-20))return void(i.display="none");_=h+n.offsetHeight,f="b"}d._variable._lineBreakComp=n,d._variable._lineBreakDir=f,i.top=_-a+"px",d._lineBreakerButton.style.left=r.getOffset(n).left+n.offsetWidth/2-15+"px",i.display="block"}else"none"!==i.display&&(i.display="none")},_onMouseDown_lineBreak:function(e){e.preventDefault()},_onLineBreak:function(e){e.preventDefault();const t=d._variable._lineBreakComp,n=this?this:d._variable._lineBreakDir,i=r.isListCell(t.parentNode),l=r.createElement(i?"BR":r.isCell(t.parentNode)?"DIV":"P");if(i||(l.innerHTML="
    "),d._charTypeHTML&&!d.checkCharCount(l.outerHTML,"byte-html"))return;t.parentNode.insertBefore(l,"t"===n?t:t.nextSibling),d._lineBreaker.style.display="none",d._variable._lineBreakComp=null;const o=i?l:l.firstChild;d.setRange(o,1,o,1),d.history.push(!1)},_addEvent:function(){const t=l.iframe?d._ww:e.element.wysiwyg;e.element.toolbar.addEventListener("mousedown",u._buttonsEventHandler,!1),e.element._menuTray.addEventListener("mousedown",u._buttonsEventHandler,!1),e.element.toolbar.addEventListener("click",u.onClick_toolbar,!1),t.addEventListener("mousedown",u.onMouseDown_wysiwyg,!1),t.addEventListener("click",u.onClick_wysiwyg,!1),t.addEventListener(r.isIE?"textinput":"input",u.onInput_wysiwyg,!1),t.addEventListener("keydown",u.onKeyDown_wysiwyg,!1),t.addEventListener("keyup",u.onKeyUp_wysiwyg,!1),t.addEventListener("paste",u.onPaste_wysiwyg,!1),t.addEventListener("copy",u.onCopy_wysiwyg,!1),t.addEventListener("cut",u.onCut_wysiwyg,!1),t.addEventListener("drop",u.onDrop_wysiwyg,!1),t.addEventListener("scroll",u.onScroll_wysiwyg,!1),t.addEventListener("focus",u.onFocus_wysiwyg,!1),t.addEventListener("blur",u.onBlur_wysiwyg,!1),u._lineBreakerBind={a:u._onLineBreak.bind(""),t:u._onLineBreak.bind("t"),b:u._onLineBreak.bind("b")},t.addEventListener("mousemove",u.onMouseMove_wysiwyg,!1),d._lineBreakerButton.addEventListener("mousedown",u._onMouseDown_lineBreak,!1),d._lineBreakerButton.addEventListener("click",u._lineBreakerBind.a,!1),e.element.lineBreaker_t.addEventListener("mousedown",u._lineBreakerBind.t,!1),e.element.lineBreaker_b.addEventListener("mousedown",u._lineBreakerBind.b,!1),d.plugins.table&&t.addEventListener("touchstart",u.onMouseDown_wysiwyg,{passive:!0,useCapture:!1}),"auto"!==l.height||l.codeMirrorEditor||(e.element.code.addEventListener("keydown",u._codeViewAutoHeight,!1),e.element.code.addEventListener("keyup",u._codeViewAutoHeight,!1),e.element.code.addEventListener("paste",u._codeViewAutoHeight,!1)),e.element.resizingBar&&(/\d+/.test(l.height)?e.element.resizingBar.addEventListener("mousedown",u.onMouseDown_resizingBar,!1):r.addClass(e.element.resizingBar,"se-resizing-none")),u._setResponsiveToolbar(),a.removeEventListener("resize",u.onResize_window),a.removeEventListener("scroll",u.onScroll_window),a.addEventListener("resize",u.onResize_window,!1),l.stickyToolbar>-1&&a.addEventListener("scroll",u.onScroll_window,!1)},_removeEvent:function(){const t=l.iframe?d._ww:e.element.wysiwyg;e.element.toolbar.removeEventListener("mousedown",u._buttonsEventHandler),e.element._menuTray.removeEventListener("mousedown",u._buttonsEventHandler),e.element.toolbar.removeEventListener("click",u.onClick_toolbar),t.removeEventListener("mousedown",u.onMouseDown_wysiwyg),t.removeEventListener("click",u.onClick_wysiwyg),t.removeEventListener(r.isIE?"textinput":"input",u.onInput_wysiwyg),t.removeEventListener("keydown",u.onKeyDown_wysiwyg),t.removeEventListener("keyup",u.onKeyUp_wysiwyg),t.removeEventListener("paste",u.onPaste_wysiwyg),t.removeEventListener("copy",u.onCopy_wysiwyg),t.removeEventListener("cut",u.onCut_wysiwyg),t.removeEventListener("drop",u.onDrop_wysiwyg),t.removeEventListener("scroll",u.onScroll_wysiwyg),t.removeEventListener("mousemove",u.onMouseMove_wysiwyg),d._lineBreakerButton.removeEventListener("mousedown",u._onMouseDown_lineBreak),d._lineBreakerButton.removeEventListener("click",u._lineBreakerBind.a),e.element.lineBreaker_t.removeEventListener("mousedown",u._lineBreakerBind.t),e.element.lineBreaker_b.removeEventListener("mousedown",u._lineBreakerBind.b),u._lineBreakerBind=null,t.removeEventListener("touchstart",u.onMouseDown_wysiwyg,{passive:!0,useCapture:!1}),t.removeEventListener("focus",u.onFocus_wysiwyg),t.removeEventListener("blur",u.onBlur_wysiwyg),e.element.code.removeEventListener("keydown",u._codeViewAutoHeight),e.element.code.removeEventListener("keyup",u._codeViewAutoHeight),e.element.code.removeEventListener("paste",u._codeViewAutoHeight),e.element.resizingBar&&e.element.resizingBar.removeEventListener("mousedown",u.onMouseDown_resizingBar),a.removeEventListener("resize",u.onResize_window),a.removeEventListener("scroll",u.onScroll_window)},_setResponsiveToolbar:function(){if(0===o.length)return void(o=null);const e=u._responsiveButtonSize=["default"],t=u._responsiveButtons={default:o[0]};for(let n,i,l=1,s=o.length;l",e}};return void 0===t&&(e.SUNEDITOR_MODULES||Object.defineProperty(e,"SUNEDITOR_MODULES",{enumerable:!0,writable:!1,configurable:!1,value:{}}),Object.defineProperty(e.SUNEDITOR_MODULES,"component",{enumerable:!0,writable:!1,configurable:!1,value:n})),n},"object"==typeof e.exports?e.exports=i.document?l(i,!0):function(e){if(!e.document)throw new Error("SUNEDITOR_MODULES a window with a document");return l(e)}:l(i)},ee5k:function(e,t,n){"use strict";var i,l;i="undefined"!=typeof window?window:this,l=function(e,t){const n={name:"resizing",add:function(e){const t=e.icons,n=e.context;n.resizing={_resizeClientX:0,_resizeClientY:0,_resize_plugin:"",_resize_w:0,_resize_h:0,_origin_w:0,_origin_h:0,_rotateVertical:!1,_resize_direction:"",_move_path:null,_isChange:!1,alignIcons:{basic:t.align_justify,left:t.align_left,right:t.align_right,center:t.align_center}};let i=this.setController_resize.call(e);n.resizing.resizeContainer=i,n.resizing.resizeDiv=i.querySelector(".se-modal-resize"),n.resizing.resizeDot=i.querySelector(".se-resize-dot"),n.resizing.resizeDisplay=i.querySelector(".se-resize-display");let l=this.setController_button.call(e);n.resizing.resizeButton=l;let o=n.resizing.resizeHandles=n.resizing.resizeDot.querySelectorAll("span");n.resizing.resizeButtonGroup=l.querySelector("._se_resizing_btn_group"),n.resizing.rotationButtons=l.querySelectorAll("._se_resizing_btn_group ._se_rotation"),n.resizing.percentageButtons=l.querySelectorAll("._se_resizing_btn_group ._se_percentage"),n.resizing.alignMenu=l.querySelector(".se-resizing-align-list"),n.resizing.alignMenuList=n.resizing.alignMenu.querySelectorAll("button"),n.resizing.alignButton=l.querySelector("._se_resizing_align_button"),n.resizing.autoSizeButton=l.querySelector("._se_resizing_btn_group ._se_auto_size"),n.resizing.captionButton=l.querySelector("._se_resizing_caption_button"),i.addEventListener("mousedown",(function(e){e.preventDefault()})),l.addEventListener("mousedown",e.eventStop),o[0].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),o[1].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),o[2].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),o[3].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),o[4].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),o[5].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),o[6].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),o[7].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),l.addEventListener("click",this.onClick_resizeButton.bind(e)),n.element.relative.appendChild(i),n.element.relative.appendChild(l),i=null,l=null,o=null},setController_resize:function(){const e=this.util.createElement("DIV");return e.className="se-controller se-resizing-container",e.style.display="none",e.innerHTML='
    ',e},setController_button:function(){const e=this.lang,t=this.icons,n=this.util.createElement("DIV");return n.className="se-controller se-controller-resizing",n.innerHTML='
    ",n},_module_getSizeX:function(e,t,n,i){return t||(t=e._element),n||(n=e._cover),i||(i=e._container),t?/%$/.test(t.style.width)?(i&&this.util.getNumber(i.style.width,2)||100)+"%":t.style.width:""},_module_getSizeY:function(e,t,n,i){return t||(t=e._element),n||(n=e._cover),i||(i=e._container),i&&n?this.util.getNumber(n.style.paddingBottom,0)>0&&!this.context.resizing._rotateVertical?n.style.height:/%$/.test(t.style.height)&&/%$/.test(t.style.width)?(i&&this.util.getNumber(i.style.height,2)||100)+"%":t.style.height:t&&t.style.height||""},_module_setModifyInputSize:function(e,t){const n=e._onlyPercentage&&this.context.resizing._rotateVertical;e.proportion.checked=e._proportionChecked="false"!==e._element.getAttribute("data-proportion");let i=n?"":this.plugins.resizing._module_getSizeX.call(this,e);if(i===e._defaultSizeX&&(i=""),e._onlyPercentage&&(i=this.util.getNumber(i,2)),e.inputX.value=i,t.setInputSize.call(this,"x"),!e._onlyPercentage){let t=n?"":this.plugins.resizing._module_getSizeY.call(this,e);t===e._defaultSizeY&&(t=""),e._onlyPercentage&&(t=this.util.getNumber(t,2)),e.inputY.value=t}e.inputX.disabled=!!n,e.inputY.disabled=!!n,e.proportion.disabled=!!n,t.setRatio.call(this)},_module_setInputSize:function(e,t){if(e._onlyPercentage)"x"===t&&e.inputX.value>100&&(e.inputX.value=100);else if(e.proportion.checked&&e._ratio&&/\d/.test(e.inputX.value)&&/\d/.test(e.inputY.value)){const n=e.inputX.value.replace(/\d+|\./g,"")||e.sizeUnit,i=e.inputY.value.replace(/\d+|\./g,"")||e.sizeUnit;if(n!==i)return;const l="%"===n?2:0;"x"===t?e.inputY.value=this.util.getNumber(e._ratioY*this.util.getNumber(e.inputX.value,l),l)+i:e.inputX.value=this.util.getNumber(e._ratioX*this.util.getNumber(e.inputY.value,l),l)+n}},_module_setRatio:function(e){const t=e.inputX.value,n=e.inputY.value;if(e.proportion.checked&&/\d+/.test(t)&&/\d+/.test(n)){if((t.replace(/\d+|\./g,"")||e.sizeUnit)!==(n.replace(/\d+|\./g,"")||e.sizeUnit))e._ratio=!1;else if(!e._ratio){const i=this.util.getNumber(t,0),l=this.util.getNumber(n,0);e._ratio=!0,e._ratioX=i/l,e._ratioY=l/i}}else e._ratio=!1},_module_sizeRevert:function(e){e._onlyPercentage?e.inputX.value=e._origin_w>100?100:e._origin_w:(e.inputX.value=e._origin_w,e.inputY.value=e._origin_h)},_module_saveCurrentSize:function(e){const t=this.plugins.resizing._module_getSizeX.call(this,e),n=this.plugins.resizing._module_getSizeY.call(this,e);e._element.setAttribute("data-size",t+","+n),e._videoRatio&&(e._videoRatio=n)},call_controller_resize:function(e,t){const n=this.context.resizing,i=this.context[t];n._resize_plugin=t;const l=n.resizeContainer,o=n.resizeDiv,s=this.util.getOffset(e,this.context.element.wysiwygFrame),a=n._rotateVertical=/^(90|270)$/.test(Math.abs(e.getAttribute("data-rotate")).toString()),r=a?e.offsetHeight:e.offsetWidth,c=a?e.offsetWidth:e.offsetHeight,d=s.top,u=s.left-this.context.element.wysiwygFrame.scrollLeft;l.style.top=d+"px",l.style.left=u+"px",l.style.width=r+"px",l.style.height=c+"px",o.style.top="0px",o.style.left="0px",o.style.width=r+"px",o.style.height=c+"px";let h=e.getAttribute("data-align")||"basic";h="none"===h?"basic":h;const g=this.util.getParentElement(e,this.util.isComponent),p=this.util.getParentElement(e,"FIGURE"),m=this.plugins.resizing._module_getSizeX.call(this,i,e,p,g)||"auto",f=i._onlyPercentage&&"image"===t?"":", "+(this.plugins.resizing._module_getSizeY.call(this,i,e,p,g)||"auto");this.util.changeTxt(n.resizeDisplay,this.lang.dialogBox[h]+" ("+m+f+")"),n.resizeButtonGroup.style.display=i._resizing?"":"none";const _=!i._resizing||i._resizeDotHide||i._onlyPercentage?"none":"flex",b=n.resizeHandles;for(let e=0,t=b.length;e=360?0:d;s.setAttribute("data-rotate",u),c._rotateVertical=/^(90|270)$/.test(this._w.Math.abs(u).toString()),this.plugins.resizing.setTransformSize.call(this,s,null,null),this.selectComponent(s,l);break;case"onalign":return void this.plugins.resizing.openAlignMenu.call(this);case"align":const h="basic"===i?"none":i;a.setAlign.call(this,h,null,null,null),this.selectComponent(s,l);break;case"caption":const g=!o._captionChecked;if(a.openModify.call(this,!0),o._captionChecked=o.captionCheckEl.checked=g,a.update_image.call(this,!1,!1,!1),g){const e=this.util.getChildElement(o._caption,(function(e){return 3===e.nodeType}));e?this.setRange(e,0,e,e.textContent.length):o._caption.focus(),this.controllersOff()}else this.selectComponent(s,l),a.openModify.call(this,!0);break;case"revert":a.setOriginSize.call(this),this.selectComponent(s,l);break;case"update":a.openModify.call(this),this.controllersOff();break;case"delete":a.destroy.call(this)}this.history.push(!1)}},resetTransform:function(e){const t=(e.getAttribute("data-size")||e.getAttribute("data-origin")||"").split(",");this.context.resizing._rotateVertical=!1,e.style.maxWidth="",e.style.transform="",e.style.transformOrigin="",e.setAttribute("data-rotate",""),e.setAttribute("data-rotateX",""),e.setAttribute("data-rotateY",""),this.plugins[this.context.resizing._resize_plugin].setSize.call(this,t[0]?t[0]:"auto",t[1]?t[1]:"",!0)},setTransformSize:function(e,t,n){let i=e.getAttribute("data-percentage");const l=this.context.resizing._rotateVertical,o=1*e.getAttribute("data-rotate");let s="";if(i&&!l)i=i.split(","),"auto"===i[0]&&"auto"===i[1]?this.plugins[this.context.resizing._resize_plugin].setAutoSize.call(this):this.plugins[this.context.resizing._resize_plugin].setPercentSize.call(this,i[0],i[1]);else{const i=this.util.getParentElement(e,"FIGURE"),a=t||e.offsetWidth,r=n||e.offsetHeight,c=(l?r:a)+"px",d=(l?a:r)+"px";if(this.plugins[this.context.resizing._resize_plugin].cancelPercentAttr.call(this),this.plugins[this.context.resizing._resize_plugin].setSize.call(this,a+"px",r+"px",!0),i.style.width=c,i.style.height=this.context[this.context.resizing._resize_plugin]._caption?"":d,l){let e=a/2+"px "+a/2+"px 0",t=r/2+"px "+r/2+"px 0";s=90===o||-270===o?t:e}}e.style.transformOrigin=s,this.plugins.resizing._setTransForm(e,o.toString(),e.getAttribute("data-rotateX")||"",e.getAttribute("data-rotateY")||""),e.style.maxWidth=l?"none":"",this.plugins.resizing.setCaptionPosition.call(this,e)},_setTransForm:function(e,t,n,i){let l=(e.offsetWidth-e.offsetHeight)*(/-/.test(t)?1:-1),o="";if(/[1-9]/.test(t)&&(n||i))switch(o=n?"Y":"X",t){case"90":o=n&&i?"X":i?o:"";break;case"270":l*=-1,o=n&&i?"Y":n?o:"";break;case"-90":o=n&&i?"Y":n?o:"";break;case"-270":l*=-1,o=n&&i?"X":i?o:"";break;default:o=""}t%180==0&&(e.style.maxWidth=""),e.style.transform="rotate("+t+"deg)"+(n?" rotateX("+n+"deg)":"")+(i?" rotateY("+i+"deg)":"")+(o?" translate"+o+"("+l+"px)":"")},setCaptionPosition:function(e){const t=this.util.getChildElement(this.util.getParentElement(e,"FIGURE"),"FIGCAPTION");t&&(t.style.marginTop=(this.context.resizing._rotateVertical?e.offsetWidth-e.offsetHeight:0)+"px")},onMouseDown_resize_handle:function(e){e.stopPropagation(),e.preventDefault();const t=this.context.resizing,n=t._resize_direction=e.target.classList[0];t._resizeClientX=e.clientX,t._resizeClientY=e.clientY,this.context.element.resizeBackground.style.display="block",t.resizeButton.style.display="none",t.resizeDiv.style.float=/l/.test(n)?"right":/r/.test(n)?"left":"none";const i=function(e){if("keydown"===e.type&&27!==e.keyCode)return;const o=t._isChange;t._isChange=!1,this.removeDocEvent("mousemove",l),this.removeDocEvent("mouseup",i),this.removeDocEvent("keydown",i),"keydown"===e.type?(this.controllersOff(),this.context.element.resizeBackground.style.display="none",this.plugins[this.context.resizing._resize_plugin].init.call(this)):(this.plugins.resizing.cancel_controller_resize.call(this,n),o&&this.history.push(!1))}.bind(this),l=this.plugins.resizing.resizing_element.bind(this,t,n,this.context[t._resize_plugin]);this.addDocEvent("mousemove",l),this.addDocEvent("mouseup",i),this.addDocEvent("keydown",i)},resizing_element:function(e,t,n,i){const l=i.clientX,o=i.clientY;let s=n._element_w,a=n._element_h;const r=n._element_w+(/r/.test(t)?l-e._resizeClientX:e._resizeClientX-l),c=n._element_h+(/b/.test(t)?o-e._resizeClientY:e._resizeClientY-o),d=n._element_h/n._element_w*r;/t/.test(t)&&(e.resizeDiv.style.top=n._element_h-(/h/.test(t)?c:d)+"px"),/l/.test(t)&&(e.resizeDiv.style.left=n._element_w-r+"px"),/r|l/.test(t)&&(e.resizeDiv.style.width=r+"px",s=r),/^(t|b)[^h]$/.test(t)?(e.resizeDiv.style.height=d+"px",a=d):/^(t|b)h$/.test(t)&&(e.resizeDiv.style.height=c+"px",a=c),e._resize_w=s,e._resize_h=a,this.util.changeTxt(e.resizeDisplay,this._w.Math.round(s)+" x "+this._w.Math.round(a)),e._isChange=!0},cancel_controller_resize:function(e){const t=this.context.resizing._rotateVertical;this.controllersOff(),this.context.element.resizeBackground.style.display="none";let n=this._w.Math.round(t?this.context.resizing._resize_h:this.context.resizing._resize_w),i=this._w.Math.round(t?this.context.resizing._resize_w:this.context.resizing._resize_h);if(!t&&!/%$/.test(n)){const e=16,t=this.context.element.wysiwygFrame.clientWidth-2*e-2;this.util.getNumber(n,0)>t&&(i=this._w.Math.round(i/n*t),n=t)}const l=this.context.resizing._resize_plugin;this.plugins[l].setSize.call(this,n,i,!1,e),this.selectComponent(this.context[l]._element,l)}};return void 0===t&&(e.SUNEDITOR_MODULES||Object.defineProperty(e,"SUNEDITOR_MODULES",{enumerable:!0,writable:!1,configurable:!1,value:{}}),Object.defineProperty(e.SUNEDITOR_MODULES,"resizing",{enumerable:!0,writable:!1,configurable:!1,value:n})),n},"object"==typeof e.exports?e.exports=i.document?l(i,!0):function(e){if(!e.document)throw new Error("SUNEDITOR_MODULES a window with a document");return l(e)}:l(i)},"gjS+":function(e,t,n){"use strict";var i,l;i="undefined"!=typeof window?window:this,l=function(e,t){const n={name:"fileManager",_xmlHttp:null,upload:function(e,t,n,i,l){this.showLoading();const o=this.plugins.fileManager,s=o._xmlHttp=this.util.getXMLHttpRequest();if(s.onreadystatechange=o._callBackUpload.bind(this,s,i,l),s.open("post",e,!0),null!==t&&"object"==typeof t&&this._w.Object.keys(t).length>0)for(let e in t)s.setRequestHeader(e,t[e]);s.send(n)},_callBackUpload:function(e,t,n){if(4===e.readyState)if(200===e.status)try{t(e)}catch(e){throw Error('[SUNEDITOR.fileManager.upload.callBack.fail] cause : "'+e.message+'"')}finally{this.closeLoading()}else{this.closeLoading();const t=e.responseText?JSON.parse(e.responseText):e;if("function"!=typeof n||n("",t,this)){const n="[SUNEDITOR.fileManager.upload.serverException] status: "+e.status+", response: "+(t.errorMessage||e.responseText);throw this.functions.noticeOpen(n),Error(n)}}},checkInfo:function(e,t,n,i,l){let o=[];for(let e=0,n=t.length;e-1||(a.splice(t,1),"function"==typeof n&&n(null,e,"delete",null,0,this),t--);l&&(this.context.resizing._resize_plugin=c)},setInfo:function(e,t,n,i,l){const o=l?this.context.resizing._resize_plugin:"";l&&(this.context.resizing._resize_plugin=e);const s=this.plugins[e],a=this.context[e],r=a._infoList;let c=t.getAttribute("data-index"),d=null,u="";if(i||(i={name:t.getAttribute("data-file-name")||("string"==typeof t.src?t.src.split("/").pop():""),size:t.getAttribute("data-file-size")||0}),!c||this._componentsInfoInit)u="create",c=a._infoIndex++,t.setAttribute("data-index",c),t.setAttribute("data-file-name",i.name),t.setAttribute("data-file-size",i.size),d={src:t.src,index:1*c,name:i.name,size:i.size},r.push(d);else{u="update",c*=1;for(let e=0,t=r.length;e=0){const i=this.context[e]._infoList;for(let e=0,l=i.length;e Date: Fri, 9 Oct 2020 11:28:25 +1100 Subject: [PATCH 20/38] simplify click logic idx was wrong when filtered --- src/plugins/dialog/mention.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/plugins/dialog/mention.js b/src/plugins/dialog/mention.js index 302e1eb25..721757fb0 100644 --- a/src/plugins/dialog/mention.js +++ b/src/plugins/dialog/mention.js @@ -60,8 +60,7 @@ export default { this.util.addClass(el, 'se-mention-item'); el.innerHTML = mention.renderItem(item); el.addEventListener("click", () => { - mention.focussed = idx; - mention._addMention(); + mention._addMention(item); }); insertAt(mention._list, el, idx); mention._itemElements[id] = el; @@ -186,9 +185,9 @@ export default { }); }, - _addMention: function() { + _addMention: function(item) { const { mention } = this.context; - const new_mention = mention._items[mention.focussed]; + const new_mention = item || mention._items[mention.focussed]; if (new_mention) { if ( !mention.mentions.find( From 6216b281b50389e5b15f75b11195e958af77d6f0 Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Fri, 9 Oct 2020 11:44:26 +1100 Subject: [PATCH 21/38] Allow other 200 range success response --- src/plugins/modules/fileManager.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/modules/fileManager.js b/src/plugins/modules/fileManager.js index cfc906928..70e0e2d73 100644 --- a/src/plugins/modules/fileManager.js +++ b/src/plugins/modules/fileManager.js @@ -51,7 +51,7 @@ _callBackUpload: function (xmlHttp, callBack, errorCallBack) { if (xmlHttp.readyState === 4) { - if (xmlHttp.status === 200) { + if (xmlHttp.status >= 200 && xmlHttp.status < 300) { try { callBack(xmlHttp); } catch (e) { @@ -314,4 +314,4 @@ } return fileManager; -})); \ No newline at end of file +})); From 7c649549efcab781c7c7a4bb8d6e1a94006d166a Mon Sep 17 00:00:00 2001 From: JiHong88 <0125ses@hanmail.net> Date: Sat, 10 Oct 2020 17:59:41 +0900 Subject: [PATCH 22/38] update: #450 rtl- table selector --- src/plugins/submenu/table.js | 62 ++++++++++++++++++++---------------- 1 file changed, 35 insertions(+), 27 deletions(-) diff --git a/src/plugins/submenu/table.js b/src/plugins/submenu/table.js index 2dcb5a3f6..6e2ccac46 100644 --- a/src/plugins/submenu/table.js +++ b/src/plugins/submenu/table.js @@ -12,7 +12,7 @@ export default { display: 'submenu', add: function (core, targetElement) { const context = core.context; - context.table = { + let contextTable = context.table = { _element: null, _tdElement: null, _trElement: null, @@ -20,6 +20,7 @@ export default { _tableXY: [], _maxWidth: true, _fixedColumn: false, + _rtl: context.options.rtl, cellControllerTop: context.options.tableCellControllerPosition === 'top', resizeText: null, headerButton: null, @@ -46,31 +47,32 @@ export default { let listDiv = this.setSubmenu.call(core); let tablePicker = listDiv.querySelector('.se-controller-table-picker'); - context.table.tableHighlight = listDiv.querySelector('.se-table-size-highlighted'); - context.table.tableUnHighlight = listDiv.querySelector('.se-table-size-unhighlighted'); - context.table.tableDisplay = listDiv.querySelector('.se-table-size-display'); + contextTable.tableHighlight = listDiv.querySelector('.se-table-size-highlighted'); + contextTable.tableUnHighlight = listDiv.querySelector('.se-table-size-unhighlighted'); + contextTable.tableDisplay = listDiv.querySelector('.se-table-size-display'); + if (context.options.rtl) contextTable.tableHighlight.style.left = (10 * 18 - 13) + 'px'; /** set table controller */ let tableController = this.setController_table.call(core); - context.table.tableController = tableController; - context.table.resizeButton = tableController.querySelector('._se_table_resize'); - context.table.resizeText = tableController.querySelector('._se_table_resize > span > span'); - context.table.columnFixedButton = tableController.querySelector('._se_table_fixed_column'); - context.table.headerButton = tableController.querySelector('._se_table_header'); + contextTable.tableController = tableController; + contextTable.resizeButton = tableController.querySelector('._se_table_resize'); + contextTable.resizeText = tableController.querySelector('._se_table_resize > span > span'); + contextTable.columnFixedButton = tableController.querySelector('._se_table_fixed_column'); + contextTable.headerButton = tableController.querySelector('._se_table_header'); tableController.addEventListener('mousedown', core.eventStop); /** set resizing */ - let resizeDiv = this.setController_tableEditor.call(core, context.table.cellControllerTop); - context.table.resizeDiv = resizeDiv; - context.table.splitMenu = resizeDiv.querySelector('.se-btn-group-sub'); - context.table.mergeButton = resizeDiv.querySelector('._se_table_merge_button'); - context.table.splitButton = resizeDiv.querySelector('._se_table_split_button'); - context.table.insertRowAboveButton = resizeDiv.querySelector('._se_table_insert_row_a'); - context.table.insertRowBelowButton = resizeDiv.querySelector('._se_table_insert_row_b'); + let resizeDiv = this.setController_tableEditor.call(core, contextTable.cellControllerTop); + contextTable.resizeDiv = resizeDiv; + contextTable.splitMenu = resizeDiv.querySelector('.se-btn-group-sub'); + contextTable.mergeButton = resizeDiv.querySelector('._se_table_merge_button'); + contextTable.splitButton = resizeDiv.querySelector('._se_table_split_button'); + contextTable.insertRowAboveButton = resizeDiv.querySelector('._se_table_insert_row_a'); + contextTable.insertRowBelowButton = resizeDiv.querySelector('._se_table_insert_row_b'); resizeDiv.addEventListener('mousedown', core.eventStop); /** add event listeners */ - tablePicker.addEventListener('mousemove', this.onMouseMove_tablePicker.bind(core)); + tablePicker.addEventListener('mousemove', this.onMouseMove_tablePicker.bind(core, contextTable)); tablePicker.addEventListener('click', this.appendTable.bind(core)); resizeDiv.addEventListener('click', this.onClick_tableController.bind(core)); tableController.addEventListener('click', this.onClick_tableController.bind(core)); @@ -83,7 +85,7 @@ export default { context.element.relative.appendChild(tableController); /** empty memory */ - listDiv = null, tablePicker = null, resizeDiv = null, tableController = null; + listDiv = null, tablePicker = null, resizeDiv = null, tableController = null, contextTable = null; }, setSubmenu: function () { @@ -228,23 +230,29 @@ export default { } }, - onMouseMove_tablePicker: function (e) { + onMouseMove_tablePicker: function (contextTable, e) { e.stopPropagation(); let x = this._w.Math.ceil(e.offsetX / 18); let y = this._w.Math.ceil(e.offsetY / 18); x = x < 1 ? 1 : x; y = y < 1 ? 1 : y; - this.context.table.tableHighlight.style.width = x + 'em'; - this.context.table.tableHighlight.style.height = y + 'em'; + + if (contextTable._rtl) { + contextTable.tableHighlight.style.left = (x * 18 - 13) + 'px'; + x = 11 - x; + } + + contextTable.tableHighlight.style.width = x + 'em'; + contextTable.tableHighlight.style.height = y + 'em'; - let x_u = 10; // x < 5 ? 5 : (x > 9 ? 10 : x + 1); - let y_u = 10; //y < 5 ? 5 : (y > 9 ? 10 : y + 1); - this.context.table.tableUnHighlight.style.width = x_u + 'em'; - this.context.table.tableUnHighlight.style.height = y_u + 'em'; + // let x_u = x < 5 ? 5 : (x > 9 ? 10 : x + 1); + // let y_u = y < 5 ? 5 : (y > 9 ? 10 : y + 1); + // contextTable.tableUnHighlight.style.width = x_u + 'em'; + // contextTable.tableUnHighlight.style.height = y_u + 'em'; - this.util.changeTxt(this.context.table.tableDisplay, x + ' x ' + y); - this.context.table._tableXY = [x, y]; + this.util.changeTxt(contextTable.tableDisplay, x + ' x ' + y); + contextTable._tableXY = [x, y]; }, reset_table_picker: function () { From 5dde74bdfa1b733dd8f631837282f7ec8a7a7b02 Mon Sep 17 00:00:00 2001 From: JiHong88 <0125ses@hanmail.net> Date: Sat, 10 Oct 2020 18:33:39 +0900 Subject: [PATCH 23/38] update: #450 controller button direction --- src/assets/css/suneditor.css | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/assets/css/suneditor.css b/src/assets/css/suneditor.css index ad52f4058..122e90bbc 100755 --- a/src/assets/css/suneditor.css +++ b/src/assets/css/suneditor.css @@ -423,6 +423,8 @@ /** --- RTL ---------------------------------------------------------- */ /* tray */ .sun-editor.se-rtl .se-btn-tray {direction:rtl;} + +/* button--- */ /* button - select text */ .sun-editor.se-rtl .se-btn-select .txt {flex:auto; text-align:right; direction:rtl;} /* button - se-menu-list */ @@ -430,18 +432,22 @@ .sun-editor.se-rtl .se-btn-list > .se-list-icon {margin:-1px 0 0 10px;} /* button - se-menu-list - li */ .sun-editor.se-rtl .se-menu-list li {float:right;} -/* menu list */ + +/* menu list--- */ .sun-editor.se-rtl .se-list-layer * {direction:rtl;} /* menu list - format block */ .sun-editor.se-rtl .se-list-layer.se-list-format ul blockquote {padding:0 7px 0 0; border-right-width:5px; border-left-width:0;} /* menu list - color picker */ .sun-editor.se-rtl .se-list-layer .se-selector-color .se-color-pallet li {float:right;} + /* placeholder */ .sun-editor.se-rtl .se-wrapper .se-placeholder {direction:rtl;} + /* tooltip */ .sun-editor.se-rtl .se-tooltip .se-tooltip-inner .se-tooltip-text {direction:rtl;} .sun-editor.se-rtl .se-tooltip .se-tooltip-inner .se-tooltip-text .se-shortcut {direction:ltr;} -/* dialog */ + +/* dialog--- */ .sun-editor.se-rtl .se-dialog * {direction:rtl;} /* dialog - header */ .sun-editor.se-rtl .se-dialog .se-dialog-inner .se-dialog-header .se-dialog-close {float:left;} @@ -453,13 +459,18 @@ .sun-editor.se-rtl .se-dialog .se-dialog-inner .se-dialog-content .se-btn-primary {float:left} .sun-editor.se-rtl .se-dialog .se-dialog-inner .se-dialog-footer > div {float:right;} .sun-editor.se-rtl .se-dialog .se-dialog-inner .se-dialog-footer > div > label {margin:0 0 0 5px;} -/* fileBrowser */ + +/* fileBrowser--- */ .sun-editor.se-rtl .se-file-browser * {direction:rtl;} /* fileBrowser - header */ .sun-editor.se-rtl .se-file-browser .se-file-browser-tags {text-align:right;} .sun-editor.se-rtl .se-file-browser .se-file-browser-tags a {margin: 8px 8px 0 8px;} .sun-editor.se-rtl .se-file-browser .se-file-browser-header .se-file-browser-close {float:left;} +/** controller--- */ +.sun-editor.se-rtl .se-controller .se-btn-group {direction:rtl;} +/** --- RTL ---------------------------------------------------------- */ + /** animation */ @keyframes blinker { 50% {opacity:0;} } From 6cea152842edcf1074c288dcdc926c59d7626207 Mon Sep 17 00:00:00 2001 From: JiHong88 <0125ses@hanmail.net> Date: Thu, 15 Oct 2020 03:17:50 +0900 Subject: [PATCH 24/38] add: core.setControllerPosition --- sample/html/out/document-editor.html | 56 ++++++++++++++++++++++++++++ src/lib/core.d.ts | 28 +++++++++++--- src/lib/core.js | 33 ++++++++++++++++ src/plugins/dialog/audio.js | 18 +-------- src/plugins/dialog/link.js | 15 +------- src/plugins/dialog/math.js | 15 +------- src/plugins/modules/resizing.js | 15 +------- src/plugins/submenu/table.js | 27 ++------------ test/dev/suneditor_build_test.js | 1 + 9 files changed, 122 insertions(+), 86 deletions(-) diff --git a/sample/html/out/document-editor.html b/sample/html/out/document-editor.html index 157a799c8..d2b79fcfd 100644 --- a/sample/html/out/document-editor.html +++ b/sample/html/out/document-editor.html @@ -959,6 +959,61 @@

    control
    +

    setControllerPosition(controller, referEl, position, addOffset)

    +
    + Specify the position of the controller. +
    +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    controller + Element + Controller element
    referEl + Element + Element that is the basis of the controller's position
    position + String + + Type of position ("top" | "bottom")
    + When using the "top" position, there should not be an arrow on the controller.
    + When using the "bottom" position there should be an arrow on the controller. +
    addOffset + Object + + These are the left and top values that need to be added specially.
    + This argument is required. - {left: 0, top: 0} +
    +
    + +

    eventStop(e)

    @@ -2185,6 +2240,7 @@

    core

  • containerOff
  • controllersOn
  • controllersOff
  • +
  • setControllerPosition
  • eventStop
  • execCommand
  • nativeFocus
  • diff --git a/src/lib/core.d.ts b/src/lib/core.d.ts index 04639a3ac..171840433 100644 --- a/src/lib/core.d.ts +++ b/src/lib/core.d.ts @@ -227,6 +227,24 @@ interface Core { */ controllersOff(e?: KeyboardEvent | MouseEvent): void; + /** + * @description Specify the position of the controller. + * @param controller Controller element. + * @param referEl Element that is the basis of the controller's position. + * @param position Type of position ("top" | "bottom") + * When using the "top" position, there should not be an arrow on the controller. + * When using the "bottom" position there should be an arrow on the controller. + * @param addOffset These are the left and top values that need to be added specially. + * This argument is required. - {left: 0, top: 0} + */ + setControllerPosition(controller: Element, referEl: Element, position: 'top' | 'bottom', addOffset: {left: number, top: number}): void; + + /** + * @description Run event.stopPropagation and event.preventDefault. + * @param e Event Object + */ + eventStop(e: Event): void; + /** * @description javascript execCommand * @param command javascript execCommand function property @@ -434,7 +452,7 @@ interface Core { * @param display Display type string ('command', 'submenu', 'dialog', 'container') * @param target The element of command button */ - actionCall(command: string, display: string, target: Element): void; + actionCall(command: string, display: 'command' | 'submenu' | 'dialog' | 'container', target: Element): void; /** * @description Execute command of command button(All Buttons except submenu and dialog) @@ -454,7 +472,7 @@ interface Core { * Setted "margin-left" to "25px" in the top "P" tag of the parameter node. * @param command Separator ("indent" or "outdent") */ - indent (command: string): void; + indent(command: 'indent' | 'outdent'): void; /** * @description Add or remove the class name of "body" so that the code block is visible @@ -738,7 +756,7 @@ export default class SunEditor { * @param remainingFilesCount Count of remaining files to upload (0 when added as a url) * @param core Core object */ - onImageUpload: (targetElement: HTMLImageElement, index: number, state: string, info: fileInfo, remainingFilesCount: number, core: Core) => void; + onImageUpload: (targetElement: HTMLImageElement, index: number, state: 'create' | 'update' | 'delete', info: fileInfo, remainingFilesCount: number, core: Core) => void; /** * @description Called when the video(iframe, video) is uploaded, updated, deleted @@ -756,7 +774,7 @@ export default class SunEditor { * @param remainingFilesCount Count of remaining files to upload (0 when added as a url) * @param core Core object */ - onVideoUpload: (targetElement: HTMLIFrameElement | HTMLVideoElement, index: number, state: string, info: fileInfo, remainingFilesCount: number, core: Core) => void; + onVideoUpload: (targetElement: HTMLIFrameElement | HTMLVideoElement, index: number, state: 'create' | 'update' | 'delete', info: fileInfo, remainingFilesCount: number, core: Core) => void; /** * @description Called when the audio is uploaded, updated, deleted @@ -774,7 +792,7 @@ export default class SunEditor { * @param remainingFilesCount Count of remaining files to upload (0 when added as a url) * @param core Core object */ - onAudioUpload: (targetElement: HTMLAudioElement, index: number, state: string, info: fileInfo, remainingFilesCount: number, core: Core) => void; + onAudioUpload: (targetElement: HTMLAudioElement, index: number, state: 'create' | 'update' | 'delete', info: fileInfo, remainingFilesCount: number, core: Core) => void; /** * @description Called when the image is upload failed diff --git a/src/lib/core.js b/src/lib/core.js index bdcbdc227..796287b2b 100755 --- a/src/lib/core.js +++ b/src/lib/core.js @@ -735,6 +735,39 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re this._antiBlur = false; }, + /** + * @description Specify the position of the controller. + * @param {Element} controller Controller element. + * @param {Element} referEl Element that is the basis of the controller's position. + * @param {String} position Type of position ("top" | "bottom") + * When using the "top" position, there should not be an arrow on the controller. + * When using the "bottom" position there should be an arrow on the controller. + * @param {Object} addOffset These are the left and top values that need to be added specially. + * This argument is required. - {left: 0, top: 0} + */ + setControllerPosition: function (controller, referEl, position, addOffset) { + const offset = util.getOffset(referEl, context.element.wysiwygFrame); + controller.style.visibility = 'hidden'; + controller.style.display = 'block'; + + const topMargin = position === 'top' ? -(controller.offsetHeight + 2) : (referEl.offsetHeight + 12); + controller.style.left = (offset.left - context.element.wysiwygFrame.scrollLeft + addOffset.left) + 'px'; + controller.style.top = (offset.top + topMargin + addOffset.top) + 'px'; + + // overleft + if (position === 'bottom') { + const overLeft = context.element.wysiwygFrame.offsetWidth - (controller.offsetLeft + controller.offsetWidth); + if (overLeft < 0) { + controller.style.left = (controller.offsetLeft + overLeft) + 'px'; + controller.firstElementChild.style.left = (20 - overLeft) + 'px'; + } else { + controller.firstElementChild.style.left = '20px'; + } + } + + controller.style.visibility = ''; + }, + /** * @description Run event.stopPropagation and event.preventDefault. * @param {Object} e Event Object diff --git a/src/plugins/dialog/audio.js b/src/plugins/dialog/audio.js index e78e929a9..7a27a34a1 100644 --- a/src/plugins/dialog/audio.js +++ b/src/plugins/dialog/audio.js @@ -471,23 +471,9 @@ export default { */ onModifyMode: function (selectionTag) { const contextAudio = this.context.audio; - - const controller = contextAudio.controller; - const offset = this.util.getOffset(selectionTag, this.context.element.wysiwygFrame); - controller.style.top = (offset.top + selectionTag.offsetHeight + 10) + 'px'; - controller.style.left = (offset.left - this.context.element.wysiwygFrame.scrollLeft) + 'px'; - - controller.style.display = 'block'; - - const overLeft = this.context.element.wysiwygFrame.offsetWidth - (controller.offsetLeft + controller.offsetWidth); - if (overLeft < 0) { - controller.style.left = (controller.offsetLeft + overLeft) + 'px'; - controller.firstElementChild.style.left = (20 - overLeft) + 'px'; - } else { - controller.firstElementChild.style.left = '20px'; - } - this.controllersOn(controller, selectionTag, this.plugins.audio.onControllerOff.bind(this, selectionTag), 'audio'); + this.setControllerPosition(contextAudio.controller, selectionTag, 'bottom', {left: 0, top: 0}); + this.controllersOn(contextAudio.controller, selectionTag, this.plugins.audio.onControllerOff.bind(this, selectionTag), 'audio'); this.util.addClass(selectionTag, 'active'); contextAudio._element = selectionTag; diff --git a/src/plugins/dialog/link.js b/src/plugins/dialog/link.js index d8e629754..523d749c8 100644 --- a/src/plugins/dialog/link.js +++ b/src/plugins/dialog/link.js @@ -228,20 +228,7 @@ export default { link.title = selectionATag.textContent; link.textContent = selectionATag.textContent; - const offset = this.util.getOffset(selectionATag, this.context.element.wysiwygFrame); - linkBtn.style.top = (offset.top + selectionATag.offsetHeight + 10) + 'px'; - linkBtn.style.left = (offset.left - this.context.element.wysiwygFrame.scrollLeft) + 'px'; - - linkBtn.style.display = 'block'; - - const overLeft = this.context.element.wysiwygFrame.offsetWidth - (linkBtn.offsetLeft + linkBtn.offsetWidth); - if (overLeft < 0) { - linkBtn.style.left = (linkBtn.offsetLeft + overLeft) + 'px'; - linkBtn.firstElementChild.style.left = (20 - overLeft) + 'px'; - } else { - linkBtn.firstElementChild.style.left = '20px'; - } - + this.setControllerPosition(linkBtn, selectionATag, 'bottom', {left: 0, top: 0}); this.controllersOn(linkBtn, selectionATag, 'link'); }, diff --git a/src/plugins/dialog/math.js b/src/plugins/dialog/math.js index 1ac460e61..d9f06e827 100644 --- a/src/plugins/dialog/math.js +++ b/src/plugins/dialog/math.js @@ -241,20 +241,7 @@ export default { this.context.math._mathExp = mathTag; const mathBtn = this.context.math.mathController; - const offset = this.util.getOffset(mathTag, this.context.element.wysiwygFrame); - mathBtn.style.top = (offset.top + mathTag.offsetHeight + 10) + 'px'; - mathBtn.style.left = (offset.left - this.context.element.wysiwygFrame.scrollLeft) + 'px'; - - mathBtn.style.display = 'block'; - - const overLeft = this.context.element.wysiwygFrame.offsetWidth - (mathBtn.offsetLeft + mathBtn.offsetWidth); - if (overLeft < 0) { - mathBtn.style.left = (mathBtn.offsetLeft + overLeft) + 'px'; - mathBtn.firstElementChild.style.left = (20 - overLeft) + 'px'; - } else { - mathBtn.firstElementChild.style.left = '20px'; - } - + this.setControllerPosition(mathBtn, mathTag, 'bottom', {left: 0, top: 0}); this.controllersOn(mathBtn, mathTag, 'math'); }, diff --git a/src/plugins/modules/resizing.js b/src/plugins/modules/resizing.js index 8bc65b4d9..a998dfb39 100644 --- a/src/plugins/modules/resizing.js +++ b/src/plugins/modules/resizing.js @@ -472,19 +472,8 @@ if (this.currentControllerName !== plugin) { this.util.setDisabledButtons(true, this.resizingDisabledButtons); - this.controllersOn(contextResizing.resizeContainer, contextResizing.resizeButton, this.util.setDisabledButtons.bind(this, false, this.resizingDisabledButtons), targetElement, plugin); - } - - // button group - const overLeft = this.context.element.wysiwygFrame.offsetWidth - l - contextResizing.resizeButton.offsetWidth; - - contextResizing.resizeButton.style.top = (h + t + 60) + 'px'; - contextResizing.resizeButton.style.left = (l + (overLeft < 0 ? overLeft : 0)) + 'px'; - - if (overLeft < 0) { - contextResizing.resizeButton.firstElementChild.style.left = (20 - overLeft) + 'px'; - } else { - contextResizing.resizeButton.firstElementChild.style.left = '20px'; + this.controllersOn(resizeContainer, contextResizing.resizeButton, this.util.setDisabledButtons.bind(this, false, this.resizingDisabledButtons), targetElement, plugin); + this.setControllerPosition(contextResizing.resizeButton, resizeContainer, 'bottom', {left: 0, top: 50}); } contextResizing._resize_w = w; diff --git a/src/plugins/submenu/table.js b/src/plugins/submenu/table.js index 6e2ccac46..5303edf80 100644 --- a/src/plugins/submenu/table.js +++ b/src/plugins/submenu/table.js @@ -334,11 +334,7 @@ export default { }, setPositionControllerTop: function (tableElement) { - const tableController = this.context.table.tableController; - const offset = this.util.getOffset(tableElement, this.context.element.wysiwygFrame); - tableController.style.left = offset.left + 'px'; - tableController.style.display = 'block'; - tableController.style.top = (offset.top - tableController.offsetHeight - 2) + 'px'; + this.setControllerPosition(this.context.table.tableController, tableElement, 'top', {left: 0, top: 0}); }, setPositionControllerDiv: function (tdElement, reset) { @@ -347,28 +343,11 @@ export default { this.plugins.table.setCellInfo.call(this, tdElement, reset); - resizeDiv.style.visibility = 'hidden'; - resizeDiv.style.display = 'block'; - if (contextTable.cellControllerTop) { - const offset = this.util.getOffset(contextTable._element, this.context.element.wysiwygFrame); - resizeDiv.style.top = (offset.top - resizeDiv.offsetHeight - 2) + 'px'; - resizeDiv.style.left = (offset.left + contextTable.tableController.offsetWidth) + 'px'; + this.setControllerPosition(resizeDiv, contextTable._element, 'top', {left: contextTable.tableController.offsetWidth, top: 0}); } else { - const offset = this.util.getOffset(tdElement, this.context.element.wysiwygFrame); - resizeDiv.style.left = (offset.left - this.context.element.wysiwygFrame.scrollLeft) + 'px'; - resizeDiv.style.top = (offset.top + tdElement.offsetHeight + 12) + 'px'; - - const overLeft = this.context.element.wysiwygFrame.offsetWidth - (resizeDiv.offsetLeft + resizeDiv.offsetWidth); - if (overLeft < 0) { - resizeDiv.style.left = (resizeDiv.offsetLeft + overLeft) + 'px'; - resizeDiv.firstElementChild.style.left = (20 - overLeft) + 'px'; - } else { - resizeDiv.firstElementChild.style.left = '20px'; - } + this.setControllerPosition(resizeDiv, tdElement, 'bottom', {left: 0, top: 0}); } - - resizeDiv.style.visibility = ''; }, setCellInfo: function (tdElement, reset) { diff --git a/test/dev/suneditor_build_test.js b/test/dev/suneditor_build_test.js index f1c768b56..13df10f16 100644 --- a/test/dev/suneditor_build_test.js +++ b/test/dev/suneditor_build_test.js @@ -264,6 +264,7 @@ s1.onKeyDown = function (e, core) { let ss = window.ss = suneditor.create(document.getElementById('editor1'), { value: "", direction: 'rtl', + // tableCellControllerPosition: 'top', lang: lang.ko, plugins: plugins, katex: Katex, From 47aed8dd4e75f73d3e9b53041207425b6aab9b19 Mon Sep 17 00:00:00 2001 From: JiHong88 <0125ses@hanmail.net> Date: Thu, 15 Oct 2020 03:47:23 +0900 Subject: [PATCH 25/38] update: #450 rtl - core.setControllerPosition --- sample/html/out/document-editor.html | 4 +++- src/lib/core.d.ts | 2 ++ src/lib/core.js | 31 +++++++++++++++++++++------- src/plugins/modules/resizing.js | 3 ++- test/dev/suneditor_build_test.js | 2 +- 5 files changed, 32 insertions(+), 10 deletions(-) diff --git a/sample/html/out/document-editor.html b/sample/html/out/document-editor.html index d2b79fcfd..a4b139fd4 100644 --- a/sample/html/out/document-editor.html +++ b/sample/html/out/document-editor.html @@ -1006,7 +1006,9 @@
    Parameters:
    These are the left and top values that need to be added specially.
    - This argument is required. - {left: 0, top: 0} + This argument is required. - {left: 0, top: 0}
    + Please enter the value based on ltr mode.
    + Calculated automatically in rtl mode. diff --git a/src/lib/core.d.ts b/src/lib/core.d.ts index 171840433..0caf24c91 100644 --- a/src/lib/core.d.ts +++ b/src/lib/core.d.ts @@ -236,6 +236,8 @@ interface Core { * When using the "bottom" position there should be an arrow on the controller. * @param addOffset These are the left and top values that need to be added specially. * This argument is required. - {left: 0, top: 0} + * Please enter the value based on ltr mode. + * Calculated automatically in rtl mode. */ setControllerPosition(controller: Element, referEl: Element, position: 'top' | 'bottom', addOffset: {left: number, top: number}): void; diff --git a/src/lib/core.js b/src/lib/core.js index 796287b2b..6d155f1f3 100755 --- a/src/lib/core.js +++ b/src/lib/core.js @@ -604,12 +604,14 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re const toolbarW = toolbar.offsetWidth; const toolbarOffset = event._getEditorOffsets(context.element.toolbar); const menuW = menu.offsetWidth; - const rtlW = (options.rtl && menuW > element.offsetWidth) ? menuW - element.offsetWidth : 0; - const l = element.parentElement.offsetLeft + 3 - rtlW; + const l = element.parentElement.offsetLeft + 3; // rtl if (options.rtl) { - menu.style.left = l + 'px'; + const elementW = element.offsetWidth; + const rtlW = menuW > elementW ? menuW - elementW : 0; + const rtlL = rtlW > 0 ? 0 : elementW - menuW; + menu.style.left = (l - rtlW + rtlL) + 'px'; if (toolbarOffset.left > event._getEditorOffsets(menu).left) { menu.style.left = toolbarOffset.left + 'px'; } @@ -744,19 +746,34 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re * When using the "bottom" position there should be an arrow on the controller. * @param {Object} addOffset These are the left and top values that need to be added specially. * This argument is required. - {left: 0, top: 0} + * Please enter the value based on ltr mode. + * Calculated automatically in rtl mode. */ setControllerPosition: function (controller, referEl, position, addOffset) { + if (options.rtl) addOffset.left *= -1; + const offset = util.getOffset(referEl, context.element.wysiwygFrame); controller.style.visibility = 'hidden'; controller.style.display = 'block'; const topMargin = position === 'top' ? -(controller.offsetHeight + 2) : (referEl.offsetHeight + 12); - controller.style.left = (offset.left - context.element.wysiwygFrame.scrollLeft + addOffset.left) + 'px'; controller.style.top = (offset.top + topMargin + addOffset.top) + 'px'; - // overleft - if (position === 'bottom') { - const overLeft = context.element.wysiwygFrame.offsetWidth - (controller.offsetLeft + controller.offsetWidth); + const l = offset.left - context.element.wysiwygFrame.scrollLeft + addOffset.left; + const controllerW = controller.offsetWidth; + const referElW = referEl.offsetWidth; + + // rtl + if (options.rtl) { + const rtlW = (controllerW > referElW) ? controllerW - referElW : 0; + const rtlL = rtlW > 0 ? 0 : referElW - controllerW; + controller.style.left = (l - rtlW + rtlL) + 'px'; + if (rtlW > 0) { + controller.firstElementChild.style.left = (20 + rtlW) + 'px'; + } + } else { + controller.style.left = l + 'px'; + const overLeft = context.element.wysiwygFrame.offsetWidth - (controller.offsetLeft + controllerW); if (overLeft < 0) { controller.style.left = (controller.offsetLeft + overLeft) + 'px'; controller.firstElementChild.style.left = (20 - overLeft) + 'px'; diff --git a/src/plugins/modules/resizing.js b/src/plugins/modules/resizing.js index a998dfb39..e7832a737 100644 --- a/src/plugins/modules/resizing.js +++ b/src/plugins/modules/resizing.js @@ -472,8 +472,9 @@ if (this.currentControllerName !== plugin) { this.util.setDisabledButtons(true, this.resizingDisabledButtons); - this.controllersOn(resizeContainer, contextResizing.resizeButton, this.util.setDisabledButtons.bind(this, false, this.resizingDisabledButtons), targetElement, plugin); + resizeContainer.style.display = 'block'; this.setControllerPosition(contextResizing.resizeButton, resizeContainer, 'bottom', {left: 0, top: 50}); + this.controllersOn(resizeContainer, contextResizing.resizeButton, this.util.setDisabledButtons.bind(this, false, this.resizingDisabledButtons), targetElement, plugin); } contextResizing._resize_w = w; diff --git a/test/dev/suneditor_build_test.js b/test/dev/suneditor_build_test.js index 13df10f16..942cdd2b5 100644 --- a/test/dev/suneditor_build_test.js +++ b/test/dev/suneditor_build_test.js @@ -264,7 +264,7 @@ s1.onKeyDown = function (e, core) { let ss = window.ss = suneditor.create(document.getElementById('editor1'), { value: "", direction: 'rtl', - // tableCellControllerPosition: 'top', + tableCellControllerPosition: 'top', lang: lang.ko, plugins: plugins, katex: Katex, From 470ffe1a2d074927121ec86b9481b92bde7e60a1 Mon Sep 17 00:00:00 2001 From: JiHong88 <0125ses@hanmail.net> Date: Thu, 15 Oct 2020 15:35:45 +0900 Subject: [PATCH 26/38] update: #450 options-rtl --- README.md | 1 + sample/html/options.html | 3 +++ src/assets/css/suneditor.css | 5 +++-- src/lib/constructor.js | 2 +- src/options.d.ts | 4 ++++ test/dev/suneditor_build_test.js | 2 +- 6 files changed, 13 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 8f779c35d..c7baac101 100644 --- a/README.md +++ b/README.md @@ -350,6 +350,7 @@ attributesWhitelist : Add attributes whitelist of tags that should be kept und } // Layout------------------------------------------------------------------------------------------------------- mode : The mode of the editor ('classic', 'inline', 'balloon', 'balloon-always'). default: 'classic' {String} +rtl : If true, the editor is set to RTL(Right To Left) mode. default: false {Boolean} toolbarWidth : The width of the toolbar. Applies only when the editor mode is 'inline' or 'balloon' mode. default: 'auto' {Number|String} toolbarContainer: A custom HTML selector placing the toolbar inside. diff --git a/sample/html/options.html b/sample/html/options.html index fccadb757..7334fc37d 100644 --- a/sample/html/options.html +++ b/sample/html/options.html @@ -106,6 +106,8 @@

    --Layout



    + +



    @@ -477,6 +479,7 @@

    Applied options

    'input': 'checked' }, mode: modeSelect.options[modeSelect.selectedIndex].value, + rtl: document.getElementById('rtl').checked, toolbarWidth: document.getElementById('toolbarWidth').checked ? document.getElementById('toolbarWidth_value').value : undefined, toolbarContainer: document.getElementById('toolbarContainer').checked ? '#custom_toolbar' : undefined, stickyToolbar: document.getElementById('stickyToolbar').checked ? document.getElementById('stickyToolbar_value').value : undefined, diff --git a/src/assets/css/suneditor.css b/src/assets/css/suneditor.css index 122e90bbc..709c8876d 100755 --- a/src/assets/css/suneditor.css +++ b/src/assets/css/suneditor.css @@ -167,9 +167,10 @@ /* tool bar select button (font, fontSize, formatBlock) */ .sun-editor .se-btn-select {width:auto; display:flex; padding:4px 6px;} .sun-editor .se-btn-select .txt {flex:auto; text-align:left;} +.sun-editor.se-rtl .se-btn-select svg {margin:auto 1px;} .sun-editor .se-btn-select.se-btn-tool-font {width:100px;} -.sun-editor .se-btn-select.se-btn-tool-format {width:80px;} -.sun-editor .se-btn-select.se-btn-tool-size {width:80px;} +.sun-editor .se-btn-select.se-btn-tool-format {width:82px;} +.sun-editor .se-btn-select.se-btn-tool-size {width:78px;} /** --- menu tray -------------------------------------------------------------- */ .sun-editor .se-btn-tray {position:relative; width:100%; height:100%; margin:0; padding:0;} diff --git a/src/lib/constructor.js b/src/lib/constructor.js index 40fbc5510..633577759 100755 --- a/src/lib/constructor.js +++ b/src/lib/constructor.js @@ -387,7 +387,7 @@ export default { options.attributesWhitelist = (!options.attributesWhitelist || typeof options.attributesWhitelist !== 'object') ? null : options.attributesWhitelist; /** Layout */ options.mode = options.mode || 'classic'; // classic, inline, balloon, balloon-always - options.rtl = /rtl/i.test(options.direction); + options.rtl = !!options.rtl; options.toolbarWidth = options.toolbarWidth ? (util.isNumber(options.toolbarWidth) ? options.toolbarWidth + 'px' : options.toolbarWidth) : 'auto'; options.toolbarContainer = /balloon/i.test(options.mode) ? null : (typeof options.toolbarContainer === 'string' ? document.querySelector(options.toolbarContainer) : options.toolbarContainer); options.stickyToolbar = (/balloon/i.test(options.mode) || !!options.toolbarContainer) ? -1 : options.stickyToolbar === undefined ? 0 : (/^\d+/.test(options.stickyToolbar) ? util.getNumber(options.stickyToolbar, 0) : -1); diff --git a/src/options.d.ts b/src/options.d.ts index 86faef646..faa8871f8 100644 --- a/src/options.d.ts +++ b/src/options.d.ts @@ -40,6 +40,10 @@ export interface SunEditorOptions { * The mode of the editor (classic, inline, balloon, balloon-always) */ mode?: 'classic' | 'inline' | 'balloon' | 'balloon-always'; + /** + * If true, the editor is set to RTL(Right To Left) mode. + */ + rtl?: boolean; /** * Button List */ diff --git a/test/dev/suneditor_build_test.js b/test/dev/suneditor_build_test.js index 942cdd2b5..57accedb9 100644 --- a/test/dev/suneditor_build_test.js +++ b/test/dev/suneditor_build_test.js @@ -263,7 +263,7 @@ s1.onKeyDown = function (e, core) { let ss = window.ss = suneditor.create(document.getElementById('editor1'), { value: "", - direction: 'rtl', + rtl: true, tableCellControllerPosition: 'top', lang: lang.ko, plugins: plugins, From 5a7b78c8617b1d30b7965f9543cc4c2bcb3af22f Mon Sep 17 00:00:00 2001 From: JiHong88 <0125ses@hanmail.net> Date: Thu, 15 Oct 2020 16:10:17 +0900 Subject: [PATCH 27/38] fix: #450 rtl - controller position --- src/lib/core.js | 16 ++++++++++++---- src/plugins/submenu/table.js | 4 ++-- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/lib/core.js b/src/lib/core.js index 6d155f1f3..b3fc22bb7 100755 --- a/src/lib/core.js +++ b/src/lib/core.js @@ -768,15 +768,23 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re const rtlW = (controllerW > referElW) ? controllerW - referElW : 0; const rtlL = rtlW > 0 ? 0 : referElW - controllerW; controller.style.left = (l - rtlW + rtlL) + 'px'; + if (rtlW > 0) { controller.firstElementChild.style.left = (20 + rtlW) + 'px'; } + + const overSize = context.element.wysiwygFrame.offsetLeft - controller.offsetLeft; + if (overSize > 0) { + controller.style.left = '0px'; + controller.firstElementChild.style.left = overSize + 'px'; + } } else { controller.style.left = l + 'px'; - const overLeft = context.element.wysiwygFrame.offsetWidth - (controller.offsetLeft + controllerW); - if (overLeft < 0) { - controller.style.left = (controller.offsetLeft + overLeft) + 'px'; - controller.firstElementChild.style.left = (20 - overLeft) + 'px'; + + const overSize = context.element.wysiwygFrame.offsetWidth - (controller.offsetLeft + controllerW); + if (overSize < 0) { + controller.style.left = (controller.offsetLeft + overSize) + 'px'; + controller.firstElementChild.style.left = (20 - overSize) + 'px'; } else { controller.firstElementChild.style.left = '20px'; } diff --git a/src/plugins/submenu/table.js b/src/plugins/submenu/table.js index 5303edf80..46e7cf840 100644 --- a/src/plugins/submenu/table.js +++ b/src/plugins/submenu/table.js @@ -323,11 +323,11 @@ export default { } const tableElement = contextTable._element || this.plugins.table._selectedTable || this.util.getParentElement(tdElement, 'TABLE'); - tablePlugin.setPositionControllerTop.call(this, tableElement); contextTable._maxWidth = this.util.hasClass(tableElement, 'se-table-size-100') || tableElement.style.width === '100%' || (!tableElement.style.width && !this.util.hasClass(tableElement, 'se-table-size-auto')); contextTable._fixedColumn = this.util.hasClass(tableElement, 'se-table-layout-fixed') || tableElement.style.tableLayout === 'fixed'; tablePlugin.setTableStyle.call(this, contextTable._maxWidth ? 'width|column' : 'width'); - + + tablePlugin.setPositionControllerTop.call(this, tableElement); tablePlugin.setPositionControllerDiv.call(this, tdElement, tablePlugin._shift); if (!tablePlugin._shift) this.controllersOn(contextTable.resizeDiv, contextTable.tableController, tablePlugin.init.bind(this), tdElement, 'table'); From 91a2a201b9ed3cbe6e95371caa0407389e872939 Mon Sep 17 00:00:00 2001 From: JiHong88 <0125ses@hanmail.net> Date: Thu, 15 Oct 2020 20:20:37 +0900 Subject: [PATCH 28/38] update: #450 buttonList reverse --- src/lib/constructor.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/lib/constructor.js b/src/lib/constructor.js index 633577759..95597b2ab 100755 --- a/src/lib/constructor.js +++ b/src/lib/constructor.js @@ -500,6 +500,11 @@ export default { ['preview', 'print'] ]; + /** RTL - buttons */ + if (options.rtl) { + options.buttonList = options.buttonList.reverse(); + } + /** --- Define icons --- */ // custom icons options.icons = (!options.icons || typeof options.icons !== 'object') ? _icons : [_icons, options.icons].reduce(function (_default, _new) { From 8d447649e60796ffd95fa70a70633a0d8a23b586 Mon Sep 17 00:00:00 2001 From: JiHong88 <0125ses@hanmail.net> Date: Thu, 15 Oct 2020 20:32:52 +0900 Subject: [PATCH 29/38] fix: #450 url input LTR --- src/assets/css/suneditor.css | 1 + src/plugins/dialog/image.js | 6 +++--- src/plugins/dialog/link.js | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/assets/css/suneditor.css b/src/assets/css/suneditor.css index 709c8876d..af13261d8 100755 --- a/src/assets/css/suneditor.css +++ b/src/assets/css/suneditor.css @@ -304,6 +304,7 @@ .sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-input-select {display:inline-block; width:auto; height:34px; font-size:14px; text-align:center; line-height:1.42857143;} .sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-input-control {display:inline-block; width:70px; height:34px; font-size:14px; text-align:center; line-height:1.42857143;} .sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-input-form {display:block; width:100%; height:34px; font-size:14px; line-height:1.42857143; padding:0 4px;} +.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-input-form.se-input-url {direction:ltr;} .sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-input-form.se-input-url:disabled {text-decoration:line-through; color:#999;} .sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-video-ratio {width:70px; margin-left:4px;} .sun-editor .se-dialog .se-dialog-inner .se-dialog-form a {color:#004cff;} diff --git a/src/plugins/dialog/image.js b/src/plugins/dialog/image.js index 706b9a9eb..5c81515aa 100644 --- a/src/plugins/dialog/image.js +++ b/src/plugins/dialog/image.js @@ -64,7 +64,7 @@ export default { let image_dialog = this.setDialog.call(core); contextImage.modal = image_dialog; contextImage.imgInputFile = image_dialog.querySelector('._se_image_file'); - contextImage.imgUrlFile = image_dialog.querySelector('.se-input-url'); + contextImage.imgUrlFile = image_dialog.querySelector('._se_image_url'); contextImage.focusElement = contextImage.imgInputFile || contextImage.imgUrlFile; contextImage.altText = image_dialog.querySelector('._se_image_alt'); contextImage.imgLink = image_dialog.querySelector('._se_image_link'); @@ -152,7 +152,7 @@ export default { '
    ' + '' + '
    ' + - '' + + '' + ((option.imageGalleryUrl && this.plugins.imageGallery) ? '' : '') + '
    ' + '' + @@ -200,7 +200,7 @@ export default { '',t},appendHr:function(e){const t=this.util.createElement("HR");return t.className=e,this.focus(),this.insertComponent(t,!1,!0,!1)},horizontalRulePick:function(e){e.preventDefault(),e.stopPropagation();let t=e.target,n=null;for(;!n&&!/UL/i.test(t.tagName);)n=t.getAttribute("data-value"),t=t.parentNode;if(!n)return;const i=this.plugins.horizontalRule.appendHr.call(this,"__se__"+n);i&&(this.setRange(i,0,i,0),this.submenuOff())}},list:{name:"list",display:"submenu",add:function(e,t){const n=e.context;n.list={targetButton:t,_list:null,currentList:"",icons:{bullets:e.icons.list_bullets,number:e.icons.list_number}};let i=this.setSubmenu.call(e),l=i.querySelector("ul");l.addEventListener("click",this.pickup.bind(e)),n.list._list=l.querySelectorAll("li button"),e.initMenuTarget(this.name,t,i),i=null,l=null},setSubmenu:function(){const e=this.lang,t=this.util.createElement("DIV");return t.className="se-submenu se-list-layer",t.innerHTML='
    ",t},active:function(e){const t=this.context.list.targetButton,n=t.firstElementChild,i=this.util;if(e){if(i.isList(e)){const l=e.nodeName;return t.setAttribute("data-focus",l),i.addClass(t,"active"),/UL/i.test(l)?i.changeElement(n,this.context.list.icons.bullets):i.changeElement(n,this.context.list.icons.number),!0}}else t.removeAttribute("data-focus"),i.changeElement(n,this.context.list.icons.number),i.removeClass(t,"active");return!1},on:function(){const e=this.context.list,t=e._list,n=e.targetButton.getAttribute("data-focus")||"";if(n!==e.currentList){for(let e=0,i=t.length;e"),t.innerHTML+=n.outerHTML,e&&(t.innerHTML+="
    ")}else{const e=n.childNodes;for(;e[0];)t.appendChild(e[0])}a.appendChild(t),r||(u=a),r&&m===g&&!o.isRangeFormatElement(f)||(d||(d=a),i&&r&&m===g||r&&o.isList(g)&&g===c||a.parentNode!==m&&m.insertBefore(a,f)),o.removeItem(n),i&&null===h&&(h=a.children.length-1),r&&(o.getRangeFormatElement(g,p)!==o.getRangeFormatElement(c,p)||o.isList(g)&&o.isList(c)&&o.getElementDepth(g)!==o.getElementDepth(c))&&(a=o.createElement(e)),_&&0===_.children.length&&o.removeItem(_)}else o.removeItem(n);h&&(d=d.children[h]),s&&(g=a.children.length-1,a.innerHTML+=c.innerHTML,u=a.children[g],o.removeItem(c))}else{if(n)for(let e=0,t=l.length;e=0;n--)if(l[n].contains(l[e])){l.splice(e,1),e--,t--;break}const t=o.getRangeFormatElement(s),i=t&&t.tagName===e;let a,r;const c=function(e){return!this.isComponent(e)}.bind(o);i||(r=o.createElement(e));for(let t,s,d=0,u=l.length;d0){const e=l.cloneNode(!1),t=l.childNodes,o=this.util.getPositionIndex(i);for(;t[o];)e.appendChild(t[o]);n.appendChild(e)}0===l.children.length&&this.util.removeItem(l),this.util.mergeSameTags(s);const a=this.util.getEdgeChildNodes(t,n);return{cc:t.parentNode,sc:a.sc,ec:a.ec}},editInsideList:function(e,t){const n=(t=t||this.getSelectedElements().filter(function(e){return this.isListCell(e)}.bind(this.util))).length;if(0===n||!e&&!this.util.isListCell(t[0].previousElementSibling)&&!this.util.isListCell(t[n-1].nextElementSibling))return{sc:t[0],so:0,ec:t[n-1],eo:1};let i=t[0].parentNode,l=t[n-1],o=null;if(e){if(i!==l.parentNode&&this.util.isList(l.parentNode.parentNode)&&l.nextElementSibling)for(l=l.nextElementSibling;l;)t.push(l),l=l.nextElementSibling;o=this.plugins.list.editList.call(this,i.nodeName.toUpperCase(),t,!0)}else{let e=this.util.createElement(i.nodeName),s=t[0].previousElementSibling,a=l.nextElementSibling;const r={s:null,e:null,sl:i,el:i};for(let l,o=0,c=n;o span > span"),n.table.columnFixedButton=o.querySelector("._se_table_fixed_column"),n.table.headerButton=o.querySelector("._se_table_header"),o.addEventListener("mousedown",e.eventStop);let s=this.setController_tableEditor.call(e,n.table.cellControllerTop);n.table.resizeDiv=s,n.table.splitMenu=s.querySelector(".se-btn-group-sub"),n.table.mergeButton=s.querySelector("._se_table_merge_button"),n.table.splitButton=s.querySelector("._se_table_split_button"),n.table.insertRowAboveButton=s.querySelector("._se_table_insert_row_a"),n.table.insertRowBelowButton=s.querySelector("._se_table_insert_row_b"),s.addEventListener("mousedown",e.eventStop),l.addEventListener("mousemove",this.onMouseMove_tablePicker.bind(e)),l.addEventListener("click",this.appendTable.bind(e)),s.addEventListener("click",this.onClick_tableController.bind(e)),o.addEventListener("click",this.onClick_tableController.bind(e)),e.initMenuTarget(this.name,t,i),n.element.relative.appendChild(s),n.element.relative.appendChild(o),i=null,l=null,s=null,o=null},setSubmenu:function(){const e=this.util.createElement("DIV");return e.className="se-submenu se-selector-table",e.innerHTML='
    1 x 1
    ',e},setController_table:function(){const e=this.lang,t=this.icons,n=this.util.createElement("DIV");return n.className="se-controller se-controller-table",n.innerHTML='
    ",n},setController_tableEditor:function(e){const t=this.lang,n=this.icons,i=this.util.createElement("DIV");return i.className="se-controller se-controller-table-cell",i.innerHTML=(e?"":'
    ')+'
    • '+t.controller.VerticalSplit+'
    • '+t.controller.HorizontalSplit+"
    ",i},appendTable:function(){const e=this.util.createElement("TABLE"),t=this.plugins.table.createCells,n=this.context.table._tableXY[0];let i=this.context.table._tableXY[1],l="";for(;i>0;)l+=""+t.call(this,"td",n)+"",--i;l+="",e.innerHTML=l;if(this.insertComponent(e,!1,!0,!1)){const t=e.querySelector("td div");this.setRange(t,0,t,0),this.plugins.table.reset_table_picker.call(this)}},createCells:function(e,t,n){if(e=e.toLowerCase(),n){const t=this.util.createElement(e);return t.innerHTML="

    ",t}{let n="";for(;t>0;)n+="<"+e+">

    ",t--;return n}},onMouseMove_tablePicker:function(e){e.stopPropagation();let t=this._w.Math.ceil(e.offsetX/18),n=this._w.Math.ceil(e.offsetY/18);t=t<1?1:t,n=n<1?1:n,this.context.table.tableHighlight.style.width=t+"em",this.context.table.tableHighlight.style.height=n+"em";this.context.table.tableUnHighlight.style.width="10em",this.context.table.tableUnHighlight.style.height="10em",this.util.changeTxt(this.context.table.tableDisplay,t+" x "+n),this.context.table._tableXY=[t,n]},reset_table_picker:function(){if(!this.context.table.tableHighlight)return;const e=this.context.table.tableHighlight.style,t=this.context.table.tableUnHighlight.style;e.width="1em",e.height="1em",t.width="10em",t.height="10em",this.util.changeTxt(this.context.table.tableDisplay,"1 x 1"),this.submenuOff()},init:function(){const e=this.context.table,t=this.plugins.table;if(t._removeEvents.call(this),t._selectedTable){const e=t._selectedTable.querySelectorAll(".se-table-selected-cell");for(let t=0,n=e.length;t0)for(let e,t=0;to||(u>=e.index?(i+=e.cs,u+=e.cs,e.rs-=1,e.row=o+1,e.rs<1&&(r.splice(t,1),t--)):h===g-1&&(e.rs-=1,e.row=o+1,e.rs<1&&(r.splice(t,1),t--)));if(o===s&&h===l){n._logical_cellIndex=u;break}d>0&&a.push({index:u,cs:c+1,rs:d,row:-1}),i+=c}r=r.concat(a).sort((function(e,t){return e.index-t.index})),a=[]}a=null,r=null}},editTable:function(e,t){const n=this.plugins.table,i=this.context.table,l=i._element,o="row"===e;if(o){const e=i._trElement.parentNode;if(/^THEAD$/i.test(e.nodeName)){if("up"===t)return;if(!e.nextElementSibling||!/^TBODY$/i.test(e.nextElementSibling.nodeName))return void(l.innerHTML+=""+n.createCells.call(this,"td",i._logical_cellCnt,!1)+"")}}if(n._ref){const e=i._tdElement,l=n._selectedCells;if(o)if(t)n.setCellInfo.call(this,"up"===t?l[0]:l[l.length-1],!0),n.editRow.call(this,t,e);else{let e=l[0].parentNode;const i=[l[0]];for(let t,n=1,o=l.length;ns&&s>t&&(e[l].rowSpan=n+a,c-=i)}if(i){const e=r[o+1];if(e){const t=[];let n=r[o].cells,i=0;for(let e,l,o=0,s=n.length;o1&&(e.rowSpan-=1,t.push({cell:e.cloneNode(!1),index:l}));if(t.length>0){let l=t.shift();n=e.cells,i=0;for(let o,s,a=0,r=n.length;a=l.index)||(a--,i--,i+=l.cell.colSpan-1,e.insertBefore(l.cell,o),l=t.shift(),l));a++);if(l){e.appendChild(l.cell);for(let n=0,i=t.length;n0){const e=!o[b+1];for(let t,n=0;n_||(p>=t.index?(f+=t.cs,p=b+f,t.rs-=1,t.row=_+1,t.rs<1&&(d.splice(n,1),n--)):e&&(t.rs-=1,t.row=_+1,t.rs<1&&(d.splice(n,1),n--)))}n>0&&c.push({rs:n,cs:r+1,index:p,row:-1}),p>=t&&p+r<=t+s?h.push(e):p<=t+s&&p+r>=t?e.colSpan-=i.getOverlapRangeAtIndex(a,a+s,p,p+r):n>0&&(pt+s)&&g.push({cell:e,i:_,rs:_+n}),f+=r}else{if(b>=t)break;if(r>0){if(u<1&&r+b>=t){e.colSpan+=1,t=null,u=n+1;break}t-=r}if(!m){for(let e,n=0;n0){u-=1;continue}null!==t&&o.length>0&&(p=this.plugins.table.createCells.call(this,o[0].nodeName,0,!0),p=e.insertBefore(p,o[t]))}}if(l){let e,t;for(let n,l=0,o=h.length;l1)c.colSpan=this._w.Math.floor(e/2),l.colSpan=e-c.colSpan,s.insertBefore(c,l.nextElementSibling);else{let t=[],n=[];for(let s,r,c=0,d=i._rowCnt;c0)for(let e,t=0;tc||(u>=e.index?(r+=e.cs,u+=e.cs,e.rs-=1,e.row=c+1,e.rs<1&&(n.splice(t,1),t--)):h===g-1&&(e.rs-=1,e.row=c+1,e.rs<1&&(n.splice(t,1),t--)));if(u<=a&&d>0&&t.push({index:u,cs:o+1,rs:d,row:-1}),i!==l&&u<=a&&u+o>=a+e-1){i.colSpan+=1;break}if(u>a)break;r+=o}n=n.concat(t).sort((function(e,t){return e.index-t.index})),t=[]}s.insertBefore(c,l.nextElementSibling)}}else{const e=l.rowSpan;if(c.colSpan=l.colSpan,e>1){c.rowSpan=this._w.Math.floor(e/2);const n=e-c.rowSpan,i=[],r=t.getArrayIndex(o,s)+n;for(let e,t,n=0;n=a));c++)l=e[c],o=l.rowSpan-1,o>0&&o+n>=r&&s=h.index&&(r+=h.cs,l+=h.cs,h=i.shift()),l>=a||o===s-1){d.insertBefore(c,e.nextElementSibling);break}r+=t}l.rowSpan=n}else{c.rowSpan=l.rowSpan;const e=t.createElement("TR");e.appendChild(c);for(let e,t=0;t=r&&(e[n].rowSpan+=1)}const n=i._physical_cellIndex,a=s.cells;for(let e=0,t=a.length;e0&&s+o>=i&&(e.rowSpan-=n.getOverlapRangeAtIndex(i,l,s,s+o));else o.push(e[s]);for(let e=0,t=o.length;e"+this.plugins.table.createCells.call(this,"th",this.context.table._logical_cellCnt,!1)+"",i.insertBefore(t,i.firstElementChild)}e.toggleClass(t,"active"),/TH/i.test(this.context.table._tdElement.nodeName)?this.controllersOff():this.plugins.table.setPositionControllerDiv.call(this,this.context.table._tdElement,!1)},setTableStyle:function(e){const t=this.context.table,n=t._element;let i,l,o,s;e.indexOf("width")>-1&&(i=t.resizeButton.firstElementChild,l=t.resizeText,t._maxWidth?(o=t.icons.reduction,s=t.minText,t.columnFixedButton.style.display="block",this.util.removeClass(n,"se-table-size-auto"),this.util.addClass(n,"se-table-size-100")):(o=t.icons.expansion,s=t.maxText,t.columnFixedButton.style.display="none",this.util.removeClass(n,"se-table-size-100"),this.util.addClass(n,"se-table-size-auto")),this.util.changeElement(i,o),this.util.changeTxt(l,s)),e.indexOf("column")>-1&&(t._fixedColumn?(this.util.removeClass(n,"se-table-layout-auto"),this.util.addClass(n,"se-table-layout-fixed"),this.util.addClass(t.columnFixedButton,"active")):(this.util.removeClass(n,"se-table-layout-fixed"),this.util.addClass(n,"se-table-layout-auto"),this.util.removeClass(t.columnFixedButton,"active")))},setActiveButton:function(e,t){const n=this.context.table;/^TH$/i.test(e.nodeName)?(n.insertRowAboveButton.setAttribute("disabled",!0),n.insertRowBelowButton.setAttribute("disabled",!0)):(n.insertRowAboveButton.removeAttribute("disabled"),n.insertRowBelowButton.removeAttribute("disabled")),t&&e!==t?(n.splitButton.setAttribute("disabled",!0),n.mergeButton.removeAttribute("disabled")):(n.splitButton.removeAttribute("disabled"),n.mergeButton.setAttribute("disabled",!0))},_bindOnSelect:null,_bindOffSelect:null,_bindOffShift:null,_selectedCells:null,_shift:!1,_fixedCell:null,_fixedCellName:null,_selectedCell:null,_selectedTable:null,_ref:null,_toggleEditor:function(e){this.context.element.wysiwyg.setAttribute("contenteditable",e),e?this.util.removeClass(this.context.element.wysiwyg,"se-disabled"):this.util.addClass(this.context.element.wysiwyg,"se-disabled")},_offCellMultiSelect:function(e){e.stopPropagation();const t=this.plugins.table;t._shift?t._initBind&&(this._wd.removeEventListener("touchmove",t._initBind),t._initBind=null):(t._removeEvents.call(this),t._toggleEditor.call(this,!0)),t._fixedCell&&t._selectedTable&&(t.setActiveButton.call(this,t._fixedCell,t._selectedCell),t.call_controller_tableEdit.call(this,t._selectedCell||t._fixedCell),t._selectedCells=t._selectedTable.querySelectorAll(".se-table-selected-cell"),t._selectedCell&&t._fixedCell&&this.focusEdge(t._selectedCell),t._shift||(t._fixedCell=null,t._selectedCell=null,t._fixedCellName=null))},_onCellMultiSelect:function(e){this._antiBlur=!0;const t=this.plugins.table,n=this.util.getParentElement(e.target,this.util.isCell);if(t._shift)n===t._fixedCell?t._toggleEditor.call(this,!0):t._toggleEditor.call(this,!1);else if(!t._ref){if(n===t._fixedCell)return;t._toggleEditor.call(this,!1)}n&&n!==t._selectedCell&&t._fixedCellName===n.nodeName&&t._selectedTable===this.util.getParentElement(n,"TABLE")&&(t._selectedCell=n,t._setMultiCells.call(this,t._fixedCell,n))},_setMultiCells:function(e,t){const n=this.plugins.table,i=n._selectedTable.rows,l=this.util,o=n._selectedTable.querySelectorAll(".se-table-selected-cell");for(let e=0,t=o.length;e0)for(let e,t=0;td||(u>=e.index?(o+=e.cs,u+=e.cs,e.rs-=1,e.row=d+1,e.rs<1&&(a.splice(t,1),t--)):p===m-1&&(e.rs-=1,e.row=d+1,e.rs<1&&(a.splice(t,1),t--)));if(s){if(i!==e&&i!==t||(c.cs=null!==c.cs&&c.csu+h?c.ce:u+h,c.rs=null!==c.rs&&c.rsd+g?c.re:d+g,c._i+=1),2===c._i){s=!1,a=[],r=[],d=-1;break}}else if(l.getOverlapRangeAtIndex(c.cs,c.ce,u,u+h)&&l.getOverlapRangeAtIndex(c.rs,c.re,d,d+g)){const e=c.csu+h?c.ce:u+h,n=c.rsd+g?c.re:d+g;if(c.cs!==e||c.ce!==t||c.rs!==n||c.re!==o){c.cs=e,c.ce=t,c.rs=n,c.re=o,d=-1,a=[],r=[];break}l.addClass(i,"se-table-selected-cell")}g>0&&r.push({index:u,cs:h+1,rs:g,row:-1}),o+=i.colSpan-1}a=a.concat(r).sort((function(e,t){return e.index-t.index})),r=[]}},_removeEvents:function(){const e=this.plugins.table;e._initBind&&(this._wd.removeEventListener("touchmove",e._initBind),e._initBind=null),e._bindOnSelect&&(this._wd.removeEventListener("mousedown",e._bindOnSelect),this._wd.removeEventListener("mousemove",e._bindOnSelect),e._bindOnSelect=null),e._bindOffSelect&&(this._wd.removeEventListener("mouseup",e._bindOffSelect),e._bindOffSelect=null),e._bindOffShift&&(this._wd.removeEventListener("keyup",e._bindOffShift),e._bindOffShift=null)},_initBind:null,onTableCellMultiSelect:function(e,t){const n=this.plugins.table;n._removeEvents.call(this),this.controllersOff(),n._shift=t,n._fixedCell=e,n._fixedCellName=e.nodeName,n._selectedTable=this.util.getParentElement(e,"TABLE");const i=n._selectedTable.querySelectorAll(".se-table-selected-cell");for(let e=0,t=i.length;e-1?(n=e.toLowerCase(),s="blockquote"===n?"range":"pre"===n?"free":"replace",r=/^h/.test(n)?n.match(/\d+/)[0]:"",a=t["tag_"+(r?"h":n)]+r,d="",c=""):(n=e.tag.toLowerCase(),s=e.command,a=e.name||n,d=e.class,c=d?' class="'+d+'"':""),o+='
  • ";return o+="
    ",n.innerHTML=o,n},active:function(e){let t=this.lang.toolbar.formats;const n=this.context.formatBlock.targetText,i=this.context.formatBlock.targetTooltip;if(e){if(this.util.isFormatElement(e)){const l=this.context.formatBlock._formatList,o=e.nodeName.toLowerCase(),s=(e.className.match(/(\s|^)__se__format__[^\s]+/)||[""])[0].trim();for(let e,n=0,i=l.length;n=0;u--)if(i=p[u],i!==(p[u+1]?p[u+1].parentNode:null)){if(d=r.isComponent(i),o=d?"":i.innerHTML.replace(/(?!>)\s+(?=<)|\n/g," "),s=r.getParentElement(i,(function(e){return e.parentNode===t})),(t!==i.parentNode||d)&&(r.isFormatElement(t)?(t.parentNode.insertBefore(n,t.nextSibling),t=t.parentNode):(t.insertBefore(n,s?s.nextSibling:null),t=i.parentNode),a=n.nextSibling,a&&n.nodeName===a.nodeName&&r.isSameAttributes(n,a)&&(n.innerHTML+="
    "+a.innerHTML,r.removeItem(a)),n=l.cloneNode(!1),h=!0),c=n.innerHTML,n.innerHTML=(h||!o||!c||/
    $/i.test(o)?o:o+"
    ")+c,0===u){t.insertBefore(n,i),a=i.nextSibling,a&&n.nodeName===a.nodeName&&r.isSameAttributes(n,a)&&(n.innerHTML+="
    "+a.innerHTML,r.removeItem(a));const e=n.previousSibling;e&&n.nodeName===e.nodeName&&r.isSameAttributes(n,e)&&(e.innerHTML+="
    "+n.innerHTML,r.removeItem(n))}d||r.removeItem(i),o&&(h=!1)}this.setRange(i,0,i,0)}else{for(let e,t,n=0,s=p.length;n('+t.toolbar.default+")";for(let e,t=0,n=i.length;t";return l+="
    ",n.innerHTML=l,n},on:function(){const e=this.context.lineHeight,t=e._sizeList,n=this.util.getFormatElement(this.getSelectionNode()),i=n?n.style.lineHeight+"":"";if(i!==e.currentSize){for(let e=0,n=t.length;e"}return o+="",t.innerHTML=o,t},on:function(){const e=this.context.paragraphStyle._classList,t=this.util.getFormatElement(this.getSelectionNode());for(let n=0,i=e.length;n"}return l+="",t.innerHTML=l,t},on:function(){const e=this.util,t=this.context.textStyle._styleList,n=this.getSelectionNode();for(let i,l,o,s=0,a=t.length;s'+(e.alt||t)+'
    '+(e.name||t)+"
    "},setImage:function(e){this.callPlugin("image",function(){const t={name:e.parentNode.querySelector(".__se__img_name").textContent,size:0};this.context.image._altText=e.alt,this.plugins.image.create_image.call(this,e.src,"",!1,this.context.image._origin_w,this.context.image._origin_h,"none",t)}.bind(this),null)}}},x={redo:'',undo:'',bold:'',underline:'',italic:'',strike:'',subscript:'',superscript:'',erase:'',indent:'',outdent:'',expansion:'',reduction:'',code_view:'',preview:'',print:'',template:'',line_height:'',paragraph_style:'',text_style:'',save:'',blockquote:'',arrow_down:'',align_justify:'',align_left:'',align_right:'',align_center:'',font_color:'',highlight_color:'',list_bullets:'',list_number:'',table:'',horizontal_rule:'',show_blocks:'',cancel:'',image:'',video:'',link:'',math:'',unlink:'',table_header:'',merge_cell:'',split_cell:'',caption:'',edit:'',delete:'',modify:'',revert:'',auto_size:'',insert_row_below:'',insert_row_above:'',insert_column_left:'',insert_column_right:'',delete_row:'',delete_column:'',fixed_column_width:'',rotate_left:'',rotate_right:'',mirror_horizontal:'',mirror_vertical:'',checked:'',line_break:'',audio:'',image_gallery:'',more_text:'',more_paragraph:'',more_plus:'',more_horizontal:'',more_vertical:'',attachment:'',map:'',magic_stick:'',empty_file:''},E=n("P6u4"),S=n.n(E);const N={_d:null,_w:null,isIE:null,isIE_Edge:null,isOSX_IOS:null,_propertiesInit:function(){this._d||(this._d=document,this._w=window,this.isIE=navigator.userAgent.indexOf("Trident")>-1,this.isIE_Edge=navigator.userAgent.indexOf("Trident")>-1||navigator.appVersion.indexOf("Edge")>-1,this.isOSX_IOS=/(Mac|iPhone|iPod|iPad)/.test(navigator.platform))},_HTMLConvertor:function(e){const t={"&":"&"," ":" ","'":"'",'"':""","<":"<",">":">"};return e.replace(/&|\u00A0|'|"|<|>/g,(function(e){return"string"==typeof t[e]?t[e]:e}))},zeroWidthSpace:String.fromCharCode(8203),zeroWidthRegExp:new RegExp(String.fromCharCode(8203),"g"),onlyZeroWidthRegExp:new RegExp("^"+String.fromCharCode(8203)+"+$"),onlyZeroWidthSpace:function(e){return"string"!=typeof e&&(e=e.textContent),""===e||this.onlyZeroWidthRegExp.test(e)},getXMLHttpRequest:function(){if(!this._w.ActiveXObject)return this._w.XMLHttpRequest?new XMLHttpRequest:null;try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(e){try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(e){return null}}},createElement:function(e){return this._d.createElement(e)},createTextNode:function(e){return this._d.createTextNode(e||"")},HTMLEncoder:function(e){const t={"<":"$lt;",">":"$gt;"};return e.replace(/<|>/g,(function(e){return"string"==typeof t[e]?t[e]:e}))},HTMLDecoder:function(e){const t={"$lt;":"<","$gt;":">"};return e.replace(/\$lt;|\$gt;/g,(function(e){return"string"==typeof t[e]?t[e]:e}))},hasOwn:function(e,t){return this._hasOwn.call(e,t)},_hasOwn:Object.prototype.hasOwnProperty,getIncludePath:function(e,t){let n="";const i=[],l="js"===t?"script":"link",o="js"===t?"src":"href";let s="(?:";for(let t=0,n=e.length;t0?i[0][o]:""),-1===n.indexOf(":/")&&"//"!==n.slice(0,2)&&(n=0===n.indexOf("/")?location.href.match(/^.*?:\/\/[^\/]*/)[0]+n:location.href.match(/^[^\?]*\/(?:)/)[0]+n),!n)throw"[SUNEDITOR.util.getIncludePath.fail] The SUNEDITOR installation path could not be automatically detected. (name: +"+name+", extension: "+t+")";return n},getPageStyle:function(e){let t="";const n=(e||this._d).styleSheets;for(let e,i=0,l=n.length;i-1||(i+=n[e].name+'="'+n[e].value+'" ');return i},getByteLength:function(e){const t=this._w.encodeURIComponent;let n,i;return this.isIE_Edge?(i=this._w.unescape(t(e.toString())).length,n=0,null!==t(e.toString()).match(/(%0A|%0D)/gi)&&(n=t(e.toString()).match(/(%0A|%0D)/gi).length),i+n):(i=new this._w.TextEncoder("utf-8").encode(e.toString()).length,n=0,null!==t(e.toString()).match(/(%0A|%0D)/gi)&&(n=t(e.toString()).match(/(%0A|%0D)/gi).length),i+n)},isWysiwygDiv:function(e){return e&&1===e.nodeType&&(this.hasClass(e,"se-wrapper-wysiwyg")||/^BODY$/i.test(e.nodeName))},isNonEditable:function(e){return e&&1===e.nodeType&&"false"===e.getAttribute("contenteditable")},isTextStyleElement:function(e){return e&&3!==e.nodeType&&/^(strong|span|font|b|var|i|em|u|ins|s|strike|del|sub|sup|mark|a|label|code)$/i.test(e.nodeName)},isFormatElement:function(e){return e&&1===e.nodeType&&(/^(P|DIV|H[1-6]|PRE|LI|TH|TD)$/i.test(e.nodeName)||this.hasClass(e,"(\\s|^)__se__format__replace_.+(\\s|$)|(\\s|^)__se__format__free_.+(\\s|$)"))&&!this.isComponent(e)&&!this.isWysiwygDiv(e)},isRangeFormatElement:function(e){return e&&1===e.nodeType&&(/^(BLOCKQUOTE|OL|UL|FIGCAPTION|TABLE|THEAD|TBODY|TR|TH|TD)$/i.test(e.nodeName)||this.hasClass(e,"(\\s|^)__se__format__range_.+(\\s|$)"))},isClosureRangeFormatElement:function(e){return e&&1===e.nodeType&&(/^(TH|TD)$/i.test(e.nodeName)||this.hasClass(e,"(\\s|^)__se__format__range__closure_.+(\\s|$)"))},isFreeFormatElement:function(e){return e&&1===e.nodeType&&(/^PRE$/i.test(e.nodeName)||this.hasClass(e,"(\\s|^)__se__format__free_.+(\\s|$)"))&&!this.isComponent(e)&&!this.isWysiwygDiv(e)},isClosureFreeFormatElement:function(e){return e&&1===e.nodeType&&this.hasClass(e,"(\\s|^)__se__format__free__closure_.+(\\s|$)")},isComponent:function(e){return e&&(/se-component/.test(e.className)||/^(TABLE|HR)$/.test(e.nodeName))},isMediaComponent:function(e){return e&&/se-component/.test(e.className)},isNotCheckingNode:function(e){return e&&/katex|__se__tag/.test(e.className)},getFormatElement:function(e,t){if(!e)return null;for(t||(t=function(){return!0});e;){if(this.isWysiwygDiv(e))return null;if(this.isRangeFormatElement(e)&&e.firstElementChild,this.isFormatElement(e)&&t(e))return e;e=e.parentNode}return null},getRangeFormatElement:function(e,t){if(!e)return null;for(t||(t=function(){return!0});e;){if(this.isWysiwygDiv(e))return null;if(this.isRangeFormatElement(e)&&!/^(THEAD|TBODY|TR)$/i.test(e.nodeName)&&t(e))return e;e=e.parentNode}return null},getFreeFormatElement:function(e,t){if(!e)return null;for(t||(t=function(){return!0});e;){if(this.isWysiwygDiv(e))return null;if(this.isFreeFormatElement(e)&&t(e))return e;e=e.parentNode}return null},getClosureFreeFormatElement:function(e,t){if(!e)return null;for(t||(t=function(){return!0});e;){if(this.isWysiwygDiv(e))return null;if(this.isClosureFreeFormatElement(e)&&t(e))return e;e=e.parentNode}return null},copyTagAttributes:function(e,t){t.style.cssText&&(e.style.cssText+=t.style.cssText);const n=t.classList;for(let t=0,i=n.length;ts?1:o0&&!this.isBreak(e);)e=e.firstChild;for(;t&&1===t.nodeType&&t.childNodes.length>0&&!this.isBreak(t);)t=t.lastChild;return{sc:e,ec:t||e}}},getOffset:function(e,t){let n=0,i=0,l=3===e.nodeType?e.parentElement:e;const o=this.getParentElement(e,this.isWysiwygDiv.bind(this));for(;l&&!this.hasClass(l,"se-container")&&l!==o;)n+=l.offsetLeft,i+=l.offsetTop,l=l.offsetParent;const s=t&&/iframe/i.test(t.nodeName);return{left:n+(s?t.parentElement.offsetLeft:0),top:i-o.scrollTop+(s?t.parentElement.offsetTop:0)}},getOverlapRangeAtIndex:function(e,t,n,i){if(e<=i?tn)return 0;const l=(e>n?e:n)-(t0?" ":"")+t)},removeClass:function(e,t){if(!e)return;const n=new this._w.RegExp("(\\s|^)"+t+"(\\s|$)");e.className=e.className.replace(n," ").trim(),e.className.trim()||e.removeAttribute("class")},toggleClass:function(e,t){if(!e)return;const n=new this._w.RegExp("(\\s|^)"+t+"(\\s|$)");n.test(e.className)?e.className=e.className.replace(n," ").trim():e.className+=" "+t,e.className.trim()||e.removeAttribute("class")},setDisabledButtons:function(e,t){for(let n=0,i=t.length;n=0){e.splitText(t);const n=this.getNodeFromPath([a+1],i);this.onlyZeroWidthSpace(n)&&(n.data=this.zeroWidthSpace)}}else 1===e.nodeType&&(e.previousSibling?e=e.previousSibling:this.getElementDepth(e)===n&&(r=!1));let c=e;for(;this.getElementDepth(c)>n;)for(a=this.getPositionIndex(c)+1,c=c.parentNode,s=l,l=c.cloneNode(!1),o=c.childNodes,s&&(this.isListCell(l)&&this.isList(s)&&s.firstElementChild?(l.innerHTML=s.firstElementChild.innerHTML,N.removeItem(s.firstElementChild),s.children.length>0&&l.appendChild(s)):l.appendChild(s));o[a];)l.appendChild(o[a]);c.childNodes.length<=1&&(!c.firstChild||0===c.firstChild.textContent.length)&&(c.innerHTML="
    ");const d=c.parentNode;return r&&(c=c.nextSibling),l?(this.mergeSameTags(l,null,!1),this.mergeNestedTags(l,function(e){return this.isList(e)}.bind(this)),l.childNodes.length>0?d.insertBefore(l,c):l=c,0===i.childNodes.length&&this.removeItem(i),l):c},mergeSameTags:function(e,t,n){const i=this,l=t?t.length:0;let o=null;return l&&(o=this._w.Array.apply(null,new this._w.Array(l)).map(this._w.Number.prototype.valueOf,0)),function e(s,a,r){const c=s.childNodes;for(let d,u,h=0,g=c.length;h=0;){if(i.getArrayIndex(o.childNodes,n)!==e[r]){c=!1;break}n=d.parentNode,o=n.parentNode,r--}c&&(e.splice(a,1),e[a]=h)}}i.copyTagAttributes(d,s),s.parentNode.insertBefore(d,s),i.removeItem(s)}if(!u){1===d.nodeType&&e(d,a+1,h);break}if(d.nodeName===u.nodeName&&i.isSameAttributes(d,u)&&d.href===u.href){const e=d.childNodes;let n=0;for(let t=0,i=e.length;t0&&n++;const s=d.lastChild,c=u.firstChild;let g=0;if(s&&c){const e=3===s.nodeType&&3===c.nodeType;g=s.textContent.length;let i=s.previousSibling;for(;i&&3===i.nodeType;)g+=i.textContent.length,i=i.previousSibling;if(n>0&&3===s.nodeType&&3===c.nodeType&&(s.textContent.length>0||c.textContent.length>0)&&n--,l){let i=null;for(let d=0;dh){if(a>0&&i[a-1]!==r)continue;i[a]-=1,i[a+1]>=0&&i[a]===h&&(i[a+1]+=n,e&&s&&3===s.nodeType&&c&&3===c.nodeType&&(o[d]+=g))}}}if(3===d.nodeType){if(g=d.textContent.length,d.textContent+=u.textContent,l){let e=null;for(let i=0;ih){if(a>0&&e[a-1]!==r)continue;e[a]-=1,e[a+1]>=0&&e[a]===h&&(e[a+1]+=n,o[i]+=g)}}}else d.innerHTML+=u.innerHTML;i.removeItem(u),h--}else 1===d.nodeType&&e(d,a+1,h)}}(e,0,0),o},mergeNestedTags:function(e,t){"string"==typeof t?t=function(e){return this.test(e.tagName)}.bind(new this._w.RegExp("^("+(t||".+")+")$","i")):"function"!=typeof t&&(t=function(){return!0}),function e(n){let i=n.children;if(1===i.length&&i[0].nodeName===n.nodeName&&t(n)){const e=i[0];for(i=e.children;i[0];)n.appendChild(i[0]);n.removeChild(e)}for(let t=0,i=n.children.length;t")},htmlRemoveWhiteSpace:function(e){return e?e.trim().replace(/<\/?(?!strong|span|font|b|var|i|em|u|ins|s|strike|del|sub|sup|mark|a|label|code)[^>^<]+>\s+(?=<)/gi,(function(e){return e.trim()})):""},sortByDepth:function(e,t){const n=t?1:-1,i=-1*n;e.sort(function(e,t){return this.isListCell(e)&&this.isListCell(t)?(e=this.getElementDepth(e))>(t=this.getElementDepth(t))?n:e":e.innerHTML,e.innerHTML=t.outerHTML},_setDefaultOptionStyle:function(e,t){let n="";e.height&&(n+="height:"+e.height+";"),e.minHeight&&(n+="min-height:"+e.minHeight+";"),e.maxHeight&&(n+="max-height:"+e.maxHeight+";"),e.position&&(n+="position:"+e.position+";"),e.width&&(n+="width:"+e.width+";"),e.minWidth&&(n+="min-width:"+e.minWidth+";"),e.maxWidth&&(n+="max-width:"+e.maxWidth+";");let i="",l="",o="";const s=(t=n+t).split(";");for(let t,n=0,a=s.length;n'+this._setIframeCssTags(t),e.contentDocument.body.className="sun-editor-editable",e.contentDocument.body.setAttribute("contenteditable",!0)},_setIframeCssTags:function(e){const t=e.iframeCSSFileName,n=this._w.RegExp;let i="";for(let e,l=0,o=t.length;l'}return i+("auto"===e.height?"":"")}};var T=N,L={init:function(e,t){"object"!=typeof t&&(t={});const n=document;this._initOptions(e,t);const i=n.createElement("DIV");i.className="sun-editor",e.id&&(i.id="suneditor_"+e.id);const l=n.createElement("DIV");l.className="se-container";const o=this._createToolBar(n,t.buttonList,t.plugins,t);o.element.style.visibility="hidden",o.pluginCallButtons.math&&this._checkKatexMath(t.katex);const s=n.createElement("DIV");s.className="se-arrow";const a=n.createElement("DIV");a.className="se-toolbar-sticky-dummy";const r=n.createElement("DIV");r.className="se-wrapper";const c=this._initElements(t,i,o.element,s),d=c.bottomBar,u=c.wysiwygFrame,h=c.placeholder;let g=c.codeView;const p=d.resizingBar,m=d.navigation,f=d.charWrapper,_=d.charCounter,b=n.createElement("DIV");b.className="se-loading-box sun-editor-common",b.innerHTML='
    ';const v=n.createElement("DIV");v.className="se-line-breaker",v.innerHTML='";const y=n.createElement("DIV");y.className+="se-line-breaker-component";const C=y.cloneNode(!0);y.innerHTML=C.innerHTML=t.icons.line_break;const w=n.createElement("DIV");w.className="se-resizing-back";const x=t.toolbarContainer;return x&&x.appendChild(o.element),r.appendChild(g),h&&r.appendChild(h),x||l.appendChild(o.element),l.appendChild(a),l.appendChild(r),l.appendChild(w),l.appendChild(b),l.appendChild(v),l.appendChild(y),l.appendChild(C),p&&l.appendChild(p),i.appendChild(l),g=this._checkCodeMirror(t,g),{constructed:{_top:i,_relative:l,_toolBar:o.element,_menuTray:o._menuTray,_editorArea:r,_wysiwygArea:u,_codeArea:g,_placeholder:h,_resizingBar:p,_navigation:m,_charWrapper:f,_charCounter:_,_loading:b,_lineBreaker:v,_lineBreaker_t:y,_lineBreaker_b:C,_resizeBack:w,_stickyDummy:a,_arrow:s},options:t,plugins:o.plugins,pluginCallButtons:o.pluginCallButtons,_responsiveButtons:o.responsiveButtons}},_checkCodeMirror:function(e,t){if(e.codeMirror){const n=[{mode:"htmlmixed",htmlMode:!0,lineNumbers:!0,lineWrapping:!0},e.codeMirror.options||{}].reduce((function(e,t){for(let n in t)T.hasOwn(t,n)&&(e[n]=t[n]);return e}),{});"auto"===e.height&&(n.viewportMargin=1/0,n.height="auto");const i=e.codeMirror.src.fromTextArea(t,n);i.display.wrapper.style.cssText=t.style.cssText,e.codeMirrorEditor=i,(t=i.display.wrapper).className+=" se-wrapper-code-mirror"}return t},_checkKatexMath:function(e){if(!e)throw Error('[SUNEDITOR.create.fail] To use the math button you need to add a "katex" object to the options.');const t=[{throwOnError:!1},e.options||{}].reduce((function(e,t){for(let n in t)T.hasOwn(t,n)&&(e[n]=t[n]);return e}),{});e.options=t},_setOptions:function(e,t,n,i){this._initOptions(t.element.originElement,e);const l=t.element,o=l.relative,s=l.editorArea,a=e.toolbarContainer&&e.toolbarContainer!==i.toolbarContainer,r=!!e.buttonList||e.mode!==i.mode||a,c=!!e.plugins,d=this._createToolBar(document,r?e.buttonList:i.buttonList,c?e.plugins:n,e);d.pluginCallButtons.math&&this._checkKatexMath(e.katex);const u=document.createElement("DIV");u.className="se-arrow",r&&(d.element.style.visibility="hidden",a?(e.toolbarContainer.appendChild(d.element),l.toolbar.parentElement.removeChild(l.toolbar)):l.toolbar.parentElement.replaceChild(d.element,l.toolbar),l.toolbar=d.element,l._menuTray=d._menuTray,l._arrow=u);const h=this._initElements(e,l.topArea,r?d.element:l.toolbar,u),g=h.bottomBar,p=h.wysiwygFrame,m=h.placeholder;let f=h.codeView;return l.resizingBar&&o.removeChild(l.resizingBar),g.resizingBar&&o.appendChild(g.resizingBar),s.innerHTML="",s.appendChild(f),m&&s.appendChild(m),f=this._checkCodeMirror(e,f),l.resizingBar=g.resizingBar,l.navigation=g.navigation,l.charWrapper=g.charWrapper,l.charCounter=g.charCounter,l.wysiwygFrame=p,l.code=f,l.placeholder=m,{callButtons:r?d.pluginCallButtons:null,plugins:r||c?d.plugins:null,toolbar:d}},_initElements:function(e,t,n,i){t.style.cssText=e._editorStyles.top,/inline/i.test(e.mode)?(n.className+=" se-toolbar-inline",n.style.width=e.toolbarWidth):/balloon/i.test(e.mode)&&(n.className+=" se-toolbar-balloon",n.style.width=e.toolbarWidth,n.appendChild(i));const l=document.createElement(e.iframe?"IFRAME":"DIV");l.className="se-wrapper-inner se-wrapper-wysiwyg",e.iframe?(l.allowFullscreen=!0,l.frameBorder=0,l.style.cssText=e._editorStyles.frame):(l.setAttribute("contenteditable",!0),l.setAttribute("scrolling","auto"),l.className+=" sun-editor-editable",l.style.cssText=e._editorStyles.frame+e._editorStyles.editor);const o=document.createElement("TEXTAREA");o.className="se-wrapper-inner se-wrapper-code",o.style.cssText=e._editorStyles.frame,o.style.display="none","auto"===e.height&&(o.style.overflow="hidden");let s=null,a=null,r=null,c=null;if(e.resizingBar&&(s=document.createElement("DIV"),s.className="se-resizing-bar sun-editor-common",a=document.createElement("DIV"),a.className="se-navigation sun-editor-common",s.appendChild(a),e.charCounter)){if(r=document.createElement("DIV"),r.className="se-char-counter-wrapper",e.charCounterLabel){const t=document.createElement("SPAN");t.className="se-char-label",t.textContent=e.charCounterLabel,r.appendChild(t)}if(c=document.createElement("SPAN"),c.className="se-char-counter",c.textContent="0",r.appendChild(c),e.maxCharCount>0){const t=document.createElement("SPAN");t.textContent=" / "+e.maxCharCount,r.appendChild(t)}s.appendChild(r)}let d=null;return e.placeholder&&(d=document.createElement("SPAN"),d.className="se-placeholder",d.innerText=e.placeholder),{bottomBar:{resizingBar:s,navigation:a,charWrapper:r,charCounter:c},wysiwygFrame:l,codeView:o,placeholder:d}},_initOptions:function(e,t){t.lang=t.lang||S.a,t.value="string"==typeof t.value?t.value:null,t.historyStackDelayTime="number"==typeof t.historyStackDelayTime?t.historyStackDelayTime:400,t._defaultTagsWhitelist="string"==typeof t._defaultTagsWhitelist?t._defaultTagsWhitelist:"br|p|div|pre|blockquote|h[1-6]|ol|ul|li|hr|figure|figcaption|img|iframe|audio|video|source|table|thead|tbody|tr|th|td|a|b|strong|var|i|em|u|ins|s|span|strike|del|sub|sup|code",t._editorTagsWhitelist=t._defaultTagsWhitelist+("string"==typeof t.addTagsWhitelist&&t.addTagsWhitelist.length>0?"|"+t.addTagsWhitelist:""),t.pasteTagsWhitelist="string"==typeof t.pasteTagsWhitelist?t.pasteTagsWhitelist:t._editorTagsWhitelist,t.attributesWhitelist=t.attributesWhitelist&&"object"==typeof t.attributesWhitelist?t.attributesWhitelist:null,t.mode=t.mode||"classic",t.toolbarWidth=t.toolbarWidth?T.isNumber(t.toolbarWidth)?t.toolbarWidth+"px":t.toolbarWidth:"auto",t.toolbarContainer=/balloon/i.test(t.mode)?null:"string"==typeof t.toolbarContainer?document.querySelector(t.toolbarContainer):t.toolbarContainer,t.stickyToolbar=/balloon/i.test(t.mode)||t.toolbarContainer?-1:void 0===t.stickyToolbar?0:/^\d+/.test(t.stickyToolbar)?T.getNumber(t.stickyToolbar,0):-1,t.fullPage=!!t.fullPage,t.iframe=t.fullPage||t.iframe,t.iframeCSSFileName=t.iframe?"string"==typeof t.iframeCSSFileName?[t.iframeCSSFileName]:t.iframeCSSFileName||["suneditor"]:null,t.codeMirror=t.codeMirror?t.codeMirror.src?t.codeMirror:{src:t.codeMirror}:null,t.position="string"==typeof t.position?t.position:null,t.display=t.display||("none"!==e.style.display&&e.style.display?e.style.display:"block"),t.popupDisplay=t.popupDisplay||"full",t.resizingBar=void 0===t.resizingBar?!/inline|balloon/i.test(t.mode):t.resizingBar,t.showPathLabel=!!t.resizingBar&&("boolean"!=typeof t.showPathLabel||t.showPathLabel),t.charCounter=t.maxCharCount>0||"boolean"==typeof t.charCounter&&t.charCounter,t.charCounterType="string"==typeof t.charCounterType?t.charCounterType:"char",t.charCounterLabel="string"==typeof t.charCounterLabel?t.charCounterLabel.trim():null,t.maxCharCount=T.isNumber(t.maxCharCount)&&t.maxCharCount>-1?1*t.maxCharCount:null,t.width=t.width?T.isNumber(t.width)?t.width+"px":t.width:e.clientWidth?e.clientWidth+"px":"100%",t.minWidth=(T.isNumber(t.minWidth)?t.minWidth+"px":t.minWidth)||"",t.maxWidth=(T.isNumber(t.maxWidth)?t.maxWidth+"px":t.maxWidth)||"",t.height=t.height?T.isNumber(t.height)?t.height+"px":t.height:e.clientHeight?e.clientHeight+"px":"auto",t.minHeight=(T.isNumber(t.minHeight)?t.minHeight+"px":t.minHeight)||"",t.maxHeight=(T.isNumber(t.maxHeight)?t.maxHeight+"px":t.maxHeight)||"",t.defaultStyle="string"==typeof t.defaultStyle?t.defaultStyle:"",t.font=t.font?t.font:null,t.fontSize=t.fontSize?t.fontSize:null,t.formats=t.formats?t.formats:null,t.colorList=t.colorList?t.colorList:null,t.lineHeights=t.lineHeights?t.lineHeights:null,t.paragraphStyles=t.paragraphStyles?t.paragraphStyles:null,t.textStyles=t.textStyles?t.textStyles:null,t.fontSizeUnit="string"==typeof t.fontSizeUnit&&t.fontSizeUnit.trim()||"px",t.imageResizing=void 0===t.imageResizing||t.imageResizing,t.imageHeightShow=void 0===t.imageHeightShow||!!t.imageHeightShow,t.imageWidth=t.imageWidth?T.isNumber(t.imageWidth)?t.imageWidth+"px":t.imageWidth:"auto",t.imageHeight=t.imageHeight?T.isNumber(t.imageHeight)?t.imageHeight+"px":t.imageHeight:"auto",t.imageSizeOnlyPercentage=!!t.imageSizeOnlyPercentage,t._imageSizeUnit=t.imageSizeOnlyPercentage?"%":"px",t.imageRotation=void 0!==t.imageRotation?t.imageRotation:!(t.imageSizeOnlyPercentage||!t.imageHeightShow),t.imageFileInput=void 0===t.imageFileInput||t.imageFileInput,t.imageUrlInput=void 0===t.imageUrlInput||!t.imageFileInput||t.imageUrlInput,t.imageUploadHeader=t.imageUploadHeader||null,t.imageUploadUrl="string"==typeof t.imageUploadUrl?t.imageUploadUrl:null,t.imageUploadSizeLimit=/\d+/.test(t.imageUploadSizeLimit)?T.getNumber(t.imageUploadSizeLimit,0):null,t.imageMultipleFile=!!t.imageMultipleFile,t.imageAccept="string"!=typeof t.imageAccept||"*"===t.imageAccept.trim()?"image/*":t.imageAccept.trim()||"image/*",t.imageGalleryUrl="string"==typeof t.imageGalleryUrl?t.imageGalleryUrl:null,t.videoResizing=void 0===t.videoResizing||t.videoResizing,t.videoHeightShow=void 0===t.videoHeightShow||!!t.videoHeightShow,t.videoRatioShow=void 0===t.videoRatioShow||!!t.videoRatioShow,t.videoWidth=t.videoWidth&&T.getNumber(t.videoWidth,0)?T.isNumber(t.videoWidth)?t.videoWidth+"px":t.videoWidth:"",t.videoHeight=t.videoHeight&&T.getNumber(t.videoHeight,0)?T.isNumber(t.videoHeight)?t.videoHeight+"px":t.videoHeight:"",t.videoSizeOnlyPercentage=!!t.videoSizeOnlyPercentage,t._videoSizeUnit=t.videoSizeOnlyPercentage?"%":"px",t.videoRotation=void 0!==t.videoRotation?t.videoRotation:!(t.videoSizeOnlyPercentage||!t.videoHeightShow),t.videoRatio=T.getNumber(t.videoRatio,4)||.5625,t.videoRatioList=t.videoRatioList?t.videoRatioList:null,t.youtubeQuery=(t.youtubeQuery||"").replace("?",""),t.videoFileInput=!!t.videoFileInput,t.videoUrlInput=void 0===t.videoUrlInput||!t.videoFileInput||t.videoUrlInput,t.videoUploadHeader=t.videoUploadHeader||null,t.videoUploadUrl="string"==typeof t.videoUploadUrl?t.videoUploadUrl:null,t.videoUploadSizeLimit=/\d+/.test(t.videoUploadSizeLimit)?T.getNumber(t.videoUploadSizeLimit,0):null,t.videoMultipleFile=!!t.videoMultipleFile,t.videoTagAttrs=t.videoTagAttrs||null,t.videoIframeAttrs=t.videoIframeAttrs||null,t.videoAccept="string"!=typeof t.videoAccept||"*"===t.videoAccept.trim()?"video/*":t.videoAccept.trim()||"video/*",t.audioWidth=t.audioWidth?T.isNumber(t.audioWidth)?t.audioWidth+"px":t.audioWidth:"",t.audioHeight=t.audioHeight?T.isNumber(t.audioHeight)?t.audioHeight+"px":t.audioHeight:"",t.audioFileInput=!!t.audioFileInput,t.audioUrlInput=void 0===t.audioUrlInput||!t.audioFileInput||t.audioUrlInput,t.audioUploadHeader=t.audioUploadHeader||null,t.audioUploadUrl="string"==typeof t.audioUploadUrl?t.audioUploadUrl:null,t.audioUploadSizeLimit=/\d+/.test(t.audioUploadSizeLimit)?T.getNumber(t.audioUploadSizeLimit,0):null,t.audioMultipleFile=!!t.audioMultipleFile,t.audioTagAttrs=t.audioTagAttrs||null,t.audioAccept="string"!=typeof t.audioAccept||"*"===t.audioAccept.trim()?"audio/*":t.audioAccept.trim()||"audio/*",t.tableCellControllerPosition="string"==typeof t.tableCellControllerPosition?t.tableCellControllerPosition.toLowerCase():"cell",t.tabDisable=!!t.tabDisable,t.shortcutsDisable=Array.isArray(t.shortcutsDisable)&&t.shortcutsDisable.length>0?t.shortcutsDisable.map((function(e){return e.toLowerCase()})):[],t.shortcutsHint=void 0===t.shortcutsHint||!!t.shortcutsHint,t.callBackSave=t.callBackSave?t.callBackSave:null,t.templates=t.templates?t.templates:null,t.placeholder="string"==typeof t.placeholder?t.placeholder:null,t.linkProtocol="string"==typeof t.linkProtocol?t.linkProtocol:null,t.katex=t.katex?t.katex.src?t.katex:{src:t.katex}:null,t.buttonList=t.buttonList||[["undo","redo"],["bold","underline","italic","strike","subscript","superscript"],["removeFormat"],["outdent","indent"],["fullScreen","showBlocks","codeView"],["preview","print"]],t.icons=t.icons&&"object"==typeof t.icons?[x,t.icons].reduce((function(e,t){for(let n in t)T.hasOwn(t,n)&&(e[n]=t[n]);return e}),{}):x,t._editorStyles=T._setDefaultOptionStyle(t,t.defaultStyle)},_defaultButtons:function(e){const t=e.icons,n=e.lang,i=T.isOSX_IOS?"⌘":"CTRL",l=e.shortcutsHint?e.shortcutsDisable:["bold","strike","underline","italic","undo","indent"];return{bold:["_se_command_bold",n.toolbar.bold+(l.indexOf("bold")>-1?"":" ("+i+"+B)"),"STRONG","",t.bold],underline:["_se_command_underline",n.toolbar.underline+(l.indexOf("underline")>-1?"":" ("+i+"+U)"),"U","",t.underline],italic:["_se_command_italic",n.toolbar.italic+(l.indexOf("italic")>-1?"":" ("+i+"+I)"),"EM","",t.italic],strike:["_se_command_strike",n.toolbar.strike+(l.indexOf("strike")>-1?"":" ("+i+"+SHIFT+S)"),"DEL","",t.strike],subscript:["_se_command_subscript",n.toolbar.subscript,"SUB","",t.subscript],superscript:["_se_command_superscript",n.toolbar.superscript,"SUP","",t.superscript],removeFormat:["",n.toolbar.removeFormat,"removeFormat","",t.erase],indent:["_se_command_indent",n.toolbar.indent+(l.indexOf("indent")>-1?"":" ("+i+"+])"),"indent","",t.outdent],outdent:["_se_command_outdent",n.toolbar.outdent+(l.indexOf("indent")>-1?"":" ("+i+"+[)"),"outdent","",t.indent],fullScreen:["se-code-view-enabled se-resizing-enabled _se_command_fullScreen",n.toolbar.fullScreen,"fullScreen","",t.expansion],showBlocks:["_se_command_showBlocks",n.toolbar.showBlocks,"showBlocks","",t.show_blocks],codeView:["se-code-view-enabled se-resizing-enabled _se_command_codeView",n.toolbar.codeView,"codeView","",t.code_view],undo:["_se_command_undo se-resizing-enabled",n.toolbar.undo+(l.indexOf("undo")>-1?"":" ("+i+"+Z)"),"undo","",t.undo],redo:["_se_command_redo se-resizing-enabled",n.toolbar.redo+(l.indexOf("undo")>-1?"":" ("+i+"+Y / "+i+"+SHIFT+Z)"),"redo","",t.redo],preview:["se-resizing-enabled",n.toolbar.preview,"preview","",t.preview],print:["se-resizing-enabled",n.toolbar.print,"print","",t.print],save:["_se_command_save se-resizing-enabled",n.toolbar.save,"save","",t.save],blockquote:["",n.toolbar.tag_blockquote,"blockquote","command",t.blockquote],font:["se-btn-select se-btn-tool-font",n.toolbar.font,"font","submenu",''+n.toolbar.font+""+t.arrow_down],formatBlock:["se-btn-select se-btn-tool-format",n.toolbar.formats,"formatBlock","submenu",''+n.toolbar.formats+""+t.arrow_down],fontSize:["se-btn-select se-btn-tool-size",n.toolbar.fontSize,"fontSize","submenu",''+n.toolbar.fontSize+""+t.arrow_down],fontColor:["",n.toolbar.fontColor,"fontColor","submenu",t.font_color],hiliteColor:["",n.toolbar.hiliteColor,"hiliteColor","submenu",t.highlight_color],align:["se-btn-align",n.toolbar.align,"align","submenu",t.align_left],list:["",n.toolbar.list,"list","submenu",t.list_number],horizontalRule:["btn_line",n.toolbar.horizontalRule,"horizontalRule","submenu",t.horizontal_rule],table:["",n.toolbar.table,"table","submenu",t.table],lineHeight:["",n.toolbar.lineHeight,"lineHeight","submenu",t.line_height],template:["",n.toolbar.template,"template","submenu",t.template],paragraphStyle:["",n.toolbar.paragraphStyle,"paragraphStyle","submenu",t.paragraph_style],textStyle:["",n.toolbar.textStyle,"textStyle","submenu",t.text_style],link:["",n.toolbar.link,"link","dialog",t.link],image:["",n.toolbar.image,"image","dialog",t.image],video:["",n.toolbar.video,"video","dialog",t.video],audio:["",n.toolbar.audio,"audio","dialog",t.audio],math:["",n.toolbar.math,"math","dialog",t.math],imageGallery:["",n.toolbar.imageGallery,"imageGallery","fileBrowser",t.image_gallery]}},_createModuleGroup:function(){const e=T.createElement("DIV");e.className="se-btn-module se-btn-module-border";const t=T.createElement("UL");return t.className="se-menu-list",e.appendChild(t),{div:e,ul:t}},_createButton:function(e,t,n,i,l,o,s){const a=T.createElement("LI"),r=T.createElement("BUTTON");return r.setAttribute("type","button"),r.setAttribute("class","se-btn"+(e?" "+e:"")+" se-tooltip"),r.setAttribute("data-command",n),r.setAttribute("data-display",i),r.setAttribute("tabindex","-1"),l||(l='!'),/^default\./i.test(l)&&(l=s[l.replace(/^default\./i,"")]),/^text\./i.test(l)&&(l=l.replace(/^text\./i,""),r.className+=" se-btn-more-text"),l+=''+(t||n)+"",o&&r.setAttribute("disabled",!0),r.innerHTML=l,a.appendChild(r),{li:a,button:r}},_createToolBar:function(e,t,n,i){const l=e.createElement("DIV");l.className="se-toolbar-separator-vertical";const o=e.createElement("DIV");o.className="se-toolbar sun-editor-common";const s=e.createElement("DIV");s.className="se-btn-tray",o.appendChild(s);const a=i.icons,r=this._defaultButtons(i),c={},d=[],u={};if(n){const e=n.length?n:Object.keys(n).map((function(e){return n[e]}));for(let t,n=0,i=e.length;n",b.appendChild(i),i=i.firstElementChild.firstElementChild)}if(_){const e=l.cloneNode(!1);y&&(e.style.float=y),s.appendChild(e)}s.appendChild(p.div),_=!0}else if(/^\/$/.test(v)){const t=e.createElement("DIV");t.className="se-btn-module-enter",s.appendChild(t),_=!1}1===s.children.length&&T.removeClass(s.firstElementChild,"se-btn-module-border"),d.length>0&&d.unshift(t),b.children.length>0&&s.appendChild(b);const v=e.createElement("DIV");v.className="se-menu-tray",o.appendChild(v);const y=e.createElement("DIV");return y.className="se-toolbar-cover",o.appendChild(y),{element:o,plugins:u,pluginCallButtons:c,responsiveButtons:d,_menuTray:v,_buttonTray:s}}};var k=function(e,t,n){return{element:{originElement:e,topArea:t._top,relative:t._relative,toolbar:t._toolBar,_buttonTray:t._toolBar.querySelector(".se-btn-tray"),_menuTray:t._menuTray,resizingBar:t._resizingBar,navigation:t._navigation,charWrapper:t._charWrapper,charCounter:t._charCounter,editorArea:t._editorArea,wysiwygFrame:t._wysiwygArea,wysiwyg:t._wysiwygArea,code:t._codeArea,placeholder:t._placeholder,loading:t._loading,lineBreaker:t._lineBreaker,lineBreaker_t:t._lineBreaker_t,lineBreaker_b:t._lineBreaker_b,resizeBackground:t._resizeBack,_stickyDummy:t._stickyDummy,_arrow:t._arrow},tool:{cover:t._toolBar.querySelector(".se-toolbar-cover"),bold:t._toolBar.querySelector("._se_command_bold"),underline:t._toolBar.querySelector("._se_command_underline"),italic:t._toolBar.querySelector("._se_command_italic"),strike:t._toolBar.querySelector("._se_command_strike"),subscript:t._toolBar.querySelector("._se_command_subscript"),superscript:t._toolBar.querySelector("._se_command_superscript"),undo:t._toolBar.querySelector("._se_command_undo"),redo:t._toolBar.querySelector("._se_command_redo"),save:t._toolBar.querySelector("._se_command_save"),outdent:t._toolBar.querySelector("._se_command_outdent"),indent:t._toolBar.querySelector("._se_command_indent"),fullScreen:t._toolBar.querySelector("._se_command_fullScreen"),showBlocks:t._toolBar.querySelector("._se_command_showBlocks"),codeView:t._toolBar.querySelector("._se_command_codeView")},options:n,option:n}},A={name:"notice",add:function(e){const t=e.context;t.notice={};let n=e.util.createElement("DIV"),i=e.util.createElement("SPAN"),l=e.util.createElement("BUTTON");n.className="se-notice",l.className="close",l.setAttribute("aria-label","Close"),l.setAttribute("title",e.lang.dialogBox.close),l.innerHTML=e.icons.cancel,n.appendChild(i),n.appendChild(l),t.notice.modal=n,t.notice.message=i,l.addEventListener("click",this.onClick_cancel.bind(e)),t.element.editorArea.appendChild(n),n=null},onClick_cancel:function(e){e.preventDefault(),e.stopPropagation(),this.plugins.notice.close.call(this)},open:function(e){this.context.notice.message.textContent=e,this.context.notice.modal.style.display="block"},close:function(){this.context.notice.modal.style.display="none"}},B={init:function(e){return{create:function(t,n){return this.create(t,n,e)}.bind(this)}},create:function(e,t,n){T._propertiesInit(),"object"!=typeof t&&(t={}),n&&(t=[n,t].reduce((function(e,t){for(let n in t)if(T.hasOwn(t,n))if("plugins"===n&&t[n]&&e[n]){let i=e[n],l=t[n];i=i.length?i:Object.keys(i).map((function(e){return i[e]})),l=l.length?l:Object.keys(l).map((function(e){return l[e]})),e[n]=l.filter((function(e){return-1===i.indexOf(e)})).concat(i)}else e[n]=t[n];return e}),{}));const i="string"==typeof e?document.getElementById(e):e;if(!i){if("string"==typeof e)throw Error('[SUNEDITOR.create.fail] The element for that id was not found (ID:"'+e+'")');throw Error("[SUNEDITOR.create.fail] suneditor requires textarea's element or id value")}const l=L.init(i,t);if(l.constructed._top.id&&document.getElementById(l.constructed._top.id))throw Error('[SUNEDITOR.create.fail] The ID of the suneditor you are trying to create already exists (ID:"'+l.constructed._top.id+'")');return function(e,t,n,i,l,o){const s=e.element.originElement.ownerDocument||document,a=s.defaultView||window,r=T,c=l.icons,d={_d:s,_w:a,_parser:new a.DOMParser,_wd:null,_ww:null,_shadowRoot:null,util:r,functions:null,notice:A,icons:c,history:null,context:e,pluginCallButtons:t,plugins:n||{},initPlugins:{},_targetPlugins:{},_menuTray:{},lang:i,effectNode:null,submenu:null,container:null,_submenuName:"",_bindedSubmenuOff:null,_bindedContainerOff:null,submenuActiveButton:null,containerActiveButton:null,controllerArray:[],currentControllerName:"",currentControllerTarget:null,currentFileComponentInfo:null,codeViewDisabledButtons:null,resizingDisabledButtons:null,_moreLayerActiveButton:null,_htmlCheckWhitelistRegExp:null,_disallowedTextTagsRegExp:null,editorTagsWhitelistRegExp:null,pasteTagsWhitelistRegExp:null,hasFocus:!1,isDisabled:!1,_attributesWhitelistRegExp:null,_attributesTagsWhitelist:null,_bindControllersOff:null,_isInline:null,_isBalloon:null,_isBalloonAlways:null,_inlineToolbarAttr:{top:"",width:"",isShow:!1},_notHideToolbar:!1,_sticky:!1,_antiBlur:!1,_lineBreaker:null,_lineBreakerButton:null,_componentsInfoInit:!0,_componentsInfoReset:!1,activePlugins:null,managedTagsInfo:null,_charTypeHTML:!1,_fileInfoPluginsCheck:null,_fileInfoPluginsReset:null,_fileManager:{tags:null,regExp:null,queryString:null,pluginRegExp:null,pluginMap:null},commandMap:null,_styleCommandMap:null,_defaultCommand:{bold:"STRONG",underline:"U",italic:"EM",strike:"DEL",subscript:"SUB",superscript:"SUP"},_variable:{isCodeView:!1,isFullScreen:!1,innerHeight_fullScreen:0,resizeClientY:0,tabSize:4,codeIndent:4,minResizingSize:r.getNumber(e.element.wysiwygFrame.style.minHeight||"65",0),currentNodes:[],currentNodesMap:[],_range:null,_selectionNode:null,_originCssText:e.element.topArea.style.cssText,_bodyOverflow:"",_editorAreaOriginCssText:"",_wysiwygOriginCssText:"",_codeOriginCssText:"",_fullScreenAttrs:{sticky:!1,balloon:!1,inline:!1},_lineBreakComp:null,_lineBreakDir:""},callPlugin:function(e,n,i){if(i=i||t[e],!this.plugins[e])throw Error('[SUNEDITOR.core.callPlugin.fail] The called plugin does not exist or is in an invalid format. (pluginName:"'+e+'")');this.initPlugins[e]?"object"==typeof this._targetPlugins[e]&&i&&this.initMenuTarget(e,i,this._targetPlugins[e]):(this.plugins[e].add(this,i),this.initPlugins[e]=!0),this.plugins[e].active&&!this.commandMap[e]&&i&&(this.commandMap[e]=i,this.activePlugins.push(e)),"function"==typeof n&&n()},addModule:function(e){for(let t,n=0,i=e.length;nb?(n.style.height=l+"px",e=-1*(l-g+3)):(n.style.height=b+"px",e=g+t.parentElement.offsetHeight),n.style.top=e+"px"}else n.style.top=g+t.parentElement.offsetHeight+"px";n.style.visibility=""},controllersOn:function(){this._bindControllersOff&&this._bindControllersOff(),this.controllerArray=[];for(let e,t=0;t0){for(let e=0;e":n),this.history.push(!0)},nativeFocus:function(){const t=r.getParentElement(this.getSelectionNode(),"figcaption");t?t.focus():e.element.wysiwyg.focus(),this._editorRange()},focus:function(){if("none"!==e.element.wysiwygFrame.style.display){if(l.iframe)this.nativeFocus();else try{const t=this.getRange();if(t.startContainer===t.endContainer&&r.isWysiwygDiv(t.startContainer)){const t=r.createElement("P"),n=r.createElement("BR");t.appendChild(n),e.element.wysiwyg.appendChild(t),this.setRange(n,0,n,0)}else this.setRange(t.startContainer,t.startOffset,t.endContainer,t.endOffset)}catch(e){this.nativeFocus()}u._applyTagEffects(),this._isBalloon&&u._toggleToolbarBalloon()}},focusEdge:function(t){t||(t=e.element.wysiwyg.lastElementChild);const n=this.getFileComponent(t);n?this.selectComponent(n.target,n.pluginName):t?(t=r.getChildElement(t,(function(e){return 0===e.childNodes.length||3===e.nodeType}),!0))?this.setRange(t,t.textContent.length,t,t.textContent.length):this.nativeFocus():this.focus()},setRange:function(e,t,n,i){if(!e||!n)return;t>e.textContent.length&&(t=e.textContent.length),i>n.textContent.length&&(i=n.textContent.length);const o=this._wd.createRange();try{o.setStart(e,t),o.setEnd(n,i)}catch(e){return console.warn("[SUNEDITOR.core.focus.error] "+e),void this.nativeFocus()}const s=this.getSelection();return s.removeAllRanges&&s.removeAllRanges(),s.addRange(o),this._editorRange(),l.iframe&&this.nativeFocus(),o},removeRange:function(){this._variable._range=null,this._variable._selectionNode=null,this.getSelection().removeAllRanges();const e=this.commandMap,t=this.activePlugins;for(let i in e)r.hasOwn(e,i)&&(t.indexOf(i)>-1?n[i].active.call(this,null):e.OUTDENT&&/^OUTDENT$/i.test(i)?e.OUTDENT.setAttribute("disabled",!0):e.INDENT&&/^INDENT$/i.test(i)?e.INDENT.removeAttribute("disabled"):r.removeClass(e[i],"active"))},getRange:function(){const t=this._variable._range||this._createDefaultRange(),n=this.getSelection();if(t.collapsed===n.isCollapsed||!e.element.wysiwyg.contains(n.focusNode))return t;if(n.rangeCount>0)return this._variable._range=n.getRangeAt(0),this._variable._range;{const e=n.anchorNode,t=n.focusNode,i=n.anchorOffset,l=n.focusOffset,o=r.compareElements(e,t),s=o.ancestor&&(0===o.result?i<=l:o.result>1);return this.setRange(s?e:t,s?i:l,s?t:e,s?l:i)}},getRange_addLine:function(t){if(this._selectionVoid(t)){const n=e.element.wysiwyg,i=r.createElement("P");i.innerHTML="
    ",n.insertBefore(i,n.firstElementChild),this.setRange(i.firstElementChild,0,i.firstElementChild,1),t=this._variable._range}return t},getSelection:function(){return this._shadowRoot&&this._shadowRoot.getSelection?this._shadowRoot.getSelection():this._ww.getSelection()},getSelectionNode:function(){if(r.isWysiwygDiv(this._variable._selectionNode)&&this._editorRange(),!this._variable._selectionNode){const t=r.getChildElement(e.element.wysiwyg.firstChild,(function(e){return 0===e.childNodes.length||3===e.nodeType}),!1);if(t)return this._variable._selectionNode=t,t;this._editorRange()}return this._variable._selectionNode},_editorRange:function(){const e=this.getSelection();if(!e)return null;let t=null,n=null;t=e.rangeCount>0?e.getRangeAt(0):this._createDefaultRange(),this._variable._range=t,n=t.collapsed?t.commonAncestorContainer:e.extentNode||e.anchorNode,this._variable._selectionNode=n},_createDefaultRange:function(){const t=e.element.wysiwyg;t.focus();const n=this._wd.createRange();let i=t.firstElementChild;return i||(i=r.createElement("P"),i.innerHTML="
    ",t.appendChild(i)),n.setStart(i,0),n.setEnd(i,0),n},_selectionVoid:function(e){const t=e.commonAncestorContainer;return r.isWysiwygDiv(e.startContainer)&&r.isWysiwygDiv(e.endContainer)||/FIGURE/i.test(t.nodeName)||this._fileManager.regExp.test(t.nodeName)||r.isMediaComponent(t)},_resetRangeToTextNode:function(){const t=this.getRange();if(this._selectionVoid(t))return!1;let n,i,l,o=t.startContainer,s=t.startOffset,a=t.endContainer,c=t.endOffset;if(r.isFormatElement(o)&&(o=o.childNodes[s]||o.lastChild,s=o.textContent.length),r.isFormatElement(a)&&(a=a.childNodes[c]||a.lastChild,c=a.textContent.length),n=r.isWysiwygDiv(o)?e.element.wysiwyg.firstChild:o,i=s,r.isBreak(n)||1===n.nodeType&&n.childNodes.length>0){const e=r.isBreak(n);if(!e){for(;n&&!r.isBreak(n)&&1===n.nodeType;)n=n.childNodes[i]||n.nextElementSibling||n.nextSibling,i=0;let e=r.getFormatElement(n,null);e===r.getRangeFormatElement(e,null)&&(e=r.createElement(r.getParentElement(n,r.isCell)?"DIV":"P"),n.parentNode.insertBefore(e,n),e.appendChild(n))}if(r.isBreak(n)){const t=r.createTextNode(r.zeroWidthSpace);n.parentNode.insertBefore(t,n),n=t,e&&o===a&&(a=n,c=1)}}if(o=n,s=i,n=r.isWysiwygDiv(a)?e.element.wysiwyg.lastChild:a,i=c,r.isBreak(n)||1===n.nodeType&&n.childNodes.length>0){const e=r.isBreak(n);if(!e){for(;n&&!r.isBreak(n)&&1===n.nodeType&&(l=n.childNodes,0!==l.length);)n=l[i>0?i-1:i]||!/FIGURE/i.test(l[0].nodeName)?l[0]:n.previousElementSibling||n.previousSibling||o,i=i>0?n.textContent.length:i;let e=r.getFormatElement(n,null);e===r.getRangeFormatElement(e,null)&&(e=r.createElement(r.isCell(e)?"DIV":"P"),n.parentNode.insertBefore(e,n),e.appendChild(n))}if(r.isBreak(n)){const t=r.createTextNode(r.zeroWidthSpace);n.parentNode.insertBefore(t,n),n=t,i=1,e&&!n.previousSibling&&r.removeItem(a)}}return a=n,c=i,this.setRange(o,s,a,c),!0},getSelectedElements:function(t){if(!this._resetRangeToTextNode())return[];let n=this.getRange();if(r.isWysiwygDiv(n.startContainer)){const t=e.element.wysiwyg.children;if(0===t.length)return[];this.setRange(t[0],0,t[t.length-1],t[t.length-1].textContent.trim().length),n=this.getRange()}const i=n.startContainer,l=n.endContainer,o=n.commonAncestorContainer,s=r.getListChildren(o,(function(e){return t?t(e):r.isFormatElement(e)}));if(r.isWysiwygDiv(o)||r.isRangeFormatElement(o)||s.unshift(r.getFormatElement(o,null)),i===l||1===s.length)return s;let a=r.getFormatElement(i,null),c=r.getFormatElement(l,null),d=null,u=null;const h=function(e){return!r.isTable(e)||/^TABLE$/i.test(e.nodeName)};let g=r.getRangeFormatElement(a,h),p=r.getRangeFormatElement(c,h);r.isTable(g)&&r.isListCell(g.parentNode)&&(g=g.parentNode),r.isTable(p)&&r.isListCell(p.parentNode)&&(p=p.parentNode);const m=g===p;for(let e,t=0,n=s.length;t=0;n--)if(i[n].contains(i[e])){i.splice(e,1),e--,t--;break}return i},isEdgePoint:function(e,t){return 0===t||!e.nodeValue&&1===t||t===e.nodeValue.length},showLoading:function(){e.element.loading.style.display="block"},closeLoading:function(){e.element.loading.style.display="none"},appendFormatTag:function(e,t){const n=r.getFormatElement(this.getSelectionNode(),null),i=t?"string"==typeof t?t:t.nodeName:r.isFormatElement(n)&&!r.isFreeFormatElement(n)?n.nodeName:"P",l=r.createElement(i);return l.innerHTML="
    ",(t&&"string"!=typeof t||!t&&r.isFormatElement(n))&&r.copyTagAttributes(l,t||n),r.isCell(e)?e.insertBefore(l,e.nextElementSibling):e.parentNode.insertBefore(l,e.nextElementSibling),l},insertComponent:function(e,t,n,i){if(n&&!this.checkCharCount(e,null))return null;const l=this.removeNode();this.getRange_addLine(this.getRange());let o=null,s=this.getSelectionNode(),a=r.getFormatElement(s,null);if(r.isListCell(a))this.insertNode(e,s===a?null:l.container.nextSibling,!1),e.nextSibling||e.parentNode.appendChild(r.createElement("BR"));else{if(this.getRange().collapsed&&(3===l.container.nodeType||r.isBreak(l.container))){const e=r.getParentElement(l.container,function(e){return this.isRangeFormatElement(e)}.bind(r));o=r.splitElement(l.container,l.offset,e?r.getElementDepth(e)+1:0),o&&(a=o.previousSibling)}this.insertNode(e,a,!1),a&&r.onlyZeroWidthSpace(a)&&r.removeItem(a)}if(!i){const t=this.getFileComponent(e);t?this.selectComponent(t.target,t.pluginName):o&&(o=r.getEdgeChildNodes(o,null).sc||o,this.setRange(o,0,o,0))}return t||this.history.push(1),o||e},getFileComponent:function(e){if(!this._fileManager.queryString||!e)return null;let t,n;return(/^FIGURE$/i.test(e.nodeName)||/se-component/.test(e.className))&&(t=e.querySelector(this._fileManager.queryString)),!t&&e.nodeName&&this._fileManager.regExp.test(e.nodeName)&&(t=e),t&&(n=this._fileManager.pluginMap[t.nodeName.toLowerCase()],n)?{target:t,component:r.getParentElement(t,r.isComponent),pluginName:n}:null},selectComponent:function(e,t){this.hasFocus||this.focus();const n=this.plugins[t];n&&a.setTimeout(function(){"function"==typeof n.select&&this.callPlugin(t,n.select.bind(this,e),null),this._setComponentLineBreaker(e)}.bind(this))},_setComponentLineBreaker:function(t){this._lineBreaker.style.display="none";const n=r.getParentElement(t,r.isComponent),i=e.element.lineBreaker_t.style,l=e.element.lineBreaker_b.style,o="block"===this.context.resizing.resizeContainer.style.display?this.context.resizing.resizeContainer:t,s=r.isListCell(n.parentNode);let a,c,d;(s?n.previousSibling:r.isFormatElement(n.previousElementSibling))?i.display="none":(this._variable._lineBreakComp=n,c=e.element.wysiwyg.scrollTop,a=r.getOffset(t,e.element.wysiwygFrame).top+c,d=o.offsetWidth/2/2,i.top=a-c-12+"px",i.left=r.getOffset(o).left+d+"px",i.display="block"),(s?n.nextSibling:r.isFormatElement(n.nextElementSibling))?l.display="none":(a||(this._variable._lineBreakComp=n,c=e.element.wysiwyg.scrollTop,a=r.getOffset(t,e.element.wysiwygFrame).top+c,d=o.offsetWidth/2/2),l.top=a+o.offsetHeight-c-12+"px",l.left=r.getOffset(o).left+o.offsetWidth-d-24+"px",l.display="block")},insertNode:function(e,t,n){if(n&&!this.checkCharCount(e,null))return null;const i=r.getFreeFormatElement(this.getSelectionNode(),null),l=!i&&(r.isFormatElement(e)||r.isRangeFormatElement(e))||r.isComponent(e);if(!t&&l){const e=this.removeNode();if(3===e.container.nodeType||r.isBreak(e.container)){const n=r.getParentElement(e.container,function(e){return this.isRangeFormatElement(e)||this.isListCell(e)}.bind(r));(t=r.splitElement(e.container,e.offset,n?r.getElementDepth(n)+1:0))&&(t=t.previousSibling)}}const o=t||l?this.getRange():this.getRange_addLine(this.getRange()),s=o.commonAncestorContainer,a=o.startOffset,c=o.endOffset,d=o.startContainer===s&&r.isFormatElement(s),u=d?s.childNodes[a]:o.startContainer,h=d?s.childNodes[c]:o.endContainer;let g,p=null;if(t)g=t.parentNode,t=t.nextSibling,p=!0;else if(g=u,3===u.nodeType&&(g=u.parentNode),o.collapsed)if(3===s.nodeType)t=s.textContent.length>c?s.splitText(c):s.nextSibling;else if(r.isBreak(g))t=g,g=g.parentNode;else{let n=g.childNodes[a];const i=n&&3===n.nodeType&&r.onlyZeroWidthSpace(n)&&r.isBreak(n.nextSibling)?n.nextSibling:n;i?i.nextSibling?t=r.isBreak(i)&&!r.isBreak(e)?i:i.nextSibling:(g.removeChild(i),t=null):t=null}else{if(u===h){t=this.isEdgePoint(h,c)?h.nextSibling:h.splitText(c);let e=u;this.isEdgePoint(u,a)||(e=u.splitText(a)),g.removeChild(e),0===g.childNodes.length&&l&&(g.innerHTML="
    ")}else{const e=this.removeNode(),n=e.container,i=e.prevContainer;if(n&&0===n.childNodes.length&&l&&(r.isFormatElement(n)?n.innerHTML="
    ":r.isRangeFormatElement(n)&&(n.innerHTML="


    ")),!l&&i)if(g=3===i.nodeType?i.parentNode:i,g.contains(n))for(t=n;t.parentNode===g;)t=t.parentNode;else t=null;else g=l?s:n,t=l?h:null;for(;t&&!r.isFormatElement(t)&&t.parentNode!==s;)t=t.parentNode}}try{if(r.isFormatElement(e)||r.isRangeFormatElement(e)||!r.isListCell(g)&&r.isComponent(e)){const e=g;if(r.isList(t))g=t,t=null;else if(r.isListCell(t))g=t.previousElementSibling||t;else if(!p&&!t){const e=this.removeNode(),n=3===e.container.nodeType?r.isListCell(r.getFormatElement(e.container,null))?e.container:r.getFormatElement(e.container,null)||e.container.parentNode:e.container,i=r.isWysiwygDiv(n)||r.isRangeFormatElement(n);g=i?n:n.parentNode,t=i?null:n.nextSibling}0===e.childNodes.length&&g!==e&&r.removeItem(e)}!l||i||r.isRangeFormatElement(g)||r.isListCell(g)||r.isWysiwygDiv(g)||(t=g.nextElementSibling,g=g.parentNode),g.insertBefore(e,g===t?g.lastChild:t)}catch(t){g.appendChild(e)}finally{if(i&&(r.isFormatElement(e)||r.isRangeFormatElement(e))&&(e=this._setIntoFreeFormat(e)),!r.isComponent(e)){let t=1;if(3===e.nodeType){const t=e.previousSibling,n=e.nextSibling,i=!t||1===t.nodeType||r.onlyZeroWidthSpace(t)?"":t.textContent,l=!n||1===n.nodeType||r.onlyZeroWidthSpace(n)?"":n.textContent;t&&i.length>0&&(e.textContent=i+e.textContent,r.removeItem(t)),n&&n.length>0&&(e.textContent+=l,r.removeItem(n));const o={container:e,startOffset:i.length,endOffset:e.textContent.length-l.length};return this.setRange(e,o.startOffset,e,o.endOffset),o}if(!r.isBreak(e)&&r.isFormatElement(g)){let n=null;e.previousSibling||(n=r.createTextNode(r.zeroWidthSpace),e.parentNode.insertBefore(n,e)),e.nextSibling||(n=r.createTextNode(r.zeroWidthSpace),e.parentNode.appendChild(n)),r._isIgnoreNodeChange(e)&&(e=e.nextSibling,t=0)}this.setRange(e,t,e,t)}return this.history.push(!0),e}},_setIntoFreeFormat:function(e){const t=e.parentNode;let n,i;for(;r.isFormatElement(e)||r.isRangeFormatElement(e);){for(n=e.childNodes,i=null;n[0];)if(i=n[0],r.isFormatElement(i)||r.isRangeFormatElement(i)){if(this._setIntoFreeFormat(i),!e.parentNode)break;n=e.childNodes}else t.insertBefore(i,e);0===e.childNodes.length&&r.removeItem(e),e=r.createElement("BR"),t.insertBefore(e,i.nextSibling)}return e},removeNode:function(){this._resetRangeToTextNode()||console.warn('[SUNEDITOR.core.removeNode.exception] An exception occurred while resetting the "Range" object.');const t=this.getRange();let n,i=0,l=t.startContainer,o=t.endContainer;const s=t.startOffset,a=t.endOffset,c=t.commonAncestorContainer;let d=null,u=null;const h=r.getListChildNodes(c,null);let g=r.getArrayIndex(h,l),p=r.getArrayIndex(h,o);if(h.length>0&&g>-1&&p>-1){for(let e=g+1,t=l;e>=0;e--)h[e]===t.parentNode&&h[e].firstChild===t&&0===s&&(g=e,t=t.parentNode);for(let e=p-1,t=o;e>g;e--)h[e]===t.parentNode&&1===h[e].nodeType&&(h.splice(e,1),t=t.parentNode,--p)}else{if(0===h.length){if(r.isFormatElement(c)||r.isRangeFormatElement(c)||r.isWysiwygDiv(c)||r.isBreak(c)||r.isMedia(c))return{container:c,offset:0};h.push(c),l=o=c}else if(l=o=h[0],r.isBreak(l)||r.onlyZeroWidthSpace(l))return{container:l,offset:0};g=p=0}function m(e){const t=r.getFormatElement(e,null);if(r.removeItem(e),r.isListCell(t)){const e=r.getArrayItem(t.children,r.isList,!1);if(e){const n=e.firstElementChild,i=n.childNodes;for(;i[0];)t.insertBefore(i[0],e);r.removeItemAllParents(n,null,null)}}}for(let e=g;e<=p;e++){const t=h[e];if(0===t.length||3===t.nodeType&&void 0===t.data)m(t);else if(t!==l)t!==o?m(t):(u=1===o.nodeType?r.createTextNode(o.textContent):r.createTextNode(o.substringData(a,o.length-a)),u.length>0?o.data=u.data:m(o));else if(1===l.nodeType?d=r.createTextNode(l.textContent):t===o?(d=r.createTextNode(l.substringData(0,s)+o.substringData(a,o.length-a)),i=s):d=r.createTextNode(l.substringData(0,s)),d.length>0?l.data=d.data:m(l),t===o)break}if(n=o&&o.parentNode?o:l&&l.parentNode?l:t.endContainer||t.startContainer,!r.isWysiwygDiv(n)){const t=r.removeItemAllParents(n,function(e){if(this.isComponent(e))return!1;const t=e.textContent;return 0===t.length||/^(\n|\u200B)+$/.test(t)}.bind(r),null);t&&(n=t.sc||t.ec||e.element.wysiwyg)}return this.setRange(n,i,n,i),this.history.push(!0),{container:n,offset:i,prevContainer:l&&l.parentNode?l:null}},applyRangeFormatElement:function(e){this.getRange_addLine(this.getRange());const t=this.getSelectedElementsAndComponents(!1);if(!t||0===t.length)return;e:for(let e,n,i,l,o,s,a=0,c=t.length;a-1&&(l=n.lastElementChild,t.indexOf(l)>-1)){let e=null;for(;e=l.lastElementChild;)if(r.isList(e)){if(!(t.indexOf(e.lastElementChild)>-1))continue e;l=e.lastElementChild}i=n.firstElementChild,o=t.indexOf(i),s=t.indexOf(l),t.splice(o,s-o+1),c=t.length}else;let n,i,l,o=t[t.length-1];n=r.isRangeFormatElement(o)||r.isFormatElement(o)?o:r.getRangeFormatElement(o,null)||r.getFormatElement(o,null),r.isCell(n)?(i=null,l=n):(i=n.nextSibling,l=n.parentNode);let s=r.getElementDepth(n),a=null;const c=[],d=function(e,t,n){let i=null;if(e!==t&&!r.isTable(t)){if(t&&r.getElementDepth(e)===r.getElementDepth(t))return n;i=r.removeItemAllParents(t,null,e)}return i?i.ec:n};for(let n,o,u,h,g,p,m,f=0,_=t.length;f<_;f++)if(n=t[f],o=n.parentNode,o&&!e.contains(o))if(u=r.getElementDepth(n),r.isList(o)){if(null===a&&(p?(a=p,m=!0,p=null):a=o.cloneNode(!1)),c.push(n),g=t[f+1],f===_-1||g&&g.parentNode!==o){g&&n.contains(g.parentNode)&&(p=g.parentNode.cloneNode(!1));let t,f=o.parentNode;for(;r.isList(f);)t=r.createElement(f.nodeName),t.appendChild(a),a=t,f=f.parentNode;const _=this.detachRangeFormatElement(o,c,null,!0,!0);s>=u?(s=u,l=_.cc,i=d(l,o,_.ec),i&&(l=i.parentNode)):l===_.cc&&(i=_.ec),l!==_.cc&&(h=d(l,_.cc,h),i=void 0!==h?h:_.cc);for(let e=0,t=_.removeArray.length;e=u&&(s=u,l=o,i=n.nextSibling),e.appendChild(n),l!==o&&(h=d(l,o),void 0!==h&&(i=h));if(this.effectNode=null,r.mergeSameTags(e,null,!1),r.mergeNestedTags(e,function(e){return this.isList(e)}.bind(r)),i&&r.getElementDepth(i)>0&&(r.isList(i.parentNode)||r.isList(i.parentNode.parentNode))){const t=r.getParentElement(i,function(e){return this.isRangeFormatElement(e)&&!this.isList(e)}.bind(r)),n=r.splitElement(i,null,t?r.getElementDepth(t)+1:0);n.parentNode.insertBefore(e,n)}else l.insertBefore(e,i),d(e,i);const u=r.getEdgeChildNodes(e.firstElementChild,e.lastElementChild);t.length>1?this.setRange(u.sc,0,u.ec,u.ec.textContent.length):this.setRange(u.ec,u.ec.textContent.length,u.ec,u.ec.textContent.length),this.history.push(!1)},detachRangeFormatElement:function(e,t,n,i,l){const o=this.getRange(),s=o.startOffset,a=o.endOffset;let c=r.getListChildNodes(e,(function(t){return t.parentNode===e})),d=e.parentNode,u=null,h=null,g=e.cloneNode(!1);const p=[],m=r.isList(n);let f=!1,_=!1,b=!1;function v(t,n,i,l){if(r.onlyZeroWidthSpace(n)&&(n.innerHTML=r.zeroWidthSpace),3===n.nodeType)return t.insertBefore(n,i),n;const o=(b?n:l).childNodes;let s=n.cloneNode(!1),a=null,c=null;for(;o[0];)c=o[0],!r._notTextNode(c)||r.isBreak(c)||r.isListCell(s)?s.appendChild(c):(s.childNodes.length>0&&(a||(a=s),t.insertBefore(s,i),s=n.cloneNode(!1)),t.insertBefore(c,i),a||(a=c));if(s.childNodes.length>0){if(r.isListCell(t)&&r.isListCell(s)&&r.isList(i))if(m){for(a=i;i;)s.appendChild(i),i=i.nextSibling;t.parentNode.insertBefore(s,t.nextElementSibling)}else{const t=l.nextElementSibling,n=r.detachNestedList(l,!1);if(e!==n||t!==l.nextElementSibling){const t=s.childNodes;for(;t[0];)l.appendChild(t[0]);e=n,_=!0}}else t.insertBefore(s,i);a||(a=s)}return a}for(let l,o,s,a=0,y=c.length;a0&&(d.insertBefore(g,e),g=null),!m&&r.isListCell(l))if(s&&r.getElementDepth(l)!==r.getElementDepth(s)&&(r.isListCell(d)||r.getArrayItem(l.children,r.isList,!1))){const t=l.nextElementSibling,n=r.detachNestedList(l,!1);e===n&&t===l.nextElementSibling||(e=n,_=!0)}else{const t=l;l=r.createElement(i?t.nodeName:r.isList(e.parentNode)||r.isListCell(e.parentNode)?"LI":r.isCell(e.parentNode)?"DIV":"P");const n=r.isListCell(l),o=t.childNodes;for(;o[0]&&(!r.isList(o[0])||n);)l.appendChild(o[0]);r.copyFormatAttributes(l,t),b=!0}else l=l.cloneNode(!1);if(!_&&(i?(p.push(l),r.removeItem(c[a])):(n?(f||(d.insertBefore(n,e),f=!0),l=v(n,l,null,c[a])):l=v(d,l,e,c[a]),_||(t?(h=l,u||(u=l)):u||(u=h=l))),_)){_=b=!1,c=r.getListChildNodes(e,(function(t){return t.parentNode===e})),g=e.cloneNode(!1),d=e.parentNode,a=-1,y=c.length;continue}}const y=e.parentNode;let C=e.nextSibling;g&&g.children.length>0&&y.insertBefore(g,C),n?u=n.previousSibling:u||(u=e.previousSibling),C=e.nextSibling,0===e.children.length||0===e.textContent.length?r.removeItem(e):r.removeEmptyNode(e,null);let w=null;if(i)w={cc:y,sc:u,ec:C,removeArray:p};else{u||(u=h),h||(h=u);const e=r.getEdgeChildNodes(u,h.parentNode?u:h);w={cc:(e.sc||e.ec).parentNode,sc:e.sc,ec:e.ec}}if(this.effectNode=null,l)return w;!i&&w&&(t?this.setRange(w.sc,s,w.ec,a):this.setRange(w.sc,0,w.sc,0)),this.history.push(!1)},detachList:function(e,t){let n={},i=!1,l=!1,o=null,s=null;const a=function(e){return!this.isComponent(e)}.bind(r);for(let c,d,u,h,g=0,p=e.length;g0)&&t,n=!!(n&&n.length>0)&&n;const o=!e,s=o&&!n&&!t;let c=l.startContainer,d=l.startOffset,u=l.endContainer,h=l.endOffset;if(s&&l.collapsed&&r.isFormatElement(c.parentNode)&&r.isFormatElement(u.parentNode)||c===u&&1===c.nodeType&&r.isNonEditable(c))return;if(l.collapsed&&!s&&1===c.nodeType&&!r.isBreak(c)&&!r.isComponent(c)){let e=null;const t=c.childNodes[d];t&&(e=t.nextSibling?r.isBreak(t)?t:t.nextSibling:null);const n=r.createTextNode(r.zeroWidthSpace);c.insertBefore(n,e),this.setRange(n,1,n,1),l=this.getRange(),c=l.startContainer,d=l.startOffset,u=l.endContainer,h=l.endOffset}r.isFormatElement(c)&&(c=c.childNodes[d]||c.firstChild,d=0),r.isFormatElement(u)&&(u=u.childNodes[h]||u.lastChild,h=u.textContent.length),o&&(e=r.createElement("DIV"));const g=a.RegExp,p=e.nodeName;if(!s&&c===u&&!n&&e){let t=c,n=0;const i=[],l=e.style;for(let e=0,t=l.length;e0){for(;!r.isFormatElement(t)&&!r.isWysiwygDiv(t);){for(let l=0;l=i.length)return}}let m,f={},_={},b="",v="",y="";if(t){for(let e,n=0,i=t.length;n0&&(a=l.replace(b,"").trim(),a!==l&&(w.v=!0));const c=t.className;let d="";return v&&c.length>0&&(d=c.replace(v,"").trim(),d!==c&&(w.v=!0)),(!o||!v&&c||!b&&l||a||d||!n)&&(a||d||t.nodeName!==p||C(b)!==C(l)||C(v)!==C(c))?(b&&l.length>0&&(t.style.cssText=a),t.style.cssText||t.removeAttribute("style"),v&&c.length>0&&(t.className=d.trim()),t.className.trim()||t.removeAttribute("class"),t.style.cssText||t.className||t.nodeName!==p&&!n?t:(w.v=!0,null)):(w.v=!0,null)},E=this.getSelectedElements(null);l=this.getRange(),c=l.startContainer,d=l.startOffset,u=l.endContainer,h=l.endOffset,r.getFormatElement(c,null)||(c=r.getChildElement(E[0],(function(e){return 3===e.nodeType}),!1),d=0),r.getFormatElement(u,null)||(u=r.getChildElement(E[E.length-1],(function(e){return 3===e.nodeType}),!1),h=u.textContent.length);const S=r.getFormatElement(c,null)===r.getFormatElement(u,null),N=E.length-(S?0:1);m=e.cloneNode(!1);const T=s||o&&function(e){for(let t=0,n=e.length;t0&&(m=e.cloneNode(!1),_=this._nodeChange_endLine(E[N],m,x,u,h,s,o,w,k,A));for(let t,n=N-1;n>0;n--)m=e.cloneNode(!1),t=this._nodeChange_middleLine(E[n],m,x,s,o,w,_.container),t.endContainer&&(_.ancestor=null,_.container=t.endContainer),this._setCommonListStyle(t.ancestor,null);m=e.cloneNode(!1),f=this._nodeChange_startLine(E[0],m,x,c,d,s,o,w,k,A,_.container),f.endContainer&&(_.ancestor=null,_.container=f.endContainer),N<=0?_=f:_.container||(_.ancestor=null,_.container=f.container,_.offset=f.container.textContent.length),this._setCommonListStyle(f.ancestor,null),this._setCommonListStyle(_.ancestor||r.getFormatElement(_.container),null)}this.controllersOff(),this.setRange(f.container,f.offset,_.container,_.offset),this.history.push(!1)},_setCommonListStyle:function(e,t){if(!r.isListCell(e))return;t||e.removeAttribute("style");const n=r.getArrayItem((t||e).childNodes,(function(e){return!r.isBreak(e)&&!r.onlyZeroWidthSpace(e.textContent.trim())}),!0);if(n[0]&&1===n.length){if(!(t=n[0])||1!==t.nodeType)return;const i=t.style,l=e.style;/STRONG/i.test(t.nodeName)?l.fontWeight="bold":i.fontWeight&&(l.fontWeight=i.fontWeight),i.color&&(l.color=i.color),i.fontSize&&(l.fontSize=i.fontSize),this._setCommonListStyle(e,t)}},_stripRemoveNode:function(e){const t=e.parentNode;if(!e||3===e.nodeType||!t)return;const n=e.childNodes;for(;n[0];)t.insertBefore(n[0],e);t.removeChild(e)},_util_getMaintainedNode:function(e,t,n){return!n||e?null:this.getParentElement(n,this._isMaintainedNode.bind(this))||(t?null:this.getParentElement(n,this._isSizeNode.bind(this)))},_util_isMaintainedNode:function(e,t,n){if(!n||e||1!==n.nodeType)return!1;const i=this._isMaintainedNode(n);return this.getParentElement(n,this._isMaintainedNode.bind(this))?i:i||!t&&this._isSizeNode(n)},_nodeChange_oneLine:function(e,t,n,i,l,o,s,c,d,u,h,g,p){let m=i.parentNode;for(;!(m.nextSibling||m.previousSibling||r.isFormatElement(m.parentNode)||r.isWysiwygDiv(m.parentNode))&&m.nodeName!==t.nodeName;)m=m.parentNode;if(!d&&m===o.parentNode&&m.nodeName===t.nodeName&&r.onlyZeroWidthSpace(i.textContent.slice(0,l))&&r.onlyZeroWidthSpace(o.textContent.slice(s))){const e=m.childNodes;let n=!0;for(let t,l,s,a,c=0,d=e.length;c0&&(n=t.test(e.style.cssText)),!n}if(function e(i,l){const o=i.childNodes;for(let i,s=0,a=o.length;s=N?L-N:S.data.length-N));if(E){const t=g(l);if(t&&t.parentNode!==e){let n=t,i=null;for(;n.parentNode!==e;){for(l=i=n.parentNode.cloneNode(!1);n.childNodes[0];)i.appendChild(n.childNodes[0]);n.appendChild(i),n=n.parentNode}n.parentNode.appendChild(t)}E=E.cloneNode(!1)}r.onlyZeroWidthSpace(o)||l.appendChild(o);const c=g(l);for(c&&(E=c),E&&(e=E),C=a,y=[],x="";C!==e&&C!==f&&null!==C;)i=p(C)?null:n(C),i&&1===C.nodeType&&z(C)&&(y.push(i),x+=C.style.cssText.substr(0,C.style.cssText.indexOf(":"))+"|"),C=C.parentNode;const d=y.pop()||s;for(w=C=d;y.length>0;)C=y.pop(),w.appendChild(C),w=C;if(t.appendChild(d),e.appendChild(t),E&&!g(T)&&(t=t.cloneNode(!1),b.appendChild(t),_.push(t)),S=s,N=0,k=!0,C!==s&&C.appendChild(S),!v)continue}if(A||a!==T){if(k){if(1===a.nodeType&&!r.isBreak(a)){r._isIgnoreNodeChange(a)?(b.appendChild(a.cloneNode(!0)),u||(t=t.cloneNode(!1),b.appendChild(t),_.push(t))):e(a,a);continue}C=a,y=[],x="";const o=[];for(;null!==C.parentNode&&C!==f&&C!==t;)i=A?C.cloneNode(!1):n(C),1===C.nodeType&&!r.isBreak(a)&&i&&z(C)&&(p(C)?E||o.push(i):y.push(i),x+=C.style.cssText.substr(0,C.style.cssText.indexOf(":"))+"|"),C=C.parentNode;y=y.concat(o);const s=y.pop()||a;for(w=C=s;y.length>0;)C=y.pop(),w.appendChild(C),w=C;if(p(t.parentNode)&&!p(s)&&(t=t.cloneNode(!1),b.appendChild(t),_.push(t)),A||E||!p(s))s===a?l=A?b:t:A?(b.appendChild(s),l=C):(t.appendChild(s),l=C);else{t=t.cloneNode(!1);const e=s.childNodes;for(let n=0,i=e.length;n0?C:t}if(E&&3===a.nodeType)if(g(a)){const e=r.getParentElement(l,function(e){return this._isMaintainedNode(e.parentNode)||e.parentNode===b}.bind(r));E.appendChild(e),t=e.cloneNode(!1),_.push(t),b.appendChild(t)}else E=null}d=a.cloneNode(!1),l.appendChild(d),1!==a.nodeType||r.isBreak(a)||(h=d),e(a,h)}else{E=g(a);const e=r.createTextNode(1===T.nodeType?"":T.substringData(L,T.length-L)),l=r.createTextNode(v||1===T.nodeType?"":T.substringData(0,L));if(E?E=E.cloneNode(!1):p(t.parentNode)&&!E&&(t=t.cloneNode(!1),b.appendChild(t),_.push(t)),!r.onlyZeroWidthSpace(e)){C=a,x="",y=[];const t=[];for(;C!==b&&C!==f&&null!==C;)1===C.nodeType&&z(C)&&(p(C)?t.push(C.cloneNode(!1)):y.push(C.cloneNode(!1)),x+=C.style.cssText.substr(0,C.style.cssText.indexOf(":"))+"|"),C=C.parentNode;for(y=y.concat(t),d=w=C=y.pop()||e;y.length>0;)C=y.pop(),w.appendChild(C),w=C;b.appendChild(d),C.textContent=e.data}if(E&&d){const e=g(d);e&&(E=e)}for(C=a,y=[],x="";C!==b&&C!==f&&null!==C;)i=p(C)?null:n(C),i&&1===C.nodeType&&z(C)&&(y.push(i),x+=C.style.cssText.substr(0,C.style.cssText.indexOf(":"))+"|"),C=C.parentNode;const o=y.pop()||l;for(w=C=o;y.length>0;)C=y.pop(),w.appendChild(C),w=C;E?((t=t.cloneNode(!1)).appendChild(o),E.insertBefore(t,E.firstChild),b.appendChild(E),_.push(t),E=null):t.appendChild(o),T=l,L=l.data.length,A=!0,!c&&u&&(t=l,l.textContent=r.zeroWidthSpace),C!==l&&C.appendChild(T)}}}(e,b),d&&!c&&!h.v)return{ancestor:e,startContainer:i,startOffset:l,endContainer:o,endOffset:s};if(c=c&&d)for(let e=0;e<_.length;e++){let t,n,i,l=_[e];if(u)t=r.createTextNode(r.zeroWidthSpace),b.replaceChild(t,l);else{const e=l.childNodes;for(n=e[0];e[0];)i=e[0],b.insertBefore(i,l);r.removeItem(l)}0===e&&(u?S=T=t:(S=n,T=i))}else{if(d)for(let e=0;e<_.length;e++)this._stripRemoveNode(_[e]);u&&(S=T=t)}r.removeEmptyNode(b,t),u&&(N=S.textContent.length,L=T.textContent.length);const M=c||0===T.textContent.length;r.isBreak(T)||0!==T.textContent.length||(r.removeItem(T),T=S),L=M?T.textContent.length:L;const H={s:0,e:0},I=r.getNodePath(S,b,H),D=!T.parentNode;D&&(T=S);const O={s:0,e:0},F=r.getNodePath(T,b,D||M?null:O);N+=H.s,L=u?N:D?S.textContent.length:M?L+H.s:L+O.s;const R=r.mergeSameTags(b,[I,F],!0);return e.parentNode.replaceChild(b,e),S=r.getNodeFromPath(I,b),T=r.getNodeFromPath(F,b),{ancestor:b,startContainer:S,startOffset:N+R[0],endContainer:T,endOffset:L+R[1]}},_nodeChange_startLine:function(e,t,n,i,l,o,s,a,c,d,u){let h=i.parentNode;for(;!(h.nextSibling||h.previousSibling||r.isFormatElement(h.parentNode)||r.isWysiwygDiv(h.parentNode))&&h.nodeName!==t.nodeName;)h=h.parentNode;if(!s&&h.nodeName===t.nodeName&&!r.isFormatElement(h)&&!h.nextSibling&&r.onlyZeroWidthSpace(i.textContent.slice(0,l))){let n=!0,o=i.previousSibling;for(;o;){if(!r.onlyZeroWidthSpace(o)){n=!1;break}o=o.previousSibling}if(n)return r.copyTagAttributes(h,t),{ancestor:e,container:i,offset:l}}a.v=!1;const g=e,p=[t],m=e.cloneNode(!1);let f,_,b,v,y=i,C=l,w=!1;if(function e(i,l){const o=i.childNodes;for(let i,s,a=0,h=o.length;a0,y=f.pop()||h;for(b=_=y;f.length>0;)_=f.pop(),b.appendChild(_),b=_;if(d(t.parentNode)&&!d(y)&&(t=t.cloneNode(!1),m.appendChild(t),p.push(t)),!v&&d(y)){t=t.cloneNode(!1);const e=y.childNodes;for(let n=0,i=e.length;n0;)_=f.pop(),b.appendChild(_),b=_;d!==l?(t.appendChild(d),l=_):l=t,r.isBreak(h)&&t.appendChild(h.cloneNode(!1)),e.appendChild(t),y=s,C=0,w=!0,l.appendChild(y)}}}(e,m),s&&!o&&!a.v)return{ancestor:e,container:i,offset:l,endContainer:u};if(o=o&&s)for(let e=0;e0&&u===h)return e.innerHTML=i.innerHTML,{ancestor:e,endContainer:n?r.getNodeFromPath(n,e):null}}o.v=!1;const a=e.cloneNode(!1),c=[t];let d=!0;if(function e(i,l){const o=i.childNodes;for(let i,u,h=0,g=o.length;h0&&(a.appendChild(t),t=t.cloneNode(!1)),u=g.cloneNode(!0),a.appendChild(u),a.appendChild(t),c.push(t),l=t,s&&g.contains(s)){const e=r.getNodePath(s,g);s=r.getNodeFromPath(e,u)}}}(e,t),d||l&&!i&&!o.v)return{ancestor:e,endContainer:s};if(a.appendChild(t),i&&l)for(let e=0;e0,u=m.pop()||a;for(_=f=u;m.length>0;)f=m.pop(),_.appendChild(f),_=f;if(d(t.parentNode)&&!d(u)&&(t=t.cloneNode(!1),p.insertBefore(t,p.firstChild),g.push(t)),!b&&d(u)){t=t.cloneNode(!1);const e=u.childNodes;for(let n=0,i=e.length;n0?f:t}else s?(t.insertBefore(u,t.firstChild),l=f):l=t;if(b&&3===a.nodeType)if(c(a)){const e=r.getParentElement(l,function(e){return this._isMaintainedNode(e.parentNode)||e.parentNode===p}.bind(r));b.appendChild(e),t=e.cloneNode(!1),g.push(t),p.insertBefore(t,p.firstChild)}else b=null}if(C||a!==v)i=C?n(a):a.cloneNode(!1),i&&(l.insertBefore(i,l.firstChild),1!==a.nodeType||r.isBreak(a)||(u=i)),e(a,u);else{b=c(a);const e=r.createTextNode(1===v.nodeType?"":v.substringData(y,v.length-y)),o=r.createTextNode(1===v.nodeType?"":v.substringData(0,y));if(b){b=b.cloneNode(!1);const e=c(l);if(e&&e.parentNode!==p){let t=e,n=null;for(;t.parentNode!==p;){for(l=n=t.parentNode.cloneNode(!1);t.childNodes[0];)n.appendChild(t.childNodes[0]);t.appendChild(n),t=t.parentNode}t.parentNode.insertBefore(e,t.parentNode.firstChild)}b=b.cloneNode(!1)}else d(t.parentNode)&&!b&&(t=t.cloneNode(!1),p.appendChild(t),g.push(t));for(r.onlyZeroWidthSpace(e)||l.insertBefore(e,l.firstChild),f=l,m=[];f!==p&&null!==f;)i=d(f)?null:n(f),i&&1===f.nodeType&&m.push(i),f=f.parentNode;const s=m.pop()||l;for(_=f=s;m.length>0;)f=m.pop(),_.appendChild(f),_=f;s!==l?(t.insertBefore(s,t.firstChild),l=f):l=t,r.isBreak(a)&&t.appendChild(a.cloneNode(!1)),b?(b.insertBefore(t,b.firstChild),p.insertBefore(b,p.firstChild),b=null):p.insertBefore(t,p.firstChild),v=o,y=o.data.length,C=!0,l.insertBefore(v,l.firstChild)}}}(e,p),s&&!o&&!a.v)return{ancestor:e,container:i,offset:l};if(o=o&&s)for(let e=0;e-1?null:r.createElement(n);let d=n;/^SUB$/i.test(n)&&a.indexOf("SUP")>-1?d="SUP":/^SUP$/i.test(n)&&a.indexOf("SUB")>-1&&(d="SUB"),this.nodeChange(c,null,[d],!1),this.focus()}},removeFormat:function(){this.nodeChange(null,null,null,null)},indent:function(e){const t=this.getRange(),n=this.getSelectedElements(null),i=[],l="indent"!==e;let o=t.startContainer,s=t.endContainer,a=t.startOffset,c=t.endOffset;for(let e,t,o=0,s=n.length;o0&&this.plugins.list.editInsideList.call(this,l,i),this.effectNode=null,this.setRange(o,a,s,c),this.history.push(!1)},toggleDisplayBlocks:function(){const t=e.element.wysiwyg;r.toggleClass(t,"se-show-block"),r.hasClass(t,"se-show-block")?r.addClass(this._styleCommandMap.showBlocks,"active"):r.removeClass(this._styleCommandMap.showBlocks,"active"),this._resourcesStateChange()},toggleCodeView:function(){const t=this._variable.isCodeView;this.controllersOff(),r.setDisabledButtons(!t,this.codeViewDisabledButtons),t?(this._setCodeDataToEditor(),e.element.wysiwygFrame.scrollTop=0,e.element.code.style.display="none",e.element.wysiwygFrame.style.display="block",this._variable._codeOriginCssText=this._variable._codeOriginCssText.replace(/(\s?display(\s+)?:(\s+)?)[a-zA-Z]+(?=;)/,"display: none"),this._variable._wysiwygOriginCssText=this._variable._wysiwygOriginCssText.replace(/(\s?display(\s+)?:(\s+)?)[a-zA-Z]+(?=;)/,"display: block"),"auto"!==l.height||l.codeMirrorEditor||(e.element.code.style.height="0px"),this._variable.isCodeView=!1,this._variable.isFullScreen||(this._notHideToolbar=!1,/balloon|balloon-always/i.test(l.mode)&&(e.element._arrow.style.display="",this._isInline=!1,this._isBalloon=!0,u._hideToolbar())),this.nativeFocus(),r.removeClass(this._styleCommandMap.codeView,"active"),this.history.push(!1)):(this._setEditorDataToCodeView(),this._variable._codeOriginCssText=this._variable._codeOriginCssText.replace(/(\s?display(\s+)?:(\s+)?)[a-zA-Z]+(?=;)/,"display: block"),this._variable._wysiwygOriginCssText=this._variable._wysiwygOriginCssText.replace(/(\s?display(\s+)?:(\s+)?)[a-zA-Z]+(?=;)/,"display: none"),"auto"!==l.height||l.codeMirrorEditor||(e.element.code.style.height=e.element.code.scrollHeight>0?e.element.code.scrollHeight+"px":"auto"),l.codeMirrorEditor&&l.codeMirrorEditor.refresh(),this._variable.isCodeView=!0,this._variable.isFullScreen||(this._notHideToolbar=!0,this._isBalloon&&(e.element._arrow.style.display="none",e.element.toolbar.style.left="",this._isInline=!0,this._isBalloon=!1,u._showToolbarInline())),this._variable._range=null,e.element.code.focus(),r.addClass(this._styleCommandMap.codeView,"active")),this._checkPlaceholder(),"function"==typeof h.toggleCodeView&&h.toggleCodeView(this._variable.isCodeView,this)},_setCodeDataToEditor:function(){const t=this._getCodeView();if(l.fullPage){const e=this._parser.parseFromString(t,"text/html"),n=e.head.children;for(let t=0,i=n.length;t0?this.convertContentsForEditor(t):"


    "},_setEditorDataToCodeView:function(){const t=this.convertHTMLForCodeView(e.element.wysiwyg);let n="";if(l.fullPage){const e=r.getAttributesToString(this._wd.body,null);n="\n\n"+this._wd.head.outerHTML.replace(/>(?!\n)/g,">\n")+"\n"+t+"\n"}else n=t;e.element.code.style.display="block",e.element.wysiwygFrame.style.display="none",this._setCodeView(n)},toggleFullScreen:function(t){const n=e.element.topArea,i=e.element.toolbar,o=e.element.editorArea,d=e.element.wysiwygFrame,g=e.element.code,p=this._variable;this.controllersOff(),p.isFullScreen?(p.isFullScreen=!1,d.style.cssText=p._wysiwygOriginCssText,g.style.cssText=p._codeOriginCssText,i.style.cssText="",o.style.cssText=p._editorAreaOriginCssText,n.style.cssText=p._originCssText,s.body.style.overflow=p._bodyOverflow,l.toolbarContainer&&l.toolbarContainer.appendChild(i),l.stickyToolbar>-1&&r.removeClass(i,"se-toolbar-sticky"),p._fullScreenAttrs.sticky&&!l.toolbarContainer&&(p._fullScreenAttrs.sticky=!1,e.element._stickyDummy.style.display="block",r.addClass(i,"se-toolbar-sticky")),this._isInline=p._fullScreenAttrs.inline,this._isBalloon=p._fullScreenAttrs.balloon,this._isInline&&u._showToolbarInline(),l.toolbarContainer&&r.removeClass(i,"se-toolbar-balloon"),u.onScroll_window(),r.changeElement(t.firstElementChild,c.expansion),r.removeClass(this._styleCommandMap.fullScreen,"active")):(p.isFullScreen=!0,p._fullScreenAttrs.inline=this._isInline,p._fullScreenAttrs.balloon=this._isBalloon,(this._isInline||this._isBalloon)&&(this._isInline=!1,this._isBalloon=!1),l.toolbarContainer&&e.element.relative.insertBefore(i,o),n.style.position="fixed",n.style.top="0",n.style.left="0",n.style.width="100%",n.style.maxWidth="100%",n.style.height="100%",n.style.zIndex="2147483647",""!==e.element._stickyDummy.style.display&&(p._fullScreenAttrs.sticky=!0,e.element._stickyDummy.style.display="none",r.removeClass(i,"se-toolbar-sticky")),p._bodyOverflow=s.body.style.overflow,s.body.style.overflow="hidden",p._editorAreaOriginCssText=o.style.cssText,p._wysiwygOriginCssText=d.style.cssText,p._codeOriginCssText=g.style.cssText,o.style.cssText=i.style.cssText="",d.style.cssText=(d.style.cssText.match(/\s?display(\s+)?:(\s+)?[a-zA-Z]+;/)||[""])[0],g.style.cssText=(g.style.cssText.match(/\s?display(\s+)?:(\s+)?[a-zA-Z]+;/)||[""])[0],i.style.width=d.style.height=g.style.height="100%",i.style.position="relative",i.style.display="block",p.innerHeight_fullScreen=a.innerHeight-i.offsetHeight,o.style.height=p.innerHeight_fullScreen+"px",r.changeElement(t.firstElementChild,c.reduction),l.iframe&&"auto"===l.height&&(o.style.overflow="auto",this._iframeAutoHeight()),r.addClass(this._styleCommandMap.fullScreen,"active")),"function"==typeof h.toggleFullScreen&&h.toggleFullScreen(this._variable.isFullScreen,this)},print:function(){const e=r.createElement("IFRAME");e.style.display="none",s.body.appendChild(e);const t=r.getIframeDocument(e),n=this.getContents(!0),i=this._wd;if(l.iframe){const e=l.fullPage?r.getAttributesToString(i.body,["contenteditable"]):'class="sun-editor-editable"';t.write(""+i.head.innerHTML+""+n+"")}else{const e=s.head.getElementsByTagName("link"),i=s.head.getElementsByTagName("style");let l="";for(let t=0,n=e.length;t"+l+''+n+"")}this.showLoading(),a.setTimeout((function(){try{if(e.focus(),r.isIE_Edge||s.documentMode||a.StyleMedia)try{e.contentWindow.document.execCommand("print",!1,null)}catch(t){e.contentWindow.print()}else e.contentWindow.print()}catch(e){throw Error("[SUNEDITOR.core.print.fail] error: "+e)}finally{d.closeLoading(),r.removeItem(e)}}),1e3)},preview:function(){d.submenuOff(),d.containerOff(),d.controllersOff();const t=this.getContents(!0),n=a.open("","_blank");n.mimeType="text/html";const o=e.element.wysiwygFrame.offsetWidth+"px !important",c=this._wd;if(l.iframe){const e=l.fullPage?r.getAttributesToString(c.body,["contenteditable"]):'class="sun-editor-editable"';n.document.write(""+c.head.innerHTML+""+t+"")}else{const e=s.head.getElementsByTagName("link"),l=s.head.getElementsByTagName("style");let a="";for(let t=0,n=e.length;t'+i.toolbar.preview+""+a+''+t+"")}},setContents:function(t){const n=this.convertContentsForEditor(t);if(this._resetComponents(),this._variable.isCodeView){const e=this.convertHTMLForCodeView(n);this._setCodeView(e)}else e.element.wysiwyg.innerHTML=n,this.history.push(!1)},getContents:function(t){const n=e.element.wysiwyg.innerHTML,i=r.createElement("DIV");i.innerHTML=n;const o=r.getListChildren(i,(function(e){return/FIGCAPTION/i.test(e.nodeName)}));for(let e=0,t=o.length;e"+this._wd.head.outerHTML+""+i.innerHTML+""}return i.innerHTML},_makeLine:function(e,t){if(1===e.nodeType)return r._disallowedTags(e)?"":!t||r.isFormatElement(e)||r.isRangeFormatElement(e)||r.isComponent(e)||r.isMedia(e)||r.isAnchor(e)&&r.isMedia(e.firstElementChild)?e.outerHTML:"

    "+e.outerHTML+"

    ";if(3===e.nodeType){if(!t)return e.textContent;const n=e.textContent.split(/\n/g);let i="";for(let e,t=0,l=n.length;t0&&(i+="

    "+e+"

    ");return i}return 8===e.nodeType&&this._allowHTMLComments?"\x3c!--"+e.textContent.trim()+"--\x3e":""},_tagConvertor:function(e){if(!this._disallowedTextTagsRegExp)return e;const t={b:"strong",i:"em",ins:"u",strike:"del",s:"del"};return e.replace(this._disallowedTextTagsRegExp,(function(e,n,i){return n+("string"==typeof t[i]?t[i]:i)}))},_deleteDisallowedTags:function(e){return e.replace(/\n/g,"").replace(/<(script|style).*>(\n|.)*<\/(script|style)>/gi,"").replace(/<[a-z0-9]+\:[a-z0-9]+[^>^\/]*>[^>]*<\/[a-z0-9]+\:[a-z0-9]+>/gi,"").replace(this.editorTagsWhitelistRegExp,"")},cleanHTML:function(e,t){e=this._deleteDisallowedTags(e).replace(/(<[a-zA-Z0-9]+)[^>]*(?=>)/g,function(e,t){if(/^<[a-z0-9]+\:[a-z0-9]+/i.test(e))return e;let n=null;const i=this._attributesTagsWhitelist[t.match(/(?!<)[a-zA-Z0-9]+/)[0].toLowerCase()];if(n=i?e.match(i):e.match(this._attributesWhitelistRegExp),/

    ":(i=r.htmlRemoveWhiteSpace(i),this._tagConvertor(i))},convertHTMLForCodeView:function(e){let t="";const n=a.RegExp,i=new n("^(BLOCKQUOTE|PRE|TABLE|THEAD|TBODY|TR|TH|TD|OL|UL|IMG|IFRAME|VIDEO|AUDIO|FIGURE|FIGCAPTION|HR|BR|CANVAS|SELECT)$","i"),l=r.isFormatElement.bind(r),o="string"==typeof e?s.createRange().createContextualFragment(e):e;let c=1*this._variable.codeIndent;return c=c>0?new a.Array(c+1).join(" "):"",function e(o,s,a){const d=o.childNodes,u=i.test(o.nodeName),h=u?s:"";for(let g,p,m,f=0,_=d.length;f<_;f++){if(g=d[f],m=i.test(g.nodeName),p=m?"\n":"",a=!l(g)||u||/^(TH|TD)$/i.test(o.nodeName)?"":"\n",8===g.nodeType){t+="\n\x3c!-- "+g.textContent.trim()+" --\x3e"+p;continue}if(3===g.nodeType){t+=r._HTMLConvertor(/^\n+$/.test(g.data)?"":g.data);continue}if(0===g.childNodes.length){t+=(/^HR$/i.test(g.nodeName)?"\n":"")+h+g.outerHTML+p;continue}g.innerHTML=g.innerHTML;const _=g.nodeName.toLowerCase();t+=(a||(u?"":p))+(h||m?s:"")+g.outerHTML.match(n("<"+_+"[^>]*>","i"))[0]+p,e(g,s+c,""),t+=(m?s:"")+""+(a||p||u||/^(TH|TD)$/i.test(g.nodeName)?"\n":"")}}(o,"","\n"),t.trim()+"\n"},addDocEvent:function(e,t,n){s.addEventListener(e,t,n),l.iframe&&this._wd.addEventListener(e,t)},removeDocEvent:function(e,t){s.removeEventListener(e,t),l.iframe&&this._wd.removeEventListener(e,t)},_charCount:function(e){const t=l.maxCharCount,n=l.charCounterType;let i=0;if(e&&(i=this.getCharLength(e,n)),this._setCharCount(),t>0){let e=!1;const l=h.getCharCount(n);if(l>t){if(e=!0,i>0){this._editorRange();const e=this.getRange(),n=e.endOffset-1,i=this.getSelectionNode().textContent,o=e.endOffset-(l-t);this.getSelectionNode().textContent=i.slice(0,o<0?0:o)+i.slice(e.endOffset,i.length),this.setRange(e.endContainer,n,e.endContainer,n)}}else l+i>t&&(e=!0);if(e&&(this._callCounterBlink(),i>0))return!1}return!0},checkCharCount:function(e,t){if(l.maxCharCount){const n=t||l.charCounterType,i=this.getCharLength("string"==typeof e?e:this._charTypeHTML?e.outerHTML:e.textContent,n);if(i>0&&i+h.getCharCount(n)>l.maxCharCount)return this._callCounterBlink(),!1}return!0},getCharLength:function(e,t){return/byte/.test(t)?r.getByteLength(e):e.length},_setCharCount:function(){e.element.charCounter&&a.setTimeout((function(){e.element.charCounter.textContent=h.getCharCount(l.charCounterType)}))},_callCounterBlink:function(){const t=e.element.charWrapper;t&&!r.hasClass(t,"se-blink")&&(r.addClass(t,"se-blink"),a.setTimeout((function(){r.removeClass(t,"se-blink")}),600))},_checkComponents:function(){for(let e=0,t=this._fileInfoPluginsCheck.length;e^<]+)?\\s*(?=>)","gi");const h="contenteditable|colspan|rowspan|target|href|src|class|type|controls|data-format|data-size|data-file-size|data-file-name|data-origin|data-align|data-image-link|data-rotate|data-proportion|data-percentage|origin-size|data-exp|data-font-size";this._allowHTMLComments=l._editorTagsWhitelist.indexOf("//")>-1,this._htmlCheckWhitelistRegExp=new c("^("+l._editorTagsWhitelist.replace("|//","")+")$","i"),this.editorTagsWhitelistRegExp=r.createTagsWhitelist(l._editorTagsWhitelist.replace("|//","|\x3c!--|--\x3e")),this.pasteTagsWhitelistRegExp=r.createTagsWhitelist(l.pasteTagsWhitelist);const g=l.attributesWhitelist,p={};let m="";if(g)for(let e in g)r.hasOwn(g,e)&&("all"===e?m=g[e]+"|":p[e]=new c("((?:"+g[e]+"|"+h+')s*=s*"[^"]*")',"ig"));this._attributesWhitelistRegExp=new c("((?:"+m+h+')s*=s*"[^"]*")',"ig"),this._attributesTagsWhitelist=p,this._isInline=/inline/i.test(l.mode),this._isBalloon=/balloon|balloon-always/i.test(l.mode),this._isBalloonAlways=/balloon-always/i.test(l.mode),this._cachingButtons(),this._fileInfoPluginsCheck=[],this._fileInfoPluginsReset=[],this.managedTagsInfo={query:"",map:{}};const f=[];this.activePlugins=[],this._fileManager.tags=[],this._fileManager.pluginMap={};let _,b,v=[];for(let e in n)if(r.hasOwn(n,e)){if(_=n[e],b=t[e],_.active&&b&&this.callPlugin(e,null,b),"function"==typeof _.checkFileInfo&&"function"==typeof _.resetFileInfo&&(this.callPlugin(e,null,b),this._fileInfoPluginsCheck.push(_.checkFileInfo.bind(this)),this._fileInfoPluginsReset.push(_.resetFileInfo.bind(this))),a.Array.isArray(_.fileTags)){const t=_.fileTags;this.callPlugin(e,null,b),this._fileManager.tags=this._fileManager.tags.concat(t),v.push(e);for(let n=0,i=t.length;nc&&(d=d.slice(0,c),a&&a.setAttribute("disabled",!0)),d[c]=l?{contents:n,s:{path:i.getNodePath(l.startContainer,null,null),offset:l.startOffset},e:{path:i.getNodePath(l.endContainer,null,null),offset:l.endOffset}}:{contents:n,s:{path:[0,0],offset:[0,0]},e:{path:0,offset:0}},1===c&&s&&s.removeAttribute("disabled"),e._setCharCount(),t()}return{stack:d,push:function(t){n.setTimeout(e._resourcesStateChange.bind(e));const i="number"==typeof t?t>0?t:0:t?l:0;i&&!r||(n.clearTimeout(r),i)?r=n.setTimeout((function(){n.clearTimeout(r),r=null,h()}),i):h()},undo:function(){c>0&&(c--,u())},redo:function(){d.length-1>c&&(c++,u())},go:function(e){c=e<0?d.length-1:e,u()},reset:function(n){s&&s.setAttribute("disabled",!0),a&&a.setAttribute("disabled",!0),e.context.tool.save&&e.context.tool.save.setAttribute("disabled",!0),d.splice(0),c=0,d[c]={contents:e.getContents(!0),s:{path:[0,0],offset:0},e:{path:[0,0],offset:0}},n||t()},_resetCachingButton:function(){o=e.context.element,s=e.context.tool.undo,a=e.context.tool.redo,0===c?(s&&s.setAttribute("disabled",!0),a&&c===d.length-1&&a.setAttribute("disabled",!0),e.context.tool.save&&e.context.tool.save.setAttribute("disabled",!0)):c===d.length-1&&a&&a.setAttribute("disabled",!0)},_destroy:function(){r&&n.clearTimeout(r),d=null}}}(this,this._onChange_historyStack.bind(this)),this.addModule([A]),l.iframe&&(this._wd=e.element.wysiwygFrame.contentDocument,e.element.wysiwyg=this._wd.body,l._editorStyles.editor&&(e.element.wysiwyg.style.cssText=l._editorStyles.editor),"auto"===l.height&&(this._iframeAuto=this._wd.body)),this._initWysiwygArea(i,o)},_cachingButtons:function(){this.codeViewDisabledButtons=e.element.toolbar.querySelectorAll('.se-toolbar button:not([class~="se-code-view-enabled"])'),this.resizingDisabledButtons=e.element.toolbar.querySelectorAll('.se-toolbar button:not([class~="se-resizing-enabled"])');const t=e.tool;this.commandMap={STRONG:t.bold,U:t.underline,EM:t.italic,DEL:t.strike,SUB:t.subscript,SUP:t.superscript,OUTDENT:t.outdent,INDENT:t.indent},this._styleCommandMap={fullScreen:t.fullScreen,showBlocks:t.showBlocks,codeView:t.codeView}},_initWysiwygArea:function(t,n){e.element.wysiwyg.innerHTML=t?n:this.convertContentsForEditor("string"==typeof n?n:e.element.originElement.value)},_resourcesStateChange:function(){this._iframeAutoHeight(),this._checkPlaceholder()},_onChange_historyStack:function(){u._applyTagEffects(),e.tool.save&&e.tool.save.removeAttribute("disabled"),h.onChange&&h.onChange(this.getContents(!0),this)},_iframeAutoHeight:function(){this._iframeAuto&&a.setTimeout((function(){e.element.wysiwygFrame.style.height=d._iframeAuto.offsetHeight+"px"}))},_checkPlaceholder:function(){if(this._placeholder){if(this._variable.isCodeView)return void(this._placeholder.style.display="none");const t=e.element.wysiwyg;!r.onlyZeroWidthSpace(t.textContent)||t.querySelector(".se-component, pre, blockquote, hr, li, table, img, iframe, video")||(t.innerText.match(/\n/g)||"").length>1?this._placeholder.style.display="none":this._placeholder.style.display="block"}},_setDefaultFormat:function(e){if(this._fileManager.pluginRegExp.test(this.currentControllerName))return;const t=this.getRange(),n=t.commonAncestorContainer,i=t.startContainer,l=r.getRangeFormatElement(n,null);let o,s,a;const c=r.getParentElement(n,r.isComponent);if((!c||r.isTable(c))&&(!r.isRangeFormatElement(i)&&!r.isWysiwygDiv(i)||!r.isComponent(i.childNodes[t.startOffset]))){if(l)return a=r.createElement(e||"P"),a.innerHTML=l.innerHTML,0===a.childNodes.length&&(a.innerHTML=r.zeroWidthSpace),l.innerHTML=a.outerHTML,a=l.firstChild,o=r.getEdgeChildNodes(a,null).sc,o||(o=r.createTextNode(r.zeroWidthSpace),a.insertBefore(o,a.firstChild)),s=o.textContent.length,void this.setRange(o,s,o,s);if(r.isRangeFormatElement(n)&&n.childNodes.length<=1){let e=null;return 1===n.childNodes.length&&r.isBreak(n.firstChild)?e=n.firstChild:(e=r.createTextNode(r.zeroWidthSpace),n.appendChild(e)),void this.setRange(e,1,e,1)}if(this.execCommand("formatBlock",!1,e||"P"),o=r.getEdgeChildNodes(n,n),o=o?o.ec:n,a=r.getFormatElement(o,null),!a)return this.removeRange(),void this._editorRange();if(r.isBreak(a.nextSibling)&&r.removeItem(a.nextSibling),r.isBreak(a.previousSibling)&&r.removeItem(a.previousSibling),r.isBreak(o)){const e=r.createTextNode(r.zeroWidthSpace);o.parentNode.insertBefore(e,o),o=e}this.effectNode=null,this.nativeFocus()}},_setOptionsInit:function(t,n){this.context=e=k(t.originElement,this._getConstructed(t),l),this._componentsInfoReset=!0,this._editorInit(!0,n)},_editorInit:function(t,n){this._init(t,n),u._addEvent(),this._setCharCount(),u._offStickyToolbar(),u.onResize_window(),e.element.toolbar.style.visibility="",this._checkComponents(),this._componentsInfoInit=!1,this._componentsInfoReset=!1,this.history.reset(!0),this._resourcesStateChange(),a.setTimeout((function(){"function"==typeof h.onload&&h.onload(d,t)}))},_getConstructed:function(e){return{_top:e.topArea,_relative:e.relative,_toolBar:e.toolbar,_menuTray:e._menuTray,_editorArea:e.editorArea,_wysiwygArea:e.wysiwygFrame,_codeArea:e.code,_placeholder:e.placeholder,_resizingBar:e.resizingBar,_navigation:e.navigation,_charCounter:e.charCounter,_charWrapper:e.charWrapper,_loading:e.loading,_lineBreaker:e.lineBreaker,_lineBreaker_t:e.lineBreaker_t,_lineBreaker_b:e.lineBreaker_b,_resizeBack:e.resizeBackground,_stickyDummy:e._stickyDummy,_arrow:e._arrow}}},u={_IEisComposing:!1,_lineBreakerBind:null,_responsiveCurrentSize:"default",_responsiveButtonSize:null,_responsiveButtons:null,_directionKeyCode:new a.RegExp("^(8|13|3[2-9]|40|46)$"),_nonTextKeyCode:new a.RegExp("^(8|13|1[6-9]|20|27|3[3-9]|40|45|46|11[2-9]|12[0-3]|144|145)$"),_historyIgnoreKeyCode:new a.RegExp("^(1[6-9]|20|27|3[3-9]|40|45|11[2-9]|12[0-3]|144|145)$"),_onButtonsCheck:new a.RegExp("^(STRONG|U|EM|DEL|SUB|SUP)$"),_frontZeroWidthReg:new a.RegExp(r.zeroWidthSpace+"+",""),_keyCodeShortcut:{65:"A",66:"B",83:"S",85:"U",73:"I",89:"Y",90:"Z",219:"[",221:"]"},_shortcutCommand:function(e,t){let n=null;switch(u._keyCodeShortcut[e]){case"A":n="selectAll";break;case"B":-1===l.shortcutsDisable.indexOf("bold")&&(n="STRONG");break;case"S":t&&-1===l.shortcutsDisable.indexOf("strike")&&(n="DEL");break;case"U":-1===l.shortcutsDisable.indexOf("underline")&&(n="U");break;case"I":-1===l.shortcutsDisable.indexOf("italic")&&(n="EM");break;case"Z":-1===l.shortcutsDisable.indexOf("undo")&&(n=t?"redo":"undo");break;case"Y":-1===l.shortcutsDisable.indexOf("undo")&&(n="redo");break;case"[":-1===l.shortcutsDisable.indexOf("indent")&&(n="outdent");break;case"]":-1===l.shortcutsDisable.indexOf("indent")&&(n="indent")}return!!n&&(d.commandHandler(d.commandMap[n],n),!0)},_applyTagEffects:function(){let t=d.getSelectionNode();if(t===d.effectNode)return;d.effectNode=t;const i=d.commandMap,o=this._onButtonsCheck,s=[],a=[],c=d.activePlugins,u=c.length;let h="";for(;t.firstChild;)t=t.firstChild;for(let e=t;!r.isWysiwygDiv(e)&&e;e=e.parentNode)if(1===e.nodeType&&!r.isBreak(e)){h=e.nodeName.toUpperCase(),a.push(h);for(let t,i=0;i0)&&(s.push("OUTDENT"),i.OUTDENT.removeAttribute("disabled")),-1===s.indexOf("INDENT")&&i.INDENT&&r.isListCell(e)&&!e.previousElementSibling&&(s.push("INDENT"),i.INDENT.setAttribute("disabled",!0))):o.test(h)&&(s.push(h),r.addClass(i[h],"active"))}for(let e in i)s.indexOf(e)>-1||!r.hasOwn(i,e)||(c.indexOf(e)>-1?n[e].active.call(d,null):i.OUTDENT&&/^OUTDENT$/i.test(e)?i.OUTDENT.setAttribute("disabled",!0):i.INDENT&&/^INDENT$/i.test(e)?i.INDENT.removeAttribute("disabled"):r.removeClass(i[e],"active"));d._variable.currentNodes=a.reverse(),d._variable.currentNodesMap=s,l.showPathLabel&&(e.element.navigation.textContent=d._variable.currentNodes.join(" > "))},_cancelCaptionEdit:function(){this.setAttribute("contenteditable",!1),this.removeEventListener("blur",u._cancelCaptionEdit)},_buttonsEventHandler:function(e){let t=e.target;if(d._bindControllersOff&&e.stopPropagation(),/^(input|textarea|select|option)$/i.test(t.nodeName)?d._antiBlur=!1:e.preventDefault(),r.getParentElement(t,".se-submenu"))e.stopPropagation(),d._notHideToolbar=!0;else{let n=t.getAttribute("data-command"),i=t.className;for(;!n&&!/se-menu-list/.test(i)&&!/sun-editor-common/.test(i);)t=t.parentNode,n=t.getAttribute("data-command"),i=t.className;n!==d._submenuName&&n!==d._containerName||e.stopPropagation()}},onClick_toolbar:function(e){let t=e.target,n=t.getAttribute("data-display"),i=t.getAttribute("data-command"),l=t.className;for(;t.parentNode&&!i&&!/se-menu-list/.test(l)&&!/se-toolbar/.test(l);)t=t.parentNode,i=t.getAttribute("data-command"),n=t.getAttribute("data-display"),l=t.className;(i||n)&&(t.disabled||(d.hasFocus||d.nativeFocus(),d._variable.isCodeView||d._editorRange(),d.actionCall(i,n,t)))},onMouseDown_wysiwyg:function(t){if(r.isNonEditable(e.element.wysiwyg))return;const n=r.getParentElement(t.target,r.isCell);if(n){const e=d.plugins.table;e&&n!==e._fixedCell&&!e._shift&&d.callPlugin("table",(function(){e.onTableCellMultiSelect.call(d,n,!1)}),null)}d._isBalloon&&u._hideToolbar(),/FIGURE/i.test(t.target.nodeName)&&t.preventDefault(),"function"==typeof h.onMouseDown&&h.onMouseDown(t,d)},onClick_wysiwyg:function(t){const n=t.target;if(r.isNonEditable(e.element.wysiwyg))return;const i=d.getFileComponent(n);if(i)return t.preventDefault(),void d.selectComponent(i.target,i.pluginName);const l=r.getParentElement(n,"FIGCAPTION");if(r.isNonEditable(l)&&(t.preventDefault(),l.setAttribute("contenteditable",!0),l.focus(),d._isInline&&!d._inlineToolbarAttr.isShow)){u._showToolbarInline();const e=function(){u._hideToolbar(),l.removeEventListener("blur",e)};l.addEventListener("blur",e)}a.setTimeout(d._editorRange.bind(d)),d._editorRange();const o=d.getSelectionNode(),s=r.getFormatElement(o,null),c=r.getRangeFormatElement(o,null);if(s&&s!==c||r.isNonEditable(n)||r.isList(c))u._applyTagEffects();else{const e=d.getRange();if(r.getFormatElement(e.startContainer)===r.getFormatElement(e.endContainer)){if(r.isList(c)){const e=r.createElement("LI"),t=o.nextElementSibling;e.appendChild(o),c.insertBefore(e,t)}else r.isWysiwygDiv(o)||r.isComponent(o)||r.isTable(o)&&!r.isCell(o)||d._setDefaultFormat(r.isRangeFormatElement(c)?"DIV":"P");t.preventDefault(),d.focus()}}d._isBalloon&&a.setTimeout(u._toggleToolbarBalloon),"function"==typeof h.onClick&&h.onClick(t,d)},_balloonDelay:null,_showToolbarBalloonDelay:function(){u._balloonDelay&&a.clearTimeout(u._balloonDelay),u._balloonDelay=a.setTimeout(function(){a.clearTimeout(this._balloonDelay),this._balloonDelay=null,this._showToolbarBalloon()}.bind(u),350)},_toggleToolbarBalloon:function(){d._editorRange();const e=d.getRange();d._bindControllersOff||!d._isBalloonAlways&&e.collapsed?u._hideToolbar():u._showToolbarBalloon(e)},_showToolbarBalloon:function(t){if(!d._isBalloon)return;const n=t||d.getRange(),i=e.element.toolbar,l=d.getSelection();let o;if(d._isBalloonAlways&&n.collapsed)o=!0;else if(l.focusNode===l.anchorNode)o=l.focusOffset0&&u._getPageBottomSpace()C&&(t=!1,y=!0),y&&(b=(t?n.top-m-g:n.bottom+g)-(n.noText?0:h)+d),i.style.left=a.Math.floor(v)+"px",i.style.top=a.Math.floor(b)+"px",t?(r.removeClass(e.element._arrow,"se-arrow-up"),r.addClass(e.element._arrow,"se-arrow-down"),e.element._arrow.style.top=m+"px"):(r.removeClass(e.element._arrow,"se-arrow-down"),r.addClass(e.element._arrow,"se-arrow-up"),e.element._arrow.style.top=-g+"px");const w=a.Math.floor(p/2+(f-v));e.element._arrow.style.left=(w+g>i.offsetWidth?i.offsetWidth-g:w";const e=f.attributes;for(;e[0];)f.removeAttribute(e[0].name);return d.nativeFocus(),!1}}if(f&&g.startContainer===g.endContainer&&3===c.nodeType&&!r.isFormatElement(c.parentNode)&&(g.collapsed?1===c.textContent.length:g.endOffset-g.startOffset===c.textContent.length)){t.preventDefault();let e=null,n=c.parentNode.previousSibling;const i=c.parentNode.nextSibling;n||(i?(n=i,e=0):(n=r.createElement("BR"),f.appendChild(n))),c.textContent="",r.removeItemAllParents(c,null,f),e="number"==typeof e?e:3===n.nodeType?n.textContent.length:1,d.setRange(n,e,n,e);break}const n=g.commonAncestorContainer;if(f=r.getFormatElement(g.startContainer,null),_=r.getRangeFormatElement(f,null),_&&f&&!r.isCell(_)&&!/^FIGCAPTION$/i.test(_.nodeName)){if(r.isListCell(f)&&r.isList(_)&&(r.isListCell(_.parentNode)||f.previousElementSibling)&&(c===f||3===c.nodeType&&(!c.previousSibling||r.isList(c.previousSibling)))&&(r.getFormatElement(g.startContainer,null)!==r.getFormatElement(g.endContainer,null)?_.contains(g.startContainer):0===g.startOffset&&g.collapsed)){if(g.startContainer!==g.endContainer)t.preventDefault(),d.removeNode(),3===g.startContainer.nodeType&&d.setRange(g.startContainer,g.startContainer.textContent.length,g.startContainer,g.startContainer.textContent.length),d.history.push(!0);else{let e=f.previousElementSibling||_.parentNode;if(r.isListCell(e)){t.preventDefault();let n=e;if(!e.contains(f)&&r.isListCell(n)&&r.isList(n.lastElementChild)){for(n=n.lastElementChild.lastElementChild;r.isListCell(n)&&r.isList(n.lastElementChild);)n=n.lastElementChild&&n.lastElementChild.lastElementChild;e=n}let i=e===_.parentNode?_.previousSibling:e.lastChild;i||(i=r.createTextNode(r.zeroWidthSpace),_.parentNode.insertBefore(i,_.parentNode.firstChild));const l=3===i.nodeType?i.textContent.length:1,o=f.childNodes;let s=i,a=o[0];for(;a=o[0];)e.insertBefore(a,s.nextSibling),s=a;r.removeItem(f),0===_.children.length&&r.removeItem(_),d.setRange(i,l,i,l),d.history.push(!0)}}break}if(!p&&0===g.startOffset){let e=!0,i=n;for(;i&&i!==_&&!r.isWysiwygDiv(i);){if(i.previousSibling&&(1===i.previousSibling.nodeType||!r.onlyZeroWidthSpace(i.previousSibling.textContent.trim()))){e=!1;break}i=i.parentNode}if(e&&_.parentNode){t.preventDefault(),d.detachRangeFormatElement(_,r.isListCell(f)?[f]:null,null,!1,!1),d.history.push(!0);break}}}if(!p&&(0===g.startOffset||c===f&&f.childNodes[g.startOffset])){const e=c===f?f.childNodes[g.startOffset]:c,i=(3===n.nodeType||r.isBreak(n))&&!n.previousSibling&&0===g.startOffset;if(!e.previousSibling&&(r.isComponent(n.previousSibling)||i&&r.isComponent(f.previousSibling))){const e=d.getFileComponent(f.previousSibling);e&&(t.preventDefault(),t.stopPropagation(),0===f.textContent.length&&r.removeItem(f),d.selectComponent(e.target,e.pluginName));break}if(r.isNonEditable(e.previousSibling)){t.preventDefault(),t.stopPropagation(),r.removeItem(e.previousSibling);break}}break;case 46:if(m){t.preventDefault(),t.stopPropagation(),d.plugins[m].destroy.call(d);break}if(p&&u._hardDelete()){t.preventDefault(),t.stopPropagation();break}if((r.isFormatElement(c)||null===c.nextSibling||r.onlyZeroWidthSpace(c.nextSibling)&&null===c.nextSibling.nextSibling)&&g.startOffset===c.textContent.length){let e=f.nextElementSibling;if(!e){t.preventDefault();break}if(r.isComponent(e)){if(t.preventDefault(),r.onlyZeroWidthSpace(f)&&(r.removeItem(f),r.isTable(e))){let t=r.getChildElement(e,r.isCell,!1);t=t.firstElementChild||t,d.setRange(t,0,t,0);break}const n=d.getFileComponent(e);n&&(t.stopPropagation(),d.selectComponent(n.target,n.pluginName));break}}if(!p&&(d.isEdgePoint(g.endContainer,g.endOffset)||c===f&&f.childNodes[g.startOffset])){const e=c===f?f.childNodes[g.startOffset]:c;if(r.isNonEditable(e.nextSibling)){t.preventDefault(),t.stopPropagation(),r.removeItem(e.nextSibling);break}}if(f=r.getFormatElement(g.startContainer,null),_=r.getRangeFormatElement(f,null),r.isListCell(f)&&r.isList(_)&&(c===f||3===c.nodeType&&(!c.nextSibling||r.isList(c.nextSibling))&&(r.getFormatElement(g.startContainer,null)!==r.getFormatElement(g.endContainer,null)?_.contains(g.endContainer):g.endOffset===c.textContent.length&&g.collapsed))){g.startContainer!==g.endContainer&&d.removeNode();let e=r.getArrayItem(f.children,r.isList,!1);if(e=e||f.nextElementSibling||_.parentNode.nextElementSibling,e&&(r.isList(e)||r.getArrayItem(e.children,r.isList,!1))){let n,i;if(t.preventDefault(),r.isList(e)){const t=e.firstElementChild;for(i=t.childNodes,n=i[0];i[0];)f.insertBefore(i[0],e);r.removeItem(t)}else{for(n=e.firstChild,i=e.childNodes;i[0];)f.appendChild(i[0]);r.removeItem(e)}d.setRange(n,0,n,0),d.history.push(!0)}break}break;case 9:if(m||l.tabDisable)break;if(t.preventDefault(),o||s||r.isWysiwygDiv(c))break;const b=!g.collapsed||d.isEdgePoint(g.startContainer,g.startOffset),v=d.getSelectedElements(null);c=d.getSelectionNode();const y=[];let C=[],w=r.isListCell(v[0]),x=r.isListCell(v[v.length-1]),E={sc:g.startContainer,so:g.startOffset,ec:g.endContainer,eo:g.endOffset};for(let e,t=0,n=v.length;t0&&b&&d.plugins.list)E=d.plugins.list.editInsideList.call(d,i,y);else{const e=r.getParentElement(c,r.isCell);if(e&&b){const t=r.getParentElement(e,"table"),n=r.getListChildren(t,r.isCell);let l=i?r.prevIdx(n,e):r.nextIdx(n,e);l!==n.length||i||(l=0),-1===l&&i&&(l=n.length-1);let o=n[l];if(!o)break;o=o.firstElementChild||o,d.setRange(o,0,o,0);break}C=C.concat(y),w=x=null}if(C.length>0)if(i){const e=C.length-1;for(let t,n=0;n<=e;n++){t=C[n].childNodes;for(let e,n=0,i=t.length;n":"<"+f.nodeName+">
    ",!d.checkCharCount(e,"byte-html"))return t.preventDefault(),!1}if(!i&&S){t.preventDefault();const e=c===S,n=d.getSelection(),i=c.childNodes,l=n.focusOffset,o=c.previousElementSibling,s=c.nextSibling;if(!r.isClosureFreeFormatElement(S)&&i&&(e&&g.collapsed&&i.length-1<=l+1&&r.isBreak(i[l])&&(!i[l+1]||(!i[l+2]||r.onlyZeroWidthSpace(i[l+2].textContent))&&3===i[l+1].nodeType&&r.onlyZeroWidthSpace(i[l+1].textContent))&&l>0&&r.isBreak(i[l-1])||!e&&r.onlyZeroWidthSpace(c.textContent)&&r.isBreak(o)&&(r.isBreak(o.previousSibling)||!r.onlyZeroWidthSpace(o.previousSibling.textContent))&&(!s||!r.isBreak(s)&&r.onlyZeroWidthSpace(s.textContent)))){e?r.removeItem(i[l-1]):r.removeItem(c);const t=d.appendFormatTag(S,r.isFormatElement(S.nextElementSibling)?S.nextElementSibling:null);r.copyFormatAttributes(t,S),d.setRange(t,1,t,1);break}if(e){h.insertHTML(g.collapsed&&r.isBreak(g.startContainer.childNodes[g.startOffset-1])?"
    ":"

    ",!0,!1);let e=n.focusNode;const t=n.focusOffset;S===e&&(e=e.childNodes[t-l>1?t-1:t]),d.setRange(e,1,e,1)}else{const e=n.focusNode.nextSibling,t=r.createElement("BR");d.insertNode(t,null,!1);const i=t.previousSibling,l=t.nextSibling;r.isBreak(e)||r.isBreak(i)||l&&!r.onlyZeroWidthSpace(l)?d.setRange(l,0,l,0):(t.parentNode.insertBefore(t.cloneNode(!1),t),d.setRange(t,1,t,1))}u._onShortcutKey=!0;break}if(p)break;if(_&&f&&!r.isCell(_)&&!/^FIGCAPTION$/i.test(_.nodeName)){const e=d.getRange();if(d.isEdgePoint(e.endContainer,e.endOffset)&&r.isList(c.nextSibling)){t.preventDefault();const e=r.createElement("LI"),n=r.createElement("BR");e.appendChild(n),f.parentNode.insertBefore(e,f.nextElementSibling),e.appendChild(c.nextSibling),d.setRange(n,1,n,1);break}if((3!==e.commonAncestorContainer.nodeType||!e.commonAncestorContainer.nextElementSibling)&&r.onlyZeroWidthSpace(f.innerText.trim())){t.preventDefault();let e=null;if(r.isListCell(_.parentNode)){if(_=f.parentNode.parentNode.parentNode,e=r.splitElement(f,null,r.getElementDepth(f)-2),!e){const t=r.createElement("LI");t.innerHTML="
    ",_.insertBefore(t,e),e=t}}else{const t=r.isCell(_.parentNode)?"DIV":r.isList(_.parentNode)?"LI":r.isFormatElement(_.nextElementSibling)?_.nextElementSibling.nodeName:r.isFormatElement(_.previousElementSibling)?_.previousElementSibling.nodeName:"P";e=r.createElement(t);const n=d.detachRangeFormatElement(_,[f],null,!0,!0);n.cc.insertBefore(e,n.ec)}e.innerHTML="
    ",r.copyFormatAttributes(e,f),r.removeItemAllParents(f,null,null),d.setRange(e,1,e,1);break}}if(_&&r.getParentElement(_,"FIGCAPTION")&&r.getParentElement(_,r.isList)&&(t.preventDefault(),f=d.appendFormatTag(f,null),d.setRange(f,0,f,0)),m){t.preventDefault(),t.stopPropagation();const n=e[m],i=n._container,l=i.previousElementSibling||i.nextElementSibling;let o=null;r.isListCell(i.parentNode)?o=r.createElement("BR"):(o=r.createElement(r.isFormatElement(l)?l.nodeName:"P"),o.innerHTML="
    "),i.parentNode.insertBefore(o,i),d.callPlugin(m,(function(){d.selectComponent(n._element,m)}),null)}break;case 27:if(m)return t.preventDefault(),t.stopPropagation(),d.controllersOff(),!1}if(i&&/16/.test(n)){t.preventDefault(),t.stopPropagation();const e=d.plugins.table;if(e&&!e._shift&&!e._ref){const t=r.getParentElement(f,r.isCell);if(t)return void e.onTableCellMultiSelect.call(d,t,!0)}}if(!(o||s||p||u._nonTextKeyCode.test(n))&&g.collapsed&&g.startContainer===g.endContainer&&r.isBreak(g.commonAncestorContainer)){const e=r.createTextNode(r.zeroWidthSpace);d.insertNode(e,null,!1),d.setRange(e,1,e,1)}"function"==typeof h.onKeyDown&&h.onKeyDown(t,d)},onKeyUp_wysiwyg:function(e){if(u._onShortcutKey)return;d._editorRange();const t=d.getRange(),n=e.keyCode,i=e.ctrlKey||e.metaKey||91===n||92===n||224===n,l=e.altKey;let o=d.getSelectionNode();if(d._isBalloon&&(d._isBalloonAlways&&27!==n||!t.collapsed)){if(!d._isBalloonAlways)return void u._showToolbarBalloon();27!==n&&u._showToolbarBalloonDelay()}if(8===n&&r.isWysiwygDiv(o)&&""===o.textContent&&0===o.children.length){e.preventDefault(),e.stopPropagation(),o.innerHTML="";const t=r.createElement(r.isFormatElement(d._variable.currentNodes[0])?d._variable.currentNodes[0]:"P");return t.innerHTML="
    ",o.appendChild(t),d.setRange(t,0,t,0),u._applyTagEffects(),void d.history.push(!1)}const s=r.getFormatElement(o,null),a=r.getRangeFormatElement(o,null);(s||!t.collapsed)&&s!==a||r.isComponent(o)||r.isList(o)||(d._setDefaultFormat(r.isRangeFormatElement(a)?"DIV":"P"),o=d.getSelectionNode()),u._directionKeyCode.test(n)&&u._applyTagEffects();if(!i&&!l&&!u._nonTextKeyCode.test(n)&&3===o.nodeType&&r.zeroWidthRegExp.test(o.textContent)&&!(void 0!==e.isComposing?e.isComposing:u._IEisComposing)){let e=t.startOffset,n=t.endOffset;const i=(o.textContent.substring(0,n).match(u._frontZeroWidthReg)||"").length;e=t.startOffset-i,n=t.endOffset-i,o.textContent=o.textContent.replace(r.zeroWidthRegExp,""),d.setRange(o,e<0?0:e,o,n<0?0:n)}d._charCount(""),d.history.push(!0),"function"==typeof h.onKeyUp&&h.onKeyUp(e,d)},onScroll_wysiwyg:function(e){d.controllersOff(),d._lineBreaker.style.display="none",d._isBalloon&&u._hideToolbar(),"function"==typeof h.onScroll&&h.onScroll(e,d)},onFocus_wysiwyg:function(e){d._antiBlur||(d.hasFocus=!0,d._isInline&&u._showToolbarInline(),"function"==typeof h.onFocus&&h.onFocus(e,d))},onBlur_wysiwyg:function(t){if(d._antiBlur)return;d.hasFocus=!1,d.controllersOff(),(d._isInline||d._isBalloon)&&u._hideToolbar(),"function"==typeof h.onBlur&&h.onBlur(t,d);const i=d.commandMap,o=d.activePlugins;for(let e in i)r.hasOwn(i,e)&&(o.indexOf(e)>-1?n[e].active.call(d,null):i.OUTDENT&&/^OUTDENT$/i.test(e)?i.OUTDENT.setAttribute("disabled",!0):i.INDENT&&/^INDENT$/i.test(e)?i.INDENT.removeAttribute("disabled"):r.removeClass(i[e],"active"));d._variable.currentNodes=[],d._variable.currentNodesMap=[],l.showPathLabel&&(e.element.navigation.textContent="")},onMouseDown_resizingBar:function(t){t.stopPropagation(),d._variable.resizeClientY=t.clientY,e.element.resizeBackground.style.display="block",s.addEventListener("mousemove",u._resize_editor),s.addEventListener("mouseup",(function t(){e.element.resizeBackground.style.display="none",s.removeEventListener("mousemove",u._resize_editor),s.removeEventListener("mouseup",t)}))},_resize_editor:function(t){const n=e.element.editorArea.offsetHeight+(t.clientY-d._variable.resizeClientY);e.element.wysiwygFrame.style.height=e.element.code.style.height=(n=n+o?(d._sticky||u._onStickyToolbar(),t.toolbar.style.top=n+o+l.stickyToolbar-i-d._variable.minResizingSize+"px"):i>=o&&u._onStickyToolbar()},_getEditorOffsets:function(t){let n=t||e.element.topArea,i=0,l=0,o=0;for(;n;)i+=n.offsetTop,l+=n.offsetLeft,o+=n.scrollTop,n=n.offsetParent;return{top:i,left:l,scroll:o}},_getPageBottomSpace:function(){return s.documentElement.scrollHeight-(u._getEditorOffsets(null).top+e.element.topArea.offsetHeight)},_onStickyToolbar:function(){const t=e.element;d._isInline||l.toolbarContainer||(t._stickyDummy.style.height=t.toolbar.offsetHeight+"px",t._stickyDummy.style.display="block"),t.toolbar.style.top=l.stickyToolbar+"px",t.toolbar.style.width=d._isInline?d._inlineToolbarAttr.width:t.toolbar.offsetWidth+"px",r.addClass(t.toolbar,"se-toolbar-sticky"),d._sticky=!0},_offStickyToolbar:function(){const t=e.element;t._stickyDummy.style.display="none",t.toolbar.style.top=d._isInline?d._inlineToolbarAttr.top:"",t.toolbar.style.width=d._isInline?d._inlineToolbarAttr.width:"",t.editorArea.style.marginTop="",r.removeClass(t.toolbar,"se-toolbar-sticky"),d._sticky=!1},_codeViewAutoHeight:function(){e.element.code.style.height=e.element.code.scrollHeight+"px"},_hardDelete:function(){const e=d.getRange(),t=e.startContainer,n=e.endContainer,i=r.getRangeFormatElement(t),l=r.getRangeFormatElement(n),o=r.isCell(i),s=r.isCell(l);if((o&&!i.previousElementSibling&&!i.parentElement.previousElementSibling||s&&!l.nextElementSibling&&!l.parentElement.nextElementSibling)&&i!==l)if(o){if(s)return r.removeItem(r.getParentElement(i,r.isComponent)),d.nativeFocus(),!0;r.removeItem(r.getParentElement(i,r.isComponent))}else r.removeItem(r.getParentElement(l,r.isComponent));const a=1===t.nodeType?r.getParentElement(t,".se-component"):null,c=1===n.nodeType?r.getParentElement(n,".se-component"):null;return a&&r.removeItem(a),c&&r.removeItem(c),!1},onPaste_wysiwyg:function(e){const t=r.isIE?a.clipboardData:e.clipboardData;return!t||u._dataTransferAction("paste",e,t)},_setClipboardComponent:function(e,t,n){e.preventDefault(),e.stopPropagation(),n.setData("text/html",t.component.outerHTML)},onCopy_wysiwyg:function(e){const t=r.isIE?a.clipboardData:e.clipboardData;if("function"==typeof h.onCopy&&!h.onCopy(e,t,d))return e.preventDefault(),e.stopPropagation(),!1;const n=d.currentFileComponentInfo;n&&!r.isIE&&(u._setClipboardComponent(e,n,t),r.addClass(n.component,"se-component-copy"),a.setTimeout((function(){r.removeClass(n.component,"se-component-copy")}),150))},onCut_wysiwyg:function(e){const t=r.isIE?a.clipboardData:e.clipboardData;if("function"==typeof h.onCut&&!h.onCut(e,t,d))return e.preventDefault(),e.stopPropagation(),!1;const n=d.currentFileComponentInfo;n&&!r.isIE&&(u._setClipboardComponent(e,n,t),r.removeItem(n.component),d.controllersOff()),a.setTimeout((function(){d.history.push(!1)}))},onDrop_wysiwyg:function(e){const t=e.dataTransfer;return!t||(r.isIE?(e.preventDefault(),e.stopPropagation(),!1):(d.removeNode(),u._setDropLocationSelection(e),u._dataTransferAction("drop",e,t)))},_setDropLocationSelection:function(e){if(e.rangeParent)d.setRange(e.rangeParent,e.rangeOffset,e.rangeParent,e.rangeOffset);else if(d._wd.caretRangeFromPoint){const t=d._wd.caretRangeFromPoint(e.clientX,e.clientY);d.setRange(t.startContainer,t.startOffset,t.endContainer,t.endOffset)}else{const e=d.getRange();d.setRange(e.startContainer,e.startOffset,e.endContainer,e.endOffset)}},_dataTransferAction:function(t,n,i){let l,o;if(r.isIE){l=i.getData("Text");const s=d.getRange(),c=r.createElement("DIV"),h={sc:s.startContainer,so:s.startOffset,ec:s.endContainer,eo:s.endOffset};return c.setAttribute("contenteditable",!0),c.style.cssText="position:absolute; top:0; left:0; width:1px; height:1px; overflow:hidden;",e.element.relative.appendChild(c),c.focus(),a.setTimeout((function(){o=c.innerHTML,r.removeItem(c),d.setRange(h.sc,h.so,h.ec,h.eo),u._setClipboardData(t,n,l,o,i)})),!0}if(l=i.getData("text/plain"),o=i.getData("text/html"),!1===u._setClipboardData(t,n,l,o,i))return n.preventDefault(),n.stopPropagation(),!1},_setClipboardData:function(e,t,n,i,l){/class=["']*Mso(Normal|List)/i.test(i)||/content=["']*Word.Document/i.test(i)||/content=["']*OneNote.File/i.test(i)?(i=i.replace(/\n/g," "),n=n.replace(/\n/g," ")):n=n.replace(/\n/g,""),i=d.cleanHTML(i,d.pasteTagsWhitelistRegExp);const o=d._charCount(d._charTypeHTML?i:n);if("paste"===e&&"function"==typeof h.onPaste&&!h.onPaste(t,i,o,d))return!1;if("drop"===e&&"function"==typeof h.onDrop&&!h.onDrop(t,l,d))return!1;const s=l.files;return s.length>0?(/^image/.test(s[0].type)&&d.plugins.image&&h.insertImage(s),!1):!!o&&(i?(h.insertHTML(i,!0,!1),!1):void 0)},onMouseMove_wysiwyg:function(t){if(d.isDisabled)return;const n=r.getParentElement(t.target,r.isComponent),i=d._lineBreaker.style;if(n&&!d.currentControllerName){let o=0,s=e.element.wysiwyg;do{o+=s.scrollTop,s=s.parentElement}while(s&&!/^(BODY|HTML)$/i.test(s.nodeName));const a=e.element.wysiwyg.scrollTop,c=u._getEditorOffsets(null),h=r.getOffset(n,e.element.wysiwygFrame).top+a,g=t.pageY+o+(l.iframe&&!l.toolbarContainer?e.element.toolbar.offsetHeight:0),p=h+(l.iframe?o:c.top),m=r.isListCell(n.parentNode);let f="",_="";if((m?!n.previousSibling:!r.isFormatElement(n.previousElementSibling))&&gp+n.offsetHeight-20))return void(i.display="none");_=h+n.offsetHeight,f="b"}d._variable._lineBreakComp=n,d._variable._lineBreakDir=f,i.top=_-a+"px",d._lineBreakerButton.style.left=r.getOffset(n).left+n.offsetWidth/2-15+"px",i.display="block"}else"none"!==i.display&&(i.display="none")},_onMouseDown_lineBreak:function(e){e.preventDefault()},_onLineBreak:function(e){e.preventDefault();const t=d._variable._lineBreakComp,n=this?this:d._variable._lineBreakDir,i=r.isListCell(t.parentNode),l=r.createElement(i?"BR":r.isCell(t.parentNode)?"DIV":"P");if(i||(l.innerHTML="
    "),d._charTypeHTML&&!d.checkCharCount(l.outerHTML,"byte-html"))return;t.parentNode.insertBefore(l,"t"===n?t:t.nextSibling),d._lineBreaker.style.display="none",d._variable._lineBreakComp=null;const o=i?l:l.firstChild;d.setRange(o,1,o,1),d.history.push(!1)},_addEvent:function(){const t=l.iframe?d._ww:e.element.wysiwyg;e.element.toolbar.addEventListener("mousedown",u._buttonsEventHandler,!1),e.element._menuTray.addEventListener("mousedown",u._buttonsEventHandler,!1),e.element.toolbar.addEventListener("click",u.onClick_toolbar,!1),t.addEventListener("mousedown",u.onMouseDown_wysiwyg,!1),t.addEventListener("click",u.onClick_wysiwyg,!1),t.addEventListener(r.isIE?"textinput":"input",u.onInput_wysiwyg,!1),t.addEventListener("keydown",u.onKeyDown_wysiwyg,!1),t.addEventListener("keyup",u.onKeyUp_wysiwyg,!1),t.addEventListener("paste",u.onPaste_wysiwyg,!1),t.addEventListener("copy",u.onCopy_wysiwyg,!1),t.addEventListener("cut",u.onCut_wysiwyg,!1),t.addEventListener("drop",u.onDrop_wysiwyg,!1),t.addEventListener("scroll",u.onScroll_wysiwyg,!1),t.addEventListener("focus",u.onFocus_wysiwyg,!1),t.addEventListener("blur",u.onBlur_wysiwyg,!1),u._lineBreakerBind={a:u._onLineBreak.bind(""),t:u._onLineBreak.bind("t"),b:u._onLineBreak.bind("b")},t.addEventListener("mousemove",u.onMouseMove_wysiwyg,!1),d._lineBreakerButton.addEventListener("mousedown",u._onMouseDown_lineBreak,!1),d._lineBreakerButton.addEventListener("click",u._lineBreakerBind.a,!1),e.element.lineBreaker_t.addEventListener("mousedown",u._lineBreakerBind.t,!1),e.element.lineBreaker_b.addEventListener("mousedown",u._lineBreakerBind.b,!1),d.plugins.table&&t.addEventListener("touchstart",u.onMouseDown_wysiwyg,{passive:!0,useCapture:!1}),"auto"!==l.height||l.codeMirrorEditor||(e.element.code.addEventListener("keydown",u._codeViewAutoHeight,!1),e.element.code.addEventListener("keyup",u._codeViewAutoHeight,!1),e.element.code.addEventListener("paste",u._codeViewAutoHeight,!1)),e.element.resizingBar&&(/\d+/.test(l.height)?e.element.resizingBar.addEventListener("mousedown",u.onMouseDown_resizingBar,!1):r.addClass(e.element.resizingBar,"se-resizing-none")),u._setResponsiveToolbar(),a.removeEventListener("resize",u.onResize_window),a.removeEventListener("scroll",u.onScroll_window),a.addEventListener("resize",u.onResize_window,!1),l.stickyToolbar>-1&&a.addEventListener("scroll",u.onScroll_window,!1)},_removeEvent:function(){const t=l.iframe?d._ww:e.element.wysiwyg;e.element.toolbar.removeEventListener("mousedown",u._buttonsEventHandler),e.element._menuTray.removeEventListener("mousedown",u._buttonsEventHandler),e.element.toolbar.removeEventListener("click",u.onClick_toolbar),t.removeEventListener("mousedown",u.onMouseDown_wysiwyg),t.removeEventListener("click",u.onClick_wysiwyg),t.removeEventListener(r.isIE?"textinput":"input",u.onInput_wysiwyg),t.removeEventListener("keydown",u.onKeyDown_wysiwyg),t.removeEventListener("keyup",u.onKeyUp_wysiwyg),t.removeEventListener("paste",u.onPaste_wysiwyg),t.removeEventListener("copy",u.onCopy_wysiwyg),t.removeEventListener("cut",u.onCut_wysiwyg),t.removeEventListener("drop",u.onDrop_wysiwyg),t.removeEventListener("scroll",u.onScroll_wysiwyg),t.removeEventListener("mousemove",u.onMouseMove_wysiwyg),d._lineBreakerButton.removeEventListener("mousedown",u._onMouseDown_lineBreak),d._lineBreakerButton.removeEventListener("click",u._lineBreakerBind.a),e.element.lineBreaker_t.removeEventListener("mousedown",u._lineBreakerBind.t),e.element.lineBreaker_b.removeEventListener("mousedown",u._lineBreakerBind.b),u._lineBreakerBind=null,t.removeEventListener("touchstart",u.onMouseDown_wysiwyg,{passive:!0,useCapture:!1}),t.removeEventListener("focus",u.onFocus_wysiwyg),t.removeEventListener("blur",u.onBlur_wysiwyg),e.element.code.removeEventListener("keydown",u._codeViewAutoHeight),e.element.code.removeEventListener("keyup",u._codeViewAutoHeight),e.element.code.removeEventListener("paste",u._codeViewAutoHeight),e.element.resizingBar&&e.element.resizingBar.removeEventListener("mousedown",u.onMouseDown_resizingBar),a.removeEventListener("resize",u.onResize_window),a.removeEventListener("scroll",u.onScroll_window)},_setResponsiveToolbar:function(){if(0===o.length)return void(o=null);const e=u._responsiveButtonSize=["default"],t=u._responsiveButtons={default:o[0]};for(let n,i,l=1,s=o.length;l",e}};return void 0===t&&(e.SUNEDITOR_MODULES||Object.defineProperty(e,"SUNEDITOR_MODULES",{enumerable:!0,writable:!1,configurable:!1,value:{}}),Object.defineProperty(e.SUNEDITOR_MODULES,"component",{enumerable:!0,writable:!1,configurable:!1,value:n})),n},"object"==typeof e.exports?e.exports=i.document?l(i,!0):function(e){if(!e.document)throw new Error("SUNEDITOR_MODULES a window with a document");return l(e)}:l(i)},ee5k:function(e,t,n){"use strict";var i,l;i="undefined"!=typeof window?window:this,l=function(e,t){const n={name:"resizing",add:function(e){const t=e.icons,n=e.context;n.resizing={_resizeClientX:0,_resizeClientY:0,_resize_plugin:"",_resize_w:0,_resize_h:0,_origin_w:0,_origin_h:0,_rotateVertical:!1,_resize_direction:"",_move_path:null,_isChange:!1,alignIcons:{basic:t.align_justify,left:t.align_left,right:t.align_right,center:t.align_center}};let i=this.setController_resize.call(e);n.resizing.resizeContainer=i,n.resizing.resizeDiv=i.querySelector(".se-modal-resize"),n.resizing.resizeDot=i.querySelector(".se-resize-dot"),n.resizing.resizeDisplay=i.querySelector(".se-resize-display");let l=this.setController_button.call(e);n.resizing.resizeButton=l;let o=n.resizing.resizeHandles=n.resizing.resizeDot.querySelectorAll("span");n.resizing.resizeButtonGroup=l.querySelector("._se_resizing_btn_group"),n.resizing.rotationButtons=l.querySelectorAll("._se_resizing_btn_group ._se_rotation"),n.resizing.percentageButtons=l.querySelectorAll("._se_resizing_btn_group ._se_percentage"),n.resizing.alignMenu=l.querySelector(".se-resizing-align-list"),n.resizing.alignMenuList=n.resizing.alignMenu.querySelectorAll("button"),n.resizing.alignButton=l.querySelector("._se_resizing_align_button"),n.resizing.autoSizeButton=l.querySelector("._se_resizing_btn_group ._se_auto_size"),n.resizing.captionButton=l.querySelector("._se_resizing_caption_button"),i.addEventListener("mousedown",(function(e){e.preventDefault()})),l.addEventListener("mousedown",e.eventStop),o[0].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),o[1].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),o[2].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),o[3].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),o[4].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),o[5].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),o[6].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),o[7].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),l.addEventListener("click",this.onClick_resizeButton.bind(e)),n.element.relative.appendChild(i),n.element.relative.appendChild(l),i=null,l=null,o=null},setController_resize:function(){const e=this.util.createElement("DIV");return e.className="se-controller se-resizing-container",e.style.display="none",e.innerHTML='
    ',e},setController_button:function(){const e=this.lang,t=this.icons,n=this.util.createElement("DIV");return n.className="se-controller se-controller-resizing",n.innerHTML='
    ",n},_module_getSizeX:function(e,t,n,i){return t||(t=e._element),n||(n=e._cover),i||(i=e._container),t?/%$/.test(t.style.width)?(i&&this.util.getNumber(i.style.width,2)||100)+"%":t.style.width:""},_module_getSizeY:function(e,t,n,i){return t||(t=e._element),n||(n=e._cover),i||(i=e._container),i&&n?this.util.getNumber(n.style.paddingBottom,0)>0&&!this.context.resizing._rotateVertical?n.style.height:/%$/.test(t.style.height)&&/%$/.test(t.style.width)?(i&&this.util.getNumber(i.style.height,2)||100)+"%":t.style.height:t&&t.style.height||""},_module_setModifyInputSize:function(e,t){const n=e._onlyPercentage&&this.context.resizing._rotateVertical;e.proportion.checked=e._proportionChecked="false"!==e._element.getAttribute("data-proportion");let i=n?"":this.plugins.resizing._module_getSizeX.call(this,e);if(i===e._defaultSizeX&&(i=""),e._onlyPercentage&&(i=this.util.getNumber(i,2)),e.inputX.value=i,t.setInputSize.call(this,"x"),!e._onlyPercentage){let t=n?"":this.plugins.resizing._module_getSizeY.call(this,e);t===e._defaultSizeY&&(t=""),e._onlyPercentage&&(t=this.util.getNumber(t,2)),e.inputY.value=t}e.inputX.disabled=!!n,e.inputY.disabled=!!n,e.proportion.disabled=!!n,t.setRatio.call(this)},_module_setInputSize:function(e,t){if(e._onlyPercentage)"x"===t&&e.inputX.value>100&&(e.inputX.value=100);else if(e.proportion.checked&&e._ratio&&/\d/.test(e.inputX.value)&&/\d/.test(e.inputY.value)){const n=e.inputX.value.replace(/\d+|\./g,"")||e.sizeUnit,i=e.inputY.value.replace(/\d+|\./g,"")||e.sizeUnit;if(n!==i)return;const l="%"===n?2:0;"x"===t?e.inputY.value=this.util.getNumber(e._ratioY*this.util.getNumber(e.inputX.value,l),l)+i:e.inputX.value=this.util.getNumber(e._ratioX*this.util.getNumber(e.inputY.value,l),l)+n}},_module_setRatio:function(e){const t=e.inputX.value,n=e.inputY.value;if(e.proportion.checked&&/\d+/.test(t)&&/\d+/.test(n)){if((t.replace(/\d+|\./g,"")||e.sizeUnit)!==(n.replace(/\d+|\./g,"")||e.sizeUnit))e._ratio=!1;else if(!e._ratio){const i=this.util.getNumber(t,0),l=this.util.getNumber(n,0);e._ratio=!0,e._ratioX=i/l,e._ratioY=l/i}}else e._ratio=!1},_module_sizeRevert:function(e){e._onlyPercentage?e.inputX.value=e._origin_w>100?100:e._origin_w:(e.inputX.value=e._origin_w,e.inputY.value=e._origin_h)},_module_saveCurrentSize:function(e){const t=this.plugins.resizing._module_getSizeX.call(this,e),n=this.plugins.resizing._module_getSizeY.call(this,e);e._element.setAttribute("data-size",t+","+n),e._videoRatio&&(e._videoRatio=n)},call_controller_resize:function(e,t){const n=this.context.resizing,i=this.context[t];n._resize_plugin=t;const l=n.resizeContainer,o=n.resizeDiv,s=this.util.getOffset(e,this.context.element.wysiwygFrame),a=n._rotateVertical=/^(90|270)$/.test(Math.abs(e.getAttribute("data-rotate")).toString()),r=a?e.offsetHeight:e.offsetWidth,c=a?e.offsetWidth:e.offsetHeight,d=s.top,u=s.left-this.context.element.wysiwygFrame.scrollLeft;l.style.top=d+"px",l.style.left=u+"px",l.style.width=r+"px",l.style.height=c+"px",o.style.top="0px",o.style.left="0px",o.style.width=r+"px",o.style.height=c+"px";let h=e.getAttribute("data-align")||"basic";h="none"===h?"basic":h;const g=this.util.getParentElement(e,this.util.isComponent),p=this.util.getParentElement(e,"FIGURE"),m=this.plugins.resizing._module_getSizeX.call(this,i,e,p,g)||"auto",f=i._onlyPercentage&&"image"===t?"":", "+(this.plugins.resizing._module_getSizeY.call(this,i,e,p,g)||"auto");this.util.changeTxt(n.resizeDisplay,this.lang.dialogBox[h]+" ("+m+f+")"),n.resizeButtonGroup.style.display=i._resizing?"":"none";const _=!i._resizing||i._resizeDotHide||i._onlyPercentage?"none":"flex",b=n.resizeHandles;for(let e=0,t=b.length;e=360?0:d;s.setAttribute("data-rotate",u),c._rotateVertical=/^(90|270)$/.test(this._w.Math.abs(u).toString()),this.plugins.resizing.setTransformSize.call(this,s,null,null),this.selectComponent(s,l);break;case"onalign":return void this.plugins.resizing.openAlignMenu.call(this);case"align":const h="basic"===i?"none":i;a.setAlign.call(this,h,null,null,null),this.selectComponent(s,l);break;case"caption":const g=!o._captionChecked;if(a.openModify.call(this,!0),o._captionChecked=o.captionCheckEl.checked=g,a.update_image.call(this,!1,!1,!1),g){const e=this.util.getChildElement(o._caption,(function(e){return 3===e.nodeType}));e?this.setRange(e,0,e,e.textContent.length):o._caption.focus(),this.controllersOff()}else this.selectComponent(s,l),a.openModify.call(this,!0);break;case"revert":a.setOriginSize.call(this),this.selectComponent(s,l);break;case"update":a.openModify.call(this),this.controllersOff();break;case"delete":a.destroy.call(this)}this.history.push(!1)}},resetTransform:function(e){const t=(e.getAttribute("data-size")||e.getAttribute("data-origin")||"").split(",");this.context.resizing._rotateVertical=!1,e.style.maxWidth="",e.style.transform="",e.style.transformOrigin="",e.setAttribute("data-rotate",""),e.setAttribute("data-rotateX",""),e.setAttribute("data-rotateY",""),this.plugins[this.context.resizing._resize_plugin].setSize.call(this,t[0]?t[0]:"auto",t[1]?t[1]:"",!0)},setTransformSize:function(e,t,n){let i=e.getAttribute("data-percentage");const l=this.context.resizing._rotateVertical,o=1*e.getAttribute("data-rotate");let s="";if(i&&!l)i=i.split(","),"auto"===i[0]&&"auto"===i[1]?this.plugins[this.context.resizing._resize_plugin].setAutoSize.call(this):this.plugins[this.context.resizing._resize_plugin].setPercentSize.call(this,i[0],i[1]);else{const i=this.util.getParentElement(e,"FIGURE"),a=t||e.offsetWidth,r=n||e.offsetHeight,c=(l?r:a)+"px",d=(l?a:r)+"px";if(this.plugins[this.context.resizing._resize_plugin].cancelPercentAttr.call(this),this.plugins[this.context.resizing._resize_plugin].setSize.call(this,a+"px",r+"px",!0),i.style.width=c,i.style.height=this.context[this.context.resizing._resize_plugin]._caption?"":d,l){let e=a/2+"px "+a/2+"px 0",t=r/2+"px "+r/2+"px 0";s=90===o||-270===o?t:e}}e.style.transformOrigin=s,this.plugins.resizing._setTransForm(e,o.toString(),e.getAttribute("data-rotateX")||"",e.getAttribute("data-rotateY")||""),e.style.maxWidth=l?"none":"",this.plugins.resizing.setCaptionPosition.call(this,e)},_setTransForm:function(e,t,n,i){let l=(e.offsetWidth-e.offsetHeight)*(/-/.test(t)?1:-1),o="";if(/[1-9]/.test(t)&&(n||i))switch(o=n?"Y":"X",t){case"90":o=n&&i?"X":i?o:"";break;case"270":l*=-1,o=n&&i?"Y":n?o:"";break;case"-90":o=n&&i?"Y":n?o:"";break;case"-270":l*=-1,o=n&&i?"X":i?o:"";break;default:o=""}t%180==0&&(e.style.maxWidth=""),e.style.transform="rotate("+t+"deg)"+(n?" rotateX("+n+"deg)":"")+(i?" rotateY("+i+"deg)":"")+(o?" translate"+o+"("+l+"px)":"")},setCaptionPosition:function(e){const t=this.util.getChildElement(this.util.getParentElement(e,"FIGURE"),"FIGCAPTION");t&&(t.style.marginTop=(this.context.resizing._rotateVertical?e.offsetWidth-e.offsetHeight:0)+"px")},onMouseDown_resize_handle:function(e){e.stopPropagation(),e.preventDefault();const t=this.context.resizing,n=t._resize_direction=e.target.classList[0];t._resizeClientX=e.clientX,t._resizeClientY=e.clientY,this.context.element.resizeBackground.style.display="block",t.resizeButton.style.display="none",t.resizeDiv.style.float=/l/.test(n)?"right":/r/.test(n)?"left":"none";const i=function(e){if("keydown"===e.type&&27!==e.keyCode)return;const o=t._isChange;t._isChange=!1,this.removeDocEvent("mousemove",l),this.removeDocEvent("mouseup",i),this.removeDocEvent("keydown",i),"keydown"===e.type?(this.controllersOff(),this.context.element.resizeBackground.style.display="none",this.plugins[this.context.resizing._resize_plugin].init.call(this)):(this.plugins.resizing.cancel_controller_resize.call(this,n),o&&this.history.push(!1))}.bind(this),l=this.plugins.resizing.resizing_element.bind(this,t,n,this.context[t._resize_plugin]);this.addDocEvent("mousemove",l),this.addDocEvent("mouseup",i),this.addDocEvent("keydown",i)},resizing_element:function(e,t,n,i){const l=i.clientX,o=i.clientY;let s=n._element_w,a=n._element_h;const r=n._element_w+(/r/.test(t)?l-e._resizeClientX:e._resizeClientX-l),c=n._element_h+(/b/.test(t)?o-e._resizeClientY:e._resizeClientY-o),d=n._element_h/n._element_w*r;/t/.test(t)&&(e.resizeDiv.style.top=n._element_h-(/h/.test(t)?c:d)+"px"),/l/.test(t)&&(e.resizeDiv.style.left=n._element_w-r+"px"),/r|l/.test(t)&&(e.resizeDiv.style.width=r+"px",s=r),/^(t|b)[^h]$/.test(t)?(e.resizeDiv.style.height=d+"px",a=d):/^(t|b)h$/.test(t)&&(e.resizeDiv.style.height=c+"px",a=c),e._resize_w=s,e._resize_h=a,this.util.changeTxt(e.resizeDisplay,this._w.Math.round(s)+" x "+this._w.Math.round(a)),e._isChange=!0},cancel_controller_resize:function(e){const t=this.context.resizing._rotateVertical;this.controllersOff(),this.context.element.resizeBackground.style.display="none";let n=this._w.Math.round(t?this.context.resizing._resize_h:this.context.resizing._resize_w),i=this._w.Math.round(t?this.context.resizing._resize_w:this.context.resizing._resize_h);if(!t&&!/%$/.test(n)){const e=16,t=this.context.element.wysiwygFrame.clientWidth-2*e-2;this.util.getNumber(n,0)>t&&(i=this._w.Math.round(i/n*t),n=t)}const l=this.context.resizing._resize_plugin;this.plugins[l].setSize.call(this,n,i,!1,e),this.selectComponent(this.context[l]._element,l)}};return void 0===t&&(e.SUNEDITOR_MODULES||Object.defineProperty(e,"SUNEDITOR_MODULES",{enumerable:!0,writable:!1,configurable:!1,value:{}}),Object.defineProperty(e.SUNEDITOR_MODULES,"resizing",{enumerable:!0,writable:!1,configurable:!1,value:n})),n},"object"==typeof e.exports?e.exports=i.document?l(i,!0):function(e){if(!e.document)throw new Error("SUNEDITOR_MODULES a window with a document");return l(e)}:l(i)},"gjS+":function(e,t,n){"use strict";var i,l;i="undefined"!=typeof window?window:this,l=function(e,t){const n={name:"fileManager",_xmlHttp:null,upload:function(e,t,n,i,l){this.showLoading();const o=this.plugins.fileManager,s=o._xmlHttp=this.util.getXMLHttpRequest();if(s.onreadystatechange=o._callBackUpload.bind(this,s,i,l),s.open("post",e,!0),null!==t&&"object"==typeof t&&this._w.Object.keys(t).length>0)for(let e in t)s.setRequestHeader(e,t[e]);s.send(n)},_callBackUpload:function(e,t,n){if(4===e.readyState)if(200===e.status)try{t(e)}catch(e){throw Error('[SUNEDITOR.fileManager.upload.callBack.fail] cause : "'+e.message+'"')}finally{this.closeLoading()}else{this.closeLoading();const t=e.responseText?JSON.parse(e.responseText):e;if("function"!=typeof n||n("",t,this)){const n="[SUNEDITOR.fileManager.upload.serverException] status: "+e.status+", response: "+(t.errorMessage||e.responseText);throw this.functions.noticeOpen(n),Error(n)}}},checkInfo:function(e,t,n,i,l){let o=[];for(let e=0,n=t.length;e-1||(a.splice(t,1),"function"==typeof n&&n(null,e,"delete",null,0,this),t--);l&&(this.context.resizing._resize_plugin=c)},setInfo:function(e,t,n,i,l){const o=l?this.context.resizing._resize_plugin:"";l&&(this.context.resizing._resize_plugin=e);const s=this.plugins[e],a=this.context[e],r=a._infoList;let c=t.getAttribute("data-index"),d=null,u="";if(i||(i={name:t.getAttribute("data-file-name")||("string"==typeof t.src?t.src.split("/").pop():""),size:t.getAttribute("data-file-size")||0}),!c||this._componentsInfoInit)u="create",c=a._infoIndex++,t.setAttribute("data-index",c),t.setAttribute("data-file-name",i.name),t.setAttribute("data-file-size",i.size),d={src:t.src,index:1*c,name:i.name,size:i.size},r.push(d);else{u="update",c*=1;for(let e=0,t=r.length;e=0){const i=this.context[e]._infoList;for(let e=0,l=i.length;e
    '},_onMouseDown_browser:function(e){/se-file-browser-inner/.test(e.target.className)?this.context.fileBrowser._closeSignal=!0:this.context.fileBrowser._closeSignal=!1},_onClick_browser:function(e){e.stopPropagation(),(/close/.test(e.target.getAttribute("data-command"))||this.context.fileBrowser._closeSignal)&&this.plugins.fileBrowser.close.call(this)},open:function(e,t){this.plugins.fileBrowser._bindClose&&(this._d.removeEventListener("keydown",this.plugins.fileBrowser._bindClose),this.plugins.fileBrowser._bindClose=null),this.plugins.fileBrowser._bindClose=function(e){/27/.test(e.keyCode)&&this.plugins.fileBrowser.close.call(this)}.bind(this),this._d.addEventListener("keydown",this.plugins.fileBrowser._bindClose);const n=this.context.fileBrowser;n.contextPlugin=e,n.selectorHandler=t;const i=this.context[e],l=i.listClass;this.util.hasClass(n.list,l)||(n.list.className="se-file-browser-list "+l),"full"===this.context.option.popupDisplay?n.area.style.position="fixed":n.area.style.position="absolute",n.titleArea.textContent=i.title,n.area.style.display="block",this.plugins.fileBrowser._drawFileList.call(this,this.context[e].url)},_bindClose:null,close:function(){const e=this.plugins.fileBrowser;e._xmlHttp&&e._xmlHttp.abort(),e._bindClose&&(this._d.removeEventListener("keydown",e._bindClose),e._bindClose=null);const t=this.context.fileBrowser;t.area.style.display="none",t.selectorHandler=null,t.selectedTags=[],t.items=[],t.list.innerHTML=t.tagArea.innerHTML=t.titleArea.textContent="","function"==typeof this.plugins[t.contextPlugin].init&&this.plugins[t.contextPlugin].init.call(this),t.contextPlugin=""},showBrowserLoading:function(){this._loading.style.display="block"},closeBrowserLoading:function(){this._loading.style.display="none"},_drawFileList:function(e){const t=this.plugins.fileBrowser,n=t._xmlHttp=this.util.getXMLHttpRequest();n.onreadystatechange=t._callBackGet.bind(this,n),n.open("get",e,!0),n.send(null),this.plugins.fileBrowser.showBrowserLoading()},_callBackGet:function(e){if(4===e.readyState)if(this.plugins.fileBrowser._xmlHttp=null,200===e.status)try{this.plugins.fileBrowser._drawListItem.call(this,JSON.parse(e.responseText).result,!0)}catch(e){throw Error('[SUNEDITOR.fileBrowser.drawList.fail] cause : "'+e.message+'"')}finally{this.plugins.fileBrowser.closeBrowserLoading(),this.context.fileBrowser.body.style.maxHeight=this._w.innerHeight-this.context.fileBrowser.header.offsetHeight-50+"px"}else if(this.plugins.fileBrowser.closeBrowserLoading(),0!==e.status){const t=e.responseText?JSON.parse(e.responseText):e,n="[SUNEDITOR.fileBrowser.get.serverException] status: "+e.status+", response: "+(t.errorMessage||e.responseText);throw Error(n)}},_drawListItem:function(e,t){const n=this.context.fileBrowser,i=this.context[n.contextPlugin],l=[],o=e.length,s=i.columnSize||n.columnSize,a=s<=1?1:Math.round(o/s)||1,r=i.itemTemplateHandler;let c="",d='
    ',u=1;for(let n,i,h=0;h
    '),t&&i.length>0)for(let e,t=0,n=i.length;t'+e+"");d+="
    ",n.list.innerHTML=d,t&&(n.items=e,n.tagArea.innerHTML=c,n.tagElements=n.tagArea.querySelectorAll("A"))},onClickTag:function(e){const t=e.target;if(!this.util.isAnchor(t))return;const n=t.textContent,i=this.plugins.fileBrowser,l=this.context.fileBrowser,o=l.tagArea.querySelector('a[title="'+n+'"]'),s=l.selectedTags,a=s.indexOf(n);a>-1?(s.splice(a,1),this.util.removeClass(o,"on")):(s.push(n),this.util.addClass(o,"on")),i._drawListItem.call(this,0===s.length?l.items:l.items.filter((function(e){return e.tag.some((function(e){return s.indexOf(e)>-1}))})),!1)},onClickFile:function(e){e.preventDefault(),e.stopPropagation();const t=this.context.fileBrowser,n=t.list;let i=e.target,l=null;if(i===n)return;for(;n!==i.parentNode&&(l=i.getAttribute("data-command"),!l);)i=i.parentNode;if(!l)return;const o=t.selectorHandler||this.context[t.contextPlugin].selectorHandler;this.plugins.fileBrowser.close.call(this),o(i)}};return void 0===t&&(e.SUNEDITOR_MODULES||Object.defineProperty(e,"SUNEDITOR_MODULES",{enumerable:!0,writable:!1,configurable:!1,value:{}}),Object.defineProperty(e.SUNEDITOR_MODULES,"fileBrowser",{enumerable:!0,writable:!1,configurable:!1,value:n})),n},"object"==typeof e.exports?e.exports=i.document?l(i,!0):function(e){if(!e.document)throw new Error("SUNEDITOR_MODULES a window with a document");return l(e)}:l(i)},P6u4:function(e,t,n){"use strict";var i,l;i="undefined"!=typeof window?window:this,l=function(e,t){const n={code:"en",toolbar:{default:"Default",save:"Save",font:"Font",formats:"Formats",fontSize:"Size",bold:"Bold",underline:"Underline",italic:"Italic",strike:"Strike",subscript:"Subscript",superscript:"Superscript",removeFormat:"Remove Format",fontColor:"Font Color",hiliteColor:"Highlight Color",indent:"Indent",outdent:"Outdent",align:"Align",alignLeft:"Align left",alignRight:"Align right",alignCenter:"Align center",alignJustify:"Align justify",list:"List",orderList:"Ordered list",unorderList:"Unordered list",horizontalRule:"Horizontal line",hr_solid:"Solid",hr_dotted:"Dotted",hr_dashed:"Dashed",table:"Table",link:"Link",math:"Math",image:"Image",video:"Video",audio:"Audio",fullScreen:"Full screen",showBlocks:"Show blocks",codeView:"Code view",undo:"Undo",redo:"Redo",preview:"Preview",print:"print",tag_p:"Paragraph",tag_div:"Normal (DIV)",tag_h:"Header",tag_blockquote:"Quote",tag_pre:"Code",template:"Template",lineHeight:"Line height",paragraphStyle:"Paragraph style",textStyle:"Text style",imageGallery:"Image gallery",mention:"Mention"},dialogBox:{linkBox:{title:"Insert Link",url:"URL to link",text:"Text to display",newWindowCheck:"Open in new window"},mathBox:{title:"Math",inputLabel:"Mathematical Notation",fontSizeLabel:"Font Size",previewLabel:"Preview"},imageBox:{title:"Insert image",file:"Select from files",url:"Image URL",altText:"Alternative text"},videoBox:{title:"Insert Video",file:"Select from files",url:"Media embed URL, YouTube/Vimeo"},audioBox:{title:"Insert Audio",file:"Select from files",url:"Audio URL"},browser:{tags:"Tags",search:"Search"},caption:"Insert description",close:"Close",submitButton:"Submit",revertButton:"Revert",proportion:"Constrain proportions",basic:"Basic",left:"Left",right:"Right",center:"Center",width:"Width",height:"Height",size:"Size",ratio:"Ratio"},controller:{edit:"Edit",unlink:"Unlink",remove:"Remove",insertRowAbove:"Insert row above",insertRowBelow:"Insert row below",deleteRow:"Delete row",insertColumnBefore:"Insert column before",insertColumnAfter:"Insert column after",deleteColumn:"Delete column",fixedColumnWidth:"Fixed column width",resize100:"Resize 100%",resize75:"Resize 75%",resize50:"Resize 50%",resize25:"Resize 25%",autoSize:"Auto size",mirrorHorizontal:"Mirror, Horizontal",mirrorVertical:"Mirror, Vertical",rotateLeft:"Rotate left",rotateRight:"Rotate right",maxSize:"Max size",minSize:"Min size",tableHeader:"Table header",mergeCells:"Merge cells",splitCells:"Split Cells",HorizontalSplit:"Horizontal split",VerticalSplit:"Vertical split"},menu:{spaced:"Spaced",bordered:"Bordered",neon:"Neon",translucent:"Translucent",shadow:"Shadow",code:"Code"}};return void 0===t&&(e.SUNEDITOR_LANG||Object.defineProperty(e,"SUNEDITOR_LANG",{enumerable:!0,writable:!1,configurable:!1,value:{}}),Object.defineProperty(e.SUNEDITOR_LANG,"en",{enumerable:!0,writable:!0,configurable:!0,value:n})),n},"object"==typeof e.exports?e.exports=i.document?l(i,!0):function(e){if(!e.document)throw new Error("SUNEDITOR_LANG a window with a document");return l(e)}:l(i)},WUQj:function(e,t,n){},XJR1:function(e,t,n){"use strict";n.r(t);n("3FqI"),n("WUQj");var i={name:"colorPicker",add:function(e){const t=e.context;t.colorPicker={colorListHTML:"",_colorInput:"",_defaultColor:"#000",_styleProperty:"color",_currentColor:"",_colorList:[]};let n=this.createColorList(e,this._makeColorList);t.colorPicker.colorListHTML=n,n=null},createColorList:function(e,t){const n=e.context.option,i=e.lang,l=n.colorList&&0!==n.colorList.length?n.colorList:["#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"];let o=[],s='
    ';for(let e,n=0,i=l.length;n0&&(s+='
    '+t(o)+"
    ",o=[]),"object"==typeof e&&(s+='
    '+t(e)+"
    ")));return s+='
    ",s},_makeColorList:function(e){let t="";t+='
      ';for(let n,i=0,l=e.length;i');return t+="
    ",t},init:function(e,t){const n=this.plugins.colorPicker;let i=t||(n.getColorInNode.call(this,e)||this.context.colorPicker._defaultColor);i=n.isHexColor(i)?i:n.rgb2hex(i)||i;const l=this.context.colorPicker._colorList;if(l)for(let e=0,t=l.length;e=3&&"#"+((1<<24)+(n[0]<<16)+(n[1]<<8)+n[2]).toString(16).substr(1)}},l={name:"fontColor",display:"submenu",add:function(e,t){e.addModule([i]);const n=e.context;n.fontColor={previewEl:null,colorInput:null,colorList:null};let l=this.setSubmenu.call(e);n.fontColor.colorInput=l.querySelector("._se_color_picker_input"),n.fontColor.colorInput.addEventListener("keyup",this.onChangeInput.bind(e)),l.querySelector("._se_color_picker_submit").addEventListener("click",this.submit.bind(e)),l.querySelector("._se_color_picker_remove").addEventListener("click",this.remove.bind(e)),l.addEventListener("click",this.pickup.bind(e)),n.fontColor.colorList=l.querySelectorAll("li button"),e.initMenuTarget(this.name,t,l),l=null},setSubmenu:function(){const e=this.context.colorPicker.colorListHTML,t=this.util.createElement("DIV");return t.className="se-submenu se-list-layer",t.innerHTML=e,t},on:function(){const e=this.context.colorPicker,t=this.context.fontColor;e._colorInput=t.colorInput,e._defaultColor="#333333",e._styleProperty="color",e._colorList=t.colorList,this.plugins.colorPicker.init.call(this,this.getSelectionNode(),null)},onChangeInput:function(e){this.plugins.colorPicker.setCurrentColor.call(this,e.target.value)},submit:function(){this.plugins.fontColor.applyColor.call(this,this.context.colorPicker._currentColor)},pickup:function(e){e.preventDefault(),e.stopPropagation(),this.plugins.fontColor.applyColor.call(this,e.target.getAttribute("data-value"))},remove:function(){this.nodeChange(null,["color"],["span"],!0),this.submenuOff()},applyColor:function(e){if(!e)return;const t=this.util.createElement("SPAN");t.style.color=e,this.nodeChange(t,["color"],null,null),this.submenuOff()}},o={name:"hiliteColor",display:"submenu",add:function(e,t){e.addModule([i]);const n=e.context;n.hiliteColor={previewEl:null,colorInput:null,colorList:null};let l=this.setSubmenu.call(e);n.hiliteColor.colorInput=l.querySelector("._se_color_picker_input"),n.hiliteColor.colorInput.addEventListener("keyup",this.onChangeInput.bind(e)),l.querySelector("._se_color_picker_submit").addEventListener("click",this.submit.bind(e)),l.querySelector("._se_color_picker_remove").addEventListener("click",this.remove.bind(e)),l.addEventListener("click",this.pickup.bind(e)),n.hiliteColor.colorList=l.querySelectorAll("li button"),e.initMenuTarget(this.name,t,l),l=null},setSubmenu:function(){const e=this.context.colorPicker.colorListHTML,t=this.util.createElement("DIV");return t.className="se-submenu se-list-layer",t.innerHTML=e,t},on:function(){const e=this.context.colorPicker,t=this.context.hiliteColor;e._colorInput=t.colorInput,e._defaultColor="#FFFFFF",e._styleProperty="backgroundColor",e._colorList=t.colorList,this.plugins.colorPicker.init.call(this,this.getSelectionNode(),null)},onChangeInput:function(e){this.plugins.colorPicker.setCurrentColor.call(this,e.target.value)},submit:function(){this.plugins.hiliteColor.applyColor.call(this,this.context.colorPicker._currentColor)},pickup:function(e){e.preventDefault(),e.stopPropagation(),this.plugins.hiliteColor.applyColor.call(this,e.target.getAttribute("data-value"))},remove:function(){this.nodeChange(null,["background-color"],["span"],!0),this.submenuOff()},applyColor:function(e){if(!e)return;const t=this.util.createElement("SPAN");t.style.backgroundColor=e,this.nodeChange(t,["background-color"],null,null),this.submenuOff()}},s={name:"template",display:"submenu",add:function(e,t){e.context.template={};let n=this.setSubmenu.call(e);n.querySelector("ul").addEventListener("click",this.pickup.bind(e)),e.initMenuTarget(this.name,t,n),n=null},setSubmenu:function(){const e=this.context.option.templates;if(!e||0===e.length)throw Error('[SUNEDITOR.plugins.template.fail] To use the "template" plugin, please define the "templates" option.');const t=this.util.createElement("DIV");t.className="se-list-layer";let n='
      ';for(let t,i=0,l=e.length;i";return n+="
    ",t.innerHTML=n,t},pickup:function(e){if(!/^BUTTON$/i.test(e.target.tagName))return!1;e.preventDefault(),e.stopPropagation();const t=this.context.option.templates[e.target.getAttribute("data-value")];if(!t.html)throw this.submenuOff(),Error('[SUNEDITOR.template.fail] cause : "templates[i].html not found"');this.setContents(t.html),this.submenuOff()}},a=n("1kvd"),r=n.n(a),c={name:"link",display:"dialog",add:function(e){e.addModule([r.a]);const t=e.context;t.link={focusElement:null,linkNewWindowCheck:null,linkAnchorText:null,_linkAnchor:null,_linkValue:""};let n=this.setDialog.call(e);t.link.modal=n,t.link.focusElement=n.querySelector("._se_link_url"),t.link.linkAnchorText=n.querySelector("._se_link_text"),t.link.linkNewWindowCheck=n.querySelector("._se_link_check"),t.link.preview=n.querySelector(".se-link-preview");let i=this.setController_LinkButton.call(e);t.link.linkController=i,t.link._linkAnchor=null,i.addEventListener("mousedown",e.eventStop),n.querySelector(".se-btn-primary").addEventListener("click",this.submit.bind(e)),i.addEventListener("click",this.onClick_linkController.bind(e)),t.link.focusElement.addEventListener("input",this._onLinkPreview.bind(t.link.preview,t.link,t.options.linkProtocol)),t.dialog.modal.appendChild(n),t.element.relative.appendChild(i),n=null,i=null},setDialog:function(){const e=this.lang,t=this.util.createElement("DIV");return t.className="se-dialog-content",t.style.display="none",t.innerHTML='",t},setController_LinkButton:function(){const e=this.lang,t=this.icons,n=this.util.createElement("DIV");return n.className="se-controller se-controller-link",n.innerHTML='
    ",n},open:function(){this.plugins.dialog.open.call(this,"link","link"===this.currentControllerName)},_onLinkPreview:function(e,t,n){const i=n.target.value.trim();e._linkValue=this.textContent=i?t&&-1===i.indexOf("://")&&0!==i.indexOf("#")?t+i:-1===i.indexOf("://")?"/"+i:i:""},submit:function(e){this.showLoading(),e.preventDefault(),e.stopPropagation();const t=function(){const e=this.context.link;if(0===e._linkValue.length)return!1;const t=e._linkValue,n=e.linkAnchorText,i=0===n.value.length?t:n.value;if(this.context.dialog.updateModal){e._linkAnchor.href=t,e._linkAnchor.textContent=i,e._linkAnchor.target=e.linkNewWindowCheck.checked?"_blank":"";const n=e._linkAnchor.childNodes[0];this.setRange(n,0,n,n.textContent.length)}else{const n=this.util.createElement("A");n.href=t,n.textContent=i,n.target=e.linkNewWindowCheck.checked?"_blank":"";const l=this.getSelectedElements();if(l.length>1){const e=this.util.createElement(l[0].nodeName);if(e.appendChild(n),!this.insertNode(e,null,!0))return}else if(!this.insertNode(n,null,!0))return;this.setRange(n.childNodes[0],0,n.childNodes[0],n.textContent.length)}e._linkValue=e.preview.textContent=e.focusElement.value=e.linkAnchorText.value=""}.bind(this);try{t()}finally{this.plugins.dialog.close.call(this),this.closeLoading(),this.history.push(!1)}return!1},active:function(e){if(e){if(this.util.isAnchor(e)&&null===e.getAttribute("data-image-link"))return this.controllerArray.indexOf(this.context.link.linkController)<0&&this.plugins.link.call_controller.call(this,e),!0}else this.controllerArray.indexOf(this.context.link.linkController)>-1&&this.controllersOff();return!1},on:function(e){const t=this.context.link;e?t._linkAnchor&&(this.context.dialog.updateModal=!0,t._linkValue=t.preview.textContent=t.focusElement.value=t._linkAnchor.href,t.linkAnchorText.value=t._linkAnchor.textContent,t.linkNewWindowCheck.checked=!!/_blank/i.test(t._linkAnchor.target)):(this.plugins.link.init.call(this),t.linkAnchorText.value=this.getSelection().toString())},call_controller:function(e){this.editLink=this.context.link._linkAnchor=e;const t=this.context.link.linkController,n=t.querySelector("a");n.href=e.href,n.title=e.textContent,n.textContent=e.textContent,this.setControllerPosition(t,e,"bottom",{left:0,top:0}),this.controllersOn(t,e,"link")},onClick_linkController:function(e){e.stopPropagation();const t=e.target.getAttribute("data-command")||e.target.parentNode.getAttribute("data-command");if(t){if(e.preventDefault(),/update/.test(t)){const e=this.context.link;e._linkValue=e.preview.textContent=e.focusElement.value=e._linkAnchor.href,e.linkAnchorText.value=e._linkAnchor.textContent,e.linkNewWindowCheck.checked=!!/_blank/i.test(e._linkAnchor.target),this.plugins.dialog.open.call(this,"link",!0)}else if(/unlink/.test(t)){const e=this.util.getChildElement(this.context.link._linkAnchor,(function(e){return 0===e.childNodes.length||3===e.nodeType}),!1),t=this.util.getChildElement(this.context.link._linkAnchor,(function(e){return 0===e.childNodes.length||3===e.nodeType}),!0);this.setRange(e,0,t,t.textContent.length),this.nodeChange(null,null,["A"],!1)}else this.util.removeItem(this.context.link._linkAnchor),this.context.link._linkAnchor=null,this.focus(),this.history.push(!1);this.controllersOff()}},init:function(){const e=this.context.link;e.linkController.style.display="none",e._linkAnchor=null,e._linkValue=e.preview.textContent=e.focusElement.value="",e.linkAnchorText.value="",e.linkNewWindowCheck.checked=!1}},d=n("ZED3"),u=n.n(d),h=n("ee5k"),g=n.n(h),p=n("gjS+"),m=n.n(p),f={name:"image",display:"dialog",add:function(e){e.addModule([r.a,u.a,g.a,m.a]);const t=e.context,n=t.image={_infoList:[],_infoIndex:0,_uploadFileLength:0,sizeUnit:t.option._imageSizeUnit,_altText:"",_linkElement:null,_align:"none",_floatClassRegExp:"__se__float\\-[a-z]+",_v_link:{_linkValue:""},_v_src:{_linkValue:""},svgDefaultSize:"30%",_element:null,_cover:null,_container:null,inputX:null,inputY:null,_element_w:1,_element_h:1,_element_l:0,_element_t:0,_defaultSizeX:"auto",_defaultSizeY:"auto",_origin_w:"auto"===t.option.imageWidth?"":t.option.imageWidth,_origin_h:"auto"===t.option.imageHeight?"":t.option.imageHeight,_proportionChecked:!0,_resizing:t.option.imageResizing,_resizeDotHide:!t.option.imageHeightShow,_rotation:t.option.imageRotation,_onlyPercentage:t.option.imageSizeOnlyPercentage,_ratio:!1,_ratioX:1,_ratioY:1,_captionShow:!0,_captionChecked:!1,_caption:null,captionCheckEl:null};let i=this.setDialog.call(e);n.modal=i,n.imgInputFile=i.querySelector("._se_image_file"),n.imgUrlFile=i.querySelector("._se_image_url"),n.focusElement=n.imgInputFile||n.imgUrlFile,n.altText=i.querySelector("._se_image_alt"),n.imgLink=i.querySelector("._se_image_link"),n.imgLinkNewWindowCheck=i.querySelector("._se_image_link_check"),n.captionCheckEl=i.querySelector("._se_image_check_caption"),n.previewLink=i.querySelector("._se_tab_content_url .se-link-preview"),n.previewSrc=i.querySelector("._se_tab_content_image .se-link-preview"),i.querySelector(".se-dialog-tabs").addEventListener("click",this.openTab.bind(e)),i.querySelector(".se-btn-primary").addEventListener("click",this.submit.bind(e)),n.imgInputFile&&i.querySelector(".se-file-remove").addEventListener("click",this._removeSelectedFiles.bind(n.imgInputFile,n.imgUrlFile,n.previewSrc)),n.imgInputFile&&n.imgUrlFile&&n.imgInputFile.addEventListener("change",this._fileInputChange.bind(n)),n.imgLink.addEventListener("input",this._onLinkPreview.bind(n.previewLink,n._v_link,t.options.linkProtocol)),n.imgUrlFile&&n.imgUrlFile.addEventListener("input",this._onLinkPreview.bind(n.previewSrc,n._v_src,t.options.linkProtocol));const l=i.querySelector(".__se__gallery");l&&l.addEventListener("click",this._openGallery.bind(e)),n.proportion={},n.inputX={},n.inputY={},t.option.imageResizing&&(n.proportion=i.querySelector("._se_image_check_proportion"),n.inputX=i.querySelector("._se_image_size_x"),n.inputY=i.querySelector("._se_image_size_y"),n.inputX.value=t.option.imageWidth,n.inputY.value=t.option.imageHeight,n.inputX.addEventListener("keyup",this.setInputSize.bind(e,"x")),n.inputY.addEventListener("keyup",this.setInputSize.bind(e,"y")),n.inputX.addEventListener("change",this.setRatio.bind(e)),n.inputY.addEventListener("change",this.setRatio.bind(e)),n.proportion.addEventListener("change",this.setRatio.bind(e)),i.querySelector(".se-dialog-btn-revert").addEventListener("click",this.sizeRevert.bind(e))),t.dialog.modal.appendChild(i),i=null},setDialog:function(){const e=this.context.option,t=this.lang,n=this.util.createElement("DIV");n.className="se-dialog-content",n.style.display="none";let i='
    '+t.dialogBox.imageBox.title+'
    ';if(e.imageFileInput&&(i+='
    "),e.imageUrlInput&&(i+='
    '+(e.imageGalleryUrl&&this.plugins.imageGallery?'":"")+'
    '),i+='
    ',e.imageResizing){const n=e.imageSizeOnlyPercentage,l=n?' style="display: none !important;"':"",o=e.imageHeightShow?"":' style="display: none !important;"';i+='
    ',n||!e.imageHeightShow?i+='
    ":i+='
    ",i+=' '+t.dialogBox.proportion+'
    "}return i+='
    ",n.innerHTML=i,n},_fileInputChange:function(){this.imgInputFile.value?(this.imgUrlFile.setAttribute("disabled",!0),this.previewSrc.style.textDecoration="line-through"):(this.imgUrlFile.removeAttribute("disabled"),this.previewSrc.style.textDecoration="")},_removeSelectedFiles:function(e,t){this.value="",e&&(e.removeAttribute("disabled"),t.style.textDecoration="")},_openGallery:function(){this.callPlugin("imageGallery",this.plugins.imageGallery.open.bind(this,this.plugins.image._setUrlInput.bind(this.context.image)),null)},_setUrlInput:function(e){this.altText.value=e.alt,this._v_src._linkValue=this.previewSrc.textContent=this.imgUrlFile.value=e.src,this.imgUrlFile.focus()},_onLinkPreview:function(e,t,n){const i=n.target.value.trim();e._linkValue=this.textContent=i?t&&-1===i.indexOf("://")&&0!==i.indexOf("#")?t+i:-1===i.indexOf("://")?"/"+i:i:""},fileTags:["img"],select:function(e){this.plugins.image.onModifyMode.call(this,e,this.plugins.resizing.call_controller_resize.call(this,e,"image"))},destroy:function(e){const t=e||this.context.image._element,n=this.util.getParentElement(t,this.util.isMediaComponent)||t,i=1*t.getAttribute("data-index");let l=n.previousElementSibling||n.nextElementSibling;const o=n.parentNode;this.util.removeItem(n),this.plugins.image.init.call(this),this.controllersOff(),o!==this.context.element.wysiwyg&&this.util.removeItemAllParents(o,(function(e){return 0===e.childNodes.length}),null),this.focusEdge(l),this.plugins.fileManager.deleteInfo.call(this,"image",i,this.functions.onImageUpload),this.history.push(!1)},on:function(e){const t=this.context.image;e?t.imgInputFile&&this.context.options.imageMultipleFile&&t.imgInputFile.removeAttribute("multiple"):(t.inputX.value=t._origin_w=this.context.option.imageWidth===t._defaultSizeX?"":this.context.option.imageWidth,t.inputY.value=t._origin_h=this.context.option.imageHeight===t._defaultSizeY?"":this.context.option.imageHeight,t.imgInputFile&&this.context.options.imageMultipleFile&&t.imgInputFile.setAttribute("multiple","multiple"))},open:function(){this.plugins.dialog.open.call(this,"image","image"===this.currentControllerName)},openTab:function(e){const t=this.context.image.modal,n="init"===e?t.querySelector("._se_tab_link"):e.target;if(!/^BUTTON$/i.test(n.tagName))return!1;const i=n.getAttribute("data-tab-link");let l,o,s;for(o=t.getElementsByClassName("_se_tab_content"),l=0;l0?(this.showLoading(),n.submitAction.call(this,this.context.image.imgInputFile.files)):t.imgUrlFile&&t._v_src._linkValue.length>0&&(this.showLoading(),n.onRender_imgUrl.call(this))}catch(e){throw this.closeLoading(),Error('[SUNEDITOR.image.submit.fail] cause : "'+e.message+'"')}finally{this.plugins.dialog.close.call(this)}return!1},submitAction:function(e){if(0===e.length)return;let t=0,n=[];for(let i=0,l=e.length;i0){let e=0;const n=this.context.image._infoList;for(let t=0,i=n.length;ti){this.closeLoading();const n="[SUNEDITOR.imageUpload.fail] Size of uploadable total images: "+i/1e3+"KB";return void(("function"!==this.functions.onImageUploadError||this.functions.onImageUploadError(n,{limitSize:i,currentSize:e,uploadSize:t},this))&&this.functions.noticeOpen(n))}}const l=this.context.image;l._uploadFileLength=n.length;const o={linkValue:l._v_link._linkValue,linkNewWindow:l.imgLinkNewWindowCheck.checked,inputWidth:l.inputX.value,inputHeight:l.inputY.value,align:l._align,isUpdate:this.context.dialog.updateModal,element:l._element};if("function"==typeof this.functions.onImageUploadBefore){const e=this.functions.onImageUploadBefore(n,o,this,function(e){e&&this._w.Array.isArray(e.result)?this.plugins.image.register.call(this,o,e):this.plugins.image.upload.call(this,o,e)}.bind(this));if(void 0===e)return;if(!e)return void this.closeLoading();this._w.Array.isArray(e)&&e.length>0&&(n=e)}this.plugins.image.upload.call(this,o,n)},error:function(e,t){if(this.closeLoading(),"function"!=typeof this.functions.onImageUploadError||this.functions.onImageUploadError(e,t,this))throw this.functions.noticeOpen(e),Error("[SUNEDITOR.plugin.image.error] response: "+e)},upload:function(e,t){if(!t)return void this.closeLoading();if("string"==typeof t)return void this.plugins.image.error.call(this,t,null);const n=this.context.option.imageUploadUrl,i=this.context.dialog.updateModal?1:t.length;if("string"==typeof n&&n.length>0){const l=new FormData;for(let e=0;e0){const i=this.util.createElement("A");return i.href=/^https?:\/\//.test(t)?t:"http://"+t,i.target=n?"_blank":"",i.setAttribute("data-image-link","image"),e.setAttribute("data-image-link",t),i.appendChild(e),i}return e},setInputSize:function(e,t){t&&32===t.keyCode?t.preventDefault():this.plugins.resizing._module_setInputSize.call(this,this.context.image,e)},setRatio:function(){this.plugins.resizing._module_setRatio.call(this,this.context.image)},checkFileInfo:function(){const e=this.plugins.image,t=function(t){e.onModifyMode.call(this,t,null),e.openModify.call(this,!0),e.update_image.call(this,!0,!1,!0)}.bind(this);this.plugins.fileManager.checkInfo.call(this,"image",["img"],this.functions.onImageUpload,t,!0)},resetFileInfo:function(){this.plugins.fileManager.resetInfo.call(this,"image",this.functions.onImageUpload)},create_image:function(e,t,n,i,l,o,s){const a=this.plugins.image,r=this.context.image;this.context.resizing._resize_plugin="image";let c=this.util.createElement("IMG");c.src=e,c.alt=r._altText,c=a.onRender_link.call(this,c,t,n),c.setAttribute("data-rotate","0"),r._resizing&&c.setAttribute("data-proportion",r._proportionChecked);const d=this.plugins.component.set_cover.call(this,c),u=this.plugins.component.set_container.call(this,d,"se-image-container");r._captionChecked&&(r._caption=this.plugins.component.create_caption.call(this),r._caption.setAttribute("contenteditable",!1),d.appendChild(r._caption)),r._element=c,r._cover=d,r._container=u,a.applySize.call(this,i,l),a.setAlign.call(this,o,c,d,u),c.onload=a._image_create_onload.bind(this,c,r.svgDefaultSize),this.insertComponent(u,!0,!0,!0)&&this.plugins.fileManager.setInfo.call(this,"image",c,this.functions.onImageUpload,s,!0),this.context.resizing._resize_plugin=""},_image_create_onload:function(e,t){0===e.offsetWidth&&this.plugins.image.applySize.call(this,t,""),this.selectComponent.call(this,e,"image")},update_image:function(e,t,n){const i=this.context.image,l=i._v_link._linkValue;let o,s=i._element,a=i._cover,r=i._container,c=!1;null===a&&(c=!0,s=i._element.cloneNode(!0),a=this.plugins.component.set_cover.call(this,s)),null===r?(a=a.cloneNode(!0),s=a.querySelector("img"),c=!0,r=this.plugins.component.set_container.call(this,a,"se-image-container")):c&&(r.innerHTML="",r.appendChild(a),i._cover=a,i._element=s,c=!1);const d=this.util.isNumber(i.inputX.value)?i.inputX.value+i.sizeUnit:i.inputX.value,u=this.util.isNumber(i.inputY.value)?i.inputY.value+i.sizeUnit:i.inputY.value;o=/%$/.test(s.style.width)?d!==r.style.width||u!==r.style.height:d!==s.style.width||u!==s.style.height,s.alt=i._altText;let h=!1;if(i._captionChecked?i._caption||(i._caption=this.plugins.component.create_caption.call(this),a.appendChild(i._caption),h=!0):i._caption&&(this.util.removeItem(i._caption),i._caption=null,h=!0),l.trim().length>0)if(null!==i._linkElement&&a.contains(i._linkElement))i._linkElement.href=l,i._linkElement.target=i.imgLinkNewWindowCheck.checked?"_blank":"",s.setAttribute("data-image-link",l);else{let e=this.plugins.image.onRender_link.call(this,s,l,this.context.image.imgLinkNewWindowCheck.checked);a.insertBefore(e,i._caption)}else if(null!==i._linkElement){const e=s;e.setAttribute("data-image-link","");let t=e.cloneNode(!0);a.removeChild(i._linkElement),a.insertBefore(t,i._caption),s=t}if(c){const e=this.util.isRangeFormatElement(i._element.parentNode)||this.util.isWysiwygDiv(i._element.parentNode)?i._element:/^A$/i.test(i._element.parentNode.nodeName)?i._element.parentNode:this.util.getFormatElement(i._element)||i._element;e.parentNode.replaceChild(r,e),s=r.querySelector("img"),i._element=s,i._cover=a,i._container=r}(h||!i._onlyPercentage&&o)&&!e&&(/\d+/.test(s.style.height)||this.context.resizing._rotateVertical&&i._captionChecked)&&(/%$/.test(i.inputX.value)||/%$/.test(i.inputY.value)?this.plugins.resizing.resetTransform.call(this,s):this.plugins.resizing.setTransformSize.call(this,s,this.util.getNumber(i.inputX.value,0),this.util.getNumber(i.inputY.value,0)));i._resizing&&(s.setAttribute("data-proportion",i._proportionChecked),o&&this.plugins.image.applySize.call(this)),this.plugins.image.setAlign.call(this,null,s,null,null),e&&this.plugins.fileManager.setInfo.call(this,"image",s,this.functions.onImageUpload,null,!0),t&&this.selectComponent(s,"image"),n||this.history.push(!1)},update_src:function(e,t,n){t.src=e,this._w.setTimeout(this.plugins.fileManager.setInfo.bind(this,"image",t,this.functions.onImageUpload,n,!0)),this.selectComponent(t,"image")},onModifyMode:function(e,t){if(!e)return;const n=this.context.image;n._linkElement=/^A$/i.test(e.parentNode.nodeName)?e.parentNode:null,n._element=e,n._cover=this.util.getParentElement(e,"FIGURE"),n._container=this.util.getParentElement(e,this.util.isMediaComponent),n._caption=this.util.getChildElement(n._cover,"FIGCAPTION"),n._align=e.getAttribute("data-align")||"none",t&&(n._element_w=t.w,n._element_h=t.h,n._element_t=t.t,n._element_l=t.l);let i=n._element.getAttribute("data-size")||n._element.getAttribute("data-origin");i?(i=i.split(","),n._origin_w=i[0],n._origin_h=i[1]):t&&(n._origin_w=t.w,n._origin_h=t.h)},openModify:function(e){const t=this.context.image;t.imgUrlFile&&(t._v_src._linkValue=t.previewSrc.textContent=t.imgUrlFile.value=t._element.src),t._altText=t.altText.value=t._element.alt,t._v_link._linkValue=t.previewLink.textContent=t.imgLink.value=null===t._linkElement?"":t._linkElement.href,t.imgLinkNewWindowCheck.checked=t._linkElement&&"_blank"===t._linkElement.target,t.modal.querySelector('input[name="suneditor_image_radio"][value="'+t._align+'"]').checked=!0,t._align=t.modal.querySelector('input[name="suneditor_image_radio"]:checked').value,t._captionChecked=t.captionCheckEl.checked=!!t._caption,t._resizing&&this.plugins.resizing._module_setModifyInputSize.call(this,t,this.plugins.image),e||this.plugins.dialog.open.call(this,"image",!0)},sizeRevert:function(){this.plugins.resizing._module_sizeRevert.call(this,this.context.image)},applySize:function(e,t){const n=this.context.image;return e||(e=n.inputX.value||this.context.option.imageWidth),t||(t=n.inputY.value||this.context.option.imageHeight),n._onlyPercentage&&e||/%$/.test(e)?(this.plugins.image.setPercentSize.call(this,e,t),!0):(e&&"auto"!==e||t&&"auto"!==t?this.plugins.image.setSize.call(this,e,t,!1):this.plugins.image.setAutoSize.call(this),!1)},setSize:function(e,t,n,i){const l=this.context.image,o=/^(rw|lw)$/.test(i),s=/^(th|bh)$/.test(i);this.plugins.image.cancelPercentAttr.call(this),s||(l._element.style.width=this.util.isNumber(e)?e+l.sizeUnit:e),o||(l._element.style.height=this.util.isNumber(t)?t+l.sizeUnit:/%$/.test(t)?"":t),"center"===l._align&&this.plugins.image.setAlign.call(this,null,null,null,null),n||l._element.removeAttribute("data-percentage"),this.plugins.resizing._module_saveCurrentSize.call(this,l)},setAutoSize:function(){const e=this.context.image;this.plugins.resizing.resetTransform.call(this,e._element),this.plugins.image.cancelPercentAttr.call(this),e._element.style.maxWidth="",e._element.style.width="",e._element.style.height="",e._cover.style.width="",e._cover.style.height="",this.plugins.image.setAlign.call(this,null,null,null,null),e._element.setAttribute("data-percentage","auto,auto"),this.plugins.resizing._module_saveCurrentSize.call(this,e)},setOriginSize:function(){const e=this.context.image;e._element.removeAttribute("data-percentage"),this.plugins.resizing.resetTransform.call(this,e._element),this.plugins.image.cancelPercentAttr.call(this);const t=(e._element.getAttribute("data-origin")||"").split(","),n=t[0],i=t[1];t&&(e._onlyPercentage||/%$/.test(n)&&(/%$/.test(i)||!/\d/.test(i))?this.plugins.image.setPercentSize.call(this,n,i):this.plugins.image.setSize.call(this,n,i),this.plugins.resizing._module_saveCurrentSize.call(this,e))},setPercentSize:function(e,t){const n=this.context.image;t=!t||/%$/.test(t)||this.util.getNumber(t,0)?this.util.isNumber(t)?t+n.sizeUnit:t||"":this.util.isNumber(t)?t+"%":t;const i=/%$/.test(t);n._container.style.width=this.util.isNumber(e)?e+"%":e,n._container.style.height="",n._cover.style.width="100%",n._cover.style.height=i?t:"",n._element.style.width="100%",n._element.style.height=i?"":t,n._element.style.maxWidth="","center"===n._align&&this.plugins.image.setAlign.call(this,null,null,null,null),n._element.setAttribute("data-percentage",e+","+t),this.plugins.resizing.setCaptionPosition.call(this,n._element),this.plugins.resizing._module_saveCurrentSize.call(this,n)},cancelPercentAttr:function(){const e=this.context.image;e._cover.style.width="",e._cover.style.height="",e._container.style.width="",e._container.style.height="",this.util.removeClass(e._container,this.context.image._floatClassRegExp),this.util.addClass(e._container,"__se__float-"+e._align),"center"===e._align&&this.plugins.image.setAlign.call(this,null,null,null,null)},setAlign:function(e,t,n,i){const l=this.context.image;e||(e=l._align),t||(t=l._element),n||(n=l._cover),i||(i=l._container),n.style.margin=e&&"none"!==e?"auto":"0",/%$/.test(t.style.width)&&"center"===e?(i.style.minWidth="100%",n.style.width=i.style.width):(i.style.minWidth="",n.style.width=this.context.resizing._rotateVertical?t.style.height||t.offsetHeight:t.style.width&&"auto"!==t.style.width?t.style.width||"100%":""),this.util.hasClass(i,"__se__float-"+e)||(this.util.removeClass(i,l._floatClassRegExp),this.util.addClass(i,"__se__float-"+e)),t.setAttribute("data-align",e)},resetAlign:function(){const e=this.context.image;e._element.setAttribute("data-align",""),e._align="none",e._cover.style.margin="0",this.util.removeClass(e._container,e._floatClassRegExp)},init:function(){const e=this.context.image;e.imgInputFile&&(e.imgInputFile.value=""),e.imgUrlFile&&(e._v_src._linkValue=e.previewSrc.textContent=e.imgUrlFile.value=""),e.imgInputFile&&e.imgUrlFile&&(e.imgUrlFile.removeAttribute("disabled"),e.previewSrc.style.textDecoration=""),e.altText.value="",e._v_link._linkValue=e.previewLink.textContent=e.imgLink.value="",e.imgLinkNewWindowCheck.checked=!1,e.modal.querySelector('input[name="suneditor_image_radio"][value="none"]').checked=!0,e.captionCheckEl.checked=!1,e._element=null,this.plugins.image.openTab.call(this,"init"),e._resizing&&(e.inputX.value=this.context.option.imageWidth===e._defaultSizeX?"":this.context.option.imageWidth,e.inputY.value=this.context.option.imageHeight===e._defaultSizeY?"":this.context.option.imageHeight,e.proportion.checked=!0,e._ratio=!1,e._ratioX=1,e._ratioY=1)}},_={name:"video",display:"dialog",add:function(e){e.addModule([r.a,u.a,g.a,m.a]);const t=e.context,n=t.video={_infoList:[],_infoIndex:0,_uploadFileLength:0,sizeUnit:t.option._videoSizeUnit,_align:"none",_floatClassRegExp:"__se__float\\-[a-z]+",_youtubeQuery:t.option.youtubeQuery,_videoRatio:100*t.option.videoRatio+"%",_defaultRatio:100*t.option.videoRatio+"%",_linkValue:"",_element:null,_cover:null,_container:null,inputX:null,inputY:null,_element_w:1,_element_h:1,_element_l:0,_element_t:0,_defaultSizeX:"100%",_defaultSizeY:100*t.option.videoRatio+"%",_origin_w:"100%"===t.option.videoWidth?"":t.option.videoWidth,_origin_h:"56.25%"===t.option.videoHeight?"":t.option.videoHeight,_proportionChecked:!0,_resizing:t.option.videoResizing,_resizeDotHide:!t.option.videoHeightShow,_rotation:t.option.videoRotation,_onlyPercentage:t.option.videoSizeOnlyPercentage,_ratio:!1,_ratioX:1,_ratioY:1,_captionShow:!1};let i=this.setDialog.call(e);n.modal=i,n.videoInputFile=i.querySelector("._se_video_file"),n.videoUrlFile=i.querySelector(".se-input-url"),n.focusElement=n.videoUrlFile||n.videoInputFile,n.preview=i.querySelector(".se-link-preview"),i.querySelector(".se-btn-primary").addEventListener("click",this.submit.bind(e)),n.videoInputFile&&i.querySelector(".se-dialog-files-edge-button").addEventListener("click",this._removeSelectedFiles.bind(n.videoInputFile,n.videoUrlFile,n.preview)),n.videoInputFile&&n.videoUrlFile&&n.videoInputFile.addEventListener("change",this._fileInputChange.bind(n)),n.videoUrlFile&&n.videoUrlFile.addEventListener("input",this._onLinkPreview.bind(n.preview,n,t.options.linkProtocol)),n.proportion={},n.videoRatioOption={},n.inputX={},n.inputY={},t.option.videoResizing&&(n.proportion=i.querySelector("._se_video_check_proportion"),n.videoRatioOption=i.querySelector(".se-video-ratio"),n.inputX=i.querySelector("._se_video_size_x"),n.inputY=i.querySelector("._se_video_size_y"),n.inputX.value=t.option.videoWidth,n.inputY.value=t.option.videoHeight,n.inputX.addEventListener("keyup",this.setInputSize.bind(e,"x")),n.inputY.addEventListener("keyup",this.setInputSize.bind(e,"y")),n.inputX.addEventListener("change",this.setRatio.bind(e)),n.inputY.addEventListener("change",this.setRatio.bind(e)),n.proportion.addEventListener("change",this.setRatio.bind(e)),n.videoRatioOption.addEventListener("change",this.setVideoRatio.bind(e)),i.querySelector(".se-dialog-btn-revert").addEventListener("click",this.sizeRevert.bind(e))),t.dialog.modal.appendChild(i),i=null},setDialog:function(){const e=this.context.option,t=this.lang,n=this.util.createElement("DIV");n.className="se-dialog-content",n.style.display="none";let i='
    '+t.dialogBox.videoBox.title+'
    ';if(e.videoFileInput&&(i+='
    "),e.videoUrlInput&&(i+='
    '),e.videoResizing){const n=e.videoRatioList||[{name:"16:9",value:.5625},{name:"4:3",value:.75},{name:"21:9",value:.4285}],l=e.videoRatio,o=e.videoSizeOnlyPercentage,s=o?' style="display: none !important;"':"",a=e.videoHeightShow?"":' style="display: none !important;"',r=e.videoRatioShow?"":' style="display: none !important;"',c=o||e.videoHeightShow||e.videoRatioShow?"":' style="display: none !important;"';i+='
    "}return i+='
    ",n.innerHTML=i,n},_fileInputChange:function(){this.videoInputFile.value?(this.videoUrlFile.setAttribute("disabled",!0),this.preview.style.textDecoration="line-through"):(this.videoUrlFile.removeAttribute("disabled"),this.preview.style.textDecoration="")},_removeSelectedFiles:function(e,t){this.value="",e&&(e.removeAttribute("disabled"),t.style.textDecoration="")},_onLinkPreview:function(e,t,n){const i=n.target.value.trim();/^$/.test(i)?(e._linkValue=i,this.textContent=''):e._linkValue=this.textContent=i?t&&-1===i.indexOf("://")&&0!==i.indexOf("#")?t+i:-1===i.indexOf("://")?"/"+i:i:""},_setTagAttrs:function(e){e.setAttribute("controls",!0);const t=this.context.options.videoTagAttrs;if(t)for(let n in t)this.util.hasOwn(t,n)&&e.setAttribute(n,t[n])},createVideoTag:function(){const e=this.util.createElement("VIDEO");return this.plugins.video._setTagAttrs.call(this,e),e},_setIframeAttrs:function(e){e.frameBorder="0",e.allowFullscreen=!0;const t=this.context.options.videoIframeAttrs;if(t)for(let n in t)this.util.hasOwn(t,n)&&e.setAttribute(n,t[n])},createIframeTag:function(){const e=this.util.createElement("IFRAME");return this.plugins.video._setIframeAttrs.call(this,e),e},fileTags:["iframe","video"],select:function(e){this.plugins.video.onModifyMode.call(this,e,this.plugins.resizing.call_controller_resize.call(this,e,"video"))},destroy:function(e){const t=e||this.context.video._element,n=this.context.video._container,i=1*t.getAttribute("data-index");let l=n.previousElementSibling||n.nextElementSibling;const o=n.parentNode;this.util.removeItem(n),this.plugins.video.init.call(this),this.controllersOff(),o!==this.context.element.wysiwyg&&this.util.removeItemAllParents(o,(function(e){return 0===e.childNodes.length}),null),this.focusEdge(l),this.plugins.fileManager.deleteInfo.call(this,"video",i,this.functions.onVideoUpload),this.history.push(!1)},on:function(e){const t=this.context.video;e?t.videoInputFile&&this.context.options.videoMultipleFile&&t.videoInputFile.removeAttribute("multiple"):(t.inputX.value=t._origin_w=this.context.option.videoWidth===t._defaultSizeX?"":this.context.option.videoWidth,t.inputY.value=t._origin_h=this.context.option.videoHeight===t._defaultSizeY?"":this.context.option.videoHeight,t.proportion.disabled=!0,t.videoInputFile&&this.context.options.videoMultipleFile&&t.videoInputFile.setAttribute("multiple","multiple")),t._resizing&&this.plugins.video.setVideoRatioSelect.call(this,t._origin_h||t._defaultRatio)},open:function(){this.plugins.dialog.open.call(this,"video","video"===this.currentControllerName)},setVideoRatio:function(e){const t=this.context.video,n=e.target.options[e.target.selectedIndex].value;t._defaultSizeY=t._videoRatio=n?100*n+"%":t._defaultSizeY,t.inputY.placeholder=n?100*n+"%":"",t.inputY.value=""},setInputSize:function(e,t){if(t&&32===t.keyCode)return void t.preventDefault();const n=this.context.video;this.plugins.resizing._module_setInputSize.call(this,n,e),"y"===e&&this.plugins.video.setVideoRatioSelect.call(this,t.target.value||n._defaultRatio)},setRatio:function(){this.plugins.resizing._module_setRatio.call(this,this.context.video)},submit:function(e){const t=this.context.video,n=this.plugins.video;e.preventDefault(),e.stopPropagation(),t._align=t.modal.querySelector('input[name="suneditor_video_radio"]:checked').value;try{t.videoInputFile&&t.videoInputFile.files.length>0?(this.showLoading(),n.submitAction.call(this,this.context.video.videoInputFile.files)):t.videoUrlFile&&t._linkValue.length>0&&(this.showLoading(),n.setup_url.call(this))}catch(e){throw this.closeLoading(),Error('[SUNEDITOR.video.submit.fail] cause : "'+e.message+'"')}finally{this.plugins.dialog.close.call(this)}return!1},submitAction:function(e){if(0===e.length)return;let t=0,n=[];for(let i=0,l=e.length;i0){let e=0;const n=this.context.video._infoList;for(let t=0,i=n.length;ti){this.closeLoading();const n="[SUNEDITOR.videoUpload.fail] Size of uploadable total videos: "+i/1e3+"KB";return void(("function"!==this.functions.onVideoUploadError||this.functions.onVideoUploadError(n,{limitSize:i,currentSize:e,uploadSize:t},this))&&this.functions.noticeOpen(n))}}const l=this.context.video;l._uploadFileLength=n.length;const o={inputWidth:l.inputX.value,inputHeight:l.inputY.value,align:l._align,isUpdate:this.context.dialog.updateModal,element:l._element};if("function"==typeof this.functions.onVideoUploadBefore){const e=this.functions.onVideoUploadBefore(n,o,this,function(e){e&&this._w.Array.isArray(e.result)?this.plugins.video.register.call(this,o,e):this.plugins.video.upload.call(this,o,e)}.bind(this));if(void 0===e)return;if(!e)return void this.closeLoading();"object"==typeof e&&e.length>0&&(n=e)}this.plugins.video.upload.call(this,o,n)},error:function(e,t){if(this.closeLoading(),"function"!=typeof this.functions.onVideoUploadError||this.functions.onVideoUploadError(e,t,this))throw this.functions.noticeOpen(e),Error("[SUNEDITOR.plugin.video.error] response: "+e)},upload:function(e,t){if(!t)return void this.closeLoading();if("string"==typeof t)return void this.plugins.video.error.call(this,t,null);const n=this.context.option.videoUploadUrl,i=this.context.dialog.updateModal?1:t.length;if(!("string"==typeof n&&n.length>0))throw Error('[SUNEDITOR.videoUpload.fail] cause : There is no "videoUploadUrl" option.');{const l=new FormData;for(let e=0;e$/.test(t)){if(t=(new this._w.DOMParser).parseFromString(t,"text/html").querySelector("iframe").src,0===t.length)return!1}if(/youtu\.?be/.test(t)){if(/^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("&","?&")),e._youtubeQuery.length>0)if(/\?/.test(t)){const n=t.split("?");t=n[0]+"?"+e._youtubeQuery+"&"+n[1]}else t+="?"+e._youtubeQuery}else/vimeo\.com/.test(t)&&(t.endsWith("/")&&(t=t.slice(0,-1)),t="https://player.vimeo.com/video/"+t.slice(t.lastIndexOf("/")+1));this.plugins.video.create_video.call(this,this.plugins.video.createIframeTag.call(this),t,e.inputX.value,e.inputY.value,e._align,null,this.context.dialog.updateModal)}catch(e){throw Error('[SUNEDITOR.video.upload.fail] cause : "'+e.message+'"')}finally{this.closeLoading()}},create_video:function(e,t,n,i,l,o,s){this.context.resizing._resize_plugin="video";const a=this.context.video;let r=null,c=null,d=!1;if(s){if((e=a._element).src!==t){d=!0;const n=/youtu\.?be/.test(t),i=/vimeo\.com/.test(t);if(!n&&!i||/^iframe$/i.test(e.nodeName))if(n||i||/^videoo$/i.test(e.nodeName))e.src=t;else{const n=this.plugins.video.createVideoTag.call(this);n.src=t,e.parentNode.replaceChild(n,e),a._element=e=n}else{const n=this.plugins.video.createIframeTag.call(this);n.src=t,e.parentNode.replaceChild(n,e),a._element=e=n}}c=a._container,r=this.util.getParentElement(e,"FIGURE")}else d=!0,e.src=t,a._element=e,r=this.plugins.component.set_cover.call(this,e),c=this.plugins.component.set_container.call(this,r,"se-video-container");a._cover=r,a._container=c;const u=this.plugins.resizing._module_getSizeX.call(this,a)!==(n||a._defaultSizeX)||this.plugins.resizing._module_getSizeY.call(this,a)!==(i||a._videoRatio),h=!s||u;a._resizing&&(this.context.video._proportionChecked=a.proportion.checked,e.setAttribute("data-proportion",a._proportionChecked));let g=!1;h&&(g=this.plugins.video.applySize.call(this)),g&&"center"===l||this.plugins.video.setAlign.call(this,null,e,r,c);let p=!0;s?a._resizing&&this.context.resizing._rotateVertical&&h&&this.plugins.resizing.setTransformSize.call(this,e,null,null):p=this.insertComponent(c,!1,!0,!1),p&&(d&&this.plugins.fileManager.setInfo.call(this,"video",e,this.functions.onVideoUpload,o,!0),s&&(this.selectComponent(e,"video"),this.history.push(!1))),this.context.resizing._resize_plugin=""},_update_videoCover:function(e){if(!e)return;const t=this.context.video;/^video$/i.test(e.nodeName)?this.plugins.video._setTagAttrs.call(this,e):this.plugins.video._setIframeAttrs.call(this,e);const n=this.util.getParentElement(e,this.util.isMediaComponent)||this.util.getParentElement(e,function(e){return this.isWysiwygDiv(e.parentNode)}.bind(this.util));t._element=e=e.cloneNode(!0);const i=t._cover=this.plugins.component.set_cover.call(this,e),l=t._container=this.plugins.component.set_container.call(this,i,"se-video-container"),o=n.querySelector("figcaption");let s=null;o&&(s=this.util.createElement("DIV"),s.innerHTML=o.innerHTML,this.util.removeItem(o));const a=(e.getAttribute("data-size")||e.getAttribute("data-origin")||"").split(",");this.plugins.video.applySize.call(this,a[0],a[1]),n.parentNode.replaceChild(l,n),s&&n.parentNode.insertBefore(s,l.nextElementSibling),this.plugins.fileManager.setInfo.call(this,"video",e,this.functions.onVideoUpload,null,!0)},onModifyMode:function(e,t){const n=this.context.video;n._element=e,n._cover=this.util.getParentElement(e,"FIGURE"),n._container=this.util.getParentElement(e,this.util.isMediaComponent),n._align=e.getAttribute("data-align")||"none",t&&(n._element_w=t.w,n._element_h=t.h,n._element_t=t.t,n._element_l=t.l);let i=n._element.getAttribute("data-size")||n._element.getAttribute("data-origin");i?(i=i.split(","),n._origin_w=i[0],n._origin_h=i[1]):t&&(n._origin_w=t.w,n._origin_h=t.h)},openModify:function(e){const t=this.context.video;if(t.videoUrlFile&&(t._linkValue=t.preview.textContent=t.videoUrlFile.value=t._element.src||(t._element.querySelector("source")||"").src||""),t.modal.querySelector('input[name="suneditor_video_radio"][value="'+t._align+'"]').checked=!0,t._resizing){this.plugins.resizing._module_setModifyInputSize.call(this,t,this.plugins.video);const e=t._videoRatio=this.plugins.resizing._module_getSizeY.call(this,t);this.plugins.video.setVideoRatioSelect.call(this,e)||(t.inputY.value=t._onlyPercentage?this.util.getNumber(e,2):e)}e||this.plugins.dialog.open.call(this,"video",!0)},setVideoRatioSelect:function(e){let t=!1;const n=this.context.video,i=n.videoRatioOption.options;/%$/.test(e)||n._onlyPercentage?e=this.util.getNumber(e,2)/100+"":(!this.util.isNumber(e)||1*e>=1)&&(e=""),n.inputY.placeholder="";for(let l=0,o=i.length;l'+this.icons.cancel+''+t.dialogBox.audioBox.title+'
    ';return e.audioFileInput&&(i+='
    "),e.audioUrlInput&&(i+='
    '),i+='
    ",n.innerHTML=i,n},setController:function(){const e=this.lang,t=this.icons,n=this.util.createElement("DIV");return n.className="se-controller se-controller-link",n.innerHTML='
    ",n},_fileInputChange:function(){this.audioInputFile.value?(this.audioUrlFile.setAttribute("disabled",!0),this.preview.style.textDecoration="line-through"):(this.audioUrlFile.removeAttribute("disabled"),this.preview.style.textDecoration="")},_removeSelectedFiles:function(e,t){this.value="",e&&(e.removeAttribute("disabled"),t.style.textDecoration="")},_createAudioTag:function(){const e=this.util.createElement("AUDIO");this.plugins.audio._setTagAttrs.call(this,e);const t=this.context.audio._origin_w,n=this.context.audio._origin_h;return e.setAttribute("origin-size",t+","+n),e.style.cssText=(t?"width:"+t+"; ":"")+(n?"height:"+n+";":""),e},_setTagAttrs:function(e){e.setAttribute("controls",!0);const t=this.context.options.audioTagAttrs;if(t)for(let n in t)this.util.hasOwn(t,n)&&e.setAttribute(n,t[n])},_onLinkPreview:function(e,t,n){const i=n.target.value.trim();e._linkValue=this.textContent=i?t&&-1===i.indexOf("://")&&0!==i.indexOf("#")?t+i:-1===i.indexOf("://")?"/"+i:i:""},fileTags:["audio"],select:function(e){this.plugins.audio.onModifyMode.call(this,e)},destroy:function(e){e=e||this.context.audio._element;const t=this.util.getParentElement(e,this.util.isComponent)||e,n=1*e.getAttribute("data-index"),i=t.previousElementSibling||t.nextElementSibling,l=t.parentNode;this.util.removeItem(t),this.plugins.audio.init.call(this),this.controllersOff(),l!==this.context.element.wysiwyg&&this.util.removeItemAllParents(l,(function(e){return 0===e.childNodes.length}),null),this.focusEdge(i),this.plugins.fileManager.deleteInfo.call(this,"audio",n,this.functions.onAudioUpload),this.history.push(!1)},checkFileInfo:function(){this.plugins.fileManager.checkInfo.call(this,"audio",["audio"],this.functions.onAudioUpload,this.plugins.audio.updateCover.bind(this),!1)},resetFileInfo:function(){this.plugins.fileManager.resetInfo.call(this,"audio",this.functions.onAudioUpload)},on:function(e){const t=this.context.audio;e?t._element?(this.context.dialog.updateModal=!0,t._linkValue=t.preview.textContent=t.audioUrlFile.value=t._element.src,t.audioInputFile&&this.context.options.audioMultipleFile&&t.audioInputFile.removeAttribute("multiple")):t.audioInputFile&&this.context.options.audioMultipleFile&&t.audioInputFile.removeAttribute("multiple"):(this.plugins.audio.init.call(this),t.audioInputFile&&this.context.options.audioMultipleFile&&t.audioInputFile.setAttribute("multiple","multiple"))},open:function(){this.plugins.dialog.open.call(this,"audio","audio"===this.currentControllerName)},submit:function(e){const t=this.context.audio;e.preventDefault(),e.stopPropagation();try{t.audioInputFile&&t.audioInputFile.files.length>0?(this.showLoading(),this.plugins.audio.submitAction.call(this,t.audioInputFile.files)):t.audioUrlFile&&t._linkValue.length>0&&(this.showLoading(),this.plugins.audio.setupUrl.call(this,t._linkValue))}catch(e){throw this.closeLoading(),Error('[SUNEDITOR.audio.submit.fail] cause : "'+e.message+'"')}finally{this.plugins.dialog.close.call(this)}return!1},submitAction:function(e){if(0===e.length)return;let t=0,n=[];for(let i=0,l=e.length;i0){let e=0;const n=this.context.audio._infoList;for(let t=0,i=n.length;ti){this.closeLoading();const n="[SUNEDITOR.audioUpload.fail] Size of uploadable total audios: "+i/1e3+"KB";return void(("function"!==this.functions.onAudioUploadError||this.functions.onAudioUploadError(n,{limitSize:i,currentSize:e,uploadSize:t},this))&&this.functions.noticeOpen(n))}}const l=this.context.audio;l._uploadFileLength=n.length;const o={isUpdate:this.context.dialog.updateModal,element:l._element};if("function"==typeof this.functions.onAudioUploadBefore){const e=this.functions.onAudioUploadBefore(n,o,this,function(e){e&&this._w.Array.isArray(e.result)?this.plugins.audio.register.call(this,o,e):this.plugins.audio.upload.call(this,o,e)}.bind(this));if(void 0===e)return;if(!e)return void this.closeLoading();"object"==typeof e&&e.length>0&&(n=e)}this.plugins.audio.upload.call(this,o,n)},error:function(e,t){if(this.closeLoading(),"function"!=typeof this.functions.onAudioUploadError||this.functions.onAudioUploadError(e,t,this))throw this.functions.noticeOpen(e),Error("[SUNEDITOR.plugin.audio.exception] response: "+e)},upload:function(e,t){if(!t)return void this.closeLoading();if("string"==typeof t)return void this.plugins.audio.error.call(this,t,null);const n=this.context.option.audioUploadUrl,i=this.context.dialog.updateModal?1:t.length,l=new FormData;for(let e=0;e'+this.icons.cancel+''+e.dialogBox.mathBox.title+'

    ",t},setController_MathButton:function(){const e=this.lang,t=this.util.createElement("DIV");return t.className="se-controller se-controller-link",t.innerHTML='
    ",t},open:function(){this.plugins.dialog.open.call(this,"math","math"===this.currentControllerName)},managedTags:function(){return{className:"katex",method:function(e){if(!e.getAttribute("data-exp"))return;const t=this._d.createRange().createContextualFragment(this.plugins.math._renderer.call(this,this.util.HTMLDecoder(e.getAttribute("data-exp"))));e.innerHTML=t.querySelector(".katex").innerHTML}}},_renderer:function(e){const t=this.context.option.katex;return t.src.renderToString(e,t.options)},_renderMathExp:function(e,t){e.previewElement.innerHTML=this.plugins.math._renderer.call(this,t.target.value)},submit:function(e){this.showLoading(),e.preventDefault(),e.stopPropagation();const t=function(){if(0===this.context.math.focusElement.value.trim().length)return!1;const e=this.context.math,t=e.focusElement.value,n=e.previewElement.querySelector(".katex");if(!n)return!1;if(n.className="__se__katex "+n.className,n.setAttribute("contenteditable",!1),n.setAttribute("data-exp",this.util.HTMLEncoder(t)),n.setAttribute("data-font-size",e.fontSizeElement.value),n.style.fontSize=e.fontSizeElement.value,this.context.dialog.updateModal){const t=this.util.getParentElement(e._mathExp,".katex");t.parentNode.replaceChild(n,t),this.setRange(n,0,n,1)}else{const e=this.getSelectedElements();if(e.length>1){const t=this.util.createElement(e[0].nodeName);if(t.appendChild(n),!this.insertNode(t,null,!0))return!1}else if(!this.insertNode(n,null,!0))return!1;const t=this.util.createTextNode(this.util.zeroWidthSpace);n.parentNode.insertBefore(t,n.nextSibling),this.setRange(n,0,n,1)}return e.focusElement.value="",e.fontSizeElement.value="1em",e.previewElement.style.fontSize="1em",e.previewElement.innerHTML="",!0}.bind(this);try{t()&&(this.plugins.dialog.close.call(this),this.history.push(!1))}catch(e){this.plugins.dialog.close.call(this)}finally{this.closeLoading()}return!1},active:function(e){if(e){if(e.getAttribute("data-exp"))return this.controllerArray.indexOf(this.context.math.mathController)<0&&(this.setRange(e,0,e,1),this.plugins.math.call_controller.call(this,e)),!0}else this.controllerArray.indexOf(this.context.math.mathController)>-1&&this.controllersOff();return!1},on:function(e){if(e){const e=this.context.math;if(e._mathExp){const t=this.util.HTMLDecoder(e._mathExp.getAttribute("data-exp")),n=e._mathExp.getAttribute("data-font-size")||"1em";this.context.dialog.updateModal=!0,e.focusElement.value=t,e.fontSizeElement.value=n,e.previewElement.innerHTML=this.plugins.math._renderer.call(this,t),e.previewElement.style.fontSize=n}}else this.plugins.math.init.call(this)},call_controller:function(e){this.context.math._mathExp=e;const t=this.context.math.mathController;this.setControllerPosition(t,e,"bottom",{left:0,top:0}),this.controllersOn(t,e,"math")},onClick_mathController:function(e){e.stopPropagation();const t=e.target.getAttribute("data-command")||e.target.parentNode.getAttribute("data-command");t&&(e.preventDefault(),/update/.test(t)?(this.context.math.focusElement.value=this.util.HTMLDecoder(this.context.math._mathExp.getAttribute("data-exp")),this.plugins.dialog.open.call(this,"math",!0)):(this.util.removeItem(this.context.math._mathExp),this.context.math._mathExp=null,this.focus(),this.history.push(!1)),this.controllersOff())},init:function(){const e=this.context.math;e.mathController.style.display="none",e._mathExp=null,e.focusElement.value="",e.previewElement.innerHTML=""}},y=n("JhlZ"),C=n.n(y),w={blockquote:{name:"blockquote",display:"command",add:function(e,t){e.context.blockquote={targetButton:t,tag:e.util.createElement("BLOCKQUOTE")}},active:function(e){if(e){if(/blockquote/i.test(e.nodeName))return this.util.addClass(this.context.blockquote.targetButton,"active"),!0}else this.util.removeClass(this.context.blockquote.targetButton,"active");return!1},action:function(){const e=this.util.getParentElement(this.getSelectionNode(),"blockquote");e?this.detachRangeFormatElement(e,null,null,!1,!1):this.applyRangeFormatElement(this.context.blockquote.tag.cloneNode(!1))}},align:{name:"align",display:"submenu",add:function(e,t){const n=e.icons,i=e.context;i.align={targetButton:t,_alignList:null,currentAlign:"",defaultDir:i.options.rtl?"right":"left",icons:{justify:n.align_justify,left:n.align_left,right:n.align_right,center:n.align_center}};let l=this.setSubmenu.call(e),o=l.querySelector("ul");o.addEventListener("click",this.pickup.bind(e)),i.align._alignList=o.querySelectorAll("li button"),e.initMenuTarget(this.name,t,l),l=null,o=null},setSubmenu:function(){const e=this.lang,t=this.icons,n=this.util.createElement("DIV"),i="left"===this.context.align.defaultDir,l='
  • ",o='
  • ";return n.className="se-submenu se-list-layer se-list-align",n.innerHTML='
      '+(i?l:o)+'
    • "+(i?o:l)+'
    ",n},active:function(e){const t=this.context.align,n=t.targetButton,i=n.firstElementChild;if(e){if(this.util.isFormatElement(e)){const l=e.style.textAlign;if(l)return this.util.changeElement(i,t.icons[l]),n.setAttribute("data-focus",l),!0}}else this.util.changeElement(i,t.icons[t.defaultDir]),n.removeAttribute("data-focus");return!1},on:function(){const e=this.context.align,t=e._alignList,n=e.targetButton.getAttribute("data-focus")||e.defaultDir;if(n!==e.currentAlign){for(let e=0,i=t.length;e('+t.toolbar.default+")";for(o=0,s=a.length;o";return r+="",n.innerHTML=r,n},active:function(e){const t=this.context.font.targetText,n=this.context.font.targetTooltip;if(e){if(e.style&&e.style.fontFamily.length>0){const i=e.style.fontFamily.replace(/["']/g,"");return this.util.changeTxt(t,i),this.util.changeTxt(n,i),!0}}else{const e=this.lang.toolbar.font;this.util.changeTxt(t,e),this.util.changeTxt(n,e)}return!1},on:function(){const e=this.context.font,t=e._fontList,n=e.targetText.textContent;if(n!==e.currentFont){for(let e=0,i=t.length;e('+t.toolbar.default+")";for(let t,n=0,o=e.fontSizeUnit,s=i.length;n";return l+="",n.innerHTML=l,n},active:function(e){if(e){if(e.style&&e.style.fontSize.length>0)return this.util.changeTxt(this.context.fontSize.targetText,e.style.fontSize),!0}else this.util.changeTxt(this.context.fontSize.targetText,this.lang.toolbar.fontSize);return!1},on:function(){const e=this.context.fontSize,t=e._sizeList,n=e.targetText.textContent;if(n!==e.currentSize){for(let e=0,i=t.length;e
  • ',t},appendHr:function(e){const t=this.util.createElement("HR");return t.className=e,this.focus(),this.insertComponent(t,!1,!0,!1)},horizontalRulePick:function(e){e.preventDefault(),e.stopPropagation();let t=e.target,n=null;for(;!n&&!/UL/i.test(t.tagName);)n=t.getAttribute("data-value"),t=t.parentNode;if(!n)return;const i=this.plugins.horizontalRule.appendHr.call(this,"__se__"+n);i&&(this.setRange(i,0,i,0),this.submenuOff())}},list:{name:"list",display:"submenu",add:function(e,t){const n=e.context;n.list={targetButton:t,_list:null,currentList:"",icons:{bullets:e.icons.list_bullets,number:e.icons.list_number}};let i=this.setSubmenu.call(e),l=i.querySelector("ul");l.addEventListener("click",this.pickup.bind(e)),n.list._list=l.querySelectorAll("li button"),e.initMenuTarget(this.name,t,i),i=null,l=null},setSubmenu:function(){const e=this.lang,t=this.util.createElement("DIV");return t.className="se-submenu se-list-layer",t.innerHTML='
    ",t},active:function(e){const t=this.context.list.targetButton,n=t.firstElementChild,i=this.util;if(e){if(i.isList(e)){const l=e.nodeName;return t.setAttribute("data-focus",l),i.addClass(t,"active"),/UL/i.test(l)?i.changeElement(n,this.context.list.icons.bullets):i.changeElement(n,this.context.list.icons.number),!0}}else t.removeAttribute("data-focus"),i.changeElement(n,this.context.list.icons.number),i.removeClass(t,"active");return!1},on:function(){const e=this.context.list,t=e._list,n=e.targetButton.getAttribute("data-focus")||"";if(n!==e.currentList){for(let e=0,i=t.length;e"),t.innerHTML+=n.outerHTML,e&&(t.innerHTML+="
    ")}else{const e=n.childNodes;for(;e[0];)t.appendChild(e[0])}a.appendChild(t),r||(u=a),r&&m===g&&!o.isRangeFormatElement(f)||(d||(d=a),i&&r&&m===g||r&&o.isList(g)&&g===c||a.parentNode!==m&&m.insertBefore(a,f)),o.removeItem(n),i&&null===h&&(h=a.children.length-1),r&&(o.getRangeFormatElement(g,p)!==o.getRangeFormatElement(c,p)||o.isList(g)&&o.isList(c)&&o.getElementDepth(g)!==o.getElementDepth(c))&&(a=o.createElement(e)),_&&0===_.children.length&&o.removeItem(_)}else o.removeItem(n);h&&(d=d.children[h]),s&&(g=a.children.length-1,a.innerHTML+=c.innerHTML,u=a.children[g],o.removeItem(c))}else{if(n)for(let e=0,t=l.length;e=0;n--)if(l[n].contains(l[e])){l.splice(e,1),e--,t--;break}const t=o.getRangeFormatElement(s),i=t&&t.tagName===e;let a,r;const c=function(e){return!this.isComponent(e)}.bind(o);i||(r=o.createElement(e));for(let t,s,d=0,u=l.length;d0){const e=l.cloneNode(!1),t=l.childNodes,o=this.util.getPositionIndex(i);for(;t[o];)e.appendChild(t[o]);n.appendChild(e)}0===l.children.length&&this.util.removeItem(l),this.util.mergeSameTags(s);const a=this.util.getEdgeChildNodes(t,n);return{cc:t.parentNode,sc:a.sc,ec:a.ec}},editInsideList:function(e,t){const n=(t=t||this.getSelectedElements().filter(function(e){return this.isListCell(e)}.bind(this.util))).length;if(0===n||!e&&!this.util.isListCell(t[0].previousElementSibling)&&!this.util.isListCell(t[n-1].nextElementSibling))return{sc:t[0],so:0,ec:t[n-1],eo:1};let i=t[0].parentNode,l=t[n-1],o=null;if(e){if(i!==l.parentNode&&this.util.isList(l.parentNode.parentNode)&&l.nextElementSibling)for(l=l.nextElementSibling;l;)t.push(l),l=l.nextElementSibling;o=this.plugins.list.editList.call(this,i.nodeName.toUpperCase(),t,!0)}else{let e=this.util.createElement(i.nodeName),s=t[0].previousElementSibling,a=l.nextElementSibling;const r={s:null,e:null,sl:i,el:i};for(let l,o=0,c=n;o span > span"),i.columnFixedButton=s.querySelector("._se_table_fixed_column"),i.headerButton=s.querySelector("._se_table_header"),s.addEventListener("mousedown",e.eventStop);let a=this.setController_tableEditor.call(e,i.cellControllerTop);i.resizeDiv=a,i.splitMenu=a.querySelector(".se-btn-group-sub"),i.mergeButton=a.querySelector("._se_table_merge_button"),i.splitButton=a.querySelector("._se_table_split_button"),i.insertRowAboveButton=a.querySelector("._se_table_insert_row_a"),i.insertRowBelowButton=a.querySelector("._se_table_insert_row_b"),a.addEventListener("mousedown",e.eventStop),o.addEventListener("mousemove",this.onMouseMove_tablePicker.bind(e,i)),o.addEventListener("click",this.appendTable.bind(e)),a.addEventListener("click",this.onClick_tableController.bind(e)),s.addEventListener("click",this.onClick_tableController.bind(e)),e.initMenuTarget(this.name,t,l),n.element.relative.appendChild(a),n.element.relative.appendChild(s),l=null,o=null,a=null,s=null,i=null},setSubmenu:function(){const e=this.util.createElement("DIV");return e.className="se-submenu se-selector-table",e.innerHTML='
    1 x 1
    ',e},setController_table:function(){const e=this.lang,t=this.icons,n=this.util.createElement("DIV");return n.className="se-controller se-controller-table",n.innerHTML='
    ",n},setController_tableEditor:function(e){const t=this.lang,n=this.icons,i=this.util.createElement("DIV");return i.className="se-controller se-controller-table-cell",i.innerHTML=(e?"":'
    ')+'
    • '+t.controller.VerticalSplit+'
    • '+t.controller.HorizontalSplit+"
    ",i},appendTable:function(){const e=this.util.createElement("TABLE"),t=this.plugins.table.createCells,n=this.context.table._tableXY[0];let i=this.context.table._tableXY[1],l="";for(;i>0;)l+=""+t.call(this,"td",n)+"",--i;l+="",e.innerHTML=l;if(this.insertComponent(e,!1,!0,!1)){const t=e.querySelector("td div");this.setRange(t,0,t,0),this.plugins.table.reset_table_picker.call(this)}},createCells:function(e,t,n){if(e=e.toLowerCase(),n){const t=this.util.createElement(e);return t.innerHTML="

    ",t}{let n="";for(;t>0;)n+="<"+e+">

    ",t--;return n}},onMouseMove_tablePicker:function(e,t){t.stopPropagation();let n=this._w.Math.ceil(t.offsetX/18),i=this._w.Math.ceil(t.offsetY/18);n=n<1?1:n,i=i<1?1:i,e._rtl&&(e.tableHighlight.style.left=18*n-13+"px",n=11-n),e.tableHighlight.style.width=n+"em",e.tableHighlight.style.height=i+"em",this.util.changeTxt(e.tableDisplay,n+" x "+i),e._tableXY=[n,i]},reset_table_picker:function(){if(!this.context.table.tableHighlight)return;const e=this.context.table.tableHighlight.style,t=this.context.table.tableUnHighlight.style;e.width="1em",e.height="1em",t.width="10em",t.height="10em",this.util.changeTxt(this.context.table.tableDisplay,"1 x 1"),this.submenuOff()},init:function(){const e=this.context.table,t=this.plugins.table;if(t._removeEvents.call(this),t._selectedTable){const e=t._selectedTable.querySelectorAll(".se-table-selected-cell");for(let t=0,n=e.length;t0)for(let e,t=0;to||(u>=e.index?(i+=e.cs,u+=e.cs,e.rs-=1,e.row=o+1,e.rs<1&&(r.splice(t,1),t--)):h===g-1&&(e.rs-=1,e.row=o+1,e.rs<1&&(r.splice(t,1),t--)));if(o===s&&h===l){n._logical_cellIndex=u;break}d>0&&a.push({index:u,cs:c+1,rs:d,row:-1}),i+=c}r=r.concat(a).sort((function(e,t){return e.index-t.index})),a=[]}a=null,r=null}},editTable:function(e,t){const n=this.plugins.table,i=this.context.table,l=i._element,o="row"===e;if(o){const e=i._trElement.parentNode;if(/^THEAD$/i.test(e.nodeName)){if("up"===t)return;if(!e.nextElementSibling||!/^TBODY$/i.test(e.nextElementSibling.nodeName))return void(l.innerHTML+=""+n.createCells.call(this,"td",i._logical_cellCnt,!1)+"")}}if(n._ref){const e=i._tdElement,l=n._selectedCells;if(o)if(t)n.setCellInfo.call(this,"up"===t?l[0]:l[l.length-1],!0),n.editRow.call(this,t,e);else{let e=l[0].parentNode;const i=[l[0]];for(let t,n=1,o=l.length;ns&&s>t&&(e[l].rowSpan=n+a,c-=i)}if(i){const e=r[o+1];if(e){const t=[];let n=r[o].cells,i=0;for(let e,l,o=0,s=n.length;o1&&(e.rowSpan-=1,t.push({cell:e.cloneNode(!1),index:l}));if(t.length>0){let l=t.shift();n=e.cells,i=0;for(let o,s,a=0,r=n.length;a=l.index)||(a--,i--,i+=l.cell.colSpan-1,e.insertBefore(l.cell,o),l=t.shift(),l));a++);if(l){e.appendChild(l.cell);for(let n=0,i=t.length;n0){const e=!o[b+1];for(let t,n=0;n_||(p>=t.index?(f+=t.cs,p=b+f,t.rs-=1,t.row=_+1,t.rs<1&&(d.splice(n,1),n--)):e&&(t.rs-=1,t.row=_+1,t.rs<1&&(d.splice(n,1),n--)))}n>0&&c.push({rs:n,cs:r+1,index:p,row:-1}),p>=t&&p+r<=t+s?h.push(e):p<=t+s&&p+r>=t?e.colSpan-=i.getOverlapRangeAtIndex(a,a+s,p,p+r):n>0&&(pt+s)&&g.push({cell:e,i:_,rs:_+n}),f+=r}else{if(b>=t)break;if(r>0){if(u<1&&r+b>=t){e.colSpan+=1,t=null,u=n+1;break}t-=r}if(!m){for(let e,n=0;n0){u-=1;continue}null!==t&&o.length>0&&(p=this.plugins.table.createCells.call(this,o[0].nodeName,0,!0),p=e.insertBefore(p,o[t]))}}if(l){let e,t;for(let n,l=0,o=h.length;l1)c.colSpan=this._w.Math.floor(e/2),l.colSpan=e-c.colSpan,s.insertBefore(c,l.nextElementSibling);else{let t=[],n=[];for(let s,r,c=0,d=i._rowCnt;c0)for(let e,t=0;tc||(u>=e.index?(r+=e.cs,u+=e.cs,e.rs-=1,e.row=c+1,e.rs<1&&(n.splice(t,1),t--)):h===g-1&&(e.rs-=1,e.row=c+1,e.rs<1&&(n.splice(t,1),t--)));if(u<=a&&d>0&&t.push({index:u,cs:o+1,rs:d,row:-1}),i!==l&&u<=a&&u+o>=a+e-1){i.colSpan+=1;break}if(u>a)break;r+=o}n=n.concat(t).sort((function(e,t){return e.index-t.index})),t=[]}s.insertBefore(c,l.nextElementSibling)}}else{const e=l.rowSpan;if(c.colSpan=l.colSpan,e>1){c.rowSpan=this._w.Math.floor(e/2);const n=e-c.rowSpan,i=[],r=t.getArrayIndex(o,s)+n;for(let e,t,n=0;n=a));c++)l=e[c],o=l.rowSpan-1,o>0&&o+n>=r&&s=h.index&&(r+=h.cs,l+=h.cs,h=i.shift()),l>=a||o===s-1){d.insertBefore(c,e.nextElementSibling);break}r+=t}l.rowSpan=n}else{c.rowSpan=l.rowSpan;const e=t.createElement("TR");e.appendChild(c);for(let e,t=0;t=r&&(e[n].rowSpan+=1)}const n=i._physical_cellIndex,a=s.cells;for(let e=0,t=a.length;e0&&s+o>=i&&(e.rowSpan-=n.getOverlapRangeAtIndex(i,l,s,s+o));else o.push(e[s]);for(let e=0,t=o.length;e"+this.plugins.table.createCells.call(this,"th",this.context.table._logical_cellCnt,!1)+"",i.insertBefore(t,i.firstElementChild)}e.toggleClass(t,"active"),/TH/i.test(this.context.table._tdElement.nodeName)?this.controllersOff():this.plugins.table.setPositionControllerDiv.call(this,this.context.table._tdElement,!1)},setTableStyle:function(e){const t=this.context.table,n=t._element;let i,l,o,s;e.indexOf("width")>-1&&(i=t.resizeButton.firstElementChild,l=t.resizeText,t._maxWidth?(o=t.icons.reduction,s=t.minText,t.columnFixedButton.style.display="block",this.util.removeClass(n,"se-table-size-auto"),this.util.addClass(n,"se-table-size-100")):(o=t.icons.expansion,s=t.maxText,t.columnFixedButton.style.display="none",this.util.removeClass(n,"se-table-size-100"),this.util.addClass(n,"se-table-size-auto")),this.util.changeElement(i,o),this.util.changeTxt(l,s)),e.indexOf("column")>-1&&(t._fixedColumn?(this.util.removeClass(n,"se-table-layout-auto"),this.util.addClass(n,"se-table-layout-fixed"),this.util.addClass(t.columnFixedButton,"active")):(this.util.removeClass(n,"se-table-layout-fixed"),this.util.addClass(n,"se-table-layout-auto"),this.util.removeClass(t.columnFixedButton,"active")))},setActiveButton:function(e,t){const n=this.context.table;/^TH$/i.test(e.nodeName)?(n.insertRowAboveButton.setAttribute("disabled",!0),n.insertRowBelowButton.setAttribute("disabled",!0)):(n.insertRowAboveButton.removeAttribute("disabled"),n.insertRowBelowButton.removeAttribute("disabled")),t&&e!==t?(n.splitButton.setAttribute("disabled",!0),n.mergeButton.removeAttribute("disabled")):(n.splitButton.removeAttribute("disabled"),n.mergeButton.setAttribute("disabled",!0))},_bindOnSelect:null,_bindOffSelect:null,_bindOffShift:null,_selectedCells:null,_shift:!1,_fixedCell:null,_fixedCellName:null,_selectedCell:null,_selectedTable:null,_ref:null,_toggleEditor:function(e){this.context.element.wysiwyg.setAttribute("contenteditable",e),e?this.util.removeClass(this.context.element.wysiwyg,"se-disabled"):this.util.addClass(this.context.element.wysiwyg,"se-disabled")},_offCellMultiSelect:function(e){e.stopPropagation();const t=this.plugins.table;t._shift?t._initBind&&(this._wd.removeEventListener("touchmove",t._initBind),t._initBind=null):(t._removeEvents.call(this),t._toggleEditor.call(this,!0)),t._fixedCell&&t._selectedTable&&(t.setActiveButton.call(this,t._fixedCell,t._selectedCell),t.call_controller_tableEdit.call(this,t._selectedCell||t._fixedCell),t._selectedCells=t._selectedTable.querySelectorAll(".se-table-selected-cell"),t._selectedCell&&t._fixedCell&&this.focusEdge(t._selectedCell),t._shift||(t._fixedCell=null,t._selectedCell=null,t._fixedCellName=null))},_onCellMultiSelect:function(e){this._antiBlur=!0;const t=this.plugins.table,n=this.util.getParentElement(e.target,this.util.isCell);if(t._shift)n===t._fixedCell?t._toggleEditor.call(this,!0):t._toggleEditor.call(this,!1);else if(!t._ref){if(n===t._fixedCell)return;t._toggleEditor.call(this,!1)}n&&n!==t._selectedCell&&t._fixedCellName===n.nodeName&&t._selectedTable===this.util.getParentElement(n,"TABLE")&&(t._selectedCell=n,t._setMultiCells.call(this,t._fixedCell,n))},_setMultiCells:function(e,t){const n=this.plugins.table,i=n._selectedTable.rows,l=this.util,o=n._selectedTable.querySelectorAll(".se-table-selected-cell");for(let e=0,t=o.length;e0)for(let e,t=0;td||(u>=e.index?(o+=e.cs,u+=e.cs,e.rs-=1,e.row=d+1,e.rs<1&&(a.splice(t,1),t--)):p===m-1&&(e.rs-=1,e.row=d+1,e.rs<1&&(a.splice(t,1),t--)));if(s){if(i!==e&&i!==t||(c.cs=null!==c.cs&&c.csu+h?c.ce:u+h,c.rs=null!==c.rs&&c.rsd+g?c.re:d+g,c._i+=1),2===c._i){s=!1,a=[],r=[],d=-1;break}}else if(l.getOverlapRangeAtIndex(c.cs,c.ce,u,u+h)&&l.getOverlapRangeAtIndex(c.rs,c.re,d,d+g)){const e=c.csu+h?c.ce:u+h,n=c.rsd+g?c.re:d+g;if(c.cs!==e||c.ce!==t||c.rs!==n||c.re!==o){c.cs=e,c.ce=t,c.rs=n,c.re=o,d=-1,a=[],r=[];break}l.addClass(i,"se-table-selected-cell")}g>0&&r.push({index:u,cs:h+1,rs:g,row:-1}),o+=i.colSpan-1}a=a.concat(r).sort((function(e,t){return e.index-t.index})),r=[]}},_removeEvents:function(){const e=this.plugins.table;e._initBind&&(this._wd.removeEventListener("touchmove",e._initBind),e._initBind=null),e._bindOnSelect&&(this._wd.removeEventListener("mousedown",e._bindOnSelect),this._wd.removeEventListener("mousemove",e._bindOnSelect),e._bindOnSelect=null),e._bindOffSelect&&(this._wd.removeEventListener("mouseup",e._bindOffSelect),e._bindOffSelect=null),e._bindOffShift&&(this._wd.removeEventListener("keyup",e._bindOffShift),e._bindOffShift=null)},_initBind:null,onTableCellMultiSelect:function(e,t){const n=this.plugins.table;n._removeEvents.call(this),this.controllersOff(),n._shift=t,n._fixedCell=e,n._fixedCellName=e.nodeName,n._selectedTable=this.util.getParentElement(e,"TABLE");const i=n._selectedTable.querySelectorAll(".se-table-selected-cell");for(let e=0,t=i.length;e-1?(n=e.toLowerCase(),s="blockquote"===n?"range":"pre"===n?"free":"replace",r=/^h/.test(n)?n.match(/\d+/)[0]:"",a=t["tag_"+(r?"h":n)]+r,d="",c=""):(n=e.tag.toLowerCase(),s=e.command,a=e.name||n,d=e.class,c=d?' class="'+d+'"':""),o+='
  • ";return o+="",n.innerHTML=o,n},active:function(e){let t=this.lang.toolbar.formats;const n=this.context.formatBlock.targetText,i=this.context.formatBlock.targetTooltip;if(e){if(this.util.isFormatElement(e)){const l=this.context.formatBlock._formatList,o=e.nodeName.toLowerCase(),s=(e.className.match(/(\s|^)__se__format__[^\s]+/)||[""])[0].trim();for(let e,n=0,i=l.length;n=0;u--)if(i=p[u],i!==(p[u+1]?p[u+1].parentNode:null)){if(d=r.isComponent(i),o=d?"":i.innerHTML.replace(/(?!>)\s+(?=<)|\n/g," "),s=r.getParentElement(i,(function(e){return e.parentNode===t})),(t!==i.parentNode||d)&&(r.isFormatElement(t)?(t.parentNode.insertBefore(n,t.nextSibling),t=t.parentNode):(t.insertBefore(n,s?s.nextSibling:null),t=i.parentNode),a=n.nextSibling,a&&n.nodeName===a.nodeName&&r.isSameAttributes(n,a)&&(n.innerHTML+="
    "+a.innerHTML,r.removeItem(a)),n=l.cloneNode(!1),h=!0),c=n.innerHTML,n.innerHTML=(h||!o||!c||/
    $/i.test(o)?o:o+"
    ")+c,0===u){t.insertBefore(n,i),a=i.nextSibling,a&&n.nodeName===a.nodeName&&r.isSameAttributes(n,a)&&(n.innerHTML+="
    "+a.innerHTML,r.removeItem(a));const e=n.previousSibling;e&&n.nodeName===e.nodeName&&r.isSameAttributes(n,e)&&(e.innerHTML+="
    "+n.innerHTML,r.removeItem(n))}d||r.removeItem(i),o&&(h=!1)}this.setRange(i,0,i,0)}else{for(let e,t,n=0,s=p.length;n('+t.toolbar.default+")";for(let e,t=0,n=i.length;t";return l+="",n.innerHTML=l,n},on:function(){const e=this.context.lineHeight,t=e._sizeList,n=this.util.getFormatElement(this.getSelectionNode()),i=n?n.style.lineHeight+"":"";if(i!==e.currentSize){for(let e=0,n=t.length;e"}return o+="",t.innerHTML=o,t},on:function(){const e=this.context.paragraphStyle._classList,t=this.util.getFormatElement(this.getSelectionNode());for(let n=0,i=e.length;n"}return l+="",t.innerHTML=l,t},on:function(){const e=this.util,t=this.context.textStyle._styleList,n=this.getSelectionNode();for(let i,l,o,s=0,a=t.length;s'+(e.alt||t)+'
    '+(e.name||t)+"
    "},setImage:function(e){this.callPlugin("image",function(){const t={name:e.parentNode.querySelector(".__se__img_name").textContent,size:0};this.context.image._altText=e.alt,this.plugins.image.create_image.call(this,e.src,"",!1,this.context.image._origin_w,this.context.image._origin_h,"none",t)}.bind(this),null)}}},x={rtl:{bold:'',italic:'',indent:'',outdent:'',list_bullets:'',list_number:'',link:'',unlink:''},redo:'',undo:'',bold:'',underline:'',italic:'',strike:'',subscript:'',superscript:'',erase:'',indent:'',outdent:'',expansion:'',reduction:'',code_view:'',preview:'',print:'',template:'',line_height:'',paragraph_style:'',text_style:'',save:'',blockquote:'',arrow_down:'',align_justify:'',align_left:'',align_right:'',align_center:'',font_color:'',highlight_color:'',list_bullets:'',list_number:'',table:'',horizontal_rule:'',show_blocks:'',cancel:'',image:'',video:'',link:'',math:'',unlink:'',table_header:'',merge_cell:'',split_cell:'',caption:'',edit:'',delete:'',modify:'',revert:'',auto_size:'',insert_row_below:'',insert_row_above:'',insert_column_left:'',insert_column_right:'',delete_row:'',delete_column:'',fixed_column_width:'',rotate_left:'',rotate_right:'',mirror_horizontal:'',mirror_vertical:'',checked:'',line_break:'',audio:'',image_gallery:'',more_text:'',more_paragraph:'',more_plus:'',more_horizontal:'',more_vertical:'',attachment:'',map:'',magic_stick:'',empty_file:''},E=n("P6u4"),S=n.n(E);const N={_d:null,_w:null,isIE:null,isIE_Edge:null,isOSX_IOS:null,_propertiesInit:function(){this._d||(this._d=document,this._w=window,this.isIE=navigator.userAgent.indexOf("Trident")>-1,this.isIE_Edge=navigator.userAgent.indexOf("Trident")>-1||navigator.appVersion.indexOf("Edge")>-1,this.isOSX_IOS=/(Mac|iPhone|iPod|iPad)/.test(navigator.platform))},_HTMLConvertor:function(e){const t={"&":"&"," ":" ","'":"'",'"':""","<":"<",">":">"};return e.replace(/&|\u00A0|'|"|<|>/g,(function(e){return"string"==typeof t[e]?t[e]:e}))},zeroWidthSpace:String.fromCharCode(8203),zeroWidthRegExp:new RegExp(String.fromCharCode(8203),"g"),onlyZeroWidthRegExp:new RegExp("^"+String.fromCharCode(8203)+"+$"),onlyZeroWidthSpace:function(e){return"string"!=typeof e&&(e=e.textContent),""===e||this.onlyZeroWidthRegExp.test(e)},getXMLHttpRequest:function(){if(!this._w.ActiveXObject)return this._w.XMLHttpRequest?new XMLHttpRequest:null;try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(e){try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(e){return null}}},createElement:function(e){return this._d.createElement(e)},createTextNode:function(e){return this._d.createTextNode(e||"")},HTMLEncoder:function(e){const t={"<":"$lt;",">":"$gt;"};return e.replace(/<|>/g,(function(e){return"string"==typeof t[e]?t[e]:e}))},HTMLDecoder:function(e){const t={"$lt;":"<","$gt;":">"};return e.replace(/\$lt;|\$gt;/g,(function(e){return"string"==typeof t[e]?t[e]:e}))},hasOwn:function(e,t){return this._hasOwn.call(e,t)},_hasOwn:Object.prototype.hasOwnProperty,getIncludePath:function(e,t){let n="";const i=[],l="js"===t?"script":"link",o="js"===t?"src":"href";let s="(?:";for(let t=0,n=e.length;t0?i[0][o]:""),-1===n.indexOf(":/")&&"//"!==n.slice(0,2)&&(n=0===n.indexOf("/")?location.href.match(/^.*?:\/\/[^\/]*/)[0]+n:location.href.match(/^[^\?]*\/(?:)/)[0]+n),!n)throw"[SUNEDITOR.util.getIncludePath.fail] The SUNEDITOR installation path could not be automatically detected. (name: +"+name+", extension: "+t+")";return n},getPageStyle:function(e){let t="";const n=(e||this._d).styleSheets;for(let e,i=0,l=n.length;i-1||(i+=n[e].name+'="'+n[e].value+'" ');return i},getByteLength:function(e){const t=this._w.encodeURIComponent;let n,i;return this.isIE_Edge?(i=this._w.unescape(t(e.toString())).length,n=0,null!==t(e.toString()).match(/(%0A|%0D)/gi)&&(n=t(e.toString()).match(/(%0A|%0D)/gi).length),i+n):(i=new this._w.TextEncoder("utf-8").encode(e.toString()).length,n=0,null!==t(e.toString()).match(/(%0A|%0D)/gi)&&(n=t(e.toString()).match(/(%0A|%0D)/gi).length),i+n)},isWysiwygDiv:function(e){return e&&1===e.nodeType&&(this.hasClass(e,"se-wrapper-wysiwyg")||/^BODY$/i.test(e.nodeName))},isNonEditable:function(e){return e&&1===e.nodeType&&"false"===e.getAttribute("contenteditable")},isTextStyleElement:function(e){return e&&3!==e.nodeType&&/^(strong|span|font|b|var|i|em|u|ins|s|strike|del|sub|sup|mark|a|label|code)$/i.test(e.nodeName)},isFormatElement:function(e){return e&&1===e.nodeType&&(/^(P|DIV|H[1-6]|PRE|LI|TH|TD)$/i.test(e.nodeName)||this.hasClass(e,"(\\s|^)__se__format__replace_.+(\\s|$)|(\\s|^)__se__format__free_.+(\\s|$)"))&&!this.isComponent(e)&&!this.isWysiwygDiv(e)},isRangeFormatElement:function(e){return e&&1===e.nodeType&&(/^(BLOCKQUOTE|OL|UL|FIGCAPTION|TABLE|THEAD|TBODY|TR|TH|TD)$/i.test(e.nodeName)||this.hasClass(e,"(\\s|^)__se__format__range_.+(\\s|$)"))},isClosureRangeFormatElement:function(e){return e&&1===e.nodeType&&(/^(TH|TD)$/i.test(e.nodeName)||this.hasClass(e,"(\\s|^)__se__format__range__closure_.+(\\s|$)"))},isFreeFormatElement:function(e){return e&&1===e.nodeType&&(/^PRE$/i.test(e.nodeName)||this.hasClass(e,"(\\s|^)__se__format__free_.+(\\s|$)"))&&!this.isComponent(e)&&!this.isWysiwygDiv(e)},isClosureFreeFormatElement:function(e){return e&&1===e.nodeType&&this.hasClass(e,"(\\s|^)__se__format__free__closure_.+(\\s|$)")},isComponent:function(e){return e&&(/se-component/.test(e.className)||/^(TABLE|HR)$/.test(e.nodeName))},isMediaComponent:function(e){return e&&/se-component/.test(e.className)},isNotCheckingNode:function(e){return e&&/katex|__se__tag/.test(e.className)},getFormatElement:function(e,t){if(!e)return null;for(t||(t=function(){return!0});e;){if(this.isWysiwygDiv(e))return null;if(this.isRangeFormatElement(e)&&e.firstElementChild,this.isFormatElement(e)&&t(e))return e;e=e.parentNode}return null},getRangeFormatElement:function(e,t){if(!e)return null;for(t||(t=function(){return!0});e;){if(this.isWysiwygDiv(e))return null;if(this.isRangeFormatElement(e)&&!/^(THEAD|TBODY|TR)$/i.test(e.nodeName)&&t(e))return e;e=e.parentNode}return null},getFreeFormatElement:function(e,t){if(!e)return null;for(t||(t=function(){return!0});e;){if(this.isWysiwygDiv(e))return null;if(this.isFreeFormatElement(e)&&t(e))return e;e=e.parentNode}return null},getClosureFreeFormatElement:function(e,t){if(!e)return null;for(t||(t=function(){return!0});e;){if(this.isWysiwygDiv(e))return null;if(this.isClosureFreeFormatElement(e)&&t(e))return e;e=e.parentNode}return null},copyTagAttributes:function(e,t){t.style.cssText&&(e.style.cssText+=t.style.cssText);const n=t.classList;for(let t=0,i=n.length;ts?1:o0&&!this.isBreak(e);)e=e.firstChild;for(;t&&1===t.nodeType&&t.childNodes.length>0&&!this.isBreak(t);)t=t.lastChild;return{sc:e,ec:t||e}}},getOffset:function(e,t){let n=0,i=0,l=3===e.nodeType?e.parentElement:e;const o=this.getParentElement(e,this.isWysiwygDiv.bind(this));for(;l&&!this.hasClass(l,"se-container")&&l!==o;)n+=l.offsetLeft,i+=l.offsetTop,l=l.offsetParent;const s=t&&/iframe/i.test(t.nodeName);return{left:n+(s?t.parentElement.offsetLeft:0),top:i-o.scrollTop+(s?t.parentElement.offsetTop:0)}},getOverlapRangeAtIndex:function(e,t,n,i){if(e<=i?tn)return 0;const l=(e>n?e:n)-(t0?" ":"")+t)},removeClass:function(e,t){if(!e)return;const n=new this._w.RegExp("(\\s|^)"+t+"(\\s|$)");e.className=e.className.replace(n," ").trim(),e.className.trim()||e.removeAttribute("class")},toggleClass:function(e,t){if(!e)return;const n=new this._w.RegExp("(\\s|^)"+t+"(\\s|$)");n.test(e.className)?e.className=e.className.replace(n," ").trim():e.className+=" "+t,e.className.trim()||e.removeAttribute("class")},setDisabledButtons:function(e,t){for(let n=0,i=t.length;n=0){e.splitText(t);const n=this.getNodeFromPath([a+1],i);this.onlyZeroWidthSpace(n)&&(n.data=this.zeroWidthSpace)}}else 1===e.nodeType&&(e.previousSibling?e=e.previousSibling:this.getElementDepth(e)===n&&(r=!1));let c=e;for(;this.getElementDepth(c)>n;)for(a=this.getPositionIndex(c)+1,c=c.parentNode,s=l,l=c.cloneNode(!1),o=c.childNodes,s&&(this.isListCell(l)&&this.isList(s)&&s.firstElementChild?(l.innerHTML=s.firstElementChild.innerHTML,N.removeItem(s.firstElementChild),s.children.length>0&&l.appendChild(s)):l.appendChild(s));o[a];)l.appendChild(o[a]);c.childNodes.length<=1&&(!c.firstChild||0===c.firstChild.textContent.length)&&(c.innerHTML="
    ");const d=c.parentNode;return r&&(c=c.nextSibling),l?(this.mergeSameTags(l,null,!1),this.mergeNestedTags(l,function(e){return this.isList(e)}.bind(this)),l.childNodes.length>0?d.insertBefore(l,c):l=c,0===i.childNodes.length&&this.removeItem(i),l):c},mergeSameTags:function(e,t,n){const i=this,l=t?t.length:0;let o=null;return l&&(o=this._w.Array.apply(null,new this._w.Array(l)).map(this._w.Number.prototype.valueOf,0)),function e(s,a,r){const c=s.childNodes;for(let d,u,h=0,g=c.length;h=0;){if(i.getArrayIndex(o.childNodes,n)!==e[r]){c=!1;break}n=d.parentNode,o=n.parentNode,r--}c&&(e.splice(a,1),e[a]=h)}}i.copyTagAttributes(d,s),s.parentNode.insertBefore(d,s),i.removeItem(s)}if(!u){1===d.nodeType&&e(d,a+1,h);break}if(d.nodeName===u.nodeName&&i.isSameAttributes(d,u)&&d.href===u.href){const e=d.childNodes;let n=0;for(let t=0,i=e.length;t0&&n++;const s=d.lastChild,c=u.firstChild;let g=0;if(s&&c){const e=3===s.nodeType&&3===c.nodeType;g=s.textContent.length;let i=s.previousSibling;for(;i&&3===i.nodeType;)g+=i.textContent.length,i=i.previousSibling;if(n>0&&3===s.nodeType&&3===c.nodeType&&(s.textContent.length>0||c.textContent.length>0)&&n--,l){let i=null;for(let d=0;dh){if(a>0&&i[a-1]!==r)continue;i[a]-=1,i[a+1]>=0&&i[a]===h&&(i[a+1]+=n,e&&s&&3===s.nodeType&&c&&3===c.nodeType&&(o[d]+=g))}}}if(3===d.nodeType){if(g=d.textContent.length,d.textContent+=u.textContent,l){let e=null;for(let i=0;ih){if(a>0&&e[a-1]!==r)continue;e[a]-=1,e[a+1]>=0&&e[a]===h&&(e[a+1]+=n,o[i]+=g)}}}else d.innerHTML+=u.innerHTML;i.removeItem(u),h--}else 1===d.nodeType&&e(d,a+1,h)}}(e,0,0),o},mergeNestedTags:function(e,t){"string"==typeof t?t=function(e){return this.test(e.tagName)}.bind(new this._w.RegExp("^("+(t||".+")+")$","i")):"function"!=typeof t&&(t=function(){return!0}),function e(n){let i=n.children;if(1===i.length&&i[0].nodeName===n.nodeName&&t(n)){const e=i[0];for(i=e.children;i[0];)n.appendChild(i[0]);n.removeChild(e)}for(let t=0,i=n.children.length;t")},htmlRemoveWhiteSpace:function(e){return e?e.trim().replace(/<\/?(?!strong|span|font|b|var|i|em|u|ins|s|strike|del|sub|sup|mark|a|label|code)[^>^<]+>\s+(?=<)/gi,(function(e){return e.trim()})):""},sortByDepth:function(e,t){const n=t?1:-1,i=-1*n;e.sort(function(e,t){return this.isListCell(e)&&this.isListCell(t)?(e=this.getElementDepth(e))>(t=this.getElementDepth(t))?n:e":e.innerHTML,e.innerHTML=t.outerHTML},_setDefaultOptionStyle:function(e,t){let n="";e.height&&(n+="height:"+e.height+";"),e.minHeight&&(n+="min-height:"+e.minHeight+";"),e.maxHeight&&(n+="max-height:"+e.maxHeight+";"),e.position&&(n+="position:"+e.position+";"),e.width&&(n+="width:"+e.width+";"),e.minWidth&&(n+="min-width:"+e.minWidth+";"),e.maxWidth&&(n+="max-width:"+e.maxWidth+";");let i="",l="",o="";const s=(t=n+t).split(";");for(let t,n=0,a=s.length;n'+this._setIframeCssTags(t),e.contentDocument.body.className="sun-editor-editable",e.contentDocument.body.setAttribute("contenteditable",!0)},_setIframeCssTags:function(e){const t=e.iframeCSSFileName,n=this._w.RegExp;let i="";for(let e,l=0,o=t.length;l'}return i+("auto"===e.height?"":"")}};var L=N,T={init:function(e,t){"object"!=typeof t&&(t={});const n=document;this._initOptions(e,t);const i=n.createElement("DIV");i.className="sun-editor"+(t.rtl?" se-rtl":""),e.id&&(i.id="suneditor_"+e.id);const l=n.createElement("DIV");l.className="se-container";const o=this._createToolBar(n,t.buttonList,t.plugins,t);o.element.style.visibility="hidden",o.pluginCallButtons.math&&this._checkKatexMath(t.katex);const s=n.createElement("DIV");s.className="se-arrow";const a=n.createElement("DIV");a.className="se-toolbar-sticky-dummy";const r=n.createElement("DIV");r.className="se-wrapper";const c=this._initElements(t,i,o.element,s),d=c.bottomBar,u=c.wysiwygFrame,h=c.placeholder;let g=c.codeView;const p=d.resizingBar,m=d.navigation,f=d.charWrapper,_=d.charCounter,b=n.createElement("DIV");b.className="se-loading-box sun-editor-common",b.innerHTML='
    ';const v=n.createElement("DIV");v.className="se-line-breaker",v.innerHTML='";const y=n.createElement("DIV");y.className+="se-line-breaker-component";const C=y.cloneNode(!0);y.innerHTML=C.innerHTML=t.icons.line_break;const w=n.createElement("DIV");w.className="se-resizing-back";const x=t.toolbarContainer;return x&&x.appendChild(o.element),r.appendChild(g),h&&r.appendChild(h),x||l.appendChild(o.element),l.appendChild(a),l.appendChild(r),l.appendChild(w),l.appendChild(b),l.appendChild(v),l.appendChild(y),l.appendChild(C),p&&l.appendChild(p),i.appendChild(l),g=this._checkCodeMirror(t,g),{constructed:{_top:i,_relative:l,_toolBar:o.element,_menuTray:o._menuTray,_editorArea:r,_wysiwygArea:u,_codeArea:g,_placeholder:h,_resizingBar:p,_navigation:m,_charWrapper:f,_charCounter:_,_loading:b,_lineBreaker:v,_lineBreaker_t:y,_lineBreaker_b:C,_resizeBack:w,_stickyDummy:a,_arrow:s},options:t,plugins:o.plugins,pluginCallButtons:o.pluginCallButtons,_responsiveButtons:o.responsiveButtons}},_checkCodeMirror:function(e,t){if(e.codeMirror){const n=[{mode:"htmlmixed",htmlMode:!0,lineNumbers:!0,lineWrapping:!0},e.codeMirror.options||{}].reduce((function(e,t){for(let n in t)L.hasOwn(t,n)&&(e[n]=t[n]);return e}),{});"auto"===e.height&&(n.viewportMargin=1/0,n.height="auto");const i=e.codeMirror.src.fromTextArea(t,n);i.display.wrapper.style.cssText=t.style.cssText,e.codeMirrorEditor=i,(t=i.display.wrapper).className+=" se-wrapper-code-mirror"}return t},_checkKatexMath:function(e){if(!e)throw Error('[SUNEDITOR.create.fail] To use the math button you need to add a "katex" object to the options.');const t=[{throwOnError:!1},e.options||{}].reduce((function(e,t){for(let n in t)L.hasOwn(t,n)&&(e[n]=t[n]);return e}),{});e.options=t},_setOptions:function(e,t,n,i){this._initOptions(t.element.originElement,e);const l=t.element,o=l.relative,s=l.editorArea,a=e.toolbarContainer&&e.toolbarContainer!==i.toolbarContainer,r=!!e.buttonList||e.mode!==i.mode||a,c=!!e.plugins,d=this._createToolBar(document,r?e.buttonList:i.buttonList,c?e.plugins:n,e);d.pluginCallButtons.math&&this._checkKatexMath(e.katex);const u=document.createElement("DIV");u.className="se-arrow",r&&(d.element.style.visibility="hidden",a?(e.toolbarContainer.appendChild(d.element),l.toolbar.parentElement.removeChild(l.toolbar)):l.toolbar.parentElement.replaceChild(d.element,l.toolbar),l.toolbar=d.element,l._menuTray=d._menuTray,l._arrow=u);const h=this._initElements(e,l.topArea,r?d.element:l.toolbar,u),g=h.bottomBar,p=h.wysiwygFrame,m=h.placeholder;let f=h.codeView;return l.resizingBar&&o.removeChild(l.resizingBar),g.resizingBar&&o.appendChild(g.resizingBar),s.innerHTML="",s.appendChild(f),m&&s.appendChild(m),f=this._checkCodeMirror(e,f),l.resizingBar=g.resizingBar,l.navigation=g.navigation,l.charWrapper=g.charWrapper,l.charCounter=g.charCounter,l.wysiwygFrame=p,l.code=f,l.placeholder=m,e.rtl?L.addClass(l.topArea,"se-rtl"):L.removeClass(l.topArea,"se-rtl"),{callButtons:r?d.pluginCallButtons:null,plugins:r||c?d.plugins:null,toolbar:d}},_initElements:function(e,t,n,i){t.style.cssText=e._editorStyles.top,/inline/i.test(e.mode)?(n.className+=" se-toolbar-inline",n.style.width=e.toolbarWidth):/balloon/i.test(e.mode)&&(n.className+=" se-toolbar-balloon",n.style.width=e.toolbarWidth,n.appendChild(i));const l=document.createElement(e.iframe?"IFRAME":"DIV");l.className="se-wrapper-inner se-wrapper-wysiwyg",e.iframe?(l.allowFullscreen=!0,l.frameBorder=0,l.style.cssText=e._editorStyles.frame):(l.setAttribute("contenteditable",!0),l.setAttribute("scrolling","auto"),l.className+=" sun-editor-editable"+(e.rtl?" se-rtl":""),l.style.cssText=e._editorStyles.frame+e._editorStyles.editor);const o=document.createElement("TEXTAREA");o.className="se-wrapper-inner se-wrapper-code",o.style.cssText=e._editorStyles.frame,o.style.display="none","auto"===e.height&&(o.style.overflow="hidden");let s=null,a=null,r=null,c=null;if(e.resizingBar&&(s=document.createElement("DIV"),s.className="se-resizing-bar sun-editor-common",a=document.createElement("DIV"),a.className="se-navigation sun-editor-common",s.appendChild(a),e.charCounter)){if(r=document.createElement("DIV"),r.className="se-char-counter-wrapper",e.charCounterLabel){const t=document.createElement("SPAN");t.className="se-char-label",t.textContent=e.charCounterLabel,r.appendChild(t)}if(c=document.createElement("SPAN"),c.className="se-char-counter",c.textContent="0",r.appendChild(c),e.maxCharCount>0){const t=document.createElement("SPAN");t.textContent=" / "+e.maxCharCount,r.appendChild(t)}s.appendChild(r)}let d=null;return e.placeholder&&(d=document.createElement("SPAN"),d.className="se-placeholder",d.innerText=e.placeholder),{bottomBar:{resizingBar:s,navigation:a,charWrapper:r,charCounter:c},wysiwygFrame:l,codeView:o,placeholder:d}},_initOptions:function(e,t){t.lang=t.lang||S.a,t.value="string"==typeof t.value?t.value:null,t.historyStackDelayTime="number"==typeof t.historyStackDelayTime?t.historyStackDelayTime:400,t._defaultTagsWhitelist="string"==typeof t._defaultTagsWhitelist?t._defaultTagsWhitelist:"br|p|div|pre|blockquote|h[1-6]|ol|ul|li|hr|figure|figcaption|img|iframe|audio|video|source|table|thead|tbody|tr|th|td|a|b|strong|var|i|em|u|ins|s|span|strike|del|sub|sup|code",t._editorTagsWhitelist=t._defaultTagsWhitelist+("string"==typeof t.addTagsWhitelist&&t.addTagsWhitelist.length>0?"|"+t.addTagsWhitelist:""),t.pasteTagsWhitelist="string"==typeof t.pasteTagsWhitelist?t.pasteTagsWhitelist:t._editorTagsWhitelist,t.attributesWhitelist=t.attributesWhitelist&&"object"==typeof t.attributesWhitelist?t.attributesWhitelist:null,t.mode=t.mode||"classic",t.rtl=!!t.rtl,t.toolbarWidth=t.toolbarWidth?L.isNumber(t.toolbarWidth)?t.toolbarWidth+"px":t.toolbarWidth:"auto",t.toolbarContainer=/balloon/i.test(t.mode)?null:"string"==typeof t.toolbarContainer?document.querySelector(t.toolbarContainer):t.toolbarContainer,t.stickyToolbar=/balloon/i.test(t.mode)||t.toolbarContainer?-1:void 0===t.stickyToolbar?0:/^\d+/.test(t.stickyToolbar)?L.getNumber(t.stickyToolbar,0):-1,t.iframe=t.fullPage||t.iframe,t.fullPage=!!t.fullPage,t.iframeCSSFileName=t.iframe?"string"==typeof t.iframeCSSFileName?[t.iframeCSSFileName]:t.iframeCSSFileName||["suneditor"]:null,t.previewTemplate="string"==typeof t.previewTemplate?t.previewTemplate:null,t.codeMirror=t.codeMirror?t.codeMirror.src?t.codeMirror:{src:t.codeMirror}:null,t.katex=t.katex?t.katex.src?t.katex:{src:t.katex}:null,t.position="string"==typeof t.position?t.position:null,t.display=t.display||("none"!==e.style.display&&e.style.display?e.style.display:"block"),t.popupDisplay=t.popupDisplay||"full",t.resizingBar=void 0===t.resizingBar?!/inline|balloon/i.test(t.mode):t.resizingBar,t.showPathLabel=!!t.resizingBar&&("boolean"!=typeof t.showPathLabel||t.showPathLabel),t.charCounter=t.maxCharCount>0||"boolean"==typeof t.charCounter&&t.charCounter,t.charCounterType="string"==typeof t.charCounterType?t.charCounterType:"char",t.charCounterLabel="string"==typeof t.charCounterLabel?t.charCounterLabel.trim():null,t.maxCharCount=L.isNumber(t.maxCharCount)&&t.maxCharCount>-1?1*t.maxCharCount:null,t.width=t.width?L.isNumber(t.width)?t.width+"px":t.width:e.clientWidth?e.clientWidth+"px":"100%",t.minWidth=(L.isNumber(t.minWidth)?t.minWidth+"px":t.minWidth)||"",t.maxWidth=(L.isNumber(t.maxWidth)?t.maxWidth+"px":t.maxWidth)||"",t.height=t.height?L.isNumber(t.height)?t.height+"px":t.height:e.clientHeight?e.clientHeight+"px":"auto",t.minHeight=(L.isNumber(t.minHeight)?t.minHeight+"px":t.minHeight)||"",t.maxHeight=(L.isNumber(t.maxHeight)?t.maxHeight+"px":t.maxHeight)||"",t.defaultStyle="string"==typeof t.defaultStyle?t.defaultStyle:"",t.font=t.font?t.font:null,t.fontSize=t.fontSize?t.fontSize:null,t.formats=t.formats?t.formats:null,t.colorList=t.colorList?t.colorList:null,t.lineHeights=t.lineHeights?t.lineHeights:null,t.paragraphStyles=t.paragraphStyles?t.paragraphStyles:null,t.textStyles=t.textStyles?t.textStyles:null,t.fontSizeUnit="string"==typeof t.fontSizeUnit&&t.fontSizeUnit.trim()||"px",t.imageResizing=void 0===t.imageResizing||t.imageResizing,t.imageHeightShow=void 0===t.imageHeightShow||!!t.imageHeightShow,t.imageWidth=t.imageWidth?L.isNumber(t.imageWidth)?t.imageWidth+"px":t.imageWidth:"auto",t.imageHeight=t.imageHeight?L.isNumber(t.imageHeight)?t.imageHeight+"px":t.imageHeight:"auto",t.imageSizeOnlyPercentage=!!t.imageSizeOnlyPercentage,t._imageSizeUnit=t.imageSizeOnlyPercentage?"%":"px",t.imageRotation=void 0!==t.imageRotation?t.imageRotation:!(t.imageSizeOnlyPercentage||!t.imageHeightShow),t.imageFileInput=void 0===t.imageFileInput||t.imageFileInput,t.imageUrlInput=void 0===t.imageUrlInput||!t.imageFileInput||t.imageUrlInput,t.imageUploadHeader=t.imageUploadHeader||null,t.imageUploadUrl="string"==typeof t.imageUploadUrl?t.imageUploadUrl:null,t.imageUploadSizeLimit=/\d+/.test(t.imageUploadSizeLimit)?L.getNumber(t.imageUploadSizeLimit,0):null,t.imageMultipleFile=!!t.imageMultipleFile,t.imageAccept="string"!=typeof t.imageAccept||"*"===t.imageAccept.trim()?"image/*":t.imageAccept.trim()||"image/*",t.imageGalleryUrl="string"==typeof t.imageGalleryUrl?t.imageGalleryUrl:null,t.videoResizing=void 0===t.videoResizing||t.videoResizing,t.videoHeightShow=void 0===t.videoHeightShow||!!t.videoHeightShow,t.videoRatioShow=void 0===t.videoRatioShow||!!t.videoRatioShow,t.videoWidth=t.videoWidth&&L.getNumber(t.videoWidth,0)?L.isNumber(t.videoWidth)?t.videoWidth+"px":t.videoWidth:"",t.videoHeight=t.videoHeight&&L.getNumber(t.videoHeight,0)?L.isNumber(t.videoHeight)?t.videoHeight+"px":t.videoHeight:"",t.videoSizeOnlyPercentage=!!t.videoSizeOnlyPercentage,t._videoSizeUnit=t.videoSizeOnlyPercentage?"%":"px",t.videoRotation=void 0!==t.videoRotation?t.videoRotation:!(t.videoSizeOnlyPercentage||!t.videoHeightShow),t.videoRatio=L.getNumber(t.videoRatio,4)||.5625,t.videoRatioList=t.videoRatioList?t.videoRatioList:null,t.youtubeQuery=(t.youtubeQuery||"").replace("?",""),t.videoFileInput=!!t.videoFileInput,t.videoUrlInput=void 0===t.videoUrlInput||!t.videoFileInput||t.videoUrlInput,t.videoUploadHeader=t.videoUploadHeader||null,t.videoUploadUrl="string"==typeof t.videoUploadUrl?t.videoUploadUrl:null,t.videoUploadSizeLimit=/\d+/.test(t.videoUploadSizeLimit)?L.getNumber(t.videoUploadSizeLimit,0):null,t.videoMultipleFile=!!t.videoMultipleFile,t.videoTagAttrs=t.videoTagAttrs||null,t.videoIframeAttrs=t.videoIframeAttrs||null,t.videoAccept="string"!=typeof t.videoAccept||"*"===t.videoAccept.trim()?"video/*":t.videoAccept.trim()||"video/*",t.audioWidth=t.audioWidth?L.isNumber(t.audioWidth)?t.audioWidth+"px":t.audioWidth:"",t.audioHeight=t.audioHeight?L.isNumber(t.audioHeight)?t.audioHeight+"px":t.audioHeight:"",t.audioFileInput=!!t.audioFileInput,t.audioUrlInput=void 0===t.audioUrlInput||!t.audioFileInput||t.audioUrlInput,t.audioUploadHeader=t.audioUploadHeader||null,t.audioUploadUrl="string"==typeof t.audioUploadUrl?t.audioUploadUrl:null,t.audioUploadSizeLimit=/\d+/.test(t.audioUploadSizeLimit)?L.getNumber(t.audioUploadSizeLimit,0):null,t.audioMultipleFile=!!t.audioMultipleFile,t.audioTagAttrs=t.audioTagAttrs||null,t.audioAccept="string"!=typeof t.audioAccept||"*"===t.audioAccept.trim()?"audio/*":t.audioAccept.trim()||"audio/*",t.tableCellControllerPosition="string"==typeof t.tableCellControllerPosition?t.tableCellControllerPosition.toLowerCase():"cell",t.tabDisable=!!t.tabDisable,t.shortcutsDisable=Array.isArray(t.shortcutsDisable)&&t.shortcutsDisable.length>0?t.shortcutsDisable.map((function(e){return e.toLowerCase()})):[],t.shortcutsHint=void 0===t.shortcutsHint||!!t.shortcutsHint,t.callBackSave=t.callBackSave?t.callBackSave:null,t.templates=t.templates?t.templates:null,t.placeholder="string"==typeof t.placeholder?t.placeholder:null,t.linkProtocol="string"==typeof t.linkProtocol?t.linkProtocol:null,t.buttonList=t.buttonList||[["undo","redo"],["bold","underline","italic","strike","subscript","superscript"],["removeFormat"],["outdent","indent"],["fullScreen","showBlocks","codeView"],["preview","print"]],t.rtl&&(t.buttonList=t.buttonList.reverse()),t.icons=t.icons&&"object"==typeof t.icons?[x,t.icons].reduce((function(e,t){for(let n in t)L.hasOwn(t,n)&&(e[n]=t[n]);return e}),{}):x,t.icons=t.rtl?[t.icons,t.icons.rtl].reduce((function(e,t){for(let n in t)L.hasOwn(t,n)&&(e[n]=t[n]);return e}),{}):t.icons,t._editorStyles=L._setDefaultOptionStyle(t,t.defaultStyle)},_defaultButtons:function(e){const t=e.icons,n=e.lang,i=L.isOSX_IOS?"⌘":"CTRL",l=e.shortcutsHint?e.shortcutsDisable:["bold","strike","underline","italic","undo","indent"];return{bold:["_se_command_bold",n.toolbar.bold+''+(l.indexOf("bold")>-1?"":" ("+i+"+B)")+"","STRONG","",t.bold],underline:["_se_command_underline",n.toolbar.underline+''+(l.indexOf("underline")>-1?"":" ("+i+"+U)")+"","U","",t.underline],italic:["_se_command_italic",n.toolbar.italic+''+(l.indexOf("italic")>-1?"":" ("+i+"+I)")+"","EM","",t.italic],strike:["_se_command_strike",n.toolbar.strike+''+(l.indexOf("strike")>-1?"":" ("+i+"+SHIFT+S)")+"","DEL","",t.strike],subscript:["_se_command_subscript",n.toolbar.subscript,"SUB","",t.subscript],superscript:["_se_command_superscript",n.toolbar.superscript,"SUP","",t.superscript],removeFormat:["",n.toolbar.removeFormat,"removeFormat","",t.erase],indent:["_se_command_indent",n.toolbar.indent+''+(l.indexOf("indent")>-1?"":" ("+i+"+])")+"","indent","",t.outdent],outdent:["_se_command_outdent",n.toolbar.outdent+''+(l.indexOf("indent")>-1?"":" ("+i+"+[)")+"","outdent","",t.indent],fullScreen:["se-code-view-enabled se-resizing-enabled _se_command_fullScreen",n.toolbar.fullScreen,"fullScreen","",t.expansion],showBlocks:["_se_command_showBlocks",n.toolbar.showBlocks,"showBlocks","",t.show_blocks],codeView:["se-code-view-enabled se-resizing-enabled _se_command_codeView",n.toolbar.codeView,"codeView","",t.code_view],undo:["_se_command_undo se-resizing-enabled",n.toolbar.undo+''+(l.indexOf("undo")>-1?"":" ("+i+"+Z)")+"","undo","",t.undo],redo:["_se_command_redo se-resizing-enabled",n.toolbar.redo+''+(l.indexOf("undo")>-1?"":" ("+i+"+Y / "+i+"+SHIFT+Z)")+"","redo","",t.redo],preview:["se-resizing-enabled",n.toolbar.preview,"preview","",t.preview],print:["se-resizing-enabled",n.toolbar.print,"print","",t.print],save:["_se_command_save se-resizing-enabled",n.toolbar.save,"save","",t.save],blockquote:["",n.toolbar.tag_blockquote,"blockquote","command",t.blockquote],font:["se-btn-select se-btn-tool-font",n.toolbar.font,"font","submenu",''+n.toolbar.font+""+t.arrow_down],formatBlock:["se-btn-select se-btn-tool-format",n.toolbar.formats,"formatBlock","submenu",''+n.toolbar.formats+""+t.arrow_down],fontSize:["se-btn-select se-btn-tool-size",n.toolbar.fontSize,"fontSize","submenu",''+n.toolbar.fontSize+""+t.arrow_down],fontColor:["",n.toolbar.fontColor,"fontColor","submenu",t.font_color],hiliteColor:["",n.toolbar.hiliteColor,"hiliteColor","submenu",t.highlight_color],align:["se-btn-align",n.toolbar.align,"align","submenu",e.rtl?t.align_right:t.align_left],list:["",n.toolbar.list,"list","submenu",t.list_number],horizontalRule:["btn_line",n.toolbar.horizontalRule,"horizontalRule","submenu",t.horizontal_rule],table:["",n.toolbar.table,"table","submenu",t.table],lineHeight:["",n.toolbar.lineHeight,"lineHeight","submenu",t.line_height],template:["",n.toolbar.template,"template","submenu",t.template],paragraphStyle:["",n.toolbar.paragraphStyle,"paragraphStyle","submenu",t.paragraph_style],textStyle:["",n.toolbar.textStyle,"textStyle","submenu",t.text_style],link:["",n.toolbar.link,"link","dialog",t.link],image:["",n.toolbar.image,"image","dialog",t.image],video:["",n.toolbar.video,"video","dialog",t.video],audio:["",n.toolbar.audio,"audio","dialog",t.audio],math:["",n.toolbar.math,"math","dialog",t.math],imageGallery:["",n.toolbar.imageGallery,"imageGallery","fileBrowser",t.image_gallery]}},_createModuleGroup:function(){const e=L.createElement("DIV");e.className="se-btn-module se-btn-module-border";const t=L.createElement("UL");return t.className="se-menu-list",e.appendChild(t),{div:e,ul:t}},_createButton:function(e,t,n,i,l,o,s){const a=L.createElement("LI"),r=L.createElement("BUTTON");return r.setAttribute("type","button"),r.setAttribute("class","se-btn"+(e?" "+e:"")+" se-tooltip"),r.setAttribute("data-command",n),r.setAttribute("data-display",i),r.setAttribute("tabindex","-1"),l||(l='!'),/^default\./i.test(l)&&(l=s[l.replace(/^default\./i,"")]),/^text\./i.test(l)&&(l=l.replace(/^text\./i,""),r.className+=" se-btn-more-text"),l+=''+(t||n)+"",o&&r.setAttribute("disabled",!0),r.innerHTML=l,a.appendChild(r),{li:a,button:r}},_createToolBar:function(e,t,n,i){const l=e.createElement("DIV");l.className="se-toolbar-separator-vertical";const o=e.createElement("DIV");o.className="se-toolbar sun-editor-common";const s=e.createElement("DIV");s.className="se-btn-tray",o.appendChild(s);const a=i.icons,r=this._defaultButtons(i),c={},d=[],u={};if(n){const e=n.length?n:Object.keys(n).map((function(e){return n[e]}));for(let t,n=0,i=e.length;n",b.appendChild(i),i=i.firstElementChild.firstElementChild)}if(_){const e=l.cloneNode(!1);y&&(e.style.float=y),s.appendChild(e)}s.appendChild(p.div),_=!0}else if(/^\/$/.test(v)){const t=e.createElement("DIV");t.className="se-btn-module-enter",s.appendChild(t),_=!1}1===s.children.length&&L.removeClass(s.firstElementChild,"se-btn-module-border"),d.length>0&&d.unshift(t),b.children.length>0&&s.appendChild(b);const v=e.createElement("DIV");v.className="se-menu-tray",o.appendChild(v);const y=e.createElement("DIV");return y.className="se-toolbar-cover",o.appendChild(y),{element:o,plugins:u,pluginCallButtons:c,responsiveButtons:d,_menuTray:v,_buttonTray:s}}};var k=function(e,t,n){return{element:{originElement:e,topArea:t._top,relative:t._relative,toolbar:t._toolBar,_buttonTray:t._toolBar.querySelector(".se-btn-tray"),_menuTray:t._menuTray,resizingBar:t._resizingBar,navigation:t._navigation,charWrapper:t._charWrapper,charCounter:t._charCounter,editorArea:t._editorArea,wysiwygFrame:t._wysiwygArea,wysiwyg:t._wysiwygArea,code:t._codeArea,placeholder:t._placeholder,loading:t._loading,lineBreaker:t._lineBreaker,lineBreaker_t:t._lineBreaker_t,lineBreaker_b:t._lineBreaker_b,resizeBackground:t._resizeBack,_stickyDummy:t._stickyDummy,_arrow:t._arrow},tool:{cover:t._toolBar.querySelector(".se-toolbar-cover"),bold:t._toolBar.querySelector("._se_command_bold"),underline:t._toolBar.querySelector("._se_command_underline"),italic:t._toolBar.querySelector("._se_command_italic"),strike:t._toolBar.querySelector("._se_command_strike"),subscript:t._toolBar.querySelector("._se_command_subscript"),superscript:t._toolBar.querySelector("._se_command_superscript"),undo:t._toolBar.querySelector("._se_command_undo"),redo:t._toolBar.querySelector("._se_command_redo"),save:t._toolBar.querySelector("._se_command_save"),outdent:t._toolBar.querySelector("._se_command_outdent"),indent:t._toolBar.querySelector("._se_command_indent"),fullScreen:t._toolBar.querySelector("._se_command_fullScreen"),showBlocks:t._toolBar.querySelector("._se_command_showBlocks"),codeView:t._toolBar.querySelector("._se_command_codeView")},options:n,option:n}},B={name:"notice",add:function(e){const t=e.context;t.notice={};let n=e.util.createElement("DIV"),i=e.util.createElement("SPAN"),l=e.util.createElement("BUTTON");n.className="se-notice",l.className="close",l.setAttribute("aria-label","Close"),l.setAttribute("title",e.lang.dialogBox.close),l.innerHTML=e.icons.cancel,n.appendChild(i),n.appendChild(l),t.notice.modal=n,t.notice.message=i,l.addEventListener("click",this.onClick_cancel.bind(e)),t.element.editorArea.appendChild(n),n=null},onClick_cancel:function(e){e.preventDefault(),e.stopPropagation(),this.plugins.notice.close.call(this)},open:function(e){this.context.notice.message.textContent=e,this.context.notice.modal.style.display="block"},close:function(){this.context.notice.modal.style.display="none"}},A={init:function(e){return{create:function(t,n){return this.create(t,n,e)}.bind(this)}},create:function(e,t,n){L._propertiesInit(),"object"!=typeof t&&(t={}),n&&(t=[n,t].reduce((function(e,t){for(let n in t)if(L.hasOwn(t,n))if("plugins"===n&&t[n]&&e[n]){let i=e[n],l=t[n];i=i.length?i:Object.keys(i).map((function(e){return i[e]})),l=l.length?l:Object.keys(l).map((function(e){return l[e]})),e[n]=l.filter((function(e){return-1===i.indexOf(e)})).concat(i)}else e[n]=t[n];return e}),{}));const i="string"==typeof e?document.getElementById(e):e;if(!i){if("string"==typeof e)throw Error('[SUNEDITOR.create.fail] The element for that id was not found (ID:"'+e+'")');throw Error("[SUNEDITOR.create.fail] suneditor requires textarea's element or id value")}const l=T.init(i,t);if(l.constructed._top.id&&document.getElementById(l.constructed._top.id))throw Error('[SUNEDITOR.create.fail] The ID of the suneditor you are trying to create already exists (ID:"'+l.constructed._top.id+'")');return function(e,t,n,i,l,o){const s=e.element.originElement.ownerDocument||document,a=s.defaultView||window,r=L,c=l.icons,d={_d:s,_w:a,_parser:new a.DOMParser,_wd:null,_ww:null,_shadowRoot:null,util:r,functions:null,notice:B,icons:c,history:null,context:e,pluginCallButtons:t,plugins:n||{},initPlugins:{},_targetPlugins:{},_menuTray:{},lang:i,effectNode:null,submenu:null,container:null,_submenuName:"",_bindedSubmenuOff:null,_bindedContainerOff:null,submenuActiveButton:null,containerActiveButton:null,controllerArray:[],currentControllerName:"",currentControllerTarget:null,currentFileComponentInfo:null,codeViewDisabledButtons:null,resizingDisabledButtons:null,_moreLayerActiveButton:null,_htmlCheckWhitelistRegExp:null,_disallowedTextTagsRegExp:null,editorTagsWhitelistRegExp:null,pasteTagsWhitelistRegExp:null,hasFocus:!1,isDisabled:!1,_attributesWhitelistRegExp:null,_attributesTagsWhitelist:null,_bindControllersOff:null,_isInline:null,_isBalloon:null,_isBalloonAlways:null,_inlineToolbarAttr:{top:"",width:"",isShow:!1},_notHideToolbar:!1,_sticky:!1,_antiBlur:!1,_lineBreaker:null,_lineBreakerButton:null,_componentsInfoInit:!0,_componentsInfoReset:!1,activePlugins:null,managedTagsInfo:null,_charTypeHTML:!1,_fileInfoPluginsCheck:null,_fileInfoPluginsReset:null,_fileManager:{tags:null,regExp:null,queryString:null,pluginRegExp:null,pluginMap:null},commandMap:null,_styleCommandMap:null,_defaultCommand:{bold:"STRONG",underline:"U",italic:"EM",strike:"DEL",subscript:"SUB",superscript:"SUP"},_variable:{isCodeView:!1,isFullScreen:!1,innerHeight_fullScreen:0,resizeClientY:0,tabSize:4,codeIndent:4,minResizingSize:r.getNumber(e.element.wysiwygFrame.style.minHeight||"65",0),currentNodes:[],currentNodesMap:[],_range:null,_selectionNode:null,_originCssText:e.element.topArea.style.cssText,_bodyOverflow:"",_editorAreaOriginCssText:"",_wysiwygOriginCssText:"",_codeOriginCssText:"",_fullScreenAttrs:{sticky:!1,balloon:!1,inline:!1},_lineBreakComp:null,_lineBreakDir:""},callPlugin:function(e,n,i){if(i=i||t[e],!this.plugins[e])throw Error('[SUNEDITOR.core.callPlugin.fail] The called plugin does not exist or is in an invalid format. (pluginName:"'+e+'")');this.initPlugins[e]?"object"==typeof this._targetPlugins[e]&&i&&this.initMenuTarget(e,i,this._targetPlugins[e]):(this.plugins[e].add(this,i),this.initPlugins[e]=!0),this.plugins[e].active&&!this.commandMap[e]&&i&&(this.commandMap[e]=i,this.activePlugins.push(e)),"function"==typeof n&&n()},addModule:function(e){for(let t,n=0,i=e.length;ne?c-e:0,l=i>0?0:e-c;n.style.left=d-i+l+"px",s.left>u._getEditorOffsets(n).left&&(n.style.left=s.left+"px")}else{const e=o<=c?0:o-(d+c);n.style.left=e<0?d+e+"px":d+"px"}let h=0,g=t;for(;g&&g!==i;)h+=g.offsetTop,g=g.offsetParent;const p=h;this._isBalloon?h+=i.offsetTop+t.offsetHeight:h-=t.offsetHeight;const m=s.top;let f=n.offsetHeight,_=e.element.topArea,b=0;for(;_;)b+=_.scrollTop,_=_.parentElement;const v=a.innerHeight-(m-b+p+t.parentElement.offsetHeight);if(vv?(n.style.height=l+"px",e=-1*(l-p+3)):(n.style.height=v+"px",e=p+t.parentElement.offsetHeight),n.style.top=e+"px"}else n.style.top=p+t.parentElement.offsetHeight+"px";n.style.visibility=""},controllersOn:function(){this._bindControllersOff&&this._bindControllersOff(),this.controllerArray=[];for(let e,t=0;t0){for(let e=0;eu?d-u:0,i=n>0?0:u-d;t.style.left=c-n+i+"px",n>0&&(t.firstElementChild.style.left=(d-14<10+n?d-14:10+n)+"px");const l=e.element.wysiwygFrame.offsetLeft-t.offsetLeft;l>0&&(t.style.left="0px",t.firstElementChild.style.left=l+"px")}else{t.style.left=c+"px";const n=e.element.wysiwygFrame.offsetWidth-(t.offsetLeft+d);n<0?(t.style.left=t.offsetLeft+n+"px",t.firstElementChild.style.left=20-n+"px"):t.firstElementChild.style.left="20px"}t.style.visibility=""},eventStop:function(e){e.stopPropagation(),e.preventDefault()},execCommand:function(e,t,n){this._wd.execCommand(e,t,"formatBlock"===e?"<"+n+">":n),this.history.push(!0)},nativeFocus:function(){const t=r.getParentElement(this.getSelectionNode(),"figcaption");t?t.focus():e.element.wysiwyg.focus(),this._editorRange()},focus:function(){if("none"!==e.element.wysiwygFrame.style.display){if(l.iframe)this.nativeFocus();else try{const t=this.getRange();if(t.startContainer===t.endContainer&&r.isWysiwygDiv(t.startContainer)){const t=r.createElement("P"),n=r.createElement("BR");t.appendChild(n),e.element.wysiwyg.appendChild(t),this.setRange(n,0,n,0)}else this.setRange(t.startContainer,t.startOffset,t.endContainer,t.endOffset)}catch(e){this.nativeFocus()}u._applyTagEffects(),this._isBalloon&&u._toggleToolbarBalloon()}},focusEdge:function(t){t||(t=e.element.wysiwyg.lastElementChild);const n=this.getFileComponent(t);n?this.selectComponent(n.target,n.pluginName):t?(t=r.getChildElement(t,(function(e){return 0===e.childNodes.length||3===e.nodeType}),!0))?this.setRange(t,t.textContent.length,t,t.textContent.length):this.nativeFocus():this.focus()},setRange:function(e,t,n,i){if(!e||!n)return;t>e.textContent.length&&(t=e.textContent.length),i>n.textContent.length&&(i=n.textContent.length);const o=this._wd.createRange();try{o.setStart(e,t),o.setEnd(n,i)}catch(e){return console.warn("[SUNEDITOR.core.focus.error] "+e),void this.nativeFocus()}const s=this.getSelection();return s.removeAllRanges&&s.removeAllRanges(),s.addRange(o),this._editorRange(),l.iframe&&this.nativeFocus(),o},removeRange:function(){this._variable._range=null,this._variable._selectionNode=null,this.getSelection().removeAllRanges();const e=this.commandMap,t=this.activePlugins;for(let i in e)r.hasOwn(e,i)&&(t.indexOf(i)>-1?n[i].active.call(this,null):e.OUTDENT&&/^OUTDENT$/i.test(i)?e.OUTDENT.setAttribute("disabled",!0):e.INDENT&&/^INDENT$/i.test(i)?e.INDENT.removeAttribute("disabled"):r.removeClass(e[i],"active"))},getRange:function(){const t=this._variable._range||this._createDefaultRange(),n=this.getSelection();if(t.collapsed===n.isCollapsed||!e.element.wysiwyg.contains(n.focusNode))return t;if(n.rangeCount>0)return this._variable._range=n.getRangeAt(0),this._variable._range;{const e=n.anchorNode,t=n.focusNode,i=n.anchorOffset,l=n.focusOffset,o=r.compareElements(e,t),s=o.ancestor&&(0===o.result?i<=l:o.result>1);return this.setRange(s?e:t,s?i:l,s?t:e,s?l:i)}},getRange_addLine:function(t){if(this._selectionVoid(t)){const n=e.element.wysiwyg,i=r.createElement("P");i.innerHTML="
    ",n.insertBefore(i,n.firstElementChild),this.setRange(i.firstElementChild,0,i.firstElementChild,1),t=this._variable._range}return t},getSelection:function(){return this._shadowRoot&&this._shadowRoot.getSelection?this._shadowRoot.getSelection():this._ww.getSelection()},getSelectionNode:function(){if(r.isWysiwygDiv(this._variable._selectionNode)&&this._editorRange(),!this._variable._selectionNode){const t=r.getChildElement(e.element.wysiwyg.firstChild,(function(e){return 0===e.childNodes.length||3===e.nodeType}),!1);if(t)return this._variable._selectionNode=t,t;this._editorRange()}return this._variable._selectionNode},_editorRange:function(){const e=this.getSelection();if(!e)return null;let t=null,n=null;t=e.rangeCount>0?e.getRangeAt(0):this._createDefaultRange(),this._variable._range=t,n=t.collapsed?t.commonAncestorContainer:e.extentNode||e.anchorNode,this._variable._selectionNode=n},_createDefaultRange:function(){const t=e.element.wysiwyg;t.focus();const n=this._wd.createRange();let i=t.firstElementChild;return i||(i=r.createElement("P"),i.innerHTML="
    ",t.appendChild(i)),n.setStart(i,0),n.setEnd(i,0),n},_selectionVoid:function(e){const t=e.commonAncestorContainer;return r.isWysiwygDiv(e.startContainer)&&r.isWysiwygDiv(e.endContainer)||/FIGURE/i.test(t.nodeName)||this._fileManager.regExp.test(t.nodeName)||r.isMediaComponent(t)},_resetRangeToTextNode:function(){const t=this.getRange();if(this._selectionVoid(t))return!1;let n,i,l,o=t.startContainer,s=t.startOffset,a=t.endContainer,c=t.endOffset;if(r.isFormatElement(o)&&(o=o.childNodes[s]||o.lastChild,s=o.textContent.length),r.isFormatElement(a)&&(a=a.childNodes[c]||a.lastChild,c=a.textContent.length),n=r.isWysiwygDiv(o)?e.element.wysiwyg.firstChild:o,i=s,r.isBreak(n)||1===n.nodeType&&n.childNodes.length>0){const e=r.isBreak(n);if(!e){for(;n&&!r.isBreak(n)&&1===n.nodeType;)n=n.childNodes[i]||n.nextElementSibling||n.nextSibling,i=0;let e=r.getFormatElement(n,null);e===r.getRangeFormatElement(e,null)&&(e=r.createElement(r.getParentElement(n,r.isCell)?"DIV":"P"),n.parentNode.insertBefore(e,n),e.appendChild(n))}if(r.isBreak(n)){const t=r.createTextNode(r.zeroWidthSpace);n.parentNode.insertBefore(t,n),n=t,e&&o===a&&(a=n,c=1)}}if(o=n,s=i,n=r.isWysiwygDiv(a)?e.element.wysiwyg.lastChild:a,i=c,r.isBreak(n)||1===n.nodeType&&n.childNodes.length>0){const e=r.isBreak(n);if(!e){for(;n&&!r.isBreak(n)&&1===n.nodeType&&(l=n.childNodes,0!==l.length);)n=l[i>0?i-1:i]||!/FIGURE/i.test(l[0].nodeName)?l[0]:n.previousElementSibling||n.previousSibling||o,i=i>0?n.textContent.length:i;let e=r.getFormatElement(n,null);e===r.getRangeFormatElement(e,null)&&(e=r.createElement(r.isCell(e)?"DIV":"P"),n.parentNode.insertBefore(e,n),e.appendChild(n))}if(r.isBreak(n)){const t=r.createTextNode(r.zeroWidthSpace);n.parentNode.insertBefore(t,n),n=t,i=1,e&&!n.previousSibling&&r.removeItem(a)}}return a=n,c=i,this.setRange(o,s,a,c),!0},getSelectedElements:function(t){if(!this._resetRangeToTextNode())return[];let n=this.getRange();if(r.isWysiwygDiv(n.startContainer)){const t=e.element.wysiwyg.children;if(0===t.length)return[];this.setRange(t[0],0,t[t.length-1],t[t.length-1].textContent.trim().length),n=this.getRange()}const i=n.startContainer,l=n.endContainer,o=n.commonAncestorContainer,s=r.getListChildren(o,(function(e){return t?t(e):r.isFormatElement(e)}));if(r.isWysiwygDiv(o)||r.isRangeFormatElement(o)||s.unshift(r.getFormatElement(o,null)),i===l||1===s.length)return s;let a=r.getFormatElement(i,null),c=r.getFormatElement(l,null),d=null,u=null;const h=function(e){return!r.isTable(e)||/^TABLE$/i.test(e.nodeName)};let g=r.getRangeFormatElement(a,h),p=r.getRangeFormatElement(c,h);r.isTable(g)&&r.isListCell(g.parentNode)&&(g=g.parentNode),r.isTable(p)&&r.isListCell(p.parentNode)&&(p=p.parentNode);const m=g===p;for(let e,t=0,n=s.length;t=0;n--)if(i[n].contains(i[e])){i.splice(e,1),e--,t--;break}return i},isEdgePoint:function(e,t){return 0===t||!e.nodeValue&&1===t||t===e.nodeValue.length},showLoading:function(){e.element.loading.style.display="block"},closeLoading:function(){e.element.loading.style.display="none"},appendFormatTag:function(e,t){const n=r.getFormatElement(this.getSelectionNode(),null),i=t?"string"==typeof t?t:t.nodeName:r.isFormatElement(n)&&!r.isFreeFormatElement(n)?n.nodeName:"P",l=r.createElement(i);return l.innerHTML="
    ",(t&&"string"!=typeof t||!t&&r.isFormatElement(n))&&r.copyTagAttributes(l,t||n),r.isCell(e)?e.insertBefore(l,e.nextElementSibling):e.parentNode.insertBefore(l,e.nextElementSibling),l},insertComponent:function(e,t,n,i){if(n&&!this.checkCharCount(e,null))return null;const l=this.removeNode();this.getRange_addLine(this.getRange());let o=null,s=this.getSelectionNode(),a=r.getFormatElement(s,null);if(r.isListCell(a))this.insertNode(e,s===a?null:l.container.nextSibling,!1),e.nextSibling||e.parentNode.appendChild(r.createElement("BR"));else{if(this.getRange().collapsed&&(3===l.container.nodeType||r.isBreak(l.container))){const e=r.getParentElement(l.container,function(e){return this.isRangeFormatElement(e)}.bind(r));o=r.splitElement(l.container,l.offset,e?r.getElementDepth(e)+1:0),o&&(a=o.previousSibling)}this.insertNode(e,a,!1),a&&r.onlyZeroWidthSpace(a)&&r.removeItem(a)}if(!i){const t=this.getFileComponent(e);t?this.selectComponent(t.target,t.pluginName):o&&(o=r.getEdgeChildNodes(o,null).sc||o,this.setRange(o,0,o,0))}return t||this.history.push(1),o||e},getFileComponent:function(e){if(!this._fileManager.queryString||!e)return null;let t,n;return(/^FIGURE$/i.test(e.nodeName)||/se-component/.test(e.className))&&(t=e.querySelector(this._fileManager.queryString)),!t&&e.nodeName&&this._fileManager.regExp.test(e.nodeName)&&(t=e),t&&(n=this._fileManager.pluginMap[t.nodeName.toLowerCase()],n)?{target:t,component:r.getParentElement(t,r.isComponent),pluginName:n}:null},selectComponent:function(e,t){this.hasFocus||this.focus();const n=this.plugins[t];n&&a.setTimeout(function(){"function"==typeof n.select&&this.callPlugin(t,n.select.bind(this,e),null),this._setComponentLineBreaker(e)}.bind(this))},_setComponentLineBreaker:function(t){this._lineBreaker.style.display="none";const n=r.getParentElement(t,r.isComponent),i=e.element.lineBreaker_t.style,l=e.element.lineBreaker_b.style,o="block"===this.context.resizing.resizeContainer.style.display?this.context.resizing.resizeContainer:t,s=r.isListCell(n.parentNode);let a,c,d;(s?n.previousSibling:r.isFormatElement(n.previousElementSibling))?i.display="none":(this._variable._lineBreakComp=n,c=e.element.wysiwyg.scrollTop,a=r.getOffset(t,e.element.wysiwygFrame).top+c,d=o.offsetWidth/2/2,i.top=a-c-12+"px",i.left=r.getOffset(o).left+d+"px",i.display="block"),(s?n.nextSibling:r.isFormatElement(n.nextElementSibling))?l.display="none":(a||(this._variable._lineBreakComp=n,c=e.element.wysiwyg.scrollTop,a=r.getOffset(t,e.element.wysiwygFrame).top+c,d=o.offsetWidth/2/2),l.top=a+o.offsetHeight-c-12+"px",l.left=r.getOffset(o).left+o.offsetWidth-d-24+"px",l.display="block")},insertNode:function(e,t,n){if(n&&!this.checkCharCount(e,null))return null;const i=r.getFreeFormatElement(this.getSelectionNode(),null),l=!i&&(r.isFormatElement(e)||r.isRangeFormatElement(e))||r.isComponent(e);if(!t&&l){const e=this.removeNode();if(3===e.container.nodeType||r.isBreak(e.container)){const n=r.getParentElement(e.container,function(e){return this.isRangeFormatElement(e)||this.isListCell(e)}.bind(r));(t=r.splitElement(e.container,e.offset,n?r.getElementDepth(n)+1:0))&&(t=t.previousSibling)}}const o=t||l?this.getRange():this.getRange_addLine(this.getRange()),s=o.commonAncestorContainer,a=o.startOffset,c=o.endOffset,d=o.startContainer===s&&r.isFormatElement(s),u=d?s.childNodes[a]:o.startContainer,h=d?s.childNodes[c]:o.endContainer;let g,p=null;if(t)g=t.parentNode,t=t.nextSibling,p=!0;else if(g=u,3===u.nodeType&&(g=u.parentNode),o.collapsed)if(3===s.nodeType)t=s.textContent.length>c?s.splitText(c):s.nextSibling;else if(r.isBreak(g))t=g,g=g.parentNode;else{let n=g.childNodes[a];const i=n&&3===n.nodeType&&r.onlyZeroWidthSpace(n)&&r.isBreak(n.nextSibling)?n.nextSibling:n;i?i.nextSibling?t=r.isBreak(i)&&!r.isBreak(e)?i:i.nextSibling:(g.removeChild(i),t=null):t=null}else{if(u===h){t=this.isEdgePoint(h,c)?h.nextSibling:h.splitText(c);let e=u;this.isEdgePoint(u,a)||(e=u.splitText(a)),g.removeChild(e),0===g.childNodes.length&&l&&(g.innerHTML="
    ")}else{const e=this.removeNode(),n=e.container,i=e.prevContainer;if(n&&0===n.childNodes.length&&l&&(r.isFormatElement(n)?n.innerHTML="
    ":r.isRangeFormatElement(n)&&(n.innerHTML="


    ")),!l&&i)if(g=3===i.nodeType?i.parentNode:i,g.contains(n))for(t=n;t.parentNode===g;)t=t.parentNode;else t=null;else g=l?s:n,t=l?h:null;for(;t&&!r.isFormatElement(t)&&t.parentNode!==s;)t=t.parentNode}}try{if(r.isFormatElement(e)||r.isRangeFormatElement(e)||!r.isListCell(g)&&r.isComponent(e)){const e=g;if(r.isList(t))g=t,t=null;else if(r.isListCell(t))g=t.previousElementSibling||t;else if(!p&&!t){const e=this.removeNode(),n=3===e.container.nodeType?r.isListCell(r.getFormatElement(e.container,null))?e.container:r.getFormatElement(e.container,null)||e.container.parentNode:e.container,i=r.isWysiwygDiv(n)||r.isRangeFormatElement(n);g=i?n:n.parentNode,t=i?null:n.nextSibling}0===e.childNodes.length&&g!==e&&r.removeItem(e)}!l||i||r.isRangeFormatElement(g)||r.isListCell(g)||r.isWysiwygDiv(g)||(t=g.nextElementSibling,g=g.parentNode),g.insertBefore(e,g===t?g.lastChild:t)}catch(t){g.appendChild(e)}finally{if(i&&(r.isFormatElement(e)||r.isRangeFormatElement(e))&&(e=this._setIntoFreeFormat(e)),!r.isComponent(e)){let t=1;if(3===e.nodeType){const t=e.previousSibling,n=e.nextSibling,i=!t||1===t.nodeType||r.onlyZeroWidthSpace(t)?"":t.textContent,l=!n||1===n.nodeType||r.onlyZeroWidthSpace(n)?"":n.textContent;t&&i.length>0&&(e.textContent=i+e.textContent,r.removeItem(t)),n&&n.length>0&&(e.textContent+=l,r.removeItem(n));const o={container:e,startOffset:i.length,endOffset:e.textContent.length-l.length};return this.setRange(e,o.startOffset,e,o.endOffset),o}if(!r.isBreak(e)&&r.isFormatElement(g)){let n=null;e.previousSibling&&!r.isBreak(e.previousSibling)||(n=r.createTextNode(r.zeroWidthSpace),e.parentNode.insertBefore(n,e)),e.nextSibling&&!r.isBreak(e.nextSibling)||(n=r.createTextNode(r.zeroWidthSpace),e.parentNode.insertBefore(n,e.nextSibling)),r._isIgnoreNodeChange(e)&&(e=e.nextSibling,t=0)}this.setRange(e,t,e,t)}return this.history.push(!0),e}},_setIntoFreeFormat:function(e){const t=e.parentNode;let n,i;for(;r.isFormatElement(e)||r.isRangeFormatElement(e);){for(n=e.childNodes,i=null;n[0];)if(i=n[0],r.isFormatElement(i)||r.isRangeFormatElement(i)){if(this._setIntoFreeFormat(i),!e.parentNode)break;n=e.childNodes}else t.insertBefore(i,e);0===e.childNodes.length&&r.removeItem(e),e=r.createElement("BR"),t.insertBefore(e,i.nextSibling)}return e},removeNode:function(){this._resetRangeToTextNode()||console.warn('[SUNEDITOR.core.removeNode.exception] An exception occurred while resetting the "Range" object.');const t=this.getRange();let n,i=0,l=t.startContainer,o=t.endContainer;const s=t.startOffset,a=t.endOffset,c=t.commonAncestorContainer;let d=null,u=null;const h=r.getListChildNodes(c,null);let g=r.getArrayIndex(h,l),p=r.getArrayIndex(h,o);if(h.length>0&&g>-1&&p>-1){for(let e=g+1,t=l;e>=0;e--)h[e]===t.parentNode&&h[e].firstChild===t&&0===s&&(g=e,t=t.parentNode);for(let e=p-1,t=o;e>g;e--)h[e]===t.parentNode&&1===h[e].nodeType&&(h.splice(e,1),t=t.parentNode,--p)}else{if(0===h.length){if(r.isFormatElement(c)||r.isRangeFormatElement(c)||r.isWysiwygDiv(c)||r.isBreak(c)||r.isMedia(c))return{container:c,offset:0};if(3===c.nodeType)return{container:c,offset:a};h.push(c),l=o=c}else if(l=o=h[0],r.isBreak(l)||r.onlyZeroWidthSpace(l))return{container:l,offset:0};g=p=0}function m(e){const t=r.getFormatElement(e,null);if(r.removeItem(e),r.isListCell(t)){const e=r.getArrayItem(t.children,r.isList,!1);if(e){const n=e.firstElementChild,i=n.childNodes;for(;i[0];)t.insertBefore(i[0],e);r.removeItemAllParents(n,null,null)}}}for(let e=g;e<=p;e++){const t=h[e];if(0===t.length||3===t.nodeType&&void 0===t.data)m(t);else if(t!==l)t!==o?m(t):(u=1===o.nodeType?r.createTextNode(o.textContent):r.createTextNode(o.substringData(a,o.length-a)),u.length>0?o.data=u.data:m(o));else if(1===l.nodeType?d=r.createTextNode(l.textContent):t===o?(d=r.createTextNode(l.substringData(0,s)+o.substringData(a,o.length-a)),i=s):d=r.createTextNode(l.substringData(0,s)),d.length>0?l.data=d.data:m(l),t===o)break}if(n=o&&o.parentNode?o:l&&l.parentNode?l:t.endContainer||t.startContainer,!r.isWysiwygDiv(n)){const t=r.removeItemAllParents(n,function(e){if(this.isComponent(e))return!1;const t=e.textContent;return 0===t.length||/^(\n|\u200B)+$/.test(t)}.bind(r),null);t&&(n=t.sc||t.ec||e.element.wysiwyg)}return this.setRange(n,i,n,i),this.history.push(!0),{container:n,offset:i,prevContainer:l&&l.parentNode?l:null}},applyRangeFormatElement:function(e){this.getRange_addLine(this.getRange());const t=this.getSelectedElementsAndComponents(!1);if(!t||0===t.length)return;e:for(let e,n,i,l,o,s,a=0,c=t.length;a-1&&(l=n.lastElementChild,t.indexOf(l)>-1)){let e=null;for(;e=l.lastElementChild;)if(r.isList(e)){if(!(t.indexOf(e.lastElementChild)>-1))continue e;l=e.lastElementChild}i=n.firstElementChild,o=t.indexOf(i),s=t.indexOf(l),t.splice(o,s-o+1),c=t.length}else;let n,i,l,o=t[t.length-1];n=r.isRangeFormatElement(o)||r.isFormatElement(o)?o:r.getRangeFormatElement(o,null)||r.getFormatElement(o,null),r.isCell(n)?(i=null,l=n):(i=n.nextSibling,l=n.parentNode);let s=r.getElementDepth(n),a=null;const c=[],d=function(e,t,n){let i=null;if(e!==t&&!r.isTable(t)){if(t&&r.getElementDepth(e)===r.getElementDepth(t))return n;i=r.removeItemAllParents(t,null,e)}return i?i.ec:n};for(let n,o,u,h,g,p,m,f=0,_=t.length;f<_;f++)if(n=t[f],o=n.parentNode,o&&!e.contains(o))if(u=r.getElementDepth(n),r.isList(o)){if(null===a&&(p?(a=p,m=!0,p=null):a=o.cloneNode(!1)),c.push(n),g=t[f+1],f===_-1||g&&g.parentNode!==o){g&&n.contains(g.parentNode)&&(p=g.parentNode.cloneNode(!1));let t,f=o.parentNode;for(;r.isList(f);)t=r.createElement(f.nodeName),t.appendChild(a),a=t,f=f.parentNode;const _=this.detachRangeFormatElement(o,c,null,!0,!0);s>=u?(s=u,l=_.cc,i=d(l,o,_.ec),i&&(l=i.parentNode)):l===_.cc&&(i=_.ec),l!==_.cc&&(h=d(l,_.cc,h),i=void 0!==h?h:_.cc);for(let e=0,t=_.removeArray.length;e=u&&(s=u,l=o,i=n.nextSibling),e.appendChild(n),l!==o&&(h=d(l,o),void 0!==h&&(i=h));if(this.effectNode=null,r.mergeSameTags(e,null,!1),r.mergeNestedTags(e,function(e){return this.isList(e)}.bind(r)),i&&r.getElementDepth(i)>0&&(r.isList(i.parentNode)||r.isList(i.parentNode.parentNode))){const t=r.getParentElement(i,function(e){return this.isRangeFormatElement(e)&&!this.isList(e)}.bind(r)),n=r.splitElement(i,null,t?r.getElementDepth(t)+1:0);n.parentNode.insertBefore(e,n)}else l.insertBefore(e,i),d(e,i);const u=r.getEdgeChildNodes(e.firstElementChild,e.lastElementChild);t.length>1?this.setRange(u.sc,0,u.ec,u.ec.textContent.length):this.setRange(u.ec,u.ec.textContent.length,u.ec,u.ec.textContent.length),this.history.push(!1)},detachRangeFormatElement:function(e,t,n,i,l){const o=this.getRange(),s=o.startOffset,a=o.endOffset;let c=r.getListChildNodes(e,(function(t){return t.parentNode===e})),d=e.parentNode,u=null,h=null,g=e.cloneNode(!1);const p=[],m=r.isList(n);let f=!1,_=!1,b=!1;function v(t,n,i,l){if(r.onlyZeroWidthSpace(n)&&(n.innerHTML=r.zeroWidthSpace),3===n.nodeType)return t.insertBefore(n,i),n;const o=(b?n:l).childNodes;let s=n.cloneNode(!1),a=null,c=null;for(;o[0];)c=o[0],!r._notTextNode(c)||r.isBreak(c)||r.isListCell(s)?s.appendChild(c):(s.childNodes.length>0&&(a||(a=s),t.insertBefore(s,i),s=n.cloneNode(!1)),t.insertBefore(c,i),a||(a=c));if(s.childNodes.length>0){if(r.isListCell(t)&&r.isListCell(s)&&r.isList(i))if(m){for(a=i;i;)s.appendChild(i),i=i.nextSibling;t.parentNode.insertBefore(s,t.nextElementSibling)}else{const t=l.nextElementSibling,n=r.detachNestedList(l,!1);if(e!==n||t!==l.nextElementSibling){const t=s.childNodes;for(;t[0];)l.appendChild(t[0]);e=n,_=!0}}else t.insertBefore(s,i);a||(a=s)}return a}for(let l,o,s,a=0,y=c.length;a0&&(d.insertBefore(g,e),g=null),!m&&r.isListCell(l))if(s&&r.getElementDepth(l)!==r.getElementDepth(s)&&(r.isListCell(d)||r.getArrayItem(l.children,r.isList,!1))){const t=l.nextElementSibling,n=r.detachNestedList(l,!1);e===n&&t===l.nextElementSibling||(e=n,_=!0)}else{const t=l;l=r.createElement(i?t.nodeName:r.isList(e.parentNode)||r.isListCell(e.parentNode)?"LI":r.isCell(e.parentNode)?"DIV":"P");const n=r.isListCell(l),o=t.childNodes;for(;o[0]&&(!r.isList(o[0])||n);)l.appendChild(o[0]);r.copyFormatAttributes(l,t),b=!0}else l=l.cloneNode(!1);if(!_&&(i?(p.push(l),r.removeItem(c[a])):(n?(f||(d.insertBefore(n,e),f=!0),l=v(n,l,null,c[a])):l=v(d,l,e,c[a]),_||(t?(h=l,u||(u=l)):u||(u=h=l))),_)){_=b=!1,c=r.getListChildNodes(e,(function(t){return t.parentNode===e})),g=e.cloneNode(!1),d=e.parentNode,a=-1,y=c.length;continue}}const y=e.parentNode;let C=e.nextSibling;g&&g.children.length>0&&y.insertBefore(g,C),n?u=n.previousSibling:u||(u=e.previousSibling),C=e.nextSibling,0===e.children.length||0===e.textContent.length?r.removeItem(e):r.removeEmptyNode(e,null);let w=null;if(i)w={cc:y,sc:u,ec:C,removeArray:p};else{u||(u=h),h||(h=u);const e=r.getEdgeChildNodes(u,h.parentNode?u:h);w={cc:(e.sc||e.ec).parentNode,sc:e.sc,ec:e.ec}}if(this.effectNode=null,l)return w;!i&&w&&(t?this.setRange(w.sc,s,w.ec,a):this.setRange(w.sc,0,w.sc,0)),this.history.push(!1)},detachList:function(e,t){let n={},i=!1,l=!1,o=null,s=null;const a=function(e){return!this.isComponent(e)}.bind(r);for(let c,d,u,h,g=0,p=e.length;g0)&&t,n=!!(n&&n.length>0)&&n;const o=!e,s=o&&!n&&!t;let c=l.startContainer,d=l.startOffset,u=l.endContainer,h=l.endOffset;if(s&&l.collapsed&&r.isFormatElement(c.parentNode)&&r.isFormatElement(u.parentNode)||c===u&&1===c.nodeType&&r.isNonEditable(c))return;if(l.collapsed&&!s&&1===c.nodeType&&!r.isBreak(c)&&!r.isComponent(c)){let e=null;const t=c.childNodes[d];t&&(e=t.nextSibling?r.isBreak(t)?t:t.nextSibling:null);const n=r.createTextNode(r.zeroWidthSpace);c.insertBefore(n,e),this.setRange(n,1,n,1),l=this.getRange(),c=l.startContainer,d=l.startOffset,u=l.endContainer,h=l.endOffset}r.isFormatElement(c)&&(c=c.childNodes[d]||c.firstChild,d=0),r.isFormatElement(u)&&(u=u.childNodes[h]||u.lastChild,h=u.textContent.length),o&&(e=r.createElement("DIV"));const g=a.RegExp,p=e.nodeName;if(!s&&c===u&&!n&&e){let t=c,n=0;const i=[],l=e.style;for(let e=0,t=l.length;e0){for(;!r.isFormatElement(t)&&!r.isWysiwygDiv(t);){for(let l=0;l=i.length)return}}let m,f={},_={},b="",v="",y="";if(t){for(let e,n=0,i=t.length;n0&&(a=l.replace(b,"").trim(),a!==l&&(w.v=!0));const c=t.className;let d="";return v&&c.length>0&&(d=c.replace(v,"").trim(),d!==c&&(w.v=!0)),(!o||!v&&c||!b&&l||a||d||!n)&&(a||d||t.nodeName!==p||C(b)!==C(l)||C(v)!==C(c))?(b&&l.length>0&&(t.style.cssText=a),t.style.cssText||t.removeAttribute("style"),v&&c.length>0&&(t.className=d.trim()),t.className.trim()||t.removeAttribute("class"),t.style.cssText||t.className||t.nodeName!==p&&!n?t:(w.v=!0,null)):(w.v=!0,null)},E=this.getSelectedElements(null);l=this.getRange(),c=l.startContainer,d=l.startOffset,u=l.endContainer,h=l.endOffset,r.getFormatElement(c,null)||(c=r.getChildElement(E[0],(function(e){return 3===e.nodeType}),!1),d=0),r.getFormatElement(u,null)||(u=r.getChildElement(E[E.length-1],(function(e){return 3===e.nodeType}),!1),h=u.textContent.length);const S=r.getFormatElement(c,null)===r.getFormatElement(u,null),N=E.length-(S?0:1);m=e.cloneNode(!1);const L=s||o&&function(e){for(let t=0,n=e.length;t0&&(m=e.cloneNode(!1),_=this._nodeChange_endLine(E[N],m,x,u,h,s,o,w,k,B));for(let t,n=N-1;n>0;n--)m=e.cloneNode(!1),t=this._nodeChange_middleLine(E[n],m,x,s,o,w,_.container),t.endContainer&&(_.ancestor=null,_.container=t.endContainer),this._setCommonListStyle(t.ancestor,null);m=e.cloneNode(!1),f=this._nodeChange_startLine(E[0],m,x,c,d,s,o,w,k,B,_.container),f.endContainer&&(_.ancestor=null,_.container=f.endContainer),N<=0?_=f:_.container||(_.ancestor=null,_.container=f.container,_.offset=f.container.textContent.length),this._setCommonListStyle(f.ancestor,null),this._setCommonListStyle(_.ancestor||r.getFormatElement(_.container),null)}this.controllersOff(),this.setRange(f.container,f.offset,_.container,_.offset),this.history.push(!1)},_setCommonListStyle:function(e,t){if(!r.isListCell(e))return;t||e.removeAttribute("style");const n=r.getArrayItem((t||e).childNodes,(function(e){return!r.isBreak(e)&&!r.onlyZeroWidthSpace(e.textContent.trim())}),!0);if(n[0]&&1===n.length){if(!(t=n[0])||1!==t.nodeType)return;const i=t.style,l=e.style;/STRONG/i.test(t.nodeName)?l.fontWeight="bold":i.fontWeight&&(l.fontWeight=i.fontWeight),i.color&&(l.color=i.color),i.fontSize&&(l.fontSize=i.fontSize),this._setCommonListStyle(e,t)}},_stripRemoveNode:function(e){const t=e.parentNode;if(!e||3===e.nodeType||!t)return;const n=e.childNodes;for(;n[0];)t.insertBefore(n[0],e);t.removeChild(e)},_util_getMaintainedNode:function(e,t,n){return!n||e?null:this.getParentElement(n,this._isMaintainedNode.bind(this))||(t?null:this.getParentElement(n,this._isSizeNode.bind(this)))},_util_isMaintainedNode:function(e,t,n){if(!n||e||1!==n.nodeType)return!1;const i=this._isMaintainedNode(n);return this.getParentElement(n,this._isMaintainedNode.bind(this))?i:i||!t&&this._isSizeNode(n)},_nodeChange_oneLine:function(e,t,n,i,l,o,s,c,d,u,h,g,p){let m=i.parentNode;for(;!(m.nextSibling||m.previousSibling||r.isFormatElement(m.parentNode)||r.isWysiwygDiv(m.parentNode))&&m.nodeName!==t.nodeName;)m=m.parentNode;if(!d&&m===o.parentNode&&m.nodeName===t.nodeName&&r.onlyZeroWidthSpace(i.textContent.slice(0,l))&&r.onlyZeroWidthSpace(o.textContent.slice(s))){const e=m.childNodes;let n=!0;for(let t,l,s,a,c=0,d=e.length;c0&&(n=t.test(e.style.cssText)),!n}if(function e(i,l){const o=i.childNodes;for(let i,s=0,a=o.length;s=N?T-N:S.data.length-N));if(E){const t=g(l);if(t&&t.parentNode!==e){let n=t,i=null;for(;n.parentNode!==e;){for(l=i=n.parentNode.cloneNode(!1);n.childNodes[0];)i.appendChild(n.childNodes[0]);n.appendChild(i),n=n.parentNode}n.parentNode.appendChild(t)}E=E.cloneNode(!1)}r.onlyZeroWidthSpace(o)||l.appendChild(o);const c=g(l);for(c&&(E=c),E&&(e=E),C=a,y=[],x="";C!==e&&C!==f&&null!==C;)i=p(C)?null:n(C),i&&1===C.nodeType&&z(C)&&(y.push(i),x+=C.style.cssText.substr(0,C.style.cssText.indexOf(":"))+"|"),C=C.parentNode;const d=y.pop()||s;for(w=C=d;y.length>0;)C=y.pop(),w.appendChild(C),w=C;if(t.appendChild(d),e.appendChild(t),E&&!g(L)&&(t=t.cloneNode(!1),b.appendChild(t),_.push(t)),S=s,N=0,k=!0,C!==s&&C.appendChild(S),!v)continue}if(B||a!==L){if(k){if(1===a.nodeType&&!r.isBreak(a)){r._isIgnoreNodeChange(a)?(b.appendChild(a.cloneNode(!0)),u||(t=t.cloneNode(!1),b.appendChild(t),_.push(t))):e(a,a);continue}C=a,y=[],x="";const o=[];for(;null!==C.parentNode&&C!==f&&C!==t;)i=B?C.cloneNode(!1):n(C),1===C.nodeType&&!r.isBreak(a)&&i&&z(C)&&(p(C)?E||o.push(i):y.push(i),x+=C.style.cssText.substr(0,C.style.cssText.indexOf(":"))+"|"),C=C.parentNode;y=y.concat(o);const s=y.pop()||a;for(w=C=s;y.length>0;)C=y.pop(),w.appendChild(C),w=C;if(p(t.parentNode)&&!p(s)&&(t=t.cloneNode(!1),b.appendChild(t),_.push(t)),B||E||!p(s))s===a?l=B?b:t:B?(b.appendChild(s),l=C):(t.appendChild(s),l=C);else{t=t.cloneNode(!1);const e=s.childNodes;for(let n=0,i=e.length;n0?C:t}if(E&&3===a.nodeType)if(g(a)){const e=r.getParentElement(l,function(e){return this._isMaintainedNode(e.parentNode)||e.parentNode===b}.bind(r));E.appendChild(e),t=e.cloneNode(!1),_.push(t),b.appendChild(t)}else E=null}d=a.cloneNode(!1),l.appendChild(d),1!==a.nodeType||r.isBreak(a)||(h=d),e(a,h)}else{E=g(a);const e=r.createTextNode(1===L.nodeType?"":L.substringData(T,L.length-T)),l=r.createTextNode(v||1===L.nodeType?"":L.substringData(0,T));if(E?E=E.cloneNode(!1):p(t.parentNode)&&!E&&(t=t.cloneNode(!1),b.appendChild(t),_.push(t)),!r.onlyZeroWidthSpace(e)){C=a,x="",y=[];const t=[];for(;C!==b&&C!==f&&null!==C;)1===C.nodeType&&z(C)&&(p(C)?t.push(C.cloneNode(!1)):y.push(C.cloneNode(!1)),x+=C.style.cssText.substr(0,C.style.cssText.indexOf(":"))+"|"),C=C.parentNode;for(y=y.concat(t),d=w=C=y.pop()||e;y.length>0;)C=y.pop(),w.appendChild(C),w=C;b.appendChild(d),C.textContent=e.data}if(E&&d){const e=g(d);e&&(E=e)}for(C=a,y=[],x="";C!==b&&C!==f&&null!==C;)i=p(C)?null:n(C),i&&1===C.nodeType&&z(C)&&(y.push(i),x+=C.style.cssText.substr(0,C.style.cssText.indexOf(":"))+"|"),C=C.parentNode;const o=y.pop()||l;for(w=C=o;y.length>0;)C=y.pop(),w.appendChild(C),w=C;E?((t=t.cloneNode(!1)).appendChild(o),E.insertBefore(t,E.firstChild),b.appendChild(E),_.push(t),E=null):t.appendChild(o),L=l,T=l.data.length,B=!0,!c&&u&&(t=l,l.textContent=r.zeroWidthSpace),C!==l&&C.appendChild(L)}}}(e,b),d&&!c&&!h.v)return{ancestor:e,startContainer:i,startOffset:l,endContainer:o,endOffset:s};if(c=c&&d)for(let e=0;e<_.length;e++){let t,n,i,l=_[e];if(u)t=r.createTextNode(r.zeroWidthSpace),b.replaceChild(t,l);else{const e=l.childNodes;for(n=e[0];e[0];)i=e[0],b.insertBefore(i,l);r.removeItem(l)}0===e&&(u?S=L=t:(S=n,L=i))}else{if(d)for(let e=0;e<_.length;e++)this._stripRemoveNode(_[e]);u&&(S=L=t)}r.removeEmptyNode(b,t),u&&(N=S.textContent.length,T=L.textContent.length);const M=c||0===L.textContent.length;r.isBreak(L)||0!==L.textContent.length||(r.removeItem(L),L=S),T=M?L.textContent.length:T;const H={s:0,e:0},I=r.getNodePath(S,b,H),D=!L.parentNode;D&&(L=S);const O={s:0,e:0},R=r.getNodePath(L,b,D||M?null:O);N+=H.s,T=u?N:D?S.textContent.length:M?T+H.s:T+O.s;const F=r.mergeSameTags(b,[I,R],!0);return e.parentNode.replaceChild(b,e),S=r.getNodeFromPath(I,b),L=r.getNodeFromPath(R,b),{ancestor:b,startContainer:S,startOffset:N+F[0],endContainer:L,endOffset:T+F[1]}},_nodeChange_startLine:function(e,t,n,i,l,o,s,a,c,d,u){let h=i.parentNode;for(;!(h.nextSibling||h.previousSibling||r.isFormatElement(h.parentNode)||r.isWysiwygDiv(h.parentNode))&&h.nodeName!==t.nodeName;)h=h.parentNode;if(!s&&h.nodeName===t.nodeName&&!r.isFormatElement(h)&&!h.nextSibling&&r.onlyZeroWidthSpace(i.textContent.slice(0,l))){let n=!0,o=i.previousSibling;for(;o;){if(!r.onlyZeroWidthSpace(o)){n=!1;break}o=o.previousSibling}if(n)return r.copyTagAttributes(h,t),{ancestor:e,container:i,offset:l}}a.v=!1;const g=e,p=[t],m=e.cloneNode(!1);let f,_,b,v,y=i,C=l,w=!1;if(function e(i,l){const o=i.childNodes;for(let i,s,a=0,h=o.length;a0,y=f.pop()||h;for(b=_=y;f.length>0;)_=f.pop(),b.appendChild(_),b=_;if(d(t.parentNode)&&!d(y)&&(t=t.cloneNode(!1),m.appendChild(t),p.push(t)),!v&&d(y)){t=t.cloneNode(!1);const e=y.childNodes;for(let n=0,i=e.length;n0;)_=f.pop(),b.appendChild(_),b=_;d!==l?(t.appendChild(d),l=_):l=t,r.isBreak(h)&&t.appendChild(h.cloneNode(!1)),e.appendChild(t),y=s,C=0,w=!0,l.appendChild(y)}}}(e,m),s&&!o&&!a.v)return{ancestor:e,container:i,offset:l,endContainer:u};if(o=o&&s)for(let e=0;e0&&u===h)return e.innerHTML=i.innerHTML,{ancestor:e,endContainer:n?r.getNodeFromPath(n,e):null}}o.v=!1;const a=e.cloneNode(!1),c=[t];let d=!0;if(function e(i,l){const o=i.childNodes;for(let i,u,h=0,g=o.length;h0&&(a.appendChild(t),t=t.cloneNode(!1)),u=g.cloneNode(!0),a.appendChild(u),a.appendChild(t),c.push(t),l=t,s&&g.contains(s)){const e=r.getNodePath(s,g);s=r.getNodeFromPath(e,u)}}}(e,t),d||l&&!i&&!o.v)return{ancestor:e,endContainer:s};if(a.appendChild(t),i&&l)for(let e=0;e0,u=m.pop()||a;for(_=f=u;m.length>0;)f=m.pop(),_.appendChild(f),_=f;if(d(t.parentNode)&&!d(u)&&(t=t.cloneNode(!1),p.insertBefore(t,p.firstChild),g.push(t)),!b&&d(u)){t=t.cloneNode(!1);const e=u.childNodes;for(let n=0,i=e.length;n0?f:t}else s?(t.insertBefore(u,t.firstChild),l=f):l=t;if(b&&3===a.nodeType)if(c(a)){const e=r.getParentElement(l,function(e){return this._isMaintainedNode(e.parentNode)||e.parentNode===p}.bind(r));b.appendChild(e),t=e.cloneNode(!1),g.push(t),p.insertBefore(t,p.firstChild)}else b=null}if(C||a!==v)i=C?n(a):a.cloneNode(!1),i&&(l.insertBefore(i,l.firstChild),1!==a.nodeType||r.isBreak(a)||(u=i)),e(a,u);else{b=c(a);const e=r.createTextNode(1===v.nodeType?"":v.substringData(y,v.length-y)),o=r.createTextNode(1===v.nodeType?"":v.substringData(0,y));if(b){b=b.cloneNode(!1);const e=c(l);if(e&&e.parentNode!==p){let t=e,n=null;for(;t.parentNode!==p;){for(l=n=t.parentNode.cloneNode(!1);t.childNodes[0];)n.appendChild(t.childNodes[0]);t.appendChild(n),t=t.parentNode}t.parentNode.insertBefore(e,t.parentNode.firstChild)}b=b.cloneNode(!1)}else d(t.parentNode)&&!b&&(t=t.cloneNode(!1),p.appendChild(t),g.push(t));for(r.onlyZeroWidthSpace(e)||l.insertBefore(e,l.firstChild),f=l,m=[];f!==p&&null!==f;)i=d(f)?null:n(f),i&&1===f.nodeType&&m.push(i),f=f.parentNode;const s=m.pop()||l;for(_=f=s;m.length>0;)f=m.pop(),_.appendChild(f),_=f;s!==l?(t.insertBefore(s,t.firstChild),l=f):l=t,r.isBreak(a)&&t.appendChild(a.cloneNode(!1)),b?(b.insertBefore(t,b.firstChild),p.insertBefore(b,p.firstChild),b=null):p.insertBefore(t,p.firstChild),v=o,y=o.data.length,C=!0,l.insertBefore(v,l.firstChild)}}}(e,p),s&&!o&&!a.v)return{ancestor:e,container:i,offset:l};if(o=o&&s)for(let e=0;e-1?null:r.createElement(n);let d=n;/^SUB$/i.test(n)&&a.indexOf("SUP")>-1?d="SUP":/^SUP$/i.test(n)&&a.indexOf("SUB")>-1&&(d="SUB"),this.nodeChange(c,null,[d],!1),this.focus()}},removeFormat:function(){this.nodeChange(null,null,null,null)},indent:function(e){const t=this.getRange(),n=this.getSelectedElements(null),i=[],o="indent"!==e,s=l.rtl?"marginRight":"marginLeft";let a=t.startContainer,c=t.endContainer,d=t.startOffset,u=t.endOffset;for(let e,t,l=0,a=n.length;l0&&this.plugins.list.editInsideList.call(this,o,i),this.effectNode=null,this.setRange(a,d,c,u),this.history.push(!1)},toggleDisplayBlocks:function(){const t=e.element.wysiwyg;r.toggleClass(t,"se-show-block"),r.hasClass(t,"se-show-block")?r.addClass(this._styleCommandMap.showBlocks,"active"):r.removeClass(this._styleCommandMap.showBlocks,"active"),this._resourcesStateChange()},toggleCodeView:function(){const t=this._variable.isCodeView;this.controllersOff(),r.setDisabledButtons(!t,this.codeViewDisabledButtons),t?(this._setCodeDataToEditor(),e.element.wysiwygFrame.scrollTop=0,e.element.code.style.display="none",e.element.wysiwygFrame.style.display="block",this._variable._codeOriginCssText=this._variable._codeOriginCssText.replace(/(\s?display(\s+)?:(\s+)?)[a-zA-Z]+(?=;)/,"display: none"),this._variable._wysiwygOriginCssText=this._variable._wysiwygOriginCssText.replace(/(\s?display(\s+)?:(\s+)?)[a-zA-Z]+(?=;)/,"display: block"),"auto"!==l.height||l.codeMirrorEditor||(e.element.code.style.height="0px"),this._variable.isCodeView=!1,this._variable.isFullScreen||(this._notHideToolbar=!1,/balloon|balloon-always/i.test(l.mode)&&(e.element._arrow.style.display="",this._isInline=!1,this._isBalloon=!0,u._hideToolbar())),this.nativeFocus(),r.removeClass(this._styleCommandMap.codeView,"active"),this.history.push(!1)):(this._setEditorDataToCodeView(),this._variable._codeOriginCssText=this._variable._codeOriginCssText.replace(/(\s?display(\s+)?:(\s+)?)[a-zA-Z]+(?=;)/,"display: block"),this._variable._wysiwygOriginCssText=this._variable._wysiwygOriginCssText.replace(/(\s?display(\s+)?:(\s+)?)[a-zA-Z]+(?=;)/,"display: none"),"auto"!==l.height||l.codeMirrorEditor||(e.element.code.style.height=e.element.code.scrollHeight>0?e.element.code.scrollHeight+"px":"auto"),l.codeMirrorEditor&&l.codeMirrorEditor.refresh(),this._variable.isCodeView=!0,this._variable.isFullScreen||(this._notHideToolbar=!0,this._isBalloon&&(e.element._arrow.style.display="none",e.element.toolbar.style.left="",this._isInline=!0,this._isBalloon=!1,u._showToolbarInline())),this._variable._range=null,e.element.code.focus(),r.addClass(this._styleCommandMap.codeView,"active")),this._checkPlaceholder(),"function"==typeof h.toggleCodeView&&h.toggleCodeView(this._variable.isCodeView,this)},_setCodeDataToEditor:function(){const t=this._getCodeView();if(l.fullPage){const e=this._parser.parseFromString(t,"text/html"),n=e.head.children;for(let t=0,i=n.length;t0?this.convertContentsForEditor(t):"


    "},_setEditorDataToCodeView:function(){const t=this.convertHTMLForCodeView(e.element.wysiwyg);let n="";if(l.fullPage){const e=r.getAttributesToString(this._wd.body,null);n="\n\n"+this._wd.head.outerHTML.replace(/>(?!\n)/g,">\n")+"\n"+t+"\n"}else n=t;e.element.code.style.display="block",e.element.wysiwygFrame.style.display="none",this._setCodeView(n)},toggleFullScreen:function(t){const n=e.element.topArea,i=e.element.toolbar,o=e.element.editorArea,d=e.element.wysiwygFrame,g=e.element.code,p=this._variable;this.controllersOff(),p.isFullScreen?(p.isFullScreen=!1,d.style.cssText=p._wysiwygOriginCssText,g.style.cssText=p._codeOriginCssText,i.style.cssText="",o.style.cssText=p._editorAreaOriginCssText,n.style.cssText=p._originCssText,s.body.style.overflow=p._bodyOverflow,l.toolbarContainer&&l.toolbarContainer.appendChild(i),l.stickyToolbar>-1&&r.removeClass(i,"se-toolbar-sticky"),p._fullScreenAttrs.sticky&&!l.toolbarContainer&&(p._fullScreenAttrs.sticky=!1,e.element._stickyDummy.style.display="block",r.addClass(i,"se-toolbar-sticky")),this._isInline=p._fullScreenAttrs.inline,this._isBalloon=p._fullScreenAttrs.balloon,this._isInline&&u._showToolbarInline(),l.toolbarContainer&&r.removeClass(i,"se-toolbar-balloon"),u.onScroll_window(),r.changeElement(t.firstElementChild,c.expansion),r.removeClass(this._styleCommandMap.fullScreen,"active")):(p.isFullScreen=!0,p._fullScreenAttrs.inline=this._isInline,p._fullScreenAttrs.balloon=this._isBalloon,(this._isInline||this._isBalloon)&&(this._isInline=!1,this._isBalloon=!1),l.toolbarContainer&&e.element.relative.insertBefore(i,o),n.style.position="fixed",n.style.top="0",n.style.left="0",n.style.width="100%",n.style.maxWidth="100%",n.style.height="100%",n.style.zIndex="2147483647",""!==e.element._stickyDummy.style.display&&(p._fullScreenAttrs.sticky=!0,e.element._stickyDummy.style.display="none",r.removeClass(i,"se-toolbar-sticky")),p._bodyOverflow=s.body.style.overflow,s.body.style.overflow="hidden",p._editorAreaOriginCssText=o.style.cssText,p._wysiwygOriginCssText=d.style.cssText,p._codeOriginCssText=g.style.cssText,o.style.cssText=i.style.cssText="",d.style.cssText=(d.style.cssText.match(/\s?display(\s+)?:(\s+)?[a-zA-Z]+;/)||[""])[0],g.style.cssText=(g.style.cssText.match(/\s?display(\s+)?:(\s+)?[a-zA-Z]+;/)||[""])[0],i.style.width=d.style.height=g.style.height="100%",i.style.position="relative",i.style.display="block",p.innerHeight_fullScreen=a.innerHeight-i.offsetHeight,o.style.height=p.innerHeight_fullScreen+"px",r.changeElement(t.firstElementChild,c.reduction),l.iframe&&"auto"===l.height&&(o.style.overflow="auto",this._iframeAutoHeight()),r.addClass(this._styleCommandMap.fullScreen,"active")),"function"==typeof h.toggleFullScreen&&h.toggleFullScreen(this._variable.isFullScreen,this)},print:function(){const e=r.createElement("IFRAME");e.style.display="none",s.body.appendChild(e);const t=r.getIframeDocument(e),n=this.getContents(!0),i=this._wd;if(l.iframe){const e=l.fullPage?r.getAttributesToString(i.body,["contenteditable"]):'class="sun-editor-editable"';t.write(""+i.head.innerHTML+""+n+"")}else{const e=s.head.getElementsByTagName("link"),i=s.head.getElementsByTagName("style");let l="";for(let t=0,n=e.length;t"+l+''+n+"")}this.showLoading(),a.setTimeout((function(){try{if(e.focus(),r.isIE_Edge||s.documentMode||a.StyleMedia)try{e.contentWindow.document.execCommand("print",!1,null)}catch(t){e.contentWindow.print()}else e.contentWindow.print()}catch(e){throw Error("[SUNEDITOR.core.print.fail] error: "+e)}finally{d.closeLoading(),r.removeItem(e)}}),1e3)},preview:function(){d.submenuOff(),d.containerOff(),d.controllersOff();const t=l.previewTemplate?l.previewTemplate.replace(/\{\{\s*contents\s*\}\}/i,this.getContents(!0)):this.getContents(!0),n=a.open("","_blank");n.mimeType="text/html";const o=e.element.wysiwygFrame.offsetWidth+"px !important",c=this._wd;if(l.iframe){const e=l.fullPage?r.getAttributesToString(c.body,["contenteditable"]):'class="sun-editor-editable"';n.document.write(""+c.head.innerHTML+""+t+"")}else{const e=s.head.getElementsByTagName("link"),l=s.head.getElementsByTagName("style");let a="";for(let t=0,n=e.length;t'+i.toolbar.preview+""+a+''+t+"")}},setContents:function(t){const n=this.convertContentsForEditor(t);if(this._resetComponents(),this._variable.isCodeView){const e=this.convertHTMLForCodeView(n);this._setCodeView(e)}else e.element.wysiwyg.innerHTML=n,this.history.push(!1)},getContents:function(t){const n=e.element.wysiwyg.innerHTML,i=r.createElement("DIV");i.innerHTML=n;const o=r.getListChildren(i,(function(e){return/FIGCAPTION/i.test(e.nodeName)}));for(let e=0,t=o.length;e"+this._wd.head.outerHTML+""+i.innerHTML+""}return i.innerHTML},_makeLine:function(e,t){if(1===e.nodeType)return r._disallowedTags(e)?"":!t||r.isFormatElement(e)||r.isRangeFormatElement(e)||r.isComponent(e)||r.isMedia(e)||r.isAnchor(e)&&r.isMedia(e.firstElementChild)?e.outerHTML:"

    "+e.outerHTML+"

    ";if(3===e.nodeType){if(!t)return e.textContent;const n=e.textContent.split(/\n/g);let i="";for(let e,t=0,l=n.length;t0&&(i+="

    "+e+"

    ");return i}return 8===e.nodeType&&this._allowHTMLComments?"\x3c!--"+e.textContent.trim()+"--\x3e":""},_tagConvertor:function(e){if(!this._disallowedTextTagsRegExp)return e;const t={b:"strong",i:"em",ins:"u",strike:"del",s:"del"};return e.replace(this._disallowedTextTagsRegExp,(function(e,n,i){return n+("string"==typeof t[i]?t[i]:i)}))},_deleteDisallowedTags:function(e){return e.replace(/\n/g,"").replace(/<(script|style).*>(\n|.)*<\/(script|style)>/gi,"").replace(/<[a-z0-9]+\:[a-z0-9]+[^>^\/]*>[^>]*<\/[a-z0-9]+\:[a-z0-9]+>/gi,"").replace(this.editorTagsWhitelistRegExp,"")},cleanHTML:function(e,t){e=this._deleteDisallowedTags(e).replace(/(<[a-zA-Z0-9]+)[^>]*(?=>)/g,function(e,t){if(/^<[a-z0-9]+\:[a-z0-9]+/i.test(e))return e;let n=null;const i=this._attributesTagsWhitelist[t.match(/(?!<)[a-zA-Z0-9]+/)[0].toLowerCase()];if(n=i?e.match(i):e.match(this._attributesWhitelistRegExp),/

    ":(i=r.htmlRemoveWhiteSpace(i),this._tagConvertor(i))},convertHTMLForCodeView:function(e){let t="";const n=a.RegExp,i=new n("^(BLOCKQUOTE|PRE|TABLE|THEAD|TBODY|TR|TH|TD|OL|UL|IMG|IFRAME|VIDEO|AUDIO|FIGURE|FIGCAPTION|HR|BR|CANVAS|SELECT)$","i"),l=r.isFormatElement.bind(r),o="string"==typeof e?s.createRange().createContextualFragment(e):e;let c=1*this._variable.codeIndent;return c=c>0?new a.Array(c+1).join(" "):"",function e(o,s,a){const d=o.childNodes,u=i.test(o.nodeName),h=u?s:"";for(let g,p,m,f=0,_=d.length;f<_;f++){if(g=d[f],m=i.test(g.nodeName),p=m?"\n":"",a=!l(g)||u||/^(TH|TD)$/i.test(o.nodeName)?"":"\n",8===g.nodeType){t+="\n\x3c!-- "+g.textContent.trim()+" --\x3e"+p;continue}if(3===g.nodeType){t+=r._HTMLConvertor(/^\n+$/.test(g.data)?"":g.data);continue}if(0===g.childNodes.length){t+=(/^HR$/i.test(g.nodeName)?"\n":"")+h+g.outerHTML+p;continue}g.innerHTML=g.innerHTML;const _=g.nodeName.toLowerCase();t+=(a||(u?"":p))+(h||m?s:"")+g.outerHTML.match(n("<"+_+"[^>]*>","i"))[0]+p,e(g,s+c,""),t+=(m?s:"")+""+(a||p||u||/^(TH|TD)$/i.test(g.nodeName)?"\n":"")}}(o,"","\n"),t.trim()+"\n"},addDocEvent:function(e,t,n){s.addEventListener(e,t,n),l.iframe&&this._wd.addEventListener(e,t)},removeDocEvent:function(e,t){s.removeEventListener(e,t),l.iframe&&this._wd.removeEventListener(e,t)},_charCount:function(e){const t=l.maxCharCount,n=l.charCounterType;let i=0;if(e&&(i=this.getCharLength(e,n)),this._setCharCount(),t>0){let e=!1;const l=h.getCharCount(n);if(l>t){if(e=!0,i>0){this._editorRange();const e=this.getRange(),n=e.endOffset-1,i=this.getSelectionNode().textContent,o=e.endOffset-(l-t);this.getSelectionNode().textContent=i.slice(0,o<0?0:o)+i.slice(e.endOffset,i.length),this.setRange(e.endContainer,n,e.endContainer,n)}}else l+i>t&&(e=!0);if(e&&(this._callCounterBlink(),i>0))return!1}return!0},checkCharCount:function(e,t){if(l.maxCharCount){const n=t||l.charCounterType,i=this.getCharLength("string"==typeof e?e:this._charTypeHTML?e.outerHTML:e.textContent,n);if(i>0&&i+h.getCharCount(n)>l.maxCharCount)return this._callCounterBlink(),!1}return!0},getCharLength:function(e,t){return/byte/.test(t)?r.getByteLength(e):e.length},_setCharCount:function(){e.element.charCounter&&a.setTimeout((function(){e.element.charCounter.textContent=h.getCharCount(l.charCounterType)}))},_callCounterBlink:function(){const t=e.element.charWrapper;t&&!r.hasClass(t,"se-blink")&&(r.addClass(t,"se-blink"),a.setTimeout((function(){r.removeClass(t,"se-blink")}),600))},_checkComponents:function(){for(let e=0,t=this._fileInfoPluginsCheck.length;e^<]+)?\\s*(?=>)","gi");const h="contenteditable|colspan|rowspan|target|href|src|class|type|controls|data-format|data-size|data-file-size|data-file-name|data-origin|data-align|data-image-link|data-rotate|data-proportion|data-percentage|origin-size|data-exp|data-font-size";this._allowHTMLComments=l._editorTagsWhitelist.indexOf("//")>-1,this._htmlCheckWhitelistRegExp=new c("^("+l._editorTagsWhitelist.replace("|//","")+")$","i"),this.editorTagsWhitelistRegExp=r.createTagsWhitelist(l._editorTagsWhitelist.replace("|//","|\x3c!--|--\x3e")),this.pasteTagsWhitelistRegExp=r.createTagsWhitelist(l.pasteTagsWhitelist);const g=l.attributesWhitelist,p={};let m="";if(g)for(let e in g)r.hasOwn(g,e)&&("all"===e?m=g[e]+"|":p[e]=new c("((?:"+g[e]+"|"+h+')s*=s*"[^"]*")',"ig"));this._attributesWhitelistRegExp=new c("((?:"+m+h+')s*=s*"[^"]*")',"ig"),this._attributesTagsWhitelist=p,this._isInline=/inline/i.test(l.mode),this._isBalloon=/balloon|balloon-always/i.test(l.mode),this._isBalloonAlways=/balloon-always/i.test(l.mode),this._cachingButtons(),this._fileInfoPluginsCheck=[],this._fileInfoPluginsReset=[],this.managedTagsInfo={query:"",map:{}};const f=[];this.activePlugins=[],this._fileManager.tags=[],this._fileManager.pluginMap={};let _,b,v=[];for(let e in n)if(r.hasOwn(n,e)){if(_=n[e],b=t[e],_.active&&b&&this.callPlugin(e,null,b),"function"==typeof _.checkFileInfo&&"function"==typeof _.resetFileInfo&&(this.callPlugin(e,null,b),this._fileInfoPluginsCheck.push(_.checkFileInfo.bind(this)),this._fileInfoPluginsReset.push(_.resetFileInfo.bind(this))),a.Array.isArray(_.fileTags)){const t=_.fileTags;this.callPlugin(e,null,b),this._fileManager.tags=this._fileManager.tags.concat(t),v.push(e);for(let n=0,i=t.length;nc&&(d=d.slice(0,c),a&&a.setAttribute("disabled",!0)),d[c]=l?{contents:n,s:{path:i.getNodePath(l.startContainer,null,null),offset:l.startOffset},e:{path:i.getNodePath(l.endContainer,null,null),offset:l.endOffset}}:{contents:n,s:{path:[0,0],offset:[0,0]},e:{path:0,offset:0}},1===c&&s&&s.removeAttribute("disabled"),e._setCharCount(),t()}return{stack:d,push:function(t){n.setTimeout(e._resourcesStateChange.bind(e));const i="number"==typeof t?t>0?t:0:t?l:0;i&&!r||(n.clearTimeout(r),i)?r=n.setTimeout((function(){n.clearTimeout(r),r=null,h()}),i):h()},undo:function(){c>0&&(c--,u())},redo:function(){d.length-1>c&&(c++,u())},go:function(e){c=e<0?d.length-1:e,u()},reset:function(n){s&&s.setAttribute("disabled",!0),a&&a.setAttribute("disabled",!0),e.context.tool.save&&e.context.tool.save.setAttribute("disabled",!0),d.splice(0),c=0,d[c]={contents:e.getContents(!0),s:{path:[0,0],offset:0},e:{path:[0,0],offset:0}},n||t()},_resetCachingButton:function(){o=e.context.element,s=e.context.tool.undo,a=e.context.tool.redo,0===c?(s&&s.setAttribute("disabled",!0),a&&c===d.length-1&&a.setAttribute("disabled",!0),e.context.tool.save&&e.context.tool.save.setAttribute("disabled",!0)):c===d.length-1&&a&&a.setAttribute("disabled",!0)},_destroy:function(){r&&n.clearTimeout(r),d=null}}}(this,this._onChange_historyStack.bind(this)),this.addModule([B]),l.iframe&&(this._wd=e.element.wysiwygFrame.contentDocument,e.element.wysiwyg=this._wd.body,l._editorStyles.editor&&(e.element.wysiwyg.style.cssText=l._editorStyles.editor),"auto"===l.height&&(this._iframeAuto=this._wd.body)),this._initWysiwygArea(i,o)},_cachingButtons:function(){this.codeViewDisabledButtons=e.element.toolbar.querySelectorAll('.se-toolbar button:not([class~="se-code-view-enabled"])'),this.resizingDisabledButtons=e.element.toolbar.querySelectorAll('.se-toolbar button:not([class~="se-resizing-enabled"])');const t=e.tool;this.commandMap={STRONG:t.bold,U:t.underline,EM:t.italic,DEL:t.strike,SUB:t.subscript,SUP:t.superscript,OUTDENT:t.outdent,INDENT:t.indent},this._styleCommandMap={fullScreen:t.fullScreen,showBlocks:t.showBlocks,codeView:t.codeView}},_initWysiwygArea:function(t,n){e.element.wysiwyg.innerHTML=t?n:this.convertContentsForEditor("string"==typeof n?n:e.element.originElement.value)},_resourcesStateChange:function(){this._iframeAutoHeight(),this._checkPlaceholder()},_onChange_historyStack:function(){u._applyTagEffects(),e.tool.save&&e.tool.save.removeAttribute("disabled"),h.onChange&&h.onChange(this.getContents(!0),this)},_iframeAutoHeight:function(){this._iframeAuto&&a.setTimeout((function(){e.element.wysiwygFrame.style.height=d._iframeAuto.offsetHeight+"px"}))},_checkPlaceholder:function(){if(this._placeholder){if(this._variable.isCodeView)return void(this._placeholder.style.display="none");const t=e.element.wysiwyg;!r.onlyZeroWidthSpace(t.textContent)||t.querySelector(".se-component, pre, blockquote, hr, li, table, img, iframe, video")||(t.innerText.match(/\n/g)||"").length>1?this._placeholder.style.display="none":this._placeholder.style.display="block"}},_setDefaultFormat:function(e){if(this._fileManager.pluginRegExp.test(this.currentControllerName))return;const t=this.getRange(),n=t.commonAncestorContainer,i=t.startContainer,l=r.getRangeFormatElement(n,null);let o,s,a;const c=r.getParentElement(n,r.isComponent);if((!c||r.isTable(c))&&(!r.isRangeFormatElement(i)&&!r.isWysiwygDiv(i)||!r.isComponent(i.childNodes[t.startOffset]))){if(l)return a=r.createElement(e||"P"),a.innerHTML=l.innerHTML,0===a.childNodes.length&&(a.innerHTML=r.zeroWidthSpace),l.innerHTML=a.outerHTML,a=l.firstChild,o=r.getEdgeChildNodes(a,null).sc,o||(o=r.createTextNode(r.zeroWidthSpace),a.insertBefore(o,a.firstChild)),s=o.textContent.length,void this.setRange(o,s,o,s);if(r.isRangeFormatElement(n)&&n.childNodes.length<=1){let e=null;return 1===n.childNodes.length&&r.isBreak(n.firstChild)?e=n.firstChild:(e=r.createTextNode(r.zeroWidthSpace),n.appendChild(e)),void this.setRange(e,1,e,1)}if(this.execCommand("formatBlock",!1,e||"P"),o=r.getEdgeChildNodes(n,n),o=o?o.ec:n,a=r.getFormatElement(o,null),!a)return this.removeRange(),void this._editorRange();if(r.isBreak(a.nextSibling)&&r.removeItem(a.nextSibling),r.isBreak(a.previousSibling)&&r.removeItem(a.previousSibling),r.isBreak(o)){const e=r.createTextNode(r.zeroWidthSpace);o.parentNode.insertBefore(e,o),o=e}this.effectNode=null,this.nativeFocus()}},_setOptionsInit:function(t,n){this.context=e=k(t.originElement,this._getConstructed(t),l),this._componentsInfoReset=!0,this._editorInit(!0,n)},_editorInit:function(t,n){this._init(t,n),u._addEvent(),this._setCharCount(),u._offStickyToolbar(),u.onResize_window(),e.element.toolbar.style.visibility="",this._checkComponents(),this._componentsInfoInit=!1,this._componentsInfoReset=!1,this.history.reset(!0),this._resourcesStateChange(),a.setTimeout((function(){"function"==typeof h.onload&&h.onload(d,t)}))},_getConstructed:function(e){return{_top:e.topArea,_relative:e.relative,_toolBar:e.toolbar,_menuTray:e._menuTray,_editorArea:e.editorArea,_wysiwygArea:e.wysiwygFrame,_codeArea:e.code,_placeholder:e.placeholder,_resizingBar:e.resizingBar,_navigation:e.navigation,_charCounter:e.charCounter,_charWrapper:e.charWrapper,_loading:e.loading,_lineBreaker:e.lineBreaker,_lineBreaker_t:e.lineBreaker_t,_lineBreaker_b:e.lineBreaker_b,_resizeBack:e.resizeBackground,_stickyDummy:e._stickyDummy,_arrow:e._arrow}}},u={_IEisComposing:!1,_lineBreakerBind:null,_responsiveCurrentSize:"default",_responsiveButtonSize:null,_responsiveButtons:null,_directionKeyCode:new a.RegExp("^(8|13|3[2-9]|40|46)$"),_nonTextKeyCode:new a.RegExp("^(8|13|1[6-9]|20|27|3[3-9]|40|45|46|11[2-9]|12[0-3]|144|145)$"),_historyIgnoreKeyCode:new a.RegExp("^(1[6-9]|20|27|3[3-9]|40|45|11[2-9]|12[0-3]|144|145)$"),_onButtonsCheck:new a.RegExp("^(STRONG|U|EM|DEL|SUB|SUP)$"),_frontZeroWidthReg:new a.RegExp(r.zeroWidthSpace+"+",""),_keyCodeShortcut:{65:"A",66:"B",83:"S",85:"U",73:"I",89:"Y",90:"Z",219:"[",221:"]"},_shortcutCommand:function(e,t){let n=null;switch(u._keyCodeShortcut[e]){case"A":n="selectAll";break;case"B":-1===l.shortcutsDisable.indexOf("bold")&&(n="STRONG");break;case"S":t&&-1===l.shortcutsDisable.indexOf("strike")&&(n="DEL");break;case"U":-1===l.shortcutsDisable.indexOf("underline")&&(n="U");break;case"I":-1===l.shortcutsDisable.indexOf("italic")&&(n="EM");break;case"Z":-1===l.shortcutsDisable.indexOf("undo")&&(n=t?"redo":"undo");break;case"Y":-1===l.shortcutsDisable.indexOf("undo")&&(n="redo");break;case"[":-1===l.shortcutsDisable.indexOf("indent")&&(n="outdent");break;case"]":-1===l.shortcutsDisable.indexOf("indent")&&(n="indent")}return!!n&&(d.commandHandler(d.commandMap[n],n),!0)},_applyTagEffects:function(){let t=d.getSelectionNode();if(t===d.effectNode)return;d.effectNode=t;const i=l.rtl?"marginRight":"marginLeft",o=d.commandMap,s=this._onButtonsCheck,a=[],c=[],u=d.activePlugins,h=u.length;let g="";for(;t.firstChild;)t=t.firstChild;for(let e=t;!r.isWysiwygDiv(e)&&e;e=e.parentNode)if(1===e.nodeType&&!r.isBreak(e)){g=e.nodeName.toUpperCase(),c.push(g);for(let t,i=0;i0)&&(a.push("OUTDENT"),o.OUTDENT.removeAttribute("disabled")),-1===a.indexOf("INDENT")&&o.INDENT&&r.isListCell(e)&&!e.previousElementSibling&&(a.push("INDENT"),o.INDENT.setAttribute("disabled",!0))):s.test(g)&&(a.push(g),r.addClass(o[g],"active"))}for(let e in o)a.indexOf(e)>-1||!r.hasOwn(o,e)||(u.indexOf(e)>-1?n[e].active.call(d,null):o.OUTDENT&&/^OUTDENT$/i.test(e)?o.OUTDENT.setAttribute("disabled",!0):o.INDENT&&/^INDENT$/i.test(e)?o.INDENT.removeAttribute("disabled"):r.removeClass(o[e],"active"));d._variable.currentNodes=c.reverse(),d._variable.currentNodesMap=a,l.showPathLabel&&(e.element.navigation.textContent=d._variable.currentNodes.join(" > "))},_cancelCaptionEdit:function(){this.setAttribute("contenteditable",!1),this.removeEventListener("blur",u._cancelCaptionEdit)},_buttonsEventHandler:function(e){let t=e.target;if(d._bindControllersOff&&e.stopPropagation(),/^(input|textarea|select|option)$/i.test(t.nodeName)?d._antiBlur=!1:e.preventDefault(),r.getParentElement(t,".se-submenu"))e.stopPropagation(),d._notHideToolbar=!0;else{let n=t.getAttribute("data-command"),i=t.className;for(;!n&&!/se-menu-list/.test(i)&&!/sun-editor-common/.test(i);)t=t.parentNode,n=t.getAttribute("data-command"),i=t.className;n!==d._submenuName&&n!==d._containerName||e.stopPropagation()}},onClick_toolbar:function(e){let t=e.target,n=t.getAttribute("data-display"),i=t.getAttribute("data-command"),l=t.className;for(;t.parentNode&&!i&&!/se-menu-list/.test(l)&&!/se-toolbar/.test(l);)t=t.parentNode,i=t.getAttribute("data-command"),n=t.getAttribute("data-display"),l=t.className;(i||n)&&(t.disabled||(d.hasFocus||d.nativeFocus(),d._variable.isCodeView||d._editorRange(),d.actionCall(i,n,t)))},onMouseDown_wysiwyg:function(t){if(r.isNonEditable(e.element.wysiwyg))return;const n=r.getParentElement(t.target,r.isCell);if(n){const e=d.plugins.table;e&&n!==e._fixedCell&&!e._shift&&d.callPlugin("table",(function(){e.onTableCellMultiSelect.call(d,n,!1)}),null)}d._isBalloon&&u._hideToolbar(),/FIGURE/i.test(t.target.nodeName)&&t.preventDefault(),"function"==typeof h.onMouseDown&&h.onMouseDown(t,d)},onClick_wysiwyg:function(t){const n=t.target;if(r.isNonEditable(e.element.wysiwyg))return;const i=d.getFileComponent(n);if(i)return t.preventDefault(),void d.selectComponent(i.target,i.pluginName);const l=r.getParentElement(n,"FIGCAPTION");if(r.isNonEditable(l)&&(t.preventDefault(),l.setAttribute("contenteditable",!0),l.focus(),d._isInline&&!d._inlineToolbarAttr.isShow)){u._showToolbarInline();const e=function(){u._hideToolbar(),l.removeEventListener("blur",e)};l.addEventListener("blur",e)}a.setTimeout(d._editorRange.bind(d)),d._editorRange();const o=d.getSelectionNode(),s=r.getFormatElement(o,null),c=r.getRangeFormatElement(o,null);if(s&&s!==c||r.isNonEditable(n)||r.isList(c))u._applyTagEffects();else{const e=d.getRange();if(r.getFormatElement(e.startContainer)===r.getFormatElement(e.endContainer)){if(r.isList(c)){const e=r.createElement("LI"),t=o.nextElementSibling;e.appendChild(o),c.insertBefore(e,t)}else r.isWysiwygDiv(o)||r.isComponent(o)||r.isTable(o)&&!r.isCell(o)||d._setDefaultFormat(r.isRangeFormatElement(c)?"DIV":"P");t.preventDefault(),d.focus()}}d._isBalloon&&a.setTimeout(u._toggleToolbarBalloon),"function"==typeof h.onClick&&h.onClick(t,d)},_balloonDelay:null,_showToolbarBalloonDelay:function(){u._balloonDelay&&a.clearTimeout(u._balloonDelay),u._balloonDelay=a.setTimeout(function(){a.clearTimeout(this._balloonDelay),this._balloonDelay=null,this._showToolbarBalloon()}.bind(u),350)},_toggleToolbarBalloon:function(){d._editorRange();const e=d.getRange();d._bindControllersOff||!d._isBalloonAlways&&e.collapsed?u._hideToolbar():u._showToolbarBalloon(e)},_showToolbarBalloon:function(t){if(!d._isBalloon)return;const n=t||d.getRange(),i=e.element.toolbar,l=d.getSelection();let o;if(d._isBalloonAlways&&n.collapsed)o=!0;else if(l.focusNode===l.anchorNode)o=l.focusOffset0&&u._getPageBottomSpace()C&&(t=!1,y=!0),y&&(b=(t?n.top-m-g:n.bottom+g)-(n.noText?0:h)+d),i.style.left=a.Math.floor(v)+"px",i.style.top=a.Math.floor(b)+"px",t?(r.removeClass(e.element._arrow,"se-arrow-up"),r.addClass(e.element._arrow,"se-arrow-down"),e.element._arrow.style.top=m+"px"):(r.removeClass(e.element._arrow,"se-arrow-down"),r.addClass(e.element._arrow,"se-arrow-up"),e.element._arrow.style.top=-g+"px");const w=a.Math.floor(p/2+(f-v));e.element._arrow.style.left=(w+g>i.offsetWidth?i.offsetWidth-g:w";const e=f.attributes;for(;e[0];)f.removeAttribute(e[0].name);return d.nativeFocus(),!1}}if(f&&g.startContainer===g.endContainer&&3===c.nodeType&&!r.isFormatElement(c.parentNode)&&(g.collapsed?1===c.textContent.length:g.endOffset-g.startOffset===c.textContent.length)){t.preventDefault();let e=null,n=c.parentNode.previousSibling;const i=c.parentNode.nextSibling;n||(i?(n=i,e=0):(n=r.createElement("BR"),f.appendChild(n))),c.textContent="",r.removeItemAllParents(c,null,f),e="number"==typeof e?e:3===n.nodeType?n.textContent.length:1,d.setRange(n,e,n,e);break}const n=g.commonAncestorContainer;if(f=r.getFormatElement(g.startContainer,null),_=r.getRangeFormatElement(f,null),_&&f&&!r.isCell(_)&&!/^FIGCAPTION$/i.test(_.nodeName)){if(r.isListCell(f)&&r.isList(_)&&(r.isListCell(_.parentNode)||f.previousElementSibling)&&(c===f||3===c.nodeType&&(!c.previousSibling||r.isList(c.previousSibling)))&&(r.getFormatElement(g.startContainer,null)!==r.getFormatElement(g.endContainer,null)?_.contains(g.startContainer):0===g.startOffset&&g.collapsed)){if(g.startContainer!==g.endContainer)t.preventDefault(),d.removeNode(),3===g.startContainer.nodeType&&d.setRange(g.startContainer,g.startContainer.textContent.length,g.startContainer,g.startContainer.textContent.length),d.history.push(!0);else{let e=f.previousElementSibling||_.parentNode;if(r.isListCell(e)){t.preventDefault();let n=e;if(!e.contains(f)&&r.isListCell(n)&&r.isList(n.lastElementChild)){for(n=n.lastElementChild.lastElementChild;r.isListCell(n)&&r.isList(n.lastElementChild);)n=n.lastElementChild&&n.lastElementChild.lastElementChild;e=n}let i=e===_.parentNode?_.previousSibling:e.lastChild;i||(i=r.createTextNode(r.zeroWidthSpace),_.parentNode.insertBefore(i,_.parentNode.firstChild));const l=3===i.nodeType?i.textContent.length:1,o=f.childNodes;let s=i,a=o[0];for(;a=o[0];)e.insertBefore(a,s.nextSibling),s=a;r.removeItem(f),0===_.children.length&&r.removeItem(_),d.setRange(i,l,i,l),d.history.push(!0)}}break}if(!p&&0===g.startOffset){let e=!0,i=n;for(;i&&i!==_&&!r.isWysiwygDiv(i);){if(i.previousSibling&&(1===i.previousSibling.nodeType||!r.onlyZeroWidthSpace(i.previousSibling.textContent.trim()))){e=!1;break}i=i.parentNode}if(e&&_.parentNode){t.preventDefault(),d.detachRangeFormatElement(_,r.isListCell(f)?[f]:null,null,!1,!1),d.history.push(!0);break}}}if(!p&&(0===g.startOffset||c===f&&f.childNodes[g.startOffset])){const e=c===f?f.childNodes[g.startOffset]:c,i=(3===n.nodeType||r.isBreak(n))&&!n.previousSibling&&0===g.startOffset;if(!e.previousSibling&&(r.isComponent(n.previousSibling)||i&&r.isComponent(f.previousSibling))){const e=d.getFileComponent(f.previousSibling);e&&(t.preventDefault(),t.stopPropagation(),0===f.textContent.length&&r.removeItem(f),d.selectComponent(e.target,e.pluginName));break}if(r.isNonEditable(e.previousSibling)){t.preventDefault(),t.stopPropagation(),r.removeItem(e.previousSibling);break}}break;case 46:if(m){t.preventDefault(),t.stopPropagation(),d.plugins[m].destroy.call(d);break}if(p&&u._hardDelete()){t.preventDefault(),t.stopPropagation();break}if((r.isFormatElement(c)||null===c.nextSibling||r.onlyZeroWidthSpace(c.nextSibling)&&null===c.nextSibling.nextSibling)&&g.startOffset===c.textContent.length){let e=f.nextElementSibling;if(!e){t.preventDefault();break}if(r.isComponent(e)){if(t.preventDefault(),r.onlyZeroWidthSpace(f)&&(r.removeItem(f),r.isTable(e))){let t=r.getChildElement(e,r.isCell,!1);t=t.firstElementChild||t,d.setRange(t,0,t,0);break}const n=d.getFileComponent(e);n&&(t.stopPropagation(),d.selectComponent(n.target,n.pluginName));break}}if(!p&&(d.isEdgePoint(g.endContainer,g.endOffset)||c===f&&f.childNodes[g.startOffset])){const e=c===f?f.childNodes[g.startOffset]:c;if(r.isNonEditable(e.nextSibling)){t.preventDefault(),t.stopPropagation(),r.removeItem(e.nextSibling);break}}if(f=r.getFormatElement(g.startContainer,null),_=r.getRangeFormatElement(f,null),r.isListCell(f)&&r.isList(_)&&(c===f||3===c.nodeType&&(!c.nextSibling||r.isList(c.nextSibling))&&(r.getFormatElement(g.startContainer,null)!==r.getFormatElement(g.endContainer,null)?_.contains(g.endContainer):g.endOffset===c.textContent.length&&g.collapsed))){g.startContainer!==g.endContainer&&d.removeNode();let e=r.getArrayItem(f.children,r.isList,!1);if(e=e||f.nextElementSibling||_.parentNode.nextElementSibling,e&&(r.isList(e)||r.getArrayItem(e.children,r.isList,!1))){let n,i;if(t.preventDefault(),r.isList(e)){const t=e.firstElementChild;for(i=t.childNodes,n=i[0];i[0];)f.insertBefore(i[0],e);r.removeItem(t)}else{for(n=e.firstChild,i=e.childNodes;i[0];)f.appendChild(i[0]);r.removeItem(e)}d.setRange(n,0,n,0),d.history.push(!0)}break}break;case 9:if(m||l.tabDisable)break;if(t.preventDefault(),o||s||r.isWysiwygDiv(c))break;const b=!g.collapsed||d.isEdgePoint(g.startContainer,g.startOffset),v=d.getSelectedElements(null);c=d.getSelectionNode();const y=[];let C=[],w=r.isListCell(v[0]),x=r.isListCell(v[v.length-1]),E={sc:g.startContainer,so:g.startOffset,ec:g.endContainer,eo:g.endOffset};for(let e,t=0,n=v.length;t0&&b&&d.plugins.list)E=d.plugins.list.editInsideList.call(d,i,y);else{const e=r.getParentElement(c,r.isCell);if(e&&b){const t=r.getParentElement(e,"table"),n=r.getListChildren(t,r.isCell);let l=i?r.prevIdx(n,e):r.nextIdx(n,e);l!==n.length||i||(l=0),-1===l&&i&&(l=n.length-1);let o=n[l];if(!o)break;o=o.firstElementChild||o,d.setRange(o,0,o,0);break}C=C.concat(y),w=x=null}if(C.length>0)if(i){const e=C.length-1;for(let t,n=0;n<=e;n++){t=C[n].childNodes;for(let e,n=0,i=t.length;n":"<"+f.nodeName+">
    ",!d.checkCharCount(e,"byte-html"))return t.preventDefault(),!1}if(!i&&S){t.preventDefault();const e=c===S,n=d.getSelection(),i=c.childNodes,l=n.focusOffset,o=c.previousElementSibling,s=c.nextSibling;if(!r.isClosureFreeFormatElement(S)&&i&&(e&&g.collapsed&&i.length-1<=l+1&&r.isBreak(i[l])&&(!i[l+1]||(!i[l+2]||r.onlyZeroWidthSpace(i[l+2].textContent))&&3===i[l+1].nodeType&&r.onlyZeroWidthSpace(i[l+1].textContent))&&l>0&&r.isBreak(i[l-1])||!e&&r.onlyZeroWidthSpace(c.textContent)&&r.isBreak(o)&&(r.isBreak(o.previousSibling)||!r.onlyZeroWidthSpace(o.previousSibling.textContent))&&(!s||!r.isBreak(s)&&r.onlyZeroWidthSpace(s.textContent)))){e?r.removeItem(i[l-1]):r.removeItem(c);const t=d.appendFormatTag(S,r.isFormatElement(S.nextElementSibling)?S.nextElementSibling:null);r.copyFormatAttributes(t,S),d.setRange(t,1,t,1);break}if(e){h.insertHTML(g.collapsed&&r.isBreak(g.startContainer.childNodes[g.startOffset-1])?"
    ":"

    ",!0,!1);let e=n.focusNode;const t=n.focusOffset;S===e&&(e=e.childNodes[t-l>1?t-1:t]),d.setRange(e,1,e,1)}else{const e=n.focusNode.nextSibling,t=r.createElement("BR");d.insertNode(t,null,!1);const i=t.previousSibling,l=t.nextSibling;r.isBreak(e)||r.isBreak(i)||l&&!r.onlyZeroWidthSpace(l)?d.setRange(l,0,l,0):(t.parentNode.insertBefore(t.cloneNode(!1),t),d.setRange(t,1,t,1))}u._onShortcutKey=!0;break}if(p)break;if(_&&f&&!r.isCell(_)&&!/^FIGCAPTION$/i.test(_.nodeName)){const e=d.getRange();if(d.isEdgePoint(e.endContainer,e.endOffset)&&r.isList(c.nextSibling)){t.preventDefault();const e=r.createElement("LI"),n=r.createElement("BR");e.appendChild(n),f.parentNode.insertBefore(e,f.nextElementSibling),e.appendChild(c.nextSibling),d.setRange(n,1,n,1);break}if((3!==e.commonAncestorContainer.nodeType||!e.commonAncestorContainer.nextElementSibling)&&r.onlyZeroWidthSpace(f.innerText.trim())){t.preventDefault();let e=null;if(r.isListCell(_.parentNode)){if(_=f.parentNode.parentNode.parentNode,e=r.splitElement(f,null,r.getElementDepth(f)-2),!e){const t=r.createElement("LI");t.innerHTML="
    ",_.insertBefore(t,e),e=t}}else{const t=r.isCell(_.parentNode)?"DIV":r.isList(_.parentNode)?"LI":r.isFormatElement(_.nextElementSibling)?_.nextElementSibling.nodeName:r.isFormatElement(_.previousElementSibling)?_.previousElementSibling.nodeName:"P";e=r.createElement(t);const n=d.detachRangeFormatElement(_,[f],null,!0,!0);n.cc.insertBefore(e,n.ec)}e.innerHTML="
    ",r.copyFormatAttributes(e,f),r.removeItemAllParents(f,null,null),d.setRange(e,1,e,1);break}}if(_&&r.getParentElement(_,"FIGCAPTION")&&r.getParentElement(_,r.isList)&&(t.preventDefault(),f=d.appendFormatTag(f,null),d.setRange(f,0,f,0)),m){t.preventDefault(),t.stopPropagation();const n=e[m],i=n._container,l=i.previousElementSibling||i.nextElementSibling;let o=null;r.isListCell(i.parentNode)?o=r.createElement("BR"):(o=r.createElement(r.isFormatElement(l)?l.nodeName:"P"),o.innerHTML="
    "),i.parentNode.insertBefore(o,i),d.callPlugin(m,(function(){d.selectComponent(n._element,m)}),null)}break;case 27:if(m)return t.preventDefault(),t.stopPropagation(),d.controllersOff(),!1}if(i&&/16/.test(n)){t.preventDefault(),t.stopPropagation();const e=d.plugins.table;if(e&&!e._shift&&!e._ref){const t=r.getParentElement(f,r.isCell);if(t)return void e.onTableCellMultiSelect.call(d,t,!0)}}if(!(o||s||p||u._nonTextKeyCode.test(n))&&g.collapsed&&g.startContainer===g.endContainer&&r.isBreak(g.commonAncestorContainer)){const e=r.createTextNode(r.zeroWidthSpace);d.insertNode(e,null,!1),d.setRange(e,1,e,1)}"function"==typeof h.onKeyDown&&h.onKeyDown(t,d)},onKeyUp_wysiwyg:function(e){if(u._onShortcutKey)return;d._editorRange();const t=d.getRange(),n=e.keyCode,i=e.ctrlKey||e.metaKey||91===n||92===n||224===n,l=e.altKey;let o=d.getSelectionNode();if(d._isBalloon&&(d._isBalloonAlways&&27!==n||!t.collapsed)){if(!d._isBalloonAlways)return void u._showToolbarBalloon();27!==n&&u._showToolbarBalloonDelay()}if(8===n&&r.isWysiwygDiv(o)&&""===o.textContent&&0===o.children.length){e.preventDefault(),e.stopPropagation(),o.innerHTML="";const t=r.createElement(r.isFormatElement(d._variable.currentNodes[0])?d._variable.currentNodes[0]:"P");return t.innerHTML="
    ",o.appendChild(t),d.setRange(t,0,t,0),u._applyTagEffects(),void d.history.push(!1)}const s=r.getFormatElement(o,null),a=r.getRangeFormatElement(o,null);(s||!t.collapsed)&&s!==a||r.isComponent(o)||r.isList(o)||(d._setDefaultFormat(r.isRangeFormatElement(a)?"DIV":"P"),o=d.getSelectionNode()),u._directionKeyCode.test(n)&&u._applyTagEffects();if(!i&&!l&&!u._nonTextKeyCode.test(n)&&3===o.nodeType&&r.zeroWidthRegExp.test(o.textContent)&&!(void 0!==e.isComposing?e.isComposing:u._IEisComposing)){let e=t.startOffset,n=t.endOffset;const i=(o.textContent.substring(0,n).match(u._frontZeroWidthReg)||"").length;e=t.startOffset-i,n=t.endOffset-i,o.textContent=o.textContent.replace(r.zeroWidthRegExp,""),d.setRange(o,e<0?0:e,o,n<0?0:n)}d._charCount(""),d.history.push(!0),"function"==typeof h.onKeyUp&&h.onKeyUp(e,d)},onScroll_wysiwyg:function(e){d.controllersOff(),d._lineBreaker.style.display="none",d._isBalloon&&u._hideToolbar(),"function"==typeof h.onScroll&&h.onScroll(e,d)},onFocus_wysiwyg:function(e){d._antiBlur||(d.hasFocus=!0,d._isInline&&u._showToolbarInline(),"function"==typeof h.onFocus&&h.onFocus(e,d))},onBlur_wysiwyg:function(t){if(d._antiBlur||d._variable.isCodeView)return;d.hasFocus=!1,d.controllersOff(),(d._isInline||d._isBalloon)&&u._hideToolbar(),"function"==typeof h.onBlur&&h.onBlur(t,d);const i=d.commandMap,o=d.activePlugins;for(let e in i)r.hasOwn(i,e)&&(o.indexOf(e)>-1?n[e].active.call(d,null):i.OUTDENT&&/^OUTDENT$/i.test(e)?i.OUTDENT.setAttribute("disabled",!0):i.INDENT&&/^INDENT$/i.test(e)?i.INDENT.removeAttribute("disabled"):r.removeClass(i[e],"active"));d._variable.currentNodes=[],d._variable.currentNodesMap=[],l.showPathLabel&&(e.element.navigation.textContent="")},onMouseDown_resizingBar:function(t){t.stopPropagation(),d._variable.resizeClientY=t.clientY,e.element.resizeBackground.style.display="block",s.addEventListener("mousemove",u._resize_editor),s.addEventListener("mouseup",(function t(){e.element.resizeBackground.style.display="none",s.removeEventListener("mousemove",u._resize_editor),s.removeEventListener("mouseup",t)}))},_resize_editor:function(t){const n=e.element.editorArea.offsetHeight+(t.clientY-d._variable.resizeClientY);e.element.wysiwygFrame.style.height=e.element.code.style.height=(n=n+o?(d._sticky||u._onStickyToolbar(),t.toolbar.style.top=n+o+l.stickyToolbar-i-d._variable.minResizingSize+"px"):i>=o&&u._onStickyToolbar()},_getEditorOffsets:function(t){let n=t||e.element.topArea,i=0,l=0,o=0;for(;n;)i+=n.offsetTop,l+=n.offsetLeft,o+=n.scrollTop,n=n.offsetParent;return{top:i,left:l,scroll:o}},_getPageBottomSpace:function(){return s.documentElement.scrollHeight-(u._getEditorOffsets(null).top+e.element.topArea.offsetHeight)},_onStickyToolbar:function(){const t=e.element;d._isInline||l.toolbarContainer||(t._stickyDummy.style.height=t.toolbar.offsetHeight+"px",t._stickyDummy.style.display="block"),t.toolbar.style.top=l.stickyToolbar+"px",t.toolbar.style.width=d._isInline?d._inlineToolbarAttr.width:t.toolbar.offsetWidth+"px",r.addClass(t.toolbar,"se-toolbar-sticky"),d._sticky=!0},_offStickyToolbar:function(){const t=e.element;t._stickyDummy.style.display="none",t.toolbar.style.top=d._isInline?d._inlineToolbarAttr.top:"",t.toolbar.style.width=d._isInline?d._inlineToolbarAttr.width:"",t.editorArea.style.marginTop="",r.removeClass(t.toolbar,"se-toolbar-sticky"),d._sticky=!1},_codeViewAutoHeight:function(){e.element.code.style.height=e.element.code.scrollHeight+"px"},_hardDelete:function(){const e=d.getRange(),t=e.startContainer,n=e.endContainer,i=r.getRangeFormatElement(t),l=r.getRangeFormatElement(n),o=r.isCell(i),s=r.isCell(l);if((o&&!i.previousElementSibling&&!i.parentElement.previousElementSibling||s&&!l.nextElementSibling&&!l.parentElement.nextElementSibling)&&i!==l)if(o){if(s)return r.removeItem(r.getParentElement(i,r.isComponent)),d.nativeFocus(),!0;r.removeItem(r.getParentElement(i,r.isComponent))}else r.removeItem(r.getParentElement(l,r.isComponent));const a=1===t.nodeType?r.getParentElement(t,".se-component"):null,c=1===n.nodeType?r.getParentElement(n,".se-component"):null;return a&&r.removeItem(a),c&&r.removeItem(c),!1},onPaste_wysiwyg:function(e){const t=r.isIE?a.clipboardData:e.clipboardData;return!t||u._dataTransferAction("paste",e,t)},_setClipboardComponent:function(e,t,n){e.preventDefault(),e.stopPropagation(),n.setData("text/html",t.component.outerHTML)},onCopy_wysiwyg:function(e){const t=r.isIE?a.clipboardData:e.clipboardData;if("function"==typeof h.onCopy&&!h.onCopy(e,t,d))return e.preventDefault(),e.stopPropagation(),!1;const n=d.currentFileComponentInfo;n&&!r.isIE&&(u._setClipboardComponent(e,n,t),r.addClass(n.component,"se-component-copy"),a.setTimeout((function(){r.removeClass(n.component,"se-component-copy")}),150))},onCut_wysiwyg:function(e){const t=r.isIE?a.clipboardData:e.clipboardData;if("function"==typeof h.onCut&&!h.onCut(e,t,d))return e.preventDefault(),e.stopPropagation(),!1;const n=d.currentFileComponentInfo;n&&!r.isIE&&(u._setClipboardComponent(e,n,t),r.removeItem(n.component),d.controllersOff()),a.setTimeout((function(){d.history.push(!1)}))},onDrop_wysiwyg:function(e){const t=e.dataTransfer;return!t||(r.isIE?(e.preventDefault(),e.stopPropagation(),!1):(d.removeNode(),u._setDropLocationSelection(e),u._dataTransferAction("drop",e,t)))},_setDropLocationSelection:function(e){if(e.rangeParent)d.setRange(e.rangeParent,e.rangeOffset,e.rangeParent,e.rangeOffset);else if(d._wd.caretRangeFromPoint){const t=d._wd.caretRangeFromPoint(e.clientX,e.clientY);d.setRange(t.startContainer,t.startOffset,t.endContainer,t.endOffset)}else{const e=d.getRange();d.setRange(e.startContainer,e.startOffset,e.endContainer,e.endOffset)}},_dataTransferAction:function(t,n,i){let l,o;if(r.isIE){l=i.getData("Text");const s=d.getRange(),c=r.createElement("DIV"),h={sc:s.startContainer,so:s.startOffset,ec:s.endContainer,eo:s.endOffset};return c.setAttribute("contenteditable",!0),c.style.cssText="position:absolute; top:0; left:0; width:1px; height:1px; overflow:hidden;",e.element.relative.appendChild(c),c.focus(),a.setTimeout((function(){o=c.innerHTML,r.removeItem(c),d.setRange(h.sc,h.so,h.ec,h.eo),u._setClipboardData(t,n,l,o,i)})),!0}if(l=i.getData("text/plain"),o=i.getData("text/html")||l,!1===u._setClipboardData(t,n,l,o,i))return n.preventDefault(),n.stopPropagation(),!1},_setClipboardData:function(e,t,n,i,l){/class=["']*Mso(Normal|List)/i.test(i)||/content=["']*Word.Document/i.test(i)||/content=["']*OneNote.File/i.test(i)?(i=i.replace(/\n/g," "),n=n.replace(/\n/g," ")):n=n.replace(/\n/g,""),i=d.cleanHTML(i,d.pasteTagsWhitelistRegExp);const o=d._charCount(d._charTypeHTML?i:n);if("paste"===e&&"function"==typeof h.onPaste){const e=h.onPaste(t,i,o,d);if(!e)return!1;"string"==typeof e&&(i=e)}if("drop"===e&&"function"==typeof h.onDrop){const e=h.onDrop(t,i,o,d);if(!e)return!1;"string"==typeof e&&(i=e)}const s=l.files;return s.length>0?(/^image/.test(s[0].type)&&d.plugins.image&&h.insertImage(s),!1):!!o&&(i?(h.insertHTML(i,!0,!1),!1):void 0)},onMouseMove_wysiwyg:function(t){if(d.isDisabled)return;const n=r.getParentElement(t.target,r.isComponent),i=d._lineBreaker.style;if(n&&!d.currentControllerName){let o=0,s=e.element.wysiwyg;do{o+=s.scrollTop,s=s.parentElement}while(s&&!/^(BODY|HTML)$/i.test(s.nodeName));const a=e.element.wysiwyg.scrollTop,c=u._getEditorOffsets(null),h=r.getOffset(n,e.element.wysiwygFrame).top+a,g=t.pageY+o+(l.iframe&&!l.toolbarContainer?e.element.toolbar.offsetHeight:0),p=h+(l.iframe?o:c.top),m=r.isListCell(n.parentNode);let f="",_="";if((m?!n.previousSibling:!r.isFormatElement(n.previousElementSibling))&&gp+n.offsetHeight-20))return void(i.display="none");_=h+n.offsetHeight,f="b"}d._variable._lineBreakComp=n,d._variable._lineBreakDir=f,i.top=_-a+"px",d._lineBreakerButton.style.left=r.getOffset(n).left+n.offsetWidth/2-15+"px",i.display="block"}else"none"!==i.display&&(i.display="none")},_onMouseDown_lineBreak:function(e){e.preventDefault()},_onLineBreak:function(e){e.preventDefault();const t=d._variable._lineBreakComp,n=this?this:d._variable._lineBreakDir,i=r.isListCell(t.parentNode),l=r.createElement(i?"BR":r.isCell(t.parentNode)?"DIV":"P");if(i||(l.innerHTML="
    "),d._charTypeHTML&&!d.checkCharCount(l.outerHTML,"byte-html"))return;t.parentNode.insertBefore(l,"t"===n?t:t.nextSibling),d._lineBreaker.style.display="none",d._variable._lineBreakComp=null;const o=i?l:l.firstChild;d.setRange(o,1,o,1),d.history.push(!1)},_addEvent:function(){const t=l.iframe?d._ww:e.element.wysiwyg;e.element.toolbar.addEventListener("mousedown",u._buttonsEventHandler,!1),e.element._menuTray.addEventListener("mousedown",u._buttonsEventHandler,!1),e.element.toolbar.addEventListener("click",u.onClick_toolbar,!1),t.addEventListener("mousedown",u.onMouseDown_wysiwyg,!1),t.addEventListener("click",u.onClick_wysiwyg,!1),t.addEventListener(r.isIE?"textinput":"input",u.onInput_wysiwyg,!1),t.addEventListener("keydown",u.onKeyDown_wysiwyg,!1),t.addEventListener("keyup",u.onKeyUp_wysiwyg,!1),t.addEventListener("paste",u.onPaste_wysiwyg,!1),t.addEventListener("copy",u.onCopy_wysiwyg,!1),t.addEventListener("cut",u.onCut_wysiwyg,!1),t.addEventListener("drop",u.onDrop_wysiwyg,!1),t.addEventListener("scroll",u.onScroll_wysiwyg,!1),t.addEventListener("focus",u.onFocus_wysiwyg,!1),t.addEventListener("blur",u.onBlur_wysiwyg,!1),u._lineBreakerBind={a:u._onLineBreak.bind(""),t:u._onLineBreak.bind("t"),b:u._onLineBreak.bind("b")},t.addEventListener("mousemove",u.onMouseMove_wysiwyg,!1),d._lineBreakerButton.addEventListener("mousedown",u._onMouseDown_lineBreak,!1),d._lineBreakerButton.addEventListener("click",u._lineBreakerBind.a,!1),e.element.lineBreaker_t.addEventListener("mousedown",u._lineBreakerBind.t,!1),e.element.lineBreaker_b.addEventListener("mousedown",u._lineBreakerBind.b,!1),d.plugins.table&&t.addEventListener("touchstart",u.onMouseDown_wysiwyg,{passive:!0,useCapture:!1}),"auto"!==l.height||l.codeMirrorEditor||(e.element.code.addEventListener("keydown",u._codeViewAutoHeight,!1),e.element.code.addEventListener("keyup",u._codeViewAutoHeight,!1),e.element.code.addEventListener("paste",u._codeViewAutoHeight,!1)),e.element.resizingBar&&(/\d+/.test(l.height)?e.element.resizingBar.addEventListener("mousedown",u.onMouseDown_resizingBar,!1):r.addClass(e.element.resizingBar,"se-resizing-none")),u._setResponsiveToolbar(),a.removeEventListener("resize",u.onResize_window),a.removeEventListener("scroll",u.onScroll_window),a.addEventListener("resize",u.onResize_window,!1),l.stickyToolbar>-1&&a.addEventListener("scroll",u.onScroll_window,!1)},_removeEvent:function(){const t=l.iframe?d._ww:e.element.wysiwyg;e.element.toolbar.removeEventListener("mousedown",u._buttonsEventHandler),e.element._menuTray.removeEventListener("mousedown",u._buttonsEventHandler),e.element.toolbar.removeEventListener("click",u.onClick_toolbar),t.removeEventListener("mousedown",u.onMouseDown_wysiwyg),t.removeEventListener("click",u.onClick_wysiwyg),t.removeEventListener(r.isIE?"textinput":"input",u.onInput_wysiwyg),t.removeEventListener("keydown",u.onKeyDown_wysiwyg),t.removeEventListener("keyup",u.onKeyUp_wysiwyg),t.removeEventListener("paste",u.onPaste_wysiwyg),t.removeEventListener("copy",u.onCopy_wysiwyg),t.removeEventListener("cut",u.onCut_wysiwyg),t.removeEventListener("drop",u.onDrop_wysiwyg),t.removeEventListener("scroll",u.onScroll_wysiwyg),t.removeEventListener("mousemove",u.onMouseMove_wysiwyg),d._lineBreakerButton.removeEventListener("mousedown",u._onMouseDown_lineBreak),d._lineBreakerButton.removeEventListener("click",u._lineBreakerBind.a),e.element.lineBreaker_t.removeEventListener("mousedown",u._lineBreakerBind.t),e.element.lineBreaker_b.removeEventListener("mousedown",u._lineBreakerBind.b),u._lineBreakerBind=null,t.removeEventListener("touchstart",u.onMouseDown_wysiwyg,{passive:!0,useCapture:!1}),t.removeEventListener("focus",u.onFocus_wysiwyg),t.removeEventListener("blur",u.onBlur_wysiwyg),e.element.code.removeEventListener("keydown",u._codeViewAutoHeight),e.element.code.removeEventListener("keyup",u._codeViewAutoHeight),e.element.code.removeEventListener("paste",u._codeViewAutoHeight),e.element.resizingBar&&e.element.resizingBar.removeEventListener("mousedown",u.onMouseDown_resizingBar),a.removeEventListener("resize",u.onResize_window),a.removeEventListener("scroll",u.onScroll_window)},_setResponsiveToolbar:function(){if(0===o.length)return void(o=null);const e=u._responsiveButtonSize=["default"],t=u._responsiveButtons={default:o[0]};for(let n,i,l=1,s=o.length;l",e}};return void 0===t&&(e.SUNEDITOR_MODULES||Object.defineProperty(e,"SUNEDITOR_MODULES",{enumerable:!0,writable:!1,configurable:!1,value:{}}),Object.defineProperty(e.SUNEDITOR_MODULES,"component",{enumerable:!0,writable:!1,configurable:!1,value:n})),n},"object"==typeof e.exports?e.exports=i.document?l(i,!0):function(e){if(!e.document)throw new Error("SUNEDITOR_MODULES a window with a document");return l(e)}:l(i)},ee5k:function(e,t,n){"use strict";var i,l;i="undefined"!=typeof window?window:this,l=function(e,t){const n={name:"resizing",add:function(e){const t=e.icons,n=e.context;n.resizing={_resizeClientX:0,_resizeClientY:0,_resize_plugin:"",_resize_w:0,_resize_h:0,_origin_w:0,_origin_h:0,_rotateVertical:!1,_resize_direction:"",_move_path:null,_isChange:!1,alignIcons:{basic:t.align_justify,left:t.align_left,right:t.align_right,center:t.align_center}};let i=this.setController_resize.call(e);n.resizing.resizeContainer=i,n.resizing.resizeDiv=i.querySelector(".se-modal-resize"),n.resizing.resizeDot=i.querySelector(".se-resize-dot"),n.resizing.resizeDisplay=i.querySelector(".se-resize-display");let l=this.setController_button.call(e);n.resizing.resizeButton=l;let o=n.resizing.resizeHandles=n.resizing.resizeDot.querySelectorAll("span");n.resizing.resizeButtonGroup=l.querySelector("._se_resizing_btn_group"),n.resizing.rotationButtons=l.querySelectorAll("._se_resizing_btn_group ._se_rotation"),n.resizing.percentageButtons=l.querySelectorAll("._se_resizing_btn_group ._se_percentage"),n.resizing.alignMenu=l.querySelector(".se-resizing-align-list"),n.resizing.alignMenuList=n.resizing.alignMenu.querySelectorAll("button"),n.resizing.alignButton=l.querySelector("._se_resizing_align_button"),n.resizing.autoSizeButton=l.querySelector("._se_resizing_btn_group ._se_auto_size"),n.resizing.captionButton=l.querySelector("._se_resizing_caption_button"),i.addEventListener("mousedown",(function(e){e.preventDefault()})),l.addEventListener("mousedown",e.eventStop),o[0].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),o[1].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),o[2].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),o[3].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),o[4].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),o[5].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),o[6].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),o[7].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),l.addEventListener("click",this.onClick_resizeButton.bind(e)),n.element.relative.appendChild(i),n.element.relative.appendChild(l),i=null,l=null,o=null},setController_resize:function(){const e=this.util.createElement("DIV");return e.className="se-controller se-resizing-container",e.style.display="none",e.innerHTML='
    ',e},setController_button:function(){const e=this.lang,t=this.icons,n=this.util.createElement("DIV");return n.className="se-controller se-controller-resizing",n.innerHTML='
    ",n},_module_getSizeX:function(e,t,n,i){return t||(t=e._element),n||(n=e._cover),i||(i=e._container),t?/%$/.test(t.style.width)?(i&&this.util.getNumber(i.style.width,2)||100)+"%":t.style.width:""},_module_getSizeY:function(e,t,n,i){return t||(t=e._element),n||(n=e._cover),i||(i=e._container),i&&n?this.util.getNumber(n.style.paddingBottom,0)>0&&!this.context.resizing._rotateVertical?n.style.height:/%$/.test(t.style.height)&&/%$/.test(t.style.width)?(i&&this.util.getNumber(i.style.height,2)||100)+"%":t.style.height:t&&t.style.height||""},_module_setModifyInputSize:function(e,t){const n=e._onlyPercentage&&this.context.resizing._rotateVertical;e.proportion.checked=e._proportionChecked="false"!==e._element.getAttribute("data-proportion");let i=n?"":this.plugins.resizing._module_getSizeX.call(this,e);if(i===e._defaultSizeX&&(i=""),e._onlyPercentage&&(i=this.util.getNumber(i,2)),e.inputX.value=i,t.setInputSize.call(this,"x"),!e._onlyPercentage){let t=n?"":this.plugins.resizing._module_getSizeY.call(this,e);t===e._defaultSizeY&&(t=""),e._onlyPercentage&&(t=this.util.getNumber(t,2)),e.inputY.value=t}e.inputX.disabled=!!n,e.inputY.disabled=!!n,e.proportion.disabled=!!n,t.setRatio.call(this)},_module_setInputSize:function(e,t){if(e._onlyPercentage)"x"===t&&e.inputX.value>100&&(e.inputX.value=100);else if(e.proportion.checked&&e._ratio&&/\d/.test(e.inputX.value)&&/\d/.test(e.inputY.value)){const n=e.inputX.value.replace(/\d+|\./g,"")||e.sizeUnit,i=e.inputY.value.replace(/\d+|\./g,"")||e.sizeUnit;if(n!==i)return;const l="%"===n?2:0;"x"===t?e.inputY.value=this.util.getNumber(e._ratioY*this.util.getNumber(e.inputX.value,l),l)+i:e.inputX.value=this.util.getNumber(e._ratioX*this.util.getNumber(e.inputY.value,l),l)+n}},_module_setRatio:function(e){const t=e.inputX.value,n=e.inputY.value;if(e.proportion.checked&&/\d+/.test(t)&&/\d+/.test(n)){if((t.replace(/\d+|\./g,"")||e.sizeUnit)!==(n.replace(/\d+|\./g,"")||e.sizeUnit))e._ratio=!1;else if(!e._ratio){const i=this.util.getNumber(t,0),l=this.util.getNumber(n,0);e._ratio=!0,e._ratioX=i/l,e._ratioY=l/i}}else e._ratio=!1},_module_sizeRevert:function(e){e._onlyPercentage?e.inputX.value=e._origin_w>100?100:e._origin_w:(e.inputX.value=e._origin_w,e.inputY.value=e._origin_h)},_module_saveCurrentSize:function(e){const t=this.plugins.resizing._module_getSizeX.call(this,e),n=this.plugins.resizing._module_getSizeY.call(this,e);e._element.setAttribute("data-size",t+","+n),e._videoRatio&&(e._videoRatio=n)},call_controller_resize:function(e,t){const n=this.context.resizing,i=this.context[t];n._resize_plugin=t;const l=n.resizeContainer,o=n.resizeDiv,s=this.util.getOffset(e,this.context.element.wysiwygFrame),a=n._rotateVertical=/^(90|270)$/.test(Math.abs(e.getAttribute("data-rotate")).toString()),r=a?e.offsetHeight:e.offsetWidth,c=a?e.offsetWidth:e.offsetHeight,d=s.top,u=s.left-this.context.element.wysiwygFrame.scrollLeft;l.style.top=d+"px",l.style.left=u+"px",l.style.width=r+"px",l.style.height=c+"px",o.style.top="0px",o.style.left="0px",o.style.width=r+"px",o.style.height=c+"px";let h=e.getAttribute("data-align")||"basic";h="none"===h?"basic":h;const g=this.util.getParentElement(e,this.util.isComponent),p=this.util.getParentElement(e,"FIGURE"),m=this.plugins.resizing._module_getSizeX.call(this,i,e,p,g)||"auto",f=i._onlyPercentage&&"image"===t?"":", "+(this.plugins.resizing._module_getSizeY.call(this,i,e,p,g)||"auto");this.util.changeTxt(n.resizeDisplay,this.lang.dialogBox[h]+" ("+m+f+")"),n.resizeButtonGroup.style.display=i._resizing?"":"none";const _=!i._resizing||i._resizeDotHide||i._onlyPercentage?"none":"flex",b=n.resizeHandles;for(let e=0,t=b.length;e=360?0:d;s.setAttribute("data-rotate",u),c._rotateVertical=/^(90|270)$/.test(this._w.Math.abs(u).toString()),this.plugins.resizing.setTransformSize.call(this,s,null,null),this.selectComponent(s,l);break;case"onalign":return void this.plugins.resizing.openAlignMenu.call(this);case"align":const h="basic"===i?"none":i;a.setAlign.call(this,h,null,null,null),this.selectComponent(s,l);break;case"caption":const g=!o._captionChecked;if(a.openModify.call(this,!0),o._captionChecked=o.captionCheckEl.checked=g,a.update_image.call(this,!1,!1,!1),g){const e=this.util.getChildElement(o._caption,(function(e){return 3===e.nodeType}));e?this.setRange(e,0,e,e.textContent.length):o._caption.focus(),this.controllersOff()}else this.selectComponent(s,l),a.openModify.call(this,!0);break;case"revert":a.setOriginSize.call(this),this.selectComponent(s,l);break;case"update":a.openModify.call(this),this.controllersOff();break;case"delete":a.destroy.call(this)}this.history.push(!1)}},resetTransform:function(e){const t=(e.getAttribute("data-size")||e.getAttribute("data-origin")||"").split(",");this.context.resizing._rotateVertical=!1,e.style.maxWidth="",e.style.transform="",e.style.transformOrigin="",e.setAttribute("data-rotate",""),e.setAttribute("data-rotateX",""),e.setAttribute("data-rotateY",""),this.plugins[this.context.resizing._resize_plugin].setSize.call(this,t[0]?t[0]:"auto",t[1]?t[1]:"",!0)},setTransformSize:function(e,t,n){let i=e.getAttribute("data-percentage");const l=this.context.resizing._rotateVertical,o=1*e.getAttribute("data-rotate");let s="";if(i&&!l)i=i.split(","),"auto"===i[0]&&"auto"===i[1]?this.plugins[this.context.resizing._resize_plugin].setAutoSize.call(this):this.plugins[this.context.resizing._resize_plugin].setPercentSize.call(this,i[0],i[1]);else{const i=this.util.getParentElement(e,"FIGURE"),a=t||e.offsetWidth,r=n||e.offsetHeight,c=(l?r:a)+"px",d=(l?a:r)+"px";if(this.plugins[this.context.resizing._resize_plugin].cancelPercentAttr.call(this),this.plugins[this.context.resizing._resize_plugin].setSize.call(this,a+"px",r+"px",!0),i.style.width=c,i.style.height=this.context[this.context.resizing._resize_plugin]._caption?"":d,l){let e=a/2+"px "+a/2+"px 0",t=r/2+"px "+r/2+"px 0";s=90===o||-270===o?t:e}}e.style.transformOrigin=s,this.plugins.resizing._setTransForm(e,o.toString(),e.getAttribute("data-rotateX")||"",e.getAttribute("data-rotateY")||""),e.style.maxWidth=l?"none":"",this.plugins.resizing.setCaptionPosition.call(this,e)},_setTransForm:function(e,t,n,i){let l=(e.offsetWidth-e.offsetHeight)*(/-/.test(t)?1:-1),o="";if(/[1-9]/.test(t)&&(n||i))switch(o=n?"Y":"X",t){case"90":o=n&&i?"X":i?o:"";break;case"270":l*=-1,o=n&&i?"Y":n?o:"";break;case"-90":o=n&&i?"Y":n?o:"";break;case"-270":l*=-1,o=n&&i?"X":i?o:"";break;default:o=""}t%180==0&&(e.style.maxWidth=""),e.style.transform="rotate("+t+"deg)"+(n?" rotateX("+n+"deg)":"")+(i?" rotateY("+i+"deg)":"")+(o?" translate"+o+"("+l+"px)":"")},setCaptionPosition:function(e){const t=this.util.getChildElement(this.util.getParentElement(e,"FIGURE"),"FIGCAPTION");t&&(t.style.marginTop=(this.context.resizing._rotateVertical?e.offsetWidth-e.offsetHeight:0)+"px")},onMouseDown_resize_handle:function(e){e.stopPropagation(),e.preventDefault();const t=this.context.resizing,n=t._resize_direction=e.target.classList[0];t._resizeClientX=e.clientX,t._resizeClientY=e.clientY,this.context.element.resizeBackground.style.display="block",t.resizeButton.style.display="none",t.resizeDiv.style.float=/l/.test(n)?"right":/r/.test(n)?"left":"none";const i=function(e){if("keydown"===e.type&&27!==e.keyCode)return;const o=t._isChange;t._isChange=!1,this.removeDocEvent("mousemove",l),this.removeDocEvent("mouseup",i),this.removeDocEvent("keydown",i),"keydown"===e.type?(this.controllersOff(),this.context.element.resizeBackground.style.display="none",this.plugins[this.context.resizing._resize_plugin].init.call(this)):(this.plugins.resizing.cancel_controller_resize.call(this,n),o&&this.history.push(!1))}.bind(this),l=this.plugins.resizing.resizing_element.bind(this,t,n,this.context[t._resize_plugin]);this.addDocEvent("mousemove",l),this.addDocEvent("mouseup",i),this.addDocEvent("keydown",i)},resizing_element:function(e,t,n,i){const l=i.clientX,o=i.clientY;let s=n._element_w,a=n._element_h;const r=n._element_w+(/r/.test(t)?l-e._resizeClientX:e._resizeClientX-l),c=n._element_h+(/b/.test(t)?o-e._resizeClientY:e._resizeClientY-o),d=n._element_h/n._element_w*r;/t/.test(t)&&(e.resizeDiv.style.top=n._element_h-(/h/.test(t)?c:d)+"px"),/l/.test(t)&&(e.resizeDiv.style.left=n._element_w-r+"px"),/r|l/.test(t)&&(e.resizeDiv.style.width=r+"px",s=r),/^(t|b)[^h]$/.test(t)?(e.resizeDiv.style.height=d+"px",a=d):/^(t|b)h$/.test(t)&&(e.resizeDiv.style.height=c+"px",a=c),e._resize_w=s,e._resize_h=a,this.util.changeTxt(e.resizeDisplay,this._w.Math.round(s)+" x "+this._w.Math.round(a)),e._isChange=!0},cancel_controller_resize:function(e){const t=this.context.resizing._rotateVertical;this.controllersOff(),this.context.element.resizeBackground.style.display="none";let n=this._w.Math.round(t?this.context.resizing._resize_h:this.context.resizing._resize_w),i=this._w.Math.round(t?this.context.resizing._resize_w:this.context.resizing._resize_h);if(!t&&!/%$/.test(n)){const e=16,t=this.context.element.wysiwygFrame.clientWidth-2*e-2;this.util.getNumber(n,0)>t&&(i=this._w.Math.round(i/n*t),n=t)}const l=this.context.resizing._resize_plugin;this.plugins[l].setSize.call(this,n,i,!1,e),this.selectComponent(this.context[l]._element,l)}};return void 0===t&&(e.SUNEDITOR_MODULES||Object.defineProperty(e,"SUNEDITOR_MODULES",{enumerable:!0,writable:!1,configurable:!1,value:{}}),Object.defineProperty(e.SUNEDITOR_MODULES,"resizing",{enumerable:!0,writable:!1,configurable:!1,value:n})),n},"object"==typeof e.exports?e.exports=i.document?l(i,!0):function(e){if(!e.document)throw new Error("SUNEDITOR_MODULES a window with a document");return l(e)}:l(i)},"gjS+":function(e,t,n){"use strict";var i,l;i="undefined"!=typeof window?window:this,l=function(e,t){const n={name:"fileManager",_xmlHttp:null,upload:function(e,t,n,i,l){this.showLoading();const o=this.plugins.fileManager,s=o._xmlHttp=this.util.getXMLHttpRequest();if(s.onreadystatechange=o._callBackUpload.bind(this,s,i,l),s.open("post",e,!0),null!==t&&"object"==typeof t&&this._w.Object.keys(t).length>0)for(let e in t)s.setRequestHeader(e,t[e]);s.send(n)},_callBackUpload:function(e,t,n){if(4===e.readyState)if(200===e.status)try{t(e)}catch(e){throw Error('[SUNEDITOR.fileManager.upload.callBack.fail] cause : "'+e.message+'"')}finally{this.closeLoading()}else{this.closeLoading();const t=e.responseText?JSON.parse(e.responseText):e;if("function"!=typeof n||n("",t,this)){const n="[SUNEDITOR.fileManager.upload.serverException] status: "+e.status+", response: "+(t.errorMessage||e.responseText);throw this.functions.noticeOpen(n),Error(n)}}},checkInfo:function(e,t,n,i,l){let o=[];for(let e=0,n=t.length;e-1||(a.splice(t,1),"function"==typeof n&&n(null,e,"delete",null,0,this),t--);l&&(this.context.resizing._resize_plugin=c)},setInfo:function(e,t,n,i,l){const o=l?this.context.resizing._resize_plugin:"";l&&(this.context.resizing._resize_plugin=e);const s=this.plugins[e],a=this.context[e],r=a._infoList;let c=t.getAttribute("data-index"),d=null,u="";if(i||(i={name:t.getAttribute("data-file-name")||("string"==typeof t.src?t.src.split("/").pop():""),size:t.getAttribute("data-file-size")||0}),!c||this._componentsInfoInit)u="create",c=a._infoIndex++,t.setAttribute("data-index",c),t.setAttribute("data-file-name",i.name),t.setAttribute("data-file-size",i.size),d={src:t.src,index:1*c,name:i.name,size:i.size},r.push(d);else{u="update",c*=1;for(let e=0,t=r.length;e=0){const i=this.context[e]._infoList;for(let e=0,l=i.length;e