UNPKG

enlarge-file-upload

Version:

A tool for chunked file upload with concurrency control.

2 lines 63.7 kB
/*! For license information please see upload.js.LICENSE.txt */ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.fileUploader=t():e.fileUploader=t()}(this,(()=>(()=>{"use strict";var __webpack_modules__={425:(module,__webpack_exports__,__webpack_require__)=>{var _navigator;function _slicedToArray(e,t){return _arrayWithHoles(e)||_iterableToArrayLimit(e,t)||_unsupportedIterableToArray(e,t)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _iterableToArrayLimit(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,a,s,i=[],c=!0,u=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=a.call(r)).done)&&(i.push(n.value),i.length!==t);c=!0);}catch(e){u=!0,o=e}finally{try{if(!c&&null!=r.return&&(s=r.return(),Object(s)!==s))return}finally{if(u)throw o}}return i}}function _arrayWithHoles(e){if(Array.isArray(e))return e}function _createForOfIteratorHelper(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=_unsupportedIterableToArray(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,s=!0,i=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return s=e.done,e},e:function(e){i=!0,a=e},f:function(){try{s||null==r.return||r.return()}finally{if(i)throw a}}}}function _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_unsupportedIterableToArray(e)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(e,t):void 0}}function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function _regeneratorRuntime(){_regeneratorRuntime=function(){return t};var e,t={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(e,t,r){e[t]=r.value},a="function"==typeof Symbol?Symbol:{},s=a.iterator||"@@iterator",i=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function u(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,r){return e[t]=r}}function l(e,t,r,n){var a=t&&t.prototype instanceof b?t:b,s=Object.create(a.prototype),i=new j(n||[]);return o(s,"_invoke",{value:S(e,r,i)}),s}function h(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}t.wrap=l;var f="suspendedStart",p="suspendedYield",d="executing",m="completed",y={};function b(){}function g(){}function w(){}var _={};u(_,s,(function(){return this}));var v=Object.getPrototypeOf,x=v&&v(v(C([])));x&&x!==r&&n.call(x,s)&&(_=x);var k=w.prototype=b.prototype=Object.create(_);function E(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function r(o,a,s,i){var c=h(e[o],e,a);if("throw"!==c.type){var u=c.arg,l=u.value;return l&&"object"==_typeof(l)&&n.call(l,"__await")?t.resolve(l.__await).then((function(e){r("next",e,s,i)}),(function(e){r("throw",e,s,i)})):t.resolve(l).then((function(e){u.value=e,s(u)}),(function(e){return r("throw",e,s,i)}))}i(c.arg)}var a;o(this,"_invoke",{value:function(e,n){function o(){return new t((function(t,o){r(e,n,t,o)}))}return a=a?a.then(o,o):o()}})}function S(t,r,n){var o=f;return function(a,s){if(o===d)throw Error("Generator is already running");if(o===m){if("throw"===a)throw s;return{value:e,done:!0}}for(n.method=a,n.arg=s;;){var i=n.delegate;if(i){var c=R(i,n);if(c){if(c===y)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===f)throw o=m,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=d;var u=h(t,r,n);if("normal"===u.type){if(o=n.done?m:p,u.arg===y)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(o=m,n.method="throw",n.arg=u.arg)}}}function R(t,r){var n=r.method,o=t.iterator[n];if(o===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,R(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),y;var a=h(o,t.iterator,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,y;var s=a.arg;return s?s.done?(r[t.resultName]=s.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,y):s:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,y)}function T(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function A(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function j(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(T,this),this.reset(!0)}function C(t){if(t||""===t){var r=t[s];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function r(){for(;++o<t.length;)if(n.call(t,o))return r.value=t[o],r.done=!1,r;return r.value=e,r.done=!0,r};return a.next=a}}throw new TypeError(_typeof(t)+" is not iterable")}return g.prototype=w,o(k,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:g,configurable:!0}),g.displayName=u(w,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,u(e,c,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},E(O.prototype),u(O.prototype,i,(function(){return this})),t.AsyncIterator=O,t.async=function(e,r,n,o,a){void 0===a&&(a=Promise);var s=new O(l(e,r,n,o),a);return t.isGeneratorFunction(r)?s:s.next().then((function(e){return e.done?e.value:s.next()}))},E(k),u(k,c,"Generator"),u(k,s,(function(){return this})),u(k,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},t.values=C,j.prototype={constructor:j,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(A),!t)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function o(n,o){return i.type="throw",i.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var s=this.tryEntries[a],i=s.completion;if("root"===s.tryLoc)return o("end");if(s.tryLoc<=this.prev){var c=n.call(s,"catchLoc"),u=n.call(s,"finallyLoc");if(c&&u){if(this.prev<s.catchLoc)return o(s.catchLoc,!0);if(this.prev<s.finallyLoc)return o(s.finallyLoc)}else if(c){if(this.prev<s.catchLoc)return o(s.catchLoc,!0)}else{if(!u)throw Error("try statement without catch or finally");if(this.prev<s.finallyLoc)return o(s.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var s=a?a.completion:{};return s.type=e,s.arg=t,a?(this.method="next",this.next=a.finallyLoc,y):this.complete(s)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),y},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),A(r),y}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;A(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:C(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),y}},t}function _typeof(e){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof(e)}function asyncGeneratorStep(e,t,r,n,o,a,s){try{var i=e[a](s),c=i.value}catch(e){return void r(e)}i.done?t(c):Promise.resolve(c).then(n,o)}function _asyncToGenerator(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function s(e){asyncGeneratorStep(a,n,o,s,i,"next",e)}function i(e){asyncGeneratorStep(a,n,o,s,i,"throw",e)}s(void 0)}))}}__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{checker:()=>checker,createUploader:()=>createUploader}),module=__webpack_require__.hmd(module);var axios=__webpack_require__(806),cupNum=(null===(_navigator=navigator)||void 0===_navigator?void 0:_navigator.hardwareConcurrency)||0;cupNum=cupNum?Math.max(cupNum-2,1):1;var globalObj={},shaSource=null;function createUploader(e){if(!e.uploadFunction)throw e.onError&&e.onError(),new Error("The required parameter uploadFunction is missing");null==e.hash&&(e.hash=!0),e.customHash&&(e.hash=!1);var t=!1,r=[],n=null,o=0,a=!1,s=[],i=[],c=0,u=0,l=[],h=0,f=null,p=null,d=0,m=0,y=e.threads||cupNum,b=!1;e.chunkSize=globalObj.chunkSize||e.chunkSize||5242880;var g=new Proxy({progress:0,speed:0,uploadEnd:!1,hash:"",file:"",totalChunks:"",errorMsg:"",allChunks:[],hashMap:new Map},{set:function(e,t,r){return"progress"===t||"speed"===t?(e[t]=r,!0):"uploadEnd"===t?(e[t]=!0,!0):("hash"===t||"file"===t||"totalChunks"===t||"errorMsg"===t||"allChunks"===t||"hashMap"===t)&&(e[t]=r,!0)}});function w(t,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,o=arguments.length>3?arguments[3]:void 0,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:e.maxRetries||3;return _asyncToGenerator(_regeneratorRuntime().mark((function s(){var i,f,p,d,m;return _regeneratorRuntime().wrap((function(s){for(;;)switch(s.prev=s.next){case 0:if(i=!1,s.prev=1,!e.startOffset&&(null===(f=e.includeChunks)||void 0===f?void 0:f.length)>0?e.includeChunks.includes(r)&&(i=!0):i=!0,!i){s.next=15;break}if(i=!1,"object"!==_typeof(e.customHash)||null===e.customHash||!e.customHash.flow){s.next=13;break}return s.next=8,e.customHash.calculationHash(t,r);case 8:p=s.sent,d=p.hash,m=p.hashMap,g.hash=d,g.hashMap=m;case 13:return s.next=15,e.uploadFunction({chunk:t,index:r,hash:g.hash,cancelToken:o});case 15:u++,h+=t.size,g.progress=u/c*100,e.onProgress&&e.onProgress(g.progress),s.next=39;break;case 21:if(s.prev=21,s.t0=s.catch(1),!axios.isCancel(s.t0)){s.next=26;break}return l.push({chunk:t,index:r}),s.abrupt("return");case 26:if(!(n<a)){s.next=31;break}return i=!1,s.abrupt("return",w(t,r,n+1,o)());case 31:if(g.errorMsg=s.t0,"AxiosError"!==(null===s.t0||void 0===s.t0?void 0:s.t0.name)){s.next=37;break}throw e.onError&&e.onError({chunk:t,index:r}),new Error("chunk ".concat(r," upload fail,Maximum number of retries reached ").concat(a,"."));case 37:throw e.onError&&e.onError(s.t0),s.t0;case 39:case"end":return s.stop()}}),s,null,[[1,21]])})))}function _(){p||(p=setInterval((function(){if(e.onSpeed){var t=function(e,t){var r=t/1048576/((performance.now()-e-d)/1e3);return r>=1?"".concat(r.toFixed(2)," MB/s"):"".concat((1024*r).toFixed(2)," KB/s")}(f,h);g.speed=t,e.onSpeed(t)}u>=c&&0===l.length&&0===s.length&&!a&&(v(),g.uploadEnd=!0,e.onSuccess&&e.onSuccess())}),1e3))}function v(){p&&(clearInterval(p),p=null)}function x(){return k.apply(this,arguments)}function k(){return k=_asyncToGenerator(_regeneratorRuntime().mark((function n(){var u,h,f,p,d,m,y,b,g,_=arguments;return _regeneratorRuntime().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(u=_.length>0&&void 0!==_[0]?_[0]:e.concurrency||5,!a&&!t){n.next=3;break}return n.abrupt("return");case 3:if(0!==r.length){n.next=6;break}throw e.onError&&e.onError(),new Error("The file slice has not been initialized. Please call the handleUpload method first.");case 6:for(h=Math.floor((e.startOffset||0)*e.chunkSize/e.chunkSize),f=JSON.parse(JSON.stringify(e.includeChunks||[])),p=0===h&&f.length>0,d=function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function e(){var t,n,l,m,y;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(a||o>=r.length)){e.next=2;break}return e.abrupt("return");case 2:if(!((t=p?f.shift()+h:o+h)>=c)){e.next=7;break}return console.warn("Chunk index ".concat(t," is out of range. Skipping.")),o++,e.abrupt("return");case 7:n=r[o],l=axios.CancelToken.source(),i.push(l),m=w(n,h+o,0,l.token),o++,y=m().then((function(){s=s.filter((function(e){return e!==y})),d()})),s.push(y),s.length<u&&d();case 16:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();s.length<u&&o<r.length;)d();return n.next=13,Promise.all(s);case 13:if(!(l.length>0)||a){n.next=34;break}m=_toConsumableArray(l),l=[],y=_createForOfIteratorHelper(m),n.prev=17,g=_regeneratorRuntime().mark((function e(){var t,r,n,o,a,c;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=b.value,r=t.chunk,n=t.index,o=axios.CancelToken.source(),i.push(o),a=w(r,h+n-h,0,o.token),c=a().then((function(){s=s.filter((function(e){return e!==c}))})),s.push(c),s.length<u&&d();case 8:case"end":return e.stop()}}),e)})),y.s();case 20:if((b=y.n()).done){n.next=24;break}return n.delegateYield(g(),"t0",22);case 22:n.next=20;break;case 24:n.next=29;break;case 26:n.prev=26,n.t1=n.catch(17),y.e(n.t1);case 29:return n.prev=29,y.f(),n.finish(29);case 32:return n.next=34,Promise.all(s);case 34:case"end":return n.stop()}}),n,null,[[17,26,29,32]])}))),k.apply(this,arguments)}function E(){return(E=_asyncToGenerator(_regeneratorRuntime().mark((function t(){return _regeneratorRuntime().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(0!==r.length){t.next=4;break}return e.onError&&e.onError(),console.error("The file slice has not been initialized. Please call the handleUpload method first."),t.abrupt("return");case 4:if(a){t.next=6;break}return t.abrupt("return");case 6:return a=!1,d+=performance.now()-m,_(),t.next=11,x();case 11:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function O(){return(O=_asyncToGenerator(_regeneratorRuntime().mark((function s(i){var p,m,w,v,k,E,O,S,R,T,A,j,C,L,P,N,U;return _regeneratorRuntime().wrap((function(s){for(;;)switch(s.prev=s.next){case 0:if(o=0,t=!1,u=e.startOffset||0,l=[],h=0,d=0,g.file=i,v=(e.startOffset||0)*e.chunkSize,a=!1,r=[],g.progress=0,e.beginHash&&e.hash&&e.beginHash(),r=createFileChunk(i,e.chunkSize,v),g.allChunks=r,k=hashRepeatedly(e,r.length),E=k.hash,O=k.hashMap,g.hash=E,g.hashMap=O,S=e.chunkMap&&!0!==(null===(p=e.chunkMap)||void 0===p?void 0:p.async),!((R=null===(m=e.chunkMap)||void 0===m?void 0:m.async)&&!1!==e.awaitHash||!0!==e.hash||0==e.awaitHash&&S||g.hash)){s.next=29;break}if(!S||null!==(T=g.hashMap)&&void 0!==T&&T.size){s.next=26;break}return s.next=23,hashAllSlices(r,e,y);case 23:g.hashMap=s.sent,s.next=27;break;case 26:!R||null!==(A=g.hashMap)&&void 0!==A&&A.size||hashAllSlices(r,e,y).then((function(e){g.hashMap=e}));case 27:s.next=30;break;case 29:b=!0;case 30:if(null!==(w=g.hashMap)&&void 0!==w&&w.size&&(b=!1),0!==r.length){s.next=34;break}throw e.onError&&e.onError(),new Error("The startOffset parameter is too large and the file slices array is empty.");case 34:if(c=r.length,g.totalChunks=c,g.hash||!1===e.hash){s.next=48;break}if(!1===e.awaitHash){s.next=47;break}return s.next=40,calculateHash(r,b,e);case 40:j=s.sent,C=j.hash,L=j.hashMap,g.hash=C,null!=L&&L.size&&(g.hashMap=L),s.next=48;break;case 47:calculateHash(r,b,e).then((function(e){var t=e.hash,r=e.hashMap;g.hash=t,null!=r&&r.size&&(g.hashMap=r)}));case 48:if(n=g.hash,e.endHash&&e.hash&&e.endHash(n),"function"!=typeof e.customHash){s.next=58;break}return s.next=53,e.customHash(i);case 53:P=s.sent,N=P.hash,U=P.hashMap,g.hash=N,g.hashMap=U;case 58:return f=performance.now(),_(),s.next=62,x();case 62:case"end":return s.stop()}}),s)})))).apply(this,arguments)}return{upload:function(e){return O.apply(this,arguments)},pause:function(){setTimeout((function(){a=!0,v(),m=performance.now(),i.forEach((function(e){return e.cancel("Upload suspended")})),s=[],i=[]}),0)},resume:function(){return E.apply(this,arguments)},reset:function(){t=!0,i.forEach((function(e){return e.cancel("Upload reset")})),r=[],n=null,o=0,a=!1,s=[],i=[],c=0,u=0,l=[],h=0,d=0,m=0,globalObj={},p&&(clearInterval(p),p=null),Object.keys(g).forEach((function(e){"progress"===e||"speed"===e?g[e]=0:"uploadEnd"===e?g[e]=!1:"hash"===e||"file"===e||"totalChunks"===e||"errorMsg"===e?g[e]="":"allChunks"===e?g[e]=[]:"hashMap"===e&&(g[e]=new Map)}))},state:g}}function checker(e){return _checker.apply(this,arguments)}function _checker(){return _checker=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){var r,n,o,a,s,i,c,u,l,h,f,p,d,m,y=arguments;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(m=function(){return(m=_asyncToGenerator(_regeneratorRuntime().mark((function e(){var t,r,a,h,f,p,d;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a=n.chunkMap&&!0!==(null===(t=n.chunkMap)||void 0===t?void 0:t.async),!((h=null===(r=n.chunkMap)||void 0===r?void 0:r.async)&&!1!==n.awaitHash||!0!==n.hash||0==n.awaitHash&&a)){e.next=12;break}if(!a){e.next=9;break}return e.next=6,hashAllSlices(u,n,c);case 6:i=e.sent,e.next=10;break;case 9:h&&hashAllSlices(u,n,c).then((function(e){i=e}));case 10:e.next=13;break;case 12:l=!0;case 13:if(!1===n.hash){e.next=25;break}if(!1===n.awaitHash){e.next=24;break}return e.next=17,calculateHash(o,l,n);case 17:f=e.sent,p=f.hash,d=f.hashMap,s=p,null!=d&&d.size&&(i=d),e.next=25;break;case 24:calculateHash(o,l,n).then((function(e){var t;s=e.hash,null!==(t=e.hashMap)&&void 0!==t&&t.size&&(i=e.hashMap)}));case 25:case"end":return e.stop()}}),e)})))).apply(this,arguments)},d=function(){return m.apply(this,arguments)},n=y.length>1&&void 0!==y[1]?y[1]:{},o=[],a=0,i=new Map,c=n.threads||cupNum,u=[],l=!1,h=[],f={},globalObj={},o=createFileChunk(t,n.chunkSize||5242880,0),0!==(a=o.length)){e.next=17;break}throw new Error("The startOffset parameter is too large and the file slices array is empty.");case 17:if(n.beginHash&&n.beginHash(),n.sampleHash&&"function"==typeof n.sampleHash?h=n.sampleHash(a):n.sampleHash&&"boolean"==typeof n.sampleHash&&(h=sampleHashIndexfn(a)),!h.length){e.next=23;break}return e.next=22,calcHashByChunks(h,o);case 22:f=e.sent;case 23:return u=null!==(r=n.chunkMap)&&void 0!==r&&null!==(r=r.indices)&&void 0!==r&&r.length?null===(p=n.chunkMap)||void 0===p?void 0:p.indices.map((function(e){return o[e]})):o,e.next=26,d();case 26:return n.endHash&&n.endHash(s),globalObj={config:n,chunkHashMap:i,hash:s,totalChunks:a,allChunks:o,chunkSize:n.chunkSize||5242880},e.abrupt("return",{chunkHashMap:i,hash:s,totalChunks:a,allChunks:o,sampleHash:f});case 29:case"end":return e.stop()}}),e)}))),_checker.apply(this,arguments)}function createFileChunk(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5242880,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=[],o=Math.ceil((e.size-r)/t),a=0;a<o;a++){var s=e.slice(r+t*a,r+t*(a+1));n.push(s)}return n}function hashAllSlices(e){return _hashAllSlices.apply(this,arguments)}function _hashAllSlices(){return _hashAllSlices=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){var r,n,o,a=arguments;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=a.length>1&&void 0!==a[1]?a[1]:{},n=a.length>2&&void 0!==a[2]?a[2]:4,e.next=4,createWorkerBlobURL();case 4:return o=e.sent,e.abrupt("return",new Promise((function(e){n=Math.min(n,t.length);for(var a=Math.ceil(t.length/n),s=0,i=new Map,c=0;c<n;c++){var u=new Worker(o),l=c*a,h=Math.min(l+a,t.length);u.postMessage({slices:t.slice(l,h),startIndex:l+(r.startOffset||0)}),u.onmessage=function(t){var r,a=_createForOfIteratorHelper(t.data.results);try{for(a.s();!(r=a.n()).done;){var c=_slicedToArray(r.value,2),u=c[0],l=c[1];i.set(u,l)}}catch(e){a.e(e)}finally{a.f()}++s===n&&(e(i),URL.revokeObjectURL(o))},u.onerror=function(e){console.error("Worker error:",e),reject(e),setTimeout((function(){return URL.revokeObjectURL(blobURL)}),0)}}})));case 6:case"end":return e.stop()}}),e)}))),_hashAllSlices.apply(this,arguments)}function createWorkerBlobURL(){return _createWorkerBlobURL.apply(this,arguments)}function _createWorkerBlobURL(){return(_createWorkerBlobURL=_asyncToGenerator(_regeneratorRuntime().mark((function e(){var t,r;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(shaSource){e.next=4;break}return e.next=3,fetch("https://unpkg.com/js-sha256@0.9.0/src/sha256.js").then((function(e){return e.text()}));case 3:shaSource=e.sent;case 4:return t="\n ".concat(shaSource,"\n\n self.onmessage = async (e) => {\n const { slices, startIndex } = e.data;\n const hashes = new Map();\n\n for (let i = 0; i < slices.length; i++) {\n const blob = slices[i];\n try {\n const arrayBuffer = await blob.arrayBuffer();\n const chunk = new Uint8Array(arrayBuffer);\n const hashHex = sha256(chunk);\n hashes.set(startIndex + i, hashHex);\n } catch (error) {\n console.error('Error processing chunk:', error);\n hashes.set(startIndex + i, 'error');\n }\n }\n\n self.postMessage({ results: Array.from(hashes.entries()) });\n self.close();\n };\n "),r=new Blob([t],{type:"text/javascript"}),e.abrupt("return",URL.createObjectURL(r));case 7:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function calculateHash(e,t,r){return _calculateHash.apply(this,arguments)}function _calculateHash(){return(_calculateHash=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r,n){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(shaSource){e.next=4;break}return e.next=3,fetch("https://unpkg.com/js-sha256@0.9.0/src/sha256.js").then((function(e){return e.text()}));case 3:shaSource=e.sent;case 4:return e.abrupt("return",new Promise((function(e,o){var a=URL.createObjectURL(new Blob(["\n ".concat(shaSource,"\n // importScripts('https://cdn.jsdelivr.net/npm/js-sha256@0.9.0/src/sha256.js');\n \n self.onmessage = async function (event) {\n const { chunks, hashNumFlag, chunkMap, startOffset } = event.data;\n const hash = sha256.create();\n const hashes = new Map();\n const hashPromises = [];\n \n let index = 0;\n for (const chunk of chunks) {\n try {\n const chunkBuffer = await chunk.arrayBuffer();\n const uint8Array = new Uint8Array(chunkBuffer);\n hash.update(uint8Array);\n const angency = Array.isArray(chunkMap?.indices) && chunkMap.indices.length > 0\n ? chunkMap.indices.includes(Number(index)) // 如果是非空数组,检查是否包含 i\n : true; // 否则返回 true\n\n if (hashNumFlag && chunkMap && angency) {\n hashPromises.push(Promise.resolve({\n index,\n hash: sha256(uint8Array)\n }));\n }\n } catch (e) {\n self.postMessage({ error: e });\n return;\n }\n index++;\n }\n if (hashPromises.length > 0) {\n const results = await Promise.all(hashPromises);\n results.forEach(({ index, hash }) => {\n hashes.set(index+startOffset, hash);\n });\n }\n \n self.postMessage({ \n finalHash: hash.hex(), \n hashes: hashes.size > 0 ? hashes : undefined \n });\n self.close();\n };\n ")],{type:"application/javascript"})),s=new Worker(a);s.postMessage({chunks:t,hashNumFlag:r,chunkMap:n.chunkMap,startOffset:n.startOffset||0}),s.onmessage=function(t){t.data.error?o(t.data.error):e({hash:t.data.finalHash,hashMap:t.data.hashes}),URL.revokeObjectURL(a)},s.onerror=function(e){console.error("Worker error:",e),o(e),setTimeout((function(){return URL.revokeObjectURL(a)}),0)}})));case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function hashRepeatedly(e,t){var r,n,o,a,s="",i=new Map;if(globalObj.hash&&(!1===e.hash||0!=e.startOffset&&e.startOffset||e.includeChunks&&0!==(null===(n=e.includeChunks)||void 0===n?void 0:n.length)||(s=globalObj.hash)),null!==(r=globalObj.chunkHashMap)&&void 0!==r&&r.size&&e.chunkMap)if(0!=e.startOffset&&e.startOffset||e.includeChunks&&0!=(null===(o=e.includeChunks)||void 0===o?void 0:o.length)){if((null===(a=e.includeChunks)||void 0===a?void 0:a.length)>0)for(var c=e.includeChunks,u=0;u<c.length;u++){var l=c[u],h=globalObj.chunkHashMap.get(l);h&&i.set(l,h)}else if(e.startOffset>0)for(var f=Array.from({length:t},(function(t,r){return e.startOffset+r})),p=0;p<f.length;p++){var d=f[p],m=globalObj.chunkHashMap.get(d);m&&i.set(d,m)}}else i=globalObj.chunkHashMap;return{hash:s,hashMap:i}}function sampleHashIndexfn(e){if(e<=4)return[1,2,3,4];if(e%2==0){var t=e/2;return[0,t,t+1,e-1]}return[0,(e+1)/2,e-1]}function calcHashByChunks(e,t){return _calcHashByChunks.apply(this,arguments)}function _calcHashByChunks(){return _calcHashByChunks=_asyncToGenerator(_regeneratorRuntime().mark((function _callee11(indices,chunks){var chunkHashes,hashObj,sha256,_shaSource,_iterator3,_step3,index,data,chunkBuffer,uint8Array,hashValue,finalHash;return _regeneratorRuntime().wrap((function _callee11$(_context12){for(;;)switch(_context12.prev=_context12.next){case 0:return chunkHashes=[],hashObj={},_context12.prev=2,_context12.next=5,fetch("https://unpkg.com/js-sha256@0.9.0/src/sha256.js").then((function(e){return e.text()}));case 5:_shaSource=_context12.sent,eval(_shaSource),sha256=window.sha256||self.sha256||eval("sha256"),_context12.next=14;break;case 10:throw _context12.prev=10,_context12.t0=_context12.catch(2),console.error("加载 sha256 库失败:",_context12.t0),new Error("无法加载 sha256 库");case 14:_iterator3=_createForOfIteratorHelper(indices.sort((function(e,t){return e-t}))),_context12.prev=15,_iterator3.s();case 17:if((_step3=_iterator3.n()).done){_context12.next=29;break}return index=_step3.value,data=chunks[index],_context12.next=22,data.arrayBuffer();case 22:chunkBuffer=_context12.sent,uint8Array=new Uint8Array(chunkBuffer),hashValue=sha256(uint8Array),chunkHashes.push(hashValue),hashObj[index]=hashValue;case 27:_context12.next=17;break;case 29:_context12.next=34;break;case 31:_context12.prev=31,_context12.t1=_context12.catch(15),_iterator3.e(_context12.t1);case 34:return _context12.prev=34,_iterator3.f(),_context12.finish(34);case 37:return finalHash=sha256(chunkHashes.join("")),_context12.abrupt("return",{sampleHash:finalHash,hashObj,chunkHashes});case 39:case"end":return _context12.stop()}}),_callee11,null,[[2,10],[15,31,34,37]])}))),_calcHashByChunks.apply(this,arguments)}module.exports&&(module.exports={createUploader,checker})},806:(e,t,r)=>{function n(e,t){return function(){return e.apply(t,arguments)}}const{toString:o}=Object.prototype,{getPrototypeOf:a}=Object,s=(i=Object.create(null),e=>{const t=o.call(e);return i[t]||(i[t]=t.slice(8,-1).toLowerCase())});var i;const c=e=>(e=e.toLowerCase(),t=>s(t)===e),u=e=>t=>typeof t===e,{isArray:l}=Array,h=u("undefined"),f=c("ArrayBuffer"),p=u("string"),d=u("function"),m=u("number"),y=e=>null!==e&&"object"==typeof e,b=e=>{if("object"!==s(e))return!1;const t=a(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)},g=c("Date"),w=c("File"),_=c("Blob"),v=c("FileList"),x=c("URLSearchParams"),[k,E,O,S]=["ReadableStream","Request","Response","Headers"].map(c);function R(e,t,{allOwnKeys:r=!1}={}){if(null==e)return;let n,o;if("object"!=typeof e&&(e=[e]),l(e))for(n=0,o=e.length;n<o;n++)t.call(null,e[n],n,e);else{const o=r?Object.getOwnPropertyNames(e):Object.keys(e),a=o.length;let s;for(n=0;n<a;n++)s=o[n],t.call(null,e[s],s,e)}}function T(e,t){t=t.toLowerCase();const r=Object.keys(e);let n,o=r.length;for(;o-- >0;)if(n=r[o],t===n.toLowerCase())return n;return null}const A="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:r.g,j=e=>!h(e)&&e!==A,C=(L="undefined"!=typeof Uint8Array&&a(Uint8Array),e=>L&&e instanceof L);var L;const P=c("HTMLFormElement"),N=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),U=c("RegExp"),M=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};R(r,((r,o)=>{let a;!1!==(a=t(r,o,e))&&(n[o]=a||r)})),Object.defineProperties(e,n)},H="abcdefghijklmnopqrstuvwxyz",B="0123456789",F={DIGIT:B,ALPHA:H,ALPHA_DIGIT:H+H.toUpperCase()+B},D=c("AsyncFunction");var I={isArray:l,isArrayBuffer:f,isBuffer:function(e){return null!==e&&!h(e)&&null!==e.constructor&&!h(e.constructor)&&d(e.constructor.isBuffer)&&e.constructor.isBuffer(e)},isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||d(e.append)&&("formdata"===(t=s(e))||"object"===t&&d(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&f(e.buffer),t},isString:p,isNumber:m,isBoolean:e=>!0===e||!1===e,isObject:y,isPlainObject:b,isReadableStream:k,isRequest:E,isResponse:O,isHeaders:S,isUndefined:h,isDate:g,isFile:w,isBlob:_,isRegExp:U,isFunction:d,isStream:e=>y(e)&&d(e.pipe),isURLSearchParams:x,isTypedArray:C,isFileList:v,forEach:R,merge:function e(){const{caseless:t}=j(this)&&this||{},r={},n=(n,o)=>{const a=t&&T(r,o)||o;b(r[a])&&b(n)?r[a]=e(r[a],n):b(n)?r[a]=e({},n):l(n)?r[a]=n.slice():r[a]=n};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&R(arguments[e],n);return r},extend:(e,t,r,{allOwnKeys:o}={})=>(R(t,((t,o)=>{r&&d(t)?e[o]=n(t,r):e[o]=t}),{allOwnKeys:o}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,r,n)=>{e.prototype=Object.create(t.prototype,n),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},toFlatObject:(e,t,r,n)=>{let o,s,i;const c={};if(t=t||{},null==e)return t;do{for(o=Object.getOwnPropertyNames(e),s=o.length;s-- >0;)i=o[s],n&&!n(i,e,t)||c[i]||(t[i]=e[i],c[i]=!0);e=!1!==r&&a(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},kindOf:s,kindOfTest:c,endsWith:(e,t,r)=>{e=String(e),(void 0===r||r>e.length)&&(r=e.length),r-=t.length;const n=e.indexOf(t,r);return-1!==n&&n===r},toArray:e=>{if(!e)return null;if(l(e))return e;let t=e.length;if(!m(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},forEachEntry:(e,t)=>{const r=(e&&e[Symbol.iterator]).call(e);let n;for(;(n=r.next())&&!n.done;){const r=n.value;t.call(e,r[0],r[1])}},matchAll:(e,t)=>{let r;const n=[];for(;null!==(r=e.exec(t));)n.push(r);return n},isHTMLForm:P,hasOwnProperty:N,hasOwnProp:N,reduceDescriptors:M,freezeMethods:e=>{M(e,((t,r)=>{if(d(e)&&-1!==["arguments","caller","callee"].indexOf(r))return!1;const n=e[r];d(n)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")}))}))},toObjectSet:(e,t)=>{const r={},n=e=>{e.forEach((e=>{r[e]=!0}))};return l(e)?n(e):n(String(e).split(t)),r},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,(function(e,t,r){return t.toUpperCase()+r})),noop:()=>{},toFiniteNumber:(e,t)=>null!=e&&Number.isFinite(e=+e)?e:t,findKey:T,global:A,isContextDefined:j,ALPHABET:F,generateString:(e=16,t=F.ALPHA_DIGIT)=>{let r="";const{length:n}=t;for(;e--;)r+=t[Math.random()*n|0];return r},isSpecCompliantForm:function(e){return!!(e&&d(e.append)&&"FormData"===e[Symbol.toStringTag]&&e[Symbol.iterator])},toJSONObject:e=>{const t=new Array(10),r=(e,n)=>{if(y(e)){if(t.indexOf(e)>=0)return;if(!("toJSON"in e)){t[n]=e;const o=l(e)?[]:{};return R(e,((e,t)=>{const a=r(e,n+1);!h(a)&&(o[t]=a)})),t[n]=void 0,o}}return e};return r(e,0)},isAsyncFn:D,isThenable:e=>e&&(y(e)||d(e))&&d(e.then)&&d(e.catch)};function q(e,t,r,n,o){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),n&&(this.request=n),o&&(this.response=o)}I.inherits(q,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:I.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const z=q.prototype,G={};function W(e){return I.isPlainObject(e)||I.isArray(e)}function J(e){return I.endsWith(e,"[]")?e.slice(0,-2):e}function V(e,t,r){return e?e.concat(t).map((function(e,t){return e=J(e),!r&&t?"["+e+"]":e})).join(r?".":""):t}["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach((e=>{G[e]={value:e}})),Object.defineProperties(q,G),Object.defineProperty(z,"isAxiosError",{value:!0}),q.from=(e,t,r,n,o,a)=>{const s=Object.create(z);return I.toFlatObject(e,s,(function(e){return e!==Error.prototype}),(e=>"isAxiosError"!==e)),q.call(s,e.message,t,r,n,o),s.cause=e,s.name=e.name,a&&Object.assign(s,a),s};const K=I.toFlatObject(I,{},null,(function(e){return/^is[A-Z]/.test(e)}));function $(e,t,r){if(!I.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const n=(r=I.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(e,t){return!I.isUndefined(t[e])}))).metaTokens,o=r.visitor||u,a=r.dots,s=r.indexes,i=(r.Blob||"undefined"!=typeof Blob&&Blob)&&I.isSpecCompliantForm(t);if(!I.isFunction(o))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(I.isDate(e))return e.toISOString();if(!i&&I.isBlob(e))throw new q("Blob is not supported. Use a Buffer instead.");return I.isArrayBuffer(e)||I.isTypedArray(e)?i&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function u(e,r,o){let i=e;if(e&&!o&&"object"==typeof e)if(I.endsWith(r,"{}"))r=n?r:r.slice(0,-2),e=JSON.stringify(e);else if(I.isArray(e)&&function(e){return I.isArray(e)&&!e.some(W)}(e)||(I.isFileList(e)||I.endsWith(r,"[]"))&&(i=I.toArray(e)))return r=J(r),i.forEach((function(e,n){!I.isUndefined(e)&&null!==e&&t.append(!0===s?V([r],n,a):null===s?r:r+"[]",c(e))})),!1;return!!W(e)||(t.append(V(o,r,a),c(e)),!1)}const l=[],h=Object.assign(K,{defaultVisitor:u,convertValue:c,isVisitable:W});if(!I.isObject(e))throw new TypeError("data must be an object");return function e(r,n){if(!I.isUndefined(r)){if(-1!==l.indexOf(r))throw Error("Circular reference detected in "+n.join("."));l.push(r),I.forEach(r,(function(r,a){!0===(!(I.isUndefined(r)||null===r)&&o.call(t,r,I.isString(a)?a.trim():a,n,h))&&e(r,n?n.concat(a):[a])})),l.pop()}}(e),t}function X(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,(function(e){return t[e]}))}function Y(e,t){this._pairs=[],e&&$(e,this,t)}const Q=Y.prototype;function Z(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function ee(e,t,r){if(!t)return e;const n=r&&r.encode||Z,o=r&&r.serialize;let a;if(a=o?o(t,r):I.isURLSearchParams(t)?t.toString():new Y(t,r).toString(n),a){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+a}return e}Q.append=function(e,t){this._pairs.push([e,t])},Q.toString=function(e){const t=e?function(t){return e.call(this,t,X)}:X;return this._pairs.map((function(e){return t(e[0])+"="+t(e[1])}),"").join("&")};var te=class{constructor(){this.handlers=[]}use(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){I.forEach(this.handlers,(function(t){null!==t&&e(t)}))}},re={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},ne={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:Y,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]};const oe="undefined"!=typeof window&&"undefined"!=typeof document,ae=(se="undefined"!=typeof navigator&&navigator.product,oe&&["ReactNative","NativeScript","NS"].indexOf(se)<0);var se;const ie="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,ce=oe&&window.location.href||"http://localhost";var ue={...Object.freeze({__proto__:null,hasBrowserEnv:oe,hasStandardBrowserWebWorkerEnv:ie,hasStandardBrowserEnv:ae,origin:ce}),...ne};function le(e){function t(e,r,n,o){let a=e[o++];if("__proto__"===a)return!0;const s=Number.isFinite(+a),i=o>=e.length;return a=!a&&I.isArray(n)?n.length:a,i?(I.hasOwnProp(n,a)?n[a]=[n[a],r]:n[a]=r,!s):(n[a]&&I.isObject(n[a])||(n[a]=[]),t(e,r,n[a],o)&&I.isArray(n[a])&&(n[a]=function(e){const t={},r=Object.keys(e);let n;const o=r.length;let a;for(n=0;n<o;n++)a=r[n],t[a]=e[a];return t}(n[a])),!s)}if(I.isFormData(e)&&I.isFunction(e.entries)){const r={};return I.forEachEntry(e,((e,n)=>{t(function(e){return I.matchAll(/\w+|\[(\w*)]/g,e).map((e=>"[]"===e[0]?"":e[1]||e[0]))}(e),n,r,0)})),r}return null}const he={transitional:re,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const r=t.getContentType()||"",n=r.indexOf("application/json")>-1,o=I.isObject(e);if(o&&I.isHTMLForm(e)&&(e=new FormData(e)),I.isFormData(e))return n?JSON.stringify(le(e)):e;if(I.isArrayBuffer(e)||I.isBuffer(e)||I.isStream(e)||I.isFile(e)||I.isBlob(e)||I.isReadableStream(e))return e;if(I.isArrayBufferView(e))return e.buffer;if(I.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let a;if(o){if(r.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return $(e,new ue.classes.URLSearchParams,Object.assign({visitor:function(e,t,r,n){return ue.isNode&&I.isBuffer(e)?(this.append(t,e.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)}},t))}(e,this.formSerializer).toString();if((a=I.isFileList(e))||r.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return $(a?{"files[]":e}:e,t&&new t,this.formSerializer)}}return o||n?(t.setContentType("application/json",!1),function(e,t,r){if(I.isString(e))try{return(0,JSON.parse)(e),I.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(0,JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||he.transitional,r=t&&t.forcedJSONParsing,n="json"===this.responseType;if(I.isResponse(e)||I.isReadableStream(e))return e;if(e&&I.isString(e)&&(r&&!this.responseType||n)){const r=!(t&&t.silentJSONParsing)&&n;try{return JSON.parse(e)}catch(e){if(r){if("SyntaxError"===e.name)throw q.from(e,q.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:ue.classes.FormData,Blob:ue.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};I.forEach(["delete","get","head","post","put","patch"],(e=>{he.headers[e]={}}));var fe=he;const pe=I.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),de=Symbol("internals");function me(e){return e&&String(e).trim().toLowerCase()}function ye(e){return!1===e||null==e?e:I.isArray(e)?e.map(ye):String(e)}function be(e,t,r,n,o){return I.isFunction(n)?n.call(this,t,r):(o&&(t=r),I.isString(t)?I.isString(n)?-1!==t.indexOf(n):I.isRegExp(n)?n.test(t):void 0:void 0)}class ge{constructor(e){e&&this.set(e)}set(e,t,r){const n=this;function o(e,t,r){const o=me(t);if(!o)throw new Error("header name must be a non-empty string");const a=I.findKey(n,o);(!a||void 0===n[a]||!0===r||void 0===r&&!1!==n[a])&&(n[a||t]=ye(e))}const a=(e,t)=>I.forEach(e,((e,r)=>o(e,r,t)));if(I.isPlainObject(e)||e instanceof this.constructor)a(e,t);else if(I.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))a((e=>{const t={};let r,n,o;return e&&e.split("\n").forEach((function(e){o=e.indexOf(":"),r=e.substring(0,o).trim().toLowerCase(),n=e.substring(o+1).trim(),!r||t[r]&&pe[r]||("set-cookie"===r?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)})),t})(e),t);else if(I.isHeaders(e))for(const[t,n]of e.entries())o(n,t,r);else null!=e&&o(t,e,r);return this}get(e,t){if(e=me(e)){const r=I.findKey(this,e);if(r){const e=this[r];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=r.exec(e);)t[n[1]]=n[2];return t}(e);if(I.isFunction(t))return t.call(this,e,r);if(I.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=me(e)){const r=I.findKey(this,e);return!(!r||void 0===this[r]||t&&!be(0,this[r],r,t))}return!1}delete(e,t){const r=this;let n=!1;function o(e){if(e=me(e)){const o=I.findKey(r,e);!o||t&&!be(0,r[o],o,t)||(delete r[o],n=!0)}}return I.isArray(e)?e.forEach(o):o(e),n}clear(e){const t=Object.keys(this);let r=t.length,n=!1;for(;r--;){const o=t[r];e&&!be(0,this[o],o,e,!0)||(delete this[o],n=!0)}return n}normalize(e){const t=this,r={};return I.forEach(this,((n,o)=>{const a=I.findKey(r,o);if(a)return t[a]=ye(n),void delete t[o];const s=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,((e,t,r)=>t.toUpperCase()+r))}(o):String(o).trim();s!==o&&delete t[o],t[s]=ye(n),r[s]=!0})),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return I.forEach(this,((r,n)=>{null!=r&&!1!==r&&(t[n]=e&&I.isArray(r)?r.join(", "):r)})),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map((([e,t])=>e+": "+t)).join("\n")}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const r=new this(e);return t.forEach((e=>r.set(e))),r}static accessor(e){const t=(this[de]=this[de]={accessors:{}}).accessors,r=this.prototype;function n(e){const n=me(e);t[n]||(function(e,t){const r=I.toCamelCase(" "+t);["get","set","has"].forEach((n=>{Object.defineProperty(e,n+r,{value:function(e,r,o){return this[n].call(this,t,e,r,o)},configurable:!0})}))}(r,e),t[n]=!0)}return I.isArray(e)?e.forEach(n):n(e),this}}ge.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),I.reduceDescriptors(ge.prototype,(({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[r]=e}}})),I.freezeMethods(ge);var we=ge;function _e(e,t){const r=this||fe,n=t||r,o=we.from(n.headers);let a=n.data;return I.forEach(e,(function(e){a=e.call(r,a,o.normalize(),t?t.status:void 0)})),o.normalize(),a}function ve(e){return!(!e||!e.__CANCEL__)}function xe(e,t,r){q.call(this,null==e?"canceled":e,q.ERR_CANCELED,t,r),this.name="CanceledError"}function ke(e,t,r){const n=r.config.validateStatus;r.status&&n&&!n(r.status)?t(new q("Request failed with status code "+r.status,[q.ERR_BAD_REQUEST,q.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r)):e(r)}I.inherits(xe,q,{__CANCEL__:!0});var Ee=(e,t,r=3)=>{let n=0;const o=function(e,t){e=e||10;const r=new Array(e),n=new Array(e);let o,a=0,s=0;return t=void 0!==t?t:1e3,function(i){const c=Date.now(),u=n[s];o||(o=c),r[a]=i,n[a]=c;let l=s,h=0;for(;l!==a;)h+=r[l++],l%=e;if(a=(a+1)%e,a===s&&(s=(s+1)%e),c-o<t)return;const f=u&&c-u;return f?Math.round(1e3*h/f):void 0}}(50,250);return function(e,t){let r=0;const n=1e3/t;let o=null;return function(){const t=!0===this,a=Date.now();if(t||a-r>n)return o&&(clearTimeout(o),o=null),r=a,e.apply(null,arguments);o||(o=setTimeout((()=>(o=null,r=Date.now(),e.apply(null,arguments))),n-(a-r)))}}((r=>{const a=r.loaded,s=r.lengthComputable?r.total:void 0,i=a-n,c=o(i);n=a;const u={loaded:a,total:s,progress:s?a/s:void 0,bytes:i,rate:c||void 0,estimated:c&&s&&a<=s?(s-a)/c:void 0,event:r,lengthComputable:null!=s};u[t?"download":"upload"]=!0,e(u)}),r)},Oe=ue.hasStandardBrowserEnv?function(){const e=/(msie|trident)/i.test(navigator.userAgent),t=document.createElement("a");let r;function n(r){let n=r;return e&&(t.setAttribute("href",n),n=t.href),t.setAttribute("href",n),{href:t.href,protocol:t.protocol?t.protocol.replace(/:$/,""):"",host:t.host,search:t.search?t.search.replace(/^\?/,""):"",hash:t.hash?t.hash.replace(/^#/,""):"",hostname:t.hostname,port:t.port,pathname:"/"===t.pathname.charAt(0)?t.pathname:"/"+t.pathname}}return r=n(window.location.href),function(e){const t=I.isString(e)?n(e):e;return t.protocol===r.protocol&&t.host===r.host}}():function(){return!0},Se=ue.hasStandardBrowserEnv?{write(e,t,r,n,o,a){const s=[e+"="+encodeURIComponent(t)];I.isNumber(r)&&s.push("expires="+new Date(r).toGMTString()),I.isString(n)&&s.push("path="+n),I.isString(o)&&s.push("domain="+o),!0===a&&s.push("secure"),document.cookie=s.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read:()=>null,remove(){}};function Re(e,t){return e&&!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}const Te=e=>e instanceof we?{...e}:e;function Ae(e,t){t=t||{};const r={};function n(e,t,r){return I.isPlainObject(e)&&I.isPlainObject(t)?I.merge.call({caseless:r},e,t):I.isPlainObject(t)?I.merge({},t):I.isArray(t)?t.slice():t}function o(e,t,r){return I.isUndefined(t)?I.isUndefined(e)?void 0:n(void 0,e,r):n(e,t,r)}function a(e,t){if(!I.isUndefined(t))return n(void 0,t)}function s(e,t){return I.isUndefined(t)?I.isUndefined(e)?void 0:n(void 0,e):n(void 0,t)}function i(r,o,a){return a in t?n(r,o):a in e?n(void 0,r):void 0}const c={url:a,method:a,data:a,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,withXSRFToken:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:i,headers:(e,t)=>o(Te(e),Te(t),!0)};return I.forEach(Object.keys(Object.assign({},e,t)),(function(n){const a=c[n]||o,s=a(e[n],t[n],n);I.isUndefined(s)&&a!==i||(r[n]=s)})),r}var je=e=>{const t=Ae({},e);let r,{data:n,withXSRFToken:o,xsrfHeaderName:a,xsrfCookieName:s,headers:i,auth:c}=t;if(t.headers=i=we.from(i),t.url=ee(Re(t.baseURL,t.url),e.params,e.paramsSerializer),c&&i.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):""))),I.isFormData(n))if(ue.hasStandardBrowserEnv||ue.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if(!1!==(r=i.getContentType())){const[e,...t]=r?r.split(";").map((e=>e.trim())).filter(Boolean):[];i.setContentType([e||"multipart/form-data",...t].join("; "))}if(ue.hasStandardBrowserEnv&&(o&&I.isFunction(o)&&(o=o(t)),o||!1!==o&&Oe(t.url))){const e=a&&s&&Se.read(s);e&&i.set(a,e)}return t},Ce="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise((function(t,r){const n=je(e);let o=n.data;const a=we.from(n.headers).normalize();let s,{responseType:i}=n;function c(){n.cancelToken&&n.cancelToken.unsubscribe(s),n.signal&&n.signal.removeEventListener("abort",s)}let u=new XMLHttpRequest;function l(){if(!u)return;const n=we.from("getAllResponseHeaders"in u&&u.getAllResponseHeaders());ke((function(e){t(e),c()}),(function(e){r(e),c()}),{data:i&&"text"!==i&&"json"!==i?u.response:u.responseText,status:u.status,statusText:u.statusText,headers:n,config:e,requ