@wangeditor-next/editor 5.6.47 → 5.6.48
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/css/style.css +6 -799
- package/dist/index.js +28 -50053
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -15,7 +15,7 @@ var e,t,n,r,o,i,a,s,u,l,c,d,f,p,h,g,v,m,y="undefined"!=typeof globalThis?globalT
|
|
|
15
15
|
* @param {string} phrase that needs interpolation, with placeholders
|
|
16
16
|
* @param {object} options with values that will be used to replace placeholders
|
|
17
17
|
* @returns {any[]} interpolated
|
|
18
|
-
*/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 a=n("apply");function s(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 gw=class{constructor(t){Object.defineProperty(this,a,{value:s}),this.locale={strings:{},pluralize:e=>1===e?0:1},Array.isArray(t)?t.forEach(e(this,a)[a],this):e(this,a)[a](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)}},gw}function Uw(){return yw||(yw=1,mw=function(){var e={},t=e._fns={};return e.emit=function(e,n,r,o,i,a,s){var u=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),a=0,s=i.length;for(;a<s;a++){var u=i[a];if("*"===u&&(n=n.concat(t[u])),2===o.length&&o[0]===u){n=n.concat(t[u]);break}}return n}(e);u.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,u,[n,r,o,i,a,s])},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}),mw}function Vw(){if(Ew)return bw;Ew=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",bw=function(){return new r}}function Ww(){if(Dw)return Cw;return Dw=1,Cw=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 Gw(){return Sw?ww:(Sw=1,ww={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 qw(){if(Rw)return _w;Rw=1;var e=iw(),t=ow(),n=Hw();let r,o;function i(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 s(e){return"__private_"+a+++"_"+e}const u=$w(),l=Uw(),c=SC(),d=Vw(),f=function(){if(xw)return Aw;xw=1;const e=Ww(),t=Gw();return Aw=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"}}(),p=Ww(),h=function(){if(Nw)return Ow;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 Nw=1,Ow=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}}(),g=(Tw||(Tw=1,Bw=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}),Bw),v=Fw?kw:(Fw=1,kw=function(e,t){return t.name?t.name:"image"===e.split("/")[0]?`${e.split("/")[0]}.${e.split("/")[1]}`:"noname"}),m=Pw?Iw:(Pw=1,Iw={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 y=s("plugins"),b=s("restricter"),E=s("storeUnsubscribe"),C=s("emitter"),D=s("preProcessors"),w=s("uploaders"),S=s("postProcessors"),A=s("informAndEmit"),x=s("checkRequiredMetaFieldsOnFile"),O=s("checkRequiredMetaFields"),N=s("assertNewUploadAllowed"),B=s("checkAndCreateFileStateObject"),T=s("startIfAutoProceed"),k=s("addListeners"),F=s("updateOnlineStatus"),I=s("createUpload"),P=s("getUpload"),_=s("removeUpload"),R=s("runUpload");r=Symbol.for("uppy test: getPlugins"),o=Symbol.for("uppy test: createUpload");class L{constructor(e){Object.defineProperty(this,R,{value:K}),Object.defineProperty(this,_,{value:q}),Object.defineProperty(this,P,{value:G}),Object.defineProperty(this,I,{value:W}),Object.defineProperty(this,k,{value:V}),Object.defineProperty(this,T,{value:U}),Object.defineProperty(this,B,{value:$}),Object.defineProperty(this,N,{value:z}),Object.defineProperty(this,O,{value:H}),Object.defineProperty(this,x,{value:j}),Object.defineProperty(this,A,{value:M}),Object.defineProperty(this,y,{writable:!0,value:Object.create(null)}),Object.defineProperty(this,b,{writable:!0,value:void 0}),Object.defineProperty(this,E,{writable:!0,value:void 0}),Object.defineProperty(this,C,{writable:!0,value:l()}),Object.defineProperty(this,D,{writable:!0,value:new Set}),Object.defineProperty(this,w,{writable:!0,value:new Set}),Object.defineProperty(this,S,{writable:!0,value:new Set}),Object.defineProperty(this,F,{writable:!0,value:this.updateOnlineStatus.bind(this)}),this.defaultLocale=m;const r={id:"uppy",autoProceed:!1,allowMultipleUploads:!0,allowMultipleUploadBatches:!0,debug:!1,restrictions:n.defaultOptions,meta:{},onBeforeFileAdded:e=>e,onBeforeUpload:e=>e,store:d(),logger:t.justErrorsLogger,infoTimeout:5e3};this.opts={...r,...e,restrictions:{...r.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=c(this.calculateProgress.bind(this),500,{leading:!0,trailing:!0}),this.store=this.opts.store,this.setState({plugins:{},files:{},currentUploads:{},allowNewUpload:!0,capabilities:{uploadProgress:g(),individualCancellation:!0,resumableUploads:!1},totalProgress:0,meta:{...this.opts.meta},info:[],recoveredState:null}),i(this,b)[b]=new n.Restricter(()=>this.opts,this.i18n),i(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),i(this,k)[k]()}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];i(this,C)[C].emit(e,...n)}on(e,t){return i(this,C)[C].on(e,t),this}once(e,t){return i(this,C)[C].once(e,t),this}off(e,t){return i(this,C)[C].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){i(this,D)[D].add(e)}removePreProcessor(e){return i(this,D)[D].delete(e)}addPostProcessor(e){i(this,S)[S].add(e)}removePostProcessor(e){return i(this,S)[S].delete(e)}addUploader(e){i(this,w)[w].add(e)}removeUploader(e){return i(this,w)[w].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),a=r.filter(e=>e.progress.uploadStarted||e.progress.preprocess||e.progress.postprocess),s=r.filter(e=>e.progress.uploadStarted),u=r.filter(e=>e.isPaused),l=r.filter(e=>e.progress.uploadComplete),c=r.filter(e=>e.error),d=o.filter(e=>!e.isPaused),f=r.filter(e=>e.progress.preprocess||e.progress.postprocess);return{newFiles:i,startedFiles:a,uploadStartedFiles:s,pausedFiles:u,completeFiles:l,erroredFiles:c,inProgressFiles:o,inProgressNotPausedFiles:d,processingFiles:f,isUploadStarted:s.length>0,isAllComplete:100===t&&l.length===r.length&&0===f.length,isAllErrored:!!n&&c.length===r.length,isAllPaused:0!==o.length&&u.length===o.length,isUploadInProgress:o.length>0,isSomeGhost:r.some(e=>e.isGhost)}}validateRestrictions(e,t){void 0===t&&(t=this.getFiles());try{return i(this,b)[b].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){i(this,N)[N](e);const{files:t}=this.getState();let n=i(this,B)[B](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}`),i(this,T)[T](),n.id}addFiles(e){i(this,N)[N]();const t={...this.getState().files},n=[],r=[];for(let o=0;o<e.length;o++)try{let r=i(this,B)[B](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&&i(this,T)[T](),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},a=Object.create(null);function s(e){return void 0===a[e]}e.forEach(e=>{n[e]&&(a[e]=n[e],delete o[e])}),Object.keys(i).forEach(e=>{const t=r[e].fileIDs.filter(s);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 u={currentUploads:i,files:o};0===Object.keys(o).length&&(u.allowNewUpload=!0,u.error=null,u.recoveredState=null),this.setState(u),this.calculateTotalProgress();const l=Object.keys(a);l.forEach(e=>{this.emit("file-removed",a[e],t)}),l.length>5?this.log(`Removed ${l.length} files`):this.log(`Removed files: ${l.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=i(this,I)[I](t,{forceAllowNewUpload:!0});return i(this,R)[R](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=i(this,I)[I]([e],{forceAllowNewUpload:!0});return i(this,R)[R](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 a=0===r?0:Math.round(i/r*100);a>100&&(a=100),this.setState({totalProgress:a}),this.emit("progress",a)}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 i(this,y)[y]?i(this,y)[y][n.type].push(n):i(this,y)[y][n.type]=[n],n.install(),this}getPlugin(e){for(const t of Object.values(i(this,y)[y])){const n=t.find(t=>t.id===e);if(null!=n)return n}}[r](e){return i(this,y)[y][e]}iteratePlugins(e){Object.values(i(this,y)[y]).flat(1).forEach(e)}removePlugin(e){this.log(`Removing plugin ${e.id}`),this.emit("plugin-remove",e),e.uninstall&&e.uninstall();const t=i(this,y)[y][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}),i(this,E)[E](),this.iteratePlugins(e=>{this.removePlugin(e)}),"undefined"!=typeof window&&window.removeEventListener&&(window.removeEventListener("online",i(this,F)[F]),window.removeEventListener("offline",i(this,F)[F]))}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]?i(this,R)[R](e):(i(this,_)[_](e),Promise.reject(new Error("Nonexistent upload")))}[o](){return i(this,I)[I](...arguments)}addResultData(e,t){if(!i(this,P)[P](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=i(this,y)[y].uploader)&&e.length||this.log("No uploader type plugins are used","warning");let{files:t}=this.getState();const r=this.opts.onBeforeUpload(t);return!1===r?Promise.reject(new Error("Not starting the upload because onBeforeUpload returned false")):(r&&"object"==typeof r&&(t=r,this.setState({files:t})),Promise.resolve().then(()=>i(this,b)[b].validateMinNumberOfFiles(t)).catch(e=>{throw i(this,A)[A](e),e}).then(()=>{if(!i(this,O)[O](t))throw new n.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=i(this,I)[I](r);return i(this,R)[R](o)}).catch(e=>{throw this.emit("error",e),this.log(e,"error"),e}))}}function M(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 j(e){const{missingFields:t,error:n}=i(this,b)[b].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))i(this,x)[x](n)||(t=!1);return t}function z(e){const{allowNewUpload:t}=this.getState();if(!1===t){const t=new n.RestrictionError(this.i18n("noMoreFilesAllowed"));throw i(this,A)[A](t,e),t}}function $(e,t){const r=f(t),o=v(r,t),a=p(o).extension,s=Boolean(t.isRemote),u=h({...t,type:r});if(this.checkIfFileAlreadyExists(u)){const e=new n.RestrictionError(this.i18n("noDuplicates",{fileName:o}));throw i(this,A)[A](e,t),e}const l=t.meta||{};l.name=o,l.type=r;const c=Number.isFinite(t.data.size)?t.data.size:null;let d={source:t.source||"",id:u,name:o,extension:a||"",meta:{...this.getState().meta,...l},type:r,data:t.data,progress:{percentage:0,bytesUploaded:0,bytesTotal:c,uploadComplete:!1,uploadStarted:null},size:c,isRemote:s,remote:t.remote||"",preview:t.preview};const g=this.opts.onBeforeFileAdded(d,e);if(!1===g){const e=new n.RestrictionError("Cannot add the file because onBeforeFileAdded returned false.");throw this.emit("restriction-failed",t,e),e}"object"==typeof g&&null!==g&&(d=g);try{const t=Object.keys(e).map(t=>e[t]);i(this,b)[b].validate(d,t)}catch(e){throw i(this,A)[A](e,d),e}return d}function U(){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 V(){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}),i(this,A)[A](e)}else i(this,A)[A](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:i(this,S)[S].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&&i(this,x)[x](e)}),"undefined"!=typeof window&&window.addEventListener&&(window.addEventListener("online",i(this,F)[F]),window.addEventListener("offline",i(this,F)[F]),setTimeout(i(this,F)[F],3e3))}function W(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 a=(0,e.nanoid)();return this.emit("upload",{id:a,fileIDs:t}),this.setState({allowNewUpload:!1!==this.opts.allowMultipleUploadBatches&&!1!==this.opts.allowMultipleUploads,currentUploads:{...i,[a]:{fileIDs:t,step:0,result:{}}}}),a}function G(e){const{currentUploads:t}=this.getState();return t[e]}function q(e){const t={...this.getState().currentUploads};delete t[e],this.setState({currentUploads:t})}async function K(e){let{currentUploads:t}=this.getState(),n=t[e];const r=n.step||0,o=[...i(this,D)[D],...i(this,w)[w],...i(this,S)[S]];try{for(let i=r;i<o.length&&n;i++){const r=o[i],a={...n,step:i};this.setState({currentUploads:{...t,[e]:a}}),await r(a.fileIDs,e),t=this.getState().currentUploads,n=t[e]}}catch(t){throw i(this,_)[_](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 a;return n&&(a=n.result,this.emit("complete",a),i(this,_)[_](e)),null==a&&this.log(`Not setting result for an upload that has been removed: ${e}`),a}return L.VERSION="2.3.4",_w=L}var Kw,Yw,Xw,Zw,Jw,Qw,eS,tS,nS,rS,oS,iS,aS,sS={},uS=[],lS=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,cS=Array.isArray;function dS(e,t){for(var n in t)e[n]=t[n];return e}function fS(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function pS(e,t,n){var r,o,i,a={};for(i in t)"key"==i?r=t[i]:"ref"==i?o=t[i]:a[i]=t[i];if(arguments.length>2&&(a.children=arguments.length>3?Kw.call(arguments,2):n),"function"==typeof e&&null!=e.defaultProps)for(i in e.defaultProps)void 0===a[i]&&(a[i]=e.defaultProps[i]);return hS(e,a,r,o,null)}function hS(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?++Xw:o,__i:-1,__u:0};return null==o&&null!=Yw.vnode&&Yw.vnode(i),i}function gS(e){return e.children}function vS(e,t){this.props=e,this.context=t}function mS(e,t){if(null==t)return e.__?mS(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?mS(e):null}function yS(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 yS(e)}}function bS(e){(!e.__d&&(e.__d=!0)&&Jw.push(e)&&!ES.__r++||Qw!=Yw.debounceRendering)&&((Qw=Yw.debounceRendering)||eS)(ES)}function ES(){for(var e,t,n,r,o,i,a,s=1;Jw.length;)Jw.length>s&&Jw.sort(tS),e=Jw.shift(),s=Jw.length,e.__d&&(n=void 0,r=void 0,o=(r=(t=e).__v).__e,i=[],a=[],t.__P&&((n=dS({},r)).__v=r.__v+1,Yw.vnode&&Yw.vnode(n),NS(t.__P,n,r,t.__n,t.__P.namespaceURI,32&r.__u?[o]:null,i,null==o?mS(r):o,!!(32&r.__u),a),n.__v=r.__v,n.__.__k[n.__i]=n,TS(i,n,a),r.__e=r.__=null,n.__e!=o&&yS(n)));ES.__r=0}function CS(e,t,n,r,o,i,a,s,u,l,c){var d,f,p,h,g,v,m,y=r&&r.__k||uS,b=t.length;for(u=DS(n,t,y,u,b),d=0;d<b;d++)null!=(p=n.__k[d])&&(f=-1==p.__i?sS:y[p.__i]||sS,p.__i=d,v=NS(e,p,f,o,i,a,s,u,l,c),h=p.__e,p.ref&&f.ref!=p.ref&&(f.ref&&IS(f.ref,null,p),c.push(p.ref,p.__c||h,p)),null==g&&null!=h&&(g=h),(m=!!(4&p.__u))||f.__k===p.__k?u=wS(p,u,e,m):"function"==typeof p.type&&void 0!==v?u=v:h&&(u=h.nextSibling),p.__u&=-7);return n.__e=g,u}function DS(e,t,n,r,o){var i,a,s,u,l,c=n.length,d=c,f=0;for(e.__k=new Array(o),i=0;i<o;i++)null!=(a=t[i])&&"boolean"!=typeof a&&"function"!=typeof a?(u=i+f,(a=e.__k[i]="string"==typeof a||"number"==typeof a||"bigint"==typeof a||a.constructor==String?hS(null,a,null,null,null):cS(a)?hS(gS,{children:a},null,null,null):null==a.constructor&&a.__b>0?hS(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):a).__=e,a.__b=e.__b+1,s=null,-1!=(l=a.__i=SS(a,n,u,d))&&(d--,(s=n[l])&&(s.__u|=2)),null==s||null==s.__v?(-1==l&&(o>c?f--:o<c&&f++),"function"!=typeof a.type&&(a.__u|=4)):l!=u&&(l==u-1?f--:l==u+1?f++:(l>u?f--:f++,a.__u|=4))):e.__k[i]=null;if(d)for(i=0;i<c;i++)null!=(s=n[i])&&!(2&s.__u)&&(s.__e==r&&(r=mS(s)),PS(s,s));return r}function wS(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=wS(o[i],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=mS(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do{t=t&&t.nextSibling}while(null!=t&&8==t.nodeType);return t}function SS(e,t,n,r){var o,i,a,s=e.key,u=e.type,l=t[n],c=null!=l&&!(2&l.__u);if(null===l&&null==e.key||c&&s==l.key&&u==l.type)return n;if(r>(c?1:0))for(o=n-1,i=n+1;o>=0||i<t.length;)if(null!=(l=t[a=o>=0?o--:i++])&&!(2&l.__u)&&s==l.key&&u==l.type)return a;return-1}function AS(e,t,n){"-"==t[0]?e.setProperty(t,null==n?"":n):e[t]=null==n?"":"number"!=typeof n||lS.test(t)?n:n+"px"}function xS(e,t,n,r,o){var i,a;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||AS(e.style,t,"");if(n)for(t in n)r&&n[t]==r[t]||AS(e.style,t,n[t])}else if("o"==t[0]&&"n"==t[1])i=t!=(t=t.replace(nS,"$1")),a=t.toLowerCase(),t=a in e||"onFocusOut"==t||"onFocusIn"==t?a.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+i]=n,n?r?n.u=r.u:(n.u=rS,e.addEventListener(t,i?iS:oS,i)):e.removeEventListener(t,i?iS:oS,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 OS(e){return function(t){if(this.l){var n=this.l[t.type+e];if(null==t.t)t.t=rS++;else if(t.t<n.u)return;return n(Yw.event?Yw.event(t):t)}}}function NS(e,t,n,r,o,i,a,s,u,l){var c,d,f,p,h,g,v,m,y,b,E,C,D,w,S,A,x,O=t.type;if(null!=t.constructor)return null;128&n.__u&&(u=!!(32&n.__u),i=[s=t.__e=n.__e]),(c=Yw.__b)&&c(t);e:if("function"==typeof O)try{if(m=t.props,y="prototype"in O&&O.prototype.render,b=(c=O.contextType)&&r[c.__c],E=c?b?b.props.value:c.__:r,n.__c?v=(d=t.__c=n.__c).__=d.__E:(y?t.__c=d=new O(m,E):(t.__c=d=new vS(m,E),d.constructor=O,d.render=_S),b&&b.sub(d),d.props=m,d.state||(d.state={}),d.context=E,d.__n=r,f=d.__d=!0,d.__h=[],d._sb=[]),y&&null==d.__s&&(d.__s=d.state),y&&null!=O.getDerivedStateFromProps&&(d.__s==d.state&&(d.__s=dS({},d.__s)),dS(d.__s,O.getDerivedStateFromProps(m,d.__s))),p=d.props,h=d.state,d.__v=t,f)y&&null==O.getDerivedStateFromProps&&null!=d.componentWillMount&&d.componentWillMount(),y&&null!=d.componentDidMount&&d.__h.push(d.componentDidMount);else{if(y&&null==O.getDerivedStateFromProps&&m!==p&&null!=d.componentWillReceiveProps&&d.componentWillReceiveProps(m,E),!d.__e&&null!=d.shouldComponentUpdate&&!1===d.shouldComponentUpdate(m,d.__s,E)||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)}),C=0;C<d._sb.length;C++)d.__h.push(d._sb[C]);d._sb=[],d.__h.length&&a.push(d);break e}null!=d.componentWillUpdate&&d.componentWillUpdate(m,d.__s,E),y&&null!=d.componentDidUpdate&&d.__h.push(function(){d.componentDidUpdate(p,h,g)})}if(d.context=E,d.props=m,d.__P=e,d.__e=!1,D=Yw.__r,w=0,y){for(d.state=d.__s,d.__d=!1,D&&D(t),c=d.render(d.props,d.state,d.context),S=0;S<d._sb.length;S++)d.__h.push(d._sb[S]);d._sb=[]}else do{d.__d=!1,D&&D(t),c=d.render(d.props,d.state,d.context),d.state=d.__s}while(d.__d&&++w<25);d.state=d.__s,null!=d.getChildContext&&(r=dS(dS({},r),d.getChildContext())),y&&!f&&null!=d.getSnapshotBeforeUpdate&&(g=d.getSnapshotBeforeUpdate(p,h)),A=c,null!=c&&c.type===gS&&null==c.key&&(A=kS(c.props.children)),s=CS(e,cS(A)?A:[A],t,n,r,o,i,a,s,u,l),d.base=t.__e,t.__u&=-161,d.__h.length&&a.push(d),v&&(d.__E=d.__=null)}catch(e){if(t.__v=null,u||null!=i)if(e.then){for(t.__u|=u?160:128;s&&8==s.nodeType&&s.nextSibling;)s=s.nextSibling;i[i.indexOf(s)]=null,t.__e=s}else{for(x=i.length;x--;)fS(i[x]);BS(t)}else t.__e=n.__e,t.__k=n.__k,e.then||BS(t);Yw.__e(e,t,n)}else null==i&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=FS(n.__e,t,n,r,o,i,a,u,l);return(c=Yw.diffed)&&c(t),128&t.__u?void 0:s}function BS(e){e&&e.__c&&(e.__c.__e=!0),e&&e.__k&&e.__k.forEach(BS)}function TS(e,t,n){for(var r=0;r<n.length;r++)IS(n[r],n[++r],n[++r]);Yw.__c&&Yw.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){Yw.__e(e,t.__v)}})}function kS(e){return"object"!=typeof e||null==e||e.__b&&e.__b>0?e:cS(e)?e.map(kS):dS({},e)}function FS(e,t,n,r,o,i,a,s,u){var l,c,d,f,p,h,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(l=0;l<i.length;l++)if((p=i[l])&&"setAttribute"in p==!!y&&(y?p.localName==y:3==p.nodeType)){e=p,i[l]=null;break}if(null==e){if(null==y)return document.createTextNode(m);e=document.createElementNS(o,y,m.is&&m),s&&(Yw.__m&&Yw.__m(t,i),s=!1),i=null}if(null==y)v===m||s&&e.data==m||(e.data=m);else{if(i=i&&Kw.call(e.childNodes),v=n.props||sS,!s&&null!=i)for(v={},l=0;l<e.attributes.length;l++)v[(p=e.attributes[l]).name]=p.value;for(l in v)if(p=v[l],"children"==l);else if("dangerouslySetInnerHTML"==l)d=p;else if(!(l in m)){if("value"==l&&"defaultValue"in m||"checked"==l&&"defaultChecked"in m)continue;xS(e,l,null,p,o)}for(l in m)p=m[l],"children"==l?f=p:"dangerouslySetInnerHTML"==l?c=p:"value"==l?h=p:"checked"==l?g=p:s&&"function"!=typeof p||v[l]===p||xS(e,l,p,v[l],o);if(c)s||d&&(c.__html==d.__html||c.__html==e.innerHTML)||(e.innerHTML=c.__html),t.__k=[];else if(d&&(e.innerHTML=""),CS("template"==t.type?e.content:e,cS(f)?f:[f],t,n,r,"foreignObject"==y?"http://www.w3.org/1999/xhtml":o,i,a,i?i[0]:n.__k&&mS(n,0),s,u),null!=i)for(l=i.length;l--;)fS(i[l]);s||(l="value","progress"==y&&null==h?e.removeAttribute("value"):null!=h&&(h!==e[l]||"progress"==y&&!h||"option"==y&&h!=v[l])&&xS(e,l,h,v[l],o),l="checked",null!=g&&g!=e[l]&&xS(e,l,g,v[l],o))}return e}function IS(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){Yw.__e(e,n)}}function PS(e,t,n){var r,o;if(Yw.unmount&&Yw.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||IS(r,null,t)),null!=(r=e.__c)){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){Yw.__e(e,t)}r.base=r.__P=null}if(r=e.__k)for(o=0;o<r.length;o++)r[o]&&PS(r[o],t,n||"function"!=typeof e.type);n||fS(e.__e),e.__c=e.__=e.__e=void 0}function _S(e,t,n){return this.constructor(e,n)}function RS(e,t,n){var r,o,i,a;t==document&&(t=document.documentElement),Yw.__&&Yw.__(e,t),o=(r="function"==typeof n)?null:n&&n.__k||t.__k,i=[],a=[],NS(t,e=(!r&&n||t).__k=pS(gS,null,[e]),o||sS,sS,t.namespaceURI,!r&&n?[n]:o?null:t.firstChild?Kw.call(t.childNodes):null,i,!r&&n?n:o?o.__e:t.firstChild,r,a),TS(i,e,a)}Kw=uS.slice,Yw={__e:function(e,t,n,r){for(var o,i,a;t=t.__;)if((o=t.__c)&&!o.__)try{if((i=o.constructor)&&null!=i.getDerivedStateFromError&&(o.setState(i.getDerivedStateFromError(e)),a=o.__d),null!=o.componentDidCatch&&(o.componentDidCatch(e,r||{}),a=o.__d),a)return o.__E=o}catch(t){e=t}throw e}},Xw=0,Zw=function(e){return null!=e&&null==e.constructor},vS.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!=this.state?this.__s:this.__s=dS({},this.state),"function"==typeof e&&(e=e(dS({},n),this.props)),e&&dS(n,e),null!=e&&this.__v&&(t&&this._sb.push(t),bS(this))},vS.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),bS(this))},vS.prototype.render=gS,Jw=[],eS="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,tS=function(e,t){return e.__v.__b-t.__v.__b},ES.__r=0,nS=/(PointerCapture)$|Capture$/i,rS=0,oS=OS(!1),iS=OS(!0),aS=0;var LS,MS,jS,HS,zS,$S,US,VS,WS,GS,qS,KS=Object.freeze({__proto__:null,Component:vS,Fragment:gS,cloneElement:function(e,t,n){var r,o,i,a,s=dS({},e.props);for(i in e.type&&e.type.defaultProps&&(a=e.type.defaultProps),t)"key"==i?r=t[i]:"ref"==i?o=t[i]:s[i]=void 0===t[i]&&null!=a?a[i]:t[i];return arguments.length>2&&(s.children=arguments.length>3?Kw.call(arguments,2):n),hS(e.type,s,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,bS(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"+aS++,t.__=e,t.Provider=t.__l=(t.Consumer=function(e,t){return e.children(t)}).contextType=t,t},createElement:pS,createRef:function(){return{current:null}},h:pS,hydrate:function e(t,n){RS(t,n,e)},get isValidElement(){return Zw},get options(){return Yw},render:RS,toChildArray:function e(t,n){return n=n||[],null==t||"boolean"==typeof t||(cS(t)?t.some(function(t){e(t,n)}):n.push(t)),n}}),YS=E(KS);function XS(){if(HS)return jS;HS=1;const e=MS?LS:(MS=1,LS=function(e){return(null==e?void 0:e.nodeType)===Node.ELEMENT_NODE});return jS=function(t,n){return void 0===n&&(n=document),"string"==typeof t?n.querySelector(t):e(t)?t:null}}function ZS(){if(VS)return US;VS=1;const e=$w();return US=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 JS(){if(GS)return WS;GS=1;var e=YS;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=XS(),i=$S?zS:($S=1,zS=function(e){for(var t;e&&!e.dir;)e=e.parentNode;return null==(t=e)?void 0:t.dir}),a=ZS();var s=r("updateUI");class u extends a{constructor(){super(...arguments),Object.defineProperty(this,s,{writable:!0,value:void 0})}mount(n,r){const a=r.id,l=o(n);if(l){this.isTargetDOMEl=!0;const r=document.createElement("div");return r.classList.add("uppy-Root"),t(this,s)[s]=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 ${a} to a DOM element '${n}'`),this.opts.replaceTargetContent&&(l.innerHTML=""),(0,e.render)(this.render(this.uppy.getState()),r),this.el=r,l.appendChild(r),r.dir=this.opts.direction||i(r)||"ltr",this.onMount(),this.el}let c;if("object"==typeof n&&n instanceof u)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 ${a} to ${c.id}`),this.parent=c,this.el=c.addTarget(r),this.onMount(),this.el;this.uppy.log(`Not installing ${a}`);let d=`Invalid target option given to ${a}.`;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,s))[s])||n.call(r,e))}unmount(){var e;this.isTargetDOMEl&&(null==(e=this.el)||e.remove());this.onUnmount()}onMount(){}onUnmount(){}}return WS=u}var QS,eA,tA,nA,rA,oA,iA,aA,sA,uA,lA=(qS||(qS=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=ow();e.exports=qw();const r=JS();t.UIPlugin=r;const o=ZS();t.BasePlugin=o;const i=qw();t.Uppy=i;const a=JS(),s=ZS();i.Uppy=i,i.UIPlugin=a,i.BasePlugin=s,i.debugLogger=n.debugLogger}(nw,nw.exports)),nw.exports),cA=b(lA),dA={};function fA(){if(eA)return QS;eA=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 QS=e}function pA(){if(uA)return sA;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}uA=1;var n=0;function r(e){return"__private_"+n+++"_"+e}const o=function(){if(nA)return tA;nA=1;const e=fA();return tA=function(){return fetch(...arguments).catch(t=>{throw"AbortError"===t.name?t:new e(t)})},tA}(),i=function(){if(oA)return rA;oA=1;const e=zw();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 rA=t}(),a=function(){if(aA)return iA;aA=1;class e extends Error{constructor(){super("Authorization required"),this.name="AuthError",this.isAuthError=!0}}return iA=e}();async function s(e){if(401===e.status)throw new a;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 u=r("companionHeaders"),l=r("getPostResponseFunc"),c=r("getUrl"),d=r("errorHandler");e=Symbol.for("uppy test: getCompanionHeaders");class f{constructor(e,n){Object.defineProperty(this,d,{value:h}),Object.defineProperty(this,c,{value:p}),Object.defineProperty(this,u,{writable:!0,value:void 0}),Object.defineProperty(this,l,{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,u)[u]=null==n?void 0:n.companionHeaders}setCompanionHeaders(e){t(this,u)[u]=e}[e](){return t(this,u)[u]}get hostname(){const{companion:e}=this.uppy.getState(),t=this.opts.companionUrl;return(e&&e[t]?e[t]:t).replace(/\/$/,"")}headers(){return Promise.resolve({...f.defaultHeaders,...t(this,u)[u]})}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,l)[l](n)).then(s).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,l)[l](r)).then(s).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,l)[l](r)).then(s).catch(t(this,d)[d](i,e))}}function p(e){return/^(https?:|)\/\//.test(e)?e:`${this.hostname}/${e}`}function h(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 f.VERSION="2.2.2",f.defaultHeaders={Accept:"application/json","Content-Type":"application/json","Uppy-Versions":`@uppy/companion-client=${f.VERSION}`},sA=f}var hA,gA,vA,mA,yA,bA,EA,CA,DA={};function wA(){if(hA)return DA;return hA=1,Object.defineProperty(DA,"__esModule",{value:!0}),DA.getItem=function(e){return Promise.resolve(localStorage.getItem(e))},DA.removeItem=function(e){return new Promise(t=>{localStorage.removeItem(e),t()})},DA.setItem=function(e,t){return new Promise(n=>{localStorage.setItem(e,t),n()})},DA}function SA(){if(CA)return dA;CA=1,Object.defineProperty(dA,"__esModule",{value:!0}),dA.Socket=dA.SearchProvider=dA.RequestClient=dA.Provider=void 0;const e=pA();dA.RequestClient=e;const t=function(){if(vA)return gA;vA=1;var e=wA();const t=pA();return gA=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}},gA}();dA.Provider=t;const n=function(){if(yA)return mA;yA=1;const e=pA();return mA=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}`:""}`)}},mA}();dA.SearchProvider=n;const r=function(){if(EA)return bA;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}EA=1;var r=0;function o(e){return"__private_"+r+++"_"+e}const i=Uw();var a=o("queued"),s=o("emitter"),u=o("isOpen"),l=o("socket"),c=o("handleMessage");return e=Symbol.for("uppy test: getSocket"),t=Symbol.for("uppy test: getQueued"),bA=class{constructor(e){Object.defineProperty(this,a,{writable:!0,value:[]}),Object.defineProperty(this,s,{writable:!0,value:i()}),Object.defineProperty(this,u,{writable:!0,value:!1}),Object.defineProperty(this,l,{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,u)[u]}[e](){return n(this,l)[l]}[t](){return n(this,a)[a]}open(){n(this,l)[l]=new WebSocket(this.opts.target),n(this,l)[l].onopen=()=>{for(n(this,u)[u]=!0;n(this,a)[a].length>0&&n(this,u)[u];){const e=n(this,a)[a].shift();this.send(e.action,e.payload)}},n(this,l)[l].onclose=()=>{n(this,u)[u]=!1},n(this,l)[l].onmessage=n(this,c)[c]}close(){var e;null==(e=n(this,l)[l])||e.close()}send(e,t){n(this,u)[u]?n(this,l)[l].send(JSON.stringify({action:e,payload:t})):n(this,a)[a].push({action:e,payload:t})}on(e,t){n(this,s)[s].on(e,t)}emit(e,t){n(this,s)[s].emit(e,t)}once(e,t){n(this,s)[s].once(e,t)}},bA}();return dA.Socket=r,dA}var AA,xA,OA,NA,BA,TA,kA,FA,IA,PA,_A,RA,LA,MA,jA,HA,zA,$A={};function UA(){if(AA)return $A;function e(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}AA=1,Object.defineProperty($A,"__esModule",{value:!0}),$A.internalRateLimitedQueue=$A.RateLimitedQueue=void 0;var t=0;function n(e){return"__private_"+t+++"_"+e}var r=n("activeRequests"),o=n("queuedHandlers"),i=n("paused"),a=n("pauseTimer"),s=n("downLimit"),u=n("upperLimit"),l=n("rateLimitingTimer"),c=n("call"),d=n("queueNext"),f=n("next"),p=n("queue"),h=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,f)[f]())}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 E(t,n){void 0===n&&(n={});const r={fn:t,priority:n.priority||0,abort:()=>{e(this,h)[h](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 C(t){const n=e(this,o)[o].indexOf(t);-1!==n&&e(this,o)[o].splice(n,1)}$A.RateLimitedQueue=class{constructor(t){Object.defineProperty(this,h,{value:C}),Object.defineProperty(this,p,{value:E}),Object.defineProperty(this,f,{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,a,{writable:!0,value:void 0}),Object.defineProperty(this,s,{writable:!0,value:1}),Object.defineProperty(this,u,{writable:!0,value:void 0}),Object.defineProperty(this,l,{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,l)[l]=setTimeout(e(this,v)[v],0);else{e(this,s)[s]=this.limit,this.limit=Math.ceil((e(this,u)[u]+e(this,s)[s])/2);for(let t=e(this,s)[s];t<=this.limit;t++)e(this,d)[d]();e(this,u)[u]-e(this,s)[s]>3?e(this,l)[l]=setTimeout(e(this,v)[v],2e3):e(this,s)[s]=Math.floor(e(this,s)[s]/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 a;const s=new Promise((r,i)=>{a=n.run(()=>{let t,n;try{n=Promise.resolve(e(...o))}catch(e){n=Promise.reject(e)}return n.then(e=>{t?i(t):(a.done(),r(e))},e=>{t?i(t):(a.done(),i(e))}),()=>{t=new Error("Cancelled")}},t)});return s.abort=()=>{a.abort()},s}}resume(){e(this,i)[i]=!1,clearTimeout(e(this,a)[a]);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,a)[a]),null!=t&&(e(this,a)[a]=setTimeout(e(this,g)[g],t))}rateLimit(t){clearTimeout(e(this,l)[l]),this.pause(t),this.limit>1&&Number.isFinite(this.limit)&&(e(this,u)[u]=this.limit-1,this.limit=e(this,s)[s],e(this,l)[l]=setTimeout(e(this,v)[v],t))}get isPaused(){return e(this,i)[i]}};const D=Symbol("__queue");return $A.internalRateLimitedQueue=D,$A}function VA(){return jA?MA:(jA=1,MA={strings:{timedOut:"Upload stalled for %{seconds} seconds, aborting."}})}var WA=function(){if(zA)return HA;zA=1;var e=iw(),t=SA(),n=UA();const r=ZS(),o=function(){if(OA)return xA;OA=1;const e=SC();return xA=e(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})}(),i=BA?NA:(BA=1,NA=function(e){const t=/^(?:https?:\/\/|\/\/)?(?:[^@\n]+@)?(?:www\.)?([^\n]+)/i.exec(e)[1];return`${/^http:\/\//i.test(e)?"ws":"wss"}://${t}`}),a=kA?TA:(kA=1,TA=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}))}),s=function(){if(IA)return FA;function e(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}IA=1;var t=0;function n(e){return"__private_"+t+++"_"+e}var r=n("emitter"),o=n("events");return FA=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)}},FA}(),u=function(){if(_A)return PA;function e(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}_A=1;var t=0;function n(e){return"__private_"+t+++"_"+e}var r=n("aliveTimer"),o=n("isDone"),i=n("onTimedOut"),a=n("timeout");return PA=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,a,{writable:!0,value:void 0}),e(this,a)[a]=t,e(this,i)[i]=n}progress(){e(this,o)[o]||e(this,a)[a]>0&&(clearTimeout(e(this,r)[r]),e(this,r)[r]=setTimeout(e(this,i)[i],e(this,a)[a]))}done(){e(this,o)[o]||(clearTimeout(e(this,r)[r]),e(this,r)[r]=null,e(this,o)[o]=!0)}}}(),l=fA(),c=LA?RA:(LA=1,RA=function(e){return!!e&&(0!==e.readyState&&4!==e.readyState||0===e.status)}),d=VA();function f(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})),c(e)?(n=new l(n,e),n):(n.request=e,n)}function p(e){return e.data.slice(0,e.data.size,e.meta.type)}class h extends r{constructor(e,t){super(e,t),this.type="uploader",this.id=this.opts.id||"XHRUpload",this.title="XHRUpload",this.defaultLocale=d;const r={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 c(t)&&(n=new l(n,t)),n},validateStatus:e=>e>=200&&e<300};if(this.opts={...r,...t},this.i18nInit(),this.handleUpload=this.handleUpload.bind(this),n.internalRateLimitedQueue in this.opts?this.requests=this.opts[n.internalRateLimitedQueue]:this.requests=new n.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=p(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=p(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,a=new XMLHttpRequest;let l;this.uploaderEvents[t.id]=new s(this.uppy);const c=new u(o.timeout,()=>{a.abort(),l.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)();a.upload.addEventListener("loadstart",()=>{this.uppy.log(`[XHRUpload] ${d} started`)}),a.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})}),a.addEventListener("load",()=>{if(this.uppy.log(`[XHRUpload] ${d} finished`),c.done(),l.done(),this.uploaderEvents[t.id]&&(this.uploaderEvents[t.id].remove(),this.uploaderEvents[t.id]=null),o.validateStatus(a.status,a.responseText,a)){const e=o.getResponseData(a.responseText,a),r=e[o.responseUrlFieldName],i={status:a.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(a.responseText,a),i=f(a,o.getResponseError(a.responseText,a)),s={status:a.status,body:e};return this.uppy.emit("upload-error",t,i,s),r(i)}),a.addEventListener("error",()=>{this.uppy.log(`[XHRUpload] ${d} errored`),c.done(),l.done(),this.uploaderEvents[t.id]&&(this.uploaderEvents[t.id].remove(),this.uploaderEvents[t.id]=null);const e=f(a,o.getResponseError(a.responseText,a));return this.uppy.emit("upload-error",t,e),r(e)}),a.open(o.method.toUpperCase(),o.endpoint,!0),a.withCredentials=o.withCredentials,""!==o.responseType&&(a.responseType=o.responseType),l=this.requests.run(()=>{this.uppy.emit("upload-started",t);const e=this.getOptions(t);return Object.keys(e.headers).forEach(t=>{a.setRequestHeader(t,e.headers[t])}),a.send(i),()=>{c.done(),a.abort()}}),this.onFileRemove(t.id,()=>{l.abort(),r(new Error("File removed"))}),this.onCancelAll(t.id,e=>{let{reason:t}=e;"user"===t&&l.abort(),r(new Error("Upload cancelled"))})})}uploadRemote(e){const n=this.getOptions(e);return new Promise((r,a)=>{this.uppy.emit("upload-started",e);const u={};(Array.isArray(n.metaFields)?n.metaFields:Object.keys(e.meta)).forEach(t=>{u[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:u,httpMethod:n.method,useFormData:n.formData,headers:n.headers}).then(u=>{const{token:l}=u,c=i(e.remote.companionUrl),d=new t.Socket({target:`${c}/api/${l}`,autoOpen:!1});let f;this.uploaderEvents[e.id]=new s(this.uppy),this.onFileRemove(e.id,()=>{d.send("cancel",{}),f.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",{}),f.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=>o(this,t,e)),d.on("success",t=>{const o=n.getResponseData(t.response.responseText,t.response),i=o[n.responseUrlFieldName],a={status:t.response.status,body:o,uploadURL:i};return this.uppy.emit("upload-success",e,a),f.done(),this.uploaderEvents[e.id]&&(this.uploaderEvents[e.id].remove(),this.uploaderEvents[e.id]=null),r()}),d.on("error",t=>{const r=t.response,o=r?n.getResponseError(r.responseText,r):Object.assign(new Error(t.error.message),{cause:t.error});this.uppy.emit("upload-error",e,o),f.done(),this.uploaderEvents[e.id]&&(this.uploaderEvents[e.id].remove(),this.uploaderEvents[e.id]=null),a(o)}),f=this.requests.run(()=>(d.open(),e.isPaused&&d.send("pause",{}),()=>d.close()))}).catch(t=>{this.uppy.emit("upload-error",e,t),a(t)})})}uploadBundle(e){return new Promise((t,n)=>{const{endpoint:r}=this.opts,{method:o}=this.opts,i=this.uppy.getState().xhrUpload,a=this.createBundledUpload(e,{...this.opts,...i||{}}),s=new XMLHttpRequest,l=t=>{e.forEach(e=>{this.uppy.emit("upload-error",e,t)})},c=new u(this.opts.timeout,()=>{s.abort();const e=new Error(this.i18n("timedOut",{seconds:Math.ceil(this.opts.timeout/1e3)}));l(e),n(e)});s.upload.addEventListener("loadstart",()=>{this.uppy.log("[XHRUpload] started uploading bundle"),c.progress()}),s.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})})}),s.addEventListener("load",r=>{if(c.done(),this.opts.validateStatus(r.target.status,s.responseText,s)){const n=this.opts.getResponseData(s.responseText,s),o={status:r.target.status,body:n};return e.forEach(e=>{this.uppy.emit("upload-success",e,o)}),t()}const o=this.opts.getResponseError(s.responseText,s)||new Error("Upload error");return o.request=s,l(o),n(o)}),s.addEventListener("error",()=>{c.done();const e=this.opts.getResponseError(s.responseText,s)||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(),s.abort())}),s.open(o.toUpperCase(),r,!0),s.withCredentials=this.opts.withCredentials,""!==this.opts.responseType&&(s.responseType=this.opts.responseType),Object.keys(this.opts.headers).forEach(e=>{s.setRequestHeader(e,this.opts.headers[e])}),s.send(a),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[n.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 h.VERSION="2.1.3",HA=h}(),GA=b(WA);function qA(e){var t=e.server,n=void 0===t?"":t,r=e.fieldName,o=void 0===r?"":r,i=e.maxFileSize,a=void 0===i?10485760:i,s=e.maxNumberOfFiles,u=void 0===s?100:s,l=e.meta,c=void 0===l?{}:l,d=e.metaWithUrl,f=void 0!==d&&d,p=e.headers,h=void 0===p?{}:p,g=e.withCredentials,v=void 0!==g&&g,m=e.timeout,y=void 0===m?1e4:m,b=e.onBeforeUpload,E=void 0===b?function(e){return e}:b,C=e.onSuccess,D=void 0===C?function(e,t){}:C,w=e.onError,S=void 0===w?function(e,t,n){console.error("".concat(e.name," upload error"),t,n)}:w,A=e.onProgress,x=void 0===A?function(e){}:A;if(!n)throw new Error("Cannot get upload server address\n没有配置上传地址");if(!o)throw new Error("Cannot get fieldName\n没有配置 fieldName");var O=n;f&&(O=function(e,t){var n=Qg(e.split("#"),2),r=n[0],o=n[1],i=[];lv(t,function(e,t){i.push("".concat(t,"=").concat(e))});var a=i.join("&");return r=r.indexOf("?")>0?"".concat(r,"&").concat(a):"".concat(r,"?").concat(a),o?"".concat(r,"#").concat(o):r}(O,c));var N=new cA(Yg({onBeforeUpload:E,restrictions:{maxFileSize:a,maxNumberOfFiles:u},meta:c},e.uppyConfig)).use(GA,Yg({endpoint:O,headers:h,formData:!0,fieldName:o,bundle:!0,withCredentials:v,timeout:y},e.xhrConfig));return N.on("complete",function(e){var t=e.successful[0],n=t.response,r=(null!=n?n:{}).body,o=void 0===r?{}:r;try{D(t,o)}catch(e){console.error("wangEditor upload file - onSuccess error",e)}}),N.on("progress",function(e){e<1||x(e)}),N.on("upload-error",function(e,t,n){try{S(e,t,n)}catch(e){console.error("wangEditor upload file - onError error",e)}}),N.on("restriction-failed",function(e,t){try{S(e,t)}catch(e){console.error("wangEditor upload file - onError error",e)}}),N}YE("en",{editor:{more:"More",justify:"Justify",indent:"Indent",image:"Image",video:"Video"}}),YE("zh-CN",{editor:{more:"更多",justify:"对齐",indent:"缩进",image:"图片",video:"视频"}});var KA,YA,XA,ZA,JA,QA,ex,tx,nx,rx,ox,ix,ax,sx,ux,lx={};function cx(){if(YA)return KA;YA=1;var e=S();return KA=Array.isArray||function(t){return"Array"===e(t)}}function dx(){if(ZA)return XA;ZA=1;var e=w(),t=C(),n=me(),r=Tr(),o=zt(),i=An(),a=function(){},s=o("Reflect","construct"),u=/^\s*(?:class|function)\b/,l=e(u.exec),c=!u.test(a),d=function(e){if(!n(e))return!1;try{return s(a,[],e),!0}catch(e){return!1}},f=function(e){if(!n(e))return!1;switch(r(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return c||!!l(u,i(e))}catch(e){return!0}};return f.sham=!0,XA=!s||t(function(){var e;return d(d.call)||!d(Object)||!d(function(){e=!0})||e})?f:d}function fx(){if(QA)return JA;QA=1;var e=cx(),t=dx(),n=ye(),r=ve()("species"),o=Array;return JA=function(i){var a;return e(i)&&(a=i.constructor,(t(a)&&(a===o||e(a.prototype))||n(a)&&null===(a=a[r]))&&(a=void 0)),void 0===a?o:a},JA}function px(){if(tx)return ex;tx=1;var e=fx();return ex=function(t,n){return new(e(t))(0===n?0:n)}}function hx(){if(ix)return ox;ix=1;var e=C();return ox=function(t,n){var r=[][t];return!!r&&e(function(){r.call(null,n||function(){return 1},1)})}}function gx(){if(sx)return ax;sx=1;var e=function(){if(rx)return nx;rx=1;var e=Go(),t=w(),n=A(),r=ce(),o=Jt(),i=px(),a=t([].push),s=function(t){var s=1===t,u=2===t,l=3===t,c=4===t,d=6===t,f=7===t,p=5===t||d;return function(h,g,v,m){for(var y,b,E=r(h),C=n(E),D=o(C),w=e(g,v),S=0,A=m||i,x=s?A(h,D):u||f?A(h,0):void 0;D>S;S++)if((p||S in C)&&(b=w(y=C[S],S,E),t))if(s)x[S]=b;else if(b)switch(t){case 3:return!0;case 5:return y;case 6:return S;case 2:a(x,y)}else switch(t){case 4:return!1;case 7:a(x,y)}return d?-1:l||c?c:x}};return nx={forEach:s(0),map:s(1),filter:s(2),some:s(3),every:s(4),find:s(5),findIndex:s(6),filterReject:s(7)}}().forEach,t=hx()("forEach");return ax=t?[].forEach:function(t){return e(this,t,arguments.length>1?arguments[1]:void 0)},ax}!function(){if(ux)return lx;ux=1;var e=B(),t=ci(),n=di(),r=gx(),o=ln(),i=function(e){if(e&&e.forEach!==r)try{o(e,"forEach",r)}catch(t){e.forEach=r}};for(var a in t)t[a]&&i(e[a]&&e[a].prototype);i(n)}();YE("en",{common:{ok:"OK",delete:"Delete",enter:"Enter"},blockQuote:{title:"Quote"},codeBlock:{title:"Code block"},color:{color:"Font color",bgColor:"Back color",default:"Default color",clear:"Clear back color"},divider:{title:"Divider"},emotion:{title:"Emotion"},fontSize:{title:"Font size",default:"Default"},fontFamily:{title:"Font family",default:"Default"},fullScreen:{title:"Full screen",cancelTitle:"Cancel full screen"},header:{title:"Header",text:"Text"},image:{netImage:"Net image",delete:"Delete image",edit:"Edit image",editSize:"Edit size",viewLink:"View link",src:"Image src",desc:"Description",link:"Image link",ok:"Ok",width:"Width",height:"Height"},indent:{decrease:"Decrease",increase:"Increase"},justify:{left:"Left",right:"Right",center:"Center",justify:"Justify"},lineHeight:{title:"Line height",default:"Default"},link:{insert:"Insert link",text:"Link text",url:"Link source",unLink:"Unlink",edit:"Edit link",view:"View link"},textStyle:{bold:"Bold",clear:"Clear styles",code:"Inline code",italic:"Italic",sub:"Sub",sup:"Sup",through:"Through",underline:"Underline"},undo:{undo:"undo",redo:"Redo"},todo:{todo:"Todo"},formatPainter:{title:"Format Painter"}}),YE("zh-CN",{common:{ok:"确定",delete:"删除",enter:"回车"},blockQuote:{title:"引用"},codeBlock:{title:"代码块"},color:{color:"文字颜色",bgColor:"背景色",default:"默认颜色",clear:"清除背景色"},divider:{title:"分割线"},emotion:{title:"表情"},fontSize:{title:"字号",default:"默认字号"},fontFamily:{title:"字体",default:"默认字体"},fullScreen:{title:"全屏",cancelTitle:"取消全屏"},header:{title:"标题",text:"正文"},image:{netImage:"网络图片",delete:"删除图片",edit:"编辑图片",editSize:"修改尺寸",viewLink:"查看链接",src:"图片地址",desc:"图片描述",link:"图片链接",ok:"确定",width:"宽度",height:"高度"},indent:{decrease:"减少缩进",increase:"增加缩进"},justify:{left:"左对齐",right:"右对齐",center:"居中对齐",justify:"两端对齐"},lineHeight:{title:"行高",default:"默认行高"},link:{insert:"插入链接",text:"链接文本",url:"链接地址",unLink:"取消链接",edit:"修改链接",view:"查看链接"},textStyle:{bold:"粗体",clear:"清除格式",code:"行内代码",italic:"斜体",sub:"下标",sup:"上标",through:"删除线",underline:"下划线"},undo:{undo:"撤销",redo:"重做"},todo:{todo:"待办"},formatPainter:{title:"格式刷"}});var vx={type:"blockquote",elemToHtml:function(e,t){return"<blockquote>".concat(t,"</blockquote>")}},mx='<svg viewBox="0 0 1024 1024"><path d="M864 0a160 160 0 0 1 128 256l-64 64-224-224 64-64c26.752-20.096 59.968-32 96-32zM64 736l-64 288 288-64 592-592-224-224L64 736z m651.584-372.416l-448 448-55.168-55.168 448-448 55.168 55.168z"></path></svg>',yx='<svg viewBox="0 0 1024 1024"><path d="M924.402464 1023.068211H0.679665V99.345412h461.861399v98.909208H99.596867v725.896389h725.896389V561.206811h98.909208z" p-id="10909"></path><path d="M930.805104 22.977336l69.965436 69.965436-453.492405 453.492404-69.965435-69.901489z" p-id="10910"></path><path d="M1022.464381 304.030081h-98.917201V99.345412H709.230573V0.428211h313.233808z"></path></svg>',bx='<svg viewBox="0 0 1024 1024"><path d="M133.705143 335.433143V133.851429h201.581714a29.622857 29.622857 0 0 0 29.622857-29.549715V68.754286a29.622857 29.622857 0 0 0-29.622857-29.622857H61.732571A22.893714 22.893714 0 0 0 38.765714 62.025143V335.725714c0 16.310857 13.238857 29.622857 29.622857 29.622857h35.547429a29.842286 29.842286 0 0 0 29.696-29.842285zM690.980571 133.851429h201.581715v201.654857c0 16.310857 13.238857 29.549714 29.622857 29.549714h35.547428a29.622857 29.622857 0 0 0 29.549715-29.549714V61.952a22.893714 22.893714 0 0 0-22.820572-22.893714h-273.554285a29.622857 29.622857 0 0 0-29.549715 29.622857v35.547428c0 16.310857 13.238857 29.696 29.622857 29.696zM335.286857 892.781714H133.705143V691.2a29.622857 29.622857 0 0 0-29.622857-29.622857H68.534857a29.622857 29.622857 0 0 0-29.549714 29.622857v273.554286c0 12.653714 10.24 22.893714 22.820571 22.893714h273.554286a29.622857 29.622857 0 0 0 29.696-29.622857v-35.547429a29.769143 29.769143 0 0 0-29.769143-29.696z m557.348572-201.581714v201.581714H690.907429a29.622857 29.622857 0 0 0-29.622858 29.622857v35.547429c0 16.310857 13.238857 29.622857 29.622858 29.622857h273.554285c12.580571 0 22.893714-10.313143 22.893715-22.893714V691.2a29.622857 29.622857 0 0 0-29.622858-29.622857h-35.547428a29.622857 29.622857 0 0 0-29.696 29.622857z"></path></svg>',Ex=function(){function e(){this.title=QE("blockQuote.title"),this.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M894.6 907.1H605.4c-32.6 0-59-26.4-59-59V608.2l-4-14.9c0-315.9 125.5-485.1 376.5-507.5v59.8C752.7 180.4 711.3 315.8 711.3 442.4v41.2l31.5 12.3h151.8c32.6 0 59 26.4 59 59v293.2c0 32.5-26.4 59-59 59z m-472 0H133.4c-32.6 0-59-26.4-59-59V608.2l-4-14.9c0-315.9 125.5-485.1 376.5-507.5v59.8C280.7 180.4 239.3 315.8 239.3 442.4v41.2l31.5 12.3h151.8c32.6 0 59 26.4 59 59v293.2c0 32.5-26.4 59-59 59z"></path></svg>',this.tag="button"}return e.prototype.getValue=function(e){return""},e.prototype.isActive=function(e){return!!_y.getSelectedNodeByType(e,"blockquote")},e.prototype.isDisabled=function(e){if(null==e.selection)return!0;var t=Qg(Kh.nodes(e,{match:function(e){var t=_y.getNodeType(e);return"paragraph"===t||"blockquote"===t},universal:!0,mode:"highest"}),1);return!t[0]},e.prototype.exec=function(e,t){if(!this.isDisabled(e)){var n=this.isActive(e)?"paragraph":"blockquote";jg.setNodes(e,{type:n},{mode:"highest"})}},e}(),Cx={key:"blockquote",factory:function(){return new Ex}};function Dx(e){return 0===am("<div>".concat(e,"</div>")).children().filter(function(e){return"BR"!==e.tagName}).length}function wx(e){return 0===e.length?"":e[0].outerHTML}function Sx(e){return e.length?e[0].tagName.toLowerCase():""}function Ax(e,t){for(var n="",r=(e.attr("style")||"").split(";"),o=r.length,i=0;i<o;i+=1){var a=r[i];if(a){var s=a.split(":");s[0].trim()===t&&(n=s[1].trim())}}return n}Dm&&(am.fn.css=Dm),Nm&&(am.fn.append=Nm),Bm&&(am.fn.prepend=Bm),sm&&(am.fn.addClass=sm),um&&(am.fn.removeClass=um),lm&&(am.fn.hasClass=lm),gm&&(am.fn.on=gm),vm&&(am.fn.off=vm),jm&&(am.fn.focus=jm),cm&&(am.fn.attr=cm),dm&&(am.fn.removeAttr=dm),Em&&(am.fn.hide=Em),Cm&&(am.fn.show=Cm),km&&(am.fn.parents=km),pm&&(am.fn.dataset=pm),hm&&(am.fn.val=hm),xm&&(am.fn.text=xm),Am&&(am.fn.html=Am),Im&&(am.fn.children=Im),Pm&&(am.fn.remove=Pm),Fm&&(am.fn.find=Fm),mm&&(am.fn.width=mm),ym&&(am.fn.height=ym),Sm&&(am.fn.filter=Sm),_m&&(am.fn.empty=_m);var xx={selector:"blockquote:not([data-w-e-type])",parseElemHtml:function(e,t,n){var r=am(e);return 0===(t=t.filter(function(e){return!!Cg.isText(e)||!!n.isInline(e)})).length&&(t=[{text:r.text().replace(/\s+/gm," ")}]),{type:"blockquote",children:t}}};function Ox(e){e.deleteBackward("character");jg.insertNodes(e,{type:"paragraph",children:[{text:""}]},{mode:"highest"})}var Nx={type:"blockquote",renderElem:function(e,t,n){return ND("blockquote",null,t)}},Bx={renderElems:[Nx],elemsToHtml:[vx],parseElemsHtml:[xx],menus:[Cx],editorPlugin:function(e){var t=e.insertBreak,n=e.insertText,r=e;return r.insertBreak=function(){var o=r.selection;if(null==o)return t();var i=Qg(Kh.nodes(e,{match:function(e){return _y.checkNodeType(e,"blockquote")},universal:!0}),1),a=i[0];if(!a)return t();var s=a[0];if(_y.getParentNode(e,s)){var u=_y.findPath(e,s),l=Kh.end(e,u);if(ug.equals(l,o.focus)){var c=eg.string(s);if(c&&"\n"===c.slice(-1))return void Ox(r)}n("\n")}else Ox(r)},r}};var Tx={type:"code",elemToHtml:function(e,t){return"<code>".concat(t,"</code>")}};var kx={type:"pre",elemToHtml:function(e,t){return"<pre>".concat(t,"</pre>")}},Fx=function(){function e(){this.title=QE("codeBlock.title"),this.iconSvg='<svg viewBox="0 0 1280 1024"><path d="M832 736l96 96 320-320L928 192l-96 96 224 224zM448 288l-96-96L32 512l320 320 96-96-224-224zM701.312 150.528l69.472 18.944-192 704.032-69.472-18.944 192-704.032z"></path></svg>',this.tag="button"}return e.prototype.getSelectCodeElem=function(e){var t=_y.getSelectedNodeByType(e,"code");if(null==t)return null;var n=_y.getParentNode(e,t);return null==n||"pre"!==_y.getNodeType(n)?null:t},e.prototype.getValue=function(e){var t=this.getSelectCodeElem(e);if(null==t){var n=e.getMenuConfig("codeSelectLang").codeLangs,r=(void 0===n?[]:n).find(function(e){return e.selected});return(null==r?void 0:r.value)||""}return t.language||""},e.prototype.isActive=function(e){return!!this.getSelectCodeElem(e)},e.prototype.isDisabled=function(e){if(null==e.selection)return!0;var t=_y.getSelectedElems(e);return!!t.some(function(t){return e.isVoid(t)})||!t.some(function(e){var t=_y.getNodeType(e);return"pre"===t||"paragraph"===t})},e.prototype.exec=function(e,t){this.isActive(e)?this.changeToPlainText(e):this.changeToCodeBlock(e,t.toString())},e.prototype.changeToPlainText=function(e){var t=this.getSelectCodeElem(e);if(null!=t){var n=eg.string(t);jg.removeNodes(e,{mode:"highest"});var r=n.split("\n").map(function(e){return{type:"paragraph",children:[{text:e}]}});jg.insertNodes(e,r,{mode:"highest"})}},e.prototype.changeToCodeBlock=function(e,t){var n,r,o=[],i=Kh.nodes(e,{match:function(t){return e.children.includes(t)},universal:!0});try{for(var a=Jg(i),s=a.next();!s.done;s=a.next()){var u=Qg(s.value,1)[0];u&&o.push(eg.string(u))}}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}jg.removeNodes(e,{mode:"highest"});var l={type:"pre",children:[{type:"code",language:t,children:[{text:o.join("\n")}]}]};jg.insertNodes(e,l,{mode:"highest"})},e}();var Ix={selector:"pre:not([data-w-e-type])",parseElemHtml:function(e,t,n){var r=am(e);return 0===(t=t.filter(function(e){return"code"===_y.getNodeType(e)})).length&&(t=[{type:"code",language:"",children:[{text:r[0].textContent||""}]}]),{type:"pre",children:t.filter(function(e){return"code"===_y.getNodeType(e)})}}};var Px={type:"pre",renderElem:function(e,t,n){return ND("pre",null,t)}},_x={type:"code",renderElem:function(e,t,n){return ND("code",null,t)}},Rx={menus:[{key:"codeBlock",factory:function(){return new Fx}}],editorPlugin:function(e){var t=e.insertBreak,n=e.normalizeNode,r=e.insertData,o=e.handleTab,i=e;return i.insertBreak=function(){var e=_y.getSelectedNodeByType(i,"code");if(null!=e){var n=function(e,t){var n=t.selection;if(null==n)return"";var r=eg.string(e),o=n.anchor.offset,i=r.slice(0,o).split("\n"),a=i.length;return 0===a?"":i[a-1]}(e,i);if(n){var r=n.match(/^\s+/);if(null!=r&&null!=r[0]){var o=r[0];return void i.insertText("\n".concat(o))}}i.insertText("\n")}else t()},e.handleTab=function(){var t=e.selection;if(t){var n=_y.getSelectedNodeByType(e,"code");if(n&&!fg.isCollapsed(t)){var r=Qg([t.anchor,t.focus].sort(function(e,t){return e.offset-t.offset}),2),i=r[0],a=r[1],s=n.children[0].text,u=s.split("\n"),l=s.slice(0,i.offset).split("\n").length-1,c=s.slice(0,a.offset).split("\n").length-1,d=u.map(function(e,t){return t>=l&&t<=c?" ".concat(e):e}),f=d.join("\n"),p={anchor:{path:i.path,offset:i.offset+2},focus:{path:a.path,offset:a.offset+2}};jg.insertText(e,f,{at:{anchor:{path:i.path,offset:0},focus:{path:a.path,offset:s.length}}}),jg.select(e,p)}else o()}},i.normalizeNode=function(e){var t=Qg(e,2),r=t[0],o=t[1],a=_y.getNodeType(r);("code"===a&&o.length<=1&&jg.setNodes(i,{type:"paragraph"},{at:o}),"pre"===a)&&(_y.isLastNode(i,r)&&jg.insertNodes(i,_y.genEmptyParagraph(),{at:[o[0]+1]}),"code"!==_y.getNodeType(r.children[0])&&(jg.unwrapNodes(i),jg.setNodes(i,{type:"paragraph"},{mode:"highest"})));return n([r,o])},i.insertData=function(e){if(null!=_y.getSelectedNodeByType(i,"code")){var t=e.getData("text/plain");Kh.insertText(i,t)}else r(e)},i},renderElems:[Px,_x],elemsToHtml:[Tx,kx],preParseHtml:[{selector:"pre>code",preParseHtml:function(e){var t=am(e);if("code"!==Sx(t))return e;var n=t.find("xmp");if(0===n.length)return e;var r=n.text();return n.remove(),t.text(r),t[0]}}],parseElemsHtml:[{selector:"pre:not([data-w-e-type])>code",parseElemHtml:function(e,t,n){return{type:"code",language:"",children:[{text:am(e)[0].textContent||""}]}}},Ix]},Lx=function(){function e(){this.tag="button",this.showDropPanel=!0,this.$content=null}return e.prototype.exec=function(e,t){},e.prototype.getValue=function(e){var t=this.mark,n=Kh.marks(e);return n&&n[t]?n[t]:""},e.prototype.isActive=function(e){return!!this.getValue(e)},e.prototype.isDisabled=function(e){if(null==e.selection)return!0;var t=Qg(Kh.nodes(e,{match:function(t){return"pre"===_y.getNodeType(t)||!!Kh.isVoid(e,t)},universal:!0}),1);return!!t[0]},e.prototype.getPanelContentElem=function(e){var t=this.mark;if(null==this.$content){var n=am('<ul class="w-e-panel-content-color"></ul>');n.on("click","li",function(n){var r=n.target;if(null!=r&&(n.preventDefault(),null!=e.selection)){var o=am(r).attr("data-value");"0"===o?Kh.removeMark(e,t):Kh.addMark(e,t,o)}}),this.$content=n}var r=this.$content;if(null==r)return document.createElement("ul");r.empty();var o=this.getValue(e),i=e.getMenuConfig(t).colors;(void 0===i?[]:i).forEach(function(e){var t=am('<div class="color-block" data-value="'.concat(e,'"></div>'));t.css("background-color",e);var n=am('<li data-value="'.concat(e,'"></li>'));o===e&&n.addClass("active"),n.append(t),r.append(n)});var a="";"color"===t&&(a=QE("color.default")),"bgColor"===t&&(a=QE("color.clear"));var s=am('\n <li data-value="0" class="clear">\n '.concat('<svg viewBox="0 0 1024 1024"><path d="M236.8 128L896 787.2V128H236.8z m614.4 704L192 172.8V832h659.2zM192 64h704c38.4 0 64 25.6 64 64v704c0 38.4-25.6 64-64 64H192c-38.4 0-64-25.6-64-64V128c0-38.4 25.6-64 64-64z"></path></svg>',"\n ").concat(a,"\n </li>\n "));return r.prepend(s),r[0]},e}(),Mx=function(e){function t(){var t=e.apply(this,ev([],Qg(arguments),!1))||this;return t.title=QE("color.bgColor"),t.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M510.030769 315.076923l84.676923 196.923077h-177.230769l76.8-196.923077h15.753846zM945.230769 157.538462v708.923076c0 43.323077-35.446154 78.769231-78.769231 78.769231H157.538462c-43.323077 0-78.769231-35.446154-78.769231-78.769231V157.538462c0-43.323077 35.446154-78.769231 78.769231-78.769231h708.923076c43.323077 0 78.769231 35.446154 78.769231 78.769231z m-108.307692 643.938461L600.615385 216.615385c-5.907692-11.815385-15.753846-19.692308-29.538462-19.692308h-139.815385c-11.815385 0-23.630769 7.876923-27.56923 19.692308l-216.615385 584.861538c-3.938462 11.815385 3.938462 25.6 17.723077 25.6h80.738462c11.815385 0 23.630769-9.846154 27.56923-21.661538l63.015385-175.261539h263.876923l68.923077 175.261539c3.938462 11.815385 15.753846 21.661538 27.569231 21.661538h80.738461c13.784615 0 23.630769-13.784615 19.692308-25.6z"></path></svg>',t.mark="bgColor",t}return Kg(t,e),t}(Lx),jx=function(e){function t(){var t=e.apply(this,ev([],Qg(arguments),!1))||this;return t.title=QE("color.color"),t.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M64 864h896v96H64zM360.58 576h302.85l81.53 224h102.16L579.24 64H444.77L176.89 800h102.16l81.53-224zM512 159.96L628.49 480H395.52L512 159.96z"></path></svg>',t.mark="color",t}return Kg(t,e),t}(Lx),Hx=["rgb(0, 0, 0)","rgb(38, 38, 38)","rgb(89, 89, 89)","rgb(140, 140, 140)","rgb(191, 191, 191)","rgb(217, 217, 217)","rgb(233, 233, 233)","rgb(245, 245, 245)","rgb(250, 250, 250)","rgb(255, 255, 255)","rgb(225, 60, 57)","rgb(231, 95, 51)","rgb(235, 144, 58)","rgb(245, 219, 77)","rgb(114, 192, 64)","rgb(89, 191, 192)","rgb(66, 144, 247)","rgb(54, 88, 226)","rgb(106, 57, 201)","rgb(216, 68, 147)","rgb(251, 233, 230)","rgb(252, 237, 225)","rgb(252, 239, 212)","rgb(252, 251, 207)","rgb(231, 246, 213)","rgb(218, 244, 240)","rgb(217, 237, 250)","rgb(224, 232, 250)","rgb(237, 225, 248)","rgb(246, 226, 234)","rgb(255, 163, 158)","rgb(255, 187, 150)","rgb(255, 213, 145)","rgb(255, 251, 143)","rgb(183, 235, 143)","rgb(135, 232, 222)","rgb(145, 213, 255)","rgb(173, 198, 255)","rgb(211, 173, 247)","rgb(255, 173, 210)","rgb(255, 77, 79)","rgb(255, 122, 69)","rgb(255, 169, 64)","rgb(255, 236, 61)","rgb(115, 209, 61)","rgb(54, 207, 201)","rgb(64, 169, 255)","rgb(89, 126, 247)","rgb(146, 84, 222)","rgb(247, 89, 171)","rgb(207, 19, 34)","rgb(212, 56, 13)","rgb(212, 107, 8)","rgb(212, 177, 6)","rgb(56, 158, 13)","rgb(8, 151, 156)","rgb(9, 109, 217)","rgb(29, 57, 196)","rgb(83, 29, 171)","rgb(196, 29, 127)","rgb(130, 0, 20)","rgb(135, 20, 0)","rgb(135, 56, 0)","rgb(97, 71, 0)","rgb(19, 82, 0)","rgb(0, 71, 79)","rgb(0, 58, 140)","rgb(6, 17, 120)","rgb(34, 7, 94)","rgb(120, 6, 80)"];var zx={selector:"font",preParseHtml:function(e){var t=am(e);if("font"!==Sx(t))return e;var n=t.attr("color")||"";return n&&(t.removeAttr("color"),t.css("color",n)),t[0]}};function $x(e,t){null==e.data&&(e.data={});var n=e.data;null==n.style&&(n.style={}),Object.assign(n.style,t)}var Ux={renderStyle:function(e,t){var n=e,r=n.color,o=n.bgColor,i=t;return r&&$x(i,{color:r}),o&&$x(i,{backgroundColor:o}),i},styleToHtml:function(e,t){if(!Cg.isText(e))return t;var n,r=e,o=r.color,i=r.bgColor;return o||i?((Dx(t)||"span"!==Sx(n=am(t)))&&(n=am("<span>".concat(t,"</span>"))),o&&n.css("color",o),i&&n.css("background-color",i),wx(n)):t},preParseHtml:[zx],parseStyleHtml:function(e,t,n){var r=am(e);if(!Cg.isText(t))return t;var o=t,i=Ax(r,"color");i&&(o.color=i);var a=Ax(r,"background-color");return a||(a=Ax(r,"background")),a&&(o.bgColor=a),o},menus:[{key:"color",factory:function(){return new jx},config:{colors:Hx}},{key:"bgColor",factory:function(){return new Mx},config:{colors:Hx}}]},Vx=function(){function e(){this.title=QE("common.enter"),this.iconSvg='<svg viewBox="0 0 1255 1024"><path d="M1095.111111 731.477333h-625.777778V1024L0 658.318222 469.333333 292.408889v292.636444h625.777778V0h156.444445v731.477333z"></path></svg>',this.tag="button"}return e.prototype.getValue=function(e){return""},e.prototype.isActive=function(e){return!1},e.prototype.isDisabled=function(e){var t=e.selection;return null==t||!!fg.isExpanded(t)},e.prototype.exec=function(e,t){var n=e.selection;if(null!=n){var r=[n.anchor.path[0]];jg.insertNodes(e,{type:"paragraph",children:[{text:""}]},{at:r}),e.select(Kh.start(e,r))}},e}(),Wx={menus:[{key:"enter",factory:function(){return new Vx}}]};var Gx={type:"divider",elemToHtml:function(e,t){return"<hr/>"}},qx=function(){function e(){this.title=QE("divider.title"),this.iconSvg='<svg viewBox="0 0 1092 1024"><path d="M0 51.2m51.2 0l989.866667 0q51.2 0 51.2 51.2l0 0q0 51.2-51.2 51.2l-989.866667 0q-51.2 0-51.2-51.2l0 0q0-51.2 51.2-51.2Z"></path><path d="M0 460.8m51.2 0l170.666667 0q51.2 0 51.2 51.2l0 0q0 51.2-51.2 51.2l-170.666667 0q-51.2 0-51.2-51.2l0 0q0-51.2 51.2-51.2Z"></path><path d="M819.2 460.8m51.2 0l170.666667 0q51.2 0 51.2 51.2l0 0q0 51.2-51.2 51.2l-170.666667 0q-51.2 0-51.2-51.2l0 0q0-51.2 51.2-51.2Z"></path><path d="M409.6 460.8m51.2 0l170.666667 0q51.2 0 51.2 51.2l0 0q0 51.2-51.2 51.2l-170.666667 0q-51.2 0-51.2-51.2l0 0q0-51.2 51.2-51.2Z"></path><path d="M0 870.4m51.2 0l989.866667 0q51.2 0 51.2 51.2l0 0q0 51.2-51.2 51.2l-989.866667 0q-51.2 0-51.2-51.2l0 0q0-51.2 51.2-51.2Z"></path></svg>',this.tag="button"}return e.prototype.getValue=function(e){return""},e.prototype.isActive=function(e){return!1},e.prototype.isDisabled=function(e){return null==e.selection||!!_y.getSelectedElems(e).some(function(t){if(e.isVoid(t))return!0;var n=_y.getNodeType(t);return"table"===n||"pre"===n})},e.prototype.exec=function(e,t){_y.isSelectedEmptyParagraph(e)&&jg.removeNodes(e,{mode:"highest"}),jg.insertNodes(e,{type:"divider",children:[{text:""}]},{mode:"highest"})},e}();var Kx={renderElems:[{type:"divider",renderElem:function(e,t,n){return uD("div",{props:{contentEditable:!1,className:"w-e-textarea-divider"},dataset:{selected:_y.isNodeSelected(n,e)?"true":""},style:{},on:{mousedown:function(e){return e.preventDefault()}}},[uD("hr")])}}],elemsToHtml:[Gx],parseElemsHtml:[{selector:"hr:not([data-w-e-type])",parseElemHtml:function(e,t,n){return{type:"divider",children:[{text:""}]}}}],menus:[{key:"divider",factory:function(){return new qx}}],editorPlugin:function(e){var t=e.isVoid,n=e.normalizeNode,r=e;return r.isVoid=function(e){return"divider"===e.type||t(e)},r.normalizeNode=function(e){var t=Qg(e,2),o=t[0],i=t[1];if("divider"!==_y.getNodeType(o))return n([o,i]);_y.isLastNode(r,o)&&jg.insertNodes(r,_y.genEmptyParagraph(),{at:[i[0]+1]})},r}};var Yx=function(){function e(){this.title=QE("emotion.title"),this.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M512 1024C230.4 1024 0 793.6 0 512S230.4 0 512 0s512 230.4 512 512-230.4 512-512 512z m0-102.4c226.742857 0 409.6-182.857143 409.6-409.6S738.742857 102.4 512 102.4 102.4 285.257143 102.4 512s182.857143 409.6 409.6 409.6z m-204.8-358.4h409.6c0 113.371429-91.428571 204.8-204.8 204.8s-204.8-91.428571-204.8-204.8z m0-102.4c-43.885714 0-76.8-32.914286-76.8-76.8s32.914286-76.8 76.8-76.8 76.8 32.914286 76.8 76.8-32.914286 76.8-76.8 76.8z m409.6 0c-43.885714 0-76.8-32.914286-76.8-76.8s32.914286-76.8 76.8-76.8c43.885714 0 76.8 32.914286 76.8 76.8s-32.914286 76.8-76.8 76.8z"></path></svg>',this.tag="button",this.showDropPanel=!0,this.$content=null}return e.prototype.exec=function(e,t){},e.prototype.getValue=function(e){return""},e.prototype.isActive=function(e){return!1},e.prototype.isDisabled=function(e){if(null==e.selection)return!0;var t=Qg(Kh.nodes(e,{match:function(t){return"pre"===_y.getNodeType(t)||!!Kh.isVoid(e,t)},universal:!0}),1);return!!t[0]},e.prototype.getPanelContentElem=function(e){if(null==this.$content){var t=am('<ul class="w-e-panel-content-emotion"></ul>');t.on("click","li",function(t){var n=t.target;if(null!=n){t.preventDefault();var r=am(n).text();e.insertText(r)}}),this.$content=t}var n=this.$content;if(null==n)return document.createElement("ul");n.empty();var r=e.getMenuConfig("emotion").emotions;return(void 0===r?[]:r).forEach(function(e){var t=am("<li>".concat(e,"</li>"));n.append(t)}),n[0]},e}(),Xx={menus:[{key:"emotion",factory:function(){return new Yx},config:{emotions:"😀 😃 😄 😁 😆 😅 😂 🤣 😊 😇 🙂 🙃 😉 😌 😍 😘 😗 😙 😚 😋 😛 😝 😜 🤓 😎 😏 😒 😞 😔 😟 😕 🙁 😣 😖 😫 😩 😢 😭 😤 😠 😡 😳 😱 😨 🤗 🤔 😶 😑 😬 🙄 😯 😴 😷 🤑 😈 🤡 💩 👻 💀 👀 👣 👐 🙌 👏 🤝 👍 👎 👊 ✊ 🤛 🤜 🤞 ✌️ 🤘 👌 👈 👉 👆 👇 ☝️ ✋ 🤚 🖐 🖖 👋 🤙 💪 🖕 ✍️ 🙏".split(" ")}}]};var Zx=function(){function e(){this.tag="select",this.width=80}return e.prototype.isActive=function(e){return!1},e.prototype.getValue=function(e){var t=this.mark,n=Kh.marks(e);return n&&n[t]?n[t]:""},e.prototype.isDisabled=function(e){if(null==e.selection)return!0;var t=Qg(Kh.nodes(e,{match:function(t){return"pre"===_y.getNodeType(t)||!!Kh.isVoid(e,t)},universal:!0}),1);return!!t[0]},e.prototype.exec=function(e,t){var n=this.mark;t?e.addMark(n,t):e.removeMark(n)},e}(),Jx=function(e){function t(){var t=e.apply(this,ev([],Qg(arguments),!1))||this;return t.title=QE("fontFamily.title"),t.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M956.788364 152.110545h-24.110546l23.924364 9.029819 0.186182 121.018181h-65.070546l-86.574545-130.048H566.551273v650.14691l130.048 64.977454v65.163636h-390.050909v-65.163636l129.954909-64.977454V152.110545H198.283636L111.429818 282.065455H46.545455V69.259636C46.545455 33.792 82.664727 22.062545 98.955636 22.062545h812.683637c23.738182 0 45.056 15.173818 45.056 41.053091V169.425455v-17.221819z"></path></svg>',t.mark="fontFamily",t.selectPanelWidth=150,t}return Kg(t,e),t.prototype.getOptions=function(e){var t=[],n=e.getMenuConfig(this.mark).fontFamilyList,r=void 0===n?[]:n;t.push({text:QE("fontFamily.default"),value:""}),r.forEach(function(e){if("string"==typeof e)t.push({text:e,value:e,styleForRenderMenuList:{"font-family":e}});else if("object"==typeof e){var n=e.name,r=e.value;t.push({text:n,value:r,styleForRenderMenuList:{"font-family":r}})}});var o=this.getValue(e),i=!1;return t.forEach(function(e){e.value===o?(i=!0,e.selected=!0):e.selected=void 0}),i||"string"!=typeof o||t.push({text:o,value:o,selected:!0}),t},t}(Zx),Qx=function(e){function t(){var t=e.apply(this,ev([],Qg(arguments),!1))||this;return t.title=QE("fontSize.title"),t.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M64 512h384v128h-128V1024h-128V640h-128z m896-256H708.2496v768h-136.4992V256H320V128h640z"></path></svg>',t.mark="fontSize",t}return Kg(t,e),t.prototype.getOptions=function(e){var t=[],n=e.getMenuConfig(this.mark).fontSizeList,r=void 0===n?[]:n;t.push({text:QE("fontSize.default"),value:""}),r.forEach(function(e){if("string"==typeof e)t.push({text:e,value:e});else if("object"==typeof e){var n=e.name,r=e.value;t.push({text:n,value:r})}});var o=this.getValue(e),i=!1;return t.forEach(function(e){e.value===o?(i=!0,e.selected=!0):e.selected=void 0}),i||"string"!=typeof o||t.push({text:o,value:o,selected:!0}),t},t}(Zx);var eO={1:"12px",2:"14px",3:"16px",4:"19px",5:"24px",6:"32px",7:"48px"};var tO={renderStyle:function(e,t){var n=e,r=n.fontSize,o=n.fontFamily,i=t;return r&&$x(i,{fontSize:r}),o&&$x(i,{fontFamily:o}),i},styleToHtml:function(e,t){if(!Cg.isText(e))return t;var n,r=e,o=r.fontSize,i=r.fontFamily;return o||i?((Dx(t)||"span"!==Sx(n=am(t)))&&(n=am("<span>".concat(t,"</span>"))),o&&n.css("font-size",o),i&&n.css("font-family",i),wx(n)):t},preParseHtml:[{selector:"font",preParseHtml:function(e){var t=am(e);if("font"!==Sx(t))return e;var n=t.attr("size")||"";n&&(t.removeAttr("size"),t.css("font-size",eO[n]));var r=t.attr("face")||"";return r&&(t.removeAttr("face"),t.css("font-family",r)),t[0]}}],parseStyleHtml:function(e,t,n){var r=am(e);if(!Cg.isText(t))return t;var o=t,i=Ax(r,"font-size");i&&(o.fontSize=i);var a=Ax(r,"font-family").replace(/"/g,"");return a&&(o.fontFamily=a),o},menus:[{key:"fontSize",factory:function(){return new Qx},config:{fontSizeList:["12px",{name:"13px",value:"13px"},"14px","15px","16px","19px",{name:"22px",value:"22px"},"24px","29px","32px","40px","48px"]}},{key:"fontFamily",factory:function(){return new Jx},config:{fontFamilyList:["黑体",{name:"仿宋",value:"仿宋"},"楷体","标楷体","华文仿宋","华文楷体",{name:"宋体",value:"宋体"},"微软雅黑","Arial","Tahoma","Verdana","Times New Roman","Courier New"]}}]};var nO=function(){function e(){this.title=QE("formatPainter.title"),this.iconSvg='<svg viewBox="0 0 24 24"><path d="M8 19.997v-5h2v5h9v-7H5v7zm-4-9h16v-3h-6v-4h-4v4H4zm-1 10v-8H2v-6a1 1 0 0 1 1-1h5v-3a1 1 0 0 1 1-1h6a1 1 0 0 1 1 1v3h5a1 1 0 0 1 1 1v6h-1v8a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1"/></svg>',this.tag="button"}return e.prototype.getValue=function(e){return""},e.prototype.isActive=function(t){return e.attrs.isSelect},e.prototype.isDisabled=function(e){return!1},e.prototype.setFormatHtml=function(t){var n,r;if(t.getSelectionText().length){if(e.attrs.formatStyle){!function(e){var t=Kh.marks(e);t&&Object.keys(t).forEach(function(t){e.removeMark(t)})}(t);try{for(var o=Jg(Object.entries(e.attrs.formatStyle)),i=o.next();!i.done;i=o.next()){var a=Qg(i.value,2),s=a[0],u=a[1];t.addMark(s,u)}}catch(e){n={error:e}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}}e.attrs.formatStyle=null,e.attrs.isSelect=!1}},e.prototype.exec=function(t){e.attrs.isSelect?(e.attrs.isSelect=!1,e.attrs.formatStyle=null):t.getSelectionText().length&&(e.attrs.formatStyle=Kh.marks(t),e.attrs.isSelect=!0);t.blur(),t.focus()},e.attrs={isSelect:!1,formatStyle:null},e}();var rO={menus:[{key:"formatPainter",factory:function(){return new nO}}],editorPlugin:function(e){var t=new nO,n=e.onChange,r=e,o=function(){t.setFormatHtml(r),document.removeEventListener("mouseup",o)};return r.onChange=function(){n(),nO.attrs.isSelect&&(document.removeEventListener("mouseup",o),document.addEventListener("mouseup",o))},r}},oO=function(){function e(){this.title=QE("fullScreen.title"),this.iconSvg=bx,this.tag="button",this.alwaysEnable=!0}return e.prototype.getValue=function(e){return""},e.prototype.isActive=function(e){return e.isFullScreen},e.prototype.isDisabled=function(e){return!1},e.prototype.getIcon=function(e){return e.isFullScreen?bx:'<svg t="1723361745825" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="8705" width="200" height="200"><path d="M703.926857 362.642286a42.642286 42.642286 0 0 1-42.642286-42.642286V128a42.642286 42.642286 0 1 1 85.357715 0v149.357714h149.357714c21.211429 0 38.765714 15.433143 42.057143 35.693715l0.585143 6.948571a42.642286 42.642286 0 0 1-42.642286 42.642286H703.926857zM703.926857 938.642286a42.642286 42.642286 0 0 1-42.642286-42.642286V704c0-23.552 19.090286-42.642286 42.642286-42.642286h192.073143a42.642286 42.642286 0 1 1 0 85.284572l-149.357714 0.073143v149.284571c0 21.211429-15.506286 38.765714-35.84 42.130286l-6.875429 0.512zM319.853714 938.642286a42.642286 42.642286 0 0 1-42.642285-42.642286v-149.284571H127.853714a42.642286 42.642286 0 0 1-42.130285-35.84l-0.585143-6.875429c0-23.552 19.163429-42.642286 42.715428-42.642286h192c23.552 0 42.715429 19.017143 42.715429 42.642286v192a42.642286 42.642286 0 0 1-42.715429 42.642286zM127.853714 362.642286a42.642286 42.642286 0 1 1 0-85.284572H277.211429V128c0-21.211429 15.433143-38.765714 35.766857-42.130286l6.875428-0.512c23.552 0 42.715429 19.017143 42.715429 42.642286v192a42.642286 42.642286 0 0 1-42.715429 42.642286H127.853714z" fill="#333333" p-id="8706"></path></svg>'},e.prototype.getTitle=function(e){return e.isFullScreen?QE("fullScreen.title"):QE("fullScreen.cancelTitle")},e.prototype.exec=function(e,t){e.isFullScreen?e.unFullScreen():e.fullScreen()},e}(),iO={menus:[{key:"fullScreen",factory:function(){return new oO}}]};function aO(e){return function(t,n){return"<h".concat(e,">").concat(n,"</h").concat(e,">")}}var sO={type:"header1",elemToHtml:aO(1)},uO={type:"header2",elemToHtml:aO(2)},lO={type:"header3",elemToHtml:aO(3)},cO={type:"header4",elemToHtml:aO(4)},dO={type:"header5",elemToHtml:aO(5)},fO={type:"header6",elemToHtml:aO(6)};function pO(e){var t=Qg(Kh.nodes(e,{match:function(e){return _y.getNodeType(e).startsWith("header")},universal:!0}),1),n=t[0];if(null==n)return"paragraph";var r=Qg(n,1)[0];return _y.getNodeType(r)}function hO(e){if(null==e.selection)return!0;var t=Qg(Kh.nodes(e,{match:function(e){var t=_y.getNodeType(e);return"paragraph"===t||!!t.startsWith("header")},universal:!0,mode:"highest"}),1);return!t[0]}function gO(e,t){t&&jg.setNodes(e,{type:t})}var vO=function(){function e(){this.tag="button"}return e.prototype.getValue=function(e){return pO(e)},e.prototype.isActive=function(e){return this.getValue(e)===this.type},e.prototype.isDisabled=function(e){return hO(e)},e.prototype.exec=function(e,t){var n=this.type;gO(e,t===n?"paragraph":n)},e}(),mO=function(e){function t(){var t=e.apply(this,ev([],Qg(arguments),!1))||this;return t.title="H1",t.type="header1",t}return Kg(t,e),t}(vO),yO=function(e){function t(){var t=e.apply(this,ev([],Qg(arguments),!1))||this;return t.title="H2",t.type="header2",t}return Kg(t,e),t}(vO),bO=function(e){function t(){var t=e.apply(this,ev([],Qg(arguments),!1))||this;return t.title="H3",t.type="header3",t}return Kg(t,e),t}(vO),EO=function(e){function t(){var t=e.apply(this,ev([],Qg(arguments),!1))||this;return t.title="H4",t.type="header4",t}return Kg(t,e),t}(vO),CO=function(e){function t(){var t=e.apply(this,ev([],Qg(arguments),!1))||this;return t.title="H5",t.type="header5",t}return Kg(t,e),t}(vO),DO=function(e){function t(){var t=e.apply(this,ev([],Qg(arguments),!1))||this;return t.title="H6",t.type="header6",t}return Kg(t,e),t}(vO),wO=function(){function e(){this.title=QE("header.title"),this.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M960 960c-51.2 0-102.4-3.2-153.6-3.2-51.2 0-99.2 3.2-150.4 3.2-19.2 0-28.8-22.4-28.8-38.4 0-51.2 57.6-28.8 86.4-48 19.2-12.8 19.2-60.8 19.2-80v-224-19.2c-9.6-3.2-19.2-3.2-28.8-3.2H320c-9.6 0-19.2 0-28.8 3.2V780.8c0 22.4 0 80 22.4 92.8 28.8 19.2 96-6.4 96 44.8 0 16-9.6 41.6-28.8 41.6-54.4 0-105.6-3.2-160-3.2-48 0-96 3.2-147.2 3.2-19.2 0-28.8-22.4-28.8-38.4 0-51.2 51.2-28.8 80-48 19.2-12.8 19.2-60.8 19.2-83.2V294.4c0-28.8 3.2-115.2-22.4-131.2-25.6-16-86.4 9.6-86.4-41.6 0-16 6.4-41.6 28.8-41.6 51.2 0 105.6 3.2 156.8 3.2 48 0 96-3.2 144-3.2 19.2 0 28.8 22.4 28.8 41.6 0 48-57.6 25.6-83.2 41.6-19.2 12.8-19.2 73.6-19.2 92.8v201.6c6.4 3.2 16 3.2 22.4 3.2h400c6.4 0 12.8 0 22.4-3.2V256c0-22.4 0-80-19.2-92.8-28.8-16-86.4 6.4-86.4-41.6 0-16 9.6-41.6 28.8-41.6 51.2 0 99.2 3.2 150.4 3.2 48 0 99.2-3.2 147.2-3.2 19.2 0 28.8 22.4 28.8 41.6 0 51.2-57.6 25.6-86.4 41.6-19.2 12.8-19.2 70.4-19.2 92.8v537.6c0 19.2 0 67.2 19.2 80 28.8 19.2 89.6-6.4 89.6 44.8 0 19.2-6.4 41.6-28.8 41.6z"></path></svg>',this.tag="select",this.width=60}return e.prototype.getOptions=function(e){var t=[{value:"header1",text:"H1",styleForRenderMenuList:{"font-size":"32px","font-weight":"bold"}},{value:"header2",text:"H2",styleForRenderMenuList:{"font-size":"24px","font-weight":"bold"}},{value:"header3",text:"H3",styleForRenderMenuList:{"font-size":"18px","font-weight":"bold"}},{value:"header4",text:"H4",styleForRenderMenuList:{"font-size":"16px","font-weight":"bold"}},{value:"header5",text:"H5",styleForRenderMenuList:{"font-size":"13px","font-weight":"bold"}},{value:"header6",text:"H6",styleForRenderMenuList:{"font-size":"11px","font-weight":"bold"}},{value:"paragraph",text:QE("header.text")}],n=this.getValue(e).toString();return t.forEach(function(e){e.value===n?e.selected=!0:e.selected=void 0}),t},e.prototype.isActive=function(e){return!1},e.prototype.getValue=function(e){return pO(e)},e.prototype.isDisabled=function(e){return hO(e)},e.prototype.exec=function(e,t){gO(e,t.toString())},e}(),SO={key:"headerSelect",factory:function(){return new wO}},AO={key:"header1",factory:function(){return new mO}},xO={key:"header2",factory:function(){return new yO}},OO={key:"header3",factory:function(){return new bO}},NO={key:"header4",factory:function(){return new EO}},BO={key:"header5",factory:function(){return new CO}},TO={key:"header6",factory:function(){return new DO}};function kO(e){return function(t,n,r){var o=am(t);return 0===(n=n.filter(function(e){return!!Cg.isText(e)||!!r.isInline(e)})).length&&(n=[{text:o.text().replace(/\s+/gm," ")}]),{type:"header".concat(e),children:n}}}var FO={selector:"h1:not([data-w-e-type])",parseElemHtml:kO(1)},IO={selector:"h2:not([data-w-e-type])",parseElemHtml:kO(2)},PO={selector:"h3:not([data-w-e-type])",parseElemHtml:kO(3)},_O={selector:"h4:not([data-w-e-type])",parseElemHtml:kO(4)},RO={selector:"h5:not([data-w-e-type])",parseElemHtml:kO(5)},LO={selector:"h6:not([data-w-e-type])",parseElemHtml:kO(6)};function MO(e){return function(t,n,r){return ND("h".concat(e),null,n)}}var jO={renderElems:[{type:"header1",renderElem:MO(1)},{type:"header2",renderElem:MO(2)},{type:"header3",renderElem:MO(3)},{type:"header4",renderElem:MO(4)},{type:"header5",renderElem:MO(5)},{type:"header6",renderElem:MO(6)}],elemsToHtml:[sO,uO,lO,cO,dO,fO],parseElemsHtml:[FO,IO,PO,_O,RO,LO],menus:[SO,AO,xO,OO,NO,BO,TO],editorPlugin:function(e){var t=e.insertBreak,n=e;return n.insertBreak=function(){var r=Qg(Kh.nodes(n,{match:function(e){return _y.getNodeType(e).startsWith("header")},universal:!0}),1),o=r[0];if(o)if(_y.isSelectionAtLineEnd(e,o[1])){jg.insertNodes(n,{type:"paragraph",children:[{text:""}]},{mode:"highest"})}else t();else t()},n}};var HO={type:"image",elemToHtml:function(e,t){var n=e,r=n.src,o=n.alt,i=void 0===o?"":o,a=n.href,s=void 0===a?"":a,u=n.width,l=void 0===u?"":u,c=n.height,d=void 0===c?"":c,f=n.style,p=void 0===f?{}:f,h=p.width,g=void 0===h?"":h,v=p.height,m=void 0===v?"":v,y="";return g&&(y+="width: ".concat(g,";")),m&&(y+="height: ".concat(m,";")),'<img src="'.concat(r,'" alt="').concat(i,'" data-href="').concat(s,'" width="').concat(l,'" height="').concat(d,'" style="').concat(y,'"/>')}};var zO=function(){function e(){this.title=QE("image.delete"),this.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M826.8032 356.5312c-19.328 0-36.3776 15.6928-36.3776 35.0464v524.2624c0 19.328-16 34.56-35.328 34.56H264.9344c-19.328 0-35.5072-15.3088-35.5072-34.56V390.0416c0-19.328-14.1568-35.0464-33.5104-35.0464s-33.5104 15.6928-33.5104 35.0464V915.712c0 57.9328 44.6208 108.288 102.528 108.288H755.2c57.9328 0 108.0832-50.4576 108.0832-108.288V391.4752c-0.1024-19.2512-17.1264-34.944-36.48-34.944z" p-id="9577"></path><path d="M437.1712 775.7568V390.6048c0-19.328-14.1568-35.0464-33.5104-35.0464s-33.5104 15.616-33.5104 35.0464v385.152c0 19.328 14.1568 35.0464 33.5104 35.0464s33.5104-15.7184 33.5104-35.0464zM649.7024 775.7568V390.6048c0-19.328-17.0496-35.0464-36.3776-35.0464s-36.3776 15.616-36.3776 35.0464v385.152c0 19.328 17.0496 35.0464 36.3776 35.0464s36.3776-15.7184 36.3776-35.0464zM965.0432 217.0368h-174.6176V145.5104c0-57.9328-47.2064-101.76-104.6528-101.76h-350.976c-57.8304 0-105.3952 43.8528-105.3952 101.76v71.5264H54.784c-19.4304 0-35.0464 14.1568-35.0464 33.5104 0 19.328 15.616 33.5104 35.0464 33.5104h910.3616c19.328 0 35.0464-14.1568 35.0464-33.5104 0-19.3536-15.6928-33.5104-35.1488-33.5104z m-247.3728 0H297.3952V145.5104c0-19.328 18.2016-34.7648 37.4272-34.7648h350.976c19.1488 0 31.872 15.1296 31.872 34.7648v71.5264z"></path></svg>',this.tag="button"}return e.prototype.getValue=function(e){return""},e.prototype.isActive=function(e){return!1},e.prototype.isDisabled=function(e){return null==e.selection||null==_y.getSelectedNodeByType(e,"image")},e.prototype.exec=function(e,t){this.isDisabled(e)||jg.removeNodes(e,{match:function(e){return _y.checkNodeType(e,"image")}})},e}();function $O(e){return void 0===e&&(e="r"),"".concat(e,"-").concat(zm())}function UO(e){return e.replace(/</g,"<").replace(/>/g,">")}function VO(e){var t=e.selection;if(null==t)return!0;if(!fg.isCollapsed(t))return!0;var n=Qg(Kh.nodes(e,{match:function(t){var n=_y.getNodeType(t);return"code"===n||("pre"===n||("link"===n||("list-item"===n||(!!n.startsWith("header")||("blockquote"===n||!!Kh.isVoid(e,t))))))},universal:!0}),1);return!!n[0]}function WO(e,t,n){return Xg(this,arguments,void 0,function(e,t,n,r,o){var i,a;return void 0===r&&(r=""),void 0===o&&(o=""),Zg(this,function(s){switch(s.label){case 0:return(i=t.getMenuConfig(e).checkImage)?[4,i(n,r,o)]:[3,2];case 1:if("string"==typeof(a=s.sent()))return t.alert(a,"error"),[2,!1];if(null==a)return[2,!1];s.label=2;case 2:return[2,!0]}})})}function GO(e,t,n){return Xg(this,void 0,void 0,function(){var r;return Zg(this,function(o){switch(o.label){case 0:return(r=t.getMenuConfig(e).parseImageSrc)?[4,r(n)]:[3,2];case 1:return[2,o.sent()];case 2:return[2,n]}})})}function qO(e,t){return Xg(this,arguments,void 0,function(e,t,n,r){var o,i,a;return void 0===n&&(n=""),void 0===r&&(r=""),Zg(this,function(s){switch(s.label){case 0:return[4,WO("insertImage",e,t,n,r)];case 1:return s.sent()?[4,GO("insertImage",e,t)]:[2];case 2:return o=s.sent(),i={type:"image",src:UO(o),href:r,alt:n,style:{},children:[{text:""}]},null===e.selection&&e.restoreSelection(),_y.getSelectedNodeByType(e,"image")&&e.move(1),VO(e)?[2]:(jg.insertNodes(e,i),(a=e.getMenuConfig("insertImage").onInsertedImage)&&a(i),[2])}})})}function KO(){return $O("w-e-edit-image")}var YO=function(){function e(){this.title=QE("image.edit"),this.iconSvg=mx,this.tag="button",this.showModal=!0,this.modalWidth=300,this.$content=null,this.srcInputId=KO(),this.altInputId=KO(),this.hrefInputId=KO(),this.buttonId=KO()}return e.prototype.getValue=function(e){return""},e.prototype.getImageNode=function(e){return _y.getSelectedNodeByType(e,"image")},e.prototype.isActive=function(e){return!1},e.prototype.exec=function(e,t){},e.prototype.isDisabled=function(e){var t=e.selection;return null==t||(!fg.isCollapsed(t)||null==_y.getSelectedNodeByType(e,"image"))},e.prototype.getModalPositionNode=function(e){return this.getImageNode(e)},e.prototype.getModalContentElem=function(e){var t=this,n=this,r=n.srcInputId,o=n.altInputId,i=n.hrefInputId,a=n.buttonId,s=this.getImageNode(e);if(null==s)throw new Error("Not found selected image node");var u=Qg(cC(QE("image.src"),r),2),l=u[0],c=am(u[1]),d=Qg(cC(QE("image.desc"),o),2),f=d[0],p=am(d[1]),h=Qg(cC(QE("image.link"),i),2),g=h[0],v=am(h[1]),m=Qg(fC(a,QE("common.ok")),1)[0];if(null==this.$content){var y=am("<div></div>");y.on("click","#".concat(a),function(n){n.preventDefault();var a=y.find("#".concat(r)).val(),s=y.find("#".concat(o)).val(),u=y.find("#".concat(i)).val();t.updateImage(e,a,s,u),e.hidePanelOrModal()}),this.$content=y}var b=this.$content;b.empty(),b.append(l),b.append(f),b.append(g),b.append(m);var E=s,C=E.src,D=E.alt,w=void 0===D?"":D,S=E.href,A=void 0===S?"":S;return c.val(C),p.val(w),v.val(A),setTimeout(function(){c.focus()}),b[0]},e.prototype.updateImage=function(e,t,n,r,o){void 0===n&&(n=""),void 0===r&&(r=""),void 0===o&&(o={}),t&&(e.restoreSelection(),this.isDisabled(e)||function(e,t){Xg(this,arguments,void 0,function(e,t,n,r,o){var i,a,s,u,l,c;return void 0===n&&(n=""),void 0===r&&(r=""),void 0===o&&(o={}),Zg(this,function(d){switch(d.label){case 0:return[4,WO("editImage",e,t,n,r)];case 1:return d.sent()?[4,GO("editImage",e,t)]:[2];case 2:return i=d.sent(),null==(a=_y.getSelectedNodeByType(e,"image"))||(s=a.style,u={src:i,alt:n,href:r,style:Yg(Yg({},void 0===s?{}:s),o)},jg.setNodes(e,u,{match:function(e){return _y.checkNodeType(e,"image")}}),l=_y.getSelectedNodeByType(e,"image"),(c=e.getMenuConfig("editImage").onUpdatedImage)&&c(l)),[2]}})})}(e,t,n,r,o))},e}();function XO(){return $O("w-e-insert-image")}var ZO=function(){function e(){this.title=QE("image.editSize"),this.tag="button",this.showModal=!0,this.modalWidth=320,this.$content=null,this.widthInputId=XO(),this.heightInputId=XO(),this.buttonId=XO()}return e.prototype.getSelectedImageNode=function(e){return _y.getSelectedNodeByType(e,"image")},e.prototype.getValue=function(e){return""},e.prototype.isActive=function(e){return!1},e.prototype.exec=function(e,t){},e.prototype.isDisabled=function(e){return null==e.selection||null==this.getSelectedImageNode(e)},e.prototype.getModalPositionNode=function(e){return this.getSelectedImageNode(e)},e.prototype.getModalContentElem=function(e){var t=this,n=t.widthInputId,r=t.heightInputId,o=t.buttonId,i=Qg(cC(QE("image.width"),n,"auto"),2),a=i[0],s=am(i[1]),u=Qg(cC(QE("image.height"),r,"auto"),2),l=u[0],c=am(u[1]),d=Qg(fC(o,QE("image.ok")),1)[0],f=this.getSelectedImageNode(e);if(null==this.$content){var p=am("<div></div>");p.on("click","#".concat(o),function(t){t.preventDefault();var o=p.find("#".concat(n)).val().trim(),i=p.find("#".concat(r)).val().trim(),a=function(e){return/^\d+(\.\d+)?%$/.test(e)},s=function(e){return/^\d+(\.\d+)?$/.test(e)},u=function(e){return/^\d+(\.\d+)?px$/.test(e)},l="auto",c="auto";a(o)?l=o:s(o)?l="".concat(parseInt(o,10),"px"):u(o)&&(l=o),a(i)?c=i:s(i)?c="".concat(parseInt(i,10),"px"):u(i)&&(c=i);var d=f.style,h=void 0===d?{}:d;e.restoreSelection();var g=Yg(Yg({},h),{style:{width:l,height:c}});jg.setNodes(e,g,{match:function(e){return _y.checkNodeType(e,"image")}}),e.hidePanelOrModal()}),this.$content=p}var h=this.$content;if(h.empty(),h.append(a),h.append(l),h.append(d),null==f)return h[0];var g=f.style,v=void 0===g?{}:g,m=v.width,y=void 0===m?"auto":m,b=v.height,E=void 0===b?"auto":b;return s.val(y),c.val(E),setTimeout(function(){s.focus()}),h[0]},e}();function JO(){return $O("w-e-insert-image")}var QO=function(){function e(){this.title=QE("image.netImage"),this.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M959.877 128l0.123 0.123v767.775l-0.123 0.122H64.102l-0.122-0.122V128.123l0.122-0.123h895.775zM960 64H64C28.795 64 0 92.795 0 128v768c0 35.205 28.795 64 64 64h896c35.205 0 64-28.795 64-64V128c0-35.205-28.795-64-64-64zM832 288.01c0 53.023-42.988 96.01-96.01 96.01s-96.01-42.987-96.01-96.01S682.967 192 735.99 192 832 234.988 832 288.01zM896 832H128V704l224.01-384 256 320h64l224.01-192z"></path></svg>',this.tag="button",this.showModal=!0,this.modalWidth=300,this.$content=null,this.srcInputId=JO(),this.altInputId=JO(),this.hrefInputId=JO(),this.buttonId=JO()}return e.prototype.getValue=function(e){return""},e.prototype.isActive=function(e){return!1},e.prototype.exec=function(e,t){},e.prototype.isDisabled=function(e){return VO(e)},e.prototype.getModalPositionNode=function(e){return null},e.prototype.getModalContentElem=function(e){var t=this,n=this,r=n.srcInputId,o=n.altInputId,i=n.hrefInputId,a=n.buttonId,s=Qg(cC(QE("image.src"),r),2),u=s[0],l=am(s[1]),c=Qg(cC(QE("image.desc"),o),2),d=c[0],f=am(c[1]),p=Qg(cC(QE("image.link"),i),2),h=p[0],g=am(p[1]),v=Qg(fC(a,QE("common.ok")),1)[0];if(null==this.$content){var m=am("<div></div>");m.on("click","#".concat(a),function(n){n.preventDefault();var a=m.find("#".concat(r)).val().trim(),s=m.find("#".concat(o)).val().trim(),u=m.find("#".concat(i)).val().trim();t.insertImage(e,a,s,u),e.hidePanelOrModal()}),this.$content=m}var y=this.$content;return y.empty(),y.append(u),y.append(d),y.append(h),y.append(v),l.val(""),f.val(""),g.val(""),setTimeout(function(){l.focus()}),y[0]},e.prototype.insertImage=function(e,t,n,r){void 0===n&&(n=""),void 0===r&&(r=""),t&&(e.restoreSelection(),this.isDisabled(e)||qO(e,t,n,r))},e}(),eN=function(){function e(){this.title=QE("image.viewLink"),this.iconSvg=yx,this.tag="button"}return e.prototype.getValue=function(e){var t=_y.getSelectedNodeByType(e,"image");return t&&t.href||""},e.prototype.isActive=function(e){return!1},e.prototype.isDisabled=function(e){return null==e.selection||!this.getValue(e)},e.prototype.exec=function(e,t){if(!this.isDisabled(e)){if(!t||"string"!=typeof t)throw new Error("View image link failed, image.href is '".concat(t,"'"));window.open(t,"_blank")}},e}(),tN=function(){function e(){this.tag="button"}return e.prototype.getValue=function(e){return""},e.prototype.isActive=function(e){return!1},e.prototype.getSelectedNode=function(e){return _y.getSelectedNodeByType(e,"image")},e.prototype.isDisabled=function(e){return null==e.selection||null==this.getSelectedNode(e)},e.prototype.exec=function(e,t){if(!this.isDisabled(e)){var n=this.getSelectedNode(e);if(null!=n){var r=_y.getHoverbar(e);r&&r.hideAndClean();var o=n.style,i={style:Yg(Yg({},void 0===o?{}:o),{width:this.value,height:""})};jg.setNodes(e,i,{match:function(e){return _y.checkNodeType(e,"image")}})}}},e}(),nN=function(e){function t(){var t=e.apply(this,ev([],Qg(arguments),!1))||this;return t.title="30%",t.value="30%",t}return Kg(t,e),t}(tN),rN=function(e){function t(){var t=e.apply(this,ev([],Qg(arguments),!1))||this;return t.title="50%",t.value="50%",t}return Kg(t,e),t}(tN),oN=function(e){function t(){var t=e.apply(this,ev([],Qg(arguments),!1))||this;return t.title="100%",t.value="100%",t}return Kg(t,e),t}(tN),iN={onInsertedImage:function(e){},onUpdatedImage:function(e){},checkImage:function(e,t,n){return!0},parseImageSrc:function(e){return e}};function aN(e,t){var n=_y.findKey(e,t).id;return"w-e-image-container-".concat(n)}function sN(e,t,n,r){var o=am("body"),i=aN(e,t),a=r.width,s=r.height,u=0,l=0,c=0,d=0,f=!1,p=null;var h=AC(function(e){e.preventDefault();var t=e.clientX,n=l+(f?u-t:t-u),r=c*(n/l);n>d-6||null!=p&&(n<=15||r<=15||(p.css("width","".concat(n,"px")),p.css("height","".concat(r,"px"))))},100);function g(n){if(o.off("mousemove",h),null!=p){var r=p.width().toFixed(2),i=p.height().toFixed(2),a={style:Yg(Yg({},t.style),{width:"".concat(r,"px"),height:"".concat(i,"px")})};jg.setNodes(e,a,{at:_y.findPath(e,t)}),o.off("mouseup",g)}}function v(t,n){p=function(){var e=am("#".concat(i));if(0===e.length)throw new Error("Cannot find image container elem");return e}(),u=t,d=n;var r=p.find("img");if(0===r.length)throw new Error("Cannot find image elem");l=r.width(),c=r.height(),o.on("mousemove",h),o.on("mouseup",g);var a=_y.getHoverbar(e);a&&a.hideAndClean()}var m={};return a&&(m.width=a),s&&(m.height=s),m.boxShadow="0 0 0 1px #B4D5FF",ND("div",{id:i,style:m,className:"w-e-image-container w-e-selected-image-container",on:{mousedown:function(n){var r=am(n.target);if(r.hasClass("w-e-image-dragger")){n.preventDefault(),(r.hasClass("left-top")||r.hasClass("left-bottom"))&&(f=!0);var o=_y.getParentNode(e,t);if(null!=o){var i=_y.toDOMNode(e,o),a=i.getBoundingClientRect?i.getBoundingClientRect():{width:0},s=window.getComputedStyle(i),u=parseFloat(s.paddingLeft),l=parseFloat(s.paddingRight),c=parseFloat(s.borderLeftWidth),d=parseFloat(s.borderRightWidth);v(n.clientX,a.width-u-l-c-d)}}}}},n,ND("div",{className:"w-e-image-dragger left-top"}),ND("div",{className:"w-e-image-dragger right-top"}),ND("div",{className:"w-e-image-dragger left-bottom"}),ND("div",{className:"w-e-image-dragger right-bottom"}))}var uN={type:"image",renderElem:function(e,t,n){var r=e,o=r.src,i=r.alt,a=void 0===i?"":i,s=r.href,u=void 0===s?"":s,l=r.style,c=void 0===l?{}:l,d=c.width,f=void 0===d?"":d,p=c.height,h=void 0===p?"":p,g=_y.isNodeSelected(n,e),v={maxWidth:"100%"};f&&(v.width="100%"),h&&(v.height="100%");var m=ND("img",{style:v,src:o,alt:a,"data-href":u}),y=n.isDisabled();return g&&!y?sN(n,e,m,{width:f,height:h}):function(e,t,n,r){var o=r.width,i=r.height,a={};return o&&(a.width=o),i&&(a.height=i),ND("div",{id:aN(e,t),style:a,className:"w-e-image-container"},n)}(n,e,m,{width:f,height:h})}},lN={renderElems:[uN],elemsToHtml:[HO],parseElemsHtml:[{selector:"img:not([data-w-e-type])",parseElemHtml:function(e,t,n){var r=am(e),o=r.attr("data-href")||"";return o=decodeURIComponent(o),{type:"image",src:r.attr("src")||"",alt:r.attr("alt")||"",href:o,style:{width:Ax(r,"width"),height:Ax(r,"height")},width:r.attr("width")||"",height:r.attr("height")||"",children:[{text:""}]}}}],menus:[{key:"insertImage",factory:function(){return new QO},config:iN},{key:"deleteImage",factory:function(){return new zO}},{key:"editImage",factory:function(){return new YO},config:iN},{key:"viewImageLink",factory:function(){return new eN}},{key:"imageWidth30",factory:function(){return new nN}},{key:"imageWidth50",factory:function(){return new rN}},{key:"imageWidth100",factory:function(){return new oN}},{key:"editorImageSizeMenu",factory:function(){return new ZO}}],editorPlugin:function(e){var t=e.isInline,n=e.isVoid,r=e;return r.isInline=function(e){return"image"===e.type||t(e)},r.isVoid=function(e){return"image"===e.type||n(e)},r}},cN=function(){function e(){this.tag="button"}return e.prototype.getValue=function(e){var t=Qg(Kh.nodes(e,{match:function(e){return!!e.indent},universal:!0}),1),n=t[0];return null==n?"":Qg(n,1)[0].indent||""},e.prototype.isActive=function(e){return!1},e.prototype.getMatchNode=function(e){var t=Qg(Kh.nodes(e,{match:function(e){var t=_y.getNodeType(e);return"paragraph"===t||!!t.startsWith("header")},universal:!0,mode:"highest"}),1),n=t[0];return null==n?null:n[0]},e}(),dN=function(e){function t(){var t=e.apply(this,ev([],Qg(arguments),!1))||this;return t.title=QE("indent.decrease"),t.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M0 64h1024v128H0z m384 192h640v128H384z m0 192h640v128H384z m0 192h640v128H384zM0 832h1024v128H0z m256-512v384l-256-192z"></path></svg>',t}return Kg(t,e),t.prototype.isDisabled=function(e){var t=this.getMatchNode(e);return null==t||!t.indent},t.prototype.exec=function(e,t){jg.setNodes(e,{indent:null},{match:function(e){return $h.isElement(e)}})},t}(cN),fN=function(e){function t(){var t=e.apply(this,ev([],Qg(arguments),!1))||this;return t.title=QE("indent.increase"),t.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M0 64h1024v128H0z m384 192h640v128H384z m0 192h640v128H384z m0 192h640v128H384zM0 832h1024v128H0z m0-128V320l256 192z"></path></svg>',t.DEFAULT_INDENT_VALUE="2em",t}return Kg(t,e),t.prototype.isDisabled=function(e){var t=this.getMatchNode(e);return null==t||!!t.indent},t.prototype.getIndentValue=function(e){var t=this.getMatchNode(e);if(!t)return this.DEFAULT_INDENT_VALUE;var n=t.children.filter(Cg.isText)[0];if(!n||!n.fontSize)return this.DEFAULT_INDENT_VALUE;var r=n.fontSize,o=parseInt(n.fontSize,10),i=r.replace("".concat(o),"");return"".concat(2*o).concat(i)},t.prototype.exec=function(e,t){var n=this.getIndentValue(e);jg.setNodes(e,{indent:n},{match:function(e){return $h.isElement(e)},mode:"highest"})},t}(cN);var pN={renderStyle:function(e,t){if(!$h.isElement(e))return t;var n=e.indent,r=t;return n&&$x(r,{textIndent:n}),r},styleToHtml:function(e,t){if(!$h.isElement(e))return t;var n=e.indent;if(!n)return t;var r=am(t);return r.css("text-indent",n),wx(r)},preParseHtml:[{selector:"p,h1,h2,h3,h4,h5",preParseHtml:function(e){var t=am(e),n=Ax(t,"padding-left");return/^[1-9]\d*em$/.test(n)&&t.css("text-indent","2em"),/^[1-9]\d*px$/.test(n)&&parseInt(n,10)%32==0&&t.css("text-indent","2em"),t[0]}}],parseStyleHtml:function(e,t,n){var r=am(e);if(!$h.isElement(t))return t;var o=t,i=Ax(r,"text-indent"),a=parseInt(i,10);return i&&a>0&&(o.indent=i),o},menus:[{key:"indent",factory:function(){return new fN}},{key:"delIndent",factory:function(){return new dN}}]},hN=function(){function e(){this.tag="button"}return e.prototype.getValue=function(e){return""},e.prototype.isActive=function(e){return!1},e.prototype.isDisabled=function(e){return null==e.selection||!!_y.getSelectedElems(e).some(function(t){var n=t.type;return!(!Kh.isVoid(e,t)||!Kh.isBlock(e,t)||"video"===n)||!!["pre","code"].includes(n)})},e}(),gN=function(e){function t(){var t=e.apply(this,ev([],Qg(arguments),!1))||this;return t.title=QE("justify.center"),t.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M870.4 793.6v102.4H153.6v-102.4h716.8z m102.4-230.4v102.4H51.2v-102.4h921.6z m-102.4-230.4v102.4H153.6v-102.4h716.8zM972.8 102.4v102.4H51.2V102.4h921.6z"></path></svg>',t}return Kg(t,e),t.prototype.exec=function(e,t){jg.setNodes(e,{textAlign:"center"},{match:function(t){return $h.isElement(t)&&!e.isInline(t)}})},t}(hN),vN=function(e){function t(){var t=e.apply(this,ev([],Qg(arguments),!1))||this;return t.title=QE("justify.justify"),t.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M0 64h1024v128H0z m0 192h1024v128H0z m0 192h1024v128H0z m0 192h1024v128H0z m0 192h1024v128H0z"></path></svg>',t}return Kg(t,e),t.prototype.exec=function(e,t){jg.setNodes(e,{textAlign:"justify"},{match:function(t){return $h.isElement(t)&&!e.isInline(t)}})},t}(hN),mN=function(e){function t(){var t=e.apply(this,ev([],Qg(arguments),!1))||this;return t.title=QE("justify.left"),t.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M768 793.6v102.4H51.2v-102.4h716.8z m204.8-230.4v102.4H51.2v-102.4h921.6z m-204.8-230.4v102.4H51.2v-102.4h716.8zM972.8 102.4v102.4H51.2V102.4h921.6z"></path></svg>',t}return Kg(t,e),t.prototype.exec=function(e,t){jg.setNodes(e,{textAlign:"left"},{match:function(t){return $h.isElement(t)&&!e.isInline(t)}})},t}(hN),yN=function(e){function t(){var t=e.apply(this,ev([],Qg(arguments),!1))||this;return t.title=QE("justify.right"),t.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M972.8 793.6v102.4H256v-102.4h716.8z m0-230.4v102.4H51.2v-102.4h921.6z m0-230.4v102.4H256v-102.4h716.8zM972.8 102.4v102.4H51.2V102.4h921.6z"></path></svg>',t}return Kg(t,e),t.prototype.exec=function(e,t){jg.setNodes(e,{textAlign:"right"},{match:function(t){return $h.isElement(t)&&!e.isInline(t)}})},t}(hN);var bN={renderStyle:function(e,t){if(!$h.isElement(e))return t;var n=e.textAlign,r=t;return n&&$x(r,{textAlign:n}),r},styleToHtml:function(e,t){if(!$h.isElement(e))return t;var n=e.textAlign;if(!n)return t;var r=am(t);return r.css("text-align",n),wx(r)},parseStyleHtml:function(e,t,n){var r=am(e);if(!$h.isElement(t))return t;var o=t,i=Ax(r,"text-align");return i&&(o.textAlign=i),o},menus:[{key:"justifyLeft",factory:function(){return new mN}},{key:"justifyRight",factory:function(){return new yN}},{key:"justifyCenter",factory:function(){return new gN}},{key:"justifyJustify",factory:function(){return new vN}}]};var EN=function(){function e(){this.title=QE("lineHeight.title"),this.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M964 788a8 8 0 0 1 8 8v98a8 8 0 0 1-8 8H438a8 8 0 0 1-8-8v-98a8 8 0 0 1 8-8h526zM198.93 144.306c6.668-5.798 16.774-5.094 22.573 1.574l122.26 140.582a16 16 0 0 1 3.927 10.5c0 8.836-7.164 16-16 16h-61.8a8 8 0 0 0-8 8v390.077h69.819a16 16 0 0 1 10.502 3.928c6.666 5.8 7.37 15.906 1.57 22.573L221.476 878.123a16 16 0 0 1-1.57 1.57c-6.668 5.8-16.774 5.097-22.574-1.57L75.051 737.538a16 16 0 0 1-3.928-10.5c0-8.837 7.163-16 16-16h69.822V312.96H87.127a16 16 0 0 1-10.502-3.928c-6.666-5.8-7.37-15.906-1.57-22.573l122.303-140.582a16 16 0 0 1 1.572-1.572zM964 465a8 8 0 0 1 8 8v98a8 8 0 0 1-8 8H438a8 8 0 0 1-8-8v-98a8 8 0 0 1 8-8h526z m0-323a8 8 0 0 1 8 8v98a8 8 0 0 1-8 8H438a8 8 0 0 1-8-8v-98a8 8 0 0 1 8-8h526z"></path></svg>',this.tag="select",this.width=80}return e.prototype.getOptions=function(e){var t=[],n=e.getMenuConfig("lineHeight").lineHeightList,r=void 0===n?[]:n;t.push({text:QE("lineHeight.default"),value:""}),r.forEach(function(e){t.push({text:e,value:e})});var o=this.getValue(e);return t.forEach(function(e){e.value===o?e.selected=!0:e.selected=void 0}),t},e.prototype.getMatchNode=function(e){var t=Qg(Kh.nodes(e,{match:function(e){var t=_y.getNodeType(e);return!!t.startsWith("header")||!!["paragraph","blockquote","list-item"].includes(t)},universal:!0,mode:"highest"}),1),n=t[0];return null==n?null:n[0]},e.prototype.isActive=function(e){return!1},e.prototype.getValue=function(e){var t=this.getMatchNode(e);return null==t?"":$h.isElement(t)&&t.lineHeight||""},e.prototype.isDisabled=function(e){return null==e.selection||null==this.getMatchNode(e)},e.prototype.exec=function(e,t){jg.setNodes(e,{lineHeight:t.toString()},{mode:"highest"})},e}();var CN={renderStyle:function(e,t){if(!$h.isElement(e))return t;var n=e.lineHeight,r=t;return n&&$x(r,{lineHeight:n}),r},styleToHtml:function(e,t){if(!$h.isElement(e))return t;var n=e.lineHeight;if(!n)return t;var r=am(t);return r.css("line-height",n),wx(r)},parseStyleHtml:function(e,t,n){var r=am(e);if(!$h.isElement(t))return t;var o=t,i=n.getMenuConfig("lineHeight").lineHeightList,a=void 0===i?[]:i,s=Ax(r,"line-height");return s&&a.includes(s)&&(o.lineHeight=s),o},menus:[{key:"lineHeight",factory:function(){return new EN},config:{lineHeightList:["1","1.15","1.5","2","2.5","3"]}}]};var DN={type:"link",elemToHtml:function(e,t){var n=e,r=n.url,o=n.target,i=void 0===o?"_blank":o;return'<a href="'.concat(r,'" target="').concat(i,'">').concat(t,"</a>")}};function wN(e,t,n,r){return Xg(this,void 0,void 0,function(){var o,i;return Zg(this,function(a){switch(a.label){case 0:return(o=t.getMenuConfig(e).checkLink)?[4,o(n,r)]:[3,2];case 1:if("string"==typeof(i=a.sent()))return t.alert(i,"error"),[2,!1];if(null==i)return[2,!1];a.label=2;case 2:return[2,!0]}})})}function SN(e,t,n){return Xg(this,void 0,void 0,function(){var r;return Zg(this,function(o){switch(o.label){case 0:return(r=t.getMenuConfig(e).parseLinkUrl)?[4,r(n)]:[3,2];case 1:return[2,o.sent()];case 2:return[2,n]}})})}function AN(e){return null==e.selection||!!_y.getSelectedElems(e).some(function(t){var n=t.type;return!!e.isVoid(t)||!!["pre","code","link"].includes(n)})}function xN(e,t){return{type:"link",url:UO(e),children:t?[{text:t}]:[]}}function ON(e,t,n){return Xg(this,void 0,void 0,function(){var r,o,i,a,s;return Zg(this,function(u){switch(u.label){case 0:return n?(t||(t=n),e.restoreSelection(),AN(e)?[2]:[4,wN("insertLink",e,t,n)]):[2];case 1:return u.sent()?[4,SN("insertLink",e,n)]:[2];case 2:if(r=u.sent(),null==(o=e.selection))return[2];if(fg.isCollapsed(o)){if((a=_y.getLeftLengthOfMaxLength(e))<=0)return[2];e.insertText(" "),a<t.length+1&&(t=t.slice(0,a-1)),s=xN(r,t),jg.insertNodes(e,s),e.insertFragment([{text:" "}])}else if((i=Kh.string(e,o))!==t){if((a=_y.getLeftLengthOfMaxLength(e))<=0)return[2];a<i.length-t.length&&(t=t.slice(0,a)),e.deleteFragment(),s=xN(r,t),jg.insertNodes(e,s)}else s=xN(r),jg.wrapNodes(e,s,{split:!0}),jg.collapse(e,{edge:"end"});return[2]}})})}function NN(){return $O("w-e-update-link")}var BN=function(){function e(){this.title=QE("link.edit"),this.iconSvg=mx,this.tag="button",this.showModal=!0,this.modalWidth=300,this.$content=null,this.urlInputId=NN(),this.buttonId=NN()}return e.prototype.getSelectedLinkElem=function(e){var t=_y.getSelectedNodeByType(e,"link");return null==t?null:t},e.prototype.getValue=function(e){var t=this.getSelectedLinkElem(e);return t&&t.url||""},e.prototype.isActive=function(e){return!1},e.prototype.exec=function(e,t){},e.prototype.isDisabled=function(e){return null==e.selection||null==this.getSelectedLinkElem(e)},e.prototype.getModalPositionNode=function(e){return _y.getSelectedNodeByType(e,"link")},e.prototype.getModalContentElem=function(e){var t=this.urlInputId,n=this.buttonId,r=Qg(cC(QE("link.url"),t),2),o=r[0],i=am(r[1]),a=Qg(fC(n,QE("common.ok")),1)[0];if(null==this.$content){var s=am("<div></div>");s.on("click","#".concat(n),function(n){n.preventDefault(),e.restoreSelection();var r=_y.getSelectedNodeByType(e,"link"),o=r?eg.string(r):"",i=s.find("#".concat(t)).val();!function(e,t,n){Xg(this,void 0,void 0,function(){var r,o;return Zg(this,function(i){switch(i.label){case 0:return n?[4,wN("editLink",e,t,n)]:[2];case 1:return i.sent()?[4,SN("editLink",e,n)]:[2];case 2:return r=i.sent(),o={url:UO(r)},jg.setNodes(e,o,{match:function(e){return _y.checkNodeType(e,"link")}}),[2]}})})}(e,o,i),e.hidePanelOrModal()}),this.$content=s}var u=this.$content;u.empty(),u.append(o),u.append(a);var l=this.getValue(e);return i.val(l),setTimeout(function(){i.focus()}),u[0]},e}();function TN(){return $O("w-e-insert-link")}var kN=function(){function e(){this.title=QE("link.insert"),this.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M440.224 635.776a51.84 51.84 0 0 1-36.768-15.232c-95.136-95.136-95.136-249.92 0-345.056l192-192C641.536 37.408 702.816 12.032 768 12.032s126.432 25.376 172.544 71.456c95.136 95.136 95.136 249.92 0 345.056l-87.776 87.776a51.968 51.968 0 1 1-73.536-73.536l87.776-87.776a140.16 140.16 0 0 0 0-197.984c-26.432-26.432-61.6-40.992-99.008-40.992s-72.544 14.56-99.008 40.992l-192 192a140.16 140.16 0 0 0 0 197.984 51.968 51.968 0 0 1-36.768 88.768z"></path><path d="M256 1012a242.4 242.4 0 0 1-172.544-71.456c-95.136-95.136-95.136-249.92 0-345.056l87.776-87.776a51.968 51.968 0 1 1 73.536 73.536l-87.776 87.776a140.16 140.16 0 0 0 0 197.984c26.432 26.432 61.6 40.992 99.008 40.992s72.544-14.56 99.008-40.992l192-192a140.16 140.16 0 0 0 0-197.984 51.968 51.968 0 1 1 73.536-73.536c95.136 95.136 95.136 249.92 0 345.056l-192 192A242.4 242.4 0 0 1 256 1012z"></path></svg>',this.tag="button",this.showModal=!0,this.modalWidth=300,this.$content=null,this.textInputId=TN(),this.urlInputId=TN(),this.buttonId=TN()}return e.prototype.getValue=function(e){return""},e.prototype.isActive=function(e){return!1},e.prototype.exec=function(e,t){},e.prototype.isDisabled=function(e){return AN(e)},e.prototype.getModalPositionNode=function(e){return null},e.prototype.getModalContentElem=function(e){var t=e.selection,n=this,r=n.textInputId,o=n.urlInputId,i=n.buttonId,a=Qg(cC(QE("link.text"),r),2),s=a[0],u=am(a[1]),l=Qg(cC(QE("link.url"),o),2),c=l[0],d=am(l[1]),f=Qg(fC(i,QE("common.ok")),1)[0];if(null==this.$content){var p=am("<div></div>");p.on("click","#".concat(i),function(t){t.preventDefault();var n=p.find("#".concat(r)).val(),i=p.find("#".concat(o)).val();ON(e,n,i),e.hidePanelOrModal()}),this.$content=p}var h=this.$content;if(h.empty(),h.append(s),h.append(c),h.append(f),null==t||fg.isCollapsed(t))u.val("");else{var g=Kh.string(e,t);u.val(g)}return d.val(""),setTimeout(function(){u.focus()}),h[0]},e}(),FN=function(){function e(){this.title=QE("link.unLink"),this.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M608.16328 811.815036c9.371954 9.371954 9.371954 24.56788 0 33.941834l-89.347563 89.347564c-118.525421 118.523421-311.38448 118.531421-429.919901 0-118.527421-118.529421-118.527421-311.39048 0-429.917901l89.349564-89.349563c9.371954-9.371954 24.56788-9.371954 33.941834 0l79.195613 79.195613c9.371954 9.371954 9.371954 24.56788 0 33.941834l-89.349563 89.347564c-56.143726 56.145726-56.143726 147.49928 0 203.645005 56.143726 56.143726 147.49928 56.145726 203.647005 0l89.347564-89.347563c9.371954-9.371954 24.56788-9.371954 33.941834 0l79.193613 79.195613z m-113.135447-520.429459c9.371954 9.371954 24.56788 9.371954 33.941834 0l89.347564-89.347564c56.143726-56.149726 147.49928-56.145726 203.647006 0 56.143726 56.145726 56.143726 147.49928 0 203.645006l-89.349564 89.347564c-9.371954 9.371954-9.371954 24.56788 0 33.941834l79.195613 79.195613c9.371954 9.371954 24.56788 9.371954 33.941834 0l89.349564-89.349563c118.529421-118.529421 118.529421-311.38848 0-429.917901-118.531421-118.527421-311.38848-118.527421-429.919901 0l-89.347563 89.347564c-9.371954 9.371954-9.371954 24.56788 0 33.941834l79.193613 79.195613z m469.653707 718.556492l45.253779-45.253779c18.745908-18.745908 18.745908-49.13776 0-67.881669L127.195629 14.062931c-18.745908-18.745908-49.13776-18.745908-67.881669 0L14.058181 59.31871c-18.745908 18.745908-18.745908 49.13776 0 67.881669l882.74169 882.74169c18.745908 18.743908 49.13776 18.743908 67.881669 0z"></path></svg>',this.tag="button"}return e.prototype.getValue=function(e){return""},e.prototype.isActive=function(e){return!1},e.prototype.isDisabled=function(e){return null==e.selection||null==_y.getSelectedNodeByType(e,"link")},e.prototype.exec=function(e,t){this.isDisabled(e)||jg.unwrapNodes(e,{match:function(e){return _y.checkNodeType(e,"link")}})},e}(),IN=function(){function e(){this.title=QE("link.view"),this.iconSvg=yx,this.tag="button"}return e.prototype.getSelectedLinkElem=function(e){var t=_y.getSelectedNodeByType(e,"link");return null==t?null:t},e.prototype.getValue=function(e){var t=this.getSelectedLinkElem(e);return t&&t.url||""},e.prototype.isActive=function(e){return!1},e.prototype.isDisabled=function(e){return null==e.selection||null==this.getSelectedLinkElem(e)},e.prototype.exec=function(e,t){if(!this.isDisabled(e)){if(!t||"string"!=typeof t)throw new Error("View link failed, link url is '".concat(t,"'"));window.open(t,"_blank")}},e}(),PN={checkLink:function(e,t){return!0},parseLinkUrl:function(e){return e}},_N={key:"insertLink",factory:function(){return new kN},config:PN},RN={key:"editLink",factory:function(){return new BN},config:PN},LN={key:"unLink",factory:function(){return new FN}},MN={key:"viewLink",factory:function(){return new IN}};var jN,HN,zN={selector:"a:not([data-w-e-type])",parseElemHtml:function(e,t,n){var r=am(e);return 0===(t=t.filter(function(e){return!!Cg.isText(e)||!!n.isInline(e)})).length&&(t=[{text:r.text().replace(/\s+/gm," ")}]),{type:"link",url:r.attr("href")||"",target:r.attr("target")||"",children:t}}};var $N=b(function(){if(HN)return jN;HN=1,jN=function(r){if("string"!=typeof r)return!1;var o=r.match(e);if(!o)return!1;var i=o[1];if(!i)return!1;if(t.test(i)||n.test(i))return!0;return!1};var e=/^(?:\w+:)?\/\/(\S+)$/,t=/^localhost[\:?\d]*(?:[^\:?\d]\S*)?$/,n=/^[^\s\.]+\.\S{2,}$/;return jN}());var UN={type:"link",renderElem:function(e,t,n){var r=e,o=r.url,i=r.target;return ND("a",{href:o,target:void 0===i?"_blank":i},t)}},VN={renderElems:[UN],elemsToHtml:[DN],parseElemsHtml:[zN],menus:[_N,RN,LN,MN],editorPlugin:function(e){var t=e.isInline,n=e.insertData,r=e.normalizeNode,o=e;return o.isInline=function(e){return"link"===e.type||t(e)},o.insertData=function(e){var t=e.getData("text/plain");if($N(t)){if(/<img[^>]+>/.test(e.getData("text/html")))n(e);else if(!AN(o)){var r=o.selection;if(null!=r){var i=Kh.string(o,r);ON(o,i,t)}}}else n(e)},o.normalizeNode=function(e){var t=Qg(e,2),n=t[0],i=t[1];return"link"!==_y.getNodeType(n)?r([n,i]):""===eg.string(n)?jg.removeNodes(o,{at:i}):r([n,i])},o}};var WN={selector:"p:not([data-w-e-type])",parseElemHtml:function(e,t,n){var r=am(e);return 0===(t=t.filter(function(e){return!!Cg.isText(e)||!!n.isInline(e)})).length&&(t=[{text:r.text().replace(/\s+/gm," ")}]),{type:"paragraph",children:t}}};function GN(e){var t=Qg(Kh.nodes(e,{match:function(t){return e.children[0]===t},mode:"highest"}),1),n=t[0];if(null==n)return!1;var r=n[0];if(!$h.isElement(r))return!1;if("paragraph"===r.type)return!1;if(""!==eg.string(r))return!1;var o=r.children,i=void 0===o?[]:o;return!!Cg.isText(i[0])&&(jg.setNodes(e,{type:"paragraph"}),!0)}var qN={type:"paragraph",renderElem:function(e,t,n){return ND("p",null,t)}},KN={renderElems:[qN],elemsToHtml:[{type:"paragraph",elemToHtml:function(e,t){return""===t?"<p><br></p>":"<p>".concat(t,"</p>")}}],parseElemsHtml:[WN],editorPlugin:function(e){var t=e.deleteBackward,n=e.deleteForward,r=e;return r.deleteBackward=function(e){GN(r)||t(e)},r.deleteForward=function(e){GN(r)||n(e)},r}};function YN(e,t){if(null==e.selection)return!0;var n=Qg(Kh.nodes(e,{match:function(t){return"pre"===_y.getNodeType(t)||!!Kh.isVoid(e,t)},universal:!0}),1);return!!n[0]}function XN(e,t){Object.keys(t).forEach(function(t){"text"!==t&&Kh.removeMark(e,t)})}var ZN=function(){function e(){this.marksNeedToRemove=[],this.tag="button"}return e.prototype.getValue=function(e){var t=this.mark,n=Kh.marks(e);if(n)return n[t];var r=Qg(Kh.nodes(e,{match:function(e){return!0===e[t]}}),1);return!!r[0]},e.prototype.isActive=function(e){return!!this.getValue(e)},e.prototype.isDisabled=function(e){return YN(e,this.mark)},e.prototype.exec=function(e,t){var n=this.mark,r=this.marksNeedToRemove;t?e.removeMark(n):(e.addMark(n,!0),r&&r.forEach(function(t){return e.removeMark(t)}))},e}(),JN=function(e){function t(){var t=e.apply(this,ev([],Qg(arguments),!1))||this;return t.mark="bold",t.title=QE("textStyle.bold"),t.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M707.872 484.64A254.88 254.88 0 0 0 768 320c0-141.152-114.848-256-256-256H192v896h384c141.152 0 256-114.848 256-256a256.096 256.096 0 0 0-124.128-219.36zM384 192h101.504c55.968 0 101.504 57.408 101.504 128s-45.536 128-101.504 128H384V192z m159.008 640H384v-256h159.008c58.464 0 106.016 57.408 106.016 128s-47.552 128-106.016 128z"></path></svg>',t.hotkey="mod+b",t}return Kg(t,e),t}(ZN),QN=function(){function e(){this.title=QE("textStyle.clear"),this.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M969.382408 288.738615l-319.401123-270.852152a67.074236 67.074236 0 0 0-96.459139 5.74922l-505.931379 574.922021a68.35184 68.35184 0 0 0-17.886463 47.910169 74.101061 74.101061 0 0 0 24.274486 47.910168l156.50655 132.232065h373.060512L975.131628 383.281347a67.074236 67.074236 0 0 0-5.74922-96.459139z m-440.134747 433.746725H264.144729l-90.071117-78.572676c-5.74922-5.74922-12.137243-12.137243-12.137243-17.886463a36.411728 36.411728 0 0 1 5.749221-24.274485l210.804741-240.828447 265.102932 228.691204z m-439.495945 180.781036h843.218964a60.047411 60.047411 0 1 1 0 120.733624H89.751716a60.047411 60.047411 0 1 1 0-120.733624z m0 0"></path></svg>',this.tag="button"}return e.prototype.getValue=function(e){return""},e.prototype.isActive=function(e){return!1},e.prototype.isDisabled=function(e){return YN(e)},e.prototype.exec=function(e,t){var n,r,o=Kh.nodes(e,{match:function(e){return Cg.isText(e)},universal:!0});try{for(var i=Jg(o),a=i.next();!a.done;a=i.next()){XN(e,a.value[0])}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}},e}(),eB=function(e){function t(){var t=e.apply(this,ev([],Qg(arguments),!1))||this;return t.mark="code",t.title=QE("textStyle.code"),t.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M576 736l96 96 320-320L672 192l-96 96 224 224zM448 288l-96-96L32 512l320 320 96-96-224-224z"></path></svg>',t.hotkey="mod+e",t}return Kg(t,e),t}(ZN),tB=function(e){function t(){var t=e.apply(this,ev([],Qg(arguments),!1))||this;return t.mark="italic",t.title=QE("textStyle.italic"),t.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M896 64v64h-128L448 896h128v64H128v-64h128L576 128h-128V64z"></path></svg>',t.hotkey="mod+i",t}return Kg(t,e),t}(ZN),nB=function(e){function t(){var t=e.apply(this,ev([],Qg(arguments),!1))||this;return t.mark="sub",t.marksNeedToRemove=["sup"],t.title=QE("textStyle.sub"),t.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M768 910.016v50.016h128v64h-192v-146.016l128-60V768h-128v-64h192v146.016zM676 256h-136L352 444 164 256H28l256 256-256 256h136L352 580 540 768h136l-256-256z"></path></svg>',t.hotkey="",t}return Kg(t,e),t}(ZN),rB=function(e){function t(){var t=e.apply(this,ev([],Qg(arguments),!1))||this;return t.mark="sup",t.marksNeedToRemove=["sub"],t.title=QE("textStyle.sup"),t.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M768 206.016v50.016h128v64h-192V174.016l128-60V64h-128V0h192v146.016zM676 256h-136L352 444 164 256H28l256 256-256 256h136L352 580 540 768h136l-256-256z"></path></svg>',t.hotkey="",t}return Kg(t,e),t}(ZN),oB=function(e){function t(){var t=e.apply(this,ev([],Qg(arguments),!1))||this;return t.mark="through",t.title=QE("textStyle.through"),t.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M1024 512v64h-234.496c27.52 38.496 42.496 82.688 42.496 128 0 70.88-36.672 139.04-100.576 186.976C672.064 935.488 594.144 960 512 960s-160.064-24.512-219.424-69.024C228.64 843.04 192 774.88 192 704h128c0 69.376 87.936 128 192 128s192-58.624 192-128-87.936-128-192-128H0v-64h299.52a385.984 385.984 0 0 1-6.944-5.024C228.64 459.04 192 390.88 192 320s36.672-139.04 100.576-186.976C351.936 88.512 429.856 64 512 64s160.064 24.512 219.424 69.024C795.328 180.96 832 249.12 832 320h-128c0-69.376-87.936-128-192-128s-192 58.624-192 128 87.936 128 192 128c78.976 0 154.048 22.688 212.48 64H1024z"></path></svg>',t.hotkey="mod+shift+x",t}return Kg(t,e),t}(ZN),iB=function(e){function t(){var t=e.apply(this,ev([],Qg(arguments),!1))||this;return t.mark="underline",t.title=QE("textStyle.underline"),t.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M704 64l128 0 0 416c0 159.072-143.264 288-320 288s-320-128.928-320-288l0-416 128 0 0 416c0 40.16 18.24 78.688 51.36 108.512 36.896 33.216 86.848 51.488 140.64 51.488s103.744-18.304 140.64-51.488c33.12-29.792 51.36-68.352 51.36-108.512l0-416zM192 832l640 0 0 128-640 0z"></path></svg>',t.hotkey="mod+u",t}return Kg(t,e),t}(ZN);function aB(e,t){return 0!==e.length&&(!!e[0].matches(t)||e.find(t).length>0)}function sB(e,t){var n=t,r=e,o=r.bold,i=r.italic,a=r.underline,s=r.code,u=r.through,l=r.sub,c=r.sup;return o&&(n="<strong>".concat(n,"</strong>")),s&&(n="<code>".concat(n,"</code>")),i&&(n="<em>".concat(n,"</em>")),a&&(n="<u>".concat(n,"</u>")),u&&(n="<s>".concat(n,"</s>")),l&&(n="<sub>".concat(n,"</sub>")),c&&(n="<sup>".concat(n,"</sup>")),n}var uB={renderStyle:function(e,t){var n=e,r=n.bold,o=n.italic,i=n.underline,a=n.code,s=n.through,u=n.sub,l=n.sup,c=t;return r&&(c=ND("strong",null,c)),a&&(c=ND("code",null,c)),o&&(c=ND("em",null,c)),i&&(c=ND("u",null,c)),s&&(c=ND("s",null,c)),u&&(c=ND("sub",null,c)),l&&(c=ND("sup",null,c)),c},menus:[{key:"bold",factory:function(){return new JN}},{key:"underline",factory:function(){return new iB}},{key:"italic",factory:function(){return new tB}},{key:"through",factory:function(){return new oB}},{key:"code",factory:function(){return new eB}},{key:"sub",factory:function(){return new nB}},{key:"sup",factory:function(){return new rB}},{key:"clearStyle",factory:function(){return new QN}}],styleToHtml:function(e,t){if(!Cg.isText(e))return t;if(Dx(t))return sB(e,t);var n=am(t),r=n.html();return r=sB(e,r),n.html(r),wx(n)},parseStyleHtml:function(e,t,n){var r=am(e);if(!Cg.isText(t))return t;var o=t;return aB(r,"b,strong")&&(o.bold=!0),aB(r,"i,em")&&(o.italic=!0),aB(r,"u")&&(o.underline=!0),aB(r,"s,strike")&&(o.through=!0),aB(r,"sub")&&(o.sub=!0),aB(r,"sup")&&(o.sup=!0),aB(r,"code")&&(o.code=!0),o}};var lB={type:"todo",elemToHtml:function(e,t){var n=e.checked;return'<div data-w-e-type="todo"><input type="checkbox" disabled '.concat(n?"checked":"",">").concat(t,"</div>")}},cB=function(){function e(){this.title=QE("todo.todo"),this.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M278.755556 403.911111l-79.644445 79.644445L455.111111 739.555556l568.888889-568.888889-79.644444-79.644445L455.111111 580.266667l-176.355555-176.355556zM910.222222 910.222222H113.777778V113.777778h568.888889V0H113.777778C51.2 0 0 51.2 0 113.777778v796.444444c0 62.577778 51.2 113.777778 113.777778 113.777778h796.444444c62.577778 0 113.777778-51.2 113.777778-113.777778V455.111111h-113.777778v455.111111z"></path></svg>',this.tag="button"}return e.prototype.getValue=function(e){return""},e.prototype.isActive=function(e){return!!_y.getSelectedNodeByType(e,"todo")},e.prototype.isDisabled=function(e){return null==e.selection||!!_y.getSelectedElems(e).some(function(t){if(Kh.isVoid(e,t)&&Kh.isBlock(e,t))return!0;var n=t.type;return!!["pre","table","list-item"].includes(n)})},e.prototype.exec=function(e,t){var n=this.isActive(e);jg.setNodes(e,{type:n?"paragraph":"todo"})},e}();var dB={selector:'div[data-w-e-type="todo"]',parseElemHtml:function(e,t,n){var r=am(e);0===(t=t.filter(function(e){return!!Cg.isText(e)||!!n.isInline(e)})).length&&(t=[{text:r.text().replace(/\s+/gm," ")}]);var o=!1;return null!=r.find('input[type="checkbox"]').attr("checked")&&(o=!0),{type:"todo",checked:o,children:t}}};var fB={type:"todo",renderElem:function(e,t,n){var r=!1;n.isDisabled()&&(r=!0);var o=ND("div",{style:{margin:"5px 0"}},ND("span",{contentEditable:!1,style:{marginRight:"0.5em"}},ND("input",{type:"checkbox",checked:e.checked,disabled:r,on:{change:function(t){var r=_y.findPath(n,e),o={checked:t.target.checked};jg.setNodes(n,o,{at:r})}}})),ND("span",null,t));return o}},pB={renderElems:[fB],elemsToHtml:[lB],preParseHtml:[{selector:"ul.w-e-todo",preParseHtml:function(e){var t=am(e).find("li"),n=am('<div data-w-e-type="todo"></div>'),r=t.find("input[type]");return n.append(r),t.children()[0].remove(),n[0].innerHTML+=t[0].innerHTML,n[0]}}],parseElemsHtml:[dB],menus:[{key:"todo",factory:function(){return new cB}}],editorPlugin:function(e){var t=e.deleteBackward,n=e;return n.deleteBackward=function(n){var r=e.selection;if(r&&fg.isCollapsed(r)){var o=_y.getSelectedNodeByType(e,"todo");if(o&&0===eg.string(o).length)return void jg.setNodes(e,{type:"paragraph"},{mode:"highest"})}t(n)},n}},hB=function(){function e(){this.title=QE("undo.redo"),this.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M0.00032 576a510.72 510.72 0 0 0 173.344 384l84.672-96A383.136 383.136 0 0 1 128.00032 576C128.00032 363.936 299.93632 192 512.00032 192c106.048 0 202.048 42.976 271.52 112.48L640.00032 448h384V64l-149.984 149.984A510.272 510.272 0 0 0 512.00032 64C229.21632 64 0.00032 293.216 0.00032 576z"></path></svg>',this.tag="button"}return e.prototype.getValue=function(e){return""},e.prototype.isActive=function(e){return!1},e.prototype.isDisabled=function(e){return null==e.selection},e.prototype.exec=function(e,t){"function"==typeof e.redo&&e.redo()},e}(),gB=function(){function e(){this.title=QE("undo.undo"),this.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M512 64A510.272 510.272 0 0 0 149.984 213.984L0.032 64v384h384L240.512 304.48A382.784 382.784 0 0 1 512.032 192c212.064 0 384 171.936 384 384 0 114.688-50.304 217.632-130.016 288l84.672 96a510.72 510.72 0 0 0 173.344-384c0-282.784-229.216-512-512-512z"></path></svg>',this.tag="button"}return e.prototype.getValue=function(e){return""},e.prototype.isActive=function(e){return!1},e.prototype.isDisabled=function(e){return null==e.selection},e.prototype.exec=function(e,t){"function"==typeof e.undo&&e.undo()},e}(),vB=[uB,Ux,tO,pN,bN,CN,lN,Kx,Xx,VN,Rx,Bx,jO,KN,pB,rO,{menus:[{key:"redo",factory:function(){return new hB}},{key:"undo",factory:function(){return new gB}}]},iO,Wx];YE("en",{listModule:{unOrderedList:"Unordered list",orderedList:"Ordered list"}}),YE("zh-CN",{listModule:{unOrderedList:"无序列表",orderedList:"有序列表"}});var mB=new WeakMap;function yB(e){var t,n=e.children||[],r=n.length;if(0===r)return"";for(var o=0;o<r&&!t;o+=1){var i=n[o];Cg.isText(i)&&(t=i)}return null==t?"":t.color||""}function bB(e,t,n){for(var r=t.type,o=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(t,["type"]),i=void 0!==n?n:o.level||0,a=_y.findPath(e,t),s=a;;){if(0===s.length||0===a[a.length-1])return null;s=og.previous(s);var u=Kh.node(e,s);if(!u)return null;var l=Qg(u,1)[0],c=l.level,d=void 0===c?0:c;if(_y.getNodeType(l)!==r)return null;if(d===i)return l}}function EB(e,t,n){var r=bB(e,t,n);return!!r&&r.ordered===t.ordered}var CB=[];var DB={type:"list-item",elemToHtml:function(e,t){var n="",r="",o=e.ordered,i=void 0!==o&&o?"ol":"ul",a=function(e){var t=mB.get(e);if(null==t)return 0;var n=e,r=n.type,o=n.ordered,i=void 0!==o&&o,a=n.level,s=void 0===a?0:a,u=_y.findPath(t,e);if(0===u[0])return s+1;var l=og.previous(u),c=Kh.node(t,l);if(!c)return 0;var d=Qg(c,1)[0];if(_y.getNodeType(d)!==r)return s+1;var f=d,p=f.ordered,h=void 0!==p&&p,g=f.level,v=void 0===g?0:g;return v<s?s-v:v>s?EB(t,e)?0:1:v===s?h===i?0:1:0}(e);if(a>0)for(var s=0;s<a;s+=1)n+="<".concat(i,">"),CB.push(i);var u=function(e){var t=mB.get(e);if(null==t)return 0;var n=e,r=n.type,o=n.ordered,i=void 0!==o&&o,a=n.level,s=void 0===a?0:a,u=_y.findPath(t,e);if(u[0]===t.children.length-1)return s+1;var l=og.next(u),c=Kh.node(t,l);if(!c)return 0;var d=Qg(c,1)[0];if(_y.getNodeType(d)!==r)return s+1;var f=d,p=f.ordered,h=void 0!==p&&p,g=f.level,v=void 0===g?0:g;return v<s?EB(t,d)?s-v:s-v+1:v>s?0:v===s?h===i?0:1:0}(e);if(u>0)for(s=0;s<u;s+=1){var l=CB.pop();r+="</".concat(l,">")}var c=yB(e),d=c?' style="color:'.concat(c,'"'):"";return{html:"<li".concat(d,">").concat(t,"</li>"),prefix:n,suffix:r}}},wB=function(){function e(){this.type="list-item",this.tag="button"}return e.prototype.getListNode=function(e){var t=this.type;return _y.getSelectedNodeByType(e,t)},e.prototype.getValue=function(e){return""},e.prototype.isActive=function(e){var t=this.getListNode(e);if(null==t)return!1;var n=t.ordered;return(void 0!==n&&n)===this.ordered},e.prototype.isDisabled=function(e){return null==e.selection||!!_y.getSelectedElems(e).some(function(t){if(Kh.isVoid(e,t)&&Kh.isBlock(e,t))return!0;var n=t.type;return!!["pre","code","table"].includes(n)})},e.prototype.exec=function(e,t){this.isActive(e)?jg.setNodes(e,{type:"paragraph",ordered:void 0,level:void 0}):jg.setNodes(e,{type:"list-item",ordered:this.ordered,indent:void 0})},e}(),SB=function(e){function t(){var t=e.apply(this,ev([],Qg(arguments),!1))||this;return t.ordered=!1,t.title=QE("listModule.unOrderedList"),t.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M384 64h640v128H384V64z m0 384h640v128H384v-128z m0 384h640v128H384v-128zM0 128a128 128 0 1 1 256 0 128 128 0 0 1-256 0z m0 384a128 128 0 1 1 256 0 128 128 0 0 1-256 0z m0 384a128 128 0 1 1 256 0 128 128 0 0 1-256 0z"></path></svg>',t}return Kg(t,e),t}(wB),AB=function(e){function t(){var t=e.apply(this,ev([],Qg(arguments),!1))||this;return t.ordered=!0,t.title=QE("listModule.orderedList"),t.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M384 832h640v128H384z m0-384h640v128H384z m0-384h640v128H384zM192 0v256H128V64H64V0zM128 526.016v50.016h128v64H64v-146.016l128-60V384H64v-64h192v146.016zM256 704v320H64v-64h128v-64H64v-64h128v-64H64v-64z"></path></svg>',t}return Kg(t,e),t}(wB),xB={key:"bulletedList",factory:function(){return new SB}},OB={key:"numberedList",factory:function(){return new AB}};function NB(e){return e.length?e[0].tagName.toLowerCase():""}Nm&&(am.fn.append=Nm),cm&&(am.fn.attr=cm),Tm&&(am.fn.parent=Tm);var BB={selector:"li:not([data-w-e-type])",parseElemHtml:function(e,t,n){var r=am(e);0===(t=t.filter(function(e){return!!Cg.isText(e)||!!n.isInline(e)})).length&&(t=[{text:r.text().replace(/\s+/gm," ")}]);var o=function(e){return"ol"===NB(e.parent())}(r),i=function(e){for(var t=0,n=e.parent(),r=NB(n);"ul"===r||"ol"===r;)r=NB(n=n.parent()),t+=1;return t-1}(r);return{type:"list-item",ordered:o,level:i,children:t}}};var TB={selector:"ul:not([data-w-e-type]),ol:not([data-w-e-type])",parseElemHtml:function(e,t,n){return t.flat(1/0)}};function kB(e){return Kh.nodes(e,{at:e.selection||void 0,match:function(t){return 1===_y.findPath(e,t).length}})}var FB={type:"list-item",renderElem:function(e,t,n){mB.set(e,n);var r=e,o=r.level,i=void 0===o?0:o,a=r.ordered,s=void 0!==a&&a,u={margin:"5px 0 5px ".concat(20*i,"px"),display:"flex",alignItems:"flex-start"},l="";if(s){var c=function(e,t){var n=t,r=n.type,o=n.level,i=void 0===o?0:o,a=n.ordered,s=void 0!==a&&a,u=1,l=t,c=_y.findPath(e,l);if(0===c[0])return 1;for(;c[0]>0;){var d=og.previous(c),f=Kh.node(e,d);if(null==f)break;var p=f[0],h=p.level,g=void 0===h?0:h,v=p.type,m=p.ordered;if(v!==r)break;if(g<i)break;if(g===i){if(m!==s)break;u+=1}l=p,c=d}return u}(n,e);l="".concat(c,".")}else l=function(e){void 0===e&&(e=0);var t="";switch(e){case 0:t="•";break;case 1:t="◦";break;default:t="▪"}return t}(i);return ND("div",{style:u},ND("span",{contentEditable:!1,style:{marginRight:"0.5em",color:yB(e)},"data-w-e-reserve":!0},l),ND("span",{style:{flex:"1",wordBreak:"break-word"}},t))}},IB={renderElems:[FB],editorPlugin:function(e){var t=e.deleteBackward,n=e.handleTab,r=e.normalizeNode,o=e.insertBreak,i=e;return i.insertBreak=function(){var t=Qg(Kh.nodes(e,{match:function(e){return _y.checkNodeType(e,"list-item")},universal:!0}),1),n=t[0];return n?""!==n[0].children[0].text?o():void jg.setNodes(i,{type:"paragraph",ordered:void 0,level:void 0}):o()},i.deleteBackward=function(n){var r=i.selection;if(null!=r)if(fg.isExpanded(r))t(n);else{var o=_y.getSelectedNodeByType(i,"list-item");if(null!=o)if(0!==r.focus.offset)t(n);else{var a=o,s=a.level,u=void 0===s?0:s,l=a.ordered,c=void 0!==l&&l;if(u>0){var d=bB(e,o,u-1);d&&d.ordered!==c?jg.setNodes(i,{level:u-1,ordered:!c}):jg.setNodes(i,{level:u-1})}else jg.setNodes(i,{type:"paragraph",ordered:void 0,level:void 0})}else t(n)}else t(n)},i.handleTab=function(){var e,t,r,o,a=i.selection;if(null!=a){if(fg.isCollapsed(a)){var s=_y.getSelectedNodeByType(i,"list-item");if(null==s)return void n();if(0===a.focus.offset){var u=s.level,l=void 0===u?0:u;return void jg.setNodes(i,{level:l+1})}}if(fg.isExpanded(a)){var c=0,d=!1;try{for(var f=Jg(kB(i)),p=f.next();!p.done;p=f.next()){var h=Qg(p.value,1)[0];"list-item"===_y.getNodeType(h)?c+=1:d=!0}}catch(t){e={error:t}}finally{try{p&&!p.done&&(t=f.return)&&t.call(f)}finally{if(e)throw e.error}}if(d||c<=1)return void n();try{for(var g=Jg(kB(i)),v=g.next();!v.done;v=g.next()){var m=Qg(v.value,2),y=(h=m[0],m[1]),b=h.level;l=void 0===b?0:b;jg.setNodes(i,{level:l+1},{at:y})}}catch(e){r={error:e}}finally{try{v&&!v.done&&(o=g.return)&&o.call(g)}finally{if(r)throw r.error}}}else n()}else n()},i.normalizeNode=function(e){var t=Qg(e,2),n=t[0],o=t[1],a=_y.getNodeType(n);return"bulleted-list"!==a&&"numbered-list"!==a||jg.unwrapNodes(i,{at:o}),r([n,o])},i},menus:[xB,OB],elemsToHtml:[DB],parseElemsHtml:[TB,BB]};YE("en",{tableModule:{modal:{border:"Border",borderWidth:"Width",bgColor:"Back color",align:"Text Align",ok:"OK"},color:{default:"Default color",clear:"Clear back color"},borderStyle:{none:"None",solid:"Solid",dotted:"Dotted",dashed:"Dashed",double:"Double",groove:"Groove",ridge:"Ridge",inset:"Inset",outset:"Outset"},deleteCol:"Delete column",deleteRow:"Delete row",deleteTable:"Delete table",widthAuto:"Fit width",insertCol:"Insert column",insertRow:"Insert row",insertTable:"Insert table",header:"Header",mergeCell:"merge cell",splitCell:"split cell",tableProperty:"Table property",cellProperty:"Cell property"}}),YE("zh-CN",{tableModule:{modal:{border:"边框",borderWidth:"宽度",bgColor:"背景色",align:"对齐方式",ok:"确定"},color:{default:"默认颜色",clear:"清除背景色"},borderStyle:{none:"无样式",solid:"实线",dotted:"点状虚线",dashed:"虚线",double:"双线",groove:"凹槽边框",ridge:"菱形边框",inset:"凹边框",outset:"凸边框"},deleteCol:"删除列",deleteRow:"删除行",deleteTable:"删除表格",widthAuto:"适应宽度",insertCol:"插入列",insertRow:"插入行",insertTable:"插入表格",header:"表头",mergeCell:"合并单元格",splitCell:"拆分单元格",tableProperty:"表格属性",cellProperty:"单元格属性"}});var PB={type:"table",elemToHtml:function(e,t){var n=e,r=n.width,o=void 0===r?"auto":r,i=n.columnWidths,a=n.height,s=void 0===a?"auto":a,u=null==i?void 0:i.map(function(e){return"<col width=".concat(e,"></col>")}).join(""),l=u?'<colgroup contentEditable="false">'.concat(u,"</colgroup>"):"";return'<table style="width: '.concat(o,";table-layout: fixed;height:").concat(s,'">').concat(l,"<tbody>").concat(t,"</tbody></table>")}},_B={type:"table-row",elemToHtml:function(e,t){var n=e.height,r=n?' style="height: '.concat(n,'px"'):"";return"<tr".concat(r,">").concat(t,"</tr>")}},RB={type:"table-cell",elemToHtml:function(e,t){var n=e,r=n.colSpan,o=void 0===r?1:r,i=n.rowSpan,a=void 0===i?1:i,s=n.isHeader,u=void 0!==s&&s,l=n.width,c=void 0===l?"auto":l,d=n.hidden;if(void 0!==d&&d)return"";var f=u?"th":"td";return"<".concat(f,' colSpan="').concat(o,'" rowSpan="').concat(a,'" width="').concat(c,'">').concat(t,"</").concat(f,">")}},LB='<svg viewBox="0 0 1024 1024"><path d="M236.8 128L896 787.2V128H236.8z m614.4 704L192 172.8V832h659.2zM192 64h704c38.4 0 64 25.6 64 64v704c0 38.4-25.6 64-64 64H192c-38.4 0-64-25.6-64-64V128c0-38.4 25.6-64 64-64z"></path></svg>',MB={blocks:{td:"table-cell",th:"table-cell",content:"paragraph",tr:"table-row",table:"table",tbody:"table-body"}};function jB(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var r=MB,o=t.map(function(e){var t;return null===(t=null==r?void 0:r.blocks)||void 0===t?void 0:t[e]});return function(e){return function(e){return!Kh.isEditor(e)&&$h.isElement(e)&&"type"in e}(e)&&o.includes(e.type)}}function HB(e,t){for(var n=Qg(t,2),r=n[0],o=n[1],i=[],a=2;a<arguments.length;a++)i[a-2]=arguments[a];var s=Qg(eg.common(e,r,o),2),u=s[0],l=s[1];return!!jB.apply(void 0,ev([e],Qg(i),!1))(u,l)||!!Kh.above(e,{match:jB.apply(void 0,ev([e],Qg(i),!1)),at:l})}function zB(e,t){var n,r;void 0===t&&(t={});var o=[];try{for(var i=Jg(function(e,t){var n,r,o,i,a,s,u,l,c,d,f,p,h,g,v,m,y,b;return void 0===t&&(t={}),Zg(this,function(E){switch(E.label){case 0:if(n=Qg(Kh.nodes(e,{match:jB(e,"table"),at:t.at}),1),!(r=n[0]))return[2,[]];o=Qg(r,2),i=o[1],E.label=1;case 1:E.trys.push([1,6,7,8]),a=Jg(Kh.nodes(e,{match:jB(e,"table"),at:i})),s=a.next(),E.label=2;case 2:if(s.done)return[3,5];u=Qg(s.value,2),l=u[1],c=[];try{for(y=void 0,d=Jg(Kh.nodes(e,{match:jB(e,"tr"),at:l})),f=d.next();!f.done;f=d.next())p=Qg(f.value,2),h=p[1],c.push(ev([],Qg(Kh.nodes(e,{match:jB(e,"th","td"),at:h})),!1))}catch(e){y={error:e}}finally{try{f&&!f.done&&(b=d.return)&&b.call(d)}finally{if(y)throw y.error}}return[4,c];case 3:E.sent(),E.label=4;case 4:return s=a.next(),[3,2];case 5:return[3,8];case 6:return g=E.sent(),v={error:g},[3,8];case 7:try{s&&!s.done&&(m=a.return)&&m.call(a)}finally{if(v)throw v.error}return[7];case 8:return[2]}})}(e,{at:t.at})),a=i.next();!a.done;a=i.next()){for(var s=a.value,u=[],l=0,c=0;c<s.length;c+=1)s[c]&&(l=Math.max(l,s[c].length));for(c=0;c<s.length;c+=1)if(u[c]||(u[c]=[]),s[c])for(var d=0;d<s[c].length;d+=1)if(s[c][d]&&s[c][d][0]){for(var f=Qg(s[c][d],1)[0],p=f.rowSpan,h=void 0===p?1:p,g=f.colSpan,v=void 0===g?1:g,m=d;u[c]&&u[c][m];)m+=1;for(var y=0;y<v;y+=1)for(var b=0;b<h;b+=1){var E=c+b,C=m+y;u[E]||(u[E]=[]),u[E][C]||(u[E][C]=[s[c][d],{rtl:y+1,ltr:v-y,ttb:b+1,btt:h-b}])}}o.push.apply(o,ev([],Qg(u),!1))}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return o}var $B=function(){function e(e,t){this.x=e,this.y=t}return e.valueOf=function(e,t){return new this(e,t)},e.equals=function(e,t){return e.x===t.x&&e.y===t.y},e}();function UB(e){return e.length?e[0].tagName.toLowerCase():""}function VB(e,t){for(var n="",r=(e.attr("style")||"").split(";"),o=r.length,i=0;i<o;i+=1){var a=r[i];if(a){var s=a.split(":");s[0].trim()===t&&(n=s[1].trim())}}return n}Nm&&am.fn&&(am.fn.append=Nm),gm&&am.fn&&(am.fn.on=gm),jm&&am.fn&&(am.fn.focus=jm),cm&&am.fn&&(am.fn.attr=cm),hm&&am.fn&&(am.fn.val=hm),Am&&am.fn&&(am.fn.html=Am),pm&&am.fn&&(am.fn.dataset=pm),sm&&am.fn&&(am.fn.addClass=sm),um&&am.fn&&(am.fn.removeClass=um),Im&&am.fn&&(am.fn.children=Im),wm&&am.fn&&(am.fn.each=wm),Fm&&am.fn&&(am.fn.find=Fm),fm&&am.fn&&(am.fn.data=fm),Em&&am.fn&&(am.fn.hide=Em),Cm&&am.fn&&(am.fn.show=Cm);var WB=new WeakMap,GB=new WeakMap,qB=function(){function e(){this.title=QE("tableModule.tableProperty"),this.iconSvg='<svg viewBox="0 0 20 20"><path d="M8 2v5h4V2h1v5h5v1h-5v4h.021l-.172.351-1.916.28-.151.027c-.287.063-.54.182-.755.341L8 13v5H7v-5H2v-1h5V8H2V7h5V2h1zm4 6H8v4h4V8z" opacity=".6"/><path d="m15.5 11.5 1.323 2.68 2.957.43-2.14 2.085.505 2.946L15.5 18.25l-2.645 1.39.505-2.945-2.14-2.086 2.957-.43L15.5 11.5zM17 1a2 2 0 0 1 2 2v9.475l-.85-.124-.857-1.736a2.048 2.048 0 0 0-.292-.44L17 3H3v14h7.808l.402.392L10.935 19H3a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2h14z"/></svg>',this.tag="button",this.showModal=!0,this.modalWidth=300,this.menu="table",this.borderStyle=[{value:"none",label:QE("tableModule.borderStyle.none")},{value:"solid",label:QE("tableModule.borderStyle.solid")},{value:"dotted",label:QE("tableModule.borderStyle.dotted")},{value:"dashed",label:QE("tableModule.borderStyle.dashed")},{value:"double",label:QE("tableModule.borderStyle.double")},{value:"groove",label:QE("tableModule.borderStyle.groove")},{value:"ridge",label:QE("tableModule.borderStyle.ridge")},{value:"inset",label:QE("tableModule.borderStyle.inset")},{value:"outset",label:QE("tableModule.borderStyle.outset")}],this.textAlignOptions=[{value:"left",label:QE("justify.left"),svg:'<svg viewBox="0 0 1024 1024"><path d="M768 793.6v102.4H51.2v-102.4h716.8z m204.8-230.4v102.4H51.2v-102.4h921.6z m-204.8-230.4v102.4H51.2v-102.4h716.8zM972.8 102.4v102.4H51.2V102.4h921.6z"></path></svg>'},{value:"center",label:QE("justify.center"),svg:'<svg viewBox="0 0 1024 1024"><path d="M870.4 793.6v102.4H153.6v-102.4h716.8z m102.4-230.4v102.4H51.2v-102.4h921.6z m-102.4-230.4v102.4H153.6v-102.4h716.8zM972.8 102.4v102.4H51.2V102.4h921.6z"></path></svg>'},{value:"right",label:QE("justify.right"),svg:'<svg viewBox="0 0 1024 1024"><path d="M972.8 793.6v102.4H256v-102.4h716.8z m0-230.4v102.4H51.2v-102.4h921.6z m0-230.4v102.4H256v-102.4h716.8zM972.8 102.4v102.4H51.2V102.4h921.6z"></path></svg>'},{value:"justify",label:QE("justify.justify"),svg:'<svg viewBox="0 0 1024 1024"><path d="M0 64h1024v128H0z m0 192h1024v128H0z m0 192h1024v128H0z m0 192h1024v128H0z m0 192h1024v128H0z"></path></svg>'}]}return e.prototype.getValue=function(e){return""},e.prototype.isActive=function(e){return!1},e.prototype.isDisabled=function(e){return null==_y.getSelectedNodeByType(e,"table")},e.prototype.exec=function(e,t){},e.prototype.getModalContentNode=function(e){return Qg(Kh.nodes(e,{match:jB(e,"table")}),1)[0]},e.prototype.getModalPositionNode=function(e){return null},e.prototype.getModalContentElem=function(e){var t=this,n=this.getModalContentNode(e);if(!n)return null;var r=Qg(n,2),o=r[0],i=r[1],a=am('<div>\n <label class="babel-container">\n <span>'.concat(QE("tableModule.modal.border"),'</span>\n <span class="babel-container-border">\n <select name="borderStyle">\n ').concat(this.borderStyle.map(function(e){return'<option value="'.concat(e.value,'">').concat(e.label,"</option>")}).join(""),'\n </select>\n <span class="color-group" data-mark="color">\n <span class="color-group-block"></span>\n <input name="borderColor" type="hidden">\n </span>\n <input name="borderWidth" type="number" placeholder="').concat(QE("tableModule.modal.borderWidth"),'">\n </span>\n </label>\n <div class="babel-container">\n <span>').concat(QE("tableModule.modal.bgColor"),'</span>\n <span class="babel-container-background">\n <span class="color-group" data-mark="bgColor">\n <span class="color-group-block"></span>\n <input name="backgroundColor" type="hidden">\n </span>\n </span>\n </div>\n <label class="babel-container">\n <span>').concat(QE("tableModule.modal.align"),'</span>\n <span class="babel-container-align">\n <select name="textAlign">\n ').concat(this.textAlignOptions.map(function(e){return'<option value="'.concat(e.value,'">').concat(e.label,"</option>")}).join(""),'\n </select>\n </span>\n </label>\n <div class="button-container">\n <button type="button">').concat(QE("tableModule.modal.ok"),"</button>\n </div>\n </div>"));a.find("[name]").each(function(e){am(e).val(o[am(e).attr("name")])});var s=function(e,t){t?am(".color-group-block",e).css("background-color",t).empty():am(".color-group-block",e).css("background-color","").html(LB)};return a.find(".color-group").each(function(n){var r=am('[type="hidden"]',n).val()||"";s(n,r);var o=am(n);o.on("click",function(){a.find(".color-group .w-e-drop-panel").hide();var i=o.data("panel");i?i.show():(i=t.getPanelContentElem(e,{mark:o.data("mark"),selectedColor:r,callback:function(e){am('[type="hidden"]',n).val(e||""),s(n,e),i.hide()}}),o.append(i),o.data("panel",i))})}),a.find("button").on("click",function(){var n=Array.from(a.find("[name]")).reduce(function(e,t){return e[am(t).attr("name")]=am(t).val(),e},{}),r=WB.get(e);"cell"===t.menu&&(null==r?void 0:r.length)?r.forEach(function(t){t.forEach(function(t){jg.setNodes(e,n,{at:t[0][1]})})}):jg.setNodes(e,n,{at:i}),setTimeout(function(){e.focus()})}),a[0]},e.prototype.getPanelContentElem=function(e,t){var n=t.mark,r=t.selectedColor,o=t.callback,i=am('<ul class="w-e-panel-content-color"></ul>');i.on("click","li",function(e){var t=e.target;if(t){e.preventDefault(),e.stopPropagation();var n=am(t).attr("data-value");o(n)}});var a=e.getMenuConfig(n).colors;(void 0===a?[]:a).forEach(function(e){var t=am('<div class="color-block" data-value="'.concat(e,'"></div>'));t.css("background-color",e);var n=am('<li data-value="'.concat(e,'"></li>'));r===e&&n.addClass("active"),n.append(t),i.append(n)});var s="";"color"===n&&(s=QE("tableModule.color.default")),"bgColor"===n&&(s=QE("tableModule.color.clear"));var u=am('\n <li data-value="" class="clear">\n '.concat(LB,"\n ").concat(s,"\n </li>\n "));i.prepend(u);var l=am('<div class="w-e-drop-panel"></div>');return l.append(i),l},e}(),KB=function(e){function t(){var t=e.apply(this,ev([],Qg(arguments),!1))||this;return t.title=QE("tableModule.cellProperty"),t.iconSvg='<svg viewBox="0 0 20 20"><path d="m11.105 18-.17 1H2.5A1.5 1.5 0 0 1 1 17.5v-15A1.5 1.5 0 0 1 2.5 1h15A1.5 1.5 0 0 1 19 2.5v9.975l-.85-.124-.15-.302V8h-5v4h.021l-.172.351-1.916.28-.151.027c-.287.063-.54.182-.755.341L8 13v5h3.105zM2 12h5V8H2v4zm10-4H8v4h4V8zM2 2v5h5V2H2zm0 16h5v-5H2v5zM13 7h5V2h-5v5zM8 2v5h4V2H8z" opacity=".6"/><path d="m15.5 11.5 1.323 2.68 2.957.43-2.14 2.085.505 2.946L15.5 18.25l-2.645 1.39.505-2.945-2.14-2.086 2.957-.43L15.5 11.5zM13 6a1 1 0 0 1 1 1v3.172a2.047 2.047 0 0 0-.293.443l-.858 1.736-1.916.28-.151.027A1.976 1.976 0 0 0 9.315 14H7a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h6zm-1 2H8v4h4V8z"/></svg>',t.tag="button",t.showModal=!0,t.modalWidth=300,t.menu="cell",t}return Kg(t,e),t.prototype.getModalContentNode=function(e){return Qg(Kh.nodes(e,{match:jB(e,"td")}),1)[0]},t}(qB),YB=function(){function e(){this.title=QE("tableModule.deleteCol"),this.iconSvg='<svg viewBox="0 0 1048 1024"><path d="M327.68 510.976L393.216 445.44v-13.1072L327.68 366.7968V510.976z m327.68-78.4384l65.536-65.536V507.904L655.36 442.368v-9.8304z m393.216 484.9664V0H0v917.504h1048.576z m-65.536-131.072h-262.144v-52.4288l-13.1072 13.1072-52.4288-52.4288v91.7504H393.216v-91.7504l-52.4288 52.4288-13.1072-13.1072v52.4288H65.536V65.536H327.68v121.2416l36.0448-36.0448 29.4912 29.4912V62.2592h262.144V180.224l49.152-49.152 16.384 16.384V62.2592h262.144V786.432z m-294.912-108.1344l-160.5632-160.5632-167.1168 167.1168-78.6432-78.6432 167.1168-167.1168L288.3584 278.528l78.6432-78.6432 160.5632 160.5632 163.84-163.84 78.6432 78.6432-163.84 163.84 160.5632 160.5632-78.6432 78.6432z"></path></svg>',this.tag="button"}return e.prototype.getValue=function(e){return""},e.prototype.isActive=function(e){return!1},e.prototype.isDisabled=function(e){var t=e.selection;return null==t||(!fg.isCollapsed(t)||null==_y.getSelectedNodeByType(e,"table-cell"))},e.prototype.exec=function(e,t){if(!this.isDisabled(e)){var n=Qg(Kh.nodes(e,{match:function(e){return _y.checkNodeType(e,"table-cell")},universal:!0}),1),r=Qg(n[0],2),o=r[0],i=r[1],a=_y.getParentNode(e,o),s=(null==a?void 0:a.children.length)||0;if(!a||s<=1)jg.removeNodes(e,{mode:"highest"});else if(null!=_y.getParentNode(e,a)){var u=zB(e),l=0;e:for(var c=0;c<u.length;c+=1)for(var d=0;d<u[c].length;d+=1){var f=Qg(u[c][d],1),p=Qg(f[0],2)[1];if(og.equals(i,p)){l=d;break e}}Kh.withoutNormalizing(e,function(){for(var t,n,r=new Set,o=new Set,i=0;i<u.length;i+=1)if(u[i]&&u[i][l]){var a=Qg(u[i][l],2),s=Qg(a[0],2)[1],c=a[1],d=c.rtl,f=c.ltr,p=c.ttb,h=c.btt,g=s.join(",");if(d>1||f>1||p>1||h>1){var v=i-(p-1),m=l-(d-1);if(v<0||v>=u.length||!u[v]||!u[v][m])continue;var y=Qg(u[v][m],1),b=Qg(y[0],2),E=b[0],C=b[1],D=C.join(",");if(!o.has(D)){o.add(D);var w=E.rowSpan,S=void 0===w?1:w,A=E.colSpan,x=void 0===A?1:A,O=Math.max(x-1,1);jg.setNodes(e,{rowSpan:S,colSpan:O},{at:C})}}else r.add(g)}var N=Array.from(r);N.sort(function(e,t){var n=e.split(",").map(Number),r=t.split(",").map(Number);return n[n.length-2]!==r[r.length-2]?r[r.length-2]-n[n.length-2]:r[r.length-1]-n[n.length-1]});try{for(var B=Jg(N),T=B.next();!T.done;T=B.next()){var k=T.value.split(",").map(Number);try{Kh.hasPath(e,k)&&jg.removeNodes(e,{at:k})}catch(e){console.warn("删除单元格失败:",k,e)}}}catch(e){t={error:e}}finally{try{T&&!T.done&&(n=B.return)&&n.call(B)}finally{if(t)throw t.error}}var F=Qg(Kh.nodes(e,{match:function(e){return _y.checkNodeType(e,"table")},universal:!0}),1),I=F[0];if(I){var P=Qg(I,2),_=P[0],R=P[1],L=_.columnWidths,M=ev([],Qg(void 0===L?[]:L),!1);M.splice(l,1),jg.setNodes(e,{columnWidths:M},{at:R})}})}}},e}(),XB=function(){function e(){this.title=QE("tableModule.deleteRow"),this.iconSvg='<svg viewBox="0 0 1048 1024"><path d="M907.6736 586.5472L747.1104 425.984l163.84-163.84-78.6432-78.6432-163.84 163.84L507.904 186.7776 429.2608 262.144l163.84 163.84-167.1168 167.1168 78.6432 78.6432 167.1168-167.1168 160.5632 160.5632 75.3664-78.6432zM0 917.504V0h1048.576v917.504H0z m983.04-327.68h-22.9376l-65.536-65.536H983.04V327.68h-91.7504l65.536-65.536h26.2144V65.536H65.536v196.608h317.8496l65.536 65.536H65.536v196.608h380.1088l-65.536 65.536H65.536v196.608H983.04v-196.608z"></path></svg>',this.tag="button"}return e.prototype.getValue=function(e){return""},e.prototype.isActive=function(e){return!1},e.prototype.isDisabled=function(e){var t=e.selection;return null==t||(!fg.isCollapsed(t)||null==_y.getSelectedNodeByType(e,"table-row"))},e.prototype.exec=function(e,t){if(!this.isDisabled(e)){var n=Qg(Kh.nodes(e,{match:function(e){return _y.checkNodeType(e,"table-row")},universal:!0}),1),r=Qg(n[0],2),o=r[0],i=r[1],a=_y.getParentNode(e,o);if(((null==a?void 0:a.children.length)||0)<=1)jg.removeNodes(e,{mode:"highest"});else{var s=Qg(Kh.nodes(e,{match:function(e){return _y.checkNodeType(e,"table-cell")},universal:!0}),1),u=Qg(s[0],2)[1],l=zB(e),c=0;e:for(var d=0;d<l.length;d+=1)for(var f=0;f<l[d].length;f+=1){var p=Qg(l[d][f],1),h=Qg(p[0],2)[1];if(og.equals(u,h)){c=d;break e}}Kh.withoutNormalizing(e,function(){for(var t,n,r=[],o=0;o<l[c].length;o+=1){var a=Qg(l[c][o],2),s=Qg(a[0],1)[0].hidden,u=a[1],d=u.ttb,f=u.btt,p=u.rtl;if(d>1||f>1){var h=c-(d-1);if(h<0||h>=l.length||!l[h]||!l[h][o])continue;var g=Qg(l[h][o],1),v=Qg(g[0],2),m=v[0],y=v[1],b=m,E=b.rowSpan,C=void 0===E?1:E,D=b.colSpan,w=void 0===D?1:D;if(s)jg.setNodes(e,{rowSpan:Math.max(C-1,1),colSpan:w},{at:y});else if(1===d&&1===p){if(c+1<l.length&&C>1){var S={type:"table-cell",rowSpan:C-1,colSpan:w,hidden:!1,children:b.children.map(function(e){return Yg({},e)})};b.isHeader&&(S.isHeader=b.isHeader),b.width&&(S.width=b.width),b.backgroundColor&&(S.backgroundColor=b.backgroundColor),b.borderWidth&&(S.borderWidth=b.borderWidth),b.borderStyle&&(S.borderStyle=b.borderStyle),b.borderColor&&(S.borderColor=b.borderColor),b.textAlign&&(S.textAlign=b.textAlign),r.push({cell:S,columnIndex:o})}else jg.setNodes(e,{rowSpan:Math.max(C-1,1),colSpan:w},{at:y})}else jg.setNodes(e,{rowSpan:Math.max(C-1,1),colSpan:w},{at:y})}}if(jg.removeNodes(e,{at:i}),r.length>0){var A=i;try{r.sort(function(e,t){return e.columnIndex-t.columnIndex});try{for(var x=Jg(r),O=x.next();!O.done;O=x.next()){var N=O.value,B=N.cell,T=N.columnIndex;try{var k=ev(ev([],Qg(A),!1),[T],!1);jg.insertNodes(e,B,{at:k})}catch(t){try{var F=Qg(Kh.node(e,A),1)[0].children.length,I=ev(ev([],Qg(A),!1),[F],!1);jg.insertNodes(e,B,{at:I})}catch(e){console.warn("插入新单元格失败:",e)}}}}catch(e){t={error:e}}finally{try{O&&!O.done&&(n=x.return)&&n.call(x)}finally{if(t)throw t.error}}}catch(e){console.warn("插入新单元格失败:",e)}}})}}},e}(),ZB=function(){function e(){this.title=QE("tableModule.deleteTable"),this.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M826.8032 356.5312c-19.328 0-36.3776 15.6928-36.3776 35.0464v524.2624c0 19.328-16 34.56-35.328 34.56H264.9344c-19.328 0-35.5072-15.3088-35.5072-34.56V390.0416c0-19.328-14.1568-35.0464-33.5104-35.0464s-33.5104 15.6928-33.5104 35.0464V915.712c0 57.9328 44.6208 108.288 102.528 108.288H755.2c57.9328 0 108.0832-50.4576 108.0832-108.288V391.4752c-0.1024-19.2512-17.1264-34.944-36.48-34.944z" p-id="9577"></path><path d="M437.1712 775.7568V390.6048c0-19.328-14.1568-35.0464-33.5104-35.0464s-33.5104 15.616-33.5104 35.0464v385.152c0 19.328 14.1568 35.0464 33.5104 35.0464s33.5104-15.7184 33.5104-35.0464zM649.7024 775.7568V390.6048c0-19.328-17.0496-35.0464-36.3776-35.0464s-36.3776 15.616-36.3776 35.0464v385.152c0 19.328 17.0496 35.0464 36.3776 35.0464s36.3776-15.7184 36.3776-35.0464zM965.0432 217.0368h-174.6176V145.5104c0-57.9328-47.2064-101.76-104.6528-101.76h-350.976c-57.8304 0-105.3952 43.8528-105.3952 101.76v71.5264H54.784c-19.4304 0-35.0464 14.1568-35.0464 33.5104 0 19.328 15.616 33.5104 35.0464 33.5104h910.3616c19.328 0 35.0464-14.1568 35.0464-33.5104 0-19.3536-15.6928-33.5104-35.1488-33.5104z m-247.3728 0H297.3952V145.5104c0-19.328 18.2016-34.7648 37.4272-34.7648h350.976c19.1488 0 31.872 15.1296 31.872 34.7648v71.5264z"></path></svg>',this.tag="button"}return e.prototype.getValue=function(e){return""},e.prototype.isActive=function(e){return!1},e.prototype.isDisabled=function(e){return null==e.selection||null==_y.getSelectedNodeByType(e,"table")},e.prototype.exec=function(e,t){this.isDisabled(e)||jg.removeNodes(e,{mode:"highest"})},e}(),JB=function(){function e(){this.title=QE("tableModule.widthAuto"),this.iconSvg='<svg viewBox="0 0 1228 1024"><path d="M862.514337 563.200461H404.581995v121.753478a13.311987 13.311987 0 0 1-6.655993 11.468789 10.23999 10.23999 0 0 1-12.083188-1.433599l-204.799795-179.199821a13.721586 13.721586 0 0 1 0-20.479979l204.799795-179.302221a10.23999 10.23999 0 0 1 12.185588-1.535998 13.209587 13.209587 0 0 1 6.553593 11.673588v115.097485h457.932342V319.693504a11.571188 11.571188 0 0 1 18.841582-10.239989l204.799795 179.19982a13.721586 13.721586 0 0 1 0 20.47998l-204.799795 179.199821a10.23999 10.23999 0 0 1-12.185588 1.535998 13.311987 13.311987 0 0 1-6.655994-11.571188V563.200461zM136.499064 14.951409v993.893406a15.257585 15.257585 0 0 1-15.155185 15.052785H15.155185A15.155185 15.155185 0 0 1 0 1008.844815V14.951409a15.257585 15.257585 0 0 1 15.155185-15.052785h106.086294a15.155185 15.155185 0 0 1 15.257585 15.155185zM1228.798771 14.951409v993.893406a15.257585 15.257585 0 0 1-15.155185 15.052785h-106.188693a15.155185 15.155185 0 0 1-15.155185-15.052785V14.951409a15.257585 15.257585 0 0 1 15.155185-15.052785h106.086293A15.155185 15.155185 0 0 1 1228.798771 15.053809z"></path></svg>',this.tag="button"}return e.prototype.getValue=function(e){return!1},e.prototype.isActive=function(e){return!1},e.prototype.isDisabled=function(e){var t=e.selection;return null==t||(!fg.isCollapsed(t)||null==_y.getSelectedNodeByType(e,"table"))},e.prototype.exec=function(e,t){if(!this.isDisabled(e)){var n=_y.getSelectedNodeByType(e,"table");if(n){var r=n.columnWidths,o=void 0===r?[]:r,i=_y.toDOMNode(e,n).querySelector(".table-container");if(i&&0!==o.length){var a=i.clientWidth,s=o.reduce(function(e,t){return e+t},0),u=o.map(function(e){var t=e/s;return Math.floor(t*a)}),l=e.getMenuConfig("insertTable").minWidth,c=parseInt(String(void 0===l?60:l),10)||60,d=u.map(function(e){return Math.max(c,e)}),f=d.reduce(function(e,t){return e+t},0);if(f>a){var p=a/f,h=d.map(function(e){return Math.max(c,Math.floor(e*p))});v={width:"auto",columnWidths:h};jg.setNodes(e,v,{mode:"highest"})}else{h=ev([],Qg(d),!1);var g=a-f-1;g>0&&h.length>0&&(h[h.length-1]+=g);v={width:"auto",columnWidths:h};jg.setNodes(e,v,{mode:"highest"})}}else{var v={width:"auto"};jg.setNodes(e,v,{mode:"highest"})}}}},e}();function QB(e){var t=e.children||[];return 0===t.length?[]:(t[0]||{}).children||[]}function eT(e){return QB(e).every(function(e){return!!e.isHeader})}var tT=function(){function e(){this.title=QE("tableModule.insertCol"),this.iconSvg='<svg viewBox="0 0 1048 1024"><path d="M327.68 193.3312v186.7776H140.9024v91.7504H327.68v186.7776h88.4736V471.8592h190.0544V380.1088H416.1536V193.3312zM0 917.504V0h1048.576v917.504H0zM655.36 65.536H65.536v720.896H655.36V65.536z m327.68 0h-262.144v196.608h262.144V65.536z m0 262.144h-262.144v196.608h262.144V327.68z m0 262.144h-262.144v196.608h262.144v-196.608z"></path></svg>',this.tag="button"}return e.prototype.getValue=function(e){return""},e.prototype.isActive=function(e){return!1},e.prototype.isDisabled=function(e){var t=e.selection;if(null==t)return!0;if(!fg.isCollapsed(t))return!0;var n=_y.getSelectedNodeByType(e,"table");if(null==n)return!0;try{var r=Qg(Kh.nodes(e,{match:function(e){return _y.checkNodeType(e,"table-cell")},universal:!0}),1),o=r[0];if(!o)return!0;for(var i=Qg(o,2)[1],a=zB(e),s=-1,u=0;u<a.length;u+=1){for(var l=0;l<a[u].length;l+=1){var c=Qg(a[u][l],1),d=Qg(c[0],2)[1];if(og.equals(i,d)){s=l;break}}if(-1!==s)break}if(-1===s)return!0;var f=n.columnWidths,p=(void 0===f?[]:f)[s];if(p&&p<20)return!0}catch(e){return!0}return!1},e.prototype.exec=function(e,t){if(!this.isDisabled(e)){var n=Qg(Kh.nodes(e,{match:function(e){return _y.checkNodeType(e,"table-cell")},universal:!0}),1),r=Qg(n[0],2),o=r[0],i=r[1],a=_y.getParentNode(e,o);if(null!=a){var s=_y.getParentNode(e,a);if(null!=s){for(var u=zB(e),l=0,c=0;c<u.length;c+=1)for(var d=0;d<u[c].length;d+=1){var f=Qg(u[c][d],1),p=Qg(f[0],2)[1];if(og.equals(i,p)){l=d;break}}Kh.withoutNormalizing(e,function(){for(var t=new Set,n=new Set,r=0;r<u.length;r+=1)if(u[r]&&u[r][l]){var o=Qg(u[r][l],2);Qg(o[0],1);var i=o[1],a=i.rtl,c=i.ltr,d=i.ttb,f=i.btt;if(a>1||c>1||d>1||f>1){var p=r-(d-1),h=l-(a-1);if(p<0||p>=u.length||!u[p]||!u[p][h])continue;var g=Qg(u[p][h],1),v=Qg(g[0],2),m=v[0],y=v[1],b=y.join(",");if(t.has(b))n.add(r);else{t.add(b);var E=m.rowSpan,C=void 0===E?1:E,D=m.colSpan,w=(void 0===D?1:D)+1;m.hidden||jg.setNodes(e,{colSpan:w},{at:y});for(var S=0;S<C;S+=1)n.add(p+S)}}}for(r=0;r<u.length;r+=1)if(!n.has(r)&&u[r]&&u[r][l]){var A={type:"table-cell",children:[{text:""}]};0===r&&eT(s)&&(A.isHeader=!0);var x=Qg(u[r][l],1),O=Qg(x[0],2)[1];jg.insertNodes(e,A,{at:O})}var N=Qg(Kh.nodes(e,{match:function(e){return _y.checkNodeType(e,"table")},universal:!0}),1),B=N[0];if(B){var T=Qg(B,2),k=T[0],F=T[1],I=k.columnWidths,P=void 0===I?[]:I,_=ev([],Qg(P),!1),R=e.getMenuConfig("insertTable").minWidth,L=void 0===R?60:R,M=P[l]||parseInt(L,10)||60,j=Math.floor(M/2),H=M-j;_.splice(l,0,j),_[l+1]=H,jg.setNodes(e,{columnWidths:_},{at:F})}})}}}},e}(),nT=function(){function e(){this.title=QE("tableModule.insertRow"),this.iconSvg='<svg viewBox="0 0 1048 1024"><path d="M707.7888 521.0112h-147.456v-147.456H488.2432v147.456h-147.456v68.8128h147.456v147.456h72.0896v-147.456h147.456zM0 917.504V0h1048.576v917.504H0zM327.68 65.536H65.536v196.608H327.68V65.536z m327.68 0H393.216v196.608h262.144V65.536z m327.68 0h-262.144v196.608h262.144V65.536z m0 258.8672H65.536v462.0288H983.04V324.4032z"></path></svg>',this.tag="button"}return e.prototype.getValue=function(e){return""},e.prototype.isActive=function(e){return!1},e.prototype.isDisabled=function(e){var t=e.selection;return null==t||(!fg.isCollapsed(t)||null==_y.getSelectedNodeByType(e,"table"))},e.prototype.exec=function(e,t){var n;if(!this.isDisabled(e)){var r=Qg(Kh.nodes(e,{match:function(e){return _y.checkNodeType(e,"table-cell")},universal:!0}),1),o=Qg(r[0],2)[1],i=zB(e),a=0;e:for(var s=0;s<i.length;s+=1)for(var u=0;u<i[s].length;u+=1){var l=Qg(i[s][u],1),c=Qg(l[0],2)[1];if(og.equals(o,c)){a=s;break e}}var d=(null===(n=i[a])||void 0===n?void 0:n.length)||0;0!==d&&Kh.withoutNormalizing(e,function(){for(var t=a+1,n=t>=0&&t<i.length,r=[],s=0;n&&s<i[a].length;s+=1){var u=Qg(i[a][s],2)[1],l=u.ttb,c=u.btt;if(l>1||c>1){var f=a-(l-1);if(f<0||f>=i.length||!i[f]||!i[f][s])continue;var p=Qg(i[f][s],1),h=Qg(p[0],2),g=h[0],v=h[1],m=g.rowSpan||1;r.push(s),g.hidden||jg.setNodes(e,{rowSpan:m+1},{at:v})}}for(var y=(e.getMenuConfig("insertTable")||{}).minRowHeight,b={type:"table-row",children:[],height:parseInt((void 0===y?30:y).toString(),10)||30},E=0;E<d;E+=1)if(!r.includes(E)){b.children.push({type:"table-cell",children:[{text:""}]})}var C=og.parent(o),D=og.next(C);jg.insertNodes(e,b,{at:D})})}},e}();var rT=function(){function e(){this.title=QE("tableModule.insertTable"),this.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M0 64v896h1024V64H0z m384 576v-192h256v192h-256z m256 64v192h-256v-192h256z m0-512v192h-256V192h256zM320 192v192H64V192h256z m-256 256h256v192H64v-192z m640 0h256v192h-256v-192z m0-64V192h256v192h-256zM64 704h256v192H64v-192z m640 192v-192h256v192h-256z"></path></svg>',this.tag="button",this.showDropPanel=!0,this.$content=null}return e.prototype.getValue=function(e){return""},e.prototype.isActive=function(e){return!1},e.prototype.exec=function(e,t){},e.prototype.isDisabled=function(e){var t=e.selection;return null==t||(!fg.isCollapsed(t)||!!_y.getSelectedElems(e).some(function(t){var n=_y.getNodeType(t);return"pre"===n||("table"===n||("list-item"===n||!!e.isVoid(t)))}))},e.prototype.getPanelContentElem=function(e){var t=this;if(this.$content)return this.$content[0];for(var n=am('<div class="w-e-panel-content-table"></div>'),r=am("<span>0 × 0</span>"),o=am("<table></table>"),i=0;i<10;i+=1){for(var a=am("<tr></tr>"),s=0;s<10;s+=1){var u=am("<td></td>");u.attr("data-x",s.toString()),u.attr("data-y",i.toString()),a.append(u),u.on("mouseenter",function(e){var t=e.target;if(null!=t){var n=am(t).dataset(),i=n.x,a=n.y;r[0].innerHTML="".concat(i+1," × ").concat(a+1),o.children().each(function(e){am(e).children().each(function(e){var t=am(e),n=t.dataset(),r=n.x,o=n.y;r<=i&&o<=a?t.addClass("active"):t.removeClass("active")})})}}),u.on("click",function(n){n.preventDefault();var r=n.target;if(null!=r){var o=am(r).dataset(),i=o.x,a=o.y;t.insertTable(e,a+1,i+1)}})}o.append(a)}return n.append(o),n.append(r),this.$content=n,n[0]},e.prototype.insertTable=function(e,t,n){var r=parseInt(t,10),o=parseInt(n,10);if(r&&o&&!(r<=0||o<=0)){if(_y.isSelectedEmptyParagraph(e)&&jg.removeNodes(e,{mode:"highest"}),0===e.children.length){jg.insertNodes(e,{type:"paragraph",children:[{text:""}]},{mode:"highest"})}var i=function(e,t,n){for(var r,o=[],i=e.getMenuConfig("insertTable"),a=i.minWidth,s=void 0===a?60:a,u=i.minRowHeight,l=void 0===u?30:u,c=i.tableFullWidth,d=i.tableHeader,f=Array(n).fill(parseInt(s,10)||60),p=0;p<t;p+=1){for(var h=[],g=0;g<n;g+=1){var v={type:"table-cell",children:[{text:""}]};0===p&&(v.isHeader=null===(r=null==d?void 0:d.selected)||void 0===r||r),h.push(v)}o.push({type:"table-row",children:h,height:parseInt(l,10)||30})}return{type:"table",width:(null==c?void 0:c.selected)?"100%":"auto",children:o,columnWidths:f}}(e,r,o);jg.insertNodes(e,i,{mode:"highest"})}},e}(),oT={isInTable:function(e,t){return void 0===t&&(t={}),!!Qg(Kh.nodes(e,{match:jB(e,"table"),at:t.at}),1)[0]},selection:function(e){var t,n,r,o,i,a,s,u;return Zg(this,function(l){switch(l.label){case 0:t=WB.get(e),n=0,l.label=1;case 1:if(!(t&&n<t.length))return[3,4];for(r=[],o=0;o<t[n].length;o+=1)i=Qg(t[n][o],2),a=i[0],s=i[1],u=s.ltr,1===s.ttb&&r.push(a),o+=u-1;return[4,r];case 2:l.sent(),l.label=3;case 3:return n+=1,[3,1];case 4:return[2]}})},unselect:function(e){GB.delete(e),WB.delete(e)},isSelected:function(e,t){var n=GB.get(e);return!!n&&n.has(t)}},iT=function(){function e(){this.title=QE("tableModule.mergeCell"),this.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M482.2 508.4 331.3 389c-3-2.4-7.3-.2-7.3 3.6V478H184V184h204v128c0 2.2 1.8 4 4 4h60c2.2 0 4-1.8 4-4V144c0-15.5-12.5-28-28-28H144c-15.5 0-28 12.5-28 28v736c0 15.5 12.5 28 28 28h284c15.5 0 28-12.5 28-28V712c0-2.2-1.8-4-4-4h-60c-2.2 0-4 1.8-4 4v128H184V546h140v85.4c0 3.8 4.4 6 7.3 3.6l150.9-119.4c2.4-1.8 2.4-5.4 0-7.2zM880 116H596c-15.5 0-28 12.5-28 28v168c0 2.2 1.8 4 4 4h60c2.2 0 4-1.8 4-4V184h204v294H700v-85.4c0-3.8-4.3-6-7.3-3.6l-151 119.4c-2.3 1.8-2.3 5.3 0 7.1l151 119.5c2.9 2.3 7.3.2 7.3-3.6V546h140v294H636V712c0-2.2-1.8-4-4-4h-60c-2.2 0-4 1.8-4 4v168c0 15.5 12.5 28 28 28h284c15.5 0 28-12.5 28-28V144c0-15.5-12.5-28-28-28z"/></svg>',this.tag="button"}return e.prototype.getValue=function(e){return""},e.prototype.isActive=function(e){return!1},e.prototype.isDisabled=function(e){return!this.canMerge(e)},e.prototype.exec=function(e,t){this.isDisabled(e)||(this.merge(e),oT.unselect(e))},e.prototype.canMerge=function(e){var t=WB.get(e);if(!t||!t.length)return!1;var n=Qg(t[t.length-1][t[t.length-1].length-1],1),r=Qg(n[0],2)[1],o=Qg(t[0][0],1);return!!HB(e,[Qg(o[0],2)[1],r],"table")},e.prototype.merge=function(e){if(this.canMerge(e)){var t=WB.get(e);if(t&&t.length){var n=Qg(t[0][0],1),r=Qg(n[0],2)[1],o=Qg(eg.children(e,r,{reverse:!0}),1),i=Qg(o[0],2)[1];Kh.withoutNormalizing(e,function(){for(var n,o,a,s,u,l,c=new Map,d=[],f=1/0,p=-1/0,h=1/0,g=-1/0,v=0;v<t.length;v+=1)for(var m=0;m<t[v].length;m+=1){var y=Qg(t[v][m],2),b=Qg(y[0],2),E=b[0],C=b[1],D=y[1].ttb,w=C.join(",");if(1===D&&!c.has(w)){c.set(w,{path:C,x:v,y:m,element:E});var S=E.rowSpan,A=void 0===S?1:S,x=E.colSpan,O=v,N=v+A-1,B=m,T=m+(void 0===x?1:x)-1;f=Math.min(f,O),p=Math.max(p,N),h=Math.min(h,B),g=Math.max(g,T)}}var k=p-f+1,F=g-h+1;try{for(var I=Jg(c),P=I.next();!P.done;P=I.next()){C=Qg(P.value,2)[1].path;og.equals(r,C)||d.push(C)}}catch(e){n={error:e}}finally{try{P&&!P.done&&(o=I.return)&&o.call(I)}finally{if(n)throw n.error}}d.sort(function(e,t){for(var n=0;n<Math.min(e.length,t.length);n+=1)if(e[n]!==t[n])return t[n]-e[n];return t.length-e.length});try{for(var _=Jg(d),R=_.next();!R.done;R=_.next()){C=R.value;try{if(!Kh.hasPath(e,C))continue;try{for(var L=(u=void 0,Jg(eg.children(e,C,{reverse:!0}))),M=L.next();!M.done;M=L.next()){var j=Qg(M.value,2)[1];jg.moveNodes(e,{to:og.next(i),at:j})}}catch(e){u={error:e}}finally{try{M&&!M.done&&(l=L.return)&&l.call(L)}finally{if(u)throw u.error}}jg.removeNodes(e,{at:C})}catch(e){}}}catch(e){a={error:e}}finally{try{R&&!R.done&&(s=_.return)&&s.call(_)}finally{if(a)throw a.error}}jg.setNodes(e,{rowSpan:k,colSpan:F},{at:r})})}}},e}(),aT=function(){function e(){this.title=QE("tableModule.splitCell"),this.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M362.667 494.933v53.334l25.6-25.6zm0-241.066L460.8 352V78.933H57.6v98.134h305.067zm0 535.466v57.6H57.6v98.134h403.2V691.2zM661.333 494.933v53.334l-25.6-25.6zm0-241.066L563.2 352V78.933h403.2v98.134H661.333zm0 535.466v57.6H966.4v98.134H563.2V691.2z"/><path d="M753.067 341.333 693.333 281.6 512 460.8 330.667 281.6l-59.734 59.733 181.334 181.334L270.933 704l59.734 59.733L512 582.4l181.333 181.333L753.067 704 571.733 522.667z"/></svg>',this.tag="button"}return e.prototype.getValue=function(e){return""},e.prototype.isActive=function(e){return!1},e.prototype.isDisabled=function(e){var t=Qg(Kh.nodes(e,{match:function(e){return _y.checkNodeType(e,"table-cell")}}),1),n=t[0];if(!n)return!0;var r=Qg(n,1)[0],o=r.rowSpan,i=void 0===o?1:o,a=r.colSpan;return!(i>1||(void 0===a?1:a)>1)},e.prototype.exec=function(e,t){this.isDisabled(e)||this.split(e)},e.prototype.split=function(e,t){void 0===t&&(t={});var n=Qg(Kh.nodes(e,{match:jB(e,"table","th","td"),at:t.at}),2),r=n[0],o=n[1];if(r&&o){var i=eT(Qg(r,1)[0]),a=Qg(o,2),s=a[0],u=a[1],l=s.rowSpan,c=void 0===l?1:l,d=s.colSpan,f=void 0===d?1:d;1===c&&1===f||Kh.withoutNormalizing(e,function(){jg.setNodes(e,{rowSpan:1,colSpan:1},{at:u});for(var t=1;t<f;t+=1){var n={type:"table-cell",children:[{text:""}]};0===u[u.length-2]&&i&&(n.isHeader=!0);var r=u.slice(0,-1),o=u[u.length-1]+t,a=ev(ev([],Qg(r),!1),[o],!1);try{jg.insertNodes(e,n,{at:a})}catch(t){try{var s=Qg(Kh.node(e,r),1)[0].children.length,l=ev(ev([],Qg(r),!1),[s],!1);jg.insertNodes(e,n,{at:l})}catch(e){console.warn("插入同行单元格失败: ".concat(e instanceof Error?e.message:String(e)))}}}for(var d=1;d<c;d+=1){var p=u[u.length-2]+d,h=ev(ev([],Qg(u.slice(0,-2)),!1),[p],!1);try{var g=Qg(Kh.node(e,h),1)[0];if(!g){console.warn("目标行 ".concat(p," 不存在"));continue}for(t=0;t<f;t+=1){n={type:"table-cell",children:[{text:""}]},o=u[u.length-1]+t,a=ev(ev([],Qg(h),!1),[o],!1);try{var v=g.children.length;if(o>=v){var m=ev(ev([],Qg(h),!1),[v],!1);jg.insertNodes(e,n,{at:m})}else jg.insertNodes(e,n,{at:a})}catch(t){try{var y=g.children.length;l=ev(ev([],Qg(h),!1),[y],!1);jg.insertNodes(e,n,{at:l})}catch(e){console.warn("插入单元格到第".concat(d,"行失败: ").concat(e instanceof Error?e.message:String(e)))}}}}catch(e){console.warn("处理第".concat(d,"行时出错: ").concat(e instanceof Error?e.message:String(e)))}}})}},e}(),sT=function(){function e(){this.title=QE("tableModule.header"),this.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M704 128l-64 0L384 128 320 128 0 128l0 256 0 64 0 192 0 64 0 256 320 0 64 0 256 0 64 0 320 0 0-256 0-64L1024 448 1024 384 1024 128 704 128zM640 640 384 640 384 448l256 0L640 640zM64 448l256 0 0 192L64 640 64 448zM320 896 64 896l0-192 256 0L320 896zM640 896 384 896l0-192 256 0L640 896zM960 896l-256 0 0-192 256 0L960 896zM960 640l-256 0L704 448l256 0L960 640z"></path></svg>',this.tag="button"}return e.prototype.getValue=function(e){var t=_y.getSelectedNodeByType(e,"table");return null!=t&&eT(t)},e.prototype.isActive=function(e){return!!this.getValue(e)},e.prototype.isDisabled=function(e){var t=e.selection;return null==t||(!fg.isCollapsed(t)||null==_y.getSelectedNodeByType(e,"table"))},e.prototype.exec=function(e,t){if(!this.isDisabled(e)){var n=!t,r=_y.getSelectedNodeByType(e,"table");if(null!=r)QB(r).forEach(function(t){return jg.setNodes(e,{isHeader:n},{at:_y.findPath(e,t)})})}},e}(),uT={key:"insertTable",factory:function(){return new rT}},lT={key:"deleteTable",factory:function(){return new ZB}},cT={key:"insertTableRow",factory:function(){return new nT}},dT={key:"deleteTableRow",factory:function(){return new XB}},fT={key:"insertTableCol",factory:function(){return new tT}},pT={key:"deleteTableCol",factory:function(){return new YB}},hT={key:"tableHeader",factory:function(){return new sT}},gT={key:"tableFullWidth",factory:function(){return new JB}},vT={key:"mergeTableCell",factory:function(){return new iT}},mT={key:"splitTableCell",factory:function(){return new aT}},yT={key:"setTableProperty",factory:function(){return new qB}},bT={key:"setTableCellProperty",factory:function(){return new KB}};var ET={selector:"td:not([data-w-e-type]),th:not([data-w-e-type])",parseElemHtml:function(e,t,n){var r=am(e);0===(t=t.filter(function(e){return"paragraph"===_y.getNodeType(e)||(!!Cg.isText(e)||!!n.isInline(e))})).length&&(t=[{text:r.text().replace(/\s+/gm," ")}]);var o=parseInt(r.attr("colSpan")||"1",10),i=parseInt(r.attr("rowSpan")||"1",10),a="none"===VB(r,"display"),s=r.attr("width")||"auto";return{type:"table-cell",isHeader:"th"===UB(r),colSpan:o,rowSpan:i,width:s,children:t,hidden:a}}};var CT={selector:"tr:not([data-w-e-type])",parseElemHtml:function(e,t,n){for(var r=am(e),o=[],i=0;i<t.length;i+=1){var a=t[i];if("table-cell"===_y.getNodeType(a)){var s=a;if(s.hidden)continue;o.push(s)}}return{type:"table-row",height:parseInt(VB(r,"height")||"0",10)||void 0,children:o}}};var DT,wT={selector:"table:not([data-w-e-type])",parseElemHtml:function(e,t,n){var r,o,i=am(e),a="auto";"100%"===VB(i,"width")&&(a="100%"),"100%"===i.attr("width")&&(a="100%");var s={type:"table",width:a,height:parseInt(VB(i,"height")||"0",10),children:t.filter(function(e){return"table-row"===_y.getNodeType(e)})},u=(null===(r=i.find("tr")[0])||void 0===r?void 0:r.children)||[],l=(null===(o=i.find("colgroup")[0])||void 0===o?void 0:o.children)||null,c=t[t.length-1].children.length;if(l&&l.length===c)s.columnWidths=Array.from(l).map(function(e){return parseInt(e.getAttribute("width"),10)});else if(u.length>0){var d=[];Array.from(u).forEach(function(e){var t=parseInt(am(e).attr("colSpan")||"1",10),n=parseInt(VB(am(e),"width")||"90",10);d.push(n);for(var r=1;r<t;r+=1)d.push(90)}),s.columnWidths=d}return s}},ST=null===(DT=null===window||void 0===window?void 0:window.getComputedStyle(document.documentElement))||void 0===DT?void 0:DT.getPropertyValue("--w-e-textarea-border-color");function AT(e){var t=e.selection;if(null==t)return!1;var n=Qg(Kh.nodes(e,{match:function(e){return _y.checkNodeType(e,"table-cell")}}),1),r=n[0];if(r){var o=Qg(r,2)[1],i=Kh.start(e,o);if(ug.equals(t.anchor,i))return!0}return!1}function xT(e,t){var n=t.offset;if(0===n)return!1;var r=Kh.node(e,t);if(!Cg.isText(r[0]))return!1;var o=eg.string(r[0]);return!(n>=o.length)&&("\n"===o[n-1]&&"\r"===o[n])}function OT(e,t,n){var r=e.selection;if(null==r||"line"===t)return!1;var o=Qg(Kh.nodes(e,{match:function(e){return _y.checkNodeType(e,"table-cell")}}),1),i=o[0],a=r.anchor;if("backward"===n&&0===r.anchor.offset&&(a=Kh.before(e,r)),"forward"===n&&Kh.isEnd(e,r.anchor,r.anchor.path)&&(a=Kh.after(e,r)),null==a)return!1;var s=Kh.above(e,{at:a,match:function(e){return _y.checkNodeType(e,"table-cell")}});if(null==s||null==i||!og.equals(s[1],i[1]))return!1;var u=Kh.node(e,a);if(!Cg.isText(u[0])||u[0].text.length<2)return!1;var l="backward"===n?[a.offset-2,a.offset]:[a.offset,a.offset+2],c=eg.string(u[0]);return"\n\r"===c.slice.apply(c,ev([],Qg(l),!1))?(jg.insertText(e,c.slice(0,l[0])+c.slice(l[1]),{at:{anchor:Kh.start(e,a.path),focus:Kh.end(e,a.path)}}),!0):!!xT(e,a)&&(jg.insertText(e,c.slice(0,r.anchor.offset-1)+c.slice(r.anchor.offset+1),{at:{anchor:Kh.start(e,a.path),focus:Kh.end(e,a.path)}}),!0)}function NT(e,t){var n=Kh.nodes(e,{at:t,match:function(e){return"table"===_y.getNodeType(e)}});return!!ev([],Qg(n),!1).find(function(){return!0})}function BT(e){var t,n;try{for(var r=Jg(["paragraph","header1","header2","header3","header4","header5","header6","blockquote","list-item","todo","divider"]),o=r.next();!o.done;o=r.next()){var i=o.value;if(_y.getSelectedNodeByType(e,i))return!0}}catch(e){t={error:e}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}return!1}var TT={selector:"table",preParseHtml:function(e){var t=am(e);if("table"!==UB(t))return e;var n=t.find("tbody");if(0===n.length)return e;var r=t.find("tr");t.append(r),n.remove();for(var o=t.find("td, th"),i=0;i<o.length;i+=1){var a=(u=am(o[i])).attr("style");if(a){/display\s*:\s*none/i.test(a)&&u.remove()}u.attr("width","auto")}var s=t.find("td, th");for(i=0;i<s.length;i+=1){var u,l=(u=am(s[i])).html()||"";l=(l=(l=l.replace(/<o:p[^>]*>[\s\S]*?<\/o:p>/gi,"")).replace(/<\/o:p>/gi,"")).replace(/<p[^>]*>([\s\S]*?)<\/p>/gi,function(e,t){var n=t.trim();return n&&" "!==n?t:""}),u.html(l)}return t[0]}};function kT(e){var t,n,r=[],o=0;try{for(var i=Jg(e),a=i.next();!a.done;a=i.next()){o+=a.value,r.push(o)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return r}function FT(e){var t,n,r=[],o=e.reduce(function(e,t){return e+t},0);try{for(var i=Jg(e),a=i.next();!a.done;a=i.next()){var s=a.value;r.push(s/o)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return r}var IT=null;var PT=!1,_T=!1,RT=0,LT=null,MT=am(window);MT.on("mousedown",function(e){var t=e.target;if(t.closest('[data-block-type="table-cell"]'))PT=!0;else if("DIV"===t.tagName&&t.closest(".column-resizer-item")){if(null===LT)return;_T=!0;var n=e.clientX;RT=n,document.body.style.cursor="col-resize",e.preventDefault()}MT.on("mousemove",jT),MT.on("mouseup",HT)});var jT=AC(function(e){if(_T&&null!==LT){e.preventDefault();var t,n=e.clientX,r=n-RT,o=Qg(Kh.nodes(LT,{match:jB(LT,"table")}),1),i=Qg(o[0],1)[0],a=i.columnWidths,s=void 0===a?[]:a,u=i.resizingIndex,l=void 0===u?-1:u,c=_y.getSelectedNodeByType(LT,"table"),d=_y.toDOMNode(LT,c).querySelector(".table");if(d)t=function(e,t,n,r,o){var i=ev([],Qg(e),!1);if(t<0||t>=e.length)return i;var a=o.getMenuConfig("insertTable").minWidth,s=parseInt((void 0===a?60:a).toString(),10)||60,u=n-(0===t?0:r[t-1]),l=Math.max(s,u);return i[t]=Math.floor(100*l)/100,i}(s,l,n-d.getBoundingClientRect().left,kT(s),LT);else t=function(e,t,n,r){var o=ev([],Qg(e),!1),i=r.getMenuConfig("insertTable").minWidth,a=parseInt((void 0===i?60:i).toString(),10)||60,s=o[t],u=Math.max(a,s+n);return o[t]=Math.floor(100*u)/100,o}(s,l,r,LT);jg.setNodes(LT,{columnWidths:t},{mode:"highest"})}},100);function HT(e){PT=!1,_T=!1,LT=null,document.body.style.cursor="",MT.off("mousemove",jT),MT.off("mouseup",HT)}function zT(e,t){"mouseenter"===t.type?jg.setNodes(e,{isResizing:!0},{mode:"highest"}):jg.setNodes(e,{isResizing:!1},{mode:"highest"})}function $T(e){var t,n,r=[],o=0;try{for(var i=Jg(e),a=i.next();!a.done;a=i.next()){o+=a.value,r.push(o)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return r}var UT=!1,VT=0,WT=null,GT=am(window);var qT=AC(function(e){if(UT&&null!==WT){e.preventDefault();var t,n=e.clientY,r=n-VT,o=Qg(Kh.nodes(WT,{match:jB(WT,"table")}),1),i=Qg(o[0],1)[0],a=i.children,s=i.resizingRowIndex,u=void 0===s?-1:s,l=a.map(function(e){return e.height||30}),c=_y.getSelectedNodeByType(WT,"table"),d=_y.toDOMNode(WT,c).querySelector(".table");if(d)t=function(e,t,n,r,o){var i=ev([],Qg(e),!1);if(t<0||t>=e.length)return i;var a=(o.getMenuConfig("insertTable")||{}).minRowHeight,s=parseInt((void 0===a?30:a).toString(),10)||30,u=n-(0===t?0:r[t-1]),l=Math.max(s,u);return i[t]=Math.floor(100*l)/100,i}(l,u,n-d.getBoundingClientRect().top,$T(l),WT);else t=function(e,t,n,r){var o=ev([],Qg(e),!1),i=(r.getMenuConfig("insertTable")||{}).minRowHeight,a=parseInt((void 0===i?30:i).toString(),10)||30,s=o[t],u=Math.max(a,s+n);return o[t]=Math.floor(100*u)/100,o}(l,u,r,WT);var f=_y.getSelectedNodeByType(WT,"table");if(f&&u>=0&&u<t.length){var p=ev(ev([],Qg(_y.findPath(WT,f)),!1),[u],!1);try{jg.setNodes(WT,{height:t[u]},{at:p})}catch(e){console.warn("更新行高度失败:",e)}}}},100);function KT(e){UT=!1,WT=null,document.body.style.cursor="",GT.off("mousemove",qT),GT.off("mouseup",KT)}function YT(e,t){"mouseenter"===t.type?jg.setNodes(e,{isResizingRow:!0},{mode:"highest"}):jg.setNodes(e,{isResizingRow:!1},{mode:"highest"})}GT.on("mousedown",function(e){var t=e.target;if("DIV"===t.tagName&&t.closest(".row-resizer-item")){if(null===WT)return;UT=!0;var n=e.clientY;VT=n,document.body.style.cursor="row-resize",e.preventDefault()}GT.on("mousemove",qT),GT.on("mouseup",KT)});var XT={type:"table",renderElem:function(e,t,n){var r=function(e,t){if(e.isDisabled())return!1;var n=e.selection;if(null==n)return!0;if(fg.isCollapsed(n))return!0;var r=n.anchor,o=n.focus,i=_y.findPath(e,t),a=Kh.start(e,i),s=Kh.end(e,i),u=ug.compare(r,s)<=0&&ug.compare(r,a)>=0,l=ug.compare(o,s)<=0&&ug.compare(o,a)>=0;return!!(u&&l&&og.equals(r.path.slice(0,3),o.path.slice(0,3)))}(n,e),o=e,i=o.width,a=void 0===i?"auto":i,s=o.height,u=o.columnWidths,l=void 0===u?[]:u,c=o.scrollWidth,d=void 0===c?0:c,f=o.isHoverCellBorder,p=o.resizingIndex,h=o.isResizing,g=o.isHoverRowBorder,v=o.resizingRowIndex,m=o.isResizingRow,y=_y.isNodeSelected(n,e),b=Qg(oT.selection(n),1)[0],E=FT(l),C=ND("div",{className:"table-container","data-selected":y,on:{mousedown:function(t){if("DIV"===t.target.tagName&&t.preventDefault(),!n.isDisabled()){t.target.closest('[data-block-type="table-cell"]')&&oT.unselect(n);var r=_y.findPath(n,e),o=Kh.start(n,r),i=n.selection;if(null!=i)i.anchor.path[0]!==r[0]&&"DIV"===t.target.tagName&&n.select(o);else n.select(o)}}}},ND("table",{width:a,contentEditable:r,className:"table ".concat(b?"table-selection-none":""),style:{width:"100%"===a?a:"".concat(l.reduce(function(e,t){return e+t},0),"px")},on:{mousemove:rE(function(t){!function(e,t,n,r){if(!e.isDisabled()&&!PT&&!_T){var o=t,i=o.width,a=void 0===i?"auto":i,s=o.columnWidths,u=void 0===s?[]:s,l=o.isHoverCellBorder,c=o.resizingIndex,d=n.clientX,f=n.target;if(Gm(f)&&d>(g=f.getBoundingClientRect()).x+5&&d<g.x+g.width-5)return void(l&&jg.setNodes(e,{isHoverCellBorder:!1,resizingIndex:-1},{mode:"highest"}));if(Gm(f)){var p=f.closest(".table");if(p)for(var h=n.clientX,g=p.getBoundingClientRect(),v="100%"===a?FT(u).map(function(e){return e*r}):u,m=kT(v),y=0;y<m.length;y+=1)if(h-g.x>=m[y]-5&&h-g.x<m[y]+5){if(c===y)return;return void jg.setNodes(e,{isHoverCellBorder:!0,resizingIndex:y},{mode:"highest"})}}!0===l&&jg.setNodes(e,{isHoverCellBorder:!1,resizingIndex:-1},{mode:"highest"})}}(n,e,t,d),function(e,t,n){if(!e.isDisabled()&&!UT){var r=t,o=r.children,i=r.isHoverRowBorder,a=r.resizingRowIndex,s=n.target;if(Gm(s)){var u=s.closest(".table");if(u)for(var l=n.clientY,c=u.getBoundingClientRect(),d=$T(o.map(function(e){return e.height||30})),f=0;f<d.length;f+=1)if(l-c.y>=d[f]-5&&l-c.y<d[f]+5){if(a===f)return;return void jg.setNodes(e,{isHoverRowBorder:!0,resizingRowIndex:f},{mode:"highest"})}}!0===i&&jg.setNodes(e,{isHoverRowBorder:!1,resizingRowIndex:-1},{mode:"highest"})}}(n,e,t)},25)}},ND("colgroup",{contentEditable:!1},l.map(function(e){return ND("col",{width:e})})),ND("tbody",null,t)),ND("div",{className:"column-resizer",contentEditable:!1},l.map(function(e,t){var r=e;return"100%"===a&&(r=E[t]*d),ND("div",{className:"column-resizer-item",style:{minWidth:"".concat(r,"px")}},ND("div",{className:"resizer-line-hotzone ".concat(f&&t===p?"visible ":"").concat(h&&t===p?"highlight":""),style:{height:"".concat(s,"px")},on:{mouseenter:function(e){return zT(n,e)},mouseleave:function(e){return zT(n,e)},mousedown:function(e){return function(e){_T||(LT=e)}(n)}}},ND("div",{className:"resizer-line"})))})),ND("div",{className:"row-resizer",contentEditable:!1},e.children.map(function(e,t){var r=l.reduce(function(e,t){return e+t},0),o=e.height||30;return ND("div",{className:"row-resizer-item",style:{minHeight:"".concat(o,"px")}},ND("div",{className:"resizer-line-hotzone-horizontal ".concat(g&&t===v?"visible ":"").concat(m&&t===v?"highlight":""),style:{width:"".concat(r,"px")},on:{mouseenter:function(e){return YT(n,e)},mouseleave:function(e){return YT(n,e)},mousedown:function(e){return function(e){UT||(WT=e)}(n)}}},ND("div",{className:"resizer-line-horizontal"})))}))),D=uD("div",{hook:{insert:function(e){var t=e.elm;return function(e,t){if(Gm(t)){var n=t.querySelector("table");n&&(IT=new ResizeObserver(function(t){var n=Qg(t,1)[0].contentRect;jg.setNodes(e,{scrollWidth:n.width,height:n.height},{mode:"highest"})}),IT.observe(n))}}(n,t)},destroy:function(){IT&&(null==IT||IT.disconnect(),IT=null)}}},C);return D}},ZT={type:"table-row",renderElem:function(e,t,n){var r=e.height;return ND("tr",{style:r?{height:"".concat(r,"px")}:{}},t)}},JT={type:"table-cell",renderElem:function(e,t,n){var r=function(e,t){var n=_y.getParentNode(e,t);if(null==n)return!1;var r=_y.getParentNode(e,n);return null!=r&&QB(r).some(function(e){return e===t})}(n,e),o=e,i=o.colSpan,a=void 0===i?1:i,s=o.rowSpan,u=void 0===s?1:s,l=o.isHeader,c=void 0!==l&&l,d=o.hidden,f=void 0!==d&&d,p=oT.isSelected(n,e);return ND(r&&c?"th":"td",{colSpan:a,rowSpan:u,"data-block-type":"table-cell",className:p?"w-e-selected":"",style:{display:f?"none":""}},t)}};function QT(e,t){null==e.data&&(e.data={});var n=e.data;null==n.style&&(n.style={}),Object.assign(n.style,t)}var ek={renderStyle:function(e,t){var n,r;if(!$h.isElement(e))return t;var o=e,i=o.backgroundColor,a=o.borderWidth,s=o.borderStyle,u=o.borderColor,l=o.textAlign,c={};i&&(c.backgroundColor=i),a&&(c.borderWidth="".concat(a,"px")),s&&(c.borderStyle="none"===s?"":s),u&&(c.borderColor=u),l&&(c.textAlign=l);var d=t;return"table"===e.type?QT(null===(r=(null===(n=d.children)||void 0===n?void 0:n[0]).children)||void 0===r?void 0:r[0],c):QT(d,c),d},styleToHtml:function(e,t){if("table"!==e.type&&"table-cell"!==e.type)return t;var n=e.backgroundColor,r=e.borderWidth,o=e.borderStyle,i=e.borderColor,a=e.textAlign;if(!(n||r||o||i||a))return t;var s=am(t);return n&&s.css("background-color",n),r&&s.css("border-width","".concat(r,"px")),o&&s.css("border-style","none"===o?"":o),i&&s.css("border-color",i),a&&s.css("text-align",a),function(e){return 0===e.length?"":e[0].outerHTML}(s)},parseStyleHtml:function(e,t,n){if(!["TABLE","TD","TH"].includes(e.tagName))return t;var r=am(e),o=t,i=VB(r,"background-color");i||(i=VB(r,"background")),i&&(o.backgroundColor=i);var a=VB(r,"border");a||"TD"!==e.tagName||(a="1px solid ".concat(ST));var s=Qg((null==a?void 0:a.split(" "))||[],3),u=s[0],l=s[1],c=s[2];(u=VB(r,"border-width")||u)&&(o.borderWidth=u.replace(/[^\d]/g,"")),(l=VB(r,"border-style")||l)&&(o.borderStyle="none"===l?"":l),(c=VB(r,"border-color")||c)&&(o.borderColor=c);var d=VB(r,"text-align");return(d=VB(r,"text-align")||d)&&(o.textAlign=d),t},renderElems:[XT,ZT,JT],elemsToHtml:[PB,_B,RB],preParseHtml:[TT],parseElemsHtml:[ET,CT,wT],menus:[uT,lT,cT,dT,fT,pT,hT,gT,vT,mT,yT,bT],editorPlugin:function(e){var t=e.insertBreak,n=e.deleteBackward,r=e.deleteForward,o=e.deleteFragment,i=e.normalizeNode,a=e.insertData,s=e.handleTab,u=e.selectAll,l=e;l.insertBreak=function(){null==_y.getSelectedNodeByType(l,"table")?t():l.insertText("\n\r")},l.deleteBackward=function(e){if(!AT(l)&&!OT(l,e,"backward")){var t=l.selection;if(t){var r=Kh.before(l,t),o=Kh.above(l,{at:t,match:function(e){return _y.checkNodeType(e,"table-cell")}});if(r){var i=NT(l,r);if(!o&&i&&BT(l))return}}n(e)}},l.handleTab=function(){var t;if(_y.getSelectedNodeByType(l,"table")){var n=Kh.above(e);_y.checkNodeType(n[0],"table-cell")&&jg.select(e,n[1]);var r=Kh.next(e);if(r)r[0]&&r[0].text&&(r=null!==(t=Kh.above(e,{at:r[1]}))&&void 0!==t?t:r),jg.select(e,r[1]);else{var o=l.children||[],i=o.length;if(_y.checkNodeType(o[i-1],"table")){var a=_y.genEmptyParagraph();jg.insertNodes(l,a,{at:[i]}),l.handleTab()}}}else s()},l.deleteForward=function(e){if(!AT(l)&&!OT(l,e,"forward")){var t=l.selection;if(t){var n=Kh.after(l,t),o=Kh.above(l,{at:t,match:function(e){return _y.checkNodeType(e,"table-cell")}});if(n){var i=NT(l,n);if(!o&&i&&BT(l))return}}r(e)}},l.deleteFragment=function(e){var t=l.selection;if(t){var n,r=!1,i={anchor:t.anchor,focus:t.focus},a=ug.isBefore(i.anchor,i.focus);if(xT(l,t.anchor))(n=Kh[a?"before":"after"](l,t.anchor))&&(i.anchor=n),r=!0;if(xT(l,t.focus))(n=Kh[a?"after":"before"](l,t.focus))&&(i.focus=n),r=!0;r&&jg.setSelection(l,i),o(e)}},l.normalizeNode=function(e){var t=Qg(e,2),n=t[0],r=t[1];if("table"!==_y.getNodeType(n))return i([n,r]);if(_y.isLastNode(l,n)){var o=_y.genEmptyParagraph();jg.insertNodes(l,o,{at:[r[0]+1]})}},l.insertData=function(e){if(null!=_y.getSelectedNodeByType(l,"table")){var t=e.getData("text/plain");"\n"===t||/<img[^>]+>/.test(e.getData("text/html"))?a(e):Kh.insertText(l,t)}else a(e)},l.selectAll=function(){var e=l.selection;if(null!=e){var t=_y.getSelectedNodeByType(l,"table-cell");if(null!=t){var n=e.anchor,r=e.focus;if(og.equals(n.path.slice(0,3),r.path.slice(0,3)))if(0!==eg.string(t).length){var o=_y.findPath(l,t),i={anchor:Kh.start(l,o),focus:Kh.end(l,o)};l.select(i)}else u();else u()}else u()}else u()},function(e){var t=e.apply;e.apply=function(n){if(!rg.isSelectionOperation(n)||!n.newProperties)return t(n);var r=Yg(Yg({},e.selection),n.newProperties);if(!fg.isRange(r))return oT.unselect(e),t(n);var o=function(e){return $h.isElement(e)&&("table-cell"===e.type||"th"===e.type||"td"===e.type)},i=Qg(Kh.nodes(e,{match:o,at:fg.start(r),mode:"lowest"}),1)[0],a=Qg(Kh.nodes(e,{match:o,at:fg.end(r),mode:"lowest"}),1)[0];if(!i||!a)return oT.unselect(e),t(n);var s=Qg(i,2)[1],u=Qg(a,2)[1];if(og.equals(s,u)||!HB(e,[s,u],"table"))return oT.unselect(e),t(n);try{var l=zB(e,{at:s});if(!l||0===l.length)return oT.unselect(e),t(n);for(var c=$B.valueOf(0,0),d=$B.valueOf(0,0),f=!1,p=!1,h=0;h<l.length;h+=1)if(l[h])for(var g=0;g<l[h].length;g+=1)if(l[h][g]){var v=Qg(l[h][g],1),m=Qg(v[0],2)[1];og.equals(s,m)&&(c.x=h,c.y=g,f=!0),og.equals(u,m)&&(d.x=h,d.y=g,p=!0)}if(!f||!p)return oT.unselect(e),t(n);for(var y=$B.valueOf(Math.min(c.x,d.x),Math.min(c.y,d.y)),b=$B.valueOf(Math.max(c.x,d.x),Math.max(c.y,d.y));;){var E=$B.valueOf(y.x,y.y),C=$B.valueOf(b.x,b.y);for(h=E.x;h<=C.x&&h<l.length;h+=1)if(l[h])for(g=E.y;g<=C.y&&g<l[h].length;g+=1)if(l[h][g]){var D=Qg(l[h][g],2)[1];if(D){var w=D.rtl,S=D.ltr,A=D.btt,x=D.ttb;E.x=Math.min(E.x,h-(x-1)),E.y=Math.min(E.y,g-(w-1)),C.x=Math.max(C.x,h+(A-1)),C.y=Math.max(C.y,g+(S-1))}}if($B.equals(y,E)&&$B.equals(b,C))break;y=E,b=C}var O=[],N=new WeakSet;for(h=y.x;h<=b.x&&h<l.length;h+=1)if(l[h]){var B=[];for(g=y.y;g<=b.y&&g<l[h].length;g+=1)if(l[h][g]){var T=Qg(l[h][g],1),k=Qg(T[0],1)[0];k&&(N.add(k),B.push(l[h][g]))}B.length>0&&O.push(B)}WB.set(e,O),GB.set(e,N)}catch(r){return oT.unselect(e),t(n)}t(n)}}(l),l.getTableSelection=function(){return WB.get(l)||null};var c=l.addMark,d=l.removeMark,f=Yg({},jg);return l.addMark=function(e,t){var n=WB.get(l);if(n&&n.length>0){var r=l.selection;n.forEach(function(n){n.forEach(function(n){var r=Qg(n[0],2)[1],o=Kh.start(l,r),i=Kh.end(l,r);jg.select(l,{anchor:o,focus:i}),c(e,t)})}),r&&jg.select(l,r)}else c(e,t)},l.removeMark=function(e){var t=WB.get(l);if(t&&t.length>0){var n=l.selection;t.forEach(function(t){t.forEach(function(t){var n=Qg(t[0],2)[1],r=Kh.start(l,n),o=Kh.end(l,n);jg.select(l,{anchor:r,focus:o}),d(e)})}),n&&jg.select(l,n)}else d(e)},jg.setNodes=function(e,t,n){if(void 0===n&&(n={}),e===l){var r=WB.get(l);if(r&&r.length>0)return"hidden"in t||"rowSpan"in t||"colSpan"in t?void f.setNodes(e,t,n):void r.forEach(function(r){r.forEach(function(r){var o=Qg(r[0],2)[1];f.setNodes(e,t,Yg(Yg({},n),{at:o}))})})}f.setNodes(e,t,n)},l}};function tk(e){return e.length?e[0].tagName.toLowerCase():""}function nk(e,t,n,r){void 0===t&&(t="auto"),void 0===n&&(n="auto"),void 0===r&&(r={});var o=am(e),i=r.width,a=void 0===i?"":i,s=r.height,u=void 0===s?"":s,l="";return a&&(l+="width: ".concat(a,";")),u&&(l+="height: ".concat(u,";")),o.attr("width",t),o.attr("height",n),o.attr("style",l),o[0].outerHTML}YE("en",{videoModule:{delete:"Delete",uploadVideo:"Upload video",insertVideo:"Insert video",videoSrc:"Video source",videoSrcPlaceHolder:"Video file url, or third-party <iframe>",videoPoster:"Video poster",videoPosterPlaceHolder:"Poster image url",ok:"Ok",editSize:"Edit size",edit:"Edit video",width:"Width",height:"Height"}}),YE("zh-CN",{videoModule:{delete:"删除视频",uploadVideo:"上传视频",insertVideo:"插入视频",videoSrc:"视频地址",videoSrcPlaceHolder:"视频文件 url 或第三方 <iframe>",videoPoster:"视频封面",videoPosterPlaceHolder:"封面图片 url",ok:"确定",editSize:"修改尺寸",edit:"编辑视频",width:"宽度",height:"高度"}}),Nm&&(am.fn.append=Nm),gm&&(am.fn.on=gm),jm&&(am.fn.focus=jm),cm&&(am.fn.attr=cm),hm&&(am.fn.val=hm),Am&&(am.fn.html=Am),Tm&&(am.fn.parent=Tm),lm&&(am.fn.hasClass=lm),_m&&(am.fn.empty=_m);var rk={type:"video",elemToHtml:function(e,t){var n=e,r=n.src,o=void 0===r?"":r,i=n.poster,a=void 0===i?"":i,s=n.width,u=void 0===s?"auto":s,l=n.height,c=void 0===l?"auto":l,d=n.style,f=void 0===d?{}:d,p=n.textAlign,h='<div data-w-e-type="video" data-w-e-is-void style="text-align: '.concat(void 0===p?"center":p,';">\n');if(0===o.trim().indexOf("<iframe ")){h+=nk(o,u,c,f)}else{var g=f.width,v=void 0===g?"":g,m=f.height,y=void 0===m?"":m,b="";v&&(b+="width: ".concat(v,";")),y&&(b+="height: ".concat(y,";")),h+='<video poster="'.concat(a,'" controls="true" width="').concat(u,'" height="').concat(c,'" style="').concat(b,'"><source src="').concat(o,'" type="video/mp4"/></video>')}return h+="\n</div>"}};function ok(e){return void 0===e&&(e="r"),"".concat(e,"-").concat(zm())}function ik(e){var t={};return e.trim().split(";").forEach(function(e){if(e){var n=Qg(e.split(":"),2),r=n[0],o=n[1];r&&o&&(t[r.trim()]=o.trim())}}),t}function ak(){return ok("w-e-insert-video")}var sk=function(){function e(){this.title=QE("videoModule.editSize"),this.tag="button",this.showModal=!0,this.modalWidth=320,this.$content=null,this.widthInputId=ak(),this.heightInputId=ak(),this.buttonId=ak()}return e.prototype.getSelectedVideoNode=function(e){return _y.getSelectedNodeByType(e,"video")},e.prototype.getValue=function(e){return""},e.prototype.isActive=function(e){return!1},e.prototype.exec=function(e,t){},e.prototype.isDisabled=function(e){return null==e.selection||null==this.getSelectedVideoNode(e)},e.prototype.getModalPositionNode=function(e){return this.getSelectedVideoNode(e)},e.prototype.getModalContentElem=function(e){var t=this,n=t.widthInputId,r=t.heightInputId,o=t.buttonId,i=Qg(cC(QE("videoModule.width"),n,"auto"),2),a=i[0],s=am(i[1]),u=Qg(cC(QE("videoModule.height"),r,"auto"),2),l=u[0],c=am(u[1]),d=Qg(fC(o,QE("videoModule.ok")),1)[0],f=this.getSelectedVideoNode(e);if(null==this.$content){var p=am("<div></div>");p.on("click","#".concat(o),function(t){t.preventDefault();var o=p.find("#".concat(n)).val().trim(),i=p.find("#".concat(r)).val().trim(),a=function(e){return/^\d+(\.\d+)?%$/.test(e)},s=function(e){return/^\d+(\.\d+)?$/.test(e)},u="auto",l="auto";a(o)?u=o:s(o)&&(u="".concat(parseInt(o,10),"px")),a(i)?l=i:s(i)&&(l="".concat(parseInt(i,10),"px"));var c=f.style,d=void 0===c?{}:c;e.restoreSelection();var h={style:Yg(Yg({},d),{width:u,height:l})};jg.setNodes(e,h,{match:function(e){return _y.checkNodeType(e,"video")}}),e.hidePanelOrModal()}),this.$content=p}var h=this.$content;if(h.empty(),h.append(a),h.append(l),h.append(d),null==f)return h[0];var g=f.style,v=void 0===g?{}:g,m=v.width,y=void 0===m?"":m,b=v.height,E=void 0===b?"":b;return s.val(y),c.val(E),setTimeout(function(){s.focus()}),h[0]},e}();function uk(){return ok("w-e-edit-video")}var lk=function(){function e(){this.title=QE("videoModule.edit"),this.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M864 0a160 160 0 0 1 128 256l-64 64-224-224 64-64c26.752-20.096 59.968-32 96-32zM64 736l-64 288 288-64 592-592-224-224L64 736z m651.584-372.416l-448 448-55.168-55.168 448-448 55.168 55.168z"></path></svg>',this.tag="button",this.showModal=!0,this.modalWidth=300,this.$content=null,this.srcInputId=uk(),this.posterInputId=uk(),this.buttonId=uk()}return e.prototype.getSelectedVideoNode=function(e){return _y.getSelectedNodeByType(e,"video")},e.prototype.getValue=function(e){return""},e.prototype.isActive=function(e){return!1},e.prototype.exec=function(e,t){},e.prototype.isDisabled=function(e){return null==e.selection||null==this.getSelectedVideoNode(e)},e.prototype.getModalPositionNode=function(e){return this.getSelectedVideoNode(e)},e.prototype.getModalContentElem=function(e){var t=this,n=this,r=n.srcInputId,o=n.posterInputId,i=n.buttonId,a=Qg(cC(QE("videoModule.videoSrc"),r,QE("videoModule.videoSrcPlaceHolder")),2),s=a[0],u=a[1],l=Qg(cC(QE("videoModule.videoPoster"),o,QE("videoModule.videoPosterPlaceHolder")),2),c=l[0],d=l[1],f=am(u),p=am(d),h=Qg(fC(i,QE("videoModule.ok")),1)[0];if(null==this.$content){var g=am("<div></div>");g.on("click","#".concat(i),function(n){return Xg(t,void 0,void 0,function(){var t,i,a,s;return Zg(this,function(u){return n.preventDefault(),t=g.find("#".concat(r)).val().trim(),i=g.find("#".concat(o)).val().trim(),a=ok("video-"),s={src:t,poster:i,key:a},e.restoreSelection(),jg.setNodes(e,s,{match:function(e){return _y.checkNodeType(e,"video")}}),e.hidePanelOrModal(),[2]})})}),this.$content=g}var v=this.$content;v.empty(),v.append(s),v.append(c),v.append(h);var m=this.getSelectedVideoNode(e);if(null==m)return v[0];var y=m.src,b=void 0===y?"":y,E=m.poster,C=void 0===E?"":E;return f.val(b),p.val(C),setTimeout(function(){f.focus()}),v[0]},e}();function ck(e,t){return Xg(this,arguments,void 0,function(e,t,n,r,o){var i,a,s,u,l,c,d;return void 0===n&&(n=""),void 0===r&&(r=""),void 0===o&&(o=""),Zg(this,function(f){switch(f.label){case 0:return t?(e.restoreSelection(),i=e.getMenuConfig("insertVideo"),a=i.onInsertedVideo,s=i.checkVideo,u=i.parseVideoSrc,[4,s(t,n)]):[2];case 1:return"string"==typeof(l=f.sent())?(e.alert(l,"error"),[2]):null==l?[2]:[4,u(t)];case 2:return 0!==(c=f.sent()).trim().indexOf("<iframe ")&&(c=function(e){return e.replace(/</g,"<").replace(/>/g,">")}(c)),d={type:"video",src:c,poster:n,children:[{text:""}],style:{width:r,height:o}},Promise.resolve().then(function(){_y.isSelectedEmptyParagraph(e)&&jg.removeNodes(e,{mode:"highest"}),jg.insertNodes(e,d,{mode:"highest"})}),a(d),[2]}})})}function dk(){return ok("w-e-insert-video")}var fk=function(){function e(){this.title=QE("videoModule.insertVideo"),this.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M981.184 160.096C837.568 139.456 678.848 128 512 128S186.432 139.456 42.816 160.096C15.296 267.808 0 386.848 0 512s15.264 244.16 42.816 351.904C186.464 884.544 345.152 896 512 896s325.568-11.456 469.184-32.096C1008.704 756.192 1024 637.152 1024 512s-15.264-244.16-42.816-351.904zM384 704V320l320 192-320 192z"></path></svg>',this.tag="button",this.showModal=!0,this.modalWidth=320,this.$content=null,this.srcInputId=dk(),this.posterInputId=dk(),this.buttonId=dk()}return e.prototype.getValue=function(e){return""},e.prototype.isActive=function(e){return!1},e.prototype.exec=function(e,t){},e.prototype.isDisabled=function(e){var t=e.selection;return null==t||(!fg.isCollapsed(t)||!!_y.getSelectedElems(e).some(function(t){var n=_y.getNodeType(t);return"pre"===n||("list-item"===n||!!e.isVoid(t))}))},e.prototype.getModalPositionNode=function(e){return null},e.prototype.getModalContentElem=function(e){var t=this,n=this,r=n.srcInputId,o=n.posterInputId,i=n.buttonId,a=Qg(cC(QE("videoModule.videoSrc"),r,QE("videoModule.videoSrcPlaceHolder")),2),s=a[0],u=a[1],l=Qg(cC(QE("videoModule.videoPoster"),o,QE("videoModule.videoPosterPlaceHolder")),2),c=l[0],d=l[1],f=am(u),p=am(d),h=Qg(fC(i,QE("videoModule.ok")),1)[0];if(null==this.$content){var g=am("<div></div>");g.on("click","#".concat(i),function(n){return Xg(t,void 0,void 0,function(){var t,i;return Zg(this,function(a){switch(a.label){case 0:return n.preventDefault(),t=g.find("#".concat(r)).val().trim(),i=g.find("#".concat(o)).val().trim(),[4,ck(e,t,i)];case 1:return a.sent(),e.hidePanelOrModal(),[2]}})})}),this.$content=g}var v=this.$content;return v.empty(),v.append(s),v.append(c),v.append(h),f.val(""),p.val(""),setTimeout(function(){f.focus()}),v[0]},e}();function pk(e){return e.getMenuConfig("uploadVideo")}var hk=new WeakMap;function gk(e,t){return Xg(this,void 0,void 0,function(){var n,r;return Zg(this,function(o){switch(o.label){case 0:return n=function(e){var t=hk.get(e);if(null!=t)return t;var n=pk(e),r=n.onSuccess,o=n.onProgress,i=n.onFailed,a=n.customInsert,s=n.onError;return t=qA(Yg(Yg({},n),{onProgress:function(t){e.showProgressBar(t),o&&o(t)},onSuccess:function(t,n){if(a)return a(n,function(t,n){return ck(e,t,n)}),void r(t,n);var o=n.errno,s=void 0===o?1:o,u=n.data,l=void 0===u?{}:u;if(0===s){var c=l.url,d=void 0===c?"":c,f=l.poster;ck(e,d,void 0===f?"":f),r(t,n)}else i(t,n)},onError:function(e,t,n){s(e,t,n)}})),hk.set(e,t),t}(e),r=t.map(function(e){return{name:e.name,type:e.type,size:e.size,data:e}}),n.addFiles(r),[4,n.upload()];case 1:return o.sent(),[2]}})})}var vk=function(){function e(){this.title=QE("videoModule.uploadVideo"),this.iconSvg='<svg viewBox="0 0 1056 1024"><path d="M805.902261 521.819882a251.441452 251.441452 0 0 0-251.011972 246.600033 251.051015 251.051015 0 1 0 502.023944 8.823877 253.237463 253.237463 0 0 0-251.011972-255.42391z m59.463561 240.001647v129.898403h-116.701631v-129.898403h-44.041298l101.279368-103.504859 101.279368 103.504859z" p-id="6802"></path><path d="M788.254507 0.000781H99.094092A98.663439 98.663439 0 0 0 0.001171 99.093701v590.067495a98.663439 98.663439 0 0 0 99.092921 99.092921h411.7549a266.434235 266.434235 0 0 1-2.186448-41.815807 275.843767 275.843767 0 0 1 275.180024-270.729042 270.650955 270.650955 0 0 1 103.504859 19.834201V99.093701A101.51363 101.51363 0 0 0 788.254507 0.000781zM295.054441 640.747004V147.507894l394.146189 246.600033z"></path></svg>',this.tag="button"}return e.prototype.getValue=function(e){return""},e.prototype.isActive=function(e){return!1},e.prototype.exec=function(e,t){var n=this.getMenuConfig(e),r=n.allowedFileTypes,o=void 0===r?[]:r,i=n.customBrowseAndUpload;if(i)i(function(t,n){return ck(e,t,n)});else{var a="";o.length>0&&(a='accept="'.concat(o.join(", "),'"'));var s=am("body"),u=am('<input type="file" '.concat(a," multiple/>"));u.hide(),s.append(u),u.click(),u.on("change",function(){var t=u[0].files;!function(e,t){Xg(this,void 0,void 0,function(){var n,r,o,i,a,s,u,l,c,d,f,p;return Zg(this,function(h){switch(h.label){case 0:if(null==t)return[2];n=Array.prototype.slice.call(t),r=[],o=pk(e).customUpload,h.label=1;case 1:h.trys.push([1,8,9,14]),i=!0,a=tv(n),h.label=2;case 2:return[4,a.next()];case 3:return s=h.sent(),(c=s.done)?[3,7]:(p=s.value,i=!1,u=p,o?[4,o(u,function(t,n){return ck(e,t,n)},e)]:[3,5]);case 4:return h.sent(),[3,6];case 5:r.push(u),h.label=6;case 6:return i=!0,[3,2];case 7:return[3,14];case 8:return l=h.sent(),d={error:l},[3,14];case 9:return h.trys.push([9,,12,13]),i||c||!(f=a.return)?[3,11]:[4,f.call(a)];case 10:h.sent(),h.label=11;case 11:return[3,13];case 12:if(d)throw d.error;return[7];case 13:return[7];case 14:return r.length>0?[4,gk(e,r)]:[3,16];case 15:h.sent(),h.label=16;case 16:return[2]}})})}(e,t)})}},e.prototype.isDisabled=function(e){var t=e.selection;return null==t||(!fg.isCollapsed(t)||!!_y.getSelectedElems(e).some(function(t){var n=_y.getNodeType(t);return"pre"===n||("list-item"===n||!!e.isVoid(t))}))},e.prototype.getMenuConfig=function(e){return e.getMenuConfig("uploadVideo")},e}();function mk(e,t,n,r,o,i){return void 0===t&&(t=""),void 0===n&&(n="auto"),void 0===r&&(r="auto"),void 0===o&&(o={}),void 0===i&&(i="center"),{type:"video",src:e,poster:t,width:n,height:r,style:o,children:[{text:""}],textAlign:i}}var yk={selector:'div[data-w-e-type="video"]',parseElemHtml:function(e,t,n){var r=am(e),o="",i="",a="auto",s="auto",u={},l=r.find("iframe");if(l.length>0)return a=l.attr("width")||"auto",s=l.attr("height")||"auto",u=ik(u=l.attr("style")||""),mk(o=l[0].outerHTML,i,a,s,u,ik(r.attr("style")||"")["text-align"]||"center");var c=r.find("video");return(o=c.attr("src")||"")||c.length>0&&(o=c.find("source").attr("src")||""),a=c.attr("width")||"auto",s=c.attr("height")||"auto",mk(o,i=c.attr("poster")||"",a,s,u=ik(u=c.attr("style")||""),ik(r.attr("style")||"")["text-align"]||"center")}};var bk={selector:"iframe,video,p",preParseHtml:function(e){var t=am(e),n=t;if("p"===tk(t)){var r=t.children();if(1===r.length){var o=r[0],i=o.tagName.toLowerCase();["iframe","video"].includes(i)&&(n=am(o))}}var a=tk(n);if("iframe"!==a&&"video"!==a)return n[0];if("video"===n.parent().attr("data-w-e-type"))return n[0];var s=am('<div data-w-e-type="video" data-w-e-is-void style="text-align: center;"></div>');return s.append(n),s[0]}};var Ek={type:"video",renderElem:function(e,t,n){var r,o=e,i=o.src,a=void 0===i?"":i,s=o.poster,u=void 0===s?"":s,l=o.key,c=void 0===l?"":l,d=o.width,f=void 0===d?"auto":d,p=o.height,h=void 0===p?"auto":p,g=o.style,v=void 0===g?{}:g,m=o.textAlign,y=void 0===m?"center":m,b=_y.isNodeSelected(n,e);if(0===a.trim().indexOf("<iframe ")){r=ND("div",{className:"w-e-textarea-video-container","data-selected":b?"true":"",style:{textAlign:y},innerHTML:nk(a,f,h,v)})}else{var E=ND("video",{key:c,poster:u,controls:!0,style:v},ND("source",{src:a,type:"video/mp4"}),"Sorry, your browser doesn't support embedded videos.\n 抱歉,浏览器不支持 video 视频");"auto"!==f&&(E.data.width=f),"auto"!==h&&(E.data.height=h),r=ND("div",{className:"w-e-textarea-video-container","data-selected":b?"true":"",style:{textAlign:y}},E)}var C=uD("div",{props:{contentEditable:!1},on:{mousedown:function(e){return e.preventDefault()}}},r);return C}},Ck={renderElems:[Ek],elemsToHtml:[rk],preParseHtml:[bk],parseElemsHtml:[yk],menus:[{key:"insertVideo",factory:function(){return new fk},config:{onInsertedVideo:function(e){},checkVideo:function(e,t){return!0},parseVideoSrc:function(e){return e}}},{key:"uploadVideo",factory:function(){return new vk},config:{server:"",fieldName:"wangeditor-uploaded-video",maxFileSize:10485760,maxNumberOfFiles:5,allowedFileTypes:["video/*"],meta:{},metaWithUrl:!1,withCredentials:!1,timeout:3e4,onBeforeUpload:function(e){return e},onProgress:function(e){},onSuccess:function(e,t){},onFailed:function(e,t){console.error("'".concat(e.name,"' upload failed"),t)},onError:function(e,t,n){console.error("'".concat(e.name," upload error"),t,n)}}},{key:"editVideoSize",factory:function(){return new sk}},{key:"editVideoSrc",factory:function(){return new lk}}],editorPlugin:function(e){var t=e.isVoid,n=e.normalizeNode,r=e;return r.isVoid=function(e){return"video"===e.type||t(e)},r.normalizeNode=function(e){var t=Qg(e,2),o=t[0],i=t[1];"video"===_y.getNodeType(o)&&(_y.isLastNode(r,o)&&jg.insertNodes(r,_y.genEmptyParagraph(),{at:[i[0]+1]}));return n([o,i])},r}};YE("en",{uploadImgModule:{uploadImage:"Upload Image",uploadError:"{{fileName}} upload error"}}),YE("zh-CN",{uploadImgModule:{uploadImage:"上传图片",uploadError:"{{fileName}} 上传出错"}});Nm&&(am.fn.append=Nm),gm&&(am.fn.on=gm),Pm&&(am.fn.remove=Pm),hm&&(am.fn.val=hm),Mm&&(am.fn.click=Mm),Em&&(am.fn.hide=Em);var Dk=new WeakMap;function wk(e){return e.getMenuConfig("uploadImage")}function Sk(e,t){return Xg(this,void 0,void 0,function(){return Zg(this,function(n){return[2,new Promise(function(n){var r=new FileReader;r.readAsDataURL(t),r.onload=function(){var o=r.result;if(o){var i=o.toString(),a=0===i.indexOf("data:image")?"":i;qO(e,i,t.name,a),n("ok")}}})]})})}function Ak(e,t){return Xg(this,void 0,void 0,function(){var n,r;return Zg(this,function(o){switch(o.label){case 0:return n=function(e){var t=Dk.get(e);if(null!=t)return t;var n=wk(e),r=n.onSuccess,o=n.onProgress,i=n.onFailed,a=n.customInsert,s=n.onError;return t=qA(Yg(Yg({},n),{onProgress:function(t){e.showProgressBar(t),o&&o(t)},onSuccess:function(t,n){if(a)return a(n,function(t,n,r){return qO(e,t,n,r)}),void r(t,n);var o=n.errno,s=void 0===o?1:o,u=n.data,l=void 0===u?{}:u;if(0===s){if(Array.isArray(l))l.forEach(function(t){var n=t.url,r=void 0===n?"":n,o=t.alt,i=void 0===o?"":o,a=t.href;qO(e,r,i,void 0===a?"":a)});else{var c=l.url,d=void 0===c?"":c,f=l.alt,p=void 0===f?"":f,h=l.href;qO(e,d,p,void 0===h?"":h)}r(t,n)}else i(t,n)},onError:function(e,t,n){s(e,t,n)}})),Dk.set(e,t),t}(e),r=t.map(function(e){return{name:e.name,type:e.type,size:e.size,data:e}}),n.addFiles(r),[4,n.upload()];case 1:return o.sent(),[2]}})})}function xk(e,t){return Xg(this,void 0,void 0,function(){var n,r,o,i,a,s,u,l,c,d,f,p,h,g,v;return Zg(this,function(m){switch(m.label){case 0:if(null==t)return[2];n=Array.prototype.slice.call(t),r=wk(e),o=r.customUpload,i=r.base64LimitSize,a=[],m.label=1;case 1:m.trys.push([1,10,11,16]),s=!0,u=tv(n),m.label=2;case 2:return[4,u.next()];case 3:return l=m.sent(),(p=l.done)?[3,9]:(v=l.value,s=!1,d=(c=v).size,i&&d<=i?[4,Sk(e,c)]:[3,5]);case 4:return m.sent(),[3,8];case 5:return o?[4,o(c,function(t,n,r){return qO(e,t,n,r)},e)]:[3,7];case 6:return m.sent(),[3,8];case 7:a.push(c),m.label=8;case 8:return s=!0,[3,2];case 9:return[3,16];case 10:return f=m.sent(),h={error:f},[3,16];case 11:return m.trys.push([11,,14,15]),s||p||!(g=u.return)?[3,13]:[4,g.call(u)];case 12:m.sent(),m.label=13;case 13:return[3,15];case 14:if(h)throw h.error;return[7];case 15:return[7];case 16:return a.length>0?[4,Ak(e,a)]:[3,18];case 17:m.sent(),m.label=18;case 18:return[2]}})})}var Ok=function(){function e(){this.title=QE("uploadImgModule.uploadImage"),this.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M828.708571 585.045333a48.761905 48.761905 0 0 0-48.737523 48.761905v18.529524l-72.143238-72.167619a135.972571 135.972571 0 0 0-191.585524 0l-34.133334 34.133333-120.880762-120.953905a138.898286 138.898286 0 0 0-191.585523 0l-72.167619 72.167619V292.400762a48.786286 48.786286 0 0 1 48.761904-48.761905h341.23581a48.737524 48.737524 0 0 0 34.474667-83.285333 48.737524 48.737524 0 0 0-34.474667-14.287238H146.236952A146.212571 146.212571 0 0 0 0 292.400762v585.289143A146.358857 146.358857 0 0 0 146.236952 1024h584.996572a146.212571 146.212571 0 0 0 146.236952-146.310095V633.807238a48.786286 48.786286 0 0 0-48.761905-48.761905zM146.261333 926.45181a48.737524 48.737524 0 0 1-48.761904-48.761905v-174.128762l141.409523-141.458286a38.497524 38.497524 0 0 1 53.126096 0l154.526476 154.624 209.627428 209.724953H146.236952z m633.734096-48.761905c-0.073143 9.337905-3.145143 18.383238-8.777143 25.843809l-219.843048-220.94019 34.133333-34.133334a37.546667 37.546667 0 0 1 53.613715 0l140.873143 141.897143V877.714286zM1009.615238 160.231619L863.329524 13.897143a48.737524 48.737524 0 0 0-16.091429-10.24c-11.849143-4.87619-25.161143-4.87619-37.059047 0a48.761905 48.761905 0 0 0-16.067048 10.24l-146.236952 146.334476a49.005714 49.005714 0 0 0 69.217523 69.241905l62.902858-63.390476v272.627809a48.761905 48.761905 0 1 0 97.475047 0V166.083048l62.902857 63.390476a48.737524 48.737524 0 0 0 69.217524 0 48.761905 48.761905 0 0 0 0-69.241905z"></path></svg>',this.tag="button"}return e.prototype.getValue=function(e){return""},e.prototype.isActive=function(e){return!1},e.prototype.isDisabled=function(e){return VO(e)},e.prototype.getMenuConfig=function(e){return e.getMenuConfig("uploadImage")},e.prototype.exec=function(e,t){var n=this.getMenuConfig(e),r=n.allowedFileTypes,o=void 0===r?[]:r,i=n.customBrowseAndUpload;if(i)i(function(t,n,r){return qO(e,t,n,r)});else{var a="";o.length>0&&(a='accept="'.concat(o.join(", "),'"'));var s=am("body"),u=am('<input type="file" '.concat(a," multiple/>"));u.hide(),s.append(u),u.click(),u.on("change",function(){var t=u[0].files;xk(e,t)})}},e}();var Nk={menus:[{key:"uploadImage",factory:function(){return new Ok},config:{server:"",fieldName:"wangeditor-uploaded-image",maxFileSize:2097152,maxNumberOfFiles:100,allowedFileTypes:["image/*"],meta:{},metaWithUrl:!1,withCredentials:!1,timeout:1e4,onBeforeUpload:function(e){return e},onProgress:function(e){},onSuccess:function(e,t){},onFailed:function(e,t){console.error("'".concat(e.name,"' upload failed"),t)},onError:function(e,t,n){console.error("'".concat(e.name,"' upload error"),n)},base64LimitSize:0}}],editorPlugin:function(e){var t=e.insertData,n=e;return n.insertData=function(r){if(VO(n))t(r);else if(r.getData("text/plain"))t(r);else{var o=r.files;if(o.length<=0)t(r);else Array.prototype.slice.call(o).some(function(e){return"image"===Qg(e.type.split("/"),1)[0]})?xk(e,o):t(r)}},n}};YE("en",{highLightModule:{selectLang:"Language"}}),YE("zh-CN",{highLightModule:{selectLang:"选择语言"}});var Bk,Tk={exports:{}};var kk=(Bk||(Bk=1,function(e){var t=function(e){var t=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,n=0,r={},o={manual:e.Prism&&e.Prism.manual,disableWorkerMessageHandler:e.Prism&&e.Prism.disableWorkerMessageHandler,util:{encode:function e(t){return t instanceof i?new i(t.type,e(t.content),t.alias):Array.isArray(t)?t.map(e):t.replace(/&/g,"&").replace(/</g,"<").replace(/\u00a0/g," ")},type:function(e){return Object.prototype.toString.call(e).slice(8,-1)},objId:function(e){return e.__id||Object.defineProperty(e,"__id",{value:++n}),e.__id},clone:function e(t,n){var r,i;switch(n=n||{},o.util.type(t)){case"Object":if(i=o.util.objId(t),n[i])return n[i];for(var a in r={},n[i]=r,t)t.hasOwnProperty(a)&&(r[a]=e(t[a],n));return r;case"Array":return i=o.util.objId(t),n[i]?n[i]:(r=[],n[i]=r,t.forEach(function(t,o){r[o]=e(t,n)}),r);default:return t}},getLanguage:function(e){for(;e;){var n=t.exec(e.className);if(n)return n[1].toLowerCase();e=e.parentElement}return"none"},setLanguage:function(e,n){e.className=e.className.replace(RegExp(t,"gi"),""),e.classList.add("language-"+n)},currentScript:function(){if("undefined"==typeof document)return null;if(document.currentScript&&"SCRIPT"===document.currentScript.tagName)return document.currentScript;try{throw new Error}catch(r){var e=(/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(r.stack)||[])[1];if(e){var t=document.getElementsByTagName("script");for(var n in t)if(t[n].src==e)return t[n]}return null}},isActive:function(e,t,n){for(var r="no-"+t;e;){var o=e.classList;if(o.contains(t))return!0;if(o.contains(r))return!1;e=e.parentElement}return!!n}},languages:{plain:r,plaintext:r,text:r,txt:r,extend:function(e,t){var n=o.util.clone(o.languages[e]);for(var r in t)n[r]=t[r];return n},insertBefore:function(e,t,n,r){var i=(r=r||o.languages)[e],a={};for(var s in i)if(i.hasOwnProperty(s)){if(s==t)for(var u in n)n.hasOwnProperty(u)&&(a[u]=n[u]);n.hasOwnProperty(s)||(a[s]=i[s])}var l=r[e];return r[e]=a,o.languages.DFS(o.languages,function(t,n){n===l&&t!=e&&(this[t]=a)}),a},DFS:function e(t,n,r,i){i=i||{};var a=o.util.objId;for(var s in t)if(t.hasOwnProperty(s)){n.call(t,s,t[s],r||s);var u=t[s],l=o.util.type(u);"Object"!==l||i[a(u)]?"Array"!==l||i[a(u)]||(i[a(u)]=!0,e(u,n,s,i)):(i[a(u)]=!0,e(u,n,null,i))}}},plugins:{},highlightAll:function(e,t){o.highlightAllUnder(document,e,t)},highlightAllUnder:function(e,t,n){var r={callback:n,container:e,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};o.hooks.run("before-highlightall",r),r.elements=Array.prototype.slice.apply(r.container.querySelectorAll(r.selector)),o.hooks.run("before-all-elements-highlight",r);for(var i,a=0;i=r.elements[a++];)o.highlightElement(i,!0===t,r.callback)},highlightElement:function(t,n,r){var i=o.util.getLanguage(t),a=o.languages[i];o.util.setLanguage(t,i);var s=t.parentElement;s&&"pre"===s.nodeName.toLowerCase()&&o.util.setLanguage(s,i);var u={element:t,language:i,grammar:a,code:t.textContent};function l(e){u.highlightedCode=e,o.hooks.run("before-insert",u),u.element.innerHTML=u.highlightedCode,o.hooks.run("after-highlight",u),o.hooks.run("complete",u),r&&r.call(u.element)}if(o.hooks.run("before-sanity-check",u),(s=u.element.parentElement)&&"pre"===s.nodeName.toLowerCase()&&!s.hasAttribute("tabindex")&&s.setAttribute("tabindex","0"),!u.code)return o.hooks.run("complete",u),void(r&&r.call(u.element));if(o.hooks.run("before-highlight",u),u.grammar)if(n&&e.Worker){var c=new Worker(o.filename);c.onmessage=function(e){l(e.data)},c.postMessage(JSON.stringify({language:u.language,code:u.code,immediateClose:!0}))}else l(o.highlight(u.code,u.grammar,u.language));else l(o.util.encode(u.code))},highlight:function(e,t,n){var r={code:e,grammar:t,language:n};if(o.hooks.run("before-tokenize",r),!r.grammar)throw new Error('The language "'+r.language+'" has no grammar.');return r.tokens=o.tokenize(r.code,r.grammar),o.hooks.run("after-tokenize",r),i.stringify(o.util.encode(r.tokens),r.language)},tokenize:function(e,t){var n=t.rest;if(n){for(var r in n)t[r]=n[r];delete t.rest}var o=new u;return l(o,o.head,e),s(e,o,t,o.head,0),function(e){for(var t=[],n=e.head.next;n!==e.tail;)t.push(n.value),n=n.next;return t}(o)},hooks:{all:{},add:function(e,t){var n=o.hooks.all;n[e]=n[e]||[],n[e].push(t)},run:function(e,t){var n=o.hooks.all[e];if(n&&n.length)for(var r,i=0;r=n[i++];)r(t)}},Token:i};function i(e,t,n,r){this.type=e,this.content=t,this.alias=n,this.length=0|(r||"").length}function a(e,t,n,r){e.lastIndex=t;var o=e.exec(n);if(o&&r&&o[1]){var i=o[1].length;o.index+=i,o[0]=o[0].slice(i)}return o}function s(e,t,n,r,u,d){for(var f in n)if(n.hasOwnProperty(f)&&n[f]){var p=n[f];p=Array.isArray(p)?p:[p];for(var h=0;h<p.length;++h){if(d&&d.cause==f+","+h)return;var g=p[h],v=g.inside,m=!!g.lookbehind,y=!!g.greedy,b=g.alias;if(y&&!g.pattern.global){var E=g.pattern.toString().match(/[imsuy]*$/)[0];g.pattern=RegExp(g.pattern.source,E+"g")}for(var C=g.pattern||g,D=r.next,w=u;D!==t.tail&&!(d&&w>=d.reach);w+=D.value.length,D=D.next){var S=D.value;if(t.length>e.length)return;if(!(S instanceof i)){var A,x=1;if(y){if(!(A=a(C,w,e,m))||A.index>=e.length)break;var O=A.index,N=A.index+A[0].length,B=w;for(B+=D.value.length;O>=B;)B+=(D=D.next).value.length;if(w=B-=D.value.length,D.value instanceof i)continue;for(var T=D;T!==t.tail&&(B<N||"string"==typeof T.value);T=T.next)x++,B+=T.value.length;x--,S=e.slice(w,B),A.index-=w}else if(!(A=a(C,0,S,m)))continue;O=A.index;var k=A[0],F=S.slice(0,O),I=S.slice(O+k.length),P=w+S.length;d&&P>d.reach&&(d.reach=P);var _=D.prev;if(F&&(_=l(t,_,F),w+=F.length),c(t,_,x),D=l(t,_,new i(f,v?o.tokenize(k,v):k,b,k)),I&&l(t,D,I),x>1){var R={cause:f+","+h,reach:P};s(e,t,n,D.prev,w,R),d&&R.reach>d.reach&&(d.reach=R.reach)}}}}}}function u(){var e={value:null,prev:null,next:null},t={value:null,prev:e,next:null};e.next=t,this.head=e,this.tail=t,this.length=0}function l(e,t,n){var r=t.next,o={value:n,prev:t,next:r};return t.next=o,r.prev=o,e.length++,o}function c(e,t,n){for(var r=t.next,o=0;o<n&&r!==e.tail;o++)r=r.next;t.next=r,r.prev=t,e.length-=o}if(e.Prism=o,i.stringify=function e(t,n){if("string"==typeof t)return t;if(Array.isArray(t)){var r="";return t.forEach(function(t){r+=e(t,n)}),r}var i={type:t.type,content:e(t.content,n),tag:"span",classes:["token",t.type],attributes:{},language:n},a=t.alias;a&&(Array.isArray(a)?Array.prototype.push.apply(i.classes,a):i.classes.push(a)),o.hooks.run("wrap",i);var s="";for(var u in i.attributes)s+=" "+u+'="'+(i.attributes[u]||"").replace(/"/g,""")+'"';return"<"+i.tag+' class="'+i.classes.join(" ")+'"'+s+">"+i.content+"</"+i.tag+">"},!e.document)return e.addEventListener?(o.disableWorkerMessageHandler||e.addEventListener("message",function(t){var n=JSON.parse(t.data),r=n.language,i=n.code,a=n.immediateClose;e.postMessage(o.highlight(i,o.languages[r],r)),a&&e.close()},!1),o):o;var d=o.util.currentScript();function f(){o.manual||o.highlightAll()}if(d&&(o.filename=d.src,d.hasAttribute("data-manual")&&(o.manual=!0)),!o.manual){var p=document.readyState;"loading"===p||"interactive"===p&&d&&d.defer?document.addEventListener("DOMContentLoaded",f):window.requestAnimationFrame?window.requestAnimationFrame(f):window.setTimeout(f,16)}return o}("undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{});
|
|
18
|
+
*/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 a=n("apply");function s(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 gw=class{constructor(t){Object.defineProperty(this,a,{value:s}),this.locale={strings:{},pluralize:e=>1===e?0:1},Array.isArray(t)?t.forEach(e(this,a)[a],this):e(this,a)[a](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)}},gw}function Uw(){return yw||(yw=1,mw=function(){var e={},t=e._fns={};return e.emit=function(e,n,r,o,i,a,s){var u=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),a=0,s=i.length;for(;a<s;a++){var u=i[a];if("*"===u&&(n=n.concat(t[u])),2===o.length&&o[0]===u){n=n.concat(t[u]);break}}return n}(e);u.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,u,[n,r,o,i,a,s])},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}),mw}function Vw(){if(Ew)return bw;Ew=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",bw=function(){return new r}}function Ww(){if(Dw)return Cw;return Dw=1,Cw=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 Gw(){return Sw?ww:(Sw=1,ww={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 qw(){if(Rw)return _w;Rw=1;var e=iw(),t=ow(),n=Hw();let r,o;function i(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 s(e){return"__private_"+a+++"_"+e}const u=$w(),l=Uw(),c=SC(),d=Vw(),f=function(){if(xw)return Aw;xw=1;const e=Ww(),t=Gw();return Aw=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"}}(),p=Ww(),h=function(){if(Nw)return Ow;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 Nw=1,Ow=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}}(),g=(Tw||(Tw=1,Bw=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}),Bw),v=Fw?kw:(Fw=1,kw=function(e,t){return t.name?t.name:"image"===e.split("/")[0]?`${e.split("/")[0]}.${e.split("/")[1]}`:"noname"}),m=Pw?Iw:(Pw=1,Iw={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 y=s("plugins"),b=s("restricter"),E=s("storeUnsubscribe"),C=s("emitter"),D=s("preProcessors"),w=s("uploaders"),S=s("postProcessors"),A=s("informAndEmit"),x=s("checkRequiredMetaFieldsOnFile"),O=s("checkRequiredMetaFields"),N=s("assertNewUploadAllowed"),B=s("checkAndCreateFileStateObject"),T=s("startIfAutoProceed"),k=s("addListeners"),F=s("updateOnlineStatus"),I=s("createUpload"),P=s("getUpload"),_=s("removeUpload"),R=s("runUpload");r=Symbol.for("uppy test: getPlugins"),o=Symbol.for("uppy test: createUpload");class L{constructor(e){Object.defineProperty(this,R,{value:K}),Object.defineProperty(this,_,{value:q}),Object.defineProperty(this,P,{value:G}),Object.defineProperty(this,I,{value:W}),Object.defineProperty(this,k,{value:V}),Object.defineProperty(this,T,{value:U}),Object.defineProperty(this,B,{value:$}),Object.defineProperty(this,N,{value:z}),Object.defineProperty(this,O,{value:H}),Object.defineProperty(this,x,{value:j}),Object.defineProperty(this,A,{value:M}),Object.defineProperty(this,y,{writable:!0,value:Object.create(null)}),Object.defineProperty(this,b,{writable:!0,value:void 0}),Object.defineProperty(this,E,{writable:!0,value:void 0}),Object.defineProperty(this,C,{writable:!0,value:l()}),Object.defineProperty(this,D,{writable:!0,value:new Set}),Object.defineProperty(this,w,{writable:!0,value:new Set}),Object.defineProperty(this,S,{writable:!0,value:new Set}),Object.defineProperty(this,F,{writable:!0,value:this.updateOnlineStatus.bind(this)}),this.defaultLocale=m;const r={id:"uppy",autoProceed:!1,allowMultipleUploads:!0,allowMultipleUploadBatches:!0,debug:!1,restrictions:n.defaultOptions,meta:{},onBeforeFileAdded:e=>e,onBeforeUpload:e=>e,store:d(),logger:t.justErrorsLogger,infoTimeout:5e3};this.opts={...r,...e,restrictions:{...r.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=c(this.calculateProgress.bind(this),500,{leading:!0,trailing:!0}),this.store=this.opts.store,this.setState({plugins:{},files:{},currentUploads:{},allowNewUpload:!0,capabilities:{uploadProgress:g(),individualCancellation:!0,resumableUploads:!1},totalProgress:0,meta:{...this.opts.meta},info:[],recoveredState:null}),i(this,b)[b]=new n.Restricter(()=>this.opts,this.i18n),i(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),i(this,k)[k]()}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];i(this,C)[C].emit(e,...n)}on(e,t){return i(this,C)[C].on(e,t),this}once(e,t){return i(this,C)[C].once(e,t),this}off(e,t){return i(this,C)[C].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){i(this,D)[D].add(e)}removePreProcessor(e){return i(this,D)[D].delete(e)}addPostProcessor(e){i(this,S)[S].add(e)}removePostProcessor(e){return i(this,S)[S].delete(e)}addUploader(e){i(this,w)[w].add(e)}removeUploader(e){return i(this,w)[w].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),a=r.filter(e=>e.progress.uploadStarted||e.progress.preprocess||e.progress.postprocess),s=r.filter(e=>e.progress.uploadStarted),u=r.filter(e=>e.isPaused),l=r.filter(e=>e.progress.uploadComplete),c=r.filter(e=>e.error),d=o.filter(e=>!e.isPaused),f=r.filter(e=>e.progress.preprocess||e.progress.postprocess);return{newFiles:i,startedFiles:a,uploadStartedFiles:s,pausedFiles:u,completeFiles:l,erroredFiles:c,inProgressFiles:o,inProgressNotPausedFiles:d,processingFiles:f,isUploadStarted:s.length>0,isAllComplete:100===t&&l.length===r.length&&0===f.length,isAllErrored:!!n&&c.length===r.length,isAllPaused:0!==o.length&&u.length===o.length,isUploadInProgress:o.length>0,isSomeGhost:r.some(e=>e.isGhost)}}validateRestrictions(e,t){void 0===t&&(t=this.getFiles());try{return i(this,b)[b].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){i(this,N)[N](e);const{files:t}=this.getState();let n=i(this,B)[B](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}`),i(this,T)[T](),n.id}addFiles(e){i(this,N)[N]();const t={...this.getState().files},n=[],r=[];for(let o=0;o<e.length;o++)try{let r=i(this,B)[B](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&&i(this,T)[T](),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},a=Object.create(null);function s(e){return void 0===a[e]}e.forEach(e=>{n[e]&&(a[e]=n[e],delete o[e])}),Object.keys(i).forEach(e=>{const t=r[e].fileIDs.filter(s);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 u={currentUploads:i,files:o};0===Object.keys(o).length&&(u.allowNewUpload=!0,u.error=null,u.recoveredState=null),this.setState(u),this.calculateTotalProgress();const l=Object.keys(a);l.forEach(e=>{this.emit("file-removed",a[e],t)}),l.length>5?this.log(`Removed ${l.length} files`):this.log(`Removed files: ${l.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=i(this,I)[I](t,{forceAllowNewUpload:!0});return i(this,R)[R](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=i(this,I)[I]([e],{forceAllowNewUpload:!0});return i(this,R)[R](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 a=0===r?0:Math.round(i/r*100);a>100&&(a=100),this.setState({totalProgress:a}),this.emit("progress",a)}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 i(this,y)[y]?i(this,y)[y][n.type].push(n):i(this,y)[y][n.type]=[n],n.install(),this}getPlugin(e){for(const t of Object.values(i(this,y)[y])){const n=t.find(t=>t.id===e);if(null!=n)return n}}[r](e){return i(this,y)[y][e]}iteratePlugins(e){Object.values(i(this,y)[y]).flat(1).forEach(e)}removePlugin(e){this.log(`Removing plugin ${e.id}`),this.emit("plugin-remove",e),e.uninstall&&e.uninstall();const t=i(this,y)[y][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}),i(this,E)[E](),this.iteratePlugins(e=>{this.removePlugin(e)}),"undefined"!=typeof window&&window.removeEventListener&&(window.removeEventListener("online",i(this,F)[F]),window.removeEventListener("offline",i(this,F)[F]))}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]?i(this,R)[R](e):(i(this,_)[_](e),Promise.reject(new Error("Nonexistent upload")))}[o](){return i(this,I)[I](...arguments)}addResultData(e,t){if(!i(this,P)[P](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=i(this,y)[y].uploader)&&e.length||this.log("No uploader type plugins are used","warning");let{files:t}=this.getState();const r=this.opts.onBeforeUpload(t);return!1===r?Promise.reject(new Error("Not starting the upload because onBeforeUpload returned false")):(r&&"object"==typeof r&&(t=r,this.setState({files:t})),Promise.resolve().then(()=>i(this,b)[b].validateMinNumberOfFiles(t)).catch(e=>{throw i(this,A)[A](e),e}).then(()=>{if(!i(this,O)[O](t))throw new n.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=i(this,I)[I](r);return i(this,R)[R](o)}).catch(e=>{throw this.emit("error",e),this.log(e,"error"),e}))}}function M(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 j(e){const{missingFields:t,error:n}=i(this,b)[b].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))i(this,x)[x](n)||(t=!1);return t}function z(e){const{allowNewUpload:t}=this.getState();if(!1===t){const t=new n.RestrictionError(this.i18n("noMoreFilesAllowed"));throw i(this,A)[A](t,e),t}}function $(e,t){const r=f(t),o=v(r,t),a=p(o).extension,s=Boolean(t.isRemote),u=h({...t,type:r});if(this.checkIfFileAlreadyExists(u)){const e=new n.RestrictionError(this.i18n("noDuplicates",{fileName:o}));throw i(this,A)[A](e,t),e}const l=t.meta||{};l.name=o,l.type=r;const c=Number.isFinite(t.data.size)?t.data.size:null;let d={source:t.source||"",id:u,name:o,extension:a||"",meta:{...this.getState().meta,...l},type:r,data:t.data,progress:{percentage:0,bytesUploaded:0,bytesTotal:c,uploadComplete:!1,uploadStarted:null},size:c,isRemote:s,remote:t.remote||"",preview:t.preview};const g=this.opts.onBeforeFileAdded(d,e);if(!1===g){const e=new n.RestrictionError("Cannot add the file because onBeforeFileAdded returned false.");throw this.emit("restriction-failed",t,e),e}"object"==typeof g&&null!==g&&(d=g);try{const t=Object.keys(e).map(t=>e[t]);i(this,b)[b].validate(d,t)}catch(e){throw i(this,A)[A](e,d),e}return d}function U(){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 V(){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}),i(this,A)[A](e)}else i(this,A)[A](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:i(this,S)[S].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&&i(this,x)[x](e)}),"undefined"!=typeof window&&window.addEventListener&&(window.addEventListener("online",i(this,F)[F]),window.addEventListener("offline",i(this,F)[F]),setTimeout(i(this,F)[F],3e3))}function W(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 a=(0,e.nanoid)();return this.emit("upload",{id:a,fileIDs:t}),this.setState({allowNewUpload:!1!==this.opts.allowMultipleUploadBatches&&!1!==this.opts.allowMultipleUploads,currentUploads:{...i,[a]:{fileIDs:t,step:0,result:{}}}}),a}function G(e){const{currentUploads:t}=this.getState();return t[e]}function q(e){const t={...this.getState().currentUploads};delete t[e],this.setState({currentUploads:t})}async function K(e){let{currentUploads:t}=this.getState(),n=t[e];const r=n.step||0,o=[...i(this,D)[D],...i(this,w)[w],...i(this,S)[S]];try{for(let i=r;i<o.length&&n;i++){const r=o[i],a={...n,step:i};this.setState({currentUploads:{...t,[e]:a}}),await r(a.fileIDs,e),t=this.getState().currentUploads,n=t[e]}}catch(t){throw i(this,_)[_](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 a;return n&&(a=n.result,this.emit("complete",a),i(this,_)[_](e)),null==a&&this.log(`Not setting result for an upload that has been removed: ${e}`),a}return L.VERSION="2.3.4",_w=L}var Kw,Yw,Xw,Zw,Jw,Qw,eS,tS,nS,rS,oS,iS,aS,sS={},uS=[],lS=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,cS=Array.isArray;function dS(e,t){for(var n in t)e[n]=t[n];return e}function fS(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function pS(e,t,n){var r,o,i,a={};for(i in t)"key"==i?r=t[i]:"ref"==i?o=t[i]:a[i]=t[i];if(arguments.length>2&&(a.children=arguments.length>3?Kw.call(arguments,2):n),"function"==typeof e&&null!=e.defaultProps)for(i in e.defaultProps)void 0===a[i]&&(a[i]=e.defaultProps[i]);return hS(e,a,r,o,null)}function hS(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?++Xw:o,__i:-1,__u:0};return null==o&&null!=Yw.vnode&&Yw.vnode(i),i}function gS(e){return e.children}function vS(e,t){this.props=e,this.context=t}function mS(e,t){if(null==t)return e.__?mS(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?mS(e):null}function yS(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 yS(e)}}function bS(e){(!e.__d&&(e.__d=!0)&&Jw.push(e)&&!ES.__r++||Qw!=Yw.debounceRendering)&&((Qw=Yw.debounceRendering)||eS)(ES)}function ES(){for(var e,t,n,r,o,i,a,s=1;Jw.length;)Jw.length>s&&Jw.sort(tS),e=Jw.shift(),s=Jw.length,e.__d&&(n=void 0,r=void 0,o=(r=(t=e).__v).__e,i=[],a=[],t.__P&&((n=dS({},r)).__v=r.__v+1,Yw.vnode&&Yw.vnode(n),NS(t.__P,n,r,t.__n,t.__P.namespaceURI,32&r.__u?[o]:null,i,null==o?mS(r):o,!!(32&r.__u),a),n.__v=r.__v,n.__.__k[n.__i]=n,TS(i,n,a),r.__e=r.__=null,n.__e!=o&&yS(n)));ES.__r=0}function CS(e,t,n,r,o,i,a,s,u,l,c){var d,f,p,h,g,v,m,y=r&&r.__k||uS,b=t.length;for(u=DS(n,t,y,u,b),d=0;d<b;d++)null!=(p=n.__k[d])&&(f=-1==p.__i?sS:y[p.__i]||sS,p.__i=d,v=NS(e,p,f,o,i,a,s,u,l,c),h=p.__e,p.ref&&f.ref!=p.ref&&(f.ref&&IS(f.ref,null,p),c.push(p.ref,p.__c||h,p)),null==g&&null!=h&&(g=h),(m=!!(4&p.__u))||f.__k===p.__k?u=wS(p,u,e,m):"function"==typeof p.type&&void 0!==v?u=v:h&&(u=h.nextSibling),p.__u&=-7);return n.__e=g,u}function DS(e,t,n,r,o){var i,a,s,u,l,c=n.length,d=c,f=0;for(e.__k=new Array(o),i=0;i<o;i++)null!=(a=t[i])&&"boolean"!=typeof a&&"function"!=typeof a?(u=i+f,(a=e.__k[i]="string"==typeof a||"number"==typeof a||"bigint"==typeof a||a.constructor==String?hS(null,a,null,null,null):cS(a)?hS(gS,{children:a},null,null,null):null==a.constructor&&a.__b>0?hS(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):a).__=e,a.__b=e.__b+1,s=null,-1!=(l=a.__i=SS(a,n,u,d))&&(d--,(s=n[l])&&(s.__u|=2)),null==s||null==s.__v?(-1==l&&(o>c?f--:o<c&&f++),"function"!=typeof a.type&&(a.__u|=4)):l!=u&&(l==u-1?f--:l==u+1?f++:(l>u?f--:f++,a.__u|=4))):e.__k[i]=null;if(d)for(i=0;i<c;i++)null!=(s=n[i])&&!(2&s.__u)&&(s.__e==r&&(r=mS(s)),PS(s,s));return r}function wS(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=wS(o[i],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=mS(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do{t=t&&t.nextSibling}while(null!=t&&8==t.nodeType);return t}function SS(e,t,n,r){var o,i,a,s=e.key,u=e.type,l=t[n],c=null!=l&&!(2&l.__u);if(null===l&&null==e.key||c&&s==l.key&&u==l.type)return n;if(r>(c?1:0))for(o=n-1,i=n+1;o>=0||i<t.length;)if(null!=(l=t[a=o>=0?o--:i++])&&!(2&l.__u)&&s==l.key&&u==l.type)return a;return-1}function AS(e,t,n){"-"==t[0]?e.setProperty(t,null==n?"":n):e[t]=null==n?"":"number"!=typeof n||lS.test(t)?n:n+"px"}function xS(e,t,n,r,o){var i,a;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||AS(e.style,t,"");if(n)for(t in n)r&&n[t]==r[t]||AS(e.style,t,n[t])}else if("o"==t[0]&&"n"==t[1])i=t!=(t=t.replace(nS,"$1")),a=t.toLowerCase(),t=a in e||"onFocusOut"==t||"onFocusIn"==t?a.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+i]=n,n?r?n.u=r.u:(n.u=rS,e.addEventListener(t,i?iS:oS,i)):e.removeEventListener(t,i?iS:oS,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 OS(e){return function(t){if(this.l){var n=this.l[t.type+e];if(null==t.t)t.t=rS++;else if(t.t<n.u)return;return n(Yw.event?Yw.event(t):t)}}}function NS(e,t,n,r,o,i,a,s,u,l){var c,d,f,p,h,g,v,m,y,b,E,C,D,w,S,A,x,O=t.type;if(null!=t.constructor)return null;128&n.__u&&(u=!!(32&n.__u),i=[s=t.__e=n.__e]),(c=Yw.__b)&&c(t);e:if("function"==typeof O)try{if(m=t.props,y="prototype"in O&&O.prototype.render,b=(c=O.contextType)&&r[c.__c],E=c?b?b.props.value:c.__:r,n.__c?v=(d=t.__c=n.__c).__=d.__E:(y?t.__c=d=new O(m,E):(t.__c=d=new vS(m,E),d.constructor=O,d.render=_S),b&&b.sub(d),d.props=m,d.state||(d.state={}),d.context=E,d.__n=r,f=d.__d=!0,d.__h=[],d._sb=[]),y&&null==d.__s&&(d.__s=d.state),y&&null!=O.getDerivedStateFromProps&&(d.__s==d.state&&(d.__s=dS({},d.__s)),dS(d.__s,O.getDerivedStateFromProps(m,d.__s))),p=d.props,h=d.state,d.__v=t,f)y&&null==O.getDerivedStateFromProps&&null!=d.componentWillMount&&d.componentWillMount(),y&&null!=d.componentDidMount&&d.__h.push(d.componentDidMount);else{if(y&&null==O.getDerivedStateFromProps&&m!==p&&null!=d.componentWillReceiveProps&&d.componentWillReceiveProps(m,E),!d.__e&&null!=d.shouldComponentUpdate&&!1===d.shouldComponentUpdate(m,d.__s,E)||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)}),C=0;C<d._sb.length;C++)d.__h.push(d._sb[C]);d._sb=[],d.__h.length&&a.push(d);break e}null!=d.componentWillUpdate&&d.componentWillUpdate(m,d.__s,E),y&&null!=d.componentDidUpdate&&d.__h.push(function(){d.componentDidUpdate(p,h,g)})}if(d.context=E,d.props=m,d.__P=e,d.__e=!1,D=Yw.__r,w=0,y){for(d.state=d.__s,d.__d=!1,D&&D(t),c=d.render(d.props,d.state,d.context),S=0;S<d._sb.length;S++)d.__h.push(d._sb[S]);d._sb=[]}else do{d.__d=!1,D&&D(t),c=d.render(d.props,d.state,d.context),d.state=d.__s}while(d.__d&&++w<25);d.state=d.__s,null!=d.getChildContext&&(r=dS(dS({},r),d.getChildContext())),y&&!f&&null!=d.getSnapshotBeforeUpdate&&(g=d.getSnapshotBeforeUpdate(p,h)),A=c,null!=c&&c.type===gS&&null==c.key&&(A=kS(c.props.children)),s=CS(e,cS(A)?A:[A],t,n,r,o,i,a,s,u,l),d.base=t.__e,t.__u&=-161,d.__h.length&&a.push(d),v&&(d.__E=d.__=null)}catch(e){if(t.__v=null,u||null!=i)if(e.then){for(t.__u|=u?160:128;s&&8==s.nodeType&&s.nextSibling;)s=s.nextSibling;i[i.indexOf(s)]=null,t.__e=s}else{for(x=i.length;x--;)fS(i[x]);BS(t)}else t.__e=n.__e,t.__k=n.__k,e.then||BS(t);Yw.__e(e,t,n)}else null==i&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=FS(n.__e,t,n,r,o,i,a,u,l);return(c=Yw.diffed)&&c(t),128&t.__u?void 0:s}function BS(e){e&&e.__c&&(e.__c.__e=!0),e&&e.__k&&e.__k.forEach(BS)}function TS(e,t,n){for(var r=0;r<n.length;r++)IS(n[r],n[++r],n[++r]);Yw.__c&&Yw.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){Yw.__e(e,t.__v)}})}function kS(e){return"object"!=typeof e||null==e||e.__b&&e.__b>0?e:cS(e)?e.map(kS):dS({},e)}function FS(e,t,n,r,o,i,a,s,u){var l,c,d,f,p,h,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(l=0;l<i.length;l++)if((p=i[l])&&"setAttribute"in p==!!y&&(y?p.localName==y:3==p.nodeType)){e=p,i[l]=null;break}if(null==e){if(null==y)return document.createTextNode(m);e=document.createElementNS(o,y,m.is&&m),s&&(Yw.__m&&Yw.__m(t,i),s=!1),i=null}if(null==y)v===m||s&&e.data==m||(e.data=m);else{if(i=i&&Kw.call(e.childNodes),v=n.props||sS,!s&&null!=i)for(v={},l=0;l<e.attributes.length;l++)v[(p=e.attributes[l]).name]=p.value;for(l in v)if(p=v[l],"children"==l);else if("dangerouslySetInnerHTML"==l)d=p;else if(!(l in m)){if("value"==l&&"defaultValue"in m||"checked"==l&&"defaultChecked"in m)continue;xS(e,l,null,p,o)}for(l in m)p=m[l],"children"==l?f=p:"dangerouslySetInnerHTML"==l?c=p:"value"==l?h=p:"checked"==l?g=p:s&&"function"!=typeof p||v[l]===p||xS(e,l,p,v[l],o);if(c)s||d&&(c.__html==d.__html||c.__html==e.innerHTML)||(e.innerHTML=c.__html),t.__k=[];else if(d&&(e.innerHTML=""),CS("template"==t.type?e.content:e,cS(f)?f:[f],t,n,r,"foreignObject"==y?"http://www.w3.org/1999/xhtml":o,i,a,i?i[0]:n.__k&&mS(n,0),s,u),null!=i)for(l=i.length;l--;)fS(i[l]);s||(l="value","progress"==y&&null==h?e.removeAttribute("value"):null!=h&&(h!==e[l]||"progress"==y&&!h||"option"==y&&h!=v[l])&&xS(e,l,h,v[l],o),l="checked",null!=g&&g!=e[l]&&xS(e,l,g,v[l],o))}return e}function IS(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){Yw.__e(e,n)}}function PS(e,t,n){var r,o;if(Yw.unmount&&Yw.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||IS(r,null,t)),null!=(r=e.__c)){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){Yw.__e(e,t)}r.base=r.__P=null}if(r=e.__k)for(o=0;o<r.length;o++)r[o]&&PS(r[o],t,n||"function"!=typeof e.type);n||fS(e.__e),e.__c=e.__=e.__e=void 0}function _S(e,t,n){return this.constructor(e,n)}function RS(e,t,n){var r,o,i,a;t==document&&(t=document.documentElement),Yw.__&&Yw.__(e,t),o=(r="function"==typeof n)?null:n&&n.__k||t.__k,i=[],a=[],NS(t,e=(!r&&n||t).__k=pS(gS,null,[e]),o||sS,sS,t.namespaceURI,!r&&n?[n]:o?null:t.firstChild?Kw.call(t.childNodes):null,i,!r&&n?n:o?o.__e:t.firstChild,r,a),TS(i,e,a)}Kw=uS.slice,Yw={__e:function(e,t,n,r){for(var o,i,a;t=t.__;)if((o=t.__c)&&!o.__)try{if((i=o.constructor)&&null!=i.getDerivedStateFromError&&(o.setState(i.getDerivedStateFromError(e)),a=o.__d),null!=o.componentDidCatch&&(o.componentDidCatch(e,r||{}),a=o.__d),a)return o.__E=o}catch(t){e=t}throw e}},Xw=0,Zw=function(e){return null!=e&&null==e.constructor},vS.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!=this.state?this.__s:this.__s=dS({},this.state),"function"==typeof e&&(e=e(dS({},n),this.props)),e&&dS(n,e),null!=e&&this.__v&&(t&&this._sb.push(t),bS(this))},vS.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),bS(this))},vS.prototype.render=gS,Jw=[],eS="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,tS=function(e,t){return e.__v.__b-t.__v.__b},ES.__r=0,nS=/(PointerCapture)$|Capture$/i,rS=0,oS=OS(!1),iS=OS(!0),aS=0;var LS,MS,jS,HS,zS,$S,US,VS,WS,GS,qS,KS=Object.freeze({__proto__:null,Component:vS,Fragment:gS,cloneElement:function(e,t,n){var r,o,i,a,s=dS({},e.props);for(i in e.type&&e.type.defaultProps&&(a=e.type.defaultProps),t)"key"==i?r=t[i]:"ref"==i?o=t[i]:s[i]=void 0===t[i]&&null!=a?a[i]:t[i];return arguments.length>2&&(s.children=arguments.length>3?Kw.call(arguments,2):n),hS(e.type,s,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,bS(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"+aS++,t.__=e,t.Provider=t.__l=(t.Consumer=function(e,t){return e.children(t)}).contextType=t,t},createElement:pS,createRef:function(){return{current:null}},h:pS,hydrate:function e(t,n){RS(t,n,e)},get isValidElement(){return Zw},get options(){return Yw},render:RS,toChildArray:function e(t,n){return n=n||[],null==t||"boolean"==typeof t||(cS(t)?t.some(function(t){e(t,n)}):n.push(t)),n}}),YS=E(KS);function XS(){if(HS)return jS;HS=1;const e=MS?LS:(MS=1,LS=function(e){return(null==e?void 0:e.nodeType)===Node.ELEMENT_NODE});return jS=function(t,n){return void 0===n&&(n=document),"string"==typeof t?n.querySelector(t):e(t)?t:null}}function ZS(){if(VS)return US;VS=1;const e=$w();return US=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 JS(){if(GS)return WS;GS=1;var e=YS;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=XS(),i=$S?zS:($S=1,zS=function(e){for(var t;e&&!e.dir;)e=e.parentNode;return null==(t=e)?void 0:t.dir}),a=ZS();var s=r("updateUI");class u extends a{constructor(){super(...arguments),Object.defineProperty(this,s,{writable:!0,value:void 0})}mount(n,r){const a=r.id,l=o(n);if(l){this.isTargetDOMEl=!0;const r=document.createElement("div");return r.classList.add("uppy-Root"),t(this,s)[s]=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 ${a} to a DOM element '${n}'`),this.opts.replaceTargetContent&&(l.innerHTML=""),(0,e.render)(this.render(this.uppy.getState()),r),this.el=r,l.appendChild(r),r.dir=this.opts.direction||i(r)||"ltr",this.onMount(),this.el}let c;if("object"==typeof n&&n instanceof u)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 ${a} to ${c.id}`),this.parent=c,this.el=c.addTarget(r),this.onMount(),this.el;this.uppy.log(`Not installing ${a}`);let d=`Invalid target option given to ${a}.`;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,s))[s])||n.call(r,e))}unmount(){var e;this.isTargetDOMEl&&(null==(e=this.el)||e.remove());this.onUnmount()}onMount(){}onUnmount(){}}return WS=u}var QS,eA,tA,nA,rA,oA,iA,aA,sA,uA,lA=(qS||(qS=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=ow();e.exports=qw();const r=JS();t.UIPlugin=r;const o=ZS();t.BasePlugin=o;const i=qw();t.Uppy=i;const a=JS(),s=ZS();i.Uppy=i,i.UIPlugin=a,i.BasePlugin=s,i.debugLogger=n.debugLogger}(nw,nw.exports)),nw.exports),cA=b(lA),dA={};function fA(){if(eA)return QS;eA=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 QS=e}function pA(){if(uA)return sA;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}uA=1;var n=0;function r(e){return"__private_"+n+++"_"+e}const o=function(){if(nA)return tA;nA=1;const e=fA();return tA=function(){return fetch(...arguments).catch(t=>{throw"AbortError"===t.name?t:new e(t)})},tA}(),i=function(){if(oA)return rA;oA=1;const e=zw();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 rA=t}(),a=function(){if(aA)return iA;aA=1;class e extends Error{constructor(){super("Authorization required"),this.name="AuthError",this.isAuthError=!0}}return iA=e}();async function s(e){if(401===e.status)throw new a;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 u=r("companionHeaders"),l=r("getPostResponseFunc"),c=r("getUrl"),d=r("errorHandler");e=Symbol.for("uppy test: getCompanionHeaders");class f{constructor(e,n){Object.defineProperty(this,d,{value:h}),Object.defineProperty(this,c,{value:p}),Object.defineProperty(this,u,{writable:!0,value:void 0}),Object.defineProperty(this,l,{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,u)[u]=null==n?void 0:n.companionHeaders}setCompanionHeaders(e){t(this,u)[u]=e}[e](){return t(this,u)[u]}get hostname(){const{companion:e}=this.uppy.getState(),t=this.opts.companionUrl;return(e&&e[t]?e[t]:t).replace(/\/$/,"")}headers(){return Promise.resolve({...f.defaultHeaders,...t(this,u)[u]})}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,l)[l](n)).then(s).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,l)[l](r)).then(s).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,l)[l](r)).then(s).catch(t(this,d)[d](i,e))}}function p(e){return/^(https?:|)\/\//.test(e)?e:`${this.hostname}/${e}`}function h(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 f.VERSION="2.2.2",f.defaultHeaders={Accept:"application/json","Content-Type":"application/json","Uppy-Versions":`@uppy/companion-client=${f.VERSION}`},sA=f}var hA,gA,vA,mA,yA,bA,EA,CA,DA={};function wA(){if(hA)return DA;return hA=1,Object.defineProperty(DA,"__esModule",{value:!0}),DA.getItem=function(e){return Promise.resolve(localStorage.getItem(e))},DA.removeItem=function(e){return new Promise(t=>{localStorage.removeItem(e),t()})},DA.setItem=function(e,t){return new Promise(n=>{localStorage.setItem(e,t),n()})},DA}function SA(){if(CA)return dA;CA=1,Object.defineProperty(dA,"__esModule",{value:!0}),dA.Socket=dA.SearchProvider=dA.RequestClient=dA.Provider=void 0;const e=pA();dA.RequestClient=e;const t=function(){if(vA)return gA;vA=1;var e=wA();const t=pA();return gA=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}},gA}();dA.Provider=t;const n=function(){if(yA)return mA;yA=1;const e=pA();return mA=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}`:""}`)}},mA}();dA.SearchProvider=n;const r=function(){if(EA)return bA;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}EA=1;var r=0;function o(e){return"__private_"+r+++"_"+e}const i=Uw();var a=o("queued"),s=o("emitter"),u=o("isOpen"),l=o("socket"),c=o("handleMessage");return e=Symbol.for("uppy test: getSocket"),t=Symbol.for("uppy test: getQueued"),bA=class{constructor(e){Object.defineProperty(this,a,{writable:!0,value:[]}),Object.defineProperty(this,s,{writable:!0,value:i()}),Object.defineProperty(this,u,{writable:!0,value:!1}),Object.defineProperty(this,l,{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,u)[u]}[e](){return n(this,l)[l]}[t](){return n(this,a)[a]}open(){n(this,l)[l]=new WebSocket(this.opts.target),n(this,l)[l].onopen=()=>{for(n(this,u)[u]=!0;n(this,a)[a].length>0&&n(this,u)[u];){const e=n(this,a)[a].shift();this.send(e.action,e.payload)}},n(this,l)[l].onclose=()=>{n(this,u)[u]=!1},n(this,l)[l].onmessage=n(this,c)[c]}close(){var e;null==(e=n(this,l)[l])||e.close()}send(e,t){n(this,u)[u]?n(this,l)[l].send(JSON.stringify({action:e,payload:t})):n(this,a)[a].push({action:e,payload:t})}on(e,t){n(this,s)[s].on(e,t)}emit(e,t){n(this,s)[s].emit(e,t)}once(e,t){n(this,s)[s].once(e,t)}},bA}();return dA.Socket=r,dA}var AA,xA,OA,NA,BA,TA,kA,FA,IA,PA,_A,RA,LA,MA,jA,HA,zA,$A={};function UA(){if(AA)return $A;function e(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}AA=1,Object.defineProperty($A,"__esModule",{value:!0}),$A.internalRateLimitedQueue=$A.RateLimitedQueue=void 0;var t=0;function n(e){return"__private_"+t+++"_"+e}var r=n("activeRequests"),o=n("queuedHandlers"),i=n("paused"),a=n("pauseTimer"),s=n("downLimit"),u=n("upperLimit"),l=n("rateLimitingTimer"),c=n("call"),d=n("queueNext"),f=n("next"),p=n("queue"),h=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,f)[f]())}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 E(t,n){void 0===n&&(n={});const r={fn:t,priority:n.priority||0,abort:()=>{e(this,h)[h](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 C(t){const n=e(this,o)[o].indexOf(t);-1!==n&&e(this,o)[o].splice(n,1)}$A.RateLimitedQueue=class{constructor(t){Object.defineProperty(this,h,{value:C}),Object.defineProperty(this,p,{value:E}),Object.defineProperty(this,f,{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,a,{writable:!0,value:void 0}),Object.defineProperty(this,s,{writable:!0,value:1}),Object.defineProperty(this,u,{writable:!0,value:void 0}),Object.defineProperty(this,l,{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,l)[l]=setTimeout(e(this,v)[v],0);else{e(this,s)[s]=this.limit,this.limit=Math.ceil((e(this,u)[u]+e(this,s)[s])/2);for(let t=e(this,s)[s];t<=this.limit;t++)e(this,d)[d]();e(this,u)[u]-e(this,s)[s]>3?e(this,l)[l]=setTimeout(e(this,v)[v],2e3):e(this,s)[s]=Math.floor(e(this,s)[s]/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 a;const s=new Promise((r,i)=>{a=n.run(()=>{let t,n;try{n=Promise.resolve(e(...o))}catch(e){n=Promise.reject(e)}return n.then(e=>{t?i(t):(a.done(),r(e))},e=>{t?i(t):(a.done(),i(e))}),()=>{t=new Error("Cancelled")}},t)});return s.abort=()=>{a.abort()},s}}resume(){e(this,i)[i]=!1,clearTimeout(e(this,a)[a]);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,a)[a]),null!=t&&(e(this,a)[a]=setTimeout(e(this,g)[g],t))}rateLimit(t){clearTimeout(e(this,l)[l]),this.pause(t),this.limit>1&&Number.isFinite(this.limit)&&(e(this,u)[u]=this.limit-1,this.limit=e(this,s)[s],e(this,l)[l]=setTimeout(e(this,v)[v],t))}get isPaused(){return e(this,i)[i]}};const D=Symbol("__queue");return $A.internalRateLimitedQueue=D,$A}function VA(){return jA?MA:(jA=1,MA={strings:{timedOut:"Upload stalled for %{seconds} seconds, aborting."}})}var WA=function(){if(zA)return HA;zA=1;var e=iw(),t=SA(),n=UA();const r=ZS(),o=function(){if(OA)return xA;OA=1;const e=SC();return xA=e(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})}(),i=BA?NA:(BA=1,NA=function(e){const t=/^(?:https?:\/\/|\/\/)?(?:[^@\n]+@)?(?:www\.)?([^\n]+)/i.exec(e)[1];return`${/^http:\/\//i.test(e)?"ws":"wss"}://${t}`}),a=kA?TA:(kA=1,TA=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}))}),s=function(){if(IA)return FA;function e(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}IA=1;var t=0;function n(e){return"__private_"+t+++"_"+e}var r=n("emitter"),o=n("events");return FA=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)}},FA}(),u=function(){if(_A)return PA;function e(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}_A=1;var t=0;function n(e){return"__private_"+t+++"_"+e}var r=n("aliveTimer"),o=n("isDone"),i=n("onTimedOut"),a=n("timeout");return PA=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,a,{writable:!0,value:void 0}),e(this,a)[a]=t,e(this,i)[i]=n}progress(){e(this,o)[o]||e(this,a)[a]>0&&(clearTimeout(e(this,r)[r]),e(this,r)[r]=setTimeout(e(this,i)[i],e(this,a)[a]))}done(){e(this,o)[o]||(clearTimeout(e(this,r)[r]),e(this,r)[r]=null,e(this,o)[o]=!0)}}}(),l=fA(),c=LA?RA:(LA=1,RA=function(e){return!!e&&(0!==e.readyState&&4!==e.readyState||0===e.status)}),d=VA();function f(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})),c(e)?(n=new l(n,e),n):(n.request=e,n)}function p(e){return e.data.slice(0,e.data.size,e.meta.type)}class h extends r{constructor(e,t){super(e,t),this.type="uploader",this.id=this.opts.id||"XHRUpload",this.title="XHRUpload",this.defaultLocale=d;const r={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 c(t)&&(n=new l(n,t)),n},validateStatus:e=>e>=200&&e<300};if(this.opts={...r,...t},this.i18nInit(),this.handleUpload=this.handleUpload.bind(this),n.internalRateLimitedQueue in this.opts?this.requests=this.opts[n.internalRateLimitedQueue]:this.requests=new n.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=p(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=p(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,a=new XMLHttpRequest;let l;this.uploaderEvents[t.id]=new s(this.uppy);const c=new u(o.timeout,()=>{a.abort(),l.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)();a.upload.addEventListener("loadstart",()=>{this.uppy.log(`[XHRUpload] ${d} started`)}),a.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})}),a.addEventListener("load",()=>{if(this.uppy.log(`[XHRUpload] ${d} finished`),c.done(),l.done(),this.uploaderEvents[t.id]&&(this.uploaderEvents[t.id].remove(),this.uploaderEvents[t.id]=null),o.validateStatus(a.status,a.responseText,a)){const e=o.getResponseData(a.responseText,a),r=e[o.responseUrlFieldName],i={status:a.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(a.responseText,a),i=f(a,o.getResponseError(a.responseText,a)),s={status:a.status,body:e};return this.uppy.emit("upload-error",t,i,s),r(i)}),a.addEventListener("error",()=>{this.uppy.log(`[XHRUpload] ${d} errored`),c.done(),l.done(),this.uploaderEvents[t.id]&&(this.uploaderEvents[t.id].remove(),this.uploaderEvents[t.id]=null);const e=f(a,o.getResponseError(a.responseText,a));return this.uppy.emit("upload-error",t,e),r(e)}),a.open(o.method.toUpperCase(),o.endpoint,!0),a.withCredentials=o.withCredentials,""!==o.responseType&&(a.responseType=o.responseType),l=this.requests.run(()=>{this.uppy.emit("upload-started",t);const e=this.getOptions(t);return Object.keys(e.headers).forEach(t=>{a.setRequestHeader(t,e.headers[t])}),a.send(i),()=>{c.done(),a.abort()}}),this.onFileRemove(t.id,()=>{l.abort(),r(new Error("File removed"))}),this.onCancelAll(t.id,e=>{let{reason:t}=e;"user"===t&&l.abort(),r(new Error("Upload cancelled"))})})}uploadRemote(e){const n=this.getOptions(e);return new Promise((r,a)=>{this.uppy.emit("upload-started",e);const u={};(Array.isArray(n.metaFields)?n.metaFields:Object.keys(e.meta)).forEach(t=>{u[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:u,httpMethod:n.method,useFormData:n.formData,headers:n.headers}).then(u=>{const{token:l}=u,c=i(e.remote.companionUrl),d=new t.Socket({target:`${c}/api/${l}`,autoOpen:!1});let f;this.uploaderEvents[e.id]=new s(this.uppy),this.onFileRemove(e.id,()=>{d.send("cancel",{}),f.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",{}),f.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=>o(this,t,e)),d.on("success",t=>{const o=n.getResponseData(t.response.responseText,t.response),i=o[n.responseUrlFieldName],a={status:t.response.status,body:o,uploadURL:i};return this.uppy.emit("upload-success",e,a),f.done(),this.uploaderEvents[e.id]&&(this.uploaderEvents[e.id].remove(),this.uploaderEvents[e.id]=null),r()}),d.on("error",t=>{const r=t.response,o=r?n.getResponseError(r.responseText,r):Object.assign(new Error(t.error.message),{cause:t.error});this.uppy.emit("upload-error",e,o),f.done(),this.uploaderEvents[e.id]&&(this.uploaderEvents[e.id].remove(),this.uploaderEvents[e.id]=null),a(o)}),f=this.requests.run(()=>(d.open(),e.isPaused&&d.send("pause",{}),()=>d.close()))}).catch(t=>{this.uppy.emit("upload-error",e,t),a(t)})})}uploadBundle(e){return new Promise((t,n)=>{const{endpoint:r}=this.opts,{method:o}=this.opts,i=this.uppy.getState().xhrUpload,a=this.createBundledUpload(e,{...this.opts,...i||{}}),s=new XMLHttpRequest,l=t=>{e.forEach(e=>{this.uppy.emit("upload-error",e,t)})},c=new u(this.opts.timeout,()=>{s.abort();const e=new Error(this.i18n("timedOut",{seconds:Math.ceil(this.opts.timeout/1e3)}));l(e),n(e)});s.upload.addEventListener("loadstart",()=>{this.uppy.log("[XHRUpload] started uploading bundle"),c.progress()}),s.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})})}),s.addEventListener("load",r=>{if(c.done(),this.opts.validateStatus(r.target.status,s.responseText,s)){const n=this.opts.getResponseData(s.responseText,s),o={status:r.target.status,body:n};return e.forEach(e=>{this.uppy.emit("upload-success",e,o)}),t()}const o=this.opts.getResponseError(s.responseText,s)||new Error("Upload error");return o.request=s,l(o),n(o)}),s.addEventListener("error",()=>{c.done();const e=this.opts.getResponseError(s.responseText,s)||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(),s.abort())}),s.open(o.toUpperCase(),r,!0),s.withCredentials=this.opts.withCredentials,""!==this.opts.responseType&&(s.responseType=this.opts.responseType),Object.keys(this.opts.headers).forEach(e=>{s.setRequestHeader(e,this.opts.headers[e])}),s.send(a),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[n.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 h.VERSION="2.1.3",HA=h}(),GA=b(WA);function qA(e){var t=e.server,n=void 0===t?"":t,r=e.fieldName,o=void 0===r?"":r,i=e.maxFileSize,a=void 0===i?10485760:i,s=e.maxNumberOfFiles,u=void 0===s?100:s,l=e.meta,c=void 0===l?{}:l,d=e.metaWithUrl,f=void 0!==d&&d,p=e.headers,h=void 0===p?{}:p,g=e.withCredentials,v=void 0!==g&&g,m=e.timeout,y=void 0===m?1e4:m,b=e.onBeforeUpload,E=void 0===b?function(e){return e}:b,C=e.onSuccess,D=void 0===C?function(e,t){}:C,w=e.onError,S=void 0===w?function(e,t,n){console.error("".concat(e.name," upload error"),t,n)}:w,A=e.onProgress,x=void 0===A?function(e){}:A;if(!n)throw new Error("Cannot get upload server address\n没有配置上传地址");if(!o)throw new Error("Cannot get fieldName\n没有配置 fieldName");var O=n;f&&(O=function(e,t){var n=Qg(e.split("#"),2),r=n[0],o=n[1],i=[];lv(t,function(e,t){i.push("".concat(t,"=").concat(e))});var a=i.join("&");return r=r.indexOf("?")>0?"".concat(r,"&").concat(a):"".concat(r,"?").concat(a),o?"".concat(r,"#").concat(o):r}(O,c));var N=new cA(Yg({onBeforeUpload:E,restrictions:{maxFileSize:a,maxNumberOfFiles:u},meta:c},e.uppyConfig)).use(GA,Yg({endpoint:O,headers:h,formData:!0,fieldName:o,bundle:!0,withCredentials:v,timeout:y},e.xhrConfig));return N.on("complete",function(e){var t=e.successful[0],n=t.response,r=(null!=n?n:{}).body,o=void 0===r?{}:r;try{D(t,o)}catch(e){console.error("wangEditor upload file - onSuccess error",e)}}),N.on("progress",function(e){e<1||x(e)}),N.on("upload-error",function(e,t,n){try{S(e,t,n)}catch(e){console.error("wangEditor upload file - onError error",e)}}),N.on("restriction-failed",function(e,t){try{S(e,t)}catch(e){console.error("wangEditor upload file - onError error",e)}}),N}YE("en",{editor:{more:"More",justify:"Justify",indent:"Indent",image:"Image",video:"Video"}}),YE("zh-CN",{editor:{more:"更多",justify:"对齐",indent:"缩进",image:"图片",video:"视频"}});var KA,YA,XA,ZA,JA,QA,ex,tx,nx,rx,ox,ix,ax,sx,ux,lx={};function cx(){if(YA)return KA;YA=1;var e=S();return KA=Array.isArray||function(t){return"Array"===e(t)}}function dx(){if(ZA)return XA;ZA=1;var e=w(),t=C(),n=me(),r=Tr(),o=zt(),i=An(),a=function(){},s=o("Reflect","construct"),u=/^\s*(?:class|function)\b/,l=e(u.exec),c=!u.test(a),d=function(e){if(!n(e))return!1;try{return s(a,[],e),!0}catch(e){return!1}},f=function(e){if(!n(e))return!1;switch(r(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return c||!!l(u,i(e))}catch(e){return!0}};return f.sham=!0,XA=!s||t(function(){var e;return d(d.call)||!d(Object)||!d(function(){e=!0})||e})?f:d}function fx(){if(QA)return JA;QA=1;var e=cx(),t=dx(),n=ye(),r=ve()("species"),o=Array;return JA=function(i){var a;return e(i)&&(a=i.constructor,(t(a)&&(a===o||e(a.prototype))||n(a)&&null===(a=a[r]))&&(a=void 0)),void 0===a?o:a},JA}function px(){if(tx)return ex;tx=1;var e=fx();return ex=function(t,n){return new(e(t))(0===n?0:n)}}function hx(){if(ix)return ox;ix=1;var e=C();return ox=function(t,n){var r=[][t];return!!r&&e(function(){r.call(null,n||function(){return 1},1)})}}function gx(){if(sx)return ax;sx=1;var e=function(){if(rx)return nx;rx=1;var e=Go(),t=w(),n=A(),r=ce(),o=Jt(),i=px(),a=t([].push),s=function(t){var s=1===t,u=2===t,l=3===t,c=4===t,d=6===t,f=7===t,p=5===t||d;return function(h,g,v,m){for(var y,b,E=r(h),C=n(E),D=o(C),w=e(g,v),S=0,A=m||i,x=s?A(h,D):u||f?A(h,0):void 0;D>S;S++)if((p||S in C)&&(b=w(y=C[S],S,E),t))if(s)x[S]=b;else if(b)switch(t){case 3:return!0;case 5:return y;case 6:return S;case 2:a(x,y)}else switch(t){case 4:return!1;case 7:a(x,y)}return d?-1:l||c?c:x}};return nx={forEach:s(0),map:s(1),filter:s(2),some:s(3),every:s(4),find:s(5),findIndex:s(6),filterReject:s(7)}}().forEach,t=hx()("forEach");return ax=t?[].forEach:function(t){return e(this,t,arguments.length>1?arguments[1]:void 0)},ax}!function(){if(ux)return lx;ux=1;var e=B(),t=ci(),n=di(),r=gx(),o=ln(),i=function(e){if(e&&e.forEach!==r)try{o(e,"forEach",r)}catch(t){e.forEach=r}};for(var a in t)t[a]&&i(e[a]&&e[a].prototype);i(n)}();YE("en",{common:{ok:"OK",delete:"Delete",enter:"Enter"},blockQuote:{title:"Quote"},codeBlock:{title:"Code block"},color:{color:"Font color",bgColor:"Back color",default:"Default color",clear:"Clear back color"},divider:{title:"Divider"},emotion:{title:"Emotion"},fontSize:{title:"Font size",default:"Default"},fontFamily:{title:"Font family",default:"Default"},fullScreen:{title:"Full screen",cancelTitle:"Cancel full screen"},header:{title:"Header",text:"Text"},image:{netImage:"Net image",delete:"Delete image",edit:"Edit image",editSize:"Edit size",viewLink:"View link",src:"Image src",desc:"Description",link:"Image link",ok:"Ok",width:"Width",height:"Height"},indent:{decrease:"Decrease",increase:"Increase"},justify:{left:"Left",right:"Right",center:"Center",justify:"Justify"},lineHeight:{title:"Line height",default:"Default"},link:{insert:"Insert link",text:"Link text",url:"Link source",unLink:"Unlink",edit:"Edit link",view:"View link"},textStyle:{bold:"Bold",clear:"Clear styles",code:"Inline code",italic:"Italic",sub:"Sub",sup:"Sup",through:"Through",underline:"Underline"},undo:{undo:"undo",redo:"Redo"},todo:{todo:"Todo"},formatPainter:{title:"Format Painter"}}),YE("zh-CN",{common:{ok:"确定",delete:"删除",enter:"回车"},blockQuote:{title:"引用"},codeBlock:{title:"代码块"},color:{color:"文字颜色",bgColor:"背景色",default:"默认颜色",clear:"清除背景色"},divider:{title:"分割线"},emotion:{title:"表情"},fontSize:{title:"字号",default:"默认字号"},fontFamily:{title:"字体",default:"默认字体"},fullScreen:{title:"全屏",cancelTitle:"取消全屏"},header:{title:"标题",text:"正文"},image:{netImage:"网络图片",delete:"删除图片",edit:"编辑图片",editSize:"修改尺寸",viewLink:"查看链接",src:"图片地址",desc:"图片描述",link:"图片链接",ok:"确定",width:"宽度",height:"高度"},indent:{decrease:"减少缩进",increase:"增加缩进"},justify:{left:"左对齐",right:"右对齐",center:"居中对齐",justify:"两端对齐"},lineHeight:{title:"行高",default:"默认行高"},link:{insert:"插入链接",text:"链接文本",url:"链接地址",unLink:"取消链接",edit:"修改链接",view:"查看链接"},textStyle:{bold:"粗体",clear:"清除格式",code:"行内代码",italic:"斜体",sub:"下标",sup:"上标",through:"删除线",underline:"下划线"},undo:{undo:"撤销",redo:"重做"},todo:{todo:"待办"},formatPainter:{title:"格式刷"}});var vx={type:"blockquote",elemToHtml:function(e,t){return"<blockquote>".concat(t,"</blockquote>")}},mx='<svg viewBox="0 0 1024 1024"><path d="M864 0a160 160 0 0 1 128 256l-64 64-224-224 64-64c26.752-20.096 59.968-32 96-32zM64 736l-64 288 288-64 592-592-224-224L64 736z m651.584-372.416l-448 448-55.168-55.168 448-448 55.168 55.168z"></path></svg>',yx='<svg viewBox="0 0 1024 1024"><path d="M924.402464 1023.068211H0.679665V99.345412h461.861399v98.909208H99.596867v725.896389h725.896389V561.206811h98.909208z" p-id="10909"></path><path d="M930.805104 22.977336l69.965436 69.965436-453.492405 453.492404-69.965435-69.901489z" p-id="10910"></path><path d="M1022.464381 304.030081h-98.917201V99.345412H709.230573V0.428211h313.233808z"></path></svg>',bx='<svg viewBox="0 0 1024 1024"><path d="M133.705143 335.433143V133.851429h201.581714a29.622857 29.622857 0 0 0 29.622857-29.549715V68.754286a29.622857 29.622857 0 0 0-29.622857-29.622857H61.732571A22.893714 22.893714 0 0 0 38.765714 62.025143V335.725714c0 16.310857 13.238857 29.622857 29.622857 29.622857h35.547429a29.842286 29.842286 0 0 0 29.696-29.842285zM690.980571 133.851429h201.581715v201.654857c0 16.310857 13.238857 29.549714 29.622857 29.549714h35.547428a29.622857 29.622857 0 0 0 29.549715-29.549714V61.952a22.893714 22.893714 0 0 0-22.820572-22.893714h-273.554285a29.622857 29.622857 0 0 0-29.549715 29.622857v35.547428c0 16.310857 13.238857 29.696 29.622857 29.696zM335.286857 892.781714H133.705143V691.2a29.622857 29.622857 0 0 0-29.622857-29.622857H68.534857a29.622857 29.622857 0 0 0-29.549714 29.622857v273.554286c0 12.653714 10.24 22.893714 22.820571 22.893714h273.554286a29.622857 29.622857 0 0 0 29.696-29.622857v-35.547429a29.769143 29.769143 0 0 0-29.769143-29.696z m557.348572-201.581714v201.581714H690.907429a29.622857 29.622857 0 0 0-29.622858 29.622857v35.547429c0 16.310857 13.238857 29.622857 29.622858 29.622857h273.554285c12.580571 0 22.893714-10.313143 22.893715-22.893714V691.2a29.622857 29.622857 0 0 0-29.622858-29.622857h-35.547428a29.622857 29.622857 0 0 0-29.696 29.622857z"></path></svg>',Ex=function(){function e(){this.title=QE("blockQuote.title"),this.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M894.6 907.1H605.4c-32.6 0-59-26.4-59-59V608.2l-4-14.9c0-315.9 125.5-485.1 376.5-507.5v59.8C752.7 180.4 711.3 315.8 711.3 442.4v41.2l31.5 12.3h151.8c32.6 0 59 26.4 59 59v293.2c0 32.5-26.4 59-59 59z m-472 0H133.4c-32.6 0-59-26.4-59-59V608.2l-4-14.9c0-315.9 125.5-485.1 376.5-507.5v59.8C280.7 180.4 239.3 315.8 239.3 442.4v41.2l31.5 12.3h151.8c32.6 0 59 26.4 59 59v293.2c0 32.5-26.4 59-59 59z"></path></svg>',this.tag="button"}return e.prototype.getValue=function(e){return""},e.prototype.isActive=function(e){return!!_y.getSelectedNodeByType(e,"blockquote")},e.prototype.isDisabled=function(e){if(null==e.selection)return!0;var t=Qg(Kh.nodes(e,{match:function(e){var t=_y.getNodeType(e);return"paragraph"===t||"blockquote"===t},universal:!0,mode:"highest"}),1);return!t[0]},e.prototype.exec=function(e,t){if(!this.isDisabled(e)){var n=this.isActive(e)?"paragraph":"blockquote";jg.setNodes(e,{type:n},{mode:"highest"})}},e}(),Cx={key:"blockquote",factory:function(){return new Ex}};function Dx(e){return 0===am("<div>".concat(e,"</div>")).children().filter(function(e){return"BR"!==e.tagName}).length}function wx(e){return 0===e.length?"":e[0].outerHTML}function Sx(e){return e.length?e[0].tagName.toLowerCase():""}function Ax(e,t){for(var n="",r=(e.attr("style")||"").split(";"),o=r.length,i=0;i<o;i+=1){var a=r[i];if(a){var s=a.split(":");s[0].trim()===t&&(n=s[1].trim())}}return n}Dm&&(am.fn.css=Dm),Nm&&(am.fn.append=Nm),Bm&&(am.fn.prepend=Bm),sm&&(am.fn.addClass=sm),um&&(am.fn.removeClass=um),lm&&(am.fn.hasClass=lm),gm&&(am.fn.on=gm),vm&&(am.fn.off=vm),jm&&(am.fn.focus=jm),cm&&(am.fn.attr=cm),dm&&(am.fn.removeAttr=dm),Em&&(am.fn.hide=Em),Cm&&(am.fn.show=Cm),km&&(am.fn.parents=km),pm&&(am.fn.dataset=pm),hm&&(am.fn.val=hm),xm&&(am.fn.text=xm),Am&&(am.fn.html=Am),Im&&(am.fn.children=Im),Pm&&(am.fn.remove=Pm),Fm&&(am.fn.find=Fm),mm&&(am.fn.width=mm),ym&&(am.fn.height=ym),Sm&&(am.fn.filter=Sm),_m&&(am.fn.empty=_m);var xx={selector:"blockquote:not([data-w-e-type])",parseElemHtml:function(e,t,n){var r=am(e);return 0===(t=t.filter(function(e){return!!Cg.isText(e)||!!n.isInline(e)})).length&&(t=[{text:r.text().replace(/\s+/gm," ")}]),{type:"blockquote",children:t}}};function Ox(e){e.deleteBackward("character");jg.insertNodes(e,{type:"paragraph",children:[{text:""}]},{mode:"highest"})}var Nx={type:"blockquote",renderElem:function(e,t,n){return ND("blockquote",null,t)}},Bx={renderElems:[Nx],elemsToHtml:[vx],parseElemsHtml:[xx],menus:[Cx],editorPlugin:function(e){var t=e.insertBreak,n=e.insertText,r=e;return r.insertBreak=function(){var o=r.selection;if(null==o)return t();var i=Qg(Kh.nodes(e,{match:function(e){return _y.checkNodeType(e,"blockquote")},universal:!0}),1),a=i[0];if(!a)return t();var s=a[0];if(_y.getParentNode(e,s)){var u=_y.findPath(e,s),l=Kh.end(e,u);if(ug.equals(l,o.focus)){var c=Kh.last(e,l.path),d=eg.string(c[0]);if(d&&"\n"===d.slice(-1))return void Ox(r)}n("\n")}else Ox(r)},r}};var Tx={type:"code",elemToHtml:function(e,t){return"<code>".concat(t,"</code>")}};var kx={type:"pre",elemToHtml:function(e,t){return"<pre>".concat(t,"</pre>")}},Fx=function(){function e(){this.title=QE("codeBlock.title"),this.iconSvg='<svg viewBox="0 0 1280 1024"><path d="M832 736l96 96 320-320L928 192l-96 96 224 224zM448 288l-96-96L32 512l320 320 96-96-224-224zM701.312 150.528l69.472 18.944-192 704.032-69.472-18.944 192-704.032z"></path></svg>',this.tag="button"}return e.prototype.getSelectCodeElem=function(e){var t=_y.getSelectedNodeByType(e,"code");if(null==t)return null;var n=_y.getParentNode(e,t);return null==n||"pre"!==_y.getNodeType(n)?null:t},e.prototype.getValue=function(e){var t=this.getSelectCodeElem(e);if(null==t){var n=e.getMenuConfig("codeSelectLang").codeLangs,r=(void 0===n?[]:n).find(function(e){return e.selected});return(null==r?void 0:r.value)||""}return t.language||""},e.prototype.isActive=function(e){return!!this.getSelectCodeElem(e)},e.prototype.isDisabled=function(e){if(null==e.selection)return!0;var t=_y.getSelectedElems(e);return!!t.some(function(t){return e.isVoid(t)})||!t.some(function(e){var t=_y.getNodeType(e);return"pre"===t||"paragraph"===t})},e.prototype.exec=function(e,t){this.isActive(e)?this.changeToPlainText(e):this.changeToCodeBlock(e,t.toString())},e.prototype.changeToPlainText=function(e){var t=this.getSelectCodeElem(e);if(null!=t){var n=eg.string(t);jg.removeNodes(e,{mode:"highest"});var r=n.split("\n").map(function(e){return{type:"paragraph",children:[{text:e}]}});jg.insertNodes(e,r,{mode:"highest"})}},e.prototype.changeToCodeBlock=function(e,t){var n,r,o=[],i=Kh.nodes(e,{match:function(t){return e.children.includes(t)},universal:!0});try{for(var a=Jg(i),s=a.next();!s.done;s=a.next()){var u=Qg(s.value,1)[0];u&&o.push(eg.string(u))}}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}jg.removeNodes(e,{mode:"highest"});var l={type:"pre",children:[{type:"code",language:t,children:[{text:o.join("\n")}]}]};jg.insertNodes(e,l,{mode:"highest"})},e}();var Ix={selector:"pre:not([data-w-e-type])",parseElemHtml:function(e,t,n){var r=am(e);return 0===(t=t.filter(function(e){return"code"===_y.getNodeType(e)})).length&&(t=[{type:"code",language:"",children:[{text:r[0].textContent||""}]}]),{type:"pre",children:t.filter(function(e){return"code"===_y.getNodeType(e)})}}};var Px={type:"pre",renderElem:function(e,t,n){return ND("pre",null,t)}},_x={type:"code",renderElem:function(e,t,n){return ND("code",null,t)}},Rx={menus:[{key:"codeBlock",factory:function(){return new Fx}}],editorPlugin:function(e){var t=e.insertBreak,n=e.normalizeNode,r=e.insertData,o=e.handleTab,i=e;return i.insertBreak=function(){var e=_y.getSelectedNodeByType(i,"code");if(null!=e){var n=function(e,t){var n=t.selection;if(null==n)return"";var r=eg.string(e),o=n.anchor.offset,i=r.slice(0,o).split("\n"),a=i.length;return 0===a?"":i[a-1]}(e,i);if(n){var r=n.match(/^\s+/);if(null!=r&&null!=r[0]){var o=r[0];return void i.insertText("\n".concat(o))}}i.insertText("\n")}else t()},e.handleTab=function(){var t=e.selection;if(t){var n=_y.getSelectedNodeByType(e,"code");if(n&&!fg.isCollapsed(t)){var r=Qg([t.anchor,t.focus].sort(function(e,t){return e.offset-t.offset}),2),i=r[0],a=r[1],s=n.children[0].text,u=s.split("\n"),l=s.slice(0,i.offset).split("\n").length-1,c=s.slice(0,a.offset).split("\n").length-1,d=u.map(function(e,t){return t>=l&&t<=c?" ".concat(e):e}),f=d.join("\n"),p={anchor:{path:i.path,offset:i.offset+2},focus:{path:a.path,offset:a.offset+2}};jg.insertText(e,f,{at:{anchor:{path:i.path,offset:0},focus:{path:a.path,offset:s.length}}}),jg.select(e,p)}else o()}},i.normalizeNode=function(e){var t=Qg(e,2),r=t[0],o=t[1],a=_y.getNodeType(r);("code"===a&&o.length<=1&&jg.setNodes(i,{type:"paragraph"},{at:o}),"pre"===a)&&(_y.isLastNode(i,r)&&jg.insertNodes(i,_y.genEmptyParagraph(),{at:[o[0]+1]}),"code"!==_y.getNodeType(r.children[0])&&(jg.unwrapNodes(i),jg.setNodes(i,{type:"paragraph"},{mode:"highest"})));return n([r,o])},i.insertData=function(e){if(null!=_y.getSelectedNodeByType(i,"code")){var t=e.getData("text/plain");Kh.insertText(i,t)}else r(e)},i},renderElems:[Px,_x],elemsToHtml:[Tx,kx],preParseHtml:[{selector:"pre>code",preParseHtml:function(e){var t=am(e);if("code"!==Sx(t))return e;var n=t.find("xmp");if(0===n.length)return e;var r=n.text();return n.remove(),t.text(r),t[0]}}],parseElemsHtml:[{selector:"pre:not([data-w-e-type])>code",parseElemHtml:function(e,t,n){return{type:"code",language:"",children:[{text:am(e)[0].textContent||""}]}}},Ix]},Lx=function(){function e(){this.tag="button",this.showDropPanel=!0,this.$content=null}return e.prototype.exec=function(e,t){},e.prototype.getValue=function(e){var t=this.mark,n=Kh.marks(e);return n&&n[t]?n[t]:""},e.prototype.isActive=function(e){return!!this.getValue(e)},e.prototype.isDisabled=function(e){if(null==e.selection)return!0;var t=Qg(Kh.nodes(e,{match:function(t){return"pre"===_y.getNodeType(t)||!!Kh.isVoid(e,t)},universal:!0}),1);return!!t[0]},e.prototype.getPanelContentElem=function(e){var t=this.mark;if(null==this.$content){var n=am('<ul class="w-e-panel-content-color"></ul>');n.on("click","li",function(n){var r=n.target;if(null!=r&&(n.preventDefault(),null!=e.selection)){var o=am(r).attr("data-value");"0"===o?Kh.removeMark(e,t):Kh.addMark(e,t,o)}}),this.$content=n}var r=this.$content;if(null==r)return document.createElement("ul");r.empty();var o=this.getValue(e),i=e.getMenuConfig(t).colors;(void 0===i?[]:i).forEach(function(e){var t=am('<div class="color-block" data-value="'.concat(e,'"></div>'));t.css("background-color",e);var n=am('<li data-value="'.concat(e,'"></li>'));o===e&&n.addClass("active"),n.append(t),r.append(n)});var a="";"color"===t&&(a=QE("color.default")),"bgColor"===t&&(a=QE("color.clear"));var s=am('\n <li data-value="0" class="clear">\n '.concat('<svg viewBox="0 0 1024 1024"><path d="M236.8 128L896 787.2V128H236.8z m614.4 704L192 172.8V832h659.2zM192 64h704c38.4 0 64 25.6 64 64v704c0 38.4-25.6 64-64 64H192c-38.4 0-64-25.6-64-64V128c0-38.4 25.6-64 64-64z"></path></svg>',"\n ").concat(a,"\n </li>\n "));return r.prepend(s),r[0]},e}(),Mx=function(e){function t(){var t=e.apply(this,ev([],Qg(arguments),!1))||this;return t.title=QE("color.bgColor"),t.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M510.030769 315.076923l84.676923 196.923077h-177.230769l76.8-196.923077h15.753846zM945.230769 157.538462v708.923076c0 43.323077-35.446154 78.769231-78.769231 78.769231H157.538462c-43.323077 0-78.769231-35.446154-78.769231-78.769231V157.538462c0-43.323077 35.446154-78.769231 78.769231-78.769231h708.923076c43.323077 0 78.769231 35.446154 78.769231 78.769231z m-108.307692 643.938461L600.615385 216.615385c-5.907692-11.815385-15.753846-19.692308-29.538462-19.692308h-139.815385c-11.815385 0-23.630769 7.876923-27.56923 19.692308l-216.615385 584.861538c-3.938462 11.815385 3.938462 25.6 17.723077 25.6h80.738462c11.815385 0 23.630769-9.846154 27.56923-21.661538l63.015385-175.261539h263.876923l68.923077 175.261539c3.938462 11.815385 15.753846 21.661538 27.569231 21.661538h80.738461c13.784615 0 23.630769-13.784615 19.692308-25.6z"></path></svg>',t.mark="bgColor",t}return Kg(t,e),t}(Lx),jx=function(e){function t(){var t=e.apply(this,ev([],Qg(arguments),!1))||this;return t.title=QE("color.color"),t.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M64 864h896v96H64zM360.58 576h302.85l81.53 224h102.16L579.24 64H444.77L176.89 800h102.16l81.53-224zM512 159.96L628.49 480H395.52L512 159.96z"></path></svg>',t.mark="color",t}return Kg(t,e),t}(Lx),Hx=["rgb(0, 0, 0)","rgb(38, 38, 38)","rgb(89, 89, 89)","rgb(140, 140, 140)","rgb(191, 191, 191)","rgb(217, 217, 217)","rgb(233, 233, 233)","rgb(245, 245, 245)","rgb(250, 250, 250)","rgb(255, 255, 255)","rgb(225, 60, 57)","rgb(231, 95, 51)","rgb(235, 144, 58)","rgb(245, 219, 77)","rgb(114, 192, 64)","rgb(89, 191, 192)","rgb(66, 144, 247)","rgb(54, 88, 226)","rgb(106, 57, 201)","rgb(216, 68, 147)","rgb(251, 233, 230)","rgb(252, 237, 225)","rgb(252, 239, 212)","rgb(252, 251, 207)","rgb(231, 246, 213)","rgb(218, 244, 240)","rgb(217, 237, 250)","rgb(224, 232, 250)","rgb(237, 225, 248)","rgb(246, 226, 234)","rgb(255, 163, 158)","rgb(255, 187, 150)","rgb(255, 213, 145)","rgb(255, 251, 143)","rgb(183, 235, 143)","rgb(135, 232, 222)","rgb(145, 213, 255)","rgb(173, 198, 255)","rgb(211, 173, 247)","rgb(255, 173, 210)","rgb(255, 77, 79)","rgb(255, 122, 69)","rgb(255, 169, 64)","rgb(255, 236, 61)","rgb(115, 209, 61)","rgb(54, 207, 201)","rgb(64, 169, 255)","rgb(89, 126, 247)","rgb(146, 84, 222)","rgb(247, 89, 171)","rgb(207, 19, 34)","rgb(212, 56, 13)","rgb(212, 107, 8)","rgb(212, 177, 6)","rgb(56, 158, 13)","rgb(8, 151, 156)","rgb(9, 109, 217)","rgb(29, 57, 196)","rgb(83, 29, 171)","rgb(196, 29, 127)","rgb(130, 0, 20)","rgb(135, 20, 0)","rgb(135, 56, 0)","rgb(97, 71, 0)","rgb(19, 82, 0)","rgb(0, 71, 79)","rgb(0, 58, 140)","rgb(6, 17, 120)","rgb(34, 7, 94)","rgb(120, 6, 80)"];var zx={selector:"font",preParseHtml:function(e){var t=am(e);if("font"!==Sx(t))return e;var n=t.attr("color")||"";return n&&(t.removeAttr("color"),t.css("color",n)),t[0]}};function $x(e,t){null==e.data&&(e.data={});var n=e.data;null==n.style&&(n.style={}),Object.assign(n.style,t)}var Ux={renderStyle:function(e,t){var n=e,r=n.color,o=n.bgColor,i=t;return r&&$x(i,{color:r}),o&&$x(i,{backgroundColor:o}),i},styleToHtml:function(e,t){if(!Cg.isText(e))return t;var n,r=e,o=r.color,i=r.bgColor;return o||i?((Dx(t)||"span"!==Sx(n=am(t)))&&(n=am("<span>".concat(t,"</span>"))),o&&n.css("color",o),i&&n.css("background-color",i),wx(n)):t},preParseHtml:[zx],parseStyleHtml:function(e,t,n){var r=am(e);if(!Cg.isText(t))return t;var o=t,i=Ax(r,"color");i&&(o.color=i);var a=Ax(r,"background-color");return a||(a=Ax(r,"background")),a&&(o.bgColor=a),o},menus:[{key:"color",factory:function(){return new jx},config:{colors:Hx}},{key:"bgColor",factory:function(){return new Mx},config:{colors:Hx}}]},Vx=function(){function e(){this.title=QE("common.enter"),this.iconSvg='<svg viewBox="0 0 1255 1024"><path d="M1095.111111 731.477333h-625.777778V1024L0 658.318222 469.333333 292.408889v292.636444h625.777778V0h156.444445v731.477333z"></path></svg>',this.tag="button"}return e.prototype.getValue=function(e){return""},e.prototype.isActive=function(e){return!1},e.prototype.isDisabled=function(e){var t=e.selection;return null==t||!!fg.isExpanded(t)},e.prototype.exec=function(e,t){var n=e.selection;if(null!=n){var r=[n.anchor.path[0]];jg.insertNodes(e,{type:"paragraph",children:[{text:""}]},{at:r}),e.select(Kh.start(e,r))}},e}(),Wx={menus:[{key:"enter",factory:function(){return new Vx}}]};var Gx={type:"divider",elemToHtml:function(e,t){return"<hr/>"}},qx=function(){function e(){this.title=QE("divider.title"),this.iconSvg='<svg viewBox="0 0 1092 1024"><path d="M0 51.2m51.2 0l989.866667 0q51.2 0 51.2 51.2l0 0q0 51.2-51.2 51.2l-989.866667 0q-51.2 0-51.2-51.2l0 0q0-51.2 51.2-51.2Z"></path><path d="M0 460.8m51.2 0l170.666667 0q51.2 0 51.2 51.2l0 0q0 51.2-51.2 51.2l-170.666667 0q-51.2 0-51.2-51.2l0 0q0-51.2 51.2-51.2Z"></path><path d="M819.2 460.8m51.2 0l170.666667 0q51.2 0 51.2 51.2l0 0q0 51.2-51.2 51.2l-170.666667 0q-51.2 0-51.2-51.2l0 0q0-51.2 51.2-51.2Z"></path><path d="M409.6 460.8m51.2 0l170.666667 0q51.2 0 51.2 51.2l0 0q0 51.2-51.2 51.2l-170.666667 0q-51.2 0-51.2-51.2l0 0q0-51.2 51.2-51.2Z"></path><path d="M0 870.4m51.2 0l989.866667 0q51.2 0 51.2 51.2l0 0q0 51.2-51.2 51.2l-989.866667 0q-51.2 0-51.2-51.2l0 0q0-51.2 51.2-51.2Z"></path></svg>',this.tag="button"}return e.prototype.getValue=function(e){return""},e.prototype.isActive=function(e){return!1},e.prototype.isDisabled=function(e){return null==e.selection||!!_y.getSelectedElems(e).some(function(t){if(e.isVoid(t))return!0;var n=_y.getNodeType(t);return"table"===n||"pre"===n})},e.prototype.exec=function(e,t){_y.isSelectedEmptyParagraph(e)&&jg.removeNodes(e,{mode:"highest"}),jg.insertNodes(e,{type:"divider",children:[{text:""}]},{mode:"highest"})},e}();var Kx={renderElems:[{type:"divider",renderElem:function(e,t,n){return uD("div",{props:{contentEditable:!1,className:"w-e-textarea-divider"},dataset:{selected:_y.isNodeSelected(n,e)?"true":""},style:{},on:{mousedown:function(e){return e.preventDefault()}}},[uD("hr")])}}],elemsToHtml:[Gx],parseElemsHtml:[{selector:"hr:not([data-w-e-type])",parseElemHtml:function(e,t,n){return{type:"divider",children:[{text:""}]}}}],menus:[{key:"divider",factory:function(){return new qx}}],editorPlugin:function(e){var t=e.isVoid,n=e.normalizeNode,r=e;return r.isVoid=function(e){return"divider"===e.type||t(e)},r.normalizeNode=function(e){var t=Qg(e,2),o=t[0],i=t[1];if("divider"!==_y.getNodeType(o))return n([o,i]);_y.isLastNode(r,o)&&jg.insertNodes(r,_y.genEmptyParagraph(),{at:[i[0]+1]})},r}};var Yx=function(){function e(){this.title=QE("emotion.title"),this.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M512 1024C230.4 1024 0 793.6 0 512S230.4 0 512 0s512 230.4 512 512-230.4 512-512 512z m0-102.4c226.742857 0 409.6-182.857143 409.6-409.6S738.742857 102.4 512 102.4 102.4 285.257143 102.4 512s182.857143 409.6 409.6 409.6z m-204.8-358.4h409.6c0 113.371429-91.428571 204.8-204.8 204.8s-204.8-91.428571-204.8-204.8z m0-102.4c-43.885714 0-76.8-32.914286-76.8-76.8s32.914286-76.8 76.8-76.8 76.8 32.914286 76.8 76.8-32.914286 76.8-76.8 76.8z m409.6 0c-43.885714 0-76.8-32.914286-76.8-76.8s32.914286-76.8 76.8-76.8c43.885714 0 76.8 32.914286 76.8 76.8s-32.914286 76.8-76.8 76.8z"></path></svg>',this.tag="button",this.showDropPanel=!0,this.$content=null}return e.prototype.exec=function(e,t){},e.prototype.getValue=function(e){return""},e.prototype.isActive=function(e){return!1},e.prototype.isDisabled=function(e){if(null==e.selection)return!0;var t=Qg(Kh.nodes(e,{match:function(t){return"pre"===_y.getNodeType(t)||!!Kh.isVoid(e,t)},universal:!0}),1);return!!t[0]},e.prototype.getPanelContentElem=function(e){if(null==this.$content){var t=am('<ul class="w-e-panel-content-emotion"></ul>');t.on("click","li",function(t){var n=t.target;if(null!=n){t.preventDefault();var r=am(n).text();e.insertText(r)}}),this.$content=t}var n=this.$content;if(null==n)return document.createElement("ul");n.empty();var r=e.getMenuConfig("emotion").emotions;return(void 0===r?[]:r).forEach(function(e){var t=am("<li>".concat(e,"</li>"));n.append(t)}),n[0]},e}(),Xx={menus:[{key:"emotion",factory:function(){return new Yx},config:{emotions:"😀 😃 😄 😁 😆 😅 😂 🤣 😊 😇 🙂 🙃 😉 😌 😍 😘 😗 😙 😚 😋 😛 😝 😜 🤓 😎 😏 😒 😞 😔 😟 😕 🙁 😣 😖 😫 😩 😢 😭 😤 😠 😡 😳 😱 😨 🤗 🤔 😶 😑 😬 🙄 😯 😴 😷 🤑 😈 🤡 💩 👻 💀 👀 👣 👐 🙌 👏 🤝 👍 👎 👊 ✊ 🤛 🤜 🤞 ✌️ 🤘 👌 👈 👉 👆 👇 ☝️ ✋ 🤚 🖐 🖖 👋 🤙 💪 🖕 ✍️ 🙏".split(" ")}}]};var Zx=function(){function e(){this.tag="select",this.width=80}return e.prototype.isActive=function(e){return!1},e.prototype.getValue=function(e){var t=this.mark,n=Kh.marks(e);return n&&n[t]?n[t]:""},e.prototype.isDisabled=function(e){if(null==e.selection)return!0;var t=Qg(Kh.nodes(e,{match:function(t){return"pre"===_y.getNodeType(t)||!!Kh.isVoid(e,t)},universal:!0}),1);return!!t[0]},e.prototype.exec=function(e,t){var n=this.mark;t?e.addMark(n,t):e.removeMark(n)},e}(),Jx=function(e){function t(){var t=e.apply(this,ev([],Qg(arguments),!1))||this;return t.title=QE("fontFamily.title"),t.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M956.788364 152.110545h-24.110546l23.924364 9.029819 0.186182 121.018181h-65.070546l-86.574545-130.048H566.551273v650.14691l130.048 64.977454v65.163636h-390.050909v-65.163636l129.954909-64.977454V152.110545H198.283636L111.429818 282.065455H46.545455V69.259636C46.545455 33.792 82.664727 22.062545 98.955636 22.062545h812.683637c23.738182 0 45.056 15.173818 45.056 41.053091V169.425455v-17.221819z"></path></svg>',t.mark="fontFamily",t.selectPanelWidth=150,t}return Kg(t,e),t.prototype.getOptions=function(e){var t=[],n=e.getMenuConfig(this.mark).fontFamilyList,r=void 0===n?[]:n;t.push({text:QE("fontFamily.default"),value:""}),r.forEach(function(e){if("string"==typeof e)t.push({text:e,value:e,styleForRenderMenuList:{"font-family":e}});else if("object"==typeof e){var n=e.name,r=e.value;t.push({text:n,value:r,styleForRenderMenuList:{"font-family":r}})}});var o=this.getValue(e),i=!1;return t.forEach(function(e){e.value===o?(i=!0,e.selected=!0):e.selected=void 0}),i||"string"!=typeof o||t.push({text:o,value:o,selected:!0}),t},t}(Zx),Qx=function(e){function t(){var t=e.apply(this,ev([],Qg(arguments),!1))||this;return t.title=QE("fontSize.title"),t.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M64 512h384v128h-128V1024h-128V640h-128z m896-256H708.2496v768h-136.4992V256H320V128h640z"></path></svg>',t.mark="fontSize",t}return Kg(t,e),t.prototype.getOptions=function(e){var t=[],n=e.getMenuConfig(this.mark).fontSizeList,r=void 0===n?[]:n;t.push({text:QE("fontSize.default"),value:""}),r.forEach(function(e){if("string"==typeof e)t.push({text:e,value:e});else if("object"==typeof e){var n=e.name,r=e.value;t.push({text:n,value:r})}});var o=this.getValue(e),i=!1;return t.forEach(function(e){e.value===o?(i=!0,e.selected=!0):e.selected=void 0}),i||"string"!=typeof o||t.push({text:o,value:o,selected:!0}),t},t}(Zx);var eO={1:"12px",2:"14px",3:"16px",4:"19px",5:"24px",6:"32px",7:"48px"};var tO={renderStyle:function(e,t){var n=e,r=n.fontSize,o=n.fontFamily,i=t;return r&&$x(i,{fontSize:r}),o&&$x(i,{fontFamily:o}),i},styleToHtml:function(e,t){if(!Cg.isText(e))return t;var n,r=e,o=r.fontSize,i=r.fontFamily;return o||i?((Dx(t)||"span"!==Sx(n=am(t)))&&(n=am("<span>".concat(t,"</span>"))),o&&n.css("font-size",o),i&&n.css("font-family",i),wx(n)):t},preParseHtml:[{selector:"font",preParseHtml:function(e){var t=am(e);if("font"!==Sx(t))return e;var n=t.attr("size")||"";n&&(t.removeAttr("size"),t.css("font-size",eO[n]));var r=t.attr("face")||"";return r&&(t.removeAttr("face"),t.css("font-family",r)),t[0]}}],parseStyleHtml:function(e,t,n){var r=am(e);if(!Cg.isText(t))return t;var o=t,i=Ax(r,"font-size");i&&(o.fontSize=i);var a=Ax(r,"font-family").replace(/"/g,"");return a&&(o.fontFamily=a),o},menus:[{key:"fontSize",factory:function(){return new Qx},config:{fontSizeList:["12px",{name:"13px",value:"13px"},"14px","15px","16px","19px",{name:"22px",value:"22px"},"24px","29px","32px","40px","48px"]}},{key:"fontFamily",factory:function(){return new Jx},config:{fontFamilyList:["黑体",{name:"仿宋",value:"仿宋"},"楷体","标楷体","华文仿宋","华文楷体",{name:"宋体",value:"宋体"},"微软雅黑","Arial","Tahoma","Verdana","Times New Roman","Courier New"]}}]};var nO=function(){function e(){this.title=QE("formatPainter.title"),this.iconSvg='<svg viewBox="0 0 24 24"><path d="M8 19.997v-5h2v5h9v-7H5v7zm-4-9h16v-3h-6v-4h-4v4H4zm-1 10v-8H2v-6a1 1 0 0 1 1-1h5v-3a1 1 0 0 1 1-1h6a1 1 0 0 1 1 1v3h5a1 1 0 0 1 1 1v6h-1v8a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1"/></svg>',this.tag="button"}return e.prototype.getValue=function(e){return""},e.prototype.isActive=function(t){return e.attrs.isSelect},e.prototype.isDisabled=function(e){return!1},e.prototype.setFormatHtml=function(t){var n,r;if(t.getSelectionText().length){if(e.attrs.formatStyle){!function(e){var t=Kh.marks(e);t&&Object.keys(t).forEach(function(t){e.removeMark(t)})}(t);try{for(var o=Jg(Object.entries(e.attrs.formatStyle)),i=o.next();!i.done;i=o.next()){var a=Qg(i.value,2),s=a[0],u=a[1];t.addMark(s,u)}}catch(e){n={error:e}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}}e.attrs.formatStyle=null,e.attrs.isSelect=!1}},e.prototype.exec=function(t){e.attrs.isSelect?(e.attrs.isSelect=!1,e.attrs.formatStyle=null):t.getSelectionText().length&&(e.attrs.formatStyle=Kh.marks(t),e.attrs.isSelect=!0);t.blur(),t.focus()},e.attrs={isSelect:!1,formatStyle:null},e}();var rO={menus:[{key:"formatPainter",factory:function(){return new nO}}],editorPlugin:function(e){var t=new nO,n=e.onChange,r=e,o=function(){t.setFormatHtml(r),document.removeEventListener("mouseup",o)};return r.onChange=function(){n(),nO.attrs.isSelect&&(document.removeEventListener("mouseup",o),document.addEventListener("mouseup",o))},r}},oO=function(){function e(){this.title=QE("fullScreen.title"),this.iconSvg=bx,this.tag="button",this.alwaysEnable=!0}return e.prototype.getValue=function(e){return""},e.prototype.isActive=function(e){return e.isFullScreen},e.prototype.isDisabled=function(e){return!1},e.prototype.getIcon=function(e){return e.isFullScreen?bx:'<svg t="1723361745825" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="8705" width="200" height="200"><path d="M703.926857 362.642286a42.642286 42.642286 0 0 1-42.642286-42.642286V128a42.642286 42.642286 0 1 1 85.357715 0v149.357714h149.357714c21.211429 0 38.765714 15.433143 42.057143 35.693715l0.585143 6.948571a42.642286 42.642286 0 0 1-42.642286 42.642286H703.926857zM703.926857 938.642286a42.642286 42.642286 0 0 1-42.642286-42.642286V704c0-23.552 19.090286-42.642286 42.642286-42.642286h192.073143a42.642286 42.642286 0 1 1 0 85.284572l-149.357714 0.073143v149.284571c0 21.211429-15.506286 38.765714-35.84 42.130286l-6.875429 0.512zM319.853714 938.642286a42.642286 42.642286 0 0 1-42.642285-42.642286v-149.284571H127.853714a42.642286 42.642286 0 0 1-42.130285-35.84l-0.585143-6.875429c0-23.552 19.163429-42.642286 42.715428-42.642286h192c23.552 0 42.715429 19.017143 42.715429 42.642286v192a42.642286 42.642286 0 0 1-42.715429 42.642286zM127.853714 362.642286a42.642286 42.642286 0 1 1 0-85.284572H277.211429V128c0-21.211429 15.433143-38.765714 35.766857-42.130286l6.875428-0.512c23.552 0 42.715429 19.017143 42.715429 42.642286v192a42.642286 42.642286 0 0 1-42.715429 42.642286H127.853714z" fill="#333333" p-id="8706"></path></svg>'},e.prototype.getTitle=function(e){return e.isFullScreen?QE("fullScreen.title"):QE("fullScreen.cancelTitle")},e.prototype.exec=function(e,t){e.isFullScreen?e.unFullScreen():e.fullScreen()},e}(),iO={menus:[{key:"fullScreen",factory:function(){return new oO}}]};function aO(e){return function(t,n){return"<h".concat(e,">").concat(n,"</h").concat(e,">")}}var sO={type:"header1",elemToHtml:aO(1)},uO={type:"header2",elemToHtml:aO(2)},lO={type:"header3",elemToHtml:aO(3)},cO={type:"header4",elemToHtml:aO(4)},dO={type:"header5",elemToHtml:aO(5)},fO={type:"header6",elemToHtml:aO(6)};function pO(e){var t=Qg(Kh.nodes(e,{match:function(e){return _y.getNodeType(e).startsWith("header")},universal:!0}),1),n=t[0];if(null==n)return"paragraph";var r=Qg(n,1)[0];return _y.getNodeType(r)}function hO(e){if(null==e.selection)return!0;var t=Qg(Kh.nodes(e,{match:function(e){var t=_y.getNodeType(e);return"paragraph"===t||!!t.startsWith("header")},universal:!0,mode:"highest"}),1);return!t[0]}function gO(e,t){t&&jg.setNodes(e,{type:t})}var vO=function(){function e(){this.tag="button"}return e.prototype.getValue=function(e){return pO(e)},e.prototype.isActive=function(e){return this.getValue(e)===this.type},e.prototype.isDisabled=function(e){return hO(e)},e.prototype.exec=function(e,t){var n=this.type;gO(e,t===n?"paragraph":n)},e}(),mO=function(e){function t(){var t=e.apply(this,ev([],Qg(arguments),!1))||this;return t.title="H1",t.type="header1",t}return Kg(t,e),t}(vO),yO=function(e){function t(){var t=e.apply(this,ev([],Qg(arguments),!1))||this;return t.title="H2",t.type="header2",t}return Kg(t,e),t}(vO),bO=function(e){function t(){var t=e.apply(this,ev([],Qg(arguments),!1))||this;return t.title="H3",t.type="header3",t}return Kg(t,e),t}(vO),EO=function(e){function t(){var t=e.apply(this,ev([],Qg(arguments),!1))||this;return t.title="H4",t.type="header4",t}return Kg(t,e),t}(vO),CO=function(e){function t(){var t=e.apply(this,ev([],Qg(arguments),!1))||this;return t.title="H5",t.type="header5",t}return Kg(t,e),t}(vO),DO=function(e){function t(){var t=e.apply(this,ev([],Qg(arguments),!1))||this;return t.title="H6",t.type="header6",t}return Kg(t,e),t}(vO),wO=function(){function e(){this.title=QE("header.title"),this.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M960 960c-51.2 0-102.4-3.2-153.6-3.2-51.2 0-99.2 3.2-150.4 3.2-19.2 0-28.8-22.4-28.8-38.4 0-51.2 57.6-28.8 86.4-48 19.2-12.8 19.2-60.8 19.2-80v-224-19.2c-9.6-3.2-19.2-3.2-28.8-3.2H320c-9.6 0-19.2 0-28.8 3.2V780.8c0 22.4 0 80 22.4 92.8 28.8 19.2 96-6.4 96 44.8 0 16-9.6 41.6-28.8 41.6-54.4 0-105.6-3.2-160-3.2-48 0-96 3.2-147.2 3.2-19.2 0-28.8-22.4-28.8-38.4 0-51.2 51.2-28.8 80-48 19.2-12.8 19.2-60.8 19.2-83.2V294.4c0-28.8 3.2-115.2-22.4-131.2-25.6-16-86.4 9.6-86.4-41.6 0-16 6.4-41.6 28.8-41.6 51.2 0 105.6 3.2 156.8 3.2 48 0 96-3.2 144-3.2 19.2 0 28.8 22.4 28.8 41.6 0 48-57.6 25.6-83.2 41.6-19.2 12.8-19.2 73.6-19.2 92.8v201.6c6.4 3.2 16 3.2 22.4 3.2h400c6.4 0 12.8 0 22.4-3.2V256c0-22.4 0-80-19.2-92.8-28.8-16-86.4 6.4-86.4-41.6 0-16 9.6-41.6 28.8-41.6 51.2 0 99.2 3.2 150.4 3.2 48 0 99.2-3.2 147.2-3.2 19.2 0 28.8 22.4 28.8 41.6 0 51.2-57.6 25.6-86.4 41.6-19.2 12.8-19.2 70.4-19.2 92.8v537.6c0 19.2 0 67.2 19.2 80 28.8 19.2 89.6-6.4 89.6 44.8 0 19.2-6.4 41.6-28.8 41.6z"></path></svg>',this.tag="select",this.width=60}return e.prototype.getOptions=function(e){var t=[{value:"header1",text:"H1",styleForRenderMenuList:{"font-size":"32px","font-weight":"bold"}},{value:"header2",text:"H2",styleForRenderMenuList:{"font-size":"24px","font-weight":"bold"}},{value:"header3",text:"H3",styleForRenderMenuList:{"font-size":"18px","font-weight":"bold"}},{value:"header4",text:"H4",styleForRenderMenuList:{"font-size":"16px","font-weight":"bold"}},{value:"header5",text:"H5",styleForRenderMenuList:{"font-size":"13px","font-weight":"bold"}},{value:"header6",text:"H6",styleForRenderMenuList:{"font-size":"11px","font-weight":"bold"}},{value:"paragraph",text:QE("header.text")}],n=this.getValue(e).toString();return t.forEach(function(e){e.value===n?e.selected=!0:e.selected=void 0}),t},e.prototype.isActive=function(e){return!1},e.prototype.getValue=function(e){return pO(e)},e.prototype.isDisabled=function(e){return hO(e)},e.prototype.exec=function(e,t){gO(e,t.toString())},e}(),SO={key:"headerSelect",factory:function(){return new wO}},AO={key:"header1",factory:function(){return new mO}},xO={key:"header2",factory:function(){return new yO}},OO={key:"header3",factory:function(){return new bO}},NO={key:"header4",factory:function(){return new EO}},BO={key:"header5",factory:function(){return new CO}},TO={key:"header6",factory:function(){return new DO}};function kO(e){return function(t,n,r){var o=am(t);return 0===(n=n.filter(function(e){return!!Cg.isText(e)||!!r.isInline(e)})).length&&(n=[{text:o.text().replace(/\s+/gm," ")}]),{type:"header".concat(e),children:n}}}var FO={selector:"h1:not([data-w-e-type])",parseElemHtml:kO(1)},IO={selector:"h2:not([data-w-e-type])",parseElemHtml:kO(2)},PO={selector:"h3:not([data-w-e-type])",parseElemHtml:kO(3)},_O={selector:"h4:not([data-w-e-type])",parseElemHtml:kO(4)},RO={selector:"h5:not([data-w-e-type])",parseElemHtml:kO(5)},LO={selector:"h6:not([data-w-e-type])",parseElemHtml:kO(6)};function MO(e){return function(t,n,r){return ND("h".concat(e),null,n)}}var jO={renderElems:[{type:"header1",renderElem:MO(1)},{type:"header2",renderElem:MO(2)},{type:"header3",renderElem:MO(3)},{type:"header4",renderElem:MO(4)},{type:"header5",renderElem:MO(5)},{type:"header6",renderElem:MO(6)}],elemsToHtml:[sO,uO,lO,cO,dO,fO],parseElemsHtml:[FO,IO,PO,_O,RO,LO],menus:[SO,AO,xO,OO,NO,BO,TO],editorPlugin:function(e){var t=e.insertBreak,n=e;return n.insertBreak=function(){var r=Qg(Kh.nodes(n,{match:function(e){return _y.getNodeType(e).startsWith("header")},universal:!0}),1),o=r[0];if(o)if(_y.isSelectionAtLineEnd(e,o[1])){jg.insertNodes(n,{type:"paragraph",children:[{text:""}]},{mode:"highest"})}else t();else t()},n}};var HO={type:"image",elemToHtml:function(e,t){var n=e,r=n.src,o=n.alt,i=void 0===o?"":o,a=n.href,s=void 0===a?"":a,u=n.width,l=void 0===u?"":u,c=n.height,d=void 0===c?"":c,f=n.style,p=void 0===f?{}:f,h=p.width,g=void 0===h?"":h,v=p.height,m=void 0===v?"":v,y="";return g&&(y+="width: ".concat(g,";")),m&&(y+="height: ".concat(m,";")),'<img src="'.concat(r,'" alt="').concat(i,'" data-href="').concat(s,'" width="').concat(l,'" height="').concat(d,'" style="').concat(y,'"/>')}};var zO=function(){function e(){this.title=QE("image.delete"),this.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M826.8032 356.5312c-19.328 0-36.3776 15.6928-36.3776 35.0464v524.2624c0 19.328-16 34.56-35.328 34.56H264.9344c-19.328 0-35.5072-15.3088-35.5072-34.56V390.0416c0-19.328-14.1568-35.0464-33.5104-35.0464s-33.5104 15.6928-33.5104 35.0464V915.712c0 57.9328 44.6208 108.288 102.528 108.288H755.2c57.9328 0 108.0832-50.4576 108.0832-108.288V391.4752c-0.1024-19.2512-17.1264-34.944-36.48-34.944z" p-id="9577"></path><path d="M437.1712 775.7568V390.6048c0-19.328-14.1568-35.0464-33.5104-35.0464s-33.5104 15.616-33.5104 35.0464v385.152c0 19.328 14.1568 35.0464 33.5104 35.0464s33.5104-15.7184 33.5104-35.0464zM649.7024 775.7568V390.6048c0-19.328-17.0496-35.0464-36.3776-35.0464s-36.3776 15.616-36.3776 35.0464v385.152c0 19.328 17.0496 35.0464 36.3776 35.0464s36.3776-15.7184 36.3776-35.0464zM965.0432 217.0368h-174.6176V145.5104c0-57.9328-47.2064-101.76-104.6528-101.76h-350.976c-57.8304 0-105.3952 43.8528-105.3952 101.76v71.5264H54.784c-19.4304 0-35.0464 14.1568-35.0464 33.5104 0 19.328 15.616 33.5104 35.0464 33.5104h910.3616c19.328 0 35.0464-14.1568 35.0464-33.5104 0-19.3536-15.6928-33.5104-35.1488-33.5104z m-247.3728 0H297.3952V145.5104c0-19.328 18.2016-34.7648 37.4272-34.7648h350.976c19.1488 0 31.872 15.1296 31.872 34.7648v71.5264z"></path></svg>',this.tag="button"}return e.prototype.getValue=function(e){return""},e.prototype.isActive=function(e){return!1},e.prototype.isDisabled=function(e){return null==e.selection||null==_y.getSelectedNodeByType(e,"image")},e.prototype.exec=function(e,t){this.isDisabled(e)||jg.removeNodes(e,{match:function(e){return _y.checkNodeType(e,"image")}})},e}();function $O(e){return void 0===e&&(e="r"),"".concat(e,"-").concat(zm())}function UO(e){return e.replace(/</g,"<").replace(/>/g,">")}function VO(e){var t=e.selection;if(null==t)return!0;if(!fg.isCollapsed(t))return!0;var n=Qg(Kh.nodes(e,{match:function(t){var n=_y.getNodeType(t);return"code"===n||("pre"===n||("link"===n||("list-item"===n||(!!n.startsWith("header")||("blockquote"===n||!!Kh.isVoid(e,t))))))},universal:!0}),1);return!!n[0]}function WO(e,t,n){return Xg(this,arguments,void 0,function(e,t,n,r,o){var i,a;return void 0===r&&(r=""),void 0===o&&(o=""),Zg(this,function(s){switch(s.label){case 0:return(i=t.getMenuConfig(e).checkImage)?[4,i(n,r,o)]:[3,2];case 1:if("string"==typeof(a=s.sent()))return t.alert(a,"error"),[2,!1];if(null==a)return[2,!1];s.label=2;case 2:return[2,!0]}})})}function GO(e,t,n){return Xg(this,void 0,void 0,function(){var r;return Zg(this,function(o){switch(o.label){case 0:return(r=t.getMenuConfig(e).parseImageSrc)?[4,r(n)]:[3,2];case 1:return[2,o.sent()];case 2:return[2,n]}})})}function qO(e,t){return Xg(this,arguments,void 0,function(e,t,n,r){var o,i,a;return void 0===n&&(n=""),void 0===r&&(r=""),Zg(this,function(s){switch(s.label){case 0:return[4,WO("insertImage",e,t,n,r)];case 1:return s.sent()?[4,GO("insertImage",e,t)]:[2];case 2:return o=s.sent(),i={type:"image",src:UO(o),href:r,alt:n,style:{},children:[{text:""}]},null===e.selection&&e.restoreSelection(),_y.getSelectedNodeByType(e,"image")&&e.move(1),VO(e)?[2]:(jg.insertNodes(e,i),(a=e.getMenuConfig("insertImage").onInsertedImage)&&a(i),[2])}})})}function KO(){return $O("w-e-edit-image")}var YO=function(){function e(){this.title=QE("image.edit"),this.iconSvg=mx,this.tag="button",this.showModal=!0,this.modalWidth=300,this.$content=null,this.srcInputId=KO(),this.altInputId=KO(),this.hrefInputId=KO(),this.buttonId=KO()}return e.prototype.getValue=function(e){return""},e.prototype.getImageNode=function(e){return _y.getSelectedNodeByType(e,"image")},e.prototype.isActive=function(e){return!1},e.prototype.exec=function(e,t){},e.prototype.isDisabled=function(e){var t=e.selection;return null==t||(!fg.isCollapsed(t)||null==_y.getSelectedNodeByType(e,"image"))},e.prototype.getModalPositionNode=function(e){return this.getImageNode(e)},e.prototype.getModalContentElem=function(e){var t=this,n=this,r=n.srcInputId,o=n.altInputId,i=n.hrefInputId,a=n.buttonId,s=this.getImageNode(e);if(null==s)throw new Error("Not found selected image node");var u=Qg(cC(QE("image.src"),r),2),l=u[0],c=am(u[1]),d=Qg(cC(QE("image.desc"),o),2),f=d[0],p=am(d[1]),h=Qg(cC(QE("image.link"),i),2),g=h[0],v=am(h[1]),m=Qg(fC(a,QE("common.ok")),1)[0];if(null==this.$content){var y=am("<div></div>");y.on("click","#".concat(a),function(n){n.preventDefault();var a=y.find("#".concat(r)).val(),s=y.find("#".concat(o)).val(),u=y.find("#".concat(i)).val();t.updateImage(e,a,s,u),e.hidePanelOrModal()}),this.$content=y}var b=this.$content;b.empty(),b.append(l),b.append(f),b.append(g),b.append(m);var E=s,C=E.src,D=E.alt,w=void 0===D?"":D,S=E.href,A=void 0===S?"":S;return c.val(C),p.val(w),v.val(A),setTimeout(function(){c.focus()}),b[0]},e.prototype.updateImage=function(e,t,n,r,o){void 0===n&&(n=""),void 0===r&&(r=""),void 0===o&&(o={}),t&&(e.restoreSelection(),this.isDisabled(e)||function(e,t){Xg(this,arguments,void 0,function(e,t,n,r,o){var i,a,s,u,l,c;return void 0===n&&(n=""),void 0===r&&(r=""),void 0===o&&(o={}),Zg(this,function(d){switch(d.label){case 0:return[4,WO("editImage",e,t,n,r)];case 1:return d.sent()?[4,GO("editImage",e,t)]:[2];case 2:return i=d.sent(),null==(a=_y.getSelectedNodeByType(e,"image"))||(s=a.style,u={src:i,alt:n,href:r,style:Yg(Yg({},void 0===s?{}:s),o)},jg.setNodes(e,u,{match:function(e){return _y.checkNodeType(e,"image")}}),l=_y.getSelectedNodeByType(e,"image"),(c=e.getMenuConfig("editImage").onUpdatedImage)&&c(l)),[2]}})})}(e,t,n,r,o))},e}();function XO(){return $O("w-e-insert-image")}var ZO=function(){function e(){this.title=QE("image.editSize"),this.tag="button",this.showModal=!0,this.modalWidth=320,this.$content=null,this.widthInputId=XO(),this.heightInputId=XO(),this.buttonId=XO()}return e.prototype.getSelectedImageNode=function(e){return _y.getSelectedNodeByType(e,"image")},e.prototype.getValue=function(e){return""},e.prototype.isActive=function(e){return!1},e.prototype.exec=function(e,t){},e.prototype.isDisabled=function(e){return null==e.selection||null==this.getSelectedImageNode(e)},e.prototype.getModalPositionNode=function(e){return this.getSelectedImageNode(e)},e.prototype.getModalContentElem=function(e){var t=this,n=t.widthInputId,r=t.heightInputId,o=t.buttonId,i=Qg(cC(QE("image.width"),n,"auto"),2),a=i[0],s=am(i[1]),u=Qg(cC(QE("image.height"),r,"auto"),2),l=u[0],c=am(u[1]),d=Qg(fC(o,QE("image.ok")),1)[0],f=this.getSelectedImageNode(e);if(null==this.$content){var p=am("<div></div>");p.on("click","#".concat(o),function(t){t.preventDefault();var o=p.find("#".concat(n)).val().trim(),i=p.find("#".concat(r)).val().trim(),a=function(e){return/^\d+(\.\d+)?%$/.test(e)},s=function(e){return/^\d+(\.\d+)?$/.test(e)},u=function(e){return/^\d+(\.\d+)?px$/.test(e)},l="auto",c="auto";a(o)?l=o:s(o)?l="".concat(parseInt(o,10),"px"):u(o)&&(l=o),a(i)?c=i:s(i)?c="".concat(parseInt(i,10),"px"):u(i)&&(c=i);var d=f.style,h=void 0===d?{}:d;e.restoreSelection();var g=Yg(Yg({},h),{style:{width:l,height:c}});jg.setNodes(e,g,{match:function(e){return _y.checkNodeType(e,"image")}}),e.hidePanelOrModal()}),this.$content=p}var h=this.$content;if(h.empty(),h.append(a),h.append(l),h.append(d),null==f)return h[0];var g=f.style,v=void 0===g?{}:g,m=v.width,y=void 0===m?"auto":m,b=v.height,E=void 0===b?"auto":b;return s.val(y),c.val(E),setTimeout(function(){s.focus()}),h[0]},e}();function JO(){return $O("w-e-insert-image")}var QO=function(){function e(){this.title=QE("image.netImage"),this.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M959.877 128l0.123 0.123v767.775l-0.123 0.122H64.102l-0.122-0.122V128.123l0.122-0.123h895.775zM960 64H64C28.795 64 0 92.795 0 128v768c0 35.205 28.795 64 64 64h896c35.205 0 64-28.795 64-64V128c0-35.205-28.795-64-64-64zM832 288.01c0 53.023-42.988 96.01-96.01 96.01s-96.01-42.987-96.01-96.01S682.967 192 735.99 192 832 234.988 832 288.01zM896 832H128V704l224.01-384 256 320h64l224.01-192z"></path></svg>',this.tag="button",this.showModal=!0,this.modalWidth=300,this.$content=null,this.srcInputId=JO(),this.altInputId=JO(),this.hrefInputId=JO(),this.buttonId=JO()}return e.prototype.getValue=function(e){return""},e.prototype.isActive=function(e){return!1},e.prototype.exec=function(e,t){},e.prototype.isDisabled=function(e){return VO(e)},e.prototype.getModalPositionNode=function(e){return null},e.prototype.getModalContentElem=function(e){var t=this,n=this,r=n.srcInputId,o=n.altInputId,i=n.hrefInputId,a=n.buttonId,s=Qg(cC(QE("image.src"),r),2),u=s[0],l=am(s[1]),c=Qg(cC(QE("image.desc"),o),2),d=c[0],f=am(c[1]),p=Qg(cC(QE("image.link"),i),2),h=p[0],g=am(p[1]),v=Qg(fC(a,QE("common.ok")),1)[0];if(null==this.$content){var m=am("<div></div>");m.on("click","#".concat(a),function(n){n.preventDefault();var a=m.find("#".concat(r)).val().trim(),s=m.find("#".concat(o)).val().trim(),u=m.find("#".concat(i)).val().trim();t.insertImage(e,a,s,u),e.hidePanelOrModal()}),this.$content=m}var y=this.$content;return y.empty(),y.append(u),y.append(d),y.append(h),y.append(v),l.val(""),f.val(""),g.val(""),setTimeout(function(){l.focus()}),y[0]},e.prototype.insertImage=function(e,t,n,r){void 0===n&&(n=""),void 0===r&&(r=""),t&&(e.restoreSelection(),this.isDisabled(e)||qO(e,t,n,r))},e}(),eN=function(){function e(){this.title=QE("image.viewLink"),this.iconSvg=yx,this.tag="button"}return e.prototype.getValue=function(e){var t=_y.getSelectedNodeByType(e,"image");return t&&t.href||""},e.prototype.isActive=function(e){return!1},e.prototype.isDisabled=function(e){return null==e.selection||!this.getValue(e)},e.prototype.exec=function(e,t){if(!this.isDisabled(e)){if(!t||"string"!=typeof t)throw new Error("View image link failed, image.href is '".concat(t,"'"));window.open(t,"_blank")}},e}(),tN=function(){function e(){this.tag="button"}return e.prototype.getValue=function(e){return""},e.prototype.isActive=function(e){return!1},e.prototype.getSelectedNode=function(e){return _y.getSelectedNodeByType(e,"image")},e.prototype.isDisabled=function(e){return null==e.selection||null==this.getSelectedNode(e)},e.prototype.exec=function(e,t){if(!this.isDisabled(e)){var n=this.getSelectedNode(e);if(null!=n){var r=_y.getHoverbar(e);r&&r.hideAndClean();var o=n.style,i={style:Yg(Yg({},void 0===o?{}:o),{width:this.value,height:""})};jg.setNodes(e,i,{match:function(e){return _y.checkNodeType(e,"image")}})}}},e}(),nN=function(e){function t(){var t=e.apply(this,ev([],Qg(arguments),!1))||this;return t.title="30%",t.value="30%",t}return Kg(t,e),t}(tN),rN=function(e){function t(){var t=e.apply(this,ev([],Qg(arguments),!1))||this;return t.title="50%",t.value="50%",t}return Kg(t,e),t}(tN),oN=function(e){function t(){var t=e.apply(this,ev([],Qg(arguments),!1))||this;return t.title="100%",t.value="100%",t}return Kg(t,e),t}(tN),iN={onInsertedImage:function(e){},onUpdatedImage:function(e){},checkImage:function(e,t,n){return!0},parseImageSrc:function(e){return e}};function aN(e,t){var n=_y.findKey(e,t).id;return"w-e-image-container-".concat(n)}function sN(e,t,n,r){var o=am("body"),i=aN(e,t),a=r.width,s=r.height,u=0,l=0,c=0,d=0,f=!1,p=null;var h=AC(function(e){e.preventDefault();var t=e.clientX,n=l+(f?u-t:t-u),r=c*(n/l);n>d-6||null!=p&&(n<=15||r<=15||(p.css("width","".concat(n,"px")),p.css("height","".concat(r,"px"))))},100);function g(n){if(o.off("mousemove",h),null!=p){var r=p.width().toFixed(2),i=p.height().toFixed(2),a={style:Yg(Yg({},t.style),{width:"".concat(r,"px"),height:"".concat(i,"px")})};jg.setNodes(e,a,{at:_y.findPath(e,t)}),o.off("mouseup",g)}}function v(t,n){p=function(){var e=am("#".concat(i));if(0===e.length)throw new Error("Cannot find image container elem");return e}(),u=t,d=n;var r=p.find("img");if(0===r.length)throw new Error("Cannot find image elem");l=r.width(),c=r.height(),o.on("mousemove",h),o.on("mouseup",g);var a=_y.getHoverbar(e);a&&a.hideAndClean()}var m={};return a&&(m.width=a),s&&(m.height=s),m.boxShadow="0 0 0 1px #B4D5FF",ND("div",{id:i,style:m,className:"w-e-image-container w-e-selected-image-container",on:{mousedown:function(n){var r=am(n.target);if(r.hasClass("w-e-image-dragger")){n.preventDefault(),(r.hasClass("left-top")||r.hasClass("left-bottom"))&&(f=!0);var o=_y.getParentNode(e,t);if(null!=o){var i=_y.toDOMNode(e,o),a=i.getBoundingClientRect?i.getBoundingClientRect():{width:0},s=window.getComputedStyle(i),u=parseFloat(s.paddingLeft),l=parseFloat(s.paddingRight),c=parseFloat(s.borderLeftWidth),d=parseFloat(s.borderRightWidth);v(n.clientX,a.width-u-l-c-d)}}}}},n,ND("div",{className:"w-e-image-dragger left-top"}),ND("div",{className:"w-e-image-dragger right-top"}),ND("div",{className:"w-e-image-dragger left-bottom"}),ND("div",{className:"w-e-image-dragger right-bottom"}))}var uN={type:"image",renderElem:function(e,t,n){var r=e,o=r.src,i=r.alt,a=void 0===i?"":i,s=r.href,u=void 0===s?"":s,l=r.style,c=void 0===l?{}:l,d=c.width,f=void 0===d?"":d,p=c.height,h=void 0===p?"":p,g=_y.isNodeSelected(n,e),v={maxWidth:"100%"};f&&(v.width="100%"),h&&(v.height="100%");var m=ND("img",{style:v,src:o,alt:a,"data-href":u}),y=n.isDisabled();return g&&!y?sN(n,e,m,{width:f,height:h}):function(e,t,n,r){var o=r.width,i=r.height,a={};return o&&(a.width=o),i&&(a.height=i),ND("div",{id:aN(e,t),style:a,className:"w-e-image-container"},n)}(n,e,m,{width:f,height:h})}},lN={renderElems:[uN],elemsToHtml:[HO],parseElemsHtml:[{selector:"img:not([data-w-e-type])",parseElemHtml:function(e,t,n){var r=am(e),o=r.attr("data-href")||"";return o=decodeURIComponent(o),{type:"image",src:r.attr("src")||"",alt:r.attr("alt")||"",href:o,style:{width:Ax(r,"width"),height:Ax(r,"height")},width:r.attr("width")||"",height:r.attr("height")||"",children:[{text:""}]}}}],menus:[{key:"insertImage",factory:function(){return new QO},config:iN},{key:"deleteImage",factory:function(){return new zO}},{key:"editImage",factory:function(){return new YO},config:iN},{key:"viewImageLink",factory:function(){return new eN}},{key:"imageWidth30",factory:function(){return new nN}},{key:"imageWidth50",factory:function(){return new rN}},{key:"imageWidth100",factory:function(){return new oN}},{key:"editorImageSizeMenu",factory:function(){return new ZO}}],editorPlugin:function(e){var t=e.isInline,n=e.isVoid,r=e;return r.isInline=function(e){return"image"===e.type||t(e)},r.isVoid=function(e){return"image"===e.type||n(e)},r}},cN=function(){function e(){this.tag="button"}return e.prototype.getValue=function(e){var t=Qg(Kh.nodes(e,{match:function(e){return!!e.indent},universal:!0}),1),n=t[0];return null==n?"":Qg(n,1)[0].indent||""},e.prototype.isActive=function(e){return!1},e.prototype.getMatchNode=function(e){var t=Qg(Kh.nodes(e,{match:function(e){var t=_y.getNodeType(e);return"paragraph"===t||!!t.startsWith("header")},universal:!0,mode:"highest"}),1),n=t[0];return null==n?null:n[0]},e}(),dN=function(e){function t(){var t=e.apply(this,ev([],Qg(arguments),!1))||this;return t.title=QE("indent.decrease"),t.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M0 64h1024v128H0z m384 192h640v128H384z m0 192h640v128H384z m0 192h640v128H384zM0 832h1024v128H0z m256-512v384l-256-192z"></path></svg>',t}return Kg(t,e),t.prototype.isDisabled=function(e){var t=this.getMatchNode(e);return null==t||!t.indent},t.prototype.exec=function(e,t){jg.setNodes(e,{indent:null},{match:function(e){return $h.isElement(e)}})},t}(cN),fN=function(e){function t(){var t=e.apply(this,ev([],Qg(arguments),!1))||this;return t.title=QE("indent.increase"),t.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M0 64h1024v128H0z m384 192h640v128H384z m0 192h640v128H384z m0 192h640v128H384zM0 832h1024v128H0z m0-128V320l256 192z"></path></svg>',t.DEFAULT_INDENT_VALUE="2em",t}return Kg(t,e),t.prototype.isDisabled=function(e){var t=this.getMatchNode(e);return null==t||!!t.indent},t.prototype.getIndentValue=function(e){var t=this.getMatchNode(e);if(!t)return this.DEFAULT_INDENT_VALUE;var n=t.children.filter(Cg.isText)[0];if(!n||!n.fontSize)return this.DEFAULT_INDENT_VALUE;var r=n.fontSize,o=parseInt(n.fontSize,10),i=r.replace("".concat(o),"");return"".concat(2*o).concat(i)},t.prototype.exec=function(e,t){var n=this.getIndentValue(e);jg.setNodes(e,{indent:n},{match:function(e){return $h.isElement(e)},mode:"highest"})},t}(cN);var pN={renderStyle:function(e,t){if(!$h.isElement(e))return t;var n=e.indent,r=t;return n&&$x(r,{textIndent:n}),r},styleToHtml:function(e,t){if(!$h.isElement(e))return t;var n=e.indent;if(!n)return t;var r=am(t);return r.css("text-indent",n),wx(r)},preParseHtml:[{selector:"p,h1,h2,h3,h4,h5",preParseHtml:function(e){var t=am(e),n=Ax(t,"padding-left");return/^[1-9]\d*em$/.test(n)&&t.css("text-indent","2em"),/^[1-9]\d*px$/.test(n)&&parseInt(n,10)%32==0&&t.css("text-indent","2em"),t[0]}}],parseStyleHtml:function(e,t,n){var r=am(e);if(!$h.isElement(t))return t;var o=t,i=Ax(r,"text-indent"),a=parseInt(i,10);return i&&a>0&&(o.indent=i),o},menus:[{key:"indent",factory:function(){return new fN}},{key:"delIndent",factory:function(){return new dN}}]},hN=function(){function e(){this.tag="button"}return e.prototype.getValue=function(e){return""},e.prototype.isActive=function(e){return!1},e.prototype.isDisabled=function(e){return null==e.selection||!!_y.getSelectedElems(e).some(function(t){var n=t.type;return!(!Kh.isVoid(e,t)||!Kh.isBlock(e,t)||"video"===n)||!!["pre","code"].includes(n)})},e}(),gN=function(e){function t(){var t=e.apply(this,ev([],Qg(arguments),!1))||this;return t.title=QE("justify.center"),t.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M870.4 793.6v102.4H153.6v-102.4h716.8z m102.4-230.4v102.4H51.2v-102.4h921.6z m-102.4-230.4v102.4H153.6v-102.4h716.8zM972.8 102.4v102.4H51.2V102.4h921.6z"></path></svg>',t}return Kg(t,e),t.prototype.exec=function(e,t){jg.setNodes(e,{textAlign:"center"},{match:function(t){return $h.isElement(t)&&!e.isInline(t)}})},t}(hN),vN=function(e){function t(){var t=e.apply(this,ev([],Qg(arguments),!1))||this;return t.title=QE("justify.justify"),t.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M0 64h1024v128H0z m0 192h1024v128H0z m0 192h1024v128H0z m0 192h1024v128H0z m0 192h1024v128H0z"></path></svg>',t}return Kg(t,e),t.prototype.exec=function(e,t){jg.setNodes(e,{textAlign:"justify"},{match:function(t){return $h.isElement(t)&&!e.isInline(t)}})},t}(hN),mN=function(e){function t(){var t=e.apply(this,ev([],Qg(arguments),!1))||this;return t.title=QE("justify.left"),t.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M768 793.6v102.4H51.2v-102.4h716.8z m204.8-230.4v102.4H51.2v-102.4h921.6z m-204.8-230.4v102.4H51.2v-102.4h716.8zM972.8 102.4v102.4H51.2V102.4h921.6z"></path></svg>',t}return Kg(t,e),t.prototype.exec=function(e,t){jg.setNodes(e,{textAlign:"left"},{match:function(t){return $h.isElement(t)&&!e.isInline(t)}})},t}(hN),yN=function(e){function t(){var t=e.apply(this,ev([],Qg(arguments),!1))||this;return t.title=QE("justify.right"),t.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M972.8 793.6v102.4H256v-102.4h716.8z m0-230.4v102.4H51.2v-102.4h921.6z m0-230.4v102.4H256v-102.4h716.8zM972.8 102.4v102.4H51.2V102.4h921.6z"></path></svg>',t}return Kg(t,e),t.prototype.exec=function(e,t){jg.setNodes(e,{textAlign:"right"},{match:function(t){return $h.isElement(t)&&!e.isInline(t)}})},t}(hN);var bN={renderStyle:function(e,t){if(!$h.isElement(e))return t;var n=e.textAlign,r=t;return n&&$x(r,{textAlign:n}),r},styleToHtml:function(e,t){if(!$h.isElement(e))return t;var n=e.textAlign;if(!n)return t;var r=am(t);return r.css("text-align",n),wx(r)},parseStyleHtml:function(e,t,n){var r=am(e);if(!$h.isElement(t))return t;var o=t,i=Ax(r,"text-align");return i&&(o.textAlign=i),o},menus:[{key:"justifyLeft",factory:function(){return new mN}},{key:"justifyRight",factory:function(){return new yN}},{key:"justifyCenter",factory:function(){return new gN}},{key:"justifyJustify",factory:function(){return new vN}}]};var EN=function(){function e(){this.title=QE("lineHeight.title"),this.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M964 788a8 8 0 0 1 8 8v98a8 8 0 0 1-8 8H438a8 8 0 0 1-8-8v-98a8 8 0 0 1 8-8h526zM198.93 144.306c6.668-5.798 16.774-5.094 22.573 1.574l122.26 140.582a16 16 0 0 1 3.927 10.5c0 8.836-7.164 16-16 16h-61.8a8 8 0 0 0-8 8v390.077h69.819a16 16 0 0 1 10.502 3.928c6.666 5.8 7.37 15.906 1.57 22.573L221.476 878.123a16 16 0 0 1-1.57 1.57c-6.668 5.8-16.774 5.097-22.574-1.57L75.051 737.538a16 16 0 0 1-3.928-10.5c0-8.837 7.163-16 16-16h69.822V312.96H87.127a16 16 0 0 1-10.502-3.928c-6.666-5.8-7.37-15.906-1.57-22.573l122.303-140.582a16 16 0 0 1 1.572-1.572zM964 465a8 8 0 0 1 8 8v98a8 8 0 0 1-8 8H438a8 8 0 0 1-8-8v-98a8 8 0 0 1 8-8h526z m0-323a8 8 0 0 1 8 8v98a8 8 0 0 1-8 8H438a8 8 0 0 1-8-8v-98a8 8 0 0 1 8-8h526z"></path></svg>',this.tag="select",this.width=80}return e.prototype.getOptions=function(e){var t=[],n=e.getMenuConfig("lineHeight").lineHeightList,r=void 0===n?[]:n;t.push({text:QE("lineHeight.default"),value:""}),r.forEach(function(e){t.push({text:e,value:e})});var o=this.getValue(e);return t.forEach(function(e){e.value===o?e.selected=!0:e.selected=void 0}),t},e.prototype.getMatchNode=function(e){var t=Qg(Kh.nodes(e,{match:function(e){var t=_y.getNodeType(e);return!!t.startsWith("header")||!!["paragraph","blockquote","list-item"].includes(t)},universal:!0,mode:"highest"}),1),n=t[0];return null==n?null:n[0]},e.prototype.isActive=function(e){return!1},e.prototype.getValue=function(e){var t=this.getMatchNode(e);return null==t?"":$h.isElement(t)&&t.lineHeight||""},e.prototype.isDisabled=function(e){return null==e.selection||null==this.getMatchNode(e)},e.prototype.exec=function(e,t){jg.setNodes(e,{lineHeight:t.toString()},{mode:"highest"})},e}();var CN={renderStyle:function(e,t){if(!$h.isElement(e))return t;var n=e.lineHeight,r=t;return n&&$x(r,{lineHeight:n}),r},styleToHtml:function(e,t){if(!$h.isElement(e))return t;var n=e.lineHeight;if(!n)return t;var r=am(t);return r.css("line-height",n),wx(r)},parseStyleHtml:function(e,t,n){var r=am(e);if(!$h.isElement(t))return t;var o=t,i=n.getMenuConfig("lineHeight").lineHeightList,a=void 0===i?[]:i,s=Ax(r,"line-height");return s&&a.includes(s)&&(o.lineHeight=s),o},menus:[{key:"lineHeight",factory:function(){return new EN},config:{lineHeightList:["1","1.15","1.5","2","2.5","3"]}}]};var DN={type:"link",elemToHtml:function(e,t){var n=e,r=n.url,o=n.target,i=void 0===o?"_blank":o;return'<a href="'.concat(r,'" target="').concat(i,'">').concat(t,"</a>")}};function wN(e,t,n,r){return Xg(this,void 0,void 0,function(){var o,i;return Zg(this,function(a){switch(a.label){case 0:return(o=t.getMenuConfig(e).checkLink)?[4,o(n,r)]:[3,2];case 1:if("string"==typeof(i=a.sent()))return t.alert(i,"error"),[2,!1];if(null==i)return[2,!1];a.label=2;case 2:return[2,!0]}})})}function SN(e,t,n){return Xg(this,void 0,void 0,function(){var r;return Zg(this,function(o){switch(o.label){case 0:return(r=t.getMenuConfig(e).parseLinkUrl)?[4,r(n)]:[3,2];case 1:return[2,o.sent()];case 2:return[2,n]}})})}function AN(e){return null==e.selection||!!_y.getSelectedElems(e).some(function(t){var n=t.type;return!!e.isVoid(t)||!!["pre","code","link"].includes(n)})}function xN(e,t){return{type:"link",url:UO(e),children:t?[{text:t}]:[]}}function ON(e,t,n){return Xg(this,void 0,void 0,function(){var r,o,i,a,s;return Zg(this,function(u){switch(u.label){case 0:return n?(t||(t=n),e.restoreSelection(),AN(e)?[2]:[4,wN("insertLink",e,t,n)]):[2];case 1:return u.sent()?[4,SN("insertLink",e,n)]:[2];case 2:if(r=u.sent(),null==(o=e.selection))return[2];if(fg.isCollapsed(o)){if((a=_y.getLeftLengthOfMaxLength(e))<=0)return[2];e.insertText(" "),a<t.length+1&&(t=t.slice(0,a-1)),s=xN(r,t),jg.insertNodes(e,s),e.insertFragment([{text:" "}])}else if((i=Kh.string(e,o))!==t){if((a=_y.getLeftLengthOfMaxLength(e))<=0)return[2];a<i.length-t.length&&(t=t.slice(0,a)),e.deleteFragment(),s=xN(r,t),jg.insertNodes(e,s)}else s=xN(r),jg.wrapNodes(e,s,{split:!0}),jg.collapse(e,{edge:"end"});return[2]}})})}function NN(){return $O("w-e-update-link")}var BN=function(){function e(){this.title=QE("link.edit"),this.iconSvg=mx,this.tag="button",this.showModal=!0,this.modalWidth=300,this.$content=null,this.urlInputId=NN(),this.buttonId=NN()}return e.prototype.getSelectedLinkElem=function(e){var t=_y.getSelectedNodeByType(e,"link");return null==t?null:t},e.prototype.getValue=function(e){var t=this.getSelectedLinkElem(e);return t&&t.url||""},e.prototype.isActive=function(e){return!1},e.prototype.exec=function(e,t){},e.prototype.isDisabled=function(e){return null==e.selection||null==this.getSelectedLinkElem(e)},e.prototype.getModalPositionNode=function(e){return _y.getSelectedNodeByType(e,"link")},e.prototype.getModalContentElem=function(e){var t=this.urlInputId,n=this.buttonId,r=Qg(cC(QE("link.url"),t),2),o=r[0],i=am(r[1]),a=Qg(fC(n,QE("common.ok")),1)[0];if(null==this.$content){var s=am("<div></div>");s.on("click","#".concat(n),function(n){n.preventDefault(),e.restoreSelection();var r=_y.getSelectedNodeByType(e,"link"),o=r?eg.string(r):"",i=s.find("#".concat(t)).val();!function(e,t,n){Xg(this,void 0,void 0,function(){var r,o;return Zg(this,function(i){switch(i.label){case 0:return n?[4,wN("editLink",e,t,n)]:[2];case 1:return i.sent()?[4,SN("editLink",e,n)]:[2];case 2:return r=i.sent(),o={url:UO(r)},jg.setNodes(e,o,{match:function(e){return _y.checkNodeType(e,"link")}}),[2]}})})}(e,o,i),e.hidePanelOrModal()}),this.$content=s}var u=this.$content;u.empty(),u.append(o),u.append(a);var l=this.getValue(e);return i.val(l),setTimeout(function(){i.focus()}),u[0]},e}();function TN(){return $O("w-e-insert-link")}var kN=function(){function e(){this.title=QE("link.insert"),this.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M440.224 635.776a51.84 51.84 0 0 1-36.768-15.232c-95.136-95.136-95.136-249.92 0-345.056l192-192C641.536 37.408 702.816 12.032 768 12.032s126.432 25.376 172.544 71.456c95.136 95.136 95.136 249.92 0 345.056l-87.776 87.776a51.968 51.968 0 1 1-73.536-73.536l87.776-87.776a140.16 140.16 0 0 0 0-197.984c-26.432-26.432-61.6-40.992-99.008-40.992s-72.544 14.56-99.008 40.992l-192 192a140.16 140.16 0 0 0 0 197.984 51.968 51.968 0 0 1-36.768 88.768z"></path><path d="M256 1012a242.4 242.4 0 0 1-172.544-71.456c-95.136-95.136-95.136-249.92 0-345.056l87.776-87.776a51.968 51.968 0 1 1 73.536 73.536l-87.776 87.776a140.16 140.16 0 0 0 0 197.984c26.432 26.432 61.6 40.992 99.008 40.992s72.544-14.56 99.008-40.992l192-192a140.16 140.16 0 0 0 0-197.984 51.968 51.968 0 1 1 73.536-73.536c95.136 95.136 95.136 249.92 0 345.056l-192 192A242.4 242.4 0 0 1 256 1012z"></path></svg>',this.tag="button",this.showModal=!0,this.modalWidth=300,this.$content=null,this.textInputId=TN(),this.urlInputId=TN(),this.buttonId=TN()}return e.prototype.getValue=function(e){return""},e.prototype.isActive=function(e){return!1},e.prototype.exec=function(e,t){},e.prototype.isDisabled=function(e){return AN(e)},e.prototype.getModalPositionNode=function(e){return null},e.prototype.getModalContentElem=function(e){var t=e.selection,n=this,r=n.textInputId,o=n.urlInputId,i=n.buttonId,a=Qg(cC(QE("link.text"),r),2),s=a[0],u=am(a[1]),l=Qg(cC(QE("link.url"),o),2),c=l[0],d=am(l[1]),f=Qg(fC(i,QE("common.ok")),1)[0];if(null==this.$content){var p=am("<div></div>");p.on("click","#".concat(i),function(t){t.preventDefault();var n=p.find("#".concat(r)).val(),i=p.find("#".concat(o)).val();ON(e,n,i),e.hidePanelOrModal()}),this.$content=p}var h=this.$content;if(h.empty(),h.append(s),h.append(c),h.append(f),null==t||fg.isCollapsed(t))u.val("");else{var g=Kh.string(e,t);u.val(g)}return d.val(""),setTimeout(function(){u.focus()}),h[0]},e}(),FN=function(){function e(){this.title=QE("link.unLink"),this.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M608.16328 811.815036c9.371954 9.371954 9.371954 24.56788 0 33.941834l-89.347563 89.347564c-118.525421 118.523421-311.38448 118.531421-429.919901 0-118.527421-118.529421-118.527421-311.39048 0-429.917901l89.349564-89.349563c9.371954-9.371954 24.56788-9.371954 33.941834 0l79.195613 79.195613c9.371954 9.371954 9.371954 24.56788 0 33.941834l-89.349563 89.347564c-56.143726 56.145726-56.143726 147.49928 0 203.645005 56.143726 56.143726 147.49928 56.145726 203.647005 0l89.347564-89.347563c9.371954-9.371954 24.56788-9.371954 33.941834 0l79.193613 79.195613z m-113.135447-520.429459c9.371954 9.371954 24.56788 9.371954 33.941834 0l89.347564-89.347564c56.143726-56.149726 147.49928-56.145726 203.647006 0 56.143726 56.145726 56.143726 147.49928 0 203.645006l-89.349564 89.347564c-9.371954 9.371954-9.371954 24.56788 0 33.941834l79.195613 79.195613c9.371954 9.371954 24.56788 9.371954 33.941834 0l89.349564-89.349563c118.529421-118.529421 118.529421-311.38848 0-429.917901-118.531421-118.527421-311.38848-118.527421-429.919901 0l-89.347563 89.347564c-9.371954 9.371954-9.371954 24.56788 0 33.941834l79.193613 79.195613z m469.653707 718.556492l45.253779-45.253779c18.745908-18.745908 18.745908-49.13776 0-67.881669L127.195629 14.062931c-18.745908-18.745908-49.13776-18.745908-67.881669 0L14.058181 59.31871c-18.745908 18.745908-18.745908 49.13776 0 67.881669l882.74169 882.74169c18.745908 18.743908 49.13776 18.743908 67.881669 0z"></path></svg>',this.tag="button"}return e.prototype.getValue=function(e){return""},e.prototype.isActive=function(e){return!1},e.prototype.isDisabled=function(e){return null==e.selection||null==_y.getSelectedNodeByType(e,"link")},e.prototype.exec=function(e,t){this.isDisabled(e)||jg.unwrapNodes(e,{match:function(e){return _y.checkNodeType(e,"link")}})},e}(),IN=function(){function e(){this.title=QE("link.view"),this.iconSvg=yx,this.tag="button"}return e.prototype.getSelectedLinkElem=function(e){var t=_y.getSelectedNodeByType(e,"link");return null==t?null:t},e.prototype.getValue=function(e){var t=this.getSelectedLinkElem(e);return t&&t.url||""},e.prototype.isActive=function(e){return!1},e.prototype.isDisabled=function(e){return null==e.selection||null==this.getSelectedLinkElem(e)},e.prototype.exec=function(e,t){if(!this.isDisabled(e)){if(!t||"string"!=typeof t)throw new Error("View link failed, link url is '".concat(t,"'"));window.open(t,"_blank")}},e}(),PN={checkLink:function(e,t){return!0},parseLinkUrl:function(e){return e}},_N={key:"insertLink",factory:function(){return new kN},config:PN},RN={key:"editLink",factory:function(){return new BN},config:PN},LN={key:"unLink",factory:function(){return new FN}},MN={key:"viewLink",factory:function(){return new IN}};var jN,HN,zN={selector:"a:not([data-w-e-type])",parseElemHtml:function(e,t,n){var r=am(e);return 0===(t=t.filter(function(e){return!!Cg.isText(e)||!!n.isInline(e)})).length&&(t=[{text:r.text().replace(/\s+/gm," ")}]),{type:"link",url:r.attr("href")||"",target:r.attr("target")||"",children:t}}};var $N=b(function(){if(HN)return jN;HN=1,jN=function(r){if("string"!=typeof r)return!1;var o=r.match(e);if(!o)return!1;var i=o[1];if(!i)return!1;if(t.test(i)||n.test(i))return!0;return!1};var e=/^(?:\w+:)?\/\/(\S+)$/,t=/^localhost[\:?\d]*(?:[^\:?\d]\S*)?$/,n=/^[^\s\.]+\.\S{2,}$/;return jN}());var UN={type:"link",renderElem:function(e,t,n){var r=e,o=r.url,i=r.target;return ND("a",{href:o,target:void 0===i?"_blank":i},t)}},VN={renderElems:[UN],elemsToHtml:[DN],parseElemsHtml:[zN],menus:[_N,RN,LN,MN],editorPlugin:function(e){var t=e.isInline,n=e.insertData,r=e.normalizeNode,o=e;return o.isInline=function(e){return"link"===e.type||t(e)},o.insertData=function(e){var t=e.getData("text/plain");if($N(t)){if(/<img[^>]+>/.test(e.getData("text/html")))n(e);else if(!AN(o)){var r=o.selection;if(null!=r){var i=Kh.string(o,r);ON(o,i,t)}}}else n(e)},o.normalizeNode=function(e){var t=Qg(e,2),n=t[0],i=t[1];return"link"!==_y.getNodeType(n)?r([n,i]):""===eg.string(n)?jg.removeNodes(o,{at:i}):r([n,i])},o}};var WN={selector:"p:not([data-w-e-type])",parseElemHtml:function(e,t,n){var r=am(e);return 0===(t=t.filter(function(e){return!!Cg.isText(e)||!!n.isInline(e)})).length&&(t=[{text:r.text().replace(/\s+/gm," ")}]),{type:"paragraph",children:t}}};function GN(e){var t=Qg(Kh.nodes(e,{match:function(t){return e.children[0]===t},mode:"highest"}),1),n=t[0];if(null==n)return!1;var r=n[0];if(!$h.isElement(r))return!1;if("paragraph"===r.type)return!1;if(""!==eg.string(r))return!1;var o=r.children,i=void 0===o?[]:o;return!!Cg.isText(i[0])&&(jg.setNodes(e,{type:"paragraph"}),!0)}var qN={type:"paragraph",renderElem:function(e,t,n){return ND("p",null,t)}},KN={renderElems:[qN],elemsToHtml:[{type:"paragraph",elemToHtml:function(e,t){return""===t?"<p><br></p>":"<p>".concat(t,"</p>")}}],parseElemsHtml:[WN],editorPlugin:function(e){var t=e.deleteBackward,n=e.deleteForward,r=e;return r.deleteBackward=function(e){GN(r)||t(e)},r.deleteForward=function(e){GN(r)||n(e)},r}};function YN(e,t){if(null==e.selection)return!0;var n=Qg(Kh.nodes(e,{match:function(t){return"pre"===_y.getNodeType(t)||!!Kh.isVoid(e,t)},universal:!0}),1);return!!n[0]}function XN(e,t){Object.keys(t).forEach(function(t){"text"!==t&&Kh.removeMark(e,t)})}var ZN=function(){function e(){this.marksNeedToRemove=[],this.tag="button"}return e.prototype.getValue=function(e){var t=this.mark,n=Kh.marks(e);if(n)return n[t];var r=Qg(Kh.nodes(e,{match:function(e){return!0===e[t]}}),1);return!!r[0]},e.prototype.isActive=function(e){return!!this.getValue(e)},e.prototype.isDisabled=function(e){return YN(e,this.mark)},e.prototype.exec=function(e,t){var n=this.mark,r=this.marksNeedToRemove;t?e.removeMark(n):(e.addMark(n,!0),r&&r.forEach(function(t){return e.removeMark(t)}))},e}(),JN=function(e){function t(){var t=e.apply(this,ev([],Qg(arguments),!1))||this;return t.mark="bold",t.title=QE("textStyle.bold"),t.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M707.872 484.64A254.88 254.88 0 0 0 768 320c0-141.152-114.848-256-256-256H192v896h384c141.152 0 256-114.848 256-256a256.096 256.096 0 0 0-124.128-219.36zM384 192h101.504c55.968 0 101.504 57.408 101.504 128s-45.536 128-101.504 128H384V192z m159.008 640H384v-256h159.008c58.464 0 106.016 57.408 106.016 128s-47.552 128-106.016 128z"></path></svg>',t.hotkey="mod+b",t}return Kg(t,e),t}(ZN),QN=function(){function e(){this.title=QE("textStyle.clear"),this.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M969.382408 288.738615l-319.401123-270.852152a67.074236 67.074236 0 0 0-96.459139 5.74922l-505.931379 574.922021a68.35184 68.35184 0 0 0-17.886463 47.910169 74.101061 74.101061 0 0 0 24.274486 47.910168l156.50655 132.232065h373.060512L975.131628 383.281347a67.074236 67.074236 0 0 0-5.74922-96.459139z m-440.134747 433.746725H264.144729l-90.071117-78.572676c-5.74922-5.74922-12.137243-12.137243-12.137243-17.886463a36.411728 36.411728 0 0 1 5.749221-24.274485l210.804741-240.828447 265.102932 228.691204z m-439.495945 180.781036h843.218964a60.047411 60.047411 0 1 1 0 120.733624H89.751716a60.047411 60.047411 0 1 1 0-120.733624z m0 0"></path></svg>',this.tag="button"}return e.prototype.getValue=function(e){return""},e.prototype.isActive=function(e){return!1},e.prototype.isDisabled=function(e){return YN(e)},e.prototype.exec=function(e,t){var n,r,o=Kh.nodes(e,{match:function(e){return Cg.isText(e)},universal:!0});try{for(var i=Jg(o),a=i.next();!a.done;a=i.next()){XN(e,a.value[0])}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}},e}(),eB=function(e){function t(){var t=e.apply(this,ev([],Qg(arguments),!1))||this;return t.mark="code",t.title=QE("textStyle.code"),t.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M576 736l96 96 320-320L672 192l-96 96 224 224zM448 288l-96-96L32 512l320 320 96-96-224-224z"></path></svg>',t.hotkey="mod+e",t}return Kg(t,e),t}(ZN),tB=function(e){function t(){var t=e.apply(this,ev([],Qg(arguments),!1))||this;return t.mark="italic",t.title=QE("textStyle.italic"),t.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M896 64v64h-128L448 896h128v64H128v-64h128L576 128h-128V64z"></path></svg>',t.hotkey="mod+i",t}return Kg(t,e),t}(ZN),nB=function(e){function t(){var t=e.apply(this,ev([],Qg(arguments),!1))||this;return t.mark="sub",t.marksNeedToRemove=["sup"],t.title=QE("textStyle.sub"),t.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M768 910.016v50.016h128v64h-192v-146.016l128-60V768h-128v-64h192v146.016zM676 256h-136L352 444 164 256H28l256 256-256 256h136L352 580 540 768h136l-256-256z"></path></svg>',t.hotkey="",t}return Kg(t,e),t}(ZN),rB=function(e){function t(){var t=e.apply(this,ev([],Qg(arguments),!1))||this;return t.mark="sup",t.marksNeedToRemove=["sub"],t.title=QE("textStyle.sup"),t.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M768 206.016v50.016h128v64h-192V174.016l128-60V64h-128V0h192v146.016zM676 256h-136L352 444 164 256H28l256 256-256 256h136L352 580 540 768h136l-256-256z"></path></svg>',t.hotkey="",t}return Kg(t,e),t}(ZN),oB=function(e){function t(){var t=e.apply(this,ev([],Qg(arguments),!1))||this;return t.mark="through",t.title=QE("textStyle.through"),t.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M1024 512v64h-234.496c27.52 38.496 42.496 82.688 42.496 128 0 70.88-36.672 139.04-100.576 186.976C672.064 935.488 594.144 960 512 960s-160.064-24.512-219.424-69.024C228.64 843.04 192 774.88 192 704h128c0 69.376 87.936 128 192 128s192-58.624 192-128-87.936-128-192-128H0v-64h299.52a385.984 385.984 0 0 1-6.944-5.024C228.64 459.04 192 390.88 192 320s36.672-139.04 100.576-186.976C351.936 88.512 429.856 64 512 64s160.064 24.512 219.424 69.024C795.328 180.96 832 249.12 832 320h-128c0-69.376-87.936-128-192-128s-192 58.624-192 128 87.936 128 192 128c78.976 0 154.048 22.688 212.48 64H1024z"></path></svg>',t.hotkey="mod+shift+x",t}return Kg(t,e),t}(ZN),iB=function(e){function t(){var t=e.apply(this,ev([],Qg(arguments),!1))||this;return t.mark="underline",t.title=QE("textStyle.underline"),t.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M704 64l128 0 0 416c0 159.072-143.264 288-320 288s-320-128.928-320-288l0-416 128 0 0 416c0 40.16 18.24 78.688 51.36 108.512 36.896 33.216 86.848 51.488 140.64 51.488s103.744-18.304 140.64-51.488c33.12-29.792 51.36-68.352 51.36-108.512l0-416zM192 832l640 0 0 128-640 0z"></path></svg>',t.hotkey="mod+u",t}return Kg(t,e),t}(ZN);function aB(e,t){return 0!==e.length&&(!!e[0].matches(t)||e.find(t).length>0)}function sB(e,t){var n=t,r=e,o=r.bold,i=r.italic,a=r.underline,s=r.code,u=r.through,l=r.sub,c=r.sup;return o&&(n="<strong>".concat(n,"</strong>")),s&&(n="<code>".concat(n,"</code>")),i&&(n="<em>".concat(n,"</em>")),a&&(n="<u>".concat(n,"</u>")),u&&(n="<s>".concat(n,"</s>")),l&&(n="<sub>".concat(n,"</sub>")),c&&(n="<sup>".concat(n,"</sup>")),n}var uB={renderStyle:function(e,t){var n=e,r=n.bold,o=n.italic,i=n.underline,a=n.code,s=n.through,u=n.sub,l=n.sup,c=t;return r&&(c=ND("strong",null,c)),a&&(c=ND("code",null,c)),o&&(c=ND("em",null,c)),i&&(c=ND("u",null,c)),s&&(c=ND("s",null,c)),u&&(c=ND("sub",null,c)),l&&(c=ND("sup",null,c)),c},menus:[{key:"bold",factory:function(){return new JN}},{key:"underline",factory:function(){return new iB}},{key:"italic",factory:function(){return new tB}},{key:"through",factory:function(){return new oB}},{key:"code",factory:function(){return new eB}},{key:"sub",factory:function(){return new nB}},{key:"sup",factory:function(){return new rB}},{key:"clearStyle",factory:function(){return new QN}}],styleToHtml:function(e,t){if(!Cg.isText(e))return t;if(Dx(t))return sB(e,t);var n=am(t),r=n.html();return r=sB(e,r),n.html(r),wx(n)},parseStyleHtml:function(e,t,n){var r=am(e);if(!Cg.isText(t))return t;var o=t;return aB(r,"b,strong")&&(o.bold=!0),aB(r,"i,em")&&(o.italic=!0),aB(r,"u")&&(o.underline=!0),aB(r,"s,strike")&&(o.through=!0),aB(r,"sub")&&(o.sub=!0),aB(r,"sup")&&(o.sup=!0),aB(r,"code")&&(o.code=!0),o}};var lB={type:"todo",elemToHtml:function(e,t){var n=e.checked;return'<div data-w-e-type="todo"><input type="checkbox" disabled '.concat(n?"checked":"",">").concat(t,"</div>")}},cB=function(){function e(){this.title=QE("todo.todo"),this.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M278.755556 403.911111l-79.644445 79.644445L455.111111 739.555556l568.888889-568.888889-79.644444-79.644445L455.111111 580.266667l-176.355555-176.355556zM910.222222 910.222222H113.777778V113.777778h568.888889V0H113.777778C51.2 0 0 51.2 0 113.777778v796.444444c0 62.577778 51.2 113.777778 113.777778 113.777778h796.444444c62.577778 0 113.777778-51.2 113.777778-113.777778V455.111111h-113.777778v455.111111z"></path></svg>',this.tag="button"}return e.prototype.getValue=function(e){return""},e.prototype.isActive=function(e){return!!_y.getSelectedNodeByType(e,"todo")},e.prototype.isDisabled=function(e){return null==e.selection||!!_y.getSelectedElems(e).some(function(t){if(Kh.isVoid(e,t)&&Kh.isBlock(e,t))return!0;var n=t.type;return!!["pre","table","list-item"].includes(n)})},e.prototype.exec=function(e,t){var n=this.isActive(e);jg.setNodes(e,{type:n?"paragraph":"todo"})},e}();var dB={selector:'div[data-w-e-type="todo"]',parseElemHtml:function(e,t,n){var r=am(e);0===(t=t.filter(function(e){return!!Cg.isText(e)||!!n.isInline(e)})).length&&(t=[{text:r.text().replace(/\s+/gm," ")}]);var o=!1;return null!=r.find('input[type="checkbox"]').attr("checked")&&(o=!0),{type:"todo",checked:o,children:t}}};var fB={type:"todo",renderElem:function(e,t,n){var r=!1;n.isDisabled()&&(r=!0);var o=ND("div",{style:{margin:"5px 0"}},ND("span",{contentEditable:!1,style:{marginRight:"0.5em"}},ND("input",{type:"checkbox",checked:e.checked,disabled:r,on:{change:function(t){var r=_y.findPath(n,e),o={checked:t.target.checked};jg.setNodes(n,o,{at:r})}}})),ND("span",null,t));return o}},pB={renderElems:[fB],elemsToHtml:[lB],preParseHtml:[{selector:"ul.w-e-todo",preParseHtml:function(e){var t=am(e).find("li"),n=am('<div data-w-e-type="todo"></div>'),r=t.find("input[type]");return n.append(r),t.children()[0].remove(),n[0].innerHTML+=t[0].innerHTML,n[0]}}],parseElemsHtml:[dB],menus:[{key:"todo",factory:function(){return new cB}}],editorPlugin:function(e){var t=e.deleteBackward,n=e;return n.deleteBackward=function(n){var r=e.selection;if(r&&fg.isCollapsed(r)){var o=_y.getSelectedNodeByType(e,"todo");if(o&&0===eg.string(o).length)return void jg.setNodes(e,{type:"paragraph"},{mode:"highest"})}t(n)},n}},hB=function(){function e(){this.title=QE("undo.redo"),this.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M0.00032 576a510.72 510.72 0 0 0 173.344 384l84.672-96A383.136 383.136 0 0 1 128.00032 576C128.00032 363.936 299.93632 192 512.00032 192c106.048 0 202.048 42.976 271.52 112.48L640.00032 448h384V64l-149.984 149.984A510.272 510.272 0 0 0 512.00032 64C229.21632 64 0.00032 293.216 0.00032 576z"></path></svg>',this.tag="button"}return e.prototype.getValue=function(e){return""},e.prototype.isActive=function(e){return!1},e.prototype.isDisabled=function(e){return null==e.selection},e.prototype.exec=function(e,t){"function"==typeof e.redo&&e.redo()},e}(),gB=function(){function e(){this.title=QE("undo.undo"),this.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M512 64A510.272 510.272 0 0 0 149.984 213.984L0.032 64v384h384L240.512 304.48A382.784 382.784 0 0 1 512.032 192c212.064 0 384 171.936 384 384 0 114.688-50.304 217.632-130.016 288l84.672 96a510.72 510.72 0 0 0 173.344-384c0-282.784-229.216-512-512-512z"></path></svg>',this.tag="button"}return e.prototype.getValue=function(e){return""},e.prototype.isActive=function(e){return!1},e.prototype.isDisabled=function(e){return null==e.selection},e.prototype.exec=function(e,t){"function"==typeof e.undo&&e.undo()},e}(),vB=[uB,Ux,tO,pN,bN,CN,lN,Kx,Xx,VN,Rx,Bx,jO,KN,pB,rO,{menus:[{key:"redo",factory:function(){return new hB}},{key:"undo",factory:function(){return new gB}}]},iO,Wx];YE("en",{listModule:{unOrderedList:"Unordered list",orderedList:"Ordered list"}}),YE("zh-CN",{listModule:{unOrderedList:"无序列表",orderedList:"有序列表"}});var mB=new WeakMap;function yB(e){var t,n=e.children||[],r=n.length;if(0===r)return"";for(var o=0;o<r&&!t;o+=1){var i=n[o];Cg.isText(i)&&(t=i)}return null==t?"":t.color||""}function bB(e,t,n){for(var r=t.type,o=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(t,["type"]),i=void 0!==n?n:o.level||0,a=_y.findPath(e,t),s=a;;){if(0===s.length||0===a[a.length-1])return null;s=og.previous(s);var u=Kh.node(e,s);if(!u)return null;var l=Qg(u,1)[0],c=l.level,d=void 0===c?0:c;if(_y.getNodeType(l)!==r)return null;if(d===i)return l}}function EB(e,t,n){var r=bB(e,t,n);return!!r&&r.ordered===t.ordered}var CB=[];var DB={type:"list-item",elemToHtml:function(e,t){var n="",r="",o=e.ordered,i=void 0!==o&&o?"ol":"ul",a=function(e){var t=mB.get(e);if(null==t)return 0;var n=e,r=n.type,o=n.ordered,i=void 0!==o&&o,a=n.level,s=void 0===a?0:a,u=_y.findPath(t,e);if(0===u[0])return s+1;var l=og.previous(u),c=Kh.node(t,l);if(!c)return 0;var d=Qg(c,1)[0];if(_y.getNodeType(d)!==r)return s+1;var f=d,p=f.ordered,h=void 0!==p&&p,g=f.level,v=void 0===g?0:g;return v<s?s-v:v>s?EB(t,e)?0:1:v===s?h===i?0:1:0}(e);if(a>0)for(var s=0;s<a;s+=1)n+="<".concat(i,">"),CB.push(i);var u=function(e){var t=mB.get(e);if(null==t)return 0;var n=e,r=n.type,o=n.ordered,i=void 0!==o&&o,a=n.level,s=void 0===a?0:a,u=_y.findPath(t,e);if(u[0]===t.children.length-1)return s+1;var l=og.next(u),c=Kh.node(t,l);if(!c)return 0;var d=Qg(c,1)[0];if(_y.getNodeType(d)!==r)return s+1;var f=d,p=f.ordered,h=void 0!==p&&p,g=f.level,v=void 0===g?0:g;return v<s?EB(t,d)?s-v:s-v+1:v>s?0:v===s?h===i?0:1:0}(e);if(u>0)for(s=0;s<u;s+=1){var l=CB.pop();r+="</".concat(l,">")}var c=yB(e),d=c?' style="color:'.concat(c,'"'):"";return{html:"<li".concat(d,">").concat(t,"</li>"),prefix:n,suffix:r}}},wB=function(){function e(){this.type="list-item",this.tag="button"}return e.prototype.getListNode=function(e){var t=this.type;return _y.getSelectedNodeByType(e,t)},e.prototype.getValue=function(e){return""},e.prototype.isActive=function(e){var t=this.getListNode(e);if(null==t)return!1;var n=t.ordered;return(void 0!==n&&n)===this.ordered},e.prototype.isDisabled=function(e){return null==e.selection||!!_y.getSelectedElems(e).some(function(t){if(Kh.isVoid(e,t)&&Kh.isBlock(e,t))return!0;var n=t.type;return!!["pre","code","table"].includes(n)})},e.prototype.exec=function(e,t){this.isActive(e)?jg.setNodes(e,{type:"paragraph",ordered:void 0,level:void 0}):jg.setNodes(e,{type:"list-item",ordered:this.ordered,indent:void 0})},e}(),SB=function(e){function t(){var t=e.apply(this,ev([],Qg(arguments),!1))||this;return t.ordered=!1,t.title=QE("listModule.unOrderedList"),t.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M384 64h640v128H384V64z m0 384h640v128H384v-128z m0 384h640v128H384v-128zM0 128a128 128 0 1 1 256 0 128 128 0 0 1-256 0z m0 384a128 128 0 1 1 256 0 128 128 0 0 1-256 0z m0 384a128 128 0 1 1 256 0 128 128 0 0 1-256 0z"></path></svg>',t}return Kg(t,e),t}(wB),AB=function(e){function t(){var t=e.apply(this,ev([],Qg(arguments),!1))||this;return t.ordered=!0,t.title=QE("listModule.orderedList"),t.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M384 832h640v128H384z m0-384h640v128H384z m0-384h640v128H384zM192 0v256H128V64H64V0zM128 526.016v50.016h128v64H64v-146.016l128-60V384H64v-64h192v146.016zM256 704v320H64v-64h128v-64H64v-64h128v-64H64v-64z"></path></svg>',t}return Kg(t,e),t}(wB),xB={key:"bulletedList",factory:function(){return new SB}},OB={key:"numberedList",factory:function(){return new AB}};function NB(e){return e.length?e[0].tagName.toLowerCase():""}Nm&&(am.fn.append=Nm),cm&&(am.fn.attr=cm),Tm&&(am.fn.parent=Tm);var BB={selector:"li:not([data-w-e-type])",parseElemHtml:function(e,t,n){var r=am(e);0===(t=t.filter(function(e){return!!Cg.isText(e)||!!n.isInline(e)})).length&&(t=[{text:r.text().replace(/\s+/gm," ")}]);var o=function(e){return"ol"===NB(e.parent())}(r),i=function(e){for(var t=0,n=e.parent(),r=NB(n);"ul"===r||"ol"===r;)r=NB(n=n.parent()),t+=1;return t-1}(r);return{type:"list-item",ordered:o,level:i,children:t}}};var TB={selector:"ul:not([data-w-e-type]),ol:not([data-w-e-type])",parseElemHtml:function(e,t,n){return t.flat(1/0)}};function kB(e){return Kh.nodes(e,{at:e.selection||void 0,match:function(t){return 1===_y.findPath(e,t).length}})}var FB={type:"list-item",renderElem:function(e,t,n){mB.set(e,n);var r=e,o=r.level,i=void 0===o?0:o,a=r.ordered,s=void 0!==a&&a,u={margin:"5px 0 5px ".concat(20*i,"px"),display:"flex",alignItems:"flex-start"},l="";if(s){var c=function(e,t){var n=t,r=n.type,o=n.level,i=void 0===o?0:o,a=n.ordered,s=void 0!==a&&a,u=1,l=t,c=_y.findPath(e,l);if(0===c[0])return 1;for(;c[0]>0;){var d=og.previous(c),f=Kh.node(e,d);if(null==f)break;var p=f[0],h=p.level,g=void 0===h?0:h,v=p.type,m=p.ordered;if(v!==r)break;if(g<i)break;if(g===i){if(m!==s)break;u+=1}l=p,c=d}return u}(n,e);l="".concat(c,".")}else l=function(e){void 0===e&&(e=0);var t="";switch(e){case 0:t="•";break;case 1:t="◦";break;default:t="▪"}return t}(i);return ND("div",{style:u},ND("span",{contentEditable:!1,style:{marginRight:"0.5em",color:yB(e)},"data-w-e-reserve":!0},l),ND("span",{style:{flex:"1",wordBreak:"break-word"}},t))}},IB={renderElems:[FB],editorPlugin:function(e){var t=e.deleteBackward,n=e.handleTab,r=e.normalizeNode,o=e.insertBreak,i=e;return i.insertBreak=function(){var t=Qg(Kh.nodes(e,{match:function(e){return _y.checkNodeType(e,"list-item")},universal:!0}),1),n=t[0];return n?""!==n[0].children[0].text?o():void jg.setNodes(i,{type:"paragraph",ordered:void 0,level:void 0}):o()},i.deleteBackward=function(n){var r=i.selection;if(null!=r)if(fg.isExpanded(r))t(n);else{var o=_y.getSelectedNodeByType(i,"list-item");if(null!=o)if(0!==r.focus.offset)t(n);else{var a=o,s=a.level,u=void 0===s?0:s,l=a.ordered,c=void 0!==l&&l;if(u>0){var d=bB(e,o,u-1);d&&d.ordered!==c?jg.setNodes(i,{level:u-1,ordered:!c}):jg.setNodes(i,{level:u-1})}else jg.setNodes(i,{type:"paragraph",ordered:void 0,level:void 0})}else t(n)}else t(n)},i.handleTab=function(){var e,t,r,o,a=i.selection;if(null!=a){if(fg.isCollapsed(a)){var s=_y.getSelectedNodeByType(i,"list-item");if(null==s)return void n();if(0===a.focus.offset){var u=s.level,l=void 0===u?0:u;return void jg.setNodes(i,{level:l+1})}}if(fg.isExpanded(a)){var c=0,d=!1;try{for(var f=Jg(kB(i)),p=f.next();!p.done;p=f.next()){var h=Qg(p.value,1)[0];"list-item"===_y.getNodeType(h)?c+=1:d=!0}}catch(t){e={error:t}}finally{try{p&&!p.done&&(t=f.return)&&t.call(f)}finally{if(e)throw e.error}}if(d||c<=1)return void n();try{for(var g=Jg(kB(i)),v=g.next();!v.done;v=g.next()){var m=Qg(v.value,2),y=(h=m[0],m[1]),b=h.level;l=void 0===b?0:b;jg.setNodes(i,{level:l+1},{at:y})}}catch(e){r={error:e}}finally{try{v&&!v.done&&(o=g.return)&&o.call(g)}finally{if(r)throw r.error}}}else n()}else n()},i.normalizeNode=function(e){var t=Qg(e,2),n=t[0],o=t[1],a=_y.getNodeType(n);return"bulleted-list"!==a&&"numbered-list"!==a||jg.unwrapNodes(i,{at:o}),r([n,o])},i},menus:[xB,OB],elemsToHtml:[DB],parseElemsHtml:[TB,BB]};YE("en",{tableModule:{modal:{border:"Border",borderWidth:"Width",bgColor:"Back color",align:"Text Align",ok:"OK"},color:{default:"Default color",clear:"Clear back color"},borderStyle:{none:"None",solid:"Solid",dotted:"Dotted",dashed:"Dashed",double:"Double",groove:"Groove",ridge:"Ridge",inset:"Inset",outset:"Outset"},deleteCol:"Delete column",deleteRow:"Delete row",deleteTable:"Delete table",widthAuto:"Fit width",insertCol:"Insert column",insertRow:"Insert row",insertTable:"Insert table",header:"Header",mergeCell:"merge cell",splitCell:"split cell",tableProperty:"Table property",cellProperty:"Cell property"}}),YE("zh-CN",{tableModule:{modal:{border:"边框",borderWidth:"宽度",bgColor:"背景色",align:"对齐方式",ok:"确定"},color:{default:"默认颜色",clear:"清除背景色"},borderStyle:{none:"无样式",solid:"实线",dotted:"点状虚线",dashed:"虚线",double:"双线",groove:"凹槽边框",ridge:"菱形边框",inset:"凹边框",outset:"凸边框"},deleteCol:"删除列",deleteRow:"删除行",deleteTable:"删除表格",widthAuto:"适应宽度",insertCol:"插入列",insertRow:"插入行",insertTable:"插入表格",header:"表头",mergeCell:"合并单元格",splitCell:"拆分单元格",tableProperty:"表格属性",cellProperty:"单元格属性"}});var PB={type:"table",elemToHtml:function(e,t){var n=e,r=n.width,o=void 0===r?"auto":r,i=n.columnWidths,a=n.height,s=void 0===a?"auto":a,u=null==i?void 0:i.map(function(e){return"<col width=".concat(e,"></col>")}).join(""),l=u?'<colgroup contentEditable="false">'.concat(u,"</colgroup>"):"";return'<table style="width: '.concat(o,";table-layout: fixed;height:").concat(s,'">').concat(l,"<tbody>").concat(t,"</tbody></table>")}},_B={type:"table-row",elemToHtml:function(e,t){var n=e.height,r=n?' style="height: '.concat(n,'px"'):"";return"<tr".concat(r,">").concat(t,"</tr>")}},RB={type:"table-cell",elemToHtml:function(e,t){var n=e,r=n.colSpan,o=void 0===r?1:r,i=n.rowSpan,a=void 0===i?1:i,s=n.isHeader,u=void 0!==s&&s,l=n.width,c=void 0===l?"auto":l,d=n.hidden;if(void 0!==d&&d)return"";var f=u?"th":"td";return"<".concat(f,' colSpan="').concat(o,'" rowSpan="').concat(a,'" width="').concat(c,'">').concat(t,"</").concat(f,">")}},LB='<svg viewBox="0 0 1024 1024"><path d="M236.8 128L896 787.2V128H236.8z m614.4 704L192 172.8V832h659.2zM192 64h704c38.4 0 64 25.6 64 64v704c0 38.4-25.6 64-64 64H192c-38.4 0-64-25.6-64-64V128c0-38.4 25.6-64 64-64z"></path></svg>',MB={blocks:{td:"table-cell",th:"table-cell",content:"paragraph",tr:"table-row",table:"table",tbody:"table-body"}};function jB(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var r=MB,o=t.map(function(e){var t;return null===(t=null==r?void 0:r.blocks)||void 0===t?void 0:t[e]});return function(e){return function(e){return!Kh.isEditor(e)&&$h.isElement(e)&&"type"in e}(e)&&o.includes(e.type)}}function HB(e,t){for(var n=Qg(t,2),r=n[0],o=n[1],i=[],a=2;a<arguments.length;a++)i[a-2]=arguments[a];var s=Qg(eg.common(e,r,o),2),u=s[0],l=s[1];return!!jB.apply(void 0,ev([e],Qg(i),!1))(u,l)||!!Kh.above(e,{match:jB.apply(void 0,ev([e],Qg(i),!1)),at:l})}function zB(e,t){var n,r;void 0===t&&(t={});var o=[];try{for(var i=Jg(function(e,t){var n,r,o,i,a,s,u,l,c,d,f,p,h,g,v,m,y,b;return void 0===t&&(t={}),Zg(this,function(E){switch(E.label){case 0:if(n=Qg(Kh.nodes(e,{match:jB(e,"table"),at:t.at}),1),!(r=n[0]))return[2,[]];o=Qg(r,2),i=o[1],E.label=1;case 1:E.trys.push([1,6,7,8]),a=Jg(Kh.nodes(e,{match:jB(e,"table"),at:i})),s=a.next(),E.label=2;case 2:if(s.done)return[3,5];u=Qg(s.value,2),l=u[1],c=[];try{for(y=void 0,d=Jg(Kh.nodes(e,{match:jB(e,"tr"),at:l})),f=d.next();!f.done;f=d.next())p=Qg(f.value,2),h=p[1],c.push(ev([],Qg(Kh.nodes(e,{match:jB(e,"th","td"),at:h})),!1))}catch(e){y={error:e}}finally{try{f&&!f.done&&(b=d.return)&&b.call(d)}finally{if(y)throw y.error}}return[4,c];case 3:E.sent(),E.label=4;case 4:return s=a.next(),[3,2];case 5:return[3,8];case 6:return g=E.sent(),v={error:g},[3,8];case 7:try{s&&!s.done&&(m=a.return)&&m.call(a)}finally{if(v)throw v.error}return[7];case 8:return[2]}})}(e,{at:t.at})),a=i.next();!a.done;a=i.next()){for(var s=a.value,u=[],l=0,c=0;c<s.length;c+=1)s[c]&&(l=Math.max(l,s[c].length));for(c=0;c<s.length;c+=1)if(u[c]||(u[c]=[]),s[c])for(var d=0;d<s[c].length;d+=1)if(s[c][d]&&s[c][d][0]){for(var f=Qg(s[c][d],1)[0],p=f.rowSpan,h=void 0===p?1:p,g=f.colSpan,v=void 0===g?1:g,m=d;u[c]&&u[c][m];)m+=1;for(var y=0;y<v;y+=1)for(var b=0;b<h;b+=1){var E=c+b,C=m+y;u[E]||(u[E]=[]),u[E][C]||(u[E][C]=[s[c][d],{rtl:y+1,ltr:v-y,ttb:b+1,btt:h-b}])}}o.push.apply(o,ev([],Qg(u),!1))}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return o}var $B=function(){function e(e,t){this.x=e,this.y=t}return e.valueOf=function(e,t){return new this(e,t)},e.equals=function(e,t){return e.x===t.x&&e.y===t.y},e}();function UB(e){return e.length?e[0].tagName.toLowerCase():""}function VB(e,t){for(var n="",r=(e.attr("style")||"").split(";"),o=r.length,i=0;i<o;i+=1){var a=r[i];if(a){var s=a.split(":");s[0].trim()===t&&(n=s[1].trim())}}return n}Nm&&am.fn&&(am.fn.append=Nm),gm&&am.fn&&(am.fn.on=gm),jm&&am.fn&&(am.fn.focus=jm),cm&&am.fn&&(am.fn.attr=cm),hm&&am.fn&&(am.fn.val=hm),Am&&am.fn&&(am.fn.html=Am),pm&&am.fn&&(am.fn.dataset=pm),sm&&am.fn&&(am.fn.addClass=sm),um&&am.fn&&(am.fn.removeClass=um),Im&&am.fn&&(am.fn.children=Im),wm&&am.fn&&(am.fn.each=wm),Fm&&am.fn&&(am.fn.find=Fm),fm&&am.fn&&(am.fn.data=fm),Em&&am.fn&&(am.fn.hide=Em),Cm&&am.fn&&(am.fn.show=Cm);var WB=new WeakMap,GB=new WeakMap,qB=function(){function e(){this.title=QE("tableModule.tableProperty"),this.iconSvg='<svg viewBox="0 0 20 20"><path d="M8 2v5h4V2h1v5h5v1h-5v4h.021l-.172.351-1.916.28-.151.027c-.287.063-.54.182-.755.341L8 13v5H7v-5H2v-1h5V8H2V7h5V2h1zm4 6H8v4h4V8z" opacity=".6"/><path d="m15.5 11.5 1.323 2.68 2.957.43-2.14 2.085.505 2.946L15.5 18.25l-2.645 1.39.505-2.945-2.14-2.086 2.957-.43L15.5 11.5zM17 1a2 2 0 0 1 2 2v9.475l-.85-.124-.857-1.736a2.048 2.048 0 0 0-.292-.44L17 3H3v14h7.808l.402.392L10.935 19H3a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2h14z"/></svg>',this.tag="button",this.showModal=!0,this.modalWidth=300,this.menu="table",this.borderStyle=[{value:"none",label:QE("tableModule.borderStyle.none")},{value:"solid",label:QE("tableModule.borderStyle.solid")},{value:"dotted",label:QE("tableModule.borderStyle.dotted")},{value:"dashed",label:QE("tableModule.borderStyle.dashed")},{value:"double",label:QE("tableModule.borderStyle.double")},{value:"groove",label:QE("tableModule.borderStyle.groove")},{value:"ridge",label:QE("tableModule.borderStyle.ridge")},{value:"inset",label:QE("tableModule.borderStyle.inset")},{value:"outset",label:QE("tableModule.borderStyle.outset")}],this.textAlignOptions=[{value:"left",label:QE("justify.left"),svg:'<svg viewBox="0 0 1024 1024"><path d="M768 793.6v102.4H51.2v-102.4h716.8z m204.8-230.4v102.4H51.2v-102.4h921.6z m-204.8-230.4v102.4H51.2v-102.4h716.8zM972.8 102.4v102.4H51.2V102.4h921.6z"></path></svg>'},{value:"center",label:QE("justify.center"),svg:'<svg viewBox="0 0 1024 1024"><path d="M870.4 793.6v102.4H153.6v-102.4h716.8z m102.4-230.4v102.4H51.2v-102.4h921.6z m-102.4-230.4v102.4H153.6v-102.4h716.8zM972.8 102.4v102.4H51.2V102.4h921.6z"></path></svg>'},{value:"right",label:QE("justify.right"),svg:'<svg viewBox="0 0 1024 1024"><path d="M972.8 793.6v102.4H256v-102.4h716.8z m0-230.4v102.4H51.2v-102.4h921.6z m0-230.4v102.4H256v-102.4h716.8zM972.8 102.4v102.4H51.2V102.4h921.6z"></path></svg>'},{value:"justify",label:QE("justify.justify"),svg:'<svg viewBox="0 0 1024 1024"><path d="M0 64h1024v128H0z m0 192h1024v128H0z m0 192h1024v128H0z m0 192h1024v128H0z m0 192h1024v128H0z"></path></svg>'}]}return e.prototype.getValue=function(e){return""},e.prototype.isActive=function(e){return!1},e.prototype.isDisabled=function(e){return null==_y.getSelectedNodeByType(e,"table")},e.prototype.exec=function(e,t){},e.prototype.getModalContentNode=function(e){return Qg(Kh.nodes(e,{match:jB(e,"table")}),1)[0]},e.prototype.getModalPositionNode=function(e){return null},e.prototype.getModalContentElem=function(e){var t=this,n=this.getModalContentNode(e);if(!n)return null;var r=Qg(n,2),o=r[0],i=r[1],a=am('<div>\n <label class="babel-container">\n <span>'.concat(QE("tableModule.modal.border"),'</span>\n <span class="babel-container-border">\n <select name="borderStyle">\n ').concat(this.borderStyle.map(function(e){return'<option value="'.concat(e.value,'">').concat(e.label,"</option>")}).join(""),'\n </select>\n <span class="color-group" data-mark="color">\n <span class="color-group-block"></span>\n <input name="borderColor" type="hidden">\n </span>\n <input name="borderWidth" type="number" placeholder="').concat(QE("tableModule.modal.borderWidth"),'">\n </span>\n </label>\n <div class="babel-container">\n <span>').concat(QE("tableModule.modal.bgColor"),'</span>\n <span class="babel-container-background">\n <span class="color-group" data-mark="bgColor">\n <span class="color-group-block"></span>\n <input name="backgroundColor" type="hidden">\n </span>\n </span>\n </div>\n <label class="babel-container">\n <span>').concat(QE("tableModule.modal.align"),'</span>\n <span class="babel-container-align">\n <select name="textAlign">\n ').concat(this.textAlignOptions.map(function(e){return'<option value="'.concat(e.value,'">').concat(e.label,"</option>")}).join(""),'\n </select>\n </span>\n </label>\n <div class="button-container">\n <button type="button">').concat(QE("tableModule.modal.ok"),"</button>\n </div>\n </div>"));a.find("[name]").each(function(e){am(e).val(o[am(e).attr("name")])});var s=function(e,t){t?am(".color-group-block",e).css("background-color",t).empty():am(".color-group-block",e).css("background-color","").html(LB)};return a.find(".color-group").each(function(n){var r=am('[type="hidden"]',n).val()||"";s(n,r);var o=am(n);o.on("click",function(){a.find(".color-group .w-e-drop-panel").hide();var i=o.data("panel");i?i.show():(i=t.getPanelContentElem(e,{mark:o.data("mark"),selectedColor:r,callback:function(e){am('[type="hidden"]',n).val(e||""),s(n,e),i.hide()}}),o.append(i),o.data("panel",i))})}),a.find("button").on("click",function(){var n=Array.from(a.find("[name]")).reduce(function(e,t){return e[am(t).attr("name")]=am(t).val(),e},{}),r=WB.get(e);"cell"===t.menu&&(null==r?void 0:r.length)?r.forEach(function(t){t.forEach(function(t){jg.setNodes(e,n,{at:t[0][1]})})}):jg.setNodes(e,n,{at:i}),setTimeout(function(){e.focus()})}),a[0]},e.prototype.getPanelContentElem=function(e,t){var n=t.mark,r=t.selectedColor,o=t.callback,i=am('<ul class="w-e-panel-content-color"></ul>');i.on("click","li",function(e){var t=e.target;if(t){e.preventDefault(),e.stopPropagation();var n=am(t).attr("data-value");o(n)}});var a=e.getMenuConfig(n).colors;(void 0===a?[]:a).forEach(function(e){var t=am('<div class="color-block" data-value="'.concat(e,'"></div>'));t.css("background-color",e);var n=am('<li data-value="'.concat(e,'"></li>'));r===e&&n.addClass("active"),n.append(t),i.append(n)});var s="";"color"===n&&(s=QE("tableModule.color.default")),"bgColor"===n&&(s=QE("tableModule.color.clear"));var u=am('\n <li data-value="" class="clear">\n '.concat(LB,"\n ").concat(s,"\n </li>\n "));i.prepend(u);var l=am('<div class="w-e-drop-panel"></div>');return l.append(i),l},e}(),KB=function(e){function t(){var t=e.apply(this,ev([],Qg(arguments),!1))||this;return t.title=QE("tableModule.cellProperty"),t.iconSvg='<svg viewBox="0 0 20 20"><path d="m11.105 18-.17 1H2.5A1.5 1.5 0 0 1 1 17.5v-15A1.5 1.5 0 0 1 2.5 1h15A1.5 1.5 0 0 1 19 2.5v9.975l-.85-.124-.15-.302V8h-5v4h.021l-.172.351-1.916.28-.151.027c-.287.063-.54.182-.755.341L8 13v5h3.105zM2 12h5V8H2v4zm10-4H8v4h4V8zM2 2v5h5V2H2zm0 16h5v-5H2v5zM13 7h5V2h-5v5zM8 2v5h4V2H8z" opacity=".6"/><path d="m15.5 11.5 1.323 2.68 2.957.43-2.14 2.085.505 2.946L15.5 18.25l-2.645 1.39.505-2.945-2.14-2.086 2.957-.43L15.5 11.5zM13 6a1 1 0 0 1 1 1v3.172a2.047 2.047 0 0 0-.293.443l-.858 1.736-1.916.28-.151.027A1.976 1.976 0 0 0 9.315 14H7a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h6zm-1 2H8v4h4V8z"/></svg>',t.tag="button",t.showModal=!0,t.modalWidth=300,t.menu="cell",t}return Kg(t,e),t.prototype.getModalContentNode=function(e){return Qg(Kh.nodes(e,{match:jB(e,"td")}),1)[0]},t}(qB),YB=function(){function e(){this.title=QE("tableModule.deleteCol"),this.iconSvg='<svg viewBox="0 0 1048 1024"><path d="M327.68 510.976L393.216 445.44v-13.1072L327.68 366.7968V510.976z m327.68-78.4384l65.536-65.536V507.904L655.36 442.368v-9.8304z m393.216 484.9664V0H0v917.504h1048.576z m-65.536-131.072h-262.144v-52.4288l-13.1072 13.1072-52.4288-52.4288v91.7504H393.216v-91.7504l-52.4288 52.4288-13.1072-13.1072v52.4288H65.536V65.536H327.68v121.2416l36.0448-36.0448 29.4912 29.4912V62.2592h262.144V180.224l49.152-49.152 16.384 16.384V62.2592h262.144V786.432z m-294.912-108.1344l-160.5632-160.5632-167.1168 167.1168-78.6432-78.6432 167.1168-167.1168L288.3584 278.528l78.6432-78.6432 160.5632 160.5632 163.84-163.84 78.6432 78.6432-163.84 163.84 160.5632 160.5632-78.6432 78.6432z"></path></svg>',this.tag="button"}return e.prototype.getValue=function(e){return""},e.prototype.isActive=function(e){return!1},e.prototype.isDisabled=function(e){var t=e.selection;return null==t||(!fg.isCollapsed(t)||null==_y.getSelectedNodeByType(e,"table-cell"))},e.prototype.exec=function(e,t){if(!this.isDisabled(e)){var n=Qg(Kh.nodes(e,{match:function(e){return _y.checkNodeType(e,"table-cell")},universal:!0}),1),r=Qg(n[0],2),o=r[0],i=r[1],a=_y.getParentNode(e,o),s=(null==a?void 0:a.children.length)||0;if(!a||s<=1)jg.removeNodes(e,{mode:"highest"});else if(null!=_y.getParentNode(e,a)){var u=zB(e),l=0;e:for(var c=0;c<u.length;c+=1)for(var d=0;d<u[c].length;d+=1){var f=Qg(u[c][d],1),p=Qg(f[0],2)[1];if(og.equals(i,p)){l=d;break e}}Kh.withoutNormalizing(e,function(){for(var t,n,r=new Set,o=new Set,i=0;i<u.length;i+=1)if(u[i]&&u[i][l]){var a=Qg(u[i][l],2),s=Qg(a[0],2)[1],c=a[1],d=c.rtl,f=c.ltr,p=c.ttb,h=c.btt,g=s.join(",");if(d>1||f>1||p>1||h>1){var v=i-(p-1),m=l-(d-1);if(v<0||v>=u.length||!u[v]||!u[v][m])continue;var y=Qg(u[v][m],1),b=Qg(y[0],2),E=b[0],C=b[1],D=C.join(",");if(!o.has(D)){o.add(D);var w=E.rowSpan,S=void 0===w?1:w,A=E.colSpan,x=void 0===A?1:A,O=Math.max(x-1,1);jg.setNodes(e,{rowSpan:S,colSpan:O},{at:C})}}else r.add(g)}var N=Array.from(r);N.sort(function(e,t){var n=e.split(",").map(Number),r=t.split(",").map(Number);return n[n.length-2]!==r[r.length-2]?r[r.length-2]-n[n.length-2]:r[r.length-1]-n[n.length-1]});try{for(var B=Jg(N),T=B.next();!T.done;T=B.next()){var k=T.value.split(",").map(Number);try{Kh.hasPath(e,k)&&jg.removeNodes(e,{at:k})}catch(e){console.warn("删除单元格失败:",k,e)}}}catch(e){t={error:e}}finally{try{T&&!T.done&&(n=B.return)&&n.call(B)}finally{if(t)throw t.error}}var F=Qg(Kh.nodes(e,{match:function(e){return _y.checkNodeType(e,"table")},universal:!0}),1),I=F[0];if(I){var P=Qg(I,2),_=P[0],R=P[1],L=_.columnWidths,M=ev([],Qg(void 0===L?[]:L),!1);M.splice(l,1),jg.setNodes(e,{columnWidths:M},{at:R})}})}}},e}(),XB=function(){function e(){this.title=QE("tableModule.deleteRow"),this.iconSvg='<svg viewBox="0 0 1048 1024"><path d="M907.6736 586.5472L747.1104 425.984l163.84-163.84-78.6432-78.6432-163.84 163.84L507.904 186.7776 429.2608 262.144l163.84 163.84-167.1168 167.1168 78.6432 78.6432 167.1168-167.1168 160.5632 160.5632 75.3664-78.6432zM0 917.504V0h1048.576v917.504H0z m983.04-327.68h-22.9376l-65.536-65.536H983.04V327.68h-91.7504l65.536-65.536h26.2144V65.536H65.536v196.608h317.8496l65.536 65.536H65.536v196.608h380.1088l-65.536 65.536H65.536v196.608H983.04v-196.608z"></path></svg>',this.tag="button"}return e.prototype.getValue=function(e){return""},e.prototype.isActive=function(e){return!1},e.prototype.isDisabled=function(e){var t=e.selection;return null==t||(!fg.isCollapsed(t)||null==_y.getSelectedNodeByType(e,"table-row"))},e.prototype.exec=function(e,t){if(!this.isDisabled(e)){var n=Qg(Kh.nodes(e,{match:function(e){return _y.checkNodeType(e,"table-row")},universal:!0}),1),r=Qg(n[0],2),o=r[0],i=r[1],a=_y.getParentNode(e,o);if(((null==a?void 0:a.children.length)||0)<=1)jg.removeNodes(e,{mode:"highest"});else{var s=Qg(Kh.nodes(e,{match:function(e){return _y.checkNodeType(e,"table-cell")},universal:!0}),1),u=Qg(s[0],2)[1],l=zB(e),c=0;e:for(var d=0;d<l.length;d+=1)for(var f=0;f<l[d].length;f+=1){var p=Qg(l[d][f],1),h=Qg(p[0],2)[1];if(og.equals(u,h)){c=d;break e}}Kh.withoutNormalizing(e,function(){for(var t,n,r=[],o=0;o<l[c].length;o+=1){var a=Qg(l[c][o],2),s=Qg(a[0],1)[0].hidden,u=a[1],d=u.ttb,f=u.btt,p=u.rtl;if(d>1||f>1){var h=c-(d-1);if(h<0||h>=l.length||!l[h]||!l[h][o])continue;var g=Qg(l[h][o],1),v=Qg(g[0],2),m=v[0],y=v[1],b=m,E=b.rowSpan,C=void 0===E?1:E,D=b.colSpan,w=void 0===D?1:D;if(s)jg.setNodes(e,{rowSpan:Math.max(C-1,1),colSpan:w},{at:y});else if(1===d&&1===p){if(c+1<l.length&&C>1){var S={type:"table-cell",rowSpan:C-1,colSpan:w,hidden:!1,children:b.children.map(function(e){return Yg({},e)})};b.isHeader&&(S.isHeader=b.isHeader),b.width&&(S.width=b.width),b.backgroundColor&&(S.backgroundColor=b.backgroundColor),b.borderWidth&&(S.borderWidth=b.borderWidth),b.borderStyle&&(S.borderStyle=b.borderStyle),b.borderColor&&(S.borderColor=b.borderColor),b.textAlign&&(S.textAlign=b.textAlign),r.push({cell:S,columnIndex:o})}else jg.setNodes(e,{rowSpan:Math.max(C-1,1),colSpan:w},{at:y})}else jg.setNodes(e,{rowSpan:Math.max(C-1,1),colSpan:w},{at:y})}}if(jg.removeNodes(e,{at:i}),r.length>0){var A=i;try{r.sort(function(e,t){return e.columnIndex-t.columnIndex});try{for(var x=Jg(r),O=x.next();!O.done;O=x.next()){var N=O.value,B=N.cell,T=N.columnIndex;try{var k=ev(ev([],Qg(A),!1),[T],!1);jg.insertNodes(e,B,{at:k})}catch(t){try{var F=Qg(Kh.node(e,A),1)[0].children.length,I=ev(ev([],Qg(A),!1),[F],!1);jg.insertNodes(e,B,{at:I})}catch(e){console.warn("插入新单元格失败:",e)}}}}catch(e){t={error:e}}finally{try{O&&!O.done&&(n=x.return)&&n.call(x)}finally{if(t)throw t.error}}}catch(e){console.warn("插入新单元格失败:",e)}}})}}},e}(),ZB=function(){function e(){this.title=QE("tableModule.deleteTable"),this.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M826.8032 356.5312c-19.328 0-36.3776 15.6928-36.3776 35.0464v524.2624c0 19.328-16 34.56-35.328 34.56H264.9344c-19.328 0-35.5072-15.3088-35.5072-34.56V390.0416c0-19.328-14.1568-35.0464-33.5104-35.0464s-33.5104 15.6928-33.5104 35.0464V915.712c0 57.9328 44.6208 108.288 102.528 108.288H755.2c57.9328 0 108.0832-50.4576 108.0832-108.288V391.4752c-0.1024-19.2512-17.1264-34.944-36.48-34.944z" p-id="9577"></path><path d="M437.1712 775.7568V390.6048c0-19.328-14.1568-35.0464-33.5104-35.0464s-33.5104 15.616-33.5104 35.0464v385.152c0 19.328 14.1568 35.0464 33.5104 35.0464s33.5104-15.7184 33.5104-35.0464zM649.7024 775.7568V390.6048c0-19.328-17.0496-35.0464-36.3776-35.0464s-36.3776 15.616-36.3776 35.0464v385.152c0 19.328 17.0496 35.0464 36.3776 35.0464s36.3776-15.7184 36.3776-35.0464zM965.0432 217.0368h-174.6176V145.5104c0-57.9328-47.2064-101.76-104.6528-101.76h-350.976c-57.8304 0-105.3952 43.8528-105.3952 101.76v71.5264H54.784c-19.4304 0-35.0464 14.1568-35.0464 33.5104 0 19.328 15.616 33.5104 35.0464 33.5104h910.3616c19.328 0 35.0464-14.1568 35.0464-33.5104 0-19.3536-15.6928-33.5104-35.1488-33.5104z m-247.3728 0H297.3952V145.5104c0-19.328 18.2016-34.7648 37.4272-34.7648h350.976c19.1488 0 31.872 15.1296 31.872 34.7648v71.5264z"></path></svg>',this.tag="button"}return e.prototype.getValue=function(e){return""},e.prototype.isActive=function(e){return!1},e.prototype.isDisabled=function(e){return null==e.selection||null==_y.getSelectedNodeByType(e,"table")},e.prototype.exec=function(e,t){this.isDisabled(e)||jg.removeNodes(e,{mode:"highest"})},e}(),JB=function(){function e(){this.title=QE("tableModule.widthAuto"),this.iconSvg='<svg viewBox="0 0 1228 1024"><path d="M862.514337 563.200461H404.581995v121.753478a13.311987 13.311987 0 0 1-6.655993 11.468789 10.23999 10.23999 0 0 1-12.083188-1.433599l-204.799795-179.199821a13.721586 13.721586 0 0 1 0-20.479979l204.799795-179.302221a10.23999 10.23999 0 0 1 12.185588-1.535998 13.209587 13.209587 0 0 1 6.553593 11.673588v115.097485h457.932342V319.693504a11.571188 11.571188 0 0 1 18.841582-10.239989l204.799795 179.19982a13.721586 13.721586 0 0 1 0 20.47998l-204.799795 179.199821a10.23999 10.23999 0 0 1-12.185588 1.535998 13.311987 13.311987 0 0 1-6.655994-11.571188V563.200461zM136.499064 14.951409v993.893406a15.257585 15.257585 0 0 1-15.155185 15.052785H15.155185A15.155185 15.155185 0 0 1 0 1008.844815V14.951409a15.257585 15.257585 0 0 1 15.155185-15.052785h106.086294a15.155185 15.155185 0 0 1 15.257585 15.155185zM1228.798771 14.951409v993.893406a15.257585 15.257585 0 0 1-15.155185 15.052785h-106.188693a15.155185 15.155185 0 0 1-15.155185-15.052785V14.951409a15.257585 15.257585 0 0 1 15.155185-15.052785h106.086293A15.155185 15.155185 0 0 1 1228.798771 15.053809z"></path></svg>',this.tag="button"}return e.prototype.getValue=function(e){return!1},e.prototype.isActive=function(e){return!1},e.prototype.isDisabled=function(e){var t=e.selection;return null==t||(!fg.isCollapsed(t)||null==_y.getSelectedNodeByType(e,"table"))},e.prototype.exec=function(e,t){if(!this.isDisabled(e)){var n=_y.getSelectedNodeByType(e,"table");if(n){var r=n.columnWidths,o=void 0===r?[]:r,i=_y.toDOMNode(e,n).querySelector(".table-container");if(i&&0!==o.length){var a=i.clientWidth,s=o.reduce(function(e,t){return e+t},0),u=o.map(function(e){var t=e/s;return Math.floor(t*a)}),l=e.getMenuConfig("insertTable").minWidth,c=parseInt(String(void 0===l?60:l),10)||60,d=u.map(function(e){return Math.max(c,e)}),f=d.reduce(function(e,t){return e+t},0);if(f>a){var p=a/f,h=d.map(function(e){return Math.max(c,Math.floor(e*p))});v={width:"auto",columnWidths:h};jg.setNodes(e,v,{mode:"highest"})}else{h=ev([],Qg(d),!1);var g=a-f-1;g>0&&h.length>0&&(h[h.length-1]+=g);v={width:"auto",columnWidths:h};jg.setNodes(e,v,{mode:"highest"})}}else{var v={width:"auto"};jg.setNodes(e,v,{mode:"highest"})}}}},e}();function QB(e){var t=e.children||[];return 0===t.length?[]:(t[0]||{}).children||[]}function eT(e){return QB(e).every(function(e){return!!e.isHeader})}var tT=function(){function e(){this.title=QE("tableModule.insertCol"),this.iconSvg='<svg viewBox="0 0 1048 1024"><path d="M327.68 193.3312v186.7776H140.9024v91.7504H327.68v186.7776h88.4736V471.8592h190.0544V380.1088H416.1536V193.3312zM0 917.504V0h1048.576v917.504H0zM655.36 65.536H65.536v720.896H655.36V65.536z m327.68 0h-262.144v196.608h262.144V65.536z m0 262.144h-262.144v196.608h262.144V327.68z m0 262.144h-262.144v196.608h262.144v-196.608z"></path></svg>',this.tag="button"}return e.prototype.getValue=function(e){return""},e.prototype.isActive=function(e){return!1},e.prototype.isDisabled=function(e){var t=e.selection;if(null==t)return!0;if(!fg.isCollapsed(t))return!0;var n=_y.getSelectedNodeByType(e,"table");if(null==n)return!0;try{var r=Qg(Kh.nodes(e,{match:function(e){return _y.checkNodeType(e,"table-cell")},universal:!0}),1),o=r[0];if(!o)return!0;for(var i=Qg(o,2)[1],a=zB(e),s=-1,u=0;u<a.length;u+=1){for(var l=0;l<a[u].length;l+=1){var c=Qg(a[u][l],1),d=Qg(c[0],2)[1];if(og.equals(i,d)){s=l;break}}if(-1!==s)break}if(-1===s)return!0;var f=n.columnWidths,p=(void 0===f?[]:f)[s];if(p&&p<20)return!0}catch(e){return!0}return!1},e.prototype.exec=function(e,t){if(!this.isDisabled(e)){var n=Qg(Kh.nodes(e,{match:function(e){return _y.checkNodeType(e,"table-cell")},universal:!0}),1),r=Qg(n[0],2),o=r[0],i=r[1],a=_y.getParentNode(e,o);if(null!=a){var s=_y.getParentNode(e,a);if(null!=s){for(var u=zB(e),l=0,c=0;c<u.length;c+=1)for(var d=0;d<u[c].length;d+=1){var f=Qg(u[c][d],1),p=Qg(f[0],2)[1];if(og.equals(i,p)){l=d;break}}Kh.withoutNormalizing(e,function(){for(var t=new Set,n=new Set,r=0;r<u.length;r+=1)if(u[r]&&u[r][l]){var o=Qg(u[r][l],2);Qg(o[0],1);var i=o[1],a=i.rtl,c=i.ltr,d=i.ttb,f=i.btt;if(a>1||c>1||d>1||f>1){var p=r-(d-1),h=l-(a-1);if(p<0||p>=u.length||!u[p]||!u[p][h])continue;var g=Qg(u[p][h],1),v=Qg(g[0],2),m=v[0],y=v[1],b=y.join(",");if(t.has(b))n.add(r);else{t.add(b);var E=m.rowSpan,C=void 0===E?1:E,D=m.colSpan,w=(void 0===D?1:D)+1;m.hidden||jg.setNodes(e,{colSpan:w},{at:y});for(var S=0;S<C;S+=1)n.add(p+S)}}}for(r=0;r<u.length;r+=1)if(!n.has(r)&&u[r]&&u[r][l]){var A={type:"table-cell",children:[{text:""}]};0===r&&eT(s)&&(A.isHeader=!0);var x=Qg(u[r][l],1),O=Qg(x[0],2)[1];jg.insertNodes(e,A,{at:O})}var N=Qg(Kh.nodes(e,{match:function(e){return _y.checkNodeType(e,"table")},universal:!0}),1),B=N[0];if(B){var T=Qg(B,2),k=T[0],F=T[1],I=k.columnWidths,P=void 0===I?[]:I,_=ev([],Qg(P),!1),R=e.getMenuConfig("insertTable").minWidth,L=void 0===R?60:R,M=P[l]||parseInt(L,10)||60,j=Math.floor(M/2),H=M-j;_.splice(l,0,j),_[l+1]=H,jg.setNodes(e,{columnWidths:_},{at:F})}})}}}},e}(),nT=function(){function e(){this.title=QE("tableModule.insertRow"),this.iconSvg='<svg viewBox="0 0 1048 1024"><path d="M707.7888 521.0112h-147.456v-147.456H488.2432v147.456h-147.456v68.8128h147.456v147.456h72.0896v-147.456h147.456zM0 917.504V0h1048.576v917.504H0zM327.68 65.536H65.536v196.608H327.68V65.536z m327.68 0H393.216v196.608h262.144V65.536z m327.68 0h-262.144v196.608h262.144V65.536z m0 258.8672H65.536v462.0288H983.04V324.4032z"></path></svg>',this.tag="button"}return e.prototype.getValue=function(e){return""},e.prototype.isActive=function(e){return!1},e.prototype.isDisabled=function(e){var t=e.selection;return null==t||(!fg.isCollapsed(t)||null==_y.getSelectedNodeByType(e,"table"))},e.prototype.exec=function(e,t){var n;if(!this.isDisabled(e)){var r=Qg(Kh.nodes(e,{match:function(e){return _y.checkNodeType(e,"table-cell")},universal:!0}),1),o=Qg(r[0],2)[1],i=zB(e),a=0;e:for(var s=0;s<i.length;s+=1)for(var u=0;u<i[s].length;u+=1){var l=Qg(i[s][u],1),c=Qg(l[0],2)[1];if(og.equals(o,c)){a=s;break e}}var d=(null===(n=i[a])||void 0===n?void 0:n.length)||0;0!==d&&Kh.withoutNormalizing(e,function(){for(var t=a+1,n=t>=0&&t<i.length,r=[],s=0;n&&s<i[a].length;s+=1){var u=Qg(i[a][s],2)[1],l=u.ttb,c=u.btt;if(l>1||c>1){var f=a-(l-1);if(f<0||f>=i.length||!i[f]||!i[f][s])continue;var p=Qg(i[f][s],1),h=Qg(p[0],2),g=h[0],v=h[1],m=g.rowSpan||1;r.push(s),g.hidden||jg.setNodes(e,{rowSpan:m+1},{at:v})}}for(var y=(e.getMenuConfig("insertTable")||{}).minRowHeight,b={type:"table-row",children:[],height:parseInt((void 0===y?30:y).toString(),10)||30},E=0;E<d;E+=1)if(!r.includes(E)){b.children.push({type:"table-cell",children:[{text:""}]})}var C=og.parent(o),D=og.next(C);jg.insertNodes(e,b,{at:D})})}},e}();var rT=function(){function e(){this.title=QE("tableModule.insertTable"),this.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M0 64v896h1024V64H0z m384 576v-192h256v192h-256z m256 64v192h-256v-192h256z m0-512v192h-256V192h256zM320 192v192H64V192h256z m-256 256h256v192H64v-192z m640 0h256v192h-256v-192z m0-64V192h256v192h-256zM64 704h256v192H64v-192z m640 192v-192h256v192h-256z"></path></svg>',this.tag="button",this.showDropPanel=!0,this.$content=null}return e.prototype.getValue=function(e){return""},e.prototype.isActive=function(e){return!1},e.prototype.exec=function(e,t){},e.prototype.isDisabled=function(e){var t=e.selection;return null==t||(!fg.isCollapsed(t)||!!_y.getSelectedElems(e).some(function(t){var n=_y.getNodeType(t);return"pre"===n||("table"===n||("list-item"===n||!!e.isVoid(t)))}))},e.prototype.getPanelContentElem=function(e){var t=this;if(this.$content)return this.$content[0];for(var n=am('<div class="w-e-panel-content-table"></div>'),r=am("<span>0 × 0</span>"),o=am("<table></table>"),i=0;i<10;i+=1){for(var a=am("<tr></tr>"),s=0;s<10;s+=1){var u=am("<td></td>");u.attr("data-x",s.toString()),u.attr("data-y",i.toString()),a.append(u),u.on("mouseenter",function(e){var t=e.target;if(null!=t){var n=am(t).dataset(),i=n.x,a=n.y;r[0].innerHTML="".concat(i+1," × ").concat(a+1),o.children().each(function(e){am(e).children().each(function(e){var t=am(e),n=t.dataset(),r=n.x,o=n.y;r<=i&&o<=a?t.addClass("active"):t.removeClass("active")})})}}),u.on("click",function(n){n.preventDefault();var r=n.target;if(null!=r){var o=am(r).dataset(),i=o.x,a=o.y;t.insertTable(e,a+1,i+1)}})}o.append(a)}return n.append(o),n.append(r),this.$content=n,n[0]},e.prototype.insertTable=function(e,t,n){var r=parseInt(t,10),o=parseInt(n,10);if(r&&o&&!(r<=0||o<=0)){if(_y.isSelectedEmptyParagraph(e)&&jg.removeNodes(e,{mode:"highest"}),0===e.children.length){jg.insertNodes(e,{type:"paragraph",children:[{text:""}]},{mode:"highest"})}var i=function(e,t,n){for(var r,o=[],i=e.getMenuConfig("insertTable"),a=i.minWidth,s=void 0===a?60:a,u=i.minRowHeight,l=void 0===u?30:u,c=i.tableFullWidth,d=i.tableHeader,f=Array(n).fill(parseInt(s,10)||60),p=0;p<t;p+=1){for(var h=[],g=0;g<n;g+=1){var v={type:"table-cell",children:[{text:""}]};0===p&&(v.isHeader=null===(r=null==d?void 0:d.selected)||void 0===r||r),h.push(v)}o.push({type:"table-row",children:h,height:parseInt(l,10)||30})}return{type:"table",width:(null==c?void 0:c.selected)?"100%":"auto",children:o,columnWidths:f}}(e,r,o);jg.insertNodes(e,i,{mode:"highest"})}},e}(),oT={isInTable:function(e,t){return void 0===t&&(t={}),!!Qg(Kh.nodes(e,{match:jB(e,"table"),at:t.at}),1)[0]},selection:function(e){var t,n,r,o,i,a,s,u;return Zg(this,function(l){switch(l.label){case 0:t=WB.get(e),n=0,l.label=1;case 1:if(!(t&&n<t.length))return[3,4];for(r=[],o=0;o<t[n].length;o+=1)i=Qg(t[n][o],2),a=i[0],s=i[1],u=s.ltr,1===s.ttb&&r.push(a),o+=u-1;return[4,r];case 2:l.sent(),l.label=3;case 3:return n+=1,[3,1];case 4:return[2]}})},unselect:function(e){GB.delete(e),WB.delete(e)},isSelected:function(e,t){var n=GB.get(e);return!!n&&n.has(t)}},iT=function(){function e(){this.title=QE("tableModule.mergeCell"),this.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M482.2 508.4 331.3 389c-3-2.4-7.3-.2-7.3 3.6V478H184V184h204v128c0 2.2 1.8 4 4 4h60c2.2 0 4-1.8 4-4V144c0-15.5-12.5-28-28-28H144c-15.5 0-28 12.5-28 28v736c0 15.5 12.5 28 28 28h284c15.5 0 28-12.5 28-28V712c0-2.2-1.8-4-4-4h-60c-2.2 0-4 1.8-4 4v128H184V546h140v85.4c0 3.8 4.4 6 7.3 3.6l150.9-119.4c2.4-1.8 2.4-5.4 0-7.2zM880 116H596c-15.5 0-28 12.5-28 28v168c0 2.2 1.8 4 4 4h60c2.2 0 4-1.8 4-4V184h204v294H700v-85.4c0-3.8-4.3-6-7.3-3.6l-151 119.4c-2.3 1.8-2.3 5.3 0 7.1l151 119.5c2.9 2.3 7.3.2 7.3-3.6V546h140v294H636V712c0-2.2-1.8-4-4-4h-60c-2.2 0-4 1.8-4 4v168c0 15.5 12.5 28 28 28h284c15.5 0 28-12.5 28-28V144c0-15.5-12.5-28-28-28z"/></svg>',this.tag="button"}return e.prototype.getValue=function(e){return""},e.prototype.isActive=function(e){return!1},e.prototype.isDisabled=function(e){return!this.canMerge(e)},e.prototype.exec=function(e,t){this.isDisabled(e)||(this.merge(e),oT.unselect(e))},e.prototype.canMerge=function(e){var t=WB.get(e);if(!t||!t.length)return!1;var n=Qg(t[t.length-1][t[t.length-1].length-1],1),r=Qg(n[0],2)[1],o=Qg(t[0][0],1);return!!HB(e,[Qg(o[0],2)[1],r],"table")},e.prototype.merge=function(e){if(this.canMerge(e)){var t=WB.get(e);if(t&&t.length){var n=Qg(t[0][0],1),r=Qg(n[0],2)[1],o=Qg(eg.children(e,r,{reverse:!0}),1),i=Qg(o[0],2)[1];Kh.withoutNormalizing(e,function(){for(var n,o,a,s,u,l,c=new Map,d=[],f=1/0,p=-1/0,h=1/0,g=-1/0,v=0;v<t.length;v+=1)for(var m=0;m<t[v].length;m+=1){var y=Qg(t[v][m],2),b=Qg(y[0],2),E=b[0],C=b[1],D=y[1].ttb,w=C.join(",");if(1===D&&!c.has(w)){c.set(w,{path:C,x:v,y:m,element:E});var S=E.rowSpan,A=void 0===S?1:S,x=E.colSpan,O=v,N=v+A-1,B=m,T=m+(void 0===x?1:x)-1;f=Math.min(f,O),p=Math.max(p,N),h=Math.min(h,B),g=Math.max(g,T)}}var k=p-f+1,F=g-h+1;try{for(var I=Jg(c),P=I.next();!P.done;P=I.next()){C=Qg(P.value,2)[1].path;og.equals(r,C)||d.push(C)}}catch(e){n={error:e}}finally{try{P&&!P.done&&(o=I.return)&&o.call(I)}finally{if(n)throw n.error}}d.sort(function(e,t){for(var n=0;n<Math.min(e.length,t.length);n+=1)if(e[n]!==t[n])return t[n]-e[n];return t.length-e.length});try{for(var _=Jg(d),R=_.next();!R.done;R=_.next()){C=R.value;try{if(!Kh.hasPath(e,C))continue;try{for(var L=(u=void 0,Jg(eg.children(e,C,{reverse:!0}))),M=L.next();!M.done;M=L.next()){var j=Qg(M.value,2)[1];jg.moveNodes(e,{to:og.next(i),at:j})}}catch(e){u={error:e}}finally{try{M&&!M.done&&(l=L.return)&&l.call(L)}finally{if(u)throw u.error}}jg.removeNodes(e,{at:C})}catch(e){}}}catch(e){a={error:e}}finally{try{R&&!R.done&&(s=_.return)&&s.call(_)}finally{if(a)throw a.error}}jg.setNodes(e,{rowSpan:k,colSpan:F},{at:r})})}}},e}(),aT=function(){function e(){this.title=QE("tableModule.splitCell"),this.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M362.667 494.933v53.334l25.6-25.6zm0-241.066L460.8 352V78.933H57.6v98.134h305.067zm0 535.466v57.6H57.6v98.134h403.2V691.2zM661.333 494.933v53.334l-25.6-25.6zm0-241.066L563.2 352V78.933h403.2v98.134H661.333zm0 535.466v57.6H966.4v98.134H563.2V691.2z"/><path d="M753.067 341.333 693.333 281.6 512 460.8 330.667 281.6l-59.734 59.733 181.334 181.334L270.933 704l59.734 59.733L512 582.4l181.333 181.333L753.067 704 571.733 522.667z"/></svg>',this.tag="button"}return e.prototype.getValue=function(e){return""},e.prototype.isActive=function(e){return!1},e.prototype.isDisabled=function(e){var t=Qg(Kh.nodes(e,{match:function(e){return _y.checkNodeType(e,"table-cell")}}),1),n=t[0];if(!n)return!0;var r=Qg(n,1)[0],o=r.rowSpan,i=void 0===o?1:o,a=r.colSpan;return!(i>1||(void 0===a?1:a)>1)},e.prototype.exec=function(e,t){this.isDisabled(e)||this.split(e)},e.prototype.split=function(e,t){void 0===t&&(t={});var n=Qg(Kh.nodes(e,{match:jB(e,"table","th","td"),at:t.at}),2),r=n[0],o=n[1];if(r&&o){var i=eT(Qg(r,1)[0]),a=Qg(o,2),s=a[0],u=a[1],l=s.rowSpan,c=void 0===l?1:l,d=s.colSpan,f=void 0===d?1:d;1===c&&1===f||Kh.withoutNormalizing(e,function(){jg.setNodes(e,{rowSpan:1,colSpan:1},{at:u});for(var t=1;t<f;t+=1){var n={type:"table-cell",children:[{text:""}]};0===u[u.length-2]&&i&&(n.isHeader=!0);var r=u.slice(0,-1),o=u[u.length-1]+t,a=ev(ev([],Qg(r),!1),[o],!1);try{jg.insertNodes(e,n,{at:a})}catch(t){try{var s=Qg(Kh.node(e,r),1)[0].children.length,l=ev(ev([],Qg(r),!1),[s],!1);jg.insertNodes(e,n,{at:l})}catch(e){console.warn("插入同行单元格失败: ".concat(e instanceof Error?e.message:String(e)))}}}for(var d=1;d<c;d+=1){var p=u[u.length-2]+d,h=ev(ev([],Qg(u.slice(0,-2)),!1),[p],!1);try{var g=Qg(Kh.node(e,h),1)[0];if(!g){console.warn("目标行 ".concat(p," 不存在"));continue}for(t=0;t<f;t+=1){n={type:"table-cell",children:[{text:""}]},o=u[u.length-1]+t,a=ev(ev([],Qg(h),!1),[o],!1);try{var v=g.children.length;if(o>=v){var m=ev(ev([],Qg(h),!1),[v],!1);jg.insertNodes(e,n,{at:m})}else jg.insertNodes(e,n,{at:a})}catch(t){try{var y=g.children.length;l=ev(ev([],Qg(h),!1),[y],!1);jg.insertNodes(e,n,{at:l})}catch(e){console.warn("插入单元格到第".concat(d,"行失败: ").concat(e instanceof Error?e.message:String(e)))}}}}catch(e){console.warn("处理第".concat(d,"行时出错: ").concat(e instanceof Error?e.message:String(e)))}}})}},e}(),sT=function(){function e(){this.title=QE("tableModule.header"),this.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M704 128l-64 0L384 128 320 128 0 128l0 256 0 64 0 192 0 64 0 256 320 0 64 0 256 0 64 0 320 0 0-256 0-64L1024 448 1024 384 1024 128 704 128zM640 640 384 640 384 448l256 0L640 640zM64 448l256 0 0 192L64 640 64 448zM320 896 64 896l0-192 256 0L320 896zM640 896 384 896l0-192 256 0L640 896zM960 896l-256 0 0-192 256 0L960 896zM960 640l-256 0L704 448l256 0L960 640z"></path></svg>',this.tag="button"}return e.prototype.getValue=function(e){var t=_y.getSelectedNodeByType(e,"table");return null!=t&&eT(t)},e.prototype.isActive=function(e){return!!this.getValue(e)},e.prototype.isDisabled=function(e){var t=e.selection;return null==t||(!fg.isCollapsed(t)||null==_y.getSelectedNodeByType(e,"table"))},e.prototype.exec=function(e,t){if(!this.isDisabled(e)){var n=!t,r=_y.getSelectedNodeByType(e,"table");if(null!=r)QB(r).forEach(function(t){return jg.setNodes(e,{isHeader:n},{at:_y.findPath(e,t)})})}},e}(),uT={key:"insertTable",factory:function(){return new rT}},lT={key:"deleteTable",factory:function(){return new ZB}},cT={key:"insertTableRow",factory:function(){return new nT}},dT={key:"deleteTableRow",factory:function(){return new XB}},fT={key:"insertTableCol",factory:function(){return new tT}},pT={key:"deleteTableCol",factory:function(){return new YB}},hT={key:"tableHeader",factory:function(){return new sT}},gT={key:"tableFullWidth",factory:function(){return new JB}},vT={key:"mergeTableCell",factory:function(){return new iT}},mT={key:"splitTableCell",factory:function(){return new aT}},yT={key:"setTableProperty",factory:function(){return new qB}},bT={key:"setTableCellProperty",factory:function(){return new KB}};var ET={selector:"td:not([data-w-e-type]),th:not([data-w-e-type])",parseElemHtml:function(e,t,n){var r=am(e);0===(t=t.filter(function(e){return"paragraph"===_y.getNodeType(e)||(!!Cg.isText(e)||!!n.isInline(e))})).length&&(t=[{text:r.text().replace(/\s+/gm," ")}]);var o=parseInt(r.attr("colSpan")||"1",10),i=parseInt(r.attr("rowSpan")||"1",10),a="none"===VB(r,"display"),s=r.attr("width")||"auto";return{type:"table-cell",isHeader:"th"===UB(r),colSpan:o,rowSpan:i,width:s,children:t,hidden:a}}};var CT={selector:"tr:not([data-w-e-type])",parseElemHtml:function(e,t,n){for(var r=am(e),o=[],i=0;i<t.length;i+=1){var a=t[i];if("table-cell"===_y.getNodeType(a)){var s=a;if(s.hidden)continue;o.push(s)}}return{type:"table-row",height:parseInt(VB(r,"height")||"0",10)||void 0,children:o}}};var DT,wT={selector:"table:not([data-w-e-type])",parseElemHtml:function(e,t,n){var r,o,i=am(e),a="auto";"100%"===VB(i,"width")&&(a="100%"),"100%"===i.attr("width")&&(a="100%");var s={type:"table",width:a,height:parseInt(VB(i,"height")||"0",10),children:t.filter(function(e){return"table-row"===_y.getNodeType(e)})},u=(null===(r=i.find("tr")[0])||void 0===r?void 0:r.children)||[],l=(null===(o=i.find("colgroup")[0])||void 0===o?void 0:o.children)||null,c=t[t.length-1].children.length;if(l&&l.length===c)s.columnWidths=Array.from(l).map(function(e){return parseInt(e.getAttribute("width"),10)});else if(u.length>0){var d=[];Array.from(u).forEach(function(e){var t=parseInt(am(e).attr("colSpan")||"1",10),n=parseInt(VB(am(e),"width")||"90",10);d.push(n);for(var r=1;r<t;r+=1)d.push(90)}),s.columnWidths=d}return s}},ST=null===(DT=null===window||void 0===window?void 0:window.getComputedStyle(document.documentElement))||void 0===DT?void 0:DT.getPropertyValue("--w-e-textarea-border-color");function AT(e){var t=e.selection;if(null==t)return!1;var n=Qg(Kh.nodes(e,{match:function(e){return _y.checkNodeType(e,"table-cell")}}),1),r=n[0];if(r){var o=Qg(r,2)[1],i=Kh.start(e,o);if(ug.equals(t.anchor,i))return!0}return!1}function xT(e,t){var n=t.offset;if(0===n)return!1;var r=Kh.node(e,t);if(!Cg.isText(r[0]))return!1;var o=eg.string(r[0]);return!(n>=o.length)&&("\n"===o[n-1]&&"\r"===o[n])}function OT(e,t,n){var r=e.selection;if(null==r||"line"===t)return!1;var o=Qg(Kh.nodes(e,{match:function(e){return _y.checkNodeType(e,"table-cell")}}),1),i=o[0],a=r.anchor;if("backward"===n&&0===r.anchor.offset&&(a=Kh.before(e,r)),"forward"===n&&Kh.isEnd(e,r.anchor,r.anchor.path)&&(a=Kh.after(e,r)),null==a)return!1;var s=Kh.above(e,{at:a,match:function(e){return _y.checkNodeType(e,"table-cell")}});if(null==s||null==i||!og.equals(s[1],i[1]))return!1;var u=Kh.node(e,a);if(!Cg.isText(u[0])||u[0].text.length<2)return!1;var l="backward"===n?[a.offset-2,a.offset]:[a.offset,a.offset+2],c=eg.string(u[0]);return"\n\r"===c.slice.apply(c,ev([],Qg(l),!1))?(jg.insertText(e,c.slice(0,l[0])+c.slice(l[1]),{at:{anchor:Kh.start(e,a.path),focus:Kh.end(e,a.path)}}),!0):!!xT(e,a)&&(jg.insertText(e,c.slice(0,r.anchor.offset-1)+c.slice(r.anchor.offset+1),{at:{anchor:Kh.start(e,a.path),focus:Kh.end(e,a.path)}}),!0)}function NT(e,t){var n=Kh.nodes(e,{at:t,match:function(e){return"table"===_y.getNodeType(e)}});return!!ev([],Qg(n),!1).find(function(){return!0})}function BT(e){var t,n;try{for(var r=Jg(["paragraph","header1","header2","header3","header4","header5","header6","blockquote","list-item","todo","divider"]),o=r.next();!o.done;o=r.next()){var i=o.value;if(_y.getSelectedNodeByType(e,i))return!0}}catch(e){t={error:e}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}return!1}var TT={selector:"table",preParseHtml:function(e){var t=am(e);if("table"!==UB(t))return e;var n=t.find("tbody");if(0===n.length)return e;var r=t.find("tr");t.append(r),n.remove();for(var o=t.find("td, th"),i=0;i<o.length;i+=1){var a=(u=am(o[i])).attr("style");if(a){/display\s*:\s*none/i.test(a)&&u.remove()}u.attr("width","auto")}var s=t.find("td, th");for(i=0;i<s.length;i+=1){var u,l=(u=am(s[i])).html()||"";l=(l=(l=l.replace(/<o:p[^>]*>[\s\S]*?<\/o:p>/gi,"")).replace(/<\/o:p>/gi,"")).replace(/<p[^>]*>([\s\S]*?)<\/p>/gi,function(e,t){var n=t.trim();return n&&" "!==n?t:""}),u.html(l)}return t[0]}};function kT(e){var t,n,r=[],o=0;try{for(var i=Jg(e),a=i.next();!a.done;a=i.next()){o+=a.value,r.push(o)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return r}function FT(e){var t,n,r=[],o=e.reduce(function(e,t){return e+t},0);try{for(var i=Jg(e),a=i.next();!a.done;a=i.next()){var s=a.value;r.push(s/o)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return r}var IT=null;var PT=!1,_T=!1,RT=0,LT=null,MT=am(window);MT.on("mousedown",function(e){var t=e.target;if(t.closest('[data-block-type="table-cell"]'))PT=!0;else if("DIV"===t.tagName&&t.closest(".column-resizer-item")){if(null===LT)return;_T=!0;var n=e.clientX;RT=n,document.body.style.cursor="col-resize",e.preventDefault()}MT.on("mousemove",jT),MT.on("mouseup",HT)});var jT=AC(function(e){if(_T&&null!==LT){e.preventDefault();var t,n=e.clientX,r=n-RT,o=Qg(Kh.nodes(LT,{match:jB(LT,"table")}),1),i=Qg(o[0],1)[0],a=i.columnWidths,s=void 0===a?[]:a,u=i.resizingIndex,l=void 0===u?-1:u,c=_y.getSelectedNodeByType(LT,"table"),d=_y.toDOMNode(LT,c).querySelector(".table");if(d)t=function(e,t,n,r,o){var i=ev([],Qg(e),!1);if(t<0||t>=e.length)return i;var a=o.getMenuConfig("insertTable").minWidth,s=parseInt((void 0===a?60:a).toString(),10)||60,u=n-(0===t?0:r[t-1]),l=Math.max(s,u);return i[t]=Math.floor(100*l)/100,i}(s,l,n-d.getBoundingClientRect().left,kT(s),LT);else t=function(e,t,n,r){var o=ev([],Qg(e),!1),i=r.getMenuConfig("insertTable").minWidth,a=parseInt((void 0===i?60:i).toString(),10)||60,s=o[t],u=Math.max(a,s+n);return o[t]=Math.floor(100*u)/100,o}(s,l,r,LT);jg.setNodes(LT,{columnWidths:t},{mode:"highest"})}},100);function HT(e){PT=!1,_T=!1,LT=null,document.body.style.cursor="",MT.off("mousemove",jT),MT.off("mouseup",HT)}function zT(e,t){"mouseenter"===t.type?jg.setNodes(e,{isResizing:!0},{mode:"highest"}):jg.setNodes(e,{isResizing:!1},{mode:"highest"})}function $T(e){var t,n,r=[],o=0;try{for(var i=Jg(e),a=i.next();!a.done;a=i.next()){o+=a.value,r.push(o)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return r}var UT=!1,VT=0,WT=null,GT=am(window);var qT=AC(function(e){if(UT&&null!==WT){e.preventDefault();var t,n=e.clientY,r=n-VT,o=Qg(Kh.nodes(WT,{match:jB(WT,"table")}),1),i=Qg(o[0],1)[0],a=i.children,s=i.resizingRowIndex,u=void 0===s?-1:s,l=a.map(function(e){return e.height||30}),c=_y.getSelectedNodeByType(WT,"table"),d=_y.toDOMNode(WT,c).querySelector(".table");if(d)t=function(e,t,n,r,o){var i=ev([],Qg(e),!1);if(t<0||t>=e.length)return i;var a=(o.getMenuConfig("insertTable")||{}).minRowHeight,s=parseInt((void 0===a?30:a).toString(),10)||30,u=n-(0===t?0:r[t-1]),l=Math.max(s,u);return i[t]=Math.floor(100*l)/100,i}(l,u,n-d.getBoundingClientRect().top,$T(l),WT);else t=function(e,t,n,r){var o=ev([],Qg(e),!1),i=(r.getMenuConfig("insertTable")||{}).minRowHeight,a=parseInt((void 0===i?30:i).toString(),10)||30,s=o[t],u=Math.max(a,s+n);return o[t]=Math.floor(100*u)/100,o}(l,u,r,WT);var f=_y.getSelectedNodeByType(WT,"table");if(f&&u>=0&&u<t.length){var p=ev(ev([],Qg(_y.findPath(WT,f)),!1),[u],!1);try{jg.setNodes(WT,{height:t[u]},{at:p})}catch(e){console.warn("更新行高度失败:",e)}}}},100);function KT(e){UT=!1,WT=null,document.body.style.cursor="",GT.off("mousemove",qT),GT.off("mouseup",KT)}function YT(e,t){"mouseenter"===t.type?jg.setNodes(e,{isResizingRow:!0},{mode:"highest"}):jg.setNodes(e,{isResizingRow:!1},{mode:"highest"})}GT.on("mousedown",function(e){var t=e.target;if("DIV"===t.tagName&&t.closest(".row-resizer-item")){if(null===WT)return;UT=!0;var n=e.clientY;VT=n,document.body.style.cursor="row-resize",e.preventDefault()}GT.on("mousemove",qT),GT.on("mouseup",KT)});var XT={type:"table",renderElem:function(e,t,n){var r=function(e,t){if(e.isDisabled())return!1;var n=e.selection;if(null==n)return!0;if(fg.isCollapsed(n))return!0;var r=n.anchor,o=n.focus,i=_y.findPath(e,t),a=Kh.start(e,i),s=Kh.end(e,i),u=ug.compare(r,s)<=0&&ug.compare(r,a)>=0,l=ug.compare(o,s)<=0&&ug.compare(o,a)>=0;return!!(u&&l&&og.equals(r.path.slice(0,3),o.path.slice(0,3)))}(n,e),o=e,i=o.width,a=void 0===i?"auto":i,s=o.height,u=o.columnWidths,l=void 0===u?[]:u,c=o.scrollWidth,d=void 0===c?0:c,f=o.isHoverCellBorder,p=o.resizingIndex,h=o.isResizing,g=o.isHoverRowBorder,v=o.resizingRowIndex,m=o.isResizingRow,y=_y.isNodeSelected(n,e),b=Qg(oT.selection(n),1)[0],E=FT(l),C=ND("div",{className:"table-container","data-selected":y,on:{mousedown:function(t){if("DIV"===t.target.tagName&&t.preventDefault(),!n.isDisabled()){t.target.closest('[data-block-type="table-cell"]')&&oT.unselect(n);var r=_y.findPath(n,e),o=Kh.start(n,r),i=n.selection;if(null!=i)i.anchor.path[0]!==r[0]&&"DIV"===t.target.tagName&&n.select(o);else n.select(o)}}}},ND("table",{width:a,contentEditable:r,className:"table ".concat(b?"table-selection-none":""),style:{width:"100%"===a?a:"".concat(l.reduce(function(e,t){return e+t},0),"px")},on:{mousemove:rE(function(t){!function(e,t,n,r){if(!e.isDisabled()&&!PT&&!_T){var o=t,i=o.width,a=void 0===i?"auto":i,s=o.columnWidths,u=void 0===s?[]:s,l=o.isHoverCellBorder,c=o.resizingIndex,d=n.clientX,f=n.target;if(Gm(f)&&d>(g=f.getBoundingClientRect()).x+5&&d<g.x+g.width-5)return void(l&&jg.setNodes(e,{isHoverCellBorder:!1,resizingIndex:-1},{mode:"highest"}));if(Gm(f)){var p=f.closest(".table");if(p)for(var h=n.clientX,g=p.getBoundingClientRect(),v="100%"===a?FT(u).map(function(e){return e*r}):u,m=kT(v),y=0;y<m.length;y+=1)if(h-g.x>=m[y]-5&&h-g.x<m[y]+5){if(c===y)return;return void jg.setNodes(e,{isHoverCellBorder:!0,resizingIndex:y},{mode:"highest"})}}!0===l&&jg.setNodes(e,{isHoverCellBorder:!1,resizingIndex:-1},{mode:"highest"})}}(n,e,t,d),function(e,t,n){if(!e.isDisabled()&&!UT){var r=t,o=r.children,i=r.isHoverRowBorder,a=r.resizingRowIndex,s=n.target;if(Gm(s)){var u=s.closest(".table");if(u)for(var l=n.clientY,c=u.getBoundingClientRect(),d=$T(o.map(function(e){return e.height||30})),f=0;f<d.length;f+=1)if(l-c.y>=d[f]-5&&l-c.y<d[f]+5){if(a===f)return;return void jg.setNodes(e,{isHoverRowBorder:!0,resizingRowIndex:f},{mode:"highest"})}}!0===i&&jg.setNodes(e,{isHoverRowBorder:!1,resizingRowIndex:-1},{mode:"highest"})}}(n,e,t)},25)}},ND("colgroup",{contentEditable:!1},l.map(function(e){return ND("col",{width:e})})),ND("tbody",null,t)),ND("div",{className:"column-resizer",contentEditable:!1},l.map(function(e,t){var r=e;return"100%"===a&&(r=E[t]*d),ND("div",{className:"column-resizer-item",style:{minWidth:"".concat(r,"px")}},ND("div",{className:"resizer-line-hotzone ".concat(f&&t===p?"visible ":"").concat(h&&t===p?"highlight":""),style:{height:"".concat(s,"px")},on:{mouseenter:function(e){return zT(n,e)},mouseleave:function(e){return zT(n,e)},mousedown:function(e){return function(e){_T||(LT=e)}(n)}}},ND("div",{className:"resizer-line"})))})),ND("div",{className:"row-resizer",contentEditable:!1},e.children.map(function(e,t){var r=l.reduce(function(e,t){return e+t},0),o=e.height||30;return ND("div",{className:"row-resizer-item",style:{minHeight:"".concat(o,"px")}},ND("div",{className:"resizer-line-hotzone-horizontal ".concat(g&&t===v?"visible ":"").concat(m&&t===v?"highlight":""),style:{width:"".concat(r,"px")},on:{mouseenter:function(e){return YT(n,e)},mouseleave:function(e){return YT(n,e)},mousedown:function(e){return function(e){UT||(WT=e)}(n)}}},ND("div",{className:"resizer-line-horizontal"})))}))),D=uD("div",{hook:{insert:function(e){var t=e.elm;return function(e,t){if(Gm(t)){var n=t.querySelector("table");n&&(IT=new ResizeObserver(function(t){var n=Qg(t,1)[0].contentRect;jg.setNodes(e,{scrollWidth:n.width,height:n.height},{mode:"highest"})}),IT.observe(n))}}(n,t)},destroy:function(){IT&&(null==IT||IT.disconnect(),IT=null)}}},C);return D}},ZT={type:"table-row",renderElem:function(e,t,n){var r=e.height;return ND("tr",{style:r?{height:"".concat(r,"px")}:{}},t)}},JT={type:"table-cell",renderElem:function(e,t,n){var r=function(e,t){var n=_y.getParentNode(e,t);if(null==n)return!1;var r=_y.getParentNode(e,n);return null!=r&&QB(r).some(function(e){return e===t})}(n,e),o=e,i=o.colSpan,a=void 0===i?1:i,s=o.rowSpan,u=void 0===s?1:s,l=o.isHeader,c=void 0!==l&&l,d=o.hidden,f=void 0!==d&&d,p=oT.isSelected(n,e);return ND(r&&c?"th":"td",{colSpan:a,rowSpan:u,"data-block-type":"table-cell",className:p?"w-e-selected":"",style:{display:f?"none":""}},t)}};function QT(e,t){null==e.data&&(e.data={});var n=e.data;null==n.style&&(n.style={}),Object.assign(n.style,t)}var ek={renderStyle:function(e,t){var n,r;if(!$h.isElement(e))return t;var o=e,i=o.backgroundColor,a=o.borderWidth,s=o.borderStyle,u=o.borderColor,l=o.textAlign,c={};i&&(c.backgroundColor=i),a&&(c.borderWidth="".concat(a,"px")),s&&(c.borderStyle="none"===s?"":s),u&&(c.borderColor=u),l&&(c.textAlign=l);var d=t;return"table"===e.type?QT(null===(r=(null===(n=d.children)||void 0===n?void 0:n[0]).children)||void 0===r?void 0:r[0],c):QT(d,c),d},styleToHtml:function(e,t){if("table"!==e.type&&"table-cell"!==e.type)return t;var n=e.backgroundColor,r=e.borderWidth,o=e.borderStyle,i=e.borderColor,a=e.textAlign;if(!(n||r||o||i||a))return t;var s=am(t);return n&&s.css("background-color",n),r&&s.css("border-width","".concat(r,"px")),o&&s.css("border-style","none"===o?"":o),i&&s.css("border-color",i),a&&s.css("text-align",a),function(e){return 0===e.length?"":e[0].outerHTML}(s)},parseStyleHtml:function(e,t,n){if(!["TABLE","TD","TH"].includes(e.tagName))return t;var r=am(e),o=t,i=VB(r,"background-color");i||(i=VB(r,"background")),i&&(o.backgroundColor=i);var a=VB(r,"border");a||"TD"!==e.tagName||(a="1px solid ".concat(ST));var s=Qg((null==a?void 0:a.split(" "))||[],3),u=s[0],l=s[1],c=s[2];(u=VB(r,"border-width")||u)&&(o.borderWidth=u.replace(/[^\d]/g,"")),(l=VB(r,"border-style")||l)&&(o.borderStyle="none"===l?"":l),(c=VB(r,"border-color")||c)&&(o.borderColor=c);var d=VB(r,"text-align");return(d=VB(r,"text-align")||d)&&(o.textAlign=d),t},renderElems:[XT,ZT,JT],elemsToHtml:[PB,_B,RB],preParseHtml:[TT],parseElemsHtml:[ET,CT,wT],menus:[uT,lT,cT,dT,fT,pT,hT,gT,vT,mT,yT,bT],editorPlugin:function(e){var t=e.insertBreak,n=e.deleteBackward,r=e.deleteForward,o=e.deleteFragment,i=e.normalizeNode,a=e.insertData,s=e.handleTab,u=e.selectAll,l=e;l.insertBreak=function(){null==_y.getSelectedNodeByType(l,"table")?t():l.insertText("\n\r")},l.deleteBackward=function(e){if(!AT(l)&&!OT(l,e,"backward")){var t=l.selection;if(t){var r=Kh.before(l,t),o=Kh.above(l,{at:t,match:function(e){return _y.checkNodeType(e,"table-cell")}});if(r){var i=NT(l,r);if(!o&&i&&BT(l))return}}n(e)}},l.handleTab=function(){var t;if(_y.getSelectedNodeByType(l,"table")){var n=Kh.above(e);_y.checkNodeType(n[0],"table-cell")&&jg.select(e,n[1]);var r=Kh.next(e);if(r)r[0]&&r[0].text&&(r=null!==(t=Kh.above(e,{at:r[1]}))&&void 0!==t?t:r),jg.select(e,r[1]);else{var o=l.children||[],i=o.length;if(_y.checkNodeType(o[i-1],"table")){var a=_y.genEmptyParagraph();jg.insertNodes(l,a,{at:[i]}),l.handleTab()}}}else s()},l.deleteForward=function(e){if(!AT(l)&&!OT(l,e,"forward")){var t=l.selection;if(t){var n=Kh.after(l,t),o=Kh.above(l,{at:t,match:function(e){return _y.checkNodeType(e,"table-cell")}});if(n){var i=NT(l,n);if(!o&&i&&BT(l))return}}r(e)}},l.deleteFragment=function(e){var t=l.selection;if(t){var n,r=!1,i={anchor:t.anchor,focus:t.focus},a=ug.isBefore(i.anchor,i.focus);if(xT(l,t.anchor))(n=Kh[a?"before":"after"](l,t.anchor))&&(i.anchor=n),r=!0;if(xT(l,t.focus))(n=Kh[a?"after":"before"](l,t.focus))&&(i.focus=n),r=!0;r&&jg.setSelection(l,i),o(e)}},l.normalizeNode=function(e){var t=Qg(e,2),n=t[0],r=t[1];if("table"!==_y.getNodeType(n))return i([n,r]);if(_y.isLastNode(l,n)){var o=_y.genEmptyParagraph();jg.insertNodes(l,o,{at:[r[0]+1]})}},l.insertData=function(e){if(null!=_y.getSelectedNodeByType(l,"table")){var t=e.getData("text/plain");"\n"===t||/<img[^>]+>/.test(e.getData("text/html"))?a(e):Kh.insertText(l,t)}else a(e)},l.selectAll=function(){var e=l.selection;if(null!=e){var t=_y.getSelectedNodeByType(l,"table-cell");if(null!=t){var n=e.anchor,r=e.focus;if(og.equals(n.path.slice(0,3),r.path.slice(0,3)))if(0!==eg.string(t).length){var o=_y.findPath(l,t),i={anchor:Kh.start(l,o),focus:Kh.end(l,o)};l.select(i)}else u();else u()}else u()}else u()},function(e){var t=e.apply;e.apply=function(n){if(!rg.isSelectionOperation(n)||!n.newProperties)return t(n);var r=Yg(Yg({},e.selection),n.newProperties);if(!fg.isRange(r))return oT.unselect(e),t(n);var o=function(e){return $h.isElement(e)&&("table-cell"===e.type||"th"===e.type||"td"===e.type)},i=Qg(Kh.nodes(e,{match:o,at:fg.start(r),mode:"lowest"}),1)[0],a=Qg(Kh.nodes(e,{match:o,at:fg.end(r),mode:"lowest"}),1)[0];if(!i||!a)return oT.unselect(e),t(n);var s=Qg(i,2)[1],u=Qg(a,2)[1];if(og.equals(s,u)||!HB(e,[s,u],"table"))return oT.unselect(e),t(n);try{var l=zB(e,{at:s});if(!l||0===l.length)return oT.unselect(e),t(n);for(var c=$B.valueOf(0,0),d=$B.valueOf(0,0),f=!1,p=!1,h=0;h<l.length;h+=1)if(l[h])for(var g=0;g<l[h].length;g+=1)if(l[h][g]){var v=Qg(l[h][g],1),m=Qg(v[0],2)[1];og.equals(s,m)&&(c.x=h,c.y=g,f=!0),og.equals(u,m)&&(d.x=h,d.y=g,p=!0)}if(!f||!p)return oT.unselect(e),t(n);for(var y=$B.valueOf(Math.min(c.x,d.x),Math.min(c.y,d.y)),b=$B.valueOf(Math.max(c.x,d.x),Math.max(c.y,d.y));;){var E=$B.valueOf(y.x,y.y),C=$B.valueOf(b.x,b.y);for(h=E.x;h<=C.x&&h<l.length;h+=1)if(l[h])for(g=E.y;g<=C.y&&g<l[h].length;g+=1)if(l[h][g]){var D=Qg(l[h][g],2)[1];if(D){var w=D.rtl,S=D.ltr,A=D.btt,x=D.ttb;E.x=Math.min(E.x,h-(x-1)),E.y=Math.min(E.y,g-(w-1)),C.x=Math.max(C.x,h+(A-1)),C.y=Math.max(C.y,g+(S-1))}}if($B.equals(y,E)&&$B.equals(b,C))break;y=E,b=C}var O=[],N=new WeakSet;for(h=y.x;h<=b.x&&h<l.length;h+=1)if(l[h]){var B=[];for(g=y.y;g<=b.y&&g<l[h].length;g+=1)if(l[h][g]){var T=Qg(l[h][g],1),k=Qg(T[0],1)[0];k&&(N.add(k),B.push(l[h][g]))}B.length>0&&O.push(B)}WB.set(e,O),GB.set(e,N)}catch(r){return oT.unselect(e),t(n)}t(n)}}(l),l.getTableSelection=function(){return WB.get(l)||null};var c=l.addMark,d=l.removeMark,f=Yg({},jg);return l.addMark=function(e,t){var n=WB.get(l);if(n&&n.length>0){var r=l.selection;n.forEach(function(n){n.forEach(function(n){var r=Qg(n[0],2)[1],o=Kh.start(l,r),i=Kh.end(l,r);jg.select(l,{anchor:o,focus:i}),c(e,t)})}),r&&jg.select(l,r)}else c(e,t)},l.removeMark=function(e){var t=WB.get(l);if(t&&t.length>0){var n=l.selection;t.forEach(function(t){t.forEach(function(t){var n=Qg(t[0],2)[1],r=Kh.start(l,n),o=Kh.end(l,n);jg.select(l,{anchor:r,focus:o}),d(e)})}),n&&jg.select(l,n)}else d(e)},jg.setNodes=function(e,t,n){if(void 0===n&&(n={}),e===l){var r=WB.get(l);if(r&&r.length>0)return"hidden"in t||"rowSpan"in t||"colSpan"in t?void f.setNodes(e,t,n):void r.forEach(function(r){r.forEach(function(r){var o=Qg(r[0],2)[1];f.setNodes(e,t,Yg(Yg({},n),{at:o}))})})}f.setNodes(e,t,n)},l}};function tk(e){return e.length?e[0].tagName.toLowerCase():""}function nk(e,t,n,r){void 0===t&&(t="auto"),void 0===n&&(n="auto"),void 0===r&&(r={});var o=am(e),i=r.width,a=void 0===i?"":i,s=r.height,u=void 0===s?"":s,l="";return a&&(l+="width: ".concat(a,";")),u&&(l+="height: ".concat(u,";")),o.attr("width",t),o.attr("height",n),o.attr("style",l),o[0].outerHTML}YE("en",{videoModule:{delete:"Delete",uploadVideo:"Upload video",insertVideo:"Insert video",videoSrc:"Video source",videoSrcPlaceHolder:"Video file url, or third-party <iframe>",videoPoster:"Video poster",videoPosterPlaceHolder:"Poster image url",ok:"Ok",editSize:"Edit size",edit:"Edit video",width:"Width",height:"Height"}}),YE("zh-CN",{videoModule:{delete:"删除视频",uploadVideo:"上传视频",insertVideo:"插入视频",videoSrc:"视频地址",videoSrcPlaceHolder:"视频文件 url 或第三方 <iframe>",videoPoster:"视频封面",videoPosterPlaceHolder:"封面图片 url",ok:"确定",editSize:"修改尺寸",edit:"编辑视频",width:"宽度",height:"高度"}}),Nm&&(am.fn.append=Nm),gm&&(am.fn.on=gm),jm&&(am.fn.focus=jm),cm&&(am.fn.attr=cm),hm&&(am.fn.val=hm),Am&&(am.fn.html=Am),Tm&&(am.fn.parent=Tm),lm&&(am.fn.hasClass=lm),_m&&(am.fn.empty=_m);var rk={type:"video",elemToHtml:function(e,t){var n=e,r=n.src,o=void 0===r?"":r,i=n.poster,a=void 0===i?"":i,s=n.width,u=void 0===s?"auto":s,l=n.height,c=void 0===l?"auto":l,d=n.style,f=void 0===d?{}:d,p=n.textAlign,h='<div data-w-e-type="video" data-w-e-is-void style="text-align: '.concat(void 0===p?"center":p,';">\n');if(0===o.trim().indexOf("<iframe ")){h+=nk(o,u,c,f)}else{var g=f.width,v=void 0===g?"":g,m=f.height,y=void 0===m?"":m,b="";v&&(b+="width: ".concat(v,";")),y&&(b+="height: ".concat(y,";")),h+='<video poster="'.concat(a,'" controls="true" width="').concat(u,'" height="').concat(c,'" style="').concat(b,'"><source src="').concat(o,'" type="video/mp4"/></video>')}return h+="\n</div>"}};function ok(e){return void 0===e&&(e="r"),"".concat(e,"-").concat(zm())}function ik(e){var t={};return e.trim().split(";").forEach(function(e){if(e){var n=Qg(e.split(":"),2),r=n[0],o=n[1];r&&o&&(t[r.trim()]=o.trim())}}),t}function ak(){return ok("w-e-insert-video")}var sk=function(){function e(){this.title=QE("videoModule.editSize"),this.tag="button",this.showModal=!0,this.modalWidth=320,this.$content=null,this.widthInputId=ak(),this.heightInputId=ak(),this.buttonId=ak()}return e.prototype.getSelectedVideoNode=function(e){return _y.getSelectedNodeByType(e,"video")},e.prototype.getValue=function(e){return""},e.prototype.isActive=function(e){return!1},e.prototype.exec=function(e,t){},e.prototype.isDisabled=function(e){return null==e.selection||null==this.getSelectedVideoNode(e)},e.prototype.getModalPositionNode=function(e){return this.getSelectedVideoNode(e)},e.prototype.getModalContentElem=function(e){var t=this,n=t.widthInputId,r=t.heightInputId,o=t.buttonId,i=Qg(cC(QE("videoModule.width"),n,"auto"),2),a=i[0],s=am(i[1]),u=Qg(cC(QE("videoModule.height"),r,"auto"),2),l=u[0],c=am(u[1]),d=Qg(fC(o,QE("videoModule.ok")),1)[0],f=this.getSelectedVideoNode(e);if(null==this.$content){var p=am("<div></div>");p.on("click","#".concat(o),function(t){t.preventDefault();var o=p.find("#".concat(n)).val().trim(),i=p.find("#".concat(r)).val().trim(),a=function(e){return/^\d+(\.\d+)?%$/.test(e)},s=function(e){return/^\d+(\.\d+)?$/.test(e)},u="auto",l="auto";a(o)?u=o:s(o)&&(u="".concat(parseInt(o,10),"px")),a(i)?l=i:s(i)&&(l="".concat(parseInt(i,10),"px"));var c=f.style,d=void 0===c?{}:c;e.restoreSelection();var h={style:Yg(Yg({},d),{width:u,height:l})};jg.setNodes(e,h,{match:function(e){return _y.checkNodeType(e,"video")}}),e.hidePanelOrModal()}),this.$content=p}var h=this.$content;if(h.empty(),h.append(a),h.append(l),h.append(d),null==f)return h[0];var g=f.style,v=void 0===g?{}:g,m=v.width,y=void 0===m?"":m,b=v.height,E=void 0===b?"":b;return s.val(y),c.val(E),setTimeout(function(){s.focus()}),h[0]},e}();function uk(){return ok("w-e-edit-video")}var lk=function(){function e(){this.title=QE("videoModule.edit"),this.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M864 0a160 160 0 0 1 128 256l-64 64-224-224 64-64c26.752-20.096 59.968-32 96-32zM64 736l-64 288 288-64 592-592-224-224L64 736z m651.584-372.416l-448 448-55.168-55.168 448-448 55.168 55.168z"></path></svg>',this.tag="button",this.showModal=!0,this.modalWidth=300,this.$content=null,this.srcInputId=uk(),this.posterInputId=uk(),this.buttonId=uk()}return e.prototype.getSelectedVideoNode=function(e){return _y.getSelectedNodeByType(e,"video")},e.prototype.getValue=function(e){return""},e.prototype.isActive=function(e){return!1},e.prototype.exec=function(e,t){},e.prototype.isDisabled=function(e){return null==e.selection||null==this.getSelectedVideoNode(e)},e.prototype.getModalPositionNode=function(e){return this.getSelectedVideoNode(e)},e.prototype.getModalContentElem=function(e){var t=this,n=this,r=n.srcInputId,o=n.posterInputId,i=n.buttonId,a=Qg(cC(QE("videoModule.videoSrc"),r,QE("videoModule.videoSrcPlaceHolder")),2),s=a[0],u=a[1],l=Qg(cC(QE("videoModule.videoPoster"),o,QE("videoModule.videoPosterPlaceHolder")),2),c=l[0],d=l[1],f=am(u),p=am(d),h=Qg(fC(i,QE("videoModule.ok")),1)[0];if(null==this.$content){var g=am("<div></div>");g.on("click","#".concat(i),function(n){return Xg(t,void 0,void 0,function(){var t,i,a,s;return Zg(this,function(u){return n.preventDefault(),t=g.find("#".concat(r)).val().trim(),i=g.find("#".concat(o)).val().trim(),a=ok("video-"),s={src:t,poster:i,key:a},e.restoreSelection(),jg.setNodes(e,s,{match:function(e){return _y.checkNodeType(e,"video")}}),e.hidePanelOrModal(),[2]})})}),this.$content=g}var v=this.$content;v.empty(),v.append(s),v.append(c),v.append(h);var m=this.getSelectedVideoNode(e);if(null==m)return v[0];var y=m.src,b=void 0===y?"":y,E=m.poster,C=void 0===E?"":E;return f.val(b),p.val(C),setTimeout(function(){f.focus()}),v[0]},e}();function ck(e,t){return Xg(this,arguments,void 0,function(e,t,n,r,o){var i,a,s,u,l,c,d;return void 0===n&&(n=""),void 0===r&&(r=""),void 0===o&&(o=""),Zg(this,function(f){switch(f.label){case 0:return t?(e.restoreSelection(),i=e.getMenuConfig("insertVideo"),a=i.onInsertedVideo,s=i.checkVideo,u=i.parseVideoSrc,[4,s(t,n)]):[2];case 1:return"string"==typeof(l=f.sent())?(e.alert(l,"error"),[2]):null==l?[2]:[4,u(t)];case 2:return 0!==(c=f.sent()).trim().indexOf("<iframe ")&&(c=function(e){return e.replace(/</g,"<").replace(/>/g,">")}(c)),d={type:"video",src:c,poster:n,children:[{text:""}],style:{width:r,height:o}},Promise.resolve().then(function(){_y.isSelectedEmptyParagraph(e)&&jg.removeNodes(e,{mode:"highest"}),jg.insertNodes(e,d,{mode:"highest"})}),a(d),[2]}})})}function dk(){return ok("w-e-insert-video")}var fk=function(){function e(){this.title=QE("videoModule.insertVideo"),this.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M981.184 160.096C837.568 139.456 678.848 128 512 128S186.432 139.456 42.816 160.096C15.296 267.808 0 386.848 0 512s15.264 244.16 42.816 351.904C186.464 884.544 345.152 896 512 896s325.568-11.456 469.184-32.096C1008.704 756.192 1024 637.152 1024 512s-15.264-244.16-42.816-351.904zM384 704V320l320 192-320 192z"></path></svg>',this.tag="button",this.showModal=!0,this.modalWidth=320,this.$content=null,this.srcInputId=dk(),this.posterInputId=dk(),this.buttonId=dk()}return e.prototype.getValue=function(e){return""},e.prototype.isActive=function(e){return!1},e.prototype.exec=function(e,t){},e.prototype.isDisabled=function(e){var t=e.selection;return null==t||(!fg.isCollapsed(t)||!!_y.getSelectedElems(e).some(function(t){var n=_y.getNodeType(t);return"pre"===n||("list-item"===n||!!e.isVoid(t))}))},e.prototype.getModalPositionNode=function(e){return null},e.prototype.getModalContentElem=function(e){var t=this,n=this,r=n.srcInputId,o=n.posterInputId,i=n.buttonId,a=Qg(cC(QE("videoModule.videoSrc"),r,QE("videoModule.videoSrcPlaceHolder")),2),s=a[0],u=a[1],l=Qg(cC(QE("videoModule.videoPoster"),o,QE("videoModule.videoPosterPlaceHolder")),2),c=l[0],d=l[1],f=am(u),p=am(d),h=Qg(fC(i,QE("videoModule.ok")),1)[0];if(null==this.$content){var g=am("<div></div>");g.on("click","#".concat(i),function(n){return Xg(t,void 0,void 0,function(){var t,i;return Zg(this,function(a){switch(a.label){case 0:return n.preventDefault(),t=g.find("#".concat(r)).val().trim(),i=g.find("#".concat(o)).val().trim(),[4,ck(e,t,i)];case 1:return a.sent(),e.hidePanelOrModal(),[2]}})})}),this.$content=g}var v=this.$content;return v.empty(),v.append(s),v.append(c),v.append(h),f.val(""),p.val(""),setTimeout(function(){f.focus()}),v[0]},e}();function pk(e){return e.getMenuConfig("uploadVideo")}var hk=new WeakMap;function gk(e,t){return Xg(this,void 0,void 0,function(){var n,r;return Zg(this,function(o){switch(o.label){case 0:return n=function(e){var t=hk.get(e);if(null!=t)return t;var n=pk(e),r=n.onSuccess,o=n.onProgress,i=n.onFailed,a=n.customInsert,s=n.onError;return t=qA(Yg(Yg({},n),{onProgress:function(t){e.showProgressBar(t),o&&o(t)},onSuccess:function(t,n){if(a)return a(n,function(t,n){return ck(e,t,n)}),void r(t,n);var o=n.errno,s=void 0===o?1:o,u=n.data,l=void 0===u?{}:u;if(0===s){var c=l.url,d=void 0===c?"":c,f=l.poster;ck(e,d,void 0===f?"":f),r(t,n)}else i(t,n)},onError:function(e,t,n){s(e,t,n)}})),hk.set(e,t),t}(e),r=t.map(function(e){return{name:e.name,type:e.type,size:e.size,data:e}}),n.addFiles(r),[4,n.upload()];case 1:return o.sent(),[2]}})})}var vk=function(){function e(){this.title=QE("videoModule.uploadVideo"),this.iconSvg='<svg viewBox="0 0 1056 1024"><path d="M805.902261 521.819882a251.441452 251.441452 0 0 0-251.011972 246.600033 251.051015 251.051015 0 1 0 502.023944 8.823877 253.237463 253.237463 0 0 0-251.011972-255.42391z m59.463561 240.001647v129.898403h-116.701631v-129.898403h-44.041298l101.279368-103.504859 101.279368 103.504859z" p-id="6802"></path><path d="M788.254507 0.000781H99.094092A98.663439 98.663439 0 0 0 0.001171 99.093701v590.067495a98.663439 98.663439 0 0 0 99.092921 99.092921h411.7549a266.434235 266.434235 0 0 1-2.186448-41.815807 275.843767 275.843767 0 0 1 275.180024-270.729042 270.650955 270.650955 0 0 1 103.504859 19.834201V99.093701A101.51363 101.51363 0 0 0 788.254507 0.000781zM295.054441 640.747004V147.507894l394.146189 246.600033z"></path></svg>',this.tag="button"}return e.prototype.getValue=function(e){return""},e.prototype.isActive=function(e){return!1},e.prototype.exec=function(e,t){var n=this.getMenuConfig(e),r=n.allowedFileTypes,o=void 0===r?[]:r,i=n.customBrowseAndUpload;if(i)i(function(t,n){return ck(e,t,n)});else{var a="";o.length>0&&(a='accept="'.concat(o.join(", "),'"'));var s=am("body"),u=am('<input type="file" '.concat(a," multiple/>"));u.hide(),s.append(u),u.click(),u.on("change",function(){var t=u[0].files;!function(e,t){Xg(this,void 0,void 0,function(){var n,r,o,i,a,s,u,l,c,d,f,p;return Zg(this,function(h){switch(h.label){case 0:if(null==t)return[2];n=Array.prototype.slice.call(t),r=[],o=pk(e).customUpload,h.label=1;case 1:h.trys.push([1,8,9,14]),i=!0,a=tv(n),h.label=2;case 2:return[4,a.next()];case 3:return s=h.sent(),(c=s.done)?[3,7]:(p=s.value,i=!1,u=p,o?[4,o(u,function(t,n){return ck(e,t,n)},e)]:[3,5]);case 4:return h.sent(),[3,6];case 5:r.push(u),h.label=6;case 6:return i=!0,[3,2];case 7:return[3,14];case 8:return l=h.sent(),d={error:l},[3,14];case 9:return h.trys.push([9,,12,13]),i||c||!(f=a.return)?[3,11]:[4,f.call(a)];case 10:h.sent(),h.label=11;case 11:return[3,13];case 12:if(d)throw d.error;return[7];case 13:return[7];case 14:return r.length>0?[4,gk(e,r)]:[3,16];case 15:h.sent(),h.label=16;case 16:return[2]}})})}(e,t)})}},e.prototype.isDisabled=function(e){var t=e.selection;return null==t||(!fg.isCollapsed(t)||!!_y.getSelectedElems(e).some(function(t){var n=_y.getNodeType(t);return"pre"===n||("list-item"===n||!!e.isVoid(t))}))},e.prototype.getMenuConfig=function(e){return e.getMenuConfig("uploadVideo")},e}();function mk(e,t,n,r,o,i){return void 0===t&&(t=""),void 0===n&&(n="auto"),void 0===r&&(r="auto"),void 0===o&&(o={}),void 0===i&&(i="center"),{type:"video",src:e,poster:t,width:n,height:r,style:o,children:[{text:""}],textAlign:i}}var yk={selector:'div[data-w-e-type="video"]',parseElemHtml:function(e,t,n){var r=am(e),o="",i="",a="auto",s="auto",u={},l=r.find("iframe");if(l.length>0)return a=l.attr("width")||"auto",s=l.attr("height")||"auto",u=ik(u=l.attr("style")||""),mk(o=l[0].outerHTML,i,a,s,u,ik(r.attr("style")||"")["text-align"]||"center");var c=r.find("video");return(o=c.attr("src")||"")||c.length>0&&(o=c.find("source").attr("src")||""),a=c.attr("width")||"auto",s=c.attr("height")||"auto",mk(o,i=c.attr("poster")||"",a,s,u=ik(u=c.attr("style")||""),ik(r.attr("style")||"")["text-align"]||"center")}};var bk={selector:"iframe,video,p",preParseHtml:function(e){var t=am(e),n=t;if("p"===tk(t)){var r=t.children();if(1===r.length){var o=r[0],i=o.tagName.toLowerCase();["iframe","video"].includes(i)&&(n=am(o))}}var a=tk(n);if("iframe"!==a&&"video"!==a)return n[0];if("video"===n.parent().attr("data-w-e-type"))return n[0];var s=am('<div data-w-e-type="video" data-w-e-is-void style="text-align: center;"></div>');return s.append(n),s[0]}};var Ek={type:"video",renderElem:function(e,t,n){var r,o=e,i=o.src,a=void 0===i?"":i,s=o.poster,u=void 0===s?"":s,l=o.key,c=void 0===l?"":l,d=o.width,f=void 0===d?"auto":d,p=o.height,h=void 0===p?"auto":p,g=o.style,v=void 0===g?{}:g,m=o.textAlign,y=void 0===m?"center":m,b=_y.isNodeSelected(n,e);if(0===a.trim().indexOf("<iframe ")){r=ND("div",{className:"w-e-textarea-video-container","data-selected":b?"true":"",style:{textAlign:y},innerHTML:nk(a,f,h,v)})}else{var E=ND("video",{key:c,poster:u,controls:!0,style:v},ND("source",{src:a,type:"video/mp4"}),"Sorry, your browser doesn't support embedded videos.\n 抱歉,浏览器不支持 video 视频");"auto"!==f&&(E.data.width=f),"auto"!==h&&(E.data.height=h),r=ND("div",{className:"w-e-textarea-video-container","data-selected":b?"true":"",style:{textAlign:y}},E)}var C=uD("div",{props:{contentEditable:!1},on:{mousedown:function(e){return e.preventDefault()}}},r);return C}},Ck={renderElems:[Ek],elemsToHtml:[rk],preParseHtml:[bk],parseElemsHtml:[yk],menus:[{key:"insertVideo",factory:function(){return new fk},config:{onInsertedVideo:function(e){},checkVideo:function(e,t){return!0},parseVideoSrc:function(e){return e}}},{key:"uploadVideo",factory:function(){return new vk},config:{server:"",fieldName:"wangeditor-uploaded-video",maxFileSize:10485760,maxNumberOfFiles:5,allowedFileTypes:["video/*"],meta:{},metaWithUrl:!1,withCredentials:!1,timeout:3e4,onBeforeUpload:function(e){return e},onProgress:function(e){},onSuccess:function(e,t){},onFailed:function(e,t){console.error("'".concat(e.name,"' upload failed"),t)},onError:function(e,t,n){console.error("'".concat(e.name," upload error"),t,n)}}},{key:"editVideoSize",factory:function(){return new sk}},{key:"editVideoSrc",factory:function(){return new lk}}],editorPlugin:function(e){var t=e.isVoid,n=e.normalizeNode,r=e;return r.isVoid=function(e){return"video"===e.type||t(e)},r.normalizeNode=function(e){var t=Qg(e,2),o=t[0],i=t[1];"video"===_y.getNodeType(o)&&(_y.isLastNode(r,o)&&jg.insertNodes(r,_y.genEmptyParagraph(),{at:[i[0]+1]}));return n([o,i])},r}};YE("en",{uploadImgModule:{uploadImage:"Upload Image",uploadError:"{{fileName}} upload error"}}),YE("zh-CN",{uploadImgModule:{uploadImage:"上传图片",uploadError:"{{fileName}} 上传出错"}});Nm&&(am.fn.append=Nm),gm&&(am.fn.on=gm),Pm&&(am.fn.remove=Pm),hm&&(am.fn.val=hm),Mm&&(am.fn.click=Mm),Em&&(am.fn.hide=Em);var Dk=new WeakMap;function wk(e){return e.getMenuConfig("uploadImage")}function Sk(e,t){return Xg(this,void 0,void 0,function(){return Zg(this,function(n){return[2,new Promise(function(n){var r=new FileReader;r.readAsDataURL(t),r.onload=function(){var o=r.result;if(o){var i=o.toString(),a=0===i.indexOf("data:image")?"":i;qO(e,i,t.name,a),n("ok")}}})]})})}function Ak(e,t){return Xg(this,void 0,void 0,function(){var n,r;return Zg(this,function(o){switch(o.label){case 0:return n=function(e){var t=Dk.get(e);if(null!=t)return t;var n=wk(e),r=n.onSuccess,o=n.onProgress,i=n.onFailed,a=n.customInsert,s=n.onError;return t=qA(Yg(Yg({},n),{onProgress:function(t){e.showProgressBar(t),o&&o(t)},onSuccess:function(t,n){if(a)return a(n,function(t,n,r){return qO(e,t,n,r)}),void r(t,n);var o=n.errno,s=void 0===o?1:o,u=n.data,l=void 0===u?{}:u;if(0===s){if(Array.isArray(l))l.forEach(function(t){var n=t.url,r=void 0===n?"":n,o=t.alt,i=void 0===o?"":o,a=t.href;qO(e,r,i,void 0===a?"":a)});else{var c=l.url,d=void 0===c?"":c,f=l.alt,p=void 0===f?"":f,h=l.href;qO(e,d,p,void 0===h?"":h)}r(t,n)}else i(t,n)},onError:function(e,t,n){s(e,t,n)}})),Dk.set(e,t),t}(e),r=t.map(function(e){return{name:e.name,type:e.type,size:e.size,data:e}}),n.addFiles(r),[4,n.upload()];case 1:return o.sent(),[2]}})})}function xk(e,t){return Xg(this,void 0,void 0,function(){var n,r,o,i,a,s,u,l,c,d,f,p,h,g,v;return Zg(this,function(m){switch(m.label){case 0:if(null==t)return[2];n=Array.prototype.slice.call(t),r=wk(e),o=r.customUpload,i=r.base64LimitSize,a=[],m.label=1;case 1:m.trys.push([1,10,11,16]),s=!0,u=tv(n),m.label=2;case 2:return[4,u.next()];case 3:return l=m.sent(),(p=l.done)?[3,9]:(v=l.value,s=!1,d=(c=v).size,i&&d<=i?[4,Sk(e,c)]:[3,5]);case 4:return m.sent(),[3,8];case 5:return o?[4,o(c,function(t,n,r){return qO(e,t,n,r)},e)]:[3,7];case 6:return m.sent(),[3,8];case 7:a.push(c),m.label=8;case 8:return s=!0,[3,2];case 9:return[3,16];case 10:return f=m.sent(),h={error:f},[3,16];case 11:return m.trys.push([11,,14,15]),s||p||!(g=u.return)?[3,13]:[4,g.call(u)];case 12:m.sent(),m.label=13;case 13:return[3,15];case 14:if(h)throw h.error;return[7];case 15:return[7];case 16:return a.length>0?[4,Ak(e,a)]:[3,18];case 17:m.sent(),m.label=18;case 18:return[2]}})})}var Ok=function(){function e(){this.title=QE("uploadImgModule.uploadImage"),this.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M828.708571 585.045333a48.761905 48.761905 0 0 0-48.737523 48.761905v18.529524l-72.143238-72.167619a135.972571 135.972571 0 0 0-191.585524 0l-34.133334 34.133333-120.880762-120.953905a138.898286 138.898286 0 0 0-191.585523 0l-72.167619 72.167619V292.400762a48.786286 48.786286 0 0 1 48.761904-48.761905h341.23581a48.737524 48.737524 0 0 0 34.474667-83.285333 48.737524 48.737524 0 0 0-34.474667-14.287238H146.236952A146.212571 146.212571 0 0 0 0 292.400762v585.289143A146.358857 146.358857 0 0 0 146.236952 1024h584.996572a146.212571 146.212571 0 0 0 146.236952-146.310095V633.807238a48.786286 48.786286 0 0 0-48.761905-48.761905zM146.261333 926.45181a48.737524 48.737524 0 0 1-48.761904-48.761905v-174.128762l141.409523-141.458286a38.497524 38.497524 0 0 1 53.126096 0l154.526476 154.624 209.627428 209.724953H146.236952z m633.734096-48.761905c-0.073143 9.337905-3.145143 18.383238-8.777143 25.843809l-219.843048-220.94019 34.133333-34.133334a37.546667 37.546667 0 0 1 53.613715 0l140.873143 141.897143V877.714286zM1009.615238 160.231619L863.329524 13.897143a48.737524 48.737524 0 0 0-16.091429-10.24c-11.849143-4.87619-25.161143-4.87619-37.059047 0a48.761905 48.761905 0 0 0-16.067048 10.24l-146.236952 146.334476a49.005714 49.005714 0 0 0 69.217523 69.241905l62.902858-63.390476v272.627809a48.761905 48.761905 0 1 0 97.475047 0V166.083048l62.902857 63.390476a48.737524 48.737524 0 0 0 69.217524 0 48.761905 48.761905 0 0 0 0-69.241905z"></path></svg>',this.tag="button"}return e.prototype.getValue=function(e){return""},e.prototype.isActive=function(e){return!1},e.prototype.isDisabled=function(e){return VO(e)},e.prototype.getMenuConfig=function(e){return e.getMenuConfig("uploadImage")},e.prototype.exec=function(e,t){var n=this.getMenuConfig(e),r=n.allowedFileTypes,o=void 0===r?[]:r,i=n.customBrowseAndUpload;if(i)i(function(t,n,r){return qO(e,t,n,r)});else{var a="";o.length>0&&(a='accept="'.concat(o.join(", "),'"'));var s=am("body"),u=am('<input type="file" '.concat(a," multiple/>"));u.hide(),s.append(u),u.click(),u.on("change",function(){var t=u[0].files;xk(e,t)})}},e}();var Nk={menus:[{key:"uploadImage",factory:function(){return new Ok},config:{server:"",fieldName:"wangeditor-uploaded-image",maxFileSize:2097152,maxNumberOfFiles:100,allowedFileTypes:["image/*"],meta:{},metaWithUrl:!1,withCredentials:!1,timeout:1e4,onBeforeUpload:function(e){return e},onProgress:function(e){},onSuccess:function(e,t){},onFailed:function(e,t){console.error("'".concat(e.name,"' upload failed"),t)},onError:function(e,t,n){console.error("'".concat(e.name,"' upload error"),n)},base64LimitSize:0}}],editorPlugin:function(e){var t=e.insertData,n=e;return n.insertData=function(r){if(VO(n))t(r);else if(r.getData("text/plain"))t(r);else{var o=r.files;if(o.length<=0)t(r);else Array.prototype.slice.call(o).some(function(e){return"image"===Qg(e.type.split("/"),1)[0]})?xk(e,o):t(r)}},n}};YE("en",{highLightModule:{selectLang:"Language"}}),YE("zh-CN",{highLightModule:{selectLang:"选择语言"}});var Bk,Tk={exports:{}};var kk=(Bk||(Bk=1,function(e){var t=function(e){var t=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,n=0,r={},o={manual:e.Prism&&e.Prism.manual,disableWorkerMessageHandler:e.Prism&&e.Prism.disableWorkerMessageHandler,util:{encode:function e(t){return t instanceof i?new i(t.type,e(t.content),t.alias):Array.isArray(t)?t.map(e):t.replace(/&/g,"&").replace(/</g,"<").replace(/\u00a0/g," ")},type:function(e){return Object.prototype.toString.call(e).slice(8,-1)},objId:function(e){return e.__id||Object.defineProperty(e,"__id",{value:++n}),e.__id},clone:function e(t,n){var r,i;switch(n=n||{},o.util.type(t)){case"Object":if(i=o.util.objId(t),n[i])return n[i];for(var a in r={},n[i]=r,t)t.hasOwnProperty(a)&&(r[a]=e(t[a],n));return r;case"Array":return i=o.util.objId(t),n[i]?n[i]:(r=[],n[i]=r,t.forEach(function(t,o){r[o]=e(t,n)}),r);default:return t}},getLanguage:function(e){for(;e;){var n=t.exec(e.className);if(n)return n[1].toLowerCase();e=e.parentElement}return"none"},setLanguage:function(e,n){e.className=e.className.replace(RegExp(t,"gi"),""),e.classList.add("language-"+n)},currentScript:function(){if("undefined"==typeof document)return null;if(document.currentScript&&"SCRIPT"===document.currentScript.tagName)return document.currentScript;try{throw new Error}catch(r){var e=(/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(r.stack)||[])[1];if(e){var t=document.getElementsByTagName("script");for(var n in t)if(t[n].src==e)return t[n]}return null}},isActive:function(e,t,n){for(var r="no-"+t;e;){var o=e.classList;if(o.contains(t))return!0;if(o.contains(r))return!1;e=e.parentElement}return!!n}},languages:{plain:r,plaintext:r,text:r,txt:r,extend:function(e,t){var n=o.util.clone(o.languages[e]);for(var r in t)n[r]=t[r];return n},insertBefore:function(e,t,n,r){var i=(r=r||o.languages)[e],a={};for(var s in i)if(i.hasOwnProperty(s)){if(s==t)for(var u in n)n.hasOwnProperty(u)&&(a[u]=n[u]);n.hasOwnProperty(s)||(a[s]=i[s])}var l=r[e];return r[e]=a,o.languages.DFS(o.languages,function(t,n){n===l&&t!=e&&(this[t]=a)}),a},DFS:function e(t,n,r,i){i=i||{};var a=o.util.objId;for(var s in t)if(t.hasOwnProperty(s)){n.call(t,s,t[s],r||s);var u=t[s],l=o.util.type(u);"Object"!==l||i[a(u)]?"Array"!==l||i[a(u)]||(i[a(u)]=!0,e(u,n,s,i)):(i[a(u)]=!0,e(u,n,null,i))}}},plugins:{},highlightAll:function(e,t){o.highlightAllUnder(document,e,t)},highlightAllUnder:function(e,t,n){var r={callback:n,container:e,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};o.hooks.run("before-highlightall",r),r.elements=Array.prototype.slice.apply(r.container.querySelectorAll(r.selector)),o.hooks.run("before-all-elements-highlight",r);for(var i,a=0;i=r.elements[a++];)o.highlightElement(i,!0===t,r.callback)},highlightElement:function(t,n,r){var i=o.util.getLanguage(t),a=o.languages[i];o.util.setLanguage(t,i);var s=t.parentElement;s&&"pre"===s.nodeName.toLowerCase()&&o.util.setLanguage(s,i);var u={element:t,language:i,grammar:a,code:t.textContent};function l(e){u.highlightedCode=e,o.hooks.run("before-insert",u),u.element.innerHTML=u.highlightedCode,o.hooks.run("after-highlight",u),o.hooks.run("complete",u),r&&r.call(u.element)}if(o.hooks.run("before-sanity-check",u),(s=u.element.parentElement)&&"pre"===s.nodeName.toLowerCase()&&!s.hasAttribute("tabindex")&&s.setAttribute("tabindex","0"),!u.code)return o.hooks.run("complete",u),void(r&&r.call(u.element));if(o.hooks.run("before-highlight",u),u.grammar)if(n&&e.Worker){var c=new Worker(o.filename);c.onmessage=function(e){l(e.data)},c.postMessage(JSON.stringify({language:u.language,code:u.code,immediateClose:!0}))}else l(o.highlight(u.code,u.grammar,u.language));else l(o.util.encode(u.code))},highlight:function(e,t,n){var r={code:e,grammar:t,language:n};if(o.hooks.run("before-tokenize",r),!r.grammar)throw new Error('The language "'+r.language+'" has no grammar.');return r.tokens=o.tokenize(r.code,r.grammar),o.hooks.run("after-tokenize",r),i.stringify(o.util.encode(r.tokens),r.language)},tokenize:function(e,t){var n=t.rest;if(n){for(var r in n)t[r]=n[r];delete t.rest}var o=new u;return l(o,o.head,e),s(e,o,t,o.head,0),function(e){for(var t=[],n=e.head.next;n!==e.tail;)t.push(n.value),n=n.next;return t}(o)},hooks:{all:{},add:function(e,t){var n=o.hooks.all;n[e]=n[e]||[],n[e].push(t)},run:function(e,t){var n=o.hooks.all[e];if(n&&n.length)for(var r,i=0;r=n[i++];)r(t)}},Token:i};function i(e,t,n,r){this.type=e,this.content=t,this.alias=n,this.length=0|(r||"").length}function a(e,t,n,r){e.lastIndex=t;var o=e.exec(n);if(o&&r&&o[1]){var i=o[1].length;o.index+=i,o[0]=o[0].slice(i)}return o}function s(e,t,n,r,u,d){for(var f in n)if(n.hasOwnProperty(f)&&n[f]){var p=n[f];p=Array.isArray(p)?p:[p];for(var h=0;h<p.length;++h){if(d&&d.cause==f+","+h)return;var g=p[h],v=g.inside,m=!!g.lookbehind,y=!!g.greedy,b=g.alias;if(y&&!g.pattern.global){var E=g.pattern.toString().match(/[imsuy]*$/)[0];g.pattern=RegExp(g.pattern.source,E+"g")}for(var C=g.pattern||g,D=r.next,w=u;D!==t.tail&&!(d&&w>=d.reach);w+=D.value.length,D=D.next){var S=D.value;if(t.length>e.length)return;if(!(S instanceof i)){var A,x=1;if(y){if(!(A=a(C,w,e,m))||A.index>=e.length)break;var O=A.index,N=A.index+A[0].length,B=w;for(B+=D.value.length;O>=B;)B+=(D=D.next).value.length;if(w=B-=D.value.length,D.value instanceof i)continue;for(var T=D;T!==t.tail&&(B<N||"string"==typeof T.value);T=T.next)x++,B+=T.value.length;x--,S=e.slice(w,B),A.index-=w}else if(!(A=a(C,0,S,m)))continue;O=A.index;var k=A[0],F=S.slice(0,O),I=S.slice(O+k.length),P=w+S.length;d&&P>d.reach&&(d.reach=P);var _=D.prev;if(F&&(_=l(t,_,F),w+=F.length),c(t,_,x),D=l(t,_,new i(f,v?o.tokenize(k,v):k,b,k)),I&&l(t,D,I),x>1){var R={cause:f+","+h,reach:P};s(e,t,n,D.prev,w,R),d&&R.reach>d.reach&&(d.reach=R.reach)}}}}}}function u(){var e={value:null,prev:null,next:null},t={value:null,prev:e,next:null};e.next=t,this.head=e,this.tail=t,this.length=0}function l(e,t,n){var r=t.next,o={value:n,prev:t,next:r};return t.next=o,r.prev=o,e.length++,o}function c(e,t,n){for(var r=t.next,o=0;o<n&&r!==e.tail;o++)r=r.next;t.next=r,r.prev=t,e.length-=o}if(e.Prism=o,i.stringify=function e(t,n){if("string"==typeof t)return t;if(Array.isArray(t)){var r="";return t.forEach(function(t){r+=e(t,n)}),r}var i={type:t.type,content:e(t.content,n),tag:"span",classes:["token",t.type],attributes:{},language:n},a=t.alias;a&&(Array.isArray(a)?Array.prototype.push.apply(i.classes,a):i.classes.push(a)),o.hooks.run("wrap",i);var s="";for(var u in i.attributes)s+=" "+u+'="'+(i.attributes[u]||"").replace(/"/g,""")+'"';return"<"+i.tag+' class="'+i.classes.join(" ")+'"'+s+">"+i.content+"</"+i.tag+">"},!e.document)return e.addEventListener?(o.disableWorkerMessageHandler||e.addEventListener("message",function(t){var n=JSON.parse(t.data),r=n.language,i=n.code,a=n.immediateClose;e.postMessage(o.highlight(i,o.languages[r],r)),a&&e.close()},!1),o):o;var d=o.util.currentScript();function f(){o.manual||o.highlightAll()}if(d&&(o.filename=d.src,d.hasAttribute("data-manual")&&(o.manual=!0)),!o.manual){var p=document.readyState;"loading"===p||"interactive"===p&&d&&d.defer?document.addEventListener("DOMContentLoaded",f):window.requestAnimationFrame?window.requestAnimationFrame(f):window.setTimeout(f,16)}return o}("undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{});
|
|
19
19
|
/**
|
|
20
20
|
* Prism: Lightweight, robust, elegant syntax highlighting
|
|
21
21
|
*
|