UNPKG

@hyperfoundation/sdk

Version:
6 lines 501 kB
"use strict";var HyperliquidSDK=(()=>{var kl=Object.defineProperty;var Kb=Object.getOwnPropertyDescriptor;var qb=Object.getOwnPropertyNames;var Jb=Object.prototype.hasOwnProperty;var rp=n=>{throw TypeError(n)};var Qb=(n,e,t)=>e in n?kl(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var Bl=(n,e)=>{for(var t in e)kl(n,t,{get:e[t],enumerable:!0})},jb=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of qb(e))!Jb.call(n,s)&&s!==t&&kl(n,s,{get:()=>e[s],enumerable:!(r=Kb(e,s))||r.enumerable});return n};var Yb=n=>jb(kl({},"__esModule",{value:!0}),n);var h=(n,e,t)=>Qb(n,typeof e!="symbol"?e+"":e,t),Yf=(n,e,t)=>e.has(n)||rp("Cannot "+t);var f=(n,e,t)=>(Yf(n,e,"read from private field"),t?t.call(n):e.get(n)),w=(n,e,t)=>e.has(n)?rp("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,t),p=(n,e,t,r)=>(Yf(n,e,"write to private field"),r?r.call(n,t):e.set(n,t),t),T=(n,e,t)=>(Yf(n,e,"access private method"),t);var Yr=(n,e,t,r)=>({set _(s){p(n,e,s,t)},get _(){return f(n,e,r)}});var d3={};Bl(d3,{Hyperliquid:()=>rc,utils:()=>f3});var lo={PRODUCTION:"https://api.hyperliquid.xyz",TESTNET:"https://api.hyperliquid-testnet.xyz"},Zf={PRODUCTION:"wss://api.hyperliquid.xyz/ws",TESTNET:"wss://api.hyperliquid-testnet.xyz/ws"},ee={ARBITRUM_MAINNET:"0xa4b1",ARBITRUM_TESTNET:"0x66eee"},uo={INFO:"/info",EXCHANGE:"/exchange"};var np="PLACEHOLDER";var Dl=class{constructor(e,t,r){this.httpApi=e;this.symbolConversion=t;h(this,"parent");this.parent=r}async getAllMids(e=!1){let t=await this.httpApi.makeRequest({type:"allMids"});if(e)return t;{let r={};for(let[s,i]of Object.entries(t)){let o=await this.symbolConversion.convertSymbol(s),a=parseFloat(i);r[o]=a}return r}}async getUserOpenOrders(e,t=!1){await this.parent.ensureInitialized();let r=await this.httpApi.makeRequest({type:"openOrders",user:e});return t?r:await this.symbolConversion.convertResponse(r)}async getFrontendOpenOrders(e,t=!1){let r=await this.httpApi.makeRequest({type:"frontendOpenOrders",user:e},20);return t?r:await this.symbolConversion.convertResponse(r)}async getUserFills(e,t=!1){let r=await this.httpApi.makeRequest({type:"userFills",user:e},20);return t?r:await this.symbolConversion.convertResponse(r)}async getUserFillsByTime(e,t,r,s=!1){let i={user:e,startTime:Math.round(t),type:"userFillsByTime"};r&&(i.endTime=Math.round(r));let o=await this.httpApi.makeRequest(i,20);return s?o:await this.symbolConversion.convertResponse(o)}async getUserRateLimit(e,t=!1){let r=await this.httpApi.makeRequest({type:"userRateLimit",user:e},20);return t?r:await this.symbolConversion.convertResponse(r)}async getOrderStatus(e,t,r=!1){let s=await this.httpApi.makeRequest({type:"orderStatus",user:e,oid:t});return r?s:await this.symbolConversion.convertResponse(s)}async getL2Book(e,t=!1,r=5,s){let i=await this.httpApi.makeRequest({type:"l2Book",coin:await this.symbolConversion.convertSymbol(e,"reverse"),nSigFigs:r,mantissa:s});return t?i:await this.symbolConversion.convertResponse(i)}async getCandleSnapshot(e,t,r,s,i=!1){let o=await this.httpApi.makeRequest({type:"candleSnapshot",req:{coin:await this.symbolConversion.convertSymbol(e,"reverse"),interval:t,startTime:r,endTime:s}});return i?o:await this.symbolConversion.convertResponse(o,["s"])}async getMaxBuilderFee(e,t,r=!1){let s=await this.httpApi.makeRequest({type:"maxBuilderFee",user:e,builder:t});return r?s:this.symbolConversion.convertToNumber(s)}async getHistoricalOrders(e,t=!1){let r=await this.httpApi.makeRequest({type:"historicalOrders",user:e});return t?r:await this.symbolConversion.convertResponse(r)}async getUserTwapSliceFills(e,t=!1){let r=await this.httpApi.makeRequest({type:"userTwapSliceFills",user:e});return t?r:await this.symbolConversion.convertResponse(r)}async getSubAccounts(e,t=!1){let r=await this.httpApi.makeRequest({type:"subAccounts",user:e});return t?r:await this.symbolConversion.convertResponse(r)}async getVaultDetails(e,t,r=!1){let s={type:"vaultDetails",vaultAddress:e};t&&(s.user=t);let i=await this.httpApi.makeRequest(s);return r?i:await this.symbolConversion.convertResponse(i)}async getUserVaultEquities(e,t=!1){let r=await this.httpApi.makeRequest({type:"userVaultEquities",user:e});return t?r:await this.symbolConversion.convertResponse(r)}async getUserRole(e,t=!1){let r=await this.httpApi.makeRequest({type:"userRole",user:e});return t?r:await this.symbolConversion.convertResponse(r)}async getDelegations(e,t=!1){let r=await this.httpApi.makeRequest({type:"delegations",user:e});return t?r:await this.symbolConversion.convertResponse(r)}async getDelegatorSummary(e,t=!1){let r=await this.httpApi.makeRequest({type:"delegatorSummary",user:e});return t?r:await this.symbolConversion.convertResponse(r)}async getDelegatorHistory(e,t=!1){let r=await this.httpApi.makeRequest({type:"delegatorHistory",user:e});return t?r:await this.symbolConversion.convertResponse(r)}async getDelegatorRewards(e,t=!1){let r=await this.httpApi.makeRequest({type:"delegatorRewards",user:e});return t?r:await this.symbolConversion.convertResponse(r)}async validatorSummaries(e=!1){let t=await this.httpApi.makeRequest({type:"validatorSummaries"});return e?t:await this.symbolConversion.convertResponse(t)}async vaultSummaries(e=!1){let t=await this.httpApi.makeRequest({type:"vaultSummaries"});return e?t:await this.symbolConversion.convertResponse(t)}async userFees(e,t=!1){let r=await this.httpApi.makeRequest({type:"userFees",user:e});return t?r:await this.symbolConversion.convertResponse(r)}async portfolio(e,t=!1){let r=await this.httpApi.makeRequest({type:"portfolio",user:e});return t?r:await this.symbolConversion.convertResponse(r)}async preTransferCheck(e,t,r=!1){let s=await this.httpApi.makeRequest({type:"preTransferCheck",user:e,source:t});return r?s:await this.symbolConversion.convertResponse(s)}async referral(e,t=!1){let r=await this.httpApi.makeRequest({type:"referral",user:e});return t?r:await this.symbolConversion.convertResponse(r)}async extraAgents(e,t=!1){let r=await this.httpApi.makeRequest({type:"extraAgents",user:e});return t?r:await this.symbolConversion.convertResponse(r)}async isVip(e,t=!1){let r=await this.httpApi.makeRequest({type:"isVip",user:e});return t?r:await this.symbolConversion.convertResponse(r)}async legalCheck(e,t=!1){let r=await this.httpApi.makeRequest({type:"legalCheck",user:e});return t?r:await this.symbolConversion.convertResponse(r)}async userTwapSliceFillsByTime(e,t,r,s,i=!1){let o={type:"userTwapSliceFillsByTime",user:e,startTime:t};r!==void 0&&(o.endTime=r),s!==void 0&&(o.aggregateByTime=s);let a=await this.httpApi.makeRequest(o);return i?a:await this.symbolConversion.convertResponse(a)}async twapHistory(e,t=!1){let r=await this.httpApi.makeRequest({type:"twapHistory",user:e});return t?r:await this.symbolConversion.convertResponse(r)}async userToMultiSigSigners(e,t=!1){let r=await this.httpApi.makeRequest({type:"userToMultiSigSigners",user:e});return t?r:await this.symbolConversion.convertResponse(r)}async getBuilderFeeApproval(e,t,r=!1){let s=await this.httpApi.makeRequest({type:"builderFeeApproval",user:e,builderAddress:t});return r?s:await this.symbolConversion.convertResponse(s)}async getUserOrderHistory(e,t,r,s=!1){let i={type:"userOrderHistory",user:e,startTime:Math.round(t)};r!==void 0&&(i.endTime=Math.round(r));let o=await this.httpApi.makeRequest(i,20);return s?o:await this.symbolConversion.convertResponse(o)}};var Ml=class{constructor(e,t){h(this,"httpApi");h(this,"symbolConversion");this.httpApi=e,this.symbolConversion=t}async getSpotMeta(e=!1){let t=await this.httpApi.makeRequest({type:"spotMeta"});return e?t:await this.symbolConversion.convertResponse(t,["name","coin","symbol"],"SPOT")}async getSpotClearinghouseState(e,t=!1){let r=await this.httpApi.makeRequest({type:"spotClearinghouseState",user:e});return t?r:await this.symbolConversion.convertResponse(r,["name","coin","symbol"],"SPOT")}async getSpotMetaAndAssetCtxs(e=!1){let t=await this.httpApi.makeRequest({type:"spotMetaAndAssetCtxs"});return e?t:await this.symbolConversion.convertResponse(t)}async getTokenDetails(e,t=!1){let r=await this.httpApi.makeRequest({type:"tokenDetails",tokenId:e},20);return t?r:await this.symbolConversion.convertResponse(r)}async getSpotDeployState(e,t=!1){let r=await this.httpApi.makeRequest({type:"spotDeployState",user:e},20);return t?r:await this.symbolConversion.convertResponse(r)}};var Fl=class{constructor(e,t,r){h(this,"httpApi");h(this,"symbolConversion");h(this,"parent");this.httpApi=e,this.symbolConversion=t,this.parent=r}async getMeta(e=!1){let t=await this.httpApi.makeRequest({type:"meta"});return e?t:await this.symbolConversion.convertResponse(t,["name","coin","symbol"],"PERP")}async getMetaAndAssetCtxs(e=!1){let t=await this.httpApi.makeRequest({type:"metaAndAssetCtxs"});return e?t:await this.symbolConversion.convertResponse(t,["name","coin","symbol"],"PERP")}async getClearinghouseState(e,t=!1){let r=await this.httpApi.makeRequest({type:"clearinghouseState",user:e});return t?r:await this.symbolConversion.convertResponse(r)}async getUserFunding(e,t,r,s=!1){let i=await this.httpApi.makeRequest({type:"userFunding",user:e,startTime:t,endTime:r},20);return s?i:await this.symbolConversion.convertResponse(i)}async getUserNonFundingLedgerUpdates(e,t,r,s=!1){let i=await this.httpApi.makeRequest({type:"userNonFundingLedgerUpdates",user:e,startTime:t,endTime:r},20);return s?i:await this.symbolConversion.convertResponse(i)}async getFundingHistory(e,t,r,s=!1){await this.parent.ensureInitialized();let i=await this.httpApi.makeRequest({type:"fundingHistory",coin:await this.symbolConversion.convertSymbol(e,"reverse"),startTime:t,endTime:r},20);return s?i:await this.symbolConversion.convertResponse(i)}async getPredictedFundings(e=!1){let t=await this.httpApi.makeRequest({type:"predictedFundings"},20);return e?t:await this.symbolConversion.convertResponse(t)}async getPerpsAtOpenInterestCap(e=!1){let t=await this.httpApi.makeRequest({type:"perpsAtOpenInterestCap"});return e?t:await Promise.all(t.map(s=>this.symbolConversion.convertSymbol(s,"","PERP")))}};function sc(n,e){return function(){return n.apply(e,arguments)}}var{toString:Zb}=Object.prototype,{getPrototypeOf:e0}=Object,Ll=(n=>e=>{let t=Zb.call(e);return n[t]||(n[t]=t.slice(8,-1).toLowerCase())})(Object.create(null)),Zt=n=>(n=n.toLowerCase(),e=>Ll(e)===n),Hl=n=>e=>typeof e===n,{isArray:fo}=Array,ic=Hl("undefined");function Xb(n){return n!==null&&!ic(n)&&n.constructor!==null&&!ic(n.constructor)&&At(n.constructor.isBuffer)&&n.constructor.isBuffer(n)}var op=Zt("ArrayBuffer");function $b(n){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(n):e=n&&n.buffer&&op(n.buffer),e}var ey=Hl("string"),At=Hl("function"),ap=Hl("number"),Gl=n=>n!==null&&typeof n=="object",ty=n=>n===!0||n===!1,_l=n=>{if(Ll(n)!=="object")return!1;let e=e0(n);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in n)&&!(Symbol.iterator in n)},ry=Zt("Date"),ny=Zt("File"),sy=Zt("Blob"),iy=Zt("FileList"),oy=n=>Gl(n)&&At(n.pipe),ay=n=>{let e;return n&&(typeof FormData=="function"&&n instanceof FormData||At(n.append)&&((e=Ll(n))==="formdata"||e==="object"&&At(n.toString)&&n.toString()==="[object FormData]"))},cy=Zt("URLSearchParams"),[ly,uy,fy,dy]=["ReadableStream","Request","Response","Headers"].map(Zt),hy=n=>n.trim?n.trim():n.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function oc(n,e,{allOwnKeys:t=!1}={}){if(n===null||typeof n>"u")return;let r,s;if(typeof n!="object"&&(n=[n]),fo(n))for(r=0,s=n.length;r<s;r++)e.call(null,n[r],r,n);else{let i=t?Object.getOwnPropertyNames(n):Object.keys(n),o=i.length,a;for(r=0;r<o;r++)a=i[r],e.call(null,n[a],a,n)}}function cp(n,e){e=e.toLowerCase();let t=Object.keys(n),r=t.length,s;for(;r-- >0;)if(s=t[r],e===s.toLowerCase())return s;return null}var Gs=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,lp=n=>!ic(n)&&n!==Gs;function $f(){let{caseless:n}=lp(this)&&this||{},e={},t=(r,s)=>{let i=n&&cp(e,s)||s;_l(e[i])&&_l(r)?e[i]=$f(e[i],r):_l(r)?e[i]=$f({},r):fo(r)?e[i]=r.slice():e[i]=r};for(let r=0,s=arguments.length;r<s;r++)arguments[r]&&oc(arguments[r],t);return e}var py=(n,e,t,{allOwnKeys:r}={})=>(oc(e,(s,i)=>{t&&At(s)?n[i]=sc(s,t):n[i]=s},{allOwnKeys:r}),n),my=n=>(n.charCodeAt(0)===65279&&(n=n.slice(1)),n),xy=(n,e,t,r)=>{n.prototype=Object.create(e.prototype,r),n.prototype.constructor=n,Object.defineProperty(n,"super",{value:e.prototype}),t&&Object.assign(n.prototype,t)},gy=(n,e,t,r)=>{let s,i,o,a={};if(e=e||{},n==null)return e;do{for(s=Object.getOwnPropertyNames(n),i=s.length;i-- >0;)o=s[i],(!r||r(o,n,e))&&!a[o]&&(e[o]=n[o],a[o]=!0);n=t!==!1&&e0(n)}while(n&&(!t||t(n,e))&&n!==Object.prototype);return e},by=(n,e,t)=>{n=String(n),(t===void 0||t>n.length)&&(t=n.length),t-=e.length;let r=n.indexOf(e,t);return r!==-1&&r===t},yy=n=>{if(!n)return null;if(fo(n))return n;let e=n.length;if(!ap(e))return null;let t=new Array(e);for(;e-- >0;)t[e]=n[e];return t},wy=(n=>e=>n&&e instanceof n)(typeof Uint8Array<"u"&&e0(Uint8Array)),Ay=(n,e)=>{let r=(n&&n[Symbol.iterator]).call(n),s;for(;(s=r.next())&&!s.done;){let i=s.value;e.call(n,i[0],i[1])}},Ey=(n,e)=>{let t,r=[];for(;(t=n.exec(e))!==null;)r.push(t);return r},Sy=Zt("HTMLFormElement"),vy=n=>n.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(t,r,s){return r.toUpperCase()+s}),sp=(({hasOwnProperty:n})=>(e,t)=>n.call(e,t))(Object.prototype),Ty=Zt("RegExp"),up=(n,e)=>{let t=Object.getOwnPropertyDescriptors(n),r={};oc(t,(s,i)=>{let o;(o=e(s,i,n))!==!1&&(r[i]=o||s)}),Object.defineProperties(n,r)},Ry=n=>{up(n,(e,t)=>{if(At(n)&&["arguments","caller","callee"].indexOf(t)!==-1)return!1;let r=n[t];if(At(r)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+t+"'")})}})},Py=(n,e)=>{let t={},r=s=>{s.forEach(i=>{t[i]=!0})};return fo(n)?r(n):r(String(n).split(e)),t},Ny=()=>{},Cy=(n,e)=>n!=null&&Number.isFinite(n=+n)?n:e,Xf="abcdefghijklmnopqrstuvwxyz",ip="0123456789",fp={DIGIT:ip,ALPHA:Xf,ALPHA_DIGIT:Xf+Xf.toUpperCase()+ip},Iy=(n=16,e=fp.ALPHA_DIGIT)=>{let t="",{length:r}=e;for(;n--;)t+=e[Math.random()*r|0];return t};function Oy(n){return!!(n&&At(n.append)&&n[Symbol.toStringTag]==="FormData"&&n[Symbol.iterator])}var ky=n=>{let e=new Array(10),t=(r,s)=>{if(Gl(r)){if(e.indexOf(r)>=0)return;if(!("toJSON"in r)){e[s]=r;let i=fo(r)?[]:{};return oc(r,(o,a)=>{let c=t(o,s+1);!ic(c)&&(i[a]=c)}),e[s]=void 0,i}}return r};return t(n,0)},By=Zt("AsyncFunction"),Uy=n=>n&&(Gl(n)||At(n))&&At(n.then)&&At(n.catch),dp=((n,e)=>n?setImmediate:e?((t,r)=>(Gs.addEventListener("message",({source:s,data:i})=>{s===Gs&&i===t&&r.length&&r.shift()()},!1),s=>{r.push(s),Gs.postMessage(t,"*")}))(`axios@${Math.random()}`,[]):t=>setTimeout(t))(typeof setImmediate=="function",At(Gs.postMessage)),Dy=typeof queueMicrotask<"u"?queueMicrotask.bind(Gs):typeof process<"u"&&process.nextTick||dp,v={isArray:fo,isArrayBuffer:op,isBuffer:Xb,isFormData:ay,isArrayBufferView:$b,isString:ey,isNumber:ap,isBoolean:ty,isObject:Gl,isPlainObject:_l,isReadableStream:ly,isRequest:uy,isResponse:fy,isHeaders:dy,isUndefined:ic,isDate:ry,isFile:ny,isBlob:sy,isRegExp:Ty,isFunction:At,isStream:oy,isURLSearchParams:cy,isTypedArray:wy,isFileList:iy,forEach:oc,merge:$f,extend:py,trim:hy,stripBOM:my,inherits:xy,toFlatObject:gy,kindOf:Ll,kindOfTest:Zt,endsWith:by,toArray:yy,forEachEntry:Ay,matchAll:Ey,isHTMLForm:Sy,hasOwnProperty:sp,hasOwnProp:sp,reduceDescriptors:up,freezeMethods:Ry,toObjectSet:Py,toCamelCase:vy,noop:Ny,toFiniteNumber:Cy,findKey:cp,global:Gs,isContextDefined:lp,ALPHABET:fp,generateString:Iy,isSpecCompliantForm:Oy,toJSONObject:ky,isAsyncFn:By,isThenable:Uy,setImmediate:dp,asap:Dy};function ho(n,e,t,r,s){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=n,this.name="AxiosError",e&&(this.code=e),t&&(this.config=t),r&&(this.request=r),s&&(this.response=s)}v.inherits(ho,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:v.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});var hp=ho.prototype,pp={};["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(n=>{pp[n]={value:n}});Object.defineProperties(ho,pp);Object.defineProperty(hp,"isAxiosError",{value:!0});ho.from=(n,e,t,r,s,i)=>{let o=Object.create(hp);return v.toFlatObject(n,o,function(c){return c!==Error.prototype},a=>a!=="isAxiosError"),ho.call(o,n.message,e,t,r,s),o.cause=n,o.name=n.name,i&&Object.assign(o,i),o};var V=ho;var zl=null;function t0(n){return v.isPlainObject(n)||v.isArray(n)}function xp(n){return v.endsWith(n,"[]")?n.slice(0,-2):n}function mp(n,e,t){return n?n.concat(e).map(function(s,i){return s=xp(s),!t&&i?"["+s+"]":s}).join(t?".":""):e}function My(n){return v.isArray(n)&&!n.some(t0)}var Fy=v.toFlatObject(v,{},null,function(e){return/^is[A-Z]/.test(e)});function _y(n,e,t){if(!v.isObject(n))throw new TypeError("target must be an object");e=e||new(zl||FormData),t=v.toFlatObject(t,{metaTokens:!0,dots:!1,indexes:!1},!1,function(b,A){return!v.isUndefined(A[b])});let r=t.metaTokens,s=t.visitor||u,i=t.dots,o=t.indexes,c=(t.Blob||typeof Blob<"u"&&Blob)&&v.isSpecCompliantForm(e);if(!v.isFunction(s))throw new TypeError("visitor must be a function");function l(y){if(y===null)return"";if(v.isDate(y))return y.toISOString();if(!c&&v.isBlob(y))throw new V("Blob is not supported. Use a Buffer instead.");return v.isArrayBuffer(y)||v.isTypedArray(y)?c&&typeof Blob=="function"?new Blob([y]):Buffer.from(y):y}function u(y,b,A){let S=y;if(y&&!A&&typeof y=="object"){if(v.endsWith(b,"{}"))b=r?b:b.slice(0,-2),y=JSON.stringify(y);else if(v.isArray(y)&&My(y)||(v.isFileList(y)||v.endsWith(b,"[]"))&&(S=v.toArray(y)))return b=xp(b),S.forEach(function(R,D){!(v.isUndefined(R)||R===null)&&e.append(o===!0?mp([b],D,i):o===null?b:b+"[]",l(R))}),!1}return t0(y)?!0:(e.append(mp(A,b,i),l(y)),!1)}let d=[],x=Object.assign(Fy,{defaultVisitor:u,convertValue:l,isVisitable:t0});function g(y,b){if(!v.isUndefined(y)){if(d.indexOf(y)!==-1)throw Error("Circular reference detected in "+b.join("."));d.push(y),v.forEach(y,function(S,I){(!(v.isUndefined(S)||S===null)&&s.call(e,S,v.isString(I)?I.trim():I,b,x))===!0&&g(S,b?b.concat(I):[I])}),d.pop()}}if(!v.isObject(n))throw new TypeError("data must be an object");return g(n),e}var Ln=_y;function gp(n){let e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(n).replace(/[!'()~]|%20|%00/g,function(r){return e[r]})}function bp(n,e){this._pairs=[],n&&Ln(n,this,e)}var yp=bp.prototype;yp.append=function(e,t){this._pairs.push([e,t])};yp.toString=function(e){let t=e?function(r){return e.call(this,r,gp)}:gp;return this._pairs.map(function(s){return t(s[0])+"="+t(s[1])},"").join("&")};var Vl=bp;function Ly(n){return encodeURIComponent(n).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function ac(n,e,t){if(!e)return n;let r=t&&t.encode||Ly,s=t&&t.serialize,i;if(s?i=s(e,t):i=v.isURLSearchParams(e)?e.toString():new Vl(e,t).toString(r),i){let o=n.indexOf("#");o!==-1&&(n=n.slice(0,o)),n+=(n.indexOf("?")===-1?"?":"&")+i}return n}var r0=class{constructor(){this.handlers=[]}use(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){v.forEach(this.handlers,function(r){r!==null&&e(r)})}},n0=r0;var Wl={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};var wp=typeof URLSearchParams<"u"?URLSearchParams:Vl;var Ap=typeof FormData<"u"?FormData:null;var Ep=typeof Blob<"u"?Blob:null;var Sp={isBrowser:!0,classes:{URLSearchParams:wp,FormData:Ap,Blob:Ep},protocols:["http","https","file","blob","url","data"]};var i0={};Bl(i0,{hasBrowserEnv:()=>s0,hasStandardBrowserEnv:()=>Hy,hasStandardBrowserWebWorkerEnv:()=>Gy,origin:()=>zy});var s0=typeof window<"u"&&typeof document<"u",Hy=(n=>s0&&["ReactNative","NativeScript","NS"].indexOf(n)<0)(typeof navigator<"u"&&navigator.product),Gy=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",zy=s0&&window.location.href||"http://localhost";var Fe={...i0,...Sp};function o0(n,e){return Ln(n,new Fe.classes.URLSearchParams,Object.assign({visitor:function(t,r,s,i){return Fe.isNode&&v.isBuffer(t)?(this.append(r,t.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)}},e))}function Vy(n){return v.matchAll(/\w+|\[(\w*)]/g,n).map(e=>e[0]==="[]"?"":e[1]||e[0])}function Wy(n){let e={},t=Object.keys(n),r,s=t.length,i;for(r=0;r<s;r++)i=t[r],e[i]=n[i];return e}function Ky(n){function e(t,r,s,i){let o=t[i++];if(o==="__proto__")return!0;let a=Number.isFinite(+o),c=i>=t.length;return o=!o&&v.isArray(s)?s.length:o,c?(v.hasOwnProp(s,o)?s[o]=[s[o],r]:s[o]=r,!a):((!s[o]||!v.isObject(s[o]))&&(s[o]=[]),e(t,r,s[o],i)&&v.isArray(s[o])&&(s[o]=Wy(s[o])),!a)}if(v.isFormData(n)&&v.isFunction(n.entries)){let t={};return v.forEachEntry(n,(r,s)=>{e(Vy(r),s,t,0)}),t}return null}var Kl=Ky;function qy(n,e,t){if(v.isString(n))try{return(e||JSON.parse)(n),v.trim(n)}catch(r){if(r.name!=="SyntaxError")throw r}return(t||JSON.stringify)(n)}var a0={transitional:Wl,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){let r=t.getContentType()||"",s=r.indexOf("application/json")>-1,i=v.isObject(e);if(i&&v.isHTMLForm(e)&&(e=new FormData(e)),v.isFormData(e))return s?JSON.stringify(Kl(e)):e;if(v.isArrayBuffer(e)||v.isBuffer(e)||v.isStream(e)||v.isFile(e)||v.isBlob(e)||v.isReadableStream(e))return e;if(v.isArrayBufferView(e))return e.buffer;if(v.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let a;if(i){if(r.indexOf("application/x-www-form-urlencoded")>-1)return o0(e,this.formSerializer).toString();if((a=v.isFileList(e))||r.indexOf("multipart/form-data")>-1){let c=this.env&&this.env.FormData;return Ln(a?{"files[]":e}:e,c&&new c,this.formSerializer)}}return i||s?(t.setContentType("application/json",!1),qy(e)):e}],transformResponse:[function(e){let t=this.transitional||a0.transitional,r=t&&t.forcedJSONParsing,s=this.responseType==="json";if(v.isResponse(e)||v.isReadableStream(e))return e;if(e&&v.isString(e)&&(r&&!this.responseType||s)){let o=!(t&&t.silentJSONParsing)&&s;try{return JSON.parse(e)}catch(a){if(o)throw a.name==="SyntaxError"?V.from(a,V.ERR_BAD_RESPONSE,this,null,this.response):a}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Fe.classes.FormData,Blob:Fe.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};v.forEach(["delete","get","head","post","put","patch"],n=>{a0.headers[n]={}});var po=a0;var Jy=v.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"]),vp=n=>{let e={},t,r,s;return n&&n.split(` `).forEach(function(o){s=o.indexOf(":"),t=o.substring(0,s).trim().toLowerCase(),r=o.substring(s+1).trim(),!(!t||e[t]&&Jy[t])&&(t==="set-cookie"?e[t]?e[t].push(r):e[t]=[r]:e[t]=e[t]?e[t]+", "+r:r)}),e};var Tp=Symbol("internals");function cc(n){return n&&String(n).trim().toLowerCase()}function ql(n){return n===!1||n==null?n:v.isArray(n)?n.map(ql):String(n)}function Qy(n){let e=Object.create(null),t=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g,r;for(;r=t.exec(n);)e[r[1]]=r[2];return e}var jy=n=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(n.trim());function c0(n,e,t,r,s){if(v.isFunction(r))return r.call(this,e,t);if(s&&(e=t),!!v.isString(e)){if(v.isString(r))return e.indexOf(r)!==-1;if(v.isRegExp(r))return r.test(e)}}function Yy(n){return n.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,r)=>t.toUpperCase()+r)}function Zy(n,e){let t=v.toCamelCase(" "+e);["get","set","has"].forEach(r=>{Object.defineProperty(n,r+t,{value:function(s,i,o){return this[r].call(this,e,s,i,o)},configurable:!0})})}var mo=class{constructor(e){e&&this.set(e)}set(e,t,r){let s=this;function i(a,c,l){let u=cc(c);if(!u)throw new Error("header name must be a non-empty string");let d=v.findKey(s,u);(!d||s[d]===void 0||l===!0||l===void 0&&s[d]!==!1)&&(s[d||c]=ql(a))}let o=(a,c)=>v.forEach(a,(l,u)=>i(l,u,c));if(v.isPlainObject(e)||e instanceof this.constructor)o(e,t);else if(v.isString(e)&&(e=e.trim())&&!jy(e))o(vp(e),t);else if(v.isHeaders(e))for(let[a,c]of e.entries())i(c,a,r);else e!=null&&i(t,e,r);return this}get(e,t){if(e=cc(e),e){let r=v.findKey(this,e);if(r){let s=this[r];if(!t)return s;if(t===!0)return Qy(s);if(v.isFunction(t))return t.call(this,s,r);if(v.isRegExp(t))return t.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=cc(e),e){let r=v.findKey(this,e);return!!(r&&this[r]!==void 0&&(!t||c0(this,this[r],r,t)))}return!1}delete(e,t){let r=this,s=!1;function i(o){if(o=cc(o),o){let a=v.findKey(r,o);a&&(!t||c0(r,r[a],a,t))&&(delete r[a],s=!0)}}return v.isArray(e)?e.forEach(i):i(e),s}clear(e){let t=Object.keys(this),r=t.length,s=!1;for(;r--;){let i=t[r];(!e||c0(this,this[i],i,e,!0))&&(delete this[i],s=!0)}return s}normalize(e){let t=this,r={};return v.forEach(this,(s,i)=>{let o=v.findKey(r,i);if(o){t[o]=ql(s),delete t[i];return}let a=e?Yy(i):String(i).trim();a!==i&&delete t[i],t[a]=ql(s),r[a]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){let t=Object.create(null);return v.forEach(this,(r,s)=>{r!=null&&r!==!1&&(t[s]=e&&v.isArray(r)?r.join(", "):r)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join(` `)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){let r=new this(e);return t.forEach(s=>r.set(s)),r}static accessor(e){let r=(this[Tp]=this[Tp]={accessors:{}}).accessors,s=this.prototype;function i(o){let a=cc(o);r[a]||(Zy(s,o),r[a]=!0)}return v.isArray(e)?e.forEach(i):i(e),this}};mo.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);v.reduceDescriptors(mo.prototype,({value:n},e)=>{let t=e[0].toUpperCase()+e.slice(1);return{get:()=>n,set(r){this[t]=r}}});v.freezeMethods(mo);var Be=mo;function lc(n,e){let t=this||po,r=e||t,s=Be.from(r.headers),i=r.data;return v.forEach(n,function(a){i=a.call(t,i,s.normalize(),e?e.status:void 0)}),s.normalize(),i}function uc(n){return!!(n&&n.__CANCEL__)}function Rp(n,e,t){V.call(this,n??"canceled",V.ERR_CANCELED,e,t),this.name="CanceledError"}v.inherits(Rp,V,{__CANCEL__:!0});var Cr=Rp;function fc(n,e,t){let r=t.config.validateStatus;!t.status||!r||r(t.status)?n(t):e(new V("Request failed with status code "+t.status,[V.ERR_BAD_REQUEST,V.ERR_BAD_RESPONSE][Math.floor(t.status/100)-4],t.config,t.request,t))}function l0(n){let e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(n);return e&&e[1]||""}function Xy(n,e){n=n||10;let t=new Array(n),r=new Array(n),s=0,i=0,o;return e=e!==void 0?e:1e3,function(c){let l=Date.now(),u=r[i];o||(o=l),t[s]=c,r[s]=l;let d=i,x=0;for(;d!==s;)x+=t[d++],d=d%n;if(s=(s+1)%n,s===i&&(i=(i+1)%n),l-o<e)return;let g=u&&l-u;return g?Math.round(x*1e3/g):void 0}}var Pp=Xy;function $y(n,e){let t=0,r=1e3/e,s,i,o=(l,u=Date.now())=>{t=u,s=null,i&&(clearTimeout(i),i=null),n.apply(null,l)};return[(...l)=>{let u=Date.now(),d=u-t;d>=r?o(l,u):(s=l,i||(i=setTimeout(()=>{i=null,o(s)},r-d)))},()=>s&&o(s)]}var Np=$y;var xo=(n,e,t=3)=>{let r=0,s=Pp(50,250);return Np(i=>{let o=i.loaded,a=i.lengthComputable?i.total:void 0,c=o-r,l=s(c),u=o<=a;r=o;let d={loaded:o,total:a,progress:a?o/a:void 0,bytes:c,rate:l||void 0,estimated:l&&a&&u?(a-o)/l:void 0,event:i,lengthComputable:a!=null,[e?"download":"upload"]:!0};n(d)},t)},u0=(n,e)=>{let t=n!=null;return[r=>e[0]({lengthComputable:t,total:n,loaded:r}),e[1]]},f0=n=>(...e)=>v.asap(()=>n(...e));var Cp=Fe.hasStandardBrowserEnv?function(){let e=/(msie|trident)/i.test(navigator.userAgent),t=document.createElement("a"),r;function s(i){let o=i;return e&&(t.setAttribute("href",o),o=t.href),t.setAttribute("href",o),{href:t.href,protocol:t.protocol?t.protocol.replace(/:$/,""):"",host:t.host,search:t.search?t.search.replace(/^\?/,""):"",hash:t.hash?t.hash.replace(/^#/,""):"",hostname:t.hostname,port:t.port,pathname:t.pathname.charAt(0)==="/"?t.pathname:"/"+t.pathname}}return r=s(window.location.href),function(o){let a=v.isString(o)?s(o):o;return a.protocol===r.protocol&&a.host===r.host}}():function(){return function(){return!0}}();var Ip=Fe.hasStandardBrowserEnv?{write(n,e,t,r,s,i){let o=[n+"="+encodeURIComponent(e)];v.isNumber(t)&&o.push("expires="+new Date(t).toGMTString()),v.isString(r)&&o.push("path="+r),v.isString(s)&&o.push("domain="+s),i===!0&&o.push("secure"),document.cookie=o.join("; ")},read(n){let e=document.cookie.match(new RegExp("(^|;\\s*)("+n+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(n){this.write(n,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function d0(n){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(n)}function h0(n,e){return e?n.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):n}function dc(n,e){return n&&!d0(e)?h0(n,e):e}var Op=n=>n instanceof Be?{...n}:n;function Xt(n,e){e=e||{};let t={};function r(l,u,d){return v.isPlainObject(l)&&v.isPlainObject(u)?v.merge.call({caseless:d},l,u):v.isPlainObject(u)?v.merge({},u):v.isArray(u)?u.slice():u}function s(l,u,d){if(v.isUndefined(u)){if(!v.isUndefined(l))return r(void 0,l,d)}else return r(l,u,d)}function i(l,u){if(!v.isUndefined(u))return r(void 0,u)}function o(l,u){if(v.isUndefined(u)){if(!v.isUndefined(l))return r(void 0,l)}else return r(void 0,u)}function a(l,u,d){if(d in e)return r(l,u);if(d in n)return r(void 0,l)}let c={url:i,method:i,data:i,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:a,headers:(l,u)=>s(Op(l),Op(u),!0)};return v.forEach(Object.keys(Object.assign({},n,e)),function(u){let d=c[u]||s,x=d(n[u],e[u],u);v.isUndefined(x)&&d!==a||(t[u]=x)}),t}var Jl=n=>{let e=Xt({},n),{data:t,withXSRFToken:r,xsrfHeaderName:s,xsrfCookieName:i,headers:o,auth:a}=e;e.headers=o=Be.from(o),e.url=ac(dc(e.baseURL,e.url),n.params,n.paramsSerializer),a&&o.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):"")));let c;if(v.isFormData(t)){if(Fe.hasStandardBrowserEnv||Fe.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if((c=o.getContentType())!==!1){let[l,...u]=c?c.split(";").map(d=>d.trim()).filter(Boolean):[];o.setContentType([l||"multipart/form-data",...u].join("; "))}}if(Fe.hasStandardBrowserEnv&&(r&&v.isFunction(r)&&(r=r(e)),r||r!==!1&&Cp(e.url))){let l=s&&i&&Ip.read(i);l&&o.set(s,l)}return e};var ew=typeof XMLHttpRequest<"u",kp=ew&&function(n){return new Promise(function(t,r){let s=Jl(n),i=s.data,o=Be.from(s.headers).normalize(),{responseType:a,onUploadProgress:c,onDownloadProgress:l}=s,u,d,x,g,y;function b(){g&&g(),y&&y(),s.cancelToken&&s.cancelToken.unsubscribe(u),s.signal&&s.signal.removeEventListener("abort",u)}let A=new XMLHttpRequest;A.open(s.method.toUpperCase(),s.url,!0),A.timeout=s.timeout;function S(){if(!A)return;let R=Be.from("getAllResponseHeaders"in A&&A.getAllResponseHeaders()),O={data:!a||a==="text"||a==="json"?A.responseText:A.response,status:A.status,statusText:A.statusText,headers:R,config:n,request:A};fc(function(M){t(M),b()},function(M){r(M),b()},O),A=null}"onloadend"in A?A.onloadend=S:A.onreadystatechange=function(){!A||A.readyState!==4||A.status===0&&!(A.responseURL&&A.responseURL.indexOf("file:")===0)||setTimeout(S)},A.onabort=function(){A&&(r(new V("Request aborted",V.ECONNABORTED,n,A)),A=null)},A.onerror=function(){r(new V("Network Error",V.ERR_NETWORK,n,A)),A=null},A.ontimeout=function(){let D=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded",O=s.transitional||Wl;s.timeoutErrorMessage&&(D=s.timeoutErrorMessage),r(new V(D,O.clarifyTimeoutError?V.ETIMEDOUT:V.ECONNABORTED,n,A)),A=null},i===void 0&&o.setContentType(null),"setRequestHeader"in A&&v.forEach(o.toJSON(),function(D,O){A.setRequestHeader(O,D)}),v.isUndefined(s.withCredentials)||(A.withCredentials=!!s.withCredentials),a&&a!=="json"&&(A.responseType=s.responseType),l&&([x,y]=xo(l,!0),A.addEventListener("progress",x)),c&&A.upload&&([d,g]=xo(c),A.upload.addEventListener("progress",d),A.upload.addEventListener("loadend",g)),(s.cancelToken||s.signal)&&(u=R=>{A&&(r(!R||R.type?new Cr(null,n,A):R),A.abort(),A=null)},s.cancelToken&&s.cancelToken.subscribe(u),s.signal&&(s.signal.aborted?u():s.signal.addEventListener("abort",u)));let I=l0(s.url);if(I&&Fe.protocols.indexOf(I)===-1){r(new V("Unsupported protocol "+I+":",V.ERR_BAD_REQUEST,n));return}A.send(i||null)})};var tw=(n,e)=>{let t=new AbortController,r,s=function(c){if(!r){r=!0,o();let l=c instanceof Error?c:this.reason;t.abort(l instanceof V?l:new Cr(l instanceof Error?l.message:l))}},i=e&&setTimeout(()=>{s(new V(`timeout ${e} of ms exceeded`,V.ETIMEDOUT))},e),o=()=>{n&&(i&&clearTimeout(i),i=null,n.forEach(c=>{c&&(c.removeEventListener?c.removeEventListener("abort",s):c.unsubscribe(s))}),n=null)};n.forEach(c=>c&&c.addEventListener&&c.addEventListener("abort",s));let{signal:a}=t;return a.unsubscribe=o,[a,()=>{i&&clearTimeout(i),i=null}]},Bp=tw;var rw=function*(n,e){let t=n.byteLength;if(!e||t<e){yield n;return}let r=0,s;for(;r<t;)s=r+e,yield n.slice(r,s),r=s},nw=async function*(n,e,t){for await(let r of n)yield*rw(ArrayBuffer.isView(r)?r:await t(String(r)),e)},p0=(n,e,t,r,s)=>{let i=nw(n,e,s),o=0,a,c=l=>{a||(a=!0,r&&r(l))};return new ReadableStream({async pull(l){try{let{done:u,value:d}=await i.next();if(u){c(),l.close();return}let x=d.byteLength;if(t){let g=o+=x;t(g)}l.enqueue(new Uint8Array(d))}catch(u){throw c(u),u}},cancel(l){return c(l),i.return()}},{highWaterMark:2})};var jl=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",Dp=jl&&typeof ReadableStream=="function",m0=jl&&(typeof TextEncoder=="function"?(n=>e=>n.encode(e))(new TextEncoder):async n=>new Uint8Array(await new Response(n).arrayBuffer())),Mp=(n,...e)=>{try{return!!n(...e)}catch{return!1}},sw=Dp&&Mp(()=>{let n=!1,e=new Request(Fe.origin,{body:new ReadableStream,method:"POST",get duplex(){return n=!0,"half"}}).headers.has("Content-Type");return n&&!e}),Up=64*1024,x0=Dp&&Mp(()=>v.isReadableStream(new Response("").body)),Ql={stream:x0&&(n=>n.body)};jl&&(n=>{["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!Ql[e]&&(Ql[e]=v.isFunction(n[e])?t=>t[e]():(t,r)=>{throw new V(`Response type '${e}' is not supported`,V.ERR_NOT_SUPPORT,r)})})})(new Response);var iw=async n=>{if(n==null)return 0;if(v.isBlob(n))return n.size;if(v.isSpecCompliantForm(n))return(await new Request(n).arrayBuffer()).byteLength;if(v.isArrayBufferView(n)||v.isArrayBuffer(n))return n.byteLength;if(v.isURLSearchParams(n)&&(n=n+""),v.isString(n))return(await m0(n)).byteLength},ow=async(n,e)=>{let t=v.toFiniteNumber(n.getContentLength());return t??iw(e)},Fp=jl&&(async n=>{let{url:e,method:t,data:r,signal:s,cancelToken:i,timeout:o,onDownloadProgress:a,onUploadProgress:c,responseType:l,headers:u,withCredentials:d="same-origin",fetchOptions:x}=Jl(n);l=l?(l+"").toLowerCase():"text";let[g,y]=s||i||o?Bp([s,i],o):[],b,A,S=()=>{!b&&setTimeout(()=>{g&&g.unsubscribe()}),b=!0},I;try{if(c&&sw&&t!=="get"&&t!=="head"&&(I=await ow(u,r))!==0){let k=new Request(e,{method:"POST",body:r,duplex:"half"}),M;if(v.isFormData(r)&&(M=k.headers.get("content-type"))&&u.setContentType(M),k.body){let[_,q]=u0(I,xo(f0(c)));r=p0(k.body,Up,_,q,m0)}}v.isString(d)||(d=d?"include":"omit"),A=new Request(e,{...x,signal:g,method:t.toUpperCase(),headers:u.normalize().toJSON(),body:r,duplex:"half",credentials:d});let R=await fetch(A),D=x0&&(l==="stream"||l==="response");if(x0&&(a||D)){let k={};["status","statusText","headers"].forEach(K=>{k[K]=R[K]});let M=v.toFiniteNumber(R.headers.get("content-length")),[_,q]=a&&u0(M,xo(f0(a),!0))||[];R=new Response(p0(R.body,Up,_,()=>{q&&q(),D&&S()},m0),k)}l=l||"text";let O=await Ql[v.findKey(Ql,l)||"text"](R,n);return!D&&S(),y&&y(),await new Promise((k,M)=>{fc(k,M,{data:O,headers:Be.from(R.headers),status:R.status,statusText:R.statusText,config:n,request:A})})}catch(R){throw S(),R&&R.name==="TypeError"&&/fetch/i.test(R.message)?Object.assign(new V("Network Error",V.ERR_NETWORK,n,A),{cause:R.cause||R}):V.from(R,R&&R.code,n,A)}});var g0={http:zl,xhr:kp,fetch:Fp};v.forEach(g0,(n,e)=>{if(n){try{Object.defineProperty(n,"name",{value:e})}catch{}Object.defineProperty(n,"adapterName",{value:e})}});var _p=n=>`- ${n}`,aw=n=>v.isFunction(n)||n===null||n===!1,Yl={getAdapter:n=>{n=v.isArray(n)?n:[n];let{length:e}=n,t,r,s={};for(let i=0;i<e;i++){t=n[i];let o;if(r=t,!aw(t)&&(r=g0[(o=String(t)).toLowerCase()],r===void 0))throw new V(`Unknown adapter '${o}'`);if(r)break;s[o||"#"+i]=r}if(!r){let i=Object.entries(s).map(([a,c])=>`adapter ${a} `+(c===!1?"is not supported by the environment":"is not available in the build")),o=e?i.length>1?`since : `+i.map(_p).join(` `):" "+_p(i[0]):"as no adapter specified";throw new V("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return r},adapters:g0};function b0(n){if(n.cancelToken&&n.cancelToken.throwIfRequested(),n.signal&&n.signal.aborted)throw new Cr(null,n)}function Zl(n){return b0(n),n.headers=Be.from(n.headers),n.data=lc.call(n,n.transformRequest),["post","put","patch"].indexOf(n.method)!==-1&&n.headers.setContentType("application/x-www-form-urlencoded",!1),Yl.getAdapter(n.adapter||po.adapter)(n).then(function(r){return b0(n),r.data=lc.call(n,n.transformResponse,r),r.headers=Be.from(r.headers),r},function(r){return uc(r)||(b0(n),r&&r.response&&(r.response.data=lc.call(n,n.transformResponse,r.response),r.response.headers=Be.from(r.response.headers))),Promise.reject(r)})}var Xl="1.7.4";var y0={};["object","boolean","number","function","string","symbol"].forEach((n,e)=>{y0[n]=function(r){return typeof r===n||"a"+(e<1?"n ":" ")+n}});var Lp={};y0.transitional=function(e,t,r){function s(i,o){return"[Axios v"+Xl+"] Transitional option '"+i+"'"+o+(r?". "+r:"")}return(i,o,a)=>{if(e===!1)throw new V(s(o," has been removed"+(t?" in "+t:"")),V.ERR_DEPRECATED);return t&&!Lp[o]&&(Lp[o]=!0,console.warn(s(o," has been deprecated since v"+t+" and will be removed in the near future"))),e?e(i,o,a):!0}};function cw(n,e,t){if(typeof n!="object")throw new V("options must be an object",V.ERR_BAD_OPTION_VALUE);let r=Object.keys(n),s=r.length;for(;s-- >0;){let i=r[s],o=e[i];if(o){let a=n[i],c=a===void 0||o(a,i,n);if(c!==!0)throw new V("option "+i+" must be "+c,V.ERR_BAD_OPTION_VALUE);continue}if(t!==!0)throw new V("Unknown option "+i,V.ERR_BAD_OPTION)}}var $l={assertOptions:cw,validators:y0};var Hn=$l.validators,go=class{constructor(e){this.defaults=e,this.interceptors={request:new n0,response:new n0}}async request(e,t){try{return await this._request(e,t)}catch(r){if(r instanceof Error){let s;Error.captureStackTrace?Error.captureStackTrace(s={}):s=new Error;let i=s.stack?s.stack.replace(/^.+\n/,""):"";try{r.stack?i&&!String(r.stack).endsWith(i.replace(/^.+\n.+\n/,""))&&(r.stack+=` `+i):r.stack=i}catch{}}throw r}}_request(e,t){typeof e=="string"?(t=t||{},t.url=e):t=e||{},t=Xt(this.defaults,t);let{transitional:r,paramsSerializer:s,headers:i}=t;r!==void 0&&$l.assertOptions(r,{silentJSONParsing:Hn.transitional(Hn.boolean),forcedJSONParsing:Hn.transitional(Hn.boolean),clarifyTimeoutError:Hn.transitional(Hn.boolean)},!1),s!=null&&(v.isFunction(s)?t.paramsSerializer={serialize:s}:$l.assertOptions(s,{encode:Hn.function,serialize:Hn.function},!0)),t.method=(t.method||this.defaults.method||"get").toLowerCase();let o=i&&v.merge(i.common,i[t.method]);i&&v.forEach(["delete","get","head","post","put","patch","common"],y=>{delete i[y]}),t.headers=Be.concat(o,i);let a=[],c=!0;this.interceptors.request.forEach(function(b){typeof b.runWhen=="function"&&b.runWhen(t)===!1||(c=c&&b.synchronous,a.unshift(b.fulfilled,b.rejected))});let l=[];this.interceptors.response.forEach(function(b){l.push(b.fulfilled,b.rejected)});let u,d=0,x;if(!c){let y=[Zl.bind(this),void 0];for(y.unshift.apply(y,a),y.push.apply(y,l),x=y.length,u=Promise.resolve(t);d<x;)u=u.then(y[d++],y[d++]);return u}x=a.length;let g=t;for(d=0;d<x;){let y=a[d++],b=a[d++];try{g=y(g)}catch(A){b.call(this,A);break}}try{u=Zl.call(this,g)}catch(y){return Promise.reject(y)}for(d=0,x=l.length;d<x;)u=u.then(l[d++],l[d++]);return u}getUri(e){e=Xt(this.defaults,e);let t=dc(e.baseURL,e.url);return ac(t,e.params,e.paramsSerializer)}};v.forEach(["delete","get","head","options"],function(e){go.prototype[e]=function(t,r){return this.request(Xt(r||{},{method:e,url:t,data:(r||{}).data}))}});v.forEach(["post","put","patch"],function(e){function t(r){return function(i,o,a){return this.request(Xt(a||{},{method:e,headers:r?{"Content-Type":"multipart/form-data"}:{},url:i,data:o}))}}go.prototype[e]=t(),go.prototype[e+"Form"]=t(!0)});var hc=go;var w0=class n{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let t;this.promise=new Promise(function(i){t=i});let r=this;this.promise.then(s=>{if(!r._listeners)return;let i=r._listeners.length;for(;i-- >0;)r._listeners[i](s);r._listeners=null}),this.promise.then=s=>{let i,o=new Promise(a=>{r.subscribe(a),i=a}).then(s);return o.cancel=function(){r.unsubscribe(i)},o},e(function(i,o,a){r.reason||(r.reason=new Cr(i,o,a),t(r.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;let t=this._listeners.indexOf(e);t!==-1&&this._listeners.splice(t,1)}static source(){let e;return{token:new n(function(s){e=s}),cancel:e}}},Hp=w0;function A0(n){return function(t){return n.apply(null,t)}}function E0(n){return v.isObject(n)&&n.isAxiosError===!0}var S0={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(S0).forEach(([n,e])=>{S0[e]=n});var Gp=S0;function zp(n){let e=new hc(n),t=sc(hc.prototype.request,e);return v.extend(t,hc.prototype,e,{allOwnKeys:!0}),v.extend(t,e,null,{allOwnKeys:!0}),t.create=function(s){return zp(Xt(n,s))},t}var Oe=zp(po);Oe.Axios=hc;Oe.CanceledError=Cr;Oe.CancelToken=Hp;Oe.isCancel=uc;Oe.VERSION=Xl;Oe.toFormData=Ln;Oe.AxiosError=V;Oe.Cancel=Oe.CanceledError;Oe.all=function(e){return Promise.all(e)};Oe.spread=A0;Oe.isAxiosError=E0;Oe.mergeConfig=Xt;Oe.AxiosHeaders=Be;Oe.formToJSON=n=>Kl(v.isHTMLForm(n)?new FormData(n):n);Oe.getAdapter=Yl.getAdapter;Oe.HttpStatusCode=Gp;Oe.default=Oe;var bo=Oe;var{Axios:A6,AxiosError:E6,CanceledError:S6,isCancel:v6,CancelToken:T6,VERSION:R6,all:P6,Cancel:N6,isAxiosError:C6,spread:I6,toFormData:O6,AxiosHeaders:k6,HttpStatusCode:B6,formToJSON:U6,getAdapter:D6,mergeConfig:M6}=bo;var pc=class extends Error{constructor(t,r){super(r);this.code=t;this.name="HyperliquidAPIError"}},eu=class extends Error{constructor(e){super(e),this.name="AuthenticationError"}};function Vp(n){if(n.response){let e=n.response.data&&n.response.data.code?n.response.data.code:n.response.status||"UNKNOWN_ERROR",t=n.response.data?n.response.data.message||(typeof n.response.data=="string"?n.response.data:"An unknown error occurred"):"An unknown error occurred";throw new pc(e,t)}else throw n.request?new pc("NETWORK_ERROR","No response received from the server"):new pc("REQUEST_SETUP_ERROR",n.message||"Unknown error occurred")}var Gn=class{constructor(e,t="/",r){h(this,"client");h(this,"endpoint");h(this,"rateLimiter");this.endpoint=t,this.client=bo.create({baseURL:e,headers:{"Content-Type":"application/json"}}),this.rateLimiter=r}async makeRequest(e,t=2,r=this.endpoint){try{await this.rateLimiter.waitForToken(t);let s=await this.client.post(r,e);if(s.data===null||s.data===void 0)throw new Error("Received null or undefined response data");return s.data}catch(s){Vp(s)}}};var tu=class{constructor(e,t,r,s){h(this,"spot");h(this,"perpetuals");h(this,"httpApi");h(this,"generalAPI");h(this,"symbolConversion");h(this,"parent");this.httpApi=new Gn(e,uo.INFO,t),this.symbolConversion=r,this.parent=s,this.generalAPI=new Dl(this.httpApi,this.symbolConversion,this.parent),this.spot=new Ml(this.httpApi,this.symbolConversion),this.perpetuals=new Fl(this.httpApi,this.symbolConversion,this.parent)}async getAssetIndex(e){return await this.parent.ensureInitialized(),await this.symbolConversion.getAssetIndex(e)}async getInternalName(e){return await this.parent.ensureInitialized(),await this.symbolConversion.convertSymbol(e)}async getAllAssets(){return await this.parent.ensureInitialized(),await this.symbolConversion.getAllAssets()}async getAllMids(e=!1){return await this.parent.ensureInitialized(),this.generalAPI.getAllMids(e)}async getUserOpenOrders(e,t=!1){return await this.parent.ensureInitialized(),this.generalAPI.getUserOpenOrders(e,t)}async getFrontendOpenOrders(e,t=!1){return await this.parent.ensureInitialized(),this.generalAPI.getFrontendOpenOrders(e,t)}async getUserFills(e,t=!1){return await this.parent.ensureInitialized(),this.generalAPI.getUserFills(e,t)}async getUserFillsByTime(e,t,r,s=!1){return await this.parent.ensureInitialized(),this.generalAPI.getUserFillsByTime(e,t,r,s)}async getUserRateLimit(e,t=!1){return await this.parent.ensureInitialized(),this.generalAPI.getUserRateLimit(e,t)}async getOrderStatus(e,t,r=!1){return await this.parent.ensureInitialized(),this.generalAPI.getOrderStatus(e,t,r)}async getL2Book(e,t=!1,r=5,s){return await this.parent.ensureInitialized(),this.generalAPI.getL2Book(e,t,r,s)}async getCandleSnapshot(e,t,r,s,i=!1){return await this.parent.ensureInitialized(),this.generalAPI.getCandleSnapshot(e,t,r,s,i)}async getMaxBuilderFee(e,t,r=!1){return await this.parent.ensureInitialized(),this.generalAPI.getMaxBuilderFee(e,t,r)}async getHistoricalOrders(e,t=!1){return await this.parent.ensureInitialized(),this.generalAPI.getHistoricalOrders(e,t)}async getUserTwapSliceFills(e,t=!1){return await this.parent.ensureInitialized(),this.generalAPI.getUserTwapSliceFills(e,t)}async getSubAccounts(e,t=!1){return await this.parent.ensureInitialized(),this.generalAPI.getSubAccounts(e,t)}async getVaultDetails(e,t,r=!1){return await this.parent.ensureInitialized(),this.generalAPI.getVaultDetails(e,t,r)}async getUserVaultEquities(e,t=!1){return await this.parent.ensureInitialized(),this.generalAPI.getUserVaultEquities(e,t)}async getUserRole(e,t=!1){return await this.parent.ensureInitialized(),this.generalAPI.getUserRole(e,t)}async getDelegations(e,t=!1){return await this.parent.ensureInitialized(),this.generalAPI.getDelegations(e,t)}async getDelegatorSummary(e,t=!1){return await this.parent.ensureInitialized(),this.generalAPI.getDelegatorSummary(e,t)}async getDelegatorHistory(e,t=!1){return await this.parent.ensureInitialized(),this.generalAPI.getDelegatorHistory(e,t)}async getDelegatorRewards(e,t=!1){return await this.parent.ensureInitialized(),this.generalAPI.getDelegatorRewards(e,t)}async validatorSummaries(e=!1){return await this.parent.ensureInitialized(),this.generalAPI.validatorSummaries(e)}async vaultSummaries(e=!1){return await this.parent.ensureInitialized(),this.generalAPI.vaultSummaries(e)}async userFees(e,t=!1){return await this.parent.ensureInitialized(),this.generalAPI.userFees(e,t)}async portfolio(e,t=!1){return await this.parent.ensureInitialized(),this.generalAPI.portfolio(e,t)}async preTransferCheck(e,t,r=!1){return await this.parent.ensureInitialized(),this.generalAPI.preTransferCheck(e,t,r)}async referral(e,t=!1){return await this.parent.ensureInitialized(),this.generalAPI.referral(e,t)}async extraAgents(e,t=!1){return await this.parent.ensureInitialized(),this.generalAPI.extraAgents(e,t)}async isVip(e,t=!1){return await this.parent.ensureInitialized(),this.generalAPI.isVip(e,t)}async legalCheck(e,t=!1){return await this.parent.ensureInitialized(),this.generalAPI.legalCheck(e,t)}async userTwapSliceFillsByTime(e,t,r,s,i=!1){return await this.parent.