UNPKG

axios-useful

Version:

Some expand functions for axios, like retry, cache, etc.

2 lines (1 loc) 48.8 kB
var AxiosUeseful=function(e){"use strict";function t(e){return"string"==typeof e}function n(e){return"number"==typeof e}function r(e){return"boolean"==typeof e}function o(e){return"function"==typeof e}const s=o(Array.isArray)?function(e){return Array.isArray(e)}:function(e){return"[object Array]"===function(e){return Object.prototype.toString.call(e)}(e)};function i(e){return void 0===e}function a(e){return null===e}function c(e){return!i(e)&&!a(e)}function u(e){return i(e)||a(e)}const l=(()=>{let e;return()=>(e||(e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{}),e)})();(()=>{let e;function t(e,t,n){let r;const s=[];return function i(...a){return new.target===i||this instanceof i?i(...n,...a):(r||(s.push(...a),t?r=new(l().Proxy)(new e(...a),{get(e,t){if("constructor"===t)return i;const n=Reflect.get(e,t);return o(n)?n.bind(e):n}}):(r=new e(...a),r.constructor=i)),function(e,t){if(e.length!==t.length||!e.every(((e,n)=>e===t[n])))throw new Error(`Singleton class can not be constructed with different parameters\nExpected: [${[...e]}]\nActual: [${[...t]}]`)}(s,a),r)}}e=c(l().Proxy)?(e,...n)=>{const r=t(e,!0,n),o=new(l().Proxy)(class{},{construct:(e,t)=>r(...n,...t),get:(t,n)=>"prototype"===n?Reflect.get(t,n):Reflect.get(e,n)});return o.prototype.constructor=o,o}:(e,...n)=>{const r=t(e,!1,n),o=class{constructor(...e){return r(...n,...e)}};o.prototype.constructor=o;for(const t of Object.getOwnPropertyNames(e))"prototype"!==t&&"length"!==t&&"name"!==t&&e.hasOwnProperty(t)&&(o[t]=e[t]);return o}})();const f=()=>{};function h(e){return s(e)?e:[e]}function d(e){return e.toUpperCase()}function p(){let e,t;return{promise:new Promise(((n,r)=>{e=n,t=r})),resolve:e,reject:t}}const m=c(l().performance)?()=>l().performance.now():c(Date.now)?()=>Date.now():()=>(new Date).getTime();function y(e,t){const{range:r,maximum:o}=e;if(!n(r)||!n(o))throw new Error("The range and maximum must be a number");if(r<0||o<0)throw new Error("The range and maximum must be a positive number");const s=[];let i=null;return function(n=1,a){i&&clearTimeout(i),i=setTimeout((()=>{s.length=0}),2*r);const c=m();return s.push({time:c,count:n,type:a}),function(t,n){const i=m();for(let e=0;e<s.length;e++){const{time:t,type:o}=s[e];if((!n||n===o)&&i-t<=r){e>=1&&s.splice(0,e);break}}const a=s.reduce(n?(e,t)=>e+(n===t.type?t.count:0):(e,t)=>e+t.count,0);return a>o&&(t&&t(e,a,n),!0)}(t,a)}}const b=(()=>{let e,t=!1;const n=[];function r(){t=!1;const e=n.splice(0);for(const t of e)null==t||t()}if(c(l().process)&&o(l().process.nextTick))e=()=>{l().process.nextTick(r)};else if(o(l().Promise)){const t=l().Promise.resolve();e=()=>{t.then(r)}}else if(o(l().MutationObserver)){let t=1;const n=new(l().MutationObserver)(r),o=document.createTextNode(String(t));n.observe(o,{characterData:!0}),e=()=>{t=(t+1)%2,o.data=String(t)}}else e=o(l().setImmediate)?()=>{l().setImmediate(r)}:()=>{l().setTimeout(r,0)};return function(r,...s){if(!o(r))throw new TypeError("nextTick callback must be a function");n.push((()=>{r(...s)})),t||(t=!0,e())}})();var g,w,E,R,O,T,x,S,v=e=>{throw TypeError(e)},_=(e,t,n)=>t.has(e)||v("Cannot "+n),A=(e,t,n)=>(_(e,t,"read from private field"),n?n.call(e):t.get(e)),C=(e,t,n)=>t.has(e)?v("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),j=(e,t,n,r)=>(_(e,t,"write to private field"),t.set(e,n),n),P=(e,t,n)=>(_(e,t,"access private method"),n),N=(e,t,n,r)=>({set _(n){j(e,t,n)},get _(){return A(e,t,r)}});class U{constructor(e=3){if(C(this,T),C(this,g,0),C(this,w),C(this,E,0),C(this,R,[]),C(this,O,[]),!n(e))throw new Error("`total` must be a number");if(e<=0)throw new Error("`total` must be greater than 0");j(this,w,e)}changeMaxParallelCount(e){j(this,w,e)}add(e,...t){if(!o(e))throw new Error("`task` must be a function");const n=N(this,g)._++,r=[...t],{promise:s,resolve:i,reject:a}=p();return A(this,O).push({task:e,paramaters:r,resolve:i,reject:a,index:n}),s.index=n,s.cancel=()=>{this.cancel(n)},b((()=>{P(this,T,x).call(this)})),s}cancel(e){let t=-1;n(e)?t=A(this,O).findIndex((t=>t.index===e)):o(e)&&(t=A(this,O).findIndex((t=>t.task===e))),t>-1&&(A(this,O).splice(t,1),P(this,T,x).call(this))}isPending(e){return n(e)?A(this,O).some((t=>t.index===e)):A(this,O).some((t=>t.task===e))}onEmpty(e,t=!0){if(!o(e))throw new TypeError("The param pass in must be a function");A(this,R).push({fn:e,once:t})}}function k(e,t){return function(){return e.apply(t,arguments)}}g=new WeakMap,w=new WeakMap,E=new WeakMap,R=new WeakMap,O=new WeakMap,T=new WeakSet,x=function(){if(A(this,E)>=A(this,w))return;if(!A(this,O).length)return void(A(this,E)||P(this,T,S).call(this));N(this,E)._++;const{task:e,paramaters:t,resolve:n,reject:r}=A(this,O).shift();Promise.resolve(e(...t)).then(n).catch(r).finally((()=>{N(this,E)._--,P(this,T,x).call(this)})),P(this,T,x).call(this)},S=function(){const e=A(this,R).slice(0);for(let t=0;t<e.length;t++){const n=e[t],{fn:r,once:o=!0}=n;o&&A(this,R).splice(A(this,R).indexOf(n),1),null==r||r()}};const{toString:F}=Object.prototype,{getPrototypeOf:L}=Object,{iterator:q,toStringTag:D}=Symbol,B=(I=Object.create(null),e=>{const t=F.call(e);return I[t]||(I[t]=t.slice(8,-1).toLowerCase())});var I;const M=e=>(e=e.toLowerCase(),t=>B(t)===e),z=e=>t=>typeof t===e,{isArray:K}=Array,W=z("undefined");function $(e){return null!==e&&!W(e)&&null!==e.constructor&&!W(e.constructor)&&V(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const H=M("ArrayBuffer");const J=z("string"),V=z("function"),G=z("number"),X=e=>null!==e&&"object"==typeof e,Q=e=>{if("object"!==B(e))return!1;const t=L(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||D in e||q in e)},Z=M("Date"),Y=M("File"),ee=M("Blob"),te=M("FileList"),ne=M("URLSearchParams"),[re,oe,se,ie]=["ReadableStream","Request","Response","Headers"].map(M);function ae(e,t,{allOwnKeys:n=!1}={}){if(null==e)return;let r,o;if("object"!=typeof e&&(e=[e]),K(e))for(r=0,o=e.length;r<o;r++)t.call(null,e[r],r,e);else{if($(e))return;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 ce(e,t){if($(e))return null;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 ue="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,le=e=>!W(e)&&e!==ue;const fe=(he="undefined"!=typeof Uint8Array&&L(Uint8Array),e=>he&&e instanceof he);var he;const de=M("HTMLFormElement"),pe=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),me=M("RegExp"),ye=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};ae(n,((n,o)=>{let s;!1!==(s=t(n,o,e))&&(r[o]=s||n)})),Object.defineProperties(e,r)};const be=M("AsyncFunction"),ge=(we="function"==typeof setImmediate,Ee=V(ue.postMessage),we?setImmediate:Ee?(Re=`axios@${Math.random()}`,Oe=[],ue.addEventListener("message",(({source:e,data:t})=>{e===ue&&t===Re&&Oe.length&&Oe.shift()()}),!1),e=>{Oe.push(e),ue.postMessage(Re,"*")}):e=>setTimeout(e));var we,Ee,Re,Oe;const Te="undefined"!=typeof queueMicrotask?queueMicrotask.bind(ue):"undefined"!=typeof process&&process.nextTick||ge;var xe={isArray:K,isArrayBuffer:H,isBuffer:$,isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||V(e.append)&&("formdata"===(t=B(e))||"object"===t&&V(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&H(e.buffer),t},isString:J,isNumber:G,isBoolean:e=>!0===e||!1===e,isObject:X,isPlainObject:Q,isEmptyObject:e=>{if(!X(e)||$(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(t){return!1}},isReadableStream:re,isRequest:oe,isResponse:se,isHeaders:ie,isUndefined:W,isDate:Z,isFile:Y,isBlob:ee,isRegExp:me,isFunction:V,isStream:e=>X(e)&&V(e.pipe),isURLSearchParams:ne,isTypedArray:fe,isFileList:te,forEach:ae,merge:function e(){const{caseless:t}=le(this)&&this||{},n={},r=(r,o)=>{const s=t&&ce(n,o)||o;n[s]=Q(n[s])&&Q(r)?e(n[s],r):Q(r)?e({},r):K(r)?r.slice():r};for(let o=0,s=arguments.length;o<s;o++)arguments[o]&&ae(arguments[o],r);return n},extend:(e,t,n,{allOwnKeys:r}={})=>(ae(t,((t,r)=>{e[r]=n&&V(t)?k(t,n):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,i;const a={};if(t=t||{},null==e)return t;do{for(o=Object.getOwnPropertyNames(e),s=o.length;s-- >0;)i=o[s],r&&!r(i,e,t)||a[i]||(t[i]=e[i],a[i]=!0);e=!1!==n&&L(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},kindOf:B,kindOfTest:M,endsWith:(e,t,n)=>{e=String(e),(void 0===n||n>e.length)&&(n=e.length);const r=e.indexOf(t,n-=t.length);return-1!==r&&r===n},toArray:e=>{if(!e)return null;if(K(e))return e;let t=e.length;if(!G(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},forEachEntry:(e,t)=>{const n=(e&&e[q]).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:de,hasOwnProperty:pe,hasOwnProp:pe,reduceDescriptors:ye,freezeMethods:e=>{ye(e,((t,n)=>{if(V(e)&&-1!==["arguments","caller","callee"].indexOf(n))return!1;V(e[n])&&(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 K(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:ce,global:ue,isContextDefined:le,isSpecCompliantForm:function(e){return!!(e&&V(e.append)&&"FormData"===e[D]&&e[q])},toJSONObject:e=>{const t=new Array(10),n=(e,r)=>{if(X(e)){if(t.indexOf(e)>=0)return;if($(e))return e;if(!("toJSON"in e)){t[r]=e;const o=K(e)?[]:{};return ae(e,((e,t)=>{const s=n(e,r+1);!W(s)&&(o[t]=s)})),t[r]=void 0,o}}return e};return n(e,0)},isAsyncFn:be,isThenable:e=>e&&(X(e)||V(e))&&V(e.then)&&V(e.catch),setImmediate:ge,asap:Te,isIterable:e=>null!=e&&V(e[q])};function Se(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)}xe.inherits(Se,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:xe.toJSONObject(this.config),code:this.code,status:this.status}}});const ve=Se.prototype,_e={};["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=>{_e[e]={value:e}})),Object.defineProperties(Se,_e),Object.defineProperty(ve,"isAxiosError",{value:!0}),Se.from=(e,t,n,r,o,s)=>{const i=Object.create(ve);return xe.toFlatObject(e,i,(function(e){return e!==Error.prototype}),(e=>"isAxiosError"!==e)),Se.call(i,e.message,t,n,r,o),i.cause=e,i.name=e.name,s&&Object.assign(i,s),i};function Ae(e){return xe.isPlainObject(e)||xe.isArray(e)}function Ce(e){return xe.endsWith(e,"[]")?e.slice(0,-2):e}function je(e,t,n){return e?e.concat(t).map((function(e,t){return e=Ce(e),!n&&t?"["+e+"]":e})).join(n?".":""):t}const Pe=xe.toFlatObject(xe,{},null,(function(e){return/^is[A-Z]/.test(e)}));function Ne(e,t,n){if(!xe.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const r=(n=xe.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(e,t){return!xe.isUndefined(t[e])}))).metaTokens,o=n.visitor||u,s=n.dots,i=n.indexes,a=(n.Blob||"undefined"!=typeof Blob&&Blob)&&xe.isSpecCompliantForm(t);if(!xe.isFunction(o))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(xe.isDate(e))return e.toISOString();if(xe.isBoolean(e))return e.toString();if(!a&&xe.isBlob(e))throw new Se("Blob is not supported. Use a Buffer instead.");return xe.isArrayBuffer(e)||xe.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(xe.endsWith(n,"{}"))n=r?n:n.slice(0,-2),e=JSON.stringify(e);else if(xe.isArray(e)&&function(e){return xe.isArray(e)&&!e.some(Ae)}(e)||(xe.isFileList(e)||xe.endsWith(n,"[]"))&&(a=xe.toArray(e)))return n=Ce(n),a.forEach((function(e,r){!xe.isUndefined(e)&&null!==e&&t.append(!0===i?je([n],r,s):null===i?n:n+"[]",c(e))})),!1;return!!Ae(e)||(t.append(je(o,n,s),c(e)),!1)}const l=[],f=Object.assign(Pe,{defaultVisitor:u,convertValue:c,isVisitable:Ae});if(!xe.isObject(e))throw new TypeError("data must be an object");return function e(n,r){if(!xe.isUndefined(n)){if(-1!==l.indexOf(n))throw Error("Circular reference detected in "+r.join("."));l.push(n),xe.forEach(n,(function(n,s){!0===(!(xe.isUndefined(n)||null===n)&&o.call(t,n,xe.isString(s)?s.trim():s,r,f))&&e(n,r?r.concat(s):[s])})),l.pop()}}(e),t}function Ue(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,(function(e){return t[e]}))}function ke(e,t){this._pairs=[],e&&Ne(e,this,t)}const Fe=ke.prototype;function Le(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function qe(e,t,n){if(!t)return e;const r=n&&n.encode||Le;xe.isFunction(n)&&(n={serialize:n});const o=n&&n.serialize;let s;if(s=o?o(t,n):xe.isURLSearchParams(t)?t.toString():new ke(t,n).toString(r),s){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+s}return e}Fe.append=function(e,t){this._pairs.push([e,t])},Fe.toString=function(e){const t=e?function(t){return e.call(this,t,Ue)}:Ue;return this._pairs.map((function(e){return t(e[0])+"="+t(e[1])}),"").join("&")};class De{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){xe.forEach(this.handlers,(function(t){null!==t&&e(t)}))}}var Be={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Ie={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:ke,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]};const Me="undefined"!=typeof window&&"undefined"!=typeof document,ze="object"==typeof navigator&&navigator||void 0,Ke=Me&&(!ze||["ReactNative","NativeScript","NS"].indexOf(ze.product)<0),We="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,$e=Me&&window.location.href||"http://localhost";var He={...Object.freeze({__proto__:null,hasBrowserEnv:Me,hasStandardBrowserEnv:Ke,hasStandardBrowserWebWorkerEnv:We,navigator:ze,origin:$e}),...Ie};function Je(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&&xe.isArray(r)?r.length:s,a)return r[s]=xe.hasOwnProp(r,s)?[r[s],n]:n,!i;r[s]&&xe.isObject(r[s])||(r[s]=[]);return t(e,n,r[s],o)&&xe.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(xe.isFormData(e)&&xe.isFunction(e.entries)){const n={};return xe.forEachEntry(e,((e,r)=>{t(function(e){return xe.matchAll(/\w+|\[(\w*)]/g,e).map((e=>"[]"===e[0]?"":e[1]||e[0]))}(e),r,n,0)})),n}return null}const Ve={transitional:Be,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const n=t.getContentType()||"",r=n.indexOf("application/json")>-1,o=xe.isObject(e);o&&xe.isHTMLForm(e)&&(e=new FormData(e));if(xe.isFormData(e))return r?JSON.stringify(Je(e)):e;if(xe.isArrayBuffer(e)||xe.isBuffer(e)||xe.isStream(e)||xe.isFile(e)||xe.isBlob(e)||xe.isReadableStream(e))return e;if(xe.isArrayBufferView(e))return e.buffer;if(xe.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 Ne(e,new He.classes.URLSearchParams,{visitor:function(e,t,n,r){return He.isNode&&xe.isBuffer(e)?(this.append(t,e.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)},...t})}(e,this.formSerializer).toString();if((s=xe.isFileList(e))||n.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return Ne(s?{"files[]":e}:e,t&&new t,this.formSerializer)}}return o||r?(t.setContentType("application/json",!1),function(e,t,n){if(xe.isString(e))try{return(t||JSON.parse)(e),xe.trim(e)}catch(r){if("SyntaxError"!==r.name)throw r}return(n||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||Ve.transitional,n=t&&t.forcedJSONParsing,r="json"===this.responseType;if(xe.isResponse(e)||xe.isReadableStream(e))return e;if(e&&xe.isString(e)&&(n&&!this.responseType||r)){const n=!(t&&t.silentJSONParsing)&&r;try{return JSON.parse(e)}catch(o){if(n){if("SyntaxError"===o.name)throw Se.from(o,Se.ERR_BAD_RESPONSE,this,null,this.response);throw o}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:He.classes.FormData,Blob:He.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};xe.forEach(["delete","get","head","post","put","patch"],(e=>{Ve.headers[e]={}}));const Ge=xe.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 Xe=Symbol("internals");function Qe(e){return e&&String(e).trim().toLowerCase()}function Ze(e){return!1===e||null==e?e:xe.isArray(e)?e.map(Ze):String(e)}function Ye(e,t,n,r,o){return xe.isFunction(r)?r.call(this,t,n):(o&&(t=n),xe.isString(t)?xe.isString(r)?-1!==t.indexOf(r):xe.isRegExp(r)?r.test(t):void 0:void 0)}let et=class{constructor(e){e&&this.set(e)}set(e,t,n){const r=this;function o(e,t,n){const o=Qe(t);if(!o)throw new Error("header name must be a non-empty string");const s=xe.findKey(r,o);(!s||void 0===r[s]||!0===n||void 0===n&&!1!==r[s])&&(r[s||t]=Ze(e))}const s=(e,t)=>xe.forEach(e,((e,n)=>o(e,n,t)));if(xe.isPlainObject(e)||e instanceof this.constructor)s(e,t);else if(xe.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]&&Ge[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(xe.isObject(e)&&xe.isIterable(e)){let n,r,o={};for(const t of e){if(!xe.isArray(t))throw TypeError("Object iterator must return a key-value pair");o[r=t[0]]=(n=o[r])?xe.isArray(n)?[...n,t[1]]:[n,t[1]]:t[1]}s(o,t)}else null!=e&&o(t,e,n);return this}get(e,t){if(e=Qe(e)){const n=xe.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(xe.isFunction(t))return t.call(this,e,n);if(xe.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=Qe(e)){const n=xe.findKey(this,e);return!(!n||void 0===this[n]||t&&!Ye(0,this[n],n,t))}return!1}delete(e,t){const n=this;let r=!1;function o(e){if(e=Qe(e)){const o=xe.findKey(n,e);!o||t&&!Ye(0,n[o],o,t)||(delete n[o],r=!0)}}return xe.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&&!Ye(0,this[o],o,e,!0)||(delete this[o],r=!0)}return r}normalize(e){const t=this,n={};return xe.forEach(this,((r,o)=>{const s=xe.findKey(n,o);if(s)return t[s]=Ze(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]=Ze(r),n[i]=!0})),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return xe.forEach(this,((n,r)=>{null!=n&&!1!==n&&(t[r]=e&&xe.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")}getSetCookie(){return this.get("set-cookie")||[]}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[Xe]=this[Xe]={accessors:{}}).accessors,n=this.prototype;function r(e){const r=Qe(e);t[r]||(!function(e,t){const n=xe.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 xe.isArray(e)?e.forEach(r):r(e),this}};function tt(e,t){const n=this||Ve,r=t||n,o=et.from(r.headers);let s=r.data;return xe.forEach(e,(function(e){s=e.call(n,s,o.normalize(),t?t.status:void 0)})),o.normalize(),s}function nt(e){return!(!e||!e.__CANCEL__)}function rt(e,t,n){Se.call(this,null==e?"canceled":e,Se.ERR_CANCELED,t,n),this.name="CanceledError"}function ot(e,t,n){const r=n.config.validateStatus;n.status&&r&&!r(n.status)?t(new Se("Request failed with status code "+n.status,[Se.ERR_BAD_REQUEST,Se.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):e(n)}et.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),xe.reduceDescriptors(et.prototype,(({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[n]=e}}})),xe.freezeMethods(et),xe.inherits(rt,Se,{__CANCEL__:!0});const st=(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 h=u&&c-u;return h?Math.round(1e3*f/h):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(...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)},it=(e,t)=>{const n=null!=e;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},at=e=>(...t)=>xe.asap((()=>e(...t)));var ct=He.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,He.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(He.origin),He.navigator&&/(msie|trident)/i.test(He.navigator.userAgent)):()=>!0,ut=He.hasStandardBrowserEnv?{write(e,t,n,r,o,s){const i=[e+"="+encodeURIComponent(t)];xe.isNumber(n)&&i.push("expires="+new Date(n).toGMTString()),xe.isString(r)&&i.push("path="+r),xe.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 lt(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 ft=e=>e instanceof et?{...e}:e;function ht(e,t){t=t||{};const n={};function r(e,t,n,r){return xe.isPlainObject(e)&&xe.isPlainObject(t)?xe.merge.call({caseless:r},e,t):xe.isPlainObject(t)?xe.merge({},t):xe.isArray(t)?t.slice():t}function o(e,t,n,o){return xe.isUndefined(t)?xe.isUndefined(e)?void 0:r(void 0,e,0,o):r(e,t,0,o)}function s(e,t){if(!xe.isUndefined(t))return r(void 0,t)}function i(e,t){return xe.isUndefined(t)?xe.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(ft(e),ft(t),0,!0)};return xe.forEach(Object.keys({...e,...t}),(function(r){const s=c[r]||o,i=s(e[r],t[r],r);xe.isUndefined(i)&&s!==a||(n[r]=i)})),n}var dt=e=>{const t=ht({},e);let n,{data:r,withXSRFToken:o,xsrfHeaderName:s,xsrfCookieName:i,headers:a,auth:c}=t;if(t.headers=a=et.from(a),t.url=qe(lt(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),c&&a.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):""))),xe.isFormData(r))if(He.hasStandardBrowserEnv||He.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(He.hasStandardBrowserEnv&&(o&&xe.isFunction(o)&&(o=o(t)),o||!1!==o&&ct(t.url))){const e=s&&i&&ut.read(i);e&&a.set(s,e)}return t};var pt="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise((function(t,n){const r=dt(e);let o=r.data;const s=et.from(r.headers).normalize();let i,a,c,u,l,{responseType:f,onUploadProgress:h,onDownloadProgress:d}=r;function p(){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=et.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders());ot((function(e){t(e),p()}),(function(e){n(e),p()}),{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 Se("Request aborted",Se.ECONNABORTED,e,m)),m=null)},m.onerror=function(){n(new Se("Network Error",Se.ERR_NETWORK,e,m)),m=null},m.ontimeout=function(){let t=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";r.timeoutErrorMessage&&(t=r.timeoutErrorMessage),n(new Se(t,(r.transitional||Be).clarifyTimeoutError?Se.ETIMEDOUT:Se.ECONNABORTED,e,m)),m=null},void 0===o&&s.setContentType(null),"setRequestHeader"in m&&xe.forEach(s.toJSON(),(function(e,t){m.setRequestHeader(t,e)})),xe.isUndefined(r.withCredentials)||(m.withCredentials=!!r.withCredentials),f&&"json"!==f&&(m.responseType=r.responseType),d&&([c,l]=st(d,!0),m.addEventListener("progress",c)),h&&m.upload&&([a,u]=st(h),m.upload.addEventListener("progress",a),m.upload.addEventListener("loadend",u)),(r.cancelToken||r.signal)&&(i=t=>{m&&(n(!t||t.type?new rt(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===He.protocols.indexOf(b)?n(new Se("Unsupported protocol "+b+":",Se.ERR_BAD_REQUEST,e)):m.send(o||null)}))};const mt=(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 Se?t:new rt(t instanceof Error?t.message:t))}};let s=t&&setTimeout((()=>{s=null,o(new Se(`timeout ${t} of ms exceeded`,Se.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=()=>xe.asap(i),a}},yt=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},bt=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()}},gt=(e,t,n,r)=>{const o=async function*(e,t){for await(const n of bt(e))yield*yt(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();if(n){let e=i+=r.byteLength;n(e)}e.enqueue(new Uint8Array(r))}catch(t){throw a(t),t}},cancel:e=>(a(e),o.return())},{highWaterMark:2})},wt="function"==typeof fetch&&"function"==typeof Request&&"function"==typeof Response,Et=wt&&"function"==typeof ReadableStream,Rt=wt&&("function"==typeof TextEncoder?(Ot=new TextEncoder,e=>Ot.encode(e)):async e=>new Uint8Array(await new Response(e).arrayBuffer()));var Ot;const Tt=(e,...t)=>{try{return!!e(...t)}catch(n){return!1}},xt=Et&&Tt((()=>{let e=!1;const t=new Request(He.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t})),St=Et&&Tt((()=>xe.isReadableStream(new Response("").body))),vt={stream:St&&(e=>e.body)};var _t;wt&&(_t=new Response,["text","arrayBuffer","blob","formData","stream"].forEach((e=>{!vt[e]&&(vt[e]=xe.isFunction(_t[e])?t=>t[e]():(t,n)=>{throw new Se(`Response type '${e}' is not supported`,Se.ERR_NOT_SUPPORT,n)})})));const At=async(e,t)=>{const n=xe.toFiniteNumber(e.getContentLength());return null==n?(async e=>{if(null==e)return 0;if(xe.isBlob(e))return e.size;if(xe.isSpecCompliantForm(e)){const t=new Request(He.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return xe.isArrayBufferView(e)||xe.isArrayBuffer(e)?e.byteLength:(xe.isURLSearchParams(e)&&(e+=""),xe.isString(e)?(await Rt(e)).byteLength:void 0)})(t):n};const Ct={http:null,xhr:pt,fetch:wt&&(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:h}=dt(e);u=u?(u+"").toLowerCase():"text";let d,p=mt([o,s&&s.toAbortSignal()],i);const m=p&&p.unsubscribe&&(()=>{p.unsubscribe()});let y;try{if(c&&xt&&"get"!==n&&"head"!==n&&0!==(y=await At(l,r))){let e,n=new Request(t,{method:"POST",body:r,duplex:"half"});if(xe.isFormData(r)&&(e=n.headers.get("content-type"))&&l.setContentType(e),n.body){const[e,t]=it(y,st(at(c)));r=gt(n.body,65536,e,t)}}xe.isString(f)||(f=f?"include":"omit");const o="credentials"in Request.prototype;d=new Request(t,{...h,signal:p,method:n.toUpperCase(),headers:l.normalize().toJSON(),body:r,duplex:"half",credentials:o?f:void 0});let s=await fetch(d,h);const i=St&&("stream"===u||"response"===u);if(St&&(a||i&&m)){const e={};["status","statusText","headers"].forEach((t=>{e[t]=s[t]}));const t=xe.toFiniteNumber(s.headers.get("content-length")),[n,r]=a&&it(t,st(at(a),!0))||[];s=new Response(gt(s.body,65536,n,(()=>{r&&r(),m&&m()})),e)}u=u||"text";let b=await vt[xe.findKey(vt,u)||"text"](s,e);return!i&&m&&m(),await new Promise(((t,n)=>{ot(t,n,{data:b,headers:et.from(s.headers),status:s.status,statusText:s.statusText,config:e,request:d})}))}catch(b){if(m&&m(),b&&"TypeError"===b.name&&/Load failed|fetch/i.test(b.message))throw Object.assign(new Se("Network Error",Se.ERR_NETWORK,e,d),{cause:b.cause||b});throw Se.from(b,b&&b.code,e,d)}})};xe.forEach(Ct,((e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(n){}Object.defineProperty(e,"adapterName",{value:t})}}));const jt=e=>`- ${e}`,Pt=e=>xe.isFunction(e)||null===e||!1===e;var Nt=e=>{e=xe.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,!Pt(n)&&(r=Ct[(t=String(n)).toLowerCase()],void 0===r))throw new Se(`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 Se("There is no suitable adapter to dispatch the request "+(t?e.length>1?"since :\n"+e.map(jt).join("\n"):" "+jt(e[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return r};function Ut(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new rt(null,e)}function kt(e){Ut(e),e.headers=et.from(e.headers),e.data=tt.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return Nt(e.adapter||Ve.adapter)(e).then((function(t){return Ut(e),t.data=tt.call(e,e.transformResponse,t),t.headers=et.from(t.headers),t}),(function(t){return nt(t)||(Ut(e),t&&t.response&&(t.response.data=tt.call(e,e.transformResponse,t.response),t.response.headers=et.from(t.response.headers))),Promise.reject(t)}))}const Ft="1.11.0",Lt={};["object","boolean","number","function","string","symbol"].forEach(((e,t)=>{Lt[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}}));const qt={};Lt.transitional=function(e,t,n){function r(e,t){return"[Axios v"+Ft+"] Transitional option '"+e+"'"+t+(n?". "+n:"")}return(n,o,s)=>{if(!1===e)throw new Se(r(o," has been removed"+(t?" in "+t:"")),Se.ERR_DEPRECATED);return t&&!qt[o]&&(qt[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)}},Lt.spelling=function(e){return(t,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};var Dt={assertOptions:function(e,t,n){if("object"!=typeof e)throw new Se("options must be an object",Se.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 Se("option "+s+" must be "+n,Se.ERR_BAD_OPTION_VALUE)}else if(!0!==n)throw new Se("Unknown option "+s,Se.ERR_BAD_OPTION)}},validators:Lt};const Bt=Dt.validators;let It=class{constructor(e){this.defaults=e||{},this.interceptors={request:new De,response:new De}}async request(e,t){try{return await this._request(e,t)}catch(n){if(n instanceof Error){let e={};Error.captureStackTrace?Error.captureStackTrace(e):e=new Error;const t=e.stack?e.stack.replace(/^.+\n/,""):"";try{n.stack?t&&!String(n.stack).endsWith(t.replace(/^.+\n.+\n/,""))&&(n.stack+="\n"+t):n.stack=t}catch(r){}}throw n}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=ht(this.defaults,t);const{transitional:n,paramsSerializer:r,headers:o}=t;void 0!==n&&Dt.assertOptions(n,{silentJSONParsing:Bt.transitional(Bt.boolean),forcedJSONParsing:Bt.transitional(Bt.boolean),clarifyTimeoutError:Bt.transitional(Bt.boolean)},!1),null!=r&&(xe.isFunction(r)?t.paramsSerializer={serialize:r}:Dt.assertOptions(r,{encode:Bt.function,serialize:Bt.function},!0)),void 0!==t.allowAbsoluteUrls||(t.allowAbsoluteUrls=void 0===this.defaults.allowAbsoluteUrls||this.defaults.allowAbsoluteUrls),Dt.assertOptions(t,{baseUrl:Bt.spelling("baseURL"),withXsrfToken:Bt.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let s=o&&xe.merge(o.common,o[t.method]);o&&xe.forEach(["delete","get","head","post","put","patch","common"],(e=>{delete o[e]})),t.headers=et.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=[kt.bind(this),void 0];for(e.unshift(...i),e.push(...c),l=e.length,u=Promise.resolve(t);f<l;)u=u.then(e[f++],e[f++]);return u}l=i.length;let h=t;for(f=0;f<l;){const e=i[f++],t=i[f++];try{h=e(h)}catch(d){t.call(this,d);break}}try{u=kt.call(this,h)}catch(d){return Promise.reject(d)}for(f=0,l=c.length;f<l;)u=u.then(c[f++],c[f++]);return u}getUri(e){return qe(lt((e=ht(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}};xe.forEach(["delete","get","head","options"],(function(e){It.prototype[e]=function(t,n){return this.request(ht(n||{},{method:e,url:t,data:(n||{}).data}))}})),xe.forEach(["post","put","patch"],(function(e){function t(t){return function(n,r,o){return this.request(ht(o||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:n,data:r}))}}It.prototype[e]=t(),It.prototype[e+"Form"]=t(!0)}));const Mt={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(Mt).forEach((([e,t])=>{Mt[t]=e}));const zt=function e(t){const n=new It(t),r=k(It.prototype.request,n);return xe.extend(r,It.prototype,n,{allOwnKeys:!0}),xe.extend(r,n,null,{allOwnKeys:!0}),r.create=function(n){return e(ht(t,n))},r}(Ve);zt.Axios=It,zt.CanceledError=rt,zt.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 rt(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}}},zt.isCancel=nt,zt.VERSION=Ft,zt.toFormData=Ne,zt.AxiosError=Se,zt.Cancel=zt.CanceledError,zt.all=function(e){return Promise.all(e)},zt.spread=function(e){return function(t){return e.apply(null,t)}},zt.isAxiosError=function(e){return xe.isObject(e)&&!0===e.isAxiosError},zt.mergeConfig=ht,zt.AxiosHeaders=et,zt.formToJSON=e=>Je(xe.isHTMLForm(e)?new FormData(e):e),zt.getAdapter=Nt,zt.HttpStatusCode=Mt,zt.default=zt;const{AxiosError:Kt}=zt;var Wt,$t;!function(e){e.GET="GET",e.POST="POST",e.PUT="PUT",e.DELETE="DELETE"}(Wt||(Wt={})),function(e){e.NEXT="next",e.PREV="prev",e.QUEUE="queue"}($t||($t={}));class Ht{response;constructor(e){this.response=e}}class Jt{static isResponseCache(e){return e instanceof Ht}_axios;cacheKeys;cache;constructor(e){this._axios=e}request(e){const t=e.cache;if(!t)return;const{time:o}=r(t)?{time:-1}:t;if(!n(o)||0===o)return;this.cache||(this.cache=new Map);const s=this.getCache(e);if(s){const{response:t,timestamp:r}=s;if(!(n(o)&&o>0&&Date.now()-r>o))throw new Ht(t);this.deleteCache(e)}}response(e,t){const{cache:o=!1}=e;if(o&&(this.cache||(this.cache=new Map),!this.hasCache(e))){const{time:s}=r(o)?{time:-1}:o;if(!n(s)||0===s)return;this.setCache(e,t)}}hasCache(e){return this.cache.has(this.cacheKey(e))}getCache(e){if(this.hasCache(e))return this.cache.get(this.cacheKey(e))}setCache(e,t){return this.cache.set(this.cacheKey(e),{response:t,timestamp:Date.now()})}deleteCache(e){return this.cache.delete(this.cacheKey(e))}cacheKey(e){if(this.cacheKeys||(this.cacheKeys=new WeakMap),this.cacheKeys.has(e))return this.cacheKeys.get(e);const{method:t=Wt.GET}=e,n=d(t);if(n!==Wt.GET.toUpperCase())throw new Error("Cache only supported for the `GET` method");const r=`//${n}::${this._axios.getUri(e)}`;return this.cacheKeys.set(e,r),r}}const Vt=l().AbortController?function(e){const t=new AbortController;return e.signal=t.signal,t.abort.bind(t)}:function(e){const t=zt.CancelToken.source();return e.cancelToken=t.token,t.cancel.bind(t)},Gt=[Kt.ECONNABORTED,Kt.ERR_NETWORK,Kt.ETIMEDOUT,"ECONNREFUSED"],Xt=[500,404,502],Qt=[404];function Zt(e){return"object"==typeof(t=e)&&!a(t)&&e.hasOwnProperty("from")&&e.hasOwnProperty("to")&&n(e.from)&&n(e.to);var t}function Yt(e){return e.trim()}function en(e){const r=[];if(n(e)||s(e)&&e.every(n)){const t=h(e).sort(((e,t)=>e-t));r.push(...t.reduce(((e,t)=>{const n=e[e.length-1];return n&&n.to+1===t?(n.to=t,e):(e.push({from:t,to:t}),e)}),[]))}else if(t(e))r.push(...e.split(",").reduce(((e,t)=>{const n=t.split("-").map(Yt).map(Number).slice(0,2);if(isNaN(n[0]))return e;(u(n[1])||isNaN(n[1]))&&(n[1]=n[0]);let[r,o]=n;return r>o&&([r,o]=[o,r]),e.push({from:r,to:o}),e}),[]));else{const t=h(e);if(!t.every(Zt))throw new Error("Invalid retry code range");r.push(...t)}const o=new Map;return e=>{const t=+e;if(o.has(t))return o.get(t);for(const{from:n,to:s}of r)if(n<=t&&t<=s)return o.set(t,!0),!0;return o.set(t,!1),!1}}function tn(e,t,o){const i=o.retry;if(!i)return e(...t,o);const a=r(i)?{}:i,{errorReasons:u=Gt,badResponseCodes:f=Xt,badRequestCodes:d=Qt,domains:p}=a,m=function(e){const t=h(e),n=new Map;return e=>(n.has(e)||n.set(e,t.includes(e)),n.get(e))}(u);let y,b;m(Kt.ERR_BAD_RESPONSE)||(y=en(f)),m(Kt.ERR_BAD_REQUEST)||(b=en(d));const g=n(a.delay)?Math.max(a.delay,0):1e3,w=n(a.count)?Math.max(a.count,1):5;let E,R=!1,O=-1;s(p)&&p.length&&(R=!0,E=[...p||[]]);const T=async(r=0)=>{let s=o;if(R){const e=O++;if(O>=E.length&&(O=-1),e>=0){const t=E[e];s={...o,...c(t)?{baseURL:E[e]}:{}}}}return e(...t,s).catch((e=>zt.isCancel(e)||r>=w?Promise.reject(e):m(e.code)||y&&e.code===Kt.ERR_BAD_RESPONSE&&y(e?.status)||b&&e.code===Kt.ERR_BAD_REQUEST&&b(e?.status)?function(e){if(!n(e))throw new Error("The delay time must be a number");if(e<0)throw new Error("The delay time must be a positive number");return new Promise((t=>{l().setTimeout((async()=>{await void 0,t()}),e)}))}(g).then((()=>T(r+1))):Promise.reject(e)))};return T()}const nn=/^\/*([^\/].*)$/,rn=/^(.*[^\/])\/*$/;class on{_axios;_pipeline;singleTasks;singleNext;singlePrev;constructor(e,t){this._axios=e,this._pipeline=t}request(e,t,n,o){const s=o.single;if(s||u(s)){const{type:i=$t.QUEUE}=r(s)||u(s)?{}:s,a=this.singleKey(n,o);if(i===$t.QUEUE){const{promise:n,resolve:r,reject:s}=p();this.singleTasks||(this.singleTasks=new Map),this.singleTasks.has(a)||(this.singleTasks.set(a,new U(1)),this.singleTasks.get(a).onEmpty((()=>{this.singleTasks.delete(a)})));const i=this.singleTasks.get(a).add((async()=>{await this.send(e,t,o).then(r,s)}));return n.abort=n.cancel=()=>{i.cancel(),o.__abort&&o.__abort()},n}if(i===$t.NEXT){let n=!1;this.singleNext||(this.singleNext=new Map),this.singleNext.has(a)&&this.singleNext.get(a)();const r=this.send(e,t,o);this.singleNext.set(a,(()=>{n=!0,r.abort()}));const{promise:s,resolve:i,reject:c}=p();return s.cancel=r.cancel,s.abort=r.abort,r.then(i).catch((e=>{if(n){return c(new zt.CanceledError("This request has been canceled because of the next request is come."))}c(e)})),r.finally((()=>this.singleNext.delete(a))),s}if(i===$t.PREV){this.singlePrev||(this.singlePrev=new Set);const{promise:n,resolve:r,reject:s}=p();if(this.singlePrev.has(a))n.cancel=n.abort=f,Promise.resolve().then((()=>{s(new zt.CanceledError("This request has been canceled because of the previous request has not been completed."))}));else{this.singlePrev.add(a);const i=this.send(e,t,o);n.cancel=i.cancel,n.abort=i.abort,i.then(r,s),i.finally((()=>this.singlePrev.delete(a)))}return n}throw new Error("Unknown single type")}return this.send(e,t,o)}singleKey(e,t){const{method:n=Wt.GET}=t,r=(this._axios.defaults.baseURL||"").replace(rn,"$1"),o=(e||"").replace(nn,"$1");return`//${d(n)}::${r}/${o}`}send(e,t,n={}){const r=Vt(n);n.__abort=r;const o=this._pipeline.add((async n=>await tn(e,t,n)),n),{promise:s,resolve:i,reject:a}=p();return s.abort=s.cancel=()=>{var e;o.cancel(),r(),e=()=>{a(new zt.CanceledError("Abort request before send"))},Promise.resolve().then((()=>Promise.resolve())).then(e)},o.then(i,a),s}}const sn=["get","delete","head","options"],an=["post","put","patch","postForm","putForm","patchForm"],cn={writable:!1,configurable:!1};class un{static Single=$t;static create(e,n){return t(e)?new un(e,n):new un(e)}_maximum=5;_axios;_pipeline;_frequency=void 0;requestInterceptor;requestInterceptorIndex;responseInterceptorIndex;cacheController;singleController;constructor(e,r){t(e)||(r=e,e=e?.baseURL);const{maximumInOneTime:o=5,limitInOneSecond:s=50}=r||{};this._maximum=n(+o)?Math.max(1,+o||5):5,this._pipeline=new U(this._maximum);const i=+s||0;n(i)&&i>0&&(this._frequency=y({range:1e3,maximum:i},((e,t,n)=>{throw new Error(`The request frequency is over the limit in one second. Current count is ${t} with path '${n}'. \nIt's maybe an infinite loop, and if you want to continue, you can set the \`limitInOneSecond\` to a bigger number or zero.`)})));const a={...r};delete a.maximumInOneTime,this._axios=zt.create({...a,baseURL:e}),this.cacheController=new Jt(this._axios),this.singleController=new on(this._axios,this._pipeline),this.requestInterceptor=Object.freeze({onFulfilled:e=>(this.cacheController.request(e),e),onRejected:e=>Promise.reject(e)}),this.requestInterceptorIndex=this._axios.interceptors.request.use(this.requestInterceptor.onFulfilled,this.requestInterceptor.onRejected),this.responseInterceptorIndex=this._axios.interceptors.response.use((e=>(this.cacheController.response(e.config,e),e)),(async e=>Jt.isResponseCache(e)?Promise.resolve(e.response):Promise.reject(e))),sn.forEach((e=>{const t=this._axios[e].bind(this._axios);Object.defineProperty(this,e,{...cn,value:(e,n)=>this.proxy(t,[e],e,n)})})),an.forEach((e=>{const t=this._axios[e].bind(this._axios);Object.defineProperty(this,e,{...cn,value:(e,n,r)=>this.proxy(t,[e,n],e,r)})}))}get defaults(){return this._axios.defaults}get axios(){return this._axios}get Axios(){return zt}_interceptors;get interceptors(){if(this._interceptors)return this._interceptors;this._interceptors=Object.create(null);const e=this._axios.interceptors.request,t=this._axios.interceptors.response;return Object.defineProperty(this._interceptors,"request",{...cn,value:Object.freeze({use:(...t)=>{e.eject(this.requestInterceptorIndex);const n=e.use(...t);return this.requestInterceptorIndex=e.use(this.requestInterceptor.onFulfilled,this.requestInterceptor.onRejected),n},eject:t=>{if(t!==this.requestInterceptorIndex)return e.eject(t)},clear:()=>e.clear()})}),Object.defineProperty(this._interceptors,"response",{...cn,value:Object.freeze({use:(...e)=>t.use(...e),eject:e=>{if(e!==this.responseInterceptorIndex)return t.eject(e)},clear:()=>t.clear()})}),this._interceptors}maximum(e){this._pipeline.changeMaxParallelCount(Math.max(1,+e||5))}getUri(e){return this._axios.getUri(e)}proxy(e,t,n,r={}){return this._frequency&&this._frequency(1,n),this.singleController.request(e,t,n,{...r})}}let ln;[...sn,...an].forEach((e=>{Object.defineProperty(un,e,{...cn,value:(...t)=>(ln||(ln=new un("")),ln[e](...t))})}));const fn=un,hn=zt;return e.APIRequest=fn,e.AxiosRequest=fn,e.axios=hn,e}({});