UNPKG

@wangeditor-next/editor

Version:
12 lines 81.6 kB
!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).wangEditorUpload={})}(this,function(e){"use strict";var t=function(){return t=Object.assign||function(e){for(var t,r=1,i=arguments.length;r<i;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},t.apply(this,arguments)};"function"==typeof SuppressedError&&SuppressedError;var r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function i(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function n(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if("function"==typeof t){var r=function e(){var r=!1;try{r=this instanceof e}catch{}return r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach(function(t){var i=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,i.get?i:{enumerable:!0,get:function(){return e[t]}})}),r}var o,s,a,l,u,p={exports:{}},d={};function c(){if(a)return d;a=1,Object.defineProperty(d,"__esModule",{value:!0}),d.justErrorsLogger=d.debugLogger=void 0;const e=function(){if(s)return o;function e(e){return e<10?`0${e}`:e.toString()}return s=1,o=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,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];return console.error(`[Uppy] [${e()}]`,...r)}};d.justErrorsLogger=t;const r={debug:function(){for(var t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];return console.debug(`[Uppy] [${e()}]`,...r)},warn:function(){for(var t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];return console.warn(`[Uppy] [${e()}]`,...r)},error:function(){for(var t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];return console.error(`[Uppy] [${e()}]`,...r)}};return d.debugLogger=r,d}function h(){if(u)return l;u=1;return l={nanoid:(e=21)=>{let t="",r=0|e;for(;r--;)t+="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[64*Math.random()|0];return t},customAlphabet:(e,t=21)=>(r=t)=>{let i="",n=0|r;for(;n--;)i+=e[Math.random()*e.length|0];return i}},l}var f,g,m,y,v,_,b,w,P,S,O,E,x,U,j,F,T,k,$,A,R,C,N,I,M,L,z,D,q,H,B,W,X,G={};function K(){return g?f:(g=1,f=function(e){if("number"!=typeof e||isNaN(e))throw new TypeError("Expected a number, got "+typeof e);var t=e<0,r=["B","KB","MB","GB","TB","PB","EB","ZB","YB"];if(t&&(e=-e),e<1)return(t?"-":"")+e+" B";var i=Math.min(Math.floor(Math.log(e)/Math.log(1024)),r.length-1);e=Number(e/Math.pow(1024,i));var n=r[i];return e>=10||e%1==0?(t?"-":"")+e.toFixed(0)+" "+n:(t?"-":"")+e.toFixed(1)+" "+n})}function V(){if(y)return m;function e(e,t){this.text=e=e||"",this.hasWild=~e.indexOf("*"),this.separator=t,this.parts=e.split(t)}return y=1,e.prototype.match=function(e){var t,r,i=!0,n=this.parts,o=n.length;if("string"==typeof e||e instanceof String)if(this.hasWild||this.text==e){for(r=(e||"").split(this.separator),t=0;i&&t<o;t++)"*"!==n[t]&&(i=t<r.length&&n[t]===r[t]);i=i&&r}else i=!1;else if("function"==typeof e.splice)for(i=[],t=e.length;t--;)this.match(e[t])&&(i[i.length]=e[t]);else if("object"==typeof e)for(var s in i={},e)this.match(s)&&(i[s]=e[s]);return i},m=function(t,r,i){var n=new e(t,i||/[\/\.]/);return void 0!==r?n.match(r):n}}function Y(){if(b)return G;b=1,Object.defineProperty(G,"__esModule",{value:!0}),G.defaultOptions=G.RestrictionError=G.Restricter=void 0;const e=K(),t=function(){if(_)return v;_=1;var e=V(),t=/[\/\+\.]/;return v=function(r,i){function n(i){var n=e(i,r,t);return n&&n.length>=2}return i?n(i.split(";")[0]):n}}();G.defaultOptions={maxFileSize:null,minFileSize:null,maxTotalFileSize:null,maxNumberOfFiles:null,minNumberOfFiles:null,allowedFileTypes:null,requiredMetaFields:[]};class r extends Error{constructor(){super(...arguments),this.isRestriction=!0}}G.RestrictionError=r,"undefined"==typeof AggregateError&&(globalThis.AggregateError=class extends Error{constructor(e,t){super(t),this.errors=e}});return G.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(i,n){const{maxFileSize:o,minFileSize:s,maxTotalFileSize:a,maxNumberOfFiles:l,allowedFileTypes:u}=this.getOpts().restrictions;if(l){const e=n.filter(e=>!e.isGhost);if(e.length+1>l)throw new r(`${this.i18n("youCanOnlyUploadX",{smart_count:l})}`)}if(u){if(!u.some(e=>e.includes("/")?!!i.type&&t(i.type.replace(/;.*?$/,""),e):!("."!==e[0]||!i.extension)&&i.extension.toLowerCase()===e.slice(1).toLowerCase())){const e=u.join(", ");throw new r(this.i18n("youCanOnlyUploadFileTypes",{types:e}))}}if(a&&null!=i.size){const t=n.reduce((e,t)=>e+t.size,i.size);if(t>a)throw new r(this.i18n("exceedsSize",{size:e(a),file:i.name}))}if(o&&null!=i.size&&i.size>o)throw new r(this.i18n("exceedsSize",{size:e(o),file:i.name}));if(s&&null!=i.size&&i.size<s)throw new r(this.i18n("inferiorSize",{size:e(s)}))}validateMinNumberOfFiles(e){const{minNumberOfFiles:t}=this.getOpts().restrictions;if(Object.keys(e).length<t)throw new r(this.i18n("youHaveToAtLeastSelectX",{smart_count:t}))}getMissingRequiredMetaFields(e){const t=new r(this.i18n("missingRequiredMetaFieldOnFile",{fileName:e.name})),{requiredMetaFields:i}=this.getOpts().restrictions,n=Object.prototype.hasOwnProperty,o=[];for(const t of i)n.call(e.meta,t)&&""!==e.meta[t]||o.push(t);return{missingFields:o,error:t}}},G}function Q(){if(P)return w;return P=1,w=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}}function J(){if(O)return S;function e(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}O=1;var t=0;function r(e){return"__private_"+t+++"_"+e}const i=Q();function n(e,t,r){const i=[];return e.forEach(e=>"string"!=typeof e?i.push(e):t[Symbol.split](e).forEach((e,t,n)=>{""!==e&&i.push(e),t<n.length-1&&i.push(r)})),i} /** * 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 o(e,t){const r=/\$/g;let i=[e];if(null==t)return i;for(const e of Object.keys(t))if("_"!==e){let o=t[e];"string"==typeof o&&(o=r[Symbol.replace](o,"$$$$")),i=n(i,new RegExp(`%\\{${e}\\}`,"g"),o)}return i}var s=r("apply");function a(e){if(null==e||!e.strings)return;const t=this.locale;this.locale={...t,strings:{...t.strings,...e.strings}},this.locale.pluralize=e.pluralize||t.pluralize}return S=class{constructor(t){Object.defineProperty(this,s,{value:a}),this.locale={strings:{},pluralize:e=>1===e?0:1},Array.isArray(t)?t.forEach(e(this,s)[s],this):e(this,s)[s](t)}translate(e,t){return this.translateArray(e,t).join("")}translateArray(e,t){if(!i(this.locale.strings,e))throw new Error(`missing string: ${e}`);const r=this.locale.strings[e];if("object"==typeof r){if(t&&void 0!==t.smart_count){return o(r[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 o(r,t)}},S}function Z(){return x||(x=1,E=function(){var e={},t=e._fns={};return e.emit=function(e,r,i,n,o,s,a){var l=function(e){var r=t[e]?t[e]:[],i=e.indexOf(":"),n=-1===i?[e]:[e.substring(0,i),e.substring(i+1)],o=Object.keys(t),s=0,a=o.length;for(;s<a;s++){var l=o[s];if("*"===l&&(r=r.concat(t[l])),2===n.length&&n[0]===l){r=r.concat(t[l]);break}}return r}(e);l.length&&function(e,t,r){var i=0,n=t.length;for(;i<n&&t[i];i++)t[i].event=e,t[i].apply(t[i],r)}(e,l,[r,i,n,o,s,a])},e.on=function(e,r){t[e]||(t[e]=[]),t[e].push(r)},e.once=function(t,r){this.on(t,function i(){r.apply(this,arguments),e.off(t,i)})},e.off=function(e,t){var r=[];if(e&&t)for(var i=this._fns[e],n=0,o=i?i.length:0;n<o;n++)i[n]!==t&&r.push(i[n]);r.length?this._fns[e]=r:delete this._fns[e]},e}),E}function ee(){if(j)return U;j=1;var e="Expected a function",t=/^\s+|\s+$/g,i=/^[-+]0x[0-9a-f]+$/i,n=/^0b[01]+$/i,o=/^0o[0-7]+$/i,s=parseInt,a="object"==typeof r&&r&&r.Object===Object&&r,l="object"==typeof self&&self&&self.Object===Object&&self,u=a||l||Function("return this")(),p=Object.prototype.toString,d=Math.max,c=Math.min,h=function(){return u.Date.now()};function f(t,r,i){var n,o,s,a,l,u,p=0,f=!1,y=!1,v=!0;if("function"!=typeof t)throw new TypeError(e);function _(e){var r=n,i=o;return n=o=void 0,p=e,a=t.apply(i,r)}function b(e){var t=e-u;return void 0===u||t>=r||t<0||y&&e-p>=s}function w(){var e=h();if(b(e))return P(e);l=setTimeout(w,function(e){var t=r-(e-u);return y?c(t,s-(e-p)):t}(e))}function P(e){return l=void 0,v&&n?_(e):(n=o=void 0,a)}function S(){var e=h(),t=b(e);if(n=arguments,o=this,u=e,t){if(void 0===l)return function(e){return p=e,l=setTimeout(w,r),f?_(e):a}(u);if(y)return l=setTimeout(w,r),_(u)}return void 0===l&&(l=setTimeout(w,r)),a}return r=m(r)||0,g(i)&&(f=!!i.leading,s=(y="maxWait"in i)?d(m(i.maxWait)||0,r):s,v="trailing"in i?!!i.trailing:v),S.cancel=function(){void 0!==l&&clearTimeout(l),p=0,n=u=o=l=void 0},S.flush=function(){return void 0===l?a:P(h())},S}function g(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function m(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&"[object Symbol]"==p.call(e)}(e))return NaN;if(g(e)){var r="function"==typeof e.valueOf?e.valueOf():e;e=g(r)?r+"":r}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(t,"");var a=n.test(e);return a||o.test(e)?s(e.slice(2),a?2:8):i.test(e)?NaN:+e}return U=function(t,r,i){var n=!0,o=!0;if("function"!=typeof t)throw new TypeError(e);return g(i)&&(n="leading"in i?!!i.leading:n,o="trailing"in i?!!i.trailing:o),f(t,r,{leading:n,maxWait:r,trailing:o})}}function te(){if(T)return F;T=1;var e=0;function t(t){return"__private_"+e+++"_"+t}var r=t("publish");class i{constructor(){Object.defineProperty(this,r,{value:n}),this.state={},this.callbacks=[]}getState(){return this.state}setState(e){const t={...this.state},i={...this.state,...e};this.state=i,function(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}(this,r)[r](t,i,e)}subscribe(e){return this.callbacks.push(e),()=>{this.callbacks.splice(this.callbacks.indexOf(e),1)}}}function n(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];this.callbacks.forEach(e=>{e(...t)})}return i.VERSION="2.1.1",F=function(){return new i}}function re(){if($)return k;return $=1,k=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 ie(){return R?A:(R=1,A={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 ne(){if(X)return W;X=1;var e=h(),t=c(),r=Y();let i,n;function o(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}var s=0;function a(e){return"__private_"+s+++"_"+e}const l=J(),u=Z(),p=ee(),d=te(),f=function(){if(N)return C;N=1;const e=re(),t=ie();return C=function(r){var i;if(r.type)return r.type;const n=r.name?null==(i=e(r.name).extension)?void 0:i.toLowerCase():null;return n&&n in t?t[n]:"application/octet-stream"}}(),g=re(),m=function(){if(M)return I;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 M=1,I=function(t){let r="uppy";return"string"==typeof t.name&&(r+=`-${e(t.name.toLowerCase())}`),void 0!==t.type&&(r+=`-${t.type}`),t.meta&&"string"==typeof t.meta.relativePath&&(r+=`-${e(t.meta.relativePath.toLowerCase())}`),void 0!==t.data.size&&(r+=`-${t.data.size}`),void 0!==t.data.lastModified&&(r+=`-${t.data.lastModified}`),r}}(),y=(z||(z=1,L=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 r=t[1];let[i,n]=r.split(".");return i=parseInt(i,10),n=parseInt(n,10),i<15||15===i&&n<15063||i>18||18===i&&n>=18218}),L),v=q?D:(q=1,D=function(e,t){return t.name?t.name:"image"===e.split("/")[0]?`${e.split("/")[0]}.${e.split("/")[1]}`:"noname"}),_=B?H:(B=1,H={strings:{addBulkFilesFailed:{0:"Failed to add %{smart_count} file due to an internal error",1:"Failed to add %{smart_count} files due to internal errors"},youCanOnlyUploadX:{0:"You can only upload %{smart_count} file",1:"You can only upload %{smart_count} files"},youHaveToAtLeastSelectX:{0:"You have to select at least %{smart_count} file",1:"You have to select at least %{smart_count} files"},exceedsSize:"%{file} exceeds maximum allowed size of %{size}",missingRequiredMetaField:"Missing required meta fields",missingRequiredMetaFieldOnFile:"Missing required meta fields in %{fileName}",inferiorSize:"This file is smaller than the allowed size of %{size}",youCanOnlyUploadFileTypes:"You can only upload: %{types}",noMoreFilesAllowed:"Cannot add more files",noDuplicates:"Cannot add the duplicate file '%{fileName}', it already exists",companionError:"Connection with Companion failed",authAborted:"Authentication aborted",companionUnauthorizeHint:"To unauthorize to your %{provider} account, please go to %{url}",failedToUpload:"Failed to upload %{file}",noInternetConnection:"No Internet connection",connectedToInternet:"Connected to the Internet",noFilesFound:"You have no files or folders here",selectX:{0:"Select %{smart_count}",1:"Select %{smart_count}"},allFilesFromFolderNamed:"All files from folder %{name}",openFolderNamed:"Open folder %{name}",cancel:"Cancel",logOut:"Log out",filter:"Filter",resetFilter:"Reset filter",loading:"Loading...",authenticateWithTitle:"Please authenticate with %{pluginName} to select files",authenticateWith:"Connect to %{pluginName}",signInWithGoogle:"Sign in with Google",searchImages:"Search for images",enterTextToSearch:"Enter text to search for images",search:"Search",emptyFolderAdded:"No files were added from empty folder",folderAlreadyAdded:'The folder "%{folder}" was already added',folderAdded:{0:"Added %{smart_count} file from %{folder}",1:"Added %{smart_count} files from %{folder}"}}});var b=a("plugins"),w=a("restricter"),P=a("storeUnsubscribe"),S=a("emitter"),O=a("preProcessors"),E=a("uploaders"),x=a("postProcessors"),U=a("informAndEmit"),j=a("checkRequiredMetaFieldsOnFile"),F=a("checkRequiredMetaFields"),T=a("assertNewUploadAllowed"),k=a("checkAndCreateFileStateObject"),$=a("startIfAutoProceed"),A=a("addListeners"),R=a("updateOnlineStatus"),G=a("createUpload"),K=a("getUpload"),V=a("removeUpload"),Q=a("runUpload");i=Symbol.for("uppy test: getPlugins"),n=Symbol.for("uppy test: createUpload");class ne{constructor(e){Object.defineProperty(this,Q,{value:ge}),Object.defineProperty(this,V,{value:fe}),Object.defineProperty(this,K,{value:he}),Object.defineProperty(this,G,{value:ce}),Object.defineProperty(this,A,{value:de}),Object.defineProperty(this,$,{value:pe}),Object.defineProperty(this,k,{value:ue}),Object.defineProperty(this,T,{value:le}),Object.defineProperty(this,F,{value:ae}),Object.defineProperty(this,j,{value:se}),Object.defineProperty(this,U,{value:oe}),Object.defineProperty(this,b,{writable:!0,value:Object.create(null)}),Object.defineProperty(this,w,{writable:!0,value:void 0}),Object.defineProperty(this,P,{writable:!0,value:void 0}),Object.defineProperty(this,S,{writable:!0,value:u()}),Object.defineProperty(this,O,{writable:!0,value:new Set}),Object.defineProperty(this,E,{writable:!0,value:new Set}),Object.defineProperty(this,x,{writable:!0,value:new Set}),Object.defineProperty(this,R,{writable:!0,value:this.updateOnlineStatus.bind(this)}),this.defaultLocale=_;const i={id:"uppy",autoProceed:!1,allowMultipleUploads:!0,allowMultipleUploadBatches:!0,debug:!1,restrictions:r.defaultOptions,meta:{},onBeforeFileAdded:e=>e,onBeforeUpload:e=>e,store:d(),logger:t.justErrorsLogger,infoTimeout:5e3};this.opts={...i,...e,restrictions:{...i.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=p(this.calculateProgress.bind(this),500,{leading:!0,trailing:!0}),this.store=this.opts.store,this.setState({plugins:{},files:{},currentUploads:{},allowNewUpload:!0,capabilities:{uploadProgress:y(),individualCancellation:!0,resumableUploads:!1},totalProgress:0,meta:{...this.opts.meta},info:[],recoveredState:null}),o(this,w)[w]=new r.Restricter(()=>this.opts,this.i18n),o(this,P)[P]=this.store.subscribe((e,t,r)=>{this.emit("state-update",e,t,r),this.updateAll(t)}),this.opts.debug&&"undefined"!=typeof window&&(window[this.opts.id]=this),o(this,A)[A]()}emit(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;i<t;i++)r[i-1]=arguments[i];o(this,S)[S].emit(e,...r)}on(e,t){return o(this,S)[S].on(e,t),this}once(e,t){return o(this,S)[S].once(e,t),this}off(e,t){return o(this,S)[S].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 l([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},r={};Object.keys(t).forEach(i=>{const n={...t[i]};n.progress={...n.progress,...e},r[i]=n}),this.setState({files:r,totalProgress:0}),this.emit("reset-progress")}addPreProcessor(e){o(this,O)[O].add(e)}removePreProcessor(e){return o(this,O)[O].delete(e)}addPostProcessor(e){o(this,x)[x].add(e)}removePostProcessor(e){return o(this,x)[x].delete(e)}addUploader(e){o(this,E)[E].add(e)}removeUploader(e){return o(this,E)[E].delete(e)}setMeta(e){const t={...this.getState().meta,...e},r={...this.getState().files};Object.keys(r).forEach(t=>{r[t]={...r[t],meta:{...r[t].meta,...e}}}),this.log("Adding metadata:"),this.log(e),this.setState({meta:t,files:r})}setFileMeta(e,t){const r={...this.getState().files};if(!r[e])return void this.log("Was trying to set metadata for a file that has been removed: ",e);const i={...r[e].meta,...t};r[e]={...r[e],meta:i},this.setState({files:r})}getFile(e){return this.getState().files[e]}getFiles(){const{files:e}=this.getState();return Object.values(e)}getObjectOfFilesPerState(){const{files:e,totalProgress:t,error:r}=this.getState(),i=Object.values(e),n=i.filter(e=>{let{progress:t}=e;return!t.uploadComplete&&t.uploadStarted}),o=i.filter(e=>!e.progress.uploadStarted),s=i.filter(e=>e.progress.uploadStarted||e.progress.preprocess||e.progress.postprocess),a=i.filter(e=>e.progress.uploadStarted),l=i.filter(e=>e.isPaused),u=i.filter(e=>e.progress.uploadComplete),p=i.filter(e=>e.error),d=n.filter(e=>!e.isPaused),c=i.filter(e=>e.progress.preprocess||e.progress.postprocess);return{newFiles:o,startedFiles:s,uploadStartedFiles:a,pausedFiles:l,completeFiles:u,erroredFiles:p,inProgressFiles:n,inProgressNotPausedFiles:d,processingFiles:c,isUploadStarted:a.length>0,isAllComplete:100===t&&u.length===i.length&&0===c.length,isAllErrored:!!r&&p.length===i.length,isAllPaused:0!==n.length&&l.length===n.length,isUploadInProgress:n.length>0,isSomeGhost:i.some(e=>e.isGhost)}}validateRestrictions(e,t){void 0===t&&(t=this.getFiles());try{return o(this,w)[w].validate(e,t),{result:!0}}catch(e){return{result:!1,reason:e.message}}}checkIfFileAlreadyExists(e){const{files:t}=this.getState();return!(!t[e]||t[e].isGhost)}addFile(e){o(this,T)[T](e);const{files:t}=this.getState();let r=o(this,k)[k](t,e);return t[r.id]&&t[r.id].isGhost&&(r={...t[r.id],data:e.data,isGhost:!1},this.log(`Replaced the blob in the restored ghost file: ${r.name}, ${r.id}`)),this.setState({files:{...t,[r.id]:r}}),this.emit("file-added",r),this.emit("files-added",[r]),this.log(`Added file: ${r.name}, ${r.id}, mime type: ${r.type}`),o(this,$)[$](),r.id}addFiles(e){o(this,T)[T]();const t={...this.getState().files},r=[],i=[];for(let n=0;n<e.length;n++)try{let i=o(this,k)[k](t,e[n]);t[i.id]&&t[i.id].isGhost&&(i={...t[i.id],data:e[n].data,isGhost:!1},this.log(`Replaced blob in a ghost file: ${i.name}, ${i.id}`)),t[i.id]=i,r.push(i)}catch(e){e.isRestriction||i.push(e)}if(this.setState({files:t}),r.forEach(e=>{this.emit("file-added",e)}),this.emit("files-added",r),r.length>5?this.log(`Added batch of ${r.length} files`):Object.keys(r).forEach(e=>{this.log(`Added file: ${r[e].name}\n id: ${r[e].id}\n type: ${r[e].type}`)}),r.length>0&&o(this,$)[$](),i.length>0){let e="Multiple errors occurred while adding files:\n";if(i.forEach(t=>{e+=`\n * ${t.message}`}),this.info({message:this.i18n("addBulkFilesFailed",{smart_count:i.length}),details:e},"error",this.opts.infoTimeout),"function"==typeof AggregateError)throw new AggregateError(i,e);{const t=new Error(e);throw t.errors=i,t}}}removeFiles(e,t){const{files:r,currentUploads:i}=this.getState(),n={...r},o={...i},s=Object.create(null);function a(e){return void 0===s[e]}e.forEach(e=>{r[e]&&(s[e]=r[e],delete n[e])}),Object.keys(o).forEach(e=>{const t=i[e].fileIDs.filter(a);if(0===t.length)return void delete o[e];const{capabilities:r}=this.getState();if(t.length!==i[e].fileIDs.length&&!r.individualCancellation)throw new Error("individualCancellation is disabled");o[e]={...i[e],fileIDs:t}});const l={currentUploads:o,files:n};0===Object.keys(n).length&&(l.allowNewUpload=!0,l.error=null,l.recoveredState=null),this.setState(l),this.calculateTotalProgress();const u=Object.keys(s);u.forEach(e=>{this.emit("file-removed",s[e],t)}),u.length>5?this.log(`Removed ${u.length} files`):this.log(`Removed files: ${u.join(", ")}`)}removeFile(e,t){void 0===t&&(t=null),this.removeFiles([e],t)}pauseResume(e){if(!this.getState().capabilities.resumableUploads||this.getFile(e).uploadComplete)return;const t=!(this.getFile(e).isPaused||!1);return this.setFileState(e,{isPaused:t}),this.emit("upload-pause",e,t),t}pauseAll(){const e={...this.getState().files};Object.keys(e).filter(t=>!e[t].progress.uploadComplete&&e[t].progress.uploadStarted).forEach(t=>{const r={...e[t],isPaused:!0};e[t]=r}),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 r={...e[t],isPaused:!1,error:null};e[t]=r}),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 r={...e[t],isPaused:!1,error:null};e[t]=r}),this.setState({files:e,error:null}),this.emit("retry-all",t),0===t.length)return Promise.resolve({successful:[],failed:[]});const r=o(this,G)[G](t,{forceAllowNewUpload:!0});return o(this,Q)[Q](r)}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=o(this,G)[G]([e],{forceAllowNewUpload:!0});return o(this,Q)[Q](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 r=Number.isFinite(t.bytesTotal)&&t.bytesTotal>0;this.setFileState(e.id,{progress:{...this.getFile(e.id).progress,bytesUploaded:t.bytesUploaded,bytesTotal:t.bytesTotal,percentage:r?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),r=e.filter(e=>null==e.progress.bytesTotal);if(0===t.length){const t=100*e.length,i=r.reduce((e,t)=>e+t.progress.percentage,0),n=Math.round(i/t*100);return void this.setState({totalProgress:n})}let i=t.reduce((e,t)=>e+t.progress.bytesTotal,0);const n=i/t.length;i+=n*r.length;let o=0;t.forEach(e=>{o+=e.progress.bytesUploaded}),r.forEach(e=>{o+=n*(e.progress.percentage||0)/100});let s=0===i?0:Math.round(o/i*100);s>100&&(s=100),this.setState({totalProgress:s}),this.emit("progress",s)}updateOnlineStatus(){void 0===window.navigator.onLine||window.navigator.onLine?(this.emit("is-online"),this.wasOffline&&(this.emit("back-online"),this.info(this.i18n("connectedToInternet"),"success",3e3),this.wasOffline=!1)):(this.emit("is-offline"),this.info(this.i18n("noInternetConnection"),"error",0),this.wasOffline=!0)}getID(){return this.opts.id}use(e,t){if("function"!=typeof e){throw new TypeError(`Expected a plugin class, but got ${null===e?"null":typeof e}. Please verify that the plugin was imported and spelled correctly.`)}const r=new e(this,t),i=r.id;if(!i)throw new Error("Your plugin must have an id");if(!r.type)throw new Error("Your plugin must have a type");const n=this.getPlugin(i);if(n){const e=`Already found a plugin named '${n.id}'. Tried to use: '${i}'.\nUppy plugins must have unique \`id\` options. See https://uppy.io/docs/plugins/#id.`;throw new Error(e)}return e.VERSION&&this.log(`Using ${i} v${e.VERSION}`),r.type in o(this,b)[b]?o(this,b)[b][r.type].push(r):o(this,b)[b][r.type]=[r],r.install(),this}getPlugin(e){for(const t of Object.values(o(this,b)[b])){const r=t.find(t=>t.id===e);if(null!=r)return r}}[i](e){return o(this,b)[b][e]}iteratePlugins(e){Object.values(o(this,b)[b]).flat(1).forEach(e)}removePlugin(e){this.log(`Removing plugin ${e.id}`),this.emit("plugin-remove",e),e.uninstall&&e.uninstall();const t=o(this,b)[b][e.type],r=t.findIndex(t=>t.id===e.id);-1!==r&&t.splice(r,1);const i={plugins:{...this.getState().plugins,[e.id]:void 0}};this.setState(i)}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}),o(this,P)[P](),this.iteratePlugins(e=>{this.removePlugin(e)}),"undefined"!=typeof window&&window.removeEventListener&&(window.removeEventListener("online",o(this,R)[R]),window.removeEventListener("offline",o(this,R)[R]))}hideInfo(){const{info:e}=this.getState();this.setState({info:e.slice(1)}),this.emit("info-hidden")}info(e,t,r){void 0===t&&(t="info"),void 0===r&&(r=3e3);const i="object"==typeof e;this.setState({info:[...this.getState().info,{type:t,message:i?e.message:e,details:i?e.details:null}]}),setTimeout(()=>this.hideInfo(),r),this.emit("info-visible")}log(e,t){const{logger:r}=this.opts;switch(t){case"error":r.error(e);break;case"warning":r.warn(e);break;default:r.debug(e)}}restore(e){return this.log(`Core: attempting to restore upload "${e}"`),this.getState().currentUploads[e]?o(this,Q)[Q](e):(o(this,V)[V](e),Promise.reject(new Error("Nonexistent upload")))}[n](){return o(this,G)[G](...arguments)}addResultData(e,t){if(!o(this,K)[K](e))return void this.log(`Not setting result for an upload that has been removed: ${e}`);const{currentUploads:r}=this.getState(),i={...r[e],result:{...r[e].result,...t}};this.setState({currentUploads:{...r,[e]:i}})}upload(){var e;null!=(e=o(this,b)[b].uploader)&&e.length||this.log("No uploader type plugins are used","warning");let{files:t}=this.getState();const i=this.opts.onBeforeUpload(t);return!1===i?Promise.reject(new Error("Not starting the upload because onBeforeUpload returned false")):(i&&"object"==typeof i&&(t=i,this.setState({files:t})),Promise.resolve().then(()=>o(this,w)[w].validateMinNumberOfFiles(t)).catch(e=>{throw o(this,U)[U](e),e}).then(()=>{if(!o(this,F)[F](t))throw new r.RestrictionError(this.i18n("missingRequiredMetaField"))}).catch(e=>{throw e}).then(()=>{const{currentUploads:e}=this.getState(),r=Object.values(e).flatMap(e=>e.fileIDs),i=[];Object.keys(t).forEach(e=>{const t=this.getFile(e);t.progress.uploadStarted||-1!==r.indexOf(e)||i.push(t.id)});const n=o(this,G)[G](i);return o(this,Q)[Q](n)}).catch(e=>{throw this.emit("error",e),this.log(e,"error"),e}))}}function oe(e,t){const{message:r,details:i=""}=e;e.isRestriction?this.emit("restriction-failed",t,e):this.emit("error",e),this.info({message:r,details:i},"error",this.opts.infoTimeout),this.log(`${r} ${i}`.trim(),"error")}function se(e){const{missingFields:t,error:r}=o(this,w)[w].getMissingRequiredMetaFields(e);return!(t.length>0)||(this.setFileState(e.id,{missingRequiredMetaFields:t}),this.log(r.message),this.emit("restriction-failed",e,r),!1)}function ae(e){let t=!0;for(const r of Object.values(e))o(this,j)[j](r)||(t=!1);return t}function le(e){const{allowNewUpload:t}=this.getState();if(!1===t){const t=new r.RestrictionError(this.i18n("noMoreFilesAllowed"));throw o(this,U)[U](t,e),t}}function ue(e,t){const i=f(t),n=v(i,t),s=g(n).extension,a=Boolean(t.isRemote),l=m({...t,type:i});if(this.checkIfFileAlreadyExists(l)){const e=new r.RestrictionError(this.i18n("noDuplicates",{fileName:n}));throw o(this,U)[U](e,t),e}const u=t.meta||{};u.name=n,u.type=i;const p=Number.isFinite(t.data.size)?t.data.size:null;let d={source:t.source||"",id:l,name:n,extension:s||"",meta:{...this.getState().meta,...u},type:i,data:t.data,progress:{percentage:0,bytesUploaded:0,bytesTotal:p,uploadComplete:!1,uploadStarted:null},size:p,isRemote:a,remote:t.remote||"",preview:t.preview};const c=this.opts.onBeforeFileAdded(d,e);if(!1===c){const e=new r.RestrictionError("Cannot add the file because onBeforeFileAdded returned false.");throw this.emit("restriction-failed",t,e),e}"object"==typeof c&&null!==c&&(d=c);try{const t=Object.keys(e).map(t=>e[t]);o(this,w)[w].validate(d,t)}catch(e){throw o(this,U)[U](e,d),e}return d}function pe(){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 de(){const e=(e,t,r)=>{let i=e.message||"Unknown error";e.details&&(i+=` ${e.details}`),this.setState({error:i}),null!=t&&t.id in this.getState().files&&this.setFileState(t.id,{error:i,response:r})};this.on("error",e),this.on("upload-error",(t,r,i)=>{if(e(r,t,i),"object"==typeof r&&r.message){const e=new Error(r.message);e.details=r.message,r.details&&(e.details+=` ${r.details}`),e.message=this.i18n("failedToUpload",{file:null==t?void 0:t.name}),o(this,U)[U](e)}else o(this,U)[U](r)}),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 r=this.getFile(e.id).progress;this.setFileState(e.id,{progress:{...r,postprocess:o(this,x)[x].size>0?{mode:"indeterminate"}:null,uploadComplete:!0,percentage:100,bytesUploaded:r.bytesTotal},response:t,uploadURL:t.uploadURL,isPaused:!1}),null==e.size&&this.setFileState(e.id,{size:t.bytesUploaded||r.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&&o(this,j)[j](e)}),"undefined"!=typeof window&&window.addEventListener&&(window.addEventListener("online",o(this,R)[R]),window.addEventListener("offline",o(this,R)[R]),setTimeout(o(this,R)[R],3e3))}function ce(t,r){void 0===r&&(r={});const{forceAllowNewUpload:i=!1}=r,{allowNewUpload:n,currentUploads:o}=this.getState();if(!n&&!i)throw new Error("Cannot create a new upload: already uploading.");const s=(0,e.nanoid)();return this.emit("upload",{id:s,fileIDs:t}),this.setState({allowNewUpload:!1!==this.opts.allowMultipleUploadBatches&&!1!==this.opts.allowMultipleUploads,currentUploads:{...o,[s]:{fileIDs:t,step:0,result:{}}}}),s}function he(e){const{currentUploads:t}=this.getState();return t[e]}function fe(e){const t={...this.getState().currentUploads};delete t[e],this.setState({currentUploads:t})}async function ge(e){let{currentUploads:t}=this.getState(),r=t[e];const i=r.step||0,n=[...o(this,O)[O],...o(this,E)[E],...o(this,x)[x]];try{for(let o=i;o<n.length&&r;o++){const i=n[o],s={...r,step:o};this.setState({currentUploads:{...t,[e]:s}}),await i(s.fileIDs,e),t=this.getState().currentUploads,r=t[e]}}catch(t){throw o(this,V)[V](e),t}if(r){r.fileIDs.forEach(e=>{const t=this.getFile(e);t&&t.progress.postprocess&&this.emit("postprocess-complete",t)});const i=r.fileIDs.map(e=>this.getFile(e)),n=i.filter(e=>!e.error),o=i.filter(e=>e.error);await this.addResultData(e,{successful:n,failed:o,uploadID:e}),t=this.getState().currentUploads,r=t[e]}let s;return r&&(s=r.result,this.emit("complete",s),o(this,V)[V](e)),null==s&&this.log(`Not setting result for an upload that has been removed: ${e}`),s}return ne.VERSION="2.3.4",W=ne}var oe,se,ae,le,ue,pe,de,ce,he,fe,ge,me,ye,ve={},_e=[],be=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,we=Array.isArray;function Pe(e,t){for(var r in t)e[r]=t[r];return e}function Se(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Oe(e,t,r){var i,n,o,s={};for(o in t)"key"==o?i=t[o]:"ref"==o?n=t[o]:s[o]=t[o];if(arguments.length>2&&(s.children=arguments.length>3?oe.call(arguments,2):r),"function"==typeof e&&null!=e.defaultProps)for(o in e.defaultProps)void 0===s[o]&&(s[o]=e.defaultProps[o]);return Ee(e,s,i,n,null)}function Ee(e,t,r,i,n){var o={type:e,props:t,key:r,ref:i,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:null==n?++ae:n,__i:-1,__u:0};return null==n&&null!=se.vnode&&se.vnode(o),o}function xe(e){return e.children}function Ue(e,t){this.props=e,this.context=t}function je(e,t){if(null==t)return e.__?je(e.__,e.__i+1):null;for(var r;t<e.__k.length;t++)if(null!=(r=e.__k[t])&&null!=r.__e)return r.__e;return"function"==typeof e.type?je(e):null}function Fe(e){var t,r;if(null!=(e=e.__)&&null!=e.__c){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if(null!=(r=e.__k[t])&&null!=r.__e){e.__e=e.__c.base=r.__e;break}return Fe(e)}}function Te(e){(!e.__d&&(e.__d=!0)&&ue.push(e)&&!ke.__r++||pe!=se.debounceRendering)&&((pe=se.debounceRendering)||de)(ke)}function ke(){for(var e,t,r,i,n,o,s,a=1;ue.length;)ue.length>a&&ue.sort(ce),e=ue.shift(),a=ue.length,e.__d&&(r=void 0,i=void 0,n=(i=(t=e).__v).__e,o=[],s=[],t.__P&&((r=Pe({},i)).__v=i.__v+1,se.vnode&&se.vnode(r),Le(t.__P,r,i,t.__n,t.__P.namespaceURI,32&i.__u?[n]:null,o,null==n?je(i):n,!!(32&i.__u),s),r.__v=i.__v,r.__.__k[r.__i]=r,De(o,r,s),i.__e=i.__=null,r.__e!=n&&Fe(r)));ke.__r=0}function $e(e,t,r,i,n,o,s,a,l,u,p){var d,c,h,f,g,m,y,v=i&&i.__k||_e,_=t.length;for(l=Ae(r,t,v,l,_),d=0;d<_;d++)null!=(h=r.__k[d])&&(c=-1==h.__i?ve:v[h.__i]||ve,h.__i=d,m=Le(e,h,c,n,o,s,a,l,u,p),f=h.__e,h.ref&&c.ref!=h.ref&&(c.ref&&Be(c.ref,null,h),p.push(h.ref,h.__c||f,h)),null==g&&null!=f&&(g=f),(y=!!(4&h.__u))||c.__k===h.__k?l=Re(h,l,e,y):"function"==typeof h.type&&void 0!==m?l=m:f&&(l=f.nextSibling),h.__u&=-7);return r.__e=g,l}function Ae(e,t,r,i,n){var o,s,a,l,u,p=r.length,d=p,c=0;for(e.__k=new Array(n),o=0;o<n;o++)null!=(s=t[o])&&"boolean"!=typeof s&&"function"!=typeof s?(l=o+c,(s=e.__k[o]="string"==typeof s||"number"==typeof s||"bigint"==typeof s||s.constructor==String?Ee(null,s,null,null,null):we(s)?Ee(xe,{children:s},null,null,null):null==s.constructor&&s.__b>0?Ee(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):s).__=e,s.__b=e.__b+1,a=null,-1!=(u=s.__i=Ce(s,r,l,d))&&(d--,(a=r[u])&&(a.__u|=2)),null==a||null==a.__v?(-1==u&&(n>p?c--:n<p&&c++),"function"!=typeof s.type&&(s.__u|=4)):u!=l&&(u==l-1?c--:u==l+1?c++:(u>l?c--:c++,s.__u|=4))):e.__k[o]=null;if(d)for(o=0;o<p;o++)null!=(a=r[o])&&!(2&a.__u)&&(a.__e==i&&(i=je(a)),We(a,a));return i}function Re(e,t,r,i){var n,o;if("function"==typeof e.type){for(n=e.__k,o=0;n&&o<n.length;o++)n[o]&&(n[o].__=e,t=Re(n[o],t,r,i));return t}e.__e!=t&&(i&&(t&&e.type&&!t.parentNode&&(t=je(e)),r.insertBefore(e.__e,t||null)),t=e.__e);do{t=t&&t.nextSibling}while(null!=t&&8==t.nodeType);return t}function Ce(e,t,r,i){var n,o,s,a=e.key,l=e.type,u=t[r],p=null!=u&&!(2&u.__u);if(null===u&&null==e.key||p&&a==u.key&&l==u.type)return r;if(i>(p?1:0))for(n=r-1,o=r+1;n>=0||o<t.length;)if(null!=(u=t[s=n>=0?n--:o++])&&!(2&u.__u)&&a==u.key&&l==u.type)return s;return-1}function Ne(e,t,r){"-"==t[0]?e.setProperty(t,null==r?"":r):e[t]=null==r?"":"number"!=typeof r||be.test(t)?r:r+"px"}function Ie(e,t,r,i,n){var o,s;e:if("style"==t)if("string"==typeof r)e.style.cssText=r;else{if("string"==typeof i&&(e.style.cssText=i=""),i)for(t in i)r&&t in r||Ne(e.style,t,"");if(r)for(t in r)i&&r[t]==i[t]||Ne(e.style,t,r[t])}else if("o"==t[0]&&"n"==t[1])o=t!=(t=t.replace(he,"$1")),s=t.toLowerCase(),t=s in e||"onFocusOut"==t||"onFocusIn"==t?s.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+o]=r,r?i?r.u=i.u:(r.u=fe,e.addEventListener(t,o?me:ge,o)):e.removeEventListener(t,o?me:ge,o);else{if("http://www.w3.org/2000/svg"==n)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==r?"":r;break e}catch(e){}"function"==typeof r||(null==r||!1===r&&"-"!=t[4]?e.removeAttribute(t):e.setAttribute(t,"popover"==t&&1==r?"":r))}}function Me(e){return function(t){if(this.l){var r=this.l[t.type+e];if(null==t.t)t.t=fe++;else if(t.t<r.u)return;return r(se.event?se.event(t):t)}}}function Le(e,t,r,i,n,o,s,a,l,u){var p,d,c,h,f,g,m,y,v,_,b,w,P,S,O,E,x,U=t.type;if(null!=t.constructor)return null;128&r.__u&&(l=!!(32&r.__u),o=[a=t.__e=r.__e]),(p=se.__b)&&p(t);e:if("function"==typeof U)try{if(y=t.props,v="prototype"in U&&U.prototype.render,_=(p=U.contextType)&&i[p.__c],b=p?_?_.props.value:p.__:i,r.__c?m=(d=t.__c=r.__c).__=d.__E:(v?t.__c=d=new U(y,b):(t.__c=d=new Ue(y,b),d.constructor=U,d.render=Xe),_&&_.sub(d),d.props=y,d.state||(d.state={}),d.context=b,d.__n=i,c=d.__d=!0,d.__h=[],d._sb=[]),v&&null==d.__s&&(d.__s=d.state),v&&null!=U.getDerivedStateFromProps&&(d.__s==d.state&&(d.__s=Pe({},d.__s)),Pe(d.__s,U.getDerivedStateFromProps(y,d.__s))),h=d.props,f=d.state,d.__v=t,c)v&&null==U.getDerivedStateFromProps&&null!=d.componentWillMount&&d.componentWillMount(),v&&null!=d.componentDidMount&&d.__h.push(d.componentDidMount);else{if(v&&null==U.getDerivedStateFromProps&&y!==h&&null!=d.componentWillReceiveProps&&d.componentWillReceiveProps(y,b),!d.__e&&null!=d.shouldComponentUpdate&&!1===d.shouldComponentUpdate(y,d.__s,b)||t.__v==r.__v){for(t.__v!=r.__v&&(d.props=y,d.state=d.__s,d.__d=!1),t.__e=r.__e,t.__k=r.__k,t.__k.some(function(e){e&&(e.__=t)}),w=0;w<d._sb.length;w++)d.__h.push(d._sb[w]);d._sb=[],d.__h.length&&s.push(d);break e}null!=d.componentWillUpdate&&d.componentWillUpdate(y,d.__s,b),v&&null!=d.componentDidUpdate&&d.__h.push(function(){d.componentDidUpdate(h,f,g)})}if(d.context=b,d.props=y,d.__P=e,d.__e=!1,P=se.__r,S=0,v){for(d.state=d.__s,d.__d=!1,P&&P(t),p=d.render(d.props,d.state,d.context),O=0;O<d._sb.length;O++)d.__h.push(d._sb[O]);d._sb=[]}else do{d.__d=!1,P&&P(t),p=d.render(d.props,d.state,d.context),d.state=d.__s}while(d.__d&&++S<25);d.state=d.__s,null!=d.getChildContext&&(i=Pe(Pe({},i),d.getChildContext())),v&&!c&&null!=d.getSnapshotBeforeUpdate&&(g=d.getSnapshotBeforeUpdate(h,f)),E=p,null!=p&&p.type===xe&&null==p.key&&(E=qe(p.props.children)),a=$e(e,we(E)?E:[E],t,r,i,n,o,s,a,l,u),d.base=t.__e,t.__u&=-161,d.__h.length&&s.push(d),m&&(d.__E=d.__=null)}catch(e){if(t.__v=null,l||null!=o)if(e.then){for(t.__u|=l?160:128;a&&8==a.nodeType&&a.nextSibling;)a=a.nextSibling;o[o.indexOf(a)]=null,t.__e=a}else{for(x=o.length;x--;)Se(o[x]);ze(t)}else t.__e=r.__e,t.__k=r.__k,e.then||ze(t);se.__e(e,t,r)}else null==o&&t.__v==r.__v?(t.__k=r.__k,t.__e=r.__e):a=t.__e=He(r.__e,t,r,i,n,o,s,l,u);return(p=se.diffed)&&p(t),128&t.__u?void 0:a}function ze(e){e&&e.__c&&(e.__c.__e=!0),e&&e.__k&&e.__k.forEach(ze)}function De(e,t,r){for(var i=0;i<r.length;i++)Be(r[i],r[++i],r[++i]);se.__c&&se.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){se.__e(e,t.__v)}})}function qe(e){return"object"!=typeof e||null==e||e.__b&&e.__b>0?e:we(e)?e.map(qe):Pe({},e)}function He(e,t,r,i,n,o,s,a,l){var u,p,d,c,h,f,g,m=r.props,y=t.props,v=t.type;if("svg"==v?n="http://www.w3.org/2000/svg":"math"==v?n="http://www.w3.org/1998/Math/MathML":n||(n="http://www.w3.org/1999/xhtml"),null!=o)for(u=0;u<o.length;u++)if((h=o[u])&&"setAttribute"in h==!!v&&(v?h.localName==v:3==h.nodeType)){e=h,o[u]=null;break}if(null==e){if(null==v)return document.createTextNode(y);e=document.createElementNS(n,v,y.is&&y),a&&(se.__m&&se.__m(t,o),a=!1),o=null}if(null==v)m===y||a&&e.data==y||(e.data=y);else{if(o=o&&oe.call(e.childNodes),m=r.props||ve,!a&&null!=o)for(m={},u=0;u<e.attributes.length;u++)m[(h=e.attributes[u]).name]=h.value;for(u in m)if(h=m[u],"children"==u);else if("dangerouslySetInnerHTML"==u)d=h;else if(!(u in y)){if("value"==u&&"defaultValue"in y||"checked"==u&&"defaultChecked"in y)continue;Ie(e,u,null,h,n)}for(u in y)h=y[u],"children"==u?c=h:"dangerouslySetInnerHTML"==u?p=h:"value"==u?f=h:"checked"==u?g=h:a&&"function"!=typeof h||m[u]===h||Ie(e,u,h,m[u],n);if(p)a||d&&(p.__html==d.__html||p.__html==e.innerHTML)||(e.innerHTML=p.__html),t.__k=[];else if(d&&(e.innerHTML=""),$e("template"==t.type?e.content:e,we(c)?c:[c],t,r,i,"foreignObject"==v?"http://www.w3.org/1999/xhtml":n,o,s,o?o[0]:r.__k&&je(r,0),a,l),null!=o)for(u=o.length;u--;)Se(o[u]);a||(u="value","progress"==v&&null==f?e.removeAttribute("value"):null!=f&&(f!==e[u]||"progress"==v&&!f||"option"==v&&f!=m[u])&&Ie(e,u,f,m[u],n),u="checked",null!=g&&g!=e[u]&&Ie(e,u,g,m[u],n))}return e}function Be(e,t,r){try{if("function"==typeof e){var i="function"==typeof e.__u;i&&e.__u(),i&&null==t||(e.__u=e(t))}else e.current=t}catch(e){se.__e(e,r)}}function We(e,t,r){var i,n;if(se.unmount&&se.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||Be(i,null,t)),null!=(i=e.__c)){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(e){se.__e(e,t)}i.base=i.__P=null}if(i=e.__k)for(n=0;n<i.length;n++)i[n]&&We(i[n],t,r||"function"!=typeof e.type);r||Se(e.__e),e.__c=e.__=e.__e=void 0}function Xe(e,t,r){return this.constructor(e,r)}function Ge(e,t,r){var i,n,o,s;t==document&&(t=document.documentElement),se.__&&se.__(e,t),n=(i="function"==typeof r)?null:r&&r.__k||t.__k,o=[],s=[],Le(t,e=(!i&&r||t).__k=Oe(xe,null,[e]),n||ve,ve,t.namespaceURI,!i&&r?[r]:n?null:t.firstChild?oe.call(t.childNodes):null,o,!i&&r?r:n?n.__e:t.firstChild,i,s),De(o,e,s)}oe=_e.slice,se={__e:function(e,t,r,i){for(var n,o,s;t=t.__;)if((n=t.__c)&&!n.__)try{if((o=n.constructor)&&null!=o.getDerivedStateFromError&&(n.setState(o.getDerivedStateFromError(e)),s=n.__d),null!=n.componentDidCatch&&(n.componentDidCatch(e,i||{}),s=n.__d),s)return n.__E=n}catch(t){e=t}throw e}},ae=0,le=function(e){return null!=e&&null==e.constructor},Ue.prototype.setState=function(e,t){var r;r=null!=this.__s&&this.__s!=this.state?this.__s:this.__s=Pe({},this.state),"function"==typeof e&&(e=e(Pe({},r),this.props)),e&&Pe(r,e),null!=e&&this.__v&&(t&&this._sb.push(t),Te(this))},Ue.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Te(this))},Ue.prototype.render=xe,ue=[],de="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,ce=function(e,t){return e.__v.__b-t.__v.__b},ke.__r=0,he=/(PointerCapture)$|Capture$/i,fe=0,ge=Me(!1),me=Me(!0),ye=0;var Ke,Ve,Ye,Qe,Je,Ze,et,tt,rt,it,nt,ot=Object.freeze({__proto__:null,Component:Ue,Fragment:xe,cloneElement:function(e,t,r){var i,n,o,s,a=Pe({},e.props);for(o in e.type&&e.type.defaultProps&&(s=e.type.defaultProps),t)"key"==o?i=t[o]:"ref"==o?n=t[o]:a[o]=void 0===t[o]&&null!=s?s[o]:t[o];return arguments.length>2&&(a.children=arguments.length>3?oe.call(arguments,2):r),Ee(e.type,a,i||e.key,n||e.ref,null)},createContext:function(e){function t(e){var r,i;return this.getChildContext||(r=new Set,(i={})[t.__c]=this,this.getChildContext=function(){return i},this.componentWillUnmount=function(){r=null},this.shouldComponentUpdate=function(e){this.props.value!=e.value&&r.forEach(function(e){e.__e=!0,Te(e)})},this.sub=function(e){r.add(e);var t=e.componentWillUnmount;e.componentWillUnmount=function(){r&&r.delete(e),t&&t.call(e)}}),e.children}return t.__c="__cC"+ye++,t.__=e,t.Provider=t.__l=(t.Consumer=function(e,t){return e.children(t)}).contextType=t,t},createElement:Oe,createRef:function(){return{current:null}},h:Oe,hydrate:function e(t,r){Ge(t,r,e)},get isValidElement(){return le},get options(){return se},render:Ge,toChildArray:function e(t,r){return r=r||[],null==t||"boolean"==typeof t||(we(t)?t.some(function(t){e(t,r)}):r.push(t)),r}}),st=n(ot);function at(){if(Qe)return Ye;Qe=1;const e=Ve?Ke:(Ve=1,Ke=function(e){return(null==e?void 0:e.nodeType)===Node.ELEMENT_NODE});return Ye=function(t,r){return void 0===r&&(r=document),"string"==typeof t?r.querySelector(t):e(t)?t:null}}function lt(){if(tt)return et;tt=1;const e=J();return et=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(){}