@uploadx/client
Version:
Resumable upload client for browser and Node.js
1 lines • 50.5 kB
JavaScript
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).UploadxClient=t()}(this,(function(){"use strict";var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};var t=function(){return t=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},t.apply(this,arguments)};function n(e,t,n,r){return new(n||(n=Promise))((function(o,s){function i(e){try{c(r.next(e))}catch(e){s(e)}}function a(e){try{c(r.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,a)}c((r=r.apply(e,t||[])).next())}))}function r(e,t){var n,r,o,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=a(0),i.throw=a(1),i.return=a(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}}function o(e,t){return function(){return e.apply(t,arguments)}}"function"==typeof SuppressedError&&SuppressedError;const{toString:s}=Object.prototype,{getPrototypeOf:i}=Object,a=(c=Object.create(null),e=>{const t=s.call(e);return c[t]||(c[t]=t.slice(8,-1).toLowerCase())});var c;const u=e=>(e=e.toLowerCase(),t=>a(t)===e),l=e=>t=>typeof t===e,{isArray:f}=Array,d=l("undefined");const p=u("ArrayBuffer");const h=l("string"),m=l("function"),y=l("number"),b=e=>null!==e&&"object"==typeof e,E=e=>{if("object"!==a(e))return!1;const t=i(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)},g=u("Date"),w=u("File"),R=u("Blob"),v=u("FileList"),O=u("URLSearchParams"),[T,S,C,_]=["ReadableStream","Request","Response","Headers"].map(u);function A(e,t,{allOwnKeys:n=!1}={}){if(null==e)return;let r,o;if("object"!=typeof e&&(e=[e]),f(e))for(r=0,o=e.length;r<o;r++)t.call(null,e[r],r,e);else{const o=n?Object.getOwnPropertyNames(e):Object.keys(e),s=o.length;let i;for(r=0;r<s;r++)i=o[r],t.call(null,e[i],i,e)}}function N(e,t){t=t.toLowerCase();const n=Object.keys(e);let r,o=n.length;for(;o-- >0;)if(r=n[o],t===r.toLowerCase())return r;return null}const U="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,x=e=>!d(e)&&e!==U;const L=(j="undefined"!=typeof Uint8Array&&i(Uint8Array),e=>j&&e instanceof j);var j;const P=u("HTMLFormElement"),F=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),D=u("RegExp"),B=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};A(n,((n,o)=>{let s;!1!==(s=t(n,o,e))&&(r[o]=s||n)})),Object.defineProperties(e,r)};const k=u("AsyncFunction"),I=(q="function"==typeof setImmediate,M=m(U.postMessage),q?setImmediate:M?(z=`axios@${Math.random()}`,H=[],U.addEventListener("message",(({source:e,data:t})=>{e===U&&t===z&&H.length&&H.shift()()}),!1),e=>{H.push(e),U.postMessage(z,"*")}):e=>setTimeout(e));var q,M,z,H;const V="undefined"!=typeof queueMicrotask?queueMicrotask.bind(U):"undefined"!=typeof process&&process.nextTick||I;var J={isArray:f,isArrayBuffer:p,isBuffer:function(e){return null!==e&&!d(e)&&null!==e.constructor&&!d(e.constructor)&&m(e.constructor.isBuffer)&&e.constructor.isBuffer(e)},isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||m(e.append)&&("formdata"===(t=a(e))||"object"===t&&m(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&p(e.buffer),t},isString:h,isNumber:y,isBoolean:e=>!0===e||!1===e,isObject:b,isPlainObject:E,isReadableStream:T,isRequest:S,isResponse:C,isHeaders:_,isUndefined:d,isDate:g,isFile:w,isBlob:R,isRegExp:D,isFunction:m,isStream:e=>b(e)&&m(e.pipe),isURLSearchParams:O,isTypedArray:L,isFileList:v,forEach:A,merge:function e(){const{caseless:t}=x(this)&&this||{},n={},r=(r,o)=>{const s=t&&N(n,o)||o;E(n[s])&&E(r)?n[s]=e(n[s],r):E(r)?n[s]=e({},r):f(r)?n[s]=r.slice():n[s]=r};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&A(arguments[e],r);return n},extend:(e,t,n,{allOwnKeys:r}={})=>(A(t,((t,r)=>{n&&m(t)?e[r]=o(t,n):e[r]=t}),{allOwnKeys:r}),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,n,r)=>{e.prototype=Object.create(t.prototype,r),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},toFlatObject:(e,t,n,r)=>{let o,s,a;const c={};if(t=t||{},null==e)return t;do{for(o=Object.getOwnPropertyNames(e),s=o.length;s-- >0;)a=o[s],r&&!r(a,e,t)||c[a]||(t[a]=e[a],c[a]=!0);e=!1!==n&&i(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},kindOf:a,kindOfTest:u,endsWith:(e,t,n)=>{e=String(e),(void 0===n||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return-1!==r&&r===n},toArray:e=>{if(!e)return null;if(f(e))return e;let t=e.length;if(!y(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},forEachEntry:(e,t)=>{const n=(e&&e[Symbol.iterator]).call(e);let r;for(;(r=n.next())&&!r.done;){const n=r.value;t.call(e,n[0],n[1])}},matchAll:(e,t)=>{let n;const r=[];for(;null!==(n=e.exec(t));)r.push(n);return r},isHTMLForm:P,hasOwnProperty:F,hasOwnProp:F,reduceDescriptors:B,freezeMethods:e=>{B(e,((t,n)=>{if(m(e)&&-1!==["arguments","caller","callee"].indexOf(n))return!1;const r=e[n];m(r)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")}))}))},toObjectSet:(e,t)=>{const n={},r=e=>{e.forEach((e=>{n[e]=!0}))};return f(e)?r(e):r(String(e).split(t)),n},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,(function(e,t,n){return t.toUpperCase()+n})),noop:()=>{},toFiniteNumber:(e,t)=>null!=e&&Number.isFinite(e=+e)?e:t,findKey:N,global:U,isContextDefined:x,isSpecCompliantForm:function(e){return!!(e&&m(e.append)&&"FormData"===e[Symbol.toStringTag]&&e[Symbol.iterator])},toJSONObject:e=>{const t=new Array(10),n=(e,r)=>{if(b(e)){if(t.indexOf(e)>=0)return;if(!("toJSON"in e)){t[r]=e;const o=f(e)?[]:{};return A(e,((e,t)=>{const s=n(e,r+1);!d(s)&&(o[t]=s)})),t[r]=void 0,o}}return e};return n(e,0)},isAsyncFn:k,isThenable:e=>e&&(b(e)||m(e))&&m(e.then)&&m(e.catch),setImmediate:I,asap:V};function G(e,t,n,r,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),n&&(this.config=n),r&&(this.request=r),o&&(this.response=o,this.status=o.status?o.status:null)}J.inherits(G,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:J.toJSONObject(this.config),code:this.code,status:this.status}}});const K=G.prototype,W={};["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=>{W[e]={value:e}})),Object.defineProperties(G,W),Object.defineProperty(K,"isAxiosError",{value:!0}),G.from=(e,t,n,r,o,s)=>{const i=Object.create(K);return J.toFlatObject(e,i,(function(e){return e!==Error.prototype}),(e=>"isAxiosError"!==e)),G.call(i,e.message,t,n,r,o),i.cause=e,i.name=e.name,s&&Object.assign(i,s),i};function X(e){return J.isPlainObject(e)||J.isArray(e)}function $(e){return J.endsWith(e,"[]")?e.slice(0,-2):e}function Y(e,t,n){return e?e.concat(t).map((function(e,t){return e=$(e),!n&&t?"["+e+"]":e})).join(n?".":""):t}const Q=J.toFlatObject(J,{},null,(function(e){return/^is[A-Z]/.test(e)}));function Z(e,t,n){if(!J.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const r=(n=J.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(e,t){return!J.isUndefined(t[e])}))).metaTokens,o=n.visitor||u,s=n.dots,i=n.indexes,a=(n.Blob||"undefined"!=typeof Blob&&Blob)&&J.isSpecCompliantForm(t);if(!J.isFunction(o))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(J.isDate(e))return e.toISOString();if(!a&&J.isBlob(e))throw new G("Blob is not supported. Use a Buffer instead.");return J.isArrayBuffer(e)||J.isTypedArray(e)?a&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function u(e,n,o){let a=e;if(e&&!o&&"object"==typeof e)if(J.endsWith(n,"{}"))n=r?n:n.slice(0,-2),e=JSON.stringify(e);else if(J.isArray(e)&&function(e){return J.isArray(e)&&!e.some(X)}(e)||(J.isFileList(e)||J.endsWith(n,"[]"))&&(a=J.toArray(e)))return n=$(n),a.forEach((function(e,r){!J.isUndefined(e)&&null!==e&&t.append(!0===i?Y([n],r,s):null===i?n:n+"[]",c(e))})),!1;return!!X(e)||(t.append(Y(o,n,s),c(e)),!1)}const l=[],f=Object.assign(Q,{defaultVisitor:u,convertValue:c,isVisitable:X});if(!J.isObject(e))throw new TypeError("data must be an object");return function e(n,r){if(!J.isUndefined(n)){if(-1!==l.indexOf(n))throw Error("Circular reference detected in "+r.join("."));l.push(n),J.forEach(n,(function(n,s){!0===(!(J.isUndefined(n)||null===n)&&o.call(t,n,J.isString(s)?s.trim():s,r,f))&&e(n,r?r.concat(s):[s])})),l.pop()}}(e),t}function ee(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,(function(e){return t[e]}))}function te(e,t){this._pairs=[],e&&Z(e,this,t)}const ne=te.prototype;function re(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function oe(e,t,n){if(!t)return e;const r=n&&n.encode||re;J.isFunction(n)&&(n={serialize:n});const o=n&&n.serialize;let s;if(s=o?o(t,n):J.isURLSearchParams(t)?t.toString():new te(t,n).toString(r),s){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+s}return e}ne.append=function(e,t){this._pairs.push([e,t])},ne.toString=function(e){const t=e?function(t){return e.call(this,t,ee)}:ee;return this._pairs.map((function(e){return t(e[0])+"="+t(e[1])}),"").join("&")};class se{constructor(){this.handlers=[]}use(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){J.forEach(this.handlers,(function(t){null!==t&&e(t)}))}}var ie={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},ae={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:te,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]};const ce="undefined"!=typeof window&&"undefined"!=typeof document,ue="object"==typeof navigator&&navigator||void 0,le=ce&&(!ue||["ReactNative","NativeScript","NS"].indexOf(ue.product)<0),fe="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,de=ce&&window.location.href||"http://localhost";var pe={...Object.freeze({__proto__:null,hasBrowserEnv:ce,hasStandardBrowserEnv:le,hasStandardBrowserWebWorkerEnv:fe,navigator:ue,origin:de}),...ae};function he(e){function t(e,n,r,o){let s=e[o++];if("__proto__"===s)return!0;const i=Number.isFinite(+s),a=o>=e.length;if(s=!s&&J.isArray(r)?r.length:s,a)return J.hasOwnProp(r,s)?r[s]=[r[s],n]:r[s]=n,!i;r[s]&&J.isObject(r[s])||(r[s]=[]);return t(e,n,r[s],o)&&J.isArray(r[s])&&(r[s]=function(e){const t={},n=Object.keys(e);let r;const o=n.length;let s;for(r=0;r<o;r++)s=n[r],t[s]=e[s];return t}(r[s])),!i}if(J.isFormData(e)&&J.isFunction(e.entries)){const n={};return J.forEachEntry(e,((e,r)=>{t(function(e){return J.matchAll(/\w+|\[(\w*)]/g,e).map((e=>"[]"===e[0]?"":e[1]||e[0]))}(e),r,n,0)})),n}return null}const me={transitional:ie,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const n=t.getContentType()||"",r=n.indexOf("application/json")>-1,o=J.isObject(e);o&&J.isHTMLForm(e)&&(e=new FormData(e));if(J.isFormData(e))return r?JSON.stringify(he(e)):e;if(J.isArrayBuffer(e)||J.isBuffer(e)||J.isStream(e)||J.isFile(e)||J.isBlob(e)||J.isReadableStream(e))return e;if(J.isArrayBufferView(e))return e.buffer;if(J.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let s;if(o){if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return Z(e,new pe.classes.URLSearchParams,Object.assign({visitor:function(e,t,n,r){return pe.isNode&&J.isBuffer(e)?(this.append(t,e.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)}},t))}(e,this.formSerializer).toString();if((s=J.isFileList(e))||n.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return Z(s?{"files[]":e}:e,t&&new t,this.formSerializer)}}return o||r?(t.setContentType("application/json",!1),function(e,t,n){if(J.isString(e))try{return(t||JSON.parse)(e),J.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(n||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||me.transitional,n=t&&t.forcedJSONParsing,r="json"===this.responseType;if(J.isResponse(e)||J.isReadableStream(e))return e;if(e&&J.isString(e)&&(n&&!this.responseType||r)){const n=!(t&&t.silentJSONParsing)&&r;try{return JSON.parse(e)}catch(e){if(n){if("SyntaxError"===e.name)throw G.from(e,G.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:pe.classes.FormData,Blob:pe.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};J.forEach(["delete","get","head","post","put","patch"],(e=>{me.headers[e]={}}));const ye=J.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"]);const be=Symbol("internals");function Ee(e){return e&&String(e).trim().toLowerCase()}function ge(e){return!1===e||null==e?e:J.isArray(e)?e.map(ge):String(e)}function we(e,t,n,r,o){return J.isFunction(r)?r.call(this,t,n):(o&&(t=n),J.isString(t)?J.isString(r)?-1!==t.indexOf(r):J.isRegExp(r)?r.test(t):void 0:void 0)}let Re=class{constructor(e){e&&this.set(e)}set(e,t,n){const r=this;function o(e,t,n){const o=Ee(t);if(!o)throw new Error("header name must be a non-empty string");const s=J.findKey(r,o);(!s||void 0===r[s]||!0===n||void 0===n&&!1!==r[s])&&(r[s||t]=ge(e))}const s=(e,t)=>J.forEach(e,((e,n)=>o(e,n,t)));if(J.isPlainObject(e)||e instanceof this.constructor)s(e,t);else if(J.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))s((e=>{const t={};let n,r,o;return e&&e.split("\n").forEach((function(e){o=e.indexOf(":"),n=e.substring(0,o).trim().toLowerCase(),r=e.substring(o+1).trim(),!n||t[n]&&ye[n]||("set-cookie"===n?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)})),t})(e),t);else if(J.isHeaders(e))for(const[t,r]of e.entries())o(r,t,n);else null!=e&&o(t,e,n);return this}get(e,t){if(e=Ee(e)){const n=J.findKey(this,e);if(n){const e=this[n];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}(e);if(J.isFunction(t))return t.call(this,e,n);if(J.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=Ee(e)){const n=J.findKey(this,e);return!(!n||void 0===this[n]||t&&!we(0,this[n],n,t))}return!1}delete(e,t){const n=this;let r=!1;function o(e){if(e=Ee(e)){const o=J.findKey(n,e);!o||t&&!we(0,n[o],o,t)||(delete n[o],r=!0)}}return J.isArray(e)?e.forEach(o):o(e),r}clear(e){const t=Object.keys(this);let n=t.length,r=!1;for(;n--;){const o=t[n];e&&!we(0,this[o],o,e,!0)||(delete this[o],r=!0)}return r}normalize(e){const t=this,n={};return J.forEach(this,((r,o)=>{const s=J.findKey(n,o);if(s)return t[s]=ge(r),void delete t[o];const i=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,((e,t,n)=>t.toUpperCase()+n))}(o):String(o).trim();i!==o&&delete t[o],t[i]=ge(r),n[i]=!0})),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return J.forEach(this,((n,r)=>{null!=n&&!1!==n&&(t[r]=e&&J.isArray(n)?n.join(", "):n)})),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 n=new this(e);return t.forEach((e=>n.set(e))),n}static accessor(e){const t=(this[be]=this[be]={accessors:{}}).accessors,n=this.prototype;function r(e){const r=Ee(e);t[r]||(!function(e,t){const n=J.toCamelCase(" "+t);["get","set","has"].forEach((r=>{Object.defineProperty(e,r+n,{value:function(e,n,o){return this[r].call(this,t,e,n,o)},configurable:!0})}))}(n,e),t[r]=!0)}return J.isArray(e)?e.forEach(r):r(e),this}};function ve(e,t){const n=this||me,r=t||n,o=Re.from(r.headers);let s=r.data;return J.forEach(e,(function(e){s=e.call(n,s,o.normalize(),t?t.status:void 0)})),o.normalize(),s}function Oe(e){return!(!e||!e.__CANCEL__)}function Te(e,t,n){G.call(this,null==e?"canceled":e,G.ERR_CANCELED,t,n),this.name="CanceledError"}function Se(e,t,n){const r=n.config.validateStatus;n.status&&r&&!r(n.status)?t(new G("Request failed with status code "+n.status,[G.ERR_BAD_REQUEST,G.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):e(n)}Re.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),J.reduceDescriptors(Re.prototype,(({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[n]=e}}})),J.freezeMethods(Re),J.inherits(Te,G,{__CANCEL__:!0});const Ce=(e,t,n=3)=>{let r=0;const o=function(e,t){e=e||10;const n=new Array(e),r=new Array(e);let o,s=0,i=0;return t=void 0!==t?t:1e3,function(a){const c=Date.now(),u=r[i];o||(o=c),n[s]=a,r[s]=c;let l=i,f=0;for(;l!==s;)f+=n[l++],l%=e;if(s=(s+1)%e,s===i&&(i=(i+1)%e),c-o<t)return;const d=u&&c-u;return d?Math.round(1e3*f/d):void 0}}(50,250);return function(e,t){let n,r,o=0,s=1e3/t;const i=(t,s=Date.now())=>{o=s,n=null,r&&(clearTimeout(r),r=null),e.apply(null,t)};return[(...e)=>{const t=Date.now(),a=t-o;a>=s?i(e,t):(n=e,r||(r=setTimeout((()=>{r=null,i(n)}),s-a)))},()=>n&&i(n)]}((n=>{const s=n.loaded,i=n.lengthComputable?n.total:void 0,a=s-r,c=o(a);r=s;e({loaded:s,total:i,progress:i?s/i:void 0,bytes:a,rate:c||void 0,estimated:c&&i&&s<=i?(i-s)/c:void 0,event:n,lengthComputable:null!=i,[t?"download":"upload"]:!0})}),n)},_e=(e,t)=>{const n=null!=e;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},Ae=e=>(...t)=>J.asap((()=>e(...t)));var Ne=pe.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,pe.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(pe.origin),pe.navigator&&/(msie|trident)/i.test(pe.navigator.userAgent)):()=>!0,Ue=pe.hasStandardBrowserEnv?{write(e,t,n,r,o,s){const i=[e+"="+encodeURIComponent(t)];J.isNumber(n)&&i.push("expires="+new Date(n).toGMTString()),J.isString(r)&&i.push("path="+r),J.isString(o)&&i.push("domain="+o),!0===s&&i.push("secure"),document.cookie=i.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 xe(e,t,n){let r=!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t);return e&&(r||0==n)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}const Le=e=>e instanceof Re?{...e}:e;function je(e,t){t=t||{};const n={};function r(e,t,n,r){return J.isPlainObject(e)&&J.isPlainObject(t)?J.merge.call({caseless:r},e,t):J.isPlainObject(t)?J.merge({},t):J.isArray(t)?t.slice():t}function o(e,t,n,o){return J.isUndefined(t)?J.isUndefined(e)?void 0:r(void 0,e,0,o):r(e,t,0,o)}function s(e,t){if(!J.isUndefined(t))return r(void 0,t)}function i(e,t){return J.isUndefined(t)?J.isUndefined(e)?void 0:r(void 0,e):r(void 0,t)}function a(n,o,s){return s in t?r(n,o):s in e?r(void 0,n):void 0}const c={url:s,method:s,data:s,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:a,headers:(e,t,n)=>o(Le(e),Le(t),0,!0)};return J.forEach(Object.keys(Object.assign({},e,t)),(function(r){const s=c[r]||o,i=s(e[r],t[r],r);J.isUndefined(i)&&s!==a||(n[r]=i)})),n}var Pe=e=>{const t=je({},e);let n,{data:r,withXSRFToken:o,xsrfHeaderName:s,xsrfCookieName:i,headers:a,auth:c}=t;if(t.headers=a=Re.from(a),t.url=oe(xe(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),c&&a.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):""))),J.isFormData(r))if(pe.hasStandardBrowserEnv||pe.hasStandardBrowserWebWorkerEnv)a.setContentType(void 0);else if(!1!==(n=a.getContentType())){const[e,...t]=n?n.split(";").map((e=>e.trim())).filter(Boolean):[];a.setContentType([e||"multipart/form-data",...t].join("; "))}if(pe.hasStandardBrowserEnv&&(o&&J.isFunction(o)&&(o=o(t)),o||!1!==o&&Ne(t.url))){const e=s&&i&&Ue.read(i);e&&a.set(s,e)}return t};var Fe="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise((function(t,n){const r=Pe(e);let o=r.data;const s=Re.from(r.headers).normalize();let i,a,c,u,l,{responseType:f,onUploadProgress:d,onDownloadProgress:p}=r;function h(){u&&u(),l&&l(),r.cancelToken&&r.cancelToken.unsubscribe(i),r.signal&&r.signal.removeEventListener("abort",i)}let m=new XMLHttpRequest;function y(){if(!m)return;const r=Re.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders());Se((function(e){t(e),h()}),(function(e){n(e),h()}),{data:f&&"text"!==f&&"json"!==f?m.response:m.responseText,status:m.status,statusText:m.statusText,headers:r,config:e,request:m}),m=null}m.open(r.method.toUpperCase(),r.url,!0),m.timeout=r.timeout,"onloadend"in m?m.onloadend=y:m.onreadystatechange=function(){m&&4===m.readyState&&(0!==m.status||m.responseURL&&0===m.responseURL.indexOf("file:"))&&setTimeout(y)},m.onabort=function(){m&&(n(new G("Request aborted",G.ECONNABORTED,e,m)),m=null)},m.onerror=function(){n(new G("Network Error",G.ERR_NETWORK,e,m)),m=null},m.ontimeout=function(){let t=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const o=r.transitional||ie;r.timeoutErrorMessage&&(t=r.timeoutErrorMessage),n(new G(t,o.clarifyTimeoutError?G.ETIMEDOUT:G.ECONNABORTED,e,m)),m=null},void 0===o&&s.setContentType(null),"setRequestHeader"in m&&J.forEach(s.toJSON(),(function(e,t){m.setRequestHeader(t,e)})),J.isUndefined(r.withCredentials)||(m.withCredentials=!!r.withCredentials),f&&"json"!==f&&(m.responseType=r.responseType),p&&([c,l]=Ce(p,!0),m.addEventListener("progress",c)),d&&m.upload&&([a,u]=Ce(d),m.upload.addEventListener("progress",a),m.upload.addEventListener("loadend",u)),(r.cancelToken||r.signal)&&(i=t=>{m&&(n(!t||t.type?new Te(null,e,m):t),m.abort(),m=null)},r.cancelToken&&r.cancelToken.subscribe(i),r.signal&&(r.signal.aborted?i():r.signal.addEventListener("abort",i)));const b=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(r.url);b&&-1===pe.protocols.indexOf(b)?n(new G("Unsupported protocol "+b+":",G.ERR_BAD_REQUEST,e)):m.send(o||null)}))};const De=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let n,r=new AbortController;const o=function(e){if(!n){n=!0,i();const t=e instanceof Error?e:this.reason;r.abort(t instanceof G?t:new Te(t instanceof Error?t.message:t))}};let s=t&&setTimeout((()=>{s=null,o(new G(`timeout ${t} of ms exceeded`,G.ETIMEDOUT))}),t);const i=()=>{e&&(s&&clearTimeout(s),s=null,e.forEach((e=>{e.unsubscribe?e.unsubscribe(o):e.removeEventListener("abort",o)})),e=null)};e.forEach((e=>e.addEventListener("abort",o)));const{signal:a}=r;return a.unsubscribe=()=>J.asap(i),a}},Be=function*(e,t){let n=e.byteLength;if(n<t)return void(yield e);let r,o=0;for(;o<n;)r=o+t,yield e.slice(o,r),o=r},ke=async function*(e){if(e[Symbol.asyncIterator])return void(yield*e);const t=e.getReader();try{for(;;){const{done:e,value:n}=await t.read();if(e)break;yield n}}finally{await t.cancel()}},Ie=(e,t,n,r)=>{const o=async function*(e,t){for await(const n of ke(e))yield*Be(n,t)}(e,t);let s,i=0,a=e=>{s||(s=!0,r&&r(e))};return new ReadableStream({async pull(e){try{const{done:t,value:r}=await o.next();if(t)return a(),void e.close();let s=r.byteLength;if(n){let e=i+=s;n(e)}e.enqueue(new Uint8Array(r))}catch(e){throw a(e),e}},cancel:e=>(a(e),o.return())},{highWaterMark:2})},qe="function"==typeof fetch&&"function"==typeof Request&&"function"==typeof Response,Me=qe&&"function"==typeof ReadableStream,ze=qe&&("function"==typeof TextEncoder?(He=new TextEncoder,e=>He.encode(e)):async e=>new Uint8Array(await new Response(e).arrayBuffer()));var He;const Ve=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},Je=Me&&Ve((()=>{let e=!1;const t=new Request(pe.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t})),Ge=Me&&Ve((()=>J.isReadableStream(new Response("").body))),Ke={stream:Ge&&(e=>e.body)};var We;qe&&(We=new Response,["text","arrayBuffer","blob","formData","stream"].forEach((e=>{!Ke[e]&&(Ke[e]=J.isFunction(We[e])?t=>t[e]():(t,n)=>{throw new G(`Response type '${e}' is not supported`,G.ERR_NOT_SUPPORT,n)})})));const Xe=async(e,t)=>{const n=J.toFiniteNumber(e.getContentLength());return null==n?(async e=>{if(null==e)return 0;if(J.isBlob(e))return e.size;if(J.isSpecCompliantForm(e)){const t=new Request(pe.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return J.isArrayBufferView(e)||J.isArrayBuffer(e)?e.byteLength:(J.isURLSearchParams(e)&&(e+=""),J.isString(e)?(await ze(e)).byteLength:void 0)})(t):n};const $e={http:null,xhr:Fe,fetch:qe&&(async e=>{let{url:t,method:n,data:r,signal:o,cancelToken:s,timeout:i,onDownloadProgress:a,onUploadProgress:c,responseType:u,headers:l,withCredentials:f="same-origin",fetchOptions:d}=Pe(e);u=u?(u+"").toLowerCase():"text";let p,h=De([o,s&&s.toAbortSignal()],i);const m=h&&h.unsubscribe&&(()=>{h.unsubscribe()});let y;try{if(c&&Je&&"get"!==n&&"head"!==n&&0!==(y=await Xe(l,r))){let e,n=new Request(t,{method:"POST",body:r,duplex:"half"});if(J.isFormData(r)&&(e=n.headers.get("content-type"))&&l.setContentType(e),n.body){const[e,t]=_e(y,Ce(Ae(c)));r=Ie(n.body,65536,e,t)}}J.isString(f)||(f=f?"include":"omit");const o="credentials"in Request.prototype;p=new Request(t,{...d,signal:h,method:n.toUpperCase(),headers:l.normalize().toJSON(),body:r,duplex:"half",credentials:o?f:void 0});let s=await fetch(p);const i=Ge&&("stream"===u||"response"===u);if(Ge&&(a||i&&m)){const e={};["status","statusText","headers"].forEach((t=>{e[t]=s[t]}));const t=J.toFiniteNumber(s.headers.get("content-length")),[n,r]=a&&_e(t,Ce(Ae(a),!0))||[];s=new Response(Ie(s.body,65536,n,(()=>{r&&r(),m&&m()})),e)}u=u||"text";let b=await Ke[J.findKey(Ke,u)||"text"](s,e);return!i&&m&&m(),await new Promise(((t,n)=>{Se(t,n,{data:b,headers:Re.from(s.headers),status:s.status,statusText:s.statusText,config:e,request:p})}))}catch(t){if(m&&m(),t&&"TypeError"===t.name&&/fetch/i.test(t.message))throw Object.assign(new G("Network Error",G.ERR_NETWORK,e,p),{cause:t.cause||t});throw G.from(t,t&&t.code,e,p)}})};J.forEach($e,((e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}}));const Ye=e=>`- ${e}`,Qe=e=>J.isFunction(e)||null===e||!1===e;var Ze=e=>{e=J.isArray(e)?e:[e];const{length:t}=e;let n,r;const o={};for(let s=0;s<t;s++){let t;if(n=e[s],r=n,!Qe(n)&&(r=$e[(t=String(n)).toLowerCase()],void 0===r))throw new G(`Unknown adapter '${t}'`);if(r)break;o[t||"#"+s]=r}if(!r){const e=Object.entries(o).map((([e,t])=>`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build")));throw new G("There is no suitable adapter to dispatch the request "+(t?e.length>1?"since :\n"+e.map(Ye).join("\n"):" "+Ye(e[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return r};function et(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Te(null,e)}function tt(e){et(e),e.headers=Re.from(e.headers),e.data=ve.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return Ze(e.adapter||me.adapter)(e).then((function(t){return et(e),t.data=ve.call(e,e.transformResponse,t),t.headers=Re.from(t.headers),t}),(function(t){return Oe(t)||(et(e),t&&t.response&&(t.response.data=ve.call(e,e.transformResponse,t.response),t.response.headers=Re.from(t.response.headers))),Promise.reject(t)}))}const nt="1.8.4",rt={};["object","boolean","number","function","string","symbol"].forEach(((e,t)=>{rt[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}}));const ot={};rt.transitional=function(e,t,n){function r(e,t){return"[Axios v1.8.4] Transitional option '"+e+"'"+t+(n?". "+n:"")}return(n,o,s)=>{if(!1===e)throw new G(r(o," has been removed"+(t?" in "+t:"")),G.ERR_DEPRECATED);return t&&!ot[o]&&(ot[o]=!0,console.warn(r(o," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(n,o,s)}},rt.spelling=function(e){return(t,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};var st={assertOptions:function(e,t,n){if("object"!=typeof e)throw new G("options must be an object",G.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let o=r.length;for(;o-- >0;){const s=r[o],i=t[s];if(i){const t=e[s],n=void 0===t||i(t,s,e);if(!0!==n)throw new G("option "+s+" must be "+n,G.ERR_BAD_OPTION_VALUE)}else if(!0!==n)throw new G("Unknown option "+s,G.ERR_BAD_OPTION)}},validators:rt};const it=st.validators;let at=class{constructor(e){this.defaults=e,this.interceptors={request:new se,response:new se}}async request(e,t){try{return await this._request(e,t)}catch(e){if(e instanceof Error){let t={};Error.captureStackTrace?Error.captureStackTrace(t):t=new Error;const n=t.stack?t.stack.replace(/^.+\n/,""):"";try{e.stack?n&&!String(e.stack).endsWith(n.replace(/^.+\n.+\n/,""))&&(e.stack+="\n"+n):e.stack=n}catch(e){}}throw e}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=je(this.defaults,t);const{transitional:n,paramsSerializer:r,headers:o}=t;void 0!==n&&st.assertOptions(n,{silentJSONParsing:it.transitional(it.boolean),forcedJSONParsing:it.transitional(it.boolean),clarifyTimeoutError:it.transitional(it.boolean)},!1),null!=r&&(J.isFunction(r)?t.paramsSerializer={serialize:r}:st.assertOptions(r,{encode:it.function,serialize:it.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),st.assertOptions(t,{baseUrl:it.spelling("baseURL"),withXsrfToken:it.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let s=o&&J.merge(o.common,o[t.method]);o&&J.forEach(["delete","get","head","post","put","patch","common"],(e=>{delete o[e]})),t.headers=Re.concat(s,o);const i=[];let a=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(a=a&&e.synchronous,i.unshift(e.fulfilled,e.rejected))}));const c=[];let u;this.interceptors.response.forEach((function(e){c.push(e.fulfilled,e.rejected)}));let l,f=0;if(!a){const e=[tt.bind(this),void 0];for(e.unshift.apply(e,i),e.push.apply(e,c),l=e.length,u=Promise.resolve(t);f<l;)u=u.then(e[f++],e[f++]);return u}l=i.length;let d=t;for(f=0;f<l;){const e=i[f++],t=i[f++];try{d=e(d)}catch(e){t.call(this,e);break}}try{u=tt.call(this,d)}catch(e){return Promise.reject(e)}for(f=0,l=c.length;f<l;)u=u.then(c[f++],c[f++]);return u}getUri(e){return oe(xe((e=je(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}};J.forEach(["delete","get","head","options"],(function(e){at.prototype[e]=function(t,n){return this.request(je(n||{},{method:e,url:t,data:(n||{}).data}))}})),J.forEach(["post","put","patch"],(function(e){function t(t){return function(n,r,o){return this.request(je(o||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:n,data:r}))}}at.prototype[e]=t(),at.prototype[e+"Form"]=t(!0)}));const ct={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(ct).forEach((([e,t])=>{ct[t]=e}));const ut=function e(t){const n=new at(t),r=o(at.prototype.request,n);return J.extend(r,at.prototype,n,{allOwnKeys:!0}),J.extend(r,n,null,{allOwnKeys:!0}),r.create=function(n){return e(je(t,n))},r}(me);ut.Axios=at,ut.CanceledError=Te,ut.CancelToken=class e{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise((function(e){t=e}));const n=this;this.promise.then((e=>{if(!n._listeners)return;let t=n._listeners.length;for(;t-- >0;)n._listeners[t](e);n._listeners=null})),this.promise.then=e=>{let t;const r=new Promise((e=>{n.subscribe(e),t=e})).then(e);return r.cancel=function(){n.unsubscribe(t)},r},e((function(e,r,o){n.reason||(n.reason=new Te(e,r,o),t(n.reason))}))}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=t=>{e.abort(t)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let t;return{token:new e((function(e){t=e})),cancel:t}}},ut.isCancel=Oe,ut.VERSION=nt,ut.toFormData=Z,ut.AxiosError=G,ut.Cancel=ut.CanceledError,ut.all=function(e){return Promise.all(e)},ut.spread=function(e){return function(t){return e.apply(null,t)}},ut.isAxiosError=function(e){return J.isObject(e)&&!0===e.isAxiosError},ut.mergeConfig=je,ut.AxiosHeaders=Re,ut.formToJSON=e=>he(J.isHTMLForm(e)?new FormData(e):e),ut.getAdapter=Ze,ut.HttpStatusCode=ct,ut.default=ut;const{Axios:lt,AxiosError:ft,CanceledError:dt,isCancel:pt,CancelToken:ht,VERSION:mt,all:yt,Cancel:bt,isAxiosError:Et,spread:gt,toFormData:wt,AxiosHeaders:Rt,HttpStatusCode:vt,formToJSON:Ot,getAdapter:Tt,mergeConfig:St}=ut;function Ct(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var _t,At;var Nt=Ct(function(){if(At)return _t;At=1;const e=new Set(["ENOTFOUND","ENETUNREACH","UNABLE_TO_GET_ISSUER_CERT","UNABLE_TO_GET_CRL","UNABLE_TO_DECRYPT_CERT_SIGNATURE","UNABLE_TO_DECRYPT_CRL_SIGNATURE","UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY","CERT_SIGNATURE_FAILURE","CRL_SIGNATURE_FAILURE","CERT_NOT_YET_VALID","CERT_HAS_EXPIRED","CRL_NOT_YET_VALID","CRL_HAS_EXPIRED","ERROR_IN_CERT_NOT_BEFORE_FIELD","ERROR_IN_CERT_NOT_AFTER_FIELD","ERROR_IN_CRL_LAST_UPDATE_FIELD","ERROR_IN_CRL_NEXT_UPDATE_FIELD","OUT_OF_MEM","DEPTH_ZERO_SELF_SIGNED_CERT","SELF_SIGNED_CERT_IN_CHAIN","UNABLE_TO_GET_ISSUER_CERT_LOCALLY","UNABLE_TO_VERIFY_LEAF_SIGNATURE","CERT_CHAIN_TOO_LONG","CERT_REVOKED","INVALID_CA","PATH_LENGTH_EXCEEDED","INVALID_PURPOSE","CERT_UNTRUSTED","CERT_REJECTED","HOSTNAME_MISMATCH"]);return _t=t=>!e.has(t&&t.code)}());const Ut="axios-retry";function xt(e){return!e.response&&(!!e.code&&(!["ERR_CANCELED","ECONNABORTED"].includes(e.code)&&Nt(e)))}const Lt=["get","head","options"],jt=Lt.concat(["put","delete"]);function Pt(e){return"ECONNABORTED"!==e.code&&(!e.response||429===e.response.status||e.response.status>=500&&e.response.status<=599)}function Ft(e){return!!e.config?.method&&(Pt(e)&&-1!==jt.indexOf(e.config.method))}function Dt(e){return xt(e)||Ft(e)}function Bt(e=void 0){const t=e?.response?.headers["retry-after"];if(!t)return 0;let n=1e3*(Number(t)||0);return 0===n&&(n=(new Date(t).valueOf()||0)-Date.now()),Math.max(0,n)}function kt(e=0,t=void 0,n=100){const r=2**e*n,o=Math.max(r,Bt(t));return o+.2*o*Math.random()}const It={retries:3,retryCondition:Dt,retryDelay:function(e=0,t=void 0){return Math.max(0,Bt(t))},shouldResetTimeout:!1,onRetry:()=>{},onMaxRetryTimesExceeded:()=>{},validateResponse:null};function qt(e,t,n=!1){const r=function(e,t){return{...It,...t,...e[Ut]}}(e,t||{});return r.retryCount=r.retryCount||0,r.lastRequestTime&&!n||(r.lastRequestTime=Date.now()),e[Ut]=r,r}const Mt=(e,t)=>{const n=e.interceptors.request.use((e=>(qt(e,t,!0),e[Ut]?.validateResponse&&(e.validateStatus=()=>!1),e))),r=e.interceptors.response.use(null,(async n=>{const{config:r}=n;if(!r)return Promise.reject(n);const o=qt(r,t);return n.response&&o.validateResponse?.(n.response)?n.response:await async function(e,t){const{retries:n,retryCondition:r}=e,o=(e.retryCount||0)<n&&r(t);if("object"==typeof o)try{return!1!==await o}catch(e){return!1}return o}(o,n)?async function(e,t,n,r){t.retryCount+=1;const{retryDelay:o,shouldResetTimeout:s,onRetry:i}=t,a=o(t.retryCount,n);if(function(e,t){e.defaults.agent===t.agent&&delete t.agent,e.defaults.httpAgent===t.httpAgent&&delete t.httpAgent,e.defaults.httpsAgent===t.httpsAgent&&delete t.httpsAgent}(e,r),!s&&r.timeout&&t.lastRequestTime){const e=Date.now()-t.lastRequestTime,o=r.timeout-e-a;if(o<=0)return Promise.reject(n);r.timeout=o}return r.transformRequest=[e=>e],await i(t.retryCount,n,r),r.signal?.aborted?Promise.resolve(e(r)):new Promise((t=>{const n=()=>{clearTimeout(o),t(e(r))},o=setTimeout((()=>{t(e(r)),r.signal?.removeEventListener&&r.signal.removeEventListener("abort",n)}),a);r.signal?.addEventListener&&r.signal.addEventListener("abort",n,{once:!0})}))}(e,o,n,r):(await async function(e,t){e.retryCount>=e.retries&&await e.onMaxRetryTimesExceeded(t,e.retryCount)}(o,n),Promise.reject(n))}));return{requestInterceptorId:n,responseInterceptorId:r}};Mt.isNetworkError=xt,Mt.isSafeRequestError=function(e){return!!e.config?.method&&(Pt(e)&&-1!==Lt.indexOf(e.config.method))},Mt.isIdempotentRequestError=Ft,Mt.isNetworkOrIdempotentRequestError=Dt,Mt.exponentialDelay=kt,Mt.linearDelay=function(e=100){return(t=0,n=void 0)=>{const r=t*e;return Math.max(r,Bt(n))}},Mt.isRetryableError=Pt;var zt="undefined"!=typeof process&&null!=process.versions&&null!=process.versions.node,Ht=function(t){function n(e){void 0===e&&(e="Operation aborted");var n=t.call(this,e)||this;return n.name="AbortError",n}return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}(n,t),n}(Error),Vt=function(){function e(e){void 0===e&&(e={}),this.abortController=new AbortController,this.chunkSize=e.chunkSize||5242880,this.client=ut.create(t({maxBodyLength:Number.POSITIVE_INFINITY,maxContentLength:Number.POSITIVE_INFINITY,timeout:6e4,validateStatus:function(e){return e>=200&&e<400||308===e},signal:this.abortController.signal},e.requestConfig)),Mt(this.client,t({retries:5,retryDelay:kt,retryCondition:function(e){var t,n;return Mt.isNetworkError(e)||"ECONNRESET"===e.code||Mt.isRetryableError(e)||429===(null===(t=e.response)||void 0===t?void 0:t.status)||((null===(n=e.response)||void 0===n?void 0:n.status)||0)>=500}},e.retryConfig))}return e.prototype.abort=function(){this.abortController.abort(),this.abortController=new AbortController},e.prototype.deleteUpload=function(e,t){return n(this,void 0,void 0,(function(){var n;return r(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,this.client.delete(e,{signal:t})];case 1:return r.sent(),[3,3];case 2:throw n=r.sent(),this.handleError(n,"Failed to delete upload");case 3:return[2]}}))}))},e.prototype.updateUpload=function(e,t,o){return n(this,void 0,void 0,(function(){var n;return r(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,this.client.patch(e,t,{headers:{"Content-Type":"application/json"},signal:o})];case 1:return r.sent(),[3,3];case 2:throw n=r.sent(),this.handleError(n,"Failed to update metadata");case 3:return[2]}}))}))},e.prototype.createUpload=function(e,t,o){return n(this,void 0,void 0,(function(){var n,s,i,a;return r(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,this.client.post(e,t,{headers:{"X-Upload-Content-Length":t.size,"X-Upload-Content-Type":t.mimeType||"application/octet-stream","Content-Type":"application/json"},signal:o})];case 1:if(!(n=r.sent()).headers.location)throw new Error("Missing Location header in response");return s=null===(a=null==n?void 0:n.headers)||void 0===a?void 0:a.range,[2,{url:new URL(n.headers.location,e).toString(),uploadedBytes:this.parseRangeHeader(s)}];case 2:throw i=r.sent(),this.handleError(i,"Session creation failed");case 3:return[2]}}))}))},e.prototype.createFileUpload=function(e,o,s,i){return n(this,void 0,void 0,(function(){var n,a,c;return r(this,(function(r){switch(r.label){case 0:if(!zt)throw new Error("uploadAsFile is only available in Node.js environment");return[4,import("node:fs/promises")];case 1:return[4,r.sent().stat(e)];case 2:return n=r.sent(),a=n.size,c=t(t({},o),{size:a,lastModified:o.lastModified||n.mtimeMs}),[2,this.createUpload(s,c,i)]}}))}))},e.prototype.fileUpload=function(e,t,o,s,i){return n(this,void 0,void 0,(function(){var n,a,c,u,l;return r(this,(function(r){switch(r.label){case 0:return r.trys.push([0,3,,4]),[4,this.createFileUpload(t,o,e,i)];case 1:return n=r.sent(),a=n.url,c=n.uploadedBytes||0,u=o.size,[4,this.uploadFileInChunks(a,t,c,u,s,i)];case 2:return r.sent(),[3,4];case 3:if((l=r.sent())instanceof Ht)return[2];throw this.handleError(l,"File upload failed for ".concat(t));case 4:return[2]}}))}))},e.prototype.upload=function(e,t,o,s,i){return n(this,void 0,void 0,(function(){var n,a,c,u,l,f;return r(this,(function(r){switch(r.label){case 0:return r.trys.push([0,3,,4]),[4,this.createUpload(e,o,i)];case 1:return n=r.sent(),a=n.url,c=n.uploadedBytes,u=c||0,l=o.size,[4,this.uploadDataInChunks(t,a,u,l,s,i)];case 2:return r.sent(),[3,4];case 3:if((f=r.sent())instanceof Ht)return[2];throw this.handleError(f,"Upload failed");case 4:return[2]}}))}))},e.prototype.resumeUpload=function(e,t,o,s,i){return n(this,void 0,void 0,(function(){var n,a,c,u;return r(this,(function(r){switch(r.label){case 0:return r.trys.push([0,3,,4]),[4,this.getUploadStatus(e,o,i)];case 1:return n=r.sent(),a=n.uploadedBytes,c=o.size,[4,this.uploadDataInChunks(t,e,a,c,s,i)];case 2:return r.sent(),[3,4];case 3:if((u=r.sent())instanceof Ht)return[2];throw this.handleError(u,"Upload failed");case 4:return[2]}}))}))},e.prototype.resumeFileUpload=function(e,t,o,s,i){return n(this,void 0,void 0,(function(){var n,a,c,u;return r(this,(function(r){switch(r.label){case 0:if(!zt)throw new Error("uploadAsFile is only available in Node.js environment");r.label=1;case 1:return r.trys.push([1,4,,5]),[4,this.getUploadStatus(e,o,i)];case 2:return n=r.sent(),a=n.uploadedBytes,c=o.size,[4,this.uploadFileInChunks(e,t,a,c,s,i)];case 3:return r.sent(),[3,5];case 4:if((u=r.sent())instanceof Ht)return[2];throw this.handleError(u,"File upload failed for ".concat(t));case 5:return[2]}}))}))},e.prototype.getUploadStatus=function(e,t,o){return n(this,void 0,void 0,(function(){var n,s,i,a;return r(this,(function(r){switch(r.label){case 0:return n={"Content-Type":"application/octet-stream","Content-Range":"bytes */".concat((null==t?void 0:t.size)||"*")},[4,this.client.put(e,null,{headers:n,signal:o})];case 1:return s=r.sent(),i=null===(a=null==s?void 0:s.headers)||void 0===a?void 0:a.range,[2,{uploadedBytes:this.parseRangeHeader(i)}]}}))}))},e.prototype.uploadChunk=function(e,t,o,s,i,a,c){return n(this,void 0,void 0,(function(){var n,u,l,f;return r(this,(function(r){switch(r.label){case 0:return n={"Content-Type":"application/octet-stream","Content-Range":"bytes ".concat(o,"-").concat(s-1,"/").concat(i)},[4,this.client.put(e,t,{headers:n,signal:c,onUploadProgress:a?function(e){var t=e.loaded,n=(o+t)/i;a(Math.min(n,1))}:void 0})];case 1:return u=r.sent(),l=null===(f=null==u?void 0:u.headers)||void 0===f?void 0:f.range,[2,{uploadedBytes:this.parseRangeHeader(l)}]}}))}))},e.prototype.uploadDataInChunks=function(e,t,o,s,i,a){return n(this,void 0,void 0,(function(){return r(this,(function(n){switch(n.label){case 0:return this.isBlob(e)?[4,this.uploadBlobInChunks(t,e,o,s,i,a)]:[3,2];case 1:return n.sent(),[3,6];case 2:return this.isStream(e)?[4,this.uploadStreamInChunks(t,e,o,s,i,a)]:[3,4];case 3:return n.sent(),[3,6];case 4:return[4,this.uploadBufferInChunks(t,e,o,s,i,a)];case 5:n.sent(),n.label=6;case 6:return[2]}}))}))},e.prototype.uploadFileInChunks=function(e,t,o,s,i,a){return n(this,void 0,void 0,(function(){var n,c,u,l,f,d;return r(this,(function(r){switch(r.label){case 0:if(!zt)throw new Error("uploadAsFile is only available in Node.js environment");return[4,import("node:fs")];case 1:n=r.sent().createReadStream,c=o,r.label=2;case 2:if(!(c<s))return[3,4];if(null==a?void 0:a.aborted)throw new Ht;return u=Math.min(c+this.chunkSize,s),l=n(t,{start:c,end:u}),[4,this.uploadChunk(e,l,c,u,s,i,a)];case 3:return f=r.sent(),c=u,void 0!==f.uploadedBytes&&(d=f.uploadedBytes)>c&&(c=d),[3,2];case 4:return[2]}}))}))},e.prototype.uploadBlobInChunks=function(e,t,o,s,i,a){return n(this,void 0,void 0,(function(){var n,c,u;return r(this,(function(r){switch(r.label){case 0:n=o,r.label=1;case 1:if(!(n<s))return[3,3];if(null==a?void 0:a.aborted)throw new Ht;return c=Math.min(n+this.chunkSize,s),u=t.slice(n,c),[4,this.uploadChunk(e,u,n,c,s,i,a)];case 2:return r.sent(),n=c,[3,1];case 3:return[2]}}))}))},e.prototype.uploadStreamInChunks=function(e,t,o,s,i,a){return n(this,void 0,void 0,(function(){var c,u,l,f=this;return r(this,(function(d){if(!zt)throw new Error("Stream uploads are only available in Node.js environment");return c=o,u=[],l=0,[2,new Promise((function(o,d){var p=function(){d(new Ht)};if(a){if(a.aborted)return void p();a.addEventListener("abort",p)}t.on("data",(function(n){u.push(n),l+=n.length;for(var r=function(){var n=Math.min(c+f.chunkSize,s),r=Buffer.concat(u);u=[r.slice(n-c)],l=r.length-(n-c),t.pause(),f.uploadChunk(e,r.slice(0,n-c),c,n,s,i,a).then((function(e){c=n,t.resume()})).catch((function(e){d(e)}))};l>=f.chunkSize;)r()})),t.on("end",(function(){return n(f,void 0,void 0,(function(){var t,n,f;return r(this,(function(r){switch(r.label){case 0:if(a&&a.removeEventListener("abort",p),!(u.length>0))return[3,4];if(null==a?void 0:a.aborted)return d(new Ht),[2];t=Math.min(c+l,s),n=Buffer.concat(u),r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this.uploadChunk(e,n,c,t,s,i,a)];case 2:return r.sent(),c+=l,[3,4];case 3:return f=r.sent(),d(f),[2];case 4:return o(),[2]}}))}))})),t.on("error",(function(e){a&&a.removeEventListener("abort",p),d(e)}))}))]}))}))},e.prototype.uploadBufferInChunks=function(e,t,o,s,i,a){return n(this,void 0,void 0,(function(){var n,c,u,l;return r(this,(function(r){switch(r.label){case 0:n=t instanceof ArrayBuffer?new Uint8Array(t):t,c=o,r.label=1;case 1:if(!(c<s))return[3,3];if(null==a?void 0:a.aborted)throw new Ht;return u=Math.min(c+this.chunkSize,s),l=n.subarray(c,u),[4,this.uploadChunk(e,l,c,u,s,i,a)];case 2:return r.sent(),c=u,[3,1];case 3:return[2]}}))}))},e.prototype.isBlob=function(e){return"undefined"!=typeof Blob&&e instanceof Blob},e.prototype.isStream=function(e){return!!e&&"function"==typeof e.pipe},e.prototype.parseRangeHeader=function(e){if(!e)retu