@wangeditor-next/editor
Version:
Web rich text editor, Web 富文本编辑器
12 lines • 410 kB
JavaScript
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).wangEditorCore={})}(this,function(e){"use strict";var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},t(e,n)};function n(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}var r,o=function(){return o=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},o.apply(this,arguments)};function i(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function a(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a}function u(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}if("function"==typeof SuppressedError&&SuppressedError,"undefined"==typeof global){if("ActiveXObject"in window){console.error("抱歉,wangEditor V5+ 版本开始,不在支持 IE 浏览器\n Sorry, wangEditor V5+ versions do not support IE browser.")}s(),l()}else global&&(null===(r=global.navigator)||void 0===r?void 0:r.userAgent.match("QQBrowser"))&&(s(),l());function s(){"undefined"==typeof globalThis&&(window.globalThis=window)}function l(){"undefined"==typeof AggregateError&&(window.AggregateError=function(e,t){var n=new Error(t);return n.errors=e,n})}if("object"==typeof global){var c=Object.getOwnPropertyDescriptor(global,"window");global.window&&!c.set||(global.window=global,global.requestAnimationFrame=function(){},global.navigator={userAgent:""},global.location={hostname:"0.0.0.0",port:0,protocol:"http:"},global.btoa=function(){},global.crypto={getRandomValues:function(e){return nodeCrypto.randomFillSync(e)}}),null!=global.document&&null==global.document.getElementsByTagName&&(global.document.getElementsByTagName=function(){return[]})}var f="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function d(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function h(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if("function"==typeof t){var n=function e(){var n=!1;try{n=this instanceof e}catch{}return n?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(t){var r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:function(){return e[t]}})}),n}var p,g,v,y,m,D={exports:{}},b={};function C(){if(v)return b;v=1,Object.defineProperty(b,"__esModule",{value:!0}),b.justErrorsLogger=b.debugLogger=void 0;const e=function(){if(g)return p;function e(e){return e<10?`0${e}`:e.toString()}return g=1,p=function(){const t=new Date;return`${e(t.getHours())}:${e(t.getMinutes())}:${e(t.getSeconds())}`}}(),t={debug:()=>{},warn:()=>{},error:function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return console.error(`[Uppy] [${e()}]`,...n)}};b.justErrorsLogger=t;const n={debug:function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return console.debug(`[Uppy] [${e()}]`,...n)},warn:function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return console.warn(`[Uppy] [${e()}]`,...n)},error:function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return console.error(`[Uppy] [${e()}]`,...n)}};return b.debugLogger=n,b}function w(){if(m)return y;m=1;return y={nanoid:(e=21)=>{let t="",n=0|e;for(;n--;)t+="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[64*Math.random()|0];return t},customAlphabet:(e,t=21)=>(n=t)=>{let r="",o=0|n;for(;o--;)r+=e[Math.random()*e.length|0];return r}},y}var E,A,B,x,F,O,S,_,k,P,j,N,T,R,M,L,I,$,U,z,H,V,W,q,K,J,G,X,Y,Z,Q,ee,te,ne={};function re(){return A?E:(A=1,E=function(e){if("number"!=typeof e||isNaN(e))throw new TypeError("Expected a number, got "+typeof e);var t=e<0,n=["B","KB","MB","GB","TB","PB","EB","ZB","YB"];if(t&&(e=-e),e<1)return(t?"-":"")+e+" B";var r=Math.min(Math.floor(Math.log(e)/Math.log(1024)),n.length-1);e=Number(e/Math.pow(1024,r));var o=n[r];return e>=10||e%1==0?(t?"-":"")+e.toFixed(0)+" "+o:(t?"-":"")+e.toFixed(1)+" "+o})}function oe(){if(x)return B;function e(e,t){this.text=e=e||"",this.hasWild=~e.indexOf("*"),this.separator=t,this.parts=e.split(t)}return x=1,e.prototype.match=function(e){var t,n,r=!0,o=this.parts,i=o.length;if("string"==typeof e||e instanceof String)if(this.hasWild||this.text==e){for(n=(e||"").split(this.separator),t=0;r&&t<i;t++)"*"!==o[t]&&(r=t<n.length&&o[t]===n[t]);r=r&&n}else r=!1;else if("function"==typeof e.splice)for(r=[],t=e.length;t--;)this.match(e[t])&&(r[r.length]=e[t]);else if("object"==typeof e)for(var a in r={},e)this.match(a)&&(r[a]=e[a]);return r},B=function(t,n,r){var o=new e(t,r||/[\/\.]/);return void 0!==n?o.match(n):o},B}function ie(){if(S)return ne;S=1,Object.defineProperty(ne,"__esModule",{value:!0}),ne.defaultOptions=ne.RestrictionError=ne.Restricter=void 0;const e=re(),t=function(){if(O)return F;O=1;var e=oe(),t=/[\/\+\.]/;return F=function(n,r){function o(r){var o=e(r,n,t);return o&&o.length>=2}return r?o(r.split(";")[0]):o}}();ne.defaultOptions={maxFileSize:null,minFileSize:null,maxTotalFileSize:null,maxNumberOfFiles:null,minNumberOfFiles:null,allowedFileTypes:null,requiredMetaFields:[]};class n extends Error{constructor(){super(...arguments),this.isRestriction=!0}}ne.RestrictionError=n,"undefined"==typeof AggregateError&&(globalThis.AggregateError=class extends Error{constructor(e,t){super(t),this.errors=e}});return ne.Restricter=class{constructor(e,t){this.i18n=t,this.getOpts=()=>{const t=e();if(null!=t.restrictions.allowedFileTypes&&!Array.isArray(t.restrictions.allowedFileTypes))throw new TypeError("`restrictions.allowedFileTypes` must be an array");return t}}validate(r,o){const{maxFileSize:i,minFileSize:a,maxTotalFileSize:u,maxNumberOfFiles:s,allowedFileTypes:l}=this.getOpts().restrictions;if(s){const e=o.filter(e=>!e.isGhost);if(e.length+1>s)throw new n(`${this.i18n("youCanOnlyUploadX",{smart_count:s})}`)}if(l){if(!l.some(e=>e.includes("/")?!!r.type&&t(r.type.replace(/;.*?$/,""),e):!("."!==e[0]||!r.extension)&&r.extension.toLowerCase()===e.slice(1).toLowerCase())){const e=l.join(", ");throw new n(this.i18n("youCanOnlyUploadFileTypes",{types:e}))}}if(u&&null!=r.size){const t=o.reduce((e,t)=>e+t.size,r.size);if(t>u)throw new n(this.i18n("exceedsSize",{size:e(u),file:r.name}))}if(i&&null!=r.size&&r.size>i)throw new n(this.i18n("exceedsSize",{size:e(i),file:r.name}));if(a&&null!=r.size&&r.size<a)throw new n(this.i18n("inferiorSize",{size:e(a)}))}validateMinNumberOfFiles(e){const{minNumberOfFiles:t}=this.getOpts().restrictions;if(Object.keys(e).length<t)throw new n(this.i18n("youHaveToAtLeastSelectX",{smart_count:t}))}getMissingRequiredMetaFields(e){const t=new n(this.i18n("missingRequiredMetaFieldOnFile",{fileName:e.name})),{requiredMetaFields:r}=this.getOpts().restrictions,o=Object.prototype.hasOwnProperty,i=[];for(const t of r)o.call(e.meta,t)&&""!==e.meta[t]||i.push(t);return{missingFields:i,error:t}}},ne}function ae(){if(k)return _;return k=1,_=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}}function ue(){if(j)return P;function e(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}j=1;var t=0;function n(e){return"__private_"+t+++"_"+e}const r=ae();function o(e,t,n){const r=[];return e.forEach(e=>"string"!=typeof e?r.push(e):t[Symbol.split](e).forEach((e,t,o)=>{""!==e&&r.push(e),t<o.length-1&&r.push(n)})),r}
/**
* Takes a string with placeholder variables like `%{smart_count} file selected`
* and replaces it with values from options `{smart_count: 5}`
*
* @license https://github.com/airbnb/polyglot.js/blob/master/LICENSE
* taken from https://github.com/airbnb/polyglot.js/blob/master/lib/polyglot.js#L299
*
* @param {string} phrase that needs interpolation, with placeholders
* @param {object} options with values that will be used to replace placeholders
* @returns {any[]} interpolated
*/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 u(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 P=class{constructor(t){Object.defineProperty(this,a,{value:u}),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)}},P}function se(){return T||(T=1,N=function(){var e={},t=e._fns={};return e.emit=function(e,n,r,o,i,a,u){var s=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,u=i.length;for(;a<u;a++){var s=i[a];if("*"===s&&(n=n.concat(t[s])),2===o.length&&o[0]===s){n=n.concat(t[s]);break}}return n}(e);s.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,s,[n,r,o,i,a,u])},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}),N}function le(){if(M)return R;M=1;var e="Expected a function",t=/^\s+|\s+$/g,n=/^[-+]0x[0-9a-f]+$/i,r=/^0b[01]+$/i,o=/^0o[0-7]+$/i,i=parseInt,a="object"==typeof f&&f&&f.Object===Object&&f,u="object"==typeof self&&self&&self.Object===Object&&self,s=a||u||Function("return this")(),l=Object.prototype.toString,c=Math.max,d=Math.min,h=function(){return s.Date.now()};function p(t,n,r){var o,i,a,u,s,l,f=0,p=!1,y=!1,m=!0;if("function"!=typeof t)throw new TypeError(e);function D(e){var n=o,r=i;return o=i=void 0,f=e,u=t.apply(r,n)}function b(e){var t=e-l;return void 0===l||t>=n||t<0||y&&e-f>=a}function C(){var e=h();if(b(e))return w(e);s=setTimeout(C,function(e){var t=n-(e-l);return y?d(t,a-(e-f)):t}(e))}function w(e){return s=void 0,m&&o?D(e):(o=i=void 0,u)}function E(){var e=h(),t=b(e);if(o=arguments,i=this,l=e,t){if(void 0===s)return function(e){return f=e,s=setTimeout(C,n),p?D(e):u}(l);if(y)return s=setTimeout(C,n),D(l)}return void 0===s&&(s=setTimeout(C,n)),u}return n=v(n)||0,g(r)&&(p=!!r.leading,a=(y="maxWait"in r)?c(v(r.maxWait)||0,n):a,m="trailing"in r?!!r.trailing:m),E.cancel=function(){void 0!==s&&clearTimeout(s),f=0,o=l=i=s=void 0},E.flush=function(){return void 0===s?u:w(h())},E}function g(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function v(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&"[object Symbol]"==l.call(e)}(e))return NaN;if(g(e)){var a="function"==typeof e.valueOf?e.valueOf():e;e=g(a)?a+"":a}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(t,"");var u=r.test(e);return u||o.test(e)?i(e.slice(2),u?2:8):n.test(e)?NaN:+e}return R=function(t,n,r){var o=!0,i=!0;if("function"!=typeof t)throw new TypeError(e);return g(r)&&(o="leading"in r?!!r.leading:o,i="trailing"in r?!!r.trailing:i),p(t,n,{leading:o,maxWait:n,trailing:i})}}function ce(){if(I)return L;I=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",L=function(){return new r}}function fe(){if(U)return $;return U=1,$=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 de(){return H?z:(H=1,z={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 he(){if(te)return ee;te=1;var e=w(),t=C(),n=ie();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 u(e){return"__private_"+a+++"_"+e}const s=ue(),l=se(),c=le(),f=ce(),d=function(){if(W)return V;W=1;const e=fe(),t=de();return V=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"}}(),h=fe(),p=function(){if(K)return q;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 K=1,q=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=(G||(G=1,J=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}),J),v=Y?X:(Y=1,X=function(e,t){return t.name?t.name:"image"===e.split("/")[0]?`${e.split("/")[0]}.${e.split("/")[1]}`:"noname"}),y=Q?Z:(Q=1,Z={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 m=u("plugins"),D=u("restricter"),b=u("storeUnsubscribe"),E=u("emitter"),A=u("preProcessors"),B=u("uploaders"),x=u("postProcessors"),F=u("informAndEmit"),O=u("checkRequiredMetaFieldsOnFile"),S=u("checkRequiredMetaFields"),_=u("assertNewUploadAllowed"),k=u("checkAndCreateFileStateObject"),P=u("startIfAutoProceed"),j=u("addListeners"),N=u("updateOnlineStatus"),T=u("createUpload"),R=u("getUpload"),M=u("removeUpload"),L=u("runUpload");r=Symbol.for("uppy test: getPlugins"),o=Symbol.for("uppy test: createUpload");class I{constructor(e){Object.defineProperty(this,L,{value:ge}),Object.defineProperty(this,M,{value:pe}),Object.defineProperty(this,R,{value:he}),Object.defineProperty(this,T,{value:ae}),Object.defineProperty(this,j,{value:oe}),Object.defineProperty(this,P,{value:re}),Object.defineProperty(this,k,{value:ne}),Object.defineProperty(this,_,{value:H}),Object.defineProperty(this,S,{value:z}),Object.defineProperty(this,O,{value:U}),Object.defineProperty(this,F,{value:$}),Object.defineProperty(this,m,{writable:!0,value:Object.create(null)}),Object.defineProperty(this,D,{writable:!0,value:void 0}),Object.defineProperty(this,b,{writable:!0,value:void 0}),Object.defineProperty(this,E,{writable:!0,value:l()}),Object.defineProperty(this,A,{writable:!0,value:new Set}),Object.defineProperty(this,B,{writable:!0,value:new Set}),Object.defineProperty(this,x,{writable:!0,value:new Set}),Object.defineProperty(this,N,{writable:!0,value:this.updateOnlineStatus.bind(this)}),this.defaultLocale=y;const r={id:"uppy",autoProceed:!1,allowMultipleUploads:!0,allowMultipleUploadBatches:!0,debug:!1,restrictions:n.defaultOptions,meta:{},onBeforeFileAdded:e=>e,onBeforeUpload:e=>e,store:f(),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,D)[D]=new n.Restricter(()=>this.opts,this.i18n),i(this,b)[b]=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,j)[j]()}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,E)[E].emit(e,...n)}on(e,t){return i(this,E)[E].on(e,t),this}once(e,t){return i(this,E)[E].once(e,t),this}off(e,t){return i(this,E)[E].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 s([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,A)[A].add(e)}removePreProcessor(e){return i(this,A)[A].delete(e)}addPostProcessor(e){i(this,x)[x].add(e)}removePostProcessor(e){return i(this,x)[x].delete(e)}addUploader(e){i(this,B)[B].add(e)}removeUploader(e){return i(this,B)[B].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),u=r.filter(e=>e.progress.uploadStarted),s=r.filter(e=>e.isPaused),l=r.filter(e=>e.progress.uploadComplete),c=r.filter(e=>e.error),f=o.filter(e=>!e.isPaused),d=r.filter(e=>e.progress.preprocess||e.progress.postprocess);return{newFiles:i,startedFiles:a,uploadStartedFiles:u,pausedFiles:s,completeFiles:l,erroredFiles:c,inProgressFiles:o,inProgressNotPausedFiles:f,processingFiles:d,isUploadStarted:u.length>0,isAllComplete:100===t&&l.length===r.length&&0===d.length,isAllErrored:!!n&&c.length===r.length,isAllPaused:0!==o.length&&s.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,D)[D].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,_)[_](e);const{files:t}=this.getState();let n=i(this,k)[k](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,P)[P](),n.id}addFiles(e){i(this,_)[_]();const t={...this.getState().files},n=[],r=[];for(let o=0;o<e.length;o++)try{let r=i(this,k)[k](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,P)[P](),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 u(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(u);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 s={currentUploads:i,files:o};0===Object.keys(o).length&&(s.allowNewUpload=!0,s.error=null,s.recoveredState=null),this.setState(s),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,T)[T](t,{forceAllowNewUpload:!0});return i(this,L)[L](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,T)[T]([e],{forceAllowNewUpload:!0});return i(this,L)[L](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,m)[m]?i(this,m)[m][n.type].push(n):i(this,m)[m][n.type]=[n],n.install(),this}getPlugin(e){for(const t of Object.values(i(this,m)[m])){const n=t.find(t=>t.id===e);if(null!=n)return n}}[r](e){return i(this,m)[m][e]}iteratePlugins(e){Object.values(i(this,m)[m]).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,m)[m][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,b)[b](),this.iteratePlugins(e=>{this.removePlugin(e)}),"undefined"!=typeof window&&window.removeEventListener&&(window.removeEventListener("online",i(this,N)[N]),window.removeEventListener("offline",i(this,N)[N]))}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,L)[L](e):(i(this,M)[M](e),Promise.reject(new Error("Nonexistent upload")))}[o](){return i(this,T)[T](...arguments)}addResultData(e,t){if(!i(this,R)[R](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,m)[m].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,D)[D].validateMinNumberOfFiles(t)).catch(e=>{throw i(this,F)[F](e),e}).then(()=>{if(!i(this,S)[S](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,T)[T](r);return i(this,L)[L](o)}).catch(e=>{throw this.emit("error",e),this.log(e,"error"),e}))}}function $(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 U(e){const{missingFields:t,error:n}=i(this,D)[D].getMissingRequiredMetaFields(e);return!(t.length>0)||(this.setFileState(e.id,{missingRequiredMetaFields:t}),this.log(n.message),this.emit("restriction-failed",e,n),!1)}function z(e){let t=!0;for(const n of Object.values(e))i(this,O)[O](n)||(t=!1);return t}function H(e){const{allowNewUpload:t}=this.getState();if(!1===t){const t=new n.RestrictionError(this.i18n("noMoreFilesAllowed"));throw i(this,F)[F](t,e),t}}function ne(e,t){const r=d(t),o=v(r,t),a=h(o).extension,u=Boolean(t.isRemote),s=p({...t,type:r});if(this.checkIfFileAlreadyExists(s)){const e=new n.RestrictionError(this.i18n("noDuplicates",{fileName:o}));throw i(this,F)[F](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 f={source:t.source||"",id:s,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:u,remote:t.remote||"",preview:t.preview};const g=this.opts.onBeforeFileAdded(f,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&&(f=g);try{const t=Object.keys(e).map(t=>e[t]);i(this,D)[D].validate(f,t)}catch(e){throw i(this,F)[F](e,f),e}return f}function re(){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 oe(){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,F)[F](e)}else i(this,F)[F](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,x)[x].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,O)[O](e)}),"undefined"!=typeof window&&window.addEventListener&&(window.addEventListener("online",i(this,N)[N]),window.addEventListener("offline",i(this,N)[N]),setTimeout(i(this,N)[N],3e3))}function ae(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 he(e){const{currentUploads:t}=this.getState();return t[e]}function pe(e){const t={...this.getState().currentUploads};delete t[e],this.setState({currentUploads:t})}async function ge(e){let{currentUploads:t}=this.getState(),n=t[e];const r=n.step||0,o=[...i(this,A)[A],...i(this,B)[B],...i(this,x)[x]];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,M)[M](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,M)[M](e)),null==a&&this.log(`Not setting result for an upload that has been removed: ${e}`),a}return I.VERSION="2.3.4",ee=I}var pe,ge,ve,ye,me,De,be,Ce,we,Ee,Ae,Be,xe,Fe={},Oe=[],Se=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,_e=Array.isArray;function ke(e,t){for(var n in t)e[n]=t[n];return e}function Pe(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function je(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?pe.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 Ne(e,a,r,o,null)}function Ne(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?++ve:o,__i:-1,__u:0};return null==o&&null!=ge.vnode&&ge.vnode(i),i}function Te(e){return e.children}function Re(e,t){this.props=e,this.context=t}function Me(e,t){if(null==t)return e.__?Me(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?Me(e):null}function Le(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 Le(e)}}function Ie(e){(!e.__d&&(e.__d=!0)&&me.push(e)&&!$e.__r++||De!=ge.debounceRendering)&&((De=ge.debounceRendering)||be)($e)}function $e(){for(var e,t,n,r,o,i,a,u=1;me.length;)me.length>u&&me.sort(Ce),e=me.shift(),u=me.length,e.__d&&(n=void 0,r=void 0,o=(r=(t=e).__v).__e,i=[],a=[],t.__P&&((n=ke({},r)).__v=r.__v+1,ge.vnode&&ge.vnode(n),Je(t.__P,n,r,t.__n,t.__P.namespaceURI,32&r.__u?[o]:null,i,null==o?Me(r):o,!!(32&r.__u),a),n.__v=r.__v,n.__.__k[n.__i]=n,Xe(i,n,a),r.__e=r.__=null,n.__e!=o&&Le(n)));$e.__r=0}function Ue(e,t,n,r,o,i,a,u,s,l,c){var f,d,h,p,g,v,y,m=r&&r.__k||Oe,D=t.length;for(s=ze(n,t,m,s,D),f=0;f<D;f++)null!=(h=n.__k[f])&&(d=-1==h.__i?Fe:m[h.__i]||Fe,h.__i=f,v=Je(e,h,d,o,i,a,u,s,l,c),p=h.__e,h.ref&&d.ref!=h.ref&&(d.ref&&Qe(d.ref,null,h),c.push(h.ref,h.__c||p,h)),null==g&&null!=p&&(g=p),(y=!!(4&h.__u))||d.__k===h.__k?s=He(h,s,e,y):"function"==typeof h.type&&void 0!==v?s=v:p&&(s=p.nextSibling),h.__u&=-7);return n.__e=g,s}function ze(e,t,n,r,o){var i,a,u,s,l,c=n.length,f=c,d=0;for(e.__k=new Array(o),i=0;i<o;i++)null!=(a=t[i])&&"boolean"!=typeof a&&"function"!=typeof a?(s=i+d,(a=e.__k[i]="string"==typeof a||"number"==typeof a||"bigint"==typeof a||a.constructor==String?Ne(null,a,null,null,null):_e(a)?Ne(Te,{children:a},null,null,null):null==a.constructor&&a.__b>0?Ne(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):a).__=e,a.__b=e.__b+1,u=null,-1!=(l=a.__i=Ve(a,n,s,f))&&(f--,(u=n[l])&&(u.__u|=2)),null==u||null==u.__v?(-1==l&&(o>c?d--:o<c&&d++),"function"!=typeof a.type&&(a.__u|=4)):l!=s&&(l==s-1?d--:l==s+1?d++:(l>s?d--:d++,a.__u|=4))):e.__k[i]=null;if(f)for(i=0;i<c;i++)null!=(u=n[i])&&!(2&u.__u)&&(u.__e==r&&(r=Me(u)),et(u,u));return r}function He(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=He(o[i],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=Me(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do{t=t&&t.nextSibling}while(null!=t&&8==t.nodeType);return t}function Ve(e,t,n,r){var o,i,a,u=e.key,s=e.type,l=t[n],c=null!=l&&!(2&l.__u);if(null===l&&null==e.key||c&&u==l.key&&s==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)&&u==l.key&&s==l.type)return a;return-1}function We(e,t,n){"-"==t[0]?e.setProperty(t,null==n?"":n):e[t]=null==n?"":"number"!=typeof n||Se.test(t)?n:n+"px"}function qe(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||We(e.style,t,"");if(n)for(t in n)r&&n[t]==r[t]||We(e.style,t,n[t])}else if("o"==t[0]&&"n"==t[1])i=t!=(t=t.replace(we,"$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=Ee,e.addEventListener(t,i?Be:Ae,i)):e.removeEventListener(t,i?Be:Ae,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 Ke(e){return function(t){if(this.l){var n=this.l[t.type+e];if(null==t.t)t.t=Ee++;else if(t.t<n.u)return;return n(ge.event?ge.event(t):t)}}}function Je(e,t,n,r,o,i,a,u,s,l){var c,f,d,h,p,g,v,y,m,D,b,C,w,E,A,B,x,F=t.type;if(null!=t.constructor)return null;128&n.__u&&(s=!!(32&n.__u),i=[u=t.__e=n.__e]),(c=ge.__b)&&c(t);e:if("function"==typeof F)try{if(y=t.props,m="prototype"in F&&F.prototype.render,D=(c=F.contextType)&&r[c.__c],b=c?D?D.props.value:c.__:r,n.__c?v=(f=t.__c=n.__c).__=f.__E:(m?t.__c=f=new F(y,b):(t.__c=f=new Re(y,b),f.constructor=F,f.render=tt),D&&D.sub(f),f.props=y,f.state||(f.state={}),f.context=b,f.__n=r,d=f.__d=!0,f.__h=[],f._sb=[]),m&&null==f.__s&&(f.__s=f.state),m&&null!=F.getDerivedStateFromProps&&(f.__s==f.state&&(f.__s=ke({},f.__s)),ke(f.__s,F.getDerivedStateFromProps(y,f.__s))),h=f.props,p=f.state,f.__v=t,d)m&&null==F.getDerivedStateFromProps&&null!=f.componentWillMount&&f.componentWillMount(),m&&null!=f.componentDidMount&&f.__h.push(f.componentDidMount);else{if(m&&null==F.getDerivedStateFromProps&&y!==h&&null!=f.componentWillReceiveProps&&f.componentWillReceiveProps(y,b),!f.__e&&null!=f.shouldComponentUpdate&&!1===f.shouldComponentUpdate(y,f.__s,b)||t.__v==n.__v){for(t.__v!=n.__v&&(f.props=y,f.state=f.__s,f.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(e){e&&(e.__=t)}),C=0;C<f._sb.length;C++)f.__h.push(f._sb[C]);f._sb=[],f.__h.length&&a.push(f);break e}null!=f.componentWillUpdate&&f.componentWillUpdate(y,f.__s,b),m&&null!=f.componentDidUpdate&&f.__h.push(function(){f.componentDidUpdate(h,p,g)})}if(f.context=b,f.props=y,f.__P=e,f.__e=!1,w=ge.__r,E=0,m){for(f.state=f.__s,f.__d=!1,w&&w(t),c=f.render(f.props,f.state,f.context),A=0;A<f._sb.length;A++)f.__h.push(f._sb[A]);f._sb=[]}else do{f.__d=!1,w&&w(t),c=f.render(f.props,f.state,f.context),f.state=f.__s}while(f.__d&&++E<25);f.state=f.__s,null!=f.getChildContext&&(r=ke(ke({},r),f.getChildContext())),m&&!d&&null!=f.getSnapshotBeforeUpdate&&(g=f.getSnapshotBeforeUpdate(h,p)),B=c,null!=c&&c.type===Te&&null==c.key&&(B=Ye(c.props.children)),u=Ue(e,_e(B)?B:[B],t,n,r,o,i,a,u,s,l),f.base=t.__e,t.__u&=-161,f.__h.length&&a.push(f),v&&(f.__E=f.__=null)}catch(e){if(t.__v=null,s||null!=i)if(e.then){for(t.__u|=s?160:128;u&&8==u.nodeType&&u.nextSibling;)u=u.nextSibling;i[i.indexOf(u)]=null,t.__e=u}else{for(x=i.length;x--;)Pe(i[x]);Ge(t)}else t.__e=n.__e,t.__k=n.__k,e.then||Ge(t);ge.__e(e,t,n)}else null==i&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):u=t.__e=Ze(n.__e,t,n,r,o,i,a,s,l);return(c=ge.diffed)&&c(t),128&t.__u?void 0:u}function Ge(e){e&&e.__c&&(e.__c.__e=!0),e&&e.__k&&e.__k.forEach(Ge)}function Xe(e,t,n){for(var r=0;r<n.length;r++)Qe(n[r],n[++r],n[++r]);ge.__c&&ge.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){ge.__e(e,t.__v)}})}function Ye(e){return"object"!=typeof e||null==e||e.__b&&e.__b>0?e:_e(e)?e.map(Ye):ke({},e)}function Ze(e,t,n,r,o,i,a,u,s){var l,c,f,d,h,p,g,v=n.props,y=t.props,m=t.type;if("svg"==m?o="http://www.w3.org/2000/svg":"math"==m?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((h=i[l])&&"setAttribute"in h==!!m&&(m?h.localName==m:3==h.nodeType)){e=h,i[l]=null;break}if(null==e){if(null==m)return document.createTextNode(y);e=document.createElementNS(o,m,y.is&&y),u&&(ge.__m&&ge.__m(t,i),u=!1),i=null}if(null==m)v===y||u&&e.data==y||(e.data=y);else{if(i=i&&pe.call(e.childNodes),v=n.props||Fe,!u&&null!=i)for(v={},l=0;l<e.attributes.length;l++)v[(h=e.attributes[l]).name]=h.value;for(l in v)if(h=v[l],"children"==l);else if("dangerouslySetInnerHTML"==l)f=h;else if(!(l in y)){if("value"==l&&"defaultValue"in y||"checked"==l&&"defaultChecked"in y)continue;qe(e,l,null,h,o)}for(l in y)h=y[l],"children"==l?d=h:"dangerouslySetInnerHTML"==l?c=h:"value"==l?p=h:"checked"==l?g=h:u&&"function"!=typeof h||v[l]===h||qe(e,l,h,v[l],o);if(c)u||f&&(c.__html==f.__html||c.__html==e.innerHTML)||(e.innerHTML=c.__html),t.__k=[];else if(f&&(e.innerHTML=""),Ue("template"==t.type?e.content:e,_e(d)?d:[d],t,n,r,"foreignObject"==m?"http://www.w3.org/1999/xhtml":o,i,a,i?i[0]:n.__k&&Me(n,0),u,s),null!=i)for(l=i.length;l--;)Pe(i[l]);u||(l="value","progress"==m&&null==p?e.removeAttribute("value"):null!=p&&(p!==e[l]||"progress"==m&&!p||"option"==m&&p!=v[l])&&qe(e,l,p,v[l],o),l="checked",null!=g&&g!=e[l]&&qe(e,l,g,v[l],o))}return e}function Qe(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){ge.__e(e,n)}}function et(e,t,n){var r,o;if(ge.unmount&&ge.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||Qe(r,null,t)),null!=(r=e.__c)){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){ge.__e(e,t)}r.base=r.__P=null}if(r=e.__k)for(o=0;o<r.length;o++)r[o]&&et(r[o],t,n||"function"!=typeof e.type);n||Pe(e.__e),e.__c=e.__=e.__e=void 0}function tt(e,t,n){return this.constructor(e,n)}function nt(e,t,n){var r,o,i,a;t==document&&(t=document.documentElement),ge.__&&ge.__(e,t),o=(r="function"==typeof n)?null:n&&n.__k||t.__k,i=[],a=[],Je(t,e=(!r&&n||t).__k=je(Te,null,[e]),o||Fe,Fe,t.namespaceURI,!r&&n?[n]:o?null:t.firstChild?pe.call(t.childNodes):null,i,!r&&n?n:o?o.__e:t.firstChild,r,a),Xe(i,e,a)}pe=Oe.slice,ge={__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}},ve=0,ye=function(e){return null!=e&&null==e.constructor},Re.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!=this.state?this.__s:this.__s=ke({},this.state),"function"==typeof e&&(e=e(ke({},n),this.props)),e&&ke(n,e),null!=e&&this.__v&&(t&&this._sb.push(t),Ie(this))},Re.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Ie(this))},Re.prototype.render=Te,me=[],be="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Ce=function(e,t){return e.__v.__b-t.__v.__b},$e.__r=0,we=/(PointerCapture)$|Capture$/i,Ee=0,Ae=Ke(!1),Be=Ke(!0),xe=0;var rt,ot,it,at,ut,st,lt,ct,ft,dt,ht,pt=Object.freeze({__proto__:null,Com