From 804fd50edfc622108005d2352d4abdb3da8906c9 Mon Sep 17 00:00:00 2001 From: Victor_Jay Date: Thu, 28 May 2026 01:44:46 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E5=99=A8=E4=BB=A3=E7=A0=81=E5=9D=97=E6=8D=A2=E8=A1=8C=E6=BB=9A?= =?UTF-8?q?=E5=8A=A8=E8=B7=B3=E5=8A=A8=20+=20=E7=A7=BB=E9=99=A4=E8=A7=86?= =?UTF-8?q?=E9=A2=91=E5=92=8C=E7=BD=91=E7=BB=9C=E5=9B=BE=E7=89=87=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 修复 wangeditor 选区同步 scrollIntoView 导致代码块换行大幅跳动的问题 - 移除 getBoundingClientRect 替换 hack,改用元素自身真实位置计算滚动 - 将 block 参数从 end 改为 nearest,behavior 从 smooth 改为 instant - 修复 #editor-container 与 .w-e-scroll 双重滚动容器冲突 - #editor-container 和 .w-e-text-container 设为 overflow:hidden - .w-e-scroll 作为唯一滚动容器设 overflow-y:auto - updateCodeLabels 改为节流执行并保存/恢复滚动位置 - 新增 ensureCursorVisible 替代内置滚动保证光标可见 - 滚动同步函数统一引用 .w-e-scroll 容器 - 工具栏排除视频相关按钮和网络图片功能 - .gitignore 添加 .codebuddy --- .gitignore | 1 + templates/MetaLab-2026/html/posts/new.html | 8 +- templates/MetaLab-2026/static/css/posts.css | 1 + templates/MetaLab-2026/static/js/editor.js | 84 +- .../MetaLab-2026/static/lib/wangeditor.js | 2162 ++++++++--------- 5 files changed, 1167 insertions(+), 1089 deletions(-) diff --git a/.gitignore b/.gitignore index de6ad9d..ed82ca5 100644 --- a/.gitignore +++ b/.gitignore @@ -25,3 +25,4 @@ storage/logs/ .vscode/ *.swp *.swo +.codebuddy diff --git a/templates/MetaLab-2026/html/posts/new.html b/templates/MetaLab-2026/html/posts/new.html index 0e0d93d..6b4ee1a 100644 --- a/templates/MetaLab-2026/html/posts/new.html +++ b/templates/MetaLab-2026/html/posts/new.html @@ -15,12 +15,18 @@ } #editor-container { flex: 1; - overflow-y: auto; + overflow: hidden; min-height: 0; height: 100%; } +/* .w-e-scroll 是 wangEditor 内部唯一的滚动容器 */ .editor-pane .w-e-text-container { height: 100% !important; + overflow: hidden; +} +.editor-pane .w-e-scroll { + height: 100%; + overflow-y: auto; } .editor-pane .w-e-text-container [data-slate-editor] { min-height: 100%; diff --git a/templates/MetaLab-2026/static/css/posts.css b/templates/MetaLab-2026/static/css/posts.css index 10b390f..e6bf1e2 100644 --- a/templates/MetaLab-2026/static/css/posts.css +++ b/templates/MetaLab-2026/static/css/posts.css @@ -273,6 +273,7 @@ #editor-container { background: #fff; height: 100%; + overflow: hidden; } /* wangEditor 内部文本容器撑满 */ diff --git a/templates/MetaLab-2026/static/js/editor.js b/templates/MetaLab-2026/static/js/editor.js index 8bcf996..6e09cc7 100644 --- a/templates/MetaLab-2026/static/js/editor.js +++ b/templates/MetaLab-2026/static/js/editor.js @@ -61,9 +61,12 @@ function initEditor() { const editorConfig = { placeholder: '在此输入正文...', onChange() { - // 同步更新代码块语言标签(立即生效) + // 延迟更新代码块语言标签(同步操作 DOM 会干扰 wangEditor 内部同步,导致滚动跳动) updateCodeLabels(); + // 替代 wangEditor 内置 scrollIntoView(已禁用),仅在光标不可见时微调滚动 + ensureCursorVisible(); + clearTimeout(syncTimer); syncTimer = setTimeout(() => { updateStats(); @@ -128,7 +131,14 @@ function initEditor() { createToolbar({ editor, selector: '#toolbar-container', - config: {}, + config: { + excludeKeys: [ + // 移除视频相关按钮:不允许视频上传,不在前端提供视频按钮 + 'group-video', 'insertVideo', 'uploadVideo', + // 移除"网络图片"功能,仅保留上传图片 + 'insertImage', + ], + }, mode: 'default', }); @@ -144,16 +154,48 @@ function initEditor() { saveDraft(); }); - // 滚动同步 + // 滚动同步(.w-e-scroll 是编辑区唯一滚动容器) previewCont.addEventListener('scroll', syncScrollToEditor); setTimeout(() => { - const scroller = document.getElementById('editor-container') || editorPane; - scroller.addEventListener('scroll', syncScrollToPreview); + const scroller = (document.getElementById('editor-container') || editorPane).querySelector('.w-e-scroll'); + if (scroller) scroller.addEventListener('scroll', syncScrollToPreview); }, 500); console.log('%c📝 MetaLab Editor (wangEditor) ready', 'color:#6366f1;font-weight:bold'); } +/* ================================================================ + 确保光标可见 — 替代 wangEditor 内置 scrollIntoView + wangEditor 默认使用 block:"end" 会在代码块换行时导致大幅滚动, + 已在 wangeditor.js 中禁用该调用,此处用最小偏移量保证光标可见 + ================================================================ */ +function ensureCursorVisible() { + if (!editor) return; + requestAnimationFrame(() => { + try { + const sel = window.getSelection(); + if (!sel || !sel.rangeCount) return; + const range = sel.getRangeAt(0); + + // .w-e-scroll 是编辑区滚动容器 + const scroller = document.querySelector('#editor-container .w-e-scroll'); + if (!scroller) return; + + const cursorRect = range.getBoundingClientRect(); + const scrollRect = scroller.getBoundingClientRect(); + + // 光标低于可见区 → 向下滚到光标可见 + if (cursorRect.bottom > scrollRect.bottom) { + scroller.scrollTop += cursorRect.bottom - scrollRect.bottom + 8; + } + // 光标高于可见区 → 向上滚到光标可见 + else if (cursorRect.top < scrollRect.top) { + scroller.scrollTop -= scrollRect.top - cursorRect.top + 8; + } + } catch (_) { /* 忽略 */ } + }); +} + /* ================================================================ 字数统计 ================================================================ */ @@ -168,9 +210,20 @@ function getEditorHtml() { /* ================================================================ 代码块语言标签 — 从 提取并注入标签 ================================================================ */ +// 代码块语言标签更新节流定时器 +let codeLabelTimer = null; + function updateCodeLabels() { if (!editor) return; + // 节流:避免 onChange 中频繁调用导致滚动跳动 + clearTimeout(codeLabelTimer); + codeLabelTimer = setTimeout(_updateCodeLabelsImpl, 300); +} + +function _updateCodeLabelsImpl() { + if (!editor) return; + // wangEditor 编辑区 不带 class="language-xxx", // 但 getHtml() 输出带 class="language-xxx"。 // 用 DOMParser 解析 HTML 获取语言,再注入到编辑区对应 pre。 @@ -184,6 +237,11 @@ function updateCodeLabels() { if (!editorEl) return; const domPres = editorEl.querySelectorAll('pre'); + // 保存当前滚动位置,防止 DOM 操作引起跳动 + // .w-e-scroll 是 wangEditor 内部的滚动容器 + const scroller = editorEl.querySelector('.w-e-scroll'); + const savedScrollTop = scroller ? scroller.scrollTop : 0; + htmlPres.forEach((htmlPre, idx) => { const domPre = domPres[idx]; if (!domPre || domPre.querySelector('.code-lang-label')) return; @@ -200,6 +258,11 @@ function updateCodeLabels() { } } }); + + // 恢复滚动位置 + if (scroller && scroller.scrollTop !== savedScrollTop) { + scroller.scrollTop = savedScrollTop; + } } catch (_) { /* 忽略 */ } } @@ -256,10 +319,16 @@ function togglePreview() { ================================================================ */ let scrollSyncing = false; +function getEditorScroller() { + const el = document.getElementById('editor-container') || editorPane; + return el ? (el.querySelector('.w-e-scroll') || el) : null; +} + function syncScrollToPreview() { if (!previewVisible || scrollSyncing) return; scrollSyncing = true; - const scroller = document.getElementById('editor-container') || editorPane; + const scroller = getEditorScroller(); + if (!scroller) { scrollSyncing = false; return; } const ratio = scroller.scrollTop / Math.max(1, scroller.scrollHeight - scroller.clientHeight); previewCont.scrollTop = ratio * Math.max(1, previewCont.scrollHeight - previewCont.clientHeight); requestAnimationFrame(() => { scrollSyncing = false; }); @@ -268,8 +337,9 @@ function syncScrollToPreview() { function syncScrollToEditor() { if (!previewVisible || scrollSyncing) return; scrollSyncing = true; + const scroller = getEditorScroller(); + if (!scroller) { scrollSyncing = false; return; } const ratio = previewCont.scrollTop / Math.max(1, previewCont.scrollHeight - previewCont.clientHeight); - const scroller = document.getElementById('editor-container') || editorPane; scroller.scrollTop = ratio * Math.max(1, scroller.scrollHeight - scroller.clientHeight); requestAnimationFrame(() => { scrollSyncing = false; }); } diff --git a/templates/MetaLab-2026/static/lib/wangeditor.js b/templates/MetaLab-2026/static/lib/wangeditor.js index 1e4ac8d..37f7b9a 100644 --- a/templates/MetaLab-2026/static/lib/wangeditor.js +++ b/templates/MetaLab-2026/static/lib/wangeditor.js @@ -4,80 +4,80 @@ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.wangEditor = {})); })(this, (function (exports) { 'use strict'; - /** - * @description browser polyfill - * @author wangfupeng - */ - var _a; - // @ts-nocheck - // 必须是浏览器环境 - if (typeof global === 'undefined') { - // 检查 IE 浏览器 - if ('ActiveXObject' in window) { - var info = '抱歉,wangEditor V5+ 版本开始,不在支持 IE 浏览器'; - info += '\n Sorry, wangEditor V5+ versions do not support IE browser.'; - console.error(info); - } - globalThisPolyfill(); - AggregateErrorPolyfill(); - } - else if (global && ((_a = global.navigator) === null || _a === void 0 ? void 0 : _a.userAgent.match('QQBrowser'))) { - // 兼容 QQ 浏览器 AggregateError 报错 - globalThisPolyfill(); - AggregateErrorPolyfill(); - } - function globalThisPolyfill() { - // 部分浏览器不支持 globalThis - if (typeof globalThis === 'undefined') { - // @ts-ignore - window.globalThis = window; - } - } - function AggregateErrorPolyfill() { - if (typeof AggregateError === 'undefined') { - window.AggregateError = function (errors, msg) { - var err = new Error(msg); - err.errors = errors; - return err; - }; - } + /** + * @description browser polyfill + * @author wangfupeng + */ + var _a; + // @ts-nocheck + // 必须是浏览器环境 + if (typeof global === 'undefined') { + // 检查 IE 浏览器 + if ('ActiveXObject' in window) { + var info = '抱歉,wangEditor V5+ 版本开始,不在支持 IE 浏览器'; + info += '\n Sorry, wangEditor V5+ versions do not support IE browser.'; + console.error(info); + } + globalThisPolyfill(); + AggregateErrorPolyfill(); + } + else if (global && ((_a = global.navigator) === null || _a === void 0 ? void 0 : _a.userAgent.match('QQBrowser'))) { + // 兼容 QQ 浏览器 AggregateError 报错 + globalThisPolyfill(); + AggregateErrorPolyfill(); + } + function globalThisPolyfill() { + // 部分浏览器不支持 globalThis + if (typeof globalThis === 'undefined') { + // @ts-ignore + window.globalThis = window; + } + } + function AggregateErrorPolyfill() { + if (typeof AggregateError === 'undefined') { + window.AggregateError = function (errors, msg) { + var err = new Error(msg); + err.errors = errors; + return err; + }; + } } - /** - * @description node polyfill - * @author wangfupeng - */ - // @ts-nocheck - // 必须是 node 环境 - if (typeof global === 'object') { - // 用于 nodejs ,避免报错 - var globalProperty = Object.getOwnPropertyDescriptor(global, 'window'); - // global.window 为空则直接写入 - // 部分框架下已经定义了global.window且是不可写属性 - if (!global.window || globalProperty.set) { - global.window = global; - global.requestAnimationFrame = function () { }; - global.navigator = { - userAgent: '', - }; - global.location = { - hostname: '0.0.0.0', - port: 0, - protocol: 'http:', - }; - global.btoa = function () { }; - global.crypto = { - getRandomValues: function (buffer) { - return nodeCrypto.randomFillSync(buffer); - }, - }; - } - if (global.document != null) { - // SSR 环境下可能会报错 (issue 4409) - if (global.document.getElementsByTagName == null) { - global.document.getElementsByTagName = function () { return []; }; - } - } + /** + * @description node polyfill + * @author wangfupeng + */ + // @ts-nocheck + // 必须是 node 环境 + if (typeof global === 'object') { + // 用于 nodejs ,避免报错 + var globalProperty = Object.getOwnPropertyDescriptor(global, 'window'); + // global.window 为空则直接写入 + // 部分框架下已经定义了global.window且是不可写属性 + if (!global.window || globalProperty.set) { + global.window = global; + global.requestAnimationFrame = function () { }; + global.navigator = { + userAgent: '', + }; + global.location = { + hostname: '0.0.0.0', + port: 0, + protocol: 'http:', + }; + global.btoa = function () { }; + global.crypto = { + getRandomValues: function (buffer) { + return nodeCrypto.randomFillSync(buffer); + }, + }; + } + if (global.document != null) { + // SSR 环境下可能会报错 (issue 4409) + if (global.document.getElementsByTagName == null) { + global.document.getElementsByTagName = function () { return []; }; + } + } } var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; @@ -141,20 +141,20 @@ var hasMap = typeof Map !== "undefined"; var hasSet = typeof Set !== "undefined"; var hasProxies = typeof Proxy !== "undefined" && typeof Proxy.revocable !== "undefined" && typeof Reflect !== "undefined"; - /** - * The sentinel value returned by producers to replace the draft with undefined. + /** + * The sentinel value returned by producers to replace the draft with undefined. */ var NOTHING = hasSymbol ? /*#__PURE__*/ Symbol.for("immer-nothing") : (_ref = {}, _ref["immer-nothing"] = true, _ref); - /** - * To let Immer treat your class instances as plain immutable objects - * (albeit with a custom prototype), you must define either an instance property - * or a static property on each of your custom classes. - * - * Otherwise, your class instance will never be drafted, which means it won't be - * safe to mutate in a produce callback. + /** + * To let Immer treat your class instances as plain immutable objects + * (albeit with a custom prototype), you must define either an instance property + * or a static property on each of your custom classes. + * + * Otherwise, your class instance will never be drafted, which means it won't be + * safe to mutate in a produce callback. */ var DRAFTABLE = hasSymbol ? @@ -616,10 +616,10 @@ } } - /** - * Returns a new draft of the `base` object. - * - * The second argument is the parent draft-state (used internally). + /** + * Returns a new draft of the `base` object. + * + * The second argument is the parent draft-state (used internally). */ function createProxyProxy(base, parent) { @@ -672,8 +672,8 @@ state.revoke_ = revoke; return proxy; } - /** - * Object drafts + /** + * Object drafts */ var objectTraps = { @@ -785,8 +785,8 @@ die(12); } }; - /** - * Array drafts + /** + * Array drafts */ var arrayTraps = {}; @@ -861,24 +861,24 @@ this.useProxies_ = hasProxies; this.autoFreeze_ = true; - /** - * The `produce` function takes a value and a "recipe function" (whose - * return value often depends on the base state). The recipe function is - * free to mutate its first argument however it wants. All mutations are - * only ever applied to a __copy__ of the base state. - * - * Pass only a function to create a "curried producer" which relieves you - * from passing the recipe function every time. - * - * Only plain objects and arrays are made mutable. All other objects are - * considered uncopyable. - * - * Note: This function is __bound__ to its `Immer` instance. - * - * @param {any} base - the initial state - * @param {Function} producer - function that receives a proxy of the base state as first argument and which can be freely modified - * @param {Function} patchListener - optional function that will be called with all the patches produced here - * @returns {any} a new state, or the initial state if nothing was modified + /** + * The `produce` function takes a value and a "recipe function" (whose + * return value often depends on the base state). The recipe function is + * free to mutate its first argument however it wants. All mutations are + * only ever applied to a __copy__ of the base state. + * + * Pass only a function to create a "curried producer" which relieves you + * from passing the recipe function every time. + * + * Only plain objects and arrays are made mutable. All other objects are + * considered uncopyable. + * + * Note: This function is __bound__ to its `Immer` instance. + * + * @param {any} base - the initial state + * @param {Function} producer - function that receives a proxy of the base state as first argument and which can be freely modified + * @param {Function} patchListener - optional function that will be called with all the patches produced here + * @returns {any} a new state, or the initial state if nothing was modified */ this.produce = function (base, recipe, patchListener) { @@ -995,21 +995,21 @@ usePatchesInScope(scope, patchListener); return processResult(undefined, scope); } - /** - * Pass true to automatically freeze all copies created by Immer. - * - * By default, auto-freezing is enabled. + /** + * Pass true to automatically freeze all copies created by Immer. + * + * By default, auto-freezing is enabled. */ ; _proto.setAutoFreeze = function setAutoFreeze(value) { this.autoFreeze_ = value; } - /** - * Pass true to use the ES2015 `Proxy` class when creating drafts, which is - * always faster than using ES5 proxies. - * - * By default, feature detection is used, so calling this is rarely necessary. + /** + * Pass true to use the ES2015 `Proxy` class when creating drafts, which is + * always faster than using ES5 proxies. + * + * By default, feature detection is used, so calling this is rarely necessary. */ ; @@ -2041,97 +2041,97 @@ var immer$1 = /*#__PURE__*/ new Immer(); - /** - * The `produce` function takes a value and a "recipe function" (whose - * return value often depends on the base state). The recipe function is - * free to mutate its first argument however it wants. All mutations are - * only ever applied to a __copy__ of the base state. - * - * Pass only a function to create a "curried producer" which relieves you - * from passing the recipe function every time. - * - * Only plain objects and arrays are made mutable. All other objects are - * considered uncopyable. - * - * Note: This function is __bound__ to its `Immer` instance. - * - * @param {any} base - the initial state - * @param {Function} producer - function that receives a proxy of the base state as first argument and which can be freely modified - * @param {Function} patchListener - optional function that will be called with all the patches produced here - * @returns {any} a new state, or the initial state if nothing was modified + /** + * The `produce` function takes a value and a "recipe function" (whose + * return value often depends on the base state). The recipe function is + * free to mutate its first argument however it wants. All mutations are + * only ever applied to a __copy__ of the base state. + * + * Pass only a function to create a "curried producer" which relieves you + * from passing the recipe function every time. + * + * Only plain objects and arrays are made mutable. All other objects are + * considered uncopyable. + * + * Note: This function is __bound__ to its `Immer` instance. + * + * @param {any} base - the initial state + * @param {Function} producer - function that receives a proxy of the base state as first argument and which can be freely modified + * @param {Function} patchListener - optional function that will be called with all the patches produced here + * @returns {any} a new state, or the initial state if nothing was modified */ var produce = immer$1.produce; - /** - * Like `produce`, but `produceWithPatches` always returns a tuple - * [nextState, patches, inversePatches] (instead of just the next state) + /** + * Like `produce`, but `produceWithPatches` always returns a tuple + * [nextState, patches, inversePatches] (instead of just the next state) */ var produceWithPatches = /*#__PURE__*/ immer$1.produceWithPatches.bind(immer$1); - /** - * Pass true to automatically freeze all copies created by Immer. - * - * Always freeze by default, even in production mode + /** + * Pass true to automatically freeze all copies created by Immer. + * + * Always freeze by default, even in production mode */ var setAutoFreeze = /*#__PURE__*/ immer$1.setAutoFreeze.bind(immer$1); - /** - * Pass true to use the ES2015 `Proxy` class when creating drafts, which is - * always faster than using ES5 proxies. - * - * By default, feature detection is used, so calling this is rarely necessary. + /** + * Pass true to use the ES2015 `Proxy` class when creating drafts, which is + * always faster than using ES5 proxies. + * + * By default, feature detection is used, so calling this is rarely necessary. */ var setUseProxies = /*#__PURE__*/ immer$1.setUseProxies.bind(immer$1); - /** - * Apply an array of Immer patches to the first argument. - * - * This function is a producer, which means copy-on-write is in effect. + /** + * Apply an array of Immer patches to the first argument. + * + * This function is a producer, which means copy-on-write is in effect. */ var applyPatches = /*#__PURE__*/ immer$1.applyPatches.bind(immer$1); - /** - * Create an Immer draft from the given base state, which may be a draft itself. - * The draft can be modified until you finalize it with the `finishDraft` function. + /** + * Create an Immer draft from the given base state, which may be a draft itself. + * The draft can be modified until you finalize it with the `finishDraft` function. */ var createDraft = /*#__PURE__*/ immer$1.createDraft.bind(immer$1); - /** - * Finalize an Immer draft from a `createDraft` call, returning the base state - * (if no changes were made) or a modified copy. The draft must *not* be - * mutated afterwards. - * - * Pass a function as the 2nd argument to generate Immer patches based on the - * changes that were made. + /** + * Finalize an Immer draft from a `createDraft` call, returning the base state + * (if no changes were made) or a modified copy. The draft must *not* be + * mutated afterwards. + * + * Pass a function as the 2nd argument to generate Immer patches based on the + * changes that were made. */ var finishDraft = /*#__PURE__*/ immer$1.finishDraft.bind(immer$1); - /** - * This function is actually a no-op, but can be used to cast an immutable type - * to an draft type and make TypeScript happy - * - * @param value + /** + * This function is actually a no-op, but can be used to cast an immutable type + * to an draft type and make TypeScript happy + * + * @param value */ function castDraft(value) { return value; } - /** - * This function is actually a no-op, but can be used to cast a mutable type - * to an immutable type and make TypeScript happy - * @param value + /** + * This function is actually a no-op, but can be used to cast a mutable type + * to an immutable type and make TypeScript happy + * @param value */ function castImmutable(value) { @@ -2393,8 +2393,8 @@ function _unsupportedIterableToArray$7(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$7(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$7(o, minLen); } function _arrayLikeToArray$7(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } - /** - * Create a new Slate `Editor` object. + /** + * Create a new Slate `Editor` object. */ var createEditor$1 = function createEditor() { @@ -2723,8 +2723,8 @@ }; return editor; }; - /** - * Get the "dirty" paths generated from an operation. + /** + * Get the "dirty" paths generated from an operation. */ var getDirtyPaths = function getDirtyPaths(op) { @@ -2899,8 +2899,8 @@ // [3] https://www.unicode.org/Public/UCD/latest/ucd/auxiliary/GraphemeBreakTest.html // [4] https://www.unicode.org/Public/UCD/latest/ucd/auxiliary/GraphemeBreakTest.txt - /** - * Get the distance to the end of the first character in a string of text. + /** + * Get the distance to the end of the first character in a string of text. */ var getCharacterDistance = function getCharacterDistance(str) { var isRTL = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; @@ -2974,8 +2974,8 @@ var SPACE = /\s/; var PUNCTUATION = /[\u0021-\u0023\u0025-\u002A\u002C-\u002F\u003A\u003B\u003F\u0040\u005B-\u005D\u005F\u007B\u007D\u00A1\u00A7\u00AB\u00B6\u00B7\u00BB\u00BF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E3B\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]/; var CHAMELEON = /['\u2018\u2019]/; - /** - * Get the distance to the end of the first word in a string of text. + /** + * Get the distance to the end of the first word in a string of text. */ var getWordDistance = function getWordDistance(text) { @@ -3005,9 +3005,9 @@ return dist; }; - /** - * Split a string in two parts at a given distance starting from the end when - * `isRTL` is set to `true`. + /** + * Split a string in two parts at a given distance starting from the end when + * `isRTL` is set to `true`. */ var splitByCharacterDistance = function splitByCharacterDistance(str, dist, isRTL) { @@ -3018,9 +3018,9 @@ return [str.slice(0, dist), str.slice(dist)]; }; - /** - * Check if a character is a word character. The `remaining` argument is used - * because sometimes you must read subsequent characters to truly determine it. + /** + * Check if a character is a word character. The `remaining` argument is used + * because sometimes you must read subsequent characters to truly determine it. */ var isWordCharacter = function isWordCharacter(_char3, remaining) { @@ -3051,8 +3051,8 @@ return true; }; - /** - * Iterate on codepoints from right to left. + /** + * Iterate on codepoints from right to left. */ @@ -3075,19 +3075,19 @@ yield char1; } }; - /** - * Is `charCode` a high surrogate. - * - * https://en.wikipedia.org/wiki/Universal_Character_Set_characters#Surrogates + /** + * Is `charCode` a high surrogate. + * + * https://en.wikipedia.org/wiki/Universal_Character_Set_characters#Surrogates */ var isHighSurrogate = function isHighSurrogate(charCode) { return charCode >= 0xd800 && charCode <= 0xdbff; }; - /** - * Is `charCode` a low surrogate. - * - * https://en.wikipedia.org/wiki/Universal_Character_Set_characters#Surrogates + /** + * Is `charCode` a low surrogate. + * + * https://en.wikipedia.org/wiki/Universal_Character_Set_characters#Surrogates */ @@ -3213,8 +3213,8 @@ } }; - /** - * Shared the function with isElementType utility + /** + * Shared the function with isElementType utility */ var isElement = function isElement(value) { @@ -3222,20 +3222,20 @@ }; var Element$1 = { - /** - * Check if a value implements the 'Ancestor' interface. + /** + * Check if a value implements the 'Ancestor' interface. */ isAncestor: function isAncestor(value) { return isPlainObject.isPlainObject(value) && Node$1.isNodeList(value.children); }, - /** - * Check if a value implements the `Element` interface. + /** + * Check if a value implements the `Element` interface. */ isElement: isElement, - /** - * Check if a value is an array of `Element` objects. + /** + * Check if a value is an array of `Element` objects. */ isElementList: function isElementList(value) { return Array.isArray(value) && value.every(function (val) { @@ -3243,27 +3243,27 @@ }); }, - /** - * Check if a set of props is a partial of Element. + /** + * Check if a set of props is a partial of Element. */ isElementProps: function isElementProps(props) { return props.children !== undefined; }, - /** - * Check if a value implements the `Element` interface and has elementKey with selected value. - * Default it check to `type` key value + /** + * Check if a value implements the `Element` interface and has elementKey with selected value. + * Default it check to `type` key value */ isElementType: function isElementType(value, elementVal) { var elementKey = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'type'; return isElement(value) && value[elementKey] === elementVal; }, - /** - * Check if an element matches set of properties. - * - * Note: this checks custom properties, and it does not ensure that any - * children are equivalent. + /** + * Check if an element matches set of properties. + * + * Note: this checks custom properties, and it does not ensure that any + * children are equivalent. */ matches: function matches(element, props) { for (var key in props) { @@ -3294,8 +3294,8 @@ function _arrayLikeToArray$5(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } var IS_EDITOR_CACHE = new WeakMap(); var Editor = { - /** - * Get the ancestor above a location in the document. + /** + * Get the ancestor above a location in the document. */ above: function above(editor) { var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; @@ -3339,18 +3339,18 @@ } }, - /** - * Add a custom property to the leaf text nodes in the current selection. - * - * If the selection is currently collapsed, the marks will be added to the - * `editor.marks` property instead, and applied when text is inserted next. + /** + * Add a custom property to the leaf text nodes in the current selection. + * + * If the selection is currently collapsed, the marks will be added to the + * `editor.marks` property instead, and applied when text is inserted next. */ addMark: function addMark(editor, key, value) { editor.addMark(key, value); }, - /** - * Get the point after a location. + /** + * Get the point after a location. */ after: function after(editor, at) { var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; @@ -3395,8 +3395,8 @@ return target; }, - /** - * Get the point before a location. + /** + * Get the point before a location. */ before: function before(editor, at) { var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; @@ -3442,8 +3442,8 @@ return target; }, - /** - * Delete content in the editor backward from the current selection. + /** + * Delete content in the editor backward from the current selection. */ deleteBackward: function deleteBackward(editor) { var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; @@ -3452,8 +3452,8 @@ editor.deleteBackward(unit); }, - /** - * Delete content in the editor forward from the current selection. + /** + * Delete content in the editor forward from the current selection. */ deleteForward: function deleteForward(editor) { var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; @@ -3462,8 +3462,8 @@ editor.deleteForward(unit); }, - /** - * Delete the content in the current selection. + /** + * Delete the content in the current selection. */ deleteFragment: function deleteFragment(editor) { var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; @@ -3472,15 +3472,15 @@ editor.deleteFragment(direction); }, - /** - * Get the start and end points of a location. + /** + * Get the start and end points of a location. */ edges: function edges(editor, at) { return [Editor.start(editor, at), Editor.end(editor, at)]; }, - /** - * Get the end point of a location. + /** + * Get the end point of a location. */ end: function end(editor, at) { return Editor.point(editor, at, { @@ -3488,8 +3488,8 @@ }); }, - /** - * Get the first node at a location. + /** + * Get the first node at a location. */ first: function first(editor, at) { var path = Editor.path(editor, at, { @@ -3498,8 +3498,8 @@ return Editor.node(editor, path); }, - /** - * Get the fragment at a location. + /** + * Get the fragment at a location. */ fragment: function fragment(editor, at) { var range = Editor.range(editor, at); @@ -3507,8 +3507,8 @@ return fragment; }, - /** - * Check if a node has block children. + /** + * Check if a node has block children. */ hasBlocks: function hasBlocks(editor, element) { return element.children.some(function (n) { @@ -3516,8 +3516,8 @@ }); }, - /** - * Check if a node has inline and text children. + /** + * Check if a node has inline and text children. */ hasInlines: function hasInlines(editor, element) { return element.children.some(function (n) { @@ -3525,8 +3525,8 @@ }); }, - /** - * Check if a node has text children. + /** + * Check if a node has text children. */ hasTexts: function hasTexts(editor, element) { return element.children.every(function (n) { @@ -3534,51 +3534,51 @@ }); }, - /** - * Insert a block break at the current selection. - * - * If the selection is currently expanded, it will be deleted first. + /** + * Insert a block break at the current selection. + * + * If the selection is currently expanded, it will be deleted first. */ insertBreak: function insertBreak(editor) { editor.insertBreak(); }, - /** - * Insert a fragment at the current selection. - * - * If the selection is currently expanded, it will be deleted first. + /** + * Insert a fragment at the current selection. + * + * If the selection is currently expanded, it will be deleted first. */ insertFragment: function insertFragment(editor, fragment) { editor.insertFragment(fragment); }, - /** - * Insert a node at the current selection. - * - * If the selection is currently expanded, it will be deleted first. + /** + * Insert a node at the current selection. + * + * If the selection is currently expanded, it will be deleted first. */ insertNode: function insertNode(editor, node) { editor.insertNode(node); }, - /** - * Insert text at the current selection. - * - * If the selection is currently expanded, it will be deleted first. + /** + * Insert text at the current selection. + * + * If the selection is currently expanded, it will be deleted first. */ insertText: function insertText(editor, text) { editor.insertText(text); }, - /** - * Check if a value is a block `Element` object. + /** + * Check if a value is a block `Element` object. */ isBlock: function isBlock(editor, value) { return Element$1.isElement(value) && !editor.isInline(value); }, - /** - * Check if a value is an `Editor` object. + /** + * Check if a value is an `Editor` object. */ isEditor: function isEditor(value) { if (!isPlainObject.isPlainObject(value)) return false; @@ -3593,23 +3593,23 @@ return isEditor; }, - /** - * Check if a point is the end point of a location. + /** + * Check if a point is the end point of a location. */ isEnd: function isEnd(editor, point, at) { var end = Editor.end(editor, at); return Point.equals(point, end); }, - /** - * Check if a point is an edge of a location. + /** + * Check if a point is an edge of a location. */ isEdge: function isEdge(editor, point, at) { return Editor.isStart(editor, point, at) || Editor.isEnd(editor, point, at); }, - /** - * Check if an element is empty, accounting for void nodes. + /** + * Check if an element is empty, accounting for void nodes. */ isEmpty: function isEmpty(editor, element) { var children = element.children; @@ -3620,23 +3620,23 @@ return children.length === 0 || children.length === 1 && Text.isText(first) && first.text === '' && !editor.isVoid(element); }, - /** - * Check if a value is an inline `Element` object. + /** + * Check if a value is an inline `Element` object. */ isInline: function isInline(editor, value) { return Element$1.isElement(value) && editor.isInline(value); }, - /** - * Check if the editor is currently normalizing after each operation. + /** + * Check if the editor is currently normalizing after each operation. */ isNormalizing: function isNormalizing(editor) { var isNormalizing = NORMALIZING.get(editor); return isNormalizing === undefined ? true : isNormalizing; }, - /** - * Check if a point is the start point of a location. + /** + * Check if a point is the start point of a location. */ isStart: function isStart(editor, point, at) { // PERF: If the offset isn't `0` we know it's not the start. @@ -3648,15 +3648,15 @@ return Point.equals(point, start); }, - /** - * Check if a value is a void `Element` object. + /** + * Check if a value is a void `Element` object. */ isVoid: function isVoid(editor, value) { return Element$1.isElement(value) && editor.isVoid(value); }, - /** - * Get the last node at a location. + /** + * Get the last node at a location. */ last: function last(editor, at) { var path = Editor.path(editor, at, { @@ -3665,8 +3665,8 @@ return Editor.node(editor, path); }, - /** - * Get the leaf text node at a location. + /** + * Get the leaf text node at a location. */ leaf: function leaf(editor, at) { var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; @@ -3675,8 +3675,8 @@ return [node, path]; }, - /** - * Iterate through all of the levels at a location. + /** + * Iterate through all of the levels at a location. */ levels: function* levels(editor) { var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; @@ -3733,8 +3733,8 @@ yield* levels; }, - /** - * Get the marks that would be added to text at the current selection. + /** + * Get the marks that would be added to text at the current selection. */ marks: function marks(editor) { var marks = editor.marks, @@ -3807,8 +3807,8 @@ return rest; }, - /** - * Get the matching node in the branch of the document after a location. + /** + * Get the matching node in the branch of the document after a location. */ next: function next(editor) { var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; @@ -3867,8 +3867,8 @@ return next; }, - /** - * Get the node at a location. + /** + * Get the node at a location. */ node: function node(editor, at) { var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; @@ -3877,8 +3877,8 @@ return [node, path]; }, - /** - * Iterate through all of the nodes in the Editor. + /** + * Iterate through all of the nodes in the Editor. */ nodes: function* nodes(editor) { var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; @@ -4002,8 +4002,8 @@ } }, - /** - * Normalize any dirty objects in the editor. + /** + * Normalize any dirty objects in the editor. */ normalize: function normalize(editor) { var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; @@ -4033,10 +4033,10 @@ } Editor.withoutNormalizing(editor, function () { - /* - Fix dirty elements with no children. - editor.normalizeNode() does fix this, but some normalization fixes also require it to work. - Running an initial pass avoids the catch-22 race condition. + /* + Fix dirty elements with no children. + editor.normalizeNode() does fix this, but some normalization fixes also require it to work. + Running an initial pass avoids the catch-22 race condition. */ var _iterator6 = _createForOfIteratorHelper$5(getDirtyPaths(editor)), _step6; @@ -4051,11 +4051,11 @@ var _entry2 = _slicedToArray(_entry, 2), node = _entry2[0], _ = _entry2[1]; - /* - The default normalizer inserts an empty text node in this scenario, but it can be customised. - So there is some risk here. - As long as the normalizer only inserts child nodes for this case it is safe to do in any order; - by definition adding children to an empty node can't cause other paths to change. + /* + The default normalizer inserts an empty text node in this scenario, but it can be customised. + So there is some risk here. + As long as the normalizer only inserts child nodes for this case it is safe to do in any order; + by definition adding children to an empty node can't cause other paths to change. */ @@ -4091,8 +4091,8 @@ }); }, - /** - * Get the parent node of a location. + /** + * Get the parent node of a location. */ parent: function parent(editor, at) { var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; @@ -4102,8 +4102,8 @@ return entry; }, - /** - * Get the path of a location. + /** + * Get the path of a location. */ path: function path(editor, at) { var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; @@ -4150,9 +4150,9 @@ return Node$1.has(editor, path); }, - /** - * Create a mutable ref for a `Path` object, which will stay in sync as new - * operations are applied to the editor. + /** + * Create a mutable ref for a `Path` object, which will stay in sync as new + * operations are applied to the editor. */ pathRef: function pathRef(editor, path) { var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; @@ -4174,8 +4174,8 @@ return ref; }, - /** - * Get the set of currently tracked path refs of the editor. + /** + * Get the set of currently tracked path refs of the editor. */ pathRefs: function pathRefs(editor) { var refs = PATH_REFS.get(editor); @@ -4188,8 +4188,8 @@ return refs; }, - /** - * Get the start or end point of a location. + /** + * Get the start or end point of a location. */ point: function point(editor, at) { var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; @@ -4237,9 +4237,9 @@ return at; }, - /** - * Create a mutable ref for a `Point` object, which will stay in sync as new - * operations are applied to the editor. + /** + * Create a mutable ref for a `Point` object, which will stay in sync as new + * operations are applied to the editor. */ pointRef: function pointRef(editor, point) { var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; @@ -4261,8 +4261,8 @@ return ref; }, - /** - * Get the set of currently tracked point refs of the editor. + /** + * Get the set of currently tracked point refs of the editor. */ pointRefs: function pointRefs(editor) { var refs = POINT_REFS.get(editor); @@ -4275,17 +4275,17 @@ return refs; }, - /** - * Return all the positions in `at` range where a `Point` can be placed. - * - * By default, moves forward by individual offsets at a time, but - * the `unit` option can be used to to move by character, word, line, or block. - * - * The `reverse` option can be used to change iteration direction. - * - * Note: By default void nodes are treated as a single point and iteration - * will not happen inside their content unless you pass in true for the - * `voids` option, then iteration will occur. + /** + * Return all the positions in `at` range where a `Point` can be placed. + * + * By default, moves forward by individual offsets at a time, but + * the `unit` option can be used to to move by character, word, line, or block. + * + * The `reverse` option can be used to change iteration direction. + * + * Note: By default void nodes are treated as a single point and iteration + * will not happen inside their content unless you pass in true for the + * `voids` option, then iteration will occur. */ positions: function* positions(editor) { var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; @@ -4301,22 +4301,22 @@ if (!at) { return; } - /** - * Algorithm notes: - * - * Each step `distance` is dynamic depending on the underlying text - * and the `unit` specified. Each step, e.g., a line or word, may - * span multiple text nodes, so we iterate through the text both on - * two levels in step-sync: - * - * `leafText` stores the text on a text leaf level, and is advanced - * through using the counters `leafTextOffset` and `leafTextRemaining`. - * - * `blockText` stores the text on a block level, and is shortened - * by `distance` every time it is advanced. - * - * We only maintain a window of one blockText and one leafText because - * a block node always appears before all of its leaf nodes. + /** + * Algorithm notes: + * + * Each step `distance` is dynamic depending on the underlying text + * and the `unit` specified. Each step, e.g., a line or word, may + * span multiple text nodes, so we iterate through the text both on + * two levels in step-sync: + * + * `leafText` stores the text on a text leaf level, and is advanced + * through using the counters `leafTextOffset` and `leafTextRemaining`. + * + * `blockText` stores the text on a block level, and is shortened + * by `distance` every time it is advanced. + * + * We only maintain a window of one blockText and one leafText because + * a block node always appears before all of its leaf nodes. */ @@ -4353,8 +4353,8 @@ node = _step7$value[0], path = _step7$value[1]; - /* - * ELEMENT NODE - Yield position(s) for voids, collect blockText for blocks + /* + * ELEMENT NODE - Yield position(s) for voids, collect blockText for blocks */ if (Element$1.isElement(node)) { // Void nodes are a special case, so by default we will always @@ -4392,9 +4392,9 @@ isNewBlock = true; } } - /* - * TEXT LEAF NODE - Iterate through text content, yielding - * positions every `distance` offset according to `unit`. + /* + * TEXT LEAF NODE - Iterate through text content, yielding + * positions every `distance` offset according to `unit`. */ @@ -4481,8 +4481,8 @@ } }, - /** - * Get the matching node in the branch of the document before a location. + /** + * Get the matching node in the branch of the document before a location. */ previous: function previous(editor) { var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; @@ -4547,8 +4547,8 @@ return previous; }, - /** - * Get a range of a location. + /** + * Get a range of a location. */ range: function range(editor, at, to) { if (Range.isRange(at) && !to) { @@ -4563,9 +4563,9 @@ }; }, - /** - * Create a mutable ref for a `Range` object, which will stay in sync as new - * operations are applied to the editor. + /** + * Create a mutable ref for a `Range` object, which will stay in sync as new + * operations are applied to the editor. */ rangeRef: function rangeRef(editor, range) { var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; @@ -4587,8 +4587,8 @@ return ref; }, - /** - * Get the set of currently tracked range refs of the editor. + /** + * Get the set of currently tracked range refs of the editor. */ rangeRefs: function rangeRefs(editor) { var refs = RANGE_REFS.get(editor); @@ -4601,29 +4601,29 @@ return refs; }, - /** - * Remove a custom property from all of the leaf text nodes in the current - * selection. - * - * If the selection is currently collapsed, the removal will be stored on - * `editor.marks` and applied to the text inserted next. + /** + * Remove a custom property from all of the leaf text nodes in the current + * selection. + * + * If the selection is currently collapsed, the removal will be stored on + * `editor.marks` and applied to the text inserted next. */ removeMark: function removeMark(editor, key) { editor.removeMark(key); }, - /** - * Manually set if the editor should currently be normalizing. - * - * Note: Using this incorrectly can leave the editor in an invalid state. - * + /** + * Manually set if the editor should currently be normalizing. + * + * Note: Using this incorrectly can leave the editor in an invalid state. + * */ setNormalizing: function setNormalizing(editor, isNormalizing) { NORMALIZING.set(editor, isNormalizing); }, - /** - * Get the start point of a location. + /** + * Get the start point of a location. */ start: function start(editor, at) { return Editor.point(editor, at, { @@ -4631,11 +4631,11 @@ }); }, - /** - * Get the text string content of a location. - * - * Note: by default the text of void nodes is considered to be an empty - * string, regardless of content, unless you pass in true for the voids option + /** + * Get the text string content of a location. + * + * Note: by default the text of void nodes is considered to be an empty + * string, regardless of content, unless you pass in true for the voids option */ string: function string(editor, at) { var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; @@ -4684,8 +4684,8 @@ return text; }, - /** - * Convert a range into a non-hanging one. + /** + * Convert a range into a non-hanging one. */ unhangRange: function unhangRange(editor, range) { var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; @@ -4755,8 +4755,8 @@ }; }, - /** - * Match a void node in the current branch of the editor. + /** + * Match a void node in the current branch of the editor. */ "void": function _void(editor) { var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; @@ -4767,8 +4767,8 @@ })); }, - /** - * Call a function, deferring normalization until after it completes. + /** + * Call a function, deferring normalization until after it completes. */ withoutNormalizing: function withoutNormalizing(editor, fn) { var value = Editor.isNormalizing(editor); @@ -4785,16 +4785,16 @@ }; var Location = { - /** - * Check if a value implements the `Location` interface. + /** + * Check if a value implements the `Location` interface. */ isLocation: function isLocation(value) { return Path.isPath(value) || Point.isPoint(value) || Range.isRange(value); } }; var Span = { - /** - * Check if a value implements the `Span` interface. + /** + * Check if a value implements the `Span` interface. */ isSpan: function isSpan(value) { return Array.isArray(value) && value.length === 2 && value.every(Path.isPath); @@ -4811,8 +4811,8 @@ function _arrayLikeToArray$4(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } var IS_NODE_LIST_CACHE = new WeakMap(); var Node$1 = { - /** - * Get the node at a specific path, asserting that it's an ancestor node. + /** + * Get the node at a specific path, asserting that it's an ancestor node. */ ancestor: function ancestor(root, path) { var node = Node$1.get(root, path); @@ -4824,11 +4824,11 @@ return node; }, - /** - * Return a generator of all the ancestor nodes above a specific path. - * - * By default the order is bottom-up, from lowest to highest ancestor in - * the tree, but you can pass the `reverse: true` option to go top-down. + /** + * Return a generator of all the ancestor nodes above a specific path. + * + * By default the order is bottom-up, from lowest to highest ancestor in + * the tree, but you can pass the `reverse: true` option to go top-down. */ ancestors: function* ancestors(root, path) { var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; @@ -4850,8 +4850,8 @@ } }, - /** - * Get the child of a node at a specific index. + /** + * Get the child of a node at a specific index. */ child: function child(root, index) { if (Text.isText(root)) { @@ -4867,8 +4867,8 @@ return c; }, - /** - * Iterate over the children of a node at a specific path. + /** + * Iterate over the children of a node at a specific path. */ children: function* children(root, path) { var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; @@ -4886,8 +4886,8 @@ } }, - /** - * Get an entry for the common ancesetor node of two paths. + /** + * Get an entry for the common ancesetor node of two paths. */ common: function common(root, path, another) { var p = Path.common(path, another); @@ -4895,8 +4895,8 @@ return [n, p]; }, - /** - * Get the node at a specific path, asserting that it's a descendant node. + /** + * Get the node at a specific path, asserting that it's a descendant node. */ descendant: function descendant(root, path) { var node = Node$1.get(root, path); @@ -4908,8 +4908,8 @@ return node; }, - /** - * Return a generator of all the descendant node entries inside a root node. + /** + * Return a generator of all the descendant node entries inside a root node. */ descendants: function* descendants(root) { var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; @@ -4936,10 +4936,10 @@ } }, - /** - * Return a generator of all the element nodes inside a root node. Each iteration - * will return an `ElementEntry` tuple consisting of `[Element, Path]`. If the - * root node is an element it will be included in the iteration as well. + /** + * Return a generator of all the element nodes inside a root node. Each iteration + * will return an `ElementEntry` tuple consisting of `[Element, Path]`. If the + * root node is an element it will be included in the iteration as well. */ elements: function* elements(root) { var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; @@ -4964,8 +4964,8 @@ } }, - /** - * Extract props from a Node. + /** + * Extract props from a Node. */ extractProps: function extractProps(node) { if (Element$1.isAncestor(node)) { @@ -4981,8 +4981,8 @@ } }, - /** - * Get the first node entry in a root node from a path. + /** + * Get the first node entry in a root node from a path. */ first: function first(root, path) { var p = path.slice(); @@ -5000,8 +5000,8 @@ return [n, p]; }, - /** - * Get the sliced fragment represented by a range inside a root node. + /** + * Get the sliced fragment represented by a range inside a root node. */ fragment: function fragment(root, range) { if (Text.isText(root)) { @@ -5064,9 +5064,9 @@ return newRoot.children; }, - /** - * Get the descendant node referred to by a specific path. If the path is an - * empty array, it refers to the root node itself. + /** + * Get the descendant node referred to by a specific path. If the path is an + * empty array, it refers to the root node itself. */ get: function get(root, path) { var node = root; @@ -5084,8 +5084,8 @@ return node; }, - /** - * Check if a descendant node exists at a specific path. + /** + * Check if a descendant node exists at a specific path. */ has: function has(root, path) { var node = root; @@ -5103,15 +5103,15 @@ return true; }, - /** - * Check if a value implements the `Node` interface. + /** + * Check if a value implements the `Node` interface. */ isNode: function isNode(value) { return Text.isText(value) || Element$1.isElement(value) || Editor.isEditor(value); }, - /** - * Check if a value is a list of `Node` objects. + /** + * Check if a value is a list of `Node` objects. */ isNodeList: function isNodeList(value) { if (!Array.isArray(value)) { @@ -5131,8 +5131,8 @@ return isNodeList; }, - /** - * Get the last node entry in a root node from a path. + /** + * Get the last node entry in a root node from a path. */ last: function last(root, path) { var p = path.slice(); @@ -5151,8 +5151,8 @@ return [n, p]; }, - /** - * Get the node at a specific path, ensuring it's a leaf text node. + /** + * Get the node at a specific path, ensuring it's a leaf text node. */ leaf: function leaf(root, path) { var node = Node$1.get(root, path); @@ -5164,11 +5164,11 @@ return node; }, - /** - * Return a generator of the in a branch of the tree, from a specific path. - * - * By default the order is top-down, from lowest to highest node in the tree, - * but you can pass the `reverse: true` option to go bottom-up. + /** + * Return a generator of the in a branch of the tree, from a specific path. + * + * By default the order is top-down, from lowest to highest node in the tree, + * but you can pass the `reverse: true` option to go bottom-up. */ levels: function* levels(root, path) { var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; @@ -5189,17 +5189,17 @@ } }, - /** - * Check if a node matches a set of props. + /** + * Check if a node matches a set of props. */ matches: function matches(node, props) { return Element$1.isElement(node) && Element$1.isElementProps(props) && Element$1.matches(node, props) || Text.isText(node) && Text.isTextProps(props) && Text.matches(node, props); }, - /** - * Return a generator of all the node entries of a root node. Each entry is - * returned as a `[Node, Path]` tuple, with the path referring to the node's - * position inside the root node. + /** + * Return a generator of all the node entries of a root node. Each entry is + * returned as a `[Node, Path]` tuple, with the path referring to the node's + * position inside the root node. */ nodes: function* nodes(root) { var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; @@ -5268,8 +5268,8 @@ } }, - /** - * Get the parent of a node at a specific path. + /** + * Get the parent of a node at a specific path. */ parent: function parent(root, path) { var parentPath = Path.parent(path); @@ -5282,12 +5282,12 @@ return p; }, - /** - * Get the concatenated text string of a node's content. - * - * Note that this will not include spaces or line breaks between block nodes. - * It is not a user-facing string, but a string for performing offset-related - * computations for a node. + /** + * Get the concatenated text string of a node's content. + * + * Note that this will not include spaces or line breaks between block nodes. + * It is not a user-facing string, but a string for performing offset-related + * computations for a node. */ string: function string(node) { if (Text.isText(node)) { @@ -5297,8 +5297,8 @@ } }, - /** - * Return a generator of all leaf text nodes in a root node. + /** + * Return a generator of all leaf text nodes in a root node. */ texts: function* texts(root) { var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; @@ -5328,15 +5328,15 @@ function _objectSpread$7(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$7(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$7(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } var Operation = { - /** - * Check of a value is a `NodeOperation` object. + /** + * Check of a value is a `NodeOperation` object. */ isNodeOperation: function isNodeOperation(value) { return Operation.isOperation(value) && value.type.endsWith('_node'); }, - /** - * Check of a value is an `Operation` object. + /** + * Check of a value is an `Operation` object. */ isOperation: function isOperation(value) { if (!isPlainObject.isPlainObject(value)) { @@ -5376,8 +5376,8 @@ } }, - /** - * Check if a value is a list of `Operation` objects. + /** + * Check if a value is a list of `Operation` objects. */ isOperationList: function isOperationList(value) { return Array.isArray(value) && value.every(function (val) { @@ -5385,23 +5385,23 @@ }); }, - /** - * Check of a value is a `SelectionOperation` object. + /** + * Check of a value is a `SelectionOperation` object. */ isSelectionOperation: function isSelectionOperation(value) { return Operation.isOperation(value) && value.type.endsWith('_selection'); }, - /** - * Check of a value is a `TextOperation` object. + /** + * Check of a value is a `TextOperation` object. */ isTextOperation: function isTextOperation(value) { return Operation.isOperation(value) && value.type.endsWith('_text'); }, - /** - * Invert an operation, returning a new operation that will exactly undo the - * original when applied. + /** + * Invert an operation, returning a new operation that will exactly undo the + * original when applied. */ inverse: function inverse(op) { switch (op.type) { @@ -5518,11 +5518,11 @@ }; var Path = { - /** - * Get a list of ancestor paths for a given path. - * - * The paths are sorted from deepest to shallowest ancestor. However, if the - * `reverse: true` option is passed, they are reversed. + /** + * Get a list of ancestor paths for a given path. + * + * The paths are sorted from deepest to shallowest ancestor. However, if the + * `reverse: true` option is passed, they are reversed. */ ancestors: function ancestors(path) { var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; @@ -5539,8 +5539,8 @@ return paths; }, - /** - * Get the common ancestor path of two paths. + /** + * Get the common ancestor path of two paths. */ common: function common(path, another) { var common = []; @@ -5559,13 +5559,13 @@ return common; }, - /** - * Compare a path to another, returning an integer indicating whether the path - * was before, at, or after the other. - * - * Note: Two paths of unequal length can still receive a `0` result if one is - * directly above or below the other. If you want exact matching, use - * [[Path.equals]] instead. + /** + * Compare a path to another, returning an integer indicating whether the path + * was before, at, or after the other. + * + * Note: Two paths of unequal length can still receive a `0` result if one is + * directly above or below the other. If you want exact matching, use + * [[Path.equals]] instead. */ compare: function compare(path, another) { var min = Math.min(path.length, another.length); @@ -5578,8 +5578,8 @@ return 0; }, - /** - * Check if a path ends after one of the indexes in another. + /** + * Check if a path ends after one of the indexes in another. */ endsAfter: function endsAfter(path, another) { var i = path.length - 1; @@ -5590,8 +5590,8 @@ return Path.equals(as, bs) && av > bv; }, - /** - * Check if a path ends at one of the indexes in another. + /** + * Check if a path ends at one of the indexes in another. */ endsAt: function endsAt(path, another) { var i = path.length; @@ -5600,8 +5600,8 @@ return Path.equals(as, bs); }, - /** - * Check if a path ends before one of the indexes in another. + /** + * Check if a path ends before one of the indexes in another. */ endsBefore: function endsBefore(path, another) { var i = path.length - 1; @@ -5612,8 +5612,8 @@ return Path.equals(as, bs) && av < bv; }, - /** - * Check if a path is exactly equal to another. + /** + * Check if a path is exactly equal to another. */ equals: function equals(path, another) { return path.length === another.length && path.every(function (n, i) { @@ -5621,71 +5621,71 @@ }); }, - /** - * Check if the path of previous sibling node exists + /** + * Check if the path of previous sibling node exists */ hasPrevious: function hasPrevious(path) { return path[path.length - 1] > 0; }, - /** - * Check if a path is after another. + /** + * Check if a path is after another. */ isAfter: function isAfter(path, another) { return Path.compare(path, another) === 1; }, - /** - * Check if a path is an ancestor of another. + /** + * Check if a path is an ancestor of another. */ isAncestor: function isAncestor(path, another) { return path.length < another.length && Path.compare(path, another) === 0; }, - /** - * Check if a path is before another. + /** + * Check if a path is before another. */ isBefore: function isBefore(path, another) { return Path.compare(path, another) === -1; }, - /** - * Check if a path is a child of another. + /** + * Check if a path is a child of another. */ isChild: function isChild(path, another) { return path.length === another.length + 1 && Path.compare(path, another) === 0; }, - /** - * Check if a path is equal to or an ancestor of another. + /** + * Check if a path is equal to or an ancestor of another. */ isCommon: function isCommon(path, another) { return path.length <= another.length && Path.compare(path, another) === 0; }, - /** - * Check if a path is a descendant of another. + /** + * Check if a path is a descendant of another. */ isDescendant: function isDescendant(path, another) { return path.length > another.length && Path.compare(path, another) === 0; }, - /** - * Check if a path is the parent of another. + /** + * Check if a path is the parent of another. */ isParent: function isParent(path, another) { return path.length + 1 === another.length && Path.compare(path, another) === 0; }, - /** - * Check is a value implements the `Path` interface. + /** + * Check is a value implements the `Path` interface. */ isPath: function isPath(value) { return Array.isArray(value) && (value.length === 0 || typeof value[0] === 'number'); }, - /** - * Check if a path is a sibling of another. + /** + * Check if a path is a sibling of another. */ isSibling: function isSibling(path, another) { if (path.length !== another.length) { @@ -5699,12 +5699,12 @@ return al !== bl && Path.equals(as, bs); }, - /** - * Get a list of paths at every level down to a path. Note: this is the same - * as `Path.ancestors`, but including the path itself. - * - * The paths are sorted from shallowest to deepest. However, if the `reverse: - * true` option is passed, they are reversed. + /** + * Get a list of paths at every level down to a path. Note: this is the same + * as `Path.ancestors`, but including the path itself. + * + * The paths are sorted from shallowest to deepest. However, if the `reverse: + * true` option is passed, they are reversed. */ levels: function levels(path) { var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; @@ -5723,8 +5723,8 @@ return list; }, - /** - * Given a path, get the path to the next sibling node. + /** + * Given a path, get the path to the next sibling node. */ next: function next(path) { if (path.length === 0) { @@ -5735,8 +5735,8 @@ return path.slice(0, -1).concat(last + 1); }, - /** - * Given a path, return a new path referring to the parent node above it. + /** + * Given a path, return a new path referring to the parent node above it. */ parent: function parent(path) { if (path.length === 0) { @@ -5746,8 +5746,8 @@ return path.slice(0, -1); }, - /** - * Given a path, get the path to the previous sibling node. + /** + * Given a path, get the path to the previous sibling node. */ previous: function previous(path) { if (path.length === 0) { @@ -5763,8 +5763,8 @@ return path.slice(0, -1).concat(last - 1); }, - /** - * Get a path relative to an ancestor. + /** + * Get a path relative to an ancestor. */ relative: function relative(path, ancestor) { if (!Path.isAncestor(ancestor, path) && !Path.equals(path, ancestor)) { @@ -5774,8 +5774,8 @@ return path.slice(ancestor.length); }, - /** - * Transform a path by an operation. + /** + * Transform a path by an operation. */ transform: function transform(path, operation) { var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; @@ -5897,8 +5897,8 @@ }; var PathRef = { - /** - * Transform the path ref's current value by an operation. + /** + * Transform the path ref's current value by an operation. */ transform: function transform(ref, op) { var current = ref.current, @@ -5923,9 +5923,9 @@ function _objectSpread$6(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$6(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$6(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } var Point = { - /** - * Compare a point to another, returning an integer indicating whether the - * point was before, at, or after the other. + /** + * Compare a point to another, returning an integer indicating whether the + * point was before, at, or after the other. */ compare: function compare(point, another) { var result = Path.compare(point.path, another.path); @@ -5939,37 +5939,37 @@ return result; }, - /** - * Check if a point is after another. + /** + * Check if a point is after another. */ isAfter: function isAfter(point, another) { return Point.compare(point, another) === 1; }, - /** - * Check if a point is before another. + /** + * Check if a point is before another. */ isBefore: function isBefore(point, another) { return Point.compare(point, another) === -1; }, - /** - * Check if a point is exactly equal to another. + /** + * Check if a point is exactly equal to another. */ equals: function equals(point, another) { // PERF: ensure the offsets are equal first since they are cheaper to check. return point.offset === another.offset && Path.equals(point.path, another.path); }, - /** - * Check if a value implements the `Point` interface. + /** + * Check if a value implements the `Point` interface. */ isPoint: function isPoint(value) { return isPlainObject.isPlainObject(value) && typeof value.offset === 'number' && Path.isPath(value.path); }, - /** - * Transform a point by an operation. + /** + * Transform a point by an operation. */ transform: function transform(point, op) { var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; @@ -6052,8 +6052,8 @@ }; var PointRef = { - /** - * Transform the point ref's current value by an operation. + /** + * Transform the point ref's current value by an operation. */ transform: function transform(ref, op) { var current = ref.current, @@ -6080,9 +6080,9 @@ function _objectSpread$5(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$5(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$5(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } var Range = { - /** - * Get the start and end points of a range, in the order in which they appear - * in the document. + /** + * Get the start and end points of a range, in the order in which they appear + * in the document. */ edges: function edges(range) { var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; @@ -6093,8 +6093,8 @@ return Range.isBackward(range) === reverse ? [anchor, focus] : [focus, anchor]; }, - /** - * Get the end point of a range. + /** + * Get the end point of a range. */ end: function end(range) { var _Range$edges = Range.edges(range), @@ -6104,15 +6104,15 @@ return end; }, - /** - * Check if a range is exactly equal to another. + /** + * Check if a range is exactly equal to another. */ equals: function equals(range, another) { return Point.equals(range.anchor, another.anchor) && Point.equals(range.focus, another.focus); }, - /** - * Check if a range includes a path, a point or part of another range. + /** + * Check if a range includes a path, a point or part of another range. */ includes: function includes(range, target) { if (Range.isRange(target)) { @@ -6152,8 +6152,8 @@ return isAfterStart && isBeforeEnd; }, - /** - * Get the intersection of a range with another. + /** + * Get the intersection of a range with another. */ intersection: function intersection(range, another) { range.anchor; @@ -6183,9 +6183,9 @@ } }, - /** - * Check if a range is backward, meaning that its anchor point appears in the - * document _after_ its focus point. + /** + * Check if a range is backward, meaning that its anchor point appears in the + * document _after_ its focus point. */ isBackward: function isBackward(range) { var anchor = range.anchor, @@ -6193,9 +6193,9 @@ return Point.isAfter(anchor, focus); }, - /** - * Check if a range is collapsed, meaning that both its anchor and focus - * points refer to the exact same position in the document. + /** + * Check if a range is collapsed, meaning that both its anchor and focus + * points refer to the exact same position in the document. */ isCollapsed: function isCollapsed(range) { var anchor = range.anchor, @@ -6203,41 +6203,41 @@ return Point.equals(anchor, focus); }, - /** - * Check if a range is expanded. - * - * This is the opposite of [[Range.isCollapsed]] and is provided for legibility. + /** + * Check if a range is expanded. + * + * This is the opposite of [[Range.isCollapsed]] and is provided for legibility. */ isExpanded: function isExpanded(range) { return !Range.isCollapsed(range); }, - /** - * Check if a range is forward. - * - * This is the opposite of [[Range.isBackward]] and is provided for legibility. + /** + * Check if a range is forward. + * + * This is the opposite of [[Range.isBackward]] and is provided for legibility. */ isForward: function isForward(range) { return !Range.isBackward(range); }, - /** - * Check if a value implements the [[Range]] interface. + /** + * Check if a value implements the [[Range]] interface. */ isRange: function isRange(value) { return isPlainObject.isPlainObject(value) && Point.isPoint(value.anchor) && Point.isPoint(value.focus); }, - /** - * Iterate through all of the point entries in a range. + /** + * Iterate through all of the point entries in a range. */ points: function* points(range) { yield [range.anchor, 'anchor']; yield [range.focus, 'focus']; }, - /** - * Get the start point of a range. + /** + * Get the start point of a range. */ start: function start(range) { var _Range$edges13 = Range.edges(range), @@ -6247,8 +6247,8 @@ return start; }, - /** - * Transform a range by an operation. + /** + * Transform a range by an operation. */ transform: function transform(range, op) { var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; @@ -6306,8 +6306,8 @@ }; var RangeRef = { - /** - * Transform the range ref's current value by an operation. + /** + * Transform the range ref's current value by an operation. */ transform: function transform(ref, op) { var current = ref.current, @@ -6328,15 +6328,15 @@ } }; - /* - Custom deep equal comparison for Slate nodes. + /* + Custom deep equal comparison for Slate nodes. - We don't need general purpose deep equality; - Slate only supports plain values, Arrays, and nested objects. - Complex values nested inside Arrays are not supported. + We don't need general purpose deep equality; + Slate only supports plain values, Arrays, and nested objects. + Complex values nested inside Arrays are not supported. - Slate objects are designed to be serialised, so - missing keys are deliberately normalised to undefined. + Slate objects are designed to be serialised, so + missing keys are deliberately normalised to undefined. */ var isDeepEqual = function isDeepEqual(node, another) { @@ -6356,10 +6356,10 @@ return false; } } - /* - Deep object equality is only necessary in one direction; in the reverse direction - we are only looking for keys that are missing. - As above, undefined keys are normalised to missing. + /* + Deep object equality is only necessary in one direction; in the reverse direction + we are only looking for keys that are missing. + As above, undefined keys are normalised to missing. */ @@ -6385,11 +6385,11 @@ function _objectSpread$4(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$4(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$4(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } var Text = { - /** - * Check if two text nodes are equal. - * - * When loose is set, the text is not compared. This is - * used to check whether sibling text nodes can be merged. + /** + * Check if two text nodes are equal. + * + * When loose is set, the text is not compared. This is + * used to check whether sibling text nodes can be merged. */ equals: function equals(text, another) { var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; @@ -6406,15 +6406,15 @@ return isDeepEqual(loose ? omitText(text) : text, loose ? omitText(another) : another); }, - /** - * Check if a value implements the `Text` interface. + /** + * Check if a value implements the `Text` interface. */ isText: function isText(value) { return isPlainObject.isPlainObject(value) && typeof value.text === 'string'; }, - /** - * Check if a value is a list of `Text` objects. + /** + * Check if a value is a list of `Text` objects. */ isTextList: function isTextList(value) { return Array.isArray(value) && value.every(function (val) { @@ -6422,18 +6422,18 @@ }); }, - /** - * Check if some props are a partial of Text. + /** + * Check if some props are a partial of Text. */ isTextProps: function isTextProps(props) { return props.text !== undefined; }, - /** - * Check if an text matches set of properties. - * - * Note: this is for matching custom properties, and it does not ensure that - * the `text` property are two nodes equal. + /** + * Check if an text matches set of properties. + * + * Note: this is for matching custom properties, and it does not ensure that + * the `text` property are two nodes equal. */ matches: function matches(text, props) { for (var key in props) { @@ -6449,8 +6449,8 @@ return true; }, - /** - * Get the leaves for a text node given decorations. + /** + * Get the leaves for a text node given decorations. */ decorations: function decorations(node, _decorations) { var leaves = [_objectSpread$4({}, node)]; @@ -6989,8 +6989,8 @@ }; var GeneralTransforms = { - /** - * Transform the editor by an operation. + /** + * Transform the editor by an operation. */ transform: function transform(editor, op) { editor.children = immer.createDraft(editor.children); @@ -7023,8 +7023,8 @@ function _arrayLikeToArray$1(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } var NodeTransforms = { - /** - * Insert nodes at a specific location in the Editor. + /** + * Insert nodes at a specific location in the Editor. */ insertNodes: function insertNodes(editor, nodes) { var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; @@ -7179,9 +7179,9 @@ }); }, - /** - * Lift nodes at a specific location upwards in the document tree, splitting - * their parent in two if necessary. + /** + * Lift nodes at a specific location upwards in the document tree, splitting + * their parent in two if necessary. */ liftNodes: function liftNodes(editor) { var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; @@ -7278,9 +7278,9 @@ }); }, - /** - * Merge a node at a location with the previous node of the same depth, - * removing any empty containing nodes after the merge if necessary. + /** + * Merge a node at a location with the previous node of the same depth, + * removing any empty containing nodes after the merge if necessary. */ mergeNodes: function mergeNodes(editor) { var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; @@ -7456,8 +7456,8 @@ }); }, - /** - * Move the nodes at a location to a new location. + /** + * Move the nodes at a location to a new location. */ moveNodes: function moveNodes(editor, options) { Editor.withoutNormalizing(editor, function () { @@ -7519,8 +7519,8 @@ }); }, - /** - * Remove the nodes at a specific location in the document. + /** + * Remove the nodes at a specific location in the document. */ removeNodes: function removeNodes(editor) { var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; @@ -7581,8 +7581,8 @@ }); }, - /** - * Set new properties on the nodes at a location. + /** + * Set new properties on the nodes at a location. */ setNodes: function setNodes(editor, props) { var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; @@ -7707,8 +7707,8 @@ }); }, - /** - * Split the nodes at a specific location. + /** + * Split the nodes at a specific location. */ splitNodes: function splitNodes(editor) { var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; @@ -7871,8 +7871,8 @@ }); }, - /** - * Unset properties on the nodes at a location. + /** + * Unset properties on the nodes at a location. */ unsetNodes: function unsetNodes(editor, props) { var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; @@ -7900,9 +7900,9 @@ Transforms.setNodes(editor, obj, options); }, - /** - * Unwrap the nodes at a location from a parent node, splitting the parent if - * necessary to ensure that only the content in the range is unwrapped. + /** + * Unwrap the nodes at a location from a parent node, splitting the parent if + * necessary to ensure that only the content in the range is unwrapped. */ unwrapNodes: function unwrapNodes(editor) { var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; @@ -7990,9 +7990,9 @@ }); }, - /** - * Wrap the nodes at a location in a new container node, splitting the edges - * of the range first to ensure that only the content in the range is wrapped. + /** + * Wrap the nodes at a location in a new container node, splitting the edges + * of the range first to ensure that only the content in the range is wrapped. */ wrapNodes: function wrapNodes(editor, element) { var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; @@ -8149,8 +8149,8 @@ return true; } }; - /** - * Convert a range into a point by deleting it's content. + /** + * Convert a range into a point by deleting it's content. */ @@ -8184,8 +8184,8 @@ function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$1(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } var SelectionTransforms = { - /** - * Collapse the selection. + /** + * Collapse the selection. */ collapse: function collapse(editor) { var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; @@ -8214,8 +8214,8 @@ } }, - /** - * Unset the selection. + /** + * Unset the selection. */ deselect: function deselect(editor) { var selection = editor.selection; @@ -8229,8 +8229,8 @@ } }, - /** - * Move the selection's point forward or backward. + /** + * Move the selection's point forward or backward. */ move: function move(editor) { var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; @@ -8283,8 +8283,8 @@ Transforms.setSelection(editor, props); }, - /** - * Set the selection to a new value. + /** + * Set the selection to a new value. */ select: function select(editor, target) { var selection = editor.selection; @@ -8306,8 +8306,8 @@ }); }, - /** - * Set new properties on one of the selection's points. + /** + * Set new properties on one of the selection's points. */ setPoint: function setPoint(editor, props) { var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; @@ -8333,8 +8333,8 @@ Transforms.setSelection(editor, _defineProperty({}, edge === 'anchor' ? 'anchor' : 'focus', _objectSpread$1(_objectSpread$1({}, point), props))); }, - /** - * Set new properties on the selection. + /** + * Set new properties on the selection. */ setSelection: function setSelection(editor, props) { var selection = editor.selection; @@ -8368,8 +8368,8 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } var TextTransforms = { - /** - * Delete content in the editor. + /** + * Delete content in the editor. */ "delete": function _delete(editor) { var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; @@ -8602,8 +8602,8 @@ }); }, - /** - * Insert a fragment at a specific location in the editor. + /** + * Insert a fragment at a specific location in the editor. */ insertFragment: function insertFragment(editor, fragment) { var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; @@ -8861,8 +8861,8 @@ }); }, - /** - * Insert a string of text in the Editor. + /** + * Insert a string of text in the Editor. */ insertText: function insertText(editor, text) { var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; @@ -21654,43 +21654,43 @@ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */ - var zi=function(e,t){return zi=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t;}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);},zi(e,t)};function Ui(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e;}zi(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n);}var Ki=function(){return Ki=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Gi(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value);}catch(e){o={error:e};}finally{try{r&&!r.done&&(n=i.return)&&n.call(i);}finally{if(o)throw o.error}}return a}function Ji(e,t){for(var n=0,r=t.length,o=e.length;n=t.length?(e.target=void 0,{value:void 0,done:!0}):"keys"==n?{value:r,done:!1}:"values"==n?{value:t[r],done:!1}:{value:[r,t[r]],done:!1}}),"values");jr.Arguments=jr.Array,wr("keys"),wr("values"),wr("entries");var na=function(e,t,n){for(var r in t)gt(e,r,t[r],n);return e},ra=P.Array,oa=Math.max,ia=function(e,t,n){for(var r=It(e),o=gn(t,r),i=gn(void 0===n?r:n,r),a=ra(oa(i-o,0)),s=0;oi;i++)if((s=v(e[i]))&&Ne(va,s))return s;return new ga(!1)}r=Hr(e,o);}for(l=r.next;!(u=Te(l,r)).done;){try{s=v(u.value);}catch(e){Rr(r,"throw",e);}if("object"==typeof s&&s&&Ne(va,s))return s}return new ga(!1)},ma=P.TypeError,ba=function(e,t){if(Ne(t,e))return e;throw ma("Incorrect invocation")},wa=function(e,t,n){var r,o;return xo&&Q(r=t.constructor)&&r!==n&&me(o=r.prototype)&&o!==n.prototype&&xo(e,o),e},xa=function(e,t,n){var r=-1!==e.indexOf("Map"),o=-1!==e.indexOf("Weak"),i=r?"set":"add",a=P[e],s=a&&a.prototype,l=a,u={},c=function(e){var t=W(s[e]);gt(s,e,"add"==e?function(e){return t(this,0===e?0:e),this}:"delete"==e?function(e){return !(o&&!me(e))&&t(this,0===e?0:e)}:"get"==e?function(e){return o&&!me(e)?void 0:t(this,0===e?0:e)}:"has"==e?function(e){return !(o&&!me(e))&&t(this,0===e?0:e)}:function(e,n){return t(this,0===e?0:e,n),this});};if(jn(e,!Q(a)||!(o||s.forEach&&!se((function(){(new a).entries().next();})))))l=n.getConstructor(t,e,r,i),pa.enable();else if(jn(e,!0)){var f=new l,d=f[i](o?{}:-0,1)!=f,p=se((function(){f.has(1);})),h=Gr((function(e){new a(e);})),g=!o&&se((function(){for(var e=new a,t=5;t--;)e[i](t,t);return !e.has(-0)}));h||((l=t((function(e,t){ba(e,s);var n=wa(new a,e,l);return null!=t&&ya(t,n[i],{that:n,AS_ENTRIES:r}),n}))).prototype=s,s.constructor=l),(p||g)&&(c("delete"),c("has"),r&&c("get")),(g||d)&&c(i),o&&s.clear&&delete s.clear;}return u[e]=l,_n({global:!0,forced:l!=a},u),vo(l,e),o||n.setStrong(l,e,r),l},Ea=pa.getWeakData,Sa=ct.set,ka=ct.getterFor,Oa=Zt.find,Ca=Zt.findIndex,Ta=W([].splice),Na=0,Ma=function(e){return e.frozen||(e.frozen=new La)},La=function(){this.entries=[];},Pa=function(e,t){return Oa(e.entries,(function(e){return e[0]===t}))};La.prototype={get:function(e){var t=Pa(this,e);if(t)return t[1]},has:function(e){return !!Pa(this,e)},set:function(e,t){var n=Pa(this,e);n?n[1]=t:this.entries.push([e,t]);},delete:function(e){var t=Ca(this.entries,(function(t){return t[0]===e}));return ~t&&Ta(this.entries,t,1),!!~t}};var Ra,Da={getConstructor:function(e,t,n,r){var o=e((function(e,o){ba(e,i),Sa(e,{type:t,id:Na++,frozen:void 0}),null!=o&&ya(o,e[r],{that:e,AS_ENTRIES:n});})),i=o.prototype,a=ka(t),s=function(e,t,n){var r=a(e),o=Ea(Oe(t),!0);return !0===o?Ma(r).set(t,n):o[r.id]=n,e};return na(i,{delete:function(e){var t=a(this);if(!me(e))return !1;var n=Ea(e);return !0===n?Ma(t).delete(e):n&&q(n,t.id)&&delete n[t.id]},has:function(e){var t=a(this);if(!me(e))return !1;var n=Ea(e);return !0===n?Ma(t).has(e):n&&q(n,t.id)}}),na(i,n?{get:function(e){var t=a(this);if(me(e)){var n=Ea(e);return !0===n?Ma(t).get(e):n?n[t.id]:void 0}},set:function(e,t){return s(this,e,t)}}:{add:function(e){return s(this,e,!0)}}),o}},ja=ct.enforce,Aa=!P.ActiveXObject&&"ActiveXObject"in P,_a=function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}},Fa=xa("WeakMap",_a,Da);if(Qe&&Aa){Ra=Da.getConstructor(_a,"WeakMap",!0),pa.enable();var Ia=Fa.prototype,Ba=W(Ia.delete),$a=W(Ia.has),Wa=W(Ia.get),Ha=W(Ia.set);na(Ia,{delete:function(e){if(me(e)&&!fa(e)){var t=ja(this);return t.frozen||(t.frozen=new Ra),Ba(this,e)||t.frozen.delete(e)}return Ba(this,e)},has:function(e){if(me(e)&&!fa(e)){var t=ja(this);return t.frozen||(t.frozen=new Ra),$a(this,e)||t.frozen.has(e)}return $a(this,e)},get:function(e){if(me(e)&&!fa(e)){var t=ja(this);return t.frozen||(t.frozen=new Ra),$a(this,e)?Wa(this,e):t.frozen.get(e)}return Wa(this,e)},set:function(e,t){if(me(e)&&!fa(e)){var n=ja(this);n.frozen||(n.frozen=new Ra),$a(this,e)?Ha(this,e,t):n.frozen.set(e,t);}else Ha(this,e,t);return this}});}var Va=he("iterator"),za=he("toStringTag"),Ua=ta.values,Ka=function(e,t){if(e){if(e[Va]!==Ua)try{Ue(e,Va,Ua);}catch(t){e[Va]=Ua;}if(e[za]||Ue(e,za,t),kt[t])for(var n in ta)if(e[n]!==ta[n])try{Ue(e,n,ta[n]);}catch(t){e[n]=ta[n];}}};for(var qa in kt)Ka(P[qa]&&P[qa].prototype,qa);Ka(Tt,"DOMTokenList");var Ga=new WeakMap,Ja=new WeakMap,Ya=new WeakMap,Xa=new WeakMap,Qa=new WeakMap,Za=new WeakMap,es=new WeakMap,ts=new WeakMap,ns=new WeakMap,rs=new WeakMap,os=new WeakMap,is=new WeakMap,as=new WeakMap,ss=new WeakMap,ls=new WeakMap,us=new WeakMap,cs=new WeakMap,fs=new WeakMap,ds=new WeakMap,ps=new WeakMap,hs=new WeakMap,gs=new WeakMap,vs=new WeakMap,ys=new WeakMap,ms=new WeakMap,bs=Zt.find,ws="find",xs=!0;ws in[]&&Array(1).find((function(){xs=!1;})),_n({target:"Array",proto:!0,forced:xs},{find:function(e){return bs(this,e,arguments.length>1?arguments[1]:void 0)}}),wr(ws),_n({global:!0},{globalThis:P});const Es=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","isindex","keygen","link","menuitem","meta","nextid","param","source","track","wbr"];r.css&&(y.default.fn.css=r.css),r.append&&(y.default.fn.append=r.append),r.addClass&&(y.default.fn.addClass=r.addClass),r.removeClass&&(y.default.fn.removeClass=r.removeClass),r.hasClass&&(y.default.fn.hasClass=r.hasClass),r.on&&(y.default.fn.on=r.on),r.focus&&(y.default.fn.focus=r.focus),r.attr&&(y.default.fn.attr=r.attr),r.removeAttr&&(y.default.fn.removeAttr=r.removeAttr),r.hide&&(y.default.fn.hide=r.hide),r.show&&(y.default.fn.show=r.show),r.offset&&(y.default.fn.offset=r.offset),r.width&&(y.default.fn.width=r.width),r.height&&(y.default.fn.height=r.height),r.parent&&(y.default.fn.parent=r.parent),r.parents&&(y.default.fn.parents=r.parents),r.is&&(y.default.fn.is=r.is),r.dataset&&(y.default.fn.dataset=r.dataset),r.val&&(y.default.fn.val=r.val),r.text&&(y.default.fn.text=r.text),r.html&&(y.default.fn.html=r.html),r.children&&(y.default.fn.children=r.children),r.remove&&(y.default.fn.remove=r.remove),r.find&&(y.default.fn.find=r.find),r.each&&(y.default.fn.each=r.each),r.empty&&(y.default.fn.empty=r.empty);var Ss,ks=function(e){return e&&e.ownerDocument&&e.ownerDocument.defaultView||null},Os=function(e){return Cs(e)&&1===e.nodeType},Cs=function(e){var t=ks(e);return !!t&&e instanceof t.Node},Ts=function(e){var t=e&&e.anchorNode&&ks(e.anchorNode);return !!t&&e instanceof t.Selection},Ns=function(e){return Cs(e)&&3===e.nodeType},Ms=function(e){var t,n,r;return null!==(t=window.document.getElementById(e))&&void 0!==t?t:(null===(r=null===(n=window.document.activeElement)||void 0===n?void 0:n.shadowRoot)||void 0===r?void 0:r.getElementById(e))||null},Ls=function(e,t,n){for(var r,o=e.childNodes,i=o[t],a=t,s=!1,l=!1;(Cs(r=i)&&8===r.nodeType||Os(i)&&0===i.childNodes.length||Os(i)&&"false"===i.getAttribute("contenteditable"))&&(!s||!l);)a>=o.length?(s=!0,a=t-1,n="backward"):a<0?(l=!0,a=t+1,n="forward"):(i=o[a],t=a,a+="forward"===n?1:-1);return [i,t]},Ps=function(e,t,n){return Gi(Ls(e,t,n),1)[0]},Rs=function e(t){var n,r,o="";if(Ns(t)&&t.nodeValue)return t.nodeValue;if(Os(t)){try{for(var i=qi(Array.from(t.childNodes)),a=i.next();!a.done;a=i.next()){o+=e(a.value);}}catch(e){n={error:e};}finally{try{a&&!a.done&&(r=i.return)&&r.call(i);}finally{if(n)throw n.error}}var s=getComputedStyle(t).getPropertyValue("display");"block"!==s&&"list"!==s&&"table-row"!==s&&"BR"!==t.tagName||(o+="\n");}return o};function Ds(e,t){if(!(e instanceof HTMLElement&&"true"===e.dataset.slateVoid))for(var n=e.childNodes,r=n.length;r--;){var o=n[r],i=o.nodeType;3==i?t(o,e):1!=i&&9!=i&&11!=i||Ds(o,t);}}function js(e){if(0===e.length)return "";var t=e[0];return t.nodeType!==Ss.ELEMENT_NODE?"":t.tagName.toLowerCase()}!function(e){e[e.ELEMENT_NODE=1]="ELEMENT_NODE",e[e.TEXT_NODE=3]="TEXT_NODE",e[e.CDATA_SECTION_NODE=4]="CDATA_SECTION_NODE",e[e.PROCESSING_INSTRUCTION_NODE=7]="PROCESSING_INSTRUCTION_NODE",e[e.COMMENT_NODE=8]="COMMENT_NODE",e[e.DOCUMENT_NODE=9]="DOCUMENT_NODE",e[e.DOCUMENT_TYPE_NODE=10]="DOCUMENT_TYPE_NODE",e[e.DOCUMENT_FRAGMENT_NODE=11]="DOCUMENT_FRAGMENT_NODE";}(Ss||(Ss={})),void 0!==globalThis.navigator&&void 0!==globalThis.window&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&globalThis.window.MSStream;var As="undefined"!=typeof navigator&&/Mac OS X/.test(navigator.userAgent),_s="undefined"!=typeof navigator&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent);"undefined"!=typeof navigator&&/^(?!.*Seamonkey)(?=.*Firefox\/(?:[0-7][0-9]|[0-8][0-6])(?:\.)).*/i.test(navigator.userAgent);var Fs="undefined"!=typeof navigator&&/Version\/[\d\.]+.*Safari/.test(navigator.userAgent),Is="undefined"!=typeof navigator&&/Edge?\/(?:[0-6][0-9]|[0-7][0-8])(?:\.)/i.test(navigator.userAgent),Bs="undefined"!=typeof navigator&&/Chrome?\/(?:[0-7][0-5]|[0-6][0-9])(?:\.)/i.test(navigator.userAgent),$s="undefined"!=typeof navigator&&/Chrome/i.test(navigator.userAgent);"undefined"!=typeof navigator&&/.*QQBrowser/.test(navigator.userAgent);var Ws=!Bs&&!Is&&"undefined"!=typeof globalThis&&globalThis.InputEvent&&"function"==typeof globalThis.InputEvent.prototype.getTargetRanges,Hs={getWindow:function(e){var t=hs.get(e);if(!t)throw new Error("Unable to find a host window element for this editor");return t},findKey:function(e,t){var n=ps.get(t);return n||(n=new Xi,ps.set(t,n)),n},setNewKey:function(e){var t=new Xi;ps.set(e,t);},findPath:function(e,n){for(var r=[],o=n;;){var i=ls.get(o);if(null==i){if(t.Editor.isEditor(o))return r;break}var a=ss.get(o);if(null==a)break;r.unshift(a),o=i;}throw new Error("Unable to find the path for Slate node: "+JSON.stringify(n))},findDocumentOrShadowRoot:function(e){if(e.isDestroyed)return window.document;var t=Hs.toDOMNode(e,e),n=t.getRootNode();return (n instanceof Document||n instanceof ShadowRoot)&&null!=n.getSelection?n:t.ownerDocument},getParentNode:function(e,t){return ls.get(t)||null},getParentsNodes:function(e,t){for(var n=[],r=t;r!==e&&null!=r;){var o=Hs.getParentNode(e,r);if(null==o)break;n.push(o),r=o;}return n},getTopNode:function(e,n){var r=[Hs.findPath(e,n)[0]];return t.Node.get(e,r)},toDOMNode:function(e,n){var r;if(t.Editor.isEditor(n))r=us.get(e);else {var o=Hs.findKey(e,n);r=fs.get(o);}if(!r)throw new Error("Cannot resolve a DOM node from Slate node: "+JSON.stringify(n));return r},hasDOMNode:function(e,t,n){void 0===n&&(n={});var r,o=n.editable,i=void 0!==o&&o,a=Hs.toDOMNode(e,e);try{r=Os(t)?t:t.parentElement;}catch(e){if(!e.message.includes('Permission denied to access property "nodeType"'))throw e}return !!r&&(r.closest("[data-slate-editor]")===a&&(!i||r.isContentEditable||!!r.getAttribute("data-slate-zero-width")))},toDOMRange:function(e,n){var r=n.anchor,o=n.focus,i=t.Range.isBackward(n),a=Hs.toDOMPoint(e,r),s=t.Range.isCollapsed(n)?a:Hs.toDOMPoint(e,o),l=Hs.getWindow(e).document.createRange(),u=Gi(i?s:a,2),c=u[0],f=u[1],d=Gi(i?a:s,2),p=d[0],h=d[1],g=!!(Os(c)?c:c.parentElement).getAttribute("data-slate-zero-width"),v=!!(Os(p)?p:p.parentElement).getAttribute("data-slate-zero-width");return l.setStart(c,g?1:f),l.setEnd(p,v?1:h),l},toDOMPoint:function(e,n){var r,o,i,a=Gi(t.Editor.node(e,n.path),1)[0],s=Hs.toDOMNode(e,a);t.Editor.void(e,{at:n})&&(n={path:n.path,offset:0});var l=Array.from(s.querySelectorAll("[data-slate-string], [data-slate-zero-width]")),u=0;try{for(var c=qi(l),f=c.next();!f.done;f=c.next()){var d=f.value,p=d.childNodes[0];if(null!=p&&null!=p.textContent){var h=p.textContent.length,g=d.getAttribute("data-slate-length"),v=u+(null==g?h:parseInt(g,10));if(n.offset<=v){i=[p,Math.min(h,Math.max(0,n.offset-u))];break}u=v;}}}catch(e){r={error:e};}finally{try{f&&!f.done&&(o=c.return)&&o.call(c);}finally{if(r)throw r.error}}if(!i)throw new Error("Cannot resolve a DOM point from Slate point: "+JSON.stringify(n));return i},toSlateNode:function(e,t){var n=Os(t)?t:t.parentElement;n&&!n.hasAttribute("data-slate-node")&&(n=n.closest("[data-slate-node]"));var r=n?cs.get(n):null;if(!r)throw new Error("Cannot resolve a Slate node from DOM node: "+n);return r},findEventRange:function(e,n){"nativeEvent"in n&&(n=n.nativeEvent);var r=n.clientX,o=n.clientY,i=n.target;if(null==r||null==o)throw new Error("Cannot resolve a Slate range from a DOM event: "+n);var a,s=Hs.toSlateNode(e,n.target),l=Hs.findPath(e,s);if(t.Editor.isVoid(e,s)){var u=i.getBoundingClientRect(),c=e.isInline(s)?r-u.left0},isSelectedEmptyParagraph:function(e){var n=e.selection;if(null==n)return !1;if(t.Range.isExpanded(n))return !1;var r=Hs.getSelectedNodeByType(e,"paragraph");if(null===r)return !1;var o=r.children;return 1===o.length&&(""===o[0].text||void 0)},isEmptyPath:function(e,n){var r=t.Editor.node(e,n);if(null==r)return !1;var o=Gi(r,1)[0].children;if(1===o.length&&""===o[0].text)return !0;return !1}},Vs=1,zs={};var Us={};var Ks=Zt.filter,qs=qo("filter");_n({target:"Array",proto:!0,forced:!qs},{filter:function(e){return Ks(this,e,arguments.length>1?arguments[1]:void 0)}});var Gs="\t\n\v\f\r                 \u2028\u2029\ufeff",Js=W("".replace),Ys="["+Gs+"]",Xs=RegExp("^"+Ys+Ys+"*"),Qs=RegExp(Ys+Ys+"*$"),Zs=function(e){return function(t){var n=er(V(t));return 1&e&&(n=Js(n,Xs,"")),2&e&&(n=Js(n,Qs,"")),n}},el={start:Zs(1),end:Zs(2),trim:Zs(3)},tl=ht.PROPER,nl=el.trim;_n({target:"String",proto:!0,forced:function(e){return se((function(){return !!Gs[e]()||"​…᠎"!=="​…᠎"[e]()||tl&&Gs[e].name!==e}))}("trim")},{trim:function(){return nl(this)}});var rl=[];var ol={};function il(e,t,n){var r=n.isInline(e)?"span":"div";return "<"+r+">"+t+""}function al(e,n){var r=e.type,o=void 0===r?"":r,i=e.children,a=void 0===i?[]:i,s=t.Editor.isVoid(n,e),l="";s||(l=a.map((function(e){return Ku(e,n)})).join(""));var u=function(e){return ol[e]||il}(o),c=u(e,l,n),f="";if(f="string"==typeof c?c:c.html||"",s||rl.forEach((function(t){return f=t(e,f)})),"string"==typeof c)return f;var d=c.prefix,p=void 0===d?"":d,h=c.suffix,g=void 0===h?"":h;return p&&(f=p+f),g&&(f+=g),f}var sl,ll,ul,cl,fl=P.Promise,dl=he("species"),pl=function(e){var t=ee(e),n=Ve.f;ye&&t&&!t[dl]&&n(t,dl,{configurable:!0,get:function(){return this}});},hl=P.TypeError,gl=he("species"),vl=function(e,t){var n,r=Oe(e).constructor;return void 0===r||null==(n=Oe(r)[gl])?t:function(e){if(qt(e))return e;throw hl(Re(e)+" is not a constructor")}(n)},yl=W([].slice),ml=/(?:ipad|iphone|ipod).*applewebkit/i.test(te),bl="process"==mt(P.process),wl=P.setImmediate,xl=P.clearImmediate,El=P.process,Sl=P.Dispatch,kl=P.Function,Ol=P.MessageChannel,Cl=P.String,Tl=0,Nl={},Ml="onreadystatechange";try{sl=P.location;}catch(e){}var Ll=function(e){if(q(Nl,e)){var t=Nl[e];delete Nl[e],t();}},Pl=function(e){return function(){Ll(e);}},Rl=function(e){Ll(e.data);},Dl=function(e){P.postMessage(Cl(e),sl.protocol+"//"+sl.host);};wl&&xl||(wl=function(e){var t=yl(arguments,1);return Nl[++Tl]=function(){wi(Q(e)?e:kl(e),void 0,t);},ll(Tl),Tl},xl=function(e){delete Nl[e];},bl?ll=function(e){El.nextTick(Pl(e));}:Sl&&Sl.now?ll=function(e){Sl.now(Pl(e));}:Ol&&!ml?(cl=(ul=new Ol).port2,ul.port1.onmessage=Rl,ll=Mt(cl.postMessage,cl)):P.addEventListener&&Q(P.postMessage)&&!P.importScripts&&sl&&"file:"!==sl.protocol&&!se(Dl)?(ll=Dl,P.addEventListener("message",Rl,!1)):ll=Ml in xe("script")?function(e){fr.appendChild(xe("script")).onreadystatechange=function(){fr.removeChild(this),Ll(e);};}:function(e){setTimeout(Pl(e),0);});var jl,Al,_l,Fl,Il,Bl,$l,Wl,Hl={set:wl,clear:xl},Vl=/ipad|iphone|ipod/i.test(te)&&void 0!==P.Pebble,zl=/web0s(?!.*chrome)/i.test(te),Ul=dn.f,Kl=Hl.set,ql=P.MutationObserver||P.WebKitMutationObserver,Gl=P.document,Jl=P.process,Yl=P.Promise,Xl=Ul(P,"queueMicrotask"),Ql=Xl&&Xl.value;Ql||(jl=function(){var e,t;for(bl&&(e=Jl.domain)&&e.exit();Al;){t=Al.fn,Al=Al.next;try{t();}catch(e){throw Al?Fl():_l=void 0,e}}_l=void 0,e&&e.enter();},ml||bl||zl||!ql||!Gl?!Vl&&Yl&&Yl.resolve?(($l=Yl.resolve(void 0)).constructor=Yl,Wl=Mt($l.then,$l),Fl=function(){Wl(jl);}):bl?Fl=function(){Jl.nextTick(jl);}:(Kl=Mt(Kl,P),Fl=function(){Kl(jl);}):(Il=!0,Bl=Gl.createTextNode(""),new ql(jl).observe(Bl,{characterData:!0}),Fl=function(){Bl.data=Il=!Il;}));var Zl,eu,tu,nu,ru=Ql||function(e){var t={fn:e,next:void 0};_l&&(_l.next=t),Al||(Al=t,Fl()),_l=t;},ou=function(e){var t,n;this.promise=new e((function(e,r){if(void 0!==t||void 0!==n)throw TypeError("Bad Promise constructor");t=e,n=r;})),this.resolve=je(t),this.reject=je(n);},iu={f:function(e){return new ou(e)}},au=function(e){try{return {error:!1,value:e()}}catch(e){return {error:!0,value:e}}},su="object"==typeof window,lu=Hl.set,uu=he("species"),cu="Promise",fu=ct.getterFor(cu),du=ct.set,pu=ct.getterFor(cu),hu=fl&&fl.prototype,gu=fl,vu=hu,yu=P.TypeError,mu=P.document,bu=P.process,wu=iu.f,xu=wu,Eu=!!(mu&&mu.createEvent&&P.dispatchEvent),Su=Q(P.PromiseRejectionEvent),ku="unhandledrejection",Ou=!1,Cu=jn(cu,(function(){var e=Ye(gu),t=e!==String(gu);if(!t&&66===ae)return !0;if(ae>=51&&/native code/.test(e))return !1;var n=new gu((function(e){e(1);})),r=function(e){e((function(){}),(function(){}));};return (n.constructor={})[uu]=r,!(Ou=n.then((function(){}))instanceof r)||!t&&su&&!Su})),Tu=Cu||!Gr((function(e){gu.all(e).catch((function(){}));})),Nu=function(e){var t;return !(!me(e)||!Q(t=e.then))&&t},Mu=function(e,t){if(!e.notified){e.notified=!0;var n=e.reactions;ru((function(){for(var r=e.value,o=1==e.state,i=0;n.length>i;){var a,s,l,u=n[i++],c=o?u.ok:u.fail,f=u.resolve,d=u.reject,p=u.domain;try{c?(o||(2===e.rejection&&Du(e),e.rejection=1),!0===c?a=r:(p&&p.enter(),a=c(r),p&&(p.exit(),l=!0)),a===u.promise?d(yu("Promise-chain cycle")):(s=Nu(a))?Te(s,a,f,d):f(a)):d(r);}catch(e){p&&!l&&p.exit(),d(e);}}e.reactions=[],e.notified=!1,t&&!e.rejection&&Pu(e);}));}},Lu=function(e,t,n){var r,o;Eu?((r=mu.createEvent("Event")).promise=t,r.reason=n,r.initEvent(e,!1,!0),P.dispatchEvent(r)):r={promise:t,reason:n},!Su&&(o=P["on"+e])?o(r):e===ku&&function(e,t){var n=P.console;n&&n.error&&(1==arguments.length?n.error(e):n.error(e,t));}("Unhandled promise rejection",n);},Pu=function(e){Te(lu,P,(function(){var t,n=e.facade,r=e.value;if(Ru(e)&&(t=au((function(){bl?bu.emit("unhandledRejection",r,n):Lu(ku,n,r);})),e.rejection=bl||Ru(e)?2:1,t.error))throw t.value}));},Ru=function(e){return 1!==e.rejection&&!e.parent},Du=function(e){Te(lu,P,(function(){var t=e.facade;bl?bu.emit("rejectionHandled",t):Lu("rejectionhandled",t,e.value);}));},ju=function(e,t,n){return function(r){e(t,r,n);}},Au=function(e,t,n){e.done||(e.done=!0,n&&(e=n),e.value=t,e.state=2,Mu(e,!0));},_u=function(e,t,n){if(!e.done){e.done=!0,n&&(e=n);try{if(e.facade===t)throw yu("Promise can't be resolved itself");var r=Nu(t);r?ru((function(){var n={done:!1};try{Te(r,t,ju(_u,n,e),ju(Au,n,e));}catch(t){Au(n,t,e);}})):(e.value=t,e.state=1,Mu(e,!1));}catch(t){Au({done:!1},t,e);}}};if(Cu&&(vu=(gu=function(e){ba(this,vu),je(e),Te(Zl,this);var t=fu(this);try{e(ju(_u,t),ju(Au,t));}catch(e){Au(t,e);}}).prototype,(Zl=function(e){du(this,{type:cu,done:!1,notified:!1,parent:!1,reactions:[],rejection:!1,state:0,value:void 0});}).prototype=na(vu,{then:function(e,t){var n=pu(this),r=n.reactions,o=wu(vl(this,gu));return o.ok=!Q(e)||e,o.fail=Q(t)&&t,o.domain=bl?bu.domain:void 0,n.parent=!0,r[r.length]=o,0!=n.state&&Mu(n,!1),o.promise},catch:function(e){return this.then(void 0,e)}}),eu=function(){var e=new Zl,t=fu(e);this.promise=e,this.resolve=ju(_u,t),this.reject=ju(Au,t);},iu.f=wu=function(e){return e===gu||e===tu?new eu(e):xu(e)},Q(fl)&&hu!==Object.prototype)){nu=hu.then,Ou||(gt(hu,"then",(function(e,t){var n=this;return new gu((function(e,t){Te(nu,n,e,t);})).then(e,t)}),{unsafe:!0}),gt(hu,"catch",vu.catch,{unsafe:!0}));try{delete hu.constructor;}catch(e){}xo&&xo(hu,vu);}_n({global:!0,wrap:!0,forced:Cu},{Promise:gu}),vo(gu,cu,!1),pl(cu),tu=ee(cu),_n({target:cu,stat:!0,forced:Cu},{reject:function(e){var t=wu(this);return Te(t.reject,void 0,e),t.promise}}),_n({target:cu,stat:!0,forced:Cu},{resolve:function(e){return function(e,t){if(Oe(e),me(t)&&t.constructor===e)return t;var n=iu.f(e);return (0, n.resolve)(t),n.promise}(this,e)}}),_n({target:cu,stat:!0,forced:Tu},{all:function(e){var t=this,n=wu(t),r=n.resolve,o=n.reject,i=au((function(){var n=je(t.resolve),i=[],a=0,s=1;ya(e,(function(e){var l=a++,u=!1;s++,Te(n,t,e).then((function(e){u||(u=!0,i[l]=e,--s||r(i));}),o);})),--s||r(i);}));return i.error&&o(i.value),n.promise},race:function(e){var t=this,n=wu(t),r=n.reject,o=au((function(){var o=je(t.resolve);ya(e,(function(e){Te(o,t,e).then(n.resolve,r);}));}));return o.error&&r(o.value),n.promise}});var Fu=Zo.UNSUPPORTED_Y,Iu=4294967295,Bu=Math.min,$u=[].push,Wu=W(/./.exec),Hu=W($u),Vu=W("".slice),zu=!se((function(){var e=/(?:)/,t=e.exec;e.exec=function(){return t.apply(this,arguments)};var n="ab".split(e);return 2!==n.length||"a"!==n[0]||"b"!==n[1]}));function Uu(e){Promise.resolve().then(e);}function Ku(e,n){return t.Element.isElement(e)?al(e,n):function(e,t){var n=e.text;if(null==n)throw new Error("Current node is not slate Text "+JSON.stringify(e));var r=n;r=function(e){return e.replace(/ {2}/g,"  ").replace(//g,">").replace(/®/g,"®").replace(/©/g,"©").replace(/™/g,"™")}(r);var o=Hs.getParentsNodes(t,e).some((function(e){return "pre"===Hs.getNodeType(e)}));if(o||(r=r.replace(/\r\n|\r|\n/g,"
")),o&&(r=r.replace(/ /g," ")),""===r){var i=Hs.getParentNode(null,e);if(!i||0!==i.children.length)return r;r="
";}return rl.forEach((function(t){return r=t(e,r)})),r}(e,n)}function qu(e){return "w-e-element-"+e}Si("split",(function(e,t,n){var r;return r="c"=="abbc".split(/(b)*/)[1]||4!="test".split(/(?:)/,-1).length||2!="ab".split(/(?:ab)*/).length||4!=".".split(/(.?)(.?)/).length||".".split(/()()/).length>1||"".split(/.?/).length?function(e,n){var r=er(V(this)),o=void 0===n?Iu:n>>>0;if(0===o)return [];if(void 0===e)return [r];if(!Sr(e))return Te(t,r,e,o);for(var i,a,s,l=[],u=(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.unicode?"u":"")+(e.sticky?"y":""),c=0,f=new RegExp(e.source,u+"g");(i=Te(gi,f,r))&&!((a=f.lastIndex)>c&&(Hu(l,Vu(r,c,i.index)),i.length>1&&i.index=o));)f.lastIndex===i.index&&f.lastIndex++;return c===r.length?!s&&Wu(f,"")||Hu(l,""):Hu(l,Vu(r,c)),l.length>o?ia(l,0,o):l}:"0".split(void 0,0).length?function(e,n){return void 0===e&&0===n?[]:Te(t,this,e,n)}:t,[function(t,n){var o=V(this),i=null==t?void 0:Ae(t,e);return i?Te(i,t,o,n):Te(r,er(o),t,n)},function(e,o){var i=Oe(this),a=er(e),s=n(r,i,a,o,r!==t);if(s.done)return s.value;var l=vl(i,RegExp),u=i.unicode,c=(i.ignoreCase?"i":"")+(i.multiline?"m":"")+(i.unicode?"u":"")+(Fu?"g":"y"),f=new l(Fu?"^(?:"+i.source+")":i,c),d=void 0===o?Iu:o>>>0;if(0===d)return [];if(0===a.length)return null===ji(f,a)?[a]:[];for(var p=0,h=0,g=[];h=n},Ju=function(e,t,n){var r=Hs.toDOMRange(e,t).getBoundingClientRect(),o=Hs.toDOMRange(e,n).getBoundingClientRect();return Gu(r,o)&&Gu(o,r)},Yu=["span","b","strong","i","em","s","strike","u","font","sub","sup"],Xu=[];var Qu=[];var Zu={};var ec=Ve.f,tc=Sn.f,nc=ct.enforce,rc=he("match"),oc=P.RegExp,ic=oc.prototype,ac=P.SyntaxError,sc=W(tr),lc=W(ic.exec),uc=W("".charAt),cc=W("".replace),fc=W("".indexOf),dc=W("".slice),pc=/^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/,hc=/a/g,gc=/a/g,vc=new oc(hc)!==hc,yc=Zo.MISSED_STICKY,mc=Zo.UNSUPPORTED_Y,bc=ye&&(!vc||yc||ti||ri||se((function(){return gc[rc]=!1,oc(hc)!=hc||oc(gc)==gc||"/a/i"!=oc(hc,"i")})));if(jn("RegExp",bc)){for(var wc=function(e,t){var n,r,o,i,a,s,l=Ne(ic,this),u=Sr(e),c=void 0===t,f=[],d=e;if(!l&&u&&c&&e.constructor===wc)return e;if((u||Ne(ic,e))&&(e=e.source,c&&(t="flags"in d?d.flags:sc(d))),e=void 0===e?"":er(e),t=void 0===t?"":er(t),d=e,ti&&"dotAll"in hc&&(r=!!t&&fc(t,"s")>-1)&&(t=cc(t,/s/g,"")),n=t,yc&&"sticky"in hc&&(o=!!t&&fc(t,"y")>-1)&&mc&&(t=cc(t,/y/g,"")),ri&&(i=function(e){for(var t,n=e.length,r=0,o="",i=[],a={},s=!1,l=!1,u=0,c="";r<=n;r++){if("\\"===(t=uc(e,r)))t+=uc(e,++r);else if("]"===t)s=!1;else if(!s)switch(!0){case"["===t:s=!0;break;case"("===t:lc(pc,dc(e,r+1))&&(r+=2,l=!0),o+=t,u++;continue;case">"===t&&l:if(""===c||q(a,c))throw new ac("Invalid capture group name");a[c]=!0,i[i.length]=[c,u],l=!1,c="";continue}l?c+=t:o+=t;}return [o,i]}(e),e=i[0],f=i[1]),a=wa(oc(e,t),l?this:ic,wc),(r||o||f.length)&&(s=nc(a),r&&(s.dotAll=!0,s.raw=wc(function(e){for(var t,n=e.length,r=0,o="",i=!1;r<=n;r++)"\\"!==(t=uc(e,r))?i||"."!==t?("["===t?i=!0:"]"===t&&(i=!1),o+=t):o+="[\\s\\S]":o+=t+uc(e,++r);return o}(e),n)),o&&(s.sticky=!0),f.length&&(s.groups=f)),e!==d)try{Ue(a,"source",""===d?"(?:)":d);}catch(e){}return a},xc=function(e){e in wc||ec(wc,e,{configurable:!0,get:function(){return oc[e]},set:function(t){oc[e]=t;}});},Ec=tc(oc),Sc=0;Ec.length>Sc;)xc(Ec[Sc++]);ic.constructor=wc,wc.prototype=ic,gt(P,"RegExp",wc);}pl("RegExp");var kc=new RegExp(String.fromCharCode(160),"g");function Oc(e){return e.replace(kc," ")}function Cc(e,n){var r=e.length;if(r){var o=e[r-1];if(t.Text.isText(o)){var i=Object.keys(o);if(1===i.length&&"text"===i[0])return o.text=o.text+n,!0}}return !1}function Tc(e,t,n){return {type:"paragraph",children:[{text:y.default(e).text().replace(/\s+/gm," ")}]}}function Nc(e,n){var r=function(e,t){var n=[];if(null!=e.attr("data-w-e-is-void"))return n;var r=e[0].childNodes;return 1===r.length&&"BR"===r[0].nodeName?(n.push({text:""}),n):(r.forEach((function(e){if(e.nodeType!==Ss.ELEMENT_NODE)if(e.nodeType!==Ss.TEXT_NODE);else {var r=e.textContent||"";if(""===r.trim()&&r.indexOf("\n")>=0)return;r&&(r=Oc(r),Cc(n,r)||n.push({text:r}));}else {if("BR"===e.nodeName)return void(Cc(n,"\n")||n.push({text:"\n"}));var o=Lc(y.default(e),t);Array.isArray(o)?o.forEach((function(e){return n.push(e)})):n.push(o);}})),n)}(e,n),o=function(e){for(var t in Zu)if(e[0].matches(t))return Zu[t];return Tc}(e),i=o(e[0],r,n);return Array.isArray(i)||(i=[i]),i.forEach((function(o){t.Editor.isVoid(n,o)||(0===r.length&&(o.children=[{text:e.text().replace(/\s+/gm," ")}]),Qu.forEach((function(t){o=t(e[0],o,n);})));})),i}function Mc(e,t){0===e.parents("pre").length&&(e[0].innerHTML=e[0].innerHTML.replace(/\s+/gm," ").replace(/
/g,"\n"));var n=e[0].textContent||"";n=function(e){return e.replace(/ /g," ").replace(/</g,"<").replace(/>/g,">").replace(/®/g,"®").replace(/©/g,"©").replace(/™/g,"™").replace(/"/g,'"')}(n);var r={text:n=Oc(n)};return Qu.forEach((function(n){r=n(e[0],r,t);})),r}function Lc(e,t){Xu.forEach((function(t){var n=t.selector,r=t.preParseHtml;e[0].matches(n)&&(e=y.default(r(e[0])));}));var n=js(e);return "span"===n?e.attr("data-w-e-type")?Nc(e,t):Mc(e,t):"code"===n?"pre"===js(e.parent())?Nc(e,t):Mc(e,t):Yu.includes(n)?Mc(e,t):Nc(e,t)}function Pc(e,t,n){var r=y.default(n);return !!r.attr(t)||(r.attr(t,"true"),e.on("destroyed",(function(){r.removeAttr(t);})),!1)}function Rc(e,t){void 0===t&&(t="");var n=[];""===t&&(t="


"),0!==t.indexOf("<")&&(t=t.split(/\n/).map((function(e){return "

"+e+"

"})).join(""));var r=y.default("
"+t+"
");return Array.from(r.children()).forEach((function(t){var r=Lc(y.default(t),e);Array.isArray(r)?r.forEach((function(e){return n.push(e)})):n.push(r);})),n}var Dc=Ve.f,jc=pa.fastKey,Ac=ct.set,_c=ct.getterFor,Fc={getConstructor:function(e,t,n,r){var o=e((function(e,o){ba(e,i),Ac(e,{type:t,index:yr(null),first:void 0,last:void 0,size:0}),ye||(e.size=0),null!=o&&ya(o,e[r],{that:e,AS_ENTRIES:n});})),i=o.prototype,a=_c(t),s=function(e,t,n){var r,o,i=a(e),s=l(e,t);return s?s.value=n:(i.last=s={index:o=jc(t,!0),key:t,value:n,previous:r=i.last,next:void 0,removed:!1},i.first||(i.first=s),r&&(r.next=s),ye?i.size++:e.size++,"F"!==o&&(i.index[o]=s)),e},l=function(e,t){var n,r=a(e),o=jc(t);if("F"!==o)return r.index[o];for(n=r.first;n;n=n.next)if(n.key==t)return n};return na(i,{clear:function(){for(var e=a(this),t=e.index,n=e.first;n;)n.removed=!0,n.previous&&(n.previous=n.previous.next=void 0),delete t[n.index],n=n.next;e.first=e.last=void 0,ye?e.size=0:this.size=0;},delete:function(e){var t=this,n=a(t),r=l(t,e);if(r){var o=r.next,i=r.previous;delete n.index[r.index],r.removed=!0,i&&(i.next=o),o&&(o.previous=i),n.first==r&&(n.first=o),n.last==r&&(n.last=i),ye?n.size--:t.size--;}return !!r},forEach:function(e){for(var t,n=a(this),r=Mt(e,arguments.length>1?arguments[1]:void 0);t=t?t.next:n.first;)for(r(t.value,t.key,this);t&&t.removed;)t=t.previous;},has:function(e){return !!l(this,e)}}),na(i,n?{get:function(e){var t=l(this,e);return t&&t.value},set:function(e,t){return s(this,0===e?0:e,t)}}:{add:function(e){return s(this,e=0===e?0:e,e)}}),ye&&Dc(i,"size",{get:function(){return a(this).size}}),o},setStrong:function(e,t,n){var r=t+" Iterator",o=_c(t),i=_c(r);Po(e,t,(function(e,t){Ac(this,{type:r,target:e,state:o(e),kind:t,last:void 0});}),(function(){for(var e=i(this),t=e.kind,n=e.last;n&&n.removed;)n=n.previous;return e.target&&(e.last=n=n?n.next:e.state.first)?"keys"==t?{value:n.key,done:!1}:"values"==t?{value:n.value,done:!1}:{value:[n.key,n.value],done:!1}:(e.target=void 0,{value:void 0,done:!0})}),n?"entries":"values",!n,!0),pl(t);}};xa("Set",(function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}}),Fc);var Ic=new Set(["doctype","!doctype","meta","script","style","link","frame","iframe","title","svg"]);function Bc(e,n){e.isInline(n)?(e.insertNode(n),"link"===n.type&&e.insertFragment([{text:""}])):t.Transforms.insertNodes(e,n,{mode:"highest"});}var $c=function(e){var n=e,r=n.onChange,o=n.insertText,i=n.apply,a=n.deleteBackward;return n.insertText=function(e){n.getConfig().readOnly||o(e);},n.apply=function(e){var r,o,a,s,l,u,c,f,d=[];switch(e.type){case"insert_text":case"remove_text":case"set_node":try{for(var p=qi(t.Editor.levels(n,{at:e.path})),h=p.next();!h.done;h=p.next()){var g=Gi(h.value,2),v=g[0],y=g[1],m=Hs.findKey(n,v);d.push([y,m]);}}catch(e){r={error:e};}finally{try{h&&!h.done&&(o=p.return)&&o.call(p);}finally{if(r)throw r.error}}break;case"insert_node":case"remove_node":case"merge_node":case"split_node":try{for(var b=qi(t.Editor.levels(n,{at:t.Path.parent(e.path)})),w=b.next();!w.done;w=b.next()){var x=Gi(w.value,2);v=x[0],y=x[1],m=Hs.findKey(n,v);d.push([y,m]);}}catch(e){a={error:e};}finally{try{w&&!w.done&&(s=b.return)&&s.call(b);}finally{if(a)throw a.error}}break;case"move_node":try{for(var E=qi(t.Editor.levels(n,{at:t.Path.common(t.Path.parent(e.path),t.Path.parent(e.newPath))})),S=E.next();!S.done;S=E.next()){var k=Gi(S.value,2);v=k[0],y=k[1],m=Hs.findKey(n,v);d.push([y,m]);}}catch(e){l={error:e};}finally{try{S&&!S.done&&(u=E.return)&&u.call(E);}finally{if(l)throw l.error}}}i(e);try{for(var O=qi(d),C=O.next();!C.done;C=O.next()){var T=Gi(C.value,2);y=T[0],m=T[1],v=Gi(t.Editor.node(n,y),1)[0];ps.set(v,m);}}catch(e){c={error:e};}finally{try{C&&!C.done&&(f=O.return)&&f.call(O);}finally{if(c)throw c.error}}},n.deleteBackward=function(r){if("line"!==r)return a(r);if(e.selection&&t.Range.isCollapsed(e.selection)){var o=t.Editor.above(e,{match:function(n){return t.Editor.isBlock(e,n)},at:e.selection});if(o){var i=Gi(o,2)[1],s=t.Editor.range(e,i,e.selection.anchor),l=function(e,n){var r=t.Editor.range(e,t.Range.end(n)),o=Array.from(t.Editor.positions(e,{at:n})),i=0,a=o.length,s=Math.floor(a/2);if(Ju(e,t.Editor.range(e,o[i]),r))return t.Editor.range(e,o[i],r);if(o.length<2)return t.Editor.range(e,o[o.length-1],r);for(;s!==o.length&&s!==i;)Ju(e,t.Editor.range(e,o[s]),r)?a=s:i=s,s=Math.floor((i+a)/2);return t.Editor.range(e,o[a],r)}(n,s);t.Range.isCollapsed(l)||t.Transforms.delete(e,{at:l});}}},n.onChange=function(){var e=n.selection;null!=e&&vs.set(n,e),n.emit("change"),r();},n.handleTab=function(){n.insertText(" ");},n.getHtml=function(){var e=n.children;return (void 0===e?[]:e).map((function(e){return Ku(e,n)})).join("")},n.getText=function(){var e=n.children;return (void 0===e?[]:e).map((function(e){return t.Node.string(e)})).join("\n")},n.getSelectionText=function(){var r=n.selection;return null==r?"":t.Editor.string(e,r)},n.getElemsByType=function(e,r){var o,i;void 0===r&&(r=!1);var a=[],s=t.Editor.nodes(n,{at:[],universal:!0});try{for(var l=qi(s),u=l.next();!u.done;u=l.next()){var c=Gi(u.value,1)[0];if(t.Element.isElement(c))if(r?c.type.indexOf(e)>=0:c.type===e){var f=qu(Hs.findKey(n,c).id);a.push(Ki(Ki({},c),{id:f}));}}}catch(e){o={error:e};}finally{try{u&&!u.done&&(i=l.return)&&i.call(l);}finally{if(o)throw o.error}}return a},n.getElemsByTypePrefix=function(e){return n.getElemsByType(e,!0)},n.isEmpty=function(){var e=n.children,r=void 0===e?[]:e;if(r.length>1)return !1;var o=r[0];if(null==o)return !0;if(t.Element.isElement(o)&&"paragraph"===o.type){var i=o.children,a=void 0===i?[]:i;if(a.length>1)return !1;var s=a[0];if(null==s)return !0;if(t.Text.isText(s)&&""===s.text)return !0}return !1},n.clear=function(){t.Transforms.delete(n,{at:{anchor:t.Editor.start(n,[]),focus:t.Editor.end(n,[])}}),0===n.children.length&&t.Transforms.insertNodes(n,[{type:"paragraph",children:[{text:""}]}]);},n.getParentNode=function(e){return Hs.getParentNode(n,e)},n.dangerouslyInsertHtml=function(e,r){if(void 0===e&&(e=""),void 0===r&&(r=!1),e){var o=document.createElement("div");o.innerHTML=e;var i=Array.from(o.childNodes);if(i=i.filter((function(e){var t=e.nodeType,n=e.nodeName;return t===Ss.TEXT_NODE||t===Ss.ELEMENT_NODE&&!Ic.has(n.toLowerCase())})),0!==i.length){var a=n.selection;if(null!=a){var s=null;if(Hs.isSelectedEmptyParagraph(n)&&!r)s=[a.focus.path[0]];o.setAttribute("hidden","true"),document.body.appendChild(o);var l=0;i.forEach((function(e){var t=e.nodeType,r=e.nodeName,o=e.textContent,i=void 0===o?"":o;if(t!==Ss.TEXT_NODE)if("BR"!==r){var a=e,s=!1;if(Yu.includes(r.toLowerCase()))s=!0;else for(var u in Zu)if(a.matches(u)){s=!0;break}if(s){var c=Lc(y.default(a),n);return Array.isArray(c)?(c.forEach((function(e){return Bc(n,e)})),l++):(Bc(n,c),l++),void(Hs.isSelectedVoidNode(n)&&n.move(1))}var f=window.getComputedStyle(a).display;Hs.isSelectedEmptyParagraph(n)||f.indexOf("inline")<0&&n.insertBreak(),n.dangerouslyInsertHtml(a.innerHTML,!0);}else n.insertText("\n");else {if(!i||!i.trim())return;n.insertNode({text:i});}})),l&&s&&Hs.isEmptyPath(n,s)&&t.Transforms.removeNodes(n,{at:s}),o.remove();}}}},n.setHtml=function(e){void 0===e&&(e="");var r=n.isDisabled(),o=n.isFocused(),i=JSON.stringify(n.selection);n.enable(),n.focus(),n.clear();var a=Rc(n,e);if(t.Transforms.insertFragment(n,a),o||(n.deselect(),n.blur()),r&&(n.deselect(),n.disable()),n.isFocused())try{n.select(JSON.parse(i));}catch(e){n.select(t.Editor.start(n,[]));}},n},Wc=function(e){var n=e,r=n.insertText;return n.insertFragment,n.setFragmentData=function(e){var r=n.selection;if(r){var o=Gi(t.Range.edges(r),2),i=o[0],a=o[1],s=t.Editor.void(n,{at:i.path}),l=t.Editor.void(n,{at:a.path});if(!t.Range.isCollapsed(r)||s){var u=Hs.toDOMRange(n,r),c=u.cloneContents(),f=c.childNodes[0];if(c.childNodes.forEach((function(e){e.textContent&&""!==e.textContent.trim()&&(f=e);})),l){var d=Gi(l,1)[0],p=u.cloneRange(),h=Hs.toDOMNode(n,d);p.setEndAfter(h),c=p.cloneContents();}if(s&&(f=c.querySelector("[data-slate-spacer]")),Array.from(c.querySelectorAll("[data-slate-zero-width]")).forEach((function(e){var t="n"===e.getAttribute("data-slate-zero-width");e.textContent=t?"\n":"";})),Ns(f)){var g=f.ownerDocument.createElement("span");g.style.whiteSpace="pre",g.appendChild(f),c.appendChild(g),f=g;}var v=n.getFragment(),y=JSON.stringify(v),m=window.btoa(encodeURIComponent(y));f.setAttribute("data-slate-fragment",m),e.setData("application/x-slate-fragment",m);var b=c.ownerDocument.createElement("div");return b.appendChild(c),b.setAttribute("hidden","true"),c.ownerDocument.body.appendChild(b),e.setData("text/html",b.innerHTML),e.setData("text/plain",Rs(b)),c.ownerDocument.body.removeChild(b),e}}},n.insertData=function(e){var o,i,a=e.getData("application/x-slate-fragment");if(a){var s=decodeURIComponent(window.atob(a)),l=JSON.parse(s);n.insertFragment(l);}else {var u=e.getData("text/plain"),c=e.getData("text/html");if(c)n.dangerouslyInsertHtml(c);else if(u){var f=u.split(/\r\n|\r|\n/),d=!1;try{for(var p=qi(f),h=p.next();!h.done;h=p.next()){var g=h.value;d&&t.Transforms.splitNodes(n,{always:!0}),r(g),d=!0;}}catch(e){o={error:e};}finally{try{h&&!h.done&&(i=p.return)&&i.call(p);}finally{if(o)throw o.error}}}else;}},n},Hc=function(e){return null!=e},Vc={object:!0,function:!0,undefined:!0},zc=function(e){if(!function(e){return !!Hc(e)&&hasOwnProperty.call(Vc,typeof e)}(e))return !1;try{return !!e.constructor&&e.constructor.prototype===e}catch(e){return !1}},Uc=/^\s*class[\s{/}]/,Kc=Function.prototype.toString,qc=function(e){return !!function(e){if("function"!=typeof e)return !1;if(!hasOwnProperty.call(e,"length"))return !1;try{if("number"!=typeof e.length)return !1;if("function"!=typeof e.call)return !1;if("function"!=typeof e.apply)return !1}catch(e){return !1}return !zc(e)}(e)&&!Uc.test(Kc.call(e))},Gc=function(e){return null!=e},Jc=Object.keys,Yc=function(){try{return Object.keys("primitive"),!0}catch(e){return !1}}()?Object.keys:function(e){return Jc(Gc(e)?Object(e):e)},Xc=function(e){if(!Gc(e))throw new TypeError("Cannot use null or undefined");return e},Qc=Math.max,Zc=function(){var e,t=Object.assign;return "function"==typeof t&&(t(e={foo:"raz"},{bar:"dwa"},{trzy:"trzy"}),e.foo+e.bar+e.trzy==="razdwatrzy")}()?Object.assign:function(e,t){var n,r,o,i=Qc(arguments.length,2);for(e=Object(Xc(e)),o=function(r){try{e[r]=t[r];}catch(e){n||(n=e);}},r=1;r-1},lf=T((function(e){var t=e.exports=function(e,t){var n,r,o,i,a;return arguments.length<2||"string"!=typeof e?(i=t,t=e,e=null):i=arguments[2],Hc(e)?(n=sf.call(e,"c"),r=sf.call(e,"e"),o=sf.call(e,"w")):(n=o=!0,r=!1),a={value:t,configurable:n,enumerable:r,writable:o},i?Zc(rf(i),a):a};t.gs=function(e,t,n){var r,o,i,a;return "string"!=typeof e?(i=n,n=t,t=e,e=null):i=arguments[3],Hc(t)?qc(t)?Hc(n)?qc(n)||(i=n,n=void 0):n=void 0:(i=t,t=n=void 0):t=void 0,Hc(e)?(r=sf.call(e,"c"),o=sf.call(e,"e")):(r=!0,o=!1),a={get:t,set:n,configurable:r,enumerable:o},i?Zc(rf(i),a):a};})),uf=function(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");return e},cf=T((function(e,t){var n,r,o,i,a,s,l,u=Function.prototype.apply,c=Function.prototype.call,f=Object.create,d=Object.defineProperty,p=Object.defineProperties,h=Object.prototype.hasOwnProperty,g={configurable:!0,enumerable:!1,writable:!0};n=function(e,t){var n;return uf(t),h.call(this,"__ee__")?n=this.__ee__:(n=g.value=f(null),d(this,"__ee__",g),g.value=null),n[e]?"object"==typeof n[e]?n[e].push(t):n[e]=[n[e],t]:n[e]=t,this},r=function(e,t){var r,i;return uf(t),i=this,n.call(this,e,r=function(){o.call(i,e,r),u.call(t,this,arguments);}),r.__eeOnceListener__=t,this},o=function(e,t){var n,r,o,i;if(uf(t),!h.call(this,"__ee__"))return this;if(!(n=this.__ee__)[e])return this;if("object"==typeof(r=n[e]))for(i=0;o=r[i];++i)o!==t&&o.__eeOnceListener__!==t||(2===r.length?n[e]=r[i?0:1]:r.splice(i,1));else r!==t&&r.__eeOnceListener__!==t||delete n[e];return this},i=function(e){var t,n,r,o,i;if(h.call(this,"__ee__")&&(o=this.__ee__[e]))if("object"==typeof o){for(n=arguments.length,i=new Array(n-1),t=1;ta/2){var p=a-d;c.right=p+5+"px";}else c.left=d+5+"px";if(f>s/2){var h=s-f;c.bottom=h+5+"px";}else {var g=f+u;g<0&&(g=0),c.top=g+5+"px";}return c}function mf(e,n,r){void 0===r&&(r="modal");var o={top:"0",left:"0"};if(null==e.selection)return o;var i=t.Element.isElement(n)&&e.isVoid(n),a=t.Element.isElement(n)&&e.isInline(n),s=ds.get(n);if(null==s)return o;var l=s.getBoundingClientRect(),u=l.top,c=l.left,f=l.height,d=l.width;if(i){var p=function(e){var t=[];t.push(e);for(var n=0;t.length>0;){var r=t.pop();if(null==r)break;if(++n>1e4)break;var o=r.nodeName;if(1===r.nodeType){var i=o.toLowerCase();if(Es.includes(i)||"iframe"===i||"video"===i)return r;var a=r.children||[],s=a.length;if(s)for(var l=s-1;l>=0;l--)t.push(a[l]);}}return null}(s);if(null!=p){var h=p.getBoundingClientRect();u=h.top,f=h.height;}}var g=vf(e);if(null==g)return o;var v=g.top,y=g.left,m=g.width,b=g.height,w={},x=u-v,E=c-y;if("bar"===r)return w.left=E+"px",x>40?w.bottom=b-x+5+"px":w.top=x+f+5+"px",w;if("modal"===r){var S;if(i?a?E>(m-d)/2?w.right=m-E+5+"px":w.left=E+d+5+"px":w.left="20px":w.left=E+"px",i)(S=x)<0&&(S=0),w.top=S+"px";else if(x>(b-f)/2)w.bottom=b-x+5+"px";else (S=x+f)<0&&(S=0),w.top=S+5+"px";return w}throw new Error("type '"+r+"' is invalid")}function bf(e,t){Uu((function(){var n=vf(e);if(null!=n){var r,o=n.top,i=n.left,a=n.width,s=n.height,l=t.offset(),u=l.top,c=l.left,f=t.width(),d=t.height(),p=u-o,h=c-i,g=t.attr("style");if(g.indexOf("top")>=0)if((r=p+d-s)>0){var v=t.css("top"),y=parseInt(v.toString())-r;y<0&&(y=0),t.css("top",y+"px");}if(g.indexOf("bottom")>=0&&u<0){var m=t.css("bottom"),b=parseInt(m.toString())-Math.abs(u);t.css("bottom",b+"px");}if(g.indexOf("left")>=0)if((r=h+f-a)>0){var w=t.css("left"),x=parseInt(w.toString())-r;x<0&&(x=0),t.css("left",x+"px");}if(g.indexOf("right")>=0&&c<0){var E=t.css("right"),S=parseInt(E.toString())-Math.abs(c);t.css("right",S+"px");}}}));}var wf=qo("slice"),xf=he("species"),Ef=P.Array,Sf=Math.max;_n({target:"Array",proto:!0,forced:!wf},{slice:function(e,t){var n,r,o,i=cn(this),a=It(i),s=gn(e,a),l=gn(void 0===t?a:t,a);if(Bt(i)&&(n=i.constructor,(qt(n)&&(n===Ef||Bt(n.prototype))||me(n)&&null===(n=n[xf]))&&(n=void 0),n===Ef||void 0===n))return yl(i,s,l);for(r=new(void 0===n?Ef:n)(Sf(l-s,0)),o=0;s1?arguments[1]:void 0,t.length)),r=er(e);return Of?Of(t,r,n):Cf(t,n,n+r.length)===r}});var Lf=Object.assign,Pf=Object.defineProperty,Rf=W([].concat),Df=!Lf||se((function(){if(ye&&1!==Lf({b:1},Lf(Pf({},"a",{enumerable:!0,get:function(){Pf(this,"b",{value:3,enumerable:!1});}}),{b:2})).b)return !0;var e={},t={},n=Symbol(),r="abcdefghijklmnopqrst";return e[n]=7,r.split("").forEach((function(e){t[e]=e;})),7!=Lf({},e)[n]||Fn(Lf({},t)).join("")!=r}))?function(e,t){for(var n=U(e),r=arguments.length,o=1,i=kn.f,a=un.f;r>o;)for(var s,l=Rt(arguments[o++]),u=i?Rf(Fn(l),i(l)):Fn(l),c=u.length,f=0;c>f;)s=u[f++],ye&&!Te(a,l,s)||(n[s]=l[s]);return n}:Lf;_n({target:"Object",stat:!0,forced:Object.assign!==Df},{assign:Df});var jf=["props","attrs","style","dataset","on","hook"];function Af(e){var t=e.data,n=void 0===t?{}:t,r=e.children,o=void 0===r?[]:r;Object.keys(n).forEach((function(t){var r,o,i=n[t];if("key"!==t){if(!jf.includes(t)){if(t.startsWith("data-")){var a=t.slice(5);return a=w.default(a),function(e,t){null==e.data&&(e.data={});var n=e.data;null==n.dataset&&(n.dataset={});Object.assign(n.dataset,t);}(e,((r={})[a]=i,r)),void delete n[t]}!function(e,t){null==e.data&&(e.data={});var n=e.data;null==n.props&&(n.props={});Object.assign(n.props,t);}(e,(o={},o[t]=i,o)),delete n[t];}}else e.key=i;})),o.length>0&&o.forEach((function(e){"string"!=typeof e&&Af(e);}));}var _f=[];var Ff={};function If(e,t,n){var r=n.isInline(e)?"span":"div";return s.jsx(r,null,t)}function Bf(e,n){var r,o=Hs.findKey(n,e),i=n.isInline(e),a=t.Editor.isVoid(n,e),l=qu(o.id),u={id:l,key:o.id,"data-slate-node":"element","data-slate-inline":i},c=e.type,f=e.children,d=void 0===f?[]:f,p=function(e){return Ff[e]||If}(c);r=a?null:d.map((function(t,r){return Vf(t,r,e,n)}));var h=p(e,r,n);if(a){u["data-slate-void"]=!0;var g=i?"span":"div",v=Gi(t.Node.texts(e),1),y=Gi(v[0],1)[0],m=Vf(y,0,e,n),b=s.jsx(g,{"data-slate-spacer":!0,style:{height:"0",color:"transparent",outline:"none",position:"absolute"}},m);h=s.jsx(g,{style:{position:"relative"}},h,b),ss.set(y,0),ls.set(y,e);}return null==h.data&&(h.data={}),Object.assign(h.data,u),a||i||(h=function(e,t){var n=t;return _f.forEach((function(r){n=r(e,t);})),n}(e,h)),Uu((function(){var t=Ms(l);null!=t&&(fs.set(o,t),ds.set(e,t),cs.set(t,e));})),h}function $f(e,t){return void 0===t&&(t=!1),s.jsx("span",{"data-slate-string":!0},t?e+"\n":e)}function Wf(e,t){return void 0===e&&(e=0),void 0===t&&(t=!1),s.jsx("span",{"data-slate-zero-width":t?"n":"z","data-slate-length":e},"\ufeff",t?s.jsx("br",null):null)}function Hf(e,n,r){if(null==e.text)throw new Error("Current node is not slate Text "+JSON.stringify(e));var o=Hs.findKey(r,e),i=r.getConfig().decorate;if(null==i)throw new Error("Can not get config.decorate");var a=Hs.findPath(r,e),l=i([e,a]),u=t.Text.decorations(e,l),c=u.map((function(o,i){var a=function(e,n,r,o,i){void 0===n&&(n=!1);var a=e.text,s=Hs.findPath(i,r),l=t.Path.parent(s);if(t.Editor.isEditor(o))throw new Error("Text node "+JSON.stringify(r)+" parent is Editor");return i.isVoid(o)?Wf(t.Node.string(o).length):""!==a||o.children[o.children.length-1]!==r||i.isInline(o)||""!==t.Editor.string(i,l)?""===a?Wf():n&&"\n"===a.slice(-1)?$f(a,!0):$f(a):Wf(0,!0)}(o,i===u.length-1,e,n,r);return a=function(e,t){var n=t;return _f.forEach((function(t){n=t(e,n);})),n}(o,a),s.jsx("span",{"data-slate-leaf":!0},a)})),f=function(e){return "w-e-text-"+e}(o.id),d=s.jsx("span",{"data-slate-node":"text",id:f,key:o.id},c);return Uu((function(){var t=Ms(f);null!=t&&(fs.set(o,t),ds.set(e,t),cs.set(t,e));})),d}function Vf(e,n,r,o){return ss.set(e,n),ls.set(e,r),t.Element.isElement(e)?Bf(e,o):Hf(e,r,o)}function zf(e,t){var n,r=e.$scroll,o=function(e){return "w-e-textarea-"+e}(e.id),i=t.getConfig(),a=i.readOnly,l=i.autoFocus,u=function(e,t){return void 0===t&&(t=!1),s.h("div#"+e,{props:{contentEditable:!t}})}(o,a),c=t.children||[];u.children=c.map((function(e,n){var r=Vf(e,n,t,t);return Af(r),r}));var f=os.get(e);if(null==f&&(f=!0),f){var d=function(e,t){return y.default('')}(o);r.append(d),e.$textArea=d,n=d[0],(h=s.init([s.classModule,s.propsModule,s.styleModule,s.datasetModule,s.eventListenersModule,s.attributesModule]))(n,u),os.set(e,!1),is.set(e,h);}else {var p=as.get(e),h=is.get(e);if(null==p||null==h)return;n=p.elm,h(p,u);}if(null!=n||null!=(n=Ms(o))){if((f?l:t.isFocused())&&n.focus({preventScroll:!0}),f){var g=ks(n);g&&hs.set(t,g);}us.set(t,n),ds.set(t,n),cs.set(n,t),as.set(e,u);}}function Uf(e){return "object"==typeof e&&null!=e&&1===e.nodeType}function Kf(e,t){return (!t||"hidden"!==e)&&"visible"!==e&&"clip"!==e}function qf(e,t){if(e.clientHeightt||i>e&&a=t&&s>=n?i-e-r:a>t&&sn?a-t+o:0}var Jf=function(e,t){var n=window,r=t.scrollMode,o=t.block,i=t.inline,a=t.boundary,s=t.skipOverflowHiddenElements,l="function"==typeof a?a:function(e){return e!==a};if(!Uf(e))throw new TypeError("Invalid target");for(var u=document.scrollingElement||document.documentElement,c=[],f=e;Uf(f)&&l(f);){if((f=f.parentElement)===u){c.push(f);break}null!=f&&f===document.body&&qf(f)&&!qf(document.documentElement)||null!=f&&qf(f,s)&&c.push(f);}for(var d=n.visualViewport?n.visualViewport.width:innerWidth,p=n.visualViewport?n.visualViewport.height:innerHeight,h=window.scrollX||pageXOffset,g=window.scrollY||pageYOffset,v=e.getBoundingClientRect(),y=v.height,m=v.width,b=v.top,w=v.right,x=v.bottom,E=v.left,S="start"===o||"nearest"===o?b:"end"===o?x:b+y/2,k="center"===i?E+m/2:"end"===i?w:E,O=[],C=0;C=0&&E>=0&&x<=p&&w<=d&&b>=P&&x<=D&&E>=j&&w<=R)return O;var A=getComputedStyle(T),_=parseInt(A.borderLeftWidth,10),F=parseInt(A.borderTopWidth,10),I=parseInt(A.borderRightWidth,10),B=parseInt(A.borderBottomWidth,10),$=0,W=0,H="offsetWidth"in T?T.offsetWidth-T.clientWidth-_-I:0,V="offsetHeight"in T?T.offsetHeight-T.clientHeight-F-B:0;if(u===T)$="start"===o?S:"end"===o?S-p:"nearest"===o?Gf(g,g+p,p,F,B,g+S,g+S+y,y):S-p/2,W="start"===i?k:"center"===i?k-d/2:"end"===i?k-d:Gf(h,h+d,d,_,I,h+k,h+k+m,m),$=Math.max(0,$+g),W=Math.max(0,W+h);else {$="start"===o?S-P-F:"end"===o?S-D+B+V:"nearest"===o?Gf(P,D,M,F,B+V,S,S+y,y):S-(P+M/2)+V/2,W="start"===i?k-j-_:"center"===i?k-(j+L/2)+H/2:"end"===i?k-R+I+H:Gf(j,R,L,_,I+H,k,k+m,m);var z=T.scrollLeft,U=T.scrollTop;S+=U-($=Math.max(0,Math.min(U+$,T.scrollHeight-M+V))),k+=z-(W=Math.max(0,Math.min(z+W,T.scrollWidth-L+H)));}O.push({el:T,top:$,left:W});}return O},Yf=T((function(e,t){t.__esModule=!0,t.default=void 0;var n,r=(n=Jf)&&n.__esModule?n:{default:n};function o(e){return e===Object(e)&&0!==Object.keys(e).length}var i=function(e,t){var n=!e.ownerDocument.documentElement.contains(e);if(o(t)&&"function"==typeof t.behavior)return t.behavior(n?[]:(0, r.default)(e,t));if(!n){var i=function(e){return !1===e?{block:"end",inline:"nearest"}:o(e)?e:{block:"start",inline:"nearest"}}(t);return function(e,t){void 0===t&&(t="auto");var n="scrollBehavior"in document.body.style;e.forEach((function(e){var r=e.el,o=e.top,i=e.left;r.scroll&&n?r.scroll({top:o,left:i,behavior:t}):(r.scrollTop=o,r.scrollLeft=i);}));}((0, r.default)(e,i),i.behavior)}};t.default=i,e.exports=t.default;})),Xf=C(Yf);function Qf(e,t){return Cs(t)&&Hs.hasDOMNode(e,t,{editable:!0})}function Zf(e,n){if(e.getConfig().readOnly)return !1;var r=ed(e,n)&&Hs.toSlateNode(e,n);return t.Editor.isVoid(e,r)}function ed(e,t){return Cs(t)&&Hs.hasDOMNode(e,t)}function td(e,n,r){void 0===r&&(r=!1);var o=n.selection,i=n.getConfig(),a=Hs.findDocumentOrShadowRoot(n).getSelection();if(a&&(!e.isComposing||r)&&n.isFocused()){var s="None"!==a.type;if(o||s){var l=us.get(n),u=!1;if(l.contains(a.anchorNode)&&l.contains(a.focusNode)&&(u=!0),s&&u&&o){var c=Hs.toSlateRange(n,a,{exactMatch:!0,suppressThrow:!0});if(c&&t.Range.equals(c,o)){var f=!0;if(t.Range.isCollapsed(o)){var d=a.anchorNode,p=a.anchorOffset;if(d===l){var h=l.childNodes,g=void 0;(g=h[p])&&g.matches("table")&&(f=!1),(g=h[p-1])&&g.matches("table")&&(f=!1);}}if(f)return}}if(!o||Hs.hasRange(n,o)){e.isUpdatingSelection=!0;var v=o&&Hs.toDOMRange(n,o);if(v){t.Range.isBackward(o)?a.setBaseAndExtent(v.endContainer,v.endOffset,v.startContainer,v.startOffset):a.setBaseAndExtent(v.startContainer,v.startOffset,v.endContainer,v.endOffset);var y=v.startContainer.parentElement;if(!y.closest("[data-slate-spacer]")){y.getBoundingClientRect=v.getBoundingClientRect.bind(v);var m=document.body;Xf(y,{scrollMode:"if-needed",boundary:i.scroll?l.parentElement:m,block:"end",behavior:"smooth"}),delete y.getBoundingClientRect;}}else a.removeAllRanges();setTimeout((function(){v&&_s&&l.focus(),e.isUpdatingSelection=!1;}));}else n.selection=Hs.toSlateRange(n,a,{exactMatch:!1,suppressThrow:!1});}}}var nd=new WeakMap,rd=new WeakMap;var od={bold:"mod+b",compose:["down","left","right","up","backspace","enter"],moveBackward:"left",moveForward:"right",moveWordBackward:"ctrl+left",moveWordForward:"ctrl+right",deleteBackward:"shift?+backspace",deleteForward:"shift?+delete",extendBackward:"shift+left",extendForward:"shift+right",italic:"mod+i",splitBlock:"shift?+enter",undo:"mod+z",tab:"tab",selectAll:"mod+a"},id={moveLineBackward:"opt+up",moveLineForward:"opt+down",moveWordBackward:"opt+left",moveWordForward:"opt+right",deleteBackward:["ctrl+backspace","ctrl+h"],deleteForward:["ctrl+delete","ctrl+d"],deleteLineBackward:"cmd+shift?+backspace",deleteLineForward:["cmd+shift?+delete","ctrl+k"],deleteWordBackward:"opt+shift?+backspace",deleteWordForward:"opt+shift?+delete",extendLineBackward:"opt+shift+up",extendLineForward:"opt+shift+down",redo:"cmd+shift+z",transposeCharacter:"ctrl+t"},ad={deleteWordBackward:"ctrl+shift?+backspace",deleteWordForward:"ctrl+shift?+delete",redo:["ctrl+y","ctrl+shift+z"]},sd=function(e){var t=od[e],n=id[e],r=ad[e],o=t&&u.isKeyHotkey(t),i=n&&u.isKeyHotkey(n),a=r&&u.isKeyHotkey(r);return function(e){return !(!o||!o(e))||(!!(As&&i&&i(e))||!(As||!a||!a(e)))}},ld={isBold:sd("bold"),isCompose:sd("compose"),isMoveBackward:sd("moveBackward"),isMoveForward:sd("moveForward"),isDeleteBackward:sd("deleteBackward"),isDeleteForward:sd("deleteForward"),isDeleteLineBackward:sd("deleteLineBackward"),isDeleteLineForward:sd("deleteLineForward"),isDeleteWordBackward:sd("deleteWordBackward"),isDeleteWordForward:sd("deleteWordForward"),isExtendBackward:sd("extendBackward"),isExtendForward:sd("extendForward"),isExtendLineBackward:sd("extendLineBackward"),isExtendLineForward:sd("extendLineForward"),isItalic:sd("italic"),isMoveLineBackward:sd("moveLineBackward"),isMoveLineForward:sd("moveLineForward"),isMoveWordBackward:sd("moveWordBackward"),isMoveWordForward:sd("moveWordForward"),isRedo:sd("redo"),isSplitBlock:sd("splitBlock"),isTransposeCharacter:sd("transposeCharacter"),isUndo:sd("undo"),isTab:sd("tab"),isSelectAll:sd("selectAll")};function ud(e){e.preventDefault();}var cd={beforeinput:function(e,n,r){var o=e,i=r.getConfig().readOnly;if(Ws&&!i&&Qf(r,o.target)){var a=r.selection,s=o.inputType,l=o.dataTransfer||o.data||void 0;if("insertCompositionText"!==s&&"deleteCompositionText"!==s){if(o.preventDefault(),!s.startsWith("delete")||s.startsWith("deleteBy")){var u=Gi(o.getTargetRanges(),1)[0];if(u){var c=Hs.toSlateRange(r,u,{exactMatch:!1,suppressThrow:!1});a&&t.Range.equals(a,c)||t.Transforms.select(r,c);}}if(a&&t.Range.isExpanded(a)&&s.startsWith("delete")){var f=s.endsWith("Backward")?"backward":"forward";t.Editor.deleteFragment(r,{direction:f});}else switch(s){case"deleteByComposition":case"deleteByCut":case"deleteByDrag":t.Editor.deleteFragment(r);break;case"deleteContent":case"deleteContentForward":t.Editor.deleteForward(r);break;case"deleteContentBackward":t.Editor.deleteBackward(r);break;case"deleteEntireSoftLine":t.Editor.deleteBackward(r,{unit:"line"}),t.Editor.deleteForward(r,{unit:"line"});break;case"deleteHardLineBackward":t.Editor.deleteBackward(r,{unit:"block"});break;case"deleteSoftLineBackward":t.Editor.deleteBackward(r,{unit:"line"});break;case"deleteHardLineForward":t.Editor.deleteForward(r,{unit:"block"});break;case"deleteSoftLineForward":t.Editor.deleteForward(r,{unit:"line"});break;case"deleteWordBackward":t.Editor.deleteBackward(r,{unit:"word"});break;case"deleteWordForward":t.Editor.deleteForward(r,{unit:"word"});break;case"insertLineBreak":case"insertParagraph":t.Editor.insertBreak(r);break;case"insertFromDrop":case"insertFromPaste":case"insertFromYank":case"insertReplacementText":case"insertText":if("insertFromPaste"===s&&!ms.get(r))break;l instanceof DataTransfer?r.insertData(l):"string"==typeof l&&t.Editor.insertText(r,l);}}}},blur:function(e,n,r){var o=e,i=n.isUpdatingSelection,a=n.latestElement;if(!r.getConfig().readOnly&&!i&&Qf(r,o.target)){var s=Hs.findDocumentOrShadowRoot(r);if(a!==s.activeElement){var l=o.relatedTarget;if(!(l===Hs.toDOMNode(r,r)||Os(l)&&l.hasAttribute("data-slate-spacer"))){if(null!=l&&Cs(l)&&Hs.hasDOMNode(r,l)){var u=Hs.toSlateNode(r,l);if(t.Element.isElement(u)&&!r.isVoid(u))return}if(Fs){var c=s.getSelection();null==c||c.removeAllRanges();}gs.delete(r);}}}},focus:function(e,t,n){var r=Hs.toDOMNode(n,n),o=Hs.findDocumentOrShadowRoot(n);t.latestElement=o.activeElement,_s&&e.target!==r?r.focus():gs.set(n,!0);},click:function(e,n,r){if(!r.getConfig().readOnly&&ed(r,e.target)&&Cs(e.target)){var o=Hs.toSlateNode(r,e.target),i=Hs.findPath(r,o);if(t.Editor.hasPath(r,i))if(t.Node.get(r,i)===o){var a=t.Editor.start(r,i),s=t.Editor.end(r,i),l=t.Editor.void(r,{at:a}),u=t.Editor.void(r,{at:s});if(l&&u&&t.Path.equals(l[1],u[1])){var c=t.Editor.range(r,a);t.Transforms.select(r,c);}}}},compositionstart:function(e,n,r){if(Qf(r,e.target)){var o=r.selection;if(o&&t.Range.isExpanded(o)&&(t.Editor.deleteFragment(r),Promise.resolve().then((function(){td(n,r,!0);}))),o&&t.Range.isCollapsed(o)){var i=Hs.toDOMRange(r,o).startContainer,a=i.textContent||"";nd.set(r,a),rd.set(r,i);}n.isComposing=!0,function(e,t){var n;t.getConfig().placeholder&&t.isEmpty()&&e.showPlaceholder&&(null===(n=e.$placeholder)||void 0===n||n.hide(),e.showPlaceholder=!1);}(n,r);}},compositionend:function(e,n,r){var o=e;if(Qf(r,o.target)){n.isComposing=!1;var i=r.selection;if(null!=i){($s||_s)&&Hs.cleanExposedTexNodeInSelectionBlock(r);for(var a=t.Range.isBackward(i)?i.focus:i.anchor,s=Gi(t.Editor.node(r,[a.path[0]]),1)[0],l=0;l0&&t.Editor.insertText(r,c.slice(0,f)),n.changeViewState();else t.Editor.insertText(r,c);}else t.Editor.insertText(r,c);Fs||setTimeout((function(){var e=r.selection;if(null!=e){var t=rd.get(r);if(null!=t)Hs.toDOMRange(r,e).startContainer!==t&&(t.textContent=nd.get(r)||"");}}));}}}},compositionupdate:function(e,t,n){Qf(n,e.target)&&(t.isComposing=!0);},keydown:function(e,n,r){var o=e,i=r.selection;if(!r.getConfig().readOnly&&!n.isComposing&&Qf(r,o.target)){if(function(e,t){var n=Xa.get(e),r=n&&n.getMenus(),o=Za.get(e),i=o&&o.getMenus(),a=Ki(Ki({},r),i);for(var s in a){var l=a[s],c=l.hotkey;if(c&&u.isHotkey(c,t)&&!l.isDisabled(e)){var f=l.getValue(e);l.exec(e,f);}}}(r,o),ld.isTab(o))return ud(o),void r.handleTab();if(ld.isRedo(o))return ud(o),void("function"==typeof r.redo&&r.redo());if(ld.isUndo(o))return ud(o),void("function"==typeof r.undo&&r.undo());if(ld.isMoveLineBackward(o))return ud(o),void t.Transforms.move(r,{unit:"line",reverse:!0});if(ld.isMoveLineForward(o))return ud(o),void t.Transforms.move(r,{unit:"line"});if(ld.isExtendLineBackward(o))return ud(o),void t.Transforms.move(r,{unit:"line",edge:"focus",reverse:!0});if(ld.isExtendLineForward(o))return ud(o),void t.Transforms.move(r,{unit:"line",edge:"focus"});if(ld.isMoveBackward(o))return ud(o),void(i&&t.Range.isCollapsed(i)?t.Transforms.move(r,{reverse:!0}):t.Transforms.collapse(r,{edge:"start"}));if(ld.isMoveForward(o))return ud(o),void(i&&t.Range.isCollapsed(i)?t.Transforms.move(r):t.Transforms.collapse(r,{edge:"end"}));if(ld.isMoveWordBackward(o))return ud(o),i&&t.Range.isExpanded(i)&&t.Transforms.collapse(r,{edge:"focus"}),void t.Transforms.move(r,{unit:"word",reverse:!0});if(ld.isMoveWordForward(o))return ud(o),i&&t.Range.isExpanded(i)&&t.Transforms.collapse(r,{edge:"focus"}),void t.Transforms.move(r,{unit:"word"});if(ld.isSelectAll(o))return ud(o),void r.selectAll();if(Ws){if(($s||Fs)&&i&&(ld.isDeleteBackward(o)||ld.isDeleteForward(o))&&t.Range.isCollapsed(i)){var a=t.Node.parent(r,i.anchor.path);if(t.Element.isElement(a)&&t.Editor.isVoid(r,a)&&t.Editor.isInline(r,a))return o.preventDefault(),void t.Transforms.delete(r,{unit:"block"})}}else {if(ld.isBold(o)||ld.isItalic(o)||ld.isTransposeCharacter(o))return void ud(o);if(ld.isSplitBlock(o))return ud(o),void t.Editor.insertBreak(r);if(ld.isDeleteBackward(o))return ud(o),void(i&&t.Range.isExpanded(i)?t.Editor.deleteFragment(r,{direction:"backward"}):t.Editor.deleteBackward(r));if(ld.isDeleteForward(o))return ud(o),void(i&&t.Range.isExpanded(i)?t.Editor.deleteFragment(r,{direction:"forward"}):t.Editor.deleteForward(r));if(ld.isDeleteLineBackward(o))return ud(o),void(i&&t.Range.isExpanded(i)?t.Editor.deleteFragment(r,{direction:"backward"}):t.Editor.deleteBackward(r,{unit:"line"}));if(ld.isDeleteLineForward(o))return ud(o),void(i&&t.Range.isExpanded(i)?t.Editor.deleteFragment(r,{direction:"forward"}):t.Editor.deleteForward(r,{unit:"line"}));if(ld.isDeleteWordBackward(o))return ud(o),void(i&&t.Range.isExpanded(i)?t.Editor.deleteFragment(r,{direction:"backward"}):t.Editor.deleteBackward(r,{unit:"word"}));if(ld.isDeleteWordForward(o))return ud(o),void(i&&t.Range.isExpanded(i)?t.Editor.deleteFragment(r,{direction:"forward"}):t.Editor.deleteForward(r,{unit:"word"}))}}},keypress:function(e,n,r){if(!Ws&&!r.getConfig().readOnly&&Qf(r,e.target)){e.preventDefault();var o=e.key;t.Editor.insertText(r,o);}},copy:function(e,t,n){var r=e;if(Qf(n,r.target)){r.preventDefault();var o=r.clipboardData;null!=o&&n.setFragmentData(o);}},cut:function(e,n,r){var o=e,i=r.selection;if(!r.getConfig().readOnly&&Qf(r,o.target)){o.preventDefault();var a=o.clipboardData;if(null!=a&&(r.setFragmentData(a),i))if(t.Range.isExpanded(i))t.Editor.deleteFragment(r);else {var s=t.Node.parent(r,i.anchor.path);t.Editor.isVoid(r,s)&&t.Transforms.delete(r);}}},paste:function(e,t,n){ms.set(n,!0);var r=e;if(!n.getConfig().readOnly&&Qf(n,r.target)){var o=n.getConfig().customPaste;if(o)if(!1===o(n,r))return void ms.set(n,!1);if(!Ws||function(e){return e.clipboardData&&""!==e.clipboardData.getData("text/plain")&&1===e.clipboardData.types.length}(r)){r.preventDefault();var i=r.clipboardData;null!=i&&n.insertData(i);}}},dragover:function(e,n,r){if(ed(r,e.target)){var o=Hs.toSlateNode(r,e.target);t.Editor.isVoid(r,o)&&e.preventDefault();}},dragstart:function(e,n,r){var o=e;if(ed(r,o.target)&&!r.getConfig().readOnly){var i=Hs.toSlateNode(r,o.target),a=Hs.findPath(r,i);if(t.Editor.isVoid(r,i)||t.Editor.void(r,{at:a,voids:!0})){var s=t.Editor.range(r,a);t.Transforms.select(r,s);}var l=o.dataTransfer;null!=l&&(n.isDraggingInternally=!0,r.setFragmentData(l));}},dragend:function(e,t,n){var r=e;n.getConfig().readOnly||t.isDraggingInternally&&ed(n,r.target)&&(t.isDraggingInternally=!1);},drop:function(e,n,r){var o=e,i=o.dataTransfer;if(!r.getConfig().readOnly&&ed(r,o.target)&&null!=i&&!(Ws&&Fs&&i.files.length>0)){o.preventDefault();var a=r.selection,s=Hs.findEventRange(r,o);t.Transforms.select(r,s),n.isDraggingInternally&&(a&&t.Transforms.delete(r,{at:a}),n.isDraggingInternally=!1),r.insertData(i),r.isFocused()||r.focus();}}},fd=1,dd=function(){function e(e){var n=this;this.id=fd++,this.$textArea=null,this.$progressBar=y.default('
'),this.$maxLengthInfo=y.default('
'),this.isComposing=!1,this.isUpdatingSelection=!1,this.isDraggingInternally=!1,this.latestElement=null,this.showPlaceholder=!1,this.$placeholder=null,this.latestEditorSelection=null,this.onDOMSelectionChange=b.default((function(){var e=n.editorInstance;!function(e,n){var r=e.isComposing,o=e.isUpdatingSelection,i=e.isDraggingInternally;if(!(n.getConfig().readOnly||r||o||i)){var a=Hs.findDocumentOrShadowRoot(n),s=a.activeElement,l=Hs.toDOMNode(n,n),u=a.getSelection();if(s===l?(e.latestElement=s,gs.set(n,!0)):gs.delete(n),!u)return t.Transforms.deselect(n);var c=u.anchorNode,f=u.focusNode,d=Qf(n,c)||Zf(n,c),p=Qf(n,f)||Zf(n,f);if(d&&p){var h=Hs.toSlateRange(n,u,{exactMatch:!1,suppressThrow:!1});t.Transforms.select(n,h);}else t.Transforms.deselect(n);}}(n,e);}),100);var r=y.default(e);if(0===r.length)throw new Error("Cannot find textarea DOM by selector '"+e+"'");this.$box=r;var o=y.default('
');o.append(this.$progressBar),o.append(this.$maxLengthInfo),r.append(o);var i=y.default('
');o.append(i),this.$scroll=i,this.$textAreaContainer=o,Uu((function(){var e=n.editorInstance,t=Hs.getWindow(e);t.document.addEventListener("selectionchange",n.onDOMSelectionChange),e.on("destroyed",(function(){t.document.removeEventListener("selectionchange",n.onDOMSelectionChange);})),o.on("click",(function(){return e.hidePanelOrModal()})),e.on("change",n.changeViewState.bind(n));var r=e.getConfig().onChange;r&&e.on("change",(function(){return r(e)})),n.onFocusAndOnBlur(),e.on("change",n.changeMaxLengthInfo.bind(n)),n.bindEvent();}));}return Object.defineProperty(e.prototype,"editorInstance",{get:function(){var e=Ja.get(this);if(null==e)throw new Error("Can not get editor instance");return e},enumerable:!1,configurable:!0}),e.prototype.bindEvent=function(){var e=this,t=this.$textArea,n=this.$scroll,r=this.editorInstance;null!=t&&(m.default(cd,(function(n,o){t.on(o,(function(t){n(t,e,r);}));})),r.getConfig().scroll&&(n.css("overflow-y","auto"),n.on("scroll",b.default((function(){r.emit("scroll");}),100))));},e.prototype.onFocusAndOnBlur=function(){var e=this,t=this.editorInstance,n=t.getConfig(),r=n.onBlur,o=n.onFocus;this.latestEditorSelection=t.selection,t.on("change",(function(){null==e.latestEditorSelection&&null!=t.selection?setTimeout((function(){return o&&o(t)})):null!=e.latestEditorSelection&&null==t.selection&&setTimeout((function(){return r&&r(t)})),e.latestEditorSelection=t.selection;}));},e.prototype.changeMaxLengthInfo=function(){var e=this.editorInstance,t=e.getConfig().maxLength;if(t){var n=t-Hs.getLeftLengthOfMaxLength(e);this.$maxLengthInfo[0].innerHTML=n+"/"+t;}},e.prototype.changeProgress=function(e){var t=this.$progressBar;t.css("width",e+"%"),e>=100&&setTimeout((function(){t.hide(),t.css("width","0"),t.show();}),1e3);},e.prototype.changeViewState=function(){var e=this,t=this.editorInstance;zf(this,t),function(e,t){var n,r=t.getConfig().placeholder;if(r){var o=t.isEmpty();if(o&&!e.showPlaceholder&&!e.isComposing){if(null==e.$placeholder){var i=y.default('
'+r+"
");e.$textAreaContainer.append(i),e.$placeholder=i;}return e.$placeholder.show(),void(e.showPlaceholder=!0)}!o&&e.showPlaceholder&&(null===(n=e.$placeholder)||void 0===n||n.hide(),e.showPlaceholder=!1);}}(this,t),Uu((function(){td(e,t);}));},e.prototype.destroy=function(){this.$textAreaContainer.remove();},e}();Si("match",(function(e,t,n){return [function(t){var n=V(this),r=null==t?void 0:Ae(t,e);return r?Te(r,t,n):new RegExp(t)[e](er(n))},function(e){var r=Oe(this),o=er(e),i=n(t,r,o);if(i.done)return i.value;if(!r.global)return ji(r,o);var a=r.unicode;r.lastIndex=0;for(var s,l=[],u=0;null!==(s=ji(r,o));){var c=er(s[0]);l[u]=c,""===c&&(r.lastIndex=Oi(o,Ft(r.lastIndex),a)),u++;}return 0===u?null:l}]}));function pd(e){e.removeAttr("width"),e.removeAttr("height"),e.removeAttr("fill"),e.removeAttr("class"),e.removeAttr("t"),e.removeAttr("p-id");var t=e.children();t.length&&pd(t);}function hd(){return y.default('')}function gd(){return y.default('
')}function vd(e,t,n,r,o){if(void 0===o&&(o=!1),t){if(r){var i=As?"cmd":"ctrl";r=r.replace("mod",i);}if(o)r&&(e.attr("data-tooltip",r),e.addClass("w-e-menu-tooltip-v5"),e.addClass("tooltip-right"));else {var a=r?n+"\n"+r:n;e.attr("data-tooltip",a),e.addClass("w-e-menu-tooltip-v5");}}}var yd=function(){function e(e,t,n){var r=this;void 0===n&&(n=!1),this.$elem=y.default('
'),this.$button=y.default(''),this.disabled=!1,this.menu=t;var o=t.tag,i=t.width;if("button"!==o)throw new Error("Invalid tag '"+o+"', expected 'button'");var a=t.title,s=t.hotkey,l=void 0===s?"":s,u=t.iconSvg,c=void 0===u?"":u,f=this.$button;if(c){var d=y.default(c);pd(d),f.append(d);}else f.text(a);vd(f,c,a,l,n),n&&c&&f.append(y.default(''+a+"")),i&&f.css("width",i+"px"),f.attr("data-menu-key",e),this.$elem.append(f),Uu((function(){return r.init()}));}return e.prototype.init=function(){var e=this;this.setActive(),this.setDisabled(),this.$button.on("click",(function(t){t.preventDefault(),Nd(e).hidePanelOrModal(),e.disabled||(e.exec(),e.onButtonClick());}));},e.prototype.exec=function(){var e=Nd(this),t=this.menu,n=t.getValue(e);t.exec(e,n);},e.prototype.setActive=function(){var e=Nd(this),t=this.$button,n="active";this.menu.isActive(e)?t.addClass(n):t.removeClass(n);},e.prototype.setDisabled=function(){var e=Nd(this),t=this.$button,n=this.menu.isDisabled(e);(null==e.selection||e.isDisabled())&&(n=!0),this.menu.alwaysEnable&&(n=!1);var r="disabled";n?t.addClass(r):t.removeClass(r),this.disabled=n;},e.prototype.changeMenuState=function(){this.setActive(),this.setDisabled();},e}(),md=function(e){function t(t,n,r){return void 0===r&&(r=!1),e.call(this,t,n,r)||this}return Ui(t,e),t.prototype.onButtonClick=function(){},t}(yd),bd=function(){function e(e){this.isShow=!1,this.showTime=0,this.record(e);}return e.prototype.record=function(e){var t=ts.get(e);null==t&&(t=new Set,ts.set(e,t)),t.add(this),ns.set(this,e);},e.prototype.renderContent=function(e){var t=this.$elem;t.empty(),t.append(e);var n=this.genSelfElem();n&&t.append(n);},e.prototype.appendTo=function(e){var t=this.$elem;e.append(t);},e.prototype.show=function(){if(!this.isShow){this.showTime=Date.now(),this.$elem.show(),this.isShow=!0;var e=ns.get(this);e&&e.emit("modalOrPanelShow",this);}},e.prototype.hide=function(){if(this.isShow&&!(Date.now()-this.showTime<200)){this.$elem.hide(),this.isShow=!1;var e=ns.get(this);e&&e.emit("modalOrPanelHide");}},e}(),wd=function(e){function t(t){var n=e.call(this,t)||this;return n.type="dropPanel",n.$elem=y.default('
'),n}return Ui(t,e),t.prototype.genSelfElem=function(){return null},t}(bd),xd=function(e){function t(t,n,r){void 0===r&&(r=!1);var o=e.call(this,t,n,r)||this;if(o.dropPanel=null,o.menu=n,n.showDropPanel){var i=hd();o.$button.append(i);}return o}return Ui(t,e),t.prototype.onButtonClick=function(){this.menu.showDropPanel&&this.handleDropPanel();},t.prototype.handleDropPanel=function(){var e=this.menu;if(null!=e.getPanelContentElem){var t=Nd(this);if(null==this.dropPanel){var n=new wd(t),r=e.getPanelContentElem(t);n.renderContent(r),n.appendTo(this.$elem),n.show(),this.dropPanel=n;}else {var o=this.dropPanel;if(o.isShow)o.hide();else {r=e.getPanelContentElem(t);o.renderContent(r),o.show();}}var i=this.dropPanel;if(i.isShow){var a=this.$elem,s=a.offset().left,l=a.parents(".w-e-bar");s-l.offset().left>=l.width()/2?i.$elem.css({left:"none",right:"0"}):i.$elem.css({left:"0",right:"none"});}}},t}(yd),Ed=function(e){function t(t,n){void 0===n&&(n=0);var r=e.call(this,t)||this;r.type="modal",r.$elem=y.default('
'),r.width=0,n&&(r.width=n);var o=r.$elem;return o.on("click",(function(e){return e.stopPropagation()})),o.on("keyup",(function(e){"Escape"===e.code&&(r.hide(),t.restoreSelection());})),r}return Ui(t,e),t.prototype.genSelfElem=function(){var e=this,t=y.default(''),n=ns.get(this);return t.on("click",(function(){e.hide(),null==n||n.restoreSelection();})),t},t.prototype.setStyle=function(e){var t=this.width,n=this.$elem;n.attr("style",""),t&&n.css("width",t+"px"),n.css(e);},t}(bd);var Sd=function(e){function n(t,n,r){void 0===r&&(r=!1);var o=e.call(this,t,n,r)||this;return o.$body=y.default("body"),o.modal=null,o.menu=n,o}return Ui(n,e),n.prototype.onButtonClick=function(){this.menu.showModal&&this.handleModal();},n.prototype.getPosition=function(){var e=Nd(this),n=this.menu.getModalPositionNode(e);return t.Element.isElement(n)?mf(e,n,"modal"):yf(e)},n.prototype.handleModal=function(){var e=Nd(this),t=this.menu;if(null==this.modal){var n=new Ed(e,t.modalWidth);this.renderAndShowModal(n,!0),this.modal=n;}else {(n=this.modal).isShow?n.hide():this.renderAndShowModal(n,!1);}},n.prototype.renderAndShowModal=function(e,t){void 0===t&&(t=!1);var n=Nd(this),r=this.menu;if(null!=r.getModalContentElem){var o=Hs.getTextarea(n),i=Hs.getToolbar(n),a=((null==i?void 0:i.getConfig())||{}).modalAppendToBody,s=r.getModalContentElem(n);if(e.renderContent(s),a)e.setStyle({left:"0",right:"0"});else {var l=this.getPosition();e.setStyle(l);}t&&(a?e.appendTo(this.$body):e.appendTo(o.$textAreaContainer)),e.show(),a||bf(n,e.$elem),setTimeout((function(){n.blur();}));}},n}(yd);var kd=function(e){function t(t,n){var r=e.call(this,t)||this;return r.type="selectList",r.$elem=y.default('
'),n&&r.$elem.css("width",n+"px"),r.$elem.on("click",(function(e){e.stopPropagation();})),r}return Ui(t,e),t.prototype.renderList=function(e){var t=this.$elem;t.empty();var n=y.default("
    ");e.forEach((function(e){var t=e.value,r=e.text,o=e.selected,i=e.styleForRenderMenuList,a=y.default('
  • ');if(i&&a.css(i),o){var s=y.default('');a.append(s),a.addClass("selected");}a.append(y.default(''+r+"")),a.attr("title",r),n.append(a);})),t.append(n);},t.prototype.genSelfElem=function(){return null},t}(bd);var Od=function(){function e(e,t,n){var r=this;void 0===n&&(n=!1),this.$elem=y.default('
    '),this.$button=y.default(''),this.disabled=!1,this.selectList=null;var o=t.tag,i=t.title,a=t.width,s=t.iconSvg,l=void 0===s?"":s,u=t.hotkey,c=void 0===u?"":u;if("select"!==o)throw new Error("Invalid tag '"+o+"', expected 'select'");var f=this.$button;a&&f.css("width",a+"px"),f.attr("data-menu-key",e),vd(f,l,i,c,n),this.$elem.append(f),this.menu=t,Uu((function(){return r.init()}));}return e.prototype.init=function(){var e=this;this.setSelectedValue(),this.$button.on("click",(function(t){t.preventDefault(),Nd(e).hidePanelOrModal(),e.trigger();}));},e.prototype.trigger=function(){var e=this,t=Nd(this);if(!t.isDisabled()&&!this.disabled){var n=this.menu;if(null==this.selectList){this.selectList=new kd(t,n.selectPanelWidth);var r=this.selectList,o=n.getOptions(t);r.renderList(o),r.appendTo(this.$elem),r.show(),r.$elem.on("click","li",(function(t){var n=t.target;if(null!=n){t.preventDefault();var r=y.default(n).attr("data-value");e.onChange(r);}}));}else {if((r=this.selectList).isShow)r.hide();else {o=n.getOptions(t);r.renderList(o),r.show();}}}},e.prototype.onChange=function(e){var t=Nd(this),n=this.menu;n.exec&&n.exec(t,e);},e.prototype.setSelectedValue=function(){var e=Nd(this),t=this.menu,n=t.getValue(e),r=function(e,t){for(var n=e.length,r="",o=0;o'),this.$container=y.default('
    '),this.$button=y.default('');var t=e.key,n=e.iconSvg,r=e.title,o=this.$elem,i=this.$button;if(n){var a=y.default(n);pd(a),i.append(a);}else i.text(r);i.attr("data-menu-key",t);var s=hd();i.append(s),o.append(i);var l=this.$container;o.append(l);var u=this.createObserver();this.observe(u);}return e.prototype.appendBarItem=function(e){var t=e.$elem;this.$container.append(t);},e.prototype.observe=function(e){var t=this.$container;e.observe(t[0],{childList:!0,subtree:!0,attributes:!0});},e.prototype.createObserver=function(){var e=this,t=this.$container,n=this.$button,r=new MutationObserver((function(){var o=t.find("button"),i=o.length;if(0!==i){var a=0;o.each((function(e){y.default(e).hasClass("disabled")&&a++;})),r.disconnect(),a===i?n.addClass("disabled"):n.removeClass("disabled"),e.observe(r);}}));return r},e}(),Td=new WeakMap;function Nd(e){var t=es.get(e);if(null==t)throw new Error("Can not get editor instance");return t}function Md(e,t,n){void 0===n&&(n=!1);var r=Td.get(t);if(r)return r;var o=t.tag;if("button"===o){var i=t.showDropPanel,a=t.showModal;r=i?new xd(e,t,n):a?new Sd(e,t,n):new md(e,t,n);}if("select"===o&&(r=new Od(e,t,n)),null==r)throw new Error("Invalid tag in menu "+JSON.stringify(t));return Td.set(t,r),r}function Ld(e,n){var r=e.selection;return null!=r&&(!t.Range.isCollapsed(r)&&(!Hs.getSelectedElems(e).some((function(t){if(e.isVoid(t))return !0;var n=t.type;return !!["pre","code","table"].includes(n)||void 0}))&&!!t.Text.isText(n)))}var Pd=function(){function e(){var e=this;this.$elem=y.default('
    '),this.menus={},this.hoverbarItems=[],this.prevSelectedNode=null,this.isShow=!1,this.changeHoverbarState=x.default((function(){var n=e.isShow,r=e.getSelectedNodeAndMenuKeys()||{},o=r.node,i=void 0===o?null:o,a=r.menuKeys,s=void 0===a?[]:a;if((null!=i&&e.changeItemsState(),i&&t.Element.isElement(i))&&(n&&e.isSamePath(i,e.prevSelectedNode)))return;e.hideAndClean(),null!=i&&(e.registerItems(s),e.setPosition(i),e.show()),e.prevSelectedNode=i;}),200),Uu((function(){var t=e.getEditorInstance(),n=e.$elem;n.on("mousedown",(function(e){return e.preventDefault()}),{passive:!1}),Hs.getTextarea(t).$textAreaContainer.append(n),t.on("change",e.changeHoverbarState);var r=e.hideAndClean.bind(e);t.on("scroll",r),t.on("fullScreen",r),t.on("unFullScreen",r);}));}return e.prototype.getMenus=function(){return this.menus},e.prototype.hideAndClean=function(){var e=this.$elem;e.removeClass("w-e-bar-show").addClass("w-e-bar-hidden"),this.hoverbarItems=[],e.empty(),this.isShow=!1;},e.prototype.checkPositionBottom=function(){var e=this.$elem,t=!1,n=window.innerHeight;n&&n>=360&&(n-e[0].getBoundingClientRect().bottom<360&&(t=!0));t?e.addClass("w-e-bar-bottom"):e.removeClass("w-e-bar-bottom");},e.prototype.show=function(){this.$elem.removeClass("w-e-bar-hidden").addClass("w-e-bar-show"),this.isShow=!0,this.checkPositionBottom();},e.prototype.changeItemsState=function(){var e=this;Uu((function(){e.hoverbarItems.forEach((function(e){e.changeMenuState();}));}));},e.prototype.registerItems=function(e){var t=this,n=this.$elem;e.forEach((function(e){if("|"!==e)t.registerSingleItem(e);else {var r=gd();n.append(r);}}));},e.prototype.registerSingleItem=function(e){var t=this.getEditorInstance(),n=this.menus,r=n[e];if(null==r){var o=Us[e];if(null==o)throw new Error("Not found menu item factory by key '"+e+"'");if("function"!=typeof o)throw new Error("Menu item factory (key='"+e+"') is not a function");r=o(),n[e]=r;}var i=Md(e,r);this.hoverbarItems.push(i),es.set(i,t),this.$elem.append(i.$elem);},e.prototype.setPosition=function(e){var n=this.getEditorInstance(),r=this.$elem;if(r.attr("style",""),t.Element.isElement(e)){var o=mf(n,e,"bar");return r.css(o),void bf(n,r)}if(t.Text.isText(e)){o=yf(n);return r.css(o),void bf(n,r)}throw new Error("hoverbar.setPosition error, current selected node is not elem nor text")},e.prototype.getSelectedNodeAndMenuKeys=function(){var e=this.getEditorInstance();if(null==e.selection)return null;var n=this.getHoverbarKeysConf(),r=null,o=[],i=function(i){var a=n[i],s=a.match,l=a.menuKeys,u=void 0===l?[]:l,c=s||function(e,t){return Hs.checkNodeType(t,i)},f=Gi(t.Editor.nodes(e,{match:function(t){return c(e,t)},universal:!0}),1),d=f[0];if(null!=d)return r=d[0],o=u,"break"};for(var a in n){if("break"===i(a))break}return null==r||0===o.length?null:{node:r,menuKeys:o}},e.prototype.getEditorInstance=function(){var e=Qa.get(this);if(null==e)throw new Error("Can not get editor instance");return e},e.prototype.getHoverbarKeysConf=function(){var e=this.getEditorInstance().getConfig().hoverbarKeys,t=void 0===e?{}:e,n=t.text;return n&&null==n.match&&(n.match=Ld),t},e.prototype.isSamePath=function(e,n){if(null==e||null==n)return !1;var r=Hs.findPath(null,e),o=Hs.findPath(null,n);return t.Path.equals(r,o)},e.prototype.destroy=function(){this.changeHoverbarState.cancel(),this.$elem.remove(),this.menus={},this.hoverbarItems=[],this.prevSelectedNode=null;},e}();function Rd(e,n,r,o){if(ss.set(e,n),ls.set(e,r),t.Element.isElement(e)){var i=e.children;if((void 0===i?[]:i).forEach((function(t,n){return Rd(t,n,e,o)})),t.Editor.isVoid(o,e)){var a=Gi(t.Node.texts(e),1),s=Gi(a[0],1)[0];ss.set(s,0),ls.set(s,e);}}}var Dd=qo("splice"),jd=P.TypeError,Ad=Math.max,_d=Math.min,Fd=9007199254740991,Id="Maximum allowed length exceeded";_n({target:"Array",proto:!0,forced:!Dd},{splice:function(e,t){var n,r,o,i,a,s,l=U(this),u=It(l),c=gn(e,u),f=arguments.length;if(0===f?n=r=0:1===f?(n=0,r=u-c):(n=f-2,r=_d(Ad(At(t),0),u-c)),u+n-r>Fd)throw jd(Id);for(o=Yt(l,r),i=0;iu-r+n;i--)delete l[i-1];}else if(n>r)for(i=u-r;i>c;i--)s=i+n-1,(a=i+r-1)in l?l[s]=l[a]:delete l[s];for(i=0;i'),this.menus={},this.toolbarItems=[],this.config={},this.changeToolbarState=x.default((function(){n.toolbarItems.forEach((function(e){e.changeMenuState();}));}),200),this.config=t;var r=y.default(e);if(0===r.length)throw new Error("Cannot find toolbar DOM by selector '"+e+"'");this.$box=r;var o=this.$toolbar;o.on("mousedown",(function(e){return e.preventDefault()}),{passive:!1}),r.append(o),Uu((function(){n.registerItems(),n.changeToolbarState(),n.getEditorInstance().on("change",n.changeToolbarState);}));}return e.prototype.getMenus=function(){return this.menus},e.prototype.getConfig=function(){return this.config},e.prototype.registerItems=function(){var e=this,t="",n=this.$toolbar,r=this.config,o=r.toolbarKeys,i=void 0===o?[]:o,a=r.insertKeys,s=void 0===a?{index:0,keys:[]}:a,l=r.excludeKeys,u=void 0===l?[]:l,c=E.default(i);s.keys.length>0&&("string"==typeof s.keys&&(s.keys=[s.keys]),s.keys.forEach((function(e,t){c.splice(s.index+t,0,e);})));var f=c.filter((function(e){if("string"==typeof e){if(u.includes(e))return !1}else if(u.includes(e.key))return !1;return !0})),d=f.length;f.forEach((function(r,o){if("|"===r){if(0===o)return;if(o+1===d)return;if("|"===t)return;var i=gd();return n.append(i),void(t=r)}if("string"==typeof r)return e.registerSingleItem(r,e),void(t=r);e.registerGroup(r),t="group";}));},e.prototype.registerGroup=function(e){var t=this,n=this.$toolbar,r=function(e){return new Cd(e)}(e),o=e.menuKeys,i=void 0===o?[]:o,a=this.config.excludeKeys,s=void 0===a?[]:a;i.forEach((function(e){s.includes(e)||t.registerSingleItem(e,r);})),n.append(r.$elem);},e.prototype.registerSingleItem=function(e,t){var n=this.getEditorInstance(),r=t instanceof Cd,o=this.menus,i=o[e];if(null==i){var a=Us[e];if(null==a)throw new Error("Not found menu item factory by key '"+e+"'");if("function"!=typeof a)throw new Error("Menu item factory (key='"+e+"') is not a function");i=a(),o[e]=i;}else console.warn("Duplicated toolbar menu key '"+e+"'\n重复注册了菜单栏 menu '"+e+"'");var s=Md(e,i,r);(this.toolbarItems.push(s),es.set(s,n),r)?t.appendBarItem(s):t.$toolbar.append(s.$elem);},e.prototype.getEditorInstance=function(){var e=Ya.get(this);if(null==e)throw new Error("Can not get editor instance");return e},e.prototype.destroy=function(){this.$toolbar.remove(),this.menus={},this.toolbarItems=[];},e}();var $d=ht.EXISTS,Wd=Ve.f,Hd=Function.prototype,Vd=W(Hd.toString),zd=/function\b(?:\s|\/\*[\S\s]*?\*\/|\/\/[^\n\r]*[\n\r]+)*([^\s(/]*)/,Ud=W(zd.exec);ye&&!$d&&Wd(Hd,"name",{configurable:!0,get:function(){try{return Ud(zd,Vd(this))[1]}catch(e){return ""}}});var Kd=T((function(e){function t(n){return "function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?(e.exports=t=function(e){return typeof e},e.exports.default=e.exports,e.exports.__esModule=!0):(e.exports=t=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.default=e.exports,e.exports.__esModule=!0),t(n)}e.exports=t,e.exports.default=e.exports,e.exports.__esModule=!0;})),qd=T((function(e){e.exports=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e},e.exports.default=e.exports,e.exports.__esModule=!0;})),Gd=T((function(e){e.exports=function(e){for(var t=1;t1&&void 0!==arguments[1]?arguments[1]:{};ip.default(this,e),this.init(t,n);}return ap.default(e,[{key:"init",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.prefix=t.prefix||"i18next:",this.logger=e||fp,this.options=t,this.debug=t.debug;}},{key:"setDebug",value:function(e){this.debug=e;}},{key:"log",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n1?t-1:0),r=1;r-1?e.replace(/###/g,"."):e}function o(){return !e||"string"==typeof e}for(var i="string"!=typeof t?[].concat(t):t.split(".");i.length>1;){if(o())return {};var a=r(i.shift());!e[a]&&n&&(e[a]=new n),e=Object.prototype.hasOwnProperty.call(e,a)?e[a]:{};}return o()?{}:{obj:e,k:r(i.shift())}}function bp(e,t,n){var r=mp(e,t,Object);r.obj[r.k]=n;}function wp(e,t){var n=mp(e,t),r=n.obj,o=n.k;if(r)return r[o]}function xp(e,t,n){var r=wp(e,n);return void 0!==r?r:wp(t,n)}function Ep(e,t,n){for(var r in t)"__proto__"!==r&&"constructor"!==r&&(r in e?"string"==typeof e[r]||e[r]instanceof String||"string"==typeof t[r]||t[r]instanceof String?n&&(e[r]=t[r]):Ep(e[r],t[r],n):e[r]=t[r]);return e}function Sp(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var kp={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};function Op(e){return "string"==typeof e?e.replace(/[&<>"'\/]/g,(function(e){return kp[e]})):e}var Cp="undefined"!=typeof window&&window.navigator&&window.navigator.userAgent&&window.navigator.userAgent.indexOf("MSIE")>-1;function Tp(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:".";if(e){if(e[t])return e[t];for(var r=t.split(n),o=e,i=0;ii+a;)a++,l=o[s=r.slice(i,i+a).join(n)];if(void 0===l)return;if("string"==typeof l)return l;if(s&&"string"==typeof l[s])return l[s];var u=r.slice(i+a).join(n);return u?Tp(l,u,n):void 0}o=o[r[i]];}return o}}var Np=function(e){function t(e){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{ns:["translation"],defaultNS:"translation"};return ip.default(this,t),n=sp.default(this,lp.default(t).call(this)),Cp&&hp.call(up.default(n)),n.data=e||{},n.options=r,void 0===n.options.keySeparator&&(n.options.keySeparator="."),void 0===n.options.ignoreJSONStructure&&(n.options.ignoreJSONStructure=!0),n}return cp.default(t,e),ap.default(t,[{key:"addNamespaces",value:function(e){this.options.ns.indexOf(e)<0&&this.options.ns.push(e);}},{key:"removeNamespaces",value:function(e){var t=this.options.ns.indexOf(e);t>-1&&this.options.ns.splice(t,1);}},{key:"getResource",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=void 0!==r.keySeparator?r.keySeparator:this.options.keySeparator,i=void 0!==r.ignoreJSONStructure?r.ignoreJSONStructure:this.options.ignoreJSONStructure,a=[e,t];n&&"string"!=typeof n&&(a=a.concat(n)),n&&"string"==typeof n&&(a=a.concat(o?n.split(o):n)),e.indexOf(".")>-1&&(a=e.split("."));var s=wp(this.data,a);return s||!i||"string"!=typeof n?s:Tp(this.data&&this.data[e]&&this.data[e][t],n,o)}},{key:"addResource",value:function(e,t,n,r){var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{silent:!1},i=this.options.keySeparator;void 0===i&&(i=".");var a=[e,t];n&&(a=a.concat(i?n.split(i):n)),e.indexOf(".")>-1&&(r=t,t=(a=e.split("."))[1]),this.addNamespaces(t),bp(this.data,a,r),o.silent||this.emit("added",e,t,n,r);}},{key:"addResources",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{silent:!1};for(var o in n)"string"!=typeof n[o]&&"[object Array]"!==Object.prototype.toString.apply(n[o])||this.addResource(e,t,o,n[o],{silent:!0});r.silent||this.emit("added",e,t,n);}},{key:"addResourceBundle",value:function(e,t,n,r,o){var i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{silent:!1},a=[e,t];e.indexOf(".")>-1&&(r=n,n=t,t=(a=e.split("."))[1]),this.addNamespaces(t);var s=wp(this.data,a)||{};r?Ep(s,n,o):s=op.default({},s,n),bp(this.data,a,s),i.silent||this.emit("added",e,t,n);}},{key:"removeResourceBundle",value:function(e,t){this.hasResourceBundle(e,t)&&delete this.data[e][t],this.removeNamespaces(t),this.emit("removed",e,t);}},{key:"hasResourceBundle",value:function(e,t){return void 0!==this.getResource(e,t)}},{key:"getResourceBundle",value:function(e,t){return t||(t=this.options.defaultNS),"v1"===this.options.compatibilityAPI?op.default({},{},this.getResource(e,t)):this.getResource(e,t)}},{key:"getDataByLanguage",value:function(e){return this.data[e]}},{key:"toJSON",value:function(){return this.data}}]),t}(hp),Mp={processors:{},addPostProcessor:function(e){this.processors[e.name]=e;},handle:function(e,t,n,r,o){var i=this;return e.forEach((function(e){i.processors[e]&&(t=i.processors[e].process(t,n,r,o));})),t}},Lp={},Pp=function(e){function t(e){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return ip.default(this,t),n=sp.default(this,lp.default(t).call(this)),Cp&&hp.call(up.default(n)),yp(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,up.default(n)),n.options=r,void 0===n.options.keySeparator&&(n.options.keySeparator="."),n.logger=pp.create("translator"),n}return cp.default(t,e),ap.default(t,[{key:"changeLanguage",value:function(e){e&&(this.language=e);}},{key:"exists",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{interpolation:{}};if(null==e)return !1;var n=this.resolve(e,t);return n&&void 0!==n.res}},{key:"extractFromKey",value:function(e,t){var n=void 0!==t.nsSeparator?t.nsSeparator:this.options.nsSeparator;void 0===n&&(n=":");var r=void 0!==t.keySeparator?t.keySeparator:this.options.keySeparator,o=t.ns||this.options.defaultNS;if(n&&e.indexOf(n)>-1){var i=e.match(this.interpolator.nestingRegexp);if(i&&i.length>0)return {key:e,namespaces:o};var a=e.split(n);(n!==r||n===r&&this.options.ns.indexOf(a[0])>-1)&&(o=a.shift()),e=a.join(r);}return "string"==typeof o&&(o=[o]),{key:e,namespaces:o}}},{key:"translate",value:function(e,n,r){var o=this;if("object"!==rp.default(n)&&this.options.overloadTranslationOptionHandler&&(n=this.options.overloadTranslationOptionHandler(arguments)),n||(n={}),null==e)return "";Array.isArray(e)||(e=[String(e)]);var i=void 0!==n.keySeparator?n.keySeparator:this.options.keySeparator,a=this.extractFromKey(e[e.length-1],n),s=a.key,l=a.namespaces,u=l[l.length-1],c=n.lng||this.language,f=n.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(c&&"cimode"===c.toLowerCase()){if(f){var d=n.nsSeparator||this.options.nsSeparator;return u+d+s}return s}var p=this.resolve(e,n),h=p&&p.res,g=p&&p.usedKey||s,v=p&&p.exactUsedKey||s,y=Object.prototype.toString.apply(h),m=["[object Number]","[object Function]","[object RegExp]"],b=void 0!==n.joinArrays?n.joinArrays:this.options.joinArrays,w=!this.i18nFormat||this.i18nFormat.handleAsObject,x="string"!=typeof h&&"boolean"!=typeof h&&"number"!=typeof h;if(w&&h&&x&&m.indexOf(y)<0&&("string"!=typeof b||"[object Array]"!==y)){if(!n.returnObjects&&!this.options.returnObjects)return this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!"),this.options.returnedObjectHandler?this.options.returnedObjectHandler(g,h,op.default({},n,{ns:l})):"key '".concat(s," (").concat(this.language,")' returned an object instead of string.");if(i){var E="[object Array]"===y,S=E?[]:{},k=E?v:g;for(var O in h)if(Object.prototype.hasOwnProperty.call(h,O)){var C="".concat(k).concat(i).concat(O);S[O]=this.translate(C,op.default({},n,{joinArrays:!1,ns:l})),S[O]===C&&(S[O]=h[O]);}h=S;}}else if(w&&"string"==typeof b&&"[object Array]"===y)(h=h.join(b))&&(h=this.extendTranslation(h,e,n,r));else {var T=!1,N=!1,M=void 0!==n.count&&"string"!=typeof n.count,L=t.hasDefaultValue(n),P=M?this.pluralResolver.getSuffix(c,n.count):"",R=n["defaultValue".concat(P)]||n.defaultValue;!this.isValidLookup(h)&&L&&(T=!0,h=R),this.isValidLookup(h)||(N=!0,h=s);var D=n.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey,j=D&&N?void 0:h,A=L&&R!==h&&this.options.updateMissing;if(N||T||A){if(this.logger.log(A?"updateKey":"missingKey",c,u,s,A?R:h),i){var _=this.resolve(s,op.default({},n,{keySeparator:!1}));_&&_.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.");}var F=[],I=this.languageUtils.getFallbackCodes(this.options.fallbackLng,n.lng||this.language);if("fallback"===this.options.saveMissingTo&&I&&I[0])for(var B=0;B1&&void 0!==arguments[1]?arguments[1]:{};return "string"==typeof e&&(e=[e]),e.forEach((function(e){if(!a.isValidLookup(t)){var l=a.extractFromKey(e,s),u=l.key;n=u;var c=l.namespaces;a.options.fallbackNS&&(c=c.concat(a.options.fallbackNS));var f=void 0!==s.count&&"string"!=typeof s.count,d=void 0!==s.context&&("string"==typeof s.context||"number"==typeof s.context)&&""!==s.context,p=s.lngs?s.lngs:a.languageUtils.toResolveHierarchy(s.lng||a.language,s.fallbackLng);c.forEach((function(e){a.isValidLookup(t)||(i=e,!Lp["".concat(p[0],"-").concat(e)]&&a.utils&&a.utils.hasLoadedNamespace&&!a.utils.hasLoadedNamespace(i)&&(Lp["".concat(p[0],"-").concat(e)]=!0,a.logger.warn('key "'.concat(n,'" for languages "').concat(p.join(", "),'" won\'t get resolved as namespace "').concat(i,'" was not yet loaded'),"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),p.forEach((function(n){if(!a.isValidLookup(t)){o=n;var i,l,c=u,p=[c];if(a.i18nFormat&&a.i18nFormat.addLookupKeys)a.i18nFormat.addLookupKeys(p,u,n,e,s);else f&&(i=a.pluralResolver.getSuffix(n,s.count)),f&&d&&p.push(c+i),d&&p.push(c+="".concat(a.options.contextSeparator).concat(s.context)),f&&p.push(c+=i);for(;l=p.pop();)a.isValidLookup(t)||(r=l,t=a.getResource(n,e,l,s));}})));}));}})),{res:t,usedKey:n,exactUsedKey:r,usedLng:o,usedNS:i}}},{key:"isValidLookup",value:function(e){return !(void 0===e||!this.options.returnNull&&null===e||!this.options.returnEmptyString&&""===e)}},{key:"getResource",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(e,t,n,r):this.resourceStore.getResource(e,t,n,r)}}],[{key:"hasDefaultValue",value:function(e){var t="defaultValue";for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t===n.substring(0,t.length)&&void 0!==e[n])return !0;return !1}}]),t}(hp);function Rp(e){return e.charAt(0).toUpperCase()+e.slice(1)}var Dp=function(){function e(t){ip.default(this,e),this.options=t,this.whitelist=this.options.supportedLngs||!1,this.supportedLngs=this.options.supportedLngs||!1,this.logger=pp.create("languageUtils");}return ap.default(e,[{key:"getScriptPartFromCode",value:function(e){if(!e||e.indexOf("-")<0)return null;var t=e.split("-");return 2===t.length?null:(t.pop(),"x"===t[t.length-1].toLowerCase()?null:this.formatLanguageCode(t.join("-")))}},{key:"getLanguagePartFromCode",value:function(e){if(!e||e.indexOf("-")<0)return e;var t=e.split("-");return this.formatLanguageCode(t[0])}},{key:"formatLanguageCode",value:function(e){if("string"==typeof e&&e.indexOf("-")>-1){var t=["hans","hant","latn","cyrl","cans","mong","arab"],n=e.split("-");return this.options.lowerCaseLng?n=n.map((function(e){return e.toLowerCase()})):2===n.length?(n[0]=n[0].toLowerCase(),n[1]=n[1].toUpperCase(),t.indexOf(n[1].toLowerCase())>-1&&(n[1]=Rp(n[1].toLowerCase()))):3===n.length&&(n[0]=n[0].toLowerCase(),2===n[1].length&&(n[1]=n[1].toUpperCase()),"sgn"!==n[0]&&2===n[2].length&&(n[2]=n[2].toUpperCase()),t.indexOf(n[1].toLowerCase())>-1&&(n[1]=Rp(n[1].toLowerCase())),t.indexOf(n[2].toLowerCase())>-1&&(n[2]=Rp(n[2].toLowerCase()))),n.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}},{key:"isWhitelisted",value:function(e){return this.logger.deprecate("languageUtils.isWhitelisted",'function "isWhitelisted" will be renamed to "isSupportedCode" in the next major - please make sure to rename it\'s usage asap.'),this.isSupportedCode(e)}},{key:"isSupportedCode",value:function(e){return ("languageOnly"===this.options.load||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}},{key:"getBestMatchFromCodes",value:function(e){var t,n=this;return e?(e.forEach((function(e){if(!t){var r=n.formatLanguageCode(e);n.options.supportedLngs&&!n.isSupportedCode(r)||(t=r);}})),!t&&this.options.supportedLngs&&e.forEach((function(e){if(!t){var r=n.getLanguagePartFromCode(e);if(n.isSupportedCode(r))return t=r;t=n.options.supportedLngs.find((function(e){if(0===e.indexOf(r))return e}));}})),t||(t=this.getFallbackCodes(this.options.fallbackLng)[0]),t):null}},{key:"getFallbackCodes",value:function(e,t){if(!e)return [];if("function"==typeof e&&(e=e(t)),"string"==typeof e&&(e=[e]),"[object Array]"===Object.prototype.toString.apply(e))return e;if(!t)return e.default||[];var n=e[t];return n||(n=e[this.getScriptPartFromCode(t)]),n||(n=e[this.formatLanguageCode(t)]),n||(n=e[this.getLanguagePartFromCode(t)]),n||(n=e.default),n||[]}},{key:"toResolveHierarchy",value:function(e,t){var n=this,r=this.getFallbackCodes(t||this.options.fallbackLng||[],e),o=[],i=function(e){e&&(n.isSupportedCode(e)?o.push(e):n.logger.warn("rejecting language code not found in supportedLngs: ".concat(e)));};return "string"==typeof e&&e.indexOf("-")>-1?("languageOnly"!==this.options.load&&i(this.formatLanguageCode(e)),"languageOnly"!==this.options.load&&"currentOnly"!==this.options.load&&i(this.getScriptPartFromCode(e)),"currentOnly"!==this.options.load&&i(this.getLanguagePartFromCode(e))):"string"==typeof e&&i(this.formatLanguageCode(e)),r.forEach((function(e){o.indexOf(e)<0&&i(n.formatLanguageCode(e));})),o}}]),e}(),jp=[{lngs:["ach","ak","am","arn","br","fil","gun","ln","mfe","mg","mi","oc","pt","pt-BR","tg","tl","ti","tr","uz","wa"],nr:[1,2],fc:1},{lngs:["af","an","ast","az","bg","bn","ca","da","de","dev","el","en","eo","es","et","eu","fi","fo","fur","fy","gl","gu","ha","hi","hu","hy","ia","it","kk","kn","ku","lb","mai","ml","mn","mr","nah","nap","nb","ne","nl","nn","no","nso","pa","pap","pms","ps","pt-PT","rm","sco","se","si","so","son","sq","sv","sw","ta","te","tk","ur","yo"],nr:[1,2],fc:2},{lngs:["ay","bo","cgg","fa","ht","id","ja","jbo","ka","km","ko","ky","lo","ms","sah","su","th","tt","ug","vi","wo","zh"],nr:[1],fc:3},{lngs:["be","bs","cnr","dz","hr","ru","sr","uk"],nr:[1,2,5],fc:4},{lngs:["ar"],nr:[0,1,2,3,11,100],fc:5},{lngs:["cs","sk"],nr:[1,2,5],fc:6},{lngs:["csb","pl"],nr:[1,2,5],fc:7},{lngs:["cy"],nr:[1,2,3,8],fc:8},{lngs:["fr"],nr:[1,2],fc:9},{lngs:["ga"],nr:[1,2,3,7,11],fc:10},{lngs:["gd"],nr:[1,2,3,20],fc:11},{lngs:["is"],nr:[1,2],fc:12},{lngs:["jv"],nr:[0,1],fc:13},{lngs:["kw"],nr:[1,2,3,4],fc:14},{lngs:["lt"],nr:[1,2,10],fc:15},{lngs:["lv"],nr:[1,2,0],fc:16},{lngs:["mk"],nr:[1,2],fc:17},{lngs:["mnk"],nr:[0,1,2],fc:18},{lngs:["mt"],nr:[1,2,11,20],fc:19},{lngs:["or"],nr:[2,1],fc:2},{lngs:["ro"],nr:[1,2,20],fc:20},{lngs:["sl"],nr:[5,1,2,3],fc:21},{lngs:["he","iw"],nr:[1,2,20,21],fc:22}],Ap={1:function(e){return Number(e>1)},2:function(e){return Number(1!=e)},3:function(e){return 0},4:function(e){return Number(e%10==1&&e%100!=11?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2)},5:function(e){return Number(0==e?0:1==e?1:2==e?2:e%100>=3&&e%100<=10?3:e%100>=11?4:5)},6:function(e){return Number(1==e?0:e>=2&&e<=4?1:2)},7:function(e){return Number(1==e?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2)},8:function(e){return Number(1==e?0:2==e?1:8!=e&&11!=e?2:3)},9:function(e){return Number(e>=2)},10:function(e){return Number(1==e?0:2==e?1:e<7?2:e<11?3:4)},11:function(e){return Number(1==e||11==e?0:2==e||12==e?1:e>2&&e<20?2:3)},12:function(e){return Number(e%10!=1||e%100==11)},13:function(e){return Number(0!==e)},14:function(e){return Number(1==e?0:2==e?1:3==e?2:3)},15:function(e){return Number(e%10==1&&e%100!=11?0:e%10>=2&&(e%100<10||e%100>=20)?1:2)},16:function(e){return Number(e%10==1&&e%100!=11?0:0!==e?1:2)},17:function(e){return Number(1==e||e%10==1&&e%100!=11?0:1)},18:function(e){return Number(0==e?0:1==e?1:2)},19:function(e){return Number(1==e?0:0==e||e%100>1&&e%100<11?1:e%100>10&&e%100<20?2:3)},20:function(e){return Number(1==e?0:0==e||e%100>0&&e%100<20?1:2)},21:function(e){return Number(e%100==1?1:e%100==2?2:e%100==3||e%100==4?3:0)},22:function(e){return Number(1==e?0:2==e?1:(e<0||e>10)&&e%10==0?2:3)}};function _p(){var e={};return jp.forEach((function(t){t.lngs.forEach((function(n){e[n]={numbers:t.nr,plurals:Ap[t.fc]};}));})),e}var Fp=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};ip.default(this,e),this.languageUtils=t,this.options=n,this.logger=pp.create("pluralResolver"),this.rules=_p();}return ap.default(e,[{key:"addRule",value:function(e,t){this.rules[e]=t;}},{key:"getRule",value:function(e){return this.rules[e]||this.rules[this.languageUtils.getLanguagePartFromCode(e)]}},{key:"needsPlural",value:function(e){var t=this.getRule(e);return t&&t.numbers.length>1}},{key:"getPluralFormsOfKey",value:function(e,t){return this.getSuffixes(e).map((function(e){return t+e}))}},{key:"getSuffixes",value:function(e){var t=this,n=this.getRule(e);return n?n.numbers.map((function(n){return t.getSuffix(e,n)})):[]}},{key:"getSuffix",value:function(e,t){var n=this,r=this.getRule(e);if(r){var o=r.noAbs?r.plurals(t):r.plurals(Math.abs(t)),i=r.numbers[o];this.options.simplifyPluralSuffix&&2===r.numbers.length&&1===r.numbers[0]&&(2===i?i="plural":1===i&&(i=""));var a=function(){return n.options.prepend&&i.toString()?n.options.prepend+i.toString():i.toString()};return "v1"===this.options.compatibilityJSON?1===i?"":"number"==typeof i?"_plural_".concat(i.toString()):a():"v2"===this.options.compatibilityJSON||this.options.simplifyPluralSuffix&&2===r.numbers.length&&1===r.numbers[0]?a():this.options.prepend&&o.toString()?this.options.prepend+o.toString():o.toString()}return this.logger.warn("no plural rule found for: ".concat(e)),""}}]),e}(),Ip=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};ip.default(this,e),this.logger=pp.create("interpolator"),this.options=t,this.format=t.interpolation&&t.interpolation.format||function(e){return e},this.init(t);}return ap.default(e,[{key:"init",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e.interpolation||(e.interpolation={escapeValue:!0});var t=e.interpolation;this.escape=void 0!==t.escape?t.escape:Op,this.escapeValue=void 0===t.escapeValue||t.escapeValue,this.useRawValueToEscape=void 0!==t.useRawValueToEscape&&t.useRawValueToEscape,this.prefix=t.prefix?Sp(t.prefix):t.prefixEscaped||"{{",this.suffix=t.suffix?Sp(t.suffix):t.suffixEscaped||"}}",this.formatSeparator=t.formatSeparator?t.formatSeparator:t.formatSeparator||",",this.unescapePrefix=t.unescapeSuffix?"":t.unescapePrefix||"-",this.unescapeSuffix=this.unescapePrefix?"":t.unescapeSuffix||"",this.nestingPrefix=t.nestingPrefix?Sp(t.nestingPrefix):t.nestingPrefixEscaped||Sp("$t("),this.nestingSuffix=t.nestingSuffix?Sp(t.nestingSuffix):t.nestingSuffixEscaped||Sp(")"),this.nestingOptionsSeparator=t.nestingOptionsSeparator?t.nestingOptionsSeparator:t.nestingOptionsSeparator||",",this.maxReplaces=t.maxReplaces?t.maxReplaces:1e3,this.alwaysFormat=void 0!==t.alwaysFormat&&t.alwaysFormat,this.resetRegExp();}},{key:"reset",value:function(){this.options&&this.init(this.options);}},{key:"resetRegExp",value:function(){var e="".concat(this.prefix,"(.+?)").concat(this.suffix);this.regexp=new RegExp(e,"g");var t="".concat(this.prefix).concat(this.unescapePrefix,"(.+?)").concat(this.unescapeSuffix).concat(this.suffix);this.regexpUnescape=new RegExp(t,"g");var n="".concat(this.nestingPrefix,"(.+?)").concat(this.nestingSuffix);this.nestingRegexp=new RegExp(n,"g");}},{key:"interpolate",value:function(e,t,n,r){var o,i,a,s=this,l=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{};function u(e){return e.replace(/\$/g,"$$$$")}var c=function(e){if(e.indexOf(s.formatSeparator)<0){var o=xp(t,l,e);return s.alwaysFormat?s.format(o,void 0,n,op.default({},r,t,{interpolationkey:e})):o}var i=e.split(s.formatSeparator),a=i.shift().trim(),u=i.join(s.formatSeparator).trim();return s.format(xp(t,l,a),u,n,op.default({},r,t,{interpolationkey:a}))};this.resetRegExp();var f=r&&r.missingInterpolationHandler||this.options.missingInterpolationHandler,d=r&&r.interpolation&&r.interpolation.skipOnVariables||this.options.interpolation.skipOnVariables;return [{regex:this.regexpUnescape,safeValue:function(e){return u(e)}},{regex:this.regexp,safeValue:function(e){return s.escapeValue?u(s.escape(e)):u(e)}}].forEach((function(t){for(a=0;o=t.regex.exec(e);){if(void 0===(i=c(o[1].trim())))if("function"==typeof f){var n=f(e,o,r);i="string"==typeof n?n:"";}else {if(d){i=o[0];continue}s.logger.warn("missed to pass in variable ".concat(o[1]," for interpolating ").concat(e)),i="";}else "string"==typeof i||s.useRawValueToEscape||(i=vp(i));var l=t.safeValue(i);if(e=e.replace(o[0],l),d?(t.regex.lastIndex+=l.length,t.regex.lastIndex-=o[0].length):t.regex.lastIndex=0,++a>=s.maxReplaces)break}})),e}},{key:"nest",value:function(e,t){var n,r,o=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=op.default({},i);function s(e,t){var n=this.nestingOptionsSeparator;if(e.indexOf(n)<0)return e;var r=e.split(new RegExp("".concat(n,"[ ]*{"))),o="{".concat(r[1]);e=r[0],o=(o=this.interpolate(o,a)).replace(/'/g,'"');try{a=JSON.parse(o),t&&(a=op.default({},t,a));}catch(t){return this.logger.warn("failed parsing options string in nesting for key ".concat(e),t),"".concat(e).concat(n).concat(o)}return delete a.defaultValue,e}for(a.applyPostProcessor=!1,delete a.defaultValue;n=this.nestingRegexp.exec(e);){var l=[],u=!1;if(-1!==n[0].indexOf(this.formatSeparator)&&!/{.*}/.test(n[1])){var c=n[1].split(this.formatSeparator).map((function(e){return e.trim()}));n[1]=c.shift(),l=c,u=!0;}if((r=t(s.call(this,n[1].trim(),a),a))&&n[0]===e&&"string"!=typeof r)return r;"string"!=typeof r&&(r=vp(r)),r||(this.logger.warn("missed to resolve ".concat(n[1]," for nesting ").concat(e)),r=""),u&&(r=l.reduce((function(e,t){return o.format(e,t,i.lng,op.default({},i,{interpolationkey:n[1].trim()}))}),r.trim())),e=e.replace(n[0],r),this.regexp.lastIndex=0;}return e}}]),e}();var Bp=function(e){function t(e,n,r){var o,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return ip.default(this,t),o=sp.default(this,lp.default(t).call(this)),Cp&&hp.call(up.default(o)),o.backend=e,o.store=n,o.services=r,o.languageUtils=r.languageUtils,o.options=i,o.logger=pp.create("backendConnector"),o.state={},o.queue=[],o.backend&&o.backend.init&&o.backend.init(r,i.backend,i),o}return cp.default(t,e),ap.default(t,[{key:"queueLoad",value:function(e,t,n,r){var o=this,i=[],a=[],s=[],l=[];return e.forEach((function(e){var r=!0;t.forEach((function(t){var s="".concat(e,"|").concat(t);!n.reload&&o.store.hasResourceBundle(e,t)?o.state[s]=2:o.state[s]<0||(1===o.state[s]?a.indexOf(s)<0&&a.push(s):(o.state[s]=1,r=!1,a.indexOf(s)<0&&a.push(s),i.indexOf(s)<0&&i.push(s),l.indexOf(t)<0&&l.push(t)));})),r||s.push(e);})),(i.length||a.length)&&this.queue.push({pending:a,loaded:{},errors:[],callback:r}),{toLoad:i,pending:a,toLoadLanguages:s,toLoadNamespaces:l}}},{key:"loaded",value:function(e,t,n){var r=e.split("|"),o=r[0],i=r[1];t&&this.emit("failedLoading",o,i,t),n&&this.store.addResourceBundle(o,i,n),this.state[e]=t?-1:2;var a={};this.queue.forEach((function(n){!function(e,t,n,r){var o=mp(e,t,Object),i=o.obj,a=o.k;i[a]=i[a]||[],r&&(i[a]=i[a].concat(n)),r||i[a].push(n);}(n.loaded,[o],i),function(e,t){for(var n=e.indexOf(t);-1!==n;)e.splice(n,1),n=e.indexOf(t);}(n.pending,e),t&&n.errors.push(t),0!==n.pending.length||n.done||(Object.keys(n.loaded).forEach((function(e){a[e]||(a[e]=[]),n.loaded[e].length&&n.loaded[e].forEach((function(t){a[e].indexOf(t)<0&&a[e].push(t);}));})),n.done=!0,n.errors.length?n.callback(n.errors):n.callback());})),this.emit("loaded",a),this.queue=this.queue.filter((function(e){return !e.done}));}},{key:"read",value:function(e,t,n){var r=this,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:350,a=arguments.length>5?arguments[5]:void 0;return e.length?this.backend[n](e,t,(function(s,l){s&&l&&o<5?setTimeout((function(){r.read.call(r,e,t,n,o+1,2*i,a);}),i):a(s,l);})):a(null,{})}},{key:"prepareLoading",value:function(e,t){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),o&&o();"string"==typeof e&&(e=this.languageUtils.toResolveHierarchy(e)),"string"==typeof t&&(t=[t]);var i=this.queueLoad(e,t,r,o);if(!i.toLoad.length)return i.pending.length||o(),null;i.toLoad.forEach((function(e){n.loadOne(e);}));}},{key:"load",value:function(e,t,n){this.prepareLoading(e,t,{},n);}},{key:"reload",value:function(e,t,n){this.prepareLoading(e,t,{reload:!0},n);}},{key:"loadOne",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=e.split("|"),o=r[0],i=r[1];this.read(o,i,"read",void 0,void 0,(function(r,a){r&&t.logger.warn("".concat(n,"loading namespace ").concat(i," for language ").concat(o," failed"),r),!r&&a&&t.logger.log("".concat(n,"loaded namespace ").concat(i," for language ").concat(o),a),t.loaded(e,r,a);}));}},{key:"saveMissing",value:function(e,t,n,r,o){var i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{};this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(t)?this.logger.warn('did not save key "'.concat(n,'" as the namespace "').concat(t,'" was not yet loaded'),"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!"):null!=n&&""!==n&&(this.backend&&this.backend.create&&this.backend.create(e,t,n,r,null,op.default({},i,{isUpdate:o})),e&&e[0]&&this.store.addResource(e[0],t,n,r));}}]),t}(hp);function $p(){return {debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,whitelist:!1,nonExplicitWhitelist:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!0,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:function(e){var t={};if("object"===rp.default(e[1])&&(t=e[1]),"string"==typeof e[1]&&(t.defaultValue=e[1]),"string"==typeof e[2]&&(t.tDescription=e[2]),"object"===rp.default(e[2])||"object"===rp.default(e[3])){var n=e[3]||e[2];Object.keys(n).forEach((function(e){t[e]=n[e];}));}return t},interpolation:{escapeValue:!0,format:function(e,t,n,r){return e},prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!1}}}function Wp(e){return "string"==typeof e.ns&&(e.ns=[e.ns]),"string"==typeof e.fallbackLng&&(e.fallbackLng=[e.fallbackLng]),"string"==typeof e.fallbackNS&&(e.fallbackNS=[e.fallbackNS]),e.whitelist&&(e.whitelist&&e.whitelist.indexOf("cimode")<0&&(e.whitelist=e.whitelist.concat(["cimode"])),e.supportedLngs=e.whitelist),e.nonExplicitWhitelist&&(e.nonExplicitSupportedLngs=e.nonExplicitWhitelist),e.supportedLngs&&e.supportedLngs.indexOf("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),e}function Hp(){}var Vp=function(e){function t(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;if(ip.default(this,t),e=sp.default(this,lp.default(t).call(this)),Cp&&hp.call(up.default(e)),e.options=Wp(n),e.services={},e.logger=pp,e.modules={external:[]},r&&!e.isInitialized&&!n.isClone){if(!e.options.initImmediate)return e.init(n,r),sp.default(e,up.default(e));setTimeout((function(){e.init(n,r);}),0);}return e}return cp.default(t,e),ap.default(t,[{key:"init",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;function r(e){return e?"function"==typeof e?new e:e:null}if("function"==typeof t&&(n=t,t={}),t.whitelist&&!t.supportedLngs&&this.logger.deprecate("whitelist",'option "whitelist" will be renamed to "supportedLngs" in the next major - please make sure to rename this option asap.'),t.nonExplicitWhitelist&&!t.nonExplicitSupportedLngs&&this.logger.deprecate("whitelist",'options "nonExplicitWhitelist" will be renamed to "nonExplicitSupportedLngs" in the next major - please make sure to rename this option asap.'),this.options=op.default({},$p(),this.options,Wp(t)),this.format=this.options.interpolation.format,n||(n=Hp),!this.options.isClone){this.modules.logger?pp.init(r(this.modules.logger),this.options):pp.init(null,this.options);var o=new Dp(this.options);this.store=new Np(this.options.resources,this.options);var i=this.services;i.logger=pp,i.resourceStore=this.store,i.languageUtils=o,i.pluralResolver=new Fp(o,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),i.interpolator=new Ip(this.options),i.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},i.backendConnector=new Bp(r(this.modules.backend),i.resourceStore,i,this.options),i.backendConnector.on("*",(function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o1?n-1:0),o=1;o0&&"dev"!==a[0]&&(this.options.lng=a[0]);}this.services.languageDetector||this.options.lng||this.logger.warn("init: no languageDetector is used and no lng is defined");var s=["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"];s.forEach((function(t){e[t]=function(){var n;return (n=e.store)[t].apply(n,arguments)};}));var l=["addResource","addResources","addResourceBundle","removeResourceBundle"];l.forEach((function(t){e[t]=function(){var n;return (n=e.store)[t].apply(n,arguments),e};}));var u=gp(),c=function(){var t=function(t,r){e.isInitialized&&!e.initializedStoreOnce&&e.logger.warn("init: i18next is already initialized. You should call init just once!"),e.isInitialized=!0,e.options.isClone||e.logger.log("initialized",e.options),e.emit("initialized",e.options),u.resolve(r),n(t,r);};if(e.languages&&"v1"!==e.options.compatibilityAPI&&!e.isInitialized)return t(null,e.t.bind(e));e.changeLanguage(e.options.lng,t);};return this.options.resources||!this.options.initImmediate?c():setTimeout(c,0),u}},{key:"loadResources",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Hp,r=n,o="string"==typeof e?e:this.language;if("function"==typeof e&&(r=e),!this.options.resources||this.options.partialBundledLanguages){if(o&&"cimode"===o.toLowerCase())return r();var i=[],a=function(e){e&&t.services.languageUtils.toResolveHierarchy(e).forEach((function(e){i.indexOf(e)<0&&i.push(e);}));};if(o)a(o);else {var s=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);s.forEach((function(e){return a(e)}));}this.options.preload&&this.options.preload.forEach((function(e){return a(e)})),this.services.backendConnector.load(i,this.options.ns,r);}else r(null);}},{key:"reloadResources",value:function(e,t,n){var r=gp();return e||(e=this.languages),t||(t=this.options.ns),n||(n=Hp),this.services.backendConnector.reload(e,t,(function(e){r.resolve(),n(e);})),r}},{key:"use",value:function(e){if(!e)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return "backend"===e.type&&(this.modules.backend=e),("logger"===e.type||e.log&&e.warn&&e.error)&&(this.modules.logger=e),"languageDetector"===e.type&&(this.modules.languageDetector=e),"i18nFormat"===e.type&&(this.modules.i18nFormat=e),"postProcessor"===e.type&&Mp.addPostProcessor(e),"3rdParty"===e.type&&this.modules.external.push(e),this}},{key:"changeLanguage",value:function(e,t){var n=this;this.isLanguageChangingTo=e;var r=gp();this.emit("languageChanging",e);var o=function(o){e||o||!n.services.languageDetector||(o=[]);var i="string"==typeof o?o:n.services.languageUtils.getBestMatchFromCodes(o);i&&(n.language||(n.language=i,n.languages=n.services.languageUtils.toResolveHierarchy(i)),n.translator.language||n.translator.changeLanguage(i),n.services.languageDetector&&n.services.languageDetector.cacheUserLanguage(i)),n.loadResources(i,(function(e){!function(e,o){o?(n.language=o,n.languages=n.services.languageUtils.toResolveHierarchy(o),n.translator.changeLanguage(o),n.isLanguageChangingTo=void 0,n.emit("languageChanged",o),n.logger.log("languageChanged",o)):n.isLanguageChangingTo=void 0,r.resolve((function(){return n.t.apply(n,arguments)})),t&&t(e,(function(){return n.t.apply(n,arguments)}));}(e,i);}));};return e||!this.services.languageDetector||this.services.languageDetector.async?!e&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect(o):o(e):o(this.services.languageDetector.detect()),r}},{key:"getFixedT",value:function(e,t,n){var r=this,o=function e(t,o){var i;if("object"!==rp.default(o)){for(var a=arguments.length,s=new Array(a>2?a-2:0),l=2;l1&&void 0!==arguments[1]?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;var r=this.languages[0],o=!!this.options&&this.options.fallbackLng,i=this.languages[this.languages.length-1];if("cimode"===r.toLowerCase())return !0;var a=function(e,n){var r=t.services.backendConnector.state["".concat(e,"|").concat(n)];return -1===r||2===r};if(n.precheck){var s=n.precheck(this,a);if(void 0!==s)return s}return !!this.hasResourceBundle(r,e)||(!this.services.backendConnector.backend||!(!a(r,e)||o&&!a(i,e)))}},{key:"loadNamespaces",value:function(e,t){var n=this,r=gp();return this.options.ns?("string"==typeof e&&(e=[e]),e.forEach((function(e){n.options.ns.indexOf(e)<0&&n.options.ns.push(e);})),this.loadResources((function(e){r.resolve(),t&&t(e);})),r):(t&&t(),Promise.resolve())}},{key:"loadLanguages",value:function(e,t){var n=gp();"string"==typeof e&&(e=[e]);var r=this.options.preload||[],o=e.filter((function(e){return r.indexOf(e)<0}));return o.length?(this.options.preload=r.concat(o),this.loadResources((function(e){n.resolve(),t&&t(e);})),n):(t&&t(),Promise.resolve())}},{key:"dir",value:function(e){if(e||(e=this.languages&&this.languages.length>0?this.languages[0]:this.language),!e)return "rtl";return ["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam"].indexOf(this.services.languageUtils.getLanguagePartFromCode(e))>=0?"rtl":"ltr"}},{key:"createInstance",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;return new t(e,n)}},{key:"cloneInstance",value:function(){var e=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Hp,o=op.default({},this.options,n,{isClone:!0}),i=new t(o),a=["store","services","language"];return a.forEach((function(t){i[t]=e[t];})),i.services=op.default({},this.services),i.services.utils={hasLoadedNamespace:i.hasLoadedNamespace.bind(i)},i.translator=new Pp(i.services,i.options),i.translator.on("*",(function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r0&&o.removeAllRanges(),r&&t.Transforms.deselect(e);},n.move=function(n,r){void 0===r&&(r=!1),n&&(n<0||t.Transforms.move(e,{distance:n,unit:"character",reverse:r}));},n.moveReverse=function(e){n.move(e,!0);},n.restoreSelection=function(){var e=vs.get(n);null!=e&&(n.focus(),t.Transforms.select(n,e));},n.getSelectionPosition=function(){return yf(n)},n.getNodePosition=function(e){return mf(n,e)},n.isSelectedAll=function(){var e=n.selection;if(null==e)return !1;var r=Gi(t.Range.edges(e),2),o=r[0],i=r[1],a=Gi(t.Editor.edges(n,[]),2),s=a[0],l=a[1];return !(!t.Point.equals(o,s)||!t.Point.equals(i,l))},n.selectAll=function(){var e=t.Editor.start(n,[]),r=t.Editor.end(n,[]);t.Transforms.select(n,{anchor:e,focus:r});},n}($c(function(e){var t=e;return t.getAllMenuKeys=function(){var e=[];for(var t in Us)e.push(t);return e},t.getConfig=function(){var e=rs.get(t);if(null==e)throw new Error("Can not get editor config");return e},t.getMenuConfig=function(e){var n=t.getConfig().MENU_CONF;return (void 0===n?{}:n)[e]||{}},t.alert=function(e,n){void 0===n&&(n="info");var r=t.getConfig().customAlert;r&&r(e,n);},t}(function(e){var n=e;return n.id="wangEditor-"+Vs++,n.isDestroyed=!1,n.isFullScreen=!1,n.focus=function(e){if(Hs.toDOMNode(n,n).focus({preventScroll:!0}),gs.set(n,!0),e){var r=t.Editor.end(n,[]);t.Transforms.select(n,r);}else {var o=vs.get(n);o?t.Transforms.select(n,o):t.Transforms.select(n,t.Editor.start(n,[]));}},n.isFocused=function(){return !!gs.get(n)},n.blur=function(){Hs.toDOMNode(n,n).blur(),t.Transforms.deselect(n),gs.set(n,!1);},n.updateView=function(){Hs.getTextarea(n).changeViewState();var e=Hs.getToolbar(n);e&&e.changeToolbarState();var t=Hs.getHoverbar(n);t&&t.changeHoverbarState();},n.destroy=function(){if(!n.isDestroyed){var e=Hs.getTextarea(n);e.destroy(),Ga.delete(n),Ja.delete(e);var t=Hs.getToolbar(n);t&&(t.destroy(),Xa.delete(n),Ya.delete(t));var r=Hs.getHoverbar(n);r&&(r.destroy(),Za.delete(n),Qa.delete(r)),n.isDestroyed=!0,n.emit("destroyed");}},n.scrollToElem=function(e){if(!n.getConfig().scroll){var t="编辑器禁用了 scroll ,编辑器内容无法滚动,请自行实现该功能";return t+="\nYou has disabled editor scroll, please do this yourself",void console.warn(t)}var r=y.default("#"+e);if(0!==r.length){var o=r[0];if(!Hs.hasDOMNode(n,o))return t="Element (found by id is '"+e+"') is not in editor DOM",t+="\n 通过 id '"+e+"' 找到的 element 不在 editor DOM 之内",void console.error(t,o);var i=Hs.getTextarea(n),a=i.$textAreaContainer,s=i.$scroll,l=r.offset().top,u=a.offset().top;s[0].scrollBy({top:l-u,behavior:"smooth"});}},n.showProgressBar=function(e){e<1||Hs.getTextarea(n).changeProgress(e);},n.hidePanelOrModal=function(){var e=ts.get(n);null!=e&&e.forEach((function(e){return e.hide()}));},n.enable=function(){n.getConfig().readOnly=!1,n.updateView();},n.disable=function(){n.getConfig().readOnly=!0,n.updateView();},n.isDisabled=function(){return n.getConfig().readOnly},n.toDOMNode=function(e){return Hs.toDOMNode(n,e)},n.fullScreen=function(){if(!n.isFullScreen){var e=null,t=Hs.getToolbar(n);t&&(e=t.$box);var r=Hs.getTextarea(n).$box.parent();if(e&&e.parent()[0]!==r[0])throw new Error("Can not set full screen, cause toolbar DOM parent is not equal to textarea DOM parent\n不能设置全屏,因为 toolbar DOM 父节点和 textarea DOM 父节点不一致");r.addClass("w-e-full-screen-container");var o=r.css("z-index");r.attr("data-z-index",o.toString()),n.isFullScreen=!0,n.emit("fullScreen");}},n.unFullScreen=function(){if(n.isFullScreen){var e=Hs.getTextarea(n).$box.parent();setTimeout((function(){e.removeClass("w-e-full-screen-container"),n.isFullScreen=!1,n.emit("unFullScreen");}),200);}},n.getEditableContainer=function(){return Hs.getTextarea(n).$textAreaContainer[0]},n}(Wc(t.createEditor()))))))));if(r&&function(e,t){return Pc(e,"data-w-e-textarea",t)}(c,r))throw new Error("Repeated create editor by selector '"+r+"'");var f=function(e){void 0===e&&(e={});var t=E.default(zs),n={},r=e.MENU_CONF,o=void 0===r?{}:r;return m.default(t,(function(e,t){n[t]=Ki(Ki({},e),o[t]||{});})),delete e.MENU_CONF,Ki({scroll:!0,readOnly:!1,autoFocus:!0,decorate:function(){return []},maxLength:0,MENU_CONF:n,hoverbarKeys:{},customAlert:function(e,t){window.alert(t+":\n"+e);}},e)}(i);rs.set(c,f);var d=f.hoverbarKeys,p=void 0===d?{}:d;if(u.forEach((function(e){c=e(c);})),null!=s&&(c.children=Rc(c,s)),a&&a.length&&(c.children=a),0===c.children.length&&(c.children=[{type:"paragraph",children:[{text:""}]}]),Hs.normalizeContent(c),r){var h=new dd(r);Ga.set(c,h),Ja.set(h,c),h.changeViewState(),Uu((function(){var e=h.$scroll;if(null!=e&&e.height()<300){console.warn("编辑区域高度 < 300px 这可能会导致 modal hoverbar 定位异常\nTextarea height < 300px . This may be cause modal and hoverbar position error",e);}}));var g=void 0;Object.keys(p).length>0&&(g=new Pd,Qa.set(g,c),Za.set(c,g)),c.on("change",(function(){c.hidePanelOrModal();})),c.on("scroll",(function(){c.hidePanelOrModal();}));}else c.children.forEach((function(e,t){return Rd(e,t,c,c)}));var v=f.onCreated,b=f.onDestroyed;return v&&c.on("created",(function(){return v(c)})),b&&c.on("destroyed",(function(){return b(c)})),Uu((function(){return c.emit("created")})),c},e.coreCreateToolbar=function(e,t){if(null==e)throw new Error("Cannot create toolbar, because editor is null");var n=t.selector,r=t.config,o=void 0===r?{}:r;if(function(e,t){return Pc(e,"data-w-e-toolbar",t)}(e,n))throw new Error("Repeated create toolbar by selector '"+n+"'");var i=Ki({toolbarKeys:[],excludeKeys:[],insertKeys:{index:0,keys:[]},modalAppendToBody:!1},o||{}),a=new Bd(n,i);return Ya.set(a,e),Xa.set(e,a),a},e.createUploader=function(e){var t=e.server,n=void 0===t?"":t,r=e.fieldName,o=void 0===r?"":r,i=e.maxFileSize,a=void 0===i?10485760:i,s=e.maxNumberOfFiles,l=void 0===s?100:s,u=e.meta,c=void 0===u?{}:u,f=e.metaWithUrl,d=void 0!==f&&f,p=e.headers,h=void 0===p?{}:p,g=e.withCredentials,v=void 0!==g&&g,y=e.timeout,b=void 0===y?1e4:y,w=e.onBeforeUpload,x=void 0===w?function(e){return e}:w,E=e.onSuccess,O=void 0===E?function(e,t){}:E,C=e.onError,T=void 0===C?function(e,t,n){console.error(e.name+" upload error",t,n);}:C,N=e.onProgress,M=void 0===N?function(e){}:N;if(!n)throw new Error("Cannot get upload server address\n没有配置上传地址");if(!o)throw new Error("Cannot get fieldName\n没有配置 fieldName");var L=n;d&&(L=function(e,t){var n=Gi(e.split("#"),2),r=n[0],o=n[1],i=[];m.default(t,(function(e,t){i.push(t+"="+e);}));var a=i.join("&");return r=r.indexOf("?")>0?r+"&"+a:r+"?"+a,o?r+"#"+o:r}(L,c));var P=new S.default({onBeforeUpload:x,restrictions:{maxFileSize:a,maxNumberOfFiles:l},meta:c}).use(k.default,{endpoint:L,headers:h,formData:!0,fieldName:o,bundle:!0,withCredentials:v,timeout:b});return P.on("upload-success",(function(e,t){var n=t.body,r=void 0===n?{}:n;try{O(e,r);}catch(e){console.error("wangEditor upload file - onSuccess error",e);}P.removeFile(e.id);})),P.on("progress",(function(e){e<1||M(e);})),P.on("upload-error",(function(e,t,n){try{T(e,t,n);}catch(e){console.error("wangEditor upload file - onError error",e);}P.removeFile(e.id);})),P.on("restriction-failed",(function(e,t){try{T(e,t);}catch(e){console.error("wangEditor upload file - onError error",e);}P.removeFile(e.id);})),P},e.genModalButtonElems=function(e,t){var n=y.default('
    '),r=y.default('");return n.append(r),[n[0],r[0]]},e.genModalInputElems=function(e,t,n){var r=y.default('');r.append(""+e+"");var o=y.default('');return r.append(o),[r[0],o[0]]},e.genModalTextareaElems=function(e,t,n){var r=y.default('');r.append(""+e+"");var o=y.default('');return r.append(o),[r[0],o[0]]},e.i18nAddResources=function(e,t){zp.addResourceBundle(e,Up,t,!0,!0);},e.i18nChangeLanguage=function(e){zp.changeLanguage(e);},e.i18nGetResources=function(e){return zp.getResourceBundle(e,Up)},e.registerElemToHtmlConf=function(e){var t=e.type,n=e.elemToHtml;ol[t||""]=n;},e.registerMenu=function(e,t){var n=e.key,r=e.factory,o=e.config,i=Ki(Ki({},o),t||{});if(null!=Us[n])throw new Error("Duplicated key '"+n+"' in menu items");Us[n]=r,function(e,t){null!=t&&(zs[e]=t);}(n,i);},e.registerParseElemHtmlConf=function(e){var t=e.selector,n=e.parseElemHtml;Zu[t]=n;},e.registerParseStyleHtmlHandler=function(e){Qu.push(e);},e.registerPreParseHtmlConf=function(e){Xu.push(e);},e.registerRenderElemConf=function(e){var t=e.type,n=e.renderElem;Ff[t||""]=n;},e.registerStyleHandler=function(e){_f.push(e);},e.registerStyleToHtmlHandler=function(e){rl.push(e);},e.t=Kp,Object.defineProperty(e,"__esModule",{value:!0});})); + var zi=function(e,t){return zi=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t;}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);},zi(e,t)};function Ui(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e;}zi(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n);}var Ki=function(){return Ki=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Gi(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value);}catch(e){o={error:e};}finally{try{r&&!r.done&&(n=i.return)&&n.call(i);}finally{if(o)throw o.error}}return a}function Ji(e,t){for(var n=0,r=t.length,o=e.length;n=t.length?(e.target=void 0,{value:void 0,done:!0}):"keys"==n?{value:r,done:!1}:"values"==n?{value:t[r],done:!1}:{value:[r,t[r]],done:!1}}),"values");jr.Arguments=jr.Array,wr("keys"),wr("values"),wr("entries");var na=function(e,t,n){for(var r in t)gt(e,r,t[r],n);return e},ra=P.Array,oa=Math.max,ia=function(e,t,n){for(var r=It(e),o=gn(t,r),i=gn(void 0===n?r:n,r),a=ra(oa(i-o,0)),s=0;oi;i++)if((s=v(e[i]))&&Ne(va,s))return s;return new ga(!1)}r=Hr(e,o);}for(l=r.next;!(u=Te(l,r)).done;){try{s=v(u.value);}catch(e){Rr(r,"throw",e);}if("object"==typeof s&&s&&Ne(va,s))return s}return new ga(!1)},ma=P.TypeError,ba=function(e,t){if(Ne(t,e))return e;throw ma("Incorrect invocation")},wa=function(e,t,n){var r,o;return xo&&Q(r=t.constructor)&&r!==n&&me(o=r.prototype)&&o!==n.prototype&&xo(e,o),e},xa=function(e,t,n){var r=-1!==e.indexOf("Map"),o=-1!==e.indexOf("Weak"),i=r?"set":"add",a=P[e],s=a&&a.prototype,l=a,u={},c=function(e){var t=W(s[e]);gt(s,e,"add"==e?function(e){return t(this,0===e?0:e),this}:"delete"==e?function(e){return !(o&&!me(e))&&t(this,0===e?0:e)}:"get"==e?function(e){return o&&!me(e)?void 0:t(this,0===e?0:e)}:"has"==e?function(e){return !(o&&!me(e))&&t(this,0===e?0:e)}:function(e,n){return t(this,0===e?0:e,n),this});};if(jn(e,!Q(a)||!(o||s.forEach&&!se((function(){(new a).entries().next();})))))l=n.getConstructor(t,e,r,i),pa.enable();else if(jn(e,!0)){var f=new l,d=f[i](o?{}:-0,1)!=f,p=se((function(){f.has(1);})),h=Gr((function(e){new a(e);})),g=!o&&se((function(){for(var e=new a,t=5;t--;)e[i](t,t);return !e.has(-0)}));h||((l=t((function(e,t){ba(e,s);var n=wa(new a,e,l);return null!=t&&ya(t,n[i],{that:n,AS_ENTRIES:r}),n}))).prototype=s,s.constructor=l),(p||g)&&(c("delete"),c("has"),r&&c("get")),(g||d)&&c(i),o&&s.clear&&delete s.clear;}return u[e]=l,_n({global:!0,forced:l!=a},u),vo(l,e),o||n.setStrong(l,e,r),l},Ea=pa.getWeakData,Sa=ct.set,ka=ct.getterFor,Oa=Zt.find,Ca=Zt.findIndex,Ta=W([].splice),Na=0,Ma=function(e){return e.frozen||(e.frozen=new La)},La=function(){this.entries=[];},Pa=function(e,t){return Oa(e.entries,(function(e){return e[0]===t}))};La.prototype={get:function(e){var t=Pa(this,e);if(t)return t[1]},has:function(e){return !!Pa(this,e)},set:function(e,t){var n=Pa(this,e);n?n[1]=t:this.entries.push([e,t]);},delete:function(e){var t=Ca(this.entries,(function(t){return t[0]===e}));return ~t&&Ta(this.entries,t,1),!!~t}};var Ra,Da={getConstructor:function(e,t,n,r){var o=e((function(e,o){ba(e,i),Sa(e,{type:t,id:Na++,frozen:void 0}),null!=o&&ya(o,e[r],{that:e,AS_ENTRIES:n});})),i=o.prototype,a=ka(t),s=function(e,t,n){var r=a(e),o=Ea(Oe(t),!0);return !0===o?Ma(r).set(t,n):o[r.id]=n,e};return na(i,{delete:function(e){var t=a(this);if(!me(e))return !1;var n=Ea(e);return !0===n?Ma(t).delete(e):n&&q(n,t.id)&&delete n[t.id]},has:function(e){var t=a(this);if(!me(e))return !1;var n=Ea(e);return !0===n?Ma(t).has(e):n&&q(n,t.id)}}),na(i,n?{get:function(e){var t=a(this);if(me(e)){var n=Ea(e);return !0===n?Ma(t).get(e):n?n[t.id]:void 0}},set:function(e,t){return s(this,e,t)}}:{add:function(e){return s(this,e,!0)}}),o}},ja=ct.enforce,Aa=!P.ActiveXObject&&"ActiveXObject"in P,_a=function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}},Fa=xa("WeakMap",_a,Da);if(Qe&&Aa){Ra=Da.getConstructor(_a,"WeakMap",!0),pa.enable();var Ia=Fa.prototype,Ba=W(Ia.delete),$a=W(Ia.has),Wa=W(Ia.get),Ha=W(Ia.set);na(Ia,{delete:function(e){if(me(e)&&!fa(e)){var t=ja(this);return t.frozen||(t.frozen=new Ra),Ba(this,e)||t.frozen.delete(e)}return Ba(this,e)},has:function(e){if(me(e)&&!fa(e)){var t=ja(this);return t.frozen||(t.frozen=new Ra),$a(this,e)||t.frozen.has(e)}return $a(this,e)},get:function(e){if(me(e)&&!fa(e)){var t=ja(this);return t.frozen||(t.frozen=new Ra),$a(this,e)?Wa(this,e):t.frozen.get(e)}return Wa(this,e)},set:function(e,t){if(me(e)&&!fa(e)){var n=ja(this);n.frozen||(n.frozen=new Ra),$a(this,e)?Ha(this,e,t):n.frozen.set(e,t);}else Ha(this,e,t);return this}});}var Va=he("iterator"),za=he("toStringTag"),Ua=ta.values,Ka=function(e,t){if(e){if(e[Va]!==Ua)try{Ue(e,Va,Ua);}catch(t){e[Va]=Ua;}if(e[za]||Ue(e,za,t),kt[t])for(var n in ta)if(e[n]!==ta[n])try{Ue(e,n,ta[n]);}catch(t){e[n]=ta[n];}}};for(var qa in kt)Ka(P[qa]&&P[qa].prototype,qa);Ka(Tt,"DOMTokenList");var Ga=new WeakMap,Ja=new WeakMap,Ya=new WeakMap,Xa=new WeakMap,Qa=new WeakMap,Za=new WeakMap,es=new WeakMap,ts=new WeakMap,ns=new WeakMap,rs=new WeakMap,os=new WeakMap,is=new WeakMap,as=new WeakMap,ss=new WeakMap,ls=new WeakMap,us=new WeakMap,cs=new WeakMap,fs=new WeakMap,ds=new WeakMap,ps=new WeakMap,hs=new WeakMap,gs=new WeakMap,vs=new WeakMap,ys=new WeakMap,ms=new WeakMap,bs=Zt.find,ws="find",xs=!0;ws in[]&&Array(1).find((function(){xs=!1;})),_n({target:"Array",proto:!0,forced:xs},{find:function(e){return bs(this,e,arguments.length>1?arguments[1]:void 0)}}),wr(ws),_n({global:!0},{globalThis:P});const Es=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","isindex","keygen","link","menuitem","meta","nextid","param","source","track","wbr"];r.css&&(y.default.fn.css=r.css),r.append&&(y.default.fn.append=r.append),r.addClass&&(y.default.fn.addClass=r.addClass),r.removeClass&&(y.default.fn.removeClass=r.removeClass),r.hasClass&&(y.default.fn.hasClass=r.hasClass),r.on&&(y.default.fn.on=r.on),r.focus&&(y.default.fn.focus=r.focus),r.attr&&(y.default.fn.attr=r.attr),r.removeAttr&&(y.default.fn.removeAttr=r.removeAttr),r.hide&&(y.default.fn.hide=r.hide),r.show&&(y.default.fn.show=r.show),r.offset&&(y.default.fn.offset=r.offset),r.width&&(y.default.fn.width=r.width),r.height&&(y.default.fn.height=r.height),r.parent&&(y.default.fn.parent=r.parent),r.parents&&(y.default.fn.parents=r.parents),r.is&&(y.default.fn.is=r.is),r.dataset&&(y.default.fn.dataset=r.dataset),r.val&&(y.default.fn.val=r.val),r.text&&(y.default.fn.text=r.text),r.html&&(y.default.fn.html=r.html),r.children&&(y.default.fn.children=r.children),r.remove&&(y.default.fn.remove=r.remove),r.find&&(y.default.fn.find=r.find),r.each&&(y.default.fn.each=r.each),r.empty&&(y.default.fn.empty=r.empty);var Ss,ks=function(e){return e&&e.ownerDocument&&e.ownerDocument.defaultView||null},Os=function(e){return Cs(e)&&1===e.nodeType},Cs=function(e){var t=ks(e);return !!t&&e instanceof t.Node},Ts=function(e){var t=e&&e.anchorNode&&ks(e.anchorNode);return !!t&&e instanceof t.Selection},Ns=function(e){return Cs(e)&&3===e.nodeType},Ms=function(e){var t,n,r;return null!==(t=window.document.getElementById(e))&&void 0!==t?t:(null===(r=null===(n=window.document.activeElement)||void 0===n?void 0:n.shadowRoot)||void 0===r?void 0:r.getElementById(e))||null},Ls=function(e,t,n){for(var r,o=e.childNodes,i=o[t],a=t,s=!1,l=!1;(Cs(r=i)&&8===r.nodeType||Os(i)&&0===i.childNodes.length||Os(i)&&"false"===i.getAttribute("contenteditable"))&&(!s||!l);)a>=o.length?(s=!0,a=t-1,n="backward"):a<0?(l=!0,a=t+1,n="forward"):(i=o[a],t=a,a+="forward"===n?1:-1);return [i,t]},Ps=function(e,t,n){return Gi(Ls(e,t,n),1)[0]},Rs=function e(t){var n,r,o="";if(Ns(t)&&t.nodeValue)return t.nodeValue;if(Os(t)){try{for(var i=qi(Array.from(t.childNodes)),a=i.next();!a.done;a=i.next()){o+=e(a.value);}}catch(e){n={error:e};}finally{try{a&&!a.done&&(r=i.return)&&r.call(i);}finally{if(n)throw n.error}}var s=getComputedStyle(t).getPropertyValue("display");"block"!==s&&"list"!==s&&"table-row"!==s&&"BR"!==t.tagName||(o+="\n");}return o};function Ds(e,t){if(!(e instanceof HTMLElement&&"true"===e.dataset.slateVoid))for(var n=e.childNodes,r=n.length;r--;){var o=n[r],i=o.nodeType;3==i?t(o,e):1!=i&&9!=i&&11!=i||Ds(o,t);}}function js(e){if(0===e.length)return "";var t=e[0];return t.nodeType!==Ss.ELEMENT_NODE?"":t.tagName.toLowerCase()}!function(e){e[e.ELEMENT_NODE=1]="ELEMENT_NODE",e[e.TEXT_NODE=3]="TEXT_NODE",e[e.CDATA_SECTION_NODE=4]="CDATA_SECTION_NODE",e[e.PROCESSING_INSTRUCTION_NODE=7]="PROCESSING_INSTRUCTION_NODE",e[e.COMMENT_NODE=8]="COMMENT_NODE",e[e.DOCUMENT_NODE=9]="DOCUMENT_NODE",e[e.DOCUMENT_TYPE_NODE=10]="DOCUMENT_TYPE_NODE",e[e.DOCUMENT_FRAGMENT_NODE=11]="DOCUMENT_FRAGMENT_NODE";}(Ss||(Ss={})),void 0!==globalThis.navigator&&void 0!==globalThis.window&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&globalThis.window.MSStream;var As="undefined"!=typeof navigator&&/Mac OS X/.test(navigator.userAgent),_s="undefined"!=typeof navigator&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent);"undefined"!=typeof navigator&&/^(?!.*Seamonkey)(?=.*Firefox\/(?:[0-7][0-9]|[0-8][0-6])(?:\.)).*/i.test(navigator.userAgent);var Fs="undefined"!=typeof navigator&&/Version\/[\d\.]+.*Safari/.test(navigator.userAgent),Is="undefined"!=typeof navigator&&/Edge?\/(?:[0-6][0-9]|[0-7][0-8])(?:\.)/i.test(navigator.userAgent),Bs="undefined"!=typeof navigator&&/Chrome?\/(?:[0-7][0-5]|[0-6][0-9])(?:\.)/i.test(navigator.userAgent),$s="undefined"!=typeof navigator&&/Chrome/i.test(navigator.userAgent);"undefined"!=typeof navigator&&/.*QQBrowser/.test(navigator.userAgent);var Ws=!Bs&&!Is&&"undefined"!=typeof globalThis&&globalThis.InputEvent&&"function"==typeof globalThis.InputEvent.prototype.getTargetRanges,Hs={getWindow:function(e){var t=hs.get(e);if(!t)throw new Error("Unable to find a host window element for this editor");return t},findKey:function(e,t){var n=ps.get(t);return n||(n=new Xi,ps.set(t,n)),n},setNewKey:function(e){var t=new Xi;ps.set(e,t);},findPath:function(e,n){for(var r=[],o=n;;){var i=ls.get(o);if(null==i){if(t.Editor.isEditor(o))return r;break}var a=ss.get(o);if(null==a)break;r.unshift(a),o=i;}throw new Error("Unable to find the path for Slate node: "+JSON.stringify(n))},findDocumentOrShadowRoot:function(e){if(e.isDestroyed)return window.document;var t=Hs.toDOMNode(e,e),n=t.getRootNode();return (n instanceof Document||n instanceof ShadowRoot)&&null!=n.getSelection?n:t.ownerDocument},getParentNode:function(e,t){return ls.get(t)||null},getParentsNodes:function(e,t){for(var n=[],r=t;r!==e&&null!=r;){var o=Hs.getParentNode(e,r);if(null==o)break;n.push(o),r=o;}return n},getTopNode:function(e,n){var r=[Hs.findPath(e,n)[0]];return t.Node.get(e,r)},toDOMNode:function(e,n){var r;if(t.Editor.isEditor(n))r=us.get(e);else {var o=Hs.findKey(e,n);r=fs.get(o);}if(!r)throw new Error("Cannot resolve a DOM node from Slate node: "+JSON.stringify(n));return r},hasDOMNode:function(e,t,n){void 0===n&&(n={});var r,o=n.editable,i=void 0!==o&&o,a=Hs.toDOMNode(e,e);try{r=Os(t)?t:t.parentElement;}catch(e){if(!e.message.includes('Permission denied to access property "nodeType"'))throw e}return !!r&&(r.closest("[data-slate-editor]")===a&&(!i||r.isContentEditable||!!r.getAttribute("data-slate-zero-width")))},toDOMRange:function(e,n){var r=n.anchor,o=n.focus,i=t.Range.isBackward(n),a=Hs.toDOMPoint(e,r),s=t.Range.isCollapsed(n)?a:Hs.toDOMPoint(e,o),l=Hs.getWindow(e).document.createRange(),u=Gi(i?s:a,2),c=u[0],f=u[1],d=Gi(i?a:s,2),p=d[0],h=d[1],g=!!(Os(c)?c:c.parentElement).getAttribute("data-slate-zero-width"),v=!!(Os(p)?p:p.parentElement).getAttribute("data-slate-zero-width");return l.setStart(c,g?1:f),l.setEnd(p,v?1:h),l},toDOMPoint:function(e,n){var r,o,i,a=Gi(t.Editor.node(e,n.path),1)[0],s=Hs.toDOMNode(e,a);t.Editor.void(e,{at:n})&&(n={path:n.path,offset:0});var l=Array.from(s.querySelectorAll("[data-slate-string], [data-slate-zero-width]")),u=0;try{for(var c=qi(l),f=c.next();!f.done;f=c.next()){var d=f.value,p=d.childNodes[0];if(null!=p&&null!=p.textContent){var h=p.textContent.length,g=d.getAttribute("data-slate-length"),v=u+(null==g?h:parseInt(g,10));if(n.offset<=v){i=[p,Math.min(h,Math.max(0,n.offset-u))];break}u=v;}}}catch(e){r={error:e};}finally{try{f&&!f.done&&(o=c.return)&&o.call(c);}finally{if(r)throw r.error}}if(!i)throw new Error("Cannot resolve a DOM point from Slate point: "+JSON.stringify(n));return i},toSlateNode:function(e,t){var n=Os(t)?t:t.parentElement;n&&!n.hasAttribute("data-slate-node")&&(n=n.closest("[data-slate-node]"));var r=n?cs.get(n):null;if(!r)throw new Error("Cannot resolve a Slate node from DOM node: "+n);return r},findEventRange:function(e,n){"nativeEvent"in n&&(n=n.nativeEvent);var r=n.clientX,o=n.clientY,i=n.target;if(null==r||null==o)throw new Error("Cannot resolve a Slate range from a DOM event: "+n);var a,s=Hs.toSlateNode(e,n.target),l=Hs.findPath(e,s);if(t.Editor.isVoid(e,s)){var u=i.getBoundingClientRect(),c=e.isInline(s)?r-u.left0},isSelectedEmptyParagraph:function(e){var n=e.selection;if(null==n)return !1;if(t.Range.isExpanded(n))return !1;var r=Hs.getSelectedNodeByType(e,"paragraph");if(null===r)return !1;var o=r.children;return 1===o.length&&(""===o[0].text||void 0)},isEmptyPath:function(e,n){var r=t.Editor.node(e,n);if(null==r)return !1;var o=Gi(r,1)[0].children;if(1===o.length&&""===o[0].text)return !0;return !1}},Vs=1,zs={};var Us={};var Ks=Zt.filter,qs=qo("filter");_n({target:"Array",proto:!0,forced:!qs},{filter:function(e){return Ks(this,e,arguments.length>1?arguments[1]:void 0)}});var Gs="\t\n\v\f\r                 \u2028\u2029\ufeff",Js=W("".replace),Ys="["+Gs+"]",Xs=RegExp("^"+Ys+Ys+"*"),Qs=RegExp(Ys+Ys+"*$"),Zs=function(e){return function(t){var n=er(V(t));return 1&e&&(n=Js(n,Xs,"")),2&e&&(n=Js(n,Qs,"")),n}},el={start:Zs(1),end:Zs(2),trim:Zs(3)},tl=ht.PROPER,nl=el.trim;_n({target:"String",proto:!0,forced:function(e){return se((function(){return !!Gs[e]()||"​…᠎"!=="​…᠎"[e]()||tl&&Gs[e].name!==e}))}("trim")},{trim:function(){return nl(this)}});var rl=[];var ol={};function il(e,t,n){var r=n.isInline(e)?"span":"div";return "<"+r+">"+t+""}function al(e,n){var r=e.type,o=void 0===r?"":r,i=e.children,a=void 0===i?[]:i,s=t.Editor.isVoid(n,e),l="";s||(l=a.map((function(e){return Ku(e,n)})).join(""));var u=function(e){return ol[e]||il}(o),c=u(e,l,n),f="";if(f="string"==typeof c?c:c.html||"",s||rl.forEach((function(t){return f=t(e,f)})),"string"==typeof c)return f;var d=c.prefix,p=void 0===d?"":d,h=c.suffix,g=void 0===h?"":h;return p&&(f=p+f),g&&(f+=g),f}var sl,ll,ul,cl,fl=P.Promise,dl=he("species"),pl=function(e){var t=ee(e),n=Ve.f;ye&&t&&!t[dl]&&n(t,dl,{configurable:!0,get:function(){return this}});},hl=P.TypeError,gl=he("species"),vl=function(e,t){var n,r=Oe(e).constructor;return void 0===r||null==(n=Oe(r)[gl])?t:function(e){if(qt(e))return e;throw hl(Re(e)+" is not a constructor")}(n)},yl=W([].slice),ml=/(?:ipad|iphone|ipod).*applewebkit/i.test(te),bl="process"==mt(P.process),wl=P.setImmediate,xl=P.clearImmediate,El=P.process,Sl=P.Dispatch,kl=P.Function,Ol=P.MessageChannel,Cl=P.String,Tl=0,Nl={},Ml="onreadystatechange";try{sl=P.location;}catch(e){}var Ll=function(e){if(q(Nl,e)){var t=Nl[e];delete Nl[e],t();}},Pl=function(e){return function(){Ll(e);}},Rl=function(e){Ll(e.data);},Dl=function(e){P.postMessage(Cl(e),sl.protocol+"//"+sl.host);};wl&&xl||(wl=function(e){var t=yl(arguments,1);return Nl[++Tl]=function(){wi(Q(e)?e:kl(e),void 0,t);},ll(Tl),Tl},xl=function(e){delete Nl[e];},bl?ll=function(e){El.nextTick(Pl(e));}:Sl&&Sl.now?ll=function(e){Sl.now(Pl(e));}:Ol&&!ml?(cl=(ul=new Ol).port2,ul.port1.onmessage=Rl,ll=Mt(cl.postMessage,cl)):P.addEventListener&&Q(P.postMessage)&&!P.importScripts&&sl&&"file:"!==sl.protocol&&!se(Dl)?(ll=Dl,P.addEventListener("message",Rl,!1)):ll=Ml in xe("script")?function(e){fr.appendChild(xe("script")).onreadystatechange=function(){fr.removeChild(this),Ll(e);};}:function(e){setTimeout(Pl(e),0);});var jl,Al,_l,Fl,Il,Bl,$l,Wl,Hl={set:wl,clear:xl},Vl=/ipad|iphone|ipod/i.test(te)&&void 0!==P.Pebble,zl=/web0s(?!.*chrome)/i.test(te),Ul=dn.f,Kl=Hl.set,ql=P.MutationObserver||P.WebKitMutationObserver,Gl=P.document,Jl=P.process,Yl=P.Promise,Xl=Ul(P,"queueMicrotask"),Ql=Xl&&Xl.value;Ql||(jl=function(){var e,t;for(bl&&(e=Jl.domain)&&e.exit();Al;){t=Al.fn,Al=Al.next;try{t();}catch(e){throw Al?Fl():_l=void 0,e}}_l=void 0,e&&e.enter();},ml||bl||zl||!ql||!Gl?!Vl&&Yl&&Yl.resolve?(($l=Yl.resolve(void 0)).constructor=Yl,Wl=Mt($l.then,$l),Fl=function(){Wl(jl);}):bl?Fl=function(){Jl.nextTick(jl);}:(Kl=Mt(Kl,P),Fl=function(){Kl(jl);}):(Il=!0,Bl=Gl.createTextNode(""),new ql(jl).observe(Bl,{characterData:!0}),Fl=function(){Bl.data=Il=!Il;}));var Zl,eu,tu,nu,ru=Ql||function(e){var t={fn:e,next:void 0};_l&&(_l.next=t),Al||(Al=t,Fl()),_l=t;},ou=function(e){var t,n;this.promise=new e((function(e,r){if(void 0!==t||void 0!==n)throw TypeError("Bad Promise constructor");t=e,n=r;})),this.resolve=je(t),this.reject=je(n);},iu={f:function(e){return new ou(e)}},au=function(e){try{return {error:!1,value:e()}}catch(e){return {error:!0,value:e}}},su="object"==typeof window,lu=Hl.set,uu=he("species"),cu="Promise",fu=ct.getterFor(cu),du=ct.set,pu=ct.getterFor(cu),hu=fl&&fl.prototype,gu=fl,vu=hu,yu=P.TypeError,mu=P.document,bu=P.process,wu=iu.f,xu=wu,Eu=!!(mu&&mu.createEvent&&P.dispatchEvent),Su=Q(P.PromiseRejectionEvent),ku="unhandledrejection",Ou=!1,Cu=jn(cu,(function(){var e=Ye(gu),t=e!==String(gu);if(!t&&66===ae)return !0;if(ae>=51&&/native code/.test(e))return !1;var n=new gu((function(e){e(1);})),r=function(e){e((function(){}),(function(){}));};return (n.constructor={})[uu]=r,!(Ou=n.then((function(){}))instanceof r)||!t&&su&&!Su})),Tu=Cu||!Gr((function(e){gu.all(e).catch((function(){}));})),Nu=function(e){var t;return !(!me(e)||!Q(t=e.then))&&t},Mu=function(e,t){if(!e.notified){e.notified=!0;var n=e.reactions;ru((function(){for(var r=e.value,o=1==e.state,i=0;n.length>i;){var a,s,l,u=n[i++],c=o?u.ok:u.fail,f=u.resolve,d=u.reject,p=u.domain;try{c?(o||(2===e.rejection&&Du(e),e.rejection=1),!0===c?a=r:(p&&p.enter(),a=c(r),p&&(p.exit(),l=!0)),a===u.promise?d(yu("Promise-chain cycle")):(s=Nu(a))?Te(s,a,f,d):f(a)):d(r);}catch(e){p&&!l&&p.exit(),d(e);}}e.reactions=[],e.notified=!1,t&&!e.rejection&&Pu(e);}));}},Lu=function(e,t,n){var r,o;Eu?((r=mu.createEvent("Event")).promise=t,r.reason=n,r.initEvent(e,!1,!0),P.dispatchEvent(r)):r={promise:t,reason:n},!Su&&(o=P["on"+e])?o(r):e===ku&&function(e,t){var n=P.console;n&&n.error&&(1==arguments.length?n.error(e):n.error(e,t));}("Unhandled promise rejection",n);},Pu=function(e){Te(lu,P,(function(){var t,n=e.facade,r=e.value;if(Ru(e)&&(t=au((function(){bl?bu.emit("unhandledRejection",r,n):Lu(ku,n,r);})),e.rejection=bl||Ru(e)?2:1,t.error))throw t.value}));},Ru=function(e){return 1!==e.rejection&&!e.parent},Du=function(e){Te(lu,P,(function(){var t=e.facade;bl?bu.emit("rejectionHandled",t):Lu("rejectionhandled",t,e.value);}));},ju=function(e,t,n){return function(r){e(t,r,n);}},Au=function(e,t,n){e.done||(e.done=!0,n&&(e=n),e.value=t,e.state=2,Mu(e,!0));},_u=function(e,t,n){if(!e.done){e.done=!0,n&&(e=n);try{if(e.facade===t)throw yu("Promise can't be resolved itself");var r=Nu(t);r?ru((function(){var n={done:!1};try{Te(r,t,ju(_u,n,e),ju(Au,n,e));}catch(t){Au(n,t,e);}})):(e.value=t,e.state=1,Mu(e,!1));}catch(t){Au({done:!1},t,e);}}};if(Cu&&(vu=(gu=function(e){ba(this,vu),je(e),Te(Zl,this);var t=fu(this);try{e(ju(_u,t),ju(Au,t));}catch(e){Au(t,e);}}).prototype,(Zl=function(e){du(this,{type:cu,done:!1,notified:!1,parent:!1,reactions:[],rejection:!1,state:0,value:void 0});}).prototype=na(vu,{then:function(e,t){var n=pu(this),r=n.reactions,o=wu(vl(this,gu));return o.ok=!Q(e)||e,o.fail=Q(t)&&t,o.domain=bl?bu.domain:void 0,n.parent=!0,r[r.length]=o,0!=n.state&&Mu(n,!1),o.promise},catch:function(e){return this.then(void 0,e)}}),eu=function(){var e=new Zl,t=fu(e);this.promise=e,this.resolve=ju(_u,t),this.reject=ju(Au,t);},iu.f=wu=function(e){return e===gu||e===tu?new eu(e):xu(e)},Q(fl)&&hu!==Object.prototype)){nu=hu.then,Ou||(gt(hu,"then",(function(e,t){var n=this;return new gu((function(e,t){Te(nu,n,e,t);})).then(e,t)}),{unsafe:!0}),gt(hu,"catch",vu.catch,{unsafe:!0}));try{delete hu.constructor;}catch(e){}xo&&xo(hu,vu);}_n({global:!0,wrap:!0,forced:Cu},{Promise:gu}),vo(gu,cu,!1),pl(cu),tu=ee(cu),_n({target:cu,stat:!0,forced:Cu},{reject:function(e){var t=wu(this);return Te(t.reject,void 0,e),t.promise}}),_n({target:cu,stat:!0,forced:Cu},{resolve:function(e){return function(e,t){if(Oe(e),me(t)&&t.constructor===e)return t;var n=iu.f(e);return (0, n.resolve)(t),n.promise}(this,e)}}),_n({target:cu,stat:!0,forced:Tu},{all:function(e){var t=this,n=wu(t),r=n.resolve,o=n.reject,i=au((function(){var n=je(t.resolve),i=[],a=0,s=1;ya(e,(function(e){var l=a++,u=!1;s++,Te(n,t,e).then((function(e){u||(u=!0,i[l]=e,--s||r(i));}),o);})),--s||r(i);}));return i.error&&o(i.value),n.promise},race:function(e){var t=this,n=wu(t),r=n.reject,o=au((function(){var o=je(t.resolve);ya(e,(function(e){Te(o,t,e).then(n.resolve,r);}));}));return o.error&&r(o.value),n.promise}});var Fu=Zo.UNSUPPORTED_Y,Iu=4294967295,Bu=Math.min,$u=[].push,Wu=W(/./.exec),Hu=W($u),Vu=W("".slice),zu=!se((function(){var e=/(?:)/,t=e.exec;e.exec=function(){return t.apply(this,arguments)};var n="ab".split(e);return 2!==n.length||"a"!==n[0]||"b"!==n[1]}));function Uu(e){Promise.resolve().then(e);}function Ku(e,n){return t.Element.isElement(e)?al(e,n):function(e,t){var n=e.text;if(null==n)throw new Error("Current node is not slate Text "+JSON.stringify(e));var r=n;r=function(e){return e.replace(/ {2}/g,"  ").replace(//g,">").replace(/®/g,"®").replace(/©/g,"©").replace(/™/g,"™")}(r);var o=Hs.getParentsNodes(t,e).some((function(e){return "pre"===Hs.getNodeType(e)}));if(o||(r=r.replace(/\r\n|\r|\n/g,"
    ")),o&&(r=r.replace(/ /g," ")),""===r){var i=Hs.getParentNode(null,e);if(!i||0!==i.children.length)return r;r="
    ";}return rl.forEach((function(t){return r=t(e,r)})),r}(e,n)}function qu(e){return "w-e-element-"+e}Si("split",(function(e,t,n){var r;return r="c"=="abbc".split(/(b)*/)[1]||4!="test".split(/(?:)/,-1).length||2!="ab".split(/(?:ab)*/).length||4!=".".split(/(.?)(.?)/).length||".".split(/()()/).length>1||"".split(/.?/).length?function(e,n){var r=er(V(this)),o=void 0===n?Iu:n>>>0;if(0===o)return [];if(void 0===e)return [r];if(!Sr(e))return Te(t,r,e,o);for(var i,a,s,l=[],u=(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.unicode?"u":"")+(e.sticky?"y":""),c=0,f=new RegExp(e.source,u+"g");(i=Te(gi,f,r))&&!((a=f.lastIndex)>c&&(Hu(l,Vu(r,c,i.index)),i.length>1&&i.index=o));)f.lastIndex===i.index&&f.lastIndex++;return c===r.length?!s&&Wu(f,"")||Hu(l,""):Hu(l,Vu(r,c)),l.length>o?ia(l,0,o):l}:"0".split(void 0,0).length?function(e,n){return void 0===e&&0===n?[]:Te(t,this,e,n)}:t,[function(t,n){var o=V(this),i=null==t?void 0:Ae(t,e);return i?Te(i,t,o,n):Te(r,er(o),t,n)},function(e,o){var i=Oe(this),a=er(e),s=n(r,i,a,o,r!==t);if(s.done)return s.value;var l=vl(i,RegExp),u=i.unicode,c=(i.ignoreCase?"i":"")+(i.multiline?"m":"")+(i.unicode?"u":"")+(Fu?"g":"y"),f=new l(Fu?"^(?:"+i.source+")":i,c),d=void 0===o?Iu:o>>>0;if(0===d)return [];if(0===a.length)return null===ji(f,a)?[a]:[];for(var p=0,h=0,g=[];h=n},Ju=function(e,t,n){var r=Hs.toDOMRange(e,t).getBoundingClientRect(),o=Hs.toDOMRange(e,n).getBoundingClientRect();return Gu(r,o)&&Gu(o,r)},Yu=["span","b","strong","i","em","s","strike","u","font","sub","sup"],Xu=[];var Qu=[];var Zu={};var ec=Ve.f,tc=Sn.f,nc=ct.enforce,rc=he("match"),oc=P.RegExp,ic=oc.prototype,ac=P.SyntaxError,sc=W(tr),lc=W(ic.exec),uc=W("".charAt),cc=W("".replace),fc=W("".indexOf),dc=W("".slice),pc=/^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/,hc=/a/g,gc=/a/g,vc=new oc(hc)!==hc,yc=Zo.MISSED_STICKY,mc=Zo.UNSUPPORTED_Y,bc=ye&&(!vc||yc||ti||ri||se((function(){return gc[rc]=!1,oc(hc)!=hc||oc(gc)==gc||"/a/i"!=oc(hc,"i")})));if(jn("RegExp",bc)){for(var wc=function(e,t){var n,r,o,i,a,s,l=Ne(ic,this),u=Sr(e),c=void 0===t,f=[],d=e;if(!l&&u&&c&&e.constructor===wc)return e;if((u||Ne(ic,e))&&(e=e.source,c&&(t="flags"in d?d.flags:sc(d))),e=void 0===e?"":er(e),t=void 0===t?"":er(t),d=e,ti&&"dotAll"in hc&&(r=!!t&&fc(t,"s")>-1)&&(t=cc(t,/s/g,"")),n=t,yc&&"sticky"in hc&&(o=!!t&&fc(t,"y")>-1)&&mc&&(t=cc(t,/y/g,"")),ri&&(i=function(e){for(var t,n=e.length,r=0,o="",i=[],a={},s=!1,l=!1,u=0,c="";r<=n;r++){if("\\"===(t=uc(e,r)))t+=uc(e,++r);else if("]"===t)s=!1;else if(!s)switch(!0){case"["===t:s=!0;break;case"("===t:lc(pc,dc(e,r+1))&&(r+=2,l=!0),o+=t,u++;continue;case">"===t&&l:if(""===c||q(a,c))throw new ac("Invalid capture group name");a[c]=!0,i[i.length]=[c,u],l=!1,c="";continue}l?c+=t:o+=t;}return [o,i]}(e),e=i[0],f=i[1]),a=wa(oc(e,t),l?this:ic,wc),(r||o||f.length)&&(s=nc(a),r&&(s.dotAll=!0,s.raw=wc(function(e){for(var t,n=e.length,r=0,o="",i=!1;r<=n;r++)"\\"!==(t=uc(e,r))?i||"."!==t?("["===t?i=!0:"]"===t&&(i=!1),o+=t):o+="[\\s\\S]":o+=t+uc(e,++r);return o}(e),n)),o&&(s.sticky=!0),f.length&&(s.groups=f)),e!==d)try{Ue(a,"source",""===d?"(?:)":d);}catch(e){}return a},xc=function(e){e in wc||ec(wc,e,{configurable:!0,get:function(){return oc[e]},set:function(t){oc[e]=t;}});},Ec=tc(oc),Sc=0;Ec.length>Sc;)xc(Ec[Sc++]);ic.constructor=wc,wc.prototype=ic,gt(P,"RegExp",wc);}pl("RegExp");var kc=new RegExp(String.fromCharCode(160),"g");function Oc(e){return e.replace(kc," ")}function Cc(e,n){var r=e.length;if(r){var o=e[r-1];if(t.Text.isText(o)){var i=Object.keys(o);if(1===i.length&&"text"===i[0])return o.text=o.text+n,!0}}return !1}function Tc(e,t,n){return {type:"paragraph",children:[{text:y.default(e).text().replace(/\s+/gm," ")}]}}function Nc(e,n){var r=function(e,t){var n=[];if(null!=e.attr("data-w-e-is-void"))return n;var r=e[0].childNodes;return 1===r.length&&"BR"===r[0].nodeName?(n.push({text:""}),n):(r.forEach((function(e){if(e.nodeType!==Ss.ELEMENT_NODE)if(e.nodeType!==Ss.TEXT_NODE);else {var r=e.textContent||"";if(""===r.trim()&&r.indexOf("\n")>=0)return;r&&(r=Oc(r),Cc(n,r)||n.push({text:r}));}else {if("BR"===e.nodeName)return void(Cc(n,"\n")||n.push({text:"\n"}));var o=Lc(y.default(e),t);Array.isArray(o)?o.forEach((function(e){return n.push(e)})):n.push(o);}})),n)}(e,n),o=function(e){for(var t in Zu)if(e[0].matches(t))return Zu[t];return Tc}(e),i=o(e[0],r,n);return Array.isArray(i)||(i=[i]),i.forEach((function(o){t.Editor.isVoid(n,o)||(0===r.length&&(o.children=[{text:e.text().replace(/\s+/gm," ")}]),Qu.forEach((function(t){o=t(e[0],o,n);})));})),i}function Mc(e,t){0===e.parents("pre").length&&(e[0].innerHTML=e[0].innerHTML.replace(/\s+/gm," ").replace(/
    /g,"\n"));var n=e[0].textContent||"";n=function(e){return e.replace(/ /g," ").replace(/</g,"<").replace(/>/g,">").replace(/®/g,"®").replace(/©/g,"©").replace(/™/g,"™").replace(/"/g,'"')}(n);var r={text:n=Oc(n)};return Qu.forEach((function(n){r=n(e[0],r,t);})),r}function Lc(e,t){Xu.forEach((function(t){var n=t.selector,r=t.preParseHtml;e[0].matches(n)&&(e=y.default(r(e[0])));}));var n=js(e);return "span"===n?e.attr("data-w-e-type")?Nc(e,t):Mc(e,t):"code"===n?"pre"===js(e.parent())?Nc(e,t):Mc(e,t):Yu.includes(n)?Mc(e,t):Nc(e,t)}function Pc(e,t,n){var r=y.default(n);return !!r.attr(t)||(r.attr(t,"true"),e.on("destroyed",(function(){r.removeAttr(t);})),!1)}function Rc(e,t){void 0===t&&(t="");var n=[];""===t&&(t="


    "),0!==t.indexOf("<")&&(t=t.split(/\n/).map((function(e){return "

    "+e+"

    "})).join(""));var r=y.default("
    "+t+"
    ");return Array.from(r.children()).forEach((function(t){var r=Lc(y.default(t),e);Array.isArray(r)?r.forEach((function(e){return n.push(e)})):n.push(r);})),n}var Dc=Ve.f,jc=pa.fastKey,Ac=ct.set,_c=ct.getterFor,Fc={getConstructor:function(e,t,n,r){var o=e((function(e,o){ba(e,i),Ac(e,{type:t,index:yr(null),first:void 0,last:void 0,size:0}),ye||(e.size=0),null!=o&&ya(o,e[r],{that:e,AS_ENTRIES:n});})),i=o.prototype,a=_c(t),s=function(e,t,n){var r,o,i=a(e),s=l(e,t);return s?s.value=n:(i.last=s={index:o=jc(t,!0),key:t,value:n,previous:r=i.last,next:void 0,removed:!1},i.first||(i.first=s),r&&(r.next=s),ye?i.size++:e.size++,"F"!==o&&(i.index[o]=s)),e},l=function(e,t){var n,r=a(e),o=jc(t);if("F"!==o)return r.index[o];for(n=r.first;n;n=n.next)if(n.key==t)return n};return na(i,{clear:function(){for(var e=a(this),t=e.index,n=e.first;n;)n.removed=!0,n.previous&&(n.previous=n.previous.next=void 0),delete t[n.index],n=n.next;e.first=e.last=void 0,ye?e.size=0:this.size=0;},delete:function(e){var t=this,n=a(t),r=l(t,e);if(r){var o=r.next,i=r.previous;delete n.index[r.index],r.removed=!0,i&&(i.next=o),o&&(o.previous=i),n.first==r&&(n.first=o),n.last==r&&(n.last=i),ye?n.size--:t.size--;}return !!r},forEach:function(e){for(var t,n=a(this),r=Mt(e,arguments.length>1?arguments[1]:void 0);t=t?t.next:n.first;)for(r(t.value,t.key,this);t&&t.removed;)t=t.previous;},has:function(e){return !!l(this,e)}}),na(i,n?{get:function(e){var t=l(this,e);return t&&t.value},set:function(e,t){return s(this,0===e?0:e,t)}}:{add:function(e){return s(this,e=0===e?0:e,e)}}),ye&&Dc(i,"size",{get:function(){return a(this).size}}),o},setStrong:function(e,t,n){var r=t+" Iterator",o=_c(t),i=_c(r);Po(e,t,(function(e,t){Ac(this,{type:r,target:e,state:o(e),kind:t,last:void 0});}),(function(){for(var e=i(this),t=e.kind,n=e.last;n&&n.removed;)n=n.previous;return e.target&&(e.last=n=n?n.next:e.state.first)?"keys"==t?{value:n.key,done:!1}:"values"==t?{value:n.value,done:!1}:{value:[n.key,n.value],done:!1}:(e.target=void 0,{value:void 0,done:!0})}),n?"entries":"values",!n,!0),pl(t);}};xa("Set",(function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}}),Fc);var Ic=new Set(["doctype","!doctype","meta","script","style","link","frame","iframe","title","svg"]);function Bc(e,n){e.isInline(n)?(e.insertNode(n),"link"===n.type&&e.insertFragment([{text:""}])):t.Transforms.insertNodes(e,n,{mode:"highest"});}var $c=function(e){var n=e,r=n.onChange,o=n.insertText,i=n.apply,a=n.deleteBackward;return n.insertText=function(e){n.getConfig().readOnly||o(e);},n.apply=function(e){var r,o,a,s,l,u,c,f,d=[];switch(e.type){case"insert_text":case"remove_text":case"set_node":try{for(var p=qi(t.Editor.levels(n,{at:e.path})),h=p.next();!h.done;h=p.next()){var g=Gi(h.value,2),v=g[0],y=g[1],m=Hs.findKey(n,v);d.push([y,m]);}}catch(e){r={error:e};}finally{try{h&&!h.done&&(o=p.return)&&o.call(p);}finally{if(r)throw r.error}}break;case"insert_node":case"remove_node":case"merge_node":case"split_node":try{for(var b=qi(t.Editor.levels(n,{at:t.Path.parent(e.path)})),w=b.next();!w.done;w=b.next()){var x=Gi(w.value,2);v=x[0],y=x[1],m=Hs.findKey(n,v);d.push([y,m]);}}catch(e){a={error:e};}finally{try{w&&!w.done&&(s=b.return)&&s.call(b);}finally{if(a)throw a.error}}break;case"move_node":try{for(var E=qi(t.Editor.levels(n,{at:t.Path.common(t.Path.parent(e.path),t.Path.parent(e.newPath))})),S=E.next();!S.done;S=E.next()){var k=Gi(S.value,2);v=k[0],y=k[1],m=Hs.findKey(n,v);d.push([y,m]);}}catch(e){l={error:e};}finally{try{S&&!S.done&&(u=E.return)&&u.call(E);}finally{if(l)throw l.error}}}i(e);try{for(var O=qi(d),C=O.next();!C.done;C=O.next()){var T=Gi(C.value,2);y=T[0],m=T[1],v=Gi(t.Editor.node(n,y),1)[0];ps.set(v,m);}}catch(e){c={error:e};}finally{try{C&&!C.done&&(f=O.return)&&f.call(O);}finally{if(c)throw c.error}}},n.deleteBackward=function(r){if("line"!==r)return a(r);if(e.selection&&t.Range.isCollapsed(e.selection)){var o=t.Editor.above(e,{match:function(n){return t.Editor.isBlock(e,n)},at:e.selection});if(o){var i=Gi(o,2)[1],s=t.Editor.range(e,i,e.selection.anchor),l=function(e,n){var r=t.Editor.range(e,t.Range.end(n)),o=Array.from(t.Editor.positions(e,{at:n})),i=0,a=o.length,s=Math.floor(a/2);if(Ju(e,t.Editor.range(e,o[i]),r))return t.Editor.range(e,o[i],r);if(o.length<2)return t.Editor.range(e,o[o.length-1],r);for(;s!==o.length&&s!==i;)Ju(e,t.Editor.range(e,o[s]),r)?a=s:i=s,s=Math.floor((i+a)/2);return t.Editor.range(e,o[a],r)}(n,s);t.Range.isCollapsed(l)||t.Transforms.delete(e,{at:l});}}},n.onChange=function(){var e=n.selection;null!=e&&vs.set(n,e),n.emit("change"),r();},n.handleTab=function(){n.insertText(" ");},n.getHtml=function(){var e=n.children;return (void 0===e?[]:e).map((function(e){return Ku(e,n)})).join("")},n.getText=function(){var e=n.children;return (void 0===e?[]:e).map((function(e){return t.Node.string(e)})).join("\n")},n.getSelectionText=function(){var r=n.selection;return null==r?"":t.Editor.string(e,r)},n.getElemsByType=function(e,r){var o,i;void 0===r&&(r=!1);var a=[],s=t.Editor.nodes(n,{at:[],universal:!0});try{for(var l=qi(s),u=l.next();!u.done;u=l.next()){var c=Gi(u.value,1)[0];if(t.Element.isElement(c))if(r?c.type.indexOf(e)>=0:c.type===e){var f=qu(Hs.findKey(n,c).id);a.push(Ki(Ki({},c),{id:f}));}}}catch(e){o={error:e};}finally{try{u&&!u.done&&(i=l.return)&&i.call(l);}finally{if(o)throw o.error}}return a},n.getElemsByTypePrefix=function(e){return n.getElemsByType(e,!0)},n.isEmpty=function(){var e=n.children,r=void 0===e?[]:e;if(r.length>1)return !1;var o=r[0];if(null==o)return !0;if(t.Element.isElement(o)&&"paragraph"===o.type){var i=o.children,a=void 0===i?[]:i;if(a.length>1)return !1;var s=a[0];if(null==s)return !0;if(t.Text.isText(s)&&""===s.text)return !0}return !1},n.clear=function(){t.Transforms.delete(n,{at:{anchor:t.Editor.start(n,[]),focus:t.Editor.end(n,[])}}),0===n.children.length&&t.Transforms.insertNodes(n,[{type:"paragraph",children:[{text:""}]}]);},n.getParentNode=function(e){return Hs.getParentNode(n,e)},n.dangerouslyInsertHtml=function(e,r){if(void 0===e&&(e=""),void 0===r&&(r=!1),e){var o=document.createElement("div");o.innerHTML=e;var i=Array.from(o.childNodes);if(i=i.filter((function(e){var t=e.nodeType,n=e.nodeName;return t===Ss.TEXT_NODE||t===Ss.ELEMENT_NODE&&!Ic.has(n.toLowerCase())})),0!==i.length){var a=n.selection;if(null!=a){var s=null;if(Hs.isSelectedEmptyParagraph(n)&&!r)s=[a.focus.path[0]];o.setAttribute("hidden","true"),document.body.appendChild(o);var l=0;i.forEach((function(e){var t=e.nodeType,r=e.nodeName,o=e.textContent,i=void 0===o?"":o;if(t!==Ss.TEXT_NODE)if("BR"!==r){var a=e,s=!1;if(Yu.includes(r.toLowerCase()))s=!0;else for(var u in Zu)if(a.matches(u)){s=!0;break}if(s){var c=Lc(y.default(a),n);return Array.isArray(c)?(c.forEach((function(e){return Bc(n,e)})),l++):(Bc(n,c),l++),void(Hs.isSelectedVoidNode(n)&&n.move(1))}var f=window.getComputedStyle(a).display;Hs.isSelectedEmptyParagraph(n)||f.indexOf("inline")<0&&n.insertBreak(),n.dangerouslyInsertHtml(a.innerHTML,!0);}else n.insertText("\n");else {if(!i||!i.trim())return;n.insertNode({text:i});}})),l&&s&&Hs.isEmptyPath(n,s)&&t.Transforms.removeNodes(n,{at:s}),o.remove();}}}},n.setHtml=function(e){void 0===e&&(e="");var r=n.isDisabled(),o=n.isFocused(),i=JSON.stringify(n.selection);n.enable(),n.focus(),n.clear();var a=Rc(n,e);if(t.Transforms.insertFragment(n,a),o||(n.deselect(),n.blur()),r&&(n.deselect(),n.disable()),n.isFocused())try{n.select(JSON.parse(i));}catch(e){n.select(t.Editor.start(n,[]));}},n},Wc=function(e){var n=e,r=n.insertText;return n.insertFragment,n.setFragmentData=function(e){var r=n.selection;if(r){var o=Gi(t.Range.edges(r),2),i=o[0],a=o[1],s=t.Editor.void(n,{at:i.path}),l=t.Editor.void(n,{at:a.path});if(!t.Range.isCollapsed(r)||s){var u=Hs.toDOMRange(n,r),c=u.cloneContents(),f=c.childNodes[0];if(c.childNodes.forEach((function(e){e.textContent&&""!==e.textContent.trim()&&(f=e);})),l){var d=Gi(l,1)[0],p=u.cloneRange(),h=Hs.toDOMNode(n,d);p.setEndAfter(h),c=p.cloneContents();}if(s&&(f=c.querySelector("[data-slate-spacer]")),Array.from(c.querySelectorAll("[data-slate-zero-width]")).forEach((function(e){var t="n"===e.getAttribute("data-slate-zero-width");e.textContent=t?"\n":"";})),Ns(f)){var g=f.ownerDocument.createElement("span");g.style.whiteSpace="pre",g.appendChild(f),c.appendChild(g),f=g;}var v=n.getFragment(),y=JSON.stringify(v),m=window.btoa(encodeURIComponent(y));f.setAttribute("data-slate-fragment",m),e.setData("application/x-slate-fragment",m);var b=c.ownerDocument.createElement("div");return b.appendChild(c),b.setAttribute("hidden","true"),c.ownerDocument.body.appendChild(b),e.setData("text/html",b.innerHTML),e.setData("text/plain",Rs(b)),c.ownerDocument.body.removeChild(b),e}}},n.insertData=function(e){var o,i,a=e.getData("application/x-slate-fragment");if(a){var s=decodeURIComponent(window.atob(a)),l=JSON.parse(s);n.insertFragment(l);}else {var u=e.getData("text/plain"),c=e.getData("text/html");if(c)n.dangerouslyInsertHtml(c);else if(u){var f=u.split(/\r\n|\r|\n/),d=!1;try{for(var p=qi(f),h=p.next();!h.done;h=p.next()){var g=h.value;d&&t.Transforms.splitNodes(n,{always:!0}),r(g),d=!0;}}catch(e){o={error:e};}finally{try{h&&!h.done&&(i=p.return)&&i.call(p);}finally{if(o)throw o.error}}}else;}},n},Hc=function(e){return null!=e},Vc={object:!0,function:!0,undefined:!0},zc=function(e){if(!function(e){return !!Hc(e)&&hasOwnProperty.call(Vc,typeof e)}(e))return !1;try{return !!e.constructor&&e.constructor.prototype===e}catch(e){return !1}},Uc=/^\s*class[\s{/}]/,Kc=Function.prototype.toString,qc=function(e){return !!function(e){if("function"!=typeof e)return !1;if(!hasOwnProperty.call(e,"length"))return !1;try{if("number"!=typeof e.length)return !1;if("function"!=typeof e.call)return !1;if("function"!=typeof e.apply)return !1}catch(e){return !1}return !zc(e)}(e)&&!Uc.test(Kc.call(e))},Gc=function(e){return null!=e},Jc=Object.keys,Yc=function(){try{return Object.keys("primitive"),!0}catch(e){return !1}}()?Object.keys:function(e){return Jc(Gc(e)?Object(e):e)},Xc=function(e){if(!Gc(e))throw new TypeError("Cannot use null or undefined");return e},Qc=Math.max,Zc=function(){var e,t=Object.assign;return "function"==typeof t&&(t(e={foo:"raz"},{bar:"dwa"},{trzy:"trzy"}),e.foo+e.bar+e.trzy==="razdwatrzy")}()?Object.assign:function(e,t){var n,r,o,i=Qc(arguments.length,2);for(e=Object(Xc(e)),o=function(r){try{e[r]=t[r];}catch(e){n||(n=e);}},r=1;r-1},lf=T((function(e){var t=e.exports=function(e,t){var n,r,o,i,a;return arguments.length<2||"string"!=typeof e?(i=t,t=e,e=null):i=arguments[2],Hc(e)?(n=sf.call(e,"c"),r=sf.call(e,"e"),o=sf.call(e,"w")):(n=o=!0,r=!1),a={value:t,configurable:n,enumerable:r,writable:o},i?Zc(rf(i),a):a};t.gs=function(e,t,n){var r,o,i,a;return "string"!=typeof e?(i=n,n=t,t=e,e=null):i=arguments[3],Hc(t)?qc(t)?Hc(n)?qc(n)||(i=n,n=void 0):n=void 0:(i=t,t=n=void 0):t=void 0,Hc(e)?(r=sf.call(e,"c"),o=sf.call(e,"e")):(r=!0,o=!1),a={get:t,set:n,configurable:r,enumerable:o},i?Zc(rf(i),a):a};})),uf=function(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");return e},cf=T((function(e,t){var n,r,o,i,a,s,l,u=Function.prototype.apply,c=Function.prototype.call,f=Object.create,d=Object.defineProperty,p=Object.defineProperties,h=Object.prototype.hasOwnProperty,g={configurable:!0,enumerable:!1,writable:!0};n=function(e,t){var n;return uf(t),h.call(this,"__ee__")?n=this.__ee__:(n=g.value=f(null),d(this,"__ee__",g),g.value=null),n[e]?"object"==typeof n[e]?n[e].push(t):n[e]=[n[e],t]:n[e]=t,this},r=function(e,t){var r,i;return uf(t),i=this,n.call(this,e,r=function(){o.call(i,e,r),u.call(t,this,arguments);}),r.__eeOnceListener__=t,this},o=function(e,t){var n,r,o,i;if(uf(t),!h.call(this,"__ee__"))return this;if(!(n=this.__ee__)[e])return this;if("object"==typeof(r=n[e]))for(i=0;o=r[i];++i)o!==t&&o.__eeOnceListener__!==t||(2===r.length?n[e]=r[i?0:1]:r.splice(i,1));else r!==t&&r.__eeOnceListener__!==t||delete n[e];return this},i=function(e){var t,n,r,o,i;if(h.call(this,"__ee__")&&(o=this.__ee__[e]))if("object"==typeof o){for(n=arguments.length,i=new Array(n-1),t=1;ta/2){var p=a-d;c.right=p+5+"px";}else c.left=d+5+"px";if(f>s/2){var h=s-f;c.bottom=h+5+"px";}else {var g=f+u;g<0&&(g=0),c.top=g+5+"px";}return c}function mf(e,n,r){void 0===r&&(r="modal");var o={top:"0",left:"0"};if(null==e.selection)return o;var i=t.Element.isElement(n)&&e.isVoid(n),a=t.Element.isElement(n)&&e.isInline(n),s=ds.get(n);if(null==s)return o;var l=s.getBoundingClientRect(),u=l.top,c=l.left,f=l.height,d=l.width;if(i){var p=function(e){var t=[];t.push(e);for(var n=0;t.length>0;){var r=t.pop();if(null==r)break;if(++n>1e4)break;var o=r.nodeName;if(1===r.nodeType){var i=o.toLowerCase();if(Es.includes(i)||"iframe"===i||"video"===i)return r;var a=r.children||[],s=a.length;if(s)for(var l=s-1;l>=0;l--)t.push(a[l]);}}return null}(s);if(null!=p){var h=p.getBoundingClientRect();u=h.top,f=h.height;}}var g=vf(e);if(null==g)return o;var v=g.top,y=g.left,m=g.width,b=g.height,w={},x=u-v,E=c-y;if("bar"===r)return w.left=E+"px",x>40?w.bottom=b-x+5+"px":w.top=x+f+5+"px",w;if("modal"===r){var S;if(i?a?E>(m-d)/2?w.right=m-E+5+"px":w.left=E+d+5+"px":w.left="20px":w.left=E+"px",i)(S=x)<0&&(S=0),w.top=S+"px";else if(x>(b-f)/2)w.bottom=b-x+5+"px";else (S=x+f)<0&&(S=0),w.top=S+5+"px";return w}throw new Error("type '"+r+"' is invalid")}function bf(e,t){Uu((function(){var n=vf(e);if(null!=n){var r,o=n.top,i=n.left,a=n.width,s=n.height,l=t.offset(),u=l.top,c=l.left,f=t.width(),d=t.height(),p=u-o,h=c-i,g=t.attr("style");if(g.indexOf("top")>=0)if((r=p+d-s)>0){var v=t.css("top"),y=parseInt(v.toString())-r;y<0&&(y=0),t.css("top",y+"px");}if(g.indexOf("bottom")>=0&&u<0){var m=t.css("bottom"),b=parseInt(m.toString())-Math.abs(u);t.css("bottom",b+"px");}if(g.indexOf("left")>=0)if((r=h+f-a)>0){var w=t.css("left"),x=parseInt(w.toString())-r;x<0&&(x=0),t.css("left",x+"px");}if(g.indexOf("right")>=0&&c<0){var E=t.css("right"),S=parseInt(E.toString())-Math.abs(c);t.css("right",S+"px");}}}));}var wf=qo("slice"),xf=he("species"),Ef=P.Array,Sf=Math.max;_n({target:"Array",proto:!0,forced:!wf},{slice:function(e,t){var n,r,o,i=cn(this),a=It(i),s=gn(e,a),l=gn(void 0===t?a:t,a);if(Bt(i)&&(n=i.constructor,(qt(n)&&(n===Ef||Bt(n.prototype))||me(n)&&null===(n=n[xf]))&&(n=void 0),n===Ef||void 0===n))return yl(i,s,l);for(r=new(void 0===n?Ef:n)(Sf(l-s,0)),o=0;s1?arguments[1]:void 0,t.length)),r=er(e);return Of?Of(t,r,n):Cf(t,n,n+r.length)===r}});var Lf=Object.assign,Pf=Object.defineProperty,Rf=W([].concat),Df=!Lf||se((function(){if(ye&&1!==Lf({b:1},Lf(Pf({},"a",{enumerable:!0,get:function(){Pf(this,"b",{value:3,enumerable:!1});}}),{b:2})).b)return !0;var e={},t={},n=Symbol(),r="abcdefghijklmnopqrst";return e[n]=7,r.split("").forEach((function(e){t[e]=e;})),7!=Lf({},e)[n]||Fn(Lf({},t)).join("")!=r}))?function(e,t){for(var n=U(e),r=arguments.length,o=1,i=kn.f,a=un.f;r>o;)for(var s,l=Rt(arguments[o++]),u=i?Rf(Fn(l),i(l)):Fn(l),c=u.length,f=0;c>f;)s=u[f++],ye&&!Te(a,l,s)||(n[s]=l[s]);return n}:Lf;_n({target:"Object",stat:!0,forced:Object.assign!==Df},{assign:Df});var jf=["props","attrs","style","dataset","on","hook"];function Af(e){var t=e.data,n=void 0===t?{}:t,r=e.children,o=void 0===r?[]:r;Object.keys(n).forEach((function(t){var r,o,i=n[t];if("key"!==t){if(!jf.includes(t)){if(t.startsWith("data-")){var a=t.slice(5);return a=w.default(a),function(e,t){null==e.data&&(e.data={});var n=e.data;null==n.dataset&&(n.dataset={});Object.assign(n.dataset,t);}(e,((r={})[a]=i,r)),void delete n[t]}!function(e,t){null==e.data&&(e.data={});var n=e.data;null==n.props&&(n.props={});Object.assign(n.props,t);}(e,(o={},o[t]=i,o)),delete n[t];}}else e.key=i;})),o.length>0&&o.forEach((function(e){"string"!=typeof e&&Af(e);}));}var _f=[];var Ff={};function If(e,t,n){var r=n.isInline(e)?"span":"div";return s.jsx(r,null,t)}function Bf(e,n){var r,o=Hs.findKey(n,e),i=n.isInline(e),a=t.Editor.isVoid(n,e),l=qu(o.id),u={id:l,key:o.id,"data-slate-node":"element","data-slate-inline":i},c=e.type,f=e.children,d=void 0===f?[]:f,p=function(e){return Ff[e]||If}(c);r=a?null:d.map((function(t,r){return Vf(t,r,e,n)}));var h=p(e,r,n);if(a){u["data-slate-void"]=!0;var g=i?"span":"div",v=Gi(t.Node.texts(e),1),y=Gi(v[0],1)[0],m=Vf(y,0,e,n),b=s.jsx(g,{"data-slate-spacer":!0,style:{height:"0",color:"transparent",outline:"none",position:"absolute"}},m);h=s.jsx(g,{style:{position:"relative"}},h,b),ss.set(y,0),ls.set(y,e);}return null==h.data&&(h.data={}),Object.assign(h.data,u),a||i||(h=function(e,t){var n=t;return _f.forEach((function(r){n=r(e,t);})),n}(e,h)),Uu((function(){var t=Ms(l);null!=t&&(fs.set(o,t),ds.set(e,t),cs.set(t,e));})),h}function $f(e,t){return void 0===t&&(t=!1),s.jsx("span",{"data-slate-string":!0},t?e+"\n":e)}function Wf(e,t){return void 0===e&&(e=0),void 0===t&&(t=!1),s.jsx("span",{"data-slate-zero-width":t?"n":"z","data-slate-length":e},"\ufeff",t?s.jsx("br",null):null)}function Hf(e,n,r){if(null==e.text)throw new Error("Current node is not slate Text "+JSON.stringify(e));var o=Hs.findKey(r,e),i=r.getConfig().decorate;if(null==i)throw new Error("Can not get config.decorate");var a=Hs.findPath(r,e),l=i([e,a]),u=t.Text.decorations(e,l),c=u.map((function(o,i){var a=function(e,n,r,o,i){void 0===n&&(n=!1);var a=e.text,s=Hs.findPath(i,r),l=t.Path.parent(s);if(t.Editor.isEditor(o))throw new Error("Text node "+JSON.stringify(r)+" parent is Editor");return i.isVoid(o)?Wf(t.Node.string(o).length):""!==a||o.children[o.children.length-1]!==r||i.isInline(o)||""!==t.Editor.string(i,l)?""===a?Wf():n&&"\n"===a.slice(-1)?$f(a,!0):$f(a):Wf(0,!0)}(o,i===u.length-1,e,n,r);return a=function(e,t){var n=t;return _f.forEach((function(t){n=t(e,n);})),n}(o,a),s.jsx("span",{"data-slate-leaf":!0},a)})),f=function(e){return "w-e-text-"+e}(o.id),d=s.jsx("span",{"data-slate-node":"text",id:f,key:o.id},c);return Uu((function(){var t=Ms(f);null!=t&&(fs.set(o,t),ds.set(e,t),cs.set(t,e));})),d}function Vf(e,n,r,o){return ss.set(e,n),ls.set(e,r),t.Element.isElement(e)?Bf(e,o):Hf(e,r,o)}function zf(e,t){var n,r=e.$scroll,o=function(e){return "w-e-textarea-"+e}(e.id),i=t.getConfig(),a=i.readOnly,l=i.autoFocus,u=function(e,t){return void 0===t&&(t=!1),s.h("div#"+e,{props:{contentEditable:!t}})}(o,a),c=t.children||[];u.children=c.map((function(e,n){var r=Vf(e,n,t,t);return Af(r),r}));var f=os.get(e);if(null==f&&(f=!0),f){var d=function(e,t){return y.default('')}(o);r.append(d),e.$textArea=d,n=d[0],(h=s.init([s.classModule,s.propsModule,s.styleModule,s.datasetModule,s.eventListenersModule,s.attributesModule]))(n,u),os.set(e,!1),is.set(e,h);}else {var p=as.get(e),h=is.get(e);if(null==p||null==h)return;n=p.elm,h(p,u);}if(null!=n||null!=(n=Ms(o))){if((f?l:t.isFocused())&&n.focus({preventScroll:!0}),f){var g=ks(n);g&&hs.set(t,g);}us.set(t,n),ds.set(t,n),cs.set(n,t),as.set(e,u);}}function Uf(e){return "object"==typeof e&&null!=e&&1===e.nodeType}function Kf(e,t){return (!t||"hidden"!==e)&&"visible"!==e&&"clip"!==e}function qf(e,t){if(e.clientHeightt||i>e&&a=t&&s>=n?i-e-r:a>t&&sn?a-t+o:0}var Jf=function(e,t){var n=window,r=t.scrollMode,o=t.block,i=t.inline,a=t.boundary,s=t.skipOverflowHiddenElements,l="function"==typeof a?a:function(e){return e!==a};if(!Uf(e))throw new TypeError("Invalid target");for(var u=document.scrollingElement||document.documentElement,c=[],f=e;Uf(f)&&l(f);){if((f=f.parentElement)===u){c.push(f);break}null!=f&&f===document.body&&qf(f)&&!qf(document.documentElement)||null!=f&&qf(f,s)&&c.push(f);}for(var d=n.visualViewport?n.visualViewport.width:innerWidth,p=n.visualViewport?n.visualViewport.height:innerHeight,h=window.scrollX||pageXOffset,g=window.scrollY||pageYOffset,v=e.getBoundingClientRect(),y=v.height,m=v.width,b=v.top,w=v.right,x=v.bottom,E=v.left,S="start"===o||"nearest"===o?b:"end"===o?x:b+y/2,k="center"===i?E+m/2:"end"===i?w:E,O=[],C=0;C=0&&E>=0&&x<=p&&w<=d&&b>=P&&x<=D&&E>=j&&w<=R)return O;var A=getComputedStyle(T),_=parseInt(A.borderLeftWidth,10),F=parseInt(A.borderTopWidth,10),I=parseInt(A.borderRightWidth,10),B=parseInt(A.borderBottomWidth,10),$=0,W=0,H="offsetWidth"in T?T.offsetWidth-T.clientWidth-_-I:0,V="offsetHeight"in T?T.offsetHeight-T.clientHeight-F-B:0;if(u===T)$="start"===o?S:"end"===o?S-p:"nearest"===o?Gf(g,g+p,p,F,B,g+S,g+S+y,y):S-p/2,W="start"===i?k:"center"===i?k-d/2:"end"===i?k-d:Gf(h,h+d,d,_,I,h+k,h+k+m,m),$=Math.max(0,$+g),W=Math.max(0,W+h);else {$="start"===o?S-P-F:"end"===o?S-D+B+V:"nearest"===o?Gf(P,D,M,F,B+V,S,S+y,y):S-(P+M/2)+V/2,W="start"===i?k-j-_:"center"===i?k-(j+L/2)+H/2:"end"===i?k-R+I+H:Gf(j,R,L,_,I+H,k,k+m,m);var z=T.scrollLeft,U=T.scrollTop;S+=U-($=Math.max(0,Math.min(U+$,T.scrollHeight-M+V))),k+=z-(W=Math.max(0,Math.min(z+W,T.scrollWidth-L+H)));}O.push({el:T,top:$,left:W});}return O},Yf=T((function(e,t){t.__esModule=!0,t.default=void 0;var n,r=(n=Jf)&&n.__esModule?n:{default:n};function o(e){return e===Object(e)&&0!==Object.keys(e).length}var i=function(e,t){var n=!e.ownerDocument.documentElement.contains(e);if(o(t)&&"function"==typeof t.behavior)return t.behavior(n?[]:(0, r.default)(e,t));if(!n){var i=function(e){return !1===e?{block:"end",inline:"nearest"}:o(e)?e:{block:"start",inline:"nearest"}}(t);return function(e,t){void 0===t&&(t="auto");var n="scrollBehavior"in document.body.style;e.forEach((function(e){var r=e.el,o=e.top,i=e.left;r.scroll&&n?r.scroll({top:o,left:i,behavior:t}):(r.scrollTop=o,r.scrollLeft=i);}));}((0, r.default)(e,i),i.behavior)}};t.default=i,e.exports=t.default;})),Xf=C(Yf);function Qf(e,t){return Cs(t)&&Hs.hasDOMNode(e,t,{editable:!0})}function Zf(e,n){if(e.getConfig().readOnly)return !1;var r=ed(e,n)&&Hs.toSlateNode(e,n);return t.Editor.isVoid(e,r)}function ed(e,t){return Cs(t)&&Hs.hasDOMNode(e,t)}function td(e,n,r){void 0===r&&(r=!1);var o=n.selection,i=n.getConfig(),a=Hs.findDocumentOrShadowRoot(n).getSelection();if(a&&(!e.isComposing||r)&&n.isFocused()){var s="None"!==a.type;if(o||s){var l=us.get(n),u=!1;if(l.contains(a.anchorNode)&&l.contains(a.focusNode)&&(u=!0),s&&u&&o){var c=Hs.toSlateRange(n,a,{exactMatch:!0,suppressThrow:!0});if(c&&t.Range.equals(c,o)){var f=!0;if(t.Range.isCollapsed(o)){var d=a.anchorNode,p=a.anchorOffset;if(d===l){var h=l.childNodes,g=void 0;(g=h[p])&&g.matches("table")&&(f=!1),(g=h[p-1])&&g.matches("table")&&(f=!1);}}if(f)return}}if(!o||Hs.hasRange(n,o)){e.isUpdatingSelection=!0;var v=o&&Hs.toDOMRange(n,o);if(v){t.Range.isBackward(o)?a.setBaseAndExtent(v.endContainer,v.endOffset,v.startContainer,v.startOffset):a.setBaseAndExtent(v.startContainer,v.startOffset,v.endContainer,v.endOffset);var y=v.startContainer.parentElement;if(!y.closest("[data-slate-spacer]")){var m=document.body;Xf(y,{scrollMode:"if-needed",boundary:i.scroll?l.parentElement:m,block:"nearest",behavior:"instant"});}}else a.removeAllRanges();setTimeout((function(){v&&_s&&l.focus(),e.isUpdatingSelection=!1;}));}else n.selection=Hs.toSlateRange(n,a,{exactMatch:!1,suppressThrow:!1});}}}var nd=new WeakMap,rd=new WeakMap;var od={bold:"mod+b",compose:["down","left","right","up","backspace","enter"],moveBackward:"left",moveForward:"right",moveWordBackward:"ctrl+left",moveWordForward:"ctrl+right",deleteBackward:"shift?+backspace",deleteForward:"shift?+delete",extendBackward:"shift+left",extendForward:"shift+right",italic:"mod+i",splitBlock:"shift?+enter",undo:"mod+z",tab:"tab",selectAll:"mod+a"},id={moveLineBackward:"opt+up",moveLineForward:"opt+down",moveWordBackward:"opt+left",moveWordForward:"opt+right",deleteBackward:["ctrl+backspace","ctrl+h"],deleteForward:["ctrl+delete","ctrl+d"],deleteLineBackward:"cmd+shift?+backspace",deleteLineForward:["cmd+shift?+delete","ctrl+k"],deleteWordBackward:"opt+shift?+backspace",deleteWordForward:"opt+shift?+delete",extendLineBackward:"opt+shift+up",extendLineForward:"opt+shift+down",redo:"cmd+shift+z",transposeCharacter:"ctrl+t"},ad={deleteWordBackward:"ctrl+shift?+backspace",deleteWordForward:"ctrl+shift?+delete",redo:["ctrl+y","ctrl+shift+z"]},sd=function(e){var t=od[e],n=id[e],r=ad[e],o=t&&u.isKeyHotkey(t),i=n&&u.isKeyHotkey(n),a=r&&u.isKeyHotkey(r);return function(e){return !(!o||!o(e))||(!!(As&&i&&i(e))||!(As||!a||!a(e)))}},ld={isBold:sd("bold"),isCompose:sd("compose"),isMoveBackward:sd("moveBackward"),isMoveForward:sd("moveForward"),isDeleteBackward:sd("deleteBackward"),isDeleteForward:sd("deleteForward"),isDeleteLineBackward:sd("deleteLineBackward"),isDeleteLineForward:sd("deleteLineForward"),isDeleteWordBackward:sd("deleteWordBackward"),isDeleteWordForward:sd("deleteWordForward"),isExtendBackward:sd("extendBackward"),isExtendForward:sd("extendForward"),isExtendLineBackward:sd("extendLineBackward"),isExtendLineForward:sd("extendLineForward"),isItalic:sd("italic"),isMoveLineBackward:sd("moveLineBackward"),isMoveLineForward:sd("moveLineForward"),isMoveWordBackward:sd("moveWordBackward"),isMoveWordForward:sd("moveWordForward"),isRedo:sd("redo"),isSplitBlock:sd("splitBlock"),isTransposeCharacter:sd("transposeCharacter"),isUndo:sd("undo"),isTab:sd("tab"),isSelectAll:sd("selectAll")};function ud(e){e.preventDefault();}var cd={beforeinput:function(e,n,r){var o=e,i=r.getConfig().readOnly;if(Ws&&!i&&Qf(r,o.target)){var a=r.selection,s=o.inputType,l=o.dataTransfer||o.data||void 0;if("insertCompositionText"!==s&&"deleteCompositionText"!==s){if(o.preventDefault(),!s.startsWith("delete")||s.startsWith("deleteBy")){var u=Gi(o.getTargetRanges(),1)[0];if(u){var c=Hs.toSlateRange(r,u,{exactMatch:!1,suppressThrow:!1});a&&t.Range.equals(a,c)||t.Transforms.select(r,c);}}if(a&&t.Range.isExpanded(a)&&s.startsWith("delete")){var f=s.endsWith("Backward")?"backward":"forward";t.Editor.deleteFragment(r,{direction:f});}else switch(s){case"deleteByComposition":case"deleteByCut":case"deleteByDrag":t.Editor.deleteFragment(r);break;case"deleteContent":case"deleteContentForward":t.Editor.deleteForward(r);break;case"deleteContentBackward":t.Editor.deleteBackward(r);break;case"deleteEntireSoftLine":t.Editor.deleteBackward(r,{unit:"line"}),t.Editor.deleteForward(r,{unit:"line"});break;case"deleteHardLineBackward":t.Editor.deleteBackward(r,{unit:"block"});break;case"deleteSoftLineBackward":t.Editor.deleteBackward(r,{unit:"line"});break;case"deleteHardLineForward":t.Editor.deleteForward(r,{unit:"block"});break;case"deleteSoftLineForward":t.Editor.deleteForward(r,{unit:"line"});break;case"deleteWordBackward":t.Editor.deleteBackward(r,{unit:"word"});break;case"deleteWordForward":t.Editor.deleteForward(r,{unit:"word"});break;case"insertLineBreak":case"insertParagraph":t.Editor.insertBreak(r);break;case"insertFromDrop":case"insertFromPaste":case"insertFromYank":case"insertReplacementText":case"insertText":if("insertFromPaste"===s&&!ms.get(r))break;l instanceof DataTransfer?r.insertData(l):"string"==typeof l&&t.Editor.insertText(r,l);}}}},blur:function(e,n,r){var o=e,i=n.isUpdatingSelection,a=n.latestElement;if(!r.getConfig().readOnly&&!i&&Qf(r,o.target)){var s=Hs.findDocumentOrShadowRoot(r);if(a!==s.activeElement){var l=o.relatedTarget;if(!(l===Hs.toDOMNode(r,r)||Os(l)&&l.hasAttribute("data-slate-spacer"))){if(null!=l&&Cs(l)&&Hs.hasDOMNode(r,l)){var u=Hs.toSlateNode(r,l);if(t.Element.isElement(u)&&!r.isVoid(u))return}if(Fs){var c=s.getSelection();null==c||c.removeAllRanges();}gs.delete(r);}}}},focus:function(e,t,n){var r=Hs.toDOMNode(n,n),o=Hs.findDocumentOrShadowRoot(n);t.latestElement=o.activeElement,_s&&e.target!==r?r.focus():gs.set(n,!0);},click:function(e,n,r){if(!r.getConfig().readOnly&&ed(r,e.target)&&Cs(e.target)){var o=Hs.toSlateNode(r,e.target),i=Hs.findPath(r,o);if(t.Editor.hasPath(r,i))if(t.Node.get(r,i)===o){var a=t.Editor.start(r,i),s=t.Editor.end(r,i),l=t.Editor.void(r,{at:a}),u=t.Editor.void(r,{at:s});if(l&&u&&t.Path.equals(l[1],u[1])){var c=t.Editor.range(r,a);t.Transforms.select(r,c);}}}},compositionstart:function(e,n,r){if(Qf(r,e.target)){var o=r.selection;if(o&&t.Range.isExpanded(o)&&(t.Editor.deleteFragment(r),Promise.resolve().then((function(){td(n,r,!0);}))),o&&t.Range.isCollapsed(o)){var i=Hs.toDOMRange(r,o).startContainer,a=i.textContent||"";nd.set(r,a),rd.set(r,i);}n.isComposing=!0,function(e,t){var n;t.getConfig().placeholder&&t.isEmpty()&&e.showPlaceholder&&(null===(n=e.$placeholder)||void 0===n||n.hide(),e.showPlaceholder=!1);}(n,r);}},compositionend:function(e,n,r){var o=e;if(Qf(r,o.target)){n.isComposing=!1;var i=r.selection;if(null!=i){($s||_s)&&Hs.cleanExposedTexNodeInSelectionBlock(r);for(var a=t.Range.isBackward(i)?i.focus:i.anchor,s=Gi(t.Editor.node(r,[a.path[0]]),1)[0],l=0;l0&&t.Editor.insertText(r,c.slice(0,f)),n.changeViewState();else t.Editor.insertText(r,c);}else t.Editor.insertText(r,c);Fs||setTimeout((function(){var e=r.selection;if(null!=e){var t=rd.get(r);if(null!=t)Hs.toDOMRange(r,e).startContainer!==t&&(t.textContent=nd.get(r)||"");}}));}}}},compositionupdate:function(e,t,n){Qf(n,e.target)&&(t.isComposing=!0);},keydown:function(e,n,r){var o=e,i=r.selection;if(!r.getConfig().readOnly&&!n.isComposing&&Qf(r,o.target)){if(function(e,t){var n=Xa.get(e),r=n&&n.getMenus(),o=Za.get(e),i=o&&o.getMenus(),a=Ki(Ki({},r),i);for(var s in a){var l=a[s],c=l.hotkey;if(c&&u.isHotkey(c,t)&&!l.isDisabled(e)){var f=l.getValue(e);l.exec(e,f);}}}(r,o),ld.isTab(o))return ud(o),void r.handleTab();if(ld.isRedo(o))return ud(o),void("function"==typeof r.redo&&r.redo());if(ld.isUndo(o))return ud(o),void("function"==typeof r.undo&&r.undo());if(ld.isMoveLineBackward(o))return ud(o),void t.Transforms.move(r,{unit:"line",reverse:!0});if(ld.isMoveLineForward(o))return ud(o),void t.Transforms.move(r,{unit:"line"});if(ld.isExtendLineBackward(o))return ud(o),void t.Transforms.move(r,{unit:"line",edge:"focus",reverse:!0});if(ld.isExtendLineForward(o))return ud(o),void t.Transforms.move(r,{unit:"line",edge:"focus"});if(ld.isMoveBackward(o))return ud(o),void(i&&t.Range.isCollapsed(i)?t.Transforms.move(r,{reverse:!0}):t.Transforms.collapse(r,{edge:"start"}));if(ld.isMoveForward(o))return ud(o),void(i&&t.Range.isCollapsed(i)?t.Transforms.move(r):t.Transforms.collapse(r,{edge:"end"}));if(ld.isMoveWordBackward(o))return ud(o),i&&t.Range.isExpanded(i)&&t.Transforms.collapse(r,{edge:"focus"}),void t.Transforms.move(r,{unit:"word",reverse:!0});if(ld.isMoveWordForward(o))return ud(o),i&&t.Range.isExpanded(i)&&t.Transforms.collapse(r,{edge:"focus"}),void t.Transforms.move(r,{unit:"word"});if(ld.isSelectAll(o))return ud(o),void r.selectAll();if(Ws){if(($s||Fs)&&i&&(ld.isDeleteBackward(o)||ld.isDeleteForward(o))&&t.Range.isCollapsed(i)){var a=t.Node.parent(r,i.anchor.path);if(t.Element.isElement(a)&&t.Editor.isVoid(r,a)&&t.Editor.isInline(r,a))return o.preventDefault(),void t.Transforms.delete(r,{unit:"block"})}}else {if(ld.isBold(o)||ld.isItalic(o)||ld.isTransposeCharacter(o))return void ud(o);if(ld.isSplitBlock(o))return ud(o),void t.Editor.insertBreak(r);if(ld.isDeleteBackward(o))return ud(o),void(i&&t.Range.isExpanded(i)?t.Editor.deleteFragment(r,{direction:"backward"}):t.Editor.deleteBackward(r));if(ld.isDeleteForward(o))return ud(o),void(i&&t.Range.isExpanded(i)?t.Editor.deleteFragment(r,{direction:"forward"}):t.Editor.deleteForward(r));if(ld.isDeleteLineBackward(o))return ud(o),void(i&&t.Range.isExpanded(i)?t.Editor.deleteFragment(r,{direction:"backward"}):t.Editor.deleteBackward(r,{unit:"line"}));if(ld.isDeleteLineForward(o))return ud(o),void(i&&t.Range.isExpanded(i)?t.Editor.deleteFragment(r,{direction:"forward"}):t.Editor.deleteForward(r,{unit:"line"}));if(ld.isDeleteWordBackward(o))return ud(o),void(i&&t.Range.isExpanded(i)?t.Editor.deleteFragment(r,{direction:"backward"}):t.Editor.deleteBackward(r,{unit:"word"}));if(ld.isDeleteWordForward(o))return ud(o),void(i&&t.Range.isExpanded(i)?t.Editor.deleteFragment(r,{direction:"forward"}):t.Editor.deleteForward(r,{unit:"word"}))}}},keypress:function(e,n,r){if(!Ws&&!r.getConfig().readOnly&&Qf(r,e.target)){e.preventDefault();var o=e.key;t.Editor.insertText(r,o);}},copy:function(e,t,n){var r=e;if(Qf(n,r.target)){r.preventDefault();var o=r.clipboardData;null!=o&&n.setFragmentData(o);}},cut:function(e,n,r){var o=e,i=r.selection;if(!r.getConfig().readOnly&&Qf(r,o.target)){o.preventDefault();var a=o.clipboardData;if(null!=a&&(r.setFragmentData(a),i))if(t.Range.isExpanded(i))t.Editor.deleteFragment(r);else {var s=t.Node.parent(r,i.anchor.path);t.Editor.isVoid(r,s)&&t.Transforms.delete(r);}}},paste:function(e,t,n){ms.set(n,!0);var r=e;if(!n.getConfig().readOnly&&Qf(n,r.target)){var o=n.getConfig().customPaste;if(o)if(!1===o(n,r))return void ms.set(n,!1);if(!Ws||function(e){return e.clipboardData&&""!==e.clipboardData.getData("text/plain")&&1===e.clipboardData.types.length}(r)){r.preventDefault();var i=r.clipboardData;null!=i&&n.insertData(i);}}},dragover:function(e,n,r){if(ed(r,e.target)){var o=Hs.toSlateNode(r,e.target);t.Editor.isVoid(r,o)&&e.preventDefault();}},dragstart:function(e,n,r){var o=e;if(ed(r,o.target)&&!r.getConfig().readOnly){var i=Hs.toSlateNode(r,o.target),a=Hs.findPath(r,i);if(t.Editor.isVoid(r,i)||t.Editor.void(r,{at:a,voids:!0})){var s=t.Editor.range(r,a);t.Transforms.select(r,s);}var l=o.dataTransfer;null!=l&&(n.isDraggingInternally=!0,r.setFragmentData(l));}},dragend:function(e,t,n){var r=e;n.getConfig().readOnly||t.isDraggingInternally&&ed(n,r.target)&&(t.isDraggingInternally=!1);},drop:function(e,n,r){var o=e,i=o.dataTransfer;if(!r.getConfig().readOnly&&ed(r,o.target)&&null!=i&&!(Ws&&Fs&&i.files.length>0)){o.preventDefault();var a=r.selection,s=Hs.findEventRange(r,o);t.Transforms.select(r,s),n.isDraggingInternally&&(a&&t.Transforms.delete(r,{at:a}),n.isDraggingInternally=!1),r.insertData(i),r.isFocused()||r.focus();}}},fd=1,dd=function(){function e(e){var n=this;this.id=fd++,this.$textArea=null,this.$progressBar=y.default('
    '),this.$maxLengthInfo=y.default('
    '),this.isComposing=!1,this.isUpdatingSelection=!1,this.isDraggingInternally=!1,this.latestElement=null,this.showPlaceholder=!1,this.$placeholder=null,this.latestEditorSelection=null,this.onDOMSelectionChange=b.default((function(){var e=n.editorInstance;!function(e,n){var r=e.isComposing,o=e.isUpdatingSelection,i=e.isDraggingInternally;if(!(n.getConfig().readOnly||r||o||i)){var a=Hs.findDocumentOrShadowRoot(n),s=a.activeElement,l=Hs.toDOMNode(n,n),u=a.getSelection();if(s===l?(e.latestElement=s,gs.set(n,!0)):gs.delete(n),!u)return t.Transforms.deselect(n);var c=u.anchorNode,f=u.focusNode,d=Qf(n,c)||Zf(n,c),p=Qf(n,f)||Zf(n,f);if(d&&p){var h=Hs.toSlateRange(n,u,{exactMatch:!1,suppressThrow:!1});t.Transforms.select(n,h);}else t.Transforms.deselect(n);}}(n,e);}),100);var r=y.default(e);if(0===r.length)throw new Error("Cannot find textarea DOM by selector '"+e+"'");this.$box=r;var o=y.default('
    ');o.append(this.$progressBar),o.append(this.$maxLengthInfo),r.append(o);var i=y.default('
    ');o.append(i),this.$scroll=i,this.$textAreaContainer=o,Uu((function(){var e=n.editorInstance,t=Hs.getWindow(e);t.document.addEventListener("selectionchange",n.onDOMSelectionChange),e.on("destroyed",(function(){t.document.removeEventListener("selectionchange",n.onDOMSelectionChange);})),o.on("click",(function(){return e.hidePanelOrModal()})),e.on("change",n.changeViewState.bind(n));var r=e.getConfig().onChange;r&&e.on("change",(function(){return r(e)})),n.onFocusAndOnBlur(),e.on("change",n.changeMaxLengthInfo.bind(n)),n.bindEvent();}));}return Object.defineProperty(e.prototype,"editorInstance",{get:function(){var e=Ja.get(this);if(null==e)throw new Error("Can not get editor instance");return e},enumerable:!1,configurable:!0}),e.prototype.bindEvent=function(){var e=this,t=this.$textArea,n=this.$scroll,r=this.editorInstance;null!=t&&(m.default(cd,(function(n,o){t.on(o,(function(t){n(t,e,r);}));})),r.getConfig().scroll&&(n.css("overflow-y","auto"),n.on("scroll",b.default((function(){r.emit("scroll");}),100))));},e.prototype.onFocusAndOnBlur=function(){var e=this,t=this.editorInstance,n=t.getConfig(),r=n.onBlur,o=n.onFocus;this.latestEditorSelection=t.selection,t.on("change",(function(){null==e.latestEditorSelection&&null!=t.selection?setTimeout((function(){return o&&o(t)})):null!=e.latestEditorSelection&&null==t.selection&&setTimeout((function(){return r&&r(t)})),e.latestEditorSelection=t.selection;}));},e.prototype.changeMaxLengthInfo=function(){var e=this.editorInstance,t=e.getConfig().maxLength;if(t){var n=t-Hs.getLeftLengthOfMaxLength(e);this.$maxLengthInfo[0].innerHTML=n+"/"+t;}},e.prototype.changeProgress=function(e){var t=this.$progressBar;t.css("width",e+"%"),e>=100&&setTimeout((function(){t.hide(),t.css("width","0"),t.show();}),1e3);},e.prototype.changeViewState=function(){var e=this,t=this.editorInstance;zf(this,t),function(e,t){var n,r=t.getConfig().placeholder;if(r){var o=t.isEmpty();if(o&&!e.showPlaceholder&&!e.isComposing){if(null==e.$placeholder){var i=y.default('
    '+r+"
    ");e.$textAreaContainer.append(i),e.$placeholder=i;}return e.$placeholder.show(),void(e.showPlaceholder=!0)}!o&&e.showPlaceholder&&(null===(n=e.$placeholder)||void 0===n||n.hide(),e.showPlaceholder=!1);}}(this,t),Uu((function(){td(e,t);}));},e.prototype.destroy=function(){this.$textAreaContainer.remove();},e}();Si("match",(function(e,t,n){return [function(t){var n=V(this),r=null==t?void 0:Ae(t,e);return r?Te(r,t,n):new RegExp(t)[e](er(n))},function(e){var r=Oe(this),o=er(e),i=n(t,r,o);if(i.done)return i.value;if(!r.global)return ji(r,o);var a=r.unicode;r.lastIndex=0;for(var s,l=[],u=0;null!==(s=ji(r,o));){var c=er(s[0]);l[u]=c,""===c&&(r.lastIndex=Oi(o,Ft(r.lastIndex),a)),u++;}return 0===u?null:l}]}));function pd(e){e.removeAttr("width"),e.removeAttr("height"),e.removeAttr("fill"),e.removeAttr("class"),e.removeAttr("t"),e.removeAttr("p-id");var t=e.children();t.length&&pd(t);}function hd(){return y.default('')}function gd(){return y.default('
    ')}function vd(e,t,n,r,o){if(void 0===o&&(o=!1),t){if(r){var i=As?"cmd":"ctrl";r=r.replace("mod",i);}if(o)r&&(e.attr("data-tooltip",r),e.addClass("w-e-menu-tooltip-v5"),e.addClass("tooltip-right"));else {var a=r?n+"\n"+r:n;e.attr("data-tooltip",a),e.addClass("w-e-menu-tooltip-v5");}}}var yd=function(){function e(e,t,n){var r=this;void 0===n&&(n=!1),this.$elem=y.default('
    '),this.$button=y.default(''),this.disabled=!1,this.menu=t;var o=t.tag,i=t.width;if("button"!==o)throw new Error("Invalid tag '"+o+"', expected 'button'");var a=t.title,s=t.hotkey,l=void 0===s?"":s,u=t.iconSvg,c=void 0===u?"":u,f=this.$button;if(c){var d=y.default(c);pd(d),f.append(d);}else f.text(a);vd(f,c,a,l,n),n&&c&&f.append(y.default(''+a+"")),i&&f.css("width",i+"px"),f.attr("data-menu-key",e),this.$elem.append(f),Uu((function(){return r.init()}));}return e.prototype.init=function(){var e=this;this.setActive(),this.setDisabled(),this.$button.on("click",(function(t){t.preventDefault(),Nd(e).hidePanelOrModal(),e.disabled||(e.exec(),e.onButtonClick());}));},e.prototype.exec=function(){var e=Nd(this),t=this.menu,n=t.getValue(e);t.exec(e,n);},e.prototype.setActive=function(){var e=Nd(this),t=this.$button,n="active";this.menu.isActive(e)?t.addClass(n):t.removeClass(n);},e.prototype.setDisabled=function(){var e=Nd(this),t=this.$button,n=this.menu.isDisabled(e);(null==e.selection||e.isDisabled())&&(n=!0),this.menu.alwaysEnable&&(n=!1);var r="disabled";n?t.addClass(r):t.removeClass(r),this.disabled=n;},e.prototype.changeMenuState=function(){this.setActive(),this.setDisabled();},e}(),md=function(e){function t(t,n,r){return void 0===r&&(r=!1),e.call(this,t,n,r)||this}return Ui(t,e),t.prototype.onButtonClick=function(){},t}(yd),bd=function(){function e(e){this.isShow=!1,this.showTime=0,this.record(e);}return e.prototype.record=function(e){var t=ts.get(e);null==t&&(t=new Set,ts.set(e,t)),t.add(this),ns.set(this,e);},e.prototype.renderContent=function(e){var t=this.$elem;t.empty(),t.append(e);var n=this.genSelfElem();n&&t.append(n);},e.prototype.appendTo=function(e){var t=this.$elem;e.append(t);},e.prototype.show=function(){if(!this.isShow){this.showTime=Date.now(),this.$elem.show(),this.isShow=!0;var e=ns.get(this);e&&e.emit("modalOrPanelShow",this);}},e.prototype.hide=function(){if(this.isShow&&!(Date.now()-this.showTime<200)){this.$elem.hide(),this.isShow=!1;var e=ns.get(this);e&&e.emit("modalOrPanelHide");}},e}(),wd=function(e){function t(t){var n=e.call(this,t)||this;return n.type="dropPanel",n.$elem=y.default('
    '),n}return Ui(t,e),t.prototype.genSelfElem=function(){return null},t}(bd),xd=function(e){function t(t,n,r){void 0===r&&(r=!1);var o=e.call(this,t,n,r)||this;if(o.dropPanel=null,o.menu=n,n.showDropPanel){var i=hd();o.$button.append(i);}return o}return Ui(t,e),t.prototype.onButtonClick=function(){this.menu.showDropPanel&&this.handleDropPanel();},t.prototype.handleDropPanel=function(){var e=this.menu;if(null!=e.getPanelContentElem){var t=Nd(this);if(null==this.dropPanel){var n=new wd(t),r=e.getPanelContentElem(t);n.renderContent(r),n.appendTo(this.$elem),n.show(),this.dropPanel=n;}else {var o=this.dropPanel;if(o.isShow)o.hide();else {r=e.getPanelContentElem(t);o.renderContent(r),o.show();}}var i=this.dropPanel;if(i.isShow){var a=this.$elem,s=a.offset().left,l=a.parents(".w-e-bar");s-l.offset().left>=l.width()/2?i.$elem.css({left:"none",right:"0"}):i.$elem.css({left:"0",right:"none"});}}},t}(yd),Ed=function(e){function t(t,n){void 0===n&&(n=0);var r=e.call(this,t)||this;r.type="modal",r.$elem=y.default('
    '),r.width=0,n&&(r.width=n);var o=r.$elem;return o.on("click",(function(e){return e.stopPropagation()})),o.on("keyup",(function(e){"Escape"===e.code&&(r.hide(),t.restoreSelection());})),r}return Ui(t,e),t.prototype.genSelfElem=function(){var e=this,t=y.default(''),n=ns.get(this);return t.on("click",(function(){e.hide(),null==n||n.restoreSelection();})),t},t.prototype.setStyle=function(e){var t=this.width,n=this.$elem;n.attr("style",""),t&&n.css("width",t+"px"),n.css(e);},t}(bd);var Sd=function(e){function n(t,n,r){void 0===r&&(r=!1);var o=e.call(this,t,n,r)||this;return o.$body=y.default("body"),o.modal=null,o.menu=n,o}return Ui(n,e),n.prototype.onButtonClick=function(){this.menu.showModal&&this.handleModal();},n.prototype.getPosition=function(){var e=Nd(this),n=this.menu.getModalPositionNode(e);return t.Element.isElement(n)?mf(e,n,"modal"):yf(e)},n.prototype.handleModal=function(){var e=Nd(this),t=this.menu;if(null==this.modal){var n=new Ed(e,t.modalWidth);this.renderAndShowModal(n,!0),this.modal=n;}else {(n=this.modal).isShow?n.hide():this.renderAndShowModal(n,!1);}},n.prototype.renderAndShowModal=function(e,t){void 0===t&&(t=!1);var n=Nd(this),r=this.menu;if(null!=r.getModalContentElem){var o=Hs.getTextarea(n),i=Hs.getToolbar(n),a=((null==i?void 0:i.getConfig())||{}).modalAppendToBody,s=r.getModalContentElem(n);if(e.renderContent(s),a)e.setStyle({left:"0",right:"0"});else {var l=this.getPosition();e.setStyle(l);}t&&(a?e.appendTo(this.$body):e.appendTo(o.$textAreaContainer)),e.show(),a||bf(n,e.$elem),setTimeout((function(){n.blur();}));}},n}(yd);var kd=function(e){function t(t,n){var r=e.call(this,t)||this;return r.type="selectList",r.$elem=y.default('
    '),n&&r.$elem.css("width",n+"px"),r.$elem.on("click",(function(e){e.stopPropagation();})),r}return Ui(t,e),t.prototype.renderList=function(e){var t=this.$elem;t.empty();var n=y.default("
      ");e.forEach((function(e){var t=e.value,r=e.text,o=e.selected,i=e.styleForRenderMenuList,a=y.default('
    • ');if(i&&a.css(i),o){var s=y.default('');a.append(s),a.addClass("selected");}a.append(y.default(''+r+"")),a.attr("title",r),n.append(a);})),t.append(n);},t.prototype.genSelfElem=function(){return null},t}(bd);var Od=function(){function e(e,t,n){var r=this;void 0===n&&(n=!1),this.$elem=y.default('
      '),this.$button=y.default(''),this.disabled=!1,this.selectList=null;var o=t.tag,i=t.title,a=t.width,s=t.iconSvg,l=void 0===s?"":s,u=t.hotkey,c=void 0===u?"":u;if("select"!==o)throw new Error("Invalid tag '"+o+"', expected 'select'");var f=this.$button;a&&f.css("width",a+"px"),f.attr("data-menu-key",e),vd(f,l,i,c,n),this.$elem.append(f),this.menu=t,Uu((function(){return r.init()}));}return e.prototype.init=function(){var e=this;this.setSelectedValue(),this.$button.on("click",(function(t){t.preventDefault(),Nd(e).hidePanelOrModal(),e.trigger();}));},e.prototype.trigger=function(){var e=this,t=Nd(this);if(!t.isDisabled()&&!this.disabled){var n=this.menu;if(null==this.selectList){this.selectList=new kd(t,n.selectPanelWidth);var r=this.selectList,o=n.getOptions(t);r.renderList(o),r.appendTo(this.$elem),r.show(),r.$elem.on("click","li",(function(t){var n=t.target;if(null!=n){t.preventDefault();var r=y.default(n).attr("data-value");e.onChange(r);}}));}else {if((r=this.selectList).isShow)r.hide();else {o=n.getOptions(t);r.renderList(o),r.show();}}}},e.prototype.onChange=function(e){var t=Nd(this),n=this.menu;n.exec&&n.exec(t,e);},e.prototype.setSelectedValue=function(){var e=Nd(this),t=this.menu,n=t.getValue(e),r=function(e,t){for(var n=e.length,r="",o=0;o'),this.$container=y.default('
      '),this.$button=y.default('');var t=e.key,n=e.iconSvg,r=e.title,o=this.$elem,i=this.$button;if(n){var a=y.default(n);pd(a),i.append(a);}else i.text(r);i.attr("data-menu-key",t);var s=hd();i.append(s),o.append(i);var l=this.$container;o.append(l);var u=this.createObserver();this.observe(u);}return e.prototype.appendBarItem=function(e){var t=e.$elem;this.$container.append(t);},e.prototype.observe=function(e){var t=this.$container;e.observe(t[0],{childList:!0,subtree:!0,attributes:!0});},e.prototype.createObserver=function(){var e=this,t=this.$container,n=this.$button,r=new MutationObserver((function(){var o=t.find("button"),i=o.length;if(0!==i){var a=0;o.each((function(e){y.default(e).hasClass("disabled")&&a++;})),r.disconnect(),a===i?n.addClass("disabled"):n.removeClass("disabled"),e.observe(r);}}));return r},e}(),Td=new WeakMap;function Nd(e){var t=es.get(e);if(null==t)throw new Error("Can not get editor instance");return t}function Md(e,t,n){void 0===n&&(n=!1);var r=Td.get(t);if(r)return r;var o=t.tag;if("button"===o){var i=t.showDropPanel,a=t.showModal;r=i?new xd(e,t,n):a?new Sd(e,t,n):new md(e,t,n);}if("select"===o&&(r=new Od(e,t,n)),null==r)throw new Error("Invalid tag in menu "+JSON.stringify(t));return Td.set(t,r),r}function Ld(e,n){var r=e.selection;return null!=r&&(!t.Range.isCollapsed(r)&&(!Hs.getSelectedElems(e).some((function(t){if(e.isVoid(t))return !0;var n=t.type;return !!["pre","code","table"].includes(n)||void 0}))&&!!t.Text.isText(n)))}var Pd=function(){function e(){var e=this;this.$elem=y.default('
      '),this.menus={},this.hoverbarItems=[],this.prevSelectedNode=null,this.isShow=!1,this.changeHoverbarState=x.default((function(){var n=e.isShow,r=e.getSelectedNodeAndMenuKeys()||{},o=r.node,i=void 0===o?null:o,a=r.menuKeys,s=void 0===a?[]:a;if((null!=i&&e.changeItemsState(),i&&t.Element.isElement(i))&&(n&&e.isSamePath(i,e.prevSelectedNode)))return;e.hideAndClean(),null!=i&&(e.registerItems(s),e.setPosition(i),e.show()),e.prevSelectedNode=i;}),200),Uu((function(){var t=e.getEditorInstance(),n=e.$elem;n.on("mousedown",(function(e){return e.preventDefault()}),{passive:!1}),Hs.getTextarea(t).$textAreaContainer.append(n),t.on("change",e.changeHoverbarState);var r=e.hideAndClean.bind(e);t.on("scroll",r),t.on("fullScreen",r),t.on("unFullScreen",r);}));}return e.prototype.getMenus=function(){return this.menus},e.prototype.hideAndClean=function(){var e=this.$elem;e.removeClass("w-e-bar-show").addClass("w-e-bar-hidden"),this.hoverbarItems=[],e.empty(),this.isShow=!1;},e.prototype.checkPositionBottom=function(){var e=this.$elem,t=!1,n=window.innerHeight;n&&n>=360&&(n-e[0].getBoundingClientRect().bottom<360&&(t=!0));t?e.addClass("w-e-bar-bottom"):e.removeClass("w-e-bar-bottom");},e.prototype.show=function(){this.$elem.removeClass("w-e-bar-hidden").addClass("w-e-bar-show"),this.isShow=!0,this.checkPositionBottom();},e.prototype.changeItemsState=function(){var e=this;Uu((function(){e.hoverbarItems.forEach((function(e){e.changeMenuState();}));}));},e.prototype.registerItems=function(e){var t=this,n=this.$elem;e.forEach((function(e){if("|"!==e)t.registerSingleItem(e);else {var r=gd();n.append(r);}}));},e.prototype.registerSingleItem=function(e){var t=this.getEditorInstance(),n=this.menus,r=n[e];if(null==r){var o=Us[e];if(null==o)throw new Error("Not found menu item factory by key '"+e+"'");if("function"!=typeof o)throw new Error("Menu item factory (key='"+e+"') is not a function");r=o(),n[e]=r;}var i=Md(e,r);this.hoverbarItems.push(i),es.set(i,t),this.$elem.append(i.$elem);},e.prototype.setPosition=function(e){var n=this.getEditorInstance(),r=this.$elem;if(r.attr("style",""),t.Element.isElement(e)){var o=mf(n,e,"bar");return r.css(o),void bf(n,r)}if(t.Text.isText(e)){o=yf(n);return r.css(o),void bf(n,r)}throw new Error("hoverbar.setPosition error, current selected node is not elem nor text")},e.prototype.getSelectedNodeAndMenuKeys=function(){var e=this.getEditorInstance();if(null==e.selection)return null;var n=this.getHoverbarKeysConf(),r=null,o=[],i=function(i){var a=n[i],s=a.match,l=a.menuKeys,u=void 0===l?[]:l,c=s||function(e,t){return Hs.checkNodeType(t,i)},f=Gi(t.Editor.nodes(e,{match:function(t){return c(e,t)},universal:!0}),1),d=f[0];if(null!=d)return r=d[0],o=u,"break"};for(var a in n){if("break"===i(a))break}return null==r||0===o.length?null:{node:r,menuKeys:o}},e.prototype.getEditorInstance=function(){var e=Qa.get(this);if(null==e)throw new Error("Can not get editor instance");return e},e.prototype.getHoverbarKeysConf=function(){var e=this.getEditorInstance().getConfig().hoverbarKeys,t=void 0===e?{}:e,n=t.text;return n&&null==n.match&&(n.match=Ld),t},e.prototype.isSamePath=function(e,n){if(null==e||null==n)return !1;var r=Hs.findPath(null,e),o=Hs.findPath(null,n);return t.Path.equals(r,o)},e.prototype.destroy=function(){this.changeHoverbarState.cancel(),this.$elem.remove(),this.menus={},this.hoverbarItems=[],this.prevSelectedNode=null;},e}();function Rd(e,n,r,o){if(ss.set(e,n),ls.set(e,r),t.Element.isElement(e)){var i=e.children;if((void 0===i?[]:i).forEach((function(t,n){return Rd(t,n,e,o)})),t.Editor.isVoid(o,e)){var a=Gi(t.Node.texts(e),1),s=Gi(a[0],1)[0];ss.set(s,0),ls.set(s,e);}}}var Dd=qo("splice"),jd=P.TypeError,Ad=Math.max,_d=Math.min,Fd=9007199254740991,Id="Maximum allowed length exceeded";_n({target:"Array",proto:!0,forced:!Dd},{splice:function(e,t){var n,r,o,i,a,s,l=U(this),u=It(l),c=gn(e,u),f=arguments.length;if(0===f?n=r=0:1===f?(n=0,r=u-c):(n=f-2,r=_d(Ad(At(t),0),u-c)),u+n-r>Fd)throw jd(Id);for(o=Yt(l,r),i=0;iu-r+n;i--)delete l[i-1];}else if(n>r)for(i=u-r;i>c;i--)s=i+n-1,(a=i+r-1)in l?l[s]=l[a]:delete l[s];for(i=0;i'),this.menus={},this.toolbarItems=[],this.config={},this.changeToolbarState=x.default((function(){n.toolbarItems.forEach((function(e){e.changeMenuState();}));}),200),this.config=t;var r=y.default(e);if(0===r.length)throw new Error("Cannot find toolbar DOM by selector '"+e+"'");this.$box=r;var o=this.$toolbar;o.on("mousedown",(function(e){return e.preventDefault()}),{passive:!1}),r.append(o),Uu((function(){n.registerItems(),n.changeToolbarState(),n.getEditorInstance().on("change",n.changeToolbarState);}));}return e.prototype.getMenus=function(){return this.menus},e.prototype.getConfig=function(){return this.config},e.prototype.registerItems=function(){var e=this,t="",n=this.$toolbar,r=this.config,o=r.toolbarKeys,i=void 0===o?[]:o,a=r.insertKeys,s=void 0===a?{index:0,keys:[]}:a,l=r.excludeKeys,u=void 0===l?[]:l,c=E.default(i);s.keys.length>0&&("string"==typeof s.keys&&(s.keys=[s.keys]),s.keys.forEach((function(e,t){c.splice(s.index+t,0,e);})));var f=c.filter((function(e){if("string"==typeof e){if(u.includes(e))return !1}else if(u.includes(e.key))return !1;return !0})),d=f.length;f.forEach((function(r,o){if("|"===r){if(0===o)return;if(o+1===d)return;if("|"===t)return;var i=gd();return n.append(i),void(t=r)}if("string"==typeof r)return e.registerSingleItem(r,e),void(t=r);e.registerGroup(r),t="group";}));},e.prototype.registerGroup=function(e){var t=this,n=this.$toolbar,r=function(e){return new Cd(e)}(e),o=e.menuKeys,i=void 0===o?[]:o,a=this.config.excludeKeys,s=void 0===a?[]:a;i.forEach((function(e){s.includes(e)||t.registerSingleItem(e,r);})),n.append(r.$elem);},e.prototype.registerSingleItem=function(e,t){var n=this.getEditorInstance(),r=t instanceof Cd,o=this.menus,i=o[e];if(null==i){var a=Us[e];if(null==a)throw new Error("Not found menu item factory by key '"+e+"'");if("function"!=typeof a)throw new Error("Menu item factory (key='"+e+"') is not a function");i=a(),o[e]=i;}else console.warn("Duplicated toolbar menu key '"+e+"'\n重复注册了菜单栏 menu '"+e+"'");var s=Md(e,i,r);(this.toolbarItems.push(s),es.set(s,n),r)?t.appendBarItem(s):t.$toolbar.append(s.$elem);},e.prototype.getEditorInstance=function(){var e=Ya.get(this);if(null==e)throw new Error("Can not get editor instance");return e},e.prototype.destroy=function(){this.$toolbar.remove(),this.menus={},this.toolbarItems=[];},e}();var $d=ht.EXISTS,Wd=Ve.f,Hd=Function.prototype,Vd=W(Hd.toString),zd=/function\b(?:\s|\/\*[\S\s]*?\*\/|\/\/[^\n\r]*[\n\r]+)*([^\s(/]*)/,Ud=W(zd.exec);ye&&!$d&&Wd(Hd,"name",{configurable:!0,get:function(){try{return Ud(zd,Vd(this))[1]}catch(e){return ""}}});var Kd=T((function(e){function t(n){return "function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?(e.exports=t=function(e){return typeof e},e.exports.default=e.exports,e.exports.__esModule=!0):(e.exports=t=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.default=e.exports,e.exports.__esModule=!0),t(n)}e.exports=t,e.exports.default=e.exports,e.exports.__esModule=!0;})),qd=T((function(e){e.exports=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e},e.exports.default=e.exports,e.exports.__esModule=!0;})),Gd=T((function(e){e.exports=function(e){for(var t=1;t1&&void 0!==arguments[1]?arguments[1]:{};ip.default(this,e),this.init(t,n);}return ap.default(e,[{key:"init",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.prefix=t.prefix||"i18next:",this.logger=e||fp,this.options=t,this.debug=t.debug;}},{key:"setDebug",value:function(e){this.debug=e;}},{key:"log",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n1?t-1:0),r=1;r-1?e.replace(/###/g,"."):e}function o(){return !e||"string"==typeof e}for(var i="string"!=typeof t?[].concat(t):t.split(".");i.length>1;){if(o())return {};var a=r(i.shift());!e[a]&&n&&(e[a]=new n),e=Object.prototype.hasOwnProperty.call(e,a)?e[a]:{};}return o()?{}:{obj:e,k:r(i.shift())}}function bp(e,t,n){var r=mp(e,t,Object);r.obj[r.k]=n;}function wp(e,t){var n=mp(e,t),r=n.obj,o=n.k;if(r)return r[o]}function xp(e,t,n){var r=wp(e,n);return void 0!==r?r:wp(t,n)}function Ep(e,t,n){for(var r in t)"__proto__"!==r&&"constructor"!==r&&(r in e?"string"==typeof e[r]||e[r]instanceof String||"string"==typeof t[r]||t[r]instanceof String?n&&(e[r]=t[r]):Ep(e[r],t[r],n):e[r]=t[r]);return e}function Sp(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var kp={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};function Op(e){return "string"==typeof e?e.replace(/[&<>"'\/]/g,(function(e){return kp[e]})):e}var Cp="undefined"!=typeof window&&window.navigator&&window.navigator.userAgent&&window.navigator.userAgent.indexOf("MSIE")>-1;function Tp(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:".";if(e){if(e[t])return e[t];for(var r=t.split(n),o=e,i=0;ii+a;)a++,l=o[s=r.slice(i,i+a).join(n)];if(void 0===l)return;if("string"==typeof l)return l;if(s&&"string"==typeof l[s])return l[s];var u=r.slice(i+a).join(n);return u?Tp(l,u,n):void 0}o=o[r[i]];}return o}}var Np=function(e){function t(e){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{ns:["translation"],defaultNS:"translation"};return ip.default(this,t),n=sp.default(this,lp.default(t).call(this)),Cp&&hp.call(up.default(n)),n.data=e||{},n.options=r,void 0===n.options.keySeparator&&(n.options.keySeparator="."),void 0===n.options.ignoreJSONStructure&&(n.options.ignoreJSONStructure=!0),n}return cp.default(t,e),ap.default(t,[{key:"addNamespaces",value:function(e){this.options.ns.indexOf(e)<0&&this.options.ns.push(e);}},{key:"removeNamespaces",value:function(e){var t=this.options.ns.indexOf(e);t>-1&&this.options.ns.splice(t,1);}},{key:"getResource",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=void 0!==r.keySeparator?r.keySeparator:this.options.keySeparator,i=void 0!==r.ignoreJSONStructure?r.ignoreJSONStructure:this.options.ignoreJSONStructure,a=[e,t];n&&"string"!=typeof n&&(a=a.concat(n)),n&&"string"==typeof n&&(a=a.concat(o?n.split(o):n)),e.indexOf(".")>-1&&(a=e.split("."));var s=wp(this.data,a);return s||!i||"string"!=typeof n?s:Tp(this.data&&this.data[e]&&this.data[e][t],n,o)}},{key:"addResource",value:function(e,t,n,r){var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{silent:!1},i=this.options.keySeparator;void 0===i&&(i=".");var a=[e,t];n&&(a=a.concat(i?n.split(i):n)),e.indexOf(".")>-1&&(r=t,t=(a=e.split("."))[1]),this.addNamespaces(t),bp(this.data,a,r),o.silent||this.emit("added",e,t,n,r);}},{key:"addResources",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{silent:!1};for(var o in n)"string"!=typeof n[o]&&"[object Array]"!==Object.prototype.toString.apply(n[o])||this.addResource(e,t,o,n[o],{silent:!0});r.silent||this.emit("added",e,t,n);}},{key:"addResourceBundle",value:function(e,t,n,r,o){var i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{silent:!1},a=[e,t];e.indexOf(".")>-1&&(r=n,n=t,t=(a=e.split("."))[1]),this.addNamespaces(t);var s=wp(this.data,a)||{};r?Ep(s,n,o):s=op.default({},s,n),bp(this.data,a,s),i.silent||this.emit("added",e,t,n);}},{key:"removeResourceBundle",value:function(e,t){this.hasResourceBundle(e,t)&&delete this.data[e][t],this.removeNamespaces(t),this.emit("removed",e,t);}},{key:"hasResourceBundle",value:function(e,t){return void 0!==this.getResource(e,t)}},{key:"getResourceBundle",value:function(e,t){return t||(t=this.options.defaultNS),"v1"===this.options.compatibilityAPI?op.default({},{},this.getResource(e,t)):this.getResource(e,t)}},{key:"getDataByLanguage",value:function(e){return this.data[e]}},{key:"toJSON",value:function(){return this.data}}]),t}(hp),Mp={processors:{},addPostProcessor:function(e){this.processors[e.name]=e;},handle:function(e,t,n,r,o){var i=this;return e.forEach((function(e){i.processors[e]&&(t=i.processors[e].process(t,n,r,o));})),t}},Lp={},Pp=function(e){function t(e){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return ip.default(this,t),n=sp.default(this,lp.default(t).call(this)),Cp&&hp.call(up.default(n)),yp(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,up.default(n)),n.options=r,void 0===n.options.keySeparator&&(n.options.keySeparator="."),n.logger=pp.create("translator"),n}return cp.default(t,e),ap.default(t,[{key:"changeLanguage",value:function(e){e&&(this.language=e);}},{key:"exists",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{interpolation:{}};if(null==e)return !1;var n=this.resolve(e,t);return n&&void 0!==n.res}},{key:"extractFromKey",value:function(e,t){var n=void 0!==t.nsSeparator?t.nsSeparator:this.options.nsSeparator;void 0===n&&(n=":");var r=void 0!==t.keySeparator?t.keySeparator:this.options.keySeparator,o=t.ns||this.options.defaultNS;if(n&&e.indexOf(n)>-1){var i=e.match(this.interpolator.nestingRegexp);if(i&&i.length>0)return {key:e,namespaces:o};var a=e.split(n);(n!==r||n===r&&this.options.ns.indexOf(a[0])>-1)&&(o=a.shift()),e=a.join(r);}return "string"==typeof o&&(o=[o]),{key:e,namespaces:o}}},{key:"translate",value:function(e,n,r){var o=this;if("object"!==rp.default(n)&&this.options.overloadTranslationOptionHandler&&(n=this.options.overloadTranslationOptionHandler(arguments)),n||(n={}),null==e)return "";Array.isArray(e)||(e=[String(e)]);var i=void 0!==n.keySeparator?n.keySeparator:this.options.keySeparator,a=this.extractFromKey(e[e.length-1],n),s=a.key,l=a.namespaces,u=l[l.length-1],c=n.lng||this.language,f=n.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(c&&"cimode"===c.toLowerCase()){if(f){var d=n.nsSeparator||this.options.nsSeparator;return u+d+s}return s}var p=this.resolve(e,n),h=p&&p.res,g=p&&p.usedKey||s,v=p&&p.exactUsedKey||s,y=Object.prototype.toString.apply(h),m=["[object Number]","[object Function]","[object RegExp]"],b=void 0!==n.joinArrays?n.joinArrays:this.options.joinArrays,w=!this.i18nFormat||this.i18nFormat.handleAsObject,x="string"!=typeof h&&"boolean"!=typeof h&&"number"!=typeof h;if(w&&h&&x&&m.indexOf(y)<0&&("string"!=typeof b||"[object Array]"!==y)){if(!n.returnObjects&&!this.options.returnObjects)return this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!"),this.options.returnedObjectHandler?this.options.returnedObjectHandler(g,h,op.default({},n,{ns:l})):"key '".concat(s," (").concat(this.language,")' returned an object instead of string.");if(i){var E="[object Array]"===y,S=E?[]:{},k=E?v:g;for(var O in h)if(Object.prototype.hasOwnProperty.call(h,O)){var C="".concat(k).concat(i).concat(O);S[O]=this.translate(C,op.default({},n,{joinArrays:!1,ns:l})),S[O]===C&&(S[O]=h[O]);}h=S;}}else if(w&&"string"==typeof b&&"[object Array]"===y)(h=h.join(b))&&(h=this.extendTranslation(h,e,n,r));else {var T=!1,N=!1,M=void 0!==n.count&&"string"!=typeof n.count,L=t.hasDefaultValue(n),P=M?this.pluralResolver.getSuffix(c,n.count):"",R=n["defaultValue".concat(P)]||n.defaultValue;!this.isValidLookup(h)&&L&&(T=!0,h=R),this.isValidLookup(h)||(N=!0,h=s);var D=n.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey,j=D&&N?void 0:h,A=L&&R!==h&&this.options.updateMissing;if(N||T||A){if(this.logger.log(A?"updateKey":"missingKey",c,u,s,A?R:h),i){var _=this.resolve(s,op.default({},n,{keySeparator:!1}));_&&_.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.");}var F=[],I=this.languageUtils.getFallbackCodes(this.options.fallbackLng,n.lng||this.language);if("fallback"===this.options.saveMissingTo&&I&&I[0])for(var B=0;B1&&void 0!==arguments[1]?arguments[1]:{};return "string"==typeof e&&(e=[e]),e.forEach((function(e){if(!a.isValidLookup(t)){var l=a.extractFromKey(e,s),u=l.key;n=u;var c=l.namespaces;a.options.fallbackNS&&(c=c.concat(a.options.fallbackNS));var f=void 0!==s.count&&"string"!=typeof s.count,d=void 0!==s.context&&("string"==typeof s.context||"number"==typeof s.context)&&""!==s.context,p=s.lngs?s.lngs:a.languageUtils.toResolveHierarchy(s.lng||a.language,s.fallbackLng);c.forEach((function(e){a.isValidLookup(t)||(i=e,!Lp["".concat(p[0],"-").concat(e)]&&a.utils&&a.utils.hasLoadedNamespace&&!a.utils.hasLoadedNamespace(i)&&(Lp["".concat(p[0],"-").concat(e)]=!0,a.logger.warn('key "'.concat(n,'" for languages "').concat(p.join(", "),'" won\'t get resolved as namespace "').concat(i,'" was not yet loaded'),"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),p.forEach((function(n){if(!a.isValidLookup(t)){o=n;var i,l,c=u,p=[c];if(a.i18nFormat&&a.i18nFormat.addLookupKeys)a.i18nFormat.addLookupKeys(p,u,n,e,s);else f&&(i=a.pluralResolver.getSuffix(n,s.count)),f&&d&&p.push(c+i),d&&p.push(c+="".concat(a.options.contextSeparator).concat(s.context)),f&&p.push(c+=i);for(;l=p.pop();)a.isValidLookup(t)||(r=l,t=a.getResource(n,e,l,s));}})));}));}})),{res:t,usedKey:n,exactUsedKey:r,usedLng:o,usedNS:i}}},{key:"isValidLookup",value:function(e){return !(void 0===e||!this.options.returnNull&&null===e||!this.options.returnEmptyString&&""===e)}},{key:"getResource",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(e,t,n,r):this.resourceStore.getResource(e,t,n,r)}}],[{key:"hasDefaultValue",value:function(e){var t="defaultValue";for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t===n.substring(0,t.length)&&void 0!==e[n])return !0;return !1}}]),t}(hp);function Rp(e){return e.charAt(0).toUpperCase()+e.slice(1)}var Dp=function(){function e(t){ip.default(this,e),this.options=t,this.whitelist=this.options.supportedLngs||!1,this.supportedLngs=this.options.supportedLngs||!1,this.logger=pp.create("languageUtils");}return ap.default(e,[{key:"getScriptPartFromCode",value:function(e){if(!e||e.indexOf("-")<0)return null;var t=e.split("-");return 2===t.length?null:(t.pop(),"x"===t[t.length-1].toLowerCase()?null:this.formatLanguageCode(t.join("-")))}},{key:"getLanguagePartFromCode",value:function(e){if(!e||e.indexOf("-")<0)return e;var t=e.split("-");return this.formatLanguageCode(t[0])}},{key:"formatLanguageCode",value:function(e){if("string"==typeof e&&e.indexOf("-")>-1){var t=["hans","hant","latn","cyrl","cans","mong","arab"],n=e.split("-");return this.options.lowerCaseLng?n=n.map((function(e){return e.toLowerCase()})):2===n.length?(n[0]=n[0].toLowerCase(),n[1]=n[1].toUpperCase(),t.indexOf(n[1].toLowerCase())>-1&&(n[1]=Rp(n[1].toLowerCase()))):3===n.length&&(n[0]=n[0].toLowerCase(),2===n[1].length&&(n[1]=n[1].toUpperCase()),"sgn"!==n[0]&&2===n[2].length&&(n[2]=n[2].toUpperCase()),t.indexOf(n[1].toLowerCase())>-1&&(n[1]=Rp(n[1].toLowerCase())),t.indexOf(n[2].toLowerCase())>-1&&(n[2]=Rp(n[2].toLowerCase()))),n.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}},{key:"isWhitelisted",value:function(e){return this.logger.deprecate("languageUtils.isWhitelisted",'function "isWhitelisted" will be renamed to "isSupportedCode" in the next major - please make sure to rename it\'s usage asap.'),this.isSupportedCode(e)}},{key:"isSupportedCode",value:function(e){return ("languageOnly"===this.options.load||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}},{key:"getBestMatchFromCodes",value:function(e){var t,n=this;return e?(e.forEach((function(e){if(!t){var r=n.formatLanguageCode(e);n.options.supportedLngs&&!n.isSupportedCode(r)||(t=r);}})),!t&&this.options.supportedLngs&&e.forEach((function(e){if(!t){var r=n.getLanguagePartFromCode(e);if(n.isSupportedCode(r))return t=r;t=n.options.supportedLngs.find((function(e){if(0===e.indexOf(r))return e}));}})),t||(t=this.getFallbackCodes(this.options.fallbackLng)[0]),t):null}},{key:"getFallbackCodes",value:function(e,t){if(!e)return [];if("function"==typeof e&&(e=e(t)),"string"==typeof e&&(e=[e]),"[object Array]"===Object.prototype.toString.apply(e))return e;if(!t)return e.default||[];var n=e[t];return n||(n=e[this.getScriptPartFromCode(t)]),n||(n=e[this.formatLanguageCode(t)]),n||(n=e[this.getLanguagePartFromCode(t)]),n||(n=e.default),n||[]}},{key:"toResolveHierarchy",value:function(e,t){var n=this,r=this.getFallbackCodes(t||this.options.fallbackLng||[],e),o=[],i=function(e){e&&(n.isSupportedCode(e)?o.push(e):n.logger.warn("rejecting language code not found in supportedLngs: ".concat(e)));};return "string"==typeof e&&e.indexOf("-")>-1?("languageOnly"!==this.options.load&&i(this.formatLanguageCode(e)),"languageOnly"!==this.options.load&&"currentOnly"!==this.options.load&&i(this.getScriptPartFromCode(e)),"currentOnly"!==this.options.load&&i(this.getLanguagePartFromCode(e))):"string"==typeof e&&i(this.formatLanguageCode(e)),r.forEach((function(e){o.indexOf(e)<0&&i(n.formatLanguageCode(e));})),o}}]),e}(),jp=[{lngs:["ach","ak","am","arn","br","fil","gun","ln","mfe","mg","mi","oc","pt","pt-BR","tg","tl","ti","tr","uz","wa"],nr:[1,2],fc:1},{lngs:["af","an","ast","az","bg","bn","ca","da","de","dev","el","en","eo","es","et","eu","fi","fo","fur","fy","gl","gu","ha","hi","hu","hy","ia","it","kk","kn","ku","lb","mai","ml","mn","mr","nah","nap","nb","ne","nl","nn","no","nso","pa","pap","pms","ps","pt-PT","rm","sco","se","si","so","son","sq","sv","sw","ta","te","tk","ur","yo"],nr:[1,2],fc:2},{lngs:["ay","bo","cgg","fa","ht","id","ja","jbo","ka","km","ko","ky","lo","ms","sah","su","th","tt","ug","vi","wo","zh"],nr:[1],fc:3},{lngs:["be","bs","cnr","dz","hr","ru","sr","uk"],nr:[1,2,5],fc:4},{lngs:["ar"],nr:[0,1,2,3,11,100],fc:5},{lngs:["cs","sk"],nr:[1,2,5],fc:6},{lngs:["csb","pl"],nr:[1,2,5],fc:7},{lngs:["cy"],nr:[1,2,3,8],fc:8},{lngs:["fr"],nr:[1,2],fc:9},{lngs:["ga"],nr:[1,2,3,7,11],fc:10},{lngs:["gd"],nr:[1,2,3,20],fc:11},{lngs:["is"],nr:[1,2],fc:12},{lngs:["jv"],nr:[0,1],fc:13},{lngs:["kw"],nr:[1,2,3,4],fc:14},{lngs:["lt"],nr:[1,2,10],fc:15},{lngs:["lv"],nr:[1,2,0],fc:16},{lngs:["mk"],nr:[1,2],fc:17},{lngs:["mnk"],nr:[0,1,2],fc:18},{lngs:["mt"],nr:[1,2,11,20],fc:19},{lngs:["or"],nr:[2,1],fc:2},{lngs:["ro"],nr:[1,2,20],fc:20},{lngs:["sl"],nr:[5,1,2,3],fc:21},{lngs:["he","iw"],nr:[1,2,20,21],fc:22}],Ap={1:function(e){return Number(e>1)},2:function(e){return Number(1!=e)},3:function(e){return 0},4:function(e){return Number(e%10==1&&e%100!=11?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2)},5:function(e){return Number(0==e?0:1==e?1:2==e?2:e%100>=3&&e%100<=10?3:e%100>=11?4:5)},6:function(e){return Number(1==e?0:e>=2&&e<=4?1:2)},7:function(e){return Number(1==e?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2)},8:function(e){return Number(1==e?0:2==e?1:8!=e&&11!=e?2:3)},9:function(e){return Number(e>=2)},10:function(e){return Number(1==e?0:2==e?1:e<7?2:e<11?3:4)},11:function(e){return Number(1==e||11==e?0:2==e||12==e?1:e>2&&e<20?2:3)},12:function(e){return Number(e%10!=1||e%100==11)},13:function(e){return Number(0!==e)},14:function(e){return Number(1==e?0:2==e?1:3==e?2:3)},15:function(e){return Number(e%10==1&&e%100!=11?0:e%10>=2&&(e%100<10||e%100>=20)?1:2)},16:function(e){return Number(e%10==1&&e%100!=11?0:0!==e?1:2)},17:function(e){return Number(1==e||e%10==1&&e%100!=11?0:1)},18:function(e){return Number(0==e?0:1==e?1:2)},19:function(e){return Number(1==e?0:0==e||e%100>1&&e%100<11?1:e%100>10&&e%100<20?2:3)},20:function(e){return Number(1==e?0:0==e||e%100>0&&e%100<20?1:2)},21:function(e){return Number(e%100==1?1:e%100==2?2:e%100==3||e%100==4?3:0)},22:function(e){return Number(1==e?0:2==e?1:(e<0||e>10)&&e%10==0?2:3)}};function _p(){var e={};return jp.forEach((function(t){t.lngs.forEach((function(n){e[n]={numbers:t.nr,plurals:Ap[t.fc]};}));})),e}var Fp=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};ip.default(this,e),this.languageUtils=t,this.options=n,this.logger=pp.create("pluralResolver"),this.rules=_p();}return ap.default(e,[{key:"addRule",value:function(e,t){this.rules[e]=t;}},{key:"getRule",value:function(e){return this.rules[e]||this.rules[this.languageUtils.getLanguagePartFromCode(e)]}},{key:"needsPlural",value:function(e){var t=this.getRule(e);return t&&t.numbers.length>1}},{key:"getPluralFormsOfKey",value:function(e,t){return this.getSuffixes(e).map((function(e){return t+e}))}},{key:"getSuffixes",value:function(e){var t=this,n=this.getRule(e);return n?n.numbers.map((function(n){return t.getSuffix(e,n)})):[]}},{key:"getSuffix",value:function(e,t){var n=this,r=this.getRule(e);if(r){var o=r.noAbs?r.plurals(t):r.plurals(Math.abs(t)),i=r.numbers[o];this.options.simplifyPluralSuffix&&2===r.numbers.length&&1===r.numbers[0]&&(2===i?i="plural":1===i&&(i=""));var a=function(){return n.options.prepend&&i.toString()?n.options.prepend+i.toString():i.toString()};return "v1"===this.options.compatibilityJSON?1===i?"":"number"==typeof i?"_plural_".concat(i.toString()):a():"v2"===this.options.compatibilityJSON||this.options.simplifyPluralSuffix&&2===r.numbers.length&&1===r.numbers[0]?a():this.options.prepend&&o.toString()?this.options.prepend+o.toString():o.toString()}return this.logger.warn("no plural rule found for: ".concat(e)),""}}]),e}(),Ip=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};ip.default(this,e),this.logger=pp.create("interpolator"),this.options=t,this.format=t.interpolation&&t.interpolation.format||function(e){return e},this.init(t);}return ap.default(e,[{key:"init",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e.interpolation||(e.interpolation={escapeValue:!0});var t=e.interpolation;this.escape=void 0!==t.escape?t.escape:Op,this.escapeValue=void 0===t.escapeValue||t.escapeValue,this.useRawValueToEscape=void 0!==t.useRawValueToEscape&&t.useRawValueToEscape,this.prefix=t.prefix?Sp(t.prefix):t.prefixEscaped||"{{",this.suffix=t.suffix?Sp(t.suffix):t.suffixEscaped||"}}",this.formatSeparator=t.formatSeparator?t.formatSeparator:t.formatSeparator||",",this.unescapePrefix=t.unescapeSuffix?"":t.unescapePrefix||"-",this.unescapeSuffix=this.unescapePrefix?"":t.unescapeSuffix||"",this.nestingPrefix=t.nestingPrefix?Sp(t.nestingPrefix):t.nestingPrefixEscaped||Sp("$t("),this.nestingSuffix=t.nestingSuffix?Sp(t.nestingSuffix):t.nestingSuffixEscaped||Sp(")"),this.nestingOptionsSeparator=t.nestingOptionsSeparator?t.nestingOptionsSeparator:t.nestingOptionsSeparator||",",this.maxReplaces=t.maxReplaces?t.maxReplaces:1e3,this.alwaysFormat=void 0!==t.alwaysFormat&&t.alwaysFormat,this.resetRegExp();}},{key:"reset",value:function(){this.options&&this.init(this.options);}},{key:"resetRegExp",value:function(){var e="".concat(this.prefix,"(.+?)").concat(this.suffix);this.regexp=new RegExp(e,"g");var t="".concat(this.prefix).concat(this.unescapePrefix,"(.+?)").concat(this.unescapeSuffix).concat(this.suffix);this.regexpUnescape=new RegExp(t,"g");var n="".concat(this.nestingPrefix,"(.+?)").concat(this.nestingSuffix);this.nestingRegexp=new RegExp(n,"g");}},{key:"interpolate",value:function(e,t,n,r){var o,i,a,s=this,l=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{};function u(e){return e.replace(/\$/g,"$$$$")}var c=function(e){if(e.indexOf(s.formatSeparator)<0){var o=xp(t,l,e);return s.alwaysFormat?s.format(o,void 0,n,op.default({},r,t,{interpolationkey:e})):o}var i=e.split(s.formatSeparator),a=i.shift().trim(),u=i.join(s.formatSeparator).trim();return s.format(xp(t,l,a),u,n,op.default({},r,t,{interpolationkey:a}))};this.resetRegExp();var f=r&&r.missingInterpolationHandler||this.options.missingInterpolationHandler,d=r&&r.interpolation&&r.interpolation.skipOnVariables||this.options.interpolation.skipOnVariables;return [{regex:this.regexpUnescape,safeValue:function(e){return u(e)}},{regex:this.regexp,safeValue:function(e){return s.escapeValue?u(s.escape(e)):u(e)}}].forEach((function(t){for(a=0;o=t.regex.exec(e);){if(void 0===(i=c(o[1].trim())))if("function"==typeof f){var n=f(e,o,r);i="string"==typeof n?n:"";}else {if(d){i=o[0];continue}s.logger.warn("missed to pass in variable ".concat(o[1]," for interpolating ").concat(e)),i="";}else "string"==typeof i||s.useRawValueToEscape||(i=vp(i));var l=t.safeValue(i);if(e=e.replace(o[0],l),d?(t.regex.lastIndex+=l.length,t.regex.lastIndex-=o[0].length):t.regex.lastIndex=0,++a>=s.maxReplaces)break}})),e}},{key:"nest",value:function(e,t){var n,r,o=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=op.default({},i);function s(e,t){var n=this.nestingOptionsSeparator;if(e.indexOf(n)<0)return e;var r=e.split(new RegExp("".concat(n,"[ ]*{"))),o="{".concat(r[1]);e=r[0],o=(o=this.interpolate(o,a)).replace(/'/g,'"');try{a=JSON.parse(o),t&&(a=op.default({},t,a));}catch(t){return this.logger.warn("failed parsing options string in nesting for key ".concat(e),t),"".concat(e).concat(n).concat(o)}return delete a.defaultValue,e}for(a.applyPostProcessor=!1,delete a.defaultValue;n=this.nestingRegexp.exec(e);){var l=[],u=!1;if(-1!==n[0].indexOf(this.formatSeparator)&&!/{.*}/.test(n[1])){var c=n[1].split(this.formatSeparator).map((function(e){return e.trim()}));n[1]=c.shift(),l=c,u=!0;}if((r=t(s.call(this,n[1].trim(),a),a))&&n[0]===e&&"string"!=typeof r)return r;"string"!=typeof r&&(r=vp(r)),r||(this.logger.warn("missed to resolve ".concat(n[1]," for nesting ").concat(e)),r=""),u&&(r=l.reduce((function(e,t){return o.format(e,t,i.lng,op.default({},i,{interpolationkey:n[1].trim()}))}),r.trim())),e=e.replace(n[0],r),this.regexp.lastIndex=0;}return e}}]),e}();var Bp=function(e){function t(e,n,r){var o,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return ip.default(this,t),o=sp.default(this,lp.default(t).call(this)),Cp&&hp.call(up.default(o)),o.backend=e,o.store=n,o.services=r,o.languageUtils=r.languageUtils,o.options=i,o.logger=pp.create("backendConnector"),o.state={},o.queue=[],o.backend&&o.backend.init&&o.backend.init(r,i.backend,i),o}return cp.default(t,e),ap.default(t,[{key:"queueLoad",value:function(e,t,n,r){var o=this,i=[],a=[],s=[],l=[];return e.forEach((function(e){var r=!0;t.forEach((function(t){var s="".concat(e,"|").concat(t);!n.reload&&o.store.hasResourceBundle(e,t)?o.state[s]=2:o.state[s]<0||(1===o.state[s]?a.indexOf(s)<0&&a.push(s):(o.state[s]=1,r=!1,a.indexOf(s)<0&&a.push(s),i.indexOf(s)<0&&i.push(s),l.indexOf(t)<0&&l.push(t)));})),r||s.push(e);})),(i.length||a.length)&&this.queue.push({pending:a,loaded:{},errors:[],callback:r}),{toLoad:i,pending:a,toLoadLanguages:s,toLoadNamespaces:l}}},{key:"loaded",value:function(e,t,n){var r=e.split("|"),o=r[0],i=r[1];t&&this.emit("failedLoading",o,i,t),n&&this.store.addResourceBundle(o,i,n),this.state[e]=t?-1:2;var a={};this.queue.forEach((function(n){!function(e,t,n,r){var o=mp(e,t,Object),i=o.obj,a=o.k;i[a]=i[a]||[],r&&(i[a]=i[a].concat(n)),r||i[a].push(n);}(n.loaded,[o],i),function(e,t){for(var n=e.indexOf(t);-1!==n;)e.splice(n,1),n=e.indexOf(t);}(n.pending,e),t&&n.errors.push(t),0!==n.pending.length||n.done||(Object.keys(n.loaded).forEach((function(e){a[e]||(a[e]=[]),n.loaded[e].length&&n.loaded[e].forEach((function(t){a[e].indexOf(t)<0&&a[e].push(t);}));})),n.done=!0,n.errors.length?n.callback(n.errors):n.callback());})),this.emit("loaded",a),this.queue=this.queue.filter((function(e){return !e.done}));}},{key:"read",value:function(e,t,n){var r=this,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:350,a=arguments.length>5?arguments[5]:void 0;return e.length?this.backend[n](e,t,(function(s,l){s&&l&&o<5?setTimeout((function(){r.read.call(r,e,t,n,o+1,2*i,a);}),i):a(s,l);})):a(null,{})}},{key:"prepareLoading",value:function(e,t){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),o&&o();"string"==typeof e&&(e=this.languageUtils.toResolveHierarchy(e)),"string"==typeof t&&(t=[t]);var i=this.queueLoad(e,t,r,o);if(!i.toLoad.length)return i.pending.length||o(),null;i.toLoad.forEach((function(e){n.loadOne(e);}));}},{key:"load",value:function(e,t,n){this.prepareLoading(e,t,{},n);}},{key:"reload",value:function(e,t,n){this.prepareLoading(e,t,{reload:!0},n);}},{key:"loadOne",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=e.split("|"),o=r[0],i=r[1];this.read(o,i,"read",void 0,void 0,(function(r,a){r&&t.logger.warn("".concat(n,"loading namespace ").concat(i," for language ").concat(o," failed"),r),!r&&a&&t.logger.log("".concat(n,"loaded namespace ").concat(i," for language ").concat(o),a),t.loaded(e,r,a);}));}},{key:"saveMissing",value:function(e,t,n,r,o){var i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{};this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(t)?this.logger.warn('did not save key "'.concat(n,'" as the namespace "').concat(t,'" was not yet loaded'),"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!"):null!=n&&""!==n&&(this.backend&&this.backend.create&&this.backend.create(e,t,n,r,null,op.default({},i,{isUpdate:o})),e&&e[0]&&this.store.addResource(e[0],t,n,r));}}]),t}(hp);function $p(){return {debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,whitelist:!1,nonExplicitWhitelist:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!0,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:function(e){var t={};if("object"===rp.default(e[1])&&(t=e[1]),"string"==typeof e[1]&&(t.defaultValue=e[1]),"string"==typeof e[2]&&(t.tDescription=e[2]),"object"===rp.default(e[2])||"object"===rp.default(e[3])){var n=e[3]||e[2];Object.keys(n).forEach((function(e){t[e]=n[e];}));}return t},interpolation:{escapeValue:!0,format:function(e,t,n,r){return e},prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!1}}}function Wp(e){return "string"==typeof e.ns&&(e.ns=[e.ns]),"string"==typeof e.fallbackLng&&(e.fallbackLng=[e.fallbackLng]),"string"==typeof e.fallbackNS&&(e.fallbackNS=[e.fallbackNS]),e.whitelist&&(e.whitelist&&e.whitelist.indexOf("cimode")<0&&(e.whitelist=e.whitelist.concat(["cimode"])),e.supportedLngs=e.whitelist),e.nonExplicitWhitelist&&(e.nonExplicitSupportedLngs=e.nonExplicitWhitelist),e.supportedLngs&&e.supportedLngs.indexOf("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),e}function Hp(){}var Vp=function(e){function t(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;if(ip.default(this,t),e=sp.default(this,lp.default(t).call(this)),Cp&&hp.call(up.default(e)),e.options=Wp(n),e.services={},e.logger=pp,e.modules={external:[]},r&&!e.isInitialized&&!n.isClone){if(!e.options.initImmediate)return e.init(n,r),sp.default(e,up.default(e));setTimeout((function(){e.init(n,r);}),0);}return e}return cp.default(t,e),ap.default(t,[{key:"init",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;function r(e){return e?"function"==typeof e?new e:e:null}if("function"==typeof t&&(n=t,t={}),t.whitelist&&!t.supportedLngs&&this.logger.deprecate("whitelist",'option "whitelist" will be renamed to "supportedLngs" in the next major - please make sure to rename this option asap.'),t.nonExplicitWhitelist&&!t.nonExplicitSupportedLngs&&this.logger.deprecate("whitelist",'options "nonExplicitWhitelist" will be renamed to "nonExplicitSupportedLngs" in the next major - please make sure to rename this option asap.'),this.options=op.default({},$p(),this.options,Wp(t)),this.format=this.options.interpolation.format,n||(n=Hp),!this.options.isClone){this.modules.logger?pp.init(r(this.modules.logger),this.options):pp.init(null,this.options);var o=new Dp(this.options);this.store=new Np(this.options.resources,this.options);var i=this.services;i.logger=pp,i.resourceStore=this.store,i.languageUtils=o,i.pluralResolver=new Fp(o,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),i.interpolator=new Ip(this.options),i.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},i.backendConnector=new Bp(r(this.modules.backend),i.resourceStore,i,this.options),i.backendConnector.on("*",(function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o1?n-1:0),o=1;o0&&"dev"!==a[0]&&(this.options.lng=a[0]);}this.services.languageDetector||this.options.lng||this.logger.warn("init: no languageDetector is used and no lng is defined");var s=["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"];s.forEach((function(t){e[t]=function(){var n;return (n=e.store)[t].apply(n,arguments)};}));var l=["addResource","addResources","addResourceBundle","removeResourceBundle"];l.forEach((function(t){e[t]=function(){var n;return (n=e.store)[t].apply(n,arguments),e};}));var u=gp(),c=function(){var t=function(t,r){e.isInitialized&&!e.initializedStoreOnce&&e.logger.warn("init: i18next is already initialized. You should call init just once!"),e.isInitialized=!0,e.options.isClone||e.logger.log("initialized",e.options),e.emit("initialized",e.options),u.resolve(r),n(t,r);};if(e.languages&&"v1"!==e.options.compatibilityAPI&&!e.isInitialized)return t(null,e.t.bind(e));e.changeLanguage(e.options.lng,t);};return this.options.resources||!this.options.initImmediate?c():setTimeout(c,0),u}},{key:"loadResources",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Hp,r=n,o="string"==typeof e?e:this.language;if("function"==typeof e&&(r=e),!this.options.resources||this.options.partialBundledLanguages){if(o&&"cimode"===o.toLowerCase())return r();var i=[],a=function(e){e&&t.services.languageUtils.toResolveHierarchy(e).forEach((function(e){i.indexOf(e)<0&&i.push(e);}));};if(o)a(o);else {var s=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);s.forEach((function(e){return a(e)}));}this.options.preload&&this.options.preload.forEach((function(e){return a(e)})),this.services.backendConnector.load(i,this.options.ns,r);}else r(null);}},{key:"reloadResources",value:function(e,t,n){var r=gp();return e||(e=this.languages),t||(t=this.options.ns),n||(n=Hp),this.services.backendConnector.reload(e,t,(function(e){r.resolve(),n(e);})),r}},{key:"use",value:function(e){if(!e)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return "backend"===e.type&&(this.modules.backend=e),("logger"===e.type||e.log&&e.warn&&e.error)&&(this.modules.logger=e),"languageDetector"===e.type&&(this.modules.languageDetector=e),"i18nFormat"===e.type&&(this.modules.i18nFormat=e),"postProcessor"===e.type&&Mp.addPostProcessor(e),"3rdParty"===e.type&&this.modules.external.push(e),this}},{key:"changeLanguage",value:function(e,t){var n=this;this.isLanguageChangingTo=e;var r=gp();this.emit("languageChanging",e);var o=function(o){e||o||!n.services.languageDetector||(o=[]);var i="string"==typeof o?o:n.services.languageUtils.getBestMatchFromCodes(o);i&&(n.language||(n.language=i,n.languages=n.services.languageUtils.toResolveHierarchy(i)),n.translator.language||n.translator.changeLanguage(i),n.services.languageDetector&&n.services.languageDetector.cacheUserLanguage(i)),n.loadResources(i,(function(e){!function(e,o){o?(n.language=o,n.languages=n.services.languageUtils.toResolveHierarchy(o),n.translator.changeLanguage(o),n.isLanguageChangingTo=void 0,n.emit("languageChanged",o),n.logger.log("languageChanged",o)):n.isLanguageChangingTo=void 0,r.resolve((function(){return n.t.apply(n,arguments)})),t&&t(e,(function(){return n.t.apply(n,arguments)}));}(e,i);}));};return e||!this.services.languageDetector||this.services.languageDetector.async?!e&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect(o):o(e):o(this.services.languageDetector.detect()),r}},{key:"getFixedT",value:function(e,t,n){var r=this,o=function e(t,o){var i;if("object"!==rp.default(o)){for(var a=arguments.length,s=new Array(a>2?a-2:0),l=2;l1&&void 0!==arguments[1]?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;var r=this.languages[0],o=!!this.options&&this.options.fallbackLng,i=this.languages[this.languages.length-1];if("cimode"===r.toLowerCase())return !0;var a=function(e,n){var r=t.services.backendConnector.state["".concat(e,"|").concat(n)];return -1===r||2===r};if(n.precheck){var s=n.precheck(this,a);if(void 0!==s)return s}return !!this.hasResourceBundle(r,e)||(!this.services.backendConnector.backend||!(!a(r,e)||o&&!a(i,e)))}},{key:"loadNamespaces",value:function(e,t){var n=this,r=gp();return this.options.ns?("string"==typeof e&&(e=[e]),e.forEach((function(e){n.options.ns.indexOf(e)<0&&n.options.ns.push(e);})),this.loadResources((function(e){r.resolve(),t&&t(e);})),r):(t&&t(),Promise.resolve())}},{key:"loadLanguages",value:function(e,t){var n=gp();"string"==typeof e&&(e=[e]);var r=this.options.preload||[],o=e.filter((function(e){return r.indexOf(e)<0}));return o.length?(this.options.preload=r.concat(o),this.loadResources((function(e){n.resolve(),t&&t(e);})),n):(t&&t(),Promise.resolve())}},{key:"dir",value:function(e){if(e||(e=this.languages&&this.languages.length>0?this.languages[0]:this.language),!e)return "rtl";return ["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam"].indexOf(this.services.languageUtils.getLanguagePartFromCode(e))>=0?"rtl":"ltr"}},{key:"createInstance",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;return new t(e,n)}},{key:"cloneInstance",value:function(){var e=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Hp,o=op.default({},this.options,n,{isClone:!0}),i=new t(o),a=["store","services","language"];return a.forEach((function(t){i[t]=e[t];})),i.services=op.default({},this.services),i.services.utils={hasLoadedNamespace:i.hasLoadedNamespace.bind(i)},i.translator=new Pp(i.services,i.options),i.translator.on("*",(function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r0&&o.removeAllRanges(),r&&t.Transforms.deselect(e);},n.move=function(n,r){void 0===r&&(r=!1),n&&(n<0||t.Transforms.move(e,{distance:n,unit:"character",reverse:r}));},n.moveReverse=function(e){n.move(e,!0);},n.restoreSelection=function(){var e=vs.get(n);null!=e&&(n.focus(),t.Transforms.select(n,e));},n.getSelectionPosition=function(){return yf(n)},n.getNodePosition=function(e){return mf(n,e)},n.isSelectedAll=function(){var e=n.selection;if(null==e)return !1;var r=Gi(t.Range.edges(e),2),o=r[0],i=r[1],a=Gi(t.Editor.edges(n,[]),2),s=a[0],l=a[1];return !(!t.Point.equals(o,s)||!t.Point.equals(i,l))},n.selectAll=function(){var e=t.Editor.start(n,[]),r=t.Editor.end(n,[]);t.Transforms.select(n,{anchor:e,focus:r});},n}($c(function(e){var t=e;return t.getAllMenuKeys=function(){var e=[];for(var t in Us)e.push(t);return e},t.getConfig=function(){var e=rs.get(t);if(null==e)throw new Error("Can not get editor config");return e},t.getMenuConfig=function(e){var n=t.getConfig().MENU_CONF;return (void 0===n?{}:n)[e]||{}},t.alert=function(e,n){void 0===n&&(n="info");var r=t.getConfig().customAlert;r&&r(e,n);},t}(function(e){var n=e;return n.id="wangEditor-"+Vs++,n.isDestroyed=!1,n.isFullScreen=!1,n.focus=function(e){if(Hs.toDOMNode(n,n).focus({preventScroll:!0}),gs.set(n,!0),e){var r=t.Editor.end(n,[]);t.Transforms.select(n,r);}else {var o=vs.get(n);o?t.Transforms.select(n,o):t.Transforms.select(n,t.Editor.start(n,[]));}},n.isFocused=function(){return !!gs.get(n)},n.blur=function(){Hs.toDOMNode(n,n).blur(),t.Transforms.deselect(n),gs.set(n,!1);},n.updateView=function(){Hs.getTextarea(n).changeViewState();var e=Hs.getToolbar(n);e&&e.changeToolbarState();var t=Hs.getHoverbar(n);t&&t.changeHoverbarState();},n.destroy=function(){if(!n.isDestroyed){var e=Hs.getTextarea(n);e.destroy(),Ga.delete(n),Ja.delete(e);var t=Hs.getToolbar(n);t&&(t.destroy(),Xa.delete(n),Ya.delete(t));var r=Hs.getHoverbar(n);r&&(r.destroy(),Za.delete(n),Qa.delete(r)),n.isDestroyed=!0,n.emit("destroyed");}},n.scrollToElem=function(e){if(!n.getConfig().scroll){var t="编辑器禁用了 scroll ,编辑器内容无法滚动,请自行实现该功能";return t+="\nYou has disabled editor scroll, please do this yourself",void console.warn(t)}var r=y.default("#"+e);if(0!==r.length){var o=r[0];if(!Hs.hasDOMNode(n,o))return t="Element (found by id is '"+e+"') is not in editor DOM",t+="\n 通过 id '"+e+"' 找到的 element 不在 editor DOM 之内",void console.error(t,o);var i=Hs.getTextarea(n),a=i.$textAreaContainer,s=i.$scroll,l=r.offset().top,u=a.offset().top;s[0].scrollBy({top:l-u,behavior:"smooth"});}},n.showProgressBar=function(e){e<1||Hs.getTextarea(n).changeProgress(e);},n.hidePanelOrModal=function(){var e=ts.get(n);null!=e&&e.forEach((function(e){return e.hide()}));},n.enable=function(){n.getConfig().readOnly=!1,n.updateView();},n.disable=function(){n.getConfig().readOnly=!0,n.updateView();},n.isDisabled=function(){return n.getConfig().readOnly},n.toDOMNode=function(e){return Hs.toDOMNode(n,e)},n.fullScreen=function(){if(!n.isFullScreen){var e=null,t=Hs.getToolbar(n);t&&(e=t.$box);var r=Hs.getTextarea(n).$box.parent();if(e&&e.parent()[0]!==r[0])throw new Error("Can not set full screen, cause toolbar DOM parent is not equal to textarea DOM parent\n不能设置全屏,因为 toolbar DOM 父节点和 textarea DOM 父节点不一致");r.addClass("w-e-full-screen-container");var o=r.css("z-index");r.attr("data-z-index",o.toString()),n.isFullScreen=!0,n.emit("fullScreen");}},n.unFullScreen=function(){if(n.isFullScreen){var e=Hs.getTextarea(n).$box.parent();setTimeout((function(){e.removeClass("w-e-full-screen-container"),n.isFullScreen=!1,n.emit("unFullScreen");}),200);}},n.getEditableContainer=function(){return Hs.getTextarea(n).$textAreaContainer[0]},n}(Wc(t.createEditor()))))))));if(r&&function(e,t){return Pc(e,"data-w-e-textarea",t)}(c,r))throw new Error("Repeated create editor by selector '"+r+"'");var f=function(e){void 0===e&&(e={});var t=E.default(zs),n={},r=e.MENU_CONF,o=void 0===r?{}:r;return m.default(t,(function(e,t){n[t]=Ki(Ki({},e),o[t]||{});})),delete e.MENU_CONF,Ki({scroll:!0,readOnly:!1,autoFocus:!0,decorate:function(){return []},maxLength:0,MENU_CONF:n,hoverbarKeys:{},customAlert:function(e,t){window.alert(t+":\n"+e);}},e)}(i);rs.set(c,f);var d=f.hoverbarKeys,p=void 0===d?{}:d;if(u.forEach((function(e){c=e(c);})),null!=s&&(c.children=Rc(c,s)),a&&a.length&&(c.children=a),0===c.children.length&&(c.children=[{type:"paragraph",children:[{text:""}]}]),Hs.normalizeContent(c),r){var h=new dd(r);Ga.set(c,h),Ja.set(h,c),h.changeViewState(),Uu((function(){var e=h.$scroll;if(null!=e&&e.height()<300){console.warn("编辑区域高度 < 300px 这可能会导致 modal hoverbar 定位异常\nTextarea height < 300px . This may be cause modal and hoverbar position error",e);}}));var g=void 0;Object.keys(p).length>0&&(g=new Pd,Qa.set(g,c),Za.set(c,g)),c.on("change",(function(){c.hidePanelOrModal();})),c.on("scroll",(function(){c.hidePanelOrModal();}));}else c.children.forEach((function(e,t){return Rd(e,t,c,c)}));var v=f.onCreated,b=f.onDestroyed;return v&&c.on("created",(function(){return v(c)})),b&&c.on("destroyed",(function(){return b(c)})),Uu((function(){return c.emit("created")})),c},e.coreCreateToolbar=function(e,t){if(null==e)throw new Error("Cannot create toolbar, because editor is null");var n=t.selector,r=t.config,o=void 0===r?{}:r;if(function(e,t){return Pc(e,"data-w-e-toolbar",t)}(e,n))throw new Error("Repeated create toolbar by selector '"+n+"'");var i=Ki({toolbarKeys:[],excludeKeys:[],insertKeys:{index:0,keys:[]},modalAppendToBody:!1},o||{}),a=new Bd(n,i);return Ya.set(a,e),Xa.set(e,a),a},e.createUploader=function(e){var t=e.server,n=void 0===t?"":t,r=e.fieldName,o=void 0===r?"":r,i=e.maxFileSize,a=void 0===i?10485760:i,s=e.maxNumberOfFiles,l=void 0===s?100:s,u=e.meta,c=void 0===u?{}:u,f=e.metaWithUrl,d=void 0!==f&&f,p=e.headers,h=void 0===p?{}:p,g=e.withCredentials,v=void 0!==g&&g,y=e.timeout,b=void 0===y?1e4:y,w=e.onBeforeUpload,x=void 0===w?function(e){return e}:w,E=e.onSuccess,O=void 0===E?function(e,t){}:E,C=e.onError,T=void 0===C?function(e,t,n){console.error(e.name+" upload error",t,n);}:C,N=e.onProgress,M=void 0===N?function(e){}:N;if(!n)throw new Error("Cannot get upload server address\n没有配置上传地址");if(!o)throw new Error("Cannot get fieldName\n没有配置 fieldName");var L=n;d&&(L=function(e,t){var n=Gi(e.split("#"),2),r=n[0],o=n[1],i=[];m.default(t,(function(e,t){i.push(t+"="+e);}));var a=i.join("&");return r=r.indexOf("?")>0?r+"&"+a:r+"?"+a,o?r+"#"+o:r}(L,c));var P=new S.default({onBeforeUpload:x,restrictions:{maxFileSize:a,maxNumberOfFiles:l},meta:c}).use(k.default,{endpoint:L,headers:h,formData:!0,fieldName:o,bundle:!0,withCredentials:v,timeout:b});return P.on("upload-success",(function(e,t){var n=t.body,r=void 0===n?{}:n;try{O(e,r);}catch(e){console.error("wangEditor upload file - onSuccess error",e);}P.removeFile(e.id);})),P.on("progress",(function(e){e<1||M(e);})),P.on("upload-error",(function(e,t,n){try{T(e,t,n);}catch(e){console.error("wangEditor upload file - onError error",e);}P.removeFile(e.id);})),P.on("restriction-failed",(function(e,t){try{T(e,t);}catch(e){console.error("wangEditor upload file - onError error",e);}P.removeFile(e.id);})),P},e.genModalButtonElems=function(e,t){var n=y.default('
      '),r=y.default('");return n.append(r),[n[0],r[0]]},e.genModalInputElems=function(e,t,n){var r=y.default('');r.append(""+e+"");var o=y.default('');return r.append(o),[r[0],o[0]]},e.genModalTextareaElems=function(e,t,n){var r=y.default('');r.append(""+e+"");var o=y.default('');return r.append(o),[r[0],o[0]]},e.i18nAddResources=function(e,t){zp.addResourceBundle(e,Up,t,!0,!0);},e.i18nChangeLanguage=function(e){zp.changeLanguage(e);},e.i18nGetResources=function(e){return zp.getResourceBundle(e,Up)},e.registerElemToHtmlConf=function(e){var t=e.type,n=e.elemToHtml;ol[t||""]=n;},e.registerMenu=function(e,t){var n=e.key,r=e.factory,o=e.config,i=Ki(Ki({},o),t||{});if(null!=Us[n])throw new Error("Duplicated key '"+n+"' in menu items");Us[n]=r,function(e,t){null!=t&&(zs[e]=t);}(n,i);},e.registerParseElemHtmlConf=function(e){var t=e.selector,n=e.parseElemHtml;Zu[t]=n;},e.registerParseStyleHtmlHandler=function(e){Qu.push(e);},e.registerPreParseHtmlConf=function(e){Xu.push(e);},e.registerRenderElemConf=function(e){var t=e.type,n=e.renderElem;Ff[t||""]=n;},e.registerStyleHandler=function(e){_f.push(e);},e.registerStyleToHtmlHandler=function(e){rl.push(e);},e.t=Kp,Object.defineProperty(e,"__esModule",{value:!0});})); }); - /** - * @description i18n en - * @author wangfupeng - */ - var enResources = { - editor: { - more: 'More', - justify: 'Justify', - indent: 'Indent', - image: 'Image', - video: 'Video', - }, + /** + * @description i18n en + * @author wangfupeng + */ + var enResources = { + editor: { + more: 'More', + justify: 'Justify', + indent: 'Indent', + image: 'Image', + video: 'Video', + }, }; - /** - * @description i18n zh-CN - * @author wangfupeng - */ - var zhResources = { - editor: { - more: '更多', - justify: '对齐', - indent: '缩进', - image: '图片', - video: '视频', - }, + /** + * @description i18n zh-CN + * @author wangfupeng + */ + var zhResources = { + editor: { + more: '更多', + justify: '对齐', + indent: '缩进', + image: '图片', + video: '视频', + }, }; - /** - * @description i18n entry - * @author wangfupeng - */ - dist$6.i18nAddResources('en', enResources); + /** + * @description i18n entry + * @author wangfupeng + */ + dist$6.i18nAddResources('en', enResources); dist$6.i18nAddResources('zh-CN', zhResources); var dist$5 = createCommonjsModule$1(function (module, exports) { @@ -23672,432 +23672,432 @@ }); - /*! ***************************************************************************** - Copyright (c) Microsoft Corporation. - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH - REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM - LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - PERFORMANCE OF THIS SOFTWARE. - ***************************************************************************** */ - - var __assign = function() { - __assign = Object.assign || function __assign(t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; - } - return t; - }; - return __assign.apply(this, arguments); + /*! ***************************************************************************** + Copyright (c) Microsoft Corporation. + + Permission to use, copy, modify, and/or distribute this software for any + purpose with or without fee is hereby granted. + + THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH + REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, + INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + PERFORMANCE OF THIS SOFTWARE. + ***************************************************************************** */ + + var __assign = function() { + __assign = Object.assign || function __assign(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; + } + return t; + }; + return __assign.apply(this, arguments); }; - /** - * @description Editor View class - * @author wangfupeng - */ - var Boot = /** @class */ (function () { - function Boot() { - throw new Error('不能实例化\nCan not construct a instance'); - } - Boot.setEditorConfig = function (newConfig) { - if (newConfig === void 0) { newConfig = {}; } - this.editorConfig = __assign(__assign({}, this.editorConfig), newConfig); - }; - Boot.setSimpleEditorConfig = function (newConfig) { - if (newConfig === void 0) { newConfig = {}; } - this.simpleEditorConfig = __assign(__assign({}, this.simpleEditorConfig), newConfig); - }; - Boot.setToolbarConfig = function (newConfig) { - if (newConfig === void 0) { newConfig = {}; } - this.toolbarConfig = __assign(__assign({}, this.toolbarConfig), newConfig); - }; - Boot.setSimpleToolbarConfig = function (newConfig) { - if (newConfig === void 0) { newConfig = {}; } - this.simpleToolbarConfig = __assign(__assign({}, this.simpleToolbarConfig), newConfig); - }; - Boot.registerPlugin = function (plugin) { - this.plugins.push(plugin); - }; - // 注册 menu - // TODO 可在注册时传入配置,在开发文档中说明 - Boot.registerMenu = function (menuConf, customConfig) { - dist$6.registerMenu(menuConf, customConfig); - }; - // 注册 renderElem - Boot.registerRenderElem = function (renderElemConf) { - dist$6.registerRenderElemConf(renderElemConf); - }; - // 注册 renderStyle - Boot.registerRenderStyle = function (fn) { - dist$6.registerStyleHandler(fn); - }; - // 注册 elemToHtml - Boot.registerElemToHtml = function (elemToHtmlConf) { - dist$6.registerElemToHtmlConf(elemToHtmlConf); - }; - // 注册 styleToHtml - Boot.registerStyleToHtml = function (fn) { - dist$6.registerStyleToHtmlHandler(fn); - }; - // 注册 preParseHtml - Boot.registerPreParseHtml = function (preParseHtmlConf) { - dist$6.registerPreParseHtmlConf(preParseHtmlConf); - }; - // 注册 parseElemHtml - Boot.registerParseElemHtml = function (parseElemHtmlConf) { - dist$6.registerParseElemHtmlConf(parseElemHtmlConf); - }; - // 注册 parseStyleHtml - Boot.registerParseStyleHtml = function (fn) { - dist$6.registerParseStyleHtmlHandler(fn); - }; - // 注册 module - Boot.registerModule = function (module) { - registerModule(module); - }; - // editor 配置 - Boot.editorConfig = {}; - Boot.simpleEditorConfig = {}; - //toolbar 配置 - Boot.toolbarConfig = {}; - Boot.simpleToolbarConfig = {}; - // 注册插件 - Boot.plugins = []; - return Boot; + /** + * @description Editor View class + * @author wangfupeng + */ + var Boot = /** @class */ (function () { + function Boot() { + throw new Error('不能实例化\nCan not construct a instance'); + } + Boot.setEditorConfig = function (newConfig) { + if (newConfig === void 0) { newConfig = {}; } + this.editorConfig = __assign(__assign({}, this.editorConfig), newConfig); + }; + Boot.setSimpleEditorConfig = function (newConfig) { + if (newConfig === void 0) { newConfig = {}; } + this.simpleEditorConfig = __assign(__assign({}, this.simpleEditorConfig), newConfig); + }; + Boot.setToolbarConfig = function (newConfig) { + if (newConfig === void 0) { newConfig = {}; } + this.toolbarConfig = __assign(__assign({}, this.toolbarConfig), newConfig); + }; + Boot.setSimpleToolbarConfig = function (newConfig) { + if (newConfig === void 0) { newConfig = {}; } + this.simpleToolbarConfig = __assign(__assign({}, this.simpleToolbarConfig), newConfig); + }; + Boot.registerPlugin = function (plugin) { + this.plugins.push(plugin); + }; + // 注册 menu + // TODO 可在注册时传入配置,在开发文档中说明 + Boot.registerMenu = function (menuConf, customConfig) { + dist$6.registerMenu(menuConf, customConfig); + }; + // 注册 renderElem + Boot.registerRenderElem = function (renderElemConf) { + dist$6.registerRenderElemConf(renderElemConf); + }; + // 注册 renderStyle + Boot.registerRenderStyle = function (fn) { + dist$6.registerStyleHandler(fn); + }; + // 注册 elemToHtml + Boot.registerElemToHtml = function (elemToHtmlConf) { + dist$6.registerElemToHtmlConf(elemToHtmlConf); + }; + // 注册 styleToHtml + Boot.registerStyleToHtml = function (fn) { + dist$6.registerStyleToHtmlHandler(fn); + }; + // 注册 preParseHtml + Boot.registerPreParseHtml = function (preParseHtmlConf) { + dist$6.registerPreParseHtmlConf(preParseHtmlConf); + }; + // 注册 parseElemHtml + Boot.registerParseElemHtml = function (parseElemHtmlConf) { + dist$6.registerParseElemHtmlConf(parseElemHtmlConf); + }; + // 注册 parseStyleHtml + Boot.registerParseStyleHtml = function (fn) { + dist$6.registerParseStyleHtmlHandler(fn); + }; + // 注册 module + Boot.registerModule = function (module) { + registerModule(module); + }; + // editor 配置 + Boot.editorConfig = {}; + Boot.simpleEditorConfig = {}; + //toolbar 配置 + Boot.toolbarConfig = {}; + Boot.simpleToolbarConfig = {}; + // 注册插件 + Boot.plugins = []; + return Boot; }()); - /** - * @description 注册 module - * @author wangfupeng - */ - function registerModule(module) { - var menus = module.menus, renderElems = module.renderElems, renderStyle = module.renderStyle, elemsToHtml = module.elemsToHtml, styleToHtml = module.styleToHtml, preParseHtml = module.preParseHtml, parseElemsHtml = module.parseElemsHtml, parseStyleHtml = module.parseStyleHtml, editorPlugin = module.editorPlugin; - if (menus) { - menus.forEach(function (menu) { return Boot.registerMenu(menu); }); - } - if (renderElems) { - renderElems.forEach(function (renderElemConf) { return Boot.registerRenderElem(renderElemConf); }); - } - if (renderStyle) { - Boot.registerRenderStyle(renderStyle); - } - if (elemsToHtml) { - elemsToHtml.forEach(function (elemToHtmlConf) { return Boot.registerElemToHtml(elemToHtmlConf); }); - } - if (styleToHtml) { - Boot.registerStyleToHtml(styleToHtml); - } - if (preParseHtml) { - preParseHtml.forEach(function (conf) { return Boot.registerPreParseHtml(conf); }); - } - if (parseElemsHtml) { - parseElemsHtml.forEach(function (parseElemHtmlConf) { return Boot.registerParseElemHtml(parseElemHtmlConf); }); - } - if (parseStyleHtml) { - Boot.registerParseStyleHtml(parseStyleHtml); - } - if (editorPlugin) { - Boot.registerPlugin(editorPlugin); - } + /** + * @description 注册 module + * @author wangfupeng + */ + function registerModule(module) { + var menus = module.menus, renderElems = module.renderElems, renderStyle = module.renderStyle, elemsToHtml = module.elemsToHtml, styleToHtml = module.styleToHtml, preParseHtml = module.preParseHtml, parseElemsHtml = module.parseElemsHtml, parseStyleHtml = module.parseStyleHtml, editorPlugin = module.editorPlugin; + if (menus) { + menus.forEach(function (menu) { return Boot.registerMenu(menu); }); + } + if (renderElems) { + renderElems.forEach(function (renderElemConf) { return Boot.registerRenderElem(renderElemConf); }); + } + if (renderStyle) { + Boot.registerRenderStyle(renderStyle); + } + if (elemsToHtml) { + elemsToHtml.forEach(function (elemToHtmlConf) { return Boot.registerElemToHtml(elemToHtmlConf); }); + } + if (styleToHtml) { + Boot.registerStyleToHtml(styleToHtml); + } + if (preParseHtml) { + preParseHtml.forEach(function (conf) { return Boot.registerPreParseHtml(conf); }); + } + if (parseElemsHtml) { + parseElemsHtml.forEach(function (parseElemHtmlConf) { return Boot.registerParseElemHtml(parseElemHtmlConf); }); + } + if (parseStyleHtml) { + Boot.registerParseStyleHtml(parseStyleHtml); + } + if (editorPlugin) { + Boot.registerPlugin(editorPlugin); + } } - /** - * @description register builtin modules - * @author wangfupeng - */ - basicModules.forEach(function (module) { return registerModule(module); }); - registerModule(dist$4); - registerModule(dist$3); - registerModule(dist$2); - registerModule(dist$1); + /** + * @description register builtin modules + * @author wangfupeng + */ + basicModules.forEach(function (module) { return registerModule(module); }); + registerModule(dist$4); + registerModule(dist$3); + registerModule(dist$2); + registerModule(dist$1); registerModule(dist.wangEditorCodeHighlightModule); - /** - * @description svg tag - * @author wangfupeng - */ - /** - * 【注意】svg 字符串的长度 ,否则会导致代码体积过大 - * 尽量选择 https://www.iconfont.cn/collections/detail?spm=a313x.7781069.0.da5a778a4&cid=20293 - * 找不到再从 iconfont.com 搜索 - */ - // 缩进 right - var INDENT_RIGHT_SVG = ''; - // 左对齐 - var JUSTIFY_LEFT_SVG = ''; - // 图片 - var IMAGE_SVG = ''; - // plus - var MORE_SVG = ''; - // 视频 + /** + * @description svg tag + * @author wangfupeng + */ + /** + * 【注意】svg 字符串的长度 ,否则会导致代码体积过大 + * 尽量选择 https://www.iconfont.cn/collections/detail?spm=a313x.7781069.0.da5a778a4&cid=20293 + * 找不到再从 iconfont.com 搜索 + */ + // 缩进 right + var INDENT_RIGHT_SVG = ''; + // 左对齐 + var JUSTIFY_LEFT_SVG = ''; + // 图片 + var IMAGE_SVG = ''; + // plus + var MORE_SVG = ''; + // 视频 var VIDEO_SVG = ''; - /** - * @description toolbar 配置 - * @author wangfupeng - */ - function genDefaultToolbarKeys() { - return [ - 'headerSelect', - // 'header1', - // 'header2', - // 'header3', - 'blockquote', - '|', - 'bold', - 'underline', - 'italic', - { - key: 'group-more-style', - title: dist$6.t('editor.more'), - iconSvg: MORE_SVG, - menuKeys: ['through', 'code', 'sup', 'sub', 'clearStyle'], - }, - 'color', - 'bgColor', - '|', - 'fontSize', - 'fontFamily', - 'lineHeight', - '|', - 'bulletedList', - 'numberedList', - 'todo', - { - key: 'group-justify', - title: dist$6.t('editor.justify'), - iconSvg: JUSTIFY_LEFT_SVG, - menuKeys: ['justifyLeft', 'justifyRight', 'justifyCenter', 'justifyJustify'], - }, - { - key: 'group-indent', - title: dist$6.t('editor.indent'), - iconSvg: INDENT_RIGHT_SVG, - menuKeys: ['indent', 'delIndent'], - }, - '|', - 'emotion', - 'insertLink', - // 'editLink', - // 'unLink', - // 'viewLink', - { - key: 'group-image', - title: dist$6.t('editor.image'), - iconSvg: IMAGE_SVG, - menuKeys: ['insertImage', 'uploadImage'], - }, - // 'deleteImage', - // 'editImage', - // 'viewImageLink', - { - key: 'group-video', - title: dist$6.t('editor.video'), - iconSvg: VIDEO_SVG, - menuKeys: ['insertVideo', 'uploadVideo'], - }, - // 'deleteVideo', - 'insertTable', - 'codeBlock', - // 'codeSelectLang', - 'divider', - // 'deleteTable', - '|', - 'undo', - 'redo', - '|', - 'fullScreen', - ]; - } - function genSimpleToolbarKeys() { - return [ - 'blockquote', - 'header1', - 'header2', - 'header3', - '|', - 'bold', - 'underline', - 'italic', - 'through', - 'color', - 'bgColor', - 'clearStyle', - '|', - 'bulletedList', - 'numberedList', - 'todo', - 'justifyLeft', - 'justifyRight', - 'justifyCenter', - '|', - 'insertLink', - { - key: 'group-image', - title: dist$6.t('editor.image'), - iconSvg: IMAGE_SVG, - menuKeys: ['insertImage', 'uploadImage'], - }, - 'insertVideo', - 'insertTable', - 'codeBlock', - '|', - 'undo', - 'redo', - '|', - 'fullScreen', - ]; + /** + * @description toolbar 配置 + * @author wangfupeng + */ + function genDefaultToolbarKeys() { + return [ + 'headerSelect', + // 'header1', + // 'header2', + // 'header3', + 'blockquote', + '|', + 'bold', + 'underline', + 'italic', + { + key: 'group-more-style', + title: dist$6.t('editor.more'), + iconSvg: MORE_SVG, + menuKeys: ['through', 'code', 'sup', 'sub', 'clearStyle'], + }, + 'color', + 'bgColor', + '|', + 'fontSize', + 'fontFamily', + 'lineHeight', + '|', + 'bulletedList', + 'numberedList', + 'todo', + { + key: 'group-justify', + title: dist$6.t('editor.justify'), + iconSvg: JUSTIFY_LEFT_SVG, + menuKeys: ['justifyLeft', 'justifyRight', 'justifyCenter', 'justifyJustify'], + }, + { + key: 'group-indent', + title: dist$6.t('editor.indent'), + iconSvg: INDENT_RIGHT_SVG, + menuKeys: ['indent', 'delIndent'], + }, + '|', + 'emotion', + 'insertLink', + // 'editLink', + // 'unLink', + // 'viewLink', + { + key: 'group-image', + title: dist$6.t('editor.image'), + iconSvg: IMAGE_SVG, + menuKeys: ['insertImage', 'uploadImage'], + }, + // 'deleteImage', + // 'editImage', + // 'viewImageLink', + { + key: 'group-video', + title: dist$6.t('editor.video'), + iconSvg: VIDEO_SVG, + menuKeys: ['insertVideo', 'uploadVideo'], + }, + // 'deleteVideo', + 'insertTable', + 'codeBlock', + // 'codeSelectLang', + 'divider', + // 'deleteTable', + '|', + 'undo', + 'redo', + '|', + 'fullScreen', + ]; + } + function genSimpleToolbarKeys() { + return [ + 'blockquote', + 'header1', + 'header2', + 'header3', + '|', + 'bold', + 'underline', + 'italic', + 'through', + 'color', + 'bgColor', + 'clearStyle', + '|', + 'bulletedList', + 'numberedList', + 'todo', + 'justifyLeft', + 'justifyRight', + 'justifyCenter', + '|', + 'insertLink', + { + key: 'group-image', + title: dist$6.t('editor.image'), + iconSvg: IMAGE_SVG, + menuKeys: ['insertImage', 'uploadImage'], + }, + 'insertVideo', + 'insertTable', + 'codeBlock', + '|', + 'undo', + 'redo', + '|', + 'fullScreen', + ]; } - /** - * @description hoverbar 配置 - * @author wangfupeng - */ - var COMMON_HOVERBAR_KEYS = { - // key 即 element type - link: { - menuKeys: ['editLink', 'unLink', 'viewLink'], - }, - image: { - menuKeys: [ - 'imageWidth30', - 'imageWidth50', - 'imageWidth100', - 'editImage', - 'viewImageLink', - 'deleteImage', - ], - }, - pre: { - menuKeys: ['enter', 'codeBlock', 'codeSelectLang'], - }, - table: { - menuKeys: [ - 'enter', - 'tableHeader', - 'tableFullWidth', - 'insertTableRow', - 'deleteTableRow', - 'insertTableCol', - 'deleteTableCol', - 'deleteTable', - ], - }, - divider: { - menuKeys: ['enter'], - }, - video: { - menuKeys: ['enter', 'editVideoSize'], - }, - }; - function genDefaultHoverbarKeys() { - return __assign(__assign({}, COMMON_HOVERBAR_KEYS), { - // 也可以自定义 match 来匹配元素,此时 key 就随意了 - text: { - menuKeys: [ - 'headerSelect', - 'insertLink', - 'bulletedList', - '|', - 'bold', - 'through', - 'color', - 'bgColor', - 'clearStyle', - ], - } }); - } - function genSimpleHoverbarKeys() { - return COMMON_HOVERBAR_KEYS; + /** + * @description hoverbar 配置 + * @author wangfupeng + */ + var COMMON_HOVERBAR_KEYS = { + // key 即 element type + link: { + menuKeys: ['editLink', 'unLink', 'viewLink'], + }, + image: { + menuKeys: [ + 'imageWidth30', + 'imageWidth50', + 'imageWidth100', + 'editImage', + 'viewImageLink', + 'deleteImage', + ], + }, + pre: { + menuKeys: ['enter', 'codeBlock', 'codeSelectLang'], + }, + table: { + menuKeys: [ + 'enter', + 'tableHeader', + 'tableFullWidth', + 'insertTableRow', + 'deleteTableRow', + 'insertTableCol', + 'deleteTableCol', + 'deleteTable', + ], + }, + divider: { + menuKeys: ['enter'], + }, + video: { + menuKeys: ['enter', 'editVideoSize'], + }, + }; + function genDefaultHoverbarKeys() { + return __assign(__assign({}, COMMON_HOVERBAR_KEYS), { + // 也可以自定义 match 来匹配元素,此时 key 就随意了 + text: { + menuKeys: [ + 'headerSelect', + 'insertLink', + 'bulletedList', + '|', + 'bold', + 'through', + 'color', + 'bgColor', + 'clearStyle', + ], + } }); + } + function genSimpleHoverbarKeys() { + return COMMON_HOVERBAR_KEYS; } - /** - * @description 获取编辑器默认配置 - * @author wangfupeng - */ - function getDefaultEditorConfig() { - return { - hoverbarKeys: genDefaultHoverbarKeys(), - }; - } - function getSimpleEditorConfig() { - return { - hoverbarKeys: genSimpleHoverbarKeys(), - }; - } - function getDefaultToolbarConfig() { - return { - toolbarKeys: genDefaultToolbarKeys(), - }; - } - function getSimpleToolbarConfig() { - return { - toolbarKeys: genSimpleToolbarKeys(), - }; + /** + * @description 获取编辑器默认配置 + * @author wangfupeng + */ + function getDefaultEditorConfig() { + return { + hoverbarKeys: genDefaultHoverbarKeys(), + }; + } + function getSimpleEditorConfig() { + return { + hoverbarKeys: genSimpleHoverbarKeys(), + }; + } + function getDefaultToolbarConfig() { + return { + toolbarKeys: genDefaultToolbarKeys(), + }; + } + function getSimpleToolbarConfig() { + return { + toolbarKeys: genSimpleToolbarKeys(), + }; } - /** - * @description set default config - * @author wangfupeng - */ - var defaultEditorConfig = getDefaultEditorConfig(); - Boot.setEditorConfig(__assign(__assign({}, defaultEditorConfig), { decorate: dist.wangEditorCodeHighLightDecorate })); - var simpleEditorConfig = getSimpleEditorConfig(); - Boot.setSimpleEditorConfig(__assign(__assign({}, simpleEditorConfig), { decorate: dist.wangEditorCodeHighLightDecorate })); - var defaultToolbarConfig = getDefaultToolbarConfig(); - Boot.setToolbarConfig(defaultToolbarConfig); - var simpleToolbarConfig = getSimpleToolbarConfig(); + /** + * @description set default config + * @author wangfupeng + */ + var defaultEditorConfig = getDefaultEditorConfig(); + Boot.setEditorConfig(__assign(__assign({}, defaultEditorConfig), { decorate: dist.wangEditorCodeHighLightDecorate })); + var simpleEditorConfig = getSimpleEditorConfig(); + Boot.setSimpleEditorConfig(__assign(__assign({}, simpleEditorConfig), { decorate: dist.wangEditorCodeHighLightDecorate })); + var defaultToolbarConfig = getDefaultToolbarConfig(); + Boot.setToolbarConfig(defaultToolbarConfig); + var simpleToolbarConfig = getSimpleToolbarConfig(); Boot.setSimpleToolbarConfig(simpleToolbarConfig); - /** - * @description create - * @author wangfupeng - */ - /** - * 创建 editor 实例 - */ - function createEditor(option) { - if (option === void 0) { option = {}; } - var _a = option.selector, selector = _a === void 0 ? '' : _a, _b = option.content, content = _b === void 0 ? [] : _b, html = option.html, _c = option.config, config = _c === void 0 ? {} : _c, _d = option.mode, mode = _d === void 0 ? 'default' : _d; - var globalConfig = mode === 'simple' ? Boot.simpleEditorConfig : Boot.editorConfig; - // 单独处理 hoverbarKeys - var newHoverbarKeys = __assign(__assign({}, (globalConfig.hoverbarKeys || {})), (config.hoverbarKeys || {})); - var editor = dist$6.coreCreateEditor({ - selector: selector, - config: __assign(__assign(__assign({}, globalConfig), config), { hoverbarKeys: newHoverbarKeys }), - content: content, - html: html, - plugins: Boot.plugins, - }); - return editor; - } - /** - * 创建 toolbar 实例 - */ - function createToolbar(option) { - var selector = option.selector, editor = option.editor, _a = option.config, config = _a === void 0 ? {} : _a, _b = option.mode, mode = _b === void 0 ? 'default' : _b; - if (!selector) { - throw new Error("Cannot find 'selector' when create toolbar"); - } - var globalConfig = mode === 'simple' ? Boot.simpleToolbarConfig : Boot.toolbarConfig; - var toolbar = dist$6.coreCreateToolbar(editor, { - selector: selector, - config: __assign(__assign({}, globalConfig), config), - }); - return toolbar; + /** + * @description create + * @author wangfupeng + */ + /** + * 创建 editor 实例 + */ + function createEditor(option) { + if (option === void 0) { option = {}; } + var _a = option.selector, selector = _a === void 0 ? '' : _a, _b = option.content, content = _b === void 0 ? [] : _b, html = option.html, _c = option.config, config = _c === void 0 ? {} : _c, _d = option.mode, mode = _d === void 0 ? 'default' : _d; + var globalConfig = mode === 'simple' ? Boot.simpleEditorConfig : Boot.editorConfig; + // 单独处理 hoverbarKeys + var newHoverbarKeys = __assign(__assign({}, (globalConfig.hoverbarKeys || {})), (config.hoverbarKeys || {})); + var editor = dist$6.coreCreateEditor({ + selector: selector, + config: __assign(__assign(__assign({}, globalConfig), config), { hoverbarKeys: newHoverbarKeys }), + content: content, + html: html, + plugins: Boot.plugins, + }); + return editor; + } + /** + * 创建 toolbar 实例 + */ + function createToolbar(option) { + var selector = option.selector, editor = option.editor, _a = option.config, config = _a === void 0 ? {} : _a, _b = option.mode, mode = _b === void 0 ? 'default' : _b; + if (!selector) { + throw new Error("Cannot find 'selector' when create toolbar"); + } + var globalConfig = mode === 'simple' ? Boot.simpleToolbarConfig : Boot.toolbarConfig; + var toolbar = dist$6.coreCreateToolbar(editor, { + selector: selector, + config: __assign(__assign({}, globalConfig), config), + }); + return toolbar; } - /** - * @description editor entry - * @author wangfupeng - */ + /** + * @description editor entry + * @author wangfupeng + */ var index = {}; exports.Boot = Boot;