UNPKG

@dbs-portal/core-api

Version:

HTTP client and API utilities for DBS Portal

6 lines 121 kB
"use strict";var to=Object.defineProperty;var ro=(t,e,r)=>e in t?to(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var ue=(t,e,r)=>ro(t,typeof e!="symbol"?e+"":e,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const le=require("@tanstack/react-query");function Wn(t,e){return function(){return t.apply(e,arguments)}}const{toString:no}=Object.prototype,{getPrototypeOf:Wr}=Object,{iterator:nr,toStringTag:Qn}=Symbol,sr=(t=>e=>{const r=no.call(e);return t[r]||(t[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),_e=t=>(t=t.toLowerCase(),e=>sr(e)===t),or=t=>e=>typeof e===t,{isArray:ut}=Array,Ct=or("undefined");function Tt(t){return t!==null&&!Ct(t)&&t.constructor!==null&&!Ct(t.constructor)&&Re(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const Kn=_e("ArrayBuffer");function so(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&Kn(t.buffer),e}const oo=or("string"),Re=or("function"),Jn=or("number"),_t=t=>t!==null&&typeof t=="object",io=t=>t===!0||t===!1,Gt=t=>{if(sr(t)!=="object")return!1;const e=Wr(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Qn in t)&&!(nr in t)},ao=t=>{if(!_t(t)||Tt(t))return!1;try{return Object.keys(t).length===0&&Object.getPrototypeOf(t)===Object.prototype}catch{return!1}},uo=_e("Date"),co=_e("File"),lo=_e("Blob"),fo=_e("FileList"),po=t=>_t(t)&&Re(t.pipe),ho=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||Re(t.append)&&((e=sr(t))==="formdata"||e==="object"&&Re(t.toString)&&t.toString()==="[object FormData]"))},yo=_e("URLSearchParams"),[mo,go,vo,bo]=["ReadableStream","Request","Response","Headers"].map(_e),Ro=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Ot(t,e,{allOwnKeys:r=!1}={}){if(t===null||typeof t>"u")return;let n,o;if(typeof t!="object"&&(t=[t]),ut(t))for(n=0,o=t.length;n<o;n++)e.call(null,t[n],n,t);else{if(Tt(t))return;const i=r?Object.getOwnPropertyNames(t):Object.keys(t),c=i.length;let d;for(n=0;n<c;n++)d=i[n],e.call(null,t[d],d,t)}}function Yn(t,e){if(Tt(t))return null;e=e.toLowerCase();const r=Object.keys(t);let n=r.length,o;for(;n-- >0;)if(o=r[n],e===o.toLowerCase())return o;return null}const Qe=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Gn=t=>!Ct(t)&&t!==Qe;function Fr(){const{caseless:t}=Gn(this)&&this||{},e={},r=(n,o)=>{const i=t&&Yn(e,o)||o;Gt(e[i])&&Gt(n)?e[i]=Fr(e[i],n):Gt(n)?e[i]=Fr({},n):ut(n)?e[i]=n.slice():e[i]=n};for(let n=0,o=arguments.length;n<o;n++)arguments[n]&&Ot(arguments[n],r);return e}const Eo=(t,e,r,{allOwnKeys:n}={})=>(Ot(e,(o,i)=>{r&&Re(o)?t[i]=Wn(o,r):t[i]=o},{allOwnKeys:n}),t),wo=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),So=(t,e,r,n)=>{t.prototype=Object.create(e.prototype,n),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),r&&Object.assign(t.prototype,r)},Co=(t,e,r,n)=>{let o,i,c;const d={};if(e=e||{},t==null)return e;do{for(o=Object.getOwnPropertyNames(t),i=o.length;i-- >0;)c=o[i],(!n||n(c,t,e))&&!d[c]&&(e[c]=t[c],d[c]=!0);t=r!==!1&&Wr(t)}while(t&&(!r||r(t,e))&&t!==Object.prototype);return e},To=(t,e,r)=>{t=String(t),(r===void 0||r>t.length)&&(r=t.length),r-=e.length;const n=t.indexOf(e,r);return n!==-1&&n===r},_o=t=>{if(!t)return null;if(ut(t))return t;let e=t.length;if(!Jn(e))return null;const r=new Array(e);for(;e-- >0;)r[e]=t[e];return r},Oo=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&Wr(Uint8Array)),Po=(t,e)=>{const n=(t&&t[nr]).call(t);let o;for(;(o=n.next())&&!o.done;){const i=o.value;e.call(t,i[0],i[1])}},Ao=(t,e)=>{let r;const n=[];for(;(r=t.exec(e))!==null;)n.push(r);return n},xo=_e("HTMLFormElement"),ko=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,o){return n.toUpperCase()+o}),On=(({hasOwnProperty:t})=>(e,r)=>t.call(e,r))(Object.prototype),Io=_e("RegExp"),Xn=(t,e)=>{const r=Object.getOwnPropertyDescriptors(t),n={};Ot(r,(o,i)=>{let c;(c=e(o,i,t))!==!1&&(n[i]=c||o)}),Object.defineProperties(t,n)},Do=t=>{Xn(t,(e,r)=>{if(Re(t)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;const n=t[r];if(Re(n)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},jo=(t,e)=>{const r={},n=o=>{o.forEach(i=>{r[i]=!0})};return ut(t)?n(t):n(String(t).split(e)),r},Fo=()=>{},No=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e;function Uo(t){return!!(t&&Re(t.append)&&t[Qn]==="FormData"&&t[nr])}const qo=t=>{const e=new Array(10),r=(n,o)=>{if(_t(n)){if(e.indexOf(n)>=0)return;if(Tt(n))return n;if(!("toJSON"in n)){e[o]=n;const i=ut(n)?[]:{};return Ot(n,(c,d)=>{const b=r(c,o+1);!Ct(b)&&(i[d]=b)}),e[o]=void 0,i}}return n};return r(t,0)},Lo=_e("AsyncFunction"),Mo=t=>t&&(_t(t)||Re(t))&&Re(t.then)&&Re(t.catch),Zn=((t,e)=>t?setImmediate:e?((r,n)=>(Qe.addEventListener("message",({source:o,data:i})=>{o===Qe&&i===r&&n.length&&n.shift()()},!1),o=>{n.push(o),Qe.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",Re(Qe.postMessage)),$o=typeof queueMicrotask<"u"?queueMicrotask.bind(Qe):typeof process<"u"&&process.nextTick||Zn,Bo=t=>t!=null&&Re(t[nr]),p={isArray:ut,isArrayBuffer:Kn,isBuffer:Tt,isFormData:ho,isArrayBufferView:so,isString:oo,isNumber:Jn,isBoolean:io,isObject:_t,isPlainObject:Gt,isEmptyObject:ao,isReadableStream:mo,isRequest:go,isResponse:vo,isHeaders:bo,isUndefined:Ct,isDate:uo,isFile:co,isBlob:lo,isRegExp:Io,isFunction:Re,isStream:po,isURLSearchParams:yo,isTypedArray:Oo,isFileList:fo,forEach:Ot,merge:Fr,extend:Eo,trim:Ro,stripBOM:wo,inherits:So,toFlatObject:Co,kindOf:sr,kindOfTest:_e,endsWith:To,toArray:_o,forEachEntry:Po,matchAll:Ao,isHTMLForm:xo,hasOwnProperty:On,hasOwnProp:On,reduceDescriptors:Xn,freezeMethods:Do,toObjectSet:jo,toCamelCase:ko,noop:Fo,toFiniteNumber:No,findKey:Yn,global:Qe,isContextDefined:Gn,isSpecCompliantForm:Uo,toJSONObject:qo,isAsyncFn:Lo,isThenable:Mo,setImmediate:Zn,asap:$o,isIterable:Bo};function I(t,e,r,n,o){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=t,this.name="AxiosError",e&&(this.code=e),r&&(this.config=r),n&&(this.request=n),o&&(this.response=o,this.status=o.status?o.status:null)}p.inherits(I,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:p.toJSONObject(this.config),code:this.code,status:this.status}}});const es=I.prototype,ts={};["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(t=>{ts[t]={value:t}});Object.defineProperties(I,ts);Object.defineProperty(es,"isAxiosError",{value:!0});I.from=(t,e,r,n,o,i)=>{const c=Object.create(es);return p.toFlatObject(t,c,function(b){return b!==Error.prototype},d=>d!=="isAxiosError"),I.call(c,t.message,e,r,n,o),c.cause=t,c.name=t.name,i&&Object.assign(c,i),c};const zo=null;function Nr(t){return p.isPlainObject(t)||p.isArray(t)}function rs(t){return p.endsWith(t,"[]")?t.slice(0,-2):t}function Pn(t,e,r){return t?t.concat(e).map(function(o,i){return o=rs(o),!r&&i?"["+o+"]":o}).join(r?".":""):e}function Ho(t){return p.isArray(t)&&!t.some(Nr)}const Vo=p.toFlatObject(p,{},null,function(e){return/^is[A-Z]/.test(e)});function ir(t,e,r){if(!p.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,r=p.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(A,S){return!p.isUndefined(S[A])});const n=r.metaTokens,o=r.visitor||y,i=r.dots,c=r.indexes,b=(r.Blob||typeof Blob<"u"&&Blob)&&p.isSpecCompliantForm(e);if(!p.isFunction(o))throw new TypeError("visitor must be a function");function m(C){if(C===null)return"";if(p.isDate(C))return C.toISOString();if(p.isBoolean(C))return C.toString();if(!b&&p.isBlob(C))throw new I("Blob is not supported. Use a Buffer instead.");return p.isArrayBuffer(C)||p.isTypedArray(C)?b&&typeof Blob=="function"?new Blob([C]):Buffer.from(C):C}function y(C,A,S){let B=C;if(C&&!S&&typeof C=="object"){if(p.endsWith(A,"{}"))A=n?A:A.slice(0,-2),C=JSON.stringify(C);else if(p.isArray(C)&&Ho(C)||(p.isFileList(C)||p.endsWith(A,"[]"))&&(B=p.toArray(C)))return A=rs(A),B.forEach(function(K,se){!(p.isUndefined(K)||K===null)&&e.append(c===!0?Pn([A],se,i):c===null?A:A+"[]",m(K))}),!1}return Nr(C)?!0:(e.append(Pn(S,A,i),m(C)),!1)}const E=[],D=Object.assign(Vo,{defaultVisitor:y,convertValue:m,isVisitable:Nr});function M(C,A){if(!p.isUndefined(C)){if(E.indexOf(C)!==-1)throw Error("Circular reference detected in "+A.join("."));E.push(C),p.forEach(C,function(B,k){(!(p.isUndefined(B)||B===null)&&o.call(e,B,p.isString(k)?k.trim():k,A,D))===!0&&M(B,A?A.concat(k):[k])}),E.pop()}}if(!p.isObject(t))throw new TypeError("data must be an object");return M(t),e}function An(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(n){return e[n]})}function Qr(t,e){this._pairs=[],t&&ir(t,this,e)}const ns=Qr.prototype;ns.append=function(e,r){this._pairs.push([e,r])};ns.toString=function(e){const r=e?function(n){return e.call(this,n,An)}:An;return this._pairs.map(function(o){return r(o[0])+"="+r(o[1])},"").join("&")};function Wo(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function ss(t,e,r){if(!e)return t;const n=r&&r.encode||Wo;p.isFunction(r)&&(r={serialize:r});const o=r&&r.serialize;let i;if(o?i=o(e,r):i=p.isURLSearchParams(e)?e.toString():new Qr(e,r).toString(n),i){const c=t.indexOf("#");c!==-1&&(t=t.slice(0,c)),t+=(t.indexOf("?")===-1?"?":"&")+i}return t}let xn=class{constructor(){this.handlers=[]}use(e,r,n){return this.handlers.push({fulfilled:e,rejected:r,synchronous:n?n.synchronous:!1,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){p.forEach(this.handlers,function(n){n!==null&&e(n)})}};const os={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Qo=typeof URLSearchParams<"u"?URLSearchParams:Qr,Ko=typeof FormData<"u"?FormData:null,Jo=typeof Blob<"u"?Blob:null,Yo={isBrowser:!0,classes:{URLSearchParams:Qo,FormData:Ko,Blob:Jo},protocols:["http","https","file","blob","url","data"]},Kr=typeof window<"u"&&typeof document<"u",Ur=typeof navigator=="object"&&navigator||void 0,Go=Kr&&(!Ur||["ReactNative","NativeScript","NS"].indexOf(Ur.product)<0),Xo=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Zo=Kr&&window.location.href||"http://localhost",ei=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Kr,hasStandardBrowserEnv:Go,hasStandardBrowserWebWorkerEnv:Xo,navigator:Ur,origin:Zo},Symbol.toStringTag,{value:"Module"})),ye={...ei,...Yo};function ti(t,e){return ir(t,new ye.classes.URLSearchParams,{visitor:function(r,n,o,i){return ye.isNode&&p.isBuffer(r)?(this.append(n,r.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...e})}function ri(t){return p.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function ni(t){const e={},r=Object.keys(t);let n;const o=r.length;let i;for(n=0;n<o;n++)i=r[n],e[i]=t[i];return e}function is(t){function e(r,n,o,i){let c=r[i++];if(c==="__proto__")return!0;const d=Number.isFinite(+c),b=i>=r.length;return c=!c&&p.isArray(o)?o.length:c,b?(p.hasOwnProp(o,c)?o[c]=[o[c],n]:o[c]=n,!d):((!o[c]||!p.isObject(o[c]))&&(o[c]=[]),e(r,n,o[c],i)&&p.isArray(o[c])&&(o[c]=ni(o[c])),!d)}if(p.isFormData(t)&&p.isFunction(t.entries)){const r={};return p.forEachEntry(t,(n,o)=>{e(ri(n),o,r,0)}),r}return null}function si(t,e,r){if(p.isString(t))try{return(e||JSON.parse)(t),p.trim(t)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(t)}const Pt={transitional:os,adapter:["xhr","http","fetch"],transformRequest:[function(e,r){const n=r.getContentType()||"",o=n.indexOf("application/json")>-1,i=p.isObject(e);if(i&&p.isHTMLForm(e)&&(e=new FormData(e)),p.isFormData(e))return o?JSON.stringify(is(e)):e;if(p.isArrayBuffer(e)||p.isBuffer(e)||p.isStream(e)||p.isFile(e)||p.isBlob(e)||p.isReadableStream(e))return e;if(p.isArrayBufferView(e))return e.buffer;if(p.isURLSearchParams(e))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let d;if(i){if(n.indexOf("application/x-www-form-urlencoded")>-1)return ti(e,this.formSerializer).toString();if((d=p.isFileList(e))||n.indexOf("multipart/form-data")>-1){const b=this.env&&this.env.FormData;return ir(d?{"files[]":e}:e,b&&new b,this.formSerializer)}}return i||o?(r.setContentType("application/json",!1),si(e)):e}],transformResponse:[function(e){const r=this.transitional||Pt.transitional,n=r&&r.forcedJSONParsing,o=this.responseType==="json";if(p.isResponse(e)||p.isReadableStream(e))return e;if(e&&p.isString(e)&&(n&&!this.responseType||o)){const c=!(r&&r.silentJSONParsing)&&o;try{return JSON.parse(e)}catch(d){if(c)throw d.name==="SyntaxError"?I.from(d,I.ERR_BAD_RESPONSE,this,null,this.response):d}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:ye.classes.FormData,Blob:ye.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};p.forEach(["delete","get","head","post","put","patch"],t=>{Pt.headers[t]={}});const oi=p.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"]),ii=t=>{const e={};let r,n,o;return t&&t.split(` `).forEach(function(c){o=c.indexOf(":"),r=c.substring(0,o).trim().toLowerCase(),n=c.substring(o+1).trim(),!(!r||e[r]&&oi[r])&&(r==="set-cookie"?e[r]?e[r].push(n):e[r]=[n]:e[r]=e[r]?e[r]+", "+n:n)}),e},kn=Symbol("internals");function bt(t){return t&&String(t).trim().toLowerCase()}function Xt(t){return t===!1||t==null?t:p.isArray(t)?t.map(Xt):String(t)}function ai(t){const e=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=r.exec(t);)e[n[1]]=n[2];return e}const ui=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function Ir(t,e,r,n,o){if(p.isFunction(n))return n.call(this,e,r);if(o&&(e=r),!!p.isString(e)){if(p.isString(n))return e.indexOf(n)!==-1;if(p.isRegExp(n))return n.test(e)}}function ci(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,r,n)=>r.toUpperCase()+n)}function li(t,e){const r=p.toCamelCase(" "+e);["get","set","has"].forEach(n=>{Object.defineProperty(t,n+r,{value:function(o,i,c){return this[n].call(this,e,o,i,c)},configurable:!0})})}let Ee=class{constructor(e){e&&this.set(e)}set(e,r,n){const o=this;function i(d,b,m){const y=bt(b);if(!y)throw new Error("header name must be a non-empty string");const E=p.findKey(o,y);(!E||o[E]===void 0||m===!0||m===void 0&&o[E]!==!1)&&(o[E||b]=Xt(d))}const c=(d,b)=>p.forEach(d,(m,y)=>i(m,y,b));if(p.isPlainObject(e)||e instanceof this.constructor)c(e,r);else if(p.isString(e)&&(e=e.trim())&&!ui(e))c(ii(e),r);else if(p.isObject(e)&&p.isIterable(e)){let d={},b,m;for(const y of e){if(!p.isArray(y))throw TypeError("Object iterator must return a key-value pair");d[m=y[0]]=(b=d[m])?p.isArray(b)?[...b,y[1]]:[b,y[1]]:y[1]}c(d,r)}else e!=null&&i(r,e,n);return this}get(e,r){if(e=bt(e),e){const n=p.findKey(this,e);if(n){const o=this[n];if(!r)return o;if(r===!0)return ai(o);if(p.isFunction(r))return r.call(this,o,n);if(p.isRegExp(r))return r.exec(o);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,r){if(e=bt(e),e){const n=p.findKey(this,e);return!!(n&&this[n]!==void 0&&(!r||Ir(this,this[n],n,r)))}return!1}delete(e,r){const n=this;let o=!1;function i(c){if(c=bt(c),c){const d=p.findKey(n,c);d&&(!r||Ir(n,n[d],d,r))&&(delete n[d],o=!0)}}return p.isArray(e)?e.forEach(i):i(e),o}clear(e){const r=Object.keys(this);let n=r.length,o=!1;for(;n--;){const i=r[n];(!e||Ir(this,this[i],i,e,!0))&&(delete this[i],o=!0)}return o}normalize(e){const r=this,n={};return p.forEach(this,(o,i)=>{const c=p.findKey(n,i);if(c){r[c]=Xt(o),delete r[i];return}const d=e?ci(i):String(i).trim();d!==i&&delete r[i],r[d]=Xt(o),n[d]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const r=Object.create(null);return p.forEach(this,(n,o)=>{n!=null&&n!==!1&&(r[o]=e&&p.isArray(n)?n.join(", "):n)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,r])=>e+": "+r).join(` `)}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,...r){const n=new this(e);return r.forEach(o=>n.set(o)),n}static accessor(e){const n=(this[kn]=this[kn]={accessors:{}}).accessors,o=this.prototype;function i(c){const d=bt(c);n[d]||(li(o,c),n[d]=!0)}return p.isArray(e)?e.forEach(i):i(e),this}};Ee.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);p.reduceDescriptors(Ee.prototype,({value:t},e)=>{let r=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(n){this[r]=n}}});p.freezeMethods(Ee);function Dr(t,e){const r=this||Pt,n=e||r,o=Ee.from(n.headers);let i=n.data;return p.forEach(t,function(d){i=d.call(r,i,o.normalize(),e?e.status:void 0)}),o.normalize(),i}function as(t){return!!(t&&t.__CANCEL__)}function ct(t,e,r){I.call(this,t??"canceled",I.ERR_CANCELED,e,r),this.name="CanceledError"}p.inherits(ct,I,{__CANCEL__:!0});function us(t,e,r){const n=r.config.validateStatus;!r.status||!n||n(r.status)?t(r):e(new I("Request failed with status code "+r.status,[I.ERR_BAD_REQUEST,I.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function fi(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function di(t,e){t=t||10;const r=new Array(t),n=new Array(t);let o=0,i=0,c;return e=e!==void 0?e:1e3,function(b){const m=Date.now(),y=n[i];c||(c=m),r[o]=b,n[o]=m;let E=i,D=0;for(;E!==o;)D+=r[E++],E=E%t;if(o=(o+1)%t,o===i&&(i=(i+1)%t),m-c<e)return;const M=y&&m-y;return M?Math.round(D*1e3/M):void 0}}function pi(t,e){let r=0,n=1e3/e,o,i;const c=(m,y=Date.now())=>{r=y,o=null,i&&(clearTimeout(i),i=null),t(...m)};return[(...m)=>{const y=Date.now(),E=y-r;E>=n?c(m,y):(o=m,i||(i=setTimeout(()=>{i=null,c(o)},n-E)))},()=>o&&c(o)]}const er=(t,e,r=3)=>{let n=0;const o=di(50,250);return pi(i=>{const c=i.loaded,d=i.lengthComputable?i.total:void 0,b=c-n,m=o(b),y=c<=d;n=c;const E={loaded:c,total:d,progress:d?c/d:void 0,bytes:b,rate:m||void 0,estimated:m&&d&&y?(d-c)/m:void 0,event:i,lengthComputable:d!=null,[e?"download":"upload"]:!0};t(E)},r)},In=(t,e)=>{const r=t!=null;return[n=>e[0]({lengthComputable:r,total:t,loaded:n}),e[1]]},Dn=t=>(...e)=>p.asap(()=>t(...e)),hi=ye.hasStandardBrowserEnv?((t,e)=>r=>(r=new URL(r,ye.origin),t.protocol===r.protocol&&t.host===r.host&&(e||t.port===r.port)))(new URL(ye.origin),ye.navigator&&/(msie|trident)/i.test(ye.navigator.userAgent)):()=>!0,yi=ye.hasStandardBrowserEnv?{write(t,e,r,n,o,i){const c=[t+"="+encodeURIComponent(e)];p.isNumber(r)&&c.push("expires="+new Date(r).toGMTString()),p.isString(n)&&c.push("path="+n),p.isString(o)&&c.push("domain="+o),i===!0&&c.push("secure"),document.cookie=c.join("; ")},read(t){const e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(t){this.write(t,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function mi(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function gi(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function cs(t,e,r){let n=!mi(e);return t&&(n||r==!1)?gi(t,e):e}const jn=t=>t instanceof Ee?{...t}:t;function Ye(t,e){e=e||{};const r={};function n(m,y,E,D){return p.isPlainObject(m)&&p.isPlainObject(y)?p.merge.call({caseless:D},m,y):p.isPlainObject(y)?p.merge({},y):p.isArray(y)?y.slice():y}function o(m,y,E,D){if(p.isUndefined(y)){if(!p.isUndefined(m))return n(void 0,m,E,D)}else return n(m,y,E,D)}function i(m,y){if(!p.isUndefined(y))return n(void 0,y)}function c(m,y){if(p.isUndefined(y)){if(!p.isUndefined(m))return n(void 0,m)}else return n(void 0,y)}function d(m,y,E){if(E in e)return n(m,y);if(E in t)return n(void 0,m)}const b={url:i,method:i,data:i,baseURL:c,transformRequest:c,transformResponse:c,paramsSerializer:c,timeout:c,timeoutMessage:c,withCredentials:c,withXSRFToken:c,adapter:c,responseType:c,xsrfCookieName:c,xsrfHeaderName:c,onUploadProgress:c,onDownloadProgress:c,decompress:c,maxContentLength:c,maxBodyLength:c,beforeRedirect:c,transport:c,httpAgent:c,httpsAgent:c,cancelToken:c,socketPath:c,responseEncoding:c,validateStatus:d,headers:(m,y,E)=>o(jn(m),jn(y),E,!0)};return p.forEach(Object.keys({...t,...e}),function(y){const E=b[y]||o,D=E(t[y],e[y],y);p.isUndefined(D)&&E!==d||(r[y]=D)}),r}const ls=t=>{const e=Ye({},t);let{data:r,withXSRFToken:n,xsrfHeaderName:o,xsrfCookieName:i,headers:c,auth:d}=e;e.headers=c=Ee.from(c),e.url=ss(cs(e.baseURL,e.url,e.allowAbsoluteUrls),t.params,t.paramsSerializer),d&&c.set("Authorization","Basic "+btoa((d.username||"")+":"+(d.password?unescape(encodeURIComponent(d.password)):"")));let b;if(p.isFormData(r)){if(ye.hasStandardBrowserEnv||ye.hasStandardBrowserWebWorkerEnv)c.setContentType(void 0);else if((b=c.getContentType())!==!1){const[m,...y]=b?b.split(";").map(E=>E.trim()).filter(Boolean):[];c.setContentType([m||"multipart/form-data",...y].join("; "))}}if(ye.hasStandardBrowserEnv&&(n&&p.isFunction(n)&&(n=n(e)),n||n!==!1&&hi(e.url))){const m=o&&i&&yi.read(i);m&&c.set(o,m)}return e},vi=typeof XMLHttpRequest<"u",bi=vi&&function(t){return new Promise(function(r,n){const o=ls(t);let i=o.data;const c=Ee.from(o.headers).normalize();let{responseType:d,onUploadProgress:b,onDownloadProgress:m}=o,y,E,D,M,C;function A(){M&&M(),C&&C(),o.cancelToken&&o.cancelToken.unsubscribe(y),o.signal&&o.signal.removeEventListener("abort",y)}let S=new XMLHttpRequest;S.open(o.method.toUpperCase(),o.url,!0),S.timeout=o.timeout;function B(){if(!S)return;const K=Ee.from("getAllResponseHeaders"in S&&S.getAllResponseHeaders()),q={data:!d||d==="text"||d==="json"?S.responseText:S.response,status:S.status,statusText:S.statusText,headers:K,config:t,request:S};us(function(ce){r(ce),A()},function(ce){n(ce),A()},q),S=null}"onloadend"in S?S.onloadend=B:S.onreadystatechange=function(){!S||S.readyState!==4||S.status===0&&!(S.responseURL&&S.responseURL.indexOf("file:")===0)||setTimeout(B)},S.onabort=function(){S&&(n(new I("Request aborted",I.ECONNABORTED,t,S)),S=null)},S.onerror=function(){n(new I("Network Error",I.ERR_NETWORK,t,S)),S=null},S.ontimeout=function(){let se=o.timeout?"timeout of "+o.timeout+"ms exceeded":"timeout exceeded";const q=o.transitional||os;o.timeoutErrorMessage&&(se=o.timeoutErrorMessage),n(new I(se,q.clarifyTimeoutError?I.ETIMEDOUT:I.ECONNABORTED,t,S)),S=null},i===void 0&&c.setContentType(null),"setRequestHeader"in S&&p.forEach(c.toJSON(),function(se,q){S.setRequestHeader(q,se)}),p.isUndefined(o.withCredentials)||(S.withCredentials=!!o.withCredentials),d&&d!=="json"&&(S.responseType=o.responseType),m&&([D,C]=er(m,!0),S.addEventListener("progress",D)),b&&S.upload&&([E,M]=er(b),S.upload.addEventListener("progress",E),S.upload.addEventListener("loadend",M)),(o.cancelToken||o.signal)&&(y=K=>{S&&(n(!K||K.type?new ct(null,t,S):K),S.abort(),S=null)},o.cancelToken&&o.cancelToken.subscribe(y),o.signal&&(o.signal.aborted?y():o.signal.addEventListener("abort",y)));const k=fi(o.url);if(k&&ye.protocols.indexOf(k)===-1){n(new I("Unsupported protocol "+k+":",I.ERR_BAD_REQUEST,t));return}S.send(i||null)})},Ri=(t,e)=>{const{length:r}=t=t?t.filter(Boolean):[];if(e||r){let n=new AbortController,o;const i=function(m){if(!o){o=!0,d();const y=m instanceof Error?m:this.reason;n.abort(y instanceof I?y:new ct(y instanceof Error?y.message:y))}};let c=e&&setTimeout(()=>{c=null,i(new I(`timeout ${e} of ms exceeded`,I.ETIMEDOUT))},e);const d=()=>{t&&(c&&clearTimeout(c),c=null,t.forEach(m=>{m.unsubscribe?m.unsubscribe(i):m.removeEventListener("abort",i)}),t=null)};t.forEach(m=>m.addEventListener("abort",i));const{signal:b}=n;return b.unsubscribe=()=>p.asap(d),b}},Ei=function*(t,e){let r=t.byteLength;if(r<e){yield t;return}let n=0,o;for(;n<r;)o=n+e,yield t.slice(n,o),n=o},wi=async function*(t,e){for await(const r of Si(t))yield*Ei(r,e)},Si=async function*(t){if(t[Symbol.asyncIterator]){yield*t;return}const e=t.getReader();try{for(;;){const{done:r,value:n}=await e.read();if(r)break;yield n}}finally{await e.cancel()}},Fn=(t,e,r,n)=>{const o=wi(t,e);let i=0,c,d=b=>{c||(c=!0,n&&n(b))};return new ReadableStream({async pull(b){try{const{done:m,value:y}=await o.next();if(m){d(),b.close();return}let E=y.byteLength;if(r){let D=i+=E;r(D)}b.enqueue(new Uint8Array(y))}catch(m){throw d(m),m}},cancel(b){return d(b),o.return()}},{highWaterMark:2})},ar=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",fs=ar&&typeof ReadableStream=="function",Ci=ar&&(typeof TextEncoder=="function"?(t=>e=>t.encode(e))(new TextEncoder):async t=>new Uint8Array(await new Response(t).arrayBuffer())),ds=(t,...e)=>{try{return!!t(...e)}catch{return!1}},Ti=fs&&ds(()=>{let t=!1;const e=new Request(ye.origin,{body:new ReadableStream,method:"POST",get duplex(){return t=!0,"half"}}).headers.has("Content-Type");return t&&!e}),Nn=64*1024,qr=fs&&ds(()=>p.isReadableStream(new Response("").body)),tr={stream:qr&&(t=>t.body)};ar&&(t=>{["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!tr[e]&&(tr[e]=p.isFunction(t[e])?r=>r[e]():(r,n)=>{throw new I(`Response type '${e}' is not supported`,I.ERR_NOT_SUPPORT,n)})})})(new Response);const _i=async t=>{if(t==null)return 0;if(p.isBlob(t))return t.size;if(p.isSpecCompliantForm(t))return(await new Request(ye.origin,{method:"POST",body:t}).arrayBuffer()).byteLength;if(p.isArrayBufferView(t)||p.isArrayBuffer(t))return t.byteLength;if(p.isURLSearchParams(t)&&(t=t+""),p.isString(t))return(await Ci(t)).byteLength},Oi=async(t,e)=>{const r=p.toFiniteNumber(t.getContentLength());return r??_i(e)},Pi=ar&&(async t=>{let{url:e,method:r,data:n,signal:o,cancelToken:i,timeout:c,onDownloadProgress:d,onUploadProgress:b,responseType:m,headers:y,withCredentials:E="same-origin",fetchOptions:D}=ls(t);m=m?(m+"").toLowerCase():"text";let M=Ri([o,i&&i.toAbortSignal()],c),C;const A=M&&M.unsubscribe&&(()=>{M.unsubscribe()});let S;try{if(b&&Ti&&r!=="get"&&r!=="head"&&(S=await Oi(y,n))!==0){let q=new Request(e,{method:"POST",body:n,duplex:"half"}),X;if(p.isFormData(n)&&(X=q.headers.get("content-type"))&&y.setContentType(X),q.body){const[ce,me]=In(S,er(Dn(b)));n=Fn(q.body,Nn,ce,me)}}p.isString(E)||(E=E?"include":"omit");const B="credentials"in Request.prototype;C=new Request(e,{...D,signal:M,method:r.toUpperCase(),headers:y.normalize().toJSON(),body:n,duplex:"half",credentials:B?E:void 0});let k=await fetch(C,D);const K=qr&&(m==="stream"||m==="response");if(qr&&(d||K&&A)){const q={};["status","statusText","headers"].forEach(Oe=>{q[Oe]=k[Oe]});const X=p.toFiniteNumber(k.headers.get("content-length")),[ce,me]=d&&In(X,er(Dn(d),!0))||[];k=new Response(Fn(k.body,Nn,ce,()=>{me&&me(),A&&A()}),q)}m=m||"text";let se=await tr[p.findKey(tr,m)||"text"](k,t);return!K&&A&&A(),await new Promise((q,X)=>{us(q,X,{data:se,headers:Ee.from(k.headers),status:k.status,statusText:k.statusText,config:t,request:C})})}catch(B){throw A&&A(),B&&B.name==="TypeError"&&/Load failed|fetch/i.test(B.message)?Object.assign(new I("Network Error",I.ERR_NETWORK,t,C),{cause:B.cause||B}):I.from(B,B&&B.code,t,C)}}),Lr={http:zo,xhr:bi,fetch:Pi};p.forEach(Lr,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const Un=t=>`- ${t}`,Ai=t=>p.isFunction(t)||t===null||t===!1,ps={getAdapter:t=>{t=p.isArray(t)?t:[t];const{length:e}=t;let r,n;const o={};for(let i=0;i<e;i++){r=t[i];let c;if(n=r,!Ai(r)&&(n=Lr[(c=String(r)).toLowerCase()],n===void 0))throw new I(`Unknown adapter '${c}'`);if(n)break;o[c||"#"+i]=n}if(!n){const i=Object.entries(o).map(([d,b])=>`adapter ${d} `+(b===!1?"is not supported by the environment":"is not available in the build"));let c=e?i.length>1?`since : `+i.map(Un).join(` `):" "+Un(i[0]):"as no adapter specified";throw new I("There is no suitable adapter to dispatch the request "+c,"ERR_NOT_SUPPORT")}return n},adapters:Lr};function jr(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new ct(null,t)}function qn(t){return jr(t),t.headers=Ee.from(t.headers),t.data=Dr.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),ps.getAdapter(t.adapter||Pt.adapter)(t).then(function(n){return jr(t),n.data=Dr.call(t,t.transformResponse,n),n.headers=Ee.from(n.headers),n},function(n){return as(n)||(jr(t),n&&n.response&&(n.response.data=Dr.call(t,t.transformResponse,n.response),n.response.headers=Ee.from(n.response.headers))),Promise.reject(n)})}const hs="1.11.0",ur={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{ur[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});const Ln={};ur.transitional=function(e,r,n){function o(i,c){return"[Axios v"+hs+"] Transitional option '"+i+"'"+c+(n?". "+n:"")}return(i,c,d)=>{if(e===!1)throw new I(o(c," has been removed"+(r?" in "+r:"")),I.ERR_DEPRECATED);return r&&!Ln[c]&&(Ln[c]=!0,console.warn(o(c," has been deprecated since v"+r+" and will be removed in the near future"))),e?e(i,c,d):!0}};ur.spelling=function(e){return(r,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};function xi(t,e,r){if(typeof t!="object")throw new I("options must be an object",I.ERR_BAD_OPTION_VALUE);const n=Object.keys(t);let o=n.length;for(;o-- >0;){const i=n[o],c=e[i];if(c){const d=t[i],b=d===void 0||c(d,i,t);if(b!==!0)throw new I("option "+i+" must be "+b,I.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new I("Unknown option "+i,I.ERR_BAD_OPTION)}}const Zt={assertOptions:xi,validators:ur},xe=Zt.validators;let Je=class{constructor(e){this.defaults=e||{},this.interceptors={request:new xn,response:new xn}}async request(e,r){try{return await this._request(e,r)}catch(n){if(n instanceof Error){let o={};Error.captureStackTrace?Error.captureStackTrace(o):o=new Error;const i=o.stack?o.stack.replace(/^.+\n/,""):"";try{n.stack?i&&!String(n.stack).endsWith(i.replace(/^.+\n.+\n/,""))&&(n.stack+=` `+i):n.stack=i}catch{}}throw n}}_request(e,r){typeof e=="string"?(r=r||{},r.url=e):r=e||{},r=Ye(this.defaults,r);const{transitional:n,paramsSerializer:o,headers:i}=r;n!==void 0&&Zt.assertOptions(n,{silentJSONParsing:xe.transitional(xe.boolean),forcedJSONParsing:xe.transitional(xe.boolean),clarifyTimeoutError:xe.transitional(xe.boolean)},!1),o!=null&&(p.isFunction(o)?r.paramsSerializer={serialize:o}:Zt.assertOptions(o,{encode:xe.function,serialize:xe.function},!0)),r.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?r.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:r.allowAbsoluteUrls=!0),Zt.assertOptions(r,{baseUrl:xe.spelling("baseURL"),withXsrfToken:xe.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let c=i&&p.merge(i.common,i[r.method]);i&&p.forEach(["delete","get","head","post","put","patch","common"],C=>{delete i[C]}),r.headers=Ee.concat(c,i);const d=[];let b=!0;this.interceptors.request.forEach(function(A){typeof A.runWhen=="function"&&A.runWhen(r)===!1||(b=b&&A.synchronous,d.unshift(A.fulfilled,A.rejected))});const m=[];this.interceptors.response.forEach(function(A){m.push(A.fulfilled,A.rejected)});let y,E=0,D;if(!b){const C=[qn.bind(this),void 0];for(C.unshift(...d),C.push(...m),D=C.length,y=Promise.resolve(r);E<D;)y=y.then(C[E++],C[E++]);return y}D=d.length;let M=r;for(E=0;E<D;){const C=d[E++],A=d[E++];try{M=C(M)}catch(S){A.call(this,S);break}}try{y=qn.call(this,M)}catch(C){return Promise.reject(C)}for(E=0,D=m.length;E<D;)y=y.then(m[E++],m[E++]);return y}getUri(e){e=Ye(this.defaults,e);const r=cs(e.baseURL,e.url,e.allowAbsoluteUrls);return ss(r,e.params,e.paramsSerializer)}};p.forEach(["delete","get","head","options"],function(e){Je.prototype[e]=function(r,n){return this.request(Ye(n||{},{method:e,url:r,data:(n||{}).data}))}});p.forEach(["post","put","patch"],function(e){function r(n){return function(i,c,d){return this.request(Ye(d||{},{method:e,headers:n?{"Content-Type":"multipart/form-data"}:{},url:i,data:c}))}}Je.prototype[e]=r(),Je.prototype[e+"Form"]=r(!0)});let ki=class ys{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let r;this.promise=new Promise(function(i){r=i});const n=this;this.promise.then(o=>{if(!n._listeners)return;let i=n._listeners.length;for(;i-- >0;)n._listeners[i](o);n._listeners=null}),this.promise.then=o=>{let i;const c=new Promise(d=>{n.subscribe(d),i=d}).then(o);return c.cancel=function(){n.unsubscribe(i)},c},e(function(i,c,d){n.reason||(n.reason=new ct(i,c,d),r(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const r=this._listeners.indexOf(e);r!==-1&&this._listeners.splice(r,1)}toAbortSignal(){const e=new AbortController,r=n=>{e.abort(n)};return this.subscribe(r),e.signal.unsubscribe=()=>this.unsubscribe(r),e.signal}static source(){let e;return{token:new ys(function(o){e=o}),cancel:e}}};function Ii(t){return function(r){return t.apply(null,r)}}function Di(t){return p.isObject(t)&&t.isAxiosError===!0}const Mr={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(Mr).forEach(([t,e])=>{Mr[e]=t});function ms(t){const e=new Je(t),r=Wn(Je.prototype.request,e);return p.extend(r,Je.prototype,e,{allOwnKeys:!0}),p.extend(r,e,null,{allOwnKeys:!0}),r.create=function(o){return ms(Ye(t,o))},r}const oe=ms(Pt);oe.Axios=Je;oe.CanceledError=ct;oe.CancelToken=ki;oe.isCancel=as;oe.VERSION=hs;oe.toFormData=ir;oe.AxiosError=I;oe.Cancel=oe.CanceledError;oe.all=function(e){return Promise.all(e)};oe.spread=Ii;oe.isAxiosError=Di;oe.mergeConfig=Ye;oe.AxiosHeaders=Ee;oe.formToJSON=t=>is(p.isHTMLForm(t)?new FormData(t):t);oe.getAdapter=ps.getAdapter;oe.HttpStatusCode=Mr;oe.default=oe;const{Axios:Ru,AxiosError:Eu,CanceledError:wu,isCancel:Su,CancelToken:Cu,VERSION:Tu,all:_u,Cancel:Ou,isAxiosError:ji,spread:Pu,toFormData:Au,AxiosHeaders:xu,HttpStatusCode:ku,formToJSON:Iu,getAdapter:Du,mergeConfig:ju}=oe;class $r{constructor(e={}){ue(this,"axiosInstance");const r={timeout:e.timeout||3e4,responseType:(e.responseType==="arrayBuffer"?"arraybuffer":e.responseType)||"json",validateStatus:e.validateStatus||(n=>n>=200&&n<300)};e.baseURL&&(r.baseURL=e.baseURL),e.headers&&(r.headers=e.headers),e.params&&(r.params=e.params),e.withCredentials!==void 0&&(r.withCredentials=e.withCredentials),e.maxRedirects!==void 0&&(r.maxRedirects=e.maxRedirects),e.signal&&(r.signal=e.signal),this.axiosInstance=oe.create(r)}transformAxiosResponse(e){return{data:e.data,status:e.status,statusText:e.statusText,headers:e.headers,config:e.config,request:e.request}}transformAxiosError(e){const r={name:"ApiError",message:e.message,config:e.config,request:e.request,response:e.response?this.transformAxiosResponse(e.response):void 0,code:e.code||"UNKNOWN_ERROR",isAxiosError:!0,toJSON:()=>({name:"ApiError",message:e.message,code:e.code||"UNKNOWN_ERROR",status:e.response?.status,config:e.config,stack:e.stack})};return Object.setPrototypeOf(r,Error.prototype),r}async request(e){try{const r={...e};e.responseType==="arrayBuffer"&&(r.responseType="arraybuffer");const n=await this.axiosInstance.request(r);return this.transformAxiosResponse(n)}catch(r){throw ji(r)?this.transformAxiosError(r):r}}async get(e,r){return this.request({...r,url:e,method:"GET"})}async post(e,r,n){return this.request({...n,url:e,method:"POST",data:r})}async put(e,r,n){return this.request({...n,url:e,method:"PUT",data:r})}async patch(e,r,n){return this.request({...n,url:e,method:"PATCH",data:r})}async delete(e,r){return this.request({...r,url:e,method:"DELETE"})}async head(e,r){return this.request({...r,url:e,method:"HEAD"})}async options(e,r){return this.request({...r,url:e,method:"OPTIONS"})}addRequestInterceptor(e,r){return this.axiosInstance.interceptors.request.use(e,r)}addResponseInterceptor(e,r){return this.axiosInstance.interceptors.response.use(e,r)}removeRequestInterceptor(e){this.axiosInstance.interceptors.request.eject(e)}removeResponseInterceptor(e){this.axiosInstance.interceptors.response.eject(e)}getAxiosInstance(){return this.axiosInstance}}class gs{constructor(){ue(this,"cache",new Map)}get(e){const r=this.cache.get(e);return r||null}set(e,r){this.cache.set(e,r)}delete(e){this.cache.delete(e)}clear(){this.cache.clear()}size(){return this.cache.size}keys(){return Array.from(this.cache.keys())}values(){return Array.from(this.cache.values())}entries(){return Array.from(this.cache.entries())}has(e){return this.cache.has(e)}forEach(e){this.cache.forEach(e)}getStats(){let e=0;for(const[r,n]of this.cache.entries())e+=r.length*2,e+=this.estimateObjectSize(n);return{size:this.cache.size,memoryUsage:e}}estimateObjectSize(e){let r=0;if(e==null)return 0;if(typeof e=="string")return e.length*2;if(typeof e=="number")return 8;if(typeof e=="boolean")return 4;if(Array.isArray(e)){for(const n of e)r+=this.estimateObjectSize(n);return r}if(typeof e=="object"){for(const[n,o]of Object.entries(e))r+=n.length*2,r+=this.estimateObjectSize(o);return r}return 0}cleanup(){let e=0;const r=Date.now();for(const[n,o]of this.cache.entries())r-o.timestamp>o.ttl&&(this.cache.delete(n),e++);return e}getEntriesByAge(){return Array.from(this.cache.entries()).sort(([,e],[,r])=>e.timestamp-r.timestamp)}evictOldest(e){const r=[],n=this.getEntriesByAge();for(let o=0;o<e&&o<n.length;o++){const[i]=n[o];this.cache.delete(i),r.push(i)}return r}setMaxSize(e){if(this.cache.size>e){const r=this.cache.size-e;this.evictOldest(r)}}getHitRatio(){return 0}export(){const e={};for(const[r,n]of this.cache.entries())e[r]=n;return e}import(e){this.cache.clear();for(const[r,n]of Object.entries(e))this.cache.set(r,n)}snapshot(){return new Map(this.cache)}restore(e){this.cache=new Map(e)}}class Br{constructor(e="localStorage"){ue(this,"storage",null);ue(this,"prefix");this.prefix=`dbs_api_cache_${e}_`;try{this.storage=e==="localStorage"?localStorage:sessionStorage;const r=this.prefix+"test";this.storage.setItem(r,"test"),this.storage.removeItem(r)}catch{this.storage=null,console.warn(`${e} is not available, falling back to memory cache`)}}get(e){if(!this.storage)return null;try{const r=this.storage.getItem(this.prefix+e);if(!r)return null;const n=JSON.parse(r);return Date.now()-n.timestamp>n.ttl?(this.delete(e),null):n}catch{return null}}set(e,r){if(this.storage)try{const n=JSON.stringify(r);this.storage.setItem(this.prefix+e,n)}catch(n){if(this.isQuotaExceededError(n)){this.cleanup();try{const o=JSON.stringify(r);this.storage.setItem(this.prefix+e,o)}catch{this.evictOldest(5);try{const o=JSON.stringify(r);this.storage.setItem(this.prefix+e,o)}catch{console.warn("Unable to store cache entry due to storage quota")}}}}}delete(e){this.storage&&this.storage.removeItem(this.prefix+e)}clear(){if(!this.storage)return;const e=this.keys();for(const r of e)this.delete(r)}size(){return this.keys().length}keys(){if(!this.storage)return[];const e=[];for(let r=0;r<this.storage.length;r++){const n=this.storage.key(r);n&&n.startsWith(this.prefix)&&e.push(n.substring(this.prefix.length))}return e}entries(){const e=[],r=this.keys();for(const n of r){const o=this.get(n);o&&e.push([n,o])}return e}has(e){return this.storage?this.storage.getItem(this.prefix+e)!==null:!1}getStorageInfo(){if(!this.storage)return{used:0,available:0,total:0};let e=0;for(let o=0;o<this.storage.length;o++){const i=this.storage.key(o);if(i){const c=this.storage.getItem(i);e+=i.length+(c?.length||0)}}const r=5*1024*1024,n=Math.max(0,r-e);return{used:e,available:n,total:r}}cleanup(){if(!this.storage)return 0;let e=0;const r=this.keys(),n=Date.now();for(const o of r)try{const i=this.storage.getItem(this.prefix+o);if(i){const c=JSON.parse(i);n-c.timestamp>c.ttl&&(this.delete(o),e++)}}catch{this.delete(o),e++}return e}evictOldest(e){if(!this.storage)return[];const n=this.entries().sort(([,i],[,c])=>i.timestamp-c.timestamp),o=[];for(let i=0;i<e&&i<n.length;i++){const[c]=n[i];this.delete(c),o.push(c)}return o}isQuotaExceededError(e){return e instanceof DOMException&&(e.code===22||e.code===1014||e.name==="QuotaExceededError"||e.name==="NS_ERROR_DOM_QUOTA_REACHED")}getStats(){const e=this.getStorageInfo();return{size:this.size(),storageUsed:e.used,storageAvailable:e.available,hitRate:0}}export(){const e={},r=this.entries();for(const[n,o]of r)e[n]=o;return e}import(e){this.clear();for(const[r,n]of Object.entries(e))this.set(r,n)}isAvailable(){return this.storage!==null}getStorageType(){return this.storage?this.storage===localStorage?"localStorage":"sessionStorage":"unavailable"}}class vs{constructor(e){ue(this,"storage");ue(this,"config");this.config={ttl:300*1e3,maxSize:100,storage:"memory",...e},this.storage=this.createStorage()}async get(e){if(!this.config.enabled)return null;const r=this.generateKey(e),n=await Promise.resolve(this.storage.get(r));return n?this.isExpired(n)?(await Promise.resolve(this.storage.delete(r)),null):{data:n.data,status:200,statusText:"OK",headers:n.headers||{},config:e}:null}async set(e,r){if(!this.config.enabled||this.config.shouldCache&&!this.config.shouldCache(e))return;const n=this.generateKey(e),o={data:r.data,timestamp:Date.now(),ttl:this.config.ttl,headers:r.headers};await this.enforceMaxSize(),await Promise.resolve(this.storage.set(n,o))}async delete(e){const r=this.generateKey(e);await Promise.resolve(this.storage.delete(r))}async clear(){await Promise.resolve(this.storage.clear())}async invalidate(e){const r=await Promise.resolve(this.storage.keys()),n=typeof e=="string"?new RegExp(e):e;for(const o of r)n.test(o)&&await Promise.resolve(this.storage.delete(o))}async getStats(){return{size:await Promise.resolve(this.storage.size()),maxSize:this.config.maxSize,hitRate:0,missRate:0,totalRequests:0,hits:0,misses:0}}updateConfig(e){this.config={...this.config,...e},e.storage&&(this.storage=this.createStorage())}async cleanup(){const e=await Promise.resolve(this.storage.keys());let r=0;for(const n of e){const o=await Promise.resolve(this.storage.get(n));o&&this.isExpired(o)&&(await Promise.resolve(this.storage.delete(n)),r++)}return r}generateKey(e){if(this.config.keyGenerator)return this.config.keyGenerator(e);const r=e.method||"GET",n=e.url,o=e.params?JSON.stringify(e.params):"";return`${r}:${n}:${o}`}isExpired(e){return Date.now()-e.timestamp>e.ttl}async enforceMaxSize(){if(!this.config.maxSize)return;if(await Promise.resolve(this.storage.size())>=this.config.maxSize){const r=await Promise.resolve(this.storage.keys()),n=Math.max(1,Math.floor(this.config.maxSize*.1));for(let o=0;o<n&&o<r.length;o++)await Promise.resolve(this.storage.delete(r[o]))}}createStorage(){switch(this.config.storage){case"localStorage":return new Br("localStorage");case"sessionStorage":return new Br("sessionStorage");case"memory":default:return new gs}}}const it=t=>{if(!t.response)return!0;const e=t.response.status;return e>=500&&e<600||e===408||e===429},Rt=t=>Math.min(1e3*Math.pow(2,t),3e4);class Te{constructor(e){ue(this,"config");this.config={retries:e.retries,retryDelay:e.retryDelay||Rt,retryCondition:e.retryCondition||it,shouldResetTimeout:e.shouldResetTimeout??!0}}async execute(e){let r,n=0;for(;n<=this.config.retries;)try{return await e()}catch(o){if(r=o,n>=this.config.retries||!this.shouldRetry(o))break;const i=this.calculateDelay(n);i>0&&await this.delay(i),n++}throw r}updateConfig(e){this.config={...this.config,...e,retryDelay:e.retryDelay||this.config.retryDelay,retryCondition:e.retryCondition||this.config.retryCondition}}getConfig(){return{...this.config}}shouldRetry(e){return this.config.retryCondition(e)}calculateDelay(e){return typeof this.config.retryDelay=="function"?this.config.retryDelay(e):this.config.retryDelay}delay(e){return new Promise(r=>setTimeout(r,e))}static exponentialBackoff(e=3,r=1e3,n=3e4){return new Te({retries:e,retryDelay:o=>Math.min(r*Math.pow(2,o),n),retryCondition:it})}static linearBackoff(e=3,r=1e3){return new Te({retries:e,retryDelay:n=>r*(n+1),retryCondition:it})}static fixedDelay(e=3,r=1e3){return new Te({retries:e,retryDelay:r,retryCondition:it})}static networkErrorsOnly(e=3){return new Te({retries:e,retryDelay:Rt,retryCondition:r=>!r.response})}static serverErrorsOnly(e=3){return new Te({retries:e,retryDelay:Rt,retryCondition:r=>{const n=r.response?.status;return n?n>=500&&n<600:!1}})}static custom(e,r,n){return new Te({retries:e,retryCondition:r,retryDelay:n||Rt})}static withRetryAfter(e=3){return new Te({retries:e,retryCondition:it,retryDelay:(r,n)=>{const o=n?.response?.headers?.["retry-after"];if(o){const i=Number.parseInt(o,10);if(!isNaN(i))return i*1e3}return Rt(r)}})}static withJitter(e=3,r=1e3,n=3e4,o=.1){return new Te({retries:e,retryCondition:it,retryDelay:i=>{const c=Math.min(r*Math.pow(2,i),n),d=c*o*Math.random();return c+d}})}}class Ke{constructor(e){ue(this,"tokens");ue(this,"lastRefill");ue(this,"config");this.config={maxRequests:e.maxRequests,perMilliseconds:e.perMilliseconds,maxRPS:e.maxRPS||Math.ceil(e.maxRequests/(e.perMilliseconds/1e3))},this.tokens=this.config.maxRequests,this.lastRefill=Date.now()}async acquire(){if(this.refillTokens(),this.tokens>=1){this.tokens--;return}const e=this.calculateWaitTime();if(e>0)return await this.delay(e),this.acquire()}tryAcquire(){return this.refillTokens(),this.tokens>=1?(this.tokens--,!0):!1}getAvailableTokens(){return this.refillTokens(),Math.floor(this.tokens)}getTimeUntilNextToken(){return this.refillTokens(),this.tokens>=1?0:this.calculateWaitTime()}updateConfig(e){this.config={...this.config,...e,maxRPS:e.maxRPS||Math.ceil((e.maxRequests||this.config.maxRequests)/((e.perMilliseconds||this.config.perMilliseconds)/1e3))},this.tokens=Math.min(this.tokens,this.config.maxRequests)}getConfig(){return{...this.config}}reset(){this.tokens=this.config.maxRequests,this.lastRefill=Date.now()}getStats(){return{availableTokens:this.getAvailableTokens(),maxTokens:this.config.maxRequests,refillRate:this.config.maxRequests/this.config.perMilliseconds,timeUntilNextToken:this.getTimeUntilNextToken()}}refillTokens(){const e=Date.now(),r=e-this.lastRefill;if(r>0){const n=r/this.config.perMilliseconds*this.config.maxRequests;this.tokens=Math.min(this.config.maxRequests,this.tokens+n),this.lastRefill=e}}calculateWaitTime(){const e=1-this.tokens,r=this.config.perMilliseconds/this.config.maxRequests;return Math.ceil(e*r)}delay(e){return new Promise(r=>setTimeout(r,e))}static perSecond(e){return new Ke({maxRequests:e,perMilliseconds:1e3})}static perMinute(e){return new Ke({maxRequests:e,perMilliseconds:6e4})}static perHour(e){return new Ke({maxRequests:e,perMilliseconds:36e5})}static burst(e,r,n=1e3){return new Ke({maxRequests:e,perMilliseconds:n,maxRPS:r})}}class Jr{constructor(e={}){ue(this,"httpClient");ue(this,"cacheManager");ue(this,"retryManager");ue(this,"rateLimiter");ue(this,"config");ue(this,"interceptorIds",[]);this.config=e,this.httpClient=new $r(e),e.cache?.enabled&&(this.cacheManager=new vs(e.cache)),e.retry&&(this.retryManager=new Te(e.retry)),e.rateLimit&&(this.rateLimiter=new Ke(e.rateLimit)),this.setupAxiosInterceptors()}setupAxiosInterceptors(){const e=this.httpClient.addRequestInterceptor(async n=>(this.rateLimiter&&await this.rateLimiter.acquire(),this.config.onRequest&&this.config.onRequest(n),n),n=>Promise.reject(n)),r=this.httpClient.addResponseInterceptor(async n=>{const o=n;return this.config.onResponse&&this.config.onResponse(o),this.cacheManager&&this.shouldCacheResponse(n.config,o)&&await this.cacheManager.set(n.config,o),n},n=>(this.config.onError&&this.config.onError(n),Promise.reject(n)));this.interceptorIds.push(e,r)}async request(e){if(this.cacheManager&&this.shouldUseCache(e)){const n=await this.cacheManager.get(e);if(n)return n}const r=async()=>await this.httpClient.request(e);return this.retryManager?await this.retryManager.execute(r):await r()}async get(e,r){return this.request({...r,url:e,method:"GET"})}async post(e,r,n){return this.request({...n,url:e,method:"POST",data:r})}async put(e,r,n){return this.request({...n,url:e,method:"PUT",data:r})}async patch(e,r,n){return this.request({...n,url:e,method:"PATCH",data:r})}async delete(e,r){return this