@wangeditor-next/core 1.8.4 → 1.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/src/config/interface.d.ts +8 -2
- package/dist/core/src/editor/interface.d.ts +2 -0
- package/dist/core/src/editor/plugins/with-history.d.ts +7 -0
- package/dist/core/src/to-html/elem2html.d.ts +2 -1
- package/dist/core/src/to-html/node2html.d.ts +6 -2
- package/dist/core/src/to-html/text2html.d.ts +2 -1
- package/dist/core/src/upload/createUploader.d.ts +4 -2
- package/dist/index.js +1 -12
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -12
- package/dist/index.mjs.map +1 -1
- package/dist/upload.js +1 -12
- package/dist/upload.js.map +1 -1
- package/dist/upload.mjs +1 -12
- package/dist/upload.mjs.map +1 -1
- package/package.json +4 -2
package/dist/index.js
CHANGED
|
@@ -1,13 +1,2 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("nanoid/non-secure"),require("lodash.throttle"),require("lodash.foreach"),require("nanoid"),require("slate"),require("lodash.clonedeep"),require("dom7"),require("lodash.toarray"),require("lodash.debounce"),require("is-hotkey"),require("snabbdom"),require("lodash.camelcase")):"function"==typeof define&&define.amd?define(["exports","nanoid/non-secure","lodash.throttle","lodash.foreach","nanoid","slate","lodash.clonedeep","dom7","lodash.toarray","lodash.debounce","is-hotkey","snabbdom","lodash.camelcase"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).WangEditorCore={},e.nonSecure,e.throttle,e.forEach,null,e.require$$0$2,e.cloneDeep,e.$$1,e.toArray,e.debounce,e.isHotkey,e.snabbdom,e.camelCase)}(this,function(e,t,n,r,o,i,s,a,l,u,c,d,h){"use strict";function p(e){var t=Object.create(null);return e&&Object.keys(e).forEach(function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e,Object.freeze(t)}var f=function(e,t){return f=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])},f(e,t)};function g(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}f(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var v=function(){return v=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},v.apply(this,arguments)};function m(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=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 y(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)s.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 s}function b(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}function w(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function E(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if("function"==typeof t){var n=function e(){var n=!1;try{n=this instanceof e}catch{}return n?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(t){var r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:function(){return e[t]}})}),n}"function"==typeof SuppressedError&&SuppressedError;var x,S,_,O={exports:{}},k={};function C(){if(_)return k;_=1,Object.defineProperty(k,"__esModule",{value:!0}),k.justErrorsLogger=k.debugLogger=void 0;const e=function(){if(S)return x;function e(e){return e<10?`0${e}`:e.toString()}return S=1,x=function(){const t=new Date;return`${e(t.getHours())}:${e(t.getMinutes())}:${e(t.getSeconds())}`}}(),t={debug:()=>{},warn:()=>{},error:function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return console.error(`[Uppy] [${e()}]`,...n)}};k.justErrorsLogger=t;const n={debug:function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return console.debug(`[Uppy] [${e()}]`,...n)},warn:function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return console.warn(`[Uppy] [${e()}]`,...n)},error:function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return console.error(`[Uppy] [${e()}]`,...n)}};return k.debugLogger=n,k}var T,N,P,M,R,L,$,D,A,F,j,I,U,B,H,z,W,V,q,K,J,G,X,Y,Q,Z,ee,te,ne,re,oe,ie=E(p(t)),se={};function ae(){return N?T:(N=1,T=function(e){if("number"!=typeof e||isNaN(e))throw new TypeError("Expected a number, got "+typeof e);var t=e<0,n=["B","KB","MB","GB","TB","PB","EB","ZB","YB"];if(t&&(e=-e),e<1)return(t?"-":"")+e+" B";var r=Math.min(Math.floor(Math.log(e)/Math.log(1024)),n.length-1);e=Number(e/Math.pow(1024,r));var o=n[r];return e>=10||e%1==0?(t?"-":"")+e.toFixed(0)+" "+o:(t?"-":"")+e.toFixed(1)+" "+o})}function le(){if(M)return P;function e(e,t){this.text=e=e||"",this.hasWild=~e.indexOf("*"),this.separator=t,this.parts=e.split(t)}return M=1,e.prototype.match=function(e){var t,n,r=!0,o=this.parts,i=o.length;if("string"==typeof e||e instanceof String)if(this.hasWild||this.text==e){for(n=(e||"").split(this.separator),t=0;r&&t<i;t++)"*"!==o[t]&&(r=t<n.length&&o[t]===n[t]);r=r&&n}else r=!1;else if("function"==typeof e.splice)for(r=[],t=e.length;t--;)this.match(e[t])&&(r[r.length]=e[t]);else if("object"==typeof e)for(var s in r={},e)this.match(s)&&(r[s]=e[s]);return r},P=function(t,n,r){var o=new e(t,r||/[\/\.]/);return void 0!==n?o.match(n):o}}function ue(){if($)return se;$=1,Object.defineProperty(se,"__esModule",{value:!0}),se.defaultOptions=se.RestrictionError=se.Restricter=void 0;const e=ae(),t=function(){if(L)return R;L=1;var e=le(),t=/[\/\+\.]/;return R=function(n,r){function o(r){var o=e(r,n,t);return o&&o.length>=2}return r?o(r.split(";")[0]):o}}();se.defaultOptions={maxFileSize:null,minFileSize:null,maxTotalFileSize:null,maxNumberOfFiles:null,minNumberOfFiles:null,allowedFileTypes:null,requiredMetaFields:[]};class n extends Error{constructor(){super(...arguments),this.isRestriction=!0}}se.RestrictionError=n,"undefined"==typeof AggregateError&&(globalThis.AggregateError=class extends Error{constructor(e,t){super(t),this.errors=e}});return se.Restricter=class{constructor(e,t){this.i18n=t,this.getOpts=()=>{const t=e();if(null!=t.restrictions.allowedFileTypes&&!Array.isArray(t.restrictions.allowedFileTypes))throw new TypeError("`restrictions.allowedFileTypes` must be an array");return t}}validate(r,o){const{maxFileSize:i,minFileSize:s,maxTotalFileSize:a,maxNumberOfFiles:l,allowedFileTypes:u}=this.getOpts().restrictions;if(l){const e=o.filter(e=>!e.isGhost);if(e.length+1>l)throw new n(`${this.i18n("youCanOnlyUploadX",{smart_count:l})}`)}if(u){if(!u.some(e=>e.includes("/")?!!r.type&&t(r.type.replace(/;.*?$/,""),e):!("."!==e[0]||!r.extension)&&r.extension.toLowerCase()===e.slice(1).toLowerCase())){const e=u.join(", ");throw new n(this.i18n("youCanOnlyUploadFileTypes",{types:e}))}}if(a&&null!=r.size){const t=o.reduce((e,t)=>e+t.size,r.size);if(t>a)throw new n(this.i18n("exceedsSize",{size:e(a),file:r.name}))}if(i&&null!=r.size&&r.size>i)throw new n(this.i18n("exceedsSize",{size:e(i),file:r.name}));if(s&&null!=r.size&&r.size<s)throw new n(this.i18n("inferiorSize",{size:e(s)}))}validateMinNumberOfFiles(e){const{minNumberOfFiles:t}=this.getOpts().restrictions;if(Object.keys(e).length<t)throw new n(this.i18n("youHaveToAtLeastSelectX",{smart_count:t}))}getMissingRequiredMetaFields(e){const t=new n(this.i18n("missingRequiredMetaFieldOnFile",{fileName:e.name})),{requiredMetaFields:r}=this.getOpts().restrictions,o=Object.prototype.hasOwnProperty,i=[];for(const t of r)o.call(e.meta,t)&&""!==e.meta[t]||i.push(t);return{missingFields:i,error:t}}},se}function ce(){if(A)return D;return A=1,D=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}}function de(){if(j)return F;function e(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}j=1;var t=0;function n(e){return"__private_"+t+++"_"+e}const r=ce();function o(e,t,n){const r=[];return e.forEach(e=>"string"!=typeof e?r.push(e):t[Symbol.split](e).forEach((e,t,o)=>{""!==e&&r.push(e),t<o.length-1&&r.push(n)})),r}
|
|
2
|
-
/**
|
|
3
|
-
* Takes a string with placeholder variables like `%{smart_count} file selected`
|
|
4
|
-
* and replaces it with values from options `{smart_count: 5}`
|
|
5
|
-
*
|
|
6
|
-
* @license https://github.com/airbnb/polyglot.js/blob/master/LICENSE
|
|
7
|
-
* taken from https://github.com/airbnb/polyglot.js/blob/master/lib/polyglot.js#L299
|
|
8
|
-
*
|
|
9
|
-
* @param {string} phrase that needs interpolation, with placeholders
|
|
10
|
-
* @param {object} options with values that will be used to replace placeholders
|
|
11
|
-
* @returns {any[]} interpolated
|
|
12
|
-
*/function i(e,t){const n=/\$/g;let r=[e];if(null==t)return r;for(const e of Object.keys(t))if("_"!==e){let i=t[e];"string"==typeof i&&(i=n[Symbol.replace](i,"$$$$")),r=o(r,new RegExp(`%\\{${e}\\}`,"g"),i)}return r}var s=n("apply");function a(e){if(null==e||!e.strings)return;const t=this.locale;this.locale={...t,strings:{...t.strings,...e.strings}},this.locale.pluralize=e.pluralize||t.pluralize}return F=class{constructor(t){Object.defineProperty(this,s,{value:a}),this.locale={strings:{},pluralize:e=>1===e?0:1},Array.isArray(t)?t.forEach(e(this,s)[s],this):e(this,s)[s](t)}translate(e,t){return this.translateArray(e,t).join("")}translateArray(e,t){if(!r(this.locale.strings,e))throw new Error(`missing string: ${e}`);const n=this.locale.strings[e];if("object"==typeof n){if(t&&void 0!==t.smart_count){return i(n[this.locale.pluralize(t.smart_count)],t)}throw new Error("Attempted to use a string with plural forms, but no value was given for %{smart_count}")}return i(n,t)}},F}function he(){return U||(U=1,I=function(){var e={},t=e._fns={};return e.emit=function(e,n,r,o,i,s,a){var l=function(e){var n=t[e]?t[e]:[],r=e.indexOf(":"),o=-1===r?[e]:[e.substring(0,r),e.substring(r+1)],i=Object.keys(t),s=0,a=i.length;for(;s<a;s++){var l=i[s];if("*"===l&&(n=n.concat(t[l])),2===o.length&&o[0]===l){n=n.concat(t[l]);break}}return n}(e);l.length&&function(e,t,n){var r=0,o=t.length;for(;r<o&&t[r];r++)t[r].event=e,t[r].apply(t[r],n)}(e,l,[n,r,o,i,s,a])},e.on=function(e,n){t[e]||(t[e]=[]),t[e].push(n)},e.once=function(t,n){this.on(t,function r(){n.apply(this,arguments),e.off(t,r)})},e.off=function(e,t){var n=[];if(e&&t)for(var r=this._fns[e],o=0,i=r?r.length:0;o<i;o++)r[o]!==t&&n.push(r[o]);n.length?this._fns[e]=n:delete this._fns[e]},e}),I}function pe(){if(H)return B;H=1;var e=0;function t(t){return"__private_"+e+++"_"+t}var n=t("publish");class r{constructor(){Object.defineProperty(this,n,{value:o}),this.state={},this.callbacks=[]}getState(){return this.state}setState(e){const t={...this.state},r={...this.state,...e};this.state=r,function(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}(this,n)[n](t,r,e)}subscribe(e){return this.callbacks.push(e),()=>{this.callbacks.splice(this.callbacks.indexOf(e),1)}}}function o(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];this.callbacks.forEach(e=>{e(...t)})}return r.VERSION="2.1.1",B=function(){return new r}}function fe(){if(W)return z;return W=1,z=function(e){const t=e.lastIndexOf(".");return-1===t||t===e.length-1?{name:e,extension:void 0}:{name:e.slice(0,t),extension:e.slice(t+1)}}}function ge(){return q?V:(q=1,V={md:"text/markdown",markdown:"text/markdown",mp4:"video/mp4",mp3:"audio/mp3",svg:"image/svg+xml",jpg:"image/jpeg",png:"image/png",gif:"image/gif",heic:"image/heic",heif:"image/heif",yaml:"text/yaml",yml:"text/yaml",csv:"text/csv",tsv:"text/tab-separated-values",tab:"text/tab-separated-values",avi:"video/x-msvideo",mks:"video/x-matroska",mkv:"video/x-matroska",mov:"video/quicktime",dicom:"application/dicom",doc:"application/msword",docm:"application/vnd.ms-word.document.macroenabled.12",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",dot:"application/msword",dotm:"application/vnd.ms-word.template.macroenabled.12",dotx:"application/vnd.openxmlformats-officedocument.wordprocessingml.template",xla:"application/vnd.ms-excel",xlam:"application/vnd.ms-excel.addin.macroenabled.12",xlc:"application/vnd.ms-excel",xlf:"application/x-xliff+xml",xlm:"application/vnd.ms-excel",xls:"application/vnd.ms-excel",xlsb:"application/vnd.ms-excel.sheet.binary.macroenabled.12",xlsm:"application/vnd.ms-excel.sheet.macroenabled.12",xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",xlt:"application/vnd.ms-excel",xltm:"application/vnd.ms-excel.template.macroenabled.12",xltx:"application/vnd.openxmlformats-officedocument.spreadsheetml.template",xlw:"application/vnd.ms-excel",txt:"text/plain",text:"text/plain",conf:"text/plain",log:"text/plain",pdf:"application/pdf",zip:"application/zip","7z":"application/x-7z-compressed",rar:"application/x-rar-compressed",tar:"application/x-tar",gz:"application/gzip",dmg:"application/x-apple-diskimage"})}function ve(){if(oe)return re;oe=1;var e=ie,t=C(),r=ue();let o,i;function s(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}var a=0;function l(e){return"__private_"+a+++"_"+e}const u=de(),c=he(),d=n,h=pe(),p=function(){if(J)return K;J=1;const e=fe(),t=ge();return K=function(n){var r;if(n.type)return n.type;const o=n.name?null==(r=e(n.name).extension)?void 0:r.toLowerCase():null;return o&&o in t?t[o]:"application/octet-stream"}}(),f=fe(),g=function(){if(X)return G;function e(e){let t="";return e.replace(/[^A-Z0-9]/gi,e=>(t+=`-${function(e){return e.charCodeAt(0).toString(32)}(e)}`,"/"))+t}return X=1,G=function(t){let n="uppy";return"string"==typeof t.name&&(n+=`-${e(t.name.toLowerCase())}`),void 0!==t.type&&(n+=`-${t.type}`),t.meta&&"string"==typeof t.meta.relativePath&&(n+=`-${e(t.meta.relativePath.toLowerCase())}`),void 0!==t.data.size&&(n+=`-${t.data.size}`),void 0!==t.data.lastModified&&(n+=`-${t.data.lastModified}`),n}}(),v=(Q||(Q=1,Y=function(e){if(null==e&&"undefined"!=typeof navigator&&(e=navigator.userAgent),!e)return!0;const t=/Edge\/(\d+\.\d+)/.exec(e);if(!t)return!0;const n=t[1];let[r,o]=n.split(".");return r=parseInt(r,10),o=parseInt(o,10),r<15||15===r&&o<15063||r>18||18===r&&o>=18218}),Y),m=ee?Z:(ee=1,Z=function(e,t){return t.name?t.name:"image"===e.split("/")[0]?`${e.split("/")[0]}.${e.split("/")[1]}`:"noname"}),y=ne?te:(ne=1,te={strings:{addBulkFilesFailed:{0:"Failed to add %{smart_count} file due to an internal error",1:"Failed to add %{smart_count} files due to internal errors"},youCanOnlyUploadX:{0:"You can only upload %{smart_count} file",1:"You can only upload %{smart_count} files"},youHaveToAtLeastSelectX:{0:"You have to select at least %{smart_count} file",1:"You have to select at least %{smart_count} files"},exceedsSize:"%{file} exceeds maximum allowed size of %{size}",missingRequiredMetaField:"Missing required meta fields",missingRequiredMetaFieldOnFile:"Missing required meta fields in %{fileName}",inferiorSize:"This file is smaller than the allowed size of %{size}",youCanOnlyUploadFileTypes:"You can only upload: %{types}",noMoreFilesAllowed:"Cannot add more files",noDuplicates:"Cannot add the duplicate file '%{fileName}', it already exists",companionError:"Connection with Companion failed",authAborted:"Authentication aborted",companionUnauthorizeHint:"To unauthorize to your %{provider} account, please go to %{url}",failedToUpload:"Failed to upload %{file}",noInternetConnection:"No Internet connection",connectedToInternet:"Connected to the Internet",noFilesFound:"You have no files or folders here",selectX:{0:"Select %{smart_count}",1:"Select %{smart_count}"},allFilesFromFolderNamed:"All files from folder %{name}",openFolderNamed:"Open folder %{name}",cancel:"Cancel",logOut:"Log out",filter:"Filter",resetFilter:"Reset filter",loading:"Loading...",authenticateWithTitle:"Please authenticate with %{pluginName} to select files",authenticateWith:"Connect to %{pluginName}",signInWithGoogle:"Sign in with Google",searchImages:"Search for images",enterTextToSearch:"Enter text to search for images",search:"Search",emptyFolderAdded:"No files were added from empty folder",folderAlreadyAdded:'The folder "%{folder}" was already added',folderAdded:{0:"Added %{smart_count} file from %{folder}",1:"Added %{smart_count} files from %{folder}"}}});var b=l("plugins"),w=l("restricter"),E=l("storeUnsubscribe"),x=l("emitter"),S=l("preProcessors"),_=l("uploaders"),O=l("postProcessors"),k=l("informAndEmit"),T=l("checkRequiredMetaFieldsOnFile"),N=l("checkRequiredMetaFields"),P=l("assertNewUploadAllowed"),M=l("checkAndCreateFileStateObject"),R=l("startIfAutoProceed"),L=l("addListeners"),$=l("updateOnlineStatus"),D=l("createUpload"),A=l("getUpload"),F=l("removeUpload"),j=l("runUpload");o=Symbol.for("uppy test: getPlugins"),i=Symbol.for("uppy test: createUpload");class I{constructor(e){Object.defineProperty(this,j,{value:ce}),Object.defineProperty(this,F,{value:le}),Object.defineProperty(this,A,{value:ae}),Object.defineProperty(this,D,{value:se}),Object.defineProperty(this,L,{value:q}),Object.defineProperty(this,R,{value:V}),Object.defineProperty(this,M,{value:W}),Object.defineProperty(this,P,{value:z}),Object.defineProperty(this,N,{value:H}),Object.defineProperty(this,T,{value:B}),Object.defineProperty(this,k,{value:U}),Object.defineProperty(this,b,{writable:!0,value:Object.create(null)}),Object.defineProperty(this,w,{writable:!0,value:void 0}),Object.defineProperty(this,E,{writable:!0,value:void 0}),Object.defineProperty(this,x,{writable:!0,value:c()}),Object.defineProperty(this,S,{writable:!0,value:new Set}),Object.defineProperty(this,_,{writable:!0,value:new Set}),Object.defineProperty(this,O,{writable:!0,value:new Set}),Object.defineProperty(this,$,{writable:!0,value:this.updateOnlineStatus.bind(this)}),this.defaultLocale=y;const n={id:"uppy",autoProceed:!1,allowMultipleUploads:!0,allowMultipleUploadBatches:!0,debug:!1,restrictions:r.defaultOptions,meta:{},onBeforeFileAdded:e=>e,onBeforeUpload:e=>e,store:h(),logger:t.justErrorsLogger,infoTimeout:5e3};this.opts={...n,...e,restrictions:{...n.restrictions,...e&&e.restrictions}},e&&e.logger&&e.debug?this.log("You are using a custom `logger`, but also set `debug: true`, which uses built-in logger to output logs to console. Ignoring `debug: true` and using your custom `logger`.","warning"):e&&e.debug&&(this.opts.logger=t.debugLogger),this.log(`Using Core v${this.constructor.VERSION}`),this.i18nInit(),this.calculateProgress=d(this.calculateProgress.bind(this),500,{leading:!0,trailing:!0}),this.store=this.opts.store,this.setState({plugins:{},files:{},currentUploads:{},allowNewUpload:!0,capabilities:{uploadProgress:v(),individualCancellation:!0,resumableUploads:!1},totalProgress:0,meta:{...this.opts.meta},info:[],recoveredState:null}),s(this,w)[w]=new r.Restricter(()=>this.opts,this.i18n),s(this,E)[E]=this.store.subscribe((e,t,n)=>{this.emit("state-update",e,t,n),this.updateAll(t)}),this.opts.debug&&"undefined"!=typeof window&&(window[this.opts.id]=this),s(this,L)[L]()}emit(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];s(this,x)[x].emit(e,...n)}on(e,t){return s(this,x)[x].on(e,t),this}once(e,t){return s(this,x)[x].once(e,t),this}off(e,t){return s(this,x)[x].off(e,t),this}updateAll(e){this.iteratePlugins(t=>{t.update(e)})}setState(e){this.store.setState(e)}getState(){return this.store.getState()}get state(){return this.getState()}setFileState(e,t){if(!this.getState().files[e])throw new Error(`Can’t set state for ${e} (the file could have been removed)`);this.setState({files:{...this.getState().files,[e]:{...this.getState().files[e],...t}}})}i18nInit(){const e=new u([this.defaultLocale,this.opts.locale]);this.i18n=e.translate.bind(e),this.i18nArray=e.translateArray.bind(e),this.locale=e.locale}setOptions(e){this.opts={...this.opts,...e,restrictions:{...this.opts.restrictions,...e&&e.restrictions}},e.meta&&this.setMeta(e.meta),this.i18nInit(),e.locale&&this.iteratePlugins(e=>{e.setOptions()}),this.setState()}resetProgress(){const e={percentage:0,bytesUploaded:0,uploadComplete:!1,uploadStarted:null},t={...this.getState().files},n={};Object.keys(t).forEach(r=>{const o={...t[r]};o.progress={...o.progress,...e},n[r]=o}),this.setState({files:n,totalProgress:0}),this.emit("reset-progress")}addPreProcessor(e){s(this,S)[S].add(e)}removePreProcessor(e){return s(this,S)[S].delete(e)}addPostProcessor(e){s(this,O)[O].add(e)}removePostProcessor(e){return s(this,O)[O].delete(e)}addUploader(e){s(this,_)[_].add(e)}removeUploader(e){return s(this,_)[_].delete(e)}setMeta(e){const t={...this.getState().meta,...e},n={...this.getState().files};Object.keys(n).forEach(t=>{n[t]={...n[t],meta:{...n[t].meta,...e}}}),this.log("Adding metadata:"),this.log(e),this.setState({meta:t,files:n})}setFileMeta(e,t){const n={...this.getState().files};if(!n[e])return void this.log("Was trying to set metadata for a file that has been removed: ",e);const r={...n[e].meta,...t};n[e]={...n[e],meta:r},this.setState({files:n})}getFile(e){return this.getState().files[e]}getFiles(){const{files:e}=this.getState();return Object.values(e)}getObjectOfFilesPerState(){const{files:e,totalProgress:t,error:n}=this.getState(),r=Object.values(e),o=r.filter(e=>{let{progress:t}=e;return!t.uploadComplete&&t.uploadStarted}),i=r.filter(e=>!e.progress.uploadStarted),s=r.filter(e=>e.progress.uploadStarted||e.progress.preprocess||e.progress.postprocess),a=r.filter(e=>e.progress.uploadStarted),l=r.filter(e=>e.isPaused),u=r.filter(e=>e.progress.uploadComplete),c=r.filter(e=>e.error),d=o.filter(e=>!e.isPaused),h=r.filter(e=>e.progress.preprocess||e.progress.postprocess);return{newFiles:i,startedFiles:s,uploadStartedFiles:a,pausedFiles:l,completeFiles:u,erroredFiles:c,inProgressFiles:o,inProgressNotPausedFiles:d,processingFiles:h,isUploadStarted:a.length>0,isAllComplete:100===t&&u.length===r.length&&0===h.length,isAllErrored:!!n&&c.length===r.length,isAllPaused:0!==o.length&&l.length===o.length,isUploadInProgress:o.length>0,isSomeGhost:r.some(e=>e.isGhost)}}validateRestrictions(e,t){void 0===t&&(t=this.getFiles());try{return s(this,w)[w].validate(e,t),{result:!0}}catch(e){return{result:!1,reason:e.message}}}checkIfFileAlreadyExists(e){const{files:t}=this.getState();return!(!t[e]||t[e].isGhost)}addFile(e){s(this,P)[P](e);const{files:t}=this.getState();let n=s(this,M)[M](t,e);return t[n.id]&&t[n.id].isGhost&&(n={...t[n.id],data:e.data,isGhost:!1},this.log(`Replaced the blob in the restored ghost file: ${n.name}, ${n.id}`)),this.setState({files:{...t,[n.id]:n}}),this.emit("file-added",n),this.emit("files-added",[n]),this.log(`Added file: ${n.name}, ${n.id}, mime type: ${n.type}`),s(this,R)[R](),n.id}addFiles(e){s(this,P)[P]();const t={...this.getState().files},n=[],r=[];for(let o=0;o<e.length;o++)try{let r=s(this,M)[M](t,e[o]);t[r.id]&&t[r.id].isGhost&&(r={...t[r.id],data:e[o].data,isGhost:!1},this.log(`Replaced blob in a ghost file: ${r.name}, ${r.id}`)),t[r.id]=r,n.push(r)}catch(e){e.isRestriction||r.push(e)}if(this.setState({files:t}),n.forEach(e=>{this.emit("file-added",e)}),this.emit("files-added",n),n.length>5?this.log(`Added batch of ${n.length} files`):Object.keys(n).forEach(e=>{this.log(`Added file: ${n[e].name}\n id: ${n[e].id}\n type: ${n[e].type}`)}),n.length>0&&s(this,R)[R](),r.length>0){let e="Multiple errors occurred while adding files:\n";if(r.forEach(t=>{e+=`\n * ${t.message}`}),this.info({message:this.i18n("addBulkFilesFailed",{smart_count:r.length}),details:e},"error",this.opts.infoTimeout),"function"==typeof AggregateError)throw new AggregateError(r,e);{const t=new Error(e);throw t.errors=r,t}}}removeFiles(e,t){const{files:n,currentUploads:r}=this.getState(),o={...n},i={...r},s=Object.create(null);function a(e){return void 0===s[e]}e.forEach(e=>{n[e]&&(s[e]=n[e],delete o[e])}),Object.keys(i).forEach(e=>{const t=r[e].fileIDs.filter(a);if(0===t.length)return void delete i[e];const{capabilities:n}=this.getState();if(t.length!==r[e].fileIDs.length&&!n.individualCancellation)throw new Error("individualCancellation is disabled");i[e]={...r[e],fileIDs:t}});const l={currentUploads:i,files:o};0===Object.keys(o).length&&(l.allowNewUpload=!0,l.error=null,l.recoveredState=null),this.setState(l),this.calculateTotalProgress();const u=Object.keys(s);u.forEach(e=>{this.emit("file-removed",s[e],t)}),u.length>5?this.log(`Removed ${u.length} files`):this.log(`Removed files: ${u.join(", ")}`)}removeFile(e,t){void 0===t&&(t=null),this.removeFiles([e],t)}pauseResume(e){if(!this.getState().capabilities.resumableUploads||this.getFile(e).uploadComplete)return;const t=!(this.getFile(e).isPaused||!1);return this.setFileState(e,{isPaused:t}),this.emit("upload-pause",e,t),t}pauseAll(){const e={...this.getState().files};Object.keys(e).filter(t=>!e[t].progress.uploadComplete&&e[t].progress.uploadStarted).forEach(t=>{const n={...e[t],isPaused:!0};e[t]=n}),this.setState({files:e}),this.emit("pause-all")}resumeAll(){const e={...this.getState().files};Object.keys(e).filter(t=>!e[t].progress.uploadComplete&&e[t].progress.uploadStarted).forEach(t=>{const n={...e[t],isPaused:!1,error:null};e[t]=n}),this.setState({files:e}),this.emit("resume-all")}retryAll(){const e={...this.getState().files},t=Object.keys(e).filter(t=>e[t].error);if(t.forEach(t=>{const n={...e[t],isPaused:!1,error:null};e[t]=n}),this.setState({files:e,error:null}),this.emit("retry-all",t),0===t.length)return Promise.resolve({successful:[],failed:[]});const n=s(this,D)[D](t,{forceAllowNewUpload:!0});return s(this,j)[j](n)}cancelAll(e){let{reason:t="user"}=void 0===e?{}:e;if(this.emit("cancel-all",{reason:t}),"user"===t){const{files:e}=this.getState(),t=Object.keys(e);t.length&&this.removeFiles(t,"cancel-all"),this.setState({totalProgress:0,error:null,recoveredState:null})}}retryUpload(e){this.setFileState(e,{error:null,isPaused:!1}),this.emit("upload-retry",e);const t=s(this,D)[D]([e],{forceAllowNewUpload:!0});return s(this,j)[j](t)}reset(){this.cancelAll(...arguments)}logout(){this.iteratePlugins(e=>{e.provider&&e.provider.logout&&e.provider.logout()})}calculateProgress(e,t){if(null==e||!this.getFile(e.id))return void this.log(`Not setting progress for a file that has been removed: ${null==e?void 0:e.id}`);const n=Number.isFinite(t.bytesTotal)&&t.bytesTotal>0;this.setFileState(e.id,{progress:{...this.getFile(e.id).progress,bytesUploaded:t.bytesUploaded,bytesTotal:t.bytesTotal,percentage:n?Math.round(t.bytesUploaded/t.bytesTotal*100):0}}),this.calculateTotalProgress()}calculateTotalProgress(){const e=this.getFiles().filter(e=>e.progress.uploadStarted||e.progress.preprocess||e.progress.postprocess);if(0===e.length)return this.emit("progress",0),void this.setState({totalProgress:0});const t=e.filter(e=>null!=e.progress.bytesTotal),n=e.filter(e=>null==e.progress.bytesTotal);if(0===t.length){const t=100*e.length,r=n.reduce((e,t)=>e+t.progress.percentage,0),o=Math.round(r/t*100);return void this.setState({totalProgress:o})}let r=t.reduce((e,t)=>e+t.progress.bytesTotal,0);const o=r/t.length;r+=o*n.length;let i=0;t.forEach(e=>{i+=e.progress.bytesUploaded}),n.forEach(e=>{i+=o*(e.progress.percentage||0)/100});let s=0===r?0:Math.round(i/r*100);s>100&&(s=100),this.setState({totalProgress:s}),this.emit("progress",s)}updateOnlineStatus(){void 0===window.navigator.onLine||window.navigator.onLine?(this.emit("is-online"),this.wasOffline&&(this.emit("back-online"),this.info(this.i18n("connectedToInternet"),"success",3e3),this.wasOffline=!1)):(this.emit("is-offline"),this.info(this.i18n("noInternetConnection"),"error",0),this.wasOffline=!0)}getID(){return this.opts.id}use(e,t){if("function"!=typeof e){throw new TypeError(`Expected a plugin class, but got ${null===e?"null":typeof e}. Please verify that the plugin was imported and spelled correctly.`)}const n=new e(this,t),r=n.id;if(!r)throw new Error("Your plugin must have an id");if(!n.type)throw new Error("Your plugin must have a type");const o=this.getPlugin(r);if(o){const e=`Already found a plugin named '${o.id}'. Tried to use: '${r}'.\nUppy plugins must have unique \`id\` options. See https://uppy.io/docs/plugins/#id.`;throw new Error(e)}return e.VERSION&&this.log(`Using ${r} v${e.VERSION}`),n.type in s(this,b)[b]?s(this,b)[b][n.type].push(n):s(this,b)[b][n.type]=[n],n.install(),this}getPlugin(e){for(const t of Object.values(s(this,b)[b])){const n=t.find(t=>t.id===e);if(null!=n)return n}}[o](e){return s(this,b)[b][e]}iteratePlugins(e){Object.values(s(this,b)[b]).flat(1).forEach(e)}removePlugin(e){this.log(`Removing plugin ${e.id}`),this.emit("plugin-remove",e),e.uninstall&&e.uninstall();const t=s(this,b)[b][e.type],n=t.findIndex(t=>t.id===e.id);-1!==n&&t.splice(n,1);const r={plugins:{...this.getState().plugins,[e.id]:void 0}};this.setState(r)}close(e){let{reason:t}=void 0===e?{}:e;this.log(`Closing Uppy instance ${this.opts.id}: removing all files and uninstalling plugins`),this.cancelAll({reason:t}),s(this,E)[E](),this.iteratePlugins(e=>{this.removePlugin(e)}),"undefined"!=typeof window&&window.removeEventListener&&(window.removeEventListener("online",s(this,$)[$]),window.removeEventListener("offline",s(this,$)[$]))}hideInfo(){const{info:e}=this.getState();this.setState({info:e.slice(1)}),this.emit("info-hidden")}info(e,t,n){void 0===t&&(t="info"),void 0===n&&(n=3e3);const r="object"==typeof e;this.setState({info:[...this.getState().info,{type:t,message:r?e.message:e,details:r?e.details:null}]}),setTimeout(()=>this.hideInfo(),n),this.emit("info-visible")}log(e,t){const{logger:n}=this.opts;switch(t){case"error":n.error(e);break;case"warning":n.warn(e);break;default:n.debug(e)}}restore(e){return this.log(`Core: attempting to restore upload "${e}"`),this.getState().currentUploads[e]?s(this,j)[j](e):(s(this,F)[F](e),Promise.reject(new Error("Nonexistent upload")))}[i](){return s(this,D)[D](...arguments)}addResultData(e,t){if(!s(this,A)[A](e))return void this.log(`Not setting result for an upload that has been removed: ${e}`);const{currentUploads:n}=this.getState(),r={...n[e],result:{...n[e].result,...t}};this.setState({currentUploads:{...n,[e]:r}})}upload(){var e;null!=(e=s(this,b)[b].uploader)&&e.length||this.log("No uploader type plugins are used","warning");let{files:t}=this.getState();const n=this.opts.onBeforeUpload(t);return!1===n?Promise.reject(new Error("Not starting the upload because onBeforeUpload returned false")):(n&&"object"==typeof n&&(t=n,this.setState({files:t})),Promise.resolve().then(()=>s(this,w)[w].validateMinNumberOfFiles(t)).catch(e=>{throw s(this,k)[k](e),e}).then(()=>{if(!s(this,N)[N](t))throw new r.RestrictionError(this.i18n("missingRequiredMetaField"))}).catch(e=>{throw e}).then(()=>{const{currentUploads:e}=this.getState(),n=Object.values(e).flatMap(e=>e.fileIDs),r=[];Object.keys(t).forEach(e=>{const t=this.getFile(e);t.progress.uploadStarted||-1!==n.indexOf(e)||r.push(t.id)});const o=s(this,D)[D](r);return s(this,j)[j](o)}).catch(e=>{throw this.emit("error",e),this.log(e,"error"),e}))}}function U(e,t){const{message:n,details:r=""}=e;e.isRestriction?this.emit("restriction-failed",t,e):this.emit("error",e),this.info({message:n,details:r},"error",this.opts.infoTimeout),this.log(`${n} ${r}`.trim(),"error")}function B(e){const{missingFields:t,error:n}=s(this,w)[w].getMissingRequiredMetaFields(e);return!(t.length>0)||(this.setFileState(e.id,{missingRequiredMetaFields:t}),this.log(n.message),this.emit("restriction-failed",e,n),!1)}function H(e){let t=!0;for(const n of Object.values(e))s(this,T)[T](n)||(t=!1);return t}function z(e){const{allowNewUpload:t}=this.getState();if(!1===t){const t=new r.RestrictionError(this.i18n("noMoreFilesAllowed"));throw s(this,k)[k](t,e),t}}function W(e,t){const n=p(t),o=m(n,t),i=f(o).extension,a=Boolean(t.isRemote),l=g({...t,type:n});if(this.checkIfFileAlreadyExists(l)){const e=new r.RestrictionError(this.i18n("noDuplicates",{fileName:o}));throw s(this,k)[k](e,t),e}const u=t.meta||{};u.name=o,u.type=n;const c=Number.isFinite(t.data.size)?t.data.size:null;let d={source:t.source||"",id:l,name:o,extension:i||"",meta:{...this.getState().meta,...u},type:n,data:t.data,progress:{percentage:0,bytesUploaded:0,bytesTotal:c,uploadComplete:!1,uploadStarted:null},size:c,isRemote:a,remote:t.remote||"",preview:t.preview};const h=this.opts.onBeforeFileAdded(d,e);if(!1===h){const e=new r.RestrictionError("Cannot add the file because onBeforeFileAdded returned false.");throw this.emit("restriction-failed",t,e),e}"object"==typeof h&&null!==h&&(d=h);try{const t=Object.keys(e).map(t=>e[t]);s(this,w)[w].validate(d,t)}catch(e){throw s(this,k)[k](e,d),e}return d}function V(){this.opts.autoProceed&&!this.scheduledAutoProceed&&(this.scheduledAutoProceed=setTimeout(()=>{this.scheduledAutoProceed=null,this.upload().catch(e=>{e.isRestriction||this.log(e.stack||e.message||e)})},4))}function q(){const e=(e,t,n)=>{let r=e.message||"Unknown error";e.details&&(r+=` ${e.details}`),this.setState({error:r}),null!=t&&t.id in this.getState().files&&this.setFileState(t.id,{error:r,response:n})};this.on("error",e),this.on("upload-error",(t,n,r)=>{if(e(n,t,r),"object"==typeof n&&n.message){const e=new Error(n.message);e.details=n.message,n.details&&(e.details+=` ${n.details}`),e.message=this.i18n("failedToUpload",{file:null==t?void 0:t.name}),s(this,k)[k](e)}else s(this,k)[k](n)}),this.on("upload",()=>{this.setState({error:null})}),this.on("upload-started",e=>{null!=e&&this.getFile(e.id)?this.setFileState(e.id,{progress:{uploadStarted:Date.now(),uploadComplete:!1,percentage:0,bytesUploaded:0,bytesTotal:e.size}}):this.log(`Not setting progress for a file that has been removed: ${null==e?void 0:e.id}`)}),this.on("upload-progress",this.calculateProgress),this.on("upload-success",(e,t)=>{if(null==e||!this.getFile(e.id))return void this.log(`Not setting progress for a file that has been removed: ${null==e?void 0:e.id}`);const n=this.getFile(e.id).progress;this.setFileState(e.id,{progress:{...n,postprocess:s(this,O)[O].size>0?{mode:"indeterminate"}:null,uploadComplete:!0,percentage:100,bytesUploaded:n.bytesTotal},response:t,uploadURL:t.uploadURL,isPaused:!1}),null==e.size&&this.setFileState(e.id,{size:t.bytesUploaded||n.bytesTotal}),this.calculateTotalProgress()}),this.on("preprocess-progress",(e,t)=>{null!=e&&this.getFile(e.id)?this.setFileState(e.id,{progress:{...this.getFile(e.id).progress,preprocess:t}}):this.log(`Not setting progress for a file that has been removed: ${null==e?void 0:e.id}`)}),this.on("preprocess-complete",e=>{if(null==e||!this.getFile(e.id))return void this.log(`Not setting progress for a file that has been removed: ${null==e?void 0:e.id}`);const t={...this.getState().files};t[e.id]={...t[e.id],progress:{...t[e.id].progress}},delete t[e.id].progress.preprocess,this.setState({files:t})}),this.on("postprocess-progress",(e,t)=>{null!=e&&this.getFile(e.id)?this.setFileState(e.id,{progress:{...this.getState().files[e.id].progress,postprocess:t}}):this.log(`Not setting progress for a file that has been removed: ${null==e?void 0:e.id}`)}),this.on("postprocess-complete",e=>{if(null==e||!this.getFile(e.id))return void this.log(`Not setting progress for a file that has been removed: ${null==e?void 0:e.id}`);const t={...this.getState().files};t[e.id]={...t[e.id],progress:{...t[e.id].progress}},delete t[e.id].progress.postprocess,this.setState({files:t})}),this.on("restored",()=>{this.calculateTotalProgress()}),this.on("dashboard:file-edit-complete",e=>{e&&s(this,T)[T](e)}),"undefined"!=typeof window&&window.addEventListener&&(window.addEventListener("online",s(this,$)[$]),window.addEventListener("offline",s(this,$)[$]),setTimeout(s(this,$)[$],3e3))}function se(t,n){void 0===n&&(n={});const{forceAllowNewUpload:r=!1}=n,{allowNewUpload:o,currentUploads:i}=this.getState();if(!o&&!r)throw new Error("Cannot create a new upload: already uploading.");const s=(0,e.nanoid)();return this.emit("upload",{id:s,fileIDs:t}),this.setState({allowNewUpload:!1!==this.opts.allowMultipleUploadBatches&&!1!==this.opts.allowMultipleUploads,currentUploads:{...i,[s]:{fileIDs:t,step:0,result:{}}}}),s}function ae(e){const{currentUploads:t}=this.getState();return t[e]}function le(e){const t={...this.getState().currentUploads};delete t[e],this.setState({currentUploads:t})}async function ce(e){let{currentUploads:t}=this.getState(),n=t[e];const r=n.step||0,o=[...s(this,S)[S],...s(this,_)[_],...s(this,O)[O]];try{for(let i=r;i<o.length&&n;i++){const r=o[i],s={...n,step:i};this.setState({currentUploads:{...t,[e]:s}}),await r(s.fileIDs,e),t=this.getState().currentUploads,n=t[e]}}catch(t){throw s(this,F)[F](e),t}if(n){n.fileIDs.forEach(e=>{const t=this.getFile(e);t&&t.progress.postprocess&&this.emit("postprocess-complete",t)});const r=n.fileIDs.map(e=>this.getFile(e)),o=r.filter(e=>!e.error),i=r.filter(e=>e.error);await this.addResultData(e,{successful:o,failed:i,uploadID:e}),t=this.getState().currentUploads,n=t[e]}let i;return n&&(i=n.result,this.emit("complete",i),s(this,F)[F](e)),null==i&&this.log(`Not setting result for an upload that has been removed: ${e}`),i}return I.VERSION="2.3.4",re=I}var me,ye,be,we,Ee,xe,Se,_e,Oe,ke,Ce,Te,Ne,Pe={},Me=[],Re=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Le=Array.isArray;function $e(e,t){for(var n in t)e[n]=t[n];return e}function De(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Ae(e,t,n){var r,o,i,s={};for(i in t)"key"==i?r=t[i]:"ref"==i?o=t[i]:s[i]=t[i];if(arguments.length>2&&(s.children=arguments.length>3?me.call(arguments,2):n),"function"==typeof e&&null!=e.defaultProps)for(i in e.defaultProps)void 0===s[i]&&(s[i]=e.defaultProps[i]);return Fe(e,s,r,o,null)}function Fe(e,t,n,r,o){var i={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:null==o?++be:o,__i:-1,__u:0};return null==o&&null!=ye.vnode&&ye.vnode(i),i}function je(e){return e.children}function Ie(e,t){this.props=e,this.context=t}function Ue(e,t){if(null==t)return e.__?Ue(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e)return n.__e;return"function"==typeof e.type?Ue(e):null}function Be(e){var t,n;if(null!=(e=e.__)&&null!=e.__c){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e){e.__e=e.__c.base=n.__e;break}return Be(e)}}function He(e){(!e.__d&&(e.__d=!0)&&Ee.push(e)&&!ze.__r++||xe!=ye.debounceRendering)&&((xe=ye.debounceRendering)||Se)(ze)}function ze(){for(var e,t,n,r,o,i,s,a=1;Ee.length;)Ee.length>a&&Ee.sort(_e),e=Ee.shift(),a=Ee.length,e.__d&&(n=void 0,r=void 0,o=(r=(t=e).__v).__e,i=[],s=[],t.__P&&((n=$e({},r)).__v=r.__v+1,ye.vnode&&ye.vnode(n),Ye(t.__P,n,r,t.__n,t.__P.namespaceURI,32&r.__u?[o]:null,i,null==o?Ue(r):o,!!(32&r.__u),s),n.__v=r.__v,n.__.__k[n.__i]=n,Ze(i,n,s),r.__e=r.__=null,n.__e!=o&&Be(n)));ze.__r=0}function We(e,t,n,r,o,i,s,a,l,u,c){var d,h,p,f,g,v,m,y=r&&r.__k||Me,b=t.length;for(l=Ve(n,t,y,l,b),d=0;d<b;d++)null!=(p=n.__k[d])&&(h=-1==p.__i?Pe:y[p.__i]||Pe,p.__i=d,v=Ye(e,p,h,o,i,s,a,l,u,c),f=p.__e,p.ref&&h.ref!=p.ref&&(h.ref&&nt(h.ref,null,p),c.push(p.ref,p.__c||f,p)),null==g&&null!=f&&(g=f),(m=!!(4&p.__u))||h.__k===p.__k?l=qe(p,l,e,m):"function"==typeof p.type&&void 0!==v?l=v:f&&(l=f.nextSibling),p.__u&=-7);return n.__e=g,l}function Ve(e,t,n,r,o){var i,s,a,l,u,c=n.length,d=c,h=0;for(e.__k=new Array(o),i=0;i<o;i++)null!=(s=t[i])&&"boolean"!=typeof s&&"function"!=typeof s?(l=i+h,(s=e.__k[i]="string"==typeof s||"number"==typeof s||"bigint"==typeof s||s.constructor==String?Fe(null,s,null,null,null):Le(s)?Fe(je,{children:s},null,null,null):null==s.constructor&&s.__b>0?Fe(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):s).__=e,s.__b=e.__b+1,a=null,-1!=(u=s.__i=Ke(s,n,l,d))&&(d--,(a=n[u])&&(a.__u|=2)),null==a||null==a.__v?(-1==u&&(o>c?h--:o<c&&h++),"function"!=typeof s.type&&(s.__u|=4)):u!=l&&(u==l-1?h--:u==l+1?h++:(u>l?h--:h++,s.__u|=4))):e.__k[i]=null;if(d)for(i=0;i<c;i++)null!=(a=n[i])&&!(2&a.__u)&&(a.__e==r&&(r=Ue(a)),rt(a,a));return r}function qe(e,t,n,r){var o,i;if("function"==typeof e.type){for(o=e.__k,i=0;o&&i<o.length;i++)o[i]&&(o[i].__=e,t=qe(o[i],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=Ue(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do{t=t&&t.nextSibling}while(null!=t&&8==t.nodeType);return t}function Ke(e,t,n,r){var o,i,s,a=e.key,l=e.type,u=t[n],c=null!=u&&!(2&u.__u);if(null===u&&null==e.key||c&&a==u.key&&l==u.type)return n;if(r>(c?1:0))for(o=n-1,i=n+1;o>=0||i<t.length;)if(null!=(u=t[s=o>=0?o--:i++])&&!(2&u.__u)&&a==u.key&&l==u.type)return s;return-1}function Je(e,t,n){"-"==t[0]?e.setProperty(t,null==n?"":n):e[t]=null==n?"":"number"!=typeof n||Re.test(t)?n:n+"px"}function Ge(e,t,n,r,o){var i,s;e:if("style"==t)if("string"==typeof n)e.style.cssText=n;else{if("string"==typeof r&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||Je(e.style,t,"");if(n)for(t in n)r&&n[t]==r[t]||Je(e.style,t,n[t])}else if("o"==t[0]&&"n"==t[1])i=t!=(t=t.replace(Oe,"$1")),s=t.toLowerCase(),t=s in e||"onFocusOut"==t||"onFocusIn"==t?s.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+i]=n,n?r?n.u=r.u:(n.u=ke,e.addEventListener(t,i?Te:Ce,i)):e.removeEventListener(t,i?Te:Ce,i);else{if("http://www.w3.org/2000/svg"==o)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!=t&&"height"!=t&&"href"!=t&&"list"!=t&&"form"!=t&&"tabIndex"!=t&&"download"!=t&&"rowSpan"!=t&&"colSpan"!=t&&"role"!=t&&"popover"!=t&&t in e)try{e[t]=null==n?"":n;break e}catch(e){}"function"==typeof n||(null==n||!1===n&&"-"!=t[4]?e.removeAttribute(t):e.setAttribute(t,"popover"==t&&1==n?"":n))}}function Xe(e){return function(t){if(this.l){var n=this.l[t.type+e];if(null==t.t)t.t=ke++;else if(t.t<n.u)return;return n(ye.event?ye.event(t):t)}}}function Ye(e,t,n,r,o,i,s,a,l,u){var c,d,h,p,f,g,v,m,y,b,w,E,x,S,_,O,k,C=t.type;if(null!=t.constructor)return null;128&n.__u&&(l=!!(32&n.__u),i=[a=t.__e=n.__e]),(c=ye.__b)&&c(t);e:if("function"==typeof C)try{if(m=t.props,y="prototype"in C&&C.prototype.render,b=(c=C.contextType)&&r[c.__c],w=c?b?b.props.value:c.__:r,n.__c?v=(d=t.__c=n.__c).__=d.__E:(y?t.__c=d=new C(m,w):(t.__c=d=new Ie(m,w),d.constructor=C,d.render=ot),b&&b.sub(d),d.props=m,d.state||(d.state={}),d.context=w,d.__n=r,h=d.__d=!0,d.__h=[],d._sb=[]),y&&null==d.__s&&(d.__s=d.state),y&&null!=C.getDerivedStateFromProps&&(d.__s==d.state&&(d.__s=$e({},d.__s)),$e(d.__s,C.getDerivedStateFromProps(m,d.__s))),p=d.props,f=d.state,d.__v=t,h)y&&null==C.getDerivedStateFromProps&&null!=d.componentWillMount&&d.componentWillMount(),y&&null!=d.componentDidMount&&d.__h.push(d.componentDidMount);else{if(y&&null==C.getDerivedStateFromProps&&m!==p&&null!=d.componentWillReceiveProps&&d.componentWillReceiveProps(m,w),!d.__e&&null!=d.shouldComponentUpdate&&!1===d.shouldComponentUpdate(m,d.__s,w)||t.__v==n.__v){for(t.__v!=n.__v&&(d.props=m,d.state=d.__s,d.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(e){e&&(e.__=t)}),E=0;E<d._sb.length;E++)d.__h.push(d._sb[E]);d._sb=[],d.__h.length&&s.push(d);break e}null!=d.componentWillUpdate&&d.componentWillUpdate(m,d.__s,w),y&&null!=d.componentDidUpdate&&d.__h.push(function(){d.componentDidUpdate(p,f,g)})}if(d.context=w,d.props=m,d.__P=e,d.__e=!1,x=ye.__r,S=0,y){for(d.state=d.__s,d.__d=!1,x&&x(t),c=d.render(d.props,d.state,d.context),_=0;_<d._sb.length;_++)d.__h.push(d._sb[_]);d._sb=[]}else do{d.__d=!1,x&&x(t),c=d.render(d.props,d.state,d.context),d.state=d.__s}while(d.__d&&++S<25);d.state=d.__s,null!=d.getChildContext&&(r=$e($e({},r),d.getChildContext())),y&&!h&&null!=d.getSnapshotBeforeUpdate&&(g=d.getSnapshotBeforeUpdate(p,f)),O=c,null!=c&&c.type===je&&null==c.key&&(O=et(c.props.children)),a=We(e,Le(O)?O:[O],t,n,r,o,i,s,a,l,u),d.base=t.__e,t.__u&=-161,d.__h.length&&s.push(d),v&&(d.__E=d.__=null)}catch(e){if(t.__v=null,l||null!=i)if(e.then){for(t.__u|=l?160:128;a&&8==a.nodeType&&a.nextSibling;)a=a.nextSibling;i[i.indexOf(a)]=null,t.__e=a}else{for(k=i.length;k--;)De(i[k]);Qe(t)}else t.__e=n.__e,t.__k=n.__k,e.then||Qe(t);ye.__e(e,t,n)}else null==i&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):a=t.__e=tt(n.__e,t,n,r,o,i,s,l,u);return(c=ye.diffed)&&c(t),128&t.__u?void 0:a}function Qe(e){e&&e.__c&&(e.__c.__e=!0),e&&e.__k&&e.__k.forEach(Qe)}function Ze(e,t,n){for(var r=0;r<n.length;r++)nt(n[r],n[++r],n[++r]);ye.__c&&ye.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){ye.__e(e,t.__v)}})}function et(e){return"object"!=typeof e||null==e||e.__b&&e.__b>0?e:Le(e)?e.map(et):$e({},e)}function tt(e,t,n,r,o,i,s,a,l){var u,c,d,h,p,f,g,v=n.props,m=t.props,y=t.type;if("svg"==y?o="http://www.w3.org/2000/svg":"math"==y?o="http://www.w3.org/1998/Math/MathML":o||(o="http://www.w3.org/1999/xhtml"),null!=i)for(u=0;u<i.length;u++)if((p=i[u])&&"setAttribute"in p==!!y&&(y?p.localName==y:3==p.nodeType)){e=p,i[u]=null;break}if(null==e){if(null==y)return document.createTextNode(m);e=document.createElementNS(o,y,m.is&&m),a&&(ye.__m&&ye.__m(t,i),a=!1),i=null}if(null==y)v===m||a&&e.data==m||(e.data=m);else{if(i=i&&me.call(e.childNodes),v=n.props||Pe,!a&&null!=i)for(v={},u=0;u<e.attributes.length;u++)v[(p=e.attributes[u]).name]=p.value;for(u in v)if(p=v[u],"children"==u);else if("dangerouslySetInnerHTML"==u)d=p;else if(!(u in m)){if("value"==u&&"defaultValue"in m||"checked"==u&&"defaultChecked"in m)continue;Ge(e,u,null,p,o)}for(u in m)p=m[u],"children"==u?h=p:"dangerouslySetInnerHTML"==u?c=p:"value"==u?f=p:"checked"==u?g=p:a&&"function"!=typeof p||v[u]===p||Ge(e,u,p,v[u],o);if(c)a||d&&(c.__html==d.__html||c.__html==e.innerHTML)||(e.innerHTML=c.__html),t.__k=[];else if(d&&(e.innerHTML=""),We("template"==t.type?e.content:e,Le(h)?h:[h],t,n,r,"foreignObject"==y?"http://www.w3.org/1999/xhtml":o,i,s,i?i[0]:n.__k&&Ue(n,0),a,l),null!=i)for(u=i.length;u--;)De(i[u]);a||(u="value","progress"==y&&null==f?e.removeAttribute("value"):null!=f&&(f!==e[u]||"progress"==y&&!f||"option"==y&&f!=v[u])&&Ge(e,u,f,v[u],o),u="checked",null!=g&&g!=e[u]&&Ge(e,u,g,v[u],o))}return e}function nt(e,t,n){try{if("function"==typeof e){var r="function"==typeof e.__u;r&&e.__u(),r&&null==t||(e.__u=e(t))}else e.current=t}catch(e){ye.__e(e,n)}}function rt(e,t,n){var r,o;if(ye.unmount&&ye.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||nt(r,null,t)),null!=(r=e.__c)){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){ye.__e(e,t)}r.base=r.__P=null}if(r=e.__k)for(o=0;o<r.length;o++)r[o]&&rt(r[o],t,n||"function"!=typeof e.type);n||De(e.__e),e.__c=e.__=e.__e=void 0}function ot(e,t,n){return this.constructor(e,n)}function it(e,t,n){var r,o,i,s;t==document&&(t=document.documentElement),ye.__&&ye.__(e,t),o=(r="function"==typeof n)?null:n&&n.__k||t.__k,i=[],s=[],Ye(t,e=(!r&&n||t).__k=Ae(je,null,[e]),o||Pe,Pe,t.namespaceURI,!r&&n?[n]:o?null:t.firstChild?me.call(t.childNodes):null,i,!r&&n?n:o?o.__e:t.firstChild,r,s),Ze(i,e,s)}me=Me.slice,ye={__e:function(e,t,n,r){for(var o,i,s;t=t.__;)if((o=t.__c)&&!o.__)try{if((i=o.constructor)&&null!=i.getDerivedStateFromError&&(o.setState(i.getDerivedStateFromError(e)),s=o.__d),null!=o.componentDidCatch&&(o.componentDidCatch(e,r||{}),s=o.__d),s)return o.__E=o}catch(t){e=t}throw e}},be=0,we=function(e){return null!=e&&null==e.constructor},Ie.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!=this.state?this.__s:this.__s=$e({},this.state),"function"==typeof e&&(e=e($e({},n),this.props)),e&&$e(n,e),null!=e&&this.__v&&(t&&this._sb.push(t),He(this))},Ie.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),He(this))},Ie.prototype.render=je,Ee=[],Se="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,_e=function(e,t){return e.__v.__b-t.__v.__b},ze.__r=0,Oe=/(PointerCapture)$|Capture$/i,ke=0,Ce=Xe(!1),Te=Xe(!0),Ne=0;var st,at,lt,ut,ct,dt,ht,pt,ft,gt,vt,mt=Object.freeze({__proto__:null,Component:Ie,Fragment:je,cloneElement:function(e,t,n){var r,o,i,s,a=$e({},e.props);for(i in e.type&&e.type.defaultProps&&(s=e.type.defaultProps),t)"key"==i?r=t[i]:"ref"==i?o=t[i]:a[i]=void 0===t[i]&&null!=s?s[i]:t[i];return arguments.length>2&&(a.children=arguments.length>3?me.call(arguments,2):n),Fe(e.type,a,r||e.key,o||e.ref,null)},createContext:function(e){function t(e){var n,r;return this.getChildContext||(n=new Set,(r={})[t.__c]=this,this.getChildContext=function(){return r},this.componentWillUnmount=function(){n=null},this.shouldComponentUpdate=function(e){this.props.value!=e.value&&n.forEach(function(e){e.__e=!0,He(e)})},this.sub=function(e){n.add(e);var t=e.componentWillUnmount;e.componentWillUnmount=function(){n&&n.delete(e),t&&t.call(e)}}),e.children}return t.__c="__cC"+Ne++,t.__=e,t.Provider=t.__l=(t.Consumer=function(e,t){return e.children(t)}).contextType=t,t},createElement:Ae,createRef:function(){return{current:null}},h:Ae,hydrate:function e(t,n){it(t,n,e)},get isValidElement(){return we},get options(){return ye},render:it,toChildArray:function e(t,n){return n=n||[],null==t||"boolean"==typeof t||(Le(t)?t.some(function(t){e(t,n)}):n.push(t)),n}}),yt=E(mt);function bt(){if(ut)return lt;ut=1;const e=at?st:(at=1,st=function(e){return(null==e?void 0:e.nodeType)===Node.ELEMENT_NODE});return lt=function(t,n){return void 0===n&&(n=document),"string"==typeof t?n.querySelector(t):e(t)?t:null}}function wt(){if(pt)return ht;pt=1;const e=de();return ht=class{constructor(e,t){void 0===t&&(t={}),this.uppy=e,this.opts=t}getPluginState(){const{plugins:e}=this.uppy.getState();return e[this.id]||{}}setPluginState(e){const{plugins:t}=this.uppy.getState();this.uppy.setState({plugins:{...t,[this.id]:{...t[this.id],...e}}})}setOptions(e){this.opts={...this.opts,...e},this.setPluginState(),this.i18nInit()}i18nInit(){const t=new e([this.defaultLocale,this.uppy.locale,this.opts.locale]);this.i18n=t.translate.bind(t),this.i18nArray=t.translateArray.bind(t),this.setPluginState()}addTarget(){throw new Error("Extend the addTarget method to add your plugin to another plugin's target")}install(){}uninstall(){}render(){throw new Error("Extend the render method to add your plugin to a DOM element")}update(){}afterUpdate(){}}}function Et(){if(gt)return ft;gt=1;var e=yt;function t(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}var n=0;function r(e){return"__private_"+n+++"_"+e}const o=bt(),i=dt?ct:(dt=1,ct=function(e){for(var t;e&&!e.dir;)e=e.parentNode;return null==(t=e)?void 0:t.dir}),s=wt();var a=r("updateUI");class l extends s{constructor(){super(...arguments),Object.defineProperty(this,a,{writable:!0,value:void 0})}mount(n,r){const s=r.id,u=o(n);if(u){this.isTargetDOMEl=!0;const r=document.createElement("div");return r.classList.add("uppy-Root"),t(this,a)[a]=function(e){let t=null,n=null;return function(){for(var r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];return n=o,t||(t=Promise.resolve().then(()=>(t=null,e(...n)))),t}}(t=>{this.uppy.getPlugin(this.id)&&((0,e.render)(this.render(t),r),this.afterUpdate())}),this.uppy.log(`Installing ${s} to a DOM element '${n}'`),this.opts.replaceTargetContent&&(u.innerHTML=""),(0,e.render)(this.render(this.uppy.getState()),r),this.el=r,u.appendChild(r),r.dir=this.opts.direction||i(r)||"ltr",this.onMount(),this.el}let c;if("object"==typeof n&&n instanceof l)c=n;else if("function"==typeof n){const e=n;this.uppy.iteratePlugins(t=>{t instanceof e&&(c=t)})}if(c)return this.uppy.log(`Installing ${s} to ${c.id}`),this.parent=c,this.el=c.addTarget(r),this.onMount(),this.el;this.uppy.log(`Not installing ${s}`);let d=`Invalid target option given to ${s}.`;throw d+="function"==typeof n?" The given target is not a Plugin class. Please check that you're not specifying a React Component instead of a plugin. If you are using @uppy/* packages directly, make sure you have only 1 version of @uppy/core installed: run `npm ls @uppy/core` on the command line and verify that all the versions match and are deduped correctly.":"If you meant to target an HTML element, please make sure that the element exists. Check that the <script> tag initializing Uppy is right before the closing </body> tag at the end of the page. (see https://github.com/transloadit/uppy/issues/1042)\n\nIf you meant to target a plugin, please confirm that your `import` statements or `require` calls are correct.",new Error(d)}update(e){var n,r;null!=this.el&&(null==(n=(r=t(this,a))[a])||n.call(r,e))}unmount(){var e;this.isTargetDOMEl&&(null==(e=this.el)||e.remove());this.onUnmount()}onMount(){}onUnmount(){}}return ft=l}var xt,St,_t,Ot,kt,Ct,Tt,Nt,Pt,Mt,Rt=(vt||(vt=1,function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.Uppy=t.UIPlugin=t.BasePlugin=void 0,Object.defineProperty(t,"debugLogger",{enumerable:!0,get:function(){return n.debugLogger}});var n=C();e.exports=ve();const r=Et();t.UIPlugin=r;const o=wt();t.BasePlugin=o;const i=ve();t.Uppy=i;const s=Et(),a=wt();i.Uppy=i,i.UIPlugin=s,i.BasePlugin=a,i.debugLogger=n.debugLogger}(O,O.exports)),O.exports),Lt=w(Rt),$t={};function Dt(){if(St)return xt;St=1;class e extends Error{constructor(e,t){void 0===t&&(t=null),super("This looks like a network error, the endpoint might be blocked by an internet provider or a firewall."),this.cause=e,this.isNetworkError=!0,this.request=t}}return xt=e}function At(){if(Mt)return Pt;let e;function t(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}Mt=1;var n=0;function r(e){return"__private_"+n+++"_"+e}const o=function(){if(Ot)return _t;Ot=1;const e=Dt();return _t=function(){return fetch(...arguments).catch(t=>{throw"AbortError"===t.name?t:new e(t)})},_t}(),i=function(){if(Ct)return kt;Ct=1;const e=ce();class t extends Error{constructor(t,n){void 0===n&&(n={}),super(t),this.cause=n.cause,this.cause&&e(this.cause,"isNetworkError")&&(this.isNetworkError=this.cause.isNetworkError)}}return kt=t}(),s=function(){if(Nt)return Tt;Nt=1;class e extends Error{constructor(){super("Authorization required"),this.name="AuthError",this.isAuthError=!0}}return Tt=e}();async function a(e){if(401===e.status)throw new s;const t=e.json();if(e.status<200||e.status>300){let n=`Failed request with status: ${e.status}. ${e.statusText}`;try{const e=await t;n=e.message?`${n} message: ${e.message}`:n,n=e.requestId?`${n} request-Id: ${e.requestId}`:n}finally{throw new Error(n)}}return t}var l=r("companionHeaders"),u=r("getPostResponseFunc"),c=r("getUrl"),d=r("errorHandler");e=Symbol.for("uppy test: getCompanionHeaders");class h{constructor(e,n){Object.defineProperty(this,d,{value:f}),Object.defineProperty(this,c,{value:p}),Object.defineProperty(this,l,{writable:!0,value:void 0}),Object.defineProperty(this,u,{writable:!0,value:e=>t=>e?t:this.onReceiveResponse(t)}),this.uppy=e,this.opts=n,this.onReceiveResponse=this.onReceiveResponse.bind(this),this.allowedHeaders=["accept","content-type","uppy-auth-token"],this.preflightDone=!1,t(this,l)[l]=null==n?void 0:n.companionHeaders}setCompanionHeaders(e){t(this,l)[l]=e}[e](){return t(this,l)[l]}get hostname(){const{companion:e}=this.uppy.getState(),t=this.opts.companionUrl;return(e&&e[t]?e[t]:t).replace(/\/$/,"")}headers(){return Promise.resolve({...h.defaultHeaders,...t(this,l)[l]})}onReceiveResponse(e){const t=this.uppy.getState().companion||{},n=this.opts.companionUrl,{headers:r}=e;return r.has("i-am")&&r.get("i-am")!==t[n]&&this.uppy.setState({companion:{...t,[n]:r.get("i-am")}}),e}preflight(e){return this.preflightDone?Promise.resolve(this.allowedHeaders.slice()):fetch(t(this,c)[c](e),{method:"OPTIONS"}).then(e=>(e.headers.has("access-control-allow-headers")&&(this.allowedHeaders=e.headers.get("access-control-allow-headers").split(",").map(e=>e.trim().toLowerCase())),this.preflightDone=!0,this.allowedHeaders.slice())).catch(e=>(this.uppy.log(`[CompanionClient] unable to make preflight request ${e}`,"warning"),this.preflightDone=!0,this.allowedHeaders.slice()))}preflightAndHeaders(e){return Promise.all([this.preflight(e),this.headers()]).then(e=>{let[t,n]=e;return Object.keys(n).forEach(e=>{t.includes(e.toLowerCase())||(this.uppy.log(`[CompanionClient] excluding disallowed header ${e}`),delete n[e])}),n})}get(e,n){return this.preflightAndHeaders(e).then(n=>o(t(this,c)[c](e),{method:"get",headers:n,credentials:this.opts.companionCookiesRule||"same-origin"})).then(t(this,u)[u](n)).then(a).catch(t(this,d)[d]("get",e))}post(e,n,r){const i="post";return this.preflightAndHeaders(e).then(r=>o(t(this,c)[c](e),{method:i,headers:r,credentials:this.opts.companionCookiesRule||"same-origin",body:JSON.stringify(n)})).then(t(this,u)[u](r)).then(a).catch(t(this,d)[d](i,e))}delete(e,n,r){const i="delete";return this.preflightAndHeaders(e).then(t=>o(`${this.hostname}/${e}`,{method:i,headers:t,credentials:this.opts.companionCookiesRule||"same-origin",body:n?JSON.stringify(n):null})).then(t(this,u)[u](r)).then(a).catch(t(this,d)[d](i,e))}}function p(e){return/^(https?:|)\/\//.test(e)?e:`${this.hostname}/${e}`}function f(e,n){return r=>{var o;return null!=(o=r)&&o.isAuthError||(r=new i(`Could not ${e} ${t(this,c)[c](n)}`,{cause:r})),Promise.reject(r)}}return h.VERSION="2.2.2",h.defaultHeaders={Accept:"application/json","Content-Type":"application/json","Uppy-Versions":`@uppy/companion-client=${h.VERSION}`},Pt=h}var Ft,jt,It,Ut,Bt,Ht,zt,Wt,Vt={};function qt(){if(Ft)return Vt;return Ft=1,Object.defineProperty(Vt,"__esModule",{value:!0}),Vt.getItem=function(e){return Promise.resolve(localStorage.getItem(e))},Vt.removeItem=function(e){return new Promise(t=>{localStorage.removeItem(e),t()})},Vt.setItem=function(e,t){return new Promise(n=>{localStorage.setItem(e,t),n()})},Vt}function Kt(){if(Wt)return $t;Wt=1,Object.defineProperty($t,"__esModule",{value:!0}),$t.Socket=$t.SearchProvider=$t.RequestClient=$t.Provider=void 0;const e=At();$t.RequestClient=e;const t=function(){if(It)return jt;It=1;var e=qt();const t=At();return jt=class extends t{constructor(e,t){super(e,t),this.provider=t.provider,this.id=this.provider,this.name=this.opts.name||this.id.split("-").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" "),this.pluginId=this.opts.pluginId,this.tokenKey=`companion-${this.pluginId}-auth-token`,this.companionKeysParams=this.opts.companionKeysParams,this.preAuthToken=null}headers(){return Promise.all([super.headers(),this.getAuthToken()]).then(e=>{let[t,n]=e;const r={};return n&&(r["uppy-auth-token"]=n),this.companionKeysParams&&(r["uppy-credentials-params"]=btoa(JSON.stringify({params:this.companionKeysParams}))),{...t,...r}})}onReceiveResponse(e){e=super.onReceiveResponse(e);const t=this.uppy.getPlugin(this.pluginId),n=t.getPluginState().authenticated?401!==e.status:e.status<400;return t.setPluginState({authenticated:n}),e}setAuthToken(e){return this.uppy.getPlugin(this.pluginId).storage.setItem(this.tokenKey,e)}getAuthToken(){return this.uppy.getPlugin(this.pluginId).storage.getItem(this.tokenKey)}async ensurePreAuth(){if(this.companionKeysParams&&!this.preAuthToken&&(await this.fetchPreAuthToken(),!this.preAuthToken))throw new Error("Could not load authentication data required for third-party login. Please try again later.")}authUrl(e){void 0===e&&(e={});const t=new URLSearchParams(e);return this.preAuthToken&&t.set("uppyPreAuthToken",this.preAuthToken),`${this.hostname}/${this.id}/connect?${t}`}fileUrl(e){return`${this.hostname}/${this.id}/get/${e}`}async fetchPreAuthToken(){if(this.companionKeysParams)try{const e=await this.post(`${this.id}/preauth/`,{params:this.companionKeysParams});this.preAuthToken=e.token}catch(e){this.uppy.log(`[CompanionClient] unable to fetch preAuthToken ${e}`,"warning")}}list(e){return this.get(`${this.id}/list/${e||""}`)}logout(){return this.get(`${this.id}/logout`).then(e=>Promise.all([e,this.uppy.getPlugin(this.pluginId).storage.removeItem(this.tokenKey)])).then(e=>{let[t]=e;return t})}static initPlugin(t,n,r){if(t.type="acquirer",t.files=[],r&&(t.opts={...r,...n}),n.serverUrl||n.serverPattern)throw new Error("`serverUrl` and `serverPattern` have been renamed to `companionUrl` and `companionAllowedHosts` respectively in the 0.30.5 release. Please consult the docs (for example, https://uppy.io/docs/instagram/ for the Instagram plugin) and use the updated options.`");if(n.companionAllowedHosts){const e=n.companionAllowedHosts;if(!("string"==typeof e||Array.isArray(e)||e instanceof RegExp))throw new TypeError(`${t.id}: the option "companionAllowedHosts" must be one of string, Array, RegExp`);t.opts.companionAllowedHosts=e}else/^(?!https?:\/\/).*$/i.test(n.companionUrl)?t.opts.companionAllowedHosts=`https://${n.companionUrl.replace(/^\/\//,"")}`:t.opts.companionAllowedHosts=new URL(n.companionUrl).origin;t.storage=t.opts.storage||e}},jt}();$t.Provider=t;const n=function(){if(Bt)return Ut;Bt=1;const e=At();return Ut=class extends e{constructor(e,t){super(e,t),this.provider=t.provider,this.id=this.provider,this.name=this.opts.name||this.id.split("-").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" "),this.pluginId=this.opts.pluginId}fileUrl(e){return`${this.hostname}/search/${this.id}/get/${e}`}search(e,t){return this.get(`search/${this.id}/list?q=${encodeURIComponent(e)}${t?`&${t}`:""}`)}},Ut}();$t.SearchProvider=n;const r=function(){if(zt)return Ht;let e,t;function n(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}zt=1;var r=0;function o(e){return"__private_"+r+++"_"+e}const i=he();var s=o("queued"),a=o("emitter"),l=o("isOpen"),u=o("socket"),c=o("handleMessage");return e=Symbol.for("uppy test: getSocket"),t=Symbol.for("uppy test: getQueued"),Ht=class{constructor(e){Object.defineProperty(this,s,{writable:!0,value:[]}),Object.defineProperty(this,a,{writable:!0,value:i()}),Object.defineProperty(this,l,{writable:!0,value:!1}),Object.defineProperty(this,u,{writable:!0,value:void 0}),Object.defineProperty(this,c,{writable:!0,value:e=>{try{const t=JSON.parse(e.data);this.emit(t.action,t.payload)}catch(e){console.log(e)}}}),this.opts=e,e&&!1===e.autoOpen||this.open()}get isOpen(){return n(this,l)[l]}[e](){return n(this,u)[u]}[t](){return n(this,s)[s]}open(){n(this,u)[u]=new WebSocket(this.opts.target),n(this,u)[u].onopen=()=>{for(n(this,l)[l]=!0;n(this,s)[s].length>0&&n(this,l)[l];){const e=n(this,s)[s].shift();this.send(e.action,e.payload)}},n(this,u)[u].onclose=()=>{n(this,l)[l]=!1},n(this,u)[u].onmessage=n(this,c)[c]}close(){var e;null==(e=n(this,u)[u])||e.close()}send(e,t){n(this,l)[l]?n(this,u)[u].send(JSON.stringify({action:e,payload:t})):n(this,s)[s].push({action:e,payload:t})}on(e,t){n(this,a)[a].on(e,t)}emit(e,t){n(this,a)[a].emit(e,t)}once(e,t){n(this,a)[a].once(e,t)}},Ht}();return $t.Socket=r,$t}var Jt,Gt,Xt,Yt,Qt,Zt,en,tn,nn,rn,on,sn,an,ln,un,cn,dn,hn={};function pn(){if(Jt)return hn;function e(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}Jt=1,Object.defineProperty(hn,"__esModule",{value:!0}),hn.internalRateLimitedQueue=hn.RateLimitedQueue=void 0;var t=0;function n(e){return"__private_"+t+++"_"+e}var r=n("activeRequests"),o=n("queuedHandlers"),i=n("paused"),s=n("pauseTimer"),a=n("downLimit"),l=n("upperLimit"),u=n("rateLimitingTimer"),c=n("call"),d=n("queueNext"),h=n("next"),p=n("queue"),f=n("dequeue"),g=n("resume"),v=n("increaseLimit");function m(t){e(this,r)[r]+=1;let n,o=!1;try{n=t()}catch(t){throw e(this,r)[r]-=1,t}return{abort:()=>{o||(o=!0,e(this,r)[r]-=1,n(),e(this,d)[d]())},done:()=>{o||(o=!0,e(this,r)[r]-=1,e(this,d)[d]())}}}function y(){queueMicrotask(()=>e(this,h)[h]())}function b(){if(e(this,i)[i]||e(this,r)[r]>=this.limit)return;if(0===e(this,o)[o].length)return;const t=e(this,o)[o].shift(),n=e(this,c)[c](t.fn);t.abort=n.abort,t.done=n.done}function w(t,n){void 0===n&&(n={});const r={fn:t,priority:n.priority||0,abort:()=>{e(this,f)[f](r)},done:()=>{throw new Error("Cannot mark a queued request as done: this indicates a bug")}},i=e(this,o)[o].findIndex(e=>r.priority>e.priority);return-1===i?e(this,o)[o].push(r):e(this,o)[o].splice(i,0,r),r}function E(t){const n=e(this,o)[o].indexOf(t);-1!==n&&e(this,o)[o].splice(n,1)}hn.RateLimitedQueue=class{constructor(t){Object.defineProperty(this,f,{value:E}),Object.defineProperty(this,p,{value:w}),Object.defineProperty(this,h,{value:b}),Object.defineProperty(this,d,{value:y}),Object.defineProperty(this,c,{value:m}),Object.defineProperty(this,r,{writable:!0,value:0}),Object.defineProperty(this,o,{writable:!0,value:[]}),Object.defineProperty(this,i,{writable:!0,value:!1}),Object.defineProperty(this,s,{writable:!0,value:void 0}),Object.defineProperty(this,a,{writable:!0,value:1}),Object.defineProperty(this,l,{writable:!0,value:void 0}),Object.defineProperty(this,u,{writable:!0,value:void 0}),Object.defineProperty(this,g,{writable:!0,value:()=>this.resume()}),Object.defineProperty(this,v,{writable:!0,value:()=>{if(e(this,i)[i])e(this,u)[u]=setTimeout(e(this,v)[v],0);else{e(this,a)[a]=this.limit,this.limit=Math.ceil((e(this,l)[l]+e(this,a)[a])/2);for(let t=e(this,a)[a];t<=this.limit;t++)e(this,d)[d]();e(this,l)[l]-e(this,a)[a]>3?e(this,u)[u]=setTimeout(e(this,v)[v],2e3):e(this,a)[a]=Math.floor(e(this,a)[a]/2)}}}),this.limit="number"!=typeof t||0===t?1/0:t}run(t,n){return!e(this,i)[i]&&e(this,r)[r]<this.limit?e(this,c)[c](t):e(this,p)[p](t,n)}wrapPromiseFunction(e,t){var n=this;return function(){for(var r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];let s;const a=new Promise((r,i)=>{s=n.run(()=>{let t,n;try{n=Promise.resolve(e(...o))}catch(e){n=Promise.reject(e)}return n.then(e=>{t?i(t):(s.done(),r(e))},e=>{t?i(t):(s.done(),i(e))}),()=>{t=new Error("Cancelled")}},t)});return a.abort=()=>{s.abort()},a}}resume(){e(this,i)[i]=!1,clearTimeout(e(this,s)[s]);for(let t=0;t<this.limit;t++)e(this,d)[d]()}pause(t){void 0===t&&(t=null),e(this,i)[i]=!0,clearTimeout(e(this,s)[s]),null!=t&&(e(this,s)[s]=setTimeout(e(this,g)[g],t))}rateLimit(t){clearTimeout(e(this,u)[u]),this.pause(t),this.limit>1&&Number.isFinite(this.limit)&&(e(this,l)[l]=this.limit-1,this.limit=e(this,a)[a],e(this,u)[u]=setTimeout(e(this,v)[v],t))}get isPaused(){return e(this,i)[i]}};const x=Symbol("__queue");return hn.internalRateLimitedQueue=x,hn}function fn(){return un?ln:(un=1,ln={strings:{timedOut:"Upload stalled for %{seconds} seconds, aborting."}})}var gn=function(){if(dn)return cn;dn=1;var e=ie,t=Kt(),r=pn();const o=wt(),i=Xt?Gt:(Xt=1,Gt=n(function(e,t,n){const{progress:r,bytesUploaded:o,bytesTotal:i}=t;r&&(e.uppy.log(`Upload progress: ${r}`),e.uppy.emit("upload-progress",n,{uploader:e,bytesUploaded:o,bytesTotal:i}))},300,{leading:!0,trailing:!0})),s=Qt?Yt:(Qt=1,Yt=function(e){const t=/^(?:https?:\/\/|\/\/)?(?:[^@\n]+@)?(?:www\.)?([^\n]+)/i.exec(e)[1];return`${/^http:\/\//i.test(e)?"ws":"wss"}://${t}`}),a=en?Zt:(en=1,Zt=function(e){const t=[],n=[];function r(e){t.push(e)}function o(e){n.push(e)}return Promise.all(e.map(e=>e.then(r,o))).then(()=>({successful:t,failed:n}))}),l=function(){if(nn)return tn;function e(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}nn=1;var t=0;function n(e){return"__private_"+t+++"_"+e}var r=n("emitter"),o=n("events");return tn=class{constructor(t){Object.defineProperty(this,r,{writable:!0,value:void 0}),Object.defineProperty(this,o,{writable:!0,value:[]}),e(this,r)[r]=t}on(t,n){return e(this,o)[o].push([t,n]),e(this,r)[r].on(t,n)}remove(){for(const[t,n]of e(this,o)[o].splice(0))e(this,r)[r].off(t,n)}}}(),u=function(){if(on)return rn;function e(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}on=1;var t=0;function n(e){return"__private_"+t+++"_"+e}var r=n("aliveTimer"),o=n("isDone"),i=n("onTimedOut"),s=n("timeout");return rn=class{constructor(t,n){Object.defineProperty(this,r,{writable:!0,value:void 0}),Object.defineProperty(this,o,{writable:!0,value:!1}),Object.defineProperty(this,i,{writable:!0,value:void 0}),Object.defineProperty(this,s,{writable:!0,value:void 0}),e(this,s)[s]=t,e(this,i)[i]=n}progress(){e(this,o)[o]||e(this,s)[s]>0&&(clearTimeout(e(this,r)[r]),e(this,r)[r]=setTimeout(e(this,i)[i],e(this,s)[s]))}done(){e(this,o)[o]||(clearTimeout(e(this,r)[r]),e(this,r)[r]=null,e(this,o)[o]=!0)}}}(),c=Dt(),d=an?sn:(an=1,sn=function(e){return!!e&&(0!==e.readyState&&4!==e.readyState||0===e.status)}),h=fn();function p(e,t){let n=t;return n||(n=new Error("Upload error")),"string"==typeof n&&(n=new Error(n)),n instanceof Error||(n=Object.assign(new Error("Upload error"),{data:n})),d(e)?(n=new c(n,e),n):(n.request=e,n)}function f(e){return e.data.slice(0,e.data.size,e.meta.type)}class g extends o{constructor(e,t){super(e,t),this.type="uploader",this.id=this.opts.id||"XHRUpload",this.title="XHRUpload",this.defaultLocale=h;const n={formData:!0,fieldName:t.bundle?"files[]":"file",method:"post",metaFields:null,responseUrlFieldName:"url",bundle:!1,headers:{},timeout:3e4,limit:5,withCredentials:!1,responseType:"",getResponseData(t){let n={};try{n=JSON.parse(t)}catch(t){e.log(t)}return n},getResponseError(e,t){let n=new Error("Upload error");return d(t)&&(n=new c(n,t)),n},validateStatus:e=>e>=200&&e<300};if(this.opts={...n,...t},this.i18nInit(),this.handleUpload=this.handleUpload.bind(this),r.internalRateLimitedQueue in this.opts?this.requests=this.opts[r.internalRateLimitedQueue]:this.requests=new r.RateLimitedQueue(this.opts.limit),this.opts.bundle&&!this.opts.formData)throw new Error("`opts.formData` must be true when `opts.bundle` is enabled.");this.uploaderEvents=Object.create(null)}getOptions(e){const t=this.uppy.getState().xhrUpload,{headers:n}=this.opts,r={...this.opts,...t||{},...e.xhrUpload||{},headers:{}};return"function"==typeof n?r.headers=n(e):Object.assign(r.headers,this.opts.headers),t&&Object.assign(r.headers,t.headers),e.xhrUpload&&Object.assign(r.headers,e.xhrUpload.headers),r}addMetadata(e,t,n){(Array.isArray(n.metaFields)?n.metaFields:Object.keys(t)).forEach(n=>{e.append(n,t[n])})}createFormDataUpload(e,t){const n=new FormData;this.addMetadata(n,e.meta,t);const r=f(e);return e.name?n.append(t.fieldName,r,e.meta.name):n.append(t.fieldName,r),n}createBundledUpload(e,t){const n=new FormData,{meta:r}=this.uppy.getState();return this.addMetadata(n,r,t),e.forEach(e=>{const t=this.getOptions(e),r=f(e);e.name?n.append(t.fieldName,r,e.name):n.append(t.fieldName,r)}),n}upload(t,n,r){const o=this.getOptions(t);return this.uppy.log(`uploading ${n} of ${r}`),new Promise((n,r)=>{this.uppy.emit("upload-started",t);const i=o.formData?this.createFormDataUpload(t,o):t.data,s=new XMLHttpRequest;let a;this.uploaderEvents[t.id]=new l(this.uppy);const c=new u(o.timeout,()=>{s.abort(),a.done();const e=new Error(this.i18n("timedOut",{seconds:Math.ceil(o.timeout/1e3)}));this.uppy.emit("upload-error",t,e),r(e)}),d=(0,e.nanoid)();s.upload.addEventListener("loadstart",()=>{this.uppy.log(`[XHRUpload] ${d} started`)}),s.upload.addEventListener("progress",e=>{this.uppy.log(`[XHRUpload] ${d} progress: ${e.loaded} / ${e.total}`),c.progress(),e.lengthComputable&&this.uppy.emit("upload-progress",t,{uploader:this,bytesUploaded:e.loaded,bytesTotal:e.total})}),s.addEventListener("load",()=>{if(this.uppy.log(`[XHRUpload] ${d} finished`),c.done(),a.done(),this.uploaderEvents[t.id]&&(this.uploaderEvents[t.id].remove(),this.uploaderEvents[t.id]=null),o.validateStatus(s.status,s.responseText,s)){const e=o.getResponseData(s.responseText,s),r=e[o.responseUrlFieldName],i={status:s.status,body:e,uploadURL:r};return this.uppy.emit("upload-success",t,i),r&&this.uppy.log(`Download ${t.name} from ${r}`),n(t)}const e=o.getResponseData(s.responseText,s),i=p(s,o.getResponseError(s.responseText,s)),l={status:s.status,body:e};return this.uppy.emit("upload-error",t,i,l),r(i)}),s.addEventListener("error",()=>{this.uppy.log(`[XHRUpload] ${d} errored`),c.done(),a.done(),this.uploaderEvents[t.id]&&(this.uploaderEvents[t.id].remove(),this.uploaderEvents[t.id]=null);const e=p(s,o.getResponseError(s.responseText,s));return this.uppy.emit("upload-error",t,e),r(e)}),s.open(o.method.toUpperCase(),o.endpoint,!0),s.withCredentials=o.withCredentials,""!==o.responseType&&(s.responseType=o.responseType),a=this.requests.run(()=>{this.uppy.emit("upload-started",t);const e=this.getOptions(t);return Object.keys(e.headers).forEach(t=>{s.setRequestHeader(t,e.headers[t])}),s.send(i),()=>{c.done(),s.abort()}}),this.onFileRemove(t.id,()=>{a.abort(),r(new Error("File removed"))}),this.onCancelAll(t.id,e=>{let{reason:t}=e;"user"===t&&a.abort(),r(new Error("Upload cancelled"))})})}uploadRemote(e){const n=this.getOptions(e);return new Promise((r,o)=>{this.uppy.emit("upload-started",e);const a={};(Array.isArray(n.metaFields)?n.metaFields:Object.keys(e.meta)).forEach(t=>{a[t]=e.meta[t]});new(e.remote.providerOptions.provider?t.Provider:t.RequestClient)(this.uppy,e.remote.providerOptions).post(e.remote.url,{...e.remote.body,endpoint:n.endpoint,size:e.data.size,fieldname:n.fieldName,metadata:a,httpMethod:n.method,useFormData:n.formData,headers:n.headers}).then(a=>{const{token:u}=a,c=s(e.remote.companionUrl),d=new t.Socket({target:`${c}/api/${u}`,autoOpen:!1});let h;this.uploaderEvents[e.id]=new l(this.uppy),this.onFileRemove(e.id,()=>{d.send("cancel",{}),h.abort(),r(`upload ${e.id} was removed`)}),this.onCancelAll(e.id,function(t){let{reason:n}=void 0===t?{}:t;"user"===n&&(d.send("cancel",{}),h.abort()),r(`upload ${e.id} was canceled`)}),this.onRetry(e.id,()=>{d.send("pause",{}),d.send("resume",{})}),this.onRetryAll(e.id,()=>{d.send("pause",{}),d.send("resume",{})}),d.on("progress",t=>i(this,t,e)),d.on("success",t=>{const o=n.getResponseData(t.response.responseText,t.response),i=o[n.responseUrlFieldName],s={status:t.response.status,body:o,uploadURL:i};return this.uppy.emit("upload-success",e,s),h.done(),this.uploaderEvents[e.id]&&(this.uploaderEvents[e.id].remove(),this.uploaderEvents[e.id]=null),r()}),d.on("error",t=>{const r=t.response,i=r?n.getResponseError(r.responseText,r):Object.assign(new Error(t.error.message),{cause:t.error});this.uppy.emit("upload-error",e,i),h.done(),this.uploaderEvents[e.id]&&(this.uploaderEvents[e.id].remove(),this.uploaderEvents[e.id]=null),o(i)}),h=this.requests.run(()=>(d.open(),e.isPaused&&d.send("pause",{}),()=>d.close()))}).catch(t=>{this.uppy.emit("upload-error",e,t),o(t)})})}uploadBundle(e){return new Promise((t,n)=>{const{endpoint:r}=this.opts,{method:o}=this.opts,i=this.uppy.getState().xhrUpload,s=this.createBundledUpload(e,{...this.opts,...i||{}}),a=new XMLHttpRequest,l=t=>{e.forEach(e=>{this.uppy.emit("upload-error",e,t)})},c=new u(this.opts.timeout,()=>{a.abort();const e=new Error(this.i18n("timedOut",{seconds:Math.ceil(this.opts.timeout/1e3)}));l(e),n(e)});a.upload.addEventListener("loadstart",()=>{this.uppy.log("[XHRUpload] started uploading bundle"),c.progress()}),a.upload.addEventListener("progress",t=>{c.progress(),t.lengthComputable&&e.forEach(e=>{this.uppy.emit("upload-progress",e,{uploader:this,bytesUploaded:t.loaded/t.total*e.size,bytesTotal:e.size})})}),a.addEventListener("load",r=>{if(c.done(),this.opts.validateStatus(r.target.status,a.responseText,a)){const n=this.opts.getResponseData(a.responseText,a),o={status:r.target.status,body:n};return e.forEach(e=>{this.uppy.emit("upload-success",e,o)}),t()}const o=this.opts.getResponseError(a.responseText,a)||new Error("Upload error");return o.request=a,l(o),n(o)}),a.addEventListener("error",()=>{c.done();const e=this.opts.getResponseError(a.responseText,a)||new Error("Upload error");return l(e),n(e)}),this.uppy.on("cancel-all",function(e){let{reason:t}=void 0===e?{}:e;"user"===t&&(c.done(),a.abort())}),a.open(o.toUpperCase(),r,!0),a.withCredentials=this.opts.withCredentials,""!==this.opts.responseType&&(a.responseType=this.opts.responseType),Object.keys(this.opts.headers).forEach(e=>{a.setRequestHeader(e,this.opts.headers[e])}),a.send(s),e.forEach(e=>{this.uppy.emit("upload-started",e)})})}uploadFiles(e){const t=e.map((t,n)=>{const r=parseInt(n,10)+1,o=e.length;return t.error?Promise.reject(new Error(t.error)):t.isRemote?this.uploadRemote(t,r,o):this.upload(t,r,o)});return a(t)}onFileRemove(e,t){this.uploaderEvents[e].on("file-removed",n=>{e===n.id&&t(n.id)})}onRetry(e,t){this.uploaderEvents[e].on("upload-retry",n=>{e===n&&t()})}onRetryAll(e,t){this.uploaderEvents[e].on("retry-all",()=>{this.uppy.getFile(e)&&t()})}onCancelAll(e,t){var n=this;this.uploaderEvents[e].on("cancel-all",function(){n.uppy.getFile(e)&&t(...arguments)})}handleUpload(e){if(0===e.length)return this.uppy.log("[XHRUpload] No files to upload!"),Promise.resolve();0!==this.opts.limit||this.opts[r.internalRateLimitedQueue]||this.uppy.log("[XHRUpload] When uploading multiple files at once, consider setting the `limit` option (to `10` for example), to limit the number of concurrent uploads, which helps prevent memory and network issues: https://uppy.io/docs/xhr-upload/#limit-0","warning"),this.uppy.log("[XHRUpload] Uploading...");const t=e.map(e=>this.uppy.getFile(e));if(this.opts.bundle){if(t.some(e=>e.isRemote))throw new Error("Can’t upload remote files when the `bundle: true` option is set");if("function"==typeof this.opts.headers)throw new TypeError("`headers` may not be a function when the `bundle: true` option is set");return this.uploadBundle(t)}return this.uploadFiles(t).then(()=>null)}install(){if(this.opts.bundle){const{capabilities:e}=this.uppy.getState();this.uppy.setState({capabilities:{...e,individualCancellation:!1}})}this.uppy.addUploader(this.handleUpload)}uninstall(){if(this.opts.bundle){const{capabilities:e}=this.uppy.getState();this.uppy.setState({capabilities:{...e,individualCancellation:!0}})}this.uppy.removeUploader(this.handleUpload)}}return g.VERSION="2.1.3",cn=g}(),vn=w(gn);function mn(e){Promise.resolve().then(e)}function yn(e){return e.replace(/ /g," ").replace(/</g,"<").replace(/>/g,">").replace(/®/g,"®").replace(/©/g,"©").replace(/™/g,"™").replace(/"/g,'"')}var bn=function(e){return Object.prototype.toString.call(e)};function wn(e){return e||{name:""}}function En(e){var t=e.server,n=void 0===t?"":t,o=e.fieldName,i=void 0===o?"":o,s=e.maxFileSize,a=void 0===s?10485760:s,l=e.maxNumberOfFiles,u=void 0===l?100:l,c=e.meta,d=void 0===c?{}:c,h=e.metaWithUrl,p=void 0!==h&&h,f=e.headers,g=void 0===f?{}:f,m=e.withCredentials,b=void 0!==m&&m,w=e.timeout,E=void 0===w?1e4:w,x=e.onBeforeUpload,S=void 0===x?function(e){return e}:x,_=e.onSuccess,O=void 0===_?function(e,t){}:_,k=e.onError,C=void 0===k?function(e,t,n){console.error("".concat(e.name," upload error"),t,n)}:k,T=e.onProgress,N=void 0===T?function(e){}:T;if(!n)throw new Error("Cannot get upload server address\n没有配置上传地址");if(!i)throw new Error("Cannot get fieldName\n没有配置 fieldName");var P=n;p&&(P=function(e,t){var n=y(e.split("#"),2),o=n[0],i=n[1],s=[];r(t,function(e,t){s.push("".concat(t,"=").concat(e))});var a=s.join("&");return o=o.indexOf("?")>0?"".concat(o,"&").concat(a):"".concat(o,"?").concat(a),i?"".concat(o,"#").concat(i):o}(P,d));var M=new Lt(v({onBeforeUpload:function(e){return S(e)},restrictions:{maxFileSize:a,maxNumberOfFiles:u},meta:d},e.uppyConfig)).use(vn,v({endpoint:P,headers:g,formData:!0,fieldName:i,bundle:!1,withCredentials:b,timeout:E},e.xhrConfig));return M.on("upload-success",function(e,t){var n=(null!=t?t:{}).body,r=void 0===n?{}:n,o=wn(e);try{O(o,r)}catch(e){console.error("wangEditor upload file - onSuccess error",e)}}),M.on("progress",function(e){e<1||N(e)}),M.on("upload-error",function(e,t,n){var r=wn(e);try{C(r,t,n)}catch(e){console.error("wangEditor upload file - onError error",e)}}),M.on("restriction-failed",function(e,t){var n=wn(e);try{C(n,t,void 0)}catch(e){console.error("wangEditor upload file - onError error",e)}}),M}var xn,Sn={};function _n(){if(xn)return Sn;xn=1;var e=i,t={isHistory:function(t){return e.isObject(t)&&Array.isArray(t.redos)&&Array.isArray(t.undos)&&(0===t.redos.length||e.Operation.isOperationList(t.redos[0].operations))&&(0===t.undos.length||e.Operation.isOperationList(t.undos[0].operations))}},n=new WeakMap,r=new WeakMap,o=new WeakMap,s=new WeakMap,a={isHistoryEditor:function(n){return t.isHistory(n.history)&&e.Editor.isEditor(n)},isMerging:function(e){return o.get(e)},isSplittingOnce:function(e){return s.get(e)},setSplittingOnce:function(e,t){s.set(e,t)},isSaving:function(e){return r.get(e)},redo:function(e){e.redo()},undo:function(e){e.undo()},withMerging:function(e,t){var n=a.isMerging(e);o.set(e,!0),t(),o.set(e,n)},withNewBatch:function(e,t){var n=a.isMerging(e);o.set(e,!0),s.set(e,!0),t(),o.set(e,n),s.delete(e)},withoutMerging:function(e,t){var n=a.isMerging(e);o.set(e,!1),t(),o.set(e,n)},withoutSaving:function(e,t){var n=a.isSaving(e);r.set(e,!1);try{t()}finally{r.set(e,n)}}};function l(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return u(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return u(e,t)}(e))||t){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,s=!0,a=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return s=e.done,e},e:function(e){a=!0,i=e},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw i}}}}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var c=function(t,n){return!(!n||"insert_text"!==t.type||"insert_text"!==n.type||t.offset!==n.offset+n.text.length||!e.Path.equals(t.path,n.path))||!(!n||"remove_text"!==t.type||"remove_text"!==n.type||t.offset+t.text.length!==n.offset||!e.Path.equals(t.path,n.path))},d=function(e,t){return"set_selection"!==e.type};return Sn.HISTORY=n,Sn.History=t,Sn.HistoryEditor=a,Sn.MERGING=o,Sn.SAVING=r,Sn.SPLITTING_ONCE=s,Sn.withHistory=function(t){var n=t,r=n.apply;return n.history={undos:[],redos:[]},n.redo=function(){var t=n.history,r=t.redos;if(r.length>0){var o=r[r.length-1];o.selectionBefore&&e.Transforms.setSelection(n,o.selectionBefore),a.withoutSaving(n,function(){e.Editor.withoutNormalizing(n,function(){var e,t=l(o.operations);try{for(t.s();!(e=t.n()).done;){var r=e.value;n.apply(r)}}catch(e){t.e(e)}finally{t.f()}})}),t.redos.pop(),n.writeHistory("undos",o)}},n.undo=function(){var t=n.history,r=t.undos;if(r.length>0){var o=r[r.length-1];a.withoutSaving(n,function(){e.Editor.withoutNormalizing(n,function(){var t,r=l(o.operations.map(e.Operation.inverse).reverse());try{for(r.s();!(t=r.n()).done;){var i=t.value;n.apply(i)}}catch(e){r.e(e)}finally{r.f()}o.selectionBefore&&e.Transforms.setSelection(n,o.selectionBefore)})}),n.writeHistory("redos",o),t.undos.pop()}},n.apply=function(e){var t=n.operations,o=n.history,i=o.undos,s=i[i.length-1],l=s&&s.operations[s.operations.length-1],u=a.isSaving(n),h=a.isMerging(n);if(null==u&&(u=d(e)),u){if(null==h&&(h=null!=s&&(!!t.includes(l)||c(e,l))),a.isSplittingOnce(n)&&(h=!1,a.setSplittingOnce(n,void 0)),s&&h)s.operations.push(e);else{var p={operations:[e],selectionBefore:n.selection};n.writeHistory("undos",p)}for(;i.length>100;)i.shift();o.redos=[]}r(e)},n.writeHistory=function(e,t){n.history[e].push(t)},n},Sn}var On=_n(),kn=new Set(["base","embed","math","meta","object","script","svg"]),Cn=new Set(["href","poster","src","xlink:href"]),Tn=["java","script:"].join("");function Nn(e,t,n){var r=function(e){return Array.from(e).filter(function(e){return e>" "}).join("").toLowerCase()}(n);return!r||!r.startsWith(Tn)&&!r.startsWith("vbscript:")&&(!r.startsWith("data:")||"href"!==t&&"xlink:href"!==t&&(("img"===e||"poster"===t)&&r.startsWith("data:image/")))}function Pn(e){if(void 0===e&&(e=""),!e)return"";var t=document.createElement("div");t.innerHTML=e;var n=function(e){Array.from(e.childNodes).forEach(function(e){if(e instanceof Element){var t=e,r=t.tagName.toLowerCase();if("template"===r){var o=t,i=Pn(o.innerHTML);return i?(o.insertAdjacentHTML("beforebegin",i),void o.remove()):void o.remove()}kn.has(r)?t.remove():(Array.from(t.attributes).forEach(function(e){var n=e.name.toLowerCase(),o=e.value||"";("srcdoc"===n||n.startsWith("on")||Cn.has(n)&&!Nn(r,n,o))&&t.removeAttribute(e.name)}),n(t))}})};return n(t),t.innerHTML}var Mn={};var Rn="created",Ln="destroyed",$n="change",Dn="scroll",An="fullscreen",Fn="unFullScreen",jn="modalOrPanelShow",In="modalOrPanelHide",Un={};var Bn=new WeakMap,Hn=new WeakMap,zn=new WeakMap,Wn=new WeakMap,Vn=new WeakMap,qn=new WeakMap,Kn=new WeakMap,Jn=new WeakMap,Gn=new WeakMap,Xn=new WeakMap,Yn=new WeakMap,Qn=new WeakMap,Zn=new WeakMap,er=new WeakMap,tr=new WeakMap,nr=new WeakMap,rr=new WeakMap,or=new WeakMap,ir=new WeakMap,sr=new WeakMap,ar=new WeakMap,lr=new WeakMap,ur=new WeakMap,cr=new WeakMap,dr=new WeakMap,hr=new WeakMap,pr=new WeakMap,fr=new WeakMap,gr=new WeakMap,vr=function(e){var t=e;return t.getAllMenuKeys=function(){var e=[];for(var t in Un)e.push(t);return e},t.getConfig=function(){var e=Xn.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},mr=new Set(["doctype","!doctype","meta","script","style","link","frame","iframe","title","svg"]);const yr=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"];var br,wr=globalThis.Node,Er=globalThis.Comment,xr=globalThis.Element,Sr=globalThis.Text,_r=globalThis.Range,Or=globalThis.Selection,kr=globalThis.StaticRange;a.css&&(a.fn.css=a.css),a.append&&(a.fn.append=a.append),a.addClass&&(a.fn.addClass=a.addClass),a.removeClass&&(a.fn.removeClass=a.removeClass),a.hasClass&&(a.fn.hasClass=a.hasClass),a.on&&(a.fn.on=a.on),a.focus&&(a.fn.focus=a.focus),a.attr&&(a.fn.attr=a.attr),a.removeAttr&&(a.fn.removeAttr=a.removeAttr),a.hide&&(a.fn.hide=a.hide),a.show&&(a.fn.show=a.show),a.offset&&(a.fn.offset=a.offset),a.width&&(a.fn.width=a.width),a.height&&(a.fn.height=a.height),a.parent&&(a.fn.parent=a.parent),a.parents&&(a.fn.parents=a.parents),a.is&&(a.fn.is=a.is),a.dataset&&(a.fn.dataset=a.dataset),a.val&&(a.fn.val=a.val),a.text&&(a.fn.text=a.text),a.html&&(a.fn.html=a.html),a.children&&(a.fn.children=a.children),a.remove&&(a.fn.remove=a.remove),a.find&&(a.fn.find=a.find),a.each&&(a.fn.each=a.each),a.empty&&(a.fn.empty=a.empty),e.NodeType=void 0,(br=e.NodeType||(e.NodeType={}))[br.ELEMENT_NODE=1]="ELEMENT_NODE",br[br.TEXT_NODE=3]="TEXT_NODE",br[br.CDATA_SECTION_NODE=4]="CDATA_SECTION_NODE",br[br.PROCESSING_INSTRUCTION_NODE=7]="PROCESSING_INSTRUCTION_NODE",br[br.COMMENT_NODE=8]="COMMENT_NODE",br[br.DOCUMENT_NODE=9]="DOCUMENT_NODE",br[br.DOCUMENT_TYPE_NODE=10]="DOCUMENT_TYPE_NODE",br[br.DOCUMENT_FRAGMENT_NODE=11]="DOCUMENT_FRAGMENT_NODE";var Cr=function(e){return"[object HTMLDocument]"===bn(e)},Tr=function(e){return"[object ShadowRoot]"===bn(e)},Nr=function(e){return"[object DataTransfer]"===bn(e)},Pr=/\[object HTML([A-Z][a-z]*)*Element\]/,Mr=function(e){return"matches"in e&&/^[ou]l$/i.test(e.tagName)&&!e.hasAttribute("data-w-e-type")},Rr=function(e){return Pr.test(bn(e))},Lr=function(e){return e&&e.ownerDocument&&e.ownerDocument.defaultView||null},$r=function(e){return null!=e&&"number"==typeof e.nodeType},Dr=function(t){return $r(t)&&t.nodeType===e.NodeType.COMMENT_NODE},Ar=function(t){return $r(t)&&t.nodeType===e.NodeType.ELEMENT_NODE},Fr=function(e){return"[object Selection]"===bn(e)},jr=function(t){return $r(t)&&t.nodeType===e.NodeType.TEXT_NODE},Ir=function(e){return e.clipboardData&&""!==e.clipboardData.getData("text/plain")&&1===e.clipboardData.types.length},Ur=function(e){var t,n=y(e,2),r=n[0],o=n[1];if(Ar(r)&&r.childNodes.length){var i=o===r.childNodes.length,s=i?o-1:o;for(r=(t=y(zr(r,s,i?"backward":"forward"),2))[0],i=(s=t[1])<o;Ar(r)&&r.childNodes.length;){var a=i?r.childNodes.length-1:0;r=Wr(r,a,i?"backward":"forward")}o=i&&null!=r.textContent?r.textContent.length:0}return[r,o]},Br=function(){return!(!window.document.activeElement||!window.document.activeElement.shadowRoot)},Hr=function(e){var t,n,r;return null!==(t=window&&window.document.getElementById(e))&&void 0!==t?t:window&&(null===(r=null===(n=window.document.activeElement)||void 0===n?void 0:n.shadowRoot)||void 0===r?void 0:r.getElementById(e))||null},zr=function(e,t,n){for(var r=e.childNodes,o=r[t],i=t,s=!1,a=!1;(Dr(o)||Ar(o)&&0===o.childNodes.length||Ar(o)&&"false"===o.getAttribute("contenteditable"))&&(!s||!a);)i>=r.length?(s=!0,i=t-1,n="backward"):i<0?(a=!0,i=t+1,n="forward"):(o=r[i],t=i,i+="forward"===n?1:-1);return[o,t]},Wr=function(e,t,n){return y(zr(e,t,n),1)[0]},Vr=function(e){var t,n,r="";if(jr(e)&&e.nodeValue)return e.nodeValue;if(Ar(e)){try{for(var o=m(Array.from(e.childNodes)),i=o.next();!i.done;i=o.next()){var s=i.value;r+=Vr(s)}}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}var a=getComputedStyle(e).getPropertyValue("display");"block"!==a&&"list"!==a&&"table-row"!==a&&"BR"!==e.tagName||(r+="\n")}return r};function qr(t){var n=[];n.push(t);for(var r=0;n.length>0;){var o=n.pop();if(null==o)break;if((r+=1)>1e4)break;var i=o.nodeName;if(o.nodeType===e.NodeType.ELEMENT_NODE){var s=i.toLowerCase();if(yr.includes(s)||"iframe"===s||"video"===s)return o;var a=o.children||[],l=a.length;if(l)for(var u=l-1;u>=0;u-=1)n.push(a[u])}}return null}function Kr(t,n){if(!Rr(t)||"true"!==t.dataset.slateVoid)for(var r=t.childNodes,o=r.length;o-=1;){var i=r[o],s=i.nodeType;jr(i)?n(i,t):[e.NodeType.ELEMENT_NODE,e.NodeType.DOCUMENT_NODE,e.NodeType.DOCUMENT_FRAGMENT_NODE].includes(s)&&Kr(i,n)}}function Jr(t){if(0===t.length)return"";var n=t[0];return n.nodeType!==e.NodeType.ELEMENT_NODE?"":n.tagName.toLowerCase()}var Gr=new RegExp(String.fromCharCode(160),"g");function Xr(e){return e.replace(Gr," ")}var Yr=["span","b","strong","i","em","s","strike","u","font","sub","sup"],Qr=[];var Zr=[];var eo={};function to(e,t){var n=e.length;if(n){var r=e[n-1];if(i.Text.isText(r)){var o=Object.keys(r);if(1===o.length&&"text"===o[0])return r.text+=t,!0}}return!1}function no(e,t,n){return{type:"paragraph",children:[{text:a(e).text().replace(/\s+/gm," ")}]}}function ro(e,t){var n=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(Ar(e)){if("BR"===e.nodeName)return void(to(n,"\n")||n.push({text:"\n"}));var r=uo(a(e),t);Array.isArray(r)?r.forEach(function(e){return n.push(e)}):n.push(r)}else if(jr(e)){var o=e.textContent||"";if(""===o.trim()&&o.indexOf("\n")>=0)return;o&&(o=Xr(o),to(n,o)||n.push({text:o}))}}),n)}(e,t),r=function(e){for(var t in eo)if(e[0].matches(t))return eo[t];return no}(e),o=r(e[0],n,t);return Array.isArray(o)||(o=[o]),o.forEach(function(r){i.Editor.isVoid(t,r)||(0===n.length&&(r.children=[{text:e.text().replace(/\s+/gm," ")}]),Zr.forEach(function(n){r=n(e[0],r,t)}))}),o}function oo(e,t){0===e.parents("pre").length&&(e[0].innerHTML=e[0].innerHTML.replace(/[\r\n\t]+/g,"").replace(/<br>/g,"\n"));var n=e[0].textContent||"",r={text:n=Xr(n=yn(n))};return Zr.forEach(function(n){r=n(e[0],r,t)}),r}function io(e,t){var n={text:""};return Zr.forEach(function(r){n=r(e[0],n,t)}),n}function so(e,t){var n=t.parentElement;return null==n?e:(null==n.closest("pre")&&(e=e.replace(/[\r\n\t]+/g,"")),e=Xr(e=yn(e)))}function ao(e,t){var n=v(v({},e),t);return Object.keys(t).forEach(function(e){!1===t[e]&&delete n[e]}),n}function lo(e,t,n){var r=e[0];if(Ar(r)){var o=uo(e,n),i=v({},t);return delete i.text,Array.isArray(o)?o.map(function(e){return ao(i,e)}):[ao(i,o)]}return Dr(r)?null:[ao(t,jr(r)?{text:so(r.textContent||"",r)}:oo(e,n))]}function uo(e,t){Qr.forEach(function(t){var n=t.selector,r=t.preParseHtml;e[0].matches(n)&&(e=a(r(e[0])))});var n=Jr(e);if("span"===n){if(e.attr("data-w-e-type"))return ro(e,t);if((o=Array.from(e[0].childNodes)).some(function(e){return!jr(e)&&!Dr(e)})){var r=io(a(e[0]),t);return o.flatMap(function(e){return lo(a(e),r,t)||[]})}return oo(e,t)}if("code"===n)return"pre"===Jr(e.parent())?ro(e,t):oo(e,t);if(Yr.includes(n)){var o;if((o=Array.from(e[0].childNodes)).some(function(e){return!jr(e)&&!Dr(e)})){var i=io(a(e[0]),t);return o.flatMap(function(e){return lo(a(e),i,t)||[]})}return oo(e,t)}return ro(e,t)}function co(e,t,n){var r=a(n);return!!r.attr(t)||(r.attr(t,"true"),e.on(Ln,function(){r.removeAttr(t)}),!1)}function ho(e,t){void 0===t&&(t="");var n=[],r=e.getConfig().sanitizeHtml;""===t&&(t="<p><br></p>"),0!==t.indexOf("<")&&(t=t.split(/\n/).map(function(e){return"<p>".concat(e,"</p>")}).join("")),t=r?r(t):t;var o=a("<div>".concat(t,"</div>"));return Array.from(o.children()).forEach(function(t){var r=uo(a(t),e);Array.isArray(r)?r.forEach(function(e){return n.push(e)}):n.push(r)}),n}function po(e,t){return"w-e-element-".concat(e,"-").concat(t)}var fo=[];var go={};function vo(e,t,n){var r=n.isInline(e)?"span":"div";return"<".concat(r,">").concat(t,"</").concat(r,">")}function mo(e,t){var n=e.type,r=void 0===n?"":n,o=e.children,s=void 0===o?[]:o,a=i.Editor.isVoid(t,e),l="";a||(l=s.map(function(e){return Po(e,t)}).join(""));var u=function(e){return go[e]||vo}(r),c=u(e,l,t),d="";if(d="string"==typeof c?c:c.html||"",a||fo.forEach(function(n){return d=n(e,d,t)}),"string"==typeof c)return d;var h=c.prefix,p=void 0===h?"":h,f=c.suffix,g=void 0===f?"":f;return p&&(d=p+d),g&&(d+=g),d}var yo=0,bo=function(){this.id="".concat(yo++)},wo="undefined"!=typeof navigator&&/Mac OS X/.test(navigator.userAgent),Eo="undefined"!=typeof navigator&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),xo="undefined"!=typeof navigator&&/^((?!chrome|android).)*safari/i.test(navigator.userAgent),So="undefined"!=typeof navigator&&/Edge?\/(?:[0-6][0-9]|[0-7][0-8])(?:\.)/i.test(navigator.userAgent),_o="undefined"!=typeof navigator&&/Chrome?\/(?:[0-7][0-5]|[0-6][0-9])(?:\.)/i.test(navigator.userAgent),Oo="undefined"!=typeof navigator&&/Chrome/i.test(navigator.userAgent),ko=!_o&&!So&&"undefined"!=typeof globalThis&&globalThis.InputEvent&&"function"==typeof globalThis.InputEvent.prototype.getTargetRanges,Co=function(e,t){return Boolean(e.compareDocumentPosition(t)&wr.DOCUMENT_POSITION_PRECEDING)},To=function(e,t){return Boolean(e.compareDocumentPosition(t)&wr.DOCUMENT_POSITION_FOLLOWING)},No={getWindow:function(e){var t=ur.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=lr.get(t);return n||(n=new bo,lr.set(t,n)),n},setNewKey:function(e){var t=new bo;lr.set(e,t)},findPath:function(e,t){for(var n=[],r=t;;){var o=rr.get(r);if(null==o){if(i.Editor.isEditor(r))return n;break}var s=nr.get(r);if(null==s)break;n.unshift(s),r=o}throw new Error("Unable to find the path for Slate node: ".concat(JSON.stringify(t)))},findDocumentOrShadowRoot:function(e){if(e.isDestroyed)return window.document;var t=No.toDOMNode(e,e),n=t.getRootNode();return(Cr(n)||Tr(n))&&null!=Reflect.get(n,"getSelection")?n:t.ownerDocument},getParentNode:function(e,t){return rr.get(t)||null},getParentsNodes:function(e,t){for(var n=[],r=t;r!==e&&null!=r;){var o=No.getParentNode(e,r);if(null==o)break;n.push(o),r=o}return n},getTopNode:function(e,t){var n=[No.findPath(e,t)[0]];return i.Node.get(e,n)},toDOMNode:function(e,t){var n;if(i.Editor.isEditor(t))n=or.get(e);else{var r=No.findKey(e,t);n=sr.get(r)}if(!n)throw new Error("Cannot resolve a DOM node from Slate node: ".concat(JSON.stringify(t)));return n},hasDOMNodeBySlateNode:function(e,t){if(i.Editor.isEditor(t))return!!or.get(e);var n=No.findKey(e,t);return!!sr.get(n)},canResolveDOMRange:function(e,t){try{var n=y(i.Editor.node(e,t.anchor.path),1)[0],r=y(i.Range.isCollapsed(t)?[n]:i.Editor.node(e,t.focus.path),1)[0];return No.hasDOMNodeBySlateNode(e,n)&&No.hasDOMNodeBySlateNode(e,r)}catch(e){return!1}},hasDOMNode:function(e,t,n){void 0===n&&(n={});var r,o=n.editable,i=void 0!==o&&o,s=No.toDOMNode(e,e);try{r=Ar(t)?t:t.parentElement}catch(e){if(e instanceof Error&&!e.message.includes('Permission denied to access property "nodeType"'))throw e}return!!r&&(r.closest("[data-slate-editor]")===s&&(!i||r.isContentEditable||r.closest('[contenteditable="false"]')===s||!!r.getAttribute("data-slate-zero-width"))||!!r.getAttribute("data-slate-string"))},toDOMRange:function(e,t){var n=t.anchor,r=t.focus,o=i.Range.isBackward(t),s=No.toDOMPoint(e,n),a=i.Range.isCollapsed(t)?s:No.toDOMPoint(e,r),l=No.getWindow(e).document.createRange(),u=y(o?a:s,2),c=u[0],d=u[1],h=y(o?s:a,2),p=h[0],f=h[1],g=!!(Ar(c)?c:c.parentElement).getAttribute("data-slate-zero-width"),v=!!(Ar(p)?p:p.parentElement).getAttribute("data-slate-zero-width");return l.setStart(c,g?1:d),l.setEnd(p,v?1:f),l},toDOMPoint:function(e,t){var n,r,o,s=y(i.Editor.node(e,t.path),1)[0],a=No.toDOMNode(e,s);i.Editor.void(e,{at:t})&&(t={path:t.path,offset:0});var l=Array.from(a.querySelectorAll("[data-slate-string], [data-slate-zero-width]")),u=0;try{for(var c=m(l),d=c.next();!d.done;d=c.next()){var h=d.value,p=h.childNodes[0];if(null!=p&&null!=p.textContent){var f=p.textContent.length,g=h.getAttribute("data-slate-length"),v=u+(null==g?f:parseInt(g,10));if(t.offset<=v){o=[p,Math.min(f,Math.max(0,t.offset-u))];break}u=v}}}catch(e){n={error:e}}finally{try{d&&!d.done&&(r=c.return)&&r.call(c)}finally{if(n)throw n.error}}if(!o)throw new Error("Cannot resolve a DOM point from Slate point: ".concat(JSON.stringify(t)));return o},toSlateNode:function(e,t){var n=Ar(t)?t:t.parentElement;n&&!n.hasAttribute("data-slate-node")&&(n=n.closest("[data-slate-node]"));var r=n?ir.get(n):null;if(!r)throw new Error("Cannot resolve a Slate node from DOM node: ".concat(n));return r},findEventRange:function(e,t){"nativeEvent"in t&&(t=t.nativeEvent);var n=t.clientX,r=t.clientY,o=t.target;if(null==n||null==r)throw new Error("Cannot resolve a Slate range from a DOM event: ".concat(t));var s,a=No.toSlateNode(e,t.target),l=No.findPath(e,a);if(i.Element.isElement(a)&&i.Editor.isVoid(e,a)){var u=o.getBoundingClientRect(),c=e.isInline(a)?n-u.left<u.left+u.width-n:r-u.top<u.top+u.height-r,d=i.Editor.point(e,l,{edge:c?"start":"end"}),h=c?i.Editor.before(e,d):i.Editor.after(e,d);if(h)return i.Editor.range(e,h)}var p=this.getWindow(e).document;if(p.caretRangeFromPoint)s=p.caretRangeFromPoint(n,r);else{var f=p.caretPositionFromPoint(n,r);f&&((s=p.createRange()).setStart(f.offsetNode,f.offset),s.setEnd(f.offsetNode,f.offset))}if(!s)throw new Error("Cannot resolve a Slate range from a DOM event: ".concat(t));return No.toSlateRange(e,s,{exactMatch:!1,suppressThrow:!1})},toSlateRange:function(e,t,n){var r,o,s,a,l,u=n.exactMatch,c=n.suppressThrow;if((Fr(t)?t.anchorNode:t.startContainer)&&(Fr(t)?(r=t.anchorNode,o=t.anchorOffset,s=t.focusNode,a=t.focusOffset,l=Oo&&Br()?t.anchorNode===t.focusNode&&t.anchorOffset===t.focusOffset:t.isCollapsed):(r=t.startContainer,o=t.startOffset,s=t.endContainer,a=t.endOffset,l=t.collapsed)),null==r||null==s||null==o||null==a)throw new Error("Cannot resolve a Slate range from DOM range: ".concat(t));var d=No.toSlatePoint(e,[r,o],{exactMatch:u,suppressThrow:c});if(!d)return null;var h=l?d:No.toSlatePoint(e,[s,a],{exactMatch:u,suppressThrow:c,searchDirection:Co(r,s)||r===s&&a<o?"forward":"backward"});if(!h)return null;var p={anchor:d,focus:h};return i.Range.isExpanded(p)&&i.Range.isForward(p)&&Ar(s)&&i.Editor.void(e,{at:p.focus,mode:"highest"})&&(p=i.Editor.unhangRange(e,p,{voids:!0})),p},toSlatePoint:function(e,t,n){var r,o,i,s=n.exactMatch,a=n.suppressThrow,u=y(s?t:Ur(t),2),c=u[0],d=u[1],h=c.parentNode,p=n.searchDirection,f=null,g=0;if(h){var v=No.toDOMNode(e,e),w=h.closest('[data-slate-void="true"]'),E=w&&v.contains(w)?w:null,x=h.closest('[contenteditable="false"]'),S=x&&v.contains(x)?x:null,_=h.closest("[data-slate-leaf]"),O=null,k=No.getWindow(e);if(_&&k.document.createRange){f=_.closest('[data-slate-node="text"]');var C=k.document.createRange();C.setStart(f,0),C.setEnd(c,d);var T=C.cloneContents();b(b([],y(l(T.querySelectorAll("[data-slate-zero-width]"))),!1),y(l(T.querySelectorAll("[contenteditable=false]"))),!1).forEach(function(e){e.parentNode.removeChild(e)}),g=T.textContent.length,O=f}else if(E)(_=Array.from(E.querySelectorAll("[data-slate-leaf]")).find(function(t){return No.hasDOMNode(e,t)})||null)?(f=_.closest('[data-slate-node="text"]'),g=(O=_).textContent.length,O.querySelectorAll("[data-slate-zero-width]").forEach(function(e){g-=e.textContent.length})):g=1;else if(S){var N=Boolean(S.closest("[data-w-e-reserve]"));!p&&N&&(p="forward");var P=p,M=function(t){return t?Array.from(t.querySelectorAll("[data-slate-leaf]")).filter(function(t){return No.hasDOMNode(e,t)}):[]},R=S.closest('[data-slate-node="element"]');if("backward"===p||!p)for(var L=(D=b(b([],y(M(null==R?void 0:R.previousElementSibling)),!1),y(M(R)),!1)).length-1;L>=0;L-=1){var $=D[L];if(Co(S,$)){_=$,p="backward";break}}if(!_&&("forward"===p||!p||N)){var D=b(b([],y(M(R)),!1),y(M(null==R?void 0:R.nextElementSibling)),!1);try{for(var A=m(D),F=A.next();!F.done;F=A.next()){$=F.value;if(To(S,$)){_=$,P="backward"===p&&N?"backward":"forward";break}}}catch(e){r={error:e}}finally{try{F&&!F.done&&(o=A.return)&&o.call(A)}finally{if(r)throw r.error}}}_&&(f=_.closest('[data-slate-node="text"]'),O=_,"forward"===P?g=0:(g=O.textContent.length,O.querySelectorAll("[data-slate-zero-width]").forEach(function(e){g-=e.textContent.length})))}O&&g===O.textContent.length&&(h.hasAttribute("data-slate-zero-width")||Eo&&(null===(i=O.textContent)||void 0===i?void 0:i.endsWith("\n")))&&(g-=1)}if(!f){if(a)return null;throw new Error("Cannot resolve a Slate point from DOM point: ".concat(t))}var j,I=No.toSlateNode(e,f);try{j=No.findPath(e,I)}catch(e){if(a)return null;throw e}return{path:j,offset:g}},hasRange:function(e,t){var n=t.anchor,r=t.focus;return i.Editor.hasPath(e,n.path)&&i.Editor.hasPath(e,r.path)},getNodeType:function(e){return i.Element.isElement(e)?e.type:""},checkNodeType:function(e,t){return this.getNodeType(e)===t},getNodesStr:function(e){return e.map(function(e){return i.Node.string(e)}).join("")},getSelectedElems:function(e){var t,n,r=[],o=i.Editor.nodes(e,{universal:!0});try{for(var s=m(o),a=s.next();!a.done;a=s.next()){var l=y(a.value,1)[0];i.Element.isElement(l)&&r.push(l)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}return r},getSelectedNodeByType:function(e,t){var n=this,r=y(i.Editor.nodes(e,{match:function(e){return n.checkNodeType(e,t)},universal:!0}),1),o=r[0];return null==o?null:o[0]},getSelectedTextNode:function(e){var t=y(i.Editor.nodes(e,{match:function(e){return i.Text.isText(e)},universal:!0}),1),n=t[0];return null==n?null:n[0]},isNodeSelected:function(e,t){var n=y(i.Editor.nodes(e,{match:function(e){return e===t},universal:!0}),1),r=n[0];return null!=r&&y(r,1)[0]===t},isSelectionAtLineEnd:function(e,t){var n=e.selection;return!!n&&(i.Editor.isEnd(e,n.anchor,t)||i.Editor.isEnd(e,n.focus,t))},getTextarea:function(e){var t=Bn.get(e);if(null==t)throw new Error("Cannot find textarea instance by editor");return t},getToolbar:function(e){return Wn.get(e)||null},getHoverbar:function(e){return qn.get(e)||null},normalizeContent:function(e){e.children.forEach(function(t,n){e.normalizeNode([t,[n]])})},getLeftLengthOfMaxLength:function(e){var t=e.getConfig(),n=t.maxLength,r=t.onMaxLength;if("number"!=typeof n||n<=0)return 1/0;var o=n-e.getText().replace(/\r|\n|(\r\n)|(\n\r)/g,"").length;return o<=0&&r&&r(e),o},cleanExposedTexNodeInSelectionBlock:function(e){var t,n,r,o,s=No.getTextarea(e).$textArea,l=null==s?void 0:s[0].childNodes;if(l)try{for(var u=m(Array.from(l)),c=u.next();!c.done;c=u.next()){var d=c.value;if(!jr(d))break;d.remove()}}catch(e){t={error:e}}finally{try{c&&!c.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}var h=i.Editor.nodes(e,{match:function(t){return!(!i.Element.isElement(t)||e.isInline(t))},universal:!0});try{for(var p=m(h),f=p.next();!f.done;f=p.next()){var g=f.value;if(null!=g){var v=g[0];if(!No.hasDOMNodeBySlateNode(e,v))continue;Kr(No.toDOMNode(e,v),function(e,t){var n=a(t);n.attr("data-slate-string")||n.attr("data-slate-zero-width")||n.attr("data-w-e-reserve")||t.removeChild(e)})}}}catch(e){r={error:e}}finally{try{f&&!f.done&&(o=p.return)&&o.call(p)}finally{if(r)throw r.error}}},isLastNode:function(e,t){var n=e.children||[];return n[n.length-1]===t},genEmptyParagraph:function(){return{type:"paragraph",children:[{text:""}]}},isSelectedVoidNode:function(e){var t,n,r=i.Editor.nodes(e,{match:function(t){return e.isVoid(t)}}),o=0;try{for(var s=m(r),a=s.next();!a.done;a=s.next()){a.value&&(o+=1)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}return o>0},isSelectedEmptyParagraph:function(e){var t=e.selection;if(null==t)return!1;if(i.Range.isExpanded(t))return!1;var n=No.getSelectedNodeByType(e,"paragraph");if(null===n)return!1;var r=n.children;return 1===r.length&&(""===r[0].text||void 0)},isEmptyPath:function(e,t){var n=i.Editor.node(e,t);if(null==n)return!1;var r=y(n,1)[0].children;if(1===r.length&&""===r[0].text)return!0;return!1}};function Po(e,t){return i.Element.isElement(e)?mo(e,t):function(e,t){var n=e.text;if(null==n)throw new Error("Current node is not slate Text ".concat(JSON.stringify(e)));var r=n;r=function(e){return e.replace(/ {2}/g," ").replace(/</g,"<").replace(/>/g,">").replace(/®/g,"®").replace(/©/g,"©").replace(/™/g,"™")}(r);var o=No.getParentsNodes(t,e).some(function(e){return"pre"===No.getNodeType(e)});if(o||(r=r.replace(/\n\r|\r\n|\r|\n/g,"<br>")),o&&(r=r.replace(/ /g," ")),""===r){var i=No.getParentNode(null,e);if(!i||0!==i.children.length)return r;r="<br>"}return fo.forEach(function(n){return r=n(e,r,t)}),r}(e,t)}var Mo=function(e,t){var n=(t.top+t.bottom)/2;return e.top<=n&&e.bottom>=n},Ro=function(e,t,n){var r=No.toDOMRange(e,t).getBoundingClientRect(),o=No.toDOMRange(e,n).getBoundingClientRect();return Mo(r,o)&&Mo(o,r)},Lo=function(e,t){var n,r,o=[];try{for(var s=m(i.Editor.levels(e,{at:t})),a=s.next();!a.done;a=s.next()){var l=y(a.value,2),u=l[0],c=l[1],d=No.findKey(e,u);o.push([c,d])}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}return o};var $o,Do,Ao,Fo,jo,Io,Uo,Bo,Ho,zo,Wo,Vo,qo,Ko,Jo,Go,Xo,Yo,Qo,Zo,ei,ti,ni,ri,oi,ii,si,ai,li,ui,ci,di,hi,pi,fi,gi,vi,mi,yi,bi,wi=function(e){var t=e,n=t.onChange,r=t.insertText,o=t.apply,s=t.deleteBackward,l=t.deleteFragment;return t.insertText=function(e){t.getConfig().readOnly||r(e)},t.apply=function(e){var n,r,s,a,l,u,c,d,h=[];switch(e.type){case"insert_text":case"remove_text":case"set_node":case"split_node":h.push.apply(h,b([],y(Lo(t,e.path)),!1));break;case"insert_node":case"remove_node":h.push.apply(h,b([],y(Lo(t,i.Path.parent(e.path))),!1));break;case"merge_node":var p=i.Path.previous(e.path);h.push.apply(h,b([],y(Lo(t,p)),!1));break;case"move_node":var f=i.Path.common(i.Path.parent(e.path),i.Path.parent(e.newPath));h.push.apply(h,b([],y(Lo(t,f)),!1));break;case"set_selection":(null===(a=null===(s=e.newProperties)||void 0===s?void 0:s.focus)||void 0===a?void 0:a.path)&&(h.push.apply(h,b([],y(Lo(t,null===(u=null===(l=e.newProperties)||void 0===l?void 0:l.focus)||void 0===u?void 0:u.path)),!1)),h.push.apply(h,b([],y(Lo(t,null===(d=null===(c=e.properties)||void 0===c?void 0:c.focus)||void 0===d?void 0:d.path)),!1)))}o(e);try{for(var g=m(h),v=g.next();!v.done;v=g.next()){var w=y(v.value,2),E=w[0],x=w[1],S=y(i.Editor.node(t,E),1)[0];lr.set(S,x),"type"in S&&(er.has(S)&&er.delete(S),tr.has(S)&&tr.delete(S))}}catch(e){n={error:e}}finally{try{v&&!v.done&&(r=g.return)&&r.call(g)}finally{if(n)throw n.error}}},t.deleteBackward=function(n){if("line"!==n)return s(n);if(e.selection&&i.Range.isCollapsed(e.selection)){var r=i.Editor.above(e,{match:function(t){return i.Element.isElement(t)&&i.Editor.isBlock(e,t)},at:e.selection});if(r){var o=y(r,2)[1],a=i.Editor.range(e,o,e.selection.anchor),l=function(e,t){var n=i.Editor.range(e,i.Range.end(t)),r=Array.from(i.Editor.positions(e,{at:t})),o=0,s=r.length,a=Math.floor(s/2);if(Ro(e,i.Editor.range(e,r[o]),n))return i.Editor.range(e,r[o],n);if(r.length<2)return i.Editor.range(e,r[r.length-1],n);for(;a!==r.length&&a!==o;)Ro(e,i.Editor.range(e,r[a]),n)?s=a:o=a,a=Math.floor((o+s)/2);return i.Editor.range(e,r[s],n)}(t,a);i.Range.isCollapsed(l)||i.Transforms.delete(e,{at:l})}}},t.deleteFragment=function(e){var n=function(e){var t=e.selection;if(null==t||i.Range.isCollapsed(t))return!1;var n=y(i.Range.edges(t),2),r=n[0],o=n[1],s=y(i.Editor.edges(e,[]),2),a=s[0],l=s[1];return i.Point.equals(r,a)&&i.Point.equals(o,l)}(t);l(e),n&&(!function(e){var t=[{type:"paragraph",children:[{text:""}]}];i.Editor.withoutNormalizing(e,function(){for(var n=e.children.length-1;n>=0;n-=1)i.Transforms.removeNodes(e,{at:[n]});i.Transforms.insertNodes(e,t,{at:[0]})})}(t),t.children.length>0&&i.Transforms.select(t,i.Editor.start(t,[])))},t.onChange=function(){var e=t.selection;null!=e&&dr.set(t,e),t.emit($n),n()},t.handleTab=function(){t.insertText(" ")},t.getHtml=function(){var e=t.children,n=void 0===e?[]:e,r=t.getConfig().skipCacheTypes,o=void 0===r?["list-item"]:r;return n.map(function(e){var n=No.getNodeType(e);if(o.includes(n))return Po(e,t);var r=tr.get(e);if(r)return r;var i=Po(e,t);return tr.set(e,i),i}).join("")},t.getText=function(){var e=t.children;return(void 0===e?[]:e).map(function(e){return i.Node.string(e)}).join("\n")},t.getSelectionText=function(){var n=t.selection;return null==n?"":i.Editor.string(e,n)},t.getElemsByType=function(e,n){var r,o;void 0===n&&(n=!1);var s=[],a=i.Editor.nodes(t,{at:[],universal:!0});try{for(var l=m(a),u=l.next();!u.done;u=l.next()){var c=y(u.value,1)[0];if(i.Element.isElement(c))if(n?c.type.indexOf(e)>=0:c.type===e){var d=No.findKey(t,c),h=po(c.type,d.id);s.push(v(v({},c),{id:h}))}}}catch(e){r={error:e}}finally{try{u&&!u.done&&(o=l.return)&&o.call(l)}finally{if(r)throw r.error}}return s},t.getElemsByTypePrefix=function(e){return t.getElemsByType(e,!0)},t.isEmpty=function(){var e=t.children,n=void 0===e?[]:e;if(n.length>1)return!1;var r=n[0];if(null==r)return!0;if(!i.Element.isElement(r)||"paragraph"!==r.type)return!1;var o=r.children,s=void 0===o?[]:o;if(s.length>1)return!1;var a=s[0];return null==a||i.Text.isText(a)&&""===a.text},t.clear=function(){for(var e=t.children.length-1;e>=0;e-=1)i.Transforms.removeNodes(t,{at:[e]});0!==t.children.length?function(e){var t=e.children[0];if(1===e.children.length&&i.Element.isElement(t)&&("paragraph"!==t.type||""!==i.Node.string(t))&&""===i.Node.string(t)){var n=[{type:"paragraph",children:[{text:""}]}];i.Editor.withoutNormalizing(e,function(){i.Transforms.removeNodes(e,{at:[0]}),i.Transforms.insertNodes(e,n,{at:[0]})})}}(t):i.Transforms.insertNodes(t,[{type:"paragraph",children:[{text:""}]}])},t.getParentNode=function(e){return No.getParentNode(t,e)},t.dangerouslyInsertHtml=function(e,n){if(void 0===e&&(e=""),void 0===n&&(n=!1),e){var r=document.createElement("div");r.innerHTML=e;var o=Array.from(r.childNodes);if(o=o.filter(function(e){var t=e.nodeName;return!!jr(e)||!!Ar(e)&&!mr.has(t.toLowerCase())}),0!==o.length){var s=t.selection;if(null!=s){var l=null;if(No.isSelectedEmptyParagraph(t)&&!n)l=[s.focus.path[0]];r.setAttribute("hidden","true"),document.body.appendChild(r);var u=0;o.forEach(function(e,n){var r=e.nodeName,s=e.textContent,l=void 0===s?"":s;if(jr(e)){if(!l||!l.trim())return;t.insertNode({text:l})}else if("BR"!==r){var c=e,d=!1;if(Yr.includes(r.toLowerCase()))d=!0;else for(var h in eo)if(c.matches(h)){d=!0;break}if(d){var p=uo(a(c),t),f=Array.isArray(p)?p:[p];if(f.forEach(function(e){return function(e,t){e.isInline(t)?(e.insertNode(t),"link"===t.type&&e.insertFragment([{text:""}])):i.Transforms.insertNodes(e,t,{mode:"highest"})}(t,e)}),u+=f.length,No.isSelectedVoidNode(t)&&t.move(1),f.some(function(e){return!!i.Element.isElement(e)&&(!!t.isInline(e)||e.children.some(function(e){return i.Element.isElement(e)&&t.isInline(e)}))})&&t.selection){var g=i.Editor.nodes(t,{at:t.selection,match:function(e){return i.Element.isElement(e)&&t.isInline(e)},universal:!0}).next().value;if(g){var v=y(g,2)[1],m=i.Path.next(v);i.Editor.hasPath(t,m)?i.Transforms.select(t,{anchor:{path:m,offset:0},focus:{path:m,offset:0}}):t.move(1)}}}else{var b=window.getComputedStyle(c).display;if(!No.isSelectedEmptyParagraph(t)&&b.indexOf("inline")<0){if(n>=1){var w=o[n-1];Mr(w)&&t.insertBreak()}t.insertBreak()}t.dangerouslyInsertHtml(c.innerHTML,!0)}}else t.insertText("\n")}),u&&l&&No.isEmptyPath(t,l)&&i.Transforms.removeNodes(t,{at:l}),r.remove()}}}},t.setHtml=function(e){void 0===e&&(e="");var n=t.isDisabled(),r=t.isFocused(),o=JSON.stringify(t.selection);t.enable(),dr.delete(t),t.focus(),t.clear();var s=ho(t,null==e?"":e);if(i.Transforms.insertFragment(t,s),r||(t.deselect(),t.blur()),n&&(t.deselect(),t.disable()),t.isFocused())try{var a=JSON.parse(o);i.Range.isRange(a)&&No.hasRange(t,a)?t.select(a):t.select(i.Editor.start(t,[]))}catch(e){t.select(i.Editor.start(t,[]))}},t},Ei=1,xi=function(e){var t=e;return t.id="wangEditor-".concat(Ei),Ei+=1,t.isDestroyed=!1,t.isFullScreen=!1,t.focus=function(e){if(No.toDOMNode(t,t).focus({preventScroll:!0}),cr.set(t,!0),e){var n=i.Editor.end(t,[]);i.Transforms.select(t,n)}else{var r=dr.get(t);r?i.Transforms.select(t,r):i.Transforms.select(t,i.Editor.start(t,[]))}},t.isFocused=function(){return!!cr.get(t)},t.blur=function(){No.toDOMNode(t,t).blur(),i.Transforms.deselect(t),cr.set(t,!1)},t.updateView=function(){No.getTextarea(t).changeViewState();var e=No.getToolbar(t);e&&e.changeToolbarState();var n=No.getHoverbar(t);n&&n.changeHoverbarState()},t.destroy=function(){if(!t.isDestroyed){var e=No.getTextarea(t);e.destroy(),Bn.delete(t),Hn.delete(e);var n=No.getToolbar(t);n&&(n.destroy(),Wn.delete(t),zn.delete(n));var r=No.getHoverbar(t);r&&(r.destroy(),qn.delete(t),Vn.delete(r)),t.isDestroyed=!0,t.emit(Ln)}},t.scrollToElem=function(e){if(!t.getConfig().scroll){var n="编辑器禁用了 scroll ,编辑器内容无法滚动,请自行实现该功能";return n+="\nYou has disabled editor scroll, please do this yourself",void console.warn(n)}var r=a("#".concat(e));if(0!==r.length){var o=r[0];if(!No.hasDOMNode(t,o)){n="Element (found by id is '".concat(e,"') is not in editor DOM");return n+="\n 通过 id '".concat(e,"' 找到的 element 不在 editor DOM 之内"),void console.error(n,o)}var i=No.getTextarea(t),s=i.$textAreaContainer,l=i.$scroll,u=r.offset().top,c=s.offset().top;l[0].scrollBy({top:u-c,behavior:"smooth"})}},t.showProgressBar=function(e){e<1||No.getTextarea(t).changeProgress(e)},t.hidePanelOrModal=function(){var e=Jn.get(t);null!=e&&e.forEach(function(e){return e.hide()})},t.enable=function(){t.getConfig().readOnly=!1,t.updateView()},t.disable=function(){t.getConfig().readOnly=!0,t.updateView()},t.isDisabled=function(){return t.getConfig().readOnly},t.toDOMNode=function(e){return No.toDOMNode(t,e)},t.fullScreen=function(){if(!t.isFullScreen){var e=null,n=No.getToolbar(t);n&&(e=n.$box);var r=No.getTextarea(t).$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()),t.isFullScreen=!0,t.emit(An)}},t.unFullScreen=function(){if(t.isFullScreen){var e=No.getTextarea(t).$box.parent();setTimeout(function(){e.removeClass("w-e-full-screen-container"),t.isFullScreen=!1,t.emit(Fn)},200)}},t.getEditableContainer=function(){return No.getTextarea(t).$textAreaContainer[0]},t},Si={exports:{}},_i={exports:{}};function Oi(){if(Do)return $o;Do=1;return $o=function(e){return null!=e}}function ki(){if(Io)return jo;Io=1;var e=function(){if(Fo)return Ao;Fo=1;var e=Oi(),t={object:!0,function:!0,undefined:!0};return Ao=function(n){return!!e(n)&&hasOwnProperty.call(t,typeof n)}}();return jo=function(t){if(!e(t))return!1;try{return!!t.constructor&&t.constructor.prototype===t}catch(e){return!1}}}function Ci(){if(zo)return Ho;zo=1;var e=function(){if(Bo)return Uo;Bo=1;var e=ki();return Uo=function(t){if("function"!=typeof t)return!1;if(!hasOwnProperty.call(t,"length"))return!1;try{if("number"!=typeof t.length)return!1;if("function"!=typeof t.call)return!1;if("function"!=typeof t.apply)return!1}catch(e){return!1}return!e(t)}}(),t=/^\s*class[\s{/}]/,n=Function.prototype.toString;return Ho=function(r){return!!e(r)&&!t.test(n.call(r))}}function Ti(){if(Yo)return Xo;Yo=1;var e=(Go?Jo:(Go=1,Jo=function(){}))();return Xo=function(t){return t!==e&&null!==t}}function Ni(){return ti||(ti=1,ei=(Ko?qo:(Ko=1,qo=function(){try{return Object.keys("primitive"),!0}catch(e){return!1}}))()?Object.keys:function(){if(Zo)return Qo;Zo=1;var e=Ti(),t=Object.keys;return Qo=function(n){return t(e(n)?Object(n):n)}}()),ei}function Pi(){if(ii)return oi;ii=1;var e=Ni(),t=function(){if(ri)return ni;ri=1;var e=Ti();return ni=function(t){if(!e(t))throw new TypeError("Cannot use null or undefined");return t}}(),n=Math.max;return oi=function(r,o){var i,s,a,l=n(arguments.length,2);for(r=Object(t(r)),a=function(e){try{r[e]=o[e]}catch(e){i||(i=e)}},s=1;s<l;++s)e(o=arguments[s]).forEach(a);if(void 0!==i)throw i;return r},oi}function Mi(){return ai?si:(ai=1,si=(Vo||(Vo=1,Wo=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")}),Wo)()?Object.assign:Pi())}function Ri(){return gi||(gi=1,fi=function(){if(di)return ci;di=1;var e="razdwatrzy";return ci=function(){return"function"==typeof e.contains&&!0===e.contains("dwa")&&!1===e.contains("foo")}}()()?String.prototype.contains:function(){if(pi)return hi;pi=1;var e=String.prototype.indexOf;return hi=function(t){return e.call(this,t,arguments[1])>-1},hi}()),fi}function Li(){if(vi)return _i.exports;vi=1;var e=Oi(),t=Ci(),n=Mi(),r=function(){if(ui)return li;ui=1;var e=Ti(),t=Array.prototype.forEach,n=Object.create;return li=function(r){var o=n(null);return t.call(arguments,function(t){e(t)&&function(e,t){var n;for(n in e)t[n]=e[n]}(Object(t),o)}),o},li}(),o=Ri(),i=_i.exports=function(t,i){var s,a,l,u,c;return arguments.length<2||"string"!=typeof t?(u=i,i=t,t=null):u=arguments[2],e(t)?(s=o.call(t,"c"),a=o.call(t,"e"),l=o.call(t,"w")):(s=l=!0,a=!1),c={value:i,configurable:s,enumerable:a,writable:l},u?n(r(u),c):c};return i.gs=function(i,s,a){var l,u,c,d;return"string"!=typeof i?(c=a,a=s,s=i,i=null):c=arguments[3],e(s)?t(s)?e(a)?t(a)||(c=a,a=void 0):a=void 0:(c=s,s=a=void 0):s=void 0,e(i)?(l=o.call(i,"c"),u=o.call(i,"e")):(l=!0,u=!1),d={get:s,set:a,configurable:l,enumerable:u},c?n(r(c),d):d},_i.exports}var $i=(bi||(bi=1,function(e,t){var n,r,o,i,s,a,l,u=Li(),c=yi?mi:(yi=1,mi=function(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");return e}),d=Function.prototype.apply,h=Function.prototype.call,p=Object.create,f=Object.defineProperty,g=Object.defineProperties,v=Object.prototype.hasOwnProperty,m={configurable:!0,enumerable:!1,writable:!0};r=function(e,t){var r,i;return c(t),i=this,n.call(this,e,r=function(){o.call(i,e,r),d.call(t,this,arguments)}),r.__eeOnceListener__=t,this},o=function(e,t){var n,r,o,i;if(c(t),!v.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(v.call(this,"__ee__")&&(o=this.__ee__[e]))if("object"==typeof o){for(n=arguments.length,i=new Array(n-1),t=1;t<n;++t)i[t-1]=arguments[t];for(o=o.slice(),t=0;r=o[t];++t)d.call(r,this,i)}else switch(arguments.length){case 1:h.call(o,this);break;case 2:h.call(o,this,arguments[1]);break;case 3:h.call(o,this,arguments[1],arguments[2]);break;default:for(n=arguments.length,i=new Array(n-1),t=1;t<n;++t)i[t-1]=arguments[t];d.call(o,this,i)}},s={on:n=function(e,t){var n;return c(t),v.call(this,"__ee__")?n=this.__ee__:(n=m.value=p(null),f(this,"__ee__",m),m.value=null),n[e]?"object"==typeof n[e]?n[e].push(t):n[e]=[n[e],t]:n[e]=t,this},once:r,off:o,emit:i},a={on:u(n),once:u(r),off:u(o),emit:u(i)},l=g({},a),e.exports=t=function(e){return null==e?p(l):g(Object(e),a)},t.methods=s}(Si,Si.exports)),Si.exports),Di=w($i);function Ai(e){var t=hr.get(e);return null==t&&(t=Di(),hr.set(e,t)),t}var Fi=new WeakMap;function ji(e,t){var n=Fi.get(e);null==n&&(n=new Set,Fi.set(e,n)),n.add(t)}var Ii=function(e){var t=e;return t.on=function(e,n){var r=Ai(t);if(r.on(e,n),"destroyed"===e&&ji(t,n),"destroyed"!==e){var o=function(){return r.off(e,n)};r.on("destroyed",o),ji(t,o)}},t.once=function(e,n){Ai(t).once(e,n)},t.off=function(e,n){Ai(t).off(e,n)},t.emit=function(e){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];var o=Ai(t);if(o.emit.apply(o,b([e],y(n),!1)),"destroyed"===e){var i=function(e){return Fi.get(e)||new Set}(t);i.forEach(function(e){return o.off("destroyed",e)}),function(e){Fi.set(e,new Set)}(t)}},t};var Ui=function(e){var t=e;return t.setFragmentData=function(e){var n=t.selection;if(n){var r=y(i.Range.edges(n),2),o=r[0],s=r[1],a=i.Editor.void(t,{at:o.path}),l=i.Editor.void(t,{at:s.path});if(!i.Range.isCollapsed(n)||a){var u=No.toDOMRange(t,n),c=u.cloneContents(),d=c.childNodes[0];if(c.childNodes.forEach(function(e){e.textContent&&""!==e.textContent.trim()&&(d=e)}),l){var h=y(l,1)[0],p=u.cloneRange(),f=No.toDOMNode(t,h);p.setEndAfter(f),c=p.cloneContents()}if(a&&(d=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":""}),jr(d)){var g=d.ownerDocument.createElement("span");g.style.whiteSpace="pre",g.appendChild(d),c.appendChild(g),d=g}var v=t.getFragment(),m=JSON.stringify(v),b=window.btoa(encodeURIComponent(m));d.setAttribute("data-slate-fragment",b),e.setData("application/x-slate-fragment",b);var w=c.ownerDocument.createElement("div");return w.appendChild(c),w.setAttribute("hidden","true"),c.ownerDocument.body.appendChild(w),e.setData("text/html",w.innerHTML),e.setData("text/plain",Vr(w)),c.ownerDocument.body.removeChild(w),e}}},t.insertData=function(e){var n=e.getData("application/x-slate-fragment");if(n){var r=decodeURIComponent(window.atob(n)),o=JSON.parse(r);t.insertFragment(o)}else{var i=e.getData("text/plain"),s=e.getData("text/html");if(s){var a=t.getConfig().sanitizeHtml;t.dangerouslyInsertHtml(a?a(s):s)}else if(i){if(!/[\r\n]/.test(i))return void t.insertText(i);var l=function(e){return e.replace(/\n\r|\r\n|\r/g,"\n").split("\n").map(function(e){return{type:"paragraph",children:[{text:e}]}})}(i);t.insertFragment(l)}}},t};function Bi(e){return e.replace(/\n\r|\r\n|\r|\n/g,"").length}function Hi(e,t){var n,r;if(t<=0)return"";var o=t,i="";try{for(var s=m(e),a=s.next();!a.done;a=s.next()){var l=a.value;if(/\r|\n/.test(l))i+=l;else{if(o<=0)break;i+=l,o-=1}}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}return i}var zi=function(e){var t=e,n=t.insertText,r=t.insertNode,o=t.insertFragment,s=t.dangerouslyInsertHtml;return t.insertText=function(e){if(t.getConfig().maxLength){var r=No.getLeftLengthOfMaxLength(t);r<=0||(r<e.length?n(e.slice(0,r)):n(e))}else n(e)},t.insertNode=function(e){if(t.getConfig().maxLength){var n=No.getLeftLengthOfMaxLength(t);if(!(n<=0))n<i.Node.string(e).length||r(e)}else r(e)},t.insertFragment=function(e){if(t.getConfig().maxLength){if(e.length>0){var n=e[0];if(No.getLeftLengthOfMaxLength(t)<i.Node.string(n).length)return;o([n]);for(var r=1;r<e.length;r+=1)t.insertNode(e[r])}}else o(e)},t.dangerouslyInsertHtml=function(e,n){if(void 0===e&&(e=""),void 0===n&&(n=!1),e)if(t.getConfig().maxLength){var r=No.getLeftLengthOfMaxLength(t);if(!(r<=0)){var o=function(e,t){if(t<=0)return"";var n=document.createElement("div");n.innerHTML=e;var r=function(e){e.forEach(function(e){return e.remove()})},o=function(e){for(var n=Array.from(e.childNodes),i=0;i<n.length;i+=1){var s=n[i];if(jr(s)){var a=s.textContent||"",l=Bi(a);if(l<=t){t-=l;continue}return s.textContent=Hi(a,t),t=0,r(n.slice(i+1)),!1}if(Ar(s)){if(mr.has(s.nodeName.toLowerCase())){s.remove();continue}if(!o(s))return r(n.slice(i+1)),!1}else s.remove()}return t>0};return o(n),n.innerHTML}(e,r);o&&s(o,n)}}else s(e,n)},t};function Wi(e){return e<0?0:e}function Vi(e){var t=No.getTextarea(e).$textAreaContainer,n=t.width(),r=t.height(),o=t.offset();return{top:o.top,left:o.left,width:n,height:r}}function qi(e){var t={top:"0",left:"0"},n=e.selection;if(null==n)return t;var r=Vi(e);if(null==r)return t;var o=r.top,i=r.left,s=r.width,a=r.height,l=No.toDOMRange(e,n).getClientRects(),u=l?l[0]:null;if(null==u)return t;var c={},d=u.top-o,h=u.left-i;if(h>s/2){var p=Wi(s-h);c.right="".concat(p+5,"px")}else{var f=Wi(h);c.left="".concat(f+5,"px")}if(d>a/2){var g=Wi(a-d);c.bottom="".concat(g+5,"px")}else{var v=l[l.length-1],m=v.top-o+v.height;m<0&&(m=0),c.top="".concat(m+5,"px")}return c}function Ki(e,t,n){void 0===n&&(n="modal");var r={top:"0",left:"0"};if(null==e.selection)return r;var o=i.Element.isElement(t)&&e.isVoid(t),s=i.Element.isElement(t)&&e.isInline(t),a=ar.get(t);if(null==a)return r;var l=a.getBoundingClientRect(),u=l.top,c=l.left,d=l.height,h=l.width;if(o){var p=qr(a);if(null!=p){var f=p.getBoundingClientRect();u=f.top,d=f.height}}var g=Vi(e);if(null==g)return r;var v=g.top,m=g.left,y=g.width,b=g.height,w={},E=u-v,x=c-m;if("bar"===n){if(w.left="".concat(Wi(x),"px"),E>40){var S=Wi(b-E);w.bottom="".concat(S+5,"px")}else w.top="".concat(E+d+5,"px");return w}if("modal"===n){if(o)if(s)if(x>(y-h)/2){var _=Wi(y-x);w.right="".concat(_+5,"px")}else{var O=Wi(x+h);w.left="".concat(O+5,"px")}else w.left="20px";else w.left="".concat(Wi(x),"px");if(o)(k=E)<0&&(k=0),w.top="".concat(k,"px");else if(E>(b-d)/2){S=Wi(b-E);w.bottom="".concat(S+5,"px")}else{var k;(k=E+d)<0&&(k=0),w.top="".concat(k+5,"px")}return w}throw new Error("type '".concat(n,"' is invalid"))}function Ji(e,t){mn(function(){var n=Vi(e);if(null!=n){var r,o=n.top,i=n.left,s=n.width,a=n.height,l=t.offset(),u=l.top,c=l.left,d=t.width(),h=t.height(),p=u-o,f=c-i,g=t.attr("style");if(g.indexOf("top")>=0)if((r=p+h-a)>0){var v=t.css("top"),m=parseInt(v.toString(),10)-r;m<0&&(m=0),t.css("top","".concat(m,"px"))}if(g.indexOf("bottom")>=0&&u<0){var y=t.css("bottom"),b=parseInt(y.toString(),10)-Math.abs(u);t.css("bottom","".concat(b,"px"))}if(g.indexOf("left")>=0)if((r=f+d-s)>0){var w=t.css("left"),E=parseInt(w.toString(),10)-r;E<0&&(E=0),t.css("left","".concat(E,"px"))}if(g.indexOf("right")>=0&&c<0){var x=t.css("right"),S=parseInt(x.toString(),10)-Math.abs(c);t.css("right","".concat(S,"px"))}}})}var Gi=function(e){var t=e,n=t.select,r=t.deselect,o=t.move;return t.select=function(e){n(e)},t.deselect=function(){var e=t.selection,n=No.findDocumentOrShadowRoot(t).getSelection();n&&n.rangeCount>0&&No.hasDOMNode(t,n.anchorNode)&&No.hasDOMNode(t,n.focusNode)&&n.removeAllRanges(),e&&r()},t.move=function(e,t){void 0===t&&(t=!1),"number"==typeof e?e&&(e<0||o({distance:e,unit:"character",reverse:t})):o(e)},t.moveReverse=function(e){t.move(e,!0)},t.restoreSelection=function(){var e=dr.get(t);null!=e&&(t.focus(),n(e))},t.getSelectionPosition=function(){return qi(t)},t.getNodePosition=function(e){return Ki(t,e)},t.isSelectedAll=function(){var e=t.selection;if(null==e)return!1;var n=y(i.Range.edges(e),2),r=n[0],o=n[1],s=y(i.Editor.edges(t,[]),2),a=s[0],l=s[1];return!(!i.Point.equals(r,a)||!i.Point.equals(o,l))},t.selectAll=function(){var e=i.Editor.start(t,[]),r=i.Editor.end(t,[]);n({anchor:e,focus:r})},t};const Xi=e=>"string"==typeof e,Yi=()=>{let e,t;const n=new Promise((n,r)=>{e=n,t=r});return n.resolve=e,n.reject=t,n},Qi=e=>null==e?"":""+e,Zi=/###/g,es=e=>e&&e.indexOf("###")>-1?e.replace(Zi,"."):e,ts=e=>!e||Xi(e),ns=(e,t,n)=>{const r=Xi(t)?t.split("."):t;let o=0;for(;o<r.length-1;){if(ts(e))return{};const t=es(r[o]);!e[t]&&n&&(e[t]=new n),e=Object.prototype.hasOwnProperty.call(e,t)?e[t]:{},++o}return ts(e)?{}:{obj:e,k:es(r[o])}},rs=(e,t,n)=>{const{obj:r,k:o}=ns(e,t,Object);if(void 0!==r||1===t.length)return void(r[o]=n);let i=t[t.length-1],s=t.slice(0,t.length-1),a=ns(e,s,Object);for(;void 0===a.obj&&s.length;)i=`${s[s.length-1]}.${i}`,s=s.slice(0,s.length-1),a=ns(e,s,Object),a&&a.obj&&void 0!==a.obj[`${a.k}.${i}`]&&(a.obj=void 0);a.obj[`${a.k}.${i}`]=n},os=(e,t)=>{const{obj:n,k:r}=ns(e,t);if(n)return n[r]},is=(e,t,n)=>{for(const r in t)"__proto__"!==r&&"constructor"!==r&&(r in e?Xi(e[r])||e[r]instanceof String||Xi(t[r])||t[r]instanceof String?n&&(e[r]=t[r]):is(e[r],t[r],n):e[r]=t[r]);return e},ss=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var as={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};const ls=e=>Xi(e)?e.replace(/[&<>"'\/]/g,e=>as[e]):e;const us=[" ",",","?","!",";"],cs=new class{constructor(e){this.capacity=e,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(e){const t=this.regExpMap.get(e);if(void 0!==t)return t;const n=new RegExp(e);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,n),this.regExpQueue.push(e),n}}(20),ds=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:".";if(!e)return;if(e[t])return e[t];const r=t.split(n);let o=e;for(let e=0;e<r.length;){if(!o||"object"!=typeof o)return;let t,i="";for(let s=e;s<r.length;++s)if(s!==e&&(i+=n),i+=r[s],t=o[i],void 0!==t){if(["string","number","boolean"].indexOf(typeof t)>-1&&s<r.length-1)continue;e+=s-e+1;break}o=t}return o},hs=e=>e&&e.replace("_","-"),ps={type:"logger",log(e){this.output("log",e)},warn(e){this.output("warn",e)},error(e){this.output("error",e)},output(e,t){console&&console[e]&&console[e].apply(console,t)}};class fs{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.init(e,t)}init(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.prefix=t.prefix||"i18next:",this.logger=e||ps,this.options=t,this.debug=t.debug}log(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return this.forward(t,"log","",!0)}warn(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return this.forward(t,"warn","",!0)}error(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return this.forward(t,"error","")}deprecate(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return this.forward(t,"warn","WARNING DEPRECATED: ",!0)}forward(e,t,n,r){return r&&!this.debug?null:(Xi(e[0])&&(e[0]=`${n}${this.prefix} ${e[0]}`),this.logger[t](e))}create(e){return new fs(this.logger,{prefix:`${this.prefix}:${e}:`,...this.options})}clone(e){return(e=e||this.options).prefix=e.prefix||this.prefix,new fs(this.logger,e)}}var gs=new fs;class vs{constructor(){this.observers={}}on(e,t){return e.split(" ").forEach(e=>{this.observers[e]||(this.observers[e]=new Map);const n=this.observers[e].get(t)||0;this.observers[e].set(t,n+1)}),this}off(e,t){this.observers[e]&&(t?this.observers[e].delete(t):delete this.observers[e])}emit(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];if(this.observers[e]){Array.from(this.observers[e].entries()).forEach(e=>{let[t,r]=e;for(let e=0;e<r;e++)t(...n)})}if(this.observers["*"]){Array.from(this.observers["*"].entries()).forEach(t=>{let[r,o]=t;for(let t=0;t<o;t++)r.apply(r,[e,...n])})}}}class ms extends vs{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{ns:["translation"],defaultNS:"translation"};super(),this.data=e||{},this.options=t,void 0===this.options.keySeparator&&(this.options.keySeparator="."),void 0===this.options.ignoreJSONStructure&&(this.options.ignoreJSONStructure=!0)}addNamespaces(e){this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}removeNamespaces(e){const t=this.options.ns.indexOf(e);t>-1&&this.options.ns.splice(t,1)}getResource(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const o=void 0!==r.keySeparator?r.keySeparator:this.options.keySeparator,i=void 0!==r.ignoreJSONStructure?r.ignoreJSONStructure:this.options.ignoreJSONStructure;let s;e.indexOf(".")>-1?s=e.split("."):(s=[e,t],n&&(Array.isArray(n)?s.push(...n):Xi(n)&&o?s.push(...n.split(o)):s.push(n)));const a=os(this.data,s);return!a&&!t&&!n&&e.indexOf(".")>-1&&(e=s[0],t=s[1],n=s.slice(2).join(".")),!a&&i&&Xi(n)?ds(this.data&&this.data[e]&&this.data[e][t],n,o):a}addResource(e,t,n,r){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{silent:!1};const i=void 0!==o.keySeparator?o.keySeparator:this.options.keySeparator;let s=[e,t];n&&(s=s.concat(i?n.split(i):n)),e.indexOf(".")>-1&&(s=e.split("."),r=t,t=s[1]),this.addNamespaces(t),rs(this.data,s,r),o.silent||this.emit("added",e,t,n,r)}addResources(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{silent:!1};for(const r in n)(Xi(n[r])||Array.isArray(n[r]))&&this.addResource(e,t,r,n[r],{silent:!0});r.silent||this.emit("added",e,t,n)}addResourceBundle(e,t,n,r,o){let i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{silent:!1,skipCopy:!1},s=[e,t];e.indexOf(".")>-1&&(s=e.split("."),r=n,n=t,t=s[1]),this.addNamespaces(t);let a=os(this.data,s)||{};i.skipCopy||(n=JSON.parse(JSON.stringify(n))),r?is(a,n,o):a={...a,...n},rs(this.data,s,a),i.silent||this.emit("added",e,t,n)}removeResourceBundle(e,t){this.hasResourceBundle(e,t)&&delete this.data[e][t],this.removeNamespaces(t),this.emit("removed",e,t)}hasResourceBundle(e,t){return void 0!==this.getResource(e,t)}getResourceBundle(e,t){return t||(t=this.options.defaultNS),"v1"===this.options.compatibilityAPI?{...this.getResource(e,t)}:this.getResource(e,t)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){const t=this.getDataByLanguage(e);return!!(t&&Object.keys(t)||[]).find(e=>t[e]&&Object.keys(t[e]).length>0)}toJSON(){return this.data}}var ys={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,n,r,o){return e.forEach(e=>{this.processors[e]&&(t=this.processors[e].process(t,n,r,o))}),t}};const bs={};class ws extends vs{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(),((e,t,n)=>{e.forEach(e=>{t[e]&&(n[e]=t[e])})})(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,this),this.options=t,void 0===this.options.keySeparator&&(this.options.keySeparator="."),this.logger=gs.create("translator")}changeLanguage(e){e&&(this.language=e)}exists(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{interpolation:{}};if(null==e)return!1;const n=this.resolve(e,t);return n&&void 0!==n.res}extractFromKey(e,t){let n=void 0!==t.nsSeparator?t.nsSeparator:this.options.nsSeparator;void 0===n&&(n=":");const r=void 0!==t.keySeparator?t.keySeparator:this.options.keySeparator;let o=t.ns||this.options.defaultNS||[];const i=n&&e.indexOf(n)>-1,s=!(this.options.userDefinedKeySeparator||t.keySeparator||this.options.userDefinedNsSeparator||t.nsSeparator||((e,t,n)=>{t=t||"",n=n||"";const r=us.filter(e=>t.indexOf(e)<0&&n.indexOf(e)<0);if(0===r.length)return!0;const o=cs.getRegExp(`(${r.map(e=>"?"===e?"\\?":e).join("|")})`);let i=!o.test(e);if(!i){const t=e.indexOf(n);t>0&&!o.test(e.substring(0,t))&&(i=!0)}return i})(e,n,r));if(i&&!s){const t=e.match(this.interpolator.nestingRegexp);if(t&&t.length>0)return{key:e,namespaces:Xi(o)?[o]:o};const i=e.split(n);(n!==r||n===r&&this.options.ns.indexOf(i[0])>-1)&&(o=i.shift()),e=i.join(r)}return{key:e,namespaces:Xi(o)?[o]:o}}translate(e,t,n){if("object"!=typeof t&&this.options.overloadTranslationOptionHandler&&(t=this.options.overloadTranslationOptionHandler(arguments)),"object"==typeof t&&(t={...t}),t||(t={}),null==e)return"";Array.isArray(e)||(e=[String(e)]);const r=void 0!==t.returnDetails?t.returnDetails:this.options.returnDetails,o=void 0!==t.keySeparator?t.keySeparator:this.options.keySeparator,{key:i,namespaces:s}=this.extractFromKey(e[e.length-1],t),a=s[s.length-1],l=t.lng||this.language,u=t.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(l&&"cimode"===l.toLowerCase()){if(u){const e=t.nsSeparator||this.options.nsSeparator;return r?{res:`${a}${e}${i}`,usedKey:i,exactUsedKey:i,usedLng:l,usedNS:a,usedParams:this.getUsedParamsDetails(t)}:`${a}${e}${i}`}return r?{res:i,usedKey:i,exactUsedKey:i,usedLng:l,usedNS:a,usedParams:this.getUsedParamsDetails(t)}:i}const c=this.resolve(e,t);let d=c&&c.res;const h=c&&c.usedKey||i,p=c&&c.exactUsedKey||i,f=Object.prototype.toString.apply(d),g=void 0!==t.joinArrays?t.joinArrays:this.options.joinArrays,v=!this.i18nFormat||this.i18nFormat.handleAsObject,m=!Xi(d)&&"boolean"!=typeof d&&"number"!=typeof d;if(!(v&&d&&m&&["[object Number]","[object Function]","[object RegExp]"].indexOf(f)<0)||Xi(g)&&Array.isArray(d))if(v&&Xi(g)&&Array.isArray(d))d=d.join(g),d&&(d=this.extendTranslation(d,e,t,n));else{let r=!1,s=!1;const u=void 0!==t.count&&!Xi(t.count),h=ws.hasDefaultValue(t),p=u?this.pluralResolver.getSuffix(l,t.count,t):"",f=t.ordinal&&u?this.pluralResolver.getSuffix(l,t.count,{ordinal:!1}):"",g=u&&!t.ordinal&&0===t.count&&this.pluralResolver.shouldUseIntlApi(),v=g&&t[`defaultValue${this.options.pluralSeparator}zero`]||t[`defaultValue${p}`]||t[`defaultValue${f}`]||t.defaultValue;!this.isValidLookup(d)&&h&&(r=!0,d=v),this.isValidLookup(d)||(s=!0,d=i);const m=(t.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&s?void 0:d,y=h&&v!==d&&this.options.updateMissing;if(s||r||y){if(this.logger.log(y?"updateKey":"missingKey",l,a,i,y?v:d),o){const e=this.resolve(i,{...t,keySeparator:!1});e&&e.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.")}let e=[];const n=this.languageUtils.getFallbackCodes(this.options.fallbackLng,t.lng||this.language);if("fallback"===this.options.saveMissingTo&&n&&n[0])for(let t=0;t<n.length;t++)e.push(n[t]);else"all"===this.options.saveMissingTo?e=this.languageUtils.toResolveHierarchy(t.lng||this.language):e.push(t.lng||this.language);const r=(e,n,r)=>{const o=h&&r!==d?r:m;this.options.missingKeyHandler?this.options.missingKeyHandler(e,a,n,o,y,t):this.backendConnector&&this.backendConnector.saveMissing&&this.backendConnector.saveMissing(e,a,n,o,y,t),this.emit("missingKey",e,a,n,d)};this.options.saveMissing&&(this.options.saveMissingPlurals&&u?e.forEach(e=>{const n=this.pluralResolver.getSuffixes(e,t);g&&t[`defaultValue${this.options.pluralSeparator}zero`]&&n.indexOf(`${this.options.pluralSeparator}zero`)<0&&n.push(`${this.options.pluralSeparator}zero`),n.forEach(n=>{r([e],i+n,t[`defaultValue${n}`]||v)})}):r(e,i,v))}d=this.extendTranslation(d,e,t,c,n),s&&d===i&&this.options.appendNamespaceToMissingKey&&(d=`${a}:${i}`),(s||r)&&this.options.parseMissingKeyHandler&&(d="v1"!==this.options.compatibilityAPI?this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${a}:${i}`:i,r?d:void 0):this.options.parseMissingKeyHandler(d))}else{if(!t.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const e=this.options.returnedObjectHandler?this.options.returnedObjectHandler(h,d,{...t,ns:s}):`key '${i} (${this.language})' returned an object instead of string.`;return r?(c.res=e,c.usedParams=this.getUsedParamsDetails(t),c):e}if(o){const e=Array.isArray(d),n=e?[]:{},r=e?p:h;for(const e in d)if(Object.prototype.hasOwnProperty.call(d,e)){const i=`${r}${o}${e}`;n[e]=this.translate(i,{...t,joinArrays:!1,ns:s}),n[e]===i&&(n[e]=d[e])}d=n}}return r?(c.res=d,c.usedParams=this.getUsedParamsDetails(t),c):d}extendTranslation(e,t,n,r,o){var i=this;if(this.i18nFormat&&this.i18nFormat.parse)e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...n},n.lng||this.language||r.usedLng,r.usedNS,r.usedKey,{resolved:r});else if(!n.skipInterpolation){n.interpolation&&this.interpolator.init({...n,interpolation:{...this.options.interpolation,...n.interpolation}});const s=Xi(e)&&(n&&n.interpolation&&void 0!==n.interpolation.skipOnVariables?n.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let a;if(s){const t=e.match(this.interpolator.nestingRegexp);a=t&&t.length}let l=n.replace&&!Xi(n.replace)?n.replace:n;if(this.options.interpolation.defaultVariables&&(l={...this.options.interpolation.defaultVariables,...l}),e=this.interpolator.interpolate(e,l,n.lng||this.language||r.usedLng,n),s){const t=e.match(this.interpolator.nestingRegexp);a<(t&&t.length)&&(n.nest=!1)}!n.lng&&"v1"!==this.options.compatibilityAPI&&r&&r.res&&(n.lng=this.language||r.usedLng),!1!==n.nest&&(e=this.interpolator.nest(e,function(){for(var e=arguments.length,r=new Array(e),s=0;s<e;s++)r[s]=arguments[s];return o&&o[0]===r[0]&&!n.context?(i.logger.warn(`It seems you are nesting recursively key: ${r[0]} in key: ${t[0]}`),null):i.translate(...r,t)},n)),n.interpolation&&this.interpolator.reset()}const s=n.postProcess||this.options.postProcess,a=Xi(s)?[s]:s;return null!=e&&a&&a.length&&!1!==n.applyPostProcessor&&(e=ys.handle(a,e,t,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...r,usedParams:this.getUsedParamsDetails(n)},...n}:n,this)),e}resolve(e){let t,n,r,o,i,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Xi(e)&&(e=[e]),e.forEach(e=>{if(this.isValidLookup(t))return;const a=this.extractFromKey(e,s),l=a.key;n=l;let u=a.namespaces;this.options.fallbackNS&&(u=u.concat(this.options.fallbackNS));const c=void 0!==s.count&&!Xi(s.count),d=c&&!s.ordinal&&0===s.count&&this.pluralResolver.shouldUseIntlApi(),h=void 0!==s.context&&(Xi(s.context)||"number"==typeof s.context)&&""!==s.context,p=s.lngs?s.lngs:this.languageUtils.toResolveHierarchy(s.lng||this.language,s.fallbackLng);u.forEach(e=>{this.isValidLookup(t)||(i=e,!bs[`${p[0]}-${e}`]&&this.utils&&this.utils.hasLoadedNamespace&&!this.utils.hasLoadedNamespace(i)&&(bs[`${p[0]}-${e}`]=!0,this.logger.warn(`key "${n}" for languages "${p.join(", ")}" won't get resolved as namespace "${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(n=>{if(this.isValidLookup(t))return;o=n;const i=[l];if(this.i18nFormat&&this.i18nFormat.addLookupKeys)this.i18nFormat.addLookupKeys(i,l,n,e,s);else{let e;c&&(e=this.pluralResolver.getSuffix(n,s.count,s));const t=`${this.options.pluralSeparator}zero`,r=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(c&&(i.push(l+e),s.ordinal&&0===e.indexOf(r)&&i.push(l+e.replace(r,this.options.pluralSeparator)),d&&i.push(l+t)),h){const n=`${l}${this.options.contextSeparator}${s.context}`;i.push(n),c&&(i.push(n+e),s.ordinal&&0===e.indexOf(r)&&i.push(n+e.replace(r,this.options.pluralSeparator)),d&&i.push(n+t))}}let a;for(;a=i.pop();)this.isValidLookup(t)||(r=a,t=this.getResource(n,e,a,s))}))})}),{res:t,usedKey:n,exactUsedKey:r,usedLng:o,usedNS:i}}isValidLookup(e){return!(void 0===e||!this.options.returnNull&&null===e||!this.options.returnEmptyString&&""===e)}getResource(e,t,n){let 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)}getUsedParamsDetails(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],n=e.replace&&!Xi(e.replace);let r=n?e.replace:e;if(n&&void 0!==e.count&&(r.count=e.count),this.options.interpolation.defaultVariables&&(r={...this.options.interpolation.defaultVariables,...r}),!n){r={...r};for(const e of t)delete r[e]}return r}static hasDefaultValue(e){const t="defaultValue";for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t===n.substring(0,12)&&void 0!==e[n])return!0;return!1}}const Es=e=>e.charAt(0).toUpperCase()+e.slice(1);class xs{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=gs.create("languageUtils")}getScriptPartFromCode(e){if(!(e=hs(e))||e.indexOf("-")<0)return null;const t=e.split("-");return 2===t.length?null:(t.pop(),"x"===t[t.length-1].toLowerCase()?null:this.formatLanguageCode(t.join("-")))}getLanguagePartFromCode(e){if(!(e=hs(e))||e.indexOf("-")<0)return e;const t=e.split("-");return this.formatLanguageCode(t[0])}formatLanguageCode(e){if(Xi(e)&&e.indexOf("-")>-1){if("undefined"!=typeof Intl&&void 0!==Intl.getCanonicalLocales)try{let t=Intl.getCanonicalLocales(e)[0];if(t&&this.options.lowerCaseLng&&(t=t.toLowerCase()),t)return t}catch(e){}const t=["hans","hant","latn","cyrl","cans","mong","arab"];let n=e.split("-");return this.options.lowerCaseLng?n=n.map(e=>e.toLowerCase()):2===n.length?(n[0]=n[0].toLowerCase(),n[1]=n[1].toUpperCase(),t.indexOf(n[1].toLowerCase())>-1&&(n[1]=Es(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]=Es(n[1].toLowerCase())),t.indexOf(n[2].toLowerCase())>-1&&(n[2]=Es(n[2].toLowerCase()))),n.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}isSupportedCode(e){return("languageOnly"===this.options.load||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}getBestMatchFromCodes(e){if(!e)return null;let t;return e.forEach(e=>{if(t)return;const n=this.formatLanguageCode(e);this.options.supportedLngs&&!this.isSupportedCode(n)||(t=n)}),!t&&this.options.supportedLngs&&e.forEach(e=>{if(t)return;const n=this.getLanguagePartFromCode(e);if(this.isSupportedCode(n))return t=n;t=this.options.supportedLngs.find(e=>e===n?e:e.indexOf("-")<0&&n.indexOf("-")<0?void 0:e.indexOf("-")>0&&n.indexOf("-")<0&&e.substring(0,e.indexOf("-"))===n||0===e.indexOf(n)&&n.length>1?e:void 0)}),t||(t=this.getFallbackCodes(this.options.fallbackLng)[0]),t}getFallbackCodes(e,t){if(!e)return[];if("function"==typeof e&&(e=e(t)),Xi(e)&&(e=[e]),Array.isArray(e))return e;if(!t)return e.default||[];let 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||[]}toResolveHierarchy(e,t){const n=this.getFallbackCodes(t||this.options.fallbackLng||[],e),r=[],o=e=>{e&&(this.isSupportedCode(e)?r.push(e):this.logger.warn(`rejecting language code not found in supportedLngs: ${e}`))};return Xi(e)&&(e.indexOf("-")>-1||e.indexOf("_")>-1)?("languageOnly"!==this.options.load&&o(this.formatLanguageCode(e)),"languageOnly"!==this.options.load&&"currentOnly"!==this.options.load&&o(this.getScriptPartFromCode(e)),"currentOnly"!==this.options.load&&o(this.getLanguagePartFromCode(e))):Xi(e)&&o(this.formatLanguageCode(e)),n.forEach(e=>{r.indexOf(e)<0&&o(this.formatLanguageCode(e))}),r}}let Ss=[{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}],_s={1:e=>Number(e>1),2:e=>Number(1!=e),3:e=>0,4:e=>Number(e%10==1&&e%100!=11?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2),5:e=>Number(0==e?0:1==e?1:2==e?2:e%100>=3&&e%100<=10?3:e%100>=11?4:5),6:e=>Number(1==e?0:e>=2&&e<=4?1:2),7:e=>Number(1==e?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2),8:e=>Number(1==e?0:2==e?1:8!=e&&11!=e?2:3),9:e=>Number(e>=2),10:e=>Number(1==e?0:2==e?1:e<7?2:e<11?3:4),11:e=>Number(1==e||11==e?0:2==e||12==e?1:e>2&&e<20?2:3),12:e=>Number(e%10!=1||e%100==11),13:e=>Number(0!==e),14:e=>Number(1==e?0:2==e?1:3==e?2:3),15:e=>Number(e%10==1&&e%100!=11?0:e%10>=2&&(e%100<10||e%100>=20)?1:2),16:e=>Number(e%10==1&&e%100!=11?0:0!==e?1:2),17:e=>Number(1==e||e%10==1&&e%100!=11?0:1),18:e=>Number(0==e?0:1==e?1:2),19:e=>Number(1==e?0:0==e||e%100>1&&e%100<11?1:e%100>10&&e%100<20?2:3),20:e=>Number(1==e?0:0==e||e%100>0&&e%100<20?1:2),21:e=>Number(e%100==1?1:e%100==2?2:e%100==3||e%100==4?3:0),22:e=>Number(1==e?0:2==e?1:(e<0||e>10)&&e%10==0?2:3)};const Os=["v1","v2","v3"],ks=["v4"],Cs={zero:0,one:1,two:2,few:3,many:4,other:5};class Ts{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.languageUtils=e,this.options=t,this.logger=gs.create("pluralResolver"),this.options.compatibilityJSON&&!ks.includes(this.options.compatibilityJSON)||"undefined"!=typeof Intl&&Intl.PluralRules||(this.options.compatibilityJSON="v3",this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.")),this.rules=(()=>{const e={};return Ss.forEach(t=>{t.lngs.forEach(n=>{e[n]={numbers:t.nr,plurals:_s[t.fc]}})}),e})(),this.pluralRulesCache={}}addRule(e,t){this.rules[e]=t}clearCache(){this.pluralRulesCache={}}getRule(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.shouldUseIntlApi()){const n=hs("dev"===e?"en":e),r=t.ordinal?"ordinal":"cardinal",o=JSON.stringify({cleanedCode:n,type:r});if(o in this.pluralRulesCache)return this.pluralRulesCache[o];let i;try{i=new Intl.PluralRules(n,{type:r})}catch(n){if(!e.match(/-|_/))return;const r=this.languageUtils.getLanguagePartFromCode(e);i=this.getRule(r,t)}return this.pluralRulesCache[o]=i,i}return this.rules[e]||this.rules[this.languageUtils.getLanguagePartFromCode(e)]}needsPlural(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=this.getRule(e,t);return this.shouldUseIntlApi()?n&&n.resolvedOptions().pluralCategories.length>1:n&&n.numbers.length>1}getPluralFormsOfKey(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.getSuffixes(e,n).map(e=>`${t}${e}`)}getSuffixes(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=this.getRule(e,t);return n?this.shouldUseIntlApi()?n.resolvedOptions().pluralCategories.sort((e,t)=>Cs[e]-Cs[t]).map(e=>`${this.options.prepend}${t.ordinal?`ordinal${this.options.prepend}`:""}${e}`):n.numbers.map(n=>this.getSuffix(e,n,t)):[]}getSuffix(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r=this.getRule(e,n);return r?this.shouldUseIntlApi()?`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${r.select(t)}`:this.getSuffixRetroCompatible(r,t):(this.logger.warn(`no plural rule found for: ${e}`),"")}getSuffixRetroCompatible(e,t){const n=e.noAbs?e.plurals(t):e.plurals(Math.abs(t));let r=e.numbers[n];this.options.simplifyPluralSuffix&&2===e.numbers.length&&1===e.numbers[0]&&(2===r?r="plural":1===r&&(r=""));const o=()=>this.options.prepend&&r.toString()?this.options.prepend+r.toString():r.toString();return"v1"===this.options.compatibilityJSON?1===r?"":"number"==typeof r?`_plural_${r.toString()}`:o():"v2"===this.options.compatibilityJSON||this.options.simplifyPluralSuffix&&2===e.numbers.length&&1===e.numbers[0]?o():this.options.prepend&&n.toString()?this.options.prepend+n.toString():n.toString()}shouldUseIntlApi(){return!Os.includes(this.options.compatibilityJSON)}}const Ns=function(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:".",o=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],i=((e,t,n)=>{const r=os(e,n);return void 0!==r?r:os(t,n)})(e,t,n);return!i&&o&&Xi(n)&&(i=ds(e,n,r),void 0===i&&(i=ds(t,n,r))),i},Ps=e=>e.replace(/\$/g,"$$$$");class Ms{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.logger=gs.create("interpolator"),this.options=e,this.format=e.interpolation&&e.interpolation.format||(e=>e),this.init(e)}init(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e.interpolation||(e.interpolation={escapeValue:!0});const{escape:t,escapeValue:n,useRawValueToEscape:r,prefix:o,prefixEscaped:i,suffix:s,suffixEscaped:a,formatSeparator:l,unescapeSuffix:u,unescapePrefix:c,nestingPrefix:d,nestingPrefixEscaped:h,nestingSuffix:p,nestingSuffixEscaped:f,nestingOptionsSeparator:g,maxReplaces:v,alwaysFormat:m}=e.interpolation;this.escape=void 0!==t?t:ls,this.escapeValue=void 0===n||n,this.useRawValueToEscape=void 0!==r&&r,this.prefix=o?ss(o):i||"{{",this.suffix=s?ss(s):a||"}}",this.formatSeparator=l||",",this.unescapePrefix=u?"":c||"-",this.unescapeSuffix=this.unescapePrefix?"":u||"",this.nestingPrefix=d?ss(d):h||ss("$t("),this.nestingSuffix=p?ss(p):f||ss(")"),this.nestingOptionsSeparator=g||",",this.maxReplaces=v||1e3,this.alwaysFormat=void 0!==m&&m,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const e=(e,t)=>e&&e.source===t?(e.lastIndex=0,e):new RegExp(t,"g");this.regexp=e(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=e(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=e(this.nestingRegexp,`${this.nestingPrefix}(.+?)${this.nestingSuffix}`)}interpolate(e,t,n,r){let o,i,s;const a=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},l=e=>{if(e.indexOf(this.formatSeparator)<0){const o=Ns(t,a,e,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(o,void 0,n,{...r,...t,interpolationkey:e}):o}const o=e.split(this.formatSeparator),i=o.shift().trim(),s=o.join(this.formatSeparator).trim();return this.format(Ns(t,a,i,this.options.keySeparator,this.options.ignoreJSONStructure),s,n,{...r,...t,interpolationkey:i})};this.resetRegExp();const u=r&&r.missingInterpolationHandler||this.options.missingInterpolationHandler,c=r&&r.interpolation&&void 0!==r.interpolation.skipOnVariables?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:e=>Ps(e)},{regex:this.regexp,safeValue:e=>this.escapeValue?Ps(this.escape(e)):Ps(e)}].forEach(t=>{for(s=0;o=t.regex.exec(e);){const n=o[1].trim();if(i=l(n),void 0===i)if("function"==typeof u){const t=u(e,o,r);i=Xi(t)?t:""}else if(r&&Object.prototype.hasOwnProperty.call(r,n))i="";else{if(c){i=o[0];continue}this.logger.warn(`missed to pass in variable ${n} for interpolating ${e}`),i=""}else Xi(i)||this.useRawValueToEscape||(i=Qi(i));const a=t.safeValue(i);if(e=e.replace(o[0],a),c?(t.regex.lastIndex+=i.length,t.regex.lastIndex-=o[0].length):t.regex.lastIndex=0,s++,s>=this.maxReplaces)break}}),e}nest(e,t){let n,r,o,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const s=(e,t)=>{const n=this.nestingOptionsSeparator;if(e.indexOf(n)<0)return e;const r=e.split(new RegExp(`${n}[ ]*{`));let i=`{${r[1]}`;e=r[0],i=this.interpolate(i,o);const s=i.match(/'/g),a=i.match(/"/g);(s&&s.length%2==0&&!a||a.length%2!=0)&&(i=i.replace(/'/g,'"'));try{o=JSON.parse(i),t&&(o={...t,...o})}catch(t){return this.logger.warn(`failed parsing options string in nesting for key ${e}`,t),`${e}${n}${i}`}return o.defaultValue&&o.defaultValue.indexOf(this.prefix)>-1&&delete o.defaultValue,e};for(;n=this.nestingRegexp.exec(e);){let a=[];o={...i},o=o.replace&&!Xi(o.replace)?o.replace:o,o.applyPostProcessor=!1,delete o.defaultValue;let l=!1;if(-1!==n[0].indexOf(this.formatSeparator)&&!/{.*}/.test(n[1])){const e=n[1].split(this.formatSeparator).map(e=>e.trim());n[1]=e.shift(),a=e,l=!0}if(r=t(s.call(this,n[1].trim(),o),o),r&&n[0]===e&&!Xi(r))return r;Xi(r)||(r=Qi(r)),r||(this.logger.warn(`missed to resolve ${n[1]} for nesting ${e}`),r=""),l&&(r=a.reduce((e,t)=>this.format(e,t,i.lng,{...i,interpolationkey:n[1].trim()}),r.trim())),e=e.replace(n[0],r),this.regexp.lastIndex=0}return e}}const Rs=e=>{const t={};return(n,r,o)=>{let i=o;o&&o.interpolationkey&&o.formatParams&&o.formatParams[o.interpolationkey]&&o[o.interpolationkey]&&(i={...i,[o.interpolationkey]:void 0});const s=r+JSON.stringify(i);let a=t[s];return a||(a=e(hs(r),o),t[s]=a),a(n)}};class Ls{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.logger=gs.create("formatter"),this.options=e,this.formats={number:Rs((e,t)=>{const n=new Intl.NumberFormat(e,{...t});return e=>n.format(e)}),currency:Rs((e,t)=>{const n=new Intl.NumberFormat(e,{...t,style:"currency"});return e=>n.format(e)}),datetime:Rs((e,t)=>{const n=new Intl.DateTimeFormat(e,{...t});return e=>n.format(e)}),relativetime:Rs((e,t)=>{const n=new Intl.RelativeTimeFormat(e,{...t});return e=>n.format(e,t.range||"day")}),list:Rs((e,t)=>{const n=new Intl.ListFormat(e,{...t});return e=>n.format(e)})},this.init(e)}init(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{interpolation:{}};this.formatSeparator=t.interpolation.formatSeparator||","}add(e,t){this.formats[e.toLowerCase().trim()]=t}addCached(e,t){this.formats[e.toLowerCase().trim()]=Rs(t)}format(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const o=t.split(this.formatSeparator);if(o.length>1&&o[0].indexOf("(")>1&&o[0].indexOf(")")<0&&o.find(e=>e.indexOf(")")>-1)){const e=o.findIndex(e=>e.indexOf(")")>-1);o[0]=[o[0],...o.splice(1,e)].join(this.formatSeparator)}const i=o.reduce((e,t)=>{const{formatName:o,formatOptions:i}=(e=>{let t=e.toLowerCase().trim();const n={};if(e.indexOf("(")>-1){const r=e.split("(");t=r[0].toLowerCase().trim();const o=r[1].substring(0,r[1].length-1);"currency"===t&&o.indexOf(":")<0?n.currency||(n.currency=o.trim()):"relativetime"===t&&o.indexOf(":")<0?n.range||(n.range=o.trim()):o.split(";").forEach(e=>{if(e){const[t,...r]=e.split(":"),o=r.join(":").trim().replace(/^'+|'+$/g,""),i=t.trim();n[i]||(n[i]=o),"false"===o&&(n[i]=!1),"true"===o&&(n[i]=!0),isNaN(o)||(n[i]=parseInt(o,10))}})}return{formatName:t,formatOptions:n}})(t);if(this.formats[o]){let t=e;try{const s=r&&r.formatParams&&r.formatParams[r.interpolationkey]||{},a=s.locale||s.lng||r.locale||r.lng||n;t=this.formats[o](e,a,{...i,...r,...s})}catch(e){this.logger.warn(e)}return t}return this.logger.warn(`there was no format function for ${o}`),e},e);return i}}class $s extends vs{constructor(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};super(),this.backend=e,this.store=t,this.services=n,this.languageUtils=n.languageUtils,this.options=r,this.logger=gs.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=r.maxParallelReads||10,this.readingCalls=0,this.maxRetries=r.maxRetries>=0?r.maxRetries:5,this.retryTimeout=r.retryTimeout>=1?r.retryTimeout:350,this.state={},this.queue=[],this.backend&&this.backend.init&&this.backend.init(n,r.backend,r)}queueLoad(e,t,n,r){const o={},i={},s={},a={};return e.forEach(e=>{let r=!0;t.forEach(t=>{const s=`${e}|${t}`;!n.reload&&this.store.hasResourceBundle(e,t)?this.state[s]=2:this.state[s]<0||(1===this.state[s]?void 0===i[s]&&(i[s]=!0):(this.state[s]=1,r=!1,void 0===i[s]&&(i[s]=!0),void 0===o[s]&&(o[s]=!0),void 0===a[t]&&(a[t]=!0)))}),r||(s[e]=!0)}),(Object.keys(o).length||Object.keys(i).length)&&this.queue.push({pending:i,pendingCount:Object.keys(i).length,loaded:{},errors:[],callback:r}),{toLoad:Object.keys(o),pending:Object.keys(i),toLoadLanguages:Object.keys(s),toLoadNamespaces:Object.keys(a)}}loaded(e,t,n){const r=e.split("|"),o=r[0],i=r[1];t&&this.emit("failedLoading",o,i,t),!t&&n&&this.store.addResourceBundle(o,i,n,void 0,void 0,{skipCopy:!0}),this.state[e]=t?-1:2,t&&n&&(this.state[e]=0);const s={};this.queue.forEach(n=>{((e,t,n)=>{const{obj:r,k:o}=ns(e,t,Object);r[o]=r[o]||[],r[o].push(n)})(n.loaded,[o],i),((e,t)=>{void 0!==e.pending[t]&&(delete e.pending[t],e.pendingCount--)})(n,e),t&&n.errors.push(t),0!==n.pendingCount||n.done||(Object.keys(n.loaded).forEach(e=>{s[e]||(s[e]={});const t=n.loaded[e];t.length&&t.forEach(t=>{void 0===s[e][t]&&(s[e][t]=!0)})}),n.done=!0,n.errors.length?n.callback(n.errors):n.callback())}),this.emit("loaded",s),this.queue=this.queue.filter(e=>!e.done)}read(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:this.retryTimeout,i=arguments.length>5?arguments[5]:void 0;if(!e.length)return i(null,{});if(this.readingCalls>=this.maxParallelReads)return void this.waitingReads.push({lng:e,ns:t,fcName:n,tried:r,wait:o,callback:i});this.readingCalls++;const s=(s,a)=>{if(this.readingCalls--,this.waitingReads.length>0){const e=this.waitingReads.shift();this.read(e.lng,e.ns,e.fcName,e.tried,e.wait,e.callback)}s&&a&&r<this.maxRetries?setTimeout(()=>{this.read.call(this,e,t,n,r+1,2*o,i)},o):i(s,a)},a=this.backend[n].bind(this.backend);if(2!==a.length)return a(e,t,s);try{const n=a(e,t);n&&"function"==typeof n.then?n.then(e=>s(null,e)).catch(s):s(null,n)}catch(e){s(e)}}prepareLoading(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=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."),r&&r();Xi(e)&&(e=this.languageUtils.toResolveHierarchy(e)),Xi(t)&&(t=[t]);const o=this.queueLoad(e,t,n,r);if(!o.toLoad.length)return o.pending.length||r(),null;o.toLoad.forEach(e=>{this.loadOne(e)})}load(e,t,n){this.prepareLoading(e,t,{},n)}reload(e,t,n){this.prepareLoading(e,t,{reload:!0},n)}loadOne(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";const n=e.split("|"),r=n[0],o=n[1];this.read(r,o,"read",void 0,void 0,(n,i)=>{n&&this.logger.warn(`${t}loading namespace ${o} for language ${r} failed`,n),!n&&i&&this.logger.log(`${t}loaded namespace ${o} for language ${r}`,i),this.loaded(e,n,i)})}saveMissing(e,t,n,r,o){let i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:()=>{};if(this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(t))this.logger.warn(`did not save key "${n}" as the namespace "${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!!!");else if(null!=n&&""!==n){if(this.backend&&this.backend.create){const a={...i,isUpdate:o},l=this.backend.create.bind(this.backend);if(l.length<6)try{let o;o=5===l.length?l(e,t,n,r,a):l(e,t,n,r),o&&"function"==typeof o.then?o.then(e=>s(null,e)).catch(s):s(null,o)}catch(e){s(e)}else l(e,t,n,r,s,a)}e&&e[0]&&this.store.addResource(e[0],t,n,r)}}}const Ds=()=>({debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!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:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:e=>{let t={};if("object"==typeof e[1]&&(t=e[1]),Xi(e[1])&&(t.defaultValue=e[1]),Xi(e[2])&&(t.tDescription=e[2]),"object"==typeof e[2]||"object"==typeof e[3]){const n=e[3]||e[2];Object.keys(n).forEach(e=>{t[e]=n[e]})}return t},interpolation:{escapeValue:!0,format:e=>e,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}),As=e=>(Xi(e.ns)&&(e.ns=[e.ns]),Xi(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),Xi(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&e.supportedLngs.indexOf("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),e),Fs=()=>{};class js extends vs{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;var n;if(super(),this.options=As(e),this.services={},this.logger=gs,this.modules={external:[]},n=this,Object.getOwnPropertyNames(Object.getPrototypeOf(n)).forEach(e=>{"function"==typeof n[e]&&(n[e]=n[e].bind(n))}),t&&!this.isInitialized&&!e.isClone){if(!this.options.initImmediate)return this.init(e,t),this;setTimeout(()=>{this.init(e,t)},0)}}init(){var e=this;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;this.isInitializing=!0,"function"==typeof t&&(n=t,t={}),!t.defaultNS&&!1!==t.defaultNS&&t.ns&&(Xi(t.ns)?t.defaultNS=t.ns:t.ns.indexOf("translation")<0&&(t.defaultNS=t.ns[0]));const r=Ds();this.options={...r,...this.options,...As(t)},"v1"!==this.options.compatibilityAPI&&(this.options.interpolation={...r.interpolation,...this.options.interpolation}),void 0!==t.keySeparator&&(this.options.userDefinedKeySeparator=t.keySeparator),void 0!==t.nsSeparator&&(this.options.userDefinedNsSeparator=t.nsSeparator);const o=e=>e?"function"==typeof e?new e:e:null;if(!this.options.isClone){let t;this.modules.logger?gs.init(o(this.modules.logger),this.options):gs.init(null,this.options),this.modules.formatter?t=this.modules.formatter:"undefined"!=typeof Intl&&(t=Ls);const n=new xs(this.options);this.store=new ms(this.options.resources,this.options);const i=this.services;i.logger=gs,i.resourceStore=this.store,i.languageUtils=n,i.pluralResolver=new Ts(n,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),!t||this.options.interpolation.format&&this.options.interpolation.format!==r.interpolation.format||(i.formatter=o(t),i.formatter.init(i,this.options),this.options.interpolation.format=i.formatter.format.bind(i.formatter)),i.interpolator=new Ms(this.options),i.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},i.backendConnector=new $s(o(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;o<n;o++)r[o-1]=arguments[o];e.emit(t,...r)}),this.modules.languageDetector&&(i.languageDetector=o(this.modules.languageDetector),i.languageDetector.init&&i.languageDetector.init(i,this.options.detection,this.options)),this.modules.i18nFormat&&(i.i18nFormat=o(this.modules.i18nFormat),i.i18nFormat.init&&i.i18nFormat.init(this)),this.translator=new ws(this.services,this.options),this.translator.on("*",function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];e.emit(t,...r)}),this.modules.external.forEach(e=>{e.init&&e.init(this)})}if(this.format=this.options.interpolation.format,n||(n=Fs),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const e=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);e.length>0&&"dev"!==e[0]&&(this.options.lng=e[0])}this.services.languageDetector||this.options.lng||this.logger.warn("init: no languageDetector is used and no lng is defined");["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(t=>{this[t]=function(){return e.store[t](...arguments)}});["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(t=>{this[t]=function(){return e.store[t](...arguments),e}});const i=Yi(),s=()=>{const e=(e,t)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),i.resolve(t),n(e,t)};if(this.languages&&"v1"!==this.options.compatibilityAPI&&!this.isInitialized)return e(null,this.t.bind(this));this.changeLanguage(this.options.lng,e)};return this.options.resources||!this.options.initImmediate?s():setTimeout(s,0),i}loadResources(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Fs;const n=Xi(e)?e:this.language;if("function"==typeof e&&(t=e),!this.options.resources||this.options.partialBundledLanguages){if(n&&"cimode"===n.toLowerCase()&&(!this.options.preload||0===this.options.preload.length))return t();const e=[],r=t=>{if(!t)return;if("cimode"===t)return;this.services.languageUtils.toResolveHierarchy(t).forEach(t=>{"cimode"!==t&&e.indexOf(t)<0&&e.push(t)})};if(n)r(n);else{this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(e=>r(e))}this.options.preload&&this.options.preload.forEach(e=>r(e)),this.services.backendConnector.load(e,this.options.ns,e=>{e||this.resolvedLanguage||!this.language||this.setResolvedLanguage(this.language),t(e)})}else t(null)}reloadResources(e,t,n){const r=Yi();return"function"==typeof e&&(n=e,e=void 0),"function"==typeof t&&(n=t,t=void 0),e||(e=this.languages),t||(t=this.options.ns),n||(n=Fs),this.services.backendConnector.reload(e,t,e=>{r.resolve(),n(e)}),r}use(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&&ys.addPostProcessor(e),"formatter"===e.type&&(this.modules.formatter=e),"3rdParty"===e.type&&this.modules.external.push(e),this}setResolvedLanguage(e){if(e&&this.languages&&!(["cimode","dev"].indexOf(e)>-1))for(let e=0;e<this.languages.length;e++){const t=this.languages[e];if(!(["cimode","dev"].indexOf(t)>-1)&&this.store.hasLanguageSomeTranslations(t)){this.resolvedLanguage=t;break}}}changeLanguage(e,t){var n=this;this.isLanguageChangingTo=e;const r=Yi();this.emit("languageChanging",e);const o=e=>{this.language=e,this.languages=this.services.languageUtils.toResolveHierarchy(e),this.resolvedLanguage=void 0,this.setResolvedLanguage(e)},i=(e,i)=>{i?(o(i),this.translator.changeLanguage(i),this.isLanguageChangingTo=void 0,this.emit("languageChanged",i),this.logger.log("languageChanged",i)):this.isLanguageChangingTo=void 0,r.resolve(function(){return n.t(...arguments)}),t&&t(e,function(){return n.t(...arguments)})},s=t=>{e||t||!this.services.languageDetector||(t=[]);const n=Xi(t)?t:this.services.languageUtils.getBestMatchFromCodes(t);n&&(this.language||o(n),this.translator.language||this.translator.changeLanguage(n),this.services.languageDetector&&this.services.languageDetector.cacheUserLanguage&&this.services.languageDetector.cacheUserLanguage(n)),this.loadResources(n,e=>{i(e,n)})};return e||!this.services.languageDetector||this.services.languageDetector.async?!e&&this.services.languageDetector&&this.services.languageDetector.async?0===this.services.languageDetector.detect.length?this.services.languageDetector.detect().then(s):this.services.languageDetector.detect(s):s(e):s(this.services.languageDetector.detect()),r}getFixedT(e,t,n){var r=this;const o=function(e,t){let i;if("object"!=typeof t){for(var s=arguments.length,a=new Array(s>2?s-2:0),l=2;l<s;l++)a[l-2]=arguments[l];i=r.options.overloadTranslationOptionHandler([e,t].concat(a))}else i={...t};i.lng=i.lng||o.lng,i.lngs=i.lngs||o.lngs,i.ns=i.ns||o.ns,""!==i.keyPrefix&&(i.keyPrefix=i.keyPrefix||n||o.keyPrefix);const u=r.options.keySeparator||".";let c;return c=i.keyPrefix&&Array.isArray(e)?e.map(e=>`${i.keyPrefix}${u}${e}`):i.keyPrefix?`${i.keyPrefix}${u}${e}`:e,r.t(c,i)};return Xi(e)?o.lng=e:o.lngs=e,o.ns=t,o.keyPrefix=n,o}t(){return this.translator&&this.translator.translate(...arguments)}exists(){return this.translator&&this.translator.exists(...arguments)}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e){let t=arguments.length>1&&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;const n=t.lng||this.resolvedLanguage||this.languages[0],r=!!this.options&&this.options.fallbackLng,o=this.languages[this.languages.length-1];if("cimode"===n.toLowerCase())return!0;const i=(e,t)=>{const n=this.services.backendConnector.state[`${e}|${t}`];return-1===n||0===n||2===n};if(t.precheck){const e=t.precheck(this,i);if(void 0!==e)return e}return!!this.hasResourceBundle(n,e)||(!(this.services.backendConnector.backend&&(!this.options.resources||this.options.partialBundledLanguages))||!(!i(n,e)||r&&!i(o,e)))}loadNamespaces(e,t){const n=Yi();return this.options.ns?(Xi(e)&&(e=[e]),e.forEach(e=>{this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}),this.loadResources(e=>{n.resolve(),t&&t(e)}),n):(t&&t(),Promise.resolve())}loadLanguages(e,t){const n=Yi();Xi(e)&&(e=[e]);const r=this.options.preload||[],o=e.filter(e=>r.indexOf(e)<0&&this.services.languageUtils.isSupportedCode(e));return o.length?(this.options.preload=r.concat(o),this.loadResources(e=>{n.resolve(),t&&t(e)}),n):(t&&t(),Promise.resolve())}dir(e){if(e||(e=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),!e)return"rtl";const t=this.services&&this.services.languageUtils||new xs(Ds());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","ckb"].indexOf(t.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(){return new js(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},arguments.length>1?arguments[1]:void 0)}cloneInstance(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Fs;const n=e.forkResourceStore;n&&delete e.forkResourceStore;const r={...this.options,...e,isClone:!0},o=new js(r);void 0===e.debug&&void 0===e.prefix||(o.logger=o.logger.clone(e));return["store","services","language"].forEach(e=>{o[e]=this[e]}),o.services={...this.services},o.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},n&&(o.store=new ms(this.store.data,r),o.services.resourceStore=o.store),o.translator=new ws(o.services,r),o.translator.on("*",function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];o.emit(e,...n)}),o.init(r,t),o.translator.options=r,o.translator.backendConnector.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},o}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const Is=js.createInstance();Is.createInstance=js.createInstance,Is.createInstance,Is.dir,Is.init,Is.loadResources,Is.reloadResources,Is.use,Is.changeLanguage,Is.getFixedT,Is.t,Is.exists,Is.setDefaultNamespace,Is.hasLoadedNamespace,Is.loadNamespaces,Is.loadLanguages;var Us="translation";function Bs(e){return Is.on("languageChanged",e),function(){return Is.off("languageChanged",e)}}Is.init({lng:"zh-CN",resources:{}});var Hs=Is.t.bind(Is);function zs(e){if(e.removeAttr){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&&zs(t)}}function Ws(){return a('<svg viewBox="0 0 1024 1024"><path d="M498.7 655.8l-197.6-268c-8.1-10.9-0.3-26.4 13.3-26.4h395.2c13.6 0 21.4 15.4 13.3 26.4l-197.6 268c-6.6 9-20 9-26.6 0z"></path></svg>')}function Vs(){return a('<div class="w-e-bar-divider"></div>')}function qs(e,t,n,r,o){if(void 0===r&&(r=""),void 0===o&&(o=!1),t){if(r){var i=wo?"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 s=r?"".concat(n,"\n").concat(r):n;e.attr("data-tooltip",s),e.addClass("w-e-menu-tooltip-v5")}}}var Ks=function(){function e(e,t,n){void 0===n&&(n=!1);var r=this;this.$elem=a('<div class="w-e-bar-item"></div>'),this.$button=a('<button type="button"></button>'),this.disabled=!1,this.menu=t;var o=t.tag,i=t.width;if("button"!==o)throw new Error("Invalid tag '".concat(o,"', expected 'button'"));var s=t.title,l=t.hotkey,u=void 0===l?"":l,c=t.iconSvg,d=void 0===c?"":c,h=this.$button;if(d){var p=a(d);zs(p),h.append(p)}else h.text(s);qs(h,d,s,u,n),n&&d&&h.append(a('<span class="title">'.concat(s,"</span>"))),i&&h.css("width","".concat(i,"px")),h.attr("data-menu-key",e),this.$elem.append(h),mn(function(){return r.init()})}return e.prototype.init=function(){var e=this;this.setActive(),this.setDisabled(),this.$button.on("click",function(t){t.preventDefault(),oa(e).hidePanelOrModal(),e.disabled||(e.exec(),e.onButtonClick())})},e.prototype.exec=function(){var e=oa(this),t=this.menu,n=t.getValue(e);t.exec(e,n),this.changeMenuState()},e.prototype.setActive=function(){var e=oa(this),t=this.$button,n="active";this.menu.isActive(e)?t.addClass(n):t.removeClass(n)},e.prototype.setDisabled=function(){var e=oa(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.setIcon=function(){var e=oa(this),t=this.$button;if(this.menu.getIcon){var n=this.menu.getIcon(e);if(n){t.find("svg").remove();var r=a(n);zs(r),t.append(r)}}},e.prototype.setTooltip=function(){var e=oa(this),t=this.$button;if(this.menu.getTitle){var n=this.menu.getTitle(e),r=this.menu.iconSvg;n&&r&&qs(t,r,n)}},e.prototype.changeMenuState=function(){this.setActive(),this.setDisabled(),this.setIcon(),this.setTooltip()},e}(),Js=function(e){function t(t,n,r){return void 0===r&&(r=!1),e.call(this,t,n,r)||this}return g(t,e),t.prototype.onButtonClick=function(){},t}(Ks),Gs=function(){function e(e){this.isShow=!1,this.showTime=0,this.record(e)}return e.prototype.record=function(e){var t=Jn.get(e);null==t&&(t=new Set,Jn.set(e,t)),t.add(this),Gn.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=Gn.get(this);e&&e.emit(jn,this)}},e.prototype.hide=function(){if(this.isShow&&!(Date.now()-this.showTime<200)){this.$elem.hide(),this.isShow=!1;var e=Gn.get(this);e&&e.emit(In)}},e}(),Xs=function(e){function t(t){var n=e.call(this,t)||this;return n.type="dropPanel",n.$elem=a('<div class="w-e-drop-panel"></div>'),n}return g(t,e),t.prototype.genSelfElem=function(){return null},t}(Gs),Ys=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=Ws();o.$button.append(i)}return o}return g(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=oa(this);if(null==this.dropPanel){var n=new Xs(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 s=this.$elem,a=s.offset().left,l=s.parents(".w-e-bar");a-l.offset().left>=l.width()/2?i.$elem.css({left:"none",right:"0"}):i.$elem.css({left:"0",right:"none"})}}},t}(Ks),Qs=function(e){function t(t,n){void 0===n&&(n=0);var r=e.call(this,t)||this;r.type="modal",r.$elem=a('<div class="w-e-modal"></div>'),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 g(t,e),t.prototype.genSelfElem=function(){var e=this,t=a('<span class="btn-close">'.concat('<svg viewBox="0 0 1024 1024"><path d="M1024 896.1024l-128 128L512 640 128 1024 0 896 384 512 0 128 128 0 512 384 896.1024 0l128 128L640 512z"></path></svg>',"</span>")),n=Gn.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","".concat(t,"px")),n.css(e)},t}(Gs);var Zs=function(e){function t(t,n,r){void 0===r&&(r=!1);var o=e.call(this,t,n,r)||this;return o.$body=a("body"),o.modal=null,o.menu=n,o}return g(t,e),t.prototype.onButtonClick=function(){this.menu.showModal&&this.handleModal()},t.prototype.getPosition=function(){var e=oa(this),t=this.menu.getModalPositionNode(e);return i.Element.isElement(t)?Ki(e,t,"modal"):qi(e)},t.prototype.handleModal=function(){var e=oa(this),t=this.menu;if(null==this.modal){var n=new Qs(e,t.modalWidth);this.renderAndShowModal(n,!0),this.modal=n}else{(n=this.modal).isShow?n.hide():this.renderAndShowModal(n,!1)}},t.prototype.renderAndShowModal=function(e,t){void 0===t&&(t=!1);var n=oa(this),r=this.menu;if(null!=r.getModalContentElem){var o=No.getTextarea(n),i=No.getToolbar(n),s=((null==i?void 0:i.getConfig())||{}).modalAppendToBody,a=r.getModalContentElem(n);if(e.renderContent(a),s)e.setStyle({left:"0",right:"0"});else{var l=this.getPosition();e.setStyle(l)}t&&(s?e.appendTo(this.$body):e.appendTo(o.$textAreaContainer)),e.show(),s||Ji(n,e.$elem),setTimeout(function(){n.blur()})}},t}(Ks);var ea=function(e){function t(t,n){var r=e.call(this,t)||this;return r.type="selectList",r.$elem=a('<div class="w-e-select-list"></div>'),n&&r.$elem.css("width","".concat(n,"px")),r.$elem.on("click",function(e){e.stopPropagation()}),r}return g(t,e),t.prototype.renderList=function(e){var t=this.$elem;t.empty();var n=a("<ul></ul>");e.forEach(function(e){var t=e.value,r=e.text,o=e.selected,i=e.styleForRenderMenuList,s=a('<li data-value="'.concat(t,'"></li>'));if(i&&s.css(i),o){var l=a('<svg viewBox="0 0 1446 1024"><path d="M574.116299 786.736392 1238.811249 48.517862C1272.390222 11.224635 1329.414799 7.827718 1366.75664 41.450462 1403.840015 74.840484 1406.731043 132.084741 1373.10189 169.433699L655.118888 966.834607C653.072421 969.716875 650.835807 972.514337 648.407938 975.210759 615.017957 1012.29409 558.292155 1015.652019 521.195664 982.250188L72.778218 578.493306C35.910826 545.297758 32.859041 488.584019 66.481825 451.242134 99.871807 414.158803 156.597563 410.800834 193.694055 444.202665L574.116299 786.736392Z"></path></svg>');s.append(l),s.addClass("selected")}s.append(a('<span data-value="'.concat(t,'">').concat(r,"</span>"))),s.attr("title",r),n.append(s)}),t.append(n)},t.prototype.genSelfElem=function(){return null},t}(Gs);var ta=function(){function e(e,t,n){void 0===n&&(n=!1);var r=this;this.$elem=a('<div class="w-e-bar-item"></div>'),this.$button=a('<button type="button" class="select-button"></button>'),this.disabled=!1,this.selectList=null;var o=t.tag,i=t.title,s=t.width,l=t.iconSvg,u=void 0===l?"":l,c=t.hotkey,d=void 0===c?"":c;if("select"!==o)throw new Error("Invalid tag '".concat(o,"', expected 'select'"));var h=this.$button;s&&h.css("width","".concat(s,"px")),h.attr("data-menu-key",e),qs(h,u,i,d,n),this.$elem.append(h),this.menu=t,mn(function(){return r.init()})}return e.prototype.init=function(){var e=this;this.setSelectedValue(),this.$button.on("click",function(t){t.preventDefault(),oa(e).hidePanelOrModal(),e.trigger()})},e.prototype.trigger=function(){var e=this,t=oa(this);if(!t.isDisabled()&&!this.disabled){var n=this.menu;if(null==this.selectList){this.selectList=new ea(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=a(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=oa(this),n=this.menu;n.exec&&n.exec(t,e)},e.prototype.setSelectedValue=function(){var e=oa(this),t=this.menu,n=t.getValue(e),r=function(e,t){for(var n=e.length,r="",o=0;o<n;o++){var i=e[o];if(i.value===t){r=i.text;break}}return r}(t.getOptions(e),n.toString()),o=this.$button,i=Ws();o.empty(),o.text(r),o.append(i)},e.prototype.setDisabled=function(){var e=oa(this),t=this.menu.isDisabled(e),n=this.$button;(null==e.selection||e.isDisabled())&&(t=!0);var r="disabled";t?n.addClass(r):n.removeClass(r),this.disabled=t},e.prototype.changeMenuState=function(){this.setSelectedValue(),this.setDisabled()},e}(),na=function(){function e(e){this.$elem=a('<div class="w-e-bar-item w-e-bar-item-group"></div>'),this.$container=a('<div class="w-e-bar-item-menus-container"></div>'),this.$button=a('<button type="button"></button>');var t=e.key,n=e.iconSvg,r=e.title,o=this.$elem,i=this.$button;if(n){var s=a(n);zs(s),i.append(s)}else i.text(r);i.attr("data-menu-key",t);var l=Ws();i.append(l),o.append(i);var u=this.$container;o.append(u);var c=this.createObserver();this.observe(c)}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 s=0;o.each(function(e){a(e).hasClass("disabled")&&s++}),r.disconnect(),s===i?n.addClass("disabled"):n.removeClass("disabled"),e.observe(r)}});return r},e}(),ra=new WeakMap;function oa(e){var t=Kn.get(e);if(null==t)throw new Error("Can not get editor instance");return t}function ia(e,t,n){void 0===n&&(n=!1);var r=ra.get(t);if(r)return r;var o=t.tag;if("button"===o){var i=t.showDropPanel,s=t.showModal;r=i?new Ys(e,t,n):s?new Zs(e,t,n):new Js(e,t,n)}if("select"===o&&(r=new ta(e,t,n)),null==r)throw new Error("Invalid tag in menu ".concat(JSON.stringify(t)));return ra.set(t,r),r}function sa(e,t){var n=e.selection;return null!=n&&(!i.Range.isCollapsed(n)&&(!No.getSelectedElems(e).some(function(t){if(e.isVoid(t))return!0;var n=t.type;return!!["pre","code","table"].includes(n)})&&!!i.Text.isText(t)))}var aa=function(){function e(){var e=this;this.$elem=a('<div class="w-e-bar w-e-bar-hidden w-e-hover-bar"></div>'),this.menus={},this.hoverbarItems=[],this.prevSelectedNode=null,this.isShow=!1,this.lngListen=function(){},this.changeHoverbarState=u(function(){var t=e.isShow,n=e.getSelectedNodeAndMenuKeys()||{},r=n.node,o=void 0===r?null:r,s=n.menuKeys,a=void 0===s?[]:s,l=e.getEditorInstance();if(null!=o&&e.changeItemsState(),o&&i.Element.isElement(o)&&t){var u=e.isSamePath(o,e.prevSelectedNode);if(!i.Editor.isBlock(l,o)&&u)return}e.hideAndClean(),null!=o&&(e.registerItems(a),e.setPosition(o),e.show()),e.prevSelectedNode=o},200),mn(function(){var t=e.getEditorInstance(),n=e.$elem;n.on("mousedown",function(e){return e.preventDefault()},{passive:!1}),No.getTextarea(t).$textAreaContainer.append(n),t.on($n,e.changeHoverbarState);var r=e.hideAndClean.bind(e);t.on(Dn,r),t.on(An,r),t.on(Fn,r)}),this.lngListen=Bs(function(){e.menus={},e.hideAndClean(),e.getEditorInstance().deselect()})}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="undefined"!=typeof window?window.innerHeight:null;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;mn(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=Vs();n.append(r)}})},e.prototype.registerSingleItem=function(e){var t=this.getEditorInstance(),n=this.menus,r=n[e];if(null==r){var o=Un[e];if(null==o)throw new Error("Not found menu item factory by key '".concat(e,"'"));if("function"!=typeof o)throw new Error("Menu item factory (key='".concat(e,"') is not a function"));r=o(),n[e]=r}var i=t.getMenuConfig(e);i&&void 0!==i.iconSvg&&(r.iconSvg=i.iconSvg);var s=ia(e,r);this.hoverbarItems.push(s),Kn.set(s,t),this.$elem.append(s.$elem)},e.prototype.setPosition=function(e){var t=this.getEditorInstance(),n=this.$elem;if(n.attr("style",""),i.Element.isElement(e)){var r=Ki(t,e,"bar");return n.css(r),void Ji(t,n)}if(i.Text.isText(e)){r=qi(t);return n.css(r),void Ji(t,n)}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 t=this.getHoverbarKeysConf(),n=null,r=[],o=function(o){var s=t[o],a=s.match,l=s.menuKeys,u=void 0===l?[]:l,c=a||function(e,t){return No.checkNodeType(t,o)},d=y(i.Editor.nodes(e,{match:function(t){return c(e,t)},universal:!0}),1),h=d[0];if(null!=h)return n=h[0],r=u,"break"};for(var s in t){if("break"===o(s))break}return null==n||0===r.length?null:{node:n,menuKeys:r}},e.prototype.getEditorInstance=function(){var e=Vn.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=sa),t},e.prototype.isSamePath=function(e,t){if(null==e||null==t)return!1;var n=No.findPath(null,e),r=No.findPath(null,t);return i.Path.equals(n,r)},e.prototype.destroy=function(){var e;this.changeHoverbarState.cancel(),this.$elem.remove(),null===(e=this.lngListen)||void 0===e||e.call(this),this.menus={},this.hoverbarItems=[],this.prevSelectedNode=null},e}();function la(e,t){return $r(t)&&No.hasDOMNode(e,t,{editable:!0})}function ua(e,t){return $r(t)&&No.hasDOMNode(e,t)}function ca(e,t){if(la(e,t))return!0;if(!ua(e,t))return!1;var n=null;return Ar(t)?n=t:jr(t)&&(n=t.parentElement),!!(null==n?void 0:n.closest("[data-w-e-reserve]"))||function(e,t){if(e.getConfig().readOnly)return!1;var n=ua(e,t)&&No.toSlateNode(e,t);return!!n&&i.Element.isElement(n)&&i.Editor.isVoid(e,n)}(e,t)}const da=e=>"object"==typeof e&&null!=e&&1===e.nodeType,ha=(e,t)=>(!t||"hidden"!==e)&&"visible"!==e&&"clip"!==e,pa=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){const n=getComputedStyle(e,null);return ha(n.overflowY,t)||ha(n.overflowX,t)||(e=>{const t=(e=>{if(!e.ownerDocument||!e.ownerDocument.defaultView)return null;try{return e.ownerDocument.defaultView.frameElement}catch(e){return null}})(e);return!!t&&(t.clientHeight<e.scrollHeight||t.clientWidth<e.scrollWidth)})(e)}return!1},fa=(e,t,n,r,o,i,s,a)=>i<e&&s>t||i>e&&s<t?0:i<=e&&a<=n||s>=t&&a>=n?i-e-r:s>t&&a<n||i<e&&a>n?s-t+o:0,ga=e=>{const t=e.parentElement;return null==t?e.getRootNode().host||null:t},va=(e,t)=>{var n,r,o,i;if("undefined"==typeof document)return[];const{scrollMode:s,block:a,inline:l,boundary:u,skipOverflowHiddenElements:c}=t,d="function"==typeof u?u:e=>e!==u;if(!da(e))throw new TypeError("Invalid target");const h=document.scrollingElement||document.documentElement,p=[];let f=e;for(;da(f)&&d(f);){if(f=ga(f),f===h){p.push(f);break}null!=f&&f===document.body&&pa(f)&&!pa(document.documentElement)||null!=f&&pa(f,c)&&p.push(f)}const g=null!=(r=null==(n=window.visualViewport)?void 0:n.width)?r:innerWidth,v=null!=(i=null==(o=window.visualViewport)?void 0:o.height)?i:innerHeight,{scrollX:m,scrollY:y}=window,{height:b,width:w,top:E,right:x,bottom:S,left:_}=e.getBoundingClientRect(),{top:O,right:k,bottom:C,left:T}=(e=>{const t=window.getComputedStyle(e);return{top:parseFloat(t.scrollMarginTop)||0,right:parseFloat(t.scrollMarginRight)||0,bottom:parseFloat(t.scrollMarginBottom)||0,left:parseFloat(t.scrollMarginLeft)||0}})(e);let N="start"===a||"nearest"===a?E-O:"end"===a?S+C:E+b/2-O+C,P="center"===l?_+w/2-T+k:"end"===l?x+k:_-T;const M=[];for(let e=0;e<p.length;e++){const t=p[e],{height:n,width:r,top:o,right:i,bottom:u,left:c}=t.getBoundingClientRect();if("if-needed"===s&&E>=0&&_>=0&&S<=v&&x<=g&&(t===h&&!pa(t)||E>=o&&S<=u&&_>=c&&x<=i))return M;const d=getComputedStyle(t),f=parseInt(d.borderLeftWidth,10),O=parseInt(d.borderTopWidth,10),k=parseInt(d.borderRightWidth,10),C=parseInt(d.borderBottomWidth,10);let T=0,R=0;const L="offsetWidth"in t?t.offsetWidth-t.clientWidth-f-k:0,$="offsetHeight"in t?t.offsetHeight-t.clientHeight-O-C:0,D="offsetWidth"in t?0===t.offsetWidth?0:r/t.offsetWidth:0,A="offsetHeight"in t?0===t.offsetHeight?0:n/t.offsetHeight:0;if(h===t)T="start"===a?N:"end"===a?N-v:"nearest"===a?fa(y,y+v,v,O,C,y+N,y+N+b,b):N-v/2,R="start"===l?P:"center"===l?P-g/2:"end"===l?P-g:fa(m,m+g,g,f,k,m+P,m+P+w,w),T=Math.max(0,T+y),R=Math.max(0,R+m);else{T="start"===a?N-o-O:"end"===a?N-u+C+$:"nearest"===a?fa(o,u,n,O,C+$,N,N+b,b):N-(o+n/2)+$/2,R="start"===l?P-c-f:"center"===l?P-(c+r/2)+L/2:"end"===l?P-i+k+L:fa(c,i,r,f,k+L,P,P+w,w);const{scrollLeft:e,scrollTop:s}=t;T=0===A?0:Math.max(0,Math.min(s+T/A,t.scrollHeight-n/A+$)),R=0===D?0:Math.max(0,Math.min(e+R/D,t.scrollWidth-r/D+L)),N+=s-T,P+=e-R}M.push({el:t,top:T,left:R})}return M};function ma(e,t){if(!e.isConnected||!(e=>{let t=e;for(;t&&t.parentNode;){if(t.parentNode===document)return!0;t=t.parentNode instanceof ShadowRoot?t.parentNode.host:t.parentNode}return!1})(e))return;const n=(e=>{const t=window.getComputedStyle(e);return{top:parseFloat(t.scrollMarginTop)||0,right:parseFloat(t.scrollMarginRight)||0,bottom:parseFloat(t.scrollMarginBottom)||0,left:parseFloat(t.scrollMarginLeft)||0}})(e);if((e=>"object"==typeof e&&"function"==typeof e.behavior)(t))return t.behavior(va(e,t));const r="boolean"==typeof t||null==t?void 0:t.behavior;for(const{el:o,top:i,left:s}of va(e,(e=>!1===e?{block:"end",inline:"nearest"}:(e=>e===Object(e)&&0!==Object.keys(e).length)(e)?e:{block:"start",inline:"nearest"})(t))){const e=i-n.top+n.bottom,t=s-n.left+n.right;o.scroll({top:e,left:t,behavior:r})}}function ya(e){null!=e.selection&&(e.selection=null,e.onChange())}function ba(e,t,n){void 0===n&&(n=!1);var r=t.selection,o=t.getConfig(),s=No.findDocumentOrShadowRoot(t).getSelection();if(s&&(!e.isComposing||n)&&t.isFocused()){var a="None"!==s.type;if(r||a){var l=or.get(t),u=!1;if(l.contains(s.anchorNode)&&l.contains(s.focusNode)&&(u=!0),a&&u&&r){var c=No.toSlateRange(t,s,{exactMatch:!0,suppressThrow:!0});if(c&&i.Range.equals(c,r)){var d=!0;if(i.Range.isCollapsed(r)){var h=s.anchorNode,p=s.anchorOffset;if(h===l){var f=l.childNodes,g=void 0;(g=f[p])&&g.matches("table")&&(d=!1),(g=f[p-1])&&g.matches("table")&&(d=!1)}}if(d)return}}if(!r||No.hasRange(t,r)){e.isUpdatingSelection=!0;var v=null;try{v=r&&No.toDOMRange(t,r)}catch(e){v=null}if(v){i.Range.isBackward(r)?s.setBaseAndExtent(v.endContainer,v.endOffset,v.startContainer,v.startOffset):s.setBaseAndExtent(v.startContainer,v.startOffset,v.endContainer,v.endOffset);var m=v.startContainer.parentElement;if(!m.closest("[data-slate-spacer]")&&v.getBoundingClientRect){var y=v.getBoundingClientRect.bind(v)();0===y.top&&0===y.right&&0===y.bottom&&0===y.left&&0===y.height&&0===y.width||(m.getBoundingClientRect=v.getBoundingClientRect.bind(v));var b=document.body;if(ma(m,{scrollMode:"if-needed",boundary:o.scroll&&l.parentElement||b,block:"end",behavior:"auto"}),o.scroll){var w=l.parentElement;if(w){var E=function(){var e=v.getBoundingClientRect(),t=w.getBoundingClientRect(),n=e.bottom-t.bottom,r=t.top-e.top;n>0?w.scrollTop+=n+1:r>0&&(w.scrollTop-=r+1)};E(),requestAnimationFrame(E)}}delete m.getBoundingClientRect}}else s.removeAllRanges();setTimeout(function(){v&&Eo&&l.focus(),e.isUpdatingSelection=!1})}else t.selection=No.toSlateRange(t,s,{exactMatch:!1,suppressThrow:!0})}}}var wa=new WeakMap,Ea=new WeakMap;function xa(e){var t;try{t=No.findDocumentOrShadowRoot(e)}catch(e){return null}var n=t.getSelection();if(!n||n.rangeCount<=0)return null;try{return n.getRangeAt(0).startContainer}catch(e){return null}}var Sa={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"},_a={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"},Oa={deleteWordBackward:"ctrl+shift?+backspace",deleteWordForward:"ctrl+shift?+delete",redo:["ctrl+y","ctrl+shift+z"]},ka=function(e){var t=Sa[e],n=_a[e],r=Oa[e],o=t&&c.isKeyHotkey(t),i=n&&c.isKeyHotkey(n),s=r&&c.isKeyHotkey(r);return function(e){return!(!o||!o(e))||(!!(wo&&i&&i(e))||!(wo||!s||!s(e)))}},Ca={isBold:ka("bold"),isCompose:ka("compose"),isMoveBackward:ka("moveBackward"),isMoveForward:ka("moveForward"),isDeleteBackward:ka("deleteBackward"),isDeleteForward:ka("deleteForward"),isDeleteLineBackward:ka("deleteLineBackward"),isDeleteLineForward:ka("deleteLineForward"),isDeleteWordBackward:ka("deleteWordBackward"),isDeleteWordForward:ka("deleteWordForward"),isExtendBackward:ka("extendBackward"),isExtendForward:ka("extendForward"),isExtendLineBackward:ka("extendLineBackward"),isExtendLineForward:ka("extendLineForward"),isItalic:ka("italic"),isMoveLineBackward:ka("moveLineBackward"),isMoveLineForward:ka("moveLineForward"),isMoveWordBackward:ka("moveWordBackward"),isMoveWordForward:ka("moveWordForward"),isRedo:ka("redo"),isSplitBlock:ka("splitBlock"),isTransposeCharacter:ka("transposeCharacter"),isUndo:ka("undo"),isTab:ka("tab"),isSelectAll:ka("selectAll")};function Ta(e){e.preventDefault()}var Na={beforeinput:function(e,t,n){var r,o=e,s=n.getConfig().readOnly;if(ko&&!s&&la(n,o.target)){null===(r=t.flushDOMSelectionChange)||void 0===r||r.call(t);var a=n.selection,l=o.inputType,u=o.dataTransfer||o.data||void 0;if("insertCompositionText"!==l&&"deleteCompositionText"!==l){if(o.preventDefault(),!l.startsWith("delete")||l.startsWith("deleteBy")){var c=y(o.getTargetRanges(),1)[0];if(c){var d=No.toSlateRange(n,c,{exactMatch:!1,suppressThrow:!1});a&&i.Range.equals(a,d)||i.Transforms.select(n,d)}}if(a&&i.Range.isExpanded(a)){var h=No.getSelectedElems(n),p="table"===h[0].type,f="table-cell"!==h[h.length-1].type;if(p&&f)return;if(l.startsWith("delete")){var g=l.endsWith("Backward")?"backward":"forward";return void i.Editor.deleteFragment(n,{direction:g})}}switch(l){case"deleteByComposition":case"deleteByCut":case"deleteByDrag":i.Editor.deleteFragment(n);break;case"deleteContent":case"deleteContentForward":i.Editor.deleteForward(n);break;case"deleteContentBackward":i.Editor.deleteBackward(n);break;case"deleteEntireSoftLine":i.Editor.deleteBackward(n,{unit:"line"}),i.Editor.deleteForward(n,{unit:"line"});break;case"deleteHardLineBackward":i.Editor.deleteBackward(n,{unit:"block"});break;case"deleteSoftLineBackward":i.Editor.deleteBackward(n,{unit:"line"});break;case"deleteHardLineForward":i.Editor.deleteForward(n,{unit:"block"});break;case"deleteSoftLineForward":i.Editor.deleteForward(n,{unit:"line"});break;case"deleteWordBackward":i.Editor.deleteBackward(n,{unit:"word"});break;case"deleteWordForward":i.Editor.deleteForward(n,{unit:"word"});break;case"insertLineBreak":i.Editor.insertText(n,"\n");break;case"insertParagraph":i.Editor.insertBreak(n);break;case"insertFromDrop":case"insertFromComposition":case"insertFromPaste":case"insertFromYank":case"insertReplacementText":case"insertText":if("insertFromComposition"===l&&(t.isComposing=!1,fr.set(n,!0)),"insertFromPaste"===l&&!pr.get(n))break;Nr(u)?n.insertData(u):"string"==typeof u&&i.Editor.insertText(n,u)}}}},blur:function(e,t,n){var r=e,o=t.isUpdatingSelection,s=t.latestElement;if(!n.getConfig().readOnly&&!o&&la(n,r.target)){var a=No.findDocumentOrShadowRoot(n);if(s!==a.activeElement){var l=r.relatedTarget;if(!(l===No.toDOMNode(n,n)||Ar(l)&&l.hasAttribute("data-slate-spacer"))){if(null!=l&&$r(l)&&No.hasDOMNode(n,l)){var u=No.toSlateNode(n,l);if(i.Element.isElement(u)&&!n.isVoid(u))return}if(xo){var c=a.getSelection();null==c||c.removeAllRanges()}cr.delete(n)}}}},focus:function(e,t,n){var r=No.toDOMNode(n,n),o=No.findDocumentOrShadowRoot(n);t.latestElement=o.activeElement,Eo&&e.target!==r?r.focus():cr.set(n,!0)},click:function(e,t,n){if(!n.getConfig().readOnly&&ua(n,e.target)&&$r(e.target)){var r=No.toSlateNode(n,e.target),o=No.findPath(n,r);if(i.Editor.hasPath(n,o))if(i.Node.get(n,o)===r){var s=i.Editor.start(n,o),a=i.Editor.end(n,o),l=i.Editor.void(n,{at:s}),u=i.Editor.void(n,{at:a});if(l&&u&&i.Path.equals(l[1],u[1])){var c=i.Editor.range(n,s);i.Transforms.select(n,c)}}}},compositionstart:function(e,t,n){if(la(n,e.target)){gr.delete(n);var r=n.selection;if(r&&i.Range.isCollapsed(r)){var o=xa(n);if(o){var s=o.textContent||"";wa.set(n,s),Ea.set(n,o)}}r&&i.Range.isExpanded(r)&&(i.Editor.deleteFragment(n),Promise.resolve().then(function(){ba(t,n,!0)})),t.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)}(t,n)}},compositionend:function(e,t,n){var r=e;if(la(n,r.target)){t.isComposing=!1;var o=!0===fr.get(n);o?(fr.delete(n),gr.delete(n)):gr.delete(n);var s=n.selection;if(null!=s){(Oo||Eo)&&No.cleanExposedTexNodeInSelectionBlock(n);for(var a=i.Range.isBackward(s)?s.focus:s.anchor,l=y(i.Editor.node(n,[a.path[0]]),1)[0],u=0;u<a.path.length;u+=1){var c=y(i.Editor.node(n,a.path.slice(0,u+1)),1)[0];if(i.Element.isElement(c)&&((xo||Eo)&&"link"===c.type||"code"===c.type)){No.setNewKey(l);break}}var d=r.data;if(d&&!o){if(n.getConfig().maxLength){var h=No.getLeftLengthOfMaxLength(n);if(h<d.length){var p=xa(n);p&&p.nodeType===Node.TEXT_NODE&&(p.textContent=wa.get(n)||""),h>0&&i.Editor.insertText(n,d.slice(0,h)),t.changeViewState()}else i.Editor.insertText(n,d)}else{var f=No.findDocumentOrShadowRoot(n).getSelection();if(f&&function(e,t){if(i.Range.isCollapsed(t)){var n=t.anchor,r=t.focus;if([2,3].includes(n.path.length)&&[2,3].includes(r.path.length)&&(0===n.offset||0===r.offset)){var o=i.Editor.node(e,n.path),s=0===n.offset?n.path:r.path,a=[s[0],s[1]-1];if(0===s[1])return!1;var l=i.Editor.node(e,a);if(i.Text.isText(l[0])&&i.Text.isText(o[0]))return!0}}}(n,s)){var g=No.toSlateRange(n,f,{exactMatch:!1,suppressThrow:!1});g&&(n.selection=g)}i.Editor.insertText(n,d)}xo||setTimeout(function(){if(null!=n.selection){var e=Ea.get(n);if(null!=e&&e.nodeType===Node.TEXT_NODE){var t=xa(n);null!=t&&t.nodeType===Node.TEXT_NODE&&t!==e&&(e.textContent=wa.get(n)||"")}}})}}}},compositionupdate:function(e,t,n){la(n,e.target)&&(t.isComposing=!0)},keydown:function(e,t,n){var r=e,o=n.selection;if(!n.getConfig().readOnly&&!t.isComposing&&la(n,r.target)){if(function(e,t){var n,r,o=Wn.get(e),i=o&&o.getMenus(),s=qn.get(e),a=s&&s.getMenus(),l=v(v({},i),a);try{for(var u=m(Object.keys(l)),d=u.next();!d.done;d=u.next()){var h=l[d.value],p=h.hotkey;if(p&&c.isHotkey(p,t)&&!h.isDisabled(e)){var f=h.getValue(e);h.exec(e,f)}}}catch(e){n={error:e}}finally{try{d&&!d.done&&(r=u.return)&&r.call(u)}finally{if(n)throw n.error}}}(n,r),Ca.isTab(r))return Ta(r),void n.handleTab();if(Ca.isRedo(r))return Ta(r),void("function"==typeof n.redo&&n.redo());if(Ca.isUndo(r))return Ta(r),void("function"==typeof n.undo&&n.undo());if(Ca.isMoveLineBackward(r))return Ta(r),void i.Transforms.move(n,{unit:"line",reverse:!0});if(Ca.isMoveLineForward(r))return Ta(r),void i.Transforms.move(n,{unit:"line"});if(Ca.isExtendLineBackward(r))return Ta(r),void i.Transforms.move(n,{unit:"line",edge:"focus",reverse:!0});if(Ca.isExtendLineForward(r))return Ta(r),void i.Transforms.move(n,{unit:"line",edge:"focus"});if(Ca.isMoveBackward(r))return Ta(r),void(o&&i.Range.isCollapsed(o)?i.Transforms.move(n,{reverse:!0}):i.Transforms.collapse(n,{edge:"start"}));if(Ca.isMoveForward(r))return Ta(r),void(o&&i.Range.isCollapsed(o)?i.Transforms.move(n):i.Transforms.collapse(n,{edge:"end"}));if(Ca.isMoveWordBackward(r))return Ta(r),o&&i.Range.isExpanded(o)&&i.Transforms.collapse(n,{edge:"focus"}),void i.Transforms.move(n,{unit:"word",reverse:!0});if(Ca.isMoveWordForward(r))return Ta(r),o&&i.Range.isExpanded(o)&&i.Transforms.collapse(n,{edge:"focus"}),void i.Transforms.move(n,{unit:"word"});if(Ca.isSelectAll(r))return Ta(r),void n.selectAll();if(ko){if((Oo||xo)&&o&&(Ca.isDeleteBackward(r)||Ca.isDeleteForward(r))&&i.Range.isCollapsed(o)){var s=i.Node.parent(n,o.anchor.path);i.Element.isElement(s)&&i.Editor.isVoid(n,s)&&i.Editor.isInline(n,s)&&(r.preventDefault(),i.Transforms.delete(n,{unit:"block"}))}}else{if(Ca.isBold(r)||Ca.isItalic(r)||Ca.isTransposeCharacter(r))return void Ta(r);if(Ca.isSplitBlock(r))return Ta(r),void(r.shiftKey?i.Editor.insertText(n,"\n"):i.Editor.insertBreak(n));if(Ca.isDeleteBackward(r))return Ta(r),void(o&&i.Range.isExpanded(o)?i.Editor.deleteFragment(n,{direction:"backward"}):i.Editor.deleteBackward(n));if(Ca.isDeleteForward(r))return Ta(r),void(o&&i.Range.isExpanded(o)?i.Editor.deleteFragment(n,{direction:"forward"}):i.Editor.deleteForward(n));if(Ca.isDeleteLineBackward(r))return Ta(r),void(o&&i.Range.isExpanded(o)?i.Editor.deleteFragment(n,{direction:"backward"}):i.Editor.deleteBackward(n,{unit:"line"}));if(Ca.isDeleteLineForward(r))return Ta(r),void(o&&i.Range.isExpanded(o)?i.Editor.deleteFragment(n,{direction:"forward"}):i.Editor.deleteForward(n,{unit:"line"}));if(Ca.isDeleteWordBackward(r))return Ta(r),void(o&&i.Range.isExpanded(o)?i.Editor.deleteFragment(n,{direction:"backward"}):i.Editor.deleteBackward(n,{unit:"word"}));Ca.isDeleteWordForward(r)&&(Ta(r),o&&i.Range.isExpanded(o)?i.Editor.deleteFragment(n,{direction:"forward"}):i.Editor.deleteForward(n,{unit:"word"}))}}},keypress:function(e,t,n){if(!ko&&!n.getConfig().readOnly&&la(n,e.target)){e.preventDefault();var r=e.key;i.Editor.insertText(n,r)}},copy:function(e,t,n){var r=e;if(la(n,r.target)){n.getConfig().readOnly||r.preventDefault();var o=r.clipboardData;if(null!=o){n.setFragmentData(o);var i=n.getConfig().customCopy;i&&i(n,r)}}},cut:function(e,t,n){var r=e,o=n.selection;if(!n.getConfig().readOnly&&(r.preventDefault(),la(n,r.target))){var s=r.clipboardData;if(null!=s&&(n.setFragmentData(s),o))if(i.Range.isExpanded(o))i.Editor.deleteFragment(n);else{var a=i.Node.parent(n,o.anchor.path);i.Element.isElement(a)&&i.Editor.isVoid(n,a)&&i.Transforms.delete(n)}}},paste:function(e,t,n){pr.set(n,!0);var r=e;if(!n.getConfig().readOnly&&la(n,r.target)){var o=n.getConfig().customPaste;if(o)if(!1===o(n,r))return pr.set(n,!1),void r.preventDefault();if(xo||!ko||Ir(r)){r.preventDefault();var i=r.clipboardData;null!=i&&n.insertData(i)}}},dragover:function(e,t,n){if(ua(n,e.target)){var r=No.toSlateNode(n,e.target);i.Element.isElement(r)&&i.Editor.isVoid(n,r)&&e.preventDefault()}},dragstart:function(e,t,n){var r=e;if(ua(n,r.target)&&!n.getConfig().readOnly){var o=No.toSlateNode(n,r.target),s=No.findPath(n,o);if(i.Element.isElement(o)&&i.Editor.isVoid(n,o)||i.Editor.void(n,{at:s,voids:!0})){var a=i.Editor.range(n,s);i.Transforms.select(n,a)}var l=r.dataTransfer;if(null!=l)No.getSelectedNodeByType(n,"table")||(t.isDraggingInternally=!0,n.setFragmentData(l))}},dragend:function(e,t,n){var r=e;n.getConfig().readOnly||t.isDraggingInternally&&ua(n,r.target)&&(t.isDraggingInternally=!1)},drop:function(e,t,n){var r=e,o=r.dataTransfer;if(!n.getConfig().readOnly&&ua(n,r.target)&&null!=o&&!(ko&&xo&&o.files.length>0)){r.preventDefault();var s=n.selection,a=No.findEventRange(n,r);i.Transforms.select(n,a),t.isDraggingInternally&&(s&&i.Transforms.delete(n,{at:s}),t.isDraggingInternally=!1),n.insertData(o),n.isFocused()||n.focus()}}},Pa=[];var Ma={};function Ra(e,t,n){var r=n.isInline(e)?"span":"div";return d.jsx(r,null,t)}function La(e,t){var n,r=No.findKey(t,e),o=t.isInline(e),s=i.Editor.isVoid(t,e),a=po(e.type,r.id),l={id:a,key:r.id,"data-slate-node":"element","data-slate-inline":o},u=e.type,c=e.children,h=void 0===c?[]:c,p=function(e){return Ma[e]||Ra}(u);n=s?null:h.map(function(n,r){return Fa(n,r,e,t)});var f=p(e,n,t);if(s){l["data-slate-void"]=!0;var g=o?"span":"div",v=y(i.Node.texts(e),1),m=y(v[0],1)[0],b=Fa(m,0,e,t),w=d.jsx(g,{"data-slate-spacer":!0,style:{height:"0",color:"transparent",outline:"none",position:"absolute"}},b);f=d.jsx(g,{style:{position:"relative"}},f,w),nr.set(m,0),rr.set(m,e)}return null==f.data&&(f.data={}),Object.assign(f.data,l),s||o||(f=function(e,t,n){var r=t;return Pa.forEach(function(t){r=t(e,r,n)}),r}(e,f,t)),mn(function(){var n=or.get(t),o=null==n?void 0:n.querySelector("#".concat(a));null!=o&&(sr.set(r,o),ar.set(e,o),ir.set(o,e))}),f}function $a(e,t){return void 0===t&&(t=!1),d.jsx("span",{"data-slate-string":!0},t?e+"\n":e)}function Da(e,t){return void 0===e&&(e=0),void 0===t&&(t=!1),d.jsx("span",{"data-slate-zero-width":t?"n":"z","data-slate-length":e},"\ufeff",t?d.jsx("br",null):null)}function Aa(e,t,n){if(null==e.text)throw new Error("Current node is not slate Text ".concat(JSON.stringify(e)));var r=No.findKey(n,e),o=n.getConfig().decorate;if(null==o)throw new Error("Can not get config.decorate");var s,a=No.findPath(n,e),l=o([e,a]),u=i.Text.decorations(e,l),c=u.map(function(r){var o,s=r.leaf,a=r.position,l=function(e,t,n,r,o){void 0===t&&(t=!1);var s=e.text,a=No.findPath(o,n),l=i.Path.parent(a);if(i.Editor.isEditor(r))throw new Error("Text node ".concat(JSON.stringify(n)," parent is Editor"));return o.isVoid(r)?Da(i.Node.string(r).length):""!==s||r.children[r.children.length-1]!==n||o.isInline(r)||""!==i.Editor.string(o,l)?""===s?Da():t&&"\n"===s.slice(-1)?$a(s,!0):$a(s):Da(0,!0)}(s,null!==(o=null==a?void 0:a.isLast)&&void 0!==o?o:1===u.length,e,t,n);return l=function(e,t,n){var r=t;return Pa.forEach(function(t){r=t(e,r,n)}),r}(s,l,n),d.jsx("span",{"data-slate-leaf":!0},l)}),h=(s=r.id,"w-e-text-".concat(s)),p=d.jsx("span",{"data-slate-node":"text",id:h,key:r.id},c);return mn(function(){var t=or.get(n),o=null==t?void 0:t.querySelector("#".concat(h));null!=o&&(sr.set(r,o),ar.set(e,o),ir.set(o,e))}),p}function Fa(e,t,n,r){return nr.set(e,t),rr.set(e,n),i.Element.isElement(e)?La(e,r):Aa(e,n,r)}var ja=["props","attrs","style","dataset","on","hook","ns"];function Ia(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(!ja.includes(t)){if(t.startsWith("data-")){var s=t.slice(5);return s=h(s),function(e,t){null==e.data&&(e.data={});var n=e.data;null==n.dataset&&(n.dataset={}),Object.assign(n.dataset,t)}(e,((r={})[s]=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&&Ia(e)})}function Ua(e,t){var n,r,o=e.$scroll,s=(n=e.id,"w-e-textarea-".concat(n)),l=t.getConfig(),u=l.readOnly,c=l.autoFocus,h=function(e,t){return void 0===t&&(t=!1),d.h("div#".concat(e),{props:{contentEditable:!t}})}(s,u),p=t.children||[];h.children=p.map(function(e,n){if(er.has(e)){var r=er.get(e);if(r){var o=y(r,2),s=o[0],a=o[1];if(a)return s!==n&&(nr.set(e,n),er.set(e,[n,a])),a}}var l=Fa(e,n,t,t);Ia(l);var u=t.getConfig().skipCacheTypes,c=void 0===u?["list-item"]:u;return i.Element.isElement(e)&&c.includes(e.type)||er.set(e,[n,l]),l});var f=Yn.get(e);if(null==f&&(f=!0),f){var g=function(e){return a('<div\n id="'.concat(e,'"\n data-slate-editor\n data-slate-node="value"\n suppressContentEditableWarning\n role="textarea"\n spellCheck="true"\n autoCorrect="true"\n autoCapitalize="true"\n ></div>'))}(s);o.append(g),e.$textArea=g,r=g[0],or.set(t,r),ar.set(t,r),ir.set(r,t),(m=d.init([d.classModule,d.propsModule,d.styleModule,d.datasetModule,d.eventListenersModule,d.attributesModule]))(r,h),Yn.set(e,!1),Qn.set(e,m)}else{var v=Zn.get(e),m=Qn.get(e);if(null==v||null==m)return;r=v.elm,m(v,h)}if(null==r){var b=o[0];if(null==(r=(null==b?void 0:b.querySelector("#".concat(s)))||Hr(s)))return}if((f?c:t.isFocused())&&r.focus({preventScroll:!0}),f){var w=Lr(r);w&&ur.set(t,w)}or.set(t,r),ar.set(t,r),ir.set(r,t),Zn.set(e,h)}var Ba=1,Ha=function(){function e(e){var t=this;this.selectionChangeRoot=null,this.destroyed=!1,this.id=Ba++,this.$textArea=null,this.$progressBar=a('<div class="w-e-progress-bar"></div>'),this.$maxLengthInfo=a('<div class="w-e-max-length-info"></div>'),this.isComposing=!1,this.isUpdatingSelection=!1,this.isDraggingInternally=!1,this.latestElement=null,this.showPlaceholder=!1,this.$placeholder=null,this.latestEditorSelection=null,this.onDOMSelectionChange=n(function(e){var n=Ar(null==e?void 0:e.target)?e.target:null,r=null==n?void 0:n.tagName;if("INPUT"!==r&&"TEXTAREA"!==r){var o=t.getActiveEditor();null!=o&&function(e,t){var n=e.isComposing,r=e.isUpdatingSelection,o=e.isDraggingInternally,s=t.getConfig();if(!r&&!o){var a=No.findDocumentOrShadowRoot(t),l=a.activeElement,u=No.toDOMNode(t,t),c=a.getSelection();if(l!==u)return cr.delete(t),void ya(t);if(e.latestElement=l,cr.set(t,!0),!c)return ya(t);var d=c.anchorNode,h=c.focusNode,p=ca(t,d),f=ua(t,h);if(!n)if(p&&f){var g=No.toSlateRange(t,c,{exactMatch:!1,suppressThrow:!0});g&&i.Transforms.select(t,g)}else s.readOnly&&ya(t)}}(t,o)}},100);var r=a(e);if(0===r.length)throw new Error("Cannot find textarea DOM by selector '".concat(e,"'"));this.$box=r;var o=a('<div class="w-e-text-container"></div>');o.append(this.$progressBar),o.append(this.$maxLengthInfo),r.append(o);var s=a('<div class="w-e-scroll"></div>');o.append(s),this.$scroll=s,this.$textAreaContainer=o,mn(function(){var e=t.getActiveEditor();if(null!=e){t.bindSelectionChange(e),o.on("click",function(){return e.hidePanelOrModal()}),e.on($n,t.changeViewState.bind(t));var n=e.getConfig(),i=n.onChange,s=n.scroll;i&&e.on($n,function(){return i(e)}),s||(r.css("position","relative"),o.addClass("no-scroll")),t.onFocusAndOnBlur(),e.on($n,t.changeMaxLengthInfo.bind(t)),t.bindEvent()}})}return Object.defineProperty(e.prototype,"editorInstance",{get:function(){var e=Hn.get(this);if(null==e)throw new Error("Can not get editor instance");return e},enumerable:!1,configurable:!0}),e.prototype.getActiveEditor=function(){if(this.destroyed)return null;var e=Hn.get(this);return null==e||e.isDestroyed?null:e},e.prototype.bindSelectionChange=function(e,t){var n=this;if(void 0===t&&(t=5),null==this.selectionChangeRoot&&!e.isDestroyed){try{var r=No.findDocumentOrShadowRoot(e);r.addEventListener("selectionchange",this.onDOMSelectionChange),this.selectionChangeRoot=r}catch(r){if(t>0)return void setTimeout(function(){return n.bindSelectionChange(e,t-1)},0);window.document.addEventListener("selectionchange",this.onDOMSelectionChange),this.selectionChangeRoot=window.document}e.on(Ln,function(){var e;null===(e=n.selectionChangeRoot)||void 0===e||e.removeEventListener("selectionchange",n.onDOMSelectionChange),n.selectionChangeRoot=null})}},e.prototype.flushDOMSelectionChange=function(){this.onDOMSelectionChange.flush()},e.prototype.bindEvent=function(){var e=this,t=this.$textArea,o=this.$scroll,i=this.editorInstance;null!=t&&(r(Na,function(n,r){t.on(r,function(t){n(t,e,i)})}),i.getConfig().scroll&&(o.css("overflow-y","auto"),o.on("scroll",n(function(){i.emit(Dn)},100))))},e.prototype.onFocusAndOnBlur=function(){var e=this,t=this.getActiveEditor();if(null!=t){var n=t.getConfig(),r=n.onBlur,o=n.onFocus;this.latestEditorSelection=t.selection,t.on($n,function(){null==e.latestEditorSelection&&null!=t.selection?setTimeout(function(){e.destroyed||t.isDestroyed||o&&o(t)}):null!=e.latestEditorSelection&&null==t.selection&&setTimeout(function(){e.destroyed||t.isDestroyed||r&&r(t)}),e.latestEditorSelection=t.selection})}},e.prototype.changeMaxLengthInfo=function(){var e=this.getActiveEditor();if(null!=e){var t=e.getConfig().maxLength;if(t){var n=t-No.getLeftLengthOfMaxLength(e);this.$maxLengthInfo[0].innerHTML="".concat(n,"/").concat(t)}}},e.prototype.changeProgress=function(e){var t=this.$progressBar;t.css("width","".concat(e,"%")),e>=100&&setTimeout(function(){t.hide(),t.css("width","0"),t.show()},1e3)},e.prototype.changeViewState=function(){var e=this,t=this.getActiveEditor();null!=t&&(Ua(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=a('<div class="w-e-text-placeholder">'.concat(r,"</div>"));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),mn(function(){e.destroyed||t.isDestroyed||ba(e,t)}))},e.prototype.destroy=function(){var e;this.destroyed=!0,this.onDOMSelectionChange.cancel(),null===(e=this.selectionChangeRoot)||void 0===e||e.removeEventListener("selectionchange",this.onDOMSelectionChange),this.selectionChangeRoot=null,this.$textAreaContainer.remove()},e}();function za(e,t,n,r){if(nr.set(e,t),rr.set(e,n),i.Element.isElement(e)){var o=e.children;if((void 0===o?[]:o).forEach(function(t,n){return za(t,n,e,r)}),i.Editor.isVoid(r,e)){var s=y(i.Node.texts(e),1),a=y(s[0],1)[0];nr.set(a,0),rr.set(a,e)}}}var Wa=function(){function e(e,t){var n=this;this.$toolbar=a('<div class="w-e-bar w-e-bar-show w-e-toolbar"></div>'),this.menus={},this.toolbarItems=[],this.config={},this.lngListen=function(){},this.syncToolbarState=function(){n.toolbarItems.forEach(function(e){e.changeMenuState()})},this.changeToolbarState=u(function(){n.syncToolbarState()},200),this.config=t;var r=a(e);if(0===r.length)throw new Error("Cannot find toolbar DOM by selector '".concat(e,"'"));this.$box=r;var o=this.$toolbar;o.on("mousedown",function(e){return e.preventDefault()},{passive:!1}),r.append(o),mn(function(){n.initToolbar(),n.lngListen=Bs(function(){return n.initToolbar()});var e=n.getEditorInstance();e.on($n,n.changeToolbarState),e.on(An,n.syncToolbarState),e.on(Fn,n.syncToolbarState)})}return e.prototype.getMenus=function(){return this.menus},e.prototype.getConfig=function(){return this.config},e.prototype.initToolbar=function(){this.menus={};var e=this.$toolbar;null==e||e.empty(),this.registerItems(),this.changeToolbarState()},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,l=void 0===a?{index:0,keys:[]}:a,u=r.excludeKeys,c=void 0===u?[]:u,d=s(i),h=[];h=Array.isArray(l)?l:[l];var p=0;h.forEach(function(e){var t=e.index+p;if(e.replaceFn&&d[t]){var n=e.replaceFn(d[t]);if(!n)throw new Error("This function needs to return the menu configuration: IToolbarMenuKey");d[t]=n}e.keys.length>0&&("string"==typeof e.keys&&(e.keys=[e.keys]),e.keys.forEach(function(e,n){d.splice(t+n,0,e)}),p+=e.keys.length)});var f=d.filter(function(e){var t="string"==typeof e?e:e.key;return!c.includes(t)}),g=f.length;f.forEach(function(r,o){if("|"===r){if(0===o)return;if(o+1===g)return;if("|"===t)return;var i=Vs();return n.append(i),void(t=r)}return"string"==typeof r?(e.registerSingleItem(r,e),void(t=r)):e.isMenuGroup(r)?(e.registerGroup(r),void(t="group")):(e.registerSingleMenuByConf(r),void(t=r.key))})},e.prototype.isMenuGroup=function(e){return"string"!=typeof e&&Array.isArray(e.menuKeys)},e.prototype.registerSingleMenuByConf=function(e){var t=e.key,n=e.title,r=e.iconSvg;this.registerSingleItem(t,this,{title:n,iconSvg:r})},e.prototype.registerGroup=function(e){var t=this,n=this.$toolbar,r=function(e){return new na(e)}(e),o=e.menuKeys,i=void 0===o?[]:o,s=this.config.excludeKeys,a=void 0===s?[]:s;i.forEach(function(e){a.includes(e)||t.registerSingleItem(e,r)}),n.append(r.$elem)},e.prototype.registerSingleItem=function(e,t,n){void 0===n&&(n={});var r=this.getEditorInstance(),o=t instanceof na,i=this.menus,s=i[e];if(null==s){var a=Un[e];if(null==a)throw new Error("Not found menu item factory by key '".concat(e,"'"));if("function"!=typeof a)throw new Error("Menu item factory (key='".concat(e,"') is not a function"));s=a(),i[e]=s}else console.warn("Duplicated toolbar menu key '".concat(e,"'\n重复注册了菜单栏 menu '").concat(e,"'"));var l=r.getMenuConfig(e);l&&void 0!==l.iconSvg&&(s.iconSvg=l.iconSvg),void 0!==n.iconSvg&&(s.iconSvg=n.iconSvg),void 0!==n.title&&(s.title=n.title);var u=ia(e,s,o);(this.toolbarItems.push(u),Kn.set(u,r),o)?t.appendBarItem(u):t.$toolbar.append(u.$elem)},e.prototype.getEditorInstance=function(){var e=zn.get(this);if(null==e)throw new Error("Can not get editor instance");return e},e.prototype.destroy=function(){var e;this.$toolbar.remove(),null===(e=this.lngListen)||void 0===e||e.call(this),this.menus={},this.toolbarItems=[]},e}();var Va=!1,qa=!1;function Ka(e){"undefined"!=typeof console&&"function"==typeof console.warn&&console.warn("[wangeditor-next] `@wangeditor-next/core` export `".concat(e,"` is deprecated.")+" Please import it from `@wangeditor-next/core/upload`.")}e.DOMComment=Er,e.DOMElement=xr,e.DOMNode=wr,e.DOMRange=_r,e.DOMSelection=Or,e.DOMStaticRange=kr,e.DOMText=Sr,e.DomEditor=No,e.ELEM_TO_HTML_CONF=go,e.PARSE_ELEM_HTML_CONF=eo,e.PARSE_STYLE_HTML_FN_LIST=Zr,e.PRE_PARSE_HTML_CONF_LIST=Qr,e.RENDER_ELEM_CONF=Ma,e.RENDER_STYLE_HANDLER_LIST=Pa,e.STYLE_TO_HTML_FN_LIST=fo,e.TEXT_TAGS=Yr,e.Toolbar=Wa,e.coreCreateEditor=function(e){var t=e.selector,n=void 0===t?"":t,o=e.config,a=void 0===o?{}:o,l=e.content,u=e.html,c=e.plugins,d=void 0===c?[]:c,h=function(e){return[Ui,xi,vr,wi,Gi,Ii,zi,On.withHistory].reduce(function(e,t){return t(e)},e)}(i.createEditor());if(n&&function(e,t){return co(e,"data-w-e-textarea",t)}(h,n))throw new Error("Repeated create editor by selector '".concat(n,"'"));var p=function(e){void 0===e&&(e={});var t=s(Mn),n={},o=e.MENU_CONF,i=void 0===o?{}:o;return r(t,function(e,t){n[t]=v(v({},e),i[t]||{})}),delete e.MENU_CONF,v({scroll:!0,readOnly:!1,autoFocus:!0,decorate:function(){return[]},maxLength:0,MENU_CONF:n,hoverbarKeys:{},textStyleMode:"inline",classStylePolicy:"preserve-data",sanitizeHtml:Pn,customAlert:function(e,t){window.alert("".concat(t,":\n").concat(e))}},e)}(a);Xn.set(h,p);var f=p.hoverbarKeys,g=void 0===f?{}:f;if(d.forEach(function(e){h=e(h)}),function(e,t){var n=t.html,r=t.content;null!=n?e.children=ho(e,n):r&&r.length&&(e.children=r),0===e.children.length&&(e.children=[{type:"paragraph",children:[{text:""}]}])}(h,{html:u,content:l}),n){var m=new Ha(n);Bn.set(h,m),Hn.set(m,h),m.changeViewState();var y=void 0;Object.keys(g).length>0&&(y=new aa,Vn.set(y,h),qn.set(h,y)),h.on($n,function(){h.hidePanelOrModal()}),h.on(Dn,function(){h.hidePanelOrModal()})}else h.children.forEach(function(e,t){return za(e,t,h,h)});var b=p.onCreated,w=p.onDestroyed;return b&&h.on(Rn,function(){return b(h)}),w&&h.on(Ln,function(){return w(h)}),mn(function(){return h.emit(Rn)}),h},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 co(e,"data-w-e-toolbar",t)}(e,n))throw new Error("Repeated create toolbar by selector '".concat(n,"'"));var i=v({toolbarKeys:[],excludeKeys:[],insertKeys:{index:0,keys:[]},modalAppendToBody:!1},o||{}),s=new Wa(n,i);return zn.set(s,e),Wn.set(e,s),s},e.createUploader=function(e,t){return Va||(Va=!0,Ka("createUploader")),function(e,t){return e.uploadAdapter?e.uploadAdapter({config:e,editor:t}):En(e)}(e,t)},e.createUppyUploader=function(e){return qa||(qa=!0,Ka("createUppyUploader")),En(e)},e.genModalButtonElems=function(e,t){var n=a('<div class="button-container"></div>'),r=a('<button type="button" id="'.concat(e,'">').concat(t,"</button>"));return n.append(r),[n[0],r[0]]},e.genModalInputElems=function(e,t,n){var r=a('<label class="babel-container"></label>');r.append("<span>".concat(e,"</span>"));var o=a('<input type="text" id="'.concat(t,'" placeholder="').concat(n||"",'">'));return r.append(o),[r[0],o[0]]},e.genModalTextareaElems=function(e,t,n){var r=a('<label class="babel-container"></label>');r.append("<span>".concat(e,"</span>"));var o=a('<textarea type="text" id="'.concat(t,'" placeholder="').concat(n||"",'"></textarea>'));return r.append(o),[r[0],o[0]]},e.getClassStylePolicy=function(e){if(!e)return"preserve-data";var t=e.getConfig().classStylePolicy;return"fallback-inline"===t?"fallback-inline":"strict"===t?"strict":"preserve-data"},e.getDefaultView=Lr,e.getEditableChild=Wr,e.getEditableChildAndIndex=zr,e.getElementById=Hr,e.getFirstVoidChild=qr,e.getPlainText=Vr,e.getTagName=Jr,e.getTextStyleMode=function(e){return e&&"class"===e.getConfig().textStyleMode?"class":"inline"},e.hasShadowRoot=Br,e.i18nAddResources=function(e,t){Is.addResourceBundle(e,Us,t,!0,!0)},e.i18nChangeLanguage=function(e){Is.changeLanguage(e)},e.i18nGetResources=function(e){return Is.getResourceBundle(e,Us)},e.i18nListenLanguage=Bs,e.isDOMComment=Dr,e.isDOMElement=Ar,e.isDOMNode=$r,e.isDOMSelection=Fr,e.isDOMText=jr,e.isDataTransfer=Nr,e.isDocument=Cr,e.isHTMLElememt=Rr,e.isPlainTextOnlyPaste=Ir,e.isShadowRoot=Tr,e.isUnprocessedListElement=Mr,e.normalizeDOMPoint=Ur,e.registerElemToHtmlConf=function(e){var t=e.type,n=e.elemToHtml;go[t||""]=n},e.registerMenu=function(e,t){var n=e.key,r=e.factory,o=e.config,i=v(v({},o),t||{});if(null!=Un[n])throw new Error("Duplicated key '".concat(n,"' in menu items"));Un[n]=r,function(e,t){null!=t&&(Mn[e]=t)}(n,i)},e.registerParseElemHtmlConf=function(e){var t=e.selector,n=e.parseElemHtml;eo[t]=n},e.registerParseStyleHtmlHandler=function(e){Zr.push(e)},e.registerPreParseHtmlConf=function(e){Qr.push(e)},e.registerRenderElemConf=function(e){var t=e.type,n=e.renderElem;Ma[t||""]=n},e.registerStyleHandler=function(e){Pa.push(e)},e.registerStyleToHtmlHandler=function(e){fo.push(e)},e.reportUnsupportedClassStyle=function(e,t){var n=null==e?void 0:e.getConfig().onClassStyleUnsupported;n?n(t):console.warn(t.message)},e.t=Hs,e.walkTextNodes=Kr});
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@uppy/core"),require("@uppy/xhr-upload"),require("lodash.foreach"),require("nanoid"),require("slate"),require("lodash.clonedeep"),require("dom7"),require("lodash.toarray"),require("lodash.debounce"),require("lodash.throttle"),require("is-hotkey"),require("snabbdom"),require("lodash.camelcase")):"function"==typeof define&&define.amd?define(["exports","@uppy/core","@uppy/xhr-upload","lodash.foreach","nanoid","slate","lodash.clonedeep","dom7","lodash.toarray","lodash.debounce","lodash.throttle","is-hotkey","snabbdom","lodash.camelcase"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).WangEditorCore={},e.Uppy,e.XHRUpload,e.forEach,null,e.require$$0,e.cloneDeep,e.$,e.toArray,e.debounce,e.throttle,e.isHotkey,e.snabbdom,e.camelCase)}(this,function(e,t,n,r,o,i,a,s,l,c,u,d,f,h){"use strict";var p=function(e,t){return p=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])},p(e,t)};function g(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}p(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var v=function(){return v=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},v.apply(this,arguments)};function m(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=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 y(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 b(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}function w(e){Promise.resolve().then(e)}function E(e){return e.replace(/ /g," ").replace(/</g,"<").replace(/>/g,">").replace(/®/g,"®").replace(/©/g,"©").replace(/™/g,"™").replace(/"/g,'"')}"function"==typeof SuppressedError&&SuppressedError;var x=function(e){return Object.prototype.toString.call(e)};function S(e){return e||{name:""}}function C(e){return Object.keys(e).reduce(function(t,n){return t[n]=String(e[n]),t},{})}function k(e){var o=e.server,i=void 0===o?"":o,a=e.fieldName,s=void 0===a?"":a,l=e.maxFileSize,c=void 0===l?10485760:l,u=e.maxNumberOfFiles,d=void 0===u?100:u,f=e.meta,h=void 0===f?{}:f,p=e.metaWithUrl,g=void 0!==p&&p,b=e.headers,w=void 0===b?{}:b,E=e.withCredentials,x=void 0!==E&&E,k=e.timeout,O=void 0===k?1e4:k,N=e.onBeforeUpload,T=void 0===N?function(e){return e}:N,M=e.onSuccess,L=void 0===M?function(e,t){}:M,D=e.onError,R=void 0===D?function(e,t,n){console.error("".concat(e.name," upload error"),t,n)}:D,P=e.onProgress,A=void 0===P?function(e){}:P;if(!i)throw new Error("Cannot get upload server address\n没有配置上传地址");if(!s)throw new Error("Cannot get fieldName\n没有配置 fieldName");var $=i;g&&($=function(e,t){var n=y(e.split("#"),2),o=n[0],i=n[1],a=[];r(t,function(e,t){a.push("".concat(t,"=").concat(e))});var s=a.join("&");return o=o.indexOf("?")>0?"".concat(o,"&").concat(s):"".concat(o,"?").concat(s),i?"".concat(o,"#").concat(i):o}($,h)),function(){if("undefined"!=typeof AbortSignal){var e=AbortSignal;"function"!=typeof e.any&&(e.any=function(e){var t,n,r=new AbortController,o=function(t){e.forEach(function(e){return e.removeEventListener("abort",o)});var n=t.target.reason;r.abort(n)};try{for(var i=m(e),a=i.next();!a.done;a=i.next()){var s=a.value;if(s.aborted){var l=s.reason;return r.abort(l),r.signal}s.addEventListener("abort",o,{once:!0})}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return r.signal})}}();var F=function(e){if(e)return"function"==typeof e?function(t){return C(e(t))}:C(e)}(w),I=new t(v({onBeforeUpload:function(e){return T(e)},restrictions:{maxFileSize:c,maxNumberOfFiles:d},meta:h},e.uppyConfig)).use(n,v({endpoint:$,headers:F,formData:!0,fieldName:s,bundle:!1,withCredentials:x,timeout:O},e.xhrConfig));return I.on("upload-success",function(e,t){var n=(null!=t?t:{}).body,r=void 0===n?{}:n,o=S(e);try{L(o,r)}catch(e){console.error("wangEditor upload file - onSuccess error",e)}}),I.on("progress",function(e){e<1||A(e)}),I.on("upload-error",function(e,t,n){var r=S(e);try{R(r,t,n)}catch(e){console.error("wangEditor upload file - onError error",e)}}),I.on("restriction-failed",function(e,t){var n=S(e);try{R(n,t,void 0)}catch(e){console.error("wangEditor upload file - onError error",e)}}),I}var O=new Set(["base","embed","math","meta","object","script","svg"]),N=new Set(["href","poster","src","xlink:href"]),T=["java","script:"].join("");function M(e,t,n){var r=function(e){return Array.from(e).filter(function(e){return e>" "}).join("").toLowerCase()}(n);return!r||!r.startsWith(T)&&!r.startsWith("vbscript:")&&(!r.startsWith("data:")||"href"!==t&&"xlink:href"!==t&&(("img"===e||"poster"===t)&&r.startsWith("data:image/")))}function L(e){if(void 0===e&&(e=""),!e)return"";var t=document.createElement("div");t.innerHTML=e;var n=function(e){Array.from(e.childNodes).forEach(function(e){if(e instanceof Element){var t=e,r=t.tagName.toLowerCase();if("template"===r){var o=t,i=L(o.innerHTML);return i?(o.insertAdjacentHTML("beforebegin",i),void o.remove()):void o.remove()}O.has(r)?t.remove():(Array.from(t.attributes).forEach(function(e){var n=e.name.toLowerCase(),o=e.value||"";("srcdoc"===n||n.startsWith("on")||N.has(n)&&!M(r,n,o))&&t.removeAttribute(e.name)}),n(t))}})};return n(t),t.innerHTML}var D={};var R="created",P="destroyed",A="change",$="scroll",F="fullscreen",I="unFullScreen",B="modalOrPanelShow",j="modalOrPanelHide",_={};var H=new WeakMap,W=new WeakMap,V=new WeakMap,U=new WeakMap,z=new WeakMap,K=new WeakMap,q=new WeakMap,J=new WeakMap,G=new WeakMap,Y=new WeakMap,X=new WeakMap,Z=new WeakMap,Q=new WeakMap,ee=new WeakMap,te=new WeakMap,ne=new WeakMap,re=new WeakMap,oe=new WeakMap,ie=new WeakMap,ae=new WeakMap,se=new WeakMap,le=new WeakMap,ce=new WeakMap,ue=new WeakMap,de=new WeakMap,fe=new WeakMap,he=new WeakMap,pe=new WeakMap,ge=new WeakMap,ve=function(e){var t=e;return t.getAllMenuKeys=function(){var e=[];for(var t in _)e.push(t);return e},t.getConfig=function(){var e=Y.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},me=new Set(["doctype","!doctype","meta","script","style","link","frame","iframe","title","svg"]);const ye=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"];var be,we=globalThis.Node,Ee=globalThis.Comment,xe=globalThis.Element,Se=globalThis.Text,Ce=globalThis.Range,ke=globalThis.Selection,Oe=globalThis.StaticRange;s.css&&(s.fn.css=s.css),s.append&&(s.fn.append=s.append),s.addClass&&(s.fn.addClass=s.addClass),s.removeClass&&(s.fn.removeClass=s.removeClass),s.hasClass&&(s.fn.hasClass=s.hasClass),s.on&&(s.fn.on=s.on),s.focus&&(s.fn.focus=s.focus),s.attr&&(s.fn.attr=s.attr),s.removeAttr&&(s.fn.removeAttr=s.removeAttr),s.hide&&(s.fn.hide=s.hide),s.show&&(s.fn.show=s.show),s.offset&&(s.fn.offset=s.offset),s.width&&(s.fn.width=s.width),s.height&&(s.fn.height=s.height),s.parent&&(s.fn.parent=s.parent),s.parents&&(s.fn.parents=s.parents),s.is&&(s.fn.is=s.is),s.dataset&&(s.fn.dataset=s.dataset),s.val&&(s.fn.val=s.val),s.text&&(s.fn.text=s.text),s.html&&(s.fn.html=s.html),s.children&&(s.fn.children=s.children),s.remove&&(s.fn.remove=s.remove),s.find&&(s.fn.find=s.find),s.each&&(s.fn.each=s.each),s.empty&&(s.fn.empty=s.empty),e.NodeType=void 0,(be=e.NodeType||(e.NodeType={}))[be.ELEMENT_NODE=1]="ELEMENT_NODE",be[be.TEXT_NODE=3]="TEXT_NODE",be[be.CDATA_SECTION_NODE=4]="CDATA_SECTION_NODE",be[be.PROCESSING_INSTRUCTION_NODE=7]="PROCESSING_INSTRUCTION_NODE",be[be.COMMENT_NODE=8]="COMMENT_NODE",be[be.DOCUMENT_NODE=9]="DOCUMENT_NODE",be[be.DOCUMENT_TYPE_NODE=10]="DOCUMENT_TYPE_NODE",be[be.DOCUMENT_FRAGMENT_NODE=11]="DOCUMENT_FRAGMENT_NODE";var Ne=function(e){return"[object HTMLDocument]"===x(e)},Te=function(e){return"[object ShadowRoot]"===x(e)},Me=function(e){return"[object DataTransfer]"===x(e)},Le=/\[object HTML([A-Z][a-z]*)*Element\]/,De=function(e){return"matches"in e&&/^[ou]l$/i.test(e.tagName)&&!e.hasAttribute("data-w-e-type")},Re=function(e){return Le.test(x(e))},Pe=function(e){return e&&e.ownerDocument&&e.ownerDocument.defaultView||null},Ae=function(e){return null!=e&&"number"==typeof e.nodeType},$e=function(t){return Ae(t)&&t.nodeType===e.NodeType.COMMENT_NODE},Fe=function(t){return Ae(t)&&t.nodeType===e.NodeType.ELEMENT_NODE},Ie=function(e){return"[object Selection]"===x(e)},Be=function(t){return Ae(t)&&t.nodeType===e.NodeType.TEXT_NODE},je=function(e){return e.clipboardData&&""!==e.clipboardData.getData("text/plain")&&1===e.clipboardData.types.length},_e=function(e){var t,n=y(e,2),r=n[0],o=n[1];if(Fe(r)&&r.childNodes.length){var i=o===r.childNodes.length,a=i?o-1:o;for(r=(t=y(Ve(r,a,i?"backward":"forward"),2))[0],i=(a=t[1])<o;Fe(r)&&r.childNodes.length;){var s=i?r.childNodes.length-1:0;r=Ue(r,s,i?"backward":"forward")}o=i&&null!=r.textContent?r.textContent.length:0}return[r,o]},He=function(){return!(!window.document.activeElement||!window.document.activeElement.shadowRoot)},We=function(e){var t,n,r;return null!==(t=window&&window.document.getElementById(e))&&void 0!==t?t:window&&(null===(r=null===(n=window.document.activeElement)||void 0===n?void 0:n.shadowRoot)||void 0===r?void 0:r.getElementById(e))||null},Ve=function(e,t,n){for(var r=e.childNodes,o=r[t],i=t,a=!1,s=!1;($e(o)||Fe(o)&&0===o.childNodes.length||Fe(o)&&"false"===o.getAttribute("contenteditable"))&&(!a||!s);)i>=r.length?(a=!0,i=t-1,n="backward"):i<0?(s=!0,i=t+1,n="forward"):(o=r[i],t=i,i+="forward"===n?1:-1);return[o,t]},Ue=function(e,t,n){return y(Ve(e,t,n),1)[0]},ze=function(e){var t,n,r="";if(Be(e)&&e.nodeValue)return e.nodeValue;if(Fe(e)){try{for(var o=m(Array.from(e.childNodes)),i=o.next();!i.done;i=o.next()){var a=i.value;r+=ze(a)}}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}var s=getComputedStyle(e).getPropertyValue("display");"block"!==s&&"list"!==s&&"table-row"!==s&&"BR"!==e.tagName||(r+="\n")}return r};function Ke(t){var n=[];n.push(t);for(var r=0;n.length>0;){var o=n.pop();if(null==o)break;if((r+=1)>1e4)break;var i=o.nodeName;if(o.nodeType===e.NodeType.ELEMENT_NODE){var a=i.toLowerCase();if(ye.includes(a)||"iframe"===a||"video"===a)return o;var s=o.children||[],l=s.length;if(l)for(var c=l-1;c>=0;c-=1)n.push(s[c])}}return null}function qe(t,n){if(!Re(t)||"true"!==t.dataset.slateVoid)for(var r=t.childNodes,o=r.length;o-=1;){var i=r[o],a=i.nodeType;Be(i)?n(i,t):[e.NodeType.ELEMENT_NODE,e.NodeType.DOCUMENT_NODE,e.NodeType.DOCUMENT_FRAGMENT_NODE].includes(a)&&qe(i,n)}}function Je(t){if(0===t.length)return"";var n=t[0];return n.nodeType!==e.NodeType.ELEMENT_NODE?"":n.tagName.toLowerCase()}var Ge=new RegExp(String.fromCharCode(160),"g");function Ye(e){return e.replace(Ge," ")}var Xe=["span","b","strong","i","em","s","strike","u","font","sub","sup"],Ze=[];var Qe=[];var et={};function tt(e,t){var n=e.length;if(n){var r=e[n-1];if(i.Text.isText(r)){var o=Object.keys(r);if(1===o.length&&"text"===o[0])return r.text+=t,!0}}return!1}function nt(e,t,n){return{type:"paragraph",children:[{text:s(e).text().replace(/\s+/gm," ")}]}}function rt(e,t){var n=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(Fe(e)){if("BR"===e.nodeName)return void(tt(n,"\n")||n.push({text:"\n"}));var r=ct(s(e),t);Array.isArray(r)?r.forEach(function(e){return n.push(e)}):n.push(r)}else if(Be(e)){var o=e.textContent||"";if(""===o.trim()&&o.indexOf("\n")>=0)return;o&&(o=Ye(o),tt(n,o)||n.push({text:o}))}}),n)}(e,t),r=function(e){for(var t in et)if(e[0].matches(t))return et[t];return nt}(e),o=r(e[0],n,t);return Array.isArray(o)||(o=[o]),o.forEach(function(r){i.Editor.isVoid(t,r)||(0===n.length&&(r.children=[{text:e.text().replace(/\s+/gm," ")}]),Qe.forEach(function(n){r=n(e[0],r,t)}))}),o}function ot(e,t){0===e.parents("pre").length&&(e[0].innerHTML=e[0].innerHTML.replace(/[\r\n\t]+/g,"").replace(/<br>/g,"\n"));var n=e[0].textContent||"",r={text:n=Ye(n=E(n))};return Qe.forEach(function(n){r=n(e[0],r,t)}),r}function it(e,t){var n={text:""};return Qe.forEach(function(r){n=r(e[0],n,t)}),n}function at(e,t){var n=t.parentElement;return null==n?e:(null==n.closest("pre")&&(e=e.replace(/[\r\n\t]+/g,"")),e=Ye(e=E(e)))}function st(e,t){var n=v(v({},e),t);return Object.keys(t).forEach(function(e){!1===t[e]&&delete n[e]}),n}function lt(e,t,n){var r=e[0];if(Fe(r)){var o=ct(e,n),i=v({},t);return delete i.text,Array.isArray(o)?o.map(function(e){return st(i,e)}):[st(i,o)]}return $e(r)?null:[st(t,Be(r)?{text:at(r.textContent||"",r)}:ot(e,n))]}function ct(e,t){Ze.forEach(function(t){var n=t.selector,r=t.preParseHtml;e[0].matches(n)&&(e=s(r(e[0])))});var n=Je(e);if("span"===n){if(e.attr("data-w-e-type"))return rt(e,t);if((o=Array.from(e[0].childNodes)).some(function(e){return!Be(e)&&!$e(e)})){var r=it(s(e[0]),t);return o.flatMap(function(e){return lt(s(e),r,t)||[]})}return ot(e,t)}if("code"===n)return"pre"===Je(e.parent())?rt(e,t):ot(e,t);if(Xe.includes(n)){var o;if((o=Array.from(e[0].childNodes)).some(function(e){return!Be(e)&&!$e(e)})){var i=it(s(e[0]),t);return o.flatMap(function(e){return lt(s(e),i,t)||[]})}return ot(e,t)}return rt(e,t)}function ut(e,t,n){var r=s(n);return!!r.attr(t)||(r.attr(t,"true"),e.on(P,function(){r.removeAttr(t)}),!1)}function dt(e,t){void 0===t&&(t="");var n=[],r=e.getConfig().sanitizeHtml;""===t&&(t="<p><br></p>"),0!==t.indexOf("<")&&(t=t.split(/\n/).map(function(e){return"<p>".concat(e,"</p>")}).join("")),t=r?r(t):t;var o=s("<div>".concat(t,"</div>"));return Array.from(o.children()).forEach(function(t){var r=ct(s(t),e);Array.isArray(r)?r.forEach(function(e){return n.push(e)}):n.push(r)}),n}function ft(e,t){return"w-e-element-".concat(e,"-").concat(t)}var ht=0,pt=function(){this.id="".concat(ht++)},gt="undefined"!=typeof navigator&&/Mac OS X/.test(navigator.userAgent),vt="undefined"!=typeof navigator&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),mt="undefined"!=typeof navigator&&/^((?!chrome|android).)*safari/i.test(navigator.userAgent),yt="undefined"!=typeof navigator&&/Edge?\/(?:[0-6][0-9]|[0-7][0-8])(?:\.)/i.test(navigator.userAgent),bt="undefined"!=typeof navigator&&/Chrome?\/(?:[0-7][0-5]|[0-6][0-9])(?:\.)/i.test(navigator.userAgent),wt="undefined"!=typeof navigator&&/Chrome/i.test(navigator.userAgent),Et=!bt&&!yt&&"undefined"!=typeof globalThis&&globalThis.InputEvent&&"function"==typeof globalThis.InputEvent.prototype.getTargetRanges,xt=function(e,t){return Boolean(e.compareDocumentPosition(t)&we.DOCUMENT_POSITION_PRECEDING)},St=function(e,t){return Boolean(e.compareDocumentPosition(t)&we.DOCUMENT_POSITION_FOLLOWING)},Ct={getWindow:function(e){var t=ce.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=le.get(t);return n||(n=new pt,le.set(t,n)),n},setNewKey:function(e){var t=new pt;le.set(e,t)},findPath:function(e,t){for(var n=[],r=t;;){var o=re.get(r);if(null==o){if(i.Editor.isEditor(r))return n;break}var a=ne.get(r);if(null==a)break;n.unshift(a),r=o}throw new Error("Unable to find the path for Slate node: ".concat(JSON.stringify(t)))},findDocumentOrShadowRoot:function(e){if(e.isDestroyed)return window.document;var t=Ct.toDOMNode(e,e),n=t.getRootNode();return(Ne(n)||Te(n))&&null!=Reflect.get(n,"getSelection")?n:t.ownerDocument},getParentNode:function(e,t){return re.get(t)||null},getParentsNodes:function(e,t){for(var n=[],r=t;r!==e&&null!=r;){var o=Ct.getParentNode(e,r);if(null==o)break;n.push(o),r=o}return n},getTopNode:function(e,t){var n=[Ct.findPath(e,t)[0]];return i.Node.get(e,n)},toDOMNode:function(e,t){var n;if(i.Editor.isEditor(t))n=oe.get(e);else{var r=Ct.findKey(e,t);n=ae.get(r)}if(!n)throw new Error("Cannot resolve a DOM node from Slate node: ".concat(JSON.stringify(t)));return n},hasDOMNodeBySlateNode:function(e,t){if(i.Editor.isEditor(t))return!!oe.get(e);var n=Ct.findKey(e,t);return!!ae.get(n)},canResolveDOMRange:function(e,t){try{var n=y(i.Editor.node(e,t.anchor.path),1)[0],r=y(i.Range.isCollapsed(t)?[n]:i.Editor.node(e,t.focus.path),1)[0];return Ct.hasDOMNodeBySlateNode(e,n)&&Ct.hasDOMNodeBySlateNode(e,r)}catch(e){return!1}},hasDOMNode:function(e,t,n){void 0===n&&(n={});var r,o=n.editable,i=void 0!==o&&o,a=Ct.toDOMNode(e,e);try{r=Fe(t)?t:t.parentElement}catch(e){if(e instanceof Error&&!e.message.includes('Permission denied to access property "nodeType"'))throw e}return!!r&&(r.closest("[data-slate-editor]")===a&&(!i||r.isContentEditable||r.closest('[contenteditable="false"]')===a||!!r.getAttribute("data-slate-zero-width"))||!!r.getAttribute("data-slate-string"))},toDOMRange:function(e,t){var n=t.anchor,r=t.focus,o=i.Range.isBackward(t),a=Ct.toDOMPoint(e,n),s=i.Range.isCollapsed(t)?a:Ct.toDOMPoint(e,r),l=Ct.getWindow(e).document.createRange(),c=y(o?s:a,2),u=c[0],d=c[1],f=y(o?a:s,2),h=f[0],p=f[1],g=!!(Fe(u)?u:u.parentElement).getAttribute("data-slate-zero-width"),v=!!(Fe(h)?h:h.parentElement).getAttribute("data-slate-zero-width");return l.setStart(u,g?1:d),l.setEnd(h,v?1:p),l},toDOMPoint:function(e,t){var n,r,o,a=y(i.Editor.node(e,t.path),1)[0],s=Ct.toDOMNode(e,a);i.Editor.void(e,{at:t})&&(t={path:t.path,offset:0});var l=Array.from(s.querySelectorAll("[data-slate-string], [data-slate-zero-width]")),c=0;try{for(var u=m(l),d=u.next();!d.done;d=u.next()){var f=d.value,h=f.childNodes[0];if(null!=h&&null!=h.textContent){var p=h.textContent.length,g=f.getAttribute("data-slate-length"),v=c+(null==g?p:parseInt(g,10));if(t.offset<=v){o=[h,Math.min(p,Math.max(0,t.offset-c))];break}c=v}}}catch(e){n={error:e}}finally{try{d&&!d.done&&(r=u.return)&&r.call(u)}finally{if(n)throw n.error}}if(!o)throw new Error("Cannot resolve a DOM point from Slate point: ".concat(JSON.stringify(t)));return o},toSlateNode:function(e,t){var n=Fe(t)?t:t.parentElement;n&&!n.hasAttribute("data-slate-node")&&(n=n.closest("[data-slate-node]"));var r=n?ie.get(n):null;if(!r)throw new Error("Cannot resolve a Slate node from DOM node: ".concat(n));return r},findEventRange:function(e,t){"nativeEvent"in t&&(t=t.nativeEvent);var n=t.clientX,r=t.clientY,o=t.target;if(null==n||null==r)throw new Error("Cannot resolve a Slate range from a DOM event: ".concat(t));var a,s=Ct.toSlateNode(e,t.target),l=Ct.findPath(e,s);if(i.Element.isElement(s)&&i.Editor.isVoid(e,s)){var c=o.getBoundingClientRect(),u=e.isInline(s)?n-c.left<c.left+c.width-n:r-c.top<c.top+c.height-r,d=i.Editor.point(e,l,{edge:u?"start":"end"}),f=u?i.Editor.before(e,d):i.Editor.after(e,d);if(f)return i.Editor.range(e,f)}var h=this.getWindow(e).document;if(h.caretRangeFromPoint)a=h.caretRangeFromPoint(n,r);else{var p=h.caretPositionFromPoint(n,r);p&&((a=h.createRange()).setStart(p.offsetNode,p.offset),a.setEnd(p.offsetNode,p.offset))}if(!a)throw new Error("Cannot resolve a Slate range from a DOM event: ".concat(t));return Ct.toSlateRange(e,a,{exactMatch:!1,suppressThrow:!1})},toSlateRange:function(e,t,n){var r,o,a,s,l,c=n.exactMatch,u=n.suppressThrow;if((Ie(t)?t.anchorNode:t.startContainer)&&(Ie(t)?(r=t.anchorNode,o=t.anchorOffset,a=t.focusNode,s=t.focusOffset,l=wt&&He()?t.anchorNode===t.focusNode&&t.anchorOffset===t.focusOffset:t.isCollapsed):(r=t.startContainer,o=t.startOffset,a=t.endContainer,s=t.endOffset,l=t.collapsed)),null==r||null==a||null==o||null==s)throw new Error("Cannot resolve a Slate range from DOM range: ".concat(t));var d=Ct.toSlatePoint(e,[r,o],{exactMatch:c,suppressThrow:u});if(!d)return null;var f=l?d:Ct.toSlatePoint(e,[a,s],{exactMatch:c,suppressThrow:u,searchDirection:xt(r,a)||r===a&&s<o?"forward":"backward"});if(!f)return null;var h={anchor:d,focus:f};return i.Range.isExpanded(h)&&i.Range.isForward(h)&&Fe(a)&&i.Editor.void(e,{at:h.focus,mode:"highest"})&&(h=i.Editor.unhangRange(e,h,{voids:!0})),h},toSlatePoint:function(e,t,n){var r,o,i,a=n.exactMatch,s=n.suppressThrow,c=y(a?t:_e(t),2),u=c[0],d=c[1],f=u.parentNode,h=n.searchDirection,p=null,g=0;if(f){var v=Ct.toDOMNode(e,e),w=f.closest('[data-slate-void="true"]'),E=w&&v.contains(w)?w:null,x=f.closest('[contenteditable="false"]'),S=x&&v.contains(x)?x:null,C=f.closest("[data-slate-leaf]"),k=null,O=Ct.getWindow(e);if(C&&O.document.createRange){p=C.closest('[data-slate-node="text"]');var N=O.document.createRange();N.setStart(p,0),N.setEnd(u,d);var T=N.cloneContents();b(b([],y(l(T.querySelectorAll("[data-slate-zero-width]"))),!1),y(l(T.querySelectorAll("[contenteditable=false]"))),!1).forEach(function(e){e.parentNode.removeChild(e)}),g=T.textContent.length,k=p}else if(E)(C=Array.from(E.querySelectorAll("[data-slate-leaf]")).find(function(t){return Ct.hasDOMNode(e,t)})||null)?(p=C.closest('[data-slate-node="text"]'),g=(k=C).textContent.length,k.querySelectorAll("[data-slate-zero-width]").forEach(function(e){g-=e.textContent.length})):g=1;else if(S){var M=Boolean(S.closest("[data-w-e-reserve]"));!h&&M&&(h="forward");var L=h,D=function(t){return t?Array.from(t.querySelectorAll("[data-slate-leaf]")).filter(function(t){return Ct.hasDOMNode(e,t)}):[]},R=S.closest('[data-slate-node="element"]');if("backward"===h||!h)for(var P=($=b(b([],y(D(null==R?void 0:R.previousElementSibling)),!1),y(D(R)),!1)).length-1;P>=0;P-=1){var A=$[P];if(xt(S,A)){C=A,h="backward";break}}if(!C&&("forward"===h||!h||M)){var $=b(b([],y(D(R)),!1),y(D(null==R?void 0:R.nextElementSibling)),!1);try{for(var F=m($),I=F.next();!I.done;I=F.next()){A=I.value;if(St(S,A)){C=A,L="backward"===h&&M?"backward":"forward";break}}}catch(e){r={error:e}}finally{try{I&&!I.done&&(o=F.return)&&o.call(F)}finally{if(r)throw r.error}}}C&&(p=C.closest('[data-slate-node="text"]'),k=C,"forward"===L?g=0:(g=k.textContent.length,k.querySelectorAll("[data-slate-zero-width]").forEach(function(e){g-=e.textContent.length})))}k&&g===k.textContent.length&&(f.hasAttribute("data-slate-zero-width")||vt&&(null===(i=k.textContent)||void 0===i?void 0:i.endsWith("\n")))&&(g-=1)}if(!p){if(s)return null;throw new Error("Cannot resolve a Slate point from DOM point: ".concat(t))}var B,j=Ct.toSlateNode(e,p);try{B=Ct.findPath(e,j)}catch(e){if(s)return null;throw e}return{path:B,offset:g}},hasRange:function(e,t){var n=t.anchor,r=t.focus;return i.Editor.hasPath(e,n.path)&&i.Editor.hasPath(e,r.path)},getNodeType:function(e){return i.Element.isElement(e)?e.type:""},checkNodeType:function(e,t){return this.getNodeType(e)===t},getNodesStr:function(e){return e.map(function(e){return i.Node.string(e)}).join("")},getSelectedElems:function(e){var t,n,r=[],o=i.Editor.nodes(e,{universal:!0});try{for(var a=m(o),s=a.next();!s.done;s=a.next()){var l=y(s.value,1)[0];i.Element.isElement(l)&&r.push(l)}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}return r},getSelectedNodeByType:function(e,t){var n=this,r=y(i.Editor.nodes(e,{match:function(e){return n.checkNodeType(e,t)},universal:!0}),1),o=r[0];return null==o?null:o[0]},getSelectedTextNode:function(e){var t=y(i.Editor.nodes(e,{match:function(e){return i.Text.isText(e)},universal:!0}),1),n=t[0];return null==n?null:n[0]},isNodeSelected:function(e,t){var n=y(i.Editor.nodes(e,{match:function(e){return e===t},universal:!0}),1),r=n[0];return null!=r&&y(r,1)[0]===t},isSelectionAtLineEnd:function(e,t){var n=e.selection;return!!n&&(i.Editor.isEnd(e,n.anchor,t)||i.Editor.isEnd(e,n.focus,t))},getTextarea:function(e){var t=H.get(e);if(null==t)throw new Error("Cannot find textarea instance by editor");return t},getToolbar:function(e){return U.get(e)||null},getHoverbar:function(e){return K.get(e)||null},normalizeContent:function(e){e.children.forEach(function(t,n){e.normalizeNode([t,[n]])})},getLeftLengthOfMaxLength:function(e){var t=e.getConfig(),n=t.maxLength,r=t.onMaxLength;if("number"!=typeof n||n<=0)return 1/0;var o=n-e.getText().replace(/\r|\n|(\r\n)|(\n\r)/g,"").length;return o<=0&&r&&r(e),o},cleanExposedTexNodeInSelectionBlock:function(e){var t,n,r,o,a=Ct.getTextarea(e).$textArea,l=null==a?void 0:a[0].childNodes;if(l)try{for(var c=m(Array.from(l)),u=c.next();!u.done;u=c.next()){var d=u.value;if(!Be(d))break;d.remove()}}catch(e){t={error:e}}finally{try{u&&!u.done&&(n=c.return)&&n.call(c)}finally{if(t)throw t.error}}var f=i.Editor.nodes(e,{match:function(t){return!(!i.Element.isElement(t)||e.isInline(t))},universal:!0});try{for(var h=m(f),p=h.next();!p.done;p=h.next()){var g=p.value;if(null!=g){var v=g[0];if(!Ct.hasDOMNodeBySlateNode(e,v))continue;qe(Ct.toDOMNode(e,v),function(e,t){var n=s(t);n.attr("data-slate-string")||n.attr("data-slate-zero-width")||n.attr("data-w-e-reserve")||t.removeChild(e)})}}}catch(e){r={error:e}}finally{try{p&&!p.done&&(o=h.return)&&o.call(h)}finally{if(r)throw r.error}}},isLastNode:function(e,t){var n=e.children||[];return n[n.length-1]===t},genEmptyParagraph:function(){return{type:"paragraph",children:[{text:""}]}},isSelectedVoidNode:function(e){var t,n,r=i.Editor.nodes(e,{match:function(t){return e.isVoid(t)}}),o=0;try{for(var a=m(r),s=a.next();!s.done;s=a.next()){s.value&&(o+=1)}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}return o>0},isSelectedEmptyParagraph:function(e){var t=e.selection;if(null==t)return!1;if(i.Range.isExpanded(t))return!1;var n=Ct.getSelectedNodeByType(e,"paragraph");if(null===n)return!1;var r=n.children;return 1===r.length&&(""===r[0].text||void 0)},isEmptyPath:function(e,t){var n=i.Editor.node(e,t);if(null==n)return!1;var r=y(n,1)[0].children;if(1===r.length&&""===r[0].text)return!0;return!1}},kt=[];var Ot={};function Nt(e,t,n){var r=n.isInline(e)?"span":"div";return"<".concat(r,">").concat(t,"</").concat(r,">")}var Tt="data-w-e-id",Mt=/^[A-Za-z_:-][A-Za-z0-9_:.-]*$/;function Lt(e,t,n,r){if(!r.includeId)return e;var o=function(e){return e&&Mt.test(e)?e:Tt}(r.idKey),i=Ct.findKey(n,t);return function(e,t,n){if(!e)return e;var r=e.match(/^<([A-Za-z][A-Za-z0-9-]*)([^>]*)>/);if(!r)return e;var o=y(r,3),i=o[0],a=o[1],s=o[2],l=void 0===s?"":s;if(new RegExp("\\s".concat(t,"=")).test(l))return e;var c=/\/\s*$/.test(l),u=l.replace(/\s*\/\s*$/,""),d=u.trim()?" ".concat(u.trim()):"",f=c?" /":"";return"<".concat(a).concat(d," ").concat(t,'="').concat(n,'"').concat(f,">")+e.slice(i.length)}(e,o,ft(Ct.getNodeType(t),i.id))}function Dt(e,t,n){void 0===n&&(n={});var r=e.type,o=void 0===r?"":r,a=e.children,s=void 0===a?[]:a,l=i.Editor.isVoid(t,e),c="";l||(c=s.map(function(e){return Rt(e,t,n)}).join(""));var u=function(e){return Ot[e]||Nt}(o),d=u(e,c,t),f="";if(f="string"==typeof d?d:d.html||"",l||kt.forEach(function(n){return f=n(e,f,t)}),f=Lt(f,e,t,n),"string"==typeof d)return f;var h=d.prefix,p=void 0===h?"":h,g=d.suffix,v=void 0===g?"":g;return p&&(f=p+f),v&&(f+=v),f}function Rt(e,t,n){return void 0===n&&(n={}),i.Element.isElement(e)?Dt(e,t,n):function(e,t){var n=e.text;if(null==n)throw new Error("Current node is not slate Text ".concat(JSON.stringify(e)));var r=n;r=function(e){return e.replace(/ {2}/g," ").replace(/</g,"<").replace(/>/g,">").replace(/®/g,"®").replace(/©/g,"©").replace(/™/g,"™")}(r);var o=Ct.getParentsNodes(t,e).some(function(e){return"pre"===Ct.getNodeType(e)});if(o||(r=r.replace(/\n\r|\r\n|\r|\n/g,"<br>")),o&&(r=r.replace(/ /g," ")),""===r){var i=Ct.getParentNode(null,e);if(!i||0!==i.children.length)return r;r="<br>"}return kt.forEach(function(n){return r=n(e,r,t)}),r}(e,t)}var Pt=function(e,t){var n=(t.top+t.bottom)/2;return e.top<=n&&e.bottom>=n},At=function(e,t,n){var r=Ct.toDOMRange(e,t).getBoundingClientRect(),o=Ct.toDOMRange(e,n).getBoundingClientRect();return Pt(r,o)&&Pt(o,r)},$t=function(e,t){var n,r,o=[];try{for(var a=m(i.Editor.levels(e,{at:t})),s=a.next();!s.done;s=a.next()){var l=y(s.value,2),c=l[0],u=l[1],d=Ct.findKey(e,c);o.push([u,d])}}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}return o};var Ft=function(e){var t=e,n=t.onChange,r=t.insertText,o=t.apply,a=t.deleteBackward,l=t.deleteFragment;return t.insertText=function(e){t.getConfig().readOnly||r(e)},t.apply=function(e){var n,r,a,s,l,c,u,d,f=[];switch(e.type){case"insert_text":case"remove_text":case"set_node":case"split_node":f.push.apply(f,b([],y($t(t,e.path)),!1));break;case"insert_node":case"remove_node":f.push.apply(f,b([],y($t(t,i.Path.parent(e.path))),!1));break;case"merge_node":var h=i.Path.previous(e.path);f.push.apply(f,b([],y($t(t,h)),!1));break;case"move_node":var p=i.Path.common(i.Path.parent(e.path),i.Path.parent(e.newPath));f.push.apply(f,b([],y($t(t,p)),!1));break;case"set_selection":(null===(s=null===(a=e.newProperties)||void 0===a?void 0:a.focus)||void 0===s?void 0:s.path)&&(f.push.apply(f,b([],y($t(t,null===(c=null===(l=e.newProperties)||void 0===l?void 0:l.focus)||void 0===c?void 0:c.path)),!1)),f.push.apply(f,b([],y($t(t,null===(d=null===(u=e.properties)||void 0===u?void 0:u.focus)||void 0===d?void 0:d.path)),!1)))}o(e);try{for(var g=m(f),v=g.next();!v.done;v=g.next()){var w=y(v.value,2),E=w[0],x=w[1],S=y(i.Editor.node(t,E),1)[0];le.set(S,x),"type"in S&&(ee.has(S)&&ee.delete(S),te.has(S)&&te.delete(S))}}catch(e){n={error:e}}finally{try{v&&!v.done&&(r=g.return)&&r.call(g)}finally{if(n)throw n.error}}},t.deleteBackward=function(n){if("line"!==n)return a(n);if(e.selection&&i.Range.isCollapsed(e.selection)){var r=i.Editor.above(e,{match:function(t){return i.Element.isElement(t)&&i.Editor.isBlock(e,t)},at:e.selection});if(r){var o=y(r,2)[1],s=i.Editor.range(e,o,e.selection.anchor),l=function(e,t){var n=i.Editor.range(e,i.Range.end(t)),r=Array.from(i.Editor.positions(e,{at:t})),o=0,a=r.length,s=Math.floor(a/2);if(At(e,i.Editor.range(e,r[o]),n))return i.Editor.range(e,r[o],n);if(r.length<2)return i.Editor.range(e,r[r.length-1],n);for(;s!==r.length&&s!==o;)At(e,i.Editor.range(e,r[s]),n)?a=s:o=s,s=Math.floor((o+a)/2);return i.Editor.range(e,r[a],n)}(t,s);i.Range.isCollapsed(l)||i.Transforms.delete(e,{at:l})}}},t.deleteFragment=function(e){var n=function(e){var t=e.selection;if(null==t||i.Range.isCollapsed(t))return!1;var n=y(i.Range.edges(t),2),r=n[0],o=n[1],a=y(i.Editor.edges(e,[]),2),s=a[0],l=a[1];return i.Point.equals(r,s)&&i.Point.equals(o,l)}(t);l(e),n&&(!function(e){var t=[{type:"paragraph",children:[{text:""}]}];i.Editor.withoutNormalizing(e,function(){for(var n=e.children.length-1;n>=0;n-=1)i.Transforms.removeNodes(e,{at:[n]});i.Transforms.insertNodes(e,t,{at:[0]})})}(t),t.children.length>0&&i.Transforms.select(t,i.Editor.start(t,[])))},t.onChange=function(){var e=t.selection;null!=e&&de.set(t,e),t.emit(A),n()},t.handleTab=function(){t.insertText(" ")},t.getHtml=function(){var e=t.children,n=void 0===e?[]:e,r=t.getConfig().skipCacheTypes,o=void 0===r?["list-item"]:r;return n.map(function(e){var n=Ct.getNodeType(e);if(o.includes(n))return Rt(e,t);var r=te.get(e);if(r)return r;var i=Rt(e,t);return te.set(e,i),i}).join("")},t.getHtmlWithId=function(e){void 0===e&&(e="data-w-e-id");var n=t.children;return(void 0===n?[]:n).map(function(n){return Rt(n,t,{includeId:!0,idKey:e})}).join("")},t.getText=function(){var e=t.children;return(void 0===e?[]:e).map(function(e){return i.Node.string(e)}).join("\n")},t.getSelectionText=function(){var n=t.selection;return null==n?"":i.Editor.string(e,n)},t.getElemsByType=function(e,n){var r,o;void 0===n&&(n=!1);var a=[],s=i.Editor.nodes(t,{at:[],universal:!0});try{for(var l=m(s),c=l.next();!c.done;c=l.next()){var u=y(c.value,1)[0];if(i.Element.isElement(u))if(n?u.type.indexOf(e)>=0:u.type===e){var d=Ct.findKey(t,u),f=ft(u.type,d.id);a.push(v(v({},u),{id:f}))}}}catch(e){r={error:e}}finally{try{c&&!c.done&&(o=l.return)&&o.call(l)}finally{if(r)throw r.error}}return a},t.getElemsByTypePrefix=function(e){return t.getElemsByType(e,!0)},t.isEmpty=function(){var e=t.children,n=void 0===e?[]:e;if(n.length>1)return!1;var r=n[0];if(null==r)return!0;if(!i.Element.isElement(r)||"paragraph"!==r.type)return!1;var o=r.children,a=void 0===o?[]:o;if(a.length>1)return!1;var s=a[0];return null==s||i.Text.isText(s)&&""===s.text},t.clear=function(){for(var e=t.children.length-1;e>=0;e-=1)i.Transforms.removeNodes(t,{at:[e]});0!==t.children.length?function(e){var t=e.children[0];if(1===e.children.length&&i.Element.isElement(t)&&("paragraph"!==t.type||""!==i.Node.string(t))&&""===i.Node.string(t)){var n=[{type:"paragraph",children:[{text:""}]}];i.Editor.withoutNormalizing(e,function(){i.Transforms.removeNodes(e,{at:[0]}),i.Transforms.insertNodes(e,n,{at:[0]})})}}(t):i.Transforms.insertNodes(t,[{type:"paragraph",children:[{text:""}]}])},t.getParentNode=function(e){return Ct.getParentNode(t,e)},t.dangerouslyInsertHtml=function(e,n){if(void 0===e&&(e=""),void 0===n&&(n=!1),e){var r=document.createElement("div");r.innerHTML=e;var o=Array.from(r.childNodes);if(o=o.filter(function(e){var t=e.nodeName;return!!Be(e)||!!Fe(e)&&!me.has(t.toLowerCase())}),0!==o.length){var a=t.selection;if(null!=a){var l=null;if(Ct.isSelectedEmptyParagraph(t)&&!n)l=[a.focus.path[0]];r.setAttribute("hidden","true"),document.body.appendChild(r);var c=0;o.forEach(function(e,n){var r=e.nodeName,a=e.textContent,l=void 0===a?"":a;if(Be(e)){if(!l||!l.trim())return;t.insertNode({text:l})}else if("BR"!==r){var u=e,d=!1;if(Xe.includes(r.toLowerCase()))d=!0;else for(var f in et)if(u.matches(f)){d=!0;break}if(d){var h=ct(s(u),t),p=Array.isArray(h)?h:[h];if(p.forEach(function(e){return function(e,t){e.isInline(t)?(e.insertNode(t),"link"===t.type&&e.insertFragment([{text:""}])):i.Transforms.insertNodes(e,t,{mode:"highest"})}(t,e)}),c+=p.length,Ct.isSelectedVoidNode(t)&&t.move(1),p.some(function(e){return!!i.Element.isElement(e)&&(!!t.isInline(e)||e.children.some(function(e){return i.Element.isElement(e)&&t.isInline(e)}))})&&t.selection){var g=i.Editor.nodes(t,{at:t.selection,match:function(e){return i.Element.isElement(e)&&t.isInline(e)},universal:!0}).next().value;if(g){var v=y(g,2)[1],m=i.Path.next(v);i.Editor.hasPath(t,m)?i.Transforms.select(t,{anchor:{path:m,offset:0},focus:{path:m,offset:0}}):t.move(1)}}}else{var b=window.getComputedStyle(u).display;if(!Ct.isSelectedEmptyParagraph(t)&&b.indexOf("inline")<0){if(n>=1){var w=o[n-1];De(w)&&t.insertBreak()}t.insertBreak()}t.dangerouslyInsertHtml(u.innerHTML,!0)}}else t.insertText("\n")}),c&&l&&Ct.isEmptyPath(t,l)&&i.Transforms.removeNodes(t,{at:l}),r.remove()}}}},t.setHtml=function(e){void 0===e&&(e="");var n=t.isDisabled(),r=t.isFocused(),o=JSON.stringify(t.selection);t.enable(),de.delete(t),t.focus(),t.clear();var a=dt(t,null==e?"":e);if(i.Transforms.insertFragment(t,a),r||(t.deselect(),t.blur()),n&&(t.deselect(),t.disable()),t.isFocused())try{var s=JSON.parse(o);i.Range.isRange(s)&&Ct.hasRange(t,s)?t.select(s):t.select(i.Editor.start(t,[]))}catch(e){t.select(i.Editor.start(t,[]))}},t},It=1,Bt=function(e){var t=e;return t.id="wangEditor-".concat(It),It+=1,t.isDestroyed=!1,t.isFullScreen=!1,t.focus=function(e){if(Ct.toDOMNode(t,t).focus({preventScroll:!0}),ue.set(t,!0),e){var n=i.Editor.end(t,[]);i.Transforms.select(t,n)}else{var r=de.get(t);r?i.Transforms.select(t,r):i.Transforms.select(t,i.Editor.start(t,[]))}},t.isFocused=function(){return!!ue.get(t)},t.blur=function(){Ct.toDOMNode(t,t).blur(),i.Transforms.deselect(t),ue.set(t,!1)},t.updateView=function(){Ct.getTextarea(t).changeViewState();var e=Ct.getToolbar(t);e&&e.changeToolbarState();var n=Ct.getHoverbar(t);n&&n.changeHoverbarState()},t.destroy=function(){if(!t.isDestroyed){var e=Ct.getTextarea(t);e.destroy(),H.delete(t),W.delete(e);var n=Ct.getToolbar(t);n&&(n.destroy(),U.delete(t),V.delete(n));var r=Ct.getHoverbar(t);r&&(r.destroy(),K.delete(t),z.delete(r)),t.isDestroyed=!0,t.emit(P)}},t.scrollToElem=function(e){if(!t.getConfig().scroll){var n="编辑器禁用了 scroll ,编辑器内容无法滚动,请自行实现该功能";return n+="\nYou has disabled editor scroll, please do this yourself",void console.warn(n)}var r=s("#".concat(e));if(0!==r.length){var o=r[0];if(!Ct.hasDOMNode(t,o)){n="Element (found by id is '".concat(e,"') is not in editor DOM");return n+="\n 通过 id '".concat(e,"' 找到的 element 不在 editor DOM 之内"),void console.error(n,o)}var i=Ct.getTextarea(t),a=i.$textAreaContainer,l=i.$scroll,c=r.offset().top,u=a.offset().top;l[0].scrollBy({top:c-u,behavior:"smooth"})}},t.showProgressBar=function(e){e<1||Ct.getTextarea(t).changeProgress(e)},t.hidePanelOrModal=function(){var e=J.get(t);null!=e&&e.forEach(function(e){return e.hide()})},t.enable=function(){t.getConfig().readOnly=!1,t.updateView()},t.disable=function(){t.getConfig().readOnly=!0,t.updateView()},t.isDisabled=function(){return t.getConfig().readOnly},t.toDOMNode=function(e){return Ct.toDOMNode(t,e)},t.fullScreen=function(){if(!t.isFullScreen){var e=null,n=Ct.getToolbar(t);n&&(e=n.$box);var r=Ct.getTextarea(t).$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()),t.isFullScreen=!0,t.emit(F)}},t.unFullScreen=function(){if(t.isFullScreen){var e=Ct.getTextarea(t).$box.parent();setTimeout(function(){e.removeClass("w-e-full-screen-container"),t.isFullScreen=!1,t.emit(I)},200)}},t.getEditableContainer=function(){return Ct.getTextarea(t).$textAreaContainer[0]},t};function jt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var _t,Ht,Wt,Vt,Ut,zt,Kt,qt,Jt,Gt,Yt,Xt,Zt,Qt,en,tn,nn,rn,on,an,sn,ln,cn,un,dn,fn,hn,pn,gn,vn,mn,yn,bn,wn,En,xn,Sn,Cn,kn,On,Nn={exports:{}},Tn={exports:{}};function Mn(){if(Ht)return _t;Ht=1;return _t=function(e){return null!=e}}function Ln(){if(zt)return Ut;zt=1;var e=function(){if(Vt)return Wt;Vt=1;var e=Mn(),t={object:!0,function:!0,undefined:!0};return Wt=function(n){return!!e(n)&&hasOwnProperty.call(t,typeof n)}}();return Ut=function(t){if(!e(t))return!1;try{return!!t.constructor&&t.constructor.prototype===t}catch(e){return!1}}}function Dn(){if(Gt)return Jt;Gt=1;var e=function(){if(qt)return Kt;qt=1;var e=Ln();return Kt=function(t){if("function"!=typeof t)return!1;if(!hasOwnProperty.call(t,"length"))return!1;try{if("number"!=typeof t.length)return!1;if("function"!=typeof t.call)return!1;if("function"!=typeof t.apply)return!1}catch(e){return!1}return!e(t)}}(),t=/^\s*class[\s{/}]/,n=Function.prototype.toString;return Jt=function(r){return!!e(r)&&!t.test(n.call(r))}}function Rn(){if(rn)return nn;rn=1;var e=(tn?en:(tn=1,en=function(){}))();return nn=function(t){return t!==e&&null!==t}}function Pn(){return ln||(ln=1,sn=(Qt?Zt:(Qt=1,Zt=function(){try{return Object.keys("primitive"),!0}catch(e){return!1}}))()?Object.keys:function(){if(an)return on;an=1;var e=Rn(),t=Object.keys;return on=function(n){return t(e(n)?Object(n):n)}}()),sn}function An(){if(fn)return dn;fn=1;var e=Pn(),t=function(){if(un)return cn;un=1;var e=Rn();return cn=function(t){if(!e(t))throw new TypeError("Cannot use null or undefined");return t}}(),n=Math.max;return dn=function(r,o){var i,a,s,l=n(arguments.length,2);for(r=Object(t(r)),s=function(e){try{r[e]=o[e]}catch(e){i||(i=e)}},a=1;a<l;++a)e(o=arguments[a]).forEach(s);if(void 0!==i)throw i;return r},dn}function $n(){return pn?hn:(pn=1,hn=(Xt||(Xt=1,Yt=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")}),Yt)()?Object.assign:An())}function Fn(){return xn||(xn=1,En=function(){if(yn)return mn;yn=1;var e="razdwatrzy";return mn=function(){return"function"==typeof e.contains&&!0===e.contains("dwa")&&!1===e.contains("foo")}}()()?String.prototype.contains:function(){if(wn)return bn;wn=1;var e=String.prototype.indexOf;return bn=function(t){return e.call(this,t,arguments[1])>-1},bn}()),En}function In(){if(Sn)return Tn.exports;Sn=1;var e=Mn(),t=Dn(),n=$n(),r=function(){if(vn)return gn;vn=1;var e=Rn(),t=Array.prototype.forEach,n=Object.create;return gn=function(r){var o=n(null);return t.call(arguments,function(t){e(t)&&function(e,t){var n;for(n in e)t[n]=e[n]}(Object(t),o)}),o},gn}(),o=Fn(),i=Tn.exports=function(t,i){var a,s,l,c,u;return arguments.length<2||"string"!=typeof t?(c=i,i=t,t=null):c=arguments[2],e(t)?(a=o.call(t,"c"),s=o.call(t,"e"),l=o.call(t,"w")):(a=l=!0,s=!1),u={value:i,configurable:a,enumerable:s,writable:l},c?n(r(c),u):u};return i.gs=function(i,a,s){var l,c,u,d;return"string"!=typeof i?(u=s,s=a,a=i,i=null):u=arguments[3],e(a)?t(a)?e(s)?t(s)||(u=s,s=void 0):s=void 0:(u=a,a=s=void 0):a=void 0,e(i)?(l=o.call(i,"c"),c=o.call(i,"e")):(l=!0,c=!1),d={get:a,set:s,configurable:l,enumerable:c},u?n(r(u),d):d},Tn.exports}var Bn=(On||(On=1,function(e,t){var n,r,o,i,a,s,l,c=In(),u=kn?Cn:(kn=1,Cn=function(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");return e}),d=Function.prototype.apply,f=Function.prototype.call,h=Object.create,p=Object.defineProperty,g=Object.defineProperties,v=Object.prototype.hasOwnProperty,m={configurable:!0,enumerable:!1,writable:!0};r=function(e,t){var r,i;return u(t),i=this,n.call(this,e,r=function(){o.call(i,e,r),d.call(t,this,arguments)}),r.__eeOnceListener__=t,this},i=function(e){var t,n,r,o,i;if(v.call(this,"__ee__")&&(o=this.__ee__[e]))if("object"==typeof o){for(n=arguments.length,i=new Array(n-1),t=1;t<n;++t)i[t-1]=arguments[t];for(o=o.slice(),t=0;r=o[t];++t)d.call(r,this,i)}else switch(arguments.length){case 1:f.call(o,this);break;case 2:f.call(o,this,arguments[1]);break;case 3:f.call(o,this,arguments[1],arguments[2]);break;default:for(n=arguments.length,i=new Array(n-1),t=1;t<n;++t)i[t-1]=arguments[t];d.call(o,this,i)}},a={on:n=function(e,t){var n;return u(t),v.call(this,"__ee__")?n=this.__ee__:(n=m.value=h(null),p(this,"__ee__",m),m.value=null),n[e]?"object"==typeof n[e]?n[e].push(t):n[e]=[n[e],t]:n[e]=t,this},once:r,off:o=function(e,t){var n,r,o,i;if(u(t),!v.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},emit:i},s={on:c(n),once:c(r),off:c(o),emit:c(i)},l=g({},s),e.exports=t=function(e){return null==e?h(l):g(Object(e),s)},t.methods=a}(Nn,Nn.exports)),Nn.exports),jn=jt(Bn);function _n(e){var t=fe.get(e);return null==t&&(t=jn(),fe.set(e,t)),t}var Hn=new WeakMap;function Wn(e,t){var n=Hn.get(e);null==n&&(n=new Set,Hn.set(e,n)),n.add(t)}var Vn=function(e){var t=e;return t.on=function(e,n){var r=_n(t);if(r.on(e,n),"destroyed"===e&&Wn(t,n),"destroyed"!==e){var o=function(){return r.off(e,n)};r.on("destroyed",o),Wn(t,o)}},t.once=function(e,n){_n(t).once(e,n)},t.off=function(e,n){_n(t).off(e,n)},t.emit=function(e){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];var o=_n(t);if(o.emit.apply(o,b([e],y(n),!1)),"destroyed"===e){var i=function(e){return Hn.get(e)||new Set}(t);i.forEach(function(e){return o.off("destroyed",e)}),function(e){Hn.set(e,new Set)}(t)}},t};var Un,zn=function(e){var t=e;return t.setFragmentData=function(e){var n=t.selection;if(n){var r=y(i.Range.edges(n),2),o=r[0],a=r[1],s=i.Editor.void(t,{at:o.path}),l=i.Editor.void(t,{at:a.path});if(!i.Range.isCollapsed(n)||s){var c=Ct.toDOMRange(t,n),u=c.cloneContents(),d=u.childNodes[0];if(u.childNodes.forEach(function(e){e.textContent&&""!==e.textContent.trim()&&(d=e)}),l){var f=y(l,1)[0],h=c.cloneRange(),p=Ct.toDOMNode(t,f);h.setEndAfter(p),u=h.cloneContents()}if(s&&(d=u.querySelector("[data-slate-spacer]")),Array.from(u.querySelectorAll("[data-slate-zero-width]")).forEach(function(e){var t="n"===e.getAttribute("data-slate-zero-width");e.textContent=t?"\n":""}),Be(d)){var g=d.ownerDocument.createElement("span");g.style.whiteSpace="pre",g.appendChild(d),u.appendChild(g),d=g}var v=t.getFragment(),m=JSON.stringify(v),b=window.btoa(encodeURIComponent(m));d.setAttribute("data-slate-fragment",b),e.setData("application/x-slate-fragment",b);var w=u.ownerDocument.createElement("div");return w.appendChild(u),w.setAttribute("hidden","true"),u.ownerDocument.body.appendChild(w),e.setData("text/html",w.innerHTML),e.setData("text/plain",ze(w)),u.ownerDocument.body.removeChild(w),e}}},t.insertData=function(e){var n=e.getData("application/x-slate-fragment");if(n){var r=decodeURIComponent(window.atob(n)),o=JSON.parse(r);t.insertFragment(o)}else{var i=e.getData("text/plain"),a=e.getData("text/html");if(a){var s=t.getConfig().sanitizeHtml;t.dangerouslyInsertHtml(s?s(a):a)}else if(i){if(!/[\r\n]/.test(i))return void t.insertText(i);var l=function(e){return e.replace(/\n\r|\r\n|\r/g,"\n").split("\n").map(function(e){return{type:"paragraph",children:[{text:e}]}})}(i);t.insertFragment(l)}}},t},Kn={};function qn(){if(Un)return Kn;Un=1;var e=i,t={isHistory:function(t){return e.isObject(t)&&Array.isArray(t.redos)&&Array.isArray(t.undos)&&(0===t.redos.length||e.Operation.isOperationList(t.redos[0].operations))&&(0===t.undos.length||e.Operation.isOperationList(t.undos[0].operations))}},n=new WeakMap,r=new WeakMap,o=new WeakMap,a=new WeakMap,s={isHistoryEditor:function(n){return t.isHistory(n.history)&&e.Editor.isEditor(n)},isMerging:function(e){return o.get(e)},isSplittingOnce:function(e){return a.get(e)},setSplittingOnce:function(e,t){a.set(e,t)},isSaving:function(e){return r.get(e)},redo:function(e){e.redo()},undo:function(e){e.undo()},withMerging:function(e,t){var n=s.isMerging(e);o.set(e,!0),t(),o.set(e,n)},withNewBatch:function(e,t){var n=s.isMerging(e);o.set(e,!0),a.set(e,!0),t(),o.set(e,n),a.delete(e)},withoutMerging:function(e,t){var n=s.isMerging(e);o.set(e,!1),t(),o.set(e,n)},withoutSaving:function(e,t){var n=s.isSaving(e);r.set(e,!1);try{t()}finally{r.set(e,n)}}};function l(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return c(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return c(e,t)}(e))||t){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){s=!0,i=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw i}}}}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var u=function(t,n){return!(!n||"insert_text"!==t.type||"insert_text"!==n.type||t.offset!==n.offset+n.text.length||!e.Path.equals(t.path,n.path))||!(!n||"remove_text"!==t.type||"remove_text"!==n.type||t.offset+t.text.length!==n.offset||!e.Path.equals(t.path,n.path))},d=function(e,t){return"set_selection"!==e.type};return Kn.HISTORY=n,Kn.History=t,Kn.HistoryEditor=s,Kn.MERGING=o,Kn.SAVING=r,Kn.SPLITTING_ONCE=a,Kn.withHistory=function(t){var n=t,r=n.apply;return n.history={undos:[],redos:[]},n.redo=function(){var t=n.history,r=t.redos;if(r.length>0){var o=r[r.length-1];o.selectionBefore&&e.Transforms.setSelection(n,o.selectionBefore),s.withoutSaving(n,function(){e.Editor.withoutNormalizing(n,function(){var e,t=l(o.operations);try{for(t.s();!(e=t.n()).done;){var r=e.value;n.apply(r)}}catch(e){t.e(e)}finally{t.f()}})}),t.redos.pop(),n.writeHistory("undos",o)}},n.undo=function(){var t=n.history,r=t.undos;if(r.length>0){var o=r[r.length-1];s.withoutSaving(n,function(){e.Editor.withoutNormalizing(n,function(){var t,r=l(o.operations.map(e.Operation.inverse).reverse());try{for(r.s();!(t=r.n()).done;){var i=t.value;n.apply(i)}}catch(e){r.e(e)}finally{r.f()}o.selectionBefore&&e.Transforms.setSelection(n,o.selectionBefore)})}),n.writeHistory("redos",o),t.undos.pop()}},n.apply=function(e){var t=n.operations,o=n.history,i=o.undos,a=i[i.length-1],l=a&&a.operations[a.operations.length-1],c=s.isSaving(n),f=s.isMerging(n);if(null==c&&(c=d(e)),c){if(null==f&&(f=null!=a&&(!!t.includes(l)||u(e,l))),s.isSplittingOnce(n)&&(f=!1,s.setSplittingOnce(n,void 0)),a&&f)a.operations.push(e);else{var h={operations:[e],selectionBefore:n.selection};n.writeHistory("undos",h)}for(;i.length>100;)i.shift();o.redos=[]}r(e)},n.writeHistory=function(e,t){n.history[e].push(t)},n},Kn}var Jn=qn(),Gn=function(e){var t=Jn.withHistory(e);return t.clearHistory=function(){t.history.undos=[],t.history.redos=[]},t};function Yn(e){return e.replace(/\n\r|\r\n|\r|\n/g,"").length}function Xn(e,t){var n,r;if(t<=0)return"";var o=t,i="";try{for(var a=m(e),s=a.next();!s.done;s=a.next()){var l=s.value;if(/\r|\n/.test(l))i+=l;else{if(o<=0)break;i+=l,o-=1}}}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}return i}var Zn=function(e){var t=e,n=t.insertText,r=t.insertNode,o=t.insertFragment,a=t.dangerouslyInsertHtml;return t.insertText=function(e){if(t.getConfig().maxLength){var r=Ct.getLeftLengthOfMaxLength(t);r<=0||(r<e.length?n(e.slice(0,r)):n(e))}else n(e)},t.insertNode=function(e){if(t.getConfig().maxLength){var n=Ct.getLeftLengthOfMaxLength(t);if(!(n<=0))n<i.Node.string(e).length||r(e)}else r(e)},t.insertFragment=function(e){if(t.getConfig().maxLength){if(e.length>0){var n=e[0];if(Ct.getLeftLengthOfMaxLength(t)<i.Node.string(n).length)return;o([n]);for(var r=1;r<e.length;r+=1)t.insertNode(e[r])}}else o(e)},t.dangerouslyInsertHtml=function(e,n){if(void 0===e&&(e=""),void 0===n&&(n=!1),e)if(t.getConfig().maxLength){var r=Ct.getLeftLengthOfMaxLength(t);if(!(r<=0)){var o=function(e,t){if(t<=0)return"";var n=document.createElement("div");n.innerHTML=e;var r=function(e){e.forEach(function(e){return e.remove()})},o=function(e){for(var n=Array.from(e.childNodes),i=0;i<n.length;i+=1){var a=n[i];if(Be(a)){var s=a.textContent||"",l=Yn(s);if(l<=t){t-=l;continue}return a.textContent=Xn(s,t),t=0,r(n.slice(i+1)),!1}if(Fe(a)){if(me.has(a.nodeName.toLowerCase())){a.remove();continue}if(!o(a))return r(n.slice(i+1)),!1}else a.remove()}return t>0};return o(n),n.innerHTML}(e,r);o&&a(o,n)}}else a(e,n)},t};function Qn(e){return e<0?0:e}function er(e){var t=Ct.getTextarea(e).$textAreaContainer,n=t.width(),r=t.height(),o=t.offset();return{top:o.top,left:o.left,width:n,height:r}}function tr(e){var t={top:"0",left:"0"},n=e.selection;if(null==n)return t;var r=er(e);if(null==r)return t;var o=r.top,i=r.left,a=r.width,s=r.height,l=Ct.toDOMRange(e,n).getClientRects(),c=l?l[0]:null;if(null==c)return t;var u={},d=c.top-o,f=c.left-i;if(f>a/2){var h=Qn(a-f);u.right="".concat(h+5,"px")}else{var p=Qn(f);u.left="".concat(p+5,"px")}if(d>s/2){var g=Qn(s-d);u.bottom="".concat(g+5,"px")}else{var v=l[l.length-1],m=v.top-o+v.height;m<0&&(m=0),u.top="".concat(m+5,"px")}return u}function nr(e,t,n){void 0===n&&(n="modal");var r={top:"0",left:"0"};if(null==e.selection)return r;var o=i.Element.isElement(t)&&e.isVoid(t),a=i.Element.isElement(t)&&e.isInline(t),s=se.get(t);if(null==s)return r;var l=s.getBoundingClientRect(),c=l.top,u=l.left,d=l.height,f=l.width;if(o){var h=Ke(s);if(null!=h){var p=h.getBoundingClientRect();c=p.top,d=p.height}}var g=er(e);if(null==g)return r;var v=g.top,m=g.left,y=g.width,b=g.height,w={},E=c-v,x=u-m;if("bar"===n){if(w.left="".concat(Qn(x),"px"),E>40){var S=Qn(b-E);w.bottom="".concat(S+5,"px")}else w.top="".concat(E+d+5,"px");return w}if("modal"===n){if(o)if(a)if(x>(y-f)/2){var C=Qn(y-x);w.right="".concat(C+5,"px")}else{var k=Qn(x+f);w.left="".concat(k+5,"px")}else w.left="20px";else w.left="".concat(Qn(x),"px");if(o)(O=E)<0&&(O=0),w.top="".concat(O,"px");else if(E>(b-d)/2){S=Qn(b-E);w.bottom="".concat(S+5,"px")}else{var O;(O=E+d)<0&&(O=0),w.top="".concat(O+5,"px")}return w}throw new Error("type '".concat(n,"' is invalid"))}function rr(e,t){w(function(){var n=er(e);if(null!=n){var r,o=n.top,i=n.left,a=n.width,s=n.height,l=t.offset(),c=l.top,u=l.left,d=t.width(),f=t.height(),h=c-o,p=u-i,g=t.attr("style");if(g.indexOf("top")>=0)if((r=h+f-s)>0){var v=t.css("top"),m=parseInt(v.toString(),10)-r;m<0&&(m=0),t.css("top","".concat(m,"px"))}if(g.indexOf("bottom")>=0&&c<0){var y=t.css("bottom"),b=parseInt(y.toString(),10)-Math.abs(c);t.css("bottom","".concat(b,"px"))}if(g.indexOf("left")>=0)if((r=p+d-a)>0){var w=t.css("left"),E=parseInt(w.toString(),10)-r;E<0&&(E=0),t.css("left","".concat(E,"px"))}if(g.indexOf("right")>=0&&u<0){var x=t.css("right"),S=parseInt(x.toString(),10)-Math.abs(u);t.css("right","".concat(S,"px"))}}})}var or=function(e){var t=e,n=t.select,r=t.deselect,o=t.move;return t.select=function(e){n(e)},t.deselect=function(){var e=t.selection,n=Ct.findDocumentOrShadowRoot(t).getSelection();n&&n.rangeCount>0&&Ct.hasDOMNode(t,n.anchorNode)&&Ct.hasDOMNode(t,n.focusNode)&&n.removeAllRanges(),e&&r()},t.move=function(e,t){void 0===t&&(t=!1),"number"==typeof e?e&&(e<0||o({distance:e,unit:"character",reverse:t})):o(e)},t.moveReverse=function(e){t.move(e,!0)},t.restoreSelection=function(){var e=de.get(t);null!=e&&(t.focus(),n(e))},t.getSelectionPosition=function(){return tr(t)},t.getNodePosition=function(e){return nr(t,e)},t.isSelectedAll=function(){var e=t.selection;if(null==e)return!1;var n=y(i.Range.edges(e),2),r=n[0],o=n[1],a=y(i.Editor.edges(t,[]),2),s=a[0],l=a[1];return!(!i.Point.equals(r,s)||!i.Point.equals(o,l))},t.selectAll=function(){var e=i.Editor.start(t,[]),r=i.Editor.end(t,[]);n({anchor:e,focus:r})},t};const ir=e=>"string"==typeof e,ar=()=>{let e,t;const n=new Promise((n,r)=>{e=n,t=r});return n.resolve=e,n.reject=t,n},sr=e=>null==e?"":""+e,lr=/###/g,cr=e=>e&&e.indexOf("###")>-1?e.replace(lr,"."):e,ur=e=>!e||ir(e),dr=(e,t,n)=>{const r=ir(t)?t.split("."):t;let o=0;for(;o<r.length-1;){if(ur(e))return{};const t=cr(r[o]);!e[t]&&n&&(e[t]=new n),e=Object.prototype.hasOwnProperty.call(e,t)?e[t]:{},++o}return ur(e)?{}:{obj:e,k:cr(r[o])}},fr=(e,t,n)=>{const{obj:r,k:o}=dr(e,t,Object);if(void 0!==r||1===t.length)return void(r[o]=n);let i=t[t.length-1],a=t.slice(0,t.length-1),s=dr(e,a,Object);for(;void 0===s.obj&&a.length;)i=`${a[a.length-1]}.${i}`,a=a.slice(0,a.length-1),s=dr(e,a,Object),s&&s.obj&&void 0!==s.obj[`${s.k}.${i}`]&&(s.obj=void 0);s.obj[`${s.k}.${i}`]=n},hr=(e,t)=>{const{obj:n,k:r}=dr(e,t);if(n)return n[r]},pr=(e,t,n)=>{for(const r in t)"__proto__"!==r&&"constructor"!==r&&(r in e?ir(e[r])||e[r]instanceof String||ir(t[r])||t[r]instanceof String?n&&(e[r]=t[r]):pr(e[r],t[r],n):e[r]=t[r]);return e},gr=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var vr={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};const mr=e=>ir(e)?e.replace(/[&<>"'\/]/g,e=>vr[e]):e;const yr=[" ",",","?","!",";"],br=new class{constructor(e){this.capacity=e,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(e){const t=this.regExpMap.get(e);if(void 0!==t)return t;const n=new RegExp(e);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,n),this.regExpQueue.push(e),n}}(20),wr=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:".";if(!e)return;if(e[t])return e[t];const r=t.split(n);let o=e;for(let e=0;e<r.length;){if(!o||"object"!=typeof o)return;let t,i="";for(let a=e;a<r.length;++a)if(a!==e&&(i+=n),i+=r[a],t=o[i],void 0!==t){if(["string","number","boolean"].indexOf(typeof t)>-1&&a<r.length-1)continue;e+=a-e+1;break}o=t}return o},Er=e=>e&&e.replace("_","-"),xr={type:"logger",log(e){this.output("log",e)},warn(e){this.output("warn",e)},error(e){this.output("error",e)},output(e,t){console&&console[e]&&console[e].apply(console,t)}};class Sr{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.init(e,t)}init(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.prefix=t.prefix||"i18next:",this.logger=e||xr,this.options=t,this.debug=t.debug}log(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return this.forward(t,"log","",!0)}warn(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return this.forward(t,"warn","",!0)}error(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return this.forward(t,"error","")}deprecate(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return this.forward(t,"warn","WARNING DEPRECATED: ",!0)}forward(e,t,n,r){return r&&!this.debug?null:(ir(e[0])&&(e[0]=`${n}${this.prefix} ${e[0]}`),this.logger[t](e))}create(e){return new Sr(this.logger,{prefix:`${this.prefix}:${e}:`,...this.options})}clone(e){return(e=e||this.options).prefix=e.prefix||this.prefix,new Sr(this.logger,e)}}var Cr=new Sr;class kr{constructor(){this.observers={}}on(e,t){return e.split(" ").forEach(e=>{this.observers[e]||(this.observers[e]=new Map);const n=this.observers[e].get(t)||0;this.observers[e].set(t,n+1)}),this}off(e,t){this.observers[e]&&(t?this.observers[e].delete(t):delete this.observers[e])}emit(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];if(this.observers[e]){Array.from(this.observers[e].entries()).forEach(e=>{let[t,r]=e;for(let e=0;e<r;e++)t(...n)})}if(this.observers["*"]){Array.from(this.observers["*"].entries()).forEach(t=>{let[r,o]=t;for(let t=0;t<o;t++)r.apply(r,[e,...n])})}}}class Or extends kr{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{ns:["translation"],defaultNS:"translation"};super(),this.data=e||{},this.options=t,void 0===this.options.keySeparator&&(this.options.keySeparator="."),void 0===this.options.ignoreJSONStructure&&(this.options.ignoreJSONStructure=!0)}addNamespaces(e){this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}removeNamespaces(e){const t=this.options.ns.indexOf(e);t>-1&&this.options.ns.splice(t,1)}getResource(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const o=void 0!==r.keySeparator?r.keySeparator:this.options.keySeparator,i=void 0!==r.ignoreJSONStructure?r.ignoreJSONStructure:this.options.ignoreJSONStructure;let a;e.indexOf(".")>-1?a=e.split("."):(a=[e,t],n&&(Array.isArray(n)?a.push(...n):ir(n)&&o?a.push(...n.split(o)):a.push(n)));const s=hr(this.data,a);return!s&&!t&&!n&&e.indexOf(".")>-1&&(e=a[0],t=a[1],n=a.slice(2).join(".")),!s&&i&&ir(n)?wr(this.data&&this.data[e]&&this.data[e][t],n,o):s}addResource(e,t,n,r){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{silent:!1};const i=void 0!==o.keySeparator?o.keySeparator:this.options.keySeparator;let a=[e,t];n&&(a=a.concat(i?n.split(i):n)),e.indexOf(".")>-1&&(a=e.split("."),r=t,t=a[1]),this.addNamespaces(t),fr(this.data,a,r),o.silent||this.emit("added",e,t,n,r)}addResources(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{silent:!1};for(const r in n)(ir(n[r])||Array.isArray(n[r]))&&this.addResource(e,t,r,n[r],{silent:!0});r.silent||this.emit("added",e,t,n)}addResourceBundle(e,t,n,r,o){let i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{silent:!1,skipCopy:!1},a=[e,t];e.indexOf(".")>-1&&(a=e.split("."),r=n,n=t,t=a[1]),this.addNamespaces(t);let s=hr(this.data,a)||{};i.skipCopy||(n=JSON.parse(JSON.stringify(n))),r?pr(s,n,o):s={...s,...n},fr(this.data,a,s),i.silent||this.emit("added",e,t,n)}removeResourceBundle(e,t){this.hasResourceBundle(e,t)&&delete this.data[e][t],this.removeNamespaces(t),this.emit("removed",e,t)}hasResourceBundle(e,t){return void 0!==this.getResource(e,t)}getResourceBundle(e,t){return t||(t=this.options.defaultNS),"v1"===this.options.compatibilityAPI?{...this.getResource(e,t)}:this.getResource(e,t)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){const t=this.getDataByLanguage(e);return!!(t&&Object.keys(t)||[]).find(e=>t[e]&&Object.keys(t[e]).length>0)}toJSON(){return this.data}}var Nr={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,n,r,o){return e.forEach(e=>{this.processors[e]&&(t=this.processors[e].process(t,n,r,o))}),t}};const Tr={};class Mr extends kr{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(),((e,t,n)=>{e.forEach(e=>{t[e]&&(n[e]=t[e])})})(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,this),this.options=t,void 0===this.options.keySeparator&&(this.options.keySeparator="."),this.logger=Cr.create("translator")}changeLanguage(e){e&&(this.language=e)}exists(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{interpolation:{}};if(null==e)return!1;const n=this.resolve(e,t);return n&&void 0!==n.res}extractFromKey(e,t){let n=void 0!==t.nsSeparator?t.nsSeparator:this.options.nsSeparator;void 0===n&&(n=":");const r=void 0!==t.keySeparator?t.keySeparator:this.options.keySeparator;let o=t.ns||this.options.defaultNS||[];const i=n&&e.indexOf(n)>-1,a=!(this.options.userDefinedKeySeparator||t.keySeparator||this.options.userDefinedNsSeparator||t.nsSeparator||((e,t,n)=>{t=t||"",n=n||"";const r=yr.filter(e=>t.indexOf(e)<0&&n.indexOf(e)<0);if(0===r.length)return!0;const o=br.getRegExp(`(${r.map(e=>"?"===e?"\\?":e).join("|")})`);let i=!o.test(e);if(!i){const t=e.indexOf(n);t>0&&!o.test(e.substring(0,t))&&(i=!0)}return i})(e,n,r));if(i&&!a){const t=e.match(this.interpolator.nestingRegexp);if(t&&t.length>0)return{key:e,namespaces:ir(o)?[o]:o};const i=e.split(n);(n!==r||n===r&&this.options.ns.indexOf(i[0])>-1)&&(o=i.shift()),e=i.join(r)}return{key:e,namespaces:ir(o)?[o]:o}}translate(e,t,n){if("object"!=typeof t&&this.options.overloadTranslationOptionHandler&&(t=this.options.overloadTranslationOptionHandler(arguments)),"object"==typeof t&&(t={...t}),t||(t={}),null==e)return"";Array.isArray(e)||(e=[String(e)]);const r=void 0!==t.returnDetails?t.returnDetails:this.options.returnDetails,o=void 0!==t.keySeparator?t.keySeparator:this.options.keySeparator,{key:i,namespaces:a}=this.extractFromKey(e[e.length-1],t),s=a[a.length-1],l=t.lng||this.language,c=t.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(l&&"cimode"===l.toLowerCase()){if(c){const e=t.nsSeparator||this.options.nsSeparator;return r?{res:`${s}${e}${i}`,usedKey:i,exactUsedKey:i,usedLng:l,usedNS:s,usedParams:this.getUsedParamsDetails(t)}:`${s}${e}${i}`}return r?{res:i,usedKey:i,exactUsedKey:i,usedLng:l,usedNS:s,usedParams:this.getUsedParamsDetails(t)}:i}const u=this.resolve(e,t);let d=u&&u.res;const f=u&&u.usedKey||i,h=u&&u.exactUsedKey||i,p=Object.prototype.toString.apply(d),g=void 0!==t.joinArrays?t.joinArrays:this.options.joinArrays,v=!this.i18nFormat||this.i18nFormat.handleAsObject,m=!ir(d)&&"boolean"!=typeof d&&"number"!=typeof d;if(!(v&&d&&m&&["[object Number]","[object Function]","[object RegExp]"].indexOf(p)<0)||ir(g)&&Array.isArray(d))if(v&&ir(g)&&Array.isArray(d))d=d.join(g),d&&(d=this.extendTranslation(d,e,t,n));else{let r=!1,a=!1;const c=void 0!==t.count&&!ir(t.count),f=Mr.hasDefaultValue(t),h=c?this.pluralResolver.getSuffix(l,t.count,t):"",p=t.ordinal&&c?this.pluralResolver.getSuffix(l,t.count,{ordinal:!1}):"",g=c&&!t.ordinal&&0===t.count&&this.pluralResolver.shouldUseIntlApi(),v=g&&t[`defaultValue${this.options.pluralSeparator}zero`]||t[`defaultValue${h}`]||t[`defaultValue${p}`]||t.defaultValue;!this.isValidLookup(d)&&f&&(r=!0,d=v),this.isValidLookup(d)||(a=!0,d=i);const m=(t.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&a?void 0:d,y=f&&v!==d&&this.options.updateMissing;if(a||r||y){if(this.logger.log(y?"updateKey":"missingKey",l,s,i,y?v:d),o){const e=this.resolve(i,{...t,keySeparator:!1});e&&e.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.")}let e=[];const n=this.languageUtils.getFallbackCodes(this.options.fallbackLng,t.lng||this.language);if("fallback"===this.options.saveMissingTo&&n&&n[0])for(let t=0;t<n.length;t++)e.push(n[t]);else"all"===this.options.saveMissingTo?e=this.languageUtils.toResolveHierarchy(t.lng||this.language):e.push(t.lng||this.language);const r=(e,n,r)=>{const o=f&&r!==d?r:m;this.options.missingKeyHandler?this.options.missingKeyHandler(e,s,n,o,y,t):this.backendConnector&&this.backendConnector.saveMissing&&this.backendConnector.saveMissing(e,s,n,o,y,t),this.emit("missingKey",e,s,n,d)};this.options.saveMissing&&(this.options.saveMissingPlurals&&c?e.forEach(e=>{const n=this.pluralResolver.getSuffixes(e,t);g&&t[`defaultValue${this.options.pluralSeparator}zero`]&&n.indexOf(`${this.options.pluralSeparator}zero`)<0&&n.push(`${this.options.pluralSeparator}zero`),n.forEach(n=>{r([e],i+n,t[`defaultValue${n}`]||v)})}):r(e,i,v))}d=this.extendTranslation(d,e,t,u,n),a&&d===i&&this.options.appendNamespaceToMissingKey&&(d=`${s}:${i}`),(a||r)&&this.options.parseMissingKeyHandler&&(d="v1"!==this.options.compatibilityAPI?this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${s}:${i}`:i,r?d:void 0):this.options.parseMissingKeyHandler(d))}else{if(!t.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const e=this.options.returnedObjectHandler?this.options.returnedObjectHandler(f,d,{...t,ns:a}):`key '${i} (${this.language})' returned an object instead of string.`;return r?(u.res=e,u.usedParams=this.getUsedParamsDetails(t),u):e}if(o){const e=Array.isArray(d),n=e?[]:{},r=e?h:f;for(const e in d)if(Object.prototype.hasOwnProperty.call(d,e)){const i=`${r}${o}${e}`;n[e]=this.translate(i,{...t,joinArrays:!1,ns:a}),n[e]===i&&(n[e]=d[e])}d=n}}return r?(u.res=d,u.usedParams=this.getUsedParamsDetails(t),u):d}extendTranslation(e,t,n,r,o){var i=this;if(this.i18nFormat&&this.i18nFormat.parse)e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...n},n.lng||this.language||r.usedLng,r.usedNS,r.usedKey,{resolved:r});else if(!n.skipInterpolation){n.interpolation&&this.interpolator.init({...n,interpolation:{...this.options.interpolation,...n.interpolation}});const a=ir(e)&&(n&&n.interpolation&&void 0!==n.interpolation.skipOnVariables?n.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let s;if(a){const t=e.match(this.interpolator.nestingRegexp);s=t&&t.length}let l=n.replace&&!ir(n.replace)?n.replace:n;if(this.options.interpolation.defaultVariables&&(l={...this.options.interpolation.defaultVariables,...l}),e=this.interpolator.interpolate(e,l,n.lng||this.language||r.usedLng,n),a){const t=e.match(this.interpolator.nestingRegexp);s<(t&&t.length)&&(n.nest=!1)}!n.lng&&"v1"!==this.options.compatibilityAPI&&r&&r.res&&(n.lng=this.language||r.usedLng),!1!==n.nest&&(e=this.interpolator.nest(e,function(){for(var e=arguments.length,r=new Array(e),a=0;a<e;a++)r[a]=arguments[a];return o&&o[0]===r[0]&&!n.context?(i.logger.warn(`It seems you are nesting recursively key: ${r[0]} in key: ${t[0]}`),null):i.translate(...r,t)},n)),n.interpolation&&this.interpolator.reset()}const a=n.postProcess||this.options.postProcess,s=ir(a)?[a]:a;return null!=e&&s&&s.length&&!1!==n.applyPostProcessor&&(e=Nr.handle(s,e,t,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...r,usedParams:this.getUsedParamsDetails(n)},...n}:n,this)),e}resolve(e){let t,n,r,o,i,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return ir(e)&&(e=[e]),e.forEach(e=>{if(this.isValidLookup(t))return;const s=this.extractFromKey(e,a),l=s.key;n=l;let c=s.namespaces;this.options.fallbackNS&&(c=c.concat(this.options.fallbackNS));const u=void 0!==a.count&&!ir(a.count),d=u&&!a.ordinal&&0===a.count&&this.pluralResolver.shouldUseIntlApi(),f=void 0!==a.context&&(ir(a.context)||"number"==typeof a.context)&&""!==a.context,h=a.lngs?a.lngs:this.languageUtils.toResolveHierarchy(a.lng||this.language,a.fallbackLng);c.forEach(e=>{this.isValidLookup(t)||(i=e,!Tr[`${h[0]}-${e}`]&&this.utils&&this.utils.hasLoadedNamespace&&!this.utils.hasLoadedNamespace(i)&&(Tr[`${h[0]}-${e}`]=!0,this.logger.warn(`key "${n}" for languages "${h.join(", ")}" won't get resolved as namespace "${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!!!")),h.forEach(n=>{if(this.isValidLookup(t))return;o=n;const i=[l];if(this.i18nFormat&&this.i18nFormat.addLookupKeys)this.i18nFormat.addLookupKeys(i,l,n,e,a);else{let e;u&&(e=this.pluralResolver.getSuffix(n,a.count,a));const t=`${this.options.pluralSeparator}zero`,r=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(u&&(i.push(l+e),a.ordinal&&0===e.indexOf(r)&&i.push(l+e.replace(r,this.options.pluralSeparator)),d&&i.push(l+t)),f){const n=`${l}${this.options.contextSeparator}${a.context}`;i.push(n),u&&(i.push(n+e),a.ordinal&&0===e.indexOf(r)&&i.push(n+e.replace(r,this.options.pluralSeparator)),d&&i.push(n+t))}}let s;for(;s=i.pop();)this.isValidLookup(t)||(r=s,t=this.getResource(n,e,s,a))}))})}),{res:t,usedKey:n,exactUsedKey:r,usedLng:o,usedNS:i}}isValidLookup(e){return!(void 0===e||!this.options.returnNull&&null===e||!this.options.returnEmptyString&&""===e)}getResource(e,t,n){let 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)}getUsedParamsDetails(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],n=e.replace&&!ir(e.replace);let r=n?e.replace:e;if(n&&void 0!==e.count&&(r.count=e.count),this.options.interpolation.defaultVariables&&(r={...this.options.interpolation.defaultVariables,...r}),!n){r={...r};for(const e of t)delete r[e]}return r}static hasDefaultValue(e){const t="defaultValue";for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t===n.substring(0,12)&&void 0!==e[n])return!0;return!1}}const Lr=e=>e.charAt(0).toUpperCase()+e.slice(1);class Dr{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Cr.create("languageUtils")}getScriptPartFromCode(e){if(!(e=Er(e))||e.indexOf("-")<0)return null;const t=e.split("-");return 2===t.length?null:(t.pop(),"x"===t[t.length-1].toLowerCase()?null:this.formatLanguageCode(t.join("-")))}getLanguagePartFromCode(e){if(!(e=Er(e))||e.indexOf("-")<0)return e;const t=e.split("-");return this.formatLanguageCode(t[0])}formatLanguageCode(e){if(ir(e)&&e.indexOf("-")>-1){if("undefined"!=typeof Intl&&void 0!==Intl.getCanonicalLocales)try{let t=Intl.getCanonicalLocales(e)[0];if(t&&this.options.lowerCaseLng&&(t=t.toLowerCase()),t)return t}catch(e){}const t=["hans","hant","latn","cyrl","cans","mong","arab"];let n=e.split("-");return this.options.lowerCaseLng?n=n.map(e=>e.toLowerCase()):2===n.length?(n[0]=n[0].toLowerCase(),n[1]=n[1].toUpperCase(),t.indexOf(n[1].toLowerCase())>-1&&(n[1]=Lr(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]=Lr(n[1].toLowerCase())),t.indexOf(n[2].toLowerCase())>-1&&(n[2]=Lr(n[2].toLowerCase()))),n.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}isSupportedCode(e){return("languageOnly"===this.options.load||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}getBestMatchFromCodes(e){if(!e)return null;let t;return e.forEach(e=>{if(t)return;const n=this.formatLanguageCode(e);this.options.supportedLngs&&!this.isSupportedCode(n)||(t=n)}),!t&&this.options.supportedLngs&&e.forEach(e=>{if(t)return;const n=this.getLanguagePartFromCode(e);if(this.isSupportedCode(n))return t=n;t=this.options.supportedLngs.find(e=>e===n?e:e.indexOf("-")<0&&n.indexOf("-")<0?void 0:e.indexOf("-")>0&&n.indexOf("-")<0&&e.substring(0,e.indexOf("-"))===n||0===e.indexOf(n)&&n.length>1?e:void 0)}),t||(t=this.getFallbackCodes(this.options.fallbackLng)[0]),t}getFallbackCodes(e,t){if(!e)return[];if("function"==typeof e&&(e=e(t)),ir(e)&&(e=[e]),Array.isArray(e))return e;if(!t)return e.default||[];let 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||[]}toResolveHierarchy(e,t){const n=this.getFallbackCodes(t||this.options.fallbackLng||[],e),r=[],o=e=>{e&&(this.isSupportedCode(e)?r.push(e):this.logger.warn(`rejecting language code not found in supportedLngs: ${e}`))};return ir(e)&&(e.indexOf("-")>-1||e.indexOf("_")>-1)?("languageOnly"!==this.options.load&&o(this.formatLanguageCode(e)),"languageOnly"!==this.options.load&&"currentOnly"!==this.options.load&&o(this.getScriptPartFromCode(e)),"currentOnly"!==this.options.load&&o(this.getLanguagePartFromCode(e))):ir(e)&&o(this.formatLanguageCode(e)),n.forEach(e=>{r.indexOf(e)<0&&o(this.formatLanguageCode(e))}),r}}let Rr=[{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}],Pr={1:e=>Number(e>1),2:e=>Number(1!=e),3:e=>0,4:e=>Number(e%10==1&&e%100!=11?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2),5:e=>Number(0==e?0:1==e?1:2==e?2:e%100>=3&&e%100<=10?3:e%100>=11?4:5),6:e=>Number(1==e?0:e>=2&&e<=4?1:2),7:e=>Number(1==e?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2),8:e=>Number(1==e?0:2==e?1:8!=e&&11!=e?2:3),9:e=>Number(e>=2),10:e=>Number(1==e?0:2==e?1:e<7?2:e<11?3:4),11:e=>Number(1==e||11==e?0:2==e||12==e?1:e>2&&e<20?2:3),12:e=>Number(e%10!=1||e%100==11),13:e=>Number(0!==e),14:e=>Number(1==e?0:2==e?1:3==e?2:3),15:e=>Number(e%10==1&&e%100!=11?0:e%10>=2&&(e%100<10||e%100>=20)?1:2),16:e=>Number(e%10==1&&e%100!=11?0:0!==e?1:2),17:e=>Number(1==e||e%10==1&&e%100!=11?0:1),18:e=>Number(0==e?0:1==e?1:2),19:e=>Number(1==e?0:0==e||e%100>1&&e%100<11?1:e%100>10&&e%100<20?2:3),20:e=>Number(1==e?0:0==e||e%100>0&&e%100<20?1:2),21:e=>Number(e%100==1?1:e%100==2?2:e%100==3||e%100==4?3:0),22:e=>Number(1==e?0:2==e?1:(e<0||e>10)&&e%10==0?2:3)};const Ar=["v1","v2","v3"],$r=["v4"],Fr={zero:0,one:1,two:2,few:3,many:4,other:5};class Ir{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.languageUtils=e,this.options=t,this.logger=Cr.create("pluralResolver"),this.options.compatibilityJSON&&!$r.includes(this.options.compatibilityJSON)||"undefined"!=typeof Intl&&Intl.PluralRules||(this.options.compatibilityJSON="v3",this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.")),this.rules=(()=>{const e={};return Rr.forEach(t=>{t.lngs.forEach(n=>{e[n]={numbers:t.nr,plurals:Pr[t.fc]}})}),e})(),this.pluralRulesCache={}}addRule(e,t){this.rules[e]=t}clearCache(){this.pluralRulesCache={}}getRule(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.shouldUseIntlApi()){const n=Er("dev"===e?"en":e),r=t.ordinal?"ordinal":"cardinal",o=JSON.stringify({cleanedCode:n,type:r});if(o in this.pluralRulesCache)return this.pluralRulesCache[o];let i;try{i=new Intl.PluralRules(n,{type:r})}catch(n){if(!e.match(/-|_/))return;const r=this.languageUtils.getLanguagePartFromCode(e);i=this.getRule(r,t)}return this.pluralRulesCache[o]=i,i}return this.rules[e]||this.rules[this.languageUtils.getLanguagePartFromCode(e)]}needsPlural(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=this.getRule(e,t);return this.shouldUseIntlApi()?n&&n.resolvedOptions().pluralCategories.length>1:n&&n.numbers.length>1}getPluralFormsOfKey(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.getSuffixes(e,n).map(e=>`${t}${e}`)}getSuffixes(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=this.getRule(e,t);return n?this.shouldUseIntlApi()?n.resolvedOptions().pluralCategories.sort((e,t)=>Fr[e]-Fr[t]).map(e=>`${this.options.prepend}${t.ordinal?`ordinal${this.options.prepend}`:""}${e}`):n.numbers.map(n=>this.getSuffix(e,n,t)):[]}getSuffix(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r=this.getRule(e,n);return r?this.shouldUseIntlApi()?`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${r.select(t)}`:this.getSuffixRetroCompatible(r,t):(this.logger.warn(`no plural rule found for: ${e}`),"")}getSuffixRetroCompatible(e,t){const n=e.noAbs?e.plurals(t):e.plurals(Math.abs(t));let r=e.numbers[n];this.options.simplifyPluralSuffix&&2===e.numbers.length&&1===e.numbers[0]&&(2===r?r="plural":1===r&&(r=""));const o=()=>this.options.prepend&&r.toString()?this.options.prepend+r.toString():r.toString();return"v1"===this.options.compatibilityJSON?1===r?"":"number"==typeof r?`_plural_${r.toString()}`:o():"v2"===this.options.compatibilityJSON||this.options.simplifyPluralSuffix&&2===e.numbers.length&&1===e.numbers[0]?o():this.options.prepend&&n.toString()?this.options.prepend+n.toString():n.toString()}shouldUseIntlApi(){return!Ar.includes(this.options.compatibilityJSON)}}const Br=function(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:".",o=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],i=((e,t,n)=>{const r=hr(e,n);return void 0!==r?r:hr(t,n)})(e,t,n);return!i&&o&&ir(n)&&(i=wr(e,n,r),void 0===i&&(i=wr(t,n,r))),i},jr=e=>e.replace(/\$/g,"$$$$");class _r{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.logger=Cr.create("interpolator"),this.options=e,this.format=e.interpolation&&e.interpolation.format||(e=>e),this.init(e)}init(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e.interpolation||(e.interpolation={escapeValue:!0});const{escape:t,escapeValue:n,useRawValueToEscape:r,prefix:o,prefixEscaped:i,suffix:a,suffixEscaped:s,formatSeparator:l,unescapeSuffix:c,unescapePrefix:u,nestingPrefix:d,nestingPrefixEscaped:f,nestingSuffix:h,nestingSuffixEscaped:p,nestingOptionsSeparator:g,maxReplaces:v,alwaysFormat:m}=e.interpolation;this.escape=void 0!==t?t:mr,this.escapeValue=void 0===n||n,this.useRawValueToEscape=void 0!==r&&r,this.prefix=o?gr(o):i||"{{",this.suffix=a?gr(a):s||"}}",this.formatSeparator=l||",",this.unescapePrefix=c?"":u||"-",this.unescapeSuffix=this.unescapePrefix?"":c||"",this.nestingPrefix=d?gr(d):f||gr("$t("),this.nestingSuffix=h?gr(h):p||gr(")"),this.nestingOptionsSeparator=g||",",this.maxReplaces=v||1e3,this.alwaysFormat=void 0!==m&&m,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const e=(e,t)=>e&&e.source===t?(e.lastIndex=0,e):new RegExp(t,"g");this.regexp=e(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=e(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=e(this.nestingRegexp,`${this.nestingPrefix}(.+?)${this.nestingSuffix}`)}interpolate(e,t,n,r){let o,i,a;const s=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},l=e=>{if(e.indexOf(this.formatSeparator)<0){const o=Br(t,s,e,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(o,void 0,n,{...r,...t,interpolationkey:e}):o}const o=e.split(this.formatSeparator),i=o.shift().trim(),a=o.join(this.formatSeparator).trim();return this.format(Br(t,s,i,this.options.keySeparator,this.options.ignoreJSONStructure),a,n,{...r,...t,interpolationkey:i})};this.resetRegExp();const c=r&&r.missingInterpolationHandler||this.options.missingInterpolationHandler,u=r&&r.interpolation&&void 0!==r.interpolation.skipOnVariables?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:e=>jr(e)},{regex:this.regexp,safeValue:e=>this.escapeValue?jr(this.escape(e)):jr(e)}].forEach(t=>{for(a=0;o=t.regex.exec(e);){const n=o[1].trim();if(i=l(n),void 0===i)if("function"==typeof c){const t=c(e,o,r);i=ir(t)?t:""}else if(r&&Object.prototype.hasOwnProperty.call(r,n))i="";else{if(u){i=o[0];continue}this.logger.warn(`missed to pass in variable ${n} for interpolating ${e}`),i=""}else ir(i)||this.useRawValueToEscape||(i=sr(i));const s=t.safeValue(i);if(e=e.replace(o[0],s),u?(t.regex.lastIndex+=i.length,t.regex.lastIndex-=o[0].length):t.regex.lastIndex=0,a++,a>=this.maxReplaces)break}}),e}nest(e,t){let n,r,o,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const a=(e,t)=>{const n=this.nestingOptionsSeparator;if(e.indexOf(n)<0)return e;const r=e.split(new RegExp(`${n}[ ]*{`));let i=`{${r[1]}`;e=r[0],i=this.interpolate(i,o);const a=i.match(/'/g),s=i.match(/"/g);(a&&a.length%2==0&&!s||s.length%2!=0)&&(i=i.replace(/'/g,'"'));try{o=JSON.parse(i),t&&(o={...t,...o})}catch(t){return this.logger.warn(`failed parsing options string in nesting for key ${e}`,t),`${e}${n}${i}`}return o.defaultValue&&o.defaultValue.indexOf(this.prefix)>-1&&delete o.defaultValue,e};for(;n=this.nestingRegexp.exec(e);){let s=[];o={...i},o=o.replace&&!ir(o.replace)?o.replace:o,o.applyPostProcessor=!1,delete o.defaultValue;let l=!1;if(-1!==n[0].indexOf(this.formatSeparator)&&!/{.*}/.test(n[1])){const e=n[1].split(this.formatSeparator).map(e=>e.trim());n[1]=e.shift(),s=e,l=!0}if(r=t(a.call(this,n[1].trim(),o),o),r&&n[0]===e&&!ir(r))return r;ir(r)||(r=sr(r)),r||(this.logger.warn(`missed to resolve ${n[1]} for nesting ${e}`),r=""),l&&(r=s.reduce((e,t)=>this.format(e,t,i.lng,{...i,interpolationkey:n[1].trim()}),r.trim())),e=e.replace(n[0],r),this.regexp.lastIndex=0}return e}}const Hr=e=>{const t={};return(n,r,o)=>{let i=o;o&&o.interpolationkey&&o.formatParams&&o.formatParams[o.interpolationkey]&&o[o.interpolationkey]&&(i={...i,[o.interpolationkey]:void 0});const a=r+JSON.stringify(i);let s=t[a];return s||(s=e(Er(r),o),t[a]=s),s(n)}};class Wr{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.logger=Cr.create("formatter"),this.options=e,this.formats={number:Hr((e,t)=>{const n=new Intl.NumberFormat(e,{...t});return e=>n.format(e)}),currency:Hr((e,t)=>{const n=new Intl.NumberFormat(e,{...t,style:"currency"});return e=>n.format(e)}),datetime:Hr((e,t)=>{const n=new Intl.DateTimeFormat(e,{...t});return e=>n.format(e)}),relativetime:Hr((e,t)=>{const n=new Intl.RelativeTimeFormat(e,{...t});return e=>n.format(e,t.range||"day")}),list:Hr((e,t)=>{const n=new Intl.ListFormat(e,{...t});return e=>n.format(e)})},this.init(e)}init(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{interpolation:{}};this.formatSeparator=t.interpolation.formatSeparator||","}add(e,t){this.formats[e.toLowerCase().trim()]=t}addCached(e,t){this.formats[e.toLowerCase().trim()]=Hr(t)}format(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const o=t.split(this.formatSeparator);if(o.length>1&&o[0].indexOf("(")>1&&o[0].indexOf(")")<0&&o.find(e=>e.indexOf(")")>-1)){const e=o.findIndex(e=>e.indexOf(")")>-1);o[0]=[o[0],...o.splice(1,e)].join(this.formatSeparator)}const i=o.reduce((e,t)=>{const{formatName:o,formatOptions:i}=(e=>{let t=e.toLowerCase().trim();const n={};if(e.indexOf("(")>-1){const r=e.split("(");t=r[0].toLowerCase().trim();const o=r[1].substring(0,r[1].length-1);"currency"===t&&o.indexOf(":")<0?n.currency||(n.currency=o.trim()):"relativetime"===t&&o.indexOf(":")<0?n.range||(n.range=o.trim()):o.split(";").forEach(e=>{if(e){const[t,...r]=e.split(":"),o=r.join(":").trim().replace(/^'+|'+$/g,""),i=t.trim();n[i]||(n[i]=o),"false"===o&&(n[i]=!1),"true"===o&&(n[i]=!0),isNaN(o)||(n[i]=parseInt(o,10))}})}return{formatName:t,formatOptions:n}})(t);if(this.formats[o]){let t=e;try{const a=r&&r.formatParams&&r.formatParams[r.interpolationkey]||{},s=a.locale||a.lng||r.locale||r.lng||n;t=this.formats[o](e,s,{...i,...r,...a})}catch(e){this.logger.warn(e)}return t}return this.logger.warn(`there was no format function for ${o}`),e},e);return i}}class Vr extends kr{constructor(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};super(),this.backend=e,this.store=t,this.services=n,this.languageUtils=n.languageUtils,this.options=r,this.logger=Cr.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=r.maxParallelReads||10,this.readingCalls=0,this.maxRetries=r.maxRetries>=0?r.maxRetries:5,this.retryTimeout=r.retryTimeout>=1?r.retryTimeout:350,this.state={},this.queue=[],this.backend&&this.backend.init&&this.backend.init(n,r.backend,r)}queueLoad(e,t,n,r){const o={},i={},a={},s={};return e.forEach(e=>{let r=!0;t.forEach(t=>{const a=`${e}|${t}`;!n.reload&&this.store.hasResourceBundle(e,t)?this.state[a]=2:this.state[a]<0||(1===this.state[a]?void 0===i[a]&&(i[a]=!0):(this.state[a]=1,r=!1,void 0===i[a]&&(i[a]=!0),void 0===o[a]&&(o[a]=!0),void 0===s[t]&&(s[t]=!0)))}),r||(a[e]=!0)}),(Object.keys(o).length||Object.keys(i).length)&&this.queue.push({pending:i,pendingCount:Object.keys(i).length,loaded:{},errors:[],callback:r}),{toLoad:Object.keys(o),pending:Object.keys(i),toLoadLanguages:Object.keys(a),toLoadNamespaces:Object.keys(s)}}loaded(e,t,n){const r=e.split("|"),o=r[0],i=r[1];t&&this.emit("failedLoading",o,i,t),!t&&n&&this.store.addResourceBundle(o,i,n,void 0,void 0,{skipCopy:!0}),this.state[e]=t?-1:2,t&&n&&(this.state[e]=0);const a={};this.queue.forEach(n=>{((e,t,n)=>{const{obj:r,k:o}=dr(e,t,Object);r[o]=r[o]||[],r[o].push(n)})(n.loaded,[o],i),((e,t)=>{void 0!==e.pending[t]&&(delete e.pending[t],e.pendingCount--)})(n,e),t&&n.errors.push(t),0!==n.pendingCount||n.done||(Object.keys(n.loaded).forEach(e=>{a[e]||(a[e]={});const t=n.loaded[e];t.length&&t.forEach(t=>{void 0===a[e][t]&&(a[e][t]=!0)})}),n.done=!0,n.errors.length?n.callback(n.errors):n.callback())}),this.emit("loaded",a),this.queue=this.queue.filter(e=>!e.done)}read(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:this.retryTimeout,i=arguments.length>5?arguments[5]:void 0;if(!e.length)return i(null,{});if(this.readingCalls>=this.maxParallelReads)return void this.waitingReads.push({lng:e,ns:t,fcName:n,tried:r,wait:o,callback:i});this.readingCalls++;const a=(a,s)=>{if(this.readingCalls--,this.waitingReads.length>0){const e=this.waitingReads.shift();this.read(e.lng,e.ns,e.fcName,e.tried,e.wait,e.callback)}a&&s&&r<this.maxRetries?setTimeout(()=>{this.read.call(this,e,t,n,r+1,2*o,i)},o):i(a,s)},s=this.backend[n].bind(this.backend);if(2!==s.length)return s(e,t,a);try{const n=s(e,t);n&&"function"==typeof n.then?n.then(e=>a(null,e)).catch(a):a(null,n)}catch(e){a(e)}}prepareLoading(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=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."),r&&r();ir(e)&&(e=this.languageUtils.toResolveHierarchy(e)),ir(t)&&(t=[t]);const o=this.queueLoad(e,t,n,r);if(!o.toLoad.length)return o.pending.length||r(),null;o.toLoad.forEach(e=>{this.loadOne(e)})}load(e,t,n){this.prepareLoading(e,t,{},n)}reload(e,t,n){this.prepareLoading(e,t,{reload:!0},n)}loadOne(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";const n=e.split("|"),r=n[0],o=n[1];this.read(r,o,"read",void 0,void 0,(n,i)=>{n&&this.logger.warn(`${t}loading namespace ${o} for language ${r} failed`,n),!n&&i&&this.logger.log(`${t}loaded namespace ${o} for language ${r}`,i),this.loaded(e,n,i)})}saveMissing(e,t,n,r,o){let i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:()=>{};if(this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(t))this.logger.warn(`did not save key "${n}" as the namespace "${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!!!");else if(null!=n&&""!==n){if(this.backend&&this.backend.create){const s={...i,isUpdate:o},l=this.backend.create.bind(this.backend);if(l.length<6)try{let o;o=5===l.length?l(e,t,n,r,s):l(e,t,n,r),o&&"function"==typeof o.then?o.then(e=>a(null,e)).catch(a):a(null,o)}catch(e){a(e)}else l(e,t,n,r,a,s)}e&&e[0]&&this.store.addResource(e[0],t,n,r)}}}const Ur=()=>({debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!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:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:e=>{let t={};if("object"==typeof e[1]&&(t=e[1]),ir(e[1])&&(t.defaultValue=e[1]),ir(e[2])&&(t.tDescription=e[2]),"object"==typeof e[2]||"object"==typeof e[3]){const n=e[3]||e[2];Object.keys(n).forEach(e=>{t[e]=n[e]})}return t},interpolation:{escapeValue:!0,format:e=>e,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}),zr=e=>(ir(e.ns)&&(e.ns=[e.ns]),ir(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),ir(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&e.supportedLngs.indexOf("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),e),Kr=()=>{};class qr extends kr{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;var n;if(super(),this.options=zr(e),this.services={},this.logger=Cr,this.modules={external:[]},n=this,Object.getOwnPropertyNames(Object.getPrototypeOf(n)).forEach(e=>{"function"==typeof n[e]&&(n[e]=n[e].bind(n))}),t&&!this.isInitialized&&!e.isClone){if(!this.options.initImmediate)return this.init(e,t),this;setTimeout(()=>{this.init(e,t)},0)}}init(){var e=this;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;this.isInitializing=!0,"function"==typeof t&&(n=t,t={}),!t.defaultNS&&!1!==t.defaultNS&&t.ns&&(ir(t.ns)?t.defaultNS=t.ns:t.ns.indexOf("translation")<0&&(t.defaultNS=t.ns[0]));const r=Ur();this.options={...r,...this.options,...zr(t)},"v1"!==this.options.compatibilityAPI&&(this.options.interpolation={...r.interpolation,...this.options.interpolation}),void 0!==t.keySeparator&&(this.options.userDefinedKeySeparator=t.keySeparator),void 0!==t.nsSeparator&&(this.options.userDefinedNsSeparator=t.nsSeparator);const o=e=>e?"function"==typeof e?new e:e:null;if(!this.options.isClone){let t;this.modules.logger?Cr.init(o(this.modules.logger),this.options):Cr.init(null,this.options),this.modules.formatter?t=this.modules.formatter:"undefined"!=typeof Intl&&(t=Wr);const n=new Dr(this.options);this.store=new Or(this.options.resources,this.options);const i=this.services;i.logger=Cr,i.resourceStore=this.store,i.languageUtils=n,i.pluralResolver=new Ir(n,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),!t||this.options.interpolation.format&&this.options.interpolation.format!==r.interpolation.format||(i.formatter=o(t),i.formatter.init(i,this.options),this.options.interpolation.format=i.formatter.format.bind(i.formatter)),i.interpolator=new _r(this.options),i.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},i.backendConnector=new Vr(o(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;o<n;o++)r[o-1]=arguments[o];e.emit(t,...r)}),this.modules.languageDetector&&(i.languageDetector=o(this.modules.languageDetector),i.languageDetector.init&&i.languageDetector.init(i,this.options.detection,this.options)),this.modules.i18nFormat&&(i.i18nFormat=o(this.modules.i18nFormat),i.i18nFormat.init&&i.i18nFormat.init(this)),this.translator=new Mr(this.services,this.options),this.translator.on("*",function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];e.emit(t,...r)}),this.modules.external.forEach(e=>{e.init&&e.init(this)})}if(this.format=this.options.interpolation.format,n||(n=Kr),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const e=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);e.length>0&&"dev"!==e[0]&&(this.options.lng=e[0])}this.services.languageDetector||this.options.lng||this.logger.warn("init: no languageDetector is used and no lng is defined");["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(t=>{this[t]=function(){return e.store[t](...arguments)}});["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(t=>{this[t]=function(){return e.store[t](...arguments),e}});const i=ar(),a=()=>{const e=(e,t)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),i.resolve(t),n(e,t)};if(this.languages&&"v1"!==this.options.compatibilityAPI&&!this.isInitialized)return e(null,this.t.bind(this));this.changeLanguage(this.options.lng,e)};return this.options.resources||!this.options.initImmediate?a():setTimeout(a,0),i}loadResources(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Kr;const n=ir(e)?e:this.language;if("function"==typeof e&&(t=e),!this.options.resources||this.options.partialBundledLanguages){if(n&&"cimode"===n.toLowerCase()&&(!this.options.preload||0===this.options.preload.length))return t();const e=[],r=t=>{if(!t)return;if("cimode"===t)return;this.services.languageUtils.toResolveHierarchy(t).forEach(t=>{"cimode"!==t&&e.indexOf(t)<0&&e.push(t)})};if(n)r(n);else{this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(e=>r(e))}this.options.preload&&this.options.preload.forEach(e=>r(e)),this.services.backendConnector.load(e,this.options.ns,e=>{e||this.resolvedLanguage||!this.language||this.setResolvedLanguage(this.language),t(e)})}else t(null)}reloadResources(e,t,n){const r=ar();return"function"==typeof e&&(n=e,e=void 0),"function"==typeof t&&(n=t,t=void 0),e||(e=this.languages),t||(t=this.options.ns),n||(n=Kr),this.services.backendConnector.reload(e,t,e=>{r.resolve(),n(e)}),r}use(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&&Nr.addPostProcessor(e),"formatter"===e.type&&(this.modules.formatter=e),"3rdParty"===e.type&&this.modules.external.push(e),this}setResolvedLanguage(e){if(e&&this.languages&&!(["cimode","dev"].indexOf(e)>-1))for(let e=0;e<this.languages.length;e++){const t=this.languages[e];if(!(["cimode","dev"].indexOf(t)>-1)&&this.store.hasLanguageSomeTranslations(t)){this.resolvedLanguage=t;break}}}changeLanguage(e,t){var n=this;this.isLanguageChangingTo=e;const r=ar();this.emit("languageChanging",e);const o=e=>{this.language=e,this.languages=this.services.languageUtils.toResolveHierarchy(e),this.resolvedLanguage=void 0,this.setResolvedLanguage(e)},i=(e,i)=>{i?(o(i),this.translator.changeLanguage(i),this.isLanguageChangingTo=void 0,this.emit("languageChanged",i),this.logger.log("languageChanged",i)):this.isLanguageChangingTo=void 0,r.resolve(function(){return n.t(...arguments)}),t&&t(e,function(){return n.t(...arguments)})},a=t=>{e||t||!this.services.languageDetector||(t=[]);const n=ir(t)?t:this.services.languageUtils.getBestMatchFromCodes(t);n&&(this.language||o(n),this.translator.language||this.translator.changeLanguage(n),this.services.languageDetector&&this.services.languageDetector.cacheUserLanguage&&this.services.languageDetector.cacheUserLanguage(n)),this.loadResources(n,e=>{i(e,n)})};return e||!this.services.languageDetector||this.services.languageDetector.async?!e&&this.services.languageDetector&&this.services.languageDetector.async?0===this.services.languageDetector.detect.length?this.services.languageDetector.detect().then(a):this.services.languageDetector.detect(a):a(e):a(this.services.languageDetector.detect()),r}getFixedT(e,t,n){var r=this;const o=function(e,t){let i;if("object"!=typeof t){for(var a=arguments.length,s=new Array(a>2?a-2:0),l=2;l<a;l++)s[l-2]=arguments[l];i=r.options.overloadTranslationOptionHandler([e,t].concat(s))}else i={...t};i.lng=i.lng||o.lng,i.lngs=i.lngs||o.lngs,i.ns=i.ns||o.ns,""!==i.keyPrefix&&(i.keyPrefix=i.keyPrefix||n||o.keyPrefix);const c=r.options.keySeparator||".";let u;return u=i.keyPrefix&&Array.isArray(e)?e.map(e=>`${i.keyPrefix}${c}${e}`):i.keyPrefix?`${i.keyPrefix}${c}${e}`:e,r.t(u,i)};return ir(e)?o.lng=e:o.lngs=e,o.ns=t,o.keyPrefix=n,o}t(){return this.translator&&this.translator.translate(...arguments)}exists(){return this.translator&&this.translator.exists(...arguments)}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e){let t=arguments.length>1&&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;const n=t.lng||this.resolvedLanguage||this.languages[0],r=!!this.options&&this.options.fallbackLng,o=this.languages[this.languages.length-1];if("cimode"===n.toLowerCase())return!0;const i=(e,t)=>{const n=this.services.backendConnector.state[`${e}|${t}`];return-1===n||0===n||2===n};if(t.precheck){const e=t.precheck(this,i);if(void 0!==e)return e}return!!this.hasResourceBundle(n,e)||(!(this.services.backendConnector.backend&&(!this.options.resources||this.options.partialBundledLanguages))||!(!i(n,e)||r&&!i(o,e)))}loadNamespaces(e,t){const n=ar();return this.options.ns?(ir(e)&&(e=[e]),e.forEach(e=>{this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}),this.loadResources(e=>{n.resolve(),t&&t(e)}),n):(t&&t(),Promise.resolve())}loadLanguages(e,t){const n=ar();ir(e)&&(e=[e]);const r=this.options.preload||[],o=e.filter(e=>r.indexOf(e)<0&&this.services.languageUtils.isSupportedCode(e));return o.length?(this.options.preload=r.concat(o),this.loadResources(e=>{n.resolve(),t&&t(e)}),n):(t&&t(),Promise.resolve())}dir(e){if(e||(e=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),!e)return"rtl";const t=this.services&&this.services.languageUtils||new Dr(Ur());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","ckb"].indexOf(t.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(){return new qr(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},arguments.length>1?arguments[1]:void 0)}cloneInstance(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Kr;const n=e.forkResourceStore;n&&delete e.forkResourceStore;const r={...this.options,...e,isClone:!0},o=new qr(r);void 0===e.debug&&void 0===e.prefix||(o.logger=o.logger.clone(e));return["store","services","language"].forEach(e=>{o[e]=this[e]}),o.services={...this.services},o.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},n&&(o.store=new Or(this.store.data,r),o.services.resourceStore=o.store),o.translator=new Mr(o.services,r),o.translator.on("*",function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];o.emit(e,...n)}),o.init(r,t),o.translator.options=r,o.translator.backendConnector.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},o}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const Jr=qr.createInstance();Jr.createInstance=qr.createInstance,Jr.createInstance,Jr.dir,Jr.init,Jr.loadResources,Jr.reloadResources,Jr.use,Jr.changeLanguage,Jr.getFixedT,Jr.t,Jr.exists,Jr.setDefaultNamespace,Jr.hasLoadedNamespace,Jr.loadNamespaces,Jr.loadLanguages;var Gr="translation";function Yr(e){return Jr.on("languageChanged",e),function(){return Jr.off("languageChanged",e)}}Jr.init({lng:"zh-CN",resources:{}});var Xr=Jr.t.bind(Jr);function Zr(e){if(e.removeAttr){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&&Zr(t)}}function Qr(){return s('<svg viewBox="0 0 1024 1024"><path d="M498.7 655.8l-197.6-268c-8.1-10.9-0.3-26.4 13.3-26.4h395.2c13.6 0 21.4 15.4 13.3 26.4l-197.6 268c-6.6 9-20 9-26.6 0z"></path></svg>')}function eo(){return s('<div class="w-e-bar-divider"></div>')}function to(e,t,n,r,o){if(void 0===r&&(r=""),void 0===o&&(o=!1),t){if(r){var i=gt?"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?"".concat(n,"\n").concat(r):n;e.attr("data-tooltip",a),e.addClass("w-e-menu-tooltip-v5")}}}var no=function(){function e(e,t,n){void 0===n&&(n=!1);var r=this;this.$elem=s('<div class="w-e-bar-item"></div>'),this.$button=s('<button type="button"></button>'),this.disabled=!1,this.menu=t;var o=t.tag,i=t.width;if("button"!==o)throw new Error("Invalid tag '".concat(o,"', expected 'button'"));var a=t.title,l=t.hotkey,c=void 0===l?"":l,u=t.iconSvg,d=void 0===u?"":u,f=this.$button;if(d){var h=s(d);Zr(h),f.append(h)}else f.text(a);to(f,d,a,c,n),n&&d&&f.append(s('<span class="title">'.concat(a,"</span>"))),i&&f.css("width","".concat(i,"px")),f.attr("data-menu-key",e),this.$elem.append(f),w(function(){return r.init()})}return e.prototype.init=function(){var e=this;this.setActive(),this.setDisabled(),this.$button.on("click",function(t){t.preventDefault(),po(e).hidePanelOrModal(),e.disabled||(e.exec(),e.onButtonClick())})},e.prototype.exec=function(){var e=po(this),t=this.menu,n=t.getValue(e);t.exec(e,n),this.changeMenuState()},e.prototype.setActive=function(){var e=po(this),t=this.$button,n="active";this.menu.isActive(e)?t.addClass(n):t.removeClass(n)},e.prototype.setDisabled=function(){var e=po(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.setIcon=function(){var e=po(this),t=this.$button;if(this.menu.getIcon){var n=this.menu.getIcon(e);if(n){t.find("svg").remove();var r=s(n);Zr(r),t.append(r)}}},e.prototype.setTooltip=function(){var e=po(this),t=this.$button;if(this.menu.getTitle){var n=this.menu.getTitle(e),r=this.menu.iconSvg;n&&r&&to(t,r,n)}},e.prototype.changeMenuState=function(){this.setActive(),this.setDisabled(),this.setIcon(),this.setTooltip()},e}(),ro=function(e){function t(t,n,r){return void 0===r&&(r=!1),e.call(this,t,n,r)||this}return g(t,e),t.prototype.onButtonClick=function(){},t}(no),oo=function(){function e(e){this.isShow=!1,this.showTime=0,this.record(e)}return e.prototype.record=function(e){var t=J.get(e);null==t&&(t=new Set,J.set(e,t)),t.add(this),G.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=G.get(this);e&&e.emit(B,this)}},e.prototype.hide=function(){if(this.isShow&&!(Date.now()-this.showTime<200)){this.$elem.hide(),this.isShow=!1;var e=G.get(this);e&&e.emit(j)}},e}(),io=function(e){function t(t){var n=e.call(this,t)||this;return n.type="dropPanel",n.$elem=s('<div class="w-e-drop-panel"></div>'),n}return g(t,e),t.prototype.genSelfElem=function(){return null},t}(oo),ao=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=Qr();o.$button.append(i)}return o}return g(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=po(this);if(null==this.dropPanel){var n=new io(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}(no),so=function(e){function t(t,n){void 0===n&&(n=0);var r=e.call(this,t)||this;r.type="modal",r.$elem=s('<div class="w-e-modal"></div>'),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 g(t,e),t.prototype.genSelfElem=function(){var e=this,t=s('<span class="btn-close">'.concat('<svg viewBox="0 0 1024 1024"><path d="M1024 896.1024l-128 128L512 640 128 1024 0 896 384 512 0 128 128 0 512 384 896.1024 0l128 128L640 512z"></path></svg>',"</span>")),n=G.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","".concat(t,"px")),n.css(e)},t}(oo);var lo=function(e){function t(t,n,r){void 0===r&&(r=!1);var o=e.call(this,t,n,r)||this;return o.$body=s("body"),o.modal=null,o.menu=n,o}return g(t,e),t.prototype.onButtonClick=function(){this.menu.showModal&&this.handleModal()},t.prototype.getPosition=function(){var e=po(this),t=this.menu.getModalPositionNode(e);return i.Element.isElement(t)?nr(e,t,"modal"):tr(e)},t.prototype.handleModal=function(){var e=po(this),t=this.menu;if(null==this.modal){var n=new so(e,t.modalWidth);this.renderAndShowModal(n,!0),this.modal=n}else{(n=this.modal).isShow?n.hide():this.renderAndShowModal(n,!1)}},t.prototype.renderAndShowModal=function(e,t){void 0===t&&(t=!1);var n=po(this),r=this.menu;if(null!=r.getModalContentElem){var o=Ct.getTextarea(n),i=Ct.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||rr(n,e.$elem),setTimeout(function(){n.blur()})}},t}(no);var co=function(e){function t(t,n){var r=e.call(this,t)||this;return r.type="selectList",r.$elem=s('<div class="w-e-select-list"></div>'),n&&r.$elem.css("width","".concat(n,"px")),r.$elem.on("click",function(e){e.stopPropagation()}),r}return g(t,e),t.prototype.renderList=function(e){var t=this.$elem;t.empty();var n=s("<ul></ul>");e.forEach(function(e){var t=e.value,r=e.text,o=e.selected,i=e.styleForRenderMenuList,a=s('<li data-value="'.concat(t,'"></li>'));if(i&&a.css(i),o){var l=s('<svg viewBox="0 0 1446 1024"><path d="M574.116299 786.736392 1238.811249 48.517862C1272.390222 11.224635 1329.414799 7.827718 1366.75664 41.450462 1403.840015 74.840484 1406.731043 132.084741 1373.10189 169.433699L655.118888 966.834607C653.072421 969.716875 650.835807 972.514337 648.407938 975.210759 615.017957 1012.29409 558.292155 1015.652019 521.195664 982.250188L72.778218 578.493306C35.910826 545.297758 32.859041 488.584019 66.481825 451.242134 99.871807 414.158803 156.597563 410.800834 193.694055 444.202665L574.116299 786.736392Z"></path></svg>');a.append(l),a.addClass("selected")}a.append(s('<span data-value="'.concat(t,'">').concat(r,"</span>"))),a.attr("title",r),n.append(a)}),t.append(n)},t.prototype.genSelfElem=function(){return null},t}(oo);var uo=function(){function e(e,t,n){void 0===n&&(n=!1);var r=this;this.$elem=s('<div class="w-e-bar-item"></div>'),this.$button=s('<button type="button" class="select-button"></button>'),this.disabled=!1,this.selectList=null;var o=t.tag,i=t.title,a=t.width,l=t.iconSvg,c=void 0===l?"":l,u=t.hotkey,d=void 0===u?"":u;if("select"!==o)throw new Error("Invalid tag '".concat(o,"', expected 'select'"));var f=this.$button;a&&f.css("width","".concat(a,"px")),f.attr("data-menu-key",e),to(f,c,i,d,n),this.$elem.append(f),this.menu=t,w(function(){return r.init()})}return e.prototype.init=function(){var e=this;this.setSelectedValue(),this.$button.on("click",function(t){t.preventDefault(),po(e).hidePanelOrModal(),e.trigger()})},e.prototype.trigger=function(){var e=this,t=po(this);if(!t.isDisabled()&&!this.disabled){var n=this.menu;if(null==this.selectList){this.selectList=new co(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=s(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=po(this),n=this.menu;n.exec&&n.exec(t,e)},e.prototype.setSelectedValue=function(){var e=po(this),t=this.menu,n=t.getValue(e),r=function(e,t){for(var n=e.length,r="",o=0;o<n;o++){var i=e[o];if(i.value===t){r=i.text;break}}return r}(t.getOptions(e),n.toString()),o=this.$button,i=Qr();o.empty(),o.text(r),o.append(i)},e.prototype.setDisabled=function(){var e=po(this),t=this.menu.isDisabled(e),n=this.$button;(null==e.selection||e.isDisabled())&&(t=!0);var r="disabled";t?n.addClass(r):n.removeClass(r),this.disabled=t},e.prototype.changeMenuState=function(){this.setSelectedValue(),this.setDisabled()},e}(),fo=function(){function e(e){this.$elem=s('<div class="w-e-bar-item w-e-bar-item-group"></div>'),this.$container=s('<div class="w-e-bar-item-menus-container"></div>'),this.$button=s('<button type="button"></button>');var t=e.key,n=e.iconSvg,r=e.title,o=this.$elem,i=this.$button;if(n){var a=s(n);Zr(a),i.append(a)}else i.text(r);i.attr("data-menu-key",t);var l=Qr();i.append(l),o.append(i);var c=this.$container;o.append(c);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){s(e).hasClass("disabled")&&a++}),r.disconnect(),a===i?n.addClass("disabled"):n.removeClass("disabled"),e.observe(r)}});return r},e}(),ho=new WeakMap;function po(e){var t=q.get(e);if(null==t)throw new Error("Can not get editor instance");return t}function go(e,t,n){void 0===n&&(n=!1);var r=ho.get(t);if(r)return r;var o=t.tag;if("button"===o){var i=t.showDropPanel,a=t.showModal;r=i?new ao(e,t,n):a?new lo(e,t,n):new ro(e,t,n)}if("select"===o&&(r=new uo(e,t,n)),null==r)throw new Error("Invalid tag in menu ".concat(JSON.stringify(t)));return ho.set(t,r),r}function vo(e,t){var n=e.selection;return null!=n&&(!i.Range.isCollapsed(n)&&(!Ct.getSelectedElems(e).some(function(t){if(e.isVoid(t))return!0;var n=t.type;return!!["pre","code","table"].includes(n)})&&!!i.Text.isText(t)))}var mo=function(){function e(){var e=this;this.$elem=s('<div class="w-e-bar w-e-bar-hidden w-e-hover-bar"></div>'),this.menus={},this.hoverbarItems=[],this.prevSelectedNode=null,this.isShow=!1,this.lngListen=function(){},this.changeHoverbarState=c(function(){var t=e.isShow,n=e.getSelectedNodeAndMenuKeys()||{},r=n.node,o=void 0===r?null:r,a=n.menuKeys,s=void 0===a?[]:a,l=e.getEditorInstance();if(null!=o&&e.changeItemsState(),o&&i.Element.isElement(o)&&t){var c=e.isSamePath(o,e.prevSelectedNode);if(!i.Editor.isBlock(l,o)&&c)return}e.hideAndClean(),null!=o&&(e.registerItems(s),e.setPosition(o),e.show()),e.prevSelectedNode=o},200),w(function(){var t=e.getEditorInstance(),n=e.$elem;n.on("mousedown",function(e){return e.preventDefault()},{passive:!1}),Ct.getTextarea(t).$textAreaContainer.append(n),t.on(A,e.changeHoverbarState);var r=e.hideAndClean.bind(e);t.on($,r),t.on(F,r),t.on(I,r)}),this.lngListen=Yr(function(){e.menus={},e.hideAndClean(),e.getEditorInstance().deselect()})}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="undefined"!=typeof window?window.innerHeight:null;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;w(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=eo();n.append(r)}})},e.prototype.registerSingleItem=function(e){var t=this.getEditorInstance(),n=this.menus,r=n[e];if(null==r){var o=_[e];if(null==o)throw new Error("Not found menu item factory by key '".concat(e,"'"));if("function"!=typeof o)throw new Error("Menu item factory (key='".concat(e,"') is not a function"));r=o(),n[e]=r}var i=t.getMenuConfig(e);i&&void 0!==i.iconSvg&&(r.iconSvg=i.iconSvg);var a=go(e,r);this.hoverbarItems.push(a),q.set(a,t),this.$elem.append(a.$elem)},e.prototype.setPosition=function(e){var t=this.getEditorInstance(),n=this.$elem;if(n.attr("style",""),i.Element.isElement(e)){var r=nr(t,e,"bar");return n.css(r),void rr(t,n)}if(i.Text.isText(e)){r=tr(t);return n.css(r),void rr(t,n)}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 t=this.getHoverbarKeysConf(),n=null,r=[],o=function(o){var a=t[o],s=a.match,l=a.menuKeys,c=void 0===l?[]:l,u=s||function(e,t){return Ct.checkNodeType(t,o)},d=y(i.Editor.nodes(e,{match:function(t){return u(e,t)},universal:!0}),1),f=d[0];if(null!=f)return n=f[0],r=c,"break"};for(var a in t){if("break"===o(a))break}return null==n||0===r.length?null:{node:n,menuKeys:r}},e.prototype.getEditorInstance=function(){var e=z.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=vo),t},e.prototype.isSamePath=function(e,t){if(null==e||null==t)return!1;var n=Ct.findPath(null,e),r=Ct.findPath(null,t);return i.Path.equals(n,r)},e.prototype.destroy=function(){var e;this.changeHoverbarState.cancel(),this.$elem.remove(),null===(e=this.lngListen)||void 0===e||e.call(this),this.menus={},this.hoverbarItems=[],this.prevSelectedNode=null},e}();function yo(e,t){return Ae(t)&&Ct.hasDOMNode(e,t,{editable:!0})}function bo(e,t){return Ae(t)&&Ct.hasDOMNode(e,t)}function wo(e,t){if(yo(e,t))return!0;if(!bo(e,t))return!1;var n=null;return Fe(t)?n=t:Be(t)&&(n=t.parentElement),!!(null==n?void 0:n.closest("[data-w-e-reserve]"))||function(e,t){if(e.getConfig().readOnly)return!1;var n=bo(e,t)&&Ct.toSlateNode(e,t);return!!n&&i.Element.isElement(n)&&i.Editor.isVoid(e,n)}(e,t)}const Eo=e=>"object"==typeof e&&null!=e&&1===e.nodeType,xo=(e,t)=>(!t||"hidden"!==e)&&"visible"!==e&&"clip"!==e,So=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){const n=getComputedStyle(e,null);return xo(n.overflowY,t)||xo(n.overflowX,t)||(e=>{const t=(e=>{if(!e.ownerDocument||!e.ownerDocument.defaultView)return null;try{return e.ownerDocument.defaultView.frameElement}catch(e){return null}})(e);return!!t&&(t.clientHeight<e.scrollHeight||t.clientWidth<e.scrollWidth)})(e)}return!1},Co=(e,t,n,r,o,i,a,s)=>i<e&&a>t||i>e&&a<t?0:i<=e&&s<=n||a>=t&&s>=n?i-e-r:a>t&&s<n||i<e&&s>n?a-t+o:0,ko=e=>{const t=e.parentElement;return null==t?e.getRootNode().host||null:t},Oo=(e,t)=>{var n,r,o,i;if("undefined"==typeof document)return[];const{scrollMode:a,block:s,inline:l,boundary:c,skipOverflowHiddenElements:u}=t,d="function"==typeof c?c:e=>e!==c;if(!Eo(e))throw new TypeError("Invalid target");const f=document.scrollingElement||document.documentElement,h=[];let p=e;for(;Eo(p)&&d(p);){if(p=ko(p),p===f){h.push(p);break}null!=p&&p===document.body&&So(p)&&!So(document.documentElement)||null!=p&&So(p,u)&&h.push(p)}const g=null!=(r=null==(n=window.visualViewport)?void 0:n.width)?r:innerWidth,v=null!=(i=null==(o=window.visualViewport)?void 0:o.height)?i:innerHeight,{scrollX:m,scrollY:y}=window,{height:b,width:w,top:E,right:x,bottom:S,left:C}=e.getBoundingClientRect(),{top:k,right:O,bottom:N,left:T}=(e=>{const t=window.getComputedStyle(e);return{top:parseFloat(t.scrollMarginTop)||0,right:parseFloat(t.scrollMarginRight)||0,bottom:parseFloat(t.scrollMarginBottom)||0,left:parseFloat(t.scrollMarginLeft)||0}})(e);let M="start"===s||"nearest"===s?E-k:"end"===s?S+N:E+b/2-k+N,L="center"===l?C+w/2-T+O:"end"===l?x+O:C-T;const D=[];for(let e=0;e<h.length;e++){const t=h[e],{height:n,width:r,top:o,right:i,bottom:c,left:u}=t.getBoundingClientRect();if("if-needed"===a&&E>=0&&C>=0&&S<=v&&x<=g&&(t===f&&!So(t)||E>=o&&S<=c&&C>=u&&x<=i))return D;const d=getComputedStyle(t),p=parseInt(d.borderLeftWidth,10),k=parseInt(d.borderTopWidth,10),O=parseInt(d.borderRightWidth,10),N=parseInt(d.borderBottomWidth,10);let T=0,R=0;const P="offsetWidth"in t?t.offsetWidth-t.clientWidth-p-O:0,A="offsetHeight"in t?t.offsetHeight-t.clientHeight-k-N:0,$="offsetWidth"in t?0===t.offsetWidth?0:r/t.offsetWidth:0,F="offsetHeight"in t?0===t.offsetHeight?0:n/t.offsetHeight:0;if(f===t)T="start"===s?M:"end"===s?M-v:"nearest"===s?Co(y,y+v,v,k,N,y+M,y+M+b,b):M-v/2,R="start"===l?L:"center"===l?L-g/2:"end"===l?L-g:Co(m,m+g,g,p,O,m+L,m+L+w,w),T=Math.max(0,T+y),R=Math.max(0,R+m);else{T="start"===s?M-o-k:"end"===s?M-c+N+A:"nearest"===s?Co(o,c,n,k,N+A,M,M+b,b):M-(o+n/2)+A/2,R="start"===l?L-u-p:"center"===l?L-(u+r/2)+P/2:"end"===l?L-i+O+P:Co(u,i,r,p,O+P,L,L+w,w);const{scrollLeft:e,scrollTop:a}=t;T=0===F?0:Math.max(0,Math.min(a+T/F,t.scrollHeight-n/F+A)),R=0===$?0:Math.max(0,Math.min(e+R/$,t.scrollWidth-r/$+P)),M+=a-T,L+=e-R}D.push({el:t,top:T,left:R})}return D};function No(e,t){if(!e.isConnected||!(e=>{let t=e;for(;t&&t.parentNode;){if(t.parentNode===document)return!0;t=t.parentNode instanceof ShadowRoot?t.parentNode.host:t.parentNode}return!1})(e))return;const n=(e=>{const t=window.getComputedStyle(e);return{top:parseFloat(t.scrollMarginTop)||0,right:parseFloat(t.scrollMarginRight)||0,bottom:parseFloat(t.scrollMarginBottom)||0,left:parseFloat(t.scrollMarginLeft)||0}})(e);if((e=>"object"==typeof e&&"function"==typeof e.behavior)(t))return t.behavior(Oo(e,t));const r="boolean"==typeof t||null==t?void 0:t.behavior;for(const{el:o,top:i,left:a}of Oo(e,(e=>!1===e?{block:"end",inline:"nearest"}:(e=>e===Object(e)&&0!==Object.keys(e).length)(e)?e:{block:"start",inline:"nearest"})(t))){const e=i-n.top+n.bottom,t=a-n.left+n.right;o.scroll({top:e,left:t,behavior:r})}}function To(e){null!=e.selection&&(e.selection=null,e.onChange())}function Mo(e,t,n){void 0===n&&(n=!1);var r=t.selection,o=t.getConfig(),a=Ct.findDocumentOrShadowRoot(t).getSelection();if(a&&(!e.isComposing||n)&&t.isFocused()){var s="None"!==a.type;if(r||s){var l=oe.get(t),c=!1;if(l.contains(a.anchorNode)&&l.contains(a.focusNode)&&(c=!0),s&&c&&r){var u=Ct.toSlateRange(t,a,{exactMatch:!0,suppressThrow:!0});if(u&&i.Range.equals(u,r)){var d=!0;if(i.Range.isCollapsed(r)){var f=a.anchorNode,h=a.anchorOffset;if(f===l){var p=l.childNodes,g=void 0;(g=p[h])&&g.matches("table")&&(d=!1),(g=p[h-1])&&g.matches("table")&&(d=!1)}}if(d)return}}if(!r||Ct.hasRange(t,r)){e.isUpdatingSelection=!0;var v=null;try{v=r&&Ct.toDOMRange(t,r)}catch(e){v=null}if(v){i.Range.isBackward(r)?a.setBaseAndExtent(v.endContainer,v.endOffset,v.startContainer,v.startOffset):a.setBaseAndExtent(v.startContainer,v.startOffset,v.endContainer,v.endOffset);var m=v.startContainer.parentElement;if(!m.closest("[data-slate-spacer]")&&v.getBoundingClientRect){var y=v.getBoundingClientRect.bind(v)();0===y.top&&0===y.right&&0===y.bottom&&0===y.left&&0===y.height&&0===y.width||(m.getBoundingClientRect=v.getBoundingClientRect.bind(v));var b=document.body;if(No(m,{scrollMode:"if-needed",boundary:o.scroll&&l.parentElement||b,block:"end",behavior:"auto"}),o.scroll){var w=l.parentElement;if(w){var E=function(){var e=v.getBoundingClientRect(),t=w.getBoundingClientRect(),n=e.bottom-t.bottom,r=t.top-e.top;n>0?w.scrollTop+=n+1:r>0&&(w.scrollTop-=r+1)};E(),requestAnimationFrame(E)}}delete m.getBoundingClientRect}}else a.removeAllRanges();setTimeout(function(){v&&vt&&l.focus(),e.isUpdatingSelection=!1})}else t.selection=Ct.toSlateRange(t,a,{exactMatch:!1,suppressThrow:!0})}}}var Lo=new WeakMap,Do=new WeakMap;function Ro(e){var t;try{t=Ct.findDocumentOrShadowRoot(e)}catch(e){return null}var n=t.getSelection();if(!n||n.rangeCount<=0)return null;try{return n.getRangeAt(0).startContainer}catch(e){return null}}var Po={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"},Ao={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"},$o={deleteWordBackward:"ctrl+shift?+backspace",deleteWordForward:"ctrl+shift?+delete",redo:["ctrl+y","ctrl+shift+z"]},Fo=function(e){var t=Po[e],n=Ao[e],r=$o[e],o=t&&d.isKeyHotkey(t),i=n&&d.isKeyHotkey(n),a=r&&d.isKeyHotkey(r);return function(e){return!(!o||!o(e))||(!!(gt&&i&&i(e))||!(gt||!a||!a(e)))}},Io={isBold:Fo("bold"),isCompose:Fo("compose"),isMoveBackward:Fo("moveBackward"),isMoveForward:Fo("moveForward"),isDeleteBackward:Fo("deleteBackward"),isDeleteForward:Fo("deleteForward"),isDeleteLineBackward:Fo("deleteLineBackward"),isDeleteLineForward:Fo("deleteLineForward"),isDeleteWordBackward:Fo("deleteWordBackward"),isDeleteWordForward:Fo("deleteWordForward"),isExtendBackward:Fo("extendBackward"),isExtendForward:Fo("extendForward"),isExtendLineBackward:Fo("extendLineBackward"),isExtendLineForward:Fo("extendLineForward"),isItalic:Fo("italic"),isMoveLineBackward:Fo("moveLineBackward"),isMoveLineForward:Fo("moveLineForward"),isMoveWordBackward:Fo("moveWordBackward"),isMoveWordForward:Fo("moveWordForward"),isRedo:Fo("redo"),isSplitBlock:Fo("splitBlock"),isTransposeCharacter:Fo("transposeCharacter"),isUndo:Fo("undo"),isTab:Fo("tab"),isSelectAll:Fo("selectAll")};function Bo(e){e.preventDefault()}var jo={beforeinput:function(e,t,n){var r,o=e,a=n.getConfig().readOnly;if(Et&&!a&&yo(n,o.target)){null===(r=t.flushDOMSelectionChange)||void 0===r||r.call(t);var s=n.selection,l=o.inputType,c=o.dataTransfer||o.data||void 0;if("insertCompositionText"!==l&&"deleteCompositionText"!==l){if(o.preventDefault(),!l.startsWith("delete")||l.startsWith("deleteBy")){var u=y(o.getTargetRanges(),1)[0];if(u){var d=Ct.toSlateRange(n,u,{exactMatch:!1,suppressThrow:!1});s&&i.Range.equals(s,d)||i.Transforms.select(n,d)}}if(s&&i.Range.isExpanded(s)){var f=Ct.getSelectedElems(n),h="table"===f[0].type,p="table-cell"!==f[f.length-1].type;if(h&&p)return;if(l.startsWith("delete")){var g=l.endsWith("Backward")?"backward":"forward";return void i.Editor.deleteFragment(n,{direction:g})}}switch(l){case"deleteByComposition":case"deleteByCut":case"deleteByDrag":i.Editor.deleteFragment(n);break;case"deleteContent":case"deleteContentForward":i.Editor.deleteForward(n);break;case"deleteContentBackward":i.Editor.deleteBackward(n);break;case"deleteEntireSoftLine":i.Editor.deleteBackward(n,{unit:"line"}),i.Editor.deleteForward(n,{unit:"line"});break;case"deleteHardLineBackward":i.Editor.deleteBackward(n,{unit:"block"});break;case"deleteSoftLineBackward":i.Editor.deleteBackward(n,{unit:"line"});break;case"deleteHardLineForward":i.Editor.deleteForward(n,{unit:"block"});break;case"deleteSoftLineForward":i.Editor.deleteForward(n,{unit:"line"});break;case"deleteWordBackward":i.Editor.deleteBackward(n,{unit:"word"});break;case"deleteWordForward":i.Editor.deleteForward(n,{unit:"word"});break;case"insertLineBreak":i.Editor.insertText(n,"\n");break;case"insertParagraph":i.Editor.insertBreak(n);break;case"insertFromDrop":case"insertFromComposition":case"insertFromPaste":case"insertFromYank":case"insertReplacementText":case"insertText":if("insertFromComposition"===l&&(t.isComposing=!1,pe.set(n,!0)),"insertFromPaste"===l&&!he.get(n))break;Me(c)?n.insertData(c):"string"==typeof c&&i.Editor.insertText(n,c)}}}},blur:function(e,t,n){var r=e,o=t.isUpdatingSelection,a=t.latestElement;if(!n.getConfig().readOnly&&!o&&yo(n,r.target)){var s=Ct.findDocumentOrShadowRoot(n);if(a!==s.activeElement){var l=r.relatedTarget;if(!(l===Ct.toDOMNode(n,n)||Fe(l)&&l.hasAttribute("data-slate-spacer"))){if(null!=l&&Ae(l)&&Ct.hasDOMNode(n,l)){var c=Ct.toSlateNode(n,l);if(i.Element.isElement(c)&&!n.isVoid(c))return}if(mt){var u=s.getSelection();null==u||u.removeAllRanges()}ue.delete(n)}}}},focus:function(e,t,n){var r=Ct.toDOMNode(n,n),o=Ct.findDocumentOrShadowRoot(n);t.latestElement=o.activeElement,vt&&e.target!==r?r.focus():ue.set(n,!0)},click:function(e,t,n){if(!n.getConfig().readOnly&&bo(n,e.target)&&Ae(e.target)){var r=Ct.toSlateNode(n,e.target),o=Ct.findPath(n,r);if(i.Editor.hasPath(n,o))if(i.Node.get(n,o)===r){var a=i.Editor.start(n,o),s=i.Editor.end(n,o),l=i.Editor.void(n,{at:a}),c=i.Editor.void(n,{at:s});if(l&&c&&i.Path.equals(l[1],c[1])){var u=i.Editor.range(n,a);i.Transforms.select(n,u)}}}},compositionstart:function(e,t,n){if(yo(n,e.target)){ge.delete(n);var r=n.selection;if(r&&i.Range.isCollapsed(r)){var o=Ro(n);if(o){var a=o.textContent||"";Lo.set(n,a),Do.set(n,o)}}r&&i.Range.isExpanded(r)&&(i.Editor.deleteFragment(n),Promise.resolve().then(function(){Mo(t,n,!0)})),t.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)}(t,n)}},compositionend:function(e,t,n){var r=e;if(yo(n,r.target)){t.isComposing=!1;var o=!0===pe.get(n);o?(pe.delete(n),ge.delete(n)):ge.delete(n);var a=n.selection;if(null!=a){(wt||vt)&&Ct.cleanExposedTexNodeInSelectionBlock(n);for(var s=i.Range.isBackward(a)?a.focus:a.anchor,l=y(i.Editor.node(n,[s.path[0]]),1)[0],c=0;c<s.path.length;c+=1){var u=y(i.Editor.node(n,s.path.slice(0,c+1)),1)[0];if(i.Element.isElement(u)&&((mt||vt)&&"link"===u.type||"code"===u.type)){Ct.setNewKey(l);break}}var d=r.data;if(d&&!o){if(n.getConfig().maxLength){var f=Ct.getLeftLengthOfMaxLength(n);if(f<d.length){var h=Ro(n);h&&h.nodeType===Node.TEXT_NODE&&(h.textContent=Lo.get(n)||""),f>0&&i.Editor.insertText(n,d.slice(0,f)),t.changeViewState()}else i.Editor.insertText(n,d)}else{var p=Ct.findDocumentOrShadowRoot(n).getSelection();if(p&&function(e,t){if(i.Range.isCollapsed(t)){var n=t.anchor,r=t.focus;if([2,3].includes(n.path.length)&&[2,3].includes(r.path.length)&&(0===n.offset||0===r.offset)){var o=i.Editor.node(e,n.path),a=0===n.offset?n.path:r.path,s=[a[0],a[1]-1];if(0===a[1])return!1;var l=i.Editor.node(e,s);if(i.Text.isText(l[0])&&i.Text.isText(o[0]))return!0}}}(n,a)){var g=Ct.toSlateRange(n,p,{exactMatch:!1,suppressThrow:!1});g&&(n.selection=g)}i.Editor.insertText(n,d)}mt||setTimeout(function(){if(null!=n.selection){var e=Do.get(n);if(null!=e&&e.nodeType===Node.TEXT_NODE){var t=Ro(n);null!=t&&t.nodeType===Node.TEXT_NODE&&t!==e&&(e.textContent=Lo.get(n)||"")}}})}}}},compositionupdate:function(e,t,n){yo(n,e.target)&&(t.isComposing=!0)},keydown:function(e,t,n){var r=e,o=n.selection;if(!n.getConfig().readOnly&&!t.isComposing&&yo(n,r.target)){if(function(e,t){var n,r,o=U.get(e),i=o&&o.getMenus(),a=K.get(e),s=a&&a.getMenus(),l=v(v({},i),s);try{for(var c=m(Object.keys(l)),u=c.next();!u.done;u=c.next()){var f=l[u.value],h=f.hotkey;if(h&&d.isHotkey(h,t)&&!f.isDisabled(e)){var p=f.getValue(e);f.exec(e,p)}}}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=c.return)&&r.call(c)}finally{if(n)throw n.error}}}(n,r),Io.isTab(r))return Bo(r),void n.handleTab();if(Io.isRedo(r))return Bo(r),void("function"==typeof n.redo&&n.redo());if(Io.isUndo(r))return Bo(r),void("function"==typeof n.undo&&n.undo());if(Io.isMoveLineBackward(r))return Bo(r),void i.Transforms.move(n,{unit:"line",reverse:!0});if(Io.isMoveLineForward(r))return Bo(r),void i.Transforms.move(n,{unit:"line"});if(Io.isExtendLineBackward(r))return Bo(r),void i.Transforms.move(n,{unit:"line",edge:"focus",reverse:!0});if(Io.isExtendLineForward(r))return Bo(r),void i.Transforms.move(n,{unit:"line",edge:"focus"});if(Io.isMoveBackward(r))return Bo(r),void(o&&i.Range.isCollapsed(o)?i.Transforms.move(n,{reverse:!0}):i.Transforms.collapse(n,{edge:"start"}));if(Io.isMoveForward(r))return Bo(r),void(o&&i.Range.isCollapsed(o)?i.Transforms.move(n):i.Transforms.collapse(n,{edge:"end"}));if(Io.isMoveWordBackward(r))return Bo(r),o&&i.Range.isExpanded(o)&&i.Transforms.collapse(n,{edge:"focus"}),void i.Transforms.move(n,{unit:"word",reverse:!0});if(Io.isMoveWordForward(r))return Bo(r),o&&i.Range.isExpanded(o)&&i.Transforms.collapse(n,{edge:"focus"}),void i.Transforms.move(n,{unit:"word"});if(Io.isSelectAll(r))return Bo(r),void n.selectAll();if(Et){if((wt||mt)&&o&&(Io.isDeleteBackward(r)||Io.isDeleteForward(r))&&i.Range.isCollapsed(o)){var a=i.Node.parent(n,o.anchor.path);i.Element.isElement(a)&&i.Editor.isVoid(n,a)&&i.Editor.isInline(n,a)&&(r.preventDefault(),i.Transforms.delete(n,{unit:"block"}))}}else{if(Io.isBold(r)||Io.isItalic(r)||Io.isTransposeCharacter(r))return void Bo(r);if(Io.isSplitBlock(r))return Bo(r),void(r.shiftKey?i.Editor.insertText(n,"\n"):i.Editor.insertBreak(n));if(Io.isDeleteBackward(r))return Bo(r),void(o&&i.Range.isExpanded(o)?i.Editor.deleteFragment(n,{direction:"backward"}):i.Editor.deleteBackward(n));if(Io.isDeleteForward(r))return Bo(r),void(o&&i.Range.isExpanded(o)?i.Editor.deleteFragment(n,{direction:"forward"}):i.Editor.deleteForward(n));if(Io.isDeleteLineBackward(r))return Bo(r),void(o&&i.Range.isExpanded(o)?i.Editor.deleteFragment(n,{direction:"backward"}):i.Editor.deleteBackward(n,{unit:"line"}));if(Io.isDeleteLineForward(r))return Bo(r),void(o&&i.Range.isExpanded(o)?i.Editor.deleteFragment(n,{direction:"forward"}):i.Editor.deleteForward(n,{unit:"line"}));if(Io.isDeleteWordBackward(r))return Bo(r),void(o&&i.Range.isExpanded(o)?i.Editor.deleteFragment(n,{direction:"backward"}):i.Editor.deleteBackward(n,{unit:"word"}));Io.isDeleteWordForward(r)&&(Bo(r),o&&i.Range.isExpanded(o)?i.Editor.deleteFragment(n,{direction:"forward"}):i.Editor.deleteForward(n,{unit:"word"}))}}},keypress:function(e,t,n){if(!Et&&!n.getConfig().readOnly&&yo(n,e.target)){e.preventDefault();var r=e.key;i.Editor.insertText(n,r)}},copy:function(e,t,n){var r=e;if(yo(n,r.target)){n.getConfig().readOnly||r.preventDefault();var o=r.clipboardData;if(null!=o){n.setFragmentData(o);var i=n.getConfig().customCopy;i&&i(n,r)}}},cut:function(e,t,n){var r=e,o=n.selection;if(!n.getConfig().readOnly&&(r.preventDefault(),yo(n,r.target))){var a=r.clipboardData;if(null!=a&&(n.setFragmentData(a),o))if(i.Range.isExpanded(o))i.Editor.deleteFragment(n);else{var s=i.Node.parent(n,o.anchor.path);i.Element.isElement(s)&&i.Editor.isVoid(n,s)&&i.Transforms.delete(n)}}},paste:function(e,t,n){he.set(n,!0);var r=e;if(!n.getConfig().readOnly&&yo(n,r.target)){var o=n.getConfig().customPaste;if(o)if(!1===o(n,r))return he.set(n,!1),void r.preventDefault();if(mt||!Et||je(r)){r.preventDefault();var i=r.clipboardData;null!=i&&n.insertData(i)}}},dragover:function(e,t,n){if(bo(n,e.target)){var r=Ct.toSlateNode(n,e.target);i.Element.isElement(r)&&i.Editor.isVoid(n,r)&&e.preventDefault()}},dragstart:function(e,t,n){var r=e;if(bo(n,r.target)&&!n.getConfig().readOnly){var o=Ct.toSlateNode(n,r.target),a=Ct.findPath(n,o);if(i.Element.isElement(o)&&i.Editor.isVoid(n,o)||i.Editor.void(n,{at:a,voids:!0})){var s=i.Editor.range(n,a);i.Transforms.select(n,s)}var l=r.dataTransfer;if(null!=l)Ct.getSelectedNodeByType(n,"table")||(t.isDraggingInternally=!0,n.setFragmentData(l))}},dragend:function(e,t,n){var r=e;n.getConfig().readOnly||t.isDraggingInternally&&bo(n,r.target)&&(t.isDraggingInternally=!1)},drop:function(e,t,n){var r=e,o=r.dataTransfer;if(!n.getConfig().readOnly&&bo(n,r.target)&&null!=o&&!(Et&&mt&&o.files.length>0)){r.preventDefault();var a=n.selection,s=Ct.findEventRange(n,r);i.Transforms.select(n,s),t.isDraggingInternally&&(a&&i.Transforms.delete(n,{at:a}),t.isDraggingInternally=!1),n.insertData(o),n.isFocused()||n.focus()}}},_o=[];var Ho={};function Wo(e,t,n){var r=n.isInline(e)?"span":"div";return f.jsx(r,null,t)}function Vo(e,t){var n,r=Ct.findKey(t,e),o=t.isInline(e),a=i.Editor.isVoid(t,e),s=ft(e.type,r.id),l={id:s,key:r.id,"data-slate-node":"element","data-slate-inline":o},c=e.type,u=e.children,d=void 0===u?[]:u,h=function(e){return Ho[e]||Wo}(c);n=a?null:d.map(function(n,r){return qo(n,r,e,t)});var p=h(e,n,t);if(a){l["data-slate-void"]=!0;var g=o?"span":"div",v=y(i.Node.texts(e),1),m=y(v[0],1)[0],b=qo(m,0,e,t),E=f.jsx(g,{"data-slate-spacer":!0,style:{height:"0",color:"transparent",outline:"none",position:"absolute"}},b);p=f.jsx(g,{style:{position:"relative"}},p,E),ne.set(m,0),re.set(m,e)}return null==p.data&&(p.data={}),Object.assign(p.data,l),a||o||(p=function(e,t,n){var r=t;return _o.forEach(function(t){r=t(e,r,n)}),r}(e,p,t)),w(function(){var n=oe.get(t),o=null==n?void 0:n.querySelector("#".concat(s));null!=o&&(ae.set(r,o),se.set(e,o),ie.set(o,e))}),p}function Uo(e,t){return void 0===t&&(t=!1),f.jsx("span",{"data-slate-string":!0},t?e+"\n":e)}function zo(e,t){return void 0===e&&(e=0),void 0===t&&(t=!1),f.jsx("span",{"data-slate-zero-width":t?"n":"z","data-slate-length":e},"\ufeff",t?f.jsx("br",null):null)}function Ko(e,t,n){if(null==e.text)throw new Error("Current node is not slate Text ".concat(JSON.stringify(e)));var r=Ct.findKey(n,e),o=n.getConfig().decorate;if(null==o)throw new Error("Can not get config.decorate");var a,s=Ct.findPath(n,e),l=o([e,s]),c=i.Text.decorations(e,l),u=c.map(function(r){var o,a=r.leaf,s=r.position,l=function(e,t,n,r,o){void 0===t&&(t=!1);var a=e.text,s=Ct.findPath(o,n),l=i.Path.parent(s);if(i.Editor.isEditor(r))throw new Error("Text node ".concat(JSON.stringify(n)," parent is Editor"));return o.isVoid(r)?zo(i.Node.string(r).length):""!==a||r.children[r.children.length-1]!==n||o.isInline(r)||""!==i.Editor.string(o,l)?""===a?zo():t&&"\n"===a.slice(-1)?Uo(a,!0):Uo(a):zo(0,!0)}(a,null!==(o=null==s?void 0:s.isLast)&&void 0!==o?o:1===c.length,e,t,n);return l=function(e,t,n){var r=t;return _o.forEach(function(t){r=t(e,r,n)}),r}(a,l,n),f.jsx("span",{"data-slate-leaf":!0},l)}),d=(a=r.id,"w-e-text-".concat(a)),h=f.jsx("span",{"data-slate-node":"text",id:d,key:r.id},u);return w(function(){var t=oe.get(n),o=null==t?void 0:t.querySelector("#".concat(d));null!=o&&(ae.set(r,o),se.set(e,o),ie.set(o,e))}),h}function qo(e,t,n,r){return ne.set(e,t),re.set(e,n),i.Element.isElement(e)?Vo(e,r):Ko(e,n,r)}var Jo=["props","attrs","style","dataset","on","hook","ns"];function Go(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(!Jo.includes(t)){if(t.startsWith("data-")){var a=t.slice(5);return a=h(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&&Go(e)})}function Yo(e,t){var n,r,o=e.$scroll,a=(n=e.id,"w-e-textarea-".concat(n)),l=t.getConfig(),c=l.readOnly,u=l.autoFocus,d=function(e,t){return void 0===t&&(t=!1),f.h("div#".concat(e),{props:{contentEditable:!t}})}(a,c),h=t.children||[];d.children=h.map(function(e,n){if(ee.has(e)){var r=ee.get(e);if(r){var o=y(r,2),a=o[0],s=o[1];if(s)return a!==n&&(ne.set(e,n),ee.set(e,[n,s])),s}}var l=qo(e,n,t,t);Go(l);var c=t.getConfig().skipCacheTypes,u=void 0===c?["list-item"]:c;return i.Element.isElement(e)&&u.includes(e.type)||ee.set(e,[n,l]),l});var p=X.get(e);if(null==p&&(p=!0),p){var g=function(e){return s('<div\n id="'.concat(e,'"\n data-slate-editor\n data-slate-node="value"\n suppressContentEditableWarning\n role="textarea"\n spellCheck="true"\n autoCorrect="true"\n autoCapitalize="true"\n ></div>'))}(a);o.append(g),e.$textArea=g,r=g[0],oe.set(t,r),se.set(t,r),ie.set(r,t),(m=f.init([f.classModule,f.propsModule,f.styleModule,f.datasetModule,f.eventListenersModule,f.attributesModule]))(r,d),X.set(e,!1),Z.set(e,m)}else{var v=Q.get(e),m=Z.get(e);if(null==v||null==m)return;r=v.elm,m(v,d)}if(null==r){var b=o[0];if(null==(r=(null==b?void 0:b.querySelector("#".concat(a)))||We(a)))return}if((p?u:t.isFocused())&&r.focus({preventScroll:!0}),p){var w=Pe(r);w&&ce.set(t,w)}oe.set(t,r),se.set(t,r),ie.set(r,t),Q.set(e,d)}var Xo=1,Zo=function(){function e(e){var t=this;this.selectionChangeRoot=null,this.destroyed=!1,this.id=Xo++,this.$textArea=null,this.$progressBar=s('<div class="w-e-progress-bar"></div>'),this.$maxLengthInfo=s('<div class="w-e-max-length-info"></div>'),this.isComposing=!1,this.isUpdatingSelection=!1,this.isDraggingInternally=!1,this.latestElement=null,this.showPlaceholder=!1,this.$placeholder=null,this.latestEditorSelection=null,this.onDOMSelectionChange=u(function(e){var n=Fe(null==e?void 0:e.target)?e.target:null,r=null==n?void 0:n.tagName;if("INPUT"!==r&&"TEXTAREA"!==r){var o=t.getActiveEditor();null!=o&&function(e,t){var n=e.isComposing,r=e.isUpdatingSelection,o=e.isDraggingInternally,a=t.getConfig();if(!r&&!o){var s=Ct.findDocumentOrShadowRoot(t),l=s.activeElement,c=Ct.toDOMNode(t,t),u=s.getSelection();if(l!==c)return ue.delete(t),void To(t);if(e.latestElement=l,ue.set(t,!0),!u)return To(t);var d=u.anchorNode,f=u.focusNode,h=wo(t,d),p=bo(t,f);if(!n)if(h&&p){var g=Ct.toSlateRange(t,u,{exactMatch:!1,suppressThrow:!0});g&&i.Transforms.select(t,g)}else a.readOnly&&To(t)}}(t,o)}},100);var n=s(e);if(0===n.length)throw new Error("Cannot find textarea DOM by selector '".concat(e,"'"));this.$box=n;var r=s('<div class="w-e-text-container"></div>');r.append(this.$progressBar),r.append(this.$maxLengthInfo),n.append(r);var o=s('<div class="w-e-scroll"></div>');r.append(o),this.$scroll=o,this.$textAreaContainer=r,w(function(){var e=t.getActiveEditor();if(null!=e){t.bindSelectionChange(e),r.on("click",function(){return e.hidePanelOrModal()}),e.on(A,t.changeViewState.bind(t));var o=e.getConfig(),i=o.onChange,a=o.scroll;i&&e.on(A,function(){return i(e)}),a||(n.css("position","relative"),r.addClass("no-scroll")),t.onFocusAndOnBlur(),e.on(A,t.changeMaxLengthInfo.bind(t)),t.bindEvent()}})}return Object.defineProperty(e.prototype,"editorInstance",{get:function(){var e=W.get(this);if(null==e)throw new Error("Can not get editor instance");return e},enumerable:!1,configurable:!0}),e.prototype.getActiveEditor=function(){if(this.destroyed)return null;var e=W.get(this);return null==e||e.isDestroyed?null:e},e.prototype.bindSelectionChange=function(e,t){var n=this;if(void 0===t&&(t=5),null==this.selectionChangeRoot&&!e.isDestroyed){try{var r=Ct.findDocumentOrShadowRoot(e);r.addEventListener("selectionchange",this.onDOMSelectionChange),this.selectionChangeRoot=r}catch(r){if(t>0)return void setTimeout(function(){return n.bindSelectionChange(e,t-1)},0);window.document.addEventListener("selectionchange",this.onDOMSelectionChange),this.selectionChangeRoot=window.document}e.on(P,function(){var e;null===(e=n.selectionChangeRoot)||void 0===e||e.removeEventListener("selectionchange",n.onDOMSelectionChange),n.selectionChangeRoot=null})}},e.prototype.flushDOMSelectionChange=function(){this.onDOMSelectionChange.flush()},e.prototype.bindEvent=function(){var e=this,t=this.$textArea,n=this.$scroll,o=this.editorInstance;null!=t&&(r(jo,function(n,r){t.on(r,function(t){n(t,e,o)})}),o.getConfig().scroll&&(n.css("overflow-y","auto"),n.on("scroll",u(function(){o.emit($)},100))))},e.prototype.onFocusAndOnBlur=function(){var e=this,t=this.getActiveEditor();if(null!=t){var n=t.getConfig(),r=n.onBlur,o=n.onFocus;this.latestEditorSelection=t.selection,t.on(A,function(){null==e.latestEditorSelection&&null!=t.selection?setTimeout(function(){e.destroyed||t.isDestroyed||o&&o(t)}):null!=e.latestEditorSelection&&null==t.selection&&setTimeout(function(){e.destroyed||t.isDestroyed||r&&r(t)}),e.latestEditorSelection=t.selection})}},e.prototype.changeMaxLengthInfo=function(){var e=this.getActiveEditor();if(null!=e){var t=e.getConfig().maxLength;if(t){var n=t-Ct.getLeftLengthOfMaxLength(e);this.$maxLengthInfo[0].innerHTML="".concat(n,"/").concat(t)}}},e.prototype.changeProgress=function(e){var t=this.$progressBar;t.css("width","".concat(e,"%")),e>=100&&setTimeout(function(){t.hide(),t.css("width","0"),t.show()},1e3)},e.prototype.changeViewState=function(){var e=this,t=this.getActiveEditor();null!=t&&(Yo(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=s('<div class="w-e-text-placeholder">'.concat(r,"</div>"));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),w(function(){e.destroyed||t.isDestroyed||Mo(e,t)}))},e.prototype.destroy=function(){var e;this.destroyed=!0,this.onDOMSelectionChange.cancel(),null===(e=this.selectionChangeRoot)||void 0===e||e.removeEventListener("selectionchange",this.onDOMSelectionChange),this.selectionChangeRoot=null,this.$textAreaContainer.remove()},e}();function Qo(e,t,n,r){if(ne.set(e,t),re.set(e,n),i.Element.isElement(e)){var o=e.children;if((void 0===o?[]:o).forEach(function(t,n){return Qo(t,n,e,r)}),i.Editor.isVoid(r,e)){var a=y(i.Node.texts(e),1),s=y(a[0],1)[0];ne.set(s,0),re.set(s,e)}}}var ei=function(){function e(e,t){var n=this;this.$toolbar=s('<div class="w-e-bar w-e-bar-show w-e-toolbar"></div>'),this.menus={},this.toolbarItems=[],this.config={},this.lngListen=function(){},this.syncToolbarState=function(){n.toolbarItems.forEach(function(e){e.changeMenuState()})},this.changeToolbarState=c(function(){n.syncToolbarState()},200),this.config=t;var r=s(e);if(0===r.length)throw new Error("Cannot find toolbar DOM by selector '".concat(e,"'"));this.$box=r;var o=this.$toolbar;o.on("mousedown",function(e){return e.preventDefault()},{passive:!1}),r.append(o),w(function(){n.initToolbar(),n.lngListen=Yr(function(){return n.initToolbar()});var e=n.getEditorInstance();e.on(A,n.changeToolbarState),e.on(F,n.syncToolbarState),e.on(I,n.syncToolbarState)})}return e.prototype.getMenus=function(){return this.menus},e.prototype.getConfig=function(){return this.config},e.prototype.initToolbar=function(){this.menus={};var e=this.$toolbar;null==e||e.empty(),this.registerItems(),this.changeToolbarState()},e.prototype.registerItems=function(){var e=this,t="",n=this.$toolbar,r=this.config,o=r.toolbarKeys,i=void 0===o?[]:o,s=r.insertKeys,l=void 0===s?{index:0,keys:[]}:s,c=r.excludeKeys,u=void 0===c?[]:c,d=a(i),f=[];f=Array.isArray(l)?l:[l];var h=0;f.forEach(function(e){var t=e.index+h;if(e.replaceFn&&d[t]){var n=e.replaceFn(d[t]);if(!n)throw new Error("This function needs to return the menu configuration: IToolbarMenuKey");d[t]=n}e.keys.length>0&&("string"==typeof e.keys&&(e.keys=[e.keys]),e.keys.forEach(function(e,n){d.splice(t+n,0,e)}),h+=e.keys.length)});var p=d.filter(function(e){var t="string"==typeof e?e:e.key;return!u.includes(t)}),g=p.length;p.forEach(function(r,o){if("|"===r){if(0===o)return;if(o+1===g)return;if("|"===t)return;var i=eo();return n.append(i),void(t=r)}return"string"==typeof r?(e.registerSingleItem(r,e),void(t=r)):e.isMenuGroup(r)?(e.registerGroup(r),void(t="group")):(e.registerSingleMenuByConf(r),void(t=r.key))})},e.prototype.isMenuGroup=function(e){return"string"!=typeof e&&Array.isArray(e.menuKeys)},e.prototype.registerSingleMenuByConf=function(e){var t=e.key,n=e.title,r=e.iconSvg;this.registerSingleItem(t,this,{title:n,iconSvg:r})},e.prototype.registerGroup=function(e){var t=this,n=this.$toolbar,r=function(e){return new fo(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,n){void 0===n&&(n={});var r=this.getEditorInstance(),o=t instanceof fo,i=this.menus,a=i[e];if(null==a){var s=_[e];if(null==s)throw new Error("Not found menu item factory by key '".concat(e,"'"));if("function"!=typeof s)throw new Error("Menu item factory (key='".concat(e,"') is not a function"));a=s(),i[e]=a}else console.warn("Duplicated toolbar menu key '".concat(e,"'\n重复注册了菜单栏 menu '").concat(e,"'"));var l=r.getMenuConfig(e);l&&void 0!==l.iconSvg&&(a.iconSvg=l.iconSvg),void 0!==n.iconSvg&&(a.iconSvg=n.iconSvg),void 0!==n.title&&(a.title=n.title);var c=go(e,a,o);(this.toolbarItems.push(c),q.set(c,r),o)?t.appendBarItem(c):t.$toolbar.append(c.$elem)},e.prototype.getEditorInstance=function(){var e=V.get(this);if(null==e)throw new Error("Can not get editor instance");return e},e.prototype.destroy=function(){var e;this.$toolbar.remove(),null===(e=this.lngListen)||void 0===e||e.call(this),this.menus={},this.toolbarItems=[]},e}();var ti=!1,ni=!1;function ri(e){"undefined"!=typeof console&&"function"==typeof console.warn&&console.warn("[wangeditor-next] `@wangeditor-next/core` export `".concat(e,"` is deprecated.")+" Please import it from `@wangeditor-next/core/upload`.")}e.DOMComment=Ee,e.DOMElement=xe,e.DOMNode=we,e.DOMRange=Ce,e.DOMSelection=ke,e.DOMStaticRange=Oe,e.DOMText=Se,e.DomEditor=Ct,e.ELEM_TO_HTML_CONF=Ot,e.PARSE_ELEM_HTML_CONF=et,e.PARSE_STYLE_HTML_FN_LIST=Qe,e.PRE_PARSE_HTML_CONF_LIST=Ze,e.RENDER_ELEM_CONF=Ho,e.RENDER_STYLE_HANDLER_LIST=_o,e.STYLE_TO_HTML_FN_LIST=kt,e.TEXT_TAGS=Xe,e.Toolbar=ei,e.coreCreateEditor=function(e){var t=e.selector,n=void 0===t?"":t,o=e.config,s=void 0===o?{}:o,l=e.content,c=e.html,u=e.plugins,d=void 0===u?[]:u,f=function(e){return[zn,Bt,ve,Ft,or,Vn,Zn,Gn].reduce(function(e,t){return t(e)},e)}(i.createEditor());if(n&&function(e,t){return ut(e,"data-w-e-textarea",t)}(f,n))throw new Error("Repeated create editor by selector '".concat(n,"'"));var h=function(e){void 0===e&&(e={});var t=a(D),n={},o=e.MENU_CONF,i=void 0===o?{}:o;return r(t,function(e,t){n[t]=v(v({},e),i[t]||{})}),delete e.MENU_CONF,v({scroll:!0,readOnly:!1,autoFocus:!0,decorate:function(){return[]},maxLength:0,MENU_CONF:n,hoverbarKeys:{},textStyleMode:"inline",classStylePolicy:"preserve-data",sanitizeHtml:L,customAlert:function(e,t){window.alert("".concat(t,":\n").concat(e))}},e)}(s);Y.set(f,h);var p=h.hoverbarKeys,g=void 0===p?{}:p;if(d.forEach(function(e){f=e(f)}),function(e,t){var n=t.html,r=t.content;null!=n?e.children=dt(e,n):r&&r.length&&(e.children=r),0===e.children.length&&(e.children=[{type:"paragraph",children:[{text:""}]}])}(f,{html:c,content:l}),n){var m=new Zo(n);H.set(f,m),W.set(m,f),m.changeViewState();var y=void 0;Object.keys(g).length>0&&(y=new mo,z.set(y,f),K.set(f,y)),f.on(A,function(){f.hidePanelOrModal()}),f.on($,function(){f.hidePanelOrModal()})}else f.children.forEach(function(e,t){return Qo(e,t,f,f)});var b=h.onCreated,E=h.onDestroyed;return b&&f.on(R,function(){return b(f)}),E&&f.on(P,function(){return E(f)}),w(function(){return f.emit(R)}),f},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 ut(e,"data-w-e-toolbar",t)}(e,n))throw new Error("Repeated create toolbar by selector '".concat(n,"'"));var i=v({toolbarKeys:[],excludeKeys:[],insertKeys:{index:0,keys:[]},modalAppendToBody:!1},o||{}),a=new ei(n,i);return V.set(a,e),U.set(e,a),a},e.createUploader=function(e,t){return ti||(ti=!0,ri("createUploader")),function(e,t){return e.uploadAdapter?e.uploadAdapter({config:e,editor:t}):k(e)}(e,t)},e.createUppyUploader=function(e){return ni||(ni=!0,ri("createUppyUploader")),k(e)},e.genModalButtonElems=function(e,t){var n=s('<div class="button-container"></div>'),r=s('<button type="button" id="'.concat(e,'">').concat(t,"</button>"));return n.append(r),[n[0],r[0]]},e.genModalInputElems=function(e,t,n){var r=s('<label class="babel-container"></label>');r.append("<span>".concat(e,"</span>"));var o=s('<input type="text" id="'.concat(t,'" placeholder="').concat(n||"",'">'));return r.append(o),[r[0],o[0]]},e.genModalTextareaElems=function(e,t,n){var r=s('<label class="babel-container"></label>');r.append("<span>".concat(e,"</span>"));var o=s('<textarea type="text" id="'.concat(t,'" placeholder="').concat(n||"",'"></textarea>'));return r.append(o),[r[0],o[0]]},e.getClassStylePolicy=function(e){if(!e)return"preserve-data";var t=e.getConfig().classStylePolicy;return"fallback-inline"===t?"fallback-inline":"strict"===t?"strict":"preserve-data"},e.getDefaultView=Pe,e.getEditableChild=Ue,e.getEditableChildAndIndex=Ve,e.getElementById=We,e.getFirstVoidChild=Ke,e.getPlainText=ze,e.getTagName=Je,e.getTextStyleMode=function(e){return e&&"class"===e.getConfig().textStyleMode?"class":"inline"},e.hasShadowRoot=He,e.i18nAddResources=function(e,t){Jr.addResourceBundle(e,Gr,t,!0,!0)},e.i18nChangeLanguage=function(e){Jr.changeLanguage(e)},e.i18nGetResources=function(e){return Jr.getResourceBundle(e,Gr)},e.i18nListenLanguage=Yr,e.isDOMComment=$e,e.isDOMElement=Fe,e.isDOMNode=Ae,e.isDOMSelection=Ie,e.isDOMText=Be,e.isDataTransfer=Me,e.isDocument=Ne,e.isHTMLElememt=Re,e.isPlainTextOnlyPaste=je,e.isShadowRoot=Te,e.isUnprocessedListElement=De,e.normalizeDOMPoint=_e,e.registerElemToHtmlConf=function(e){var t=e.type,n=e.elemToHtml;Ot[t||""]=n},e.registerMenu=function(e,t){var n=e.key,r=e.factory,o=e.config,i=v(v({},o),t||{});if(null!=_[n])throw new Error("Duplicated key '".concat(n,"' in menu items"));_[n]=r,function(e,t){null!=t&&(D[e]=t)}(n,i)},e.registerParseElemHtmlConf=function(e){var t=e.selector,n=e.parseElemHtml;et[t]=n},e.registerParseStyleHtmlHandler=function(e){Qe.push(e)},e.registerPreParseHtmlConf=function(e){Ze.push(e)},e.registerRenderElemConf=function(e){var t=e.type,n=e.renderElem;Ho[t||""]=n},e.registerStyleHandler=function(e){_o.push(e)},e.registerStyleToHtmlHandler=function(e){kt.push(e)},e.reportUnsupportedClassStyle=function(e,t){var n=null==e?void 0:e.getConfig().onClassStyleUnsupported;n?n(t):console.warn(t.message)},e.t=Xr,e.walkTextNodes=qe});
|
|
13
2
|
//# sourceMappingURL=index.js.map
|