UNPKG

axios-simple-cache-adapter

Version:

Configurable cache adapter for axios, works in the browser and node

6 lines (5 loc) 36.6 kB
"use strict";var rt=Object.defineProperty;var st=(e,t,n)=>t in e?rt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var ye=(e,t,n)=>(st(e,typeof t!="symbol"?t+"":t,n),n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function _e(e,t){return function(){return e.apply(t,arguments)}}const{toString:ot}=Object.prototype,{getPrototypeOf:ie}=Object,q=(e=>t=>{const n=ot.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),x=e=>(e=e.toLowerCase(),t=>q(t)===e),$=e=>t=>typeof t===e,{isArray:F}=Array,L=$("undefined");function it(e){return e!==null&&!L(e)&&e.constructor!==null&&!L(e.constructor)&&O(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Fe=x("ArrayBuffer");function at(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&Fe(e.buffer),t}const ct=$("string"),O=$("function"),je=$("number"),z=e=>e!==null&&typeof e=="object",ut=e=>e===!0||e===!1,U=e=>{if(q(e)!=="object")return!1;const t=ie(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},lt=x("Date"),ft=x("File"),dt=x("Blob"),pt=x("FileList"),ht=e=>z(e)&&O(e.pipe),mt=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||O(e.append)&&((t=q(e))==="formdata"||t==="object"&&O(e.toString)&&e.toString()==="[object FormData]"))},yt=x("URLSearchParams"),bt=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function k(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let r,s;if(typeof e!="object"&&(e=[e]),F(e))for(r=0,s=e.length;r<s;r++)t.call(null,e[r],r,e);else{const o=n?Object.getOwnPropertyNames(e):Object.keys(e),i=o.length;let c;for(r=0;r<i;r++)c=o[r],t.call(null,e[c],c,e)}}function Le(e,t){t=t.toLowerCase();const n=Object.keys(e);let r=n.length,s;for(;r-- >0;)if(s=n[r],t===s.toLowerCase())return s;return null}const De=(()=>typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global)(),ke=e=>!L(e)&&e!==De;function te(){const{caseless:e}=ke(this)&&this||{},t={},n=(r,s)=>{const o=e&&Le(t,s)||s;U(t[o])&&U(r)?t[o]=te(t[o],r):U(r)?t[o]=te({},r):F(r)?t[o]=r.slice():t[o]=r};for(let r=0,s=arguments.length;r<s;r++)arguments[r]&&k(arguments[r],n);return t}const wt=(e,t,n,{allOwnKeys:r}={})=>(k(t,(s,o)=>{n&&O(s)?e[o]=_e(s,n):e[o]=s},{allOwnKeys:r}),e),Et=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),St=(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)},gt=(e,t,n,r)=>{let s,o,i;const c={};if(t=t||{},e==null)return t;do{for(s=Object.getOwnPropertyNames(e),o=s.length;o-- >0;)i=s[o],(!r||r(i,e,t))&&!c[i]&&(t[i]=e[i],c[i]=!0);e=n!==!1&&ie(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},Ot=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return r!==-1&&r===n},Rt=e=>{if(!e)return null;if(F(e))return e;let t=e.length;if(!je(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},At=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&ie(Uint8Array)),xt=(e,t)=>{const r=(e&&e[Symbol.iterator]).call(e);let s;for(;(s=r.next())&&!s.done;){const o=s.value;t.call(e,o[0],o[1])}},Tt=(e,t)=>{let n;const r=[];for(;(n=e.exec(t))!==null;)r.push(n);return r},Nt=x("HTMLFormElement"),Ct=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,s){return r.toUpperCase()+s}),be=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),Pt=x("RegExp"),Be=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};k(n,(s,o)=>{let i;(i=t(s,o,e))!==!1&&(r[o]=i||s)}),Object.defineProperties(e,r)},_t=e=>{Be(e,(t,n)=>{if(O(e)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=e[n];if(O(r)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},Ft=(e,t)=>{const n={},r=s=>{s.forEach(o=>{n[o]=!0})};return F(e)?r(e):r(String(e).split(t)),n},jt=()=>{},Lt=(e,t)=>(e=+e,Number.isFinite(e)?e:t),G="abcdefghijklmnopqrstuvwxyz",we="0123456789",Ue={DIGIT:we,ALPHA:G,ALPHA_DIGIT:G+G.toUpperCase()+we},Dt=(e=16,t=Ue.ALPHA_DIGIT)=>{let n="";const{length:r}=t;for(;e--;)n+=t[Math.random()*r|0];return n};function kt(e){return!!(e&&O(e.append)&&e[Symbol.toStringTag]==="FormData"&&e[Symbol.iterator])}const Bt=e=>{const t=new Array(10),n=(r,s)=>{if(z(r)){if(t.indexOf(r)>=0)return;if(!("toJSON"in r)){t[s]=r;const o=F(r)?[]:{};return k(r,(i,c)=>{const f=n(i,s+1);!L(f)&&(o[c]=f)}),t[s]=void 0,o}}return r};return n(e,0)},Ut=x("AsyncFunction"),vt=e=>e&&(z(e)||O(e))&&O(e.then)&&O(e.catch),a={isArray:F,isArrayBuffer:Fe,isBuffer:it,isFormData:mt,isArrayBufferView:at,isString:ct,isNumber:je,isBoolean:ut,isObject:z,isPlainObject:U,isUndefined:L,isDate:lt,isFile:ft,isBlob:dt,isRegExp:Pt,isFunction:O,isStream:ht,isURLSearchParams:yt,isTypedArray:At,isFileList:pt,forEach:k,merge:te,extend:wt,trim:bt,stripBOM:Et,inherits:St,toFlatObject:gt,kindOf:q,kindOfTest:x,endsWith:Ot,toArray:Rt,forEachEntry:xt,matchAll:Tt,isHTMLForm:Nt,hasOwnProperty:be,hasOwnProp:be,reduceDescriptors:Be,freezeMethods:_t,toObjectSet:Ft,toCamelCase:Ct,noop:jt,toFiniteNumber:Lt,findKey:Le,global:De,isContextDefined:ke,ALPHABET:Ue,generateString:Dt,isSpecCompliantForm:kt,toJSONObject:Bt,isAsyncFn:Ut,isThenable:vt};function y(e,t,n,r,s){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),s&&(this.response=s)}a.inherits(y,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:a.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const ve=y.prototype,Ie={};["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=>{Ie[e]={value:e}});Object.defineProperties(y,Ie);Object.defineProperty(ve,"isAxiosError",{value:!0});y.from=(e,t,n,r,s,o)=>{const i=Object.create(ve);return a.toFlatObject(e,i,function(f){return f!==Error.prototype},c=>c!=="isAxiosError"),y.call(i,e.message,t,n,r,s),i.cause=e,i.name=e.name,o&&Object.assign(i,o),i};const It=null;function ne(e){return a.isPlainObject(e)||a.isArray(e)}function He(e){return a.endsWith(e,"[]")?e.slice(0,-2):e}function Ee(e,t,n){return e?e.concat(t).map(function(s,o){return s=He(s),!n&&o?"["+s+"]":s}).join(n?".":""):t}function Ht(e){return a.isArray(e)&&!e.some(ne)}const Mt=a.toFlatObject(a,{},null,function(t){return/^is[A-Z]/.test(t)});function J(e,t,n){if(!a.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=a.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(m,w){return!a.isUndefined(w[m])});const r=n.metaTokens,s=n.visitor||u,o=n.dots,i=n.indexes,f=(n.Blob||typeof Blob<"u"&&Blob)&&a.isSpecCompliantForm(t);if(!a.isFunction(s))throw new TypeError("visitor must be a function");function p(l){if(l===null)return"";if(a.isDate(l))return l.toISOString();if(!f&&a.isBlob(l))throw new y("Blob is not supported. Use a Buffer instead.");return a.isArrayBuffer(l)||a.isTypedArray(l)?f&&typeof Blob=="function"?new Blob([l]):Buffer.from(l):l}function u(l,m,w){let S=l;if(l&&!w&&typeof l=="object"){if(a.endsWith(m,"{}"))m=r?m:m.slice(0,-2),l=JSON.stringify(l);else if(a.isArray(l)&&Ht(l)||(a.isFileList(l)||a.endsWith(m,"[]"))&&(S=a.toArray(l)))return m=He(m),S.forEach(function(R,C){!(a.isUndefined(R)||R===null)&&t.append(i===!0?Ee([m],C,o):i===null?m:m+"[]",p(R))}),!1}return ne(l)?!0:(t.append(Ee(w,m,o),p(l)),!1)}const d=[],h=Object.assign(Mt,{defaultVisitor:u,convertValue:p,isVisitable:ne});function b(l,m){if(!a.isUndefined(l)){if(d.indexOf(l)!==-1)throw Error("Circular reference detected in "+m.join("."));d.push(l),a.forEach(l,function(S,g){(!(a.isUndefined(S)||S===null)&&s.call(t,S,a.isString(g)?g.trim():g,m,h))===!0&&b(S,m?m.concat(g):[g])}),d.pop()}}if(!a.isObject(e))throw new TypeError("data must be an object");return b(e),t}function Se(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(r){return t[r]})}function ae(e,t){this._pairs=[],e&&J(e,this,t)}const Me=ae.prototype;Me.append=function(t,n){this._pairs.push([t,n])};Me.toString=function(t){const n=t?function(r){return t.call(this,r,Se)}:Se;return this._pairs.map(function(s){return n(s[0])+"="+n(s[1])},"").join("&")};function qt(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||qt,s=n&&n.serialize;let o;if(s?o=s(t,n):o=a.isURLSearchParams(t)?t.toString():new ae(t,n).toString(r),o){const i=e.indexOf("#");i!==-1&&(e=e.slice(0,i)),e+=(e.indexOf("?")===-1?"?":"&")+o}return e}class $t{constructor(){this.handlers=[]}use(t,n,r){return this.handlers.push({fulfilled:t,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){a.forEach(this.handlers,function(r){r!==null&&t(r)})}}const ge=$t,$e={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},zt=typeof URLSearchParams<"u"?URLSearchParams:ae,Jt=typeof FormData<"u"?FormData:null,Vt=typeof Blob<"u"?Blob:null,Kt=(()=>{let e;return typeof navigator<"u"&&((e=navigator.product)==="ReactNative"||e==="NativeScript"||e==="NS")?!1:typeof window<"u"&&typeof document<"u"})(),Wt=(()=>typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function")(),A={isBrowser:!0,classes:{URLSearchParams:zt,FormData:Jt,Blob:Vt},isStandardBrowserEnv:Kt,isStandardBrowserWebWorkerEnv:Wt,protocols:["http","https","file","blob","url","data"]};function Gt(e,t){return J(e,new A.classes.URLSearchParams,Object.assign({visitor:function(n,r,s,o){return A.isNode&&a.isBuffer(n)?(this.append(r,n.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)}},t))}function Xt(e){return a.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function Qt(e){const t={},n=Object.keys(e);let r;const s=n.length;let o;for(r=0;r<s;r++)o=n[r],t[o]=e[o];return t}function ze(e){function t(n,r,s,o){let i=n[o++];const c=Number.isFinite(+i),f=o>=n.length;return i=!i&&a.isArray(s)?s.length:i,f?(a.hasOwnProp(s,i)?s[i]=[s[i],r]:s[i]=r,!c):((!s[i]||!a.isObject(s[i]))&&(s[i]=[]),t(n,r,s[i],o)&&a.isArray(s[i])&&(s[i]=Qt(s[i])),!c)}if(a.isFormData(e)&&a.isFunction(e.entries)){const n={};return a.forEachEntry(e,(r,s)=>{t(Xt(r),s,n,0)}),n}return null}function Zt(e,t,n){if(a.isString(e))try{return(t||JSON.parse)(e),a.trim(e)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(e)}const ce={transitional:$e,adapter:["xhr","http"],transformRequest:[function(t,n){const r=n.getContentType()||"",s=r.indexOf("application/json")>-1,o=a.isObject(t);if(o&&a.isHTMLForm(t)&&(t=new FormData(t)),a.isFormData(t))return s&&s?JSON.stringify(ze(t)):t;if(a.isArrayBuffer(t)||a.isBuffer(t)||a.isStream(t)||a.isFile(t)||a.isBlob(t))return t;if(a.isArrayBufferView(t))return t.buffer;if(a.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let c;if(o){if(r.indexOf("application/x-www-form-urlencoded")>-1)return Gt(t,this.formSerializer).toString();if((c=a.isFileList(t))||r.indexOf("multipart/form-data")>-1){const f=this.env&&this.env.FormData;return J(c?{"files[]":t}:t,f&&new f,this.formSerializer)}}return o||s?(n.setContentType("application/json",!1),Zt(t)):t}],transformResponse:[function(t){const n=this.transitional||ce.transitional,r=n&&n.forcedJSONParsing,s=this.responseType==="json";if(t&&a.isString(t)&&(r&&!this.responseType||s)){const i=!(n&&n.silentJSONParsing)&&s;try{return JSON.parse(t)}catch(c){if(i)throw c.name==="SyntaxError"?y.from(c,y.ERR_BAD_RESPONSE,this,null,this.response):c}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:A.classes.FormData,Blob:A.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};a.forEach(["delete","get","head","post","put","patch"],e=>{ce.headers[e]={}});const ue=ce,Yt=a.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"]),en=e=>{const t={};let n,r,s;return e&&e.split(` `).forEach(function(i){s=i.indexOf(":"),n=i.substring(0,s).trim().toLowerCase(),r=i.substring(s+1).trim(),!(!n||t[n]&&Yt[n])&&(n==="set-cookie"?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t},Oe=Symbol("internals");function j(e){return e&&String(e).trim().toLowerCase()}function v(e){return e===!1||e==null?e:a.isArray(e)?e.map(v):String(e)}function tn(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}const nn=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function X(e,t,n,r,s){if(a.isFunction(r))return r.call(this,t,n);if(s&&(t=n),!!a.isString(t)){if(a.isString(r))return t.indexOf(r)!==-1;if(a.isRegExp(r))return r.test(t)}}function rn(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,r)=>n.toUpperCase()+r)}function sn(e,t){const n=a.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(s,o,i){return this[r].call(this,t,s,o,i)},configurable:!0})})}let V=class{constructor(t){t&&this.set(t)}set(t,n,r){const s=this;function o(c,f,p){const u=j(f);if(!u)throw new Error("header name must be a non-empty string");const d=a.findKey(s,u);(!d||s[d]===void 0||p===!0||p===void 0&&s[d]!==!1)&&(s[d||f]=v(c))}const i=(c,f)=>a.forEach(c,(p,u)=>o(p,u,f));return a.isPlainObject(t)||t instanceof this.constructor?i(t,n):a.isString(t)&&(t=t.trim())&&!nn(t)?i(en(t),n):t!=null&&o(n,t,r),this}get(t,n){if(t=j(t),t){const r=a.findKey(this,t);if(r){const s=this[r];if(!n)return s;if(n===!0)return tn(s);if(a.isFunction(n))return n.call(this,s,r);if(a.isRegExp(n))return n.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,n){if(t=j(t),t){const r=a.findKey(this,t);return!!(r&&this[r]!==void 0&&(!n||X(this,this[r],r,n)))}return!1}delete(t,n){const r=this;let s=!1;function o(i){if(i=j(i),i){const c=a.findKey(r,i);c&&(!n||X(r,r[c],c,n))&&(delete r[c],s=!0)}}return a.isArray(t)?t.forEach(o):o(t),s}clear(t){const n=Object.keys(this);let r=n.length,s=!1;for(;r--;){const o=n[r];(!t||X(this,this[o],o,t,!0))&&(delete this[o],s=!0)}return s}normalize(t){const n=this,r={};return a.forEach(this,(s,o)=>{const i=a.findKey(r,o);if(i){n[i]=v(s),delete n[o];return}const c=t?rn(o):String(o).trim();c!==o&&delete n[o],n[c]=v(s),r[c]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const n=Object.create(null);return a.forEach(this,(r,s)=>{r!=null&&r!==!1&&(n[s]=t&&a.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,n])=>t+": "+n).join(` `)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const r=new this(t);return n.forEach(s=>r.set(s)),r}static accessor(t){const r=(this[Oe]=this[Oe]={accessors:{}}).accessors,s=this.prototype;function o(i){const c=j(i);r[c]||(sn(s,i),r[c]=!0)}return a.isArray(t)?t.forEach(o):o(t),this}};V.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);a.reduceDescriptors(V.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}});a.freezeMethods(V);const T=V;function Q(e,t){const n=this||ue,r=t||n,s=T.from(r.headers);let o=r.data;return a.forEach(e,function(c){o=c.call(n,o,s.normalize(),t?t.status:void 0)}),s.normalize(),o}function Je(e){return!!(e&&e.__CANCEL__)}function B(e,t,n){y.call(this,e??"canceled",y.ERR_CANCELED,t,n),this.name="CanceledError"}a.inherits(B,y,{__CANCEL__:!0});function on(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new y("Request failed with status code "+n.status,[y.ERR_BAD_REQUEST,y.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}const an=A.isStandardBrowserEnv?function(){return{write:function(n,r,s,o,i,c){const f=[];f.push(n+"="+encodeURIComponent(r)),a.isNumber(s)&&f.push("expires="+new Date(s).toGMTString()),a.isString(o)&&f.push("path="+o),a.isString(i)&&f.push("domain="+i),c===!0&&f.push("secure"),document.cookie=f.join("; ")},read:function(n){const r=document.cookie.match(new RegExp("(^|;\\s*)("+n+")=([^;]*)"));return r?decodeURIComponent(r[3]):null},remove:function(n){this.write(n,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}();function cn(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function un(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}function Ve(e,t){return e&&!cn(t)?un(e,t):t}const ln=A.isStandardBrowserEnv?function(){const t=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");let r;function s(o){let i=o;return t&&(n.setAttribute("href",i),i=n.href),n.setAttribute("href",i),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:n.pathname.charAt(0)==="/"?n.pathname:"/"+n.pathname}}return r=s(window.location.href),function(i){const c=a.isString(i)?s(i):i;return c.protocol===r.protocol&&c.host===r.host}}():function(){return function(){return!0}}();function fn(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function dn(e,t){e=e||10;const n=new Array(e),r=new Array(e);let s=0,o=0,i;return t=t!==void 0?t:1e3,function(f){const p=Date.now(),u=r[o];i||(i=p),n[s]=f,r[s]=p;let d=o,h=0;for(;d!==s;)h+=n[d++],d=d%e;if(s=(s+1)%e,s===o&&(o=(o+1)%e),p-i<t)return;const b=u&&p-u;return b?Math.round(h*1e3/b):void 0}}function Re(e,t){let n=0;const r=dn(50,250);return s=>{const o=s.loaded,i=s.lengthComputable?s.total:void 0,c=o-n,f=r(c),p=o<=i;n=o;const u={loaded:o,total:i,progress:i?o/i:void 0,bytes:c,rate:f||void 0,estimated:f&&i&&p?(i-o)/f:void 0,event:s};u[t?"download":"upload"]=!0,e(u)}}const pn=typeof XMLHttpRequest<"u",hn=pn&&function(e){return new Promise(function(n,r){let s=e.data;const o=T.from(e.headers).normalize(),i=e.responseType;let c;function f(){e.cancelToken&&e.cancelToken.unsubscribe(c),e.signal&&e.signal.removeEventListener("abort",c)}let p;a.isFormData(s)&&(A.isStandardBrowserEnv||A.isStandardBrowserWebWorkerEnv?o.setContentType(!1):o.getContentType(/^\s*multipart\/form-data/)?a.isString(p=o.getContentType())&&o.setContentType(p.replace(/^\s*(multipart\/form-data);+/,"$1")):o.setContentType("multipart/form-data"));let u=new XMLHttpRequest;if(e.auth){const l=e.auth.username||"",m=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";o.set("Authorization","Basic "+btoa(l+":"+m))}const d=Ve(e.baseURL,e.url);u.open(e.method.toUpperCase(),qe(d,e.params,e.paramsSerializer),!0),u.timeout=e.timeout;function h(){if(!u)return;const l=T.from("getAllResponseHeaders"in u&&u.getAllResponseHeaders()),w={data:!i||i==="text"||i==="json"?u.responseText:u.response,status:u.status,statusText:u.statusText,headers:l,config:e,request:u};on(function(g){n(g),f()},function(g){r(g),f()},w),u=null}if("onloadend"in u?u.onloadend=h:u.onreadystatechange=function(){!u||u.readyState!==4||u.status===0&&!(u.responseURL&&u.responseURL.indexOf("file:")===0)||setTimeout(h)},u.onabort=function(){u&&(r(new y("Request aborted",y.ECONNABORTED,e,u)),u=null)},u.onerror=function(){r(new y("Network Error",y.ERR_NETWORK,e,u)),u=null},u.ontimeout=function(){let m=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded";const w=e.transitional||$e;e.timeoutErrorMessage&&(m=e.timeoutErrorMessage),r(new y(m,w.clarifyTimeoutError?y.ETIMEDOUT:y.ECONNABORTED,e,u)),u=null},A.isStandardBrowserEnv){const l=(e.withCredentials||ln(d))&&e.xsrfCookieName&&an.read(e.xsrfCookieName);l&&o.set(e.xsrfHeaderName,l)}s===void 0&&o.setContentType(null),"setRequestHeader"in u&&a.forEach(o.toJSON(),function(m,w){u.setRequestHeader(w,m)}),a.isUndefined(e.withCredentials)||(u.withCredentials=!!e.withCredentials),i&&i!=="json"&&(u.responseType=e.responseType),typeof e.onDownloadProgress=="function"&&u.addEventListener("progress",Re(e.onDownloadProgress,!0)),typeof e.onUploadProgress=="function"&&u.upload&&u.upload.addEventListener("progress",Re(e.onUploadProgress)),(e.cancelToken||e.signal)&&(c=l=>{u&&(r(!l||l.type?new B(null,e,u):l),u.abort(),u=null)},e.cancelToken&&e.cancelToken.subscribe(c),e.signal&&(e.signal.aborted?c():e.signal.addEventListener("abort",c)));const b=fn(d);if(b&&A.protocols.indexOf(b)===-1){r(new y("Unsupported protocol "+b+":",y.ERR_BAD_REQUEST,e));return}u.send(s||null)})},re={http:It,xhr:hn};a.forEach(re,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const Ae=e=>`- ${e}`,mn=e=>a.isFunction(e)||e===null||e===!1,Ke={getAdapter:e=>{e=a.isArray(e)?e:[e];const{length:t}=e;let n,r;const s={};for(let o=0;o<t;o++){n=e[o];let i;if(r=n,!mn(n)&&(r=re[(i=String(n)).toLowerCase()],r===void 0))throw new y(`Unknown adapter '${i}'`);if(r)break;s[i||"#"+o]=r}if(!r){const o=Object.entries(s).map(([c,f])=>`adapter ${c} `+(f===!1?"is not supported by the environment":"is not available in the build"));let i=t?o.length>1?`since : `+o.map(Ae).join(` `):" "+Ae(o[0]):"as no adapter specified";throw new y("There is no suitable adapter to dispatch the request "+i,"ERR_NOT_SUPPORT")}return r},adapters:re};function Z(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new B(null,e)}function xe(e){return Z(e),e.headers=T.from(e.headers),e.data=Q.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),Ke.getAdapter(e.adapter||ue.adapter)(e).then(function(r){return Z(e),r.data=Q.call(e,e.transformResponse,r),r.headers=T.from(r.headers),r},function(r){return Je(r)||(Z(e),r&&r.response&&(r.response.data=Q.call(e,e.transformResponse,r.response),r.response.headers=T.from(r.response.headers))),Promise.reject(r)})}const Te=e=>e instanceof T?e.toJSON():e;function _(e,t){t=t||{};const n={};function r(p,u,d){return a.isPlainObject(p)&&a.isPlainObject(u)?a.merge.call({caseless:d},p,u):a.isPlainObject(u)?a.merge({},u):a.isArray(u)?u.slice():u}function s(p,u,d){if(a.isUndefined(u)){if(!a.isUndefined(p))return r(void 0,p,d)}else return r(p,u,d)}function o(p,u){if(!a.isUndefined(u))return r(void 0,u)}function i(p,u){if(a.isUndefined(u)){if(!a.isUndefined(p))return r(void 0,p)}else return r(void 0,u)}function c(p,u,d){if(d in t)return r(p,u);if(d in e)return r(void 0,p)}const f={url:o,method:o,data:o,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials: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:c,headers:(p,u)=>s(Te(p),Te(u),!0)};return a.forEach(Object.keys(Object.assign({},e,t)),function(u){const d=f[u]||s,h=d(e[u],t[u],u);a.isUndefined(h)&&d!==c||(n[u]=h)}),n}const We="1.5.1",le={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{le[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const Ne={};le.transitional=function(t,n,r){function s(o,i){return"[Axios v"+We+"] Transitional option '"+o+"'"+i+(r?". "+r:"")}return(o,i,c)=>{if(t===!1)throw new y(s(i," has been removed"+(n?" in "+n:"")),y.ERR_DEPRECATED);return n&&!Ne[i]&&(Ne[i]=!0,console.warn(s(i," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(o,i,c):!0}};function yn(e,t,n){if(typeof e!="object")throw new y("options must be an object",y.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let s=r.length;for(;s-- >0;){const o=r[s],i=t[o];if(i){const c=e[o],f=c===void 0||i(c,o,e);if(f!==!0)throw new y("option "+o+" must be "+f,y.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new y("Unknown option "+o,y.ERR_BAD_OPTION)}}const se={assertOptions:yn,validators:le},N=se.validators;let H=class{constructor(t){this.defaults=t,this.interceptors={request:new ge,response:new ge}}request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=_(this.defaults,n);const{transitional:r,paramsSerializer:s,headers:o}=n;r!==void 0&&se.assertOptions(r,{silentJSONParsing:N.transitional(N.boolean),forcedJSONParsing:N.transitional(N.boolean),clarifyTimeoutError:N.transitional(N.boolean)},!1),s!=null&&(a.isFunction(s)?n.paramsSerializer={serialize:s}:se.assertOptions(s,{encode:N.function,serialize:N.function},!0)),n.method=(n.method||this.defaults.method||"get").toLowerCase();let i=o&&a.merge(o.common,o[n.method]);o&&a.forEach(["delete","get","head","post","put","patch","common"],l=>{delete o[l]}),n.headers=T.concat(i,o);const c=[];let f=!0;this.interceptors.request.forEach(function(m){typeof m.runWhen=="function"&&m.runWhen(n)===!1||(f=f&&m.synchronous,c.unshift(m.fulfilled,m.rejected))});const p=[];this.interceptors.response.forEach(function(m){p.push(m.fulfilled,m.rejected)});let u,d=0,h;if(!f){const l=[xe.bind(this),void 0];for(l.unshift.apply(l,c),l.push.apply(l,p),h=l.length,u=Promise.resolve(n);d<h;)u=u.then(l[d++],l[d++]);return u}h=c.length;let b=n;for(d=0;d<h;){const l=c[d++],m=c[d++];try{b=l(b)}catch(w){m.call(this,w);break}}try{u=xe.call(this,b)}catch(l){return Promise.reject(l)}for(d=0,h=p.length;d<h;)u=u.then(p[d++],p[d++]);return u}getUri(t){t=_(this.defaults,t);const n=Ve(t.baseURL,t.url);return qe(n,t.params,t.paramsSerializer)}};a.forEach(["delete","get","head","options"],function(t){H.prototype[t]=function(n,r){return this.request(_(r||{},{method:t,url:n,data:(r||{}).data}))}});a.forEach(["post","put","patch"],function(t){function n(r){return function(o,i,c){return this.request(_(c||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:o,data:i}))}}H.prototype[t]=n(),H.prototype[t+"Form"]=n(!0)});const I=H;let bn=class Ge{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(o){n=o});const r=this;this.promise.then(s=>{if(!r._listeners)return;let o=r._listeners.length;for(;o-- >0;)r._listeners[o](s);r._listeners=null}),this.promise.then=s=>{let o;const i=new Promise(c=>{r.subscribe(c),o=c}).then(s);return i.cancel=function(){r.unsubscribe(o)},i},t(function(o,i,c){r.reason||(r.reason=new B(o,i,c),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}static source(){let t;return{token:new Ge(function(s){t=s}),cancel:t}}};const wn=bn;function En(e){return function(n){return e.apply(null,n)}}function Sn(e){return a.isObject(e)&&e.isAxiosError===!0}const oe={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(oe).forEach(([e,t])=>{oe[t]=e});const gn=oe;function Xe(e){const t=new I(e),n=_e(I.prototype.request,t);return a.extend(n,I.prototype,t,{allOwnKeys:!0}),a.extend(n,t,null,{allOwnKeys:!0}),n.create=function(s){return Xe(_(e,s))},n}const E=Xe(ue);E.Axios=I;E.CanceledError=B;E.CancelToken=wn;E.isCancel=Je;E.VERSION=We;E.toFormData=J;E.AxiosError=y;E.Cancel=E.CanceledError;E.all=function(t){return Promise.all(t)};E.spread=En;E.isAxiosError=Sn;E.mergeConfig=_;E.AxiosHeaders=T;E.formToJSON=e=>ze(a.isHTMLForm(e)?new FormData(e):e);E.getAdapter=Ke.getAdapter;E.HttpStatusCode=gn;E.default=E;const Qe=E,{Axios:$n,AxiosError:zn,CanceledError:Jn,isCancel:Vn,CancelToken:Kn,VERSION:Wn,all:Gn,Cancel:Xn,isAxiosError:Qn,spread:Zn,toFormData:Yn,AxiosHeaders:er,HttpStatusCode:tr,formToJSON:nr,getAdapter:On,mergeConfig:rr}=Qe;function K(e,t){return t?n=>e(n,t):n=>e(n)}const fe=K(e=>typeof e=="object"&&e!==null),Rn=K(e=>typeof e=="boolean"),An=K(e=>typeof e=="number");function Y(e){return K(t=>t instanceof Promise||fe(t)&&typeof Reflect.get(t,"then")=="function")(e)}/*! (c) 2020 Andrea Giammarchi */const{parse:xn,stringify:Tn}=JSON,{keys:Nn}=Object,D=String,Ze="string",Ce={},M="object",Ye=(e,t)=>t,Cn=e=>e instanceof D?D(e):e,Pn=(e,t)=>typeof t===Ze?new D(t):t,et=(e,t,n,r)=>{const s=[];for(let o=Nn(n),{length:i}=o,c=0;c<i;c++){const f=o[c],p=n[f];if(p instanceof D){const u=e[p];typeof u===M&&!t.has(u)?(t.add(u),n[f]=Ce,s.push({k:f,a:[e,t,u,r]})):n[f]=r.call(n,f,u)}else n[f]!==Ce&&(n[f]=r.call(n,f,p))}for(let{length:o}=s,i=0;i<o;i++){const{k:c,a:f}=s[i];n[c]=r.call(n,c,et.apply(null,f))}return n},Pe=(e,t,n)=>{const r=D(t.push(n)-1);return e.set(n,r),r},_n=(e,t)=>{const n=xn(e,Pn).map(Cn),r=n[0],s=t||Ye,o=typeof r===M&&r?et(n,new Set,r,s):r;return s.call({"":o},"",o)},Fn=(e,t,n)=>{const r=t&&typeof t===M?(u,d)=>u===""||-1<t.indexOf(u)?d:void 0:t||Ye,s=new Map,o=[],i=[];let c=+Pe(s,o,r.call({"":e},"",e)),f=!c;for(;c<o.length;)f=!0,i[c]=Tn(o[c++],p,n);return"["+i.join(",")+"]";function p(u,d){if(f)return f=!f,d;const h=r.call(this,u,d);switch(typeof h){case M:if(h===null)return h;case Ze:return s.get(h)||Pe(s,o,h)}return h}};function ee(e){return fe(e)&&Reflect.has(e,"getItem")}function jn(e){return fe(e)&&Reflect.has(e,"delete")}class Ln{constructor(t){ye(this,"storage");t?this.storage=t:this.storage=typeof localStorage>"u"?new Map:localStorage}async get(t){const n=this.cacheKey(t);let r=ee(this.storage)?this.storage.getItem(n):this.storage.get(n);if(Y(r)&&(r=await Promise.resolve(r)),r){const{expiration:s,value:o}=_n(r);return!Number.isNaN(Number(s))&&Number(s)<Date.now()?(await this.del(n),null):o}return null}async set(t,{config:{headers:n},...r},s){const o=this.cacheKey(t),i=Fn({expiration:Date.now()+s,value:{...r,config:{headers:n},request:{}}}),c=ee(this.storage)?this.storage.setItem(o,i):this.storage.set(o,i);Y(c)&&await c}async del(t){const n=ee(this.storage)?this.storage.removeItem(t):jn(this.storage)?this.storage.delete(t):this.storage.del(t);Y(n)&&await n}cacheKey(t){return`axios-cache::${t}`}}var Dn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},tt={exports:{}};(function(e,t){(function(n,r){e.exports=r()})(Dn,function(){return function(n){var r={};function s(o){if(r[o])return r[o].exports;var i=r[o]={i:o,l:!1,exports:{}};return n[o].call(i.exports,i,i.exports,s),i.l=!0,i.exports}return s.m=n,s.c=r,s.d=function(o,i,c){s.o(o,i)||Object.defineProperty(o,i,{enumerable:!0,get:c})},s.r=function(o){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(o,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(o,"__esModule",{value:!0})},s.t=function(o,i){if(1&i&&(o=s(o)),8&i||4&i&&typeof o=="object"&&o&&o.__esModule)return o;var c=Object.create(null);if(s.r(c),Object.defineProperty(c,"default",{enumerable:!0,value:o}),2&i&&typeof o!="string")for(var f in o)s.d(c,f,(function(p){return o[p]}).bind(null,f));return c},s.n=function(o){var i=o&&o.__esModule?function(){return o.default}:function(){return o};return s.d(i,"a",i),i},s.o=function(o,i){return Object.prototype.hasOwnProperty.call(o,i)},s.p="",s(s.s=1)}([function(n,r){},function(n,r,s){function o(d){return(o=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(h){return typeof h}:function(h){return h&&typeof Symbol=="function"&&h.constructor===Symbol&&h!==Symbol.prototype?"symbol":typeof h})(d)}function i(d,h){return function(b){if(Array.isArray(b))return b}(d)||function(b,l){if(Symbol.iterator in Object(b)||Object.prototype.toString.call(b)==="[object Arguments]"){var m=[],w=!0,S=!1,g=void 0;try{for(var R,C=b[Symbol.iterator]();!(w=(R=C.next()).done)&&(m.push(R.value),!l||m.length!==l);w=!0);}catch(P){S=!0,g=P}finally{try{w||C.return==null||C.return()}finally{if(S)throw g}}return m}}(d,h)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}s.r(r);var c=["max-age","s-maxage","stale-while-revalidate","stale-if-error","public","private","no-store","no-cache","must-revalidate","proxy-revalidate","immutable","no-transform"],f=function(d){var h={},b=d.toLowerCase().split(",").map(function(W){return W.trim().split("=").map(function(nt){return nt.trim()})}),l=!0,m=!1,w=void 0;try{for(var S,g=b[Symbol.iterator]();!(l=(S=g.next()).done);l=!0){var R=i(S.value,2),C=R[0],P=R[1];switch(C){case"max-age":var de=parseInt(P,10);if(isNaN(de))continue;h["max-age"]=de;break;case"s-maxage":var pe=parseInt(P,10);if(isNaN(pe))continue;h["s-maxage"]=pe;break;case"stale-while-revalidate":var he=parseInt(P,10);if(isNaN(he))continue;h["stale-while-revalidate"]=he;break;case"stale-if-error":var me=parseInt(P,10);if(isNaN(me))continue;h["stale-if-error"]=me;break;case"public":h.public=!0;break;case"private":h.private=!0;break;case"no-store":h["no-store"]=!0;break;case"no-cache":h["no-cache"]=!0;break;case"must-revalidate":h["must-revalidate"]=!0;break;case"proxy-revalidate":h["proxy-revalidate"]=!0;break;case"immutable":h.immutable=!0;break;case"no-transform":h["no-transform"]=!0}}}catch(W){m=!0,w=W}finally{try{l||g.return==null||g.return()}finally{if(m)throw w}}return h},p=function(d){for(var h=[],b=0,l=Object.entries(d);b<l.length;b++){var m=i(l[b],2),w=m[0],S=m[1];if(c.includes(w))switch(o(S)){case"boolean":h.push("".concat(w));break;case"number":h.push("".concat(w,"=").concat(S))}}return h.join(", ")},u=s(0);s.d(r,"parse",function(){return f}),s.d(r,"stringify",function(){return p}),s.d(r,"CacheControl",function(){return u.CacheControl})}])})})(tt);var kn=tt.exports;const Bn=1e3;function Un(e={}){const{headers:t={}}=e;for(const[n,r]of Object.entries(t))if(n.toLowerCase()==="cache-control"){const s=kn.parse(r),o=s["s-maxage"]??s["max-age"];if(o)return o*Bn}return null}function vn({parseHeaders:e,config:t,response:n,defaultTTL:r}){const{cache:s}=t;if(Rn(s)){if(!s)return null;if(r)return r}return An(s)&&s>0?s:e?Un(n):null}function In({debug:e=!1,parseHeaders:t=!1,logger:n=console,storage:r,defaultTTL:s}={}){const o=new Ln(r),i=On(typeof XMLHttpRequest>"u"?"http":"xhr");return async function(c){var b;const f=((b=c.method)==null?void 0:b.toLowerCase())==="get",p=Qe.getUri(c),u=f?await o.get(p):null;if(u){if(e){const l=`[axios-cache] serving cached response for url: ${p}`;n.log(l)}return{...u,config:{...c,...u.config}}}const d=await i(c),h=vn({config:c,response:d,defaultTTL:s,parseHeaders:t});if(f&&h){if(e){const l=`[axios-cache] caching response for url: ${p} with TTL: ${h}`;n.log(l)}await o.set(p,d,h)}return d}}exports.createCacheAdapter=In;