PageSourceSearch

https://playwhale.io/assets/walletConnect-CQic-65c.js

js playwhale.io collected 2026-10-07 00:23:01 UTC 1,781,163 bytes, 317 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-CEikKVnh.js","assets/parseSignature-B2B-ODGT.js","assets/index-CiajkjIR.js","assets/index-DjByUfik.css","assets/sha256-CgwiFjkb.js","assets/session-1pMhuUoh.js","assets/ccip-CFbEFPP6.js","assets/index-BTJb-n1K.js","assets/serializeAuthorizationList-wIv9X1mL.js","assets/features-948L-g_x.js","assets/embedded-wallet-Cwlr1cwq.js","assets/index-CQTsp2uh.js","assets/index-CXeeN_Eg.js","assets/ref-R7Cau8EG.js","assets/index-BErn5Edm.js","assets/HelpersUtil-BuV_mag4.js","assets/ConstantsUtil-aFyp-fX5.js","assets/index-oqJ9rTSc.js","assets/index-CXKpu8tB.js","assets/index-CTFP0xNo.js","assets/index-BYTBCf3M.js","assets/index-CcKS1HO7.js","assets/NavigationUtil-DmfK5sOV.js","assets/email-Cq1ioRqf.js","assets/index-BVsI2kVl.js","assets/index-3qDaaG8g.js","assets/socials-DbWojnCN.js","assets/index--o6O-CR3.js","assets/index-DxZAYY97.js","assets/index-m0-mLiGh.js","assets/index-DQQm_iWk.js","assets/swaps-Dv_29EaF.js","assets/index-DxuqNo8v.js","assets/SwapController-DiPnz6-z.js","assets/index-DsvdoOC8.js","assets/MathUtil-BGCe3rZ3.js","assets/send-BRVvYXle.js","assets/index-CqT0DA4O.js","assets/index-BbN8s_nK.js","assets/index-Bv-8xAY8.js","assets/index-DM82_YIP.js","assets/receive-DKqzl-qy.js","assets/onramp-BoBRXNrn.js","assets/index-DWBlwVif.js","assets/index-g54aYd5u.js","assets/index-D4t2_ec-.js","assets/pay-with-exchange-CkVjQebP.js","assets/ExchangeController-BH-jXJLR.js","assets/transactions-9xQ8rgrQ.js","assets/index-CgkzbVVK.js","assets/index-ae4pRNt-.js","assets/index-BKTcqeKk.js","assets/index-D6RFTRMG.js","assets/data-capture-DEFQXfBC.js","assets/index-DmLNSrse.js","assets/index-D5wwmamL.js","assets/w3m-modal-BI9aYexB.js","assets/index-CSXFBaT0.js","assets/WebCryptoP256-D0vP9pC9.js","assets/index-WAeqSs1c.js","assets/index-CR6LcdxX.js","assets/index-BQaIjDHO.js"])))=>i.map(i=>d[i]);
2var PV=Object.defineProperty;var hx=t=>{throw TypeError(t)};var OV=(t,e,r)=>e in t?PV(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var K=(t,e,r)=>OV(t,typeof e!="symbol"?e+"":e,r),b2=(t,e,r)=>e.has(t)||hx("Cannot "+r);var $=(t,e,r)=>(b2(t,e,"read from private field"),r?r.call(t):e.get(t)),ne=(t,e,r)=>e.has(t)?hx("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),W=(t,e,r,n)=>(b2(t,e,"write to private field"),n?n.call(t,r):e.set(t,r),r),ge=(t,e,r)=>(b2(t,e,"access private method"),r);var zp=(t,e,r,n)=>({set _(s){W(t,e,s,r)},get _(){return $(t,e,n)}});import{p as Qr,_ as Wr,g as W$,c as V$,B as bt,fj as We,fk as To,I as G$,ch as NV,V as xV,fl as RV,W as BV,T as kV,Q as jV,fm as DV,U as UV,fn as MV,fo as $V}from"./index-CiajkjIR.js";import{qC as LV,qD as FV,o as LS,qE as HV,qF as px,qG as gx,qH as qV,k as mx,qI as zV,qJ as K$,qK as WV,qL as VV,qM as GV,qN as KV,qO as ZV,r as YV,q as JV,n as QV,s as XV,qP as eG,qQ as tG,qR as w2,qS as rG,qT as nG}from"./session-1pMhuUoh.js";import{b as sG}from"./index-BTJb-n1K.js";const iG=Symbol(),yx=Object.getPrototypeOf,FS=new WeakMap,oG=t=>t&&(FS.has(t)?FS.get(t):yx(t)===Object.prototype||yx(t)===Array.prototype),aG=t=>oG(t)&&t[iG]||null,bx=(t,e=!0)=>{FS.set(t,e)},T_={},UP=t=>typeof t=="object"&&t!==null,cG=t=>UP(t)&&!s0.has(t)&&(Array.isArray(t)||!(Symbol.iterator in t))&&!(t instanceof WeakMap)&&!(t instanceof WeakSet)&&!(t instanceof Error)&&!(t instanceof Number)&&!(t instanceof Date)&&!(t instanceof String)&&!(t instanceof RegExp)&&!(t instanceof ArrayBuffer)&&!(t instanceof Promise),Z$=(t,e)=>{const r=HS.get(t);if((r==null?void 0:r[0])===e)return r[1];const n=Array.isArray(t)?[]:Object.create(Object.getPrototypeOf(t));return bx(n,!0),HS.set(t,[e,n]),Reflect.ownKeys(t).forEach(s=>{if(Object.getOwnPropertyDescriptor(n,s))return;const i=Reflect.get(t,s),{enumerable:o}=Reflect.getOwnPropertyDescriptor(t,s),a={value:i,enumerable:o,configurable:!0};if(s0.has(i))bx(i,!1);else if(Ou.has(i)){const[c,u]=Ou.get(i);a.value=Z$(c,u())}Object.defineProperty(n,s,a)}),Object.preventExtensions(n)},uG=(t,e,r,n)=>({deleteProperty(s,i){const o=Reflect.get(s,i);r(i);const a=Reflect.deleteProperty(s,i);return a&&n(["delete",[i],o]),a},set(s,i,o,a){const c=!t()&&Reflect.has(s,i),u=Reflect.get(s,i,a);if(c&&(wx(u,o)||Hm.has(o)&&wx(u,Hm.get(o))))return!0;r(i),UP(o)&&(o=aG(o)||o);const l=!Ou.has(o)&&dG(o)?rr(o):o;return e(i,l),Reflect.set(s,i,l,a),n(["set",[i],o,u]),!0}}),Ou=new WeakMap,s0=new WeakSet,HS=new WeakMap,n_=[1],Hm=new WeakMap;let wx=Object.is,lG=(t,e)=>new Proxy(t,e),dG=cG,fG=Z$,hG=uG;function rr(t={}){if(!UP(t))throw new Error("object required");const e=Hm.get(t);if(e)return e;let r=n_[0];const n=new Set,s=(y,w=++n_[0])=>
2{r!==w&&(i=r=w,n.forEach(I=>I(y,w)))};let i=r;const o=(y=n_[0])=>(i!==y&&(i=y,c.forEach(([w])=>{const I=w[1](y);I>r&&(r=I)})),r),a=y=>(w,I)=>{const v=[...w];v[1]=[y,...v[1]],s(v,I)},c=new Map,u=(y,w)=>{const I=!s0.has(w)&&Ou.get(w);if(I){if((T_?"production":void 0)!=="production"&&c.has(y))throw new Error("prop listener already exists");if(n.size){const v=I[2](a(y));c.set(y,[I,v])}else c.set(y,[I])}},l=y=>{var w;const I=c.get(y);I&&(c.delete(y),(w=I[1])==null||w.call(I))},d=y=>(n.add(y),n.size===1&&c.forEach(([I,v],E)=>{if((T_?"production":void 0)!=="production"&&v)throw new Error("remove already exists");const b=I[2](a(E));c.set(E,[I,b])}),()=>{n.delete(y),n.size===0&&c.forEach(([I,v],E)=>{v&&(v(),c.set(E,[I]))})});let f=!0;const g=hG(()=>f,u,l,s),h=lG(t,g);Hm.set(t,h);const p=[t,o,d];return Ou.set(h,p),Reflect.ownKeys(t).forEach(y=>{const w=Object.getOwnPropertyDescriptor(t,y);"value"in w&&w.writable&&(h[y]=t[y])}),f=!1,h}function ln(t,e,r){const n=Ou.get(t);(T_?"production":void 0)!=="production"&&!n&&console.warn("Please use proxy object");let s;const i=[],o=n[2];let a=!1;const u=o(l=>
2{i.push(l),s||(s=Promise.resolve().then(()=>{s=void 0,a&&e(i.splice(0))}))});return a=!0,()=>{a=!1,u()}}function qm(t){const e=Ou.get(t);(T_?"production":void 0)!=="production"&&!e&&console.warn("Please use proxy object");const[r,n]=e;return fG(r,n())}function zm(t){return s0.add(t),t}function pG(){return{proxyStateMap:Ou,refSet:s0,snapCache:HS,versionHolder:n_,proxyCache:Hm}}function cr(t,e,r,n){let s=t[e];return ln(t,()=>{const i=t[e];Object.is(s,i)||r(s=i)})}const{proxyStateMap:gG,snapCache:mG}=pG(),sb=t=>gG.has(t);function yG(t){const e=[];let r=0;const n=new Map,s=new WeakMap,i=()=>{const u=mG.get(a),l=u==null?void 0:u[1];if(l&&!s.has(l)){const d=new Map(n);s.set(l,d)}},o=u=>s.get(u)||n,a={data:e,index:r,epoch:0,get size(){return sb(this)||i(),o(this).size},get(u){const d=o(this).get(u);if(d===void 0){this.epoch;return}return this.data[d]},has(u){const l=o(this);return this.epoch,l.has(u)},set(u,l){if(!sb(this))throw new Error("Cannot perform mutations on a snapshot");const d=n.get(u);return d===void 0?(n.set(u,this.index),this.data[this.index++]=l):this.data[d]=l,this.epoch++,this},delete(u){if(!sb(this))throw new Error("Cannot perform mutations on a snapshot");const l=n.get(u);return l===void 0?!1:(delete this.data[l],n.delete(u),this.epoch++,!0)},clear(){if(!sb(this))throw new Error("Cannot perform mutations on a snapshot");this.data.length=0,this.index=0,this.epoch++,n.clear()},forEach(u){this.epoch,o(this).forEach((d,f)=>{u(this.data[d],f,this)})},*entries(){this.epoch;const u=o(this);for(const[l,d]of u)yield[l,this.data[d]]},*keys(){this.epoch;const u=o(this);for(const l of u.keys())yield l},*values(){this.epoch;const u=o(this);for(const l of u.values())yield this.data[l]},[Symbol.iterator](){return this.entries()},get[Symbol.toStringTag](){return"Map"},toJSON(){return new Map(this.entries())}},c=rr(a);return Object.defineProperties(c,{size:{enumerable:!1},index:{enumerable:!1},epoch:{enumerable:!1},data:{enumerable:!1},toJSON:{enumerable:!1}}),Object.seal(c),c}const Y$={isLowerCaseMatch(t,e){return(t==null?void 0:t.toLowerCase())===(e==null?void 0:e.toLowerCase())}};var Ex={};const Y={WC_NAME_SUFFIX:".reown.id",WC_NAME_SUFFIX_LEGACY:".wcn.id",BLOCKCHAIN_API_RPC_URL:"https://rpc.walletconnect.org",PULSE_API_URL:"https://pulse.walletconnect.org",W3M_API_URL:"https://api.web3modal.org",CONNECTOR_ID:{WALLET_CONNECT:"walletConnect",INJECTED:"injected",WALLET_STANDARD:"announced",COINBASE:"coinbaseWallet",COINBASE_SDK:"coinbaseWalletSDK",BASE_ACCOUNT:"baseAccount",SAFE:"safe",LEDGER:"ledger",OKX:"okx",EIP6963:"eip6963",AUTH:"AUTH"},CONNECTOR_NAMES:{AUTH:"Auth"},AUTH_CONNECTOR_SUPPORTED_CHAINS:["eip155","solana"],LIMITS:{PENDING_TRANSACTIONS:99},CHAIN:{EVM:"eip155",SOLANA:"solana",POLKADOT:"polkadot",BITCOIN:"bip122",TON:"ton",TRON:"tron"}
2,CHAIN_NAME_MAP:{eip155:"EVM Networks",solana:"Solana",polkadot:"Polkadot",bip122:"Bitcoin",cosmos:"Cosmos",sui:"Sui",stacks:"Stacks",ton:"TON",tron:"TRON"},ADAPTER_TYPES:{BITCOIN:"bitcoin",SOLANA:"solana",WAGMI:"wagmi",ETHERS:"ethers",ETHERS5:"ethers5",TON:"ton",TRON:"tron"},USDT_CONTRACT_ADDRESSES:["0xdac17f958d2ee523a2206206994597c13d831ec7","0xc2132d05d31c914a87c6611c10748aeb04b58e8f","0x9702230a8ea53601f5cd2dc00fdbc13d4df4a8c7","0x919C1c267BC06a7039e03fcc2eF738525769109c","0x48065fbBE25f71C9282ddf5e1cD6D6A887483D5e","0x55d398326f99059fF775485246999027B3197955","0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9"],SOLANA_SPL_TOKEN_ADDRESSES:{SOL:"So11111111111111111111111111111111111111112"},NATIVE_IMAGE_IDS_BY_NAMESPACE:{eip155:"ba0ba0cd-17c6-4806-ad93-f9d174f17900",solana:"3e8119e5-2a6f-4818-c50c-1937011d5900",bip122:"0b4838db-0161-4ffe-022d-532bf03dba00"},TOKEN_SYMBOLS_BY_ADDRESS:{"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48":"USDC","0x833589fcd6edb6e08f4c7c32d4f71b54bda02913":"USDC","0x0b2c639c533813f4aa9d7837caf62653d097ff85":"USDC","0xaf88d065e77c8cc2239327c5edb3a432268e5831":"USDC","0x3c499c542cef5e3811e1192ce70d8cc03d5c3359":"USDC","0x2791bca1f2de4661ed88a30c99a7a9449aa84174":"USDC",EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v:"USDC","0xdac17f958d2ee523a2206206994597c13d831ec7":"USDT","0x94b008aa00579c1307b0ef2c499ad98a8ce58e58":"USDT","0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9":"USDT","0xc2132d05d31c914a87c6611c10748aeb04b58e8f":"USDT",Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB:"USDT"},HTTP_STATUS_CODES:{SERVER_ERROR:500,TOO_MANY_REQUESTS:429,SERVICE_UNAVAILABLE:503,FORBIDDEN:403},UNSUPPORTED_NETWORK_NAME:"Unknown Network",SECURE_SITE_SDK_ORIGIN:(typeof Qr<"u"&&typeof Ex<"u"?Ex.NEXT_PUBLIC_SECURE_SITE_ORIGIN:void 0)||"https://secure.walletconnect.org",REMOTE_FEATURES_ALERTS:{MULTI_WALLET_NOT_ENABLED:{DEFAULT:{displayMessage:"Multi-Wallet Not Enabled",debugMessage:"Multi-wallet support is not enabled. Please enable it in your AppKit configuration at cloud.reown.com."},CONNECTIONS_HOOK:{displayMessage:"Multi-Wallet Not Enabled",debugMessage:"Multi-wallet support is not enabled. Please enable it in your AppKit configuration at cloud.reown.com to use the useAppKitConnections hook."},CONNECTION_HOOK:{displayMessage:"Multi-Wallet Not Enabled",debugMessage:"Multi-wallet support is not enabled. Please enable it in your AppKit configuration at cloud.reown.com to use the useAppKitConnection hook."}},HEADLESS_NOT_ENABLED:{DEFAULT:{displayMessage:"",debugMessage:"Headless support is not enabled. Please enable it with the features.headless option in the AppKit configuration and make sure your current plan supports it."}}},IS_DEVELOPMENT:typeof Qr<"u"&&!1,DEFAULT_ALLOWED_ANCESTORS:["http://localhost:*","https://localhost:*","http://127.0.0.1:*","https://127.0.0.1:*","https://*.pages.dev","https://*.vercel.app","https://*.ngrok-free.app","https://secure-mobile.walletconnect.com","https://secure-mobile.walletconnect.org"],METMASK_CONNECTOR_NAME:"MetaMask",TRUST_CONNECTOR_NAME:"Trust Wallet",SOLFLARE_CONNECTOR_NAME:"Solflare",PHANTOM_CONNECTOR_NAME:"Phantom",COIN98_CONNECTOR_NAME:"Coin98",MAGIC_EDEN_CONNECTOR_NAME:"Magic Eden",BACKPACK_CONNECTOR_NAME:"Backpack",BITGET_CONNECTOR_NAME:"Bitget Wallet",FRONTIER_CONNECTOR_NAME:"Frontier",XVERSE_CONNECTOR_NAME:"Xverse Wallet",LEATHER_CONNECTOR_NAME:"Leather",OKX_CONNECTOR_NAME:"OKX Wallet",BINANCE_CONNECTOR_NAME:"Binance Wallet",EIP155:"eip155",ADD_CHAIN_METHOD:"wallet_addEthereumChain",EIP6963_ANNOUNCE_EVENT:"eip6963:announceProvider",EIP6963_REQUEST_EVENT:"eip6963:requestProvider",CONNECTOR_RDNS_MAP:{coinbaseWallet:"com.coinbase.wallet",coinbaseWalletSDK:"com.coinbase.wallet"},CONNECTOR_TYPE_EXTERNAL:"EXTERNAL",CONNECTOR_TYPE_WALLET_CONNECT:"WALLET_CONNECT",CONNECTOR_TYPE_INJECTED:"INJECTED",CONNECTOR_TYPE_ANNOUNCED:"ANNOUNCED",CONNECTOR_TYPE_AUTH:"AUTH",CONNECTOR_TYPE_MULTI_CHAIN:"MULTI_CHAIN",CONNECTOR_TYPE_W3M_AUTH:"AUTH"},Tm={caipNetworkIdToNumber(t){return t?Number(t.split(":")[1]):void 0},parseEvmChainId(t){return typeof t=="string"?this.caipNetworkIdToNumber(t):t},getNetworksByNamespace(t,e){return(t==null?void 0:t.filter(r=>r.chainNamespace===e))||[]},getFirstNetworkByNamespace(t,e){return this.getNetworksByNamespace(t,e)[0]},getNetworkNameByCaipNetworkId(t,e){var s;if(!e)return;const r=t.find(i=>i.caipNetworkId===e);if(r)return r.name;const[n]=e.split(":");return((s=Y.CHAIN_NAME_MAP)==null?void 0:s[n])||void 0}},J$=["eip155","solana","polkadot","bip122","cosmos","sui","stacks"];var bG=20,wG=1,Id=1e6,vx=1e6,EG=-7,vG=21,_G=!1,i0="[big.js] ",qd=i0+"Invalid ",NA=qd+"decimal places",AG=qd+"roun
2ding mode",Q$=i0+"Division by zero",jt={},Uo=void 0,CG=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i;function X$(){function t(e){var r=this;if(!(r instanceof t))return e===Uo?X$():new t(e);if(e instanceof t)r.s=e.s,r.e=e.e,r.c=e.c.slice();else{if(typeof e!="string"){if(t.strict===!0&&typeof e!="bigint")throw TypeError(qd+"value");e=e===0&&1/e<0?"-0":String(e)}IG(r,e)}r.constructor=t}return t.prototype=jt,t.DP=bG,t.RM=wG,t.NE=EG,t.PE=vG,t.strict=_G,t.roundDown=0,t.roundHalfUp=1,t.roundHalfEven=2,t.roundUp=3,t}function IG(t,e){var r,n,s;if(!CG.test(e))throw Error(qd+"number");for(t.s=e.charAt(0)=="-"?(e=e.slice(1),-1):1,(r=e.indexOf("."))>-1&&(e=e.replace(".","")),(n=e.search(/e/i))>0?(r<0&&(r=n),r+=+e.slice(n+1),e=e.substring(0,n)):r<0&&(r=e.length),s=e.length,n=0;n<s&&e.charAt(n)=="0";)++n;if(n==s)t.c=[t.e=0];else{for(;s>0&&e.charAt(--s)=="0";);for(t.e=r-n-1,t.c=[],r=0;n<=s;)t.c[r++]=+e.charAt(n++)}return t}function zd(t,e,r,n){var s=t.c;if(r===Uo&&(r=t.constructor.RM),r!==0&&r!==1&&r!==2&&r!==3)throw Error(AG);if(e<1)n=r===3&&(n||!!s[0])||e===0&&(r===1&&s[0]>=5||r===2&&(s[0]>5||s[0]===5&&(n||s[1]!==Uo))),s.length=1,n?(t.e=t.e-e+1,s[0]=1):s[0]=t.e=0;else if(e<s.length){if(n=r===1&&s[e]>=5||r===2&&(s[e]>5||s[e]===5&&(n||s[e+1]!==Uo||s[e-1]&1))||r===3&&(n||!!s[0]),s.length=e,n){for(;++s[--e]>9;)if(s[e]=0,e===0){++t.e,s.unshift(1);break}}for(e=s.length;!s[--e];)s.pop()}return t}function Wd(t,e,r){var n=t.e,s=t.c.join(""),i=s.length;if(e)s=s.charAt(0)+(i>1?"."+s.slice(1):"")+(n<0?"e":"e+")+n;else if(n<0){for(;++n;)s="0"+s;s="0."+s}else if(n>0)if(++n>i)for(n-=i;n--;)s+="0";else n<i&&(s=s.slice(0,n)+"."+s.slice(n));else i>1&&(s=s.charAt(0)+"."+s.slice(1));return t.s<0&&r?"-"+s:s}jt.abs=function(){var t=new this.constructor(this);return t.s=1,t};jt.cmp=function(t){var e,r=this,n=r.c,s=(t=new r.constructor(t)).c,i=r.s,o=t.s,a=r.e,c=t.e;if(!n[0]||!s[0])return n[0]?i:s[0]?-o:0;if(i!=o)return i;if(e=i<0,a!=c)return a>c^e?1:-1;for(o=(a=n.length)<(c=s.length)?a:c,i=-1;++i<o;)if(n[i]!=s[i])return n[i]>s[i]^e?1:-1;return a==c?0:a>c^e?1:-1};jt.div=function(t){var e=this,r=e.constructor,n=e.c,s=(t=new r(t)).c,i=e.s==t.s?1:-1,o=r.DP;if(o!==~~o||o<0||o>Id)throw Error(NA);if(!s[0])throw Error(Q$);if(!n[0])return t.s=i,t.c=[t.e=0],t;var a,c,u,l,d,f=s.slice(),g=a=s.length,h=n.length,p=n.slice(0,a),y=p.length,w=t,I=w.c=[],v=0,E=o+(w.e=e.e-t.e)+1;for(w.s=i,i=E<0?0:E,f.unshift(0);y++<a;)p.push(0);do{for(u=0;u<10;u++){if(a!=(y=p.length))l=a>y?1:-1;else for(d=-1,l=0;++d<a;)if(s[d]!=p[d]){l=s[d]>p[d]?1:-1;break}if(l<0){for(c=y==a?s:f;y;){if(p[--y]<c[y]){for(d=y;d&&!p[--d];)p[d]=9;--p[d],p[y]+=10}p[y]-=c[y]}for(;!p[0];)p.shift()}else break}I[v++]=l?u:++u,p[0]&&l?p[y]=n[g]||0:p=[n[g]]}while((g++<h||p[0]!==Uo)&&i--);return!I[0]&&v!=1&&(I.shift(),w.e--,E--),v>E&&zd(w,E,r.RM,p[0]!==Uo),w};jt.eq=function(t){return this.cmp(t)===0};jt.gt=function(t){return this.cmp(t)>0};jt.gte=function(t){return this.cmp(t)>-1};jt.lt=function(t){return this.cmp(t)<0};jt.lte=function(t){return this.cmp(t)<1};jt.minus=jt.sub=function(t){var e,r,n,s,i=this,o=i.constructor,a=i.s,c=(t=new o(t)).s;if(a!=c)return t.s=-c,i.plus(t);var u=i.c.slice(),l=i.e,d=t.c,f=t.e;if(!u[0]||!d[0])return d[0]?t.s=-c:u[0]?t=new o(i):t.s=1,t;if(a=l-f){for((s=a<0)?(a=-a,n=u):(f=l,n=d),n.reverse(),c=a;c--;)n.push(0);n.reverse()}else for(r=((s=u.length<d.length)?u:d).length,a=c=0;c<r;c++)if(u[c]!=d[c]){s=u[c]<d[c];break}if(s&&(n=u,u=d,d=n,t.s=-t.s),(c=(r=d.length)-(e=u.length))>0)for(;c--;)u[e++]=0;for(c=e;r>a;){if(u[--r]<d[r]){for(e=r;e&&!u[--e];)u[e]=9;--u[e],u[r]+=10}u[r]-=d[r]}for(;u[--c]===0;)u.pop();for(;u[0]===0;)u.shift(),--f;return u[0]||(t.s=1,u=[f=0]),t.c=u,t.e=f,t};jt.mod=function(t){var e,r=this,n=r.constructor,s=r.s,i=(t=new n(t)).s;if(!t.c[0])throw Error(Q$);return r.s=t.s=1,e=t.cmp(r)==1,r.s=s,t.s=i,e?new n(r):(s=n.DP,i=n.RM,n.DP=n.RM=0,r=r.div(t),n.DP=s,n.RM=i,this.minus(r.times(t)))};jt.neg=function(){var t=new this.constructor(this);return t.s=-t.s,t};jt.plus=jt.add=function(t){var e,r,n,s=this,i=s.constructor;if(t=new i(t),s.s!=t.s)return t.s=-t.s,s.minus(t);var o=s.e,a=s.c,c=t.e,u=t.c;if(!a[0]||!u[0])return u[0]||(a[0]?t=new i(s):t.s=s.s),t;if(a=a.slice(),e=o-c){for(e>0?(c=o,n=u):(e=-e,n=a),n.reverse();e--;)n.push(0);n.reverse()}for(a.length-u.length<0&&(n=u,u=a,a=n),e=u.length,r=0;e;a[e]%=10)r=(a[--e]=a[e]+u[e]+r)/10|0;
2for(r&&(a.unshift(r),++c),e=a.length;a[--e]===0;)a.pop();return t.c=a,t.e=c,t};jt.pow=function(t){var e=this,r=new e.constructor("1"),n=r,s=t<0;if(t!==~~t||t<-vx||t>vx)throw Error(qd+"exponent");for(s&&(t=-t);t&1&&(n=n.times(e)),t>>=1,!!t;)e=e.times(e);return s?r.div(n):n};jt.prec=function(t,e){if(t!==~~t||t<1||t>Id)throw Error(qd+"precision");return zd(new this.constructor(this),t,e)};jt.round=function(t,e){if(t===Uo)t=0;else if(t!==~~t||t<-Id||t>Id)throw Error(NA);return zd(new this.constructor(this),t+this.e+1,e)};jt.sqrt=function(){var t,e,r,n=this,s=n.constructor,i=n.s,o=n.e,a=new s("0.5");if(!n.c[0])return new s(n);if(i<0)throw Error(i0+"No square root");i=Math.sqrt(+Wd(n,!0,!0)),i===0||i===1/0?(e=n.c.join(""),e.length+o&1||(e+="0"),i=Math.sqrt(e),o=((o+1)/2|0)-(o<0||o&1),t=new s((i==1/0?"5e":(i=i.toExponential()).slice(0,i.indexOf("e")+1))+o)):t=new s(i+""),o=t.e+(s.DP+=4);do r=t,t=a.times(r.plus(n.div(r)));while(r.c.slice(0,o).join("")!==t.c.slice(0,o).join(""));return zd(t,(s.DP-=4)+t.e+1,s.RM)};jt.times=jt.mul=function(t){var e,r=this,n=r.constructor,s=r.c,i=(t=new n(t)).c,o=s.length,a=i.length,c=r.e,u=t.e;if(t.s=r.s==t.s?1:-1,!s[0]||!i[0])return t.c=[t.e=0],t;for(t.e=c+u,o<a&&(e=s,s=i,i=e,u=o,o=a,a=u),e=new Array(u=o+a);u--;)e[u]=0;for(c=a;c--;){for(a=0,u=o+c;u>c;)a=e[u]+i[c]*s[u-c-1]+a,e[u--]=a%10,a=a/10|0;e[u]=a}for(a?++t.e:e.shift(),c=e.length;!e[--c];)e.pop();return t.c=e,t};jt.toExponential=function(t,e){var r=this,n=r.c[0];if(t!==Uo){if(t!==~~t||t<0||t>Id)throw Error(NA);for(r=zd(new r.constructor(r),++t,e);r.c.length<t;)r.c.push(0)}return Wd(r,!0,!!n)};jt.toFixed=function(t,e){var r=this,n=r.c[0];if(t!==Uo){if(t!==~~t||t<0||t>Id)throw Error(NA);for(r=zd(new r.constructor(r),t+r.e+1,e),t=t+r.e+1;r.c.length<t;)r.c.push(0)}return Wd(r,!1,!!n)};jt[Symbol.for("nodejs.util.inspect.custom")]=jt.toJSON=jt.toString=function(){var t=this,e=t.constructor;return Wd(t,t.e<=e.NE||t.e>=e.PE,!!t.c[0])};jt.toNumber=function(){var t=+Wd(this,!0,!0);if(this.constructor.strict===!0&&!this.eq(t.toString()))throw Error(i0+"Imprecise conversion");return t};jt.toPrecision=function(t,e){var r=this,n=r.constructor,s=r.c[0];if(t!==Uo){if(t!==~~t||t<1||t>Id)throw Error(qd+"precision");for(r=zd(new n(r),t,e);r.c.length<t;)r.c.push(0)}return Wd(r,t<=r.e||r.e<=n.NE||r.e>=n.PE,!!s)};jt.valueOf=function(){var t=this,e=t.constructor;if(e.strict===!0)throw Error(i0+"valueOf disallowed");return Wd(t,t.e<=e.NE||t.e>=e.PE,!0)};var oo=X$();const eL={bigNumber(t,e={safe:!1}){try{return t?new oo(t):new oo(0)}catch(r){if(e.safe)return new oo(0);throw r}},formatNumber(t,e){const{decimals:r,round:n=8,safe:s=!0}=e;return eL.bigNumber(t,{safe:s}).div(new oo(10).pow(r)).round(n)},multiply(t,e){if(t===void 0||e===void 0)return new oo(0);const r=new oo(t),n=new oo(e);return r.times(n)},toFixed(t,e=2){return t===void 0||t===""?new oo(0).toFixed(e):new oo(t).toFixed(e)},formatNumberToLocalString(t,e=2){return t===void 0||t===""?"0.00":typeof t=="number"?t.toLocaleString("en-US",{maximumFractionDigits:e,minimumFractionDigits:e,roundingMode:"floor"}):parseFloat(t).toLocaleString("en-US",{maximumFractionDigits:e,minimumFractionDigits:e,roundingMode:"floor"})},parseLocalStringToNumber(t){if(t===void 0||t==="")return 0;const e=t.replace(/,/gu,"");return new oo(e).toNumber()}},SG=[{type:"function",name:"transfer",stateMutability:"nonpayable",inputs:[{name:"_to",type:"address"},{name:"_value",type:"uint256"}],outputs:[{name:"",type:"bool"}]},{type:"function",name:"transferFrom",stateMutability:"nonpayable",inputs:[{name:"_from",type:"address"},{name:"_to",type:"address"},{name:"_value",type:"uint256"}],outputs:[{name:"",type:"bool"}]}],TG=[{type:"function",name:"approve",stateMutability:"nonpayable",inputs:[{name:"spender",type:"address"},{name:"amount",type:"uint256"}],outputs:[{type:"bool"}]}],PG=[{type:"function",name:"transfer",stateMutability:"nonpayable",inputs:[{name:"recipient",type:"address"},{name:"amount",type:"uint256"}],outputs:[]},{type:"function",name:"transferFrom",stateMutability:"nonpayable",inputs:[{name:"sender",type:"address"},{name:"recipient",type:"address"},{name:"amount",type:"uint256"}],outputs:[{name:"",type:"bool"}]}],OG={getERC20Abi:t=>Y.USDT_CONTRACT_ADDRESSES.includes(t)?PG:SG,getSwapAbi:()=>TG},Hs={ConnectorExplorerIds:{[Y.CONNECTOR_ID.COINBASE]:"d0ca99ff52b99abc48743dad0f7fc891e041be73574f7fac4afe5d4bb83845c8",[Y.CONNECTOR_ID.COINBASE_SDK]:"d0ca99ff52b99abc48743dad0f7fc891e041be73574f7fac4afe5d4bb83845c8",[Y.CONNECTOR_ID.BASE_ACCOUNT]:"fd20dc426fb37566d803205b19bbc1d4096b248ac04548e3cfb6b3a38bd033aa",[Y.CONNECTOR_ID.SAFE]:"225affb176778569276e484e1b92637ad061b01e13a048b35a9d280c3b58970f",[Y.CONNECTOR_ID.LEDGER]:"19177a98252e07ddfc9af2083ba8e07ef627cb6103467ffebb3f8f4205fd7927",[Y.CONNECTOR_ID.OKX]:"971e689d0a5be527bac79629b4ee9b925e82208e5168b733496
2a09c0faed0709",[Y.METMASK_CONNECTOR_NAME]:"c57ca95b47569778a828d19178114f4db188b89b763c899ba0be274e97267d96",[Y.TRUST_CONNECTOR_NAME]:"4622a2b2d6af1c9844944291e5e7351a6aa24cd7b23099efac1b2fd875da31a0",[Y.SOLFLARE_CONNECTOR_NAME]:"1ca0bdd4747578705b1939af023d120677c64fe6ca76add81fda36e350605e79",[Y.PHANTOM_CONNECTOR_NAME]:"a797aa35c0fadbfc1a53e7f675162ed5226968b44a19ee3d24385c64d1d3c393",[Y.COIN98_CONNECTOR_NAME]:"2a3c89040ac3b723a1972a33a125b1db11e258a6975d3a61252cd64e6ea5ea01",[Y.MAGIC_EDEN_CONNECTOR_NAME]:"8b830a2b724a9c3fbab63af6f55ed29c9dfa8a55e732dc88c80a196a2ba136c6",[Y.BACKPACK_CONNECTOR_NAME]:"2bd8c14e035c2d48f184aaa168559e86b0e3433228d3c4075900a221785019b0",[Y.BITGET_CONNECTOR_NAME]:"38f5d18bd8522c244bdd70cb4a68e0e718865155811c043f052fb9f1c51de662",[Y.FRONTIER_CONNECTOR_NAME]:"85db431492aa2e8672e93f4ea7acf10c88b97b867b0d373107af63dc4880f041",[Y.XVERSE_CONNECTOR_NAME]:"2a87d74ae02e10bdd1f51f7ce6c4e1cc53cd5f2c0b6b5ad0d7b3007d2b13de7b",[Y.LEATHER_CONNECTOR_NAME]:"483afe1df1df63daf313109971ff3ef8356ddf1cc4e45877d205eee0b7893a13",[Y.OKX_CONNECTOR_NAME]:"971e689d0a5be527bac79629b4ee9b925e82208e5168b733496a09c0faed0709",[Y.BINANCE_CONNECTOR_NAME]:"2fafea35bb471d22889ccb49c08d99dd0a18a37982602c33f696a5723934ba25"},ConnectorImageIds:{[Y.CONNECTOR_ID.COINBASE]:"0c2840c3-5b04-4c44-9661-fbd4b49e1800",[Y.CONNECTOR_ID.COINBASE_SDK]:"0c2840c3-5b04-4c44-9661-fbd4b49e1800",[Y.CONNECTOR_ID.BASE_ACCOUNT]:"bba2c8be-7fd1-463e-42b1-796ecb0ad200",[Y.CONNECTOR_ID.SAFE]:"461db637-8616-43ce-035a-d89b8a1d5800",[Y.CONNECTOR_ID.LEDGER]:"54a1aa77-d202-4f8d-0fb2-5d2bb6db0300",[Y.CONNECTOR_ID.WALLET_CONNECT]:"ef1a1fcf-7fe8-4d69-bd6d-fda1345b4400",[Y.CONNECTOR_ID.INJECTED]:"07ba87ed-43aa-4adf-4540-9e6a2b9cae00"},ConnectorNamesMap:{[Y.CONNECTOR_ID.INJECTED]:"Browser Wallet",[Y.CONNECTOR_ID.WALLET_CONNECT]:"WalletConnect",[Y.CONNECTOR_ID.COINBASE]:"Coinbase",[Y.CONNECTOR_ID.COINBASE_SDK]:"Coinbase",[Y.CONNECTOR_ID.BASE_ACCOUNT]:"Base Account",[Y.CONNECTOR_ID.LEDGER]:"Ledger",[Y.CONNECTOR_ID.SAFE]:"Safe"},ConnectorTypesMap:{[Y.CONNECTOR_ID.INJECTED]:"INJECTED",[Y.CONNECTOR_ID.WALLET_CONNECT]:"WALLET_CONNECT",[Y.CONNECTOR_ID.EIP6963]:"ANNOUNCED",[Y.CONNECTOR_ID.AUTH]:"AUTH",[Y.CONNECTOR_ID.COINBASE]:"EXTERNAL",[Y.CONNECTOR_ID.COINBASE_SDK]:"EXTERNAL",[Y.CONNECTOR_ID.BASE_ACCOUNT]:"EXTERNAL"}},Rr={validateCaipAddress(t){var e;if(((e=t.split(":"))==null?void 0:e.length)!==3)throw new Error("Invalid CAIP Address");return t},parseCaipAddress(t){const e=t.split(":");if(e.length!==3)throw new Error(`Invalid CAIP-10 address: ${t}`);const[r,n,s]=e;if(!r||!n||!s)throw new Error(`Invalid CAIP-10 address: ${t}`);return{chainNamespace:r,chainId:n,address:s}},parseCaipNetworkId(t){const e=t.split(":");if(e.length!==2)throw new Error(`Invalid CAIP-2 network id: ${t}`);const[r,n]=e;if(!r||!n)throw new Error(`Invalid CAIP-2 network id: ${t}`);return{chainNamespace:r,chainId:n}}},Oo={RPC_ERROR_CODE:{USER_REJECTED_REQUEST:4001,USER_REJECTED_METHODS:5002,USER_REJECTED:5e3,SEND_TRANSACTION_ERROR:5001},PROVIDER_RPC_ERROR_NAME:{PROVIDER_RPC:"ProviderRpcError",USER_REJECTED_REQUEST:"UserRejectedRequestError",SEND_TRANSACTION_ERROR:"SendTransactionError"},isRpcProviderError(t){try{if(typeof t=="object"&&t!==null){const e=t,r=typeof e.message=="string",n=typeof e.code=="number";return r&&n}return!1}catch{return!1}},isUserRejectedMessage(t){return t.toLowerCase().includes("user rejected")||t.toLowerCase().includes("user cancelled")||t.toLowerCase().includes("user canceled")},isUserRejectedRequestError(t){if(Oo.isRpcProviderError(t)){const e=t.code===Oo.RPC_ERROR_CODE.USER_REJECTED_REQUEST,r=t.code===Oo.RPC_ERROR_CODE.USER_REJECTED_METHODS;return e||r||Oo.isUserRejectedMessage(t.message)}return t instanceof Error?Oo.isUserRejectedMessage(t.message):!1}};let NG=class extends Error{constructor(e,r){super(r.message,{cause:e}),this.name=Oo.PROVIDER_RPC_ERROR_NAME.PROVIDER_RPC,this.code=r.code}},MP=class extends NG{constructor(e){super(e,{code:Oo.RPC_ERROR_CODE.USER_REJECTED_REQUEST,message:"User rejected the request"}),this.name=Oo.PROVIDER_RPC_ERROR_NAME.USER_REJECTED_REQUEST}};const Le={WALLET_ID:"@appkit/wallet_id",WALLET_NAME:"@appkit/wallet_name",SOLANA_WALLET:"@appkit/solana_wallet",SOLANA_CAIP_CHAIN:"@appkit/solana_caip_chain",ACTIVE_CAIP_NETWORK_ID:"@appkit/active_caip_network_id",CONNECTED_SOCIAL:"@appkit/connected_social",CONNECTED_SOCIAL_USERNAME:"@appkit-wallet/SOCIAL_USERNAME",RECENT_WALLETS:"@appkit/recent_wallets",RECENT_WALLET:"@appkit/recent_wallet",DEEPLINK_CHOICE:"WALLETCONNECT_DEEPLINK_CHOICE",ACTIVE_NAMESPACE:"@appkit/active_namespace",CONNECTED_NAMESPACES:"@appkit/connected_namespaces",CONNECTION_STATUS:"@appkit/connection_status",SIWX_AUTH_TOKEN:"@appkit/siwx-auth-token",SIWX_NONCE_TOKEN:"@appkit/siwx-nonce-token",TELEGRAM_SOCIAL_PROVIDER:"@appkit/social_provider",NATIVE_BALANCE_CACHE:"@appkit/native_balance_cache",PORTFOLIO_CACHE:"@appkit/portfolio_cac
2he",ENS_CACHE:"@appkit/ens_cache",IDENTITY_CACHE:"@appkit/identity_cache",PREFERRED_ACCOUNT_TYPES:"@appkit/preferred_account_types",CONNECTIONS:"@appkit/connections",DISCONNECTED_CONNECTOR_IDS:"@appkit/disconnected_connector_ids",HISTORY_TRANSACTIONS_CACHE:"@appkit/history_transactions_cache",TOKEN_PRICE_CACHE:"@appkit/token_price_cache",RECENT_EMAILS:"@appkit/recent_emails",LATEST_APPKIT_VERSION:"@appkit/latest_version",TON_WALLETS_CACHE:"@appkit/ton_wallets_cache"};function E2(t){if(!t)throw new Error("Namespace is required for CONNECTED_CONNECTOR_ID");return`@appkit/${t}:connected_connector_id`}const Ue={setItem(t,e){bm()&&e!==void 0&&localStorage.setItem(t,e)},getItem(t){if(bm())return localStorage.getItem(t)||void 0},removeItem(t){bm()&&localStorage.removeItem(t)},clear(){bm()&&localStorage.clear()}};function bm(){return typeof window<"u"&&typeof localStorage<"u"}function Wm(t,e){const r=(t==null?void 0:t["--apkt-accent"])??(t==null?void 0:t["--w3m-accent"]);return e==="light"?{"--w3m-accent":r||"hsla(231, 100%, 70%, 1)","--w3m-background":"#fff"}:{"--w3m-accent":r||"hsla(230, 100%, 67%, 1)","--w3m-background":"#202020"}}var _x={};const v2=(typeof Qr<"u"&&typeof _x<"u"?_x.NEXT_PUBLIC_SECURE_SITE_ORIGIN:void 0)||"https://secure.walletconnect.org",tL=[{label:"Meld.io",name:"meld",feeRange:"1-2%",url:"https://meldcrypto.com",supportedChains:["eip155","solana"]}],xG="WXETMuFUQmqqybHuRkSgxv:25B8LJHSfpG6LVjR2ytU5Cwh7Z4Sch2ocoU",lt={FOUR_MINUTES_MS:24e4,TEN_SEC_MS:1e4,FIVE_SEC_MS:5e3,THREE_SEC_MS:3e3,ONE_SEC_MS:1e3,SECURE_SITE:v2,SECURE_SITE_DASHBOARD:`${v2}/dashboard`,SECURE_SITE_FAVICON:`${v2}/images/favicon.png`,SOLANA_NATIVE_TOKEN_ADDRESS:"So11111111111111111111111111111111111111111",RESTRICTED_TIMEZONES:["ASIA/SHANGHAI","ASIA/URUMQI","ASIA/CHONGQING","ASIA/HARBIN","ASIA/KASHGAR","ASIA/MACAU","ASIA/HONG_KONG","ASIA/MACAO","ASIA/BEIJING","ASIA/HARBIN"],SWAP_SUGGESTED_TOKENS:["ETH","UNI","1INCH","AAVE","SOL","ADA","AVAX","DOT","LINK","NITRO","GAIA","MILK","TRX","NEAR","GNO","WBTC","DAI","WETH","USDC","USDT","ARB","BAL","BICO","CRV","ENS","MATIC","OP"],SWAP_POPULAR_TOKENS:["ETH","UNI","1INCH","AAVE","SOL","ADA","AVAX","DOT","LINK","NITRO","GAIA","MILK","TRX","NEAR","GNO","WBTC","DAI","WETH","USDC","USDT","ARB","BAL","BICO","CRV","ENS","MATIC","OP","METAL","DAI","CHAMP","WOLF","SALE","BAL","BUSD","MUST","BTCpx","ROUTE","HEX","WELT","amDAI","VSQ","VISION","AURUM","pSP","SNX","VC","LINK","CHP","amUSDT","SPHERE","FOX","GIDDY","GFC","OMEN","OX_OLD","DE","WNT"],SUGGESTED_TOKENS_BY_CHAIN:{"eip155:42161":["USD₮0"]},BALANCE_SUPPORTED_CHAINS:[Y.CHAIN.EVM,Y.CHAIN.SOLANA],SEND_PARAMS_SUPPORTED_CHAINS:[Y.CHAIN.EVM],SWAP_SUPPORTED_NETWORKS:["eip155:1","eip155:42161","eip155:10","eip155:324","eip155:8453","eip155:56","eip155:137","eip155:100","eip155:43114","eip155:250","eip155:8217","eip155:1313161554"],NAMES_SUPPORTED_CHAIN_NAMESPACES:[Y.CHAIN.EVM],ONRAMP_SUPPORTED_CHAIN_NAMESPACES:[Y.CHAIN.EVM,Y.CHAIN.SOLANA],PAY_WITH_EXCHANGE_SUPPORTED_CHAIN_NAMESPACES:[Y.CHAIN.EVM,Y.CHAIN.SOLANA],ACTIVITY_ENABLED_CHAIN_NAMESPACES:[Y.CHAIN.EVM,Y.CHAIN.TON],NATIVE_TOKEN_ADDRESS:{eip155:"0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",solana:"So11111111111111111111111111111111111111111",polkadot:"0x",bip122:"0x",cosmos:"0x",sui:"0x",stacks:"0x",ton:"0x",tron:"0x"},CONVERT_SLIPPAGE_TOLERANCE:1,CONNECT_LABELS:{MOBILE:"Open and continue in the wallet app",WEB:"Open and continue in the wallet app"},SEND_SUPPORTED_NAMESPACES:[Y.CHAIN.EVM,Y.CHAIN.SOLANA],DEFAULT_REMOTE_FEATURES:{swaps:["1inch"],onramp:["meld"],email:!0,socials:["google","x","discord","farcaster","github","apple","facebook"],activity:!0,reownBranding:!0,multiWallet:!1,emailCapture:!1,payWithExchange:!1,payments:!1,reownAuthentication:!1,headless:!1},DEFAULT_REMOTE_FEATURES_DISABLED:{email:!1,socials:!1,swaps:!1,onramp:!1,activity:!1,reownBranding:!1,emailCapture:!1,reownAuthentication:!1,headless:!1},DEFAULT_FEATURES:{receive:!0,send:!0,emailShowWallets:!0,connectorTypeOrder:["walletConnect","recent","injected","featured","custom","external","recommended"],analytics:!0,allWallets:!0,legalCheckbox:!1,smartSessions:!1,collapseWallets:!1,walletFeaturesOrder:["onramp","swaps","receive","send"],connectMethodsOrder:void 0,pay:!1,reownAuthentication:!1,headless:!1},DEFAULT_SOCIALS:["google","x","farcaster","discord","apple","github","facebook"],DEFAULT_ACCOUNT_TYPES:{b
vendor: 12,238 bytes, line 2
2ip122:"payment",eip155:"smartAccount",polkadot:"eoa",solana:"eoa",ton:"eoa",tron:"eoa"},ADAPTER_TYPES:{UNIVERSAL:"universal",SOLANA:"solana",WAGMI:"wagmi",ETHERS:"ethers",ETHERS5:"ethers5",BITCOIN:"bitcoin"},SIWX_DEFAULTS:{signOutOnDisconnect:!0},MANDATORY_WALLET_IDS_ON_MOBILE:[Hs.ConnectorExplorerIds[Y.CONNECTOR_ID.COINBASE],Hs.ConnectorExplorerIds[Y.CONNECTOR_ID.COINBASE_SDK],Hs.ConnectorExplorerIds[Y.CONNECTOR_ID.BASE_ACCOUNT],Hs.ConnectorExplorerIds[Y.SOLFLARE_CONNECTOR_NAME],Hs.ConnectorExplorerIds[Y.PHANTOM_CONNECTOR_NAME],Hs.ConnectorExplorerIds[Y.BINANCE_CONNECTOR_NAME]],DEFAULT_CONNECT_METHOD_ORDER:["email","social","wallet"]},ce={cacheExpiry:{portfolio:3e4,nativeBalance:3e4,ens:3e5,identity:3e5,transactionsHistory:15e3,tokenPrice:15e3,latestAppKitVersion:6048e5,tonWallets:864e5},isCacheExpired(t,e){return Date.now()-t>e},getActiveNetworkProps(){const t=ce.getActiveNamespace(),e=ce.getActiveCaipNetworkId(),r=e?e.split(":")[1]:void 0,n=r?isNaN(Number(r))?r:Number(r):void 0;return{namespace:t,caipNetworkId:e,chainId:n}},setWalletConnectDeepLink({name:t,href:e}){try{Ue.setItem(Le.DEEPLINK_CHOICE,JSON.stringify({href:e,name:t}))}catch{console.info("Unable to set WalletConnect deep link")}},getWalletConnectDeepLink(){try{const t=Ue.getItem(Le.DEEPLINK_CHOICE);if(t)return JSON.parse(t)}catch{console.info("Unable to get WalletConnect deep link")}},deleteWalletConnectDeepLink(){try{Ue.removeItem(Le.DEEPLINK_CHOICE)}catch{console.info("Unable to delete WalletConnect deep link")}},setActiveNamespace(t){try{Ue.setItem(Le.ACTIVE_NAMESPACE,t)}catch{console.info("Unable to set active namespace")}},setActiveCaipNetworkId(t){try{Ue.setItem(Le.ACTIVE_CAIP_NETWORK_ID,t),ce.setActiveNamespace(t.split(":")[0])}catch{console.info("Unable to set active caip network id")}},getActiveCaipNetworkId(){try{return Ue.getItem(Le.ACTIVE_CAIP_NETWORK_ID)}catch{console.info("Unable to get active caip network id");return}},deleteActiveCaipNetworkId(){try{Ue.removeItem(Le.ACTIVE_CAIP_NETWORK_ID)}catch{console.info("Unable to delete active caip network id")}},deleteConnectedConnectorId(t){try{const e=E2(t);Ue.removeItem(e)}catch{console.info("Unable to delete connected connector id")}},setAppKitRecent(t){try{const e=ce.getRecentWallets();e.find(n=>n.id===t.id)||(e.unshift(t),e.length>2&&e.pop(),Ue.setItem(Le.RECENT_WALLETS,JSON.stringify(e)),Ue.setItem(Le.RECENT_WALLET,JSON.stringify(t)))}catch{console.info("Unable to set AppKit recent")}},getRecentWallets(){try{const t=Ue.getItem(Le.RECENT_WALLETS);return t?JSON.parse(t):[]}catch{console.info("Unable to get AppKit recent")}return[]},getRecentWallet(){try{const t=Ue.getItem(Le.RECENT_WALLET);return t?JSON.parse(t):null}catch{console.info("Unable to get AppKit recent")}return null},deleteRecentWallet(){try{Ue.removeItem(Le.RECENT_WALLET)}catch{console.info("Unable to delete AppKit recent")}},setConnectedConnectorId(t,e){try{const r=E2(t);Ue.setItem(r,e)}catch{console.info("Unable to set Connected Connector Id")}},getActiveNamespace(){try{return Ue.getItem(Le.ACTIVE_NAMESPACE)}catch{console.info("Unable to get active namespace")}},getConnectedConnectorId(t){if(t)try{const e=E2(t);return Ue.getItem(e)}catch{console.info("Unable to get connected connector id in namespace",t)}},setConnectedSocialProvider(t){try{Ue.setItem(Le.CONNECTED_SOCIAL,t)}catch{console.info("Unable to set connected social provider")}},getConnectedSocialProvider(){try{return Ue.getItem(Le.CONNECTED_SOCIAL)}catch{console.info("Unable to get connected social provider")}},deleteConnectedSocialProvider(){try{Ue.removeItem(Le.CONNECTED_SOCIAL)}catch{console.info("Unable to delete connected social provider")}},getConnectedSocialUsername(){try{return Ue.getItem(Le.CONNECTED_SOCIAL_USERNAME)}catch{console.info("Unable to get connected social username")}},getStoredActiveCaipNetworkId(){var r;const t=Ue.getItem(Le.ACTIVE_CAIP_NETWORK_ID);return(r=t==null?void 0:t.split(":"))==null?void 0:r[1]},setConnectionStatus(t){try{Ue.setItem(Le.CONNECTION_STATUS,t)}catch{console.info("Unable to set connection status")}},getConnectionStatus(){try{return Ue.getItem(Le.CONNECTION_STATUS)}catch{return}},getConnectedNamespaces(){try{const t=Ue.getItem(Le.CONNECTED_NAMESPACES);return t!=null&&t.length?t.split(","):[]}catch{return[]}},setConnectedNamespaces(t){try{const e=Array.from(new Set(t));Ue.setItem(Le.CONNECTED_NAMESPACES,e.join(","))}catch{console.info("Unable to set namespaces in storage")}},addConnectedNamespace(t){try{const e=ce.getConnectedNamespaces();e.includes(t)||(e.push(t),ce.setConnectedNamespaces(e))}catch{console.info("Unable to add connected namespace")}},removeConnectedNamespace(t){try{const e=ce.getConnectedNamespaces(),r=e.indexOf(t);r>-1&&(e.splice(r,1),ce.setConnectedNamespaces(e))}catch{console.info("Unable to remove connected namespace")}},getTelegramSocialProvider(){try{return Ue.getItem(Le.TELEGRAM_SOCIAL_PROVIDER)}catch{return console.info("Unable to get telegram social provider"),null}},setTelegramSocialProvider(t){try{Ue.setItem(Le.TELEGRAM_SOCIAL_PROVIDER,t)}catch{console.info("Unable to set telegram social provider")}},removeTelegramSocialProvider(){try{Ue.removeItem(Le.TELEGRAM_SOCIAL_PROVIDER)}catch{console.info("Unable to remove telegram social provider")}},getBalanceCache(){let t={};try{const e=Ue.getItem(Le.PORTFOLIO_CACHE);t=e?JSON.parse(e):{}}catch{console.info("Unable to get balance cache")}return t},removeAddressFromBalanceCache(t){try{const e=ce.getBalanceCache();Ue.setItem(Le.PORTFOLIO_CACHE,JSON.stringify({...e,[t]:void 0}))}catch{console.info("Unable to remove address from balance cache",t)}},getBalanceCacheForCaipAddress(t){try{const r=ce.getBalanceCache()[t];if(r&&!this.isCacheExpired(r.timestamp,this.cacheExpiry.portfolio))return r.balance;ce.removeAddressFromBalanceCache(t)}catch{console.info("Unable to get balance cache for address",t)}},updateBalanceCache(t){try{const e=ce.getBalanceCache();e[t.caipAddress]=t,Ue.setItem(Le.PORTFOLIO_CACHE,JSON.stringify(e))}catch{console.info("Unable to update balance cache",t)}},getNativeBalanceCache(){let t={};try{const e=Ue.getItem(Le.NATIVE_BALANCE_CACHE);t=e?JSON.parse(e):{}}catch{console.info("Unable to get balance cache")}return t},removeAddressFromNativeBalanceCache(t){try{const e=ce.getBalanceCache();Ue.setItem(Le.NATIVE_BALANCE_CACHE,JSON.stringify({...e,[t]:void 0}))}catch{console.info("Unable to remove address from balance cache",t)}},getNativeBalanceCacheForCaipAddress(t){try{const r=ce.getNativeBalanceCache()[t];if(r&&!this.isCacheExpired(r.timestamp,this.cacheExpiry.nativeBalance))return r;console.info("Discarding cache for address",t),ce.removeAddressFromBalanceCache(t)}catch{console.info("Unable to get balance cache for address",t)}},updateNativeBalanceCache(t){try{const e=ce.getNativeBalanceCache();e[t.caipAddress]=t,Ue.setItem(Le.NATIVE_BALANCE_CACHE,JSON.stringify(e))}catch{console.info("Unable to update balance cache",t)}},getEnsCache(){let t={};try{const e=Ue.getItem(Le.ENS_CACHE);t=e?JSON.parse(e):{}}catch{console.info("Unable to get ens name cache")}return t},getEnsFromCacheForAddress(t){try{const r=ce.getEnsCache()[t];if(r&&!this.isCacheExpired(r.timestamp,this.cacheExpiry.ens))return r.ens;ce.removeEnsFromCache(t)}catch{console.info("Unable to get ens name from cache",t)}},updateEnsCache(t){try{const e=ce.getEnsCache();e[t.address]=t,Ue.setItem(Le.ENS_CACHE,JSON.stringify(e))}catch{console.info("Unable to update ens name cache",t)}},removeEnsFromCache(t){try{const e=ce.getEnsCache();Ue.setItem(Le.ENS_CACHE,JSON.stringify({...e,[t]:void 0}))}catch{console.info("Unable to remove ens name from cache",t)}},getIdentityCache(){let t={};try{const e=Ue.getItem(Le.IDENTITY_CACHE);t=e?JSON.parse(e):{}}catch{console.info("Unable to get identity cache")}return t},getIdentityFromCacheForAddress(t){try{const r=ce.getIdentityCache()[t];if(r&&!this.isCacheExpired(r.timestamp,this.cacheExpiry.identity))return r.identity;ce.removeIdentityFromCache(t)}catch{console.info("Unable to get identity from cache",t)}},updateIdentityCache(t){try{const e=ce.getIdentityCache();e[t.address]={identity:t.identity,timestamp:t.timestamp},Ue.setItem(Le.IDENTITY_CACHE,JSON.stringify(e))}catch{console.info("Unable to update identity cache",t)}},removeIdentityFromCache(t){try{const e=ce.getIdentityCache();Ue.setItem(Le.IDENTITY_CACHE,JSON.stringify({...e,[t]:void 0}))}catch{console.info("Unable to remove identity from cache",t)}},getTonWalletsCache(){try{const t=Ue.getItem(Le.TON_WALLETS_CACHE),e=t?JSON.parse(t):void 0;if(e&&!this.isCacheExpired(e.timestamp,this.cacheExpiry.tonWallets))return e;ce.removeTonWalletsCache()}catch{console.info("Unable to get ton wallets cache")}},updateTonWalletsCache(t){try{const e=ce.getTonWalletsCache()||{timestamp:0,wallets:[]};e.timestamp=new Date().getTime(),e.wallets=t,Ue.setItem(Le.TON_WALLETS_CACHE,JSON.stringify(e))}catch{console.info("Unable to update ton wallets cache",t)}},removeTonWalletsCache(){try{Ue.removeItem(Le.TON_WALLETS_CACHE)}catch{console.info("Unable to remove ton wallets cache")}},clearAddressCache(){try{Ue.removeItem(Le.PORTFOLIO_CACHE),Ue.removeItem(Le.NATIVE_BALANCE_CACHE),Ue.removeItem(Le.ENS_CACHE),Ue.removeItem(Le.IDENTITY_CACHE),Ue.removeItem(Le.HISTORY_TRANSACTIONS_CACHE)}catch{console.info("Unable to clear address cache")}},setPreferredAccountTypes(t){try{Ue.setItem(Le.PREFERRED_ACCOUNT_TYPES,JSON.stringify(t))}catch{console.info("Unable to set preferred account types",t)}},getPreferredAccountTypes(){try{const t=Ue.getItem(Le.PREFERRED_ACCOUNT_TYPES);return t?JSON.parse(t):{}}catch{console.info("Unable to get preferred account types")}return{}},setConnections(t,e){try{const r=ce.getConnections(),n=r[e]??[],s=new Map;for(const o of n)s.set(o.connectorId,{...o});for(const o of t){const a=s.get(o.connectorId),c=o.connectorId===Y.CONNECTOR_ID.AUTH;if(a&&!c){const u=new Set(a.accounts.map(d=>d.address.toLowerCase())),l=o.accounts.filter(d=>!u.has(d.address.toLowerCase()));a.accounts.push(...l)}else s.set(o.connectorId,{...o})}const i={...r,[e]:Array.from(s.values())};Ue.setItem(Le.CONNECTIONS,JSON.stringify(i))}catch(r){console.error("Unable to sync connections to storage",r)}},getConnections(){try{const t=Ue.getItem(Le.CONNECTIONS);return t?JSON.parse(t):{}}catch(t){return console.error("Unable to get connections from storage",t),{}}},deleteAddressFromConnection({connectorId:t,address:e,namespace:r}){try{const n=ce.getConnections(),s=n[r]??[],i=new Map(s.map(a=>[a.connectorId,a])),o=i.get(t);o&&(o.accounts.filter(c=>c.address.toLowerCase()!==e.toLowerCase()).length===0?i.delete(t):i.set(t,{...o,accounts:o.accounts.filter(c=>c.address.toLowerCase()!==e.toLowerCase())})),Ue.setItem(Le.CONNECTIONS,JSON.stringify({...n,[r]:Array.from(i.values())}))}catch{console.error(`Unable to remove address "${e}" from connector "${t}" in namespace "${r}"`)}},getDisconnectedConnectorIds(){try{const t=Ue.getItem(Le.DISCONNECTED_CONNECTOR_IDS);return t?JSON.parse(t):{}}catch{console.info("Unable to get disconnected connector ids")}return{}},addDisconnectedConnectorId(t,e){try{const r=ce.getDisconnectedConnectorIds(),n=r[e]??[];n.push(t),Ue.setItem(Le.DISCONNECTED_CONNECTOR_IDS,JSON.stringify({...r,[e]:Array.from(new Set(n))}))}catch{console.error(`Unable to set disconnected connector id "${t}" for namespace "${e}"`)}},removeDisconnectedConnectorId(t,e){try{const r=ce.getDisconnectedConnectorIds();let n=r[e]??[];n=n.filter(s=>s.toLowerCase()!==t.toLowerCase()),Ue.setItem(Le.DISCONNECTED_CONNECTOR_IDS,JSON.stringify({...r,[e]:Array.from(new Set(n))}))}catch{console.error(`Unable to remove disconnected connector id "${t}" for namespace "${e}"`)}},isConnectorDisconnected(t,e){try{return(ce.getDisconnectedConnectorIds()[e]??[]).some(s=>s.toLowerCase()===t.toLowerCase())}catch{console.info(`Unable to get disconnected connector id "${t}" for namespace "${e}"`)}return!1},getTransactionsCache(){try{const t=Ue.getItem(Le.HISTORY_TRANSACTIONS_CACHE);return t?JSON.parse(t):{}}catch{console.info("Unable to get transactions cache")}return{}},getTransactionsCacheForAddress({address:t,chainId:e=""}){var r;try{const s=(r=ce.getTransactionsCache()[t])==null?void 0:r[e];if(s&&!this.isCacheExpired(s.timestamp,this.cacheExpiry.transactionsHistory)
2)return s.transactions;ce.removeTransactionsCache({address:t,chainId:e})}catch{console.info("Unable to get transactions cache")}},updateTransactionsCache({address:t,chainId:e="",timestamp:r,transactions:n}){try{const s=ce.getTransactionsCache();s[t]={...s[t],[e]:{timestamp:r,transactions:n}},Ue.setItem(Le.HISTORY_TRANSACTIONS_CACHE,JSON.stringify(s))}catch{console.info("Unable to update transactions cache",{address:t,chainId:e,timestamp:r,transactions:n})}},removeTransactionsCache({address:t,chainId:e}){try{const r=ce.getTransactionsCache(),n=(r==null?void 0:r[t])||{},{[e]:s,...i}=n;Ue.setItem(Le.HISTORY_TRANSACTIONS_CACHE,JSON.stringify({...r,[t]:i}))}catch{console.info("Unable to remove transactions cache",{address:t,chainId:e})}},getTokenPriceCache(){try{const t=Ue.getItem(Le.TOKEN_PRICE_CACHE);return t?JSON.parse(t):{}}catch{console.info("Unable to get token price cache")}return{}},getTokenPriceCacheForAddresses(t){try{const r=ce.getTokenPriceCache()[t.join(",")];if(r&&!this.isCacheExpired(r.timestamp,this.cacheExpiry.tokenPrice))return r.tokenPrice;ce.removeTokenPriceCache(t)}catch{console.info("Unable to get token price cache for addresses",t)}},updateTokenPriceCache(t){try{const e=ce.getTokenPriceCache();e[t.addresses.join(",")]={timestamp:t.timestamp,tokenPrice:t.tokenPrice},Ue.setItem(Le.TOKEN_PRICE_CACHE,JSON.stringify(e))}catch{console.info("Unable to update token price cache",t)}},removeTokenPriceCache(t){try{const e=ce.getTokenPriceCache();Ue.setItem(Le.TOKEN_PRICE_CACHE,JSON.stringify({...e,[t.join(",")]:void 0}))}catch{console.info("Unable to remove token price cache",t)}},getLatestAppKitVersion(){try{const t=this.getLatestAppKitVersionCache(),e=t==null?void 0:t.version;return e&&!this.isCacheExpired(t.timestamp,this.cacheExpiry.latestAppKitVersion)?e:void 0}catch{console.info("Unable to get latest AppKit version")}},getLatestAppKitVersionCache(){try{const t=Ue.getItem(Le.LATEST_APPKIT_VERSION);return t?JSON.parse(t):{}}catch{console.info("Unable to get latest AppKit version cache")}return{}},updateLatestAppKitVersion(t){try{const e=ce.getLatestAppKitVersionCache();e.timestamp=t.timestamp,e.version=t.version,Ue.setItem(Le.LATEST_APPKIT_VERSION,JSON.stringify(e))}catch{console.info("Unable to update latest AppKit version on local storage",t)}}},be={getWindow(){if(!(typeof window>"u"))return window},isMobile(){var t;return this.isClient()?!!(window!=null&&window.matchMedia&&typeof window.matchMedia=="function"&&((t=window.matchMedia("(pointer:coarse)"))!=null&&t.matches)||/Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini/u.test(navigator.userAgent)):!1},checkCaipNetwork(t,e=""){return t==null?void 0:t.caipNetworkId.toLocaleLowerCase().includes(e.toLowerCase())},isAndroid(){if(!this.isMobile())return!1;const t=window==null?void 0:window.navigator.userAgent.toLowerCase();return be.isMobile()&&t.includes("android")},isIos(){if(!this.isMobile())return!1;const t=window==null?void 0:window.navigator.userAgent.toLowerCase();return t.includes("iphone")||t.includes("ipad")},isSafari(){return this.isClient()?(window==null?void 0:window.navigator.userAgent.toLowerCase()).includes("safari"):!1},isClient(){return typeof window<"u"},isPairingExpired(t){return t?t-Date.now()<=lt.TEN_SEC_MS:!0},isAllowedRetry(t,e=lt.ONE_SEC_MS){return Date.now()-t>=e},copyToClopboard(t){navigator.clipboard.writeText(t)},isIframe(){try{return(window==null?void 0:window.self)!==(window==null?void 0:window.top)}catch{return!1}},isSafeApp(){var t,e;if(be.isClient()&&window.self!==window.top)try{const r=(e=(t=window==null?void 0:window.location)==null?void 0:t.ancestorOrigins)==null?void 0:e[0],n="https://app.safe.global";if(r){const s=new URL(r),i=new URL(n);return s.hostname===i.hostname}}catch{return!1}return!1},getPairingExpiry(){return Date.now()+lt.FOUR_MINUTES_MS},getNetworkId(t){return t==null?void 0:t.split(":")[1]},getPlainAddress(t){return t==null?void 0:t.split(":")[2]},async wait(t){return new Promise(e=>{setTimeout(e,t)})},debounce(t,e=500){let r;return(...n)=>{function s(){t(...n)}r&&clearTimeout(r),r=setTimeout(s,e)}},isHttpUrl(t){return t.startsWith("http://")||t.startsWith("https://")},formatNativeUrl(t,e,r=null){if(be.isHttpUrl(t))return this.formatUniversalUrl(t,e);let n=t,s=r;n.includes("://")||(n=t.replaceAll("/","").replaceAll(":",""),n=`${n}://`),n.endsWith("/")||(n=`${n}/`),s&&!(s!=null&&s.endsWith("/"))&&(s=`${s}/`),this.isTelegram()&&this.isAndroid()&&(e=encodeURIComponent(e));const i=encodeURIComponent(e);return{redirect:`${n}wc?uri=${i}`,redirectUniversalLink:s?`${s}wc?uri=${i}`:void 0,href:n,universalHref:s??void 0}},formatUniversalUrl(t,e){if(!be.isHttpUrl(t))return this.formatNativeUrl(t,e);let r=t;r.endsWith("/")||(r=`${r}/`);const n=encodeURIComponent(e);return{redirect:`${r}wc?uri=${n}`,href:r}},getOpenTargetForPlatform(t){return t==="popupWindow"?t:this.isTelegram()?ce.getTelegramSocialProvider()?"_top":"_blank":t},openHref(t,e,r){window==null||window.open(t,this.getOpenTargetForPlatform(e),r||"n
2oreferrer noopener")},returnOpenHref(t,e,r){return window==null?void 0:window.open(t,this.getOpenTargetForPlatform(e),r||"noreferrer noopener")},isTelegram(){return typeof window<"u"&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)},isPWA(){var r,n;if(typeof window>"u")return!1;const t=window!=null&&window.matchMedia&&typeof window.matchMedia=="function"?(r=window.matchMedia("(display-mode: standalone)"))==null?void 0:r.matches:!1,e=(n=window==null?void 0:window.navigator)==null?void 0:n.standalone;return!!(t||e)},async preloadImage(t){const e=new Promise((r,n)=>{const s=new Image;s.onload=r,s.onerror=n,s.crossOrigin="anonymous",s.src=t});return Promise.race([e,be.wait(2e3)])},parseBalance(t,e){let r="0.000";if(typeof t=="string"){const c=Number(t);if(!isNaN(c)){const u=(Math.floor(c*1e3)/1e3).toFixed(3);u&&(r=u)}}const[n,s]=r.split("."),i=n||"0",o=s||"000";return{formattedText:`${i}.${o}${e?` ${e}`:""}`,value:i,decimals:o,symbol:e}},getApiUrl(){return Y.W3M_API_URL},getBlockchainApiUrl(){return Y.BLOCKCHAIN_API_RPC_URL},getAnalyticsUrl(){return Y.PULSE_API_URL},getUUID(){return crypto!=null&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu,t=>{const e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)})},parseError(t){var e,r;return typeof t=="string"?t:typeof((r=(e=t==null?void 0:t.issues)==null?void 0:e[0])==null?void 0:r.message)=="string"?t.issues[0].message:t instanceof Error?t.message:"Unknown error"},sortRequestedNetworks(t,e=[]){const r={};return e&&t&&(t.forEach((n,s)=>{r[n]=s}),e.sort((n,s)=>{const i=r[n.id],o=r[s.id];return i!==void 0&&o!==void 0?i-o:i!==void 0?-1:o!==void 0?1:0})),e},calculateBalance(t){let e=0;for(const r of t)e+=r.value??0;return e},formatTokenBalance(t){const e=t.toFixed(2),[r,n]=e.split(".");return{dollars:r,pennies:n}},isAddress(t,e="eip155"){switch(e){case"eip155":if(/^(?:0x)?[0-9a-f]{40}$/iu.test(t)){if(/^(?:0x)?[0-9a-f]{40}$/iu.test(t)||/^(?:0x)?[0-9A-F]{40}$/iu.test(t))return!0}else return!1;return!1;case"solana":return/[1-9A-HJ-NP-Za-km-z]{32,44}$/iu.test(t);case"bip122":{const r=/^[1][a-km-zA-HJ-NP-Z1-9]{25,34}$/u.test(t),n=/^[3][a-km-zA-HJ-NP-Z1-9]{25,34}$/u.test(t),s=/^bc1[a-z0-9]{39,87}$/u.test(t),i=/^bc1p[a-z0-9]{58}$/u.test(t);return r||n||s||i}default:return!1}},uniqueBy(t,e){const r=new Set;return t.filter(n=>{const s=n[e];return r.has(s)?!1:(r.add(s),!0)})},generateSdkVersion(t,e,r){const s=t.length===0?lt.ADAPTER_TYPES.UNIVERSAL:t.map(i=>i.adapterType).join(",");return`${e}-${s}-${r}`},createAccount(t){const{chainNamespace:e,chainId:r,address:n}=Rr.parseCaipAddress(t.caipAddress);return{namespace:e,address:n,chainId:r,caipAddress:t.caipAddress,type:t.type,publicKey:t.publicKey,path:t.path}},isCaipAddress(t){if(typeof t!="string")return!1;const e=t.split(":"),r=e[0];return e.filter(Boolean).length===3&&r in Y.CHAIN_NAME_MAP},getAccount(t){return t?typeof t=="string"?{address:t,chainId:void 0}:{address:t.address,chainId:t.chainId}:{address:void 0,chainId:void 0}},isMac(){const t=window==null?void 0:window.navigator.userAgent.toLowerCase();return t.includes("macintosh")&&!t.includes("safari")},formatTelegramSocialLoginUrl(t){const e=`--${encodeURIComponent(window==null?void 0:window.location.href)}`,r="state=";if(new URL(t).host==="auth.magic.link"){const s="provider_authorization_url=",i=t.substring(t.indexOf(s)+s.length),o=this.injectIntoUrl(decodeURIComponent(i),r,e);return t.replace(i,encodeURIComponent(o))}return this.injectIntoUrl(t,r,e)},injectIntoUrl(t,e,r){const n=t.indexOf(e);if(n===-1)throw new Error(`${e} parameter not found in the URL: ${t}`);const s=t.indexOf("&",n),i=e.length,o=s!==-1?s:t.length,a=t.substring(0,n+i),c=t.substring(n+i,o),u=t.substring(s),l=c+r;return a+l+u},isNumber(t){return typeof t!="number"&&typeof t!="string"?!1:!isNaN(Number(t))},appendPayToUri(t,e){return e?`${t}&pay=${encodeURIComponent(e)}`:t}},rL={BLOCKCHAIN_API_RPC_URL:"https://rpc.walletconnect.org"},RG={validateCaipAddress(t){var e;if(((e=t.split(":"))==null?void 0:e.length)!==3)throw new Error("Invalid CAIP Address");return t},parseCaipAddress(t){const e=t.split(":");if(e.length!==3)throw new Error(`Invalid CAIP-10 address: ${t}`);const[r,n,s]=e;if(!r||!n||!s)throw new Error(`Invalid CAIP-10 address: ${t}`);return{chainNamespace:r,chainId:n,address:s}},parseCaipNetworkId(t){const e=t.split(":");if(e.length!==2)throw new Error(`Invalid CAIP-2 network id: ${t}`);const[r,n]=e;if(!r||!n)throw new Error(`Invalid CAIP-2 network id: ${t}`);return{chainNamespace:r,chainId:n}}};var ip={};const BG="https://secure.walletconnect.org/sdk",kG=(typeof Qr<"u"&&typeof ip<"u"?ip.NEXT_PUBLIC_SECURE_SITE_SDK_URL:void 0)||BG,jG=(typeof Qr<"u"&&typeof ip<"u"?ip.NEXT_PUBLIC_DEFAULT_LOG_LEVEL:void 0)||"error",DG=(typeof Qr<"u"&&typeof ip<"u"?ip.NEXT_PUBLIC_SECURE_SITE_SDK_VERSION:void 0)||"4",je={APP_EVENT_KEY:"@w3m-app/",FRAME_EVENT_KEY:"@w3m-frame/",RPC_METHOD_KEY:"RPC_",STORAGE_KEY:"@appkit-wallet/",SESSION_TOKEN_KEY:"SESSION_TOKEN_KEY",EMAIL_LOGIN_USED_KEY:"EMAIL_LOGIN_USED_KEY",LAST_USED_CHAIN_KEY:"LAST_USED_CHAIN_KEY",LAST_EMAIL_LOGIN_TIME:"LAST_EMAIL_LOGIN_TIME",EMAIL:"EMAIL",PREFERRED_ACCOUNT_TYPE:"PREFERRED_ACCOUNT_TYPE",SMART_ACCOUNT_ENABLED:"SMART_ACCOUNT_ENABLED",SMART_ACCOUNT_ENABLED_NETWORKS:"SMART_ACCOUNT_ENABLED_NETWORKS",SO
2CIAL_USERNAME:"SOCIAL_USERNAME",APP_SWITCH_NETWORK:"@w3m-app/SWITCH_NETWORK",APP_CONNECT_EMAIL:"@w3m-app/CONNECT_EMAIL",APP_CONNECT_DEVICE:"@w3m-app/CONNECT_DEVICE",APP_CONNECT_OTP:"@w3m-app/CONNECT_OTP",APP_CONNECT_SOCIAL:"@w3m-app/CONNECT_SOCIAL",APP_GET_SOCIAL_REDIRECT_URI:"@w3m-app/GET_SOCIAL_REDIRECT_URI",APP_GET_USER:"@w3m-app/GET_USER",APP_SIGN_OUT:"@w3m-app/SIGN_OUT",APP_IS_CONNECTED:"@w3m-app/IS_CONNECTED",APP_GET_CHAIN_ID:"@w3m-app/GET_CHAIN_ID",APP_RPC_REQUEST:"@w3m-app/RPC_REQUEST",APP_UPDATE_EMAIL:"@w3m-app/UPDATE_EMAIL",APP_UPDATE_EMAIL_PRIMARY_OTP:"@w3m-app/UPDATE_EMAIL_PRIMARY_OTP",APP_UPDATE_EMAIL_SECONDARY_OTP:"@w3m-app/UPDATE_EMAIL_SECONDARY_OTP",APP_AWAIT_UPDATE_EMAIL:"@w3m-app/AWAIT_UPDATE_EMAIL",APP_SYNC_THEME:"@w3m-app/SYNC_THEME",APP_SYNC_DAPP_DATA:"@w3m-app/SYNC_DAPP_DATA",APP_GET_SMART_ACCOUNT_ENABLED_NETWORKS:"@w3m-app/GET_SMART_ACCOUNT_ENABLED_NETWORKS",APP_INIT_SMART_ACCOUNT:"@w3m-app/INIT_SMART_ACCOUNT",APP_SET_PREFERRED_ACCOUNT:"@w3m-app/SET_PREFERRED_ACCOUNT",APP_CONNECT_FARCASTER:"@w3m-app/CONNECT_FARCASTER",APP_GET_FARCASTER_URI:"@w3m-app/GET_FARCASTER_URI",APP_RELOAD:"@w3m-app/RELOAD",APP_RPC_ABORT:"@w3m-app/RPC_ABORT",FRAME_SWITCH_NETWORK_ERROR:"@w3m-frame/SWITCH_NETWORK_ERROR",FRAME_SWITCH_NETWORK_SUCCESS:"@w3m-frame/SWITCH_NETWORK_SUCCESS",FRAME_CONNECT_EMAIL_ERROR:"@w3m-frame/CONNECT_EMAIL_ERROR",FRAME_CONNECT_EMAIL_SUCCESS:"@w3m-frame/CONNECT_EMAIL_SUCCESS",FRAME_CONNECT_DEVICE_ERROR:"@w3m-frame/CONNECT_DEVICE_ERROR",FRAME_CONNECT_DEVICE_SUCCESS:"@w3m-frame/CONNECT_DEVICE_SUCCESS",FRAME_CONNECT_OTP_SUCCESS:"@w3m-frame/CONNECT_OTP_SUCCESS",FRAME_CONNECT_OTP_ERROR:"@w3m-frame/CONNECT_OTP_ERROR",FRAME_CONNECT_SOCIAL_SUCCESS:"@w3m-frame/CONNECT_SOCIAL_SUCCESS",FRAME_CONNECT_SOCIAL_ERROR:"@w3m-frame/CONNECT_SOCIAL_ERROR",FRAME_CONNECT_FARCASTER_SUCCESS:"@w3m-frame/CONNECT_FARCASTER_SUCCESS",FRAME_CONNECT_FARCASTER_ERROR:"@w3m-frame/CONNECT_FARCASTER_ERROR",FRAME_GET_FARCASTER_URI_SUCCESS:"@w3m-frame/GET_FARCASTER_URI_SUCCESS",FRAME_GET_FARCASTER_URI_ERROR:"@w3m-frame/GET_FARCASTER_URI_ERROR",FRAME_GET_SOCIAL_REDIRECT_URI_SUCCESS:"@w3m-frame/GET_SOCIAL_REDIRECT_URI_SUCCESS",FRAME_GET_SOCIAL_REDIRECT_URI_ERROR:"@w3m-frame/GET_SOCIAL_REDIRECT_URI_ERROR",FRAME_GET_USER_SUCCESS:"@w3m-frame/GET_USER_SUCCESS",FRAME_GET_USER_ERROR:"@w3m-frame/GET_USER_ERROR",FRAME_SIGN_OUT_SUCCESS:"@w3m-frame/SIGN_OUT_SUCCESS",FRAME_SIGN_OUT_ERROR:"@w3m-frame/SIGN_OUT_ERROR",FRAME_IS_CONNECTED_SUCCESS:"@w3m-frame/IS_CONNECTED_SUCCESS",FRAME_IS_CONNECTED_ERROR:"@w3m-frame/IS_CONNECTED_ERROR",FRAME_GET_CHAIN_ID_SUCCESS:"@w3m-frame/GET_CHAIN_ID_SUCCESS",FRAME_GET_CHAIN_ID_ERROR:"@w3m-frame/GET_CHAIN_ID_ERROR",FRAME_RPC_REQUEST_SUCCESS:"@w3m-frame/RPC_REQUEST_SUCCESS",FRAME_RPC_REQUEST_ERROR:"@w3m-frame/RPC_REQUEST_ERROR",FRAME_SESSION_UPDATE:"@w3m-frame/SESSION_UPDATE",FRAME_UPDATE_EMAIL_SUCCESS:"@w3m-frame/UPDATE_EMAIL_SUCCESS",FRAME_UPDATE_EMAIL_ERROR:"@w3m-frame/UPDATE_EMAIL_ERROR",FRAME_UPDATE_EMAIL_PRIMARY_OTP_SUCCESS:"@w3m-frame/UPDATE_EMAIL_PRIMARY_OTP_SUCCESS",FRAME_UPDATE_EMAIL_PRIMARY_OTP_ERROR:"@w3m-frame/UPDATE_EMAIL_PRIMARY_OTP_ERROR",FRAME_UPDATE_EMAIL_SECONDARY_OTP_SUCCESS:"@w3m-frame/UPDATE_EMAIL_SECONDARY_OTP_SUCCESS",FRAME_UPDATE_EMAIL_SECONDARY_OTP_ERROR:"@w3m-frame/UPDATE_EMAIL_SECONDARY_OTP_ERROR",FRAME_SYNC_THEME_SUCCESS:"@w3m-frame/SYNC_THEME_SUCCESS",FRAME_SYNC_THEME_ERROR:"@w3m-frame/SYNC_THEME_ERROR",FRAME_SYNC_DAPP_DATA_SUCCESS:"@w3m-frame/SYNC_DAPP_DATA_SUCCESS",FRAME_SYNC_DAPP_DATA_ERROR:"@w3m-frame/SYNC_DAPP_DATA_ERROR",FRAME_GET_SMART_ACCOUNT_ENABLED_NETWORKS_SUCCESS:"@w3m-frame/GET_SMART_ACCOUNT_ENABLED_NETWORKS_SUCCESS",FRAME_GET_SMART_ACCOUNT_ENABLED_NETWORKS_ERROR:"@w3m-frame/GET_SMART_ACCOUNT_ENABLED_NETWORKS_ERROR",FRAME_INIT_SMART_ACCOUNT_SUCCESS:"@w3m-frame/INIT_SMART_ACCOUNT_SUCCESS",FRAME_INIT_SMART_ACCOUNT_ERROR:"@w3m-frame/INIT_SMART_ACCOUNT_ERROR",FRAME_SET_PREFERRED_ACCOUNT_SUCCESS:"@w3m-frame/SET_PREFERRED_ACCOUNT_SUCCESS",FRAME_SET_PREFERRED_ACCOUNT_ERROR:"@w3m-frame/SET_PREFERRED_ACCOUNT_ERROR",FRAME_READY:"@w3m-frame/READY",FRAME_RELOAD_SUCCESS:"@w3m-frame/RELOAD_SUCCESS",FRAME_RELOAD_ERROR:"@w3m-frame/RELOAD_ERROR",FRAME_RPC_ABORT_SUCCESS:"@w3m-frame/RPC_ABORT_SUCCESS",FRAME_RPC_ABORT_ERROR:"@w3m-frame/RPC_ABORT_ERROR",RPC_RESPONSE_TYPE_ER
2ROR:"RPC_RESPONSE_ERROR",RPC_RESPONSE_TYPE_TX:"RPC_RESPONSE_TRANSACTION_HASH",RPC_RESPONSE_TYPE_OBJECT:"RPC_RESPONSE_OBJECT"},Tr={SAFE_RPC_METHODS:["eth_accounts","eth_blockNumber","eth_call","eth_chainId","eth_estimateGas","eth_feeHistory","eth_gasPrice","eth_getAccount","eth_getBalance","eth_getBlockByHash","eth_getBlockByNumber","eth_getBlockReceipts","eth_getBlockTransactionCountByHash","eth_getBlockTransactionCountByNumber","eth_getCode","eth_getFilterChanges","eth_getFilterLogs","eth_getLogs","eth_getProof","eth_getStorageAt","eth_getTransactionByBlockHashAndIndex","eth_getTransactionByBlockNumberAndIndex","eth_getTransactionByHash","eth_getTransactionCount","eth_getTransactionReceipt","eth_getUncleCountByBlockHash","eth_getUncleCountByBlockNumber","eth_maxPriorityFeePerGas","eth_newBlockFilter","eth_newFilter","eth_newPendingTransactionFilter","eth_sendRawTransaction","eth_syncing","eth_uninstallFilter","wallet_getCapabilities","wallet_getCallsStatus","eth_getUserOperationReceipt","eth_estimateUserOperationGas","eth_getUserOperationByHash","eth_supportedEntryPoints","wallet_getAssets"],NOT_SAFE_RPC_METHODS:["personal_sign","eth_signTypedData_v4","eth_sendTransaction","solana_signMessage","solana_signTransaction","solana_signAllTransactions","solana_signAndSendTransaction","wallet_sendCalls","wallet_grantPermissions","wallet_revokePermissions","eth_sendUserOperation"],GET_CHAIN_ID:"eth_chainId",RPC_METHOD_NOT_ALLOWED_MESSAGE:"Requested RPC call is not allowed",RPC_METHOD_NOT_ALLOWED_UI_MESSAGE:"Action not allowed",ACCOUNT_TYPES:{EOA:"eoa",SMART_ACCOUNT:"smartAccount"}},Ax={transactionHash:/^0x(?:[A-Fa-f0-9]{64})$/u,signedMessage:/^0x(?:[a-fA-F0-9]{62,})$/u},Ur={set(t,e){Ws.isClient&&localStorage.setItem(`${je.STORAGE_KEY}${t}`,e)},get(t){return Ws.isClient?localStorage.getItem(`${je.STORAGE_KEY}${t}`):null},delete(t,e){Ws.isClient&&(e?localStorage.removeItem(t):localStorage.removeItem(`${je.STORAGE_KEY}${t}`))}},ib=30*1e3,Ws={checkIfAllowedToTriggerEmail(){const t=Ur.get(je.LAST_EMAIL_LOGIN_TIME);if(t){const e=Date.now()-Number(t);if(e<ib){const r=Math.ceil((ib-e)/1e3);throw new Error(`Please try again after ${r} seconds`)}}},getTimeToNextEmailLogin(){const t=Ur.get(je.LAST_EMAIL_LOGIN_TIME);if(t){const e=Date.now()-Number(t);if(e<ib)return Math.ceil((ib-e)/1e3)}return 0},checkIfRequestExists(t){return Tr.NOT_SAFE_RPC_METHODS.includes(t.method)||Tr.SAFE_RPC_METHODS.includes(t.method)},getResponseType(t){return typeof t=="string"&&((t==null?void 0:t.match(Ax.transactionHash))||(t==null?void 0:t.match(Ax.signedMessage)))?je.RPC_RESPONSE_TYPE_TX:je.RPC_RESPONSE_TYPE_OBJECT},checkIfRequestIsSafe(t){return Tr.SAFE_RPC_METHODS.includes(t.method)},isClient:typeof window<"u"};var Pt;(function(t){t.assertEqual=s=>s;function e(s){}t.assertIs=e;function r(s){throw new Error}t.assertNever=r,t.arrayToEnum=s=>{const i={};for(const o of s)i[o]=o;return i},t.getValidEnumValues=s=>{const i=t.objectKeys(s).filter(a=>typeof s[s[a]]!="number"),o={};for(const a of i)o[a]=s[a];return t.objectValues(o)},t.objectValues=s=>t.objectKeys(s).map(function(i){return s[i]}),t.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const i=[];for(const o in s)Object.prototype.hasOwnProperty.call(s,o)&&i.push(o);return i},t.find=(s,i)=>{for(const o of s)if(i(o))return o},t.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&isFinite(s)&&Math.floor(s)===s;function n(s,i=" | "){return s.map(o=>typeof o=="string"?`'${o}'`:o).join(i)}t.joinValues=n,t.jsonStringifyReplacer=(s,i)=>typeof i=="bigint"?i.toString():i})(Pt||(Pt={}));var qS;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(qS||(qS={}));const Pe=Pt.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Yc=t=>{switch(typeof t){case"undefined":return Pe.undefined;case"string":return Pe.string;case"number":return isNaN(t)?Pe.nan:Pe.number;case"boolean":return Pe.boolean;case"function":return Pe.function;case"bigint":return Pe.bigint;case"symbol":return Pe.symbol;case"object":return Array.isArray(t)?Pe.array:t===null?Pe.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?Pe.promise:typeof Map<"u"&&t instanceof Map?Pe.map:typeof Set<"u"&&t instanceof Set?Pe.set:typeof Date<"u"&&t instanceof Date?Pe.date:Pe.object;default:return Pe.unknown}}
vendor: 2,097 bytes, line 2
2,Ee=Pt.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),UG=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:");class Wi extends Error{constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};const r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){const r=e||function(i){return i.message},n={_errors:[]},s=i=>{for(const o of i.issues)if(o.code==="invalid_union")o.unionErrors.map(s);else if(o.code==="invalid_return_type")s(o.returnTypeError);else if(o.code==="invalid_arguments")s(o.argumentsError);else if(o.path.length===0)n._errors.push(r(o));else{let a=n,c=0;for(;c<o.path.length;){const u=o.path[c];c===o.path.length-1?(a[u]=a[u]||{_errors:[]},a[u]._errors.push(r(o))):a[u]=a[u]||{_errors:[]},a=a[u],c++}}};return s(this),n}toString(){return this.message}get message(){return JSON.stringify(this.issues,Pt.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){const r={},n=[];for(const s of this.issues)s.path.length>0?(r[s.path[0]]=r[s.path[0]]||[],r[s.path[0]].push(e(s))):n.push(e(s));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}}Wi.create=t=>new Wi(t);const Vm=(t,e)=>{let r;switch(t.code){case Ee.invalid_type:t.received===Pe.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case Ee.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,Pt.jsonStringifyReplacer)}`;break;case Ee.unrecognized_keys:r=`Unrecognized key(s) in object: ${Pt.joinValues(t.keys,", ")}`;break;case Ee.invalid_union:r="Invalid input";break;case Ee.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Pt.j
2oinValues(t.options)}`;break;case Ee.invalid_enum_value:r=`Invalid enum value. Expected ${Pt.joinValues(t.options)}, received '${t.received}'`;break;case Ee.invalid_arguments:r="Invalid function arguments";break;case Ee.invalid_return_type:r="Invalid function return type";break;case Ee.invalid_date:r="Invalid date";break;case Ee.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:Pt.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case Ee.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case Ee.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case Ee.custom:r="Invalid input";break;case Ee.invalid_intersection_types:r="Intersection results could not be merged";break;case Ee.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case Ee.not_finite:r="Number must be finite";break;default:r=e.defaultError,Pt.assertNever(t)}return{message:r}};let nL=Vm;function MG(t){nL=t}function P_(){return nL}const O_=t=>{const{data:e,path:r,errorMaps:n,issueData:s}=t,i=[...r,...s.path||[]],o={...s,path:i};let a="";const c=n.filter(u=>!!u).slice().reverse();for(const u of c)a=u(o,{data:e,defaultError:a}).message;return{...s,path:i,message:s.message||a}},$G=[];function Re(t,e){const r=O_({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,P_(),Vm].filter(n=>!!n)});t.common.issues.push(r)}class Nn{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){const n=[];for(const s of r){if(s.status==="aborted")return et;s.status==="dirty"&&e.dirty(),n.push(s.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){const n=[];for(const s of r)n.push({key:await s.key,value:await s.value});return Nn.mergeObjectSync(e,n)}static mergeObjectSync(e,r){const n={};for(const s of r){const{key:i,value:o}=s;if(i.status==="aborted"||o.status==="aborted")return et;i.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof o.value<"u"||s.alwaysSet)&&(n[i.value]=o.value)}return{status:e.value,value:n}}}const et=Object.freeze({status:"aborted"}),sL=t=>({status:"dirty",value:t}),Jn=t=>({status:"valid",value:t}),zS=t=>t.status==="aborted",WS=t=>t.status==="dirty",Gm=t=>t.status==="valid",N_=t=>typeof Promise<"u"&&t instanceof Promise;var qe;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(qe||(qe={}));class qo{constructor(e,r,n,s){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=s}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Cx=(t,e)=>{if(Gm(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const r=new Wi(t.common.issues);return this._error=r,this._error}}};function rt(t){if(!t)return{};const{errorMap:e,invalid_type_error:r,required_error:n,description:s}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:(o,a)=>o.code!=="invalid_type"?{message:a.defaultError}:typeof a.data>"u"?{message:n??a.defaultError}:{message:r??a.defaultError},description:s}}class ct{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return Yc(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:Yc(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Nn,ctx:{common:e.parent.common,data:e.data,parsedType:Yc(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const r=this._parse(e);if(N_(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){const r=this._parse(e);return Promise.resolve(r)}parse(e,r){const n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){var n;const s={common:{issues:[],async:(n=r==null?void 0:r.async)!==null&&n!==void 0?n:!1,contextualErrorMap:r==null?void 0:r.errorMap},path:(r==null?void 0:r.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Yc(e)},i=this._parseSync({data:e,path:s.path,parent:s});return Cx(s,i)}async parseAsync(e,r){const n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){const n={common:{issues:[],contextualErrorMap:r==null?void 0:r.errorMap,async:!0},path:(r==null?void 0:r.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Yc(e)},s=this._parse({data:e,path:n.path,parent:n}),i=await(N_(s)?s:Promise.resolve(s));return Cx(n,i)}refine(e,r){const n=s=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(s):r;return this._refinement((s,i)=>{const o=e(s),a=()=>i.addIssue({code:Ee.custom,...n(s)});return typeof Promise<"u"&&o instanceof Promise?o.then(c=>c?!0:(a(),!1)):o?!0:(a(),!1)})}refinement(e,r){return this._refinement((n,s)=>e(n)?!0:(s.addIssue(typeof r=="function"?r(n,s):r),!1))}_refinement(e){return new Ki({schema:this,typeName:Ke.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return ec.create(this,this._def)}nullable(){return Pd.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Vi.create(this,this._def)}promise(){return ap.create(this,this._def)}or(e){return Jm.create([this,e],this._def)}and(e){return Qm.create(this,e,this._def)}transform(e){return new Ki({...rt(this._def),schema:this,typeName:Ke.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const r=typeof e=="function"?e:()=>e;return new ny({...rt(this._def),innerType:this,defaultValue:r,typeName:Ke.ZodDefault})}brand(){return new oL({typeName:Ke.ZodBranded,type:this,...rt(this._def)})}catch(e){const r=typeof e=="function"?e:()=>e;return new k_({...rt(this._def),innerType:this,catchValue:r,typeName:Ke.ZodCatch})}describe(e){const r=this.constructor;return new r({...this._def,description:e})}pipe(e){return o0.create(this,e)}readonly(){return D_.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const LG=/^c[^\s-]{8,}
vendor: 31,369 bytes, line 2
2$/i,FG=/^[a-z][a-z0-9]*$/,HG=/^[0-9A-HJKMNP-TV-Z]{26}$/,qG=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,zG=/^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,WG="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let _2;const VG=/^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/,GG=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,KG=t=>t.precision?t.offset?new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${t.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`):new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${t.precision}}Z$`):t.precision===0?t.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$"):t.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$");function ZG(t,e){return!!((e==="v4"||!e)&&VG.test(t)||(e==="v6"||!e)&&GG.test(t))}class qi extends ct{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==Pe.string){const i=this._getOrReturnCtx(e);return Re(i,{code:Ee.invalid_type,expected:Pe.string,received:i.parsedType}),et}const n=new Nn;let s;for(const i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(s=this._getOrReturnCtx(e,s),Re(s,{code:Ee.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="max")e.data.length>i.value&&(s=this._getOrReturnCtx(e,s),Re(s,{code:Ee.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="length"){const o=e.data.length>i.value,a=e.data.length<i.value;(o||a)&&(s=this._getOrReturnCtx(e,s),o?Re(s,{code:Ee.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):a&&Re(s,{code:Ee.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")zG.test(e.data)||(s=this._getOrReturnCtx(e,s),Re(s,{validation:"email",code:Ee.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")_2||(_2=new RegExp(WG,"u")),_2.test(e.data)||(s=this._getOrReturnCtx(e,s),Re(s,{validation:"emoji",code:Ee.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")qG.test(e.data)||(s=this._getOrReturnCtx(e,s),Re(s,{validation:"uuid",code:Ee.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")LG.test(e.data)||(s=this._getOrReturnCtx(e,s),Re(s,{validation:"cuid",code:Ee.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")FG.test(e.data)||(s=this._getOrReturnCtx(e,s),Re(s,{validation:"cuid2",code:Ee.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")HG.test(e.data)||(s=this._getOrReturnCtx(e,s),Re(s,{validation:"ulid",code:Ee.invalid_string,message:i.message}),n.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),Re(s,{validation:"url",code:Ee.invalid_string,message:i.message}),n.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),Re(s,{validation:"regex",code:Ee.invalid_string,message:i.message}),n.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(s=this._getOrReturnCtx(e,s),Re(s,{code:Ee.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),n.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(s=this._getOrReturnCtx(e,s),Re(s,{code:Ee.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(s=this._getOrReturnCtx(e,s),Re(s,{code:Ee.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?KG(i).test(e.data)||(s=this._getOrReturnCtx(e,s),Re(s,{code:Ee.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="ip"?ZG(e.data,i.version)||(s=this._getOrReturnCtx(e,s),Re(s,{validation:"ip",code:Ee.invalid_string,message:i.message}),n.dirty()):Pt.assertNever(i);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(s=>e.test(s),{validation:r,code:Ee.invalid_string,...qe.errToObj(n)})}_addCheck(e){return new qi({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...qe.errToObj(e)})}url(e){return this._addCheck({kind:"url",...qe.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...qe.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...qe.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...qe.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...qe.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...qe.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...qe.errToObj(e)})}datetime(e){var r;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(r=e==null?void 0:e.offset)!==null&&r!==void 0?r:!1,...qe.errToObj(e==null?void 0:e.message)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...qe.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r==null?void 0:r.position,...qe.errToObj(r==null?void 0:r.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...qe.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...qe.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...qe.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...qe.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...qe.errToObj(r)})}nonempty(e){return this.min(1,qe.errToObj(e))}trim(){return new qi({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new qi({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new qi({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get minLength(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}}qi.create=t=>{var e;return new qi({checks:[],typeName:Ke.ZodString,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1,...rt(t)})};function YG(t,e){const r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,s=r>n?r:n,i=parseInt(t.toFixed(s).replace(".","")),o=parseInt(e.toFixed(s).replace(".",""));return i%o/Math.pow(10,s)}class Nu extends ct{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==Pe.number){const i=this._getOrReturnCtx(e);return Re(i,{code:Ee.invalid_type,expected:Pe.number,received:i.parsedType}),et}let n;const s=new Nn;for(const i of this._def.checks)i.kind==="int"?Pt.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),Re(n,{code:Ee.invalid_type,expected:"integer",received:"float",message:i.message}),s.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(n=this._getOrReturnCtx(e,n),Re(n,{code:Ee.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),Re(n,{code:Ee.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="multipleOf"?YG(e.data,i.value)!==0&&(n=this._getOrReturnCtx(e,n),Re(n,{code:Ee.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),Re(n,{code:Ee.not_finite,message:i.message}),s.dirty()):Pt.assertNever(i);return{status:s.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,qe.toString(r))}gt(e,r){return this.setLimit("min",e,!1,qe.toString(r))}lte(e,r){return this.setLimit("max",e,!0,qe.toString(r))}lt(e,r){return this.setLimit("max",e,!1,qe.toString(r))}setLimit(e,r,n,s){return new Nu({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:qe.toString(s)}]})}_addCheck(e){return new Nu({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:qe.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:qe.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:qe.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:qe.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:qe.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:qe.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:qe.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:qe.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:qe.toString(e)})}get minValue(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&Pt.isInteger(e.value))}get isFinite(){let e=null,r=null;for(const n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(r)&&Number.isFinite(e)}}Nu.create=t=>new Nu({checks:[],typeName:Ke.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...rt(t)});class xu extends ct{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==Pe.bigint){const i=this._getOrReturnCtx(e);return Re(i,{code:Ee.invalid_type,expected:Pe.bigint,received:i.parsedType}),et}let n;const s=new Nn;for(const i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(n=this._getOrReturnCtx(e,n),Re(n,{code:Ee.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),Re(n,{code:Ee.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),Re(n,{code:Ee.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):Pt.assertNever(i);return{status:s.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,qe.toString(r))}gt(e,r){return this.setLimit("min",e,!1,qe.toString(r))}lte(e,r){return this.setLimit("max",e,!0,qe.toString(r))}lt(e,r){return this.setLimit("max",e,!1,qe.toString(r))}setLimit(e,r,n,s){return new xu({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:qe.toString(s)}]})}_addCheck(e){return new xu({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:qe.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:qe.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:qe.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:qe.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:qe.toString(r)})}get minValue(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}}xu.create=t=>{var e;return new xu({checks:[],typeName:Ke.ZodBigInt,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1,...rt(t)})};class Km extends ct{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==Pe.boolean){const n=this._getOrReturnCtx(e);return Re(n,{code:Ee.invalid_type,expected:Pe.boolean,received:n.parsedType}),et}return Jn(e.data)}}Km.create=t=>new Km({typeName:Ke.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...rt(t)});class Sd extends ct{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==Pe.date){const i=this._getOrReturnCtx(e);return Re(i,{code:Ee.invalid_type,expected:Pe.date,received:i.parsedType}),et}if(isNaN(e.data.getTime())){const i=this._getOrReturnCtx(e);return Re(i,{code:Ee.invalid_date}),et}const n=new Nn;let s;for(const i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(s=this._getOrReturnCtx(e,s),Re(s,{code:Ee.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),n.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(s=this._getOrReturnCtx(e,s),Re(s,{code:Ee.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):Pt.assertNever(i);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Sd({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:qe.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:qe.toString(r)})}get minDate(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}}Sd.create=t=>new Sd({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:Ke.ZodDate,...rt(t)});class x_ extends ct{_parse(e){if(this._getType(e)!==Pe.symbol){const n=this._getOrReturnCtx(e);return Re(n,{code:Ee.invalid_type,expected:Pe.symbol,received:n.parsedType}),et}return Jn(e.data)}}x_.create=t=>new x_({typeName:Ke.ZodSymbol,...rt(t)});class Zm extends ct{_parse(e){if(this._getType(e)!==Pe.undefined){const n=this._getOrReturnCtx(e);return Re(n,{code:Ee.invalid_type,expected:Pe.undefined,received:n.parsedType}),et}return Jn(e.data)}}Zm.create=t=>new Zm({typeName:Ke.ZodUndefined,...rt(t)});class Ym extends ct{_parse(e){if(this._getType(e)!==Pe.null){const n=this._getOrReturnCtx(e);return Re(n,{code:Ee.invalid_type,expected:Pe.null,received:n.parsedType}),et}return Jn(e.data)}}Ym.create=t=>new Ym({typeName:Ke.ZodNull,...rt(t)});class op extends ct{constructor(){super(...arguments),this._any=!0}_parse(e){return Jn(e.data)}}op.create=t=>new op({typeName:Ke.ZodAny,...rt(t)});class bd extends ct{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Jn(e.data)}}bd.create=t=>new bd({typeName:Ke.ZodUnknown,...rt(t)});class oc extends ct{_parse(e){const r=this._getOrReturnCtx(e);return Re(r,{code:Ee.invalid_type,expected:Pe.never,received:r.parsedType}),et}}oc.create=t=>new oc({typeName:Ke.ZodNever,...rt(t)});class R_ extends ct{_parse(e){if(this._getType(e)!==Pe.undefined){const n=this._getOrReturnCtx(e);return Re(n,{code:Ee.invalid_type,expected:Pe.void,received:n.parsedType}),et}return Jn(e.data)}}R_.create=t=>new R_({typeName:Ke.ZodVoid,...rt(t)});class Vi extends ct{_parse(e){const{ctx:r,status:n}=this._processInputParams(e),s=this._def;if(r.parsedType!==Pe.array)return Re(r,{code:Ee.invalid_type,expected:Pe.array,received:r.parsedType}),et;if(s.exactLength!==null){const o=r.data.length>s.exactLength.value,a=r.data.length<s.exactLength.value;(o||a)&&(Re(r,{code:o?Ee.too_big:Ee.too_small,minimum:a?s.exactLength.value:void 0,maximum:o?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),n.dirty())}if(s.minLength!==null&&r.data.length<s.minLength.value&&(Re(r,{code:Ee.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),n.dirty()),s.maxLength!==null&&r.data.length>s.maxLength.value&&(Re(r,{code:Ee.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((o,a)=>s.type._parseAsync(new qo(r,o,r.path,a)))).then(o=>Nn.mergeArray(n,o));const i=[...r.data].map((o,a)=>s.type._parseSync(new qo(r,o,r.path,a)));return Nn.mergeArray(n,i)}get element(){return this._def.type}min(e,r){return new Vi({...this._def,minLength:{value:e,message:qe.toString(r)}})}max(e,r){return new Vi({...this._def,maxLength:{value:e,message:qe.toString(r)}})}length(e,r){return new Vi({...this._def,exactLength:{value:e,message:qe.toString(r)}})}nonempty(e){return this.min(1,e)}}Vi.create=(t,e)=>new Vi({type:t,minLength:null,maxLength:null,exactLength:null,typeName:Ke.ZodArray,...rt(e)});function Lf(t){if(t instanceof hr){const e={};for(const r in t.shape){const n=t.shape[r];e[r]=ec.create(Lf(n))}return new hr({...t._def,shape:()=>e})}else return t instanceof Vi?new Vi({...t._def,type:Lf(t.element)}):t instanceof ec?ec.create(Lf(t.unwrap())):t instanceof Pd?Pd.create(Lf(t.unwrap())):t instanceof zo?zo.create(t.items.map(e=>Lf(e))):t}class hr extends ct{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),r=Pt.objectKeys(e);return this._cached={shape:e,keys:r}}_parse(e){if(this._getType(e)!==Pe.object){const u=this._getOrReturnCtx(e);return Re(u,{code:Ee.invalid_type,expected:Pe.object,received:u.parsedType}),et}const{status:n,ctx:s}=this._processInputParams(e),{shape:i,keys:o}=this._getCached(),a=[];if(!(this._def.catchall instanceof oc&&this._def.unknownKeys==="strip"))for(const u in s.data)o.includes(u)||a.push(u);const c=[];for(const u of o){const l=i[u],d=s.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new qo(s,d,s.path,u)),alwaysSet:u in s.data})}if(this._def.catchall instanceof oc){const u=this._def.unknownKeys;if(u==="passthrough")for(const l of a)c.push({key:{status:"valid",value:l},value:{status:"valid",value:s.data[l]}});else if(u==="strict")a.length>0&&(Re(s,{code:Ee.unrecognized_keys,keys:a}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const u=this._def.catchall;for(const l of a){const d=s.data[l];c.push({key:{status:"valid",value:l},value:u._parse(new qo(s,d,s.path,l)),alwaysSet:l in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const u=[];for(const l of c){const d=await l.key;u.push({key:d,value:await l.value,alwaysSet:l.alwaysSet})}return u}).then(u=>Nn.mergeObjectSync(n,u)):Nn.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(e){return qe.errToObj,new hr({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{var s,i,o,a;const c=(o=(i=(s=this._def).errorMap)===null||i===void 0?void 0:i.call(s,r,n).message)!==null&&o!==void 0?o:n.defaultError;return r.code==="unrecognized_keys"?{message:(a=qe.errToObj(e).message)!==null&&a!==void 0?a:c}:{message:c}}}:{}})}strip(){return new hr({...this._def,unknownKeys:"strip"})}passthrough(){return new hr({...this._def,unknownKeys:"passthrough"})}extend(e){return new hr({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new hr({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Ke.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new hr({...this._def,catchall:e})}pick(e){const r={};return Pt.objectKeys(e).forEach(n=>{e[n]&&this.shape[n]&&(r[n]=this.shape[n])}),new hr({...this._def,shape:()=>r})}omit(e){const r={};return Pt.objectKeys(this.shape).forEach(n=>{e[n]||(r[n]=this.shape[n])}),new hr({...this._def,shape:()=>r})}deepPartial(){return Lf(this)}partial(e){const r={};return Pt.objectKeys(this.shape).forEach(n=>{const s=this.shape[n];e&&!e[n]?r[n]=s:r[n]=s.optional()}),new hr({...this._def,shape:()=>r})}required(e){const r={};return Pt.objectKeys(this.shape).forEach(n=>{if(e&&!e[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof ec;)i=i._def.innerType;r[n]=i}}),new hr({...this._def,shape:()=>r})}keyof(){return iL(Pt.objectKeys(this.shape))}}hr.create=(t,e)=>new hr({shape:()=>t,unknownKeys:"strip",catchall:oc.create(),typeName:Ke.ZodObject,...rt(e)});hr.strictCreate=(t,e)=>new hr({shape:()=>t,unknownKeys:"strict",catchall:oc.create(),typeName:Ke.ZodObject,...rt(e)});hr.lazycreate=(t,e)=>new hr({shape:t,unknownKeys:"strip",catchall:oc.create(),typeName:Ke.ZodObject,...rt(e)});class Jm extends ct{_parse(e){const{ctx:r}=this._processInputParams(e),n=this._def.options;function s(i){for(const a of i)if(a.result.status==="valid")return a.result;for(const a of i)if(a.result.status==="dirty")return r.common.issues.push(...a.ctx.common.issues),a.result;const o=i.map(a=>new Wi(a.ctx.common.issues));return Re(r,{code:Ee.invalid_union,unionErrors:o}),et}if(r.common.async)return Promise.all(n.map(async i=>{const o={...r,common:{...r.common,issues:[]},parent:null};return{result:await i._parseAsync({data:r.data,path:r.path,parent:o}),ctx:o}})).then(s);{let i;const o=[];for(const c of n){const u={...r,common:{...r.common,issues:[]},parent:null},l=c._parseSync({data:r.data,path:r.path,parent:u});if(l.status==="valid")return l;l.status==="dirty"&&!i&&(i={result:l,ctx:u}),u.common.issues.length&&o.push(u.common.issues)}if(i)return r.common.issues.push(...i.ctx.common.issues),i.result;const a=o.map(c=>new Wi(c));return Re(r,{code:Ee.invalid_union,unionErrors:a}),et}}get options(){return this._def.options}}Jm.create=(t,e)=>new Jm({options:t,typeName:Ke.ZodUnion,...rt(e)});const s_=t=>t instanceof ey?s_(t.schema):t instanceof Ki?s_(t.innerType()):t instanceof ty?[t.value]:t instanceof Ru?t.options:t instanceof ry?Object.keys(t.enum):t instanceof ny?s_(t._def.innerType):t instanceof Zm?[void 0]:t instanceof Ym?[null]:null;class xA extends ct{_parse(e){const{ctx:r}=this._processInputParams(e);if(r.parsedType!==Pe.object)return Re(r,{code:Ee.invalid_type,expected:Pe.object,received:r.parsedType}),et;const n=this.discriminator,s=r.data[n],i=this.optionsMap.get(s);return i?r.common.async?i._parseAsync({data:r.data,path:r.path,parent:r}):i._parseSync({data:r.data,path:r.path,parent:r}):(Re(r,{code:Ee.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),et)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){const s=new Map;for(const i of r){const o=s_(i.shape[e]);if(!o)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const a of o){if(s.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);s.set(a,i)}}return new xA({typeName:Ke.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:s,...rt(n)})}}function VS(t,e){const r=Yc(t),n=Yc(e);if(t===e)return{valid:!0,data:t};if(r===Pe.object&&n===Pe.object){const s=Pt.objectKeys(e),i=Pt.objectKeys(t).filter(a=>s.indexOf(a)!==-1),o={...t,...e};for(const a of i){const c=VS(t[a],e[a]);if(!c.valid)return{valid:!1};o[a]=c.data}return{valid:!0,data:o}}else if(r===Pe.array&&n===Pe.array){if(t.length!==e.length)return{valid:!1};const s=[];for(let i=0;i<t.length;i++){const o=t[i],a=e[i],c=VS(o,a);if(!c.valid)return{valid:!1};s.push(c.data)}return{valid:!0,data:s}}else return r===Pe.date&&n===Pe.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class Qm extends ct{_parse(e){const{status:r,ctx:n}=this._processInputParams(e),s=(i,o)=>{if(zS(i)||zS(o))return et;const a=VS(i.value,o.value);return a.valid?((WS(i)||WS(o))&&r.dirty(),{status:r.value,value:a.data}):(Re(n,{code:Ee.invalid_intersection_types}),et)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([i,o])=>s(i,o)):s(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}Qm.create=(t,e,r)=>new Qm({left:t,right:e,typeName:Ke.ZodIntersection,...rt(r)});class zo extends ct{_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==Pe.array)return Re(n,{code:Ee.invalid_type,expected:Pe.array,received:n.parsedType}),et;if(n.data.length<this._def.items.length)return Re(n,{code:Ee.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),et;!this._def.rest&&n.data.length>this._def.items.length&&(Re(n,{code:Ee.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());const i=[...n.data].map((o,a)=>{const c=this._def.items[a]||this._def.rest;return c?c._parse(new qo(n,o,n.path,a)):null}).filter(o=>!!o);return n.common.async?Promise.all(i).then(o=>Nn.mergeArray(r,o)):Nn.mergeArray(r,i)}get items(){return this._def.items}rest(e){return new zo({...this._def,rest:e})}}zo.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new zo({items:t,typeName:Ke.ZodTuple,rest:null,...rt(e)})};class Xm extends ct{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==Pe.object)return Re(n,{code:Ee.invalid_type,expected:Pe.object,received:n.parsedType}),et;const s=[],i=this._def.keyType,o=this._def.valueType;for(const a in n.data)s.push({key:i._parse(new qo(n,a,n.path,a)),value:o._parse(new qo(n,n.data[a],n.path,a))});return n.common.async?Nn.mergeObjectAsync(r,s):Nn.mergeObjectSync(r,s)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof ct?new Xm({keyType:e,valueType:r,typeName:Ke.ZodRecord,...rt(n)}):new Xm({keyType:qi.create(),valueType:e,typeName:Ke.ZodRecord,...rt(r)})}}class B_ extends ct{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==Pe.map)return Re(n,{code:Ee.invalid_type,expected:Pe.map,received:n.parsedType}),et;const s=this._def.keyType,i=this._def.valueType,o=[...n.data.entries()].map(([a,c],u)=>({key:s._parse(new qo(n,a,n.path,[u,"key"])),value:i._parse(new qo(n,c,n.path,[u,"value"]))}));if(n.common.async){const a=new Map;return Promise.resolve().then(async()=>{for(const c of o){const u=await c.key,l=await c.value;if(u.status==="aborted"||l.status==="aborted")return et;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),a.set(u.value,l.value)}return{status:r.value,value:a}})}else{const a=new Map;for(const c of o){const u=c.key,l=c.value;if(u.status==="aborted"||l.status==="aborted")return et;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),a.set(u.value,l.value)}return{status:r.value,value:a}}}}B_.create=(t,e,r)=>new B_({valueType:e,keyType:t,typeName:Ke.ZodMap,...rt(r)});class Td extends ct{_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==Pe.set)return Re(n,{code:Ee.invalid_type,expected:Pe.set,received:n.parsedType}),et;const s=this._def;s.minSize!==null&&n.data.size<s.minSize.value&&(Re(n,{code:Ee.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),r.dirty()),s.maxSize!==null&&n.data.size>s.maxSize.value&&(Re(n,{code:Ee.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),r.dirty());const i=this._def.valueType;function o(c){const u=new Set;for(const l of c){if(l.status==="aborted")return et;l.status==="dirty"&&r.dirty(),u.add(l.value)}return{status:r.value,value:u}}const a=[...n.data.values()].map((c,u)=>i._parse(new qo(n,c,n.path,u)));return n.common.async?Promise.all(a).then(c=>o(c)):o(a)}min(e,r){return new Td({...this._def,minSize:{value:e,message:qe.toString(r)}})}max(e,r){return new Td({...this._def,maxSize:{value:e,message:qe.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}}Td.create=(t,e)=>new Td({valueType:t,minSize:null,maxSize:null,typeName:Ke.ZodSet,...rt(e)});class sh extends ct{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:r}=this._processInputParams(e);if(r.parsedType!==Pe.function)return Re(r,{code:Ee.invalid_type,expected:Pe.function,received:r.parsedType}),et;function n(a,c){return O_({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,P_(),Vm].filter(u=>!!u),issueData:{code:Ee.invalid_arguments,argumentsError:c}})}function s(a,c){return O_({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,P_(),Vm].filter(u=>!!u),issueData:{code:Ee.invalid_return_type,returnTypeError:c}})}const i={errorMap:r.common.contextualErrorMap},o=r.data;if(this._def.returns instanceof ap){const a=this;return Jn(async function(...c){const u=new Wi([]),l=await a._def.args.parseAsync(c,i).catch(g=>{throw u.addIssue(n(c,g)),u}),d=await Reflect.apply(o,this,l);return await a._def.returns._def.type.parseAsync(d,i).catch(g=>{throw u.addIssue(s(d,g)),u})})}else{const a=this;return Jn(function(...c){const u=a._def.args.safeParse(c,i);if(!u.success)throw new Wi([n(c,u.error)]);const l=Reflect.apply(o,this,u.data),d=a._def.returns.safeParse(l,i);if(!d.success)throw new Wi([s(l,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new sh({...this._def,args:zo.create(e).rest(bd.create())})}returns(e){return new sh({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,n){return new sh({args:e||zo.create([]).rest(bd.create()),returns:r||bd.create(),typeName:Ke.ZodFunction,...rt(n)})}}class ey extends ct{get schema(){return this._def.getter()}_parse(e){const{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}}ey.create=(t,e)=>new ey({getter:t,typeName:Ke.ZodLazy,...rt(e)});class ty extends ct{_parse(e){if(e.data!==this._def.value){const r=this._getOrReturnCtx(e);return Re(r,{received:r.data,code:Ee.invalid_literal,expected:this._def.value}),et}
2return{status:"valid",value:e.data}}get value(){return this._def.value}}ty.create=(t,e)=>new ty({value:t,typeName:Ke.ZodLiteral,...rt(e)});function iL(t,e){return new Ru({values:t,typeName:Ke.ZodEnum,...rt(e)})}class Ru extends ct{_parse(e){if(typeof e.data!="string"){const r=this._getOrReturnCtx(e),n=this._def.values;return Re(r,{expected:Pt.joinValues(n),received:r.parsedType,code:Ee.invalid_type}),et}if(this._def.values.indexOf(e.data)===-1){const r=this._getOrReturnCtx(e),n=this._def.values;return Re(r,{received:r.data,code:Ee.invalid_enum_value,options:n}),et}return Jn(e.data)}get options(){return this._def.values}get enum(){const e={};for(const r of this._def.values)e[r]=r;return e}get Values(){const e={};for(const r of this._def.values)e[r]=r;return e}get Enum(){const e={};for(const r of this._def.values)e[r]=r;return e}extract(e){return Ru.create(e)}exclude(e){return Ru.create(this.options.filter(r=>!e.includes(r)))}}Ru.create=iL;class ry extends ct{_parse(e){const r=Pt.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==Pe.string&&n.parsedType!==Pe.number){const s=Pt.objectValues(r);return Re(n,{expected:Pt.joinValues(s),received:n.parsedType,code:Ee.invalid_type}),et}if(r.indexOf(e.data)===-1){const s=Pt.objectValues(r);return Re(n,{received:n.data,code:Ee.invalid_enum_value,options:s}),et}return Jn(e.data)}get enum(){return this._def.values}}ry.create=(t,e)=>new ry({values:t,typeName:Ke.ZodNativeEnum,...rt(e)});class ap extends ct{unwrap(){return this._def.type}_parse(e){const{ctx:r}=this._processInputParams(e);if(r.parsedType!==Pe.promise&&r.common.async===!1)return Re(r,{code:Ee.invalid_type,expected:Pe.promise,received:r.parsedType}),et;const n=r.parsedType===Pe.promise?r.data:Promise.resolve(r.data);return Jn(n.then(s=>this._def.type.parseAsync(s,{path:r.path,errorMap:r.common.contextualErrorMap})))}}ap.create=(t,e)=>new ap({type:t,typeName:Ke.ZodPromise,...rt(e)});class Ki extends ct{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Ke.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:r,ctx:n}=this._processInputParams(e),s=this._def.effect||null,i={addIssue:o=>{Re(n,o),o.fatal?r.abort():r.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),s.type==="preprocess"){const o=s.transform(n.data,i);return n.common.issues.length?{status:"dirty",value:n.data}:n.common.async?Promise.resolve(o).then(a=>this._def.schema._parseAsync({data:a,path:n.path,parent:n})):this._def.schema._parseSync({data:o,path:n.path,parent:n})}if(s.type==="refinement"){const o=a=>{const c=s.refinement(a,i);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(n.common.async===!1){const a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?et:(a.status==="dirty"&&r.dirty(),o(a.value),{status:r.value,value:a.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>a.status==="aborted"?et:(a.status==="dirty"&&r.dirty(),o(a.value).then(()=>({status:r.value,value:a.value}))))}if(s.type==="transform")if(n.common.async===!1){const o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Gm(o))return o;const a=s.transform(o.value,i);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>Gm(o)?Promise.resolve(s.transform(o.value,i)).then(a=>({status:r.value,value:a})):o);Pt.assertNever(s)}}Ki.create=(t,e,r)=>new Ki({schema:t,typeName:Ke.ZodEffects,effect:e,...rt(r)});Ki.createWithPreprocess=(t,e,r)=>new Ki({schema:e,effect:{type:"preprocess",transform:t},typeName:Ke.ZodEffects,...rt(r)});class ec extends ct{_parse(e){return this._getType(e)===Pe.undefined?Jn(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ec.create=(t,e)=>new ec({innerType:t,typeName:Ke.ZodOptional,...rt(e)});class Pd extends ct{_parse(e){return this._getType(e)===Pe.null?Jn(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Pd.create=(t,e)=>new Pd({innerType:t,typeName:Ke.ZodNullable,...rt(e)});
vendor: 4,773 bytes, line 2
2class ny extends ct{_parse(e){const{ctx:r}=this._processInputParams(e);let n=r.data;return r.parsedType===Pe.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}}ny.create=(t,e)=>new ny({innerType:t,typeName:Ke.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...rt(e)});class k_ extends ct{_parse(e){const{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},s=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return N_(s)?s.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Wi(n.common.issues)},input:n.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Wi(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}k_.create=(t,e)=>new k_({innerType:t,typeName:Ke.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...rt(e)});class j_ extends ct{_parse(e){if(this._getType(e)!==Pe.nan){const n=this._getOrReturnCtx(e);return Re(n,{code:Ee.invalid_type,expected:Pe.nan,received:n.parsedType}),et}return{status:"valid",value:e.data}}}j_.create=t=>new j_({typeName:Ke.ZodNaN,...rt(t)});const JG=Symbol("zod_brand");class oL extends ct{_parse(e){const{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}}class o0 extends ct{_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const i=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?et:i.status==="dirty"?(r.dirty(),sL(i.value)):this._def.out._parseAsync({data:i.value,path:n.path,parent:n})})();{const s=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?et:s.status==="dirty"?(r.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:n.path,parent:n})}}static create(e,r){return new o0({in:e,out:r,typeName:Ke.ZodPipeline})}}class D_ extends ct{_parse(e){const r=this._def.innerType._parse(e);return Gm(r)&&(r.value=Object.freeze(r.value)),r}}D_.create=(t,e)=>new D_({innerType:t,typeName:Ke.ZodReadonly,...rt(e)});const aL=(t,e={},r)=>t?op.create().superRefine((n,s)=>{var i,o;if(!t(n)){const a=typeof e=="function"?e(n):typeof e=="string"?{message:e}:e,c=(o=(i=a.fatal)!==null&&i!==void 0?i:r)!==null&&o!==void 0?o:!0,u=typeof a=="string"?{message:a}:a;s.addIssue({code:"custom",...u,fatal:c})}}):op.create(),QG={object:hr.lazycreate};var Ke;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(Ke||(Ke={}));const XG=(t,e={message:`Input not instance of ${t.name}`})=>aL(r=>r instanceof t,e),cL=qi.create,uL=Nu.create,eK=j_.create,tK=xu.create,lL=Km.create,rK=Sd.create,nK=x_.create,sK=Zm.create,iK=Ym.create,oK=op.create,aK=bd.create,cK=oc.create,uK=R_.create,lK=Vi.create,dK=hr.create,fK=hr.strictCreate,hK=Jm.create,pK=xA.create,gK=Qm.create,mK=zo.create,yK=Xm.create,bK=B_.create,wK=Td.create,EK=sh.create,vK=ey.create,_K=ty.create,AK=Ru.create,CK=ry.create,IK=ap.create,Ix=Ki.create,SK=ec.create,TK=Pd.create,PK=Ki.createWithPreprocess,OK=o0.create,NK=()=>cL().optional(),xK=()=>uL().optional(),RK=()=>lL().optional(),BK={string:t=>qi.create({...t,coerce:!0}),number:t=>Nu.create({...t,coerce:!0}),boolean:t=>Km.create({...t,coerce:!0}),bigint:t=>xu.create({...t,coerce:!0}),date:t=>Sd.create({...t,coerce:!0})},kK=et;var F=Object.freeze({__proto__:null,defaultErrorMap:Vm,setErrorMap:MG,getErrorMap:P_,makeIssue:O_,EMPTY_PATH:$G,addIssueToContext:Re,ParseStatus:Nn,INVALID:et,DIRTY:sL,OK:Jn,isAborted:zS,isDirty:WS,isValid:Gm,isAsync:N_,get util(){return Pt},get objectUtil(){return qS},ZodParsedType:Pe,getParsedType:Yc,ZodType:ct,ZodString:qi,ZodNumber:Nu,ZodBigInt:xu,ZodBoolean:Km,ZodDate:Sd,ZodSymbol:x_,ZodUndefined:
2Zm,ZodNull:Ym,ZodAny:op,ZodUnknown:bd,ZodNever:oc,ZodVoid:R_,ZodArray:Vi,ZodObject:hr,ZodUnion:Jm,ZodDiscriminatedUnion:xA,ZodIntersection:Qm,ZodTuple:zo,ZodRecord:Xm,ZodMap:B_,ZodSet:Td,ZodFunction:sh,ZodLazy:ey,ZodLiteral:ty,ZodEnum:Ru,ZodNativeEnum:ry,ZodPromise:ap,ZodEffects:Ki,ZodTransformer:Ki,ZodOptional:ec,ZodNullable:Pd,ZodDefault:ny,ZodCatch:k_,ZodNaN:j_,BRAND:JG,ZodBranded:oL,ZodPipeline:o0,ZodReadonly:D_,custom:aL,Schema:ct,ZodSchema:ct,late:QG,get ZodFirstPartyTypeKind(){return Ke},coerce:BK,any:oK,array:lK,bigint:tK,boolean:lL,date:rK,discriminatedUnion:pK,effect:Ix,enum:AK,function:EK,instanceof:XG,intersection:gK,lazy:vK,literal:_K,map:bK,nan:eK,nativeEnum:CK,never:cK,null:iK,nullable:TK,number:uL,object:dK,oboolean:RK,onumber:xK,optional:SK,ostring:NK,pipeline:OK,preprocess:PK,promise:IK,record:yK,set:wK,strictObject:fK,string:cL,symbol:nK,transformer:Ix,tuple:mK,undefined:sK,union:hK,unknown:aK,void:uK,NEVER:kK,ZodIssueCode:Ee,quotelessJson:UG,ZodError:Wi});const gr=F.object({message:F.string()});function Oe(t){return F.literal(je[t])}const RA=F.object({serializedMessage:F.string().optional(),accountAddress:F.string(),chainId:F.string(),notBefore:F.string().optional(),domain:F.string(),uri:F.string(),version:F.string(),nonce:F.string(),statement:F.string().optional(),resources:F.array(F.string()).optional(),requestId:F.string().optional(),issuedAt:F.string().optional(),expirationTime:F.string().optional()});F.object({accessList:F.array(F.string()),blockHash:F.string().nullable(),blockNumber:F.string().nullable(),chainId:F.string().or(F.number()),from:F.string(),gas:F.string(),hash:F.string(),input:F.string().nullable(),maxFeePerGas:F.string(),maxPriorityFeePerGas:F.string(),nonce:F.string(),r:F.string(),s:F.string(),to:F.string(),transactionIndex:F.string().nullable(),type:F.string(),v:F.string(),value:F.string()});const jK=F.object({chainId:F.string().or(F.number()),rpcUrl:F.optional(F.string())}),DK=F.object({email:F.string().email()}),UK=F.object({otp:F.string()}),MK=F.object({uri:F.string(),preferredAccountType:F.optional(F.string()),chainId:F.optional(F.string().or(F.number())),siwxMessage:F.optional(RA),rpcUrl:F.optional(F.string())}),$K=F.object({chainId:F.optional(F.string().or(F.number())),preferredAccountType:F.optional(F.string()),socialUri:F.optional(F.string()),siwxMessage:F.optional(RA),rpcUrl:F.optional(F.string())}),LK=F.object({provider:F.enum(["google","github","apple","facebook","x","discord"])}),FK=F.object({email:F.string().email()}),HK=F.object({otp:F.string()}),qK=F.object({otp:F.string()}),zK=F.object({themeMode:F.optional(F.enum(["light","dark"])),themeVariables:F.optional(F.record(F.string(),F.string().or(F.number()))),w3mThemeVariables:F.optional(F.record(F.string(),F.string()))}),WK=F.object({metadata:F.object({name:F.string(),description:F.string(),url:F.string(),icons:F.array(F.string())}).optional(),sdkVersion:F.string().optional(),sdkType:F.string().optional(),projectId:F.string()}),VK=F.object({type:F.string()}),GK=F.object({action:F.enum(["VERIFY_DEVICE","VERIFY_OTP","CONNECT"])}),KK=F.object({url:F.string()}),ZK=F.object({userName:F.string()}),YK=F.object({email:F.string().optional().nullable(),address:F.string(),chainId:F.string().or(F.number()),accounts:F.array(F.object({address:F.string(),type:F.enum([Tr.ACCOUNT_TYPES.EOA,Tr.ACCOUNT_TYPES.SMART_ACCOUNT])})).optional(),userName:F.string().optional().nullable(),preferredAccountType:F.optional(F.string()),signature:F.string().optional(),message:F.string().optional(),siwxMessage:F.optional(RA)}),JK=F.object({action:F.enum(["VERIFY_PRIMARY_OTP","VERIFY_SECONDARY_OTP"])}),QK=F.object({email:F.string().email().optional().nullable(),address:F.string(),chainId:F.string().or(F.number()),smartAccountDeployed:F.optional(F.boolean()),accounts:F.array(F.object({address:F.string(),type:F.enum([Tr.ACCOUNT_TYPES.EOA,Tr.ACCOUNT_TYPES.SMART_ACCOUNT])})).optional(),preferredAccountType:F.optional(F.string()),signature:F.string().optional(),message:F.string().optional(),siwxMessage:F.optional(RA)}),XK=F.object({uri:F.string()}),eZ=F.object({isConnected:F.boolean()}
2),tZ=F.object({chainId:F.string().or(F.number())}),rZ=F.object({chainId:F.string().or(F.number())}),nZ=F.object({newEmail:F.string().email()}),sZ=F.object({smartAccountEnabledNetworks:F.array(F.number())});F.object({address:F.string(),isDeployed:F.boolean()});const iZ=F.object({version:F.string().optional()}),oZ=F.object({type:F.string(),address:F.string()}),aZ=F.any(),cZ=F.object({method:F.literal("eth_accounts")}),uZ=F.object({method:F.literal("eth_blockNumber")}),lZ=F.object({method:F.literal("eth_call"),params:F.array(F.any())}),dZ=F.object({method:F.literal("eth_chainId")}),fZ=F.object({method:F.literal("eth_estimateGas"),params:F.array(F.any())}),hZ=F.object({method:F.literal("eth_feeHistory"),params:F.array(F.any())}),pZ=F.object({method:F.literal("eth_gasPrice")}),gZ=F.object({method:F.literal("eth_getAccount"),params:F.array(F.any())}),mZ=F.object({method:F.literal("eth_getBalance"),params:F.array(F.any())}),yZ=F.object({method:F.literal("eth_getBlockByHash"),params:F.array(F.any())}),bZ=F.object({method:F.literal("eth_getBlockByNumber"),params:F.array(F.any())}),wZ=F.object({method:F.literal("eth_getBlockReceipts"),params:F.array(F.any())}),EZ=F.object({method:F.literal("eth_getBlockTransactionCountByHash"),params:F.array(F.any())}),vZ=F.object({method:F.literal("eth_getBlockTransactionCountByNumber"),params:F.array(F.any())}),_Z=F.object({method:F.literal("eth_getCode"),params:F.array(F.any())}),AZ=F.object({method:F.literal("eth_getFilterChanges"),params:F.array(F.any())}),CZ=F.object({method:F.literal("eth_getFilterLogs"),params:F.array(F.any())}),IZ=F.object({method:F.literal("eth_getLogs"),params:F.array(F.any())}),SZ=F.object({method:F.literal("eth_getProof"),params:F.array(F.any())}),TZ=F.object({method:F.literal("eth_getStorageAt"),params:F.array(F.any())}),PZ=F.object({method:F.literal("eth_getTransactionByBlockHashAndIndex"),params:F.array(F.any())}),OZ=F.object({method:F.literal("eth_getTransactionByBlockNumberAndIndex"),params:F.array(F.any())}),NZ=F.object({method:F.literal("eth_getTransactionByHash"),params:F.array(F.any())}),xZ=F.object({method:F.literal("eth_getTransactionCount"),params:F.array(F.any())}),RZ=F.object({method:F.literal("eth_getTransactionReceipt"),params:F.array(F.any())}),BZ=F.object({method:F.literal("eth_getUncleCountByBlockHash"),params:F.array(F.any())}),kZ=F.object({method:F.literal("eth_getUncleCountByBlockNumber"),params:F.array(F.any())}),jZ=F.object({method:F.literal("eth_maxPriorityFeePerGas")}),DZ=F.object({method:F.literal("eth_newBlockFilter")}),UZ=F.object({method:F.literal("eth_newFilter"),params:F.array(F.any())}),MZ=F.object({method:F.literal("eth_newPendingTransactionFilter")}),$Z=F.object({method:F.literal("eth_sendRawTransaction"),params:F.array(F.any())}),LZ=F.object({method:F.literal("eth_syncing"),params:F.array(F.any())}),FZ=F.object({method:F.literal("eth_uninstallFilter"),params:F.array(F.any())}),Sx=F.object({method:F.literal("personal_sign"),params:F.array(F.any())}),HZ=F.object({method:F.literal("eth_signTypedData_v4"),params:F.array(F.any())}),qZ=F.object({method:F.literal("eth_sendTransaction"),params:F.array(F.any())}),zZ=F.object({method:F.literal("solana_signMessage"),params:F.object({message:F.string(),pubkey:F.string()})}),WZ=F.object({method:F.literal("solana_signTransaction"),params:F.object({transaction:F.string()})}),VZ=F.object({method:F.literal("solana_signAllTransactions"),params:F.object({transactions:F.array(F.string())})}),GZ=F.object({method:F.literal("solana_signAndSendTransaction"),params:F.object({transaction:F.string(),options:F.object({skipPreflight:F.boolean().optional(),preflightCommitment:F.enum(["processed","confirmed","finalized","recent","single","singleGossip","root","max"]).optional(),maxRetries:F.number().optional(),minContextSlot:F.number().optional()}).optional()})}),KZ=F.object({method:F.literal("wallet_sendCalls"),params:F.array(F.object({chainId:F.string().or(F.number()).optional(),from:F.string().optional(),version:F.string().optional(),capabilities:F.any().optional(),calls:F.array(F.object({to:F.string().startsWith("0x"),data:F.string().startsWith("0x").optional(),value:F.string().optional()}))}))}),ZZ=F.object({method:F.literal("wallet_getCallsStatus"),params:F.array(F.string())}),YZ=F.object({method:F.literal("wallet_getCapabilities"),params:F.array(F.string().or(F.number()).optional()).optional()}),JZ=F.object({method:F.literal("wallet_grantPermissions"),params:F.array(F.any())}),QZ=F.object({method:F.literal("wallet_revokePermissions"),params:F.any()}),XZ=F.object({method:F.literal("wallet_getAssets"),params:F.any()}
2),Tx=F.object({token:F.string()}),Ne=F.object({id:F.string().optional()}),A2={appEvent:Ne.extend({type:Oe("APP_SWITCH_NETWORK"),payload:jK}).or(Ne.extend({type:Oe("APP_CONNECT_EMAIL"),payload:DK})).or(Ne.extend({type:Oe("APP_CONNECT_DEVICE")})).or(Ne.extend({type:Oe("APP_CONNECT_OTP"),payload:UK})).or(Ne.extend({type:Oe("APP_CONNECT_SOCIAL"),payload:MK})).or(Ne.extend({type:Oe("APP_GET_FARCASTER_URI")})).or(Ne.extend({type:Oe("APP_CONNECT_FARCASTER")})).or(Ne.extend({type:Oe("APP_GET_USER"),payload:F.optional($K)})).or(Ne.extend({type:Oe("APP_GET_SOCIAL_REDIRECT_URI"),payload:LK})).or(Ne.extend({type:Oe("APP_SIGN_OUT")})).or(Ne.extend({type:Oe("APP_IS_CONNECTED"),payload:F.optional(Tx)})).or(Ne.extend({type:Oe("APP_GET_CHAIN_ID")})).or(Ne.extend({type:Oe("APP_GET_SMART_ACCOUNT_ENABLED_NETWORKS")})).or(Ne.extend({type:Oe("APP_INIT_SMART_ACCOUNT")})).or(Ne.extend({type:Oe("APP_SET_PREFERRED_ACCOUNT"),payload:VK})).or(Ne.extend({type:Oe("APP_RPC_REQUEST"),payload:Sx.or(XZ).or(cZ).or(uZ).or(lZ).or(dZ).or(fZ).or(hZ).or(pZ).or(gZ).or(mZ).or(yZ).or(bZ).or(wZ).or(EZ).or(vZ).or(_Z).or(AZ).or(CZ).or(IZ).or(SZ).or(TZ).or(PZ).or(OZ).or(NZ).or(xZ).or(RZ).or(BZ).or(kZ).or(jZ).or(DZ).or(UZ).or(MZ).or($Z).or(LZ).or(FZ).or(Sx).or(HZ).or(qZ).or(zZ).or(WZ).or(VZ).or(GZ).or(ZZ).or(KZ).or(YZ).or(JZ).or(QZ).and(F.object({chainId:F.string().or(F.number()).optional(),chainNamespace:F.enum(["eip155","solana","polkadot","bip122","cosmos"]).optional(),rpcUrl:F.string().optional()}))})).or(Ne.extend({type:Oe("APP_UPDATE_EMAIL"),payload:FK})).or(Ne.extend({type:Oe("APP_UPDATE_EMAIL_PRIMARY_OTP"),payload:HK})).or(Ne.extend({type:Oe("APP_UPDATE_EMAIL_SECONDARY_OTP"),payload:qK})).or(Ne.extend({type:Oe("APP_SYNC_THEME"),payload:zK})).or(Ne.extend({type:Oe("APP_SYNC_DAPP_DATA"),payload:WK})).or(Ne.extend({type:Oe("APP_RELOAD")})).or(Ne.extend({type:Oe("APP_RPC_ABORT")})),frameEvent:Ne.extend({type:Oe("FRAME_SWITCH_NETWORK_ERROR"),payload:gr}).or(Ne.extend({type:Oe("FRAME_SWITCH_NETWORK_SUCCESS"),payload:rZ})).or(Ne.extend({type:Oe("FRAME_CONNECT_EMAIL_SUCCESS"),payload:GK})).or(Ne.extend({type:Oe("FRAME_CONNECT_EMAIL_ERROR"),payload:gr})).or(Ne.extend({type:Oe("FRAME_GET_FARCASTER_URI_SUCCESS"),payload:KK})).or(Ne.extend({type:Oe("FRAME_GET_FARCASTER_URI_ERROR"),payload:gr})).or(Ne.extend({type:Oe("FRAME_CONNECT_FARCASTER_SUCCESS"),payload:ZK})).or(Ne.extend({type:Oe("FRAME_CONNECT_FARCASTER_ERROR"),payload:gr})).or(Ne.extend({type:Oe("FRAME_CONNECT_OTP_ERROR"),payload:gr})).or(Ne.extend({type:Oe("FRAME_CONNECT_OTP_SUCCESS")})).or(Ne.extend({type:Oe("FRAME_CONNECT_DEVICE_ERROR"),payload:gr})).or(Ne.extend({type:Oe("FRAME_CONNECT_DEVICE_SUCCESS")})).or(Ne.extend({type:Oe("FRAME_CONNECT_SOCIAL_SUCCESS"),payload:YK})).or(Ne.extend({type:Oe("FRAME_CONNECT_SOCIAL_ERROR"),payload:gr})).or(Ne.extend({type:Oe("FRAME_GET_USER_ERROR"),payload:gr})).or(Ne.extend({type:Oe("FRAME_GET_USER_SUCCESS"),payload:QK})).or(Ne.extend({type:Oe("FRAME_GET_SOCIAL_REDIRECT_URI_ERROR"),payload:gr})).or(Ne.extend({type:Oe("FRAME_GET_SOCIAL_REDIRECT_URI_SUCCESS"),payload:XK})).or(Ne.extend({type:Oe("FRAME_SIGN_OUT_ERROR"),payload:gr})).or(Ne.extend({type:Oe("FRAME_SIGN_OUT_SUCCESS")})).or(Ne.extend({type:Oe("FRAME_IS_CONNECTED_ERROR"),payload:gr})).or(Ne.extend({type:Oe("FRAME_IS_CONNECTED_SUCCESS"),payload:eZ})).or(Ne.extend({type:Oe("FRAME_GET_CHAIN_ID_ERROR"),payload:gr})).or(Ne.extend({type:Oe("FRAME_GET_CHAIN_ID_SUCCESS"),payload:tZ})).or(Ne.extend({type:Oe("FRAME_RPC_REQUEST_ERROR"),payload:gr})).or(Ne.extend({type:Oe("FRAME_RPC_REQUEST_SUCCESS"),payload:aZ})).or(Ne.extend({type:Oe("FRAME_SESSION_UPDATE"),payload:Tx})).or(Ne.extend({type:Oe("FRAME_UPDATE_EMAIL_ERROR"),payload:gr})).or(Ne.extend({type:Oe("FRAME_UPDATE_EMAIL_SUCCESS"),payload:JK})).or(Ne.extend({type:Oe("FRAME_UPDATE_EMAIL_PRIMARY_OTP_ERROR"),payload:gr})).or(Ne.extend({type:Oe("FRAME_UPDATE_EMAIL_PRIMARY_OTP_SUCCESS")})).or(Ne.extend({type:Oe("FRAME_UPDATE_EMAIL_SECONDARY_OTP_ERROR"),payload:gr})).or(Ne.extend({type:Oe("FRAME_UPDATE_EMAIL_SECONDARY_OTP_SUCCESS"),payload:nZ})).or(Ne.extend({type:Oe("FRAME_SYNC_THEME_ERROR"),payload:gr})).or(Ne.extend({type:Oe("FRAME_SYNC_THEME_SUCCESS")})).or(Ne.extend({type:Oe("FRAME_SYNC_DAPP_DATA_ERROR"),payload:gr})).or(Ne.extend({type:Oe("FRAME_SYNC_DAPP_DATA_SUCCESS")})).or(Ne.extend({type:Oe("FRAME_GET_SMART_ACCOUNT_ENABLED_NETWORKS_SUCCESS"),payload:sZ}
2)).or(Ne.extend({type:Oe("FRAME_GET_SMART_ACCOUNT_ENABLED_NETWORKS_ERROR"),payload:gr})).or(Ne.extend({type:Oe("FRAME_INIT_SMART_ACCOUNT_ERROR"),payload:gr})).or(Ne.extend({type:Oe("FRAME_SET_PREFERRED_ACCOUNT_SUCCESS"),payload:oZ})).or(Ne.extend({type:Oe("FRAME_SET_PREFERRED_ACCOUNT_ERROR"),payload:gr})).or(Ne.extend({type:Oe("FRAME_READY"),payload:iZ})).or(Ne.extend({type:Oe("FRAME_RELOAD_ERROR"),payload:gr})).or(Ne.extend({type:Oe("FRAME_RELOAD_SUCCESS")}))};function C2(t,e={}){var r;return typeof(e==null?void 0:e.type)=="string"&&((r=e==null?void 0:e.type)==null?void 0:r.includes(t))}function eY({projectId:t,chainId:e,enableLogger:r,rpcUrl:n=rL.BLOCKCHAIN_API_RPC_URL,enableCloudAuthAccount:s=!1}){const i=new URL(kG);i.searchParams.set("projectId",t),i.searchParams.set("chainId",String(e)),i.searchParams.set("version",DG),i.searchParams.set("enableLogger",String(r)),i.searchParams.set("rpcUrl",n);const o=Ur.get("dapp_smart_account_version");return o&&(o==="v6"||o==="v7")&&(console.warn(">> AppKit - Forcing smart account version",o),i.searchParams.set("smartAccountVersion",o)),s&&i.searchParams.set("enableCloudAuthAccount","true"),i.toString()}class tY{constructor({projectId:e,isAppClient:r=!1,chainId:n="eip155:1",enableLogger:s=!0,enableCloudAuthAccount:i=!1,rpcUrl:o=rL.BLOCKCHAIN_API_RPC_URL}){if(this.iframe=null,this.iframeIsReady=!1,this.initFrame=()=>{const a=document.getElementById("w3m-iframe");this.iframe&&!a&&document.body.appendChild(this.iframe)},this.events={registerFrameEventHandler:(a,c,u)=>{function l({data:d}){var g;if(!C2(je.FRAME_EVENT_KEY,d))return;const f=A2.frameEvent.safeParse(d);if(!f.success){console.warn("W3mFrame: invalid frame event",f.error.message);return}((g=f.data)==null?void 0:g.id)===a&&(c(f.data),window.removeEventListener("message",l))}Ws.isClient&&(window.addEventListener("message",l),u.addEventListener("abort",()=>{window.removeEventListener("message",l)}))},onFrameEvent:a=>{Ws.isClient&&window.addEventListener("message",({data:c})=>{if(!C2(je.FRAME_EVENT_KEY,c))return;const u=A2.frameEvent.safeParse(c);u.success?a(u.data):console.warn("W3mFrame: invalid frame event",u.error.message)})},onAppEvent:a=>{Ws.isClient&&window.addEventListener("message",({data:c})=>{if(!C2(je.APP_EVENT_KEY,c))return;const u=A2.appEvent.safeParse(c);u.success||console.warn("W3mFrame: invalid app event",u.error.message),a(c)})},postAppEvent:a=>{var c;if(Ws.isClient){if(!((c=this.iframe)!=null&&c.contentWindow))throw new Error("W3mFrame: iframe is not set");this.iframe.contentWindow.postMessage(a,"*")}},postFrameEvent:a=>{if(Ws.isClient){if(!parent)throw new Error("W3mFrame: parent is not set");parent.postMessage(a,"*")}}},this.projectId=e,this.frameLoadPromise=new Promise((a,c)=>{this.frameLoadPromiseResolver={resolve:a,reject:c}}),this.rpcUrl=o,r&&(this.frameLoadPromise=new Promise((a,c)=>{this.frameLoadPromiseResolver={resolve:a,reject:c}}),Ws.isClient)){const a=document.createElement("iframe");a.id="w3m-iframe",a.src=eY({projectId:e,chainId:n,enableLogger:s,rpcUrl:this.rpcUrl,enableCloudAuthAccount:i}),a.name="w3m-secure-iframe",a.style.position="fixed",a.style.zIndex="999999",a.style.display="none",a.style.border="none",a.style.animationDelay="0s, 50ms",a.style.borderBottomLeftRadius="clamp(0px, var(--apkt-borderRadius-8), 44px)",a.style.borderBottomRightRadius="clamp(0px, var(--apkt-borderRadius-8), 44px)",this.iframe=a,this.iframe.onerror=()=>{var c;(c=this.frameLoadPromiseResolver)==null||c.reject("Unable to load email login dependency")},this.events.onFrameEvent(c=>{var u;c.type==="@w3m-frame/READY"&&(this.iframeIsReady=!0,(u=this.frameLoadPromiseResolver)==null||u.resolve(void 0))})}}get networks(){const e=["eip155:1","eip155:5","eip155:11155111","eip155:10","eip155:420","eip155:42161","eip155:421613","eip155:137","eip155:80001","eip155:42220","eip155:1313161554","eip155:1313161555","eip155:56","eip155:97","eip155:43114","eip155:43113","eip155:324","eip155:280","eip155:100","eip155:8453","eip155:84531","eip155:84532","eip155:7777777","eip155:999","solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp","solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z","solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1"].map(r=>({[r]:{rpcUrl:`${this.rpcUrl}/v1/?chainId=${r}&projectId=${this.projectId}`,chainId:r}}));return Object.assign({},...e)}}var No={exports:{}};function rY(t){try{return JSON.stringify(t)}catch{return'"[Circular]"'}}var nY=sY;function sY(t,e,r){var n=r&&r.stringify||rY,s=1;if(typeof t=="object"&&t!==null){var i=e.length+s;
vendor: 8,455 bytes, line 2
2if(i===1)return t;var o=new Array(i);o[0]=n(t);for(var a=1;a<i;a++)o[a]=n(e[a]);return o.join(" ")}if(typeof t!="string")return t;var c=e.length;if(c===0)return t;for(var u="",l=1-s,d=-1,f=t&&t.length||0,g=0;g<f;){if(t.charCodeAt(g)===37&&g+1<f){switch(d=d>-1?d:0,t.charCodeAt(g+1)){case 100:case 102:if(l>=c||e[l]==null)break;d<g&&(u+=t.slice(d,g)),u+=Number(e[l]),d=g+2,g++;break;case 105:if(l>=c||e[l]==null)break;d<g&&(u+=t.slice(d,g)),u+=Math.floor(Number(e[l])),d=g+2,g++;break;case 79:case 111:case 106:if(l>=c||e[l]===void 0)break;d<g&&(u+=t.slice(d,g));var h=typeof e[l];if(h==="string"){u+="'"+e[l]+"'",d=g+2,g++;break}if(h==="function"){u+=e[l].name||"<anonymous>",d=g+2,g++;break}u+=n(e[l]),d=g+2,g++;break;case 115:if(l>=c)break;d<g&&(u+=t.slice(d,g)),u+=String(e[l]),d=g+2,g++;break;case 37:d<g&&(u+=t.slice(d,g)),u+="%",d=g+2,g++,l--;break}++l}++g}return d===-1?t:(d<f&&(u+=t.slice(d)),u)}const Px=nY;No.exports=tc;const sy=wY().console||{},iY={mapHttpRequest:ob,mapHttpResponse:ob,wrapRequestSerializer:I2,wrapResponseSerializer:I2,wrapErrorSerializer:I2,req:ob,res:ob,err:Nx,errWithCause:Nx};function Eu(t,e){return t==="silent"?1/0:e.levels.values[t]}const $P=Symbol("pino.logFuncs"),GS=Symbol("pino.hierarchy"),oY={error:"log",fatal:"error",warn:"error",info:"log",debug:"log",trace:"log"};function Ox(t,e){const r={logger:e,parent:t[GS]};e[GS]=r}function aY(t,e,r){const n={};e.forEach(s=>{n[s]=r[s]?r[s]:sy[s]||sy[oY[s]||"log"]||ih}),t[$P]=n}function cY(t,e){return Array.isArray(t)?t.filter(function(r){return r!=="!stdSerializers.err"}):t===!0?Object.keys(e):!1}function tc(t){t=t||{},t.browser=t.browser||{};const e=t.browser.transmit;if(e&&typeof e.send!="function")throw Error("pino: transmit option must have a send function");const r=t.browser.write||sy;t.browser.write&&(t.browser.asObject=!0);const n=t.serializers||{},s=cY(t.browser.serialize,n);let i=t.browser.serialize;Array.isArray(t.browser.serialize)&&t.browser.serialize.indexOf("!stdSerializers.err")>-1&&(i=!1);const o=Object.keys(t.customLevels||{}),a=["error","fatal","warn","info","debug","trace"].concat(o);typeof r=="function"&&a.forEach(function(p){r[p]=r}),(t.enabled===!1||t.browser.disabled)&&(t.level="silent");const c=t.level||"info",u=Object.create(r);u.log||(u.log=ih),aY(u,a,r),Ox({},u),Object.defineProperty(u,"levelVal",{get:d}),Object.defineProperty(u,"level",{get:f,set:g});const l={transmit:e,serialize:s,asObject:t.browser.asObject,asObjectBindingsOnly:t.browser.asObjectBindingsOnly,formatters:t.browser.formatters,levels:a,timestamp:mY(t),messageKey:t.messageKey||"msg",onChild:t.onChild||ih};u.levels=uY(t),u.level=c,u.isLevelEnabled=function(p){return this.levels.values[p]?this.levels.values[p]>=this.levels.values[this.level]:!1},u.setMaxListeners=u.getMaxListeners=u.emit=u.addListener=u.on=u.prependListener=u.once=u.prependOnceListener=u.removeListener=u.removeAllListeners=u.listeners=u.listenerCount=u.eventNames=u.write=u.flush=ih,u.serializers=n,u._serialize=s,u._stdErrSerialize=i,u.child=function(...p){return h.call(this,l,...p)},e&&(u._logEvent=KS());function d(){return Eu(this.level,this)}function f(){return this._level}function g(p){if(p!=="silent"&&!this.levels.values[p])throw Error("unknown level "+p);this._level=p,Xu(this,l,u,"error"),Xu(this,l,u,"fatal"),Xu(this,l,u,"warn"),Xu(this,l,u,"info"),Xu(this,l,u,"debug"),Xu(this,l,u,"trace"),o.forEach(y=>{Xu(this,l,u,y)})}function h(p,y,w){if(!y)throw new Error("missing bindings for child Pino");w=w||{},s&&y.serializers&&(w.serializers=y.serializers);const I=w.serializers;if(s&&I){var v=Object.assign({},n,I),E=t.browser.serialize===!0?Object.keys(v):s;delete y.serializers,LP([y],E,v,this._stdErrSerialize)}function b(_){this._childLevel=(_._childLevel|0)+1,this.bindings=y,v&&(this.serializers=v,this._serialize=E),e&&(this._logEvent=KS([].concat(_._logEvent.bindings,y)))}b.prototype=this;const m=new b(this);return Ox(this,m),m.child=function(..._){return h.call(this,p,..._)},m.level=w.level||this.level,p.onChild(m),m}return u}function uY(t){const e=t.customLevels||{},r=Object.assign({},tc.levels.values,e),n=Object.assign({},tc.levels.labels,lY(e));return{values:r,labels:n}}function lY(t){const e={};return Object.keys(t).forEach(function(r){e[t[r]]=r}),e}tc.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}},tc.stdSerializers=iY,tc.stdTimeFunctions=Object.assign({},{nullTime:dL,epochTime:fL,unixTime:yY,isoTime:bY});function dY(t){const e=[];t.bindings&&e.push(t.bindings);let r=t[GS];for(;r.parent;)r=r.parent,r.logger.bindings&&e.push(r.logger.bindings);return e.reverse()}function Xu(t,e,r,n){if(Object.defineProperty(t,n,{value:Eu(t.level,r)>Eu(n,r)?ih:r[$P][n],writable:!0,enumerable:!0,configurable:!0}),t[n]===ih){if(!e.transmit)return;const i=e.transmit.level||t.level,o=Eu(i,r);if(Eu(n,r)<o)return}t[n]=hY(t,e,r,n);const s=dY(t);s.length!==0&&(t[n]=fY(s,t[n]))}function fY(t,e){return function(){return e.apply(this,[...t,...arguments])}}function hY(t,e,r,n){return function(s){return function(){const i=e.timestamp(),o=new Array(arguments.length),a=Object.getPrototypeOf&&Object.getPrototypeOf(this)===sy?sy:this;for(var c=0;c<o.length;c++)o[c]=arguments[c];var u=!1;if(e.serialize&&(LP(o,this._serialize,this.serializers,this._stdErrSerialize),u=!0),e.asObject||e.formatters?s.call(a,...pY(this,n,o,i,e)):s.apply(a,o),e.transmit){const l=e.transmit.level||t._level,d=Eu(l,r),f=Eu(n,r);if(f<d)return;gY(this,{ts:i,methodLevel:n,methodValue:f,transmitValue:r.levels.values[e.transmit.level||t._level],send:e.transmit.send,val:Eu(t._level,r)},o,u)}}}(t[$P][n])}function pY(t,e,r,n,s){const{level:i,log:o=d=>d}=s.formatters||{},a=r.slice();let c=a[0];const u={};let l=(t._childLevel|0)+1;if(l<1&&(l=1),n&&(u.time=n),i){const d=i(e,t.levels.values[e]);Object.assign(u,d)}else u.level=t.levels.values[e];if(s.asObjectBindingsOnly){if(c!==null&&typeof c=="object")for(;l--&&typeof a[0]=="object";)Object.assign(u,a.shift());return[o(u),...a]}else{if(c!==null&&typeof c=="object"){for(;l--&&typeof a[0]=="object";)Object.assign(u,a.shift());c=a.length?Px(a.shift(),a):void 0}else typeof c=="string"&&(c=Px(a.shift(),a));return c!==void 0&&(u[s.messageKey]=c),[o(u)]}}function LP(t,e,r,n){for(const s in t)if(n&&t[s]instanceof Error)t[s]=tc.stdSerializers.err(t[s]);else if(typeof t[s]=="object"&&!Array.isArray(t[s])&&e)for(const i in t[s])e.indexOf(i)>-1&&i in r&&(t[s][i]=r[i](t[s][i]))}function gY(t,e,r,n=!1){const s=e.send,i=e.ts,o=e.methodLevel,a=e.methodValue,c=e.val,u=t._logEvent.bindings;n||LP(r,t._serialize||Object.keys(t.serializers),t.serializers,t._stdErrSerialize===void 0?!0:t._stdErrSerialize),t._logEvent.ts=i,t._logEvent.messages=r.filter(function(l){return u.indexOf(l)===-1}),t._logEvent.level.label=o,t._logEvent.level.value=a,s(o,t._logEvent,c),t._logEvent=KS(u)}function KS(t){return{ts:0,messages:[],bindings:t||[],level:{label:"",value:0}}}function Nx(t){const e={type:t.constructor.name,msg:t.message,stack:t.stack};for(const r in t)e[r]===void 0&&(e[r]=t[r]);return e}function mY(t){return typeof t.timestamp=="function"?t.timestamp:t.timestamp===!1?dL:fL}function ob(){return{}}function I2(t){return t}function ih(){}function dL(){return!1}function fL(){return Date.now()}function yY(){return Math.round(Date.now()/1e3)}function bY(){return new Date(Date.now()).toISOString()}function wY(){function t(e){return typeof e<"u"&&e}try{return typeof globalThis<"u"||Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),globalThis}catch{return t(self)||t(window)||t(this)||{}}}No.exports.default=tc;No.exports.pino=tc;const EY={level:"info"},BA="custom_context",FP=1e3*1024;var vY=Object.defineProperty,_Y=(t,e,r)=>e in t?vY(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Jc=(t,e,r)=>_Y(t,typeof e!="symbol"?e+"":e,r);let AY=class{constructor(e){Jc(this,"nodeValue"),Jc(this,"sizeInBytes"),Jc(this,"next"),this.nodeValue=e,this.sizeInBytes=new TextEncoder().encode(this.nodeValue).length,this.next=null}get value(){return this.nodeValue}get size(){return this.sizeInBytes}},xx=class{constructor(e){Jc(this,"lengthInNodes"),Jc(this,"sizeInBytes"),Jc(this,"head"),Jc(this,"tail"),Jc(this,"maxSizeInBytes"),this.head=null,this.tail=null,this.lengthInNodes=0,this.maxSizeInBytes=e,this.sizeInBytes=0}append(e){const r=new AY(e);
2if(r.size>this.maxSizeInBytes)throw new Error(`[LinkedList] Value too big to insert into list: ${e} with size ${r.size}`);for(;this.size+r.size>this.maxSizeInBytes;)this.shift();this.head?(this.tail&&(this.tail.next=r),this.tail=r):(this.head=r,this.tail=r),this.lengthInNodes++,this.sizeInBytes+=r.size}shift(){if(!this.head)return;const e=this.head;this.head=this.head.next,this.head||(this.tail=null),this.lengthInNodes--,this.sizeInBytes-=e.size}toArray(){const e=[];let r=this.head;for(;r!==null;)e.push(r.value),r=r.next;return e}get length(){return this.lengthInNodes}get size(){return this.sizeInBytes}toOrderedArray(){return Array.from(this)}[Symbol.iterator](){let e=this.head;return{next:()=>{if(!e)return{done:!0,value:null};const r=e.value;return e=e.next,{done:!1,value:r}}}}};const CY=t=>JSON.stringify(t,(e,r)=>typeof r=="bigint"?r.toString()+"n":r);function Rx(t){return typeof t=="string"?t:CY(t)||""}var IY=Object.defineProperty,SY=(t,e,r)=>e in t?IY(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ab=(t,e,r)=>SY(t,typeof e!="symbol"?e+"":e,r);let hL=class{constructor(e,r=FP){ab(this,"logs"),ab(this,"level"),ab(this,"levelValue"),ab(this,"MAX_LOG_SIZE_IN_BYTES"),this.level=e??"error",this.levelValue=No.exports.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=r,this.logs=new xx(this.MAX_LOG_SIZE_IN_BYTES)}forwardToConsole(e,r){r===No.exports.levels.values.error?console.error(e):r===No.exports.levels.values.warn?console.warn(e):r===No.exports.levels.values.debug?console.debug(e):r===No.exports.levels.values.trace?console.trace(e):console.log(e)}appendToLogs(e){this.logs.append(Rx({timestamp:new Date().toISOString(),log:e}));const r=typeof e=="string"?JSON.parse(e).level:e.level;r>=this.levelValue&&this.forwardToConsole(e,r)}getLogs(){return this.logs}clearLogs(){this.logs=new xx(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(e){const r=this.getLogArray();return r.push(Rx({extraMetadata:e})),new Blob(r,{type:"application/json"})}};var TY=Object.defineProperty,PY=(t,e,r)=>e in t?TY(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,OY=(t,e,r)=>PY(t,e+"",r);let NY=class{constructor(e,r=FP){OY(this,"baseChunkLogger"),this.baseChunkLogger=new hL(e,r)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}downloadLogsBlobInBrowser(e){const r=URL.createObjectURL(this.logsToBlob(e)),n=document.createElement("a");n.href=r,n.download=`walletconnect-logs-${new Date().toISOString()}.txt`,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(r)}};var xY=Object.defineProperty,RY=(t,e,r)=>e in t?xY(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,BY=(t,e,r)=>RY(t,e+"",r);let kY=class{constructor(e,r=FP){BY(this,"baseChunkLogger"),this.baseChunkLogger=new hL(e,r)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}};var jY=Object.defineProperty,DY=Object.defineProperties,UY=Object.getOwnPropertyDescriptors,Bx=Object.getOwnPropertySymbols,MY=Object.prototype.hasOwnProperty,$Y=Object.prototype.propertyIsEnumerable,kx=(t,e,r)=>e in t?jY(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Cu=(t,e)=>{for(var r in e||(e={}))MY.call(e,r)&&kx(t,r,e[r]);if(Bx)for(var r of Bx(e))$Y.call(e,r)&&kx(t,r,e[r]);return t},Iu=(t,e)=>DY(t,UY(e));function HP(t){return Iu(Cu({},t),{level:(t==null?void 0:t.level)||EY.level})}function LY(t,e,r=BA){return t[r]=e,t}function vs(t,e=BA){return t[e]||""}function FY(t,e,r=BA){const n=vs(t,r);return n.trim()?`${n}/${e}`:e}function _s(t,e,r=BA){const n=FY(t,e,r),s=t.child({context:n});return LY(s,n,r)}function HY(t){var e,r;const n=new NY((e=t.opts)==null?void 0:e.level,t.maxSizeInBytes);return{logger:No.exports(Iu(Cu({},t.opts),{level:"trace",browser:Iu(Cu({},(r=t.opts)==null?void 0:r.browser),{write:s=>n.write(s)})})),chunkLoggerController:n}}function qY(t){var e,r;const n=new kY((e=t.opts)==null?void 0:e.level,t.maxSizeInBytes);return{logger:No.exports(Iu(Cu({},t.opts),{level:"trace",browser:Iu(Cu({},(r=t.opts)==null?void 0:r.browser),{write:s=>n.write(s)})}),n),chunkLoggerController:n}}function kA(t){var e;if(typeof t.loggerOverride<"u"&&typeof t.loggerOverride!="string")return{logger:t.loggerOverride,chunkLoggerController:null};const r=Iu(Cu({},t.opts),{level:typeof t.loggerOverride=="string"?t.loggerOverride:(e=t.opts)==null?void 0:e.level});return typeof window<"u"?HY(Iu(Cu({},t),{opts:r})):qY(Iu(Cu({},t),{opts:r}))}class zY{constructor(e){var i;const r=HP({level:jG}),{logger:n,chunkLoggerController:s}=kA({opts:r});this.logger=_s(n,this.constructor.name),this.chunkLoggerController=s,typeof window<"u"&&((i=this.chunkLoggerController)!=null&&i.downloadLogsBlobInBrowser)&&(window.downloadAppKitLogsBlob||(window.downloadAppKitLogsBlob={}),window.downloadAppKitLogsBlob.sdk=()=>{var o;(o=this.chunkLoggerController)!=null&&o.downloadLogsBlobInBrowser&&this.chunkLoggerController.downloadLogsBlobInBrowser({projectId:e})})}}function ZS(t){if(typeof t=="bigint")return`0x${t.toString(16)}`;if(Array.isArray(t))return t.map(ZS);if(t!==null&&typeof t=="object"){const e={};for(const[r,n]of Object.entries(t))e[r]=ZS(n);return e}return t}class WY{constructor({projectId:e,chainId:r,enableLogger:n=!0,onTimeout:s,abortController:i,getActiveCaipNetwork:o,getCaipNetworks:a,enableCloudAuthAccount:c,metadata:u,sdkVersion:l,sdkType:d}){this.openRpcRequests=new Map,this.isInitialized=!1,n&&(this.w3mLogger=new zY(e)),this.abortController=i,this.getActiveCaipNetwork=o,this.getCaipNetworks=a;const f=this.getRpcUrl(r);this.projectId=e,this.sdkVersion=l,this.sdkType=d,this.metadata=u,this.w3mFrame=new tY({projectId:e,isAppClient:!0,chainId:r,enableLogger:n,rpcUrl:f,enableCloudAuthAccount:c}),this.onTimeout=s,this.getLoginEmailUsed()&&this.createFrame()}async createFrame(){this.w3mFrame.initFrame(),this.initPromise=new Promise(e=>{this.w3mFrame.events.onFrameEvent(r=>{r.type===je.FRAME_READY&&setTimeout(()=>{e()},500)})}),await this.initPromise,await this.syncDappData({metadata:this.metadata,projectId:this.projectId,sdkVersion:this.sdkVersion,sdkType:this.sdkType}
2),await this.getSmartAccountEnabledNetworks(),this.isInitialized=!0,this.initPromise=void 0}async init(){if(!this.isInitialized){if(this.initPromise){await this.initPromise;return}await this.createFrame()}}getLoginEmailUsed(){return!!Ur.get(je.EMAIL_LOGIN_USED_KEY)}getEmail(){return Ur.get(je.EMAIL)}getUsername(){return Ur.get(je.SOCIAL_USERNAME)}async reload(){var e;try{await this.appEvent({type:je.APP_RELOAD})}catch(r){throw(e=this.w3mLogger)==null||e.logger.error({error:r},"Error reloading iframe"),r}}async connectEmail(e){var r;try{Ws.checkIfAllowedToTriggerEmail(),await this.init();const n=await this.appEvent({type:je.APP_CONNECT_EMAIL,payload:e});return this.setNewLastEmailLoginTime(),n}catch(n){throw(r=this.w3mLogger)==null||r.logger.error({error:n},"Error connecting email"),n}}async connectDevice(){var e;try{return this.appEvent({type:je.APP_CONNECT_DEVICE})}catch(r){throw(e=this.w3mLogger)==null||e.logger.error({error:r},"Error connecting device"),r}}async connectOtp(e){var r;try{return this.appEvent({type:je.APP_CONNECT_OTP,payload:e})}catch(n){throw(r=this.w3mLogger)==null||r.logger.error({error:n},"Error connecting otp"),n}}async isConnected(){var e;try{if(!this.getLoginEmailUsed())return{isConnected:!1};const r=await this.appEvent({type:je.APP_IS_CONNECTED});return r!=null&&r.isConnected||this.deleteAuthLoginCache(),r}catch(r){throw this.deleteAuthLoginCache(),(e=this.w3mLogger)==null||e.logger.error({error:r},"Error checking connection"),r}}async getChainId(){var e;try{const r=await this.appEvent({type:je.APP_GET_CHAIN_ID});return this.setLastUsedChainId(r.chainId),r}catch(r){throw(e=this.w3mLogger)==null||e.logger.error({error:r},"Error getting chain id"),r}}async getSocialRedirectUri(e){var r;try{return await this.init(),this.appEvent({type:je.APP_GET_SOCIAL_REDIRECT_URI,payload:e})}catch(n){throw(r=this.w3mLogger)==null||r.logger.error({error:n},"Error getting social redirect uri"),n}}async updateEmail(e){var r;try{const n=await this.appEvent({type:je.APP_UPDATE_EMAIL,payload:e});return this.setNewLastEmailLoginTime(),n}catch(n){throw(r=this.w3mLogger)==null||r.logger.error({error:n},"Error updating email"),n}}async updateEmailPrimaryOtp(e){var r;try{return this.appEvent({type:je.APP_UPDATE_EMAIL_PRIMARY_OTP,payload:e})}catch(n){throw(r=this.w3mLogger)==null||r.logger.error({error:n},"Error updating email primary otp"),n}}async updateEmailSecondaryOtp(e){var r;try{const n=await this.appEvent({type:je.APP_UPDATE_EMAIL_SECONDARY_OTP,payload:e});return this.setLoginSuccess(n.newEmail),n}catch(n){throw(r=this.w3mLogger)==null||r.logger.error({error:n},"Error updating email secondary otp"),n}}async syncTheme(e){var r;try{return this.appEvent({type:je.APP_SYNC_THEME,payload:e})}catch(n){throw(r=this.w3mLogger)==null||r.logger.error({error:n},"Error syncing theme"),n}}async syncDappData(e){var r;try{return this.appEvent({type:je.APP_SYNC_DAPP_DATA,payload:e})}catch(n){throw(r=this.w3mLogger)==null||r.logger.error({error:n},"Error syncing dapp data"),n}}async getSmartAccountEnabledNetworks(){var e;try{const r=await this.appEvent({type:je.APP_GET_SMART_ACCOUNT_ENABLED_NETWORKS});return this.persistSmartAccountEnabledNetworks(r.smartAccountEnabledNetworks),r}catch(r){throw this.persistSmartAccountEnabledNetworks([]),(e=this.w3mLogger)==null||e.logger.error({error:r},"Error getting smart account enabled networks"),r}}async setPreferredAccount(e){var r;try{return this.appEvent({type:je.APP_SET_PREFERRED_ACCOUNT,payload:{type:e}})}catch(n){throw(r=this.w3mLogger)==null||r.logger.error({error:n},"Error setting preferred account"),n}}async connect(e){var r,n;if(e!=null&&e.socialUri)try{await this.init();const s=this.getRpcUrl(e.chainId),i=await this.appEvent({type:je.APP_CONNECT_SOCIAL,payload:{uri:e.socialUri,preferredAccountType:e.preferredAccountType,chainId:e.chainId,siwxMessage:e.siwxMessage,rpcUrl:s}});return i.userName&&this.setSocialLoginSuccess(i.userName),this.setLoginSuccess(i.email),this.setLastUsedChainId(i.chainId),this.user=i,i}catch(s){throw(r=this.w3mLogger)==null||r.logger.error({error:s},"Error connecting social"),s}
2else try{const s=(e==null?void 0:e.chainId)||this.getLastUsedChainId()||1,i=await this.getUser({chainId:s,preferredAccountType:e==null?void 0:e.preferredAccountType,siwxMessage:e==null?void 0:e.siwxMessage,rpcUrl:this.getRpcUrl(s)});return this.setLoginSuccess(i.email),this.setLastUsedChainId(i.chainId),this.user=i,i}catch(s){throw(n=this.w3mLogger)==null||n.logger.error({error:s},"Error connecting"),s}}async getUser(e){var r;try{await this.init();const n=(e==null?void 0:e.chainId)||this.getLastUsedChainId()||1,s=await this.appEvent({type:je.APP_GET_USER,payload:{...e,chainId:n,rpcUrl:this.getRpcUrl(n)}});return this.user=s,s}catch(n){throw(r=this.w3mLogger)==null||r.logger.error({error:n},"Error connecting"),n}}async connectSocial({uri:e,chainId:r,preferredAccountType:n}){var s;try{await this.init();const i=this.getRpcUrl(r),o=await this.appEvent({type:je.APP_CONNECT_SOCIAL,payload:{uri:e,chainId:r,rpcUrl:i,preferredAccountType:n}});return o.userName&&this.setSocialLoginSuccess(o.userName),o}catch(i){throw(s=this.w3mLogger)==null||s.logger.error({error:i},"Error connecting social"),i}}async getFarcasterUri(){var e;try{return await this.init(),await this.appEvent({type:je.APP_GET_FARCASTER_URI})}catch(r){throw(e=this.w3mLogger)==null||e.logger.error({error:r},"Error getting farcaster uri"),r}}async connectFarcaster(){var e;try{const r=await this.appEvent({type:je.APP_CONNECT_FARCASTER});return r.userName&&this.setSocialLoginSuccess(r.userName),r}catch(r){throw(e=this.w3mLogger)==null||e.logger.error({error:r},"Error connecting farcaster"),r}}async switchNetwork({chainId:e}){var r;try{const n=this.getRpcUrl(e),s=await this.appEvent({type:je.APP_SWITCH_NETWORK,payload:{chainId:e,rpcUrl:n}});return this.setLastUsedChainId(s.chainId),s}catch(n){throw(r=this.w3mLogger)==null||r.logger.error({error:n},"Error switching network"),n}}async disconnect(){var e;try{return this.deleteAuthLoginCache(),await new Promise(async n=>{const s=setTimeout(()=>{n()},3e3);await this.appEvent({type:je.APP_SIGN_OUT}),clearTimeout(s),n()})}catch(r){throw(e=this.w3mLogger)==null||e.logger.error({error:r},"Error disconnecting"),r}}async request(e){var n,s,i,o,a;const r=e;try{if(Tr.GET_CHAIN_ID===e.method)return this.getLastUsedChainId();const c=e.chainNamespace||"eip155",u=(n=this.getActiveCaipNetwork(c))==null?void 0:n.id;r.chainNamespace=c,r.chainId=u,r.rpcUrl=this.getRpcUrl(u),(s=this.rpcRequestHandler)==null||s.call(this,e);const l=await this.appEvent({type:je.APP_RPC_REQUEST,payload:ZS(r)});return(i=this.rpcSuccessHandler)==null||i.call(this,l,r),l}catch(c){throw(o=this.rpcErrorHandler)==null||o.call(this,c,r),(a=this.w3mLogger)==null||a.logger.error({error:c},"Error requesting"),c}}onRpcRequest(e){this.rpcRequestHandler=e}onRpcSuccess(e){this.rpcSuccessHandler=e}onRpcError(e){this.rpcErrorHandler=e}onIsConnected(e){this.w3mFrame.events.onFrameEvent(r=>{r.type===je.FRAME_IS_CONNECTED_SUCCESS&&r.payload.isConnected&&e()})}onNotConnected(e){this.w3mFrame.events.onFrameEvent(r=>{r.type===je.FRAME_IS_CONNECTED_ERROR&&e(),r.type===je.FRAME_IS_CONNECTED_SUCCESS&&!r.payload.isConnected&&e()})}onConnect(e){this.w3mFrame.events.onFrameEvent(r=>{r.type===je.FRAME_GET_USER_SUCCESS&&e(r.payload)})}onSocialConnected(e){this.w3mFrame.events.onFrameEvent(r=>{r.type===je.FRAME_CONNECT_SOCIAL_SUCCESS&&e(r.payload)})}async getCapabilities(){try{return await this.request({method:"wallet_getCapabilities"})||{}}catch{return{}}}onSetPreferredAccount(e){this.w3mFrame.events.onFrameEvent(r=>{r.type===je.FRAME_SET_PREFERRED_ACCOUNT_SUCCESS?e(r.payload):r.type===je.FRAME_SET_PREFERRED_ACCOUNT_ERROR&&e({type:Tr.ACCOUNT_TYPES.EOA})})}getAvailableChainIds(){return Object.keys(this.w3mFrame.networks)}async rejectRpcRequests(){var e;try{await Promise.all(Array.from(this.openRpcRequests.values()).map(async({abortController:r,method:n})=>
2{Tr.SAFE_RPC_METHODS.includes(n)||r.abort(),await this.appEvent({type:je.APP_RPC_ABORT})})),this.openRpcRequests.clear()}catch(r){(e=this.w3mLogger)==null||e.logger.error({error:r},"Error aborting RPC request")}}async appEvent(e){let r,n;function s(c){return c.replace("@w3m-app/","")}const i=[je.APP_SYNC_DAPP_DATA,je.APP_SYNC_THEME,je.APP_SET_PREFERRED_ACCOUNT],o=s(e.type);return!this.w3mFrame.iframeIsReady&&!i.includes(e.type)&&(n=setTimeout(()=>{var c;(c=this.onTimeout)==null||c.call(this,"iframe_load_failed"),this.abortController.abort()},2e4)),await this.w3mFrame.frameLoadPromise,clearTimeout(n),[je.APP_CONNECT_EMAIL,je.APP_CONNECT_DEVICE,je.APP_CONNECT_OTP,je.APP_CONNECT_SOCIAL,je.APP_GET_SOCIAL_REDIRECT_URI].map(s).includes(o)&&(r=setTimeout(()=>{var c;(c=this.onTimeout)==null||c.call(this,"iframe_request_timeout"),this.abortController.abort()},12e4)),new Promise((c,u)=>{var g,h,p;const l=Math.random().toString(36).substring(7);(p=(g=this.w3mLogger)==null?void 0:(h=g.logger).info)==null||p.call(h,{event:e,id:l},"Sending app event"),this.w3mFrame.events.postAppEvent({...e,id:l});const d=new AbortController;if(o==="RPC_REQUEST"){const y=e;this.openRpcRequests.set(l,{...y.payload,abortController:d})}d.signal.addEventListener("abort",()=>{o==="RPC_REQUEST"?u(new Error("Request was aborted")):o!=="GET_FARCASTER_URI"&&u(new Error("Something went wrong"))});const f=(y,w)=>{var I,v,E;y.id===l&&((v=w==null?void 0:(I=w.logger).info)==null||v.call(I,{framEvent:y,id:l},"Received frame response"),this.openRpcRequests.delete(y.id),y.type===`@w3m-frame/${o}_SUCCESS`?(r&&clearTimeout(r),n&&clearTimeout(n),"payload"in y&&c(y.payload),c(void 0)):y.type===`@w3m-frame/${o}_ERROR`&&(r&&clearTimeout(r),n&&clearTimeout(n),"payload"in y&&u(new Error(((E=y.payload)==null?void 0:E.message)||"An error occurred")),u(new Error("An error occurred"))))};this.w3mFrame.events.registerFrameEventHandler(l,y=>f(y,this.w3mLogger),this.abortController.signal)})}setNewLastEmailLoginTime(){Ur.set(je.LAST_EMAIL_LOGIN_TIME,Date.now().toString())}setSocialLoginSuccess(e){Ur.set(je.SOCIAL_USERNAME,e)}setLoginSuccess(e){e&&Ur.set(je.EMAIL,e),Ur.set(je.EMAIL_LOGIN_USED_KEY,"true"),Ur.delete(je.LAST_EMAIL_LOGIN_TIME)}deleteAuthLoginCache(){Ur.delete(je.EMAIL_LOGIN_USED_KEY),Ur.delete(je.EMAIL),Ur.delete(je.LAST_USED_CHAIN_KEY),Ur.delete(je.SOCIAL_USERNAME)}setLastUsedChainId(e){e&&Ur.set(je.LAST_USED_CHAIN_KEY,String(e))}getLastUsedChainId(){const e=Ur.get(je.LAST_USED_CHAIN_KEY)??void 0,r=Number(e);return isNaN(r)?e:r}persistSmartAccountEnabledNetworks(e){Ur.set(je.SMART_ACCOUNT_ENABLED_NETWORKS,e.join(","))}getRpcUrl(e){var i,o;let r=e===void 0?void 0:"eip155";typeof e=="string"&&(e.includes(":")?r=(i=RG.parseCaipNetworkId(e))==null?void 0:i.chainNamespace:Number.isInteger(Number(e))?r="eip155":r="solana");const n=this.getCaipNetworks(r),s=e?n.find(a=>String(a.id)===String(e)||a.caipNetworkId===e):n[0];return(o=s==null?void 0:s.rpcUrls.default.http)==null?void 0:o[0]}}function pL(t,{strict:e=!0}={}){return!t||typeof t!="string"?!1:e?/^0x[0-9a-fA-F]*$/.test(t):t.startsWith("0x")}function jx(t){return pL(t,{strict:!1})?Math.ceil((t.length-2)/2):t.length}const gL="2.55.10";let Wp={getDocsUrl:({docsBaseUrl:t,docsPath:e="",docsSlug:r})=>e?`${t??"https://viem.sh"}${e}${r?`#${r}`:""}`:void 0,version:`viem@${gL}`},Wt=class YS extends Error{constructor(e,r={}){var a;const n=(()=>{var c;return r.cause instanceof YS?r.cause.details:(c=r.cause)!=null&&c.message?r.cause.message:r.details})(),s=r.cause instanceof YS&&r.cause.docsPath||r.docsPath,i=(a=Wp.getDocsUrl)==null?void 0:a.call(Wp,{...r,docsPath:s}),o=[e||"An error occurred.","",...r.metaMessages?[...r.metaMessages,""]:[],...i?[`Docs: ${i}`]:[],...n?[`Details: ${n}`]:[],...Wp.version?[`Version: ${Wp.version}`]:[]].join(`
3`);super(o,r.cause?{cause:r.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=n,this.docsPath=s,this.metaMessages=r.metaMessages,this.name=r.name??this.name,this.shortMessage=e,this.version=gL}walk(e){return mL(this,e)}};function mL(t,e){return e!=null&&e(t)?t:t&&typeof t=="object"&&"cause"in t&&t.cause!==void 0?mL(t.cause,e):e?null:t}let WCe=class extends Wt{constructor({offset:e,position:r,size:n}){super(`Slice ${r==="start"?"starting":"ending"} at offset "${e}" is out-of-bounds (size: ${n}).`,{name:"SliceOffsetOutOfBoundsError"})}},yL=class extends Wt{constructor({size:e,targetSize:r,type:n}){super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} size (${e}) exceeds padding size (${r}).`,{name:"SizeExceedsPaddingSizeError"})}};class KCe extends Wt{constructor({size:e,targetSize:r,type:n}){super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} is expected to be ${r} ${n} long, but is ${e} ${n} long.`,{name:"InvalidBytesLengthError"})}}function Pp(t,{dir:e,size:r=32}={}){return typeof t=="string"?VY(t,{dir:e,size:r}):GY(t,{dir:e,size:r})}function VY(t,{dir:e,size:r=32}={}){if(r===null)return t;const n=t.replace("0x","");if(n.length>r*2)throw new yL({size:Math.ceil(n.length/2),targetSize:r,type:"hex"});return`0x${n[e==="right"?"padEnd":"padStart"](r*2,"0")}`}function GY(t,{dir:e,size:r=32}={}){if(r===null)return t;if(t.length>r)throw new yL({size:t.length,targetSize:r,type:"bytes"});const n=new Uint8Array(r);for(let s=0;s<r;s++){const i=e==="right";n[i?s:r-s-1]=t[i?s:t.length-s-1]}return n}let bL=class extends Wt{constructor({max:e,min:r,signed:n,size:s,value:i}
3){super(`Number "${i}" is not in safe ${s?`${s*8}-bit ${n?"signed":"unsigned"} `:""}integer range ${e?`(${r} to ${e})`:`(above ${r})`}`,{name:"IntegerOutOfRangeError"})}};class YCe extends Wt{constructor(e){super(`Bytes value "${e}" is not a valid boolean. The bytes array must contain a single byte of either a 0 or 1 value.`,{name:"InvalidBytesBooleanError"})}}class KY extends Wt{constructor(e){super(`Hex value "${e}" is not a valid boolean. The hex value must be "0x0" (false) or "0x1" (true).`,{name:"InvalidHexBooleanError"})}}let ZY=class extends Wt{constructor({givenSize:e,maxSize:r}){super(`Size cannot exceed ${r} bytes. Given size: ${e} bytes.`,{name:"SizeOverflowError"})}};function i_(t,{dir:e="left"}={}){let r=typeof t=="string"?t.replace("0x",""):t,n=0;for(let s=0;s<r.length-1&&r[e==="left"?s:r.length-s-1].toString()==="0";s++)n++;return r=e==="left"?r.slice(n):r.slice(0,r.length-n),typeof t=="string"?(r.length===1&&e==="right"&&(r=`${r}0`),`0x${r.length%2===1?`0${r}`:r}`):r}function Uu(t,{size:e}){if(jx(t)>e)throw new ZY({givenSize:jx(t),maxSize:e})}function YY(t,e={}){const{signed:r}=e;e.size&&Uu(t,{size:e.size});const n=BigInt(t);if(!r)return n;const s=(t.length-2)/2,i=(1n<<BigInt(s)*8n-1n)-1n;return n<=i?n:n-BigInt(`0x${"f".padStart(s*2,"f")}`)-1n}function QCe(t,e={}){let r=t;if(e.size&&(Uu(r,{size:e.size}),r=i_(r)),i_(r)==="0x00")return!1;if(i_(r)==="0x01")return!0;throw new KY(r)}function XCe(t,e={}){const r=YY(t,e),n=Number(r);if(!Number.isSafeInteger(n))throw new bL({max:`${Number.MAX_SAFE_INTEGER}`,min:`${Number.MIN_SAFE_INTEGER}`,signed:e.signed,size:e.size,value:`${r}n`});return n}function e2e(t,e={}){let r=qP(t);return e.size&&(Uu(r,{size:e.size}),r=i_(r,{dir:"right"})),new TextDecoder().decode(r)}const JY=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function Dx(t,e={}){return typeof t=="number"||typeof t=="bigint"?EL(t,e):typeof t=="string"?eJ(t,e):typeof t=="boolean"?QY(t,e):wL(t,e)}function QY(t,e={}){const r=`0x${Number(t)}`;return typeof e.size=="number"?(Uu(r,{size:e.size}),Pp(r,{size:e.size})):r}function wL(t,e={}){let r="";for(let s=0;s<t.length;s++)r+=JY[t[s]];const n=`0x${r}`;return typeof e.size=="number"?(Uu(n,{size:e.size}),Pp(n,{dir:"right",size:e.size})):n}function EL(t,e={}){const{signed:r,size:n}=e,s=BigInt(t);let i;n?r?i=(1n<<BigInt(n)*8n-1n)-1n:i=2n**(BigInt(n)*8n)-1n:typeof t=="number"&&(i=BigInt(Number.MAX_SAFE_INTEGER));const o=typeof i=="bigint"&&r?-i-1n:0;if(i&&s>i||s<o){const c=typeof t=="bigint"?"n":"";throw new bL({max:i?`${i}${c}`:void 0,min:`${o}${c}`,signed:r,size:n,value:`${t}${c}`})}const a=`0x${(r&&s<0?(1n<<BigInt(n*8))+BigInt(s):s).toString(16)}`;return n?Pp(a,{size:n}):a}const XY=new TextEncoder;function eJ(t,e={}){const r=XY.encode(t);return wL(r,e)}const tJ=new TextEncoder;function t2e(t,e={}){return typeof t=="number"||typeof t=="bigint"?nJ(t,e):typeof t=="boolean"?rJ(t,e):pL(t)?qP(t,e):sJ(t,e)}function rJ(t,e={}){const r=new Uint8Array(1);return r[0]=Number(t),typeof e.size=="number"?(Uu(r,{size:e.size}),Pp(r,{size:e.size})):r}const Ko={zero:48,nine:57,A:65,F:70,a:97,f:102};function Ux(t){if(t>=Ko.zero&&t<=Ko.nine)return t-Ko.zero;if(t>=Ko.A&&t<=Ko.F)return t-(Ko.A-10);if(t>=Ko.a&&t<=Ko.f)return t-(Ko.a-10)}function qP(t,e={}){let r=t;e.size&&(Uu(r,{size:e.size}),r=Pp(r,{dir:"right",size:e.size}));let n=r.slice(2);n.length%2&&(n=`0${n}`);const s=n.length/2,i=new Uint8Array(s);for(let o=0,a=0;o<s;o++){const c=Ux(n.charCodeAt(a++)),u=Ux(n.charCodeAt(a++));if(c===void 0||u===void 0)throw new Wt(`Invalid byte sequence ("${n[a-2]}${n[a-1]}" in "${n}").`);i[o]=c*16+u}return i}function nJ(t,e){const r=EL(t,e);return qP(r)}function sJ(t,e={}){const r=tJ.encode(t);return typeof e.size=="number"?(Uu(r,{size:e.size}),Pp(r,{dir:"right",size:e.size})):r}const iJ=BigInt(0),Vp=BigInt(1),oJ=BigInt(2),aJ=BigInt(7),cJ=BigInt(256),uJ=BigInt(113),vL=[],_L=[],AL=[];for(let t=0,e=Vp,r=1,n=0;t<24;t++){[r,n]=[n,(2*r+3*n)%5],vL.push(2*(5*n+r)),_L.push((t+1)*(t+2)/2%64);let s=iJ;for(let i=0;i<7;i++)e=(e<<Vp^(e>>aJ)*uJ)%cJ,e&oJ&&(s^=Vp<<(Vp<<BigInt(i))-Vp);AL.push(s)}const CL=ZV(AL,!0),lJ=CL[0],dJ=CL[1],Mx=(t,e,r)=>r>32?GV(t,e,r):WV(t,e,r),$x=(t,e,r)=>r>32?KV(t,e,r):VV(t,e,r);
3function fJ(t,e=24){const r=new Uint32Array(10);for(let n=24-e;n<24;n++){for(let o=0;o<10;o++)r[o]=t[o]^t[o+10]^t[o+20]^t[o+30]^t[o+40];for(let o=0;o<10;o+=2){const a=(o+8)%10,c=(o+2)%10,u=r[c],l=r[c+1],d=Mx(u,l,1)^r[a],f=$x(u,l,1)^r[a+1];for(let g=0;g<50;g+=10)t[o+g]^=d,t[o+g+1]^=f}let s=t[2],i=t[3];for(let o=0;o<24;o++){const a=_L[o],c=Mx(s,i,a),u=$x(s,i,a),l=vL[o];s=t[l],i=t[l+1],t[l]=c,t[l+1]=u}for(let o=0;o<50;o+=10){for(let a=0;a<10;a++)r[a]=t[o+a];for(let a=0;a<10;a++)t[o+a]^=~r[(a+2)%10]&r[(a+4)%10]}t[0]^=lJ[n],t[1]^=dJ[n]}K$(r)}let hJ=class IL extends FV{constructor(e,r,n,s=!1,i=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=e,this.suffix=r,this.outputLen=n,this.enableXOF=s,this.rounds=i,LS(n),!(0<e&&e<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=HV(this.state)}clone(){return this._cloneInto()}keccak(){px(this.state32),fJ(this.state32,this.rounds),px(this.state32),this.posOut=0,this.pos=0}update(e){gx(this),e=qV(e),mx(e);const{blockLen:r,state:n}=this,s=e.length;for(let i=0;i<s;){const o=Math.min(r-this.pos,s-i);for(let a=0;a<o;a++)n[this.pos++]^=e[i++];this.pos===r&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:e,suffix:r,pos:n,blockLen:s}=this;e[n]^=r,(r&128)!==0&&n===s-1&&this.keccak(),e[s-1]^=128,this.keccak()}writeInto(e){gx(this,!1),mx(e),this.finish();const r=this.state,{blockLen:n}=this;for(let s=0,i=e.length;s<i;){this.posOut>=n&&this.keccak();const o=Math.min(n-this.posOut,i-s);e.set(r.subarray(this.posOut,this.posOut+o),s),this.posOut+=o,s+=o}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return LS(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(zV(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,K$(this.state)}_cloneInto(e){const{blockLen:r,suffix:n,outputLen:s,rounds:i,enableXOF:o}=this;return e||(e=new IL(r,n,s,o,i)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=i,e.suffix=n,e.outputLen=s,e.enableXOF=o,e.destroyed=this.destroyed,e}};const pJ=(t,e,r)=>LV(()=>new hJ(e,t,r)),gJ=pJ(1,136,256/8);let mJ=class extends Map{constructor(e){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=e}get(e){const r=super.get(e);return super.has(e)&&(super.delete(e),super.set(e,r)),r}set(e,r){if(super.has(e)&&super.delete(e),super.set(e,r),this.maxSize&&this.size>this.maxSize){const n=super.keys().next().value;n!==void 0&&super.delete(n)}return this}};const wd=(t,e,r)=>JSON.stringify(t,(n,s)=>typeof s=="bigint"?s.toString():s,r),U_={wei:0,gwei:9,szabo:12,finney:15,ether:18};function zP(t,e=0){if(!Number.isInteger(e)||e<0)throw new bJ({decimals:e});let r=t.toString();const n=r.startsWith("-");n&&(r=r.slice(1)),r=r.padStart(e,"0");let[s,i]=[r.slice(0,r.length-e),r.slice(r.length-e)];return i=i.replace(/(0+)$/,""),`${n?"-":""}${s||"0"}${i?`.${i}`:""}`}function n2e(t,e="wei"){return zP(t,U_.ether-U_[e])}function yJ(t,e="wei"){return zP(t,U_.gwei-U_[e])}class bJ extends Error{constructor({decimals:e}){super(`\`decimals\` must be a non-negative integer. Got \`${e}\`.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Value.InvalidDecimalsError"})}}function M_(t,e="wei"){return yJ(t,e)}const s2e=t=>t;function Od(t){if(t!=null&&t.reason)return t.reason;if(typeof DOMException=="function")return new DOMException("This operation was aborted","AbortError");const e=new Error("This operation was aborted");return e.name="AbortError",e}function a0(t){return typeof t=="object"&&t!==null&&"name"in t&&t.name==="AbortError"}const WP=t=>{try{const e=new URL(t);return!e.username&&!e.password?t:(e.username="",e.password="",e.toString())}catch{return t}};class Pm extends Wt{constructor({body:e,cause:r,details:n,headers:s,status:i,url:o}){super("HTTP request failed.",{cause:r,details:n,metaMessages:[i&&`Status: ${i}`,`URL: ${WP(o)}`,e&&`Request body: ${wd(e)}
3`].filter(Boolean),name:"HttpRequestError"}),Object.defineProperty(this,"body",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"headers",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.body=e,this.headers=s,this.status=i,this.url=o}}class o_ extends Wt{constructor({maxSize:e,size:r}){super("HTTP response body exceeded the size limit.",{metaMessages:[`Max: ${e} bytes`,`Received: ${r} bytes`],name:"ResponseBodyTooLargeError"}),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"size",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=e,this.size=r}}class SL extends Wt{constructor({body:e,error:r,url:n}){super("RPC Request failed.",{cause:r,details:r.message,metaMessages:[`URL: ${WP(n)}`,`Request body: ${wd(e)}`],name:"RpcRequestError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.code=r.code,this.data=r.data,this.url=n}}class Lx extends Wt{constructor({body:e,url:r}){super("The request took too long to respond.",{details:"The request timed out.",metaMessages:[`URL: ${WP(r)}`,`Request body: ${wd(e)}`],name:"TimeoutError"}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.url=r}}const wJ=-1;class As extends Wt{constructor(e,{code:r,docsPath:n,metaMessages:s,name:i,shortMessage:o}){super(o,{cause:e,docsPath:n,metaMessages:s||(e==null?void 0:e.metaMessages),name:i||"RpcError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=i||e.name,this.code=e instanceof SL?e.code:r??wJ}}class Cs extends As{constructor(e,r){super(e,r),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=r.data}}class iy extends As{constructor(e){super(e,{code:iy.code,name:"ParseRpcError",shortMessage:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."})}}Object.defineProperty(iy,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32700});class oy extends As{constructor(e){super(e,{code:oy.code,name:"InvalidRequestRpcError",shortMessage:"JSON is not a valid request object."})}}Object.defineProperty(oy,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32600});class ay extends As{constructor(e,{method:r}={}){super(e,{code:ay.code,name:"MethodNotFoundRpcError",shortMessage:`The method${r?` "${r}"`:""} does not exist / is not available.`})}}Object.defineProperty(ay,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32601});class cy extends As{constructor(e){super(e,{code:cy.code,name:"InvalidParamsRpcError",shortMessage:["Invalid parameters were provided to the RPC method.","Double check you have provided the correct parameters."].join(`
4`)})}}Object.defineProperty(cy,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32602});class cp extends As{constructor(e){super(e,{code:cp.code,name:"InternalRpcError",shortMessage:"An internal error was received."})}}Object.defineProperty(cp,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32603});class uy extends As{constructor(e){super(e,{code:uy.code,name:"InvalidInputRpcError",shortMessage:["Missing or invalid parameters.","Double check you have provided the correct parameters."].join(`
5`)})}}Object.defineProperty(uy,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3});class ly extends As{constructor(e){super(e,{code:ly.code,name:"ResourceNotFoundRpcError",shortMessage:"Requested resource not found."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceNotFoundRpcError"})}}Object.defineProperty(ly,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001});class dy extends As{constructor(e){super(e,{code:dy.code,name:"ResourceUnavailableRpcError",shortMessage:"Requested resource not available."})}}Object.defineProperty(dy,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002});class up extends As{constructor(e){super(e,{code:up.code,name:"TransactionRejectedRpcError",shortMessage:"Transaction creation failed."})}}Object.defineProperty(up,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003});class Ll extends As{constructor(e,{method:r}={}){super(e,{code:Ll.code,name:"MethodNotSupportedRpcError",shortMessage:`Method${r?` "${r}"`:""} is not supported.`})}}Object.defineProperty(Ll,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004});class lp extends As{constructor(e){super(e,{code:lp.code,name:"LimitExceededRpcError",shortMessage:"Request exceeds defined limit."})}}Object.defineProperty(lp,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32005});class fy extends As{constructor(e){super(e,{code:fy.code,name:"JsonRpcVersionUnsupportedError",shortMessage:"Version of JSON-RPC protocol is not supported."})}}Object.defineProperty(fy,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006});class Ed extends Cs{constructor(e){super(e,{code:Ed.code,name:"UserRejectedRequestError",shortMessage:"User rejected the request."})}}Object.defineProperty(Ed,"code",{enumerable:!0,configurable:!0,writable:!0,value:4001});class hy extends Cs{constructor(e){super(e,{code:hy.code,name:"UnauthorizedProviderError",shortMessage:"The requested method and/or account has not been authorized by the user."})}}Object.defineProperty(hy,"code",{enumerable:!0,configurable:!0,writable:!0,value:4100});class py extends Cs{constructor(e,{method:r}={}){super(e,{code:py.code,name:"UnsupportedProviderMethodError",shortMessage:`The Provider does not support the requested method${r?` " ${r}"`:""}.`})}}Object.defineProperty(py,"code",{enumerable:!0,configurable:!0,writable:!0,value:4200});class gy extends Cs{constructor(e){super(e,{code:gy.code,name:"ProviderDisconnectedError",shortMessage:"The Provider is disconnected from all chains."})}}Object.defineProperty(gy,"code",{enumerable:!0,configurable:!0,writable:!0,value:4900});class my extends Cs{constructor(e){super(e,{code:my.code,name:"ChainDisconnectedError",shortMessage:"The Provider is not connected to the requested chain."})}}Object.defineProperty(my,"code",{enumerable:!0,configurable:!0,writable:!0,value:4901});class yy extends Cs{constructor(e){super(e,{code:yy.code,name:"SwitchChainError",shortMessage:"An error occurred when attempting to switch chain."})}}Object.defineProperty(yy,"code",{enumerable:!0,configurable:!0,writable:!0,value:4902});class by extends Cs{constructor(e){super(e,{code:by.code,name:"UnsupportedNonOptionalCapabilityError",shortMessage:"This Wallet does not support a capability that was not marked as optional."})}}Object.defineProperty(by,"code",{enumerable:!0,configurable:!0,writable:!0,value:5700});class wy extends Cs{constructor(e){super(e,{code:wy.code,name:"UnsupportedChainIdError",shortMessage:"This Wallet does not support the requested chain ID."})}}Object.defineProperty(wy,"code",{enumerable:!0,configurable:!0,writable:!0,value:5710});class Ey extends Cs{constructor(e){super(e,{code:Ey.code,name:"DuplicateIdError",shortMessage:"There is already a bundle submitted with this ID."})}}Object.defineProperty(Ey,"code",{enumerable:!0,configurable:!0,writable:!0,value:5720});class vy extends Cs{constructor(e){super(e,{code:vy.code,name:"UnknownBundleIdError",shortMessage:"This bundle id is unknown / has not been submitted"})}}Object.defineProperty(vy,"code",{enumerable:!0,configurable:!0,writable:!0,value:5730});class _y extends Cs{constructor(e){super(e,{code:_y.code,name:"BundleTooLargeError",shortMessage:"The call bundle is too large for the Wallet to process."})}}Object.defineProperty(_y,"code",{enumerable:!0,configurable:!0,writable:!0,value:5740});class Ay extends Cs{constructor(e){super(e,{code:Ay.code,name:"AtomicReadyWalletRejectedUpgradeError",shortMessage:"The Wallet can support atomicity after an upgrade, but the user rejected the upgrade."})}}Object.defineProperty(Ay,"code",{enumerable:!0,configurable:!0,writable:!0,value:5750}
5);class Cy extends Cs{constructor(e){super(e,{code:Cy.code,name:"AtomicityNotSupportedError",shortMessage:"The wallet does not support atomic execution but the request requires it."})}}Object.defineProperty(Cy,"code",{enumerable:!0,configurable:!0,writable:!0,value:5760});class dp extends Cs{constructor(e){super(e,{code:dp.code,name:"WalletConnectSessionSettlementError",shortMessage:"WalletConnect session settlement failed."})}}Object.defineProperty(dp,"code",{enumerable:!0,configurable:!0,writable:!0,value:7e3});class EJ extends As{constructor(e){super(e,{name:"UnknownRpcError",shortMessage:"An unknown RPC error occurred."})}}class VP extends Wt{constructor({cause:e,message:r}={}){var s;const n=(s=r==null?void 0:r.replace("execution reverted: ",""))==null?void 0:s.replace("execution reverted","");super(`Execution reverted ${n?`with reason: ${n}`:"for an unknown reason"}.`,{cause:e,name:"ExecutionRevertedError"})}}Object.defineProperty(VP,"code",{enumerable:!0,configurable:!0,writable:!0,value:3});Object.defineProperty(VP,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted|gas required exceeds allowance/});class vJ extends Wt{constructor({cause:e,maxFeePerGas:r}={}){super(`The fee cap (\`maxFeePerGas\`${r?` = ${M_(r)} gwei`:""}) cannot be higher than the maximum allowed value (2^256-1).`,{cause:e,name:"FeeCapTooHighError"})}}Object.defineProperty(vJ,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas higher than 2\^256-1|fee cap higher than 2\^256-1/});class _J extends Wt{constructor({cause:e,maxFeePerGas:r}={}){super(`The fee cap (\`maxFeePerGas\`${r?` = ${M_(r)}`:""} gwei) cannot be lower than the block base fee.`,{cause:e,name:"FeeCapTooLowError"})}}Object.defineProperty(_J,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas less than block base fee|fee cap less than block base fee|transaction is outdated/});class AJ extends Wt{constructor({cause:e,nonce:r}={}){super(`Nonce provided for the transaction ${r?`(${r}) `:""}is higher than the next one expected.`,{cause:e,name:"NonceTooHighError"})}}Object.defineProperty(AJ,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too high/});class CJ extends Wt{constructor({cause:e,nonce:r}={}){super([`Nonce provided for the transaction ${r?`(${r}) `:""}is lower than the current nonce of the account.`,"Try increasing the nonce or find the latest nonce with `getTransactionCount`."].join(`
6`),{cause:e,name:"NonceTooLowError"})}}Object.defineProperty(CJ,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too low|transaction already imported|already known/});class IJ extends Wt{constructor({cause:e,nonce:r}={}){super(`Nonce provided for the transaction ${r?`(${r}) `:""}exceeds the maximum allowed nonce.`,{cause:e,name:"NonceMaxValueError"})}}Object.defineProperty(IJ,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce has max value/});class SJ extends Wt{constructor({cause:e}={}){super(["The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account."].join(`
7`),{cause:e,metaMessages:["This error could arise when the account does not have enough funds to:"," - pay for the total gas fee,"," - pay for the value to send."," ","The cost of the transaction is calculated as `gas * gas fee + value`, where:"," - `gas` is the amount of gas needed for transaction to execute,"," - `gas fee` is the gas fee,"," - `value` is the amount of ether to send to the recipient."],name:"InsufficientFundsError"})}}Object.defineProperty(SJ,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/insufficient funds|exceeds transaction sender account balance/});class TJ extends Wt{constructor({cause:e,gas:r}={}){super(`The amount of gas ${r?`(${r}) `:""}provided for the transaction exceeds the limit allowed for the block.`,{cause:e,name:"IntrinsicGasTooHighError"})}}Object.defineProperty(TJ,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too high|gas limit reached/});class PJ extends Wt{constructor({cause:e,gas:r}={}){super(`The amount of gas ${r?`(${r}) `:""}provided for the transaction is too low.`,{cause:e,name:"IntrinsicGasTooLowError"})}}Object.defineProperty(PJ,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too low/});class OJ extends Wt{constructor({cause:e}){super("The transaction type is not supported for this chain.",{cause:e,name:"TransactionTypeNotSupportedError"})}}Object.defineProperty(OJ,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/transaction type not valid/});class NJ extends Wt{constructor({cause:e,maxPriorityFeePerGas:r,maxFeePerGas:n}={}){super([`The provided tip (\`maxPriorityFeePerGas\`${r?` = ${M_(r)} gwei`:""}) cannot be higher than the fee cap (\`maxFeePerGas\`${n?` = ${M_(n)}
vendor: 2,673 bytes, lines 7-8
7 gwei`:""}).`].join(`
8`),{cause:e,name:"TipAboveFeeCapError"})}}Object.defineProperty(NJ,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max priority fee per gas higher than max fee per gas|tip higher than fee cap/});class i2e extends Wt{constructor({cause:e}){super(`An error occurred while executing: ${e==null?void 0:e.shortMessage}`,{cause:e,name:"UnknownNodeError"})}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const GP=BigInt(0),JS=BigInt(1);function c0(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}function KP(t){if(!c0(t))throw new Error("Uint8Array expected")}function Iy(t,e){if(typeof e!="boolean")throw new Error(t+" boolean expected, got "+e)}function cb(t){const e=t.toString(16);return e.length&1?"0"+e:e}function TL(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);return t===""?GP:BigInt("0x"+t)}const PL=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",xJ=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function Sy(t){if(KP(t),PL)return t.toHex();let e="";for(let r=0;r<t.length;r++)e+=xJ[t[r]];return e}const Zo={_0:48,_9:57,A:65,F:70,a:97,f:102};function Fx(t){if(t>=Zo._0&&t<=Zo._9)return t-Zo._0;if(t>=Zo.A&&t<=Zo.F)return t-(Zo.A-10);if(t>=Zo.a&&t<=Zo.f)return t-(Zo.a-10)}function $_(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);if(PL)return Uint8Array.fromHex(t);const e=t.length,r=e/2;if(e%2)throw new Error("hex string expected, got unpadded hex of length "+e);const n=new Uint8Array(r);for(let s=0,i=0;s<r;s++,i+=2){const o=Fx(t.charCodeAt(i)),a=Fx(t.charCodeAt(i+1));if(o===void 0||a===void 0){const c=t[i]+t[i+1];throw new Error('hex string expected, got non-hex character "'+c+'" at index '+i)}n[s]=o*16+a}return n}function vd(t){return TL(Sy(t))}function OL(t){return KP(t),TL(Sy(Uint8Array.from(t).reverse()))}function u0(t,e){return $_(t.toString(16).padStart(e*2,"0"))}function NL(t,e){return u0(t,e).reverse()}function si(t,e,r){let n;if(typeof e=="string")try{n=$_(e)}catch(i){throw new Error(t+" must be hex string or Uint8Array, cause: "+i)}else if(c0(e))n=Uint8Array.from(e);else throw new Error(t+" must be hex string or Uint8Array");const s=n.length;if(typeof r=="number"&&s!==r)throw new Error(t+" of length "+r+" expected, got "+s);return n}function L_(...t){let e=0;for(let n=0;n<t.length;n++){const s=t[n];KP(s),e+=s.length}const r=new Uint8Array(e);for(let n=0,s=0;n<t.length;n++){const i=t[n];r.set(i,s),s+=i.length}return r}const S2=t=>typeof t=="bigint"&&GP<=t;function ZP(t,e,r){return S2(t)&&S2(e)&&S2(r)&&e<=t&&t<r}
8function oh(t,e,r,n){if(!ZP(e,r,n))throw new Error("expected valid "+t+": "+r+" <= n < "+n+", got "+e)}function RJ(t){let e;for(e=0;t>GP;t>>=JS,e+=1);return e}const jA=t=>(JS<<BigInt(t))-JS,T2=t=>new Uint8Array(t),Hx=t=>Uint8Array.from(t);function BJ(t,e,r){if(typeof t!="number"||t<2)throw new Error("hashLen must be a number");if(typeof e!="number"||e<2)throw new Error("qByteLen must be a number");if(typeof r!="function")throw new Error("hmacFn must be a function");let n=T2(t),s=T2(t),i=0;const o=()=>{n.fill(1),s.fill(0),i=0},a=(...d)=>r(s,n,...d),c=(d=T2(0))=>{s=a(Hx([0]),d),n=a(),d.length!==0&&(s=a(Hx([1]),d),n=a())},u=()=>{if(i++>=1e3)throw new Error("drbg: tried 1000 values");let d=0;const f=[];for(;d<e;){n=a();const g=n.slice();f.push(g),d+=n.length}return L_(...f)};return(d,f)=>{o(),c(d);let g;for(;!(g=f(u()));)c();return o(),g}}const kJ={bigint:t=>typeof t=="bigint",function:t=>typeof t=="function",boolean:t=>typeof t=="boolean",string:t=>typeof t=="string",stringOrUint8Array:t=>typeof t=="string"||c0(t),isSafeInteger:t=>Number.isSafeInteger(t),array:t=>Array.isArray(t),field:(t,e)=>e.Fp.isValid(t),hash:t=>typeof t=="function"&&Number.isSafeInteger(t.outputLen)};function DA(t,e,r={}){const n=(s,i,o)=>{const a=kJ[i];if(typeof a!="function")throw new Error("invalid validator function");const c=t[s];if(!(o&&c===void 0)&&!a(c,t))throw new Error("param "+String(s)+" is invalid. Expected "+i+", got "+c)};for(const[s,i]of Object.entries(e))n(s,i,!1);for(const[s,i]of Object.entries(r))n(s,i,!0);return t}function qx(t){const e=new WeakMap;return(r,...n)=>{const s=e.get(r);if(s!==void 0)return s;const i=t(r,...n);return e.set(r,i),i}}const o2e=[{inputs:[{components:[{name:"target",type:"address"},{name:"allowFailure",type:"bool"},{name:"callData",type:"bytes"}],name:"calls",type:"tuple[]"}],name:"aggregate3",outputs:[{components:[{name:"success",type:"bool"},{name:"returnData",type:"bytes"}],name:"returnData",type:"tuple[]"}],stateMutability:"view",type:"function"},{inputs:[{name:"addr",type:"address"}],name:"getEthBalance",outputs:[{name:"balance",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"getCurrentBlockTimestamp",outputs:[{internalType:"uint256",name:"timestamp",type:"uint256"}],stateMutability:"view",type:"function"}],a2e=[{name:"query",type:"function",stateMutability:"view",inputs:[{type:"tuple[]",name:"queries",components:[{type:"address",name:"sender"},{type:"string[]",name:"urls"},{type:"bytes",name:"data"}]}],outputs:[{type:"bool[]",name:"failures"},{type:"bytes[]",name:"responses"}]},{name:"HttpError",type:"error",inputs:[{type:"uint16",name:"status"},{type:"string",name:"message"}]}],xL=[{inputs:[{name:"dns",type:"bytes"}],name:"DNSDecodingFailed",type:"error"},{inputs:[{name:"ens",type:"string"}],name:"DNSEncodingFailed",type:"error"},{inputs:[],name:"EmptyAddress",type:"error"},{inputs:[{name:"status",type:"uint16"},{name:"message",type:"string"}],name:"HttpError",type:"error"},{inputs:[],name:"InvalidBatchGatewayResponse",type:"error"},{inputs:[{name:"errorData",type:"bytes"}],name:"ResolverError",type:"error"},{inputs:[{name:"name",type:"bytes"},{name:"resolver",type:"address"}],name:"ResolverNotContract",type:"error"},{inputs:[{name:"name",type:"bytes"}],name:"ResolverNotFound",type:"error"},{inputs:[{name:"primary",type:"string"},{name:"primaryAddress",type:"bytes"}],name:"ReverseAddressMismatch",type:"error"},{inputs:[{internalType:"bytes4",name:"selector",type:"bytes4"}],name:"UnsupportedResolverProfile",type:"error"}],c2e=[...xL,{name:"resolveWithGateways",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes"},{name:"data",type:"bytes"},{name:"gateways",type:"string[]"}],outputs:[{name:"",type:"bytes"},{name:"address",type:"address"}]}],u2e=[...xL,{name:"reverseWithGateways",type:"function",stateMutability:"view",inputs:[{type:"bytes",name:"reverseName"},{type:"uint256",name:"coinType"},{type:"string[]",name:"gateways"}],outputs:[{type:"string",name:"resolvedName"},{type:"address",name:"resolver"},{type:"address",name:"reverseResolver"}]}],l2e=[{name:"text",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"key",type:"string"}],outputs:[{name:"",type:"string"}]}],d2e=[{name:"addr",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"}],outputs:[{name:"",type:"address"}]},{name:"addr",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"coinType",type:"uint256"}],outputs:[{name:"",type:"bytes"}]}],f2e=[{name:"isValidSignature",type:"function",stateMutability:"view",inputs:[{name:"hash",type:"bytes32"},{name:"signature",type:"bytes"}],outputs:[{name:"",type:"bytes4"}]}],h2e=[{inputs:[{name:"_signer",type:"address"},{name:"_hash",type:"bytes32"},{name:"_signature",type:"bytes"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[{name:"_signer",type:"address"},{name:"_hash",type:"bytes32"},{name:"_signature",type:"bytes"}],outputs:[{type:"bool"}],stateMutability:"nonpayable",type:"function",name:"isValidSig"}
8],ub=[{type:"event",name:"Approval",inputs:[{indexed:!0,name:"owner",type:"address"},{indexed:!0,name:"spender",type:"address"},{indexed:!1,name:"value",type:"uint256"}]},{type:"event",name:"Transfer",inputs:[{indexed:!0,name:"from",type:"address"},{indexed:!0,name:"to",type:"address"},{indexed:!1,name:"value",type:"uint256"}]},{type:"function",name:"allowance",stateMutability:"view",inputs:[{name:"owner",type:"address"},{name:"spender",type:"address"}],outputs:[{type:"uint256"}]},{type:"function",name:"approve",stateMutability:"nonpayable",inputs:[{name:"spender",type:"address"},{name:"amount",type:"uint256"}],outputs:[{type:"bool"}]},{type:"function",name:"balanceOf",stateMutability:"view",inputs:[{name:"account",type:"address"}],outputs:[{type:"uint256"}]},{type:"function",name:"decimals",stateMutability:"view",inputs:[],outputs:[{type:"uint8"}]},{type:"function",name:"name",stateMutability:"view",inputs:[],outputs:[{type:"string"}]},{type:"function",name:"symbol",stateMutability:"view",inputs:[],outputs:[{type:"string"}]},{type:"function",name:"totalSupply",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{type:"function",name:"transfer",stateMutability:"nonpayable",inputs:[{name:"recipient",type:"address"},{name:"amount",type:"uint256"}],outputs:[{type:"bool"}]},{type:"function",name:"transferFrom",stateMutability:"nonpayable",inputs:[{name:"sender",type:"address"},{name:"recipient",type:"address"},{name:"amount",type:"uint256"}],outputs:[{type:"bool"}]}];function jJ(){let t=()=>{},e=()=>{};return{promise:new Promise((n,s)=>{t=n,e=s}),resolve:t,reject:e}}const P2=new Map;function DJ({fn:t,id:e,shouldSplitBatch:r,wait:n=0,sort:s}){const i=async()=>{const l=c();o();const d=l.map(({args:f})=>f);d.length!==0&&t(d).then(f=>{s&&Array.isArray(f)&&f.sort(s);for(let g=0;g<l.length;g++){const{resolve:h}=l[g];h==null||h([f[g],f])}}).catch(f=>{for(let g=0;g<l.length;g++){const{reject:h}=l[g];h==null||h(f)}})},o=()=>P2.delete(e),a=()=>c().map(({args:l})=>l),c=()=>P2.get(e)||[],u=l=>P2.set(e,[...c(),l]);return{flush:o,async schedule(l){const{promise:d,resolve:f,reject:g}=jJ();return(r==null?void 0:r([...a(),l]))&&i(),c().length>0?(u({args:l,resolve:f,reject:g}),d):(u({args:l,resolve:f,reject:g}),setTimeout(i,n),d)}}}async function RL(t,{signal:e}={}){return new Promise((r,n)=>{if(e!=null&&e.aborted){n(Od(e));return}const s=()=>e==null?void 0:e.removeEventListener("abort",o),i=setTimeout(()=>{s(),r()},t),o=()=>{clearTimeout(i),s(),n(Od(e))};e==null||e.addEventListener("abort",o,{once:!0})})}function UJ(t,{delay:e=100,retryCount:r=2,shouldRetry:n=()=>!0,signal:s}={}){return new Promise((i,o)=>{const a=async({count:c=0}={})=>{if(s!=null&&s.aborted){o(Od(s));return}const u=async({error:l})=>{const d=typeof e=="function"?e({count:c,error:l}):e;if(d)try{await RL(d,{signal:s})}catch(f){o(f);return}a({count:c+1})};try{const l=await t();i(l)}catch(l){if(s!=null&&s.aborted){o(Od(s));return}if(a0(l)){o(l);return}if(c<r&&await n({count:c,error:l}))return u({error:l});o(l)}};a()})}const QS=256;let lb=QS,db;function MJ(t=11){if(!db||lb+t>QS*2){db="",lb=0;for(let e=0;e<QS;e++)db+=(256+Math.random()*256|0).toString(16).substring(1)}return db.substring(lb,lb+++t)}const fb=new mJ(8192);function $J(t,{enabled:e=!0,id:r}){if(!e||!r)return t();if(fb.get(r))return fb.get(r);const n=t().finally(()=>fb.delete(r));return fb.set(r,n),n}function LJ(t,e={}){return async(r,n={})=>{var f;const{dedupe:s=!1,methods:i,retryDelay:o=150,retryCount:a=3,signal:c,uid:u}={...e,...n},{method:l}=r;if((f=i==null?void 0:i.exclude)!=null&&f.includes(l))throw new Ll(new Error("method not supported"),{method:l});if(i!=null&&i.include&&!i.include.includes(l))throw new Ll(new Error("method not supported"),{method:l});if(c!=null&&c.aborted)throw Od(c);const d=s?HJ(`${u}.${wd(r)}`):void 0;return $J(()=>UJ(async()=>{try{return await t(r,c?{signal:c}:void 0)}catch(g){if(c!=null&&c.aborted)throw Od(c);if(a0(g))throw g;const h=g;switch(h.code){case iy.code:throw new iy(h);
8case oy.code:throw new oy(h);case ay.code:throw new ay(h,{method:r.method});case cy.code:throw new cy(h);case cp.code:throw new cp(h);case uy.code:throw new uy(h);case ly.code:throw new ly(h);case dy.code:throw new dy(h);case up.code:throw new up(h);case Ll.code:throw new Ll(h,{method:r.method});case lp.code:throw new lp(h);case fy.code:throw new fy(h);case Ed.code:throw new Ed(h);case hy.code:throw new hy(h);case py.code:throw new py(h);case gy.code:throw new gy(h);case my.code:throw new my(h);case yy.code:throw new yy(h);case by.code:throw new by(h);case wy.code:throw new wy(h);case Ey.code:throw new Ey(h);case vy.code:throw new vy(h);case _y.code:throw new _y(h);case Ay.code:throw new Ay(h);case Cy.code:throw new Cy(h);case 5e3:throw new Ed(h);case dp.code:throw new dp(h);default:throw g instanceof Wt?g:new EJ(h)}}},{delay:({count:g,error:h})=>{var p;if(h&&h instanceof Pm){const y=(p=h==null?void 0:h.headers)==null?void 0:p.get("Retry-After");if(y!=null&&y.match(/\d/))return Number.parseInt(y,10)*1e3}return~~(1<<g)*o},retryCount:a,signal:c,shouldRetry:({error:g})=>FJ(g)}),{enabled:s,id:d})}}function FJ(t){return a0(t)?!1:"code"in t&&typeof t.code=="number"?t.code===-1||t.code===lp.code||t.code===cp.code||t.code===429:t instanceof Pm&&t.status?t.status===403||t.status===408||t.status===413||t.status===429||t.status===500||t.status===502||t.status===503||t.status===504:!0}function HJ(t,e=0){let r=3735928559^e,n=1103547991^e;for(let s=0;s<t.length;s++){const i=t.charCodeAt(s);r=Math.imul(r^i,2654435761),n=Math.imul(n^i,1597334677)}return r=Math.imul(r^r>>>16,2246822507),r^=Math.imul(n^n>>>16,3266489909),n=Math.imul(n^n>>>16,2246822507),n^=Math.imul(r^r>>>16,3266489909),(4294967296*(2097151&n)+(r>>>0)).toString(36)}function BL(t){const e={formatters:void 0,fees:void 0,serializers:void 0,...t};function r(n){return s=>{const i=typeof s=="function"?s(n):s,o={...n,...i};return Object.assign(o,{extend:r(o)})}}return Object.assign(e,{extend:r(e)})}function qJ(t,{errorInstance:e=new Error("timed out"),timeout:r,signal:n}){return new Promise((s,i)=>{(async()=>{let o;const a=new AbortController;try{r>0&&(o=setTimeout(()=>{n&&a.abort()},r)),s(await t({signal:(a==null?void 0:a.signal)||null}))}catch(c){if(a!=null&&a.signal.aborted&&a0(c)){i(e);return}i(c)}finally{clearTimeout(o)}})()})}function zJ(){return{current:0,take(){return this.current++},reset(){this.current=0}}}const zx=zJ(),WJ=10485760;function VJ(t,e={}){const{url:r,headers:n}=KJ(t);return{async request(s){var p,y,w;const{body:i,fetchFn:o=e.fetchFn??fetch,maxResponseBodySize:a=e.maxResponseBodySize??WJ,onRequest:c=e.onRequest,onResponse:u=e.onResponse,timeout:l=e.timeout??1e4}=s,d={...e.fetchOptions??{},...s.fetchOptions??{}},{headers:f,method:g,signal:h}=d;try{const I=await qJ(async({signal:b})=>{const m={...d,body:Array.isArray(i)?wd(i.map(S=>({jsonrpc:"2.0",id:S.id??zx.take(),...S}))):wd({jsonrpc:"2.0",id:i.id??zx.take(),...i}),headers:{...n,"Content-Type":"application/json",...f},method:g||"POST",signal:h||(l>0?b:null)},_=new Request(r,m),O=await(c==null?void 0:c(_,m))??{...m,url:r};return await o(O.url??r,O)},{errorInstance:new Lx({body:i,url:r}),timeout:l,signal:!0});u&&await u(I);let v;const E=await GJ(I,{maxResponseBodySize:a});if((p=I.headers.get("Content-Type"))!=null&&p.startsWith("application/json"))v=JSON.parse(E);else{v=E;try{v=JSON.parse(v||"{}")}catch(b){if(I.ok)throw b;v={error:v}}}if(!I.ok){if(typeof((y=v.error)==null?void 0:y.code)=="number"&&typeof((w=v.error)==null?void 0:w.message)=="string")return v;throw new Pm({body:i,details:wd(v.error)||I.statusText,headers:I.headers,status:I.status,url:r})}return v}catch(I){throw h!=null&&h.aborted?Od(h):a0(I)||I instanceof Pm||I instanceof o_||I instanceof Lx?I:new Pm({body:i,cause:I,url:r})}}}}async function GJ(t,{maxResponseBodySize:e}){if(e===!1)return t.text();const r=t.headers.get("Content-Length");if(r){const a=Number(r);if(a>e)throw new o_({maxSize:e,size:a})}if(!t.body){const a=await t.text(),c=new TextEncoder().encode(a).length;if(c>e)throw new o_({maxSize:e,size:c});return a}const n=t.body.getReader(),s=new TextDecoder;let i="",o=0;try{for(;;){const{done:a,value:c}=await n.read();if(a)break;if(o+=c.byteLength,o>e)throw await n.cancel(),new o_({maxSize:e,size:o});i+=s.decode(c,{stream:!0})}return i+=s.decode(),i}finally{n.releaseLock()}}function KJ(t){try{const e=new URL(t),r=(()=>
vendor: 6,131 bytes, line 8
8{if(e.username){const n=`${decodeURIComponent(e.username)}:${decodeURIComponent(e.password)}`;return e.username="",e.password="",{url:e.toString(),headers:{Authorization:`Basic ${btoa(n)}`}}}})();return{url:e.toString(),...r}}catch{return{url:t}}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const ys=BigInt(0),Kn=BigInt(1),Fl=BigInt(2),ZJ=BigInt(3),kL=BigInt(4),jL=BigInt(5),DL=BigInt(8);function fs(t,e){const r=t%e;return r>=ys?r:e+r}function Ys(t,e,r){let n=t;for(;e-- >ys;)n*=n,n%=r;return n}function XS(t,e){if(t===ys)throw new Error("invert: expected non-zero number");if(e<=ys)throw new Error("invert: expected positive modulus, got "+e);let r=fs(t,e),n=e,s=ys,i=Kn;for(;r!==ys;){const a=n/r,c=n%r,u=s-i*a;n=r,r=c,s=i,i=u}if(n!==Kn)throw new Error("invert: does not exist");return fs(s,e)}function UL(t,e){const r=(t.ORDER+Kn)/kL,n=t.pow(e,r);if(!t.eql(t.sqr(n),e))throw new Error("Cannot find square root");return n}function YJ(t,e){const r=(t.ORDER-jL)/DL,n=t.mul(e,Fl),s=t.pow(n,r),i=t.mul(e,s),o=t.mul(t.mul(i,Fl),s),a=t.mul(i,t.sub(o,t.ONE));if(!t.eql(t.sqr(a),e))throw new Error("Cannot find square root");return a}function JJ(t){if(t<BigInt(3))throw new Error("sqrt is not defined for small field");let e=t-Kn,r=0;for(;e%Fl===ys;)e/=Fl,r++;let n=Fl;const s=YP(t);for(;Wx(s,n)===1;)if(n++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(r===1)return UL;let i=s.pow(n,e);const o=(e+Kn)/Fl;return function(c,u){if(c.is0(u))return u;if(Wx(c,u)!==1)throw new Error("Cannot find square root");let l=r,d=c.mul(c.ONE,i),f=c.pow(u,e),g=c.pow(u,o);for(;!c.eql(f,c.ONE);){if(c.is0(f))return c.ZERO;let h=1,p=c.sqr(f);for(;!c.eql(p,c.ONE);)if(h++,p=c.sqr(p),h===l)throw new Error("Cannot find square root");const y=Kn<<BigInt(l-h-1),w=c.pow(d,y);l=h,d=c.sqr(w),f=c.mul(f,d),g=c.mul(g,w)}return g}}function QJ(t){return t%kL===ZJ?UL:t%DL===jL?YJ:JJ(t)}const XJ=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function eQ(t){const e={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},r=XJ.reduce((n,s)=>(n[s]="function",n),e);return DA(t,r)}function tQ(t,e,r){if(r<ys)throw new Error("invalid exponent, negatives unsupported");if(r===ys)return t.ONE;if(r===Kn)return e;let n=t.ONE,s=e;for(;r>ys;)r&Kn&&(n=t.mul(n,s)),s=t.sqr(s),r>>=Kn;return n}function ML(t,e,r=!1){const n=new Array(e.length).fill(r?t.ZERO:void 0),s=e.reduce((o,a,c)=>t.is0(a)?o:(n[c]=o,t.mul(o,a)),t.ONE),i=t.inv(s);return e.reduceRight((o,a,c)=>t.is0(a)?o:(n[c]=t.mul(o,n[c]),t.mul(o,a)),i),n}function Wx(t,e){const r=(t.ORDER-Kn)/Fl,n=t.pow(e,r),s=t.eql(n,t.ONE),i=t.eql(n,t.ZERO),o=t.eql(n,t.neg(t.ONE));if(!s&&!i&&!o)throw new Error("invalid Legendre symbol result");return s?1:i?0:-1}function $L(t,e){e!==void 0&&LS(e);const r=e!==void 0?e:t.toString(2).length,n=Math.ceil(r/8);return{nBitLength:r,nByteLength:n}}function YP(t,e,r=!1,n={}){if(t<=ys)throw new Error("invalid field: expected ORDER > 0, got "+t);const{nBitLength:s,nByteLength:i}=$L(t,e);if(i>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let o;const a=Object.freeze({ORDER:t,isLE:r,BITS:s,BYTES:i,MASK:jA(s),ZERO:ys,ONE:Kn,create:c=>fs(c,t),isValid:c=>{if(typeof c!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof c);return ys<=c&&c<t},is0:c=>c===ys,isOdd:c=>(c&Kn)===Kn,neg:c=>fs(-c,t),eql:(c,u)=>c===u,sqr:c=>fs(c*c,t),add:(c,u)=>fs(c+u,t),sub:(c,u)=>fs(c-u,t),mul:(c,u)=>fs(c*u,t),pow:(c,u)=>tQ(a,c,u),div:(c,u)=>fs(c*XS(u,t),t),sqrN:c=>c*c,addN:(c,u)=>c+u,subN:(c,u)=>c-u,mulN:(c,u)=>c*u,inv:c=>XS(c,t),sqrt:n.sqrt||(c=>(o||(o=QJ(t)),o(a,c))),toBytes:c=>r?NL(c,i):u0(c,i),fromBytes:c=>{if(c.length!==i)throw new Error("Field.fromBytes: expected "+i+" bytes, got "+c.length);return r?OL(c):vd(c)},invertBatch:c=>ML(a,c),cmov:(c,u,l)=>l?u:c});return Object.freeze(a)}function LL(t){if(typeof t!="bigint")throw new Error("field order must be bigint");const e=t.toString(2).length;return Math.ceil(e/8)}function FL(t){const e=LL(t);return e+Math.ceil(e/2)}function rQ(t,e,r=!1){const n=t.length,s=LL(e),i=FL(e);if(n<16||n<i||n>1024)throw new Error("expected "+i+"-1024 bytes of input, got "+n);const o=r?OL(t):vd(t),a=fs(o,e-Kn)+Kn;return r?NL(a,s):u0(a,s)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Vx=BigInt(0),eT=BigInt(1);function O2(t,e){const r=e.negate();return t?r:e}function HL(t,e){if(!Number.isSafeInteger(t)||t<=0||t>e)throw new Error("invalid window size, expected [1.."+e+"], got W="+t)}function N2(t,e){HL(t,e);const r=Math.ceil(e/t)+1,n=2**(t-1),s=2**t,i=jA(t),o=BigInt(t);return{windows:r,windowSize:n,mask:i,maxNumber:s,shiftBy:o}}function Gx(t,e,r){const{windowSize:n,mask:s,maxNumber:i,shiftBy:o}=r;let a=Number(t&s),c=t>>o;a>n&&(a-=i,c+=eT);const u=e*n,l=u+Math.abs(a)-1,d=a===0,f=a<0,g=e%2!==0;return{nextN:c,offset:l,isZero:d,isNeg:f,isNegF:g,offsetF:u}}function nQ(t,e){if(!Array.isArray(t))throw new Error("array expected");t.forEach((r,n)=>{if(!(r instanceof e))throw new Error("invalid point at index "+n)})}function sQ(t,e){if(!Array.isArray(t))throw new Error("array of scalars expected");t.forEach((r,n)=>{if(!e.isValid(r))throw new Error("invalid scalar at index "+n)})}const x2=new WeakMap,qL=new WeakMap;function R2(t){return qL.get(t)||1}function iQ(t,e){return{constTimeNegate:O2,hasPrecomputes(r){return R2(r)!==1},unsafeLadder(r,n,s=t.ZERO){let i=r;for(;n>Vx;)n&eT&&(s=s.add(i)),i=i.double(),n>>=eT;return s},precomputeWindow(r,n){const{windows:s,windowSize:i}=N2(n,e),o=[];let a=r,c=a;for(let u=0;u<s;u++){c=a,o.push(c);for(let l=1;l<i;l++)c=c.add(a),o.push(c);a=c.double()}return o},wNAF(r,n,s){let i=t.ZERO,o=t.BASE;const a=N2(r,e);for(let c=0;c<a.windows;c++){const{nextN:u,offset:l,isZero:d,isNeg:f,isNegF:g,offsetF:h}=Gx(s,c,a);s=u,d?o=o.add(O2(g,n[h])):i=i.add(O2(f,n[l]))}return{p:i,f:o}},wNAFUnsafe(r,n,s,i=t.ZERO){const o=N2(r,e);for(let a=0;a<o.windows&&s!==Vx;a++){const{nextN:c,offset:u,isZero:l,isNeg:d}=Gx(s,a,o);if(s=c,!l){const f=n[u];i=i.add(d?f.negate():f)}}return i},getPrecomputes(r,n,s){let i=x2.get(n);
vendor: 5,231 bytes, line 8
8return i||(i=this.precomputeWindow(n,r),r!==1&&x2.set(n,s(i))),i},wNAFCached(r,n,s){const i=R2(r);return this.wNAF(i,this.getPrecomputes(i,r,s),n)},wNAFCachedUnsafe(r,n,s,i){const o=R2(r);return o===1?this.unsafeLadder(r,n,i):this.wNAFUnsafe(o,this.getPrecomputes(o,r,s),n,i)},setWindowSize(r,n){HL(n,e),qL.set(r,n),x2.delete(r)}}}function oQ(t,e,r,n){nQ(r,t),sQ(n,e);const s=r.length,i=n.length;if(s!==i)throw new Error("arrays of points and scalars must have equal length");const o=t.ZERO,a=RJ(BigInt(s));let c=1;a>12?c=a-3:a>4?c=a-2:a>0&&(c=2);const u=jA(c),l=new Array(Number(u)+1).fill(o),d=Math.floor((e.BITS-1)/c)*c;let f=o;for(let g=d;g>=0;g-=c){l.fill(o);for(let p=0;p<i;p++){const y=n[p],w=Number(y>>BigInt(g)&u);l[w]=l[w].add(r[p])}let h=o;for(let p=l.length-1,y=o;p>0;p--)y=y.add(l[p]),h=h.add(y);if(f=f.add(h),g!==0)for(let p=0;p<c;p++)f=f.double()}return f}function zL(t){return eQ(t.Fp),DA(t,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...$L(t.n,t.nBitLength),...t,p:t.Fp.ORDER})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function Kx(t){t.lowS!==void 0&&Iy("lowS",t.lowS),t.prehash!==void 0&&Iy("prehash",t.prehash)}function aQ(t){const e=zL(t);DA(e,{a:"field",b:"field"},{allowInfinityPoint:"boolean",allowedPrivateKeyLengths:"array",clearCofactor:"function",fromBytes:"function",isTorsionFree:"function",toBytes:"function",wrapPrivateKey:"boolean"});const{endo:r,Fp:n,a:s}=e;if(r){if(!n.eql(s,n.ZERO))throw new Error("invalid endo: CURVE.a must be 0");if(typeof r!="object"||typeof r.beta!="bigint"||typeof r.splitScalar!="function")throw new Error('invalid endo: expected "beta": bigint and "splitScalar": function')}return Object.freeze({...e})}class cQ extends Error{constructor(e=""){super(e)}}const ka={Err:cQ,_tlv:{encode:(t,e)=>{const{Err:r}=ka;if(t<0||t>256)throw new r("tlv.encode: wrong tag");if(e.length&1)throw new r("tlv.encode: unpadded data");const n=e.length/2,s=cb(n);if(s.length/2&128)throw new r("tlv.encode: long form length too big");const i=n>127?cb(s.length/2|128):"";return cb(t)+i+s+e},decode(t,e){const{Err:r}=ka;let n=0;if(t<0||t>256)throw new r("tlv.encode: wrong tag");if(e.length<2||e[n++]!==t)throw new r("tlv.decode: wrong tlv");const s=e[n++],i=!!(s&128);let o=0;if(!i)o=s;else{const c=s&127;if(!c)throw new r("tlv.decode(long): indefinite length not supported");if(c>4)throw new r("tlv.decode(long): byte length is too big");const u=e.subarray(n,n+c);if(u.length!==c)throw new r("tlv.decode: length bytes not complete");if(u[0]===0)throw new r("tlv.decode(long): zero leftmost byte");for(const l of u)o=o<<8|l;if(n+=c,o<128)throw new r("tlv.decode(long): not minimal encoding")}const a=e.subarray(n,n+o);if(a.length!==o)throw new r("tlv.decode: wrong value length");return{v:a,l:e.subarray(n+o)}}},_int:{encode(t){const{Err:e}=ka;if(t<Za)throw new e("integer: negative integers are not allowed");let r=cb(t);if(Number.parseInt(r[0],16)&8&&(r="00"+r),r.length&1)throw new e("unexpected DER parsing assertion: unpadded hex");return r},decode(t){const{Err:e}=ka;if(t[0]&128)throw new e("invalid signature integer: negative");if(t[0]===0&&!(t[1]&128))throw new e("invalid signature integer: unnecessary leading zero");return vd(t)}},toSig(t){const{Err:e,_int:r,_tlv:n}=ka,s=si("signature",t),{v:i,l:o}=n.decode(48,s);if(o.length)throw new e("invalid signature: left bytes after parsing");const{v:a,l:c}=n.decode(2,i),{v:u,l}=n.decode(2,c);if(l.length)throw new e("invalid signature: left bytes after parsing");return{r:r.decode(a),s:r.decode(u)}},hexFromSig(t){const{_tlv:e,_int:r}=ka,n=e.encode(2,r.encode(t.r)),s=e.encode(2,r.encode(t.s)),i=n+s;return e.encode(48,i)}};function B2(t,e){return Sy(u0(t,e))}const Za=BigInt(0),Vr=BigInt(1);BigInt(2);const k2=BigInt(3),uQ=BigInt(4);function lQ(t){const e=aQ(t),{Fp:r}=e,n=YP(e.n,e.nBitLength),s=e.toBytes||((v,E,b)=>{const m=E.toAffine();return L_(Uint8Array.from([4]),r.toBytes(m.x),r.toBytes(m.y))}),i=e.fromBytes||(v=>{const E=v.subarray(1),b=r.fromBytes(E.subarray(0,r.BYTES)),m=r.fromBytes(E.subarray(r.BYTES,2*r.BYTES));return{x:b,y:m}});function o(v){const{a:E,b}=e,m=r.sqr(v),_=r.mul(m,v);return r.add(r.add(_,r.mul(v,E)),b)}function a(v,E){const b=r.sqr(E),m=o(v);return r.eql(b,m)}if(!a(e.Gx,e.Gy))throw new Error("bad curve params: generator point");const c=r.mul(r.pow(e.a,k2),uQ),u=r.mul(r.sqr(e.b),BigInt(27));if(r.is0(r.add(c,u)))throw new Error("bad curve params: a or b");function l(v){return ZP(v,Vr,e.n)}function d(v){const{allowedPrivateKeyLengths:E,nByteLength:b,wrapPrivateKey:m,n:_}=e;if(E&&typeof v!="bigint"){if(c0(v)&&(v=Sy(v)),typeof v!="string"||!E.includes(v.length))throw new Error("invalid private key");v=v.padStart(b*2,"0")}let O;try{O=typeof v=="bigint"?v:vd(si("private key",v,b))}catch{throw new Error("invalid private key, expected hex or "+b+" bytes, got "+typeof v)}return m&&(O=fs(O,_)),oh("private key",O,Vr,_),O}function f(v){if(!(v instanceof p))throw new Error("ProjectivePoint expected")}const g=qx((v,E)=>{const{px:b,py:m,pz:_}=v;if(r.eql(_,r.ONE))return{x:b,y:m};const O=v.is0();E==null&&(E=O?r.ONE:r.inv(_));const C=r.mul(b,E),S=r.mul(m,E),T=r.mul(_,E);if(O)return{x:r.ZERO,y:r.ZERO};
vendor: 4,411 bytes, line 8
8if(!r.eql(T,r.ONE))throw new Error("invZ was invalid");return{x:C,y:S}}),h=qx(v=>{if(v.is0()){if(e.allowInfinityPoint&&!r.is0(v.py))return;throw new Error("bad point: ZERO")}const{x:E,y:b}=v.toAffine();if(!r.isValid(E)||!r.isValid(b))throw new Error("bad point: x or y not FE");if(!a(E,b))throw new Error("bad point: equation left != right");if(!v.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});class p{constructor(E,b,m){if(E==null||!r.isValid(E))throw new Error("x required");if(b==null||!r.isValid(b)||r.is0(b))throw new Error("y required");if(m==null||!r.isValid(m))throw new Error("z required");this.px=E,this.py=b,this.pz=m,Object.freeze(this)}static fromAffine(E){const{x:b,y:m}=E||{};if(!E||!r.isValid(b)||!r.isValid(m))throw new Error("invalid affine point");if(E instanceof p)throw new Error("projective point not allowed");const _=O=>r.eql(O,r.ZERO);return _(b)&&_(m)?p.ZERO:new p(b,m,r.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(E){const b=ML(r,E.map(m=>m.pz));return E.map((m,_)=>m.toAffine(b[_])).map(p.fromAffine)}static fromHex(E){const b=p.fromAffine(i(si("pointHex",E)));return b.assertValidity(),b}static fromPrivateKey(E){return p.BASE.multiply(d(E))}static msm(E,b){return oQ(p,n,E,b)}_setWindowSize(E){I.setWindowSize(this,E)}assertValidity(){h(this)}hasEvenY(){const{y:E}=this.toAffine();if(r.isOdd)return!r.isOdd(E);throw new Error("Field doesn't support isOdd")}equals(E){f(E);const{px:b,py:m,pz:_}=this,{px:O,py:C,pz:S}=E,T=r.eql(r.mul(b,S),r.mul(O,_)),N=r.eql(r.mul(m,S),r.mul(C,_));return T&&N}negate(){return new p(this.px,r.neg(this.py),this.pz)}double(){const{a:E,b}=e,m=r.mul(b,k2),{px:_,py:O,pz:C}=this;let S=r.ZERO,T=r.ZERO,N=r.ZERO,R=r.mul(_,_),B=r.mul(O,O),A=r.mul(C,C),P=r.mul(_,O);return P=r.add(P,P),N=r.mul(_,C),N=r.add(N,N),S=r.mul(E,N),T=r.mul(m,A),T=r.add(S,T),S=r.sub(B,T),T=r.add(B,T),T=r.mul(S,T),S=r.mul(P,S),N=r.mul(m,N),A=r.mul(E,A),P=r.sub(R,A),P=r.mul(E,P),P=r.add(P,N),N=r.add(R,R),R=r.add(N,R),R=r.add(R,A),R=r.mul(R,P),T=r.add(T,R),A=r.mul(O,C),A=r.add(A,A),R=r.mul(A,P),S=r.sub(S,R),N=r.mul(A,B),N=r.add(N,N),N=r.add(N,N),new p(S,T,N)}add(E){f(E);const{px:b,py:m,pz:_}=this,{px:O,py:C,pz:S}=E;let T=r.ZERO,N=r.ZERO,R=r.ZERO;const B=e.a,A=r.mul(e.b,k2);let P=r.mul(b,O),k=r.mul(m,C),U=r.mul(_,S),x=r.add(b,m),j=r.add(O,C);x=r.mul(x,j),j=r.add(P,k),x=r.sub(x,j),j=r.add(b,_);let D=r.add(O,S);return j=r.mul(j,D),D=r.add(P,U),j=r.sub(j,D),D=r.add(m,_),T=r.add(C,S),D=r.mul(D,T),T=r.add(k,U),D=r.sub(D,T),R=r.mul(B,j),T=r.mul(A,U),R=r.add(T,R),T=r.sub(k,R),R=r.add(k,R),N=r.mul(T,R),k=r.add(P,P),k=r.add(k,P),U=r.mul(B,U),j=r.mul(A,j),k=r.add(k,U),U=r.sub(P,U),U=r.mul(B,U),j=r.add(j,U),P=r.mul(k,j),N=r.add(N,P),P=r.mul(D,j),T=r.mul(x,T),T=r.sub(T,P),P=r.mul(x,k),R=r.mul(D,R),R=r.add(R,P),new p(T,N,R)}subtract(E){return this.add(E.negate())}is0(){return this.equals(p.ZERO)}wNAF(E){return I.wNAFCached(this,E,p.normalizeZ)}multiplyUnsafe(E){const{endo:b,n:m}=e;oh("scalar",E,Za,m);const _=p.ZERO;if(E===Za)return _;if(this.is0()||E===Vr)return this;if(!b||I.hasPrecomputes(this))return I.wNAFCachedUnsafe(this,E,p.normalizeZ);let{k1neg:O,k1:C,k2neg:S,k2:T}=b.splitScalar(E),N=_,R=_,B=this;for(;C>Za||T>Za;)C&Vr&&(N=N.add(B)),T&Vr&&(R=R.add(B)),B=B.double(),C>>=Vr,T>>=Vr;return O&&(N=N.negate()),S&&(R=R.negate()),R=new p(r.mul(R.px,b.beta),R.py,R.pz),N.add(R)}multiply(E){const{endo:b,n:m}=e;oh("scalar",E,Vr,m);let _,O;if(b){const{k1neg:C,k1:S,k2neg:T,k2:N}=b.splitScalar(E);let{p:R,f:B}=this.wNAF(S),{p:A,f:P}=this.wNAF(N);R=I.constTimeNegate(C,R),A=I.constTimeNegate(T,A),A=new p(r.mul(A.px,b.beta),A.py,A.pz),_=R.add(A),O=B.add(P)}else{const{p:C,f:S}=this.wNAF(E);_=C,O=S}return p.normalizeZ([_,O])[0]}multiplyAndAddUnsafe(E,b,m){const _=p.BASE,O=(S,T)=>T===Za||T===Vr||!S.equals(_)?S.multiplyUnsafe(T):S.multiply(T),C=O(this,b).add(O(E,m));return C.is0()?void 0:C}toAffine(E){return g(this,E)}isTorsionFree(){const{h:E,isTorsionFree:b}=e;if(E===Vr)return!0;if(b)return b(p,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:E,clearCofactor:b}=e;return E===Vr?this:b?b(p,this):this.multiplyUnsafe(e.h)}toRawBytes(E=!0){return Iy("isCompressed",E),this.assertValidity(),s(p,this,E)}toHex(E=!0){return Iy("isCompressed",E),Sy(this.toRawBytes(E))}}p.BASE=new p(e.Gx,e.Gy,r.ONE),p.ZERO=new p(r.ZERO,r.ONE,r.ZERO);
vendor: 4,627 bytes, line 8
8const{endo:y,nBitLength:w}=e,I=iQ(p,y?Math.ceil(w/2):w);return{CURVE:e,ProjectivePoint:p,normPrivateKeyToScalar:d,weierstrassEquation:o,isWithinCurveOrder:l}}function dQ(t){const e=zL(t);return DA(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}function fQ(t){const e=dQ(t),{Fp:r,n,nByteLength:s,nBitLength:i}=e,o=r.BYTES+1,a=2*r.BYTES+1;function c(A){return fs(A,n)}function u(A){return XS(A,n)}const{ProjectivePoint:l,normPrivateKeyToScalar:d,weierstrassEquation:f,isWithinCurveOrder:g}=lQ({...e,toBytes(A,P,k){const U=P.toAffine(),x=r.toBytes(U.x),j=L_;return Iy("isCompressed",k),k?j(Uint8Array.from([P.hasEvenY()?2:3]),x):j(Uint8Array.from([4]),x,r.toBytes(U.y))},fromBytes(A){const P=A.length,k=A[0],U=A.subarray(1);if(P===o&&(k===2||k===3)){const x=vd(U);if(!ZP(x,Vr,r.ORDER))throw new Error("Point is not on curve");const j=f(x);let D;try{D=r.sqrt(j)}catch(H){const z=H instanceof Error?": "+H.message:"";throw new Error("Point is not on curve"+z)}const M=(D&Vr)===Vr;return(k&1)===1!==M&&(D=r.neg(D)),{x,y:D}}else if(P===a&&k===4){const x=r.fromBytes(U.subarray(0,r.BYTES)),j=r.fromBytes(U.subarray(r.BYTES,2*r.BYTES));return{x,y:j}}else{const x=o,j=a;throw new Error("invalid Point, expected length of "+x+", or uncompressed "+j+", got "+P)}}});function h(A){const P=n>>Vr;return A>P}function p(A){return h(A)?c(-A):A}const y=(A,P,k)=>vd(A.slice(P,k));class w{constructor(P,k,U){oh("r",P,Vr,n),oh("s",k,Vr,n),this.r=P,this.s=k,U!=null&&(this.recovery=U),Object.freeze(this)}static fromCompact(P){const k=s;return P=si("compactSignature",P,k*2),new w(y(P,0,k),y(P,k,2*k))}static fromDER(P){const{r:k,s:U}=ka.toSig(si("DER",P));return new w(k,U)}assertValidity(){}addRecoveryBit(P){return new w(this.r,this.s,P)}recoverPublicKey(P){const{r:k,s:U,recovery:x}=this,j=_(si("msgHash",P));if(x==null||![0,1,2,3].includes(x))throw new Error("recovery id invalid");const D=x===2||x===3?k+e.n:k;if(D>=r.ORDER)throw new Error("recovery id 2 or 3 invalid");const M=(x&1)===0?"02":"03",L=l.fromHex(M+B2(D,r.BYTES)),H=u(D),z=c(-j*H),V=c(U*H),G=l.BASE.multiplyAndAddUnsafe(L,z,V);if(!G)throw new Error("point at infinify");return G.assertValidity(),G}hasHighS(){return h(this.s)}normalizeS(){return this.hasHighS()?new w(this.r,c(-this.s),this.recovery):this}toDERRawBytes(){return $_(this.toDERHex())}toDERHex(){return ka.hexFromSig(this)}toCompactRawBytes(){return $_(this.toCompactHex())}toCompactHex(){const P=s;return B2(this.r,P)+B2(this.s,P)}}const I={isValidPrivateKey(A){try{return d(A),!0}catch{return!1}},normPrivateKeyToScalar:d,randomPrivateKey:()=>{const A=FL(e.n);return rQ(e.randomBytes(A),e.n)},precompute(A=8,P=l.BASE){return P._setWindowSize(A),P.multiply(BigInt(3)),P}};function v(A,P=!0){return l.fromPrivateKey(A).toRawBytes(P)}function E(A){if(typeof A=="bigint")return!1;if(A instanceof l)return!0;const k=si("key",A).length,U=r.BYTES,x=U+1,j=2*U+1;if(!(e.allowedPrivateKeyLengths||s===x))return k===x||k===j}function b(A,P,k=!0){if(E(A)===!0)throw new Error("first arg must be private key");if(E(P)===!1)throw new Error("second arg must be public key");return l.fromHex(P).multiply(d(A)).toRawBytes(k)}const m=e.bits2int||function(A){if(A.length>8192)throw new Error("input is too large");const P=vd(A),k=A.length*8-i;return k>0?P>>BigInt(k):P},_=e.bits2int_modN||function(A){return c(m(A))},O=jA(i);function C(A){return oh("num < 2^"+i,A,Za,O),u0(A,s)}function S(A,P,k=T){if(["recovered","canonical"].some(X=>X in k))throw new Error("sign() legacy options not supported");const{hash:U,randomBytes:x}=e;let{lowS:j,prehash:D,extraEntropy:M}=k;j==null&&(j=!0),A=si("msgHash",A),Kx(k),D&&(A=si("prehashed msgHash",U(A)));const L=_(A),H=d(P),z=[C(H),C(L)];if(M!=null&&M!==!1){const X=M===!0?x(r.BYTES):M;z.push(si("extraEntropy",X))}const V=L_(...z),G=L;function ee(X){const oe=m(X);if(!g(oe))return;const te=u(oe),fe=l.BASE.multiply(oe).toAffine(),Se=c(fe.x);if(Se===Za)return;const le=c(te*c(G+Se*H));if(le===Za)return;let we=(fe.x===Se?0:2)|Number(fe.y&Vr),ve=le;return j&&h(le)&&(ve=p(le),we^=1),new w(Se,ve,we)}return{seed:V,k2sig:ee}}const T={lowS:e.lowS,prehash:!1},N={lowS:e.lowS,prehash:!1};function R(A,P,k=T){const{seed:U,k2sig:x}=S(A,P,k),j=e;return BJ(j.hash.outputLen,j.nByteLength,j.hmac)(U,x)}l.BASE._setWindowSize(8);function B(A,P,k,U=N){var we;const x=A;P=si("msgHash",P),k=si("publicKey",k);const{lowS:j,prehash:D,format:M}=U;if(Kx(U),"strict"in U)throw new Error("options.strict was renamed to lowS");if(M!==void 0&&M!=="compact"&&M!=="der")throw new Error("format must be compact or der");
8const L=typeof x=="string"||c0(x),H=!L&&!M&&typeof x=="object"&&x!==null&&typeof x.r=="bigint"&&typeof x.s=="bigint";if(!L&&!H)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");let z,V;try{if(H&&(z=new w(x.r,x.s)),L){try{M!=="compact"&&(z=w.fromDER(x))}catch(ve){if(!(ve instanceof ka.Err))throw ve}!z&&M!=="der"&&(z=w.fromCompact(x))}V=l.fromHex(k)}catch{return!1}if(!z||j&&z.hasHighS())return!1;D&&(P=e.hash(P));const{r:G,s:ee}=z,X=_(P),oe=u(ee),te=c(X*oe),fe=c(G*oe),Se=(we=l.BASE.multiplyAndAddUnsafe(V,te,fe))==null?void 0:we.toAffine();return Se?c(Se.x)===G:!1}return{CURVE:e,getPublicKey:v,getSharedSecret:b,sign:R,verify:B,ProjectivePoint:l,Signature:w,utils:I}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function hQ(t){return{hash:t,hmac:(e,...r)=>JV(t,e,QV(...r)),randomBytes:YV}}function pQ(t,e){const r=n=>fQ({...t,...hQ(n)});return{...r(e),create:r}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const WL=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),Zx=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),gQ=BigInt(0),mQ=BigInt(1),tT=BigInt(2),Yx=(t,e)=>(t+e/tT)/e;function yQ(t){const e=WL,r=BigInt(3),n=BigInt(6),s=BigInt(11),i=BigInt(22),o=BigInt(23),a=BigInt(44),c=BigInt(88),u=t*t*t%e,l=u*u*t%e,d=Ys(l,r,e)*l%e,f=Ys(d,r,e)*l%e,g=Ys(f,tT,e)*u%e,h=Ys(g,s,e)*g%e,p=Ys(h,i,e)*h%e,y=Ys(p,a,e)*p%e,w=Ys(y,c,e)*y%e,I=Ys(w,a,e)*p%e,v=Ys(I,r,e)*l%e,E=Ys(v,o,e)*h%e,b=Ys(E,n,e)*u%e,m=Ys(b,tT,e);if(!rT.eql(rT.sqr(m),t))throw new Error("Cannot find square root");return m}const rT=YP(WL,void 0,void 0,{sqrt:yQ}),VL=pQ({a:gQ,b:BigInt(7),Fp:rT,n:Zx,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:t=>{const e=Zx,r=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-mQ*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),s=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),i=r,o=BigInt("0x100000000000000000000000000000000"),a=Yx(i*t,e),c=Yx(-n*t,e);let u=fs(t-a*r-c*s,e),l=fs(-a*n-c*i,e);const d=u>o,f=l>o;if(d&&(u=e-u),f&&(l=e-l),u>o||l>o)throw new Error("splitScalar: Endomorphism failed, k="+t);return{k1neg:d,k1:u,k2neg:f,k2:l}}}},XV),p2e=Object.freeze(Object.defineProperty({__proto__:null,secp256k1:VL},Symbol.toStringTag,{value:"Module"}));function GL(t,e){return zP(t,e)}function KL({key:t,methods:e,name:r,request:n,retryCount:s=3,retryDelay:i=150,timeout:o,type:a},c){const u=MJ();return{config:{key:t,methods:e,name:r,request:n,retryCount:s,retryDelay:i,timeout:o,type:a},request:LJ(n,{methods:e,retryCount:s,retryDelay:i,uid:u}),value:c}}function Jx(t,e={}){const{key:r="fallback",name:n="Fallback",rank:s=!1,shouldThrow:i=bQ,retryCount:o,retryDelay:a}=e;return({chain:c,pollingInterval:u=4e3,timeout:l,...d})=>{let f=t,g=()=>{};const h=KL({key:r,name:n,async request({method:p,params:y}){let w;const I=async(v=0)=>{const E=f[v]({...d,chain:c,retryCount:0,timeout:l});try{const b=await E.request({method:p,params:y});return g({method:p,params:y,response:b,transport:E,status:"success"}),b}catch(b){if(g({error:b,method:p,params:y,transport:E,status:"error"}),i(b)||v===f.length-1||(w??(w=f.slice(v+1).some(m=>{const{include:_,exclude:O}=m({chain:c}).config.methods||{};return _?_.includes(p):O?!O.includes(p):!0})),!w))throw b;return I(v+1)}};return I()},retryCount:o,retryDelay:a,type:"fallback"},{onResponse:p=>g=p,transports:f.map(p=>p({chain:c,retryCount:0}))});if(s){const p=typeof s=="object"?s:{};wQ({chain:c,interval:p.interval??u,onTransports:y=>f=y,ping:p.ping,sampleCount:p.sampleCount,timeout:p.timeout,transports:f,weights:p.weights})}return h}}function bQ(t){return!!("code"in t&&typeof t.code=="number"&&(t.code===up.code||t.code===Ed.code||t.code===dp.code||VP.nodeMessage.test(t.message)||t.code===5e3))}function wQ({chain:t,interval:e=4e3,onTransports:r,ping:n,sampleCount:s=10,timeout:i=1e3,transports:o,weights:a={}}
8){const{stability:c=.7,latency:u=.3}=a,l=[],d=async()=>{const f=await Promise.all(o.map(async p=>{const y=p({chain:t,retryCount:0,timeout:i}),w=Date.now();let I,v;try{await(n?n({transport:y}):y.request({method:"net_listening"})),v=1}catch{v=0}finally{I=Date.now()}return{latency:I-w,success:v}}));l.push(f),l.length>s&&l.shift();const g=Math.max(...l.map(p=>Math.max(...p.map(({latency:y})=>y)))),h=o.map((p,y)=>{const w=l.map(m=>m[y].latency),v=1-w.reduce((m,_)=>m+_,0)/w.length/g,E=l.map(m=>m[y].success),b=E.reduce((m,_)=>m+_,0)/E.length;return b===0?[0,y]:[u*v+c*b,y]}).sort((p,y)=>y[0]-p[0]);r(h.map(([,p])=>o[p])),await RL(e),d()};d()}class EQ extends Wt{constructor(){super("No URL was provided to the Transport. Please provide a valid RPC URL to the Transport.",{docsPath:"/docs/clients/intro",name:"UrlRequiredError"})}}let vQ=0;const Qx=new WeakMap;function _Q(t){if(!t)return"default";const e=Qx.get(t);if(e!==void 0)return e;const r=vQ++;return Qx.set(t,r),r}function hb(t,e={}){const{batch:r,fetchFn:n,fetchOptions:s,key:i="http",maxResponseBodySize:o,methods:a,name:c="HTTP JSON-RPC",onFetchRequest:u,onFetchResponse:l,retryDelay:d,raw:f}=e;return({chain:g,retryCount:h,timeout:p})=>{const{batchSize:y=1e3,wait:w=0}=typeof r=="object"?r:{},I=e.retryCount??h,v=p??e.timeout??1e4,E=t||(g==null?void 0:g.rpcUrls.default.http[0]);if(!E)throw new EQ;const b=VJ(E,{fetchFn:n,fetchOptions:s,maxResponseBodySize:o,onRequest:u,onResponse:l,timeout:v});return KL({key:i,methods:a,name:c,async request({method:m,params:_},O){const C={method:m,params:_},S=O!=null&&O.signal?{signal:O.signal}:void 0,{schedule:T}=DJ({id:`${E}.${_Q(O==null?void 0:O.signal)}`,wait:w,shouldSplitBatch(A){return A.length>y},fn:A=>b.request({body:A,fetchOptions:S}),sort:(A,P)=>A.id-P.id}),N=async A=>r?T(A):[await b.request({body:A,fetchOptions:S})],[{error:R,result:B}]=await N(C);if(f)return{error:R,result:B};if(R)throw new SL({body:C,error:R,url:E});return B},retryCount:I,retryDelay:d,timeout:v,type:"http"},{fetchOptions:s,url:E})}}async function Gp(...t){const e=await fetch(...t);if(!e.ok)throw new Error(`HTTP status code: ${e.status}`,{cause:e});return e}class l0{constructor({baseUrl:e,clientId:r}){this.baseUrl=e,this.clientId=r}async get({headers:e,signal:r,cache:n,...s}){const i=this.createUrl(s);return(await Gp(i,{method:"GET",headers:e,signal:r,cache:n})).json()}async getBlob({headers:e,signal:r,...n}){const s=this.createUrl(n);return(await Gp(s,{method:"GET",headers:e,signal:r})).blob()}async post({body:e,headers:r,signal:n,...s}){const i=this.createUrl(s);return(await Gp(i,{method:"POST",headers:r,body:e?JSON.stringify(e):void 0,signal:n})).json()}async put({body:e,headers:r,signal:n,...s}){const i=this.createUrl(s);return(await Gp(i,{method:"PUT",headers:r,body:e?JSON.stringify(e):void 0,signal:n})).json()}async delete({body:e,headers:r,signal:n,...s}){const i=this.createUrl(s);return(await Gp(i,{method:"DELETE",headers:r,body:e?JSON.stringify(e):void 0,signal:n})).json()}createUrl({path:e,params:r}){const n=new URL(e,this.baseUrl);return r&&Object.entries(r).forEach(([s,i])=>{i!=null&&n.searchParams.append(s,i)}),this.clientId&&n.searchParams.append("clientId",this.clientId),n}sendBeacon({body:e,...r}){const n=this.createUrl(r);return navigator.sendBeacon(n.toString(),e?JSON.stringify(e):void 0)}}const nT={getFeatureValue(t,e){const r=e==null?void 0:e[t];return r===void 0?lt.DEFAULT_FEATURES[t]:r},filterSocialsByPlatform(t){if(!t||!t.length)return t;let e=t;return be.isTelegram()&&(be.isIos()&&(e=e.filter(r=>r!=="google")),be.isMac()&&(e=e.filter(r=>r!=="x")),be.isAndroid()&&(e=e.filter(r=>!["facebook","x"].includes(r)))),be.isMobile()&&(e=e.filter(r=>r!=="facebook")),e},isSocialsEnabled(){var t,e,r,n;return Array.isArray((t=se.state.features)==null?void 0:t.socials)&&((e=se.state.features)==null?void 0:e.socials.length)>0||Array.isArray((r=se.state.remoteFeatures)==null?void 0:r.socials)&&((n=se.state.remoteFeatures)==null?void 0:n.socials.length)>0},isEmailEnabled(){var t,e;return!!((t=se.state.features)!=null&&t.email||(e=se.state.remoteFeatures)!=null&&e.email)}},Me=rr({features:lt.DEFAULT_FEATURES,projectId:"",sdkType:"appkit",sdkVersion:"html-wagmi-undefined",defaultAccountTypes:lt.DEFAULT_ACCOUNT_TYPES,enableNetworkSwitch:!0,experimental_preferUniversalLinks:!1,remoteFeatures:{},enableMobileFullScreen:!1,coinbasePreference:"all"}),se={state:Me,subscribeKey(t,e){return cr(Me,t,e)},setOptions(t){Object.assign(Me,t)},setRemoteFeatures(t){var r,n;if(!t)return;const e={...Me.remoteFeatures,...t};Me.remoteFeatures=e,(r=Me.remoteFeatures)!=null&&r.socials&&(Me.remoteFeatures.socials=nT.filterSocialsByPlatform(Me.remoteFeatures.socials)),(n=Me.features)!=null&&n.pay&&(Me.remoteFeatures.email=!1,Me.remoteFeatures.socials=!1)},setFeatures(t){var r;if(!t)return;Me.features||(Me.features=lt.DEFAULT_FEATURES);const e={...Me.features,...t};Me.features=e,(r=Me.features)!=null&&r.pay&&Me.remoteFeatures&&(Me.remoteFeatures.email=!1,Me.remoteFeatures.socials=!1)},setProjectId(t){Me.projectId=t},setCustomRpcUrls(t){Me.customRpcUrls=t},setAllWallets(t){Me.allWallets=t},setIncludeWalletIds(t){Me.includeWalletIds=t},setExcludeWalletIds(t){Me.excludeWalletIds=t},setFeaturedWalletIds(t){Me.featuredWalletIds=t},setTokens(t){Me.tokens=t},setTermsConditionsUrl(t){Me.termsConditionsUrl=t},setPrivacyPolicyUrl(t){Me.privacyPolicyUrl=t},setCustomWallets(t){Me.customWallets=t},setIsSiweEnabled(t){Me.isSiweEnabled=t},setIsUniversalProvider(t){Me.isUniversalProvider=t},setSdkVersion(t){Me.sdkVersion=t},setMetadata(t){Me.metadata=t},setDisableAppend(t){Me.disableAppend=t},setEIP6963Enabled(t){Me.enableEIP6963=t},setEnableInjected(t){Me.enableInjected=t},setEnableCoinbase(t){Me.enableCoinbase=t},setEnableBaseAccount(t){Me.enableBaseAccount=t},setDebug(t){Me.debug=t},setEnableWalletGuide(t){Me.enableWalletGuide=t},setEnableAuthLogger(t){Me.enableAuthLogger=t},setEnableWallets(t){Me.enableWallets=t},setPreferUniversalLinks(t){Me.experimental_preferUniversalLinks=t},setSIWX(t){if(t)for(const[e,r]of Object.entries(lt.SIWX_DEFAULTS))t[e]??(t[e]=r);Me.siwx=t},setConnectMethodsOrder(t){Me.features={...Me.features,connectMethodsOrder:t}},setWalletFeaturesOrder(t){Me.features={...Me.features,walletFeaturesOrder:t}},setSocialsOrder(t){Me.remoteFeatures={...Me.remoteFeatures,socials:t}},setCollapseWallets(t){Me.features={...Me.features,collapseWallets:t}},setEnableEmbedded(t){Me.enableEmbedded=t},setAllowUnsupportedChain(t){Me.allowUnsupportedChain=t},setManualWCControl(t){Me.manualWCControl=t},setEnableNetworkSwitch(t){Me.enableNetworkSwitch=t},setEnableMobileFullScreen(t){Me.enableMobileFullScreen=be.isMobile()&&t},setEnableReconnect(t){Me.enableReconnect=t},setCoinbasePreference(t){Me.coinbasePreference=t},setDefaultAccountTypes(t={}){Object.entries(t).forEach(([e,r])=>{r&&(Me.defaultAccountTypes[e]=r)})},setUniversalProviderConfigOverride(t){Me.universalProviderConfigOverride=t},getUniversalProviderConfigOverride(){return Me.universalProviderConfigOverride}
8,getSnapshot(){return qm(Me)}},Pl=Object.freeze({message:"",variant:"success",svg:void 0,open:!1,autoClose:!0}),kr=rr({...Pl}),AQ={state:kr,subscribeKey(t,e){return cr(kr,t,e)},showLoading(t,e={}){this._showMessage({message:t,variant:"loading",...e})},showSuccess(t){this._showMessage({message:t,variant:"success"})},showSvg(t,e){this._showMessage({message:t,svg:e})},showError(t){const e=be.parseError(t);this._showMessage({message:e,variant:"error"})},hide(){kr.message=Pl.message,kr.variant=Pl.variant,kr.svg=Pl.svg,kr.open=Pl.open,kr.autoClose=Pl.autoClose},_showMessage({message:t,svg:e,variant:r="success",autoClose:n=Pl.autoClose}){kr.open?(kr.open=!1,setTimeout(()=>{kr.message=t,kr.variant=r,kr.svg=e,kr.open=!0,kr.autoClose=n},150)):(kr.message=t,kr.variant=r,kr.svg=e,kr.open=!0,kr.autoClose=n)}},Bo=AQ,CQ={purchaseCurrencies:[{id:"2b92315d-eab7-5bef-84fa-089a131333f5",name:"USD Coin",symbol:"USDC",networks:[{name:"ethereum-mainnet",display_name:"Ethereum",chain_id:"1",contract_address:"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"},{name:"polygon-mainnet",display_name:"Polygon",chain_id:"137",contract_address:"0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174"}]},{id:"2b92315d-eab7-5bef-84fa-089a131333f5",name:"Ether",symbol:"ETH",networks:[{name:"ethereum-mainnet",display_name:"Ethereum",chain_id:"1",contract_address:"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"},{name:"polygon-mainnet",display_name:"Polygon",chain_id:"137",contract_address:"0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174"}]}],paymentCurrencies:[{id:"USD",payment_method_limits:[{id:"card",min:"10.00",max:"7500.00"},{id:"ach_bank_account",min:"10.00",max:"25000.00"}]},{id:"EUR",payment_method_limits:[{id:"card",min:"10.00",max:"7500.00"},{id:"ach_bank_account",min:"10.00",max:"25000.00"}]}]},ZL=be.getBlockchainApiUrl(),Rn=rr({clientId:null,api:new l0({baseUrl:ZL,clientId:null}),supportedChains:{http:[],ws:[]}}),Ve={state:Rn,async get(t){const{st:e,sv:r}=Ve.getSdkProperties(),n=se.state.projectId,s={...t.params||{},st:e,sv:r,projectId:n};return Rn.api.get({...t,params:s})},getSdkProperties(){const{sdkType:t,sdkVersion:e}=se.state;return{st:t||"unknown",sv:e||"unknown"}},async isNetworkSupported(t){if(!t)return!1;try{Rn.supportedChains.http.length||await Ve.getSupportedNetworks()}catch{return!1}return Rn.supportedChains.http.includes(t)},async getSupportedNetworks(){try{const t=await Ve.get({path:"v1/supported-chains"});return Rn.supportedChains=t,t}catch{return Rn.supportedChains}},async fetchIdentity({address:t}){const e=ce.getIdentityFromCacheForAddress(t);if(e)return e;const r=await Ve.get({path:`/v1/identity/${t}`,params:{sender:q.state.activeCaipAddress?be.getPlainAddress(q.state.activeCaipAddress):void 0}});return ce.updateIdentityCache({address:t,identity:r,timestamp:Date.now()}),r},async fetchTransactions({account:t,cursor:e,signal:r,cache:n,chainId:s}){var c;if(!await Ve.isNetworkSupported((c=q.state.activeCaipNetwork)==null?void 0:c.caipNetworkId))return{data:[],next:void 0};const o=ce.getTransactionsCacheForAddress({address:t,chainId:s});if(o)return o;const a=await Ve.get({path:`/v1/account/${t}/history`,params:{cursor:e,chainId:s},signal:r,cache:n});return ce.updateTransactionsCache({address:t,chainId:s,timestamp:Date.now(),transactions:a}),a},async fetchSwapQuote({amount:t,userAddress:e,from:r,to:n,gasPrice:s}){var o;return await Ve.isNetworkSupported((o=q.state.activeCaipNetwork)==null?void 0:o.caipNetworkId)?Ve.get({path:"/v1/convert/quotes",headers:{"Content-Type":"application/json"},params:{amount:t,userAddress:e,from:r,to:n,gasPrice:s}}):{quotes:[]}},async fetchSwapTokens({chainId:t}){var r;return await Ve.isNetworkSupported((r=q.state.activeCaipNetwork)==null?void 0:r.caipNetworkId)?Ve.get({path:"/v1/convert/tokens",params:{chainId:t}}):{tokens:[]}},async getAddressBalance({caipNetworkId:t,address:e,method:r="getAddressBalance",params:n}){return Rn.api.post({path:`/v1?chainId=${t}&projectId=${se.state.projectId}`,body:{id:"1",jsonrpc:"2.0",method:r,params:n??{address:e}}}).then(s=>s.result)},async fetchTokenPrice({addresses:t,caipNetworkId:e=(r=>(r=q.state.activeCaipNetwork)==null?void 0:r.caipNetworkId)()}
8){if(!await Ve.isNetworkSupported(e))return{fungibles:[]};const s=ce.getTokenPriceCacheForAddresses(t);if(s)return s;const i=await Rn.api.post({path:"/v1/fungible/price",body:{currency:"usd",addresses:t,projectId:se.state.projectId},headers:{"Content-Type":"application/json"}});return ce.updateTokenPriceCache({addresses:t,timestamp:Date.now(),tokenPrice:i}),i},async fetchSwapAllowance({tokenAddress:t,userAddress:e}){var n;return await Ve.isNetworkSupported((n=q.state.activeCaipNetwork)==null?void 0:n.caipNetworkId)?Ve.get({path:"/v1/convert/allowance",params:{tokenAddress:t,userAddress:e},headers:{"Content-Type":"application/json"}}):{allowance:"0"}},async fetchGasPrice({chainId:t}){var s;const{st:e,sv:r}=Ve.getSdkProperties();if(!await Ve.isNetworkSupported((s=q.state.activeCaipNetwork)==null?void 0:s.caipNetworkId))throw new Error("Network not supported for Gas Price");return Ve.get({path:"/v1/convert/gas-price",headers:{"Content-Type":"application/json"},params:{chainId:t,st:e,sv:r}})},async generateSwapCalldata({amount:t,from:e,to:r,userAddress:n,disableEstimate:s}){var o;if(!await Ve.isNetworkSupported((o=q.state.activeCaipNetwork)==null?void 0:o.caipNetworkId))throw new Error("Network not supported for Swaps");return Rn.api.post({path:"/v1/convert/build-transaction",headers:{"Content-Type":"application/json"},body:{amount:t,eip155:{slippage:lt.CONVERT_SLIPPAGE_TOLERANCE},projectId:se.state.projectId,from:e,to:r,userAddress:n,disableEstimate:s}})},async generateApproveCalldata({from:t,to:e,userAddress:r}){var o;const{st:n,sv:s}=Ve.getSdkProperties();if(!await Ve.isNetworkSupported((o=q.state.activeCaipNetwork)==null?void 0:o.caipNetworkId))throw new Error("Network not supported for Swaps");return Ve.get({path:"/v1/convert/build-approve",headers:{"Content-Type":"application/json"},params:{userAddress:r,from:t,to:e,st:n,sv:s}})},async getBalance(t,e,r){var u;const{st:n,sv:s}=Ve.getSdkProperties();if(!await Ve.isNetworkSupported((u=q.state.activeCaipNetwork)==null?void 0:u.caipNetworkId))return Bo.showError("Token Balance Unavailable"),{balances:[]};const o=`${e}:${t}`,a=ce.getBalanceCacheForCaipAddress(o);if(a)return a;const c=await Ve.get({path:`/v1/account/${t}/balance`,params:{currency:"usd",chainId:e,forceUpdate:r,st:n,sv:s}});return ce.updateBalanceCache({caipAddress:o,balance:c,timestamp:Date.now()}),c},async lookupEnsName(t){var r;return await Ve.isNetworkSupported((r=q.state.activeCaipNetwork)==null?void 0:r.caipNetworkId)?Ve.get({path:`/v1/profile/account/${t}`,params:{apiVersion:"2"}}):{addresses:{},attributes:[]}},async reverseLookupEnsName({address:t}){var n,s;if(!await Ve.isNetworkSupported((n=q.state.activeCaipNetwork)==null?void 0:n.caipNetworkId))return[];const r=(s=q.getAccountData())==null?void 0:s.address;return Ve.get({path:`/v1/profile/reverse/${t}`,params:{sender:r,apiVersion:"2"}})},async getEnsNameSuggestions(t){var r;return await Ve.isNetworkSupported((r=q.state.activeCaipNetwork)==null?void 0:r.caipNetworkId)?Ve.get({path:`/v1/profile/suggestions/${t}`,params:{zone:"reown.id"}}):{suggestions:[]}},async registerEnsName({coinType:t,address:e,message:r,signature:n}){var i;return await Ve.isNetworkSupported((i=q.state.activeCaipNetwork)==null?void 0:i.caipNetworkId)?Rn.api.post({path:"/v1/profile/account",body:{coin_type:t,address:e,message:r,signature:n},headers:{"Content-Type":"application/json"}}):{success:!1}},async generateOnRampURL({destinationWallets:t,partnerUserId:e,defaultNetwork:r,purchaseAmount:n,paymentAmount:s}){var a;return await Ve.isNetworkSupported((a=q.state.activeCaipNetwork)==null?void 0:a.caipNetworkId)?(await Rn.api.post({path:"/v1/generators/onrampurl",params:{projectId:se.state.projectId},body:{destinationWallets:t,defaultNetwork:r,partnerUserId:e,defaultExperience:"buy",presetCryptoAmount:n,presetFiatAmount:s}})).url:""},async getOnrampOptions(){var e;if(!await Ve.isNetworkSupported((e=q.state.activeCaipNetwork)==null?void 0:e.caipNetworkId))return{paymentCurrencies:[],purchaseCurrencies:[]};try{return await Ve.get({path:"/v1/onramp/options"})}catch{return CQ}},async getOnrampQuote({purchaseCurrency:t,paymentCurrency:e,amount:r,network:n}){var s;try{return await Ve.isNetworkSupported((s=q.state.activeCaipNetwork)==null?void 0:s.caipNetworkId)?await Rn.api.post({path:"/v1/onramp/quote",params:{projectId:se.state.projectId},body:{purchaseCurrency:t,paymentCurrency:e,amount:r,network:n}}):null}catch{return{networkFee:{amount:r,currency:e.id},paymentSubtotal:{amount:r,currency:e.id},paymentTotal:{amount:r,currency:e.id},purchaseAmount:{amount:r,currency:e.id},quoteId:"mocked-quote-id"}}},async getSmartSessions(t){var r;return await Ve.isNetworkSupported((r=q.state.activeCaipNetwork)==null?void 0:r.caipNetworkId)?Ve.get({path:`/v1/sessions/${t}`}):[]},async revokeSmartSession(t,e,r){var s;return await Ve.isNetworkSupported((s=q.state.activeCaipNetwork)==null?void 0:s.caipNetworkId)?Rn.api.post({path:`/v1/sessions/${t}/revoke`,params:{projectId:se.state.projectId},body:{pci:e,signature:r}}):{success:!1}},setClientId(t){Rn.clientId=t,Rn.api=new l0({baseUrl:ZL,clientId:t})}},IQ=Object.freeze({enabled:!0,events:[]}),SQ=new l0({baseUrl:be.getAnalyticsUrl(),clientId:null}),TQ=5,PQ=60*1e3,_c=rr({...IQ}),OQ={state:_c,subscribeKey(t,e){return cr(_c,t,e)},async sendError(t,e){if(!_c.enabled)return;const r=Date.now();if(_c.events.filter(i=>{const o=new Date(i.properties.timestamp||"").getTime();return r-o<PQ}).length>=TQ)return;const s={type:"error",event:e,properties:{errorType:t.name,errorMessage:t.message,stackTrace:t.stack,timestamp:new Date().toISOString()}};_c.events.push(s);try{if(typeof window>"u")return;const{projectId:i,sdkType:o,sdkVersion:a}=se.state;await SQ.post({path:"/e",params:{projectId:i,st:o,sv:a||"html-wagmi-4.2.2"},body:{eventId:be.getUUID(),url:window.location.href,domain:window.location.hostname,timestamp:new Date().toISOString(),props:{type:"error",event:e,errorType:t.name,errorMessage:t.message,stackTrace:t.stack}}})}catch{}},enable(){_c.enabled=!0},disable(){_c.enabled=!1},clearEvents(){_c.events=[]}};
8class Nd extends Error{constructor(e,r,n){super(e),this.originalName="AppKitError",this.name="AppKitError",this.category=r,this.originalError=n,n&&n instanceof Error&&(this.originalName=n.name),Object.setPrototypeOf(this,Nd.prototype);let s=!1;if(n instanceof Error&&typeof n.stack=="string"&&n.stack){const i=n.stack,o=i.indexOf(`
9`);if(o>-1){const a=i.substring(o+1);this.stack=`${this.name}: ${this.message}
10${a}`,s=!0}}s||(Error.captureStackTrace?Error.captureStackTrace(this,Nd):this.stack||(this.stack=`${this.name}: ${this.message}`))}}function Xx(t,e){let r="";try{t instanceof Error?r=t.message:typeof t=="string"?r=t:typeof t=="object"&&t!==null?Object.keys(t).length===0?r="Unknown error":r=(t==null?void 0:t.message)||JSON.stringify(t):r=String(t)}catch(s){r="Unknown error",console.error("Error parsing error message",s)}const n=t instanceof Nd?t:new Nd(r,e,t);throw OQ.sendError(n,n.category),n}function pi(t,e="INTERNAL_SDK_ERROR"){const r={};return Object.keys(t).forEach(n=>{const s=t[n];if(typeof s=="function"){let i=s;s.constructor.name==="AsyncFunction"?i=async(...o)=>{try{return await s(...o)}catch(a){return Xx(a,e)}}:i=(...o)=>{try{return s(...o)}catch(a){return Xx(a,e)}},r[n]=i}else r[n]=s}),r}const Ts=rr({walletImages:{},networkImages:{},chainImages:{},connectorImages:{},tokenImages:{},currencyImages:{}}),NQ={state:Ts,subscribeNetworkImages(t){return ln(Ts.networkImages,()=>t(Ts.networkImages))},subscribeKey(t,e){return cr(Ts,t,e)},subscribe(t){return ln(Ts,()=>t(Ts))},setWalletImage(t,e){Ts.walletImages[t]=e},setNetworkImage(t,e){Ts.networkImages[t]=e},setChainImage(t,e){Ts.chainImages[t]=e},setConnectorImage(t,e){Ts.connectorImages={...Ts.connectorImages,[t]:e}},setTokenImage(t,e){Ts.tokenImages[t]=e},setCurrencyImage(t,e){Ts.currencyImages[t]=e}},qs=pi(NQ),eR={eip155:"ba0ba0cd-17c6-4806-ad93-f9d174f17900",solana:"a1b58899-f671-4276-6a5e-56ca5bd59700",polkadot:"",bip122:"0b4838db-0161-4ffe-022d-532bf03dba00",cosmos:"",sui:"",stacks:"",ton:"20f673c0-095e-49b2-07cf-eb5049dcf600",tron:"3502bb86-cc4e-420f-a387-59ea63a28b00"},af=rr({networkImagePromises:{},tokenImagePromises:{}}),vu={async fetchWalletImage(t){if(t)return await Ae._fetchWalletImage(t),this.getWalletImageById(t)},async fetchNetworkImage(t){if(!t)return;const e=this.getNetworkImageById(t);return e||(af.networkImagePromises[t]||(af.networkImagePromises[t]=Ae._fetchNetworkImage(t)),await af.networkImagePromises[t],this.getNetworkImageById(t))},async fetchTokenImage(t){if(t)return af.tokenImagePromises[t]||(af.tokenImagePromises[t]=Ae._fetchTokenImage(t)),await af.tokenImagePromises[t],this.getTokenImage(t)},getWalletImageById(t){if(t)return qs.state.walletImages[t]},getWalletImage(t){if(t!=null&&t.image_url)return t==null?void 0:t.image_url;if(t!=null&&t.image_id)return qs.state.walletImages[t.image_id]},getNetworkImage(t){var e,r,n;if((e=t==null?void 0:t.assets)!=null&&e.imageUrl)return(r=t==null?void 0:t.assets)==null?void 0:r.imageUrl;if((n=t==null?void 0:t.assets)!=null&&n.imageId)return qs.state.networkImages[t.assets.imageId]},getNetworkImageById(t){if(t)return qs.state.networkImages[t]},getConnectorImage(t){var e;if(t!=null&&t.imageUrl)return t.imageUrl;if((e=t==null?void 0:t.info)!=null&&e.icon)return t.info.icon;if(t!=null&&t.imageId)return qs.state.connectorImages[t.imageId]},getChainImage(t){return qs.state.networkImages[eR[t]]},getTokenImage(t){if(t)return qs.state.tokenImages[t]},getWalletImageUrl(t){if(!t)return"";const{projectId:e,sdkType:r,sdkVersion:n}=se.state,s=new URL(`${Y.W3M_API_URL}/getWalletImage/${t}`);return s.searchParams.set("projectId",e),s.searchParams.set("st",r),s.searchParams.set("sv",n),s.toString()},getAssetImageUrl(t){if(!t)return"";const{projectId:e,sdkType:r,sdkVersion:n}=se.state,s=new URL(`${Y.W3M_API_URL}/public/getAssetImage/${t}`);return s.searchParams.set("projectId",e),s.searchParams.set("st",r),s.searchParams.set("sv",n),s.toString()},getChainNamespaceImageUrl(t){return this.getAssetImageUrl(eR[t])},async getImageByToken(t,e){if(t==="native"){const n=Y.NATIVE_IMAGE_IDS_BY_NAMESPACE[e]??null;return n?vu.fetchNetworkImage(n):void 0}const[,r]=Object.entries(Y.TOKEN_SYMBOLS_BY_ADDRESS).find(([n])=>n.toLowerCase()===t.toLowerCase())??[];if(r)return vu.fetchTokenImage(r)}},Dr={PHANTOM:{id:"a797aa35c0fadbfc1a53e7f675162ed5226968b44a19ee3d24385c64d1d3c393",url:"https://phantom.app",androidPackage:"app.phantom"},SOLFLARE:{id:"1ca0bdd4747578705b1939af023d120677c64fe6ca76add81fda36e350605e79",url:"https://solflare.com"},COINBASE:{id:"d0ca99ff52b99abc48743dad0f7fc891e041be73574f7fac4afe5d4bb83845c8",url:"https://go.cb-w.com",evmDeeplink:"cbwallet://miniapp"},BINANCE:{id:"2fafea35bb471d22889ccb49c08d99dd0a18a37982602c33f696a5723934ba25",appId:"yFK5FCqYprrXDiVFbhyRx7",deeplink:"bnc://app.binance.com/mp/app",url:"https://app.binance.com/en/download"}},YL={isCustomDeeplinkWallet(t,e){return t===Dr.PHANTOM.id?e===Y.CHAIN.SOLANA||e===Y.CHAIN.EVM||e===Y.CHAIN.BITCOIN:t===Dr.SOLFLARE.id?e===Y.CHAIN.SOLANA:t===Dr.COINBASE.id?e===Y.CHAIN.SOLANA||e===Y.CHAIN.EVM:t===Dr.BINANCE.id?e===Y.CHAIN.BITCOIN:!1}
10,handleMobileDeeplinkRedirect(t,e,r){const n=window.location.href,s=encodeURIComponent(n),i=(r==null?void 0:r.isCoinbaseDisabled)??!1;if(t===Dr.PHANTOM.id&&!("phantom"in window)){const o=n.startsWith("https")?"https":"http",a=n.split("/")[2],c=encodeURIComponent(`${o}://${a}`),u=`${Dr.PHANTOM.url}/ul/browse/${s}?ref=${c}`;if(be.isAndroid()){const l=`intent://browse/${s}?ref=${c}#Intent;scheme=phantom;package=${Dr.PHANTOM.androidPackage};end`;window.location.href=l}else window.location.href=u}if(t===Dr.SOLFLARE.id&&e===Y.CHAIN.SOLANA&&!("solflare"in window)&&(window.location.href=`${Dr.SOLFLARE.url}/ul/v1/browse/${s}?ref=${s}`),e===Y.CHAIN.SOLANA&&t===Dr.COINBASE.id&&(i||!("coinbaseSolana"in window))&&(window.location.href=`${Dr.COINBASE.url}/dapp?cb_url=${s}`),e===Y.CHAIN.EVM&&t===Dr.COINBASE.id&&(i||!("coinbaseWalletExtension"in window))&&(window.location.href=`${Dr.COINBASE.evmDeeplink}?url=${s}`),e===Y.CHAIN.BITCOIN&&t===Dr.BINANCE.id&&!("binancew3w"in window)){const o=q.state.activeCaipNetwork,a=window.btoa("/pages/browser/index"),c=window.btoa(`url=${s}&defaultChainId=${(o==null?void 0:o.id)??1}`),u=new URL(Dr.BINANCE.deeplink);u.searchParams.set("appId",Dr.BINANCE.appId),u.searchParams.set("startPagePath",a),u.searchParams.set("startPageQuery",c);const l=new URL(Dr.BINANCE.url);l.searchParams.set("_dp",window.btoa(u.toString())),window.location.href=l.toString()}}},xQ=be.getAnalyticsUrl(),RQ=new l0({baseUrl:xQ,clientId:null}),BQ=["MODAL_CREATED"],kQ=45,tR=1e3*10,mr=rr({timestamp:Date.now(),lastFlush:Date.now(),reportedErrors:{},data:{type:"track",event:"MODAL_CREATED"},pendingEvents:[],subscribedToVisibilityChange:!1,walletImpressions:[]}),Xe={state:mr,subscribe(t){return ln(mr,()=>t(mr))},getSdkProperties(){const{projectId:t,sdkType:e,sdkVersion:r}=se.state;return{projectId:t,st:e,sv:r||"html-wagmi-4.2.2"}},shouldFlushEvents(){const t=JSON.stringify(mr.pendingEvents).length/1024>kQ,e=mr.lastFlush+tR<Date.now();return t||e},_setPendingEvent(t){var e,r;try{let n=(e=q.getAccountData())==null?void 0:e.address;if("address"in t.data&&t.data.address&&(n=t.data.address),BQ.includes(t.data.event)||typeof window>"u")return;const s=(r=q.getActiveCaipNetwork())==null?void 0:r.caipNetworkId;this.state.pendingEvents.push({eventId:be.getUUID(),url:window.location.href,domain:window.location.hostname,timestamp:t.timestamp,props:{...t.data,address:n,properties:{..."properties"in t.data?t.data.properties:{},caipNetworkId:s}}}),mr.reportedErrors.FORBIDDEN=!1,Xe.shouldFlushEvents()&&Xe._submitPendingEvents()}catch(n){console.warn("_setPendingEvent",n)}},sendEvent(t){var r;mr.timestamp=Date.now(),mr.data=t;const e=["INITIALIZE","CONNECT_SUCCESS","SOCIAL_LOGIN_SUCCESS"];((r=se.state.features)!=null&&r.analytics||e.includes(t.event))&&Xe._setPendingEvent(mr),this.subscribeToFlushTriggers()},sendWalletImpressionEvent(t){mr.walletImpressions.push(t)},_transformPendingEventsForBatch(t){try{return t.filter(e=>e.props.event!=="WALLET_IMPRESSION_V2")}catch{return t}},_submitPendingEvents(){if(mr.lastFlush=Date.now(),!(mr.pendingEvents.length===0&&mr.walletImpressions.length===0))try{const t=Xe._transformPendingEventsForBatch(mr.pendingEvents);mr.walletImpressions.length&&t.push({eventId:be.getUUID(),url:window.location.href,domain:window.location.hostname,timestamp:Date.now(),props:{type:"track",event:"WALLET_IMPRESSION_V2",items:[...mr.walletImpressions]}}),RQ.sendBeacon({path:"/batch",params:Xe.getSdkProperties(),body:t}),mr.reportedErrors.FORBIDDEN=!1,mr.pendingEvents=[],mr.walletImpressions=[]}catch{mr.reportedErrors.FORBIDDEN=!0}},subscribeToFlushTriggers(){var t,e,r;mr.subscribedToVisibilityChange||typeof document>"u"||(mr.subscribedToVisibilityChange=!0,(t=document==null?void 0:document.addEventListener)==null||t.call(document,"visibilitychange",()=>{document.visibilityState==="hidden"&&Xe._submitPendingEvents()}),(e=document==null?void 0:document.addEventListener)==null||e.call(document,"freeze",()=>{Xe._submitPendingEvents()}),(r=window==null?void 0:window.addEventListener)==null||r.call(window,"pagehide",()=>{Xe._submitPendingEvents()}),setInterval(()=>{Xe._submitPendingEvents()},tR))}},jQ=be.getApiUrl(),Bn=new l0({baseUrl:jQ,clientId:null}),DQ=40,rR=4,UQ=20,Ze=rr({promises:{},page:1,count:0,featured:[],allFeatured:[],recommended:[],allRecommended:[],wallets:[],filteredWallets:[],search:[],isAnalyticsEnabled:!1,excludedWallets:[],isFetchingRecommendedWallets:!1,explorerWallets:[],explorerFilteredWallets:[],plan:{tier:"none",hasExceededUsageLimit:!1,limits:{isAboveRpcLim
10it:!1,isAboveMauLimit:!1}}}),Ae={state:Ze,subscribeKey(t,e){return cr(Ze,t,e)},_getSdkProperties(){const{projectId:t,sdkType:e,sdkVersion:r}=se.state;return{projectId:t,st:e||"appkit",sv:r||"html-wagmi-4.2.2"}},_filterOutExtensions(t){return se.state.isUniversalProvider?t.filter(e=>!!(e.mobile_link||e.desktop_link||e.webapp_link)):t},async _fetchWalletImage(t){const e=`${Bn.baseUrl}/getWalletImage/${t}`,r=await Bn.getBlob({path:e,params:Ae._getSdkProperties()});qs.setWalletImage(t,URL.createObjectURL(r))},async _fetchNetworkImage(t){const e=`${Bn.baseUrl}/public/getAssetImage/${t}`,r=await Bn.getBlob({path:e,params:Ae._getSdkProperties()});qs.setNetworkImage(t,URL.createObjectURL(r))},async _fetchConnectorImage(t){const e=`${Bn.baseUrl}/public/getAssetImage/${t}`,r=await Bn.getBlob({path:e,params:Ae._getSdkProperties()});qs.setConnectorImage(t,URL.createObjectURL(r))},async _fetchCurrencyImage(t){const e=`${Bn.baseUrl}/public/getCurrencyImage/${t}`,r=await Bn.getBlob({path:e,params:Ae._getSdkProperties()});qs.setCurrencyImage(t,URL.createObjectURL(r))},async _fetchTokenImage(t){const e=`${Bn.baseUrl}/public/getTokenImage/${t}`,r=await Bn.getBlob({path:e,params:Ae._getSdkProperties()});qs.setTokenImage(t,URL.createObjectURL(r))},_filterWalletsByPlatform(t){const e=t.length,r=be.isMobile()?t==null?void 0:t.filter(s=>s.mobile_link||s.webapp_link?!0:Object.values(Dr).map(o=>o.id).includes(s.id)):t,n=e-r.length;return{filteredWallets:r,mobileFilteredOutWalletsLength:n}},async fetchProjectConfig(){return(await Bn.get({path:"/appkit/v1/config",params:Ae._getSdkProperties()})).features},async fetchUsage(){try{const t=await Bn.get({path:"/appkit/v1/project-limits",params:Ae._getSdkProperties()}),{tier:e,isAboveMauLimit:r,isAboveRpcLimit:n}=t.planLimits,s=e==="starter",i=r||n;Ae.state.plan={tier:e,hasExceededUsageLimit:s&&i,limits:{isAboveRpcLimit:n,isAboveMauLimit:r}}}catch(t){console.warn("Failed to fetch usage",t)}},async fetchAllowedOrigins(){try{const{allowedOrigins:t}=await Bn.get({path:"/projects/v1/origins",params:Ae._getSdkProperties()});return t}catch(t){if(t instanceof Error&&t.cause instanceof Response){const e=t.cause.status;if(e===Y.HTTP_STATUS_CODES.TOO_MANY_REQUESTS)throw new Error("RATE_LIMITED",{cause:t});if(e>=Y.HTTP_STATUS_CODES.SERVER_ERROR&&e<600)throw new Error("SERVER_ERROR",{cause:t});return[]}return[]}},async fetchNetworkImages(){const t=q.getAllRequestedCaipNetworks(),e=t==null?void 0:t.map(({assets:r})=>r==null?void 0:r.imageId).filter(Boolean).filter(r=>!vu.getNetworkImageById(r));e&&await Promise.allSettled(e.map(r=>Ae._fetchNetworkImage(r)))},async fetchConnectorImages(){const{connectors:t}=pe.state,e=t.map(({imageId:r})=>r).filter(Boolean);await Promise.allSettled(e.map(r=>Ae._fetchConnectorImage(r)))},async fetchCurrencyImages(t=[]){await Promise.allSettled(t.map(e=>Ae._fetchCurrencyImage(e)))},async fetchTokenImages(t=[]){await Promise.allSettled(t.map(e=>Ae._fetchTokenImage(e)))},async fetchWallets(t){var o;const e=t.exclude??[];Ae._getSdkProperties().sv.startsWith("html-core-")&&e.push(...Object.values(Dr).map(a=>a.id));const n=await Bn.get({path:"/getWallets",params:{...Ae._getSdkProperties(),...t,page:String(t.page),entries:String(t.entries),include:((o=t.include)==null?void 0:o.join(","))||void 0,exclude:e.join(",")||void 0,include_pay_only:t.include_pay_only?"true":void 0}}),{filteredWallets:s,mobileFilteredOutWalletsLength:i}=Ae._filterWalletsByPlatform(n==null?void 0:n.data);return{data:s||[],count:n==null?void 0:n.count,mobileFilteredOutWalletsLength:i}},async prefetchWalletRanks(){const t=pe.state.connectors;if(!(t!=null&&t.length))return;const e={page:1,entries:20,badge:"certified"};if(e.names=t.map(s=>s.name).join(","),q.state.activeChain===Y.CHAIN.EVM){const s=[...t.flatMap(i=>{var o;return((o=i.connectors)==null?void 0:o.map(a=>{var c;return(c=a.info)==null?void 0:c.rdns}))||[]}),...t.map(i=>{var o;return(o=i.info)==null?void 0:o.rdns})].filter(i=>typeof i=="string"&&i.length>0);s.length&&(e.rdns=s.join(","))}const{data:r}=await Ae.fetchWallets(e);Ze.explorerWallets=r,pe.extendConnectorsWithExplorerWallets(r);const n=q.getRequestedCaipNetworkIds().join(",");Ze.explorerFilteredWallets=r.filter(s=>{var i;return(i=s.chains)==null?void 0:i.some(o=>n.includes(o))})},async fetchFeaturedWallets(){const{featuredWalletIds:t}=se.state;if(t!=null&&t.length){const e={...Ae._getSdkProperties(),page:1,entries:(t==null?void 0:t.length)??rR,include:t},{data:r}=await Ae.fetchWallets(e),n=[...r].sort((i,o)=>t.indexOf(i.id)-t.indexOf(o.id)),s=n.map(i=>
10i.image_id).filter(Boolean);await Promise.allSettled(s.map(i=>Ae._fetchWalletImage(i))),Ze.featured=n,Ze.allFeatured=n}},async fetchRecommendedWallets(){try{Ze.isFetchingRecommendedWallets=!0;const{includeWalletIds:t,excludeWalletIds:e,featuredWalletIds:r}=se.state,n=[...e??[],...r??[]].filter(Boolean),s=q.getRequestedCaipNetworkIds().join(","),i={page:1,entries:rR,include:t,exclude:n,chains:s},{data:o,count:a}=await Ae.fetchWallets(i),c=ce.getRecentWallets(),u=o.map(d=>d.image_id).filter(Boolean),l=c.map(d=>d.image_id).filter(Boolean);await Promise.allSettled([...u,...l].map(d=>Ae._fetchWalletImage(d))),Ze.recommended=o,Ze.allRecommended=o,Ze.count=a??0}catch{}finally{Ze.isFetchingRecommendedWallets=!1}},async fetchWalletsByPage({page:t,entries:e,badge:r,include:n,exclude:s,includePayOnly:i,sort:o}){const{includeWalletIds:a,excludeWalletIds:c,featuredWalletIds:u}=se.state,l=q.getRequestedCaipNetworkIds().join(","),d=[...Ze.recommended.map(({id:w})=>w),...c??[],...u??[]].filter(Boolean),f={page:t,entries:e??DQ,include:n??a,exclude:s??d,badge_type:r,include_pay_only:i,sort:o,chains:l},{data:g,count:h,mobileFilteredOutWalletsLength:p}=await Ae.fetchWallets(f);Ze.mobileFilteredOutWalletsLength=p+(Ze.mobileFilteredOutWalletsLength??0);const y=g.slice(0,UQ).map(w=>w.image_id).filter(Boolean);await Promise.allSettled(y.map(w=>Ae._fetchWalletImage(w))),Ze.wallets=be.uniqueBy([...Ze.wallets,...Ae._filterOutExtensions(g)],"id").filter(w=>{var I;return(I=w.chains)==null?void 0:I.some(v=>l.includes(v))}),Ze.count=h>Ze.count?h:Ze.count,Ze.page=t},async initializeExcludedWallets({ids:t}){const e={page:1,entries:t.length,include:t},{data:r}=await Ae.fetchWallets(e);r&&r.forEach(n=>{Ze.excludedWallets.push({rdns:n.rdns,name:n.name})})},async searchWallet({search:t,badge:e,entries:r,page:n,include:s,exclude:i,includePayOnly:o,sort:a}){const{includeWalletIds:c,excludeWalletIds:u}=se.state,l=q.getRequestedCaipNetworkIds().join(",");Ze.search=[];const d={page:n??1,entries:r??100,search:(t==null?void 0:t.trim())||void 0,badge_type:e,include:s??c,exclude:i??u,include_pay_only:o,sort:a,chains:l},{data:f}=await Ae.fetchWallets(d);Xe.sendEvent({type:"track",event:"SEARCH_WALLET",properties:{badge:e??"",search:t??""}});const g=f.map(h=>h.image_id).filter(Boolean);await Promise.allSettled([...g.map(h=>Ae._fetchWalletImage(h)),be.wait(300)]),Ze.search=Ae._filterOutExtensions(f)},initPromise(t,e){const r=Ze.promises[t];return r||(Ze.promises[t]=e())},prefetch({fetchConnectorImages:t=!0,fetchFeaturedWallets:e=!0,fetchRecommendedWallets:r=!0,fetchNetworkImages:n=!0,fetchWalletRanks:s=!0}={}){const i=[t&&Ae.initPromise("connectorImages",Ae.fetchConnectorImages),e&&Ae.initPromise("featuredWallets",Ae.fetchFeaturedWallets),r&&Ae.initPromise("recommendedWallets",Ae.fetchRecommendedWallets),n&&Ae.initPromise("networkImages",Ae.fetchNetworkImages),s&&Ae.initPromise("walletRanks",Ae.prefetchWalletRanks)].filter(Boolean);return Promise.allSettled(i)},prefetchAnalyticsConfig(){var t;(t=se.state.features)!=null&&t.analytics&&Ae.fetchAnalyticsConfig()},async fetchAnalyticsConfig(){try{const{isAnalyticsEnabled:t}=await Bn.get({path:"/getAnalyticsConfig",params:Ae._getSdkProperties()});se.setFeatures({analytics:t})}catch{se.setFeatures({analytics:!1})}},filterByNamespaces(t){if(!(t!=null&&t.length)){Ze.featured=Ze.allFeatured,Ze.recommended=Ze.allRecommended;return}const e=q.getRequestedCaipNetworkIds().join(",");Ze.featured=Ze.allFeatured.filter(r=>{var n;return(n=r.chains)==null?void 0:n.some(s=>e.includes(s))}),Ze.recommended=Ze.allRecommended.filter(r=>{var n;return(n=r.chains)==null?void 0:n.some(s=>e.includes(s))}),Ze.filteredWallets=Ze.wallets.filter(r=>{var n;return(n=r.chains)==null?void 0:n.some(s=>e.includes(s))})},clearFilterByNamespaces(){Ze.filteredWallets=[]},setFilterByNamespace(t){if(!t){Ze.featured=Ze.allFeatured,Ze.recommended=Ze.allRecommended;return}const e=q.getRequestedCaipNetworkIds().join(",");Ze.featured=Ze.allFeatured.filter(r=>{var n;return(n=r.chains)==null?void 0:n.some(s=>e.includes(s))}),Ze.recommended=Ze.allRecommended.filter(r=>{var n;return(n=r.chains)==null?void 0:n.some(s=>e.includes(s))}),Ze.filteredWallets=Ze.wallets.filter(r=>{var n;return(n=r.chains)==null?void 0:n.some(s=>e.includes(s))})}},Ja={filterOutDuplicatesByRDNS(t){const e=pe.state.connectors,r=ce.getRecentWallets(),n=e.map(a=>{var c;return(c=a.info)==null?void 0:c.rdns}
10).filter(Boolean),s=r.map(a=>a.rdns).filter(Boolean),i=n.concat(s);if(i.includes("io.metamask.mobile")&&be.isMobile()){const a=i.indexOf("io.metamask.mobile");i[a]="io.metamask"}return t.filter(a=>!(a!=null&&a.rdns&&i.includes(String(a.rdns))||!(a!=null&&a.rdns)&&e.some(u=>u.name===a.name)))},filterOutDuplicatesByIds(t){const e=pe.state.connectors.filter(a=>a.type==="ANNOUNCED"||a.type==="INJECTED"||a.type==="MULTI_CHAIN"),r=ce.getRecentWallets(),n=e.map(a=>{var c;return a.explorerId||((c=a.explorerWallet)==null?void 0:c.id)||a.id}),s=r.map(a=>a.id),i=n.concat(s);return t.filter(a=>!i.includes(a==null?void 0:a.id))},filterOutDuplicateWallets(t){const e=this.filterOutDuplicatesByRDNS(t);return this.filterOutDuplicatesByIds(e)},markWalletsAsInstalled(t){const{connectors:e}=pe.state,{featuredWalletIds:r}=se.state,n=e.filter(o=>o.type==="ANNOUNCED").reduce((o,a)=>{var c;return(c=a.info)!=null&&c.rdns&&(o[a.info.rdns]=!0),o},{});return t.map(o=>({...o,installed:!!o.rdns&&!!n[o.rdns??""]})).sort((o,a)=>{const c=Number(a.installed)-Number(o.installed);if(c!==0)return c;if(r!=null&&r.length){const u=r.indexOf(o.id),l=r.indexOf(a.id);if(u!==-1&&l!==-1)return u-l;if(u!==-1)return-1;if(l!==-1)return 1}return 0})},getConnectOrderMethod(t,e){var c;const r=(t==null?void 0:t.connectMethodsOrder)||((c=se.state.features)==null?void 0:c.connectMethodsOrder),n=e||pe.state.connectors;if(r)return r;const{injected:s,announced:i}=an.getConnectorsByType(n,Ae.state.recommended,Ae.state.featured),o=s.filter(an.showConnector),a=i.filter(an.showConnector);return o.length||a.length?["wallet","email","social"]:lt.DEFAULT_CONNECT_METHOD_ORDER},isExcluded(t){const e=!!t.rdns&&Ae.state.excludedWallets.some(n=>n.rdns===t.rdns),r=!!t.name&&Ae.state.excludedWallets.some(n=>Y$.isLowerCaseMatch(n.name,t.name));return e||r},markWalletsWithDisplayIndex(t){return t.map((e,r)=>({...e,display_index:r}))},filterWalletsByWcSupport(t){return me.state.wcBasic?t.filter(e=>e.supports_wc):be.isMobile()?t.filter(e=>e.supports_wc||lt.MANDATORY_WALLET_IDS_ON_MOBILE.includes(e.id)):t},getWalletConnectWallets(t){var i;const e=[...Ae.state.featured,...Ae.state.recommended];((i=Ae.state.filteredWallets)==null?void 0:i.length)>0?e.push(...Ae.state.filteredWallets):e.push(...t);const r=be.uniqueBy(e,"id"),n=Ja.markWalletsAsInstalled(r),s=Ja.filterWalletsByWcSupport(n);return Ja.markWalletsWithDisplayIndex(s)}},an={getConnectorsByType(t,e,r){const{customWallets:n}=se.state,s=ce.getRecentWallets(),i=Ja.filterOutDuplicateWallets(e),o=Ja.filterOutDuplicateWallets(r),a=t.filter(d=>d.type==="MULTI_CHAIN"),c=t.filter(d=>d.type==="ANNOUNCED"),u=t.filter(d=>d.type==="INJECTED"),l=t.filter(d=>d.type==="EXTERNAL");return{custom:n,recent:s,external:l,multiChain:a,announced:c,injected:u,recommended:i,featured:o}},showConnector(t){var a,c;const e=(a=t.info)==null?void 0:a.rdns,r=!!e&&Ae.state.excludedWallets.some(u=>!!u.rdns&&u.rdns===e),n=!!t.name&&Ae.state.excludedWallets.some(u=>Y$.isLowerCaseMatch(u.name,t.name));if(t.type==="INJECTED"&&(t.name==="Browser Wallet"&&(!be.isMobile()||be.isMobile()&&!e&&!me.checkInstalled())||r||n)||(t.type==="ANNOUNCED"||t.type==="EXTERNAL")&&(r||n))return!1;const{includeWalletIds:s,excludeWalletIds:i}=se.state;if(t.type==="INJECTED"||t.type==="ANNOUNCED"||t.type==="MULTI_CHAIN"){const u=t.explorerId||((c=t.explorerWallet)==null?void 0:c.id);if(i!=null&&i.length&&u&&i.includes(u)||s!=null&&s.length&&(!u||!s.includes(u)))return!1}return!0},getIsConnectedWithWC(){return Array.from(q.state.chains.values()).some(r=>pe.getConnectorId(r.namespace)===Y.CONNECTOR_ID.WALLET_CONNECT)},getConnectorTypeOrder({recommended:t,featured:e,custom:r,recent:n,announced:s,injected:i,multiChain:o,external:a,overriddenConnectors:c=(u=>(u=se.state.features)==null?void 0:u.connectorTypeOrder)()??[]}){const d=[{type:"walletConnect",isEnabled:!0},{type:"recent",isEnabled:n.length>0},{type:"injected",isEnabled:[...i,...s,...o].length>0},{type:"featured",isEnabled:e.length>0},{type:"custom",isEnabled:r&&r.length>0},{type:"external",isEnabled:a.length>0},{type:"recommended",isEnabled:t.length>0}].filter(p=>p.isEnabled),f=new Set(d.map(p=>p.type)),g=c.filter(p=>f.has(p)).map(p=>({type:p,isEnabled:!0})),h=d.filter(({type:p})=>!g.some(({type:w})=>w===p));return Array.from(new Set([...g,...h].map(({type:p})=>p)))},sortConnectorsByExplorerWallet(t){return[...t].sort((e,r)=>e.explorerWallet&&r.explorerWallet?(e.explorerWallet.order??0)-(r.explorerWallet.order??0):e.explorerWallet?-1:r.explorerWallet?1:0)},getPriority(t){return t.id===Y.CONNECTOR_ID.BASE_ACCOUNT?0:t.id===Y.CONNECTOR_ID.COINBASE||t.id===Y.CONNECTOR_ID.COINBASE_SDK?1:2},sortConnectorsByPriority(t){return[...t].sort((e,r)=>
10an.getPriority(e)-an.getPriority(r))},getAuthName({email:t,socialUsername:e,socialProvider:r}){return e?r&&r==="discord"&&e.endsWith("0")?e.slice(0,-1):e:t.length>30?`${t.slice(0,-3)}...`:t},async fetchProviderData(t){var e,r;try{if(t.name==="Browser Wallet"&&!be.isMobile())return{accounts:[],chainId:void 0};if(t.id===Y.CONNECTOR_ID.AUTH)return{accounts:[],chainId:void 0};const[n,s]=await Promise.all([(e=t.provider)==null?void 0:e.request({method:"eth_accounts"}),(r=t.provider)==null?void 0:r.request({method:"eth_chainId"}).then(i=>Number(i))]);return{accounts:n,chainId:s}}catch(n){return console.warn(`Failed to fetch provider data for ${t.name}`,n),{accounts:[],chainId:void 0}}},getFilteredCustomWallets(t){const e=ce.getRecentWallets(),r=pe.state.connectors.map(o=>{var a;return(a=o.info)==null?void 0:a.rdns}).filter(Boolean),n=e.map(o=>o.rdns).filter(Boolean),s=r.concat(n);if(s.includes("io.metamask.mobile")&&be.isMobile()){const o=s.indexOf("io.metamask.mobile");s[o]="io.metamask"}return t.filter(o=>!s.includes(String(o==null?void 0:o.rdns)))},hasWalletConnector(t){return pe.state.connectors.some(e=>e.id===t.id||e.name===t.name)},isWalletCompatibleWithCurrentChain(t){const e=q.state.activeChain;return e&&t.chains?t.chains.some(r=>{const n=r.split(":")[0];return e===n}):!0},getFilteredRecentWallets(){return ce.getRecentWallets().filter(r=>!Ja.isExcluded(r)).filter(r=>!this.hasWalletConnector(r)).filter(r=>this.isWalletCompatibleWithCurrentChain(r))},getCappedRecommendedWallets(t){const{connectors:e}=pe.state,{customWallets:r,featuredWalletIds:n}=se.state,s=e.find(I=>I.id==="walletConnect"),i=e.filter(I=>I.type==="INJECTED"||I.type==="ANNOUNCED"||I.type==="MULTI_CHAIN");if(!s&&!i.length&&!(r!=null&&r.length))return[];const o=nT.isEmailEnabled(),a=nT.isSocialsEnabled(),c=i.filter(I=>I.name!=="Browser Wallet"&&I.name!=="WalletConnect"),u=(n==null?void 0:n.length)||0,l=(r==null?void 0:r.length)||0,d=c.length||0,f=o?1:0,g=a?1:0,h=u+l+d+f+g,y=Math.max(0,4-h);return y<=0?[]:Ja.filterOutDuplicateWallets(t).slice(0,y)},processConnectorsByType(t,e=!0){const r=an.sortConnectorsByExplorerWallet([...t]);return e?r.filter(an.showConnector):r},connectorList(){const t=an.getConnectorsByType(pe.state.connectors,Ae.state.recommended,Ae.state.featured),e=this.processConnectorsByType(t.announced.filter(g=>g.id!=="walletConnect")),r=this.processConnectorsByType(t.injected),n=this.processConnectorsByType(t.multiChain.filter(g=>g.name!=="WalletConnect"),!1),s=t.custom,i=t.recent,o=this.processConnectorsByType(t.external.filter(g=>g.id!==Y.CONNECTOR_ID.COINBASE_SDK&&g.id!==Y.CONNECTOR_ID.BASE_ACCOUNT)),a=t.recommended,c=t.featured,u=an.getConnectorTypeOrder({custom:s,recent:i,announced:e,injected:r,multiChain:n,recommended:a,featured:c,external:o}),l=pe.state.connectors.find(g=>g.id==="walletConnect"),d=be.isMobile(),f=[];for(const g of u)switch(g){case"walletConnect":{!d&&l&&f.push({kind:"connector",subtype:"walletConnect",connector:l});break}case"recent":{an.getFilteredRecentWallets().forEach(p=>f.push({kind:"wallet",subtype:"recent",wallet:p}));break}case"injected":{n.forEach(h=>f.push({kind:"connector",subtype:"multiChain",connector:h})),e.forEach(h=>f.push({kind:"connector",subtype:"announced",connector:h})),r.forEach(h=>f.push({kind:"connector",subtype:"injected",connector:h}));break}
10case"featured":{c.forEach(h=>f.push({kind:"wallet",subtype:"featured",wallet:h}));break}case"custom":{an.getFilteredCustomWallets(s??[]).forEach(p=>f.push({kind:"wallet",subtype:"custom",wallet:p}));break}case"external":{o.forEach(h=>f.push({kind:"connector",subtype:"external",connector:h}));break}case"recommended":{an.getCappedRecommendedWallets(a).forEach(p=>f.push({kind:"wallet",subtype:"recommended",wallet:p}));break}default:console.warn(`Unknown connector type: ${g}`)}return f},hasInjectedConnectors(){return pe.state.connectors.filter(t=>(t.type==="INJECTED"||t.type==="ANNOUNCED"||t.type==="MULTI_CHAIN")&&t.name!=="Browser Wallet"&&t.name!=="WalletConnect").length}},MQ=["ConnectingExternal","ConnectingMultiChain","ConnectingSocial","ConnectingFarcaster"],Rt=rr({view:"Connect",history:["Connect"],transactionStack:[]}),$Q={state:Rt,subscribeKey(t,e){return cr(Rt,t,e)},pushTransactionStack(t){Rt.transactionStack.push(t)},popTransactionStack(t){const e=Rt.transactionStack.pop();if(!e)return;const{onSuccess:r,onError:n,onCancel:s}=e;switch(t){case"success":r==null||r();break;case"error":n==null||n(),Fe.goBack();break;case"cancel":s==null||s(),Fe.goBack();break}},push(t,e){let r=t,n=e;Ae.state.plan.hasExceededUsageLimit&&MQ.includes(t)&&(r="UsageExceeded",n=void 0),r!==Rt.view&&(Rt.view=r,Rt.history.push(r),Rt.data=n)},reset(t,e){Rt.view=t,Rt.history=[t],Rt.data=e},replace(t,e){Rt.history.at(-1)===t||(Rt.view=t,Rt.history[Rt.history.length-1]=t,Rt.data=e)},goBack(){var n,s;const t=q.state.activeCaipAddress,e=Fe.state.view==="ConnectingFarcaster",r=!t&&e;if(Rt.history.length>1){Rt.history.pop();const[i]=Rt.history.slice(-1);i&&(t&&i==="Connect"?Rt.view="Account":Rt.view=i)}else ft.close();(n=Rt.data)!=null&&n.wallet&&(Rt.data.wallet=void 0),(s=Rt.data)!=null&&s.redirectView&&(Rt.data.redirectView=void 0),setTimeout(()=>{var i,o,a;if(r){q.setAccountProp("farcasterUrl",void 0,q.state.activeChain);const c=pe.getAuthConnector();(i=c==null?void 0:c.provider)==null||i.reload();const u=qm(se.state);(a=(o=c==null?void 0:c.provider)==null?void 0:o.syncDappData)==null||a.call(o,{metadata:u.metadata,sdkVersion:u.sdkVersion,projectId:u.projectId,sdkType:u.sdkType})}},100)},goBackToIndex(t){if(Rt.history.length>1){Rt.history=Rt.history.slice(0,t+1);const[e]=Rt.history.slice(-1);e&&(Rt.view=e)}},goBackOrCloseModal(){Fe.state.history.length>1?Fe.goBack():ft.close()}},Fe=pi($Q),Yo=rr({themeMode:"dark",themeVariables:{},w3mThemeVariables:void 0}),sT={state:Yo,subscribe(t){return ln(Yo,()=>t(Yo))},setThemeMode(t){Yo.themeMode=t;try{const e=pe.getAuthConnector();if(e){const r=sT.getSnapshot().themeVariables;e.provider.syncTheme({themeMode:t,themeVariables:r,w3mThemeVariables:Wm(r,t)})}}catch{console.info("Unable to sync theme to auth connector")}},setThemeVariables(t){Yo.themeVariables={...Yo.themeVariables,...t};try{const e=pe.getAuthConnector();if(e){const r=sT.getSnapshot().themeVariables;e.provider.syncTheme({themeVariables:r,w3mThemeVariables:Wm(Yo.themeVariables,Yo.themeMode)})}}catch{console.info("Unable to sync theme to auth connector")}},getSnapshot(){return qm(Yo)}},ds=pi(sT),JL=Object.fromEntries(J$.map(t=>[t,void 0])),LQ=Object.fromEntries(J$.map(t=>[t,!0])),Et=rr({allConnectors:[],connectors:[],activeConnector:void 0,filterByNamespace:void 0,activeConnectorIds:JL,filterByNamespaceMap:LQ}),FQ={state:Et,subscribe(t){return ln(Et,()=>{t(Et)})},subscribeKey(t,e){return cr(Et,t,e)},initialize(t){t.forEach(e=>{const r=ce.getConnectedConnectorId(e);r&&pe.setConnectorId(r,e)})},setActiveConnector(t){t&&(Et.activeConnector=zm(t))},setConnectors(t){t.filter(s=>!Et.allConnectors.some(i=>i.id===s.id&&pe.getConnectorName(i.name)===pe.getConnectorName(s.name)&&i.chain===s.chain)).forEach(s=>{s.type!=="MULTI_CHAIN"&&Et.allConnectors.push(zm(s))});const r=pe.getEnabledNamespaces(),n=pe.getEnabledConnectors(r);Et.connectors=pe.mergeMultiChainConnectors(n)},filterByNamespaces(t){Object.keys(Et.filterByNamespaceMap).forEach(e=>{Et.filterByNamespaceMap[e]=!1}),t.forEach(e=>{Et.filterByNamespaceMap[e]=!0}),pe.updateConnectorsForEnabledNamespaces()},filterByNamespace(t,e){Et.filterByNamespaceMap[t]=e,pe.updateConnectorsForEnabledNamespaces()},updateConnectorsForEnabledNamespaces(){const t=pe.getEnabledNamespaces(),e=pe.getEnabledConnectors(t),r=pe.areAllNamespacesEnabled();Et.connectors=pe.mergeMultiChainConnectors(e),r?Ae.clearFilterByNamespaces():Ae.filterByNamespaces(t)},getEnabledNamespaces(){return Object.entries(Et.filterByNamespaceMap).filter(([t,e])=>e).map(([t])=>t)},getEnabledConnectors(t){return Et.allConnectors.filter(e=>t.includes(e.chain))},areAllNamespacesEnabled(){return Object.values(Et.filterByNamespaceMap).every(t=>t)},mergeMultiChainConnectors(t){const e=pe.generateConnectorMapByName(t),r=[];return e.forEach(n=>{const s=n[0],i=(s==null?void 0:s.id)===Y.CONNECTOR_ID.AUTH;n.length>
101&&s?r.push({name:s.name,imageUrl:s.imageUrl,imageId:s.imageId,connectors:[...n],type:i?"AUTH":"MULTI_CHAIN",chain:"eip155",id:(s==null?void 0:s.id)||""}):s&&r.push(s)}),r},generateConnectorMapByName(t){const e=new Map;return t.forEach(r=>{const{name:n}=r,s=pe.getConnectorName(n);if(!s)return;const i=e.get(s)||[];i.find(a=>a.chain===r.chain)||i.push(r),e.set(s,i)}),e},getConnectorName(t){return t&&({"Trust Wallet":"Trust"}[t]||t)},getUniqueConnectorsByName(t){const e=[];return t.forEach(r=>{e.find(n=>n.chain===r.chain)||e.push(r)}),e},addConnector(t){var e,r,n;if(t.id===Y.CONNECTOR_ID.AUTH){const s=t,i=qm(se.state),o=ds.getSnapshot().themeMode,a=ds.getSnapshot().themeVariables;(r=(e=s==null?void 0:s.provider)==null?void 0:e.syncDappData)==null||r.call(e,{metadata:i.metadata,sdkVersion:i.sdkVersion,projectId:i.projectId,sdkType:i.sdkType}),(n=s==null?void 0:s.provider)==null||n.syncTheme({themeMode:o,themeVariables:a,w3mThemeVariables:Wm(a,o)}),pe.setConnectors([t])}else pe.setConnectors([t])},getAuthConnector(t){var n;const e=t||q.state.activeChain,r=Et.connectors.find(s=>s.id===Y.CONNECTOR_ID.AUTH);if(r)return(n=r==null?void 0:r.connectors)!=null&&n.length?r.connectors.find(i=>i.chain===e):r},getAnnouncedConnectorRdns(){return Et.connectors.filter(t=>t.type==="ANNOUNCED").map(t=>{var e;return(e=t.info)==null?void 0:e.rdns})},getConnectorById(t){return an.sortConnectorsByPriority(Et.allConnectors).find(r=>r.id===t)},getConnector({id:t,namespace:e}){const r=e||q.state.activeChain,n=Et.allConnectors.filter(o=>o.chain===r);return an.sortConnectorsByPriority(n).find(o=>o.id===t||o.explorerId===t)},syncIfAuthConnector(t){var i,o;if(t.id!=="AUTH")return;const e=t,r=qm(se.state),n=ds.getSnapshot().themeMode,s=ds.getSnapshot().themeVariables;(o=(i=e==null?void 0:e.provider)==null?void 0:i.syncDappData)==null||o.call(i,{metadata:r.metadata,sdkVersion:r.sdkVersion,sdkType:r.sdkType,projectId:r.projectId}),e.provider.syncTheme({themeMode:n,themeVariables:s,w3mThemeVariables:Wm(s,n)})},getConnectorsByNamespace(t){const e=Et.allConnectors.filter(r=>r.chain===t);return pe.mergeMultiChainConnectors(e)},canSwitchToSmartAccount(t){return q.checkIfSmartAccountEnabled()&&qn(t)===Tr.ACCOUNT_TYPES.EOA},selectWalletConnector(t){var s;const e=(s=Fe.state.data)==null?void 0:s.redirectView,r=q.state.activeChain,n=r?pe.getConnector({id:t.id,namespace:r}):void 0;YL.handleMobileDeeplinkRedirect((n==null?void 0:n.explorerId)||t.id,q.state.activeChain,{isCoinbaseDisabled:se.state.enableCoinbase===!1}),n?Fe.push("ConnectingExternal",{connector:n,wallet:t,redirectView:e}):Fe.push("ConnectingWalletConnect",{wallet:t,redirectView:e})},getConnectors(t){return t?pe.getConnectorsByNamespace(t):pe.mergeMultiChainConnectors(Et.allConnectors)},setFilterByNamespace(t){Et.filterByNamespace=t,Et.connectors=pe.getConnectors(t),Ae.setFilterByNamespace(t)},setConnectorId(t,e){t&&(Et.activeConnectorIds={...Et.activeConnectorIds,[e]:t},ce.setConnectedConnectorId(e,t))},removeConnectorId(t){Et.activeConnectorIds={...Et.activeConnectorIds,[t]:void 0},ce.deleteConnectedConnectorId(t)},getConnectorId(t){if(t)return Et.activeConnectorIds[t]},isConnected(t){return t?!!Et.activeConnectorIds[t]:Object.values(Et.activeConnectorIds).some(e=>!!e)},resetConnectorIds(){Et.activeConnectorIds={...JL}},extendConnectorsWithExplorerWallets(t){Et.allConnectors.forEach(n=>{const s=t.find(i=>{var o;return i.id===n.id||i.rdns&&i.rdns===((o=n.info)==null?void 0:o.rdns)});s&&(n.explorerWallet=s)});const e=pe.getEnabledNamespaces(),r=pe.getEnabledConnectors(e);Et.connectors=pe.mergeMultiChainConnectors(r)},async connect(t={}){const{namespace:e}=t;return pe.setFilterByNamespace(e),Fe.push("Connect",{addWalletForNamespace:e}),new Promise((r,n)=>{if(e){const s=q.subscribeChainProp("accountState",o=>{o!=null&&o.caipAddress&&(r({caipAddress:o==null?void 0:o.caipAddress}),s())},e),i=ft.subscribeKey("open",o=>{o||(n(new Error("Modal closed")),i())})}else{const s=q.subscribeKey("activeCaipAddress",o=>{o&&(r({caipAddress:o}),s())}),i=ft.subscribeKey("open",o=>{o||(n(new Error("Modal closed")),i())})}})}},pe=pi(FQ),HQ=1e3,Rl={checkNamespaceConnectorId(t,e){return pe.getConnectorId(t)===e},isSocialProvider(t){return lt.DEFAULT_REMOTE_FEATURES.socials.includes(t)},connectWalletConnect({walletConnect:t,connector:e,closeModalOnConnect:r=!0,redirectViewOnModalClose:n="Connect",onOpen:s,onConnect:i}){return new Promise((o,a)=>
10{if(t&&pe.setActiveConnector(e),s==null||s(be.isMobile()&&t),n){const u=ft.subscribeKey("open",l=>{l||(Fe.state.view!==n&&Fe.replace(n),u(),a(new Error("Modal closed")))})}const c=q.subscribeKey("activeCaipAddress",u=>{u&&(i==null||i(),r&&ft.close(),c(),o(Rr.parseCaipAddress(u)))})})},connectExternal(t){return new Promise((e,r)=>{const n=q.subscribeKey("activeCaipAddress",s=>{s&&(ft.close(),n(),e(Rr.parseCaipAddress(s)))});me.connectExternal(t,t.chain).catch(()=>{n(),r(new Error("Connection rejected"))})})},connectSocial({social:t,namespace:e,closeModalOnConnect:r=!0,onOpenFarcaster:n,onConnect:s}){let i,o=!1,a=null;const c=e||q.state.activeChain,u=q.subscribeKey("activeCaipAddress",l=>{l&&(r&&ft.close(),u())});return new Promise((l,d)=>{async function f(h){var p;if((p=h.data)!=null&&p.resultUri)if(h.origin===Y.SECURE_SITE_SDK_ORIGIN){window.removeEventListener("message",f,!1);try{const y=pe.getAuthConnector(c);if(y&&!o){i&&i.close(),o=!0;const w=h.data.resultUri;Xe.sendEvent({type:"track",event:"SOCIAL_LOGIN_REQUEST_USER_DATA",properties:{provider:t}}),ce.setConnectedSocialProvider(t),await me.connectExternal({id:y.id,type:y.type,socialUri:w},y.chain);const I=q.state.activeCaipAddress;if(!I){d(new Error("Failed to connect"));return}l(Rr.parseCaipAddress(I)),Xe.sendEvent({type:"track",event:"SOCIAL_LOGIN_SUCCESS",properties:{provider:t}})}}catch(y){Xe.sendEvent({type:"track",event:"SOCIAL_LOGIN_ERROR",properties:{provider:t,message:be.parseError(y)}}),d(new Error("Failed to connect"))}}else Xe.sendEvent({type:"track",event:"SOCIAL_LOGIN_ERROR",properties:{provider:t,message:"Untrusted Origin"}})}async function g(){if(Xe.sendEvent({type:"track",event:"SOCIAL_LOGIN_STARTED",properties:{provider:t}}),t==="farcaster"){n==null||n();const h=ft.subscribeKey("open",y=>{!y&&t==="farcaster"&&(d(new Error("Popup closed")),s==null||s(),h())}),p=pe.getAuthConnector();if(p){const y=q.getAccountData(c);if(!(y!=null&&y.farcasterUrl))try{const{url:w}=await p.provider.getFarcasterUri();q.setAccountProp("farcasterUrl",w,c)}catch{d(new Error("Failed to connect to farcaster"))}}}else{const h=pe.getAuthConnector();a=be.returnOpenHref(`${Y.SECURE_SITE_SDK_ORIGIN}/loading`,"popupWindow","width=600,height=800,scrollbars=yes");try{if(h){const{uri:p}=await h.provider.getSocialRedirectUri({provider:t});if(a&&p){a.location.href=p,i=a;const y=setInterval(()=>{i!=null&&i.closed&&!o&&(d(new Error("Popup closed")),clearInterval(y))},1e3);window.addEventListener("message",f,!1)}else a==null||a.close(),d(new Error("Failed to initiate social connection"))}}catch{d(new Error("Failed to initiate social connection")),a==null||a.close()}}}g()})},connectEmail({closeModalOnConnect:t=!0,redirectViewOnModalClose:e="Connect",onOpen:r,onConnect:n}){return new Promise((s,i)=>{if(r==null||r(),e){const a=ft.subscribeKey("open",c=>{c||(Fe.state.view!==e&&Fe.replace(e),a(),i(new Error("Modal closed")))})}const o=q.subscribeKey("activeCaipAddress",a=>{a&&(n==null||n(),t&&ft.close(),o(),s(Rr.parseCaipAddress(a)))})})},async updateEmail(){const t=ce.getConnectedConnectorId(q.state.activeChain),e=pe.getAuthConnector();if(!e)throw new Error("No auth connector found");if(t!==Y.CONNECTOR_ID.AUTH)throw new Error("Not connected to email or social");const r=e.provider.getEmail()??"";return await ft.open({view:"UpdateEmailWallet",data:{email:r,redirectView:void 0}}),new Promise((n,s)=>{const i=setInterval(()=>{const a=e.provider.getEmail()??"";a!==r&&(ft.close(),clearInterval(i),o(),n({email:a}))},HQ),o=ft.subscribeKey("open",a=>{a||(Fe.state.view!=="Connect"&&Fe.push("Connect"),clearInterval(i),o(),s(new Error("Modal closed")))})})},canSwitchToSmartAccount(t){return q.checkIfSmartAccountEnabled()&&qn(t)===Tr.ACCOUNT_TYPES.EOA}};function QL(){var n,s;const t=((n=q.state.activeCaipNetwork)==null?void 0:n.chainNamespace)||"eip155",e=((s=q.state.activeCaipNetwork)==null?void 0:s.id)||1,r=lt.NATIVE_TOKEN_ADDRESS[t];return`${t}:${e}:${r}`}function g2e(t){return lt.NATIVE_TOKEN_ADDRESS[t]}function qn(t){var r;return(r=q.getAccountData(t))==null?void 0:r.preferredAccountType}function Vf(t){var e,r;return t?(r=(e=q.state.chains.get(t))==null?void 0:e.networkState)==null?void 0:r.caipNetwork:q.state.activeCaipNetwork}const Ty={getConnectionStatus(t,e){const r=pe.state.activeConnectorIds[e],n=me.getConnections(e);return!!r&&t.connectorId===r?"connected":n.some(o=>o.connectorId.toLowerCase()===t.connectorId.toLowerCase())?"active":"disconnected"},excludeConnectorAddressFromConnections({connections:t,connectorId:e,addresses:r}){return t.map(n=>{if((e?n.connectorId.toLowerCase()===e.toLowerCase():!1)&&r){const i=n.accounts.filter(o=>!r.some(c=>
10c.toLowerCase()===o.address.toLowerCase()));return{...n,accounts:i}}return n})},excludeExistingConnections(t,e){const r=new Set(t);return e.filter(n=>!r.has(n.connectorId))},getConnectionsByConnectorId(t,e){return t.filter(r=>r.connectorId.toLowerCase()===e.toLowerCase())},getConnectionsData(t){var a;const e=!!((a=se.state.remoteFeatures)!=null&&a.multiWallet),r=pe.state.activeConnectorIds[t],n=me.getConnections(t),i=(me.state.recentConnections.get(t)??[]).filter(c=>pe.getConnectorById(c.connectorId)),o=Ty.excludeExistingConnections([...n.map(c=>c.connectorId),...r?[r]:[]],i);return e?{connections:n,recentConnections:o}:{connections:n.filter(c=>c.connectorId.toLowerCase()===(r==null?void 0:r.toLowerCase())),recentConnections:[]}},onConnectMobile(t,e){const r=me.state.wcUri;if(t!=null&&t.mobile_link&&r)try{me.setWcError(!1);const{mobile_link:n,link_mode:s,name:i}=t,o=be.appendPayToUri(r,e),{redirect:a,redirectUniversalLink:c,href:u,universalHref:l}=be.formatNativeUrl(n,o,s),d=a,f=c,g=be.isIframe()?"_top":"_self",h=!!se.state.experimental_preferUniversalLinks,p=h&&f?f:d,y=h&&l?l:u;me.setWcLinking({name:i,href:y}),me.setRecentWallet(t),be.openHref(p,g)}catch(n){Xe.sendEvent({type:"track",event:"CONNECT_PROXY_ERROR",properties:{message:n instanceof Error?n.message:"Error parsing the deep link",uri:r,mobile_link:t.mobile_link,name:t.name}}),me.setWcError(!0)}}},cf=rr({loading:!1,open:!1,selectedNetworkId:void 0,activeChain:void 0,initialized:!1,connectingWallet:void 0}),Tn={state:cf,subscribe(t){return ln(cf,()=>t(cf))},subscribeOpen(t){return cr(cf,"open",t)},set(t){Object.assign(cf,{...cf,...t})}},ir=rr({transactions:[],transactionsByYear:{},lastNetworkInView:void 0,loading:!1,empty:!1,next:void 0}),qQ={state:ir,subscribe(t){return ln(ir,()=>t(ir))},setLastNetworkInView(t){ir.lastNetworkInView=t},async fetchTransactions(t){var e;if(!t)throw new Error("Transactions can't be fetched without an accountAddress");ir.loading=!0;try{const r=await Ve.fetchTransactions({account:t,cursor:ir.next,chainId:(e=q.state.activeCaipNetwork)==null?void 0:e.caipNetworkId}),n=a_.filterSpamTransactions(r.data),s=a_.filterByConnectedChain(n),i=[...ir.transactions,...s];ir.loading=!1,ir.transactions=i,ir.transactionsByYear=a_.groupTransactionsByYearAndMonth(ir.transactionsByYear,s),ir.empty=i.length===0,ir.next=r.next?r.next:void 0}catch{const n=q.state.activeChain;Xe.sendEvent({type:"track",event:"ERROR_FETCH_TRANSACTIONS",properties:{address:t,projectId:se.state.projectId,cursor:ir.next,isSmartAccount:qn(n)===Tr.ACCOUNT_TYPES.SMART_ACCOUNT}}),Bo.showError("Failed to fetch transactions"),ir.loading=!1,ir.empty=!0,ir.next=void 0}},groupTransactionsByYearAndMonth(t={},e=[]){const r=t;return e.forEach(n=>{const s=new Date(n.metadata.minedAt).getFullYear(),i=new Date(n.metadata.minedAt).getMonth(),o=r[s]??{},c=(o[i]??[]).filter(u=>u.id!==n.id);r[s]={...o,[i]:[...c,n].sort((u,l)=>new Date(l.metadata.minedAt).getTime()-new Date(u.metadata.minedAt).getTime())}}),r},filterSpamTransactions(t){return t.filter(e=>{var n;return!((n=e.transfers)==null?void 0:n.every(s=>{var i;return((i=s.nft_info)==null?void 0:i.flags.is_spam)===!0}))})},filterByConnectedChain(t){var n;const e=(n=q.state.activeCaipNetwork)==null?void 0:n.caipNetworkId;return t.filter(s=>s.metadata.chain===e)},clearCursor(){ir.next=void 0},resetTransactions(){ir.transactions=[],ir.transactionsByYear={},ir.lastNetworkInView=void 0,ir.loading=!1,ir.empty=!1,ir.next=void 0}},a_=pi(qQ,"API_ERROR"),tt=rr({connections:new Map,recentConnections:new Map,isSwitchingConnection:!1,wcError:!1,wcFetchingUri:!1,buffering:!1,status:"disconnected"});let Ac;const zQ={state:tt,subscribe(t){return ln(tt,()=>t(tt))},subscribeKey(t,e){return cr(tt,t,e)},_getClient(){return tt._client},setClient(t){tt._client=zm(t)},initialize(t){const e=t.filter(r=>!!r.namespace).map(r=>r.namespace);me.syncStorageConnections(e)},syncStorageConnections(t){const e=ce.getConnections(),r=t??Array.from(q.state.chains.keys());for(const n of r){const s=e[n]??[],i=new Map(tt.recentConnections);i.set(n,s),tt.recentConnections=i}},getConnections(t){return t?tt.connections.get(t)??[]:[]},hasAnyConnection(t){const e=me.state.connections;return Array.from(e.values()).flatMap(r=>r).some(({connectorId:r})=>r===t)},async connectWalletConnect({cache:t="auto"}={}){var r,n,s,i;tt.wcFetchingUri=!0;const e=be.isTelegram()||be.isSafari()&&be.isIos();try{if(t==="always"||t==="auto"&&e){if(Ac){await Ac,Ac=void 0;return}if(!be.isPairingExpired(tt==null?void 0:tt.wcPairingExpiry)){const o=tt.wcUri;tt.wcUri=o;return}Ac=(n=(r=me._getClient())==null?void 0:r.connectWalletConnect)==null?void 0:n.call(r),me.state.status="connecting",await Ac,Ac=void 0,tt.wcPairingExpiry=void 0,me.state.status="connected"}else await((i=(s=me._getClient())==null?void 0:s.connectWalletConnect)==null?void 0:i.call(s))}catch(o){throw tt.wcError=!0,tt.wcFetchingUri=!1,tt.status="disconnected",Ac=void 0,o}},async connectExternal(t,e,r=!0){var o,a,c;const n=await((a=(o=me._getClient())==null?void 0:o.connectExternal)==null?void 0:a.call(o,t));r&&q.setActiveNamespace(e);const s=pe.state.allConnectors.find(u=>u.id===(t==null?void 0:t.id)),i=t.type==="AUTH"?"email":"browser";return Xe.sendEvent({type:"track",event:"CONNECT_SUCCESS",properties:{method:i,name:(s==null?void 0:s.name)||"Unknown",view:Fe.state.view,walletRank:(c=s==null?void 0:s.explorerWallet)==null?void 0:c.order}}),n},async reconnectExternal(t){var r,n;await((n=(r=me._getClient())==null?void 0:r.reconnectExternal)==null?void 0:n.call(r,t));const e=t.chain||q.state.activeChain;e&&pe.setConnectorId(t.id,e)},async setPreferredAccountType(t,e){var n;if(!e)return;ft.setLoading(!0,q.state.activeChain);const r=pe.getAuthConnector();r&&(q.setAccountProp("preferredAccountType",t,e),await r.provider.setPreferredAccount(t),ce.setPreferredAccountTypes(Object.entries(q.state.chains).reduce((s,[i,o])=>{const a=i,c=qn(a);return c!==void 0&&(s[a]=c),s},{})),await me.reconnectExternal(r),ft.setLoading(!1,q.state.activeChain),Xe.sendEvent({type:"track",event:"SET_PREFERRED_ACCOUNT_TYPE",properties:{accountType:t,network:((n=q.state.activeCaipNetwork)==null?void 0:n.caipNetworkId)||""}}))},async signMessage(t){var e;return(e=me._getClient())==null?void 0:e.signMessage(t)},parseUnits(t,e){var r;return(r=me._getClient())==null?void 0:r.parseUnits(t,e)},formatUnits(t,e){var r;return(r=me._getClient())==null?void 0:r.formatUnits(t,e)},updateBalance(t){var e;return(e=me._getClient())==null?void 0:e.updateBalance(t)},async sendTransaction(t){var e;return(e=me._getClient())==null?void 0:e.sendTransaction(t)},async getCapabilities(t){var e;return(e=me._getClient())==null?void 0:e.getCapabilities(t)},async grantPermissions(t){var e;return(e=me._getClient())==null?void 0:e.grantPermissions(t)},async walletGetAssets(t){var e;return((e=me._getClient())==null?void 0:e.walletGetAssets(t))??{}},async estimateGas(t){var e;return(e=me._getClient())==null?void 0:e.estimateGas(t)},async writeContract(t){var e;return(e=me._getClient())==null?void 0:e.writeContract(t)},async writeSolanaTransaction(t){var e;return(e=me._getClient())==null?void 0:e.writeSolanaTransaction(t)},async getEnsAddress(t){var e;return(e=me._getClient())==null?void 0:e.getEnsAddress(t)},async getEnsAvatar(t){var e;return(e=me._getClient())==null?void 0:e.getEnsAvatar(t)},checkInstalled(t){var e,r;return((r=(e=me._getClient())==null?void 0:e.checkInstalled)==null?void 0:r.call(e,t))||!1},resetWcConnection(){tt.wcUri=void 0,tt.wcPairingExpiry=void 0,tt.wcLinking=void 0,tt.recentWallet=void 0,tt.wcFetchingUri=!1,tt.status="disconnected",a_.resetTransactions(),ce.deleteWalletConnectDeepLink(),ce.deleteRecentWallet(),Tn.set({connectingWallet:void 0})},resetUri(){tt.wcUri=void 0,tt.wcPairingExpiry=void 0,Ac=void 0,tt.wcFetchingUri=!1,Tn.set({connectingWallet:void 0})},finalizeWcConnection(t){var n,s;const{wcLinking:e,recentWallet:r}=me.state;e&&ce.setWalletConnectDeepLink(e),r&&ce.setAppKitRecent(r),t&&Xe.sendEvent({type:"track",event:"CONNECT_SUCCESS",address:t,properties:{method:e?"mobile":"qrcode",name:((s=(n=Fe.state.data)==null?void 0:n.wallet)==null?void 0:s.name)||"Unknown",view:Fe.state.view,walletRank:r==null?void 0:r.order}})},setWcBasic(t){tt.wcBasic=t},setUri(t){tt.wcUri=t,tt.wcFetchingUri=!1,tt.wcPairingExpiry=be.getPairingExpiry()},setWcLinking(t){tt.wcLinking=t},setWcError(t){tt.wcError=t,tt.wcFetchingUri=!1,tt.buffering=!1},setRecentWallet(t){tt.recentWallet=t},setBuffering(t){tt.buffering=t},setStatus(t){tt.status=t},setIsSwitchingConnection(t){tt.isSwitchingConnection=t},async disconnect({id:t,namespace:e,initialDisconnect:r}={}){var n;try{await((n=me._getClient())==null?void 0:n.disconnect({id:t,chainNamespace:e,initialDisconnect:r}))}catch(s){throw new Nd("Failed to disconnect","INTERNAL_SDK_ERROR",s)}},async disconnectConnector({id:t,namespace:e}){var r;try{await((r=me._getClient())==null?void 0:r.disconnectConnector({id:t,namespace:e}))}catch(n){throw new Nd("Failed to disconnect connector","INTERNAL_SDK_ERROR",n)}},setConnections(t,e){const r=new Map(tt.connections);r.set(e,t),tt.connections=r},async handleAuthAccountSwitch({address:t,namespace:e}){var i,o;const r=q.getAccountData(e),n=(o=(i=r==null?void 0:r.user)==null?void 0:i.accounts)==null?void 0:o.find(a=>a.type==="smartAccount"),s=n&&n.address.toLowerCase()===t.toLowerCase()&&Rl.canSwitchToSmartAccount(e)?"smartAccount":"eoa";await me.setPreferredAccountType(s,e)},async handleActiveConnection({connection:t,namespace:e,address:r}){const n=pe.getConnectorById(t.connectorId),s=t.connectorId===Y.CONNECTOR_ID.AUTH;if(!n)throw new Error(`No connector found for connection: ${t.connectorId}`);if(s)r&&await me.handleAuthAccountSwitch({address:r,namespace:e});else{const i=await me.connectExternal({id:n.id,type:n.type,provider:n.provider,address:r,chain:e},e);return i==null?void 0:i.address}return r},async handleDisconnectedConnection({connection:t,namespace:e,address:r,closeModalOnConnect:n}){var u,l;const s=pe.getConnectorById(t.connectorId),i=(l=(u=t.auth)==null?void 0:u.name)==null?void 0:l.toLowerCase(),o=t.connectorId===Y.CONNECTOR_ID.AUTH,a=t.connectorId===Y.CONNECTOR_ID.WALLET_CONNECT;if(!s)throw new Error(`No connector found for connection: ${t.connectorId}`);let c;if(o)if(i&&Rl.isSocialProvider(i)){const{address:d}=await Rl.connectSocial({social:i,closeModalOnConnect:n,onOpenFarcaster(){ft.open({view:"ConnectingFarcaster"})},onConnect(){Fe.replace("ProfileWallets")}});c=d}else{const{address:d}=await Rl.connectEmail({closeModalOnConnect:n,onOpen(){ft.open({view:"EmailLogin"})},onConnect(){Fe.replace("ProfileWallets")}});c=d}else if(a){const{address:d}=await Rl.connectWalletConnect({walletConnect:!0,connector:s,closeModalOnConnect:n,onOpen(f){const g=f?"AllWallets":"ConnectingWalletConnect";ft.state.open?Fe.push(g):ft.open({view:g})},onConnect(){Fe.replace("ProfileWallets")}});c=d}else{const d=await me.connectExternal({id:s.id,type:s.type,provider:s.provider,chain:e},e);d&&(c=d.address)}return o&&r&&await me.handleAuthAccountSwitch({address:r,namespace:e}),c},async switchConnection({connection:t,address:e,namespace:r,closeModalOnConnect:n,onChange:s}){var c;let i;const o=(c=q.getAccountData(r))==null?void 0:c.caipAddress;if(o){const{address:u}=Rr.parseCaipAddress(o);i=u}const a=Ty.getConnectionStatus(t,r);switch(a){case"connected":case"active":{const u=await me.handleActiveConnection({connection:t,namespace:r,address:e});if(i&&u){const l=u.toLowerCase()!==i.toLowerCase();s==null||s({address:u,namespace:r,hasSwitchedAccount:l,hasSwitchedWallet:
10a==="active"})}break}case"disconnected":{const u=await me.handleDisconnectedConnection({connection:t,namespace:r,address:e,closeModalOnConnect:n});u&&(s==null||s({address:u,namespace:r,hasSwitchedAccount:!0,hasSwitchedWallet:!0}));break}default:throw new Error(`Invalid connection status: ${a}`)}}},me=pi(zQ),j2={createBalance(t,e){const r={name:t.metadata.name||"",symbol:t.metadata.symbol||"",decimals:t.metadata.decimals||0,value:t.metadata.value||0,price:t.metadata.price||0,iconUrl:t.metadata.iconUrl||""};return{name:r.name,symbol:r.symbol,chainId:e,address:t.address==="native"?void 0:this.convertAddressToCAIP10Address(t.address,e),value:r.value,price:r.price,quantity:{decimals:r.decimals.toString(),numeric:this.convertHexToBalance({hex:t.balance,decimals:r.decimals})},iconUrl:r.iconUrl}},convertHexToBalance({hex:t,decimals:e}){return GL(BigInt(t),e)},convertAddressToCAIP10Address(t,e){return`${e}:${t}`},createCAIP2ChainId(t,e){return`${e}:${parseInt(t,16)}`},getChainIdHexFromCAIP2ChainId(t){const e=t.split(":");if(e.length<2||!e[1])return"0x0";const r=e[1],n=parseInt(r,10);return isNaN(n)?"0x0":`0x${n.toString(16)}`},isWalletGetAssetsResponse(t){return typeof t!="object"||t===null?!1:Object.values(t).every(e=>Array.isArray(e)&&e.every(r=>this.isValidAsset(r)))},isValidAsset(t){return typeof t=="object"&&t!==null&&typeof t.address=="string"&&typeof t.balance=="string"&&(t.type==="ERC20"||t.type==="NATIVE")&&typeof t.metadata=="object"&&t.metadata!==null&&typeof t.metadata.name=="string"&&typeof t.metadata.symbol=="string"&&typeof t.metadata.decimals=="number"&&typeof t.metadata.price=="number"&&typeof t.metadata.iconUrl=="string"}};let D2;
10async function nR(){if(!D2){const{createPublicClient:t,http:e,defineChain:r}=await Wr(async()=>{const{createPublicClient:n,http:s,defineChain:i}=await import("./index-CEikKVnh.js");return{createPublicClient:n,http:s,defineChain:i}},__vite__mapDeps([0,1,2,3,4,5,6,7,8]));D2={createPublicClient:t,http:e,defineChain:r}}return D2}const iT={getBlockchainApiRpcUrl(t,e){const r=new URL("https://rpc.walletconnect.org/v1/");return r.searchParams.set("chainId",t),r.searchParams.set("projectId",e),r.toString()},async getViemChain(t){const{defineChain:e}=await nR(),{chainId:r}=Rr.parseCaipNetworkId(t.caipNetworkId);return e({...t,id:Number(r)})},async createViemPublicClient(t){const{createPublicClient:e,http:r}=await nR(),n=se.state.projectId,s=await iT.getViemChain(t);if(!s)throw new Error(`Chain ${t.caipNetworkId} not found in viem/chains`);return e({chain:s,transport:r(iT.getBlockchainApiRpcUrl(t.caipNetworkId,n))})}},JP={async getMyTokensWithBalance(t={forceUpdate:void 0,caipNetwork:q.state.activeCaipNetwork,address:(e=>(e=q.getAccountData())==null?void 0:e.address)()}){const{forceUpdate:r,caipNetwork:n,address:s}=t,i=pe.getConnectorId("eip155")===Y.CONNECTOR_ID.AUTH;if(!s)return[];const o=n?`${n.caipNetworkId}:${s}`:s,a=ce.getBalanceCacheForCaipAddress(o);if(a)return a.balances;if(n&&n.chainNamespace===Y.CHAIN.EVM&&i){const u=await this.getEIP155Balances(s,n);if(u)return this.filterLowQualityTokens(u)}const c=await Ve.getBalance(s,n==null?void 0:n.caipNetworkId,r);return this.filterLowQualityTokens(c.balances)},async getEIP155Balances(t,e){var r,n;try{const s=j2.getChainIdHexFromCAIP2ChainId(e.caipNetworkId),i=await me.getCapabilities(t);if(!((n=(r=i==null?void 0:i[s])==null?void 0:r.assetDiscovery)!=null&&n.supported))return null;const o=await me.walletGetAssets({account:t,chainFilter:[s]});if(!j2.isWalletGetAssetsResponse(o))return null;const c=(o[s]||[]).map(u=>j2.createBalance(u,e.caipNetworkId));return ce.updateBalanceCache({caipAddress:`${e.caipNetworkId}:${t}`,balance:{balances:c},timestamp:Date.now()}),c}catch{return null}},filterLowQualityTokens(t){return t.filter(e=>e.quantity.decimals!=="0")},async fetchERC20Balance({caipAddress:t,assetAddress:e,caipNetwork:r}){const n=await iT.createViemPublicClient(r),{address:s}=Rr.parseCaipAddress(t),[{result:i},{result:o},{result:a},{result:c}]=await n.multicall({contracts:[{address:e,functionName:"name",args:[],abi:ub},{address:e,functionName:"symbol",args:[],abi:ub},{address:e,functionName:"balanceOf",args:[s],abi:ub},{address:e,functionName:"decimals",args:[],abi:ub}]});return{name:i,symbol:o,decimals:c,balance:a&&c?GL(a,c):"0"}}},U2={adapters:{}},XL={state:U2,initialize(t){U2.adapters={...t}},get(t){return U2.adapters[t]}},F_={eip155:void 0,solana:void 0,polkadot:void 0,bip122:void 0,cosmos:void 0,sui:void 0,stacks:void 0,ton:void 0,tron:void 0},ts=rr({providers:{...F_},providerIds:{...F_}}),_t={state:ts,subscribeKey(t,e){return cr(ts,t,e)},subscribe(t){return ln(ts,()=>{t(ts)})},subscribeProviders(t){return ln(ts.providers,()=>t(ts.providers))},setProvider(t,e){t&&e&&(ts.providers[t]=zm(e))},getProvider(t){if(t)return ts.providers[t]},setProviderId(t,e){e&&(ts.providerIds[t]=e)},getProviderId(t){if(t)return ts.providerIds[t]},reset(){ts.providers={...F_},ts.providerIds={...F_}},resetChain(t){ts.providers[t]=void 0,ts.providerIds[t]=void 0}},WQ={async getTokenList(t){var n;const e=await Ve.fetchSwapTokens({chainId:t});return((n=e==null?void 0:e.tokens)==null?void 0:n.map(s=>({...s,eip2612:!1,quantity:{decimals:"0",numeric:"0"},price:0,value:0})))||[]},async fetchGasPrice(){var e;const t=q.state.activeCaipNetwork;if(!t)return null;try{switch(t.chainNamespace){case"solana":const r=(e=await(me==null?void 0:me.estimateGas({chainNamespace:"solana"})))==null?void 0:e.toString();return{standard:r,fast:r,instant:r};case"eip155":default:return await Ve.fetchGasPrice({chainId:t.caipNetworkId})}}catch{return null}},async fetchSwapAllowance({tokenAddress:t,userAddress:e,sourceTokenAmount:r,sourceTokenDecimals:n}){const s=await Ve.fetchSwapAllowance({tokenAddress:t,userAddress:e});if(s!=null&&s.allowance&&r&&n){const i=me.parseUnits(r,n)||0;return BigInt(s.allowance)>=i}return!1},async getMyTokensWithBalance(t){var r;const e=await JP.getMyTokensWithBalance({forceUpdate:t,caipNetwork:q.state.activeCaipNetwork,address:(r=q.getAccountData())==null?void 0:r.address});return q.setAccountProp("tokenBalance",e,q.state.activeChain),this.mapBalancesToSwapTokens(e)},mapBalancesToSwapTokens(t){return(t==null?void 0:t.map(e=>({...e,address:e!=null&&e.address?e.address:QL(),decimals:parseInt(e.quantity.decimals,10),logoUri:e.iconUrl,eip2612:!1})))||[]},async handleSwapError(t){var e,r;try{const n=t==null?void 0:t.cause;if(!(n!=null&&n.json))return;const s=await n.json(),i=(r=(e=s==null?void 0:s.reasons)==null?void 0:e[0])==null?void 0:r.description;return i!=null&&i.includes("insufficient liquidity")?"Insufficient liquidity":void 0}catch{return}}},vt=rr({tokenBalances:[],loading:!1}),VQ={state:vt,subscribe(t){return ln(vt,()=>t(vt))},subscribeKey(t,e){return cr(vt,t,e)},setToken(t){t&&(vt.token=zm(t))},setTokenAmount(t){vt.sendTokenAmount=t},setReceiverAddress(t){vt.receiverAddress=t},setReceiverProfileImageUrl(t){vt.receiverProfileImageUrl=t},setReceiverProfileName(t){vt.receiverProfileName=t},setNetworkBalanceInUsd(t){vt.networkBalanceInUSD=t},setLoading(t){vt.loading=t},getSdkEventProperties(t){var e,r;return{message:be.parseError(t),isSmartAccount:qn(q.state.activeChain)===Tr.ACCOUNT_TYPES.SMART_ACCOUNT,token:((e=vt.token)==null?void 0:e.symbol)||"",amount:Number(vt.sendTokenAmount??"0"),network:((r=q.state.activeCaipNetwork)==null?void 0:r.caipNetworkId)||""}},async sendToken(){var t;try{switch(at.setLoading(!0),(t=q.state.activeCaipNetwork)==null?void 0:t.chainNamespace){case"eip155":await at.sendEvmToken();return;case"solana":await at.sendSolanaToken();return;default:throw new Error("Unsupported chain")}}catch(e){throw Oo.isUserRejectedRequestError(e)?new MP(e):e}finally{at.setLoading(!1)}},async sendEvmToken(){var r,n,s;const t=q.state.activeChain;if(!t)throw new Error("SendController:sendEvmToken - activeChainNamespace is required");const e=qn(t);if(!at.state.sendTokenAmount||!at.state.receiverAddress)throw new Error("An amount and receiver address are required");if(!at.state.token)throw new Error("A token is required");if((r=at.state.token)!=null&&r.address){Xe.sendEvent({type:"track",event:"SEND_INITIATED",properties:{isSmartAccount:e===Tr.ACCOUNT_TYPES.SMART_ACCOUNT,token:at.state.token.address,amount:Number(at.state.sendTokenAmount),network:((n=q.state.activeCaipNetwork)==null?void 0:n.caipNetworkId)||""}});const{hash:i}=await at.sendERC20Token({receiverAddress:at.state.receiverAddress,tokenAddress:at.state.token.address,sendTokenAmount:at.state.sendTokenAmount,decimals:at.state.token.quantity.decimals});i&&(vt.hash=i)}else{Xe.sendEvent({type:"track",event:"SEND_INITIATED",properties:{isSmartAccount:e===Tr.ACCOUNT_TYPES.SMART_ACCOUNT,token:at.state.token.symbol||"",amount:Number(at.state.sendTokenAmount),network:((s=q.state.activeCaipNetwork)==null?void 0:s.caipNetworkId)||""}});const{hash:i}=await at.sendNativeToken({receiverAddress:at.state.receiverAddress,sendTokenAmount:at.state.sendTokenAmount,decimals:at.state.token.quantity.decimals});i&&(vt.hash=i)}},async fetchTokenBalance(t){var o,a,c;vt.loading=!0;const e=q.state.activeChain,r=(o=q.state.activeCaipNetwork)==null?void 0:o.caipNetworkId,n=(a=q.state.activeCaipNetwork)==null?void 0:a.chainNamespace,s=((c=q.getAccountData(e))==null?void 0:c.caipAddress)??q.
10state.activeCaipAddress,i=s?be.getPlainAddress(s):void 0;if(vt.lastRetry&&!be.isAllowedRetry(vt.lastRetry,30*lt.ONE_SEC_MS))return vt.loading=!1,[];try{if(i&&r&&n){const u=await JP.getMyTokensWithBalance();return vt.tokenBalances=u,vt.lastRetry=void 0,u}}catch(u){vt.lastRetry=Date.now(),t==null||t(u),Bo.showError("Token Balance Unavailable")}finally{vt.loading=!1}return[]},fetchNetworkBalance(){if(vt.tokenBalances.length===0)return;const t=WQ.mapBalancesToSwapTokens(vt.tokenBalances);if(!t)return;const e=t.find(r=>r.address===QL());e&&(vt.networkBalanceInUSD=e?eL.multiply(e.quantity.numeric,e.price).toString():"0")},async sendNativeToken(t){var o,a,c,u;Fe.pushTransactionStack({});const e=t.receiverAddress,r=(o=q.getAccountData())==null?void 0:o.address,n=me.parseUnits(t.sendTokenAmount.toString(),Number(t.decimals)),i=await me.sendTransaction({chainNamespace:Y.CHAIN.EVM,to:e,address:r,data:"0x",value:n??BigInt(0)});return Xe.sendEvent({type:"track",event:"SEND_SUCCESS",properties:{isSmartAccount:qn("eip155")===Tr.ACCOUNT_TYPES.SMART_ACCOUNT,token:((a=at.state.token)==null?void 0:a.symbol)||"",amount:Number(t.sendTokenAmount),network:((c=q.state.activeCaipNetwork)==null?void 0:c.caipNetworkId)||"",hash:i||""}}),(u=me._getClient())==null||u.updateBalance("eip155"),at.resetSend(),{hash:i}},async sendERC20Token(t){var n,s,i;Fe.pushTransactionStack({onSuccess(){Fe.replace("Account")}});const e=me.parseUnits(t.sendTokenAmount.toString(),Number(t.decimals)),r=(n=q.getAccountData())==null?void 0:n.address;if(r&&t.sendTokenAmount&&t.receiverAddress&&t.tokenAddress){const o=be.getPlainAddress(t.tokenAddress);if(!o)throw new Error("SendController:sendERC20Token - tokenAddress is required");const a=await me.writeContract({fromAddress:r,tokenAddress:o,args:[t.receiverAddress,e??BigInt(0)],method:"transfer",abi:OG.getERC20Abi(o),chainNamespace:Y.CHAIN.EVM});return Xe.sendEvent({type:"track",event:"SEND_SUCCESS",properties:{isSmartAccount:qn("eip155")===Tr.ACCOUNT_TYPES.SMART_ACCOUNT,token:((s=at.state.token)==null?void 0:s.symbol)||"",amount:Number(t.sendTokenAmount),network:((i=q.state.activeCaipNetwork)==null?void 0:i.caipNetworkId)||"",hash:a||""}}),at.resetSend(),{hash:a}}return{hash:void 0}},async sendSolanaToken(){var r,n,s;if(!at.state.sendTokenAmount||!at.state.receiverAddress)throw new Error("An amount and receiver address are required");Fe.pushTransactionStack({onSuccess(){Fe.replace("Account")}});let t;at.state.token&&at.state.token.address!==lt.SOLANA_NATIVE_TOKEN_ADDRESS&&(be.isCaipAddress(at.state.token.address)?t=be.getPlainAddress(at.state.token.address):t=at.state.token.address);const e=await me.sendTransaction({chainNamespace:"solana",tokenMint:t,to:at.state.receiverAddress,value:Number(at.state.sendTokenAmount)});e&&(vt.hash=e),(r=me._getClient())==null||r.updateBalance("solana"),Xe.sendEvent({type:"track",event:"SEND_SUCCESS",properties:{isSmartAccount:!1,token:((n=at.state.token)==null?void 0:n.symbol)||"",amount:Number(at.state.sendTokenAmount),network:((s=q.state.activeCaipNetwork)==null?void 0:s.caipNetworkId)||"",hash:e||""}}),at.resetSend()},resetSend(){vt.token=void 0,vt.sendTokenAmount=void 0,vt.receiverAddress=void 0,vt.receiverProfileImageUrl=void 0,vt.receiverProfileName=void 0,vt.loading=!1,vt.tokenBalances=[]}},at=pi(VQ),M2={currentTab:0,tokenBalance:[],smartAccountDeployed:!1,addressLabels:new Map,user:void 0,preferredAccountType:void 0},pb={caipNetwork:void 0,supportsAllNetworks:!0,smartAccountEnabledNetworks:[]},Ie=rr({chains:yG(),activeCaipAddress:void 0,activeChain:void 0,activeCaipNetwork:void 0,noAdapters:!1,universalAdapter:{connectionControllerClient:void 0},isSwitchingNamespace:!1}),eF={state:Ie,subscribe(t){return ln(Ie,()=>{t(Ie)})},subscribeKey(t,e){return cr(Ie,t,e)},subscribeAccountStateProp(t,e,r){var s;const n=r||Ie.activeChain;return n?cr(((s=Ie.chains.get(n))==null?void 0:s.accountState)||{},t,e):()=>{}},subscribeChainProp(t,e,r){let n;return ln(Ie.chains,()=>{var i;const s=r||Ie.activeChain;if(s){const o=(i=Ie.chains.get(s))==null?void 0:i[t];n!==o&&(n=o,e(o))}})},initialize(t,e,r){const{chainId:n,namespace:s}=ce.getActiveNetworkProps(),i=e==null?void 0:e.find(l=>l.id.toString()===(n==null?void 0:n.toString())),a=t.find(l=>(l==null?void 0:l.namespace)===s)||(t==null?void 0:t[0]),c=t.map(l=>
10l.namespace).filter(l=>l!==void 0),u=se.state.enableEmbedded?new Set([...c]):new Set([...(e==null?void 0:e.map(l=>l.chainNamespace))??[]]);((t==null?void 0:t.length)===0||!a)&&(Ie.noAdapters=!0),Ie.noAdapters||(Ie.activeChain=a==null?void 0:a.namespace,Ie.activeCaipNetwork=i,q.setChainNetworkData(a==null?void 0:a.namespace,{caipNetwork:i}),Ie.activeChain&&Tn.set({activeChain:a==null?void 0:a.namespace})),u.forEach(l=>{const d=e==null?void 0:e.filter(h=>h.chainNamespace===l),f=ce.getPreferredAccountTypes()||{},g={...se.state.defaultAccountTypes,...f};q.state.chains.set(l,{namespace:l,networkState:rr({...pb,caipNetwork:d==null?void 0:d[0]}),accountState:rr({...M2,preferredAccountType:g[l]}),caipNetworks:d??[],...r}),q.setRequestedCaipNetworks(d??[],l)})},removeAdapter(t){var e,r;if(Ie.activeChain===t){const n=Array.from(Ie.chains.entries()).find(([s])=>s!==t);if(n){const s=(r=(e=n[1])==null?void 0:e.caipNetworks)==null?void 0:r[0];s&&q.setActiveCaipNetwork(s)}}Ie.chains.delete(t)},addAdapter(t,{connectionControllerClient:e},r){if(!t.namespace)throw new Error("ChainController:addAdapter - adapter must have a namespace");Ie.chains.set(t.namespace,{namespace:t.namespace,networkState:{...pb,caipNetwork:r[0]},accountState:{...M2},caipNetworks:r,connectionControllerClient:e}),q.setRequestedCaipNetworks((r==null?void 0:r.filter(n=>n.chainNamespace===t.namespace))??[],t.namespace)},addNetwork(t){var r;const e=Ie.chains.get(t.chainNamespace);if(e){const n=[...e.caipNetworks||[]];(r=e.caipNetworks)!=null&&r.find(s=>s.id===t.id)||n.push(t),Ie.chains.set(t.chainNamespace,{...e,caipNetworks:n}),q.setRequestedCaipNetworks(n,t.chainNamespace),pe.filterByNamespace(t.chainNamespace,!0)}},removeNetwork(t,e){var n,s,i;const r=Ie.chains.get(t);if(r){const o=((n=Ie.activeCaipNetwork)==null?void 0:n.id)===e,a=[...((s=r.caipNetworks)==null?void 0:s.filter(c=>c.id!==e))||[]];o&&((i=r==null?void 0:r.caipNetworks)!=null&&i[0])&&q.setActiveCaipNetwork(r.caipNetworks[0]),Ie.chains.set(t,{...r,caipNetworks:a}),q.setRequestedCaipNetworks(a||[],t),a.length===0&&pe.filterByNamespace(t,!1)}},setAdapterNetworkState(t,e){const r=Ie.chains.get(t);r&&(r.networkState={...r.networkState||pb,...e},Ie.chains.set(t,r))},setChainAccountData(t,e,r=!0){if(!t)throw new Error("Chain is required to update chain account data");const n=Ie.chains.get(t);if(n){const s={...n.accountState||M2,...e};Ie.chains.set(t,{...n,accountState:s}),(Ie.chains.size===1||Ie.activeChain===t)&&e.caipAddress&&(Ie.activeCaipAddress=e.caipAddress)}},setChainNetworkData(t,e){if(!t)return;const r=Ie.chains.get(t);if(r){const n={...r.networkState||pb,...e};Ie.chains.set(t,{...r,networkState:n})}},setAccountProp(t,e,r,n=!0){q.setChainAccountData(r,{[t]:e},n)},setActiveNamespace(t){var n,s;Ie.activeChain=t;const e=t?Ie.chains.get(t):void 0,r=(n=e==null?void 0:e.networkState)==null?void 0:n.caipNetwork;r!=null&&r.id&&t&&(Ie.activeCaipAddress=(s=e==null?void 0:e.accountState)==null?void 0:s.caipAddress,Ie.activeCaipNetwork=r,q.setChainNetworkData(t,{caipNetwork:r}),ce.setActiveCaipNetworkId(r==null?void 0:r.caipNetworkId),Tn.set({activeChain:t,selectedNetworkId:r==null?void 0:r.caipNetworkId}))},setActiveCaipNetwork(t){var i,o;if(!t)return;const e=Ie.activeChain===t.chainNamespace;e||q.setIsSwitchingNamespace(!0);const r=Ie.chains.get(t.chainNamespace);Ie.activeChain=t.chainNamespace,Ie.activeCaipNetwork=t,q.setChainNetworkData(t.chainNamespace,{caipNetwork:t});let n=(i=r==null?void 0:r.accountState)==null?void 0:i.address;if(n)Ie.activeCaipAddress=`${t.chainNamespace}:${t.id}:${n}`;else if(e&&Ie.activeCaipAddress){const{address:a}=Rr.parseCaipAddress(Ie.activeCaipAddress);n=a,Ie.activeCaipAddress=`${t.caipNetworkId}:${n}`}else Ie.activeCaipAddress=void 0;q.setChainAccountData(t.chainNamespace,{address:n,caipAddress:Ie.activeCaipAddress}),at.resetSend(),Tn.set({activeChain:Ie.activeChain,selectedNetworkId:(o=Ie.activeCaipNetwork)==null?void 0:o.caipNetworkId}),ce.setActiveCaipNetworkId(t.caipNetworkId),!q.checkIfSupportedNetwork(t.chainNamespace)&&se.state.enableNetworkSwitch&&!se.state.allowUnsupportedChain&&!me.state.wcBasic&&q.showUnsupportedChainUI()},addCaipNetwork(t){var r;if(!t)return;const e=Ie.chains.get(t.chainNamespace);e&&((r=e==null?void 0:e.caipNetworks)==null||r.push(t))},async switchActiveNamespace(t){var s;if(!t)return;const e=t!==q.state.activeChain,r=(s=q.getNetworkData(t))==null?void 0:s.caipNetwork,n=q.getCaipNetworkByNamespace(t,r==null?void 0:r.id);e&&n&&await q.switchActiveNetwork(n)},async switchActiveNetwork(t,{throwOnFailure:e=!1}={}){var o;const r=q.state.activeChain;if(!r)throw new Error("ChainController:switchActiveNetwork - namespace is required");const n=_t.getProviderId(Ie.activeChain)==="AUTH",s=(o=q.getAccountData(r))==null?void 0:o.address,i=Y.AUTH_CONNECTOR_SUPPORTED_CHAINS.includes(t.chainNamespace);try{if(s&&t.chainNamespace===r||n&&i){const a=XL.get(t.chainNamespace);if(!a)throw new Error("Adapter not found");await a.switchNetwork({caipNetwork:t})}q.setActiveCaipNetwork(t)}catch(a){if(e)throw a}Xe.sendEvent({type:"track",event:"SWITCH_NETWORK",properties:{network:t.caipNetworkId}})},getConnectionControllerClient(t){const e=t||Ie.activeChain;if(!e)throw new Error("Chain is required to get connection controller client");const r=Ie.chains.get(e);if(!(r!=null&&r.connectionControllerClient))throw new Error("ConnectionController client not set");return r.connectionControllerClient},getNetworkProp(t,e){var n;const r=(n=Ie.chains.get(e))==null?void 0:n.networkState;if(r)return r[t]},getRequestedCaipNetworks(t){const e=Ie.chains.get(t),{approvedCaipNetworkIds:r=[],requestedCaipNetworks:n=[]}=(e==null?void 0:e.networkState)||{};return be.sortRequestedNetworks(r,n).filter(o=>o==null?void 0:o.id)},getAllRequestedCaipNetworks(){const t=[];
10return Ie.chains.forEach(e=>{if(!e.namespace)throw new Error("ChainController:getAllRequestedCaipNetworks - chainAdapter must have a namespace");const r=q.getRequestedCaipNetworks(e.namespace);t.push(...r)}),t},setRequestedCaipNetworks(t,e){q.setAdapterNetworkState(e,{requestedCaipNetworks:t});const n=q.getAllRequestedCaipNetworks().map(i=>i.chainNamespace),s=Array.from(new Set(n));pe.filterByNamespaces(s)},getAllApprovedCaipNetworkIds(){const t=[];return Ie.chains.forEach(e=>{if(!e.namespace)throw new Error("ChainController:getAllApprovedCaipNetworkIds - chainAdapter must have a namespace");const r=q.getApprovedCaipNetworkIds(e.namespace);t.push(...r)}),t},getActiveCaipNetwork(t){var e,r;return t?(r=(e=Ie.chains.get(t))==null?void 0:e.networkState)==null?void 0:r.caipNetwork:Ie.activeCaipNetwork},getActiveCaipAddress(){return Ie.activeCaipAddress},getApprovedCaipNetworkIds(t){var n;const e=Ie.chains.get(t);return((n=e==null?void 0:e.networkState)==null?void 0:n.approvedCaipNetworkIds)||[]},setApprovedCaipNetworksData(t,e){q.setAdapterNetworkState(t,e)},checkIfSupportedNetwork(t,e){var s;const r=e||((s=Ie.activeCaipNetwork)==null?void 0:s.caipNetworkId),n=q.getRequestedCaipNetworks(t);return n.length?n==null?void 0:n.some(i=>i.caipNetworkId===r):!0},checkIfSupportedChainId(t){if(!Ie.activeChain)return!0;const e=q.getRequestedCaipNetworks(Ie.activeChain);return e==null?void 0:e.some(r=>r.id===t)},checkIfSmartAccountEnabled(){var n,s;const t=Tm.caipNetworkIdToNumber((n=Ie.activeCaipNetwork)==null?void 0:n.caipNetworkId);if(!Ie.activeChain||!t)return!1;const r=((s=Ur.get(je.SMART_ACCOUNT_ENABLED_NETWORKS))==null?void 0:s.split(","))||[];return!!(r!=null&&r.includes(t.toString()))},showUnsupportedChainUI(){ft.open({view:"UnsupportedChain"})},checkIfNamesSupported(){const t=Ie.activeCaipNetwork;return!!(t!=null&&t.chainNamespace&&lt.NAMES_SUPPORTED_CHAIN_NAMESPACES.includes(t.chainNamespace))},resetNetwork(t){q.setAdapterNetworkState(t,{approvedCaipNetworkIds:void 0,supportsAllNetworks:!0})},resetAccount(t){var s,i;const e=t;if(!e)throw new Error("Chain is required to set account prop");const r=(i=(s=q.state.chains.get(e))==null?void 0:s.accountState)==null?void 0:i.preferredAccountType,n=se.state.defaultAccountTypes[e];Ie.activeCaipAddress=void 0,q.setChainAccountData(e,{smartAccountDeployed:!1,currentTab:0,caipAddress:void 0,address:void 0,balance:void 0,balanceSymbol:void 0,profileName:void 0,profileImage:void 0,addressExplorerUrl:void 0,tokenBalance:[],connectedWalletInfo:void 0,preferredAccountType:n||r,socialProvider:void 0,socialWindow:void 0,farcasterUrl:void 0,user:void 0,status:"disconnected"}),pe.removeConnectorId(e)},setIsSwitchingNamespace(t){Ie.isSwitchingNamespace=t},getFirstCaipNetworkSupportsAuthConnector(){var r,n;const t=[];let e;if(Ie.chains.forEach(s=>{Y.AUTH_CONNECTOR_SUPPORTED_CHAINS.find(i=>i===s.namespace)&&s.namespace&&t.push(s.namespace)}),t.length>0){const s=t[0];return e=s?(n=(r=Ie.chains.get(s))==null?void 0:r.caipNetworks)==null?void 0:n[0]:void 0,e}},getAccountData(t){var r;const e=t||Ie.activeChain;if(e)return(r=q.state.chains.get(e))==null?void 0:r.accountState},getNetworkData(t){var r;const e=t||Ie.activeChain;if(e)return(r=q.state.chains.get(e))==null?void 0:r.networkState},getCaipNetworkByNamespace(t,e){var s,i,o;if(!t)return;const r=q.state.chains.get(t),n=(s=r==null?void 0:r.caipNetworks)==null?void 0:s.find(a=>a.id.toString()===(e==null?void 0:e.toString()));return n||((i=r==null?void 0:r.networkState)==null?void 0:i.caipNetwork)||((o=r==null?void 0:r.caipNetworks)==null?void 0:o[0])},getRequestedCaipNetworkIds(){const t=pe.state.filterByNamespace;return(t?[Ie.chains.get(t)]:Array.from(Ie.chains.values())).flatMap(r=>(r==null?void 0:r.caipNetworks)||[]).map(r=>r.caipNetworkId)},getCaipNetworks(t){return t?q.getRequestedCaipNetworks(t):q.getAllRequestedCaipNetworks()},getCaipNetworkById(t,e){return eF.getCaipNetworks(e).find(r=>r.id.toString()===t.toString()||r.caipNetworkId.toString()===t.toString())},setLastConnectedSIWECaipNetwork(t){Ie.lastConnectedSIWECaipNetwork=t}
10,getLastConnectedSIWECaipNetwork(){return Ie.lastConnectedSIWECaipNetwork},async fetchTokenBalance(t){var o,a;const e=q.getAccountData();if(!e)return[];const r=(o=q.state.activeCaipNetwork)==null?void 0:o.caipNetworkId,n=(a=q.state.activeCaipNetwork)==null?void 0:a.chainNamespace,s=q.state.activeCaipAddress,i=s?be.getPlainAddress(s):void 0;if(q.setAccountProp("balanceLoading",!0,n),e.lastRetry&&!be.isAllowedRetry(e.lastRetry,30*lt.ONE_SEC_MS))return q.setAccountProp("balanceLoading",!1,n),[];try{if(i&&r&&n){const c=await JP.getMyTokensWithBalance();return q.setAccountProp("tokenBalance",c,n),q.setAccountProp("lastRetry",void 0,n),q.setAccountProp("balanceLoading",!1,n),c}}catch(c){q.setAccountProp("lastRetry",Date.now(),n),t==null||t(c),Bo.showError("Token Balance Unavailable")}finally{q.setAccountProp("balanceLoading",!1,n)}return[]},isCaipNetworkDisabled(t){var c;const e=t.chainNamespace,r=!!((c=q.getAccountData(e))!=null&&c.caipAddress),n=q.getAllApprovedCaipNetworkIds(),s=q.getNetworkProp("supportsAllNetworks",e)!==!1,i=pe.getConnectorId(e),o=pe.getAuthConnector(),a=i===Y.CONNECTOR_ID.AUTH&&o;return!r||s||a?!1:!(n!=null&&n.includes(t.caipNetworkId))}},q=pi(eF),GQ={onSwitchNetwork({network:t,ignoreSwitchConfirmation:e=!1}){var f,g;const r=q.state.activeCaipNetwork,n=q.state.activeChain,s=Fe.state.data;if(t.id===(r==null?void 0:r.id))return;const o=!!((f=q.getAccountData(n))!=null&&f.address),a=!!((g=q.getAccountData(t.chainNamespace))!=null&&g.address),c=t.chainNamespace!==n,l=pe.getConnectorId(n)===Y.CONNECTOR_ID.AUTH,d=Y.AUTH_CONNECTOR_SUPPORTED_CHAINS.find(h=>h===t.chainNamespace);e||l&&d?Fe.push("SwitchNetwork",{...s,network:t}):o&&c&&!a?Fe.push("SwitchActiveChain",{switchToChain:t.chainNamespace,navigateTo:"Connect",navigateWithReplace:!0,network:t}):Fe.push("SwitchNetwork",{...s,network:t})}},rs=rr({loading:!1,loadingNamespaceMap:new Map,open:!1,shake:!1,namespace:void 0}),KQ={state:rs,subscribe(t){return ln(rs,()=>t(rs))},subscribeKey(t,e){return cr(rs,t,e)},async open(t){var o,a;const e=t==null?void 0:t.namespace,r=q.state.activeChain,n=e&&e!==r,s=(o=q.getAccountData(t==null?void 0:t.namespace))==null?void 0:o.caipAddress,i=q.state.noAdapters;if(me.state.wcBasic?Ae.prefetch({fetchNetworkImages:!1,fetchConnectorImages:!1,fetchWalletRanks:!1}):await Ae.prefetch(),pe.setFilterByNamespace(t==null?void 0:t.namespace),ft.setLoading(!0,e),e&&n){const c=((a=q.getNetworkData(e))==null?void 0:a.caipNetwork)||q.getRequestedCaipNetworks(e)[0];c&&(i?(await q.switchActiveNetwork(c),Fe.push("ConnectingWalletConnectBasic")):GQ.onSwitchNetwork({network:c,ignoreSwitchConfirmation:!0}))}else se.state.manualWCControl||i&&!s?be.isMobile()?Fe.reset("AllWallets"):Fe.reset("ConnectingWalletConnectBasic"):t!=null&&t.view?Fe.reset(t.view,t.data):s?Fe.reset("Account"):Fe.reset("Connect");rs.open=!0,Tn.set({open:!0}),Xe.sendEvent({type:"track",event:"MODAL_OPEN",properties:{connected:!!s}})},close(){const t=se.state.enableEmbedded,e=!!q.state.activeCaipAddress;rs.open&&Xe.sendEvent({type:"track",event:"MODAL_CLOSE",properties:{connected:e}}),rs.open=!1,Fe.reset("Connect"),ft.clearLoading(),t?e?Fe.replace("Account"):Fe.push("Connect"):Tn.set({open:!1}),me.resetUri()},setLoading(t,e){e&&rs.loadingNamespaceMap.set(e,t),rs.loading=t,Tn.set({loading:t})},clearLoading(){rs.loadingNamespaceMap.clear(),rs.loading=!1,Tn.set({loading:!1})},shake(){rs.shake||(rs.shake=!0,setTimeout(()=>{rs.shake=!1},500))}},ft=pi(KQ),sR=Symbol("appkit.coinbaseReauthWrapped"),ZQ=5,iR=new WeakMap;function YQ(t){return typeof t=="string"&&t.toLowerCase().includes("coinbase")}function tF(t,e=0){if(!t||typeof t!="object"||e>ZQ)return!1;const r=t;return r.code===4100||typeof r.message=="string"&&r.message.includes("eth_requestAccounts")?!0:r.cause&&r.cause!==t?tF(r.cause,e+1):!1}async function JQ(t){var r;const e=(r=q.getActiveCaipNetwork("eip155"))==null?void 0:r.id;typeof e=="number"&&await t.request({method:"wallet_switchEthereumChain",params:[{chainId:`0x${e.toString(16)}`}]})}function QQ(t){const e=t;if(!t||typeof e.request!="function"||t[sR])return t;const r=iR.get(t);if(r)return r;async function n(i){try{return await e.request(i)}catch(o){if(!tF(o))throw o;return await e.request({method:"eth_requestAccounts"}),i.method==="eth_sendTransaction"&&await JQ(e),e.request(i)}}const s=new Proxy(t,{get(i,o){if(o===sR)return!0;
10if(o==="request")return n;const a=Reflect.get(i,o,i);return typeof a=="function"?a.bind(i):a}});return iR.set(t,s),s}function XQ(t){const{connectorId:e,chainNamespace:r,provider:n}=t;return r==="eip155"&&YQ(e)&&typeof n=="object"&&n!==null?QQ(n):n}const Om={id:"2b92315d-eab7-5bef-84fa-089a131333f5",name:"USD Coin",symbol:"USDC",networks:[{name:"ethereum-mainnet",display_name:"Ethereum",chain_id:"1",contract_address:"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"},{name:"polygon-mainnet",display_name:"Polygon",chain_id:"137",contract_address:"0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174"}]},oT={id:"USD",payment_method_limits:[{id:"card",min:"10.00",max:"7500.00"},{id:"ach_bank_account",min:"10.00",max:"25000.00"}]},eX={providers:tL,selectedProvider:null,error:null,purchaseCurrency:Om,paymentCurrency:oT,purchaseCurrencies:[Om],paymentCurrencies:[],quotesLoading:!1},It=rr(eX),tX={state:It,subscribe(t){return ln(It,()=>t(It))},subscribeKey(t,e){return cr(It,t,e)},setSelectedProvider(t){var e,r;if(t&&t.name==="meld"){const n=q.state.activeChain,s=n===Y.CHAIN.SOLANA?"SOL":"USDC",i=n?((r=(e=q.state.chains.get(n))==null?void 0:e.accountState)==null?void 0:r.address)??"":"",o=new URL(t.url);o.searchParams.append("publicKey",xG),o.searchParams.append("destinationCurrencyCode",s),o.searchParams.append("walletAddress",i),o.searchParams.append("externalCustomerId",se.state.projectId),It.selectedProvider={...t,url:o.toString()}}else It.selectedProvider=t},setOnrampProviders(t){if(Array.isArray(t)&&t.every(e=>typeof e=="string")){const e=t,r=tL.filter(n=>e.includes(n.name));It.providers=r}else It.providers=[]},setPurchaseCurrency(t){It.purchaseCurrency=t},setPaymentCurrency(t){It.paymentCurrency=t},setPurchaseAmount(t){aT.state.purchaseAmount=t},setPaymentAmount(t){aT.state.paymentAmount=t},async getAvailableCurrencies(){const t=await Ve.getOnrampOptions();It.purchaseCurrencies=t.purchaseCurrencies,It.paymentCurrencies=t.paymentCurrencies,It.paymentCurrency=t.paymentCurrencies[0]||oT,It.purchaseCurrency=t.purchaseCurrencies[0]||Om,await Ae.fetchCurrencyImages(t.paymentCurrencies.map(e=>e.id)),await Ae.fetchTokenImages(t.purchaseCurrencies.map(e=>e.symbol))},async getQuote(){var t,e;It.quotesLoading=!0;try{const r=await Ve.getOnrampQuote({purchaseCurrency:It.purchaseCurrency,paymentCurrency:It.paymentCurrency,amount:((t=It.paymentAmount)==null?void 0:t.toString())||"0",network:(e=It.purchaseCurrency)==null?void 0:e.symbol});return It.quotesLoading=!1,It.purchaseAmount=Number(r==null?void 0:r.purchaseAmount.amount),r}catch(r){return It.error=r.message,It.quotesLoading=!1,null}finally{It.quotesLoading=!1}},resetState(){It.selectedProvider=null,It.error=null,It.purchaseCurrency=Om,It.paymentCurrency=oT,It.purchaseCurrencies=[Om],It.paymentCurrencies=[],It.paymentAmount=void 0,It.purchaseAmount=void 0,It.quotesLoading=!1}},aT=pi(tX);var gb={exports:{}},oR;function rF(){if(oR)return gb.exports;oR=1;var t=typeof Reflect=="object"?Reflect:null,e=t&&typeof t.apply=="function"?t.apply:function(b,m,_){return Function.prototype.apply.call(b,m,_)},r;t&&typeof t.ownKeys=="function"?r=t.ownKeys:Object.getOwnPropertySymbols?r=function(b){return Object.getOwnPropertyNames(b).concat(Object.getOwnPropertySymbols(b))}:r=function(b){return Object.getOwnPropertyNames(b)};function n(E){console&&console.warn&&console.warn(E)}var s=Number.isNaN||function(b){return b!==b};function i(){i.init.call(this)}gb.exports=i,gb.exports.once=w,i.EventEmitter=i,i.prototype._events=void 0,i.prototype._eventsCount=0,i.prototype._maxListeners=void 0;var o=10;function a(E){if(typeof E!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof E)}Object.defineProperty(i,"defaultMaxListeners",{enumerable:!0,get:function(){return o},set:function(E){if(typeof E!="number"||E<0||s(E))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+E+".");o=E}}),i.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},i.prototype.setMaxListeners=function(b){if(typeof b!="number"||b<0||s(b))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+b+".");return this._maxListeners=b,this};function c(E){return E._maxListeners===void 0?i.defaultMaxListeners:E._maxListeners}i.prototype.getMaxListeners=function(){return c(this)},i.prototype.emit=function(b){for(var m=[],_=1;_<arguments.length;_++)m.push(arguments[_]);var O=b==="error",C=this._events;if(C!==void 0)O=O&&C.error===void 0;else if(!O)return!1;if(O){var S;if(m.length>0&&(S=m[0]),S instanceof Error)throw S;var T=new Error("Unhandled error."+(S?" ("+S.message+")":""));throw T.context=S,T}var N=C[b];if(N===void 0)return!1;if(typeof N=="function")e(N,this,m);else for(var R=N.length,B=h(N,R),_=0;_<R;++_)e(B[_],this,m);return!0};function u(E,b,m,_){var O,C,S;if(a(m),C=E._events,C===void 0?(C=E._events=Object.create(null),E._eventsCount=0):(C.newListener!==void 0&&(E.emit("newListener",b,m.listener?m.listener:m),C=E._events),S=C[b]),S===void 0)S=C[b]=m,++E._eventsCount;else if(typeof S=="function"?S=C[b]=_?[m,S]:[S,m]:_?S.unshift(m):S.push(m),O=c(E),O>0&&S.length>O&&!S.warned){S.warned=!0;var T=new Error("Possible EventEmitter memory leak detected. "+S.length+" "+String(b)+" listeners added. Use emitter.setMaxListeners() to increase limit");T.name="MaxListenersExceededWarning",T.emitter=E,T.type=b,T.count=S.length,n(T)}return E}i.prototype.addListener=function(b,m){return u(this,b,m,!1)},i.prototype.on=i.prototype.addListener,i.prototype.prependListener=function(b,m){return u(this,b,m,!0)};function l(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function d(E,b,m){var _={fired:!1,wrapFn:void 0,target:E,type:b,listener:m},O=l.bind(_);return O.listener=m,_.wrapFn=O,O}i.prototype.once=function(b,m){return a(m),this.on(b,d(this,b,m)),this},i.prototype.prependOnceListener=function(b,m){return a(m),this.prependListener(b,d(this,b,m)),this},i.prototype.removeListener=function(b,m){var _,O,C,S,T;if(a(m),O=this._events,O===void 0)return this;if(_=O[b],_===void 0)return this;if(_===m||_.listener===m)--this._eventsCount===0?this._events=Object.create(null):(delete O[b],O.removeListener&&this.emit
vendor: 9,276 bytes, lines 10-23
10("removeListener",b,_.listener||m));else if(typeof _!="function"){for(C=-1,S=_.length-1;S>=0;S--)if(_[S]===m||_[S].listener===m){T=_[S].listener,C=S;break}if(C<0)return this;C===0?_.shift():p(_,C),_.length===1&&(O[b]=_[0]),O.removeListener!==void 0&&this.emit("removeListener",b,T||m)}return this},i.prototype.off=i.prototype.removeListener,i.prototype.removeAllListeners=function(b){var m,_,O;if(_=this._events,_===void 0)return this;if(_.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):_[b]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete _[b]),this;if(arguments.length===0){var C=Object.keys(_),S;for(O=0;O<C.length;++O)S=C[O],S!=="removeListener"&&this.removeAllListeners(S);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(m=_[b],typeof m=="function")this.removeListener(b,m);else if(m!==void 0)for(O=m.length-1;O>=0;O--)this.removeListener(b,m[O]);return this};function f(E,b,m){var _=E._events;if(_===void 0)return[];var O=_[b];return O===void 0?[]:typeof O=="function"?m?[O.listener||O]:[O]:m?y(O):h(O,O.length)}i.prototype.listeners=function(b){return f(this,b,!0)},i.prototype.rawListeners=function(b){return f(this,b,!1)},i.listenerCount=function(E,b){return typeof E.listenerCount=="function"?E.listenerCount(b):g.call(E,b)},i.prototype.listenerCount=g;function g(E){var b=this._events;if(b!==void 0){var m=b[E];if(typeof m=="function")return 1;if(m!==void 0)return m.length}return 0}i.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]};function h(E,b){for(var m=new Array(b),_=0;_<b;++_)m[_]=E[_];return m}function p(E,b){for(;b+1<E.length;b++)E[b]=E[b+1];E.pop()}function y(E){for(var b=new Array(E.length),m=0;m<b.length;++m)b[m]=E[m].listener||E[m];return b}function w(E,b){return new Promise(function(m,_){function O(S){E.removeListener(b,C),_(S)}function C(){typeof E.removeListener=="function"&&E.removeListener("error",O),m([].slice.call(arguments))}v(E,b,C,{once:!0}),b!=="error"&&I(E,O,{once:!0})})}function I(E,b,m){typeof E.on=="function"&&v(E,"error",b,m)}function v(E,b,m,_){if(typeof E.on=="function")_.once?E.once(b,m):E.on(b,m);else if(typeof E.addEventListener=="function")E.addEventListener(b,function O(C){_.once&&E.removeEventListener(b,O),m(C)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof E)}return gb.exports}var gi=rF();const QP=W$(gi);var $2={};/*! *****************************************************************************
11Copyright (c) Microsoft Corporation.
12
13Permission to use, copy, modify, and/or distribute this software for any
14purpose with or without fee is hereby granted.
15
16THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
17REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
18AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
19INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
20LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
21OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
22PERFORMANCE OF THIS SOFTWARE.
23***************************************************************************** */var cT=function(t,e){return cT=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var s in n)n.hasOwnProperty(s)&&(r[s]=n[s])},cT(t,e)};function rX(t,e){cT(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var uT=function(){return uT=Object.assign||function(e){for(var r,n=1,s=arguments.length;n<s;n++){r=arguments[n];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},uT.apply(this,arguments)};function nX(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(t);s<n.length;s++)e.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(t,n[s])&&(r[n[s]]=t[n[s]]);return r}function sX(t,e,r,n){var s=arguments.length,i=s<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(i=(s<3?o(i):s>3?o(e,r,i):o(e,r))||i);return s>3&&i&&Object.defineProperty(e,r,i),i}function iX(t,e){return function(r,n){e(r,n,t)}}function oX(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function aX(t,e,r,n){function s(i){return i instanceof r?i:new r(function(o){o(i)})}return new(r||(r=Promise))(function(i,o){function a(l){try{u(n.next(l))}catch(d){o(d)}}function c(l){try{u(n.throw(l))}catch(d){o(d)}}function u(l){l.done?i(l.value):s(l.value).then(a,c)}u((n=n.apply(t,e||[])).next())})}function cX(t,e){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,s,i,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(u){return function(l){return c([u,l])}}function c(u){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,s&&(i=u[0]&2?s.return:u[0]?s.throw||((i=s.return)&&i.call(s),0):s.next)&&!(i=i.call(s,u[1])).done)return i;switch(s=0,i&&(u=[u[0]&2,i.value]),u[0]){case 0:case 1:i=u;break;case 4:return r.label++,{value:u[1],done:!1};case 5:r.label++,s=u[1],u=[0];continue;case 7:u=r.ops.pop(),r.trys.pop();continue;default:if(i=r.trys,!(i=i.length>0&&i[i.length-1])&&(u[0]===6||u[0]===2)){r=0;continue}if(u[0]===3&&(!i||u[1]>i[0]&&u[1]<i[3])){r.label=u[1];break}if(u[0]===6&&r.label<i[1]){r.label=i[1],i=u;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(u);break}i[2]&&r.ops.pop(),r.trys.pop();continue}u=e.call(t,r)}catch(l){u=[6,l],s=0}finally{n=i=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}function uX(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}function lX(t,e){for(var r in t)r!=="default"&&!e.hasOwnProperty(r)&&(e[r]=t[r])}function lT(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function nF(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),s,i=[],o;try{for(;(e===void 0||e-- >0)&&!(s=n.next()).done;)i.push(s.value)}catch(a){o={error:a}}finally{try{s&&!s.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return i}function dX(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(nF(arguments[e]));return t}function fX(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;for(var n=Array(t),s=0,e=0;e<r;e++)for(var i=arguments[e],o=0,a=i.length;o<a;o++,s++)n[s]=i[o];return n}function Py(t){return this instanceof Py?(this.v=t,this):new Py(t)}function hX(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),s,i=[];return s={},o("next"),o("throw"),o("return"),s[Symbol.asyncIterator]=function(){return this},s;function o(f){n[f]&&(s[f]=function(g){return new Promise(function(h,p){i.push([f,g,h,p])>1||a(f,g)})})}function a(f,g){try{c(n[f](g))}catch(h){d(i[0][3],h)}}function c(f){f.value instanceof Py?Promise.resolve(f.value.v).then(u,l):d(i[0][2],f)}function u(f){a("next",f)}function l(f){a("throw",f)}function d(f,g){f(g),i.shift(),i.length&&a(i[0][0],i[0][1])}}function pX(t){var e,r;return e={},n("next"),n("throw",function(s){throw s}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(s,i){e[s]=t[s]?function(o){return(r=!r)?{value:Py(t[s](o)),done:s==="return"}:i?i(o):o}:i}}function gX(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof lT=="function"?lT(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(i){r[i]=t[i]&&function(o){return new Promise(function(a,c){o=t[i](o),s(a,c,o.done,o.value)})}}function s(i,o,a,c){Promise.resolve(c).then(function(u){i({value:u,done:a})},o)}}function mX(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function yX(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e}function bX(t){return t&&t.__esModule?t:{default:t}}function wX(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function EX(t,e,r){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,r),r}const vX=Object.freeze(Object.defineProperty({__proto__:null,get __assign(){return uT},__asyncDelegator:pX,__asyncGenerator:hX,__asyncValues:gX,__await:Py,__awaiter:aX,__classPrivateFieldGet:wX,__classPrivateFieldSet:EX,__createBinding:uX,__decorate:sX,__exportStar:lX,__extends:rX,__generator:cX,__importDefault:bX,__importStar:yX,__makeTemplateOb
23ject:mX,__metadata:oX,__param:iX,__read:nF,__rest:nX,__spread:dX,__spreadArrays:fX,__values:lT},Symbol.toStringTag,{value:"Module"})),d0=V$(vX);var L2={},Kp={},aR;function _X(){if(aR)return Kp;aR=1,Object.defineProperty(Kp,"__esModule",{value:!0}),Kp.delay=void 0;function t(e){return new Promise(r=>{setTimeout(()=>{r(!0)},e)})}return Kp.delay=t,Kp}var el={},F2={},tl={},cR;function AX(){return cR||(cR=1,Object.defineProperty(tl,"__esModule",{value:!0}),tl.ONE_THOUSAND=tl.ONE_HUNDRED=void 0,tl.ONE_HUNDRED=100,tl.ONE_THOUSAND=1e3),tl}var H2={},uR;function CX(){return uR||(uR=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.ONE_YEAR=t.FOUR_WEEKS=t.THREE_WEEKS=t.TWO_WEEKS=t.ONE_WEEK=t.THIRTY_DAYS=t.SEVEN_DAYS=t.FIVE_DAYS=t.THREE_DAYS=t.ONE_DAY=t.TWENTY_FOUR_HOURS=t.TWELVE_HOURS=t.SIX_HOURS=t.THREE_HOURS=t.ONE_HOUR=t.SIXTY_MINUTES=t.THIRTY_MINUTES=t.TEN_MINUTES=t.FIVE_MINUTES=t.ONE_MINUTE=t.SIXTY_SECONDS=t.THIRTY_SECONDS=t.TEN_SECONDS=t.FIVE_SECONDS=t.ONE_SECOND=void 0,t.ONE_SECOND=1,t.FIVE_SECONDS=5,t.TEN_SECONDS=10,t.THIRTY_SECONDS=30,t.SIXTY_SECONDS=60,t.ONE_MINUTE=t.SIXTY_SECONDS,t.FIVE_MINUTES=t.ONE_MINUTE*5,t.TEN_MINUTES=t.ONE_MINUTE*10,t.THIRTY_MINUTES=t.ONE_MINUTE*30,t.SIXTY_MINUTES=t.ONE_MINUTE*60,t.ONE_HOUR=t.SIXTY_MINUTES,t.THREE_HOURS=t.ONE_HOUR*3,t.SIX_HOURS=t.ONE_HOUR*6,t.TWELVE_HOURS=t.ONE_HOUR*12,t.TWENTY_FOUR_HOURS=t.ONE_HOUR*24,t.ONE_DAY=t.TWENTY_FOUR_HOURS,t.THREE_DAYS=t.ONE_DAY*3,t.FIVE_DAYS=t.ONE_DAY*5,t.SEVEN_DAYS=t.ONE_DAY*7,t.THIRTY_DAYS=t.ONE_DAY*30,t.ONE_WEEK=t.SEVEN_DAYS,t.TWO_WEEKS=t.ONE_WEEK*2,t.THREE_WEEKS=t.ONE_WEEK*3,t.FOUR_WEEKS=t.ONE_WEEK*4,t.ONE_YEAR=t.ONE_DAY*365}(H2)),H2}var lR;function sF(){return lR||(lR=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=d0;e.__exportStar(AX(),t),e.__exportStar(CX(),t)}(F2)),F2}var dR;function IX(){if(dR)return el;
vendor: 21,286 bytes, line 23
23dR=1,Object.defineProperty(el,"__esModule",{value:!0}),el.fromMiliseconds=el.toMiliseconds=void 0;const t=sF();function e(n){return n*t.ONE_THOUSAND}el.toMiliseconds=e;function r(n){return Math.floor(n/t.ONE_THOUSAND)}return el.fromMiliseconds=r,el}var fR;function SX(){return fR||(fR=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=d0;e.__exportStar(_X(),t),e.__exportStar(IX(),t)}(L2)),L2}var uf={},hR;function TX(){if(hR)return uf;hR=1,Object.defineProperty(uf,"__esModule",{value:!0}),uf.Watch=void 0;class t{constructor(){this.timestamps=new Map}start(r){if(this.timestamps.has(r))throw new Error(`Watch already started for label: ${r}`);this.timestamps.set(r,{started:Date.now()})}stop(r){const n=this.get(r);if(typeof n.elapsed<"u")throw new Error(`Watch already stopped for label: ${r}`);const s=Date.now()-n.started;this.timestamps.set(r,{started:n.started,elapsed:s})}get(r){const n=this.timestamps.get(r);if(typeof n>"u")throw new Error(`No timestamp found for label: ${r}`);return n}elapsed(r){const n=this.get(r);return n.elapsed||Date.now()-n.started}}return uf.Watch=t,uf.default=t,uf}var q2={},Zp={},pR;function PX(){if(pR)return Zp;pR=1,Object.defineProperty(Zp,"__esModule",{value:!0}),Zp.IWatch=void 0;class t{}return Zp.IWatch=t,Zp}var gR;function OX(){return gR||(gR=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),d0.__exportStar(PX(),t)}(q2)),q2}var mR;function NX(){return mR||(mR=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=d0;e.__exportStar(SX(),t),e.__exportStar(TX(),t),e.__exportStar(OX(),t),e.__exportStar(sF(),t)}($2)),$2}var ye=NX();class Vd{}let xX=class extends Vd{constructor(e){super()}};const yR=ye.FIVE_SECONDS,Gd={pulse:"heartbeat_pulse"};let RX=class iF extends xX{constructor(e){super(e),this.events=new gi.EventEmitter,this.interval=yR,this.interval=(e==null?void 0:e.interval)||yR}static async init(e){const r=new iF(e);return await r.init(),r}async init(){await this.initialize()}stop(){clearInterval(this.intervalRef)}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async initialize(){this.intervalRef=setInterval(()=>this.pulse(),ye.toMiliseconds(this.interval))}pulse(){this.events.emit(Gd.pulse)}};const BX=/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,kX=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,jX=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function DX(t,e){if(t==="__proto__"||t==="constructor"&&e&&typeof e=="object"&&"prototype"in e){UX(t);return}return e}function UX(t){console.warn(`[destr] Dropping "${t}" key to prevent prototype pollution.`)}function mb(t,e={}){if(typeof t!="string")return t;if(t[0]==='"'&&t[t.length-1]==='"'&&t.indexOf("\\")===-1)return t.slice(1,-1);const r=t.trim();if(r.length<=9)switch(r.toLowerCase()){case"true":return!0;case"false":return!1;case"undefined":return;case"null":return null;case"nan":return Number.NaN;case"infinity":return Number.POSITIVE_INFINITY;case"-infinity":return Number.NEGATIVE_INFINITY}if(!jX.test(t)){if(e.strict)throw new SyntaxError("[destr] Invalid JSON");return t}try{if(BX.test(t)||kX.test(t)){if(e.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(t,DX)}return JSON.parse(t)}catch(n){if(e.strict)throw n;return t}}function MX(t){return!t||typeof t.then!="function"?Promise.resolve(t):t}function qr(t,...e){try{return MX(t(...e))}catch(r){return Promise.reject(r)}}function $X(t){const e=typeof t;return t===null||e!=="object"&&e!=="function"}function LX(t){const e=Object.getPrototypeOf(t);return!e||e.isPrototypeOf(Object)}function c_(t){if($X(t))return String(t);if(LX(t)||Array.isArray(t))return JSON.stringify(t);if(typeof t.toJSON=="function")return c_(t.toJSON());throw new Error("[unstorage] Cannot stringify value!")}const dT="base64:";function FX(t){return typeof t=="string"?t:dT+zX(t)}function HX(t){return typeof t!="string"||!t.startsWith(dT)?t:qX(t.slice(dT.length))}function qX(t){return globalThis.Buffer?bt.from(t,"base64"):Uint8Array.from(globalThis.atob(t),e=>e.codePointAt(0))}function zX(t){return globalThis.Buffer?bt.from(t).toString("base64"):globalThis.btoa(String.fromCodePoint(...t))}function as(t){var e;return t&&((e=t.split("?")[0])==null?void 0:e.replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,""))||""}function WX(...t){return as(t.join(":"))}function yb(t){return t=as(t),t?t+":":""}function VX(t,e){if(e===void 0)return!0;let r=0,n=t.indexOf(":");for(;n>-1;)r++,n=t.indexOf(":",n+1);return r<=e}function GX(t,e){return e?t.startsWith(e)&&t[t.length-1]!=="$":t[t.length-1]!=="$"}const KX="memory",ZX=()=>{const t=new Map;return{name:KX,getInstance:()=>t,hasItem(e){return t.has(e)},getItem(e){return t.get(e)??null},getItemRaw(e){return t.get(e)??null},setItem(e,r){t.set(e,r)},setItemRaw(e,r){t.set(e,r)},removeItem(e){t.delete(e)},getKeys(){return[...t.keys()]},clear(){t.clear()},dispose(){t.clear()}}};function YX(t={}){const e={mounts:{"":t.driver||ZX()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},r=u=>{for(const l of e.mountpoints)if(u.startsWith(l))return{base:l,relativeKey:u.slice(l.length),driver:e.mounts[l]};return{base:"",relativeKey:u,driver:e.mounts[""]}},n=(u,l)=>e.mountpoints.filter(d=>d.startsWith(u)||l&&u.startsWith(d)).map(d=>({relativeBase:u.length>d.length?u.slice(d.length):void 0,mountpoint:d,driver:e.mounts[d]})),s=(u,l)=>{if(e.watching){l=as(l);for(const d of e.watchListeners)d(u,l)}},i=async()=>{if(!e.watching){e.watching=!0;for(const u in e.mounts)e.unwatch[u]=await bR(e.mounts[u],s,u)}},o=async()=>{if(e.watching){for(const u in e.unwatch)await e.unwatch[u]();e.unwatch={},e.watching=!1}},a=(u,l,d)=>{const f=new Map,g=h=>{let p=f.get(h.base);return p||(p={driver:h.driver,base:h.base,items:[]},f.set(h.base,p)),p};for(const h of u){const p=typeof h=="string",y=as(p?h:h.key),w=p?void 0:h.value,I=p||!h.options?l:{...l,...h.options},v=r(y);g(v).items.push({key:y,value:w,relativeKey:v.relativeKey,options:I})}return Promise.all([...f.values()].map(h=>d(h))).then(h=>h.flat())},c={hasItem(u,l={}){u=as(u);const{relativeKey:d,driver:f}=r(u);return qr(f.hasItem,d,l)},getItem(u,l={}){u=as(u);const{relativeKey:d,driver:f}=r(u);return qr(f.getItem,d,l).then(g=>mb(g))},getItems(u,l={}){return a(u,l,d=>d.driver.getItems?qr(d.driver.getItems,d.items.map(f=>({key:f.relativeKey,options:f.options})),l).then(f=>f.map(g=>({key:WX(d.base,g.key),value:mb(g.value)}))):Promise.all(d.items.map(f=>qr(d.driver.getItem,f.relativeKey,f.options).then(g=>({key:f.key,value:mb(g)})))))},getItemRaw(u,l={}){u=as(u);const{relativeKey:d,driver:f}=r(u);return f.getItemRaw?qr(f.getItemRaw,d,l):qr(f.getItem,d,l).then(g=>HX(g))},async setItem(u,l,d={}){if(l===void 0)return c.removeItem(u);u=as(u);const{relativeKey:f,driver:g}=r(u);g.setItem&&(await qr(g.setItem,f,c_(l),d),g.watch||s("update",u))},async setItems(u,l){await a(u,l,async d=>{if(d.driver.setItems)return qr(d.driver.setItems,d.items.map(f=>({key:f.relativeKey,value:c_(f.value),options:f.options})),l);d.driver.setItem&&await Promise.all(d.items.map(f=>qr(d.driver.setItem,f.relativeKey,c_(f.value),f.options)))})},async setItemRaw(u,l,d={}){if(l===void 0)return c.removeItem(u,d);u=as(u);const{relativeKey:f,driver:g}=r(u);if(g.setItemRaw)await qr(g.setItemRaw,f,l,d);else if(g.setItem)await qr(g.setItem,f,FX(l),d);else return;g.watch||s("update",u)},async removeItem(u,l={}){typeof l=="boolean"&&(l={removeMeta:l}),u=as(u);const{relativeKey:d,driver:f}=r(u);f.removeItem&&(await qr(f.removeItem,d,l),(l.removeMeta||l.removeMata)&&await qr(f.removeItem,d+"$",l),f.watch||s("remove",u))},async getMeta(u,l={}){typeof l=="boolean"&&(l={nativeOnly:l}),u=as(u);const{relativeKey:d,driver:f}=r(u),g=Object.create(null);if(f.getMeta&&Object.assign(g,await qr(f.getMeta,d,l)),!l.nativeOnly){const h=await qr(f.getItem,d+"$",l).then(p=>mb(p));h&&typeof h=="object"&&(typeof h.atime=="string"&&(h.atime=new Date(h.atime)),typeof h.mtime=="string"&&(h.mtime=new Date(h.mtime)),Object.assign(g,h))}return g},setMeta(u,l,d={}){return this.setItem(u+"$",l,d)},removeMeta(u,l={}){return this.removeItem(u+"$",l)},async getKeys(u,l={}){var y;u=yb(u);const d=n(u,!0);let f=[];const g=[];let h=!0;for(const w of d){(y=w.driver.flags)!=null&&y.maxDepth||(h=!1);const I=await qr(w.driver.getKeys,w.relativeBase,l);for(const v of I){const E=w.mountpoint+as(v);f.some(b=>E.startsWith(b))||g.push(E)}f=[w.mountpoint,...f.filter(v=>!v.startsWith(w.mountpoint))]}const p=l.maxDepth!==void 0&&!h;return g.filter(w=>(!p||VX(w,l.maxDepth))&&GX(w,u))},async clear(u,l={}){u=yb(u),await Promise.all(n(u,!1).map(async d=>{if(d.driver.clear)return qr(d.driver.clear,d.relativeBase,l);if(d.driver.removeItem){const f=await d.driver.getKeys(d.relativeBase||"",l);return Promise.all(f.map(g=>d.driver.removeItem(g,l)))}}))},async dispose(){await Promise.all(Object.values(e.mounts).map(u=>wR(u)))},async watch(u){return await i(),e.watchListeners.push(u),async()=>{e.watchListeners=e.watchListeners.filter(l=>l!==u),e.watchListeners.length===0&&await o()}},async unwatch(){e.watchListeners=[],await o()},mount(u,l){if(u=yb(u),u&&e.mounts[u])throw new Error(`already mounted at ${u}`);return u&&(e.mountpoints.push(u),e.mountpoints.sort((d,f)=>f.length-d.length)),e.mounts[u]=l,e.watching&&Promise.resolve(bR(l,s,u)).then(d=>{e.unwatch[u]=d}).catch(console.error),c},async unmount(u,l=!0){var d,f;u=yb(u),!(!u||!e.mounts[u])&&(e.watching&&u in e.unwatch&&((f=(d=e.unwatch)[u])==null||f.call(d),delete e.unwatch[u]),l&&await wR(e.mounts[u]),e.mountpoints=e.mountpoints.filter(g=>g!==u),delete e.mounts[u])},getMount(u=""){u=as(u)+":";const l=r(u);return{driver:l.driver,base:l.base}},getMounts(u="",l={}){return u=as(u),n(u,l.parents).map(f=>({driver:f.driver,base:f.mountpoint}))},keys:(u,l={})=>c.getKeys(u,l),get:(u,l={})=>c.getItem(u,l),set:(u,l,d={})=>c.setItem(u,l,d),has:(u,l={})=>c.hasItem(u,l),del:(u,l={})=>c.removeItem(u,l),remove:(u,l={})=>c.removeItem(u,l)};return c}function bR(t,e,r){return t.watch?t.watch((n,s)=>e(n,r+s)):()=>{}}async function wR(t){typeof t.dispose=="function"&&await qr(t.dispose)}function Kd(t){return new Promise((e,r)=>{t.oncomplete=t.onsuccess=()=>e(t.result),t.onabort=t.onerror=()=>r(t.error)})}function oF(t,e){const r=indexedDB.open(t);r.onupgradeneeded=()=>r.result.createObjectStore(e);const n=Kd(r);return(s,i)=>n.then(o=>i(o.transaction(e,s).objectStore(e)))}let z2;function f0(){return z2||(z2=oF("keyval-store","keyval")),z2}function ER(t,e=f0()){return e("readonly",r=>Kd(r.get(t)))}function JX(t,e,r=f0()){return r("readwrite",n=>(n.put(e,t),Kd(n.transaction)))}function QX(t,e=f0()){return e("readwrite",r=>(r.delete(t),Kd(r.transaction)))}function XX(t=f0()){return t("readwrite",e=>(e.clear(),Kd(e.transaction)))}function eee(t,e){return t.openCursor().onsuccess=function(){this.result&&(e(this.result),this.result.continue())},Kd(t.transaction)}function tee(t=f0()){return t("readonly",e=>{if(e.getAllKeys)return Kd(e.getAllKeys());const r=[];return eee(e,n=>r.push(n.key)).then(()=>r)})}const ree=t=>JSON.stringify(t,(e,r)=>typeof r=="bigint"?r.toString()+"n":r),nee=t=>{const e=/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,r=t.replace(e,'$1"$2n"$3');return JSON.parse(r,(n,s)=>typeof s=="string"&&s.match(/^\d+n$/)?BigInt(s.substring(0,s.length-1)):s)};function xd(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return nee(t)}catch{return t}}function Rd(t){return typeof t=="string"?t:ree(t)||""}const see="idb-keyval";var iee=(t={})=>{const e=t.base&&t.base.length>0?`${t.base}:`:"",r=s=>e+s;let n;return t.dbName&&t.storeName&&(n=oF(t.dbName,t.storeName)),{name:see,options:t,async hasItem(s){return!(typeof await ER(r(s),n)>"u")},async getItem(s){return await ER(r(s),n)??null},setItem(s,i){return JX(r(s),i,n)},removeItem(s){return QX(r(s),n)},getKeys(){return tee(n)},clear(){return XX(n)}}};const oee="WALLET_CONNECT_V2_INDEXED_DB",aee="keyvaluestorage";let cee=class{constructor(){this.indexedDb=YX({driver:iee({dbName:oee,storeName:aee})})}async getKeys(){return this.indexedDb.getKeys()}async getEntries(){return(await this.indexedDb.getItems(await this.indexedDb.getKeys())).map(e=>[e.key,e.value])}async getItem(e){const r=await this.indexedDb.getItem(e);if(r!==null)return r}async setItem(e,r){await this.indexedDb.setItem(e,Rd(r))}async removeItem(e){await this.indexedDb.removeItem(e)}};var W2=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof We<"u"?We:typeof self<"u"?self:{},u_={exports:{}};(function(){let t;function e(){}t=e,t.prototype.getItem=function(r){return this.hasOwnProperty(r)?String(this[r]):null},t.prototype.setItem=function(r,n){this[r]=String(n)},t.prototype.removeItem=function(r){delete this[r]},t.prototype.clear=function(){const r=this;Object.keys(r).forEach(function(n){r[n]=void 0,delete r[n]})},t.prototype.key=function(r){return r=r||0,Object.keys(this)[r]},t.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof W2<"u"&&W2.localStorage?u_.exports=W2.localStorage:typeof window<"u"&&window.localStorage?u_.exports=window.localStorage:u_.exports=new e})();function uee(t){var e;return[t[0],xd((e=t[1])!=null?e:"")]}let lee=class{constructor(){this.localStorage=u_.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(uee)}async getItem(e){const r=this.localStorage.getItem(e);if(r!==null)return xd(r)}async setItem(e,r){this.localStorage.setItem(e,Rd(r))}async removeItem(e){this.localStorage.removeItem(e)}};const dee="wc_storage_version",vR=1,fee=async(t,e,r)=>{const n=dee,s=await e.getItem(n);if(s&&s>=vR){r(e);return}const i=await t.getKeys();if(!i.length){r(e);return}const o=[];for(;i.length;){const a=i.shift();if(!a)continue;const c=a.toLowerCase();if(c.includes("wc@")||c.includes("walletconnect")||c.includes("wc_")||c.includes("wallet_connect")){const u=await t.getItem(a);await e.setItem(a,u),o.push(a)}}await e.setItem(n,vR),r(e),hee(t,o)},hee=async(t,e)=>{e.length&&e.forEach(async r=>{await t.removeItem(r)})};let pee=class{constructor(){this.initialized=!1,this.setInitialized=r=>{this.storage=r,this.initialized=!0};const e=new lee;this.storage=e;try{const r=new cee;fee(e,r,this.setInitialized)}catch{this.initialized=!0}}async getKeys(){return await this.initialize(),this.storage.getKeys()}async getEntries(){return await this.initialize(),this.storage.getEntries()}async getItem(e){return await this.initialize(),this.storage.getItem(e)}async setItem(e,r){return await this.initialize(),this.storage.setItem(e,r)}async removeItem(e){return await this.initialize(),this.storage.removeItem(e)}async initialize(){this.initialized||await new Promise(e=>{const r=setInterval(()=>{this.initialized&&(clearInterval(r),e())},20)})}};var gee=Object.defineProperty,mee=(t,e,r)=>e in t?gee(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,_R=(t,e,r)=>mee(t,typeof e!="symbol"?e+"":e,r);let yee=class extends Vd{constructor(e){super(),this.opts=e,_R(this,"protocol","wc"),_R(this,"version",2)}};var bee=Object.defineProperty,wee=(t,e,r)=>e in t?bee(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Eee=(t,e,r)=>wee(t,e+"",r);let vee=class extends Vd{constructor(e,r){super(),this.core=e,this.logger=r,Eee(this,"records",new Map)}},_ee=class{constructor(e,r){this.logger=e,this.core=r}},Aee=class extends Vd{constructor(e,r){super(),this.relayer=e,this.logger=r}},Cee=class extends Vd{constructor(e){super()}},Iee=class{constructor(e,r,n,s){this.core=e,this.logger=r,this.name=n}},See=class extends Vd{constructor(e,r){super(),this.relayer=e,this.logger=r}},Tee=class extends Vd{constructor(e,r){super(),this.core=e,this.logger=r}},Pee=class{constructor(e,r,n){this.core=e,this.logger=r,this.store=n}},Oee=class{constructor(e,r){this.projectId=e,this.logger=r}},Nee=class{constructor(e,r,n){this.core=e,this.logger=r,this.telemetryEnabled=n}};var xee=Object.defineProperty,Ree=(t,e,r)=>e in t?xee(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,AR=(t,e,r)=>Ree(t,typeof e!="symbol"?e+"":e,r);let Bee=class{constructor(e){this.opts=e,AR(this,"protocol","wc"),AR(this,"version",2)}},kee=class{constructor(e){this.client=e}};function jee(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}function aF(t,...e){if(!jee(t))throw new Error("Uint8Array expected");if(e.length>0&&!e.includes(t.length))throw new Error("Uint8Array expected of length "+e+", got length="+t.length)}function CR(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function Dee(t,e){aF(t);const r=e.outputLen;if(t.length<r)throw new Error("digestInto() expects output buffer of length at least "+r)}const lf=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */const V2=t=>new DataView(t.buffer,t.byteOffset,t.byteLength);function Uee(t){if(typeof t!="string")throw new Error("utf8ToBytes expected string, got "+typeof t);return new Uint8Array(new TextEncoder().encode(t))}function cF(t){return typeof t=="string"&&(t=Uee(t)),aF(t),t}let Mee=class{clone(){return this._cloneInto()}};function $ee(t){const e=n=>t().update(cF(n)).digest(),r=t();return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=()=>t(),e}function uF(t=32){if(lf&&typeof lf.getRandomValues=="function")return lf.getRandomValues(new Uint8Array(t));if(lf&&typeof lf.randomBytes=="function")return lf.randomBytes(t);throw new Error("crypto.getRandomValues must be defined")}function Lee(t,e,r,n){if(typeof t.setBigUint64=="function")return t.setBigUint64(e,r,n);const s=BigInt(32),i=BigInt(4294967295),o=Number(r>>s&i),a=Number(r&i),c=n?4:0,u=n?0:4;t.setUint32(e+c,o,n),t.setUint32(e+u,a,n)}let Fee=class extends Mee{constructor(e,r,n,s){super(),this.blockLen=e,this.outputLen=r,this.padOffset=n,this.isLE=s,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=V2(this.buffer)}update(e){CR(this);const{view:r,buffer:n,blockLen:s}=this;e=cF(e);const i=e.length;for(let o=0;o<i;){const a=Math.min(s-this.pos,i-o);if(a===s){const c=V2(e);for(;s<=i-o;o+=s)this.process(c,o);continue}n.set(e.subarray(o,o+a),this.pos),this.pos+=a,o+=a,this.pos===s&&(this.process(r,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){CR(this),Dee(e,this),this.finished=!0;const{buffer:r,view:n,blockLen:s,isLE:i}=this;let{pos:o}=this;r[o++]=128,this.buffer.subarray(o).fill(0),this.padOffset>s-o&&(this.process(n,0),o=0);for(let d=o;d<s;d++)r[d]=0;Lee(n,s-8,BigInt(this.length*8),i),this.process(n,0);const a=V2(e),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const u=c/4,l=this.get();if(u>l.length)throw new Error("_sha2: outputLen bigger than state");for(let d=0;d<u;d++)a.setUint32(4*d,l[d],i)}digest(){const{buffer:e,outputLen:r}=this;this.digestInto(e);const n=e.slice(0,r);return this.destroy(),n}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:r,buffer:n,length:s,finished:i,destroyed:o,pos:a}=this;return e.length=s,e.pos=a,e.finished=i,e.destroyed=o,s%r&&e.buffer.set(n),e}};const bb=BigInt(2**32-1),fT=BigInt(32);function lF(t,e=!1){return e?{h:Number(t&bb),l:Number(t>>fT&bb)}:{h:Number(t>>fT&bb)|0,l:Number(t&bb)|0}}function Hee(t,e=!1){let r=new Uint32Array(t.length),n=new Uint32Array(t.length);for(let s=0;s<t.length;s++){const{h:i,l:o}=lF(t[s],e);[r[s],n[s]]=[i,o]}return[r,n]}const qee=(t,e)=>BigInt(t>>>0)<<fT|BigInt(e>>>0),zee=(t,e,r)=>t>>>r,Wee=(t,e,r)=>t<<32-r|e>>>r,Vee=(t,e,r)=>t>>>r|e<<32-r,Gee=(t,e,r)=>t<<32-r|e>>>r,Kee=(t,e,r)=>t<<64-r|e>>>r-32,Zee=(t,e,r)=>t>>>r-32|e<<64-r,Yee=(t,e)=>e,Jee=(t,e)=>t,Qee=(t,e,r)=>t<<r|e>>>32-r,Xee=(t,e,r)=>e<<r|t>>>32-r,ete=(t,e,r)=>e<<r-32|t>>>64-r,tte=(t,e,r)=>t<<r-32|e>>>64-r;function rte(t,e,r,n){const s=(e>>>0)+(n>>>0);return{h:t+r+(s/2**32|0)|0,l:s|0}}const nte=(t,e,r)=>(t>>>0)+(e>>>0)+(r>>>0),ste=(t,e,r,n)=>e+r+n+(t/2**32|0)|0,ite=(t,e,r,n)=>(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0),ote=(t,e,r,n,s)=>e+r+n+s+(t/2**32|0)|0,ate=(t,e,r,n,s)=>(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0)+(s>>>0),cte=(t,e,r,n,s,i)=>e+r+n+s+i+(t/2**32|0)|0,it={fromBig:lF,split:Hee,toBig:qee,shrSH:zee,shrSL:Wee,rotrSH:Vee,rotrSL:Gee,rotrBH:Kee,rotrBL:Zee,rotr32H:Yee,rotr32L:Jee,rotlSH:Qee,rotlSL:Xee,rotlBH:ete,rotlBL:tte,add:rte,add3L:nte,add3H:ste,add4L:ite,add4H:ote,add5H:cte,add5L:ate},[ute,lte]=it.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b89
236f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(t=>BigInt(t))),Cc=new Uint32Array(80),Ic=new Uint32Array(80);let dte=class extends Fee{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){const{Ah:e,Al:r,Bh:n,Bl:s,Ch:i,Cl:o,Dh:a,Dl:c,Eh:u,El:l,Fh:d,Fl:f,Gh:g,Gl:h,Hh:p,Hl:y}=this;return[e,r,n,s,i,o,a,c,u,l,d,f,g,h,p,y]}set(e,r,n,s,i,o,a,c,u,l,d,f,g,h,p,y){this.Ah=e|0,this.Al=r|0,this.Bh=n|0,this.Bl=s|0,this.Ch=i|0,this.Cl=o|0,this.Dh=a|0,this.Dl=c|0,this.Eh=u|0,this.El=l|0,this.Fh=d|0,this.Fl=f|0,this.Gh=g|0,this.Gl=h|0,this.Hh=p|0,this.Hl=y|0}process(e,r){for(let v=0;v<16;v++,r+=4)Cc[v]=e.getUint32(r),Ic[v]=e.getUint32(r+=4);for(let v=16;v<80;v++){const E=Cc[v-15]|0,b=Ic[v-15]|0,m=it.rotrSH(E,b,1)^it.rotrSH(E,b,8)^it.shrSH(E,b,7),_=it.rotrSL(E,b,1)^it.rotrSL(E,b,8)^it.shrSL(E,b,7),O=Cc[v-2]|0,C=Ic[v-2]|0,S=it.rotrSH(O,C,19)^it.rotrBH(O,C,61)^it.shrSH(O,C,6),T=it.rotrSL(O,C,19)^it.rotrBL(O,C,61)^it.shrSL(O,C,6),N=it.add4L(_,T,Ic[v-7],Ic[v-16]),R=it.add4H(N,m,S,Cc[v-7],Cc[v-16]);Cc[v]=R|0,Ic[v]=N|0}let{Ah:n,Al:s,Bh:i,Bl:o,Ch:a,Cl:c,Dh:u,Dl:l,Eh:d,El:f,Fh:g,Fl:h,Gh:p,Gl:y,Hh:w,Hl:I}=this;for(let v=0;v<80;v++){const E=it.rotrSH(d,f,14)^it.rotrSH(d,f,18)^it.rotrBH(d,f,41),b=it.rotrSL(d,f,14)^it.rotrSL(d,f,18)^it.rotrBL(d,f,41),m=d&g^~d&p,_=f&h^~f&y,O=it.add5L(I,b,_,lte[v],Ic[v]),C=it.add5H(O,w,E,m,ute[v],Cc[v]),S=O|0,T=it.rotrSH(n,s,28)^it.rotrBH(n,s,34)^it.rotrBH(n,s,39),N=it.rotrSL(n,s,28)^it.rotrBL(n,s,34)^it.rotrBL(n,s,39),R=n&i^n&a^i&a,B=s&o^s&c^o&c;w=p|0,I=y|0,p=g|0,y=h|0,g=d|0,h=f|0,{h:d,l:f}=it.add(u|0,l|0,C|0,S|0),u=a|0,l=c|0,a=i|0,c=o|0,i=n|0,o=s|0;const A=it.add3L(S,N,B);n=it.add3H(A,C,T,R),s=A|0}({h:n,l:s}=it.add(this.Ah|0,this.Al|0,n|0,s|0)),{h:i,l:o}=it.add(this.Bh|0,this.Bl|0,i|0,o|0),{h:a,l:c}=it.add(this.Ch|0,this.Cl|0,a|0,c|0),{h:u,l}=it.add(this.Dh|0,this.Dl|0,u|0,l|0),{h:d,l:f}=it.add(this.Eh|0,this.El|0,d|0,f|0),{h:g,l:h}=it.add(this.Fh|0,this.Fl|0,g|0,h|0),{h:p,l:y}=it.add(this.Gh|0,this.Gl|0,p|0,y|0),{h:w,l:I}=it.add(this.Hh|0,this.Hl|0,w|0,I|0),this.set(n,s,i,o,a,c,u,l,d,f,g,h,p,y,w,I)}roundClean(){Cc.fill(0),Ic.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}};const fte=$ee(()=>new dte);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const XP=BigInt(0),dF=BigInt(1),hte=BigInt(2);function eO(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}function tO(t){if(!eO(t))throw new Error("Uint8Array expected")}function G2(t,e){if(typeof e!="boolean")throw new Error(t+" boolean expected, got "+e)}const pte=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function rO(t){tO(t);let e="";for(let r=0;r<t.length;r++)e+=pte[t[r]];return e}function fF(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);return t===""?XP:BigInt("0x"+t)}const Jo={_0:48,_9:57,A:65,F:70,a:97,f:102};function IR(t){if(t>=Jo._0&&t<=Jo._9)return t-Jo._0;if(t>=Jo.A&&t<=Jo.F)return t-(Jo.A-10);if(t>=Jo.a&&t<=Jo.f)return t-(Jo.a-10)}function hF(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);const e=t.length,r=e/2;if(e%2)throw new Error("hex string expected, got unpadded hex of length "+e);const n=new Uint8Array(r);for(let s=0,i=0;s<r;s++,i+=2){const o=IR(t.charCodeAt(i)),a=IR(t.charCodeAt(i+1));if(o===void 0||a===void 0){const c=t[i]+t[i+1];throw new Error('hex string expected, got non-hex character "'+c+'" at index '+i)}n[s]=o*16+a}return n}function gte(t){return fF(rO(t))}function l_(t){return tO(t),fF(rO(Uint8Array.from(t).reverse()))}function pF(t,e){return hF(t.toString(16).padStart(e*2,"0"))}function hT(t,e){return pF(t,e).reverse()}function Qo(t,e,r){let n;if(typeof e=="string")try{n=hF(e)}catch(i){throw new Error(t+" must be hex string or Uint8Array, cause: "+i)}else if(eO(e))n=Uint8Array.from(e);else throw new Error(t+" must be hex string or Uint8Array");const s=n.length;if(typeof r=="number"&&s!==r)throw new Error(t+" of length "+r+" expected, got "+s);return n}function SR(...t){let e=0;for(let n=0;n<t.length;n++){const s=t[n];tO(s),e+=s.length}
vendor: 4,758 bytes, line 23
23const r=new Uint8Array(e);for(let n=0,s=0;n<t.length;n++){const i=t[n];r.set(i,s),s+=i.length}return r}const K2=t=>typeof t=="bigint"&&XP<=t;function mte(t,e,r){return K2(t)&&K2(e)&&K2(r)&&e<=t&&t<r}function Yp(t,e,r,n){if(!mte(e,r,n))throw new Error("expected valid "+t+": "+r+" <= n < "+n+", got "+e)}function yte(t){let e;for(e=0;t>XP;t>>=dF,e+=1);return e}const bte=t=>(hte<<BigInt(t-1))-dF,wte={bigint:t=>typeof t=="bigint",function:t=>typeof t=="function",boolean:t=>typeof t=="boolean",string:t=>typeof t=="string",stringOrUint8Array:t=>typeof t=="string"||eO(t),isSafeInteger:t=>Number.isSafeInteger(t),array:t=>Array.isArray(t),field:(t,e)=>e.Fp.isValid(t),hash:t=>typeof t=="function"&&Number.isSafeInteger(t.outputLen)};function nO(t,e,r={}){const n=(s,i,o)=>{const a=wte[i];if(typeof a!="function")throw new Error("invalid validator function");const c=t[s];if(!(o&&c===void 0)&&!a(c,t))throw new Error("param "+String(s)+" is invalid. Expected "+i+", got "+c)};for(const[s,i]of Object.entries(e))n(s,i,!1);for(const[s,i]of Object.entries(r))n(s,i,!0);return t}function TR(t){const e=new WeakMap;return(r,...n)=>{const s=e.get(r);if(s!==void 0)return s;const i=t(r,...n);return e.set(r,i),i}}const Yr=BigInt(0),Cr=BigInt(1),Bl=BigInt(2),Ete=BigInt(3),pT=BigInt(4),PR=BigInt(5),OR=BigInt(8);function $r(t,e){const r=t%e;return r>=Yr?r:e+r}function vte(t,e,r){if(e<Yr)throw new Error("invalid exponent, negatives unsupported");if(r<=Yr)throw new Error("invalid modulus");if(r===Cr)return Yr;let n=Cr;for(;e>Yr;)e&Cr&&(n=n*t%r),t=t*t%r,e>>=Cr;return n}function ao(t,e,r){let n=t;for(;e-- >Yr;)n*=n,n%=r;return n}function NR(t,e){if(t===Yr)throw new Error("invert: expected non-zero number");if(e<=Yr)throw new Error("invert: expected positive modulus, got "+e);let r=$r(t,e),n=e,s=Yr,i=Cr;for(;r!==Yr;){const o=n/r,a=n%r,c=s-i*o;n=r,r=a,s=i,i=c}if(n!==Cr)throw new Error("invert: does not exist");return $r(s,e)}function _te(t){const e=(t-Cr)/Bl;let r,n,s;for(r=t-Cr,n=0;r%Bl===Yr;r/=Bl,n++);for(s=Bl;s<t&&vte(s,e,t)!==t-Cr;s++)if(s>1e3)throw new Error("Cannot find square root: likely non-prime P");if(n===1){const o=(t+Cr)/pT;return function(a,c){const u=a.pow(c,o);if(!a.eql(a.sqr(u),c))throw new Error("Cannot find square root");return u}}const i=(r+Cr)/Bl;return function(o,a){if(o.pow(a,e)===o.neg(o.ONE))throw new Error("Cannot find square root");let c=n,u=o.pow(o.mul(o.ONE,s),r),l=o.pow(a,i),d=o.pow(a,r);for(;!o.eql(d,o.ONE);){if(o.eql(d,o.ZERO))return o.ZERO;let f=1;for(let h=o.sqr(d);f<c&&!o.eql(h,o.ONE);f++)h=o.sqr(h);const g=o.pow(u,Cr<<BigInt(c-f-1));u=o.sqr(g),l=o.mul(l,g),d=o.mul(d,u),c=f}return l}}function Ate(t){if(t%pT===Ete){const e=(t+Cr)/pT;return function(r,n){const s=r.pow(n,e);if(!r.eql(r.sqr(s),n))throw new Error("Cannot find square root");return s}}if(t%OR===PR){const e=(t-PR)/OR;return function(r,n){const s=r.mul(n,Bl),i=r.pow(s,e),o=r.mul(n,i),a=r.mul(r.mul(o,Bl),i),c=r.mul(o,r.sub(a,r.ONE));if(!r.eql(r.sqr(c),n))throw new Error("Cannot find square root");return c}}return _te(t)}const Cte=(t,e)=>($r(t,e)&Cr)===Cr,Ite=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Ste(t){const e={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},r=Ite.reduce((n,s)=>(n[s]="function",n),e);return nO(t,r)}function Tte(t,e,r){if(r<Yr)throw new Error("invalid exponent, negatives unsupported");if(r===Yr)return t.ONE;if(r===Cr)return e;let n=t.ONE,s=e;for(;r>Yr;)r&Cr&&(n=t.mul(n,s)),s=t.sqr(s),r>>=Cr;return n}function Pte(t,e){const r=new Array(e.length),n=e.reduce((i,o,a)=>t.is0(o)?i:(r[a]=i,t.mul(i,o)),t.ONE),s=t.inv(n);return e.reduceRight((i,o,a)=>t.is0(o)?i:(r[a]=t.mul(i,r[a]),t.mul(i,o)),s),r}function gF(t,e){const r=e!==void 0?e:t.toString(2).length,n=Math.ceil(r/8);return{nBitLength:r,nByteLength:n}}function mF(t,e,r=!1,n={}){if(t<=Yr)throw new Error("invalid field: expected ORDER > 0, got "+t);const{nBitLength:s,nByteLength:i}=gF(t,e);if(i>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let o;const a=Object.freeze({ORDER:t,isLE:r,BITS:s,BYTES:i,MASK:bte(s),ZERO:Yr,ONE:Cr,create:c=>$r(c,t),isValid:c=>{if(typeof c!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof c);return Yr<=c&&c<t},is0:c=>c===Yr,isOdd:c=>(c&Cr)===Cr,neg:c=>$r(-c,t),eql:(c,u)=>c===u,sqr:c=>$r(c*c,t),add:(c,u)=>$r(c+u,t),sub:(c,u)=>$r(c-u,t),mul:(c,u)=>$r(c*u,t),pow:(c,u)=>Tte(a,c,u),div:(c,u)=>$r(c*NR(u,t),t),sqrN:c=>c*c,addN:(c,u)=>c+u,subN:(c,u)=>c-u,mulN:(c,u)=>c*u,inv:c=>NR(c,t),sqrt:n.sqrt||(c=>(o||(o=Ate(t)),o(a,c))),invertBatch:c=>Pte(a,c),cmov:(c,u,l)=>l?u:c,toBytes:c=>r?hT(c,i):pF(c,i),fromBytes:c=>{if(c.length!==i)throw new Error("Field.fromBytes: expected "+i+" b
23ytes, got "+c.length);return r?l_(c):gte(c)}});return Object.freeze(a)}const xR=BigInt(0),wb=BigInt(1);function Z2(t,e){const r=e.negate();return t?r:e}function yF(t,e){if(!Number.isSafeInteger(t)||t<=0||t>e)throw new Error("invalid window size, expected [1.."+e+"], got W="+t)}function Y2(t,e){yF(t,e);const r=Math.ceil(e/t)+1,n=2**(t-1);return{windows:r,windowSize:n}}function Ote(t,e){if(!Array.isArray(t))throw new Error("array expected");t.forEach((r,n)=>{if(!(r instanceof e))throw new Error("invalid point at index "+n)})}function Nte(t,e){if(!Array.isArray(t))throw new Error("array of scalars expected");t.forEach((r,n)=>{if(!e.isValid(r))throw new Error("invalid scalar at index "+n)})}const J2=new WeakMap,bF=new WeakMap;function Q2(t){return bF.get(t)||1}function xte(t,e){return{constTimeNegate:Z2,hasPrecomputes(r){return Q2(r)!==1},unsafeLadder(r,n,s=t.ZERO){let i=r;for(;n>xR;)n&wb&&(s=s.add(i)),i=i.double(),n>>=wb;return s},precomputeWindow(r,n){const{windows:s,windowSize:i}=Y2(n,e),o=[];let a=r,c=a;for(let u=0;u<s;u++){c=a,o.push(c);for(let l=1;l<i;l++)c=c.add(a),o.push(c);a=c.double()}return o},wNAF(r,n,s){const{windows:i,windowSize:o}=Y2(r,e);let a=t.ZERO,c=t.BASE;const u=BigInt(2**r-1),l=2**r,d=BigInt(r);for(let f=0;f<i;f++){const g=f*o;let h=Number(s&u);s>>=d,h>o&&(h-=l,s+=wb);const p=g,y=g+Math.abs(h)-1,w=f%2!==0,I=h<0;h===0?c=c.add(Z2(w,n[p])):a=a.add(Z2(I,n[y]))}return{p:a,f:c}},wNAFUnsafe(r,n,s,i=t.ZERO){const{windows:o,windowSize:a}=Y2(r,e),c=BigInt(2**r-1),u=2**r,l=BigInt(r);for(let d=0;d<o;d++){const f=d*a;if(s===xR)break;let g=Number(s&c);if(s>>=l,g>a&&(g-=u,s+=wb),g===0)continue;let h=n[f+Math.abs(g)-1];g<0&&(h=h.negate()),i=i.add(h)}return i},getPrecomputes(r,n,s){let i=J2.get(n);return i||(i=this.precomputeWindow(n,r),r!==1&&J2.set(n,s(i))),i},wNAFCached(r,n,s){const i=Q2(r);return this.wNAF(i,this.getPrecomputes(i,r,s),n)},wNAFCachedUnsafe(r,n,s,i){const o=Q2(r);return o===1?this.unsafeLadder(r,n,i):this.wNAFUnsafe(o,this.getPrecomputes(o,r,s),n,i)},setWindowSize(r,n){yF(n,e),bF.set(r,n),J2.delete(r)}}}function Rte(t,e,r,n){if(Ote(r,t),Nte(n,e),r.length!==n.length)throw new Error("arrays of points and scalars must have equal length");const s=t.ZERO,i=yte(BigInt(r.length)),o=i>12?i-3:i>4?i-2:i?2:1,a=(1<<o)-1,c=new Array(a+1).fill(s),u=Math.floor((e.BITS-1)/o)*o;let l=s;for(let d=u;d>=0;d-=o){c.fill(s);for(let g=0;g<n.length;g++){const h=n[g],p=Number(h>>BigInt(d)&BigInt(a));c[p]=c[p].add(r[g])}let f=s;for(let g=c.length-1,h=s;g>0;g--)h=h.add(c[g]),f=f.add(h);if(l=l.add(f),d!==0)for(let g=0;g<o;g++)l=l.double()}return l}function Bte(t){return Ste(t.Fp),nO(t,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...gF(t.n,t.nBitLength),...t,p:t.Fp.ORDER})}const wi=BigInt(0),ns=BigInt(1),Eb=BigInt(2),kte=BigInt(8),jte={zip215:!0};function Dte(t){const e=Bte(t);return nO(t,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...e})}function Ute(t){const e=Dte(t),{Fp:r,n,prehash:s,hash:i,randomBytes:o,nByteLength:a,h:c}=e,u=Eb<<BigInt(a*8)-ns,l=r.create,d=mF(e.n,e.nBitLength),f=e.uvRatio||((A,P)=>{try{return{isValid:!0,value:r.sqrt(A*r.inv(P))}}catch{return{isValid:!1,value:wi}}}),g=e.adjustScalarBytes||(A=>A),h=e.domain||((A,P,k)=>{if(G2("phflag",k),P.length||k)throw new Error("Contexts/pre-hash are not supported");return A});function p(A,P){Yp("coordinate "+A,P,wi,u)}function y(A){if(!(A instanceof v))throw new Error("ExtendedPoint expected")}const w=TR((A,P)=>{const{ex:k,ey:U,ez:x}=A,j=A.is0();P==null&&(P=j?kte:r.inv(x));const D=l(k*P),M=l(U*P),L=l(x*P);if(j)return{x:wi,y:ns};if(L!==ns)throw new Error("invZ was invalid");return{x:D,y:M}}),I=TR(A=>{const{a:P,d:k}=e;if(A.is0())throw new Error("bad point: ZERO");const{ex:U,ey:x,ez:j,et:D}=A,M=l(U*U),L=l(x*x),H=l(j*j),z=l(H*H),V=l(M*P),G=l(H*l(V+L)),ee=l(z+l(k*l(M*L)));if(G!==ee)throw new Error("bad point: equation left != right (1)");const X=l(U*x),oe=l(j*D);if(X!==oe)throw new Error("bad point: equation left != right (2)");return!0});class v{constructor(P,k,U,x){this.ex=P,this.ey=k,this.ez=U,this.et=x,p("x",P),p("y",k),p("z",U),p("t",x),Object.freeze(this)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(P){if(P instanceof v)throw new Error("extended point not allowed");const{x:k,y:U}=P||{};return p("x",k),p("y",U),new v(k,U,ns,l(k*U))}static normalizeZ(P){const k=r.invertBatch(P.map(U=>U.ez));return P.map((U,x)=>U.toAffine(k[x])).map(v.fromAffine)}static msm(P,k){return Rte(v,d,P,k)}_setWindowSize(P){m.setWindowSize(this,P)}assertValidity(){I(this)}equals(P){y(P);const{ex:k,ey:U,ez:x}=this,{ex:j,ey:D,ez:M}=P,L=l(k*M),H=l(j*x),z=l(U*M),V=l(D*x);return L===H&&z===V}is0(){return this.equals(v.ZERO)}negate(){return new v(l(-this.ex),this.ey,this.ez,l(-this.et))}double(){const{a:P}=e,{ex:k,ey:U,ez:x}=this,j=l(k*k),D=l(U*U),M=l(Eb*l(x*x)),L=l(P*j),H=k+U,z=l(l(H*H)-j-D),V=L+D,G=V-M,ee=L-D,X=l(z*G),oe=l(V*ee),te=l(z*ee),fe=l(G*V);return new v(X,oe,fe,te)}add(P){y(P);const{a:k,d:U}=e,{ex:x,ey:j,ez:D,et:M}=this,{ex:L,ey:H,ez:z,et:V}=P;if(k===BigInt(-1)){const wt=l((j-x)*(H+L)),Ot=l((j+x)*(H-L)),pt=l(Ot-wt);if(pt===wi)return this.double();const nr=l(D*Eb*V),Jt=l(M*Eb*z),sr=Jt+nr,ie=Ot+wt,de=Jt-nr,Ce=l(sr*pt),ze=l(ie*de),Ut=l(sr*de),es=l(pt*ie);return new v(Ce,ze,es,Ut)}const G=l(x*L),ee=l(j*H),X=l(M*U*V),oe=l(D*z),te=l((x+j)*(L+H)-G-ee),fe=oe-X,Se=oe+X,le=l(ee-k*G),we=l(te*fe),ve=l(Se*le),ae=l(te*le),re=l(fe*Se);return new v(we,ve,re,ae)}subtract(P){return this.add(P.negate())}wNAF(P){return m.wNAFCached(this,P,v.normalizeZ)}multiply(P){const k=P;Yp("scalar",k,ns,n);const{p:U,f:x}=this.wNAF(k);return v.normalizeZ([U,x])[0]}multiplyUnsafe(P,k=v.ZERO){const U=P;return Yp("scalar",U,wi,n),U===wi?b:this.is0()||U===ns?this:m.wNAFCachedUnsafe(this,U,v.normalizeZ,k)}isSmallOrder(){return this.multiplyUnsafe(c).is0()}isTorsionFree(){return m.unsafeLadder(this,n).is0()}toAffine(P){return w(this,P)}clearCofactor(){const{h:P}=e;return P===ns?this:this.multiplyUnsafe(P)}static fromHex(P,k=!1){const{d:U,a:x}=e,j=r.BYTES;P=Qo("pointHex",P,j),G2("zip215",k);const D=P.slice(),M=P[j-1];D[j-1]=M&-129;const L=l_(D),H=k?u:r.ORDER;Yp("pointHex.y",L,wi,H);const z=l(L*L),V=l(z-ns),G=l(U*z-x);let{isValid:ee,value:X}=f(V,G);
vendor: 10,337 bytes, line 23
23if(!ee)throw new Error("Point.fromHex: invalid y coordinate");const oe=(X&ns)===ns,te=(M&128)!==0;if(!k&&X===wi&&te)throw new Error("Point.fromHex: x=0 and x_0=1");return te!==oe&&(X=l(-X)),v.fromAffine({x:X,y:L})}static fromPrivateKey(P){return C(P).point}toRawBytes(){const{x:P,y:k}=this.toAffine(),U=hT(k,r.BYTES);return U[U.length-1]|=P&ns?128:0,U}toHex(){return rO(this.toRawBytes())}}v.BASE=new v(e.Gx,e.Gy,ns,l(e.Gx*e.Gy)),v.ZERO=new v(wi,ns,ns,wi);const{BASE:E,ZERO:b}=v,m=xte(v,a*8);function _(A){return $r(A,n)}function O(A){return _(l_(A))}function C(A){const P=r.BYTES;A=Qo("private key",A,P);const k=Qo("hashed private key",i(A),2*P),U=g(k.slice(0,P)),x=k.slice(P,2*P),j=O(U),D=E.multiply(j),M=D.toRawBytes();return{head:U,prefix:x,scalar:j,point:D,pointBytes:M}}function S(A){return C(A).pointBytes}function T(A=new Uint8Array,...P){const k=SR(...P);return O(i(h(k,Qo("context",A),!!s)))}function N(A,P,k={}){A=Qo("message",A),s&&(A=s(A));const{prefix:U,scalar:x,pointBytes:j}=C(P),D=T(k.context,U,A),M=E.multiply(D).toRawBytes(),L=T(k.context,M,j,A),H=_(D+L*x);Yp("signature.s",H,wi,n);const z=SR(M,hT(H,r.BYTES));return Qo("result",z,r.BYTES*2)}const R=jte;function B(A,P,k,U=R){const{context:x,zip215:j}=U,D=r.BYTES;A=Qo("signature",A,2*D),P=Qo("message",P),k=Qo("publicKey",k,D),j!==void 0&&G2("zip215",j),s&&(P=s(P));const M=l_(A.slice(D,2*D));let L,H,z;try{L=v.fromHex(k,j),H=v.fromHex(A.slice(0,D),j),z=E.multiplyUnsafe(M)}catch{return!1}if(!j&&L.isSmallOrder())return!1;const V=T(x,H.toRawBytes(),L.toRawBytes(),P);return H.add(L.multiplyUnsafe(V)).subtract(z).clearCofactor().equals(v.ZERO)}return E._setWindowSize(8),{CURVE:e,getPublicKey:S,sign:N,verify:B,ExtendedPoint:v,utils:{getExtendedPublicKey:C,randomPrivateKey:()=>o(r.BYTES),precompute(A=8,P=v.BASE){return P._setWindowSize(A),P.multiply(BigInt(3)),P}}}}BigInt(0),BigInt(1);const sO=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),RR=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");BigInt(0);const Mte=BigInt(1),BR=BigInt(2);BigInt(3);const $te=BigInt(5),Lte=BigInt(8);function Fte(t){const e=BigInt(10),r=BigInt(20),n=BigInt(40),s=BigInt(80),i=sO,o=t*t%i*t%i,a=ao(o,BR,i)*o%i,c=ao(a,Mte,i)*t%i,u=ao(c,$te,i)*c%i,l=ao(u,e,i)*u%i,d=ao(l,r,i)*l%i,f=ao(d,n,i)*d%i,g=ao(f,s,i)*f%i,h=ao(g,s,i)*f%i,p=ao(h,e,i)*u%i;return{pow_p_5_8:ao(p,BR,i)*t%i,b2:o}}function Hte(t){return t[0]&=248,t[31]&=127,t[31]|=64,t}function qte(t,e){const r=sO,n=$r(e*e*e,r),s=$r(n*n*e,r),i=Fte(t*s).pow_p_5_8;let o=$r(t*n*i,r);const a=$r(e*o*o,r),c=o,u=$r(o*RR,r),l=a===t,d=a===$r(-t,r),f=a===$r(-t*RR,r);return l&&(o=c),(d||f)&&(o=u),Cte(o,r)&&(o=$r(-o,r)),{isValid:l||d,value:o}}const zte=mF(sO,void 0,!0),Wte={a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:zte,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:Lte,Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:fte,randomBytes:uF,adjustScalarBytes:Hte,uvRatio:qte},wF=Ute(Wte),Vte="EdDSA",Gte="JWT",H_=".",UA="base64url",EF="utf8",vF="utf8",Kte=":",Zte="did",Yte="key",kR="base58btc",Jte="z",Qte="K36",Xte=32;function iO(t){return globalThis.Buffer!=null?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t}function _F(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?iO(globalThis.Buffer.allocUnsafe(t)):new Uint8Array(t)}function AF(t,e){e||(e=t.reduce((s,i)=>s+i.length,0));const r=_F(e);let n=0;for(const s of t)r.set(s,n),n+=s.length;return iO(r)}function ere(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var s=0;s<t.length;s++){var i=t.charAt(s),o=i.charCodeAt(0);if(r[o]!==255)throw new TypeError(i+" is ambiguous");r[o]=s}var a=t.length,c=t.charAt(0),u=Math.log(a)/Math.log(256),l=Math.log(256)/Math.log(a);function d(h){if(h instanceof Uint8Array||(ArrayBuffer.isView(h)?h=new Uint8Array(h.buffer,h.byteOffset,h.byteLength):Array.isArray(h)&&(h=Uint8Array.from(h))),!(h instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(h.length===0)return"";for(var p=0,y=0,w=0,I=h.length;w!==I&&h[w]===0;)w++,p++;for(var v=(I-w)*l+1>>>0,E=new Uint8Array(v);w!==I;){for(var b=h[w],m=0,_=v-1;(b!==0||m<y)&&_!==-1;_--,m++)b+=256*E[_]>>>0,E[_]=b%a>>>0,b=b/a>>>0;if(b!==0)throw new Error("Non-zero carry");y=m,w++}for(var O=v-y;O!==v&&E[O]===0;)O++;for(var C=c.repeat(p);O<v;++O)C+=t.charAt(E[O]);return C}function f(h){if(typeof h!="string")throw new TypeError("Expected String");if(h.length===0)return new Uint8Array;var p=0;if(h[p]!==" "){for(var y=0,w=0;h[p]===c;)y++,p++;for(var I=(h.length-p)*u+1>>>0,v=new Uint8Array(I);h[p];){var E=r[h.charCodeAt(p)];if(E===255)return;for(var b=0,m=I-1;(E!==0||b<w)&&m!==-1;m--,b++)E+=a*v[m]>>>0,v[m]=E%256>>>0,E=E/256>>>0;if(E!==0)throw new Error("Non-zero carry");w=b,p++}if(h[p]!==" "){for(var _=I-w;_!==I&&v[_]===0;)_++;for(var O=new Uint8Array(y+(I-_)),C=y;_!==I;)O[C++]=v[_++];return O}}}function g(h){var p=f(h);if(p)return p;throw new Error(`Non-${e} character`)}return{encode:d,decodeUnsafe:f,decode:g}}var tre=ere,rre=tre;const CF=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},nre=t=>new TextEncoder().encode(t),sre=t=>new TextDecoder().decode(t);let ire=class{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},ore=class{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return IF(this,e)}},are=class{constructor(e){this.decoders=e}or(e){return IF(this,e)}decode(e){const r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};const IF=(t,e)=>new are({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}});let cre=class{constructor(e,r,n,s){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=s,this.encoder=new ire(e,r,n),this.decoder=new ore(e,r,s)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};const MA=({name:t,prefix:e,encode:r,decode:n})=>new cre(t,e,r,n),h0=({prefix:t,name:e,alphabet:r})=>{const{encode:n,decode:s}=rre(r,e);return MA({prefix:t,name:e,encode:n,decode:i=>CF(s(i))})},ure=(t,e,r,n)=>{const s={};for(let l=0;l<e.length;++l)s[e[l]]=l;let i=t.length;for(;t[i-1]==="=";)--i;const o=new Uint8Array(i*r/8|0);let a=0,c=0,u=0;for(let l=0;l<i;++l){const d=s[t[l]];if(d===void 0)throw new SyntaxError(`Non-${n} character`);c=c<<r|d,a+=r,a>=8&&(a-=8,o[u++]=255&c>>a)}if(a>=r||255&c<<8-a)throw new SyntaxError("Unexpected end of data");return o},lre=(t,e,r)=>{const n=e[e.length-1]==="=",s=(1<<r)-1;let i="",o=0,a=0;for(let c=0;c<t.length;++c)for(a=a<<8|t[c],o+=8;o>r;)o-=r,i+=e[s&a>>o];if(o&&(i+=e[s&a<<r-o]),n)for(;i.length*r&7;)i+="=";return i},dn=({name:t,prefix:e,bitsPerChar:r,alphabet:n})=>MA({prefix:e,name:t,encode(s){return lre(s,n,r)},decode(s){return ure(s,n,r,t)}}),dre=MA({prefix:"\0",name:"identity",encode:t=>sre(t),decode:t=>nre(t)});var fre=Object.freeze({__proto__:null,identity:dre});const hre=dn({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var pre=Object.freeze({__proto__:null,base2:hre});const gre=dn({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var mre=Object.freeze({__proto__:null,base8:gre});const yre=h0({prefix:"9",name:"base10",alphabet:"0123456789"});var bre=Object.freeze({__proto__:null,base10:yre});const wre=dn({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Ere=dn({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var vre=Object.freeze({__proto__:null,base16:wre,base16upper:Ere});const _re=dn({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Are=dn({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Cre=dn({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Ire=dn({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Sre=dn({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Tre=dn({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Pre=dn({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Ore=dn({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Nre=dn({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var xre=Object.freeze({__proto__:null,base32:_re,base32upper:Are,base32pad:Cre,base32padupper:Ire,base32hex:Sre,base32hexupper:Tre,base32hexpad:Pre,base32hexpadupper:Ore,base32z:Nre});const Rre=h0({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Bre=h0({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var kre=Object.freeze({__proto__:null,base36:Rre,base36upper:Bre});const jre=h0({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Dre=h0({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Ure=Object.freeze({__proto__:null,base58btc:jre,base58flickr:Dre});const Mre=dn({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
23+/",bitsPerChar:6}),$re=dn({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Lre=dn({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Fre=dn({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var Hre=Object.freeze({__proto__:null,base64:Mre,base64pad:$re,base64url:Lre,base64urlpad:Fre});const SF=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),qre=SF.reduce((t,e,r)=>(t[r]=e,t),[]),zre=SF.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function Wre(t){return t.reduce((e,r)=>(e+=qre[r],e),"")}function Vre(t){const e=[];for(const r of t){const n=zre[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}const Gre=MA({prefix:"🚀",name:"base256emoji",encode:Wre,decode:Vre});var Kre=Object.freeze({__proto__:null,base256emoji:Gre}),Zre=TF,jR=128,Yre=-128,Jre=Math.pow(2,31);function TF(t,e,r){e=e||[],r=r||0;for(var n=r;t>=Jre;)e[r++]=t&255|jR,t/=128;for(;t&Yre;)e[r++]=t&255|jR,t>>>=7;return e[r]=t|0,TF.bytes=r-n+1,e}var Qre=gT,Xre=128,DR=127;function gT(t,n){var r=0,n=n||0,s=0,i=n,o,a=t.length;do{if(i>=a)throw gT.bytes=0,new RangeError("Could not decode varint");o=t[i++],r+=s<28?(o&DR)<<s:(o&DR)*Math.pow(2,s),s+=7}while(o>=Xre);return gT.bytes=i-n,r}var ene=Math.pow(2,7),tne=Math.pow(2,14),rne=Math.pow(2,21),nne=Math.pow(2,28),sne=Math.pow(2,35),ine=Math.pow(2,42),one=Math.pow(2,49),ane=Math.pow(2,56),cne=Math.pow(2,63),une=function(t){return t<ene?1:t<tne?2:t<rne?3:t<nne?4:t<sne?5:t<ine?6:t<one?7:t<ane?8:t<cne?9:10},lne={encode:Zre,decode:Qre,encodingLength:une},PF=lne;const UR=(t,e,r=0)=>(PF.encode(t,e,r),e),MR=t=>PF.encodingLength(t),mT=(t,e)=>{const r=e.byteLength,n=MR(t),s=n+MR(r),i=new Uint8Array(s+r);return UR(t,i,0),UR(r,i,n),i.set(e,s),new dne(t,r,e,i)};let dne=class{constructor(e,r,n,s){this.code=e,this.size=r,this.digest=n,this.bytes=s}};const OF=({name:t,code:e,encode:r})=>new fne(t,e,r);let fne=class{constructor(e,r,n){this.name=e,this.code=r,this.encode=n}digest(e){if(e instanceof Uint8Array){const r=this.encode(e);return r instanceof Uint8Array?mT(this.code,r):r.then(n=>mT(this.code,n))}else throw Error("Unknown type, must be binary type")}};const NF=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),hne=OF({name:"sha2-256",code:18,encode:NF("SHA-256")}),pne=OF({name:"sha2-512",code:19,encode:NF("SHA-512")});var gne=Object.freeze({__proto__:null,sha256:hne,sha512:pne});const xF=0,mne="identity",RF=CF,yne=t=>mT(xF,RF(t)),bne={code:xF,name:mne,encode:RF,digest:yne};var wne=Object.freeze({__proto__:null,identity:bne});new TextEncoder,new TextDecoder;const $R={...fre,...pre,...mre,...bre,...vre,...xre,...kre,...Ure,...Hre,...Kre};({...gne,...wne});function BF(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}const LR=BF("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),X2=BF("ascii","a",t=>{let e="a";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return e},t=>{t=t.substring(1);const e=_F(t.length);for(let r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return e}),kF={utf8:LR,"utf-8":LR,hex:$R.base16,latin1:X2,ascii:X2,binary:X2,...$R};function $A(t,e="utf8"){const r=kF[e];if(!r)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(t.buffer,t.byteOffset,t.byteLength).toString("utf8"):r.encoder.encode(t).substring(1)}function Op(t,e="utf8"){const r=kF[e];if(!r)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?iO(globalThis.Buffer.from(t,"utf-8")):r.decoder.decode(`${r.prefix}${t}`)}function FR(t){return xd($A(Op(t,UA),EF))}function q_(t){return $A(Op(Rd(t),EF),UA)}function jF(t){const e=Op(Qte,kR),r=Jte+$A(AF([e,t]),kR);return[Zte,Yte,r].join(Kte)}function Ene(t){return $A(t,UA)}function vne(t){return Op(t,UA)}function _ne(t){return Op([q_(t.header),q_(t.payload)].join(H_),vF)}function Ane(t){return[q_(t.header),q_(t.payload),Ene(t.signature)].join(H_)}function yT(t){const e=t.split(H_),r=FR(e[0]),n=FR(e[1]),s=vne(e[2]),i=Op(e.slice(0,2).join(H_),vF);return{header:r,payload:n,signature:s,data:i}}function HR(t=uF(Xte)){const e=wF.getPublicKey(t);return{secretKey:AF([t,e]),publicKey:e}}async function Cne(t,e,r,n,s=ye.fromMiliseconds(Date.now())){const i={alg:Vte,typ:Gte},o=jF(n.publicKey),a=s+r,c={iss:o,sub:t,aud:e,iat:s,exp:a},u=_ne({header:i,payload:c}),l=wF.sign(u,n.secretKey.slice(0,32));return Ane({header:i,payload:c,signature:l})}var qR=function(t,e,r){if(r||arguments.length===2)for(var n=0,s=e.length,i;n<s;n++)(i||!(n in e))&&(i||(i=Array.prototype.slice.call(e,0,n)),i[n]=e[n]);return t.concat(i||Array.prototype.slice.call(e))},Ine=function(){function t(e,r,n){this.name=e,this.version=r,this.os=n,this.type="browser"}return t}(),Sne=function(){function t(e){this.version=e,this.type="node",this.name="node",this.os=Qr.platform}return t}(),Tne=function(){function t(e,r,n,s){this.name=e,this.version=r,this.os=n,this.bot=s,this.type="bot-device"}return t}(),Pne=function(){function t(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null}return t}(),One=function(){function t(){this.type="react-native",this.name="react-native",this.version=null,this.os=null}return t}(),Nne=/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yaho
vendor: 8,833 bytes, lines 23-24
23o!|yandex/,xne=/(nuhk|curl|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,zR=3,Rne=[["aol",/AOLShield\/([0-9\._]+)/],["edge",/Edge\/([0-9\._]+)/],["edge-ios",/EdgiOS\/([0-9\._]+)/],["yandexbrowser",/YaBrowser\/([0-9\._]+)/],["kakaotalk",/KAKAOTALK\s([0-9\.]+)/],["samsung",/SamsungBrowser\/([0-9\.]+)/],["silk",/\bSilk\/([0-9._-]+)\b/],["miui",/MiuiBrowser\/([0-9\.]+)$/],["beaker",/BeakerBrowser\/([0-9\.]+)/],["edge-chromium",/EdgA?\/([0-9\.]+)/],["chromium-webview",/(?!Chrom.*OPR)wv\).*Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["chrome",/(?!Chrom.*OPR)Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["phantomjs",/PhantomJS\/([0-9\.]+)(:?\s|$)/],["crios",/CriOS\/([0-9\.]+)(:?\s|$)/],["firefox",/Firefox\/([0-9\.]+)(?:\s|$)/],["fxios",/FxiOS\/([0-9\.]+)/],["opera-mini",/Opera Mini.*Version\/([0-9\.]+)/],["opera",/Opera\/([0-9\.]+)(?:\s|$)/],["opera",/OPR\/([0-9\.]+)(:?\s|$)/],["pie",/^Microsoft Pocket Internet Explorer\/(\d+\.\d+)$/],["pie",/^Mozilla\/\d\.\d+\s\(compatible;\s(?:MSP?IE|MSInternet Explorer) (\d+\.\d+);.*Windows CE.*\)$/],["netfront",/^Mozilla\/\d\.\d+.*NetFront\/(\d.\d)/],["ie",/Trident\/7\.0.*rv\:([0-9\.]+).*\).*Gecko$/],["ie",/MSIE\s([0-9\.]+);.*Trident\/[4-7].0/],["ie",/MSIE\s(7\.0)/],["bb10",/BB10;\sTouch.*Version\/([0-9\.]+)/],["android",/Android\s([0-9\.]+)/],["ios",/Version\/([0-9\._]+).*Mobile.*Safari.*/],["safari",/Version\/([0-9\._]+).*Safari/],["facebook",/FB[AS]V\/([0-9\.]+)/],["instagram",/Instagram\s([0-9\.]+)/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Mobile/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Gecko\)$/],["curl",/^curl\/([0-9\.]+)$/],["searchbot",Nne]],WR=[["iOS",/iP(hone|od|ad)/],["Android OS",/Android/],["BlackBerry OS",/BlackBerry|BB10/],["Windows Mobile",/IEMobile/],["Amazon OS",/Kindle/],["Windows 3.11",/Win16/],["Windows 95",/(Windows 95)|(Win95)|(Windows_95)/],["Windows 98",/(Windows 98)|(Win98)/],["Windows 2000",/(Windows NT 5.0)|(Windows 2000)/],["Windows XP",/(Windows NT 5.1)|(Windows XP)/],["Windows Server 2003",/(Windows NT 5.2)/],["Windows Vista",/(Windows NT 6.0)/],["Windows 7",/(Windows NT 6.1)/],["Windows 8",/(Windows NT 6.2)/],["Windows 8.1",/(Windows NT 6.3)/],["Windows 10",/(Windows NT 10.0)/],["Windows ME",/Windows ME/],["Windows CE",/Windows CE|WinCE|Microsoft Pocket Internet Explorer/],["Open BSD",/OpenBSD/],["Sun OS",/SunOS/],["Chrome OS",/CrOS/],["Linux",/(Linux)|(X11)/],["Mac OS",/(Mac_PowerPC)|(Macintosh)/],["QNX",/QNX/],["BeOS",/BeOS/],["OS/2",/OS\/2/]];function Bne(t){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new One:typeof navigator<"u"?jne(navigator.userAgent):Une()}function kne(t){return t!==""&&Rne.reduce(function(e,r){var n=r[0],s=r[1];if(e)return e;var i=s.exec(t);return!!i&&[n,i]},!1)}function jne(t){var e=kne(t);if(!e)return null;var r=e[0],n=e[1];if(r==="searchbot")return new Pne;var s=n[1]&&n[1].split(".").join("_").split("_").slice(0,3);s?s.length<zR&&(s=qR(qR([],s,!0),Mne(zR-s.length),!0)):s=[];var i=s.join("."),o=Dne(t),a=xne.exec(t);return a&&a[1]?new Tne(r,i,o,a[1]):new Ine(r,i,o)}function Dne(t){for(var e=0,r=WR.length;e<r;e++){var n=WR[e],s=n[0],i=n[1],o=i.exec(t);if(o)return s}return null}function Une(){var t=typeof Qr<"u"&&Qr.version;return t?new Sne(Qr.version.slice(1)):null}function Mne(t){for(var e=[],r=0;r<t;r++)e.push("0");return e}var $t={},VR;function DF(){if(VR)return $t;VR=1,Object.defineProperty($t,"__esModule",{value:!0}),$t.getLocalStorage=$t.getLocalStorageOrThrow=$t.getCrypto=$t.getCryptoOrThrow=$t.getLocation=$t.getLocationOrThrow=$t.getNavigator=$t.getNavigatorOrThrow=$t.getDocument=$t.getDocumentOrThrow=$t.getFromWindowOrThrow=$t.getFromWindow=void 0;function t(f){let g;return typeof window<"u"&&typeof window[f]<"u"&&(g=window[f]),g}$t.getFromWindow=t;function e(f){const g=t(f);if(!g)throw new Error(`${f} is not defined in Window`);return g}$t.getFromWindowOrThrow=e;function r(){return e("document")}$t.getDocumentOrThrow=r;function n(){return t("document")}$t.getDocument=n;function s(){return e("navigator")}$t.getNavigatorOrThrow=s;function i(){return t("navigator")}$t.getNavigator=i;function o(){return e("location")}$t.getLocationOrThrow=o;function a(){return t("location")}$t.getLocation=a;function c(){return e("crypto")}$t.getCryptoOrThrow=c;function u(){return t("crypto")}$t.getCrypto=u;function l(){return e("localStorage")}$t.getLocalStorageOrThrow=l;function d(){return t("localStorage")}return $t.getLocalStorage=d,$t}var ac=DF(),Jp={},GR;function $ne(){if(GR)return Jp;GR=1,Object.defineProperty(Jp,"__esModule",{value:!0}),Jp.getWindowMetadata=void 0;const t=DF();function e(){let r,n;try{r=t.getDocumentOrThrow(),n=t.getLocationOrThrow()}catch{return null}function s(){const g=r.getElementsByTagName("link"),h=[];for(let p=0;p<g.length;p++){const y=g[p],w=y.getAttribute("rel");if(w&&w.toLowerCase().indexOf("icon")>-1){const I=y.getAttribute("href");if(I)if(I.toLowerCase().indexOf("https:")===-1&&I.toLowerCase().indexOf("http:")===-1&&I.indexOf("//")!==0){let v=n.protocol+"//"+n.host;if(I.indexOf("/")===0)v+=I;else{const E=n.pathname.split("/");E.pop();const b=E.join("/");v+=b+"/"+I}h.push(v)}else if(I.indexOf("//")===0){const v=n.protocol+I;h.push(v)}else h.push(I)}}return h}function i(...g){const h=r.getElementsByTagName("meta");for(let p=0;p<h.length;p++){const y=h[p],w=["itemprop","property","name"].map(I=>y.getAttribute(I)).filter(I=>I?g.includes(I):!1);if(w.length&&w){const I=y.getAttribute("content");if(I)return I}}return""}function o(){let g=i("name","og:site_name","og:title","twitter:title");return g||(g=r.title),g}function a(){return i("description","og:description","twitter:description","keywords")}const c=o(),u=a(),l=n.origin,d=s();return{description:u,url:l,icons:d,name:c}}return Jp.getWindowMetadata=e,Jp}var Lne=$ne();const Fne="0.1.1";function Hne(){return Fne}class ur extends Error{constructor(e,r={}){const n=(()=>{var c;if(r.cause instanceof ur){if(r.cause.details)return r.cause.details;if(r.cause.shortMessage)return r.cause.shortMessage}return r.cause&&"details"in r.cause&&typeof r.cause.details=="string"?r.cause.details:(c=r.cause)!=null&&c.message?r.cause.message:r.details})(),s=r.cause instanceof ur&&r.cause.docsPath||r.docsPath,o=`https://oxlib.sh${s??""}`,a=[e||"An error occurred.",...r.metaMessages?["",...r.metaMessages]:[],...n||s?["",n?`Details: ${n}`:void 0,s?`See: ${o}`:void 0]:[]].filter(c=>typeof c=="string").join(`
24`);super(a,r.cause?{cause:r.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:`ox@${Hne()}`}),this.cause=r.cause,this.details=n,this.docs=o,this.docsPath=s,this.shortMessage=e}walk(e){return UF(this,e)}}function UF(t,e){return e!=null&&e(t)?t:t&&typeof t=="object"&&"cause"in t&&t.cause?UF(t.cause,e):e?null:t}function qne(t,e){if(JR(t)>e)throw new lse({givenSize:JR(t),maxSize:e})}const Xo={zero:48,nine:57,A:65,F:70,a:97,f:102};function KR(t){if(t>=Xo.zero&&t<=Xo.nine)return t-Xo.zero;if(t>=Xo.A&&t<=Xo.F)return t-(Xo.A-10);if(t>=Xo.a&&t<=Xo.f)return t-(Xo.a-10)}function zne(t,e={}){const{dir:r,size:n=32}=e;if(n===0)return t;if(t.length>n)throw new dse({size:t.length,targetSize:n,type:"Bytes"});const s=new Uint8Array(n);for(let i=0;i<n;i++){const o=r==="right";s[o?i:n-i-1]=t[o?i:t.length-i-1]}return s}function MF(t,e){if(Bu(t)>e)throw new ese({givenSize:Bu(t),maxSize:e})}function Wne(t,e){if(typeof e=="number"&&e>0&&e>Bu(t)-1)throw new FF({offset:e,position:"start",size:Bu(t)})}function Vne(t,e,r){if(typeof e=="number"&&typeof r=="number"&&Bu(t)!==r-e)throw new FF({offset:r,position:"end",size:Bu(t)})}function $F(t,e={}){const{dir:r,size:n=32}=e;if(n===0)return t;const s=t.replace("0x","");if(s.length>n*2)throw new tse({size:Math.ceil(s.length/2),targetSize:n,type:"Hex"});return`0x${s[r==="right"?"padEnd":"padStart"](n*2,"0")}`}const Gne="#__bigint";function oO(t,e,r){return JSON.stringify(t,(n,s)=>typeof s=="bigint"?s.toString()+Gne:s,r)}const Kne=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function Zne(t,e={}){const{strict:r=!1}=e;if(!t)throw new ZR(t);if(typeof t!="string")throw new ZR(t);if(r&&!/^0x[0-9a-fA-F]*$/.test(t))throw new YR(t);if(!t.startsWith("0x"))throw new YR(t)}function Yne(...t){return`0x${t.reduce((e,r)=>e+r.replace("0x",""),"")}`}
vendor: 8,457 bytes, line 24
24function aO(t){return t instanceof Uint8Array?z_(t):Array.isArray(t)?z_(new Uint8Array(t)):t}function z_(t,e={}){let r="";for(let s=0;s<t.length;s++)r+=Kne[t[s]];const n=`0x${r}`;return typeof e.size=="number"?(MF(n,e.size),LF(n,e.size)):n}function eI(t,e={}){const{signed:r,size:n}=e,s=BigInt(t);let i;n?r?i=(1n<<BigInt(n)*8n-1n)-1n:i=2n**(BigInt(n)*8n)-1n:typeof t=="number"&&(i=BigInt(Number.MAX_SAFE_INTEGER));const o=typeof i=="bigint"&&r?-i-1n:0;if(i&&s>i||s<o){const u=typeof t=="bigint"?"n":"";throw new Xne({max:i?`${i}${u}`:void 0,min:`${o}${u}`,signed:r,size:n,value:`${t}${u}`})}const c=`0x${(r&&s<0?(1n<<BigInt(n*8))+BigInt(s):s).toString(16)}`;return n?Jne(c,n):c}function Jne(t,e){return $F(t,{dir:"left",size:e})}function LF(t,e){return $F(t,{dir:"right",size:e})}function Oa(t,e,r,n={}){const{strict:s}=n;Wne(t,e);const i=`0x${t.replace("0x","").slice((e??0)*2,(r??t.length)*2)}`;return s&&Vne(i,e,r),i}function Bu(t){return Math.ceil((t.length-2)/2)}function Qne(t,e={}){const{strict:r=!1}=e;try{return Zne(t,{strict:r}),!0}catch{return!1}}class Xne extends ur{constructor({max:e,min:r,signed:n,size:s,value:i}){super(`Number \`${i}\` is not in safe${s?` ${s*8}-bit`:""}${n?" signed":" unsigned"} integer range ${e?`(\`${r}\` to \`${e}\`)`:`(above \`${r}\`)`}`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.IntegerOutOfRangeError"})}}class ZR extends ur{constructor(e){super(`Value \`${typeof e=="object"?oO(e):e}\` of type \`${typeof e}\` is an invalid hex type.`,{metaMessages:['Hex types must be represented as `"0x${string}"`.']}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.InvalidHexTypeError"})}}class YR extends ur{constructor(e){super(`Value \`${e}\` is an invalid hex value.`,{metaMessages:['Hex values must start with `"0x"` and contain only hexadecimal characters (0-9, a-f, A-F).']}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.InvalidHexValueError"})}}let ese=class extends ur{constructor({givenSize:e,maxSize:r}){super(`Size cannot exceed \`${r}\` bytes. Given size: \`${e}\` bytes.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SizeOverflowError"})}};class FF extends ur{constructor({offset:e,position:r,size:n}){super(`Slice ${r==="start"?"starting":"ending"} at offset \`${e}\` is out-of-bounds (size: \`${n}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SliceOffsetOutOfBoundsError"})}}let tse=class extends ur{constructor({size:e,targetSize:r,type:n}){super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} size (\`${e}\`) exceeds padding size (\`${r}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SizeExceedsPaddingSizeError"})}};const rse=new TextEncoder;function nse(t){if(!(t instanceof Uint8Array)){if(!t)throw new vb(t);if(typeof t!="object")throw new vb(t);if(!("BYTES_PER_ELEMENT"in t))throw new vb(t);if(t.BYTES_PER_ELEMENT!==1||t.constructor.name!=="Uint8Array")throw new vb(t)}}function sse(t){return t instanceof Uint8Array?t:typeof t=="string"?ose(t):ise(t)}function ise(t){return t instanceof Uint8Array?t:new Uint8Array(t)}function ose(t,e={}){const{size:r}=e;let n=t;r&&(MF(t,r),n=LF(t,r));let s=n.slice(2);s.length%2&&(s=`0${s}`);const i=s.length/2,o=new Uint8Array(i);for(let a=0,c=0;a<i;a++){const u=KR(s.charCodeAt(c++)),l=KR(s.charCodeAt(c++));if(u===void 0||l===void 0)throw new ur(`Invalid byte sequence ("${s[c-2]}${s[c-1]}" in "${s}").`);o[a]=u*16+l}return o}function ase(t,e={}){const{size:r}=e,n=rse.encode(t);return typeof r=="number"?(qne(n,r),cse(n,r)):n}function cse(t,e){return zne(t,{dir:"right",size:e})}function JR(t){return t.length}function use(t){try{return nse(t),!0}catch{return!1}}class vb extends ur{constructor(e){super(`Value \`${typeof e=="object"?oO(e):e}\` of type \`${typeof e}\` is an invalid Bytes value.`,{metaMessages:["Bytes values must be of type `Bytes`."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.InvalidBytesTypeError"})}}class lse extends ur{constructor({givenSize:e,maxSize:r}){super(`Size cannot exceed \`${r}\` bytes. Given size: \`${e}\` bytes.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.SizeOverflowError"})}}class dse extends ur{constructor({size:e,targetSize:r,type:n}){super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} size (\`${e}\`) exceeds padding size (\`${r}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.SizeExceedsPaddingSizeError"})}}function HF(t,e={}){const{as:r=typeof t=="string"?"Hex":"Bytes"}=e,n=gJ(sse(t));return r==="Bytes"?n:z_(n)}class fse extends Map{constructor(e){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=e}get(e){const r=super.get(e);return super.has(e)&&r!==void 0&&(this.delete(e),super.set(e,r)),r}set(e,r){if(super.set(e,r),this.maxSize&&this.size>this.maxSize){const n=this.keys().next().value;n&&this.delete(n)}return this}}const hse={checksum:new fse(8192)},tI=hse.checksum;function qF(t,e={}){const{compressed:r}=e,{prefix:n,x:s,y:i}=t;if(r===!1||typeof s=="bigint"&&typeof i=="bigint"){if(n!==4)throw new QR({prefix:n,cause:new wse});return}if(r===!0||typeof s=="bigint"&&typeof i>"u"){if(n!==3&&n!==2)throw new QR({prefix:n,cause:new bse});return}throw new yse({publicKey:t})}function pse(t){const e=(()=>{if(Qne(t))return zF(t);if(use(t))return gse(t);const{prefix:r,x:n,y:s}=t;return typeof n=="bigint"&&typeof s=="bigint"?{prefix:r??4,x:n,y:s}:{prefix:r,x:n}})();return qF(e),e}function gse(t){return zF(z_(t))}function zF(t){if(t.length!==132&&t.length!==130&&t.length!==68)throw new Ese({publicKey:t});if(t.length===130){const n=BigInt(Oa(t,0,32)),s=BigInt(Oa(t,32,64));return{prefix:4,x:n,y:s}}if(t.length===132){const n=Number(Oa(t,0,1)),s=BigInt(Oa(t,1,33)),i=BigInt(Oa(t,33,65));return{prefix:n,x:s,y:i}}const e=Number(Oa(t,0,1)),r=BigInt(Oa(t,1,33));return{prefix:e,x:r}}function mse(t,e={}){qF(t);const{prefix:r,x:n,y:s}=t,{includePrefix:i=!0}=e;return Yne(i?eI(r,{size:1}):"0x",eI(n,{size:32}),typeof s=="bigint"?eI(s,{size:32}):"0x")}class yse extends ur{constructor({publicKey:e}){super(`Value \`${oO(e)}\` is not a valid public key.`,{metaMessages:["Public key must contain:","- an `x` and `prefix` value (compressed)","- an `x`, `y`, and `prefix` value (uncompressed)"]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PublicKey.InvalidError"})}}class QR extends ur{constructor({prefix:e,cause:r}){super(`Prefix "${e}" is invalid.`,{cause:r}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PublicKey.InvalidPrefixError"})}}class bse extends ur{constructor(){super("Prefix must be 2 or 3 for compressed public keys."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PublicKey.InvalidCompressedPrefixError"})}}class wse extends ur{constructor(){super("Prefix must be 4 for uncompressed public keys."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PublicKey.InvalidUncompressedPrefixError"})}}let Ese=class extends ur{constructor({publicKey:e}){super(`Value \`${e}\` is an invalid public key size.`,{metaMessages:["Expected: 33 bytes (compressed + prefix), 64 bytes (uncompressed) or 65 bytes (uncompressed + prefix).",`Received ${Bu(aO(e))} bytes.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PublicKey.InvalidSerializedSizeError"})}};const vse=/^0x[a-fA-F0-9]{40}$/;function WF(t,e={}){const{strict:r=!0}=e;if(!vse.test(t))throw new XR({address:t,cause:new Cse});if(r){if(t.toLowerCase()===t)return;if(VF(t)!==t)throw new XR({address:t,cause:new Ise})}}function VF(t){if(tI.has(t))return tI.get(t);WF(t,{strict:!1});const e=t.substring(2).toLowerCase(),r=HF(ase(e),{as:"Bytes"}),n=e.split("");for(let i=0;i<40;i+=2)r[i>>1]>>4>=8&&n[i]&&(n[i]=n[i].toUpperCase()),(r[i>>1]&15)>=8&&n[i+1]&&(n[i+1]=n[i+1].toUpperCase());const s=`0x${n.join("")}`;return tI.set(t,s),s}function _se(t,e={}){const{checksum:r=!1}=e;return WF(t),r?VF(t):t}function Ase(t,e={}){const r=HF(`0x${mse(t).slice(4)}`).substring(26);return _se(`0x${r}`,e)}class XR extends ur{constructor({address:e,cause:r}){super(`Address "${e}
24" is invalid.`,{cause:r}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidAddressError"})}}class Cse extends ur{constructor(){super("Address is not a 20 byte (40 hexadecimal character) value."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidInputError"})}}class Ise extends ur{constructor(){super("Address does not match its checksum counterpart."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidChecksumError"})}}function Sse(t){if(t.length!==130&&t.length!==132)throw new Pse({signature:t});const e=BigInt(Oa(t,0,32)),r=BigInt(Oa(t,32,64)),n=(()=>{const s=+`0x${t.slice(130)}`;if(!Number.isNaN(s))try{return Tse(s)}catch{throw new Ose({value:s})}})();return typeof n>"u"?{r:e,s:r}:{r:e,s:r,yParity:n}}function Tse(t){if(t===0||t===27)return 0;if(t===1||t===28)return 1;if(t>=35)return t%2===0?1:0;throw new Nse({value:t})}class Pse extends ur{constructor({signature:e}){super(`Value \`${e}\` is an invalid signature size.`,{metaMessages:["Expected: 64 bytes or 65 bytes.",`Received ${Bu(aO(e))} bytes.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidSerializedSizeError"})}}class Ose extends ur{constructor({value:e}){super(`Value \`${e}\` is an invalid y-parity value. Y-parity must be 0 or 1.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidYParityError"})}}class Nse extends ur{constructor({value:e}){super(`Value \`${e}\` is an invalid v value. v must be 27, 28 or >=35.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidVError"})}}/*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) */function GF(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}function KF(t,e){return Array.isArray(e)?e.length===0?!0:t?e.every(r=>typeof r=="string"):e.every(r=>Number.isSafeInteger(r)):!1}function W_(t,e){if(typeof e!="string")throw new Error(`${t}: string expected`);return!0}function p0(t){if(!Number.isSafeInteger(t))throw new Error(`invalid integer: ${t}`)}function V_(t){if(!Array.isArray(t))throw new Error("array expected")}function G_(t,e){if(!KF(!0,e))throw new Error(`${t}: array of strings expected`)}function ZF(t,e){if(!KF(!1,e))throw new Error(`${t}: array of numbers expected`)}function YF(...t){const e=i=>i,r=(i,o)=>a=>i(o(a)),n=t.map(i=>i.encode).reduceRight(r,e),s=t.map(i=>i.decode).reduce(r,e);return{encode:n,decode:s}}function JF(t){const e=typeof t=="string"?t.split(""):t,r=e.length;G_("alphabet",e);const n=new Map(e.map((s,i)=>[s,i]));return{encode:s=>(V_(s),s.map(i=>{if(!Number.isSafeInteger(i)||i<0||i>=r)throw new Error(`alphabet.encode: digit index outside alphabet "${i}". Allowed: ${t}`);return e[i]})),decode:s=>(V_(s),s.map(i=>{W_("alphabet.decode",i);const o=n.get(i);if(o===void 0)throw new Error(`Unknown letter: "${i}". Allowed: ${t}`);return o}))}}function QF(t=""){return W_("join",t),{encode:e=>(G_("join.decode",e),e.join(t)),decode:e=>(W_("join.decode",e),e.split(t))}}function xse(t,e="="){return p0(t),W_("padding",e),{encode(r){for(G_("padding.encode",r);r.length*t%8;)r.push(e);return r},decode(r){G_("padding.decode",r);let n=r.length;if(n*t%8)throw new Error("padding: invalid, string should have whole number of bytes");for(;n>0&&r[n-1]===e;n--)if((n-1)*t%8===0)throw new Error("padding: invalid, string has too much padding");return r.slice(0,n)}}}function eB(t,e,r){if(e<2)throw new Error(`convertRadix: invalid from=${e}, base cannot be less than 2`);if(r<2)throw new Error(`convertRadix: invalid to=${r}, base cannot be less than 2`);if(V_(t),!t.length)return[];let n=0;const s=[],i=Array.from(t,a=>{if(p0(a),a<0||a>=e)throw new Error(`invalid integer: ${a}`);return a}),o=i.length;for(;;){let a=0,c=!0;for(let u=n;u<o;u++){const l=i[u],d=e*a,f=d+l;if(!Number.isSafeInteger(f)||d/e!==a||f-l!==d)throw new Error("convertRadix: carry overflow");const g=f/r;a=f%r;const h=Math.floor(g);if(i[u]=h,!Number.isSafeInteger(h)||h*r+a!==f)throw new Error("convertRadix: carry overflow");if(c)h?c=!1:n=u;else continue}if(s.push(a),c)break}for(let a=0;a<t.length-1&&t[a]===0;a++)s.push(0);return s.reverse()}const XF=(t,e)=>e===0?t:XF(e,t%e),K_=(t,e)=>t+(e-XF(t,e)),rI=(()=>{let t=[];for(let e=0;e<40;e++)t.push(2**e);return t})();function tB(t,e,r,n){if(V_(t),e<=0||e>32)throw new Error(`convertRadix2: wrong from=${e}`);if(r<=0||r>32)throw new Error(`convertRadix2: wrong to=${r}`);if(K_(e,r)>32)throw new Error(`convertRadix2: carry overflow from=${e} to=${r} carryBits=${K_(e,r)}`);let s=0,i=0;const o=rI[e],a=rI[r]-1,c=[];for(const u of t){if(p0(u),u>=o)throw new Error(`convertRadix2: invalid data word=${u} from=${e}`);if(s=s<<e|u,i+e>32)throw new Error(`convertRadix2: carry overflow pos=${i} from=${e}`);for(i+=e;i>=r;i-=r)c.push((s>>i-r&a)>>>0);const l=rI[i];if(l===void 0)throw new Error("invalid carry");s&=l-1}if(s=s<<r-i&a,!n&&i>=e)throw new Error("Excess padding");if(!n&&s>0)throw new Error(`Non-zero padding: ${s}`);return n&&i>0&&c.push(s>>>0),c}function Rse(t){p0(t);const e=2**8;return{encode:r=>{if(!GF(r))throw new Error("radix.encode input should be Uint8Array");return eB(Array.from(r),e,t)},decode:r=>(ZF("radix.decode",r),Uint8Array.from(eB(r,t,e)))}}function Bse(t,e=!1){if(p0(t),t<=0||t>32)throw new Error("radix2: bits should be in (0..32]");if(K_(8,t)>32||K_(t,8)>32)throw new Error("radix2: carry overflow");return{encode:r=>{if(!GF(r))throw new Error("radix2.encode input should be Uint8Array");return tB(Array.from(r),8,t,!e)},decode:r=>(ZF("radix2.decode",r),Uint8Array.from(tB(r,t,8,e)))}}const kse=YF(Bse(5),JF("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"),xse(5),QF("")),jse=t=>YF(Rse(58),JF(t),QF("")),g0=jse("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");function Dse(t){return Ase(Use(t))}function Use(t){const{payload:e,signature:r}=t,{r:n,s,yParity:i}=r,a=new VL.Signature(BigInt(n),BigInt(s)).addRecoveryBit(i).recoverPublicKey(aO(e).substring(2));return pse(a)}function Mse(t){const e=t.length;let r=0,n=0;for(;n<e;){let s=t.charCodeAt(n++);if((s&4294967168)===0){r++;continue}else if((s&4294965248)===0)r+=2;else{if(s>=55296&&s<=56319&&n<e){const i=t.charCodeAt(n);(i&64512)===56320&&(++n,s=((s&1023)<<10)+(i&1023)+65536)}(s&4294901760)===0?r+=3:r+=4}}return r}function $se(t,e,r){const n=t.length;let s=r,i=0;for(;i<n;){let o=t.charCodeAt(i++);if((o&4294967168)===0){e[s++]=o;continue}else if((o&4294965248)===0)e[s++]=o>>6&31|192;else{if(o>=55296&&o<=56319&&i<n){const a=t.charCodeAt(i);(a&64512)===56320&&(++i,o=((o&1023)<<10)+(a&1023)+65536)}(o&4294901760)===0?(e[s++]=o>>12&15|224,e[s++]=o>>6&63|128):(e[s++]=o>>18&7|240,e[s++]=o>>12&63|128,e[s++]=o>>6&63|128)}e[s++]=o&63|128}}const Lse=new TextEncoder,Fse=50;function Hse(t,e,r){Lse.encodeInto(t,e.subarray(r))}function qse(t,e,r){t.length>Fse?Hse(t,e,r):$se(t,e,r)}const zse=4096;function e9(t,e,r){let n=e;const s=n+r,i=[];let o="";for(;n<s;){const a=t[n++];if((a&128)===0)i.push(a);else if((a&224)===192){const c=t[n++]&63;i.push((a&31)<<6|c)}else if((a&240)===224){const c=t[n++]&63,u=t[n++]&63;i.push((a&31)<<12|c<<6|u)}else if((a&248)===240){const c=t[n++]&63,u=t[n++]&63,l=t[n++]&63;let d=(a&7)<<18|c<<12|u<<6|l;d>65535&&(d-=65536,i.push(d>>>10&1023|55296),d=56320|d&1023),i.push(d)}else i.push(a);i.length>=zse&&(o+=String.fromCharCode(...i),i.length=0)}return i.length>0&&(o+=String.fromCharCode(...i)),o}const Wse=new TextDecoder,Vse=200;function Gse(t,e,r){const n=t.subarray(e,e+r);return Wse.decode(n)}function Kse(t,e,r){return r>Vse?Gse(t,e,r):e9(t,e,r)}class _b{constructor(e,r){K(this,"type");K(this,"data");this.type=e,this.data=r}}
24class Ls extends Error{constructor(e){super(e);const r=Object.create(Ls.prototype);Object.setPrototypeOf(this,r),Object.defineProperty(this,"name",{configurable:!0,enumerable:!1,value:Ls.name})}}const Qp=4294967295;function Zse(t,e,r){const n=r/4294967296,s=r;t.setUint32(e,n),t.setUint32(e+4,s)}function t9(t,e,r){const n=Math.floor(r/4294967296),s=r;t.setUint32(e,n),t.setUint32(e+4,s)}function r9(t,e){const r=t.getInt32(e),n=t.getUint32(e+4);return r*4294967296+n}function Yse(t,e){const r=t.getUint32(e),n=t.getUint32(e+4);return r*4294967296+n}const Jse=-1,Qse=4294967296-1,Xse=17179869184-1;function eie({sec:t,nsec:e}){if(t>=0&&e>=0&&t<=Xse)if(e===0&&t<=Qse){const r=new Uint8Array(4);return new DataView(r.buffer).setUint32(0,t),r}else{const r=t/4294967296,n=t&4294967295,s=new Uint8Array(8),i=new DataView(s.buffer);return i.setUint32(0,e<<2|r&3),i.setUint32(4,n),s}else{const r=new Uint8Array(12),n=new DataView(r.buffer);return n.setUint32(0,e),t9(n,4,t),r}}function tie(t){const e=t.getTime(),r=Math.floor(e/1e3),n=(e-r*1e3)*1e6,s=Math.floor(n/1e9);return{sec:r+s,nsec:n-s*1e9}}function rie(t){if(t instanceof Date){const e=tie(t);return eie(e)}else return null}function nie(t){const e=new DataView(t.buffer,t.byteOffset,t.byteLength);switch(t.byteLength){case 4:return{sec:e.getUint32(0),nsec:0};case 8:{const r=e.getUint32(0),n=e.getUint32(4),s=(r&3)*4294967296+n,i=r>>>2;return{sec:s,nsec:i}}case 12:{const r=r9(e,4),n=e.getUint32(0);return{sec:r,nsec:n}}default:throw new Ls(`Unrecognized data size for timestamp (expected 4, 8, or 12): ${t.length}`)}}function sie(t){const e=nie(t);return new Date(e.sec*1e3+e.nsec/1e6)}const iie={type:Jse,encode:rie,decode:sie},_A=class _A{constructor(){K(this,"__brand");K(this,"builtInEncoders",[]);K(this,"builtInDecoders",[]);K(this,"encoders",[]);K(this,"decoders",[]);this.register(iie)}register({type:e,encode:r,decode:n}){if(e>=0)this.encoders[e]=r,this.decoders[e]=n;else{const s=-1-e;this.builtInEncoders[s]=r,this.builtInDecoders[s]=n}}tryToEncode(e,r){for(let n=0;n<this.builtInEncoders.length;n++){const s=this.builtInEncoders[n];if(s!=null){const i=s(e,r);if(i!=null){const o=-1-n;return new _b(o,i)}}}for(let n=0;n<this.encoders.length;n++){const s=this.encoders[n];if(s!=null){const i=s(e,r);if(i!=null){const o=n;return new _b(o,i)}}}return e instanceof _b?e:null}decode(e,r,n){const s=r<0?this.builtInDecoders[-1-r]:this.decoders[r];return s?s(e,r,n):new _b(r,e)}};K(_A,"defaultCodec",new _A);let Z_=_A;function oie(t){return t instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&t instanceof SharedArrayBuffer}function bT(t){return t instanceof Uint8Array?t:ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):oie(t)?new Uint8Array(t):Uint8Array.from(t)}const aie=100,cie=2048;let uie=class n9{constructor(e){K(this,"extensionCodec");K(this,"context");K(this,"useBigInt64");K(this,"maxDepth");K(this,"initialBufferSize");K(this,"sortKeys");K(this,"forceFloat32");K(this,"ignoreUndefined");K(this,"forceIntegerToFloat");K(this,"pos");K(this,"view");K(this,"bytes");K(this,"entered",!1);this.extensionCodec=(e==null?void 0:e.extensionCodec)??Z_.defaultCodec,this.context=e==null?void 0:e.context,this.useBigInt64=(e==null?void 0:e.useBigInt64)??!1,this.maxDepth=(e==null?void 0:e.maxDepth)??aie,this.initialBufferSize=(e==null?void 0:e.initialBufferSize)??cie,this.sortKeys=(e==null?void 0:e.sortKeys)??!1,this.forceFloat32=(e==null?void 0:e.forceFloat32)??!1,this.ignoreUndefined=(e==null?void 0:e.ignoreUndefined)??!1,this.forceIntegerToFloat=(e==null?void 0:e.forceIntegerToFloat)??!1,this.pos=0,this.view=new DataView(new ArrayBuffer(this.initialBufferSize)),this.bytes=new Uint8Array(this.view.buffer)}clone(){return new n9({extensionCodec:this.extensionCodec,context:this.context,useBigInt64:this.useBigInt64,maxDepth:this.maxDepth,initialBufferSize:this.initialBufferSize,sortKeys:this.sortKeys,forceFloat32:this.forceFloat32,ignoreUndefined:this.ignoreUndefined,forceIntegerToFloat:this.forceIntegerToFloat})}reinitializeState(){this.pos=0}encodeSharedRef(e){if(this.entered)return this.clone().encodeSharedRef(e);try{return this.entered=!0,this.reinitializeState(),this.doEncode(e,1),this.bytes.subarray(0,this.pos)}finally{this.entered=!1}}encode(e){if(this.entered)return this.clone().encode(e);try{return this.entered=!0,this.reinitializeState(),this.doEncode(e,1),this.bytes.slice(0,this.pos)}finally{this.entered=!1}}doEncode(e,r){if(r>this.maxDepth)throw new Error(`Too deep objects in depth ${r}`);e==null?this.encodeNil():typeof e=="boolean"?this.encodeBoolean(e):typeof e=="number"?this.forceIntegerToFloat?this.encodeNumberAsFloat(e):this.encodeNumber(e):typeof e=="string"?this.encodeString(e):this.useBigInt64&&typeof e=="bigint"?this.encodeBigInt64(e):this.encodeObject(e,r)}ensureBufferSizeToWrite(e){const r=this.pos+e;this.view.byteLength<r&&this.resizeBuffer(r*2)}resizeBuffer(e){const r=new ArrayBuffer(e),n=new Uint8Array(r),s=new DataView(r);n.set(this.bytes),this.view=s,this.bytes=n}encodeNil(){this.writeU8(192)}encodeBoolean(e){e===!1?this.writeU8(194):this.writeU8(195)}encodeNumber(e){!this.forceIntegerToFloat&&Number.isSafeInteger(e)?e>=0?e<128?this.writeU8(e):e<256?(this.writeU8(204),this.writeU8(e)):e<65536?(this.writeU8(205),this.writeU16(e)):e<4294967296?(this.writeU8(206),this.writeU32(e)):this.useBigInt64?this.encodeNumberAsFloat(e):(this.writeU8(207),this.writeU64(e)):e>=-32?this.writeU8(224|e+32):e>=-128?(this.writeU8(208),this.writeI8(e)):e>
vendor: 22,653 bytes, line 24
24=-32768?(this.writeU8(209),this.writeI16(e)):e>=-2147483648?(this.writeU8(210),this.writeI32(e)):this.useBigInt64?this.encodeNumberAsFloat(e):(this.writeU8(211),this.writeI64(e)):this.encodeNumberAsFloat(e)}encodeNumberAsFloat(e){this.forceFloat32?(this.writeU8(202),this.writeF32(e)):(this.writeU8(203),this.writeF64(e))}encodeBigInt64(e){e>=BigInt(0)?(this.writeU8(207),this.writeBigUint64(e)):(this.writeU8(211),this.writeBigInt64(e))}writeStringHeader(e){if(e<32)this.writeU8(160+e);else if(e<256)this.writeU8(217),this.writeU8(e);else if(e<65536)this.writeU8(218),this.writeU16(e);else if(e<4294967296)this.writeU8(219),this.writeU32(e);else throw new Error(`Too long string: ${e} bytes in UTF-8`)}encodeString(e){const n=Mse(e);this.ensureBufferSizeToWrite(5+n),this.writeStringHeader(n),qse(e,this.bytes,this.pos),this.pos+=n}encodeObject(e,r){const n=this.extensionCodec.tryToEncode(e,this.context);if(n!=null)this.encodeExtension(n);else if(Array.isArray(e))this.encodeArray(e,r);else if(ArrayBuffer.isView(e))this.encodeBinary(e);else if(typeof e=="object")this.encodeMap(e,r);else throw new Error(`Unrecognized object: ${Object.prototype.toString.apply(e)}`)}encodeBinary(e){const r=e.byteLength;if(r<256)this.writeU8(196),this.writeU8(r);else if(r<65536)this.writeU8(197),this.writeU16(r);else if(r<4294967296)this.writeU8(198),this.writeU32(r);else throw new Error(`Too large binary: ${r}`);const n=bT(e);this.writeU8a(n)}encodeArray(e,r){const n=e.length;if(n<16)this.writeU8(144+n);else if(n<65536)this.writeU8(220),this.writeU16(n);else if(n<4294967296)this.writeU8(221),this.writeU32(n);else throw new Error(`Too large array: ${n}`);for(const s of e)this.doEncode(s,r+1)}countWithoutUndefined(e,r){let n=0;for(const s of r)e[s]!==void 0&&n++;return n}encodeMap(e,r){const n=Object.keys(e);this.sortKeys&&n.sort();const s=this.ignoreUndefined?this.countWithoutUndefined(e,n):n.length;if(s<16)this.writeU8(128+s);else if(s<65536)this.writeU8(222),this.writeU16(s);else if(s<4294967296)this.writeU8(223),this.writeU32(s);else throw new Error(`Too large map object: ${s}`);for(const i of n){const o=e[i];this.ignoreUndefined&&o===void 0||(this.encodeString(i),this.doEncode(o,r+1))}}encodeExtension(e){if(typeof e.data=="function"){const n=e.data(this.pos+6),s=n.length;if(s>=4294967296)throw new Error(`Too large extension object: ${s}`);this.writeU8(201),this.writeU32(s),this.writeI8(e.type),this.writeU8a(n);return}const r=e.data.length;if(r===1)this.writeU8(212);else if(r===2)this.writeU8(213);else if(r===4)this.writeU8(214);else if(r===8)this.writeU8(215);else if(r===16)this.writeU8(216);else if(r<256)this.writeU8(199),this.writeU8(r);else if(r<65536)this.writeU8(200),this.writeU16(r);else if(r<4294967296)this.writeU8(201),this.writeU32(r);else throw new Error(`Too large extension object: ${r}`);this.writeI8(e.type),this.writeU8a(e.data)}writeU8(e){this.ensureBufferSizeToWrite(1),this.view.setUint8(this.pos,e),this.pos++}writeU8a(e){const r=e.length;this.ensureBufferSizeToWrite(r),this.bytes.set(e,this.pos),this.pos+=r}writeI8(e){this.ensureBufferSizeToWrite(1),this.view.setInt8(this.pos,e),this.pos++}writeU16(e){this.ensureBufferSizeToWrite(2),this.view.setUint16(this.pos,e),this.pos+=2}writeI16(e){this.ensureBufferSizeToWrite(2),this.view.setInt16(this.pos,e),this.pos+=2}writeU32(e){this.ensureBufferSizeToWrite(4),this.view.setUint32(this.pos,e),this.pos+=4}writeI32(e){this.ensureBufferSizeToWrite(4),this.view.setInt32(this.pos,e),this.pos+=4}writeF32(e){this.ensureBufferSizeToWrite(4),this.view.setFloat32(this.pos,e),this.pos+=4}writeF64(e){this.ensureBufferSizeToWrite(8),this.view.setFloat64(this.pos,e),this.pos+=8}writeU64(e){this.ensureBufferSizeToWrite(8),Zse(this.view,this.pos,e),this.pos+=8}writeI64(e){this.ensureBufferSizeToWrite(8),t9(this.view,this.pos,e),this.pos+=8}writeBigUint64(e){this.ensureBufferSizeToWrite(8),this.view.setBigUint64(this.pos,e),this.pos+=8}writeBigInt64(e){this.ensureBufferSizeToWrite(8),this.view.setBigInt64(this.pos,e),this.pos+=8}};function lie(t,e){return new uie(e).encodeSharedRef(t)}function nI(t){return`${t<0?"-":""}0x${Math.abs(t).toString(16).padStart(2,"0")}`}const die=16,fie=16;class hie{constructor(e=die,r=fie){K(this,"hit",0);K(this,"miss",0);K(this,"caches");K(this,"maxKeyLength");K(this,"maxLengthPerKey");this.maxKeyLength=e,this.maxLengthPerKey=r,this.caches=[];for(let n=0;n<this.maxKeyLength;n++)this.caches.push([])}canBeCached(e){return e>0&&e<=this.maxKeyLength}find(e,r,n){const s=this.caches[n-1];e:for(const i of s){const o=i.bytes;for(let a=0;a<n;a++)if(o[a]!==e[r+a])continue e;return i.str}return null}store(e,r){const n=this.caches[e.length-1],s={bytes:e,str:r};n.length>=this.maxLengthPerKey?n[Math.random()*n.length|0]=s:n.push(s)}decode(e,r,n){const s=this.find(e,r,n);if(s!=null)return this.hit++,s;this.miss++;const i=e9(e,r,n),o=Uint8Array.prototype.slice.call(e,r,r+n);return this.store(o,i),i}}const wT="array",Nm="map_key",s9="map_value",pie=t=>{if(typeof t=="string"||typeof t=="number")return t;throw new Ls("The type of key must be string or number but "+typeof t)};class gie{constructor(){K(this,"stack",[]);K(this,"stackHeadPosition",-1)}get length(){return this.stackHeadPosition+1}top(){return this.stack[this.stackHeadPosition]}pushArrayState(e){const r=this.getUninitializedStateFromPool();r.type=wT,r.position=0,r.size=e,r.array=new Array(e)}pushMapState(e){const r=this.getUninitializedStateFromPool();r.type=Nm,r.readCount=0,r.size=e,r.map={}}getUninitializedStateFromPool(){if(this.stackHeadPosition++,this.stackHeadPosition===this.stack.length){const e={type:void 0,size:0,array:void 0,position:0,readCount:0,map:void 0,key:null};this.stack.push(e)}return this.stack[this.stackHeadPosition]}release(e){if(this.stack[this.stackHeadPosition]!==e)throw new Error("Invalid stack state. Released state is not on top of the stack.");if(e.type===wT){const n=e;n.size=0,n.array=void 0,n.position=0,n.type=void 0}if(e.type===Nm||e.type===s9){const n=e;n.size=0,n.map=void 0,n.readCount=0,n.type=void 0}this.stackHeadPosition--}reset(){this.stack.length=0,this.stackHeadPosition=-1}}const Xp=-1,cO=new DataView(new ArrayBuffer(0)),mie=new Uint8Array(cO.buffer);try{cO.getInt8(0)}catch(t){if(!(t instanceof RangeError))throw new Error("This module is not supported in the current JavaScript engine because DataView does not throw RangeError on out-of-bounds access")}const rB=new RangeError("Insufficient data"),yie=new hie;let bie=class i9{constructor(e){K(this,"extensionCodec");K(this,"context");K(this,"useBigInt64");K(this,"rawStrings");K(this,"maxStrLength");K(this,"maxBinLength");K(this,"maxArrayLength");K(this,"maxMapLength");K(this,"maxExtLength");K(this,"keyDecoder");K(this,"mapKeyConverter");K(this,"totalPos",0);K(this,"pos",0);K(this,"view",cO);K(this,"bytes",mie);K(this,"headByte",Xp);K(this,"stack",new gie);K(this,"entered",!1);this.extensionCodec=(e==null?void 0:e.extensionCodec)??Z_.defaultCodec,this.context=e==null?void 0:e.context,this.useBigInt64=(e==null?void 0:e.useBigInt64)??!1,this.rawStrings=(e==null?void 0:e.rawStrings)??!1,this.maxStrLength=(e==null?void 0:e.maxStrLength)??Qp,this.maxBinLength=(e==null?void 0:e.maxBinLength)??Qp,this.maxArrayLength=(e==null?void 0:e.maxArrayLength)??Qp,this.maxMapLength=(e==null?void 0:e.maxMapLength)??Qp,this.maxExtLength=(e==null?void 0:e.maxExtLength)??Qp,this.keyDecoder=(e==null?void 0:e.keyDecoder)!==void 0?e.keyDecoder:yie,this.mapKeyConverter=(e==null?void 0:e.mapKeyConverter)??pie}clone(){return new i9({extensionCodec:this.extensionCodec,context:this.context,useBigInt64:this.useBigInt64,rawStrings:this.rawStrings,maxStrLength:this.maxStrLength,maxBinLength:this.maxBinLength,maxArrayLength:this.maxArrayLength,maxMapLength:this.maxMapLength,maxExtLength:this.maxExtLength,keyDecoder:this.keyDecoder})}reinitializeState(){this.totalPos=0,this.headByte=Xp,this.stack.reset()}setBuffer(e){const r=bT(e);this.bytes=r,this.view=new DataView(r.buffer,r.byteOffset,r.byteLength),this.pos=0}appendBuffer(e){if(this.headByte===Xp&&!this.hasRemaining(1))this.setBuffer(e);else{const r=this.bytes.subarray(this.pos),n=bT(e),s=new Uint8Array(r.length+n.length);s.set(r),s.set(n,r.length),this.setBuffer(s)}}hasRemaining(e){return this.view.byteLength-this.pos>=e}createExtraByteError(e){const{view:r,pos:n}=this;return new RangeError(`Extra ${r.byteLength-n} of ${r.byteLength} byte(s) found at buffer[${e}]`)}decode(e){if(this.entered)return this.clone().decode(e);try{this.entered=!0,this.reinitializeState(),this.setBuffer(e);const r=this.doDecodeSync();if(this.hasRemaining(1))throw this.createExtraByteError(this.pos);return r}finally{this.entered=!1}}*decodeMulti(e){if(this.entered){yield*this.clone().decodeMulti(e);return}try{for(this.entered=!0,this.reinitializeState(),this.setBuffer(e);this.hasRemaining(1);)yield this.doDecodeSync()}finally{this.entered=!1}}async decodeAsync(e){if(this.entered)return this.clone().decodeAsync(e);try{this.entered=!0;let r=!1,n;for await(const a of e){if(r)throw this.entered=!1,this.createExtraByteError(this.totalPos);this.appendBuffer(a);try{n=this.doDecodeSync(),r=!0}catch(c){if(!(c instanceof RangeError))throw c}this.totalPos+=this.pos}if(r){if(this.hasRemaining(1))throw this.createExtraByteError(this.totalPos);return n}const{headByte:s,pos:i,totalPos:o}=this;throw new RangeError(`Insufficient data in parsing ${nI(s)} at ${o} (${i} in the current buffer)`)}finally{this.entered=!1}}decodeArrayStream(e){return this.decodeMultiAsync(e,!0)}decodeStream(e){return this.decodeMultiAsync(e,!1)}async*decodeMultiAsync(e,r){if(this.entered){yield*this.clone().decodeMultiAsync(e,r);return}try{this.entered=!0;let n=r,s=-1;for await(const i of e){if(r&&s===0)throw this.createExtraByteError(this.totalPos);this.appendBuffer(i),n&&(s=this.readArraySize(),n=!1,this.complete());try{for(;yield this.doDecodeSync(),--s!==0;);}catch(o){if(!(o instanceof RangeError))throw o}this.totalPos+=this.pos}}finally{this.entered=!1}}doDecodeSync(){e:for(;;){const e=this.readHeadByte();let r;if(e>=224)r=e-256;else if(e<192)if(e<128)r=e;else if(e<144){const s=e-128;if(s!==0){this.pushMapState(s),this.complete();continue e}else r={}}else if(e<160){const s=e-144;if(s!==0){this.pushArrayState(s),this.complete();continue e}else r=[]}else{const s=e-160;r=this.decodeString(s,0)}else if(e===192)r=null;else if(e===194)r=!1;else if(e===195)r=!0;else if(e===202)r=this.readF32();else if(e===203)r=this.readF64();else if(e===204)r=this.readU8();else if(e===205)r=this.readU16();else if(e===206)r=this.readU32();else if(e===207)this.useBigInt64?r=this.readU64AsBigInt():r=this.readU64();else if(e===208)r=this.readI8();else if(e===209)r=this.readI16();else if(e===210)r=this.readI32();else if(e===211)this.useBigInt64?r=this.readI64AsBigInt():r=this.readI64();else if(e===217){const s=this.lookU8();r=this.decodeString(s,1)}else if(e===218){const s=this.lookU16();r=this.decodeString(s,2)}else if(e===219){const s=this.lookU32();r=this.decodeString(s,4)}else if(e===220){const s=this.readU16();if(s!==0){this.pushArrayState(s),this.complete();continue e}else r=[]}else if(e===221){const s=this.readU32();if(s!==0){this.pushArrayState(s),this.complete();continue e}else r=[]}else if(e===222){const s=this.readU16();if(s!==0){this.pushMapState(s),this.complete();continue e}else r={}}else if(e===223){const s=this.readU32();if(s!==0){this.pushMapState(s),this.complete();continue e}else r={}}else if(e===196){const s=this.lookU8();r=this.decodeBinary(s,1)}else if(e===197){const s=this.lookU16();r=this.decodeBinary(s,2)}else if(e===198){const s=this.lookU32();r=this.decodeBinary(s,4)}else if(e===212)r=this.decodeExtension(1,0);else if(e===213)r=this.decodeExtension(2,0);else if(e===214)r=this.decodeExtension(4,0);else if(e===215)r=this.decodeExtension(8,0);else if(e===216)r=this.decodeExtension(16,0);else if(e===199){const s=this.lookU8();r=this.decodeExtension(s,1)}else if(e===200){const s=this.lookU16();r=this.decodeExtension(s,2)}else if(e===201){const s=this.lookU32();r=this.decodeExtension(s,4)}else throw new Ls(`Unrecognized type byte: ${nI(e)}`);this.complete();const n=this.stack;for(;n.length>0;){const s=n.top();if(s.type===wT)if(s.array[s.position]=r,s.position++,s.position===s.size)r=s.array,n.release(s);else continue e;else if(s.type===Nm){if(r==="__proto__")throw new Ls("The key __proto__ is not allowed");s.key=this.mapKeyConverter(r),s.type=s9;continue e}else if(s.map[s.key]=r,s.readCount++,s.readCount===s.size)r=s.map,n.release(s);else{s.key=null,s.type=Nm;continue e}}return r}}readHeadByte(){return this.headByte===Xp&&(this.headByte=this.readU8()),this.headByte}complete(){this.headByte=Xp}readArraySize(){const e=this.readHeadByte();switch(e){case 220:return this.readU16();case 221:return this.readU32();default:{if(e<160)return e-144;throw new Ls(`Unrecognized array type byte: ${nI(e)}`)}}}pushMapState(e){if(e>this.maxMapLength)throw new Ls(`Max length exceeded: map length (${e}) > maxMapLengthLength (${this.maxMapLength})`);this.stack.pushMapState(e)}pushArrayState(e){if(e>this.maxArrayLength)throw new Ls(`Max length exceeded: array length (${e}) > maxArrayLength (${this.maxArrayLength})`);this.stack.pushArrayState(e)}decodeString(e,r){return!this.rawStrings||this.stateIsMapKey()?this.decodeUtf8String(e,r):this.decodeBinary(e,r)}decodeUtf8String(e,r){var i;if(e>this.maxStrLength)throw new Ls(`Max length exceeded: UTF-8 byte length (${e}) > maxStrLength (${this.maxStrLength})`);if(this.bytes.byteLength<this.pos+r+e)throw rB;const n=this.pos+r;let s;return this.stateIsMapKey()&&((i=this.keyDecoder)!=null&&i.canBeCached(e))?s=this.keyDecoder.decode(this.bytes,n,e):s=Kse(this.bytes,n,e),this.pos+=r+e,s}stateIsMapKey(){return this.stack.length>0?this.stack.top().type===Nm:!1}decodeBinary(e,r){if(e>this.maxBinLength)throw new Ls(`Max length exceeded: bin length (${e}) > maxBinLength (${this.maxBinLength})`);if(!this.hasRemaining(e+r))throw rB;const n=this.pos+r,s=this.bytes.subarray(n,n+e);return this.pos+=r+e,s}decodeExtension(e,r){if(e>this.maxExtLength)throw new Ls(`Max length exceeded: ext length (${e}) > maxExtLength (${this.maxExtLength})`);const n=this.view.getInt8(this.pos+r),s=this.decodeBinary(e,r+1);return this.extensionCodec.decode(s,n,this.context)}lookU8(){return this.view.getUint8(this.pos)}lookU16(){return this.view.getUint16(this.pos)}lookU32(){return this.view.getUint32(this.pos)}readU8(){const e=this.view.getUint8(this.pos);return this.pos++,e}readI8(){const e=this.view.getInt8(this.pos);return this.pos++,e}readU16(){const e=this.view.getUint16(this.pos);return this.pos+=2,e}readI16(){const e=this.view.getInt16(this.pos);return this.pos+=2,e}readU32(){const e=this.view.getUint32(this.pos);return this.pos+=4,e}readI32(){const e=this.view.getInt32(this.pos);return this.pos+=4,e}readU64(){const e=Yse(this.view,this.pos);return this.pos+=8,e}readI64(){const e=r9(this.view,this.pos);return this.pos+=8,e}readU64AsBigInt(){const e=this.view.getBigUint64(this.pos);return this.pos+=8,e}readI64AsBigInt(){const e=this.view.getBigInt64(this.pos);return this.pos+=8,e}readF32(){const e=this.view.getFloat32(this.pos);return this.pos+=4,e}readF64(){const e=this.view.getFloat64(this.pos);return this.pos+=8,e}};function wie(t,e){return new bie(e).decode(t)}function uO(t){return globalThis.Buffer!=null?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t}function o9(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?uO(globalThis.Buffer.allocUnsafe(t)):new Uint8Array(t)}function xm(t,e){e||(e=t.reduce((s,i)=>s+i.length,0));const r=o9(e);let n=0;for(const s of t)r.set(s,n),n+=s.length;return uO(r)}function Eie(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var s=0;s<t.length;s++){var i=t.charAt(s),o=i.charCodeAt(0);if(r[o]!==255)throw new TypeError(i+" is ambiguous");r[o]=s}var a=t.length,c=t.charAt(0),u=Math.log(a)/Math.log(256),l=Math.log(256)/Math.log(a);function d(h){if(h instanceof Uint8Array||(ArrayBuffer.isView(h)?h=new Uint8Array(h.buffer,h.byteOffset,h.byteLength):Array.isArray(h)&&(h=Uint8Array.from(h))),!(h instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(h.length===0)return"";for(var p=0,y=0,w=0,I=h.length;w!==I&&h[w]===0;)w++,p++;for(var v=(I-w)*l+1>>>0,E=new Uint8Array(v);w!==I;){for(var b=h[w],m=0,_=v-1;(b!==0||m<y)&&_!==-1;_--,m++)b+=256*E[_]>>>0,E[_]=b%a>>>0,b=b/a>>>0;if(b!==0)throw new Error("Non-zero carry");y=m,w++}for(var O=v-y;O!==v&&E[O]===0;)O++;for(var C=c.repeat(p);O<v;++O)C+=t.charAt(E[O]);return C}function f(h){if(typeof h!="string")throw new TypeError("Expected String");if(h.length===0)return new Uint8Array;var p=0;if(h[p]!==" "){for(var y=0,w=0;h[p]===c;)y++,p++;for(var I=(h.length-p)*u+1>>>0,v=new Uint8Array(I);h[p];){var E=r[h.charCodeAt(p)];if(E===255)return;for(var b=0,m=I-1;(E!==0||b<w)&&m!==-1;m--,b++)E+=a*v[m]>>>0,v[m]=E%256>>>0,E=E/256>>>0;if(E!==0)throw new Error("Non-zero carry");w=b,p++}if(h[p]!==" "){for(var _=I-w;_!==I&&v[_]===0;)_++;for(var O=new Uint8Array(y+(I-_)),C=y;_!==I;)O[C++]=v[_++];return O}}}function g(h){var p=f(h);if(p)return p;throw new Error(`Non-${e} character`)}return{encode:d,decodeUnsafe:f,decode:g}}var vie=Eie,_ie=vie;const Aie=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},Cie=t=>new TextEncoder().encode(t),Iie=t=>new TextDecoder().decode(t);class Sie{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class Tie{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return a9(this,e)}}class Pie{constructor(e){this.decoders=e}or(e){return a9(this,e)}decode(e){const r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const a9=(t,e)=>new Pie({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}});class Oie{constructor(e,r,n,s){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=s,this.encoder=new Sie(e,r,n),this.decoder=new Tie(e,r,s)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const LA=({name:t,prefix:e,encode:r,decode:n})=>new Oie(t,e,r,n),m0=({prefix:t,name:e,alphabet:r})=>{const{encode:n,decode:s}=_ie(r,e);return LA({prefix:t,name:e,encode:n,decode:i=>Aie(s(i))})},Nie=(t,e,r,n)=>{const s={};for(let l=0;l<e.length;++l)s[e[l]]=l;let i=t.length;for(;t[i-1]==="=";)--i;const o=new Uint8Array(i*r/8|0);let a=0,c=0,u=0;for(let l=0;l<i;++l){const d=s[t[l]];if(d===void 0)throw new SyntaxError(`Non-${n} character`);c=c<<r|d,a+=r,a>=8&&(a-=8,o[u++]=255&c>>a)}if(a>=r||255&c<<8-a)throw new SyntaxError("Unexpected end of data");return o},xie=(t,e,r)=>{const n=e[e.length-1]==="=",s=(1<<r)-1;let i="",o=0,a=0;for(let c=0;c<t.length;++c)for(a=a<<8|t[c],o+=8;o>r;)o-=r,i+=e[s&a>>o];if(o&&(i+=e[s&a<<r-o]),n)for(;i.length*r&7;)i+="=";return i},fn=({name:t,prefix:e,bitsPerChar:r,alphabet:n})=>LA({prefix:e,name:t,encode(s){return xie(s,n,r)},decode(s){return Nie(s,n,r,t)}}),Rie=LA({prefix:"\0",name:"identity",encode:t=>Iie(t),decode:t=>Cie(t)}),Bie=Object.freeze(Object.defineProperty({__proto__:null,identity:Rie},Symbol.toStringTag,{value:"Module"})),kie=fn({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),jie=Object.freeze(Object.defineProperty({__proto__:null,base2:kie},Symbol.toStringTag,{value:"Module"})),Die=fn({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),Uie=Object.freeze(Object.defineProperty({__proto__:null,base8:Die},Symbol.toStringTag,{value:"Module"})),Mie=m0({prefix:"9",name:"base10",alphabet:"0123456789"}),$ie=Object.freeze(Object.defineProperty({__proto__:null,base10:Mie},Symbol.toStringTag,{value:"Module"})),Lie=fn({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Fie=fn({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),Hie=Object.freeze(Object.defineProperty({__proto__:null,base16:Lie,base16upper:Fie},Symbol.toStringTag,{value:"Module"})),qie=fn({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),zie=fn({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Wie=fn({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Vie=fn({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Gie=fn({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Kie=fn({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Zie=fn({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Yie=fn({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Jie=fn({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),Qie=Object.freeze(Object.defineProperty({__proto__:null,base32:qie,base32hex:Gie,base32hexpad:Zie,base32hexpadupper:Yie,base32hexupper:Kie,base32pad:Wie,base32padupper:Vie,base32upper:zie,base32z:Jie},Symbol.toStringTag,{value:"Module"})),Xie=m0({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),eoe=m0({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),toe=Object.freeze(Object.defineProperty({__proto__:null,base36:Xie,base36upper:eoe},Symbol.toStringTag,{value:"Module"})),roe=m0({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),noe=m0({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),soe=Object.freeze(Object.defineProperty({__proto__:null,base58btc:roe,base58flickr:noe},Symbol.toStringTag,{value:"Module"})),ioe=fn({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
24+/",bitsPerChar:6}),ooe=fn({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),aoe=fn({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),coe=fn({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),uoe=Object.freeze(Object.defineProperty({__proto__:null,base64:ioe,base64pad:ooe,base64url:aoe,base64urlpad:coe},Symbol.toStringTag,{value:"Module"})),c9=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),loe=c9.reduce((t,e,r)=>(t[r]=e,t),[]),doe=c9.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function foe(t){return t.reduce((e,r)=>(e+=loe[r],e),"")}function hoe(t){const e=[];for(const r of t){const n=doe[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}const poe=LA({prefix:"🚀",name:"base256emoji",encode:foe,decode:hoe}),goe=Object.freeze(Object.defineProperty({__proto__:null,base256emoji:poe},Symbol.toStringTag,{value:"Module"}));new TextEncoder;new TextDecoder;const nB={...Bie,...jie,...Uie,...$ie,...Hie,...Qie,...toe,...soe,...uoe,...goe};function u9(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}const sB=u9("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),sI=u9("ascii","a",t=>{let e="a";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return e},t=>{t=t.substring(1);const e=o9(t.length);for(let r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return e}),l9={utf8:sB,"utf-8":sB,hex:nB.base16,latin1:sI,ascii:sI,binary:sI,...nB};function fi(t,e="utf8"){const r=l9[e];if(!r)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?uO(globalThis.Buffer.from(t,"utf-8")):r.decoder.decode(`${r.prefix}${t}`)}function ws(t,e="utf8"){const r=l9[e];if(!r)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(t.buffer,t.byteOffset,t.byteLength).toString("utf8"):r.encoder.encode(t).substring(1)}const moe={waku:{publish:"waku_publish",batchPublish:"waku_batchPublish",subscribe:"waku_subscribe",batchSubscribe:"waku_batchSubscribe",subscription:"waku_subscription",unsubscribe:"waku_unsubscribe",batchUnsubscribe:"waku_batchUnsubscribe",batchFetchMessages:"waku_batchFetchMessages"},irn:{publish:"irn_publish",batchPublish:"irn_batchPublish",subscribe:"irn_subscribe",batchSubscribe:"irn_batchSubscribe",subscription:"irn_subscription",unsubscribe:"irn_unsubscribe",batchUnsubscribe:"irn_batchUnsubscribe",batchFetchMessages:"irn_batchFetchMessages"},iridium:{publish:"iridium_publish",batchPublish:"iridium_batchPublish",subscribe:"iridium_subscribe",batchSubscribe:"iridium_batchSubscribe",subscription:"iridium_subscription",unsubscribe:"iridium_unsubscribe",batchUnsubscribe:"iridium_batchUnsubscribe",batchFetchMessages:"iridium_batchFetchMessages"}};var iI,iB;function d9(){if(iB)return iI;iB=1;const t="Input must be an string, Buffer or Uint8Array";function e(o){let a;if(o instanceof Uint8Array)a=o;
vendor: 27,819 bytes, lines 24-26
24else if(typeof o=="string")a=new TextEncoder().encode(o);else throw new Error(t);return a}function r(o){return Array.prototype.map.call(o,function(a){return(a<16?"0":"")+a.toString(16)}).join("")}function n(o){return(4294967296+o).toString(16).substring(1)}function s(o,a,c){let u=`
25`+o+" = ";for(let l=0;l<a.length;l+=2){if(c===32)u+=n(a[l]).toUpperCase(),u+=" ",u+=n(a[l+1]).toUpperCase();else if(c===64)u+=n(a[l+1]).toUpperCase(),u+=n(a[l]).toUpperCase();else throw new Error("Invalid size "+c);l%6===4?u+=`
26`+new Array(o.length+4).join(" "):l<a.length-2&&(u+=" ")}console.log(u)}function i(o,a,c){let u=new Date().getTime();const l=new Uint8Array(a);for(let f=0;f<a;f++)l[f]=f%256;const d=new Date().getTime();console.log("Generated random input in "+(d-u)+"ms"),u=d;for(let f=0;f<c;f++){const g=o(l),h=new Date().getTime(),p=h-u;u=h,console.log("Hashed in "+p+"ms: "+g.substring(0,20)+"..."),console.log(Math.round(a/(1<<20)/(p/1e3)*100)/100+" MB PER SECOND")}}return iI={normalizeInput:e,toHex:r,debugPrint:s,testSpeed:i},iI}var oI,oB;function yoe(){if(oB)return oI;oB=1;const t=d9();function e(w,I,v){const E=w[I]+w[v];let b=w[I+1]+w[v+1];E>=4294967296&&b++,w[I]=E,w[I+1]=b}function r(w,I,v,E){let b=w[I]+v;v<0&&(b+=4294967296);let m=w[I+1]+E;b>=4294967296&&m++,w[I]=b,w[I+1]=m}function n(w,I){return w[I]^w[I+1]<<8^w[I+2]<<16^w[I+3]<<24}function s(w,I,v,E,b,m){const _=u[b],O=u[b+1],C=u[m],S=u[m+1];e(c,w,I),r(c,w,_,O);let T=c[E]^c[w],N=c[E+1]^c[w+1];c[E]=N,c[E+1]=T,e(c,v,E),T=c[I]^c[v],N=c[I+1]^c[v+1],c[I]=T>>>24^N<<8,c[I+1]=N>>>24^T<<8,e(c,w,I),r(c,w,C,S),T=c[E]^c[w],N=c[E+1]^c[w+1],c[E]=T>>>16^N<<16,c[E+1]=N>>>16^T<<16,e(c,v,E),T=c[I]^c[v],N=c[I+1]^c[v+1],c[I]=N>>>31^T<<1,c[I+1]=T>>>31^N<<1}const i=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),o=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3],a=new Uint8Array(o.map(function(w){return w*2})),c=new Uint32Array(32),u=new Uint32Array(32);function l(w,I){let v=0;for(v=0;v<16;v++)c[v]=w.h[v],c[v+16]=i[v];for(c[24]=c[24]^w.t,c[25]=c[25]^w.t/4294967296,I&&(c[28]=~c[28],c[29]=~c[29]),v=0;v<32;v++)u[v]=n(w.b,4*v);for(v=0;v<12;v++)s(0,8,16,24,a[v*16+0],a[v*16+1]),s(2,10,18,26,a[v*16+2],a[v*16+3]),s(4,12,20,28,a[v*16+4],a[v*16+5]),s(6,14,22,30,a[v*16+6],a[v*16+7]),s(0,10,20,30,a[v*16+8],a[v*16+9]),s(2,12,22,24,a[v*16+10],a[v*16+11]),s(4,14,16,26,a[v*16+12],a[v*16+13]),s(6,8,18,28,a[v*16+14],a[v*16+15]);for(v=0;v<16;v++)w.h[v]=w.h[v]^c[v]^c[v+16]}const d=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);function f(w,I,v,E){if(w===0||w>64)throw new Error("Illegal output length, expected 0 < length <= 64");if(I&&I.length>64)throw new Error("Illegal key, expected Uint8Array with 0 < length <= 64");if(v&&v.length!==16)throw new Error("Illegal salt, expected Uint8Array with length is 16");if(E&&E.length!==16)throw new Error("Illegal personal, expected Uint8Array with length is 16");const b={b:new Uint8Array(128),h:new Uint32Array(16),t:0,c:0,outlen:w};d.fill(0),d[0]=w,I&&(d[1]=I.length),d[2]=1,d[3]=1,v&&d.set(v,32),E&&d.set(E,48);for(let m=0;m<16;m++)b.h[m]=i[m]^n(d,m*4);return I&&(g(b,I),b.c=128),b}function g(w,I){for(let v=0;v<I.length;v++)w.c===128&&(w.t+=w.c,l(w,!1),w.c=0),w.b[w.c++]=I[v]}function h(w){for(w.t+=w.c;w.c<128;)w.b[w.c++]=0;l(w,!0);const I=new Uint8Array(w.outlen);for(let v=0;v<w.outlen;v++)I[v]=w.h[v>>2]>>8*(v&3);return I}function p(w,I,v,E,b){v=v||64,w=t.normalizeInput(w),E&&(E=t.normalizeInput(E)),b&&(b=t.normalizeInput(b));const m=f(v,I,E,b);return g(m,w),h(m)}function y(w,I,v,E,b){const m=p(w,I,v,E,b);return t.toHex(m)}return oI={blake2b:p,blake2bHex:y,blake2bInit:f,blake2bUpdate:g,blake2bFinal:h},oI}var aI,aB;function boe(){if(aB)return aI;aB=1;const t=d9();function e(h,p){return h[p]^h[p+1]<<8^h[p+2]<<16^h[p+3]<<24}function r(h,p,y,w,I,v){o[h]=o[h]+o[p]+I,o[w]=n(o[w]^o[h],16),o[y]=o[y]+o[w],o[p]=n(o[p]^o[y],12),o[h]=o[h]+o[p]+v,o[w]=n(o[w]^o[h],8),o[y]=o[y]+o[w],o[p]=n(o[p]^o[y],7)}function n(h,p){return h>>>p^h<<32-p}const s=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),i=new Uint8Array([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0]),o=new Uint32Array(16),a=new Uint32Array(16);function c(h,p){let y=0;for(y=0;y<8;y++)o[y]=h.h[y],o[y+8]=s[y];for(o[12]^=h.t,o[13]^=h.t/4294967296,p&&(o[14]=~o[14]),y=0;y<16;y++)a[y]=e(h.b,4*y);for(y=0;y<10;y++)r(0,4,8,12,a[i[y*16+0]],a[i[y*16+1]]),r(1,5,9,13,a[i[y*16+2]],a[i[y*16+3]]),r(2,6,10,14,a[i[y*16+4]],a[i[y*16+5]]),r(3,7,11,15,a[i[y*16+6]],a[i[y*16+7]]),r(0,5,10,15,a[i[y*16+8]],a[i[y*16+9]]),r(1,6,11,12,a[i[y*16+10]],a[i[y*16+11]]),r(2,7,8,13,a[i[y*16+12]],a[i[y*16+13]]),r(3,4,9,14,a[i[y*16+14]],a[i[y*16+15]]);for(y=0;y<8;y++)h.h[y]^=o[y]^o[y+8]}function u(h,p){if(!(h>0&&h<=32))throw new Error("Incorrect output length, should be in [1, 32]");const y=p?p.length:0;if(p&&!(y>0&&y<=32))throw new Error("Incorrect key length, should be in [1, 32]");const w={h:new Uint32Array(s),b:new Uint8Array(64),c:0,t:0,outlen:h};return w.h[0]^=16842752^y<<8^h,y>0&&(l(w,p),w.c=64),w}function l(h,p){for(let y=0;y<p.length;y++)h.c===64&&(h.t+=h.c,c(h,!1),h.c=0),h.b[h.c++]=p[y]}function d(h){for(h.t+=h.c;h.c<64;)h.b[h.c++]=0;c(h,!0);const p=new Uint8Array(h.outlen);for(let y=0;y<h.outlen;y++)p[y]=h.h[y>>2]>>8*(y&3)&255;return p}function f(h,p,y){y=y||32,h=t.normalizeInput(h);const w=u(y,p);return l(w,h),d(w)}function g(h,p,y){const w=f(h,p,y);return t.toHex(w)}return aI={blake2s:f,blake2sHex:g,blake2sInit:u,blake2sUpdate:l,blake2sFinal:d},aI}var cI,cB;function woe(){if(cB)return cI;cB=1;const t=yoe(),e=boe();return cI={blake2b:t.blake2b,blake2bHex:t.blake2bHex,blake2bInit:t.blake2bInit,blake2bUpdate:t.blake2bUpdate,blake2bFinal:t.blake2bFinal,blake2s:e.blake2s,blake2sHex:e.blake2sHex,blake2sInit:e.blake2sInit,blake2sUpdate:e.blake2sUpdate,blake2sFinal:e.blake2sFinal},cI}var Eoe=woe(),voe={};const _oe=":";function rc(t){const[e,r]=t.split(_oe);return{namespace:e,reference:r}}function f9(t,e){return t.includes(":")?[t]:e.chains||[]}const Aoe={INVALID_METHOD:{message:"Invalid method.",code:1001},INVALID_EVENT:{message:"Invalid event.",code:1002},INVALID_UPDATE_REQUEST:{message:"Invalid update request.",code:1003},INVALID_EXTEND_REQUEST:{message:"Invalid extend request.",code:1004},INVALID_SESSION_SETTLE_REQUEST:{message:"Invalid session settle request.",code:1005},UNAUTHORIZED_METHOD:{message:"Unauthorized method.",code:3001},UNAUTHORIZED_EVENT:{message:"Unauthorized event.",code:3002},UNAUTHORIZED_UPDATE_REQUEST:{message:"Unauthorized update request.",code:3003},UNAUTHORIZED_EXTEND_REQUEST:{message:"Unauthorized extend request.",code:3004},USER_REJECTED:{message:"User rejected.",code:5e3},USER_REJECTED_CHAINS:{message:"User rejected chains.",code:5001},USER_REJECTED_METHODS:{message:"User rejected methods.",code:5002},USER_REJECTED_EVENTS:{message:"User rejected events.",code:5003},UNSUPPORTED_CHAINS:{message:"Unsupported chains.",code:5100},UNSUPPORTED_METHODS:{message:"Unsupported methods.",code:5101},UNSUPPORTED_EVENTS:{message:"Unsupported events.",code:5102},UNSUPPORTED_ACCOUNTS:{message:"Unsupported accounts.",code:5103},UNSUPPORTED_NAMESPACE_KEY:{message:"Unsupported namespace key.",code:5104},USER_DISCONNECTED:{message:"User disconnected.",code:6e3},SESSION_SETTLEMENT_FAILED:{message:"Session settlement failed.",code:7e3},WC_METHOD_UNSUPPORTED:{message:"Unsupported wc_ method.",code:10001}},Coe={NOT_INITIALIZED:{message:"Not initialized.",code:1},NO_MATCHING_KEY:{message:"No matching key.",code:2},RESTORE_WILL_OVERRIDE:{message:"Restore will override.",code:3},RESUBSCRIBED:{message:"Resubscribed.",code:4},MISSING_OR_INVALID:{message:"Missing or invalid.",code:5},EXPIRED:{message:"Expired.",code:6},UNKNOWN_TYPE:{message:"Unknown type.",code:7},MISMATCHED_TOPIC:{message:"Mismatched topic.",code:8},NON_CONFORMING_NAMESPACES:{message:"Non conforming namespaces.",code:9}};function _e(t,e){const{message:r,code:n}=Coe[t];return{message:e?`${r} ${e}`:r,code:n}}function ar(t,e){const{message:r,code:n}=Aoe[t];return{message:e?`${r} ${e}`:r,code:n}}var Ioe=Object.defineProperty,Soe=Object.defineProperties,Toe=Object.getOwnPropertyDescriptors,uB=Object.getOwnPropertySymbols,Poe=Object.prototype.hasOwnProperty,Ooe=Object.prototype.propertyIsEnumerable,ET=(t,e,r)=>e in t?Ioe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,lB=(t,e)=>{for(var r in e||(e={}))Poe.call(e,r)&&ET(t,r,e[r]);if(uB)for(var r of uB(e))Ooe.call(e,r)&&ET(t,r,e[r]);return t},Noe=(t,e)=>Soe(t,Toe(e)),dB=(t,e,r)=>ET(t,typeof e!="symbol"?e+"":e,r);const xoe="ReactNative",Vs={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},Roe="js";function Y_(){return typeof Qr<"u"&&typeof Qr.versions<"u"&&typeof Qr.versions.node<"u"}function Mu(){return!ac.getDocument()&&!!ac.getNavigator()&&navigator.product===xoe}function Boe(){return Mu()&&typeof We<"u"&&typeof(We==null?void 0:We.Platform)<"u"&&(We==null?void 0:We.Platform.OS)==="android"}function koe(){return Mu()&&typeof We<"u"&&typeof(We==null?void 0:We.Platform)<"u"&&(We==null?void 0:We.Platform.OS)==="ios"}function Np(){return!Y_()&&!!ac.getNavigator()&&!!ac.getDocument()}function y0(){return Mu()?Vs.reactNative:Y_()?Vs.node:Np()?Vs.browser:Vs.unknown}function fB(){var t;try{return Mu()&&typeof We<"u"&&typeof(We==null?void 0:We.Application)<"u"?(t=We.Application)==null?void 0:t.applicationId:void 0}catch{return}}function joe(t,e){const r=new URLSearchParams(t);return Object.entries(e).sort(([n],[s])=>n.localeCompare(s)).forEach(([n,s])=>{s!=null&&r.set(n,String(s))}),r.toString()}function Doe(t){var e,r;const n=h9();try{return t!=null&&t.url&&n.url&&new URL(t.url).host!==new URL(n.url).host&&(console.warn(`The configured WalletConnect 'metadata.url':${t.url} differs from the actual page url:${n.url}. This is probably unintended and can lead to issues.`),t.url=n.url),(e=t==null?void 0:t.icons)!=null&&e.length&&t.icons.length>0&&(t.icons=t.icons.filter(s=>s!=="")),Noe(lB(lB({},n),t),{url:(t==null?void 0:t.url)||n.url,name:(t==null?void 0:t.name)||n.name,description:(t==null?void 0:t.description)||n.description,icons:(r=t==null?void 0:t.icons)!=null&&r.length&&t.icons.length>0?t.icons:n.icons})}catch(s){return console.warn("Error populating app metadata",s),t||n}}function h9(){return Lne.getWindowMetadata()||{name:"",description:"",url:"",icons:[""]}}function Uoe(){if(y0()===Vs.reactNative&&typeof We<"u"&&typeof(We==null?void 0:We.Platform)<"u"){const{OS:r,Version:n}=We.Platform;return[r,n].join("-")}const t=Bne();if(t===null)return"unknown";const e=t.os?t.os.replace(" ","").toLowerCase():"unknown";return t.type==="browser"?[e,t.name,t.version].join("-"):[e,t.version].join("-")}function Moe(){var t;const e=y0();return e===Vs.browser?[e,((t=ac.getLocation())==null?void 0:t.host)||"unknown"].join(":"):e}function p9(t,e,r){const n=Uoe(),s=Moe();return[[t,e].join("-"),[Roe,r].join("-"),n,s].join("/")}function $oe({protocol:t,version:e,relayUrl:r,sdkVersion:n,auth:s,projectId:i,useOnCloseEvent:o,bundleId:a,packageName:c}){const u=r.split("?"),l=p9(t,e,n),d={auth:s,ua:l,projectId:i,useOnCloseEvent:o,packageName:c||void 0,bundleId:a||void 0},f=joe(u[1]||"",d);return u[0]+"?"+f}function Hl(t,e){return t.filter(r=>e.includes(r)).length===t.length}function vT(t){return Object.fromEntries(t.entries())}function _T(t){return new Map(Object.entries(t))}function Ol(t=ye.FIVE_MINUTES,e){const r=ye.toMiliseconds(t||ye.FIVE_MINUTES);let n,s,i,o;return{resolve:a=>{i&&n&&(clearTimeout(i),n(a),o=Promise.resolve(a))},reject:a=>{i&&s&&(clearTimeout(i),s(a))},done:()=>new Promise((a,c)=>{if(o)return a(o);i=setTimeout(()=>{const u=_e("EXPIRED"),l=new Error(e||u.message);l.code=u.code,c(l)},r),n=a,s=c})}}function ko(t,e,r){return new Promise(async(n,s)=>{const i=setTimeout(()=>s(new Error(r)),e);try{const o=await t;n(o)}catch(o){s(o)}clearTimeout(i)})}function g9(t,e){if(typeof e=="string"&&e.startsWith(`${t}:`))return e;if(t.toLowerCase()==="topic"){if(typeof e!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${e}`}else if(t.toLowerCase()==="id"){if(typeof e!="number")throw new Error('Value must be "number" for expirer target type: id');return`id:${e}`}throw new Error(`Unknown expirer target type: ${t}`)}function Loe(t){return g9("topic",t)}function Foe(t){return g9("id",t)}function m9(t){const[e,r]=t.split(":"),n={id:void 0,topic:void 0};if(e==="topic"&&typeof r=="string")n.topic=r;else if(e==="id"&&Number.isInteger(Number(r)))n.id=Number(r);else throw new Error(`Invalid target, expected id:number or topic:string, got ${e}:${r}`);return n}function Nr(t,e){return ye.fromMiliseconds(Date.now()+ye.toMiliseconds(t))}function Po(t){return Date.now()>=ye.toMiliseconds(t)}function kt(t,e){return`${t}${e?`:${e}`:""}`}function Mo(t=[],e=[]){return[...new Set([...t,...e])]}async function Hoe({id:t,topic:e,wcDeepLink:r}){var n;try{if(!r)return;const s=typeof r=="string"?JSON.parse(r):r,i=s==null?void 0:s.href;if(typeof i!="string")return;const o=qoe(i,t,e),a=y0();if(a===Vs.browser){if(!((n=ac.getDocument())!=null&&n.hasFocus())){console.warn("Document does not have focus, skipping deeplink.");return}zoe(o)}else a===Vs.reactNative&&typeof(We==null?void 0:We.Linking)<"u"&&await We.Linking.openURL(o)}catch(s){console.error(s)}}function qoe(t,e,r){const n=`requestId=${e}&sessionTopic=${r}`;t.endsWith("/")&&(t=t.slice(0,-1));let s=`${t}`;if(t.startsWith("https://t.me")){const i=t.includes("?")?"&startapp=":"?startapp=";s=`${s}${i}${Koe(n,!0)}`}else s=`${s}/wc?${n}`;return s}function zoe(t){let e="_self";Goe()?e="_top":(Voe()||t.startsWith("https://")||t.startsWith("http://"))&&(e="_blank"),window.open(t,e,"noreferrer noopener")}async function Woe(t,e){let r="";try{if(Np()&&(r=localStorage.getItem(e),r))return r;r=await t.getItem(e)}catch(n){console.error(n)}return r}function hB(t,e){if(!t.includes(e))return null;const r=t.split(/([&,?,=])/),n=r.indexOf(e);return r[n+2]}function pB(){return typeof crypto<"u"&&crypto!=null&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu,t=>{const e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)})}function lO(){return typeof Qr<"u"&&voe.IS_VITEST==="true"}function Voe(){return typeof window<"u"&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)}function Goe(){try{return window.self!==window.top}catch{return!1}}function Koe(t,e=!1){const r=bt.from(t).toString("base64");return e?r.replace(/[=]/g,""):r}function y9(t){return bt.from(t,"base64").toString("utf-8")}function Zoe(t){return new Promise(e=>setTimeout(e,t))}let Yoe=class{constructor({limit:e}){dB(this,"limit"),dB(this,"set"),this.limit=e,this.set=new Set}add(e){if(!this.set.has(e)){if(this.set.size>=this.limit){const r=this.set.values().next().value;r&&this.set.delete(r)}this.set.add(e)}}has(e){return this.set.has(e)}};const Ab=BigInt(2**32-1),gB=BigInt(32);function b9(t,e=!1){return e?{h:Number(t&Ab),l:Number(t>>gB&Ab)}:{h:Number(t>>gB&Ab)|0,l:Number(t&Ab)|0}}function w9(t,e=!1){const r=t.length;let n=new Uint32Array(r),s=new Uint32Array(r);for(let i=0;i<r;i++){const{h:o,l:a}=b9(t[i],e);[n[i],s[i]]=[o,a]}return[n,s]}const mB=(t,e,r)=>t>>>r,yB=(t,e,r)=>t<<32-r|e>>>r,Vc=(t,e,r)=>t>>>r|e<<32-r,Gc=(t,e,r)=>t<<32-r|e>>>r,wm=(t,e,r)=>t<<64-r|e>>>r-32,Em=(t,e,r)=>t>>>r-32|e<<64-r,Joe=(t,e)=>e,Qoe=(t,e)=>t,Xoe=(t,e,r)=>t<<r|e>>>32-r,eae=(t,e,r)=>e<<r|t>>>32-r,tae=(t,e,r)=>e<<r-32|t>>>64-r,rae=(t,e,r)=>t<<r-32|e>>>64-r;function Ni(t,e,r,n){const s=(e>>>0)+(n>>>0);return{h:t+r+(s/2**32|0)|0,l:s|0}}const dO=(t,e,r)=>(t>>>0)+(e>>>0)+(r>>>0),fO=(t,e,r,n)=>e+r+n+(t/2**32|0)|0,nae=(t,e,r,n)=>(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0),sae=(t,e,r,n,s)=>e+r+n+s+(t/2**32|0)|0,iae=(t,e,r,n,s)=>(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0)+(s>>>0),oae=(t,e,r,n,s,i)=>e+r+n+s+i+(t/2**32|0)|0,df=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;function FA(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}function cc(t){if(!Number.isSafeInteger(t)||t<0)throw new Error("positive integer expected, got "+t)}function Zi(t,...e){if(!FA(t))throw new Error("Uint8Array expected");if(e.length>0&&!e.includes(t.length))throw new Error("Uint8Array expected of length "+e+", got length="+t.length)}function HA(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");cc(t.outputLen),cc(t.blockLen)}function ku(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function hO(t,e){Zi(t);const r=e.outputLen;if(t.length<r)throw new Error("digestInto() expects output buffer of length at least "+r)}function Oy(t){return new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4))}function hi(...t){for(let e=0;e<t.length;e++)t[e].fill(0)}function uI(t){return new DataView(t.buffer,t.byteOffset,t.byteLength)}function co(t,e){return t<<32-e|t>>>e}const E9=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function v9(t){return t<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255}const Ia=E9?t=>t:t=>v9(t);function aae(t){for(let e=0;e<t.length;e++)t[e]=v9(t[e]);return t}const Kc=E9?t=>t:aae,_9=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",cae=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function ah(t){if(Zi(t),_9)return t.toHex();let e="";for(let r=0;r<t.length;r++)e+=cae[t[r]];return e}const ea={_0:48,_9:57,A:65,F:70,a:97,f:102};function bB(t){if(t>=ea._0&&t<=ea._9)return t-ea._0;if(t>=ea.A&&t<=ea.F)return t-(ea.A-10);if(t>=ea.a&&t<=ea.f)return t-(ea.a-10)}function J_(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);if(_9)return Uint8Array.fromHex(t);const e=t.length,r=e/2;if(e%2)throw new Error("hex string expected, got unpadded hex of length "+e);const n=new Uint8Array(r);for(let s=0,i=0;s<r;s++,i+=2){const o=bB(t.charCodeAt(i)),a=bB(t.charCodeAt(i+1));if(o===void 0||a===void 0){const c=t[i]+t[i+1];throw new Error('hex string expected, got non-hex character "'+c+'" at index '+i)}n[s]=o*16+a}return n}function A9(t){if(typeof t!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(t))}function Gi(t){return typeof t=="string"&&(t=A9(t)),Zi(t),t}function Qc(...t){let e=0;for(let n=0;n<t.length;n++){const s=t[n];Zi(s),e+=s.length}const r=new Uint8Array(e);for(let n=0,s=0;n<t.length;n++){const i=t[n];r.set(i,s),s+=i.length}return r}let qA=class{};function b0(t){const e=n=>t().update(Gi(n)).digest(),r=t();return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=()=>t(),e}function uae(t){const e=(n,s)=>t(s).update(Gi(n)).digest(),r=t({});return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=n=>t(n),e}function Zd(t=32){if(df&&typeof df.getRandomValues=="function")return df.getRandomValues(new Uint8Array(t));if(df&&typeof df.randomBytes=="function")return Uint8Array.from(df.randomBytes(t));throw new Error("crypto.getRandomValues must be defined")}const lae=BigInt(0),eg=BigInt(1),dae=BigInt(2),fae=BigInt(7),hae=BigInt(256),pae=BigInt(113),C9=[],I9=[],S9=[];for(let t=0,e=eg,r=1,n=0;t<24;t++){[r,n]=[n,(2*r+3*n)%5],C9.push(2*(5*n+r)),I9.push((t+1)*(t+2)/2%64);let s=lae;for(let i=0;i<7;i++)e=(e<<eg^(e>>fae)*pae)%hae,e&dae&&(s^=eg<<(eg<<BigInt(i))-eg);S9.push(s)}const T9=w9(S9,!0),gae=T9[0],mae=T9[1],wB=(t,e,r)=>r>32?tae(t,e,r):Xoe(t,e,r),EB=(t,e,r)=>r>32?rae(t,e,r):eae(t,e,r);function yae(t,e=24){const r=new Uint32Array(10);for(let n=24-e;n<24;n++){for(let o=0;o<10;o++)r[o]=t[o]^t[o+10]^t[o+20]^t[o+30]^t[o+40];for(let o=0;o<10;o+=2){const a=(o+8)%10,c=(o+2)%10,u=r[c],l=r[c+1],d=wB(u,l,1)^r[a],f=EB(u,l,1)^r[a+1];for(let g=0;g<50;g+=10)t[o+g]^=d,t[o+g+1]^=f}let s=t[2],i=t[3];for(let o=0;o<24;o++){const a=I9[o],c=wB(s,i,a),u=EB(s,i,a),l=C9[o];s=t[l],i=t[l+1],t[l]=c,t[l+1]=u}for(let o=0;o<50;o+=10){for(let a=0;a<10;a++)r[a]=t[o+a];for(let a=0;a<10;a++)t[o+a]^=~r[(a+2)%10]&r[(a+4)%10]}t[0]^=gae[n],t[1]^=mae[n]}hi(r)}let bae=class P9 extends qA{constructor(e,r,n,s=!1,i=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=e,this.suffix=r,this.outputLen=n,this.enableXOF=s,this.rounds=i,cc(n),!(0<e&&e<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=Oy(this.state)}clone(){return this._cloneInto()}keccak(){Kc(this.state32),yae(this.state32,this.rounds),Kc(this.state32),this.posOut=0,this.pos=0}update(e){ku(this),e=Gi(e),Zi(e);const{blockLen:r,state:n}=this,s=e.length;for(let i=0;i<s;){const o=Math.min(r-this.pos,s-i);for(let a=0;a<o;a++)n[this.pos++]^=e[i++];this.pos===r&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:e,suffix:r,pos:n,blockLen:s}=this;e[n]^=r,(r&128)!==0&&n===s-1&&this.keccak(),e[s-1]^=128,this.keccak()}writeInto(e){ku(this,!1),Zi(e),this.finish();const r=this.state,{blockLen:n}=this;for(let s=0,i=e.length;s<i;){this.posOut>=n&&this.keccak();const o=Math.min(n-this.posOut,i-s);e.set(r.subarray(this.posOut,this.posOut+o),s),this.posOut+=o,s+=o}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return cc(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(hO(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,hi(this.state)}_cloneInto(e){const{blockLen:r,suffix:n,outputLen:s,rounds:i,enableXOF:o}=this;return e||(e=new P9(r,n,s,o,i)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=i,e.suffix=n,e.outputLen=s,e.enableXOF=o,e.destroyed=this.destroyed,e}};const wae=(t,e,r)=>b0(()=>new bae(e,t,r)),Eae=wae(1,136,256/8);function vae(t,e,r,n){if(typeof t.setBigUint64=="function")return t.setBigUint64(e,r,n);const s=BigInt(32),i=BigInt(4294967295),o=Number(r>>s&i),a=Number(r&i),c=n?4:0,u=n?0:4;t.setUint32(e+c,o,n),t.setUint32(e+u,a,n)}function _ae(t,e,r){return t&e^~t&r}function Aae(t,e,r){return t&e^t&r^e&r}let O9=class extends qA{constructor(e,r,n,s){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=e,this.outputLen=r,this.padOffset=n,this.isLE=s,this.buffer=new Uint8Array(e),this.view=uI(this.buffer)}update(e){ku(this),e=Gi(e),Zi(e);const{view:r,buffer:n,blockLen:s}=this,i=e.length;for(let o=0;o<i;){const a=Math.min(s-this.pos,i-o);if(a===s){const c=uI(e);for(;s<=i-o;o+=s)this.process(c,o);continue}n.set(e.subarray(o,o+a),this.pos),this.pos+=a,o+=a,this.pos===s&&(this.process(r,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){ku(this),hO(e,this),this.finished=!0;const{buffer:r,view:n,blockLen:s,isLE:i}=this;let{pos:o}=this;r[o++]=128,hi(this.buffer.subarray(o)),this.padOffset>s-o&&(this.process(n,0),o=0);for(let d=o;d<s;d++)r[d]=0;vae(n,s-8,BigInt(this.length*8),i),this.process(n,0);const a=uI(e),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const u=c/4,l=this.get();if(u>l.length)throw new Error("_sha2: outputLen bigger than state");for(let d=0;d<u;d++)a.setUint32(4*d,l[d],i)}digest(){const{buffer:e,outputLen:r}=this;this.digestInto(e);const n=e.slice(0,r);return this.destroy(),n}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:r,buffer:n,length:s,finished:i,destroyed:o,pos:a}=this;return e.destroyed=o,e.finished=i,e.length=s,e.pos=a,s%r&&e.buffer.set(n),e}clone(){return this._cloneInto()}};const Sc=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),gn=Uint32Array.from([3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]),mn=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209]),Cae=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Tc=new Uint32Array(64);class Iae extends O9{constructor(e=32){super(64,e,8,!1),this.A=Sc[0]|0,this.B=Sc[1]|0,this.C=Sc[2]|0,this.D=Sc[3]|0,this.E=Sc[4]|0,this.F=Sc[5]|0,this.G=Sc[6]|0,this.H=Sc[7]|0}get(){const{A:e,B:r,C:n,D:s,E:i,F:o,G:a,H:c}=this;return[e,r,n,s,i,o,a,c]}set(e,r,n,s,i,o,a,c){this.A=e|0,this.B=r|0,this.C=n|0,this.D=s|0,this.E=i|0,this.F=o|0,this.G=a|0,this.H=c|0}process(e,r){for(let d=0;d<16;d++,r+=4)Tc[d]=e.getUint32(r,!1);for(let d=16;d<64;d++){const f=Tc[d-15],g=Tc[d-2],h=co(f,7)^co(f,18)^f>>>3,p=co(g,17)^co(g,19)^g>>>10;Tc[d]=p+Tc[d-7]+h+Tc[d-16]|0}let{A:n,B:s,C:i,D:o,E:a,F:c,G:u,H:l}=this;for(let d=0;d<64;d++){const f=co(a,6)^co(a,11)^co(a,25),g=l+f+_ae(a,c,u)+Cae[d]+Tc[d]|0,h=(co(n,2)^co(n,13)^co(n,22))+Aae(n,s,i)|0;l=u,u=c,c=a,a=o+g|0,o=i,i=s,s=n,n=g+h|0}n=n+this.A|0,s=s+this.B|0,i=i+this.C|0,o=o+this.D|0,a=a+this.E|0,c=c+this.F|0,u=u+this.G|0,l=l+this.H|0,this.set(n,s,i,o,a,c,u,l)}roundClean(){hi(Tc)}destroy(){this.set(0,0,0,0,0,0,0,0),hi(this.buffer)}}const N9=w9(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e3585
265771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(t=>BigInt(t))),Sae=N9[0],Tae=N9[1],Pc=new Uint32Array(80),Oc=new Uint32Array(80);let pO=class extends O9{constructor(e=64){super(128,e,16,!1),this.Ah=mn[0]|0,this.Al=mn[1]|0,this.Bh=mn[2]|0,this.Bl=mn[3]|0,this.Ch=mn[4]|0,this.Cl=mn[5]|0,this.Dh=mn[6]|0,this.Dl=mn[7]|0,this.Eh=mn[8]|0,this.El=mn[9]|0,this.Fh=mn[10]|0,this.Fl=mn[11]|0,this.Gh=mn[12]|0,this.Gl=mn[13]|0,this.Hh=mn[14]|0,this.Hl=mn[15]|0}get(){const{Ah:e,Al:r,Bh:n,Bl:s,Ch:i,Cl:o,Dh:a,Dl:c,Eh:u,El:l,Fh:d,Fl:f,Gh:g,Gl:h,Hh:p,Hl:y}=this;return[e,r,n,s,i,o,a,c,u,l,d,f,g,h,p,y]}set(e,r,n,s,i,o,a,c,u,l,d,f,g,h,p,y){this.Ah=e|0,this.Al=r|0,this.Bh=n|0,this.Bl=s|0,this.Ch=i|0,this.Cl=o|0,this.Dh=a|0,this.Dl=c|0,this.Eh=u|0,this.El=l|0,this.Fh=d|0,this.Fl=f|0,this.Gh=g|0,this.Gl=h|0,this.Hh=p|0,this.Hl=y|0}process(e,r){for(let v=0;v<16;v++,r+=4)Pc[v]=e.getUint32(r),Oc[v]=e.getUint32(r+=4);for(let v=16;v<80;v++){const E=Pc[v-15]|0,b=Oc[v-15]|0,m=Vc(E,b,1)^Vc(E,b,8)^mB(E,b,7),_=Gc(E,b,1)^Gc(E,b,8)^yB(E,b,7),O=Pc[v-2]|0,C=Oc[v-2]|0,S=Vc(O,C,19)^wm(O,C,61)^mB(O,C,6),T=Gc(O,C,19)^Em(O,C,61)^yB(O,C,6),N=nae(_,T,Oc[v-7],Oc[v-16]),R=sae(N,m,S,Pc[v-7],Pc[v-16]);Pc[v]=R|0,Oc[v]=N|0}let{Ah:n,Al:s,Bh:i,Bl:o,Ch:a,Cl:c,Dh:u,Dl:l,Eh:d,El:f,Fh:g,Fl:h,Gh:p,Gl:y,Hh:w,Hl:I}=this;for(let v=0;v<80;v++){const E=Vc(d,f,14)^Vc(d,f,18)^wm(d,f,41),b=Gc(d,f,14)^Gc(d,f,18)^Em(d,f,41),m=d&g^~d&p,_=f&h^~f&y,O=iae(I,b,_,Tae[v],Oc[v]),C=oae(O,w,E,m,Sae[v],Pc[v]),S=O|0,T=Vc(n,s,28)^wm(n,s,34)^wm(n,s,39),N=Gc(n,s,28)^Em(n,s,34)^Em(n,s,39),R=n&i^n&a^i&a,B=s&o^s&c^o&c;w=p|0,I=y|0,p=g|0,y=h|0,g=d|0,h=f|0,{h:d,l:f}=Ni(u|0,l|0,C|0,S|0),u=a|0,l=c|0,a=i|0,c=o|0,i=n|0,o=s|0;const A=dO(S,N,B);n=fO(A,C,T,R),s=A|0}({h:n,l:s}=Ni(this.Ah|0,this.Al|0,n|0,s|0)),{h:i,l:o}=Ni(this.Bh|0,this.Bl|0,i|0,o|0),{h:a,l:c}=Ni(this.Ch|0,this.Cl|0,a|0,c|0),{h:u,l}=Ni(this.Dh|0,this.Dl|0,u|0,l|0),{h:d,l:f}=Ni(this.Eh|0,this.El|0,d|0,f|0),{h:g,l:h}=Ni(this.Fh|0,this.Fl|0,g|0,h|0),{h:p,l:y}=Ni(this.Gh|0,this.Gl|0,p|0,y|0),{h:w,l:I}=Ni(this.Hh|0,this.Hl|0,w|0,I|0),this.set(n,s,i,o,a,c,u,l,d,f,g,h,p,y,w,I)}roundClean(){hi(Pc,Oc)}destroy(){hi(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}};class Pae extends pO{constructor(){super(48),this.Ah=gn[0]|0,this.Al=gn[1]|0,this.Bh=gn[2]|0,this.Bl=gn[3]|0,this.Ch=gn[4]|0,this.Cl=gn[5]|0,this.Dh=gn[6]|0,this.Dl=gn[7]|0,this.Eh=gn[8]|0,this.El=gn[9]|0,this.Fh=gn[10]|0,this.Fl=gn[11]|0,this.Gh=gn[12]|0,this.Gl=gn[13]|0,this.Hh=gn[14]|0,this.Hl=gn[15]|0}}const yn=Uint32Array.from([573645204,4230739756,2673172387,3360449730,596883563,1867755857,2520282905,1497426621,2519219938,2827943907,3193839141,1401305490,721525244,746961066,246885852,2177182882]);class Oae extends pO{constructor(){super(32),this.Ah=yn[0]|0,this.Al=yn[1]|0,this.Bh=yn[2]|0,this.Bl=yn[3]|0,this.Ch=yn[4]|0,this.Cl=yn[5]|0,this.Dh=yn[6]|0,this.Dl=yn[7]|0,this.Eh=yn[8]|0,this.El=yn[9]|0,this.Fh=yn[10]|0,this.Fl=yn[11]|0,this.Gh=yn[12]|0,this.Gl=yn[13]|0,this.Hh=yn[14]|0,this.Hl=yn[15]|0}}const zA=b0(()=>new Iae),Nae=b0(()=>new pO),xae=b0(()=>new Pae),Rae=b0(()=>new Oae),Bae=Uint8Array.from([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9]),jr=Uint32Array.from([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),Te=new Uint32Array(32);function Nc(t,e,r,n,s,i){const o=s[i],a=s[i+1];let c=Te[2*t],u=Te[2*t+1],l=Te[2*e],d=Te[2*e+1],f=Te[2*r],g=Te[2*r+1],h=Te[2*n],p=Te[2*n+1],y=dO(c,l,o);u=fO(y,u,d,a),c=y|0,{Dh:p,Dl:h}={Dh:p^u,Dl:h^c},{Dh:p,Dl:h}={Dh:Joe(p,h),Dl:Qoe(p)},{h:g,l:f}=Ni(g,f,p,h),{Bh:d,Bl:l}={Bh:d^g,Bl:l^f},{Bh:d,Bl:l}={Bh:Vc(d,l,24),Bl:Gc(d,l,24)},Te[2*t]=c,Te[2*t+1]=u,Te[2*e]=l,Te[2*e+1]=d,Te[2*r]=f,Te[2*r+1]=g,Te[2*n]=h,Te[2*n+1]=p}function xc(t,e,r,n,s,i){const o=s[i],a=s[i+1];let c=Te[2*t],u=Te[2*t+1],l=Te[2*e],d=Te[2*e+1],f=Te[2*r],g=Te[2*r+1],h=Te[2*n],p=Te[2*n+1],y=dO(c,l,o);u=fO(y,u,d,a),c=y|0,{Dh:p,Dl:h}={Dh:p^u,Dl:h^c},{Dh:p,Dl:h}={Dh:Vc(p,h,16),Dl:Gc(p,h,16)},{h:g,l:f}=Ni(g,f,p,h),{Bh:d,Bl:l}={Bh:d^g,Bl:l^f},{Bh:d,Bl:l}={Bh:wm(d,l,63),Bl:Em(d,l,63)},Te[2*t]=c,Te[2*t+1]=u,Te[2*e]=l,Te[2*e+1]=d,Te[2*r]=f,Te[2*r+1]=g,Te[2*n]=h,Te[2*n+1]=p}function kae(t,e={},r,n,s){if(cc(r),t<0||t>r)throw new Error("outputLen bigger than keyLen");const{key:i,salt:o,personalization:a}=e;if(i!==void 0&&(i.length<1||i.length>r))throw new Error("key length must be undefined or 1.."+r);if(o!==void 0&&o.length!==n)throw new Error("salt must be undefined or "+n);if(a!==void 0&&a.length!==s)throw new Error("personalization must be undefined or "+s)}class jae extends qA{constructor(e,r){super(),this.finished=!1,this.destroyed=!1,this.length=0,this.pos=0,cc(e),cc(r),this.blockLen=e,this.outputLen=r,this.buffer=new Uint8Array(e),this.buffer32=Oy(this.buffer)}update(e){ku(this),e=Gi(e),Zi(e);const{blockLen:r,buffer:n,buffer32:s}=this,i=e.length,o=e.byteOffset,a=e.buffer;for(let c=0;c<i;){this.pos===r&&(Kc(s),this.compress(s,0,!1),Kc(s),this.pos=0);const u=Math.min(r-this.pos,i-c),l=o+c;if(u===r&&!(l%4)&&c+u<i){const d=new Uint32Array(a,l,Math.floor((i-c)/4));Kc(d);for(let f=0;c+r<i;f+=s.length,c+=r)this.length+=r,this.compress(d,f,!1);Kc(d);continue}n.set(e.subarray(c,c+u),this.pos),this.pos+=u,this.length+=u,c+=u}return this}digestInto(e){ku(this),hO(e,this);const{pos:r,buffer32:n}=this;this.finished=!0,hi(this.buffer.subarray(r)),Kc(n),this.compress(n,0,!0),Kc(n);const s=Oy(e);
vendor: 38,647 bytes, lines 26-29
26this.get().forEach((i,o)=>s[o]=Ia(i))}digest(){const{buffer:e,outputLen:r}=this;this.digestInto(e);const n=e.slice(0,r);return this.destroy(),n}_cloneInto(e){const{buffer:r,length:n,finished:s,destroyed:i,outputLen:o,pos:a}=this;return e||(e=new this.constructor({dkLen:o})),e.set(...this.get()),e.buffer.set(r),e.destroyed=i,e.finished=s,e.length=n,e.pos=a,e.outputLen=o,e}clone(){return this._cloneInto()}}class Dae extends jae{constructor(e={}){const r=e.dkLen===void 0?64:e.dkLen;super(128,r),this.v0l=jr[0]|0,this.v0h=jr[1]|0,this.v1l=jr[2]|0,this.v1h=jr[3]|0,this.v2l=jr[4]|0,this.v2h=jr[5]|0,this.v3l=jr[6]|0,this.v3h=jr[7]|0,this.v4l=jr[8]|0,this.v4h=jr[9]|0,this.v5l=jr[10]|0,this.v5h=jr[11]|0,this.v6l=jr[12]|0,this.v6h=jr[13]|0,this.v7l=jr[14]|0,this.v7h=jr[15]|0,kae(r,e,64,16,16);let{key:n,personalization:s,salt:i}=e,o=0;if(n!==void 0&&(n=Gi(n),o=n.length),this.v0l^=this.outputLen|o<<8|65536|1<<24,i!==void 0){i=Gi(i);const a=Oy(i);this.v4l^=Ia(a[0]),this.v4h^=Ia(a[1]),this.v5l^=Ia(a[2]),this.v5h^=Ia(a[3])}if(s!==void 0){s=Gi(s);const a=Oy(s);this.v6l^=Ia(a[0]),this.v6h^=Ia(a[1]),this.v7l^=Ia(a[2]),this.v7h^=Ia(a[3])}if(n!==void 0){const a=new Uint8Array(this.blockLen);a.set(n),this.update(a)}}get(){let{v0l:e,v0h:r,v1l:n,v1h:s,v2l:i,v2h:o,v3l:a,v3h:c,v4l:u,v4h:l,v5l:d,v5h:f,v6l:g,v6h:h,v7l:p,v7h:y}=this;return[e,r,n,s,i,o,a,c,u,l,d,f,g,h,p,y]}set(e,r,n,s,i,o,a,c,u,l,d,f,g,h,p,y){this.v0l=e|0,this.v0h=r|0,this.v1l=n|0,this.v1h=s|0,this.v2l=i|0,this.v2h=o|0,this.v3l=a|0,this.v3h=c|0,this.v4l=u|0,this.v4h=l|0,this.v5l=d|0,this.v5h=f|0,this.v6l=g|0,this.v6h=h|0,this.v7l=p|0,this.v7h=y|0}compress(e,r,n){this.get().forEach((c,u)=>Te[u]=c),Te.set(jr,16);let{h:s,l:i}=b9(BigInt(this.length));Te[24]=jr[8]^i,Te[25]=jr[9]^s,n&&(Te[28]=~Te[28],Te[29]=~Te[29]);let o=0;const a=Bae;for(let c=0;c<12;c++)Nc(0,4,8,12,e,r+2*a[o++]),xc(0,4,8,12,e,r+2*a[o++]),Nc(1,5,9,13,e,r+2*a[o++]),xc(1,5,9,13,e,r+2*a[o++]),Nc(2,6,10,14,e,r+2*a[o++]),xc(2,6,10,14,e,r+2*a[o++]),Nc(3,7,11,15,e,r+2*a[o++]),xc(3,7,11,15,e,r+2*a[o++]),Nc(0,5,10,15,e,r+2*a[o++]),xc(0,5,10,15,e,r+2*a[o++]),Nc(1,6,11,12,e,r+2*a[o++]),xc(1,6,11,12,e,r+2*a[o++]),Nc(2,7,8,13,e,r+2*a[o++]),xc(2,7,8,13,e,r+2*a[o++]),Nc(3,4,9,14,e,r+2*a[o++]),xc(3,4,9,14,e,r+2*a[o++]);this.v0l^=Te[0]^Te[16],this.v0h^=Te[1]^Te[17],this.v1l^=Te[2]^Te[18],this.v1h^=Te[3]^Te[19],this.v2l^=Te[4]^Te[20],this.v2h^=Te[5]^Te[21],this.v3l^=Te[6]^Te[22],this.v3h^=Te[7]^Te[23],this.v4l^=Te[8]^Te[24],this.v4h^=Te[9]^Te[25],this.v5l^=Te[10]^Te[26],this.v5h^=Te[11]^Te[27],this.v6l^=Te[12]^Te[28],this.v6h^=Te[13]^Te[29],this.v7l^=Te[14]^Te[30],this.v7h^=Te[15]^Te[31],hi(Te)}destroy(){this.destroyed=!0,hi(this.buffer32),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const Uae=uae(t=>new Dae(t)),Mae="https://rpc.walletconnect.org/v1";function x9(t){const e=`�Ethereum Signed Message:
27${t.length}`,r=new TextEncoder().encode(e+t);return"0x"+bt.from(Eae(r)).toString("hex")}async function $ae(t,e,r,n,s,i){switch(r.t){case"eip191":return await Lae(t,e,r.s);case"eip1271":return await Fae(t,e,r.s,n,s,i);default:throw new Error(`verifySignature failed: Attempted to verify CacaoSignature with unknown type: ${r.t}`)}}function Lae(t,e,r){const n=Sse(r);return Dse({payload:x9(e),signature:n}).toLowerCase()===t.toLowerCase()}async function Fae(t,e,r,n,s,i){const o=rc(n);if(!o.namespace||!o.reference)throw new Error(`isValidEip1271Signature failed: chainId must be in CAIP-2 format, received: ${n}`);try{const a="0x1626ba7e",c="0000000000000000000000000000000000000000000000000000000000000040",u=r.substring(2),l=(u.length/2).toString(16).padStart(64,"0"),d=(e.startsWith("0x")?e:x9(e)).substring(2),f=a+d+c+l+u,g=await fetch(`${i||Mae}/?chainId=${n}&projectId=${s}`,{headers:{"Content-Type":"application/json"},method:"POST",body:JSON.stringify({id:Hae(),jsonrpc:"2.0",method:"eth_call",params:[{to:t,data:f},"latest"]})}),{result:h}=await g.json();return h?h.slice(0,a.length).toLowerCase()===a.toLowerCase():!1}catch(a){return console.error("isValidEip1271Signature: ",a),!1}}function Hae(){return Date.now()+Math.floor(Math.random()*1e3)}function qae(t){const e=atob(t),r=new Uint8Array(e.length);for(let o=0;o<e.length;o++)r[o]=e.charCodeAt(o);const n=r[0];if(n===0)throw new Error("No signatures found");const s=1+n*64;if(r.length<s)throw new Error("Transaction data too short for claimed signature count");if(r.length<100)throw new Error("Transaction too short");const i=bt.from(t,"base64").slice(1,65);return g0.encode(i)}function zae(t){const e=new Uint8Array(bt.from(t,"base64")),r=Array.from("TransactionData::").map(i=>i.charCodeAt(0)),n=new Uint8Array(r.length+e.length);n.set(r),n.set(e,r.length);const s=Uae(n,{dkLen:32});return g0.encode(s)}function vB(t){const e=new Uint8Array(zA(Wae(t)));return g0.encode(e)}function Wae(t){if(t instanceof Uint8Array)return t;if(Array.isArray(t))return new Uint8Array(t);if(typeof t=="object"&&t!=null&&t.data)return new Uint8Array(Object.values(t.data));if(typeof t=="object"&&t)return new Uint8Array(Object.values(t));throw new Error("getNearUint8ArrayFromBytes: Unexpected result type from bytes array")}function _B(t){const e=bt.from(t,"base64"),r=wie(e).txn;if(!r)throw new Error("Invalid signed transaction: missing 'txn' field");const n=lie(r),s=bt.from("TX"),i=bt.concat([s,bt.from(n)]),o=Rae(i);return kse.encode(o).replace(/=+$/,"")}function lI(t){const e=[];let r=BigInt(t);for(;r>=BigInt(128);)e.push(Number(r&BigInt(127)|BigInt(128))),r>>=BigInt(7);return e.push(Number(r)),bt.from(e)}function Vae(t){const e=bt.from(t.signed.bodyBytes,"base64"),r=bt.from(t.signed.authInfoBytes,"base64"),n=bt.from(t.signature.signature,"base64"),s=[];s.push(bt.from([10])),s.push(lI(e.length)),s.push(e),s.push(bt.from([18])),s.push(lI(r.length)),s.push(r),s.push(bt.from([26])),s.push(lI(n.length)),s.push(n);const i=bt.concat(s),o=zA(i);return bt.from(o).toString("hex").toUpperCase()}function Gae(t){var e,r;const n=[];try{if(typeof t=="string")return n.push(t),n;if(typeof t!="object")return n;t!=null&&t.id&&n.push(t.id);const s=(r=(e=t==null?void 0:t.capabilities)==null?void 0:e.caip345)==null?void 0:r.transactionHashes;s&&n.push(...s)}catch(s){console.warn("getWalletSendCallsHashes failed: ",s)}return n}var Kae=Object.defineProperty,Zae=Object.defineProperties,Yae=Object.getOwnPropertyDescriptors,AB=Object.getOwnPropertySymbols,Jae=Object.prototype.hasOwnProperty,Qae=Object.prototype.propertyIsEnumerable,CB=(t,e,r)=>e in t?Kae(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Xae=(t,e)=>{for(var r in e||(e={}))Jae.call(e,r)&&CB(t,r,e[r]);if(AB)for(var r of AB(e))Qae.call(e,r)&&CB(t,r,e[r]);return t},ece=(t,e)=>Zae(t,Yae(e));const R9="did:pkh:",tce={eip155:"Ethereum",solana:"Solana",bip122:"Bitcoin"},rce=t=>t?tce[t]||t:"",WA=t=>t==null?void 0:t.split(":"),nce=t=>{const e=t&&WA(t);if(e)return t.includes(R9)?e[3]:e[1]},sce=t=>{const e=t&&WA(t);if(e)return t.includes(R9)?e[2]:e[0]},AT=t=>{const e=t&&WA(t);if(e)return e[2]+":"+e[3]},Q_=t=>{const e=t&&WA(t);if(e)return e.pop()};async function IB(t){const{cacao:e,projectId:r}=t,{s:n,p:s}=e,i=gO(s,s.iss),o=Q_(s.iss);return await $ae(o,i,n,AT(s.iss),r)}const gO=(t,e)=>{const r=sce(e);if(!r)throw new Error("Invalid issuer: "+e);const n=`${t.domain} wants you to sign in with your ${rce(r)} account:`,s=Q_(e);if(!t.aud&&!t.uri)throw new Error("Either `aud` or `uri` is required to construct the message");let i=t.statement||void 0;const o=`URI: ${t.aud||t.uri}`,a=`Version: ${t.version}`,c=`Chain ID: ${nce(e)}`,u=`Nonce: ${t.nonce}`,l=`Issued At: ${t.iat}`,d=t.exp?`Expiration Time: ${t.exp}`:void 0,f=t.nbf?`Not Before: ${t.nbf}`:void 0,g=t.requestId?`Request ID: ${t.requestId}`:void 0,h=t.resources?`Resources:${t.resources.map(y=>`
28- ${y}`).join("")}`:void 0,p=d_(t.resources);if(p){const y=Ny(p);i=hce(i,y)}return[n,s,"",i,"",o,a,c,u,l,d,f,g,h].filter(y=>y!=null).join(`
29`)};function ice(t){return bt.from(JSON.stringify(t)).toString("base64")}function oce(t){return JSON.parse(bt.from(t,"base64").toString("utf-8"))}function Bd(t){if(!t)throw new Error("No recap provided, value is undefined");if(!t.att)throw new Error("No `att` property found");const e=Object.keys(t.att);if(!(e!=null&&e.length))throw new Error("No resources found in `att` property");e.forEach(r=>{const n=t.att[r];if(Array.isArray(n))throw new Error(`Resource must be an object: ${r}`);if(typeof n!="object")throw new Error(`Resource must be an object: ${r}`);if(!Object.keys(n).length)throw new Error(`Resource object is empty: ${r}`);Object.keys(n).forEach(s=>{const i=n[s];if(!Array.isArray(i))throw new Error(`Ability limits ${s} must be an array of objects, found: ${i}`);if(!i.length)throw new Error(`Value of ${s} is empty array, must be an array with objects`);i.forEach(o=>{if(typeof o!="object")throw new Error(`Ability limits (${s}) must be an array of objects, found: ${o}`)})})})}function ace(t,e,r,n={}){return r==null||r.sort((s,i)=>s.localeCompare(i)),{att:{[t]:cce(e,r,n)}}}function cce(t,e,r={}){e=e==null?void 0:e.sort((s,i)=>s.localeCompare(i));const n=e.map(s=>({[`${t}/${s}`]:[r]}));return Object.assign({},...n)}function B9(t){return Bd(t),`urn:recap:${ice(t).replace(/=/g,"")}`}function Ny(t){const e=oce(t.replace("urn:recap:",""));return Bd(e),e}function uce(t,e,r){const n=ace(t,e,r);return B9(n)}function lce(t){return t&&t.includes("urn:recap:")}function dce(t,e){const r=Ny(t),n=Ny(e),s=fce(r,n);return B9(s)}function fce(t,e){Bd(t),Bd(e);const r=Object.keys(t.att).concat(Object.keys(e.att)).sort((s,i)=>s.localeCompare(i)),n={att:{}};return r.forEach(s=>{var i,o;Object.keys(((i=t.att)==null?void 0:i[s])||{}).concat(Object.keys(((o=e.att)==null?void 0:o[s])||{})).sort((a,c)=>a.localeCompare(c)).forEach(a=>{var c,u;n.att[s]=ece(Xae({},n.att[s]),{[a]:((c=t.att[s])==null?void 0:c[a])||((u=e.att[s])==null?void 0:u[a])})})}),n}function hce(t="",e){Bd(e);const r="I further authorize the stated URI to perform the following actions on my behalf: ";if(t.includes(r))return t;const n=[];let s=0;Object.keys(e.att).forEach(a=>{const c=Object.keys(e.att[a]).map(d=>({ability:d.split("/")[0],action:d.split("/")[1]}));c.sort((d,f)=>d.action.localeCompare(f.action));const u={};c.forEach(d=>{u[d.ability]||(u[d.ability]=[]),u[d.ability].push(d.action)});const l=Object.keys(u).map(d=>(s++,`(${s}) '${d}': '${u[d].join("', '")}' for '${a}'.`));n.push(l.join(", ").replace(".,","."))});const i=n.join(" "),o=`${r}${i}`;return`${t?t+" ":""}${o}`}function SB(t){var e;const r=Ny(t);Bd(r);const n=(e=r.att)==null?void 0:e.eip155;return n?Object.keys(n).map(s=>s.split("/")[1]):[]}function TB(t){const e=Ny(t);Bd(e);const r=[];return Object.values(e.att).forEach(n=>{Object.values(n).forEach(s=>{var i;(i=s==null?void 0:s[0])!=null&&i.chains&&r.push(s[0].chains)})}),[...new Set(r.flat())]}function d_(t){if(!t)return;const e=t==null?void 0:t[t.length-1];return lce(e)?e:void 0}/*! noble-ciphers - MIT License (c) 2023 Paul Miller (paulmillr.com) */function k9(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}function CT(t){if(typeof t!="boolean")throw new Error(`boolean expected, not ${t}`)}function dI(t){if(!Number.isSafeInteger(t)||t<0)throw new Error("positive integer expected, got "+t)}function hs(t,...e){if(!k9(t))throw new Error("Uint8Array expected");if(e.length>0&&!e.includes(t.length))throw new Error("Uint8Array expected of length "+e+", got length="+t.length)}function PB(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function pce(t,e){hs(t);const r=e.outputLen;if(t.length<r)throw new Error("digestInto() expects output buffer of length at least "+r)}function Su(t){return new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4))}function fp(...t){for(let e=0;e<t.length;e++)t[e].fill(0)}function gce(t){return new DataView(t.buffer,t.byteOffset,t.byteLength)}const mce=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function yce(t){if(typeof t!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(t))}function IT(t){if(typeof t=="string")t=yce(t);else if(k9(t))t=ST(t);else throw new Error("Uint8Array expected, got "+typeof t);return t}function bce(t,e){if(e==null||typeof e!="object")throw new Error("options must be defined");return Object.assign(t,e)}function wce(t,e){if(t.length!==e.length)return!1;let r=0;for(let n=0;n<t.length;n++)r|=t[n]^e[n];return r===0}const Ece=(t,e)=>{function r(n,...s){if(hs(n),!mce)throw new Error("Non little-endian hardware is not yet supported");if(t.nonceLength!==void 0){const u=s[0];if(!u)throw new Error("nonce / iv required");t.varSizeNonce?hs(u):hs(u,t.nonceLength)}const i=t.tagLength;i&&s[1]!==void 0&&hs(s[1]);const o=e(n,...s),a=(u,l)=>{if(l!==void 0){if(u!==2)throw new Error("cipher output not supported");hs(l)}};let c=!1;return{encrypt(u,l){if(c)throw new Error("cannot encrypt() twice with same key + nonce");return c=!0,hs(u),a(o.encrypt.length,l),o.encrypt(u,l)},decrypt(u,l){if(hs(u),i&&u.length<i)throw new Error("invalid ciphertext length: smaller than tagLength="+i);return a(o.decrypt.length,l),o.decrypt(u,l)}}}return Object.assign(r,t),r};function OB(t,e,r=!0){if(e===void 0)return new Uint8Array(t);if(e.length!==t)throw new Error("invalid output length, expected "+t+", got: "+e.length);if(r&&!_ce(e))throw new Error("invalid output, must be aligned");return e}function NB(t,e,r,n){if(typeof t.setBigUint64=="function")return t.setBigUint64(e,r,n);const s=BigInt(32),i=BigInt(4294967295),o=Number(r>>s&i),a=Number(r&i);t.setUint32(e+4,o,n),t.setUint32(e+0,a,n)}function vce(t,e,r){CT(r);const n=new Uint8Array(16),s=gce(n);return NB(s,0,BigInt(e),r),NB(s,8,BigInt(t),r),n}function _ce(t){return t.byteOffset%4===0}function ST(t){return Uint8Array.from(t)}const j9=t=>Uint8Array.from(t.split("").map(e=>e.charCodeAt(0))),Ace=j9("expand 16-byte k"),Cce=j9("expand 32-byte k"),Ice=Su(Ace),Sce=Su(Cce);function St(t,e){return t<<e|t>>>32-e}function TT(t){return t.byteOffset%4===0}const Cb=64,Tce=16,D9=2**32-1,xB=new Uint32Array;function Pce(t,e,r,n,s,i,o,a){const c=s.length,u=new Uint8Array(Cb),l=Su(u),d=TT(s)&&TT(i),f=d?Su(s):xB,g=d?Su(i):xB;for(let h=0;h<c;o++){if(t(e,r,n,l,o,a),o>=D9)throw new Error("arx: counter overflow");const p=Math.min(Cb,c-h);if(d&&p===Cb){const y=h/4;if(h%4!==0)throw new Error("arx: invalid block position");for(let w=0,I;w<Tce;w++)I=y+w,g[I]=f[I]^l[w];h+=Cb;continue}for(let y=0,w;y<p;y++)w=h+y,i[w]=s[w]^u[y];h+=p}}function Oce(t,e){const{allowShortKeys:r,extendNonceFn:n,counterLength:s,counterRight:i,rounds:o}=bce({allowShortKeys:!1,counterLength:8,counterRight:!1,rounds:20},e);if(typeof t!="function")throw new Error("core must be a function");return dI(s),dI(o),CT(i),CT(r),(a,c,u,l,d=0)=>{hs(a),hs(c),hs(u);const f=u.length;if(l===void 0&&(l=new Uint8Array(f)),hs(l),dI(d),d<0||d>=D9)throw new Error("arx: counter overflow");if(l.length<f)throw new Error(`arx: output (${l.length}) is shorter than data (${f})`);const g=[];let h=a.length,p,y;if(h===32)g.push(p=ST(a)),y=Sce;else if(h===16&&r)p=new Uint8Array(32),p.set(a),p.set(a,16),y=Ice,g.push(p);else throw new Error(`arx: invalid 32-byte key, got length=${h}`);TT(c)||g.push(c=ST(c));const w=Su(p);if(n){if(c.length!==24)throw new Error("arx: extended nonce must be 24 bytes");n(y,w,Su(c.subarray(0,16)),w),c=c.subarray(16)}const I=16-s;if(I!==c.length)throw new Error(`arx: nonce must be ${I} or 16 bytes`);if(I!==12){const E=new Uint8Array(12);E.set(c,i?0:12-c.length),c=E,g.push(c)}const v=Su(c);return Pce(t,y,w,v,u,l,d,o),fp(...g),l}}const Xr=(t,e)=>t[e++]&255|(t[e++]&255)<<8;class Nce{constructor(e){this.blockLen=16,this.outputLen=16,this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.pos=0,this.finished=!1,e=IT(e),hs(e,32);const r=Xr(e,0),n=Xr(e,2),s=Xr(e,4),i=Xr(e,6),o=Xr(e,8),a=Xr(e,10),c=Xr(e,12),u=Xr(e,14);this.r[0]=r&8191,this.r[1]=(r>>>13|n<<3)&8191,this.r[2]=(n>>>10|s<<6)&7939,this.r[3]=(s>>>7|i<<9)&8191,this.r[4]=(i>>>4|o<<12)&255,this.r[5]=o>>>1&8190,this.r[6]=(o>>>14|a<<2)&8191,this.r[7]=(a>>>11|c<<5)&8065,this.r[8]=(c>>>8|u<<8)&8191,this.r[9]=u>>>5&127;for(let l=0;l<8;l++)this.pad[l]=Xr(e,16+2*l)}process(e,r,n=!1){const s=n?0:2048,{h:i,r:o}=this,a=o[0],c=o[1],u=o[2],l=o[3],d=o[4],f=o[5],g=o[6],h=o[7],p=o[8],y=o[9],w=Xr(e,r+0),I=Xr(e,r+2),v=Xr(e,r+4),E=Xr(e,r+6),b=Xr(e,r+8),m=Xr(e,r+10),_=Xr(e,r+12),O=Xr(e,r+14);let C=i[0]+(w&8191),S=i[1]+((w>>>13|I<<3)&8191),T=i[2]+((I>>>10|v<<6)&8191),N=i[3]+((v>>>7|E<<9)&8191),R=i[4]+((E>>>4|b<<12)&8191),B=i[5]+(b>>>1&8191),A=i[6]+((b>>>14|m<<2)&8191),P=i[7]+((m>>>11|_<<5)&8191),k=i[8]+((_>>>8|O<<8)&8191),U=i[9]+(O>>>5|s),x=0,j=x+C*a+S*(5*y)+T*(5*p)+N*(5*h)+R*(5*g);x=j>>>13,j&=8191,j+=B*(5*f)+A*(5*d)+P*(5*l)+k*(5*u)+U*(5*c),x+=j>>>13,j&=8191;let D=x+C*c+S*a+T*(5*y)+N*(5*p)+R*(5*h);x=D>>>13,D&=8191,D+=B*(5*g)+A*(5*f)+P*(5*d)+k*(5*l)+U*(5*u),x+=D>>>13,D&=8191;let M=x+C*u+S*c+T*a+N*(5*y)+R*(5*p);x=M>>>13,M&=8191,M+=B*(5*h)+A*(5*g)+P*(5*f)+k*(5*d)+U*(5*l),x+=M>>>13,M&=8191;let L=x+C*l+S*u+T*c+N*a+R*(5*y);x=L>>>13,L&=8191,L+=B*(5*p)+A*(5*h)+P*(5*g)+k*(5*f)+U*(5*d),x+=L>>>13,L&=8191;let H=x+C*d+S*l+T*u+N*c+R*a;x=H>>>13,H&=8191,H+=B*(5*y)+A*(5*p)+P*(5*h)+k*(5*g)+U*(5*f),x+=H>>>13,H&=8191;let z=x+C*f+S*d+T*l+N*u+R*c;x=z>>>13,z&=8191,z+=B*a+A*(5*y)+P*(5*p)+k*(5*h)+U*(5*g),x+=z>>>13,z&=8191;let V=x+C*g+S*f+T*d+N*l+R*u;x=V>>>13,V&=8191,V+=B*c+A*a+P*(5*y)+k*(5*p)+U*(5*h),x+=V>>>13,V&=8191;let G=x+C*h+S*g+T*f+N*d+R*l;x=G>>>13,G&=8191,G+=B*u+A*c+P*a+k*(5*y)+U*(5*p),x+=G>>>13,G&=8191;let ee=x+C*p+S*h+T*g+N*f+R*d;x=ee>>>13,ee&=8191,ee+=B*l+A*u+P*c+k*a+U*(5*y),x+=ee>>>13,ee&=8191;let X=x+C*y+S*p+T*h+N*g+R*f;x=X>>>13,X&=8191,X+=B*d+A*l+P*u+k*c+U*a,x+=X>>>13,X&=8191,x=(x<<2)+x|0,x=x+j|0,j=x&8191,x=x>>>13,D+=x,i[0]=j,i[1]=D,i[2]=M,i[3]=L,i[4]=H,i[5]=z,i[6]=V,i[7]=G,i[8]=ee,i[9]=X}finalize(){const{h:e,pad:r}=this,n=new Uint16Array(10);let s=e[1]>>>13;e[1]&=8191;for(let a=2;a<10;a++)e[a]+=s,s=e[a]>>>13,e[a]&=8191;e[0]+=s*5,s=e[0]>>>13,e[0]&=8191,e[1]+=s,s=e[1]>>>13,e[1]&=8191,e[2]+=s,n[0]=e[0]+5,s=n[0]>>>13,n[0]&=8191;for(let a=1;a<10;a++)n[a]=e[a]+s,s=n[a]>>>13,n[a]&=8191;n[9]-=8192;let i=(s^1)-1;for(let a=0;a<10;a++)n[a]&=i;i=~i;for(let a=0;a<10;a++)e[a]=e[a]&i|n[a];e[0]=(e[0]|e[1]<<13)&65535,e[1]=(e[1]>>>3|e[2]<<10)&65535,e[2]=(e[2]>>>6|e[3]<<7)&65535,e[3]=(e[3]>>>9|e[4]<<4)&65535,e[4]=(e[4]>>>12|e[5]<<1|e[6]<<14)&65535,e[5]=(e[6]>>>2|e[7]<<11)&65535,e[6]=(e[7]>>>5|e[8]<<8)&65535,e[7]=(e[8]>>>8|e[9]<<5)&65535;let o=e[0]+r[0];e[0]=o&65535;for(let a=1;a<8;a++)o=(e[a]+r[a]|0)+(o>>>16)|0,e[a]=o&65535;fp(n)}update(e){PB(this),e=IT(e),hs(e);const{buffer:r,blockLen:n}=this,s=e.length;for(let i=0;i<s;){const o=Math.min(n-this.pos,s-i);if(o===n){for(;n<=s-i;i+=n)this.process(e,i);continue}r.set(e.subarray(i,i+o),this.pos),this.pos+=o,i+=o,this.pos===n&&(this.process(r,0,!1),this.pos=0)}return this}destroy(){fp(this.h,this.r,this.buffer,this.pad)}digestInto(e){PB(this),pce(e,this),this.finished=!0;const{buffer:r,h:n}=this;let{pos:s}=this;if(s){for(r[s++]=1;s<16;s++)r[s]=0;this.process(r,0,!0)}this.finalize();let i=0;for(let o=0;o<8;o++)e[i++]=n[o]>>>0,e[i++]=n[o]>>>8;return e}digest(){const{buffer:e,outputLen:r}=this;this.digestInto(e);const n=e.slice(0,r);return this.destroy(),n}}function xce(t){const e=(n,s)=>t(s).update(IT(n)).digest(),r=t(new Uint8Array(32));return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=n=>t(n),e}const Rce=xce(t=>new Nce(t));function Bce(t,e,r,n,s,i=20){let o=t[0],a=t[1],c=t[2],u=t[3],l=e[0],d=e[1],f=e[2],g=e[3],h=e[4],p=e[5],y=e[6],w=e[7],I=s,v=r[0],E=r[1],b=r[2],m=o,_=a,O=c,C=u,S=l,T=d,N=f,R=g,B=h,A=p,P=y,k=w,U=I,x=v,j=E,D=b;for(let L=0;L<i;L+=2)m=m+S|0,U=St(U^m,16),B=B+U|0,S=St(S^B,12),m=m+S|0,U=St(U^m,8),B=B+U|0,S=St(S^B,7),_=_+T|0,x=St(x^_,16),A=A+x|0,T=St(T^A,12),_=_+T|0,x=St(x^_,8),A=A+x|0,T=St(T^A,7),O=O+N|0,j=St(j^O,16),P=P+j|0,N=St(N^P,12),O=O+N|0,j=St(j^O,8),P=P+j|0,N=St(N^P,7),C=C+R|0,D=St(D^C,16),k=k+D|0,R=St(R^k,12),C=C+R|0,D=St(D^C,8),k=k+D|0,R=St(R^k,7),m=m+T|0,D=St(D^m,16),P=P+D|0,T=St(T^P,12),m=m+T|0,D=St(D^m,8),P=P+D|0,T=St(T^P,7),_=_+N|0,U=St(U^_,16),k=k+U|0,N=St(N^k,12),_=_+N|0,U=St(U^_,8),k=k+U|0,N=St(N^k,7),O=O+R|0,x=St(x^O,16),B=B+x|0,R=St(R^B,12),O=O+R|0,x=St(x^O,8),B=B+x|0,R=St(R^B,7),C=C+S|0,j=St(j^C,16),A=A+j|0,S=St(S^A,12),C=C+S|0,j=St(j^C,8),A=A+j|0,S=St(S^A,7);let M=0;n[M++]=o+m|0,n[M++]=a+_|0,n[M++]=c+O|0,n[M++]=u+C|0,n[M++]=l+S|0,n[M++]=d+T|0,n[M++]=f+N|0,n[M++]=g+R|0,n[M++]=h+B|0,n[M++]=p+A|0,n[M++]=y+P|0,n[M++]=w+k|0,n[M++]=I+U|0,n[M++]=v+x|0,n[M++]=E+j|0,n[M++]=b+D|0}const kce=Oce(Bce,{counterRight:!1,counterLength:4,allowShortKeys:!1}),jce=new Uint8Array(16),RB=(t,e)=>{t.update(e);const r=e.length%16;r&&t.update(jce.subarray(r))},Dce=new Uint8Array(32);function BB(t,e,r,n,s){const i=t(e,r,Dce),o=Rce.create(i);s&&RB(o,s),RB(o,n);const a=vce(n.length,s?s.length:0,!0);o.update(a);const c=o.digest();return fp(i,a),c}const Uce=t=>(e,r,n)=>({encrypt(s,i){const o=s.length;i=OB(o+16,i,!1),i.set(s);const a=i.subarray(0,-16);t(e,r,a,a,1);const c=BB(t,e,r,a,n);return i.set(c,o),fp(c),i},decrypt(s,i){i=OB(s.length-16,i,!1);const o=s.subarray(0,-16),a=s.subarray(-16),c=BB(t,e,r,o,n);if(!wce(a,c))throw new Error("invalid tag");return i.set(s.subarray(0,-16)),t(e,r,i,i,1),fp(c),i}}),U9=Ece({blockSize:64,nonceLength:12,tagLength:16},Uce(kce));let M9=class extends qA{constructor(e,r){super(),this.finished=!1,this.destroyed=!1,HA(e);const n=Gi(r);if(this.iHash=e.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const s=this.blockLen,i=new Uint8Array(s);i.set(n.length>s?e.create().update(n).digest():n);for(let o=0;o<i.length;o++)i[o]^=54;this.iHash.update(i),this.oHash=e.create();for(let o=0;o<i.length;o++)i[o]^=106;this.oHash.update(i),hi(i)}update(e){return ku(this),this.iHash.update(e),this}digestInto(e){ku(this),Zi(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){const e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||(e=Object.create(Object.getPrototypeOf(this),{}));const{oHash:r,iHash:n,finished:s,destroyed:i,blockLen:o,outputLen:a}=this;return e=e,e.finished=s,e.destroyed=i,e.blockLen=o,e.outputLen=a,e.oHash=r._cloneInto(e.oHash),e.iHash=n._cloneInto(e.iHash),e}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}};const VA=(t,e,r)=>new M9(t,e).update(r).digest();VA.create=(t,e)=>new M9(t,e);function Mce(t,e,r){return HA(t),r===void 0&&(r=new Uint8Array(t.outputLen)),VA(t,Gi(r),Gi(e))}const fI=Uint8Array.from([0]),kB=Uint8Array.of();function $ce(t,e,r,n=32){HA(t),cc(n);const s=t.outputLen;if(n>255*s)throw new Error("Length should be <= 255*HashLen");const i=Math.ceil(n/s);r===void 0&&(r=kB);const o=new Uint8Array(i*s),a=VA.create(t,e),c=a._cloneInto(),u=new Uint8Array(a.outputLen);for(let l=0;l<i;l++)fI[0]=l+1,c.update(l===0?kB:u).update(r).update(fI).digestInto(u),o.set(u,s*l),a._cloneInto(c);return a.destroy(),c.destroy(),hi(u,fI),o.slice(0,n)}const Lce=(t,e,r,n,s)=>$ce(t,Mce(t,e,r),n,s),GA=zA,mO=BigInt(0),PT=BigInt(1);function X_(t,e=""){if(typeof t!="boolean"){const r=e&&`"${e}"`;throw new Error(r+"expected boolean, got type="+typeof t)}return t}function ql(t,e,r=""){const n=FA(t),s=t==null?void 0:t.length,i=e!==void 0;if(!n||i&&s!==e){const o=r&&`"${r}" `,a=i?` of length ${e}`:"",c=n?`length=${s}`:`type=${typeof t}`;throw new Error(o+"expected Uint8Array"+a+", got "+c)}return t}function Ib(t){const e=t.toString(16);return e.length&1?"0"+e:e}function $9(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);return t===""?mO:BigInt("0x"+t)}function KA(t){return $9(ah(t))}function eA(t){return Zi(t),$9(ah(Uint8Array.from(t).reverse()))}function yO(t,e){return J_(t.toString(16).padStart(e*2,"0"))}function bO(t,e){return yO(t,e).reverse()}function In(t,e,r){let n;if(typeof e=="string")try{n=J_(e)}catch(i){throw new Error(t+" must be hex string or Uint8Array, cause: "+i)}else if(FA(e))n=Uint8Array.from(e);else throw new Error(t+" must be hex string or Uint8Array");const s=n.length;if(typeof r=="number"&&s!==r)throw new Error(t+" of length "+r+" expected, got "+s);return n}const hI=t=>typeof t=="bigint"&&mO<=t;function Fce(t,e,r){return hI(t)&&hI(e)&&hI(r)&&e<=t&&t<r}function OT(t,e,r,n){if(!Fce(e,r,n))throw new Error("expected valid "+t+": "+r+" <= n < "+n+", got "+e)}function L9(t){let e;for(e=0;t>mO;t>>=PT,e+=1);return e}const w0=t=>(PT<<BigInt(t))-PT;function Hce(t,e,r){if(typeof t!="number"||t<2)throw new Error("hashLen must be a number");if(typeof e!="number"||e<2)throw new Error("qByteLen must be a number");if(typeof r!="function")throw new Error("hmacFn must be a function");const n=f=>new Uint8Array(f),s=f=>Uint8Array.of(f);let i=n(t),o=n(t),a=0;const c=()=>{i.fill(1),o.fill(0),a=0},u=(...f)=>r(o,i,...f),l=(f=n(0))=>{o=u(s(0),f),i=u(),f.length!==0&&(o=u(s(1),f),i=u())},d=()=>{if(a++>=1e3)throw new Error("drbg: tried 1000 values");let f=0;const g=[];for(;f<e;){i=u();const h=i.slice();g.push(h),f+=i.length}return Qc(...g)};return(f,g)=>{c(),l(f);let h;for(;!(h=g(d()));)l();return c(),h}}function ZA(t,e,r={}){if(!t||typeof t!="object")throw new Error("expected valid options object");function n(s,i,o){const a=t[s];if(o&&a===void 0)return;const c=typeof a;if(c!==i||a===null)throw new Error(`param "${s}" is invalid: expected ${i}, got ${c}`)}Object.entries(e).forEach(([s,i])=>n(s,i,!1)),Object.entries(r).forEach(([s,i])=>n(s,i,!0))}function jB(t){const e=new WeakMap;return(r,...n)=>{const s=e.get(r);if(s!==void 0)return s;const i=t(r,...n);return e.set(r,i),i}}const bs=BigInt(0),Zn=BigInt(1),zl=BigInt(2),F9=BigInt(3),H9=BigInt(4),q9=BigInt(5),qce=BigInt(7),z9=BigInt(8),zce=BigInt(9),W9=BigInt(16);function Fs(t,e){const r=t%e;return r>=bs?r:e+r}function Oi(t,e,r){let n=t;for(;e-- >bs;)n*=n,n%=r;return n}function DB(t,e){if(t===bs)throw new Error("invert: expected non-zero number");if(e<=bs)throw new Error("invert: expected positive modulus, got "+e);let r=Fs(t,e),n=e,s=bs,i=Zn;for(;r!==bs;){const o=n/r,a=n%r,c=s-i*o;n=r,r=a,s=i,i=c}if(n!==Zn)throw new Error("invert: does not exist");return Fs(s,e)}function wO(t,e,r){if(!t.eql(t.sqr(e),r))throw new Error("Cannot find square root")}function V9(t,e){const r=(t.ORDER+Zn)/H9,n=t.pow(e,r);return wO(t,n,e),n}function Wce(t,e){const r=(t.ORDER-q9)/z9,n=t.mul(e,zl),s=t.pow(n,r),i=t.mul(e,s),o=t.mul(t.mul(i,zl),s),a=t.mul(i,t.sub(o,t.ONE));return wO(t,a,e),a}function Vce(t){const e=$u(t),r=G9(t),n=r(e,e.neg(e.ONE)),s=r(e,n),i=r(e,e.neg(n)),o=(t+qce)/W9;return(a,c)=>{let u=a.pow(c,o),l=a.mul(u,n);const d=a.mul(u,s),f=a.mul(u,i),g=a.eql(a.sqr(l),c),h=a.eql(a.sqr(d),c);u=a.cmov(u,l,g),l=a.cmov(f,d,h);const p=a.eql(a.sqr(l),c),y=a.cmov(u,l,p);return wO(a,y,c),y}}function G9(t){if(t<F9)throw new Error("sqrt is not defined for small field");let e=t-Zn,r=0;for(;e%zl===bs;)e/=zl,r++;let n=zl;const s=$u(t);for(;UB(s,n)===1;)if(n++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(r===1)return V9;let i=s.pow(n,e);const o=(e+Zn)/zl;return function(a,c){if(a.is0(c))return c;if(UB(a,c)!==1)throw new Error("Cannot find square root");let u=r,l=a.mul(a.ONE,i),d=a.pow(c,e),f=a.pow(c,o);for(;!a.eql(d,a.ONE);){if(a.is0(d))return a.ZERO;let g=1,h=a.sqr(d);for(;!a.eql(h,a.ONE);)if(g++,h=a.sqr(h),g===u)throw new Error("Cannot find square root");const p=Zn<<BigInt(u-g-1),y=a.pow(l,p);u=g,l=a.sqr(y),d=a.mul(d,l),f=a.mul(f,y)}return f}}function Gce(t){return t%H9===F9?V9:t%z9===q9?Wce:t%W9===zce?Vce(t):G9(t)}const Kce=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Zce(t){const e={ORDER:"bigint",MASK:"bigint",BYTES:"number",BITS:"number"},r=Kce.reduce((n,s)=>(n[s]="function",n),e);return ZA(t,r),t}function Yce(t,e,r){if(r<bs)throw new Error("invalid exponent, negatives unsupported");if(r===bs)return t.ONE;if(r===Zn)return e;let n=t.ONE,s=e;for(;r>bs;)r&Zn&&(n=t.mul(n,s)),s=t.sqr(s),r>>=Zn;return n}function K9(t,e,r=!1){const n=new Array(e.length).fill(r?t.ZERO:void 0),s=e.reduce((o,a,c)=>t.is0(a)?o:(n[c]=o,t.mul(o,a)),t.ONE),i=t.inv(s);return e.reduceRight((o,a,c)=>t.is0(a)?o:(n[c]=t.mul(o,n[c]),t.mul(o,a)),i),n}function UB(t,e){const r=(t.ORDER-Zn)/zl,n=t.pow(e,r),s=t.eql(n,t.ONE),i=t.eql(n,t.ZERO),o=t.eql(n,t.neg(t.ONE));if(!s&&!i&&!o)throw new Error("invalid Legendre symbol result");return s?1:i?0:-1}function Z9(t,e){e!==void 0&&cc(e);const r=e!==void 0?e:t.toString(2).length,n=Math.ceil(r/8);return{nBitLength:r,nByteLength:n}}function $u(t,e,r=!1,n={}){if(t<=bs)throw new Error("invalid field: expected ORDER > 0, got "+t);let s,i,o=!1,a;if(typeof e=="object"&&e!=null){if(n.sqrt||r)throw new Error("cannot specify opts in two arguments");const f=e;f.BITS&&(s=f.BITS),f.sqrt&&(i=f.sqrt),typeof f.isLE=="boolean"&&(r=f.isLE),typeof f.modFromBytes=="boolean"&&(o=f.modFromBytes),a=f.allowedLengths}else typeof e=="number"&&(s=e),n.sqrt&&(i=n.sqrt);const{nBitLength:c,nByteLength:u}=Z9(t,s);if(u>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let l;const d=Object.freeze({ORDER:t,isLE:r,BITS:c,BYTES:u,MASK:w0(c),ZERO:bs,ONE:Zn,allowedLengths:a,create:f=>Fs(f,t),isValid:f=>{if(typeof f!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof f);return bs<=f&&f<t},is0:f=>f===bs,isValidNot0:f=>!d.is0(f)&&d.isValid(f),isOdd:f=>(f&Zn)===Zn,neg:f=>Fs(-f,t),eql:(f,g)=>f===g,sqr:f=>Fs(f*f,t),add:(f,g)=>Fs(f+g,t),sub:(f,g)=>Fs(f-g,t),mul:(f,g)=>Fs(f*g,t),pow:(f,g)=>Yce(d,f,g),div:(f,g)=>Fs(f*DB(g,t),t),sqrN:f=>f*f,addN:(f,g)=>f+g,subN:(f,g)=>f-g,mulN:(f,g)=>f*g,inv:f=>DB(f,t),sqrt:i||(f=>(l||(l=Gce(t)),l(d,f))),toBytes:f=>r?bO(f,u):yO(f,u),fromBytes:(f,g=!0)=>{if(a){if(!a.includes(f.length)||f.length>u)throw new Error("Field.fromBytes: expected "+a+" bytes, got "+f.length);const p=new Uint8Array(u);p.set(f,r?0:p.length-f.length),f=p}if(f.length!==u)throw new Error("Field.fromBytes: expected "+u+" bytes, got "+f.length);let h=r?eA(f):KA(f);if(o&&(h=Fs(h,t)),!g&&!d.isValid(h))throw new Error("invalid field element: outside of range 0..ORDER");return h},invertBatch:f=>K9(d,f),cmov:(f,g,h)=>h?g:f});return Object.freeze(d)}function Y9(t){if(typeof t!="bigint")throw new Error("field order must be bigint");const e=t.toString(2).length;return Math.ceil(e/8)}function J9(t){const e=Y9(t);return e+Math.ceil(e/2)}function Jce(t,e,r=!1){const n=t.length,s=Y9(e),i=J9(e);if(n<16||n<i||n>1024)throw new Error("expected "+i+"-1024 bytes of input, got "+n);const o=r?eA(t):KA(t),a=Fs(o,e-Zn)+Zn;return r?bO(a,s):yO(a,s)}const hp=BigInt(0),Wl=BigInt(1);function tA(t,e){const r=e.negate();return t?r:e}function pI(t,e){const r=K9(t.Fp,e.map(n=>n.Z));return e.map((n,s)=>t.fromAffine(n.toAffine(r[s])))}function Q9(t,e){if(!Number.isSafeInteger(t)||t<=0||t>e)throw new Error("invalid window size, expected [1.."+e+"], got W="+t)}function gI(t,e){Q9(t,e);const r=Math.ceil(e/t)+1,n=2**(t-1),s=2**t,i=w0(t),o=BigInt(t);return{windows:r,windowSize:n,mask:i,maxNumber:s,shiftBy:o}}function MB(t,e,r){const{windowSize:n,mask:s,maxNumber:i,shiftBy:o}=r;let a=Number(t&s),c=t>>o;a>n&&(a-=i,c+=Wl);const u=e*n,l=u+Math.abs(a)-1,d=a===0,f=a<0,g=e%2!==0;return{nextN:c,offset:l,isZero:d,isNeg:f,isNegF:g,offsetF:u}}function Qce(t,e){if(!Array.isArray(t))throw new Error("array expected");t.forEach((r,n)=>{if(!(r instanceof e))throw new Error("invalid point at index "+n)})}function Xce(t,e){if(!Array.isArray(t))throw new Error("array of scalars expected");t.forEach((r,n)=>{if(!e.isValid(r))throw new Error("invalid scalar at index "+n)})}const mI=new WeakMap,X9=new WeakMap;function yI(t){return X9.get(t)||1}function $B(t){if(t!==hp)throw new Error("invalid wNAF")}class eue{constructor(e,r){this.BASE=e.BASE,this.ZERO=e.ZERO,this.Fn=e.Fn,this.bits=r}_unsafeLadder(e,r,n=this.ZERO){let s=e;for(;r>hp;)r&Wl&&(n=n.add(s)),s=s.double(),r>>=Wl;return n}precomputeWindow(e,r){const{windows:n,windowSize:s}=gI(r,this.bits),i=[];let o=e,a=o;for(let c=0;c<n;c++){a=o,i.push(a);for(let u=1;u<s;u++)a=a.add(o),i.push(a);o=a.double()}return i}wNAF(e,r,n){if(!this.Fn.isValid(n))throw new Error("invalid scalar");let s=this.ZERO,i=this.BASE;const o=gI(e,this.bits);for(let a=0;a<o.windows;a++){const{nextN:c,offset:u,isZero:l,isNeg:d,isNegF:f,offsetF:g}=MB(n,a,o);n=c,l?i=i.add(tA(f,r[g])):s=s.add(tA(d,r[u]))}return $B(n),{p:s,f:i}}wNAFUnsafe(e,r,n,s=this.ZERO){const i=gI(e,this.bits);for(let o=0;o<i.windows&&n!==hp;o++){const{nextN:a,offset:c,isZero:u,isNeg:l}=MB(n,o,i);if(n=a,!u){const d=r[c];s=s.add(l?d.negate():d)}}return $B(n),s}getPrecomputes(e,r,n){let s=mI.get(r);return s||(s=this.precomputeWindow(r,e),e!==1&&(typeof n=="function"&&(s=n(s)),mI.set(r,s))),s}cached(e,r,n){const s=yI(e);return this.wNAF(s,this.getPrecomputes(s,e,n),r)}unsafe(e,r,n,s){const i=yI(e);return i===1?this._unsafeLadder(e,r,s):this.wNAFUnsafe(i,this.getPrecomputes(i,e,n),r,s)}createCache(e,r){Q9(r,this.bits),X9.set(e,r),mI.delete(e)}hasCache(e){return yI(e)!==1}}function tue(t,e,r,n){let s=e,i=t.ZERO,o=t.ZERO;for(;r>hp||n>hp;)r&Wl&&(i=i.add(s)),n&Wl&&(o=o.add(s)),s=s.double(),r>>=Wl,n>>=Wl;return{p1:i,p2:o}}function rue(t,e,r,n){Qce(r,t),Xce(n,e);const s=r.length,i=n.length;if(s!==i)throw new Error("arrays of points and scalars must have equal length");const o=t.ZERO,a=L9(BigInt(s));let c=1;a>12?c=a-3:a>4?c=a-2:a>0&&(c=2);const u=w0(c),l=new Array(Number(u)+1).fill(o),d=Math.floor((e.BITS-1)/c)*c;let f=o;for(let g=d;g>=0;g-=c){l.fill(o);for(let p=0;p<i;p++){const y=n[p],w=Number(y>>BigInt(g)&u);l[w]=l[w].add(r[p])}let h=o;for(let p=l.length-1,y=o;p>0;p--)y=y.add(l[p]),h=h.add(y);if(f=f.add(h),g!==0)for(let p=0;p<c;p++)f=f.double()}return f}function LB(t,e,r){if(e){if(e.ORDER!==t)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return Zce(e),e}else return $u(t,{isLE:r})}function nue(t,e,r={},n){if(n===void 0&&(n=t==="edwards"),!e||typeof e!="object")throw new Error(`expected valid ${t} CURVE object`);for(const a of["p","n","h"]){const c=e[a];if(!(typeof c=="bigint"&&c>hp))throw new Error(`CURVE.${a} must be positive bigint`)}const s=LB(e.p,r.Fp,n),i=LB(e.n,r.Fn,n),o=["Gx","Gy","a","b"];for(const a of o)if(!s.isValid(e[a]))throw new Error(`CURVE.${a} must be valid field element of CURVE.Fp`);return e=Object.freeze(Object.assign({},e)),{CURVE:e,Fp:s,Fn:i}}BigInt(0),BigInt(1),BigInt(2),BigInt(8),A9("HashToScalar-");const tg=BigInt(0),ff=BigInt(1),Sb=BigInt(2);function sue(t){return ZA(t,{adjustScalarBytes:"function",powPminus2:"function"}),Object.freeze({...t})}function iue(t){const e=sue(t),{P:r,type:n,adjustScalarBytes:s,powPminus2:i,randomBytes:o}=e,a=n==="x25519";if(!a&&n!=="x448")throw new Error("invalid type");const c=o||Zd,u=a?255:448,l=a?32:56,d=BigInt(a?9:5),f=BigInt(a?121665:39081),g=a?Sb**BigInt(254):Sb**BigInt(447),h=a?BigInt(8)*Sb**BigInt(251)-ff:BigInt(4)*Sb**BigInt(445)-ff,p=g+h+ff,y=N=>Fs(N,r),w=I(d);function I(N){return bO(y(N),l)}function v(N){const R=In("u coordinate",N,l);return a&&(R[31]&=127),y(eA(R))}function E(N){return eA(s(In("scalar",N,l)))}function b(N,R){const B=O(v(R),E(N));if(B===tg)throw new Error("invalid private or public key received");return I(B)}function m(N){return b(N,w)}function _(N,R,B){const A=y(N*(R-B));return R=y(R-A),B=y(B+A),{x_2:R,x_3:B}}function O(N,R){OT("u",N,tg,r),OT("scalar",R,g,p);const B=R,A=N;let P=ff,k=tg,U=N,x=ff,j=tg;for(let M=BigInt(u-1);M>=tg;M--){const L=B>>M&ff;j^=L,{x_2:P,x_3:U}=_(j,P,U),{x_2:k,x_3:x}=_(j,k,x),j=L;const H=P+k,z=y(H*H),V=P-k,G=y(V*V),ee=z-G,X=U+x,oe=U-x,te=y(oe*H),fe=y(X*V),Se=te+fe,le=te-fe;U=y(Se*Se),x=y(A*y(le*le)),P=y(z*G),k=y(ee*(z+y(f*ee)))}({x_2:P,x_3:U}=_(j,P,U)),{x_2:k,x_3:x}=_(j,k,x);const D=i(k);return y(P*D)}const C={secretKey:l,publicKey:l,seed:l},S=(N=c(l))=>(Zi(N,C.seed),N);function T(N){const R=S(N);return{secretKey:R,publicKey:m(R)}}return{keygen:T,getSharedSecret:(N,R)=>b(N,R),getPublicKey:N=>m(N),scalarMult:b,scalarMultBase:m,utils:{randomSecretKey:S,randomPrivateKey:S},GuBytes:w.slice(),lengths:C}}const oue=BigInt(1),FB=BigInt(2),aue=BigInt(3),cue=BigInt(5);BigInt(8);const eH=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed"),uue={p:eH,n:BigInt("0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed"),a:BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec"),d:BigInt("0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3"),Gx:BigInt("0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a"),Gy:BigInt("0x6666666666666666666666666666666666666666666666666666666666666658")};function lue(t){const e=BigInt(10),r=BigInt(20),n=BigInt(40),s=BigInt(80),i=eH,o=t*t%i*t%i,a=Oi(o,FB,i)*o%i,c=Oi(a,oue,i)*t%i,u=Oi(c,cue,i)*c%i,l=Oi(u,e,i)*u%i,d=Oi(l,r,i)*l%i,f=Oi(d,n,i)*d%i,g=Oi(f,s,i)*f%i,h=Oi(g,s,i)*f%i,p=Oi(h,e,i)*u%i;return{pow_p_5_8:Oi(p,FB,i)*t%i,b2:o}}function due(t){return t[0]&=248,t[31]&=127,t[31]|=64,t}const fue=$u(uue.p,{isLE:!0}),NT=(()=>{const t=fue.ORDER;return iue({P:t,type:"x25519",powPminus2:e=>{const{pow_p_5_8:r,b2:n}=lue(e);return Fs(Oi(r,aue,t)*n,t)},adjustScalarBytes:due})})(),HB=(t,e)=>(t+(t>=0?e:-e)/tH)/e;function hue(t,e,r){const[[n,s],[i,o]]=e,a=HB(o*t,r),c=HB(-s*t,r);let u=t-a*n-c*i,l=-a*s-c*o;const d=u<Qa,f=l<Qa;d&&(u=-u),f&&(l=-l);const g=w0(Math.ceil(L9(r)/2))+ch;if(u<Qa||u>=g||l<Qa||l>=g)throw new Error("splitScalar (endomorphism): failed, k="+t);return{k1neg:d,k1:u,k2neg:f,k2:l}}function xT(t){if(!["compact","recovered","der"].includes(t))throw new Error('Signature format must be "compact", "recovered", or "der"');return t}function bI(t,e){const r={};for(let n of Object.keys(e))r[n]=t[n]===void 0?e[n]:t[n];return X_(r.lowS,"lowS"),X_(r.prehash,"prehash"),r.format!==void 0&&xT(r.format),r}class pue extends Error{constructor(e=""){super(e)}}const ja={Err:pue,_tlv:{encode:(t,e)=>{const{Err:r}=ja;if(t<0||t>256)throw new r("tlv.encode: wrong tag");if(e.length&1)throw new r("tlv.encode: unpadded data");const n=e.length/2,s=Ib(n);if(s.length/2&128)throw new r("tlv.encode: long form length too big");const i=n>127?Ib(s.length/2|128):"";return Ib(t)+i+s+e},decode(t,e){const{Err:r}=ja;let n=0;if(t<0||t>256)throw new r("tlv.encode: wrong tag");if(e.length<2||e[n++]!==t)throw new r("tlv.decode: wrong tlv");const s=e[n++],i=!!(s&128);let o=0;if(!i)o=s;else{const c=s&127;if(!c)throw new r("tlv.decode(long): indefinite length not supported");if(c>4)throw new r("tlv.decode(long): byte length is too big");const u=e.subarray(n,n+c);
vendor: 4,238 bytes, line 29
29if(u.length!==c)throw new r("tlv.decode: length bytes not complete");if(u[0]===0)throw new r("tlv.decode(long): zero leftmost byte");for(const l of u)o=o<<8|l;if(n+=c,o<128)throw new r("tlv.decode(long): not minimal encoding")}const a=e.subarray(n,n+o);if(a.length!==o)throw new r("tlv.decode: wrong value length");return{v:a,l:e.subarray(n+o)}}},_int:{encode(t){const{Err:e}=ja;if(t<Qa)throw new e("integer: negative integers are not allowed");let r=Ib(t);if(Number.parseInt(r[0],16)&8&&(r="00"+r),r.length&1)throw new e("unexpected DER parsing assertion: unpadded hex");return r},decode(t){const{Err:e}=ja;if(t[0]&128)throw new e("invalid signature integer: negative");if(t[0]===0&&!(t[1]&128))throw new e("invalid signature integer: unnecessary leading zero");return KA(t)}},toSig(t){const{Err:e,_int:r,_tlv:n}=ja,s=In("signature",t),{v:i,l:o}=n.decode(48,s);if(o.length)throw new e("invalid signature: left bytes after parsing");const{v:a,l:c}=n.decode(2,i),{v:u,l}=n.decode(2,c);if(l.length)throw new e("invalid signature: left bytes after parsing");return{r:r.decode(a),s:r.decode(u)}},hexFromSig(t){const{_tlv:e,_int:r}=ja,n=e.encode(2,r.encode(t.r)),s=e.encode(2,r.encode(t.s)),i=n+s;return e.encode(48,i)}},Qa=BigInt(0),ch=BigInt(1),tH=BigInt(2),Tb=BigInt(3),gue=BigInt(4);function Gf(t,e){const{BYTES:r}=t;let n;if(typeof e=="bigint")n=e;else{let s=In("private key",e);try{n=t.fromBytes(s)}catch{throw new Error(`invalid private key: expected ui8a of size ${r}, got ${typeof e}`)}}if(!t.isValidNot0(n))throw new Error("invalid private key: out of range [1..N-1]");return n}function mue(t,e={}){const r=nue("weierstrass",t,e),{Fp:n,Fn:s}=r;let i=r.CURVE;const{h:o,n:a}=i;ZA(e,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object",wrapPrivateKey:"boolean"});const{endo:c}=e;if(c&&(!n.is0(i.a)||typeof c.beta!="bigint"||!Array.isArray(c.basises)))throw new Error('invalid endo: expected "beta": bigint and "basises": array');const u=nH(n,s);function l(){if(!n.isOdd)throw new Error("compression is not supported: Field does not have .isOdd()")}function d(N,R,B){const{x:A,y:P}=R.toAffine(),k=n.toBytes(A);if(X_(B,"isCompressed"),B){l();const U=!n.isOdd(P);return Qc(rH(U),k)}else return Qc(Uint8Array.of(4),k,n.toBytes(P))}function f(N){ql(N,void 0,"Point");const{publicKey:R,publicKeyUncompressed:B}=u,A=N.length,P=N[0],k=N.subarray(1);if(A===R&&(P===2||P===3)){const U=n.fromBytes(k);if(!n.isValid(U))throw new Error("bad point: is not on curve, wrong x");const x=p(U);let j;try{j=n.sqrt(x)}catch(M){const L=M instanceof Error?": "+M.message:"";throw new Error("bad point: is not on curve, sqrt error"+L)}l();const D=n.isOdd(j);return(P&1)===1!==D&&(j=n.neg(j)),{x:U,y:j}}else if(A===B&&P===4){const U=n.BYTES,x=n.fromBytes(k.subarray(0,U)),j=n.fromBytes(k.subarray(U,U*2));if(!y(x,j))throw new Error("bad point: is not on curve");return{x,y:j}}else throw new Error(`bad point: got length ${A}, expected compressed=${R} or uncompressed=${B}`)}const g=e.toBytes||d,h=e.fromBytes||f;function p(N){const R=n.sqr(N),B=n.mul(R,N);return n.add(n.add(B,n.mul(N,i.a)),i.b)}function y(N,R){const B=n.sqr(R),A=p(N);return n.eql(B,A)}if(!y(i.Gx,i.Gy))throw new Error("bad curve params: generator point");const w=n.mul(n.pow(i.a,Tb),gue),I=n.mul(n.sqr(i.b),BigInt(27));if(n.is0(n.add(w,I)))throw new Error("bad curve params: a or b");function v(N,R,B=!1){if(!n.isValid(R)||B&&n.is0(R))throw new Error(`bad point coordinate ${N}`);return R}function E(N){if(!(N instanceof C))throw new Error("ProjectivePoint expected")}function b(N){if(!c||!c.basises)throw new Error("no endo");return hue(N,c.basises,s.ORDER)}const m=jB((N,R)=>{const{X:B,Y:A,Z:P}=N;if(n.eql(P,n.ONE))return{x:B,y:A};const k=N.is0();R==null&&(R=k?n.ONE:n.inv(P));const U=n.mul(B,R),x=n.mul(A,R),j=n.mul(P,R);if(k)return{x:n.ZERO,y:n.ZERO};if(!n.eql(j,n.ONE))throw new Error("invZ was invalid");return{x:U,y:x}}),_=jB(N=>{if(N.is0()){if(e.allowInfinityPoint&&!n.is0(N.Y))return;throw new Error("bad point: ZERO")}const{x:R,y:B}=N.toAffine();if(!n.isValid(R)||!n.isValid(B))throw new Error("bad point: x or y not field elements");if(!y(R,B))throw new Error("bad point: equation left != right");
vendor: 13,415 bytes, line 29
29if(!N.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});function O(N,R,B,A,P){return B=new C(n.mul(B.X,N),B.Y,B.Z),R=tA(A,R),B=tA(P,B),R.add(B)}class C{constructor(R,B,A){this.X=v("x",R),this.Y=v("y",B,!0),this.Z=v("z",A),Object.freeze(this)}static CURVE(){return i}static fromAffine(R){const{x:B,y:A}=R||{};if(!R||!n.isValid(B)||!n.isValid(A))throw new Error("invalid affine point");if(R instanceof C)throw new Error("projective point not allowed");return n.is0(B)&&n.is0(A)?C.ZERO:new C(B,A,n.ONE)}static fromBytes(R){const B=C.fromAffine(h(ql(R,void 0,"point")));return B.assertValidity(),B}static fromHex(R){return C.fromBytes(In("pointHex",R))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(R=8,B=!0){return T.createCache(this,R),B||this.multiply(Tb),this}assertValidity(){_(this)}hasEvenY(){const{y:R}=this.toAffine();if(!n.isOdd)throw new Error("Field doesn't support isOdd");return!n.isOdd(R)}equals(R){E(R);const{X:B,Y:A,Z:P}=this,{X:k,Y:U,Z:x}=R,j=n.eql(n.mul(B,x),n.mul(k,P)),D=n.eql(n.mul(A,x),n.mul(U,P));return j&&D}negate(){return new C(this.X,n.neg(this.Y),this.Z)}double(){const{a:R,b:B}=i,A=n.mul(B,Tb),{X:P,Y:k,Z:U}=this;let x=n.ZERO,j=n.ZERO,D=n.ZERO,M=n.mul(P,P),L=n.mul(k,k),H=n.mul(U,U),z=n.mul(P,k);return z=n.add(z,z),D=n.mul(P,U),D=n.add(D,D),x=n.mul(R,D),j=n.mul(A,H),j=n.add(x,j),x=n.sub(L,j),j=n.add(L,j),j=n.mul(x,j),x=n.mul(z,x),D=n.mul(A,D),H=n.mul(R,H),z=n.sub(M,H),z=n.mul(R,z),z=n.add(z,D),D=n.add(M,M),M=n.add(D,M),M=n.add(M,H),M=n.mul(M,z),j=n.add(j,M),H=n.mul(k,U),H=n.add(H,H),M=n.mul(H,z),x=n.sub(x,M),D=n.mul(H,L),D=n.add(D,D),D=n.add(D,D),new C(x,j,D)}add(R){E(R);const{X:B,Y:A,Z:P}=this,{X:k,Y:U,Z:x}=R;let j=n.ZERO,D=n.ZERO,M=n.ZERO;const L=i.a,H=n.mul(i.b,Tb);let z=n.mul(B,k),V=n.mul(A,U),G=n.mul(P,x),ee=n.add(B,A),X=n.add(k,U);ee=n.mul(ee,X),X=n.add(z,V),ee=n.sub(ee,X),X=n.add(B,P);let oe=n.add(k,x);return X=n.mul(X,oe),oe=n.add(z,G),X=n.sub(X,oe),oe=n.add(A,P),j=n.add(U,x),oe=n.mul(oe,j),j=n.add(V,G),oe=n.sub(oe,j),M=n.mul(L,X),j=n.mul(H,G),M=n.add(j,M),j=n.sub(V,M),M=n.add(V,M),D=n.mul(j,M),V=n.add(z,z),V=n.add(V,z),G=n.mul(L,G),X=n.mul(H,X),V=n.add(V,G),G=n.sub(z,G),G=n.mul(L,G),X=n.add(X,G),z=n.mul(V,X),D=n.add(D,z),z=n.mul(oe,X),j=n.mul(ee,j),j=n.sub(j,z),z=n.mul(ee,V),M=n.mul(oe,M),M=n.add(M,z),new C(j,D,M)}subtract(R){return this.add(R.negate())}is0(){return this.equals(C.ZERO)}multiply(R){const{endo:B}=e;if(!s.isValidNot0(R))throw new Error("invalid scalar: out of range");let A,P;const k=U=>T.cached(this,U,x=>pI(C,x));if(B){const{k1neg:U,k1:x,k2neg:j,k2:D}=b(R),{p:M,f:L}=k(x),{p:H,f:z}=k(D);P=L.add(z),A=O(B.beta,M,H,U,j)}else{const{p:U,f:x}=k(R);A=U,P=x}return pI(C,[A,P])[0]}multiplyUnsafe(R){const{endo:B}=e,A=this;if(!s.isValid(R))throw new Error("invalid scalar: out of range");if(R===Qa||A.is0())return C.ZERO;if(R===ch)return A;if(T.hasCache(this))return this.multiply(R);if(B){const{k1neg:P,k1:k,k2neg:U,k2:x}=b(R),{p1:j,p2:D}=tue(C,A,k,x);return O(B.beta,j,D,P,U)}else return T.unsafe(A,R)}multiplyAndAddUnsafe(R,B,A){const P=this.multiplyUnsafe(B).add(R.multiplyUnsafe(A));return P.is0()?void 0:P}toAffine(R){return m(this,R)}isTorsionFree(){const{isTorsionFree:R}=e;return o===ch?!0:R?R(C,this):T.unsafe(this,a).is0()}clearCofactor(){const{clearCofactor:R}=e;return o===ch?this:R?R(C,this):this.multiplyUnsafe(o)}isSmallOrder(){return this.multiplyUnsafe(o).is0()}toBytes(R=!0){return X_(R,"isCompressed"),this.assertValidity(),g(C,this,R)}toHex(R=!0){return ah(this.toBytes(R))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}get px(){return this.X}get py(){return this.X}get pz(){return this.Z}toRawBytes(R=!0){return this.toBytes(R)}_setWindowSize(R){this.precompute(R)}static normalizeZ(R){return pI(C,R)}static msm(R,B){return rue(C,s,R,B)}static fromPrivateKey(R){return C.BASE.multiply(Gf(s,R))}}C.BASE=new C(i.Gx,i.Gy,n.ONE),C.ZERO=new C(n.ZERO,n.ONE,n.ZERO),C.Fp=n,C.Fn=s;const S=s.BITS,T=new eue(C,e.endo?Math.ceil(S/2):S);return C.BASE.precompute(8),C}function rH(t){return Uint8Array.of(t?2:3)}function nH(t,e){return{secretKey:e.BYTES,publicKey:1+t.BYTES,publicKeyUncompressed:1+2*t.BYTES,publicKeyHasPrefix:!0,signature:2*e.BYTES}}function yue(t,e={}){const{Fn:r}=t,n=e.randomBytes||Zd,s=Object.assign(nH(t.Fp,r),{seed:J9(r.ORDER)});function i(f){try{return!!Gf(r,f)}catch{return!1}}function o(f,g){const{publicKey:h,publicKeyUncompressed:p}=s;try{const y=f.length;return g===!0&&y!==h||g===!1&&y!==p?!1:!!t.fromBytes(f)}catch{return!1}}function a(f=n(s.seed)){return Jce(ql(f,s.seed,"seed"),r.ORDER)}function c(f,g=!0){return t.BASE.multiply(Gf(r,f)).toBytes(g)}function u(f){const g=a(f);return{secretKey:g,publicKey:c(g)}}function l(f){if(typeof f=="bigint")return!1;if(f instanceof t)return!0;const{secretKey:g,publicKey:h,publicKeyUncompressed:p}=s;if(r.allowedLengths||g===h)return;const y=In("key",f).length;return y===h||y===p}function d(f,g,h=!0){if(l(f)===!0)throw new Error("first arg must be private key");if(l(g)===!1)throw new Error("second arg must be public key");const p=Gf(r,f);return t.fromHex(g).multiply(p).toBytes(h)}return Object.freeze({getPublicKey:c,getSharedSecret:d,keygen:u,Point:t,utils:{isValidSecretKey:i,isValidPublicKey:o,randomSecretKey:a,isValidPrivateKey:i,randomPrivateKey:a,normPrivateKeyToScalar:f=>Gf(r,f),precompute(f=8,g=t.BASE){return g.precompute(f,!1)}},lengths:s})}function bue(t,e,r={}){HA(e),ZA(r,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"});const n=r.randomBytes||Zd,s=r.hmac||((B,...A)=>VA(e,B,Qc(...A))),{Fp:i,Fn:o}=t,{ORDER:a,BITS:c}=o,{keygen:u,getPublicKey:l,getSharedSecret:d,utils:f,lengths:g}=yue(t,r),h={prehash:!1,lowS:typeof r.lowS=="boolean"?r.lowS:!1,format:void 0,extraEntropy:!1},p="compact";function y(B){const A=a>>ch;return B>A}function w(B,A){if(!o.isValidNot0(A))throw new Error(`invalid signature ${B}: out of range 1..Point.Fn.ORDER`);return A}function I(B,A){xT(A);const P=g.signature,k=A==="compact"?P:A==="recovered"?P+1:void 0;return ql(B,k,`${A} signature`)}class v{constructor(A,P,k){this.r=w("r",A),this.s=w("s",P),k!=null&&(this.recovery=k),Object.freeze(this)}static fromBytes(A,P=p){I(A,P);let k;if(P==="der"){const{r:D,s:M}=ja.toSig(ql(A));return new v(D,M)}P==="recovered"&&(k=A[0],P="compact",A=A.subarray(1));const U=o.BYTES,x=A.subarray(0,U),j=A.subarray(U,U*2);return new v(o.fromBytes(x),o.fromBytes(j),k)}static fromHex(A,P){return this.fromBytes(J_(A),P)}addRecoveryBit(A){return new v(this.r,this.s,A)}recoverPublicKey(A){const P=i.ORDER,{r:k,s:U,recovery:x}=this;if(x==null||![0,1,2,3].includes(x))throw new Error("recovery id invalid");if(a*tH<P&&x>1)throw new Error("recovery id is ambiguous for h>1 curve");const j=x===2||x===3?k+a:k;if(!i.isValid(j))throw new Error("recovery id 2 or 3 invalid");const D=i.toBytes(j),M=t.fromBytes(Qc(rH((x&1)===0),D)),L=o.inv(j),H=b(In("msgHash",A)),z=o.create(-H*L),V=o.create(U*L),G=t.BASE.multiplyUnsafe(z).add(M.multiplyUnsafe(V));if(G.is0())throw new Error("point at infinify");return G.assertValidity(),G}hasHighS(){return y(this.s)}toBytes(A=p){if(xT(A),A==="der")return J_(ja.hexFromSig(this));const P=o.toBytes(this.r),k=o.toBytes(this.s);if(A==="recovered"){if(this.recovery==null)throw new Error("recovery bit must be present");return Qc(Uint8Array.of(this.recovery),P,k)}return Qc(P,k)}toHex(A){return ah(this.toBytes(A))}assertValidity(){}static fromCompact(A){return v.fromBytes(In("sig",A),"compact")}static fromDER(A){return v.fromBytes(In("sig",A),"der")}normalizeS(){return this.hasHighS()?new v(this.r,o.neg(this.s),this.recovery):this}toDERRawBytes(){return this.toBytes("der")}toDERHex(){return ah(this.toBytes("der"))}toCompactRawBytes(){return this.toBytes("compact")}toCompactHex(){return ah(this.toBytes("compact"))}}const E=r.bits2int||function(B){if(B.length>8192)throw new Error("input is too large");const A=KA(B),P=B.length*8-c;return P>0?A>>BigInt(P):A},b=r.bits2int_modN||function(B){return o.create(E(B))},m=w0(c);function _(B){return OT("num < 2^"+c,B,Qa,m),o.toBytes(B)}function O(B,A){return ql(B,void 0,"message"),A?ql(e(B),void 0,"prehashed message"):B}function C(B,A,P){if(["recovered","canonical"].some(V=>V in P))throw new Error("sign() legacy options not supported");const{lowS:k,prehash:U,extraEntropy:x}=bI(P,h);B=O(B,U);const j=b(B),D=Gf(o,A),M=[_(D),_(j)];if(x!=null&&x!==!1){const V=x===!0?n(g.secretKey):x;M.push(In("extraEntropy",V))}const L=Qc(...M),H=j;function z(V){const G=E(V);if(!o.isValidNot0(G))return;const ee=o.inv(G),X=t.BASE.multiply(G).toAffine(),oe=o.create(X.x);if(oe===Qa)return;const te=o.create(ee*o.create(H+oe*D));if(te===Qa)return;let fe=(X.x===oe?0:2)|Number(X.y&ch),Se=te;return k&&y(te)&&(Se=o.neg(te),fe^=1),new v(oe,Se,fe)}return{seed:L,k2sig:z}}function S(B,A,P={}){B=In("message",B);const{seed:k,k2sig:U}=C(B,A,P);return Hce(e.outputLen,o.BYTES,s)(k,U)}function T(B){let A;const P=typeof B=="string"||FA(B),k=!P&&B!==null&&typeof B=="object"&&typeof B.r=="bigint"&&typeof B.s=="bigint";if(!P&&!k)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");if(k)A=new v(B.r,B.s);else if(P){try{A=v.fromBytes(In("sig",B),"der")}catch(U){if(!(U instanceof ja.Err))throw U}if(!A)try{A=v.fromBytes(In("sig",B),"compact")}catch{return!1}}return A||!1}function N(B,A,P,k={}){const{lowS:U,prehash:x,format:j}=bI(k,h);if(P=In("publicKey",P),A=O(In("message",A),x),"strict"in k)throw new Error("options.strict was renamed to lowS");const D=j===void 0?T(B):v.fromBytes(In("sig",B),j);if(D===!1)return!1;try{const M=t.fromBytes(P);if(U&&D.hasHighS())return!1;const{r:L,s:H}=D,z=b(A),V=o.inv(H),G=o.create(z*V),ee=o.create(L*V),X=t.BASE.multiplyUnsafe(G).add(M.multiplyUnsafe(ee));return X.is0()?!1:o.create(X.x)===L}catch{return!1}}function R(B,A,P={}){const{prehash:k}=bI(P,h);return A=O(A,k),v.fromBytes(B,"recovered").recoverPublicKey(A).toBytes()}return Object.freeze({keygen:u,getPublicKey:l,getSharedSecret:d,utils:f,lengths:g,Point:t,sign:S,verify:N,recoverPublicKey:R,Signature:v,hash:e})}function wue(t){const e={a:t.a,b:t.b,p:t.Fp.ORDER,n:t.n,h:t.h,Gx:t.Gx,Gy:t.Gy},r=t.Fp;let n=t.allowedPrivateKeyLengths?Array.from(new Set(t.allowedPrivateKeyLengths.map(o=>Math.ceil(o/2)))):void 0;const s=$u(e.n,{BITS:t.nBitLength,allowedLengths:n,modFromBytes:t.wrapPrivateKey}),i={Fp:r,Fn:s,allowInfinityPoint:t.allowInfinityPoint,endo:t.endo,isTorsionFree:t.isTorsionFree,clearCofactor:t.clearCofactor,fromBytes:t.fromBytes,toBytes:t.toBytes};return{CURVE:e,curveOpts:i}}function Eue(t){const{CURVE:e,curveOpts:r}=wue(t),n={hmac:t.hmac,randomBytes:t.randomBytes,lowS:t.lowS,bits2int:t.bits2int,bits2int_modN:t.bits2int_modN};return{CURVE:e,curveOpts:r,hash:t.hash,ecdsaOpts:n}}function vue(t,e){const r=e.Point;return Object.assign({},e,{ProjectivePoint:r,CURVE:Object.assign({},t,Z9(r.Fn.ORDER,r.Fn.BITS))})}function _ue(t){const{CURVE:e,curveOpts:r,hash:n,ecdsaOpts:s}=Eue(t),i=mue(e,r),o=bue(i,n,s);return vue(t,o)}function RT(t,e){const r=n=>_ue({...t,hash:n});return{...r(e),create:r}}const sH={p:BigInt("0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff"),n:BigInt("0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551"),h:BigInt(1),a:BigInt("0xffffffff00000001000000000000000000000000fffffffffffffffffffffffc"),b:BigInt("0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b"),Gx:BigInt("0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296"),Gy:BigInt("0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5")},iH={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffff0000000000000000ffffffff"),n:BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffc7634d81f4372ddf581a0db248b0a77aecec196accc52973"),h:BigInt(1),a:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffff0000000000000000fffffffc"),b:BigInt("0xb3312fa7e23ee7e4988e056be3f82d19181d9c6efe8141120314088f5013875ac656398d8a2ed19d2a85c8edd3ec2aef"),Gx:BigInt("0xaa87ca22be8b05378eb1c71ef320ad746e1d3b628ba79b9859f741e082542a385502f25dbf55296c3a545e3872760ab7"),Gy:BigInt("0x3617de4a96262c6f5d9e98bf9292dc29f8f41dbd289a147ce9da3113b5f0b8c00a60b1ce1d7e819d7a431d7c90ea0e5f")},oH={p:BigInt("0x1ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),n:BigInt("0x01fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa51868783bf2f966b7fcc0148f709a5d03bb5c9b8899c47aebb6fb71e91386409"),h:BigInt(1),a:BigInt("0x1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc"),b:BigInt("0x0051953eb9618e1c9a1f929a21a0b68540eea2da725b99b315f3b8b489918ef109e156193951ec7e937b1652c0bd3bb1bf073573df883d2c34f1ef451fd46b503f00"),Gx:BigInt("0x00c6858e06b70404e9cd9e3ecb662395b4429c648139053fb521f828af606b4d3dbaa14b5e77efe75928fe1dc127a2ffa8de3348b3c1856a429bf97e7e31c2e5bd66"),Gy:BigInt("0x011839296a789a3bc0045c8a5fb42c7d1bd998f54449579b446817afbd17273e662c97ee72995ef42640c550b9013fad0761353c7086a272c24088be94769fd16650")},Aue=$u(sH.p),Cue=$u(iH.p),Iue=$u(oH.p),Sue=RT({...sH,Fp:Aue,lowS:!1},zA);RT({...iH,Fp:Cue,lowS:!1},xae),RT({...oH,Fp:Iue,lowS:!1,allowedPrivateKeyLengths:[130,131,132]},Nae);const Tue=Sue,aH="base10",Yn="base16",ps="base64pad",Xc="base64url",E0="utf8",cH=0,nc=1,v0=2,Pue=0,qB=1,Rm
29=12,EO=32;function Oue(){const t=NT.utils.randomPrivateKey(),e=NT.getPublicKey(t);return{privateKey:ws(t,Yn),publicKey:ws(e,Yn)}}function BT(){const t=Zd(EO);return ws(t,Yn)}function Nue(t,e){const r=NT.getSharedSecret(fi(t,Yn),fi(e,Yn)),n=Lce(GA,r,void 0,void 0,EO);return ws(n,Yn)}function f_(t){const e=GA(fi(t,Yn));return ws(e,Yn)}function ui(t){const e=GA(fi(t,E0));return ws(e,Yn)}function uH(t){return fi(`${t}`,aH)}function kd(t){return Number(ws(t,aH))}function lH(t){return t.replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function dH(t){const e=t.replace(/-/g,"+").replace(/_/g,"/"),r=(4-e.length%4)%4;return e+"=".repeat(r)}function xue(t){const e=uH(typeof t.type<"u"?t.type:cH);if(kd(e)===nc&&typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");const r=typeof t.senderPublicKey<"u"?fi(t.senderPublicKey,Yn):void 0,n=typeof t.iv<"u"?fi(t.iv,Yn):Zd(Rm),s=fi(t.symKey,Yn),i=U9(s,n).encrypt(fi(t.message,E0)),o=fH({type:e,sealed:i,iv:n,senderPublicKey:r});return t.encoding===Xc?lH(o):o}function Rue(t){const e=fi(t.symKey,Yn),{sealed:r,iv:n}=xy({encoded:t.encoded,encoding:t.encoding}),s=U9(e,n).decrypt(r);if(s===null)throw new Error("Failed to decrypt");return ws(s,E0)}function Bue(t,e){const r=uH(v0),n=Zd(Rm),s=fi(t,E0),i=fH({type:r,sealed:s,iv:n});return e===Xc?lH(i):i}function kue(t,e){const{sealed:r}=xy({encoded:t,encoding:e});return ws(r,E0)}function fH(t){if(kd(t.type)===v0)return ws(xm([t.type,t.sealed]),ps);if(kd(t.type)===nc){if(typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return ws(xm([t.type,t.senderPublicKey,t.iv,t.sealed]),ps)}return ws(xm([t.type,t.iv,t.sealed]),ps)}function xy(t){const e=(t.encoding||ps)===Xc?dH(t.encoded):t.encoded,r=fi(e,ps),n=r.slice(Pue,qB),s=qB;if(kd(n)===nc){const c=s+EO,u=c+Rm,l=r.slice(s,c),d=r.slice(c,u),f=r.slice(u);return{type:n,sealed:f,iv:d,senderPublicKey:l}}if(kd(n)===v0){const c=r.slice(s),u=Zd(Rm);return{type:n,sealed:c,iv:u}}const i=s+Rm,o=r.slice(s,i),a=r.slice(i);return{type:n,sealed:a,iv:o}}function jue(t,e){const r=xy({encoded:t,encoding:e==null?void 0:e.encoding});return hH({type:kd(r.type),senderPublicKey:typeof r.senderPublicKey<"u"?ws(r.senderPublicKey,Yn):void 0,receiverPublicKey:e==null?void 0:e.receiverPublicKey})}function hH(t){const e=(t==null?void 0:t.type)||cH;if(e===nc){if(typeof(t==null?void 0:t.senderPublicKey)>"u")throw new Error("missing sender public key");if(typeof(t==null?void 0:t.receiverPublicKey)>"u")throw new Error("missing receiver public key")}return{type:e,senderPublicKey:t==null?void 0:t.senderPublicKey,receiverPublicKey:t==null?void 0:t.receiverPublicKey}}function zB(t){return t.type===nc&&typeof t.senderPublicKey=="string"&&typeof t.receiverPublicKey=="string"}function WB(t){return t.type===v0}function Due(t){const e=bt.from(t.x,"base64"),r=bt.from(t.y,"base64");return xm([new Uint8Array([4]),e,r])}function Uue(t,e){const[r,n,s]=t.split("."),i=bt.from(dH(s),"base64");if(i.length!==64)throw new Error("Invalid signature length");const o=i.slice(0,32),a=i.slice(32,64),c=`${r}.${n}`,u=GA(c),l=Due(e);if(!Tue.verify(xm([o,a]),u,l))throw new Error("Invalid signature");return yT(t).payload}const Mue="irn";function rA(t){return(t==null?void 0:t.relay)||{protocol:Mue}}function Kf(t){const e=moe[t];if(typeof e>"u")throw new Error(`Relay Protocol not supported: ${t}`);return e}var $ue=Object.defineProperty,Lue=Object.defineProperties,Fue=Object.getOwnPropertyDescriptors,VB=Object.getOwnPropertySymbols,Hue=Object.prototype.hasOwnProperty,que=Object.prototype.propertyIsEnumerable,GB=(t,e,r)=>e in t?$ue(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,wI=(t,e)=>{for(var r in e||(e={}))Hue.call(e,r)&&GB(t,r,e[r]);if(VB)for(var r of VB(e))que.call(e,r)&&GB(t,r,e[r]);return t},zue=(t,e)=>Lue(t,Fue(e));function Wue(t,e="-"){const r={},n="relay"+e;return Object.keys(t).forEach(s=>{if(s.startsWith(n)){const i=s.replace(n,""),o=t[s];r[i]=o}}),r}function KB(t){if(!t.includes("wc:")){const u=y9(t);u!=null&&u.includes("wc:")&&(t=u)}t=t.includes("wc://")?t.replace("wc://",""):t,t=t.includes("wc:")?t.replace("wc:",""):t;const e=t.indexOf(":"),r=t.indexOf("?")!==-1?t.indexOf("?"):void 0,n=t.substring(0,e),s=t.substring(e+1,r).split("@"),i=typeof r<"u"?t.substring(r):"",o=new URLSearchParams(i),a=Object.fromEntries(o.entries()),c=typeof a.methods=="str
29ing"?a.methods.split(","):void 0;return{protocol:n,topic:Vue(s[0]),version:parseInt(s[1],10),symKey:a.symKey,relay:Wue(a),methods:c,expiryTimestamp:a.expiryTimestamp?parseInt(a.expiryTimestamp,10):void 0}}function Vue(t){return t.startsWith("//")?t.substring(2):t}function Gue(t,e="-"){const r="relay",n={};return Object.keys(t).forEach(s=>{const i=s,o=r+e+i;t[i]&&(n[o]=t[i])}),n}function ZB(t){const e=new URLSearchParams,r=wI(wI(zue(wI({},Gue(t.relay)),{symKey:t.symKey}),t.expiryTimestamp&&{expiryTimestamp:t.expiryTimestamp.toString()}),t.methods&&{methods:t.methods.join(",")});return Object.entries(r).sort(([n],[s])=>n.localeCompare(s)).forEach(([n,s])=>{s!==void 0&&e.append(n,String(s))}),`${t.protocol}:${t.topic}@${t.version}?${e}`}function Pb(t,e,r){return`${t}?wc_ev=${r}&topic=${e}`}var Kue=Object.defineProperty,Zue=Object.defineProperties,Yue=Object.getOwnPropertyDescriptors,YB=Object.getOwnPropertySymbols,Jue=Object.prototype.hasOwnProperty,Que=Object.prototype.propertyIsEnumerable,JB=(t,e,r)=>e in t?Kue(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Xue=(t,e)=>{for(var r in e||(e={}))Jue.call(e,r)&&JB(t,r,e[r]);if(YB)for(var r of YB(e))Que.call(e,r)&&JB(t,r,e[r]);return t},ele=(t,e)=>Zue(t,Yue(e));function xp(t){const e=[];return t.forEach(r=>{const[n,s]=r.split(":");e.push(`${n}:${s}`)}),e}function pH(t){const e=[];return Object.values(t).forEach(r=>{e.push(...xp(r.accounts))}),[...new Set(e)]}function tle(t){const e=[];return Object.values(t).forEach(r=>{e.push(...r.methods)}),[...new Set(e)]}function rle(t){const e=[];return Object.values(t).forEach(r=>{e.push(...r.events)}),[...new Set(e)]}function nle(t,e){const r=[];return Object.values(t).forEach(n=>{xp(n.accounts).includes(e)&&r.push(...n.methods)}),r}function sle(t,e){const r=[];return Object.values(t).forEach(n=>{xp(n.accounts).includes(e)&&r.push(...n.events)}),r}function YA(t){return t.includes(":")}function Zf(t){return YA(t)?t.split(":")[0]:t}function QB(t){var e,r,n;const s={};if(!$o(t))return s;for(const[i,o]of Object.entries(t)){const a=YA(i)?[i]:o.chains,c=o.methods||[],u=o.events||[],l=Zf(i);s[l]=ele(Xue({},s[l]),{chains:Mo(a,(e=s[l])==null?void 0:e.chains),methods:Mo(c,(r=s[l])==null?void 0:r.methods),events:Mo(u,(n=s[l])==null?void 0:n.events)})}return s}function ile(t){const e={};return t==null||t.forEach(r=>{var n;const[s,i]=r.split(":");e[s]||(e[s]={accounts:[],chains:[],events:[],methods:[]}),e[s].accounts.push(r),(n=e[s].chains)==null||n.push(`${s}:${i}`)}),e}function XB(t,e){e=e.map(n=>n.replace("did:pkh:",""));const r=ile(e);for(const[n,s]of Object.entries(r))s.methods?s.methods=Mo(s.methods,t):s.methods=t,s.events=["chainChanged","accountsChanged"];return r}function ole(t,e){var r,n,s,i,o,a;const c=QB(t),u=QB(e),l={},d=Object.keys(c).concat(Object.keys(u));for(const f of d)l[f]={chains:Mo((r=c[f])==null?void 0:r.chains,(n=u[f])==null?void 0:n.chains),methods:Mo((s=c[f])==null?void 0:s.methods,(i=u[f])==null?void 0:i.methods),events:Mo((o=c[f])==null?void 0:o.events,(a=u[f])==null?void 0:a.events)};return l}function sc(t,e){return!!Array.isArray(t)}function $o(t){return Object.getPrototypeOf(t)===Object.prototype&&Object.keys(t).length}function Gr(t){return typeof t>"u"}function xr(t,e){return e&&Gr(t)?!0:typeof t=="string"&&!!t.trim().length}function vO(t,e){return typeof t=="number"&&!isNaN(t)}function ale(t,e){const{requiredNamespaces:r}=e,n=Object.keys(t.namespaces),s=Object.keys(r);let i=!0;return Hl(s,n)?(n.forEach(o=>{const{accounts:a,methods:c,events:u}=t.namespaces[o],l=xp(a),d=r[o];(!Hl(f9(o,d),l)||!Hl(d.methods,c)||!Hl(d.events,u))&&(i=!1)}),i):!1}function nA(t){return xr(t,!1)&&t.includes(":")?t.split(":").length===2:!1}function cle(t){if(xr(t,!1)&&t.includes(":")){const e=t.split(":");if(e.length===3){const r=e[0]+":"+e[1];return!!e[2]&&nA(r)}}return!1}function ule(t){function e(r){try{return typeof new URL(r)<"u"}catch{return!1}}try{if(xr(t,!1)){if(e(t))return!0;const r=y9(t);return e(r)}}catch{}return!1}function lle(t){var e;return(e=t==null?void 0:t.proposer)==null?void 0:e.publicKey}function dle(t){return t==null?void 0:t.topic}function fle(t,e){let r=null;return xr(t==null?void 0:t.publicKey,!1)||(r=_e("MISSING_OR_INVALID",`${e} controller public key should be a string`)),r}function e6(t){let e=!0;return sc(t)?t.length&&(e=t.every(r=>xr(r,!1))):e=!1,e}function hle(t,e,r){let n=null;return sc(e)&&e.length?e.forEach(s=>
29{n||nA(s)||(n=ar("UNSUPPORTED_CHAINS",`${r}, chain ${s} should be a string and conform to "namespace:chainId" format`))}):nA(t)||(n=ar("UNSUPPORTED_CHAINS",`${r}, chains must be defined as "namespace:chainId" e.g. "eip155:1": {...} in the namespace key OR as an array of CAIP-2 chainIds e.g. eip155: { chains: ["eip155:1", "eip155:5"] }`)),n}function ple(t,e,r){let n=null;return Object.entries(t).forEach(([s,i])=>{if(n)return;const o=hle(s,f9(s,i),`${e} ${r}`);o&&(n=o)}),n}function gle(t,e){let r=null;return sc(t)?t.forEach(n=>{r||cle(n)||(r=ar("UNSUPPORTED_ACCOUNTS",`${e}, account ${n} should be a string and conform to "namespace:chainId:address" format`))}):r=ar("UNSUPPORTED_ACCOUNTS",`${e}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),r}function mle(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;const s=gle(n==null?void 0:n.accounts,`${e} namespace`);s&&(r=s)}),r}function yle(t,e){let r=null;return e6(t==null?void 0:t.methods)?e6(t==null?void 0:t.events)||(r=ar("UNSUPPORTED_EVENTS",`${e}, events should be an array of strings or empty array for no events`)):r=ar("UNSUPPORTED_METHODS",`${e}, methods should be an array of strings or empty array for no methods`),r}function gH(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;const s=yle(n,`${e}, namespace`);s&&(r=s)}),r}function ble(t,e,r){let n=null;if(t&&$o(t)){const s=gH(t,e);s&&(n=s);const i=ple(t,e,r);i&&(n=i)}else n=_e("MISSING_OR_INVALID",`${e}, ${r} should be an object with data`);return n}function EI(t,e){let r=null;if(t&&$o(t)){const n=gH(t,e);n&&(r=n);const s=mle(t,e);s&&(r=s)}else r=_e("MISSING_OR_INVALID",`${e}, namespaces should be an object with data`);return r}function mH(t){return xr(t.protocol,!0)}function wle(t,e){let r=!1;return t?t&&sc(t)&&t.length&&t.forEach(n=>{r=mH(n)}):r=!0,r}function Ele(t){return typeof t=="number"}function cs(t){return typeof t<"u"&&typeof t!==null}function vle(t){return!(!t||typeof t!="object"||!t.code||!vO(t.code)||!t.message||!xr(t.message,!1))}function _le(t){return!(Gr(t)||!xr(t.method,!1))}function Ale(t){return!(Gr(t)||Gr(t.result)&&Gr(t.error)||!vO(t.id)||!xr(t.jsonrpc,!1))}function Cle(t){return!(Gr(t)||!xr(t.name,!1))}function t6(t,e){return!(!nA(e)||!pH(t).includes(e))}function Ile(t,e,r){return xr(r,!1)?nle(t,e).includes(r):!1}function Sle(t,e,r){return xr(r,!1)?sle(t,e).includes(r):!1}function r6(t,e,r){let n=null;const s=Tle(t),i=Ple(e),o=Object.keys(s),a=Object.keys(i),c=n6(Object.keys(t)),u=n6(Object.keys(e)),l=c.filter(d=>!u.includes(d));return l.length&&(n=_e("NON_CONFORMING_NAMESPACES",`${r} namespaces keys don't satisfy requiredNamespaces.
30      Required: ${l.toString()}
31      Received: ${Object.keys(e).toString()}`)),Hl(o,a)||(n=_e("NON_CONFORMING_NAMESPACES",`${r} namespaces chains don't satisfy required namespaces.
32      Required: ${o.toString()}
33      Approved: ${a.toString()}`)),Object.keys(e).forEach(d=>{if(!d.includes(":")||n)return;const f=xp(e[d].accounts);f.includes(d)||(n=_e("NON_CONFORMING_NAMESPACES",`${r} namespaces accounts don't satisfy namespace accounts for ${d}
34        Required: ${d}
35        Approved: ${f.toString()}`))}),o.forEach(d=>{n||(Hl(s[d].methods,i[d].methods)?Hl(s[d].events,i[d].events)||(n=_e("NON_CONFORMING_NAMESPACES",`${r} namespaces events don't satisfy namespace events for ${d}`)):n=_e("NON_CONFORMING_NAMESPACES",`${r} namespaces methods don't satisfy namespace methods for ${d}`))}),n}function Tle(t){const e={};return Object.keys(t).forEach(r=>{var n;r.includes(":")?e[r]=t[r]:(n=t[r].chains)==null||n.forEach(s=>{e[s]={methods:t[r].methods,events:t[r].events}})}),e}function n6(t){return[...new Set(t.map(e=>e.includes(":")?e.split(":")[0]:e))]}function Ple(t){const e={};return Object.keys(t).forEach(r=>{if(r.includes(":"))e[r]=t[r];else{const n=xp(t[r].accounts);n==null||n.forEach(s=>{e[s]={accounts:t[r].accounts.filter(i=>i.includes(`${s}:`)),methods:t[r].methods,events:t[r].events}})}}),e}function Ole(t,e){return vO(t)&&t<=e.max&&t>=e.min}function s6(){const t=y0();return new Promise(e=>{switch(t){case Vs.browser:e(Nle());break;case Vs.reactNative:e(xle());break;case Vs.node:e(Rle());break;default:e(!0)}})}function Nle(){return Np()&&(navigator==null?void 0:navigator.onLine)}async function xle(){if(Mu()&&typeof We<"u"&&We!=null&&We.NetInfo){const t=await(We==null?void 0:We.NetInfo.fetch());return t==null?void 0:t.isConnected}return!0}function Rle(){return!0}function Ble(t){switch(y0()){case Vs.browser:kle(t);break;case Vs.reactNative:jle(t);break}}function kle(t){!Mu()&&Np()&&(window.addEventListener("online",()=>t(!0)),window.addEventListener("offline",()=>t(!1)))}function jle(t){var e;Mu()&&typeof We<"u"&&We!=null&&We.NetInfo&&((e=We)==null||e.NetInfo.addEventListener(r=>t(r==null?void 0:r.isConnected)))}function Dle(){var t;return Np()&&ac.getDocument()?((t=ac.getDocument())==null?void 0:t.visibilityState)==="visible":!0}const vI={};class rg{static get(e){return vI[e]}static set(e,r){vI[e]=r}static delete(e){delete vI[e]}}function Ule(t){const e=g0.decode(t);if(e.length<33)throw new Error("Too short to contain a public key");return e.slice(1,33)}function Mle({publicKey:t,signature:e,payload:r}){var n;const s=kT(r.method),i=128|parseInt(((n=r.version)==null?void 0:n.toString())||"4"),o=Fle(r.address),a=r.era==="00"?new Uint8Array([0]):kT(r.era);if(a.length!==1&&a.length!==2)throw new Error("Invalid era length");const c=parseInt(r.nonce,16),u=new Uint8Array([c&255,c>>8&255]),l=BigInt(`0x${Lle(r.tip)}`),d=qle(l),f=new Uint8Array([0,...t,o,...e,...a,...u,...d,...s]),g=Hle(f.length+1);return new Uint8Array([...g,i,...f])}function $le(t){const e=kT(t),r=Eoe.blake2b(e,void 0,32);return"0x"+bt.from(r).toString("hex")}function kT(t){return new Uint8Array(t.replace(/^0x/,"").match(/.{1,2}/g).map(e=>parseInt(e,16)))}function Lle(t){return t.startsWith("0x")?t.slice(2):t}function Fle(t){const e=g0.decode(t)[0];return e===42?0:e===60?2:1}function Hle(t){if(t<64)return new Uint8Array([t<<2]);if(t<16384){const e=t<<2|1;return new Uint8Array([e&255,e>>
vendor: 20,557 bytes, line 35
358&255])}else if(t<1<<30){const e=t<<2|2;return new Uint8Array([e&255,e>>8&255,e>>16&255,e>>24&255])}else throw new Error("Compact encoding > 2^30 not supported")}function qle(t){if(t<BigInt(1)<<BigInt(6))return new Uint8Array([Number(t<<BigInt(2))]);if(t<BigInt(1)<<BigInt(14)){const e=t<<BigInt(2)|BigInt(1);return new Uint8Array([Number(e&BigInt(255)),Number(e>>BigInt(8)&BigInt(255))])}else if(t<BigInt(1)<<BigInt(30)){const e=t<<BigInt(2)|BigInt(2);return new Uint8Array([Number(e&BigInt(255)),Number(e>>BigInt(8)&BigInt(255)),Number(e>>BigInt(16)&BigInt(255)),Number(e>>BigInt(24)&BigInt(255))])}else throw new Error("BigInt compact encoding not supported > 2^30")}function zle(t){const e=Uint8Array.from(bt.from(t.signature,"hex")),r=Ule(t.transaction.address),n=Mle({publicKey:r,signature:e,payload:t.transaction}),s=bt.from(n).toString("hex");return $le(s)}function _O({logger:t,name:e}){const r=typeof t=="string"?kA({opts:{level:t,name:e}}).logger:t;return r.level=typeof t=="string"?t:t.level,r}const Wle="PARSE_ERROR",Vle="INVALID_REQUEST",Gle="METHOD_NOT_FOUND",Kle="INVALID_PARAMS",yH="INTERNAL_ERROR",AO="SERVER_ERROR",Zle=[-32700,-32600,-32601,-32602,-32603],Bm={[Wle]:{code:-32700,message:"Parse error"},[Vle]:{code:-32600,message:"Invalid Request"},[Gle]:{code:-32601,message:"Method not found"},[Kle]:{code:-32602,message:"Invalid params"},[yH]:{code:-32603,message:"Internal error"},[AO]:{code:-32e3,message:"Server error"}},bH=AO;function Yle(t){return Zle.includes(t)}function i6(t){return Object.keys(Bm).includes(t)?Bm[t]:Bm[bH]}function Jle(t){const e=Object.values(Bm).find(r=>r.code===t);return e||Bm[bH]}function wH(t,e,r){return t.message.includes("getaddrinfo ENOTFOUND")||t.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${r} RPC url at ${e}`):t}var _I={},ta={},o6;function Qle(){if(o6)return ta;o6=1,Object.defineProperty(ta,"__esModule",{value:!0}),ta.isBrowserCryptoAvailable=ta.getSubtleCrypto=ta.getBrowerCrypto=void 0;function t(){return(To===null||To===void 0?void 0:To.crypto)||(To===null||To===void 0?void 0:To.msCrypto)||{}}ta.getBrowerCrypto=t;function e(){const n=t();return n.subtle||n.webkitSubtle}ta.getSubtleCrypto=e;function r(){return!!t()&&!!e()}return ta.isBrowserCryptoAvailable=r,ta}var ra={},a6;function Xle(){if(a6)return ra;a6=1,Object.defineProperty(ra,"__esModule",{value:!0}),ra.isBrowser=ra.isNode=ra.isReactNative=void 0;function t(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}ra.isReactNative=t;function e(){return typeof Qr<"u"&&typeof Qr.versions<"u"&&typeof Qr.versions.node<"u"}ra.isNode=e;function r(){return!t()&&!e()}return ra.isBrowser=r,ra}var c6;function ede(){return c6||(c6=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=d0;e.__exportStar(Qle(),t),e.__exportStar(Xle(),t)}(_I)),_I}var tde=ede();function yo(t=3){const e=Date.now()*Math.pow(10,t),r=Math.floor(Math.random()*Math.pow(10,t));return e+r}function _u(t=6){return BigInt(yo(t))}function Fi(t,e,r){return{id:r||yo(),jsonrpc:"2.0",method:t,params:e}}function Ry(t,e){return{id:t,jsonrpc:"2.0",result:e}}function JA(t,e,r){return{id:t,jsonrpc:"2.0",error:rde(e)}}function rde(t,e){return typeof t>"u"?i6(yH):(typeof t=="string"&&(t=Object.assign(Object.assign({},i6(AO)),{message:t})),Yle(t.code)&&(t=Jle(t.code)),t)}let nde=class{},sde=class extends nde{constructor(){super()}},ide=class extends sde{constructor(e){super()}};const ode="^https?:",ade="^wss?:";function cde(t){const e=t.match(new RegExp(/^\w+:/,"gi"));if(!(!e||!e.length))return e[0]}function EH(t,e){const r=cde(t);return typeof r>"u"?!1:new RegExp(e).test(r)}function u6(t){return EH(t,ode)}function l6(t){return EH(t,ade)}function ude(t){return new RegExp("wss?://localhost(:d{2,5})?").test(t)}function vH(t){return typeof t=="object"&&"id"in t&&"jsonrpc"in t&&t.jsonrpc==="2.0"}function CO(t){return vH(t)&&"method"in t}function QA(t){return vH(t)&&(bo(t)||li(t))}function bo(t){return"result"in t}function li(t){return"error"in t}let IO=class extends ide{constructor(e){super(e),this.events=new gi.EventEmitter,this.hasRegisteredEventListeners=!1,this.connection=this.setConnection(e),this.connection.connected&&this.registerEventListeners()}async connect(e=this.connection){await this.open(e)}async disconnect(){await this.close()}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async request(e,r){return this.requestStrict(Fi(e.method,e.params||[],e.id||_u().toString()),r)}async requestStrict(e,r){return new Promise(async(n,s)=>{if(!this.connection.connected)try{await this.open()}catch(i){s(i)}this.events.on(`${e.id}`,i=>{li(i)?s(i.error):n(i.result)});try{await this.connection.send(e,r)}catch(i){s(i)}})}setConnection(e=this.connection){return e}onPayload(e){this.events.emit("payload",e),QA(e)?this.events.emit(`${e.id}`,e):this.events.emit("message",{type:e.method,data:e.params})}onClose(e){e&&e.code===3e3&&this.events.emit("error",new Error(`WebSocket connection closed abnormally with code: ${e.code} ${e.reason?`(${e.reason})`:""}`)),this.events.emit("disconnect")}async open(e=this.connection){this.connection===e&&this.connection.connected||(this.connection.connected&&this.close(),typeof e=="string"&&(await this.connection.open(e),e=this.connection),this.connection=this.setConnection(e),await this.connection.open(),this.registerEventListeners(),this.events.emit("connect"))}async close(){await this.connection.close()}registerEventListeners(){this.hasRegisteredEventListeners||(this.connection.on("payload",e=>this.onPayload(e)),this.connection.on("close",e=>this.onClose(e)),this.connection.on("error",e=>this.events.emit("error",e)),this.connection.on("register_error",e=>this.onClose()),this.hasRegisteredEventListeners=!0)}};const lde=()=>typeof WebSocket<"u"?WebSocket:typeof We<"u"&&typeof We.WebSocket<"u"?We.WebSocket:typeof window<"u"&&typeof window.WebSocket<"u"?window.WebSocket:typeof self<"u"&&typeof self.WebSocket<"u"?self.WebSocket:require("ws"),dde=()=>typeof WebSocket<"u"||typeof We<"u"&&typeof We.WebSocket<"u"||typeof window<"u"&&typeof window.WebSocket<"u"||typeof self<"u"&&typeof self.WebSocket<"u",d6=t=>t.split("?")[0],f6=10,fde=lde();let hde=class{constructor(e){if(this.url=e,this.events=new gi.EventEmitter,this.registering=!1,!l6(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);this.url=e}get connected(){return typeof this.socket<"u"}get connecting(){return this.registering}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async open(e=this.url){await this.register(e)}async close(){return new Promise((e,r)=>{if(typeof this.socket>"u"){r(new Error("Connection already closed"));return}this.socket.onclose=n=>{this.onClose(n),e()},this.socket.close()})}async send(e){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send(Rd(e))}catch(r){this.onError(e.id,r)}}register(e=this.url){if(!l6(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);if(this.registering){const r=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=r||this.events.listenerCount("open")>=r)&&this.events.setMaxListeners(r+1),new Promise((n,s)=>{this.events.once("register_error",i=>{this.resetMaxListeners(),s(i)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.socket>"u")return s(new Error("WebSocket connection is missing or invalid"));n(this.socket)})})}return this.url=e,this.registering=!0,new Promise((r,n)=>{const s=tde.isReactNative()?void 0:{rejectUnauthorized:!ude(e)},i=new fde(e,[],s);dde()?i.onerror=o=>{const a=o;n(this.emitError(a.error))}:i.on("error",o=>{n(this.emitError(o))}),i.onopen=()=>{this.onOpen(i),r(i)}})}onOpen(e){e.onmessage=r=>this.onPayload(r),e.onclose=r=>this.onClose(r),this.socket=e,this.registering=!1,this.events.emit("open")}onClose(e){this.socket=void 0,this.registering=!1,this.events.emit("close",e)}onPayload(e){if(typeof e.data>"u")return;const r=typeof e.data=="string"?xd(e.data):e.data;this.events.emit("payload",r)}onError(e,r){const n=this.parseError(r),s=n.message||n.toString(),i=JA(e,s);this.events.emit("payload",i)}parseError(e,r=this.url){return wH(e,d6(r),"WS")}resetMaxListeners(){this.events.getMaxListeners()>f6&&this.events.setMaxListeners(f6)}emitError(e){const r=this.parseError(new Error((e==null?void 0:e.message)||`WebSocket connection failed for host: ${d6(this.url)}`));return this.events.emit("register_error",r),r}};var pde={};const _H="wc",AH=2,jT="core",Wo=`${_H}@2:${jT}:`,gde={logger:"error"},mde={database:":memory:"},yde="crypto",h6="client_ed25519_seed",bde=ye.ONE_DAY,wde="keychain",Ede="0.3",vde="messages",_de="0.3",Ade=ye.SIX_HOURS,Cde="publisher",CH="irn",Ide="error",IH="wss://relay.walletconnect.org",Sde="relayer",_r={message:"relayer_message",message_ack:"relayer_message_ack",connect:"relayer_connect",disconnect:"relayer_disconnect",error:"relayer_error",connection_stalled:"relayer_connection_stalled",transport_closed:"relayer_transport_closed",publish:"relayer_publish"},Tde="_subscription",Js={payload:"payload",connect:"connect",disconnect:"disconnect",error:"error"},Pde=.1,DT="2.23.7",er={link_mode:"link_mode",relay:"relay"},h_={inbound:"inbound",outbound:"outbound"},Ode="0.3",Nde="WALLETCONNECT_CLIENT_ID",p6="WALLETCONNECT_LINK_MODE_APPS",ks={created:"subscription_created",deleted:"subscription_deleted",expired:"subscription_expired",disabled:"subscription_disabled",sync:"subscription_sync",resubscribed:"subscription_resubscribed"},xde="subscription",Rde="0.3",Bde="pairing",kde="0.3",ng={wc_pairingDelete:{req:{ttl:ye.ONE_DAY,prompt:!1,tag:1e3},res:{ttl:ye.ONE_DAY,prompt:!1,tag:1001}},wc_pairingPing:{req:{ttl:ye.THIRTY_SECONDS,prompt:!1,tag:1002},res:{ttl:ye.THIRTY_SECONDS,prompt:!1,tag:1003}},unregistered_method:{req:{ttl:ye.ONE_DAY,prompt:!1,tag:0},res:{ttl:ye.ONE_DAY,prompt:!1,tag:0}}},kl={create:"pairing_create",expire:"pairing_expire",delete:"pairing_delete",ping:"pairing_ping"},Ei={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},jde="history",Dde="0.3",Ude="expirer",ti={created:"expirer_created",deleted:"expirer_deleted",expired:"expirer_expired",sync:"expirer_sync"},Mde="0.3",$de="verify-api",Lde="https://verify.walletconnect.com",SH="https://verify.walletconnect.org",km=SH,Fde=`${km}/v3`,Hde=[Lde,SH],qde="echo",zde="https://echo.walletconnect.com",mo={pairing_started:"pairing_started",pairing_uri_validation_success:"pairing_uri_validation_success",pairing_uri_not_expired:"pairing_uri_not_expired",store_new_pairing:"store_new_pairing",subscribing_pairing_topic:"subscribing_pairing_topic",subscribe_pairing_topic_success:"subscribe_pairing_topic_success",existing_pairing:"existing_pairing",pairing_not_expired:"pairing_not_expired",emit_inactive_pairing:"emit_inactive_pairing",emit_session_proposal:"emit_session_proposal",subscribing_to_pairing_topic:"subscribing_to_pairing_topic"},Sa={no_wss_connection:"no_wss_connection",no_internet_connection:"no_internet_connection",malformed_pairing_uri:"malformed_pairing_uri",active_pairing_already_exists:"active_pairing_already_exists",subscribe_pairing_topic_failure:"subscribe_pairing_topic_failure",pairing_expired:"pairing_expired",proposal_expired:"proposal_expired",proposal_listener_not_found:"proposal_listener_not_found"},vi={session_approve_started:"session_approve_started",proposal_not_expired:"proposal_not_expired",session_namespaces_validation_success:"session_namespaces_validation_success",create_session_topic:"create_session_topic",subscribing_session_topic:"subscribing_session_topic",subscribe_session_topic_success:"subscribe_session_topic_success",publishing_session_approve:"publishing_session_approve",session_approve_publish_success:"session_approve_publish_success",store_session:"store_session",publishing_session_settle:"publishing_session_settle",session_settle_publish_success:"session_settle_publish_success",session_request_response_started:"session_request_response_started",session_request_response_validation_success:"session_request_response_validation_success",session_request_response_publish_started:"session_request_response_publish_started"},rl={no_internet_connection:"no_internet_connection",no_wss_connection:"no_wss_connection",proposal_expired:"proposal_expired",subscribe_session_topic_failure:"subscribe_session_topic_failure",session_approve_publish_failure:"session_approve_publish_failure",session_settle_publish_failure:"session_settle_publish_failure",session_approve_namespace_validation_failure:"session_approve_namespace_validation_failure",proposal_not_found:"proposal_not_found",session_request_response_validation_failure:"session_request_response_validation_failure",session_request_response_publish_failure:"session_request_response_publish_failure"},nl={authenticated_session_approve_started:"authenticated_session_approve_started",create_authenticated_session_topic:"create_authenticated_session_topic",cacaos_verified:"cacaos_verified",store_authenticated_session:"store_authenticated_session",subscribing_authenticated_session_topic:"subscribing_authenticated_session_topic",subscribe_authenticated_session_topic_success:"subscribe_authenticated_session_topic_success",publishing_authenticated_session_approve:"publishing_authenticated_session_approve"},sg={no_internet_connection:"no_internet_connection",invalid_cacao:"invalid_cacao",subscribe_authenticated_session_topic_failure:"subscribe_authenticated_session_topic_failure",authenticated_session_approve_publish_failure:"authenticated_session_approve_publish_failure",authenticated_session_pending_request_not_found:"authenticated_session_pending_request_not_found"},Wde=.1,Vde="event-client",Gde=86400,Kde="https://pulse.walletconnect.org/batch";function Zde(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var s=0;s<t.length;s++){var i=t.charAt(s),o=i.charCodeAt(0);if(r[o]!==255)throw new TypeError(i+" is ambiguous");r[o]=s}var a=t.length,c=t.charAt(0),u=Math.log(a)/Math.log(256),l=Math.log(256)/Math.log(a);function d(h){if(h instanceof Uint8Array||(ArrayBuffer.isView(h)?h=new Uint8Array(h.buffer,h.byteOffset,h.byteLength):Array.isArray(h)&&(h=Uint8Array.from(h))),!(h instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(h.length===0)return"";for(var p=0,y=0,w=0,I=h.length;w!==I&&h[w]===0;)w++,p++;for(var v=(I-w)*l+1>>>0,E=new Uint8Array(v);w!==I;){for(var b=h[w],m=0,_=v-1;(b!==0||m<y)&&_!==-1;_--,m++)b+=256*E[_]>>>0,E[_]=b%a>>>0,b=b/a>>>0;if(b!==0)throw new Error("Non-zero carry");y=m,w++}for(var O=v-y;O!==v&&E[O]===0;)O++;for(var C=c.repeat(p);O<v;++O)C+=t.charAt(E[O]);return C}function f(h){if(typeof h!="string")throw new TypeError("Expected String");if(h.length===0)return new Uint8Array;var p=0;if(h[p]!==" "){for(var y=0,w=0;h[p]===c;)y++,p++;for(var I=(h.length-p)*u+1>>>0,v=new Uint8Array(I);h[p];){var E=r[h.charCodeAt(p)];if(E===255)return;for(var b=0,m=I-1;(E!==0||b<w)&&m!==-1;m--,b++)E+=a*v[m]>>>0,v[m]=E%256>>>0,E=E/256>>>0;if(E!==0)throw new Error("Non-zero carry");w=b,p++}if(h[p]!==" "){for(var _=I-w;_!==I&&v[_]===0;)_++;for(var O=new Uint8Array(y+(I-_)),C=y;_!==I;)O[C++]=v[_++];return O}}}function g(h){var p=f(h);if(p)return p;throw new Error(`Non-${e} character`)}return{encode:d,decodeUnsafe:f,decode:g}}var Yde=Zde,Jde=Yde;const TH=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},Qde=t=>new TextEncoder().encode(t),Xde=t=>new TextDecoder().decode(t);class efe{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class tfe{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return PH(this,e)}}class rfe{constructor(e){this.decoders=e}or(e){return PH(this,e)}decode(e){const r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const PH=(t,e)=>new rfe({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}});class nfe{constructor(e,r,n,s){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=s,this.encoder=new efe(e,r,n),this.decoder=new tfe(e,r,s)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const XA=({name:t,prefix:e,encode:r,decode:n})=>new nfe(t,e,r,n),_0=({prefix:t,name:e,alphabet:r})=>{const{encode:n,decode:s}=Jde(r,e);return XA({prefix:t,name:e,encode:n,decode:i=>TH(s(i))})},sfe=(t,e,r,n)=>{const s={};for(let l=0;l<e.length;++l)s[e[l]]=l;let i=t.length;for(;t[i-1]==="=";)--i;const o=new Uint8Array(i*r/8|0);let a=0,c=0,u=0;for(let l=0;l<i;++l){const d=s[t[l]];if(d===void 0)throw new SyntaxError(`Non-${n} character`);c=c<<r|d,a+=r,a>=8&&(a-=8,o[u++]=255&c>>a)}if(a>=r||255&c<<8-a)throw new SyntaxError("Unexpected end of data");return o},ife=(t,e,r)=>{const n=e[e.length-1]==="=",s=(1<<r)-1;let i="",o=0,a=0;for(let c=0;c<t.length;++c)for(a=a<<8|t[c],o+=8;o>r;)o-=r,i+=e[s&a>>o];if(o&&(i+=e[s&a<<r-o]),n)for(;i.length*r&7;)i+="=";return i},hn=({name:t,prefix:e,bitsPerChar:r,alphabet:n})=>XA({prefix:e,name:t,encode(s){return ife(s,n,r)},decode(s){return sfe(s,n,r,t)}}),ofe=XA({prefix:"\0",name:"identity",encode:t=>Xde(t),decode:t=>Qde(t)});var afe=Object.freeze({__proto__:null,identity:ofe});const cfe=hn({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var ufe=Object.freeze({__proto__:null,base2:cfe});const lfe=hn({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var dfe=Object.freeze({__proto__:null,base8:lfe});const ffe=_0({prefix:"9",name:"base10",alphabet:"0123456789"});var hfe=Object.freeze({__proto__:null,base10:ffe});const pfe=hn({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),gfe=hn({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var mfe=Object.freeze({__proto__:null,base16:pfe,base16upper:gfe});const yfe=hn({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),bfe=hn({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),wfe=hn({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Efe=hn({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),vfe=hn({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),_fe=hn({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Afe=hn({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Cfe=hn({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Ife=hn({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Sfe=Object.freeze({__proto__:null,base32:yfe,base32upper:bfe,base32pad:wfe,base32padupper:Efe,base32hex:vfe,base32hexupper:_fe,base32hexpad:Afe,base32hexpadupper:Cfe,base32z:Ife});const Tfe=_0({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Pfe=_0({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var Ofe=Object.freeze({__proto__:null,base36:Tfe,base36upper:Pfe});const Nfe=_0({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),xfe=_0({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Rfe=Object.freeze({__proto__:null,base58btc:Nfe,base58flickr:xfe});const Bfe=hn({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
35+/",bitsPerChar:6}),kfe=hn({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),jfe=hn({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Dfe=hn({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var Ufe=Object.freeze({__proto__:null,base64:Bfe,base64pad:kfe,base64url:jfe,base64urlpad:Dfe});const OH=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),Mfe=OH.reduce((t,e,r)=>(t[r]=e,t),[]),$fe=OH.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function Lfe(t){return t.reduce((e,r)=>(e+=Mfe[r],e),"")}function Ffe(t){const e=[];for(const r of t){const n=$fe[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}const Hfe=XA({prefix:"🚀",name:"base256emoji",encode:Lfe,decode:Ffe});var qfe=Object.freeze({__proto__:null,base256emoji:Hfe}),zfe=NH,g6=128,Wfe=-128,Vfe=Math.pow(2,31);function NH(t,e,r){e=e||[],r=r||0;for(var n=r;t>=Vfe;)e[r++]=t&255|g6,t/=128;for(;t&Wfe;)e[r++]=t&255|g6,t>>>=7;return e[r]=t|0,NH.bytes=r-n+1,e}var Gfe=UT,Kfe=128,m6=127;function UT(t,n){var r=0,n=n||0,s=0,i=n,o,a=t.length;do{if(i>=a)throw UT.bytes=0,new RangeError("Could not decode varint");o=t[i++],r+=s<28?(o&m6)<<s:(o&m6)*Math.pow(2,s),s+=7}while(o>=Kfe);return UT.bytes=i-n,r}var Zfe=Math.pow(2,7),Yfe=Math.pow(2,14),Jfe=Math.pow(2,21),Qfe=Math.pow(2,28),Xfe=Math.pow(2,35),ehe
vendor: 11,166 bytes, line 35
35=Math.pow(2,42),the=Math.pow(2,49),rhe=Math.pow(2,56),nhe=Math.pow(2,63),she=function(t){return t<Zfe?1:t<Yfe?2:t<Jfe?3:t<Qfe?4:t<Xfe?5:t<ehe?6:t<the?7:t<rhe?8:t<nhe?9:10},ihe={encode:zfe,decode:Gfe,encodingLength:she},xH=ihe;const y6=(t,e,r=0)=>(xH.encode(t,e,r),e),b6=t=>xH.encodingLength(t),MT=(t,e)=>{const r=e.byteLength,n=b6(t),s=n+b6(r),i=new Uint8Array(s+r);return y6(t,i,0),y6(r,i,n),i.set(e,s),new ohe(t,r,e,i)};class ohe{constructor(e,r,n,s){this.code=e,this.size=r,this.digest=n,this.bytes=s}}const RH=({name:t,code:e,encode:r})=>new ahe(t,e,r);class ahe{constructor(e,r,n){this.name=e,this.code=r,this.encode=n}digest(e){if(e instanceof Uint8Array){const r=this.encode(e);return r instanceof Uint8Array?MT(this.code,r):r.then(n=>MT(this.code,n))}else throw Error("Unknown type, must be binary type")}}const BH=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),che=RH({name:"sha2-256",code:18,encode:BH("SHA-256")}),uhe=RH({name:"sha2-512",code:19,encode:BH("SHA-512")});var lhe=Object.freeze({__proto__:null,sha256:che,sha512:uhe});const kH=0,dhe="identity",jH=TH,fhe=t=>MT(kH,jH(t)),hhe={code:kH,name:dhe,encode:jH,digest:fhe};var phe=Object.freeze({__proto__:null,identity:hhe});new TextEncoder,new TextDecoder;const w6={...afe,...ufe,...dfe,...hfe,...mfe,...Sfe,...Ofe,...Rfe,...Ufe,...qfe};({...lhe,...phe});function DH(t){return globalThis.Buffer!=null?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t}function ghe(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?DH(globalThis.Buffer.allocUnsafe(t)):new Uint8Array(t)}function UH(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}const E6=UH("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),AI=UH("ascii","a",t=>{let e="a";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return e},t=>{t=t.substring(1);const e=ghe(t.length);for(let r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return e}),mhe={utf8:E6,"utf-8":E6,hex:w6.base16,latin1:AI,ascii:AI,binary:AI,...w6};function yhe(t,e="utf8"){const r=mhe[e];if(!r)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?DH(globalThis.Buffer.from(t,"utf-8")):r.decoder.decode(`${r.prefix}${t}`)}var bhe=Object.defineProperty,whe=(t,e,r)=>e in t?bhe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,uo=(t,e,r)=>whe(t,typeof e!="symbol"?e+"":e,r);class Ehe{constructor(e,r){this.core=e,this.logger=r,uo(this,"keychain",new Map),uo(this,"name",wde),uo(this,"version",Ede),uo(this,"initialized",!1),uo(this,"storagePrefix",Wo),uo(this,"init",async()=>{if(!this.initialized){const n=await this.getKeyChain();typeof n<"u"&&(this.keychain=n),this.initialized=!0}}),uo(this,"has",n=>(this.isInitialized(),this.keychain.has(n))),uo(this,"set",async(n,s)=>{this.isInitialized(),this.keychain.set(n,s),await this.persist()}),uo(this,"get",n=>{this.isInitialized();const s=this.keychain.get(n);if(typeof s>"u"){const{message:i}=_e("NO_MATCHING_KEY",`${this.name}: ${n}`);throw new Error(i)}return s}),uo(this,"del",async n=>{this.isInitialized(),this.keychain.delete(n),await this.persist()}),this.core=e,this.logger=_s(r,this.name)}get context(){return vs(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(e){await this.core.storage.setItem(this.storageKey,vT(e))}async getKeyChain(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?_T(e):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){const{message:e}=_e("NOT_INITIALIZED",this.name);throw new Error(e)}}}var vhe=Object.defineProperty,_he=(t,e,r)=>e in t?vhe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Fr=(t,e,r)=>_he(t,typeof e!="symbol"?e+"":e,r);class Ahe{constructor(e,r,n){this.core=e,this.logger=r,Fr(this,"name",yde),Fr(this,"keychain"),Fr(this,"randomSessionIdentifier",BT()),Fr(this,"initialized",!1),Fr(this,"clientId"),Fr(this,"init",async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)}),Fr(this,"hasKeys",s=>(this.isInitialized(),this.keychain.has(s))),Fr(this,"getClientId",async()=>{if(this.isInitialized(),this.clientId)return this.clientId;const s=await this.getClientSeed(),i=HR(s),o=jF(i.publicKey);return this.clientId=o,o}),Fr(this,"generateKeyPair",()=>{this.isInitialized();const s=Oue();return this.setPrivateKey(s.publicKey,s.privateKey)}),Fr(this,"signJWT",async s=>{this.isInitialized();const i=await this.getClientSeed(),o=HR(i),a=this.randomSessionIdentifier;return await Cne(a,s,bde,o)}),Fr(this,"generateSharedKey",(s,i,o)=>{this.isInitialized();const a=this.getPrivateKey(s),c=Nue(a,i);return this.setSymKey(c,o)}),Fr(this,"setSymKey",async(s,i)=>{this.isInitialized();const o=i||f_(s);return await this.keychain.set(o,s),o}),Fr(this,"deleteKeyPair",async s=>{this.isInitialized(),await this.keychain.del(s)}),Fr(this,"deleteSymKey",async s=>{this.isInitialized(),await this.keychain.del(s)}),Fr(this,"encode",async(s,i,o)=>{this.isInitialized();const a=hH(o),c=Rd(i);if(WB(a))return Bue(c,o==null?void 0:o.encoding);if(zB(a)){const f=a.senderPublicKey,g=a.receiverPublicKey;s=await this.generateSharedKey(f,g)}const u=this.getSymKey(s),{type:l,senderPublicKey:d}=a;return xue({type:l,symKey:u,message:c,senderPublicKey:d,encoding:o==null?void 0:o.encoding})}),Fr(this,"decode",async(s,i,o)=>{this.isInitialized();const a=jue(i,o);if(WB(a)){const c=kue(i,o==null?void 0:o.encoding);return xd(c)}if(zB(a)){const c=a.receiverPublicKey,u=a.senderPublicKey;s=await this.generateSharedKey(c,u)}try{const c=this.getSymKey(s),u=Rue({symKey:c,encoded:i,encoding:o==null?void 0:o.encoding});return xd(u)}catch(c){this.logger.error(`Failed to decode message from topic: '${s}', clientId: '${await this.getClientId()}'`),this.logger.error(c)}}),Fr(this,"getPayloadType",(s,i=ps)=>{const o=xy({encoded:s,encoding:i});return kd(o.type)}),Fr(this,"getPayloadSenderPublicKey",(s,i=ps)=>{const o=xy({encoded:s,encoding:i});return o.senderPublicKey?ws(o.senderPublicKey,Yn):void 0}),this.core=e,this.logger=_s(r,this.name),this.keychain=n||new Ehe(this.core,this.logger)}get context(){return vs(this.logger)}async setPrivateKey(e,r){return await this.keychain.set(e,r),e}getPrivateKey(e){return this.keychain.get(e)}async getClientSeed(){let e="";try{e=this.keychain.get(h6)}catch{e=BT(),await this.keychain.set(h6,e)}return yhe(e,"base16")}getSymKey(e){return this.keychain.get(e)}isInitialized(){if(!this.initialized){const{message:e}=_e("NOT_INITIALIZED",this.name);throw new Error(e)}}}var Che=Object.defineProperty,Ihe=Object.defineProperties,She=Object.getOwnPropertyDescriptors,v6=Object.getOwnPropertySymbols,The=Object.prototype.hasOwnProperty,Phe=Object.prototype.propertyIsEnumerable,$T=(t,e,r)=>e in t?Che(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Ohe=(t,e)=>{for(var r in e||(e={}))The.call(e,r)&&$T(t,r,e[r]);if(v6)for(var r of v6(e))Phe.call(e,r)&&$T(t,r,e[r]);return t},Nhe=(t,e)=>Ihe(t,She(e)),Ps=(t,e,r)=>$T(t,typeof e!="symbol"?e+"":e,r);class xhe extends _ee{constructor(e,r){super(e,r),this.logger=e,this.core=r,Ps(this,"messages",new Map),Ps(this,"messagesWithoutClientAck",new Map),Ps(this,"name",vde),Ps(this,"version",_de),Ps(this,"initialized",!1),Ps(this,"storagePrefix",Wo),Ps(this,"init",async()=>{if(!this.initialized){this.logger.trace("Initialized");try{const n=await this.getRelayerMessages();typeof n<"u"&&(this.messages=n);const s=await this.getRelayerMessagesWithoutClientAck();typeof s<"u"&&(this.messagesWithoutClientAck=s),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(n){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(n)}finally{this.initialized=!0}}}),Ps(this,"set",async(n,s,i)=>{this.isInitialized();const o=ui(s);let a=this.messages.get(n);if(typeof a>"u"&&(a={}),typeof a[o]<"u")return o;if(a[o]=s,this.messages.set(n,a),i===h_.inbound){const c=this.messagesWithoutClientAck.get(n)||{};this.messagesWithoutClientAck.set(n,Nhe(Ohe({},c),{[o]:s}))}return await this.persist(),o}),Ps(this,"get",n=>{this.isInitialized();let s=this.messages.get(n);return typeof s>"u"&&(s={}),s}),Ps(this,"getWithoutAck",n=>{this.isInitialized();const s={};for(const i of n){const o=this.messagesWithoutClientAck.get(i)||{};s[i]=Object.values(o)}return s}),Ps(this,"has",(n,s)=>{this.isInitialized();const i=this.get(n),o=ui(s);return typeof i[o]<"u"}),Ps(this,"ack",async(n,s)=>{this.isInitialized();const i=this.messagesWithoutClientAck.get(n);if(typeof i>"u")return;const o=ui(s);delete i[o],Object.keys(i).length===0?this.messagesWithoutClientAck.delete(n):this.messagesWithoutClientAck.set(n,i),await this.persist()}),Ps(this,"del",async n=>{this.isInitialized(),this.messages.delete(n),this.messagesWithoutClientAck.delete(n),await this.persist()}),this.logger=_s(e,this.name),this.core=r}get context(){return vs(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get storageKeyWithoutClientAck(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name+"_withoutClientAck"}async setRelayerMessages(e){await this.core.storage.setItem(this.storageKey,vT(e))}async setRelayerMessagesWithoutClientAck(e){await this.core.storage.setItem(this.storageKeyWithoutClientAck,vT(e))}async getRelayerMessages(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?_T(e):void 0}async getRelayerMessagesWithoutClientAck(){const e=await this.core.storage.getItem(this.storageKeyWithoutClientAck);return typeof e<"u"?_T(e):void 0}async persist(){await this.setRelayerMessages(this.messages),await this.setRelayerMessagesWithoutClientAck(this.messagesWithoutClientAck)}isInitialized(){if(!this.initialized){const{message:e}=_e("NOT_INITIALIZED",this.name);throw new Error(e)}}}var Rhe=Object.defineProperty,Bhe=Object.defineProperties,khe=Object.getOwnPropertyDescriptors,_6=Object.getOwnPropertySymbols,jhe=Object.prototype.hasOwnProperty,Dhe=Object.prototype.propertyIsEnumerable,LT=(t,e,r)=>e in t?Rhe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,hf=(t,e)=>{for(var r in e||(e={}))jhe.call(e,r)&&LT(t,r,e[r]);if(_6)for(var r of _6(e))Dhe.call(e,r)&&LT(t,r,e[r]);return t},A6=(t,e)=>Bhe(t,khe(e)),Qs=(t,e,r)=>LT(t,typeof e!="symbol"?e+"":e,r);class Uhe extends Aee{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,Qs(this,"events",new gi.EventEmitter),Qs(this,"name",Cde),Qs(this,"queue",new Map),Qs(this,"publishTimeout",ye.toMiliseconds(ye.ONE_MINUTE)),Qs(this,"initialPublishTimeout",ye.toMiliseconds(ye.ONE_SECOND*15)),Qs(this,"needsTransportRestart",!1),Qs(this,"publish",async(n,s,i)=>{var o,a,c,u,l;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:n,message:s,opts:i}});const d=(i==null?void 0:i.ttl)||Ade,f=(i==null?void 0:i.prompt)||!1,g=(i==null?void 0:i.tag)||0,h=(i==null?void 0:i.id)||_u(
35).toString(),p=Kf(rA().protocol),y={id:h,method:(i==null?void 0:i.publishMethod)||p.publish,params:hf({topic:n,message:s,ttl:d,prompt:f,tag:g,attestation:i==null?void 0:i.attestation},i==null?void 0:i.tvf)},w=`Failed to publish payload, please try again. id:${h} tag:${g}`;try{Gr((o=y.params)==null?void 0:o.prompt)&&((a=y.params)==null||delete a.prompt),Gr((c=y.params)==null?void 0:c.tag)&&((u=y.params)==null||delete u.tag);const I=new Promise(async v=>{const E=({id:m})=>{var _;((_=y.id)==null?void 0:_.toString())===m.toString()&&(this.removeRequestFromQueue(m),this.relayer.events.removeListener(_r.publish,E),v())};this.relayer.events.on(_r.publish,E);const b=ko(new Promise((m,_)=>{this.rpcPublish(y,i).then(m).catch(O=>{this.logger.warn(O,O==null?void 0:O.message),_(O)})}),this.initialPublishTimeout,`Failed initial publish, retrying.... id:${h} tag:${g}`);try{await b,this.events.removeListener(_r.publish,E)}catch(m){this.queue.set(h,{request:y,opts:i,attempt:1}),this.logger.warn(m,m==null?void 0:m.message)}});this.logger.trace({type:"method",method:"publish",params:{id:h,topic:n,message:s,opts:i}}),await ko(I,this.publishTimeout,w)}catch(I){if(this.logger.debug("Failed to Publish Payload"),this.logger.error(I),(l=i==null?void 0:i.internal)!=null&&l.throwOnFailedPublish)throw I}finally{this.queue.delete(h)}}),Qs(this,"publishCustom",async n=>{var s,i,o,a,c;this.logger.debug("Publishing custom payload"),this.logger.trace({type:"method",method:"publishCustom",params:n});const{payload:u,opts:l={}}=n,{attestation:d,tvf:f,publishMethod:g,prompt:h,tag:p,ttl:y=ye.FIVE_MINUTES}=l,w=l.id||_u().toString(),I=Kf(rA().protocol),v=g||I.publish,E={id:w,method:v,params:hf(A6(hf({},u),{ttl:y,prompt:h,tag:p,attestation:d}),f)},b=`Failed to publish custom payload, please try again. id:${w} tag:${p}`;try{Gr((s=E.params)==null?void 0:s.prompt)&&((i=E.params)==null||delete i.prompt),Gr((o=E.params)==null?void 0:o.tag)&&((a=E.params)==null||delete a.tag);const m=new Promise(async _=>{const O=({id:S})=>{var T;((T=E.id)==null?void 0:T.toString())===S.toString()&&(this.removeRequestFromQueue(S),this.relayer.events.removeListener(_r.publish,O),_())};this.relayer.events.on(_r.publish,O);const C=ko(new Promise((S,T)=>{this.rpcPublish(E,l).then(S).catch(N=>{this.logger.warn(N,N==null?void 0:N.message),T(N)})}),this.initialPublishTimeout,`Failed initial custom payload publish, retrying.... method:${v} id:${w} tag:${p}`);try{await C,this.events.removeListener(_r.publish,O)}catch(S){this.queue.set(w,{request:E,opts:l,attempt:1}),this.logger.warn(S,S==null?void 0:S.message)}});this.logger.trace({type:"method",method:"publish",params:{id:w,payload:u,opts:l}}),await ko(m,this.publishTimeout,b)}catch(m){if(this.logger.debug("Failed to Publish Payload"),this.logger.error(m),(c=l==null?void 0:l.internal)!=null&&c.throwOnFailedPublish)throw m}finally{this.queue.delete(w)}}),Qs(this,"on",(n,s)=>{this.events.on(n,s)}),Qs(this,"once",(n,s)=>{this.events.once(n,s)}),Qs(this,"off",(n,s)=>{this.events.off(n,s)}),Qs(this,"removeListener",(n,s)=>{this.events.removeListener(n,s)}),this.relayer=e,this.logger=_s(r,this.name),this.registerEventListeners()}get context(){return vs(this.logger)}async rpcPublish(e,r){this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:e});const n=await this.relayer.request(e);return this.relayer.events.emit(_r.publish,hf(hf({},e),r)),this.logger.debug("Successfully Published Payload"),n}removeRequestFromQueue(e){this.queue.delete(e)}checkQueue(){this.queue.forEach(async(e,r)=>{var n;const s=e.attempt+1;this.queue.set(r,A6(hf({},e),{attempt:s})),this.logger.warn({},`Publisher: queue->publishing: ${e.request.id}, tag: ${(n=e.request.params)==null?void 0:n.tag}, attempt: ${s}`),await this.rpcPublish(e.request,e.opts),this.logger.warn({},`Publisher: queue->published: ${e.request.id}`)})}registerEventListeners(){this.relayer.core.heartbeat.on(Gd.pulse,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit(_r.connection_stalled);return}this.checkQueue()}),this.relayer.on(_r.message_ack,e=>{this.removeRequestFromQueue(e.id.toString())})}}var Mhe=Object.defineProperty,$he=(t,e,r)=>e in t?Mhe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,pf=(t,e,r)=>$he(t,typeof e!="symbol"?e+"":e,r);class Lhe{constructor(){pf(this,"map",new Map),pf(this,"set",(e,r)=>{const n=this.get(e);this.exists(e,r)||this.map.set(e,[...n,r])}),pf(this,"get",e=>this.map.get(e)||[]),pf(this,"exists",(e,r)=>this.get(e).includes(r)),pf(this,"delete",(e,r)=>{if(typeof r>"u"){this.map.delete(e);return}if(!this.map.has(e))return;const n=this.get(e);if(!this.exists(e,r))return;const s=n.filter(i=>i!==r);if(!s.length){this.map.delete(e);return}this.map.set(e,s)}),pf(this,"clear",()=>{this.map.clear()})}
vendor: 14,601 bytes, line 35
35get topics(){return Array.from(this.map.keys())}}var Fhe=Object.defineProperty,Hhe=Object.defineProperties,qhe=Object.getOwnPropertyDescriptors,C6=Object.getOwnPropertySymbols,zhe=Object.prototype.hasOwnProperty,Whe=Object.prototype.propertyIsEnumerable,FT=(t,e,r)=>e in t?Fhe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ig=(t,e)=>{for(var r in e||(e={}))zhe.call(e,r)&&FT(t,r,e[r]);if(C6)for(var r of C6(e))Whe.call(e,r)&&FT(t,r,e[r]);return t},CI=(t,e)=>Hhe(t,qhe(e)),Lt=(t,e,r)=>FT(t,typeof e!="symbol"?e+"":e,r);class Vhe extends See{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,Lt(this,"subscriptions",new Map),Lt(this,"topicMap",new Lhe),Lt(this,"events",new gi.EventEmitter),Lt(this,"name",xde),Lt(this,"version",Rde),Lt(this,"pending",new Map),Lt(this,"cached",[]),Lt(this,"initialized",!1),Lt(this,"storagePrefix",Wo),Lt(this,"subscribeTimeout",ye.toMiliseconds(ye.ONE_MINUTE)),Lt(this,"initialSubscribeTimeout",ye.toMiliseconds(ye.ONE_SECOND*15)),Lt(this,"clientId"),Lt(this,"batchSubscribeTopicsLimit",500),Lt(this,"init",async()=>{this.initialized||(this.logger.trace("Initialized"),this.registerEventListeners(),await this.restore()),this.initialized=!0}),Lt(this,"subscribe",async(n,s)=>{var i;this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:s}});try{const o=rA(s),a={topic:n,relay:o,transportType:s==null?void 0:s.transportType};(i=s==null?void 0:s.internal)!=null&&i.skipSubscribe||this.pending.set(n,a);const c=await this.rpcSubscribe(n,o,s);return typeof c=="string"&&(this.onSubscribe(c,a),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:s}})),c}catch(o){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(o),o}}),Lt(this,"unsubscribe",async(n,s)=>{this.isInitialized(),typeof(s==null?void 0:s.id)<"u"?await this.unsubscribeById(n,s.id,s):await this.unsubscribeByTopic(n,s)}),Lt(this,"isSubscribed",n=>new Promise(s=>{s(this.topicMap.topics.includes(n))})),Lt(this,"isKnownTopic",n=>new Promise(s=>{s(this.topicMap.topics.includes(n)||this.pending.has(n)||this.cached.some(i=>i.topic===n))})),Lt(this,"on",(n,s)=>{this.events.on(n,s)}),Lt(this,"once",(n,s)=>{this.events.once(n,s)}),Lt(this,"off",(n,s)=>{this.events.off(n,s)}),Lt(this,"removeListener",(n,s)=>{this.events.removeListener(n,s)}),Lt(this,"start",async()=>{await this.onConnect()}),Lt(this,"stop",async()=>{await this.onDisconnect()}),Lt(this,"restart",async()=>{await this.restore(),await this.onRestart()}),Lt(this,"checkPending",async()=>{if(this.pending.size===0&&(!this.initialized||!this.relayer.connected))return;const n=[];this.pending.forEach(s=>{n.push(s)}),await this.batchSubscribe(n)}),Lt(this,"registerEventListeners",()=>{this.relayer.core.heartbeat.on(Gd.pulse,async()=>{await this.checkPending()}),this.events.on(ks.created,async n=>{const s=ks.created;this.logger.info(`Emitting ${s}`),this.logger.debug({type:"event",event:s,data:n}),await this.persist()}),this.events.on(ks.deleted,async n=>{const s=ks.deleted;this.logger.info(`Emitting ${s}`),this.logger.debug({type:"event",event:s,data:n}),await this.persist()})}),this.relayer=e,this.logger=_s(r,this.name),this.clientId=""}get context(){return vs(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.relayer.core.customStoragePrefix+"//"+this.name}get length(){return this.subscriptions.size}get ids(){return Array.from(this.subscriptions.keys())}get values(){return Array.from(this.subscriptions.values())}get topics(){return this.topicMap.topics}get hasAnyTopics(){return this.topicMap.topics.length>0||this.pending.size>0||this.cached.length>0||this.subscriptions.size>0}hasSubscription(e,r){let n=!1;try{n=this.getSubscription(e).topic===r}catch{}return n}reset(){this.cached=[],this.initialized=!0}onDisable(){this.values.length>0&&(this.cached=this.values),this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(e,r){const n=this.topicMap.get(e);await Promise.all(n.map(async s=>await this.unsubscribeById(e,s,r)))}async unsubscribeById(e,r,n){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:r,opts:n}});try{const s=rA(n);await this.restartToComplete({topic:e,id:r,relay:s}),await this.rpcUnsubscribe(e,r,s);const i=ar("USER_DISCONNECTED",`${this.name}, ${e}`);await this.onUnsubscribe(e,r,i),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:r,opts:n}})}catch(s){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(s),s}}async rpcSubscribe(e,r,n){var s,i;const o=await this.getSubscriptionId(e);if((s=n==null?void 0:n.internal)!=null&&s.skipSubscribe)return o;(!n||(n==null?void 0:n.transportType)===er.relay)&&await this.restartToComplete({topic:e,id:e,relay:r});const a={method:Kf(r.protocol).subscribe,params:{topic:e}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:a});const c=(i=n==null?void 0:n.internal)==null?void 0:i.throwOnFailedPublish;try{if((n==null?void 0:n.transportType)===er.link_mode)return setTimeout(()=>{(this.relayer.connected||this.relayer.connecting)&&this.relayer.request(a).catch(d=>this.logger.warn(d))},ye.toMiliseconds(ye.ONE_SECOND)),o;const u=new Promise(async d=>{const f=g=>{g.topic===e&&(this.events.removeListener(ks.created,f),d(g.id))};this.events.on(ks.created,f);try{const g=await ko(new Promise((h,p)=>{this.relayer.request(a).catch(y=>{this.logger.warn(y,y==null?void 0:y.message),p(y)}).then(h)}),this.initialSubscribeTimeout,`Subscribing to ${e} failed, please try again`);this.events.removeListener(ks.created,f),d(g)}catch{}}),l=await ko(u,this.subscribeTimeout,`Subscribing to ${e} failed, please try again`);if(!l&&c)throw new Error(`Subscribing to ${e} failed, please try again`);return l?o:null}catch(u){if(this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(_r.connection_stalled),c)throw u}return null}async rpcBatchSubscribe(e){if(!e.length)return!0;const r=e[0].relay,n={method:Kf(r.protocol).batchSubscribe,params:{topics:e.map(s=>s.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});try{return await ko(new Promise((s,i)=>{this.relayer.request(n).then(s).catch(o=>{this.logger.warn(o),i(o)})}),this.subscribeTimeout,"rpcBatchSubscribe failed, please try again"),!0}catch{return this.relayer.events.emit(_r.connection_stalled),!1}}async rpcBatchFetchMessages(e){if(!e.length)return;const r=e[0].relay,n={method:Kf(r.protocol).batchFetchMessages,params:{topics:e.map(i=>i.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});let s;try{s=await await ko(new Promise((i,o)=>{this.relayer.request(n).catch(a=>{this.logger.warn(a),o(a)}).then(i)}),this.subscribeTimeout,"rpcBatchFetchMessages failed, please try again")}catch{this.relayer.events.emit(_r.connection_stalled)}return s}rpcUnsubscribe(e,r,n){const s={method:Kf(n.protocol).unsubscribe,params:{topic:e,id:r}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:s}),this.relayer.request(s)}onSubscribe(e,r){this.setSubscription(e,CI(ig({},r),{id:e})),this.pending.delete(r.topic)}onBatchSubscribe(e){e.length&&e.forEach(r=>{this.setSubscription(r.id,ig({},r)),this.pending.delete(r.topic)})}async onUnsubscribe(e,r,n){this.events.removeAllListeners(r),this.hasSubscription(r,e)&&this.deleteSubscription(r,n),await this.relayer.messages.del(e)}async setRelayerSubscriptions(e){await this.relayer.core.storage.setItem(this.storageKey,e)}async getRelayerSubscriptions(){return await this.relayer.core.storage.getItem(this.storageKey)}setSubscription(e,r){this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:e,subscription:r}),this.addSubscription(e,r)}addSubscription(e,r){this.subscriptions.set(e,ig({},r)),this.topicMap.set(r.topic,e),this.events.emit(ks.created,r)}getSubscription(e){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:e});const r=this.subscriptions.get(e);if(!r){const{message:n}=_e("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return r}deleteSubscription(e,r){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:e,reason:r});const n=this.getSubscription(e);this.subscriptions.delete(e),this.topicMap.delete(n.topic,e),this.events.emit(ks.deleted,CI(ig({},n),{reason:r}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(ks.sync)}async onRestart(){if(this.cached.length){const e=[...this.cached],r=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let n=0;n<r;n++){const s=e.splice(0,this.batchSubscribeTopicsLimit);await this.batchSubscribe(s)}}this.events.emit(ks.resubscribed)}async restore(){try{const e=await this.getRelayerSubscriptions();if(typeof e>"u"||!e.length)return;if(this.subscriptions.size&&!e.every(r=>{var n;return r.topic===((n=this.subscriptions.get(r.id))==null?void 0:n.topic)})){const{message:r}=_e("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:"method",method:"restore",subscriptions:this.values})}catch(e){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(e)}}async batchSubscribe(e){if(e.length){if(!await this.rpcBatchSubscribe(e)){this.logger.warn(`Batch subscribe failed for ${e.length} topics, adding to pending for retry`),e.forEach(r=>{this.pending.set(r.topic,r)});return}this.onBatchSubscribe(await Promise.all(e.map(async r=>CI(ig({},r),{id:await this.getSubscriptionId(r.topic)}))))}}async batchFetchMessages(e){if(!e.length)return;this.logger.trace(`Fetching batch messages for ${e.length} subscriptions`);const r=await this.rpcBatchFetchMessages(e);r&&r.messages&&(await Zoe(ye.toMiliseconds(ye.ONE_SECOND)),await this.relayer.handleBatchMessageEvents(r.messages))}async onConnect(){await this.restart(),this.reset()}onDisconnect(){this.onDisable()}isInitialized(){if(!this.initialized){const{message:e}=_e("NOT_INITIALIZED",this.name);throw new Error(e)}}async restartToComplete(e){!this.relayer.connected&&!this.relayer.connecting&&(this.cached.push(e),await this.relayer.transportOpen())}async getClientId(){return this.clientId||(this.clientId=await this.relayer.core.crypto.getClientId()),this.clientId}async getSubscriptionId(e){return ui(e+await this.getClientId())}}var Ghe=Object.defineProperty,I6=Object.getOwnPropertySymbols,Khe=Object.prototype.hasOwnProperty,Zhe=Object.prototype.propertyIsEnumerable,HT=(t,e,r)=>e in t?Ghe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,S6=(t,e)=>{for(var r in e||(e={}))Khe.call(e,r)&&HT(t,r,e[r]);if(I6)for(var r of I6(e))Zhe.call(e,r)&&HT(t,r,e[r]);return t},ht=(t,e,r)=>HT(t,typeof e!="symbol"?e+"":e,r);class Yhe extends Cee{constructor(e){var r;super(e),ht(this,"protocol","wc"),ht(this,"version",2),ht(this,"core"),ht(this,"logger"),ht(this,"events",new gi.EventEmitter),ht(this,"provider"),ht(this,"messages"),ht(this,"subscriber"),ht(this,"publisher"),ht(this,"name",Sde),ht(this,"transportExplicitlyClosed",!1),ht(this,"initialized",!1),ht(this,"connectionAttemptInProgress",!1),ht(this,"relayUrl"),ht(this,"projectId"),ht(this,"packageName"),ht(this,"bundleId"),ht(this,"hasExperiencedNetworkDisruption",!1),ht(this,"pingTimeout"),ht(this,"heartBeatTimeout",ye.toMiliseconds(ye.THIRTY_SECONDS+ye.FIVE_SECONDS)),ht(this,"reconnectTimeout"),ht(this,"connectPromise"),ht(this,"reconnectInProgress",!1),ht(this,"requestsInFlight",[]),ht(this,"connectTimeout",ye.toMiliseconds(ye.ONE_SECOND*15)),ht(this,"stalledRestartInProgress",!1),ht(this,"stalledRestartTimeout"),ht(this,"stalledRestartBackoff",0),ht(this,"stalledRestartBaseInterval",ye.toMiliseconds(ye.ONE_SECOND*2)),ht(this,"stalledRestartMaxInterval",ye.toMiliseconds(ye.THIRTY_SECONDS)),ht(this,"request",async n=>{var s,i;this.logger.debug("Publishing Request Payload");const o=n.id||_u().toString();await this.toEstablishConnection();try{this.logger.trace({id:o,method:n.method,topic:(s=n.params)==null?void 0:s.topic},"relayer.request - publishing...");const a=`${o}:${((i=n.params)==null?void 0:i.tag)||""}`;this.requestsInFlight.push(a);const c=await this.provider.request(n);return this.requestsInFlight=this.requestsInFlight.filter(u=>u!==a),c}catch(a){throw this.logger.debug(`Failed to Publish Request: ${o}`),a}}),ht(this,"resetPingTimeout",()=>{Y_()&&(clearTimeout(this.pingTimeout),this.pingTimeout=setTimeout(()=>{var n,s,i,o;try{this.logger.debug({},"pingTimeout: Connection stalled, terminating..."),(o=(i=(s=(n=this.provider)==null?void 0:n.connection)==null?void 0:s.socket)==null?void 0:i.terminate)==null||o.call(i)}catch(a){this.logger.warn(a,a==null?void 0:a.message)}},this.heartBeatTimeout))}),ht(this,"onPayloadHandler",n=>{this.onProviderPayload(n),this.resetPingTimeout()}),ht(this,"onConnectHandler",()=>{this.logger.warn({},"Relayer connected 🛜"),this.startPingTimeout(),this.events.emit(_r.connect)}),ht(this,"onDisconnectHandler",()=>{this.logger.warn({},"Relayer disconnected 🛑"),this.requestsInFlight=[],this.onProviderDisconnect()}),ht(this,"onProviderErrorHandler",n=>{this.logger.fatal(`Fatal socket error: ${n.message}`),this.events.emit(_r.error,n),this.logger.fatal("Fatal socket error received, closing transport"),this.transportExplicitlyClosed=!0,clearTimeout(this.reconnectTimeout),this.reconnectTimeout=void 0,this.reconnectInProgress=!1,this.transportClose().catch(s=>this.logger.warn(s))}),ht(this,"registerProviderListeners",()=>{this.provider.on(Js.payload,this.onPayloadHandler),this.provider.on(Js.connect,this.onConnectHandler),this.provider.on(Js.disconnect,this.onDisconnectHandler),this.provider.on(Js.error,this.onProviderErrorHandler)}),this.core=e.core,this.logger=_O({logger:(r=e.logger)!=null?r:Ide,name:this.name}),this.messages=new xhe(this.logger,e.core),this.subscriber=new Vhe(this,this.logger),this.publisher=new Uhe(this,this.logger),this.projectId=e==null?void 0:e.projectId,this.relayUrl=(e==null?void 0:e.relayUrl)||IH,Boe()?this.packageName=fB():koe()&&(this.bundleId=fB()),this.provider={}}
35async init(){this.logger.trace("Initialized"),this.registerEventListeners(),await Promise.all([this.messages.init(),this.subscriber.init()]),this.initialized=!0,this.transportOpen().catch(e=>this.logger.warn(e,e==null?void 0:e.message))}get context(){return vs(this.logger)}get connected(){var e,r,n;return((n=(r=(e=this.provider)==null?void 0:e.connection)==null?void 0:r.socket)==null?void 0:n.readyState)===1||!1}get connecting(){var e,r,n;return((n=(r=(e=this.provider)==null?void 0:e.connection)==null?void 0:r.socket)==null?void 0:n.readyState)===0||this.connectPromise!==void 0||!1}async publish(e,r,n){this.isInitialized(),await this.publisher.publish(e,r,n),await this.recordMessageEvent({topic:e,message:r,publishedAt:Date.now(),transportType:er.relay},h_.outbound)}async publishCustom(e){this.isInitialized(),await this.publisher.publishCustom(e)}async subscribe(e,r){var n,s,i;this.isInitialized(),(!(r!=null&&r.transportType)||(r==null?void 0:r.transportType)==="relay")&&await this.toEstablishConnection();const o=typeof((n=r==null?void 0:r.internal)==null?void 0:n.throwOnFailedPublish)>"u"?!0:(s=r==null?void 0:r.internal)==null?void 0:s.throwOnFailedPublish;let a=((i=this.subscriber.topicMap.get(e))==null?void 0:i[0])||"",c;const u=l=>{l.topic===e&&(this.subscriber.off(ks.created,u),c())};return await Promise.all([new Promise(l=>{c=l,this.subscriber.on(ks.created,u)}),new Promise(async(l,d)=>{a=await this.subscriber.subscribe(e,S6({internal:{throwOnFailedPublish:o}},r)).catch(f=>{o&&d(f)})||a,l()})]),a}async unsubscribe(e,r){this.isInitialized(),await this.subscriber.unsubscribe(e,r)}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async transportDisconnect(){this.provider.disconnect&&(this.hasExperiencedNetworkDisruption||this.connected)?await ko(this.provider.disconnect(),2e3,"provider.disconnect()").catch(()=>this.onProviderDisconnect()):this.onProviderDisconnect()}async transportClose(){this.transportExplicitlyClosed=!0,clearTimeout(this.stalledRestartTimeout),this.stalledRestartInProgress=!1,this.stalledRestartBackoff=0,await this.resetTransport()}async transportOpen(e){if(!this.subscriber.hasAnyTopics){this.logger.info("Starting WS connection skipped because the client has no topics to work with.");return}if(this.connectPromise?(this.logger.debug({},"Waiting for existing connection attempt to resolve..."),await this.connectPromise,this.logger.debug({},"Existing connection attempt resolved")):(this.connectPromise=new Promise(async(r,n)=>{await this.connect(e).then(r).catch(n).finally(()=>{this.connectPromise=void 0})}),await this.connectPromise),!this.connected)throw new Error(`Couldn't establish socket connection to the relay server: ${this.relayUrl}`)}async restartTransport(e){this.logger.debug({},"Restarting transport..."),!this.connectionAttemptInProgress&&(this.relayUrl=e||this.relayUrl,await this.confirmOnlineStateOrThrow(),await this.resetTransport(),await this.transportOpen())}async resetTransport(){this.reconnectInProgress=!0,clearTimeout(this.reconnectTimeout),this.reconnectTimeout=void 0,await this.transportDisconnect(),await this.subscriber.stop(),this.reconnectInProgress=!1}async confirmOnlineStateOrThrow(){if(!await s6())throw new Error("No internet connection detected. Please restart your network and try again.")}async handleBatchMessageEvents(e){if((e==null?void 0:e.length)===0){this.logger.trace("Batch message events is empty. Ignoring...");return}const r=e.sort((n,s)=>n.publishedAt-s.publishedAt);this.logger.debug(`Batch of ${r.length} message events sorted`);for(const n of r)try{await this.onMessageEvent(n)}catch(s){this.logger.warn(s,"Error while processing batch message event: "+(s==null?void 0:s.message))}this.logger.trace(`Batch of ${r.length} message events processed`)}async onLinkMessageEvent(e,r){const{topic:n}=e;if(!r.sessionExists){const s=Nr(ye.FIVE_MINUTES),i={topic:n,expiry:s,relay:{protocol:"irn"},active:!1};await this.core.pairing.pairings.set(n,i)}this.events.emit(_r.message,e),await this.recordMessageEvent(e,h_.inbound)}async connect(e){await this.confirmOnlineStateOrThrow(),e&&e!==this.relayUrl&&(this.relayUrl=e,await this.transportDisconnect()),this.connectionAttemptInProgress=!0,this.transportExplicitlyClosed=!1;let r=1;for(;r<6;){try{if(this.transportExplicitlyClosed)break;this.logger.debug({},`Connecting to ${this.relayUrl}, attempt: ${r}...`),await this.createProvider(),await new Promise(async(n,s)=>{const i=()=>
vendor: 21,619 bytes, line 35
35{s(new Error("Connection interrupted while trying to connect"))};this.provider.once(Js.disconnect,i),await ko(new Promise((o,a)=>{this.provider.connect().then(o).catch(a)}),this.connectTimeout,`Socket stalled when trying to connect to ${this.relayUrl}`).catch(o=>{s(o)}).finally(()=>{this.provider.off(Js.disconnect,i),clearTimeout(this.reconnectTimeout)}),await new Promise(async(o,a)=>{const c=()=>{s(new Error("Connection interrupted while trying to subscribe"))};this.provider.once(Js.disconnect,c),await this.subscriber.start().then(o).catch(a).finally(()=>{this.provider.off(Js.disconnect,c)})}),this.hasExperiencedNetworkDisruption=!1,n()})}catch(n){await this.subscriber.stop();const s=n;this.logger.warn({},s.message),this.hasExperiencedNetworkDisruption=!0}finally{this.connectionAttemptInProgress=!1}if(this.connected){this.logger.debug({},`Connected to ${this.relayUrl} successfully on attempt: ${r}`);break}await new Promise(n=>setTimeout(n,ye.toMiliseconds(r*1))),r++}}startPingTimeout(){var e,r,n,s,i;if(Y_())try{(r=(e=this.provider)==null?void 0:e.connection)!=null&&r.socket&&((i=(s=(n=this.provider)==null?void 0:n.connection)==null?void 0:s.socket)==null||i.on("ping",()=>{this.resetPingTimeout()})),this.resetPingTimeout()}catch(o){this.logger.warn(o,o==null?void 0:o.message)}}async createProvider(){this.provider.connection&&this.unregisterProviderListeners();const e=await this.core.crypto.signJWT(this.relayUrl);this.provider=new IO(new hde($oe({sdkVersion:DT,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:e,useOnCloseEvent:!0,bundleId:this.bundleId,packageName:this.packageName}))),this.registerProviderListeners()}async recordMessageEvent(e,r){const{topic:n,message:s}=e;await this.messages.set(n,s,r)}async shouldIgnoreMessageEvent(e){const{topic:r,message:n}=e;if(!n||n.length===0)return this.logger.warn(`Ignoring invalid/empty message: ${n}`),!0;if(!await this.subscriber.isKnownTopic(r))return this.logger.warn(`Ignoring message for unknown topic ${r}`),!0;const s=this.messages.has(r,n);return s&&this.logger.warn(`Ignoring duplicate message: ${n}`),s}async onProviderPayload(e){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:e}),CO(e)){if(!e.method.endsWith(Tde))return;const r=e.params,{topic:n,message:s,publishedAt:i,attestation:o}=r.data,a={topic:n,message:s,publishedAt:i,transportType:er.relay,attestation:o};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(S6({type:"event",event:r.id},a)),this.events.emit(r.id,a),await this.acknowledgePayload(e),await this.onMessageEvent(a)}else QA(e)&&this.events.emit(_r.message_ack,e)}async onMessageEvent(e){await this.shouldIgnoreMessageEvent(e)||(await this.recordMessageEvent(e,h_.inbound),this.events.emit(_r.message,e))}async acknowledgePayload(e){const r=Ry(e.id,!0);await this.provider.connection.send(r)}unregisterProviderListeners(){this.provider.off(Js.payload,this.onPayloadHandler),this.provider.off(Js.connect,this.onConnectHandler),this.provider.off(Js.disconnect,this.onDisconnectHandler),this.provider.off(Js.error,this.onProviderErrorHandler),clearTimeout(this.pingTimeout)}async registerEventListeners(){let e=await s6();Ble(async r=>{e!==r&&(e=r,r?await this.transportOpen().catch(n=>this.logger.error(n,n==null?void 0:n.message)):(this.hasExperiencedNetworkDisruption=!0,await this.transportDisconnect(),this.transportExplicitlyClosed=!1))}),this.core.heartbeat.on(Gd.pulse,async()=>{if(!this.transportExplicitlyClosed&&!this.connected&&Dle())try{await this.confirmOnlineStateOrThrow(),await this.transportOpen()}catch(r){this.logger.warn(r,r==null?void 0:r.message)}}),this.events.on(_r.connection_stalled,()=>{if(this.transportExplicitlyClosed||this.stalledRestartInProgress)return;this.stalledRestartInProgress=!0;const r=this.stalledRestartBackoff===0?0:Math.min(Math.pow(2,this.stalledRestartBackoff-1)*this.stalledRestartBaseInterval,this.stalledRestartMaxInterval);this.stalledRestartBackoff++,this.logger.warn(`Connection stalled, restarting transport${r?` in ${r}ms`:""}...`),this.stalledRestartTimeout=setTimeout(async()=>{try{if(this.transportExplicitlyClosed)return;await this.restartTransport()}catch(n){this.logger.error(n,n==null?void 0:n.message)}finally{this.stalledRestartInProgress=!1}},r)})}async onProviderDisconnect(){clearTimeout(this.pingTimeout),this.events.emit(_r.disconnect),this.connectionAttemptInProgress=!1,!this.reconnectInProgress&&(this.reconnectInProgress=!0,await this.subscriber.stop(),this.subscriber.hasAnyTopics&&(this.transportExplicitlyClosed||(this.reconnectTimeout=setTimeout(async()=>{await this.transportOpen().catch(e=>this.logger.error(e,e==null?void 0:e.message)),this.reconnectTimeout=void 0,this.reconnectInProgress=!1},ye.toMiliseconds(Pde)))))}isInitialized(){if(!this.initialized){const{message:e}=_e("NOT_INITIALIZED",this.name);throw new Error(e)}}async toEstablishConnection(){if(await this.confirmOnlineStateOrThrow(),!this.connected){if(this.connectPromise){await this.connectPromise;return}await this.connect()}}}function Jhe(t,e){return t===e||Number.isNaN(t)&&Number.isNaN(e)}function T6(t){return Object.getOwnPropertySymbols(t).filter(e=>Object.prototype.propertyIsEnumerable.call(t,e))}function P6(t){return t==null?t===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(t)}const Qhe="[object RegExp]",Xhe="[object String]",epe="[object Number]",tpe="[object Boolean]",O6="[object Arguments]",rpe="[object Symbol]",npe="[object Date]",spe="[object Map]",ipe="[object Set]",ope="[object Array]",ape="[object Function]",cpe="[object ArrayBuffer]",II="[object Object]",upe="[object Error]",lpe="[object DataView]",dpe="[object Uint8Array]",fpe="[object Uint8ClampedArray]",hpe="[object Uint16Array]",ppe="[object Uint32Array]",gpe="[object BigUint64Array]",mpe="[object Int8Array]",ype="[object Int16Array]",bpe="[object Int32Array]",wpe="[object BigInt64Array]",Epe="[object Float32Array]",vpe="[object Float64Array]";function N6(t){if(!t||typeof t!="object")return!1;const e=Object.getPrototypeOf(t);return e===null||e===Object.prototype||Object.getPrototypeOf(e)===null?Object.prototype.toString.call(t)==="[object Object]":!1}function _pe(t,e,r){return vm(t,e,void 0,void 0,void 0,void 0,r)}function vm(t,e,r,n,s,i,o){const a=o(t,e,r,n,s,i);if(a!==void 0)return a;if(typeof t==typeof e)switch(typeof t){case"bigint":case"string":case"boolean":case"symbol":case"undefined":return t===e;case"number":return t===e||Object.is(t,e);case"function":return t===e;case"object":return jm(t,e,i,o)}return jm(t,e,i,o)}function jm(t,e,r,n){if(Object.is(t,e))return!0;let s=P6(t),i=P6(e);if(s===O6&&(s=II),i===O6&&(i=II),s!==i)return!1;switch(s){case Xhe:return t.toString()===e.toString();case epe:{const c=t.valueOf(),u=e.valueOf();return Jhe(c,u)}case tpe:case npe:case rpe:return Object.is(t.valueOf(),e.valueOf());case Qhe:return t.source===e.source&&t.flags===e.flags;case ape:return t===e}r=r??new Map;const o=r.get(t),a=r.get(e);if(o!=null&&a!=null)return o===e;r.set(t,e),r.set(e,t);try{switch(s){case spe:{if(t.size!==e.size)return!1;for(const[c,u]of t.entries())if(!e.has(c)||!vm(u,e.get(c),c,t,e,r,n))return!1;return!0}case ipe:{if(t.size!==e.size)return!1;const c=Array.from(t.values()),u=Array.from(e.values());for(let l=0;l<c.length;l++){const d=c[l],f=u.findIndex(g=>vm(d,g,void 0,t,e,r,n));if(f===-1)return!1;u.splice(f,1)}return!0}case ope:case dpe:case fpe:case hpe:case ppe:case gpe:case mpe:case ype:case bpe:case wpe:case Epe:case vpe:{if(typeof bt<"u"&&bt.isBuffer(t)!==bt.isBuffer(e)||t.length!==e.length)return!1;for(let c=0;c<t.length;c++)if(!vm(t[c],e[c],c,t,e,r,n))return!1;return!0}case cpe:return t.byteLength!==e.byteLength?!1:jm(new Uint8Array(t),new Uint8Array(e),r,n);case lpe:return t.byteLength!==e.byteLength||t.byteOffset!==e.byteOffset?!1:jm(new Uint8Array(t),new Uint8Array(e),r,n);case upe:return t.name===e.name&&t.message===e.message;case II:{if(!(jm(t.constructor,e.constructor,r,n)||N6(t)&&N6(e)))return!1;const c=[...Object.keys(t),...T6(t)],u=[...Object.keys(e),...T6(e)];if(c.length!==u.length)return!1;for(let l=0;l<c.length;l++){const d=c[l],f=t[d];if(!Object.hasOwn(e,d))return!1;const g=e[d];if(!vm(f,g,d,t,e,r,n))return!1}return!0}default:return!1}}finally{r.delete(t),r.delete(e)}}function Ape(){}function Cpe(t,e){return _pe(t,e,Ape)}var Ipe=Object.defineProperty,x6=Object.getOwnPropertySymbols,Spe=Object.prototype.hasOwnProperty,Tpe=Object.prototype.propertyIsEnumerable,qT=(t,e,r)=>e in t?Ipe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,R6=(t,e)=>{for(var r in e||(e={}))Spe.call(e,r)&&qT(t,r,e[r]);if(x6)for(var r of x6(e))Tpe.call(e,r)&&qT(t,r,e[r]);return t},ss=(t,e,r)=>qT(t,typeof e!="symbol"?e+"":e,r);class Yd extends Iee{constructor(e,r,n,s=Wo,i=void 0){super(e,r,n,s),this.core=e,this.logger=r,this.name=n,ss(this,"map",new Map),ss(this,"version",Ode),ss(this,"cached",[]),ss(this,"initialized",!1),ss(this,"getKey"),ss(this,"storagePrefix",Wo),ss(this,"recentlyDeleted",[]),ss(this,"recentlyDeletedLimit",200),ss(this,"init",async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(o=>{this.getKey&&o!==null&&!Gr(o)?this.map.set(this.getKey(o),o):lle(o)?this.map.set(o.id,o):dle(o)&&this.map.set(o.topic,o)}),this.cached=[],this.initialized=!0)}),ss(this,"set",async(o,a)=>{this.isInitialized(),this.map.has(o)?await this.update(o,a):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:o,value:a}),this.map.set(o,a),await this.persist())}),ss(this,"get",o=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:o}),this.getData(o))),ss(this,"getAll",o=>(this.isInitialized(),o?this.values.filter(a=>Object.keys(o).every(c=>Cpe(a[c],o[c]))):this.values)),ss(this,"update",async(o,a)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:o,update:a});const c=R6(R6({},this.getData(o)),a);this.map.set(o,c),await this.persist()}),ss(this,"delete",async(o,a)=>{this.isInitialized(),this.map.has(o)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:o,reason:a}),this.map.delete(o),this.addToRecentlyDeleted(o),await this.persist())}),this.logger=_s(r,this.name),this.storagePrefix=s,this.getKey=i}get context(){return vs(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.map.size}get keys(){return Array.from(this.map.keys())}get values(){return Array.from(this.map.values())}addToRecentlyDeleted(e){this.recentlyDeleted.push(e),this.recentlyDeleted.length>=this.recentlyDeletedLimit&&this.recentlyDeleted.splice(0,this.recentlyDeletedLimit/2)}async setDataStore(e){await this.core.storage.setItem(this.storageKey,e)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(e){const r=this.map.get(e);if(!r){if(this.recentlyDeleted.includes(e)){const{message:s}=_e("MISSING_OR_INVALID",`Record was recently deleted - ${this.name}: ${e}`);throw this.logger.error(s),new Error(s)}const{message:n}=_e("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(n),new Error(n)}return r}async persist(){await this.setDataStore(this.values)}async restore(){try{const e=await this.getDataStore();if(typeof e>"u"||!e.length)return;if(this.map.size){const{message:r}=_e("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored value for ${this.name}`),this.logger.trace({type:"method",method:"restore",value:this.values})}catch(e){this.logger.debug(`Failed to Restore value for ${this.name}`),this.logger.error(e)}}isInitialized(){if(!this.initialized){const{message:e}=_e("NOT_INITIALIZED",this.name);throw new Error(e)}}}var Ppe=Object.defineProperty,Ope=(t,e,r)=>e in t?Ppe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,gt=(t,e,r)=>Ope(t,typeof e!="symbol"?e+"":e,r);class Npe{constructor(e,r){this.core=e,this.logger=r,gt(this,"name",Bde),gt(this,"version",kde),gt(this,"events",new QP),gt(this,"pairings"),gt(this,"initialized",!1),gt(this,"storagePrefix",Wo),gt(this,"ignoredPayloadTypes",[nc]),gt(this,"registeredMethods",[]),gt(this,"init",async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"))}),gt(this,"register",({methods:n})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...n])]}),gt(this,"create",async n=>{this.isInitialized();const s=BT(),i=await this.core.crypto.setSymKey(s),o=Nr(ye.FIVE_MINUTES),a={protocol:CH},c={topic:i,expiry:o,relay:a,active:!1,methods:n==null?void 0:n.methods},u=ZB({protocol:this.core.protocol,version:this.core.version,topic:i,symKey:s,relay:a,expiryTimestamp:o,methods:n==null?void 0:n.methods});return this.events.emit(kl.create,c),this.core.expirer.set(i,o),await this.pairings.set(i,c),await this.core.relayer.subscribe(i,{transportType:n==null?void 0:n.transportType,internal:n==null?void 0:n.internal}),{topic:i,uri:u}}),gt(this,"pair",async n=>{this.isInitialized();const s=this.core.eventClient.createEvent({properties:{topic:n==null?void 0:n.uri,trace:[mo.pairing_started]}});this.isValidPair(n,s);const{topic:i,symKey:o,relay:a,expiryTimestamp:c,methods:u}=KB(n.uri);s.props.properties.topic=i,s.addTrace(mo.pairing_uri_validation_success),s.addTrace(mo.pairing_uri_not_expired);let l;if(this.pairings.keys.includes(i)){if(l=this.pairings.get(i),s.addTrace(mo.existing_pairing),l.active)throw s.setError(Sa.active_pairing_already_exists),new Error(`Pairing already exists: ${i}. Please try again with a new connection URI.`);s.addTrace(mo.pairing_not_expired)}const d=c||Nr(ye.FIVE_MINUTES),f={topic:i,relay:a,expiry:d,active:!1,methods:u};this.core.expirer.set(i,d),await this.pairings.set(i,f),s.addTrace(mo.store_new_pairing),n.activatePairing&&await this.activate({topic:i}),this.events.emit(kl.create,f),s.addTrace(mo.emit_inactive_pairing),this.core.crypto.keychain.has(i)||await this.core.crypto.setSymKey(o,i),s.addTrace(mo.subscribing_pairing_topic);try{await this.core.relayer.confirmOnlineStateOrThrow()}catch{s.setError(Sa.no_internet_connection)}try{await this.core.relayer.subscribe(i,{relay:a})}catch(g){throw s.setError(Sa.subscribe_pairing_topic_failure),g}return s.addTrace(mo.subscribe_pairing_topic_success),f}),gt(this,"activate",async({topic:n})=>{this.isInitialized();const s=Nr(ye.FIVE_MINUTES);this.core.expirer.set(n,s),await this.pairings.update(n,{active:!0,expiry:s})}),gt(this,"ping",async n=>{this.isInitialized(),await this.isValidPing(n),this.logger.warn("ping() is deprecated and will be removed in the next major release.");const{topic:s}=n;if(this.pairings.keys.includes(s)){const i=await this.sendRequest(s,"wc_pairingPing",{}),{done:o,resolve:a,reject:c}=Ol();this.events.once(kt("pairing_ping",i),({error:u})=>{u?c(u):a()}),await o()}}),gt(this,"updateExpiry",async({topic:n,expiry:s})=>{this.isInitialized(),await this.pairings.update(n,{expiry:s})}),gt(this,"updateMetadata",async({topic:n,metadata:s})=>{this.isInitialized(),await this.pairings.update(n,{peerMetadata:s})}),gt(this,"getPairings",()=>(this.isInitialized(),this.pairings.values)),gt(this,"disconnect",async n=>{this.isInitialized(),await this.isValidDisconnect(n);const{topic:s}=n;this.pairings.keys.includes(s)&&(await this.sendRequest(s,"wc_pairingDelete",ar("USER_DISCONNECTED")),await this.deletePairing(s))}),gt(this,"formatUriFromPairing",n=>{this.isInitialized();const{topic:s,relay:i,expiry:o,methods:a}=n,c=this.core.crypto.keychain.get(s);return ZB({protocol:this.core.protocol,version:this.core.version,topic:s,symKey:c,relay:i,expiryTimestamp:o,methods:a})}),gt(this,"sendRequest",async(n,s,i)=>{const o=Fi(s,i),a=await this.core.crypto.encode(n,o),c=ng[s].req;return this.core.history.set(n,o),this.core.relayer.publish(n,a,c),o.id}),gt(this,"sendResult",async(n,s,i)=>{const o=Ry(n,i),a=await this.core.crypto.encode(s,o),c=(await this.core.history.get(s,n)).request.method,u=ng[c].res;await this.core.relayer.publish(s,a,u),await this.core.history.resolve(o)}),gt(this,"sendError",async(n,s,i)=>{const o=JA(n,i),a=await this.core.crypto.encode(s,o),c=(await this.core.history.get(s,n)).request.method,u=ng[c]?ng[c].res:ng.unregistered_method.res;await this.core.relayer.publish(s,a,u),await this.core.history.resolve(o)}),gt(this,"deletePairing",async(n,s)=>{await this.core.relayer.unsubscribe(n),await Promise.all([this.pairings.delete(n,ar("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(n),s?Promise.resolve():this.core.expirer.del(n)])}),gt(this,"cleanup",async()=>{const n=this.pairings.getAll().filter(s=>Po(s.expiry));await Promise.all(n.map(s=>this.deletePairing(s.topic)))}),gt(this,"onRelayEventRequest",async n=>{const{topic:s,payload:i}=n;switch(i.method){case"wc_pairingPing":return await this.onPairingPingRequest(s,i);case"wc_pairingDelete":return await this.onPairingDeleteRequest(s,i);default:return await this.onUnknownRpcMethodRequest(s,i)}}),gt(this,"onRelayEventResponse",async n=>{const{topic:s,payload:i}=n,o=(await this.core.history.get(s,i.id)).request.method;switch(o){case"wc_pairingPing":return this.onPairingPingResponse(s,i);default:return this.onUnknownRpcMethodResponse(o)}}),gt(this,"onPairingPingRequest",async(n,s)=>{const{id:i}=s;try{this.isValidPing({topic:n}),await this.sendResult(i,n,!0),this.events.emit(kl.ping,{id:i,topic:n})}catch(o){await this.sendError(i,n,o),this.logger.error(o)}}),gt(this,"onPairingPingResponse",(n,s)=>{const{id:i}=s;setTimeout(()=>{bo(s)?this.events.emit(kt("pairing_ping",i),{}):li(s)&&this.events.emit(kt("pairing_ping",i),{error:s.error})},500)}),gt(this,"onPairingDeleteRequest",async(n,s)=>{const{id:i}=s;try{this.isValidDisconnect({topic:n}),await this.deletePairing(n),this.events.emit(kl.delete,{id:i,topic:n})}catch(o){await this.sendError(i,n,o),this.logger.error(o)}}),gt(this,"onUnknownRpcMethodRequest",async(n,s)=>{const{id:i,method:o}=s;try{if(this.registeredMethods.includes(o))return;const a=ar("WC_METHOD_UNSUPPORTED",o);await this.sendError(i,n,a),this.logger.error(a)}catch(a){await this.sendError(i,n,a),this.logger.error(a)}}),gt(this,"onUnknownRpcMethodResponse",n=>{this.registeredMethods.includes(n)||this.logger.error(ar("WC_METHOD_UNSUPPORTED",n))}),gt(this,"isValidPair",(n,s)=>{var i;if(!cs(n)){const{message:a}=_e("MISSING_OR_INVALID",`pair() params: ${n}`);throw s.setError(Sa.malformed_pairing_uri),new Error(a)}if(!ule(n.uri)){const{message:a}=_e("MISSING_OR_INVALID",`pair() uri: ${n.uri}`);throw s.setError(Sa.malformed_pairing_uri),new Error(a)}const o=KB(n==null?void 0:n.uri);if(!((i=o==null?void 0:o.relay)!=null&&i.protocol)){const{message:a}=_e("MISSING_OR_INVALID","pair() uri#relay-protocol");throw s.setError(Sa.malformed_pairing_uri),new Error(a)}if(!(o!=null&&o.symKey)){const{message:a}=_e("MISSING_OR_INVALID","pair() uri#symKey");throw s.setError(Sa.malformed_pairing_uri),new Error(a)}if(o!=null&&o.expiryTimestamp&&ye.toMiliseconds(o==null?void 0:o.expiryTimestamp)<Date.now()){s.setError(Sa.pairing_expired);const{message:a}=_e("EXPIRED","pair() URI has expired. Please try again with a new connection URI.");throw new Error(a)}}),gt(this,"isValidPing",async n=>{if(!cs(n)){const{message:i}=_e("MISSING_OR_INVALID",`ping() params: ${n}`);throw new Error(i)}const{topic:s}=n;await this.isValidPairingTopic(s)}),gt(this,"isValidDisconnect",async n=>{if(!cs(n)){const{message:i}=_e("MISSING_OR_INVALID",`disconnect() params: ${n}`);throw new Error(i)}const{topic:s}=n;await this.isValidPairingTopic(s)}),gt(this,"isValidPairingTopic",async n=>{if(!xr(n,!1)){const{message:s}=_e("MISSING_OR_INVALID",`pairing topic should be a string: ${n}`);throw new Error(s)}if(!this.pairings.keys.includes(n)){const{message:s}=_e("NO_MATCHING_KEY",`pairing topic doesn't exist: ${n}`);throw new Error(s)}if(Po(this.pairings.get(n).expiry)){await this.deletePairing(n);const{message:s}=_e("EXPIRED",`pairing topic: ${n}`);throw new Error(s)}}),this.core=e,this.logger=_s(r,this.name),this.pairings=new Yd(this.core,this.logger,this.name,this.storagePrefix)}get context(){return vs(this.logger)}isInitialized(){if(!this.initialized){const{message:e}=_e("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.core.relayer.on(_r.message,async e=>{const{topic:r,message:n,transportType:s}=e;if(this.pairings.keys.includes(r)&&s!==er.link_mode&&!this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(n)))try{const i=await this.core.crypto.decode(r,n);CO(i)?(this.core.history.set(r,i),await this.onRelayEventRequest({topic:r,payload:i})):QA(i)&&(await this.core.history.resolve(i),await this.onRelayEventResponse({topic:r,payload:i}),this.core.history.delete(r,i.id)),await this.core.relayer.messages.ack(r,n)}catch(i){this.logger.error(i)}})}registerExpirerEvents(){this.core.expirer.on(ti.expired,async e=>{const{topic:r}=m9(e.target);r&&this.pairings.keys.includes(r)&&(await this.deletePairing(r,!0),this.events.emit(kl.expire,{topic:r}))})}}var xpe=Object.defineProperty,Rpe=(t,e,r)=>e in t?xpe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,en=(t,e,r)=>Rpe(t,typeof e!="symbol"?e+"":e,r);class Bpe extends vee{constructor(e,r){super(e,r),this.core=e,this.logger=r,en(this,"records",new Map),en(this,"events",new gi.EventEmitter),en(this,"name",jde),en(this,"version",Dde),en(this,"cac
35hed",[]),en(this,"initialized",!1),en(this,"storagePrefix",Wo),en(this,"init",async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.records.set(n.id,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)}),en(this,"set",(n,s,i)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:n,request:s,chainId:i}),this.records.has(s.id))return;const o={id:s.id,topic:n,request:{method:s.method,params:s.params||null},chainId:i,expiry:Nr(ye.THIRTY_DAYS)};this.records.set(o.id,o),this.persist(),this.events.emit(Ei.created,o)}),en(this,"resolve",async n=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:n}),!this.records.has(n.id))return;const s=await this.getRecord(n.id);typeof s.response>"u"&&(s.response=li(n)?{error:n.error}:{result:n.result},this.records.set(s.id,s),this.persist(),this.events.emit(Ei.updated,s))}),en(this,"get",async(n,s)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:n,id:s}),await this.getRecord(s))),en(this,"delete",(n,s)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:s}),this.values.forEach(i=>{if(i.topic===n){if(typeof s<"u"&&i.id!==s)return;this.records.delete(i.id),this.events.emit(Ei.deleted,i)}}),this.persist()}),en(this,"exists",async(n,s)=>(this.isInitialized(),this.records.has(s)?(await this.getRecord(s)).topic===n:!1)),en(this,"on",(n,s)=>{this.events.on(n,s)}),en(this,"once",(n,s)=>{this.events.once(n,s)}),en(this,"off",(n,s)=>{this.events.off(n,s)}),en(this,"removeListener",(n,s)=>{this.events.removeListener(n,s)}),this.logger=_s(r,this.name)}get context(){return vs(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get size(){return this.records.size}get keys(){return Array.from(this.records.keys())}get values(){return Array.from(this.records.values())}get pending(){const e=[];return this.values.forEach(r=>{if(typeof r.response<"u")return;const n={topic:r.topic,request:Fi(r.request.method,r.request.params,r.id),chainId:r.chainId};return e.push(n)}),e}async setJsonRpcRecords(e){await this.core.storage.setItem(this.storageKey,e)}async getJsonRpcRecords(){return await this.core.storage.getItem(this.storageKey)}getRecord(e){this.isInitialized();const r=this.records.get(e);if(!r){const{message:n}=_e("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return r}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(Ei.sync)}async restore(){try{const e=await this.getJsonRpcRecords();if(typeof e>"u"||!e.length)return;if(this.records.size){const{message:r}=_e("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",records:this.values})}catch(e){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(e)}}registerEventListeners(){this.events.on(Ei.created,e=>{const r=Ei.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.events.on(Ei.updated,e=>{const r=Ei.updated;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.events.on(Ei.deleted,e=>{const r=Ei.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.core.heartbeat.on(Gd.pulse,()=>{this.cleanup()})}cleanup(){try{this.isInitialized();let e=!1;this.records.forEach(r=>{ye.toMiliseconds(r.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${r.id}`),this.records.delete(r.id),this.events.emit(Ei.deleted,r,!1),e=!0)}),e&&this.persist()}catch(e){this.logger.warn(e)}}isInitialized(){if(!this.initialized){const{message:e}=_e("NOT_INITIALIZED",this.name);throw new Error(e)}}}var kpe=Object.defineProperty,jpe=(t,e,r)=>e in t?kpe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,bn=(t,e,r)=>jpe(t,typeof e!="symbol"?e+"":e,r);class Dpe extends Tee{constructor(e,r){super(e,r),this.core=e,this.logger=r,bn(this,"expirations",new Map),bn(this,"events",new gi.EventEmitter),bn(this,"name",Ude),bn(this,"version",Mde),bn(this,"cac
35hed",[]),bn(this,"initialized",!1),bn(this,"storagePrefix",Wo),bn(this,"init",async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.expirations.set(n.target,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)}),bn(this,"has",n=>{try{const s=this.formatTarget(n);return typeof this.getExpiration(s)<"u"}catch{return!1}}),bn(this,"set",(n,s)=>{this.isInitialized();const i=this.formatTarget(n),o={target:i,expiry:s};this.expirations.set(i,o),this.checkExpiry(i,o),this.events.emit(ti.created,{target:i,expiration:o})}),bn(this,"get",n=>{this.isInitialized();const s=this.formatTarget(n);return this.getExpiration(s)}),bn(this,"del",n=>{if(this.isInitialized(),this.has(n)){const s=this.formatTarget(n),i=this.getExpiration(s);this.expirations.delete(s),this.events.emit(ti.deleted,{target:s,expiration:i})}}),bn(this,"on",(n,s)=>{this.events.on(n,s)}),bn(this,"once",(n,s)=>{this.events.once(n,s)}),bn(this,"off",(n,s)=>{this.events.off(n,s)}),bn(this,"removeListener",(n,s)=>{this.events.removeListener(n,s)}),this.logger=_s(r,this.name)}get context(){return vs(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.expirations.size}get keys(){return Array.from(this.expirations.keys())}get values(){return Array.from(this.expirations.values())}formatTarget(e){if(typeof e=="string")return Loe(e);if(typeof e=="number")return Foe(e);const{message:r}=_e("UNKNOWN_TYPE",`Target type: ${typeof e}`);throw new Error(r)}async setExpirations(e){await this.core.storage.setItem(this.storageKey,e)}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit(ti.sync)}async restore(){try{const e=await this.getExpirations();if(typeof e>"u"||!e.length)return;if(this.expirations.size){const{message:r}=_e("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values})}catch(e){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(e)}}getExpiration(e){const r=this.expirations.get(e);if(!r){const{message:n}=_e("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.warn(n),new Error(n)}return r}checkExpiry(e,r){const{expiry:n}=r;ye.toMiliseconds(n)-Date.now()<=0&&this.expire(e,r)}expire(e,r){this.expirations.delete(e),this.events.emit(ti.expired,{target:e,expiration:r})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((e,r)=>this.checkExpiry(r,e))}registerEventListeners(){this.core.heartbeat.on(Gd.pulse,()=>this.checkExpirations()),this.events.on(ti.created,e=>{const r=ti.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(ti.expired,e=>{const r=ti.expired;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(ti.deleted,e=>{const r=ti.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()})}isInitialized(){if(!this.initialized){const{message:e}=_e("NOT_INITIALIZED",this.name);throw new Error(e)}}}var Upe=Object.defineProperty,Mpe=(t,e,r)=>e in t?Upe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Or=(t,e,r)=>Mpe(t,typeof e!="symbol"?e+"":e,r);class $pe extends Pee{constructor(e,r,n){super(e,r,n),this.core=e,this.logger=r,this.store=n,Or(this,"name",$de),Or(this,"abortController"),Or(this,"isDevEnv"),Or(this,"verifyUrlV3",Fde),Or(this,"storagePrefix",Wo),Or(this,"version",AH),Or(this,"publicKey"),Or(this,"fetchPromise"),Or(this,"init",async()=>{var s;this.isDevEnv||(this.publicKey=await this.store.getItem(this.storeKey),this.publicKey&&ye.toMiliseconds((s=this.publicKey)==null?void 0:s.expiresAt)<Date.now()&&(this.logger.debug("verify v2 public key expired"),await this.removePublicKey()))}),Or(this,"register",async s=>{if(!Np()||this.isDevEnv)return;const i=window.location.origin,{id:o,decryptedId:a}=s,c=`${this.verifyUrlV3}/attestation?projectId=${this.core.projectId}&origin=${i}&id=${o}&decryptedId=${a}`;try{const u=ac.getDocument(),l=this.startAbortTimer(ye.ONE_SECOND*5),d=await new Promise((f,g)=>{const h=()=>{window.removeEventListener("message",y),u.body.removeChild(p),g("attestation aborted")};this.abortController.signal.addEventListener("abort",h);const p=u.createElement("iframe");p.src=c,p.style.display="none",p.addEventListener("error",h,{signal:this.abortController.signal});const y=w=>
vendor: 74,602 bytes, line 35
35{if(w.data&&typeof w.data=="string")try{const I=JSON.parse(w.data);if(I.type==="verify_attestation"){if(yT(I.attestation).payload.id!==o)return;clearInterval(l),u.body.removeChild(p),this.abortController.signal.removeEventListener("abort",h),window.removeEventListener("message",y),f(I.attestation===null?"":I.attestation)}}catch(I){this.logger.warn(I)}};u.body.appendChild(p),window.addEventListener("message",y,{signal:this.abortController.signal})});return this.logger.debug(d,"jwt attestation"),d}catch(u){this.logger.warn(u)}return""}),Or(this,"resolve",async s=>{if(this.isDevEnv)return"";const{attestationId:i,hash:o,encryptedId:a}=s;if(i===""){this.logger.debug("resolve: attestationId is empty, skipping");return}if(i){if(yT(i).payload.id!==a)return;const u=await this.isValidJwtAttestation(i);if(u){if(!u.isVerified){this.logger.warn("resolve: jwt attestation: origin url not verified");return}return u}}if(!o)return;const c=this.getVerifyUrl(s==null?void 0:s.verifyUrl);return this.fetchAttestation(o,c)}),Or(this,"fetchAttestation",async(s,i)=>{this.logger.debug(`resolving attestation: ${s} from url: ${i}`);const o=this.startAbortTimer(ye.ONE_SECOND*5),a=await fetch(`${i}/attestation/${s}?v2Supported=true`,{signal:this.abortController.signal});return clearTimeout(o),a.status===200?await a.json():void 0}),Or(this,"getVerifyUrl",s=>{let i=s||km;return Hde.includes(i)||(this.logger.info(`verify url: ${i}, not included in trusted list, assigning default: ${km}`),i=km),i}),Or(this,"fetchPublicKey",async()=>{try{this.logger.debug(`fetching public key from: ${this.verifyUrlV3}`);const s=this.startAbortTimer(ye.FIVE_SECONDS),i=await fetch(`${this.verifyUrlV3}/public-key`,{signal:this.abortController.signal});return clearTimeout(s),await i.json()}catch(s){this.logger.warn(s)}}),Or(this,"persistPublicKey",async s=>{this.logger.debug(s,"persisting public key to local storage"),await this.store.setItem(this.storeKey,s),this.publicKey=s}),Or(this,"removePublicKey",async()=>{this.logger.debug("removing verify v2 public key from storage"),await this.store.removeItem(this.storeKey),this.publicKey=void 0}),Or(this,"isValidJwtAttestation",async s=>{const i=await this.getPublicKey();try{if(i)return this.validateAttestation(s,i)}catch(a){this.logger.error(a),this.logger.warn("error validating attestation")}const o=await this.fetchAndPersistPublicKey();try{if(o)return this.validateAttestation(s,o)}catch(a){this.logger.error(a),this.logger.warn("error validating attestation")}}),Or(this,"getPublicKey",async()=>this.publicKey?this.publicKey:await this.fetchAndPersistPublicKey()),Or(this,"fetchAndPersistPublicKey",async()=>{if(this.fetchPromise)return await this.fetchPromise,this.publicKey;this.fetchPromise=new Promise(async i=>{const o=await this.fetchPublicKey();o&&(await this.persistPublicKey(o),i(o))});const s=await this.fetchPromise;return this.fetchPromise=void 0,s}),Or(this,"validateAttestation",(s,i)=>{const o=Uue(s,i.publicKey),a={hasExpired:ye.toMiliseconds(o.exp)<Date.now(),payload:o};if(a.hasExpired)throw this.logger.warn("resolve: jwt attestation expired"),new Error("JWT attestation expired");return{origin:a.payload.origin,isScam:a.payload.isScam,isVerified:a.payload.isVerified}}),this.logger=_s(r,this.name),this.abortController=new AbortController,this.isDevEnv=lO(),this.init()}get storeKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//verify:public:key"}get context(){return vs(this.logger)}startAbortTimer(e){return this.abortController=new AbortController,setTimeout(()=>this.abortController.abort(),ye.toMiliseconds(e))}}var Lpe=Object.defineProperty,Fpe=(t,e,r)=>e in t?Lpe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,B6=(t,e,r)=>Fpe(t,typeof e!="symbol"?e+"":e,r);class Hpe extends Oee{constructor(e,r){super(e,r),this.projectId=e,this.logger=r,B6(this,"context",qde),B6(this,"registerDeviceToken",async n=>{const{clientId:s,token:i,notificationType:o,enableEncrypted:a=!1}=n,c=`${zde}/${this.projectId}/clients`;await fetch(c,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:s,type:o,token:i,always_raw:a})})}),this.logger=_s(r,this.context)}}var qpe=Object.defineProperty,k6=Object.getOwnPropertySymbols,zpe=Object.prototype.hasOwnProperty,Wpe=Object.prototype.propertyIsEnumerable,zT=(t,e,r)=>e in t?qpe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,og=(t,e)=>{for(var r in e||(e={}))zpe.call(e,r)&&zT(t,r,e[r]);if(k6)for(var r of k6(e))Wpe.call(e,r)&&zT(t,r,e[r]);return t},Hr=(t,e,r)=>zT(t,typeof e!="symbol"?e+"":e,r);class Vpe extends Nee{constructor(e,r,n=!0){super(e,r,n),this.core=e,this.logger=r,Hr(this,"context",Vde),Hr(this,"storagePrefix",Wo),Hr(this,"storageVersion",Wde),Hr(this,"events",new Map),Hr(this,"shouldPersist",!1),Hr(this,"init",async()=>{if(!lO())try{const s={eventId:pB(),timestamp:Date.now(),domain:this.getAppDomain(),props:{event:"INIT",type:"",properties:{client_id:await this.core.crypto.getClientId(),user_agent:p9(this.core.relayer.protocol,this.core.relayer.version,DT)}}};await this.sendEvent([s])}catch(s){this.logger.warn(s)}}),Hr(this,"createEvent",s=>{const{event:i="ERROR",type:o="",properties:{topic:a,trace:c}}=s,u=pB(),l=this.core.projectId||"",d=Date.now(),f=og({eventId:u,timestamp:d,props:{event:i,type:o,properties:{topic:a,trace:c}},bundleId:l,domain:this.getAppDomain()},this.setMethods(u));return this.telemetryEnabled&&(this.events.set(u,f),this.shouldPersist=!0),f}),Hr(this,"getEvent",s=>{const{eventId:i,topic:o}=s;if(i)return this.events.get(i);const a=Array.from(this.events.values()).find(c=>c.props.properties.topic===o);if(a)return og(og({},a),this.setMethods(a.eventId))}),Hr(this,"deleteEvent",s=>{const{eventId:i}=s;this.events.delete(i),this.shouldPersist=!0}),Hr(this,"setEventListeners",()=>{this.core.heartbeat.on(Gd.pulse,async()=>{this.shouldPersist&&await this.persist(),this.events.forEach(s=>{ye.fromMiliseconds(Date.now())-ye.fromMiliseconds(s.timestamp)>Gde&&(this.events.delete(s.eventId),this.shouldPersist=!0)})})}),Hr(this,"setMethods",s=>({addTrace:i=>this.addTrace(s,i),setError:i=>this.setError(s,i)})),Hr(this,"addTrace",(s,i)=>{const o=this.events.get(s);o&&(o.props.properties.trace.push(i),this.events.set(s,o),this.shouldPersist=!0)}),Hr(this,"setError",(s,i)=>{const o=this.events.get(s);o&&(o.props.type=i,o.timestamp=Date.now(),this.events.set(s,o),this.shouldPersist=!0)}),Hr(this,"persist",async()=>{await this.core.storage.setItem(this.storageKey,Array.from(this.events.values())),this.shouldPersist=!1}),Hr(this,"restore",async()=>{try{const s=await this.core.storage.getItem(this.storageKey)||[];if(!s.length)return;s.forEach(i=>{this.events.set(i.eventId,og(og({},i),this.setMethods(i.eventId)))})}catch(s){this.logger.warn(s)}}),Hr(this,"submit",async()=>{if(!this.telemetryEnabled||this.events.size===0)return;const s=[];for(const[i,o]of this.events)o.props.type&&s.push(o);if(s.length!==0)try{if((await this.sendEvent(s)).ok)for(const i of s)this.events.delete(i.eventId),this.shouldPersist=!0}catch(i){this.logger.warn(i)}}),Hr(this,"sendEvent",async s=>{const i=this.getAppDomain()?"":"&sp=desktop";return await fetch(`${Kde}?projectId=${this.core.projectId}&st=events_sdk&sv=js-${DT}${i}`,{method:"POST",body:JSON.stringify(s)})}),Hr(this,"getAppDomain",()=>h9().url),this.logger=_s(r,this.context),this.telemetryEnabled=n,n?this.restore().then(async()=>{await this.submit(),this.setEventListeners()}):this.persist()}get storageKey(){return this.storagePrefix+this.storageVersion+this.core.customStoragePrefix+"//"+this.context}}var Gpe=Object.defineProperty,j6=Object.getOwnPropertySymbols,Kpe=Object.prototype.hasOwnProperty,Zpe=Object.prototype.propertyIsEnumerable,WT=(t,e,r)=>e in t?Gpe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,D6=(t,e)=>{for(var r in e||(e={}))Kpe.call(e,r)&&WT(t,r,e[r]);if(j6)for(var r of j6(e))Zpe.call(e,r)&&WT(t,r,e[r]);return t},Gt=(t,e,r)=>WT(t,typeof e!="symbol"?e+"":e,r);let Ype=class MH extends yee{constructor(e){var r;super(e),Gt(this,"protocol",_H),Gt(this,"version",AH),Gt(this,"name",jT),Gt(this,"relayUrl"),Gt(this,"projectId"),Gt(this,"customStoragePrefix"),Gt(this,"events",new gi.EventEmitter),Gt(this,"logger"),Gt(this,"heartbeat"),Gt(this,"relayer"),Gt(this,"crypto"),Gt(this,"storage"),Gt(this,"history"),Gt(this,"expirer"),Gt(this,"pairing"),Gt(this,"verify"),Gt(this,"echoClient"),Gt(this,"linkModeSupportedApps"),Gt(this,"eventClient"),Gt(this,"initialized",!1),Gt(this,"logChunkController"),Gt(this,"on",(a,c)=>this.events.on(a,c)),Gt(this,"once",(a,c)=>this.events.once(a,c)),Gt(this,"off",(a,c)=>this.events.off(a,c)),Gt(this,"removeListener",(a,c)=>this.events.removeListener(a,c)),Gt(this,"dispatchEnvelope",({topic:a,message:c,sessionExists:u})=>{if(!a||!c)return;const l={topic:a,message:c,publishedAt:Date.now(),transportType:er.link_mode};this.relayer.onLinkMessageEvent(l,{sessionExists:u})});const n=this.getGlobalCore(e==null?void 0:e.customStoragePrefix);if(n)try{return this.customStoragePrefix=n.customStoragePrefix,this.logger=n.logger,this.heartbeat=n.heartbeat,this.crypto=n.crypto,this.history=n.history,this.expirer=n.expirer,this.storage=n.storage,this.relayer=n.relayer,this.pairing=n.pairing,this.verify=n.verify,this.echoClient=n.echoClient,this.linkModeSupportedApps=n.linkModeSupportedApps,this.eventClient=n.eventClient,this.initialized=n.initialized,this.logChunkController=n.logChunkController,n}catch(a){console.warn("Failed to copy global core",a)}this.projectId=e==null?void 0:e.projectId,this.relayUrl=(e==null?void 0:e.relayUrl)||IH,this.customStoragePrefix=e!=null&&e.customStoragePrefix?`:${e.customStoragePrefix}`:"";const s=HP({level:typeof(e==null?void 0:e.logger)=="string"&&e.logger?e.logger:gde.logger,name:jT}),{logger:i,chunkLoggerController:o}=kA({opts:s,maxSizeInBytes:e==null?void 0:e.maxLogBlobSizeInBytes,loggerOverride:e==null?void 0:e.logger});this.logChunkController=o,(r=this.logChunkController)!=null&&r.downloadLogsBlobInBrowser&&(window.downloadLogsBlobInBrowser=async()=>{var a,c;(a=this.logChunkController)!=null&&a.downloadLogsBlobInBrowser&&((c=this.logChunkController)==null||c.downloadLogsBlobInBrowser({clientId:await this.crypto.getClientId()}))}),this.logger=_s(i,this.name),this.heartbeat=new RX,this.crypto=new Ahe(this,this.logger,e==null?void 0:e.keychain),this.history=new Bpe(this,this.logger),this.expirer=new Dpe(this,this.logger),this.storage=e!=null&&e.storage?e.storage:new pee(D6(D6({},mde),e==null?void 0:e.storageOptions)),this.relayer=new Yhe({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new Npe(this,this.logger),this.verify=new $pe(this,this.logger,this.storage),this.echoClient=new Hpe(this.projectId||"",this.logger),this.linkModeSupportedApps=[],this.eventClient=new Vpe(this,this.logger,e==null?void 0:e.telemetryEnabled),this.setGlobalCore(this)}static async init(e){const r=new MH(e);await r.initialize();const n=await r.crypto.getClientId();return await r.storage.setItem(Nde,n),r}get context(){return vs(this.logger)}async start(){this.initialized||await this.initialize()}async getLogsBlob(){var e;return(e=this.logChunkController)==null?void 0:e.logsToBlob({clientId:await this.crypto.getClientId()})}async addLinkModeSupportedApp(e){this.linkModeSupportedApps.includes(e)||(this.linkModeSupportedApps.push(e),await this.storage.setItem(p6,this.linkModeSupportedApps))}async initialize(){this.logger.trace("Initialized");try{await this.crypto.init(),await this.history.init(),await this.expirer.init(),await this.relayer.init(),await this.heartbeat.init(),await this.pairing.init(),this.linkModeSupportedApps=await this.storage.getItem(p6)||[],this.initialized=!0,this.logger.info("Core Initialization Success")}catch(e){throw this.logger.warn(e,`Core Initialization Failure at epoch ${Date.now()}`),this.logger.error(e.message),e}}getGlobalCore(e=""){try{if(this.isGlobalCoreDisabled())return;const r=`_walletConnectCore_${e}`,n=`${r}_count`;return globalThis[n]=(globalThis[n]||0)+1,globalThis[n]>1&&console.warn(`WalletConnect Core is already initialized. This is probably a mistake and can lead to unexpected behavior. Init() was called ${globalThis[n]} times.`),globalThis[r]}catch(r){console.warn("Failed to get global WalletConnect core",r);return}}setGlobalCore(e){var r;try{if(this.isGlobalCoreDisabled())return;const n=`_walletConnectCore_${((r=e.opts)==null?void 0:r.customStoragePrefix)||""}`;globalThis[n]=e}catch(n){console.warn("Failed to set global WalletConnect core",n)}}isGlobalCoreDisabled(){try{return typeof Qr<"u"&&pde.DISABLE_GLOBAL_CORE==="true"}catch{return!0}}};const Jpe=Ype,$H="wc",LH=2,FH="client",SO=`${$H}@${LH}:${FH}:`,SI={name:FH,logger:"error"},U6="WALLETCONNECT_DEEPLINK_CHOICE",Qpe="proposal",M6="Proposal expired",Xpe="session",gf=ye.SEVEN_DAYS,ege="engine",tn={wc_sessionPropose:{req:{ttl:ye.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:ye.FIVE_MINUTES,prompt:!1,tag:1101},reject:{ttl:ye.FIVE_MINUTES,prompt:!1,tag:1120},autoReject:{ttl:ye.FIVE_MINUTES,prompt:!1,tag:1121}},wc_sessionSettle:{req:{ttl:ye.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:ye.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:ye.ONE_DAY,prompt:!1,tag:1104},res:{ttl:ye.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:ye.ONE_DAY,prompt:!1,tag:1106},res:{ttl:ye.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:ye.FIVE_MINUTES*3,prompt:!0,tag:1108},res:{ttl:ye.FIVE_MINUTES*3,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:ye.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:ye.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:ye.ONE_DAY,prompt:!1,tag:1112},res:{ttl:ye.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:ye.ONE_DAY,prompt:!1,tag:1114},res:{ttl:ye.ONE_DAY,prompt:!1,tag:1115}},wc_sessionAuthenticate:{req:{ttl:ye.ONE_HOUR,prompt:!0,tag:1116},res:{ttl:ye.ONE_HOUR,prompt:!1,tag:1117},reject:{ttl:ye.FIVE_MINUTES,prompt:!1,tag:1118},autoReject:{ttl:ye.FIVE_MINUTES,prompt:!1,tag:1119}}},TI={min:ye.FIVE_MINUTES,max:ye.SEVEN_DAYS},lo={idle:"IDLE",active:"ACTIVE"},tge={eth_sendTransaction:{key:""},eth_sendRawTransaction:{key:""},wallet_sendCalls:{key:""},solana_signTransaction:{key:"signature"},solana_signAllTransactions:{key:"transactions"},solana_signAndSendTransaction:{key:"signature"},sui_signAndExecuteTransaction:{key:"digest"},sui_signTransaction:{key:""},hedera_signAndExecuteTransaction:{key:"transactionId"},hedera_executeTransaction:{key:"transactionId"},near_signTransaction:{key:""},near_signTransactions:{key:""},tron_signTransaction:{key:"txID"},xrpl_signTransaction:{key:""},xrpl_signTransactionFor:{key:""},algo_signTxn:{key:""},sendTransfer:{key:"txid"},stacks_stxTransfer:{key:"txId"},polkadot_signTransaction:{key:""},cosmos_signDirect:{key:""}},rge="request",nge=["wc_sessionPropose","wc_sessionRequest","wc_authRequest","wc_sessionAuthenticate"],sge="wc",ige="auth",oge="authKeys",age="pairingTopics",cge="requests",eC=`${sge}@${1.5}:${ige}:`,p_=`${eC}:PUB_KEY`;var uge=Object.defineProperty,lge=Object.defineProperties,dge=Object.getOwnPropertyDescriptors,$6=Object.getOwnPropertySymbols,fge=Object.prototype.hasOwnProperty,hge=Object.prototype.propertyIsEnumerable,VT=(t,e,r)=>e in t?uge(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Nt=(t,e)=>{for(var r in e||(e={}))fge.call(e,r)&&VT(t,r,e[r]);if($6)for(var r of $6(e))hge.call(e,r)&&VT(t,r,e[r]);return t},rn=(t,e)=>lge(t,dge(e)),he=(t,e,r)=>VT(t,typeof e!="symbol"?e+"":e,r);class pge extends kee{constructor(e){super(e),he(this,"name",ege),he(this,"events",new QP),he(this,"initialized",!1),he(this,"requestQueue",{state:lo.idle,queue:[]}),he(this,"sessionRequestQueue",{state:lo.idle,queue:[]}),he(this,"emittedSessionRequests",new Yoe({limit:500})),he(this,"requestQueueDelay",ye.ONE_SECOND),he(this,"expectedPairingMethodMap",new Map),he(this,"recentlyDeletedMap",new Map),he(this,"recentlyDeletedLimit",200),he(this,"relayMessageCache",[]),he(this,"pendingSessions",new Map),he(this,"init",async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.registerPairingEvents(),await this.registerLinkModeListeners(),this.client.core.pairing.register({methods:Object.keys(tn)}),this.initialized=!0,setTimeout(async()=>{await this.processPendingMessageEvents(),this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()},ye.toMiliseconds(this.requestQueueDelay)))}),he(this,"connect",async r=>{var n;this.isInitialized(),await this.confirmOnlineStateOrThrow();const s=rn(Nt({},r),{requiredNamespaces:r.requiredNamespaces||{},optionalNamespaces:r.optionalNamespaces||{}});await this.isValidConnect(s),s.optionalNamespaces=ole(s.requiredNamespaces,s.optionalNamespaces),s.requiredNamespaces={};const{pairingTopic:i,requiredNamespaces:o,optionalNamespaces:a,sessionProperties:c,scopedProperties:u,relays:l,authentication:d,walletPay:f}=s,g=((n=d==null?void 0:d[0])==null?void 0:n.ttl)||tn.wc_sessionPropose.req.ttl||ye.FIVE_MINUTES;this.validateRequestExpiry(g);let h=i,p,y=!1;try{if(h){const C=this.client.core.pairing.pairings.get(h);this.client.logger.warn("connect() with existing pairing topic is deprecated and will be removed in the next major release."),y=C.active}}catch(C){throw this.client.logger.error(`connect() -> pairing.get(${h}) failed`),C}if(!h||!y){const{topic:C,uri:S}=await this.client.core.pairing.create({internal:{skipSubscribe:!0}});h=C,p=S}if(!h){const{message:C}=_e("NO_MATCHING_KEY",`connect() pairing topic: ${h}`);throw new Error(C)}const w=await this.client.core.crypto.generateKeyPair(),I=Nr(g),v=Nt(rn(Nt(Nt({requiredNamespaces:o,optionalNamespaces:a,relays:l??[{protocol:CH}],proposer:{publicKey:w,metadata:this.client.metadata},expiryTimestamp:I,pairingTopic:h},c&&{sessionProperties:c}),u&&{scopedProperties:u}),{id:yo()}),(d||f)&&{requests:{authentication:d==null?void 0:d.map(C=>{const{domain:S,chains:T,nonce:N,uri:R,exp:B,nbf:A,type:P,statement:k,requestId:U,resources:x,signatureTypes:j}=C;return{domain:S,chains:T,nonce:N,type:P??"caip122",aud:R,version:"1",iat:new Date().toISOString(),exp:B,nbf:A,statement:k,requestId:U,resources:x,signatureTypes:j}}),walletPay:f}}),E=kt("session_connect",v.id),{reject:b,resolve:m,done:_}=Ol(g,M6),O=({id:C})=>{C===v.id&&(this.client.events.off("proposal_expire",O),this.pendingSessions.delete(v.id),this.events.emit(E,{error:{message:M6,code:0}}))};return this.client.events.on("proposal_expire",O),this.events.once(E,({error:C,session:S})=>{this.client.events.off("proposal_expire",O),C?b(C):S&&m(S)}),await this.setProposal(v.id,v),await this.sendProposeSession({proposal:v,publishOpts:{internal:{throwOnFailedPublish:!0},tvf:{correlationId:v.id}}}).catch(C=>{throw this.deleteProposal(v.id),C}),{uri:p,approval:_}}),he(this,"pair",async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{return await this.client.core.pairing.pair(r)}catch(n){throw this.client.logger.error("pair() failed"),n}}),he(this,"approve",async r=>{var n,s,i;const o=this.client.core.eventClient.createEvent({properties:{topic:(n=r==null?void 0:r.id)==null?void 0:n.toString(),trace:[vi.session_approve_started]}});try{this.isInitialized(),await this.confirmOnlineStateOrThrow()}catch(S){throw o.setError(rl.no_internet_connection),S}try{await this.isValidProposalId(r==null?void 0:r.id)}catch(S){throw this.client.logger.error(`approve() -> proposal.get(${r==null?void 0:r.id}) failed`),o.setError(rl.proposal_not_found),S}try{await this.isValidApprove(r)}catch(S){throw this.client.logger.error("approve() -> isValidApprove() failed"),o.setError(rl.session_approve_namespace_validation_failure),S}const{id:a,relayProtocol:c,namespaces:u,sessionProperties:l,scopedProperties:d,sessionConfig:f,proposalRequestsResponses:g}=r,h=this.client.proposal.get(a);this.client.core.eventClient.deleteEvent({eventId:o.eventId});const{pairingTopic:p,proposer:y,requiredNamespaces:w,optionalNamespaces:I}=h;let v=(s=this.client.core.eventClient)==null?void 0:s.getEvent({topic:p});v||(v=(i=this.client.core.eventClient)==null?void 0:i.createEvent({type:vi.session_approve_started,properties:{topic:p,trace:[vi.session_approve_started,vi.session_namespaces_validation_success]}}));const E=await this.client.core.crypto.generateKeyPair(),b=y.publicKey,m=await this.client.core.crypto.generateSharedKey(E,b),_=rn(Nt(Nt(Nt({relay:{protocol:c??"irn"},namespaces:u,controller:{publicKey:E,metadata:this.client.metadata},expiry:Nr(gf)},l&&{sessionProperties:l}),d&&{scopedProperties:d}),f&&{sessionConfig:f}),{proposalRequestsResponses:g}),O=er.relay;v.addTrace(vi.subscribing_session_topic);try{await this.client.core.relayer.subscribe(m,{transportType:O,internal:{skipSubscribe:!0}})}catch(S){throw v.setError(rl.subscribe_session_topic_failure),S}v.addTrace(vi.subscribe_session_topic_success);const C=rn(Nt({},_),{topic:m,requiredNamespaces:w,optionalNamespaces:I,pairingTopic:p,acknowledged:!1,self:_.controller,peer:{publicKey:y.publicKey,metadata:y.metadata},controller:E,transportType:er.relay,authentication:g==null?void 0:g.authentication,walletPayResult:g==null?void 0:g.walletPay});await this.client.session.set(m,C),v.addTrace(vi.store_session);try{await this.sendApproveSession({sessionTopic:m,proposal:h,pairingProposalResponse:{relay:{protocol:c??"irn"},responderPublicKey:E},sessionSettleRequest:_,publishOpts:{internal:{throwOnFailedPublish:!0},tvf:Nt({correlationId:a},this.getTVFApproveParams(C))}}),v.addTrace(vi.session_approve_publish_success)}catch(S){throw this.client.logger.error(S),this.client.session.delete(m,ar("USER_DISCONNECTED")),await this.client.core.relayer.unsubscribe(m),S}return this.client.core.eventClient.deleteEvent({eventId:v.eventId}),await this.client.core.pairing.updateMetadata({topic:p,metadata:y.metadata}),await this.deleteProposal(a),await this.client.core.pairing.activate({topic:p}),await this.setExpiry(m,Nr(gf)),{topic:m,acknowledged:()=>Promise.resolve(this.client.session.get(m))}}),he(this,"reject",async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidReject(r)}catch(o){throw this.client.logger.error("reject() -> isValidReject() failed"),o}const{id:n,reason:s}=r;let i;try{i=this.client.proposal.get(n).pairingTopic}catch(o){throw this.client.logger.error(`reject() -> proposal.get(${n}) failed`),o}i&&await this.sendError({id:n,topic:i,error:s,rpcOpts:tn.wc_sessionPropose.reject}),await this.deleteProposal(n)}),he(this,"update",async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidUpdate(r)}catch(d){throw this.client.logger.error("update() -> isValidUpdate() failed"),d}const{topic:n,namespaces:s}=r,{done:i,resolve:o,reject:a}=Ol(ye.FIVE_MINUTES,"Session update request expired without receiving any acknowledgement"),c=yo(),u=_u().toString(),l=this.client.session.get(n).namespaces;return this.events.once(kt("session_update",c),({error:d})=>{d?a(d):o()}),await this.client.session.update(n,{namespaces:s}),await this.sendRequest({topic:n,method:"wc_sessionUpdate",params:{namespaces:s},throwOnFailedPublish:!0,clientRpcId:c,relayRpcId:u}).catch(d=>{this.client.logger.error(d),this.client.session.update(n,{namespaces:l}),a(d)}),{acknowledged:i}}),he(this,"extend",async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidExtend(r)}catch(c){throw this.client.logger.error("extend() -> isValidExtend() failed"),c}const{topic:n}=r,s=yo(),{done:i,resolve:o,reject:a}=Ol(ye.FIVE_MINUTES,"Session extend request expired without receiving any acknowledgement");return this.events.once(kt("session_extend",s),({error:c})=>{c?a(c):o()}),await this.setExpiry(n,Nr(gf)),this.sendRequest({topic:n,method:"wc_sessionExtend",params:{},clientRpcId:s,throwOnFailedPublish:!0}).catch(c=>{a(c)}),{acknowledged:i}}),he(this,"request",async r=>{this.isInitialized();try{await this.isValidRequest(r)}catch(y){throw this.client.logger.error("request() -> isValidRequest() failed"),y}const{chainId:n,request:s,topic:i,expiry:o=tn.wc_sessionRequest.req.ttl}=r,a=this.client.session.get(i);(a==null?void 0:a.transportType)===er.relay&&await this.confirmOnlineStateOrThrow();const c=yo(),u=_u().toString(),{done:l,resolve:d,reject:f}=Ol(o,"Request expired. Please try again.");this.events.once(kt("session_request",c),({error:y,result:w})=>{y?f(y):d(w)});const g="wc_sessionRequest",h=this.getAppLinkIfEnabled(a.peer.metadata,a.transportType);if(h)return await this.sendRequest({clientRpcId:c,relayRpcId:u,topic:i,method:g,params:{request:rn(Nt({},s),{expiryTimestamp:Nr(o)}),chainId:n},expiry:o,throwOnFailedPublish:!0,appLink:h}).catch(y=>f(y)),this.client.events.emit("session_request_sent",{topic:i,request:s,chainId:n,id:c}),await l();const p={request:rn(Nt({},s),{expiryTimestamp:Nr(o)}),chainId:n};return await Promise.all([new Promise(async y=>{await this.sendRequest({clientRpcId:c,relayRpcId:u,topic:i,method:g,params:p,expiry:o,throwOnFailedPublish:!0,tvf:this.getTVFParams(c,p)}).catch(w=>f(w)),this.client.events.emit("session_request_sent",{topic:i,request:s,chainId:n,id:c}),y()}),new Promise(async y=>{var w;if(!((w=a.sessionConfig)!=null&&w.disableDeepLink)){const I=await Woe(this.client.core.storage,U6);await Hoe({id:c,topic:i,wcDeepLink:I})}y()}),l()]).then(y=>y[2])}),he(this,"respond",async r=>{var n,s;this.isInitialized();const i=this.client.core.eventClient.createEvent({properties:{topic:(r==null?void 0:r.topic)||((s=(n=r==null?void 0:r.response)==null?void 0:n.id)==null?void 0:s.toString()),trace:[vi.session_request_response_started]}});try{await this.isValidRespond(r)}catch(d){throw i.addTrace(d==null?void 0:d.message),i.setError(rl.session_request_response_validation_failure),d}i.addTrace(vi.session_request_response_validation_success);const{topic:o,response:a}=r,{id:c}=a,u=this.client.session.get(o);u.transportType===er.relay&&await this.confirmOnlineStateOrThrow();const l=this.getAppLinkIfEnabled(u.peer.metadata,u.transportType);try{i.addTrace(vi.session_request_response_publish_started),bo(a)?await this.sendResult({id:c,topic:o,result:a.result,throwOnFailedPublish:!0,appLink:l}):li(a)&&await this.sendError({id:c,topic:o,error:a.error,appLink:l}),this.cleanupAfterResponse(r)}catch(d){throw i.addTrace(d==null?void 0:d.message),i.setError(rl.session_request_response_publish_failure),d}}),he(this,"ping",async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidPing(r)}catch(s){throw this.client.logger.error("ping() -> isValidPing() failed"),s}const{topic:n}=r;if(this.client.session.keys.includes(n)){const s=yo(),i=_u().toString(),{done:o,resolve:a,reject:c}=Ol(ye.FIVE_MINUTES,"Ping request expired without receiving any acknowledgement");this.events.once(kt("session_ping",s),({error:u})=>{u?c(u):a()}),await Promise.all([this.sendRequest({topic:n,method:"wc_sessionPing",params:{},throwOnFailedPublish:!0,clientRpcId:s,relayRpcId:i}),o()])}else this.client.core.pairing.pairings.keys.includes(n)&&(this.client.logger.warn("ping() on pairing topic is deprecated and will be removed in the next major release."),await this.client.core.pairing.ping({topic:n}))}),he(this,"emit",async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidEmit(r);const{topic:n,event:s,chainId:i}=r,o=_u().toString(),a=yo();await this.sendRequest({topic:n,method:"wc_sessionEvent",params:{event:s,chainId:i},throwOnFailedPublish:!0,relayRpcId:o,clientRpcId:a})}),he(this,"disconnect",async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidDisconnect(r);const{topic:n}=r;if(this.client.session.keys.includes(n))await this.sendRequest({topic:n,method:"wc_sessionDelete",params:ar("USER_DISCONNECTED"),throwOnFailedPublish:!0}),await this.deleteSession({topic:n,emitEvent:!1});else if(this.client.core.pairing.pairings.keys.includes(n))await this.client.core.pairing.disconnect({topic:n});else{const{message:s}=_e("MISMATCHED_TOPIC",`Session or pairing topic not found: ${n}`);throw new Error(s)}}),he(this,"find",r=>(this.isInitialized(),this.client.session.getAll().filter(n=>ale(n,r)))),he(this,"getPendingSessionRequests",()=>this.client.pendingRequest.getAll()),he(this,"authenticate",async(r,n)=>{var s;this.isInitialized(),this.isValidAuthenticate(r);const i=n&&this.client.core.linkModeSupportedApps.includes(n)&&((s=this.client.metadata.redirect)==null?void 0:s.linkMode),o=i?er.link_mode:er.relay;o===er.relay&&await this.confirmOnlineStateOrThrow();const{chains:a,statement:c="",uri:u,domain:l,nonce:d,type:f,exp:g,nbf:h,methods:p=[],expiry:y}=r,w=[...r.resources||[]],{topic:I,uri:v}=await this.client.core.pairing.create({methods:["wc_sessionAuthenticate"],transportType:o});this.client.logger.info({message:"Generated new pairing",pairing:{topic:I,uri:v}});const E=await this.client.core.crypto.generateKeyPair(),b=f_(E);if(await Promise.all([this.client.auth.authKeys.set(p_,{responseTopic:b,publicKey:E}),this.client.auth.pairingTopics.set(b,{topic:b,pairingTopic:I})]),await this.client.core.relayer.subscribe(b,{transportType:o}),this.client.logger.info(`sending request to new pairing topic: ${I}`),p.length>0){const{namespace:x}=rc(a[0]);let j=uce(x,"request",p);d_(w)&&(j=dce(j,w.pop())),w.push(j)}const m=y&&y>tn.wc_sessionAuthenticate.req.ttl?y:tn.wc_sessionAuthenticate.req.ttl,_={authPayload:{type:f??"caip122",chains:a,statement:c,aud:u,domain:l,version:"1",nonce:d,iat:new Date().toISOString(),exp:g,nbf:h,resources:w},requester:{publicKey:E,metadata:this.client.metadata},expiryTimestamp:Nr(m)},O={eip155:{chains:a,methods:[...new Set(["personal_sign",...p])],events:["chainChanged","accountsChanged"]}},C={requiredNamespaces:{},optionalNamespaces:O,relays:[{protocol:"irn"}],pairingTopic:I,proposer:{publicKey:E,metadata:this.client.metadata},expiryTimestamp:Nr(tn.wc_sessionPropose.req.ttl),id:yo()},{done:S,resolve:T,reject:N}=Ol(m,"Request expired"),R=yo(),B=kt("session_connect",C.id),A=kt("session_request",R),P=async({error:x,session:j})=>{this.events.off(A,k),x?N(x):j&&T({session:j})},k=async x=>{var j,D,M;if(await this.deletePendingAuthRequest(R,{message:"fulfilled",code:0}),x.error){const X=ar("WC_METHOD_UNSUPPORTED","wc_sessionAuthenticate");return x.error.code===X.code?void 0:(this.events.off(B,P),N(x.error.message))}await this.deleteProposal(C.id),this.events.off(B,P);const{cacaos:L,responder:H}=x.result,z=[],V=[];for(const X of L){await IB({cacao:X,projectId:this.client.core.projectId})||(this.client.logger.error(X,"Signature verification failed"),N(ar("SESSION_SETTLEMENT_FAILED","Signature verification failed")));const{p:oe}=X,te=d_(oe.resources),fe=[AT(oe.iss)],Se=Q_(oe.iss);if(te){const le=SB(te),we=TB(te);z.push(...le),fe.push(...we)}for(const le of fe)V.push(`${le}:${Se}`)}const G=await this.client.core.crypto.generateSharedKey(E,H.publicKey);let ee;z.length>0&&(ee={topic:G,acknowledged:!0,self:{publicKey:E,metadata:this.client.metadata},peer:H,controller:H.publicKey,expiry:Nr(gf),requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:I,namespaces:XB([...new Set(z)],[...new Set(V)]),transportType:o},await this.client.core.relayer.subscribe(G,{transportType:o}),await this.client.session.set(G,ee),I&&await this.client.core.pairing.updateMetadata({topic:I,metadata:H.metadata}),ee=this.client.session.get(G)),(j=this.client.metadata.redirect)!=null&&j.linkMode&&(D=H.metadata.redirect)!=null&&D.linkMode&&(M=H.metadata.redirect)!=null&&M.universal&&n&&(this.client.core.addLinkModeSupportedApp(H.metadata.redirect.universal),this.client.session.update(G,{transportType:er.link_mode})),T({auths:L,session:ee})};this.events.once(B,P),this.events.once(A,k);let U;try{if(i){const x=Fi("wc_sessionAuthenticate",_,R);this.client.core.history.set(I,x);const j=await this.client.core.crypto.encode("",x,{type:v0,encoding:Xc});U=Pb(n,I,j)}else await Promise.all([this.sendRequest({topic:I,method:"wc_sessionAuthenticate",params:_,expiry:r.expiry,throwOnFailedPublish:!0,clientRpcId:R}),this.sendRequest({topic:I,method:"wc_sessionPropose",params:C,expiry:tn.wc_sessionPropose.req.ttl,throwOnFailedPublish:!0,clientRpcId:C.id})])}catch(x){throw this.events.off(B,P),this.events.off(A,k),x}return await this.setProposal(C.id,C),await this.setAuthRequest(R,{request:rn(Nt({},_),{verifyContext:{}}),pairingTopic:I,transportType:o}),{uri:U??v,response:S}}),he(this,"approveSessionAuthenticate",async r=>{const{id:n,auths:s}=r,i=this.client.core.eventClient.createEvent({properties:{topic:n.toString(),trace:[nl.authenticated_session_approve_started]}});try{this.isInitialized()}catch(y){throw i.setError(sg.no_internet_connection),y}const o=this.getPendingAuthRequest(n);if(!o)throw i.setError(sg.authenticated_session_pending_request_not_found),new Error(`Could not find pending auth request with id ${n}`);const a=o.transportType||er.relay;a===er.relay&&await this.confirmOnlineStateOrThrow();const c=o.requester.publicKey,u=await this.client.core.crypto.generateKeyPair(),l=f_(c),d={type:nc,receiverPublicKey:c,senderPublicKey:u},f=[],g=[];for(const y of s){if(!await IB({cacao:y,projectId:this.client.core.projectId})){i.setError(sg.invalid_cacao);const b=ar("SESSION_SETTLEMENT_FAILED","Signature verification failed");throw await this.sendError({id:n,topic:l,error:b,encodeOpts:d}),new Error(b.message)}i.addTrace(nl.cacaos_verified);const{p:w}=y,I=d_(w.resources),v=[AT(w.iss)],E=Q_(w.iss);if(I){const b=SB(I),m=TB(I);f.push(...b),v.push(...m)}for(const b of v)g.push(`${b}:${E}`)}const h=await this.client.core.crypto.generateSharedKey(u,c);i.addTrace(nl.create_authenticated_session_topic);let p;if((f==null?void 0:f.length)>0){p={topic:h,acknowledged:!0,self:{publicKey:u,metadata:this.client.metadata},peer:{publicKey:c,metadata:o.requester.metadata},controller:c,expiry:Nr(gf),authentication:s,requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:o.pairingTopic,namespaces:XB([...new Set(f)],[...new Set(g)]),transportType:a},i.addTrace(nl.subscribing_authenticated_session_topic);try{await this.client.core.relayer.subscribe(h,{transportType:a})}catch(y){throw i.setError(sg.subscribe_authenticated_session_topic_failure),y}i.addTrace(nl.subscribe_authenticated_session_topic_success),await this.client.session.set(h,p),i.addTrace(nl.store_authenticated_session),await this.client.core.pairing.updateMetadata({topic:o.pairingTopic,metadata:o.requester.metadata})}i.addTrace(nl.publishing_authenticated_session_approve);try{await this.sendResult({topic:l,id:n,result:{cacaos:s,responder:{publicKey:u,metadata:this.client.metadata}},encodeOpts:d,throwOnFailedPublish:!0,appLink:this.getAppLinkIfEnabled(o.requester.metadata,a)})}catch(y){throw i.setError(sg.authenticated_session_approve_publish_failure),y}return await this.client.auth.requests.delete(n,{message:"fulfilled",code:0}),await this.client.core.pairing.activate({topic:o.pairingTopic}),this.client.core.eventClient.deleteEvent({eventId:i.eventId}),{session:p}}),he(this,"rejectSessionAuthenticate",async r=>{this.isInitialized();const{id:n,reason:s}=r,i=this.getPendingAuthRequest(n);if(!i)throw new Error(`Could not find pending auth request with id ${n}`);i.transportType===er.relay&&await this.confirmOnlineStateOrThrow();const o=i.requester.publicKey,a=await this.client.core.crypto.generateKeyPair(),c=f_(o),u={type:nc,receiverPublicKey:o,senderPublicKey:a};await this.sendError({id:n,topic:c,error:s,encodeOpts:u,rpcOpts:tn.wc_sessionAuthenticate.reject,appLink:this.getAppLinkIfEnabled(i.requester.metadata,i.transportType)}),await this.client.auth.requests.delete(n,{message:"rejected",code:0}),await this.deleteProposal(n)}),he(this,"formatAuthMessage",r=>{this.isInitialized();const{request:n,iss:s}=r;return gO(n,s)}),he(this,"processRelayMessageCache",()=>{setTimeout(async()=>{if(this.relayMessageCache.length!==0)for(;this.relayMessageCache.length>0;)try{const r=this.relayMessageCache.shift();r&&await this.onRelayMessage(r)}catch(r){this.client.logger.error(r)}},50)}),he(this,"cleanupDuplicatePairings",async r=>{if(r.pairingTopic)try{const n=this.client.core.pairing.pairings.get(r.pairingTopic),s=this.client.core.pairing.pairings.getAll().filter(i=>{var o,a;return((o=i.peerMetadata)==null?void 0:o.url)&&((a=i.peerMetadata)==null?void 0:a.url)===r.peer.metadata.url&&i.topic&&i.topic!==n.topic});if(s.length===0)return;this.client.logger.info(`Cleaning up ${s.length} duplicate pairing(s)`),await Promise.all(s.map(i=>this.client.core.pairing.disconnect({topic:i.topic}))),this.client.logger.info("Duplicate pairings clean up finished")}catch(n){this.client.logger.error(n)}}),he(this,"deleteSession",async r=>{var n;const{topic:s,expirerHasDeleted:i=!1,emitEvent:o=!0,id:a=0}=r,{self:c}=this.client.session.get(s);await this.client.core.relayer.unsubscribe(s),await this.client.session.delete(s,ar("USER_DISCONNECTED")),this.addToRecentlyDeleted(s,"session"),this.client.core.crypto.keychain.has(c.publicKey)&&await this.client.core.crypto.deleteKeyPair(c.publicKey),this.client.core.crypto.keychain.has(s)&&await this.client.core.crypto.deleteSymKey(s),i||this.client.core.expirer.del(s),this.client.core.storage.removeItem(U6).catch(u=>this.client.logger.warn(u)),s===((n=this.sessionRequestQueue.queue[0])==null?void 0:n.topic)&&(this.sessionRequestQueue.state=lo.idle),await Promise.all(this.getPendingSessionRequests().filter(u=>u.topic===s).map(u=>this.deletePendingSessionRequest(u.id,ar("USER_DISCONNECTED")))),o&&this.client.events.emit("session_delete",{id:a,topic:s})}),he(this,"deleteProposal",async(r,n)=>{if(n)try{const s=this.client.proposal.get(r),i=this.client.core.eventClient.getEvent({topic:s.pairingTopic});i==null||i.setError(rl.proposal_expired)}catch{}await Promise.all([this.client.proposal.delete(r,ar("USER_DISCONNECTED")),n?Promise.resolve():this.client.core.expirer.del(r)]),this.addToRecentlyDeleted(r,"proposal")}),he(this,"deletePendingSessionRequest",async(r,n,s=!1)=>{await Promise.all([this.client.pendingRequest.delete(r,n),s?Promise.resolve():this.client.core.expirer.del(r)]),this.addToRecentlyDeleted(r,"request"),this.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter(i=>i.id!==r),s&&(this.sessionRequestQueue.state=lo.idle,this.client.events.emit("session_request_expire",{id:r}))}),he(this,"deletePendingAuthRequest",async(r,n,s=!1)=>{await Promise.all([this.client.auth.requests.delete(r,n),s?Promise.resolve():this.client.core.expirer.del(r)])}),he(this,"setExpiry",async(r,n)=>{this.client.session.keys.includes(r)&&(this.client.core.expirer.set(r,n),await this.client.session.update(r,{expiry:n}))}),he(this,"setProposal",async(r,n)=>{this.client.core.expirer.set(r,Nr(tn.wc_sessionPropose.req.ttl)),await this.client.proposal.set(r,n)}),he(this,"setAuthRequest",async(r,n)=>{const{request:s,pairingTopic:i,transportType:o=er.relay}=n;this.client.core.expirer.set(r,s.expiryTimestamp),await this.client.auth.requests.set(r,{authPayload:s.authPayload,requester:s.requester,expiryTimestamp:s.expiryTimestamp,id:r,pairingTopic:i,verifyContext:s.verifyContext,transportType:o})}),he(this,"setPendingSessionRequest",async r=>{const{id:n,topic:s,params:i,verifyContext:o}=r,a=i.request.expiryTimestamp||Nr(tn.wc_sessionRequest.req.ttl);this.client.core.expirer.set(n,a),await this.client.pendingRequest.set(n,{id:n,topic:s,params:i,verifyContext:o})}),he(this,"sendRequest",async r=>{const{topic:n,method:s,params:i,expiry:o,relayRpcId:a,clientRpcId:c,throwOnFailedPublish:u,appLink:l,tvf:d,publishOpts:f={}}=r,g=Fi(s,i,c);let h;const p=!!l;try{const I=p?Xc:ps;h=await this.client.core.crypto.encode(n,g,{encoding:I})}catch(I){throw await this.cleanup(),this.client.logger.error(`sendRequest() -> core.crypto.encode() for topic ${n} failed`),I}let y;if(nge.includes(s)){const I=ui(JSON.stringify(g)),v=ui(h);y=await this.client.core.verify.register({id:v,decryptedId:I})}const w=Nt(Nt({},tn[s].req),f);if(w.attestation=y,o&&(w.ttl=o),a&&(w.id=a),this.client.core.history.set(n,g),p){const I=Pb(l,n,h);await We.Linking.openURL(I,this.client.name)}else w.tvf=rn(Nt({},d),{correlationId:g.id}),u?(w.internal=rn(Nt({},w.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(n,h,w)):this.client.core.relayer.publish(n,h,w).catch(I=>this.client.logger.error(I));return g.id}),he(this,"sendProposeSession",async r=>{const{proposal:n,publishOpts:s}=r,i=Fi("wc_sessionPropose",n,n.id);this.client.core.history.set(n.pairingTopic,i);const o=await this.client.core.crypto.encode(n.pairingTopic,i,{encoding:ps}),a=ui(JSON.stringify(i)),c=ui(o),u=await this.client.core.verify.register({id:c,decryptedId:a});await this.client.core.relayer.publishCustom({payload:{pairingTopic:n.pairingTopic,sessionProposal:o},opts:rn(Nt({},s),{publishMethod:"wc_proposeSession",attestation:u})})}),he(this,"sendApproveSession",async r=>{const{sessionTopic:n,pairingProposalResponse:s,proposal:i,sessionSettleRequest:o,publishOpts:a}=r,c=Ry(i.id,s),u=await this.client.core.crypto.encode(i.pairingTopic,c,{encoding:ps}),l=Fi("wc_sessionSettle",o,a==null?void 0:a.id),d=await this.client.core.crypto.encode(n,l,{encoding:ps});this.client.core.history.set(n,l),await this.client.core.relayer.publishCustom({payload:{sessionTopic:n,pairingTopic:i.pairingTopic,sessionProposalResponse:u,sessionSettlementRequest:d},opts:rn(Nt({},a),{publishMethod:"wc_approveSession"})})}),he(this,"sendResult",async r=>{const{id:n,topic:s,result:i,throwOnFailedPublish:o,encodeOpts:a,appLink:c}=r,u=Ry(n,i);let l;const d=c&&typeof(We==null?void 0:We.Linking)<"u";try{const h=d?Xc:ps;l=await this.client.core.crypto.encode(s,u,rn(Nt({},a||{}),{encoding:h}))}catch(h){throw await this.cleanup(),this.client.logger.error(`sendResult() -> core.crypto.encode() for topic ${s} failed`),h}let f,g;try{f=await this.client.core.history.get(s,n);const h=f.request;try{g=this.getTVFParams(n,h.params,i)}catch(p){this.client.logger.warn(`sendResult() -> getTVFParams() failed: ${p==null?void 0:p.message}`)}}catch(h){throw this.client.logger.error(`sendResult() -> history.get(${s}, ${n}) failed`),h}if(d){const h=Pb(c,s,l);await We.Linking.openURL(h,this.client.name)}else{const h=f.request.method,p=tn[h].res;p.tvf=rn(Nt({},g),{correlationId:n}),o?(p.internal=rn(Nt({},p.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(s,l,p)):this.client.core.relayer.publish(s,l,p).catch(y=>this.client.logger.error(y))}await this.client.core.history.resolve(u)}),he(this,"sendError",async r=>{const{id:n,topic:s,error:i,encodeOpts:o,rpcOpts:a,appLink:c}=r,u=JA(n,i);let l;const d=c&&typeof(We==null?void 0:We.Linking)<"u";try{const g=d?Xc:ps;l=await this.client.core.crypto.encode(s,u,rn(Nt({},o||{}),{encoding:g}))}catch(g){throw await this.cleanup(),this.client.logger.error(`sendError() -> core.crypto.encode() for topic ${s} failed`),g}let f;try{f=await this.client.core.history.get(s,n)}catch(g){throw this.client.logger.error(`sendError() -> history.get(${s}, ${n}) failed`),g}if(d){const g=Pb(c,s,l);await We.Linking.openURL(g,this.client.name)}else{const g=f.request.method,h=a||tn[g].res;this.client.core.relayer.publish(s,l,h)}await this.client.core.history.resolve(u)}),he(this,"cleanup",async()=>{const r=[],n=[];this.client.session.getAll().forEach(s=>{let i=!1;Po(s.expiry)&&(i=!0),this.client.core.crypto.keychain.has(s.topic)||(i=!0),i&&r.push(s.topic)}),this.client.proposal.getAll().forEach(s=>{Po(s.expiryTimestamp)&&n.push(s.id)}),await Promise.all([...r.map(s=>this.deleteSession({topic:s})),...n.map(s=>this.deleteProposal(s))])}),he(this,"onProviderMessageEvent",async r=>{!this.initialized||this.relayMessageCache.length>0?this.relayMessageCache.push(r):await this.onRelayMessage(r)}),he(this,"onRelayEventRequest",async r=>{this.requestQueue.queue.push(r),await this.processRequestsQueue()}),he(this,"processRequestsQueue",async()=>{if(this.requestQueue.state===lo.active){this.client.logger.info("Request queue already active, skipping...");return}for(this.client.logger.info(`Request queue starting with ${this.requestQueue.queue.length} requests`);this.requestQueue.queue.length>0;){this.requestQueue.state=lo.active;const r=this.requestQueue.queue.shift();if(r)try{await this.processRequest(r)}catch(n){this.client.logger.warn(n)}}this.requestQueue.state=lo.idle}),he(this,"processRequest",async r=>{const{topic:n,payload:s,attestation:i,transportType:o,encryptedId:a}=r,c=s.method;if(!this.shouldIgnorePairingRequest({topic:n,requestMethod:c}))switch(c){case"wc_sessionPropose":return await this.onSessionProposeRequest({topic:n,payload:s,attestation:i,encryptedId:a});case"wc_sessionSettle":return await this.onSessionSettleRequest(n,s);case"wc_sessionUpdate":return await this.onSessionUpdateRequest(n,s);case"wc_sessionExtend":return await this.onSessionExtendRequest(n,s);case"wc_sessionPing":return await this.onSessionPingRequest(n,s);case"wc_sessionDelete":return await this.onSessionDeleteRequest(n,s);case"wc_sessionRequest":return await this.onSessionRequest({topic:n,payload:s,attestation:i,encryptedId:a,transportType:o});case"wc_sessionEvent":return await this.onSessionEventRequest(n,s);case"wc_sessionAuthenticate":return await this.onSessionAuthenticateRequest({topic:n,payload:s,attestation:i,encryptedId:a,transportType:o});default:return this.client.logger.info(`Unsupported request method ${c}`)}}),he(this,"onRelayEventResponse",async r=>{const{topic:n,payload:s,transportType:i}=r,o=(await this.client.core.history.get(n,s.id)).request.method;switch(o){case"wc_sessionPropose":return this.onSessionProposeResponse(n,s,i);case"wc_sessionSettle":return this.onSessionSettleResponse(n,s);case"wc_sessionUpdate":return this.onSessionUpdateResponse(n,s);case"wc_sessionExtend":return this.onSessionExtendResponse(n,s);case"wc_sessionPing":return this.onSessionPingResponse(n,s);case"wc_sessionRequest":return this.onSessionRequestResponse(n,s);case"wc_sessionAuthenticate":return this.onSessionAuthenticateResponse(n,s);default:return this.client.logger.info(`Unsupported response method ${o}`)}}),he(this,"onRelayEventUnknownPayload",r=>{const{topic:n}=r,{message:s}=_e("MISSING_OR_INVALID",`Decoded payload on topic ${n} is not identifiable as a JSON-RPC request or a response.`);throw new Error(s)}),he(this,"shouldIgnorePairingRequest",r=>{const{topic:n,requestMethod:s}=r,i=this.expectedPairingMethodMap.get(n);return!i||i.includes(s)?!1:!!(i.includes("wc_sessionAuthenticate")&&this.client.events.listenerCount("session_authenticate")>0)}),he(this,"onSessionProposeRequest",async r=>{const{topic:n,payload:s,attestation:i,encryptedId:o}=r,{params:a,id:c}=s;try{const u=this.client.core.eventClient.getEvent({topic:n});this.client.events.listenerCount("session_proposal")===0&&(console.warn("No listener for session_proposal event"),u==null||u.setError(Sa.proposal_listener_not_found)),this.isValidConnect(Nt({},s.params));const l=a.expiryTimestamp||Nr(tn.wc_sessionPropose.req.ttl),d=Nt({id:c,pairingTopic:n,expiryTimestamp:l,attestation:i,encryptedId:o},a);await this.setProposal(c,d);const f=await this.getVerifyContext({attestationId:i,hash:ui(JSON.stringify(s)),encryptedId:o,metadata:d.proposer.metadata});u==null||u.addTrace(mo.emit_session_proposal),this.client.events.emit("session_proposal",{id:c,params:d,verifyContext:f})}catch(u){await this.sendError({id:c,topic:n,error:u,rpcOpts:tn.wc_sessionPropose.autoReject}),this.client.logger.error(u)}}),he(this,"onSessionProposeResponse",async(r,n,s)=>{const{id:i}=n;if(bo(n)){const{result:o}=n;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:o});const a=this.client.proposal.get(i);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:a});const c=a.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:c});const u=o.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:u});const l=await this.client.core.crypto.generateSharedKey(c,u);this.pendingSessions.set(i,{sessionTopic:l,pairingTopic:r,proposalId:i,publicKey:c});const d=await this.client.core.relayer.subscribe(l,{transportType:s});this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:d}),await this.client.core.pairing.activate({topic:r})}else if(li(n)){await this.deleteProposal(i);const o=kt("session_connect",i);if(this.events.listenerCount(o)===0)throw new Error(`emitting ${o} without any listeners, 954`);this.events.emit(o,{error:n.error})}}),he(this,"onSessionSettleRequest",async(r,n)=>{const{id:s,params:i}=n;try{this.isValidSessionSettleRequest(i);const{relay:o,controller:a,expiry:c,namespaces:u,sessionProperties:l,scopedProperties:d,sessionConfig:f,proposalRequestsResponses:g}=n.params,h=[...this.pendingSessions.values()].find(w=>w.sessionTopic===r);if(!h)return this.client.logger.error(`Pending session not found for topic ${r}`);const p=this.client.proposal.get(h.proposalId),y=rn(Nt(Nt(Nt({topic:r,relay:o,expiry:c,namespaces:u,acknowledged:!0,pairingTopic:h.pairingTopic,requiredNamespaces:p.requiredNamespaces,optionalNamespaces:p.optionalNamespaces,controller:a.publicKey,self:{publicKey:h.publicKey,metadata:this.client.metadata},peer:{publicKey:a.publicKey,metadata:a.metadata}},l&&{sessionProperties:l}),d&&{scopedProperties:d}),f&&{sessionConfig:f}),{transportType:er.relay,authentication:g==null?void 0:g.authentication,walletPayResult:g==null?void 0:g.walletPay});await this.client.session.set(y.topic,y),await this.setExpiry(y.topic,y.expiry),await this.client.core.pairing.updateMetadata({topic:h.pairingTopic,metadata:y.peer.metadata}),this.pendingSessions.delete(h.proposalId),this.deleteProposal(h.proposalId,!1),this.cleanupDuplicatePairings(y),await this.sendResult({id:n.id,topic:r,throwOnFailedPublish:!0,result:!0}),this.client.events.emit("session_connect",{session:y}),this.events.emit(kt("session_connect",h.proposalId),{session:y})}catch(o){await this.sendError({id:s,topic:r,error:o}),this.client.logger.error(o)}}),he(this,"onSessionSettleResponse",async(r,n)=>{const{id:s}=n;bo(n)?(await this.client.session.update(r,{acknowledged:!0}),this.events.emit(kt("session_approve",s),{})):li(n)&&(await this.client.session.delete(r,ar("USER_DISCONNECTED")),this.events.emit(kt("session_approve",s),{error:n.error}))}),he(this,"onSessionUpdateRequest",async(r,n)=>{const{params:s,id:i}=n;try{const o=`${r}_session_update`,a=rg.get(o);if(a&&this.isRequestOutOfSync(a,i)){this.client.logger.warn(`Discarding out of sync request - ${i}`),this.sendError({id:i,topic:r,error:ar("INVALID_UPDATE_REQUEST")});return}this.isValidUpdate(Nt({topic:r},s));try{rg.set(o,i),await this.client.session.update(r,{namespaces:s.namespaces}),await this.sendResult({id:i,topic:r,result:!0})}catch(c){throw rg.delete(o),c}this.client.events.emit("session_update",{id:i,topic:r,params:s})}catch(o){await this.sendError({id:i,topic:r,error:o}),this.client.logger.error(o)}}),he(this,"isRequestOutOfSync",(r,n)=>n.toString().slice(0,-3)<r.toString().slice(0,-3)),he(this,"onSessionUpdateResponse",(r,n)=>{const{id:s}=n,i=kt("session_update",s);if(this.events.listenerCount(i)===0)throw new Error(`emitting ${i} without any listeners`);bo(n)?this.events.emit(kt("session_update",s),{}):li(n)&&this.events.emit(kt("session_update",s),{error:n.error})}),he(this,"onSessionExtendRequest",async(r,n)=>{const{id:s}=n;try{this.isValidExtend({topic:r}),await this.setExpiry(r,Nr(gf)),await this.sendResult({id:s,topic:r,result:!0}),this.client.events.emit("session_extend",{id:s,topic:r})}catch(i){await this.sendError({id:s,topic:r,error:i}),this.client.logger.error(i)}}),he(this,"onSessionExtendResponse",(r,n)=>{const{id:s}=n,i=kt("session_extend",s);if(this.events.listenerCount(i)===0)throw new Error(`emitting ${i} without any listeners`);bo(n)?this.events.emit(kt("session_extend",s),{}):li(n)&&this.events.emit(kt("session_extend",s),{error:n.error})}),he(this,"onSessionPingRequest",async(r,n)=>{const{id:s}=n;try{this.isValidPing({topic:r}),await this.sendResult({id:s,topic:r,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_ping",{id:s,topic:r})}catch(i){await this.sendError({id:s,topic:r,error:i}),this.client.logger.error(i)}}),he(this,"onSessionPingResponse",(r,n)=>{const{id:s}=n,i=kt("session_ping",s);setTimeout(()=>{if(this.events.listenerCount(i)===0)throw new Error(`emitting ${i} without any listeners 2176`);bo(n)?this.events.emit(kt("session_ping",s),{}):li(n)&&this.events.emit(kt("session_ping",s),{error:n.error})},500)}),he(this,"onSessionDeleteRequest",async(r,n)=>{const{id:s}=n;try{await this.isValidDisconnect({topic:r,reason:n.params}),this.cleanupPendingSentRequestsForTopic({topic:r,error:ar("USER_DISCONNECTED")}),await this.deleteSession({topic:r,id:s})}catch(i){this.client.logger.error(i)}}),he(this,"onSessionRequest",async r=>{var n,s,i;const{topic:o,payload:a,attestation:c,encryptedId:u,transportType:l}=r,{id:d,params:f}=a;try{await this.isValidRequest(Nt({topic:o},f));const g=this.client.session.get(o),h=await this.getVerifyContext({attestationId:c,hash:ui(JSON.stringify(Fi("wc_sessionRequest",f,d))),encryptedId:u,metadata:g.peer.metadata,transportType:l}),p={id:d,topic:o,params:f,verifyContext:h};await this.setPendingSessionRequest(p),l===er.link_mode&&(n=g.peer.metadata.redirect)!=null&&n.universal&&this.client.core.addLinkModeSupportedApp((s=g.peer.metadata.redirect)==null?void 0:s.universal),(i=this.client.signConfig)!=null&&i.disableRequestQueue?this.emitSessionRequest(p):(this.addSessionRequestToSessionRequestQueue(p),this.processSessionRequestQueue())}catch(g){await this.sendError({id:d,topic:o,error:g}),this.client.logger.error(g)}}),he(this,"onSessionRequestResponse",(r,n)=>{const{id:s}=n,i=kt("session_request",s);if(this.events.listenerCount(i)===0)throw new Error(`emitting ${i} without any listeners`);bo(n)?this.events.emit(kt("session_request",s),{result:n.result}):li(n)&&this.events.emit(kt("session_request",s),{error:n.error})}),he(this,"onSessionEventRequest",async(r,n)=>{const{id:s,params:i}=n;try{const o=`${r}_session_event_${i.event.name}`,a=rg.get(o);if(a&&this.isRequestOutOfSync(a,s)){this.client.logger.info(`Discarding out of sync request - ${s}`);return}this.isValidEmit(Nt({topic:r},i)),this.client.events.emit("session_event",{id:s,topic:r,params:i}),rg.set(o,s)}catch(o){await this.sendError({id:s,topic:r,error:o}),this.client.logger.error(o)}}),he(this,"onSessionAuthenticateResponse",(r,n)=>{const{id:s}=n;this.client.logger.trace({type:"method",method:"onSessionAuthenticateResponse",topic:r,payload:n}),bo(n)?this.events.emit(kt("session_request",s),{result:n.result}):li(n)&&this.events.emit(kt("session_request",s),{error:n.error})}),he(this,"onSessionAuthenticateRequest",async r=>{var n;const{topic:s,payload:i,attestation:o,encryptedId:a,transportType:c}=r;try{const{requester:u,authPayload:l,expiryTimestamp:d}=i.params,f=await this.getVerifyContext({attestationId:o,hash:ui(JSON.stringify(i)),encryptedId:a,metadata:u.metadata,transportType:c}),g={requester:u,pairingTopic:s,id:i.id,authPayload:l,verifyContext:f,expiryTimestamp:d};await this.setAuthRequest(i.id,{request:g,pairingTopic:s,transportType:c}),c===er.link_mode&&(n=u.metadata.redirect)!=null&&n.universal&&this.client.core.addLinkModeSupportedApp(u.metadata.redirect.universal),this.client.events.emit("session_authenticate",{topic:s,params:i.params,id:i.id,verifyContext:f})}catch(u){this.client.logger.error(u);const l=i.params.requester.publicKey,d=await this.client.core.crypto.generateKeyPair(),f=this.getAppLinkIfEnabled(i.params.requester.metadata,c),g={type:nc,receiverPublicKey:l,senderPublicKey:d};await this.sendError({id:i.id,topic:s,error:u,encodeOpts:g,rpcOpts:tn.wc_sessionAuthenticate.autoReject,appLink:f})}}),he(this,"addSessionRequestToSessionRequestQueue",r=>{this.sessionRequestQueue.queue.push(r)}),he(this,"cleanupAfterResponse",r=>{this.deletePendingSessionRequest(r.response.id,{message:"fulfilled",code:0}),setTimeout(()=>{this.sessionRequestQueue.state=lo.idle,this.processSessionRequestQueue()},ye.toMiliseconds(this.requestQueueDelay))}),he(this,"cleanupPendingSentRequestsForTopic",({topic:r,error:n})=>{const s=this.client.core.history.pending;s.length>0&&s.filter(i=>i.topic===r&&i.request.method==="wc_sessionRequest").forEach(i=>{this.events.emit(kt("session_request",i.request.id),{error:n})})}),he(this,"processSessionRequestQueue",()=>{if(this.sessionRequestQueue.state===lo.active){this.client.logger.info("session request queue is already active.");return}const r=this.sessionRequestQueue.queue[0];if(!r){this.client.logger.info("session request queue is empty.");return}try{this.emitSessionRequest(r)}catch(n){this.client.logger.error(n)}}),he(this,"emitSessionRequest",r=>{if(this.emittedSessionRequests.has(r.id)){this.client.logger.warn({id:r.id},`Skipping emitting \`session_request\` event for duplicate request. id: ${r.id}`);return}this.sessionRequestQueue.state=lo.active,this.emittedSessionRequests.add(r.id),this.client.events.emit("session_request",r)}),he(this,"onPairingCreated",r=>{if(r.methods&&this.expectedPairingMethodMap.set(r.topic,r.methods),r.active)return;const n=this.client.proposal.getAll().find(s=>s.pairingTopic===r.topic);n&&this.onSessionProposeRequest({topic:r.topic,payload:Fi("wc_sessionPropose",rn(Nt({},n),{requiredNamespaces:n.requiredNamespaces,optionalNamespaces:n.optionalNamespaces,relays:n.relays,proposer:n.proposer,sessionProperties:n.sessionProperties,scopedProperties:n.scopedProperties}),n.id),attestation:n.attestation,encryptedId:n.encryptedId})}),he(this,"isValidConnect",async r=>{if(!cs(r)){const{message:u}=_e("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(r)}`);throw new Error(u)}const{pairingTopic:n,requiredNamespaces:s,optionalNamespaces:i,sessionProperties:o,scopedProperties:a,relays:c}=r;if(Gr(n)||await this.isValidPairingTopic(n),!wle(c)){const{message:u}=_e("MISSING_OR_INVALID",`connect() relays: ${c}`);throw new Error(u)}if(s&&!Gr(s)&&$o(s)!==0){const u="requiredNamespaces are deprecated and are automatically assigned to optionalNamespaces";["fatal","error","silent"].includes(this.client.logger.level)?console.warn(u):this.client.logger.warn(u),this.validateNamespaces(s,"requiredNamespaces")}if(i&&!Gr(i)&&$o(i)!==0&&this.validateNamespaces(i,"optionalNamespaces"),o&&!Gr(o)&&this.validateSessionProps(o,"sessionProperties"),a&&!Gr(a)){this.validateSessionProps(a,"scopedProperties");const u=Object.keys(s||{}).concat(Object.keys(i||{}));if(!Object.keys(a).every(l=>u.includes(l.split(":")[0])))throw new Error(`Scoped properties must be a subset of required/optional namespaces, received: ${JSON.stringify(a)}, required/optional namespaces: ${JSON.stringify(u)}`)}}),he(this,"validateNamespaces",(r,n)=>{const s=ble(r,"connect()",n);if(s)throw new Error(s.message)}),he(this,"isValidApprove",async r=>{if(!cs(r))throw new Error(_e("MISSING_OR_INVALID",`approve() params: ${r}`).message);const{id:n,namespaces:s,relayProtocol:i,sessionProperties:o,scopedProperties:a}=r;this.checkRecentlyDeleted(n),await this.isValidProposalId(n);const c=this.client.proposal.get(n),u=EI(s,"approve()");if(u)throw new Error(u.message);const l=r6(c.requiredNamespaces,s,"approve()");if(l)throw new Error(l.message);if(!xr(i,!0)){const{message:d}=_e("MISSING_OR_INVALID",`approve() relayProtocol: ${i}`);throw new Error(d)}if(o&&!Gr(o)&&this.validateSessionProps(o,"sessionProperties"),a&&!Gr(a)){this.validateSessionProps(a,"scopedProperties");const d=new Set(Object.keys(s));if(!Object.keys(a).every(f=>d.has(f.split(":")[0])))throw new Error(`Scoped properties must be a subset of approved namespaces, received: ${JSON.stringify(a)}, approved namespaces: ${Array.from(d).join(", ")}`)}}),he(this,"isValidReject",async r=>{if(!cs(r)){const{message:i}=_e("MISSING_OR_INVALID",`reject() params: ${r}`);throw new Error(i)}const{id:n,reason:s}=r;if(this.checkRecentlyDeleted(n),await this.isValidProposalId(n),!vle(s)){const{message:i}=_e("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(s)}`);throw new Error(i)}}),he(this,"isValidSessionSettleRequest",r=>{if(!cs(r)){const{message:u}=_e("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${r}`);throw new Error(u)}const{relay:n,controller:s,namespaces:i,expiry:o}=r;if(!mH(n)){const{message:u}=_e("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(u)}const a=fle(s,"onSessionSettleRequest()");if(a)throw new Error(a.message);const c=EI(i,"onSessionSettleRequest()");if(c)throw new Error(c.message);if(Po(o)){const{message:u}=_e("EXPIRED","onSessionSettleRequest()");throw new Error(u)}}),he(this,"isValidUpdate",async r=>{if(!cs(r)){const{message:c}=_e("MISSING_OR_INVALID",`update() params: ${r}`);throw new Error(c)}const{topic:n,namespaces:s}=r;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n);const i=this.client.session.get(n),o=EI(s,"update()");if(o)throw new Error(o.message);const a=r6(i.requiredNamespaces,s,"update()");if(a)throw new Error(a.message)}),he(this,"isValidExtend",async r=>{if(!cs(r)){const{message:s}=_e("MISSING_OR_INVALID",`extend() params: ${r}`);throw new Error(s)}const{topic:n}=r;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n)}),he(this,"isValidRequest",async r=>{if(!cs(r)){const{message:c}=_e("MISSING_OR_INVALID",`request() params: ${r}`);throw new Error(c)}const{topic:n,request:s,chainId:i,expiry:o}=r;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n);const{namespaces:a}=this.client.session.get(n);if(!t6(a,i)){const{message:c}=_e("MISSING_OR_INVALID",`request() chainId: ${i}`);throw new Error(c)}if(!_le(s)){const{message:c}=_e("MISSING_OR_INVALID",`request() ${JSON.stringify(s)}`);throw new Error(c)}if(!Ile(a,i,s.method)){const{message:c}=_e("MISSING_OR_INVALID",`request() method: ${s.method}`);throw new Error(c)}this.validateRequestExpiry(o)}),he(this,"isValidRespond",async r=>{var n;if(!cs(r)){const{message:a}=_e("MISSING_OR_INVALID",`respond() params: ${r}`);throw new Error(a)}const{topic:s,response:i}=r;try{await this.isValidSessionTopic(s)}catch(a){throw(n=r==null?void 0:r.response)!=null&&n.id&&this.cleanupAfterResponse(r),a}if(!Ale(i)){const{message:a}=_e("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(i)}`);throw new Error(a)}const o=this.client.pendingRequest.get(i.id);if(o.topic!==s){const{message:a}=_e("MISMATCHED_TOPIC",`Request response topic mismatch. reqId: ${i.id}, expected topic: ${o.topic}, received topic: ${s}`);throw new Error(a)}}),he(this,"isValidPing",async r=>{if(!cs(r)){const{message:s}=_e("MISSING_OR_INVALID",`ping() params: ${r}`);throw new Error(s)}const{topic:n}=r;await this.isValidSessionOrPairingTopic(n)}),he(this,"isValidEmit",async r=>{if(!cs(r)){const{message:a}=_e("MISSING_OR_INVALID",`emit() params: ${r}`);throw new Error(a)}const{topic:n,event:s,chainId:i}=r;await this.isValidSessionTopic(n);const{namespaces:o}=this.client.session.get(n);if(!t6(o,i)){const{message:a}=_e("MISSING_OR_INVALID",`emit() chainId: ${i}`);throw new Error(a)}if(!Cle(s)){const{message:a}=_e("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(s)}`);throw new Error(a)}if(!Sle(o,i,s.name)){const{message:a}=_e("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(s)}`);throw new Error(a)}}),he(this,"isValidDisconnect",async r=>{if(!cs(r)){const{message:s}=_e("MISSING_OR_INVALID",`disconnect() params: ${r}`);throw new Error(s)}const{topic:n}=r;await this.isValidSessionOrPairingTopic(n)}),he(this,"isValidAuthenticate",r=>{const{chains:n,uri:s,domain:i,nonce:o}=r;if(!Array.isArray(n)||n.length===0)throw new Error("chains is required and must be a non-empty array");if(!xr(s,!1))throw new Error("uri is required parameter");if(!xr(i,!1))throw new Error("domain is required parameter");if(!xr(o,!1))throw new Error("nonce is required parameter");if([...new Set(n.map(c=>rc(c).namespace))].length>1)throw new Error("Multi-namespace requests are not supported. Please request single namespace only.");const{namespace:a}=rc(n[0]);if(a!=="eip155")throw new Error("Only eip155 namespace is supported for authenticated sessions. Please use .connect() for non-eip155 chains.")}),he(this,"getVerifyContext",async r=>{const{attestationId:n,hash:s,encryptedId:i,metadata:o,transportType:a}=r,c={verified:{verifyUrl:o.verifyUrl||km,validation:"UNKNOWN",origin:o.url||""}};try{if(a===er.link_mode){const l=this.getAppLinkIfEnabled(o,a);return c.verified.validation=l&&new URL(l).origin===new URL(o.url).origin?"VALID":"INVALID",c}const u=await this.client.core.verify.resolve({attestationId:n,hash:s,encryptedId:i,verifyUrl:o.verifyUrl});u&&(c.verified.origin=u.origin,c.verified.isScam=u.isScam,c.verified.validation=u.origin===new URL(o.url).origin?"VALID":"INVALID")}catch(u){this.client.logger.warn(u)}return this.client.logger.debug(`Verify context: ${JSON.stringify(c)}`),c}),he(this,"validateSessionProps",(r,n)=>{Object.values(r).forEach((s,i)=>{if(s==null){const{message:o}=_e("MISSING_OR_INVALID",`${n} must contain an existing value for each key. Received: ${s} for key ${Object.keys(r)[i]}`);throw new Error(o)}})}),he(this,"getPendingAuthRequest",r=>{const n=this.client.auth.requests.get(r);return typeof n=="object"?n:void 0}),he(this,"addToRecentlyDeleted",(r,n)=>{if(this.recentlyDeletedMap.set(r,n),this.recentlyDeletedMap.size>=this.recentlyDeletedLimit){let s=0;const i=this.recentlyDeletedLimit/2;for(const o of this.recentlyDeletedMap.keys()){if(s++>=i)break;this.recentlyDeletedMap.delete(o)}}}),he(this,"checkRecentlyDeleted",r=>{const n=this.recentlyDeletedMap.get(r);if(n){const{message:s}=_e("MISSING_OR_INVALID",`Record was recently deleted - ${n}: ${r}`);throw new Error(s)}}),he(this,"isLinkModeEnabled",(r,n)=>{var s,i,o,a,c,u,l,d,f;return!r||n!==er.link_mode?!1:((i=(s=this.client.metadata)==null?void 0:s.redirect)==null?void 0:i.linkMode)===!0&&((a=(o=this.client.metadata)==null?void 0:o.redirect)==null?void 0:a.universal)!==void 0&&((u=(c=this.client.metadata)==null?void 0:c.redirect)==null?void 0:u.universal)!==""&&((l=r==null?void 0:r.redirect)==null?void 0:l.universal)!==void 0&&((d=r==null?void 0:r.redirect)==null?void 0:d.universal)!==""&&((f=r==null?void 0:r.redirect)==null?void 0:f.linkMode)===!0&&this.client.core.linkModeSupportedApps.includes(r.redirect.universal)&&typeof(We==null?void 0:We.Linking)<"u"}),he(this,"getAppLinkIfEnabled",(r,n)=>{var s;return this.isLinkModeEnabled(r,n)?(s=r==null?void 0:r.redirect)==null?void 0:s.universal:void 0}),he(this,"handleLinkModeMessage",({url:r})=>{if(!r||!r.includes("wc_ev")||!r.includes("topic"))return;const n=hB(r,"topic")||"",s=decodeURIComponent(hB(r,"wc_ev")||""),i=this.client.session.keys.includes(n);i&&this.client.session.update(n,{transportType:er.link_mode}),this.client.core.dispatchEnvelope({topic:n,message:s,sessionExists:i})}),he(this,"registerLinkModeListeners",async()=>{var r;if(lO()||Mu()&&(r=this.client.metadata.redirect)!=null&&r.linkMode){const n=We==null?void 0:We.Linking;if(typeof n<"u"){n.addEventListener("url",this.handleLinkModeMessage,this.client.name);const s=await n.getInitialURL();s&&setTimeout(()=>{this.handleLinkModeMessage({url:s})},50)}}}),he(this,"getTVFApproveParams",r=>{try{const n=pH(r.namespaces),s=tle(r.namespaces),i=rle(r.namespaces),o=r.sessionProperties,a=r.scopedProperties;return{approvedChains:n,approvedMethods:s,approvedEvents:i,sessionProperties:o,scopedProperties:a}}catch(n){return this.client.logger.warn(n,"Error getting TVF approve params"),{}}}),he(this,"getTVFParams",(r,n,s)=>{var i,o,a;if(!((i=n.request)!=null&&i.method))return{};const c={correlationId:r,rpcMethods:[n.request.method],chainId:n.chainId};try{const u=this.extractTxHashesFromResult(n.request,s);c.txHashes=u,c.contractAddresses=this.isValidContractData(n.request.params)?[(a=(o=n.request.params)==null?void 0:o[0])==null?void 0:a.to]:[]}catch(u){this.client.logger.warn(u,"Error getting TVF params")}return c}),he(this,"isValidContractData",r=>{var n;if(!r)return!1;try{const s=(r==null?void 0:r.data)||((n=r==null?void 0:r[0])==null?void 0:n.data);if(!s.startsWith("0x"))return!1;const i=s.slice(2);return/^[0-9a-fA-F]*$/.test(i)?i.length%2===0:!1}catch{}return!1}),he(this,"extractTxHashesFromResult",(r,n)=>{var s;try{if(!n)return[];const i=r.method,o=tge[i];if(i==="sui_signTransaction")return[zae(n.transactionBytes)];if(i==="near_signTransaction")return[vB(n)];if(i==="near_signTransactions")return n.map(c=>vB(c));if(i==="xrpl_signTransactionFor"||i==="xrpl_signTransaction")return[(s=n.tx_json)==null?void 0:s.hash];if(i==="polkadot_signTransaction")return[zle({transaction:r.params.transactionPayload,signature:n.signature})];if(i==="algo_signTxn")return sc(n)?n.map(c=>_B(c)):[_B(n)];if(i==="cosmos_signDirect")return[Vae(n)];if(i==="wallet_sendCalls")return Gae(n);if(typeof n=="string")return[n];const a=n[o.key];if(sc(a))return i==="solana_signAllTransactions"?a.map(c=>qae(c)):a;if(typeof a=="string")return[a]}catch(i){this.client.logger.warn(i,"Error extracting tx hashes from result")}return[]})}async processPendingMessageEvents(){try{const e=this.client.session.keys,r=this.client.core.relayer.messages.getWithoutAck(e);for(const[n,s]of Object.entries(r))for(const i of s)try{await this.onProviderMessageEvent({topic:n,message:i,publishedAt:Date.now()})}catch{this.client.logger.warn(`Error processing pending message event for topic: ${n}, message: ${i}`)}}catch(e){this.client.logger.warn(e,"processPendingMessageEvents failed")}}isInitialized(){if(!this.initialized){const{message:e}=_e("NOT_INITIALIZED",this.name);throw new Error(e)}}async confirmOnlineStateOrThrow(){await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(_r.message,e=>{this.onProviderMessageEvent(e)})}async onRelayMessage(e){const{topic:r,message:n,attestation:s,transportType:i}=e,{publicKey:o}=this.client.auth.authKeys.keys.includes(p_)?this.client.auth.authKeys.get(p_):{publicKey:void 0};try{const a=await this.client.core.crypto.decode(r,n,{receiverPublicKey:o,encoding:i===er.link_mode?Xc:ps});CO(a)?(this.client.core.history.set(r,a),await this.onRelayEventRequest({topic:r,payload:a,attestation:s,transportType:i,encryptedId:ui(n)})):QA(a)?(await this.client.core.history.resolve(a),await this.onRelayEventResponse({topic:r,payload:a,transportType:i}),this.client.core.history.delete(r,a.id)):(this.client.logger.error(`onRelayMessage() -> unknown payload: ${JSON.stringify(a)}`),await this.onRelayEventUnknownPayload({topic:r,payload:a,transportType:i})),await this.client.core.relayer.messages.ack(r,n)}catch(a){this.client.logger.error(`onRelayMessage() -> failed to process an inbound message: ${n}`),this.client.logger.error(a)}}registerExpirerEvents(){this.client.core.expirer.on(ti.expired,async e=>{const{topic:r,id:n}=m9(e.target);if(n&&this.client.pendingRequest.keys.includes(n))return await this.deletePendingSessionRequest(n,_e("EXPIRED"),!0);if(n&&this.client.auth.requests.keys.includes(n))return await this.deletePendingAuthRequest(n,_e("EXPIRED"),!0);r?this.client.session.keys.includes(r)&&(await this.deleteSession({topic:r,expirerHasDeleted:!0}),this.client.events.emit("session_expire",{topic:r})):n&&(await this.deleteProposal(n,!0),this.client.events.emit("proposal_expire",{id:n}))})}registerPairingEvents(){this.client.core.pairing.events.on(kl.create,e=>this.onPairingCreated(e)),this.client.core.pairing.events.on(kl.delete,e=>{this.addToRecentlyDeleted(e.topic,"pairing")})}isValidPairingTopic(e){if(!xr(e,!1)){const{message:r}=_e("MISSING_OR_INVALID",`pairing topic should be a string: ${e}`);throw new Error(r)}if(!this.client.core.pairing.pairings.keys.includes(e)){const{message:r}=_e("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw new Error(r)}if(Po(this.client.core.pairing.pairings.get(e).expiry)){const{message:r}=_e("EXPIRED",`pairing topic: ${e}`);throw new Error(r)}}async isValidSessionTopic(e){if(!xr(e,!1)){const{message:r}=_e("MISSING_OR_INVALID",`session topic should be a string: ${e}`);throw new Error(r)}if(this.checkRecentlyDeleted(e),!this.client.session.keys.includes(e)){const{message:r}=_e("NO_MATCHING_KEY",`session topic doesn't exist: ${e}`);throw new Error(r)}if(Po(this.client.session.get(e).expiry)){await this.deleteSession({topic:e});const{message:r}=_e("EXPIRED",`session topic: ${e}`);throw new Error(r)}if(!this.client.core.crypto.keychain.has(e)){const{message:r}=_e("MISSING_OR_INVALID",`session topic does not exist in keychain: ${e}`);throw await this.deleteSession({topic:e}),new Error(r)}}async isValidSessionOrPairingTopic(e){if(this.checkRecentlyDeleted(e),this.client.session.keys.includes(e))await this.isValidSessionTopic(e);else if(this.client.core.pairing.pairings.keys.includes(e))this.isValidPairingTopic(e);else if(xr(e,!1)){const{message:r}=_e("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${e}`);throw new Error(r)}else{const{message:r}=_e("MISSING_OR_INVALID",`session or pairing topic should be a string: ${e}`);throw new Error(r)}}async isValidProposalId(e){if(!Ele(e)){const{message:r}=_e("MISSING_OR_INVALID",`proposal id should be a number: ${e}`);throw new Error(r)}if(!this.client.proposal.keys.includes(e)){const{message:r}=_e("NO_MATCHING_KEY",`proposal id doesn't exist: ${e}`);throw new Error(r)}if(Po(this.client.proposal.get(e).expiryTimestamp)){await this.deleteProposal(e);const{message:r}=_e("EXPIRED",`proposal id: ${e}`);throw new Error(r)}}validateRequestExpiry(e){if(e&&!Ole(e,TI)){const{message:r}=_e("MISSING_OR_INVALID",`request() expiry: ${e}. Expiry must be a number (in seconds) between ${TI.min} and ${TI.max}`);throw new Error(r)}}}class gge extends Yd{constructor(e,r){super(e,r,Qpe,SO),this.core=e,this.logger=r}}let mge=class extends Yd{constructor(e,r){super(e,r,Xpe,SO),this.core=e,this.logger=r}};class yge extends Yd{constructor(e,r){super(e,r,rge,SO,n=>n.id),this.core=e,this.logger=r}}class bge extends Yd{constructor(e,r){super(e,r,oge,eC,()=>p_),this.core=e,this.logger=r}}class wge extends Yd{constructor(e,r){super(e,r,age,eC),this.core=e,this.logger=r}}class Ege extends Yd{constructor(e,r){super(e,r,cge,eC,n=>n.id),this.core=e,this.logger=r}}var vge=Object.defineProperty,_ge=(t,e,r)=>e in t?vge(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,PI=(t,e,r)=>_ge(t,typeof e!="symbol"?e+"":e,r);class Age{constructor(e,r){this.core=e,this.logger=r,PI(this,"authKeys"),PI(this,"pairingTopics"),PI(this,"requests"),this.authKeys=new bge(this.core,this.logger),this.pairingTopics=new wge(this.core,this.logger),this.requests=new Ege(this.core,this.logger)}
35async init(){await this.authKeys.init(),await this.pairingTopics.init(),await this.requests.init()}}var Cge=Object.defineProperty,Ige=(t,e,r)=>e in t?Cge(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,mt=(t,e,r)=>Ige(t,typeof e!="symbol"?e+"":e,r);class TO extends Bee{constructor(e){super(e),mt(this,"protocol",$H),mt(this,"version",LH),mt(this,"name",SI.name),mt(this,"metadata"),mt(this,"core"),mt(this,"logger"),mt(this,"events",new gi.EventEmitter),mt(this,"engine"),mt(this,"session"),mt(this,"proposal"),mt(this,"pendingRequest"),mt(this,"auth"),mt(this,"signConfig"),mt(this,"on",(n,s)=>this.events.on(n,s)),mt(this,"once",(n,s)=>this.events.once(n,s)),mt(this,"off",(n,s)=>this.events.off(n,s)),mt(this,"removeListener",(n,s)=>this.events.removeListener(n,s)),mt(this,"removeAllListeners",n=>this.events.removeAllListeners(n)),mt(this,"connect",async n=>{try{return await this.engine.connect(n)}catch(s){throw this.logger.error(s.message),s}}),mt(this,"pair",async n=>{try{return await this.engine.pair(n)}catch(s){throw this.logger.error(s.message),s}}),mt(this,"approve",async n=>{try{return await this.engine.approve(n)}catch(s){throw this.logger.error(s.message),s}}),mt(this,"reject",async n=>{try{return await this.engine.reject(n)}catch(s){throw this.logger.error(s.message),s}}),mt(this,"update",async n=>{try{return await this.engine.update(n)}catch(s){throw this.logger.error(s.message),s}}),mt(this,"extend",async n=>{try{return await this.engine.extend(n)}catch(s){throw this.logger.error(s.message),s}}),mt(this,"request",async n=>{try{return await this.engine.request(n)}catch(s){throw this.logger.error(s.message),s}}),mt(this,"respond",async n=>{try{return await this.engine.respond(n)}catch(s){throw this.logger.error(s.message),s}}),mt(this,"ping",async n=>{try{return await this.engine.ping(n)}catch(s){throw this.logger.error(s.message),s}}),mt(this,"emit",async n=>{try{return await this.engine.emit(n)}catch(s){throw this.logger.error(s.message),s}}),mt(this,"disconnect",async n=>{try{return await this.engine.disconnect(n)}catch(s){throw this.logger.error(s.message),s}}),mt(this,"find",n=>{try{return this.engine.find(n)}catch(s){throw this.logger.error(s.message),s}}),mt(this,"getPendingSessionRequests",()=>{try{return this.engine.getPendingSessionRequests()}catch(n){throw this.logger.error(n.message),n}}),mt(this,"authenticate",async(n,s)=>{try{return await this.engine.authenticate(n,s)}catch(i){throw this.logger.error(i.message),i}}),mt(this,"formatAuthMessage",n=>{try{return this.engine.formatAuthMessage(n)}catch(s){throw this.logger.error(s.message),s}}),mt(this,"approveSessionAuthenticate",async n=>{try{return await this.engine.approveSessionAuthenticate(n)}catch(s){throw this.logger.error(s.message),s}}),mt(this,"rejectSessionAuthenticate",async n=>{try{return await this.engine.rejectSessionAuthenticate(n)}catch(s){throw this.logger.error(s.message),s}}),this.name=(e==null?void 0:e.name)||SI.name,this.metadata=Doe(e==null?void 0:e.metadata),this.signConfig=e==null?void 0:e.signConfig;const r=_O({logger:(e==null?void 0:e.logger)||SI.logger,name:this.name});this.logger=r,this.core=(e==null?void 0:e.core)||new Jpe(e),this.session=new mge(this.core,this.logger),this.proposal=new gge(this.core,this.logger),this.pendingRequest=new yge(this.core,this.logger),this.engine=new pge(this),this.auth=new Age(this.core,this.logger)}static async init(e){const r=new TO(e);return await r.initialize(),r}get context(){return vs(this.logger)}get pairing(){return this.core.pairing.pairings}async initialize(){this.logger.trace("Initialized");try{await this.core.start(),await this.session.init(),await this.proposal.init(),await this.pendingRequest.init(),await this.auth.init(),await this.engine.init(),this.logger.info("SignClient Initialization Success")}catch(e){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(e.message),e}}}const Sge=TO;var Ob={exports:{}},L6;function Tge(){return L6||(L6=1,function(t,e){var r=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof To<"u"&&To,n=function(){function i(){this.fetch=!1,this.DOMException=r.DOMException}return i.prototype=r,new i}();(function(i){(function(o){var a=typeof i<"u"&&i||typeof self<"u"&&self||typeof To<"u"&&To||{},c={searchParams:"URLSearchParams"in a,iterable:"Symbol"in a&&"iterator"in Symbol,blob:"FileReader"in a&&"Blob"in a&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in a,arrayBuffer:"ArrayBuffer"in a};function u(A){return A&&DataView.prototype.isPrototypeOf(A)}if(c.arrayBuffer)var l=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array
35]"],d=ArrayBuffer.isView||function(A){return A&&l.indexOf(Object.prototype.toString.call(A))>-1};function f(A){if(typeof A!="string"&&(A=String(A)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(A)||A==="")throw new TypeError('Invalid character in header field name: "'+A+'"');return A.toLowerCase()}function g(A){return typeof A!="string"&&(A=String(A)),A}function h(A){var P={next:function(){var k=A.shift();return{done:k===void 0,value:k}}};return c.iterable&&(P[Symbol.iterator]=function(){return P}),P}function p(A){this.map={},A instanceof p?A.forEach(function(P,k){this.append(k,P)},this):Array.isArray(A)?A.forEach(function(P){if(P.length!=2)throw new TypeError("Headers constructor: expected name/value pair to be length 2, found"+P.length);this.append(P[0],P[1])},this):A&&Object.getOwnPropertyNames(A).forEach(function(P){this.append(P,A[P])},this)}p.prototype.append=function(A,P){A=f(A),P=g(P);var k=this.map[A];this.map[A]=k?k+", "+P:P},p.prototype.delete=function(A){delete this.map[f(A)]},p.prototype.get=function(A){return A=f(A),this.has(A)?this.map[A]:null},p.prototype.has=function(A){return this.map.hasOwnProperty(f(A))},p.prototype.set=function(A,P){this.map[f(A)]=g(P)},p.prototype.forEach=function(A,P){for(var k in this.map)this.map.hasOwnProperty(k)&&A.call(P,this.map[k],k,this)},p.prototype.keys=function(){var A=[];return this.forEach(function(P,k){A.push(k)}),h(A)},p.prototype.values=function(){var A=[];return this.forEach(function(P){A.push(P)}),h(A)},p.prototype.entries=function(){var A=[];return this.forEach(function(P,k){A.push([k,P])}),h(A)},c.iterable&&(p.prototype[Symbol.iterator]=p.prototype.entries);function y(A){if(!A._noBody){if(A.bodyUsed)return Promise.reject(new TypeError("Already read"));A.bodyUsed=!0}}function w(A){return new Promise(function(P,k){A.onload=function(){P(A.result)},A.onerror=function(){k(A.error)}})}function I(A){var P=new FileReader,k=w(P);return P.readAsArrayBuffer(A),k}function v(A){var P=new FileReader,k=w(P),U=/charset=([A-Za-z0-9_-]+)/.exec(A.type),x=U?U[1]:"utf-8";return P.readAsText(A,x),k}function E(A){for(var P=new Uint8Array(A),k=new Array(P.length),U=0;U<P.length;U++)k[U]=String.fromCharCode(P[U]);return k.join("")}function b(A){if(A.slice)return A.slice(0);var P=new Uint8Array(A.byteLength);return P.set(new Uint8Array(A)),P.buffer}function m(){return this.bodyUsed=!1,this._initBody=function(A){this.bodyUsed=this.bodyUsed,this._bodyInit=A,A?typeof A=="string"?this._bodyText=A:c.blob&&Blob.prototype.isPrototypeOf(A)?this._bodyBlob=A:c.formData&&FormData.prototype.isPrototypeOf(A)?this._bodyFormData=A:c.searchParams&&URLSearchParams.prototype.isPrototypeOf(A)?this._bodyText=A.toString():c.arrayBuffer&&c.blob&&u(A)?(this._bodyArrayBuffer=b(A.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):c.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(A)||d(A))?this._bodyArrayBuffer=b(A):this._bodyText=A=Object.prototype.toString.call(A):(this._noBody=!0,this._bodyText=""),this.headers.get("content-type")||(typeof A=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):c.searchParams&&URLSearchParams.prototype.isPrototypeOf(A)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},c.blob&&(this.blob=function(){var A=y(this);if(A)return A;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))}),this.arrayBuffer=function(){if(this._bodyArrayBuffer){var A=y(this);return A||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}else{if(c.blob)return this.blob().then(I);throw new Error("could not read as ArrayBuffer")}},this.text=function(){var A=y(this);if(A)return A;if(this._bodyBlob)return v(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(E(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},c.formData&&(this.formData=function(){return this.text().then(S)}),this.json=function(){return this.text().then(JSON.parse)},this}var _=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];function O(A){var P=A.toUpperCase();return _.indexOf(P)>-1?P:A}function C(A,P){if(!(this instanceof C))throw new TypeError('Please use the "new" operator, this DOM object c
35onstructor cannot be called as a function.');P=P||{};var k=P.body;if(A instanceof C){if(A.bodyUsed)throw new TypeError("Already read");this.url=A.url,this.credentials=A.credentials,P.headers||(this.headers=new p(A.headers)),this.method=A.method,this.mode=A.mode,this.signal=A.signal,!k&&A._bodyInit!=null&&(k=A._bodyInit,A.bodyUsed=!0)}else this.url=String(A);if(this.credentials=P.credentials||this.credentials||"same-origin",(P.headers||!this.headers)&&(this.headers=new p(P.headers)),this.method=O(P.method||this.method||"GET"),this.mode=P.mode||this.mode||null,this.signal=P.signal||this.signal||function(){if("AbortController"in a){var j=new AbortController;return j.signal}}(),this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&k)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(k),(this.method==="GET"||this.method==="HEAD")&&(P.cache==="no-store"||P.cache==="no-cache")){var U=/([?&])_=[^&]*/;if(U.test(this.url))this.url=this.url.replace(U,"$1_="+new Date().getTime());else{var x=/\?/;this.url+=(x.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}C.prototype.clone=function(){return new C(this,{body:this._bodyInit})};function S(A){var P=new FormData;return A.trim().split("&").forEach(function(k){if(k){var U=k.split("="),x=U.shift().replace(/\+/g," "),j=U.join("=").replace(/\+/g," ");P.append(decodeURIComponent(x),decodeURIComponent(j))}}),P}function T(A){var P=new p,k=A.replace(/\r?\n[\t ]+/g," ");return k.split("\r").map(function(U){return U.indexOf(`
36`)===0?U.substr(1,U.length):U}).forEach(function(U){var x=U.split(":"),j=x.shift().trim();if(j){var D=x.join(":").trim();try{P.append(j,D)}catch(M){console.warn("Response "+M.message)}}}),P}m.call(C.prototype);function N(A,P){if(!(this instanceof N))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');if(P||(P={}),this.type="default",this.status=P.status===void 0?200:P.status,this.status<200||this.status>599)throw new RangeError("Failed to construct 'Response': The status provided (0) is outside the range [200, 599].");this.ok=this.status>=200&&this.status<300,this.statusText=P.statusText===void 0?"":""+P.statusText,this.headers=new p(P.headers),this.url=P.url||"",this._initBody(A)}m.call(N.prototype),N.prototype.clone=function(){return new N(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new p(this.headers),url:this.url})},N.error=function(){var A=new N(null,{status:200,statusText:""});return A.ok=!1,A.status=0,A.type="error",A};var R=[301,302,303,307,308];N.redirect=function(A,P){if(R.indexOf(P)===-1)throw new RangeError("Invalid status code");return new N(null,{status:P,headers:{location:A}})},o.DOMException=a.DOMException;try{new o.DOMException}catch{o.DOMException=function(P,k){this.message=P,this.name=k;var U=Error(P);this.stack=U.stack},o.DOMException.prototype=Object.create(Error.prototype),o.DOMException.prototype.constructor=o.DOMException}function B(A,P){return new Promise(function(k,U){var x=new C(A,P);if(x.signal&&x.signal.aborted)return U(new o.DOMException("Aborted","AbortError"));var j=new XMLHttpRequest;function D(){j.abort()}j.onload=function(){var H={statusText:j.statusText,headers:T(j.getAllResponseHeaders()||"")};x.url.indexOf("file://")===0&&(j.status<200||j.status>599)?H.status=200:H.status=j.status,H.url="responseURL"in j?j.responseURL:H.headers.get("X-Request-URL");var z="response"in j?j.response:j.responseText;setTimeout(function(){k(new N(z,H))},0)},j.onerror=function(){setTimeout(function(){U(new TypeError("Network request failed"))},0)},j.ontimeout=function(){setTimeout(function(){U(new TypeError("Network request timed out"))},0)},j.onabort=function(){setTimeout(function(){U(new o.DOMException("Aborted","AbortError"))},0)};function M(H){try{return H===""&&a.location.href?a.location.href:H}catch{return H}}if(j.open(x.method,M(x.url),!0),x.credentials==="include"?j.withCredentials=!0:x.credentials==="omit"&&(j.withCredentials=!1),"responseType"in j&&(c.blob?j.responseType="blob":c.arrayBuffer&&(j.responseType="arraybuffer")),P&&typeof P.headers=="object"&&!(P.headers instanceof p||a.Headers&&P.headers instanceof a.Headers)){var L=[];
vendor: 4,557 bytes, line 36
36Object.getOwnPropertyNames(P.headers).forEach(function(H){L.push(f(H)),j.setRequestHeader(H,g(P.headers[H]))}),x.headers.forEach(function(H,z){L.indexOf(z)===-1&&j.setRequestHeader(z,H)})}else x.headers.forEach(function(H,z){j.setRequestHeader(z,H)});x.signal&&(x.signal.addEventListener("abort",D),j.onreadystatechange=function(){j.readyState===4&&x.signal.removeEventListener("abort",D)}),j.send(typeof x._bodyInit>"u"?null:x._bodyInit)})}return B.polyfill=!0,a.fetch||(a.fetch=B,a.Headers=p,a.Request=C,a.Response=N),o.Headers=p,o.Request=C,o.Response=N,o.fetch=B,Object.defineProperty(o,"__esModule",{value:!0}),o})({})})(n),n.fetch.ponyfill=!0,delete n.fetch.polyfill;var s=r.fetch?r:n;e=s.fetch,e.default=s.fetch,e.fetch=s.fetch,e.Headers=s.Headers,e.Request=s.Request,e.Response=s.Response,t.exports=e}(Ob,Ob.exports)),Ob.exports}var Pge=Tge();const F6=W$(Pge);var Oge=Object.defineProperty,Nge=Object.defineProperties,xge=Object.getOwnPropertyDescriptors,H6=Object.getOwnPropertySymbols,Rge=Object.prototype.hasOwnProperty,Bge=Object.prototype.propertyIsEnumerable,q6=(t,e,r)=>e in t?Oge(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,z6=(t,e)=>{for(var r in e||(e={}))Rge.call(e,r)&&q6(t,r,e[r]);if(H6)for(var r of H6(e))Bge.call(e,r)&&q6(t,r,e[r]);return t},W6=(t,e)=>Nge(t,xge(e));const kge={Accept:"application/json","Content-Type":"application/json"},jge="POST",V6={headers:kge,method:jge},G6=10;let HH=class{constructor(e,r=!1){if(this.url=e,this.disableProviderPing=r,this.events=new gi.EventEmitter,this.isAvailable=!1,this.registering=!1,!u6(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);this.url=e,this.disableProviderPing=r}get connected(){return this.isAvailable}get connecting(){return this.registering}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async open(e=this.url){await this.register(e)}async close(){if(!this.isAvailable)throw new Error("Connection already closed");this.onClose()}async send(e){this.isAvailable||await this.register();try{const r=Rd(e),n=await(await F6(this.url,W6(z6({},V6),{body:r}))).json();this.onPayload({data:n})}catch(r){this.onError(e.id,r)}}async register(e=this.url){if(!u6(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);if(this.registering){const r=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=r||this.events.listenerCount("open")>=r)&&this.events.setMaxListeners(r+1),new Promise((n,s)=>{this.events.once("register_error",i=>{this.resetMaxListeners(),s(i)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.isAvailable>"u")return s(new Error("HTTP connection is missing or invalid"));n()})})}this.url=e,this.registering=!0;try{if(!this.disableProviderPing){const r=Rd({id:1,jsonrpc:"2.0",method:"test",params:[]});await F6(e,W6(z6({},V6),{body:r}))}this.onOpen()}catch(r){const n=this.parseError(r);throw this.events.emit("register_error",n),this.onClose(),n}}onOpen(){this.isAvailable=!0,this.registering=!1,this.events.emit("open")}onClose(){this.isAvailable=!1,this.registering=!1,this.events.emit("close")}onPayload(e){if(typeof e.data>"u")return;const r=typeof e.data=="string"?xd(e.data):e.data;this.events.emit("payload",r)}onError(e,r){const n=this.parseError(r),s=n.message||n.toString(),i=JA(e,s);this.events.emit("payload",i)}parseError(e,r=this.url){return wH(e,r,"HTTP")}resetMaxListeners(){this.events.getMaxListeners()>G6&&this.events.setMaxListeners(G6)}};function Dge(t){return Number.isSafeInteger(t)&&t>=0}function Uge(t){return t!=null&&typeof t!="function"&&Dge(t.length)}function Mge(t){return t==="__proto__"}function PO(t){return t==null||typeof t!="object"&&typeof t!="function"}function qH(t){return Object.getOwnPropertySymbols(t).filter(e=>Object.prototype.propertyIsEnumerable.call(t,e))}function OO(t){return t==null?t===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(t)}const $ge="[object RegExp]",zH="[object String]",WH="[object Number]",VH="[object Boolean]",GH="[object Arguments]",Lge="[object Symbol]",Fge="[object Date]",Hge="[object Map]",qge="[object Set]",zge="[object Array]",Wge="[object ArrayBuffer]",KH="[object Object]",Vge="[object DataView]",Gge="[object Uint8Array]",Kge="[object Uint8ClampedArray]",Zge="[object Uint16Array]",Yge="[object Uint32Array]",Jge="[object Int8Array]",Qge="[object Int16Array]",Xge="[object Int32Array]",eme="[object Float32Array]",tme="[object Float64Array
36]";function NO(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function rme(t,e){return Yf(t,void 0,t,new Map,e)}function Yf(t,e,r,n=new Map,s=void 0){const i=s==null?void 0:s(t,e,r,n);if(i!==void 0)return i;if(PO(t))return t;if(n.has(t))return n.get(t);if(Array.isArray(t)){const o=new Array(t.length);n.set(t,o);for(let a=0;a<t.length;a++)o[a]=Yf(t[a],a,r,n,s);return Object.hasOwn(t,"index")&&(o.index=t.index),Object.hasOwn(t,"input")&&(o.input=t.input),o}if(t instanceof Date)return new Date(t.getTime());if(t instanceof RegExp){const o=new RegExp(t.source,t.flags);return o.lastIndex=t.lastIndex,o}if(t instanceof Map){const o=new Map;n.set(t,o);for(const[a,c]of t)o.set(a,Yf(c,a,r,n,s));return o}if(t instanceof Set){const o=new Set;n.set(t,o);for(const a of t)o.add(Yf(a,void 0,r,n,s));return o}if(typeof bt<"u"&&bt.isBuffer(t))return t.subarray();if(NO(t)){const o=new(Object.getPrototypeOf(t)).constructor(t.length);n.set(t,o);for(let a=0;a<t.length;a++)o[a]=Yf(t[a],a,r,n,s);return o}if(t instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&t instanceof SharedArrayBuffer)return t.slice(0);if(t instanceof DataView){const o=new DataView(t.buffer.slice(0),t.byteOffset,t.byteLength);return n.set(t,o),Bi(o,t,r,n,s),o}if(typeof File<"u"&&t instanceof File){const o=new File([t],t.name,{type:t.type});return n.set(t,o),Bi(o,t,r,n,s),o}if(typeof Blob<"u"&&t instanceof Blob){const o=new Blob([t],{type:t.type});return n.set(t,o),Bi(o,t,r,n,s),o}if(t instanceof Error){const o=new t.constructor;return n.set(t,o),o.message=t.message,o.name=t.name,o.stack=t.stack,o.cause=t.cause,Bi(o,t,r,n,s),o}if(t instanceof Boolean){const o=new Boolean(t.valueOf());return n.set(t,o),Bi(o,t,r,n,s),o}if(t instanceof Number){const o=new Number(t.valueOf());return n.set(t,o),Bi(o,t,r,n,s),o}if(t instanceof String){const o=new String(t.valueOf());return n.set(t,o),Bi(o,t,r,n,s),o}if(typeof t=="object"&&nme(t)){const o=Object.create(Object.getPrototypeOf(t));return n.set(t,o),Bi(o,t,r,n,s),o}return t}function Bi(t,e,r=t,n,s){const i=[...Object.keys(e),...qH(e)];for(let o=0;o<i.length;o++){const a=i[o],c=Object.getOwnPropertyDescriptor(t,a);(c==null||c.writable)&&(t[a]=Yf(e[a],a,r,n,s))}}function nme(t){switch(OO(t)){case GH:case zge:case Wge:case Vge:case VH:case Fge:case eme:case tme:case Jge:case Qge:case Xge:case Hge:case WH:case KH:case $ge:case qge:case zH:case Lge:case Gge:case Kge:case Zge:case Yge:return!0;default:return!1}}function sme(t,e){return rme(t,(r,n,s,i)=>{if(typeof t=="object"){if(OO(t)===KH&&typeof t.constructor!="function"){const o={};return i.set(t,o),Bi(o,t,s,i),o}switch(Object.prototype.toString.call(t)){case WH:case zH:case VH:{const o=new t.constructor(t==null?void 0:t.valueOf());return Bi(o,t),o}case GH:{const o={};return Bi(o,t),o.length=t.length,o[Symbol.iterator]=t[Symbol.iterator],o}default:return}}})}function K6(t){return sme(t)}function Z6(t){return t!==null&&typeof t=="object"&&OO(t)==="[object Arguments]"}function GT(t){return typeof t=="object"&&t!==null}function ime(t){return GT(t)&&Uge(t)}function ome(){}function OI(t){return NO(t)}function NI(t){var r;if(typeof t!="object"||t==null)return!1;if(Object.getPrototypeOf(t)===null)return!0;if(Object.prototype.toString.call(t)!=="[object Object]"){const n=t[Symbol.toStringTag];return n==null||!((r=Object.getOwnPropertyDescriptor(t,Symbol.toStringTag))!=null&&r.writable)?!1:t.toString()===`[object ${n}]`}let e=t;for(;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e}function ame(t){if(PO(t))return t;if(Array.isArray(t)||NO(t)||t instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&t instanceof SharedArrayBuffer)return t.slice(0);const e=Object.getPrototypeOf(t);if(e==null)return Object.assign(Object.create(e),t);const r=e.constructor;if(t instanceof Date||t instanceof Map||t instanceof Set)return new r(t);if(t instanceof RegExp){const n=new r(t);return n.lastIndex=t.lastIndex,n}if(t instanceof DataView)return new r(t.buffer.slice(0));if(t instanceof Error){let n;return t instanceof AggregateError?n=new r(t.errors,t.message,{cause:t.cause}):n=new r(t.message,{cause:t.cause}),n.stack=t.stack,Object.assign(n,t),n}if(typeof File<"u"&&t instanceof File)return new r([t],t.name,{type:t.type,lastModified:t.lastModified});if(typeof t=="object"){const n=Object.create(e);return Object.assign(n,t)}return t}function cme(t,...e){const r=e.slice(0,-1),n=e[e.length-1];let s=t;for(let i=0;i<r.length;i++){const o=r[i];s=KT(s,o,n,new Map)}return s}function KT(t,e,r,n){if(PO(t)&&(t=Object(t)),e==null||typeof e!="object")return t;if(n.has(e))return ame(n.get(e));if(n.set(e,t),Array.isArray(e)){e=e.slice();for(let i=0;i<e.length;i++)e[i]=e[i]??void 0}const s=[...Object.keys(e),...qH(e)];for(let i=0;i<s.length;i++){const o=s[i];if(Mge(o))continue;let a=e[o],c=t[o];if(Z6(a)&&(a={...a}),Z6(c)&&(c={...c}),typeof bt<"u"&&bt.isBuffer(a)&&(a=K6(a)),Array.isArray(a))if(Array.isArray(c)){const l=[],d=Reflect.ownKeys(c);for(let f=0;f<d.length;f++){const g=d[f];l[g]=c[g]}c=l}else if(ime(c)){const l=[];for(let d=0;d<c.length;d++)l[d]=c[d];c=l}else c=[];const u=r(c,a,o,t,e,n);u!==void 0?t[o]=u:Array.isArray(a)||GT(c)&&GT(a)&&(NI(c)||NI(a)||OI(c)||OI(a))?t[o]=KT(c,a,r,n):c==null&&NI(a)?t[o]=KT({},a,r,n):c==null&&OI(a)?t[o]=K6(a):(c===void 0||a!==void 0)&&(t[o]=a)}return t}function ume(t,...e){return cme(t,...e,ome)}const Y6="error",lme="wss://relay.walletconnect.org",dme="wc",ZH="universal_provider",Nb=`${dme}
36@2:${ZH}:`,YH="https://rpc.walletconnect.org/v1/",JH="generic",fme=`${YH}bundler`,uh="call_status",hme=86400,xO={DEFAULT_CHAIN_CHANGED:"default_chain_changed"};var pme=Object.defineProperty,gme=Object.defineProperties,mme=Object.getOwnPropertyDescriptors,J6=Object.getOwnPropertySymbols,yme=Object.prototype.hasOwnProperty,bme=Object.prototype.propertyIsEnumerable,Q6=(t,e,r)=>e in t?pme(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,xb=(t,e)=>{for(var r in e||(e={}))yme.call(e,r)&&Q6(t,r,e[r]);if(J6)for(var r of J6(e))bme.call(e,r)&&Q6(t,r,e[r]);return t},wme=(t,e)=>gme(t,mme(e));function QH(t,e,r){var n;const s=rc(t);return((n=e.rpcMap)==null?void 0:n[s.reference])||`${YH}?chainId=${s.namespace}:${s.reference}&projectId=${r}`}function Eme(t){return t.includes(":")?t.split(":")[1]:t}function XH(t){return t.map(e=>`${e.split(":")[0]}:${e.split(":")[1]}`)}function vme(t,e){const r=Object.keys(e.namespaces).filter(s=>s.includes(t));if(!r.length)return[];const n=[];return r.forEach(s=>{const i=e.namespaces[s].accounts;n.push(...i)}),n}function X6(t){return Object.fromEntries(Object.entries(t).filter(([e,r])=>{var n,s;return((n=r==null?void 0:r.chains)==null?void 0:n.length)&&((s=r==null?void 0:r.chains)==null?void 0:s.length)>0}))}function Rb(t={},e={}){const r=X6(e3(t)),n=X6(e3(e));return ume(r,n)}function e3(t){var e,r,n,s,i;const o={};if(!$o(t))return o;for(const[a,c]of Object.entries(t)){const u=YA(a)?[a]:c.chains,l=c.methods||[],d=c.events||[],f=c.rpcMap||{},g=Zf(a);o[g]=wme(xb(xb({},o[g]),c),{chains:Mo(u,(e=o[g])==null?void 0:e.chains),methods:Mo(l,(r=o[g])==null?void 0:r.methods),events:Mo(d,(n=o[g])==null?void 0:n.events)}),($o(f)||$o(((s=o[g])==null?void 0:s.rpcMap)||{}))&&(o[g].rpcMap=xb(xb({},f),(i=o[g])==null?void 0:i.rpcMap))}return o}function t3(t){return t.includes(":")?t.split(":")[2]:t}function r3(t){const e={};for(const[r,n]of Object.entries(t)){const s=n.methods||[],i=n.events||[],o=n.accounts||[],a=YA(r)?[r]:n.chains?n.chains:XH(n.accounts);e[r]={chains:a,methods:s,events:i,accounts:o}}return e}function xI(t){return typeof t=="number"?t:t.includes("0x")?parseInt(t,16):(t=t.includes(":")?t.split(":")[1]:t,isNaN(Number(t))?t:Number(t))}function _me(t){try{const e=JSON.parse(t);return typeof e=="object"&&e!==null&&!Array.isArray(e)}catch{return!1}}const eq={},lh=t=>eq[t],RI=(t,e)=>{eq[t]=e};var Ame=Object.defineProperty,n3=Object.getOwnPropertySymbols,Cme=Object.prototype.hasOwnProperty,Ime=Object.prototype.propertyIsEnumerable,s3=(t,e,r)=>e in t?Ame(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,i3=(t,e)=>{for(var r in e||(e={}))Cme.call(e,r)&&s3(t,r,e[r]);if(n3)for(var r of n3(e))Ime.call(e,r)&&s3(t,r,e[r]);return t};const o3="eip155",Sme=["atomic","flow-control","paymasterService","sessionKeys","auxiliaryFunds"],Tme=t=>t&&t.startsWith("0x")?BigInt(t).toString(10):t,BI=t=>t&&t.startsWith("0x")?t:`0x${BigInt(t).toString(16)}`,a3=t=>Object.keys(t).filter(e=>Sme.includes(e)).reduce((e,r)=>(e[r]=Pme(t[r]),e),{}),Pme=t=>typeof t=="string"&&_me(t)?JSON.parse(t):t,Ome=(t,e,r)=>{const{sessionProperties:n={},scopedProperties:s={}}=t,i={};if(!$o(s)&&!$o(n))return;const o=a3(n);for(const a of r){const c=Tme(a);if(!c)continue;i[BI(c)]=o;const u=s==null?void 0:s[`${o3}:${c}`];if(u){const l=u==null?void 0:u[`${o3}:${c}:${e}`];i[BI(c)]=i3(i3({},i[BI(c)]),a3(l||u))}}for(const[a,c]of Object.entries(i))Object.keys(c).length===0&&delete i[a];return Object.keys(i).length>0?i:void 0};var Nme=Object.defineProperty,xme=(t,e,r)=>e in t?Nme(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Rme=(t,e,r)=>xme(t,e+"",r);let kI;class RO{constructor(e){Rme(this,"storage"),this.storage=e}async getItem(e){return await this.storage.getItem(e)}async setItem(e,r){return await this.storage.setItem(e,r)}async removeItem(e){return await this.storage.removeItem(e)}static getStorage(e){return kI||(kI=new RO(e)),kI}}var Bme=Object.defineProperty,kme=Object.defineProperties,jme=Object.getOwnPropertyDescriptors,c3=Object.getOwnPropertySymbols,Dme=Object.prototype.hasOwnProperty,Ume=Object.prototype.propertyIsEnumerable,u3=(t,e,r)=>e in t?Bme(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Mme=(t,e)=>{for(var r in e||(e={}))Dme.call(e,r)&&u3(t,r,e[r]);if(c3)for(var r of c3(e))Ume.call(e,r)&&u3(t,r,e[r]);return t},$me=(t,e)=>kme(t,jme(e));async function Lme(t,e){const r=rc(t.result.capabilities.caip345.caip2),n=t.result.capabilities.caip345.transactionHashes,s=await Promise.allSettled(n.map(d=>Fme(r.reference,d,e))),i=s.filter(d=>d.status==="fulfilled").map(d=>d.value).filter(d=>d);s.filter(d=>d.status==="rejected").forEach(d=>console.warn("Failed to fetch transaction receipt:",d.reason));const o=!i.length||i.some(d=>!d),a=i.every(d=>(d==null?void 0:d.status)==="0x1"),c=i.every(d=>(d==null?void 0:d.status)==="0x0"),u=i.some(d=>(d==null?void 0:d.status)==="0x0");let l;return o?l=100:a?l=200:c?l=500:u&&(l=600),{id:t.result.id,version:t.request.version,atomic:t.request.atomicRequired,chainId:t.request.chainId,capabilities:t.result.capabilities,receipts:i,status:l}}async function Fme(t,e,r){return await r(parseInt(t)).request(Fi("eth_getTransactionReceipt",[e]))}async function Hme({sendCalls:t,storage:e}){const r=await e.getItem(uh);await e.setItem(uh,$me(Mme({},r),{[t.result.id]:{request:t.request,result:t.result,expiry:Nr(hme)}}))}async function qme({resultId:t,storage:e}){const r=await e.getItem(uh);if(r){delete r[t],await e.setItem(uh,r);for(const n in r)Po(r[n].expiry)&&delete r[n];await e.setItem(uh,r)}}async function zme({resultId:t,storage:e}){const r=await e.getItem(uh),n=r==null?void 0:r[t];if(n&&!Po(n.expiry))return n;await qme({resultId:t,storage:e})}var Wme=Object.defineProperty,Vme=Object.defineProperties,Gme=Object.getOwnPropertyDescriptors,l3=Object.getOwnPropertySymbols,Kme=Object.prototype.hasOwnProperty,Zme=Object.prototype.propertyIsEnumerable,ZT=(t,e,r)=>e in t?Wme(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,jI=(t,e)=>{for(var r in e||(e={}))Kme.call(e,r)&&ZT(t,r,e[r]);if(l3)for(var r of l3(e))Zme.call(e,r)&&ZT(t,r,e[r]);return t},DI=(t,e)=>Vme(t,Gme(e)),sl=(t,e,r)=>ZT(t,typeof e!="symbol"?e+"":e,r);class Yme{constructor(e){sl(this,"name","eip155"),sl(this,"client"),sl(this,"chainId"),sl(this,"namespace"),sl(this,"httpProviders"),sl(this,"events"),sl(this,"storage"),this.namespace=e.namespace,this.events=lh("events"),this.client=lh("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain()),this.storage=RO.getStorage(this.client.core.storage)}async request(e){switch(e.request.method){case"eth_requestAccounts":return this.getAccounts();case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(e);case"eth_chainId":return parseInt(this.getDefaultChain());case"wallet_getCapabilities":return await this.getCapabilities(e);case"wallet_getCallsStatus":return await this.getCallStatus(e);case"wallet_sendCalls":return await this.sendCalls(e)}return this.namespace.methods.includes(e.request.method)?await this.client.request(e):this.getHttpProvider().request(e.request)}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(parseInt(e),r);const n=this.chainId;this.chainId=parseInt(e),this.events.emit(xO.DEFAULT_CHAIN_CHANGED,{currentCaipChainId:`${this.name}:${e}`,previousCaipChainId:`${this.name}:${n}`})}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}createHttpProvider(e,r){const n=r||QH(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new IO(new HH(n,lh("disableProviderPing")))}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;
vendor: 7,063 bytes, line 36
36const s=parseInt(Eme(r));e[s]=this.createHttpProvider(s,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}getHttpProvider(e){const r=e||this.chainId;return this.httpProviders[r]||(this.httpProviders=DI(jI({},this.httpProviders),{[r]:this.createHttpProvider(r)}),this.httpProviders[r])}async handleSwitchChain(e){var r,n;let s=e.request.params?(r=e.request.params[0])==null?void 0:r.chainId:"0x0";s=s.startsWith("0x")?s:`0x${s}`;const i=parseInt(s,16);if(this.isChainApproved(i))this.setDefaultChain(`${i}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:e.topic,request:{method:e.request.method,params:[{chainId:s}]},chainId:(n=this.namespace.chains)==null?void 0:n[0]}),this.setDefaultChain(`${i}`);else throw new Error(`Failed to switch to chain 'eip155:${i}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);return null}isChainApproved(e){return this.namespace.chains.includes(`${this.name}:${e}`)}async getCapabilities(e){var r,n,s,i,o;const a=(n=(r=e.request)==null?void 0:r.params)==null?void 0:n[0],c=((i=(s=e.request)==null?void 0:s.params)==null?void 0:i[1])||[];if(!a)throw new Error("Missing address parameter in `wallet_getCapabilities` request");const u=this.client.session.get(e.topic),l=((o=u==null?void 0:u.sessionProperties)==null?void 0:o.capabilities)||{},d=c.length>0?c.join(","):`0x${this.chainId.toString(16)}`,f=`${a}${d}`,g=l==null?void 0:l[f];if(g)return g;let h;try{h=Ome(u,a,c)}catch(y){console.warn("Failed to extract capabilities from session",y)}if(h)return h;const p=await this.client.request(e);try{await this.client.session.update(e.topic,{sessionProperties:DI(jI({},u.sessionProperties||{}),{capabilities:DI(jI({},l||{}),{[f]:p})})})}catch(y){console.warn("Failed to update session with capabilities",y)}return p}async getCallStatus(e){var r,n,s;const i=this.client.session.get(e.topic),o=(r=i.sessionProperties)==null?void 0:r.bundler_name;if(o){const u=this.getBundlerUrl(e.chainId,o);try{return await this.getUserOperationReceipt(u,e)}catch(l){console.warn("Failed to fetch call status from bundler",l,u)}}const a=(n=i.sessionProperties)==null?void 0:n.bundler_url;if(a)try{return await this.getUserOperationReceipt(a,e)}catch(u){console.warn("Failed to fetch call status from custom bundler",u,a)}const c=await zme({resultId:(s=e.request.params)==null?void 0:s[0],storage:this.storage});if(c)try{return await Lme(c,this.getHttpProvider.bind(this))}catch(u){console.warn("Failed to fetch call status from stored send calls",u,c)}if(this.namespace.methods.includes(e.request.method))return await this.client.request(e);throw new Error("Fetching call status not approved by the wallet.")}async getUserOperationReceipt(e,r){var n;const s=new URL(e),i=await fetch(s,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Fi("eth_getUserOperationReceipt",[(n=r.request.params)==null?void 0:n[0]]))});if(!i.ok)throw new Error(`Failed to fetch user operation receipt - ${i.status}`);return await i.json()}getBundlerUrl(e,r){return`${fme}?projectId=${this.client.core.projectId}&chainId=${e}&bundler=${r}`}async sendCalls(e){var r,n,s;const i=await this.client.request(e),o=(r=e.request.params)==null?void 0:r[0],a=i==null?void 0:i.id,c=(i==null?void 0:i.capabilities)||{},u=(n=c==null?void 0:c.caip345)==null?void 0:n.caip2,l=(s=c==null?void 0:c.caip345)==null?void 0:s.transactionHashes;return!a||!u||!(l!=null&&l.length)||await Hme({sendCalls:{request:o,result:i},storage:this.storage}),i}}var Jme=Object.defineProperty,Qme=(t,e,r)=>e in t?Jme(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,mf=(t,e,r)=>Qme(t,typeof e!="symbol"?e+"":e,r);class Xme{constructor(e){mf(this,"name",JH),mf(this,"client"),mf(this,"httpProviders"),mf(this,"events"),mf(this,"namespace"),mf(this,"chainId"),this.namespace=e.namespace,this.events=lh("events"),this.client=lh("client"),this.chainId=this.getDefaultChain(),this.name=this.getNamespaceName(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace.chains=[...new Set((this.namespace.chains||[]).concat(e.chains||[]))],this.namespace.accounts=[...new Set((this.namespace.accounts||[]).concat(e.accounts||[]))],this.namespace.methods=[...new Set((this.namespace.methods||[]).concat(e.methods||[]))],this.namespace.events=[...new Set((this.namespace.events||[]).concat(e.events||[]))],this.httpProviders=this.createHttpProviders()}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider(e.chainId).request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r);const n=this.chainId;this.chainId=e,this.events.emit(xO.DEFAULT_CHAIN_CHANGED,{currentCaipChainId:`${this.name}:${e}`,previousCaipChainId:`${this.name}:${n}`})}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getNamespaceName(){const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return rc(e).namespace}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){var e,r;const n={};return(r=(e=this.namespace)==null?void 0:e.accounts)==null||r.forEach(s=>{var i,o;const a=rc(s),c=(o=(i=this.namespace)==null?void 0:i.rpcMap)==null?void 0:o[`${a.namespace}:${a.reference}`];n[a.reference]=this.createHttpProvider(s,c)}),n}getHttpProvider(e){const r=rc(e).reference,n=this.httpProviders[r];if(typeof n>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return n}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||QH(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new IO(new HH(n,lh("disableProviderPing")))}}var eye=Object.defineProperty,tye=Object.defineProperties,rye=Object.getOwnPropertyDescriptors,d3=Object.getOwnPropertySymbols,nye=Object.prototype.hasOwnProperty,sye=Object.prototype.propertyIsEnumerable,YT=(t,e,r)=>e in t?eye(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ag=(t,e)=>{for(var r in e||(e={}))nye.call(e,r)&&YT(t,r,e[r]);if(d3)for(var r of d3(e))sye.call(e,r)&&YT(t,r,e[r]);return t},Bb=(t,e)=>tye(t,rye(e)),Os=(t,e,r)=>YT(t,typeof e!="symbol"?e+"":e,r);let iye=class tq{constructor(e){Os(this,"client"),Os(this,"namespaces"),Os(this,"optionalNamespaces"),Os(this,"sessionProperties"),Os(this,"scopedProperties"),Os(this,"events",new QP),Os(this,"rpcProviders",{}),Os(this,"session"),Os(this,"providerOpts"),Os(this,"logger"),Os(this,"uri"),Os(this,"disableProviderPing",!1),Os(this,"connectParam
36s");var r,n;this.providerOpts=e,this.logger=_O({logger:(r=e.logger)!=null?r:Y6,name:(n=this.providerOpts.name)!=null?n:ZH}),this.disableProviderPing=(e==null?void 0:e.disableProviderPing)||!1}static async init(e){const r=new tq(e);return await r.initialize(),r}async request(e,r,n){const[s,i]=this.validateChain(r);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(s).request({request:ag({},e),chainId:`${s}:${i}`,topic:this.session.topic,expiry:n})}sendAsync(e,r,n,s){const i=new Date().getTime();this.request(e,n,s).then(o=>r(null,Ry(i,o))).catch(o=>r(o,void 0))}async enable(){if(!this.client)throw new Error("Sign Client not initialized");return this.session||await this.connect({namespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties,scopedProperties:this.scopedProperties}),await this.requestAccounts()}async disconnect(){var e;if(!this.session)throw new Error("Please call connect() before enable()");await this.client.disconnect({topic:(e=this.session)==null?void 0:e.topic,reason:ar("USER_DISCONNECTED")}),await this.cleanup()}async connect(e){if(!this.client)throw new Error("Sign Client not initialized");if(this.connectParams=e,this.setNamespaces(e),this.cleanupPendingPairings(),!e.skipPairing)return await this.pair(e.pairingTopic)}async authenticate(e,r){if(!this.client)throw new Error("Sign Client not initialized");this.setNamespaces(e),await this.cleanupPendingPairings();const{uri:n,response:s}=await this.client.authenticate(e,r);n&&(this.uri=n,this.events.emit("display_uri",n));const i=await s();if(this.session=i.session,this.session){const o=r3(this.session.namespaces);this.namespaces=Rb(this.namespaces,o),await this.persist("namespaces",this.namespaces),this.onConnect()}return i}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}removeListener(e,r){this.events.removeListener(e,r)}off(e,r){this.events.off(e,r)}get isWalletConnect(){return!0}async pair(e){var r,n;const{uri:s,approval:i}=await this.client.connect({pairingTopic:e,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties,scopedProperties:this.scopedProperties,authentication:(r=this.connectParams)==null?void 0:r.authentication,walletPay:(n=this.connectParams)==null?void 0:n.walletPay});s&&(this.uri=s,this.events.emit("display_uri",s));const o=await i();this.session=o;const a=r3(o.namespaces);return this.namespaces=Rb(this.namespaces,a),await this.persist("namespaces",this.namespaces),await this.persist("optionalNamespaces",this.optionalNamespaces),this.onConnect(),this.session}setDefaultChain(e,r){try{if(!this.session)return;const[n,s]=this.validateChain(e),i=this.getProvider(n);i?i.setDefaultChain(s,r):this.session&&this.logger.warn(`Provider for namespace '${n}' not found in setDefaultChain`)}catch(n){if(!/Please call connect/.test(n.message))throw n}}async cleanupPendingPairings(e={}){try{this.logger.info("Cleaning up inactive pairings...");const r=this.client.pairing.getAll();if(!sc(r))return;for(const n of r)e.deletePairings?this.client.core.expirer.set(n.topic,0):await this.client.core.relayer.subscriber.unsubscribe(n.topic);this.logger.info(`Inactive pairings cleared: ${r.length}`)}catch(r){this.logger.warn(r,"Failed to cleanup pending pairings")}}abortPairingAttempt(){this.logger.warn("abortPairingAttempt is deprecated. This is now a no-op.")}async checkStorage(){this.namespaces=await this.getFromStore("namespaces")||{},this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.session&&this.createProviders()}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){var e,r;if(this.client=this.providerOpts.client||await Sge.init({core:this.providerOpts.core,logger:this.providerOpts.logger||Y6,relayUrl:this.providerOpts.relayUrl||lme,projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name,customStoragePrefix:this.providerOpts.customStoragePrefix,telemetryEnabled:this.providerOpts.telemetryEnabled}),this.providerOpts.session)try{this.session=this.client.session.get(this.providerOpts.session.topic)}catch(n){throw this.logger.error(n,"Failed to get session"),new Error(`The provided session: ${(r=(e=this.providerOpts)==null?void 0:e.session)==null?void 0:r.topic} doesn't exist in the Sign client`)}else{const n=this.client.session.getAll();this.session=n[0]}this.logger.trace("SignClient Initialized")}createProviders(){if(!this.client)throw new Error("Sign Client not initialized");if(!this.session)throw new Error("Session not initialized. Please call connect() before enable()");const e=[...new Set(Object.keys(this.session.namespaces).map(r=>Zf(r)))];RI("client",this.client),RI("events",this.events),RI("disableProviderPing",this.disableProviderPing),e.forEach(r=>{if(!this.session)return;const n=vme(r,this.session);if((n==null?void 0:n.length)===0)return;const s=XH(n),i=Rb(this.namespaces,this.optionalNamespaces),o=Bb(ag({},i[r]),{accounts:n,chains:s});switch(r){case"eip155":this.rpcProviders[r]=new Yme({namespace:o});break;default:this.rpcProviders[r]=new Xme({namespace:o})}})}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",e=>{var r;const{topic:n}=e;n===((r=this.session)==null?void 0:r.topic)&&this.events.emit("session_ping",e)}),this.client.on("session_event",e=>{var r;const{params:n,topic:s}=e;if(s!==((r=this.session)==null?void 0:r.topic))return;const{event:i}=n;if(i.name==="accountsChanged"){const o=i.data;o&&sc(o)&&this.events.emit("accountsChanged",o.map(t3))}else if(i.name==="chainChanged"){const o=n.chainId,a=n.event.data,c=Zf(o),u=xI(o)!==xI(a)?`${c}:${xI(a)}`:o;this.onChainChanged({currentCaipChainId:u})}else this.events.emit(i.name,i.data);this.events.emit("session_event",e)}),this.client.on("session_update",({topic:e,params:r})=>{var n,s;if(e!==((n=this.session)==null?void 0:n.topic))return;const{namespaces:i}=r,o=(s=this.client)==null?void 0:s.session.get(e);this.session=Bb(ag({},o),{namespaces:i}
36),this.onSessionUpdate(),this.events.emit("session_update",{topic:e,params:r})}),this.client.on("session_delete",async e=>{var r;e.topic===((r=this.session)==null?void 0:r.topic)&&(await this.cleanup(),this.events.emit("session_delete",e),this.events.emit("disconnect",Bb(ag({},ar("USER_DISCONNECTED")),{data:e.topic})))}),this.on(xO.DEFAULT_CHAIN_CHANGED,e=>{this.onChainChanged(Bb(ag({},e),{internal:!0}))})}getProvider(e){return this.rpcProviders[e]||this.rpcProviders[JH]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(e=>{var r;this.getProvider(e).updateNamespace((r=this.session)==null?void 0:r.namespaces[e])})}setNamespaces(e){const{namespaces:r={},optionalNamespaces:n={},sessionProperties:s,scopedProperties:i}=e;this.optionalNamespaces=Rb(r,n),this.sessionProperties=s,this.scopedProperties=i}validateChain(e){const[r,n]=(e==null?void 0:e.split(":"))||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[r,n];if(r&&!Object.keys(this.namespaces||{}).map(o=>Zf(o)).includes(r))throw new Error(`Namespace '${r}' is not configured. Please call connect() first with namespace config.`);if(r&&n)return[r,n];const s=Zf(Object.keys(this.namespaces)[0]),i=this.rpcProviders[s].getDefaultChain();return[s,i]}async requestAccounts(){const[e]=this.validateChain();return await this.getProvider(e).requestAccounts()}async onChainChanged({currentCaipChainId:e,previousCaipChainId:r,internal:n=!1}){if(!this.namespaces)return;const[s,i]=this.validateChain(e);if(i){if(this.updateNamespaceChain(s,i),n)this.events.emit("chainChanged",i),this.emitAccountsChangedOnChainChange({namespace:s,currentCaipChainId:e,previousCaipChainId:r});else{const o=this.getProvider(s);o?o.setDefaultChain(i):this.session&&this.logger.warn(`Provider for namespace '${s}' not found during chain change`)}await this.persist("namespaces",this.namespaces)}}emitAccountsChangedOnChainChange({namespace:e,currentCaipChainId:r,previousCaipChainId:n}){var s,i;try{if(n===r)return;const o=(i=(s=this.session)==null?void 0:s.namespaces[e])==null?void 0:i.accounts;if(!o)return;const a=o.filter(c=>c.includes(`${r}:`)).map(t3);if(!sc(a))return;this.events.emit("accountsChanged",a)}catch(o){this.logger.warn(o,"Failed to emit accountsChanged on chain change")}}updateNamespaceChain(e,r){if(!this.namespaces)return;const n=this.namespaces[e]?e:`${e}:${r}`,s={chains:[],methods:[],events:[],defaultChain:r};this.namespaces[n]?this.namespaces[n]&&(this.namespaces[n].defaultChain=r):this.namespaces[n]=s}onConnect(){this.createProviders(),this.events.emit("connect",{session:this.session})}async cleanup(){this.connectParams=void 0,this.namespaces=void 0,this.optionalNamespaces=void 0,this.sessionProperties=void 0,await this.deleteFromStore("namespaces"),await this.deleteFromStore("optionalNamespaces"),await this.deleteFromStore("sessionProperties"),this.session=void 0,this.cleanupPendingPairings({deletePairings:!0}),await this.cleanupStorage()}async persist(e,r){var n;const s=((n=this.session)==null?void 0:n.topic)||"";await this.client.core.storage.setItem(`${Nb}/${e}${s}`,r)}async getFromStore(e){var r;const n=((r=this.session)==null?void 0:r.topic)||"";return await this.client.core.storage.getItem(`${Nb}/${e}${n}`)}async deleteFromStore(e){var r;const n=((r=this.session)==null?void 0:r.topic)||"";await this.client.core.storage.removeItem(`${Nb}/${e}${n}`)}async cleanupStorage(){var e;try{if(((e=this.client)==null?void 0:e.session.length)>0)return;const r=await this.client.core.storage.getKeys();for(const n of r)n.startsWith(Nb)&&await this.client.core.storage.removeItem(n)}catch(r){this.logger.warn(r,"Failed to cleanup storage")}}};const f3=2147483648,oye={convertEVMChainIdToCoinType(t){if(t>=f3)throw new Error("Invalid chainId");return(f3|t)>>>0}},Xs=rr({suggestions:[],loading:!1}),aye={state:Xs,subscribe(t){return ln(Xs,()=>t(Xs))},subscribeKey(t,e){return cr(Xs,t,e)},async resolveName(t){var e,r;try{return await Ve.lookupEnsName(t)}catch(n){const s=n;throw new Error(((r=(e=s==null?void 0:s.reasons)==null?void 0:e[0])==null?void 0:r.description)||"Error resolving name")}},async isNameRegistered(t){try{return await Ve.lookupEnsName(t),!0}catch{return!1}},async getSuggestions(t){try{Xs.loading=!0,Xs.suggestions=[];const e=await Ve.getEnsNameSuggestions(t);return Xs.suggestions=e.suggestions||[],Xs.suggestions}catch(e){const r=Dm.parseEnsApiError(e,"Error fetching name suggestions");throw new Error(r)}finally{Xs.loading=!1}},async getNamesForAddress(t){try{if(!q.state.activeCaipNetwork)return[];
vendor: 4,132 bytes, line 36
36const r=ce.getEnsFromCacheForAddress(t);if(r)return r;const n=await Ve.reverseLookupEnsName({address:t});return ce.updateEnsCache({address:t,ens:n,timestamp:Date.now()}),n}catch(e){const r=Dm.parseEnsApiError(e,"Error fetching names for address");throw new Error(r)}},async registerName(t){var s;const e=q.state.activeCaipNetwork,r=(s=q.getAccountData(e==null?void 0:e.chainNamespace))==null?void 0:s.address,n=pe.getAuthConnector();if(!e)throw new Error("Network not found");if(!r||!n)throw new Error("Address or auth connector not found");Xs.loading=!0;try{const i=JSON.stringify({name:t,attributes:{},timestamp:Math.floor(Date.now()/1e3)});Fe.pushTransactionStack({onCancel(){Fe.replace("RegisterAccountName")}});const o=await me.signMessage(i);Xs.loading=!1;const a=e.id;if(!a)throw new Error("Network not found");const c=oye.convertEVMChainIdToCoinType(Number(a));await Ve.registerEnsName({coinType:c,address:r,signature:o,message:i}),q.setAccountProp("profileName",t,e.chainNamespace),ce.updateEnsCache({address:r,ens:[{name:t,registered_at:new Date().toISOString(),updated_at:void 0,addresses:{},attributes:[]}],timestamp:Date.now()}),Fe.replace("RegisterAccountNameSuccess")}catch(i){const o=Dm.parseEnsApiError(i,`Error registering name ${t}`);throw Fe.replace("RegisterAccountName"),new Error(o)}finally{Xs.loading=!1}},validateName(t){return/^[a-zA-Z0-9-]{4,}$/u.test(t)},parseEnsApiError(t,e){var n,s;const r=t;return((s=(n=r==null?void 0:r.reasons)==null?void 0:n[0])==null?void 0:s.description)||e}},Dm=pi(aye);function JT(t){try{return new URL(t)}catch{return null}}function cye(t){const e=t.split("/"),r=e.length>0&&e[0]!==void 0?e[0]:"",n=r.lastIndexOf(":");return n===-1?{host:r}:{host:r.slice(0,n),port:r.slice(n+1)}}function uye(t){const e=t.indexOf("://");if(e===-1)return null;const r=t.slice(0,e),n=e+3;let s=t.indexOf("/",n);s===-1&&(s=t.length);const i=t.slice(n,s),o=i.lastIndexOf(":");return o===-1?{scheme:r,host:i}:{scheme:r,host:i.slice(0,o),port:i.slice(o+1)}}function lye(t,e){if(e.includes("://")){const o=JT(e);return o?o.origin===t:!1}const{host:r,port:n}=cye(e),s=t.indexOf("://");if(s!==-1){const o=s+3;let a=t.indexOf("/",o);a===-1&&(a=t.length);const c=t.slice(o,a);if(n!==void 0)return`${r}:${n}`===c;const u=c.split(":")[0];return r===u}const i=JT(t);return i?n!==void 0?r===i.hostname&&n===(i.port||void 0):r===i.hostname:!1}function dye(t,e,r){let n=r,s;const i=n.indexOf("://");i!==-1&&(s=n.slice(0,i),n=n.slice(i+3));const o=n.indexOf("/");o!==-1&&(n=n.slice(0,o));let a=n,c;const u=a.lastIndexOf(":");u!==-1&&(c=a.slice(u+1),a=a.slice(0,u));const l=a.split(".");for(const p of l)if(p.includes("*")&&p!=="*")return!1;const d=t.protocol.replace(/:$/u,"");if(s&&s!==d||c!==void 0&&c!=="*"&&c!==t.port)return!1;const f=uye(e),h=(f?f.host:t.hostname).split(".");if(l.length!==h.length)return!1;for(let p=l.length-1;p>=0;p-=1){const y=l[p],w=h[p];if(y!=="*"&&y!==w)return!1}return!0}const fye={ton:["ton_sendMessage","ton_signData"],solana:["solana_signMessage","solana_signTransaction","solana_requestAccounts","solana_getAccounts","solana_signAllTransactions","solana_signAndSendTransaction"],eip155:["eth_accounts","eth_requestAccounts","eth_sendRawTransaction","eth_sign","eth_signTransaction","eth_signTypedData","eth_signTypedData_v3","eth_signTypedData_v4","eth_sendTransaction","personal_sign","wallet_switchEthereumChain","wallet_addEthereumChain","wallet_getPermissions","wallet_requestPermissions","wallet_registerOnboarding","wallet_watchAsset","wallet_scanQRCode","wallet_getCallsStatus","wallet_showCallsStatus","wallet_sendCalls","wallet_getCapabilities","wallet_grantPermissions","wallet_revokePermissions","wallet_getAssets"],bip122:["sendTransfer","signMessage","signPsbt","getAccountAddresses"],tron:["tron_signMessage","tron_signTransaction"]},Lo={RPC_ERROR_CODE:{USER_REJECTED:5e3,USER_REJECTED_METHODS:5002},getMethodsByChainNamespace(t){return fye[t]||[]},createDefaultNamespace(t){return{methods:this.getMethodsByChainNamespace(t),events:["accountsChanged","chainChanged"],chains:[],rpcMap:{}}},applyNamespaceOverrides(t,e){if(!e)return{...t};const r={...t},n=new Set;
36if(e.methods&&Object.keys(e.methods).forEach(s=>n.add(s)),e.chains&&Object.keys(e.chains).forEach(s=>n.add(s)),e.events&&Object.keys(e.events).forEach(s=>n.add(s)),e.rpcMap&&Object.keys(e.rpcMap).forEach(s=>{const[i]=s.split(":");i&&n.add(i)}),n.forEach(s=>{r[s]||(r[s]=this.createDefaultNamespace(s))}),e.methods&&Object.entries(e.methods).forEach(([s,i])=>{r[s]&&(r[s].methods=i)}),e.chains&&Object.entries(e.chains).forEach(([s,i])=>{r[s]&&(r[s].chains=i)}),e.events&&Object.entries(e.events).forEach(([s,i])=>{r[s]&&(r[s].events=i)}),e.rpcMap){const s=new Set;Object.entries(e.rpcMap).forEach(([i,o])=>{const[a,c]=i.split(":");!a||!c||!r[a]||(r[a].rpcMap||(r[a].rpcMap={}),s.has(a)||(r[a].rpcMap={},s.add(a)),r[a].rpcMap[c]=o)})}return r},createNamespaces(t,e){const r=t.reduce((n,s)=>{const{id:i,chainNamespace:o,rpcUrls:a}=s,c=a.default.http[0];n[o]||(n[o]=this.createDefaultNamespace(o));const u=`${o}:${i}`,l=n[o];switch(l.chains.push(u),u){case"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp":l.chains.push("solana:4sGjMW1sUnHzSxGspuhpqLDx6wiyjNtZ");break;case"solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1":l.chains.push("solana:8E9rvCKLFQia2Y35HXjjpWzj8weVo44K");break}return l!=null&&l.rpcMap&&c&&(l.rpcMap[i]=c),n},{});return this.applyNamespaceOverrides(r,e)},resolveReownName:async t=>{var n;const e=await Dm.resolveName(t);return((n=(e!=null&&e.addresses?Object.values(e.addresses):[])[0])==null?void 0:n.address)||!1},getChainsFromNamespaces(t={}){return Object.values(t).flatMap(e=>{const r=e.chains||[],n=e.accounts.map(s=>{const[i,o]=s.split(":");return`${i}:${o}`});return Array.from(new Set([...r,...n]))})},isSessionEventData(t){return typeof t=="object"&&t!==null&&"id"in t&&"topic"in t&&"params"in t&&typeof t.params=="object"&&t.params!==null&&"chainId"in t.params&&"event"in t.params&&typeof t.params.event=="object"&&t.params.event!==null},isUserRejectedRequestError(t){try{if(typeof t=="object"&&t!==null){const e=t,r=typeof e.code=="number",n=r&&e.code===Lo.RPC_ERROR_CODE.USER_REJECTED_METHODS,s=r&&e.code===Lo.RPC_ERROR_CODE.USER_REJECTED;return n||s}return!1}catch{return!1}},isOriginAllowed(t,e,r){const n=[...e,...r];if(e.length===0)return!0;const s=JT(t);if(!s)return n.some(i=>!i.includes("*")&&i===t);if(s.hostname==="localhost"||s.hostname==="127.0.0.1")return!0;for(const i of n)if(i.includes("*")){if(dye(s,t,i))return!0}else if(lye(t,i))return!0;return!1},listenWcProvider({universalProvider:t,namespace:e,onConnect:r,onDisconnect:n,onAccountsChanged:s,onChainChanged:i,onDisplayUri:o}){r&&t.on("connect",()=>{const a=Lo.getWalletConnectAccounts(t,e);r(a)}),n&&t.on("disconnect",()=>{n()}),s&&t.on("accountsChanged",a=>{var c,u,l,d,f;try{const g=((l=(u=(c=t.session)==null?void 0:c.namespaces)==null?void 0:u[e])==null?void 0:l.accounts)||[],h=(f=(d=t.rpcProviders)==null?void 0:d[e])==null?void 0:f.getDefaultChain(),p=a.map(y=>{const w=g.find(E=>E.includes(`${e}:${h}:${y}`));if(!w)return;const{chainId:I,chainNamespace:v}=Rr.parseCaipAddress(w);return{address:y,chainId:I,chainNamespace:v}}).filter(y=>y!==void 0);p.length>0&&s(p)}catch(g){console.warn("Failed to parse accounts for namespace on accountsChanged event",e,a,g)}}),i&&t.on("chainChanged",a=>{i(a)}),o&&t.on("display_uri",a=>{o(a)})},getWalletConnectAccounts(t,e){var s,i,o,a;const r=new Set,n=(a=(o=(i=(s=t==null?void 0:t.session)==null?void 0:s.namespaces)==null?void 0:i[e])==null?void 0:o.accounts)==null?void 0:a.map(c=>Rr.parseCaipAddress(c)).filter(({address:c})=>r.has(c.toLowerCase())?!1:(r.add(c.toLowerCase()),!0));return n&&n.length>0?n:[]}},hye=[Y.CONNECTOR_ID.AUTH,Y.CONNECTOR_ID.WALLET_CONNECT];class rq{constructor(e){this.availableConnectors=[],this.availableConnections=[],this.providerHandlers={},this.eventListeners=new Map,this.getCaipNetworks=r=>q.getCaipNetworks(r),this.getConnectorId=r=>pe.getConnectorId(r),e&&this.construct(e)}construct(e){this.projectId=e.projectId,this.namespace=e.namespace,this.adapterType=e.adapterType}get connectors(){return this.availableConnectors}get connections(){return this.availableConnections}get networks(){return this.getCaipNetworks(this.namespace)}onAuthConnected({accounts:e,chainId:r}){const n=this.getCaipNetworks().filter(s=>s.chainNamespace===this.namespace).find(s=>s.id.toString()===(r==null?void 0:r.toString()));e&&n&&this.addConnection({connectorId:Y.CONNECTOR_ID.AUTH,accounts:e,caipNetwork:n})}setAuthProvider(e){e.onConnect(this.onAuthConnected.bind(this)),e.onSocialConnected(this.onAuthConnected.bind(this)),this.addConnector({id:Y.CONNECTOR_ID.AUTH,type:"AUTH",
36name:Y.CONNECTOR_NAMES.AUTH,provider:e,imageId:void 0,chain:this.namespace,chains:[]})}addConnector(...e){const r=new Set;this.availableConnectors=[...e,...this.availableConnectors].filter(n=>r.has(n.id)?!1:(r.add(n.id),!0)),this.emit("connectors",this.availableConnectors)}addConnection(...e){const r=new Set;this.availableConnections=[...e,...this.availableConnections].filter(n=>r.has(n.connectorId.toLowerCase())?!1:(r.add(n.connectorId.toLowerCase()),!0)),this.emit("connections",this.availableConnections)}deleteConnection(e){this.availableConnections=this.availableConnections.filter(r=>r.connectorId.toLowerCase()!==e.toLowerCase()),this.emit("connections",this.availableConnections)}clearConnections(e=!1){this.availableConnections=[],e&&this.emit("connections",this.availableConnections)}setStatus(e,r){q.setAccountProp("status",e,r)}on(e,r){var n;this.eventListeners.has(e)||this.eventListeners.set(e,new Set),(n=this.eventListeners.get(e))==null||n.add(r)}off(e,r){const n=this.eventListeners.get(e);n&&n.delete(r)}removeAllEventListeners(){this.eventListeners.forEach(e=>{e.clear()})}emit(e,r){const n=this.eventListeners.get(e);n&&n.forEach(s=>s(r))}async connectWalletConnect(e){try{return{clientId:(await this.getWalletConnectConnector().connectWalletConnect()).clientId}}catch(r){throw Lo.isUserRejectedRequestError(r)?new MP(r):r}}async switchNetwork(e){var i;const{caipNetwork:r}=e,n=_t.getProviderId(r.chainNamespace),s=_t.getProvider(r.chainNamespace);if(!s)throw new Error("Provider not found");if(n==="WALLET_CONNECT"){s.setDefaultChain(r.caipNetworkId);return}if(n==="AUTH"){const o=(i=pe.getAuthConnector())==null?void 0:i.provider;if(!o)throw new Error("Auth provider not found");const a=qn(r.chainNamespace);await o.switchNetwork({chainId:r.caipNetworkId});const c=await o.getUser({chainId:r.caipNetworkId,preferredAccountType:a});this.emit("switchNetwork",c)}}getWalletConnectConnector(){const e=this.connectors.find(r=>r.id==="walletConnect");if(!e)throw new Error("WalletConnectConnector not found");return e}onConnect(e,r){if(e.length>0){const{address:n,chainId:s}=be.getAccount(e[0]),i=this.getCaipNetworks().filter(a=>a.chainNamespace===this.namespace).find(a=>a.id.toString()===(s==null?void 0:s.toString())),o=this.connectors.find(a=>a.id===r);n&&(this.emit("accountChanged",{address:n,chainId:s,connector:o}),this.addConnection({connectorId:r,accounts:e.map(a=>{const{address:c}=be.getAccount(a);return{address:c}}),caipNetwork:i}))}}onAccountsChanged(e,r,n=!0){var s,i;if(e.length>0){const{address:o}=be.getAccount(e[0]),a=this.getConnection({connectorId:r,connections:this.connections,connectors:this.connectors});o&&((s=this.getConnectorId(Y.CHAIN.EVM))==null?void 0:s.toLowerCase())===r.toLowerCase()&&this.emit("accountChanged",{address:o,chainId:(i=a==null?void 0:a.caipNetwork)==null?void 0:i.id,connector:a==null?void 0:a.connector}),this.addConnection({connectorId:r,accounts:e.map(c=>{const{address:u}=be.getAccount(c);return{address:u}}),caipNetwork:a==null?void 0:a.caipNetwork})}else n&&this.onDisconnect(r)}onDisconnect(e){var r;this.removeProviderListeners(e),this.deleteConnection(e),((r=this.getConnectorId(Y.CHAIN.EVM))==null?void 0:r.toLowerCase())===e.toLowerCase()&&this.emitFirstAvailableConnection(),this.connections.length===0&&this.emit("disconnect")}onChainChanged(e,r){var o;const n=typeof e=="string"&&e.startsWith("0x")?parseInt(e,16).toString():e.toString(),s=this.getConnection({connectorId:r,connections:this.connections,connectors:this.connectors}),i=this.getCaipNetworks().filter(a=>a.chainNamespace===this.namespace).find(a=>a.id.toString()===n);s&&this.addConnection({connectorId:r,accounts:s.accounts,caipNetwork:i}),((o=this.getConnectorId(Y.CHAIN.EVM))==null?void 0:o.toLowerCase())===r.toLowerCase()&&this.emit("switchNetwork",{chainId:n})}listenProviderEvents(e,r){if(hye.includes(e))return;const n=o=>this.onAccountsChanged(o,e),s=o=>this.onChainChanged(o,e),i=()=>this.onDisconnect(e);this.providerHandlers[e]||(r.on("disconnect",i),r.on("accountsChanged",n),r.on("chainChanged",s),this.providerHandlers[e]={provider:r,disconnect:i,accountsChanged:n,chainChanged:s})}removeProviderListeners(e){if(this.providerHandlers[e]){const{provider:r,disconnect:n,accountsChanged:s,chainChanged:i}=this.providerHandlers[e];r.removeListener("disconnect",n),r.removeListener("accountsChanged",s),r.removeListener("chainChanged",i),this.providerHandlers[e]=null}}emitFirstAvailableConnection(){var r;const e=this.getConnection({connections:this.connections,connectors:this.connectors});if(e){const[n]=e.accounts;
36this.emit("accountChanged",{address:n==null?void 0:n.address,chainId:(r=e.caipNetwork)==null?void 0:r.id,connector:e.connector})}}getConnection({address:e,connectorId:r,connections:n,connectors:s}){if(r){const o=n.find(u=>u.connectorId.toLowerCase()===r.toLowerCase());if(!o)return null;const a=s.find(u=>u.id.toLowerCase()===o.connectorId.toLowerCase()),c=e?o.accounts.find(u=>u.address.toLowerCase()===e.toLowerCase()):o.accounts[0];return{...o,account:c,connector:a}}const i=n.find(o=>o.accounts.length>0&&s.some(a=>a.id.toLowerCase()===o.connectorId.toLowerCase()));if(i){const[o]=i.accounts,a=s.find(c=>c.id.toLowerCase()===i.connectorId.toLowerCase());return{...i,account:o,connector:a}}return null}}let il=null;const Sn={getSIWX(){return se.state.siwx},async initializeIfEnabled(t=q.getActiveCaipAddress()){var i,o,a;const e=se.state.siwx;if(!(e&&t))return;const[r,n,s]=t.split(":");if(q.checkIfSupportedNetwork(r,`${r}:${n}`))try{if((i=se.state.remoteFeatures)!=null&&i.emailCapture){const u=(o=q.getAccountData(r))==null?void 0:o.user;await ft.open({view:"DataCapture",data:{email:(u==null?void 0:u.email)??void 0}});return}if(il&&await il,(await e.getSessions(`${r}:${n}`,s)).length)return;await ft.open({view:"SIWXSignMessage"})}catch(c){console.error("SIWXUtil:initializeIfEnabled",c),Xe.sendEvent({type:"track",event:"SIWX_AUTH_ERROR",properties:this.getSIWXEventProperties(c)}),await((a=me._getClient())==null?void 0:a.disconnect().catch(console.error)),Fe.reset("Connect"),Bo.showError("A problem occurred while trying initialize authentication")}},async isAuthenticated(t=q.getActiveCaipAddress()){if(!se.state.siwx||!t)return!0;const{chainNamespace:r,chainId:n,address:s}=Rr.parseCaipAddress(t),i=`${r}:${n}`;return(await Sn.getSessions({address:s,caipNetworkId:i})).length>0},async requestSignMessage(){const t=se.state.siwx,e=be.getPlainAddress(q.getActiveCaipAddress()),r=Vf();if(!t)throw new Error("SIWX is not enabled");if(!e)throw new Error("No ActiveCaipAddress found");if(!r)throw new Error("No ActiveCaipNetwork or client found");try{const n=await t.createMessage({chainId:r.caipNetworkId,accountAddress:e}),s=n.toString();let i="";t.signMessage?i=await t.signMessage({message:s,chainId:r.caipNetworkId,accountAddress:e}):(pe.getConnectorId(r.chainNamespace)===Y.CONNECTOR_ID.AUTH&&Fe.pushTransactionStack({}),i=await me.signMessage(s)||""),await t.addSession({data:n,message:s,signature:i}),q.setLastConnectedSIWECaipNetwork(r),ft.close(),Xe.sendEvent({type:"track",event:"SIWX_AUTH_SUCCESS",properties:this.getSIWXEventProperties()})}catch(n){(!ft.state.open||Fe.state.view==="ApproveTransaction")&&await ft.open({view:"SIWXSignMessage"}),Bo.showError("Error signing message"),Xe.sendEvent({type:"track",event:"SIWX_AUTH_ERROR",properties:this.getSIWXEventProperties(n)}),console.error("SWIXUtil:requestSignMessage",n)}},async cancelSignMessage(){var t;try{const e=this.getSIWX();if((t=e==null?void 0:e.getRequired)==null?void 0:t.call(e)){const n=q.getLastConnectedSIWECaipNetwork();if(n){const s=await(e==null?void 0:e.getSessions(n==null?void 0:n.caipNetworkId,be.getPlainAddress(q.getActiveCaipAddress())||""));s&&s.length>0?await q.switchActiveNetwork(n):await me.disconnect()}else await me.disconnect()}else ft.close();ft.close(),Xe.sendEvent({event:"CLICK_CANCEL_SIWX",type:"track",properties:this.getSIWXEventProperties()})}catch(e){console.error("SIWXUtil:cancelSignMessage",e)}},async getAllSessions(){const t=this.getSIWX(),e=q.getAllRequestedCaipNetworks(),r=[];return await Promise.all(e.map(async n=>{const s=await(t==null?void 0:t.getSessions(n.caipNetworkId,be.getPlainAddress(q.getActiveCaipAddress())||""));s&&r.push(...s)})),r},async getSessions(t){const e=se.state.siwx;let r=t==null?void 0:t.address;if(!r){const s=q.getActiveCaipAddress();r=be.getPlainAddress(s)}let n=t==null?void 0:t.caipNetworkId;if(!n){const s=q.getActiveCaipNetwork();n=s==null?void 0:s.caipNetworkId}return e&&r&&n?e.getSessions(n,r):[]},async isSIWXCloseDisabled(){var e;const t=this.getSIWX();if(t){const r=Fe.state.view==="ApproveTransaction",n=Fe.state.view==="SIWXSignMessage";if(r||n)return((e=t.getRequired)==null?void 0:e.call(t))&&(await this.get
36Sessions()).length===0}return!1},async authConnectorAuthenticate({authConnector:t,chainId:e,socialUri:r,preferredAccountType:n,chainNamespace:s}){var d;const i=Sn.getSIWX(),o=Vf();if(!i||!s.includes(Y.CHAIN.EVM)||(d=se.state.remoteFeatures)!=null&&d.emailCapture){const f=await t.connect({chainId:e,socialUri:r,preferredAccountType:n});return{address:f.address,chainId:f.chainId,accounts:f.accounts}}const a=`${s}:${e}`,c=await i.createMessage({chainId:a,accountAddress:"<<AccountAddress>>"}),u={accountAddress:c.accountAddress,chainId:c.chainId,domain:c.domain,uri:c.uri,version:c.version,nonce:c.nonce,notBefore:c.notBefore,statement:c.statement,resources:c.resources,requestId:c.requestId,issuedAt:c.issuedAt,expirationTime:c.expirationTime,serializedMessage:c.toString()},l=await t.connect({chainId:e,socialUri:r,siwxMessage:u,preferredAccountType:n});return u.accountAddress=l.address,u.serializedMessage=l.message||"",l.signature&&l.message&&await Sn.addEmbeddedWalletSession(u,l.message,l.signature),q.setLastConnectedSIWECaipNetwork(o),{address:l.address,chainId:l.chainId,accounts:l.accounts}},async addEmbeddedWalletSession(t,e,r){if(il)return il;const n=Sn.getSIWX();return n?(il=n.addSession({data:t,message:e,signature:r}).finally(()=>{il=null}),il):Promise.resolve()},async universalProviderAuthenticate({universalProvider:t,chains:e,methods:r}){var u,l,d;const n=Sn.getSIWX(),s=Vf(),i=new Set(e.map(f=>f.split(":")[0]));if(!n||i.size!==1||!i.has("eip155"))return!1;const o=await n.createMessage({chainId:((u=Vf())==null?void 0:u.caipNetworkId)||"",accountAddress:""}),a=await t.authenticate({nonce:o.nonce,domain:o.domain,uri:o.uri,exp:o.expirationTime,iat:o.issuedAt,nbf:o.notBefore,requestId:o.requestId,version:o.version,resources:o.resources,statement:o.statement,chainId:o.chainId,methods:r,chains:[o.chainId,...e.filter(f=>f!==o.chainId)]});Bo.showLoading("Authenticating...",{autoClose:!1});const c={...a.session.peer.metadata,name:a.session.peer.metadata.name,icon:(l=a.session.peer.metadata.icons)==null?void 0:l[0],type:"WALLET_CONNECT"};if(q.setAccountProp("connectedWalletInfo",c,Array.from(i)[0]),(d=a==null?void 0:a.auths)!=null&&d.length){const f=a.auths.map(g=>{const h=t.client.formatAuthMessage({request:g.p,iss:g.p.iss});return{data:{...g.p,accountAddress:g.p.iss.split(":").slice(-1).join(""),chainId:g.p.iss.split(":").slice(2,4).join(":"),uri:g.p.aud??"",version:g.p.version||o.version,expirationTime:g.p.exp,issuedAt:g.p.iat,notBefore:g.p.nbf},message:h,signature:g.s.s,cacao:g}});try{await n.setSessions(f),s&&q.setLastConnectedSIWECaipNetwork(s),Xe.sendEvent({type:"track",event:"SIWX_AUTH_SUCCESS",properties:Sn.getSIWXEventProperties()})}catch(g){throw console.error("SIWX:universalProviderAuth - failed to set sessions",g),Xe.sendEvent({type:"track",event:"SIWX_AUTH_ERROR",properties:Sn.getSIWXEventProperties(g)}),await t.disconnect().catch(console.error),g}finally{Bo.hide()}}return!0},getSIWXEventProperties(t){var r;const e=q.state.activeChain;if(!e)throw new Error("SIWXUtil:getSIWXEventProperties - namespace is required");return{network:((r=q.state.activeCaipNetwork)==null?void 0:r.caipNetworkId)||"",isSmartAccount:qn(e)===Tr.ACCOUNT_TYPES.SMART_ACCOUNT,message:t?be.parseError(t):void 0}},async clearSessions(){const t=this.getSIWX();t&&await t.setSessions([])}};class nq{constructor({provider:e,namespace:r}){this.id=Y.CONNECTOR_ID.WALLET_CONNECT,this.name="WalletConnect",this.type="WALLET_CONNECT",this.imageId="ef1a1fcf-7fe8-4d69-bd6d-fda1345b4400",this.getCaipNetworks=q.getCaipNetworks.bind(q),this.caipNetworks=this.getCaipNetworks(),this.provider=e,this.chain=r}get chains(){return this.getCaipNetworks()}async connectWalletConnect(){if(!await this.authenticate()){const r=this.getCaipNetworks(),n=se.state.universalProviderConfigOverride,s=Lo.createNamespaces(r,n);await this.provider.connect({optionalNamespaces:s})}return{clientId:await this.provider.client.core.crypto.getClientId(),session:this.provider.session}}async disconnect(){await this.provider.disconnect()}async authenticate(){const e=this.chains.map(r=>r.caipNetworkId);return Sn.universalProviderAuthenticate({universalProvider:this.provider,chains:e,methods:pye})}}const pye=["eth_accounts","eth_requestAccounts","eth_sendRawTransaction","eth_sign","eth_signTransaction","eth_signTypedData","eth_signTypedData_v3","eth_signTypedData_v4","eth_sendTransaction","personal_sign","wallet_switchEthereumChain","wallet_addEthereumChain","wallet_getPermissions","wallet_requestPermissions","wallet_registerOnboarding","wallet_watchAsset","wallet_scanQRCode","wallet_getCallsStatus","wallet_sendCalls","wallet_getCapabilities","wallet_grantPermissions","wallet_revokePermissions","wallet_getAssets"],_i=rr({message:"",variant:"info",open:!1}),gye={state:_i,subscribeKey(t,e){return cr(_i,t,e)}
36,open(t,e){const{debug:r}=se.state,{code:n,displayMessage:s,debugMessage:i}=t;s&&r&&(_i.message=s,_i.variant=e,_i.open=!0)},warn(t,e,r){_i.open=!0,_i.message=t,_i.variant="warning",e&&console.warn(e,r)},close(){_i.open=!1,_i.message="",_i.variant="info"}},An=pi(gye),mye={eip155:{native:{assetNamespace:"slip44",assetReference:"60"},defaultTokenNamespace:"erc20"},solana:{native:{assetNamespace:"slip44",assetReference:"501"},defaultTokenNamespace:"token"}},h3={56:"714",204:"714"};class yye extends Error{}function bye(){const{sdkType:t,sdkVersion:e,projectId:r}=se.getSnapshot(),n=new URL("https://rpc.walletconnect.org/v1/json-rpc");return n.searchParams.set("projectId",r),n.searchParams.set("st",t),n.searchParams.set("sv",e),n.searchParams.set("source","fund-wallet"),n.toString()}async function BO(t,e){const r=bye(),{projectId:n}=se.getSnapshot(),s={jsonrpc:"2.0",id:1,method:t,params:{...e||{},projectId:n}},o=await(await fetch(r,{method:"POST",body:JSON.stringify(s),headers:{"Content-Type":"application/json"}})).json();if(o.error)throw new yye(o.error.message);return o}async function nIe(t){return(await BO("reown_getExchanges",t)).result}async function sIe(t){return(await BO("reown_getExchangePayUrl",t)).result}async function iIe(t){return(await BO("reown_getExchangeBuyStatus",t)).result}function oIe(t,e){const{chainNamespace:r,chainId:n}=Rr.parseCaipNetworkId(t),s=mye[r];if(!s)throw new Error(`Unsupported chain namespace for CAIP-19 formatting: ${r}`);let i=s.native.assetNamespace,o=s.native.assetReference;return e!=="native"?(i=s.defaultTokenNamespace,o=e):r==="eip155"&&h3[n]&&(o=h3[n]),`${`${r}:${n}`}/${i}:${o}`}const wye={network:"eip155:1",asset:"native",metadata:{name:"Ethereum",symbol:"ETH",decimals:18}},Eye={network:"eip155:8453",asset:"native",metadata:{name:"Ethereum",symbol:"ETH",decimals:18}},sq={network:"eip155:8453",asset:"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",metadata:{name:"USD Coin",symbol:"USDC",decimals:6}},vye={asset:"0x036CbD53842c5426634e7929541eC2318f3dCF7e"},_ye={network:"eip155:84532",asset:"native",metadata:{name:"Ethereum",symbol:"ETH",decimals:18}},Aye={network:"eip155:1",asset:"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",metadata:{name:"USD Coin",symbol:"USDC",decimals:6}},Cye={network:"eip155:42161",asset:"0xaf88d065e77c8cC2239327C5EDb3A432268e5831",metadata:{name:"USD Coin",symbol:"USDC",decimals:6}},Iye={network:"eip155:137",asset:"0x2791bca1f2de4661ed88a30c99a7a9449aa84174",metadata:{name:"USD Coin",symbol:"USDC",decimals:6}},Sye={network:"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",asset:"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",metadata:{name:"USD Coin",symbol:"USDC",decimals:6}},Tye={network:"eip155:1",asset:"0xdAC17F958D2ee523a2206206994597C13D831ec7",metadata:{name:"Tether USD",symbol:"USDT",decimals:6}},Pye={network:"eip155:10",asset:"0x94b008aA00579c1307B0EF2c499aD98a8ce58e58",metadata:{name:"Tether USD",symbol:"USDT",decimals:6}},Oye={network:"eip155:42161",asset:"0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9",metadata:{name:"Tether USD",symbol:"USDT",decimals:6}},Nye={network:"eip155:137",asset:"0xc2132d05d31c914a87c6611c10748aeb04b58e8f",metadata:{name:"Tether USD",symbol:"USDT",decimals:6}},xye={network:"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",asset:"Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB",metadata:{name:"Tether USD",symbol:"USDT",decimals:6}},Rye={network:"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",asset:"native",metadata:{name:"Solana",symbol:"SOL",decimals:9}},Bye={ethereumETH:wye,baseETH:Eye,baseUSDC:sq,baseSepoliaETH:_ye,ethereumUSDC:Aye,arbitrumUSDC:Cye,polygonUSDC:Iye,solanaUSDC:Sye,ethereumUSDT:Tye,optimismUSDT:Pye,arbitrumUSDT:Oye,polygonUSDT:Nye,solanaUSDT:xye,solanaSOL:Rye};function aIe(t){return Object.values(Bye).filter(e=>e.network===t)}const UI={getInitialWallets(){return an.connectorList().map(t=>t.kind==="connector"?this.mapConnectorToWalletItem(t.connector,t.subtype):t.kind==="wallet"?this.mapWalletToWalletItem(t.wallet):null).filter(Boolean)},getWalletConnectWallets(t,e){return e.length>0?e.map(r=>this.mapWalletToWalletItem(r)):Ja.getWalletConnectWallets(t).map(r=>this.mapWalletToWalletItem(r))},serializeWcWallet(t){return t?{walletInfo:{description:t.description,supportedChains:t.chains,website:t.homepage,installationLinks:{appStore:t.app_store,playStore:t.play_store,chromeStore:t.chrome_store,desktopLink:t.desktop_link},deepLink:t.mobile_link,linkMode:t.link_mode,isCertified:t.badge_type==="certified",supp
36ortsWcPay:t.supports_wcpay??!1}}:{walletInfo:{}}},mapConnectorToWalletItem(t,e){var s,i;const n=((s=t.connectors)==null?void 0:s.length)?((i=t.connectors)==null?void 0:i.map(o=>({id:o.id,chain:o.chain,chainImageUrl:vu.getChainNamespaceImageUrl(o.chain)})))||[]:[{id:t.id,chain:t.chain,chainImageUrl:vu.getChainNamespaceImageUrl(t.chain)}];return{id:t.id,connectors:e==="walletConnect"?[]:n,name:t.name,imageUrl:t.imageUrl||vu.getAssetImageUrl(t.imageId),imageId:t.imageId,isInjected:e!=="walletConnect",isRecent:!1,...this.serializeWcWallet(t.explorerWallet)}},mapWalletToWalletItem(t){return{id:t.id,connectors:[],name:t.name,imageUrl:vu.getWalletImageUrl(t.image_id),imageId:t.image_id,isInjected:!1,isRecent:!1,...this.serializeWcWallet(t)}},mapWalletItemToWcWallet(t){return{id:t.id,name:t.name,image_id:t.imageId,image_url:t.imageUrl,description:t.walletInfo.description,mobile_link:t.walletInfo.deepLink,link_mode:t.walletInfo.linkMode??null,chains:t.walletInfo.supportedChains}}},na={async fetchWallets(t){const{query:e,...r}=t??{},n=r.search??e;n?await Ae.searchWallet({...r,search:n}):(Ae.state.search=[],await Ae.fetchWalletsByPage({page:1,...r}))},getWalletList(){return{wallets:UI.getInitialWallets(),wcWallets:UI.getWalletConnectWallets(Ae.state.wallets,Ae.state.search),page:Ae.state.page,count:Ae.state.count}},subscribeWalletList(t){const e=[cr(Ae.state,"wallets",t),cr(Ae.state,"search",t),cr(Ae.state,"page",t),cr(Ae.state,"count",t)];return()=>e.forEach(r=>r())},async prefetchWalletConnectUri(t){this.resetWcUri(),await me.connectWalletConnect({cache:"auto"})},getWalletConnectUri(){return{wcUri:me.state.wcUri,wcError:!!me.state.wcError,wcFetchingUri:me.state.wcFetchingUri}},subscribeWalletConnectUri(t){const e=[cr(me.state,"wcUri",t),cr(me.state,"wcError",t),cr(me.state,"wcFetchingUri",t)];return()=>e.forEach(r=>r())},async connect(t,e,r){Tn.set({connectingWallet:t});const n=be.isMobile(),s=e||q.state.activeChain;try{const i=t==null?void 0:t.connectors.find(c=>c.chain===s),o=i&&s?pe.getConnector({id:i==null?void 0:i.id,namespace:s}):void 0,a=!o&&s?pe.getConnector({id:t==null?void 0:t.id,namespace:s}):void 0;if(t!=null&&t.isInjected&&o)await Rl.connectExternal(o);else if(a)await Rl.connectExternal(a);else if(n){const c=UI.mapWalletItemToWcWallet(t);c.mobile_link?Ty.onConnectMobile(c,r==null?void 0:r.wcPayUrl):YL.handleMobileDeeplinkRedirect(t.id,s,{isCoinbaseDisabled:se.state.enableCoinbase===!1})}else await me.connectWalletConnect({cache:"never"})}catch(i){throw Tn.set({connectingWallet:void 0}),i}},resetWcUri(){me.resetUri(),me.setWcLinking(void 0)},resetConnectingWallet(){Tn.set({connectingWallet:void 0})}},Fn={METMASK_CONNECTOR_NAME:"MetaMask",TRUST_CONNECTOR_NAME:"Trust Wallet",SOLFLARE_CONNECTOR_NAME:"Solflare",PHANTOM_CONNECTOR_NAME:"Phantom",COIN98_CONNECTOR_NAME:"Coin98",MAGIC_EDEN_CONNECTOR_NAME:"Magic Eden",BACKPACK_CONNECTOR_NAME:"Backpack",BITGET_CONNECTOR_NAME:"Bitget Wallet",FRONTIER_CONNECTOR_NAME:"Frontier",XVERSE_CONNECTOR_NAME:"Xverse Wallet",LEATHER_CONNECTOR_NAME:"Leather",OKX_CONNECTOR_NAME:"OKX Wallet",BINANCE_CONNECTOR_NAME:"Binance Wallet",EIP155:Y.CHAIN.EVM,ADD_CHAIN_METHOD:"wallet_addEthereumChain",EIP6963_ANNOUNCE_EVENT:"eip6963:announceProvider",EIP6963_REQUEST_EVENT:"eip6963:requestProvider",CONNECTOR_RDNS_MAP:{coinbaseWallet:"com.coinbase.wallet",coinbaseWalletSDK:"com.coinbase.wallet"},CONNECTOR_TYPE_EXTERNAL:"EXTERNAL",CONNECTOR_TYPE_WALLET_CONNECT:"WALLET_CONNECT",CONNECTOR_TYPE_INJECTED:"INJECTED",CONNECTOR_TYPE_ANNOUNCED:"ANNOUNCED",CONNECTOR_TYPE_AUTH:"AUTH",CONNECTOR_TYPE_MULTI_CHAIN:"MULTI_CHAIN",CONNECTOR_TYPE_W3M_AUTH:"AUTH",getSDKVersionWarningMessage(t,e){return`
37     @@@@@@@           @@@@@@@@@@@@@@@@@@      
38   @@@@@@@@@@@      @@@@@@@@@@@@@@@@@@@@@@@@   
39  @@@@@@@@@@@@@    @@@@@@@@@@@@@@@@@@@@@@@@@@  
40 @@@@@@@@@@@@@@@  @@@@@@@@@@@@@@@@@@@@@@@@@@@  
41 @@@@@@@@@@@@@@@  @@@@@@@@@@@@@@   @@@@@@@@@@@ 
42 @@@@@@@@@@@@@@@  @@@@@@@@@@@@@   @@@@@@@@@@@@ 
43 @@@@@@@@@@@@@@@  @@@@@@@@@@@@@  @@@@@@@@@@@@@
44 @@@@@@@@@@@@@@@  @@@@@@@@@@@@   @@@@@@@@@@@@@    
45 @@@@@@   @@@@@@  @@@@@@@@@@@   @@@@@@@@@@@@@@    
46 @@@@@@   @@@@@@  @@@@@@@@@@@  @@@@@@@@@@@@@@@ 
47 @@@@@@@@@@@@@@@  @@@@@@@@@@   @@@@@@@@@@@@@@@ 
48 @@@@@@@@@@@@@@@  @@@@@@@@@@@@@@@@@@@@@@@@@@@  
49  @@@@@@@@@@@@@    @@@@@@@@@@@@@@@@@@@@@@@@@@  
50   @@@@@@@@@@@      @@@@@@@@@@@@@@@@@@@@@@@@   
51      @@@@@            @@@@@@@@@@@@@@@@@@  
52      
53AppKit SDK version ${t} is outdated. Latest version is ${e}. Please update to the latest version for bug fixes and new features.
54            
55Changelog: https://github.com/reown-com/appkit/releases
56NPM Registry: https://www.npmjs.com/package/@reown/appkit`}},iq={NetworkImageIds:{1:"ba0ba0cd-17c6-4806-ad93-f9d174f17900",42161:"3bff954d-5cb0-47a0-9a23-d20192e74600",43114:"30c46e53-e989-45fb-4549-be3bd4eb3b00",56:"93564157-2e8e-4ce7-81df-b264dbee9b00",250:"06b26297-fe0c-4733-5d6b-ffa5498aac00",10:"ab9c186a-c52f-464b-2906-ca59d760a400",137:"41d04d42-da3b-4453-8506-668cc0727900",5e3:"e86fae9b-b770-4eea-e520-150e12c81100",295:"6a97d510-cac8-4e58-c7ce-e8681b044c00",11155111:"e909ea0a-f92a-4512-c8fc-748044ea6800",84532:"a18a7ecd-e307-4360-4746-283182228e00",1301:"4eeea7ef-0014-4649-5d1d-07271a80f600",130:"2257980a-3463-48c6-cbac-a42d2a956e00",10143:"0a728e83-bacb-46db-7844-948f05434900",143:"0a728e83-bacb-46db-7844-948f05434900",100:"02b53f6a-e3d4-479e-1cb4-21178987d100",9001:"f926ff41-260d-4028-635e-91913fc28e00",324:"b310f07f-4ef7-49f3-7073-2a0a39685800",314:"5a73b3dd-af74-424e-cae0-0de859ee9400",4689:"34e68754-e536-40da-c153-6ef2e7188a00",1088:"3897a66d-40b9-4833-162f-a2c90531c900",1284:"161038da-44ae-4ec7-1208-0ea569454b00",1285:"f1d73bb6-5450-4e18-38f7-fb6484264a00",7777777:"845c60df-d429-4991-e687-91ae45791600",42220:"ab781bbc-ccc6-418d-d32d-789b15da1f00",8453:"7289c336-3981-4081-c5f4-efc26ac64a00",1313161554:"3ff73439-a619-4894-9262-4470c773a100",2020:"b8101fc0-9c19-4b6f-ec65-f6dfff106e00",2021:"b8101fc0-9c19-4b6f-ec65-f6dfff106e00",80094:"e329c2c9-59b0-4a02-83e4-212ff3779900",2741:"fc2427d1-5af9-4a9c-8da5-6f94627cd900","5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp":"a1b58899-f671-4276-6a5e-56ca5bd59700","4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z":"a1b58899-f671-4276-6a5e-56ca5bd59700",EtWTRABZaYq6iMfeYKouRu166VU2xqa1:"a1b58899-f671-4276-6a5e-56ca5bd59700","000000000019d6689c085ae165831e93":"0b4838db-0161-4ffe-022d-532bf03dba00","000000000933ea01ad0ee984209779ba":"39354064-d79b-420b-065d-f980c4b78200","00000008819873e925422c1ff0f99f7c":"b3406e4a-bbfc-44fb-e3a6-89673c78b700","-239":"20f673c0-095e-49b2-07cf-eb5049dcf600","-3":"20f673c0-095e-49b2-07cf-eb5049dcf600","0x2b6653dc":"3502bb86-cc4e-420f-a387-59ea63a28b00","0x94a9059e":"3502bb86-cc4e-420f-a387-59ea63a28b00","0xcd8690dc":"3502bb86-cc4e-420f-a387-59ea63a28b00"}},zi={getCaipTokens(t){if(!t)return;const e={};return Object.entries(t).forEach(([r,n])=>{e[`${Fn.EIP155}:${r}`]=n}),e},isLowerCaseMatch(t,e){return(t==null?void 0:t.toLowerCase())===(e==null?void 0:e.toLowerCase())},getActiveNamespaceConnectedToAuth(){const t=q.state.activeChain;return Y.AUTH_CONNECTOR_SUPPORTED_CHAINS.find(e=>pe.getConnectorId(e)===Y.CONNECTOR_ID.AUTH&&e===t)},withRetry({conditionFn:t,intervalMs:e,maxRetries:r}){let n=0;return new Promise(s=>{async function i(){return n+=1,await t()?s(!0):n>=r?s(!1):(setTimeout(i,e),null)}i()})},userChainIdToChainNamespace(t){if(typeof t=="number")return Y.CHAIN.EVM;const[e]=t.split(":");return e},getOtherAuthNamespaces(t){return t?Y.AUTH_CONNECTOR_SUPPORTED_CHAINS.filter(n=>n!==t):[]},getConnectorStorageInfo(t,e){const n=ce.getConnections()[e]??[];return{hasDisconnected:ce.isConnectorDisconnected(t,e),hasConnected:n.some(s=>zi.isLowerCaseMatch(s.connectorId,t))}}},kye=new AbortController,Cn={EmbeddedWalletAbortController:kye,UniversalProviderErrors:{UNAUTHORIZED_DOMAIN_NOT_ALLOWED:{message:"Unauthorized: origin not allowed",alertErrorKey:"ORIGIN_NOT_ALLOWED"},JWT_VALIDATION_ERROR:{message:"JWT validation error: JWT Token is not yet valid",alertErrorKey:"JWT_TOKEN_NOT_VALID"},INVALID_KEY:{message:"Unauthorized: invalid key",alertErrorKey:"INVALID_PROJECT_ID"}},ALERT_ERRORS:{SWITCH_NETWORK_NOT_FOUND:{code:"APKT001",displayMessage:"Network Not Found",debugMessage:"The specified network is not recognized. Please ensure it is included in the `networks` array of your `createAppKit` configuration."},ORIGIN_NOT_ALLOWED:{code:"APKT002",displayMessage:"Invalid App Configuration",debugMessage:()=>`The origin ${bm()?window.origin:"unknown"} is not in your allow list. Please update your allowed domains at https://dashboard.reown.com. [PID: ${se.state.projectId}]`},IFRAME_LOAD_FAILED:{code:"APKT003",displayMessage:"Network Error: Wallet Load Failed",debugMessage:()=>"Failed to load the embedded wallet. This may be due to network issues or server downtime. Please check your network connection and try again shortly. Contact support if the issue persists."},IFRAME_REQUEST_TIMEOUT:{code:"APKT004",displayMessage:"Wallet Request Timeout",debugMessage:()=>"The request to the embedded wallet timed out. Please check your network connection and try again shortly. Contact support if the issue persists."},UNVERIFIED_DOMAIN:{code:"APKT005",displayMessage:"Unverified Domain",debugMessage:()=>"Embedded wallet load failed. Ensure your domain is verified in https://dashboard.reown.com."},JWT_TOKEN_NOT_VALID:{code:"APKT006",displayMessage:"Session Expired",debugMessage:"Your session is invali
56d or expired. Please check your system’s date and time settings, then reconnect."},INVALID_PROJECT_ID:{code:"APKT007",displayMessage:"Invalid Project ID",debugMessage:"The specified project ID is invalid. Please visit https://dashboard.reown.com to obtain a valid project ID."},PROJECT_ID_NOT_CONFIGURED:{code:"APKT008",displayMessage:"Project ID Missing",debugMessage:"No project ID is configured. You can create and configure a project ID at https://dashboard.reown.com."},SERVER_ERROR_APP_CONFIGURATION:{code:"APKT009",displayMessage:"Server Error",debugMessage:t=>`Unable to fetch App Configuration. ${t}. Please check your network connection and try again shortly. Contact support if the issue persists.`},RATE_LIMITED_APP_CONFIGURATION:{code:"APKT010",displayMessage:"Rate Limited",debugMessage:"You have been rate limited while retrieving App Configuration. Please wait a few minutes and try again. Contact support if the issue persists."}},ALERT_WARNINGS:{LOCAL_CONFIGURATION_IGNORED:{debugMessage:t=>`[Reown Config Notice] ${t}`},INACTIVE_NAMESPACE_NOT_CONNECTED:{code:"APKTW001",displayMessage:"Inactive Namespace Not Connected",debugMessage:(t,e)=>`An error occurred while connecting an inactive namespace ${t}: "${e}"`},INVALID_EMAIL:{code:"APKTW002",displayMessage:"Invalid Email Address",debugMessage:"Please enter a valid email address"}}},oq={TOKEN_ADDRESSES_BY_SYMBOL:{USDC:{8453:sq.asset,84532:vye.asset}},getTokenSymbolByAddress(t){if(!t)return;const[e]=Object.entries(oq.TOKEN_ADDRESSES_BY_SYMBOL).find(([r,n])=>Object.values(n).includes(t))??[];return e}},jye={createLogger(t,e="error"){const r=HP({level:e}),{logger:n}=kA({opts:r});return n.error=(...s)=>{for(const i of s)if(i instanceof Error){t(i,...s);return}t(void 0,...s)},n}},Dye="rpc.walletconnect.org";function p3(t,e){const r=new URL("https://rpc.walletconnect.org/v1/");return r.searchParams.set("chainId",t),r.searchParams.set("projectId",e),r.toString()}const MI=["near:mainnet","solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp","eip155:1101","eip155:56","eip155:42161","eip155:7777777","eip155:59144","eip155:324","solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1","eip155:5000","solana:4sgjmw1sunhzsxgspuhpqldx6wiyjntz","eip155:80084","eip155:5003","eip155:100","eip155:8453","eip155:42220","eip155:1313161555","eip155:17000","eip155:1","eip155:300","eip155:1313161554","eip155:1329","eip155:84532","eip155:421614","eip155:11155111","eip155:8217","eip155:43114","solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z","eip155:999999999","eip155:11155420","eip155:80002","eip155:97","eip155:43113","eip155:137","eip155:10","eip155:1301","eip155:80094","eip155:80069","eip155:560048","eip155:31","eip155:2818","eip155:57054","eip155:911867","eip155:534351","eip155:1112","eip155:534352","eip155:1111","eip155:146","eip155:130","eip155:1284","eip155:30","eip155:2810","eip155:55931","bip122:000000000019d6689c085ae165831e93","bip122:000000000933ea01ad0ee984209779ba","tron:0x2b6653dc","tron:0xcd8690dc"],Ff={extendRpcUrlWithProjectId(t,e){let r=!1;try{r=new URL(t).host===Dye}catch{r=!1}if(r){const n=new URL(t);return n.searchParams.has("projectId")||n.searchParams.set("projectId",e),n.toString()}return t},isCaipNetwork(t){return"chainNamespace"in t&&"caipNetworkId"in t},getChainNamespace(t){return this.isCaipNetwork(t)?t.chainNamespace:Y.CHAIN.EVM},getCaipNetworkId(t){return this.isCaipNetwork(t)?t.caipNetworkId:`${Y.CHAIN.EVM}:${t.id}`},getDefaultRpcUrl(t,e,r){var s,i,o;const n=(o=(i=(s=t.rpcUrls)==null?void 0:s.default)==null?void 0:i.http)==null?void 0:o[0];return MI.includes(e)?p3(e,r):n||""},extendCaipNetwork(t,{customNetworkImageUrls:e,projectId:r,customRpcUrls:n}){var f,g,h,p,y,w,I;const s=this.getChainNamespace(t),i=this.getCaipNetworkId(t),o=(h=(g=(f=t.rpcUrls)==null?void 0:f.default)==null?void 0:g.http)==null?void 0:h[0],a=this.getDefaultRpcUrl(t,i,r),c=((w=(y=(p=t==null?void 0:t.rpcUrls)==null?void 0:p.chainDefault)==null?void 0:y.http)==null?void 0:w[0])||o,u=((I=n==null?void 0:n[i])==null?void 0:I.map(v=>v.url))||[],l=[...u,...a?[a]:[]],d=[...u];return c&&!d.includes(c)&&d.push(c),{...t,chainNamespace:s,caipNetworkId:i,assets:{imageId:iq.NetworkImageIds[t.id],imageUrl:e==null?void 0:e[t.id]},rpcUrls:{...t.rpcUrls,default:{http:l},chainDefault:{http:d}}}},extendCaipNetworks(t,{customNetworkImageUrls:e,projectId:r,customRpcUrls:n}){return t.map(s=>Ff.extendCaipNetwork(s,{customNetworkImageUrls:e,customRpcUrls:n,projectId:r}))}
56,getViemTransport(t,e,r){var s,i,o;const n=[];return r==null||r.forEach(a=>{n.push(hb(a.url,a.config))}),MI.includes(t.caipNetworkId)&&n.push(hb(p3(t.caipNetworkId,e),{fetchOptions:{headers:{"Content-Type":"text/plain"}}})),(o=(i=(s=t==null?void 0:t.rpcUrls)==null?void 0:s.default)==null?void 0:i.http)==null||o.forEach(a=>{n.push(hb(a))}),Jx(n)},extendWagmiTransports(t,e,r){if(MI.includes(t.caipNetworkId)){const n=this.getDefaultRpcUrl(t,t.caipNetworkId,e);return Jx([r,hb(n)])}return r},getUnsupportedNetwork(t){return{id:t.split(":")[1],caipNetworkId:t,name:Y.UNSUPPORTED_NETWORK_NAME,chainNamespace:t.split(":")[0],nativeCurrency:{name:"",decimals:0,symbol:""},rpcUrls:{default:{http:[]}}}},getCaipNetworkFromStorage(t){var c;const e=ce.getActiveCaipNetworkId(),r=q.getAllRequestedCaipNetworks(),n=Array.from(((c=q.state.chains)==null?void 0:c.keys())||[]),s=e==null?void 0:e.split(":")[0],i=s?n.includes(s):!1,o=r==null?void 0:r.find(u=>u.caipNetworkId===e);return i&&!o&&e?this.getUnsupportedNetwork(e):o||t||(r==null?void 0:r[0])}};class Um{constructor(){}static getInstance({projectId:e,chainId:r,enableLogger:n,onTimeout:s,abortController:i,getActiveCaipNetwork:o,getCaipNetworks:a}){var d;const{metadata:c,sdkVersion:u,sdkType:l}=se.getSnapshot();return Um.instance||(Um.instance=new WY({projectId:e,chainId:r,enableLogger:n,onTimeout:s,abortController:i,getActiveCaipNetwork:o,getCaipNetworks:a,enableCloudAuthAccount:!!((d=se.state.remoteFeatures)!=null&&d.emailCapture),metadata:c,sdkVersion:u,sdkType:l})),Um.instance}}/**
57 * @license
58 * Copyright 2019 Google LLC
59 * SPDX-License-Identifier: BSD-3-Clause
60 */const g_=globalThis,kO=g_.ShadowRoot&&(g_.ShadyCSS===void 0||g_.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,jO=Symbol(),g3=new WeakMap;let aq=class{constructor(e,r,n){if(this._$cssResult$=!0,n!==jO)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=r}get styleSheet(){let e=this.o;const r=this.t;if(kO&&e===void 0){const n=r!==void 0&&r.length===1;n&&(e=g3.get(r)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&g3.set(r,e))}return e}toString(){return this.cssText}};const ki=t=>new aq(typeof t=="string"?t:t+"",void 0,jO),eu=(t,...e)=>{const r=t.length===1?t[0]:e.reduce((n,s,i)=>n+(o=>{if(o._$cssResult$===!0)return o.cssText;if(typeof o=="number")return o;throw Error("Value passed to 'css' function must be a 'css' function result: "+o+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+t[i+1],t[0]);return new aq(r,t,jO)},Uye=(t,e)=>{if(kO)t.adoptedStyleSheets=e.map(r=>r instanceof CSSStyleSheet?r:r.styleSheet);else for(const r of e){const n=document.createElement("style"),s=g_.litNonce;s!==void 0&&n.setAttribute("nonce",s),n.textContent=r.cssText,t.appendChild(n)}},m3=kO?t=>t:t=>t instanceof CSSStyleSheet?(e=>{let r="";for(const n of e.cssRules)r+=n.cssText;return ki(r)})(t):t;/**
61 * @license
62 * Copyright 2017 Google LLC
63 * SPDX-License-Identifier: BSD-3-Clause
64 */const{is:Mye,defineProperty:$ye,getOwnPropertyDescriptor:Lye,getOwnPropertyNames:Fye,getOwnPropertySymbols:Hye,getPrototypeOf:qye}=Object,Tu=globalThis,y3=Tu.trustedTypes,zye=y3?y3.emptyScript:"",$I=Tu.reactiveElementPolyfillSupport,Mm=(t,e)=>t,QT={toAttribute(t,e){switch(e){case Boolean:t=t?zye:null;break;case Object:case Array:t=t==null?t:JSON.stringify(t)}return t},fromAttribute(t,e){let r=t;switch(e){case Boolean:r=t!==null;break;case Number:r=t===null?null:Number(t);break;case Object:case Array:try{r=JSON.parse(t)}catch{r=null}}return r}},cq=(t,e)=>!Mye(t,e),b3={attribute:!0,type:String,converter:QT,reflect:!1,useDefault:!1,hasChanged:cq};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),Tu.litPropertyMetadata??(Tu.litPropertyMetadata=new WeakMap);let Hf=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??(this.l=[])).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,r=b3){if(r.state&&(r.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((r=Object.create(r)).wrapped=!0),this.elementProperties.set(e,r),!r.noAccessor){const n=Symbol(),s=this.getPropertyDescriptor(e,n,r);s!==void 0&&$ye(this.prototype,e,s)}}static getPropertyDescriptor(e,r,n){const{get:s,set:i}=Lye(this.prototype,e)??{get(){return this[r]},set(o){this[r]=o}};return{get:s,set(o){const a=s==null?void 0:s.call(this);i==null||i.call(this,o),this.requestUpdate(e,a,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??b3}static _$Ei(){if(this.hasOwnProperty(Mm("elementProperties")))return;const e=qye(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(Mm("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Mm("properties"))){const r=this.properties,n=[...Fye(r),...Hye(r)];for(const s of n)this.createProperty(s,r[s])}const e=this[Symbol.metadata];if(e!==null){const r=litPropertyMetadata.get(e);if(r!==void 0)for(const[n,s]of r)this.elementProperties.set(n,s)}this._$Eh=new Map;for(const[r,n]of this.elementProperties){const s=this._$Eu(r,n);s!==void 0&&this._$Eh.set(s,r)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const r=[];if(Array.isArray(e)){const n=new Set(e.flat(1/0).reverse());for(const s of n)r.unshift(m3(s))}else e!==void 0&&r.push(m3(e));return r}static _$Eu(e,r){const n=r.attribute;return n===!1?void 0:typeof n=="string"?n:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){var e;this._$ES=new Promise(r=>this.enableUpdating=r),this._$AL=new Map,this._$E_(),this.requestUpdate(),(e=this.constructor.l)==null||e.forEach(r=>r(this))}addController(e){var r;(this._$EO??(this._$EO=new Set)).add(e),this.renderRoot!==void 0&&this.isConnected&&((r=e.hostConnected)==null||r.call(e))}
vendor: 18,785 bytes, lines 64-74
64removeController(e){var r;(r=this._$EO)==null||r.delete(e)}_$E_(){const e=new Map,r=this.constructor.elementProperties;for(const n of r.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Uye(e,this.constructor.elementStyles),e}connectedCallback(){var e;this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(e=this._$EO)==null||e.forEach(r=>{var n;return(n=r.hostConnected)==null?void 0:n.call(r)})}enableUpdating(e){}disconnectedCallback(){var e;(e=this._$EO)==null||e.forEach(r=>{var n;return(n=r.hostDisconnected)==null?void 0:n.call(r)})}attributeChangedCallback(e,r,n){this._$AK(e,n)}_$ET(e,r){var i;const n=this.constructor.elementProperties.get(e),s=this.constructor._$Eu(e,n);if(s!==void 0&&n.reflect===!0){const o=(((i=n.converter)==null?void 0:i.toAttribute)!==void 0?n.converter:QT).toAttribute(r,n.type);this._$Em=e,o==null?this.removeAttribute(s):this.setAttribute(s,o),this._$Em=null}}_$AK(e,r){var i,o;const n=this.constructor,s=n._$Eh.get(e);if(s!==void 0&&this._$Em!==s){const a=n.getPropertyOptions(s),c=typeof a.converter=="function"?{fromAttribute:a.converter}:((i=a.converter)==null?void 0:i.fromAttribute)!==void 0?a.converter:QT;this._$Em=s;const u=c.fromAttribute(r,a.type);this[s]=u??((o=this._$Ej)==null?void 0:o.get(s))??u,this._$Em=null}}requestUpdate(e,r,n,s=!1,i){var o;if(e!==void 0){const a=this.constructor;if(s===!1&&(i=this[e]),n??(n=a.getPropertyOptions(e)),!((n.hasChanged??cq)(i,r)||n.useDefault&&n.reflect&&i===((o=this._$Ej)==null?void 0:o.get(e))&&!this.hasAttribute(a._$Eu(e,n))))return;this.C(e,r,n)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,r,{useDefault:n,reflect:s,wrapped:i},o){n&&!(this._$Ej??(this._$Ej=new Map)).has(e)&&(this._$Ej.set(e,o??r??this[e]),i!==!0||o!==void 0)||(this._$AL.has(e)||(this.hasUpdated||n||(r=void 0),this._$AL.set(e,r)),s===!0&&this._$Em!==e&&(this._$Eq??(this._$Eq=new Set)).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(r){Promise.reject(r)}const e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var n;if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(const[i,o]of this._$Ep)this[i]=o;this._$Ep=void 0}const s=this.constructor.elementProperties;if(s.size>0)for(const[i,o]of s){const{wrapped:a}=o,c=this[i];a!==!0||this._$AL.has(i)||c===void 0||this.C(i,void 0,o,c)}}let e=!1;const r=this._$AL;try{e=this.shouldUpdate(r),e?(this.willUpdate(r),(n=this._$EO)==null||n.forEach(s=>{var i;return(i=s.hostUpdate)==null?void 0:i.call(s)}),this.update(r)):this._$EM()}catch(s){throw e=!1,this._$EM(),s}e&&this._$AE(r)}willUpdate(e){}_$AE(e){var r;(r=this._$EO)==null||r.forEach(n=>{var s;return(s=n.hostUpdated)==null?void 0:s.call(n)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&(this._$Eq=this._$Eq.forEach(r=>this._$ET(r,this[r]))),this._$EM()}updated(e){}firstUpdated(e){}};Hf.elementStyles=[],Hf.shadowRootOptions={mode:"open"},Hf[Mm("elementProperties")]=new Map,Hf[Mm("finalized")]=new Map,$I==null||$I({ReactiveElement:Hf}),(Tu.reactiveElementVersions??(Tu.reactiveElementVersions=[])).push("2.1.2");/**
65 * @license
66 * Copyright 2017 Google LLC
67 * SPDX-License-Identifier: BSD-3-Clause
68 */const $m=globalThis,w3=t=>t,sA=$m.trustedTypes,E3=sA?sA.createPolicy("lit-html",{createHTML:t=>t}):void 0,uq="$lit$",tu=`lit$${Math.random().toFixed(9).slice(2)}$`,lq="?"+tu,Wye=`<${lq}>`,jd=document,By=()=>jd.createComment(""),ky=t=>t===null||typeof t!="object"&&typeof t!="function",DO=Array.isArray,Vye=t=>DO(t)||typeof(t==null?void 0:t[Symbol.iterator])=="function",LI=`[ 	
69\f\r]`,cg=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,v3=/-->/g,_3=/>/g,ol=RegExp(`>|${LI}(?:([^\\s"'>=/]+)(${LI}*=${LI}*(?:[^ 	
70\f\r"'\`<>=]|("|')|))|$)`,"g"),A3=/'/g,C3=/"/g,dq=/^(?:script|style|textarea|title)$/i,fq=t=>(e,...r)=>({_$litType$:t,strings:e,values:r}),lIe=fq(1),dIe=fq(2),pp=Symbol.for("lit-noChange"),Zr=Symbol.for("lit-nothing"),I3=new WeakMap,Vl=jd.createTreeWalker(jd,129);function hq(t,e){if(!DO(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return E3!==void 0?E3.createHTML(e):e}const Gye=(t,e)=>{const r=t.length-1,n=[];let s,i=e===2?"<svg>":e===3?"<math>":"",o=cg;for(let a=0;a<r;a++){const c=t[a];let u,l,d=-1,f=0;for(;f<c.length&&(o.lastIndex=f,l=o.exec(c),l!==null);)f=o.lastIndex,o===cg?l[1]==="!--"?o=v3:l[1]!==void 0?o=_3:l[2]!==void 0?(dq.test(l[2])&&(s=RegExp("</"+l[2],"g")),o=ol):l[3]!==void 0&&(o=ol):o===ol?l[0]===">"?(o=s??cg,d=-1):l[1]===void 0?d=-2:(d=o.lastIndex-l[2].length,u=l[1],o=l[3]===void 0?ol:l[3]==='"'?C3:A3):o===C3||o===A3?o=ol:o===v3||o===_3?o=cg:(o=ol,s=void 0);const g=o===ol&&t[a+1].startsWith("/>")?" ":"";i+=o===cg?c+Wye:d>=0?(n.push(u),c.slice(0,d)+uq+c.slice(d)+tu+g):c+tu+(d===-2?a:g)}return[hq(t,i+(t[r]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),n]};class jy{constructor({strings:e,_$litType$:r},n){let s;this.parts=[];let i=0,o=0;const a=e.length-1,c=this.parts,[u,l]=Gye(e,r);if(this.el=jy.createElement(u,n),Vl.currentNode=this.el.content,r===2||r===3){const d=this.el.content.firstChild;d.replaceWith(...d.childNodes)}for(;(s=Vl.nextNode())!==null&&c.length<a;){if(s.nodeType===1){if(s.hasAttributes())for(const d of s.getAttributeNames())if(d.endsWith(uq)){const f=l[o++],g=s.getAttribute(d).split(tu),h=/([.?@])?(.*)/.exec(f);c.push({type:1,index:i,name:h[2],strings:g,ctor:h[1]==="."?Zye:h[1]==="?"?Yye:h[1]==="@"?Jye:tC}),s.removeAttribute(d)}else d.startsWith(tu)&&(c.push({type:6,index:i}),s.removeAttribute(d));if(dq.test(s.tagName)){const d=s.textContent.split(tu),f=d.length-1;if(f>0){s.textContent=sA?sA.emptyScript:"";for(let g=0;g<f;g++)s.append(d[g],By()),Vl.nextNode(),c.push({type:2,index:++i});s.append(d[f],By())}}}else if(s.nodeType===8)if(s.data===lq)c.push({type:2,index:i});else{let d=-1;for(;(d=s.data.indexOf(tu,d+1))!==-1;)c.push({type:7,index:i}),d+=tu.length-1}i++}}static createElement(e,r){const n=jd.createElement("template");return n.innerHTML=e,n}}function gp(t,e,r=t,n){var o,a;if(e===pp)return e;let s=n!==void 0?(o=r._$Co)==null?void 0:o[n]:r._$Cl;const i=ky(e)?void 0:e._$litDirective$;return(s==null?void 0:s.constructor)!==i&&((a=s==null?void 0:s._$AO)==null||a.call(s,!1),i===void 0?s=void 0:(s=new i(t),s._$AT(t,r,n)),n!==void 0?(r._$Co??(r._$Co=[]))[n]=s:r._$Cl=s),s!==void 0&&(e=gp(t,s._$AS(t,e.values),s,n)),e}class Kye{constructor(e,r){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=r}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:r},parts:n}=this._$AD,s=((e==null?void 0:e.creationScope)??jd).importNode(r,!0);Vl.currentNode=s;let i=Vl.nextNode(),o=0,a=0,c=n[0];for(;c!==void 0;){if(o===c.index){let u;c.type===2?u=new A0(i,i.nextSibling,this,e):c.type===1?u=new c.ctor(i,c.name,c.strings,this,e):c.type===6&&(u=new Qye(i,this,e)),this._$AV.push(u),c=n[++a]}o!==(c==null?void 0:c.index)&&(i=Vl.nextNode(),o++)}return Vl.currentNode=jd,s}p(e){let r=0;for(const n of this._$AV)n!==void 0&&(n.strings!==void 0?(n._$AI(e,n,r),r+=n.strings.length-2):n._$AI(e[r])),r++}}class A0{get _$AU(){var e;return((e=this._$AM)==null?void 0:e._$AU)??this._$Cv}constructor(e,r,n,s){this.type=2,this._$AH=Zr,this._$AN=void 0,this._$AA=e,this._$AB=r,this._$AM=n,this.options=s,this._$Cv=(s==null?void 0:s.isConnected)??!0}get parentNode(){let e=this._$AA.parentNode;const r=this._$AM;return r!==void 0&&(e==null?void 0:e.nodeType)===11&&(e=r.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,r=this){e=gp(this,e,r),ky(e)?e===Zr||e==null||e===""?(this._$AH!==Zr&&this._$AR(),this._$AH=Zr):e!==this._$AH&&e!==pp&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Vye(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==Zr&&ky(this._$AH)?this._$AA.nextSibling.data=e:this.T(jd.createTextNode(e)),this._$AH=e}$(e){var i;const{values:r,_$litType$:n}=e,s=typeof n=="number"?this._$AC(e):(n.el===void 0&&(n.el=jy.createElement(hq(n.h,n.h[0]),this.options)),n);if(((i=this._$AH)==null?void 0:i._$AD)===s)this._$AH.p(r);else{const o=new Kye(s,this),a=o.u(this.options);o.p(r),this.T(a),this._$AH=o}}_$AC(e){let r=I3.get(e.strings);return r===void 0&&I3.set(e.strings,r=new jy(e)),r}k(e){DO(this._$AH)||(this._$AH=[],this._$AR());const r=this._$AH;let n,s=0;for(const i of e)s===r.length?r.push(n=new A0(this.O(By()),this.O(By()),this,this.options)):n=r[s],n._$AI(i),s++;s<r.length&&(this._$AR(n&&n._$AB.nextSibling,s),r.length=s)}_$AR(e=this._$AA.nextSibling,r){var n;for((n=this._$AP)==null?void 0:n.call(this,!1,!0,r);e!==this._$AB;){const s=w3(e).nextSibling;w3(e).remove(),e=s}}setConnected(e){var r;this._$AM===void 0&&(this._$Cv=e,(r=this._$AP)==null||r.call(this,e))}}class tC{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,r,n,s,i){this.type=1,this._$AH=Zr,this._$AN=void 0,this.element=e,this.name=r,this._$AM=s,this.options=i,n.length>2||n[0]!==""||n[1]!==""?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=Zr}_$AI(e,r=this,n,s){const i=this.strings;let o=!1;if(i===void 0)e=gp(this,e,r,0),o=!ky(e)||e!==this._$AH&&e!==pp,o&&(this._$AH=e);else{const a=e;let c,u;for(e=i[0],c=0;c<i.length-1;c++)u=gp(this,a[n+c],r,c),u===pp&&(u=this._$AH[c]),o||(o=!ky(u)||u!==this._$AH[c]),u===Zr?e=Zr:e!==Zr&&(e+=(u??"")+i[c+1]),this._$AH[c]=u}o&&!s&&this.j(e)}j(e){e===Zr?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class Zye extends tC{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===Zr?void 0:e}}class Yye extends tC{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==Zr)}}class Jye extends tC{constructor(e,r,n,s,i){super(e,r,n,s,i),this.type=5}_$AI(e,r=this){if((e=gp(this,e,r,0)??Zr)===pp)return;const n=this._$AH,s=e===Zr&&n!==Zr||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,i=e!==Zr&&(n===Zr||s);s&&this.element.removeEventListener(this.name,this,n),i&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){var r;typeof this._$AH=="function"?this._$AH.call(((r=this.options)==null?void 0:r.host)??this.element,e):this._$AH.handleEvent(e)}}class Qye{constructor(e,r,n){this.element=e,this.type=6,this._$AN=void 0,this._$AM=r,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(e){gp(this,e)}}const FI=$m.litHtmlPolyfillSupport;FI==null||FI(jy,A0),($m.litHtmlVersions??($m.litHtmlVersions=[])).push("3.3.3");const Xye=(t,e,r)=>{const n=(r==null?void 0:r.renderBefore)??e;let s=n._$litPart$;if(s===void 0){const i=(r==null?void 0:r.renderBefore)??null;n._$litPart$=s=new A0(e.insertBefore(By(),i),i,void 0,r??{})}return s._$AI(t),s};/**
71 * @license
72 * Copyright 2017 Google LLC
73 * SPDX-License-Identifier: BSD-3-Clause
74 */const _d=globalThis;class m_ extends Hf{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var r;const e=super.createRenderRoot();return(r=this.renderOptions).renderBefore??(r.renderBefore=e.firstChild),e}update(e){const r=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=Xye(r,this.renderRoot,this.renderOptions)}connectedCallback(){var e;super.connectedCallback(),(e=this._$Do)==null||e.setConnected(!0)}disconnectedCallback(){var e;super.disconnectedCallback(),(e=this._$Do)==null||e.setConnected(!1)}render(){return pp}}var q$;m_._$litElement$=!0,m_.finalized=!0,(q$=_d.litElementHydrateSupport)==null||q$.call(_d,{LitElement:m_});const HI=_d.litElementPolyfillSupport;HI==null||HI({LitElement:m_});(_d.litElementVersions??(_d.litElementVersions=[])).push("4.2.2");const e0e={black:"#202020",white:"#FFFFFF",white010:"rgba(255, 255, 255, 0.1)",accent010:"rgba(9, 136, 240, 0.1)",accent020:"rgba(9, 136, 240, 0.2)",accent030:"rgba(9, 136, 240, 0.3)",accent040:"rgba(9, 136, 240, 0.4)",accent050:"rgba(9, 136, 240, 0.5)",accent060:"rgba(9, 136, 240, 0.6)",accent070:"rgba(9, 136, 240, 0.7)",accent080:"rgba(9, 136, 240, 0.8)",accent090:"rgba(9, 136, 240, 0.9)",accent100:"rgba(9, 136, 240, 1.0)",accentSecondary010:"rgba(199, 185, 148, 0.1)",accentSecondary020:"rgba(199, 185, 148, 0.2)",accentSecondary030:"rgba(199, 185, 148, 0.3)",accentSecondary040:"rgba(199, 185, 148, 0.4)",accentSecondary050:"rgba(199, 185, 148, 0.5)",accentSecondary060:"rgba(199, 185, 148, 0.6)",accentSecondary070:"rgba(199, 185, 148, 0.7)",accentSecondary080:"rgba(199, 185, 148, 0.8)",accentSecondary090:"rgba(199, 185, 148, 0.9)",accentSecondary100:"rgba(199, 185, 148, 1.0)",productWalletKit:"#FFB800",productAppKit:"#FF573B",productCloud:"#0988F0",productDocumentation:"#008847",neutrals050:"#F6F6F6",neutrals100:"#F3F3F3",neutrals200:"#E9E9E9",neutrals300:"#D0D0D0",neutrals400:"#BBB",neutrals500:"#9A9A9A",neutrals600:"#6C6C6C",neutrals700:"#4F4F4F",neutrals800:"#363636",neutrals900:"#2A2A2A",neutrals1000:"#252525",semanticSuccess010:"rgba(48, 164, 107, 0.1)",semanticSuccess020:"rgba(48, 164, 107, 0.2)",semanticSuccess030:"rgba(48, 164, 107, 0.3)",semanticSuccess040:"rgba(48, 164, 107, 0.4)",semanticSuccess050:"rgba(48, 164, 107, 0.5)",semanticSuccess060:"rgba(48, 164, 107, 0.6)",semanticSuccess070:"rgba(48, 164, 107, 0.7)",semanticSuccess080:"rgba(48, 164, 107, 0.8)",semanticSuccess090:"rgba(48, 164, 107, 0.9)",semanticSuccess100:"rgba(48, 164, 107, 1.0)",semanticError010:"rgba(223, 74, 52, 0.1)",semanticError020:"rgba(223, 74, 52, 0.2)",semanticError030:"rgba(223, 74, 52, 0.3)",semanticError040:"rgba(223, 74, 52, 0.4)",semanticError050:"rgba(223, 74, 52, 0.5)",semanticError060:"rgba(223, 74, 52, 0.6)",semanticError070:"rgba(223, 74, 52, 0.7)",semanticError080:"rgba(223, 74, 52, 0.8)",semanticError090:"rgba(223, 74, 52, 0.9)",semanticError100:"rgba(223, 74, 52, 1.0)",semanticWarning010:"rgba(243, 161, 63, 0.1)",semanticWarning020:"rgba(243, 161, 63, 0.2)",semanticWarning030:"rgba(243, 161, 63, 0.3)",semanticWarning040:"rgba(243, 161, 63, 0.4)",semanticWarning050:"rgba(243, 161, 63, 0.5)",semanticWarning060:"rgba(243, 161, 63, 0.6)",semanticWarning070:"rgba(243, 161, 63, 0.7)",semanticWarning080:"rgba(243, 161, 63, 0.8)",semanticWarning090:"rgba(243, 161, 63, 0.9)",semanticWarning100:"rgba(243, 161, 63, 1.0)"},iA={core:{backgroundAccentPrimary:"#0988F0",backgroundAccentCertified:"#C7B994",backgroundWalletKit:"#FFB800",backgroundAppKit:"#FF573B",backgroundCloud:"#0988F0",backgroundDocumentation:"#008847",backgroundSuccess:"rgba(48, 164, 107, 0.20)",backgroundError:"rgba(223, 74, 52, 0.20)",backgroundWarning:"rgba(243, 161, 63, 0.20)",textAccentPrimary:"#0988F0",textAccentCertified:"#C7B994",textWalletKit:"#FFB800",textAppKit:"#FF573B",textCloud:"#0988F0",textDocumentation:"#008847",textSuccess:"#30A46B",textError:"#DF4A34",textWarning:"#F3A13F",borderAccentPrimary:"#0988F0",borderSecondary:"#C7B994",borderSuccess:"#30A46B",borderError:"#DF4A34",borderWarning:"#F3A13F",foregroundAccent010:"rgba(9, 136, 240, 0.1)",foregroundAccent020:"rgba(9, 136, 240, 0.2)",foregroundAccent040:"rgba(9, 136, 240, 0.4)",foregroundAccent060:"rgba(9, 136, 240, 0.6)",foregroundSecondary020:"rgba(199, 185, 148, 0.2)",foregroundSecondary040:"rgba(199, 185, 148, 0.4)",foregroundSecondary060:"rgba(199, 185, 148, 0.6)",iconAccentPrimary:"#0988F0",iconAccentCertified:"#C7B994",iconSuccess:"#30A46B",iconError:"#DF4A34",iconWarning:"#F3A13F",glass010:"rgba(255, 255, 255, 0.1)",zIndex:"9999"},dark:{overlay:"rgba(0, 0, 0, 0.50)",backgroundPrimary:"#202020",backgroundInvert:"#FFFFFF",textPrimary:"#FFFFFF",textSecondary:"#9A9A9A",textTertiary:"#BBBBBB",textInvert:"#202020",borderPrimary:"#2A2A2A",borderPrimaryDark:"#363636",borderSecondary:"#4F4F4F",foregroundPrimary:"#252525",foregroundSecondary:"#2A2A2A",foregroundTertiary:"#363636",iconDefault:"#9A9A9A",iconInverse:"#FFFFFF"},light:{overlay:"rgba(230 , 230, 230, 0.5)",backgroundPrimary:"#FFFFFF",borderPrimaryDark:"#E9E9E9",backgroundInvert:"#202020",textPrimary:"#202020",textSecondary:"#9A9A9A",textTertiary:"#6C6C6C",textInvert:"#FFFFFF",borderPrimary:"#E9E9E9",borderSecondary:"#D0D0D0",foregroundPrimary:"#F3F3F3",foregroundSecondary:"#E9E9E9",foregroundTertiary:"#D0D0D0",iconDefault:"#9A9A9A",iconInverse:"#202020"}},t0e={1:"4px",2:"8px",10:"10px",3:"12px",4:"16px",6:"24px",5:"20px",8:"32px",16:"64px",20:"80px",32:"128px",64:"256px",128:"512px",round:"9999px"},r0e={0:"0px","01":"2px",1:"4px",2:"8px",3:"12px",4:"16px",5:"20px",6:"24px",7:"28px",8:"32px",9:"36px",10:"40px",12:"48px",14:"56px",16:"64px",20:"80px",32:"128px",64:"256px"},n0e={regular:"KHTeka",mono:"KHTekaMono"},s0e={regular:"400",medium:"500"},i0e={h1:"50px",h2:"44px",h3:"38px",h4:"32px",h5:"26px",h6:"20px",large:"16px",medium:"14px",small:"12px"},o0e={"h1-regular-mono":{lineHeight:"50px",letterSpacing:"-3px"},"h1-regular":{lineHeight:"50px",letterSpacing:"-1px"},"h1-medium":{lineHeight:"50px",letterSpacing:"-0.84px"},"h2-regular-mono":{lineHeight:"44px",letterSpacing:"-2.64px"},"h2-regular":{lineHeight:"44px",letterSpacing:"-0.88px"},"h2-medium":{lineHeight:"44px",letterSpacing:"-0.88px"},"h3-regular-mono":{lineHeight:"38px",letterSpacing:"-2.28px"},"h3-regular":{lineHeight:"38px",letterSpacing:"-0.76px"},"h3-medium":{lineHeight:"38px",letterSpacing:"-0.76px"},"h4-regular-mono":{lineHeight:"32px",letterSpacing:"-1.92px"},"h4-regular":{lineHeight:"32px",letterSpacing:"-0.32px"},"h4-medium":{lineHeight:"32px",letterSpacing:"-0.32px"},"h5-regular-mono":{lineHeight:"26px",letterSpacing:"-1.56px"},"h5-regular":{lineHeight:"26px",letterSpacing:"-0.26px"},"h5-medium":{lineHeight:"26px",letterSpacing:"-0.26px"},"h6-regular-mono":{lineHeight:"20px",letterSpacing:"-1.2px"},"h6-regular":{lineHeight:"20px",letterSpacing:"-0.6px"},"h6-medium":{lineHeight:"20px",letterSpacing:"-0.6px"},"lg-regular-mono":{lineHeight:"16px",letterSpacing:"-0.96px"},"lg-regular":{lineHeight:"18px",letterSpacing:"-0.16px"},"lg-medium":{lineHeight:"18px",letterSpacing:"-0.16px"},"md-regular-mono":{lineHeight:"14px",letterSpacing:"-0.84px"},"md-regular":{lineHeight:"16px",letterSpacing:"-0.14px"},"md-medium":{lineHeight:"16px",letterSpacing:"-0.14px"},"sm-regular-mono":{lineHeight:"12px",letterSpacing:"-0.72px"},"sm-regular":{lineHeight:"14px",letterSpacing:"-0.12px"},"sm-medium":{lineHeight:"14px",letterSpacing:"-0.12px"}}
vendor: 9,010 bytes, lines 74-78
74,a0e={"ease-out-power-2":"cubic-bezier(0.23, 0.09, 0.08, 1.13)","ease-out-power-1":"cubic-bezier(0.12, 0.04, 0.2, 1.06)","ease-in-power-2":"cubic-bezier(0.92, -0.13, 0.77, 0.91)","ease-in-power-1":"cubic-bezier(0.88, -0.06, 0.8, 0.96)","ease-inout-power-2":"cubic-bezier(0.77, 0.09, 0.23, 1.13)","ease-inout-power-1":"cubic-bezier(0.88, 0.04, 0.12, 1.06)"},c0e={xl:"400ms",lg:"200ms",md:"125ms",sm:"75ms"},XT={colors:e0e,fontFamily:n0e,fontWeight:s0e,textSize:i0e,typography:o0e,tokens:{core:iA.core,theme:iA.dark},borderRadius:t0e,spacing:r0e,durations:c0e,easings:a0e},S3="--apkt";function kb(t){if(!t)return{};const e={};return e["font-family"]=t["--apkt-font-family"]??t["--w3m-font-family"]??"KHTeka",e.accent=t["--apkt-accent"]??t["--w3m-accent"]??"#0988F0",e["color-mix"]=t["--apkt-color-mix"]??t["--w3m-color-mix"]??"#000",e["color-mix-strength"]=t["--apkt-color-mix-strength"]??t["--w3m-color-mix-strength"]??0,e["font-size-master"]=t["--apkt-font-size-master"]??t["--w3m-font-size-master"]??"10px",e["border-radius-master"]=t["--apkt-border-radius-master"]??t["--w3m-border-radius-master"]??"4px",t["--apkt-z-index"]!==void 0?e["z-index"]=t["--apkt-z-index"]:t["--w3m-z-index"]!==void 0&&(e["z-index"]=t["--w3m-z-index"]),e}const Na={createCSSVariables(t){const e={},r={};function n(i,o,a=""){for(const[c,u]of Object.entries(i)){const l=a?`${a}-${c}`:c;u&&typeof u=="object"&&Object.keys(u).length?(o[c]={},n(u,o[c],l)):typeof u=="string"&&(o[c]=`${S3}-${l}`)}}function s(i,o){for(const[a,c]of Object.entries(i))c&&typeof c=="object"?(o[a]={},s(c,o[a])):typeof c=="string"&&(o[a]=`var(${c})`)}return n(t,e),s(e,r),{cssVariables:e,cssVariablesVarPrefix:r}},assignCSSVariables(t,e){const r={};function n(s,i,o){for(const[a,c]of Object.entries(s)){const u=o?`${o}-${a}`:a,l=i[a];c&&typeof c=="object"?n(c,l,u):typeof l=="string"&&(r[`${S3}-${u}`]=l)}}return n(t,e),r},createRootStyles(t,e){const r={...XT,tokens:{...XT.tokens,theme:t==="light"?iA.light:iA.dark}},{cssVariables:n}=Na.createCSSVariables(r),s=Na.assignCSSVariables(n,r),i=Na.generateW3MVariables(e),o=Na.generateW3MOverrides(e),a=Na.generateScaledVariables(e),c=Na.generateBaseVariables(s),u={...s,...c,...i,...o,...a},l=Na.applyColorMixToVariables(e,u),d={...u,...l};return`:root {${Object.entries(d).map(([g,h])=>`${g}:${h.replace("/[:;{}</>]/g","")};`).join("")}}`},generateW3MVariables(t){if(!t)return{};const e=kb(t),r={};return r["--w3m-font-family"]=e["font-family"],r["--w3m-accent"]=e.accent,r["--w3m-color-mix"]=e["color-mix"],r["--w3m-color-mix-strength"]=`${e["color-mix-strength"]}%`,r["--w3m-font-size-master"]=e["font-size-master"],r["--w3m-border-radius-master"]=e["border-radius-master"],r},generateW3MOverrides(t){if(!t)return{};const e=kb(t),r={};if(t["--apkt-accent"]||t["--w3m-accent"]){const n=e.accent;r["--apkt-tokens-core-iconAccentPrimary"]=n,r["--apkt-tokens-core-borderAccentPrimary"]=n,r["--apkt-tokens-core-textAccentPrimary"]=n,r["--apkt-tokens-core-backgroundAccentPrimary"]=n}return(t["--apkt-font-family"]||t["--w3m-font-family"])&&(r["--apkt-fontFamily-regular"]=e["font-family"]),e["z-index"]!==void 0&&(r["--apkt-tokens-core-zIndex"]=`${e["z-index"]}`),r},generateScaledVariables(t){if(!t)return{};const e=kb(t),r={};if(t["--apkt-font-size-master"]||t["--w3m-font-size-master"]){const n=parseFloat(e["font-size-master"].replace("px",""));r["--apkt-textSize-h1"]=`${Number(n)*5}px`,r["--apkt-textSize-h2"]=`${Number(n)*4.4}px`,r["--apkt-textSize-h3"]=`${Number(n)*3.8}px`,r["--apkt-textSize-h4"]=`${Number(n)*3.2}px`,r["--apkt-textSize-h5"]=`${Number(n)*2.6}px`,r["--apkt-textSize-h6"]=`${Number(n)*2}px`,r["--apkt-textSize-large"]=`${Number(n)*1.6}px`,r["--apkt-textSize-medium"]=`${Number(n)*1.4}px`,r["--apkt-textSize-small"]=`${Number(n)*1.2}px`}if(t["--apkt-border-radius-master"]||t["--w3m-border-radius-master"]){const n=parseFloat(e["border-radius-master"].replace("px",""));r["--apkt-borderRadius-1"]=`${Number(n)}px`,r["--apkt-borderRadius-2"]=`${Number(n)*2}px`,r["--apkt-borderRadius-3"]=`${Number(n)*3}px`,r["--apkt-borderRadius-4"]=`${Number(n)*4}px`,r["--apkt-borderRadius-5"]=`${Number(n)*5}px`,r["--apkt-borderRadius-6"]=`${Number(n)*6}px`,r["--apkt-borderRadius-8"]=`${Number(n)*8}px`,r["--apkt-borderRadius-16"]=`${Number(n)*16}px`,r["--apkt-borderRadius-20"]=`${Number(n)*20}px`,r["--apkt-borderRadius-32"]=`${Number(n)*32}px`,r["--apkt-borderRadius-64"]=`${Number(n)*64}px`,r["--apkt-borderRadius-128"]=`${Number(n)*128}px`}return r},generateColorMixCSS(t,e){if(!(t!=null&&t["--w3m-color-mix"])||!t["--w3m-color-mix-strength"])return"";const r=t["--w3m-color-mix"],n=t["--w3m-color-mix-strength"];if(!n||n===0)return"";const s=Object.keys(e||{}).filter(o=>{const a=o.includes("-tokens-core-background")||o.includes("-tokens-core-text")||o.includes("-tokens-core-border")||o.includes("-tokens-core-foreground")||o.includes("-tokens-core-icon")||o.includes("-tokens-theme-background")||o.includes("-tokens-theme-text")||o.includes("-tokens-theme-border")||o.includes("-tokens-theme-foreground")||o.includes("-tokens-theme-icon"),c=o.includes("-borderRadius-")||o.includes("-spacing-")||o.includes("-textSize-")||o.includes("-fontFamily-")||o.includes("-fontWeight-")||o.includes("-typography-")||o.includes("-duration-")||o.includes("-ease-")||o.includes("-path-")||o.includes("-width-")||o.includes("-height-")||o.includes("-visual-size-")||o.includes("-modal-width")||o.includes("-cover");return a&&!c});return s.length===0?"":` @supports (background: color-mix(in srgb, white 50%, black)) {
75      :root {
76        ${s.map(o=>{const a=(e==null?void 0:e[o])||"";return a.includes("color-mix")||a.startsWith("#")||a.startsWith("rgb")?`${o}: color-mix(in srgb, ${r} ${n}%, ${a});`:`${o}: color-mix(in srgb, ${r} ${n}%, var(${o}-base, ${a}));`}).join("")}
77      }
78    }`},generateBaseVariables(t){const e={},r=t["--apkt-tokens-theme-backgroundPrimary"];r&&(e["--apkt-tokens-theme-backgroundPrimary-base"]=r);const n=t["--apkt-tokens-core-backgroundAccentPrimary"];return n&&(e["--apkt-tokens-core-backgroundAccentPrimary-base"]=n),e},applyColorMixToVariables(t,e){const r={};e!=null&&e["--apkt-tokens-theme-backgroundPrimary"]&&(r["--apkt-tokens-theme-backgroundPrimary"]="var(--apkt-tokens-theme-backgroundPrimary-base)"),e!=null&&e["--apkt-tokens-core-backgroundAccentPrimary"]&&(r["--apkt-tokens-core-backgroundAccentPrimary"]="var(--apkt-tokens-core-backgroundAccentPrimary-base)");const n=kb(t),s=n["color-mix"],i=n["color-mix-strength"];if(!i||i===0)return r;const o=Object.keys(e||{}).filter(a=>{const c=a.includes("-tokens-core-background")||a.includes("-tokens-core-text")||a.includes("-tokens-core-border")||a.includes("-tokens-core-foreground")||a.includes("-tokens-core-icon")||a.includes("-tokens-theme-background")||a.includes("-tokens-theme-text")||a.includes("-tokens-theme-border")||a.includes("-tokens-theme-foreground")||a.includes("-tokens-theme-icon")||a.includes("-tokens-theme-overlay"),u=a.includes("-borderRadius-")||a.includes("-spacing-")||a.includes("-textSize-")||a.includes("-fontFamily-")||a.includes("-fontWeight-")||a.includes("-typography-")||a.includes("-duration-")||a.includes("-ease-")||a.includes("-path-")||a.includes("-width-")||a.includes("-height-")||a.includes("-visual-size-")||a.includes("-modal-width")||a.includes("-cover");return c&&!u});return o.length===0||o.forEach(a=>{const c=(e==null?void 0:e[a])||"";a.endsWith("-base")||(a==="--apkt-tokens-theme-backgroundPrimary"||a==="--apkt-tokens-core-backgroundAccentPrimary"?r[a]=`color-mix(in srgb, ${s} ${i}%, var(${a}-base))`:c.includes("color-mix")||c.startsWith("#")||c.startsWith("rgb")?r[a]=`color-mix(in srgb, ${s} ${i}%, ${c})`:r[a]=`color-mix(in srgb, ${s} ${i}%, var(${a}-base, ${c}))`)}),r}},{cssVariablesVarPrefix:u0e}=Na.createCSSVariables(XT);function fIe(t,...e){return eu(t,...e.map(r=>ki(typeof r=="function"?r(u0e):r)))}let jl,Gl,jo,zs,oA;const Ta={"KHTeka-500-woff2":"https://fonts.reown.com/KHTeka-Medium.woff2","KHTeka-400-woff2":"https://fonts.reown.com/KHTeka-Regular.woff2","KHTeka-300-woff2":"https://fonts.reown.com/KHTeka-Light.woff2","KHTekaMono-400-woff2":"https://fonts.reown.com/KHTekaMono-Regular.woff2","KHTeka-500-woff":"https://fonts.reown.com/KHTeka-Light.woff","KHTeka-400-woff":"https://fonts.reown.com/KHTeka-Regular.woff","KHTeka-300-woff":"https://fonts.reown.com/KHTeka-Light.woff","KHTekaMono-400-woff":"https://fonts.reown.com/KHTekaMono-Regular.woff"};function aA(t,e="dark"){jl&&document.head.removeChild(jl),jl=document.createElement("style"),jl.textContent=Na.createRootStyles(e,t),document.head.appendChild(jl)}function hIe(t,e="dark"){if(oA=t,Gl=document.createElement("style"),jo=document.createElement("style"),zs=document.createElement("style"),Gl.textContent=dh(t).core.cssText,jo.textContent=dh(t).dark.cssText,zs.textContent=dh(t).light.cssText,document.head.appendChild(Gl),document.head.appendChild(jo),document.head.appendChild(zs),aA(t,e),eP(e),!((t==null?void 0:t["--apkt-font-family"])||(t==null?void 0:t["--w3m-font-family"]))
78)for(const[n,s]of Object.entries(Ta)){const i=document.createElement("link");i.rel="preload",i.href=s,i.as="font",i.type=n.includes("woff2")?"font/woff2":"font/woff",i.crossOrigin="anonymous",document.head.appendChild(i)}eP(e)}function eP(t="dark"){jo&&zs&&jl&&(t==="light"?(aA(oA,t),jo.removeAttribute("media"),zs.media="enabled"):(aA(oA,t),zs.removeAttribute("media"),jo.media="enabled"))}function l0e(t){var e,r,n;if(oA=t,Gl&&jo&&zs){Gl.textContent=dh(t).core.cssText,jo.textContent=dh(t).dark.cssText,zs.textContent=dh(t).light.cssText;const s=(t==null?void 0:t["--apkt-font-family"])||(t==null?void 0:t["--w3m-font-family"]);s&&(Gl.textContent=(e=Gl.textContent)==null?void 0:e.replace("font-family: KHTeka",`font-family: ${s}`),jo.textContent=(r=jo.textContent)==null?void 0:r.replace("font-family: KHTeka",`font-family: ${s}`),zs.textContent=(n=zs.textContent)==null?void 0:n.replace("font-family: KHTeka",`font-family: ${s}`))}if(jl){const s=(zs==null?void 0:zs.media)==="enabled"?"light":"dark";aA(t,s)}}function dh(t){const e=!!(t!=null&&t["--apkt-font-family"]||t!=null&&t["--w3m-font-family"]);return{core:eu`
79      ${e?eu``:eu`
80            @font-face {
81              font-family: 'KHTeka';
82              src:
83                url(${ki(Ta["KHTeka-400-woff2"])}) format('woff2'),
84                url(${ki(Ta["KHTeka-400-woff"])}) format('woff');
85              font-weight: 400;
86              font-style: normal;
87              font-display: swap;
88            }
89
90            @font-face {
91              font-family: 'KHTeka';
92              src:
93                url(${ki(Ta["KHTeka-300-woff2"])}) format('woff2'),
94                url(${ki(Ta["KHTeka-300-woff"])}) format('woff');
95              font-weight: 300;
96              font-style: normal;
97            }
98
99            @font-face {
100              font-family: 'KHTekaMono';
101              src:
102                url(${ki(Ta["KHTekaMono-400-woff2"])}) format('woff2'),
103                url(${ki(Ta["KHTekaMono-400-woff"])}) format('woff');
104              font-weight: 400;
105              font-style: normal;
106            }
107
108            @font-face {
109              font-family: 'KHTeka';
110              src:
111                url(${ki(Ta["KHTeka-400-woff2"])}) format('woff2'),
112                url(${ki(Ta["KHTeka-400-woff"])}) format('woff');
113              font-weight: 400;
114              font-style: normal;
115            }
116          `}
117
118      @keyframes w3m-shake {
119        0% {
120          transform: scale(1) rotate(0deg);
121        }
122        20% {
123          transform: scale(1) rotate(-1deg);
124        }
125        40% {
126          transform: scale(1) rotate(1.5deg);
127        }
128        60% {
129          transform: scale(1) rotate(-1.5deg);
130        }
131        80% {
132          transform: scale(1) rotate(1deg);
133        }
134        100% {
135          transform: scale(1) rotate(0deg);
136        }
137      }
138      @keyframes w3m-iframe-fade-out {
139        0% {
140          opacity: 1;
141        }
142        100% {
143          opacity: 0;
144        }
145      }
146      @keyframes w3m-iframe-zoom-in {
147        0% {
148          transform: translateY(50px);
149          opacity: 0;
150        }
151        100% {
152          transform: translateY(0px);
153          opacity: 1;
154        }
155      }
156      @keyframes w3m-iframe-zoom-in-mobile {
157        0% {
158          transform: scale(0.95);
159          opacity: 0;
160        }
161        100% {
162          transform: scale(1);
163          opacity: 1;
164        }
165      }
166      :root {
167        --apkt-modal-width: 370px;
168
169        --apkt-visual-size-inherit: inherit;
170        --apkt-visual-size-sm: 40px;
171        --apkt-visual-size-md: 55px;
172        --apkt-visual-size-lg: 80px;
173
174        --apkt-path-network-sm: path(
175          'M15.4 2.1a5.21 5.21 0 0 1 5.2 0l11.61 6.7a5.21 5.21 0 0 1 2.61 4.52v13.4c0 1.87-1 3.59-2.6 4.52l-11.61 6.7c-1.62.93-3.6.93-5.22 0l-11.6-6.7a5.21 5.21 0 0 1-2.61-4.51v-13.4c0-1.87 1-3.6 2.6-4.52L15.4 2.1Z'
176        );
177
178        --apkt-path-network-md: path(
179          'M43.4605 10.7248L28.0485 1.61089C25.5438 0.129705 22.4562 0.129705 19.9515 1.61088L4.53951 10.7248C2.03626 12.2051 0.5 14.9365 0.5 17.886V36.1139C0.5 39.0635 2.03626 41.7949 4.53951 43.2752L19.9515 52.3891C22.4562 53.8703 25.5438 53.8703 28.0485 52.3891L43.4605 43.2752C45.9637 41.7949 47.5 39.0635 47.5 36.114V17.8861C47.5 14.9365 45.9637 12.2051 43.4605 10.7248Z'
180        );
181
182        --apkt-path-network-lg: path(
183          'M78.3244 18.926L50.1808 2.45078C45.7376 -0.150261 40.2624 -0.150262 35.8192 2.45078L7.6756 18.926C3.23322 21.5266 0.5 26.3301 0.5 31.5248V64.4752C0.5 69.6699 3.23322 74.4734 7.6756 77.074L35.8192 93.5492C40.2624 96.1503 45.7376 96.1503 50.1808 93.5492L78.3244 77.074C82.7668 74.4734 85.5 69.6699 85.5 64.4752V31.5248C85.5 26.3301 82.7668 21.5266 78.3244 18.926Z'
184        );
185
186        --apkt-width-network-sm: 36px;
187        --apkt-width-network-md: 48px;
188        --apkt-width-network-lg: 86px;
189
190        --apkt-duration-dynamic: 0ms;
191        --apkt-height-network-sm: 40px;
192        --apkt-height-network-md: 54px;
193        --apkt-height-network-lg: 96px;
194      }
195    `,dark:eu`
196      :root {
197      }
198    `,light:eu`
199      :root {
200      }
201    `}}const pIe=eu`
202  div,
203  span,
204  iframe,
205  a,
206  img,
207  form,
208  button,
209  label,
210  *::after,
211  *::before {
212    margin: 0;
213    padding: 0;
214    box-sizing: border-box;
215    font-style: normal;
216    text-rendering: optimizeSpeed;
217    -webkit-font-smoothing: antialiased;
218    -moz-osx-font-smoothing: grayscale;
219    -webkit-tap-highlight-color: transparent;
220    backface-visibility: hidden;
221  }
222
223  :host {
224    font-family: var(--apkt-fontFamily-regular);
225  }
226`,gIe=eu`
227  button,
228  a {
229    cursor: pointer;
230    display: flex;
231    justify-content: center;
232    align-items: center;
233    position: relative;
234
235    will-change: background-color, color, border, box-shadow, width, height, transform, opacity;
236    outline: none;
237    border: none;
238    text-decoration: none;
239    transition:
240      background-color var(--apkt-durations-lg) var(--apkt-easings-ease-out-power-2),
241      color var(--apkt-durations-lg) var(--apkt-easings-ease-out-power-2),
242      border var(--apkt-durations-lg) var(--apkt-easings-ease-out-power-2),
243      box-shadow var(--apkt-durations-lg) var(--apkt-easings-ease-out-power-2),
244      width var(--apkt-durations-lg) var(--apkt-easings-ease-out-power-2),
245      height var(--apkt-durations-lg) var(--apkt-easings-ease-out-power-2),
246      transform var(--apkt-durations-lg) var(--apkt-easings-ease-out-power-2),
247      opacity var(--apkt-durations-lg) var(--apkt-easings-ease-out-power-2),
248      scale var(--apkt-durations-lg) var(--apkt-easings-ease-out-power-2),
249      border-radius var(--apkt-durations-lg) var(--apkt-easings-ease-out-power-2);
250    will-change:
251      background-color, color, border, box-shadow, width, height, transform, opacity, scale,
252      border-radius;
253  }
254
255  a:active:not([disabled]),
256  button:active:not([disabled]) {
257    scale: 0.975;
258    transform-origin: center;
259  }
260
261  button:disabled {
262    cursor: default;
263  }
264
265  input {
266    border: none;
267    outline: none;
268    appearance: none;
269  }
270`,Au={ERROR_CODE_UNRECOGNIZED_CHAIN_ID:4902,ERROR_CODE_DEFAULT:5e3,ERROR_INVALID_CHAIN_ID:32603};class d0e extends rq{async setUniversalProvider(e){if(!this.namespace)throw new Error("UniversalAdapter:setUniversalProvider - namespace is required");return this.addConnector(new nq({provider:e,caipNetworks:this.getCaipNetworks(),namespace:this.namespace})),Promise.resolve()}async connect(e){return Promise.resolve({id:"WALLET_CONNECT",type:"WALLET_CONNECT",chainId:Number(e.chainId),provider:this.provider,address:""})}async disconnect(){try{await this.getWalletConnectConnector().disconnect(),this.emit("disconnect")}catch(e){console.warn("UniversalAdapter:disconnect - error",e)}return{connections:[]}}syncConnections(){return Promise.resolve()}async writeSolanaTransaction(){return Promise.resolve({hash:""})}async getAccounts({namespace:e}){var s,i,o;const r=this.provider,n=(((o=(i=(s=r==null?void 0:r.session)==null?void 0:s.namespaces)==null?void 0:i[e])==null?void 0:o.accounts)||[]).filter((a,c,u)=>u.indexOf(a)===c);return Promise.resolve({accounts:n.map(a=>be.createAccount({caipAddress:a,type:e==="bip122"?"payment":"eoa"}))})}async syncConnectors(){return Promise.resolve()}async getBalance(e){var o,a,c,u,l;if(!(e.caipNetwork&&lt.BALANCE_SUPPORTED_CHAINS.includes((o=e.caipNetwork)==null?void 0:o.chainNamespace))||(a=e.caipNetwork)!=null&&a.testnet)return{balance:"0.00",symbol:((c=e.caipNetwork)==null?void 0:c.nativeCurrency.symbol)||""};const n=q.getAccountData();if(n!=null&&n.balanceLoading&&e.chainId===((u=q.state.activeCaipNetwork)==null?void 0:u.id))return{balance:(n==null?void 0:n.balance)||"0.00",symbol:(n==null?void 0:n.balanceSymbol)||""};const i=(await q.fetchTokenBalance()).find(d=>{var f,g;return d.chainId===`${(f=e.caipNetwork)==null?void 0:f.chainNamespace}:${e.chainId}`&&d.symbol===((g=e.caipNetwork)==null?void 0:g.nativeCurrency.symbol)});return{balance:(i==null?void 0:i.quantity.numeric)||"0.00",symbol:(i==null?void 0:i.symbol)||((l=e.caipNetwork)==null?void 0:l.nativeCurrency.symbol)||""}}async signMessage(e){var o,a,c;const{provider:r,message:n,address:s}=e;if(!r)throw new Error("UniversalAdapter:signMessage - provider is undefined");let i="";return((o=q.state.activeCaipNetwork)==null?void 0:o.chainNamespace)===Y.CHAIN.SOLANA?i=(await r.request({method:"solana_signMessage",params:{message:sG.encode(ne
270w TextEncoder().encode(n)),pubkey:s}},(a=q.state.activeCaipNetwork)==null?void 0:a.caipNetworkId)).signature:i=await r.request({method:"personal_sign",params:[n,s]},(c=q.state.activeCaipNetwork)==null?void 0:c.caipNetworkId),{signature:i}}async estimateGas(){return Promise.resolve({gas:BigInt(0)})}async sendTransaction(){return Promise.resolve({hash:""})}walletGetAssets(e){return Promise.resolve({})}async writeContract(){return Promise.resolve({hash:""})}emitFirstAvailableConnection(){}parseUnits(){return 0n}formatUnits(){return"0"}async getCapabilities(){return Promise.resolve({})}async grantPermissions(){return Promise.resolve({})}async revokePermissions(){return Promise.resolve("0x")}async syncConnection(){return Promise.resolve({id:"WALLET_CONNECT",type:"WALLET_CONNECT",chainId:1,provider:this.provider,address:""})}async switchNetwork(e){var s,i,o,a,c,u,l;const{caipNetwork:r}=e,n=this.getWalletConnectConnector();if(r.chainNamespace===Y.CHAIN.EVM)try{await((s=n.provider)==null?void 0:s.request({method:"wallet_switchEthereumChain",params:[{chainId:Dx(r.id)}]}))}catch(d){if(d.code===Au.ERROR_CODE_UNRECOGNIZED_CHAIN_ID||d.code===Au.ERROR_INVALID_CHAIN_ID||d.code===Au.ERROR_CODE_DEFAULT||((o=(i=d==null?void 0:d.data)==null?void 0:i.originalError)==null?void 0:o.code)===Au.ERROR_CODE_UNRECOGNIZED_CHAIN_ID)try{await((u=n.provider)==null?void 0:u.request({method:"wallet_addEthereumChain",params:[{chainId:Dx(r.id),rpcUrls:[(a=r==null?void 0:r.rpcUrls.chainDefault)==null?void 0:a.http],chainName:r.name,nativeCurrency:r.nativeCurrency,blockExplorerUrls:[(c=r.blockExplorers)==null?void 0:c.default.url]}]}))}catch{throw new Error("Chain is not supported")}}(l=n.provider)==null||l.setDefaultChain(r.caipNetworkId)}getWalletConnectProvider(){const e=this.connectors.find(n=>n.type==="WALLET_CONNECT");return e==null?void 0:e.provider}}const f0e=["email","socials","swaps","onramp","activity","reownBranding","multiWallet","emailCapture","payWithExchange","payments","reownAuthentication","headless"],jb={email:{apiFeatureName:"social_login",localFeatureName:"email",returnType:!1,isLegacy:!1,isAvailableOnBasic:!1,processApi:t=>{if(!(t!=null&&t.config))return!1;const e=t.config;return!!t.isEnabled&&e.includes("email")},processFallback:t=>t===void 0?lt.DEFAULT_REMOTE_FEATURES.email:!!t},socials:{apiFeatureName:"social_login",localFeatureName:"socials",returnType:!1,isLegacy:!1,isAvailableOnBasic:!1,processApi:t=>{if(!(t!=null&&t.config))return!1;const e=t.config;return t.isEnabled&&e.length>0?e.filter(r=>r!=="email"):!1},processFallback:t=>t===void 0?lt.DEFAULT_REMOTE_FEATURES.socials:typeof t=="boolean"?t?lt.DEFAULT_REMOTE_FEATURES.socials:!1:t},swaps:{apiFeatureName:"swap",localFeatureName:"swaps",returnType:!1,isLegacy:!1,isAvailableOnBasic:!1,processApi:t=>{if(!(t!=null&&t.config))return!1;const e=t.config;return t.isEnabled&&e.length>0?e:!1},processFallback:t=>t===void 0?lt.DEFAULT_REMOTE_FEATURES.swaps:typeof t=="boolean"?t?lt.DEFAULT_REMOTE_FEATURES.swaps:!1:t},onramp:{apiFeatureName:"onramp",localFeatureName:"onramp",returnType:!1,isLegacy:!1,isAvailableOnBasic:!1,processApi:t=>{if(!(t!=null&&t.config))return!1;const e=t.config;return t.isEnabled&&e.length>0?e:!1},processFallback:t=>t===void 0?lt.DEFAULT_REMOTE_FEATURES.onramp:typeof t=="boolean"?t?lt.DEFAULT_REMOTE_FEATURES.onramp:!1:t},activity:{apiFeatureName:"activity",localFeatureName:"history",returnType:!1,isLegacy:!0,isAvailableOnBasic:!1,processApi:t=>!!t.isEnabled,processFallback:t=>t===void 0?lt.DEFAULT_REMOTE_FEATURES.activity:!!t},reownBranding:{apiFeatureName:"reown_branding",localFeatureName:"reownBranding",returnType:!1,isLegacy:!1,isAvailableOnBasic:!1,processApi:t=>!!t.isEnabled,processFallback:t=>t===void 0?lt.DEFAULT_REMOTE_FEATURES.reownBranding:!!t},emailCapture:{apiFeatureName:"email_capture",localFeatureName:"emailCapture",returnType:!1,isLegacy:!1,isAvailableOnBasic:!1,processApi:t=>t.isEnabled&&(t.config??[]),processFallback:t=>!1},multiWallet:{apiFeatureName:"multi_wallet",localFeatureName:"multiWallet",returnType:!1,isLegacy:!1,isAvailableOnBasic:!1,processApi:t=>!!t.isEnabled,processFallback:()=>lt.DEFAULT_REMOTE_FEATURES.multiWallet},payWithExchange:{apiFeatureName:"fund_from_exchange",localFeatureName:"payWithExchange",returnType:!1,isLegacy:!1,isAvailableOnBasic:!1,processApi:t=>!!t.isEnabled,processFallback:()=>lt.DEFAULT_REMOTE_FEATURES.payWithExchange},payments:{apiFeatureName:"payments",localFeatureName:"payments",returnType:!1,isLegacy:!1,isAvailableOnBasic:!1,processApi:t=>!!t.isEnabled,processFallback:()=>lt.DEFAULT_REMOTE_FEATURES.payments},reownAuthentication:{apiFeatureName:"reown_authentication",localFeatureName:"reownAuthentication",returnType:!1,isLegacy:!1,isAvailableOnBasic:!1,processApi:t=>!!t.isEnabled,processFallback:t=>typeof t>"u"?lt.DEFAULT_REMOTE_FEATURES.reownAuthentication:!!t},headless:{apiFeatureName:"headless",localFeatureName:"headless",returnType:!1,isLegacy:!1,isAvailableOnBasic:!1,processApi:t=>!!t.isEnabled,processFallback:()=>lt.DEFAULT_REMOTE_FEATURES.headless}},h0e={localSettingsOverridden:new Set,getApiConfig(t,e){return e==null?void 0:e.find(r=>r.id===t)},addWarning(t,e){if(t!==void 0){const r=jb[e],n=r.isLegacy?`"features.${r.localFeatureName}" (now "${e}")`:`"features.${e}"`;this.localSettingsOverridden.add(n)}},processFeature(t,e,r,n,s){const i=jb[t],o=e[i.localFeatureName];if(s&&!i.isAvailableOnBasic)return!1;if(n){const a=this.getApiConfig(i.apiFeatureName,r);return(a==null?void 0:a.config)===null?this.processFallbackFeature(t,o):a!=null&&a.config?(o!==void 0&&this.addWarning(o,t),this.processApiFeature(t,a)):!1}return this.processFallbackFeature(t,o)},processApiFeature(t,e){return jb[t].processApi(e)},processFallbackFeature(t,e){return jb[t].processFallback(e)},async fetchRemoteFeatures(t){const e=t.basic??!1,r=t.features||{};this.localSettingsOverridden.clear();let n=null,s=!1;try{n=await Ae.fetchProjectConfig(),s=n!=null}catch(o){console.warn("[Reown Config] Failed to fetch remote project configuration. Using local/default values.",o)}const i=s&&!e?lt.DEFAULT_REMOTE_FEATURES:lt.DEFAULT_REMOTE_FEATURES_DISABLED;try{for(const o of f0e){const a=this.processFeature(o,r,n,s,e);Object.assign(i,{[o]:a})}}catch(o){return console.warn("[Reown Config] Failed to process the configuration from Cloud. Using default values.",o),lt.DEFAULT_REMOTE_FEATURES}if(s&&this.localSettingsOverridden.size>0){const o=`Your local configuration for ${Array.from(this.localSettingsOverridden).join(", ")} was ignored because a remote configuration was successfully fetched. Please manage these features via your project dashboard on dashboard.reown.com.`;An.open({debugMessage:Cn.ALERT_WARNINGS.LOCAL_CONFIGURATION_IGNORED.debugMessage(o)},"warning")}return i}};class p0e{constructor(e){this.chainNamespaces=[],this.features={},this.remoteFeatures={},this.reportedAlertErrors={},this.getCaipNetwork=(r,n)=>{var s,i,o;if(r){const a=(s=q.getCaipNetworks(r))==null?void 0:s.find(l=>l.id===n);if(a)return a;const c=(i=q.getNetworkData(r))==null?void 0:i.caipNetwork;return c||((o=q.getRequestedCaipNetworks(r).filter(l=>l.chainNamespace===r))==null?void 0:o[0])}return q.state.activeCaipNetwork||this.defaultCaipNetwork},this.getCaipNetworkId=()=>{const r=this.getCaipNetwork();if(r)return r.id},this.getCaipNetworks=r=>q.getCaipNetworks(r),this.getActiveChainNamespace=()=>q.state.activeChain,this.setRequestedCaipNetworks=(r,n)=>{q.setRequestedCaipNetworks(r,n)},this.getApprovedCaipNetworkIds=()=>q.getAllApprovedCaipNetworkIds(),this.getCaipAddress=r=>{var n,s;return q.state.activeChain===r||!r?q.state.activeCaipAddress:(s=(n=q.state.chains.get(r))==null?void 0:n.accountState)==null?void 0:s.caipAddress},this.setClientId=r=>{Ve.setClientId(r)},this.getProvider=r=>_t.getProvider(r),this.getProviderType=r=>_t.getProviderId(r),this.getPreferredAccountType=r=>qn(r),this.setCaipAddress=(r,n,s=!1)=>
270{if(r!==null){const i=r.split(":");if(i.length!==3||i.some(o=>!o)){console.warn(`[AppKit] setCaipAddress: invalid CAIP-10 address rejected: "${r}"`);return}}q.setAccountProp("caipAddress",r,n,s),q.setAccountProp("address",be.getPlainAddress(r),n,s)},this.setBalance=(r,n,s)=>{q.setAccountProp("balance",r,s),q.setAccountProp("balanceSymbol",n,s)},this.setProfileName=(r,n)=>{q.setAccountProp("profileName",r,n)},this.setProfileImage=(r,n)=>{q.setAccountProp("profileImage",r,n)},this.setUser=(r,n)=>{q.setAccountProp("user",r,n)},this.resetAccount=r=>{q.resetAccount(r)},this.setCaipNetwork=r=>{q.setActiveCaipNetwork(r)},this.setCaipNetworkOfNamespace=(r,n)=>{q.setChainNetworkData(n,{caipNetwork:r})},this.setStatus=(r,n)=>{q.setAccountProp("status",r,n),pe.isConnected()?ce.setConnectionStatus("connected"):ce.setConnectionStatus("disconnected")},this.getAddressByChainNamespace=r=>{var n;return(n=q.getAccountData(r))==null?void 0:n.address},this.setConnectors=r=>{const n=[...pe.state.allConnectors,...r];pe.setConnectors(n)},this.setConnections=(r,n)=>{ce.setConnections(r,n),me.setConnections(r,n)},this.fetchIdentity=r=>Ve.fetchIdentity(r),this.getReownName=r=>Dm.getNamesForAddress(r),this.getConnectors=()=>pe.getConnectors(),this.getConnectorImage=r=>vu.getConnectorImage(r),this.getConnections=r=>this.remoteFeatures.multiWallet?Ty.getConnectionsData(r).connections:(An.open(Y.REMOTE_FEATURES_ALERTS.MULTI_WALLET_NOT_ENABLED.DEFAULT,"info"),[]),this.getRecentConnections=r=>this.remoteFeatures.multiWallet?Ty.getConnectionsData(r).recentConnections:(An.open(Y.REMOTE_FEATURES_ALERTS.MULTI_WALLET_NOT_ENABLED.DEFAULT,"info"),[]),this.switchConnection=async r=>{if(!this.remoteFeatures.multiWallet){An.open(Y.REMOTE_FEATURES_ALERTS.MULTI_WALLET_NOT_ENABLED.DEFAULT,"info");return}await me.switchConnection(r)},this.deleteConnection=r=>{if(!this.remoteFeatures.multiWallet){An.open(Y.REMOTE_FEATURES_ALERTS.MULTI_WALLET_NOT_ENABLED.DEFAULT,"info");return}ce.deleteAddressFromConnection(r),me.syncStorageConnections()},this.setConnectedWalletInfo=(r,n)=>{const s=_t.getProviderId(n),i=r?{...r,type:s}:void 0;q.setAccountProp("connectedWalletInfo",i,n)},this.getIsConnectedState=()=>!!q.state.activeCaipAddress,this.addAddressLabel=(r,n,s)=>{var o;const i=((o=q.getAccountData(s))==null?void 0:o.addressLabels)||{};q.setAccountProp("addressLabels",{...i,[r]:n},s)},this.removeAddressLabel=(r,n)=>{var i;const s=((i=q.getAccountData(n))==null?void 0:i.addressLabels)||{};q.setAccountProp("addressLabels",{...s,[r]:void 0},n)},this.getAddress=r=>{var s;const n=r||q.state.activeChain;return(s=q.getAccountData(n))==null?void 0:s.address},this.resetNetwork=r=>{q.resetNetwork(r)},this.addConnector=r=>{pe.addConnector(r)},this.resetWcConnection=()=>{me.resetWcConnection()},this.setAddressExplorerUrl=(r,n)=>{q.setAccountProp("addressExplorerUrl",r,n)},this.setSmartAccountDeployed=(r,n)=>{q.setAccountProp("smartAccountDeployed",r,n)},this.setPreferredAccountType=(r,n)=>{q.setAccountProp("preferredAccountType",r,n)},this.setEIP6963Enabled=r=>{se.setEIP6963Enabled(r)},this.handleUnsafeRPCRequest=()=>{if(this.isOpen()){if(this.isTransactionStackEmpty())return;this.redirect("ApproveTransaction")}else this.open({view:"ApproveTransaction"})},this.options=e,this.version=e.sdkVersion,this.caipNetworks=this.extendCaipNetworks(e),this.chainNamespaces=this.getChainNamespacesSet(e.adapters,this.caipNetworks),this.defaultCaipNetwork=this.extendDefaultCaipNetwork(e),this.chainAdapters=this.createAdapters(e.adapters),this.readyPromise=this.initialize(e)}getChainNamespacesSet(e,r){const n=e==null?void 0:e.map(i=>i.namespace).filter(i=>!!i);if(n!=null&&n.length)return[...new Set(n)];const s=r==null?void 0:r.map(i=>i.chainNamespace);return[...new Set(s)]}async initialize(e){var r,n,s,i,o,a;if(this.initializeProjectSettings(e),this.initControllers(e),await this.initChainAdapters(),this.sendInitializeEvent(e),(r=e.features)!=null&&r.headless&&!an.hasInjectedConnectors()&&Ae.prefetch({fetchNetworkImages:!1,fetchConnectorImages:!1,fetchWalletRanks:!1,fetchRecommendedWallets:!0}),se.state.enableReconnect?(await this.syncExistingConnection(),await this.syncAdapterConnections()):await this.unSyncExistingConnection(),!e.basic&&!e.manualWCControl&&(this.remoteFeatures=await h0e.fetchRemoteFeatures(e)),await Ae.fetchUsage(),se.setRemoteFeatures(this.remoteFeatures),this.remoteFeatures.onramp&&aT.setOnrampProviders(this.remoteFeatures.onramp),((n=se.state.remoteFeatures)!=null&&n.email||Array.isArray((s=se.state.remoteFeatures)==null?void 0:s.socials)&&((i=se.state.remoteFeatures)==null?void 0:i.socials.length)>0)&&await this.checkAllowedOrigins(),(o=se.state.features)!=null&&o.reownAuthentication||(a=se.state.remoteFeatures)!=null&&a.reownAuthentication){const{ReownAuthentication:c}=await Wr(async()=>{const{ReownAuthentication:l}=await import("./features-948L-g_x.js");return{ReownAuthentication:l}},__vite__mapDeps([9,2,3,5,7])),u=se.state.siwx;u instanceof c||(u&&console.warn("ReownAuthentication option is enabled, SIWX configuration will be overridden."),se.setSIWX(new c))}}async openSend(e){var i;const r=e.namespace||q.state.activeChain,n=this.getCaipAddress(r),s=(i=this.getCaipNetwork(r))==null?void 0:i.id;if(!n)throw new Error("openSend: caipAddress not found");if((s==null?void 0:s.toString())!==e.chainId.toString()){const o=q.getCaipNetworkById(e.chainId,r);if(!o)throw new Error(`openSend: caipNetwork with chainId ${e.chainId} not found`);await this.switchNetwork(o,{throwOnFailure:!0})}try{const o=oq.getTokenSymbolByAddress(e.assetAddress);o&&await Ae.fetchTokenImages([o])}catch{}return await ft.open({view:"WalletSend",data:{send:e}}),new Promise((o,a)=>
270{const c=at.subscribeKey("hash",d=>{d&&(l(),o({hash:d}))}),u=ft.subscribe(d=>{d.open||(l(),a(new Error("Modal closed")))}),l=this.createCleanupHandler([c,u])})}toModalOptions(){function e(n){return(n==null?void 0:n.view)==="Swap"}function r(n){return(n==null?void 0:n.view)==="WalletSend"}return{isSwap:e,isSend:r}}async checkAllowedOrigins(){try{const e=await Ae.fetchAllowedOrigins();if(!be.isClient())return;const r=window.location.origin;Lo.isOriginAllowed(r,e,Y.DEFAULT_ALLOWED_ANCESTORS)||An.open(Cn.ALERT_ERRORS.ORIGIN_NOT_ALLOWED,"error")}catch(e){if(!(e instanceof Error))return;switch(e.message){case"RATE_LIMITED":An.open(Cn.ALERT_ERRORS.RATE_LIMITED_APP_CONFIGURATION,"error");break;case"SERVER_ERROR":{const r=e.cause instanceof Error?e.cause:e;An.open({displayMessage:Cn.ALERT_ERRORS.SERVER_ERROR_APP_CONFIGURATION.displayMessage,debugMessage:Cn.ALERT_ERRORS.SERVER_ERROR_APP_CONFIGURATION.debugMessage(r.message)},"error");break}}}}createCleanupHandler(e){return()=>{e.forEach(r=>{try{r()}catch{}})}}sendInitializeEvent(e){var n;const{...r}=e;delete r.adapters,delete r.universalProvider,Xe.sendEvent({type:"track",event:"INITIALIZE",properties:{...r,networks:e.networks.map(s=>s.id),siweConfig:{options:((n=e.siweConfig)==null?void 0:n.options)||{}}}})}initControllers(e){this.initializeOptionsController(e),this.initializeChainController(e),this.initializeThemeController(e),this.initializeConnectionController(e),this.initializeConnectorController()}initAdapterController(){XL.initialize(this.chainAdapters)}initializeThemeController(e){e.themeMode&&ds.setThemeMode(e.themeMode),e.themeVariables&&ds.setThemeVariables(e.themeVariables)}initializeChainController(e){if(!this.connectionControllerClient)throw new Error("ConnectionControllerClient must be set");q.initialize(e.adapters??[],this.caipNetworks,{connectionControllerClient:this.connectionControllerClient});const r=this.getDefaultNetwork();r&&q.setActiveCaipNetwork(r)}initializeConnectionController(e){me.initialize(e.adapters??[]),me.setWcBasic(e.basic??!1)}initializeConnectorController(){pe.initialize(this.chainNamespaces)}initializeProjectSettings(e){se.setProjectId(e.projectId),se.setSdkVersion(e.sdkVersion)}initializeOptionsController(e){var s;se.setDebug(e.debug!==!1),se.setEnableWalletGuide(e.enableWalletGuide!==!1),se.setEnableWallets(e.enableWallets!==!1),se.setEIP6963Enabled(e.enableEIP6963!==!1),se.setEnableInjected(e.enableInjected!==!1),se.setEnableCoinbase(e.enableCoinbase!==!1),se.setEnableNetworkSwitch(e.enableNetworkSwitch!==!1),se.setEnableReconnect(e.enableReconnect!==!1),se.setEnableMobileFullScreen(e.enableMobileFullScreen===!0),se.setCoinbasePreference(e.coinbasePreference),se.setEnableAuthLogger(e.enableAuthLogger!==!1),se.setCustomRpcUrls(e.customRpcUrls),se.setEnableEmbedded(e.enableEmbedded),se.setAllWallets(e.allWallets),se.setIncludeWalletIds(e.includeWalletIds),se.setExcludeWalletIds(e.excludeWalletIds),se.setFeaturedWalletIds(e.featuredWalletIds),se.setTokens(e.tokens),se.setTermsConditionsUrl(e.termsConditionsUrl),se.setPrivacyPolicyUrl(e.privacyPolicyUrl),se.setCustomWallets(e.customWallets),se.setFeatures(e.features),se.setAllowUnsupportedChain(e.allowUnsupportedChain),se.setUniversalProviderConfigOverride(e.universalProviderConfigOverride),se.setPreferUniversalLinks(e.experimental_preferUniversalLinks),se.setDefaultAccountTypes(e.defaultAccountTypes);const r=this.getDefaultMetaData();if(!e.metadata&&r&&(e.metadata=r),se.setMetadata(e.metadata),se.setDisableAppend(e.disableAppend),se.setEnableEmbedded(e.enableEmbedded),se.setSIWX(e.siwx),this.features=se.state.features??{},!e.projectId){An.open(Cn.ALERT_ERRORS.PROJECT_ID_NOT_CONFIGURED,"error");return}if(((s=e.adapters)==null?void 0:s.find(i=>i.namespace===Y.CHAIN.EVM))&&e.siweConfig){if(e.siwx)throw new Error("Cannot set both `siweConfig` and `siwx` options");se.setSIWX(e.siweConfig.mapToSIWX())}}getDefaultMetaData(){var e,r,n,s;return be.isClient()?{name:((r=(e=document.getElementsByTagName("title"))==null?void 0:e[0])==null?void 0:r.textContent)||"",description:((n=document.querySelector('meta[property="og:description"]'))==null?void 0:n.content)||"",url:window.location.origin,icons:[((s=document.querySelector('link[rel~="icon"]'))==null?void 0:s.href)||""]}:null}setUnsupportedNetwork(e){const r=this.getActiveChainNamespace();if(r){const n=Ff.getUnsupportedNetwork(`${r}:${e}`);q.setActiveCaipNetwork(n)}}getDefaultNetwork(){return Ff.getCaipNetworkFromStorage(this.defaultCaipNetwork)}extendCaipNetwork(e,r){return Ff.extendCaipNetwork(e,{customNetworkImageUrls:r.chainImages,projectId:r.projectId})}extendCaipNetworks(e){return Ff.extendCaipNetworks(e.networks,{customNetworkImageUrls:e.chainImages,customRpcUrls:e.customRpcUrls,projectId:e.projectId})}extendDefaultCaipNetwork(e){const r=e.networks.find(s=>{var i;return s.id===((i=e.defaultNetwork)==null?void 0:i.id)});return r?Ff.extendCaipNetwork(r,{customNetworkImageUrls:e.chainImages,customRpcUrls:e.customRpcUrls,projectId:e.projectId}):void 0}async disconnectConnector(e,r){var n,s;try{this.setLoading(!0,e);let i={connections:[]};const o=this.getAdapter(e);return(((s=(n=q.state.chains.get(e))==null?void 0:n.accountState)==null?void 0:s.caipAddress)||!se.state.enableReconnect)&&(o!=null&&o.disconnect)&&(i=await o.disconnect({id:r})),this.setLoading(!1,e),i}catch(i){throw this.setLoading(!1,e),new Error(`Failed to disconnect chains: ${i.message}`)}}createClients(){this.connectionControllerClient={connectWalletConnect:async()=>{var u;const e=q.state.activeChain,r=this.getAdapter(e),n=(u=this.getCaipNetwork(e))==null?void 0:u.id,s=me.getConnections(e),i=this.remoteFeatures.multiWallet,o=s.length>0;if(!r)throw new Error("Adapter not found");const a=await r.connectWalletConnect(n);(!o||!i)&&this.close(),this.setClientId((a==null?void 0:a.clientId)||null),
270ce.setConnectedNamespaces([...q.state.chains.keys()]),await this.syncWalletConnectAccount(),await Sn.initializeIfEnabled()},connectExternal:async e=>{const r=await this.onConnectExternal(e);return await this.connectInactiveNamespaces(e,r),r?{address:r.address}:void 0},reconnectExternal:async({id:e,info:r,type:n,provider:s})=>{var a;const i=q.state.activeChain,o=this.getAdapter(i);if(!i)throw new Error("reconnectExternal: namespace not found");if(!o)throw new Error("reconnectExternal: adapter not found");o!=null&&o.reconnect&&(await(o==null?void 0:o.reconnect({id:e,info:r,type:n,provider:s,chainId:(a=this.getCaipNetwork())==null?void 0:a.id})),ce.addConnectedNamespace(i),this.syncConnectedWalletInfo(i))},disconnectConnector:async e=>{await this.disconnectConnector(e.namespace,e.id)},disconnect:async e=>{var u;const{id:r,chainNamespace:n,initialDisconnect:s}=e||{},i=n||q.state.activeChain,o=pe.getConnectorId(i),a=r===Y.CONNECTOR_ID.AUTH||o===Y.CONNECTOR_ID.AUTH,c=r===Y.CONNECTOR_ID.WALLET_CONNECT||o===Y.CONNECTOR_ID.WALLET_CONNECT;try{const l=Array.from(q.state.chains.keys());let d=n?[n]:l;(c||a)&&(d=l);const f=d.map(async p=>{const y=pe.getConnectorId(p),w=r||y,I=await this.disconnectConnector(p,w);I&&(a&&ce.deleteConnectedSocialProvider(),I.connections.forEach(v=>{ce.addDisconnectedConnectorId(v.connectorId,p)})),s&&this.onDisconnectNamespace({chainNamespace:p,closeModal:!1})}),g=await Promise.allSettled(f);at.resetSend(),me.resetWcConnection(),(u=Sn.getSIWX())!=null&&u.signOutOnDisconnect&&await Sn.clearSessions(),pe.setFilterByNamespace(void 0),me.syncStorageConnections();const h=g.filter(p=>p.status==="rejected");if(h.length>0)throw new Error(h.map(p=>p.reason.message).join(", "));Xe.sendEvent({type:"track",event:"DISCONNECT_SUCCESS",properties:{namespace:n||"all"}})}catch(l){throw new Error(`Failed to disconnect chains: ${l.message}`)}},checkInstalled:e=>e?e.some(r=>{var n;return!!((n=window.ethereum)!=null&&n[String(r)])}):!!window.ethereum,signMessage:async e=>{const r=q.state.activeChain,n=this.getAdapter(q.state.activeChain);if(!r)throw new Error("signMessage: namespace not found");if(!n)throw new Error("signMessage: adapter not found");const s=this.getAddress(r);if(!s)throw new Error("signMessage: address not found");const i=await(n==null?void 0:n.signMessage({message:e,address:s,provider:_t.getProvider(r)}));return(i==null?void 0:i.signature)||""},sendTransaction:async e=>{const r=e.chainNamespace;if(!r)throw new Error("sendTransaction: namespace not found");if(lt.SEND_SUPPORTED_NAMESPACES.includes(r)){const n=this.getAdapter(r);if(!n)throw new Error("sendTransaction: adapter not found");const s=_t.getProvider(r),i=await(n==null?void 0:n.sendTransaction({...e,caipNetwork:this.getCaipNetwork(),provider:s}));return(i==null?void 0:i.hash)||""}return""},estimateGas:async e=>{const r=e.chainNamespace;if(r===Y.CHAIN.EVM){const n=this.getAdapter(r);if(!n)throw new Error("estimateGas: adapter is required but got undefined");const s=_t.getProvider(r),i=this.getCaipNetwork();if(!i)throw new Error("estimateGas: caipNetwork is required but got undefined");const o=await(n==null?void 0:n.estimateGas({...e,provider:s,caipNetwork:i}));return(o==null?void 0:o.gas)||0n}return 0n},getEnsAvatar:async()=>{var s;const e=q.state.activeChain;if(!e)throw new Error("getEnsAvatar: namespace is required but got undefined");const r=this.getAddress(e);if(!r)throw new Error("getEnsAvatar: address not found");await this.syncIdentity({address:r,chainId:Number((s=this.getCaipNetwork())==null?void 0:s.id),chainNamespace:e});const n=q.getAccountData();return(n==null?void 0:n.profileImage)||!1},getEnsAddress:async e=>await Lo.resolveReownName(e),writeContract:async e=>{const r=q.state.activeChain,n=this.getAdapter(r);if(!r)throw new Error("writeContract: namespace is required but got undefined");if(!n)throw new Error("writeContract: adapter is required but got undefined");const s=this.getCaipNetwork(),i=this.getCaipAddress(),o=_t.getProvider(r);if(!s||!i)throw new Error("writeContract: caipNetwork or caipAddress is required but got undefined");const a=await(n==null?void 0:n.writeContract({...e,caipNetwork:s,provider:o,caipAddress:i}));return a==null?void 0:a.hash},writeSolanaTransaction:async e=>{const r=q.state.activeChain,n=this.getAdapter(r);if(!r)throw new Error("writeContract: namespace is required but got undefined");if(!n)throw new Error("writeContract: adapter is required but got undefined");const s=this.getCaipNetwork(),i=this.getCaipAddress(),o=_t.getProvider(r);if(!s||!i)throw new Error("writeContract: caipNetwork or caipAddress is required but got undefined");const a=await(n==null?void 0:n.writeSolanaTransaction({...e,caipNetwork:s,provider:o,caipAddress:i}));return a==null?void 0:a.hash},parseUnits:(e,r)=>{const n=this.getAdapter(q.state.activeChain);if(!n)throw new Error("parseUnits: adapter is required but got undefined");return(n==null?void 0:n.parseUnits({value:e,decimals:r}))??0n},formatUnits:(e,r)=>{const n=this.getAdapter(q.state.activeChain);if(!n)throw new Error("formatUnits: adapter is required but got undefined");return(n==null?void 0:n.formatUnits({value:e,decimals:r}))??"0"},getCapabilities:async e=>{const r=this.getAdapter(q.state.activeChain);if(!r)throw new Error("getCapabilities: adapter is required but got undefined");return await(r==null?void 0:r.getCapabilities(e))},grantPermissions:async e=>{const r=this.getAdapter(q.state.activeChain);if(!r)throw new Error("grantPermissions: adapter is required but got undefined");return await(r==null?void 0:r.grantPermissions(e))},revokePermissions:async e=>{const r=this.getAdapter(q.state.activeChain);if(!r)throw new Error("revokePermissions: adapter is required but got undefined");return r!=null&&r.revokePermissions?await r.revokePermissions(e):"0x"},walletGetAssets:async e=>{const r=this.getAdapter(q.state.activeChain);if(!r)throw new Error("walletGetAssets: adapter is required but got undefined");return await(r==null?void 0:r.walletGetAssets(e))??{}},updateBalance:e=>{const r=this.getAddress(e),n=this.getCaipNetwork(e);!n||!r||this.updateNativeBalance(r,n==null?void 0:n.id,e)}},me.setClient(this.connectionControllerClient)}async onConnectExternal(e){var u,l,d,f,g,h,p,y;const r=q.state.activeChain,n=e.chain||r,s=this.getAdapter(n);let i=!0;if(e.type===Fn.CONNECTOR_TYPE_AUTH&&Y.AUTH_CONNECTOR_SUPPORTED_CHAINS.some(v=>pe.getConnectorId(v)===Y.CONNECTOR_ID.AUTH)&&e.chain!==r&&(i=!1),e.chain&&e.chain!==r&&!e.caipNetwork){const w=this.getCaipNetworks().find(I=>I.chainNamespace===e.chain);w&&i&&this.setCaipNetwork(w)}if(!n)throw new Error("connectExternal: namespace not found");if(!s)throw new Error("connectExternal: adapter not found");const o=this.getCaipNetwork(n),a=e.caipNetwork||o,c=await s.connect({id:e.id,address:e.address,info:e.info,type:e.type,provider:e.provider,socialUri:e.socialUri,chainId:((u=e.caipNetwork)==null?void 0:u.id)||(o==null?void 0:o.id),rpcUrl:((g=(f=(d=(l=e.caipNetwork)==null?void 0:l.rpcUrls)==null?void 0:d.default)==null?void 0:f.http)==null?void 0:g[0])||((y=(p=(h=o==null?void 0:o.rpcUrls)==null?void 0:h.default)==null?void 0:p.http)==null?void 0:y[0])});if(c)return ce.addConnectedNamespace(n),this.syncProvider({...c,chainNamespace:n}),this.setStatus("connected",n),this.syncConnectedWalletInfo(n),ce.removeDisconnectedConnectorId(e.id,n),{address:c.address,connectedCaipNetwork:a}}async connectInactiveNamespaces(e,r){var a;const n=e.type===Fn.CONNECTOR_TYPE_AUTH,s=zi.getOtherAuthNamespaces((a=r==null?void 0:r.connectedCaipNetwork)==null?void 0:a.chainNamespace),i=q.state.activeCaipNetwork,o=this.getAdapter(i==null?void 0:i.chainNamespace);n&&(await Promise.all(s.map(async c=>{var u,l,d;try{const f=_t.getProvider(c),g=this.getCaipNetwork(c),h=this.getAdapter(c);await(h==null?void 0:h.connect({...e,provider:f,socialUri:void 0,chainId:g==null?void 0:g.id,rpcUrl:(d=(l=(u=g==null?void 0:g.rpcUrls)==null?void 0:u.default)==null?void 0:l.http)==null?void 0:d[0]}))&&(ce.addConnectedNamespace(c),ce.removeDisconnectedConnectorId(e.id,c),this.setStatus("connected",c),this.syncConnectedWalletInfo(c))}catch(f){An.warn(Cn.ALERT_WARNINGS.INACTIVE_NAMESPACE_NOT_CONNECTED.displayMessage,Cn.ALERT_WARNINGS.INACTIVE_NAMESPACE_NOT_CONNECTED.debugMessage(c,f instanceof Error?f.message:void 0),Cn.ALERT_WARNINGS.INACTIVE_NAMESPACE_NOT_CONNECTED.code)}})),i&&await(o==null?void 0:o.switchNetwork({caipNetwork:i})))}getApprovedCaipNetworksData(){var r,n,s,i,o;if(_t.getProviderId(q.state.activeChain)===Fn.CONNECTOR_TYPE_WALLET_CONNECT){const a=(n=(r=this.universalProvider)==null?void 0:r.session)==null?void 0:n.namespaces;return{supportsAllNetworks:((o=(i=(s=this.universalProvider)==null?void 0:s.session)==null?void 0:i.peer)==null?void 0:o.metadata.name)==="MetaMask Wallet",approvedCaipNetworkIds:this.getChainsFromNamespaces(a)}}return{supportsAllNetworks:!0,approvedCaipNetworkIds:[]}}async switchCaipNetwork(e){const r=e.chainNamespace;if(this.getAddressByChainNamespace(e.chainNamespace)){const s=_t.getProviderId(r);if(e.chainNamespace===q.state.activeChain){const i=this.getAdapter(r);await(i==null?void 0:i.switchNetwork({caipNetwork:e}))}else if(this.setCaipNetwork(e),s===Fn.CONNECTOR_TYPE_WALLET_CONNECT)this.syncWalletConnectAccount();else{const i=this.getAddressByChainNamespace(r);i&&this.syncAccount({address:i,chainId:e.id,chainNamespace:r})}}else this.setCaipNetwork(e)}
270getChainsFromNamespaces(e={}){return Object.values(e).flatMap(r=>{const n=r.chains||[],s=r.accounts.map(i=>{const{chainId:o,chainNamespace:a}=Rr.parseCaipAddress(i);return`${a}:${o}`});return Array.from(new Set([...n,...s]))})}createAdapters(e){return this.createClients(),this.chainNamespaces.reduce((r,n)=>{var i,o;const s=e==null?void 0:e.find(a=>a.namespace===n);return s?(s.construct({namespace:n,projectId:(i=this.options)==null?void 0:i.projectId,networks:(o=this.caipNetworks)==null?void 0:o.filter(({chainNamespace:a})=>a===n)}),r[n]=s):r[n]=new d0e({namespace:n,networks:this.getCaipNetworks()}),r},{})}async initChainAdapter(e){this.onConnectors(e),this.listenAdapter(e);const r=this.getAdapter(e);if(!r)throw new Error("adapter not found");await r.syncConnectors(),await this.createUniversalProviderForAdapter(e)}async initChainAdapters(){await Promise.all(this.chainNamespaces.map(async e=>{await this.initChainAdapter(e)})),this.initAdapterController()}onConnectors(e){const r=this.getAdapter(e);r==null||r.on("connectors",this.setConnectors.bind(this))}listenAdapter(e){const r=this.getAdapter(e);if(!r)return;const n=ce.getConnectionStatus();se.state.enableReconnect===!1?this.setStatus("disconnected",e):n==="connected"?this.setStatus("connecting",e):n==="disconnected"?(ce.clearAddressCache(),this.setStatus(n,e)):this.setStatus(n,e),r.on("switchNetwork",({address:s,chainId:i})=>{var u,l;const o=this.getCaipNetworks().find(d=>d.id.toString()===i.toString()||d.caipNetworkId.toString()===i.toString()),a=q.state.activeChain===e,c=(l=(u=q.state.chains.get(e))==null?void 0:u.accountState)==null?void 0:l.address;if(o){const d=a&&s?s:c;d&&this.syncAccount({address:d,chainId:o.id,chainNamespace:e})}else this.setUnsupportedNetwork(i)}),r.on("disconnect",()=>{const s=this.remoteFeatures.multiWallet,i=Array.from(me.state.connections.values()).flat();this.onDisconnectNamespace({chainNamespace:e,closeModal:!s||i.length===0})}),r.on("connections",s=>{this.setConnections(s,e)}),r.on("pendingTransactions",()=>{const s=this.getAddress(e),i=q.state.activeCaipNetwork;!s||!(i!=null&&i.id)||this.updateNativeBalance(s,i.id,i.chainNamespace)}),r.on("accountChanged",({address:s,chainId:i,connector:o})=>{var l,d;this.handlePreviousConnectorConnection(o);const a=q.state.activeChain===e;o!=null&&o.provider&&(this.syncProvider({id:o.id,type:o.type,provider:o==null?void 0:o.provider,chainNamespace:e}),this.syncConnectedWalletInfo(e));const c=(d=(l=q.getNetworkData(e))==null?void 0:l.caipNetwork)==null?void 0:d.id,u=i||c;a&&u?this.syncAccount({address:s,chainId:u,chainNamespace:e}).catch(()=>null):!a&&u?(this.syncAccountInfo(s,u,e),this.syncBalance({address:s,chainId:u,chainNamespace:e}).catch(()=>null)):this.syncAccountInfo(s,i,e),ce.addConnectedNamespace(e)})}async handlePreviousConnectorConnection(e){var c;const r=e==null?void 0:e.chain,n=e==null?void 0:e.id,s=pe.getConnectorId(r),i=(c=se.state.remoteFeatures)==null?void 0:c.multiWallet,a=r&&n&&s&&s!==n&&!i;try{a&&await me.disconnect({id:s,namespace:r})}catch(u){console.warn("Error disconnecting previous connector",u)}}async createUniversalProviderForAdapter(e){var r,n,s;await this.getUniversalProvider(),this.universalProvider&&await((s=(n=(r=this.chainAdapters)==null?void 0:r[e])==null?void 0:n.setUniversalProvider)==null?void 0:s.call(n,this.universalProvider))}async syncExistingConnection(){await Promise.allSettled(this.chainNamespaces.map(e=>this.syncNamespaceConnection(e)))}async unSyncExistingConnection(){try{await Promise.allSettled(this.chainNamespaces.map(e=>me.disconnect({namespace:e,initialDisconnect:!0})))}catch(e){console.error("Error disconnecting existing connections:",e)}}async reconnectWalletConnect(){await this.syncWalletConnectAccount();const e=this.getAddress();this.getCaipAddress()||ce.deleteRecentWallet();const r=ce.getRecentWallet();Xe.sendEvent({type:"track",event:"CONNECT_SUCCESS",address:e,properties:{method:be.isMobile()?"mobile":"qrcode",name:(r==null?void 0:r.name)||"Unknown",reconnect:!0,view:Fe.state.view,walletRank:r==null?void 0:r.order}})}async syncNamespaceConnection(e){try{e===Y.CHAIN.EVM&&be.isSafeApp()&&pe.setConnectorId(Y.CONNECTOR_ID.SAFE,e);const r=pe.getConnectorId(e);switch(this.setStatus("connecting",e),r){case Y.CONNECTOR_ID.WALLET_CONNECT:await this.reconnectWalletConnect();break;case Y.CONNECTOR_ID.AUTH:break;default:await this.syncAdapterConnection(e)}}catch(r){console.warn("AppKit couldn't sync existing connection",r),this.setStatus("disconnected",e)}}onDisconnectNamespace(e){const{chainNamespace:r,closeModal:n}=e||{};q.resetAccount(r),q.resetNetwork(r),ce.removeConnectedNamespace(r);const s=Array.from(q.state.chains.keys());
270(r?[r]:s).forEach(o=>ce.addDisconnectedConnectorId(pe.getConnectorId(o)||"",o)),pe.removeConnectorId(r),_t.resetChain(r),this.setUser(null,r),this.setStatus("disconnected",r),this.setConnectedWalletInfo(null,r),n!==!1&&ft.close()}async syncAdapterConnections(){await Promise.allSettled(this.chainNamespaces.map(e=>{const r=this.getAdapter(e),n=this.getCaipAddress(e),s=this.getCaipNetwork(e);return r==null?void 0:r.syncConnections({connectToFirstConnector:!n,caipNetwork:s})}))}async syncAdapterConnection(e){var a,c,u,l,d;const r=this.getAdapter(e),n=this.getCaipNetwork(e),s=pe.getConnectorId(e),o=pe.getConnectors(e).find(f=>f.id===s);try{if(!r||!o)throw new Error(`Adapter or connector not found for namespace ${e}`);if(!(n!=null&&n.id))throw new Error("CaipNetwork not found");const f=await(r==null?void 0:r.syncConnection({namespace:e,id:o.id,chainId:n.id,rpcUrl:(u=(c=(a=n==null?void 0:n.rpcUrls)==null?void 0:a.default)==null?void 0:c.http)==null?void 0:u[0]}));f?(this.syncProvider({...f,chainNamespace:e}),await this.syncAccount({...f,chainNamespace:e}),this.setStatus("connected",e),Xe.sendEvent({type:"track",event:"CONNECT_SUCCESS",address:f.address,properties:{method:"browser",name:((l=o.info)==null?void 0:l.name)||o.name||"Unknown",reconnect:!0,view:Fe.state.view,walletRank:(d=o==null?void 0:o.explorerWallet)==null?void 0:d.order}})):this.setStatus("disconnected",e)}catch{this.onDisconnectNamespace({chainNamespace:e,closeModal:!1})}}async syncWalletConnectAccount(){var n,s;const e=Object.keys(((s=(n=this.universalProvider)==null?void 0:n.session)==null?void 0:s.namespaces)||{}),r=this.chainNamespaces.map(async i=>{var d,f,g,h,p;const o=this.getAdapter(i);if(!o)return;const a=((h=(g=(f=(d=this.universalProvider)==null?void 0:d.session)==null?void 0:f.namespaces)==null?void 0:g[i])==null?void 0:h.accounts)||[],c=(p=q.state.activeCaipNetwork)==null?void 0:p.id,u=a.find(y=>{const{chainId:w}=Rr.parseCaipAddress(y);return w===(c==null?void 0:c.toString())})||a[0];if(u){const y=Rr.validateCaipAddress(u),{chainId:w,address:I}=Rr.parseCaipAddress(y);if(_t.setProviderId(i,Fn.CONNECTOR_TYPE_WALLET_CONNECT),this.caipNetworks&&q.state.activeCaipNetwork&&o.namespace!==Y.CHAIN.EVM){const v=o.getWalletConnectProvider({caipNetworks:this.getCaipNetworks(),provider:this.universalProvider,activeCaipNetwork:q.state.activeCaipNetwork});_t.setProvider(i,v)}else _t.setProvider(i,this.universalProvider);pe.setConnectorId(Y.CONNECTOR_ID.WALLET_CONNECT,i),ce.addConnectedNamespace(i),await this.syncAccount({address:I,chainId:w,chainNamespace:i})}else e.includes(i)&&this.setStatus("disconnected",i);const l=this.getApprovedCaipNetworksData();this.syncConnectedWalletInfo(i),q.setApprovedCaipNetworksData(i,{approvedCaipNetworkIds:l.approvedCaipNetworkIds,supportsAllNetworks:l.supportsAllNetworks})});await Promise.all(r)}syncProvider({type:e,provider:r,id:n,chainNamespace:s}){_t.setProviderId(s,e),_t.setProvider(s,XQ({connectorId:n,chainNamespace:s,provider:r})),pe.setConnectorId(n,s)}async syncAccount(e){var d,f;const r=e.chainNamespace===q.state.activeChain,n=q.getCaipNetworkByNamespace(e.chainNamespace,e.chainId),{address:s,chainId:i,chainNamespace:o}=e,{chainId:a}=ce.getActiveNetworkProps(),c=(n==null?void 0:n.id)||a,u=((d=q.state.activeCaipNetwork)==null?void 0:d.name)===Y.UNSUPPORTED_NETWORK_NAME,l=q.getNetworkProp("supportsAllNetworks",o);if(this.setStatus("connected",o),!(u&&!l)&&c){let g=this.getCaipNetworks().find(w=>w.id.toString()===c.toString()),h=this.getCaipNetworks().find(w=>w.chainNamespace===o);if(!l&&!g&&!h){const w=this.getApprovedCaipNetworkIds()||[],I=w.find(E=>{var b;return((b=Rr.parseCaipNetworkId(E))==null?void 0:b.chainId)===c.toString()}),v=w.find(E=>{var b;return((b=Rr.parseCaipNetworkId(E))==null?void 0:b.chainNamespace)===o});g=this.getCaipNetworks().find(E=>E.caipNetworkId===I),h=this.getCaipNetworks().find(E=>E.caipNetworkId===v||"deprecatedCaipNetworkId"in E&&E.deprecatedCaipNetworkId===v)}const p=g||h;(p==null?void 0:p.chainNamespace)===q.state.activeChain?se.state.enableNetworkSwitch&&!se.state.allowUnsupportedChain&&((f=q.state.activeCaipNetwork)==null?void 0:f.name)===Y.UNSUPPORTED_NETWORK_NAME?q.showUnsupportedChainUI():this.setCaipNetwork(p):r||n&&this.setCaipNetworkOfNamespace(n,o),this.syncConnectedWalletInfo(o);const y=this.getAddress(o);zi.isLowerCaseMatch(s,y)||this.syncAccountInfo(s,p==null?void 0:p.id,o),r?await this.syncBalance({address:s,chainId:p==null?void 0:p.id,chainNamespace:o}):await this.syncBalance({address:s,chainId:n==null?void 0:n.id,chainNamespace:o}),this.syncIdentity({address:s,chainId:i,chainNamespace:o}).catch(()=>null)}}async syncAccountInfo(e,r,n){const s=this.getCaipAddress(n),i=r||(s==null?void 0:s.split(":")[1]);if(!i)return;const o=`${n}:${i}:${e}`;this.setCaipAddress(o,n,!0),await this.syncIdentity({address:e,chainId:i,chainNamespace:n})}async syncReownName(e,r){try{const n=await this.getReownName(e);
270if(n[0]){const s=n[0];this.setProfileName(s.name,r)}else this.setProfileName(null,r)}catch{this.setProfileName(null,r)}}syncConnectedWalletInfo(e){var s;const r=pe.getConnectorId(e),n=_t.getProviderId(e);if(n===Fn.CONNECTOR_TYPE_ANNOUNCED||n===Fn.CONNECTOR_TYPE_INJECTED){if(r){const o=this.getConnectors().find(a=>{var d,f;const c=a.id===r,u=((d=a.info)==null?void 0:d.rdns)===r,l=(f=a.connectors)==null?void 0:f.some(g=>{var h;return g.id===r||((h=g.info)==null?void 0:h.rdns)===r});return c||u||!!l});if(o){const{info:a,name:c,imageUrl:u}=o,l=u||this.getConnectorImage(o);this.setConnectedWalletInfo({name:c,icon:l,...a},e)}}}else if(n===Fn.CONNECTOR_TYPE_WALLET_CONNECT){const i=_t.getProvider(e);i!=null&&i.session&&this.setConnectedWalletInfo({...i.session.peer.metadata,name:i.session.peer.metadata.name,icon:(s=i.session.peer.metadata.icons)==null?void 0:s[0]},e)}else if(r&&(r===Y.CONNECTOR_ID.COINBASE_SDK||r===Y.CONNECTOR_ID.COINBASE||r===Y.CONNECTOR_ID.BASE_ACCOUNT)){const i=this.getConnectors().find(l=>l.id===r),o=r===Y.CONNECTOR_ID.BASE_ACCOUNT?"Base Account":"Coinbase Wallet",a=(i==null?void 0:i.name)||o,c=(i==null?void 0:i.imageUrl)||this.getConnectorImage(i),u=i==null?void 0:i.info;this.setConnectedWalletInfo({...u,name:a,icon:c},e)}}async syncBalance(e){!Tm.getNetworksByNamespace(this.getCaipNetworks(),e.chainNamespace).find(n=>{var s;return n.id.toString()===((s=e.chainId)==null?void 0:s.toString())})||!e.chainId||await this.updateNativeBalance(e.address,e.chainId,e.chainNamespace)}async ready(){await this.readyPromise}async updateNativeBalance(e,r,n){const s=this.getAdapter(n),i=q.getCaipNetworkByNamespace(n,r);if(s){const o=await s.getBalance({address:e,chainId:r,caipNetwork:i,tokens:this.options.tokens});return this.setBalance(o.balance,o.symbol,n),o}}async initializeUniversalAdapter(){var s,i,o,a,c,u,l,d,f,g;const e=jye.createLogger((h,...p)=>{h&&this.handleAlertError(h),console.error(...p)}),r={projectId:(s=this.options)==null?void 0:s.projectId,metadata:{name:(i=this.options)!=null&&i.metadata?(o=this.options)==null?void 0:o.metadata.name:"",description:(a=this.options)!=null&&a.metadata?(c=this.options)==null?void 0:c.metadata.description:"",url:(u=this.options)!=null&&u.metadata?(l=this.options)==null?void 0:l.metadata.url:"",icons:(d=this.options)!=null&&d.metadata?(f=this.options)==null?void 0:f.metadata.icons:[""]},logger:e};se.setManualWCControl(!!((g=this.options)!=null&&g.manualWCControl)),this.universalProvider=this.options.universalProvider??await iye.init(r);const n=this.universalProvider.disconnect.bind(this.universalProvider);this.universalProvider.disconnect=async()=>{try{return await n()}catch(h){if(h instanceof Error&&h.message.includes("Missing or invalid. Record was recently deleted"))return;throw h}},se.state.enableReconnect===!1&&this.universalProvider.session&&await this.universalProvider.disconnect(),this.listenWalletConnect()}listenWalletConnect(){this.universalProvider&&this.chainNamespaces.forEach(e=>{Lo.listenWcProvider({universalProvider:this.universalProvider,namespace:e,onDisplayUri:r=>{me.setUri(r)},onConnect:r=>{const{address:n}=be.getAccount(r[0]);for(const s of this.chainNamespaces)ce.removeDisconnectedConnectorId(Y.CONNECTOR_ID.WALLET_CONNECT,s);me.finalizeWcConnection(n)},onDisconnect:()=>{q.state.noAdapters&&this.resetAccount(e),me.resetWcConnection()},onChainChanged:r=>{const n=q.state.activeChain,s=n&&pe.state.activeConnectorIds[n]===Y.CONNECTOR_ID.WALLET_CONNECT;if(n===e&&(q.state.noAdapters||s)){const i=this.getCaipNetworks().find(a=>a.id.toString()===r.toString()||a.caipNetworkId.toString()===r.toString()),o=this.getCaipNetwork();if(!i){this.setUnsupportedNetwork(r);return}(o==null?void 0:o.id.toString())!==(i==null?void 0:i.id.toString())&&(o==null?void 0:o.chainNamespace)===(i==null?void 0:i.chainNamespace)&&this.setCaipNetwork(i)}},onAccountsChanged:r=>{const n=q.state.activeChain,s=n&&pe.state.activeConnectorIds[n]===Y.CONNECTOR_ID.WALLET_CONNECT;if(n===e&&(q.state.noAdapters||s)){const i=r==null?void 0:r[0];i&&this.syncAccount({address:i.address,chainId:i.chainId,chainNamespace:i.chainNamespace})}}})})}createUniversalProvider(){var e;
270return!this.universalProviderInitPromise&&be.isClient()&&((e=this.options)!=null&&e.projectId)&&(this.universalProviderInitPromise=this.initializeUniversalAdapter()),this.universalProviderInitPromise}async getUniversalProvider(){if(!this.universalProvider)try{await this.createUniversalProvider()}catch(e){Xe.sendEvent({type:"error",event:"INTERNAL_SDK_ERROR",properties:{errorType:"UniversalProviderInitError",errorMessage:e instanceof Error?e.message:"Unknown",uncaught:!1}}),console.error("AppKit:getUniversalProvider - Cannot create provider",e)}return this.universalProvider}getDisabledCaipNetworks(){const e=q.getAllApprovedCaipNetworkIds(),r=q.getAllRequestedCaipNetworks();return be.sortRequestedNetworks(e,r).filter(s=>q.isCaipNetworkDisabled(s))}handleAlertError(e){const r=Object.entries(Cn.UniversalProviderErrors).find(([,{message:a}])=>e.message.includes(a)),[n,s]=r??[],{message:i,alertErrorKey:o}=s??{};if(n&&i&&!this.reportedAlertErrors[n]){const a=Cn.ALERT_ERRORS[o];a&&(An.open(a,"error"),this.reportedAlertErrors[n]=!0)}}getAdapter(e){var r;if(e)return(r=this.chainAdapters)==null?void 0:r[e]}createAdapter(e){var s,i;if(!e)return;const r=e.namespace;if(!r)return;this.createClients();const n=e;n.namespace=r,n.construct({namespace:r,projectId:(s=this.options)==null?void 0:s.projectId,networks:(i=this.caipNetworks)==null?void 0:i.filter(({chainNamespace:o})=>o===r)}),this.chainNamespaces.includes(r)||this.chainNamespaces.push(r),this.chainAdapters&&(this.chainAdapters[r]=n)}async open(e){await this.injectModalUi(),e!=null&&e.uri&&me.setUri(e.uri);const{isSwap:r,isSend:n}=this.toModalOptions();return r(e)?ft.open({...e,data:{swap:e.arguments}}):n(e)&&e.arguments?this.openSend(e.arguments):ft.open(e)}async close(){await this.injectModalUi(),ft.close()}setLoading(e,r){ft.setLoading(e,r)}async disconnect(e){await me.disconnect({namespace:e})}async fetchWallets(e){await na.fetchWallets(e)}getWalletList(){return na.getWalletList()}subscribeWalletList(e){return na.subscribeWalletList(e)}async prefetchWalletConnectUri(e){await na.prefetchWalletConnectUri(e)}getWalletConnectUri(){return na.getWalletConnectUri()}subscribeWalletConnectUri(e){return na.subscribeWalletConnectUri(e)}resetWalletConnectUri(){na.resetWcUri()}resetConnectingWallet(){na.resetConnectingWallet()}async connectWallet(e,r,n){await na.connect(e,r,n)}getSIWX(){return se.state.siwx}getError(){return""}getChainId(){var e;return(e=q.state.activeCaipNetwork)==null?void 0:e.id}async switchNetwork(e,{throwOnFailure:r=!1}={}){const n=this.getCaipNetworks().find(s=>s.id===e.id);if(!n){An.open(Cn.ALERT_ERRORS.SWITCH_NETWORK_NOT_FOUND,"error");return}await q.switchActiveNetwork(n,{throwOnFailure:r})}getWalletProvider(){return q.state.activeChain?_t.state.providers[q.state.activeChain]:null}getWalletProviderType(){return _t.getProviderId(q.state.activeChain)}subscribeProviders(e){return _t.subscribeProviders(e)}getThemeMode(){return ds.state.themeMode}getThemeVariables(){return ds.state.themeVariables}setThemeMode(e){ds.setThemeMode(e),eP(ds.state.themeMode)}setTermsConditionsUrl(e){se.setTermsConditionsUrl(e)}setPrivacyPolicyUrl(e){se.setPrivacyPolicyUrl(e)}setThemeVariables(e){ds.setThemeVariables(e),l0e(ds.state.themeVariables)}subscribeTheme(e){return ds.subscribe(e)}subscribeConnections(e){return this.remoteFeatures.multiWallet?me.subscribe(e):(An.open(Y.REMOTE_FEATURES_ALERTS.MULTI_WALLET_NOT_ENABLED.DEFAULT,"info"),()=>{})}getWalletInfo(e){var n,s;if(e)return(s=(n=q.state.chains.get(e))==null?void 0:n.accountState)==null?void 0:s.connectedWalletInfo;const r=q.getAccountData();return r==null?void 0:r.connectedWalletInfo}getAccount(e){const r=e||q.state.activeChain,n=pe.getAuthConnector(r),s=q.getAccountData(r),i=ce.getConnectedConnectorId(q.state.activeChain),o=me.getConnections(r);if(!r)throw new Error("AppKit:getAccount - namespace is required");const a=q.getActiveCaipNetwork(r),c=o.flatMap(u=>{const l=u.caipNetwork??a;return l?u.accounts.map(({address:d,type:f,publicKey:g})=>be.createAccount({caipAddress:`${l.caipNetworkId}:${d}`,type:f||"eoa",publicKey:g})):[]});if(s)return{allAccounts:c,caipAddress:s.caipAddress,address:be.getPlainAddress(s.caipAddress),isConnected:!!s.caipAddress,status:s.status,embeddedWalletInfo:n&&i===Y.CONNECTOR_ID.AUTH?{user:s.user?{...s.user,username:ce.getConnectedSocialUsername()}:void 0,authProvider:s.socialProvider||"email",accountType:qn(r),isSmartAccountDeployed:!!s.smartAccountDeployed}:void 0}}subscribeAccount(e,r){const n=[],s=()=>{const o=this.getAccount(r);o&&e(o)};if(r){const o=q.subscribeChainProp("accountState",s,r);n.push(o)}else{const o=q.subscribe(s);n.push(o)}const i=pe.subscribe(s);return n.push(i),()=>
270{n.forEach(o=>o())}}subscribeNetwork(e){return q.subscribe(({activeCaipNetwork:r,activeChain:n,chains:s})=>{var o;const i=n?(o=s.get(n))==null?void 0:o.networkState:void 0;e({caipNetwork:r,chainId:r==null?void 0:r.id,caipNetworkId:r==null?void 0:r.caipNetworkId,approvedCaipNetworkIds:i==null?void 0:i.approvedCaipNetworkIds,supportsAllNetworks:(i==null?void 0:i.supportsAllNetworks)??!0})})}subscribeWalletInfo(e,r){return r?q.subscribeChainProp("accountState",n=>e(n==null?void 0:n.connectedWalletInfo),r):q.subscribeChainProp("accountState",n=>e(n==null?void 0:n.connectedWalletInfo))}subscribeShouldUpdateToAddress(e){return q.subscribeChainProp("accountState",r=>e(r==null?void 0:r.shouldUpdateToAddress))}subscribeCaipNetworkChange(e){return q.subscribeKey("activeCaipNetwork",e)}getState(){return Tn.state}getRemoteFeatures(){return se.state.remoteFeatures}subscribeState(e){return Tn.subscribe(e)}subscribeRemoteFeatures(e){return se.subscribeKey("remoteFeatures",e)}showErrorMessage(e){Bo.showError(e)}showSuccessMessage(e){Bo.showSuccess(e)}getEvent(){return{...Xe.state}}subscribeEvents(e){return Xe.subscribe(e)}replace(e){Fe.replace(e)}redirect(e){Fe.push(e)}popTransactionStack(e){Fe.popTransactionStack(e)}isOpen(){return ft.state.open}isTransactionStackEmpty(){return Fe.state.transactionStack.length===0}static getInstance(){return this.instance}updateFeatures(e){se.setFeatures(e)}updateRemoteFeatures(e){se.setRemoteFeatures(e)}updateOptions(e){const n={...se.state||{},...e};se.setOptions(n)}setConnectMethodsOrder(e){se.setConnectMethodsOrder(e)}setWalletFeaturesOrder(e){se.setWalletFeaturesOrder(e)}setCollapseWallets(e){se.setCollapseWallets(e)}setSocialsOrder(e){se.setSocialsOrder(e)}getConnectMethodsOrder(){return Ja.getConnectOrderMethod(se.state.features,pe.getConnectors())}addNetwork(e,r){if(this.chainAdapters&&!this.chainAdapters[e])throw new Error(`Adapter for namespace ${e} doesn't exist`);const n=this.extendCaipNetwork(r,this.options);this.getCaipNetworks().find(s=>s.id===n.id)||q.addNetwork(n)}removeNetwork(e,r){if(this.chainAdapters&&!this.chainAdapters[e])throw new Error(`Adapter for namespace ${e} doesn't exist`);this.getCaipNetworks().find(s=>s.id===r)&&q.removeNetwork(e,r)}}let T3=!1;class g0e extends p0e{async onAuthProviderConnected(e){const r=zi.userChainIdToChainNamespace(e==null?void 0:e.chainId);if(e.message&&e.signature&&e.siwxMessage&&await Sn.addEmbeddedWalletSession({chainId:e.siwxMessage.chainId,accountAddress:e.address,notBefore:e.siwxMessage.notBefore,statement:e.siwxMessage.statement,resources:e.siwxMessage.resources,requestId:e.siwxMessage.requestId,issuedAt:e.siwxMessage.issuedAt,domain:e.siwxMessage.domain,uri:e.siwxMessage.uri,version:e.siwxMessage.version,nonce:e.siwxMessage.nonce},e.message,e.signature),!r)throw new Error("AppKit:onAuthProviderConnected - namespace is required");const n=r===Y.CHAIN.EVM?`eip155:${e.chainId}:${e.address}`:`${e.chainId}:${e.address}`,s=se.state.defaultAccountTypes[r],i=qn(r),o=e.preferredAccountType||i||s;this.setCaipAddress(n,r);const{signature:a,siwxMessage:c,message:u,...l}=e,d=q.getAccountData(r);this.setUser({...(d==null?void 0:d.user)||{},...l},r),this.setSmartAccountDeployed(!!e.smartAccountDeployed,r),this.setPreferredAccountType(o,r),await Promise.all([this.syncAuthConnectorTheme(this.authProvider),this.syncAccount({address:e.address,chainId:e.chainId,chainNamespace:r})]),this.setLoading(!1,r)}setupAuthConnectorListeners(e){e.onRpcRequest(r=>{Ws.checkIfRequestExists(r)?Ws.checkIfRequestIsSafe(r)||this.handleUnsafeRPCRequest():(this.open(),console.error(Tr.RPC_METHOD_NOT_ALLOWED_MESSAGE,{method:r.method}),setTimeout(()=>{this.showErrorMessage(Tr.RPC_METHOD_NOT_ALLOWED_UI_MESSAGE)},300),e.rejectRpcRequests())}),e.onRpcError(()=>{this.isOpen()&&(this.isTransactionStackEmpty()?this.close():this.popTransactionStack("error"))}),e.onRpcSuccess((r,n)=>{const s=Ws.checkIfRequestIsSafe(n),i=this.getAddress(),o=q.state.activeCaipNetwork;s||(i&&(o!=null&&o.id)&&this.updateNativeBalance(i,o.id,o.chainNamespace),this.isTransactionStackEmpty()?this.close():this.popTransactionStack("success"))}),e.onNotConnected(()=>{const r=q.state.activeChain;if(!r)throw new Error("AppKit:onNotConnected - namespace is required");pe.getConnectorId(r)===Y.CONNECTOR_ID.AUTH&&(this.setCaipAddress(null,r),this.setLoading(!1,r))}),e.onConnect(this.onAuthProviderConnected.bind(this)),e.onSocialConnected(this.onAuthProviderConnected.bind(this)),e.onSetPreferredAccount(({address:r,type:n})=>{const s=q.state.activeChain;if(!s)throw new Error("AppKit:onSetPreferredAccount - namespace is required");r&&this.setPreferredAccountType(n,s)})}async syncAuthConnectorTheme(e){if(!e)return;const r=ds.getSnapshot();await e.syncTheme({themeMode:r.themeMode,themeVariables:r.themeVariables,w3mThemeVariables:Wm(r.themeVariables,r.themeMode)})}async syncAuthConnector(e,r){var l,d,f,g,h,p,y,w,I;const n=Y.AUTH_CONNECTOR_SUPPORTED_CHAINS.includes(r),s=r===q.state.activeChain;if(!n)return;this.setLoading(!0,r);const i=e.getLoginEmailUsed();this.setLoading(i,r),i&&this.setStatus("connecting",r);const o=e.getEmail(),a=e.getUsername(),c=((l=q.getAccountData(r))==null?void 0:l.user)||{};this.setUser({...c,username:a,email:o},r),this.setupAuthConnectorListeners(e);const{isConnected:u}=await e.isConnected();if(r&&n&&s)if(u&&((d=this.connectionControllerClient)!=null&&d.connectExternal)){await e.init(
270),await this.syncAuthConnectorTheme(e),await((h=this.connectionControllerClient)==null?void 0:h.connectExternal({id:Y.CONNECTOR_ID.AUTH,info:{name:Y.CONNECTOR_ID.AUTH},type:Fn.CONNECTOR_TYPE_AUTH,provider:e,chainId:(g=(f=q.getNetworkData(r))==null?void 0:f.caipNetwork)==null?void 0:g.id,chain:r})),this.setStatus("connected",r);const v=ce.getConnectedSocialProvider();v?Xe.sendEvent({type:"track",event:"SOCIAL_LOGIN_SUCCESS",address:this.getAddress(),properties:{provider:v,reconnect:!0}}):Xe.sendEvent({type:"track",event:"CONNECT_SUCCESS",address:this.getAddress(),properties:{method:"email",name:((I=(w=(y=(p=this.universalProvider)==null?void 0:p.session)==null?void 0:y.peer)==null?void 0:w.metadata)==null?void 0:I.name)||"Unknown",reconnect:!0,view:Fe.state.view,walletRank:void 0}})}else pe.getConnectorId(r)===Y.CONNECTOR_ID.AUTH&&(this.setStatus("disconnected",r),ce.removeConnectedNamespace(r));this.setLoading(!1,r)}async checkExistingTelegramSocialConnection(e){var r;try{if(!be.isTelegram())return;const n=ce.getTelegramSocialProvider();if(!n||!be.isClient())return;const i=new URL(window.location.href).searchParams.get("result_uri");if(!i)return;n&&q.setAccountProp("socialProvider",n,e),await((r=this.authProvider)==null?void 0:r.init());const o=pe.getAuthConnector();n&&o&&(this.setLoading(!0,e),await me.connectExternal({id:o.id,type:o.type,socialUri:i},o.chain),ce.setConnectedSocialProvider(n),ce.removeTelegramSocialProvider(),Xe.sendEvent({type:"track",event:"SOCIAL_LOGIN_SUCCESS",properties:{provider:n}}))}catch(n){this.setLoading(!1,e),console.error("checkExistingSTelegramocialConnection error",n)}try{const n=new URL(window.location.href);n.searchParams.delete("result_uri"),window.history.replaceState({},document.title,n.toString())}catch(n){console.error("tma social login failed",n)}}createAuthProvider(e){var u,l,d,f;if(!Y.AUTH_CONNECTOR_SUPPORTED_CHAINS.includes(e))return;const n=(u=this.remoteFeatures)==null?void 0:u.email,s=Array.isArray((l=this.remoteFeatures)==null?void 0:l.socials)&&this.remoteFeatures.socials.length>0,i=n||s,a=zi.getActiveNamespaceConnectedToAuth()||e;!this.authProvider&&((d=this.options)!=null&&d.projectId)&&i&&(this.authProvider=Um.getInstance({projectId:this.options.projectId,enableLogger:this.options.enableAuthLogger,chainId:(f=this.getCaipNetwork(a))==null?void 0:f.caipNetworkId,abortController:Cn.EmbeddedWalletAbortController,onTimeout:g=>{g==="iframe_load_failed"?An.open(Cn.ALERT_ERRORS.IFRAME_LOAD_FAILED,"error"):g==="iframe_request_timeout"?An.open(Cn.ALERT_ERRORS.IFRAME_REQUEST_TIMEOUT,"error"):g==="unverified_domain"&&An.open(Cn.ALERT_ERRORS.UNVERIFIED_DOMAIN,"error")},getActiveCaipNetwork:g=>Vf(g),getCaipNetworks:g=>q.getCaipNetworks(g)}),Tn.subscribeOpen(g=>{var h;!g&&this.isTransactionStackEmpty()&&((h=this.authProvider)==null||h.rejectRpcRequests())}));const c=e===q.state.activeChain&&se.state.enableReconnect;se.state.enableReconnect===!1?this.syncAuthConnectorTheme(this.authProvider):this.authProvider&&c&&(this.syncAuthConnector(this.authProvider,e),this.checkExistingTelegramSocialConnection(e))}createAuthProviderForAdapter(e){var r,n,s;this.createAuthProvider(e),this.authProvider&&((s=(n=(r=this.chainAdapters)==null?void 0:r[e])==null?void 0:n.setAuthProvider)==null||s.call(n,this.authProvider))}initControllers(e){super.initControllers(e),this.options.excludeWalletIds&&Ae.initializeExcludedWallets({ids:this.options.excludeWalletIds})}async switchCaipNetwork(e){var o,a,c;if(!e)return;const r=q.state.activeChain,n=e.chainNamespace,s=this.getAddressByChainNamespace(n);if(n===r&&((o=q.getAccountData(n))!=null&&o.caipAddress)){const u=this.getAdapter(n);await(u==null?void 0:u.switchNetwork({caipNetwork:e})),this.setCaipNetwork(e)}else{const l=_t.getProviderId(r)===Fn.CONNECTOR_TYPE_AUTH,d=_t.getProviderId(n),f=d===Fn.CONNECTOR_TYPE_AUTH,g=Y.AUTH_CONNECTOR_SUPPORTED_CHAINS.includes(n);if(!n)throw new Error("AppKit:switchCaipNetwork - networkNamespace is required");if((l&&d===void 0||f)&&g)try{if(q.state.activeChain=e.chainNamespace,s){const h=this.getAdapter(n);await(h==null?void 0:h.switchNetwork({caipNetwork:e}))}else await((c=(a=this.connectionControllerClient)==null?void 0:a.connectExternal)==null?void 0:c.call(a,{id:Y.CONNECTOR_ID.AUTH,provider:this.authProvider,chain:n,chainId:e.id,type:Fn.CONNECTOR_TYPE_AUTH,caipNetwork:e}));this.setCaipNetwork(e)}catch{const p=this.getAdapter(n);await(p==null?void 0:p.switchNetwork({caipNetwork:e}))}else if(d===Fn.CONNECTOR_TYPE_WALLET_CONNECT){if(!q.state.noAdapters){const h=this.getAdapter(n);await(h==null?void 0:h.switchNetwork({caipNetwork:e}))}this.setCaipNetwork(e),this.syncWalletConnectAccount()}else this.setCaipNetwork(e),s&&this.syncAccount({address:s,chainId:e.id,chainNamespace:n})}}async initialize(e){var r;await super.initialize(e),(r=this.chainNamespaces)==null||r.forEach(n=>{this.createAuthProviderForAdapter(n)}
270),await this.injectModalUi(),Tn.set({initialized:!0})}async syncIdentity({address:e,chainId:r,chainNamespace:n}){var a;if(n!==Y.CHAIN.EVM)return;const s=`${n}:${r}`,i=(a=this.caipNetworks)==null?void 0:a.find(c=>c.caipNetworkId===s);if(i!=null&&i.testnet){this.setProfileName(null,n),this.setProfileImage(null,n);return}const o=pe.getConnectorId(n)===Y.CONNECTOR_ID.AUTH;try{const{name:c,avatar:u}=await this.fetchIdentity({address:e});!c&&o?await this.syncReownName(e,n):(this.setProfileName(c,n),this.setProfileImage(u,n))}catch{r!==1&&this.setProfileImage(null,n)}}syncConnectedWalletInfo(e){const r=_t.getProviderId(e);if(r===Fn.CONNECTOR_TYPE_AUTH){const n=this.authProvider;if(n){const s=ce.getConnectedSocialProvider()??"email",i=n.getEmail()??n.getUsername();this.setConnectedWalletInfo({name:r,identifier:i,social:s},e)}}else super.syncConnectedWalletInfo(e)}async injectModalUi(){if(!be.isClient())return;const e={...lt.DEFAULT_FEATURES,...this.options.features};if(!e.headless&&!T3)try{const r=this.remoteFeatures;if(await this.loadModalComponents(e,r),be.isClient()&&!document.querySelector("w3m-modal")){const s=document.createElement("w3m-modal");!se.state.disableAppend&&!se.state.enableEmbedded&&document.body.insertAdjacentElement("beforeend",s)}T3=!0}catch(r){console.error("Error injecting modal UI:",r)}}async loadModalComponents(e,r){if(!be.isClient())return;const n=[];(r.email||r.socials&&r.socials.length>0)&&n.push(Wr(()=>import("./embedded-wallet-Cwlr1cwq.js"),__vite__mapDeps([10,11,2,3,12,13,14,15,16,17,18,19,20,21,22,5,7]))),r.email&&n.push(Wr(()=>import("./email-Cq1ioRqf.js"),__vite__mapDeps([23,11,2,3,24,21,14,20,13,19,25,17,5,7]))),r.socials&&n.push(Wr(()=>import("./socials-DbWojnCN.js"),__vite__mapDeps([26,11,2,3,27,13,28,20,16,19,14,29,12,30,5,7]))),r.swaps&&r.swaps.length>0&&n.push(Wr(()=>import("./swaps-Dv_29EaF.js"),__vite__mapDeps([31,11,2,3,19,14,20,32,33,30,34,12,35,17,13,5,7]))),e.send&&n.push(Wr(()=>import("./send-BRVvYXle.js"),__vite__mapDeps([36,11,2,3,19,14,20,37,13,38,21,34,12,30,33,17,39,40,5,7]))),e.receive&&n.push(Wr(()=>import("./receive-DKqzl-qy.js"),__vite__mapDeps([41,11,2,3,12,29,5,7]))),r.onramp&&r.onramp.length>0&&n.push(Wr(()=>import("./onramp-BoBRXNrn.js"),__vite__mapDeps([42,11,2,3,43,14,27,13,12,44,45,21,19,20,17,5,7]))),r.payWithExchange&&n.push(Wr(()=>import("./pay-with-exchange-CkVjQebP.js"),__vite__mapDeps([46,11,2,3,12,18,43,14,30,19,38,13,21,47,20,17,39,37,5,7]))),r.activity&&n.push(Wr(()=>import("./transactions-9xQ8rgrQ.js"),__vite__mapDeps([48,11,2,3,49,20,21,12,30,5,7]))),(e.pay||r.payments)&&n.push(Wr(()=>import("./index-ae4pRNt-.js"),__vite__mapDeps([50,51,11,2,3,19,14,18,12,43,52,20,37,30,35,5,7]))),r.emailCapture&&n.push(Wr(()=>import("./data-capture-DEFQXfBC.js"),__vite__mapDeps([53,11,2,3,24,21,14,9,5,7]))),await Promise.all([...n,Wr(()=>import("./index-DmLNSrse.js"),__vite__mapDeps([54,11,2,3,12,14,40,20,55,45,21,15,16,52,18,43,19,47,49,30,39,32,35,37,13,17,25,27,28,29,22,44,5,7])),Wr(()=>import("./w3m-modal-BI9aYexB.js"),__vite__mapDeps([56,11,2,3,51,19,14,18,12,43,52,20,37,30,35,15,16,32,55,45,21,33,5,7]))])}}const m0e="1.8.23";function y0e(t){return new g0e({...t,sdkVersion:be.generateSdkVersion(t.adapters??[],"html",m0e)})}const b0e=BL({id:42161,name:"Arbitrum One",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},blockTime:250,rpcUrls:{default:{http:["https://arb1.arbitrum.io/rpc"]}},blockExplorers:{default:{name:"Arbiscan",url:"https://arbiscan.io",apiUrl:"https://api.arbiscan.io/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:7654707}}}),w0e=BL({id:1,name:"Ethereum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},blockTime:12e3,rpcUrls:{default:{http:["https://ethereum.reth.rs/rpc"]}},blockExplorers:{default:{name:"Etherscan",url:"https://etherscan.io",apiUrl:"https://api.etherscan.io/api"}},contracts:{ensUniversalResolver:{address:"0xeeeeeeee14d718c2b47d9923deab1335e144eeee",blockCreated:23085558},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:14353601}}});function Qi(t){return{formatters:void 0,fees:void 0,serializers:void 0,...t}}Qi({id:"5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",name:"Solana",network:"solana-mainnet",nativeCurrency:{name:"Solana",symbol:"SOL",decimals:9},rpcUrls:{default:{http:["https://rpc.walletconnect.org/v1"]}},blockExplorers:{default:{name:"Solscan",url:"https://solscan.io"}},testnet:!1,chainNamespace:"solana",caipNetworkId:"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",deprecatedCaipNetworkId:"solana:4sGjMW1sUnHzSxGspuhpqLDx6wiyjNtZ"});
270Qi({id:"EtWTRABZaYq6iMfeYKouRu166VU2xqa1",name:"Solana Devnet",network:"solana-devnet",nativeCurrency:{name:"Solana",symbol:"SOL",decimals:9},rpcUrls:{default:{http:["https://rpc.walletconnect.org/v1"]}},blockExplorers:{default:{name:"Solscan",url:"https://solscan.io"}},testnet:!0,chainNamespace:"solana",caipNetworkId:"solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1",deprecatedCaipNetworkId:"solana:8E9rvCKLFQia2Y35HXjjpWzj8weVo44K"});Qi({id:"4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z",name:"Solana Testnet",network:"solana-testnet",nativeCurrency:{name:"Solana",symbol:"SOL",decimals:9},rpcUrls:{default:{http:["https://rpc.walletconnect.org/v1"]}},blockExplorers:{default:{name:"Solscan",url:"https://solscan.io"}},testnet:!0,chainNamespace:"solana",caipNetworkId:"solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z"});Qi({id:"000000000019d6689c085ae165831e93",caipNetworkId:"bip122:000000000019d6689c085ae165831e93",chainNamespace:"bip122",name:"Bitcoin",nativeCurrency:{name:"Bitcoin",symbol:"BTC",decimals:8},rpcUrls:{default:{http:["https://rpc.walletconnect.org/v1"]}}});Qi({id:"000000000933ea01ad0ee984209779ba",caipNetworkId:"bip122:000000000933ea01ad0ee984209779ba",chainNamespace:"bip122",name:"Bitcoin Testnet",nativeCurrency:{name:"Bitcoin",symbol:"BTC",decimals:8},rpcUrls:{default:{http:["https://rpc.walletconnect.org/v1"]}},testnet:!0});Qi({id:"00000008819873e925422c1ff0f99f7c",caipNetworkId:"bip122:00000008819873e925422c1ff0f99f7c",chainNamespace:"bip122",name:"Bitcoin Signet",nativeCurrency:{name:"Bitcoin",symbol:"BTC",decimals:8},rpcUrls:{default:{http:["https://rpc.walletconnect.org/v1"]}},testnet:!0});Qi({id:"-239",name:"TON",network:"ton-mainnet",nativeCurrency:{name:"TON",symbol:"TON",decimals:9},rpcUrls:{default:{http:["https://rpc.walletconnect.org/v1"]}},blockExplorers:{default:{name:"Tonscan",url:"https://tonscan.org"}},testnet:!1,chainNamespace:"ton",caipNetworkId:"ton:-239"});Qi({id:"-3",name:"TON Testnet",network:"ton-testnet",nativeCurrency:{name:"TON",symbol:"TON",decimals:9},rpcUrls:{default:{http:["https://rpc.walletconnect.org/v1"]}},blockExplorers:{default:{name:"Tonscan",url:"https://testnet.tonscan.org"}},testnet:!0,chainNamespace:"ton",caipNetworkId:"ton:-3"});Qi({id:"0x2b6653dc",name:"TRON",network:"tron-mainnet",nativeCurrency:{name:"TRX",symbol:"TRX",decimals:6},rpcUrls:{default:{http:["https://rpc.walletconnect.org/v1"]},chainDefault:{http:["https://api.trongrid.io"]}},blockExplorers:{default:{name:"Tronscan",url:"https://tronscan.org"}},testnet:!1,chainNamespace:"tron",caipNetworkId:"tron:0x2b6653dc"});Qi({id:"0x94a9059e",name:"TRON Shasta",network:"tron-shasta",nativeCurrency:{name:"TRX",symbol:"TRX",decimals:6},rpcUrls:{default:{http:["https://rpc.walletconnect.org/v1"]},chainDefault:{http:["https://api.shasta.trongrid.io"]}},blockExplorers:{default:{name:"Tronscan",url:"https://shasta.tronscan.org"}},testnet:!0,chainNamespace:"tron",caipNetworkId:"tron:0x94a9059e"});Qi({id:"0xcd8690dc",name:"TRON Nile",network:"tron-nile",nativeCurrency:{name:"TRX",symbol:"TRX",decimals:6},rpcUrls:{default:{http:["https://rpc.walletconnect.org/v1"]},chainDefault:{http:["https://nile.trongrid.io"]}},blockExplorers:{default:{name:"Tronscan",url:"https://nile.tronscan.org"}},testnet:!0,chainNamespace:"tron",caipNetworkId:"tron:0xcd8690dc"});const E0e="6.13.2";function v0e(t,e,r){const n=e.split("|").map(i=>i.trim());for(let i=0;i<n.length;i++)switch(e){case"any":return;case"bigint":case"boolean":case"number":case"string":if(typeof t===e)return}const s=new Error(`invalid value for type ${e}`);throw s.code="INVALID_ARGUMENT",s.argument=`value.${r}`,s.value=t,s}async function Ln(t){const e=Object.keys(t);return(await Promise.all(e.map(n=>Promise.resolve(t[n])))).reduce((n,s,i)=>(n[e[i]]=s,n),{})}function Ge(t,e,r){for(let n in e){let s=e[n];const i=r?r[n]:null;i&&v0e(s,i,n),Object.defineProperty(t,n,{enumerable:!0,value:s,writable:!1})}}function Jf(t){if(t==null)return"null";if(Array.isArray(t))return"[ "+t.map(Jf).join(", ")+" ]";if(t instanceof Uint8Array){const e="0123456789abcdef";let r="0x";for(let n=0;n<t.length;n++)r+=e[t[n]>>4],r+=e[t[n]&15];return r}if(typeof t=="object"&&typeof t.toJSON=="function")return Jf(t.toJSON());switch(typeof t){case"boolean":case"symbol":return t.toString();case"bigint":return BigInt(t).toString();case"number":return t.toString();case"string":return JSON.stringify(t);case"object":{const e=Object.keys(t);return e.sort(),"{ "+e.map(r=>`${Jf(r)}: ${Jf(t[r])}`).join(", ")+" }"}}return"[ COULD NOT SERIALIZE ]"}function Pn(t,e){return t&&t.code===e}function UO(t){return Pn(t,"CALL_EXCEPTION")}function wr(t,e,r){let n=t;{const i=[];if(r){if("message"in r||"code"in r||"name"in r)throw new Error(`value will over
270write populated values: ${Jf(r)}`);for(const o in r){if(o==="shortMessage")continue;const a=r[o];i.push(o+"="+Jf(a))}}i.push(`code=${e}`),i.push(`version=${E0e}`),i.length&&(t+=" ("+i.join(", ")+")")}let s;switch(e){case"INVALID_ARGUMENT":s=new TypeError(t);break;case"NUMERIC_FAULT":case"BUFFER_OVERRUN":s=new RangeError(t);break;default:s=new Error(t)}return Ge(s,{code:e}),r&&Object.assign(s,r),s.shortMessage==null&&Ge(s,{shortMessage:n}),s}function ue(t,e,r,n){if(!t)throw wr(e,r,n)}function Q(t,e,r,n){ue(t,e,"INVALID_ARGUMENT",{argument:r,value:n})}function pq(t,e,r){r==null&&(r=""),r&&(r=": "+r),ue(t>=e,"missing arguemnt"+r,"MISSING_ARGUMENT",{count:t,expectedCount:e}),ue(t<=e,"too many arguments"+r,"UNEXPECTED_ARGUMENT",{count:t,expectedCount:e})}["NFD","NFC","NFKD","NFKC"].reduce((t,e)=>{try{if("test".normalize(e)!=="test")throw new Error("bad");if(e==="NFD"&&"é".normalize("NFD")!=="é")throw new Error("broken");t.push(e)}catch{}return t},[]);function C0(t,e,r){if(r==null&&(r=""),t!==e){let n=r,s="new";r&&(n+=".",s+=" "+r),ue(!1,`private constructor; use ${n}from* methods`,"UNSUPPORTED_OPERATION",{operation:s})}}function gq(t,e,r){if(t instanceof Uint8Array)return r?new Uint8Array(t):t;if(typeof t=="string"&&t.match(/^0x(?:[0-9a-f][0-9a-f])*$/i)){const n=new Uint8Array((t.length-2)/2);let s=2;for(let i=0;i<n.length;i++)n[i]=parseInt(t.substring(s,s+2),16),s+=2;return n}Q(!1,"invalid BytesLike value",e||"value",t)}function Ct(t,e){return gq(t,e,!1)}function Hn(t,e){return gq(t,e,!0)}function zt(t,e){return!(typeof t!="string"||!t.match(/^0x[0-9A-Fa-f]*$/)||typeof e=="number"&&t.length!==2+2*e||e===!0&&t.length%2!==0)}function MO(t){return zt(t,!0)||t instanceof Uint8Array}const P3="0123456789abcdef";function De(t){const e=Ct(t);let r="0x";for(let n=0;n<e.length;n++){const s=e[n];r+=P3[(s&240)>>4]+P3[s&15]}return r}function Pr(t){return"0x"+t.map(e=>De(e).substring(2)).join("")}function fh(t){return zt(t,!0)?(t.length-2)/2:Ct(t).length}function Er(t,e,r){const n=Ct(t);return r!=null&&r>n.length&&ue(!1,"cannot slice beyond data bounds","BUFFER_OVERRUN",{buffer:n,length:n.length,offset:r}),De(n.slice(e??0,r??n.length))}function mq(t,e,r){const n=Ct(t);ue(e>=n.length,"padding exceeds data length","BUFFER_OVERRUN",{buffer:new Uint8Array(n),length:e,offset:e+1});const s=new Uint8Array(e);return s.fill(0),r?s.set(n,e-n.length):s.set(n,0),De(s)}function Dd(t,e){return mq(t,e,!0)}function _0e(t,e){return mq(t,e,!1)}const rC=BigInt(0),Hi=BigInt(1),Qf=9007199254740991;function cA(t,e){const r=nC(t,"value"),n=BigInt(nt(e,"width"));if(ue(r>>n===rC,"overflow","NUMERIC_FAULT",{operation:"fromTwos",fault:"overflow",value:t}),r>>n-Hi){const s=(Hi<<n)-Hi;return-((~r&s)+Hi)}return r}function yq(t,e){let r=$e(t,"value");const n=BigInt(nt(e,"width")),s=Hi<<n-Hi;if(r<rC){r=-r,ue(r<=s,"too low","NUMERIC_FAULT",{operation:"toTwos",fault:"overflow",value:t});const i=(Hi<<n)-Hi;return(~r&i)+Hi}else ue(r<s,"too high","NUMERIC_FAULT",{operation:"toTwos",fault:"overflow",value:t});return r}function Kl(t,e){const r=nC(t,"value"),n=BigInt(nt(e,"bits"));return r&(Hi<<n)-Hi}function $e(t,e){switch(typeof t){case"bigint":return t;case"number":return Q(Number.isInteger(t),"underflow",e||"value",t),Q(t>=-Qf&&t<=Qf,"overflow",e||"value",t),BigInt(t);case"string":try{if(t==="")throw new Error("empty string");return t[0]==="-"&&t[1]!=="-"?-BigInt(t.substring(1)):BigInt(t)}catch(r){Q(!1,`invalid BigNumberish string: ${r.message}`,e||"value",t)}}Q(!1,"invalid BigNumberish value",e||"value",t)}function nC(t,e){const r=$e(t,e);return ue(r>=rC,"unsigned value cannot be negative","NUMERIC_FAULT",{fault:"overflow",operation:"getUint",value:t}),r}const O3="0123456789abcdef";function sC(t){if(t instanceof Uint8Array){let e="0x0";for(const r of t)e+=O3[r>>4],e+=O3[r&15];return BigInt(e)}return $e(t)}function nt(t,e){switch(typeof t){case"bigint":return Q(t>=-Qf&&t<=Qf,"overflow",e||"value",t),Number(t);case"number":return Q(Number.isInteger(t),"underflow",e||"value",t),Q(t>=-Qf&&t<=Qf,"overflow",e||"value",t),t;case"string":try{if(t==="")throw new Error("empty string");return nt(BigInt(t),e)}catch(r){Q(!1,`invalid numeric string: ${r.message}`,e||"value",t)}}Q(!1,"invalid numeric value",e||"value",t)}function A0e(t){return nt(sC(t))}function ju(t,e){let n=nC(t,"value").toString(16);if(e==null)n.length%2&&(n="0"+n);else{const s=nt(e,"width");for(ue(s*2>=n.length,`value exceeds width (${s} bytes)`,"NUMERIC_FAULT",{operation:"toBeHex",fault:"overflow",value:t});n.length<s*2;)n="0"+n}return"0x"+n}function zn(t){const e=nC(t,"value");if(e===rC)return new Uint8Array([]);let r=e.toString(16);r.length%2&&(r="0"+r);const n=new Uint8Array(r.length/2);for(let s=0;s<n.length;s++){const i=s*2;n[s]=parseInt(r.substring(i,i+2),16)}return n}function Xf(t){let e=De(MO(t)?t:zn(t)).substring(2);for(;e.startsWith("0");)e=e.substring(1);return e===""&&(e="0"),"0x"+e}const N3="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";BigInt(0);const x3=BigInt(58);function C0e(t){const e=Ct(t);let r=sC(e),n="";for(;r;)n=N3[Number(r%x3)]+n,r/=x3;for(let s=0;s<e.length&&!e[s];s++)n=N3[0]+n;return n}function I0e(t){t=atob(t);const e=new Uint8Array(t.length);for(let r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return Ct(e)}function S0e(t){const e=Ct(t);let r="";for(let n=0;n<e.length;n++)r+=String.fromCharCode(e[n]);return btoa(r)}var wh;class bq{constructor(e,r,n){K(this,"filter");K(this,"emitter");ne(this,wh);W(this,wh,r),Ge(this,{emitter:e,filter:n})}async removeListener(){$(this,wh)!=null&&await this.emitter.off(this.filter,$(this,wh))}}wh=new WeakMap;function T0e(t,e,r,n,s){Q(!1,`invalid codepoint at offset ${e}; ${t}`,"bytes",r)}function wq(t,e,r,n,s){if(t==="BAD_PREFIX"||t==="UNEXPECTED_CONTINUE"){let i=0;for(let o=e+1;o<r.length&&r[o]>>6===2;o++)i++;return i}return t==="OVERRUN"?r.length-e-1:0}function P0e(t,e,r,n,s){return t==="OVERLONG"?(Q(typeof s=="number","invali
270d bad code point for replacement","badCodepoint",s),n.push(s),0):(n.push(65533),wq(t,e,r))}const O0e=Object.freeze({error:T0e,ignore:wq,replace:P0e});function N0e(t,e){e==null&&(e=O0e.error);const r=Ct(t,"bytes"),n=[];let s=0;for(;s<r.length;){const i=r[s++];if(i>>7===0){n.push(i);continue}let o=null,a=null;if((i&224)===192)o=1,a=127;else if((i&240)===224)o=2,a=2047;else if((i&248)===240)o=3,a=65535;else{(i&192)===128?s+=e("UNEXPECTED_CONTINUE",s-1,r,n):s+=e("BAD_PREFIX",s-1,r,n);continue}if(s-1+o>=r.length){s+=e("OVERRUN",s-1,r,n);continue}let c=i&(1<<8-o-1)-1;for(let u=0;u<o;u++){let l=r[s];if((l&192)!=128){s+=e("MISSING_CONTINUE",s,r,n),c=null;break}c=c<<6|l&63,s++}if(c!==null){if(c>1114111){s+=e("OUT_OF_RANGE",s-1-o,r,n,c);continue}if(c>=55296&&c<=57343){s+=e("UTF16_SURROGATE",s-1-o,r,n,c);continue}if(c<=a){s+=e("OVERLONG",s-1-o,r,n,c);continue}n.push(c)}}return n}function Fo(t,e){Q(typeof t=="string","invalid string value","str",t);let r=[];for(let n=0;n<t.length;n++){const s=t.charCodeAt(n);if(s<128)r.push(s);else if(s<2048)r.push(s>>6|192),r.push(s&63|128);else if((s&64512)==55296){n++;const i=t.charCodeAt(n);Q(n<t.length&&(i&64512)===56320,"invalid surrogate pair","str",t);const o=65536+((s&1023)<<10)+(i&1023);r.push(o>>18|240),r.push(o>>12&63|128),r.push(o>>6&63|128),r.push(o&63|128)}else r.push(s>>12|224),r.push(s>>6&63|128),r.push(s&63|128)}return new Uint8Array(r)}function x0e(t){return t.map(e=>e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10&1023)+55296,(e&1023)+56320))).join("")}function uA(t,e){return x0e(N0e(t,e))}function Eq(t){async function e(r,n){ue(n==null||!n.cancelled,"request cancelled before sending","CANCELLED");const s=r.url.split(":")[0].toLowerCase();ue(s==="http"||s==="https",`unsupported protocol ${s}`,"UNSUPPORTED_OPERATION",{info:{protocol:s},operation:"request"}),ue(s==="https"||!r.credentials||r.allowInsecureAuthentication,"insecure authorized connections unsupported","UNSUPPORTED_OPERATION",{operation:"request"});let i=null;const o=new AbortController,a=setTimeout(()=>{i=wr("request timeout","TIMEOUT"),o.abort()},r.timeout);n&&n.addListener(()=>{i=wr("request cancelled","CANCELLED"),o.abort()});const c={method:r.method,headers:new Headers(Array.from(r)),body:r.body||void 0,signal:o.signal};let u;try{u=await fetch(r.url,c)}catch(g){throw clearTimeout(a),i||g}clearTimeout(a);const l={};u.headers.forEach((g,h)=>{l[h.toLowerCase()]=g});const d=await u.arrayBuffer(),f=d==null?null:new Uint8Array(d);return{statusCode:u.status,statusMessage:u.statusText,headers:l,body:f}}return e}const R0e=12,B0e=250;let R3=Eq();const k0e=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i"),j0e=new RegExp("^ipfs://(ipfs/)?(.*)$","i");let qI=!1;async function vq(t,e){try{const r=t.match(k0e);if(!r)throw new Error("invalid data");return new Pu(200,"OK",{"content-type":r[1]||"text/plain"},r[2]?I0e(r[3]):U0e(r[3]))}catch{return new Pu(599,"BAD REQUEST (invalid data: URI)",{},null,new uc(t))}}function _q(t){async function e(r,n){try{const s=r.match(j0e);if(!s)throw new Error("invalid link");return new uc(`${t}${s[2]}`)}catch{return new Pu(599,"BAD REQUEST (invalid IPFS URI)",{},null,new uc(r))}}return e}const Db={data:vq,ipfs:_q("https://gateway.ipfs.io/ipfs/")},Aq=new WeakMap;var Ql,nu;class D0e{constructor(e){ne(this,Ql);ne(this,nu);W(this,Ql,[]),W(this,nu,!1),Aq.set(e,()=>{if(!$(this,nu)){W(this,nu,!0);for(const r of $(this,Ql))setTimeout(()=>{r()},0);W(this,Ql,[])}})}addListener(e){ue(!$(this,nu),"singal already cancelled","UNSUPPORTED_OPERATION",{operation:"fetchCancelSignal.addCancelListener"}),$(this,Ql).push(e)}get cancelled(){return $(this,nu)}checkSignal(){ue(!this.cancelled,"cancelled","CANCELLED",{})}}Ql=new WeakMap,nu=new WeakMap;function Ub(t){if(t==null)throw new Error("missing signal; should not happen");return t.checkSignal(),t}var Eh,vh,Di,Ua,_h,Ah,zr,Ds,Ma,Xl,ed,td,wo,Ui,su,rd,_m;const AA=class AA{constructor(e){ne(this,rd);ne(this,Eh);ne(this,vh);ne(this,Di);ne(this,Ua);ne(this,_h);ne(this,Ah);ne(this,zr);ne(this,Ds);ne(this,Ma);ne(this,Xl);ne(this,ed);ne(this,td);ne(this,wo);ne(this,Ui);ne(this,su);W(this,Ah,String(e)),W(this,Eh,!1),W(this,vh,!0),W(this,Di,{}),W(this,Ua,""),W(this,_h,3e5),W(this,Ui,{slotInterval:B0e,maxAttempts:R0e}),W(this,su,null)}get url(){return $(this,Ah)}set url(e){W(this,Ah,String(e))}get body(){return $(this,zr)==null?null:new Uint8Array($(this,zr))}set body(e){if(e==null)W(this,zr,void 0),W(this,Ds,void 0);else if(typeof e=="string")W(this,zr,Fo(e)),W(this,Ds,"text/plain");else if(e instanceof Uint8Array)W(this,zr,e),W(this,Ds,"application/octet-stream");else if(typeof e=="object")W(this,zr,Fo(JSON.stringify(e))),W(this,Ds,"application/json");else throw new Error("invalid body")}hasBody(){return $(this,zr)!=null}
270get method(){return $(this,Ua)?$(this,Ua):this.hasBody()?"POST":"GET"}set method(e){e==null&&(e=""),W(this,Ua,String(e).toUpperCase())}get headers(){const e=Object.assign({},$(this,Di));return $(this,Ma)&&(e.authorization=`Basic ${S0e(Fo($(this,Ma)))}`),this.allowGzip&&(e["accept-encoding"]="gzip"),e["content-type"]==null&&$(this,Ds)&&(e["content-type"]=$(this,Ds)),this.body&&(e["content-length"]=String(this.body.length)),e}getHeader(e){return this.headers[e.toLowerCase()]}setHeader(e,r){$(this,Di)[String(e).toLowerCase()]=String(r)}clearHeaders(){W(this,Di,{})}[Symbol.iterator](){const e=this.headers,r=Object.keys(e);let n=0;return{next:()=>{if(n<r.length){const s=r[n++];return{value:[s,e[s]],done:!1}}return{value:void 0,done:!0}}}}get credentials(){return $(this,Ma)||null}setCredentials(e,r){Q(!e.match(/:/),"invalid basic authentication username","username","[REDACTED]"),W(this,Ma,`${e}:${r}`)}get allowGzip(){return $(this,vh)}set allowGzip(e){W(this,vh,!!e)}get allowInsecureAuthentication(){return!!$(this,Eh)}set allowInsecureAuthentication(e){W(this,Eh,!!e)}get timeout(){return $(this,_h)}set timeout(e){Q(e>=0,"timeout must be non-zero","timeout",e),W(this,_h,e)}get preflightFunc(){return $(this,Xl)||null}set preflightFunc(e){W(this,Xl,e)}get processFunc(){return $(this,ed)||null}set processFunc(e){W(this,ed,e)}get retryFunc(){return $(this,td)||null}set retryFunc(e){W(this,td,e)}get getUrlFunc(){return $(this,su)||R3}set getUrlFunc(e){W(this,su,e)}toString(){return`<FetchRequest method=${JSON.stringify(this.method)} url=${JSON.stringify(this.url)} headers=${JSON.stringify(this.headers)} body=${$(this,zr)?De($(this,zr)):"null"}>`}setThrottleParams(e){e.slotInterval!=null&&($(this,Ui).slotInterval=e.slotInterval),e.maxAttempts!=null&&($(this,Ui).maxAttempts=e.maxAttempts)}send(){return ue($(this,wo)==null,"request already sent","UNSUPPORTED_OPERATION",{operation:"fetchRequest.send"}),W(this,wo,new D0e(this)),ge(this,rd,_m).call(this,0,B3()+this.timeout,0,this,new Pu(0,"",{},null,this))}cancel(){ue($(this,wo)!=null,"request has not been sent","UNSUPPORTED_OPERATION",{operation:"fetchRequest.cancel"});const e=Aq.get(this);if(!e)throw new Error("missing signal; should not happen");e()}redirect(e){const r=this.url.split(":")[0].toLowerCase(),n=e.split(":")[0].toLowerCase();ue(this.method==="GET"&&(r!=="https"||n!=="http")&&e.match(/^https?:/),"unsupported redirect","UNSUPPORTED_OPERATION",{operation:`redirect(${this.method} ${JSON.stringify(this.url)} => ${JSON.stringify(e)})`});const s=new AA(e);return s.method="GET",s.allowGzip=this.allowGzip,s.timeout=this.timeout,W(s,Di,Object.assign({},$(this,Di))),$(this,zr)&&W(s,zr,new Uint8Array($(this,zr))),W(s,Ds,$(this,Ds)),s}clone(){const e=new AA(this.url);return W(e,Ua,$(this,Ua)),$(this,zr)&&W(e,zr,$(this,zr)),W(e,Ds,$(this,Ds)),W(e,Di,Object.assign({},$(this,Di))),W(e,Ma,$(this,Ma)),this.allowGzip&&(e.allowGzip=!0),e.timeout=this.timeout,this.allowInsecureAuthentication&&(e.allowInsecureAuthentication=!0),W(e,Xl,$(this,Xl)),W(e,ed,$(this,ed)),W(e,td,$(this,td)),W(e,Ui,Object.assign({},$(this,Ui))),W(e,su,$(this,su)),e}static lockConfig(){qI=!0}static getGateway(e){return Db[e.toLowerCase()]||null}static registerGateway(e,r){if(e=e.toLowerCase(),e==="http"||e==="https")throw new Error(`cannot intercept ${e}; use registerGetUrl`);if(qI)throw new Error("gateways locked");Db[e]=r}static registerGetUrl(e){if(qI)throw new Error("gateways locked");R3=e}static createGetUrlFunc(e){return Eq()}static createDataGateway(){return vq}static createIpfsGatewayFunc(e){return _q(e)}};Eh=new WeakMap,vh=new WeakMap,Di=new WeakMap,Ua=new WeakMap,_h=new WeakMap,Ah=new WeakMap,zr=new WeakMap,Ds=new WeakMap,Ma=new WeakMap,Xl=new WeakMap,ed=new WeakMap,td=new WeakMap,wo=new WeakMap,Ui=new WeakMap,su=new WeakMap,rd=new WeakSet,_m=async function(e,r,n,s,i){var l,d,f;if(e>=$(this,Ui).maxAttempts)return i.makeServerError("exceeded maximum retry limit");ue(B3()<=r,"timeout","TIMEOUT",{operation:"request.send",reason:"timeout",request:s}),n>0&&await M0e(n);let o=this.clone();const a=(o.url.split(":")[0]||"").toLowerCase();if(a in Db){const g=await Db[a](o.url,Ub($(s,wo)));if(g instanceof Pu){let h=g;if(this.processFunc){Ub($(s,wo));try{h=await this.processFunc(o,h)}catch(p){(p.throttle==null||typeof p.stall!="number")&&h.makeServerError("error in post-processing function",p).assertOk()}}return h}o=g}this.preflightFunc&&(o=await this.preflightFunc(o));const c=await this.getUrlFunc(o,Ub($(s,wo)));let u=new Pu(c.statusCode,c.statusMessage,c.headers,c.body,s);if(u.statusCode===301||u.statusCode===302){try{const g=u.headers.location||"";return ge(l=o.redirect(g),rd,_m).call(l,e+1,r,0,s,u)}catch{}return u}else if(u.statusCode===429&&(this.retryFunc==null||await this.retryFunc(o,u,e))){const g=u.headers["retry-after"];let h=$(this,Ui).slotInterval*Math.trunc(Math.random()*Math.pow(2,e));return typeof g=="string"&&g.match(/^[1-9][0-9]*$/)&&(h=parseInt(g)),ge(d=o.clone(),rd,_m).call(
270d,e+1,r,h,s,u)}if(this.processFunc){Ub($(s,wo));try{u=await this.processFunc(o,u)}catch(g){(g.throttle==null||typeof g.stall!="number")&&u.makeServerError("error in post-processing function",g).assertOk();let h=$(this,Ui).slotInterval*Math.trunc(Math.random()*Math.pow(2,e));return g.stall>=0&&(h=g.stall),ge(f=o.clone(),rd,_m).call(f,e+1,r,h,s,u)}}return u};let uc=AA;var Vy,Gy,Ky,Us,Ch,nd;const sx=class sx{constructor(e,r,n,s,i){ne(this,Vy);ne(this,Gy);ne(this,Ky);ne(this,Us);ne(this,Ch);ne(this,nd);W(this,Vy,e),W(this,Gy,r),W(this,Ky,Object.keys(n).reduce((o,a)=>(o[a.toLowerCase()]=String(n[a]),o),{})),W(this,Us,s==null?null:new Uint8Array(s)),W(this,Ch,i||null),W(this,nd,{message:""})}toString(){return`<FetchResponse status=${this.statusCode} body=${$(this,Us)?De($(this,Us)):"null"}>`}get statusCode(){return $(this,Vy)}get statusMessage(){return $(this,Gy)}get headers(){return Object.assign({},$(this,Ky))}get body(){return $(this,Us)==null?null:new Uint8Array($(this,Us))}get bodyText(){try{return $(this,Us)==null?"":uA($(this,Us))}catch{ue(!1,"response body is not valid UTF-8 data","UNSUPPORTED_OPERATION",{operation:"bodyText",info:{response:this}})}}get bodyJson(){try{return JSON.parse(this.bodyText)}catch{ue(!1,"response body is not valid JSON","UNSUPPORTED_OPERATION",{operation:"bodyJson",info:{response:this}})}}[Symbol.iterator](){const e=this.headers,r=Object.keys(e);let n=0;return{next:()=>{if(n<r.length){const s=r[n++];return{value:[s,e[s]],done:!1}}return{value:void 0,done:!0}}}}makeServerError(e,r){let n;e?n=`CLIENT ESCALATED SERVER ERROR (${this.statusCode} ${this.statusMessage}; ${e})`:(e=`${this.statusCode} ${this.statusMessage}`,n=`CLIENT ESCALATED SERVER ERROR (${e})`);const s=new sx(599,n,this.headers,this.body,$(this,Ch)||void 0);return W(s,nd,{message:e,error:r}),s}throwThrottleError(e,r){r==null?r=-1:Q(Number.isInteger(r)&&r>=0,"invalid stall timeout","stall",r);const n=new Error(e||"throttling requests");throw Ge(n,{stall:r,throttle:!0}),n}getHeader(e){return this.headers[e.toLowerCase()]}hasBody(){return $(this,Us)!=null}get request(){return $(this,Ch)}ok(){return $(this,nd).message===""&&this.statusCode>=200&&this.statusCode<300}assertOk(){if(this.ok())return;let{message:e,error:r}=$(this,nd);e===""&&(e=`server response ${this.statusCode} ${this.statusMessage}`);let n=null;this.request&&(n=this.request.url);let s=null;try{$(this,Us)&&(s=uA($(this,Us)))}catch{}ue(!1,e,"SERVER_ERROR",{request:this.request||"unknown request",response:this,error:r,info:{requestUrl:n,responseBody:s,responseStatus:`${this.statusCode} ${this.statusMessage}`}})}};Vy=new WeakMap,Gy=new WeakMap,Ky=new WeakMap,Us=new WeakMap,Ch=new WeakMap,nd=new WeakMap;let Pu=sx;function B3(){return new Date().getTime()}function U0e(t){return Fo(t.replace(/%([0-9a-f][0-9a-f])/gi,(e,r)=>String.fromCharCode(parseInt(r,16))))}function M0e(t){return new Promise(e=>setTimeout(e,t))}const $0e=BigInt(-1),xi=BigInt(0),eh=BigInt(1),L0e=BigInt(5),yf={};let hh="0000";for(;hh.length<80;)hh+=hh;function al(t){let e=hh;for(;e.length<t;)e+=e;return BigInt("1"+e.substring(0,t))}function ug(t,e,r){const n=BigInt(e.width);if(e.signed){const s=eh<<n-eh;ue(r==null||t>=-s&&t<s,"overflow","NUMERIC_FAULT",{operation:r,fault:"overflow",value:t}),t>xi?t=cA(Kl(t,n),n):t=-cA(Kl(-t,n),n)}else{const s=eh<<n;ue(r==null||t>=0&&t<s,"overflow","NUMERIC_FAULT",{operation:r,fault:"overflow",value:t}),t=(t%s+s)%s&s-eh}return t}function zI(t){typeof t=="number"&&(t=`fixed128x${t}`);let e=!0,r=128,n=18;if(typeof t=="string"){if(t!=="fixed")if(t==="ufixed")e=!1;else{const i=t.match(/^(u?)fixed([0-9]+)x([0-9]+)$/);Q(i,"invalid fixed format","format",t),e=i[1]!=="u",r=parseInt(i[2]),n=parseInt(i[3])}}else if(t){const i=t,o=(a,c,u)=>i[a]==null?u:(Q(typeof i[a]===c,"invalid fixed format ("+a+" not "+c+")","format."+a,i[a]),i[a]);e=o("signed","boolean",e),r=o("width","number",r),n=o("decimals","number",n)}Q(r%8===0,"invalid FixedNumber width (not byte aligned)","format.width",r),Q(n<=80,"invalid FixedNumber decimals (too large)","format.decimals",n);const s=(e?"":"u")+"fixed"+String(r)+"x"+String(n);return{signed:e,width:r,decimals:n,name:s}}function F0e(t,e){let r="";t<xi&&(r="-",t*=$0e);let n=t.toString();if(e===0)return r+n;for(;n.length<=e;)n=hh+n;const s=n.length-e;for(n=n.substring(0,s)+"."+n.substring(s);n[0]==="0"&&n[1]!==".";)n=n.substring(1);for(;n[n.length-1]==="0"&&n[n.length-2]!==".";)n=n.substring(0,n.length-1);return r+n}var Mi,Mt,Mn,Bt,Nl,Pa,tP,rP,nP,sP;const Zc=class Zc{constructor(e,r,n){ne(this,Bt);K(this,"format");ne(this,Mi);ne(this,Mt);ne(this,Mn);K(this,"_value");C0(e,yf,"FixedNumber"),W(this,Mt,r),W(this,Mi,n);const s=F0e(r,n.decimals);Ge(this,{format:n.name,_value:s}),W(this,Mn,al(n.decimals))}get signed(){return $(this,Mi).signed}get width(){return $(this,Mi).width}get decimals(){return $(this,Mi).decimals}get value(){return $(this,Mt)}
270addUnsafe(e){return ge(this,Bt,tP).call(this,e)}add(e){return ge(this,Bt,tP).call(this,e,"add")}subUnsafe(e){return ge(this,Bt,rP).call(this,e)}sub(e){return ge(this,Bt,rP).call(this,e,"sub")}mulUnsafe(e){return ge(this,Bt,nP).call(this,e)}mul(e){return ge(this,Bt,nP).call(this,e,"mul")}mulSignal(e){ge(this,Bt,Nl).call(this,e);const r=$(this,Mt)*$(e,Mt);return ue(r%$(this,Mn)===xi,"precision lost during signalling mul","NUMERIC_FAULT",{operation:"mulSignal",fault:"underflow",value:this}),ge(this,Bt,Pa).call(this,r/$(this,Mn),"mulSignal")}divUnsafe(e){return ge(this,Bt,sP).call(this,e)}div(e){return ge(this,Bt,sP).call(this,e,"div")}divSignal(e){ue($(e,Mt)!==xi,"division by zero","NUMERIC_FAULT",{operation:"div",fault:"divide-by-zero",value:this}),ge(this,Bt,Nl).call(this,e);const r=$(this,Mt)*$(this,Mn);return ue(r%$(e,Mt)===xi,"precision lost during signalling div","NUMERIC_FAULT",{operation:"divSignal",fault:"underflow",value:this}),ge(this,Bt,Pa).call(this,r/$(e,Mt),"divSignal")}cmp(e){let r=this.value,n=e.value;const s=this.decimals-e.decimals;return s>0?n*=al(s):s<0&&(r*=al(-s)),r<n?-1:r>n?1:0}eq(e){return this.cmp(e)===0}lt(e){return this.cmp(e)<0}lte(e){return this.cmp(e)<=0}gt(e){return this.cmp(e)>0}gte(e){return this.cmp(e)>=0}floor(){let e=$(this,Mt);return $(this,Mt)<xi&&(e-=$(this,Mn)-eh),e=$(this,Mt)/$(this,Mn)*$(this,Mn),ge(this,Bt,Pa).call(this,e,"floor")}ceiling(){let e=$(this,Mt);return $(this,Mt)>xi&&(e+=$(this,Mn)-eh),e=$(this,Mt)/$(this,Mn)*$(this,Mn),ge(this,Bt,Pa).call(this,e,"ceiling")}round(e){if(e==null&&(e=0),e>=this.decimals)return this;const r=this.decimals-e,n=L0e*al(r-1);let s=this.value+n;const i=al(r);return s=s/i*i,ug(s,$(this,Mi),"round"),new Zc(yf,s,$(this,Mi))}isZero(){return $(this,Mt)===xi}isNegative(){return $(this,Mt)<xi}toString(){return this._value}toUnsafeFloat(){return parseFloat(this.toString())}toFormat(e){return Zc.fromString(this.toString(),e)}static fromValue(e,r,n){const s=r==null?0:nt(r),i=zI(n);let o=$e(e,"value");const a=s-i.decimals;if(a>0){const c=al(a);ue(o%c===xi,"value loses precision for format","NUMERIC_FAULT",{operation:"fromValue",fault:"underflow",value:e}),o/=c}else a<0&&(o*=al(-a));return ug(o,i,"fromValue"),new Zc(yf,o,i)}static fromString(e,r){const n=e.match(/^(-?)([0-9]*)\.?([0-9]*)$/);Q(n&&n[2].length+n[3].length>0,"invalid FixedNumber string value","value",e);const s=zI(r);let i=n[2]||"0",o=n[3]||"";for(;o.length<s.decimals;)o+=hh;ue(o.substring(s.decimals).match(/^0*$/),"too many decimals for format","NUMERIC_FAULT",{operation:"fromString",fault:"underflow",value:e}),o=o.substring(0,s.decimals);const a=BigInt(n[1]+i+o);return ug(a,s,"fromString"),new Zc(yf,a,s)}static fromBytes(e,r){let n=sC(Ct(e,"value"));const s=zI(r);return s.signed&&(n=cA(n,s.width)),ug(n,s,"fromBytes"),new Zc(yf,n,s)}};Mi=new WeakMap,Mt=new WeakMap,Mn=new WeakMap,Bt=new WeakSet,Nl=function(e){Q(this.format===e.format,"incompatible format; use fixedNumber.toFormat","other",e)},Pa=function(e,r){return e=ug(e,$(this,Mi),r),new Zc(yf,e,$(this,Mi))},tP=function(e,r){return ge(this,Bt,Nl).call(this,e),ge(this,Bt,Pa).call(this,$(this,Mt)+$(e,Mt),r)},rP=function(e,r){return ge(this,Bt,Nl).call(this,e),ge(this,Bt,Pa).call(this,$(this,Mt)-$(e,Mt),r)},nP=function(e,r){return ge(this,Bt,Nl).call(this,e),ge(this,Bt,Pa).call(this,$(this,Mt)*$(e,Mt)/$(this,Mn),r)},sP=function(e,r){return ue($(e,Mt)!==xi,"division by zero","NUMERIC_FAULT",{operation:"div",fault:"divide-by-zero",value:this}),ge(this,Bt,Nl).call(this,e),ge(this,Bt,Pa).call(this,$(this,Mt)*$(this,Mn)/$(e,Mt),r)};let lA=Zc;function H0e(t){let e=t.toString(16);for(;e.length<2;)e="0"+e;return"0x"+e}function k3(t,e,r){let n=0;for(let s=0;s<r;s++)n=n*256+t[e+s];return n}function j3(t,e,r,n){const s=[];for(;r<e+1+n;){const i=Cq(t,r);s.push(i.result),r+=i.consumed,ue(r<=e+1+n,"child data too short","BUFFER_OVERRUN",{buffer:t,length:n,offset:e})}return{consumed:1+n,result:s}}function Cq(t,e){ue(t.length!==0,"data too short","BUFFER_OVERRUN",{buffer:t,length:0,offset:1});const r=n=>{ue(n<=t.length,"data short segment too short","BUFFER_OVERRUN",{buffer:t,length:t.length,offset:n})};if(t[e]>=248){const n=t[e]-247;r(e+1+n);const s=k3(t,e+1,n);return r(e+1+n+s),j3(t,e,e+1+n,n+s)}else if(t[e]>=192){const n=t[e]-192;return r(e+1+n),j3(t,e,e+1,n)}else if(t[e]>=184){const n=t[e]-183;r(e+1+n);const s=k3(t,e+1,n);r(e+1+n+s);const i=De(t.slice(e+1+n,e+1+n+s));return{consumed:1+n+s,result:i}}else if(t[e]>=128){const n=t[e]-128;r(e+1+n);const s=De(t.slice(e+1,e+1+n));return{consumed:1+n,result:s}}return{consumed:1,result:H0e(t[e])}}function iC(t){const e=Ct(t,"data"),r=Cq(e,0);return Q(r.consumed===e.length,"unexpected junk after rlp payload","data",t),r.result}function D3(t){const e=[];for(;t;)e.unshift(t&255),t>>=8;return e}function Iq(t){if(Array.isArray(t)){let n=[];
270if(t.forEach(function(i){n=n.concat(Iq(i))}),n.length<=55)return n.unshift(192+n.length),n;const s=D3(n.length);return s.unshift(247+s.length),s.concat(n)}const e=Array.prototype.slice.call(Ct(t,"object"));if(e.length===1&&e[0]<=127)return e;if(e.length<=55)return e.unshift(128+e.length),e;const r=D3(e.length);return r.unshift(183+r.length),r.concat(e)}const U3="0123456789abcdef";function Ud(t){let e="0x";for(const r of Iq(t))e+=U3[r>>4],e+=U3[r&15];return e}const Sq=["wei","kwei","mwei","gwei","szabo","finney","ether"];function Tq(t,e){let r=18;if(typeof e=="string"){const n=Sq.indexOf(e);Q(n>=0,"invalid unit","unit",e),r=3*n}else e!=null&&(r=nt(e,"unit"));return lA.fromValue(t,r,{decimals:r,width:512}).toString()}function q0e(t,e){Q(typeof t=="string","value must be a string","value",t);let r=18;if(typeof e=="string"){const n=Sq.indexOf(e);Q(n>=0,"invalid unit","unit",e),r=3*n}else e!=null&&(r=nt(e,"unit"));return lA.fromString(t,{decimals:r,width:512}).value}function z0e(t){return Tq(t,18)}const Wn=32,iP=new Uint8Array(Wn),W0e=["then"],Mb={},Pq=new WeakMap;function Dl(t){return Pq.get(t)}function M3(t,e){Pq.set(t,e)}function lg(t,e){const r=new Error(`deferred error during ABI decoding triggered accessing ${t}`);throw r.error=e,r}function oP(t,e,r){return t.indexOf(null)>=0?e.map((n,s)=>n instanceof mp?oP(Dl(n),n,r):n):t.reduce((n,s,i)=>{let o=e.getValue(s);return s in n||(r&&o instanceof mp&&(o=oP(Dl(o),o,r)),n[s]=o),n},{})}var Ih;const th=class th extends Array{constructor(...r){const n=r[0];let s=r[1],i=(r[2]||[]).slice(),o=!0;n!==Mb&&(s=r,i=[],o=!1);super(s.length);ne(this,Ih);s.forEach((u,l)=>{this[l]=u});const a=i.reduce((u,l)=>(typeof l=="string"&&u.set(l,(u.get(l)||0)+1),u),new Map);if(M3(this,Object.freeze(s.map((u,l)=>{const d=i[l];return d!=null&&a.get(d)===1?d:null}))),W(this,Ih,[]),$(this,Ih)==null&&$(this,Ih),!o)return;Object.freeze(this);const c=new Proxy(this,{get:(u,l,d)=>{if(typeof l=="string"){if(l.match(/^[0-9]+$/)){const g=nt(l,"%index");if(g<0||g>=this.length)throw new RangeError("out of result range");const h=u[g];return h instanceof Error&&lg(`index ${g}`,h),h}if(W0e.indexOf(l)>=0)return Reflect.get(u,l,d);const f=u[l];if(f instanceof Function)return function(...g){return f.apply(this===d?u:this,g)};if(!(l in u))return u.getValue.apply(this===d?u:this,[l])}return Reflect.get(u,l,d)}});return M3(c,Dl(this)),c}toArray(r){const n=[];return this.forEach((s,i)=>{s instanceof Error&&lg(`index ${i}`,s),r&&s instanceof th&&(s=s.toArray(r)),n.push(s)}),n}toObject(r){const n=Dl(this);return n.reduce((s,i,o)=>(ue(i!=null,`value at index ${o} unnamed`,"UNSUPPORTED_OPERATION",{operation:"toObject()"}),oP(n,this,r)),{})}slice(r,n){r==null&&(r=0),r<0&&(r+=this.length,r<0&&(r=0)),n==null&&(n=this.length),n<0&&(n+=this.length,n<0&&(n=0)),n>this.length&&(n=this.length);const s=Dl(this),i=[],o=[];for(let a=r;a<n;a++)i.push(this[a]),o.push(s[a]);return new th(Mb,i,o)}filter(r,n){const s=Dl(this),i=[],o=[];for(let a=0;a<this.length;a++){const c=this[a];c instanceof Error&&lg(`index ${a}`,c),r.call(n,c,a,this)&&(i.push(c),o.push(s[a]))}return new th(Mb,i,o)}map(r,n){const s=[];for(let i=0;i<this.length;i++){const o=this[i];o instanceof Error&&lg(`index ${i}`,o),s.push(r.call(n,o,i,this))}return s}getValue(r){const n=Dl(this).indexOf(r);if(n===-1)return;const s=this[n];return s instanceof Error&&lg(`property ${JSON.stringify(r)}`,s.error),s}static fromItems(r,n){return new th(Mb,r,n)}};Ih=new WeakMap;let mp=th;function $3(t){let e=zn(t);return ue(e.length<=Wn,"value out-of-bounds","BUFFER_OVERRUN",{buffer:e,length:Wn,offset:e.length}),e.length!==Wn&&(e=Hn(Pr([iP.slice(e.length%Wn),e]))),e}class dc{constructor(e,r,n,s){K(this,"name");K(this,"type");K(this,"localName");K(this,"dynamic");Ge(this,{name:e,type:r,localName:n,dynamic:s},{name:"string",type:"string",localName:"string",dynamic:"boolean"})}_throwError(e,r){Q(!1,e,this.localName,r)}}var $a,sd,Sh,y_;class aP{constructor(){ne(this,Sh);ne(this,$a);ne(this,sd);W(this,$a,[]),W(this,sd,0)}get data(){return Pr($(this,$a))}get length(){return $(this,sd)}appendWriter(e){return ge(this,Sh,y_).call(this,Hn(e.data))}writeBytes(e){let r=Hn(e);const n=r.length%Wn;
270return n&&(r=Hn(Pr([r,iP.slice(n)]))),ge(this,Sh,y_).call(this,r)}writeValue(e){return ge(this,Sh,y_).call(this,$3(e))}writeUpdatableValue(){const e=$(this,$a).length;return $(this,$a).push(iP),W(this,sd,$(this,sd)+Wn),r=>{$(this,$a)[e]=$3(r)}}}$a=new WeakMap,sd=new WeakMap,Sh=new WeakSet,y_=function(e){return $(this,$a).push(e),W(this,sd,$(this,sd)+e.length),e.length};var us,Ms,id,od,iu,Hd,uP,Oq;const ix=class ix{constructor(e,r,n){ne(this,Hd);K(this,"allowLoose");ne(this,us);ne(this,Ms);ne(this,id);ne(this,od);ne(this,iu);Ge(this,{allowLoose:!!r}),W(this,us,Hn(e)),W(this,id,0),W(this,od,null),W(this,iu,n??1024),W(this,Ms,0)}get data(){return De($(this,us))}get dataLength(){return $(this,us).length}get consumed(){return $(this,Ms)}get bytes(){return new Uint8Array($(this,us))}subReader(e){const r=new ix($(this,us).slice($(this,Ms)+e),this.allowLoose,$(this,iu));return W(r,od,this),r}readBytes(e,r){let n=ge(this,Hd,Oq).call(this,0,e,!!r);return ge(this,Hd,uP).call(this,e),W(this,Ms,$(this,Ms)+n.length),n.slice(0,e)}readValue(){return sC(this.readBytes(Wn))}readIndex(){return A0e(this.readBytes(Wn))}};us=new WeakMap,Ms=new WeakMap,id=new WeakMap,od=new WeakMap,iu=new WeakMap,Hd=new WeakSet,uP=function(e){var r;if($(this,od))return ge(r=$(this,od),Hd,uP).call(r,e);W(this,id,$(this,id)+e),ue($(this,iu)<1||$(this,id)<=$(this,iu)*this.dataLength,`compressed ABI data exceeds inflation ratio of ${$(this,iu)} ( see: https://github.com/ethers-io/ethers.js/issues/4537 )`,"BUFFER_OVERRUN",{buffer:Hn($(this,us)),offset:$(this,Ms),length:e,info:{bytesRead:$(this,id),dataLength:this.dataLength}})},Oq=function(e,r,n){let s=Math.ceil(r/Wn)*Wn;return $(this,Ms)+s>$(this,us).length&&(this.allowLoose&&n&&$(this,Ms)+r<=$(this,us).length?s=r:ue(!1,"data out-of-bounds","BUFFER_OVERRUN",{buffer:Hn($(this,us)),length:$(this,us).length,offset:$(this,Ms)+s})),$(this,us).slice($(this,Ms),$(this,Ms)+s)};let cP=ix;function dA(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`Wrong positive integer: ${t}`)}function $O(t,...e){if(!(t instanceof Uint8Array))throw new Error("Expected Uint8Array");if(e.length>0&&!e.includes(t.length))throw new Error(`Expected Uint8Array of length ${e}, not of length=${t.length}`)}function V0e(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");dA(t.outputLen),dA(t.blockLen)}function yp(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function Nq(t,e){$O(t);const r=e.outputLen;if(t.length<r)throw new Error(`digestInto() expects output buffer of length at least ${r}`)}const WI=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */const xq=t=>t instanceof Uint8Array,G0e=t=>new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4)),VI=t=>new DataView(t.buffer,t.byteOffset,t.byteLength),fo=(t,e)=>t<<32-e|t>>>e,K0e=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!K0e)throw new Error("Non little-endian hardware is not supported");function Z0e(t){if(typeof t!="string")throw new Error(`utf8ToBytes expected string, got ${typeof t}`);return new Uint8Array(new TextEncoder().encode(t))}function oC(t){if(typeof t=="string"&&(t=Z0e(t)),!xq(t))throw new Error(`expected Uint8Array, got ${typeof t}`);return t}function Y0e(...t){const e=new Uint8Array(t.reduce((n,s)=>n+s.length,0));let r=0;return t.forEach(n=>{if(!xq(n))throw new Error("Uint8Array expected");e.set(n,r),r+=n.length}),e}let LO=class{clone(){return this._cloneInto()}};function FO(t){const e=n=>t().update(oC(n)).digest(),r=t();return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=()=>t(),e}function J0e(t=32){if(WI&&typeof WI.getRandomValues=="function")return WI.getRandomValues(new Uint8Array(t));throw new Error("crypto.getRandomValues must be defined")}class Rq extends LO{constructor(e,r){super(),this.finished=!1,this.destroyed=!1,V0e(e);const n=oC(r);if(this.iHash=e.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const s=this.blockLen,i=new Uint8Array(s);i.set(n.length>s?e.create().update(n).digest():n);for(let o=0;o<i.length;o++)i[o]^=54;this.iHash.update(i),this.oHash=e.create();for(let o=0;o<i.length;o++)i[o]^=106;this.oHash.update(i),i.fill(0)}update(e){return yp(this),this.iHash.update(e),this}digestInto(e){yp(this),$O(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){const e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||(e=Object.create(Object.getPrototypeOf(this),{}));const{oHash:r,iHash:n,finished:s,destroyed:i,blockLen:o,outputLen:a}=this;return e=e,e.finished=s,e.destroyed=i,e.blockLen=o,e.outputLen=a,e.oHash=r._cloneInto(e.oHash),e.iHash=n._cloneInto(e.iHash),e}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const Bq=(t,e,r)=>new Rq(t,e).update(r).digest();Bq.create=(t,e)=>new Rq(t,e);function Q0e(t,e,r,n){if(typeof t.setBigUint64=="function")return t.setBigUint64(e,r,n);const s=BigInt(32),i=BigInt(4294967295),o=Number(r>>s&i),a=Number(r&i),c=n?4:0,u=n?0:4;t.setUint32(e+c,o,n),t.setUint32(e+u,a,n)}class kq extends LO{constructor(e,r,n,s){super(),this.blockLen=e,this.outputLen=r,this.padOffset=n,this.isLE=s,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=VI(this.buffer)}update(e){yp(this);const{view:r,buffer:n,blockLen:s}=this;e=oC(e);const i=e.length;for(let o=0;o<i;){const a=Math.min(s-this.pos,i-o);if(a===s){const c=VI(e);for(;s<=i-o;o+=s)this.process(c,o);continue}n.set(e.subarray(o,o+a),this.pos),this.pos+=a,o+=a,this.pos===s&&(this.process(r,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){yp(this),Nq(e,this),this.finished=!0;const{buffer:r,view:n,blockLen:s,isLE:i}=this;let{pos:o}=this;r[o++]=128,this.buffer.subarray(o).fill(0),this.padOffset>s-o&&(this.process(n,0),o=0);for(let d=o;d<s;d++)r[d]=0;Q0e(n,s-8,BigInt(this.length*8),i),this.process(n,0);const a=VI(e),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const u=c/4,l=this.get();if(u>l.length)throw new Error("_sha2: outputLen bigger than state");for(let d=0;d<u;d++)a.setUint32(4*d,l[d],i)}digest(){const{buffer:e,outputLen:r}=this;this.digestInto(e);const n=e.slice(0,r);return this.destroy(),n}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:r,buffer:n,length:s,finished:i,destroyed:o,pos:a}=this;return e.length=s,e.pos=a,e.finished=i,e.destroyed=o,s%r&&e.buffer.set(n),e}}const X0e=(t,e,r)=>t&e^~t&r,ebe=(t,e,r)=>t&e^t&r^e&r,tbe=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756
vendor: 3,381 bytes, line 270
270734187,3204031479,3329325298]),Rc=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Bc=new Uint32Array(64);class rbe extends kq{constructor(){super(64,32,8,!1),this.A=Rc[0]|0,this.B=Rc[1]|0,this.C=Rc[2]|0,this.D=Rc[3]|0,this.E=Rc[4]|0,this.F=Rc[5]|0,this.G=Rc[6]|0,this.H=Rc[7]|0}get(){const{A:e,B:r,C:n,D:s,E:i,F:o,G:a,H:c}=this;return[e,r,n,s,i,o,a,c]}set(e,r,n,s,i,o,a,c){this.A=e|0,this.B=r|0,this.C=n|0,this.D=s|0,this.E=i|0,this.F=o|0,this.G=a|0,this.H=c|0}process(e,r){for(let d=0;d<16;d++,r+=4)Bc[d]=e.getUint32(r,!1);for(let d=16;d<64;d++){const f=Bc[d-15],g=Bc[d-2],h=fo(f,7)^fo(f,18)^f>>>3,p=fo(g,17)^fo(g,19)^g>>>10;Bc[d]=p+Bc[d-7]+h+Bc[d-16]|0}let{A:n,B:s,C:i,D:o,E:a,F:c,G:u,H:l}=this;for(let d=0;d<64;d++){const f=fo(a,6)^fo(a,11)^fo(a,25),g=l+f+X0e(a,c,u)+tbe[d]+Bc[d]|0,p=(fo(n,2)^fo(n,13)^fo(n,22))+ebe(n,s,i)|0;l=u,u=c,c=a,a=o+g|0,o=i,i=s,s=n,n=g+p|0}n=n+this.A|0,s=s+this.B|0,i=i+this.C|0,o=o+this.D|0,a=a+this.E|0,c=c+this.F|0,u=u+this.G|0,l=l+this.H|0,this.set(n,s,i,o,a,c,u,l)}roundClean(){Bc.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const jq=FO(()=>new rbe),$b=BigInt(2**32-1),lP=BigInt(32);function Dq(t,e=!1){return e?{h:Number(t&$b),l:Number(t>>lP&$b)}:{h:Number(t>>lP&$b)|0,l:Number(t&$b)|0}}function Uq(t,e=!1){let r=new Uint32Array(t.length),n=new Uint32Array(t.length);for(let s=0;s<t.length;s++){const{h:i,l:o}=Dq(t[s],e);[r[s],n[s]]=[i,o]}return[r,n]}const nbe=(t,e)=>BigInt(t>>>0)<<lP|BigInt(e>>>0),sbe=(t,e,r)=>t>>>r,ibe=(t,e,r)=>t<<32-r|e>>>r,obe=(t,e,r)=>t>>>r|e<<32-r,abe=(t,e,r)=>t<<32-r|e>>>r,cbe=(t,e,r)=>t<<64-r|e>>>r-32,ube=(t,e,r)=>t>>>r-32|e<<64-r,lbe=(t,e)=>e,dbe=(t,e)=>t,Mq=(t,e,r)=>t<<r|e>>>32-r,$q=(t,e,r)=>e<<r|t>>>32-r,Lq=(t,e,r)=>e<<r-32|t>>>64-r,Fq=(t,e,r)=>t<<r-32|e>>>64-r;function fbe(t,e,r,n){const s=(e>>>0)+(n>>>0);return{h:t+r+(s/2**32|0)|0,l:s|0}}const hbe=(t,e,r)=>(t>>>0)+(e>>>0)+(r>>>0),pbe=(t,e,r,n)=>e+r+n+(t/2**32|0)|0,gbe=(t,e,r,n)=>(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0),mbe=(t,e,r,n,s)=>e+r+n+s+(t/2**32|0)|0,ybe=(t,e,r,n,s)=>(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0)+(s>>>0),bbe=(t,e,r,n,s,i)=>e+r+n+s+i+(t/2**32|0)|0,ot={fromBig:Dq,split:Uq,toBig:nbe,shrSH:sbe,shrSL:ibe,rotrSH:obe,rotrSL:abe,rotrBH:cbe,rotrBL:ube,rotr32H:lbe,rotr32L:dbe,rotlSH:Mq,rotlSL:$q,rotlBH:Lq,rotlBL:Fq,add:fbe,add3L:hbe,add3H:pbe,add4L:gbe,add4H:mbe,add5H:bbe,add5L:ybe},[wbe,Ebe]=ot.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e3585
2705771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(t=>BigInt(t))),kc=new Uint32Array(80),jc=new Uint32Array(80);class vbe extends kq{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){const{Ah:e,Al:r,Bh:n,Bl:s,Ch:i,Cl:o,Dh:a,Dl:c,Eh:u,El:l,Fh:d,Fl:f,Gh:g,Gl:h,Hh:p,Hl:y}=this;return[e,r,n,s,i,o,a,c,u,l,d,f,g,h,p,y]}set(e,r,n,s,i,o,a,c,u,l,d,f,g,h,p,y){this.Ah=e|0,this.Al=r|0,this.Bh=n|0,this.Bl=s|0,this.Ch=i|0,this.Cl=o|0,this.Dh=a|0,this.Dl=c|0,this.Eh=u|0,this.El=l|0,this.Fh=d|0,this.Fl=f|0,this.Gh=g|0,this.Gl=h|0,this.Hh=p|0,this.Hl=y|0}process(e,r){for(let v=0;v<16;v++,r+=4)kc[v]=e.getUint32(r),jc[v]=e.getUint32(r+=4);for(let v=16;v<80;v++){const E=kc[v-15]|0,b=jc[v-15]|0,m=ot.rotrSH(E,b,1)^ot.rotrSH(E,b,8)^ot.shrSH(E,b,7),_=ot.rotrSL(E,b,1)^ot.rotrSL(E,b,8)^ot.shrSL(E,b,7),O=kc[v-2]|0,C=jc[v-2]|0,S=ot.rotrSH(O,C,19)^ot.rotrBH(O,C,61)^ot.shrSH(O,C,6),T=ot.rotrSL(O,C,19)^ot.rotrBL(O,C,61)^ot.shrSL(O,C,6),N=ot.add4L(_,T,jc[v-7],jc[v-16]),R=ot.add4H(N,m,S,kc[v-7],kc[v-16]);kc[v]=R|0,jc[v]=N|0}let{Ah:n,Al:s,Bh:i,Bl:o,Ch:a,Cl:c,Dh:u,Dl:l,Eh:d,El:f,Fh:g,Fl:h,Gh:p,Gl:y,Hh:w,Hl:I}=this;for(let v=0;v<80;v++){const E=ot.rotrSH(d,f,14)^ot.rotrSH(d,f,18)^ot.rotrBH(d,f,41),b=ot.rotrSL(d,f,14)^ot.rotrSL(d,f,18)^ot.rotrBL(d,f,41),m=d&g^~d&p,_=f&h^~f&y,O=ot.add5L(I,b,_,Ebe[v],jc[v]),C=ot.add5H(O,w,E,m,wbe[v],kc[v]),S=O|0,T=ot.rotrSH(n,s,28)^ot.rotrBH(n,s,34)^ot.rotrBH(n,s,39),N=ot.rotrSL(n,s,28)^ot.rotrBL(n,s,34)^ot.rotrBL(n,s,39),R=n&i^n&a^i&a,B=s&o^s&c^o&c;w=p|0,I=y|0,p=g|0,y=h|0,g=d|0,h=f|0,{h:d,l:f}=ot.add(u|0,l|0,C|0,S|0),u=a|0,l=c|0,a=i|0,c=o|0,i=n|0,o=s|0;const A=ot.add3L(S,N,B);n=ot.add3H(A,C,T,R),s=A|0}({h:n,l:s}=ot.add(this.Ah|0,this.Al|0,n|0,s|0)),{h:i,l:o}=ot.add(this.Bh|0,this.Bl|0,i|0,o|0),{h:a,l:c}=ot.add(this.Ch|0,this.Cl|0,a|0,c|0),{h:u,l}=ot.add(this.Dh|0,this.Dl|0,u|0,l|0),{h:d,l:f}=ot.add(this.Eh|0,this.El|0,d|0,f|0),{h:g,l:h}=ot.add(this.Fh|0,this.Fl|0,g|0,h|0),{h:p,l:y}=ot.add(this.Gh|0,this.Gl|0,p|0,y|0),{h:w,l:I}=ot.add(this.Hh|0,this.Hl|0,w|0,I|0),this.set(n,s,i,o,a,c,u,l,d,f,g,h,p,y,w,I)}roundClean(){kc.fill(0),jc.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const _be=FO(()=>new vbe);function Abe(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof We<"u")return We;throw new Error("unable to locate global object")}const L3=Abe();L3.crypto||L3.msCrypto;function Cbe(t){switch(t){case"sha256":return jq.create();case"sha512":return _be.create()}Q(!1,"invalid hashing algorithm name","algorithm",t)}const[Hq,qq,zq]=[[],[],[]],Ibe=BigInt(0),dg=BigInt(1),Sbe=BigInt(2),Tbe=BigInt(7),Pbe=BigInt(256),Obe=BigInt(113);for(let t=0,e=dg,r=1,n=0;t<24;t++){[r,n]=[n,(2*r+3*n)%5],Hq.push(2*(5*n+r)),qq.push((t+1)*(t+2)/2%64);let s=Ibe;for(let i=0;i<7;i++)e=(e<<dg^(e>>Tbe)*Obe)%Pbe,e&Sbe&&(s^=dg<<(dg<<BigInt(i))-dg);zq.push(s)}const[Nbe,xbe]=Uq(zq,!0),F3=(t,e,r)=>r>32?Lq(t,e,r):Mq(t,e,r),H3=(t,e,r)=>r>32?Fq(t,e,r):$q(t,e,r);function Rbe(t,e=24){const r=new Uint32Array(10);for(let n=24-e;n<24;n++){for(let o=0;o<10;o++)r[o]=t[o]^t[o+10]^t[o+20]^t[o+30]^t[o+40];for(let o=0;o<10;o+=2){const a=(o+8)%10,c=(o+2)%10,u=r[c],l=r[c+1],d=F3(u,l,1)^r[a],f=H3(u,l,1)^r[a+1];for(let g=0;g<50;g+=10)t[o+g]^=d,t[o+g+1]^=f}let s=t[2],i=t[3];for(let o=0;o<24;o++){const a=qq[o],c=F3(s,i,a),u=H3(s,i,a),l=Hq[o];s=t[l],i=t[l+1],t[l]=c,t[l+1]=u}for(let o=0;o<50;o+=10){for(let a=0;a<10;a++)r[a]=t[o+a];for(let a=0;a<10;a++)t[o+a]^=~r[(a+2)%10]&r[(a+4)%10]}t[0]^=Nbe[n],t[1]^=xbe[n]}r.fill(0)}class HO extends LO{constructor(e,r,n,s=!1,i=24){if(super(),this.blockLen=e,this.suffix=r,this.outputLen=n,this.enableXOF=s,this.rounds=i,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,dA(n),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=G0e(this.state)}keccak(){Rbe(this.state32,this.rounds),this.posOut=0,this.pos=0}update(e){yp(this);const{blockLen:r,state:n}=this;e=oC(e);const s=e.length;for(let i=0;i<s;){const o=Math.min(r-this.pos,s-i);for(let a=0;a<o;a++)n[this.pos++]^=e[i++];this.pos===r&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:e,suffix:r,pos:n,blockLen:s}=this;e[n]^=r,(r&128)!==0&&n===s-1&&this.keccak(),e[s-1]^=128,this.keccak()}writeInto(e){yp(this,!1),$O(e),this.finish();const r=this.state,{blockLen:n}=this;for(let s=0,i=e.length;s<i;){this.posOut>=n&&this.keccak();const o=Math.min(n-this.posOut,i-s);e.set(r.subarray(this.posOut,this.posOut+o),s),this.posOut+=o,s+=o}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return dA(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(Nq(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(e){const{blockLen:r,suffix:n,outputLen:s,rounds:i,enableXOF:o}=this;return e||(e=new HO(r,n,s,o,i)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=i,e.suffix=n,e.outputLen=s,e.enableXOF=o,e.destroyed=this.destroyed,e}}const Bbe=(t,e,r)=>FO(()=>new HO(e,t,r)),kbe=Bbe(1,136,256/8);let Wq=!1;const Vq=function(t){return kbe(t)};let Gq=Vq;function Br(t){const e=Ct(t,"data");return De(Gq(e))}Br._=Vq;Br.lock=function(){Wq=!0};Br.register=function(t){if(Wq)throw new TypeError("keccak256 is locked");Gq=t};Object.freeze(Br);const Kq=function(t){return Cbe("sha256").update(t).digest()};let Zq=Kq,Yq=!1;function Rp(t){const e=Ct(t,"data");return De(Zq(e))}Rp._=Kq;Rp.lock=function(){Yq=!0};Rp.register=function(t){if(Yq)throw new Error("sha256 is locked");Zq=t};Object.freeze(Rp);Object.freeze(Rp);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Jq=BigInt(0),aC=BigInt(1),jbe=BigInt(2),cC=t=>t instanceof Uint8Array,Dbe=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function bp(t){if(!cC(t))throw new Error("Uint8Array expected");let e="";for(let r=0;r<t.length;r++)e+=Dbe[t[r]];return e}function Qq(t){const e=t.toString(16);return e.length&1?`0${e}`:e}function qO(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);return BigInt(t===""?"0":`0x${t}`)}function wp(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);const e=t.length;if(e%2)throw new Error("padded hex string expected, got unpadded hex of length "+e);
270const r=new Uint8Array(e/2);for(let n=0;n<r.length;n++){const s=n*2,i=t.slice(s,s+2),o=Number.parseInt(i,16);if(Number.isNaN(o)||o<0)throw new Error("Invalid byte sequence");r[n]=o}return r}function Ad(t){return qO(bp(t))}function zO(t){if(!cC(t))throw new Error("Uint8Array expected");return qO(bp(Uint8Array.from(t).reverse()))}function Ep(t,e){return wp(t.toString(16).padStart(e*2,"0"))}function WO(t,e){return Ep(t,e).reverse()}function Ube(t){return wp(Qq(t))}function ji(t,e,r){let n;if(typeof e=="string")try{n=wp(e)}catch(i){throw new Error(`${t} must be valid hex string, got "${e}". Cause: ${i}`)}else if(cC(e))n=Uint8Array.from(e);else throw new Error(`${t} must be hex string or Uint8Array`);const s=n.length;if(typeof r=="number"&&s!==r)throw new Error(`${t} expected ${r} bytes, got ${s}`);return n}function Dy(...t){const e=new Uint8Array(t.reduce((n,s)=>n+s.length,0));let r=0;return t.forEach(n=>{if(!cC(n))throw new Error("Uint8Array expected");e.set(n,r),r+=n.length}),e}function Mbe(t,e){if(t.length!==e.length)return!1;for(let r=0;r<t.length;r++)if(t[r]!==e[r])return!1;return!0}function $be(t){if(typeof t!="string")throw new Error(`utf8ToBytes expected string, got ${typeof t}`);return new Uint8Array(new TextEncoder().encode(t))}function Lbe(t){let e;for(e=0;t>Jq;t>>=aC,e+=1);return e}function Fbe(t,e){return t>>BigInt(e)&aC}const Hbe=(t,e,r)=>t|(r?aC:Jq)<<BigInt(e),VO=t=>(jbe<<BigInt(t-1))-aC,GI=t=>new Uint8Array(t),q3=t=>Uint8Array.from(t);function Xq(t,e,r){if(typeof t!="number"||t<2)throw new Error("hashLen must be a number");if(typeof e!="number"||e<2)throw new Error("qByteLen must be a number");if(typeof r!="function")throw new Error("hmacFn must be a function");let n=GI(t),s=GI(t),i=0;const o=()=>{n.fill(1),s.fill(0),i=0},a=(...d)=>r(s,n,...d),c=(d=GI())=>{s=a(q3([0]),d),n=a(),d.length!==0&&(s=a(q3([1]),d),n=a())},u=()=>{if(i++>=1e3)throw new Error("drbg: tried 1000 values");let d=0;const f=[];for(;d<e;){n=a();const g=n.slice();f.push(g),d+=n.length}return Dy(...f)};return(d,f)=>{o(),c(d);let g;for(;!(g=f(u()));)c();return o(),g}}const qbe={bigint:t=>typeof t=="bigint",function:t=>typeof t=="function",boolean:t=>typeof t=="boolean",string:t=>typeof t=="string",stringOrUint8Array:t=>typeof t=="string"||t instanceof Uint8Array,isSafeInteger:t=>Number.isSafeInteger(t),array:t=>Array.isArray(t),field:(t,e)=>e.Fp.isValid(t),hash:t=>typeof t=="function"&&Number.isSafeInteger(t.outputLen)};function I0(t,e,r={}){const n=(s,i,o)=>{const a=qbe[i];if(typeof a!="function")throw new Error(`Invalid validator "${i}", expected function`);const c=t[s];if(!(o&&c===void 0)&&!a(c,t))throw new Error(`Invalid param ${String(s)}=${c} (${typeof c}), expected ${i}`)};for(const[s,i]of Object.entries(e))n(s,i,!1);for(const[s,i]of Object.entries(r))n(s,i,!0);return t}const zbe=Object.freeze(Object.defineProperty({__proto__:null,bitGet:Fbe,bitLen:Lbe,bitMask:VO,bitSet:Hbe,bytesToHex:bp,bytesToNumberBE:Ad,bytesToNumberLE:zO,concatBytes:Dy,createHmacDrbg:Xq,ensureBytes:ji,equalBytes:Mbe,hexToBytes:wp,hexToNumber:qO,numberToBytesBE:Ep,numberToBytesLE:WO,numberToHexUnpadded:Qq,numberToVarBytesBE:Ube,utf8ToBytes:$be,validateObject:I0},Symbol.toStringTag,{value:"Module"}));/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Jr=BigInt(0),Ir=BigInt(1),Ul=BigInt(2),Wbe=BigInt(3),dP=BigInt(4),z3=BigInt(5),W3=BigInt(8);BigInt(9);BigInt(16);function gs(t,e){const r=t%e;return r>=Jr?r:e+r}function Vbe(t,e,r){if(r<=Jr||e<Jr)throw new Error("Expected power/modulo > 0");if(r===Ir)return Jr;let n=Ir;for(;e>Jr;)e&Ir&&(n=n*t%r),t=t*t%r,e>>=Ir;return n}function ei(t,e,r){let n=t;for(;e-- >Jr;)n*=n,n%=r;return n}function fP(t,e){if(t===Jr||e<=Jr)throw new Error(`invert: expected positive integers, got n=${t} mod=${e}`);let r=gs(t,e),n=e,s=Jr,i=Ir;for(;r!==Jr;){const a=n/r,c=n%r,u=s-i*a;n=r,r=c,s=i,i=u}if(n!==Ir)throw new Error("invert: does not exist");return gs(s,e)}function Gbe(t){const e=(t-Ir)/Ul;let r,n,s;for(r=t-Ir,n=0;r%Ul===Jr;r/=Ul,n++);for(s=Ul;s<t&&Vbe(s,e,t)!==t-Ir;s++);if(n===1){const o=(t+Ir)/dP;return function(c,u){const l=c.pow(u,o);if(!c.eql(c.sqr(l),u))throw new Error("Cannot find square root");return l}}const i=(r+Ir)/Ul;return function(a,c){if(a.pow(c,e)===a.neg(a.ONE))throw new Error("Cannot find square root");let u=n,l=a.pow(a.mul(a.ONE,s),r),d=a.pow(c,i),f=a.pow(c,r);for(;!a.eql(f,a.ONE);){if(a.eql(f,a.ZERO))return a.ZERO;let g=1;for(let p=a.sqr(f);g<u&&!a.eql(p,a.ONE);g++)p=a.sqr(p);const h=a.pow(l,Ir<<BigInt(u-g-1));l=a.sqr(h),d=a.mul(d,h),f=a.mul(f,l),u=g}return d}}function Kbe(t){if(t%dP===Wbe){const e=(t+Ir)/dP;return function(n,s){const i=n.pow(s,e);if(!n.eql(n.sqr(i),s))throw new Error("Cannot find square root");return i}}if(t%W3===z3){const e=(t-z3)/W3;return function(n,s){const i=n.mul(s,Ul),o=n.pow(i,e),a=n.mul(s,o),c=n.mul(n.mul(a,Ul),o),u=n.mul(a,n.sub(c,n.ONE));if(!n.eql(n.sqr(u),s))throw new Error("Cannot find square root");return u}}return Gbe(t)}const Zbe=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Ybe(t){const e={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},r=Zbe.reduce((n,s)=>(n[s]="function",n),e);return I0(t,r)}function Jbe(t,e,r){if(r<Jr)throw new Error("Expected power > 0");if(r===Jr)return t.ONE;if(r===Ir)return e;let n=t.ONE,s=e;for(;r>Jr;)r&Ir&&(n=t.mul(n,s)),s=t.sqr(s),r>>=Ir;return n}function Qbe(t,e){const r=new Array(e.length),n=e.reduce((i,o,a)=>t.is0(o)?i:(r[a]=i,t.mul(i,o)),t.ONE),s=t.inv(n);return e.reduceRight((i,o,a)=>t.is0(o)?i:(r[a]=t.mul(i,r[a]),t.mul(i,o)),s),r}function e7(t,e){const r=e!==void 0?e:t.toString(2).length,n=Math.ceil(r/8);return{nBitLength:r,nByteLength:n}}function Xbe(t,e,r=!1,n={}){if(t<=Jr)throw new Error(`Expected Field ORDER > 0, got ${t}`);const{nBitLength:s,nByteLength:i}=e7(t,e);if(i>2048)throw new Error("Field lengths over 2048 bytes are not supported");const o=Kbe(t),a=Object.freeze({ORDER:t,BITS:s,BYTES:i,MASK:VO(s),ZERO:Jr,ONE:Ir,create:c=>gs(c,t),isValid:c=>{if(typeof c!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof c}`);return Jr<=c&&c<t},is0:c=>c===Jr,isOdd:c=>(c&Ir)===Ir,neg:c=>gs(-c,t),eql:(c,u)=>c===u,sqr:c=>gs(c*c,t),add:(c,u)=>gs(c+u,t),sub:(c,u)=>gs(c-u,t),mul:(c,u)=>gs(c*u,t),pow:(c,u)=>Jbe(a,c,u),div:(c,u)=>gs(c*fP(u,t),t),sqrN:c=>c*c,addN:(c,u)=>c+u,subN:(c,u)=>c-u,mulN:(c,u)=>c*u,inv:c=>fP(c,t),sqrt:n.sqrt||(c=>o(a,c)),invertBatch:c=>Qbe(a,c),cmov:(c,u,l)=>l?u:c,toBytes:c=>r?WO(c,i):Ep(c,i),fromBytes:c=>{if(c.length!==i)throw new Error(`Fp.fromBytes: expected ${i}, got ${c.length}`);return r?zO(c):Ad(c)}});return Object.freeze(a)}function t7(t){if(typeof t!="bigint")throw new Error("field order must be bigint");const e=t.toString(2).length;return Math.ceil(e/8)}function r7(t){const e=t7(t);return e+Math.ceil(e/2)}function ewe(t,e,r=!1){const n=t.length,s=t7(e),i=r7(e);if(n<16||n<i||n>1024)throw new Error(`expected ${i}-1024 bytes of input, got ${n}`);const o=r?Ad(t):zO(t),a=gs(o,e-Ir)+Ir;return r?WO(a,s):Ep(a,s)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const twe=BigInt(0),KI=BigInt(1);function rwe(t,e){const r=(s,i)=>{const o=i.negate();return s?o:i},n=s=>{const i=Math.ceil(e/s)+1,o=2**(s-1);return{windows:i,windowSize:o}};return{constTimeNegate:r,unsafeLadder(s,i){let o=t.ZERO,a=s;for(;i>twe;)i&KI&&(o=o.add(a)),a=a.double(),i>>=KI;return o},precomputeWindow(s,i){const{windows:o,windowSize:a}=n(i),c=[];let u=s,l=u;for(let d=0;d<o;d++){l=u,c.push(l);for(let f=1;f<a;f++)l=l.add(u),c.push(l);u=l.double()}return c},wNAF(s,i,o){const{windows:a,windowSize:c}=n(s);let u=t.ZERO,l=t.BASE;const d=BigInt(2**s-1),f=2**s,g=BigInt(s);for(let h=0;h<a;h++){const p=h*c;let y=Number(o&d);o>>=g,y>c&&(y-=f,o+=KI);const w=p,I=p+Math.abs(y)-1,v=h%2!==0,E=y<0;
270y===0?l=l.add(r(v,i[w])):u=u.add(r(E,i[I]))}return{p:u,f:l}},wNAFCached(s,i,o,a){const c=s._WINDOW_SIZE||1;let u=i.get(s);return u||(u=this.precomputeWindow(s,c),c!==1&&i.set(s,a(u))),this.wNAF(c,u,o)}}}function n7(t){return Ybe(t.Fp),I0(t,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...e7(t.n,t.nBitLength),...t,p:t.Fp.ORDER})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function nwe(t){const e=n7(t);I0(e,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:r,Fp:n,a:s}=e;if(r){if(!n.eql(s,n.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if(typeof r!="object"||typeof r.beta!="bigint"||typeof r.splitScalar!="function")throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...e})}const{bytesToNumberBE:swe,hexToBytes:iwe}=zbe,Zl={Err:class extends Error{constructor(e=""){super(e)}},_parseInt(t){const{Err:e}=Zl;if(t.length<2||t[0]!==2)throw new e("Invalid signature integer tag");const r=t[1],n=t.subarray(2,r+2);if(!r||n.length!==r)throw new e("Invalid signature integer: wrong length");if(n[0]&128)throw new e("Invalid signature integer: negative");if(n[0]===0&&!(n[1]&128))throw new e("Invalid signature integer: unnecessary leading zero");return{d:swe(n),l:t.subarray(r+2)}},toSig(t){const{Err:e}=Zl,r=typeof t=="string"?iwe(t):t;if(!(r instanceof Uint8Array))throw new Error("ui8a expected");let n=r.length;if(n<2||r[0]!=48)throw new e("Invalid signature tag");if(r[1]!==n-2)throw new e("Invalid signature: incorrect length");const{d:s,l:i}=Zl._parseInt(r.subarray(2)),{d:o,l:a}=Zl._parseInt(i);if(a.length)throw new e("Invalid signature: left bytes after parsing");return{r:s,s:o}},hexFromSig(t){const e=u=>Number.parseInt(u[0],16)&8?"00"+u:u,r=u=>{const l=u.toString(16);return l.length&1?`0${l}`:l},n=e(r(t.s)),s=e(r(t.r)),i=n.length/2,o=s.length/2,a=r(i),c=r(o);return`30${r(o+i+4)}02${c}${s}02${a}${n}`}},Ya=BigInt(0),di=BigInt(1);BigInt(2);const V3=BigInt(3);BigInt(4);function owe(t){const e=nwe(t),{Fp:r}=e,n=e.toBytes||((h,p,y)=>{const w=p.toAffine();return Dy(Uint8Array.from([4]),r.toBytes(w.x),r.toBytes(w.y))}),s=e.fromBytes||(h=>{const p=h.subarray(1),y=r.fromBytes(p.subarray(0,r.BYTES)),w=r.fromBytes(p.subarray(r.BYTES,2*r.BYTES));return{x:y,y:w}});function i(h){const{a:p,b:y}=e,w=r.sqr(h),I=r.mul(w,h);return r.add(r.add(I,r.mul(h,p)),y)}if(!r.eql(r.sqr(e.Gy),i(e.Gx)))throw new Error("bad generator point: equation left != right");function o(h){return typeof h=="bigint"&&Ya<h&&h<e.n}function a(h){if(!o(h))throw new Error("Expected valid bigint: 0 < bigint < curve.n")}function c(h){const{allowedPrivateKeyLengths:p,nByteLength:y,wrapPrivateKey:w,n:I}=e;if(p&&typeof h!="bigint"){if(h instanceof Uint8Array&&(h=bp(h)),typeof h!="string"||!p.includes(h.length))throw new Error("Invalid key");h=h.padStart(y*2,"0")}let v;try{v=typeof h=="bigint"?h:Ad(ji("private key",h,y))}catch{throw new Error(`private key must be ${y} bytes, hex or bigint, not ${typeof h}`)}return w&&(v=gs(v,I)),a(v),v}const u=new Map;function l(h){if(!(h instanceof d))throw new Error("ProjectivePoint expected")}class d{constructor(p,y,w){if(this.px=p,this.py=y,this.pz=w,p==null||!r.isValid(p))throw new Error("x required");if(y==null||!r.isValid(y))throw new Error("y required");if(w==null||!r.isValid(w))throw new Error("z required")}static fromAffine(p){const{x:y,y:w}=p||{};if(!p||!r.isValid(y)||!r.isValid(w))throw new Error("invalid affine point");if(p instanceof d)throw new Error("projective point not allowed");const I=v=>r.eql(v,r.ZERO);return I(y)&&I(w)?d.ZERO:new d(y,w,r.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(p){const y=r.invertBatch(p.map(w=>w.pz));return p.map((w,I)=>w.toAffine(y[I])).map(d.fromAffine)}static fromHex(p){const y=d.fromAffine(s(ji("pointHex",p)));return y.assertValidity(),y}static fromPrivateKey(p){return d.BASE.multiply(c(p))}_setWindowSize(p){this._WINDOW_SIZE=p,u.delete(this)}
270assertValidity(){if(this.is0()){if(e.allowInfinityPoint&&!r.is0(this.py))return;throw new Error("bad point: ZERO")}const{x:p,y}=this.toAffine();if(!r.isValid(p)||!r.isValid(y))throw new Error("bad point: x or y not FE");const w=r.sqr(y),I=i(p);if(!r.eql(w,I))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:p}=this.toAffine();if(r.isOdd)return!r.isOdd(p);throw new Error("Field doesn't support isOdd")}equals(p){l(p);const{px:y,py:w,pz:I}=this,{px:v,py:E,pz:b}=p,m=r.eql(r.mul(y,b),r.mul(v,I)),_=r.eql(r.mul(w,b),r.mul(E,I));return m&&_}negate(){return new d(this.px,r.neg(this.py),this.pz)}double(){const{a:p,b:y}=e,w=r.mul(y,V3),{px:I,py:v,pz:E}=this;let b=r.ZERO,m=r.ZERO,_=r.ZERO,O=r.mul(I,I),C=r.mul(v,v),S=r.mul(E,E),T=r.mul(I,v);return T=r.add(T,T),_=r.mul(I,E),_=r.add(_,_),b=r.mul(p,_),m=r.mul(w,S),m=r.add(b,m),b=r.sub(C,m),m=r.add(C,m),m=r.mul(b,m),b=r.mul(T,b),_=r.mul(w,_),S=r.mul(p,S),T=r.sub(O,S),T=r.mul(p,T),T=r.add(T,_),_=r.add(O,O),O=r.add(_,O),O=r.add(O,S),O=r.mul(O,T),m=r.add(m,O),S=r.mul(v,E),S=r.add(S,S),O=r.mul(S,T),b=r.sub(b,O),_=r.mul(S,C),_=r.add(_,_),_=r.add(_,_),new d(b,m,_)}add(p){l(p);const{px:y,py:w,pz:I}=this,{px:v,py:E,pz:b}=p;let m=r.ZERO,_=r.ZERO,O=r.ZERO;const C=e.a,S=r.mul(e.b,V3);let T=r.mul(y,v),N=r.mul(w,E),R=r.mul(I,b),B=r.add(y,w),A=r.add(v,E);B=r.mul(B,A),A=r.add(T,N),B=r.sub(B,A),A=r.add(y,I);let P=r.add(v,b);return A=r.mul(A,P),P=r.add(T,R),A=r.sub(A,P),P=r.add(w,I),m=r.add(E,b),P=r.mul(P,m),m=r.add(N,R),P=r.sub(P,m),O=r.mul(C,A),m=r.mul(S,R),O=r.add(m,O),m=r.sub(N,O),O=r.add(N,O),_=r.mul(m,O),N=r.add(T,T),N=r.add(N,T),R=r.mul(C,R),A=r.mul(S,A),N=r.add(N,R),R=r.sub(T,R),R=r.mul(C,R),A=r.add(A,R),T=r.mul(N,A),_=r.add(_,T),T=r.mul(P,A),m=r.mul(B,m),m=r.sub(m,T),T=r.mul(B,N),O=r.mul(P,O),O=r.add(O,T),new d(m,_,O)}subtract(p){return this.add(p.negate())}is0(){return this.equals(d.ZERO)}wNAF(p){return g.wNAFCached(this,u,p,y=>{const w=r.invertBatch(y.map(I=>I.pz));return y.map((I,v)=>I.toAffine(w[v])).map(d.fromAffine)})}multiplyUnsafe(p){const y=d.ZERO;if(p===Ya)return y;if(a(p),p===di)return this;const{endo:w}=e;if(!w)return g.unsafeLadder(this,p);let{k1neg:I,k1:v,k2neg:E,k2:b}=w.splitScalar(p),m=y,_=y,O=this;for(;v>Ya||b>Ya;)v&di&&(m=m.add(O)),b&di&&(_=_.add(O)),O=O.double(),v>>=di,b>>=di;return I&&(m=m.negate()),E&&(_=_.negate()),_=new d(r.mul(_.px,w.beta),_.py,_.pz),m.add(_)}multiply(p){a(p);let y=p,w,I;const{endo:v}=e;if(v){const{k1neg:E,k1:b,k2neg:m,k2:_}=v.splitScalar(y);let{p:O,f:C}=this.wNAF(b),{p:S,f:T}=this.wNAF(_);O=g.constTimeNegate(E,O),S=g.constTimeNegate(m,S),S=new d(r.mul(S.px,v.beta),S.py,S.pz),w=O.add(S),I=C.add(T)}else{const{p:E,f:b}=this.wNAF(y);w=E,I=b}return d.normalizeZ([w,I])[0]}multiplyAndAddUnsafe(p,y,w){const I=d.BASE,v=(b,m)=>m===Ya||m===di||!b.equals(I)?b.multiplyUnsafe(m):b.multiply(m),E=v(this,y).add(v(p,w));return E.is0()?void 0:E}toAffine(p){const{px:y,py:w,pz:I}=this,v=this.is0();p==null&&(p=v?r.ONE:r.inv(I));const E=r.mul(y,p),b=r.mul(w,p),m=r.mul(I,p);if(v)return{x:r.ZERO,y:r.ZERO};if(!r.eql(m,r.ONE))throw new Error("invZ was invalid");return{x:E,y:b}}isTorsionFree(){const{h:p,isTorsionFree:y}=e;if(p===di)return!0;if(y)return y(d,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:p,clearCofactor:y}=e;return p===di?this:y?y(d,this):this.multiplyUnsafe(e.h)}toRawBytes(p=!0){return this.assertValidity(),n(d,this,p)}toHex(p=!0){return bp(this.toRawBytes(p))}}d.BASE=new d(e.Gx,e.Gy,r.ONE),d.ZERO=new d(r.ZERO,r.ONE,r.ZERO);const f=e.nBitLength,g=rwe(d,e.endo?Math.ceil(f/2):f);return{CURVE:e,ProjectivePoint:d,normPrivateKeyToScalar:c,weierstrassEquation:i,isWithinCurveOrder:o}}function awe(t){const e=n7(t);return I0(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}function cwe(t){const e=awe(t),{Fp:r,n}=e,s=r.BYTES+1,i=2*r.BYTES+1;function o(A){return Ya<A&&A<r.ORDER}function a(A){return gs(A,n)}function c(A){return fP(A,n)}const{ProjectivePoint:u,normPrivateKeyToScalar:l,weierstrassEquation:d,isWithinCurveOrder:f}=owe({...e,toBytes(A,P,k){const U=P.toAffine(),x=r.toBytes(U.x),j=Dy;return k?j(Uint8Array.from([P.hasEvenY()?2:3]),x):j(Uint8Array.from([4]),x,r.toBytes(U.y))},fromBytes(A){const P=A.length,k=A[0],U=A.subarray(1);if(P===s&&(k===2||k===3)){const x=Ad(U);if(!o(x))throw new Error("Point is not on curve");const j=d(x);let D=r.sqrt(j);const M=(D&di)===di;return(k&1)===1!==M&&(D=r.neg(D)),{x,y:D}}else if(P===i&&k===4){const x=r.fromBytes(U.subarray(0,r.BYTES)),j=r.fromBytes(U.subarray(r.BYTES,2*r.BYTES));return{x,y:j}}else throw new Error(`Point of length ${P}
270 was invalid. Expected ${s} compressed bytes or ${i} uncompressed bytes`)}}),g=A=>bp(Ep(A,e.nByteLength));function h(A){const P=n>>di;return A>P}function p(A){return h(A)?a(-A):A}const y=(A,P,k)=>Ad(A.slice(P,k));class w{constructor(P,k,U){this.r=P,this.s=k,this.recovery=U,this.assertValidity()}static fromCompact(P){const k=e.nByteLength;return P=ji("compactSignature",P,k*2),new w(y(P,0,k),y(P,k,2*k))}static fromDER(P){const{r:k,s:U}=Zl.toSig(ji("DER",P));return new w(k,U)}assertValidity(){if(!f(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!f(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(P){return new w(this.r,this.s,P)}recoverPublicKey(P){const{r:k,s:U,recovery:x}=this,j=_(ji("msgHash",P));if(x==null||![0,1,2,3].includes(x))throw new Error("recovery id invalid");const D=x===2||x===3?k+e.n:k;if(D>=r.ORDER)throw new Error("recovery id 2 or 3 invalid");const M=(x&1)===0?"02":"03",L=u.fromHex(M+g(D)),H=c(D),z=a(-j*H),V=a(U*H),G=u.BASE.multiplyAndAddUnsafe(L,z,V);if(!G)throw new Error("point at infinify");return G.assertValidity(),G}hasHighS(){return h(this.s)}normalizeS(){return this.hasHighS()?new w(this.r,a(-this.s),this.recovery):this}toDERRawBytes(){return wp(this.toDERHex())}toDERHex(){return Zl.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return wp(this.toCompactHex())}toCompactHex(){return g(this.r)+g(this.s)}}const I={isValidPrivateKey(A){try{return l(A),!0}catch{return!1}},normPrivateKeyToScalar:l,randomPrivateKey:()=>{const A=r7(e.n);return ewe(e.randomBytes(A),e.n)},precompute(A=8,P=u.BASE){return P._setWindowSize(A),P.multiply(BigInt(3)),P}};function v(A,P=!0){return u.fromPrivateKey(A).toRawBytes(P)}function E(A){const P=A instanceof Uint8Array,k=typeof A=="string",U=(P||k)&&A.length;return P?U===s||U===i:k?U===2*s||U===2*i:A instanceof u}function b(A,P,k=!0){if(E(A))throw new Error("first arg must be private key");if(!E(P))throw new Error("second arg must be public key");return u.fromHex(P).multiply(l(A)).toRawBytes(k)}const m=e.bits2int||function(A){const P=Ad(A),k=A.length*8-e.nBitLength;return k>0?P>>BigInt(k):P},_=e.bits2int_modN||function(A){return a(m(A))},O=VO(e.nBitLength);function C(A){if(typeof A!="bigint")throw new Error("bigint expected");if(!(Ya<=A&&A<O))throw new Error(`bigint expected < 2^${e.nBitLength}`);return Ep(A,e.nByteLength)}function S(A,P,k=T){if(["recovered","canonical"].some(X=>X in k))throw new Error("sign() legacy options not supported");const{hash:U,randomBytes:x}=e;let{lowS:j,prehash:D,extraEntropy:M}=k;j==null&&(j=!0),A=ji("msgHash",A),D&&(A=ji("prehashed msgHash",U(A)));const L=_(A),H=l(P),z=[C(H),C(L)];if(M!=null){const X=M===!0?x(r.BYTES):M;z.push(ji("extraEntropy",X))}const V=Dy(...z),G=L;function ee(X){const oe=m(X);if(!f(oe))return;const te=c(oe),fe=u.BASE.multiply(oe).toAffine(),Se=a(fe.x);if(Se===Ya)return;const le=a(te*a(G+Se*H));if(le===Ya)return;let we=(fe.x===Se?0:2)|Number(fe.y&di),ve=le;return j&&h(le)&&(ve=p(le),we^=1),new w(Se,ve,we)}return{seed:V,k2sig:ee}}const T={lowS:e.lowS,prehash:!1},N={lowS:e.lowS,prehash:!1};function R(A,P,k=T){const{seed:U,k2sig:x}=S(A,P,k),j=e;return Xq(j.hash.outputLen,j.nByteLength,j.hmac)(U,x)}u.BASE._setWindowSize(8);function B(A,P,k,U=N){var fe;const x=A;if(P=ji("msgHash",P),k=ji("publicKey",k),"strict"in U)throw new Error("options.strict was renamed to lowS");const{lowS:j,prehash:D}=U;let M,L;try{if(typeof x=="string"||x instanceof Uint8Array)try{M=w.fromDER(x)}catch(Se){if(!(Se instanceof Zl.Err))throw Se;M=w.fromCompact(x)}else if(typeof x=="object"&&typeof x.r=="bigint"&&typeof x.s=="bigint"){const{r:Se,s:le}=x;M=new w(Se,le)}else throw new Error("PARSE");L=u.fromHex(k)}catch(Se){if(Se.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(j&&M.hasHighS())return!1;D&&(P=e.hash(P));const{r:H,s:z}=M,V=_(P),G=c(z),ee=a(V*G),X=a(H*G),oe=(fe=u.BASE.multiplyAndAddUnsafe(L,ee,X))==null?void 0:fe.toAffine();return oe?a(oe.x)===H:!1}return{CURVE:e,getPublicKey:v,getSharedSecret:b,sign:R,verify:B,ProjectivePoint:u,Signature:w,utils:I}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function uwe(t){return{hash:t,hmac:(e,...r)=>Bq(t,e,Y0e(...r)),randomBytes:J0e}}function lwe(t,e){const r=n=>cwe({...t,...uwe(n)});return Object.freeze({...r(e),create:r})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const s7=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),G3=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),dwe=BigInt(1),hP=BigInt(2),K3=(t,e)=>(t+e/hP)/e;function fwe(t){const e=s7,r=BigInt(3),n=BigInt(6),s=BigInt(11),i=BigInt(22),o=BigInt(23),a=BigInt(44),c=BigInt(88),u=t*t*t%e,l=u*u*t%e,d=ei(l,r,e)*l%e,f=ei(d,r,e)*l%e,g=ei(f,hP,e)*u%e,h=ei(g,s,e)*g%e,p=ei(h,i,e)*h%e,y=ei(p,a,e)*p%e,w=ei(y,c,e)*y%e,I=ei(w,a,e)*p%e,v=ei(I,r,e)*l%e,E=ei(v,o,e)*h%e,b=ei(E,n,e)*u%e,m=ei(b,hP,e);if(!pP.eql(pP.sqr(m),t))throw new Error("Cannot find square root");return m}const pP=Xbe(s7,void 0,void 0,{sqrt:fwe}),Wc=lwe({a:BigInt(0),b:BigInt(7),Fp:pP,n:G3,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:t=>{const e=G3,r=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-dwe*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),s=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),i=r,o=BigInt("0x100000000000000000000000000000000"),a=K3(i*t,e),c=K3(-n*t,e);let u=gs(t-a*r-c*s,e),l=gs(-a*n-c*i,e);const d=u>o,f=l>o;if(d&&(u=e-u),f&&(l=e-l),u>o||l>o)throw new Error("splitScalar: Endomorphism failed, k="+t);return{k1neg:d,k1:u,k2neg:f,k2:l}}}},jq);BigInt(0);Wc.ProjectivePoint;const Uy="0x0000000000000000000000000000000000000000",Z3="0x0000000000000000000000000000000000000000000000000000000000000000",Y3=BigInt(0),J3=BigInt(1),Q3=BigInt(2),X3=BigInt(27),ek=BigInt(28),Lb=BigInt(35),bf={};function tk(t){return Dd(zn(t),32)}var Th,Ph,Oh,ad;const Ri=class Ri{constructor(e,r,n,s){ne(this,Th);ne(this,Ph);ne(this,Oh);ne(this,ad);C0(e,bf,"Signature"),W(this,Th,r),W(this,Ph,n),W(this,Oh,s),W(this,ad,null)}get r(){return $(this,Th)}
270set r(e){Q(fh(e)===32,"invalid r","value",e),W(this,Th,De(e))}get s(){return $(this,Ph)}set s(e){Q(fh(e)===32,"invalid s","value",e);const r=De(e);Q(parseInt(r.substring(0,3))<8,"non-canonical s","value",r),W(this,Ph,r)}get v(){return $(this,Oh)}set v(e){const r=nt(e,"value");Q(r===27||r===28,"invalid v","v",e),W(this,Oh,r)}get networkV(){return $(this,ad)}get legacyChainId(){const e=this.networkV;return e==null?null:Ri.getChainId(e)}get yParity(){return this.v===27?0:1}get yParityAndS(){const e=Ct(this.s);return this.yParity&&(e[0]|=128),De(e)}get compactSerialized(){return Pr([this.r,this.yParityAndS])}get serialized(){return Pr([this.r,this.s,this.yParity?"0x1c":"0x1b"])}[Symbol.for("nodejs.util.inspect.custom")](){return`Signature { r: "${this.r}", s: "${this.s}", yParity: ${this.yParity}, networkV: ${this.networkV} }`}clone(){const e=new Ri(bf,this.r,this.s,this.v);return this.networkV&&W(e,ad,this.networkV),e}toJSON(){const e=this.networkV;return{_type:"signature",networkV:e!=null?e.toString():null,r:this.r,s:this.s,v:this.v}}static getChainId(e){const r=$e(e,"v");return r==X3||r==ek?Y3:(Q(r>=Lb,"invalid EIP-155 v","v",e),(r-Lb)/Q3)}static getChainIdV(e,r){return $e(e)*Q3+BigInt(35+r-27)}static getNormalizedV(e){const r=$e(e);return r===Y3||r===X3?27:r===J3||r===ek?28:(Q(r>=Lb,"invalid v","v",e),r&J3?27:28)}static from(e){function r(u,l){Q(u,l,"signature",e)}if(e==null)return new Ri(bf,Z3,Z3,27);if(typeof e=="string"){const u=Ct(e,"signature");if(u.length===64){const l=De(u.slice(0,32)),d=u.slice(32,64),f=d[0]&128?28:27;return d[0]&=127,new Ri(bf,l,De(d),f)}if(u.length===65){const l=De(u.slice(0,32)),d=u.slice(32,64);r((d[0]&128)===0,"non-canonical s");const f=Ri.getNormalizedV(u[64]);return new Ri(bf,l,De(d),f)}r(!1,"invalid raw signature length")}if(e instanceof Ri)return e.clone();const n=e.r;r(n!=null,"missing r");const s=tk(n),i=function(u,l){if(u!=null)return tk(u);if(l!=null){r(zt(l,32),"invalid yParityAndS");const d=Ct(l);return d[0]&=127,De(d)}r(!1,"missing s")}(e.s,e.yParityAndS);r((Ct(i)[0]&128)==0,"non-canonical s");const{networkV:o,v:a}=function(u,l,d){if(u!=null){const f=$e(u);return{networkV:f>=Lb?f:void 0,v:Ri.getNormalizedV(f)}}if(l!=null)return r(zt(l,32),"invalid yParityAndS"),{v:Ct(l)[0]&128?28:27};if(d!=null){switch(nt(d,"sig.yParity")){case 0:return{v:27};case 1:return{v:28}}r(!1,"invalid yParity")}r(!1,"missing v")}(e.v,e.yParityAndS,e.yParity),c=new Ri(bf,s,i,a);return o&&W(c,ad,o),r(e.yParity==null||nt(e.yParity,"sig.yParity")===c.yParity,"yParity mismatch"),r(e.yParityAndS==null||e.yParityAndS===c.yParityAndS,"yParityAndS mismatch"),c}};Th=new WeakMap,Ph=new WeakMap,Oh=new WeakMap,ad=new WeakMap;let Yi=Ri;var La;const Ml=class Ml{constructor(e){ne(this,La);
270Q(fh(e)===32,"invalid private key","privateKey","[REDACTED]"),W(this,La,De(e))}get privateKey(){return $(this,La)}get publicKey(){return Ml.computePublicKey($(this,La))}get compressedPublicKey(){return Ml.computePublicKey($(this,La),!0)}sign(e){Q(fh(e)===32,"invalid digest length","digest",e);const r=Wc.sign(Hn(e),Hn($(this,La)),{lowS:!0});return Yi.from({r:ju(r.r,32),s:ju(r.s,32),v:r.recovery?28:27})}computeSharedSecret(e){const r=Ml.computePublicKey(e);return De(Wc.getSharedSecret(Hn($(this,La)),Ct(r),!1))}static computePublicKey(e,r){let n=Ct(e,"key");if(n.length===32){const i=Wc.getPublicKey(n,!!r);return De(i)}if(n.length===64){const i=new Uint8Array(65);i[0]=4,i.set(n,1),n=i}const s=Wc.ProjectivePoint.fromHex(n);return De(s.toRawBytes(r))}static recoverPublicKey(e,r){Q(fh(e)===32,"invalid digest length","digest",e);const n=Yi.from(r);let s=Wc.Signature.fromCompact(Hn(Pr([n.r,n.s])));s=s.addRecoveryBit(n.yParity);const i=s.recoverPublicKey(Hn(e));return Q(i!=null,"invalid signautre for digest","signature",r),"0x"+i.toHex(!1)}static addPoints(e,r,n){const s=Wc.ProjectivePoint.fromHex(Ml.computePublicKey(e).substring(2)),i=Wc.ProjectivePoint.fromHex(Ml.computePublicKey(r).substring(2));return"0x"+s.add(i).toHex(!!n)}};La=new WeakMap;let My=Ml;const hwe=BigInt(0),pwe=BigInt(36);function rk(t){t=t.toLowerCase();const e=t.substring(2).split(""),r=new Uint8Array(40);for(let s=0;s<40;s++)r[s]=e[s].charCodeAt(0);const n=Ct(Br(r));for(let s=0;s<40;s+=2)n[s>>1]>>4>=8&&(e[s]=e[s].toUpperCase()),(n[s>>1]&15)>=8&&(e[s+1]=e[s+1].toUpperCase());return"0x"+e.join("")}const GO={};for(let t=0;t<10;t++)GO[String(t)]=String(t);for(let t=0;t<26;t++)GO[String.fromCharCode(65+t)]=String(10+t);const nk=15;function gwe(t){t=t.toUpperCase(),t=t.substring(4)+t.substring(0,2)+"00";let e=t.split("").map(n=>GO[n]).join("");for(;e.length>=nk;){let n=e.substring(0,nk);e=parseInt(n,10)%97+e.substring(n.length)}let r=String(98-parseInt(e,10)%97);for(;r.length<2;)r="0"+r;return r}const mwe=function(){const t={};for(let e=0;e<36;e++){const r="0123456789abcdefghijklmnopqrstuvwxyz"[e];t[r]=BigInt(e)}return t}();function ywe(t){t=t.toLowerCase();let e=hwe;for(let r=0;r<t.length;r++)e=e*pwe+mwe[t[r]];return e}function Dt(t){if(Q(typeof t=="string","invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/)){t.startsWith("0x")||(t="0x"+t);const e=rk(t);return Q(!t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)||e===t,"bad address checksum","address",t),e}if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){Q(t.substring(2,4)===gwe(t),"bad icap checksum","address",t);let e=ywe(t.substring(4)).toString(16);for(;e.length<40;)e="0"+e;return rk("0x"+e)}Q(!1,"invalid address","address",t)}function bwe(t){const e=Dt(t.from);let n=$e(t.nonce,"tx.nonce").toString(16);return n==="0"?n="0x":n.length%2?n="0x0"+n:n="0x"+n,Dt(Er(Br(Ud([e,n])),12))}function i7(t){return t&&typeof t.getAddress=="function"}async function ZI(t,e){const r=await e;return(r==null||r==="0x0000000000000000000000000000000000000000")&&(ue(typeof t!="string","unconfigured name","UNCONFIGURED_NAME",{value:t}),Q(!1,"invalid AddressLike value; did not resolve to a value address","target",t)),Dt(r)}function Vn(t,e){if(typeof t=="string")return t.match(/^0x[0-9a-f]{40}$/i)?Dt(t):(ue(e!=null,"ENS resolution requires a provider","UNSUPPORTED_OPERATION",{operation:"resolveName"}),ZI(t,e.resolveName(t)));if(i7(t))return ZI(t,t.getAddress());if(t&&typeof t.then=="function")return ZI(t,t);Q(!1,"unsupported addressable value","target",t)}const xa={};function ke(t,e){let r=!1;return e<0&&(r=!0,e*=-1),new On(xa,`${r?"":"u"}int${e}`,t,{signed:r,width:e})}function Tt(t,e){return new On(xa,`bytes${e||""}`,t,{size:e})}const sk=Symbol.for("_ethers_typed");var cd;const Ra=class Ra{constructor(e,r,n,s){K(this,"type");K(this,"value");ne(this,cd);K(this,"_typedSymbol");s==null&&(s=null),C0(xa,e,"Typed"),Ge(this,{_typedSymbol:sk,type:r,value:n}),W(this,cd,s),this.format()}format(){if(this.type==="array")throw new Error("");if(this.type==="dynamicArray")throw new Error("");return this.type==="tuple"?`tuple(${this.value.map(e=>e.format()).join(",")}
270)`:this.type}defaultValue(){return 0}minValue(){return 0}maxValue(){return 0}isBigInt(){return!!this.type.match(/^u?int[0-9]+$/)}isData(){return this.type.startsWith("bytes")}isString(){return this.type==="string"}get tupleName(){if(this.type!=="tuple")throw TypeError("not a tuple");return $(this,cd)}get arrayLength(){if(this.type!=="array")throw TypeError("not an array");return $(this,cd)===!0?-1:$(this,cd)===!1?this.value.length:null}static from(e,r){return new Ra(xa,e,r)}static uint8(e){return ke(e,8)}static uint16(e){return ke(e,16)}static uint24(e){return ke(e,24)}static uint32(e){return ke(e,32)}static uint40(e){return ke(e,40)}static uint48(e){return ke(e,48)}static uint56(e){return ke(e,56)}static uint64(e){return ke(e,64)}static uint72(e){return ke(e,72)}static uint80(e){return ke(e,80)}static uint88(e){return ke(e,88)}static uint96(e){return ke(e,96)}static uint104(e){return ke(e,104)}static uint112(e){return ke(e,112)}static uint120(e){return ke(e,120)}static uint128(e){return ke(e,128)}static uint136(e){return ke(e,136)}static uint144(e){return ke(e,144)}static uint152(e){return ke(e,152)}static uint160(e){return ke(e,160)}static uint168(e){return ke(e,168)}static uint176(e){return ke(e,176)}static uint184(e){return ke(e,184)}static uint192(e){return ke(e,192)}static uint200(e){return ke(e,200)}static uint208(e){return ke(e,208)}static uint216(e){return ke(e,216)}static uint224(e){return ke(e,224)}static uint232(e){return ke(e,232)}static uint240(e){return ke(e,240)}static uint248(e){return ke(e,248)}static uint256(e){return ke(e,256)}static uint(e){return ke(e,256)}static int8(e){return ke(e,-8)}static int16(e){return ke(e,-16)}static int24(e){return ke(e,-24)}static int32(e){return ke(e,-32)}static int40(e){return ke(e,-40)}static int48(e){return ke(e,-48)}static int56(e){return ke(e,-56)}static int64(e){return ke(e,-64)}static int72(e){return ke(e,-72)}static int80(e){return ke(e,-80)}static int88(e){return ke(e,-88)}static int96(e){return ke(e,-96)}static int104(e){return ke(e,-104)}static int112(e){return ke(e,-112)}static int120(e){return ke(e,-120)}static int128(e){return ke(e,-128)}static int136(e){return ke(e,-136)}static int144(e){return ke(e,-144)}static int152(e){return ke(e,-152)}static int160(e){return ke(e,-160)}static int168(e){return ke(e,-168)}static int176(e){return ke(e,-176)}static int184(e){return ke(e,-184)}static int192(e){return ke(e,-192)}static int200(e){return ke(e,-200)}static int208(e){return ke(e,-208)}static int216(e){return ke(e,-216)}static int224(e){return ke(e,-224)}static int232(e){return ke(e,-232)}static int240(e){return ke(e,-240)}static int248(e){return ke(e,-248)}static int256(e){return ke(e,-256)}static int(e){return ke(e,-256)}static bytes1(e){return Tt(e,1)}static bytes2(e){return Tt(e,2)}static bytes3(e){return Tt(e,3)}static bytes4(e){return Tt(e,4)}static bytes5(e){return Tt(e,5)}static bytes6(e){return Tt(e,6)}static bytes7(e){return Tt(e,7)}static bytes8(e){return Tt(e,8)}static bytes9(e){return Tt(e,9)}static bytes10(e){return Tt(e,10)}static bytes11(e){return Tt(e,11)}static bytes12(e){return Tt(e,12)}static bytes13(e){return Tt(e,13)}static bytes14(e){return Tt(e,14)}static bytes15(e){return Tt(e,15)}static bytes16(e){return Tt(e,16)}static bytes17(e){return Tt(e,17)}static bytes18(e){return Tt(e,18)}static bytes19(e){return Tt(e,19)}static bytes20(e){return Tt(e,20)}static bytes21(e){return Tt(e,21)}static bytes22(e){return Tt(e,22)}static bytes23(e){return Tt(e,23)}static bytes24(e){return Tt(e,24)}static bytes25(e){return Tt(e,25)}static bytes26(e){return Tt(e,26)}static bytes27(e){return Tt(e,27)}static bytes28(e){return Tt(e,28)}static bytes29(e){return Tt(e,29)}static bytes30(e){return Tt(e,30)}static bytes31(e){return Tt(e,31)}static bytes32(e){return Tt(e,32)}static address(e){return new Ra(xa,"address",e)}static bool(e){return new Ra(xa,"bool",!!e)}static bytes(e){return new Ra(xa,"bytes",e)}static string(e){return new Ra(xa,"string",e)}static array(e,r){throw new Error("not implemented yet")}static tuple(e,r){throw new Error("not implemented yet")}static overrides(e){return new Ra(xa,"overrides",Object.assign({},e))}static isTyped(e){return e&&typeof e=="object"&&"_typedSymbol"in e&&e._typedSymbol===sk}static dereference(e,r){if(Ra.isTyped(e)){if(e.type!==r)throw new Error(`invalid type: expecetd ${r}, got ${e.type}`);return e.value}return e}};cd=new WeakMap;let On=Ra;class wwe extends dc{constructor(e){super("address","address",e,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(e,r){let n=On.dereference(r,"string");try{n=Dt(n)}catch(s){return this._throwError(s.message,r)}return e.writeValue(n)}decode(e){return Dt(ju(e.readValue(),20))}}class Ewe extends dc{constructor(r){super(r.name,r.type,"_",r.dynamic);K(this,"coder");
270this.coder=r}defaultValue(){return this.coder.defaultValue()}encode(r,n){return this.coder.encode(r,n)}decode(r){return this.coder.decode(r)}}function o7(t,e,r){let n=[];if(Array.isArray(r))n=r;else if(r&&typeof r=="object"){let c={};n=e.map(u=>{const l=u.localName;return ue(l,"cannot encode object for signature with missing names","INVALID_ARGUMENT",{argument:"values",info:{coder:u},value:r}),ue(!c[l],"cannot encode object for signature with duplicate names","INVALID_ARGUMENT",{argument:"values",info:{coder:u},value:r}),c[l]=!0,r[l]})}else Q(!1,"invalid tuple value","tuple",r);Q(e.length===n.length,"types/value length mismatch","tuple",r);let s=new aP,i=new aP,o=[];e.forEach((c,u)=>{let l=n[u];if(c.dynamic){let d=i.length;c.encode(i,l);let f=s.writeUpdatableValue();o.push(g=>{f(g+d)})}else c.encode(s,l)}),o.forEach(c=>{c(s.length)});let a=t.appendWriter(s);return a+=t.appendWriter(i),a}function a7(t,e){let r=[],n=[],s=t.subReader(0);return e.forEach(i=>{let o=null;if(i.dynamic){let a=t.readIndex(),c=s.subReader(a);try{o=i.decode(c)}catch(u){if(Pn(u,"BUFFER_OVERRUN"))throw u;o=u,o.baseType=i.name,o.name=i.localName,o.type=i.type}}else try{o=i.decode(t)}catch(a){if(Pn(a,"BUFFER_OVERRUN"))throw a;o=a,o.baseType=i.name,o.name=i.localName,o.type=i.type}if(o==null)throw new Error("investigate");r.push(o),n.push(i.localName||null)}),mp.fromItems(r,n)}class vwe extends dc{constructor(r,n,s){const i=r.type+"["+(n>=0?n:"")+"]",o=n===-1||r.dynamic;super("array",i,s,o);K(this,"coder");K(this,"length");Ge(this,{coder:r,length:n})}defaultValue(){const r=this.coder.defaultValue(),n=[];for(let s=0;s<this.length;s++)n.push(r);return n}encode(r,n){const s=On.dereference(n,"array");Array.isArray(s)||this._throwError("expected array value",s);let i=this.length;i===-1&&(i=s.length,r.writeValue(s.length)),pq(s.length,i,"coder array"+(this.localName?" "+this.localName:""));let o=[];for(let a=0;a<s.length;a++)o.push(this.coder);return o7(r,o,s)}decode(r){let n=this.length;n===-1&&(n=r.readIndex(),ue(n*Wn<=r.dataLength,"insufficient data length","BUFFER_OVERRUN",{buffer:r.bytes,offset:n*Wn,length:r.dataLength}));let s=[];for(let i=0;i<n;i++)s.push(new Ewe(this.coder));return a7(r,s)}}class _we extends dc{constructor(e){super("bool","bool",e,!1)}defaultValue(){return!1}encode(e,r){const n=On.dereference(r,"bool");return e.writeValue(n?1:0)}decode(e){return!!e.readValue()}}class c7 extends dc{constructor(e,r){super(e,e,r,!0)}defaultValue(){return"0x"}encode(e,r){r=Hn(r);let n=e.writeValue(r.length);return n+=e.writeBytes(r),n}decode(e){return e.readBytes(e.readIndex(),!0)}}class Awe extends c7{constructor(e){super("bytes",e)}decode(e){return De(super.decode(e))}}class Cwe extends dc{constructor(r,n){let s="bytes"+String(r);super(s,s,n,!1);K(this,"size");Ge(this,{size:r},{size:"number"})}defaultValue(){return"0x0000000000000000000000000000000000000000000000000000000000000000".substring(0,2+this.size*2)}encode(r,n){let s=Hn(On.dereference(n,this.type));return s.length!==this.size&&this._throwError("incorrect data length",n),r.writeBytes(s)}decode(r){return De(r.readBytes(this.size))}}const Iwe=new Uint8Array([]);class Swe extends dc{constructor(e){super("null","",e,!1)}defaultValue(){return null}encode(e,r){return r!=null&&this._throwError("not null",r),e.writeBytes(Iwe)}decode(e){return e.readBytes(0),null}}const Twe=BigInt(0),Pwe=BigInt(1),Owe=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");class Nwe extends dc{constructor(r,n,s){const i=(n?"int":"uint")+r*8;super(i,i,s,!1);K(this,"size");K(this,"signed");Ge(this,{size:r,signed:n},{size:"number",signed:"boolean"})}defaultValue(){return 0}encode(r,n){let s=$e(On.dereference(n,this.type)),i=Kl(Owe,Wn*8);if(this.signed){let o=Kl(i,this.size*8-1);(s>o||s<-(o+Pwe))&&this._throwError("value out-of-bounds",n),s=yq(s,8*Wn)}else(s<Twe||s>Kl(i,this.size*8))&&this._throwError("value out-of-bounds",n);return r.writeValue(s)}decode(r){let n=Kl(r.readValue(),this.size*8);return this.signed&&(n=cA(n,this.size*8)),n}}class xwe extends c7{constructor(e){super("string",e)}defaultValue(){return""}encode(e,r){return super.encode(e,Fo(On.dereference(r,"string")))}decode(e){return uA(super.decode(e))}}class Fb extends dc{constructor(r,n){let s=!1;const i=[];r.forEach(a=>{a.dynamic&&(s=!0),i.push(a.type)});const o="tuple("+i.join(",")+")";super("tuple",o,n,s);K(this,"coders");Ge(this,{coders:Object.freeze(r.slice())})}defaultValue(){const r=[];
270this.coders.forEach(s=>{r.push(s.defaultValue())});const n=this.coders.reduce((s,i)=>{const o=i.localName;return o&&(s[o]||(s[o]=0),s[o]++),s},{});return this.coders.forEach((s,i)=>{let o=s.localName;!o||n[o]!==1||(o==="length"&&(o="_length"),r[o]==null&&(r[o]=r[i]))}),Object.freeze(r)}encode(r,n){const s=On.dereference(n,"tuple");return o7(r,this.coders,s)}decode(r){return a7(r,this.coders)}}function Md(t){return Br(Fo(t))}var Rwe="AEEUdwmgDS8BxQKKAP4BOgDjATAAngDUAIMAoABoAOAAagCOAEQAhABMAHIAOwA9ACsANgAmAGIAHgAuACgAJwAXAC0AGgAjAB8ALwAUACkAEgAeAAkAGwARABkAFgA5ACgALQArADcAFQApABAAHgAiABAAGgAeABMAGAUhBe8BFxREN8sF2wC5AK5HAW8ArQkDzQCuhzc3NzcBP68NEfMABQdHBuw5BV8FYAA9MzkI9r4ZBg7QyQAWA9CeOwLNCjcCjqkChuA/lm+RAsXTAoP6ASfnEQDytQFJAjWVCkeXAOsA6godAB/cwdAUE0WlBCN/AQUCQRjFD/MRBjHxDQSJbw0jBzUAswBxme+tnIcAYwabAysG8QAjAEMMmxcDqgPKQyDXCMMxA7kUQwD3NXOrAKmFIAAfBC0D3x4BJQDBGdUFAhEgVD8JnwmQJiNWYUzrg0oAGwAUAB0AFnNcACkAFgBP9h3gPfsDOWDKneY2ChglX1UDYD30ABsAFAAdABZzIGRAnwDD8wAjAEEMzRbDqgMB2sAFYwXqAtCnAsS4AwpUJKRtFHsadUz9AMMVbwLpABM1NJEX0ZkCgYMBEyMAxRVvAukAEzUBUFAtmUwSAy4DBTER33EftQHfSwB5MxJ/AjkWKQLzL8E/cwBB6QH9LQDPDtO9ASNriQC5DQANAwCK21EFI91zHwCoL9kBqQcHBwcHKzUDowBvAQohPvU3fAQgHwCyAc8CKQMA5zMSezr7ULgFmDp/LzVQBgEGAi8FYQVgt8AFcTtlQhpCWEmfe5tmZ6IAExsDzQ8t+X8rBKtTAltbAn0jsy8Bl6utPWMDTR8Ei2kRANkDBrNHNysDBzECQWUAcwFpJ3kAiyUhAJ0BUb8AL3EfAbfNAz81KUsFWwF3YQZtAm0A+VEfAzEJDQBRSQCzAQBlAHsAM70GD/v3IZWHBwARKQAxALsjTwHZAeMPEzmXgIHwABIAGQA8AEUAQDt3gdvIEGcQZAkGTRFMdEIVEwK0D64L7REdDNkq09PgADSxB/MDWwfzA1sDWwfzB/MDWwfzA1sDWwNbA1scEvAi28gQZw9QBHUFlgWTBN4IiyZREYkHMAjaVBV0JhxPA00BBCMtSSQ7mzMTJUpMFE0LCAQ2SmyvfUADTzGzVP2QqgPTMlc5dAkGHnkSqAAyD3skNb1OhnpPcagKU0+2tYdJak5vAsY6sEAACikJm2/Dd1YGRRAfJ6kQ+ww3AbkBPw3xS9wE9QY/BM0fgRkdD9GVoAipLeEM8SbnLqWAXiP5KocF8Uv4POELUVFsD10LaQnnOmeBUgMlAREijwrhDT0IcRD3Cs1vDekRSQc9A9lJngCpBwULFR05FbkmFGKwCw05ewb/GvoLkyazEy17AAXXGiUGUQEtGwMA0y7rhbRaNVwgT2MGBwspI8sUrFAkDSlAu3hMGh8HGSWtApVDdEqLUToelyH6PEENai4XUYAH+TwJGVMLhTyiRq9FEhHWPpE9TCJNTDAEOYMsMyePCdMPiQy9fHYBXQklCbUMdRM1ERs3yQg9Bx0xlygnGQglRplgngT7owP3E9UDDwVDCUUHFwO5HDETMhUtBRGBKNsC9zbZLrcCk1aEARsFzw8pH+MQVEfkDu0InwJpA4cl7wAxFSUAGyKfCEdnAGOP3FMJLs8Iy2pwI3gDaxTrZRF3B5UOWwerHDcVwxzlcMxeD4YMKKezCV8BeQmdAWME5wgNNV+MpCBFZ1eLXBifIGVBQ14AAjUMaRWjRMGHfAKPD28SHwE5AXcHPQ0FAnsR8RFvEJkI74YINbkz/DopBFMhhyAVCisDU2zSCysm/Qz8bQGnEmYDEDRBd/Jnr2C6KBgBBx0yyUFkIfULlk/RDKAaxRhGVDIZ6AfDA/ca9yfuQVsGAwOnBxc6UTPyBMELbQiPCUMATQ6nGwfbGG4KdYzUATWPAbudA1uVhwJzkwY7Bw8Aaw+LBX3pACECqwinAAkA0wNbAD0CsQehAB0AiUUBQQMrMwEl6QKTA5cINc8BmTMB9y0EH8cMGQD7O25OAsO1AoBuZqYF4VwCkgJNOQFRKQQJUktVA7N15QDfAE8GF+NLARmvTs8e50cB43MvAMsA/wAJOQcJRQHRAfdxALsBYws1Caa3uQFR7S0AhwAZbwHbAo0A4QA5AIP1AVcAUQVd/QXXAlNNARU1HC9bZQG/AyMBNwERAH0Gz5GpzQsjBHEH1wIQHxXlAu8yB7kFAyLjE9FCyQK94lkAMhoKPAqrCqpgX2Q3CjV2PVQAEh+sPss/UgVVO1c7XDtXO1w7VztcO1c7XDtXO1wDm8Pmw+YKcF9JYe8Mqg3YRMw6TRPfYFVgNhPMLbsUxRXSJVoZQRrAJwkl6FUNDwgt12Y0CDA0eRfAAEMpbINFY4oeNApPHOtTlVT8LR8AtUumM7MNsBsZREQFS3XxYi4WEgomAmSFAmJGX1GzAV83JAKh+wJonAJmDQKfiDgfDwJmPwJmKgRyBIMDfxcDfpY5Cjl7GzmGOicnAmwhAjI6OA4CbcsCbbLzjgM3a0kvAWsA4gDlAE4JB5wMkQECD8YAEbkCdzMCdqZDAnlPRwJ4viFg30WyRvcCfEMCeswCfQ0CfPRIBEiBZygALxlJXEpfGRtK0ALRBQLQ0EsrA4hTA4fqRMmRNgLypV0HAwOyS9JMMSkH001QTbMCi0MCitzFHwshR2sJuwKOOwKOYESbhQKO3QKOYHxRuFM5AQ5S2FSJApP/ApMQAO0AIFUiVbNV1AosHymZijLleGpFPz0Cl6MC77ZYJawAXSkClpMCloCgAK1ZsFoNhVEAPwKWuQKWUlxIXNUCmc8CmWhczl0LHQKcnznGOqECnBoCn58CnryOACETNS4TAp31Ap6WALlBYThh8wKe1wKgcgGtAp6jIwKeUqljzGQrKS8CJ7MCJoICoP8CoFDbAqYzAqXSAqgDAIECp/ZogGi1AAdNaiBq1QKs5wKssgKtawKtBgJXIQJV4AKx5dsDH1JsmwKywRECsuwbbORtZ21MYwMl0QK2YD9DbpQDKUkCuGICuUsZArkue3A6cOUCvR0DLbYDMhUCvoxyBgMzdQK+HnMmc1MCw88CwwhzhnRPOUl05AM8qwEDPJ4DPcMCxYACxksCxhSNAshtVQLISALJUwLJMgJkoQLd1nh9ZXiyeSlL1AMYp2cGAmH4GfeVKHsPXpZevxUCz28Cz3AzT1fW9xejAMqxAs93AS3uA04Wfk8JAtwrAtuOAtJTA1JgA1NjAQUDVZCAjUMEzxrxZEl5A4LSg5EC2ssC2eKEFIRNp0ADhqkAMwNkEoZ1Xf0AWQLfaQLevHd7AuIz7RgB8zQrAfSfAfLWiwLr9wLpdH0DAur9AuroAP1LAb0C7o0C66CWrpcHAu5DA4XkmH1w5HGlAvMHAG0DjhqZlwL3FwORcgOSiwL3nAL53QL4apogmq+/O5siA52HAv7+AR8APZ8gAZ+3AwWRA6ZuA6bdANXJAwZuoYyiCQ0DDE0BEwEjB3EGZb1rCQC/BG/DFY8etxEAG3k9ACcDNxJRA42DAWcrJQCM8wAlAOanC6OVCLsGI6fJBgCvBRnDBvElRUYFFoAFcD9GSDNCKUK8X3kZX8QAls0FOgCQVCGbwTsuYDoZutcONxjOGJHJ/gVfBWAFXwVgBWsFYAVfBWAFXwVgBV8FYAVfBWBOHQjfjW8KCgoKbF7xMwTRA7kGN8PDAMMEr8MA70gxFroFTj5xPnhCR0K+X30/X/AAWBkzswCNBsxzzASm70aCRS4rDDMeLz49fnXfcsH5GcoscQFz13Y4HwVnBXLJycnACNdRYwgICAqEXoWTxgA7P4kAC
270xbZBu21Kw0AjMsTAwkVAOVtJUUsJ1JCuULESUArXy9gPi9AKwnJRQYKTD9LPoA+iT54PnkCkULEUUpDX9NWV3JVEjQAc1w3A3IBE3YnX+g7QiMJb6MKaiszRCUuQrNCxDPMCcwEX9EWJzYREBEEBwIHKn6l33JCNVIfybPJtAltydPUCmhBZw/tEKsZAJOVJU1CLRuxbUHOQAo7P0s+eEJHHA8SJVRPdGM0NVrpvBoKhfUlM0JHHGUQUhEWO1xLSj8MO0ucNAqJIzVCRxv9EFsqKyA4OQgNj2nwZgp5ZNFgE2A1K3YHS2AhQQojJmC7DgpzGG1WYFUZCQYHZO9gHWCdYIVgu2BTYJlwFh8GvRbcXbG8YgtDHrMBwzPVyQonHQgkCyYBgQJ0Ajc4nVqIAwGSCsBPIgDsK3SWEtIVBa5N8gGjAo+kVwVIZwD/AEUSCDweX4ITrRQsJ8K3TwBXFDwEAB0TvzVcAtoTS20RIwDgVgZ9BBImYgA5AL4Coi8LFnezOkCnIQFjAY4KBAPh9RcGsgZSBsEAJctdsWIRu2kTkQstRw7DAcMBKgpPBGIGMDAwKCYnKTQaLg4AKRSVAFwCdl+YUZ0JdicFD3lPAdt1F9ZZKCGxuE3yBxkFVGcA/wBFEgiCBwAOLHQSjxOtQDg1z7deFRMAZ8QTAGtKb1ApIiPHADkAvgKiLy1DFtYCmBiDAlDDWNB0eo7fpaMO/aEVRRv0ATEQZBIODyMEAc8JQhCbDRgzFD4TAEMAu9YBCgCsAOkAm5I3ABwAYxvONnR+MhXJAxgKQyxL2+kkJhMbhQKDBMkSsvF0AD9BNQ6uQC7WqSQHwxEAEEIu1hkhAH2z4iQPwyJPHNWpdyYBRSpnJALzoBAEVPPsH20MxA0CCEQKRgAFyAtFAlMNwwjEDUQJRArELtapMg7DDZgJIw+TGukEIwvDFkMAqAtDEMMMBhioe+QAO3MMRAACrgnEBSPY9Q0FDnbSBoMAB8MSYxkSxAEJAPIJAAB8FWMOFtMc/HcXwxhDAC7DAvOowwAewwJdKDKHAAHDAALrFUQVwwAbwyvzpWMWv8wA/ABpAy++bcYDUKPD0KhDCwKmJ1MAAmMA5+UZwxAagwipBRL/eADfw6fDGOMCGsOjk3l6BwOpo4sAEsMOGxMAA5sAbcMOAAvDp0MJGkMDwgipnNIPAwfIqUMGAOGDAAPzABXDAAcDAAnDAGmTABrDAA7DChjDjnEWAwABYwAOcwAuUyYABsMAF8MIKQANUgC6wy4AA8MADqMq8wCyYgAcIwAB8wqpAAXOCx0V4wAHowBCwwEKAGnDAAuDAB3DAAjDCakABdIAbqcZ3QCZCCkABdIAAAFDAAfjAB2jCCkABqIACYMAGzMAbSMA5sOIAAhjAAhDABTDBAkpAAbSAOOTAAlDC6kOzPtnAAdDAG6kQFAATwAKwwwAA0MACbUDPwAHIwAZgwACE6cDAAojAApDAAoDp/MGwwAJIwADEwAQQwgAFEMAEXMAD5MADfMADcMAGRMOFiMAFUMAbqMWuwHDAMIAE0MLAGkzEgDhUwACQwAEWgAXgwUjAAbYABjDBSYBgzBaAEFNALcQBxUMegAwMngBrA0IZgJ0KxQHBREPd1N0ZzKRJwaIHAZqNT4DqQq8BwngAB4DAwt2AX56T1ocKQNXAh1GATQGC3tOxYNagkgAMQA5CQADAQEAWxLjAIOYNAEzAH7tFRk6TglSAF8NAAlYAQ+S1ACAQwQorQBiAN4dAJ1wPyeTANVzuQDX3AIeEMp9eyMgXiUAEdkBkJizKltbVVAaRMqRAAEAhyQ/SDEz6BmfVwB6ATEsOClKIRcDOF0E/832AFNt5AByAnkCRxGCOs94NjXdAwINGBonDBwPALW2AwICAgAAAAAAAAYDBQMDARrUAwAtAAAAAgEGBgYGBgYFBQUFBQUEBQYHCAkEBQUFBQQAAAICAAAAIgCNAJAAlT0A6gC7ANwApEQAwgCyAK0AqADuAKYA2gCjAOcBCAEDAMcAgQBiANIA1AEDAN4A8gCQAKkBMQDqAN8A3AsBCQ8yO9ra2tq8xuLT1tRJOB0BUgFcNU0BWgFpAWgBWwFMUUlLbhMBUxsNEAs6PhMOACcUKy0vMj5AQENDQ0RFFEYGJFdXV1dZWVhZL1pbXVxcI2NnZ2ZoZypsbnZ1eHh4eHh4enp6enp6enp6enp8fH18e2IARPIASQCaAHgAMgBm+ACOAFcAVwA3AnbvAIsABfj4AGQAk/IAnwBPAGIAZP//sACFAIUAaQBWALEAJAC2AIMCQAJDAPwA5wD+AP4A6AD/AOkA6QDoAOYALwJ7AVEBQAE+AVQBPgE+AT4BOQE4ATgBOAEcAVgXADEQCAEAUx8SHgsdHhYAjgCWAKYAUQBqIAIxAHYAbwCXAxUDJzIDIUlGTzEAkQJPAMcCVwKkAMAClgKWApYClgKWApYCiwKWApYClgKWApYClgKVApUCmAKgApcClgKWApQClAKUApQCkgKVAnUB1AKXAp8ClgKWApUeAIETBQD+DQOfAmECOh8BVBg9AuIZEjMbAU4/G1WZAXusRAFpYQEFA0FPAQYAmTEeIJdyADFoAHEANgCRA5zMk/C2jGINwjMWygIZCaXdfDILBCs5dAE7YnQBugDlhoiHhoiGiYqKhouOjIaNkI6Ij4qQipGGkoaThpSSlYaWhpeKmIaZhpqGm4aci52QnoqfhuIC4XTpAt90AIp0LHSoAIsAdHQEQwRABEIERQRDBEkERgRBBEcESQRIBEQERgRJAJ5udACrA490ALxuAQ10ANFZdHQA13QCFHQA/mJ0AP4BIQD+APwA/AD9APwDhGZ03ASMK23HAP4A/AD8AP0A/CR0dACRYnQA/gCRASEA/gCRAvQA/gCRA4RmdNwEjCttxyR0AP9idAEhAP4A/gD8APwA/QD8AP8A/AD8AP0A/AOEZnTcBIwrbcckdHQAkWJ0ASEA/gCRAP4AkQL0AP4AkQOEZnTcBIwrbcckdAJLAT50AlIBQXQCU8l0dAJfdHQDpgL0A6YDpgOnA6cDpwOnA4RmdNwEjCttxyR0dACRYnQBIQOmAJEDpgCRAvQDpgCRA4RmdNwEjCttxyR0BDh0AJEEOQCRDpU5dSgCADR03gV2CwArdAEFAM5iCnR0AF1iAAYcOgp0dACRCnQAXAEIwWZ0CnRmdHQAkWZ0CnRmdEXgAFF03gp0dEY0tlT2u3SOAQTwscwhjZZKrhYcBSfFp9XNbKiVDOD2b+cpe4/Z17mQnbtzzhaeQtE2GGj0IDNTjRUSyTxxw/RPHW/+vS7d1NfRt9z9QPZg4X7QFfhCnkvgNPIItOsC2eV6hPannZNHlZ9xrwZXIMOlu3jSoQSq78WEjwLjw1ELSlF1aBvfzwk5ZX7AUvQzjPQKbDuQ+sm4wNOp4A6AdVuRS0t1y/DZpg4R6m7FNjM9HgvW7Bi88zaMjOo6lM8wtBBdj8LP4ylv3zCXPhebMKJc066o9sF71oFW/8JXu86HJbwDID5lzw5GWLR/LhT0Qqnp2JQxNZNfcbLIzPy+YypqRm/lBmGmex+82+PisxUumSeJkALIT6rJezxMH+CTJmQtt5uwTVbL3ptmjDUQzlSIvWi8Tl7ng1NpuRn1Ng4n14Qc+3Iil7OwkvNWogLSPkn3pihIFytyIGmMhOe3n1tWsuMy9BdKyqF4Z3v2SgggTL9KVvMXPnCbRe+oOuFFP3HejBG/w9gvmfNYvg6JuWia2lcSSN1uIjBktzoIazOHPJZ7kKHPz8mRWVdW3lA8WGF9dQF6Bm673boov3BUWDU2JNcahR23GtfHKLOz/viZ+rYnZFaIznXO67CYEJ1fXuTRpZhYZkKe54xeoagkNGLs+NTZHE0rX45/XvQ2RGADX6vcAvdxIUBV27wxGm2zjZo4X3ILgAlrOFheuZ6wtsvaIj4yLY7qqawlliaIcrz2G+c3vscAnCkCuMzMmZvMfu9lLwTvfX+3cVSyPdN9ZwgDZhfjRgNJcLiJ67b9xx8JHswprbiE3v9UphotAPIgnXVIN5KmMc0piXhc6cChPnN+MRhG9adtdttQTTwSIpl8I4/j//d3sz1326qTBTpPRM/Hgh3kzqEXs8ZAk4ErQhNO8hzrQ0DLkWMA/N+91tn2MdOJnWC2FCZehkQrwzwbKOjhvZsbM95QoeL9skYyMf4srVPVJSgg7pOLUtr/n9eT99oe9nLtFRpjA9okV2Kj8h9k5HaC0oivRD8VyXkJ81tcd4fHNXPCfloIQasxsuO18/46
270dR2jgul/UIet2G0kRvnyONMKhHs6J26FEoqSqd+rfYjeEGwHWVDpX1fh1jBBcKGMqRepju9Y00mDVHC+Xdij/j44rKfvfjGinNs1jO/0F3jB83XCDINN/HB84axlP+3E/klktRo+vl3U/aiyMJbIodE1XSsDn6UAzIoMtUObY2+k/4gY/l+AkZJ5Sj2vQrkyLm3FoxjhDX+31UXBFf9XrAH31fFqoBmDEZvhvvpnZ87N+oZEu7U9O/nnk+QWj3x8uyoRbEnf+O5UMr9i0nHP38IF5AvzrBW8YWBUR0mIAzIvndQq9N3v/Jto3aPjPXUPl8ASdPPyAp7jENf8bk7VMM9ol9XGmlBmeDMuGqt+WzuL6CXAxXjIhCPM5vACchgMJ/8XBGLO/D1isVvGhwwHHr1DLaI5mn2Jr/b1pUD90uciDaS8cXNDzCWvNmT/PhQe5e8nTnnnkt8Ds/SIjibcum/fqDhKopxAY8AkSrPn+IGDEKOO+U3XOP6djFs2H5N9+orhOahiQk5KnEUWa+CzkVzhp8bMHRbg81qhjjXuIKbHjSLSIBKWqockGtKinY+z4/RdBUF6pcc3JmnlxVcNgrI4SEzKUZSwcD2QCyxzKve+gAmg6ZuSRkpPFa6mfThu7LJNu3H5K42uCpNvPAsoedolKV/LHe/eJ+BbaG5MG0NaSGVPRUmNFMFFSSpXEcXwbVh7UETOZZtoVNRGOIbbkig3McEtR68cG0RZAoJevWYo7Dg/lZ1CQzblWeUvVHmr8fY4Nqd9JJiH/zEX24mJviH60fAyFr0A3c4bC1j3yZU60VgJxXn8JgJXLUIsiBnmKmMYz+7yBQFBvqb2eYnuW59joZBf56/wXvWIR4R8wTmV80i1mZy+S4+BUES+hzjk0uXpC///z/IlqHZ1monzlXp8aCfhGKMti73FI1KbL1q6IKO4fuBuZ59gagjn5xU79muMpHXg6S+e+gDM/U9BKLHbl9l6o8czQKl4RUkJJiqftQG2i3BMg/TQlUYFkJDYBOOvAugYuzYSDnZbDDd/aSd9x0Oe6F+bJcHfl9+gp6L5/TgA+BdFFovbfCrQ40s5vMPw8866pNX8zyFGeFWdxIpPVp9Rg1UPOVFbFZrvaFq/YAzHQgqMWpahMYfqHpmwXfHL1/kpYmGuHFwT55mQu0dylfNuq2Oq0hTMCPwqfxnuBIPLXfci4Y1ANy+1CUipQxld/izVh16WyG2Q0CQQ9NqtAnx1HCHwDj7sYxOSB0wopZSnOzxQOcExmxrVTF2BkOthVpGfuhaGECfCJpJKpjnihY+xOT2QJxN61+9K6QSqtv2Shr82I3jgJrqBg0wELFZPjvHpvzTtaJnLK6Vb97Yn933koO/saN7fsjwNKzp4l2lJVx2orjCGzC/4ZL4zCver6aQYtC5sdoychuFE6ufOiog+VWi5UDkbmvmtah/3aArEBIi39s5ILUnlFLgilcGuz9CQshEY7fw2ouoILAYPVT/gyAIq3TFAIwVsl+ktkRz/qGfnCDGrm5gsl/l9QdvCWGsjPz3dU7XuqKfdUrr/6XIgjp4rey6AJBmCmUJMjITHVdFb5m1p+dLMCL8t55zD42cmftmLEJC0Da04YiRCVUBLLa8D071/N5UBNBXDh0LFsmhV/5B5ExOB4j3WVG/S3lfK5o+V6ELHvy6RR9n4ac+VsK4VE4yphPvV+kG9FegTBH4ZRXL2HytUHCduJazB/KykjfetYxOXTLws267aGOd+I+JhKP//+VnXmS90OD/jvLcVu0asyqcuYN1mSb6XTlCkqv1vigZPIYwNF/zpWcT1GR/6aEIRjkh0yhg4LXJfaGobYJTY4JI58KiAKgmmgAKWdl5nYCeLqavRJGQNuYuZtZFGx+IkI4w4NS2xwbetNMunOjBu/hmKCI/w7tfiiyUd//4rbTeWt4izBY8YvGIN6vyKYmP/8X8wHKCeN+WRcKM70+tXKNGyevU9H2Dg5BsljnTf8YbsJ1TmMs74Ce2XlHisleguhyeg44rQOHZuw/6HTkhnnurK2d62q6yS7210SsAIaR+jXMQA+svkrLpsUY+F30Uw89uOdGAR6vo4FIME0EfVVeHTu6eKicfhSqOeXJhbftcd08sWEnNUL1C9fnprTgd83IMut8onVUF0hvqzZfHduPjbjwEXIcoYmy+P6tcJZHmeOv6VrvEdkHDJecjHuHeWANe79VG662qTjA/HCvumVv3qL+LrOcpqGps2ZGwQdFJ7PU4iuyRlBrwfO+xnPyr47s2cXVbWzAyznDiBGjCM3ksxjjqM62GE9C8f5U38kB3VjtabKp/nRdvMESPGDG90bWRLAt1Qk5DyLuazRR1YzdC1c+hZXvAWV8xA72S4A8B67vjVhbba3MMop293FeEXpe7zItMWrJG/LOH9ByOXmYnNJfjmfuX9KbrpgLOba4nZ+fl8Gbdv/ihv+6wFGKHCYrVwmhFC0J3V2bn2tIB1wCc1CST3d3X2OyxhguXcs4sm679UngzofuSeBewMFJboIQHbUh/m2JhW2hG9DIvG2t7yZIzKBTz9wBtnNC+2pCRYhSIuQ1j8xsz5VvqnyUIthvuoyyu7fNIrg/KQUVmGQaqkqZk/Vx5b33/gsEs8yX7SC1J+NV4icz6bvIE7C5G6McBaI8rVg56q5QBJWxn/87Q1sPK4+sQa8fLU5gXo4paaq4cOcQ4wR0VBHPGjKh+UlPCbA1nLXyEUX45qZ8J7/Ln4FPJE2TdzD0Z8MLSNQiykMMmSyOCiFfy84Rq60emYB2vD09KjYwsoIpeDcBDTElBbXxND72yhd9pC/1CMid/5HUMvAL27OtcIJDzNKpRPNqPOpyt2aPGz9QWIs9hQ9LiX5s8m9hjTUu/f7MyIatjjd+tSfQ3ufZxPpmJhTaBtZtKLUcfOCUqADuO+QoH8B9v6U+P0HV1GLQmtoNFTb3s74ivZgjES0qfK+8RdGgBbcCMSy8eBvh98+et1KIFqSe1KQPyXULBMTsIYnysIwiZBJYdI20vseV+wuJkcqGemehKjaAb9L57xZm3g2zX0bZ2xk/fU+bCo7TlnbW7JuF1YdURo/2Gw7VclDG1W7LOtas2LX4upifZ/23rzpsnY/ALfRgrcWP5hYmV9VxVOQA1fZvp9F2UNU+7d7xRyVm5wiLp3/0dlV7vdw1PMiZrbDAYzIVqEjRY2YU03sJhPnlwIPcZUG5ltL6S8XCxU1eYS5cjr34veBmXAvy7yN4ZjArIG0dfD/5UpBNlX1ZPoxJOwyqRi3wQWtOzd4oNKh0LkoTm8cwqgIfKhqqGOhwo71I+zXnMemTv2B2AUzABWyFztGgGULjDDzWYwJUVBTjKCn5K2QGMK1CQT7SzziOjo+BhAmqBjzuc3xYym2eedGeOIRJVyTwDw37iCMe4g5Vbnsb5ZBdxOAnMT7HU4DHpxWGuQ7GeiY30Cpbvzss55+5Km1YsbD5ea3NI9QNYIXol5apgSu9dZ8f8xS5dtHpido5BclDuLWY4lhik0tbJa07yJhH0BOyEut/GRbYTS6RfiTYWGMCkNpfSHi7HvdiTglEVHKZXaVhezH4kkXiIvKopYAlPusftpE4a5IZwvw1x/eLvoDIh/zpo9FiQInsTb2SAkKHV42XYBjpJDg4374XiVb3ws4qM0s9eSQ5HzsMU4OZJKuopFjBM+dAZEl8RUMx5uU2N486Kr141tVsGQfGjORYMCJAMsxELeNT4RmWjRcpdTGBwcx6XN9drWqPmJzcrGrH4+DRc7+n1w3kPZwu0BkNr6hQrqgo7JTB9A5kdJ/H7P4cWBMwsmuixAzJB3yrQpnGIq90lxAXLzDCdn1LPibsRt7rHNjgQBklRgPZ8vTbjXdgXrTWQsK5MdrXXQVPp0Rinq3frzZKJ0qD6Qhc40VzAraUXlob1gvkhK3vpmHgI6FRlQZNx6eRqkp0zy4AQlX813fAPtL3jMRaitGFFjo0zmErloC+h+YYdVQ6k4F/epxAoF0BmqEoKNTt6j4vQZNQ2BoqF9Vj53TOIoNmDiu9Xp15RkIgQIGcoLpfoIbenzpGUAtqFJp5W+LLnx38jHeECTJ/navKY1NWfN0sY1T8/pB8kIH3DU3DX+u6W3YwpypBMYOhbSxGjq84R
270Z84fWJow8pyHqn4S/9J15EcCMsXqrfwyd9mhiu3+rEo9pPpoJkdZqHjra4NvzFwuThNKy6hao/SlLw3ZADUcUp3w3SRVfW2rhl80zOgTYnKE0Hs2qp1J6H3xqPqIkvUDRMFDYyRbsFI3M9MEyovPk8rlw7/0a81cDVLmBsR2ze2pBuKb23fbeZC0uXoIvDppfTwIDxk1Oq2dGesGc+oJXWJLGkOha3CX+DUnzgAp9HGH9RsPZN63Hn4RMA5eSVhPHO+9RcRb/IOgtW31V1Q5IPGtoxPjC+MEJbVlIMYADd9aHYWUIQKopuPOHmoqSkubnAKnzgKHqgIOfW5RdAgotN6BN+O2ZYHkuemLnvQ8U9THVrS1RtLmKbcC7PeeDsYznvqzeg6VCNwmr0Yyx1wnLjyT84BZz3EJyCptD3yeueAyDWIs0L2qs/VQ3HUyqfrja0V1LdDzqAikeWuV4sc7RLIB69jEIBjCkyZedoUHqCrOvShVzyd73OdrJW0hPOuQv2qOoHDc9xVb6Yu6uq3Xqp2ZaH46A7lzevbxQEmfrzvAYSJuZ4WDk1Hz3QX1LVdiUK0EvlAGAYlG3Md30r7dcPN63yqBCIj25prpvZP0nI4+EgWoFG95V596CurXpKRBGRjQlHCvy5Ib/iW8nZJWwrET3mgd6mEhfP4KCuaLjopWs7h+MdXFdIv8dHQJgg1xi1eYqB0uDYjxwVmri0Sv5XKut/onqapC+FQiC2C1lvYJ9MVco6yDYsS3AANUfMtvtbYI2hfwZatiSsnoUeMZd34GVjkMMKA+XnjJpXgRW2SHTZplVowPmJsvXy6w3cfO1AK2dvtZEKTkC/TY9LFiKHCG0DnrMQdGm2lzlBHM9iEYynH2UcVMhUEjsc0oDBTgo2ZSQ1gzkAHeWeBXYFjYLuuf8yzTCy7/RFR81WDjXMbq2BOH5dURnxo6oivmxL3cKzKInlZkD31nvpHB9Kk7GfcfE1t+1V64b9LtgeJGlpRFxQCAqWJ5DoY77ski8gsOEOr2uywZaoO/NGa0X0y1pNQHBi3b2SUGNpcZxDT7rLbBf1FSnQ8guxGW3W+36BW0gBje4DOz6Ba6SVk0xiKgt+q2JOFyr4SYfnu+Ic1QZYIuwHBrgzr6UvOcSCzPTOo7D6IC4ISeS7zkl4h+2VoeHpnG/uWR3+ysNgPcOIXQbv0n4mr3BwQcdKJxgPSeyuP/z1Jjg4e9nUvoXegqQVIE30EHx5GHv+FAVUNTowYDJgyFhf5IvlYmEqRif6+WN1MkEJmDcQITx9FX23a4mxy1AQRsOHO/+eImX9l8EMJI3oPWzVXxSOeHU1dUWYr2uAA7AMb+vAEZSbU3qob9ibCyXeypEMpZ6863o6QPqlqGHZkuWABSTVNd4cOh9hv3qEpSx2Zy/DJMP6cItEmiBJ5PFqQnDEIt3NrA3COlOSgz43D7gpNFNJ5MBh4oFzhDPiglC2ypsNU4ISywY2erkyb1NC3Qh/IfWj0eDgZI4/ln8WPfBsT3meTjq1Uqt1E7Zl/qftqkx6aM9KueMCekSnMrcHj1CqTWWzEzPsZGcDe3Ue4Ws+XFYVxNbOFF8ezkvQGR6ZOtOLU2lQEnMBStx47vE6Pb7AYMBRj2OOfZXfisjJnpTfSNjo6sZ6qSvNxZNmDeS7Gk3yYyCk1HtKN2UnhMIjOXUzAqDv90lx9O/q/AT1ZMnit5XQe9wmQxnE/WSH0CqZ9/2Hy+Sfmpeg8RwsHI5Z8kC8H293m/LHVVM/BA7HaTJYg5Enk7M/xWpq0192ACfBai2LA/qrCjCr6Dh1BIMzMXINBmX96MJ5Hn2nxln/RXPFhwHxUmSV0EV2V0jm86/dxxuYSU1W7sVkEbN9EzkG0QFwPhyHKyb3t+Fj5WoUUTErcazE/N6EW6Lvp0d//SDPj7EV9UdJN+Amnf3Wwk3A0SlJ9Z00yvXZ7n3z70G47Hfsow8Wq1JXcfwnA+Yxa5mFsgV464KKP4T31wqIgzFPd3eCe3j5ory5fBF2hgCFyVFrLzI9eetNXvM7oQqyFgDo4CTp/hDV9NMX9JDHQ/nyHTLvZLNLF6ftn2OxjGm8+PqOwhxnPHWipkE/8wbtyri80Sr7pMNkQGMfo4ZYK9OcCC4ESVFFbLMIvlxSoRqWie0wxqnLfcLSXMSpMMQEJYDVObYsXIQNv4TGNwjq1kvT1UOkicTrG3IaBZ3XdScS3u8sgeZPVpOLkbiF940FjbCeNRINNvDbd01EPBrTCPpm12m43ze1bBB59Ia6Ovhnur/Nvx3IxwSWol+3H2qfCJR8df6aQf4v6WiONxkK+IqT4pKQrZK/LplgDI/PJZbOep8dtbV7oCr6CgfpWa8NczOkPx81iSHbsNhVSJBOtrLIMrL31LK9TqHqAbAHe0RLmmV806kRLDLNEhUEJfm9u0sxpkL93Zgd6rw+tqBfTMi59xqXHLXSHwSbSBl0EK0+loECOPtrl+/nsaFe197di4yUgoe4jKoAJDXc6DGDjrQOoFDWZJ9HXwt8xDrQP+7aRwWKWI1GF8s8O4KzxWBBcwnl3vnl1Oez3oh6Ea1vjR7/z7DDTrFtqU2W/KAEzAuXDNZ7MY73MF216dzdSbWmUp4lcm7keJfWaMHgut9x5C9mj66Z0lJ+yhsjVvyiWrfk1lzPOTdhG15Y7gQlXtacvI7qv/XNSscDwqkgwHT/gUsD5yB7LdRRvJxQGYINn9hTpodKFVSTPrtGvyQw+HlRFXIkodErAGu9Iy1YpfSPc3jkFh5CX3lPxv7aqjE/JAfTIpEjGb/H7MO0e2vsViSW1qa/Lmi4/n4DEI3g7lYrcanspDfEpKkdV1OjSLOy0BCUqVoECaB55vs06rXl4jqmLsPsFM/7vYJ0vrBhDCm/00A/H81l1uekJ/6Lml3Hb9+NKiLqATJmDpyzfYZFHumEjC662L0Bwkxi7E9U4cQA0XMVDuMYAIeLMPgQaMVOd8fmt5SflFIfuBoszeAw7ow5gXPE2Y/yBc/7jExARUf/BxIHQBF5Sn3i61w4z5xJdCyO1F1X3+3ax+JSvMeZ7S6QSKp1Fp/sjYz6Z+VgCZzibGeEoujryfMulH7Rai5kAft9ebcW50DyJr2uo2z97mTWIu45YsSnNSMrrNUuG1XsYBtD9TDYzQffKB87vWbkM4EbPAFgoBV4GQS+vtFDUqOFAoi1nTtmIOvg38N4hT2Sn8r8clmBCXspBlMBYTnrqFJGBT3wZOzAyJDre9dHH7+x7qaaKDOB4UQALD5ecS0DE4obubQEiuJZ0EpBVpLuYcce8Aa4PYd/V4DLDAJBYKQPCWTcrEaZ5HYbJi11Gd6hjGom1ii18VHYnG28NKpkz2UKVPxlhYSp8uZr367iOmoy7zsxehW9wzcy2zG0a80PBMCRQMb32hnaHeOR8fnNDzZhaNYhkOdDsBUZ3loDMa1YP0uS0cjUP3b/6DBlqmZOeNABDsLl5BI5QJups8uxAuWJdkUB/pO6Zax6tsg7fN5mjjDgMGngO+DPcKqiHIDbFIGudxtPTIyDi9SFMKBDcfdGQRv41q1AqmxgkVfJMnP8w/Bc7N9/TR6C7mGObFqFkIEom8sKi2xYqJLTCHK7cxzaZvqODo22c3wisBCP4HeAgcRbNPAsBkNRhSmD48dHupdBRw4mIvtS5oeF6zeT1KMCyhMnmhpkFAGWnGscoNkwvQ8ZM5lE/vgTHFYL99OuNxdFBxTEDd5v2qLR8y9WkXsWgG6kZNndFG+pO/UAkOCipqIhL3hq7cRSdrCq7YhUsTocEcnaFa6nVkhnSeRYUA1YO0z5itF9Sly3VlxYDw239TJJH6f3EUfYO5lb7bcFcz8Bp7Oo8QmnsUHOz/fagVUBtKEw1iT88j+aKkv8cscKNkMxjYr8344D1kFoZ7/td1W6LCNYN594301tUGRmFjAzeRg5vyoM1F6+bJZ/Q54jN/k8SFd3DxPTYaAUsivsBfgTn7Mx8H2SpPt4GOdYRnEJOH6jHM2p6SgB0gzIRq6fHxGMmSmqaPCmlfwxiuloaVIitLGN8wie2CDWhkzLoCJcODh7KIOAqbHEvXdUxaS4TTTs07Clzj/6GmVs9kiZDerMxEnhUB6QQPlcfqkG9882RqHoLiHGBoHfQuXIsAG8GTAtao2KVwRnvvam8jo1e312GQAKWEa4sUVEAMG4G6ckcONDwRcg1e2D3+ohXgY4UAWF8wHKQMrSnzCgfFpsxh+aHXMGtPQroQasRY4U6UdG0rz1Vjbka0MekOGRZQEvqQFlxseFor8zWFgHek3v29
270+WqN6gaK5gZOTOMZzpQIC1201LkMCXild3vWXSc5UX9xcFYfbRPzGFa1FDcPfPB/jUEq/FeGt419CI3YmBlVoHsa4KdcwQP5ZSwHHhFJ7/Ph/Rap/4vmG91eDwPP0lDfCDRCLszTqfzM71xpmiKi2HwS4WlqvGNwtvwF5Dqpn6KTq8ax00UMPkxDcZrEEEsIvHiUXXEphdb4GB4FymlPwBz4Gperqq5pW7TQ6/yNRhW8VT5NhuP0udlxo4gILq5ZxAZk8ZGh3g4CqxJlPKY7AQxupfUcVpWT5VItp1+30UqoyP4wWsRo3olRRgkWZZ2ZN6VC3OZFeXB8NbnUrSdikNptD1QiGuKkr8EmSR/AK9Rw+FF3s5uwuPbvHGiPeFOViltMK7AUaOsq9+x9cndk3iJEE5LKZRlWJbKOZweROzmPNVPkjE3K/TyA57Rs68TkZ3MR8akKpm7cFjnjPd/DdkWjgYoKHSr5Wu5ssoBYU4acRs5g2DHxUmdq8VXOXRbunD8QN0LhgkssgahcdoYsNvuXGUK/KXD/7oFb+VGdhqIn02veuM5bLudJOc2Ky0GMaG4W/xWBxIJcL7yliJOXOpx0AkBqUgzlDczmLT4iILXDxxtRR1oZa2JWFgiAb43obrJnG/TZC2KSK2wqOzRZTXavZZFMb1f3bXvVaNaK828w9TO610gk8JNf3gMfETzXXsbcvRGCG9JWQZ6+cDPqc4466Yo2RcKH+PILeKOqtnlbInR3MmBeGG3FH10yzkybuqEC2HSQwpA0An7d9+73BkDUTm30bZmoP/RGbgFN+GrCOfADgqr0WbI1a1okpFms8iHYw9hm0zUvlEMivBRxModrbJJ+9/p3jUdQQ9BCtQdxnOGrT5dzRUmw0593/mbRSdBg0nRvRZM5/E16m7ZHmDEtWhwvfdZCZ8J8M12W0yRMszXamWfQTwIZ4ayYktrnscQuWr8idp3PjT2eF/jmtdhIfcpMnb+IfZY2FebW6UY/AK3jP4u3Tu4zE4qlnQgLFbM19EBIsNf7KhjdbqQ/D6yiDb+NlEi2SKD+ivXVUK8ib0oBo366gXkR8ZxGjpJIDcEgZPa9TcYe0TIbiPl/rPUQDu3XBJ9X/GNq3FAUsKsll57DzaGMrjcT+gctp+9MLYXCq+sqP81eVQ0r9lt+gcQfZbACRbEjvlMskztZG8gbC8Qn9tt26Q7y7nDrbZq/LEz7kR6Jc6pg3N9rVX8Y5MJrGlML9p9lU4jbTkKqCveeZUJjHB03m2KRKR2TytoFkTXOLg7keU1s1lrPMQJpoOKLuAAC+y1HlJucU6ysB5hsXhvSPPLq5J7JtnqHKZ4vYjC4Vy8153QY+6780xDuGARsGbOs1WqzH0QS765rnSKEbbKlkO8oI/VDwUd0is13tKpqILu1mDJFNy/iJAWcvDgjxvusIT+PGz3ST/J9r9Mtfd0jpaGeiLYIqXc7DiHSS8TcjFVksi66PEkxW1z6ujbLLUGNNYnzOWpH8BZGK4bCK7iR+MbIv8ncDAz1u4StN3vTTzewr9IQjk9wxFxn+6N1ddKs0vffJiS08N3a4G1SVrlZ97Q/M+8G9fe5AP6d9/Qq4WRnORVhofPIKEdCr3llspUfE0oKIIYoByBRPh+bX1HLS3JWGJRhIvE1aW4NTd8ePi4Z+kXb+Z8snYfSNcqijhAgVsx4RCM54cXUiYkjeBmmC4ajOHrChoELscJJC7+9jjMjw5BagZKlgRMiSNYz7h7vvZIoQqbtQmspc0cUk1G/73iXtSpROl5wtLgQi0mW2Ex8i3WULhcggx6E1LMVHUsdc9GHI1PH3U2Ko0PyGdn9KdVOLm7FPBui0i9a0HpA60MsewVE4z8CAt5d401Gv6zXlIT5Ybit1VIA0FCs7wtvYreru1fUyW3oLAZ/+aTnZrOcYRNVA8spoRtlRoWflsRClFcgzkqiHOrf0/SVw+EpVaFlJ0g4Kxq1MMOmiQdpMNpte8lMMQqm6cIFXlnGbfJllysKDi+0JJMotkqgIxOSQgU9dn/lWkeVf8nUm3iwX2Nl3WDw9i6AUK3vBAbZZrcJpDQ/N64AVwjT07Jef30GSSmtNu2WlW7YoyW2FlWfZFQUwk867EdLYKk9VG6JgEnBiBxkY7LMo4YLQJJlAo9l/oTvJkSARDF/XtyAzM8O2t3eT/iXa6wDN3WewNmQHdPfsxChU/KtLG2Mn8i4ZqKdSlIaBZadxJmRzVS/o4yA65RTSViq60oa395Lqw0pzY4SipwE0SXXsKV+GZraGSkr/RW08wPRvqvSUkYBMA9lPx4m24az+IHmCbXA+0faxTRE9wuGeO06DIXa6QlKJ3puIyiuAVfPr736vzo2pBirS+Vxel3TMm3JKhz9o2ZoRvaFVpIkykb0Hcm4oHFBMcNSNj7/4GJt43ogonY2Vg4nsDQIWxAcorpXACzgBqQPjYsE/VUpXpwNManEru4NwMCFPkXvMoqvoeLN3qyu/N1eWEHttMD65v19l/0kH2mR35iv/FI+yjoHJ9gPMz67af3Mq/BoWXqu3rphiWMXVkmnPSEkpGpUI2h1MThideGFEOK6YZHPwYzMBvpNC7+ZHxPb7epfefGyIB4JzO9DTNEYnDLVVHdQyvOEVefrk6Uv5kTQYVYWWdqrdcIl7yljwwIWdfQ/y+2QB3eR/qxYObuYyB4gTbo2in4PzarU1sO9nETkmj9/AoxDA+JM3GMqQtJR4jtduHtnoCLxd1gQUscHRB/MoRYIEsP2pDZ9KvHgtlk1iTbWWbHhohwFEYX7y51fUV2nuUmnoUcqnWIQAAgl9LTVX+Bc0QGNEhChxHR4YjfE51PUdGfsSFE6ck7BL3/hTf9jLq4G1IafINxOLKeAtO7quulYvH5YOBc+zX7CrMgWnW47/jfRsWnJjYYoE7xMfWV2HN2iyIqLI";const ik=new Map([[8217,"apostrophe"],[8260,"fraction slash"],[12539,"middle dot"]]),ok=4;function Bwe(t){let e=0;function r(){return t[e++]<<8|t[e++]}let n=r(),s=1,i=[0,1];for(let b=1;b<n;b++)i.push(s+=r());let o=r(),a=e;e+=o;let c=0,u=0;function l(){return c==0&&(u=u<<8|t[e++],c=8),u>>--c&1}const d=31,f=2**d,g=f>>>1,h=g>>1,p=f-1;let y=0;for(let b=0;b<d;b++)y=y<<1|l();let w=[],I=0,v=f;for(;;){let b=Math.floor(((y-I+1)*s-1)/v),m=0,_=n;for(;_-m>1;){let S=m+_>>>1;b<i[S]?_=S:m=S}if(m==0)break;w.push(m);let O=I+Math.floor(v*i[m]/s),C=I+Math.floor(v*i[m+1]/s)-1;for(;((O^C)&g)==0;)y=y<<1&p|l(),O=O<<1&p,C=C<<1&p|1;for(;O&~C&h;)y=y&g|y<<1&p>>>1|l(),O=O<<1^g,C=(C^g)<<1|g|1;I=O,v=1+C-O}let E=n-4;return w.map(b=>{switch(b-E){case 3:return E+65792+(t[a++]<<16|t[a++]<<8|t[a++]);case 2:return E+256+(t[a++]<<8|t[a++]);case 1:return E+t[a++];default:return b-1}})}function kwe(t){let e=0;return()=>t[e++]}function u7(t){return kwe(Bwe(jwe(t)))}function jwe(t){let e=[];[..."ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"].forEach((s,i)=>e[s.charCodeAt(0)]=i);let r=t.length,n=new Uint8Array(6*r>>
2703);for(let s=0,i=0,o=0,a=0;s<r;s++)a=a<<6|e[t.charCodeAt(s)],o+=6,o>=8&&(n[i++]=a>>(o-=8));return n}function Dwe(t){return t&1?~t>>1:t>>1}function Uwe(t,e){let r=Array(t);for(let n=0,s=0;n<t;n++)r[n]=s+=Dwe(e());return r}function $y(t,e=0){let r=[];for(;;){let n=t(),s=t();if(!s)break;e+=n;for(let i=0;i<s;i++)r.push(e+i);e+=s+1}return r}function l7(t){return Ly(()=>{let e=$y(t);if(e.length)return e})}function d7(t){let e=[];for(;;){let r=t();if(r==0)break;e.push(Mwe(r,t))}for(;;){let r=t()-1;if(r<0)break;e.push($we(r,t))}return e.flat()}function Ly(t){let e=[];for(;;){let r=t(e.length);if(!r)break;e.push(r)}return e}function f7(t,e,r){let n=Array(t).fill().map(()=>[]);for(let s=0;s<e;s++)Uwe(t,r).forEach((i,o)=>n[o].push(i));return n}function Mwe(t,e){let r=1+e(),n=e(),s=Ly(e);return f7(s.length,1+t,e).flatMap((o,a)=>{let[c,...u]=o;return Array(s[a]).fill().map((l,d)=>{let f=d*n;return[c+d*r,u.map(g=>g+f)]})})}function $we(t,e){let r=1+e();return f7(r,1+t,e).map(s=>[s[0],s.slice(1)])}function Lwe(t){let e=[],r=$y(t);return s(n([]),[]),e;function n(i){let o=t(),a=Ly(()=>{let c=$y(t).map(u=>r[u]);if(c.length)return n(c)});return{S:o,B:a,Q:i}}function s({S:i,B:o},a,c){if(!(i&4&&c===a[a.length-1])){i&2&&(c=a[a.length-1]),i&1&&e.push(a);for(let u of o)for(let l of u.Q)s(u,[...a,l],c)}}}function Fwe(t){return t.toString(16).toUpperCase().padStart(2,"0")}function h7(t){return`{${Fwe(t)}}`}function Hwe(t){let e=[];for(let r=0,n=t.length;r<n;){let s=t.codePointAt(r);r+=s<65536?1:2,e.push(s)}return e}function vp(t){let r=t.length;if(r<4096)return String.fromCodePoint(...t);let n=[];for(let s=0;s<r;)n.push(String.fromCodePoint(...t.slice(s,s+=4096)));return n.join("")}function qwe(t,e){let r=t.length,n=r-e.length;for(let s=0;n==0&&s<r;s++)n=t[s]-e[s];return n}var zwe=
vendor: 7,453 bytes, line 270
270"AEUDTAHBCFQATQDRADAAcgAgADQAFAAsABQAHwAOACQADQARAAoAFwAHABIACAAPAAUACwAFAAwABAAQAAMABwAEAAoABQAIAAIACgABAAQAFAALAAIACwABAAIAAQAHAAMAAwAEAAsADAAMAAwACgANAA0AAwAKAAkABAAdAAYAZwDSAdsDJgC0CkMB8xhZAqfoC190UGcThgBurwf7PT09Pb09AjgJum8OjDllxHYUKXAPxzq6tABAxgK8ysUvWAgMPT09PT09PSs6LT2HcgWXWwFLoSMEEEl5RFVMKvO0XQ8ExDdJMnIgsj26PTQyy8FfEQ8AY8IPAGcEbwRwBHEEcgRzBHQEdQR2BHcEeAR6BHsEfAR+BIAEgfndBQoBYgULAWIFDAFiBNcE2ATZBRAFEQUvBdALFAsVDPcNBw13DYcOMA4xDjMB4BllHI0B2grbAMDpHLkQ7QHVAPRNQQFnGRUEg0yEB2uaJF8AJpIBpob5AERSMAKNoAXqaQLUBMCzEiACnwRZEkkVsS7tANAsBG0RuAQLEPABv9HICTUBXigPZwRBApMDOwAamhtaABqEAY8KvKx3LQ4ArAB8UhwEBAVSagD8AEFZADkBIadVj2UMUgx5Il4ANQC9AxIB1BlbEPMAs30CGxlXAhwZKQIECBc6EbsCoxngzv7UzRQA8M0BawL6ZwkN7wABAD33OQRcsgLJCjMCjqUChtw/km+NAsXPAoP2BT84PwURAK0RAvptb6cApQS/OMMey5HJS84UdxpxTPkCogVFITaTOwERAK5pAvkNBOVyA7q3BKlOJSALAgUIBRcEdASpBXqzABXFSWZOawLCOqw//AolCZdvv3dSBkEQGyelEPcMMwG1ATsN7UvYBPEGOwTJH30ZGQ/NlZwIpS3dDO0m4y6hgFoj9SqDBe1L9DzdC01RaA9ZC2UJ4zpjgU4DIQENIosK3Q05CG0Q8wrJaw3lEUUHOQPVSZoApQcBCxEdNRW1JhBirAsJOXcG+xr2C48mrxMpevwF0xohBk0BKRr/AM8u54WwWjFcHE9fBgMLJSPHFKhQIA0lQLd4SBobBxUlqQKRQ3BKh1E2HpMh9jw9DWYuE1F8B/U8BRlPC4E8nkarRQ4R0j6NPUgiSUwsBDV/LC8niwnPD4UMuXxyAVkJIQmxDHETMREXN8UIOQcZLZckJxUIIUaVYJoE958D8xPRAwsFPwlBBxMDtRwtEy4VKQUNgSTXAvM21S6zAo9WgAEXBcsPJR/fEFBH4A7pCJsCZQODJesALRUhABcimwhDYwBfj9hTBS7LCMdqbCN0A2cU52ERcweRDlcHpxwzFb8c4XDIXguGCCijrwlbAXUJmQFfBOMICTVbjKAgQWdTi1gYmyBhQT9d/AIxDGUVn0S9h3gCiw9rEhsBNQFzBzkNAQJ3Ee0RaxCVCOuGBDW1M/g6JQRPIYMgEQonA09szgsnJvkM+GkBoxJiAww0PXfuZ6tgtiQX/QcZMsVBYCHxC5JPzQycGsEYQlQuGeQHvwPzGvMn6kFXBf8DowMTOk0z7gS9C2kIiwk/AEkOoxcH1xhqCnGM0AExiwG3mQNXkYMCb48GNwcLAGcLhwV55QAdAqcIowAFAM8DVwA5Aq0HnQAZAIVBAT0DJy8BIeUCjwOTCDHLAZUvAfMpBBvDDBUA9zduSgLDsQKAamaiBd1YAo4CSTUBTSUEBU5HUQOvceEA2wBLBhPfRwEVq0rLGuNDAd9vKwDHAPsABTUHBUEBzQHzbQC3AV8LMQmis7UBTekpAIMAFWsB1wKJAN0ANQB/8QFTAE0FWfkF0wJPSQERMRgrV2EBuwMfATMBDQB5BsuNpckHHwRtB9MCEBsV4QLvLge1AQMi3xPNQsUCvd5VoWACZIECYkJbTa9bNyACofcCaJgCZgkCn4Q4GwsCZjsCZiYEbgR/A38TA36SOQY5dxc5gjojIwJsHQIyNjgKAm3HAm2u74ozZ0UrAWcA3gDhAEoFB5gMjQD+C8IADbUCdy8CdqI/AnlLQwJ4uh1c20WuRtcCfD8CesgCfQkCfPAFWQUgSABIfWMkAoFtAoAAAoAFAn+uSVhKWxUXSswC0QEC0MxLJwOITwOH5kTFkTIC8qFdAwMDrkvOTC0lA89NTE2vAos/AorYwRsHHUNnBbcCjjcCjlxAl4ECjtkCjlx4UbRTNQpS1FSFApP7ApMMAOkAHFUeVa9V0AYsGymVhjLheGZFOzkCl58C77JYIagAWSUClo8ClnycAKlZrFoJgU0AOwKWtQKWTlxEXNECmcsCmWRcyl0HGQKcmznCOp0CnBYCn5sCnriKAB0PMSoPAp3xAp6SALU9YTRh7wKe0wKgbgGpAp6fHwKeTqVjyGQnJSsCJ68CJn4CoPsCoEwCot0CocQCpi8Cpc4Cp/8AfQKn8mh8aLEAA0lqHGrRAqzjAqyuAq1nAq0CAlcdAlXcArHh1wMfTmyXArK9DQKy6Bds4G1jbUhfAyXNArZcOz9ukAMpRQK4XgK5RxUCuSp3cDZw4QK9GQK72nCWAzIRAr6IcgIDM3ECvhpzInNPAsPLAsMEc4J0SzVFdOADPKcDPJoDPb8CxXwCxkcCxhCJAshpUQLIRALJTwLJLgJknQLd0nh5YXiueSVL0AMYo2cCAmH0GfOVJHsLXpJeuxECz2sCz2wvS1PS8xOfAMatAs9zASnqA04SfksFAtwnAtuKAtJPA1JcA1NfAQEDVYyAiT8AyxbtYEWCHILTgs6DjQLaxwLZ3oQQhEmnPAOGpQAvA2QOhnFZ+QBVAt9lAt64c3cC4i/tFAHzMCcB9JsB8tKHAuvzAulweQLq+QLq5AD5RwG5Au6JAuuclqqXAwLuPwOF4Jh5cOBxoQLzAwBpA44WmZMC9xMDkW4DkocC95gC+dkC+GaaHJqruzebHgOdgwL++gEbADmfHJ+zAwWNA6ZqA6bZANHFAwZqoYiiBQkDDEkCwAA/AwDhQRdTARHzA2sHl2cFAJMtK7evvdsBiZkUfxEEOQH7KQUhDp0JnwCS/SlXxQL3AZ0AtwW5AG8LbUEuFCaNLgFDAYD8AbUmAHUDDgRtACwCFgyhAAAKAj0CagPdA34EkQEgRQUhfAoABQBEABMANhICdwEABdUDa+8KxQIA9wqfJ7+xt+UBkSFBQgHpFH8RNMCJAAQAGwBaAkUChIsABjpTOpSNbQC4Oo860ACNOME63AClAOgAywE6gTo7Ofw5+Tt2iTpbO56JOm85GAFWATMBbAUvNV01njWtNWY1dTW2NcU1gjWRNdI14TWeNa017jX9NbI1wTYCNhE1xjXVNhY2JzXeNe02LjY9Ni41LSE2OjY9Njw2yTcIBJA8VzY4Nt03IDcPNsogN4k3MAoEsDxnNiQ3GTdsOo03IULUQwdC4EMLHA8PCZsobShRVQYA6X8A6bABFCnXAukBowC9BbcAbwNzBL8MDAMMAQgDAAkKCwsLCQoGBAVVBI/DvwDz9b29kaUCb0QtsRTNLt4eGBcSHAMZFhYZEhYEARAEBUEcQRxBHEEcQRxBHEEaQRxBHEFCSTxBPElISUhBNkM2QTYbNklISVmBVIgBFLWZAu0BhQCjBcEAbykBvwGJAaQcEZ0ePCklMAAhMvAIMAL54gC7Bm8EescjzQMpARQpKgDUABavAj626xQAJP0A3etzuf4NNRA7efy2Z9NQrCnC0OSyANz5BBIbJ5IFDR6miIavYS6tprjjmuKebxm5C74Q225X1pkaYYPb6f1DK4k3xMEBb9S2WMjEibTNWhsRJIA+vwNVEiXTE5iXs/wezV66oFLfp9NZGYW+Gk19J2+bCT6Ye2w6LDYdgzKMUabk595eLBCXANz9HUpWbATq9vqXVx9XDg+Pc9Xp4+bsS005SVM/BJBM4687WUuf+Uj9dEi8aDNaPxtpbDxcG1THTImUMZq4UCaaNYpsVqraNyKLJXDYsFZ/5jl7bLRtO88t7P3xZaAxhb5OdPMXqsSkp1WCieG8jXm1U99+blvLlXzPCS+M93VnJCiK+09LfaSaBAVBomyDgJua8dfUzR7ga34IvR2Nvj+A9heJ6lsl1KG4NkI1032Cnff1m1wof2B9oHJK4bi6JkEdSqeNeiuo6QoZZincoc73/TH9SXF8sCE7XyuYyW8WSgbGFCjPV0ihLKhdPs08Tx82fYAkLLc4I2wdl4apY7GU5lHRFzRWJep7Ww3wbeA3qmd59/86P4xuNaqDpygXt6M85glSBHOCGgJDnt+pN9bK7HApMguX6+06RZNjzVmcZJ+wcUrJ9//bpRNxNuKpNl9uFds+S9tdx7LaM5ZkIrPj6nIU9mnbFtVbs9s/uLgl8MVczAwet+iOEzzBlYW7RCMgE6gyNLeq6+1tIx4dpgZnd0DksJS5f+JNDpwwcPNXaaVspq1fbQajOrJgK0ofKtJ1Ne90L6VO4MOl5S886p7u6xo7OLjG8TGL+HU1JXGJgppg4nNbNJ5nlzSpuPYy21JUEcUA94PoFiZfjZue+QnyQ80ekOuZVkxx4g+cvhJfHgNl4hy1/a6+RKcKlar/J29y//EztlbVPHVUeQ1zX86eQVAjR/M3dA9w4W8LfaXp4EgM85wOWasli837PzVMOnsLzR+k3o75/lRPAJSE1xAKQzEi5v10ke+VBvRt1cwQRMd+U5mLCTGVd6XiZtgBG5cDi0w22GKcVNvHiu5LQbZEDVtz0onn7k5+heuKXVsZtSzilkLRAUmjMXEMB3J9YC50XBxPiz53SC+EhnPl9WsKCv92SM/OFFIMJZYfl0WW8tIO3UxYcwdMAj7FSmgrsZ2aAZO03BOhP1bNNZItyXYQFTpC3SG1VuPDqH9GkiCDmE+JwxyIVSO5siDErAOpEXFgjy6PQtOVDj+s6e1r8heWVvmZnTciuf4EiNZzCAd7SOMhXERIOlsHIMG399i9aLTy3m2hRLZjJVDNLS53iGIK11dPqQt0zBDyg6qc7YqkDm2M5Ve6dCWCaCbTXX2rToaIgz6+zh4lYUi/+6nqcFMAkQJKHYLK0wYk5N9szV6xihDbDDFr45lN1K4aCXBq/FitPSud9gLt5ZVn+ZqGX7cwm2z5EGMgfFpIFyhGGuDPmso6TItTMwny+7uPnLCf4W6goFQFV0oQSsc9VfMmVLcLr6ZetDZbaSFTLqnSO/bIPjA3/zAUoqgGFAEQS4IhuMzEp2I3jJzbzkk/IEmyax+rhZTwd6f+CGtwPixu8IvzACquPWPREu9ZvGkUzpRwvRRuaNN6cr0W1wWits9ICdYJ7ltbgMiSL3sTPeufgNcVqMVWFkCPDH4jG2jA0XcVgQj62Cb29v9f/z/+2KbYvIv/zzjpQAPkliaVDzNrW57TZ/ZOyZD0nlfMmAIBIAGAI0D3k/mdN4xr9v85ZbZbbqfH2jGd5hUqNZWwl5SPfoGmfElmazUIeNL1j/mkF7VNAzTq4jNt8JoQ11NQOcmhprXoxSxfRGJ9LDEOAQ+dmxAQH90iti9e2u/MoeuaGcDTHoC+xsmEeWmxEKefQuIzHbpw5Tc5cEocboAD09oipWQhtTO1wivf/O+DRe2rpl/E9wlrzBorjJsOeG1B/XPW4EaJEFdNlECEZga5ZoGRHXgYouGRuVkm8tDESiEyFNo+3s5M5puSdTyUL2llnINVHEt91XUNW4ewdMgJ4boJfEyt/iY5WXqbA+A2Fkt5Z0lutiWhe9nZIyIUjyXDC3UsaG1t+eNx6z4W/OYoTB7A6x+dNSTOi9AInctbESqm5gvOLww7OWXPrmHwVZasrl4eD113pm+JtT7JVOvnCXqdzzdTRHgJ0PiGTFYW5Gvt9R9LD6Lzfs0v/TZZHSmyVNq7viIHE6DBK7Qp07Iz55EM8SYtQvZf/obBniTWi5C2/ovHfw4VndkE5XYdjOhCMRjDeOEfXeN/CwfGduiUIfsoFeUxXeQXba7c7972XNv8w+dTjjUM0QeNAReW+J014dKAD/McQYXT7c0GQPIkn3Ll6R7gGjuiQoZD0TEeEqQpKoZ15g/0OPQI17QiSv9AUROa/V/TQN3dvLArec3RrsYlvBm1b8LWzltdugsC50lNKYLEp2a+ZZYqPejULRlOJh5zj/LVMyTDvwKhMxxwuDkxJ1QpoNI0OTWLom4Z71SNzI9TV1iXJrIu9Wcnd+MCaAw8o1jSXd94YU/1gnkrC9BUEOtQvEIQ7g0i6h+KL2JKk8Ydl7HruvgWMSAmNe+LshGhV4qnWHhO9/RIPQzY1tHRj2VqOyNsDpK0cww+56AdDC4gsWwY0XxoucIWIqs/GcwnWqlaT0KPr8mbK5U94/301i1WLt4YINTVvCFBrFZbIbY8eycOdeJ2teD5IfPLCRg7jjcFTwlMFNl9zdh/o3E/hHPwj7BWg0MU09pPrBLbrCgm54A6H+I6v27+jL5gkjWg/iYdks9jbfVP5y/n0dlgWEMlKasl7JvFZd56LfybW1eeaVO0gxTfXZwD8G4SI116yx7UKVRgui6Ya1YpixqXeNLc8IxtAwCU5IhwQgn+NqHnRaDv61CxKhOq4pOX7M6pkA+Pmpd4j1vn6ACUALoLLc4vpXci8VidLxzm7qFBe7s+quuJs6ETYmnpgS3LwSZxPIltgBDXz8M1k/W2ySNv2f9/NPhxLGK2D21dkHeSGmenRT3Yqcdl0m/h3OYr8V+lXNYGf8aCCpd4bWjE4QIPj7vUKN4Nrfs7ML6Y2OyS830JCnofg/k7lpFpt4SqZc5HGg1HCOrHvOdC8bP6FGDbE/VV0mX4IakzbdS/op+Kt3G24/8QbBV7y86sGSQ/vZzU8FXs7u6jIvwchsEP2BpIhW3G8uWNwa3HmjfH/ZjhhCWvluAcF+nMf14ClKg5hGgtPLJ98ueNAkc5Hs2WZlk2QHvfreCK1CCGO6nMZVSb99VM/ajr8WHTte9JSmkXq/i/U943HEbdzW6Re/S88dKgg8pGOLlAeNiqrcLkUR3/aClFpMXcOUP3rmETcWSfMXZE3TUOi8i+fqRnTYLflVx/Vb/6GJ7eIRZUA6k3RYR3iFSK9c4iDdNwJuZL2FKz/IK5VimcNWEqdXjSoxSgmF0UPlDoUlNrPcM7ftmA8Y9gKiqKEHuWN+AZRIwtVSxye2Kf8rM3lhJ5XcBXU9n4v0Oy1RU2M+4qM8AQPVwse8ErNSob5oFPWxuqZnVzo1qB/IBxkM3EVUKFUUlO3e51259GgNcJbCmlvrdjtoTW7rChm1wyCKzpCTwozUUEOIcWLneRLgMXh+SjGSFkAllzbGS5HK7LlfCMRNRDSvbQPjcXaenNYxCvu2Qyznz6StuxVj66SgI0T8B6/sfHAJYZaZ78thjOSIFumNWLQbeZixDCCC+v0YBtkxiBB3jefHqZ/dFHU+crbj6OvS1x/JDD7vlm7zOVPwpUC01nhxZuY/63E7g"
270;const Fy=44032,fA=4352,hA=4449,pA=4519,p7=19,g7=21,_p=28,gA=g7*_p,Wwe=p7*gA,Vwe=Fy+Wwe,Gwe=fA+p7,Kwe=hA+g7,Zwe=pA+_p;function Am(t){return t>>24&255}function m7(t){return t&16777215}let gP,ak,mP,b_;function Ywe(){let t=u7(zwe);gP=new Map(l7(t).flatMap((e,r)=>e.map(n=>[n,r+1<<24]))),ak=new Set($y(t)),mP=new Map,b_=new Map;for(let[e,r]of d7(t)){if(!ak.has(e)&&r.length==2){let[n,s]=r,i=b_.get(n);i||(i=new Map,b_.set(n,i)),i.set(s,e)}mP.set(e,r.reverse())}}function y7(t){return t>=Fy&&t<Vwe}function Jwe(t,e){if(t>=fA&&t<Gwe&&e>=hA&&e<Kwe)return Fy+(t-fA)*gA+(e-hA)*_p;if(y7(t)&&e>pA&&e<Zwe&&(t-Fy)%_p==0)return t+(e-pA);{let r=b_.get(t);return r&&(r=r.get(e),r)?r:-1}}function b7(t){gP||Ywe();let e=[],r=[],n=!1;function s(i){let o=gP.get(i);o&&(n=!0,i|=o),e.push(i)}for(let i of t)for(;;){if(i<128)e.push(i);else if(y7(i)){let o=i-Fy,a=o/gA|0,c=o%gA/_p|0,u=o%_p;s(fA+a),s(hA+c),u>0&&s(pA+u)}else{let o=mP.get(i);o?r.push(...o):s(i)}if(!r.length)break;i=r.pop()}if(n&&e.length>1){let i=Am(e[0]);for(let o=1;o<e.length;o++){let a=Am(e[o]);if(a==0||i<=a){i=a;continue}let c=o-1;for(;;){let u=e[c+1];if(e[c+1]=e[c],e[c]=u,!c||(i=Am(e[--c]),i<=a))break}i=Am(e[o])}}return e}function Qwe(t){let e=[],r=[],n=-1,s=0;for(let i of t){let o=Am(i),a=m7(i);if(n==-1)o==0?n=a:e.push(a);else if(s>0&&s>=o)o==0?(e.push(n,...r),r.length=0,n=a):r.push(a),s=o;else{let c=Jwe(n,a);c>=0?n=c:s==0&&o==0?(e.push(n),n=a):(r.push(a),s=o)}}return n>=0&&e.push(n,...r),e}function w7(t){return b7(t).map(m7)}function Xwe(t){return Qwe(b7(t))}const ck=45,E7=".",v7=65039,_7=1,mA=t=>Array.from(t);function Hy(t,e){return t.P.has(e)||t.Q.has(e)}class e1e extends Array{get is_emoji(){return!0}}let yP,A7,Yl,bP,C7,ph,YI,qf,xl,uk,wP;function KO(){if(yP)return;let t=u7(Rwe);const e=()=>$y(t),r=()=>new Set(e()),n=(l,d)=>d.forEach(f=>l.add(f));yP=new Map(d7(t)),A7=r(),Yl=e(),bP=new Set(e().map(l=>Yl[l])),Yl=new Set(Yl),C7=r(),r();let s=l7(t),i=t();const o=()=>{let l=new Set;return e().forEach(d=>n(l,s[d])),n(l,e()),l};ph=Ly(l=>{let d=Ly(t).map(f=>f+96);if(d.length){let f=l>=i;d[0]-=32,d=vp(d),f&&(d=`Restricted[${d}]`);let g=o(),h=o(),p=!t();return{N:d,P:g,Q:h,M:p,R:f}}}),YI=r(),qf=new Map;let a=e().concat(mA(YI)).sort((l,d)=>l-d);a.forEach((l,d)=>{let f=t(),g=a[d]=f?a[d-f]:{V:[],M:new Map};g.V.push(l),YI.has(l)||qf.set(l,g)});for(let{V:l,M:d}of new Set(qf.values())){let f=[];for(let h of l){let p=ph.filter(w=>Hy(w,h)),y=f.find(({G:w})=>p.some(I=>w.has(I)));y||(y={G:new Set,V:[]},f.push(y)),y.V.push(h),n(y.G,p)}let g=f.flatMap(h=>mA(h.G));for(let{G:h,V:p}of f){let y=new Set(g.filter(w=>!h.has(w)));for(let w of p)d.set(w,y)}}xl=new Set;let c=new Set;const u=l=>xl.has(l)?c.add(l):xl.add(l);for(let l of ph){for(let d of l.P)u(d);for(let d of l.Q)u(d)}for(let l of xl)!qf.has(l)&&!c.has(l)&&qf.set(l,_7);n(xl,w7(xl)),uk=Lwe(t).map(l=>e1e.from(l)).sort(qwe),wP=new Map;for(let l of uk){let d=[wP];for(let f of l){let g=d.map(h=>{let p=h.get(f);return p||(p=new Map,h.set(f,p)),p});f===v7?d.push(...g):d=g}for(let f of d)f.V=l}}function ZO(t){return(I7(t)?"":`${YO(uC([t]))} `)+h7(t)}function YO(t){return`"${t}"‎`}function t1e(t){if(t.length>=4&&t[2]==ck&&t[3]==ck)throw new Error(`invalid label extension: "${vp(t.slice(0,4))}"`)}function r1e(t){for(let r=t.lastIndexOf(95);r>0;)if(t[--r]!==95)throw new Error("underscore allowed only at start")}function n1e(t){let e=t[0],r=ik.get(e);if(r)throw Lm(`leading ${r}`);let n=t.length,s=-1;for(let i=1;i<n;i++){e=t[i];let o=ik.get(e);if(o){if(s==i)throw Lm(`${r} + ${o}`);s=i+1,r=o}}if(s==n)throw Lm(`trailing ${r}`)}function uC(t,e=1/0,r=h7){let n=[];s1e(t[0])&&n.push("◌"),t.length>e&&(e>>=1,t=[...t.slice(0,e),8230,...t.slice(-e)]);let s=0,i=t.length;for(let o=0;o<i;o++){let a=t[o];
270I7(a)&&(n.push(vp(t.slice(s,o))),n.push(r(a)),s=o+1)}return n.push(vp(t.slice(s,i))),n.join("")}function s1e(t){return KO(),Yl.has(t)}function I7(t){return KO(),C7.has(t)}function i1e(t){return u1e(o1e(t,Xwe,f1e))}function o1e(t,e,r){if(!t)return[];KO();let n=0;return t.split(E7).map(s=>{let i=Hwe(s),o={input:i,offset:n};n+=i.length+1;try{let a=o.tokens=d1e(i,e,r),c=a.length,u;if(!c)throw new Error("empty label");let l=o.output=a.flat();if(r1e(l),!(o.emoji=c>1||a[0].is_emoji)&&l.every(f=>f<128))t1e(l),u="ASCII";else{let f=a.flatMap(g=>g.is_emoji?[]:g);if(!f.length)u="Emoji";else{if(Yl.has(l[0]))throw Lm("leading combining mark");for(let p=1;p<c;p++){let y=a[p];if(!y.is_emoji&&Yl.has(y[0]))throw Lm(`emoji + combining mark: "${vp(a[p-1])} + ${uC([y[0]])}"`)}n1e(l);let g=mA(new Set(f)),[h]=c1e(g);l1e(h,f),a1e(h,g),u=h.N}}o.type=u}catch(a){o.error=a}return o})}function a1e(t,e){let r,n=[];for(let s of e){let i=qf.get(s);if(i===_7)return;if(i){let o=i.M.get(s);if(r=r?r.filter(a=>o.has(a)):mA(o),!r.length)return}else n.push(s)}if(r){for(let s of r)if(n.every(i=>Hy(s,i)))throw new Error(`whole-script confusable: ${t.N}/${s.N}`)}}function c1e(t){let e=ph;for(let r of t){let n=e.filter(s=>Hy(s,r));if(!n.length)throw ph.some(s=>Hy(s,r))?T7(e[0],r):S7(r);if(e=n,n.length==1)break}return e}function u1e(t){return t.map(({input:e,error:r,output:n})=>{if(r){let s=r.message;throw new Error(t.length==1?s:`Invalid label ${YO(uC(e,63))}: ${s}`)}return vp(n)}).join(E7)}function S7(t){return new Error(`disallowed character: ${ZO(t)}`)}function T7(t,e){let r=ZO(e),n=ph.find(s=>s.P.has(e));return n&&(r=`${n.N} ${r}`),new Error(`illegal mixture: ${t.N} + ${r}`)}function Lm(t){return new Error(`illegal placement: ${t}`)}function l1e(t,e){for(let r of e)if(!Hy(t,r))throw T7(t,r);if(t.M){let r=w7(e);for(let n=1,s=r.length;n<s;n++)if(bP.has(r[n])){let i=n+1;for(let o;i<s&&bP.has(o=r[i]);i++)for(let a=n;a<i;a++)if(r[a]==o)throw new Error(`duplicate non-spacing marks: ${ZO(o)}`);if(i-n>ok)throw new Error(`excessive non-spacing marks: ${YO(uC(r.slice(n-1,i)))} (${i-n}/${ok})`);n=i}}}function d1e(t,e,r){let n=[],s=[];for(t=t.slice().reverse();t.length;){let i=h1e(t);if(i)s.length&&(n.push(e(s)),s=[]),n.push(r(i));else{let o=t.pop();if(xl.has(o))s.push(o);else{let a=yP.get(o);if(a)s.push(...a);else if(!A7.has(o))throw S7(o)}}}return s.length&&n.push(e(s)),n}function f1e(t){return t.filter(e=>e!=v7)}function h1e(t,e){let r=wP,n,s=t.length;for(;s&&(r=r.get(t[--s]),!!r);){let{V:i}=r;i&&(n=i,t.length=s)}return n}const P7=new Uint8Array(32);P7.fill(0);function lk(t){return Q(t.length!==0,"invalid ENS name; empty component","comp",t),t}function O7(t){const e=Fo(p1e(t)),r=[];if(t.length===0)return r;let n=0;for(let s=0;s<e.length;s++)e[s]===46&&(r.push(lk(e.slice(n,s))),n=s+1);return Q(n<e.length,"invalid ENS name; empty component","name",t),r.push(lk(e.slice(n))),r}function p1e(t){try{if(t.length===0)throw new Error("empty label");return i1e(t)}catch(e){Q(!1,`invalid ENS name (${e.message})`,"name",t)}}function EP(t){Q(typeof t=="string","invalid ENS name; not a string","name",t),Q(t.length,"invalid ENS name (empty label)","name",t);let e=P7;const r=O7(t);for(;r.length;)e=Br(Pr([e,Br(r.pop())]));return De(e)}function g1e(t,e){const r=e;return Q(r<=255,"DNS encoded label cannot exceed 255","length",r),De(Pr(O7(t).map(n=>{Q(n.length<=r,`label ${JSON.stringify(t)} exceeds ${r} bytes`,"name",t);const s=new Uint8Array(n.length+1);return s.set(n,1),s[0]=s.length-1,s})))+"00"}function JI(t,e){return{address:Dt(t),storageKeys:e.map((r,n)=>(Q(zt(r,32),"invalid slot",`storageKeys[${n}]`,r),r.toLowerCase()))}}function Jd(t){if(Array.isArray(t))return t.map((r,n)=>Array.isArray(r)?(Q(r.length===2,"invalid slot set",`value[${n}]`,r),JI(r[0],r[1])):(Q(r!=null&&typeof r=="object","invalid address-slot set","value",t),JI(r.address,r.storageKeys)));Q(t!=null&&typeof t=="object","invalid access list","value",t);const e=Object.keys(t).map(r=>{const n=t[r].reduce((s,i)=>(s[i]=!0,s),{});return JI(r,Object.keys(n).sort())});return e.sort((r,n)=>r.address.localeCompare(n.address)),e}function m1e(t){let e;return typeof t=="string"?e=My.computePublicKey(t,!1):e=t.publicKey,Dt(Br("0x"+e.substring(4)).substring(26))}function y1e(t,e){return m1e(My.recoverPublicKey(t,e))}const Kr=BigInt(0),b1e=BigInt(2),w1e=BigInt(27),E1e=BigInt(28),v1e=BigInt(35),_1e=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),QI=4096*32;function dk(t,e){let r=t.toString(16);for(;r.length<2;)r="0"+r;return r+=Rp(e).substring(4),"0x"+r}function lC(t){return t==="0x"?null:Dt(t)}function JO(t,e){try{return Jd(t)}catch(r){Q(!1,r.message,e,t)}}function S0(t,e){return t==="0x"?0:nt(t,e)}function Sr(t,e){if(t==="0x")return Kr;const r=$e(t,e);return Q(r<=_1e,"value exceeds uint size",e,r),r}function tr(t,e){const r=$e(t,"value"),n=zn(r);return Q(n.length<=32,"value too large",`tx.${e}`,r),n}function QO(t){return Jd(t).map(e=>[e.address,e.storageKeys])}function A1e(t,e){Q(Array.isArray(t),`invalid ${e}`,"value",t);for(let r=0;r<t.length;r++)Q(zt(t[r],32),"invalid ${ param } hash",`value[${r}]`,t[r]);return t}function C1e(t){const e=iC(t);Q(Array.isArray(e)&&(e.length===9||e.length===6),"invalid field count for legacy transaction","data",t);const r={type:0,nonce:S0(e[0],"nonce"),gasPrice:Sr(e[1],"gasPrice"),gasLimit:Sr(e[2],"gasLim
270it"),to:lC(e[3]),value:Sr(e[4],"value"),data:De(e[5]),chainId:Kr};if(e.length===6)return r;const n=Sr(e[6],"v"),s=Sr(e[7],"r"),i=Sr(e[8],"s");if(s===Kr&&i===Kr)r.chainId=n;else{let o=(n-v1e)/b1e;o<Kr&&(o=Kr),r.chainId=o,Q(o!==Kr||n===w1e||n===E1e,"non-canonical legacy v","v",e[6]),r.signature=Yi.from({r:Dd(e[7],32),s:Dd(e[8],32),v:n})}return r}function I1e(t,e){const r=[tr(t.nonce,"nonce"),tr(t.gasPrice||0,"gasPrice"),tr(t.gasLimit,"gasLimit"),t.to||"0x",tr(t.value,"value"),t.data];let n=Kr;if(t.chainId!=Kr)n=$e(t.chainId,"tx.chainId"),Q(!e||e.networkV==null||e.legacyChainId===n,"tx.chainId/sig.v mismatch","sig",e);else if(t.signature){const i=t.signature.legacyChainId;i!=null&&(n=i)}if(!e)return n!==Kr&&(r.push(zn(n)),r.push("0x"),r.push("0x")),Ud(r);let s=BigInt(27+e.yParity);return n!==Kr?s=Yi.getChainIdV(n,e.v):BigInt(e.v)!==s&&Q(!1,"tx.chainId/sig.v mismatch","sig",e),r.push(zn(s)),r.push(zn(e.r)),r.push(zn(e.s)),Ud(r)}function XO(t,e){let r;try{if(r=S0(e[0],"yParity"),r!==0&&r!==1)throw new Error("bad yParity")}catch{Q(!1,"invalid yParity","yParity",e[0])}const n=Dd(e[1],32),s=Dd(e[2],32),i=Yi.from({r:n,s,yParity:r});t.signature=i}function S1e(t){const e=iC(Ct(t).slice(1));Q(Array.isArray(e)&&(e.length===9||e.length===12),"invalid field count for transaction type: 2","data",De(t));const r={type:2,chainId:Sr(e[0],"chainId"),nonce:S0(e[1],"nonce"),maxPriorityFeePerGas:Sr(e[2],"maxPriorityFeePerGas"),maxFeePerGas:Sr(e[3],"maxFeePerGas"),gasPrice:null,gasLimit:Sr(e[4],"gasLimit"),to:lC(e[5]),value:Sr(e[6],"value"),data:De(e[7]),accessList:JO(e[8],"accessList")};return e.length===9||XO(r,e.slice(9)),r}function T1e(t,e){const r=[tr(t.chainId,"chainId"),tr(t.nonce,"nonce"),tr(t.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),tr(t.maxFeePerGas||0,"maxFeePerGas"),tr(t.gasLimit,"gasLimit"),t.to||"0x",tr(t.value,"value"),t.data,QO(t.accessList||[])];return e&&(r.push(tr(e.yParity,"yParity")),r.push(zn(e.r)),r.push(zn(e.s))),Pr(["0x02",Ud(r)])}function P1e(t){const e=iC(Ct(t).slice(1));Q(Array.isArray(e)&&(e.length===8||e.length===11),"invalid field count for transaction type: 1","data",De(t));const r={type:1,chainId:Sr(e[0],"chainId"),nonce:S0(e[1],"nonce"),gasPrice:Sr(e[2],"gasPrice"),gasLimit:Sr(e[3],"gasLimit"),to:lC(e[4]),value:Sr(e[5],"value"),data:De(e[6]),accessList:JO(e[7],"accessList")};return e.length===8||XO(r,e.slice(8)),r}function O1e(t,e){const r=[tr(t.chainId,"chainId"),tr(t.nonce,"nonce"),tr(t.gasPrice||0,"gasPrice"),tr(t.gasLimit,"gasLimit"),t.to||"0x",tr(t.value,"value"),t.data,QO(t.accessList||[])];return e&&(r.push(tr(e.yParity,"recoveryParam")),r.push(zn(e.r)),r.push(zn(e.s))),Pr(["0x01",Ud(r)])}function N1e(t){let e=iC(Ct(t).slice(1)),r="3",n=null;if(e.length===4&&Array.isArray(e[0])){r="3 (network format)";const i=e[1],o=e[2],a=e[3];Q(Array.isArray(i),"invalid network format: blobs not an array","fields[1]",i),Q(Array.isArray(o),"invalid network format: commitments not an array","fields[2]",o),Q(Array.isArray(a),"invalid network format: proofs not an array","fields[3]",a),Q(i.length===o.length,"invalid network format: blobs/commitments length mismatch","fields",e),Q(i.length===a.length,"invalid network format: blobs/proofs length mismatch","fields",e),n=[];for(let c=0;c<e[1].length;c++)n.push({data:i[c],commitment:o[c],proof:a[c]});e=e[0]}Q(Array.isArray(e)&&(e.length===11||e.length===14),`invalid field count for transaction type: ${r}`,"data",De(t));const s={type:3,chainId:Sr(e[0],"chainId"),nonce:S0(e[1],"nonce"),maxPriorityFeePerGas:Sr(e[2],"maxPriorityFeePerGas"),maxFeePerGas:Sr(e[3],"maxFeePerGas"),gasPrice:null,gasLimit:Sr(e[4],"gasLimit"),to:lC(e[5]),value:Sr(e[6],"value"),data:De(e[7]),accessList:JO(e[8],"accessList"),maxFeePerBlobGas:Sr(e[9],"maxFeePerBlobGas"),blobVersionedHashes:e[10]};n&&(s.blobs=n),Q(s.to!=null,`invalid address for transaction type: ${r}`,"data",t),Q(Array.isArray(s.blobVersionedHashes),"invalid blobVersionedHashes: must be an array","data",t);for(let i=0;i<s.blobVersionedHashes.length;i++)Q(zt(s.blobVersionedHashes[i],32),`invalid blobVersionedHash at index ${i}: must be length 32`,"data",t);return e.length===11||XO(s,e.slice(11)),s}function x1e(t,e,r){const n=[tr(t.chainId,"chainId"),tr(t.nonce,"nonce"),tr(t.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),tr(t.maxFeePerGas||0,"maxFeePerGas"),tr(t.gasLimit,"gasLimit"),t.to||Uy,tr(t.value,"value"),t.data,QO(t.accessList||[]),tr(t.maxFeePerBlobGas||0,"maxFeePerBlobGas"),A1e(t.blobVersionedHashes||[],"blobVersionedHashes")];return e&&(n.push(tr(e.yParity,"yParity")),n.push(zn(e.r)),n.push(zn(e.s)),r)?Pr(["0x03",Ud([n,r.map(s=>s.data),r.map(s=>s.commitment),r.map(s=>s.proof)])]):Pr(["0x03",Ud(n)])}var Eo,Nh,xh,Rh,Bh,kh,jh,Dh,Uh,Mh,$h,Lh,ud,ou,Fa,au,Fh,w_;const Ba=class Ba{constructor(){ne(this,Fh);ne(this,Eo);ne(this,Nh);ne(this,xh);ne(this,Rh);ne(this,Bh);ne(this,kh);ne(this,jh);ne(this,Dh);ne(this,Uh);ne(this,Mh);ne(this,$h);ne(this,Lh);ne(this,ud);ne(this,ou);ne(this,Fa);ne(this,au);W(this,Eo,null),W(this,Nh,null),W(this,Rh,0),W(this,Bh,Kr),W(this,kh,null),W(this,jh,null),W(this,Dh,null),W(this,xh,"0x"),W(this,Uh,Kr),W(this,Mh,Kr),W(this,$h,null),W(this,Lh,null),W(this,ud,null),W(this,ou,null),W(this,au,null),W(this,Fa,null)}get type(){return $(this,Eo)}set type(e){switch(e){case null:W(this,Eo,null);break;case 0:case"legacy":W(this,Eo,0);break;case 1:case"berlin":case"eip-2930":W(this,Eo,1);break;
270case 2:case"london":case"eip-1559":W(this,Eo,2);break;case 3:case"cancun":case"eip-4844":W(this,Eo,3);break;default:Q(!1,"unsupported transaction type","type",e)}}get typeName(){switch(this.type){case 0:return"legacy";case 1:return"eip-2930";case 2:return"eip-1559";case 3:return"eip-4844"}return null}get to(){const e=$(this,Nh);return e==null&&this.type===3?Uy:e}set to(e){W(this,Nh,e==null?null:Dt(e))}get nonce(){return $(this,Rh)}set nonce(e){W(this,Rh,nt(e,"value"))}get gasLimit(){return $(this,Bh)}set gasLimit(e){W(this,Bh,$e(e))}get gasPrice(){const e=$(this,kh);return e==null&&(this.type===0||this.type===1)?Kr:e}set gasPrice(e){W(this,kh,e==null?null:$e(e,"gasPrice"))}get maxPriorityFeePerGas(){const e=$(this,jh);return e??(this.type===2||this.type===3?Kr:null)}set maxPriorityFeePerGas(e){W(this,jh,e==null?null:$e(e,"maxPriorityFeePerGas"))}get maxFeePerGas(){const e=$(this,Dh);return e??(this.type===2||this.type===3?Kr:null)}set maxFeePerGas(e){W(this,Dh,e==null?null:$e(e,"maxFeePerGas"))}get data(){return $(this,xh)}set data(e){W(this,xh,De(e))}get value(){return $(this,Uh)}set value(e){W(this,Uh,$e(e,"value"))}get chainId(){return $(this,Mh)}set chainId(e){W(this,Mh,$e(e))}get signature(){return $(this,$h)||null}set signature(e){W(this,$h,e==null?null:Yi.from(e))}get accessList(){const e=$(this,Lh)||null;return e??(this.type===1||this.type===2||this.type===3?[]:null)}set accessList(e){W(this,Lh,e==null?null:Jd(e))}get maxFeePerBlobGas(){const e=$(this,ud);return e==null&&this.type===3?Kr:e}set maxFeePerBlobGas(e){W(this,ud,e==null?null:$e(e,"maxFeePerBlobGas"))}get blobVersionedHashes(){let e=$(this,ou);return e==null&&this.type===3?[]:e}set blobVersionedHashes(e){if(e!=null){Q(Array.isArray(e),"blobVersionedHashes must be an Array","value",e),e=e.slice();for(let r=0;r<e.length;r++)Q(zt(e[r],32),"invalid blobVersionedHash",`value[${r}]`,e[r])}W(this,ou,e)}get blobs(){return $(this,au)==null?null:$(this,au).map(e=>Object.assign({},e))}set blobs(e){if(e==null){W(this,au,null);return}const r=[],n=[];for(let s=0;s<e.length;s++){const i=e[s];if(MO(i)){ue($(this,Fa),"adding a raw blob requires a KZG library","UNSUPPORTED_OPERATION",{operation:"set blobs()"});let o=Ct(i);if(Q(o.length<=QI,"blob is too large",`blobs[${s}]`,i),o.length!==QI){const u=new Uint8Array(QI);u.set(o),o=u}const a=$(this,Fa).blobToKzgCommitment(o),c=De($(this,Fa).computeBlobKzgProof(o,a));r.push({data:De(o),commitment:De(a),proof:c}),n.push(dk(1,a))}else{const o=De(i.commitment);r.push({data:De(i.data),commitment:o,proof:De(i.proof)}),n.push(dk(1,o))}}W(this,au,r),W(this,ou,n)}get kzg(){return $(this,Fa)}set kzg(e){W(this,Fa,e)}get hash(){return this.signature==null?null:Br(ge(this,Fh,w_).call(this,!0,!1))}get unsignedHash(){return Br(this.unsignedSerialized)}get from(){return this.signature==null?null:y1e(this.unsignedHash,this.signature)}get fromPublicKey(){return this.signature==null?null:My.recoverPublicKey(this.unsignedHash,this.signature)}isSigned(){return this.signature!=null}get serialized(){return ge(this,Fh,w_).call(this,!0,!0)}get unsignedSerialized(){return ge(this,Fh,w_).call(this,!1,!1)}inferType(){const e=this.inferTypes();return e.indexOf(2)>=0?2:e.pop()}inferTypes(){const e=this.gasPrice!=null,r=this.maxFeePerGas!=null||this.maxPriorityFeePerGas!=null,n=this.accessList!=null,s=$(this,ud)!=null||$(this,ou);this.maxFeePerGas!=null&&this.maxPriorityFeePerGas!=null&&ue(this.maxFeePerGas>=this.maxPriorityFeePerGas,"priorityFee cannot be more than maxFee","BAD_DATA",{value:this}),ue(!r||this.type!==0&&this.type!==1,"transaction type cannot have maxFeePerGas or maxPriorityFeePerGas","BAD_DATA",{value:this}),ue(this.type!==0||!n,"legacy transaction cannot have accessList","BAD_DATA",{value:this});const i=[];return this.type!=null?i.push(this.type):r?i.push(2):e?(i.push(1),n||i.push(0)):n?(i.push(1),i.push(2)):(s&&this.to||(i.push(0),i.push(1),i.push(2)),i.push(3)),i.sort(),i}isLegacy(){return this.type===0}isBerlin(){return this.type===1}isLondon(){return this.type===2}isCancun(){return this.type===3}clone(){return Ba.from(this)}toJSON(){const e=r=>r==null?null:r.toString();
270return{type:this.type,to:this.to,data:this.data,nonce:this.nonce,gasLimit:e(this.gasLimit),gasPrice:e(this.gasPrice),maxPriorityFeePerGas:e(this.maxPriorityFeePerGas),maxFeePerGas:e(this.maxFeePerGas),value:e(this.value),chainId:e(this.chainId),sig:this.signature?this.signature.toJSON():null,accessList:this.accessList}}static from(e){if(e==null)return new Ba;if(typeof e=="string"){const n=Ct(e);if(n[0]>=127)return Ba.from(C1e(n));switch(n[0]){case 1:return Ba.from(P1e(n));case 2:return Ba.from(S1e(n));case 3:return Ba.from(N1e(n))}ue(!1,"unsupported transaction type","UNSUPPORTED_OPERATION",{operation:"from"})}const r=new Ba;return e.type!=null&&(r.type=e.type),e.to!=null&&(r.to=e.to),e.nonce!=null&&(r.nonce=e.nonce),e.gasLimit!=null&&(r.gasLimit=e.gasLimit),e.gasPrice!=null&&(r.gasPrice=e.gasPrice),e.maxPriorityFeePerGas!=null&&(r.maxPriorityFeePerGas=e.maxPriorityFeePerGas),e.maxFeePerGas!=null&&(r.maxFeePerGas=e.maxFeePerGas),e.maxFeePerBlobGas!=null&&(r.maxFeePerBlobGas=e.maxFeePerBlobGas),e.data!=null&&(r.data=e.data),e.value!=null&&(r.value=e.value),e.chainId!=null&&(r.chainId=e.chainId),e.signature!=null&&(r.signature=Yi.from(e.signature)),e.accessList!=null&&(r.accessList=e.accessList),e.blobVersionedHashes!=null&&(r.blobVersionedHashes=e.blobVersionedHashes),e.kzg!=null&&(r.kzg=e.kzg),e.blobs!=null&&(r.blobs=e.blobs),e.hash!=null&&(Q(r.isSigned(),"unsigned transaction cannot define '.hash'","tx",e),Q(r.hash===e.hash,"hash mismatch","tx",e)),e.from!=null&&(Q(r.isSigned(),"unsigned transaction cannot define '.from'","tx",e),Q(r.from.toLowerCase()===(e.from||"").toLowerCase(),"from mismatch","tx",e)),r}};Eo=new WeakMap,Nh=new WeakMap,xh=new WeakMap,Rh=new WeakMap,Bh=new WeakMap,kh=new WeakMap,jh=new WeakMap,Dh=new WeakMap,Uh=new WeakMap,Mh=new WeakMap,$h=new WeakMap,Lh=new WeakMap,ud=new WeakMap,ou=new WeakMap,Fa=new WeakMap,au=new WeakMap,Fh=new WeakSet,w_=function(e,r){ue(!e||this.signature!=null,"cannot serialize unsigned transaction; maybe you meant .unsignedSerialized","UNSUPPORTED_OPERATION",{operation:".serialized"});const n=e?this.signature:null;switch(this.inferType()){case 0:return I1e(this,n);case 1:return O1e(this,n);case 2:return T1e(this,n);case 3:return x1e(this,n,r?this.blobs:null)}ue(!1,"unsupported transaction type","UNSUPPORTED_OPERATION",{operation:".serialized"})};let yA=Ba;const N7=new Uint8Array(32);N7.fill(0);const R1e=BigInt(-1),x7=BigInt(0),R7=BigInt(1),B1e=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");function k1e(t){const e=Ct(t),r=e.length%32;return r?Pr([e,N7.slice(r)]):De(e)}const j1e=ju(R7,32),D1e=ju(x7,32),fk={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},XI=["name","version","chainId","verifyingContract","salt"];function hk(t){return function(e){return Q(typeof e=="string",`invalid domain value for ${JSON.stringify(t)}`,`domain.${t}`,e),e}}const U1e={name:hk("name"),version:hk("version"),chainId:function(t){const e=$e(t,"domain.chainId");return Q(e>=0,"invalid chain ID","domain.chainId",t),Number.isSafeInteger(e)?Number(e):Xf(e)},verifyingContract:function(t){try{return Dt(t).toLowerCase()}catch{}Q(!1,'invalid domain value "verifyingContract"',"domain.verifyingContract",t)},salt:function(t){const e=Ct(t,"domain.salt");return Q(e.length===32,'invalid domain value "salt"',"domain.salt",t),De(e)}};function eS(t){{const e=t.match(/^(u?)int(\d+)$/);if(e){const r=e[1]==="",n=parseInt(e[2]);Q(n%8===0&&n!==0&&n<=256&&e[2]===String(n),"invalid numeric width","type",t);const s=Kl(B1e,r?n-1:n),i=r?(s+R7)*R1e:x7;return function(o){const a=$e(o,"value");return Q(a>=i&&a<=s,`value out-of-bounds for ${t}`,"value",a),ju(r?yq(a,256):a,32)}}}{const e=t.match(/^bytes(\d+)$/);if(e){const r=parseInt(e[1]);return Q(r!==0&&r<=32&&e[1]===String(r),"invalid bytes width","type",t),function(n){const s=Ct(n);return Q(s.length===r,`invalid length for ${t}`,"value",n),k1e(n)}}}switch(t){case"address":return function(e){return Dd(Dt(e),32)};case"bool":return function(e){return e?j1e:D1e};case"bytes":return function(e){return Br(e)};case"string":return function(e){return Md(e)}}return null}function pk(t,e){return`${t}(${e.map(({name:r,type:n})=>n+" "+r).join(",")})`}function Hb(t){const e=t.match(/^([^\x5b]*)((\x5b\d*\x5d)*)(\x5b(\d*)\x5d)$/);return e?{base:e[1],index:e[2]+e[4],array:{base:e[1],prefix:e[1]+e[2],count:e[5]?parseInt(e[5]):-1}}:{base:t}}var Zy,Ha,Hh,CA,B7;const ri=class ri{constructor(e){ne(this,CA);K(this,"primaryType");
270ne(this,Zy);ne(this,Ha);ne(this,Hh);W(this,Ha,new Map),W(this,Hh,new Map);const r=new Map,n=new Map,s=new Map,i={};Object.keys(e).forEach(c=>{i[c]=e[c].map(({name:u,type:l})=>{let{base:d,index:f}=Hb(l);return d==="int"&&!e.int&&(d="int256"),d==="uint"&&!e.uint&&(d="uint256"),{name:u,type:d+(f||"")}}),r.set(c,new Set),n.set(c,[]),s.set(c,new Set)}),W(this,Zy,JSON.stringify(i));for(const c in i){const u=new Set;for(const l of i[c]){Q(!u.has(l.name),`duplicate variable name ${JSON.stringify(l.name)} in ${JSON.stringify(c)}`,"types",e),u.add(l.name);const d=Hb(l.type).base;Q(d!==c,`circular type reference to ${JSON.stringify(d)}`,"types",e),!eS(d)&&(Q(n.has(d),`unknown type ${JSON.stringify(d)}`,"types",e),n.get(d).push(c),r.get(c).add(d))}}const o=Array.from(n.keys()).filter(c=>n.get(c).length===0);Q(o.length!==0,"missing primary type","types",e),Q(o.length===1,`ambiguous primary types or unused types: ${o.map(c=>JSON.stringify(c)).join(", ")}`,"types",e),Ge(this,{primaryType:o[0]});function a(c,u){Q(!u.has(c),`circular type reference to ${JSON.stringify(c)}`,"types",e),u.add(c);for(const l of r.get(c))if(n.has(l)){a(l,u);for(const d of u)s.get(d).add(l)}u.delete(c)}a(this.primaryType,new Set);for(const[c,u]of s){const l=Array.from(u);l.sort(),$(this,Ha).set(c,pk(c,i[c])+l.map(d=>pk(d,i[d])).join(""))}}get types(){return JSON.parse($(this,Zy))}getEncoder(e){let r=$(this,Hh).get(e);return r||(r=ge(this,CA,B7).call(this,e),$(this,Hh).set(e,r)),r}encodeType(e){const r=$(this,Ha).get(e);return Q(r,`unknown type: ${JSON.stringify(e)}`,"name",e),r}encodeData(e,r){return this.getEncoder(e)(r)}hashStruct(e,r){return Br(this.encodeData(e,r))}encode(e){return this.encodeData(this.primaryType,e)}hash(e){return this.hashStruct(this.primaryType,e)}_visit(e,r,n){if(eS(e))return n(e,r);const s=Hb(e).array;if(s)return Q(s.count===-1||s.count===r.length,`array length mismatch; expected length ${s.count}`,"value",r),r.map(o=>this._visit(s.prefix,o,n));const i=this.types[e];if(i)return i.reduce((o,{name:a,type:c})=>(o[a]=this._visit(c,r[a],n),o),{});Q(!1,`unknown type: ${e}`,"type",e)}visit(e,r){return this._visit(this.primaryType,e,r)}static from(e){return new ri(e)}static getPrimaryType(e){return ri.from(e).primaryType}static hashStruct(e,r,n){return ri.from(r).hashStruct(e,n)}static hashDomain(e){const r=[];for(const n in e){if(e[n]==null)continue;const s=fk[n];Q(s,`invalid typed-data domain key: ${JSON.stringify(n)}`,"domain",e),r.push({name:n,type:s})}return r.sort((n,s)=>XI.indexOf(n.name)-XI.indexOf(s.name)),ri.hashStruct("EIP712Domain",{EIP712Domain:r},e)}static encode(e,r,n){return Pr(["0x1901",ri.hashDomain(e),ri.from(r).hash(n)])}static hash(e,r,n){return Br(ri.encode(e,r,n))}static async resolveNames(e,r,n,s){e=Object.assign({},e);for(const a in e)e[a]==null&&delete e[a];const i={};e.verifyingContract&&!zt(e.verifyingContract,20)&&(i[e.verifyingContract]="0x");const o=ri.from(r);o.visit(n,(a,c)=>(a==="address"&&!zt(c,20)&&(i[c]="0x"),c));for(const a in i)i[a]=await s(a);return e.verifyingContract&&i[e.verifyingContract]&&(e.verifyingContract=i[e.verifyingContract]),n=o.visit(n,(a,c)=>a==="address"&&i[c]?i[c]:c),{domain:e,value:n}}static getPayload(e,r,n){ri.hashDomain(e);const s={},i=[];XI.forEach(c=>{const u=e[c];u!=null&&(s[c]=U1e[c](u),i.push({name:c,type:fk[c]}))});const o=ri.from(r);r=o.types;const a=Object.assign({},r);return Q(a.EIP712Domain==null,"types must not contain EIP712Domain type","types.EIP712Domain",r),a.EIP712Domain=i,o.encode(n),{types:a,domain:s,primaryType:o.primaryType,message:o.visit(n,(c,u)=>{if(c.match(/^bytes(\d*)/))return De(Ct(u));if(c.match(/^u?int/))return $e(u).toString();switch(c){case"address":return u.toLowerCase();case"bool":return!!u;case"string":return Q(typeof u=="string","invalid string","value",u),u}Q(!1,"unsupported type","type",c)})}}};Zy=new WeakMap,Ha=new WeakMap,Hh=new WeakMap,CA=new WeakSet,B7=function(e){{const s=eS(e);if(s)return s}const r=Hb(e).array;if(r){const s=r.prefix,i=this.getEncoder(s);return o=>{Q(r.count===-1||r.count===o.length,`array length mismatch; expected length ${r.count}`,"value",o);let a=o.map(i);return $(this,Ha).has(s)&&(a=a.map(Br)),Br(Pr(a))}}const n=this.types[e];if(n){const s=Md($(this,Ha).get(e));return i=>{const o=n.map(({name:a,type:c})=>{const u=this.getEncoder(c)(i[a]);return $(this,Ha).has(c)?Br(u):u});return o.unshift(s),Pr(o)}}Q(!1,`unknown type: ${e}`,"type",e)};let bA=ri;function Gn(t){const e=new Set;return t.forEach(r=>e.add(r)),Object.freeze(e)}const M1e="external public payable override",$1e=Gn(M1e.split(" ")),k7="constant external internal payable private public pure view override",L1e=Gn(k7.split(" ")),j7="constructor error event fallback function receive struct",D7=Gn(j7.split(" ")),U7="calldata memory storage payable indexed",F1e=Gn(U7.split(" ")),H1e="tuple returns",q1e=[j7,U7,H1e,k7].join(" "),z1e=Gn(q1e.split(" ")),W1e={"(":"OPEN_PAREN",")":"CLOSE_PAREN","[":"OPEN_BRACKET","]":"CLOSE_BRACKET",",":"COMMA","@":"AT"},V1e=new RegExp("^(\\s*)"),G1e=new RegExp("^([0-9]+)"),K1e=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)"),M7=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)$"),$7=new RegExp("^(address|bool|bytes([0-9]*)|string|u?int([0-9]*))$");var on,$i,Yy,vP;const IA=class IA{constructor(e){ne(this,Yy);ne(this,on);ne(this,$i);W(this,on,0),W(this,$i,e.slice())}get offset(){return $(this,on)}get length(){return $(this,$i).length-$(this,on)}clone(){return new IA($(this,$i))}reset(){W(this,on,0)}popKeyword(e){const r=this.peek();if(r.type!=="KEYWORD"||!e.has(r.text))throw new Error(`expected keyword ${r.text}`);return this.pop().text}popType(e){if(this.peek().type!==e){const r=this.peek();throw new Error(`expected ${e}; got ${r.type} ${JSON.stringify(r.text)}`)}return this.pop().text}popParen(){const e=this.peek();if(e.type!=="OPEN_PAREN")throw new Error("bad start");const r=ge(this,Yy,vP).call(this,$(this,on)+1,e.match+1);return W(this,on,e.match+1),r}popParams(){const e=this.peek();if(e.type!=="OPEN_PAREN")throw new Error("bad start");const r=[];for(;$(this,on)<e.match-1;){const n=this.peek().linkNext;r.push(ge(this,Yy,vP).call(this,$(this,on)+1,n)),W(this,on,n)}return W(this,on,e.match+1),r}peek(){if($(this,on)>=$(this,$i).length)throw new Error("out-of-bounds");return $(this,$i)[$(this,on)]}peekKeyword(e){const r=this.peekType("KEYWORD");return r!=null&&e.has(r)?r:null}peekType(e){if(this.length===0)return null;const r=this.peek();return r.type===e?r.text:null}pop(){const e=this.peek();return zp(this,on)._++,e}toString(){const e=[];for(let r=$(this,on);r<$(this,$i).length;r++){const n=$(this,$i)[r];e.push(`${n.type}:${n.text}`)}return`<TokenString ${e.join(" ")}>`}};on=new WeakMap,$i=new WeakMap,Yy=new WeakSet,vP=function(e=0,r=0){return new IA($(this,$i).slice(e,r).map(n=>Object.freeze(Object.assign({},n,{match:n.match-e,linkBack:n.linkBack-e,linkNext:n.linkNext-e}))))};let Ji=IA;function Lu(t){const e=[],r=o=>{const a=i<t.length?JSON.stringify(t[i]):"$EOI";throw new Error(`invalid token ${a} at ${i}: ${o}`)};let n=[],s=[],i=0;for(;i<t.length;){let o=t.substring(i),a=o.match(V1e);a&&(i+=a[1].length,o=t.substring(i));const c={depth:n.length,linkBack:-1,linkNext:-1,match:-1,type:"",text:"",offset:i,value:-1};e.push(c);let u=W1e[o[0]]||"";if(u){if(c.type=u,c.text=o[0],i++,u==="OPEN_PAREN")n.push(e.length-1),s.push(e.length-1);else if(u=="CLOSE_PAREN")n.length===0&&r("no matching open bracket"),c.match=n.pop(),e[c.match].match=e.length-1,c.depth--,c.linkBack=s.pop(),e[c.linkBack].linkNext=e.length-1;else if(u==="COMMA")c.linkBack=s.pop(),e[c.linkBack].linkNext=e.length-1,s.push(e.length-1);else if(u==="OPEN_BRACKET")c.type="BRACKET";else if(u==="CLOSE_BRACKET"){let l=e.pop().text;if(e.length>0&&e[e.length-1].type==="NUMBER"){const d=e.pop().text;l=d+l,e[e.length-1].value=nt(d)}if(e.length===0||e[e.length-1].type!=="BRACKET")throw new Error("missing opening bracket");e[e.length-1].text+=l}continue}if(a=o.match(K1e),a){if(c.text=a[1],i+=c.text.length,z1e.has(c.text)){c.type="KEYWORD";continue}if(c.text.match($7)){c.type="TYPE";continue}c.type="ID";continue}if(a=o.match(G1e),a){c.text=a[1],c.type="NUMBER",i+=c.text.length;continue}throw new Error(`unexpected token ${JSON.stringify(o[0])} at position ${i}`)}return new Ji(e.map(o=>Object.freeze(o)))}function gk(t,e){let r=[];for(const n in e.keys())t.has(n)&&r.push(n);if(r.length>1)throw new Error(`conflicting types: ${r.join(", ")}`)}function dC(t,e){if(e.peekKeyword(D7)){const r=e.pop().text;if(r!==t)throw new Error(`expected ${t}, got ${r}`)}return e.popType("ID")}function lc(t,e){const r=new Set;for(;;){const n=t.peekType("KEYWORD");if(n==null||e&&!e.has(n))break;if(t.pop(),r.has(n))throw new Error(`duplicate keywords: ${JSON.stringify(n)}`);r.add(n)}return Object.freeze(r)}function L7(t){let e=lc(t,L1e);return gk(e,Gn("constant payable nonpayable".split(" "))),gk(e,Gn("pure view payable nonpayable".split(" "))),e.has("view")?"view":e.has("pure")?"pure":e.has("payable")?"payable":e.has("nonpayable")?"nonpayable":e.has("constant")?"view":"nonpayable"}function ic(t,e){return t.popParams().map(r=>un.from(r,e))}
270function F7(t){if(t.peekType("AT")){if(t.pop(),t.peekType("NUMBER"))return $e(t.pop().text);throw new Error("invalid gas")}return null}function $d(t){if(t.length)throw new Error(`unexpected tokens at offset ${t.offset}: ${t.toString()}`)}const Z1e=new RegExp(/^(.*)\[([0-9]*)\]$/);function mk(t){const e=t.match($7);if(Q(e,"invalid type","type",t),t==="uint")return"uint256";if(t==="int")return"int256";if(e[2]){const r=parseInt(e[2]);Q(r!==0&&r<=32,"invalid bytes length","type",t)}else if(e[3]){const r=parseInt(e[3]);Q(r!==0&&r<=256&&r%8===0,"invalid numeric width","type",t)}return t}const pr={},Es=Symbol.for("_ethers_internal"),yk="_ParamTypeInternal",bk="_ErrorInternal",wk="_EventInternal",Ek="_ConstructorInternal",vk="_FallbackInternal",_k="_FunctionInternal",Ak="_StructInternal";var qh,E_;const ni=class ni{constructor(e,r,n,s,i,o,a,c){ne(this,qh);K(this,"name");K(this,"type");K(this,"baseType");K(this,"indexed");K(this,"components");K(this,"arrayLength");K(this,"arrayChildren");if(C0(e,pr,"ParamType"),Object.defineProperty(this,Es,{value:yk}),o&&(o=Object.freeze(o.slice())),s==="array"){if(a==null||c==null)throw new Error("")}else if(a!=null||c!=null)throw new Error("");if(s==="tuple"){if(o==null)throw new Error("")}else if(o!=null)throw new Error("");Ge(this,{name:r,type:n,baseType:s,indexed:i,components:o,arrayLength:a,arrayChildren:c})}format(e){if(e==null&&(e="sighash"),e==="json"){const n=this.name||"";if(this.isArray()){const i=JSON.parse(this.arrayChildren.format("json"));return i.name=n,i.type+=`[${this.arrayLength<0?"":String(this.arrayLength)}]`,JSON.stringify(i)}const s={type:this.baseType==="tuple"?"tuple":this.type,name:n};return typeof this.indexed=="boolean"&&(s.indexed=this.indexed),this.isTuple()&&(s.components=this.components.map(i=>JSON.parse(i.format(e)))),JSON.stringify(s)}let r="";return this.isArray()?(r+=this.arrayChildren.format(e),r+=`[${this.arrayLength<0?"":String(this.arrayLength)}]`):this.isTuple()?r+="("+this.components.map(n=>n.format(e)).join(e==="full"?", ":",")+")":r+=this.type,e!=="sighash"&&(this.indexed===!0&&(r+=" indexed"),e==="full"&&this.name&&(r+=" "+this.name)),r}isArray(){return this.baseType==="array"}isTuple(){return this.baseType==="tuple"}isIndexable(){return this.indexed!=null}walk(e,r){if(this.isArray()){if(!Array.isArray(e))throw new Error("invalid array value");if(this.arrayLength!==-1&&e.length!==this.arrayLength)throw new Error("array is wrong length");const n=this;return e.map(s=>n.arrayChildren.walk(s,r))}if(this.isTuple()){if(!Array.isArray(e))throw new Error("invalid tuple value");if(e.length!==this.components.length)throw new Error("array is wrong length");const n=this;return e.map((s,i)=>n.components[i].walk(s,r))}return r(this.type,e)}async walkAsync(e,r){const n=[],s=[e];return ge(this,qh,E_).call(this,n,e,r,i=>{s[0]=i}),n.length&&await Promise.all(n),s[0]}static from(e,r){if(ni.isParamType(e))return e;if(typeof e=="string")try{return ni.from(Lu(e),r)}catch{Q(!1,"invalid param type","obj",e)}else if(e instanceof Ji){let a="",c="",u=null;lc(e,Gn(["tuple"])).has("tuple")||e.peekType("OPEN_PAREN")?(c="tuple",u=e.popParams().map(p=>ni.from(p)),a=`tuple(${u.map(p=>p.format()).join(",")})`):(a=mk(e.popType("TYPE")),c=a);let l=null,d=null;for(;e.length&&e.peekType("BRACKET");){const p=e.pop();l=new ni(pr,"",a,c,null,u,d,l),d=p.value,a+=p.text,c="array",u=null}let f=null;if(lc(e,F1e).has("indexed")){if(!r)throw new Error("");f=!0}const h=e.peekType("ID")?e.pop().text:"";if(e.length)throw new Error("leftover tokens");return new ni(pr,h,a,c,f,u,d,l)}const n=e.name;Q(!n||typeof n=="string"&&n.match(M7),"invalid name","obj.name",n);let s=e.indexed;s!=null&&(Q(r,"parameter cannot be indexed","obj.indexed",e.indexed),s=!!s);let i=e.type,o=i.match(Z1e);if(o){const a=parseInt(o[2]||"-1"),c=ni.from({type:o[1],components:e.components});return new ni(pr,n||"",i,"array",s,null,a,c)}if(i==="tuple"||i.startsWith("tuple(")||i.startsWith("(")){const a=e.components!=null?e.components.map(u=>ni.from(u)):null;return new ni(pr,n||"",i,"tuple",s,a,null,null)}return i=mk(e.type),new ni(pr,n||"",i,i,s,null,null,null)}static isParamType(e){return e&&e[Es]===yk}};qh=new WeakSet,E_=function(e,r,n,s){if(this.isArray()){if(!Array.isArray(r))throw new Error("invalid array value");if(this.arrayLength!==-1&&r.length!==this.arrayLength)throw new Error("array is wrong length");const o=this.arrayChildren,a=r.slice();a.forEach((c,u)=>{var l;ge(l=o,qh,E_).call(l,e,c,n,d=>{a[u]=d})}),s(a);return}if(this.isTuple()){const o=this.components;let a;if(Array.isArray(r))a=r.slice();else{if(r==null||typeof r!="object")throw new Error("invalid tuple value");a=o.map(c=>{if(!c.name)throw new Error("cannot use object value with unnamed components");if(!(c.name in r))throw new Error(`missing value for component ${c.name}`);return r[c.name]})}if(a.length!==this.components.length)throw new Error("array is wrong length");a.forEach((c,u)=>{var l;ge(l=o[u],qh,E_).call(l,e,c,n,d=>{a[u]=d})}),s(a);return}const i=n(this.type,r);i.then?e.push(async function(){s(await i)}()):s(i)};let un=ni;class Ld{constructor(e,r,n){K(this,"type");
270K(this,"inputs");C0(e,pr,"Fragment"),n=Object.freeze(n.slice()),Ge(this,{type:r,inputs:n})}static from(e){if(typeof e=="string"){try{Ld.from(JSON.parse(e))}catch{}return Ld.from(Lu(e))}if(e instanceof Ji)switch(e.peekKeyword(D7)){case"constructor":return Xa.from(e);case"error":return ms.from(e);case"event":return xo.from(e);case"fallback":case"receive":return Da.from(e);case"function":return Ro.from(e);case"struct":return Cd.from(e)}else if(typeof e=="object"){switch(e.type){case"constructor":return Xa.from(e);case"error":return ms.from(e);case"event":return xo.from(e);case"fallback":case"receive":return Da.from(e);case"function":return Ro.from(e);case"struct":return Cd.from(e)}ue(!1,`unsupported type: ${e.type}`,"UNSUPPORTED_OPERATION",{operation:"Fragment.from"})}Q(!1,"unsupported frgament object","obj",e)}static isConstructor(e){return Xa.isFragment(e)}static isError(e){return ms.isFragment(e)}static isEvent(e){return xo.isFragment(e)}static isFunction(e){return Ro.isFragment(e)}static isStruct(e){return Cd.isFragment(e)}}class fC extends Ld{constructor(r,n,s,i){super(r,n,i);K(this,"name");Q(typeof s=="string"&&s.match(M7),"invalid identifier","name",s),i=Object.freeze(i.slice()),Ge(this,{name:s})}}function qy(t,e){return"("+e.map(r=>r.format(t)).join(t==="full"?", ":",")+")"}class ms extends fC{constructor(e,r,n){super(e,"error",r,n),Object.defineProperty(this,Es,{value:bk})}get selector(){return Md(this.format("sighash")).substring(0,10)}format(e){if(e==null&&(e="sighash"),e==="json")return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map(n=>JSON.parse(n.format(e)))});const r=[];return e!=="sighash"&&r.push("error"),r.push(this.name+qy(e,this.inputs)),r.join(" ")}static from(e){if(ms.isFragment(e))return e;if(typeof e=="string")return ms.from(Lu(e));if(e instanceof Ji){const r=dC("error",e),n=ic(e);return $d(e),new ms(pr,r,n)}return new ms(pr,e.name,e.inputs?e.inputs.map(un.from):[])}static isFragment(e){return e&&e[Es]===bk}}class xo extends fC{constructor(r,n,s,i){super(r,"event",n,s);K(this,"anonymous");Object.defineProperty(this,Es,{value:wk}),Ge(this,{anonymous:i})}get topicHash(){return Md(this.format("sighash"))}format(r){if(r==null&&(r="sighash"),r==="json")return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map(s=>JSON.parse(s.format(r)))});const n=[];return r!=="sighash"&&n.push("event"),n.push(this.name+qy(r,this.inputs)),r!=="sighash"&&this.anonymous&&n.push("anonymous"),n.join(" ")}static getTopicHash(r,n){return n=(n||[]).map(i=>un.from(i)),new xo(pr,r,n,!1).topicHash}static from(r){if(xo.isFragment(r))return r;if(typeof r=="string")try{return xo.from(Lu(r))}catch{Q(!1,"invalid event fragment","obj",r)}else if(r instanceof Ji){const n=dC("event",r),s=ic(r,!0),i=!!lc(r,Gn(["anonymous"])).has("anonymous");return $d(r),new xo(pr,n,s,i)}return new xo(pr,r.name,r.inputs?r.inputs.map(n=>un.from(n,!0)):[],!!r.anonymous)}static isFragment(r){return r&&r[Es]===wk}}class Xa extends Ld{constructor(r,n,s,i,o){super(r,n,s);K(this,"payable");K(this,"gas");Object.defineProperty(this,Es,{value:Ek}),Ge(this,{payable:i,gas:o})}format(r){if(ue(r!=null&&r!=="sighash","cannot format a constructor for sighash","UNSUPPORTED_OPERATION",{operation:"format(sighash)"}),r==="json")return JSON.stringify({type:"constructor",stateMutability:this.payable?"payable":"undefined",payable:this.payable,gas:this.gas!=null?this.gas:void 0,inputs:this.inputs.map(s=>JSON.parse(s.format(r)))});const n=[`constructor${qy(r,this.inputs)}`];return this.payable&&n.push("payable"),this.gas!=null&&n.push(`@${this.gas.toString()}`),n.join(" ")}static from(r){if(Xa.isFragment(r))return r;if(typeof r=="string")try{return Xa.from(Lu(r))}catch{Q(!1,"invalid constuctor fragment","obj",r)}else if(r instanceof Ji){lc(r,Gn(["constructor"]));const n=ic(r),s=!!lc(r,$1e).has("payable"),i=F7(r);return $d(r),new Xa(pr,"constructor",n,s,i)}return new Xa(pr,"constructor",r.inputs?r.inputs.map(un.from):[],!!r.payable,r.gas!=null?r.gas:null)}static isFragment(r){return r&&r[Es]===Ek}}class Da extends Ld{constructor(r,n,s){super(r,"fallback",n);K(this,"payable");Object.defineProperty(this,Es,{value:vk}),Ge(this,{payable:s})}format(r){const n=this.inputs.length===0?"receive":"fallback";if(r==="json"){const s=this.payable?"payable":"nonpayable";return JSON.stringify({type:n,stateMutability:s})}return`${n}()${this.payable?" payable":""}`}static from(r){if(Da.isFragment(r))return r;if(typeof r=="string")try{return Da.from(Lu(r))}catch{Q(!1,"invalid fallback fragment","obj",r)}else if(r instanceof Ji){const n=r.toString(),s=r.peekKeyword(Gn(["fallback","receive"]));if(Q(s,"type must be fallback or receive","obj",n),r.popKeyword(Gn(["fallback","receive"]))==="receive"){const c=ic(r);return Q(c.length===0,"receive cannot have arguments","obj.inputs",c),lc(r,Gn(["payable"])),$d(r),new Da(pr,[],!0)}let o=ic(r);
270o.length?Q(o.length===1&&o[0].type==="bytes","invalid fallback inputs","obj.inputs",o.map(c=>c.format("minimal")).join(", ")):o=[un.from("bytes")];const a=L7(r);if(Q(a==="nonpayable"||a==="payable","fallback cannot be constants","obj.stateMutability",a),lc(r,Gn(["returns"])).has("returns")){const c=ic(r);Q(c.length===1&&c[0].type==="bytes","invalid fallback outputs","obj.outputs",c.map(u=>u.format("minimal")).join(", "))}return $d(r),new Da(pr,o,a==="payable")}if(r.type==="receive")return new Da(pr,[],!0);if(r.type==="fallback"){const n=[un.from("bytes")],s=r.stateMutability==="payable";return new Da(pr,n,s)}Q(!1,"invalid fallback description","obj",r)}static isFragment(r){return r&&r[Es]===vk}}class Ro extends fC{constructor(r,n,s,i,o,a){super(r,"function",n,i);K(this,"constant");K(this,"outputs");K(this,"stateMutability");K(this,"payable");K(this,"gas");Object.defineProperty(this,Es,{value:_k}),o=Object.freeze(o.slice()),Ge(this,{constant:s==="view"||s==="pure",gas:a,outputs:o,payable:s==="payable",stateMutability:s})}get selector(){return Md(this.format("sighash")).substring(0,10)}format(r){if(r==null&&(r="sighash"),r==="json")return JSON.stringify({type:"function",name:this.name,constant:this.constant,stateMutability:this.stateMutability!=="nonpayable"?this.stateMutability:void 0,payable:this.payable,gas:this.gas!=null?this.gas:void 0,inputs:this.inputs.map(s=>JSON.parse(s.format(r))),outputs:this.outputs.map(s=>JSON.parse(s.format(r)))});const n=[];return r!=="sighash"&&n.push("function"),n.push(this.name+qy(r,this.inputs)),r!=="sighash"&&(this.stateMutability!=="nonpayable"&&n.push(this.stateMutability),this.outputs&&this.outputs.length&&(n.push("returns"),n.push(qy(r,this.outputs))),this.gas!=null&&n.push(`@${this.gas.toString()}`)),n.join(" ")}static getSelector(r,n){return n=(n||[]).map(i=>un.from(i)),new Ro(pr,r,"view",n,[],null).selector}static from(r){if(Ro.isFragment(r))return r;if(typeof r=="string")try{return Ro.from(Lu(r))}catch{Q(!1,"invalid function fragment","obj",r)}else if(r instanceof Ji){const s=dC("function",r),i=ic(r),o=L7(r);let a=[];lc(r,Gn(["returns"])).has("returns")&&(a=ic(r));const c=F7(r);return $d(r),new Ro(pr,s,o,i,a,c)}let n=r.stateMutability;return n==null&&(n="payable",typeof r.constant=="boolean"?(n="view",r.constant||(n="payable",typeof r.payable=="boolean"&&!r.payable&&(n="nonpayable"))):typeof r.payable=="boolean"&&!r.payable&&(n="nonpayable")),new Ro(pr,r.name,n,r.inputs?r.inputs.map(un.from):[],r.outputs?r.outputs.map(un.from):[],r.gas!=null?r.gas:null)}static isFragment(r){return r&&r[Es]===_k}}class Cd extends fC{constructor(e,r,n){super(e,"struct",r,n),Object.defineProperty(this,Es,{value:Ak})}format(){throw new Error("@TODO")}static from(e){if(typeof e=="string")try{return Cd.from(Lu(e))}catch{Q(!1,"invalid struct fragment","obj",e)}else if(e instanceof Ji){const r=dC("struct",e),n=ic(e);return $d(e),new Cd(pr,r,n)}return new Cd(pr,e.name,e.inputs?e.inputs.map(un.from):[])}static isFragment(e){return e&&e[Es]===Ak}}const Xi=new Map;Xi.set(0,"GENERIC_PANIC");Xi.set(1,"ASSERT_FALSE");Xi.set(17,"OVERFLOW");Xi.set(18,"DIVIDE_BY_ZERO");Xi.set(33,"ENUM_RANGE_ERROR");Xi.set(34,"BAD_STORAGE_DATA");Xi.set(49,"STACK_UNDERFLOW");Xi.set(50,"ARRAY_RANGE_ERROR");Xi.set(65,"OUT_OF_MEMORY");Xi.set(81,"UNINITIALIZED_FUNCTION_CALL");const Y1e=new RegExp(/^bytes([0-9]*)$/),J1e=new RegExp(/^(u?int)([0-9]*)$/);let tS=null,Ck=1024;function Q1e(t,e,r,n){let s="missing revert data",i=null;const o=null;let a=null;if(r){s="execution reverted";const u=Ct(r);if(r=De(r),u.length===0)s+=" (no data present; likely require(false) occurred",i="require(false)";else if(u.length%32!==4)s+=" (could not decode reason; invalid data length)";else if(De(u.slice(0,4))==="0x08c379a0")try{i=n.decode(["string"],u.slice(4))[0],a={signature:"Error(string)",name:"Error",args:[i]},s+=`: ${JSON.stringify(i)}`}catch{s+=" (could not decode reason; invalid string data)"}else if(De(u.slice(0,4))==="0x4e487b71")try{const l=Number(n.decode(["uint256"],u.slice(4))[0]);a={signature:"Panic(uint256)",name:"Panic",args:[l]},i=`Panic due to ${Xi.get(l)||"UNKNOWN"}(${l})`,s+=`: ${i}`}catch{s+=" (could not decode panic code)"}else s+=" (unknown custom error)"}const c={to:e.to?Dt(e.to):null,data:e.data||"0x"};return e.from&&(c.from=Dt(e.from)),wr(s,"CALL_EXCEPTION",{action:t,data:r,reason:i,transaction:c,invocation:o,revert:a})}var cu,zf;const SA=class SA{constructor(){ne(this,cu)}getDefaultValue(e){const r=e.map(s=>ge(this,cu,zf).call(this,un.from(s)));return new Fb(r,"_").defaultValue()}encode(e,r){pq(r.length,e.length,"types/values length mismatch");const n=e.map(o=>ge(this,cu,zf).call(this,un.from(o))),s=new Fb(n,"_"),i=new aP;return s.encode(i,r),i.data}decode(e,r,n){const s=e.map(o=>ge(this,cu,zf).call(this,un.from(o)));
270return new Fb(s,"_").decode(new cP(r,n,Ck))}static _setDefaultMaxInflation(e){Q(typeof e=="number"&&Number.isInteger(e),"invalid defaultMaxInflation factor","value",e),Ck=e}static defaultAbiCoder(){return tS==null&&(tS=new SA),tS}static getBuiltinCallException(e,r,n){return Q1e(e,r,n,SA.defaultAbiCoder())}};cu=new WeakSet,zf=function(e){if(e.isArray())return new vwe(ge(this,cu,zf).call(this,e.arrayChildren),e.arrayLength,e.name);if(e.isTuple())return new Fb(e.components.map(n=>ge(this,cu,zf).call(this,n)),e.name);switch(e.baseType){case"address":return new wwe(e.name);case"bool":return new _we(e.name);case"string":return new xwe(e.name);case"bytes":return new Awe(e.name);case"":return new Swe(e.name)}let r=e.type.match(J1e);if(r){let n=parseInt(r[2]||"256");return Q(n!==0&&n<=256&&n%8===0,"invalid "+r[1]+" bit length","param",e),new Nwe(n/8,r[1]==="int",e.name)}if(r=e.type.match(Y1e),r){let n=parseInt(r[1]);return Q(n!==0&&n<=32,"invalid bytes length","param",e),new Cwe(n,e.name)}Q(!1,"invalid type","type",e.type)};let zy=SA;class X1e{constructor(e,r,n){K(this,"fragment");K(this,"name");K(this,"signature");K(this,"topic");K(this,"args");const s=e.name,i=e.format();Ge(this,{fragment:e,name:s,signature:i,topic:r,args:n})}}class eEe{constructor(e,r,n,s){K(this,"fragment");K(this,"name");K(this,"args");K(this,"signature");K(this,"selector");K(this,"value");const i=e.name,o=e.format();Ge(this,{fragment:e,name:i,args:n,signature:o,selector:r,value:s})}}class tEe{constructor(e,r,n){K(this,"fragment");K(this,"name");K(this,"args");K(this,"signature");K(this,"selector");const s=e.name,i=e.format();Ge(this,{fragment:e,name:s,args:n,signature:i,selector:r})}}class Ik{constructor(e){K(this,"hash");K(this,"_isIndexed");Ge(this,{hash:e,_isIndexed:!0})}static isIndexed(e){return!!(e&&e._isIndexed)}}const Sk={0:"generic panic",1:"assert(false)",17:"arithmetic overflow",18:"division or modulo by zero",33:"enum overflow",34:"invalid encoded storage byte array accessed",49:"out-of-bounds array access; popping on an empty array",50:"out-of-bounds access of an array or bytesN",65:"out of memory",81:"uninitialized function"},Tk={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:t=>`reverted with reason string ${JSON.stringify(t)}`},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"],reason:t=>{let e="unknown panic code";return t>=0&&t<=255&&Sk[t.toString()]&&(e=Sk[t.toString()]),`reverted with panic code 0x${t.toString(16)} (${e})`}}};var vo,_o,Ao,En,Ho,v_,__;const $l=class $l{constructor(e){ne(this,Ho);K(this,"fragments");K(this,"deploy");K(this,"fallback");K(this,"receive");ne(this,vo);ne(this,_o);ne(this,Ao);ne(this,En);let r=[];typeof e=="string"?r=JSON.parse(e):r=e,W(this,Ao,new Map),W(this,vo,new Map),W(this,_o,new Map);const n=[];for(const o of r)try{n.push(Ld.from(o))}catch(a){console.log(`[Warning] Invalid Fragment ${JSON.stringify(o)}:`,a.message)}Ge(this,{fragments:Object.freeze(n)});let s=null,i=!1;W(this,En,this.getAbiCoder()),this.fragments.forEach((o,a)=>{let c;switch(o.type){case"constructor":if(this.deploy){console.log("duplicate definition - constructor");return}Ge(this,{deploy:o});return;case"fallback":o.inputs.length===0?i=!0:(Q(!s||o.payable!==s.payable,"conflicting fallback fragments",`fragments[${a}]`,o),s=o,i=s.payable);return;case"function":c=$(this,Ao);break;case"event":c=$(this,_o);break;case"error":c=$(this,vo);break;default:return}const u=o.format();c.has(u)||c.set(u,o)}),this.deploy||Ge(this,{deploy:Xa.from("constructor()")}),Ge(this,{fallback:s,receive:i})}format(e){const r=e?"minimal":"full";return this.fragments.map(s=>s.format(r))}formatJson(){const e=this.fragments.map(r=>r.format("json"));return JSON.stringify(e.map(r=>JSON.parse(r)))}getAbiCoder(){return zy.defaultAbiCoder()}getFunctionName(e){const r=ge(this,Ho,v_).call(this,e,null,!1);return Q(r,"no matching function","key",e),r.name}hasFunction(e){return!!ge(this,Ho,v_).call(this,e,null,!1)}getFunction(e,r){return ge(this,Ho,v_).call(this,e,r||null,!0)}forEachFunction(e){const r=Array.from($(this,Ao).keys());r.sort((n,s)=>n.localeCompare(s));for(let n=0;n<r.length;n++){const s=r[n];e($(this,Ao).get(s),n)}}getEventName(e){const r=ge(this,Ho,__).call(this,e,null,!1);return Q(r,"no matching event","key",e),r.name}hasEvent(e){return!!ge(this,Ho,__).call(this,e,null,!1)}getEvent(e,r){return ge(this,Ho,__).call(this,e,r||null,!0)}forEachEvent(e){const r=Array.from($(this,_o).keys());r.sort((n,s)=>n.localeCompare(s));for(let n=0;n<r.length;n++){const s=r[n];e($(this,_o).get(s),n)}}getError(e,r){if(zt(e)){const s=e.toLowerCase();if(Tk[s])return ms.from(Tk[s].signature);for(const i of $(this,vo).values())if(s===i.selector)return i;return null}if(e.indexOf("(")===-1){const s=[];for(const[i,o]of $(this,vo))i.split("(")[0]===e&&s.push(o);if(s.length===0)return e==="Error"?ms.from("error Error(string)"):e==="Panic"?ms.from("error Panic(uint256)"):null;if(s.length>1){const i=s.map(o=>JSON.stringify(o.format())).join(", ");Q(!1,`ambiguous error description (i.e. ${i})`,"name",e)}return s[0]}if(e=ms.from(e).format(),e==="Error(string)")return ms.from("error Error(string)");if(e==="Panic(uint256)")return ms.from("error Panic(uint256)");const n=$(this,vo).get(e);return n||null}forEachError(e){const r=Array.from($(this,vo).keys());r.sort((n,s)=>n.localeCompare(s));for(let n=0;n<r.length;n++){const s=r[n];e($(this,vo).get(s),n)}}_decodeParams(e,r){return $(this,En).decode(e,r)}_encodeParams(e,r){return $(this,En).encode(e,r)}encodeDeploy(e){return this._encodeParams(this.deploy.inputs,e||[])}decodeErrorResult(e,r){if(typeof e=="string"){const n=this.getError(e);Q(n,"unknown error","fragment",e),e=n}return Q(Er(r,0,4)===e.selector,`data signature does not match error ${e.name}.`,"data",r),this._decodeParams(e.inputs,Er(r,4))}encodeErrorResult(e,r){if(typeof e=="string"){const n=this.getError(e);Q(n,"unknown error","fragment",e),e=n}return Pr([e.selector,this._encodeParams(e.inputs,r||[])])}decodeFunctionData(e,r){if(typeof e=="string"){const n=this.getFunction(e);Q(n,"unknown function","fragment",e),e=n}return Q(Er(r,0,4)===e.selector,`data signature does not match function ${e.name}.`,"data",r),this._decodeParams(e.inputs,Er(r,4))}encodeFunctionData(e,r){if(typeof e=="string"){const n=this.getFunction(e);Q(n,"unknown function","fragment",e),e=n}return Pr([e.selector,this._encodeParams(e.inputs,r||[])])}decodeFunctionResult(e,r){if(typeof e=="string"){const i=this.getFunction(e);Q(i,"unknown function","fragment",e),e=i}let n="invalid length for result data";const s=Hn(r);if(s.length%32===0)try{return $(this,En).decode(e.outputs,s)}
270catch{n="could not decode result data"}ue(!1,n,"BAD_DATA",{value:De(s),info:{method:e.name,signature:e.format()}})}makeError(e,r){const n=Ct(e,"data"),s=zy.getBuiltinCallException("call",r,n);if(s.message.startsWith("execution reverted (unknown custom error)")){const a=De(n.slice(0,4)),c=this.getError(a);if(c)try{const u=$(this,En).decode(c.inputs,n.slice(4));s.revert={name:c.name,signature:c.format(),args:u},s.reason=s.revert.signature,s.message=`execution reverted: ${s.reason}`}catch{s.message="execution reverted (coult not decode custom error)"}}const o=this.parseTransaction(r);return o&&(s.invocation={method:o.name,signature:o.signature,args:o.args}),s}encodeFunctionResult(e,r){if(typeof e=="string"){const n=this.getFunction(e);Q(n,"unknown function","fragment",e),e=n}return De($(this,En).encode(e.outputs,r||[]))}encodeFilterTopics(e,r){if(typeof e=="string"){const i=this.getEvent(e);Q(i,"unknown event","eventFragment",e),e=i}ue(r.length<=e.inputs.length,`too many arguments for ${e.format()}`,"UNEXPECTED_ARGUMENT",{count:r.length,expectedCount:e.inputs.length});const n=[];e.anonymous||n.push(e.topicHash);const s=(i,o)=>i.type==="string"?Md(o):i.type==="bytes"?Br(De(o)):(i.type==="bool"&&typeof o=="boolean"?o=o?"0x01":"0x00":i.type.match(/^u?int/)?o=ju(o):i.type.match(/^bytes/)?o=_0e(o,32):i.type==="address"&&$(this,En).encode(["address"],[o]),Dd(De(o),32));for(r.forEach((i,o)=>{const a=e.inputs[o];if(!a.indexed){Q(i==null,"cannot filter non-indexed parameters; must be null","contract."+a.name,i);return}i==null?n.push(null):a.baseType==="array"||a.baseType==="tuple"?Q(!1,"filtering with tuples or arrays not supported","contract."+a.name,i):Array.isArray(i)?n.push(i.map(c=>s(a,c))):n.push(s(a,i))});n.length&&n[n.length-1]===null;)n.pop();return n}encodeEventLog(e,r){if(typeof e=="string"){const o=this.getEvent(e);Q(o,"unknown event","eventFragment",e),e=o}const n=[],s=[],i=[];return e.anonymous||n.push(e.topicHash),Q(r.length===e.inputs.length,"event arguments/values mismatch","values",r),e.inputs.forEach((o,a)=>{const c=r[a];if(o.indexed)if(o.type==="string")n.push(Md(c));else if(o.type==="bytes")n.push(Br(c));else{if(o.baseType==="tuple"||o.baseType==="array")throw new Error("not implemented");n.push($(this,En).encode([o.type],[c]))}else s.push(o),i.push(c)}),{data:$(this,En).encode(s,i),topics:n}}decodeEventLog(e,r,n){if(typeof e=="string"){const g=this.getEvent(e);Q(g,"unknown event","eventFragment",e),e=g}if(n!=null&&!e.anonymous){const g=e.topicHash;Q(zt(n[0],32)&&n[0].toLowerCase()===g,"fragment/topic mismatch","topics[0]",n[0]),n=n.slice(1)}const s=[],i=[],o=[];e.inputs.forEach((g,h)=>{g.indexed?g.type==="string"||g.type==="bytes"||g.baseType==="tuple"||g.baseType==="array"?(s.push(un.from({type:"bytes32",name:g.name})),o.push(!0)):(s.push(g),o.push(!1)):(i.push(g),o.push(!1))});const a=n!=null?$(this,En).decode(s,Pr(n)):null,c=$(this,En).decode(i,r,!0),u=[],l=[];let d=0,f=0;return e.inputs.forEach((g,h)=>{let p=null;if(g.indexed)if(a==null)p=new Ik(null);else if(o[h])p=new Ik(a[f++]);else try{p=a[f++]}catch(y){p=y}else try{p=c[d++]}catch(y){p=y}u.push(p),l.push(g.name||null)}),mp.fromItems(u,l)}parseTransaction(e){const r=Ct(e.data,"tx.data"),n=$e(e.value!=null?e.value:0,"tx.value"),s=this.getFunction(De(r.slice(0,4)));if(!s)return null;const i=$(this,En).decode(s.inputs,r.slice(4));return new eEe(s,s.selector,i,n)}parseCallResult(e){throw new Error("@TODO")}parseLog(e){const r=this.getEvent(e.topics[0]);return!r||r.anonymous?null:new X1e(r,r.topicHash,this.decodeEventLog(r,e.data,e.topics))}parseError(e){const r=De(e),n=this.getError(Er(r,0,4));if(!n)return null;const s=$(this,En).decode(n.inputs,Er(r,4));return new tEe(n,n.selector,s)}static from(e){return e instanceof $l?e:typeof e=="string"?new $l(JSON.parse(e)):typeof e.formatJson=="function"?new $l(e.formatJson()):typeof e.format=="function"?new $l(e.format("json")):new $l(e)}};vo=new WeakMap,_o=new WeakMap,Ao=new WeakMap,En=new WeakMap,Ho=new WeakSet,v_=function(e,r,n){if(zt(e)){const i=e.toLowerCase();for(const o of $(this,Ao).values())if(i===o.selector)return o;return null}if(e.indexOf("(")===-1){const i=[];
270for(const[o,a]of $(this,Ao))o.split("(")[0]===e&&i.push(a);if(r){const o=r.length>0?r[r.length-1]:null;let a=r.length,c=!0;On.isTyped(o)&&o.type==="overrides"&&(c=!1,a--);for(let u=i.length-1;u>=0;u--){const l=i[u].inputs.length;l!==a&&(!c||l!==a-1)&&i.splice(u,1)}for(let u=i.length-1;u>=0;u--){const l=i[u].inputs;for(let d=0;d<r.length;d++)if(On.isTyped(r[d])){if(d>=l.length){if(r[d].type==="overrides")continue;i.splice(u,1);break}if(r[d].type!==l[d].baseType){i.splice(u,1);break}}}}if(i.length===1&&r&&r.length!==i[0].inputs.length){const o=r[r.length-1];(o==null||Array.isArray(o)||typeof o!="object")&&i.splice(0,1)}if(i.length===0)return null;if(i.length>1&&n){const o=i.map(a=>JSON.stringify(a.format())).join(", ");Q(!1,`ambiguous function description (i.e. matches ${o})`,"key",e)}return i[0]}const s=$(this,Ao).get(Ro.from(e).format());return s||null},__=function(e,r,n){if(zt(e)){const i=e.toLowerCase();for(const o of $(this,_o).values())if(i===o.topicHash)return o;return null}if(e.indexOf("(")===-1){const i=[];for(const[o,a]of $(this,_o))o.split("(")[0]===e&&i.push(a);if(r){for(let o=i.length-1;o>=0;o--)i[o].inputs.length<r.length&&i.splice(o,1);for(let o=i.length-1;o>=0;o--){const a=i[o].inputs;for(let c=0;c<r.length;c++)if(On.isTyped(r[c])&&r[c].type!==a[c].baseType){i.splice(o,1);break}}}if(i.length===0)return null;if(i.length>1&&n){const o=i.map(a=>JSON.stringify(a.format())).join(", ");Q(!1,`ambiguous event description (i.e. matches ${o})`,"key",e)}return i[0]}const s=$(this,_o).get(xo.from(e).format());return s||null};let _P=$l;const H7=BigInt(0);function gh(t){return t??null}function Ar(t){return t==null?null:t.toString()}class Pk{constructor(e,r,n){K(this,"gasPrice");K(this,"maxFeePerGas");K(this,"maxPriorityFeePerGas");Ge(this,{gasPrice:gh(e),maxFeePerGas:gh(r),maxPriorityFeePerGas:gh(n)})}toJSON(){const{gasPrice:e,maxFeePerGas:r,maxPriorityFeePerGas:n}=this;return{_type:"FeeData",gasPrice:Ar(e),maxFeePerGas:Ar(r),maxPriorityFeePerGas:Ar(n)}}}function wA(t){const e={};t.to&&(e.to=t.to),t.from&&(e.from=t.from),t.data&&(e.data=De(t.data));const r="chainId,gasLimit,gasPrice,maxFeePerBlobGas,maxFeePerGas,maxPriorityFeePerGas,value".split(/,/);for(const s of r)!(s in t)||t[s]==null||(e[s]=$e(t[s],`request.${s}`));const n="type,nonce".split(/,/);for(const s of n)!(s in t)||t[s]==null||(e[s]=nt(t[s],`request.${s}`));return t.accessList&&(e.accessList=Jd(t.accessList)),"blockTag"in t&&(e.blockTag=t.blockTag),"enableCcipRead"in t&&(e.enableCcipRead=!!t.enableCcipRead),"customData"in t&&(e.customData=t.customData),"blobVersionedHashes"in t&&t.blobVersionedHashes&&(e.blobVersionedHashes=t.blobVersionedHashes.slice()),"kzg"in t&&(e.kzg=t.kzg),"blobs"in t&&t.blobs&&(e.blobs=t.blobs.map(s=>MO(s)?De(s):Object.assign({},s))),e}var qa;class rEe{constructor(e,r){K(this,"provider");K(this,"number");K(this,"hash");K(this,"timestamp");K(this,"parentHash");K(this,"parentBeaconBlockRoot");K(this,"nonce");K(this,"difficulty");K(this,"gasLimit");K(this,"gasUsed");K(this,"stateRoot");K(this,"receiptsRoot");K(this,"blobGasUsed");K(this,"excessBlobGas");K(this,"miner");K(this,"prevRandao");K(this,"extraData");K(this,"baseFeePerGas");ne(this,qa);W(this,qa,e.transactions.map(n=>typeof n!="string"?new Wy(n,r):n)),Ge(this,{provider:r,hash:gh(e.hash),number:e.number,timestamp:e.timestamp,parentHash:e.parentHash,parentBeaconBlockRoot:e.parentBeaconBlockRoot,nonce:e.nonce,difficulty:e.difficulty,gasLimit:e.gasLimit,gasUsed:e.gasUsed,blobGasUsed:e.blobGasUsed,excessBlobGas:e.excessBlobGas,miner:e.miner,prevRandao:gh(e.prevRandao),extraData:e.extraData,baseFeePerGas:gh(e.baseFeePerGas),stateRoot:e.stateRoot,receiptsRoot:e.receiptsRoot})}get transactions(){return $(this,qa).map(e=>typeof e=="string"?e:e.hash)}get prefetchedTransactions(){const e=$(this,qa).slice();return e.length===0?[]:(ue(typeof e[0]=="object","transactions were not prefetched with block request","UNSUPPORTED_OPERATION",{operation:"transactionResponses()"}),e)}toJSON(){const{baseFeePerGas:e,difficulty:r,extraData:n,gasLimit:s,gasUsed:i,hash:o,miner:a,prevRandao:c,nonce:u,number:l,parentHash:d,parentBeaconBlockRoot:f,stateRoot:g,receiptsRoot:h,timestamp:p,transactions:y}=this;return{_type:"Block",baseFeePerGas:Ar(e),difficulty:Ar(r),extraData:n,gasLimit:Ar(s),gasUsed:Ar(i),blobGasUsed:Ar(this.blobGasUsed),excessBlobGas:Ar(this.excessBlobGas),hash:o,miner:a,prevRandao:c,nonce:u,number:l,parentHash:d,timestamp:p,parentBeaconBlockRoot:f,stateRoot:g,receiptsRoot:h,transactions:y}}[Symbol.iterator](){let e=0;const r=this.transactions;return{next:()=>e<this.length?{value:r[e++],done:!1}:{value:void 0,done:!0}}}get length(){return $(this,qa).length}get date(){return this.timestamp==null?null:new Date(this.timestamp*1e3)}async getTransaction(e){let r;if(typeof e=="number")r=$(this,qa)[e];else{const n=e.toLowerCase();for(const s of $(this,qa))if(typeof s=="string"){if(s!==n)continue;r=s;break}else{if(s.hash===n)continue;r=s;break}}if(r==null)throw new Error("no such tx");return typeof r=="string"?await this.provider.getTransaction(r):r}getPrefetchedTransaction(e){const r=this.prefetchedTransactions;if(typeof e=="number")return r[e];e=e.toLowerCase();for(const n of r)if(n.hash===e)return n;Q(!1,"no matching transaction","indexOrHash",e)}isMined(){return!!this.hash}isLondon(){return!!this.baseFeePerGas}orphanedEvent(){if(!this.isMined())throw new Error("");return nEe(this)}}qa=new WeakMap;class T0{constructor(e,r){K(this,"provider");K(this,"transactionHash");K(this,"blockHash");K(this,"blockNumber");K(this,"removed");K(this,"address");K(this,"data");K(this,"topics");K(this,"index");K(this,"transactionIndex");this.provider=r;const n=Object.freeze(e.topics.slice());Ge(this,{transactionHash:e.transactionHash,blockHash:e.blockHash,blockNumber:e.blockNumber,removed:e.removed,address:e.address,data:e.data,topics:n,index:e.index,transactionIndex:e.transactionIndex})}toJSON(){const{address:e,blockHash:r,blockNumber:n,data:s,index:i,removed:o,topics:a,transactionHash:c,transactionIndex:u}=this;return{_type:"log",address:e,blockHash:r,blockNumber:n,data:s,index:i,removed:o,topics:a,transactionHash:c,transactionIndex:u}}async getBlock(){const e=await this.provider.getBlock(this.blockHash);return ue(!!e,"failed to find transaction","UNKNOWN_ERROR",{}),e}async getTransaction(){const e=await this.provider.getTransaction(this.transactionHash);return ue(!!e,"failed to find transaction","UNKNOWN_ERROR",{}),e}async getTransactionReceipt(){const e=await this.provider.getTransactionReceipt(this.transactionHash);return ue(!!e,"failed to find transaction receipt","UNKNOWN_ERROR",{}),e}removedEvent(){return sEe(this)}}var Jy;class q7{constructor(e,r){K(this,"provider");K(this,"to");K(this,"from");K(this,"contractAddress");K(this,"hash");K(this,"index");K(this,"blockHash");K(this,"blockNumber");K(this,"logsBloom");K(this,"gasUsed");K(this,"blobGasUsed");K(this,"cumulativeGasUsed");K(this,"gasPrice");K(this,"blobGasPrice");K(this,"type");K(this,"status");K(this,"root");ne(this,Jy);W(this,Jy,Object.freeze(e.logs.map(s=>new T0(s,r))));let n=H7;e.effectiveGasPrice!=null?n=e.effectiveGasPrice:e.gasPrice!=null&&(n=e.gasPrice),Ge(this,{provider:r,to:e.to,from:e.from,contractAddress:e.contractAddress,hash:e.hash,index:e.index,blockHash:e.blockHash,blockNumber:e.blockNumber,logsBloom:e.logsBloom,gasUsed:e.gasUsed,cumulativeGasUsed:e.cumulativeGasUsed,blobGasUsed:e.blobGasUsed,gasPrice:n,blobGasPrice:e.blobGasPrice,type:e.type,status:e.status,root:e.root})}get logs(){return $(this,Jy)}toJSON(){const{to:e,from:r,contractAddress:n,hash:s,index:i,blockHash:o,blockNumber:a,logsBloom:c,logs:u,status:l,root:d}=this;return{_type:"TransactionReceipt",blockHash:o,blockNumber:a,contractAddress:n,cumulativeGasUsed:Ar(this.cumulativeGasUsed),from:r,gasPrice:Ar(this.gasPrice),blobGasUsed:Ar(this.blobGasUsed),blobGasPrice:Ar(this.blobGasPrice),gasUsed:Ar(this.gasUsed),hash:s,index:i,logs:u,logsBloom:c,root:d,status:l,to:e}}get length(){return this.logs.length}[Symbol.iterator](){let e=0;return{next:()=>e<this.length?{value:this.logs[e++],done:!1}:{value:void 0,done:!0}}}get fee(){return this.gasUsed*this.gasPrice}async getBlock(){const e=await this.provider.getBlock(this.blockHash);if(e==null)throw new Error("TODO");return e}async getTransaction(){const e=await this.provider.getTransaction(this.hash);if(e==null)throw new Error("TODO");return e}async getResult(){return await this.provider.getTransactionResult(this.hash)}async confirmations(){return await this.provider.getBlockNumber()-this.blockNumber+1}removedEvent(){return W7(this)}reorderedEvent(e){return ue(!e||e.isMined(),"unmined 'other' transction cannot be orphaned","UNSUPPORTED_OPERATION",{operation:"reorderedEvent(other)"}),z7(this,e)}}Jy=new WeakMap;var uu;const ox=class ox{constructor(e,r){K(this,"provider");K(this,"blockNumber");K(this,"blockHash");K(this,"index");K(this,"hash");K(this,"type");K(this,"to");K(this,"from");K(this,"nonce");
270K(this,"gasLimit");K(this,"gasPrice");K(this,"maxPriorityFeePerGas");K(this,"maxFeePerGas");K(this,"maxFeePerBlobGas");K(this,"data");K(this,"value");K(this,"chainId");K(this,"signature");K(this,"accessList");K(this,"blobVersionedHashes");ne(this,uu);this.provider=r,this.blockNumber=e.blockNumber!=null?e.blockNumber:null,this.blockHash=e.blockHash!=null?e.blockHash:null,this.hash=e.hash,this.index=e.index,this.type=e.type,this.from=e.from,this.to=e.to||null,this.gasLimit=e.gasLimit,this.nonce=e.nonce,this.data=e.data,this.value=e.value,this.gasPrice=e.gasPrice,this.maxPriorityFeePerGas=e.maxPriorityFeePerGas!=null?e.maxPriorityFeePerGas:null,this.maxFeePerGas=e.maxFeePerGas!=null?e.maxFeePerGas:null,this.maxFeePerBlobGas=e.maxFeePerBlobGas!=null?e.maxFeePerBlobGas:null,this.chainId=e.chainId,this.signature=e.signature,this.accessList=e.accessList!=null?e.accessList:null,this.blobVersionedHashes=e.blobVersionedHashes!=null?e.blobVersionedHashes:null,W(this,uu,-1)}toJSON(){const{blockNumber:e,blockHash:r,index:n,hash:s,type:i,to:o,from:a,nonce:c,data:u,signature:l,accessList:d,blobVersionedHashes:f}=this;return{_type:"TransactionResponse",accessList:d,blockNumber:e,blockHash:r,blobVersionedHashes:f,chainId:Ar(this.chainId),data:u,from:a,gasLimit:Ar(this.gasLimit),gasPrice:Ar(this.gasPrice),hash:s,maxFeePerGas:Ar(this.maxFeePerGas),maxPriorityFeePerGas:Ar(this.maxPriorityFeePerGas),maxFeePerBlobGas:Ar(this.maxFeePerBlobGas),nonce:c,signature:l,to:o,index:n,type:i,value:Ar(this.value)}}async getBlock(){let e=this.blockNumber;if(e==null){const n=await this.getTransaction();n&&(e=n.blockNumber)}if(e==null)return null;const r=this.provider.getBlock(e);if(r==null)throw new Error("TODO");return r}async getTransaction(){return this.provider.getTransaction(this.hash)}async confirmations(){if(this.blockNumber==null){const{tx:r,blockNumber:n}=await Ln({tx:this.getTransaction(),blockNumber:this.provider.getBlockNumber()});return r==null||r.blockNumber==null?0:n-r.blockNumber+1}return await this.provider.getBlockNumber()-this.blockNumber+1}async wait(e,r){const n=e??1,s=r??0;let i=$(this,uu),o=-1,a=i===-1;const c=async()=>{if(a)return null;const{blockNumber:f,nonce:g}=await Ln({blockNumber:this.provider.getBlockNumber(),nonce:this.provider.getTransactionCount(this.from)});if(g<this.nonce){i=f;return}if(a)return null;const h=await this.getTransaction();if(!(h&&h.blockNumber!=null))for(o===-1&&(o=i-3,o<$(this,uu)&&(o=$(this,uu)));o<=f;){if(a)return null;const p=await this.provider.getBlock(o,!0);if(p==null)return;for(const y of p)if(y===this.hash)return;for(let y=0;y<p.length;y++){const w=await p.getTransaction(y);if(w.from===this.from&&w.nonce===this.nonce){if(a)return null;const I=await this.provider.getTransactionReceipt(w.hash);if(I==null||f-I.blockNumber+1<n)return;let v="replaced";w.data===this.data&&w.to===this.to&&w.value===this.value?v="repriced":w.data==="0x"&&w.from===w.to&&w.value===H7&&(v="cancelled"),ue(!1,"transaction was replaced","TRANSACTION_REPLACED",{cancelled:v==="replaced"||v==="cancelled",reason:v,replacement:w.replaceableTransaction(i),hash:w.hash,receipt:I})}}o++}},u=f=>{if(f==null||f.status!==0)return f;ue(!1,"transaction execution reverted","CALL_EXCEPTION",{action:"sendTransaction",data:null,reason:null,invocation:null,revert:null,transaction:{to:f.to,from:f.from,data:""},receipt:f})},l=await this.provider.getTransactionReceipt(this.hash);if(n===0)return u(l);if(l){if(await l.confirmations()>=n)return u(l)}else if(await c(),n===0)return null;return await new Promise((f,g)=>{const h=[],p=()=>{h.forEach(w=>w())};if(h.push(()=>{a=!0}),s>0){const w=setTimeout(()=>{p(),g(wr("wait for transaction timeout","TIMEOUT"))},s);h.push(()=>{clearTimeout(w)})}const y=async w=>{if(await w.confirmations()>=n){p();try{f(u(w))}catch(I){g(I)}}};if(h.push(()=>{this.provider.off(this.hash,y)}),this.provider.on(this.hash,y),i>=0){const w=async()=>{try{await c()}catch(I){if(Pn(I,"TRANSACTION_REPLACED")){p(),g(I);return}}a||this.provider.once("block",w)};h.push(()=>{this.provider.off("block",w)}),this.provider.once("block",w)}})}isMined(){return this.blockHash!=null}isLegacy(){return this.type===0}isBerlin(){return this.type===1}isLondon(){return this.type===2}isCancun(){return this.type===3}removedEvent(){return ue(this.isMined(),"unmined transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),W7(this)}reorderedEvent(e){return ue(this.isMined(),"unmined transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),ue(!e||e.isMined(),"unmined 'other' transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),z7(this,e)}replaceableTransaction(e){Q(Number.isInteger(e)&&e>=0,"invalid startBlock","startBlock",e);const r=new ox(this,this.provider);return W(r,uu,e),r}};uu=new WeakMap;let Wy=ox;function nEe(t){return{orphan:"drop-block",hash:t.hash,number:t.number}}function z7(t,e){return{orphan:"reorder-transaction",tx:t,other:e}}function W7(t){return{orphan:"drop-transaction",tx:t}}function sEe(t){return{orphan:"drop-log",log:{transactionHash:t.transactionHash,blockHash:t.blockHash,blockNumber:t.blockNumber,address:t.address,data:t.data,topics:Object.freeze(t.topics.slice()),index:t.index}}}class eN extends T0{constructor(r,n,s){super(r,r.provider);K(this,"interface");K(this,"fragment");K(this,"args");const i=n.decodeEventLog(s,r.data,r.topics);Ge(this,{args:i,fragment:s,interface:n})}get eventName(){return this.fragment.name}get eventSignature(){return this.fragment.format()}}class V7 extends T0{constructor(r,n){super(r,r.provider);K(this,"error");Ge(this,{error:n})}}var zh;class iEe extends q7{constructor(r,n,s){super(s,n);ne(this,zh);W(this,zh,r)}get logs(){return super.logs.map(r=>{const n=r.topics.length?$(this,zh).getEvent(r.topics[0]):null;if(n)try{return new eN(r,$(this,zh),n)}catch(s){return new V7(r,s)}return r})}}zh=new WeakMap;var Qy;class tN extends Wy{constructor(r,n,s){super(s,n);ne(this,Qy);W(this,Qy,r)}async wait(r,n){const s=await super.wait(r,n);return s==null?null:new iEe($(this,Qy),this.provider,s)}}Qy=new WeakMap;class G7 extends bq{constructor(r,n,s,i){super(r,n,s);K(this,"log");Ge(this,{log:i})}async getBlock(){return await this.log.getBlock()}async getTransaction(){return await this.log.getTransaction()}async getTransactionReceipt(){return await this.log.getTransactionReceipt()}}class oEe extends G7{constructor(e,r,n,s,i){super(e,r,n,new eN(i,e.interface,s));const o=e.interface.decodeEventLog(s,this.log.data,this.log.topics);Ge(this,{args:o,fragment:s})}get eventName(){return this.fragment.name}get eventSignature(){return this.fragment.format()}}const Ok=BigInt(0);function K7(t){return t&&typeof t.call=="function"}function Z7(t){return t&&typeof t.estimateGas=="function"}function hC(t){return t&&typeof t.resolveName=="function"}function Y7(t){return t&&typeof t.sendTransaction=="function"}function J7(t){if(t!=null){if(hC(t))return t;if(t.provider)return t.provider}}var Xy;class aEe{constructor(e,r,n){ne(this,Xy);K(this,"fragment");
270if(Ge(this,{fragment:r}),r.inputs.length<n.length)throw new Error("too many arguments");const s=Fd(e.runner,"resolveName"),i=hC(s)?s:null;W(this,Xy,async function(){const o=await Promise.all(r.inputs.map((a,c)=>n[c]==null?null:a.walkAsync(n[c],(l,d)=>l==="address"?Array.isArray(d)?Promise.all(d.map(f=>Vn(f,i))):Vn(d,i):d)));return e.interface.encodeFilterTopics(r,o)}())}getTopicFilter(){return $(this,Xy)}}Xy=new WeakMap;function Fd(t,e){return t==null?null:typeof t[e]=="function"?t:t.provider&&typeof t.provider[e]=="function"?t.provider:null}function Jl(t){return t==null?null:t.provider||null}async function Q7(t,e){const r=On.dereference(t,"overrides");Q(typeof r=="object","invalid overrides parameter","overrides",t);const n=wA(r);return Q(n.to==null||(e||[]).indexOf("to")>=0,"cannot override to","overrides.to",n.to),Q(n.data==null||(e||[]).indexOf("data")>=0,"cannot override data","overrides.data",n.data),n.from&&(n.from=n.from),n}async function cEe(t,e,r){const n=Fd(t,"resolveName"),s=hC(n)?n:null;return await Promise.all(e.map((i,o)=>i.walkAsync(r[o],(a,c)=>(c=On.dereference(c,a),a==="address"?Vn(c,s):c))))}function uEe(t){const e=async function(o){const a=await Q7(o,["data"]);a.to=await t.getAddress(),a.from&&(a.from=await Vn(a.from,J7(t.runner)));const c=t.interface,u=$e(a.value||Ok,"overrides.value")===Ok,l=(a.data||"0x")==="0x";c.fallback&&!c.fallback.payable&&c.receive&&!l&&!u&&Q(!1,"cannot send data to receive or send value to non-payable fallback","overrides",o),Q(c.fallback||l,"cannot send data to receive-only contract","overrides.data",a.data);const d=c.receive||c.fallback&&c.fallback.payable;return Q(d||u,"cannot send value to non-payable fallback","overrides.value",a.value),Q(c.fallback||l,"cannot send data to receive-only contract","overrides.data",a.data),a},r=async function(o){const a=Fd(t.runner,"call");ue(K7(a),"contract runner does not support calling","UNSUPPORTED_OPERATION",{operation:"call"});const c=await e(o);try{return await a.call(c)}catch(u){throw UO(u)&&u.data?t.interface.makeError(u.data,c):u}},n=async function(o){const a=t.runner;ue(Y7(a),"contract runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});const c=await a.sendTransaction(await e(o)),u=Jl(t.runner);return new tN(t.interface,u,c)},s=async function(o){const a=Fd(t.runner,"estimateGas");return ue(Z7(a),"contract runner does not support gas estimation","UNSUPPORTED_OPERATION",{operation:"estimateGas"}),await a.estimateGas(await e(o))},i=async o=>await n(o);return Ge(i,{_contract:t,estimateGas:s,populateTransaction:e,send:n,staticCall:r}),i}function lEe(t,e){const r=function(...u){const l=t.interface.getFunction(e,u);return ue(l,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e,args:u}}),l},n=async function(...u){const l=r(...u);let d={};if(l.inputs.length+1===u.length&&(d=await Q7(u.pop()),d.from&&(d.from=await Vn(d.from,J7(t.runner)))),l.inputs.length!==u.length)throw new Error("internal error: fragment inputs doesn't match arguments; should not happen");const f=await cEe(t.runner,l.inputs,u);return Object.assign({},d,await Ln({to:t.getAddress(),data:t.interface.encodeFunctionData(l,f)}))},s=async function(...u){const l=await a(...u);return l.length===1?l[0]:l},i=async function(...u){const l=t.runner;ue(Y7(l),"contract runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});const d=await l.sendTransaction(await n(...u)),f=Jl(t.runner);return new tN(t.interface,f,d)},o=async function(...u){const l=Fd(t.runner,"estimateGas");return ue(Z7(l),"contract runner does not support gas estimation","UNSUPPORTED_OPERATION",{operation:"estimateGas"}),await l.estimateGas(await n(...u))},a=async function(...u){const l=Fd(t.runner,"call");ue(K7(l),"contract runner does not support calling","UNSUPPORTED_OPERATION",{operation:"call"});const d=await n(...u);let f="0x";try{f=await l.call(d)}catch(h){throw UO(h)&&h.data?t.interface.makeError(h.data,d):h}const g=r(...u);return t.interface.decodeFunctionResult(g,f)},c=async(...u)=>r(...u).constant?await s(...u):await i(...u);return Ge(c,{name:t.interface.getFunctionName(e),_contract:t,_key:e,getFragment:r,estimateGas:o,populateTransaction:n,send:i,staticCall:s,staticCallResult:a}),Object.defineProperty(c,"fragment",{configurable:!1,enumerable:!0,get:()=>{const u=t.interface.getFunction(e);return ue(u,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e}}),u}}),c}function dEe(t,e){const r=function(...s){const i=t.interface.getEvent(e,s);return ue(i,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e,args:s}}),i},n=function(...s){return new aEe(t,r(...s),s)};return Ge(n,{name:t.interface.getEventName(e),_contract:t,_key:e,getFragment:r}),Object.defineProperty(n,"fragment",{configurable:!1,enumerable:!0,get:()=>{const s=t.interface.getEvent(e);return ue(s,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e}}),s}}),n}const EA=Symbol.for("_ethersInternal_contract"),X7=new WeakMap;function fEe(t,e){X7.set(t[EA],e)}function js(t){return X7.get(t[EA])}function hEe(t){return t&&typeof t=="object"&&"getTopicFilter"in t&&typeof t.getTopicFilter=="function"&&t.fragment}async function rN(t,e){let r,n=null;
270if(Array.isArray(e)){const i=function(o){if(zt(o,32))return o;const a=t.interface.getEvent(o);return Q(a,"unknown fragment","name",o),a.topicHash};r=e.map(o=>o==null?null:Array.isArray(o)?o.map(i):i(o))}else e==="*"?r=[null]:typeof e=="string"?zt(e,32)?r=[e]:(n=t.interface.getEvent(e),Q(n,"unknown fragment","event",e),r=[n.topicHash]):hEe(e)?r=await e.getTopicFilter():"fragment"in e?(n=e.fragment,r=[n.topicHash]):Q(!1,"unknown event name","event",e);r=r.map(i=>{if(i==null)return null;if(Array.isArray(i)){const o=Array.from(new Set(i.map(a=>a.toLowerCase())).values());return o.length===1?o[0]:(o.sort(),o)}return i.toLowerCase()});const s=r.map(i=>i==null?"null":Array.isArray(i)?i.join("|"):i).join("&");return{fragment:n,tag:s,topics:r}}async function Cm(t,e){const{subs:r}=js(t);return r.get((await rN(t,e)).tag)||null}async function Nk(t,e,r){const n=Jl(t.runner);ue(n,"contract runner does not support subscribing","UNSUPPORTED_OPERATION",{operation:e});const{fragment:s,tag:i,topics:o}=await rN(t,r),{addr:a,subs:c}=js(t);let u=c.get(i);if(!u){const d={address:a||t,topics:o},f=y=>{let w=s;if(w==null)try{w=t.interface.getEvent(y.topics[0])}catch{}if(w){const I=w,v=s?t.interface.decodeEventLog(s,y.data,y.topics):[];CP(t,r,v,E=>new oEe(t,E,r,I,y))}else CP(t,r,[],I=>new G7(t,I,r,y))};let g=[];u={tag:i,listeners:[],start:()=>{g.length||g.push(n.on(d,f))},stop:async()=>{if(g.length==0)return;let y=g;g=[],await Promise.all(y),n.off(d,f)}},c.set(i,u)}return u}let AP=Promise.resolve();async function pEe(t,e,r,n){await AP;const s=await Cm(t,e);if(!s)return!1;const i=s.listeners.length;return s.listeners=s.listeners.filter(({listener:o,once:a})=>{const c=Array.from(r);n&&c.push(n(a?null:o));try{o.call(t,...c)}catch{}return!a}),s.listeners.length===0&&(s.stop(),js(t).subs.delete(s.tag)),i>0}async function CP(t,e,r,n){try{await AP}catch{}const s=pEe(t,e,r,n);return AP=s,await s}const qb=["then"];var z$;z$=EA;const Fm=class Fm{constructor(e,r,n,s){K(this,"target");K(this,"interface");K(this,"runner");K(this,"filters");K(this,z$);K(this,"fallback");Q(typeof e=="string"||i7(e),"invalid value for Contract target","target",e),n==null&&(n=null);const i=_P.from(r);Ge(this,{target:e,runner:n,interface:i}),Object.defineProperty(this,EA,{value:{}});let o,a=null,c=null;if(s){const d=Jl(n);c=new tN(this.interface,d,s)}let u=new Map;if(typeof e=="string")if(zt(e))a=e,o=Promise.resolve(e);else{const d=Fd(n,"resolveName");if(!hC(d))throw wr("contract runner does not support name resolution","UNSUPPORTED_OPERATION",{operation:"resolveName"});o=d.resolveName(e).then(f=>{if(f==null)throw wr("an ENS name used for a contract target must be correctly configured","UNCONFIGURED_NAME",{value:e});return js(this).addr=f,f})}else o=e.getAddress().then(d=>{if(d==null)throw new Error("TODO");return js(this).addr=d,d});fEe(this,{addrPromise:o,addr:a,deployTx:c,subs:u});const l=new Proxy({},{get:(d,f,g)=>{if(typeof f=="symbol"||qb.indexOf(f)>=0)return Reflect.get(d,f,g);try{return this.getEvent(f)}catch(h){if(!Pn(h,"INVALID_ARGUMENT")||h.argument!=="key")throw h}},has:(d,f)=>qb.indexOf(f)>=0?Reflect.has(d,f):Reflect.has(d,f)||this.interface.hasEvent(String(f))});return Ge(this,{filters:l}),Ge(this,{fallback:i.receive||i.fallback?uEe(this):null}),new Proxy(this,{get:(d,f,g)=>{if(typeof f=="symbol"||f in d||qb.indexOf(f)>=0)return Reflect.get(d,f,g);try{return d.getFunction(f)}catch(h){if(!Pn(h,"INVALID_ARGUMENT")||h.argument!=="key")throw h}},has:(d,f)=>typeof f=="symbol"||f in d||qb.indexOf(f)>=0?Reflect.has(d,f):d.interface.hasFunction(f)})}connect(e){return new Fm(this.target,this.interface,e)}attach(e){return new Fm(e,this.interface,this.runner)}async getAddress(){return await js(this).addrPromise}async getDeployedCode(){const e=Jl(this.runner);ue(e,"runner does not support .provider","UNSUPPORTED_OPERATION",{operation:"getDeployedCode"});const r=await e.getCode(await this.getAddress());return r==="0x"?null:r}async waitForDeployment(){const e=this.deploymentTransaction();
270if(e)return await e.wait(),this;if(await this.getDeployedCode()!=null)return this;const n=Jl(this.runner);return ue(n!=null,"contract runner does not support .provider","UNSUPPORTED_OPERATION",{operation:"waitForDeployment"}),new Promise((s,i)=>{const o=async()=>{try{if(await this.getDeployedCode()!=null)return s(this);n.once("block",o)}catch(a){i(a)}};o()})}deploymentTransaction(){return js(this).deployTx}getFunction(e){return typeof e!="string"&&(e=e.format()),lEe(this,e)}getEvent(e){return typeof e!="string"&&(e=e.format()),dEe(this,e)}async queryTransaction(e){throw new Error("@TODO")}async queryFilter(e,r,n){r==null&&(r=0),n==null&&(n="latest");const{addr:s,addrPromise:i}=js(this),o=s||await i,{fragment:a,topics:c}=await rN(this,e),u={address:o,topics:c,fromBlock:r,toBlock:n},l=Jl(this.runner);return ue(l,"contract runner does not have a provider","UNSUPPORTED_OPERATION",{operation:"queryFilter"}),(await l.getLogs(u)).map(d=>{let f=a;if(f==null)try{f=this.interface.getEvent(d.topics[0])}catch{}if(f)try{return new eN(d,this.interface,f)}catch(g){return new V7(d,g)}return new T0(d,l)})}async on(e,r){const n=await Nk(this,"on",e);return n.listeners.push({listener:r,once:!1}),n.start(),this}async once(e,r){const n=await Nk(this,"once",e);return n.listeners.push({listener:r,once:!0}),n.start(),this}async emit(e,...r){return await CP(this,e,r,null)}async listenerCount(e){if(e){const s=await Cm(this,e);return s?s.listeners.length:0}const{subs:r}=js(this);let n=0;for(const{listeners:s}of r.values())n+=s.length;return n}async listeners(e){if(e){const s=await Cm(this,e);return s?s.listeners.map(({listener:i})=>i):[]}const{subs:r}=js(this);let n=[];for(const{listeners:s}of r.values())n=n.concat(s.map(({listener:i})=>i));return n}async off(e,r){const n=await Cm(this,e);if(!n)return this;if(r){const s=n.listeners.map(({listener:i})=>i).indexOf(r);s>=0&&n.listeners.splice(s,1)}return(r==null||n.listeners.length===0)&&(n.stop(),js(this).subs.delete(n.tag)),this}async removeAllListeners(e){if(e){const r=await Cm(this,e);if(!r)return this;r.stop(),js(this).subs.delete(r.tag)}else{const{subs:r}=js(this);for(const{tag:n,stop:s}of r.values())s(),r.delete(n)}return this}async addListener(e,r){return await this.on(e,r)}async removeListener(e,r){return await this.off(e,r)}static buildClass(e){class r extends Fm{constructor(s,i=null){super(s,e,i)}}return r}static from(e,r,n){return n==null&&(n=null),new this(e,r,n)}};let IP=Fm;function gEe(){return IP}class mh extends gEe(){}function rS(t){return t.match(/^ipfs:\/\/ipfs\//i)?t=t.substring(12):t.match(/^ipfs:\/\//i)?t=t.substring(7):Q(!1,"unsupported IPFS format","link",t),`https://gateway.ipfs.io/ipfs/${t}`}class mEe{constructor(e){K(this,"name");Ge(this,{name:e})}connect(e){return this}supportsCoinType(e){return!1}async encodeAddress(e,r){throw new Error("unsupported coin")}async decodeAddress(e,r){throw new Error("unsupported coin")}}const ez=new RegExp("^(ipfs)://(.*)$","i"),xk=[new RegExp("^(https)://(.*)$","i"),new RegExp("^(data):(.*)$","i"),ez,new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$","i")];var lu,ld,du,Wf,TA,tz;const rh=class rh{constructor(e,r,n){ne(this,du);K(this,"provider");K(this,"address");K(this,"name");ne(this,lu);ne(this,ld);Ge(this,{provider:e,address:r,name:n}),W(this,lu,null),W(this,ld,new mh(r,["function supportsInterface(bytes4) view returns (bool)","function resolve(bytes, bytes) view returns (bytes)","function addr(bytes32) view returns (address)","function addr(bytes32, uint) view returns (bytes)","function text(bytes32, string) view returns (string)","function contenthash(bytes32) view returns (bytes)"],e))}async supportsWildcard(){return $(this,lu)==null&&W(this,lu,(async()=>{try{return await $(this,ld).supportsInterface("0x9061b923")}catch(e){if(Pn(e,"CALL_EXCEPTION"))return!1;throw W(this,lu,null),e}})()),await $(this,lu)}async getAddress(e){if(e==null&&(e=60),e===60)try{const i=await ge(this,du,Wf).call(this,"addr(bytes32)");return i==null||i===Uy?null:i}catch(i){if(Pn(i,"CALL_EXCEPTION"))return null;throw i}if(e>=0&&e<2147483648){let i=e+2147483648;const o=await ge(this,du,Wf).call(this,"addr(bytes32,uint)",[i]);if(zt(o,20))return Dt(o)}let r=null;for(const i of this.provider.plugins)if(i instanceof mEe&&i.supportsCoinType(e)){r=i;break}if(r==null)return null;const n=await ge(this,du,Wf).call(this,"addr(bytes32,uint)",[e]);if(n==null||n==="0x")return null;const s=await r.decodeAddress(e,n);if(s!=null)return s;ue(!1,"invalid coin data","UNSUPPORTED_OPERATION",{operation:`getAddress(${e})`,info:{coinType:e,data:n}})}async getText(e){const r=await ge(this,du,Wf).call(this,"text(bytes32,string)",[e]);return r==null||r==="0x"?null:r}async getContentHash(){const e=await ge(this,du,Wf).call(this,"contenthash(bytes32)");if(e==null||e==="0x")return null;const r=e.match(/^0x(e3010170|e5010172)(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/);if(r){const s=r[1]==="e3010170"?"ipfs":"ipns",i=parseInt(r[4],16);if(r[5].length===i*2)return`${s}://${C0e("0x"+r[2])}`}const n=e.match(/^0xe40101fa011b20([0-9a-f]*)$/);if(n&&n[1].length===64)return`bzz://${n[1]}`;ue(!1,"invalid or unsupported content hash data","UNSUPPORTED_OPERATION",{operation:"getContentHash()",info:{data:e}})}async getAvatar(){return(await this._getAvatar()).url}async _getAvatar(){const e=[{type:"name",value:this.name}];try{const r=await this.getText("avatar");if(r==null)return e.push({type:"!avatar",value:""}),{url:null,linkage:e};e.push({type:"avatar",value:r});for(let n=0;n<xk.length;n++){const s=r.match(xk[n]);if(s==null)continue;const i=s[1].toLowerCase();switch(i){case"https":case"data":return e.push({type:"url",value:r}),{linkage:e,url:r};case"ipfs":{const o=rS(r);return e.push({type:"ipfs",value:r}),e.push({type:"url",value:o}),{linkage:e,url:o}}case"erc721":case"erc1155":{const o=i==="erc721"?"tokenURI(uint256)":"uri(uint256)";e.push({type:i,value:r});const a=await this.getAddress();if(a==null)return e.push({type:"!owner",value:""}),{url:null,linkage:e};const c=(s[2]||"").split("/");if(c.length!==2)return e.push({type:`!${i}caip`,value:s[2]||""}),{url:null,linkage:e};const u=c[1],l=new mh(c[0],["function tokenURI(uint) view returns (string)","function ownerOf(uint) view returns (address)","function uri(uint) view returns (string)","function balanceOf(address, uint256) view returns (uint)"],this.provider);if(i==="erc721"){const p=await l.ownerOf(u);
270if(a!==p)return e.push({type:"!owner",value:p}),{url:null,linkage:e};e.push({type:"owner",value:p})}else if(i==="erc1155"){const p=await l.balanceOf(a,u);if(!p)return e.push({type:"!balance",value:"0"}),{url:null,linkage:e};e.push({type:"balance",value:p.toString()})}let d=await l[o](u);if(d==null||d==="0x")return e.push({type:"!metadata-url",value:""}),{url:null,linkage:e};e.push({type:"metadata-url-base",value:d}),i==="erc1155"&&(d=d.replace("{id}",ju(u,32).substring(2)),e.push({type:"metadata-url-expanded",value:d})),d.match(/^ipfs:/i)&&(d=rS(d)),e.push({type:"metadata-url",value:d});let f={};const g=await new uc(d).send();g.assertOk();try{f=g.bodyJson}catch{try{e.push({type:"!metadata",value:g.bodyText})}catch{const w=g.body;return w&&e.push({type:"!metadata",value:De(w)}),{url:null,linkage:e}}return{url:null,linkage:e}}if(!f)return e.push({type:"!metadata",value:""}),{url:null,linkage:e};e.push({type:"metadata",value:JSON.stringify(f)});let h=f.image;if(typeof h!="string")return e.push({type:"!imageUrl",value:""}),{url:null,linkage:e};if(!h.match(/^(https:\/\/|data:)/i)){if(h.match(ez)==null)return e.push({type:"!imageUrl-ipfs",value:h}),{url:null,linkage:e};e.push({type:"imageUrl-ipfs",value:h}),h=rS(h)}return e.push({type:"url",value:h}),{linkage:e,url:h}}}}}catch{}return{linkage:e,url:null}}static async getEnsAddress(e){const r=await e.getNetwork(),n=r.getPlugin("org.ethers.plugins.network.Ens");return ue(n,"network does not support ENS","UNSUPPORTED_OPERATION",{operation:"getEnsAddress",info:{network:r}}),n.address}static async fromName(e,r){var s;let n=r;for(;;){if(n===""||n==="."||r!=="eth"&&n==="eth")return null;const i=await ge(s=rh,TA,tz).call(s,e,n);if(i!=null){const o=new rh(e,i,r);return n!==r&&!await o.supportsWildcard()?null:o}n=n.split(".").slice(1).join(".")}}};lu=new WeakMap,ld=new WeakMap,du=new WeakSet,Wf=async function(e,r){r=(r||[]).slice();const n=$(this,ld).interface;r.unshift(EP(this.name));let s=null;await this.supportsWildcard()&&(s=n.getFunction(e),ue(s,"missing fragment","UNKNOWN_ERROR",{info:{funcName:e}}),r=[g1e(this.name,255),n.encodeFunctionData(s,r)],e="resolve(bytes,bytes)"),r.push({enableCcipRead:!0});try{const i=await $(this,ld)[e](...r);return s?n.decodeFunctionResult(s,i)[0]:i}catch(i){if(!Pn(i,"CALL_EXCEPTION"))throw i}return null},TA=new WeakSet,tz=async function(e,r){const n=await rh.getEnsAddress(e);try{const i=await new mh(n,["function resolver(bytes32) view returns (address)"],e).resolver(EP(r),{enableCcipRead:!0});return i===Uy?null:i}catch(s){throw s}return null},ne(rh,TA);let vA=rh;const Rk=BigInt(0);function At(t,e){return function(r){return r==null?e:t(r)}}function pC(t,e){return r=>{if(e&&r==null)return null;if(!Array.isArray(r))throw new Error("not an array");return r.map(n=>t(n))}}function P0(t,e){return r=>{const n={};for(const s in t){let i=s;if(e&&s in e&&!(i in r)){for(const o of e[s])if(o in r){i=o;break}}try{const o=t[s](r[i]);o!==void 0&&(n[s]=o)}catch(o){const a=o instanceof Error?o.message:"not-an-error";ue(!1,`invalid value for value.${s} (${a})`,"BAD_DATA",{value:r})}}return n}}function yEe(t){switch(t){case!0:case"true":return!0;case!1:case"false":return!1}Q(!1,`invalid boolean; ${JSON.stringify(t)}`,"value",t)}function Ap(t){return Q(zt(t,!0),"invalid data","value",t),t}function cn(t){return Q(zt(t,32),"invalid hash","value",t),t}const bEe=P0({address:Dt,blockHash:cn,blockNumber:nt,data:Ap,index:nt,removed:At(yEe,!1),topics:pC(cn),transactionHash:cn,transactionIndex:nt},{index:["logIndex"]});function wEe(t){return bEe(t)}const EEe=P0({hash:At(cn),parentHash:cn,parentBeaconBlockRoot:At(cn,null),number:nt,timestamp:nt,nonce:At(Ap),difficulty:$e,gasLimit:$e,gasUsed:$e,stateRoot:At(cn,null),receiptsRoot:At(cn,null),blobGasUsed:At($e,null),excessBlobGas:At($e,null),miner:At(Dt),prevRandao:At(cn,null),extraData:Ap,baseFeePerGas:At($e)},{prevRandao:["mixHash"]});function vEe(t){const e=EEe(t);return e.transactions=t.transactions.map(r=>typeof r=="string"?r:rz(r)),e}const _Ee=P0({transactionIndex:nt,blockNumber:nt,transactionHash:cn,address:Dt,topics:pC(cn),data:Ap,index:nt,blockHash:cn},{index:["logIndex"]});function AEe(t){return _Ee(t)}const CEe=P0({to:At(Dt,null),from:At(Dt,null),contractAddress:At(Dt,null),index:nt,root:At(De),gasUsed:$e,blobGasUsed:At($e,null),logsBloom:At(Ap),blockHash:cn,hash:cn,logs:pC(AEe),blockNumber:nt,cumulativeGasUsed:$e,effectiveGasPrice:At($e),blobGasPrice:At($e,null),status:At(nt),type:At(nt,0)},{effectiveGasPrice:["gasPrice"],hash:["transactionHash"],index:["transactionIndex"]});function IEe(t){return CEe(t)}function rz(t){t.to&&$e(t.to)===Rk&&(t.to="0x0000000000000000000000000000000000000000");const e=P0({hash:cn,index:At(nt,void 0),type:r=>r==="0x"||r==null?0:nt(r),accessList:At(Jd,null),blobVersionedHashes:At(pC(cn,!0),null),blockHash:At(cn,null),blockNumber:At(nt,null),transactionIndex:At(nt,null),from:Dt,gasPrice:At($e),maxPriorityFeePerGas:At($e),maxFeePerGas:At($e),maxFeePerBlobGas:At($e,null),gasLimit:$e,to:At(Dt,null),value:$e,nonce:nt,data:Ap,creates:At(Dt,null),chainId:At($e,null)},{data:["input"],gasLimit:["gas"],index:["transactionIndex"]})(t);if(e.to==null&&e.creates==null&&(e.creates=bwe(e)),(t.type===1||t.type===2)&&t.accessList==null&&(e.accessList=[]),t.signature?e.signature=Yi.from(t.signature):e.signature=Yi.from(t),e.chainId==null){const r=e.signature.legacyChainId;r!=null&&(e.chainId=r)}return e.blockHash&&$e(e.blockHash)===Rk&&(e.blockHash=null),e}const SEe="0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e";class O0{constructor(e){K(this,"name");Ge(this,{name:e})}clone(){return new O0(this.name)}}class gC extends O0{constructor(r,n){r==null&&(r=0);super(`org.ethers.network.plugins.GasCost#${r||0}`);K(this,"effectiveBlock");K(this,"txBase");K(this,"txCreate");K(this,"txDataZero");K(this,"txDataNonzero");K(this,"txAccessListStorageKey");K(this,"txAccessListAddress");const s={effectiveBlock:r};function i(o,a){let c=(n||{})[o];c==null&&(c=a),Q(typeof c=="number",`invalud value for ${o}`,"costs",n),s[o]=c}i("txBase",21e3),i("txCreate",32e3),i("txDataZero",4),i("txDataNonzero",16),i("txAccessListStorageKey",1900),i("txAccessListAddress",2400),Ge(this,s)}clone(){return new gC(this.effectiveBlock,this)}}class mC extends O0{constructor(r,n){super("org.ethers.plugins.network.Ens");K(this,"address");K(this,"targetNetwork");Ge(this,{address:r||SEe,targetNetwork:n??1})}clone(){return new mC(this.address,this.targetNetwork)}}var e0,t0;class TEe extends O0{constructor(r,n){super("org.ethers.plugins.network.FetchUrlFeeDataPlugin");ne(this,e0);ne(this,t0);W(this,e0,r),W(this,t0,n)}get url(){return $(this,e0)}get processFunc(){return $(this,t0)}clone(){return this}}e0=new WeakMap,t0=new WeakMap;const nS=new Map;var Wh,Vh,fu;const nh=class nh{constructor(e,r){ne(this,Wh);ne(this,Vh);ne(this,fu);W(this,Wh,e),W(this,Vh,$e(r)),W(this,fu,new Map)}toJSON(){return{name:this.name,chainId:String(this.chainId)}}get name(){return $(this,Wh)}set name(e){W(this,Wh,e)}get chainId(){return $(this,Vh)}set chainId(e){W(this,Vh,$e(e,"chainId"))}matches(e){if(e==null)return!1;if(typeof e=="string"){try{return this.chainId===$e(e)}catch{}return this.name===e}if(typeof e=="number"||typeof e=="bigint"){try{return this.chainId===$e(e)}catch{}return!1}if(typeof e=="object"){if(e.chainId!=null){try{return this.chainId===$e(e.chainId)}catch{}return!1}return e.name!=null?this.name===e.name:!1}return!1}get plugins(){return Array.from($(this,fu).values())}attachPlugin(e){if($(this,fu).get(e.name))throw new Error(`cannot replace existing plugin: ${e.name} `);return $(this,fu).set(e.name,e.clone()),this}getPlugin(e){return $(this,fu).get(e)||null}getPlugins(e){return this.plugins.filter(r=>r.name.split("#")[0]===e)}clone(){const e=new nh(this.name,this.chainId);return this.plugins.forEach(r=>{e.attachPlugin(r.clone())}),e}computeIntrinsicGas(e){const r=this.getPlugin("org.ethers.plugins.network.GasCost")||new gC;let n=r.txBase;if(e.to==null&&(n+=r.txCreate),e.data)for(let s=2;s<e.data.length;s+=2)e.data.substring(s,s+2)==="00"?n+=r.txDataZero:n+=r.txDataNonzero;if(e.accessList){const s=Jd(e.accessList);for(const i in s)n+=r.txAccessListAddress+r.txAccessListStorageKey*s[i].storageKeys.length}return n}static from(e){if(PEe(),e==null)return nh.from("mainnet");if(typeof e=="number"&&(e=BigInt(e)),typeof e=="string"||typeof e=="bigint"){const r=nS.get(e);if(r)return r();if(typeof e=="bigint")return new nh("unknown",e);Q(!1,"unknown network","network",e)}if(typeof e.clone=="function")return e.clone();if(typeof e=="object"){Q(typeof e.name=="string"&&typeof e.chainId=="number","invali
270d network object name or chainId","network",e);const r=new nh(e.name,e.chainId);return(e.ensAddress||e.ensNetwork!=null)&&r.attachPlugin(new mC(e.ensAddress,e.ensNetwork)),r}Q(!1,"invalid network","network",e)}static register(e,r){typeof e=="number"&&(e=BigInt(e));const n=nS.get(e);n&&Q(!1,`conflicting network for ${JSON.stringify(n.name)}`,"nameOrChainId",e),nS.set(e,r)}};Wh=new WeakMap,Vh=new WeakMap,fu=new WeakMap;let Do=nh;function Bk(t,e){const r=String(t);if(!r.match(/^[0-9.]+$/))throw new Error(`invalid gwei value: ${t}`);const n=r.split(".");if(n.length===1&&n.push(""),n.length!==2)throw new Error(`invalid gwei value: ${t}`);for(;n[1].length<e;)n[1]+="0";if(n[1].length>9){let s=BigInt(n[1].substring(0,9));n[1].substring(9).match(/^0+$/)||s++,n[1]=s.toString()}return BigInt(n[0]+n[1])}function kk(t){return new TEe(t,async(e,r,n)=>{n.setHeader("User-Agent","ethers");let s;try{const[i,o]=await Promise.all([n.send(),e()]);s=i;const a=s.bodyJson.standard;return{gasPrice:o.gasPrice,maxFeePerGas:Bk(a.maxFee,9),maxPriorityFeePerGas:Bk(a.maxPriorityFee,9)}}catch(i){ue(!1,`error encountered with polygon gas station (${JSON.stringify(n.url)})`,"SERVER_ERROR",{request:n,response:s,error:i})}})}let jk=!1;function PEe(){if(jk)return;jk=!0;function t(e,r,n){const s=function(){const i=new Do(e,r);return n.ensNetwork!=null&&i.attachPlugin(new mC(null,n.ensNetwork)),i.attachPlugin(new gC),(n.plugins||[]).forEach(o=>{i.attachPlugin(o)}),i};Do.register(e,s),Do.register(r,s),n.altNames&&n.altNames.forEach(i=>{Do.register(i,s)})}t("mainnet",1,{ensNetwork:1,altNames:["homestead"]}),t("ropsten",3,{ensNetwork:3}),t("rinkeby",4,{ensNetwork:4}),t("goerli",5,{ensNetwork:5}),t("kovan",42,{ensNetwork:42}),t("sepolia",11155111,{ensNetwork:11155111}),t("holesky",17e3,{ensNetwork:17e3}),t("classic",61,{}),t("classicKotti",6,{}),t("arbitrum",42161,{ensNetwork:1}),t("arbitrum-goerli",421613,{}),t("arbitrum-sepolia",421614,{}),t("base",8453,{ensNetwork:1}),t("base-goerli",84531,{}),t("base-sepolia",84532,{}),t("bnb",56,{ensNetwork:1}),t("bnbt",97,{}),t("linea",59144,{ensNetwork:1}),t("linea-goerli",59140,{}),t("linea-sepolia",59141,{}),t("matic",137,{ensNetwork:1,plugins:[kk("https://gasstation.polygon.technology/v2")]}),t("matic-amoy",80002,{}),t("matic-mumbai",80001,{altNames:["maticMumbai","maticmum"],plugins:[kk("https://gasstation-testnet.polygon.technology/v2")]}),t("optimism",10,{ensNetwork:1,plugins:[]}),t("optimism-goerli",420,{}),t("optimism-sepolia",11155420,{}),t("xdai",100,{ensNetwork:1})}function SP(t){return JSON.parse(JSON.stringify(t))}var za,ii,hu,Co,Gh,A_;class OEe{constructor(e){ne(this,Gh);ne(this,za);ne(this,ii);ne(this,hu);ne(this,Co);W(this,za,e),W(this,ii,null),W(this,hu,4e3),W(this,Co,-2)}get pollingInterval(){return $(this,hu)}set pollingInterval(e){W(this,hu,e)}start(){$(this,ii)||(W(this,ii,$(this,za)._setTimeout(ge(this,Gh,A_).bind(this),$(this,hu))),ge(this,Gh,A_).call(this))}stop(){$(this,ii)&&($(this,za)._clearTimeout($(this,ii)),W(this,ii,null))}pause(e){this.stop(),e&&W(this,Co,-2)}resume(){this.start()}}za=new WeakMap,ii=new WeakMap,hu=new WeakMap,Co=new WeakMap,Gh=new WeakSet,A_=async function(){try{const e=await $(this,za).getBlockNumber();if($(this,Co)===-2){W(this,Co,e);return}if(e!==$(this,Co)){for(let r=$(this,Co)+1;r<=e;r++){if($(this,ii)==null)return;await $(this,za).emit("block",r)}W(this,Co,e)}}catch{}$(this,ii)!=null&&W(this,ii,$(this,za)._setTimeout(ge(this,Gh,A_).bind(this),$(this,hu)))};var dd,fd,pu;class nN{constructor(e){ne(this,dd);ne(this,fd);ne(this,pu);W(this,dd,e),W(this,pu,!1),W(this,fd,r=>{this._poll(r,$(this,dd))})}async _poll(e,r){throw new Error("sub-classes must override this")}start(){$(this,pu)||(W(this,pu,!0),$(this,fd).call(this,-2),$(this,dd).on("block",$(this,fd)))}stop(){$(this,pu)&&(W(this,pu,!1),$(this,dd).off("block",$(this,fd)))}pause(e){this.stop()}resume(){this.start()}}dd=new WeakMap,fd=new WeakMap,pu=new WeakMap;var Kh,Wa;class NEe extends nN{constructor(r,n){super(r);ne(this,Kh);ne(this,Wa);W(this,Kh,n),W(this,Wa,-2)}pause(r){r&&W(this,Wa,-2),super.pause(r)}async _poll(r,n){const s=await n.getBlock($(this,Kh));s!=null&&($(this,Wa)===-2?W(this,Wa,s.number):s.number>$(this,Wa)&&(n.emit($(this,Kh),s.number),W(this,Wa,s.number)))}}Kh=new WeakMap,Wa=new WeakMap;var PA;class xEe extends nN{constructor(r,n){super(r);ne(this,PA);W(this,PA,SP(n))}async _poll(r,n){throw new Error("@TODO")}}PA=new WeakMap;var Zh;class REe extends nN{constructor(r,n){super(r);ne(this,Zh);W(this,Zh,n)}async _poll(r,n){const s=await n.getTransactionReceipt($(this,Zh));s&&n.emit($(this,Zh),s)}}Zh=new WeakMap;var Va,Yh,Jh,gu,oi,OA,nz;class sN{constructor(e,r){ne(this,OA);ne(this,Va);ne(this,Yh);ne(this,Jh);ne(this,gu);ne(this,oi);W(this,Va,e),W(this,Yh,SP(r)),W(this,Jh,ge(this,OA,nz).bind(this)),W(this,gu,!1),W(this,oi,-2)}start(){$(this,gu)||(W(this,gu,!0),$(this,oi)===-2&&$(this,Va).getBlockNumber().then(e=>{W(this,oi,e)}),$(this,Va).on("block",$(this,Jh)))}stop(){$(this,gu)&&(W(this,gu,!1),$(this,Va).off("block",$(this,Jh)))}pause(e){this.stop(),e&&W(this,oi,-2)}resume(){this.start()}}Va=new WeakMap,Yh=new WeakMap,Jh=new WeakMap,gu=new WeakMap,oi=new WeakMap,OA=new WeakSet,nz=async function(e){if($(this,oi)===-2)return;const r=SP($(this,Yh));r.fromBlock=$(this,oi)+1,r.toBlock=e;const n=await $(this,Va).getLogs(r);if(n.length===0){$(this,oi)<e-60&&W(this,oi,e-60);return}for(const s of n)$(this,Va).emit($(this,Yh),s),W(this,oi,s.blockNumber)};const BEe=BigInt(2),kEe=10;function zb(t){return t&&typeof t.then=="function"}function C_(t,e){return t+":"+JSON.stringify(e,(r,n)=>{if(n==null)return"null";if(typeof n=="bigint")return`bigint:${n.toString()}`;if(typeof n=="string")return n.toLowerCase();if(typeof n=="object"&&!Array.isArray(n)){const s=Object.keys(n);return s.sort(),s.reduce((i,o)=>(i[o]=n[o],i),{})}return n})}class sz{constructor(e){K(this,"name");Ge(this,{name:e})}start(){}stop(){}pause(e){}resume(){}}function jEe(t){return JSON.parse(JSON.stringify(t))}function TP(t){return t=Array.from(new Set(t).values()),t.sort(),t}async function sS(t,e){if(t==null)throw new Error("invalid event");
270if(Array.isArray(t)&&(t={topics:t}),typeof t=="string")switch(t){case"block":case"debug":case"error":case"finalized":case"network":case"pending":case"safe":return{type:t,tag:t}}if(zt(t,32)){const r=t.toLowerCase();return{type:"transaction",tag:C_("tx",{hash:r}),hash:r}}if(t.orphan){const r=t;return{type:"orphan",tag:C_("orphan",r),filter:jEe(r)}}if(t.address||t.topics){const r=t,n={topics:(r.topics||[]).map(s=>s==null?null:Array.isArray(s)?TP(s.map(i=>i.toLowerCase())):s.toLowerCase())};if(r.address){const s=[],i=[],o=a=>{zt(a)?s.push(a):i.push((async()=>{s.push(await Vn(a,e))})())};Array.isArray(r.address)?r.address.forEach(o):o(r.address),i.length&&await Promise.all(i),n.address=TP(s.map(a=>a.toLowerCase()))}return{filter:n,tag:C_("event",n),type:"event"}}Q(!1,"unknown ProviderEvent","event",t)}function iS(){return new Date().getTime()}const DEe={cacheTimeout:250,pollingInterval:4e3};var vn,mu,_n,Qh,$s,hd,yu,Ga,r0,ai,Xh,ep,dt,Bs,PP,OP,Im,NP,Sm,I_;class UEe{constructor(e,r){ne(this,dt);ne(this,vn);ne(this,mu);ne(this,_n);ne(this,Qh);ne(this,$s);ne(this,hd);ne(this,yu);ne(this,Ga);ne(this,r0);ne(this,ai);ne(this,Xh);ne(this,ep);if(W(this,ep,Object.assign({},DEe,r||{})),e==="any")W(this,hd,!0),W(this,$s,null);else if(e){const n=Do.from(e);W(this,hd,!1),W(this,$s,Promise.resolve(n)),setTimeout(()=>{this.emit("network",n,null)},0)}else W(this,hd,!1),W(this,$s,null);W(this,Ga,-1),W(this,yu,new Map),W(this,vn,new Map),W(this,mu,new Map),W(this,_n,null),W(this,Qh,!1),W(this,r0,1),W(this,ai,new Map),W(this,Xh,!1)}get pollingInterval(){return $(this,ep).pollingInterval}get provider(){return this}get plugins(){return Array.from($(this,mu).values())}attachPlugin(e){if($(this,mu).get(e.name))throw new Error(`cannot replace existing plugin: ${e.name} `);return $(this,mu).set(e.name,e.connect(this)),this}getPlugin(e){return $(this,mu).get(e)||null}get disableCcipRead(){return $(this,Xh)}set disableCcipRead(e){W(this,Xh,!!e)}async ccipReadFetch(e,r,n){if(this.disableCcipRead||n.length===0||e.to==null)return null;const s=e.to.toLowerCase(),i=r.toLowerCase(),o=[];for(let a=0;a<n.length;a++){const c=n[a],u=c.replace("{sender}",s).replace("{data}",i),l=new uc(u);c.indexOf("{data}")===-1&&(l.body={data:i,sender:s}),this.emit("debug",{action:"sendCcipReadFetchRequest",request:l,index:a,urls:n});let d="unknown error";const f=await l.send();try{const g=f.bodyJson;if(g.data)return this.emit("debug",{action:"receiveCcipReadFetchResult",request:l,result:g}),g.data;g.message&&(d=g.message),this.emit("debug",{action:"receiveCcipReadFetchError",request:l,result:g})}catch{}ue(f.statusCode<400||f.statusCode>=500,`response not found during CCIP fetch: ${d}`,"OFFCHAIN_FAULT",{reason:"404_MISSING_RESOURCE",transaction:e,info:{url:c,errorMessage:d}}),o.push(d)}ue(!1,`error encountered during CCIP fetch: ${o.map(a=>JSON.stringify(a)).join(", ")}`,"OFFCHAIN_FAULT",{reason:"500_SERVER_ERROR",transaction:e,info:{urls:n,errorMessages:o}})}_wrapBlock(e,r){return new rEe(vEe(e),this)}_wrapLog(e,r){return new T0(wEe(e),this)}_wrapTransactionReceipt(e,r){return new q7(IEe(e),this)}_wrapTransactionResponse(e,r){return new Wy(rz(e),this)}_detectNetwork(){ue(!1,"sub-classes must implement this","UNSUPPORTED_OPERATION",{operation:"_detectNetwork"})}async _perform(e){ue(!1,`unsupported method: ${e.method}`,"UNSUPPORTED_OPERATION",{operation:e.method,info:e})}async getBlockNumber(){const e=nt(await ge(this,dt,Bs).call(this,{method:"getBlockNumber"}),"%response");return $(this,Ga)>=0&&W(this,Ga,e),e}_getAddress(e){return Vn(e,this)}_getBlockTag(e){if(e==null)return"latest";switch(e){case"earliest":return"0x0";case"finalized":case"latest":case"pending":case"safe":return e}if(zt(e))return zt(e,32)?e:Xf(e);if(typeof e=="bigint"&&(e=nt(e,"blockTag")),typeof e=="number")return e>=0?Xf(e):$(this,Ga)>=0?Xf($(this,Ga)+e):this.getBlockNumber().then(r=>Xf(r+e));Q(!1,"invalid blockTag","blockTag",e)}_getFilter(e){const r=(e.topics||[]).map(c=>c==null?null:Array.isArray(c)?TP(c.map(u=>u.toLowerCase())):c.toLowerCase()),n="blockHash"in e?e.blockHash:void 0,s=(c,u,l)=>{let d;switch(c.length){case 0:break;case 1:d=c[0];break;default:c.sort(),d=c}if(n&&(u!=null||l!=null))throw new Error("invalid filter");const f={};return d&&(f.address=d),r.length&&(f.topics=r),u&&(f.fromBlock=u),l&&(f.toBlock=l),n&&(f.blockHash=n),f};let i=[];if(e.address)if(Array.isArray(e.address))for(const c of e.address)i.push(this._getAddress(c));else i.push(this._getAddress(e.address));let o;"fromBlock"in e&&(o=this._getBlockTag(e.fromBlock));let a;return"toBlock"in e&&(a=this._getBlockTag(e.toBlock)),i.filter(c=>typeof c!="string").length||o!=null&&typeof o!="string"||a!=null&&typeof a!="string"?Promise.all([Promise.all(i),o,a]).then(c=>s(c[0],c[1],c[2])):s(i,o,a)}_getTransactionRequest(e){const r=wA(e),n=[];if(["to","from"].forEach(s=>{if(r[s]==null)return;const i=Vn(r[s],this);zb(i)?n.push(async function(){r[s]=await i}()):r[s]=i}),r.blockTag!=null){const s=this._getBlockTag(r.blockTag);zb(s)?n.push(async function(){r.blockTag=await s}()):r.blockTag=s}return n.length?async function(){return await Promise.all(n),r}():r}async getNetwork(){if($(this,$s)==null){const s=(async()=>{try{const i=await this._detectNetwork();
270return this.emit("network",i,null),i}catch(i){throw $(this,$s)===s&&W(this,$s,null),i}})();return W(this,$s,s),(await s).clone()}const e=$(this,$s),[r,n]=await Promise.all([e,this._detectNetwork()]);return r.chainId!==n.chainId&&($(this,hd)?(this.emit("network",n,r),$(this,$s)===e&&W(this,$s,Promise.resolve(n))):ue(!1,`network changed: ${r.chainId} => ${n.chainId} `,"NETWORK_ERROR",{event:"changed"})),r.clone()}async getFeeData(){const e=await this.getNetwork(),r=async()=>{const{_block:s,gasPrice:i,priorityFee:o}=await Ln({_block:ge(this,dt,NP).call(this,"latest",!1),gasPrice:(async()=>{try{const l=await ge(this,dt,Bs).call(this,{method:"getGasPrice"});return $e(l,"%response")}catch{}return null})(),priorityFee:(async()=>{try{const l=await ge(this,dt,Bs).call(this,{method:"getPriorityFee"});return $e(l,"%response")}catch{}return null})()});let a=null,c=null;const u=this._wrapBlock(s,e);return u&&u.baseFeePerGas&&(c=o??BigInt("1000000000"),a=u.baseFeePerGas*BEe+c),new Pk(i,a,c)},n=e.getPlugin("org.ethers.plugins.network.FetchUrlFeeDataPlugin");if(n){const s=new uc(n.url),i=await n.processFunc(r,this,s);return new Pk(i.gasPrice,i.maxFeePerGas,i.maxPriorityFeePerGas)}return await r()}async estimateGas(e){let r=this._getTransactionRequest(e);return zb(r)&&(r=await r),$e(await ge(this,dt,Bs).call(this,{method:"estimateGas",transaction:r}),"%response")}async call(e){const{tx:r,blockTag:n}=await Ln({tx:this._getTransactionRequest(e),blockTag:this._getBlockTag(e.blockTag)});return await ge(this,dt,OP).call(this,ge(this,dt,PP).call(this,r,n,e.enableCcipRead?0:-1))}async getBalance(e,r){return $e(await ge(this,dt,Im).call(this,{method:"getBalance"},e,r),"%response")}async getTransactionCount(e,r){return nt(await ge(this,dt,Im).call(this,{method:"getTransactionCount"},e,r),"%response")}async getCode(e,r){return De(await ge(this,dt,Im).call(this,{method:"getCode"},e,r))}async getStorage(e,r,n){const s=$e(r,"position");return De(await ge(this,dt,Im).call(this,{method:"getStorage",position:s},e,n))}async broadcastTransaction(e){const{blockNumber:r,hash:n,network:s}=await Ln({blockNumber:this.getBlockNumber(),hash:this._perform({method:"broadcastTransaction",signedTransaction:e}),network:this.getNetwork()}),i=yA.from(e);if(i.hash!==n)throw new Error("@TODO: the returned hash did not match");return this._wrapTransactionResponse(i,s).replaceableTransaction(r)}async getBlock(e,r){const{network:n,params:s}=await Ln({network:this.getNetwork(),params:ge(this,dt,NP).call(this,e,!!r)});return s==null?null:this._wrapBlock(s,n)}async getTransaction(e){const{network:r,params:n}=await Ln({network:this.getNetwork(),params:ge(this,dt,Bs).call(this,{method:"getTransaction",hash:e})});return n==null?null:this._wrapTransactionResponse(n,r)}async getTransactionReceipt(e){const{network:r,params:n}=await Ln({network:this.getNetwork(),params:ge(this,dt,Bs).call(this,{method:"getTransactionReceipt",hash:e})});if(n==null)return null;if(n.gasPrice==null&&n.effectiveGasPrice==null){const s=await ge(this,dt,Bs).call(this,{method:"getTransaction",hash:e});if(s==null)throw new Error("report this; could not find tx or effectiveGasPrice");n.effectiveGasPrice=s.gasPrice}return this._wrapTransactionReceipt(n,r)}async getTransactionResult(e){const{result:r}=await Ln({network:this.getNetwork(),result:ge(this,dt,Bs).call(this,{method:"getTransactionResult",hash:e})});return r==null?null:De(r)}async getLogs(e){let r=this._getFilter(e);zb(r)&&(r=await r);const{network:n,params:s}=await Ln({network:this.getNetwork(),params:ge(this,dt,Bs).call(this,{method:"getLogs",filter:r})});return s.map(i=>this._wrapLog(i,n))}_getProvider(e){ue(!1,"provider cannot connect to target network","UNSUPPORTED_OPERATION",{operation:"_getProvider()"})}async getResolver(e){return await vA.fromName(this,e)}async getAvatar(e){const r=await this.getResolver(e);return r?await r.getAvatar():null}async resolveName(e){const r=await this.getResolver(e);return r?await r.getAddress():null}async lookupAddress(e){e=Dt(e);const r=EP(e.substring(2).toLowerCase()+".addr.reverse");try{const n=await vA.getEnsAddress(this),i=await new mh(n,["function resolver(bytes32) view returns (address)"],this).resolver(r);if(i==null||i===Uy)return null;const a=await new mh(i,["function name(bytes32) view returns (string)"],this).name(r);return await this.resolveName(a)!==e?null:a}catch(n){if(Pn(n,"BAD_DATA")&&n.value==="0x"||Pn(n,"CALL_EXCEPTION"))return null;throw n}return null}async waitForTransaction(e,r,n){const s=r??1;return s===0?this.getTransactionReceipt(e):new Promise(async(i,o)=>{let a=null;const c=async u=>{try{const l=await this.getTransactionReceipt(e);
270if(l!=null&&u-l.blockNumber+1>=s){i(l),a&&(clearTimeout(a),a=null);return}}catch(l){console.log("EEE",l)}this.once("block",c)};n!=null&&(a=setTimeout(()=>{a!=null&&(a=null,this.off("block",c),o(wr("timeout","TIMEOUT",{reason:"timeout"})))},n)),c(await this.getBlockNumber())})}async waitForBlock(e){ue(!1,"not implemented yet","NOT_IMPLEMENTED",{operation:"waitForBlock"})}_clearTimeout(e){const r=$(this,ai).get(e);r&&(r.timer&&clearTimeout(r.timer),$(this,ai).delete(e))}_setTimeout(e,r){r==null&&(r=0);const n=zp(this,r0)._++,s=()=>{$(this,ai).delete(n),e()};if(this.paused)$(this,ai).set(n,{timer:null,func:s,time:r});else{const i=setTimeout(s,r);$(this,ai).set(n,{timer:i,func:s,time:iS()})}return n}_forEachSubscriber(e){for(const r of $(this,vn).values())e(r.subscriber)}_getSubscriber(e){switch(e.type){case"debug":case"error":case"network":return new sz(e.type);case"block":{const r=new OEe(this);return r.pollingInterval=this.pollingInterval,r}case"safe":case"finalized":return new NEe(this,e.type);case"event":return new sN(this,e.filter);case"transaction":return new REe(this,e.hash);case"orphan":return new xEe(this,e.filter)}throw new Error(`unsupported event: ${e.type}`)}_recoverSubscriber(e,r){for(const n of $(this,vn).values())if(n.subscriber===e){n.started&&n.subscriber.stop(),n.subscriber=r,n.started&&r.start(),$(this,_n)!=null&&r.pause($(this,_n));break}}async on(e,r){const n=await ge(this,dt,I_).call(this,e);return n.listeners.push({listener:r,once:!1}),n.started||(n.subscriber.start(),n.started=!0,$(this,_n)!=null&&n.subscriber.pause($(this,_n))),this}async once(e,r){const n=await ge(this,dt,I_).call(this,e);return n.listeners.push({listener:r,once:!0}),n.started||(n.subscriber.start(),n.started=!0,$(this,_n)!=null&&n.subscriber.pause($(this,_n))),this}async emit(e,...r){const n=await ge(this,dt,Sm).call(this,e,r);if(!n||n.listeners.length===0)return!1;const s=n.listeners.length;return n.listeners=n.listeners.filter(({listener:i,once:o})=>{const a=new bq(this,o?null:i,e);try{i.call(this,...r,a)}catch{}return!o}),n.listeners.length===0&&(n.started&&n.subscriber.stop(),$(this,vn).delete(n.tag)),s>0}async listenerCount(e){if(e){const n=await ge(this,dt,Sm).call(this,e);return n?n.listeners.length:0}let r=0;for(const{listeners:n}of $(this,vn).values())r+=n.length;return r}async listeners(e){if(e){const n=await ge(this,dt,Sm).call(this,e);return n?n.listeners.map(({listener:s})=>s):[]}let r=[];for(const{listeners:n}of $(this,vn).values())r=r.concat(n.map(({listener:s})=>s));return r}async off(e,r){const n=await ge(this,dt,Sm).call(this,e);if(!n)return this;if(r){const s=n.listeners.map(({listener:i})=>i).indexOf(r);s>=0&&n.listeners.splice(s,1)}return(!r||n.listeners.length===0)&&(n.started&&n.subscriber.stop(),$(this,vn).delete(n.tag)),this}async removeAllListeners(e){if(e){const{tag:r,started:n,subscriber:s}=await ge(this,dt,I_).call(this,e);n&&s.stop(),$(this,vn).delete(r)}else for(const[r,{started:n,subscriber:s}]of $(this,vn))n&&s.stop(),$(this,vn).delete(r);return this}async addListener(e,r){return await this.on(e,r)}async removeListener(e,r){return this.off(e,r)}get destroyed(){return $(this,Qh)}destroy(){this.removeAllListeners();for(const e of $(this,ai).keys())this._clearTimeout(e);W(this,Qh,!0)}get paused(){return $(this,_n)!=null}set paused(e){!!e!==this.paused&&(this.paused?this.resume():this.pause(!1))}pause(e){if(W(this,Ga,-1),$(this,_n)!=null){if($(this,_n)==!!e)return;ue(!1,"cannot change pause type; resume first","UNSUPPORTED_OPERATION",{operation:"pause"})}this._forEachSubscriber(r=>r.pause(e)),W(this,_n,!!e);for(const r of $(this,ai).values())r.timer&&clearTimeout(r.timer),r.time=iS()-r.time}resume(){if($(this,_n)!=null){this._forEachSubscriber(e=>e.resume()),W(this,_n,null);for(const e of $(this,ai).values()){let r=e.time;r<0&&(r=0),e.time=iS(),setTimeout(e.func,r)}}}}vn=new WeakMap,mu=new WeakMap,_n=new WeakMap,Qh=new WeakMap,$s=new WeakMap,hd=new WeakMap,yu=new WeakMap,Ga=new WeakMap,r0=new WeakMap,ai=new WeakMap,Xh=new WeakMap,ep=new WeakMap,dt=new WeakSet,Bs=async function(e){const r=$(this,ep).cacheTimeout;if(r<0)return await this._perform(e);const n=C_(e.method,e);let s=$(this,yu).get(n);return s||(s=this._perform(e),$(this,yu).set(n,s),setTimeout(()=>{$(this,yu).get(n)===s&&$(this,yu).delete(n)},r)),await s},PP=async function(e,r,n){ue(n<kEe,"CCIP read exceeded maximum redirections","OFFCHAIN_FAULT",{reason:"TOO_MANY_REDIRECTS",transaction:Object.assign({},e,{blockTag:r,enableCcipRead:!0})});const s=wA(e);try{return De(await this._perform({method:"call",transaction:s,blockTag:r}))}catch(i){if(!this.disableCcipRead&&UO(i)&&i.data&&n>=0&&r==="latest"&&s.to!=null&&Er(i.data,0,4)==="0x556f1830"){const o=i.data,a=await Vn(s.to,this);let c;try{c=HEe(Er(i.data,4))}catch(d){ue(!1,d.message,"OFFCHAIN_FAULT",{reason:"BAD_DATA",transaction:s,info:{data:o}})}ue(c.sender.toLowerCase()===a.toLowerCase(),"CCIP Read sender mismatch","CALL_EXCEPTION",{action:"call",data:o,reason:"OffchainLookup",transaction:s,invocation:null,revert:{signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",name:"OffchainLookup",args:c.errorArgs}});const u=await this.ccipReadFetch(s,c.calldata,c.urls);ue(u!=null,"CCIP Read failed to fetch data","OFFCHAIN_FAULT",{reason:"FETCH_FAILED",transaction:s,info:{data:i.data,errorArgs:c.errorArgs}});const l={to:a,data:Pr([c.selector,FEe([u,c.extraData])])};
270this.emit("debug",{action:"sendCcipReadCall",transaction:l});try{const d=await ge(this,dt,PP).call(this,l,r,n+1);return this.emit("debug",{action:"receiveCcipReadCallResult",transaction:Object.assign({},l),result:d}),d}catch(d){throw this.emit("debug",{action:"receiveCcipReadCallError",transaction:Object.assign({},l),error:d}),d}}throw i}},OP=async function(e){const{value:r}=await Ln({network:this.getNetwork(),value:e});return r},Im=async function(e,r,n){let s=this._getAddress(r),i=this._getBlockTag(n);return(typeof s!="string"||typeof i!="string")&&([s,i]=await Promise.all([s,i])),await ge(this,dt,OP).call(this,ge(this,dt,Bs).call(this,Object.assign(e,{address:s,blockTag:i})))},NP=async function(e,r){if(zt(e,32))return await ge(this,dt,Bs).call(this,{method:"getBlock",blockHash:e,includeTransactions:r});let n=this._getBlockTag(e);return typeof n!="string"&&(n=await n),await ge(this,dt,Bs).call(this,{method:"getBlock",blockTag:n,includeTransactions:r})},Sm=async function(e,r){let n=await sS(e,this);return n.type==="event"&&r&&r.length>0&&r[0].removed===!0&&(n=await sS({orphan:"drop-log",log:r[0]},this)),$(this,vn).get(n.tag)||null},I_=async function(e){const r=await sS(e,this),n=r.tag;let s=$(this,vn).get(n);return s||(s={subscriber:this._getSubscriber(r),tag:n,addressableMap:new WeakMap,nameMap:new Map,started:!1,listeners:[]},$(this,vn).set(n,s)),s};function MEe(t,e){try{const r=xP(t,e);if(r)return uA(r)}catch{}return null}function xP(t,e){if(t==="0x")return null;try{const r=nt(Er(t,e,e+32)),n=nt(Er(t,r,r+32));return Er(t,r+32,r+32+n)}catch{}return null}function Dk(t){const e=zn(t);if(e.length>32)throw new Error("internal; should not happen");const r=new Uint8Array(32);return r.set(e,32-e.length),r}function $Ee(t){if(t.length%32===0)return t;const e=new Uint8Array(Math.ceil(t.length/32)*32);return e.set(t),e}const LEe=new Uint8Array([]);function FEe(t){const e=[];let r=0;for(let n=0;n<t.length;n++)e.push(LEe),r+=32;for(let n=0;n<t.length;n++){const s=Ct(t[n]);e[n]=Dk(r),e.push(Dk(s.length)),e.push($Ee(s)),r+=32+Math.ceil(s.length/32)*32}return Pr(e)}const Uk="0x0000000000000000000000000000000000000000000000000000000000000000";function HEe(t){const e={sender:"",urls:[],calldata:"",selector:"",extraData:"",errorArgs:[]};ue(fh(t)>=5*32,"insufficient OffchainLookup data","OFFCHAIN_FAULT",{reason:"insufficient OffchainLookup data"});const r=Er(t,0,32);ue(Er(r,0,12)===Er(Uk,0,12),"corrupt OffchainLookup sender","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup sender"}),e.sender=Er(r,12);try{const n=[],s=nt(Er(t,32,64)),i=nt(Er(t,s,s+32)),o=Er(t,s+32);for(let a=0;a<i;a++){const c=MEe(o,a*32);if(c==null)throw new Error("abort");n.push(c)}e.urls=n}catch{ue(!1,"corrupt OffchainLookup urls","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup urls"})}try{const n=xP(t,64);if(n==null)throw new Error("abort");e.calldata=n}catch{ue(!1,"corrupt OffchainLookup calldata","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup calldata"})}ue(Er(t,100,128)===Er(Uk,0,28),"corrupt OffchainLookup callbaackSelector","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup callbaackSelector"}),e.selector=Er(t,96,100);try{const n=xP(t,128);if(n==null)throw new Error("abort");e.extraData=n}catch{ue(!1,"corrupt OffchainLookup extraData","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup extraData"})}return e.errorArgs="sender,urls,calldata,selector,extraData".split(/,/).map(n=>e[n]),e}function wf(t,e){if(t.provider)return t.provider;ue(!1,"missing provider","UNSUPPORTED_OPERATION",{operation:e})}async function Mk(t,e){let r=wA(e);if(r.to!=null&&(r.to=Vn(r.to,t)),r.from!=null){const n=r.from;r.from=Promise.all([t.getAddress(),Vn(n,t)]).then(([s,i])=>(Q(s.toLowerCase()===i.toLowerCase(),"transaction from mismatch","tx.from",i),s))}else r.from=t.getAddress();return await Ln(r)}class qEe{constructor(e){K(this,"provider");Ge(this,{provider:e||null})}async getNonce(e){return wf(this,"getTransactionCount").getTransactionCount(await this.getAddress(),e)}async populateCall(e){return await Mk(this,e)}async populateTransaction(e){const r=wf(this,"populateTransaction"),n=await Mk(this,e);n.nonce==null&&(n.nonce=await this.getNonce("pending")),n.gasLimit==null&&(n.gasLimit=await this.estimateGas(n));const s=await this.provider.getNetwork();if(n.chainId!=null){const o=$e(n.chainId);Q(o===s.chainId,"transaction chainId mismatch","tx.chainId",e.chainId)}else n.chainId=s.chainId;const i=n.maxFeePerGas!=null||n.maxPriorityFeePerGas!=null;if(n.gasPrice!=null&&(n.type===2||i)?Q(!1,"eip-1559 transaction do n
270ot support gasPrice","tx",e):(n.type===0||n.type===1)&&i&&Q(!1,"pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas","tx",e),(n.type===2||n.type==null)&&n.maxFeePerGas!=null&&n.maxPriorityFeePerGas!=null)n.type=2;else if(n.type===0||n.type===1){const o=await r.getFeeData();ue(o.gasPrice!=null,"network does not support gasPrice","UNSUPPORTED_OPERATION",{operation:"getGasPrice"}),n.gasPrice==null&&(n.gasPrice=o.gasPrice)}else{const o=await r.getFeeData();if(n.type==null)if(o.maxFeePerGas!=null&&o.maxPriorityFeePerGas!=null)if(n.type=2,n.gasPrice!=null){const a=n.gasPrice;delete n.gasPrice,n.maxFeePerGas=a,n.maxPriorityFeePerGas=a}else n.maxFeePerGas==null&&(n.maxFeePerGas=o.maxFeePerGas),n.maxPriorityFeePerGas==null&&(n.maxPriorityFeePerGas=o.maxPriorityFeePerGas);else o.gasPrice!=null?(ue(!i,"network does not support EIP-1559","UNSUPPORTED_OPERATION",{operation:"populateTransaction"}),n.gasPrice==null&&(n.gasPrice=o.gasPrice),n.type=0):ue(!1,"failed to get consistent fee data","UNSUPPORTED_OPERATION",{operation:"signer.getFeeData"});else(n.type===2||n.type===3)&&(n.maxFeePerGas==null&&(n.maxFeePerGas=o.maxFeePerGas),n.maxPriorityFeePerGas==null&&(n.maxPriorityFeePerGas=o.maxPriorityFeePerGas))}return await Ln(n)}async estimateGas(e){return wf(this,"estimateGas").estimateGas(await this.populateCall(e))}async call(e){return wf(this,"call").call(await this.populateCall(e))}async resolveName(e){return await wf(this,"resolveName").resolveName(e)}async sendTransaction(e){const r=wf(this,"sendTransaction"),n=await this.populateTransaction(e);delete n.from;const s=yA.from(n);return await r.broadcastTransaction(await this.signTransaction(s))}}function zEe(t){return JSON.parse(JSON.stringify(t))}var $n,Io,pd,bu,gd,tp,Du,RP,BP;class iz{constructor(e){ne(this,Du);ne(this,$n);ne(this,Io);ne(this,pd);ne(this,bu);ne(this,gd);ne(this,tp);W(this,$n,e),W(this,Io,null),W(this,pd,ge(this,Du,RP).bind(this)),W(this,bu,!1),W(this,gd,null),W(this,tp,!1)}_subscribe(e){throw new Error("subclasses must override this")}_emitResults(e,r){throw new Error("subclasses must override this")}_recover(e){throw new Error("subclasses must override this")}start(){$(this,bu)||(W(this,bu,!0),ge(this,Du,RP).call(this,-2))}stop(){$(this,bu)&&(W(this,bu,!1),W(this,tp,!0),ge(this,Du,BP).call(this),$(this,$n).off("block",$(this,pd)))}pause(e){e&&ge(this,Du,BP).call(this),$(this,$n).off("block",$(this,pd))}resume(){this.start()}}$n=new WeakMap,Io=new WeakMap,pd=new WeakMap,bu=new WeakMap,gd=new WeakMap,tp=new WeakMap,Du=new WeakSet,RP=async function(e){try{$(this,Io)==null&&W(this,Io,this._subscribe($(this,$n)));let r=null;try{r=await $(this,Io)}catch(i){if(!Pn(i,"UNSUPPORTED_OPERATION")||i.operation!=="eth_newFilter")throw i}if(r==null){W(this,Io,null),$(this,$n)._recoverSubscriber(this,this._recover($(this,$n)));return}const n=await $(this,$n).getNetwork();if($(this,gd)||W(this,gd,n),$(this,gd).chainId!==n.chainId)throw new Error("chaid changed");if($(this,tp))return;const s=await $(this,$n).send("eth_getFilterChanges",[r]);await this._emitResults($(this,$n),s)}catch(r){console.log("@TODO",r)}$(this,$n).once("block",$(this,pd))},BP=function(){const e=$(this,Io);e&&(W(this,Io,null),e.then(r=>{$(this,$n).destroyed||$(this,$n).send("eth_uninstallFilter",[r])}))};var md;class WEe extends iz{constructor(r,n){super(r);ne(this,md);W(this,md,zEe(n))}_recover(r){return new sN(r,$(this,md))}async _subscribe(r){return await r.send("eth_newFilter",[$(this,md)])}async _emitResults(r,n){for(const s of n)r.emit($(this,md),r._wrapLog(s,r._network))}}md=new WeakMap;class VEe extends iz{async _subscribe(e){return await e.send("eth_newPendingTransactionFilter",[])}async _emitResults(e,r){for(const n of r)e.emit("pending",n)}}const GEe="bigint,boolean,function,number,string,symbol".split(/,/g);function S_(t){if(t==null||GEe.indexOf(typeof t)>=0||typeof t.getAddress=="function")return t;if(Array.isArray(t))return t.map(S_);if(typeof t=="object")return Object.keys(t).reduce((e,r)=>(e[r]=t[r],e),{});throw new Error(`should not happen: ${t} (${typeof t})`)}function KEe(t){return new Promise(e=>{setTimeout(e,t)})}function Ef(t){return t&&t.toLowerCase()}function $k(t){return t&&typeof t.pollingInterval=="number"}const oz={polling:!1,staticNetwork:null,batchStallTime:10,batchMaxSize:1<<20,batchMaxCount:100,cacheTimeout:250,pollingInterval:4e3};class yh extends qEe{constructor(r,n){super(r);K(this,"address");n=Dt(n),Ge(this,{address:n})}connect(r){ue(!1,"cannot reconnect JsonRpcSigner","UNSUPPORTED_OPERATION",{operation:"signer.connect"})}async getAddress(){return this.address}async populateTransaction(r){return await this.populateCall(r)}async sendUncheckedTransaction(r){const n=S_(r),s=[];if(n.from){const o=n.from;s.push((async()=>{const a=await Vn(o,this.provider);Q(a!=null&&a.toLowerCase()===this.address.toLowerCase(),"from address mismatch","transaction",r),n.from=a})())}else n.from=this.address;if(n.gasLimit==null&&s.push((async()=>{n.gasLimit=await this.provider.estimateGas({...n,from:this.address})})()),n.to!=null){const o=n.to;s.push((async()=>{n.to=await Vn(o,this.provider)})())}s.length&&await Promise.all(s);const i=this.provider.getRpcTransaction(n);return this.provider.send("eth_sendTransaction",[i])}async sendTransaction(r){const n=await this.provider.getBlockNumber(),s=await this.sendUncheckedTransaction(r);return await new Promise((i,o)=>{const a=[1e3,100];let c=0;const u=async()=>{try{const l=await this.provider.getTransaction(s);if(l!=null){i(l.replaceableTransaction(n));return}}catch(l){if(Pn(l,"CANCELLED")||Pn(l,"BAD_DATA")||Pn(l,"NETWORK_E
270RROR")){l.info==null&&(l.info={}),l.info.sendTransactionHash=s,o(l);return}if(Pn(l,"INVALID_ARGUMENT")&&(c++,l.info==null&&(l.info={}),l.info.sendTransactionHash=s,c>10)){o(l);return}this.provider.emit("error",wr("failed to fetch transation after sending (will try again)","UNKNOWN_ERROR",{error:l}))}this.provider._setTimeout(()=>{u()},a.pop()||4e3)};u()})}async signTransaction(r){const n=S_(r);if(n.from){const i=await Vn(n.from,this.provider);Q(i!=null&&i.toLowerCase()===this.address.toLowerCase(),"from address mismatch","transaction",r),n.from=i}else n.from=this.address;const s=this.provider.getRpcTransaction(n);return await this.provider.send("eth_signTransaction",[s])}async signMessage(r){const n=typeof r=="string"?Fo(r):r;return await this.provider.send("personal_sign",[De(n),this.address.toLowerCase()])}async signTypedData(r,n,s){const i=S_(s),o=await bA.resolveNames(r,n,i,async a=>{const c=await Vn(a);return Q(c!=null,"TypedData does not support null address","value",a),c});return await this.provider.send("eth_signTypedData_v4",[this.address.toLowerCase(),JSON.stringify(bA.getPayload(o.domain,n,o.value))])}async unlock(r){return this.provider.send("personal_unlockAccount",[this.address.toLowerCase(),r,null])}async _legacySignMessage(r){const n=typeof r=="string"?Fo(r):r;return await this.provider.send("eth_sign",[this.address.toLowerCase(),De(n)])}}var yd,rp,Ka,So,Li,ci,ls,n0,kP;class ZEe extends UEe{constructor(r,n){super(r,n);ne(this,n0);ne(this,yd);ne(this,rp);ne(this,Ka);ne(this,So);ne(this,Li);ne(this,ci);ne(this,ls);W(this,rp,1),W(this,yd,Object.assign({},oz,n||{})),W(this,Ka,[]),W(this,So,null),W(this,ci,null),W(this,ls,null);{let i=null;const o=new Promise(a=>{i=a});W(this,Li,{promise:o,resolve:i})}const s=this._getOption("staticNetwork");typeof s=="boolean"?(Q(!s||r!=="any","staticNetwork cannot be used on special network 'any'","options",n),s&&r!=null&&W(this,ci,Do.from(r))):s&&(Q(r==null||s.matches(r),"staticNetwork MUST match network object","options",n),W(this,ci,s))}_getOption(r){return $(this,yd)[r]}get _network(){return ue($(this,ci),"network is not available yet","NETWORK_ERROR"),$(this,ci)}async _perform(r){if(r.method==="call"||r.method==="estimateGas"){let s=r.transaction;if(s&&s.type!=null&&$e(s.type)&&s.maxFeePerGas==null&&s.maxPriorityFeePerGas==null){const i=await this.getFeeData();i.maxFeePerGas==null&&i.maxPriorityFeePerGas==null&&(r=Object.assign({},r,{transaction:Object.assign({},s,{type:void 0})}))}}const n=this.getRpcRequest(r);return n!=null?await this.send(n.method,n.args):super._perform(r)}async _detectNetwork(){const r=this._getOption("staticNetwork");if(r)if(r===!0){if($(this,ci))return $(this,ci)}else return r;return $(this,ls)?await $(this,ls):this.ready?(W(this,ls,(async()=>{try{const n=Do.from($e(await this.send("eth_chainId",[])));return W(this,ls,null),n}catch(n){throw W(this,ls,null),n}})()),await $(this,ls)):(W(this,ls,(async()=>{const n={id:zp(this,rp)._++,method:"eth_chainId",params:[],jsonrpc:"2.0"};this.emit("debug",{action:"sendRpcPayload",payload:n});let s;try{s=(await this._send(n))[0],W(this,ls,null)}catch(i){throw W(this,ls,null),this.emit("debug",{action:"receiveRpcError",error:i}),i}
270if(this.emit("debug",{action:"receiveRpcResult",result:s}),"result"in s)return Do.from($e(s.result));throw this.getRpcError(n,s)})()),await $(this,ls))}_start(){$(this,Li)==null||$(this,Li).resolve==null||($(this,Li).resolve(),W(this,Li,null),(async()=>{for(;$(this,ci)==null&&!this.destroyed;)try{W(this,ci,await this._detectNetwork())}catch(r){if(this.destroyed)break;console.log("JsonRpcProvider failed to detect network and cannot start up; retry in 1s (perhaps the URL is wrong or the node is not started)"),this.emit("error",wr("failed to bootstrap network detection","NETWORK_ERROR",{event:"initial-network-discovery",info:{error:r}})),await KEe(1e3)}ge(this,n0,kP).call(this)})())}async _waitUntilReady(){if($(this,Li)!=null)return await $(this,Li).promise}_getSubscriber(r){return r.type==="pending"?new VEe(this):r.type==="event"?this._getOption("polling")?new sN(this,r.filter):new WEe(this,r.filter):r.type==="orphan"&&r.filter.orphan==="drop-log"?new sz("orphan"):super._getSubscriber(r)}get ready(){return $(this,Li)==null}getRpcTransaction(r){const n={};return["chainId","gasLimit","gasPrice","type","maxFeePerGas","maxPriorityFeePerGas","nonce","value"].forEach(s=>{if(r[s]==null)return;let i=s;s==="gasLimit"&&(i="gas"),n[i]=Xf($e(r[s],`tx.${s}`))}),["from","to","data"].forEach(s=>{r[s]!=null&&(n[s]=De(r[s]))}),r.accessList&&(n.accessList=Jd(r.accessList)),r.blobVersionedHashes&&(n.blobVersionedHashes=r.blobVersionedHashes.map(s=>s.toLowerCase())),n}getRpcRequest(r){switch(r.method){case"chainId":return{method:"eth_chainId",args:[]};case"getBlockNumber":return{method:"eth_blockNumber",args:[]};case"getGasPrice":return{method:"eth_gasPrice",args:[]};case"getPriorityFee":return{method:"eth_maxPriorityFeePerGas",args:[]};case"getBalance":return{method:"eth_getBalance",args:[Ef(r.address),r.blockTag]};case"getTransactionCount":return{method:"eth_getTransactionCount",args:[Ef(r.address),r.blockTag]};case"getCode":return{method:"eth_getCode",args:[Ef(r.address),r.blockTag]};case"getStorage":return{method:"eth_getStorageAt",args:[Ef(r.address),"0x"+r.position.toString(16),r.blockTag]};case"broadcastTransaction":return{method:"eth_sendRawTransaction",args:[r.signedTransaction]};case"getBlock":if("blockTag"in r)return{method:"eth_getBlockByNumber",args:[r.blockTag,!!r.includeTransactions]};if("blockHash"in r)return{method:"eth_getBlockByHash",args:[r.blockHash,!!r.includeTransactions]};break;case"getTransaction":return{method:"eth_getTransactionByHash",args:[r.hash]};case"getTransactionReceipt":return{method:"eth_getTransactionReceipt",args:[r.hash]};case"call":return{method:"eth_call",args:[this.getRpcTransaction(r.transaction),r.blockTag]};case"estimateGas":return{method:"eth_estimateGas",args:[this.getRpcTransaction(r.transaction)]};case"getLogs":return r.filter&&r.filter.address!=null&&(Array.isArray(r.filter.address)?r.filter.address=r.filter.address.map(Ef):r.filter.address=Ef(r.filter.address)),{method:"eth_getLogs",args:[r.filter]}}return null}getRpcError(r,n){const{method:s}=r,{error:i}=n;if(s==="eth_estimateGas"&&i.message){const c=i.message;if(!c.match(/revert/i)&&c.match(/insufficient funds/i))return wr("insufficient funds","INSUFFICIENT_FUNDS",{transaction:r.params[0],info:{payload:r,error:i}})}if(s==="eth_call"||s==="eth_estimateGas"){const c=jP(i),u=zy.getBuiltinCallException(s==="eth_call"?"call":"estimateGas",r.params[0],c?c.data:null);return u.info={error:i,payload:r},u}const o=JSON.stringify(JEe(i));if(typeof i.message=="string"&&i.message.match(/user denied|ethers-user-denied/i))return wr("user rejected action","ACTION_REJECTED",{action:{eth_sign:"signMessage",personal_sign:"signMessage",eth_signTypedData_v4:"signTypedData",eth_signTransaction:"signTransaction",eth_sendTransaction:"sendTransaction",eth_requestAccounts:"requestAccess",wallet_requestAccounts:"requestAccess"}[s]||"unknown",reason:"rejected",info:{payload:r,error:i}});if(s==="eth_sendRawTransaction"||s==="eth_sendTransaction"){const c=r.params[0];if(o.match(/insufficient funds|base fee exceeds gas limit/i))return wr("insufficient funds for intrinsic transaction cost","INSUFFICIENT_FUNDS",{transaction:c,info:{error:i}});if(o.match(/nonce/i)&&o.match(/too low/i))return wr("nonce has already been used","NONCE_EXPIRED",{transaction:c,info:{error:i}});if(o.match(/replacement transaction/i)&&o.match(/underpriced/i))return wr("replacement fee too low","REPLACEMENT_UNDERPRICED",{transaction:c,info:{error:i}});if(o.match(/only replay-protected/i))return wr("legacy pre-eip-155 transactions not supported","UNSUPPORTED_OPERATION",{operation:s,info:{transaction:c,info:{error:i}}})}let a=!!o.match(/the method .* does not exist/i);return a||i&&i.details&&i.details.startsWith("Unauthorized method:")&&(a=!0),a?
270wr("unsupported operation","UNSUPPORTED_OPERATION",{operation:r.method,info:{error:i,payload:r}}):wr("could not coalesce error","UNKNOWN_ERROR",{error:i,payload:r})}send(r,n){if(this.destroyed)return Promise.reject(wr("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:r}));const s=zp(this,rp)._++,i=new Promise((o,a)=>{$(this,Ka).push({resolve:o,reject:a,payload:{method:r,params:n,id:s,jsonrpc:"2.0"}})});return ge(this,n0,kP).call(this),i}async getSigner(r){r==null&&(r=0);const n=this.send("eth_accounts",[]);if(typeof r=="number"){const i=await n;if(r>=i.length)throw new Error("no such account");return new yh(this,i[r])}const{accounts:s}=await Ln({network:this.getNetwork(),accounts:n});r=Dt(r);for(const i of s)if(Dt(i)===r)return new yh(this,r);throw new Error("invalid account")}async listAccounts(){return(await this.send("eth_accounts",[])).map(n=>new yh(this,n))}destroy(){$(this,So)&&(clearTimeout($(this,So)),W(this,So,null));for(const{payload:r,reject:n}of $(this,Ka))n(wr("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:r.method}));W(this,Ka,[]),super.destroy()}}yd=new WeakMap,rp=new WeakMap,Ka=new WeakMap,So=new WeakMap,Li=new WeakMap,ci=new WeakMap,ls=new WeakMap,n0=new WeakSet,kP=function(){if($(this,So))return;const r=this._getOption("batchMaxCount")===1?0:this._getOption("batchStallTime");W(this,So,setTimeout(()=>{W(this,So,null);const n=$(this,Ka);for(W(this,Ka,[]);n.length;){const s=[n.shift()];for(;n.length&&s.length!==$(this,yd).batchMaxCount;)if(s.push(n.shift()),JSON.stringify(s.map(o=>o.payload)).length>$(this,yd).batchMaxSize){n.unshift(s.pop());break}(async()=>{const i=s.length===1?s[0].payload:s.map(o=>o.payload);this.emit("debug",{action:"sendRpcPayload",payload:i});try{const o=await this._send(i);this.emit("debug",{action:"receiveRpcResult",result:o});for(const{resolve:a,reject:c,payload:u}of s){if(this.destroyed){c(wr("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:u.method}));continue}const l=o.filter(d=>d.id===u.id)[0];if(l==null){const d=wr("missing response for request","BAD_DATA",{value:o,info:{payload:u}});this.emit("error",d),c(d);continue}if("error"in l){c(this.getRpcError(u,l));continue}a(l.result)}}catch(o){this.emit("debug",{action:"receiveRpcError",error:o});for(const{reject:a}of s)a(o)}})()}},r))};var wu;class az extends ZEe{constructor(r,n){super(r,n);ne(this,wu);let s=this._getOption("pollingInterval");s==null&&(s=oz.pollingInterval),W(this,wu,s)}_getSubscriber(r){const n=super._getSubscriber(r);return $k(n)&&(n.pollingInterval=$(this,wu)),n}get pollingInterval(){return $(this,wu)}set pollingInterval(r){if(!Number.isInteger(r)||r<0)throw new Error("invalid interval");W(this,wu,r),this._forEachSubscriber(n=>{$k(n)&&(n.pollingInterval=$(this,wu))})}}wu=new WeakMap;var np;class YEe extends az{constructor(r,n,s){r==null&&(r="http://localhost:8545");super(n,s);ne(this,np);typeof r=="string"?W(this,np,new uc(r)):W(this,np,r.clone())}_getConnection(){return $(this,np).clone()}async send(r,n){return await this._start(),await super.send(r,n)}async _send(r){const n=this._getConnection();n.body=JSON.stringify(r),n.setHeader("content-type","application/json");const s=await n.send();s.assertOk();let i=s.bodyJson;return Array.isArray(i)||(i=[i]),i}}np=new WeakMap;function jP(t){if(t==null)return null;if(typeof t.message=="string"&&t.message.match(/revert/i)&&zt(t.data))return{message:t.message,data:t.data};if(typeof t=="object"){for(const e in t){const r=jP(t[e]);if(r)return r}return null}if(typeof t=="string")try{return jP(JSON.parse(t))}catch{}return null}function DP(t,e){if(t!=null){if(typeof t.message=="string"&&e.push(t.message),typeof t=="object")for(const r in t)DP(t[r],e);if(typeof t=="string")try{return DP(JSON.parse(t),e)}catch{}}}function JEe(t){const e=[];return DP(t,e),e}var sp;class oS extends az{constructor(r,n,s){const i=Object.assign({},s??{},{batchMaxCount:1});Q(r&&r.request,"invalid EIP-1193 provider","ethereum",r);super(n,i);ne(this,sp);W(this,sp,async(o,a)=>{const c={method:o,params:a};this.emit("debug",{action:"sendEip1193Request",payload:c});try{const u=await r.request(c);
270return this.emit("debug",{action:"receiveEip1193Result",result:u}),u}catch(u){const l=new Error(u.message);throw l.code=u.code,l.data=u.data,l.payload=c,this.emit("debug",{action:"receiveEip1193Error",error:l}),l}})}async send(r,n){return await this._start(),await super.send(r,n)}async _send(r){Q(!Array.isArray(r),"EIP-1193 does not support batch request","payload",r);try{const n=await $(this,sp).call(this,r.method,r.params||[]);return[{id:r.id,result:n}]}catch(n){return[{id:r.id,error:{code:n.code,data:n.data,message:n.message}}]}}getRpcError(r,n){switch(n=JSON.parse(JSON.stringify(n)),n.error.code||-1){case 4001:n.error.message=`ethers-user-denied: ${n.error.message}`;break;case 4200:n.error.message=`ethers-unsupported: ${n.error.message}`;break}return super.getRpcError(r,n)}async hasSigner(r){r==null&&(r=0);const n=await this.send("eth_accounts",[]);return typeof r=="number"?n.length>r:(r=r.toLowerCase(),n.filter(s=>s.toLowerCase()===r).length!==0)}async getSigner(r){if(r==null&&(r=0),!await this.hasSigner(r))try{await $(this,sp).call(this,"eth_requestAccounts",[])}catch(n){const s=n.payload;throw this.getRpcError(s,{id:s.id,error:n})}return await super.getSigner(r)}}sp=new WeakMap;const bh={hexStringToNumber(t){const e=t.startsWith("0x")?t.slice(2):t;return parseInt(e,16)},numberToHexString(t){return`0x${t.toString(16)}`},async getUserInfo(t){const[e,r]=await Promise.all([bh.getAddresses(t),bh.getChainId(t)]);return{chainId:r,addresses:e}},async getChainId(t){const e=await t.request({method:"eth_chainId"});return Number(e)},async getAddress(t){const[e]=await t.request({method:"eth_accounts"});return e},async getAddresses(t){return await t.request({method:"eth_accounts"})},async addEthereumChain(t,e){var n,s;const r=((n=e.rpcUrls.chainDefault)==null?void 0:n.http)||[];await t.request({method:"wallet_addEthereumChain",params:[{chainId:bh.numberToHexString(e.id),rpcUrls:[...r],chainName:e.name,nativeCurrency:{name:e.nativeCurrency.name,decimals:e.nativeCurrency.decimals,symbol:e.nativeCurrency.symbol},blockExplorerUrls:[(s=e.blockExplorers)==null?void 0:s.default.url],iconUrls:[iq.NetworkImageIds[e.id]]}]})}};class yC{constructor(){this.initialized=!1}async getProvider(){return Promise.resolve(this.provider)}}class QEe extends yC{async initialize(){const e=q.getCaipNetworks(),{metadata:r,coinbasePreference:n}=se.state;try{const{createBaseAccountSDK:s}=await Wr(async()=>{const{createBaseAccountSDK:o}=await import("./index-CSXFBaT0.js");return{createBaseAccountSDK:o}},__vite__mapDeps([57,58,1,2,3,4,5,59,8,7]));if(typeof window>"u")return Promise.resolve();const i=s({appName:r==null?void 0:r.name,appLogoUrl:r==null?void 0:r.icons[0],appChainIds:(e==null?void 0:e.map(o=>o.id))||[1,84532],preference:{options:n??"all"}});return this.provider=i.getProvider(),this.initialized=!0,Promise.resolve()}catch(s){return console.error("Failed to import Coinbase Wallet SDK:",s),Promise.resolve()}}async getProvider(){return Promise.resolve(this.provider)}}class XEe extends yC{async initialize(){const e=q.getCaipNetworks(),{metadata:r,coinbasePreference:n}=se.state;try{const{CoinbaseWalletSDK:s}=await Wr(async()=>{const{CoinbaseWalletSDK:a}=await import("./index-CR6LcdxX.js");return{CoinbaseWalletSDK:a}},__vite__mapDeps([60,58,1,2,3,4,5,59,7]));if(typeof window>"u")return Promise.resolve();const i=(e==null?void 0:e.map(a=>a.id))||[1],o=new s({appName:(r==null?void 0:r.name)||"AppKit",appLogoUrl:r==null?void 0:r.icons[0],appChainIds:i});return this.provider=o.makeWeb3Provider({options:n??"all"}),this.initialized=!0,Promise.resolve()}catch(s){return console.error("Failed to import Coinbase Wallet SDK:",s),Promise.resolve()}}async getProvider(){return Promise.resolve(this.provider)}}var aS={},fg={},sa={},vf={},cl={},hg={},pg={},Lk;function cz(){if(Lk)return pg;
270Lk=1,Object.defineProperty(pg,"__esModule",{value:!0}),pg.getSDKVersion=void 0;const t=()=>"9.1.0";return pg.getSDKVersion=t,pg}var gg={},Fk;function eve(){if(Fk)return gg;Fk=1,Object.defineProperty(gg,"__esModule",{value:!0}),gg.generateRequestId=void 0;const t=n=>n.toString(16).padStart(2,"0"),e=n=>{const s=new Uint8Array(n/2);return window.crypto.getRandomValues(s),Array.from(s,t).join("")},r=()=>typeof window<"u"?e(10):new Date().getTime().toString(36);return gg.generateRequestId=r,gg}var Hk;function uz(){if(Hk)return hg;Hk=1,Object.defineProperty(hg,"__esModule",{value:!0}),hg.MessageFormatter=void 0;const t=cz(),e=eve();class r{}return hg.MessageFormatter=r,r.makeRequest=(n,s)=>({id:(0,e.generateRequestId)(),method:n,params:s,env:{sdkVersion:(0,t.getSDKVersion)()}}),r.makeResponse=(n,s,i)=>({id:n,success:!0,version:i,data:s}),r.makeErrorResponse=(n,s,i)=>({id:n,success:!1,error:s,version:i}),hg}var ul={},qk;function Qd(){if(qk)return ul;qk=1,Object.defineProperty(ul,"__esModule",{value:!0}),ul.RestrictedMethods=ul.Methods=void 0;var t;(function(r){r.sendTransactions="sendTransactions",r.rpcCall="rpcCall",r.getChainInfo="getChainInfo",r.getSafeInfo="getSafeInfo",r.getTxBySafeTxHash="getTxBySafeTxHash",r.getSafeBalances="getSafeBalances",r.signMessage="signMessage",r.signTypedMessage="signTypedMessage",r.getEnvironmentInfo="getEnvironmentInfo",r.getOffChainSignature="getOffChainSignature",r.requestAddressBook="requestAddressBook",r.wallet_getPermissions="wallet_getPermissions",r.wallet_requestPermissions="wallet_requestPermissions"})(t||(ul.Methods=t={}));var e;return function(r){r.requestAddressBook="requestAddressBook"}(e||(ul.RestrictedMethods=e={})),ul}var zk;function tve(){return zk||(zk=1,function(t){var e=cl&&cl.__createBinding||(Object.create?function(i,o,a,c){c===void 0&&(c=a);var u=Object.getOwnPropertyDescriptor(o,a);(!u||("get"in u?!o.__esModule:u.writable||u.configurable))&&(u={enumerable:!0,get:function(){return o[a]}}),Object.defineProperty(i,c,u)}:function(i,o,a,c){c===void 0&&(c=a),i[c]=o[a]}),r=cl&&cl.__exportStar||function(i,o){for(var a in i)a!=="default"&&!Object.prototype.hasOwnProperty.call(o,a)&&e(o,i,a)};Object.defineProperty(t,"__esModule",{value:!0});const n=uz();class s{constructor(o=null,a=!1){this.allowedOrigins=null,this.callbacks=new Map,this.debugMode=!1,this.isServer=typeof window>"u",this.isValidMessage=({origin:c,data:u,source:l})=>{const d=!u,f=!this.isServer&&l===window.parent,g=typeof u.version<"u"&&parseInt(u.version.split(".")[0]),h=typeof g=="number"&&g>=1;let p=!0;return Array.isArray(this.allowedOrigins)&&(p=this.allowedOrigins.find(y=>y.test(c))!==void 0),!d&&f&&h&&p},this.logIncomingMessage=c=>{console.info(`Safe Apps SDK v1: A message was received from origin ${c.origin}. `,c.data)},this.onParentMessage=c=>{this.isValidMessage(c)&&(this.debugMode&&this.logIncomingMessage(c),this.handleIncomingMessage(c.data))},this.handleIncomingMessage=c=>{const{id:u}=c,l=this.callbacks.get(u);l&&(l(c),this.callbacks.delete(u))},this.send=(c,u)=>{const l=n.MessageFormatter.makeRequest(c,u);if(this.isServer)throw new Error("Window doesn't exist");return window.parent.postMessage(l,"*"),new Promise((d,f)=>{this.callbacks.set(l.id,g=>{if(!g.success){f(new Error(g.error));return}d(g)})})},this.allowedOrigins=o,this.debugMode=a,this.isServer||window.addEventListener("message",this.onParentMessage)}}t.default=s,r(Qd(),t)}(cl)),cl}var mg={},ll={},yg={},Wk;function rve(){if(Wk)return yg;Wk=1,Object.defineProperty(yg,"__esModule",{value:!0}),yg.isObjectEIP712TypedData=void 0;const t=e=>typeof e=="object"&&e!=null&&"domain"in e&&"types"in e&&"message"in e;return yg.isObjectEIP712TypedData=t,yg}var cS={},Vk;function nve(){return Vk||(Vk=1,Object.defineProperty(cS,"__esModule",{value:!0})),cS}var uS={},dl={},fl={},ia={},Gk;function sve(){if(Gk)return ia;Gk=1;var t=ia&&ia.__awaiter||function(c,u,l,d){function f(g){return g instanceof l?g:new l(function(h){h(g)})}return new(l||(l=Promise))(function(g,h){function p(I){try{w(d.next(I))}catch(v){h(v)}}function y(I){try{w(d.throw(I))}catch(v){h(v)}}function w(I){I.done?g(I.value):f(I.value).then(p,y)}w((d=d.apply(c,u||[])).next())})};Object.defineProperty(ia,"__esModule",{value:!0}),ia.insertParams=n,ia.stringifyQuery=s,ia.fetchData=o,ia.getData=a;const e=c=>typeof c=="object"&&c!==null&&("code"in c||"statusCode"in c)&&"message"in c;function r(c,u,l){return c.replace(new RegExp(`\\{${u}\\}`,"g"),l)}function n(c,u){return u?Object.keys(u).reduce((l,d)=>r(l,d,String(u[d])),c):c}function s(c){if(!c)return"";const u=new URLSearchParams;
270Object.keys(c).forEach(d=>{c[d]!=null&&u.append(d,String(c[d]))});const l=u.toString();return l?`?${l}`:""}function i(c){return t(this,void 0,void 0,function*(){var u;let l;try{l=yield c.json()}catch{l={}}if(!c.ok){const d=e(l)?`CGW error - ${(u=l.code)!==null&&u!==void 0?u:l.statusCode}: ${l.message}`:`CGW error - status ${c.statusText}`;throw new Error(d)}return l})}function o(c,u,l,d,f){return t(this,void 0,void 0,function*(){const g=Object.assign({"Content-Type":"application/json"},d),h={method:u??"POST",headers:g};f&&(h.credentials=f),l!=null&&(h.body=typeof l=="string"?l:JSON.stringify(l));const p=yield fetch(c,h);return i(p)})}function a(c,u,l){return t(this,void 0,void 0,function*(){const d={method:"GET"};u&&(d.headers=Object.assign(Object.assign({},u),{"Content-Type":"application/json"})),l&&(d.credentials=l);const f=yield fetch(c,d);return i(f)})}return ia}var Kk;function ive(){if(Kk)return fl;Kk=1,Object.defineProperty(fl,"__esModule",{value:!0}),fl.postEndpoint=r,fl.putEndpoint=n,fl.deleteEndpoint=s,fl.getEndpoint=i;const t=sve();function e(o,a,c,u){const l=(0,t.insertParams)(a,c),d=(0,t.stringifyQuery)(u);return`${o}${l}${d}`}function r(o,a,c){const u=e(o,a,c==null?void 0:c.path,c==null?void 0:c.query);return(0,t.fetchData)(u,"POST",c==null?void 0:c.body,c==null?void 0:c.headers,c==null?void 0:c.credentials)}function n(o,a,c){const u=e(o,a,c==null?void 0:c.path,c==null?void 0:c.query);return(0,t.fetchData)(u,"PUT",c==null?void 0:c.body,c==null?void 0:c.headers,c==null?void 0:c.credentials)}function s(o,a,c){const u=e(o,a,c==null?void 0:c.path,c==null?void 0:c.query);return(0,t.fetchData)(u,"DELETE",c==null?void 0:c.body,c==null?void 0:c.headers,c==null?void 0:c.credentials)}function i(o,a,c,u){if(u)return(0,t.getData)(u,void 0,c==null?void 0:c.credentials);const l=e(o,a,c==null?void 0:c.path,c==null?void 0:c.query);return(0,t.getData)(l,c==null?void 0:c.headers,c==null?void 0:c.credentials)}return fl}var bg={},Zk;function ove(){return Zk||(Zk=1,Object.defineProperty(bg,"__esModule",{value:!0}),bg.DEFAULT_BASE_URL=void 0,bg.DEFAULT_BASE_URL="https://safe-client.safe.global"),bg}var wg={},Yk;function ave(){if(Yk)return wg;Yk=1,Object.defineProperty(wg,"__esModule",{value:!0}),wg.ImplementationVersionState=void 0;var t;return function(e){e.UP_TO_DATE="UP_TO_DATE",e.OUTDATED="OUTDATED",e.UNKNOWN="UNKNOWN"}(t||(wg.ImplementationVersionState=t={})),wg}var oa={},Jk;function cve(){if(Jk)return oa;Jk=1,Object.defineProperty(oa,"__esModule",{value:!0}),oa.SafeAppSocialPlatforms=oa.SafeAppFeatures=oa.SafeAppAccessPol
270icyTypes=void 0;var t;(function(n){n.NoRestrictions="NO_RESTRICTIONS",n.DomainAllowlist="DOMAIN_ALLOWLIST"})(t||(oa.SafeAppAccessPolicyTypes=t={}));var e;(function(n){n.BATCHED_TRANSACTIONS="BATCHED_TRANSACTIONS"})(e||(oa.SafeAppFeatures=e={}));var r;return function(n){n.TWITTER="TWITTER",n.GITHUB="GITHUB",n.DISCORD="DISCORD",n.TELEGRAM="TELEGRAM"}(r||(oa.SafeAppSocialPlatforms=r={})),oa}var Ft={},Qk;function uve(){if(Qk)return Ft;Qk=1,Object.defineProperty(Ft,"__esModule",{value:!0}),Ft.LabelValue=Ft.StartTimeValue=Ft.DurationType=Ft.DetailedExecutionInfoType=Ft.TransactionListItemType=Ft.ConflictType=Ft.TransactionInfoType=Ft.SettingsInfoType=Ft.TransactionTokenType=Ft.TransferDirection=Ft.TransactionStatus=Ft.Operation=void 0;var t;(function(f){f[f.CALL=0]="CALL",f[f.DELEGATE=1]="DELEGATE"})(t||(Ft.Operation=t={}));var e;(function(f){f.AWAITING_CONFIRMATIONS="AWAITING_CONFIRMATIONS",f.AWAITING_EXECUTION="AWAITING_EXECUTION",f.CANCELLED="CANCELLED",f.FAILED="FAILED",f.SUCCESS="SUCCESS"})(e||(Ft.TransactionStatus=e={}));var r;(function(f){f.INCOMING="INCOMING",f.OUTGOING="OUTGOING",f.UNKNOWN="UNKNOWN"})(r||(Ft.TransferDirection=r={}));var n;(function(f){f.ERC20="ERC20",f.ERC721="ERC721",f.NATIVE_COIN="NATIVE_COIN"})(n||(Ft.TransactionTokenType=n={}));var s;(function(f){f.SET_FALLBACK_HANDLER="SET_FALLBACK_HANDLER",f.ADD_OWNER="ADD_OWNER",f.REMOVE_OWNER="REMOVE_OWNER",f.SWAP_OWNER="SWAP_OWNER",f.CHANGE_THRESHOLD="CHANGE_THRESHOLD",f.CHANGE_IMPLEMENTATION="CHANGE_IMPLEMENTATION",f.ENABLE_MODULE="ENABLE_MODULE",f.DISABLE_MODULE="DISABLE_MODULE",f.SET_GUARD="SET_GUARD",f.DELETE_GUARD="DELETE_GUARD"})(s||(Ft.SettingsInfoType=s={}));var i;(function(f){f.TRANSFER="Transfer",f.SETTINGS_CHANGE="SettingsChange",f.CUSTOM="Custom",f.CREATION="Creation",f.SWAP_ORDER="SwapOrder",f.TWAP_ORDER="TwapOrder",f.SWAP_TRANSFER="SwapTransfer",f.NATIVE_STAKING_DEPOSIT="NativeStakingDeposit",f.NATIVE_STAKING_VALIDATORS_EXIT="NativeStakingValidatorsExit",f.NATIVE_STAKING_WITHDRAW="NativeStakingWithdraw"})(i||(Ft.TransactionInfoType=i={}));var o;(function(f){f.NONE="None",f.HAS_NEXT="HasNext",f.END="End"})(o||(Ft.ConflictType=o={}));var a;(function(f){f.TRANSACTION="TRANSACTION",f.LABEL="LABEL",f.CONFLICT_HEADER="CONFLICT_HEADER",f.DATE_LABEL="DATE_LABEL"})(a||(Ft.TransactionListItemType=a={}));var c;(function(f){f.MULTISIG="MULTISIG",f.MODULE="MODULE"})(c||(Ft.DetailedExecutionInfoType=c={}));var u;(function(f){f.AUTO="AUTO",f.LIMIT_DURATION="LIMIT_DURATION"})(u||(Ft.DurationType=u={}));var l;(function(f){f.AT_MINING_TIME="AT_MINING_TIME",f.AT_EPOCH="AT_EPOCH"})(l||(Ft.StartTimeValue=l={}));var d;return function(f){f.Queued="Queued",f.Next="Next"}(d||(Ft.LabelValue=d={})),Ft}var aa={},Xk;function lve(){if(Xk)return aa;Xk=1,Object.defineProperty(aa,"__esModule",{value:!0}),aa.FEATURES=aa.GAS_PRICE_TYPE=aa.RPC_AUTHENTICATION=void 0;var t;(function(n){n.API_KEY_PATH="API_KEY_PATH",n.NO_AUTHENTICATION="NO_AUTHENTICATION",n.UNKNOWN="UNKNOWN"})(t||(aa.RPC_AUTHENTICATION=t={}));var e;(function(n){n.ORACLE="ORACLE",n.FIXED="FIXED",n.FIXED_1559="FIXED1559",n.UNKNOWN="UNKNOWN"})(e||(aa.GAS_PRICE_TYPE=e={}));var r;return function(n){n.ERC721="ERC721",n.SAFE_APPS="SAFE_APPS",n.CONTRACT_INTERACTION="CONTRACT_INTERACTION",n.DOMAIN_LOOKUP="DOMAIN_LOOKUP",n.SPENDING_LIMIT="SPENDING_LIMIT",n.EIP1559="EIP1559",n.SAFE_TX_GAS_OPTIONAL="SAFE_TX_GAS_OPTIONAL",n.TX_SIMULATION="TX_SIMULATION",n.EIP1271="EIP1271"}(r||(aa.FEATURES=r={})),aa}var Eg={},e5;function dve(){if(e5)return Eg;e5=1,Object.defineProperty(Eg,"__esModule",{value:!0}),Eg.TokenType=void 0;var t;return function(e){e.ERC20="ERC20",e.ERC721="ERC721",e.NATIVE_TOKEN="NATIVE_TOKEN",e.UNKNOWN="UNKNOWN"}(t||(Eg.TokenType=t={})),Eg}var lS={},t5;function fve(){return t5||(t5=1,Object.defineProperty(lS,"__esModule",{value:!0})),lS}var hl={},r5;function hve(){if(r5)return hl;r5=1,Object.defineProperty(hl,"__esModule",{value:!0}),hl.NativeStakingStatus=hl.ConfirmationViewTypes=void 0;var t;(function(r){r.GENERIC="GENERIC",r.COW_SWAP_ORDER="COW_SWAP_ORDER",r.COW_SWAP_TWAP_ORDER="COW_SWAP_TWAP_ORDER",r.KILN_NATIVE_STAKING_DEPOSIT="KILN_NATIVE_STAKING_DEPOSIT",r.KILN_NATIVE_STAKING_VALIDATORS_EXIT="KILN_NATIVE_STAKING_VALIDATORS_EXIT",r.KILN_NATIVE_STAKING_WITHDRAW="KILN_NATIVE_STAKING_WITHDRAW"})(t||(hl.ConfirmationViewTypes=t={}));var e;return function(r){r.NOT_STAKED="NOT_STAKED",r.ACTIVATING="ACTIVATING",r.DEPOSIT_IN_PROGRESS="DEPOSIT_IN_PROGRESS",r.ACTIVE="ACTIVE",r.EXIT_REQUESTED="EXIT_REQUESTED",r.EXITING="EXITING",r.EXITED="EXITED",r.SLASHED="SLASHED"}(e||(hl.NativeStakingStatus=e={})),hl}var pl={},n5;function pve(){if(n5)return pl;
270n5=1,Object.defineProperty(pl,"__esModule",{value:!0}),pl.SafeMessageStatus=pl.SafeMessageListItemType=void 0;var t;(function(r){r.DATE_LABEL="DATE_LABEL",r.MESSAGE="MESSAGE"})(t||(pl.SafeMessageListItemType=t={}));var e;return function(r){r.NEEDS_CONFIRMATION="NEEDS_CONFIRMATION",r.CONFIRMED="CONFIRMED"}(e||(pl.SafeMessageStatus=e={})),pl}var vg={},s5;function gve(){if(s5)return vg;s5=1,Object.defineProperty(vg,"__esModule",{value:!0}),vg.DeviceType=void 0;var t;return function(e){e.ANDROID="ANDROID",e.IOS="IOS",e.WEB="WEB"}(t||(vg.DeviceType=t={})),vg}var dS={},i5;function mve(){return i5||(i5=1,Object.defineProperty(dS,"__esModule",{value:!0})),dS}var o5;function yve(){return o5||(o5=1,function(t){var e=dl&&dl.__createBinding||(Object.create?function(ie,de,Ce,ze){ze===void 0&&(ze=Ce);var Ut=Object.getOwnPropertyDescriptor(de,Ce);(!Ut||("get"in Ut?!de.__esModule:Ut.writable||Ut.configurable))&&(Ut={enumerable:!0,get:function(){return de[Ce]}}),Object.defineProperty(ie,ze,Ut)}:function(ie,de,Ce,ze){ze===void 0&&(ze=Ce),ie[ze]=de[Ce]}),r=dl&&dl.__exportStar||function(ie,de){for(var Ce in ie)Ce!=="default"&&!Object.prototype.hasOwnProperty.call(de,Ce)&&e(de,ie,Ce)};Object.defineProperty(t,"__esModule",{value:!0}),t.setBaseUrl=void 0,t.relayTransaction=a,t.getRelayCount=c,t.getSafeInfo=u,t.getIncomingTransfers=l,t.getModuleTransactions=d,t.getMultisigTransactions=f,t.getBalances=g,t.getFiatCurrencies=h,t.getOwnedSafes=p,t.getAllOwnedSafes=y,t.getCollectibles=w,t.getCollectiblesPage=I,t.getTransactionHistory=v,t.getTransactionQueue=E,t.getTransactionDetails=b,t.deleteTransaction=m,t.postSafeGasEstimation=_,t.getNonces=O,t.proposeTransaction=C,t.getConfirmationView=S,t.getTxPreview=T,t.getChainsConfig=N,t.getChainConfig=R,t.getSafeApps=B,t.getMasterCopies=A,t.getDecodedData=P,t.getSafeMessages=k,t.getSafeMessage=U,t.proposeSafeMessage=x,t.confirmSafeMessage=j,t.getDelegates=D,t.registerDevice=M,t.unregisterSafe=L,t.unregisterDevice=H,t.registerEmail=z,t.changeEmail=V,t.resendEmailVerificationCode=G,t.verifyEmail=ee,t.getRegisteredEmail=X,t.deleteRegisteredEmail=oe,t.registerRecoveryModule=te,t.unsubscribeSingle=fe,t.unsubscribeAll=Se,t.getSafeOverviews=le,t.getContract=we,t.getAuthNonce=ve,t.verifyAuth=ae,t.createAccount=re,t.getAccount=wt,t.deleteAccount=Ot,t.getAccountDataTypes=pt,t.getAccountDataSettings=nr,t.putAccountDataSettings=Jt,t.getIndexingStatus=sr;const n=ive(),s=ove();r(ave(),t),r(cve(),t),r(uve(),t),r(lve(),t),r(dve(),t),r(fve(),t),r(hve(),t),r(pve(),t),r(gve(),t),r(mve(),t);let i=s.DEFAULT_BASE_URL;const o=ie=>{i=ie};t.setBaseUrl=o;function a(ie,de){return(0,n.postEndpoint)(i,"/v1/chains/{chainId}/relay",{path:{chainId:ie},body:de})}function c(ie,de){return(0,n.getEndpoint)(i,"/v1/chains/{chainId}/relay/{address}",{path:{chainId:ie,address:de}})}function u(ie,de){return(0,n.getEndpoint)(i,"/v1/chains/{chainId}/safes/{address}",{path:{chainId:ie,address:de}})}function l(ie,de,Ce,ze){return(0,n.getEndpoint)(i,"/v1/chains/{chainId}/safes/{address}/incoming-transfers/",{path:{chainId:ie,address:de},query:Ce},ze)}function d(ie,de,Ce,ze){return(0,n.getEndpoint)(i,"/v1/chains/{chainId}/safes/{address}/module-transactions/",{path:{chainId:ie,address:de},query:Ce},ze)}function f(ie,de,Ce,ze){return(0,n.getEndpoint)(i,"/v1/chains/{chainId}/safes/{address}/multisig-transactions/",{path:{chainId:ie,address:de},query:Ce},ze)}function g(ie,de,Ce="usd",ze={}){return(0,n.getEndpoint)(i,"/v1/chains/{chainId}/safes/{address}/balances/{currency}",{path:{chainId:ie,address:de,currency:Ce},query:ze})}function h(){return(0,n.getEndpoint)(i,"/v1/balances/supported-fiat-codes")}function p(ie,de){return(0,n.getEndpoint)(i,"/v1/chains/{chainId}/owners/{address}/safes",{path:{chainId:ie,address:de}})}function y(ie){return(0,n.getEndpoint)(i,"/v1/owners/{address}/safes",{path:{address:ie}})}function w(ie,de,Ce={}){return(0,n.getEndpoint)(i,"/v1/chains/{chainId}/safes/{address}/collectibles",{path:{chainId:ie,address:de},query:Ce})}function I(ie,de,Ce={},ze){return(0,n.getEndpoint)(i,"/v2/chains/{chainId}/safes/{address}/collectibles",{path:{chainId:ie,address:de},query:Ce},ze)}function v(ie,de,Ce={},ze){return(0,n.getEndpoint)(i,"/v1/chains/{chainId}/safes/{safe_address}/transactions/history",{path:{chainId:ie,safe_address:de},query:Ce},ze)}function E(ie,de,Ce={},ze){return(0,n.getEndpoint)(i,"/v1/chains/{chainId}/safes/{safe_address}/transactions/queued",{path:{chainId:ie,safe_address:de},query:Ce},ze)}function b(ie,de){return(0,n.getEndpoint)(i,"/v1/chains/{chainId}/transactions/{transactionId}",{path:{chainId:ie,transactionId:de}})}function m(ie,de,Ce){return(0,n.deleteEndpoint)(i,"/v1/chains/{chainId}/transactions/{safeTxHash}",{path:{chainId:ie,safeTxHash:de},body:{signature:Ce}})}function _(ie,de,Ce){return(0,n.postEndpoint)(i,"/v2/chains/{chainId}/safes/{safe_address}/multisig-transactions/estimations",{path:{chainId:ie,safe_address:de},body:Ce})}function O(ie,de){return(0,n.getEndpoint)(i,"/v1/chains/{chainId}/safes/{safe_address}/nonces",{path:{chainId:ie,safe_address:de}})}function C(ie,de,Ce){return(0,n.postEndpoint)(i,"/v1/chains/{chainId}/transactions/{safe_address}/propose",{path:{chainId:ie,safe_address:de},body:Ce})}function S(ie,de,Ce,ze,Ut,es){return(0,n.postEndpoint)(i,"/v1/chains/{chainId}/safes/{safe_address}/views/transaction-confirmation",{path:{chainId:ie,safe_address:de},body:{operation:Ce,data:ze,to:Ut,value:es}})}function T(ie,de,Ce,ze,Ut,es){return(0,n.postEndpoint)(i,"/v1/chains/{chainId}/transactions/{safe_address}/preview",{path:{chainId:ie,safe_address:de},body:{operation:Ce,data:ze,to:Ut,value:es}})}function N(ie){return(0,n.getEndpoint)(i,"/v1/chains",{query:ie})}function R(ie){return(0,n.getEndpoint)(i,"/v1/chains/{chainId}",{path:{chainId:ie}})}function B(ie,de={}){return(0,n.getEndpoint)(i,"/v1/chains/{chainId}/safe-apps",{path:{chainId:ie},query:de})}function A(ie){return(0,n.getEndpoint)(i,"/v1/chains/{chainId}/about/master-copies",{path:{chainId:ie}})}function P(ie,de,Ce,ze){return(0,n.postEndpoint)(i,"/v1/chains/{chainId}/data-decoder",{path:{chainId:ie},body:{operation:de,data:Ce,to:ze}})}function k(ie,de,Ce){return(0,n.getEndpoint)(i,"/v1/chains/{chainId}/safes/{safe_address}/messages",{path:{chainId:ie,safe_address:de},query:{}},Ce)}function U(ie,de){return(0,n.getEndpoint)(i,"/v1/chains/{chainId}/messages/{message_hash}",{path:{chainId:ie,message_hash:de}})}function x(ie,de,Ce){return(0,n.postEndpoint)(i,"/v1/chains/{chainId}/safes/{safe_address}/messages",{path:{chainId:ie,safe_address:de},body:Ce})}function j(ie,de,Ce){return(0,n.postEndpoint)(i,"/v1/chains/{chainId}/messages/{message_hash}/signatures",{path:{chainId:ie,message_hash:de},body:Ce})}function D(ie,de={}){return(0,n.getEndpoint)(i,"/v2/chains/{chainId}/delegates",{path:{chainId:ie},query:de})}function M(ie){return(0,n.postEndpoint)(i,"/v1/register/notifications",{body:ie})}function L(ie,de,Ce){return(0,n.deleteEndpoint)(i,"/v1/chains/{chainId}/notifications/devices/{uuid}/safes/{safe_address}",{path:{chainId:ie,safe_address:de,uuid:Ce}})}function H(ie,de){return(0,n.deleteEndpoint)(i,"/v1/chains/{chainId}/notifications/devices/{uuid}",{path:{chainId:ie,uuid:de}})}function z(ie,de,Ce,ze){return(0,n.postEndpoint)(i,"/v1/chains/{chainId}/safes/{safe_address}/emails",{path:{chainId:ie,safe_address:de},body:Ce,headers:ze})}function V(ie,de,Ce,ze,Ut){return(0,n.putEndpoint)(i,"/v1/chains/{chainId}/safes/{safe_address}/emails/{signer}",{path:{chainId:ie,safe_address:de,signer:Ce},body:ze,headers:Ut})}function G(ie,de,Ce){return(0,n.postEndpoint)(i,"/v1/chains/{chainId}/safes/{safe_address}/emails/{signer}/verify-resend",{path:{chainId:ie,safe_address:de,signer:Ce},body:""})}function ee(ie,de,Ce,ze){return(0,n.putEndpoint)(i,"/v1/chains/{chainId}/safes/{safe_address}/emails/{signer}/verify",{path:{chainId:ie,safe_address:de,signer:Ce},body:ze})}function X(ie,de,Ce,ze){return(0,n.getEndpoint)(i,"/v1/chains/{chainId}/safes/{safe_address}/emails/{signer}",{path:{chainId:ie,safe_address:de,signer:Ce},headers:ze})}function oe(ie,de,Ce,ze){return(0,n.deleteEndpoint)(i,"/v1/chains/{chainId}/safes/{safe_address}/emails/{signer}",{path:{chainId:ie,safe_address:de,signer:Ce},headers:ze})}function te(ie,de,Ce){return(0,n.postEndpoint)(i,"/v1/chains/{chainId}/safes/{safe_address}/recovery",{path:{chainId:ie,safe_address:de},body:Ce})}function fe(ie){return(0,n.deleteEndpoint)(i,"/v1/subscriptions",{query:ie})}function Se(ie){return(0,n.deleteEndpoint)(i,"/v1/subscriptions/all",{query:ie})}function le(ie,de){return(0,n.getEndpoint)(i,"/v1/safes",{query:Object.assign(Object.assign({},de),{safes:ie.join(",")})})}function we(ie,de){return(0,n.getEndpoint)(i,"/v1/chains/{chainId}/contracts/{contractAddress}",{path:{chainId:ie,contractAddress:de}})}function ve(){return(0,n.getEndpoint)(i,"/v1/auth/nonce",{credentials:"include"})}function ae(ie){return(0,n.postEndpoint)(i,"/v1/auth/verify",{body:ie,credentials:"include"})}function re(ie){return(0,n.postEndpoint)(i,"/v1/accounts",{body:ie,credentials:"include"})}function wt(ie){return(0,n.getEndpoint)(i,"/v1/accounts/{address}",{path:{address:ie},credentials:"include"})}function Ot(ie){return(0,n.deleteEndpoint)(i,"/v1/accounts/{address}",{path:{address:ie},credentials:"include"})}function pt(){return(0,n.getEndpoint)(i,"/v1/accounts/data-types")}function nr(ie){return(0,n.getEndpoint)(i,"/v1/accounts/{address}/data-settings",{path:{address:ie},credentials:"include"})}function Jt(ie,de){return(0,n.putEndpoint)(i,"/v1/accounts/{address}/data-settings",{path:{address:ie},body:de,credentials:"include"})}function sr(ie){return(0,n.getEndpoint)(i,"/v1/chains/{chainId}/about/indexing",{path:{chainId:ie}})}}(dl)),dl}var a5;function bve(){return a5||(a5=1,function(t){Object.defineProperty(t,"__esMo
270dule",{value:!0}),t.TransferDirection=t.TransactionStatus=t.TokenType=t.Operation=void 0;var e=yve();Object.defineProperty(t,"Operation",{enumerable:!0,get:function(){return e.Operation}}),Object.defineProperty(t,"TokenType",{enumerable:!0,get:function(){return e.TokenType}}),Object.defineProperty(t,"TransactionStatus",{enumerable:!0,get:function(){return e.TransactionStatus}}),Object.defineProperty(t,"TransferDirection",{enumerable:!0,get:function(){return e.TransferDirection}})}(uS)),uS}var fS={},c5;function wve(){return c5||(c5=1,Object.defineProperty(fS,"__esModule",{value:!0}),Qd()),fS}var u5;function iN(){return u5||(u5=1,function(t){var e=ll&&ll.__createBinding||(Object.create?function(n,s,i,o){o===void 0&&(o=i);var a=Object.getOwnPropertyDescriptor(s,i);(!a||("get"in a?!s.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return s[i]}}),Object.defineProperty(n,o,a)}:function(n,s,i,o){o===void 0&&(o=i),n[o]=s[i]}),r=ll&&ll.__exportStar||function(n,s){for(var i in n)i!=="default"&&!Object.prototype.hasOwnProperty.call(s,i)&&e(s,n,i)};Object.defineProperty(t,"__esModule",{value:!0}),r(rve(),t),r(nve(),t),r(bve(),t),r(wve(),t)}(ll)),ll}var l5;function Eve(){if(l5)return mg;l5=1,Object.defineProperty(mg,"__esModule",{value:!0}),mg.TXs=void 0;const t=Qd(),e=iN();class r{constructor(s){this.communicator=s}async getBySafeTxHash(s){if(!s)throw new Error("Invalid safeTxHash");return(await this.communicator.send(t.Methods.getTxBySafeTxHash,{safeTxHash:s})).data}async signMessage(s){const i={message:s};return(await this.communicator.send(t.Methods.signMessage,i)).data}async signTypedMessage(s){if(!(0,e.isObjectEIP712TypedData)(s))throw new Error("Invalid typed data");return(await this.communicator.send(t.Methods.signTypedMessage,{typedData:s})).data}async send({txs:s,params:i}){if(!s||!s.length)throw new Error("No transactions were passed");const o={txs:s,params:i};return(await this.communicator.send(t.Methods.sendTransactions,o)).data}}return mg.TXs=r,mg}var _g={},Ag={},d5;function oN(){return d5||(d5=1,Object.defineProperty(Ag,"__esModule",{value:!0}),Ag.RPC_CALLS=void 0,Ag.RPC_CALLS={eth_call:"eth_call",eth_gasPrice:"eth_gasPrice",eth_getLogs:"eth_getLogs",eth_getBalance:"eth_getBalance",eth_getCode:"eth_getCode",eth_getBlockByHash:"eth_getBlockByHash",eth_getBlockByNumber:"eth_getBlockByNumber",eth_getStorageAt:"eth_getStorageAt",eth_getTransactionByHash:"eth_getTransactionByHash",eth_getTransactionReceipt:"eth_getTransactionReceipt",eth_getTransactionCount:"eth_getTransactionCount",eth_estimateGas:"eth_estimateGas",safe_setSettings:"safe_setSettings"}),Ag}var f5;function vve(){if(f5)return _g;f5=1,Object.defineProperty(_g,"__esModule",{value:!0}),_g.Eth=void 0;const t=oN(),e=Qd(),r={defaultBlockParam:(s="latest")=>s,returnFullTxObjectParam:(s=!1)=>s,blockNumberToHex:s=>Number.isInteger(s)?`0x${s.toString(16)}`:s};class n{constructor(i){this.communicator=i,this.call=this.buildRequest({call:t.RPC_CALLS.eth_call,formatters:[null,r.defaultBlockParam]}),this.getBalance=this.buildRequest({call:t.RPC_CALLS.eth_getBalance,formatters:[null,r.defaultBlockParam]}),this.getCode=this.buildRequest({call:t.RPC_CALLS.eth_getCode,formatters:[null,r.defaultBlockParam]}),this.getStorageAt=this.buildRequest({call:t.RPC_CALLS.eth_getStorageAt,formatters:[null,r.blockNumberToHex,r.defaultBlockParam]}),this.getPastLogs=this.buildRequest({call:t.RPC_CALLS.eth_getLogs}),this.getBlockByHash=this.buildRequest({call:t.RPC_CALLS.eth_getBlockByHash,formatters:[null,r.returnFullTxObjectParam]}),this.getBlockByNumber=this.buildRequest({call:t.RPC_CALLS.eth_getBlockByNumber,formatters:[r.blockNumberToHex,r.returnFullTxObjectParam]}),this.getTransactionByHash=this.buildRequest({call:t.RPC_CALLS.eth_getTransactionByHash}),this.getTransactionReceipt=this.buildRequest({call:t.RPC_CALLS.eth_getTransactionReceipt}),this.getTransactionCount=this.buildRequest({call:t.RPC_CALLS.eth_getTransactionCount,formatters:[null,r.defaultBlockParam]}),this.getGasPrice=this.buildRequest({call:t.RPC_CALLS.eth_gasPrice}),this.getEstimateGas=o=>this.buildRequest({call:t.RPC_CALLS.eth_estimateGas})([o]),this.setSafeSettings=this.buildRequest({call:t.RPC_CALLS.safe_setSettings})}buildRequest(i){const{call:o,formatters:a}=i;return async c=>{a&&Array.isArray(c)&&a.forEach((d,f)=>{d&&(c[f]=d(c[f]))});const u={call:o,params:c||[]};return(await this.communicator.send(e.Methods.rpcCall,u)).data}}}return _g.Eth=n,_g}var ca={},hS={},pS={},Cg={},Ig={},h5;function _ve(){return h5||(h5=1,Object.defineProperty(Ig,"__esMo
270dule",{value:!0}),Ig.version=void 0,Ig.version="1.0.8"),Ig}var p5;function Bp(){if(p5)return Cg;p5=1,Object.defineProperty(Cg,"__esModule",{value:!0}),Cg.BaseError=void 0;const t=_ve();class e extends Error{constructor(n,s={}){var c;const i=s.cause instanceof e?s.cause.details:(c=s.cause)!=null&&c.message?s.cause.message:s.details,o=s.cause instanceof e&&s.cause.docsPath||s.docsPath,a=[n||"An error occurred.","",...s.metaMessages?[...s.metaMessages,""]:[],...o?[`Docs: https://abitype.dev${o}`]:[],...i?[`Details: ${i}`]:[],`Version: abitype@${t.version}`].join(`
271`);super(a),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiTypeError"}),s.cause&&(this.cause=s.cause),this.details=i,this.docsPath=o,this.metaMessages=s.metaMessages,this.shortMessage=n}}return Cg.BaseError=e,Cg}var Wb={},g5;function Ave(){if(g5)return Wb;g5=1,Object.defineProperty(Wb,"__esModule",{value:!0}),Wb.narrow=t;function t(e){return e}return Wb}var Vb={},Gb={},Kb={},Zb={},ho={},m5;function bC(){if(m5)return ho;m5=1,Object.defineProperty(ho,"__esModule",{value:!0}),ho.isTupleRegex=ho.integerRegex=ho.bytesRegex=void 0,ho.execTyped=t;function t(e,r){const n=e.exec(r);return n==null?void 0:n.groups}return ho.bytesRegex=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,ho.integerRegex=/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/,ho.isTupleRegex=/^\(.+?\).*?$/,ho}var y5;function lz(){if(y5)return Zb;
271y5=1,Object.defineProperty(Zb,"__esModule",{value:!0}),Zb.formatAbiParameter=r;const t=bC(),e=/^tuple(?<array>(\[(\d*)\])*)$/;function r(n){let s=n.type;if(e.test(n.type)&&"components"in n){s="(";const i=n.components.length;for(let a=0;a<i;a++){const c=n.components[a];s+=r(c),a<i-1&&(s+=", ")}const o=(0,t.execTyped)(e,n.type);return s+=`)${(o==null?void 0:o.array)??""}`,r({...n,type:s})}return"indexed"in n&&n.indexed&&(s=`${s} indexed`),n.name?`${s} ${n.name}`:s}return Zb}var b5;function dz(){if(b5)return Kb;b5=1,Object.defineProperty(Kb,"__esModule",{value:!0}),Kb.formatAbiParameters=e;const t=lz();function e(r){let n="";const s=r.length;for(let i=0;i<s;i++){const o=r[i];n+=(0,t.formatAbiParameter)(o),i!==s-1&&(n+=", ")}return n}return Kb}var w5;function fz(){if(w5)return Gb;w5=1,Object.defineProperty(Gb,"__esModule",{value:!0}),Gb.formatAbiItem=e;const t=dz();function e(r){var n;return r.type==="function"?`function ${r.name}(${(0,t.formatAbiParameters)(r.inputs)})${r.stateMutability&&r.stateMutability!=="nonpayable"?` ${r.stateMutability}`:""}${(n=r.outputs)!=null&&n.length?` returns (${(0,t.formatAbiParameters)(r.outputs)})`:""}`:r.type==="event"?`event ${r.name}(${(0,t.formatAbiParameters)(r.inputs)})`:r.type==="error"?`error ${r.name}(${(0,t.formatAbiParameters)(r.inputs)})`:r.type==="constructor"?`constructor(${(0,t.formatAbiParameters)(r.inputs)})${r.stateMutability==="payable"?" payable":""}`:r.type==="fallback"?`fallback() external${r.stateMutability==="payable"?" payable":""}`:"receive() external payable"}return Gb}var E5;function Cve(){if(E5)return Vb;E5=1,Object.defineProperty(Vb,"__esModule",{value:!0}),Vb.formatAbi=e;const t=fz();function e(r){const n=[],s=r.length;for(let i=0;i<s;i++){const o=r[i],a=(0,t.formatAbiItem)(o);n.push(a)}return n}return Vb}var Yb={},yr={},v5;function kp(){if(v5)return yr;
271v5=1,Object.defineProperty(yr,"__esModule",{value:!0}),yr.functionModifiers=yr.eventModifiers=yr.modifiers=void 0,yr.isErrorSignature=r,yr.execErrorSignature=n,yr.isEventSignature=i,yr.execEventSignature=o,yr.isFunctionSignature=c,yr.execFunctionSignature=u,yr.isStructSignature=d,yr.execStructSignature=f,yr.isConstructorSignature=h,yr.execConstructorSignature=p,yr.isFallbackSignature=w,yr.execFallbackSignature=I,yr.isReceiveSignature=E;const t=bC(),e=/^error (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function r(b){return e.test(b)}function n(b){return(0,t.execTyped)(e,b)}const s=/^event (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function i(b){return s.test(b)}function o(b){return(0,t.execTyped)(s,b)}const a=/^function (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)(?: (?<scope>external|public{1}))?(?: (?<stateMutability>pure|view|nonpayable|payable{1}))?(?: returns\s?\((?<returns>.*?)\))?$/;function c(b){return a.test(b)}function u(b){return(0,t.execTyped)(a,b)}const l=/^struct (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*) \{(?<properties>.*?)\}$/;function d(b){return l.test(b)}function f(b){return(0,t.execTyped)(l,b)}const g=/^constructor\((?<parameters>.*?)\)(?:\s(?<stateMutability>payable{1}))?$/;function h(b){return g.test(b)}function p(b){return(0,t.execTyped)(g,b)}const y=/^fallback\(\) external(?:\s(?<stateMutability>payable{1}))?$/;function w(b){return y.test(b)}function I(b){return(0,t.execTyped)(y,b)}const v=/^receive\(\) external payable$/;function E(b){return v.test(b)}return yr.modifiers=new Set(["memory","indexed","storage","calldata"]),yr.eventModifiers=new Set(["indexed"]),yr.functionModifiers=new Set(["calldata","memory","storage"]),yr}var Jb={},ua={},_5;function wC(){if(_5)return ua;_5=1,Object.defineProperty(ua,"__esModule",{value:!0}),ua.UnknownSolidityTypeError=ua.UnknownTypeError=ua.InvalidAbiItemError=void 0;const t=Bp();class e extends t.BaseError{constructor({signature:i}){super("Failed to parse ABI item.",{details:`parseAbiItem(${JSON.stringify(i,null,2)})`,docsPath:"/api/human#parseabiitem-1"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiItemError"})}}ua.InvalidAbiItemError=e;class r extends t.BaseError{constructor({type:i}){super("Unknown type.",{metaMessages:[`Type "${i}" is not a valid ABI type. Perhaps you forgot to include a struct signature?`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownTypeError"})}}ua.UnknownTypeError=r;class n extends t.BaseError{constructor({type:i}){super("Unknown type.",{metaMessages:[`Type "${i}" is not a valid ABI type.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSolidityTypeError"})}}return ua.UnknownSolidityTypeError=n,ua}var nn={},A5;function N0(){if(A5)return nn;A5=1,Object.defineProperty(nn,"__esModule",{value:!0}),nn.InvalidAbiTypeParameterError=nn.InvalidFunctionModifierError=nn.InvalidModifierError=nn.SolidityProtectedKeywordError=nn.InvalidParameterError=nn.InvalidAbiParametersError=nn.InvalidAbiParameterError=void 0;const t=Bp();class e extends t.BaseError{constructor({param:u}){super("Failed to parse ABI parameter.",{details:`parseAbiParameter(${JSON.stringify(u,null,2)})`,docsPath:"/api/human#parseabiparameter-1"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiParameterError"})}}nn.InvalidAbiParameterError=e;class r extends t.BaseError{constructor({params:u}){super("Failed to parse ABI parameters.",{details:`parseAbiParameters(${JSON.stringify(u,null,2)})`,docsPath:"/api/human#parseabiparameters-1"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiParametersError"})}}nn.InvalidAbiParametersError=r;class n extends t.BaseError{constructor({param:u}){super("Invalid ABI parameter.",{details:u}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParameterError"})}}nn.InvalidParameterError=n;class s extends t.BaseError{constructor({param:u,name:l}){super("Invalid ABI parameter.",{details:u,metaMessages:[`"${l}" is a protected Solidity keyword. More info: https://docs.soliditylang.org/en/latest/cheatsheet.html`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SolidityProtectedKeywordError"})}}nn.SolidityProtectedKeywordError=s;class i extends t.BaseError{constructor({param:u,type:l,modifier:d}){super("Invalid ABI parameter.",{details:u,metaMessages:[`Modifier "${d}" not allowed${l?` in "${l}" type`:""}.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidModifierError"})}}nn.InvalidModifierError=i;class o extends t.BaseError{constructor({param:u,type:l,modifier:d}){super("Invalid ABI parameter.",{details:u,metaMessages:[`Modifier "${d}" not allowed${l?` in "${l}" type`:""}.`,`Data location can only be specified for array, struct, or mapping types, but "${d}" was given.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidFunctionModifierError"})}}nn.InvalidFunctionModifierError=o;class a extends t.BaseError{constructor({abiParameter:u}){super("Invalid ABI parameter.",{details:JSON.stringify(u,null,2),metaMessages:["ABI parameter type is invali
271d."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiTypeParameterError"})}}return nn.InvalidAbiTypeParameterError=a,nn}var la={},C5;function aN(){if(C5)return la;C5=1,Object.defineProperty(la,"__esModule",{value:!0}),la.InvalidStructSignatureError=la.UnknownSignatureError=la.InvalidSignatureError=void 0;const t=Bp();class e extends t.BaseError{constructor({signature:i,type:o}){super(`Invalid ${o} signature.`,{details:i}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidSignatureError"})}}la.InvalidSignatureError=e;class r extends t.BaseError{constructor({signature:i}){super("Unknown signature.",{details:i}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSignatureError"})}}la.UnknownSignatureError=r;class n extends t.BaseError{constructor({signature:i}){super("Invalid struct signature.",{details:i,metaMessages:["No properties exist."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidStructSignatureError"})}}return la.InvalidStructSignatureError=n,la}var Sg={},I5;function hz(){if(I5)return Sg;I5=1,Object.defineProperty(Sg,"__esModule",{value:!0}),Sg.CircularReferenceError=void 0;const t=Bp();class e extends t.BaseError{constructor({type:n}){super("Circular reference detected.",{metaMessages:[`Struct "${n}" is a circular reference.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"CircularReferenceError"})}}return Sg.CircularReferenceError=e,Sg}var is={},Tg={},S5;function pz(){if(S5)return Tg;S5=1,Object.defineProperty(Tg,"__esModule",{value:!0}),Tg.InvalidParenthesisError=void 0;const t=Bp();class e extends t.BaseError{constructor({current:n,depth:s}){super("Unbalanced parentheses.",{metaMessages:[`"${n.trim()}" has too many ${s>0?"opening":"closing"} parentheses.`],details:`Depth "${s}"`}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParenthesisError"})}}return Tg.InvalidParenthesisError=e,Tg}var _f={},T5;function Ive(){if(T5)return _f;T5=1,Object.defineProperty(_f,"__esModule",{value:!0}),_f.parameterCache=void 0,_f.getParameterCacheKey=t;function t(e,r,n){let s="";if(n)for(const i of Object.entries(n)){if(!i)continue;let o="";for(const a of i[1])o+=`[${a.type}${a.name?`:${a.name}`:""}]`;s+=`(${i[0]}{${o}})`}return r?`${r}:${e}${s}`:e}return _f.parameterCache=new Map([["address",{type:"address"}],["bool",{type:"bool"}],["bytes",{type:"bytes"}],["bytes32",{type:"bytes32"}],["int",{type:"int256"}],["int256",{type:"int256"}],["string",{type:"string"}],["uint",{type:"uint256"}],["uint8",{type:"uint8"}],["uint16",{type:"uint16"}],["uint24",{type:"uint24"}],["uint32",{type:"uint32"}],["uint64",{type:"uint64"}],["uint96",{type:"uint96"}],["uint112",{type:"uint112"}],["uint160",{type:"uint160"}],["uint192",{type:"uint192"}],["uint256",{type:"uint256"}],["address owner",{type:"address",name:"owner"}],["address to",{type:"address",name:"to"}],["bool approved",{type:"bool",name:"approved"}],["bytes _data",{type:"bytes",name:"_data"}],["bytes data",{type:"bytes",name:"data"}],["bytes signature",{type:"bytes",name:"signature"}],["bytes32 hash",{type:"bytes32",name:"hash"}],["bytes32 r",{type:"bytes32",name:"r"}],["bytes32 root",{type:"bytes32",name:"root"}],["bytes32 s",{type:"bytes32",name:"s"}],["string name",{type:"string",name:"name"}],["string symbol",{type:"string",name:"symbol"}],["string tokenURI",{type:"string",name:"tokenURI"}],["uint tokenId",{type:"uint256",name:"tokenId"}],["uint8 v",{type:"uint8",name:"v"}],["uint256 balance",{type:"uint256",name:"balance"}],["uint256 tokenId",{type:"uint256",name:"tokenId"}],["uint256 value",{type:"uint256",name:"value"}],["event:address indexed from",{type:"address",name:"from",indexed:!0}],["event:address indexed to",{type:"address",name:"to",indexed:!0}],["event:uint indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}],["event:uint256 indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}]]),_f}var P5;function Cp(){if(P5)return is;P5=1,Object.defineProperty(is,"__esModule",{value:!0}),is.parseSignature=a,is.parseFunctionSignature=c,is.parseEventSignature=u,is.parseErrorSignature=l,is.parseConstructorSignature=d,is.parseFallbackSignature=f,is.parseAbiParameter=y,is.splitParameters=w,is.isSolidityType=I,is.isSolidityKeyword=E,is.isValidDataLocation=b;const t=bC(),e=wC(),r=N0(),n=aN(),s=pz(),i=Ive(),o=kp();function a(m,_={}){if((0,o.isFunctionSignature)(m))return c(m,_);if((0,o.isEventSignature)(m))return u(m,_);if((0,o.isErrorSignature)(m))return l(m,_);if((0,o.isConstructorSignature)(m))return d(m,_);if((0,o.isFallbackSignature)(m))return f(m);if((0,o.isReceiveSignature)(m))return{type:"receive",stateMutability:"payable"};throw new n.UnknownSignatureError({signature:m})}function c(m,_={}){const O=(0,o.execFunctionSignature)(m);if(!O)throw new n.InvalidSignatureError({signature:m,type:"function"});const C=w(O.parameters),S=[],T=C.length;for(let R=0;R<T;R++)S.push(y(C[R],{modifiers:o.functionModifiers,structs:_,type:"function"}));const N=[];if(O.returns){const R=w(O.returns),B=R.length;for(let A=0;A<B;A++)N.push(y(R[A],{modifiers:o.functionModifiers,structs:_,type:"function"}))}return{name:O.name,type:"function",stateMutability:O.stateMutability??"nonpayable",inputs:S,outputs:N}}function u(m,_={}){const O=(0,o.execEventSignature)(m);if(!O)throw new n.InvalidSignatureError({signature:m,type:"event"});const C=w(O.parameters),S=[],T=C.length;for(let N=0;N<T;N++)S.push(y(C[N],{modifiers:o.eventModifiers,structs:_,type:"event"}));return{name:O.name,type:"event",inputs:S}}function l(m,_={}){const O=(0,o.execErrorSignature)(m);if(!O)throw new n.InvalidSignatureError({signature:m,type:"error"});const C=w(O.parameters),S=[],T=C.length;for(let N=0;N<T;N++)S.push(y(C[N],{structs:_,type:"error"}));return{name:O.name,type:"error",inputs:S}}function d(m,_={}){const O=(0,o.execConstructorSignature)(m);if(!O)throw new n.InvalidSignatureError({signature:m,type:"constructor"});const C=w(O.parameters),S=[],T=C.length;for(let N=0;N<T;N++)S.push(y(C[N],{structs:_,type:"constructor"}));return{type:"constructor",stateMutability:O.stateMutability??"nonpayable",inputs:S}}function f(m){const _=(0,o.execFallbackSignature)(m);if(!_)throw new n.InvalidSignatureError({signature:m,type:"fallback"});return{type:"fallback",stateMutability:_.stateMutability??"nonpayable"}}const g=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,h=/^\((?<type>.+?)\)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,p=/^u?int$/;function y(m,_){var k,U;const O=(0,i.getParameterCacheKey)(m,_==null?void 0:_.type,_==null?void 0:_.structs);if(i.parameterCache.has(O))return i.parameterCache.get(O);const C=t.isTupleRegex.test(m),S=(0,t.execTyped)(C?h:g,m);if(!S)throw new r.InvalidParameterError({param:m});if(S.name&&E(S.name))throw new r.SolidityProtectedKeywordError({param:m,name:S.name});const T=S.name?{name:S.name}:{},N=S.modifier==="indexed"?{indexed:!0}:{},R=(_==null?void 0:_.structs)??{};let B,A={};if(C){B="tuple";const x=w(S.type),j=[],D=x.length;for(let M=0;M<D;M++)j.push(y(x[M],{structs:R}));A={components:j}}else if(S.type in R)B="tuple",A={components:R[S.type]};else if(p.test(S.type))B=`${S.type}256`;else if(B=S.type,(_==null?void 0:_.type)!=="struct"&&!I(B))throw new e.UnknownSolidityTypeError({type:B});if(S.modifier){if(!((U=(k=_==null?void 0:_.modifiers)==null?void 0:k.has)!=null&&U.call(k,S.modifier)))throw new r.InvalidModifierError({param:m,type:_==null?void 0:_.type,modifier:S.modifier});
271if(o.functionModifiers.has(S.modifier)&&!b(B,!!S.array))throw new r.InvalidFunctionModifierError({param:m,type:_==null?void 0:_.type,modifier:S.modifier})}const P={type:`${B}${S.array??""}`,...T,...N,...A};return i.parameterCache.set(O,P),P}function w(m,_=[],O="",C=0){const S=m.trim().length;for(let T=0;T<S;T++){const N=m[T],R=m.slice(T+1);switch(N){case",":return C===0?w(R,[..._,O.trim()]):w(R,_,`${O}${N}`,C);case"(":return w(R,_,`${O}${N}`,C+1);case")":return w(R,_,`${O}${N}`,C-1);default:return w(R,_,`${O}${N}`,C)}}if(O==="")return _;if(C!==0)throw new s.InvalidParenthesisError({current:O,depth:C});return _.push(O.trim()),_}function I(m){return m==="address"||m==="bool"||m==="function"||m==="string"||t.bytesRegex.test(m)||t.integerRegex.test(m)}const v=/^(?:after|alias|anonymous|apply|auto|byte|calldata|case|catch|constant|copyof|default|defined|error|event|external|false|final|function|immutable|implements|in|indexed|inline|internal|let|mapping|match|memory|mutable|null|of|override|partial|private|promise|public|pure|reference|relocatable|return|returns|sizeof|static|storage|struct|super|supports|switch|this|true|try|typedef|typeof|var|view|virtual)$/;function E(m){return m==="address"||m==="bool"||m==="function"||m==="string"||m==="tuple"||t.bytesRegex.test(m)||t.integerRegex.test(m)||v.test(m)}function b(m,_){return _||m==="bytes"||m==="string"||m==="tuple"}return is}var O5;function EC(){if(O5)return Jb;O5=1,Object.defineProperty(Jb,"__esModule",{value:!0}),Jb.parseStructs=a;const t=bC(),e=wC(),r=N0(),n=aN(),s=hz(),i=kp(),o=Cp();function a(l){const d={},f=l.length;for(let y=0;y<f;y++){const w=l[y];if(!(0,i.isStructSignature)(w))continue;const I=(0,i.execStructSignature)(w);if(!I)throw new n.InvalidSignatureError({signature:w,type:"struct"});const v=I.properties.split(";"),E=[],b=v.length;for(let m=0;m<b;m++){const O=v[m].trim();if(!O)continue;const C=(0,o.parseAbiParameter)(O,{type:"struct"});E.push(C)}if(!E.length)throw new n.InvalidStructSignatureError({signature:w});d[I.name]=E}const g={},h=Object.entries(d),p=h.length;for(let y=0;y<p;y++){const[w,I]=h[y];g[w]=u(I,d)}return g}const c=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?$/;function u(l,d,f=new Set){const g=[],h=l.length;for(let p=0;p<h;p++){const y=l[p];if(t.isTupleRegex.test(y.type))g.push(y);else{const I=(0,t.execTyped)(c,y.type);if(!(I!=null&&I.type))throw new r.InvalidAbiTypeParameterError({abiParameter:y});const{array:v,type:E}=I;if(E in d){if(f.has(E))throw new s.CircularReferenceError({type:E});g.push({...y,type:`tuple${v??""}`,components:u(d[E]??[],d,new Set([...f,E]))})}else if((0,o.isSolidityType)(E))g.push(y);else throw new e.UnknownTypeError({type:E})}}return g}return Jb}var N5;function Sve(){if(N5)return Yb;N5=1,Object.defineProperty(Yb,"__esModule",{value:!0}),Yb.parseAbi=n;const t=kp(),e=EC(),r=Cp();function n(s){const i=(0,e.parseStructs)(s),o=[],a=s.length;for(let c=0;c<a;c++){const u=s[c];(0,t.isStructSignature)(u)||o.push((0,r.parseSignature)(u,i))}return o}return Yb}var Qb={},x5;function Tve(){if(x5)return Qb;x5=1,Object.defineProperty(Qb,"__esModule",{value:!0}),Qb.parseAbiItem=s;const t=wC(),e=kp(),r=EC(),n=Cp();function s(i){let o;if(typeof i=="string")o=(0,n.parseSignature)(i);else{const a=(0,r.parseStructs)(i),c=i.length;for(let u=0;u<c;u++){const l=i[u];if(!(0,e.isStructSignature)(l)){o=(0,n.parseSignature)(l,a);break}}}if(!o)throw new t.InvalidAbiItemError({signature:i});return o}return Qb}var Xb={},R5;function Pve(){if(R5)return Xb;R5=1,Object.defineProperty(Xb,"__esModule",{value:!0}),Xb.parseAbiParameter=s;const t=N0(),e=kp(),r=EC(),n=Cp();function s(i){let o;if(typeof i=="string")o=(0,n.parseAbiParameter)(i,{modifiers:e.modifiers});else{const a=(0,r.parseStructs)(i),c=i.length;for(let u=0;u<c;u++){const l=i[u];if(!(0,e.isStructSignature)(l)){o=(0,n.parseAbiParameter)(l,{modifiers:e.modifiers,structs:a});break}}}if(!o)throw new t.InvalidAbiParameterError({param:i});return o}return Xb}var ew={},B5;function Ove(){if(B5)return ew;B5=1,Object.defineProperty(ew,"__esModule",{value:!0}),ew.parseAbiParameters=i;const t=N0(),e=kp(),r=EC(),n=Cp(),s=Cp();function i(o){const a=[];
271if(typeof o=="string"){const c=(0,n.splitParameters)(o),u=c.length;for(let l=0;l<u;l++)a.push((0,s.parseAbiParameter)(c[l],{modifiers:e.modifiers}))}else{const c=(0,r.parseStructs)(o),u=o.length;for(let l=0;l<u;l++){const d=o[l];if((0,e.isStructSignature)(d))continue;const f=(0,n.splitParameters)(d),g=f.length;for(let h=0;h<g;h++)a.push((0,s.parseAbiParameter)(f[h],{modifiers:e.modifiers,structs:c}))}}if(a.length===0)throw new t.InvalidAbiParametersError({params:o});return a}return ew}var k5;function vC(){return k5||(k5=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.CircularReferenceError=t.InvalidParenthesisError=t.UnknownSignatureError=t.InvalidSignatureError=t.InvalidStructSignatureError=t.InvalidAbiParameterError=t.InvalidAbiParametersError=t.InvalidParameterError=t.SolidityProtectedKeywordError=t.InvalidModifierError=t.InvalidFunctionModifierError=t.InvalidAbiTypeParameterError=t.UnknownSolidityTypeError=t.InvalidAbiItemError=t.UnknownTypeError=t.parseAbiParameters=t.parseAbiParameter=t.parseAbiItem=t.parseAbi=t.formatAbiParameters=t.formatAbiParameter=t.formatAbiItem=t.formatAbi=t.narrow=t.BaseError=void 0;var e=Bp();Object.defineProperty(t,"BaseError",{enumerable:!0,get:function(){return e.BaseError}});var r=Ave();Object.defineProperty(t,"narrow",{enumerable:!0,get:function(){return r.narrow}});var n=Cve();Object.defineProperty(t,"formatAbi",{enumerable:!0,get:function(){return n.formatAbi}});var s=fz();Object.defineProperty(t,"formatAbiItem",{enumerable:!0,get:function(){return s.formatAbiItem}});var i=lz();Object.defineProperty(t,"formatAbiParameter",{enumerable:!0,get:function(){return i.formatAbiParameter}});var o=dz();Object.defineProperty(t,"formatAbiParameters",{enumerable:!0,get:function(){return o.formatAbiParameters}});var a=Sve();Object.defineProperty(t,"parseAbi",{enumerable:!0,get:function(){return a.parseAbi}});var c=Tve();Object.defineProperty(t,"parseAbiItem",{enumerable:!0,get:function(){return c.parseAbiItem}});var u=Pve();Object.defineProperty(t,"parseAbiParameter",{enumerable:!0,get:function(){return u.parseAbiParameter}});var l=Ove();Object.defineProperty(t,"parseAbiParameters",{enumerable:!0,get:function(){return l.parseAbiParameters}});var d=wC();Object.defineProperty(t,"UnknownTypeError",{enumerable:!0,get:function(){return d.UnknownTypeError}}),Object.defineProperty(t,"InvalidAbiItemError",{enumerable:!0,get:function(){return d.InvalidAbiItemError}}),Object.defineProperty(t,"UnknownSolidityTypeError",{enumerable:!0,get:function(){return d.UnknownSolidityTypeError}});var f=N0();Object.defineProperty(t,"InvalidAbiTypeParameterError",{enumerable:!0,get:function(){return f.InvalidAbiTypeParameterError}}),Object.defineProperty(t,"InvalidFunctionModifierError",{enumerable:!0,get:function(){return f.InvalidFunctionModifierError}}),Object.defineProperty(t,"InvalidModifierError",{enumerable:!0,get:function(){return f.InvalidModifierError}}),Object.defineProperty(t,"SolidityProtectedKeywordError",{enumerable:!0,get:function(){return f.SolidityProtectedKeywordError}}),Object.defineProperty(t,"InvalidParameterError",{enumerable:!0,get:function(){return f.InvalidParameterError}}),Object.defineProperty(t,"InvalidAbiParametersError",{enumerable:!0,get:function(){return f.InvalidAbiParametersError}}),Object.defineProperty(t,"InvalidAbiParameterError",{enumerable:!0,get:function(){return f.InvalidAbiParameterError}});var g=aN();Object.defineProperty(t,"InvalidStructSignatureError",{enumerable:!0,get:function(){return g.InvalidStructSignatureError}}),Object.defineProperty(t,"InvalidSignatureError",{enumerable:!0,get:function(){return g.InvalidSignatureError}}),Object.defineProperty(t,"UnknownSignatureError",{enumerable:!0,get:function(){return g.UnknownSignatureError}});var h=pz();Object.defineProperty(t,"InvalidParenthesisError",{enumerable:!0,get:function(){return h.InvalidParenthesisError}});var p=hz();Object.defineProperty(t,"CircularReferenceError",{enumerable:!0,get:function(){return p.CircularReferenceError}})}(pS)),pS}var Af={},tw={},j5;function Vt(){if(j5)return tw;j5=1,Object.defineProperty(tw,"__esModule",{value:!0}),tw.getAction=t;function t(e,r,n){const s=e[r.name];if(typeof s=="function")return s;const i=e[n];return typeof i=="function"?i:o=>r(e,o)}return tw}var rw={},nw={},He={},Pg={},D5;function fc(){if(D5)return Pg;
271D5=1,Object.defineProperty(Pg,"__esModule",{value:!0}),Pg.formatAbiItem=e,Pg.formatAbiParams=r;const t=lr();function e(s,{includeName:i=!1}={}){if(s.type!=="function"&&s.type!=="event"&&s.type!=="error")throw new t.InvalidDefinitionTypeError(s.type);return`${s.name}(${r(s.inputs,{includeName:i})})`}function r(s,{includeName:i=!1}={}){return s?s.map(o=>n(o,{includeName:i})).join(i?", ":","):""}function n(s,{includeName:i}){return s.type.startsWith("tuple")?`(${r(s.components,{includeName:i})})${s.type.slice(5)}`:s.type+(i&&s.name?` ${s.name}`:"")}return Pg}var sw={},iw={},U5;function Qn(){if(U5)return iw;U5=1,Object.defineProperty(iw,"__esModule",{value:!0}),iw.isHex=t;function t(e,{strict:r=!0}={}){return!e||typeof e!="string"?!1:r?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x")}return iw}var M5;function Gs(){if(M5)return sw;M5=1,Object.defineProperty(sw,"__esModule",{value:!0}),sw.size=e;const t=Qn();function e(r){return(0,t.isHex)(r,{strict:!1})?Math.ceil((r.length-2)/2):r.length}return sw}var Cf={},Og={},$5;function Nve(){return $5||($5=1,Object.defineProperty(Og,"__esModule",{value:!0}),Og.version=void 0,Og.version="2.23.4"),Og}var L5;function ut(){if(L5)return Cf;L5=1,Object.defineProperty(Cf,"__esModule",{value:!0}),Cf.BaseError=void 0,Cf.setErrorConfig=r;const t=Nve();let e={getDocsUrl:({docsBaseUrl:i,docsPath:o="",docsSlug:a})=>o?`${i??"https://viem.sh"}${o}${a?`#${a}`:""}`:void 0,version:`viem@${t.version}`};function r(i){e=i}class n extends Error{constructor(o,a={}){var f;const c=(()=>{var g;return a.cause instanceof n?a.cause.details:(g=a.cause)!=null&&g.message?a.cause.message:a.details})(),u=a.cause instanceof n&&a.cause.docsPath||a.docsPath,l=(f=e.getDocsUrl)==null?void 0:f.call(e,{...a,docsPath:u}),d=[o||"An error occurred.","",...a.metaMessages?[...a.metaMessages,""]:[],...l?[`Docs: ${l}`]:[],...c?[`Details: ${c}`]:[],...e.version?[`Version: ${e.version}`]:[]].join(`
272`);super(d,a.cause?{cause:a.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=c,this.docsPath=u,this.metaMessages=a.metaMessages,this.name=a.name??this.name,this.shortMessage=o,this.version=t.version}walk(o){return s(this,o)}}Cf.BaseError=n;function s(i,o){return o!=null&&o(i)?i:i&&typeof i=="object"&&"cause"in i&&i.cause!==void 0?s(i.cause,o):o?null:i}return Cf}var F5;function lr(){if(F5)return He;F5=1,Object.defineProperty(He,"__esModule",{value:!0}),He.UnsupportedPackedAbiType=He.InvalidDefinitionTypeError=He.InvalidArrayError=He.InvalidAbiDecodingTypeError=He.InvalidAbiEncodingTypeError=He.DecodeLogTopicsMismatch=He.DecodeLogDataMismatch=He.BytesSizeMismatchError=He.AbiItemAmbiguityError=He.AbiFunctionSignatureNotFoundError=He.AbiFunctionOutputsNotFoundError=He.AbiFunctionNotFoundError=He.AbiEventNotFoundError=He.AbiEventSignatureNotFoundError=He.AbiEventSignatureEmptyTopicsError=He.AbiErrorSignatureNotFoundError=He.AbiErrorNotFoundError=He.AbiErrorInputsNotFoundError=He.AbiEncodingLengthMismatchError=He.AbiEncodingBytesSizeMismatchError=He.AbiEncodingArrayLengthMismatchError=He.AbiDecodingZeroDataError=He.AbiDecodingDataSizeTooSmallError=He.AbiDecodingDataSizeInvalidError=He.AbiConstructorParamsNotFoundError=He.AbiConstructorNotFoundError=void 0;const t=fc(),e=Gs(),r=ut();
272class n extends r.BaseError{constructor({docsPath:B}){super(["A constructor was not found on the ABI.","Make sure you are using the correct ABI and that the constructor exists on it."].join(`
273`),{docsPath:B,name:"AbiConstructorNotFoundError"})}}He.AbiConstructorNotFoundError=n;class s extends r.BaseError{constructor({docsPath:B}){super(["Constructor arguments were provided (`args`), but a constructor parameters (`inputs`) were not found on the ABI.","Make sure you are using the correct ABI, and that the `inputs` attribute on the constructor exists."].join(`
274`),{docsPath:B,name:"AbiConstructorParamsNotFoundError"})}}He.AbiConstructorParamsNotFoundError=s;class i extends r.BaseError{constructor({data:B,size:A}){super([`Data size of ${A} bytes is invalid.`,"Size must be in increments of 32 bytes (size % 32 === 0)."].join(`
275`),{metaMessages:[`Data: ${B} (${A} bytes)`],name:"AbiDecodingDataSizeInvalidError"})}}He.AbiDecodingDataSizeInvalidError=i;class o extends r.BaseError{constructor({data:B,params:A,size:P}){super([`Data size of ${P} bytes is too small for given parameters.`].join(`
276`),{metaMessages:[`Params: (${(0,t.formatAbiParams)(A,{includeName:!0})})`,`Data:   ${B} (${P} bytes)`],name:"AbiDecodingDataSizeTooSmallError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"size",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=B,this.params=A,this.size=P}}He.AbiDecodingDataSizeTooSmallError=o;class a extends r.BaseError{constructor(){super('Cannot decode zero data ("0x") with ABI parameters.',{name:"AbiDecodingZeroDataError"})}}He.AbiDecodingZeroDataError=a;class c extends r.BaseError{constructor({expectedLength:B,givenLength:A,type:P}){super([`ABI encoding array length mismatch for type ${P}.`,`Expected length: ${B}`,`Given length: ${A}`].join(`
277`),{name:"AbiEncodingArrayLengthMismatchError"})}}He.AbiEncodingArrayLengthMismatchError=c;class u extends r.BaseError{constructor({expectedSize:B,value:A}){super(`Size of bytes "${A}" (bytes${(0,e.size)(A)}) does not match expected size (bytes${B}).`,{name:"AbiEncodingBytesSizeMismatchError"})}}He.AbiEncodingBytesSizeMismatchError=u;class l extends r.BaseError{constructor({expectedLength:B,givenLength:A}){super(["ABI encoding params/values length mismatch.",`Expected length (params): ${B}`,`Given length (values): ${A}`].join(`
278`),{name:"AbiEncodingLengthMismatchError"})}}He.AbiEncodingLengthMismatchError=l;class d extends r.BaseError{constructor(B,{docsPath:A}){super([`Arguments (\`args\`) were provided to "${B}", but "${B}" on the ABI does not contain any parameters (\`inputs\`).`,"Cannot encode error result without knowing what the parameter types are.","Make sure you are using the correct ABI and that the inputs exist on it."].join(`
279`),{docsPath:A,name:"AbiErrorInputsNotFoundError"})}}He.AbiErrorInputsNotFoundError=d;class f extends r.BaseError{constructor(B,{docsPath:A}={}){super([`Error ${B?`"${B}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the error exists on it."].join(`
280`),{docsPath:A,name:"AbiErrorNotFoundError"})}}He.AbiErrorNotFoundError=f;class g extends r.BaseError{constructor(B,{docsPath:A}){super([`Encoded error signature "${B}" not found on ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://openchain.xyz/signatures?query=${B}.`].join(`
281`),{docsPath:A,name:"AbiErrorSignatureNotFoundError"}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.signature=B}}He.AbiErrorSignatureNotFoundError=g;class h extends r.BaseError{constructor({docsPath:B}){super("Cannot extract event signature from empty topics.",{docsPath:B,name:"AbiEventSignatureEmptyTopicsError"})}}He.AbiEventSignatureEmptyTopicsError=h;class p extends r.BaseError{constructor(B,{docsPath:A}){super([`Encoded event signature "${B}" not found on ABI.`,"Make sure you are using the correct ABI and that the event exists on it.",`You can look up the signature here: https://openchain.xyz/signatures?query=${B}.`].join(`
282`),{docsPath:A,name:"AbiEventSignatureNotFoundError"})}}He.AbiEventSignatureNotFoundError=p;class y extends r.BaseError{constructor(B,{docsPath:A}={}){super([`Event ${B?`"${B}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the event exists on it."].join(`
283`),{docsPath:A,name:"AbiEventNotFoundError"})}}He.AbiEventNotFoundError=y;class w extends r.BaseError{constructor(B,{docsPath:A}={}){super([`Function ${B?`"${B}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the function exists on it."].join(`
284`),{docsPath:A,name:"AbiFunctionNotFoundError"})}}He.AbiFunctionNotFoundError=w;class I extends r.BaseError{constructor(B,{docsPath:A}){super([`Function "${B}" does not contain any \`outputs\` on ABI.`,"Cannot decode function result without knowing what the parameter types are.","Make sure you are using the correct ABI and that the function exists on it."].join(`
285`),{docsPath:A,name:"AbiFunctionOutputsNotFoundError"})}}He.AbiFunctionOutputsNotFoundError=I;class v extends r.BaseError{constructor(B,{docsPath:A}){super([`Encoded function signature "${B}" not found on ABI.`,"Make sure you are using the correct ABI and that the function exists on it.",`You can look up the signature here: https://openchain.xyz/signatures?query=${B}.`].join(`
286`),{docsPath:A,name:"AbiFunctionSignatureNotFoundError"})}}He.AbiFunctionSignatureNotFoundError=v;class E extends r.BaseError{constructor(B,A){super("Found ambiguous types in overloaded ABI items.",{metaMessages:[`\`${B.type}\` in \`${(0,t.formatAbiItem)(B.abiItem)}\`, and`,`\`${A.type}\` in \`${(0,t.formatAbiItem)(A.abiItem)}\``,"","These types encode differently and cannot be distinguished at runtime.","Remove one of the ambiguous items in the ABI."],name:"AbiItemAmbiguityError"})}}He.AbiItemAmbiguityError=E;class b extends r.BaseError{constructor({expectedSize:B,givenSize:A}){super(`Expected bytes${B}, got bytes${A}.`,{name:"BytesSizeMismatchError"})}}He.BytesSizeMismatchError=b;class m extends r.BaseError{constructor({abiItem:B,data:A,params:P,size:k}){super([`Data size of ${k} bytes is too small for non-indexed event parameters.`].join(`
287`),{metaMessages:[`Params: (${(0,t.formatAbiParams)(P,{includeName:!0})})`,`Data:   ${A} (${k} bytes)`],name:"DecodeLogDataMismatch"}),Object.defineProperty(this,"abiItem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"size",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abiItem=B,this.data=A,this.params=P,this.size=k}}He.DecodeLogDataMismatch=m;class _ extends r.BaseError{constructor({abiItem:B,param:A}){super([`Expected a topic for indexed event parameter${A.name?` "${A.name}"`:""} on event "${(0,t.formatAbiItem)(B,{includeName:!0})}".`].join(`
288`),{name:"DecodeLogTopicsMismatch"}),Object.defineProperty(this,"abiItem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abiItem=B}}He.DecodeLogTopicsMismatch=_;class O extends r.BaseError{constructor(B,{docsPath:A}){super([`Type "${B}" is not a valid encoding type.`,"Please provide a valid ABI type."].join(`
289`),{docsPath:A,name:"InvalidAbiEncodingType"})}}He.InvalidAbiEncodingTypeError=O;class C extends r.BaseError{constructor(B,{docsPath:A}){super([`Type "${B}" is not a valid decoding type.`,"Please provide a valid ABI type."].join(`
290`),{docsPath:A,name:"InvalidAbiDecodingType"})}}He.InvalidAbiDecodingTypeError=C;class S extends r.BaseError{constructor(B){super([`Value "${B}" is not a valid array.`].join(`
291`),{name:"InvalidArrayError"})}}He.InvalidArrayError=S;class T extends r.BaseError{constructor(B){super([`"${B}" is not a valid definition type.`,'Valid types: "function", "event", "error"'].join(`
292`),{name:"InvalidDefinitionTypeError"})}}He.InvalidDefinitionTypeError=T;class N extends r.BaseError{constructor(B){super(`Type "${B}" is not supported for packed encoding.`,{name:"UnsupportedPackedAbiType"})}}return He.UnsupportedPackedAbiType=N,He}var Ng={},H5;function gz(){if(H5)return Ng;
292H5=1,Object.defineProperty(Ng,"__esModule",{value:!0}),Ng.FilterTypeNotSupportedError=void 0;const t=ut();class e extends t.BaseError{constructor(n){super(`Filter type "${n}" is not supported.`,{name:"FilterTypeNotSupportedError"})}}return Ng.FilterTypeNotSupportedError=e,Ng}var Dc={},If={},da={},q5;function _C(){if(q5)return da;q5=1,Object.defineProperty(da,"__esModule",{value:!0}),da.InvalidBytesLengthError=da.SizeExceedsPaddingSizeError=da.SliceOffsetOutOfBoundsError=void 0;const t=ut();class e extends t.BaseError{constructor({offset:i,position:o,size:a}){super(`Slice ${o==="start"?"starting":"ending"} at offset "${i}" is out-of-bounds (size: ${a}).`,{name:"SliceOffsetOutOfBoundsError"})}}da.SliceOffsetOutOfBoundsError=e;class r extends t.BaseError{constructor({size:i,targetSize:o,type:a}){super(`${a.charAt(0).toUpperCase()}${a.slice(1).toLowerCase()} size (${i}) exceeds padding size (${o}).`,{name:"SizeExceedsPaddingSizeError"})}}da.SizeExceedsPaddingSizeError=r;class n extends t.BaseError{constructor({size:i,targetSize:o,type:a}){super(`${a.charAt(0).toUpperCase()}${a.slice(1).toLowerCase()} is expected to be ${o} ${a} long, but is ${i} ${a} long.`,{name:"InvalidBytesLengthError"})}}return da.InvalidBytesLengthError=n,da}var z5;function Fu(){if(z5)return If;z5=1,Object.defineProperty(If,"__esModule",{value:!0}),If.pad=e,If.padHex=r,If.padBytes=n;const t=_C();function e(s,{dir:i,size:o=32}={}){return typeof s=="string"?r(s,{dir:i,size:o}):n(s,{dir:i,size:o})}function r(s,{dir:i,size:o=32}={}){if(o===null)return s;const a=s.replace("0x","");if(a.length>o*2)throw new t.SizeExceedsPaddingSizeError({size:Math.ceil(a.length/2),targetSize:o,type:"hex"});return`0x${a[i==="right"?"padEnd":"padStart"](o*2,"0")}`}function n(s,{dir:i,size:o=32}={}){if(o===null)return s;if(s.length>o)throw new t.SizeExceedsPaddingSizeError({size:s.length,targetSize:o,type:"bytes"});const a=new Uint8Array(o);for(let c=0;c<o;c++){const u=i==="right";a[u?c:o-c-1]=s[u?c:s.length-c-1]}return a}return If}var fa={},Ns={},W5;function jp(){if(W5)return Ns;W5=1,Object.defineProperty(Ns,"__esModule",{value:!0}),Ns.SizeOverflowError=Ns.InvalidHexValueError=Ns.InvalidHexBooleanError=Ns.InvalidBytesBooleanError=Ns.IntegerOutOfRangeError=void 0;const t=ut();class e extends t.BaseError{constructor({max:a,min:c,signed:u,size:l,value:d}){super(`Number "${d}" is not in safe ${l?`${l*8}-bit ${u?"signed":"unsigned"} `:""}integer range ${a?`(${c} to ${a})`:`(above ${c})`}`,{name:"IntegerOutOfRangeError"})}}Ns.IntegerOutOfRangeError=e;class r extends t.BaseError{constructor(a){super(`Bytes value "${a}" is not a valid boolean. The bytes array must contain a single byte of either a 0 or 1 value.`,{name:"InvalidBytesBooleanError"})}}Ns.InvalidBytesBooleanError=r;class n extends t.BaseError{constructor(a){super(`Hex value "${a}" is not a valid boolean. The hex value must be "0x0" (false) or "0x1" (true).`,{name:"InvalidHexBooleanError"})}}Ns.InvalidHexBooleanError=n;class s extends t.BaseError{constructor(a){super(`Hex value "${a}" is an odd length (${a.length}). It must be an even length.`,{name:"InvalidHexValueError"})}}Ns.InvalidHexValueError=s;class i extends t.BaseError{constructor({givenSize:a,maxSize:c}){super(`Size cannot exceed ${c} bytes. Given size: ${a} bytes.`,{name:"SizeOverflowError"})}}return Ns.SizeOverflowError=i,Ns}var ow={},V5;function Hu(){if(V5)return ow;V5=1,Object.defineProperty(ow,"__esModule",{value:!0}),ow.trim=t;function t(e,{dir:r="left"}={}){let n=typeof e=="string"?e.replace("0x",""):e,s=0;for(let i=0;i<n.length-1&&n[r==="left"?i:n.length-i-1].toString()==="0";i++)s++;return n=r==="left"?n.slice(s):n.slice(0,n.length-s),typeof e=="string"?(n.length===1&&r==="right"&&(n=`${n}0`),`0x${n.length%2===1?`0${n}`:n}`):n}return ow}var G5;function Lr(){if(G5)return fa;G5=1,Object.defineProperty(fa,"__esModule",{value:!0}),fa.assertSize=s,fa.fromHex=i,fa.hexToBigInt=o,fa.hexToBool=a,fa.hexToNumber=c,fa.hexToString=u;const t=jp(),e=Gs(),r=Hu(),n=Yt();function s(l,{size:d}){if((0,e.size)(l)>d)throw new t.SizeOverflowError({givenSize:(0,e.size)(l),maxSize:d})}
292function i(l,d){const f=typeof d=="string"?{to:d}:d,g=f.to;return g==="number"?c(l,f):g==="bigint"?o(l,f):g==="string"?u(l,f):g==="boolean"?a(l,f):(0,n.hexToBytes)(l,f)}function o(l,d={}){const{signed:f}=d;d.size&&s(l,{size:d.size});const g=BigInt(l);if(!f)return g;const h=(l.length-2)/2,p=(1n<<BigInt(h)*8n-1n)-1n;return g<=p?g:g-BigInt(`0x${"f".padStart(h*2,"f")}`)-1n}function a(l,d={}){let f=l;if(d.size&&(s(f,{size:d.size}),f=(0,r.trim)(f)),(0,r.trim)(f)==="0x00")return!1;if((0,r.trim)(f)==="0x01")return!0;throw new t.InvalidHexBooleanError(f)}function c(l,d={}){return Number(o(l,d))}function u(l,d={}){let f=(0,n.hexToBytes)(l);return d.size&&(s(f,{size:d.size}),f=(0,r.trim)(f,{dir:"right"})),new TextDecoder().decode(f)}return fa}var Uc={},K5;function Be(){if(K5)return Uc;K5=1,Object.defineProperty(Uc,"__esModule",{value:!0}),Uc.toHex=s,Uc.boolToHex=i,Uc.bytesToHex=o,Uc.numberToHex=a,Uc.stringToHex=u;const t=jp(),e=Fu(),r=Lr(),n=Array.from({length:256},(l,d)=>d.toString(16).padStart(2,"0"));function s(l,d={}){return typeof l=="number"||typeof l=="bigint"?a(l,d):typeof l=="string"?u(l,d):typeof l=="boolean"?i(l,d):o(l,d)}function i(l,d={}){const f=`0x${Number(l)}`;return typeof d.size=="number"?((0,r.assertSize)(f,{size:d.size}),(0,e.pad)(f,{size:d.size})):f}function o(l,d={}){let f="";for(let h=0;h<l.length;h++)f+=n[l[h]];const g=`0x${f}`;return typeof d.size=="number"?((0,r.assertSize)(g,{size:d.size}),(0,e.pad)(g,{dir:"right",size:d.size})):g}function a(l,d={}){const{signed:f,size:g}=d,h=BigInt(l);let p;g?f?p=(1n<<BigInt(g)*8n-1n)-1n:p=2n**(BigInt(g)*8n)-1n:typeof l=="number"&&(p=BigInt(Number.MAX_SAFE_INTEGER));const y=typeof p=="bigint"&&f?-p-1n:0;if(p&&h>p||h<y){const I=typeof l=="bigint"?"n":"";throw new t.IntegerOutOfRangeError({max:p?`${p}${I}`:void 0,min:`${y}${I}`,signed:f,size:g,value:`${l}${I}`})}const w=`0x${(f&&h<0?(1n<<BigInt(g*8))+BigInt(h):h).toString(16)}`;return g?(0,e.pad)(w,{size:g}):w}const c=new TextEncoder;function u(l,d={}){const f=c.encode(l);return o(f,d)}return Uc}var Z5;function Yt(){if(Z5)return Dc;Z5=1,Object.defineProperty(Dc,"__esModule",{value:!0}),Dc.toBytes=o,Dc.boolToBytes=a,Dc.hexToBytes=l,Dc.numberToBytes=d,Dc.stringToBytes=f;const t=ut(),e=Qn(),r=Fu(),n=Lr(),s=Be(),i=new TextEncoder;function o(g,h={}){return typeof g=="number"||typeof g=="bigint"?d(g,h):typeof g=="boolean"?a(g,h):(0,e.isHex)(g)?l(g,h):f(g,h)}function a(g,h={}){const p=new Uint8Array(1);return p[0]=Number(g),typeof h.size=="number"?((0,n.assertSize)(p,{size:h.size}),(0,r.pad)(p,{size:h.size})):p}const c={zero:48,nine:57,A:65,F:70,a:97,f:102};function u(g){if(g>=c.zero&&g<=c.nine)return g-c.zero;if(g>=c.A&&g<=c.F)return g-(c.A-10);if(g>=c.a&&g<=c.f)return g-(c.a-10)}function l(g,h={}){let p=g;h.size&&((0,n.assertSize)(p,{size:h.size}),p=(0,r.pad)(p,{dir:"right",size:h.size}));let y=p.slice(2);y.length%2&&(y=`0${y}`);const w=y.length/2,I=new Uint8Array(w);for(let v=0,E=0;v<w;v++){const b=u(y.charCodeAt(E++)),m=u(y.charCodeAt(E++));if(b===void 0||m===void 0)throw new t.BaseError(`Invalid byte sequence ("${y[E-2]}${y[E-1]}" in "${y}").`);I[v]=b*16+m}return I}function d(g,h){const p=(0,s.numberToHex)(g,h);return l(p)}function f(g,h={}){const p=i.encode(g);return typeof h.size=="number"?((0,n.assertSize)(p,{size:h.size}),(0,r.pad)(p,{dir:"right",size:h.size})):p}return Dc}var aw={},Kt={},Mc={},Y5;function AC(){if(Y5)return Mc;Y5=1,Object.defineProperty(Mc,"__esModule",{value:!0}),Mc.anumber=t,Mc.abytes=r,Mc.ahash=n,Mc.aexists=s,Mc.aoutput=i;function t(o){if(!Number.isSafeInteger(o)||o<0)throw new Error("positive integer expected, got "+o)}function e(o){return o instanceof Uint8Array||ArrayBuffer.isView(o)&&o.constructor.name==="Uint8Array"}function r(o,...a){if(!e(o))throw new Error("Uint8Array expected");if(a.length>0&&!a.includes(o.length))throw new Error("Uint8Array expected of length "+a+", got length="+o.length)}function n(o){if(typeof o!="function"||typeof o.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");t(o.outputLen),t(o.blockLen)}function s(o,a=!0){if(o.destroyed)throw new Error("Hash instance has been destroyed");if(a&&o.finished)throw new Error("Hash#digest() has already been called")}function i(o,a){r(o);const c=a.outputLen;if(o.length<c)throw new Error("digestInto() expects output buffer of length at least "+c)}return Mc}var Ye={},J5;function xve(){if(J5)return Ye;
292J5=1,Object.defineProperty(Ye,"__esModule",{value:!0}),Ye.add5L=Ye.add5H=Ye.add4H=Ye.add4L=Ye.add3H=Ye.add3L=Ye.rotlBL=Ye.rotlBH=Ye.rotlSL=Ye.rotlSH=Ye.rotr32L=Ye.rotr32H=Ye.rotrBL=Ye.rotrBH=Ye.rotrSL=Ye.rotrSH=Ye.shrSL=Ye.shrSH=Ye.toBig=void 0,Ye.fromBig=r,Ye.split=n,Ye.add=w;const t=BigInt(2**32-1),e=BigInt(32);function r(C,S=!1){return S?{h:Number(C&t),l:Number(C>>e&t)}:{h:Number(C>>e&t)|0,l:Number(C&t)|0}}function n(C,S=!1){let T=new Uint32Array(C.length),N=new Uint32Array(C.length);for(let R=0;R<C.length;R++){const{h:B,l:A}=r(C[R],S);[T[R],N[R]]=[B,A]}return[T,N]}const s=(C,S)=>BigInt(C>>>0)<<e|BigInt(S>>>0);Ye.toBig=s;const i=(C,S,T)=>C>>>T;Ye.shrSH=i;const o=(C,S,T)=>C<<32-T|S>>>T;Ye.shrSL=o;const a=(C,S,T)=>C>>>T|S<<32-T;Ye.rotrSH=a;const c=(C,S,T)=>C<<32-T|S>>>T;Ye.rotrSL=c;const u=(C,S,T)=>C<<64-T|S>>>T-32;Ye.rotrBH=u;const l=(C,S,T)=>C>>>T-32|S<<64-T;Ye.rotrBL=l;const d=(C,S)=>S;Ye.rotr32H=d;const f=(C,S)=>C;Ye.rotr32L=f;const g=(C,S,T)=>C<<T|S>>>32-T;Ye.rotlSH=g;const h=(C,S,T)=>S<<T|C>>>32-T;Ye.rotlSL=h;const p=(C,S,T)=>S<<T-32|C>>>64-T;Ye.rotlBH=p;const y=(C,S,T)=>C<<T-32|S>>>64-T;Ye.rotlBL=y;function w(C,S,T,N){const R=(S>>>0)+(N>>>0);return{h:C+T+(R/2**32|0)|0,l:R|0}}const I=(C,S,T)=>(C>>>0)+(S>>>0)+(T>>>0);Ye.add3L=I;const v=(C,S,T,N)=>S+T+N+(C/2**32|0)|0;Ye.add3H=v;const E=(C,S,T,N)=>(C>>>0)+(S>>>0)+(T>>>0)+(N>>>0);Ye.add4L=E;const b=(C,S,T,N,R)=>S+T+N+R+(C/2**32|0)|0;Ye.add4H=b;const m=(C,S,T,N,R)=>(C>>>0)+(S>>>0)+(T>>>0)+(N>>>0)+(R>>>0);Ye.add5L=m;const _=(C,S,T,N,R,B)=>S+T+N+R+B+(C/2**32|0)|0;Ye.add5H=_;const O={fromBig:r,split:n,toBig:s,shrSH:i,shrSL:o,rotrSH:a,rotrSL:c,rotrBH:u,rotrBL:l,rotr32H:d,rotr32L:f,rotlSH:g,rotlSL:h,rotlBH:p,rotlBL:y,add:w,add3L:I,add3H:v,add4L:E,add4H:b,add5H:_,add5L:m};return Ye.default=O,Ye}var gS={},xg={},Q5;function Rve(){return Q5||(Q5=1,Object.defineProperty(xg,"__esModule",{value:!0}),xg.crypto=void 0,xg.crypto=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0),xg}var X5;function Xd(){return X5||(X5=1,function(t){/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */Object.defineProperty(t,"__esModule",{value:!0}),t.Hash=t.nextTick=t.byteSwapIfBE=t.isLE=void 0,t.isBytes=n,t.u8=s,t.u32=i,t.createView=o,t.rotr=a,t.rotl=c,t.byteSwap=u,t.byteSwap32=l,t.bytesToHex=f,t.hexToBytes=p,t.asyncLoop=w,t.utf8ToBytes=I,t.toBytes=v,t.concatBytes=E,t.checkOpts=m,t.wrapConstructor=_,t.wrapConstructorWithOpts=O,t.wrapXOFConstructorWithOpts=C,t.randomBytes=S;const e=Rve(),r=AC();function n(T){return T instanceof Uint8Array||ArrayBuffer.isView(T)&&T.constructor.name==="Uint8Array"}function s(T){return new Uint8Array(T.buffer,T.byteOffset,T.byteLength)}function i(T){return new Uint32Array(T.buffer,T.byteOffset,Math.floor(T.byteLength/4))}function o(T){return new DataView(T.buffer,T.byteOffset,T.byteLength)}function a(T,N){return T<<32-N|T>>>N}function c(T,N){return T<<N|T>>>32-N>>>0}t.isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function u(T){return T<<24&4278190080|T<<8&16711680|T>>>8&65280|T>>>24&255}t.byteSwapIfBE=t.isLE?T=>T:T=>u(T);function l(T){for(let N=0;N<T.length;N++)T[N]=u(T[N])}const d=Array.from({length:256},(T,N)=>N.toString(16).padStart(2,"0"));function f(T){(0,r.abytes)(T);let N="";for(let R=0;R<T.length;R++)N+=d[T[R]];return N}const g={_0:48,_9:57,A:65,F:70,a:97,f:102};function h(T){if(T>=g._0&&T<=g._9)return T-g._0;if(T>=g.A&&T<=g.F)return T-(g.A-10);if(T>=g.a&&T<=g.f)return T-(g.a-10)}function p(T){if(typeof T!="string")throw new Error("hex string expected, got "+typeof T);const N=T.length,R=N/2;if(N%2)throw new Error("hex string expected, got unpadded hex of length "+N);const B=new Uint8Array(R);for(let A=0,P=0;A<R;A++,P+=2){const k=h(T.charCodeAt(P)),U=h(T.charCodeAt(P+1));if(k===void 0||U===void 0){const x=T[P]+T[P+1];throw new Error('hex string expected, got non-hex character "'+x+'" at index '+P)}B[A]=k*16+U}return B}const y=async()=>{};t.nextTick=y;async function w(T,N,R){let B=Date.now();for(let A=0;A<T;A++){R(A);const P=Date.now()-B;P>=0&&P<N||(await(0,t.nextTick)(),B+=P)}}function I(T){if(typeof T!="string")throw new Error("utf8ToBytes expected string, got "+typeof T);return new Uint8Array(new TextEncoder().encode(T))}function v(T){return typeof T=="string"&&(T=I(T)),(0,r.abytes)(T),T}function E(...T){let N=0;for(let B=0;B<T.length;B++){const A=T[B];(0,r.abytes)(A),N+=A.length}const R=new Uint8Array(N);for(let B=0,A=0;B<T.length;B++){const P=T[B];R.set(P,A),A+=P.length}return R}class b{clone(){return this._cloneInto()}}t.Hash=b;function m(T,N){if(N!==void 0&&{}.toString.call(N)!=="[object Object]")throw new Error("Options should be object or undefined");return Object.assign(T,N)}function _(T){const N=B=>T().update(v(B)).digest(),R=T();return N.outputLen=R.outputLen,N.blockLen=R.blockLen,N.create=()=>T(),N}function O(T){const N=(B,A)=>T(A).update(v(B)).digest(),R=T({});return N.outputLen=R.outputLen,N.blockLen=R.blockLen,N.create=B=>T(B),N}function C(T){const N=(B,A)=>T(A).update(v(B)).digest(),R=T({});return N.outputLen=R.outputLen,N.blockLen=R.blockLen,N.create=B=>T(B),N}function S(T=32){if(e.crypto&&typeof e.crypto.getRandomValues=="function")return e.crypto.getRandomValues(new Uint8Array(T));if(e.crypto&&typeof e.crypto.randomBytes=="function")return e.crypto.randomBytes(T);throw new Error("crypto.getRandomValues must be defined")}}(gS)),gS}var ej;function Bve(){if(ej)return Kt;
292ej=1,Object.defineProperty(Kt,"__esModule",{value:!0}),Kt.shake256=Kt.shake128=Kt.keccak_512=Kt.keccak_384=Kt.keccak_256=Kt.keccak_224=Kt.sha3_512=Kt.sha3_384=Kt.sha3_256=Kt.sha3_224=Kt.Keccak=void 0,Kt.keccakP=y;const t=AC(),e=xve(),r=Xd(),n=[],s=[],i=[],o=BigInt(0),a=BigInt(1),c=BigInt(2),u=BigInt(7),l=BigInt(256),d=BigInt(113);for(let E=0,b=a,m=1,_=0;E<24;E++){[m,_]=[_,(2*m+3*_)%5],n.push(2*(5*_+m)),s.push((E+1)*(E+2)/2%64);let O=o;for(let C=0;C<7;C++)b=(b<<a^(b>>u)*d)%l,b&c&&(O^=a<<(a<<BigInt(C))-a);i.push(O)}const[f,g]=(0,e.split)(i,!0),h=(E,b,m)=>m>32?(0,e.rotlBH)(E,b,m):(0,e.rotlSH)(E,b,m),p=(E,b,m)=>m>32?(0,e.rotlBL)(E,b,m):(0,e.rotlSL)(E,b,m);function y(E,b=24){const m=new Uint32Array(10);for(let _=24-b;_<24;_++){for(let S=0;S<10;S++)m[S]=E[S]^E[S+10]^E[S+20]^E[S+30]^E[S+40];for(let S=0;S<10;S+=2){const T=(S+8)%10,N=(S+2)%10,R=m[N],B=m[N+1],A=h(R,B,1)^m[T],P=p(R,B,1)^m[T+1];for(let k=0;k<50;k+=10)E[S+k]^=A,E[S+k+1]^=P}let O=E[2],C=E[3];for(let S=0;S<24;S++){const T=s[S],N=h(O,C,T),R=p(O,C,T),B=n[S];O=E[B],C=E[B+1],E[B]=N,E[B+1]=R}for(let S=0;S<50;S+=10){for(let T=0;T<10;T++)m[T]=E[S+T];for(let T=0;T<10;T++)E[S+T]^=~m[(T+2)%10]&m[(T+4)%10]}E[0]^=f[_],E[1]^=g[_]}m.fill(0)}class w extends r.Hash{constructor(b,m,_,O=!1,C=24){if(super(),this.blockLen=b,this.suffix=m,this.outputLen=_,this.enableXOF=O,this.rounds=C,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,(0,t.anumber)(_),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=(0,r.u32)(this.state)}keccak(){r.isLE||(0,r.byteSwap32)(this.state32),y(this.state32,this.rounds),r.isLE||(0,r.byteSwap32)(this.state32),this.posOut=0,this.pos=0}update(b){(0,t.aexists)(this);const{blockLen:m,state:_}=this;b=(0,r.toBytes)(b);const O=b.length;for(let C=0;C<O;){const S=Math.min(m-this.pos,O-C);for(let T=0;T<S;T++)_[this.pos++]^=b[C++];this.pos===m&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:b,suffix:m,pos:_,blockLen:O}=this;b[_]^=m,(m&128)!==0&&_===O-1&&this.keccak(),b[O-1]^=128,this.keccak()}writeInto(b){(0,t.aexists)(this,!1),(0,t.abytes)(b),this.finish();const m=this.state,{blockLen:_}=this;for(let O=0,C=b.length;O<C;){this.posOut>=_&&this.keccak();const S=Math.min(_-this.posOut,C-O);b.set(m.subarray(this.posOut,this.posOut+S),O),this.posOut+=S,O+=S}return b}xofInto(b){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(b)}xof(b){return(0,t.anumber)(b),this.xofInto(new Uint8Array(b))}digestInto(b){if((0,t.aoutput)(b,this),this.finished)throw new Error("digest() was already called");return this.writeInto(b),this.destroy(),b}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(b){const{blockLen:m,suffix:_,outputLen:O,rounds:C,enableXOF:S}=this;return b||(b=new w(m,_,O,S,C)),b.state32.set(this.state32),b.pos=this.pos,b.posOut=this.posOut,b.finished=this.finished,b.rounds=C,b.suffix=_,b.outputLen=O,b.enableXOF=S,b.destroyed=this.destroyed,b}}Kt.Keccak=w;const I=(E,b,m)=>(0,r.wrapConstructor)(()=>new w(b,E,m));Kt.sha3_224=I(6,144,224/8),Kt.sha3_256=I(6,136,256/8),Kt.sha3_384=I(6,104,384/8),Kt.sha3_512=I(6,72,512/8),Kt.keccak_224=I(1,144,224/8),Kt.keccak_256=I(1,136,256/8),Kt.keccak_384=I(1,104,384/8),Kt.keccak_512=I(1,72,512/8);const v=(E,b,m)=>(0,r.wrapXOFConstructorWithOpts)((_={})=>new w(b,E,_.dkLen===void 0?m:_.dkLen,!0));return Kt.shake128=v(31,168,128/8),Kt.shake256=v(31,136,256/8),Kt}var tj;function Is(){if(tj)return aw;tj=1,Object.defineProperty(aw,"__esModule",{value:!0}),aw.keccak256=s;const t=Bve(),e=Qn(),r=Yt(),n=Be();function s(i,o){const a=o||"hex",c=(0,t.keccak_256)((0,e.isHex)(i,{strict:!1})?(0,r.toBytes)(i):i);return a==="bytes"?c:(0,n.toHex)(c)}return aw}var Rg={},cw={},uw={},rj;function kve(){if(rj)return uw;rj=1,Object.defineProperty(uw,"__esModule",{value:!0}),uw.hashSignature=n;const t=Yt(),e=Is(),r=s=>(0,e.keccak256)((0,t.toBytes)(s));function n(s){return r(s)}return uw}var Bg={},lw={},nj;function jve(){if(nj)return lw;nj=1,Object.defineProperty(lw,"__esModule",{value:!0}),lw.normalizeSignature=e;const t=ut();function e(r){let n=!0,s="",i=0,o="",a=!1;for(let c=0;c<r.length;c++){const u=r[c];if(["(",")",","].includes(u)&&(n=!0),u==="("&&i++,u===")"&&i--,!!n){
292if(i===0){if(u===" "&&["event","function",""].includes(o))o="";else if(o+=u,u===")"){a=!0;break}continue}if(u===" "){r[c-1]!==","&&s!==","&&s!==",("&&(s="",n=!1);continue}o+=u,s+=u}}if(!a)throw new t.BaseError("Unable to normalize signature.");return o}return lw}var sj;function cN(){if(sj)return Bg;sj=1,Object.defineProperty(Bg,"__esModule",{value:!0}),Bg.toSignature=void 0;const t=vC(),e=jve(),r=n=>{const s=typeof n=="string"?n:(0,t.formatAbiItem)(n);return(0,e.normalizeSignature)(s)};return Bg.toSignature=r,Bg}var ij;function CC(){if(ij)return cw;ij=1,Object.defineProperty(cw,"__esModule",{value:!0}),cw.toSignatureHash=r;const t=kve(),e=cN();function r(n){return(0,t.hashSignature)((0,e.toSignature)(n))}return cw}var oj;function Dp(){if(oj)return Rg;oj=1,Object.defineProperty(Rg,"__esModule",{value:!0}),Rg.toEventSelector=void 0;const t=CC();return Rg.toEventSelector=t.toSignatureHash,Rg}var kg={},jg={},aj;function eo(){if(aj)return jg;aj=1,Object.defineProperty(jg,"__esModule",{value:!0}),jg.InvalidAddressError=void 0;const t=ut();class e extends t.BaseError{constructor({address:n}){super(`Address "${n}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}}return jg.InvalidAddressError=e,jg}var mS={},Dg={},cj;function x0(){if(cj)return Dg;cj=1,Object.defineProperty(Dg,"__esModule",{value:!0}),Dg.LruMap=void 0;class t extends Map{constructor(r){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=r}get(r){const n=super.get(r);return super.has(r)&&n!==void 0&&(this.delete(r),super.set(r,n)),n}set(r,n){if(super.set(r,n),this.maxSize&&this.size>this.maxSize){const s=this.keys().next().value;s&&this.delete(s)}return this}}return Dg.LruMap=t,Dg}var Ug={},uj;function mi(){if(uj)return Ug;uj=1,Object.defineProperty(Ug,"__esModule",{value:!0}),Ug.checksumAddress=o,Ug.getAddress=a;const t=eo(),e=Yt(),r=Is(),n=x0(),s=Ks(),i=new n.LruMap(8192);function o(c,u){if(i.has(`${c}.${u}`))return i.get(`${c}.${u}`);const l=u?`${u}${c.toLowerCase()}`:c.substring(2).toLowerCase(),d=(0,r.keccak256)((0,e.stringToBytes)(l),"bytes"),f=(u?l.substring(`${u}0x`.length):l).split("");for(let h=0;h<40;h+=2)d[h>>1]>>4>=8&&f[h]&&(f[h]=f[h].toUpperCase()),(d[h>>1]&15)>=8&&f[h+1]&&(f[h+1]=f[h+1].toUpperCase());const g=`0x${f.join("")}`;return i.set(`${c}.${u}`,g),g}function a(c,u){if(!(0,s.isAddress)(c,{strict:!1}))throw new t.InvalidAddressError({address:c});return o(c,u)}return Ug}var lj;function Ks(){return lj||(lj=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.isAddressCache=void 0,t.isAddress=s;const e=x0(),r=mi(),n=/^0x[a-fA-F0-9]{40}$/;t.isAddressCache=new e.LruMap(8192);function s(i,o){const{strict:a=!0}=o??{},c=`${i}.${a}`;if(t.isAddressCache.has(c))return t.isAddressCache.get(c);const u=n.test(i)?i.toLowerCase()===i?!0:a?(0,r.checksumAddress)(i)===i:!0:!1;return t.isAddressCache.set(c,u),u}}(mS)),mS}var Sf={},dj;function Xn(){if(dj)return Sf;dj=1,Object.defineProperty(Sf,"__esModule",{value:!0}),Sf.concat=t,Sf.concatBytes=e,Sf.concatHex=r;function t(n){return typeof n[0]=="string"?r(n):e(n)}function e(n){let s=0;for(const a of n)s+=a.length;const i=new Uint8Array(s);let o=0;for(const a of n)i.set(a,o),o+=a.length;return i}function r(n){return`0x${n.reduce((s,i)=>s+i.replace("0x",""),"")}`}return Sf}var Tf={},fj;function to(){if(fj)return Tf;fj=1,Object.defineProperty(Tf,"__esModule",{value:!0}),Tf.slice=n,Tf.sliceBytes=o,Tf.sliceHex=a;const t=_C(),e=Qn(),r=Gs();function n(c,u,l,{strict:d}={}){return(0,e.isHex)(c,{strict:!1})?a(c,u,l,{strict:d}):o(c,u,l,{strict:d})}function s(c,u){if(typeof u=="number"&&u>0&&u>(0,r.size)(c)-1)throw new t.SliceOffsetOutOfBoundsError({offset:u,position:"start",size:(0,r.size)(c)})}function i(c,u,l){if(typeof u=="number"&&typeof l=="number"&&(0,r.size)(c)!==l-u)throw new t.SliceOffsetOutOfBoundsError({offset:l,position:"end",size:(0,r.size)(c)})}function o(c,u,l,{strict:d}={}){s(c,u);const f=c.slice(u,l);return d&&i(f,u,l),f}function a(c,u,l,{strict:d}={}){s(c,u);const f=`0x${c.replace("0x","").slice((u??0)*2,(l??c.length)*2)}`;return d&&i(f,u,l),f}return Tf}var ha={},hj;function IC(){return hj||(hj=1,Object.defineProperty(ha,"__esModule",{value:!0}),ha.integerRegex=ha.bytesRegex=ha.arrayRegex=void 0,ha.arrayRegex=/^(.*)\[([0-9]*)\]$/,ha.bytesRegex=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,ha.integerRegex=/^(u?int)(8|
29216|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/),ha}var pj;function ro(){if(pj)return kg;pj=1,Object.defineProperty(kg,"__esModule",{value:!0}),kg.encodeAbiParameters=d,kg.getArrayComponents=m;const t=lr(),e=eo(),r=ut(),n=jp(),s=Ks(),i=Xn(),o=Fu(),a=Gs(),c=to(),u=Be(),l=IC();function d(_,O){if(_.length!==O.length)throw new t.AbiEncodingLengthMismatchError({expectedLength:_.length,givenLength:O.length});const C=f({params:_,values:O}),S=h(C);return S.length===0?"0x":S}function f({params:_,values:O}){const C=[];for(let S=0;S<_.length;S++)C.push(g({param:_[S],value:O[S]}));return C}function g({param:_,value:O}){const C=m(_.type);if(C){const[S,T]=C;return y(O,{length:S,param:{..._,type:T}})}if(_.type==="tuple")return b(O,{param:_});if(_.type==="address")return p(O);if(_.type==="bool")return I(O);if(_.type.startsWith("uint")||_.type.startsWith("int")){const S=_.type.startsWith("int"),[,,T="256"]=l.integerRegex.exec(_.type)??[];return v(O,{signed:S,size:Number(T)})}if(_.type.startsWith("bytes"))return w(O,{param:_});if(_.type==="string")return E(O);throw new t.InvalidAbiEncodingTypeError(_.type,{docsPath:"/docs/contract/encodeAbiParameters"})}function h(_){let O=0;for(let N=0;N<_.length;N++){const{dynamic:R,encoded:B}=_[N];R?O+=32:O+=(0,a.size)(B)}const C=[],S=[];let T=0;for(let N=0;N<_.length;N++){const{dynamic:R,encoded:B}=_[N];R?(C.push((0,u.numberToHex)(O+T,{size:32})),S.push(B),T+=(0,a.size)(B)):C.push(B)}return(0,i.concat)([...C,...S])}function p(_){if(!(0,s.isAddress)(_))throw new e.InvalidAddressError({address:_});return{dynamic:!1,encoded:(0,o.padHex)(_.toLowerCase())}}function y(_,{length:O,param:C}){const S=O===null;if(!Array.isArray(_))throw new t.InvalidArrayError(_);if(!S&&_.length!==O)throw new t.AbiEncodingArrayLengthMismatchError({expectedLength:O,givenLength:_.length,type:`${C.type}[${O}]`});let T=!1;const N=[];for(let R=0;R<_.length;R++){const B=g({param:C,value:_[R]});B.dynamic&&(T=!0),N.push(B)}if(S||T){const R=h(N);if(S){const B=(0,u.numberToHex)(N.length,{size:32});return{dynamic:!0,encoded:N.length>0?(0,i.concat)([B,R]):B}}if(T)return{dynamic:!0,encoded:R}}return{dynamic:!1,encoded:(0,i.concat)(N.map(({encoded:R})=>R))}}function w(_,{param:O}){const[,C]=O.type.split("bytes"),S=(0,a.size)(_);if(!C){let T=_;return S%32!==0&&(T=(0,o.padHex)(T,{dir:"right",size:Math.ceil((_.length-2)/2/32)*32})),{dynamic:!0,encoded:(0,i.concat)([(0,o.padHex)((0,u.numberToHex)(S,{size:32})),T])}}if(S!==Number.parseInt(C))throw new t.AbiEncodingBytesSizeMismatchError({expectedSize:Number.parseInt(C),value:_});return{dynamic:!1,encoded:(0,o.padHex)(_,{dir:"right"})}}function I(_){if(typeof _!="boolean")throw new r.BaseError(`Invalid boolean value: "${_}" (type: ${typeof _}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:(0,o.padHex)((0,u.boolToHex)(_))}}function v(_,{signed:O,size:C=256}){if(typeof C=="number"){const S=2n**(BigInt(C)-(O?1n:0n))-1n,T=O?-S-1n:0n;if(_>S||_<T)throw new n.IntegerOutOfRangeError({max:S.toString(),min:T.toString(),signed:O,size:C/8,value:_.toString()})}return{dynamic:!1,encoded:(0,u.numberToHex)(_,{size:32,signed:O})}}function E(_){const O=(0,u.stringToHex)(_),C=Math.ceil((0,a.size)(O)/32),S=[];for(let T=0;T<C;T++)S.push((0,o.padHex)((0,c.slice)(O,T*32,(T+1)*32),{dir:"right"}));return{dynamic:!0,encoded:(0,i.concat)([(0,o.padHex)((0,u.numberToHex)((0,a.size)(O),{size:32})),...S])}}function b(_,{param:O}){let C=!1;const S=[];for(let T=0;T<O.components.length;T++){const N=O.components[T],R=Array.isArray(_)?T:N.name,B=g({param:N,value:_[R]});S.push(B),B.dynamic&&(C=!0)}return{dynamic:C,encoded:C?h(S):(0,i.concat)(S.map(({encoded:T})=>T))}}function m(_){const O=_.match(/^(.*)\[(\d+)?\]$/);return O?[O[2]?Number(O[2]):null,O[1]]:void 0}return kg}var Pf={},Mg={},gj;function ef(){if(gj)return Mg;gj=1,Object.defineProperty(Mg,"__esModule",{value:!0}),Mg.toFunctionSelector=void 0;const t=to(),e=CC(),r=n=>(0,t.slice)((0,e.toSignatureHash)(n),0,4);return Mg.toFunctionSelector=r,Mg}var mj;function hc(){if(mj)return Pf;
292mj=1,Object.defineProperty(Pf,"__esModule",{value:!0}),Pf.getAbiItem=i,Pf.isArgOfType=o,Pf.getAmbiguousTypes=a;const t=lr(),e=Qn(),r=Ks(),n=Dp(),s=ef();function i(c){const{abi:u,args:l=[],name:d}=c,f=(0,e.isHex)(d,{strict:!1}),g=u.filter(p=>f?p.type==="function"?(0,s.toFunctionSelector)(p)===d:p.type==="event"?(0,n.toEventSelector)(p)===d:!1:"name"in p&&p.name===d);if(g.length===0)return;if(g.length===1)return g[0];let h;for(const p of g){if(!("inputs"in p))continue;if(!l||l.length===0){if(!p.inputs||p.inputs.length===0)return p;continue}if(!p.inputs||p.inputs.length===0||p.inputs.length!==l.length)continue;if(l.every((w,I)=>{const v="inputs"in p&&p.inputs[I];return v?o(w,v):!1})){if(h&&"inputs"in h&&h.inputs){const w=a(p.inputs,h.inputs,l);if(w)throw new t.AbiItemAmbiguityError({abiItem:p,type:w[0]},{abiItem:h,type:w[1]})}h=p}}return h||g[0]}function o(c,u){const l=typeof c,d=u.type;switch(d){case"address":return(0,r.isAddress)(c,{strict:!1});case"bool":return l==="boolean";case"function":return l==="string";case"string":return l==="string";default:return d==="tuple"&&"components"in u?Object.values(u.components).every((f,g)=>o(Object.values(c)[g],f)):/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(d)?l==="number"||l==="bigint":/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(d)?l==="string"||c instanceof Uint8Array:/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(d)?Array.isArray(c)&&c.every(f=>o(f,{...u,type:d.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function a(c,u,l){for(const d in c){const f=c[d],g=u[d];if(f.type==="tuple"&&g.type==="tuple"&&"components"in f&&"components"in g)return a(f.components,g.components,l[d]);const h=[f.type,g.type];if(h.includes("address")&&h.includes("bytes20")?!0:h.includes("address")&&h.includes("string")?(0,r.isAddress)(l[d],{strict:!1}):h.includes("address")&&h.includes("bytes")?(0,r.isAddress)(l[d],{strict:!1}):!1)return h}}return Pf}var yj;function tf(){if(yj)return nw;yj=1,Object.defineProperty(nw,"__esModule",{value:!0}),nw.encodeEventTopics=u;const t=lr(),e=gz(),r=Yt(),n=Is(),s=Dp(),i=ro(),o=fc(),a=hc(),c="/docs/contract/encodeEventTopics";function u(d){var v;const{abi:f,eventName:g,args:h}=d;let p=f[0];if(g){const E=(0,a.getAbiItem)({abi:f,name:g});if(!E)throw new t.AbiEventNotFoundError(g,{docsPath:c});p=E}if(p.type!=="event")throw new t.AbiEventNotFoundError(void 0,{docsPath:c});const y=(0,o.formatAbiItem)(p),w=(0,s.toEventSelector)(y);let I=[];if(h&&"inputs"in p){const E=(v=p.inputs)==null?void 0:v.filter(m=>"indexed"in m&&m.indexed),b=Array.isArray(h)?h:Object.values(h).length>0?(E==null?void 0:E.map(m=>h[m.name]))??[]:[];b.length>0&&(I=(E==null?void 0:E.map((m,_)=>Array.isArray(b[_])?b[_].map((O,C)=>l({param:m,value:b[_][C]})):typeof b[_]<"u"&&b[_]!==null?l({param:m,value:b[_]}):null))??[])}return[w,...I]}function l({param:d,value:f}){if(d.type==="string"||d.type==="bytes")return(0,n.keccak256)((0,r.toBytes)(f));if(d.type==="tuple"||d.type.match(/^(.*)\[(\d+)?\]$/))throw new e.FilterTypeNotSupportedError(d.type);return(0,i.encodeAbiParameters)([d],[f])}return nw}var dw={},bj;function SC(){if(bj)return dw;
292bj=1,Object.defineProperty(dw,"__esModule",{value:!0}),dw.createFilterRequestScope=t;function t(e,{method:r}){var s,i;const n={};return e.transport.type==="fallback"&&((i=(s=e.transport).onResponse)==null||i.call(s,({method:o,response:a,status:c,transport:u})=>{c==="success"&&r===o&&(n[a]=u.request)})),o=>n[o]||e.request}return dw}var wj;function uN(){if(wj)return rw;wj=1,Object.defineProperty(rw,"__esModule",{value:!0}),rw.createContractEventFilter=n;const t=tf(),e=Be(),r=SC();async function n(s,i){const{address:o,abi:a,args:c,eventName:u,fromBlock:l,strict:d,toBlock:f}=i,g=(0,r.createFilterRequestScope)(s,{method:"eth_newFilter"}),h=u?(0,t.encodeEventTopics)({abi:a,args:c,eventName:u}):void 0,p=await s.request({method:"eth_newFilter",params:[{address:o,fromBlock:typeof l=="bigint"?(0,e.numberToHex)(l):l,toBlock:typeof f=="bigint"?(0,e.numberToHex)(f):f,topics:h}]});return{abi:a,args:c,eventName:u,id:p,request:g(p),strict:!!d,type:"event"}}return rw}var fw={},hw={},Ej;function pn(){if(Ej)return hw;Ej=1,Object.defineProperty(hw,"__esModule",{value:!0}),hw.parseAccount=t;function t(e){return typeof e=="string"?{address:e,type:"json-rpc"}:e}return hw}var pw={},gw={},vj;function mz(){if(vj)return gw;vj=1,Object.defineProperty(gw,"__esModule",{value:!0}),gw.prepareEncodeFunctionData=i;const t=lr(),e=ef(),r=fc(),n=hc(),s="/docs/contract/encodeFunctionData";function i(o){const{abi:a,args:c,functionName:u}=o;let l=a[0];if(u){const d=(0,n.getAbiItem)({abi:a,args:c,name:u});if(!d)throw new t.AbiFunctionNotFoundError(u,{docsPath:s});l=d}if(l.type!=="function")throw new t.AbiFunctionNotFoundError(void 0,{docsPath:s});return{abi:[l],functionName:(0,e.toFunctionSelector)((0,r.formatAbiItem)(l))}}return gw}var _j;function yi(){if(_j)return pw;_j=1,Object.defineProperty(pw,"__esModule",{value:!0}),pw.encodeFunctionData=n;const t=Xn(),e=ro(),r=mz();function n(s){const{args:i}=s,{abi:o,functionName:a}=(()=>{var d;return s.abi.length===1&&((d=s.functionName)!=null&&d.startsWith("0x"))?s:(0,r.prepareEncodeFunctionData)(s)})(),c=o[0],u=a,l="inputs"in c&&c.inputs?(0,e.encodeAbiParameters)(c.inputs,i??[]):void 0;return(0,t.concatHex)([u,l??"0x"])}return pw}var mw={},kn={},pa={},Aj;function lN(){return Aj||(Aj=1,Object.defineProperty(pa,"__esModule",{value:!0}),pa.solidityPanic=pa.solidityError=pa.panicReasons=void 0,pa.panicReasons={1:"An `assert` condition failed.",17:"Arithmetic operation resulted in underflow or overflow.",18:"Division or modulo by zero (e.g. `5 / 0` or `23 % 0`).",33:"Attempted to convert to an invalid type.",34:"Attempted to access a storage byte array that is incorrectly encoded.",49:"Performed `.pop()` on an empty array",50:"Array index is out of bounds.",65:"Allocated too much memory or created an array which is too large.",81:"Attempted to call a zero-initialized variable of internal function type."},pa.solidityError={inputs:[{name:"message",type:"string"}],name:"Error",type:"error"},pa.solidityPanic={inputs:[{name:"reason",type:"uint256"}],name:"Panic",type:"error"}),pa}var yw={},bw={},ww={},ga={},Cj;function yz(){if(Cj)return ga;Cj=1,Object.defineProperty(ga,"__esModule",{value:!0}),ga.RecursiveReadLimitExceededError=ga.PositionOutOfBoundsError=ga.NegativeOffsetError=void 0;const t=ut();class e extends t.BaseError{constructor({offset:i}){super(`Offset \`${i}\` cannot be negative.`,{name:"NegativeOffsetError"})}}ga.NegativeOffsetError=e;class r extends t.BaseError{constructor({length:i,position:o}){super(`Position \`${o}\` is out of bounds (\`0 < position < ${i}\`).`,{name:"PositionOutOfBoundsError"})}}ga.PositionOutOfBoundsError=r;class n extends t.BaseError{constructor({count:i,limit:o}){super(`Recursive read limit of \`${o}\` exceeded (recursive read count: \`${i}\`).`,{name:"RecursiveReadLimitExceededError"})}}return ga.RecursiveReadLimitExceededError=n,ga}var Ij;function R0(){if(Ij)return ww;Ij=1,Object.defineProperty(ww,"__esModule",{value:!0}),ww.createCursor=r;const t=yz(),e={bytes:new Uint8Array,dataView:new DataView(new ArrayBuffer(0)),position:0,positionReadCount:new Map,recursiveReadCount:0,recursiveReadLimit:Number.POSITIVE_INFINITY,assertReadLimit(){if(this.recursiveReadCount>=this.recursiveReadLimit)throw new t.RecursiveReadLimitExceededError({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(n){if(n<0||n>this.bytes.length-1)throw new t.PositionOutOfBoundsError({length:this.bytes.length,position:n})},decrementPosition(n){if(n<0)throw new t.NegativeOffsetError({offset:n});const s=this.position-n;this.assertPosition(s),this.position=s},getReadCount(n){return this.positionReadCount.get(n||this.position)||0},incrementPosition(n){if(n<0)throw new t.NegativeOffsetError({offset:n});const s=this.position+n;this.assertPosition(s),this.position=s},inspectByte(n){const s=n??this.position;return this.assertPosition(s),this.bytes[s]},inspectBytes(n,s){const i=s??this.position;return this.assertPosition(i+n-1),this.bytes.subarray(i,i+n)},inspectUint8(n){const s=n??this.position;return this.assertPosition(s),this.bytes[s]},inspectUint16(n){const s=n??this.position;return this.assertPosition(s+1),this.dataView.getUint16(s)},inspectUint24(n){const s=n??this.position;return this.assertPosition(s+2),(this.dataView.getUint16(s)<<8)+this.dataView.getUint8(s+2)},inspectUint32(n){const s=n??this.position;return this.assertPosition(s+3),this.dataView.getUint32(s)},pushByte(n){this.assertPosition(this.position),this.bytes[this.position]=n,this.position++},pushBytes(n){this.assertPosition(this.position+n.length-1),this.bytes.set(n,this.position),this.position+=n.length},pushUint8(n){this.assertPosition(this.position),this.bytes[this.position]=n,this.position++},pushUint16(n){this.assertPosition(this.position+1),this.dataView.setUint16(this.position,n),this.position+=2},pushUint24(n){this.assertPosition(this.position+2),this.dataView.setUint16(this.position,n>>8),this.dataView.setUint8(this.position+2,n&255),this.position+=3},pushUint32(n){this.assertPosition(this.position+3),this.dataView.setUint32(this.position,n),this.position+=4},readByte(){this.assertReadLimit(),this._touch();const n=this.inspectByte();return this.position++,n},readBytes(n,s){this.assertReadLimit(),this._touch();const i=this.inspectBytes(n);return this.position+=s??n,i},readUint8(){this.assertReadLimit(),this._touch();const n=this.inspectUint8();return this.position+=1,n},readUint16(){this.assertReadLimit(),this._touch();const n=this.inspectUint16();return this.position+=2,n},readUint24(){this.assertReadLimit(),this._touch();const n=this.inspectUint24();return this.position+=3,n},readUint32(){this.assertReadLimit(),this._touch();const n=this.inspectUint32();return this.position+=4,n},get remaining(){return this.bytes.length-this.position},setPosition(n){const s=this.position;return this.assertPosition(n),this.position=n,()=>this.position=s},_touch(){if(this.recursiveReadLimit===Number.POSITIVE_INFINITY)return;const n=this.getReadCount();this.positionReadCount.set(this.position,n+1),n>0&&this.recursiveReadCount++}};function r(n,{recursiveReadLimit:s=8192}={}){const i=Object.create(e);return i.bytes=n,i.dataView=new DataView(n.buffer,n.byteOffset,n.byteLength),i.positionReadCount=new Map,i.recursiveReadLimit=s,i}return ww}var $c={},Sj;function dN(){if(Sj)return $c;Sj=1,Object.defineProperty($c,"__esModule",{value:!0}),$c.fromBytes=s,$c.bytesToBigInt=i,$c.bytesToBool=o,$c.bytesToNumber=a,$c.bytesToString=c;const t=jp(),e=Hu(),r=Lr(),n=Be();function s(u,l){const d=typeof l=="string"?{to:l}:l,f=d.to;return f==="number"?a(u,d):f==="bigint"?i(u,d):f==="boolean"?o(u,d):f==="string"?c(u,d):(0,n.bytesToHex)(u,d)}function i(u,l={}){typeof l.size<"u"&&(0,r.assertSize)(u,{size:l.size});const d=(0,n.bytesToHex)(u,l);return(0,r.hexToBigInt)(d,l)}function o(u,l={}){let d=u;if(typeof l.size<"u"&&((0,r.assertSize)(d,{size:l.size}),d=(0,e.trim)(d)),d.length>1||d[0]>1)throw new t.InvalidBytesBooleanError(d);return!!d[0]}function a(u,l={}){typeof l.size<"u"&&(0,r.assertSize)(u,{size:l.size});const d=(0,n.bytesToHex)(u,l);return(0,r.hexToNumber)(d,l)}function c(u,l={}){let d=u;return typeof l.size<"u"&&((0,r.assertSize)(d,{size:l.size}),d=(0,e.trim)(d,{dir:"right"})),new TextDecoder().decode(d)}return $c}var Tj;function qu(){if(Tj)return bw;Tj=1,Object.defineProperty(bw,"__esModule",{value:!0}),bw.decodeAbiParameters=l;const t=lr(),e=mi(),r=R0(),n=Gs(),s=to(),i=Hu(),o=dN(),a=Yt(),c=Be(),u=ro();function l(m,_){const O=typeof _=="string"?(0,a.hexToBytes)(_):_,C=(0,r.createCursor)(O);if((0,n.size)(O)===0&&m.length>0)throw new t.AbiDecodingZeroDataError;if((0,n.size)(_)&&(0,n.size)(_)<32)throw new t.AbiDecodingDataSizeTooSmallError({data:typeof _=="string"?_:(0,c.bytesToHex)(_),params:m,size:(0,n.size)(_)});let S=0;const T=[];for(let N=0;N<m.length;++N){const R=m[N];C.setPosition(S);const[B,A]=d(C,R,{staticPosition:0});S+=A,T.push(B)}return T}function d(m,_,{staticPosition:O}){const C=(0,u.getArrayComponents)(_.type);if(C){const[S,T]=C;return p(m,{..._,type:T},{length:S,staticPosition:O})}if(_.type==="tuple")return v(m,_,{staticPosition:O});if(_.type==="address")return h(m);if(_.type==="bool")return y(m);if(_.type.startsWith("bytes"))return w(m,_,{staticPosition:O});if(_.type.startsWith("uint")||_.type.startsWith("int"))return I(m,_);if(_.type==="string")return E(m,{staticPosition:O});throw new t.InvalidAbiDecodingTypeError(_.type,{docsPath:"/docs/contract/decodeAbiParameters"})}const f=32,g=32;function h(m){const _=m.readBytes(32);return[(0,e.checksumAddress)((0,c.bytesToHex)((0,s.sliceBytes)(_,-20))),32]}function p(m,_,{length:O,staticPosition:C}){if(!O){const N=(0,o.bytesToNumber)(m.readBytes(g)),R=C+N,B=R+f;m.setPosition(R);const A=(0,o.bytesToNumber)(m.readBytes(f)),P=b(_);let k=0;const U=[];for(let x=0;x<A;++x){m.setPosition(B+(P?x*32:k));const[j,D]=d(m,_,{staticPosition:B});k+=D,U.push(j)}return m.setPosition(C+32),[U,32]}if(b(_)){const N=(0,o.bytesToNumber)(m.readBytes(g)),R=C+N,B=[];for(let A=0;A<O;++A){m.setPosition(R+A*32);const[P]=d(m,_,{staticPosition:R});B.push(P)}return m.setPosition(C+32),[B,32]}let S=0;const T=[];for(let N=0;N<O;++N){const[R,B]=d(m,_,{staticPosition:C+S});S+=B,T.push(R)}return[T,S]}function y(m){return[(0,o.bytesToBool)(m.readBytes(32),{size:32}),32]}function w(m,_,{staticPosition:O}){const[C,S]=_.type.split("bytes");if(!S){const N=(0,o.bytesToNumber)(m.readBytes(32));m.setPosition(O+N);const R=(0,o.bytesToNumber)(m.readBytes(32));if(R===0)return m.setPosition(O+32),["0x",32];const B=m.readBytes(R);return m.setPosition(O+32),[(0,c.bytesToHex)(B),32]}return[(0,c.bytesToHex)(m.readBytes(Number.parseInt(S),32)),32]}function I(m,_){const O=_.type.startsWith("int"),C=Number.parseInt(_.type.split("int")[1]||"256"),S=m.readBytes(32);return[C>48?(0,o.bytesToBigInt)(S,{signed:O}):(0,o.bytesToNumber)(S,{signed:O}),32]}function v(m,_,{staticPosition:O}){const C=_.components.length===0||_.components.some(({name:N})=>!N),S=C?[]:{};let T=0;if(b(_)){const N=(0,o.bytesToNumber)(m.readBytes(g)),R=O+N;for(let B=0;B<_.components.length;++B){const A=_.components[B];m.setPosition(R+T);const[P,k]=d(m,A,{staticPosition:R});T+=k,S[C?B:A==null?void 0:A.name]=P}return m.setPosition(O+32),[S,32]}for(let N=0;N<_.components.length;++N){const R=_.components[N],[B,A]=d(m,R,{staticPosition:O});S[C?N:R==null?void 0:R.name]=B,T+=A}return[S,T]}function E(m,{staticPosition:_}){const O=(0,o.bytesToNumber)(m.readBytes(32)),C=_+O;m.setPosition(C);const S=(0,o.bytesToNumber)(m.readBytes(32));if(S===0)return m.setPosition(_+32),["",32];const T=m.readBytes(S,32),N=(0,o.bytesToString)((0,i.trim)(T));return m.setPosition(_+32),[N,32]}function b(m){var C;const{type:_}=m;if(_==="string"||_==="bytes"||_.endsWith("[]"))return!0;
292if(_==="tuple")return(C=m.components)==null?void 0:C.some(b);const O=(0,u.getArrayComponents)(m.type);return!!(O&&b({...m,type:O[1]}))}return bw}var Pj;function TC(){if(Pj)return yw;Pj=1,Object.defineProperty(yw,"__esModule",{value:!0}),yw.decodeErrorResult=o;const t=lN(),e=lr(),r=to(),n=ef(),s=qu(),i=fc();function o(a){const{abi:c,data:u}=a,l=(0,r.slice)(u,0,4);if(l==="0x")throw new e.AbiDecodingZeroDataError;const f=[...c||[],t.solidityError,t.solidityPanic].find(g=>g.type==="error"&&l===(0,n.toFunctionSelector)((0,i.formatAbiItem)(g)));if(!f)throw new e.AbiErrorSignatureNotFoundError(l,{docsPath:"/docs/contract/decodeErrorResult"});return{abiItem:f,args:"inputs"in f&&f.inputs&&f.inputs.length>0?(0,s.decodeAbiParameters)(f.inputs,(0,r.slice)(u,4)):void 0,errorName:f.name}}return yw}var Ew={},$g={},Oj;function xn(){if(Oj)return $g;Oj=1,Object.defineProperty($g,"__esModule",{value:!0}),$g.stringify=void 0;const t=(e,r,n)=>JSON.stringify(e,(s,i)=>{const o=typeof i=="bigint"?i.toString():i;return typeof r=="function"?r(s,o):o},n);return $g.stringify=t,$g}var Nj;function bz(){if(Nj)return Ew;Nj=1,Object.defineProperty(Ew,"__esModule",{value:!0}),Ew.formatAbiItemWithArgs=e;const t=xn();function e({abiItem:r,args:n,includeFunctionName:s=!0,includeName:i=!1}){if("name"in r&&"inputs"in r&&r.inputs)return`${s?r.name:""}(${r.inputs.map((o,a)=>`${i&&o.name?`${o.name}: `:""}${typeof n[a]=="object"?(0,t.stringify)(n[a]):n[a]}`).join(", ")})`}return Ew}var vw={},ma={},xj;function B0(){return xj||(xj=1,Object.defineProperty(ma,"__esModule",{value:!0}),ma.weiUnits=ma.gweiUnits=ma.etherUnits=void 0,ma.etherUnits={gwei:9,wei:18},ma.gweiUnits={ether:-9,wei:9},ma.weiUnits={ether:-18,gwei:-9}),ma}var _w={},Rj;function PC(){if(Rj)return _w;Rj=1,Object.defineProperty(_w,"__esModule",{value:!0}),_w.formatUnits=t;function t(e,r){let n=e.toString();const s=n.startsWith("-");s&&(n=n.slice(1)),n=n.padStart(r,"0");let[i,o]=[n.slice(0,n.length-r),n.slice(n.length-r)];return o=o.replace(/(0+)$/,""),`${s?"-":""}${i||"0"}${o?`.${o}`:""}`}return _w}var Bj;function k0(){if(Bj)return vw;Bj=1,Object.defineProperty(vw,"__esModule",{value:!0}),vw.formatEther=r;const t=B0(),e=PC();function r(n,s="wei"){return(0,e.formatUnits)(n,t.etherUnits[s])}return vw}var Aw={},kj;function rf(){if(kj)return Aw;kj=1,Object.defineProperty(Aw,"__esModule",{value:!0}),Aw.formatGwei=r;const t=B0(),e=PC();function r(n,s="wei"){return(0,e.formatUnits)(n,t.gweiUnits[s])}return Aw}var ya={},jj;function fN(){if(jj)return ya;jj=1,Object.defineProperty(ya,"__esModule",{value:!0}),ya.StateAssignmentConflictError=ya.AccountStateConflictError=void 0,ya.prettyStateMapping=n,ya.prettyStateOverride=s;const t=ut();class e extends t.BaseError{constructor({address:o}){super(`State for account "${o}" is set multiple times.`,{name:"AccountStateConflictError"})}}ya.AccountStateConflictError=e;class r extends t.BaseError{constructor(){super("state and stateDiff are set on the same account.",{name:"StateAssignmentConflictError"})}}ya.StateAssignmentConflictError=r;function n(i){return i.reduce((o,{slot:a,value:c})=>`${o}        ${a}: ${c}
293`,"")}function s(i){return i.reduce((o,{address:a,...c})=>{let u=`${o}    ${a}:
294`;return c.nonce&&(u+=`      nonce: ${c.nonce}
295`),c.balance&&(u+=`      balance: ${c.balance}
296`),c.code&&(u+=`      code: ${c.code}
297`),c.state&&(u+=`      state:
298`,u+=n(c.state)),c.stateDiff&&(u+=`      stateDiff:
299`,u+=n(c.stateDiff)),u},`  State Override:
300`).slice(0,-1)}return ya}var or={},Dj;function Zs(){if(Dj)return or;Dj=1,Object.defineProperty(or,"__esModule",{value:!0}),or.WaitForTransactionReceiptTimeoutError=or.TransactionReceiptNotFoundError=or.TransactionNotFoundError=or.TransactionExecutionError=or.InvalidStorageKeySizeError=or.InvalidSerializedTransactionError=or.InvalidSerializedTransactionTypeError=or.InvalidSerializableTransactionError=or.InvalidLegacyVError=or.FeeConflictError=void 0,or.prettyPrint=n;const t=k0(),e=rf(),r=ut();function n(h){const p=Object.entries(h).map(([w,I])=>I===void 0||I===!1?null:[w,I]).filter(Boolean),y=p.reduce((w,[I])=>Math.max(w,I.length),0);return p.map(([w,I])=>`  ${`${w}:`.padEnd(y+1)}  ${I}`).join(`
301`)}class s extends r.BaseError{constructor(){super(["Cannot specify both a `gasPrice` and a `maxFeePerGas`/`maxPriorityFeePerGas`.","Use `maxFeePerGas`/`maxPriorityFeePerGas` for EIP-1559 compatible networks, and `gasPrice` for others."].join(`
302`),{name:"FeeConflictError"})}}
302or.FeeConflictError=s;class i extends r.BaseError{constructor({v:p}){super(`Invalid \`v\` value "${p}". Expected 27 or 28.`,{name:"InvalidLegacyVError"})}}or.InvalidLegacyVError=i;class o extends r.BaseError{constructor({transaction:p}){super("Cannot infer a transaction type from provided transaction.",{metaMessages:["Provided Transaction:","{",n(p),"}","","To infer the type, either provide:","- a `type` to the Transaction, or","- an EIP-1559 Transaction with `maxFeePerGas`, or","- an EIP-2930 Transaction with `gasPrice` & `accessList`, or","- an EIP-4844 Transaction with `blobs`, `blobVersionedHashes`, `sidecars`, or","- an EIP-7702 Transaction with `authorizationList`, or","- a Legacy Transaction with `gasPrice`"],name:"InvalidSerializableTransactionError"})}}or.InvalidSerializableTransactionError=o;class a extends r.BaseError{constructor({serializedType:p}){super(`Serialized transaction type "${p}" is invalid.`,{name:"InvalidSerializedTransactionType"}),Object.defineProperty(this,"serializedType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.serializedType=p}}or.InvalidSerializedTransactionTypeError=a;class c extends r.BaseError{constructor({attributes:p,serializedTransaction:y,type:w}){const I=Object.entries(p).map(([v,E])=>typeof E>"u"?v:void 0).filter(Boolean);super(`Invalid serialized transaction of type "${w}" was provided.`,{metaMessages:[`Serialized Transaction: "${y}"`,I.length>0?`Missing Attributes: ${I.join(", ")}`:""].filter(Boolean),name:"InvalidSerializedTransactionError"}),Object.defineProperty(this,"serializedTransaction",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"type",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.serializedTransaction=y,this.type=w}}or.InvalidSerializedTransactionError=c;class u extends r.BaseError{constructor({storageKey:p}){super(`Size for storage key "${p}" is invalid. Expected 32 bytes. Got ${Math.floor((p.length-2)/2)} bytes.`,{name:"InvalidStorageKeySizeError"})}}or.InvalidStorageKeySizeError=u;class l extends r.BaseError{constructor(p,{account:y,docsPath:w,chain:I,data:v,gas:E,gasPrice:b,maxFeePerGas:m,maxPriorityFeePerGas:_,nonce:O,to:C,value:S}){var N;const T=n({chain:I&&`${I==null?void 0:I.name} (id: ${I==null?void 0:I.id})`,from:y==null?void 0:y.address,to:C,value:typeof S<"u"&&`${(0,t.formatEther)(S)} ${((N=I==null?void 0:I.nativeCurrency)==null?void 0:N.symbol)||"ETH"}`,data:v,gas:E,gasPrice:typeof b<"u"&&`${(0,e.formatGwei)(b)} gwei`,maxFeePerGas:typeof m<"u"&&`${(0,e.formatGwei)(m)} gwei`,maxPriorityFeePerGas:typeof _<"u"&&`${(0,e.formatGwei)(_)} gwei`,nonce:O});super(p.shortMessage,{cause:p,docsPath:w,metaMessages:[...p.metaMessages?[...p.metaMessages," "]:[],"Request Arguments:",T].filter(Boolean),name:"TransactionExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=p}}or.TransactionExecutionError=l;class d extends r.BaseError{constructor({blockHash:p,blockNumber:y,blockTag:w,hash:I,index:v}){let E="Transaction";w&&v!==void 0&&(E=`Transaction at block time "${w}" at index "${v}"`),p&&v!==void 0&&(E=`Transaction at block hash "${p}" at index "${v}"`),y&&v!==void 0&&(E=`Transaction at block number "${y}" at index "${v}"`),I&&(E=`Transaction with hash "${I}"`),super(`${E} could not be found.`,{name:"TransactionNotFoundError"})}}or.TransactionNotFoundError=d;class f extends r.BaseError{constructor({hash:p}){super(`Transaction receipt with hash "${p}" could not be found. The Transaction may not be processed on a block yet.`,{name:"TransactionReceiptNotFoundError"})}}or.TransactionReceiptNotFoundError=f;class g extends r.BaseError{constructor({hash:p}){super(`Timed out while waiting for transaction with hash "${p}" to be confirmed.`,{name:"WaitForTransactionReceiptTimeoutError"})}}return or.WaitForTransactionReceiptTimeoutError=g,or}var gl={},Uj;function hN(){if(Uj)return gl;Uj=1,Object.defineProperty(gl,"__esModule",{value:!0}),gl.getUrl=gl.getContractAddress=void 0;const t=r=>r;gl.getContractAddress=t;const e=r=>r;return gl.getUrl=e,gl}var Mj;function zu(){if(Mj)return kn;Mj=1,Object.defineProperty(kn,"__esModule",{value:!0}),kn.RawContractError=kn.CounterfactualDeploymentFailedError=kn.ContractFunctionZeroDataError=kn.ContractFunctionRevertedError=kn.ContractFunctionExecutionError=kn.CallExecutionError=void 0;const t=pn(),e=lN(),r=TC(),n=fc(),s=bz(),i=hc(),o=k0(),a=rf(),c=lr(),u=ut(),l=fN(),d=Zs(),f=hN();class g extends u.BaseError{constructor(E,{account:b,docsPath:m,chain:_,data:O,gas:C,gasPrice:S,maxFeePerGas:T,maxPriorityFeePerGas:N,nonce:R,to:B,value:A,stateOverride:P}){var x;const k=b?(0,t.parseAccount)(b):void 0;let U=(0,d.prettyPrint)({from:k==null?void 0:k.address,to:B,value:typeof A<"u"&&`${(0,o.formatEther)(A)} ${((x=_==null?void 0:_.nativeCurrency)==null?void 0:x.symbol)||"ETH"}`,data:O,gas:C,gasPrice:typeof S<"u"&&`${(0,a.formatGwei)(S)} gwei`,maxFeePerGas:typeof T<"u"&&`${(0,a.formatGwei)(T)} gwei`,maxPriorityFeePerGas:typeof N<"u"&&`${(0,a.formatGwei)(N)} gwei`,nonce:R});P&&(U+=`
303${(0,l.prettyStateOverride)(P)}`),super(E.shortMessage,{cause:E,docsPath:m,metaMessages:[...E.metaMessages?[...E.metaMessages," "]:[],"Raw Call Arguments:",U].filter(
303Boolean),name:"CallExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=E}}kn.CallExecutionError=g;class h extends u.BaseError{constructor(E,{abi:b,args:m,contractAddress:_,docsPath:O,functionName:C,sender:S}){const T=(0,i.getAbiItem)({abi:b,args:m,name:C}),N=T?(0,s.formatAbiItemWithArgs)({abiItem:T,args:m,includeFunctionName:!1,includeName:!1}):void 0,R=T?(0,n.formatAbiItem)(T,{includeName:!0}):void 0,B=(0,d.prettyPrint)({address:_&&(0,f.getContractAddress)(_),function:R,args:N&&N!=="()"&&`${[...Array((C==null?void 0:C.length)??0).keys()].map(()=>" ").join("")}${N}`,sender:S});super(E.shortMessage||`An unknown error occurred while executing the contract function "${C}".`,{cause:E,docsPath:O,metaMessages:[...E.metaMessages?[...E.metaMessages," "]:[],B&&"Contract Call:",B].filter(Boolean),name:"ContractFunctionExecutionError"}),Object.defineProperty(this,"abi",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"args",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"contractAddress",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"formattedArgs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"functionName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sender",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abi=b,this.args=m,this.cause=E,this.contractAddress=_,this.functionName=C,this.sender=S}}kn.ContractFunctionExecutionError=h;class p extends u.BaseError{constructor({abi:E,data:b,functionName:m,message:_}){let O,C,S,T;if(b&&b!=="0x")try{C=(0,r.decodeErrorResult)({abi:E,data:b});const{abiItem:R,errorName:B,args:A}=C;if(B==="Error")T=A[0];else if(B==="Panic"){const[P]=A;T=e.panicReasons[P]}else{const P=R?(0,n.formatAbiItem)(R,{includeName:!0}):void 0,k=R&&A?(0,s.formatAbiItemWithArgs)({abiItem:R,args:A,includeFunctionName:!1,includeName:!1}):void 0;S=[P?`Error: ${P}`:"",k&&k!=="()"?`       ${[...Array((B==null?void 0:B.length)??0).keys()].map(()=>" ").join("")}${k}`:""]}}catch(R){O=R}else _&&(T=_);let N;O instanceof c.AbiErrorSignatureNotFoundError&&(N=O.signature,S=[`Unable to decode signature "${N}" as it was not found on the provided ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://openchain.xyz/signatures?query=${N}.`]),super(T&&T!=="execution reverted"||N?[`The contract function "${m}" reverted with the following ${N?"signature":"reason"}:`,T||N].join(`
304`):`The contract function "${m}" reverted.`,{cause:O,metaMessages:S,name:"ContractFunctionRevertedError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"raw",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reason",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=C,this.raw=b,this.reason=T,this.signature=N}}kn.ContractFunctionRevertedError=p;class y extends u.BaseError{constructor({functionName:E}){super(`The contract function "${E}" returned no data ("0x").`,{metaMessages:["This could be due to any of the following:",`  - The contract does not have the function "${E}",`,"  - The parameters passed to the contract function may be invalid, or","  - The address is not a contract."],name:"ContractFunctionZeroDataError"})}}kn.ContractFunctionZeroDataError=y;class w extends u.BaseError{constructor({factory:E}){super(`Deployment for counterfactual contract call failed${E?` for factory "${E}".`:""}`,{metaMessages:["Please ensure:","- The `factory` is a valid contract deployment factory (ie. Create2 Factory, ERC-4337 Factory, etc).","- The `factoryData` is a valid encoded function call for contract deployment function on the factory."],name:"CounterfactualDeploymentFailedError"})}}kn.CounterfactualDeploymentFailedError=w;class I extends u.BaseError{constructor({data:E,message:b}){super(b||"",{name:"RawContractError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=E}}return kn.RawContractError=I,kn}var xs={},$j;function no(){if($j)return xs;$j=1,Object.defineProperty(xs,"__esModule",{value:!0}),xs.TimeoutError=xs.SocketClosedError=xs.RpcRequestError=xs.WebSocketRequestError=xs.HttpRequestError=void 0;const t=xn(),e=ut(),r=hN();
304class n extends e.BaseError{constructor({body:u,cause:l,details:d,headers:f,status:g,url:h}){super("HTTP request failed.",{cause:l,details:d,metaMessages:[g&&`Status: ${g}`,`URL: ${(0,r.getUrl)(h)}`,u&&`Request body: ${(0,t.stringify)(u)}`].filter(Boolean),name:"HttpRequestError"}),Object.defineProperty(this,"body",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"headers",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.body=u,this.headers=f,this.status=g,this.url=h}}xs.HttpRequestError=n;class s extends e.BaseError{constructor({body:u,cause:l,details:d,url:f}){super("WebSocket request failed.",{cause:l,details:d,metaMessages:[`URL: ${(0,r.getUrl)(f)}`,u&&`Request body: ${(0,t.stringify)(u)}`].filter(Boolean),name:"WebSocketRequestError"})}}xs.WebSocketRequestError=s;class i extends e.BaseError{constructor({body:u,error:l,url:d}){super("RPC Request failed.",{cause:l,details:l.message,metaMessages:[`URL: ${(0,r.getUrl)(d)}`,`Request body: ${(0,t.stringify)(u)}`],name:"RpcRequestError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.code=l.code,this.data=l.data}}xs.RpcRequestError=i;class o extends e.BaseError{constructor({url:u}={}){super("The socket has been closed.",{metaMessages:[u&&`URL: ${(0,r.getUrl)(u)}`].filter(Boolean),name:"SocketClosedError"})}}xs.SocketClosedError=o;class a extends e.BaseError{constructor({body:u,url:l}){super("The request took too long to respond.",{details:"The request timed out.",metaMessages:[`URL: ${(0,r.getUrl)(l)}`,`Request body: ${(0,t.stringify)(u)}`],name:"TimeoutError"})}}return xs.TimeoutError=a,xs}var Je={},Lj;function nf(){if(Lj)return Je;Lj=1,Object.defineProperty(Je,"__esModule",{value:!0}),Je.UnknownRpcError=Je.SwitchChainError=Je.ChainDisconnectedError=Je.ProviderDisconnectedError=Je.UnsupportedProviderMethodError=Je.UnauthorizedProviderError=Je.UserRejectedRequestError=Je.JsonRpcVersionUnsupportedError=Je.LimitExceededRpcError=Je.MethodNotSupportedRpcError=Je.TransactionRejectedRpcError=Je.ResourceUnavailableRpcError=Je.ResourceNotFoundRpcError=Je.InvalidInputRpcError=Je.InternalRpcError=Je.InvalidParamsRpcError=Je.MethodNotFoundRpcError=Je.InvalidRequestRpcError=Je.ParseRpcError=Je.ProviderRpcError=Je.RpcError=void 0;const t=ut(),e=no(),r=-1;class n extends t.BaseError{constructor(C,{code:S,docsPath:T,metaMessages:N,name:R,shortMessage:B}){super(B,{cause:C,docsPath:T,metaMessages:N||(C==null?void 0:C.metaMessages),name:R||"RpcError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=R||C.name,this.code=C instanceof e.RpcRequestError?C.code:S??r}}Je.RpcError=n;class s extends n{constructor(C,S){super(C,S),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=S.data}}Je.ProviderRpcError=s;class i extends n{constructor(C){super(C,{code:i.code,name:"ParseRpcError",shortMessage:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."})}}Je.ParseRpcError=i,Object.defineProperty(i,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32700});class o extends n{constructor(C){super(C,{code:o.code,name:"InvalidRequestRpcError",shortMessage:"JSON is not a valid request object."})}}Je.InvalidRequestRpcError=o,Object.defineProperty(o,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32600});class a extends n{constructor(C,{method:S}={}){super(C,{code:a.code,name:"MethodNotFoundRpcError",shortMessage:`The method${S?` "${S}"`:""} does not exist / is not available.`})}}Je.MethodNotFoundRpcError=a,Object.defineProperty(a,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32601});class c extends n{constructor(C){super(C,{code:c.code,name:"InvalidParamsRpcError",shortMessage:["Invalid parameters were provided to the RPC method.","Double check you have provided the correct parameters."].join(`
305`)})}}Je.InvalidParamsRpcError=c,Object.defineProperty(c,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32602});class u extends n{constructor(C){super(C,{code:u.code,name:"InternalRpcError",shortMessage:"An internal error was received."})}}Je.InternalRpcError=u,Object.defineProperty(u,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32603});class l extends n{constructor(C){super(C,{code:l.code,name:"InvalidInputRpcError",shortMessage:["Missing or invalid parameters.","Double check you have provided the correct parameters."].join(`
306`)})}}Je.InvalidInputRpcError=l,Object.defineProperty(l,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3});class d extends n{constructor(C){super(C,{code:d.code,name:"ResourceNotFoundRpcError",shortMessage:"Requested resource not found."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceNotFoundRpcError"})}}Je.ResourceNotFoundRpcError=d,Object.defineProperty(d,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001});class f extends n{constructor(C){super(C,{code:f.code,name:"ResourceUnavailableRpcError",shortMessage:"Requested resource not available."})}}Je.ResourceUnavailableRpcError=f,Object.defineProperty(f,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002});class g extends n{constructor(C){super(C,{code:g.code,name:"TransactionRejectedRpcError",shortMessage:"Transaction creation failed."})}}Je.TransactionRejectedRpcError=g,Object.defineProperty(g,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003});class h extends n{constructor(C,{method:S}={}
306){super(C,{code:h.code,name:"MethodNotSupportedRpcError",shortMessage:`Method${S?` "${S}"`:""} is not supported.`})}}Je.MethodNotSupportedRpcError=h,Object.defineProperty(h,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004});class p extends n{constructor(C){super(C,{code:p.code,name:"LimitExceededRpcError",shortMessage:"Request exceeds defined limit."})}}Je.LimitExceededRpcError=p,Object.defineProperty(p,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32005});class y extends n{constructor(C){super(C,{code:y.code,name:"JsonRpcVersionUnsupportedError",shortMessage:"Version of JSON-RPC protocol is not supported."})}}Je.JsonRpcVersionUnsupportedError=y,Object.defineProperty(y,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006});class w extends s{constructor(C){super(C,{code:w.code,name:"UserRejectedRequestError",shortMessage:"User rejected the request."})}}Je.UserRejectedRequestError=w,Object.defineProperty(w,"code",{enumerable:!0,configurable:!0,writable:!0,value:4001});class I extends s{constructor(C){super(C,{code:I.code,name:"UnauthorizedProviderError",shortMessage:"The requested method and/or account has not been authorized by the user."})}}Je.UnauthorizedProviderError=I,Object.defineProperty(I,"code",{enumerable:!0,configurable:!0,writable:!0,value:4100});class v extends s{constructor(C,{method:S}={}){super(C,{code:v.code,name:"UnsupportedProviderMethodError",shortMessage:`The Provider does not support the requested method${S?` " ${S}"`:""}.`})}}Je.UnsupportedProviderMethodError=v,Object.defineProperty(v,"code",{enumerable:!0,configurable:!0,writable:!0,value:4200});class E extends s{constructor(C){super(C,{code:E.code,name:"ProviderDisconnectedError",shortMessage:"The Provider is disconnected from all chains."})}}Je.ProviderDisconnectedError=E,Object.defineProperty(E,"code",{enumerable:!0,configurable:!0,writable:!0,value:4900});class b extends s{constructor(C){super(C,{code:b.code,name:"ChainDisconnectedError",shortMessage:"The Provider is not connected to the requested chain."})}}Je.ChainDisconnectedError=b,Object.defineProperty(b,"code",{enumerable:!0,configurable:!0,writable:!0,value:4901});class m extends s{constructor(C){super(C,{code:m.code,name:"SwitchChainError",shortMessage:"An error occurred when attempting to switch chain."})}}Je.SwitchChainError=m,Object.defineProperty(m,"code",{enumerable:!0,configurable:!0,writable:!0,value:4902});class _ extends n{constructor(C){super(C,{name:"UnknownRpcError",shortMessage:"An unknown RPC error occurred."})}}return Je.UnknownRpcError=_,Je}var Fj;function Wu(){if(Fj)return mw;Fj=1,Object.defineProperty(mw,"__esModule",{value:!0}),mw.getContractError=o;const t=lr(),e=ut(),r=zu(),n=no(),s=nf(),i=3;function o(a,{abi:c,address:u,args:l,docsPath:d,functionName:f,sender:g}){const h=a instanceof r.RawContractError?a:a instanceof e.BaseError?a.walk(b=>"data"in b)||a.walk():{},{code:p,data:y,details:w,message:I,shortMessage:v}=h,E=a instanceof t.AbiDecodingZeroDataError?new r.ContractFunctionZeroDataError({functionName:f}):[i,s.InternalRpcError.code].includes(p)&&(y||w||I||v)?new r.ContractFunctionRevertedError({abi:c,data:typeof y=="object"?y.data:y,functionName:f,message:h instanceof n.RpcRequestError?w:v??I}):a;return new r.ContractFunctionExecutionError(E,{abi:c,args:l,contractAddress:u,docsPath:d,functionName:f,sender:g})}return mw}var Cw={},Iw={},Sw={},Tw={},Hj;function wz(){if(Hj)return Tw;Hj=1,Object.defineProperty(Tw,"__esModule",{value:!0}),Tw.publicKeyToAddress=r;const t=mi(),e=Is();function r(n){const s=(0,e.keccak256)(`0x${n.substring(4)}`).substring(26);return(0,t.checksumAddress)(`0x${s}`)}return Tw}var Pw={},yS={},ba={},Lc={},qj;function Ez(){if(qj)return Lc;qj=1,Object.defineProperty(Lc,"__esModule",{value:!0}),Lc.HashMD=void 0,Lc.setBigUint64=r,Lc.Chi=n,Lc.Maj=s;const t=AC(),e=Xd();function r(o,a,c,u){if(typeof o.setBigUint64=="function")return o.setBigUint64(a,c,u);const l=BigInt(32),d=BigInt(4294967295),f=Number(c>>l&d),g=Number(c&d),h=u?4:0,p=u?0:4;o.setUint32(a+h,f,u),o.setUint32(a+p,g,u)}function n(o,a,c){return o&a^~o&c}function s(o,a,c){return o&a^o&c^a&c}class i extends e.Hash{constructor(a,c,u,l){super(),this.blockLen=a,this.outputLen=c,this.padOffset=u,this.isLE=l,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(a),this.view=(0,e.createView)(this.buffer)}update(a){(0,t.aexists)(this);const{view:c,buffer:u,blockLen:l}=this;a=(0,e.toBytes)(a);const d=a.length;for(let f=0;f<d;){const g=Math.min(l-this.pos,d-f);if(g===l){const h=(0,e.createView)(a);for(;l<=d-f;f+=l)this.process(h,f);continue}u.set(a.subarray(f,f+g),this.pos),this.pos+=g,f+=g,this.pos===l&&(this.process(c,0),this.pos=0)}return this.length+=a.length,this.roundClean(),this}digestInto(a){(0,t.aexists)(this),(0,t.aoutput)(a,this),this.finished=!0;const{buffer:c,view:u,blockLen:l,isLE:d}=this;let{pos:f}=this;c[f++]=128,this.buffer.subarray(f).fill(0),this.padOffset>l-f&&(this.process(u,0),f=0);for(let w=f;w<l;w++)c[w]=0;r(u,l-8,BigInt(this.length*8),d),this.process(u,0);const g=(0,e.createView)(a),h=this.outputLen;if(h%4)throw new Error("_sha2: outputLen should be aligned to 32bit");
306const p=h/4,y=this.get();if(p>y.length)throw new Error("_sha2: outputLen bigger than state");for(let w=0;w<p;w++)g.setUint32(4*w,y[w],d)}digest(){const{buffer:a,outputLen:c}=this;this.digestInto(a);const u=a.slice(0,c);return this.destroy(),u}_cloneInto(a){a||(a=new this.constructor),a.set(...this.get());const{blockLen:c,buffer:u,length:l,finished:d,destroyed:f,pos:g}=this;return a.length=l,a.pos=g,a.finished=d,a.destroyed=f,l%c&&a.buffer.set(u),a}}return Lc.HashMD=i,Lc}var zj;function vz(){if(zj)return ba;zj=1,Object.defineProperty(ba,"__esModule",{value:!0}),ba.sha224=ba.sha256=ba.SHA256=void 0;const t=Ez(),e=Xd(),r=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),n=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),s=new Uint32Array(64);class i extends t.HashMD{constructor(){super(64,32,8,!1),this.A=n[0]|0,this.B=n[1]|0,this.C=n[2]|0,this.D=n[3]|0,this.E=n[4]|0,this.F=n[5]|0,this.G=n[6]|0,this.H=n[7]|0}get(){const{A:c,B:u,C:l,D:d,E:f,F:g,G:h,H:p}=this;return[c,u,l,d,f,g,h,p]}set(c,u,l,d,f,g,h,p){this.A=c|0,this.B=u|0,this.C=l|0,this.D=d|0,this.E=f|0,this.F=g|0,this.G=h|0,this.H=p|0}process(c,u){for(let I=0;I<16;I++,u+=4)s[I]=c.getUint32(u,!1);for(let I=16;I<64;I++){const v=s[I-15],E=s[I-2],b=(0,e.rotr)(v,7)^(0,e.rotr)(v,18)^v>>>3,m=(0,e.rotr)(E,17)^(0,e.rotr)(E,19)^E>>>10;s[I]=m+s[I-7]+b+s[I-16]|0}let{A:l,B:d,C:f,D:g,E:h,F:p,G:y,H:w}=this;for(let I=0;I<64;I++){const v=(0,e.rotr)(h,6)^(0,e.rotr)(h,11)^(0,e.rotr)(h,25),E=w+v+(0,t.Chi)(h,p,y)+r[I]+s[I]|0,m=((0,e.rotr)(l,2)^(0,e.rotr)(l,13)^(0,e.rotr)(l,22))+(0,t.Maj)(l,d,f)|0;w=y,y=p,p=h,h=g+E|0,g=f,f=d,d=l,l=E+m|0}l=l+this.A|0,d=d+this.B|0,f=f+this.C|0,g=g+this.D|0,h=h+this.E|0,p=p+this.F|0,y=y+this.G|0,w=w+this.H|0,this.set(l,d,f,g,h,p,y,w)}roundClean(){s.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}ba.SHA256=i;class o extends i{constructor(){super(),this.A=-1056596264,this.B=914150663,this.C=812702999,this.D=-150054599,this.E=-4191439,this.F=1750603025,this.G=1694076839,this.H=-1090891868,this.outputLen=28}}return ba.sha256=(0,e.wrapConstructor)(()=>new i),ba.sha224=(0,e.wrapConstructor)(()=>new o),ba}var Lg={},bS={},Wj;function Dve(){return Wj||(Wj=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.hmac=t.HMAC=void 0;const e=AC(),r=Xd();class n extends r.Hash{constructor(o,a){super(),this.finished=!1,this.destroyed=!1,(0,e.ahash)(o);const c=(0,r.toBytes)(a);if(this.iHash=o.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const u=this.blockLen,l=new Uint8Array(u);l.set(c.length>u?o.create().update(c).digest():c);for(let d=0;d<l.length;d++)l[d]^=54;this.iHash.update(l),this.oHash=o.create();for(let d=0;d<l.length;d++)l[d]^=106;this.oHash.update(l),l.fill(0)}update(o){return(0,e.aexists)(this),this.iHash.update(o),this}digestInto(o){(0,e.aexists)(this),(0,e.abytes)(o,this.outputLen),this.finished=!0,this.iHash.digestInto(o),this.oHash.update(o),this.oHash.digestInto(o),this.destroy()}digest(){const o=new Uint8Array(this.oHash.outputLen);return this.digestInto(o),o}_cloneInto(o){o||(o=Object.create(Object.getPrototypeOf(this),{}));const{oHash:a,iHash:c,finished:u,destroyed:l,blockLen:d,outputLen:f}=this;return o=o,o.finished=u,o.destroyed=l,o.blockLen=d,o.outputLen=f,o.oHash=a._cloneInto(o.oHash),o.iHash=c._cloneInto(o.iHash),o}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}t.HMAC=n;const s=(i,o,a)=>new n(i,o).update(a).digest();t.hmac=s,t.hmac.create=(i,o)=>new n(i,o)}(bS)),bS}var wS={},ml={},Qt={},xt={},Vj;function Ip(){if(Vj)return xt;Vj=1;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */Object.defineProperty(xt,"__esMo
306dule",{value:!0}),xt.notImplemented=xt.bitMask=void 0,xt.isBytes=n,xt.abytes=s,xt.abool=i,xt.bytesToHex=a,xt.numberToHexUnpadded=c,xt.hexToNumber=u,xt.hexToBytes=f,xt.bytesToNumberBE=g,xt.bytesToNumberLE=h,xt.numberToBytesBE=p,xt.numberToBytesLE=y,xt.numberToVarBytesBE=w,xt.ensureBytes=I,xt.concatBytes=v,xt.equalBytes=E,xt.utf8ToBytes=b,xt.inRange=_,xt.aInRange=O,xt.bitLen=C,xt.bitGet=S,xt.bitSet=T,xt.createHmacDrbg=A,xt.validateObject=k,xt.memoized=x;const t=BigInt(0),e=BigInt(1),r=BigInt(2);function n(j){return j instanceof Uint8Array||ArrayBuffer.isView(j)&&j.constructor.name==="Uint8Array"}function s(j){if(!n(j))throw new Error("Uint8Array expected")}function i(j,D){if(typeof D!="boolean")throw new Error(j+" boolean expected, got "+D)}const o=Array.from({length:256},(j,D)=>D.toString(16).padStart(2,"0"));function a(j){s(j);let D="";for(let M=0;M<j.length;M++)D+=o[j[M]];return D}function c(j){const D=j.toString(16);return D.length&1?"0"+D:D}function u(j){if(typeof j!="string")throw new Error("hex string expected, got "+typeof j);return j===""?t:BigInt("0x"+j)}const l={_0:48,_9:57,A:65,F:70,a:97,f:102};function d(j){if(j>=l._0&&j<=l._9)return j-l._0;if(j>=l.A&&j<=l.F)return j-(l.A-10);if(j>=l.a&&j<=l.f)return j-(l.a-10)}function f(j){if(typeof j!="string")throw new Error("hex string expected, got "+typeof j);const D=j.length,M=D/2;if(D%2)throw new Error("hex string expected, got unpadded hex of length "+D);const L=new Uint8Array(M);for(let H=0,z=0;H<M;H++,z+=2){const V=d(j.charCodeAt(z)),G=d(j.charCodeAt(z+1));if(V===void 0||G===void 0){const ee=j[z]+j[z+1];throw new Error('hex string expected, got non-hex character "'+ee+'" at index '+z)}L[H]=V*16+G}return L}function g(j){return u(a(j))}function h(j){return s(j),u(a(Uint8Array.from(j).reverse()))}function p(j,D){return f(j.toString(16).padStart(D*2,"0"))}function y(j,D){return p(j,D).reverse()}function w(j){return f(c(j))}function I(j,D,M){let L;
306if(typeof D=="string")try{L=f(D)}catch(z){throw new Error(j+" must be hex string or Uint8Array, cause: "+z)}else if(n(D))L=Uint8Array.from(D);else throw new Error(j+" must be hex string or Uint8Array");const H=L.length;if(typeof M=="number"&&H!==M)throw new Error(j+" of length "+M+" expected, got "+H);return L}function v(...j){let D=0;for(let L=0;L<j.length;L++){const H=j[L];s(H),D+=H.length}const M=new Uint8Array(D);for(let L=0,H=0;L<j.length;L++){const z=j[L];M.set(z,H),H+=z.length}return M}function E(j,D){if(j.length!==D.length)return!1;let M=0;for(let L=0;L<j.length;L++)M|=j[L]^D[L];return M===0}function b(j){if(typeof j!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(j))}const m=j=>typeof j=="bigint"&&t<=j;function _(j,D,M){return m(j)&&m(D)&&m(M)&&D<=j&&j<M}function O(j,D,M,L){if(!_(D,M,L))throw new Error("expected valid "+j+": "+M+" <= n < "+L+", got "+D)}function C(j){let D;for(D=0;j>t;j>>=e,D+=1);return D}function S(j,D){return j>>BigInt(D)&e}function T(j,D,M){return j|(M?e:t)<<BigInt(D)}const N=j=>(r<<BigInt(j-1))-e;xt.bitMask=N;const R=j=>new Uint8Array(j),B=j=>Uint8Array.from(j);function A(j,D,M){if(typeof j!="number"||j<2)throw new Error("hashLen must be a number");if(typeof D!="number"||D<2)throw new Error("qByteLen must be a number");if(typeof M!="function")throw new Error("hmacFn must be a function");let L=R(j),H=R(j),z=0;const V=()=>{L.fill(1),H.fill(0),z=0},G=(...te)=>M(H,L,...te),ee=(te=R())=>{H=G(B([0]),te),L=G(),te.length!==0&&(H=G(B([1]),te),L=G())},X=()=>{if(z++>=1e3)throw new Error("drbg: tried 1000 values");let te=0;const fe=[];for(;te<D;){L=G();const Se=L.slice();fe.push(Se),te+=L.length}return v(...fe)};return(te,fe)=>{V(),ee(te);let Se;for(;!(Se=fe(X()));)ee();return V(),Se}}const P={bigint:j=>typeof j=="bigint",function:j=>typeof j=="function",boolean:j=>typeof j=="boolean",string:j=>typeof j=="string",stringOrUint8Array:j=>typeof j=="string"||n(j),isSafeInteger:j=>Number.isSafeInteger(j),array:j=>Array.isArray(j),field:(j,D)=>D.Fp.isValid(j),hash:j=>typeof j=="function"&&Number.isSafeInteger(j.outputLen)};function k(j,D,M={}){const L=(H,z,V)=>{const G=P[z];if(typeof G!="function")throw new Error("invalid validator function");const ee=j[H];if(!(V&&ee===void 0)&&!G(ee,j))throw new Error("param "+String(H)+" is invalid. Expected "+z+", got "+ee)};for(const[H,z]of Object.entries(D))L(H,z,!1);for(const[H,z]of Object.entries(M))L(H,z,!0);return j}const U=()=>{throw new Error("not implemented")};xt.notImplemented=U;function x(j){const D=new WeakMap;return(M,...L)=>{const H=D.get(M);if(H!==void 0)return H;const z=j(M,...L);return D.set(M,z),z}}return xt}var Gj;function OC(){if(Gj)return Qt;Gj=1,Object.defineProperty(Qt,"__esModule",{value:!0}),Qt.isNegativeLE=void 0,Qt.mod=c,Qt.pow=u,Qt.pow2=l,Qt.invert=d,Qt.tonelliShanks=f,Qt.FpSqrt=g,Qt.validateField=y,Qt.FpPow=w,Qt.FpInvertBatch=I,Qt.FpDiv=v,Qt.FpLegendre=E,Qt.FpIsSquare=b,Qt.nLength=m,Qt.Field=_,Qt.FpSqrtOdd=O,Qt.FpSqrtEven=C,Qt.hashToPrivateScalar=S,Qt.getFieldBytesLength=T,Qt.getMinHashLength=N,Qt.mapHashToField=R;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const t=Ip(),e=BigInt(0),r=BigInt(1),n=BigInt(2),s=BigInt(3),i=BigInt(4),o=BigInt(5),a=BigInt(8);function c(B,A){const P=B%A;return P>=e?P:A+P}function u(B,A,P){if(A<e)throw new Error("invalid exponent, negatives unsupported");if(P<=e)throw new Error("invalid modulus");if(P===r)return e;let k=r;for(;A>e;)A&r&&(k=k*B%P),B=B*B%P,A>>=r;return k}function l(B,A,P){let k=B;for(;A-- >e;)k*=k,k%=P;return k}function d(B,A){if(B===e)throw new Error("invert: expected non-zero number");if(A<=e)throw new Error("invert: expected positive modulus, got "+A);let P=c(B,A),k=A,U=e,x=r;for(;P!==e;){const D=k/P,M=k%P,L=U-x*D;k=P,P=M,U=x,x=L}if(k!==r)throw new Error("invert: does not exist");return c(U,A)}function f(B){const A=(B-r)/n;let P,k,U;for(P=B-r,k=0;P%n===e;P/=n,k++);for(U=n;U<B&&u(U,A,B)!==B-r;U++)if(U>1e3)throw new Error("Cannot find square root: likely non-prime P");if(k===1){const j=(B+r)/i;return function(M,L){const H=M.pow(L,j);if(!M.eql(M.sqr(H),L))throw new Error("Cannot find square root");return H}}const x=(P+r)/n;return function(D,M){if(D.pow(M,A)===D.neg(D.ONE))throw new Error("Cannot find square root");let L=k,H=D.pow(D.mul(D.ONE,U),P),z=D.pow(M,x),V=D.pow(M,P);for(;!D.eql(V,D.ONE);){if(D.eql(V,D.ZERO))return D.ZERO;let G=1;for(let X=D.sqr(V);G<L&&!D.eql(X,D.ONE);G++)X=D.sqr(X);const ee=D.pow(H,r<<BigInt(L-G-1));H=D.sqr(ee),z=D.mul(z,ee),V=D.mul(V,H),L=G}return z}}function g(B){if(B%i===s){const A=(B+r)/i;return function(k,U){const x=k.pow(U,A);if(!k.eql(k.sqr(x),U))throw new Error("Cannot find square root");return x}}if(B%a===o){const A=(B-o)/a;return function(k,U){const x=k.mul(U,n),j=k.pow(x,A),D=k.mul(U,j),M=k.mul(k.mul(D,n),j),L=k.mul(D,k.sub(M,k.ONE));if(!k.eql(k.sqr(L),U))throw new Error("Cannot find square root");return L}}return f(B)}const h=(B,A)=>(c(B,A)&r)===r;Qt.isNegativeLE=h;const p=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function y(B){const A={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},P=p.reduce((k,U)=>(k[U]="function",k),A);return(0,t.validateObject)(B,P)}function w(B,A,P){if(P<e)throw new Error("invalid exponent, negatives unsupported");if(P===e)return B.ONE;if(P===r)return A;let k=B.ONE,U=A;for(;P>e;)P&r&&(k=B.mul(k,U)),U=B.sqr(U),P>>=r;return k}function I(B,A){const P=new Array(A.length),k=A.reduce((x,j,D)=>B.is0(j)?x:(P[D]=x,B.mul(x,j)),B.ONE),U=B.inv(k);return A.reduceRight((x,j,D)=>B.is0(j)?x:(P[D]=B.mul(x,P[D]),B.mul(x,j)),U),P}function v(B,A,P){return B.mul(A,typeof P=="bigint"?d(P,B.ORDER):B.inv(P))}function E(B){const A=(B-r)/n;return(P,k)=>P.pow(k,A)}function b(B){const A=E(B.ORDER);return P=>{const k=A(B,P);return B.eql(k,B.ZERO)||B.eql(k,B.ONE)}}function m(B,A){const P=A!==void 0?A:B.toString(2).length,k=Math.ceil(P/8);return{nBitLength:P,nByteLength:k}}function _(B,A,P=!1,k={}){if(B<=e)throw new Error("invalid field: expected ORDER > 0, got "+B);const{nBitLength:U,nByteLength:x}=m(B,A);if(x>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let j;const D=Object.freeze({ORDER:B,isLE:P,BITS:U,BYTES:x,MASK:(0,t.bitMask)(U),ZERO:e,ONE:r,create:M=>c(M,B),isValid:M=>{if(typeof M!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof M);return e<=M&&M<B},is0:M=>M===e,isOdd:M=>(M&r)===r,neg:M=>c(-M,B),eql:(M,L)=>M===L,sqr:M=>c(M*M,B),add:(M,L)=>c(M+L,B),sub:(M,L)=>c(M-L,B),mul:(M,L)=>c(M*L,B),pow:(M,L)=>w(D,M,L),div:(M,L)=>
306c(M*d(L,B),B),sqrN:M=>M*M,addN:(M,L)=>M+L,subN:(M,L)=>M-L,mulN:(M,L)=>M*L,inv:M=>d(M,B),sqrt:k.sqrt||(M=>(j||(j=g(B)),j(D,M))),invertBatch:M=>I(D,M),cmov:(M,L,H)=>H?L:M,toBytes:M=>P?(0,t.numberToBytesLE)(M,x):(0,t.numberToBytesBE)(M,x),fromBytes:M=>{if(M.length!==x)throw new Error("Field.fromBytes: expected "+x+" bytes, got "+M.length);return P?(0,t.bytesToNumberLE)(M):(0,t.bytesToNumberBE)(M)}});return Object.freeze(D)}function O(B,A){if(!B.isOdd)throw new Error("Field doesn't have isOdd");const P=B.sqrt(A);return B.isOdd(P)?P:B.neg(P)}function C(B,A){if(!B.isOdd)throw new Error("Field doesn't have isOdd");const P=B.sqrt(A);return B.isOdd(P)?B.neg(P):P}function S(B,A,P=!1){B=(0,t.ensureBytes)("privateHash",B);const k=B.length,U=m(A).nByteLength+8;if(U<24||k<U||k>1024)throw new Error("hashToPrivateScalar: expected "+U+"-1024 bytes of input, got "+k);const x=P?(0,t.bytesToNumberLE)(B):(0,t.bytesToNumberBE)(B);return c(x,A-r)+r}function T(B){if(typeof B!="bigint")throw new Error("field order must be bigint");const A=B.toString(2).length;return Math.ceil(A/8)}function N(B){const A=T(B);return A+Math.ceil(A/2)}function R(B,A,P=!1){const k=B.length,U=T(A),x=N(A);if(k<16||k<x||k>1024)throw new Error("expected "+x+"-1024 bytes of input, got "+k);const j=P?(0,t.bytesToNumberLE)(B):(0,t.bytesToNumberBE)(B),D=c(j,A-r)+r;return P?(0,t.numberToBytesLE)(D,U):(0,t.numberToBytesBE)(D,U)}return Qt}var Kj;function Uve(){if(Kj)return ml;Kj=1,Object.defineProperty(ml,"__esModule",{value:!0}),ml.wNAF=f,ml.pippenger=g,ml.precomputeMSMUnsafe=h,ml.validateBasic=p;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const t=OC(),e=Ip(),r=BigInt(0),n=BigInt(1);function s(y,w){const I=w.negate();return y?I:w}function i(y,w){if(!Number.isSafeInteger(y)||y<=0||y>w)throw new Error("invalid window size, expected [1.."+w+"], got W="+y)}function o(y,w){i(y,w);const I=Math.ceil(w/y)+1,v=2**(y-1);return{windows:I,windowSize:v}}function a(y,w){if(!Array.isArray(y))throw new Error("array expected");y.forEach((I,v)=>{if(!(I instanceof w))throw new Error("invalid point at index "+v)})}function c(y,w){if(!Array.isArray(y))throw new Error("array of scalars expected");y.forEach((I,v)=>{if(!w.isValid(I))throw new Error("invalid scalar at index "+v)})}const u=new WeakMap,l=new WeakMap;function d(y){return l.get(y)||1}function f(y,w){return{constTimeNegate:s,hasPrecomputes(I){return d(I)!==1},unsafeLadder(I,v,E=y.ZERO){let b=I;for(;v>r;)v&n&&(E=E.add(b)),b=b.double(),v>>=n;return E},precomputeWindow(I,v){const{windows:E,windowSize:b}=o(v,w),m=[];let _=I,O=_;for(let C=0;C<E;C++){O=_,m.push(O);for(let S=1;S<b;S++)O=O.add(_),m.push(O);_=O.double()}return m},wNAF(I,v,E){const{windows:b,windowSize:m}=o(I,w);let _=y.ZERO,O=y.BASE;const C=BigInt(2**I-1),S=2**I,T=BigInt(I);for(let N=0;N<b;N++){const R=N*m;let B=Number(E&C);E>>=T,B>m&&(B-=S,E+=n);const A=R,P=R+Math.abs(B)-1,k=N%2!==0,U=B<0;B===0?O=O.add(s(k,v[A])):_=_.add(s(U,v[P]))}return{p:_,f:O}},wNAFUnsafe(I,v,E,b=y.ZERO){const{windows:m,windowSize:_}=o(I,w),O=BigInt(2**I-1),C=2**I,S=BigInt(I);for(let T=0;T<m;T++){const N=T*_;if(E===r)break;let R=Number(E&O);
306if(E>>=S,R>_&&(R-=C,E+=n),R===0)continue;let B=v[N+Math.abs(R)-1];R<0&&(B=B.negate()),b=b.add(B)}return b},getPrecomputes(I,v,E){let b=u.get(v);return b||(b=this.precomputeWindow(v,I),I!==1&&u.set(v,E(b))),b},wNAFCached(I,v,E){const b=d(I);return this.wNAF(b,this.getPrecomputes(b,I,E),v)},wNAFCachedUnsafe(I,v,E,b){const m=d(I);return m===1?this.unsafeLadder(I,v,b):this.wNAFUnsafe(m,this.getPrecomputes(m,I,E),v,b)},setWindowSize(I,v){i(v,w),l.set(I,v),u.delete(I)}}}function g(y,w,I,v){if(a(I,y),c(v,w),I.length!==v.length)throw new Error("arrays of points and scalars must have equal length");const E=y.ZERO,b=(0,e.bitLen)(BigInt(I.length)),m=b>12?b-3:b>4?b-2:b?2:1,_=(1<<m)-1,O=new Array(_+1).fill(E),C=Math.floor((w.BITS-1)/m)*m;let S=E;for(let T=C;T>=0;T-=m){O.fill(E);for(let R=0;R<v.length;R++){const B=v[R],A=Number(B>>BigInt(T)&BigInt(_));O[A]=O[A].add(I[R])}let N=E;for(let R=O.length-1,B=E;R>0;R--)B=B.add(O[R]),N=N.add(B);if(S=S.add(N),T!==0)for(let R=0;R<m;R++)S=S.double()}return S}function h(y,w,I,v){i(v,w.BITS),a(I,y);const E=y.ZERO,b=2**v-1,m=Math.ceil(w.BITS/v),_=BigInt((1<<v)-1),O=I.map(C=>{const S=[];for(let T=0,N=C;T<b;T++)S.push(N),N=N.add(C);return S});return C=>{if(c(C,w),C.length>I.length)throw new Error("array of scalars must be smaller than array of points");let S=E;for(let T=0;T<m;T++){if(S!==E)for(let R=0;R<v;R++)S=S.double();const N=BigInt(m*v-(T+1)*v);for(let R=0;R<C.length;R++){const B=C[R],A=Number(B>>N&_);A&&(S=S.add(O[R][A-1]))}}return S}}function p(y){return(0,t.validateField)(y.Fp),(0,e.validateObject)(y,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...(0,t.nLength)(y.n,y.nBitLength),...y,p:y.Fp.ORDER})}return ml}var Zj;function _z(){return Zj||(Zj=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.DER=t.DERErr=void 0,t.weierstrassPoints=p,t.weierstrass=w,t.SWUFpSqrtRatio=I,t.mapToCurveSimpleSWU=v;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const e=Uve(),r=OC(),n=Ip(),s=Ip();function i(E){E.lowS!==void 0&&(0,s.abool)("lowS",E.lowS),E.prehash!==void 0&&(0,s.abool)("prehash",E.prehash)}function o(E){const b=(0,e.validateBasic)(E);n.validateObject(b,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:m,Fp:_,a:O}=b;if(m){if(!_.eql(O,_.ZERO))throw new Error("invalid endomorphism, can only be defined for Koblitz curves that have a=0");if(typeof m!="object"||typeof m.beta!="bigint"||typeof m.splitScalar!="function")throw new Error("invalid endomorphism, expected beta: bigint and splitScalar: function")}return Object.freeze({...b})}const{bytesToNumberBE:a,hexToBytes:c}=n;class u extends Error{constructor(b=""){super(b)}}t.DERErr=u,t.DER={Err:u,_tlv:{encode:(E,b)=>{const{Err:m}=t.DER;if(E<0||E>256)throw new m("tlv.encode: wrong tag");if(b.length&1)throw new m("tlv.encode: unpadded data");const _=b.length/2,O=n.numberToHexUnpadded(_);if(O.length/2&128)throw new m("tlv.encode: long form length too big");const C=_>127?n.numberToHexUnpadded(O.length/2|128):"";return n.numberToHexUnpadded(E)+C+O+b},decode(E,b){const{Err:m}=t.DER;let _=0;if(E<0||E>256)throw new m("tlv.encode: wrong tag");if(b.length<2||b[_++]!==E)throw new m("tlv.decode: wrong tlv");const O=b[_++],C=!!(O&128);let S=0;if(!C)S=O;else{const N=O&127;if(!N)throw new m("tlv.decode(long): indefinite length not supported");if(N>4)throw new m("tlv.decode(long): byte length is too big");const R=b.subarray(_,_+N);if(R.length!==N)throw new m("tlv.decode: length bytes not complete");if(R[0]===0)throw new m("tlv.decode(long): zero leftmost byte");for(const B of R)S=S<<8|B;if(_+=N,S<128)throw new m("tlv.decode(long): not minimal encoding")}const T=b.subarray(_,_+S);if(T.length!==S)throw new m("tlv.decode: wrong value length");return{v:T,l:b.subarray(_+S)}}},_int:{encode(E){const{Err:b}=t.DER;if(E<l)throw new b("integer: negative integers are not allowed");let m=n.numberToHexUnpadded(E);if(Number.parseInt(m[0],16)&8&&(m="00"+m),m.length&1)throw new b("unexpected DER parsing assertion: unpadded hex");return m},decode(E){const{Err:b}=t.DER;if(E[0]&128)throw new b("invalid signature integer: negative");if(E[0]===0&&!(E[1]&128))throw new b("invalid signature integer: unnecessary leading zero");return a(E)}},toSig(E){const{Err:b,_int:m,_tlv:_}=t.DER,O=typeof E=="string"?c(E):E;n.abytes(O);const{v:C,l:S}=_.decode(48,O);
306if(S.length)throw new b("invalid signature: left bytes after parsing");const{v:T,l:N}=_.decode(2,C),{v:R,l:B}=_.decode(2,N);if(B.length)throw new b("invalid signature: left bytes after parsing");return{r:m.decode(T),s:m.decode(R)}},hexFromSig(E){const{_tlv:b,_int:m}=t.DER,_=b.encode(2,m.encode(E.r)),O=b.encode(2,m.encode(E.s)),C=_+O;return b.encode(48,C)}};const l=BigInt(0),d=BigInt(1),f=BigInt(2),g=BigInt(3),h=BigInt(4);function p(E){const b=o(E),{Fp:m}=b,_=(0,r.Field)(b.n,b.nBitLength),O=b.toBytes||((x,j,D)=>{const M=j.toAffine();return n.concatBytes(Uint8Array.from([4]),m.toBytes(M.x),m.toBytes(M.y))}),C=b.fromBytes||(x=>{const j=x.subarray(1),D=m.fromBytes(j.subarray(0,m.BYTES)),M=m.fromBytes(j.subarray(m.BYTES,2*m.BYTES));return{x:D,y:M}});function S(x){const{a:j,b:D}=b,M=m.sqr(x),L=m.mul(M,x);return m.add(m.add(L,m.mul(x,j)),D)}if(!m.eql(m.sqr(b.Gy),S(b.Gx)))throw new Error("bad generator point: equation left != right");function T(x){return n.inRange(x,d,b.n)}function N(x){const{allowedPrivateKeyLengths:j,nByteLength:D,wrapPrivateKey:M,n:L}=b;if(j&&typeof x!="bigint"){if(n.isBytes(x)&&(x=n.bytesToHex(x)),typeof x!="string"||!j.includes(x.length))throw new Error("invalid private key");x=x.padStart(D*2,"0")}let H;try{H=typeof x=="bigint"?x:n.bytesToNumberBE((0,s.ensureBytes)("private key",x,D))}catch{throw new Error("invalid private key, expected hex or "+D+" bytes, got "+typeof x)}return M&&(H=(0,r.mod)(H,L)),n.aInRange("private key",H,d,L),H}function R(x){if(!(x instanceof P))throw new Error("ProjectivePoint expected")}const B=(0,s.memoized)((x,j)=>{const{px:D,py:M,pz:L}=x;if(m.eql(L,m.ONE))return{x:D,y:M};const H=x.is0();j==null&&(j=H?m.ONE:m.inv(L));const z=m.mul(D,j),V=m.mul(M,j),G=m.mul(L,j);if(H)return{x:m.ZERO,y:m.ZERO};if(!m.eql(G,m.ONE))throw new Error("invZ was invalid");return{x:z,y:V}}),A=(0,s.memoized)(x=>{if(x.is0()){if(b.allowInfinityPoint&&!m.is0(x.py))return;throw new Error("bad point: ZERO")}const{x:j,y:D}=x.toAffine();if(!m.isValid(j)||!m.isValid(D))throw new Error("bad point: x or y not FE");const M=m.sqr(D),L=S(j);if(!m.eql(M,L))throw new Error("bad point: equation left != right");if(!x.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});class P{constructor(j,D,M){if(this.px=j,this.py=D,this.pz=M,j==null||!m.isValid(j))throw new Error("x required");if(D==null||!m.isValid(D))throw new Error("y required");if(M==null||!m.isValid(M))throw new Error("z required");Object.freeze(this)}static fromAffine(j){const{x:D,y:M}=j||{};if(!j||!m.isValid(D)||!m.isValid(M))throw new Error("invalid affine point");if(j instanceof P)throw new Error("projective point not allowed");const L=H=>m.eql(H,m.ZERO);return L(D)&&L(M)?P.ZERO:new P(D,M,m.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(j){const D=m.invertBatch(j.map(M=>M.pz));return j.map((M,L)=>M.toAffine(D[L])).map(P.fromAffine)}static fromHex(j){const D=P.fromAffine(C((0,s.ensureBytes)("pointHex",j)));return D.assertValidity(),D}static fromPrivateKey(j){return P.BASE.multiply(N(j))}static msm(j,D){return(0,e.pippenger)(P,_,j,D)}_setWindowSize(j){U.setWindowSize(this,j)}assertValidity(){A(this)}hasEvenY(){const{y:j}=this.toAffine();if(m.isOdd)return!m.isOdd(j);throw new Error("Field doesn't support isOdd")}equals(j){R(j);const{px:D,py:M,pz:L}=this,{px:H,py:z,pz:V}=j,G=m.eql(m.mul(D,V),m.mul(H,L)),ee=m.eql(m.mul(M,V),m.mul(z,L));return G&&ee}negate(){return new P(this.px,m.neg(this.py),this.pz)}double(){const{a:j,b:D}=b,M=m.mul(D,g),{px:L,py:H,pz:z}=this;let V=m.ZERO,G=m.ZERO,ee=m.ZERO,X=m.mul(L,L),oe=m.mul(H,H),te=m.mul(z,z),fe=m.mul(L,H);return fe=m.add(fe,fe),ee=m.mul(L,z),ee=m.add(ee,ee),V=m.mul(j,ee),G=m.mul(M,te),G=m.add(V,G),V=m.sub(oe,G),G=m.add(oe,G),G=m.mul(V,G),V=m.mul(fe,V),ee=m.mul(M,ee),te=m.mul(j,te),fe=m.sub(X,te),fe=m.mul(j,fe),fe=m.add(fe,ee),ee=m.add(X,X),X=m.add(ee,X),X=m.add(X,te),X=m.mul(X,fe),G=m.add(G,X),te=m.mul(H,z),te=m.add(te,te),X=m.mul(te,fe),V=m.sub(V,X),ee=m.mul(te,oe),ee=m.add(ee,ee),ee=m.add(ee,ee),new P(V,G,ee)}add(j){R(j);const{px:D,py:M,pz:L}=this,{px:H,py:z,pz:V}=j;let G=m.ZERO,ee=m.ZERO,X=m.ZERO;const oe=b.a,te=m.mul(b.b,g);let fe=m.mul(D,H),Se=m.mul(M,z),le=m.mul(L,V),we=m.add(D,M),ve=m.add(H,z);we=m.mul(we,ve),ve=m.add(fe,Se),we=m.sub(we,ve),ve=m.add(D,L);
306let ae=m.add(H,V);return ve=m.mul(ve,ae),ae=m.add(fe,le),ve=m.sub(ve,ae),ae=m.add(M,L),G=m.add(z,V),ae=m.mul(ae,G),G=m.add(Se,le),ae=m.sub(ae,G),X=m.mul(oe,ve),G=m.mul(te,le),X=m.add(G,X),G=m.sub(Se,X),X=m.add(Se,X),ee=m.mul(G,X),Se=m.add(fe,fe),Se=m.add(Se,fe),le=m.mul(oe,le),ve=m.mul(te,ve),Se=m.add(Se,le),le=m.sub(fe,le),le=m.mul(oe,le),ve=m.add(ve,le),fe=m.mul(Se,ve),ee=m.add(ee,fe),fe=m.mul(ae,ve),G=m.mul(we,G),G=m.sub(G,fe),fe=m.mul(we,Se),X=m.mul(ae,X),X=m.add(X,fe),new P(G,ee,X)}subtract(j){return this.add(j.negate())}is0(){return this.equals(P.ZERO)}wNAF(j){return U.wNAFCached(this,j,P.normalizeZ)}multiplyUnsafe(j){const{endo:D,n:M}=b;n.aInRange("scalar",j,l,M);const L=P.ZERO;if(j===l)return L;if(this.is0()||j===d)return this;if(!D||U.hasPrecomputes(this))return U.wNAFCachedUnsafe(this,j,P.normalizeZ);let{k1neg:H,k1:z,k2neg:V,k2:G}=D.splitScalar(j),ee=L,X=L,oe=this;for(;z>l||G>l;)z&d&&(ee=ee.add(oe)),G&d&&(X=X.add(oe)),oe=oe.double(),z>>=d,G>>=d;return H&&(ee=ee.negate()),V&&(X=X.negate()),X=new P(m.mul(X.px,D.beta),X.py,X.pz),ee.add(X)}multiply(j){const{endo:D,n:M}=b;n.aInRange("scalar",j,d,M);let L,H;if(D){const{k1neg:z,k1:V,k2neg:G,k2:ee}=D.splitScalar(j);let{p:X,f:oe}=this.wNAF(V),{p:te,f:fe}=this.wNAF(ee);X=U.constTimeNegate(z,X),te=U.constTimeNegate(G,te),te=new P(m.mul(te.px,D.beta),te.py,te.pz),L=X.add(te),H=oe.add(fe)}else{const{p:z,f:V}=this.wNAF(j);L=z,H=V}return P.normalizeZ([L,H])[0]}multiplyAndAddUnsafe(j,D,M){const L=P.BASE,H=(V,G)=>G===l||G===d||!V.equals(L)?V.multiplyUnsafe(G):V.multiply(G),z=H(this,D).add(H(j,M));return z.is0()?void 0:z}toAffine(j){return B(this,j)}isTorsionFree(){const{h:j,isTorsionFree:D}=b;if(j===d)return!0;if(D)return D(P,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:j,clearCofactor:D}=b;return j===d?this:D?D(P,this):this.multiplyUnsafe(b.h)}toRawBytes(j=!0){return(0,s.abool)("isCompressed",j),this.assertValidity(),O(P,this,j)}toHex(j=!0){return(0,s.abool)("isCompressed",j),n.bytesToHex(this.toRawBytes(j))}}P.BASE=new P(b.Gx,b.Gy,m.ONE),P.ZERO=new P(m.ZERO,m.ONE,m.ZERO);const k=b.nBitLength,U=(0,e.wNAF)(P,b.endo?Math.ceil(k/2):k);return{CURVE:b,ProjectivePoint:P,normPrivateKeyToScalar:N,weierstrassEquation:S,isWithinCurveOrder:T}}function y(E){const b=(0,e.validateBasic)(E);return n.validateObject(b,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...b})}function w(E){const b=y(E),{Fp:m,n:_}=b,O=m.BYTES+1,C=2*m.BYTES+1;function S(le){return(0,r.mod)(le,_)}function T(le){return(0,r.invert)(le,_)}const{ProjectivePoint:N,normPrivateKeyToScalar:R,weierstrassEquation:B,isWithinCurveOrder:A}=p({...b,toBytes(le,we,ve){const ae=we.toAffine(),re=m.toBytes(ae.x),wt=n.concatBytes;return(0,s.abool)("isCompressed",ve),ve?wt(Uint8Array.from([we.hasEvenY()?2:3]),re):wt(Uint8Array.from([4]),re,m.toBytes(ae.y))},fromBytes(le){const we=le.length,ve=le[0],ae=le.subarray(1);if(we===O&&(ve===2||ve===3)){const re=n.bytesToNumberBE(ae);if(!n.inRange(re,d,m.ORDER))throw new Error("Point is not on curve");const wt=B(re);let Ot;try{Ot=m.sqrt(wt)}catch(Jt){const sr=Jt instanceof Error?": "+Jt.message:"";throw new Error("Point is not on curve"+sr)}const pt=(Ot&d)===d;return(ve&1)===1!==pt&&(Ot=m.neg(Ot)),{x:re,y:Ot}}else if(we===C&&ve===4){const re=m.fromBytes(ae.subarray(0,m.BYTES)),wt=m.fromBytes(ae.subarray(m.BYTES,2*m.BYTES));return{x:re,y:wt}}else{const re=O,wt=C;throw new Error("invalid Point, expected length of "+re+", or uncompressed "+wt+", got "+we)}}}),P=le=>n.bytesToHex(n.numberToBytesBE(le,b.nByteLength));function k(le){const we=_>>d;return le>we}function U(le){return k(le)?S(-le):le}const x=(le,we,ve)=>n.bytesToNumberBE(le.slice(we,ve));class j{constructor(we,ve,ae){this.r=we,this.s=ve,this.recovery=ae,this.assertValidity()}static fromCompact(we){const ve=b.nByteLength;return we=(0,s.ensureBytes)("compactSignature",we,ve*2),new j(x(we,0,ve),x(we,ve,2*ve))}static fromDER(we){const{r:ve,s:ae}=t.DER.toSig((0,s.ensureBytes)("DER",we));return new j(ve,ae)}assertValidity(){n.aInRange("r",this.r,d,_),n.aInRange("s",this.s,d,_)}addRecoveryBit(we){return new j(this.r,this.s,we)}recoverPublicKey(we){const{r:ve,s:ae,recovery:re}=this,wt=V((0,s.ensureBytes)("msgHash",we));if(re==null||![0,1,2,3].includes(re))throw new Error("recovery id invalid");const Ot=re===2||re===3?ve+b.n:ve;if(Ot>=m.ORDER)throw new Error("recovery id 2 or 3 invalid");const pt=(re&1)===0?"02":"03",nr=N.fromHex(pt+P(Ot)),Jt=T(Ot),sr=S(-wt*Jt),ie=S(ae*Jt),de=N.BASE.multiplyAndAddUnsafe(nr,sr,ie);
306if(!de)throw new Error("point at infinify");return de.assertValidity(),de}hasHighS(){return k(this.s)}normalizeS(){return this.hasHighS()?new j(this.r,S(-this.s),this.recovery):this}toDERRawBytes(){return n.hexToBytes(this.toDERHex())}toDERHex(){return t.DER.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return n.hexToBytes(this.toCompactHex())}toCompactHex(){return P(this.r)+P(this.s)}}const D={isValidPrivateKey(le){try{return R(le),!0}catch{return!1}},normPrivateKeyToScalar:R,randomPrivateKey:()=>{const le=(0,r.getMinHashLength)(b.n);return(0,r.mapHashToField)(b.randomBytes(le),b.n)},precompute(le=8,we=N.BASE){return we._setWindowSize(le),we.multiply(BigInt(3)),we}};function M(le,we=!0){return N.fromPrivateKey(le).toRawBytes(we)}function L(le){const we=n.isBytes(le),ve=typeof le=="string",ae=(we||ve)&&le.length;return we?ae===O||ae===C:ve?ae===2*O||ae===2*C:le instanceof N}function H(le,we,ve=!0){if(L(le))throw new Error("first arg must be private key");if(!L(we))throw new Error("second arg must be public key");return N.fromHex(we).multiply(R(le)).toRawBytes(ve)}const z=b.bits2int||function(le){if(le.length>8192)throw new Error("input is too large");const we=n.bytesToNumberBE(le),ve=le.length*8-b.nBitLength;return ve>0?we>>BigInt(ve):we},V=b.bits2int_modN||function(le){return S(z(le))},G=n.bitMask(b.nBitLength);function ee(le){return n.aInRange("num < 2^"+b.nBitLength,le,l,G),n.numberToBytesBE(le,b.nByteLength)}function X(le,we,ve=oe){if(["recovered","canonical"].some(ze=>ze in ve))throw new Error("sign() legacy options not supported");const{hash:ae,randomBytes:re}=b;let{lowS:wt,prehash:Ot,extraEntropy:pt}=ve;wt==null&&(wt=!0),le=(0,s.ensureBytes)("msgHash",le),i(ve),Ot&&(le=(0,s.ensureBytes)("prehashed msgHash",ae(le)));const nr=V(le),Jt=R(we),sr=[ee(Jt),ee(nr)];if(pt!=null&&pt!==!1){const ze=pt===!0?re(m.BYTES):pt;sr.push((0,s.ensureBytes)("extraEntropy",ze))}const ie=n.concatBytes(...sr),de=nr;function Ce(ze){const Ut=z(ze);if(!A(Ut))return;const es=T(Ut),Vo=N.BASE.multiply(Ut).toAffine(),Ss=S(Vo.x);if(Ss===l)return;const Go=S(es*S(de+Ss*Jt));if(Go===l)return;let io=(Vo.x===Ss?0:2)|Number(Vo.y&d),bi=Go;return wt&&k(Go)&&(bi=U(Go),io^=1),new j(Ss,bi,io)}return{seed:ie,k2sig:Ce}}const oe={lowS:b.lowS,prehash:!1},te={lowS:b.lowS,prehash:!1};function fe(le,we,ve=oe){const{seed:ae,k2sig:re}=X(le,we,ve),wt=b;return n.createHmacDrbg(wt.hash.outputLen,wt.nByteLength,wt.hmac)(ae,re)}N.BASE._setWindowSize(8);function Se(le,we,ve,ae=te){var io;const re=le;we=(0,s.ensureBytes)("msgHash",we),ve=(0,s.ensureBytes)("publicKey",ve);const{lowS:wt,prehash:Ot,format:pt}=ae;if(i(ae),"strict"in ae)throw new Error("options.strict was renamed to lowS");if(pt!==void 0&&pt!=="compact"&&pt!=="der")throw new Error("format must be compact or der");const nr=typeof re=="string"||n.isBytes(re),Jt=!nr&&!pt&&typeof re=="object"&&re!==null&&typeof re.r=="bigint"&&typeof re.s=="bigint";if(!nr&&!Jt)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");let sr,ie;try{if(Jt&&(sr=new j(re.r,re.s)),nr){try{pt!=="compact"&&(sr=j.fromDER(re))}catch(bi){if(!(bi instanceof t.DER.Err))throw bi}!sr&&pt!=="der"&&(sr=j.fromCompact(re))}ie=N.fromHex(ve)}catch{return!1}if(!sr||wt&&sr.hasHighS())return!1;Ot&&(we=b.hash(we));const{r:de,s:Ce}=sr,ze=V(we),Ut=T(Ce),es=S(ze*Ut),Vo=S(de*Ut),Ss=(io=N.BASE.multiplyAndAddUnsafe(ie,es,Vo))==null?void 0:io.toAffine();return Ss?S(Ss.x)===de:!1}return{CURVE:b,getPublicKey:M,getSharedSecret:H,sign:fe,verify:Se,ProjectivePoint:N,Signature:j,utils:D}}function I(E,b){const m=E.ORDER;let _=l;for(let U=m-d;U%f===l;U/=f)_+=d;const O=_,C=f<<O-d-d,S=C*f,T=(m-d)/S,N=(T-d)/f,R=S-d,B=C,A=E.pow(b,T),P=E.pow(b,(T+d)/f);let k=(U,x)=>{let j=A,D=E.pow(x,R),M=E.sqr(D);M=E.mul(M,x);let L=E.mul(U,M);L=E.pow(L,N),L=E.mul(L,D),D=E.mul(L,x),M=E.mul(L,U);let H=E.mul(M,D);L=E.pow(H,B);let z=E.eql(L,E.ONE);D=E.mul(M,P),L=E.mul(H,j),M=E.cmov(D,M,z),H=E.cmov(L,H,z);for(let V=O;V>d;V--){let G=V-f;G=f<<G-d;let ee=E.pow(H,G);const X=E.eql(ee,E.ONE);D=E.mul(M,j),j=E.mul(j,j),ee=E.mul(H,j),M=E.cmov(D,M,X),H=E.cmov(ee,H,X)}return{isValid:z,value:M}};if(E.ORDER%h===g){const U=(E.ORDER-g)/h,x=E.sqrt(E.neg(b));k=(j,D)=>{let M=E.sqr(D);const L=E.mul(j,D);M=E.mul(M,L);let H=E.pow(M,U);H=E.mul(H,L);const z=E.mul(H,x),V=E.mul(E.sqr(H),D),G=E.eql(V,j);let ee=E.cmov(z,H,G);return{isValid:G,value:ee}}}return k}function v(E,b){if((0,r.validateField)(E),!E.isValid(b.A)||!E.isValid(b.B)||
306!E.isValid(b.Z))throw new Error("mapToCurveSimpleSWU: invalid opts");const m=I(E,b.Z);if(!E.isOdd)throw new Error("Fp.isOdd is not implemented!");return _=>{let O,C,S,T,N,R,B,A;O=E.sqr(_),O=E.mul(O,b.Z),C=E.sqr(O),C=E.add(C,O),S=E.add(C,E.ONE),S=E.mul(S,b.B),T=E.cmov(b.Z,E.neg(C),!E.eql(C,E.ZERO)),T=E.mul(T,b.A),C=E.sqr(S),R=E.sqr(T),N=E.mul(R,b.A),C=E.add(C,N),C=E.mul(C,S),R=E.mul(R,T),N=E.mul(R,b.B),C=E.add(C,N),B=E.mul(O,S);const{isValid:P,value:k}=m(C,R);A=E.mul(O,_),A=E.mul(A,k),B=E.cmov(B,S,P),A=E.cmov(A,k,P);const U=E.isOdd(_)===E.isOdd(A);return A=E.cmov(E.neg(A),A,U),B=E.div(B,T),{x:B,y:A}}}}(wS)),wS}var Yj;function Mve(){if(Yj)return Lg;Yj=1,Object.defineProperty(Lg,"__esModule",{value:!0}),Lg.getHash=n,Lg.createCurve=s;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const t=Dve(),e=Xd(),r=_z();function n(i){return{hash:i,hmac:(o,...a)=>(0,t.hmac)(i,o,(0,e.concatBytes)(...a)),randomBytes:e.randomBytes}}function s(i,o){const a=c=>(0,r.weierstrass)({...i,...n(c)});return{...a(o),create:a}}return Lg}var Fc={},Jj;function $ve(){if(Jj)return Fc;Jj=1,Object.defineProperty(Fc,"__esModule",{value:!0}),Fc.expand_message_xmd=o,Fc.expand_message_xof=a,Fc.hash_to_field=c,Fc.isogenyMap=u,Fc.createHasher=l;const t=OC(),e=Ip(),r=e.bytesToNumberBE;function n(d,f){if(i(d),i(f),d<0||d>=1<<8*f)throw new Error("invalid I2OSP input: "+d);const g=Array.from({length:f}).fill(0);for(let h=f-1;h>=0;h--)g[h]=d&255,d>>>=8;return new Uint8Array(g)}function s(d,f){const g=new Uint8Array(d.length);for(let h=0;h<d.length;h++)g[h]=d[h]^f[h];return g}function i(d){if(!Number.isSafeInteger(d))throw new Error("number expected")}function o(d,f,g,h){(0,e.abytes)(d),(0,e.abytes)(f),i(g),f.length>255&&(f=h((0,e.concatBytes)((0,e.utf8ToBytes)("H2C-OVERSIZE-DST-"),f)));const{outputLen:p,blockLen:y}=h,w=Math.ceil(g/p);if(g>65535||w>255)throw new Error("expand_message_xmd: invalid lenInBytes");const I=(0,e.concatBytes)(f,n(f.length,1)),v=n(0,y),E=n(g,2),b=new Array(w),m=h((0,e.concatBytes)(v,d,E,n(0,1),I));b[0]=h((0,e.concatBytes)(m,n(1,1),I));for(let O=1;O<=w;O++){const C=[s(m,b[O-1]),n(O+1,1),I];b[O]=h((0,e.concatBytes)(...C))}return(0,e.concatBytes)(...b).slice(0,g)}function a(d,f,g,h,p){if((0,e.abytes)(d),(0,e.abytes)(f),i(g),f.length>255){const y=Math.ceil(2*h/8);f=p.create({dkLen:y}).update((0,e.utf8ToBytes)("H2C-OVERSIZE-DST-")).update(f).digest()}if(g>65535||f.length>255)throw new Error("expand_message_xof: invalid lenInBytes");return p.create({dkLen:g}).update(d).update(n(g,2)).update(f).update(n(f.length,1)).digest()}function c(d,f,g){(0,e.validateObject)(g,{DST:"stringOrUint8Array",p:"bigint",m:"isSafeInteger",k:"isSafeInteger",hash:"hash"});const{p:h,k:p,m:y,hash:w,expand:I,DST:v}=g;(0,e.abytes)(d),i(f);const E=typeof v=="string"?(0,e.utf8ToBytes)(v):v,b=h.toString(2).length,m=Math.ceil((b+p)/8),_=f*y*m;let O;if(I==="xmd")O=o(d,E,_,w);else if(I==="xof")O=a(d,E,_,p,w);else if(I==="_internal_pass")O=d;else throw new Error('expand must be "xmd" or "xof"');const C=new Array(f);for(let S=0;S<f;S++){const T=new Array(y);for(let N=0;N<y;N++){const R=m*(N+S*y),B=O.subarray(R,R+m);T[N]=(0,t.mod)(r(B),h)}C[S]=T}return C}function u(d,f){const g=f.map(h=>Array.from(h).reverse());return(h,p)=>{const[y,w,I,v]=g.map(E=>E.reduce((b,m)=>d.add(d.mul(b,h),m)));return h=d.div(y,w),p=d.mul(p,d.div(I,v)),{x:h,y:p}}}function l(d,f,g){if(typeof f!="function")throw new Error("mapToCurve() must be defined");return{hashToCurve(h,p){const y=c(h,2,{...g,DST:g.DST,...p}),w=d.fromAffine(f(y[0])),I=d.fromAffine(f(y[1])),v=w.add(I).clearCofactor();return v.assertValidity(),v},encodeToCurve(h,p){const y=c(h,1,{...g,DST:g.encodeDST,...p}),w=d.fromAffine(f(y[0])).clearCofactor();return w.assertValidity(),w},mapToCurve(h){if(!Array.isArray(h))throw new Error("mapToCurve: expected array of bigints");for(const y of h)if(typeof y!="bigint")throw new Error("mapToCurve: expected array of bigints");const p=d.fromAffine(f(h)).clearCofactor();return p.assertValidity(),p}}}return Fc}var Qj;function j0(){return Qj||(Qj=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.encodeToCurve=t.hashToCurve=t.schnorr=t.secp256k1=void 0;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const e=vz(),r=Xd(),n=Mve(),s=$ve(),i=OC(),o=Ip(),a=_z(),c=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),u=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),l=BigInt(1),d=BigInt(2),f=(U,x)=>(U+x/d)/x;function g(U){const x=c,j=BigInt(3),D=BigInt(6),M=BigInt(11),L=BigInt(22),H=BigInt(23),z=BigInt(44),V=BigInt(88),G=U*U*U%x,ee=G*G*U%x,X=(0,i.pow2)(ee,j,x)*ee%x,oe=(0,i.pow2)(X,j,x)*ee%x,te=(0,i.pow2)(oe,d,x)*G%x,fe=(0,i.pow2)(te,M,x)*te%x,Se=(0,i.pow2)(fe,L,x)*fe%x,le=(0,i.pow2)(Se,z,x)*Se%x,we=(0,i.pow2)(le,V,x)*le%x,ve=(0,i.pow2)(we,z,x)*Se%x,ae=(0,i.pow2)(ve,j,x)*ee%x,re=(0,i.pow2)(ae,H,x)*fe%x,wt=(0,i.pow2)(re,D,x)*G%x,Ot=(0,i.pow2)(wt,d,x);if(!h.eql(h.sqr(Ot),U))throw new Error("Cannot find square root");return Ot}const h=(0,i.Field)(c,void 0,void 0,{sqrt:g});t.secp256k1=(0,n.createCurve)({a:BigInt(0),b:BigInt(7),Fp:h,n:u,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:U=>{const x=u,j=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),D=-l*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),M=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),L=j,H=BigInt("0x100000000000000000000000000000000"),z=f(L*U,x),V=f(-D*U,x);let G=(0,i.mod)(U-z*j-V*M,x),ee=(0,i.mod)(-z*D-V*L,x);const X=G>H,oe=ee>H;if(X&&(G=x-G),oe&&(ee=x-ee),G>H||ee>H)throw new Error("splitScalar: Endomorphism failed, k="+U);return{k1neg:X,k1:G,k2neg:oe,k2:ee}}}},e.sha256);const p=BigInt(0),y={};function w(U,...x){let j=y[U];if(j===void 0){const D=(0,e.sha256)(Uint8Array.from(U,M=>
306M.charCodeAt(0)));j=(0,o.concatBytes)(D,D),y[U]=j}return(0,e.sha256)((0,o.concatBytes)(j,...x))}const I=U=>U.toRawBytes(!0).slice(1),v=U=>(0,o.numberToBytesBE)(U,32),E=U=>(0,i.mod)(U,c),b=U=>(0,i.mod)(U,u),m=t.secp256k1.ProjectivePoint,_=(U,x,j)=>m.BASE.multiplyAndAddUnsafe(U,x,j);function O(U){let x=t.secp256k1.utils.normPrivateKeyToScalar(U),j=m.fromPrivateKey(x);return{scalar:j.hasEvenY()?x:b(-x),bytes:I(j)}}function C(U){(0,o.aInRange)("x",U,l,c);const x=E(U*U),j=E(x*U+BigInt(7));let D=g(j);D%d!==p&&(D=E(-D));const M=new m(U,D,l);return M.assertValidity(),M}const S=o.bytesToNumberBE;function T(...U){return b(S(w("BIP0340/challenge",...U)))}function N(U){return O(U).bytes}function R(U,x,j=(0,r.randomBytes)(32)){const D=(0,o.ensureBytes)("message",U),{bytes:M,scalar:L}=O(x),H=(0,o.ensureBytes)("auxRand",j,32),z=v(L^S(w("BIP0340/aux",H))),V=w("BIP0340/nonce",z,M,D),G=b(S(V));if(G===p)throw new Error("sign failed: k is zero");const{bytes:ee,scalar:X}=O(G),oe=T(ee,M,D),te=new Uint8Array(64);if(te.set(ee,0),te.set(v(b(X+oe*L)),32),!B(te,D,M))throw new Error("sign: Invalid signature produced");return te}function B(U,x,j){const D=(0,o.ensureBytes)("signature",U,64),M=(0,o.ensureBytes)("message",x),L=(0,o.ensureBytes)("publicKey",j,32);try{const H=C(S(L)),z=S(D.subarray(0,32));if(!(0,o.inRange)(z,l,c))return!1;const V=S(D.subarray(32,64));if(!(0,o.inRange)(V,l,u))return!1;const G=T(v(z),I(H),M),ee=_(H,V,b(-G));return!(!ee||!ee.hasEvenY()||ee.toAffine().x!==z)}catch{return!1}}t.schnorr={getPublicKey:N,sign:R,verify:B,utils:{randomPrivateKey:t.secp256k1.utils.randomPrivateKey,lift_x:C,pointToBytes:I,numberToBytesBE:o.numberToBytesBE,bytesToNumberBE:o.bytesToNumberBE,taggedHash:w,mod:i.mod}};const A=(0,s.isogenyMap)(h,[["0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa8c7","0x7d3d4c80bc321d5b9f315cea7fd44c5d595d2fc0bf63b92dfff1044f17c6581","0x534c328d23f234e6e2a413deca25caece4506144037c40314ecbd0b53d9dd262","0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa88c"],["0xd35771193d94918a9ca34ccbb7b640dd86cd409542f8487d9fe6b745781eb49b","0xedadc6f64383dc1df7c4b2d51b54225406d36b641f5e41bbc52a56612a8c6d14","0x0000000000000000000000000000000000000000000000000000000000000001"],["0x4bda12f684bda12f684bda12f684bda12f684bda12f684bda12f684b8e38e23c","0xc75e0c32d5cb7c0fa9d0a54b12a0a6d5647ab046d686da6fdffc90fc201d71a3","0x29a6194691f91a73715209ef6512e576722830a201be2018a765e85a9ecee931","0x2f684bda12f684bda12f684bda12f684bda12f684bda12f684bda12f38e38d84"],["0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffff93b","0x7a06534bb8bdb49fd5e9e6632722c2989467c1bfc8e8d978dfb425d2685c2573","0x6484aa716545ca2cf3a70c3fa8fe337e0a3d21162f0d6299a7bf8192bfd2a76f","0x0000000000000000000000000000000000000000000000000000000000000001"]].map(U=>U.map(x=>BigInt(x)))),P=(0,a.mapToCurveSimpleSWU)(h,{A:BigInt("0x3f8731abdd661adca08a5558f0f5d272e953d363cb6f0e5d405447c01a444533"),B:BigInt("1771"),Z:h.create(BigInt("-11"))}),k=(0,s.createHasher)(t.secp256k1.ProjectivePoint,U=>{const{x,y:j}=P(h.create(U[0]));return A(x,j)},{DST:"secp256k1_XMD:SHA-256_SSWU_RO_",encodeDST:"secp256k1_XMD:SHA-256_SSWU_NU_",p:h.ORDER,m:1,k:128,expand:"xmd",hash:e.sha256});t.hashToCurve=k.hashToCurve,t.encodeToCurve=k.encodeToCurve}(yS)),yS}var Xj;function pN(){if(Xj)return Pw;Xj=1,Object.defineProperty(Pw,"__esModule",{value:!0}),Pw.recoverPublicKey=n;const t=Qn(),e=Lr(),r=Be();async function n({hash:i,signature:o}){const a=(0,t.isHex)(i)?i:(0,r.toHex)(i),{secp256k1:c}=await Promise.resolve().then(()=>j0());return`0x${(()=>{if(typeof o=="object"&&"r"in o&&"s"in o){const{r:h,s:p,v:y,yParity:w}=o,I=Number(w??y),v=s(I);return new c.Signature((0,e.hexToBigInt)(h),(0,e.hexToBigInt)(p)).addRecoveryBit(v)}const d=(0,t.isHex)(o)?o:(0,r.toHex)(o),f=(0,e.hexToNumber)(`0x${d.slice(130)}`),g=s(f);return c.Signature.fromCompact(d.substring(2,130)).addRecoveryBit(g)})().recoverPublicKey(a.substring(2)).toHex(!1)}`}function s(i){if(i===0||i===1)return i;if(i===27)return 0;if(i===28)return 1;throw new Error("Invalid yParityOrV value")}return Pw}var e8;function Vu(){if(e8)return Sw;e8=1,Object.defineProperty(Sw,"__esModule",{value:!0}),Sw.recoverAddress=r;const t=wz(),e=pN();async function r({hash:n,signature:s}){return(0,t.publicKeyToAddress)(await(0,e.recoverPublicKey)({hash:n,signature:s}))}return Sw}var Ow={},Of={},t8;function D0(){if(t8)return Of;
306t8=1,Object.defineProperty(Of,"__esModule",{value:!0}),Of.toRlp=s,Of.bytesToRlp=i,Of.hexToRlp=o;const t=ut(),e=R0(),r=Yt(),n=Be();function s(d,f="hex"){const g=a(d),h=(0,e.createCursor)(new Uint8Array(g.length));return g.encode(h),f==="hex"?(0,n.bytesToHex)(h.bytes):h.bytes}function i(d,f="bytes"){return s(d,f)}function o(d,f="hex"){return s(d,f)}function a(d){return Array.isArray(d)?c(d.map(f=>a(f))):u(d)}function c(d){const f=d.reduce((p,y)=>p+y.length,0),g=l(f);return{length:f<=55?1+f:1+g+f,encode(p){f<=55?p.pushByte(192+f):(p.pushByte(247+g),g===1?p.pushUint8(f):g===2?p.pushUint16(f):g===3?p.pushUint24(f):p.pushUint32(f));for(const{encode:y}of d)y(p)}}}function u(d){const f=typeof d=="string"?(0,r.hexToBytes)(d):d,g=l(f.length);return{length:f.length===1&&f[0]<128?1:f.length<=55?1+f.length:1+g+f.length,encode(p){f.length===1&&f[0]<128?p.pushBytes(f):f.length<=55?(p.pushByte(128+f.length),p.pushBytes(f)):(p.pushByte(183+g),g===1?p.pushUint8(f.length):g===2?p.pushUint16(f.length):g===3?p.pushUint24(f.length):p.pushUint32(f.length),p.pushBytes(f))}}}function l(d){if(d<2**8)return 1;if(d<2**16)return 2;if(d<2**24)return 3;if(d<2**32)return 4;throw new t.BaseError("Length is too large.")}return Of}var r8;function Lve(){if(r8)return Ow;r8=1,Object.defineProperty(Ow,"__esModule",{value:!0}),Ow.hashAuthorization=i;const t=Xn(),e=Yt(),r=Be(),n=D0(),s=Is();function i(o){const{chainId:a,contractAddress:c,nonce:u,to:l}=o,d=(0,s.keccak256)((0,t.concatHex)(["0x05",(0,n.toRlp)([a?(0,r.numberToHex)(a):"0x",c,u?(0,r.numberToHex)(u):"0x"])]));return l==="bytes"?(0,e.hexToBytes)(d):d}return Ow}var n8;function Az(){if(n8)return Iw;n8=1,Object.defineProperty(Iw,"__esModule",{value:!0}),Iw.recoverAuthorizationAddress=r;const t=Vu(),e=Lve();async function r(n){const{authorization:s,signature:i}=n;return(0,t.recoverAddress)({hash:(0,e.hashAuthorization)(s),signature:i??s})}return Iw}var Nw={},Fg={},s8;function Cz(){if(s8)return Fg;s8=1,Object.defineProperty(Fg,"__esModule",{value:!0}),Fg.EstimateGasExecutionError=void 0;const t=k0(),e=rf(),r=ut(),n=Zs();class s extends r.BaseError{constructor(o,{account:a,docsPath:c,chain:u,data:l,gas:d,gasPrice:f,maxFeePerGas:g,maxPriorityFeePerGas:h,nonce:p,to:y,value:w}){var v;const I=(0,n.prettyPrint)({from:a==null?void 0:a.address,to:y,value:typeof w<"u"&&`${(0,t.formatEther)(w)} ${((v=u==null?void 0:u.nativeCurrency)==null?void 0:v.symbol)||"ETH"}`,data:l,gas:d,gasPrice:typeof f<"u"&&`${(0,e.formatGwei)(f)} gwei`,maxFeePerGas:typeof g<"u"&&`${(0,e.formatGwei)(g)} gwei`,maxPriorityFeePerGas:typeof h<"u"&&`${(0,e.formatGwei)(h)} gwei`,nonce:p});super(o.shortMessage,{cause:o,docsPath:c,metaMessages:[...o.metaMessages?[...o.metaMessages," "]:[],"Estimate Gas Arguments:",I].filter(Boolean),name:"EstimateGasExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=o}}return Fg.EstimateGasExecutionError=s,Fg}var Ht={},i8;function pc(){if(i8)return Ht;i8=1,Object.defineProperty(Ht,"__esModule",{value:!0}),Ht.UnknownNodeError=Ht.TipAboveFeeCapError=Ht.TransactionTypeNotSupportedError=Ht.IntrinsicGasTooLowError=Ht.IntrinsicGasTooHighError=Ht.InsufficientFundsError=Ht.NonceMaxValueError=Ht.NonceTooLowError=Ht.NonceTooHighError=Ht.FeeCapTooLowError=Ht.FeeCapTooHighError=Ht.ExecutionRevertedError=void 0;const t=rf(),e=ut();class r extends e.BaseError{constructor({cause:p,message:y}={}){var I;const w=(I=y==null?void 0:y.replace("execution reverted: ",""))==null?void 0:I.replace("execution reverted","");super(`Execution reverted ${w?`with reason: ${w}`:"for an unknown reason"}.`,{cause:p,name:"ExecutionRevertedError"})}}Ht.ExecutionRevertedError=r,Object.defineProperty(r,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(r,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted/});class n extends e.BaseError{constructor({cause:p,maxFeePerGas:y}={}){super(`The fee cap (\`maxFeePerGas\`${y?` = ${(0,t.formatGwei)(y)} gwei`:""}) cannot be higher than the maximum allowed value (2^256-1).`,{cause:p,name:"FeeCapTooHighError"})}}Ht.FeeCapTooHighError=n,Object.defineProperty(n,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas higher than 2\^256-1|fee cap higher than 2\^256-1/});class s extends e.BaseError{constructor({cause:p,maxFeePerGas:y}={}){super(`The fee cap (\`maxFeePerGas\`${y?` = ${(0,t.formatGwei)(y)}`:""} gwei) cannot be lower than the block base fee.`,{cause:p,name:"FeeCapTooLowError"})}}Ht.FeeCapTooLowError=s,Object.defineProperty(s,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas less than block base fee|fee cap less than block base fee|transaction is outdated/});class i extends e.BaseError{constructor({cause:p,nonce:y}={}){super(`Nonce provided for the transaction ${y?`(${y}) `:""}is higher than the next one expected.`,{cause:p,name:"NonceTooHighError"})}}Ht.NonceTooHighError=i,Object.defineProperty(i,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too high/});class o extends e.BaseError{constructor({cause:p,nonce:y}={}){super([`Nonce provided for the transaction ${y?`(${y}) `:""}is lower than the current nonce of the account.`,"Try increasing the nonce or find the latest nonce with `getTransactionCount`."].join(`
307`),{cause:p,name:"NonceTooLowError"})}}Ht.NonceTooLowError=o,Object.defineProperty(o,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too low|transaction already imported|already known/});class a extends e.BaseError{constructor({cause:p,nonce:y}={}){super(`Nonce provided for the transaction ${y?`(${y}) `:""}exceeds the maximum allowed nonce.`,{cause:p,name:"NonceMaxValueError"})}}Ht.NonceMaxValueError=a,Object.defineProperty(a,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce has max value/});class c extends e.BaseError{constructor({cause:p}={}){super(["The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account."].join(`
308`),{cause:p,metaMessages:["This error could arise when the account does not have enough funds to:"," - pay for the total gas fee,"," - pay for the value to send."," ","The cost of the transaction is calculated as `gas * gas fee + value`, where:"," - `gas` is the amount of gas needed for transaction to execute,"," - `gas fee` is the gas fee,"," - `value` is the amount of ether to send to the recipient."],name:"InsufficientFundsError"})}}Ht.InsufficientFundsError=c,Object.defineProperty(c,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/insufficient funds|exceeds transaction sender account balance/});class u extends e.BaseError{constructor({cause:p,gas:y}={}){super(`The amount of gas ${y?`(${y}) `:""}provided for the transaction exceeds the limit allowed for the block.`,{cause:p,name:"IntrinsicGasTooHighError"})}}Ht.IntrinsicGasTooHighError=u,Object.defineProperty(u,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too high|gas limit reached/});class l extends e.BaseError{constructor({cause:p,gas:y}={}){super(`The amount of gas ${y?`(${y}) `:""}provided for the transaction is too low.`,{cause:p,name:"IntrinsicGasTooLowError"})}}Ht.IntrinsicGasTooLowError=l,Object.defineProperty(l,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too low/});class d extends e.BaseError{constructor({cause:p}){super("The transaction type is not supported for this chain.",{cause:p,name:"TransactionTypeNotSupportedError"})}}Ht.TransactionTypeNotSupportedError=d,Object.defineProperty(d,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/transaction type not valid/});class f extends e.BaseError{constructor({cause:p,maxPriorityFeePerGas:y,maxFeePerGas:w}={}){super([`The provided tip (\`maxPriorityFeePerGas\`${y?` = ${(0,t.formatGwei)(y)} gwei`:""}) cannot be higher than the fee cap (\`maxFeePerGas\`${w?` = ${(0,t.formatGwei)(w)} gwei`:""}).`].join(`
309`),{cause:p,name:"TipAboveFeeCapError"})}}
309Ht.TipAboveFeeCapError=f,Object.defineProperty(f,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max priority fee per gas higher than max fee per gas|tip higher than fee cap/});class g extends e.BaseError{constructor({cause:p}){super(`An error occurred while executing: ${p==null?void 0:p.shortMessage}`,{cause:p,name:"UnknownNodeError"})}}return Ht.UnknownNodeError=g,Ht}var Hg={},o8;function U0(){if(o8)return Hg;o8=1,Object.defineProperty(Hg,"__esModule",{value:!0}),Hg.containsNodeError=s,Hg.getNodeError=i;const t=ut(),e=pc(),r=no(),n=nf();function s(o){return o instanceof n.TransactionRejectedRpcError||o instanceof n.InvalidInputRpcError||o instanceof r.RpcRequestError&&o.code===e.ExecutionRevertedError.code}function i(o,a){const c=(o.details||"").toLowerCase(),u=o instanceof t.BaseError?o.walk(l=>(l==null?void 0:l.code)===e.ExecutionRevertedError.code):o;return u instanceof t.BaseError?new e.ExecutionRevertedError({cause:o,message:u.details}):e.ExecutionRevertedError.nodeMessage.test(c)?new e.ExecutionRevertedError({cause:o,message:o.details}):e.FeeCapTooHighError.nodeMessage.test(c)?new e.FeeCapTooHighError({cause:o,maxFeePerGas:a==null?void 0:a.maxFeePerGas}):e.FeeCapTooLowError.nodeMessage.test(c)?new e.FeeCapTooLowError({cause:o,maxFeePerGas:a==null?void 0:a.maxFeePerGas}):e.NonceTooHighError.nodeMessage.test(c)?new e.NonceTooHighError({cause:o,nonce:a==null?void 0:a.nonce}):e.NonceTooLowError.nodeMessage.test(c)?new e.NonceTooLowError({cause:o,nonce:a==null?void 0:a.nonce}):e.NonceMaxValueError.nodeMessage.test(c)?new e.NonceMaxValueError({cause:o,nonce:a==null?void 0:a.nonce}):e.InsufficientFundsError.nodeMessage.test(c)?new e.InsufficientFundsError({cause:o}):e.IntrinsicGasTooHighError.nodeMessage.test(c)?new e.IntrinsicGasTooHighError({cause:o,gas:a==null?void 0:a.gas}):e.IntrinsicGasTooLowError.nodeMessage.test(c)?new e.IntrinsicGasTooLowError({cause:o,gas:a==null?void 0:a.gas}):e.TransactionTypeNotSupportedError.nodeMessage.test(c)?new e.TransactionTypeNotSupportedError({cause:o}):e.TipAboveFeeCapError.nodeMessage.test(c)?new e.TipAboveFeeCapError({cause:o,maxFeePerGas:a==null?void 0:a.maxFeePerGas,maxPriorityFeePerGas:a==null?void 0:a.maxPriorityFeePerGas}):new e.UnknownNodeError({cause:o})}return Hg}var a8;function Iz(){if(a8)return Nw;a8=1,Object.defineProperty(Nw,"__esModule",{value:!0}),Nw.getEstimateGasError=n;const t=Cz(),e=pc(),r=U0();function n(s,{docsPath:i,...o}){const a=(()=>{const c=(0,r.getNodeError)(s,o);return c instanceof e.UnknownNodeError?s:c})();return new t.EstimateGasExecutionError(a,{docsPath:i,...o})}return Nw}var xw={},c8;function Up(){if(c8)return xw;c8=1,Object.defineProperty(xw,"__esModule",{value:!0}),xw.extract=t;function t(e,{format:r}){if(!r)return{};const n={};function s(o){const a=Object.keys(o);for(const c of a)c in e&&(n[c]=e[c]),o[c]&&typeof o[c]=="object"&&!Array.isArray(o[c])&&s(o[c])}const i=r(e||{});return s(i),n}return xw}var ES={},Rw={},u8;function M0(){if(u8)return Rw;u8=1,Object.defineProperty(Rw,"__esModule",{value:!0}),Rw.defineFormatter=t;function t(e,r){return({exclude:n,format:s})=>({exclude:n,format:i=>{const o=r(i);if(n)for(const a of n)delete o[a];return{...o,...s(i)}},type:e})}return Rw}var l8;function gc(){return l8||(l8=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.defineTransactionRequest=t.rpcTransactionType=void 0,t.formatTransactionRequest=n;const e=Be(),r=M0();t.rpcTransactionType={legacy:"0x0",eip2930:"0x1",eip1559:"0x2",eip4844:"0x3",eip7702:"0x4"};function n(i){const o={};return typeof i.authorizationList<"u"&&(o.authorizationList=s(i.authorizationList)),typeof i.accessList<"u"&&(o.accessList=i.accessList),typeof i.blobVersionedHashes<"u"&&(o.blobVersionedHashes=i.blobVersionedHashes),typeof i.blobs<"u"&&(typeof i.blobs[0]!="string"?o.blobs=i.blobs.map(a=>(0,e.bytesToHex)(a)):o.blobs=i.blobs),typeof i.data<"u"&&(o.data=i.data),typeof i.from<"u"&&(o.from=i.from),typeof i.gas<"u"&&(o.gas=(0,e.numberToHex)(i.gas)),typeof i.gasPrice<"u"&&(o.gasPrice=(0,e.numberToHex)(i.gasPrice)),typeof i.maxFeePerBlobGas<"u"&&(o.maxFeePerBlobGas=(0,e.numberToHex)(i.maxFeePerBlobGas)),typeof i.maxFeePerGas<"u"&&(o.maxFeePerGas=(0,e.numberToHex)(i.maxFeePerGas)),typeof i.maxPriorityFeePerGas<"u"&&(o.maxPriorityFeePerGas=(0,e.numberToHex)(i.maxPriorityFeePerGas)),typeof i.nonce<"u"&&(o.nonce=(0,e.numberToHex)(i.nonce)),typeof i.to<"u"&&(o.to=i.to),typeof i.type<"u"&&(o.type=t.rpcTransactionType[i.type]),typeof i.value<"u"&&(o.value=(0,e.numberToHex)(i.value)),o}t.defineTransactionRequest=(0,r.defineFormatter)("transactionRequest",n);function s(i){return i.map(o=>({address:o.contractAddress,r:o.r,s:o.s,chainId:(0,e.numberToHex)(o.chainId),nonce:(0,e.numberToHex)(o.nonce),...typeof o.yParity<"u"?{yParity:(0,e.numberToHex)(o.yParity)}:{},...typeof o.v<"u"&&typeof o.yParity>"u"?{v:(0,e.numberToHex)(o.v)}:{}}))}}(ES)),ES}var Nf={},d8;function gN(){if(d8)return Nf;
309d8=1,Object.defineProperty(Nf,"__esModule",{value:!0}),Nf.serializeStateMapping=i,Nf.serializeAccountStateOverride=o,Nf.serializeStateOverride=a;const t=eo(),e=_C(),r=fN(),n=Ks(),s=Be();function i(c){if(!(!c||c.length===0))return c.reduce((u,{slot:l,value:d})=>{if(l.length!==66)throw new e.InvalidBytesLengthError({size:l.length,targetSize:66,type:"hex"});if(d.length!==66)throw new e.InvalidBytesLengthError({size:d.length,targetSize:66,type:"hex"});return u[l]=d,u},{})}function o(c){const{balance:u,nonce:l,state:d,stateDiff:f,code:g}=c,h={};if(g!==void 0&&(h.code=g),u!==void 0&&(h.balance=(0,s.numberToHex)(u)),l!==void 0&&(h.nonce=(0,s.numberToHex)(l)),d!==void 0&&(h.state=i(d)),f!==void 0){if(h.state)throw new r.StateAssignmentConflictError;h.stateDiff=i(f)}return h}function a(c){if(!c)return;const u={};for(const{address:l,...d}of c){if(!(0,n.isAddress)(l,{strict:!1}))throw new t.InvalidAddressError({address:l});if(u[l])throw new r.AccountStateConflictError({address:l});u[l]=o(d)}return u}return Nf}var Bw={},J={},f8;function mN(){return f8||(f8=1,Object.defineProperty(J,"__esModule",{value:!0}),J.minInt144=J.minInt136=J.minInt128=J.minInt120=J.minInt112=J.minInt104=J.minInt96=J.minInt88=J.minInt80=J.minInt72=J.minInt64=J.minInt56=J.minInt48=J.minInt40=J.minInt32=J.minInt24=J.minInt16=J.minInt8=J.maxInt256=J.maxInt248=J.maxInt240=J.maxInt232=J.maxInt224=J.maxInt216=J.maxInt208=J.maxInt200=J.maxInt192=J.maxInt184=J.maxInt176=J.maxInt168=J.maxInt160=J.maxInt152=J.maxInt144=J.maxInt136=J.maxInt128=J.maxInt120=J.maxInt112=J.max
309Int104=J.maxInt96=J.maxInt88=J.maxInt80=J.maxInt72=J.maxInt64=J.maxInt56=J.maxInt48=J.maxInt40=J.maxInt32=J.maxInt24=J.maxInt16=J.maxInt8=void 0,J.maxUint256=J.maxUint248=J.maxUint240=J.maxUint232=J.maxUint224=J.maxUint216=J.maxUint208=J.maxUint200=J.maxUint192=J.maxUint184=J.maxUint176=J.maxUint168=J.maxUint160=J.maxUint152=J.maxUint144=J.maxUint136=J.maxUint128=J.maxUint120=J.maxUint112=J.maxUint104=J.maxUint96=J.maxUint88=J.maxUint80=J.maxUint72=J.maxUint64=J.maxUint56=J.maxUint48=J.maxUint40=J.maxUint32=J.maxUint24=J.maxUint16=J.maxUint8=J.minInt256=J.minInt248=J.minInt240=J.minInt232=J.minInt224=J.minInt216=J.minInt208=J.minInt200=J.minInt192=J.minInt184=J.minInt176=J.minInt168=J.minInt160=J.minInt152=void 0,J.maxInt8=2n**(8n-1n)-1n,J.maxInt16=2n**(16n-1n)-1n,J.maxInt24=2n**(24n-1n)-1n,J.maxInt32=2n**(32n-1n)-1n,J.maxInt40=2n**(40n-1n)-1n,J.maxInt48=2n**(48n-1n)-1n,J.maxInt56=2n**(56n-1n)-1n,J.maxInt64=2n**(64n-1n)-1n,J.maxInt72=2n**(72n-1n)-1n,J.maxInt80=2n**(80n-1n)-1n,J.maxInt88=2n**(88n-1n)-1n,J.maxInt96=2n**(96n-1n)-1n,J.maxInt104=2n**(104n-1n)-1n,J.maxInt112=2n**(112n-1n)-1n,J.maxInt120=2n**(120n-1n)-1n,J.maxInt128=2n**(128n-1n)-1n,J.maxInt136=2n**(136n-1n)-1n,J.maxInt144=2n**(144n-1n)-1n,J.maxInt152=2n**(152n-1n)-1n,J.maxInt160=2n**(160n-1n)-1n,J.maxInt168=2n**(168n-1n)-1n,J.maxInt176=2n**(176n-1n)-1n,J.maxInt184=2n**(184n-1n)-1n,J.maxInt192=2n**(192n-1n)-1n,J.maxInt200=2n**(200n-1n)-1n,J.maxInt208=2n**(208n-1n)-1n,J.maxInt216=2n**(216n-1n)-1n,J.maxInt224=2n**(224n-1n)-1n,J.maxInt232=2n**(232n-1n)-1n,J.maxInt240=2n**(240n-1n)-1n,J.maxInt248=2n**(248n-1n)-1n,J.maxInt256=2n**(256n-1n)-1n,J.minInt8=-(2n**(8n-1n)),J.minInt16=-(2n**(16n-1n)),J.minInt24=-(2n**(24n-1n)),J.minInt32=-(2n**(32n-1n)),J.minInt40=-(2n**(40n-1n)),J.minInt48=-(2n**(48n-1n)),J.minInt56=-(2n**(56n-1n)),J.minInt64=-(2n**(64n-1n)),J.minInt72=-(2n**(72n-1n)),J.minInt80=-(2n**(80n-1n)),J.minInt88=-(2n**(88n-1n)),J.minInt96=-(2n**(96n-1n)),J.minInt104=-(2n**(104n-1n)),J.minInt112=-(2n**(112n-1n)),J.minInt120=-(2n**(120n-1n)),J.minInt128=-(2n**(128n-1n)),J.minInt136=-(2n**(136n-1n)),J.minInt144=-(2n**(144n-1n)),J.minInt152=-(2n**(152n-1n)),J.minInt160=-(2n**(160n-1n)),J.minInt168=-(2n**(168n-1n)),J.minInt176=-(2n**(176n-1n)),J.minInt184=-(2n**(184n-1n)),J.minInt192=-(2n**(192n-1n)),J.minInt200=-(2n**(200n-1n)),J.minInt208=-(2n**(208n-1n)),J.minInt216=-(2n**(216n-1n)),J.minInt224=-(2n**(224n-1n)),J.minInt232=-(2n**(232n-1n)),J.minInt240=-(2n**(240n-1n)),J.minInt248=-(2n**(248n-1n)),J.minInt256=-(2n**(256n-1n)),J.maxUint8=2n**8n-1n,J.maxUint16=2n**16n-1n,J.maxUint24=2n**24n-1n,J.maxUint32=2n**32n-1n,J.maxUint40=2n**40n-1n,J.maxUint48=2n**48n-1n,J.maxUint56=2n**56n-1n,J.maxUint64=2n**64n-1n,J.maxUint72=2n**72n-1n,J.maxUint80=2n**80n-1n,J.maxUint88=2n**88n-1n,J.maxUint96=2n**96n-1n,J.maxUint104=2n**104n-1n,J.maxUint112=2n**112n-1n,J.maxUint120=2n**120n-1n,J.maxUint128=2n**128n-1n,J.maxUint136=2n**136n-1n,J.maxUint144=2n**144n-1n,J.maxUint152=2n**152n-1n,J.maxUint160=2n**160n-1n,J.maxUint168=2n**168n-1n,J.maxUint176=2n**176n-1n,J.maxUint184=2n**184n-1n,J.maxUint192=2n**192n-1n,J.maxUint200=2n**200n-1n,J.maxUint208=2n**208n-1n,J.maxUint216=2n**216n-1n,J.maxUint224=2n**224n-1n,J.maxUint232=2n**232n-1n,J.maxUint240=2n**240n-1n,J.maxUint248=2n**248n-1n,J.maxUint256=2n**256n-1n),J}var h8;function mc(){if(h8)return Bw;h8=1,Object.defineProperty(Bw,"__esModule",{value:!0}),Bw.assertRequest=o;const t=pn(),e=mN(),r=eo(),n=pc(),s=Zs(),i=Ks();function o(a){const{account:c,gasPrice:u,maxFeePerGas:l,maxPriorityFeePerGas:d,to:f}=a,g=c?(0,t.parseAccount)(c):void 0;if(g&&!(0,i.isAddress)(g.address))throw new r.InvalidAddressError({address:g.address});if(f&&!(0,i.isAddress)(f))throw new r.InvalidAddressError({address:f});if(typeof u<"u"&&(typeof l<"u"||typeof d<"u"))throw new s.FeeConflictError;if(l&&l>e.maxUint256)throw new n.FeeCapTooHighError({maxFeePerGas:l});if(d&&l&&d>l)throw new n.TipAboveFeeCapError({maxFeePerGas:l,maxPriorityFeePerGas:d})}return Bw}var vS={},qg={},wa={},p8;function NC(){if(p8)return wa;p8=1,Object.defineProperty(wa,"__esModule",{value:!0}),wa.MaxFeePerGasTooLowError=wa.Eip1559FeesNotSupportedError=wa.BaseFeeScalarError=void 0;const t=rf(),e=ut();class r extends e.BaseError{constructor(){super("`baseFeeMultiplier` must be greater than 1.",{name:"BaseFeeScalarError"})}}wa.BaseFeeScalarError=r;class n extends e.BaseError{constructor(){super("Chain does not support EIP-1559 fees.",{name:"Eip1559FeesNotSupportedError"})}}wa.Eip1559FeesNotSupportedError=n;class s extends e.BaseError{constructor({maxPriorityFeePerGas:o}){super(`\`maxFeePerGas\` cannot be less than the \`maxPriorityFeePerGas\` (${(0,t.formatGwei)(o)} gwei).`,{name:"MaxFeePerGasTooLowError"})}}return wa.MaxFeePerGasTooLowError=s,wa}var zg={},kw={},Wg={},g8;function yN(){if(g8)return Wg;
309g8=1,Object.defineProperty(Wg,"__esModule",{value:!0}),Wg.BlockNotFoundError=void 0;const t=ut();class e extends t.BaseError{constructor({blockHash:n,blockNumber:s}){let i="Block";n&&(i=`Block at hash "${n}"`),s&&(i=`Block at number "${s}"`),super(`${i} could not be found.`,{name:"BlockNotFoundError"})}}return Wg.BlockNotFoundError=e,Wg}var xf={},_S={},m8;function $0(){return m8||(m8=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.defineTransaction=t.transactionType=void 0,t.formatTransaction=n;const e=Lr(),r=M0();t.transactionType={"0x0":"legacy","0x1":"eip2930","0x2":"eip1559","0x3":"eip4844","0x4":"eip7702"};function n(i){const o={...i,blockHash:i.blockHash?i.blockHash:null,blockNumber:i.blockNumber?BigInt(i.blockNumber):null,chainId:i.chainId?(0,e.hexToNumber)(i.chainId):void 0,gas:i.gas?BigInt(i.gas):void 0,gasPrice:i.gasPrice?BigInt(i.gasPrice):void 0,maxFeePerBlobGas:i.maxFeePerBlobGas?BigInt(i.maxFeePerBlobGas):void 0,maxFeePerGas:i.maxFeePerGas?BigInt(i.maxFeePerGas):void 0,maxPriorityFeePerGas:i.maxPriorityFeePerGas?BigInt(i.maxPriorityFeePerGas):void 0,nonce:i.nonce?(0,e.hexToNumber)(i.nonce):void 0,to:i.to?i.to:null,transactionIndex:i.transactionIndex?Number(i.transactionIndex):null,type:i.type?t.transactionType[i.type]:void 0,typeHex:i.type?i.type:void 0,value:i.value?BigInt(i.value):void 0,v:i.v?BigInt(i.v):void 0};return i.authorizationList&&(o.authorizationList=s(i.authorizationList)),o.yParity=(()=>{if(i.yParity)return Number(i.yParity);if(typeof o.v=="bigint"){if(o.v===0n||o.v===27n)return 0;if(o.v===1n||o.v===28n)return 1;if(o.v>=35n)return o.v%2n===0n?1:0}})(),o.type==="legacy"&&(delete o.accessList,delete o.maxFeePerBlobGas,delete o.maxFeePerGas,delete o.maxPriorityFeePerGas,delete o.yParity),o.type==="eip2930"&&(delete o.maxFeePerBlobGas,delete o.maxFeePerGas,delete o.maxPriorityFeePerGas),o.type==="eip1559"&&delete o.maxFeePerBlobGas,o}t.defineTransaction=(0,r.defineFormatter)("transaction",n);function s(i){return i.map(o=>({contractAddress:o.address,chainId:Number(o.chainId),nonce:Number(o.nonce),r:o.r,s:o.s,yParity:Number(o.yParity)}))}}(_S)),_S}var y8;function xC(){if(y8)return xf;y8=1,Object.defineProperty(xf,"__esModule",{value:!0}),xf.defineBlock=void 0,xf.formatBlock=r;const t=M0(),e=$0();function r(n){const s=(n.transactions??[]).map(i=>typeof i=="string"?i:(0,e.formatTransaction)(i));return{...n,baseFeePerGas:n.baseFeePerGas?BigInt(n.baseFeePerGas):null,blobGasUsed:n.blobGasUsed?BigInt(n.blobGasUsed):void 0,difficulty:n.difficulty?BigInt(n.difficulty):void 0,excessBlobGas:n.excessBlobGas?BigInt(n.excessBlobGas):void 0,gasLimit:n.gasLimit?BigInt(n.gasLimit):void 0,gasUsed:n.gasUsed?BigInt(n.gasUsed):void 0,hash:n.hash?n.hash:null,logsBloom:n.logsBloom?n.logsBloom:null,nonce:n.nonce?n.nonce:null,number:n.number?BigInt(n.number):null,size:n.size?BigInt(n.size):void 0,timestamp:n.timestamp?BigInt(n.timestamp):void 0,transactions:s,totalDifficulty:n.totalDifficulty?BigInt(n.totalDifficulty):null}}return xf.defineBlock=(0,t.defineFormatter)("block",r),xf}var b8;function Mp(){if(b8)return kw;b8=1,Object.defineProperty(kw,"__esModule",{value:!0}),kw.getBlock=n;const t=yN(),e=Be(),r=xC();async function n(s,{blockHash:i,blockNumber:o,blockTag:a,includeTransactions:c}={}){var h,p,y;const u=a??"latest",l=c??!1,d=o!==void 0?(0,e.numberToHex)(o):void 0;let f=null;if(i?f=await s.request({method:"eth_getBlockByHash",params:[i,l]},{dedupe:!0}):f=await s.request({method:"eth_getBlockByNumber",params:[d||u,l]},{dedupe:!!d}),!f)throw new t.BlockNotFoundError({blockHash:i,blockNumber:o});return(((y=(p=(h=s.chain)==null?void 0:h.formatters)==null?void 0:p.block)==null?void 0:y.format)||r.formatBlock)(f)}return kw}var jw={},w8;function bN(){if(w8)return jw;w8=1,Object.defineProperty(jw,"__esModule",{value:!0}),jw.getGasPrice=t;async function t(e){const r=await e.request({method:"eth_gasPrice"});return BigInt(r)}return jw}var E8;function Sz(){if(E8)return zg;E8=1,Object.defineProperty(zg,"__esModule",{value:!0}),zg.estimateMaxPriorityFeePerGas=i,zg.internal_estimateMaxPriorityFeePerGas=o;const t=NC(),e=Lr(),r=Vt(),n=Mp(),s=bN();async function i(a,c){return o(a,c)}async function o(a,c){var f,g;const{block:u,chain:l=a.chain,request:d}=c||{};try{const h=((f=l==null?void 0:l.fees)==null?void 0:f.maxPriorityFeePerGas)??((g=l==null?void 0:l.fees)==null?void 0:g.defaultPriorityFee);if(typeof h=="function"){const y=u||await(0,r.getAction)(a,n.getBlock,"getBlock")({}),w=await h({block:y,client:a,request:d});if(w===null)throw new Error;return w}if(typeof h<"u")return h;const p=await a.request({method:"eth_maxPriorityFeePerGas"});return(0,e.hexToBigInt)(p)}catch{const[h,p]=await Promise.all([u?Promise.resolve(u):(0,r.getAction)(a,n.getBlock,"getBlock")({}),(0,r.getAction)(a,s.getGasPrice,"getGasPrice")({})]);if(typeof h.baseFeePerGas!="bigint")throw new t.Eip1559FeesNotSupportedError;const y=p-h.baseFeePerGas;return y<0n?0n:y}}return zg}var v8;function Tz(){if(v8)return qg;
309v8=1,Object.defineProperty(qg,"__esModule",{value:!0}),qg.estimateFeesPerGas=i,qg.internal_estimateFeesPerGas=o;const t=NC(),e=Vt(),r=Sz(),n=Mp(),s=bN();async function i(a,c){return o(a,c)}async function o(a,c){var v,E;const{block:u,chain:l=a.chain,request:d,type:f="eip1559"}=c||{},g=await(async()=>{var b,m;return typeof((b=l==null?void 0:l.fees)==null?void 0:b.baseFeeMultiplier)=="function"?l.fees.baseFeeMultiplier({block:u,client:a,request:d}):((m=l==null?void 0:l.fees)==null?void 0:m.baseFeeMultiplier)??1.2})();if(g<1)throw new t.BaseFeeScalarError;const p=10**(((v=g.toString().split(".")[1])==null?void 0:v.length)??0),y=b=>b*BigInt(Math.ceil(g*p))/BigInt(p),w=u||await(0,e.getAction)(a,n.getBlock,"getBlock")({});if(typeof((E=l==null?void 0:l.fees)==null?void 0:E.estimateFeesPerGas)=="function"){const b=await l.fees.estimateFeesPerGas({block:u,client:a,multiply:y,request:d,type:f});if(b!==null)return b}if(f==="eip1559"){if(typeof w.baseFeePerGas!="bigint")throw new t.Eip1559FeesNotSupportedError;const b=typeof(d==null?void 0:d.maxPriorityFeePerGas)=="bigint"?d.maxPriorityFeePerGas:await(0,r.internal_estimateMaxPriorityFeePerGas)(a,{block:w,chain:l,request:d}),m=y(w.baseFeePerGas);return{maxFeePerGas:(d==null?void 0:d.maxFeePerGas)??m+b,maxPriorityFeePerGas:b}}return{gasPrice:(d==null?void 0:d.gasPrice)??y(await(0,e.getAction)(a,s.getGasPrice,"getGasPrice")({}))}}return qg}var Dw={},_8;function wN(){if(_8)return Dw;_8=1,Object.defineProperty(Dw,"__esModule",{value:!0}),Dw.getTransactionCount=r;const t=Lr(),e=Be();async function r(n,{address:s,blockTag:i="latest",blockNumber:o}){const a=await n.request({method:"eth_getTransactionCount",params:[s,o?(0,e.numberToHex)(o):i]},{dedupe:!!o});return(0,t.hexToNumber)(a)}return Dw}var Uw={},A8;function RC(){if(A8)return Uw;A8=1,Object.defineProperty(Uw,"__esModule",{value:!0}),Uw.blobsToCommitments=r;const t=Yt(),e=Be();function r(n){const{kzg:s}=n,i=n.to??(typeof n.blobs[0]=="string"?"hex":"bytes"),o=typeof n.blobs[0]=="string"?n.blobs.map(c=>(0,t.hexToBytes)(c)):n.blobs,a=[];for(const c of o)a.push(Uint8Array.from(s.blobToKzgCommitment(c)));return i==="bytes"?a:a.map(c=>(0,e.bytesToHex)(c))}return Uw}var Mw={},C8;function BC(){if(C8)return Mw;C8=1,Object.defineProperty(Mw,"__esModule",{value:!0}),Mw.blobsToProofs=r;const t=Yt(),e=Be();function r(n){const{kzg:s}=n,i=n.to??(typeof n.blobs[0]=="string"?"hex":"bytes"),o=typeof n.blobs[0]=="string"?n.blobs.map(u=>(0,t.hexToBytes)(u)):n.blobs,a=typeof n.commitments[0]=="string"?n.commitments.map(u=>(0,t.hexToBytes)(u)):n.commitments,c=[];for(let u=0;u<o.length;u++){const l=o[u],d=a[u];c.push(Uint8Array.from(s.computeBlobKzgProof(l,d)))}return i==="bytes"?c:c.map(u=>(0,e.bytesToHex)(u))}return Mw}var $w={},Lw={},Fw={},I8;function EN(){if(I8)return Fw;I8=1,Object.defineProperty(Fw,"__esModule",{value:!0}),Fw.sha256=s;const t=vz(),e=Qn(),r=Yt(),n=Be();function s(i,o){const a=o||"hex",c=(0,t.sha256)((0,e.isHex)(i,{strict:!1})?(0,r.toBytes)(i):i);return a==="bytes"?c:(0,n.toHex)(c)}return Fw}var S8;function vN(){if(S8)return Lw;S8=1,Object.defineProperty(Lw,"__esModule",{value:!0}),Lw.commitmentToVersionedHash=r;const t=Be(),e=EN();function r(n){const{commitment:s,version:i=1}=n,o=n.to??(typeof s=="string"?"hex":"bytes"),a=(0,e.sha256)(s,"bytes");return a.set([i],0),o==="bytes"?a:(0,t.bytesToHex)(a)}return Lw}var T8;function _N(){if(T8)return $w;T8=1,Object.defineProperty($w,"__esModule",{value:!0}),$w.commitmentsToVersionedHashes=e;const t=vN();function e(r){const{commitments:n,version:s}=r,i=r.to??(typeof n[0]=="string"?"hex":"bytes"),o=[];for(const a of n)o.push((0,t.commitmentToVersionedHash)({commitment:a,to:i,version:s}));return o}return $w}var Hw={},qw={},AS={},P8;function Fve(){return P8||(P8=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.maxBytesPerTransaction=t.bytesPerBlob=t.fieldElementsPerBlob=t.bytesPerFieldElement=void 0;const e=6;t.bytesPerFieldElement=32,t.fieldElementsPerBlob=4096,t.bytesPerBlob=t.bytesPerFieldElement*t.fieldElementsPerBlob,t.maxBytesPerTransaction=t.bytesPerBlob*e-1-1*t.fieldElementsPerBlob*e}
309(AS)),AS}var Ai={},Vg={},O8;function Pz(){return O8||(O8=1,Object.defineProperty(Vg,"__esModule",{value:!0}),Vg.versionedHashVersionKzg=void 0,Vg.versionedHashVersionKzg=1),Vg}var N8;function Oz(){if(N8)return Ai;N8=1,Object.defineProperty(Ai,"__esModule",{value:!0}),Ai.InvalidVersionedHashVersionError=Ai.InvalidVersionedHashSizeError=Ai.EmptyBlobError=Ai.BlobSizeTooLargeError=void 0;const t=Pz(),e=ut();class r extends e.BaseError{constructor({maxSize:a,size:c}){super("Blob size is too large.",{metaMessages:[`Max: ${a} bytes`,`Given: ${c} bytes`],name:"BlobSizeTooLargeError"})}}Ai.BlobSizeTooLargeError=r;class n extends e.BaseError{constructor(){super("Blob data must not be empty.",{name:"EmptyBlobError"})}}Ai.EmptyBlobError=n;class s extends e.BaseError{constructor({hash:a,size:c}){super(`Versioned hash "${a}" size is invalid.`,{metaMessages:["Expected: 32",`Received: ${c}`],name:"InvalidVersionedHashSizeError"})}}Ai.InvalidVersionedHashSizeError=s;class i extends e.BaseError{constructor({hash:a,version:c}){super(`Versioned hash "${a}" version is invalid.`,{metaMessages:[`Expected: ${t.versionedHashVersionKzg}`,`Received: ${c}`],name:"InvalidVersionedHashVersionError"})}}return Ai.InvalidVersionedHashVersionError=i,Ai}var x8;function Nz(){if(x8)return qw;x8=1,Object.defineProperty(qw,"__esModule",{value:!0}),qw.toBlobs=o;const t=Fve(),e=Oz(),r=R0(),n=Gs(),s=Yt(),i=Be();function o(a){const c=a.to??(typeof a.data=="string"?"hex":"bytes"),u=typeof a.data=="string"?(0,s.hexToBytes)(a.data):a.data,l=(0,n.size)(u);if(!l)throw new e.EmptyBlobError;if(l>t.maxBytesPerTransaction)throw new e.BlobSizeTooLargeError({maxSize:t.maxBytesPerTransaction,size:l});const d=[];let f=!0,g=0;for(;f;){const h=(0,r.createCursor)(new Uint8Array(t.bytesPerBlob));let p=0;for(;p<t.fieldElementsPerBlob;){const y=u.slice(g,g+(t.bytesPerFieldElement-1));if(h.pushByte(0),h.pushBytes(y),y.length<31){h.pushByte(128),f=!1;break}p++,g+=31}d.push(h)}return c==="bytes"?d.map(h=>h.bytes):d.map(h=>(0,i.bytesToHex)(h.bytes))}return qw}var R8;function kC(){if(R8)return Hw;R8=1,Object.defineProperty(Hw,"__esModule",{value:!0}),Hw.toBlobSidecars=n;const t=RC(),e=BC(),r=Nz();function n(s){const{data:i,kzg:o,to:a}=s,c=s.blobs??(0,r.toBlobs)({data:i,to:a}),u=s.commitments??(0,t.blobsToCommitments)({blobs:c,kzg:o,to:a}),l=s.proofs??(0,e.blobsToProofs)({blobs:c,commitments:u,kzg:o,to:a}),d=[];for(let f=0;f<c.length;f++)d.push({blob:c[f],commitment:u[f],proof:l[f]});return d}return Hw}var zw={},B8;function jC(){if(B8)return zw;B8=1,Object.defineProperty(zw,"__esModule",{value:!0}),zw.getTransactionType=e;const t=Zs();function e(r){if(r.type)return r.type;if(typeof r.authorizationList<"u")return"eip7702";if(typeof r.blobs<"u"||typeof r.blobVersionedHashes<"u"||typeof r.maxFeePerBlobGas<"u"||typeof r.sidecars<"u")return"eip4844";if(typeof r.maxFeePerGas<"u"||typeof r.maxPriorityFeePerGas<"u")return"eip1559";if(typeof r.gasPrice<"u")return typeof r.accessList<"u"?"eip2930":"legacy";throw new t.InvalidSerializableTransactionError({transaction:r})}return zw}var Ww={},k8;function L0(){if(k8)return Ww;k8=1,Object.defineProperty(Ww,"__esModule",{value:!0}),Ww.getChainId=e;const t=Lr();async function e(r){const n=await r.request({method:"eth_chainId"},{dedupe:!0});return(0,t.hexToNumber)(n)}return Ww}var j8;function DC(){return j8||(j8=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.eip1559NetworkCache=t.defaultParameters=void 0,t.prepareTransactionRequest=p;const e=pn(),r=Tz(),n=AN(),s=Mp(),i=wN(),o=NC(),a=RC(),c=BC(),u=_N(),l=kC(),d=Vt(),f=mc(),g=jC(),h=L0();t.defaultParameters=["blobVersionedHashes","chainId","fees","gas","nonce","type"],t.eip1559NetworkCache=new Map;async function p(y,w){const{account:I=y.account,blobs:v,chain:E,gas:b,kzg:m,nonce:_,nonceManager:O,parameters:C=t.defaultParameters,type:S}=w,T=I&&(0,e.parseAccount)(I),N={...w,...T?{from:T==null?void 0:T.address}:{}};let R;async function B(){return R||(R=await(0,d.getAction)(y,s.getBlock,"getBlock")({blockTag:"latest"}),R)}let A;async function P(){return A||(E?E.id:typeof w.chainId<"u"?w.chainId:(A=await(0,d.getAction)(y,h.getChainId,"getChainId")({}),A))}if((C.includes("blobVersionedHashes")||C.includes("sidecars"))&&v&&m){const k=(0,a.blobsToCommitments)({blobs:v,kzg:m});if(C.includes("blobVersionedHashes")){const U=(0,u.commitmentsToVersionedHashes)({commitments:k,to:"hex"});N.blobVersionedHashes=U}if(C.includes("sidecars")){const U=(0,c.blobsToProofs)({blobs:v,commitments:k,kzg:m}),x=(0,l.toBlobSidecars)({blobs:v,commitments:k,proofs:U,to:"hex"});N.sidecars=x}}if(C.includes("chainId")&&(N.chainId=await P()),(C.includes("fees")||C.includes("type"))&&typeof S>"u")try{N.type=(0,g.getTransactionType)(N)}catch{let k=t.eip1559NetworkCache.get(y.uid);if(typeof k>"u"){const U=await B();k=typeof(U==null?void 0:U.baseFeePerGas)=="bigint",t.eip1559NetworkCache.set(y.uid,k)}N.type=k?"eip1559":"legacy"}if(C.includes("fees"))if(N.type!=="legacy"&&N.type!=="eip2930"){if(typeof N.maxFeePerGas>"u"||typeof N.maxPriorityFeePerGas>"u"){const k=await B(),{maxFeePerGas:U,maxPriorityFeePerGas:x}=await(0,r.internal_estimateFeesPerGas)(y,{block:k,chain:E,request:N});if(typeof w.maxPriorityFeePerGas>"u"&&w.maxFeePerGas&&w.maxFeePerGas<x)throw new o.MaxFeePerGasTooLowError({maxPriorityFeePerGas:x});N.maxPriorityFeePerGas=x,N.maxFeePerGas=U}}else{if(typeof w.maxFeePerGas<"u"||typeof w.maxPriorityFeePerGas<"u")throw new o.Eip1559FeesNotSupportedError;if(typeof w.gasPrice>"u"){const k=await B(),{gasPrice:U}=await(0,r.internal_estimateFeesPerGas)(y,{block:k,chain:E,request:N,type:"legacy"});N.gasPrice=U}}if(C.includes("gas")&&typeof b>"u"&&(N.gas=await(0,d.getAction)(y,n.estimateGas,"estimateGas")({...N,account:T&&{address:T.address,type:"json-rpc"}})),C.includes("nonce")&&typeof _>"u"&&T)if(O){const k=await P();N.nonce=await O.consume({address:T.address,chainId:k,client:y})}else N.nonce=await(0,d.getAction)(y,i.getTransactionCount,"getTransactionCount")({address:T.address,blockTag:"pending"});return(0,f.assertRequest)(N),delete N.parameters,N}}(vS)),vS}var Vw={},D8;function xz(){if(D8)return Vw;D8=1,Object.defineProperty(Vw,"__esModule",{value:!0}),Vw.getBalance=e;const t=Be();async function e(r,{address:n,blockNumber:s,blockTag:i="latest"}){const o=s?(0,t.numberToHex)(s):void 0,a=await r.request({method:"eth_getBalance",params:[n,o||i]});return BigInt(a)}return Vw}var U8;function AN(){if(U8)return Cw;U8=1,Object.defineProperty(Cw,"__esModule",{value:!0}),Cw.estimateGas=d;const t=pn(),e=ut(),r=Az(),n=Be(),s=Iz(),i=Up(),o=gc(),a=gN(),c=mc(),u=DC(),l=xz();async function d(f,g){var y,w,I;const{account:h=f.account}=g,p=h?(0,t.parseAccount)(h):void 0;try{let V=function(ee){const{block:X,request:oe,rpcStateOverride:te}=ee;return f.request({method:"eth_estimateGas",params:te?[oe,X??"latest",te]:X?[oe,X]:[oe]})};const{accessList:v,authorizationList:E,blobs:b,blobVersionedHashes:m,blockNumber:_,blockTag:O,data:C,gas:S,gasPrice:T,maxFeePerBlobGas:N,maxFeePerGas:R,maxPriorityFeePerGas:B,nonce:A,value:P,stateOverride:k,...U}=await(0,u.prepareTransactionRequest)(f,{...g,parameters:(p==null?void 0:p.type)==="local"?void 0:["blobVersionedHashes"]}
309),j=(_?(0,n.numberToHex)(_):void 0)||O,D=(0,a.serializeStateOverride)(k),M=await(async()=>{if(U.to)return U.to;if(E&&E.length>0)return await(0,r.recoverAuthorizationAddress)({authorization:E[0]}).catch(()=>{throw new e.BaseError("`to` is required. Could not infer from `authorizationList`")})})();(0,c.assertRequest)(g);const L=(I=(w=(y=f.chain)==null?void 0:y.formatters)==null?void 0:w.transactionRequest)==null?void 0:I.format,z=(L||o.formatTransactionRequest)({...(0,i.extract)(U,{format:L}),from:p==null?void 0:p.address,accessList:v,authorizationList:E,blobs:b,blobVersionedHashes:m,data:C,gas:S,gasPrice:T,maxFeePerBlobGas:N,maxFeePerGas:R,maxPriorityFeePerGas:B,nonce:A,to:M,value:P});let G=BigInt(await V({block:j,request:z,rpcStateOverride:D}));if(E){const ee=await(0,l.getBalance)(f,{address:z.from}),X=await Promise.all(E.map(async oe=>{const{contractAddress:te}=oe,fe=await V({block:j,request:{authorizationList:void 0,data:C,from:p==null?void 0:p.address,to:te,value:(0,n.numberToHex)(ee)},rpcStateOverride:D}).catch(()=>100000n);return 2n*BigInt(fe)}));G+=X.reduce((oe,te)=>oe+te,0n)}return G}catch(v){throw(0,s.getEstimateGasError)(v,{...g,account:p,chain:f.chain})}}return Cw}var M8;function Rz(){if(M8)return fw;M8=1,Object.defineProperty(fw,"__esModule",{value:!0}),fw.estimateContractGas=i;const t=pn(),e=yi(),r=Wu(),n=Vt(),s=AN();async function i(o,a){const{abi:c,address:u,args:l,functionName:d,dataSuffix:f,...g}=a,h=(0,e.encodeFunctionData)({abi:c,args:l,functionName:d});try{return await(0,n.getAction)(o,s.estimateGas,"estimateGas")({data:`${h}${f?f.replace("0x",""):""}`,to:u,...g})}catch(p){const y=g.account?(0,t.parseAccount)(g.account):void 0;throw(0,r.getContractError)(p,{abi:c,address:u,args:l,docsPath:"/docs/contract/estimateContractGas",functionName:d,sender:y==null?void 0:y.address})}}return fw}var Gw={},Kw={},Zw={},Yw={},$8;function yc(){if($8)return Yw;$8=1,Object.defineProperty(Yw,"__esModule",{value:!0}),Yw.isAddressEqual=r;const t=eo(),e=Ks();function r(n,s){if(!(0,e.isAddress)(n,{strict:!1}))throw new t.InvalidAddressError({address:n});if(!(0,e.isAddress)(s,{strict:!1}))throw new t.InvalidAddressError({address:s});return n.toLowerCase()===s.toLowerCase()}return Yw}var Jw={},L8;function F0(){if(L8)return Jw;L8=1,Object.defineProperty(Jw,"__esModule",{value:!0}),Jw.decodeEventLog=a;const t=lr(),e=Gs(),r=Dp(),n=yz(),s=qu(),i=fc(),o="/docs/contract/decodeEventLog";function a(u){const{abi:l,data:d,strict:f,topics:g}=u,h=f??!0,[p,...y]=g;if(!p)throw new t.AbiEventSignatureEmptyTopicsError({docsPath:o});const w=l.length===1?l[0]:l.find(O=>O.type==="event"&&p===(0,r.toEventSelector)((0,i.formatAbiItem)(O)));if(!(w&&"name"in w)||w.type!=="event")throw new t.AbiEventSignatureNotFoundError(p,{docsPath:o});const{name:I,inputs:v}=w,E=v==null?void 0:v.some(O=>!("name"in O&&O.name));let b=E?[]:{};const m=v.filter(O=>"indexed"in O&&O.indexed);for(let O=0;O<m.length;O++){const C=m[O],S=y[O];if(!S)throw new t.DecodeLogTopicsMismatch({abiItem:w,param:C});b[E?O:C.name||O]=c({param:C,value:S})}const _=v.filter(O=>!("indexed"in O&&O.indexed));if(_.length>0){if(d&&d!=="0x")try{const O=(0,s.decodeAbiParameters)(_,d);if(O)if(E)b=[...b,...O];else for(let C=0;C<_.length;C++)b[_[C].name]=O[C]}catch(O){if(h)throw O instanceof t.AbiDecodingDataSizeTooSmallError||O instanceof n.PositionOutOfBoundsError?new t.DecodeLogDataMismatch({abiItem:w,data:d,params:_,size:(0,e.size)(d)}):O}else if(h)throw new t.DecodeLogDataMismatch({abiItem:w,data:"0x",params:_,size:0})}return{eventName:I,args:Object.values(b).length>0?b:void 0}}function c({param:u,value:l}){return u.type==="string"||u.type==="bytes"||u.type==="tuple"||u.type.match(/^(.*)\[(\d+)?\]$/)?l:((0,s.decodeAbiParameters)([u],l)||[])[0]}return Jw}var F8;function H0(){if(F8)return Zw;F8=1,Object.defineProperty(Zw,"__esModule",{value:!0}),Zw.parseEventLogs=o;const t=lr(),e=yc(),r=Yt(),n=Is(),s=Dp(),i=F0();
309function o(c){const{abi:u,args:l,logs:d,strict:f=!0}=c,g=(()=>{if(c.eventName)return Array.isArray(c.eventName)?c.eventName:[c.eventName]})();return d.map(h=>{var p;try{const y=u.find(I=>I.type==="event"&&h.topics[0]===(0,s.toEventSelector)(I));if(!y)return null;const w=(0,i.decodeEventLog)({...h,abi:[y],strict:f});return g&&!g.includes(w.eventName)||!a({args:w.args,inputs:y.inputs,matchArgs:l})?null:{...w,...h}}catch(y){let w,I;if(y instanceof t.AbiEventSignatureNotFoundError)return null;if(y instanceof t.DecodeLogDataMismatch||y instanceof t.DecodeLogTopicsMismatch){if(f)return null;w=y.abiItem.name,I=(p=y.abiItem.inputs)==null?void 0:p.some(v=>!("name"in v&&v.name))}return{...h,args:I?[]:{},eventName:w}}}).filter(Boolean)}function a(c){const{args:u,inputs:l,matchArgs:d}=c;if(!d)return!0;if(!u)return!1;function f(g,h,p){try{return g.type==="address"?(0,e.isAddressEqual)(h,p):g.type==="string"||g.type==="bytes"?(0,n.keccak256)((0,r.toBytes)(h))===p:h===p}catch{return!1}}return Array.isArray(u)&&Array.isArray(d)?d.every((g,h)=>{if(g==null)return!0;const p=l[h];return p?(Array.isArray(g)?g:[g]).some(w=>f(p,w,u[h])):!1}):typeof u=="object"&&!Array.isArray(u)&&typeof d=="object"&&!Array.isArray(d)?Object.entries(d).every(([g,h])=>{if(h==null)return!0;const p=l.find(w=>w.name===g);return p?(Array.isArray(h)?h:[h]).some(w=>f(p,w,u[g])):!1}):!1}return Zw}var Qw={},H8;function bc(){if(H8)return Qw;H8=1,Object.defineProperty(Qw,"__esModule",{value:!0}),Qw.formatLog=t;function t(e,{args:r,eventName:n}={}){return{...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,logIndex:e.logIndex?Number(e.logIndex):null,transactionHash:e.transactionHash?e.transactionHash:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,...n?{args:r,eventName:n}:{}}}return Qw}var q8;function CN(){if(q8)return Kw;q8=1,Object.defineProperty(Kw,"__esModule",{value:!0}),Kw.getLogs=s;const t=tf(),e=H0(),r=Be(),n=bc();async function s(i,{address:o,blockHash:a,fromBlock:c,toBlock:u,event:l,events:d,args:f,strict:g}={}){const h=g??!1,p=d??(l?[l]:void 0);let y=[];p&&(y=[p.flatMap(E=>(0,t.encodeEventTopics)({abi:[E],eventName:E.name,args:d?void 0:f}))],l&&(y=y[0]));let w;a?w=await i.request({method:"eth_getLogs",params:[{address:o,topics:y,blockHash:a}]}):w=await i.request({method:"eth_getLogs",params:[{address:o,topics:y,fromBlock:typeof c=="bigint"?(0,r.numberToHex)(c):c,toBlock:typeof u=="bigint"?(0,r.numberToHex)(u):u}]});const I=w.map(v=>(0,n.formatLog)(v));return p?(0,e.parseEventLogs)({abi:p,args:f,logs:I,strict:h}):I}return Kw}var z8;function IN(){if(z8)return Gw;z8=1,Object.defineProperty(Gw,"__esModule",{value:!0}),Gw.getContractEvents=n;const t=hc(),e=Vt(),r=CN();async function n(s,i){const{abi:o,address:a,args:c,blockHash:u,eventName:l,fromBlock:d,toBlock:f,strict:g}=i,h=l?(0,t.getAbiItem)({abi:o,name:l}):void 0,p=h?void 0:o.filter(y=>y.type==="event");return(0,e.getAction)(s,r.getLogs,"getLogs")({address:a,args:c,blockHash:u,event:h,events:p,fromBlock:d,toBlock:f,strict:g})}return Gw}var Xw={},e1={},W8;function wc(){if(W8)return e1;W8=1,Object.defineProperty(e1,"__esModule",{value:!0}),e1.decodeFunctionResult=s;const t=lr(),e=qu(),r=hc(),n="/docs/contract/decodeFunctionResult";function s(i){const{abi:o,args:a,functionName:c,data:u}=i;let l=o[0];if(c){const f=(0,r.getAbiItem)({abi:o,args:a,name:c});if(!f)throw new t.AbiFunctionNotFoundError(c,{docsPath:n});l=f}if(l.type!=="function")throw new t.AbiFunctionNotFoundError(void 0,{docsPath:n});if(!l.outputs)throw new t.AbiFunctionOutputsNotFoundError(l.name,{docsPath:n});const d=(0,e.decodeAbiParameters)(l.outputs,u);if(d&&d.length>1)return d;if(d&&d.length===1)return d[0]}return e1}var Gg={},Xt={},V8;function sf(){if(V8)return Xt;V8=1,Object.defineProperty(Xt,"__esModule",{value:!0}),Xt.erc4626Abi=Xt.erc721Abi=Xt.erc20Abi_bytes32=Xt.erc20Abi=Xt.universalSignatureValidatorAbi=Xt.smartAccountAbi=Xt.addressResolverAbi=Xt.textResolverAbi=Xt.universalResolverReverseAbi=Xt.universalResolverResolveAbi=Xt.multicall3Abi=void 0,Xt.multicall3Abi=[{inputs:[{components:[{name:"target",type:"address"}
309,{name:"allowFailure",type:"bool"},{name:"callData",type:"bytes"}],name:"calls",type:"tuple[]"}],name:"aggregate3",outputs:[{components:[{name:"success",type:"bool"},{name:"returnData",type:"bytes"}],name:"returnData",type:"tuple[]"}],stateMutability:"view",type:"function"}];const t=[{inputs:[],name:"ResolverNotFound",type:"error"},{inputs:[],name:"ResolverWildcardNotSupported",type:"error"},{inputs:[],name:"ResolverNotContract",type:"error"},{inputs:[{name:"returnData",type:"bytes"}],name:"ResolverError",type:"error"},{inputs:[{components:[{name:"status",type:"uint16"},{name:"message",type:"string"}],name:"errors",type:"tuple[]"}],name:"HttpError",type:"error"}];return Xt.universalResolverResolveAbi=[...t,{name:"resolve",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes"},{name:"data",type:"bytes"}],outputs:[{name:"",type:"bytes"},{name:"address",type:"address"}]},{name:"resolve",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes"},{name:"data",type:"bytes"},{name:"gateways",type:"string[]"}],outputs:[{name:"",type:"bytes"},{name:"address",type:"address"}]}],Xt.universalResolverReverseAbi=[...t,{name:"reverse",type:"function",stateMutability:"view",inputs:[{type:"bytes",name:"reverseName"}],outputs:[{type:"string",name:"resolvedName"},{type:"address",name:"resolvedAddress"},{type:"address",name:"reverseResolver"},{type:"address",name:"resolver"}]},{name:"reverse",type:"function",stateMutability:"view",inputs:[{type:"bytes",name:"reverseName"},{type:"string[]",name:"gateways"}],outputs:[{type:"string",name:"resolvedName"},{type:"address",name:"resolvedAddress"},{type:"address",name:"reverseResolver"},{type:"address",name:"resolver"}]}],Xt.textResolverAbi=[{name:"text",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"key",type:"string"}],outputs:[{name:"",type:"string"}]}],Xt.addressResolverAbi=[{name:"addr",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"}],outputs:[{name:"",type:"address"}]},{name:"addr",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"coinType",type:"uint256"}],outputs:[{name:"",type:"bytes"}]}],Xt.smartAccountAbi=[{name:"isValidSignature",type:"function",stateMutability:"view",inputs:[{name:"hash",type:"bytes32"},{name:"signature",type:"bytes"}],outputs:[{name:"",type:"bytes4"}]}],Xt.universalSignatureValidatorAbi=[{inputs:[{name:"_signer",type:"address"},{name:"_hash",type:"bytes32"},{name:"_signature",type:"bytes"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[{name:"_signer",type:"address"},{name:"_hash",type:"bytes32"},{name:"_signature",type:"bytes"}],outputs:[{type:"bool"}],stateMutability:"nonpayable",type:"function",name:"isValidSig"}],Xt.erc20Abi=[{type:"event",name:"Approval",inputs:[{indexed:!0,name:"owner",type:"address"},{indexed:!0,name:"spender",type:"address"},{indexed:!1,name:"value",type:"uint256"}]},{type:"event",name:"Transfer",inputs:[{indexed:!0,name:"from",type:"address"},{indexed:!0,name:"to",type:"address"},{indexed:!1,name:"value",type:"uint256"}]},{type:"function",name:"allowance",stateMutability:"view",inputs:[{name:"owner",type:"address"},{name:"spender",type:"address"}],outputs:[{type:"uint256"}]},{type:"function",name:"approve",stateMutability:"nonpayable",inputs:[{name:"spender",type:"address"},{name:"amount",type:"uint256"}],outputs:[{type:"bool"}]},{type:"function",name:"balanceOf",stateMutability:"view",inputs:[{name:"account",type:"address"}],outputs:[{type:"uint256"}]},{type:"function",name:"decimals",stateMutability:"view",inputs:[],outputs:[{type:"uint8"}]},{type:"function",name:"name",stateMutability:"view",inputs:[],outputs:[{type:"string"}]},{type:"function",name:"symbol",stateMutability:"view",inputs:[],outputs:[{type:"string"}]},{type:"function",name:"totalSupply",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{type:"function",name:"transfer",stateMutability:"nonpayable",inputs:[{name:"recipient",type:"address"},{name:"amount",type:"uint256"}],outputs:[{type:"bool"}]},{type:"function",name:"transferFrom",stateMutability:"nonpayable",inputs:[{name:"sender",type:"address"},{name:"recipient",type:"address"},{name:"amount",type:"uint256"}],outputs:[{type:"bool"}]}
309],Xt.erc20Abi_bytes32=[{type:"event",name:"Approval",inputs:[{indexed:!0,name:"owner",type:"address"},{indexed:!0,name:"spender",type:"address"},{indexed:!1,name:"value",type:"uint256"}]},{type:"event",name:"Transfer",inputs:[{indexed:!0,name:"from",type:"address"},{indexed:!0,name:"to",type:"address"},{indexed:!1,name:"value",type:"uint256"}]},{type:"function",name:"allowance",stateMutability:"view",inputs:[{name:"owner",type:"address"},{name:"spender",type:"address"}],outputs:[{type:"uint256"}]},{type:"function",name:"approve",stateMutability:"nonpayable",inputs:[{name:"spender",type:"address"},{name:"amount",type:"uint256"}],outputs:[{type:"bool"}]},{type:"function",name:"balanceOf",stateMutability:"view",inputs:[{name:"account",type:"address"}],outputs:[{type:"uint256"}]},{type:"function",name:"decimals",stateMutability:"view",inputs:[],outputs:[{type:"uint8"}]},{type:"function",name:"name",stateMutability:"view",inputs:[],outputs:[{type:"bytes32"}]},{type:"function",name:"symbol",stateMutability:"view",inputs:[],outputs:[{type:"bytes32"}]},{type:"function",name:"totalSupply",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{type:"function",name:"transfer",stateMutability:"nonpayable",inputs:[{name:"recipient",type:"address"},{name:"amount",type:"uint256"}],outputs:[{type:"bool"}]},{type:"function",name:"transferFrom",stateMutability:"nonpayable",inputs:[{name:"sender",type:"address"},{name:"recipient",type:"address"},{name:"amount",type:"uint256"}],outputs:[{type:"bool"}]}
309],Xt.erc721Abi=[{type:"event",name:"Approval",inputs:[{indexed:!0,name:"owner",type:"address"},{indexed:!0,name:"spender",type:"address"},{indexed:!0,name:"tokenId",type:"uint256"}]},{type:"event",name:"ApprovalForAll",inputs:[{indexed:!0,name:"owner",type:"address"},{indexed:!0,name:"operator",type:"address"},{indexed:!1,name:"approved",type:"bool"}]},{type:"event",name:"Transfer",inputs:[{indexed:!0,name:"from",type:"address"},{indexed:!0,name:"to",type:"address"},{indexed:!0,name:"tokenId",type:"uint256"}]},{type:"function",name:"approve",stateMutability:"payable",inputs:[{name:"spender",type:"address"},{name:"tokenId",type:"uint256"}],outputs:[]},{type:"function",name:"balanceOf",stateMutability:"view",inputs:[{name:"account",type:"address"}],outputs:[{type:"uint256"}]},{type:"function",name:"getApproved",stateMutability:"view",inputs:[{name:"tokenId",type:"uint256"}],outputs:[{type:"address"}]},{type:"function",name:"isApprovedForAll",stateMutability:"view",inputs:[{name:"owner",type:"address"},{name:"operator",type:"address"}],outputs:[{type:"bool"}]},{type:"function",name:"name",stateMutability:"view",inputs:[],outputs:[{type:"string"}]},{type:"function",name:"ownerOf",stateMutability:"view",inputs:[{name:"tokenId",type:"uint256"}],outputs:[{name:"owner",type:"address"}]},{type:"function",name:"safeTransferFrom",stateMutability:"payable",inputs:[{name:"from",type:"address"},{name:"to",type:"address"},{name:"tokenId",type:"uint256"}],outputs:[]},{type:"function",name:"safeTransferFrom",stateMutability:"nonpayable",inputs:[{name:"from",type:"address"},{name:"to",type:"address"},{name:"id",type:"uint256"},{name:"data",type:"bytes"}],outputs:[]},{type:"function",name:"setApprovalForAll",stateMutability:"nonpayable",inputs:[{name:"operator",type:"address"},{name:"approved",type:"bool"}],outputs:[]},{type:"function",name:"symbol",stateMutability:"view",inputs:[],outputs:[{type:"string"}]},{type:"function",name:"tokenByIndex",stateMutability:"view",inputs:[{name:"index",type:"uint256"}],outputs:[{type:"uint256"}]},{type:"function",name:"tokenByIndex",stateMutability:"view",inputs:[{name:"owner",type:"address"},{name:"index",type:"uint256"}],outputs:[{name:"tokenId",type:"uint256"}]},{type:"function",name:"tokenURI",stateMutability:"view",inputs:[{name:"tokenId",type:"uint256"}],outputs:[{type:"string"}]},{type:"function",name:"totalSupply",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{type:"function",name:"transferFrom",stateMutability:"payable",inputs:[{name:"sender",type:"address"},{name:"recipient",type:"address"},{name:"tokeId",type:"uint256"}],outputs:[]}],Xt.erc4626Abi=[{anonymous:!1,inputs:[{indexed:!0,name:"owner",type:"address"},{indexed:!0,name:"spender",type:"address"},{indexed:!1,name:"value",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"sender",type:"address"},{indexed:!0,name:"receiver",type:"address"},{indexed:!1,name:"assets",type:"uint256"},{indexed:!1,name:"shares",type:"uint256"}],name:"Deposit",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"from",type:"address"},{indexed:!0,name:"to",type:"address"},{indexed:!1,name:"value",type:"uint256"}],name:"Transfer",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"sender",type:"address"},{indexed:!0,name:"receiver",type:"address"},{indexed:!0,name:"owner",type:"address"},{indexed:!1,name:"assets",type:"uint256"},{indexed:!1,name:"shares",type:"uint256"}],name:"Withdraw",type:"event"},{inputs:[{name:"owner",type:"address"},{name:"spender",type:"address"}],name:"allowance",outputs:[{type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"spender",type:"address"},{name:"amount",type:"uint256"}],name:"approve",outputs:[{type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"asset",outputs:[{name:"assetTokenAddress",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{name:"account",type:"address"}],name:"balanceOf",outputs:[{type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"shares",type:"uint256"}],name:"convertToAssets",outputs:[{name:"assets",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"assets",type:"uint256"}],name:"convertToShares",outputs:[{name:"shares",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"assets",type:"uint256"},{name:"receiver",type:"address"}],name:"deposit",outputs:[{name:"shares",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[{name:"caller",type:"address"}],name:"maxDeposit",outputs:[{name:"maxAssets",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"caller",type:"address"}],name:"maxMint",outputs:[{name:"maxShares",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"owner",type:"address"}],name:"maxRedeem",outputs:[{name:"maxShares",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"owner",type:"address"}],name:"maxWithdraw",outputs:[{name:"maxAssets",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"shares",type:"uint256"},{name:"receiver",type:"address"}],name:"mint",outputs:[{name:"assets",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[{name:"assets",type:"uint256"}],name:"previewDeposit",outputs:[{name:"shares",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"shares",type:"uint256"}],name:"previewMint",outputs:[{name:"assets",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"shares",type:"uint256"}],name:"previewRedeem",outputs:[{name:"assets",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"assets",type:"uint256"}],name:"previewWithdraw",outputs:[{name:"shares",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"shares",type:"uint256"},{name:"receiver",type:"address"},{name:"owner",type:"address"}],name:"redeem",outputs:[{name:"assets",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"totalAssets",outputs:[{name:"totalManagedAssets",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"to",type:"address"},{name:"amount",type:"uint256"}],name:"transfer",outputs:[{type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{name:"from",type:"address"},{name:"to",type:"address"},{name:"amount",type:"uint256"}],name:"transferFrom",outputs:[{type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{name:"assets",type:"uint256"},{name:"receiver",type:"address"},{name:"owner",type:"address"}],name:"withdraw",outputs:[{name:"shares",type:"uint256"}],stateMutability:"nonpayable",type:"function"}],Xt}var Kg={},G8;function Hve(){return G8||(G8=1,Object.defineProperty(Kg,"__esMo
309dule",{value:!0}),Kg.aggregate3Signature=void 0,Kg.aggregate3Signature="0x82ad56cb"),Kg}var Ea={},K8;function UC(){return K8||(K8=1,Object.defineProperty(Ea,"__esModule",{value:!0}),Ea.universalSignatureValidatorByteCode=Ea.deploylessCallViaFactoryBytecode=Ea.deploylessCallViaBytecodeBytecode=void 0,Ea.deploylessCallViaBytecodeBytecode="0x608060405234801561001057600080fd5b5060405161018e38038061018e83398101604081905261002f91610124565b6000808351602085016000f59050803b61004857600080fd5b6000808351602085016000855af16040513d6000823e81610067573d81fd5b3d81f35b634e487b7160e01b600052604160045260246000fd5b600082601f83011261009257600080fd5b81516001600160401b038111156100ab576100ab61006b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156100d9576100d961006b565b6040528181528382016020018510156100f157600080fd5b60005b82811015610110576020818601810151838301820152016100f4565b506000918101602001919091529392505050565b6000806040838503121561013757600080fd5b82516001600160401b0381111561014d57600080fd5b61015985828601610081565b602085015190935090506001600160401b0381111561017757600080fd5b61018385828601610081565b915050925092905056fe",Ea.deploylessCallViaFactoryBytecode="0x608060405234801561001057600080fd5b506040516102c03803806102c083398101604081905261002f916101e6565b836001600160a01b03163b6000036100e457600080836001600160a01b03168360405161005c9190610270565b6000604051808303816000865af19150503d8060008114610099576040519150601f19603f3d011682016040523d82523d6000602084013e61009e565b606091505b50915091508115806100b857506001600160a01b0386163b155b156100e1578060405163101bb98d60e01b81526004016100d8919061028c565b60405180910390fd5b50505b6000808451602086016000885af16040513d6000823e81610103573d81fd5b3d81f35b80516001600160a01b038116811461011e57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561015457818101518382015260200161013c565b50506000910152565b600082601f83011261016e57600080fd5b81516001600160401b0381111561018757610187610123565b604051601f8201601f19908116603f011681016001600160401b03811182821017156101b5576101b5610123565b6040528181528382016020018510156101cd57600080fd5b6101de826020830160208701610139565b949350505050565b600080600080608085870312156101fc57600080fd5b61020585610107565b60208601519094506001600160401b0381111561022157600080fd5b61022d8782880161015d565b93505061023c60408601610107565b60608601519092506001600160401b0381111561025857600080fd5b6102648782880161015d565b91505092959194509250565b60008251610282818460208701610139565b9190910192915050565b60208152600082518060208401526102ab816040850160208701610139565b601f01601f1916919091016040019291505056fe",Ea.universalSignatureValidatorByteCode="0x608060405234801561001057600080fd5b5060405161069438038061069483398101604081905261002f9161051e565b600061003c848484610048565b9050806000526001601ff35b60007f64926492649264926492649264926492649264926492649264926492649264926100748361040c565b036101e7576000606080848060200190518101906100929190610577565b60405192955090935091506000906001600160a01b038516906100b69085906105dd565b6000604051808303816000865af19150503d80600081146100f3576040519150601f19603f3d011682016040523d82523d6000602084013e6100f8565b606091505b50509050876001600160a01b03163b60000361016057806101605760405162461bcd60e51b815260206004820152601e60248201527f5369676e617475726556616c696461746f723a206465706c6f796d656e74000060448201526064015b60405180910390fd5b604051630b135d3f60e11b808252906001600160a01b038a1690631626ba7e90610190908b9087906004016105f9565b602060405180830381865afa1580156101ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101d19190610633565b6001600160e01b03191614945050505050610405565b6001600160a01b0384163b1561027a57604051630b135d3f60e11b808252906001600160a01b03861690631626ba7e9061022790879087906004016105f9565b602060405180830381865afa158015610244573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102689190610633565b6001600160e01b031916149050610405565b81516041146102df5760405162461bcd60e51b815260206004820152603a602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e6174757265206c656e6774680000000000006064820152608401610157565b6102e7610425565b5060208201516040808401518451859392600091859190811061030c5761030c61065d565b016020015160f81c9050601b811480159061032b57508060ff16601c14155b1561038c5760405162461bcd60e51b8152
30960206004820152603b602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e617475726520762076616c756500000000006064820152608401610157565b60408051600081526020810180835289905260ff83169181019190915260608101849052608081018390526001600160a01b0389169060019060a0016020604051602081039080840390855afa1580156103ea573d6000803e3d6000fd5b505050602060405103516001600160a01b0316149450505050505b9392505050565b600060208251101561041d57600080fd5b508051015190565b60405180606001604052806003906020820280368337509192915050565b6001600160a01b038116811461045857600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561048c578181015183820152602001610474565b50506000910152565b600082601f8301126104a657600080fd5b81516001600160401b038111156104bf576104bf61045b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156104ed576104ed61045b565b60405281815283820160200185101561050557600080fd5b610516826020830160208701610471565b949350505050565b60008060006060848603121561053357600080fd5b835161053e81610443565b6020850151604086015191945092506001600160401b0381111561056157600080fd5b61056d86828701610495565b9150509250925092565b60008060006060848
309603121561058c57600080fd5b835161059781610443565b60208501519093506001600160401b038111156105b357600080fd5b6105bf86828701610495565b604086015190935090506001600160401b0381111561056157600080fd5b600082516105ef818460208701610471565b9190910192915050565b828152604060208201526000825180604084015261061e816060850160208701610471565b601f01601f1916919091016060019392505050565b60006020828403121561064557600080fd5b81516001600160e01b03198116811461040557600080fd5b634e487b7160e01b600052603260045260246000fdfe5369676e617475726556616c696461746f72237265636f7665725369676e6572"),Ea}var Rs={},Z8;function q0(){if(Z8)return Rs;Z8=1,Object.defineProperty(Rs,"__esModule",{value:!0}),Rs.InvalidChainIdError=Rs.ClientChainNotConfiguredError=Rs.ChainNotFoundError=Rs.ChainMismatchError=Rs.ChainDoesNotSupportContract=void 0;const t=ut();class e extends t.BaseError{constructor({blockNumber:a,chain:c,contract:u}){super(`Chain "${c.name}" does not support contract "${u.name}".`,{metaMessages:["This could be due to any of the following:",...a&&u.blockCreated&&u.blockCreated>a?[`- The contract "${u.name}" was not deployed until block ${u.blockCreated} (current block ${a}).`]:[`- The chain does not have the contract "${u.name}" configured.`]],name:"ChainDoesNotSupportContract"})}}Rs.ChainDoesNotSupportContract=e;class r extends t.BaseError{constructor({chain:a,currentChainId:c}){super(`The current chain of the wallet (id: ${c}) does not match the target chain for the transaction (id: ${a.id} – ${a.name}).`,{metaMessages:[`Current Chain ID:  ${c}`,`Expected Chain ID: ${a.id} – ${a.name}`],name:"ChainMismatchError"})}}Rs.ChainMismatchError=r;class n extends t.BaseError{constructor(){super(["No chain was provided to the request.","Please provide a chain with the `chain` argument on the Action, or by supplying a `chain` to WalletClient."].join(`
310`),{name:"ChainNotFoundError"})}}Rs.ChainNotFoundError=n;class s extends t.BaseError{constructor(){super("No chain was provided to the Client.",{name:"ClientChainNotConfiguredError"})}}Rs.ClientChainNotConfiguredError=s;class i extends t.BaseError{constructor({chainId:a}){super(typeof a=="number"?`Chain ID "${a}
310" is invalid.`:"Chain ID is invalid.",{name:"InvalidChainIdError"})}}return Rs.InvalidChainIdError=i,Rs}var t1={},Y8;function z0(){if(Y8)return t1;Y8=1,Object.defineProperty(t1,"__esModule",{value:!0}),t1.encodeDeployData=s;const t=lr(),e=Xn(),r=ro(),n="/docs/contract/encodeDeployData";function s(i){const{abi:o,args:a,bytecode:c}=i;if(!a||a.length===0)return c;const u=o.find(d=>"type"in d&&d.type==="constructor");if(!u)throw new t.AbiConstructorNotFoundError({docsPath:n});if(!("inputs"in u))throw new t.AbiConstructorParamsNotFoundError({docsPath:n});if(!u.inputs||u.inputs.length===0)throw new t.AbiConstructorParamsNotFoundError({docsPath:n});const l=(0,r.encodeAbiParameters)(u.inputs,a);return(0,e.concatHex)([c,l])}return t1}var r1={},J8;function Gu(){if(J8)return r1;J8=1,Object.defineProperty(r1,"__esModule",{value:!0}),r1.getChainContractAddress=e;const t=q0();function e({blockNumber:r,chain:n,contract:s}){var o;const i=(o=n==null?void 0:n.contracts)==null?void 0:o[s];if(!i)throw new t.ChainDoesNotSupportContract({chain:n,contract:{name:s}});if(r&&i.blockCreated&&i.blockCreated>r)throw new t.ChainDoesNotSupportContract({blockNumber:r,chain:n,contract:{name:s,blockCreated:i.blockCreated}});return i.address}return r1}var n1={},Q8;function SN(){if(Q8)return n1;Q8=1,Object.defineProperty(n1,"__esModule",{value:!0}),n1.getCallError=n;const t=zu(),e=pc(),r=U0();function n(s,{docsPath:i,...o}){const a=(()=>{const c=(0,r.getNodeError)(s,o);return c instanceof e.UnknownNodeError?s:c})();return new t.CallExecutionError(a,{docsPath:i,...o})}return n1}var s1={},i1={},X8;function Bz(){if(X8)return i1;X8=1,Object.defineProperty(i1,"__esModule",{value:!0}),i1.withResolvers=t;function t(){let e=()=>{},r=()=>{};return{promise:new Promise((s,i)=>{e=s,r=i}),resolve:e,reject:r}}return i1}var eD;function TN(){if(eD)return s1;eD=1,Object.defineProperty(s1,"__esModule",{value:!0}),s1.createBatchScheduler=r;const t=Bz(),e=new Map;function r({fn:n,id:s,shouldSplitBatch:i,wait:o=0,sort:a}){const c=async()=>{const g=d();u();const h=g.map(({args:p})=>p);h.length!==0&&n(h).then(p=>{a&&Array.isArray(p)&&p.sort(a);for(let y=0;y<g.length;y++){const{resolve:w}=g[y];w==null||w([p[y],p])}}).catch(p=>{for(let y=0;y<g.length;y++){const{reject:w}=g[y];w==null||w(p)}})},u=()=>e.delete(s),l=()=>d().map(({args:g})=>g),d=()=>e.get(s)||[],f=g=>e.set(s,[...d(),g]);return{flush:u,async schedule(g){const{promise:h,resolve:p,reject:y}=(0,t.withResolvers)();return(i==null?void 0:i([...l(),g]))&&c(),d().length>0?(f({args:g,resolve:p,reject:y}),h):(f({args:g,resolve:p,reject:y}),setTimeout(c,o),h)}}}return s1}var CS={},va={},tD;function qve(){if(tD)return va;tD=1,Object.defineProperty(va,"__esModule",{value:!0}),va.OffchainLookupSenderMismatchError=va.OffchainLookupResponseMalformedError=va.OffchainLookupError=void 0;const t=xn(),e=ut(),r=hN();class n extends e.BaseError{constructor({callbackSelector:a,cause:c,data:u,extraData:l,sender:d,urls:f}){var g;super(c.shortMessage||"An error occurred while fetching for an offchain result.",{cause:c,metaMessages:[...c.metaMessages||[],(g=c.metaMessages)!=null&&g.length?"":[],"Offchain Gateway Call:",f&&["  Gateway URL(s):",...f.map(h=>`    ${(0,r.getUrl)(h)}`)],`  Sender: ${d}`,`  Data: ${u}`,`  Callback selector: ${a}`,`  Extra data: ${l}`].flat(),name:"OffchainLookupError"})}}va.OffchainLookupError=n;class s extends e.BaseError{constructor({result:a,url:c}){super("Offchain gateway response is malformed. Response data must be a hex value.",{metaMessages:[`Gateway URL: ${(0,r.getUrl)(c)}`,`Response: ${(0,t.stringify)(a)}`],name:"OffchainLookupResponseMalformedError"})}}va.OffchainLookupResponseMalformedError=s;class i extends e.BaseError{constructor({sender:a,to:c}){super("Reverted sender address does not match target contract address (`to`).",{metaMessages:[`Contract address: ${c}`,`OffchainLookup sender address: ${a}`],name:"OffchainLookupSenderMismatchError"})}}return va.OffchainLookupSenderMismatchError=i,va}var rD;function PN(){return rD||(rD=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.offchainLookupAbiItem=t.offchainLookupSignature=void 0,t.offchainLookup=l,t.ccipRequest=d;
310const e=W0(),r=qve(),n=no(),s=TC(),i=ro(),o=yc(),a=Xn(),c=Qn(),u=xn();t.offchainLookupSignature="0x556f1830",t.offchainLookupAbiItem={name:"OffchainLookup",type:"error",inputs:[{name:"sender",type:"address"},{name:"urls",type:"string[]"},{name:"callData",type:"bytes"},{name:"callbackFunction",type:"bytes4"},{name:"extraData",type:"bytes"}]};async function l(f,{blockNumber:g,blockTag:h,data:p,to:y}){const{args:w}=(0,s.decodeErrorResult)({data:p,abi:[t.offchainLookupAbiItem]}),[I,v,E,b,m]=w,{ccipRead:_}=f,O=_&&typeof(_==null?void 0:_.request)=="function"?_.request:d;try{if(!(0,o.isAddressEqual)(y,I))throw new r.OffchainLookupSenderMismatchError({sender:I,to:y});const C=await O({data:E,sender:I,urls:v}),{data:S}=await(0,e.call)(f,{blockNumber:g,blockTag:h,data:(0,a.concat)([b,(0,i.encodeAbiParameters)([{type:"bytes"},{type:"bytes"}],[C,m])]),to:y});return S}catch(C){throw new r.OffchainLookupError({callbackSelector:b,cause:C,data:p,extraData:m,sender:I,urls:v})}}async function d({data:f,sender:g,urls:h}){var y;let p=new Error("An unknown error occurred.");for(let w=0;w<h.length;w++){const I=h[w],v=I.includes("{data}")?"GET":"POST",E=v==="POST"?{data:f,sender:g}:void 0,b=v==="POST"?{"Content-Type":"application/json"}:{};try{const m=await fetch(I.replace("{sender}",g).replace("{data}",f),{body:JSON.stringify(E),headers:b,method:v});let _;if((y=m.headers.get("Content-Type"))!=null&&y.startsWith("application/json")?_=(await m.json()).data:_=await m.text(),!m.ok){p=new n.HttpRequestError({body:E,details:_!=null&&_.error?(0,u.stringify)(_.error):m.statusText,headers:m.headers,status:m.status,url:I});continue}if(!(0,c.isHex)(_)){p=new r.OffchainLookupResponseMalformedError({result:_,url:I});continue}return _}catch(m){p=new n.HttpRequestError({body:E,details:m.message,url:I})}}throw p}}(CS)),CS}var nD;function W0(){if(nD)return Gg;nD=1,Object.defineProperty(Gg,"__esModule",{value:!0}),Gg.call=v,Gg.getRevertErrorData=O;const t=vC(),e=pn(),r=sf(),n=Hve(),s=UC(),i=ut(),o=q0(),a=zu(),c=wc(),u=z0(),l=yi(),d=Gu(),f=Be(),g=SN(),h=Up(),p=gc(),y=TN(),w=gN(),I=mc();async function v(C,S){var ve,ae,re,wt;const{account:T=C.account,batch:N=!!((ve=C.batch)!=null&&ve.multicall),blockNumber:R,blockTag:B="latest",accessList:A,blobs:P,code:k,data:U,factory:x,factoryData:j,gas:D,gasPrice:M,maxFeePerBlobGas:L,maxFeePerGas:H,maxPriorityFeePerGas:z,nonce:V,to:G,value:ee,stateOverride:X,...oe}=S,te=T?(0,e.parseAccount)(T):void 0;if(k&&(x||j))throw new i.BaseError("Cannot provide both `code` & `factory`/`factoryData` as parameters.");if(k&&G)throw new i.BaseError("Cannot provide both `code` & `to` as parameters.");const fe=k&&U,Se=x&&j&&G&&U,le=fe||Se,we=fe?m({code:k,data:U}):Se?_({data:U,factory:x,factoryData:j,to:G}):U;try{(0,I.assertRequest)(S);const pt=(R?(0,f.numberToHex)(R):void 0)||B,nr=(0,w.serializeStateOverride)(X),Jt=(wt=(re=(ae=C.chain)==null?void 0:ae.formatters)==null?void 0:re.transactionRequest)==null?void 0:wt.format,ie=(Jt||p.formatTransactionRequest)({...(0,h.extract)(oe,{format:Jt}),from:te==null?void 0:te.address,accessList:A,blobs:P,data:we,gas:D,gasPrice:M,maxFeePerBlobGas:L,maxFeePerGas:H,maxPriorityFeePerGas:z,nonce:V,to:le?void 0:G,value:ee});if(N&&E({request:ie})&&!nr)try{return await b(C,{...ie,blockNumber:R,blockTag:B})}catch(Ce){if(!(Ce instanceof o.ClientChainNotConfiguredError)&&!(Ce instanceof o.ChainDoesNotSupportContract))throw Ce}const de=await C.request({method:"eth_call",params:nr?[ie,pt,nr]:[ie,pt]});return de==="0x"?{data:void 0}:{data:de}}catch(Ot){const pt=O(Ot),{offchainLookup:nr,offchainLookupSignature:Jt}=await Promise.resolve().then(()=>PN());if(C.ccipRead!==!1&&(pt==null?void 0:pt.slice(0,10))===Jt&&G)return{data:await nr(C,{data:pt,to:G})};throw le&&(pt==null?void 0:pt.slice(0,10))==="0x101bb98d"?new a.CounterfactualDeploymentFailedError({factory:x}):(0,g.getCallError)(Ot,{...S,account:te,chain:C.chain})}}function E({request:C}){const{data:S,to:T,...N}=C;return!(!S||S.startsWith(n.aggregate3Signature)||!T||Object.values(N).filter(R=>typeof R<"u").length>0)}async function b(C,S){var H;const{batchSize:T=1024,wait:N=0}=typeof((H=C.batch)==null?void 0:H.multicall)=="object"?C.batch.multicall:{},{blockNumber:R,blockTag:B="latest",data:A,multicallAddress:P,to:k}=S;let U=P;if(!U){if(!C.chain)throw new o.ClientChainNotConfiguredError;U=(0,d.getChainContractAddress)({blockNumber:R,chain:C.chain,contract:"multicall3"})}const j=(R?(0,f.numberToHex)(R):void 0)||B,{schedule:D}=(0,y.createBatchScheduler)({id:`${C.uid}.${j}`,wait:N,shouldSplitBatch(z){return z.reduce((G,{data:ee})=>G+(ee.length-2),0)>T*2},fn:async z=>{const V=z.map(X=>
310({allowFailure:!0,callData:X.data,target:X.to})),G=(0,l.encodeFunctionData)({abi:r.multicall3Abi,args:[V],functionName:"aggregate3"}),ee=await C.request({method:"eth_call",params:[{data:G,to:U},j]});return(0,c.decodeFunctionResult)({abi:r.multicall3Abi,args:[V],functionName:"aggregate3",data:ee||"0x"})}}),[{returnData:M,success:L}]=await D({data:A,to:k});if(!L)throw new a.RawContractError({data:M});return M==="0x"?{data:void 0}:{data:M}}function m(C){const{code:S,data:T}=C;return(0,u.encodeDeployData)({abi:(0,t.parseAbi)(["constructor(bytes, bytes)"]),bytecode:s.deploylessCallViaBytecodeBytecode,args:[S,T]})}function _(C){const{data:S,factory:T,factoryData:N,to:R}=C;return(0,u.encodeDeployData)({abi:(0,t.parseAbi)(["constructor(address, bytes, address, bytes)"]),bytecode:s.deploylessCallViaFactoryBytecode,args:[R,S,T,N]})}function O(C){var T;if(!(C instanceof i.BaseError))return;const S=C.walk();return typeof(S==null?void 0:S.data)=="object"?(T=S.data)==null?void 0:T.data:S.data}return Gg}var sD;function Ec(){if(sD)return Xw;sD=1,Object.defineProperty(Xw,"__esModule",{value:!0}),Xw.readContract=i;const t=wc(),e=yi(),r=Wu(),n=Vt(),s=W0();async function i(o,a){const{abi:c,address:u,args:l,functionName:d,...f}=a,g=(0,e.encodeFunctionData)({abi:c,args:l,functionName:d});try{const{data:h}=await(0,n.getAction)(o,s.call,"call")({...f,data:g,to:u});return(0,t.decodeFunctionResult)({abi:c,args:l,functionName:d,data:h||"0x"})}catch(h){throw(0,r.getContractError)(h,{abi:c,address:u,args:l,docsPath:"/docs/contract/readContract",functionName:d})}}return Xw}var o1={},iD;function kz(){if(iD)return o1;iD=1,Object.defineProperty(o1,"__esModule",{value:!0}),o1.simulateContract=o;const t=pn(),e=wc(),r=yi(),n=Wu(),s=Vt(),i=W0();async function o(a,c){const{abi:u,address:l,args:d,dataSuffix:f,functionName:g,...h}=c,p=h.account?(0,t.parseAccount)(h.account):a.account,y=(0,r.encodeFunctionData)({abi:u,args:d,functionName:g});try{const{data:w}=await(0,s.getAction)(a,i.call,"call")({batch:!1,data:`${y}${f?f.replace("0x",""):""}`,to:l,...h,account:p}),I=(0,e.decodeFunctionResult)({abi:u,args:d,functionName:g,data:w||"0x"}),v=u.filter(E=>"name"in E&&E.name===c.functionName);return{result:I,request:{abi:v,address:l,args:d,dataSuffix:f,functionName:g,...h,account:p}}}catch(w){throw(0,n.getContractError)(w,{abi:u,address:l,args:d,docsPath:"/docs/contract/simulateContract",functionName:g,sender:p==null?void 0:p.address})}}return o1}var a1={},IS={},oD;function $p(){return oD||(oD=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.cleanupCache=t.listenersCache=void 0,t.observe=r,t.listenersCache=new Map,t.cleanupCache=new Map;let e=0;function r(n,s,i){const o=++e,a=()=>t.listenersCache.get(n)||[],c=()=>{const g=a();t.listenersCache.set(n,g.filter(h=>h.id!==o))},u=()=>{const g=a();if(!g.some(p=>p.id===o))return;const h=t.cleanupCache.get(n);g.length===1&&h&&h(),c()},l=a();if(t.listenersCache.set(n,[...l,{id:o,fns:s}]),l&&l.length>0)return u;const d={};for(const g in s)d[g]=(...h)=>{var y,w;const p=a();if(p.length!==0)for(const I of p)(w=(y=I.fns)[g])==null||w.call(y,...h)};const f=i(d);return typeof f=="function"&&t.cleanupCache.set(n,f),u}}(IS)),IS}var c1={},u1={},aD;function ON(){if(aD)return u1;aD=1,Object.defineProperty(u1,"__esModule",{value:!0}),u1.wait=t;async function t(e){return new Promise(r=>setTimeout(r,e))}return u1}var cD;function V0(){if(cD)return c1;cD=1,Object.defineProperty(c1,"__esModule",{value:!0}),c1.poll=e;const t=ON();function e(r,{emitOnBegin:n,initialWaitTime:s,interval:i}){let o=!0;const a=()=>o=!1;return(async()=>{let u;n&&(u=await r({unpoll:a}));const l=await(s==null?void 0:s(u))??i;await(0,t.wait)(l);const d=async()=>{o&&(await r({unpoll:a}),await(0,t.wait)(i),d())};d()})(),a}return c1}var Zg={},SS={},uD;function zve(){return uD||(uD=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.responseCache=t.promiseCache=void 0,t.getCache=e,t.withCache=r,t.promiseCache=new Map,t.responseCache=new Map;function e(n){const s=(a,c)=>({clear:()=>c.delete(a),get:()=>c.get(a),set:u=>c.set(a,u)}
310),i=s(n,t.promiseCache),o=s(n,t.responseCache);return{clear:()=>{i.clear(),o.clear()},promise:i,response:o}}async function r(n,{cacheKey:s,cacheTime:i=Number.POSITIVE_INFINITY}){const o=e(s),a=o.response.get();if(a&&i>0&&new Date().getTime()-a.created.getTime()<i)return a.data;let c=o.promise.get();c||(c=n(),o.promise.set(c));try{const u=await c;return o.response.set({created:new Date,data:u}),u}finally{o.promise.clear()}}}(SS)),SS}var lD;function G0(){if(lD)return Zg;lD=1,Object.defineProperty(Zg,"__esModule",{value:!0}),Zg.getBlockNumberCache=r,Zg.getBlockNumber=n;const t=zve(),e=s=>`blockNumber.${s}`;function r(s){return(0,t.getCache)(e(s))}async function n(s,{cacheTime:i=s.cacheTime}={}){const o=await(0,t.withCache)(()=>s.request({method:"eth_blockNumber"}),{cacheKey:e(s.uid),cacheTime:i});return BigInt(o)}return Zg}var l1={},dD;function MC(){if(dD)return l1;dD=1,Object.defineProperty(l1,"__esModule",{value:!0}),l1.getFilterChanges=r;const t=H0(),e=bc();async function r(n,{filter:s}){const i="strict"in s&&s.strict,o=await s.request({method:"eth_getFilterChanges",params:[s.id]});if(typeof o[0]=="string")return o;const a=o.map(c=>(0,e.formatLog)(c));return!("abi"in s)||!s.abi?a:(0,t.parseEventLogs)({abi:s.abi,logs:a,strict:i})}return l1}var d1={},fD;function $C(){if(fD)return d1;fD=1,Object.defineProperty(d1,"__esModule",{value:!0}),d1.uninstallFilter=t;async function t(e,{filter:r}){return r.request({method:"eth_uninstallFilter",params:[r.id]})}return d1}var hD;function jz(){if(hD)return a1;hD=1,Object.defineProperty(a1,"__esModule",{value:!0}),a1.watchContractEvent=h;const t=lr(),e=nf(),r=F0(),n=tf(),s=bc(),i=Vt(),o=$p(),a=V0(),c=xn(),u=uN(),l=G0(),d=IN(),f=MC(),g=$C();function h(p,y){const{abi:w,address:I,args:v,batch:E=!0,eventName:b,fromBlock:m,onError:_,onLogs:O,poll:C,pollingInterval:S=p.pollingInterval,strict:T}=y;return(typeof C<"u"?C:typeof m=="bigint"?!0:!(p.transport.type==="webSocket"||p.transport.type==="fallback"&&p.transport.transports[0].c
310onfig.type==="webSocket"))?(()=>{const A=T??!1,P=(0,c.stringify)(["watchContractEvent",I,v,E,p.uid,b,S,A,m]);return(0,o.observe)(P,{onLogs:O,onError:_},k=>{let U;m!==void 0&&(U=m-1n);let x,j=!1;const D=(0,a.poll)(async()=>{var M;if(!j){try{x=await(0,i.getAction)(p,u.createContractEventFilter,"createContractEventFilter")({abi:w,address:I,args:v,eventName:b,strict:A,fromBlock:m})}catch{}j=!0;return}try{let L;if(x)L=await(0,i.getAction)(p,f.getFilterChanges,"getFilterChanges")({filter:x});else{const H=await(0,i.getAction)(p,l.getBlockNumber,"getBlockNumber")({});U&&U<H?L=await(0,i.getAction)(p,d.getContractEvents,"getContractEvents")({abi:w,address:I,args:v,eventName:b,fromBlock:U+1n,toBlock:H,strict:A}):L=[],U=H}if(L.length===0)return;if(E)k.onLogs(L);else for(const H of L)k.onLogs([H])}catch(L){x&&L instanceof e.InvalidInputRpcError&&(j=!1),(M=k.onError)==null||M.call(k,L)}},{emitOnBegin:!0,interval:S});return async()=>{x&&await(0,i.getAction)(p,g.uninstallFilter,"uninstallFilter")({filter:x}),D()}})})():(()=>{const A=T??!1,P=(0,c.stringify)(["watchContractEvent",I,v,E,p.uid,b,S,A]);let k=!0,U=()=>k=!1;return(0,o.observe)(P,{onLogs:O,onError:_},x=>((async()=>{try{const j=(()=>{if(p.transport.type==="fallback"){const L=p.transport.transports.find(H=>H.config.type==="webSocket");return L?L.value:p.transport}return p.transport})(),D=b?(0,n.encodeEventTopics)({abi:w,eventName:b,args:v}):[],{unsubscribe:M}=await j.subscribe({params:["logs",{address:I,topics:D}],onData(L){var z;if(!k)return;const H=L.result;try{const{eventName:V,args:G}=(0,r.decodeEventLog)({abi:w,data:H.data,topics:H.topics,strict:T}),ee=(0,s.formatLog)(H,{args:G,eventName:V});x.onLogs([ee])}catch(V){let G,ee;if(V instanceof t.DecodeLogDataMismatch||V instanceof t.DecodeLogTopicsMismatch){if(T)return;G=V.abiItem.name,ee=(z=V.abiItem.inputs)==null?void 0:z.some(oe=>!("name"in oe&&oe.name))}const X=(0,s.formatLog)(H,{args:ee?[]:{},eventName:G});x.onLogs([X])}},onError(L){var H;(H=x.onError)==null||H.call(x,L)}});U=M,k||U()}catch(j){_==null||_(j)}})(),()=>U()))})()}return a1}var f1={},yl={},pD;function K0(){if(pD)return yl;pD=1,Object.defineProperty(yl,"__esModule",{value:!0}),yl.AccountTypeNotSupportedError=yl.AccountNotFoundError=void 0;const t=ut();class e extends t.BaseError{constructor({docsPath:s}={}){super(["Could not find an Account to execute with this Action.","Please provide an Account with the `account` argument on the Action, or by supplying an `account` to the Client."].join(`
311`),{docsPath:s,docsSlug:"account",name:"AccountNotFoundError"})}}yl.AccountNotFoundError=e;class r extends t.BaseError{constructor({docsPath:s,metaMessages:i,type:o}){super(`Account type "${o}" is not supported.`,{docsPath:s,metaMessages:i,name:"AccountTypeNotSupportedError"})}}return yl.AccountTypeNotSupportedError=r,yl}var h1={},p1={},gD;function LC(){if(gD)return p1;gD=1,Object.defineProperty(p1,"__esModule",{value:!0}),p1.assertCurrentChain=e;const t=q0();function e({chain:r,currentChainId:n}){if(!r)throw new t.ChainNotFoundError;if(n!==r.id)throw new t.ChainMismatchError({chain:r,currentChainId:n})}return p1}var g1={},mD;function Dz(){if(mD)return g1;mD=1,Object.defineProperty(g1,"__esModule",{value:!0}),g1.getTransactionError=n;const t=pc(),e=Zs(),r=U0();function n(s,{docsPath:i,...o}){const a=(()=>{const c=(0,r.getNodeError)(s,o);return c instanceof t.UnknownNodeError?s:c})();return new e.TransactionExecutionError(a,{docsPath:i,...o})}return g1}var m1={},yD;function NN(){if(yD)return m1;yD=1,Object.defineProperty(m1,"__esModule",{value:!0}),m1.sendRawTransaction=t;async function t(e,{serializedTransaction:r}){return e.request({method:"eth_sendRawTransaction",params:[r]},{retryCount:0})}return m1}var bD;function xN(){if(bD)return h1;bD=1,Object.defineProperty(h1,"__esModule",{value:!0}),h1.sendTransaction=p;const t=pn(),e=K0(),r=ut(),n=Az(),s=LC(),i=Dz(),o=Up(),a=gc(),c=Vt(),u=x0(),l=mc(),d=L0(),f=DC(),g=NN(),h=new u.LruMap(128);async function p(y,w){var k,U,x,j;const{account:I=y.account,chain:v=y.chain,accessList:E,authorizationList:b,blobs:m,data:_,gas:O,gasPrice:C,maxFeePerBlobGas:S,maxFeePerGas:T,maxPriorityFeePerGas:N,nonce:R,value:B,...A}=w;if(typeof I>"u")throw new e.AccountNotFoundError({docsPath:"/docs/actions/wallet/sendTransaction"});const P=I?(0,t.parseAccount)(I):null;try{(0,l.assertRequest)(w);const D=await(async()=>
311{if(w.to)return w.to;if(b&&b.length>0)return await(0,n.recoverAuthorizationAddress)({authorization:b[0]}).catch(()=>{throw new r.BaseError("`to` is required. Could not infer from `authorizationList`.")})})();if((P==null?void 0:P.type)==="json-rpc"||P===null){let M;v!==null&&(M=await(0,c.getAction)(y,d.getChainId,"getChainId")({}),(0,s.assertCurrentChain)({currentChainId:M,chain:v}));const L=(x=(U=(k=y.chain)==null?void 0:k.formatters)==null?void 0:U.transactionRequest)==null?void 0:x.format,z=(L||a.formatTransactionRequest)({...(0,o.extract)(A,{format:L}),accessList:E,authorizationList:b,blobs:m,chainId:M,data:_,from:P==null?void 0:P.address,gas:O,gasPrice:C,maxFeePerBlobGas:S,maxFeePerGas:T,maxPriorityFeePerGas:N,nonce:R,to:D,value:B}),V=h.get(y.uid),G=V?"wallet_sendTransaction":"eth_sendTransaction";try{return await y.request({method:G,params:[z]},{retryCount:0})}catch(ee){if(V===!1)throw ee;const X=ee;if(X.name==="InvalidInputRpcError"||X.name==="InvalidParamsRpcError"||X.name==="MethodNotFoundRpcError"||X.name==="MethodNotSupportedRpcError")return await y.request({method:"wallet_sendTransaction",params:[z]},{retryCount:0}).then(oe=>(h.set(y.uid,!0),oe)).catch(oe=>{const te=oe;throw te.name==="MethodNotFoundRpcError"||te.name==="MethodNotSupportedRpcError"?(h.set(y.uid,!1),X):te});throw X}}if((P==null?void 0:P.type)==="local"){const M=await(0,c.getAction)(y,f.prepareTransactionRequest,"prepareTransactionRequest")({account:P,accessList:E,authorizationList:b,blobs:m,chain:v,data:_,gas:O,gasPrice:C,maxFeePerBlobGas:S,maxFeePerGas:T,maxPriorityFeePerGas:N,nonce:R,nonceManager:P.nonceManager,parameters:[...f.defaultParameters,"sidecars"],value:B,...A,to:D}),L=(j=v==null?void 0:v.serializers)==null?void 0:j.transaction,H=await P.signTransaction(M,{serializer:L});return await(0,c.getAction)(y,g.sendRawTransaction,"sendRawTransaction")({serializedTransaction:H})}throw(P==null?void 0:P.type)==="smart"?new e.AccountTypeNotSupportedError({metaMessages:["Consider using the `sendUserOperation` Action instead."],docsPath:"/docs/actions/bundler/sendUserOperation",type:"smart"}):new e.AccountTypeNotSupportedError({docsPath:"/docs/actions/wallet/sendTransaction",type:P==null?void 0:P.type})}catch(D){throw D instanceof e.AccountTypeNotSupportedError?D:(0,i.getTransactionError)(D,{...w,account:P,chain:w.chain||void 0})}}return h1}var wD;function Uz(){if(wD)return f1;wD=1,Object.defineProperty(f1,"__esModule",{value:!0}),f1.writeContract=o;const t=pn(),e=K0(),r=yi(),n=Wu(),s=Vt(),i=xN();async function o(a,c){const{abi:u,account:l=a.account,address:d,args:f,dataSuffix:g,functionName:h,...p}=c;if(typeof l>"u")throw new e.AccountNotFoundError({docsPath:"/docs/contract/writeContract"});const y=l?(0,t.parseAccount)(l):null,w=(0,r.encodeFunctionData)({abi:u,args:f,functionName:h});try{return await(0,s.getAction)(a,i.sendTransaction,"sendTransaction")({data:`${w}${g?g.replace("0x",""):""}`,to:d,account:y,...p})}catch(I){throw(0,n.getContractError)(I,{abi:u,address:d,args:f,docsPath:"/docs/contract/writeContract",functionName:h,sender:y==null?void 0:y.address})}}return f1}var ED;function Wve(){if(ED)return Af;ED=1,Object.defineProperty(Af,"__esModule",{value:!0}),Af.getContract=c,Af.getFunctionParameters=u,Af.getEventParameters=l;const t=Vt(),e=uN(),r=Rz(),n=IN(),s=Ec(),i=kz(),o=jz(),a=Uz();function c({abi:d,address:f,client:g}){const h=g,[p,y]=h?"public"in h&&"wallet"in h?[h.public,h.wallet]:"public"in h?[h.public,void 0]:"wallet"in h?[void 0,h.wallet]:[h,h]:[void 0,void 0],w=p!=null,I=y!=null,v={};let E=!1,b=!1,m=!1;for(const _ of d)if(_.type==="function"?_.stateMutability==="view"||_.stateMutability==="pure"?E=!0:b=!0:_.type==="event"&&(m=!0),E&&b&&m)break;return w&&(E&&(v.read=new Proxy({},{get(_,O){return(...C)=>{const{args:S,options:T}=u(C);return(0,t.getAction)(p,s.readContract,"readContract")({abi:d,address:f,functionName:O,args:S,...T})}}})),b&&(v.simulate=new Proxy({},{get(_,O){return(...C)=>{const{args:S,options:T}=u(C);return(0,t.getAction)(p,i.simulateContract,"simulateContract")({abi:d,address:f,functionName:O,args:S,...T})}}})),m&&(v.createEventFilter=new Proxy({},{get(_,O){return(...C)=>{const S=d.find(R=>R.type==="event"&&R.name===O),{args:T,options:N}=l(C,S);return(0,t.getAction)(p,e.createContractEventFilter,"createContractEventFilter")({abi:d,address:f,eventName:O,args:T,...N})}}}),v.getEvents=new Proxy({},{get(_,O){return(...C)=>{const S=d.find(R=>R.type==="event"&&R.name===O),{args:T,options:N}=l(C,S);return(0,t.getAction)(p,n.getContractEvents,"getContractEvents")({abi:d,address:f,eventName:O,args:T,...N})}}}),v.watchEvent=new Proxy({},{get(_,O){return(...C)=>{const S=d.find(R=>R.type==="event"&&R.name===O),{args:T,options:N}=l(C,S);return(0,t.getAction)(p,o.watchContractEvent,"watchContractEvent")({abi:d,address:f,eventName:O,args:T,...N})}}}))),I&&b&&(v.write=new Proxy({},{get(_,O){return(...C)=>{const{args:S,options:T}=u(C);return(0,t.getAction)(y,a.writeContract,"writeContract")({abi:d,address:f,functionName:O,args:S,...T})}}})),(w||I)&&b&&(v.estimateGas=new Proxy({},{get(_,O){return(...C)=>{const{args:S,options:T}=u(C),N=p??y;return(0,t.getAction)(N,r.estimateContractGas,"estimateContractGas")({abi:d,address:f,functionName:O,args:S,...T,account:T.account??y.account})}}})),v.address=f,v.abi=d,v}function u(d){const f=d.length&&Array.isArray(d[0]),g=f?d[0]:[],h=(f?d[1]:d[0])??{};return{args:g,options:h}}function l(d,f){let g=!1;Array.isArray(d[0])?g=!0:d.length===1?g=f.inputs.some(y=>y.indexed):d.length===2&&(g=!0);const h=g?d[0]:void 0,p=(g?d[1]:d[0])??{};return{args:h,options:p}}return Af}var Yg={},y1={},vD;function Mz(){if(vD)return y1;vD=1,Object.defineProperty(y1,"__esModule",{value:!0}),y1.uid=n;const t=256;let e=t,r;function n(s=11){if(!r||e+s>t*2){r="",e=0;for(let i=0;i<t;i++)r+=(256+Math.random()*256|0).toString(16).substring(1)}return r.substring(e,e+++s)}return y1}var _D;function FC(){if(_D)return Yg;
311_D=1,Object.defineProperty(Yg,"__esModule",{value:!0}),Yg.createClient=r,Yg.rpcSchema=n;const t=pn(),e=Mz();function r(s){const{batch:i,cacheTime:o=s.pollingInterval??4e3,ccipRead:a,key:c="base",name:u="Base Client",pollingInterval:l=4e3,type:d="base"}=s,f=s.chain,g=s.account?(0,t.parseAccount)(s.account):void 0,{config:h,request:p,value:y}=s.transport({chain:f,pollingInterval:l}),w={...h,...y},I={account:g,batch:i,cacheTime:o,ccipRead:a,chain:f,key:c,name:u,pollingInterval:l,request:p,transport:w,type:d,uid:(0,e.uid)()};function v(E){return b=>{const m=b(E);for(const O in I)delete m[O];const _={...E,...m};return Object.assign(_,{extend:v(_)})}}return Object.assign(I,{extend:v(I)})}function n(){return null}return Yg}var b1={},w1={},Jg={},TS={},AD;function Vve(){return AD||(AD=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.promiseCache=void 0,t.withDedupe=r;const e=x0();t.promiseCache=new e.LruMap(8192);function r(n,{enabled:s=!0,id:i}){if(!s||!i)return n();if(t.promiseCache.get(i))return t.promiseCache.get(i);const o=n().finally(()=>t.promiseCache.delete(i));return t.promiseCache.set(i,o),o}}(TS)),TS}var E1={},CD;function RN(){if(CD)return E1;CD=1,Object.defineProperty(E1,"__esModule",{value:!0}),E1.withRetry=e;const t=ON();function e(r,{delay:n=100,retryCount:s=2,shouldRetry:i=()=>!0}={}){return new Promise((o,a)=>{const c=async({count:u=0}={})=>{const l=async({error:d})=>{const f=typeof n=="function"?n({count:u,error:d}):n;f&&await(0,t.wait)(f),c({count:u+1})};try{const d=await r();o(d)}catch(d){if(u<s&&await i({count:u,error:d}))return l({error:d});a(d)}};c()})}return E1}var ID;function $z(){if(ID)return Jg;ID=1,Object.defineProperty(Jg,"__esModule",{value:!0}),Jg.buildRequest=a,Jg.shouldRetry=c;const t=ut(),e=no(),r=nf(),n=Be(),s=Vve(),i=RN(),o=xn();function a(u,l={}){return async(d,f={})=>{var E;const{dedupe:g=!1,methods:h,retryDelay:p=150,retryCount:y=3,uid:w}={...l,...f},{method:I}=d;if((E=h==null?void 0:h.exclude)!=null&&E.includes(I))throw new r.MethodNotSupportedRpcError(new Error("method not supported"),{method:I});if(h!=null&&h.include&&!h.include.includes(I))throw new r.MethodNotSupportedRpcError(new Error("method not supported"),{method:I});const v=g?(0,n.stringToHex)(`${w}.${(0,o.stringify)(d)}`):void 0;return(0,s.withDedupe)(()=>(0,i.withRetry)(async()=>{try{return await u(d)}catch(b){const m=b;switch(m.code){case r.ParseRpcError.code:throw new r.ParseRpcError(m);case r.InvalidRequestRpcError.code:throw new r.InvalidRequestRpcError(m);case r.MethodNotFoundRpcError.code:throw new r.MethodNotFoundRpcError(m,{method:d.method});case r.InvalidParamsRpcError.code:throw new r.InvalidParamsRpcError(m);case r.InternalRpcError.code:throw new r.InternalRpcError(m);case r.InvalidInputRpcError.code:throw new r.InvalidInputRpcError(m);case r.ResourceNotFoundRpcError.code:throw new r.ResourceNotFoundRpcError(m);case r.ResourceUnavailableRpcError.code:throw new r.ResourceUnavailableRpcError(m);case r.TransactionRejectedRpcError.code:throw new r.TransactionRejectedRpcError(m);case r.MethodNotSupportedRpcError.code:throw new r.MethodNotSupportedRpcError(m,{method:d.method});case r.LimitExceededRpcError.code:throw new r.LimitExceededRpcError(m);case r.JsonRpcVersionUnsupportedError.code:throw new r.JsonRpcVersionUnsupportedError(m);case r.UserRejectedRequestError.code:throw new r.UserRejectedRequestError(m);case r.UnauthorizedProviderError.code:throw new r.UnauthorizedProviderError(m);case r.UnsupportedProviderMethodError.code:throw new r.UnsupportedProviderMethodError(m);case r.ProviderDisconnectedError.code:throw new r.ProviderDisconnectedError(m);case r.ChainDisconnectedError.code:throw new r.ChainDisconnectedError(m);case r.SwitchChainError.code:throw new r.SwitchChainError(m);case 5e3:throw new r.UserRejectedRequestError(m);default:throw b instanceof t.BaseError?b:new r.UnknownRpcError(m)}}},{delay:({count:b,error:m})=>{var _;if(m&&m instanceof e.HttpRequestError){const O=(_=m==null?void 0:m.headers)==null?void 0:_.get("Retry-After");if(O!=null&&O.match(/\d/))return Number.parseInt(O)*1e3}return~~(1<<b)*p},retryCount:y,shouldRetry:({error:b})=>c(b)}),{enabled:g,id:v})}}function c(u){return"code"in u&&typeof u.code=="number"?u.code===-1||u.code===r.LimitExceededRpcError.code||u.code===r.InternalRpcError.code:u instanceof e.HttpRequestError&&u.status?u.status===403||u.status===408||u.status===4
31113||u.status===429||u.status===500||u.status===502||u.status===503||u.status===504:!0}return Jg}var SD;function Z0(){if(SD)return w1;SD=1,Object.defineProperty(w1,"__esModule",{value:!0}),w1.createTransport=r;const t=$z(),e=Mz();function r({key:n,methods:s,name:i,request:o,retryCount:a=3,retryDelay:c=150,timeout:u,type:l},d){const f=(0,e.uid)();return{config:{key:n,methods:s,name:i,request:o,retryCount:a,retryDelay:c,timeout:u,type:l},request:(0,t.buildRequest)(o,{methods:s,retryCount:a,retryDelay:c,uid:f}),value:d}}return w1}var TD;function Gve(){if(TD)return b1;TD=1,Object.defineProperty(b1,"__esModule",{value:!0}),b1.custom=e;const t=Z0();function e(r,n={}){const{key:s="custom",methods:i,name:o="Custom Provider",retryDelay:a}=n;return({retryCount:c})=>(0,t.createTransport)({key:s,methods:i,name:o,request:r.request.bind(r),retryCount:n.retryCount??c,retryDelay:a,type:"custom"})}return b1}var Qg={},PD;function Kve(){if(PD)return Qg;PD=1,Object.defineProperty(Qg,"__esModule",{value:!0}),Qg.fallback=s,Qg.rankTransports=o;const t=pc(),e=nf(),r=ON(),n=Z0();function s(a,c={}){const{key:u="fallback",name:l="Fallback",rank:d=!1,retryCount:f,retryDelay:g}=c;return({chain:h,pollingInterval:p=4e3,timeout:y,...w})=>{let I=a,v=()=>{};const E=(0,n.createTransport)({key:u,name:l,async request({method:b,params:m}){let _;const O=async(C=0)=>{const S=I[C]({...w,chain:h,retryCount:0,timeout:y});try{const T=await S.request({method:b,params:m});return v({method:b,params:m,response:T,transport:S,status:"success"}),T}catch(T){if(v({error:T,method:b,params:m,transport:S,status:"error"}),i(T)||C===I.length-1||(_??(_=I.slice(C+1).some(N=>{const{include:R,exclude:B}=N({chain:h}).config.methods||{};return R?R.includes(b):B?!B.includes(b):!0})),!_))throw T;return O(C+1)}};return O()},retryCount:f,retryDelay:g,type:"fallback"},{onResponse:b=>v=b,transports:I.map(b=>b({chain:h,retryCount:0}))});if(d){const b=typeof d=="object"?d:{};o({chain:h,interval:b.interval??p,onTransports:m=>I=m,ping:b.ping,sampleCount:b.sampleCount,timeout:b.timeout,transports:I,weights:b.weights})}return E}}function i(a){return!!("code"in a&&typeof a.code=="number"&&(a.code===e.TransactionRejectedRpcError.code||a.code===e.UserRejectedRequestError.code||t.ExecutionRevertedError.nodeMessage.test(a.message)||a.code===5e3))}function o({chain:a,interval:c=4e3,onTransports:u,ping:l,sampleCount:d=10,timeout:f=1e3,transports:g,weights:h={}}){const{stability:p=.7,latency:y=.3}=h,w=[],I=async()=>{const v=await Promise.all(g.map(async m=>{const _=m({chain:a,retryCount:0,timeout:f}),O=Date.now();let C,S;try{await(l?l({transport:_}):_.request({method:"net_listening"})),S=1}catch{S=0}finally{C=Date.now()}return{latency:C-O,success:S}}));w.push(v),w.length>d&&w.shift();const E=Math.max(...w.map(m=>Math.max(...m.map(({latency:_})=>_)))),b=g.map((m,_)=>{const O=w.map(R=>R[_].latency),S=1-O.reduce((R,B)=>R+B,0)/O.length/E,T=w.map(R=>R[_].success),N=T.reduce((R,B)=>R+B,0)/T.length;return N===0?[0,_]:[y*S+p*N,_]}).sort((m,_)=>_[0]-m[0]);u(b.map(([,m])=>g[m])),await(0,r.wait)(c),I()};I()}return Qg}var v1={},Xg={},OD;function BN(){if(OD)return Xg;OD=1,Object.defineProperty(Xg,"__esModule",{value:!0}),Xg.UrlRequiredError=void 0;const t=ut();class e extends t.BaseError{constructor(){super("No URL was provided to the Transport. Please provide a valid RPC URL to the Transport.",{docsPath:"/docs/clients/intro",name:"UrlRequiredError"})}}return Xg.UrlRequiredError=e,Xg}var _1={},A1={},ND;function kN(){if(ND)return A1;ND=1,Object.defineProperty(A1,"__esModule",{value:!0}),A1.withTimeout=t;function t(e,{errorInstance:r=new Error("timed out"),timeout:n,signal:s}){return new Promise((i,o)=>{(async()=>{let a;try{const c=new AbortController;n>0&&(a=setTimeout(()=>{s?c.abort():o(r)},n)),i(await e({signal:(c==null?void 0:c.signal)||null}))}catch(c){(c==null?void 0:c.name)==="AbortError"&&o(r),o(c)}finally{clearTimeout(a)}})()})}return A1}var em={},xD;function Lz(){if(xD)return em;xD=1,Object.defineProperty(em,"__esModule",{value:!0}),em.idCache=void 0;function t(){return{current:0,take(){return this.current++},reset(){this.current=0}}}return em.idCache=t(),em}var RD;function jN(){if(RD)return _1;RD=1,Object.defineProperty(_1,"__esModule",{value:!0}),_1.getHttpRpcClient=s;const t=no(),e=kN(),r=xn(),n=Lz();function s(i,o={}){return{async request(a){var y;const{body:c,onRequest:u=o.onRequest,onResponse:l=o.onResponse,timeout:d=o.timeout??1e4}=a,f={...o.fetchOptions??{},...a.fetchOptions??{}},{headers:g,method:h,signal:p}=f;try{const w=await(0,e.withTimeout)(async({signal:v})=>{const E={...f,body:Array.isArray(c)?(0,r.stringify)(c.map(O=>({jsonrpc:"2.0",id:O.id??n.idCache.take(),...O}))):(0,r.stringify)({jsonrpc:"2.0",id:c.id??n.idCache.take(),...c}),headers:{"Content-Type":"application/json",...g},method:h||"POST",signal:p||(d>0?v:null)}
311,b=new Request(i,E),m=await(u==null?void 0:u(b,E))??{...E,url:i};return await fetch(m.url??i,m)},{errorInstance:new t.TimeoutError({body:c,url:i}),timeout:d,signal:!0});l&&await l(w);let I;if((y=w.headers.get("Content-Type"))!=null&&y.startsWith("application/json"))I=await w.json();else{I=await w.text();try{I=JSON.parse(I||"{}")}catch(v){if(w.ok)throw v;I={error:I}}}if(!w.ok)throw new t.HttpRequestError({body:c,details:(0,r.stringify)(I.error)||w.statusText,headers:w.headers,status:w.status,url:i});return I}catch(w){throw w instanceof t.HttpRequestError||w instanceof t.TimeoutError?w:new t.HttpRequestError({body:c,cause:w,url:i})}}}}return _1}var BD;function Zve(){if(BD)return v1;BD=1,Object.defineProperty(v1,"__esModule",{value:!0}),v1.http=i;const t=no(),e=BN(),r=TN(),n=jN(),s=Z0();function i(o,a={}){const{batch:c,fetchOptions:u,key:l="http",methods:d,name:f="HTTP JSON-RPC",onFetchRequest:g,onFetchResponse:h,retryDelay:p}=a;return({chain:y,retryCount:w,timeout:I})=>{const{batchSize:v=1e3,wait:E=0}=typeof c=="object"?c:{},b=a.retryCount??w,m=I??a.timeout??1e4,_=o||(y==null?void 0:y.rpcUrls.default.http[0]);if(!_)throw new e.UrlRequiredError;const O=(0,n.getHttpRpcClient)(_,{fetchOptions:u,onRequest:g,onResponse:h,timeout:m});return(0,s.createTransport)({key:l,methods:d,name:f,async request({method:C,params:S}){const T={method:C,params:S},{schedule:N}=(0,r.createBatchScheduler)({id:_,wait:E,shouldSplitBatch(P){return P.length>v},fn:P=>O.request({body:P}),sort:(P,k)=>P.id-k.id}),R=async P=>c?N(P):[await O.request({body:P})],[{error:B,result:A}]=await R(T);if(B)throw new t.RpcRequestError({body:T,error:B,url:_});return A},retryCount:b,retryDelay:p,timeout:m,type:"http"},{fetchOptions:u,url:_})}}return v1}var C1={},I1={},S1={},T1={},kD;function DN(){if(kD)return T1;kD=1,Object.defineProperty(T1,"__esModule",{value:!0}),T1.isNullUniversalResolverError=n;const t=lN(),e=ut(),r=zu();function n(s,i){var a,c,u,l,d,f;if(!(s instanceof e.BaseError))return!1;const o=s.walk(g=>g instanceof r.ContractFunctionRevertedError);return o instanceof r.ContractFunctionRevertedError?!!(((a=o.data)==null?void 0:a.errorName)==="ResolverNotFound"||((c=o.data)==null?void 0:c.errorName)==="ResolverWildcardNotSupported"||((u=o.data)==null?void 0:u.errorName)==="ResolverNotContract"||((l=o.data)==null?void 0:l.errorName)==="ResolverError"||((d=o.data)==null?void 0:d.errorName)==="HttpError"||(f=o.reason)!=null&&f.includes("Wildcard on non-extended resolvers is not supported")||i==="reverse"&&o.reason===t.panicReasons[50]):!1}return T1}var P1={},O1={},jD;function Fz(){if(jD)return O1;jD=1,Object.defineProperty(O1,"__esModule",{value:!0}),O1.encodedLabelToLabelhash=e;const t=Qn();function e(r){if(r.length!==66||r.indexOf("[")!==0||r.indexOf("]")!==65)return null;const n=`0x${r.slice(1,65)}`;return(0,t.isHex)(n)?n:null}return O1}var DD;function UN(){if(DD)return P1;DD=1,Object.defineProperty(P1,"__esModule",{value:!0}),P1.namehash=i;const t=Xn(),e=Yt(),r=Be(),n=Is(),s=Fz();function i(o){let a=new Uint8Array(32).fill(0);if(!o)return(0,r.bytesToHex)(a);const c=o.split(".");for(let u=c.length-1;u>=0;u-=1){const l=(0,s.encodedLabelToLabelhash)(c[u]),d=l?(0,e.toBytes)(l):(0,n.keccak256)((0,e.stringToBytes)(c[u]),"bytes");a=(0,n.keccak256)((0,t.concat)([a,d]),"bytes")}return(0,r.bytesToHex)(a)}return P1}var N1={},x1={},UD;function Yve(){if(UD)return x1;UD=1,Object.defineProperty(x1,"__esModule",{value:!0}),x1.encodeLabelhash=t;function t(e){return`[${e.slice(2)}]`}return x1}var R1={},MD;function Hz(){if(MD)return R1;MD=1,Object.defineProperty(R1,"__esModule",{value:!0}),R1.labelhash=s;const t=Yt(),e=Be(),r=Is(),n=Fz();function s(i){const o=new Uint8Array(32).fill(0);return i?(0,n.encodedLabelToLabelhash)(i)||(0,r.keccak256)((0,t.stringToBytes)(i)):(0,e.bytesToHex)(o)}return R1}var $D;function HC(){if($D)return N1;$D=1,Object.defineProperty(N1,"__esModule",{value:!0}),N1.packetToBytes=n;const t=Yt(),e=Yve(),r=Hz();function n(s){const i=s.replace(/^\.|\.$/gm,"");if(i.length===0)return new Uint8Array(1);const o=new Uint8Array((0,t.stringToBytes)(i).byteLength+2);let a=0;const c=i.split(".");for(let u=0;u<c.length;u++){let l=(0,t.stringToBytes)(c[u]);l.byteLength>255&&(l=(0,t.stringToBytes)((0,e.encodeLabelhash)((0,r.labelhash)(c[u])))),o[a]=l.length,o.set(l,a+1),a+=l.length+1}return o.byteLength!==a+1?o.slice(0,a+1):o}return N1}var LD;function Jve(){if(LD)return S1;LD=1,Object.defineProperty(S1,"__esModule",{value:!0}),S1.getEnsAddress=d;const t=sf(),e=wc(),r=yi(),n=Gu(),s=Hu(),i=Be(),o=DN(),a=UN(),c=HC(),u=Vt(),l=Ec();async function d(f,{blockNumber:g,blockTag:h,coinType:p,name:y,gatewayUrls:w,strict:I,universalResolverAddress:v}){let E=v;if(!E){if(!f.chain)throw new Error("client chain not configured. universalResolverAddress is required.");E=(0,n.getChainContractAddress)({blockNumber:g,chain:f.chain,contract:"ensUniversalResolver"})}try{const b=(0,r.encodeFunctionData)({abi:t.addressResolverAbi,functionName:"addr",...p!=null?{args:[(0,a.namehash)(y),BigInt(p)]}:{args:[(0,a.namehash)(y)]}}),m={address:E,abi:t.universalResolverResolveAbi,functionName:"resolve",args:[(0,i.toHex)((0,c.packetToBytes)(y)),b],blockNumber:g,blockTag:h},_=(0,u.getAction)(f,l.readContract,"readContract"),O=w?await _({...m,args:[...m.args,w]}):await _(m);if(O[0]==="0x")return null;const C=(0,e.decodeFunctionResult)({abi:t.addressResolverAbi,args:p!=null?[(0,a.namehash)(y),BigInt(p)]:void 0,functionName:"addr",data:O[0]});return C==="0x"||(0,s.trim)(C)==="0x00"?null:C}catch(b){if(I)throw b;if((0,o.isNullUniversalResolverError)(b,"resolve"))return null;throw b}}return S1}var B1={},k1={},Ci={},Ii={},FD;
311function qz(){if(FD)return Ii;FD=1,Object.defineProperty(Ii,"__esModule",{value:!0}),Ii.EnsAvatarUnsupportedNamespaceError=Ii.EnsAvatarUriResolutionError=Ii.EnsAvatarInvalidNftUriError=Ii.EnsAvatarInvalidMetadataError=void 0;const t=ut();class e extends t.BaseError{constructor({data:o}){super("Unable to extract image from metadata. The metadata may be malformed or invalid.",{metaMessages:["- Metadata must be a JSON object with at least an `image`, `image_url` or `image_data` property.","",`Provided data: ${JSON.stringify(o)}`],name:"EnsAvatarInvalidMetadataError"})}}Ii.EnsAvatarInvalidMetadataError=e;class r extends t.BaseError{constructor({reason:o}){super(`ENS NFT avatar URI is invalid. ${o}`,{name:"EnsAvatarInvalidNftUriError"})}}Ii.EnsAvatarInvalidNftUriError=r;class n extends t.BaseError{constructor({uri:o}){super(`Unable to resolve ENS avatar URI "${o}". The URI may be malformed, invalid, or does not respond with a valid image.`,{name:"EnsAvatarUriResolutionError"})}}Ii.EnsAvatarUriResolutionError=n;class s extends t.BaseError{constructor({namespace:o}){super(`ENS NFT avatar namespace "${o}" is not supported. Must be "erc721" or "erc1155".`,{name:"EnsAvatarUnsupportedNamespaceError"})}}return Ii.EnsAvatarUnsupportedNamespaceError=s,Ii}var HD;function Qve(){if(HD)return Ci;HD=1,Object.defineProperty(Ci,"__esModule",{value:!0}),Ci.isImageUri=o,Ci.getGateway=a,Ci.resolveAvatarUri=c,Ci.getJsonImage=u,Ci.getMetadataAvatarUri=l,Ci.parseAvatarUri=d,Ci.parseNftUri=f,Ci.getNftTokenUri=g;const t=Ec(),e=qz(),r=/(?<protocol>https?:\/\/[^\/]*|ipfs:\/|ipns:\/|ar:\/)?(?<root>\/)?(?<subpath>ipfs\/|ipns\/)?(?<target>[\w\-.]+)(?<subtarget>\/.*)?/,n=/^(Qm[1-9A-HJ-NP-Za-km-z]{44,}|b[A-Za-z2-7]{58,}|B[A-Z2-7]{58,}|z[1-9A-HJ-NP-Za-km-z]{48,}|F[0-9A-F]{50,})(\/(?<target>[\w\-.]+))?(?<subtarget>\/.*)?$/,s=/^data:([a-zA-Z\-/+]*);base64,([^"].*)/,i=/^data:([a-zA-Z\-/+]*)?(;[a-zA-Z0-9].*?)?(,)/;async function o(h){try{const p=await fetch(h,{method:"HEAD"});if(p.status===200){const y=p.headers.get("content-type");return y==null?void 0:y.startsWith("image/")}return!1}catch(p){return typeof p=="object"&&typeof p.response<"u"||!globalThis.hasOwnProperty("Image")?!1:new Promise(y=>{const w=new Image;w.onload=()=>{y(!0)},w.onerror=()=>{y(!1)},w.src=h})}}function a(h,p){return h?h.endsWith("/")?h.slice(0,-1):h:p}function c({uri:h,gatewayUrls:p}){const y=s.test(h);if(y)return{uri:h,isOnChain:!0,isEncoded:y};const w=a(p==null?void 0:p.ipfs,"https://ipfs.io"),I=a(p==null?void 0:p.arweave,"https://arweave.net"),v=h.match(r),{protocol:E,subpath:b,target:m,subtarget:_=""}=(v==null?void 0:v.groups)||{},O=E==="ipns:/"||b==="ipns/",C=E==="ipfs:/"||b==="ipfs/"||n.test(h);if(h.startsWith("http")&&!O&&!C){let T=h;return p!=null&&p.arweave&&(T=h.replace(/https:\/\/arweave.net/g,p==null?void 0:p.arweave)),{uri:T,isOnChain:!1,isEncoded:!1}}if((O||C)&&m)return{uri:`${w}/${O?"ipns":"ipfs"}/${m}${_}`,isOnChain:!1,isEncoded:!1};if(E==="ar:/"&&m)return{uri:`${I}/${m}${_||""}`,isOnChain:!1,isEncoded:!1};let S=h.replace(i,"");if(S.startsWith("<svg")&&(S=`data:image/svg+xml;base64,${btoa(S)}`),S.startsWith("data:")||S.startsWith("{"))return{uri:S,isOnChain:!0,isEncoded:!1};throw new e.EnsAvatarUriResolutionError({uri:h})}function u(h){if(typeof h!="object"||!("image"in h)&&!("image_url"in h)&&!("image_data"in h))throw new e.EnsAvatarInvalidMetadataError({data:h});return h.image||h.image_url||h.image_data}async function l({gatewayUrls:h,uri:p}){try{const y=await fetch(p).then(I=>I.json());return await d({gatewayUrls:h,uri:u(y)})}catch{throw new e.EnsAvatarUriResolutionError({uri:p})}}async function d({gatewayUrls:h,uri:p}){const{uri:y,isOnChain:w}=c({uri:p,gatewayUrls:h});if(w||await o(y))return y;throw new e.EnsAvatarUriResolutionError({uri:p})}function f(h){let p=h;p.startsWith("did:nft:")&&(p=p.replace("did:nft:","").replace(/_/g,"/"));const[y,w,I]=p.split("/"),[v,E]=y.split(":"),[b,m]=w.split(":");if(!v||v.toLowerCase()!=="eip155")throw new e.EnsAvatarInvalidNftUriError({reason:"Only EIP-155 supported"});if(!E)throw new e.EnsAvatarInvalidNftUriError({reason:"Chain ID not found"});if(!m)throw new e.EnsAvatarInvalidNftUriError({reason:"Contract address not found"});if(!I)throw new e.EnsAvatarInvalidNftUriError({reason:"Token ID not found"});if(!b)throw new e.EnsAvatarInvalidNftUriError({reason:"ERC namespace not found"});return{chainID:Number.parseInt(E),namespace:b.toLowerCase(),contractAddress:m,tokenID:I}}async function g(h,{nft:p}){if(p.namespace==="erc721")return(0,t.readContract)(h,{address:p.contractAddress,abi:[{name:"tokenURI",type:"function",stateMutability:"view",inputs:[{name:"tokenId",type:"uint256"}],outputs:[{name:"",type:"string"}]}],functionName:"tokenURI",args:[BigInt(p.tokenID)]});if(p.namespace==="erc1155")return(0,t.readContract)(h,{address:p.contractAddress,abi:[{name:"uri",type:"function",stateMutability:"view",inputs:[{name:"_id",type:"uint256"}],outputs:[{name:"",type:"string"}]}],functionName:"uri",args:[BigInt(p.tokenID)]});throw new e.EnsAvatarUnsupportedNamespaceError({namespace:p.namespace})}return Ci}var qD;function Xve(){if(qD)return k1;qD=1,Object.defineProperty(k1,"__esModule",{value:!0}),k1.parseAvatarRecord=e;const t=Qve();async function e(n,{gatewayUrls:s,record:i}){return/eip155:/i.test(i)?r(n,{gatewayUrls:s,record:i}):(0,t.parseAvatarUri)({uri:i,gatewayUrls:s})}async function r(n,{gatewayUrls:s,record:i}){const o=(0,t.parseNftUri)(i),a=await(0,t.getNftTokenUri)(n,{nft:
311o}),{uri:c,isOnChain:u,isEncoded:l}=(0,t.resolveAvatarUri)({uri:a,gatewayUrls:s});if(u&&(c.includes("data:application/json;base64,")||c.startsWith("{"))){const f=l?atob(c.replace("data:application/json;base64,","")):c,g=JSON.parse(f);return(0,t.parseAvatarUri)({uri:(0,t.getJsonImage)(g),gatewayUrls:s})}let d=o.tokenID;return o.namespace==="erc1155"&&(d=d.replace("0x","").padStart(64,"0")),(0,t.getMetadataAvatarUri)({gatewayUrls:s,uri:c.replace(/(?:0x)?{id}/,d)})}return k1}var j1={},zD;function zz(){if(zD)return j1;zD=1,Object.defineProperty(j1,"__esModule",{value:!0}),j1.getEnsText=l;const t=sf(),e=wc(),r=yi(),n=Gu(),s=Be(),i=DN(),o=UN(),a=HC(),c=Vt(),u=Ec();async function l(d,{blockNumber:f,blockTag:g,name:h,key:p,gatewayUrls:y,strict:w,universalResolverAddress:I}){let v=I;if(!v){if(!d.chain)throw new Error("client chain not configured. universalResolverAddress is required.");v=(0,n.getChainContractAddress)({blockNumber:f,chain:d.chain,contract:"ensUniversalResolver"})}try{const E={address:v,abi:t.universalResolverResolveAbi,functionName:"resolve",args:[(0,s.toHex)((0,a.packetToBytes)(h)),(0,r.encodeFunctionData)({abi:t.textResolverAbi,functionName:"text",args:[(0,o.namehash)(h),p]})],blockNumber:f,blockTag:g},b=(0,c.getAction)(d,u.readContract,"readContract"),m=y?await b({...E,args:[...E.args,y]}):await b(E);if(m[0]==="0x")return null;const _=(0,e.decodeFunctionResult)({abi:t.textResolverAbi,functionName:"text",data:m[0]});return _===""?null:_}catch(E){if(w)throw E;if((0,i.isNullUniversalResolverError)(E,"resolve"))return null;throw E}}return j1}var WD;function e_e(){if(WD)return B1;WD=1,Object.defineProperty(B1,"__esModule",{value:!0}),B1.getEnsAvatar=n;const t=Xve(),e=Vt(),r=zz();async function n(s,{blockNumber:i,blockTag:o,assetGatewayUrls:a,name:c,gatewayUrls:u,strict:l,universalResolverAddress:d}){const f=await(0,e.getAction)(s,r.getEnsText,"getEnsText")({blockNumber:i,blockTag:o,key:"avatar",name:c,universalResolverAddress:d,gatewayUrls:u,strict:l});if(!f)return null;try{return await(0,t.parseAvatarRecord)(s,{record:f,gatewayUrls:a})}catch{return null}}return B1}var D1={},VD;function t_e(){if(VD)return D1;VD=1,Object.defineProperty(D1,"__esModule",{value:!0}),D1.getEnsName=a;const t=sf(),e=Gu(),r=Be(),n=DN(),s=HC(),i=Vt(),o=Ec();async function a(c,{address:u,blockNumber:l,blockTag:d,gatewayUrls:f,strict:g,universalResolverAddress:h}){let p=h;if(!p){if(!c.chain)throw new Error("client chain not configured. universalResolverAddress is required.");p=(0,e.getChainContractAddress)({blockNumber:l,chain:c.chain,contract:"ensUniversalResolver"})}const y=`${u.toLowerCase().substring(2)}.addr.reverse`;try{const w={address:p,abi:t.universalResolverReverseAbi,functionName:"reverse",args:[(0,r.toHex)((0,s.packetToBytes)(y))],blockNumber:l,blockTag:d},I=(0,i.getAction)(c,o.readContract,"readContract"),[v,E]=f?await I({...w,args:[...w.args,f]}):await I(w);return u.toLowerCase()!==E.toLowerCase()?null:v}catch(w){if(g)throw w;if((0,n.isNullUniversalResolverError)(w,"reverse"))return null;throw w}}return D1}var U1={},GD;function r_e(){if(GD)return U1;GD=1,Object.defineProperty(U1,"__esModule",{value:!0}),U1.getEnsResolver=i;const t=Gu(),e=Be(),r=HC(),n=Vt(),s=Ec();async function i(o,{blockNumber:a,blockTag:c,name:u,universalResolverAddress:l}){let d=l;if(!d){if(!o.chain)throw new Error("client chain not configured. universalResolverAddress is required.");d=(0,t.getChainContractAddress)({blockNumber:a,chain:o.chain,contract:"ensUniversalResolver"})}const[f]=await(0,n.getAction)(o,s.readContract,"readContract")({address:d,abi:[{inputs:[{type:"bytes"}],name:"findResolver",outputs:[{type:"address"},{type:"bytes32"}],stateMutability:"view",type:"function"}],functionName:"findResolver",args:[(0,e.toHex)((0,r.packetToBytes)(u))],blockNumber:a,blockTag:c});return f}return U1}var M1={},KD;function Wz(){if(KD)return M1;KD=1,Object.defineProperty(M1,"__esModule",{value:!0}),M1.createAccessList=o;const t=pn(),e=Be(),r=SN(),n=Up(),s=gc(),i=mc();async function o(a,c){var _,O,C;const{account:u=a.account,blockNumber:l,blockTag:d="latest",blobs:f,data:g,gas:h,gasPrice:p,maxFeePerBlobGas:y,maxFeePerGas:w,maxPriorityFeePerGas:I,to:v,value:E,...b}=c,m=u?(0,t.parseAccount)(u):void 0;try{(0,i.assertRequest)(c);const T=(l?(0,e.numberToHex)(l):void 0)||d,N=(C=(O=(_=a.chain)==null?void 0:_.formatters)==null?void 0:O.transactionRequest)==null?void 0:C.format,B=(N||s.formatTransactionRequest)({...(0,n.extract)(b,{format:N}),from:m==null?void 0:m.address,blobs:f,data:g,gas:h,gasPrice:p,maxFeePerBlobGas:y,maxFeePerGas:w,maxPriorityFeePerGas:I,to:v,value:E}),A=await a.request({method:"eth_createAccessList",params:[B,T]});return{accessList:A.accessList,gasUsed:BigInt(A.gasUsed)}}catch(S){throw(0,r.getCallError)(S,{...c,account:m,chain:a.chain})}}return M1}var $1={},ZD;function n_e(){if(ZD)return $1;ZD=1,Object.defineProperty($1,"__esModule",{value:!0}),$1.createBlockFilter=e;const t=SC();async function e(r){const n=(0,t.createFilterRequestScope)(r,{method:"eth_newBlockFilter"}),s=await r.request({method:"eth_newBlockFilter"});return{id:s,request:n(s),type:"block"}}return $1}var L1={},YD;function Vz(){if(YD)return L1;YD=1,Object.defineProperty(L1,"__esModule",{value:!0}),L1.createEventFilter=n;const t=tf(),e=Be(),r=SC();async function n(s,{address:i,args:o,event:a,events:c,fromBlock:u,strict:l,toBlock:d}={}
311){const f=c??(a?[a]:void 0),g=(0,r.createFilterRequestScope)(s,{method:"eth_newFilter"});let h=[];f&&(h=[f.flatMap(w=>(0,t.encodeEventTopics)({abi:[w],eventName:w.name,args:o}))],a&&(h=h[0]));const p=await s.request({method:"eth_newFilter",params:[{address:i,fromBlock:typeof u=="bigint"?(0,e.numberToHex)(u):u,toBlock:typeof d=="bigint"?(0,e.numberToHex)(d):d,...h.length?{topics:h}:{}}]});return{abi:f,args:o,eventName:a?a.name:void 0,fromBlock:u,id:p,request:g(p),strict:!!l,toBlock:d,type:"event"}}return L1}var F1={},JD;function Gz(){if(JD)return F1;JD=1,Object.defineProperty(F1,"__esModule",{value:!0}),F1.createPendingTransactionFilter=e;const t=SC();async function e(r){const n=(0,t.createFilterRequestScope)(r,{method:"eth_newPendingTransactionFilter"}),s=await r.request({method:"eth_newPendingTransactionFilter"});return{id:s,request:n(s),type:"transaction"}}return F1}var H1={},QD;function s_e(){if(QD)return H1;QD=1,Object.defineProperty(H1,"__esModule",{value:!0}),H1.getBlobBaseFee=t;async function t(e){const r=await e.request({method:"eth_blobBaseFee"});return BigInt(r)}return H1}var q1={},XD;function i_e(){if(XD)return q1;XD=1,Object.defineProperty(q1,"__esModule",{value:!0}),q1.getBlockTransactionCount=r;const t=Lr(),e=Be();async function r(n,{blockHash:s,blockNumber:i,blockTag:o="latest"}={}){const a=i!==void 0?(0,e.numberToHex)(i):void 0;let c;return s?c=await n.request({method:"eth_getBlockTransactionCountByHash",params:[s]},{dedupe:!0}):c=await n.request({method:"eth_getBlockTransactionCountByNumber",params:[a||o]},{dedupe:!!a}),(0,t.hexToNumber)(c)}return q1}var z1={},e4;function o_e(){if(e4)return z1;e4=1,Object.defineProperty(z1,"__esModule",{value:!0}),z1.getCode=e;const t=Be();async function e(r,{address:n,blockNumber:s,blockTag:i="latest"}){const o=s!==void 0?(0,t.numberToHex)(s):void 0,a=await r.request({method:"eth_getCode",params:[n,o||i]},{dedupe:!!o});if(a!=="0x")return a}return z1}var W1={},tm={},t4;function a_e(){if(t4)return tm;t4=1,Object.defineProperty(tm,"__esModule",{value:!0}),tm.Eip712DomainNotFoundError=void 0;const t=ut();class e extends t.BaseError{constructor({address:n}){super(`No EIP-712 domain found on contract "${n}".`,{metaMessages:["Ensure that:",`- The contract is deployed at the address "${n}".`,"- `eip712Domain()` function exists on the contract.","- `eip712Domain()` function matches signature to ERC-5267 specification."],name:"Eip712DomainNotFoundError"})}}return tm.Eip712DomainNotFoundError=e,tm}var r4;function c_e(){if(r4)return W1;r4=1,Object.defineProperty(W1,"__esModule",{value:!0}),W1.getEip712Domain=n;const t=a_e(),e=Vt(),r=Ec();async function n(i,o){const{address:a,factory:c,factoryData:u}=o;try{const[l,d,f,g,h,p,y]=await(0,e.getAction)(i,r.readContract,"readContract")({abi:s,address:a,functionName:"eip712Domain",factory:c,factoryData:u});return{domain:{name:d,version:f,chainId:Number(g),verifyingContract:h,salt:p},extensions:y,fields:l}}catch(l){const d=l;throw d.name==="ContractFunctionExecutionError"&&d.cause.name==="ContractFunctionZeroDataError"?new t.Eip712DomainNotFoundError({address:a}):d}}const s=[{inputs:[],name:"eip712Domain",outputs:[{name:"fields",type:"bytes1"},{name:"name",type:"string"},{name:"version",type:"string"},{name:"chainId",type:"uint256"},{name:"verifyingContract",type:"address"},{name:"salt",type:"bytes32"},{name:"extensions",type:"uint256[]"}],stateMutability:"view",type:"function"}];return W1}var V1={},G1={},n4;function u_e(){if(n4)return G1;n4=1,Object.defineProperty(G1,"__esModule",{value:!0}),G1.formatFeeHistory=t;function t(e){var r;return{baseFeePerGas:e.baseFeePerGas.map(n=>BigInt(n)),gasUsedRatio:e.gasUsedRatio,oldestBlock:BigInt(e.oldestBlock),reward:(r=e.reward)==null?void 0:r.map(n=>n.map(s=>BigInt(s)))}}return G1}var s4;function l_e(){if(s4)return V1;s4=1,Object.defineProperty(V1,"__esModule",{value:!0}),V1.getFeeHistory=r;const t=Be(),e=u_e();async function r(n,{blockCount:s,blockNumber:i,blockTag:o="latest",rewardPercentiles:a}){const c=i?(0,t.numberToHex)(i):void 0,u=await n.request({method:"eth_feeHistory",params:[(0,t.numberToHex)(s),c||o,a]},{dedupe:!!c});return(0,e.formatFeeHistory)(u)}return V1}var K1={},i4;
311function d_e(){if(i4)return K1;i4=1,Object.defineProperty(K1,"__esModule",{value:!0}),K1.getFilterLogs=r;const t=H0(),e=bc();async function r(n,{filter:s}){const i=s.strict??!1,a=(await s.request({method:"eth_getFilterLogs",params:[s.id]})).map(c=>(0,e.formatLog)(c));return s.abi?(0,t.parseEventLogs)({abi:s.abi,logs:a,strict:i}):a}return K1}var Z1={},Y1={},PS={},J1={},o4;function Kz(){if(o4)return J1;o4=1,Object.defineProperty(J1,"__esModule",{value:!0}),J1.defineChain=t;function t(e){return{formatters:void 0,fees:void 0,serializers:void 0,...e}}return J1}var Q1={},a4;function Zz(){if(a4)return Q1;a4=1,Object.defineProperty(Q1,"__esModule",{value:!0}),Q1.extractChain=t;function t({chains:e,id:r}){return e.find(n=>n.id===r)}return Q1}var Rf={},X1={},OS={},c4;function Yz(){return c4||(c4=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.socketClientCache=void 0,t.getSocketRpcClient=i;const e=no(),r=TN(),n=kN(),s=Lz();t.socketClientCache=new Map;async function i(o){const{getSocket:a,keepAlive:c=!0,key:u="socket",reconnect:l=!0,url:d}=o,{interval:f=3e4}=typeof c=="object"?c:{},{attempts:g=5,delay:h=2e3}=typeof l=="object"?l:{};let p=t.socketClientCache.get(`${u}:${d}`);if(p)return p;let y=0;const{schedule:w}=(0,r.createBatchScheduler)({id:`${u}:${d}`,fn:async()=>{const E=new Map,b=new Map;let m,_,O;async function C(){const S=await a({onClose(){var T,N;for(const R of E.values())(T=R.onError)==null||T.call(R,new e.SocketClosedError({url:d}));for(const R of b.values())(N=R.onError)==null||N.call(R,new e.SocketClosedError({url:d}));E.clear(),b.clear(),l&&y<g&&setTimeout(async()=>{y++,await C().catch(console.error)},h)},onError(T){var N,R;m=T;for(const B of E.values())(N=B.onError)==null||N.call(B,m);for(const B of b.values())(R=B.onError)==null||R.call(B,m);E.clear(),b.clear(),p==null||p.close(),l&&y<g&&setTimeout(async()=>{y++,await C().catch(console.error)},h)},onOpen(){m=void 0,y=0},onResponse(T){const N=T.method==="eth_subscription",R=N?T.params.subscription:T.id,B=N?b:E,A=B.get(R);A&&A.onResponse(T),N||B.delete(R)}});return _=S,c&&(O&&clearInterval(O),O=setInterval(()=>{var T;return(T=_.ping)==null?void 0:T.call(_)},f)),S}return await C(),m=void 0,p={close(){O&&clearInterval(O),_.close(),t.socketClientCache.delete(`${u}:${d}`)},get socket(){return _},request({body:S,onError:T,onResponse:N}){m&&T&&T(m);const R=S.id??s.idCache.take(),B=A=>{var P;typeof A.id=="number"&&R!==A.id||(S.method==="eth_subscribe"&&typeof A.result=="string"&&b.set(A.result,{onResponse:B,onError:T}),S.method==="eth_unsubscribe"&&b.delete((P=S.params)==null?void 0:P[0]),N(A))};E.set(R,{onResponse:B,onError:T});try{_.request({body:{jsonrpc:"2.0",id:R,...S}})}catch(A){T==null||T(A)}},requestAsync({body:S,timeout:T=1e4}){return(0,n.withTimeout)(()=>new Promise((N,R)=>this.request({body:S,onError:R,onResponse:N})),{errorInstance:new e.TimeoutError({body:S,url:d}),timeout:T})},requests:E,subscriptions:b,url:d},t.socketClientCache.set(`${u}:${d}`,p),[p]}}),[I,[v]]=await w();return v}}(OS)),OS}function f_e(){if(typeof WebSocket<"u")return WebSocket;if(typeof We.WebSocket<"u")return We.WebSocket;if(typeof window.WebSocket<"u")return window.WebSocket;if(typeof self.WebSocket<"u")return self.WebSocket;throw new Error("`WebSocket` is not supported in this environment")}const h_e=f_e(),p_e=Object.freeze(Object.defineProperty({__proto__:null,WebSocket:h_e},Symbol.toStringTag,{value:"Module"})),g_e=V$(p_e);var u4;function MN(){if(u4)return X1;u4=1,Object.defineProperty(X1,"__esModule",{value:!0}),X1.getWebSocketRpcClient=r;const t=no(),e=Yz();async function r(n,s={}){const{keepAlive:i,reconnect:o}=s;return(0,e.getSocketRpcClient)({async getSocket({onClose:a,onError:c,onOpen:u,onResponse:l}){const d=await Promise.resolve().then(()=>g_e).then(y=>y.WebSocket),f=new d(n);function g(){f.removeEventListener("close",g),f.removeEventListener("message",h),f.removeEventListener("error",c),f.removeEventListener("open",u),a()}function h({data:y}){l(JSON.parse(y))}f.addEventListener("close",g),f.addEventListener("message",h),f.addEventListener("error",c),f.addEventListener("open",u),f.readyState===d.CONNECTING&&await new Promise((y,w)=>{f&&(f.onopen=y,f.onerror=w)});const{close:p}=f;return Object.assign(f,{close(){p.bind(f)(),g()},ping(){try{if(f.readyState===f.CLOSED||f.readyState===f.CLOSING)throw new t.WebSocketRequestError({url:f.url,cause:new t.SocketClosedError({url:f.url})});const y={jsonrpc:"2.0",method:"net_version",params:[]};f.send(JSON.stringify(y))}catch(y){c(y)}},request({body:y}
311){if(f.readyState===f.CLOSED||f.readyState===f.CLOSING)throw new t.WebSocketRequestError({body:y,url:f.url,cause:new t.SocketClosedError({url:f.url})});return f.send(JSON.stringify(y))}})},keepAlive:i,reconnect:o,url:n})}return X1}var l4;function Jz(){if(l4)return Rf;l4=1,Object.defineProperty(Rf,"__esModule",{value:!0}),Rf.rpc=void 0,Rf.getSocket=s;const t=jN(),e=MN();function r(i,{body:o,onError:a,onResponse:c}){return i.request({body:o,onError:a,onResponse:c}),i}async function n(i,{body:o,timeout:a=1e4}){return i.requestAsync({body:o,timeout:a})}async function s(i){const o=await(0,e.getWebSocketRpcClient)(i);return Object.assign(o.socket,{requests:o.requests,subscriptions:o.subscriptions})}return Rf.rpc={http(i,o){return(0,t.getHttpRpcClient)(i).request(o)},webSocket:r,webSocketAsync:n},Rf}var bl={},_a={},d4;function Qz(){if(d4)return _a;d4=1,Object.defineProperty(_a,"__esModule",{value:!0}),_a.InvalidStructTypeError=_a.InvalidPrimaryTypeError=_a.InvalidDomainError=void 0;const t=xn(),e=ut();class r extends e.BaseError{constructor({domain:o}){super(`Invalid domain "${(0,t.stringify)(o)}".`,{metaMessages:["Must be a valid EIP-712 domain."]})}}_a.InvalidDomainError=r;class n extends e.BaseError{constructor({primaryType:o,types:a}){super(`Invalid primary type \`${o}\` must be one of \`${JSON.stringify(Object.keys(a))}\`.`,{docsPath:"/api/glossary/Errors#typeddatainvalidprimarytypeerror",metaMessages:["Check that the primary type is a key in `types`."]})}}_a.InvalidPrimaryTypeError=n;class s extends e.BaseError{constructor({type:o}){super(`Struct type "${o}" is invalid.`,{metaMessages:["Struct type must not be a Solidity type."],name:"InvalidStructTypeError"})}}return _a.InvalidStructTypeError=s,_a}var wl={},f4;function Y0(){if(f4)return wl;f4=1,Object.defineProperty(wl,"__esModule",{value:!0}),wl.hashTypedData=i,wl.hashDomain=o,wl.hashStruct=a,wl.encodeType=l;const t=ro(),e=Xn(),r=Be(),n=Is(),s=qC();function i(g){const{domain:h={},message:p,primaryType:y}=g,w={EIP712Domain:(0,s.getTypesForEIP712Domain)({domain:h}),...g.types};(0,s.validateTypedData)({domain:h,message:p,primaryType:y,types:w});const I=["0x1901"];return h&&I.push(o({domain:h,types:w})),y!=="EIP712Domain"&&I.push(a({data:p,primaryType:y,types:w})),(0,n.keccak256)((0,e.concat)(I))}function o({domain:g,types:h}){return a({data:g,primaryType:"EIP712Domain",types:h})}function a({data:g,primaryType:h,types:p}){const y=c({data:g,primaryType:h,types:p});return(0,n.keccak256)(y)}function c({data:g,primaryType:h,types:p}){const y=[{type:"bytes32"}],w=[u({primaryType:h,types:p})];for(const I of p[h]){const[v,E]=f({types:p,name:I.name,type:I.type,value:g[I.name]});y.push(v),w.push(E)}return(0,t.encodeAbiParameters)(y,w)}function u({primaryType:g,types:h}){const p=(0,r.toHex)(l({primaryType:g,types:h}));return(0,n.keccak256)(p)}function l({primaryType:g,types:h}){let p="";const y=d({primaryType:g,types:h});y.delete(g);const w=[g,...Array.from(y).sort()];for(const I of w)p+=`${I}(${h[I].map(({name:v,type:E})=>`${E} ${v}`).join(",")})`;return p}function d({primaryType:g,types:h},p=new Set){const y=g.match(/^\w*/u),w=y==null?void 0:y[0];if(p.has(w)||h[w]===void 0)return p;p.add(w);for(const I of h[w])d({primaryType:I.type,types:h},p);return p}function f({types:g,name:h,type:p,value:y}){if(g[p]!==void 0)return[{type:"bytes32"},(0,n.keccak256)(c({data:y,primaryType:p,types:g}))];if(p==="bytes")return y=`0x${(y.length%2?"0":"")+y.slice(2)}`,[{type:"bytes32"},(0,n.keccak256)(y)];if(p==="string")return[{type:"bytes32"},(0,n.keccak256)((0,r.toHex)(y))];if(p.lastIndexOf("]")===p.length-1){const w=p.slice(0,p.lastIndexOf("[")),I=y.map(v=>f({name:h,type:w,types:g,value:v}));return[{type:"bytes32"},(0,n.keccak256)((0,t.encodeAbiParameters)(I.map(([v])=>v),I.map(([,v])=>v)))]}return[{type:p},y]}return wl}var h4;function qC(){if(h4)return bl;h4=1,Object.defineProperty(bl,"__esModule",{value:!0}),bl.serializeTypedData=u,bl.validateTypedData=l,bl.getTypesForEIP712Domain=d,bl.domainSeparator=f;const t=lr(),e=eo(),r=Qz(),n=Ks(),s=Gs(),i=Be(),o=IC(),a=Y0(),c=xn();function u(h){const{domain:p,message:y,primaryType:w,types:I}=h,v=(m,_)=>{const O={..._};for(const C of m){const{name:S,type:T}=C;T==="address"&&(O[S]=O[S].toLowerCase())}return O},E=I.EIP712Domain?p?v(I.EIP712Domain,p):{}:{},b=(()=>
311{if(w!=="EIP712Domain")return v(I[w],y)})();return(0,c.stringify)({domain:E,message:b,primaryType:w,types:I})}function l(h){const{domain:p,message:y,primaryType:w,types:I}=h,v=(E,b)=>{for(const m of E){const{name:_,type:O}=m,C=b[_],S=O.match(o.integerRegex);if(S&&(typeof C=="number"||typeof C=="bigint")){const[R,B,A]=S;(0,i.numberToHex)(C,{signed:B==="int",size:Number.parseInt(A)/8})}if(O==="address"&&typeof C=="string"&&!(0,n.isAddress)(C))throw new e.InvalidAddressError({address:C});const T=O.match(o.bytesRegex);if(T){const[R,B]=T;if(B&&(0,s.size)(C)!==Number.parseInt(B))throw new t.BytesSizeMismatchError({expectedSize:Number.parseInt(B),givenSize:(0,s.size)(C)})}const N=I[O];N&&(g(O),v(N,C))}};if(I.EIP712Domain&&p){if(typeof p!="object")throw new r.InvalidDomainError({domain:p});v(I.EIP712Domain,p)}if(w!=="EIP712Domain")if(I[w])v(I[w],y);else throw new r.InvalidPrimaryTypeError({primaryType:w,types:I})}function d({domain:h}){return[typeof(h==null?void 0:h.name)=="string"&&{name:"name",type:"string"},(h==null?void 0:h.version)&&{name:"version",type:"string"},(typeof(h==null?void 0:h.chainId)=="number"||typeof(h==null?void 0:h.chainId)=="bigint")&&{name:"chainId",type:"uint256"},(h==null?void 0:h.verifyingContract)&&{name:"verifyingContract",type:"address"},(h==null?void 0:h.salt)&&{name:"salt",type:"bytes32"}].filter(Boolean)}function f({domain:h}){return(0,a.hashDomain)({domain:h,types:{EIP712Domain:d({domain:h})}})}function g(h){if(h==="address"||h==="bool"||h==="string"||h.startsWith("bytes")||h.startsWith("uint")||h.startsWith("int"))throw new r.InvalidStructTypeError({type:h})}return bl}var eE={},p4;function Xz(){if(p4)return eE;p4=1,Object.defineProperty(eE,"__esModule",{value:!0}),eE.decodeFunctionData=i;const t=lr(),e=to(),r=ef(),n=qu(),s=fc();function i(o){const{abi:a,data:c}=o,u=(0,e.slice)(c,0,4),l=a.find(d=>d.type==="function"&&u===(0,r.toFunctionSelector)((0,s.formatAbiItem)(d)));if(!l)throw new t.AbiFunctionSignatureNotFoundError(u,{docsPath:"/docs/contract/decodeFunctionData"});return{functionName:l.name,args:"inputs"in l&&l.inputs&&l.inputs.length>0?(0,n.decodeAbiParameters)(l.inputs,(0,e.slice)(c,4)):void 0}}return eE}var tE={},g4;function eW(){if(g4)return tE;g4=1,Object.defineProperty(tE,"__esModule",{value:!0}),tE.encodeErrorResult=a;const t=lr(),e=Xn(),r=ef(),n=ro(),s=fc(),i=hc(),o="/docs/contract/encodeErrorResult";function a(c){const{abi:u,errorName:l,args:d}=c;let f=u[0];if(l){const y=(0,i.getAbiItem)({abi:u,args:d,name:l});if(!y)throw new t.AbiErrorNotFoundError(l,{docsPath:o});f=y}if(f.type!=="error")throw new t.AbiErrorNotFoundError(void 0,{docsPath:o});const g=(0,s.formatAbiItem)(f),h=(0,r.toFunctionSelector)(g);let p="0x";if(d&&d.length>0){if(!f.inputs)throw new t.AbiErrorInputsNotFoundError(f.name,{docsPath:o});p=(0,n.encodeAbiParameters)(f.inputs,d)}return(0,e.concatHex)([h,p])}return tE}var rE={},m4;function tW(){if(m4)return rE;m4=1,Object.defineProperty(rE,"__esModule",{value:!0}),rE.encodeFunctionResult=s;const t=lr(),e=ro(),r=hc(),n="/docs/contract/encodeFunctionResult";function s(i){const{abi:o,functionName:a,result:c}=i;let u=o[0];if(a){const d=(0,r.getAbiItem)({abi:o,name:a});if(!d)throw new t.AbiFunctionNotFoundError(a,{docsPath:n});u=d}if(u.type!=="function")throw new t.AbiFunctionNotFoundError(void 0,{docsPath:n});if(!u.outputs)throw new t.AbiFunctionOutputsNotFoundError(u.name,{docsPath:n});let l=Array.isArray(c)?c:[c];return u.outputs.length===0&&!l[0]&&(l=[]),(0,e.encodeAbiParameters)(u.outputs,l)}return rE}var nE={},y4;function rW(){if(y4)return nE;y4=1,Object.defineProperty(nE,"__esModule",{value:!0}),nE.encodePacked=a;const t=lr(),e=eo(),r=Ks(),n=Xn(),s=Fu(),i=Be(),o=IC();function a(u,l){if(u.length!==l.length)throw new t.AbiEncodingLengthMismatchError({expectedLength:u.length,givenLength:l.length});const d=[];for(let f=0;f<u.length;f++){const g=u[f],h=l[f];d.push(c(g,h))}return(0,n.concatHex)(d)}function c(u,l,d=!1){if(u==="address"){const p=l;if(!(0,r.isAddress)(p))throw new e.InvalidAddressError({address:p});return(0,s.pad)(p.toLowerCase(),{size:d?32:null})}if(u==="string")return(0,i.stringToHex)(l);if(u==="bytes")return l;if(u==="bool")return(0,s.pad)((0,i.boolToHex)(l),{size:d?32:1});const f=u.match(o.integerRegex);if(f){const[p,y,w="256"]=f,I=Number.parseInt(w)/8;return(0,i.numberToHex)(l,{size:d?32:I,signed:y==="int"})}const g=u.match(o.bytesRegex);if(g){const[p,y]=g;if(Number.parseInt(y)!==(l.length-2)/2)throw new t.BytesSizeMismatchError({expectedSize:Number.parseInt(y),givenSize:(l.length-2)/2});return(0,s.pad)(l,{dir:"right",size:d?32:null})}const h=u.match(o.arrayRegex);if(h&&Array.isArray(l)){const[p,y]=h,w=[];for(let I=0;I<l.length;I++)w.push(c(y,l[I],!0));return w.length===0?"0x":(0,n.concatHex)(w)}throw new t.UnsupportedPackedAbiType(u)}return nE}var Bf={},sE={},b4;function $N(){if(b4)return sE;b4=1,Object.defineProperty(sE,"__esModule",{value:!0}),sE.isBytes=t;function t(e){return!e||typeof e!="object"||!("BYTES_PER_ELEMENT"in e)?!1:e.BYTES_PER_ELEMENT===1&&e.constructor.name==="Uint8Array"}return sE}var w4;function nW(){if(w4)return Bf;
311w4=1,Object.defineProperty(Bf,"__esModule",{value:!0}),Bf.getContractAddress=c,Bf.getCreateAddress=u,Bf.getCreate2Address=l;const t=Xn(),e=$N(),r=Fu(),n=to(),s=Yt(),i=D0(),o=Is(),a=mi();function c(d){return d.opcode==="CREATE2"?l(d):u(d)}function u(d){const f=(0,s.toBytes)((0,a.getAddress)(d.from));let g=(0,s.toBytes)(d.nonce);return g[0]===0&&(g=new Uint8Array([])),(0,a.getAddress)(`0x${(0,o.keccak256)((0,i.toRlp)([f,g],"bytes")).slice(26)}`)}function l(d){const f=(0,s.toBytes)((0,a.getAddress)(d.from)),g=(0,r.pad)((0,e.isBytes)(d.salt)?d.salt:(0,s.toBytes)(d.salt),{size:32}),h="bytecodeHash"in d?(0,e.isBytes)(d.bytecodeHash)?d.bytecodeHash:(0,s.toBytes)(d.bytecodeHash):(0,o.keccak256)(d.bytecode,"bytes");return(0,a.getAddress)((0,n.slice)((0,o.keccak256)((0,t.concat)([(0,s.toBytes)("0xff"),f,g,h])),12))}return Bf}var NS={},E4;function LN(){return E4||(E4=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.defineTransactionReceipt=t.receiptStatuses=void 0,t.formatTransactionReceipt=i;const e=Lr(),r=M0(),n=bc(),s=$0();t.receiptStatuses={"0x0":"reverted","0x1":"success"};function i(o){const a={...o,blockNumber:o.blockNumber?BigInt(o.blockNumber):null,contractAddress:o.contractAddress?o.contractAddress:null,cumulativeGasUsed:o.cumulativeGasUsed?BigInt(o.cumulativeGasUsed):null,effectiveGasPrice:o.effectiveGasPrice?BigInt(o.effectiveGasPrice):null,gasUsed:o.gasUsed?BigInt(o.gasUsed):null,logs:o.logs?o.logs.map(c=>(0,n.formatLog)(c)):null,to:o.to?o.to:null,transactionIndex:o.transactionIndex?(0,e.hexToNumber)(o.transactionIndex):null,status:o.status?t.receiptStatuses[o.status]:null,type:o.type?s.transactionType[o.type]||o.type:null};return o.blobGasPrice&&(a.blobGasPrice=BigInt(o.blobGasPrice)),o.blobGasUsed&&(a.blobGasUsed=BigInt(o.blobGasUsed)),a}t.defineTransactionReceipt=(0,r.defineFormatter)("transactionReceipt",i)}(NS)),NS}var iE={},v4;function FN(){if(v4)return iE;v4=1,Object.defineProperty(iE,"__esModule",{value:!0}),iE.fromRlp=i;const t=ut(),e=jp(),r=R0(),n=Yt(),s=Be();function i(u,l="hex"){const d=(()=>{if(typeof u=="string"){if(u.length>3&&u.length%2!==0)throw new e.InvalidHexValueError(u);return(0,n.hexToBytes)(u)}return u})(),f=(0,r.createCursor)(d,{recursiveReadLimit:Number.POSITIVE_INFINITY});return o(f,l)}function o(u,l="hex"){if(u.bytes.length===0)return l==="hex"?(0,s.bytesToHex)(u.bytes):u.bytes;const d=u.readByte();if(d<128&&u.decrementPosition(1),d<192){const g=a(u,d,128),h=u.readBytes(g);return l==="hex"?(0,s.bytesToHex)(h):h}const f=a(u,d,192);return c(u,f,l)}function a(u,l,d){if(d===128&&l<128)return 1;if(l<=d+55)return l-d;if(l===d+55+1)return u.readUint8();if(l===d+55+2)return u.readUint16();if(l===d+55+3)return u.readUint24();if(l===d+55+4)return u.readUint32();throw new t.BaseError("Invalid RLP prefix")}function c(u,l,d){const f=u.position,g=[];for(;u.position-f<l;)g.push(o(u,d));return g}return iE}var xS={},_4;function sW(){return _4||(_4=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.toEventSignature=void 0;var e=cN();Object.defineProperty(t,"toEventSignature",{enumerable:!0,get:function(){return e.toSignature}})}(xS)),xS}var RS={},A4;function iW(){return A4||(A4=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.toFunctionSignature=void 0;var e=cN();Object.defineProperty(t,"toFunctionSignature",{enumerable:!0,get:function(){return e.toSignature}})}(RS)),RS}var BS={},C4;function oW(){return C4||(C4=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.toEventHash=void 0;var e=CC();Object.defineProperty(t,"toEventHash",{enumerable:!0,get:function(){return e.toSignatureHash}})}(BS)),BS}var kS={},I4;function aW(){return I4||(I4=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.toFunctionHash=void 0;var e=CC();Object.defineProperty(t,"toFunctionHash",{enumerable:!0,get:function(){return e.toSignatureHash}})}(kS)),kS}var oE={},S4;function HN(){if(S4)return oE;S4=1,Object.defineProperty(oE,"__esModule",{value:!0}),oE.isHash=r;const t=Qn(),e=Gs();function r(n){return(0,t.isHex)(n)&&(0,e.size)(n)===32}return oE}var aE={},El={},T4;function m_e(){if(T4)return El;
311T4=1,Object.defineProperty(El,"__esModule",{value:!0}),El.ripemd160=El.RIPEMD160=void 0;const t=Ez(),e=Xd(),r=new Uint8Array([7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8]),n=new Uint8Array(new Array(16).fill(0).map((p,y)=>y)),s=n.map(p=>(9*p+5)%16);let i=[n],o=[s];for(let p=0;p<4;p++)for(let y of[i,o])y.push(y[p].map(w=>r[w]));const a=[[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8],[12,13,11,15,6,9,9,7,12,15,11,13,7,8,7,7],[13,15,14,11,7,7,6,8,13,14,13,12,5,5,6,9],[14,11,12,14,8,6,5,5,15,12,15,14,9,9,8,6],[15,12,13,13,9,5,8,6,14,11,12,11,8,6,5,5]].map(p=>new Uint8Array(p)),c=i.map((p,y)=>p.map(w=>a[y][w])),u=o.map((p,y)=>p.map(w=>a[y][w])),l=new Uint32Array([0,1518500249,1859775393,2400959708,2840853838]),d=new Uint32Array([1352829926,1548603684,1836072691,2053994217,0]);function f(p,y,w,I){return p===0?y^w^I:p===1?y&w|~y&I:p===2?(y|~w)^I:p===3?y&I|w&~I:y^(w|~I)}const g=new Uint32Array(16);class h extends t.HashMD{constructor(){super(64,20,8,!0),this.h0=1732584193,this.h1=-271733879,this.h2=-1732584194,this.h3=271733878,this.h4=-1009589776}get(){const{h0:y,h1:w,h2:I,h3:v,h4:E}=this;return[y,w,I,v,E]}set(y,w,I,v,E){this.h0=y|0,this.h1=w|0,this.h2=I|0,this.h3=v|0,this.h4=E|0}process(y,w){for(let N=0;N<16;N++,w+=4)g[N]=y.getUint32(w,!0);let I=this.h0|0,v=I,E=this.h1|0,b=E,m=this.h2|0,_=m,O=this.h3|0,C=O,S=this.h4|0,T=S;for(let N=0;N<5;N++){const R=4-N,B=l[N],A=d[N],P=i[N],k=o[N],U=c[N],x=u[N];for(let j=0;j<16;j++){const D=(0,e.rotl)(I+f(N,E,m,O)+g[P[j]]+B,U[j])+S|0;I=S,S=O,O=(0,e.rotl)(m,10)|0,m=E,E=D}for(let j=0;j<16;j++){const D=(0,e.rotl)(v+f(R,b,_,C)+g[k[j]]+A,x[j])+T|0;v=T,T=C,C=(0,e.rotl)(_,10)|0,_=b,b=D}}this.set(this.h1+m+C|0,this.h2+O+T|0,this.h3+S+v|0,this.h4+I+b|0,this.h0+E+_|0)}roundClean(){g.fill(0)}destroy(){this.destroyed=!0,this.buffer.fill(0),this.set(0,0,0,0,0)}}return El.RIPEMD160=h,El.ripemd160=(0,e.wrapConstructor)(()=>new h),El}var P4;function cW(){if(P4)return aE;P4=1,Object.defineProperty(aE,"__esModule",{value:!0}),aE.ripemd160=s;const t=m_e(),e=Qn(),r=Yt(),n=Be();function s(i,o){const a=o||"hex",c=(0,t.ripemd160)((0,e.isHex)(i,{strict:!1})?(0,r.toBytes)(i):i);return a==="bytes"?c:(0,n.toHex)(c)}return aE}var cE={},uE={},lE={},rm={},O4;function uW(){return O4||(O4=1,Object.defineProperty(rm,"__esModule",{value:!0}),rm.presignMessagePrefix=void 0,rm.presignMessagePrefix=`�Ethereum Signed Message:
312`),rm}var N4;function lW(){if(N4)return lE;N4=1,Object.defineProperty(lE,"__esModule",{value:!0}),lE.toPrefixedMessage=s;const t=uW(),e=Xn(),r=Gs(),n=Be();function s(i){const o=typeof i=="string"?(0,n.stringToHex)(i):typeof i.raw=="string"?i.raw:(0,n.bytesToHex)(i.raw),a=(0,n.stringToHex)(`${t.presignMessagePrefix}${(0,r.size)(o)}`);return(0,e.concat)([a,o])}return lE}var x4;function J0(){if(x4)return uE;x4=1,Object.defineProperty(uE,"__esModule",{value:!0}),uE.hashMessage=r;const t=Is(),e=lW();function r(n,s){return(0,t.keccak256)((0,e.toPrefixedMessage)(n),s)}return uE}var R4;function qN(){if(R4)return cE;R4=1,Object.defineProperty(cE,"__esModule",{value:!0}),cE.recoverMessageAddress=r;const t=J0(),e=Vu();async function r({message:n,signature:s}){return(0,e.recoverAddress)({hash:(0,t.hashMessage)(n),signature:s})}return cE}var dE={},B4;function zN(){if(B4)return dE;B4=1,Object.defineProperty(dE,"__esModule",{value:!0}),dE.recoverTypedDataAddress=r;const t=Y0(),e=Vu();async function r(n){const{domain:s,message:i,primaryType:o,signature:a,types:c}=n;return(0,e.recoverAddress)({hash:(0,t.hashTypedData)({domain:s,message:i,primaryType:o,types:c}),signature:a})}return dE}var fE={},k4;function dW(){if(k4)return fE;k4=1,Object.defineProperty(fE,"__esModule",{value:!0}),fE.verifyHash=n;const t=mi(),e=yc(),r=Vu();async function n({address:s,hash:i,signature:o}){return(0,e.isAddressEqual)((0,t.getAddress)(s),await(0,r.recoverAddress)({hash:i,signature:o}))}return fE}var hE={},j4;function fW(){if(j4)return hE;j4=1,Object.defineProperty(hE,"__esModule",{value:!0}),hE.verifyMessage=n;const t=mi(),e=yc(),r=qN();async function n({address:s,message:i,signature:o}){return(0,e.isAddressEqual)((0,t.getAddress)(s),await(0,r.recoverMessageAddress)({message:i,signature:o}))}return hE}var pE={},D4;function hW(){if(D4)return pE;D4=1,Object.defineProperty(pE,"__esModule",{value:!0}),pE.verifyTypedData=n;const t=mi(),e=yc(),r=zN();async function n(s){const{address:i,domain:o,message:a,primaryType:c,signature:u,types:l}=s;return(0,e.isAddressEqual)((0,t.getAddress)(i),await(0,r.recoverTypedDataAddress)({domain:o,message:a,primaryType:c,signature:u,types:l}))}return pE}var gE={},mE={},vl={},U4;
312function WN(){return U4||(U4=1,Object.defineProperty(vl,"__esModule",{value:!0}),vl.zeroHash=vl.erc6492MagicBytes=void 0,vl.erc6492MagicBytes="0x6492649264926492649264926492649264926492649264926492649264926492",vl.zeroHash="0x0000000000000000000000000000000000000000000000000000000000000000"),vl}var M4;function zC(){if(M4)return mE;M4=1,Object.defineProperty(mE,"__esModule",{value:!0}),mE.isErc6492Signature=r;const t=WN(),e=to();function r(n){return(0,e.sliceHex)(n,-32)===t.erc6492MagicBytes}return mE}var $4;function pW(){if($4)return gE;$4=1,Object.defineProperty(gE,"__esModule",{value:!0}),gE.parseErc6492Signature=r;const t=qu(),e=zC();function r(n){if(!(0,e.isErc6492Signature)(n))return{signature:n};const[s,i,o]=(0,t.decodeAbiParameters)([{type:"address"},{type:"bytes"},{type:"bytes"}],n);return{address:s,data:i,signature:o}}return gE}var yE={},L4;function VN(){if(L4)return yE;L4=1,Object.defineProperty(yE,"__esModule",{value:!0}),yE.serializeErc6492Signature=s;const t=WN(),e=ro(),r=Xn(),n=Yt();function s(i){const{address:o,data:a,signature:c,to:u="hex"}=i,l=(0,r.concatHex)([(0,e.encodeAbiParameters)([{type:"address"},{type:"bytes"},{type:"bytes"}],[o,a,c]),t.erc6492MagicBytes]);return u==="hex"?l:(0,n.hexToBytes)(l)}return yE}var bE={},F4;function GN(){if(F4)return bE;F4=1,Object.defineProperty(bE,"__esModule",{value:!0}),bE.getSerializedTransactionType=n;const t=Zs(),e=to(),r=Lr();function n(s){const i=(0,e.sliceHex)(s,0,1);if(i==="0x04")return"eip7702";if(i==="0x03")return"eip4844";if(i==="0x02")return"eip1559";if(i==="0x01")return"eip2930";if(i!=="0x"&&(0,r.hexToNumber)(i)>=192)return"legacy";throw new t.InvalidSerializedTransactionTypeError({serializedType:i})}return bE}var Hc={},H4;function WC(){if(H4)return Hc;H4=1,Object.defineProperty(Hc,"__esModule",{value:!0}),Hc.assertTransactionEIP7702=d,Hc.assertTransactionEIP4844=f,Hc.assertTransactionEIP1559=g,Hc.assertTransactionEIP2930=h,Hc.assertTransactionLegacy=p;const t=Pz(),e=mN(),r=eo(),n=ut(),s=Oz(),i=q0(),o=pc(),a=Ks(),c=Gs(),u=to(),l=Lr();function d(y){const{authorizationList:w}=y;if(w)for(const I of w){const{contractAddress:v,chainId:E}=I;if(!(0,a.isAddress)(v))throw new r.InvalidAddressError({address:v});if(E<0)throw new i.InvalidChainIdError({chainId:E})}g(y)}function f(y){const{blobVersionedHashes:w}=y;if(w){if(w.length===0)throw new s.EmptyBlobError;for(const I of w){const v=(0,c.size)(I),E=(0,l.hexToNumber)((0,u.slice)(I,0,1));if(v!==32)throw new s.InvalidVersionedHashSizeError({hash:I,size:v});if(E!==t.versionedHashVersionKzg)throw new s.InvalidVersionedHashVersionError({hash:I,version:E})}}g(y)}function g(y){const{chainId:w,maxPriorityFeePerGas:I,maxFeePerGas:v,to:E}=y;if(w<=0)throw new i.InvalidChainIdError({chainId:w});if(E&&!(0,a.isAddress)(E))throw new r.InvalidAddressError({address:E});if(v&&v>e.maxUint256)throw new o.FeeCapTooHighError({maxFeePerGas:v});if(I&&v&&I>v)throw new o.TipAboveFeeCapError({maxFeePerGas:v,maxPriorityFeePerGas:I})}function h(y){const{chainId:w,maxPriorityFeePerGas:I,gasPrice:v,maxFeePerGas:E,to:b}=y;if(w<=0)throw new i.InvalidChainIdError({chainId:w});if(b&&!(0,a.isAddress)(b))throw new r.InvalidAddressError({address:b});if(I||E)throw new n.BaseError("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid EIP-2930 Transaction attribute.");if(v&&v>e.maxUint256)throw new o.FeeCapTooHighError({maxFeePerGas:v})}function p(y){const{chainId:w,maxPriorityFeePerGas:I,gasPrice:v,maxFeePerGas:E,to:b}=y;if(b&&!(0,a.isAddress)(b))throw new r.InvalidAddressError({address:b});if(typeof w<"u"&&w<=0)throw new i.InvalidChainIdError({chainId:w});if(I||E)throw new n.BaseError("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid Legacy Transaction attribute.");if(v&&v>e.maxUint256)throw new o.FeeCapTooHighError({maxFeePerGas:v})}return Hc}var kf={},q4;function KN(){if(q4)return kf;q4=1,Object.defineProperty(kf,"__esModule",{value:!0}),kf.parseTransaction=f,kf.toTransactionArray=I,kf.parseAccessList=v;const t=eo(),e=Zs(),r=Ks(),n=kC(),s=Qn(),i=Fu(),o=Hu(),a=Lr(),c=FN(),u=HN(),l=WC(),d=GN();function f(m){const _=(0,d.getSerializedTransactionType)(m);return _==="eip1559"?p(m):_==="eip2930"?y(m):_==="eip4844"?h(m):_==="eip7702"?g(m):w(m)}function g(m){const _=I(m),[O,C,S,T,N,R,B,A,P,k,U,x,j]=_;if(_.length!==10&&_.length!==13)throw new e.InvalidSerializedTransactionError({attributes:{chainId:O,nonce:C,maxPriorityFeePerGas:S,maxFeePerGas:T,gas:N,to:R,value:B,data:A,accessList:P,authorizationList:k,..._.length>9?{v:U,r:x,s:j}:{}},serializedTransaction:m,type:"eip7702"});const D={chainId:(0,a.hexToNumber)(O),type:"eip7702"};return(0,s.isHex)(R)&&R!=="0x"&&(D.to=R),(0,s.isHex)(N)&&N!=="0x"&&(D.gas=(0,a.hexToBigInt)(N)),(0,s.isHex)(A)&&A!=="0x"&&(D.data=A),(0,s.isHex)(C)&&C!=="0x"&&(D.nonce=(0,a.hexToNumber)(C)),(0,s.isHex)(B)&&B!=="0x"&&(D.value=(0,a.hexToBigInt)(B)),(0,s.isHex)(T)&&T!=="0x"&&(D.maxFeePerGas=(0,a.hexToBigInt)(T)),(0,s.isHex)(S)&&S!=="0x"&&(D.maxPriorityFeePerGas=(0,a.hexToBigInt)(S)),P.length!==0&&P!=="0x"&&(D.accessList=v(P)),k.length!==0&&k!=="0x"&&(D.authorizationList=E(k)),(0,l.assertTransactionEIP7702)(D),{..._.length===13?b(_):void 0,...D}}function h(m){const _=I(m),O=_.length===4,C=O?_[0]:_,S=O?_.slice(1):[],[T,N,R,B,A,P,k,U,x,j,D,M,L,H]=C,[z,V,G]=S;
312if(!(C.length===11||C.length===14))throw new e.InvalidSerializedTransactionError({attributes:{chainId:T,nonce:N,maxPriorityFeePerGas:R,maxFeePerGas:B,gas:A,to:P,value:k,data:U,accessList:x,...C.length>9?{v:M,r:L,s:H}:{}},serializedTransaction:m,type:"eip4844"});const ee={blobVersionedHashes:D,chainId:(0,a.hexToNumber)(T),type:"eip4844"};return(0,s.isHex)(P)&&P!=="0x"&&(ee.to=P),(0,s.isHex)(A)&&A!=="0x"&&(ee.gas=(0,a.hexToBigInt)(A)),(0,s.isHex)(U)&&U!=="0x"&&(ee.data=U),(0,s.isHex)(N)&&N!=="0x"&&(ee.nonce=(0,a.hexToNumber)(N)),(0,s.isHex)(k)&&k!=="0x"&&(ee.value=(0,a.hexToBigInt)(k)),(0,s.isHex)(j)&&j!=="0x"&&(ee.maxFeePerBlobGas=(0,a.hexToBigInt)(j)),(0,s.isHex)(B)&&B!=="0x"&&(ee.maxFeePerGas=(0,a.hexToBigInt)(B)),(0,s.isHex)(R)&&R!=="0x"&&(ee.maxPriorityFeePerGas=(0,a.hexToBigInt)(R)),x.length!==0&&x!=="0x"&&(ee.accessList=v(x)),z&&V&&G&&(ee.sidecars=(0,n.toBlobSidecars)({blobs:z,commitments:V,proofs:G})),(0,l.assertTransactionEIP4844)(ee),{...C.length===14?b(C):void 0,...ee}}function p(m){const _=I(m),[O,C,S,T,N,R,B,A,P,k,U,x]=_;if(!(_.length===9||_.length===12))throw new e.InvalidSerializedTransactionError({attributes:{chainId:O,nonce:C,maxPriorityFeePerGas:S,maxFeePerGas:T,gas:N,to:R,value:B,data:A,accessList:P,..._.length>9?{v:k,r:U,s:x}:{}},serializedTransaction:m,type:"eip1559"});const j={chainId:(0,a.hexToNumber)(O),type:"eip1559"};return(0,s.isHex)(R)&&R!=="0x"&&(j.to=R),(0,s.isHex)(N)&&N!=="0x"&&(j.gas=(0,a.hexToBigInt)(N)),(0,s.isHex)(A)&&A!=="0x"&&(j.data=A),(0,s.isHex)(C)&&C!=="0x"&&(j.nonce=(0,a.hexToNumber)(C)),(0,s.isHex)(B)&&B!=="0x"&&(j.value=(0,a.hexToBigInt)(B)),(0,s.isHex)(T)&&T!=="0x"&&(j.maxFeePerGas=(0,a.hexToBigInt)(T)),(0,s.isHex)(S)&&S!=="0x"&&(j.maxPriorityFeePerGas=(0,a.hexToBigInt)(S)),P.length!==0&&P!=="0x"&&(j.accessList=v(P)),(0,l.assertTransactionEIP1559)(j),{..._.length===12?b(_):void 0,...j}}function y(m){const _=I(m),[O,C,S,T,N,R,B,A,P,k,U]=_;if(!(_.length===8||_.length===11))throw new e.InvalidSerializedTransactionError({attributes:{chainId:O,nonce:C,gasPrice:S,gas:T,to:N,value:R,data:B,accessList:A,..._.length>8?{v:P,r:k,s:U}:{}},serializedTransaction:m,type:"eip2930"});const x={chainId:(0,a.hexToNumber)(O),type:"eip2930"};return(0,s.isHex)(N)&&N!=="0x"&&(x.to=N),(0,s.isHex)(T)&&T!=="0x"&&(x.gas=(0,a.hexToBigInt)(T)),(0,s.isHex)(B)&&B!=="0x"&&(x.data=B),(0,s.isHex)(C)&&C!=="0x"&&(x.nonce=(0,a.hexToNumber)(C)),(0,s.isHex)(R)&&R!=="0x"&&(x.value=(0,a.hexToBigInt)(R)),(0,s.isHex)(S)&&S!=="0x"&&(x.gasPrice=(0,a.hexToBigInt)(S)),A.length!==0&&A!=="0x"&&(x.accessList=v(A)),(0,l.assertTransactionEIP2930)(x),{..._.length===11?b(_):void 0,...x}}function w(m){const _=(0,c.fromRlp)(m,"hex"),[O,C,S,T,N,R,B,A,P]=_;if(!(_.length===6||_.length===9))throw new e.InvalidSerializedTransactionError({attributes:{nonce:O,gasPrice:C,gas:S,to:T,value:N,data:R,..._.length>6?{v:B,r:A,s:P}:{}},serializedTransaction:m,type:"legacy"});const k={type:"legacy"};
312if((0,s.isHex)(T)&&T!=="0x"&&(k.to=T),(0,s.isHex)(S)&&S!=="0x"&&(k.gas=(0,a.hexToBigInt)(S)),(0,s.isHex)(R)&&R!=="0x"&&(k.data=R),(0,s.isHex)(O)&&O!=="0x"&&(k.nonce=(0,a.hexToNumber)(O)),(0,s.isHex)(N)&&N!=="0x"&&(k.value=(0,a.hexToBigInt)(N)),(0,s.isHex)(C)&&C!=="0x"&&(k.gasPrice=(0,a.hexToBigInt)(C)),(0,l.assertTransactionLegacy)(k),_.length===6)return k;const U=(0,s.isHex)(B)&&B!=="0x"?(0,a.hexToBigInt)(B):0n;if(P==="0x"&&A==="0x")return U>0&&(k.chainId=Number(U)),k;const x=U,j=Number((x-35n)/2n);if(j>0)k.chainId=j;else if(x!==27n&&x!==28n)throw new e.InvalidLegacyVError({v:x});return k.v=x,k.s=P,k.r=A,k.yParity=x%2n===0n?1:0,k}function I(m){return(0,c.fromRlp)(`0x${m.slice(4)}`,"hex")}function v(m){const _=[];for(let O=0;O<m.length;O++){const[C,S]=m[O];if(!(0,r.isAddress)(C,{strict:!1}))throw new t.InvalidAddressError({address:C});_.push({address:C,storageKeys:S.map(T=>(0,u.isHash)(T)?T:(0,o.trim)(T))})}return _}function E(m){const _=[];for(let O=0;O<m.length;O++){const[C,S,T,N,R,B]=m[O];_.push({chainId:(0,a.hexToNumber)(C),contractAddress:S,nonce:(0,a.hexToNumber)(T),...b([N,R,B])})}return _}function b(m){const _=m.slice(-3),O=_[0]==="0x"||(0,a.hexToBigInt)(_[0])===0n?27n:28n;return{r:(0,i.padHex)(_[1],{size:32}),s:(0,i.padHex)(_[2],{size:32}),v:O,yParity:O===27n?0:1}}return kf}var nm={},wE={},z4;function y_e(){if(z4)return wE;z4=1,Object.defineProperty(wE,"__esModule",{value:!0}),wE.serializeAuthorizationList=r;const t=Be(),e=VC();function r(n){if(!n||n.length===0)return[];const s=[];for(const i of n){const{contractAddress:o,chainId:a,nonce:c,...u}=i;s.push([a?(0,t.toHex)(a):"0x",o,c?(0,t.toHex)(c):"0x",...(0,e.toYParitySignatureArray)({},u)])}return s}return wE}var EE={},W4;function ZN(){if(W4)return EE;W4=1,Object.defineProperty(EE,"__esModule",{value:!0}),EE.serializeAccessList=n;const t=eo(),e=Zs(),r=Ks();function n(s){if(!s||s.length===0)return[];const i=[];for(let o=0;o<s.length;o++){const{address:a,storageKeys:c}=s[o];for(let u=0;u<c.length;u++)if(c[u].length-2!==64)throw new e.InvalidStorageKeySizeError({storageKey:c[u]});if(!(0,r.isAddress)(a,{strict:!1}))throw new t.InvalidAddressError({address:a});i.push([a,c])}return i}return EE}var V4;function VC(){if(V4)return nm;V4=1,Object.defineProperty(nm,"__esModule",{value:!0}),nm.serializeTransaction=g,nm.toYParitySignatureArray=v;const t=Zs(),e=RC(),r=BC(),n=_N(),s=kC(),i=Xn(),o=Hu(),a=Be(),c=D0(),u=y_e(),l=WC(),d=jC(),f=ZN();function g(E,b){const m=(0,d.getTransactionType)(E);return m==="eip1559"?y(E,b):m==="eip2930"?w(E,b):m==="eip4844"?p(E,b):m==="eip7702"?h(E,b):I(E,b)}function h(E,b){const{authorizationList:m,chainId:_,gas:O,nonce:C,to:S,value:T,maxFeePerGas:N,maxPriorityFeePerGas:R,accessList:B,data:A}=E;(0,l.assertTransactionEIP7702)(E);const P=(0,f.serializeAccessList)(B),k=(0,u.serializeAuthorizationList)(m);return(0,i.concatHex)(["0x04",(0,c.toRlp)([(0,a.toHex)(_),C?(0,a.toHex)(C):"0x",R?(0,a.toHex)(R):"0x",N?(0,a.toHex)(N):"0x",O?(0,a.toHex)(O):"0x",S??"0x",T?(0,a.toHex)(T):"0x",A??"0x",P,k,...v(E,b)])])}function p(E,b){const{chainId:m,gas:_,nonce:O,to:C,value:S,maxFeePerBlobGas:T,maxFeePerGas:N,maxPriorityFeePerGas:R,accessList:B,data:A}=E;(0,l.assertTransactionEIP4844)(E);let P=E.blobVersionedHashes,k=E.sidecars;if(E.blobs&&(typeof P>"u"||typeof k>"u")){const L=typeof E.blobs[0]=="string"?E.blobs:E.blobs.map(V=>(0,a.bytesToHex)(V)),H=E.kzg,z=(0,e.blobsToCommitments)({blobs:L,kzg:H});if(typeof P>"u"&&(P=(0,n.commitmentsToVersionedHashes)({commitments:z})),typeof k>"u"){const V=(0,r.blobsToProofs)({blobs:L,commitments:z,kzg:H});k=(0,s.toBlobSidecars)({blobs:L,commitments:z,proofs:V})}}const U=(0,f.serializeAccessList)(B),x=[(0,a.toHex)(m),O?(0,a.toHex)(O):"0x",R?(0,a.toHex)(R):"0x",N?(0,a.toHex)(N):"0x",_?(0,a.toHex)(_):"0x",C??"0x",S?(0,a.toHex)(S):"0x",A??"0x",U,T?(0,a.toHex)(T):"0x",P??[],...v(E,b)],j=[],D=[],M=[];if(k)for(let L=0;L<k.length;L++){const{blob:H,commitment:z,proof:V}=k[L];j.push(H),D.push(z),M.push(V)}return(0,i.concatHex)(["0x03",k?(0,c.toRlp)([x,j,D,M]):(0,c.toRlp)(x)])}function y(E,b){const{chainId:m,gas:_,nonce:O,to:C,value:S,maxFeePerGas:T,maxPriorityFeePerGas:N,accessList:R,data:B}=E;(0,l.assertTransactionEIP1559)(E);const A=(0,f.serializeAccessList)(R),P=[(0,a.toHex)(m),O?(0,a.toHex)(O):"0x",N?(0,a.toHex)(N):"0x",T?(0,a.toHex)(T):"0x",_?(0,a.toHex)(_):"0x",C??"0x",S?(0,a.toHex)(S):"0x",B??"0x",A,...v(E,b)];return(0,i.concatHex)(["0x02",(0,c.toRlp)(P)])}function w(E,b){const{chainId:m,gas:_,data:O,nonce:C,to:S,value:T,accessList:N,gasPrice:R}=E;(0,l.assertTransactionEIP2930)(E);const B=(0,f.serializeAccessList)(N),A=[(0,a.toHex)(m),C?(0,a.toHex)(C):"0x",R?(0,a.toHex)(R):"0x",_?(0,a.toHex)(_):"0x",S??"0x",T?(0,a.toHex)(T):"0x",O??"0x",B,...v(E,b)];return(0,i.concatHex)(["0x01",(0,c.toRlp)(A)])}function I(E,b){const{chainId:m=0,gas:_,data:O,nonce:C,to:S,value:T,gasPrice:N}=E;(0,l.assertTransactionLegacy)(E);let R=[C?(0,a.toHex)(C):"0x",N?(0,a.toHex)(N):"0x",_?(0,a.toHex)(_):"0x",S??"0x",T?(0,a.toHex)(T):"0x",O??"0x"];if(b){const B=(()=>
312{if(b.v>=35n)return(b.v-35n)/2n>0?b.v:27n+(b.v===35n?0n:1n);if(m>0)return BigInt(m*2)+BigInt(35n+b.v-27n);const k=27n+(b.v===27n?0n:1n);if(b.v!==k)throw new t.InvalidLegacyVError({v:b.v});return k})(),A=(0,o.trim)(b.r),P=(0,o.trim)(b.s);R=[...R,(0,a.toHex)(B),A==="0x00"?"0x":A,P==="0x00"?"0x":P]}else m>0&&(R=[...R,(0,a.toHex)(m),"0x","0x"]);return(0,c.toRlp)(R)}function v(E,b){const m=b??E,{v:_,yParity:O}=m;if(typeof m.r>"u")return[];if(typeof m.s>"u")return[];if(typeof _>"u"&&typeof O>"u")return[];const C=(0,o.trim)(m.r),S=(0,o.trim)(m.s);return[typeof O=="number"?O?(0,a.toHex)(1):"0x":_===0n?"0x":_===1n?(0,a.toHex)(1):_===27n?"0x":(0,a.toHex)(1),C==="0x00"?"0x":C,S==="0x00"?"0x":S]}return nm}var vE={},sm={},G4;function gW(){if(G4)return sm;G4=1,Object.defineProperty(sm,"__esModule",{value:!0}),sm.InvalidDecimalNumberError=void 0;const t=ut();class e extends t.BaseError{constructor({value:n}){super(`Number \`${n}\` is not a valid decimal number.`,{name:"InvalidDecimalNumberError"})}}return sm.InvalidDecimalNumberError=e,sm}var K4;function GC(){if(K4)return vE;K4=1,Object.defineProperty(vE,"__esModule",{value:!0}),vE.parseUnits=e;const t=gW();function e(r,n){if(!/^(-?)([0-9]*)\.?([0-9]*)$/.test(r))throw new t.InvalidDecimalNumberError({value:r});let[s,i="0"]=r.split(".");const o=s.startsWith("-");if(o&&(s=s.slice(1)),i=i.replace(/(0+)$/,""),n===0)Math.round(+`.${i}`)===1&&(s=`${BigInt(s)+1n}`),i="";else if(i.length>n){const[a,c,u]=[i.slice(0,n-1),i.slice(n-1,n),i.slice(n)],l=Math.round(+`${c}.${u}`);l>9?i=`${BigInt(a)+BigInt(1)}0`.padStart(a.length+1,"0"):i=`${a}${l}`,i.length>n&&(i=i.slice(1),s=`${BigInt(s)+1n}`),i=i.slice(0,n)}else i=i.padEnd(n,"0");return BigInt(`${o?"-":""}${s}${i}`)}return vE}var _E={},Z4;function mW(){if(Z4)return _E;Z4=1,Object.defineProperty(_E,"__esModule",{value:!0}),_E.parseEther=r;const t=B0(),e=GC();function r(n,s="wei"){return(0,e.parseUnits)(n,t.etherUnits[s])}return _E}var AE={},Y4;function yW(){if(Y4)return AE;Y4=1,Object.defineProperty(AE,"__esModule",{value:!0}),AE.parseGwei=r;const t=B0(),e=GC();function r(n,s="wei"){return(0,e.parseUnits)(n,t.gweiUnits[s])}return AE}var _l={},J4;function bW(){if(J4)return _l;
312J4=1,Object.defineProperty(_l,"__esModule",{value:!0}),_l.nonceManager=void 0,_l.createNonceManager=r,_l.jsonRpc=n;const t=wN(),e=x0();function r(s){const{source:i}=s,o=new Map,a=new e.LruMap(8192),c=new Map,u=({address:l,chainId:d})=>`${l}.${d}`;return{async consume({address:l,chainId:d,client:f}){const g=u({address:l,chainId:d}),h=this.get({address:l,chainId:d,client:f});this.increment({address:l,chainId:d});const p=await h;return await i.set({address:l,chainId:d},p),a.set(g,p),p},async increment({address:l,chainId:d}){const f=u({address:l,chainId:d}),g=o.get(f)??0;o.set(f,g+1)},async get({address:l,chainId:d,client:f}){const g=u({address:l,chainId:d});let h=c.get(g);return h||(h=(async()=>{try{const y=await i.get({address:l,chainId:d,client:f}),w=a.get(g)??0;return w>0&&y<=w?w+1:(a.delete(g),y)}finally{this.reset({address:l,chainId:d})}})(),c.set(g,h)),(o.get(g)??0)+await h},reset({address:l,chainId:d}){const f=u({address:l,chainId:d});o.delete(f),c.delete(f)}}}function n(){return{async get(s){const{address:i,client:o}=s;return(0,t.getTransactionCount)(o,{address:i,blockTag:"pending"})},set(){}}}return _l.nonceManager=r({source:n()}),_l}var Q4;function YN(){return Q4||(Q4=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.isAddress=t.getAddress=t.getCreate2Address=t.getCreateAddress=t.getContractAddress=t.publicKeyToAddress=t.parseAccount=t.formatAbiParams=t.formatAbiItem=t.formatAbiItemWithArgs=t.encodePacked=t.parseAbiParameters=t.parseAbiParameter=t.parseAbiItem=t.parseAbi=t.getAbiItem=t.parseEventLogs=t.encodeFunctionResult=t.encodeFunctionData=t.encodeEventTopics=t.encodeErrorResult=t.encodeDeployData=t.encodeAbiParameters=t.decodeFunctionResult=t.decodeFunctionData=t.decodeEventLog=t.decodeErrorResult=t.decodeAbiParameters=t.validateTypedData=t.serializeTypedData=t.stringify=t.getWebSocketRpcClient=t.socketClientCache=t.getSocketRpcClient=t.getHttpRpcClient=t.rpc=t.getSocket=t.integerRegex=t.bytesRegex=t.arrayRegex=t.getChainContractAddress=t.extractChain=t.defineChain=t.assertCurrentChain=t.offchainLookupSignature=t.offchainLookupAbiItem=t.offchainLookup=t.ccipFetch=t.ccipRequest=t.buildRequest=void 0,t.getCallError=t.getNodeError=t.containsNodeError=t.fromRlp=t.hexToString=t.hexToNumber=t.hexToBigInt=t.hexToBool=t.fromHex=t.fromBytes=t.bytesToString=t.bytesToNumber=t.bytesToBool=t.bytesToBigint=t.bytesToBigInt=t.stringToHex=t.numberToHex=t.toHex=t.bytesToHex=t.boolToHex=t.stringToBytes=t.numberToBytes=t.hexToBytes=t.toBytes=t.boolToBytes=t.toRlp=t.extract=t.formatTransactionRequest=t.defineTransactionRequest=t.defineTransactionReceipt=t.formatLog=t.transactionType=t.formatTransaction=t.defineTransaction=t.formatBlock=t.defineBlock=t.trim=t.sliceHex=t.sliceBytes=t.slice=t.size=t.padHex=t.padBytes=t.pad=t.isHex=t.isBytes=t.concatHex=t.concatBytes=t.concat=t.isAddressEqual=void 0,t.nonceManager=t.createNonceManager=t.parseGwei=t.parseEther=t.parseUnits=t.formatUnits=t.formatGwei=t.formatEther=t.serializeAccessList=t.serializeTransaction=t.parseTransaction=t.assertTransactionLegacy=t.assertTransactionEIP2930=t.assertTransactionEIP1559=t.assertRequest=t.getTransactionType=t.getSerializedTransactionType=t.serializeErc6492Signature=t.isErc6492Signature=t.parseErc6492Signature=t.hashMessage=t.verifyTypedData=t.verifyMessage=t.verifyHash=t.recoverTypedDataAddress=t.recoverPublicKey=t.recoverMessageAddress=t.recoverAddress=t.hashTypedData=t.hashStruct=t.ripemd160=t.sha256=t.keccak256=t.isHash=t.toFunctionHash=t.toEventHash=t.getFunctionSignature=t.toFunctionSignature=t.getEventSignature=t.toEventSignature=t.getFunctionSelector=t.toFunctionSelector=t.getEventSelector=t.toEventSelector=t.defineFormatter=t.getAction=t.getTransactionError=t.getEstimateGasError=t.getContractError=void 0;var e=$z();Object.defineProperty(t,"buildRequest",{enumerable:!0,get:function(){return e.buildRequest}});var r=PN();Object.defineProperty(t,"ccipRequest",{enumerable:!0,get:function(){return r.ccipRequest}}),Object.defineProperty(t,"ccipFetch",{enumerable:!0,get:function(){return r.ccipRequest}}),Object.defineProperty(t,"offchainLookup",{enumerable:!0,get:function(){return r.offchainLookup}}),Object.defineProperty(t,"offchainLookupAbiItem",{enumerable:!0,get:function(){return r.offchainLookupAbiItem}}),Object.defineProperty(t,"offchainLookupSignature",{enumerable:!0,get:function(){return r.offchainLookupSignature}});var n=LC();Object.defineProperty(t,"assertCurrentChain",{enumerable:!0,get:function(){return n.assertCurrentChain}});var s=Kz();Object.defineProperty(t,"defineChain",{enumerable:!0,get:function(){return s.defineChain}});var i=Zz();Object.defineProperty(t,"extractChain",{enumerable:!0,get:function(){return i.extractChain}});var o=Gu();Object.defineProperty(t,"getChainContractAddress",{enumerable:!0,get:function(){return o.getChainContractAddress}});var a=IC();Object.defineProperty(t,"arrayRegex",{enumerable:!0,get:function(){return a.arrayRegex}}),Object.defineProperty(t,"bytesRegex",{enumerable:!0,get:function(){return a.bytesRegex}}),Object.defineProperty(t,"integerRegex",{enumerable:!0,get:function(){return a.integerRegex}});var c=Jz();Object.defineProperty(t,"getSocket",{enumerable:!0,get:function(){return c.getSocket}}),Object.defineProperty(t,"rpc",{enumerable:!0,get:function(){return c.rpc}});var u=jN();Object.defineProperty(t,"getHttpRpcClient",{enumerable:!0,get:function(){return u.getHttpRpcClient}});var l=Yz();Object.defineProperty(t,"getSocketRpcClient",{enumerable:!0,get:function(){return l.getSocketRpcClient}}),Object.defineProperty(t,"socketClientCache",{enumerable:!0,get:function(){return l.socketClientCache}});var d=MN();Object.defineProperty(t,"getWebSocketRpcClient",{enumerable:!0,get:function(){return d.getWebSocketRpcClient}});var f=xn();Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return f.stringify}});var g=qC();Object.defineProperty(t,"serializeTypedData",{enumerable:!0,get:function(){return g.serializeTypedData}
312}),Object.defineProperty(t,"validateTypedData",{enumerable:!0,get:function(){return g.validateTypedData}});var h=qu();Object.defineProperty(t,"decodeAbiParameters",{enumerable:!0,get:function(){return h.decodeAbiParameters}});var p=TC();Object.defineProperty(t,"decodeErrorResult",{enumerable:!0,get:function(){return p.decodeErrorResult}});var y=F0();Object.defineProperty(t,"decodeEventLog",{enumerable:!0,get:function(){return y.decodeEventLog}});var w=Xz();Object.defineProperty(t,"decodeFunctionData",{enumerable:!0,get:function(){return w.decodeFunctionData}});var I=wc();Object.defineProperty(t,"decodeFunctionResult",{enumerable:!0,get:function(){return I.decodeFunctionResult}});var v=ro();Object.defineProperty(t,"encodeAbiParameters",{enumerable:!0,get:function(){return v.encodeAbiParameters}});var E=z0();Object.defineProperty(t,"encodeDeployData",{enumerable:!0,get:function(){return E.encodeDeployData}});var b=eW();Object.defineProperty(t,"encodeErrorResult",{enumerable:!0,get:function(){return b.encodeErrorResult}});var m=tf();Object.defineProperty(t,"encodeEventTopics",{enumerable:!0,get:function(){return m.encodeEventTopics}});var _=yi();Object.defineProperty(t,"encodeFunctionData",{enumerable:!0,get:function(){return _.encodeFunctionData}});var O=tW();Object.defineProperty(t,"encodeFunctionResult",{enumerable:!0,get:function(){return O.encodeFunctionResult}});var C=H0();Object.defineProperty(t,"parseEventLogs",{enumerable:!0,get:function(){return C.parseEventLogs}});var S=hc();Object.defineProperty(t,"getAbiItem",{enumerable:!0,get:function(){return S.getAbiItem}});var T=vC();Object.defineProperty(t,"parseAbi",{enumerable:!0,get:function(){return T.parseAbi}}),Object.defineProperty(t,"parseAbiItem",{enumerable:!0,get:function(){return T.parseAbiItem}}),Object.defineProperty(t,"parseAbiParameter",{enumerable:!0,get:function(){return T.parseAbiParameter}}),Object.defineProperty(t,"parseAbiParameters",{enumerable:!0,get:function(){return T.parseAbiParameters}});var N=rW();Object.defineProperty(t,"encodePacked",{enumerable:!0,get:function(){return N.encodePacked}});var R=bz();Object.defineProperty(t,"formatAbiItemWithArgs",{enumerable:!0,get:function(){return R.formatAbiItemWithArgs}});var B=fc();Object.defineProperty(t,"formatAbiItem",{enumerable:!0,get:function(){return B.formatAbiItem}}),Object.defineProperty(t,"formatAbiParams",{enumerable:!0,get:function(){return B.formatAbiParams}});var A=pn();Object.defineProperty(t,"parseAccount",{enumerable:!0,get:function(){return A.parseAccount}});var P=wz();Object.defineProperty(t,"publicKeyToAddress",{enumerable:!0,get:function(){return P.publicKeyToAddress}});var k=nW();Object.defineProperty(t,"getContractAddress",{enumerable:!0,get:function(){return k.getContractAddress}}),Object.defineProperty(t,"getCreateAddress",{enumerable:!0,get:function(){return k.getCreateAddress}}),Object.defineProperty(t,"getCreate2Address",{enumerable:!0,get:function(){return k.getCreate2Address}});var U=mi();Object.defineProperty(t,"getAddress",{enumerable:!0,get:function(){return U.getAddress}});var x=Ks();Object.defineProperty(t,"isAddress",{enumerable:!0,get:function(){return x.isAddress}});var j=yc();Object.defineProperty(t,"isAddressEqual",{enumerable:!0,get:function(){return j.isAddressEqual}});var D=Xn();Object.defineProperty(t,"concat",{enumerable:!0,get:function(){return D.concat}}),Object.defineProperty(t,"concatBytes",{enumerable:!0,get:function(){return D.concatBytes}}),Object.defineProperty(t,"concatHex",{enumerable:!0,get:function(){return D.concatHex}});var M=$N();Object.defineProperty(t,"isBytes",{enumerable:!0,get:function(){return M.isBytes}});var L=Qn();Object.defineProperty(t,"isHex",{enumerable:!0,get:function(){return L.isHex}});var H=Fu();Object.defineProperty(t,"pad",{enumerable:!0,get:function(){return H.pad}}),Object.defineProperty(t,"padBytes",{enumerable:!0,get:function(){return H.padBytes}}),Object.defineProperty(t,"padHex",{enumerable:!0,get:function(){return H.padHex}});var z=Gs();Object.defineProperty(t,"size",{enumerable:!0,get:function(){return z.size}});var V=to();Object.defineProperty(t,"slice",{enumerable:!0,get:function(){return V.slice}}),Object.defineProperty(t,"sliceBytes",{enumerable:!0,get:function(){return V.sliceBytes}}),Object.defineProperty(t,"sliceHex",{enumerable:!0,get:function(){return V.sliceHex}});var G=Hu();Object.defineProperty(t,"trim",{enumerable:!0,get:function(){return G.trim}});var ee=xC();Object.defineProperty(t,"defineBlock",{enumerable:!0,get:function(){return ee.defineBlock}}),Object.defineProperty(t,"formatBlock",{enumerable:!0,get:function(){return ee.formatBlock}});var X=$0();Object.defineProperty(t,"defineTransaction",{enumerable:!0,get:function(){return X.defineTransaction}}),Object.defineProperty(t,"formatTransaction",{enumerable:!0,get:function(){return X.formatTransaction}}),Object.defineProperty(t,"transactionType",{enumerable:!0,get:function(){return X.transactionType}});var oe=bc();Object.defineProperty(t,"formatLog",{enumerable:!0,get:function(){return oe.formatLog}});var te=LN();Object.defineProperty(t,"defineTransactionReceipt",{enumerable:!0,get:function(){return te.defineTransactionReceipt}});var fe=gc();Object.defineProperty(t,"defineTransactionRequest",{enumerable:!0,get:function(){return fe.defineTransactionRequest}}),Object.defineProperty(t,"formatTransactionRequest",{enumerable:!0,get:function(){return fe.formatTransactionRequest}});var Se=Up();Object.defineProperty(t,"extract",{enumerable:!0,get:function(){return Se.extract}});var le=D0();Object.defineProperty(t,"toRlp",{enumerable:!0,get:function(){return le.toRlp}});var we=Yt();Object.defineProperty(t,"boolToBytes",{enumerable:!0,get:function(){return we.boolToBytes}}),Object.defineProperty(t,"toBytes",{enumerable:!0,get:function(){return we.toBytes}}),Object.defineProperty(t,"hexToBytes",{enumerable:!0,get:function(){return we.hexToBytes}}),Object.defineProperty(t,"numberToBytes",{enumerable:!0,get:function(){return we.numberToBytes}}),Object.defineProperty(t,"stringToBytes",{enumerable:!0,get:function(){return we.stringToBytes}});var ve=Be();Object.defineProperty(t,"boolToHex",{enumerable:!0,get:function(){return ve.boolToHex}}),Object.defineProperty(t,"bytesToHex",{enumerable:!0,get:function(){return ve.bytesToHex}}),Object.defineProperty(t,"toHex",{enumerable:!0,get:function(){return ve.toHex}}),Object.defineProperty(t,"numberToHex",{enumerable:!0,get:function(){return ve.numberToHex}}),Object.defineProperty(t,"stringToHex",{enumerable:!0,get:function(){return ve.stringToHex}});var ae=dN();Object.defineProperty(t,"bytesToBigInt",{enumerable:!0,get:function(){return ae.bytesToBigInt}}),Object.defineProperty(t,"bytesToBigint",{enumerable:!0,get:function(){return ae.bytesToBigInt}}),Object.defineProperty(t,"bytesToBool",{enumerable:!0,get:function(){return ae.bytesToBool}}),Object.defineProperty(t,"bytesToNumber",{enumerable:!0,get:function(){return ae.bytesToNumber}}),Object.defineProperty(t,"bytesToString",{enumerable:!0,get:function(){return ae.bytesToString}}),Object.defineProperty(t,"fromBytes",{enumerable:!0,get:function(){return ae.fromBytes}});var re=Lr();Object.defineProperty(t,"fromHex",{enumerable:!0,get:function(){return re.fromHex}}),Object.defineProperty(t,"hexToBool",{enumerable:!0,get:function(){return re.hexToBool}}),Object.defineProperty(t,"hexToBigInt",{enumerable:!0,get:function(){return re.hexToBigInt}}),Object.defineProperty(t,"hexToNumber",{enumerable:!0,get:function(){return re.hexToNumber}}),Object.defineProperty(t,"hexToString",{enumerable:!0,get:function(){return re.hexToString}});var wt=FN();Object.defineProperty(t,"fromRlp",{enumerable:!0,get:function(){return wt.fromRlp}});var Ot=U0();Object.defineProperty(t,"containsNodeError",{enumerable:!0,get:function(){return Ot.containsNodeError}}),Object.defineProperty(t,"getNodeError",{enumerable:!0,get:function(){return Ot.getNodeError}});var pt=SN();Object.defineProperty(t,"getCallError",{enumerable:!0,get:function(){return pt.getCallError}});var nr=Wu();Object.defineProperty(t,"getContractError",{enumerable:!0,get:function(){return nr.getContractError}});var Jt=Iz();Object.defineProperty(t,"getEstimateGasError",{enumerable:!0,get:function(){return Jt.getEstimateGasError}});var sr=Dz();Object.defineProperty(t,"getTransactionError",{enumerable:!0,get:function(){return sr.getTransactionError}});var ie=Vt();Object.defineProperty(t,"getAction",{enumerable:!0,get:function(){return ie.getAction}});var de=M0();Object.defineProperty(t,"defineFormatter",{enumerable:!0,get:function(){return de.defineFormatter}});var Ce=Dp();Object.defineProperty(t,"toEventSelector",{enumerable:!0,get:function(){return Ce.toEventSelector}}),Object.defineProperty(t,"getEventSelector",{enumerable:!0,get:function(){return Ce.toEventSelector}});var ze=ef();Object.defineProperty(t,"toFunctionSelector",{enumerable:!0,get:function(){return ze.toFunctionSelector}}),Object.defineProperty(t,"getFunctionSelector",{enumerable:!0,get:function(){return ze.toFunctionSelector}});
312var Ut=sW();Object.defineProperty(t,"toEventSignature",{enumerable:!0,get:function(){return Ut.toEventSignature}}),Object.defineProperty(t,"getEventSignature",{enumerable:!0,get:function(){return Ut.toEventSignature}});var es=iW();Object.defineProperty(t,"toFunctionSignature",{enumerable:!0,get:function(){return es.toFunctionSignature}}),Object.defineProperty(t,"getFunctionSignature",{enumerable:!0,get:function(){return es.toFunctionSignature}});var Vo=oW();Object.defineProperty(t,"toEventHash",{enumerable:!0,get:function(){return Vo.toEventHash}});var Ss=aW();Object.defineProperty(t,"toFunctionHash",{enumerable:!0,get:function(){return Ss.toFunctionHash}});var Go=HN();Object.defineProperty(t,"isHash",{enumerable:!0,get:function(){return Go.isHash}});var io=Is();Object.defineProperty(t,"keccak256",{enumerable:!0,get:function(){return io.keccak256}});var bi=EN();Object.defineProperty(t,"sha256",{enumerable:!0,get:function(){return bi.sha256}});var QC=cW();Object.defineProperty(t,"ripemd160",{enumerable:!0,get:function(){return QC.ripemd160}});var X0=Y0();Object.defineProperty(t,"hashStruct",{enumerable:!0,get:function(){return X0.hashStruct}}),Object.defineProperty(t,"hashTypedData",{enumerable:!0,get:function(){return X0.hashTypedData}});var XC=Vu();Object.defineProperty(t,"recoverAddress",{enumerable:!0,get:function(){return XC.recoverAddress}});var e2=qN();Object.defineProperty(t,"recoverMessageAddress",{enumerable:!0,get:function(){return e2.recoverMessageAddress}});var t2=pN();Object.defineProperty(t,"recoverPublicKey",{enumerable:!0,get:function(){return t2.recoverPublicKey}});var r2=zN();Object.defineProperty(t,"recoverTypedDataAddress",{enumerable:!0,get:function(){return r2.recoverTypedDataAddress}});var eb=dW();Object.defineProperty(t,"verifyHash",{enumerable:!0,get:function(){return eb.verifyHash}});var tb=fW();Object.defineProperty(t,"verifyMessage",{enumerable:!0,get:function(){return tb.verifyMessage}});var Hp=hW();Object.defineProperty(t,"verifyTypedData",{enumerable:!0,get:function(){return Hp.verifyTypedData}});var n2=J0();Object.defineProperty(t,"hashMessage",{enumerable:!0,get:function(){return n2.hashMessage}});var s2=pW();Object.defineProperty(t,"parseErc6492Signature",{enumerable:!0,get:function(){return s2.parseErc6492Signature}});var i2=zC();Object.defineProperty(t,"isErc6492Signature",{enumerable:!0,get:function(){return i2.isErc6492Signature}});var o2=VN();Object.defineProperty(t,"serializeErc6492Signature",{enumerable:!0,get:function(){return o2.serializeErc6492Signature}});var a2=GN();Object.defineProperty(t,"getSerializedTransactionType",{enumerable:!0,get:function(){return a2.getSerializedTransactionType}});var c2=jC();Object.defineProperty(t,"getTransactionType",{enumerable:!0,get:function(){return c2.getTransactionType}});var u2=mc();Object.defineProperty(t,"assertRequest",{enumerable:!0,get:function(){return u2.assertRequest}});var Ku=WC();Object.defineProperty(t,"assertTransactionEIP1559",{enumerable:!0,get:function(){return Ku.assertTransactionEIP1559}}),Object.defineProperty(t,"assertTransactionEIP2930",{enumerable:!0,get:function(){return Ku.assertTransactionEIP2930}}),Object.defineProperty(t,"assertTransactionLegacy",{enumerable:!0,get:function(){return Ku.assertTransactionLegacy}});var Zu=KN();Object.defineProperty(t,"parseTransaction",{enumerable:!0,get:function(){return Zu.parseTransaction}});var Yu=VC();Object.defineProperty(t,"serializeTransaction",{enumerable:!0,get:function(){return Yu.serializeTransaction}});var Ju=ZN();Object.defineProperty(t,"serializeAccessList",{enumerable:!0,get:function(){return Ju.serializeAccessList}});var Qu=k0();Object.defineProperty(t,"formatEther",{enumerable:!0,get:function(){return Qu.formatEther}});var l2=rf();Object.defineProperty(t,"formatGwei",{enumerable:!0,get:function(){return l2.formatGwei}});var d2=PC();Object.defineProperty(t,"formatUnits",{enumerable:!0,get:function(){return d2.formatUnits}});var f2=GC();Object.defineProperty(t,"parseUnits",{enumerable:!0,get:function(){return f2.parseUnits}});var h2=mW();Object.defineProperty(t,"parseEther",{enumerable:!0,get:function(){return h2.parseEther}});var p2=yW();Object.defineProperty(t,"parseGwei",{enumerable:!0,get:function(){return p2.parseGwei}});var rb=bW();Object.defineProperty(t,"createNonceManager",{enumerable:!0,get:function(){return rb.createNonceManager}}),Object.defineProperty(t,"nonceManager",{enumerable:!0,get:function(){return rb.nonceManager}})}(PS)),PS}var X4;function b_e(){if(X4)return Y1;X4=1,Object.defineProperty(Y1,"__esModule",{value:!0}),Y1.formatProof=r;const t=YN();function e(n){return n.map(s=>({...s,value:BigInt(s.value)}))}function r(n){return{...n,balance:n.balance?BigInt(n.balance):void 0,nonce:n.nonce?(0,t.hexToNumber)(n.nonce):void 0,storageProof:n.storageProof?e(n.storageProof):void 0}}return Y1}var eU;function w_e(){if(eU)return Z1;eU=1,Object.defineProperty(Z1,"__esModule",{value:!0}),Z1.getProof=r;const t=Be(),e=b_e();async function r(n,{address:s,blockNumber:i,blockTag:o,storageKeys:a}){const c=o??"latest",u=i!==void 0?(0,t.numberToHex)(i):void 0,l=await n.request({method:"eth_getProof",params:[s,a,u||c]});return(0,e.formatProof)(l)}return Z1}var CE={},tU;function E_e(){if(tU)return CE;tU=1,Object.defineProperty(CE,"__esModule",{value:!0}),CE.getStorageAt=e;const t=Be();async function e(r,{address:n,blockNumber:s,blockTag:i="latest",slot:o}){const a=s!==void 0?(0,t.numberToHex)(s):void 0;return await r.request({method:"eth_getStorageAt",params:[n,o,a||i]})}return CE}var IE={},rU;function JN(){if(rU)return IE;rU=1,Object.defineProperty(IE,"__esModule",{value:!0}),IE.getTransaction=n;const t=Zs(),e=Be(),r=$0();async function n(s,{blockHash:i,blockNumber:o,blockTag:a,hash:c,index:u}){var h,p,y;const l=a||"latest",d=o!==void 0?(0,e.numberToHex)(o):void 0;let f=null;if(c?f=await s.request({method:"eth_getTransactionByHash",params:[c]},{dedupe:!0}):i?f=await s.request({method:"eth_getTransactionByBlockHashAndIndex",params:[i,(0,e.numberToHex)(u)]},{dedupe:!0}):f=await s.request({method:"eth_getTransactionByBlockNumberAndIndex",params:[d||l,(0,e.numberToHex)(u)]},{dedupe:!!d}),!f)throw new t.TransactionNotFoundError({blockHash:i,blockNumber:o,blockTag:l,hash:c,index:u});return(((y=(p=(h=s.chain)==null?void 0:h.formatters)==null?void 0:p.transaction)==null?void 0:y.format)||r.formatTransaction)(f)}return IE}var SE={},nU;function v_e(){if(nU)return SE;nU=1,Object.defineProperty(SE,"__esModule",{value:!0}),SE.getTransactionConfirmations=n;const t=Vt(),e=G0(),r=JN();async function n(s,{hash:i,transactionReceipt:o}){const[a,c]=await Promise.all([(0,t.getAction)(s,e.getBlockNumber,"getBlockNumber")({}),i?(0,t.getAction)(s,r.getTransaction,"getTransaction")({hash:i}):void 0]),u=(o==null?void 0:o.blockNumber)||(c==null?void 0:c.blockNumber);return u?a-u+1n:0n}return SE}var TE={},sU;function wW(){if(sU)return TE;sU=1,Object.defineProperty(TE,"__esModule",{value:!0}),TE.getTransactionReceipt=r;const t=Zs(),e=LN();async function r(n,{hash:s}){var a,c,u;const i=await n.request({method:"eth_getTransactionReceipt",params:[s]},{dedupe:!0});if(!i)throw new t.TransactionReceiptNotFoundError({hash:s});return(((u=(c=(a=n.chain)==null?void 0:a.formatters)==null?void 0:c.transactionReceipt)==null?void 0:u.format)||e.formatTransactionReceipt)(i)}return TE}var PE={},iU;function __e(){if(iU)return PE;iU=1,Object.defineProperty(PE,"__esModule",{value:!0}),PE.multicall=l;
312const t=sf(),e=lr(),r=ut(),n=zu(),s=wc(),i=yi(),o=Gu(),a=Wu(),c=Vt(),u=Ec();async function l(d,f){var T;const{allowFailure:g=!0,batchSize:h,blockNumber:p,blockTag:y,multicallAddress:w,stateOverride:I}=f,v=f.contracts,E=h??(typeof((T=d.batch)==null?void 0:T.multicall)=="object"&&d.batch.multicall.batchSize||1024);let b=w;if(!b){if(!d.chain)throw new Error("client chain not configured. multicallAddress is required.");b=(0,o.getChainContractAddress)({blockNumber:p,chain:d.chain,contract:"multicall3"})}const m=[[]];let _=0,O=0;for(let N=0;N<v.length;N++){const{abi:R,address:B,args:A,functionName:P}=v[N];try{const k=(0,i.encodeFunctionData)({abi:R,args:A,functionName:P});O+=(k.length-2)/2,E>0&&O>E&&m[_].length>0&&(_++,O=(k.length-2)/2,m[_]=[]),m[_]=[...m[_],{allowFailure:!0,callData:k,target:B}]}catch(k){const U=(0,a.getContractError)(k,{abi:R,address:B,args:A,docsPath:"/docs/contract/multicall",functionName:P});if(!g)throw U;m[_]=[...m[_],{allowFailure:!0,callData:"0x",target:B}]}}const C=await Promise.allSettled(m.map(N=>(0,c.getAction)(d,u.readContract,"readContract")({abi:t.multicall3Abi,address:b,args:[N],blockNumber:p,blockTag:y,functionName:"aggregate3",stateOverride:I}))),S=[];for(let N=0;N<C.length;N++){const R=C[N];if(R.status==="rejected"){if(!g)throw R.reason;for(let A=0;A<m[N].length;A++)S.push({status:"failure",error:R.reason,result:void 0});continue}const B=R.value;for(let A=0;A<B.length;A++){const{returnData:P,success:k}=B[A],{callData:U}=m[N][A],{abi:x,address:j,functionName:D,args:M}=v[S.length];try{if(U==="0x")throw new e.AbiDecodingZeroDataError;if(!k)throw new n.RawContractError({data:P});const L=(0,s.decodeFunctionResult)({abi:x,args:M,data:P,functionName:D});S.push(g?{result:L,status:"success"}:L)}catch(L){const H=(0,a.getContractError)(L,{abi:x,address:j,args:M,docsPath:"/docs/contract/multicall",functionName:D});if(!g)throw H;S.push({error:H,result:void 0,status:"failure"})}}}if(S.length!==v.length)throw new r.BaseError("multicall results mismatch");return S}return PE}var OE={},im={},st={},xe={},jS={},DS={},om={},oU;function A_e(){return oU||(oU=1,Object.defineProperty(om,"__esModule",{value:!0}),om.crypto=void 0,om.crypto=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0),om}var aU;function Sp(){return aU||(aU=1,function(t){/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */Object.defineProperty(t,"__esModule",{value:!0}),t.wrapXOFConstructorWithOpts=t.wrapConstructorWithOpts=t.wrapConstructor=t.Hash=t.nextTick=t.swap32IfBE=t.byteSwapIfBE=t.swap8IfBE=t.isLE=void 0,t.isBytes=r,t.anumber=n,t.abytes=s,t.ahash=i,t.aexists=o,t.aoutput=a,t.u8=c,t.u32=u,t.clean=l,t.createView=d,t.rotr=f,t.rotl=g,t.byteSwap=h,t.byteSwap32=p,t.bytesToHex=I,t.hexToBytes=b,t.asyncLoop=_,t.utf8ToBytes=O,t.bytesToUtf8=C,t.toBytes=S,t.kdfInputToBytes=T,t.concatBytes=N,t.checkOpts=R,t.createHasher=A,t.createOptHasher=P,t.createXOFer=k,t.randomBytes=U;const e=A_e();function r(x){return x instanceof Uint8Array||ArrayBuffer.isView(x)&&x.constructor.name==="Uint8Array"}function n(x){if(!Number.isSafeInteger(x)||x<0)throw new Error("positive integer expected, got "+x)}function s(x,...j){if(!r(x))throw new Error("Uint8Array expected");if(j.length>0&&!j.includes(x.length))throw new Error("Uint8Array expected of length "+j+", got length="+x.length)}function i(x){if(typeof x!="function"||typeof x.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");n(x.outputLen),n(x.blockLen)}function o(x,j=!0){if(x.destroyed)throw new Error("Hash instance has been destroyed");if(j&&x.finished)throw new Error("Hash#digest() has already been called")}function a(x,j){s(x);const D=j.outputLen;if(x.length<D)throw new Error("digestInto() expects output buffer of length at least "+D)}function c(x){return new Uint8Array(x.buffer,x.byteOffset,x.byteLength)}function u(x){return new Uint32Array(x.buffer,x.byteOffset,Math.floor(x.byteLength/4))}function l(...x){for(let j=0;j<x.length;j++)x[j].fill(0)}function d(x){return new DataView(x.buffer,x.byteOffset,x.byteLength)}function f(x,j){return x<<32-j|x>>>j}function g(x,j){return x<<j|x>>>32-j>>>0}t.isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function h(x){return x<<24&4278190080|x<<8&16711680|x>>>8&65280|x>>>24&255}t.swap8IfBE=t.isLE?x=>x:x=>h(x),t.byteSwapIfBE=t.swap8IfBE;function p(x){for(let j=0;j<x.length;j++)x[j]=h(x[j]);return x}t.swap32IfBE=t.isLE?x=>x:p;const y=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",w=Array.from({length:256},(x,j)=>j.toString(16).padStart(2,"0"));function I(x){if(s(x),y)return x.toHex();let j="";for(let D=0;D<x.length;D++)j+=w[x[D]];return j}const v={_0:48,_9:57,A:65,F:70,a:97,f:102};function E(x){if(x>=v._0&&x<=v._9)return x-v._0;if(x>=v.A&&x<=v.F)return x-(v.A-10);if(x>=v.a&&x<=v.f)return x-(v.a-10)}function b(x){if(typeof x!="string")throw new Error("hex string expected, got "+typeof x);if(y)return Uint8Array.fromHex(x);const j=x.length,D=j/2;if(j%2)throw new Error("hex string expected, got unpadded hex of length "+j);const M=new Uint8Array(D);for(let L=0,H=0;L<D;
312L++,H+=2){const z=E(x.charCodeAt(H)),V=E(x.charCodeAt(H+1));if(z===void 0||V===void 0){const G=x[H]+x[H+1];throw new Error('hex string expected, got non-hex character "'+G+'" at index '+H)}M[L]=z*16+V}return M}const m=async()=>{};t.nextTick=m;async function _(x,j,D){let M=Date.now();for(let L=0;L<x;L++){D(L);const H=Date.now()-M;H>=0&&H<j||(await(0,t.nextTick)(),M+=H)}}function O(x){if(typeof x!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(x))}function C(x){return new TextDecoder().decode(x)}function S(x){return typeof x=="string"&&(x=O(x)),s(x),x}function T(x){return typeof x=="string"&&(x=O(x)),s(x),x}function N(...x){let j=0;for(let M=0;M<x.length;M++){const L=x[M];s(L),j+=L.length}const D=new Uint8Array(j);for(let M=0,L=0;M<x.length;M++){const H=x[M];D.set(H,L),L+=H.length}return D}function R(x,j){if(j!==void 0&&{}.toString.call(j)!=="[object Object]")throw new Error("options should be object or undefined");return Object.assign(x,j)}class B{}t.Hash=B;function A(x){const j=M=>x().update(S(M)).digest(),D=x();return j.outputLen=D.outputLen,j.blockLen=D.blockLen,j.create=()=>x(),j}function P(x){const j=(M,L)=>x(L).update(S(M)).digest(),D=x({});return j.outputLen=D.outputLen,j.blockLen=D.blockLen,j.create=M=>x(M),j}function k(x){const j=(M,L)=>x(L).update(S(M)).digest(),D=x({});return j.outputLen=D.outputLen,j.blockLen=D.blockLen,j.create=M=>x(M),j}t.wrapConstructor=A,t.wrapConstructorWithOpts=P,t.wrapXOFConstructorWithOpts=k;function U(x=32){if(e.crypto&&typeof e.crypto.getRandomValues=="function")return e.crypto.getRandomValues(new Uint8Array(x));if(e.crypto&&typeof e.crypto.randomBytes=="function")return Uint8Array.from(e.crypto.randomBytes(x));throw new Error("crypto.getRandomValues must be defined")}}(DS)),DS}var cU;function C_e(){return cU||(cU=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.notImplemented=t.bitMask=t.utf8ToBytes=t.randomBytes=t.isBytes=t.hexToBytes=t.concatBytes=t.bytesToUtf8=t.bytesToHex=t.anumber=t.abytes=void 0,t.abool=i,t._abool2=o,t._abytes2=a,t.numberToHexUnpadded=c,t.hexToNumber=u,t.bytesToNumberBE=l,t.bytesToNumberLE=d,t.numberToBytesBE=f,t.numberToBytesLE=g,t.numberToVarBytesBE=h,t.ensureBytes=p,t.equalBytes=y,t.copyBytes=w,t.asciiToBytes=I,t.inRange=E,t.aInRange=b,t.bitLen=m,t.bitGet=_,t.bitSet=O,t.createHmacDrbg=S,t.validateObject=N,t.isHash=R,t._validateObject=B,t.memoized=P;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const e=Sp();var r=Sp();Object.defineProperty(t,"abytes",{enumerable:!0,get:function(){return r.abytes}}),Object.defineProperty(t,"anumber",{enumerable:!0,get:function(){return r.anumber}}),Object.defineProperty(t,"bytesToHex",{enumerable:!0,get:function(){return r.bytesToHex}}),Object.defineProperty(t,"bytesToUtf8",{enumerable:!0,get:function(){return r.bytesToUtf8}}),Object.defineProperty(t,"concatBytes",{enumerable:!0,get:function(){return r.concatBytes}}),Object.defineProperty(t,"hexToBytes",{enumerable:!0,get:function(){return r.hexToBytes}}),Object.defineProperty(t,"isBytes",{enumerable:!0,get:function(){return r.isBytes}}),Object.defineProperty(t,"randomBytes",{enumerable:!0,get:function(){return r.randomBytes}}),Object.defineProperty(t,"utf8ToBytes",{enumerable:!0,get:function(){return r.utf8ToBytes}});const n=BigInt(0),s=BigInt(1);function i(k,U){if(typeof U!="boolean")throw new Error(k+" boolean expected, got "+U)}function o(k,U=""){if(typeof k!="boolean"){const x=U&&`"${U}"`;throw new Error(x+"expected boolean, got type="+typeof k)}return k}function a(k,U,x=""){const j=(0,e.isBytes)(k),D=k==null?void 0:k.length,M=U!==void 0;if(!j||M&&D!==U){const L=x&&`"${x}" `,H=M?` of length ${U}`:"",z=j?`length=${D}`:`type=${typeof k}`;throw new Error(L+"expected Uint8Array"+H+", got "+z)}return k}function c(k){const U=k.toString(16);return U.length&1?"0"+U:U}function u(k){if(typeof k!="string")throw new Error("hex string expected, got "+typeof k);return k===""?n:BigInt("0x"+k)}function l(k){return u((0,e.bytesToHex)(k))}function d(k){return(0,e.abytes)(k),u((0,e.bytesToHex)(Uint8Array.from(k).reverse()))}function f(k,U){return(0,e.hexToBytes)(k.toString(16).padStart(U*2,"0"))}function g(k,U){return f(k,U).reverse()}function h(k){return(0,e.hexToBytes)(c(k))}function p(k,U,x){let j;if(typeof U=="string")try{j=(0,e.hexToBytes)(U)}catch(M){throw new Error(k+" must be hex string or Uint8Array, cause: "+M)}else if((0,e.isBytes)(U))j=Uint8Array.from(U);else throw new Error(k+" must be hex string or Uint8Array");const D=j.length;if(typeof x=="number"&&D!==x)throw new Error(k+" of length "+x+" expected, got "+D);return j}function y(k,U){if(k.length!==U.length)return!1;let x=0;for(let j=0;j<k.length;j++)x|=k[j]^U[j];return x===0}function w(k){return Uint8Array.from(k)}function I(k){return Uint8Array.from(k,(U,x)=>{const j=U.charCodeAt(0);if(U.length!==1||j>
312127)throw new Error(`string contains non-ASCII character "${k[x]}" with code ${j} at position ${x}`);return j})}const v=k=>typeof k=="bigint"&&n<=k;function E(k,U,x){return v(k)&&v(U)&&v(x)&&U<=k&&k<x}function b(k,U,x,j){if(!E(U,x,j))throw new Error("expected valid "+k+": "+x+" <= n < "+j+", got "+U)}function m(k){let U;for(U=0;k>n;k>>=s,U+=1);return U}function _(k,U){return k>>BigInt(U)&s}function O(k,U,x){return k|(x?s:n)<<BigInt(U)}const C=k=>(s<<BigInt(k))-s;t.bitMask=C;function S(k,U,x){if(typeof k!="number"||k<2)throw new Error("hashLen must be a number");if(typeof U!="number"||U<2)throw new Error("qByteLen must be a number");if(typeof x!="function")throw new Error("hmacFn must be a function");const j=oe=>new Uint8Array(oe),D=oe=>Uint8Array.of(oe);let M=j(k),L=j(k),H=0;const z=()=>{M.fill(1),L.fill(0),H=0},V=(...oe)=>x(L,M,...oe),G=(oe=j(0))=>{L=V(D(0),oe),M=V(),oe.length!==0&&(L=V(D(1),oe),M=V())},ee=()=>{if(H++>=1e3)throw new Error("drbg: tried 1000 values");let oe=0;const te=[];for(;oe<U;){M=V();const fe=M.slice();te.push(fe),oe+=M.length}return(0,e.concatBytes)(...te)};return(oe,te)=>{z(),G(oe);let fe;for(;!(fe=te(ee()));)G();return z(),fe}}const T={bigint:k=>typeof k=="bigint",function:k=>typeof k=="function",boolean:k=>typeof k=="boolean",string:k=>typeof k=="string",stringOrUint8Array:k=>typeof k=="string"||(0,e.isBytes)(k),isSafeInteger:k=>Number.isSafeInteger(k),array:k=>Array.isArray(k),field:(k,U)=>U.Fp.isValid(k),hash:k=>typeof k=="function"&&Number.isSafeInteger(k.outputLen)};function N(k,U,x={}){const j=(D,M,L)=>{const H=T[M];if(typeof H!="function")throw new Error("invalid validator function");const z=k[D];if(!(L&&z===void 0)&&!H(z,k))throw new Error("param "+String(D)+" is invalid. Expected "+M+", got "+z)};for(const[D,M]of Object.entries(U))j(D,M,!1);for(const[D,M]of Object.entries(x))j(D,M,!0);return k}function R(k){return typeof k=="function"&&Number.isSafeInteger(k.outputLen)}function B(k,U,x={}){if(!k||typeof k!="object")throw new Error("expected valid options object");function j(D,M,L){const H=k[D];if(L&&H===void 0)return;const z=typeof H;if(z!==M||H===null)throw new Error(`param "${D}" is invalid: expected ${M}, got ${z}`)}
312Object.entries(U).forEach(([D,M])=>j(D,M,!1)),Object.entries(x).forEach(([D,M])=>j(D,M,!0))}const A=()=>{throw new Error("not implemented")};t.notImplemented=A;function P(k){const U=new WeakMap;return(x,...j)=>{const D=U.get(x);if(D!==void 0)return D;const M=k(x,...j);return U.set(x,M),M}}}(jS)),jS}var uU;function EW(){if(uU)return xe;uU=1,Object.defineProperty(xe,"__esModule",{value:!0}),xe.isHash=xe.validateObject=xe.memoized=xe.notImplemented=xe.createHmacDrbg=xe.bitMask=xe.bitSet=xe.bitGet=xe.bitLen=xe.aInRange=xe.inRange=xe.asciiToBytes=xe.copyBytes=xe.equalBytes=xe.ensureBytes=xe.numberToVarBytesBE=xe.numberToBytesLE=xe.numberToBytesBE=xe.bytesToNumberLE=xe.bytesToNumberBE=xe.hexToNumber=xe.numberToHexUnpadded=xe.abool=xe.utf8ToBytes=xe.randomBytes=xe.isBytes=xe.hexToBytes=xe.concatBytes=xe.bytesToUtf8=xe.bytesToHex=xe.anumber=xe.abytes=void 0;const t=C_e();return xe.abytes=t.abytes,xe.anumber=t.anumber,xe.bytesToHex=t.bytesToHex,xe.bytesToUtf8=t.bytesToUtf8,xe.concatBytes=t.concatBytes,xe.hexToBytes=t.hexToBytes,xe.isBytes=t.isBytes,xe.randomBytes=t.randomBytes,xe.utf8ToBytes=t.utf8ToBytes,xe.abool=t.abool,xe.numberToHexUnpadded=t.numberToHexUnpadded,xe.hexToNumber=t.hexToNumber,xe.bytesToNumberBE=t.bytesToNumberBE,xe.bytesToNumberLE=t.bytesToNumberLE,xe.numberToBytesBE=t.numberToBytesBE,xe.numberToBytesLE=t.numberToBytesLE,xe.numberToVarBytesBE=t.numberToVarBytesBE,xe.ensureBytes=t.ensureBytes,xe.equalBytes=t.equalBytes,xe.copyBytes=t.copyBytes,xe.asciiToBytes=t.asciiToBytes,xe.inRange=t.inRange,xe.aInRange=t.aInRange,xe.bitLen=t.bitLen,xe.bitGet=t.bitGet,xe.bitSet=t.bitSet,xe.bitMask=t.bitMask,xe.createHmacDrbg=t.createHmacDrbg,xe.notImplemented=t.notImplemented,xe.memoized=t.memoized,xe.validateObject=t.validateObject,xe.isHash=t.isHash,xe}var yt={},am={},jf={},cm={},lU;function I_e(){return lU||(lU=1,Object.defineProperty(cm,"__esModule",{value:!0}),cm.version=void 0,cm.version="0.1.1"),cm}var dU;function S_e(){if(dU)return jf;dU=1,Object.defineProperty(jf,"__esModule",{value:!0}),jf.getUrl=e,jf.getVersion=r,jf.prettyPrint=n;const t=I_e();function e(s){return s}function r(){return t.version}function n(s){if(!s)return"";const i=Object.entries(s).map(([a,c])=>c===void 0||c===!1?null:[a,c]).filter(Boolean),o=i.reduce((a,[c])=>Math.max(a,c.length),0);return i.map(([a,c])=>`  ${`${a}:`.padEnd(o+1)}  ${c}`).join(`
313`)}return jf}var fU;function vc(){if(fU)return am;fU=1,Object.defineProperty(am,"__esModule",{value:!0}),am.BaseError=void 0;const t=S_e();class e extends Error{constructor(s,i={}){const o=(()=>{var d;if(i.cause instanceof e){if(i.cause.details)return i.cause.details;if(i.cause.shortMessage)return i.cause.shortMessage}return(d=i.cause)!=null&&d.message?i.cause.message:i.details})(),a=i.cause instanceof e&&i.cause.docsPath||i.docsPath,u=`https://oxlib.sh${a??""}`,l=[s||"An error occurred.",...i.metaMessages?["",...i.metaMessages]:[],...o||a?["",o?`Details: ${o}`:void 0,a?`See: ${u}`:void 0]:[]].filter(d=>typeof d=="string").join(`
314`);super(l,i.cause?{cause:i.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:`ox@${(0,t.getVersion)()}`}),this.cause=i.cause,this.details=o,this.docs=u,this.docsPath=a,this.shortMessage=s}walk(s){return r(this,s)}}am.BaseError=e;function r(n,s){return s!=null&&s(n)?n:n&&typeof n=="object"&&"cause"in n&&n.cause?r(n.cause,s):s?null:n}return am}var um={},hU;function QN(){if(hU)return um;hU=1,Object.defineProperty(um,"__esModule",{value:!0}),um.parse=e,um.stringify=r;const t="#__bigint";function e(n,s){return JSON.parse(n,(i,o)=>{const a=o;
314return typeof a=="string"&&a.endsWith(t)?BigInt(a.slice(0,-t.length)):typeof s=="function"?s(i,a):a})}function r(n,s,i){return JSON.stringify(n,(o,a)=>typeof s=="function"?s(o,a):typeof a=="bigint"?a.toString()+t:a,i)}return um}var US={},pU;function vW(){return pU||(pU=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.charCodeMap=void 0,t.assertSize=r,t.assertStartOffset=n,t.assertEndOffset=s,t.charCodeToBase16=i,t.pad=o,t.trim=a;const e=of();function r(c,u){if(e.size(c)>u)throw new e.SizeOverflowError({givenSize:e.size(c),maxSize:u})}function n(c,u){if(typeof u=="number"&&u>0&&u>e.size(c)-1)throw new e.SliceOffsetOutOfBoundsError({offset:u,position:"start",size:e.size(c)})}function s(c,u,l){if(typeof u=="number"&&typeof l=="number"&&e.size(c)!==l-u)throw new e.SliceOffsetOutOfBoundsError({offset:l,position:"end",size:e.size(c)})}t.charCodeMap={zero:48,nine:57,A:65,F:70,a:97,f:102};function i(c){if(c>=t.charCodeMap.zero&&c<=t.charCodeMap.nine)return c-t.charCodeMap.zero;if(c>=t.charCodeMap.A&&c<=t.charCodeMap.F)return c-(t.charCodeMap.A-10);if(c>=t.charCodeMap.a&&c<=t.charCodeMap.f)return c-(t.charCodeMap.a-10)}function o(c,u={}){const{dir:l,size:d=32}=u;if(d===0)return c;if(c.length>d)throw new e.SizeExceedsPaddingSizeError({size:c.length,targetSize:d,type:"Bytes"});const f=new Uint8Array(d);for(let g=0;g<d;g++){const h=l==="right";f[h?g:d-g-1]=c[h?g:c.length-g-1]}return f}function a(c,u={}){const{dir:l="left"}=u;let d=c,f=0;for(let g=0;g<d.length-1&&d[l==="left"?g:d.length-g-1].toString()==="0";g++)f++;return d=l==="left"?d.slice(f):d.slice(0,d.length-f),d}}(US)),US}var qc={},gU;function _W(){if(gU)return qc;gU=1,Object.defineProperty(qc,"__esModule",{value:!0}),qc.assertSize=e,qc.assertStartOffset=r,qc.assertEndOffset=n,qc.pad=s,qc.trim=i;const t=so();function e(o,a){if(t.size(o)>a)throw new t.SizeOverflowError({givenSize:t.size(o),maxSize:a})}function r(o,a){if(typeof a=="number"&&a>0&&a>t.size(o)-1)throw new t.SliceOffsetOutOfBoundsError({offset:a,position:"start",size:t.size(o)})}function n(o,a,c){if(typeof a=="number"&&typeof c=="number"&&t.size(o)!==c-a)throw new t.SliceOffsetOutOfBoundsError({offset:c,position:"end",size:t.size(o)})}function s(o,a={}){const{dir:c,size:u=32}=a;if(u===0)return o;const l=o.replace("0x","");if(l.length>u*2)throw new t.SizeExceedsPaddingSizeError({size:Math.ceil(l.length/2),targetSize:u,type:"Hex"});return`0x${l[c==="right"?"padEnd":"padStart"](u*2,"0")}`}function i(o,a={}){const{dir:c="left"}=a;let u=o.replace("0x",""),l=0;for(let d=0;d<u.length-1&&u[c==="left"?d:u.length-d-1].toString()==="0";d++)l++;return u=c==="left"?u.slice(l):u.slice(0,u.length-l),u==="0"?"0x":c==="right"&&u.length%2===1?`0x${u}0`:`0x${u}`}return qc}var mU;function of(){if(mU)return yt;mU=1,Object.defineProperty(yt,"__esModule",{value:!0}),yt.SizeExceedsPaddingSizeError=yt.SliceOffsetOutOfBoundsError=yt.SizeOverflowError=yt.InvalidBytesTypeError=yt.InvalidBytesBooleanError=void 0,yt.assert=c,yt.concat=u,yt.from=l,yt.fromArray=d,yt.fromBoolean=f,yt.fromHex=g,yt.fromNumber=h,yt.fromString=p,yt.isEqual=y,yt.padLeft=w,yt.padRight=I,yt.random=v,yt.size=E,yt.slice=b,yt.toBigInt=m,yt.toBoolean=_,yt.toHex=O,yt.toNumber=C,yt.toString=S,yt.trimLeft=T,yt.trimRight=N,yt.validate=R;const t=EW(),e=vc(),r=so(),n=QN(),s=vW(),i=_W(),o=new TextDecoder,a=new TextEncoder;
314function c(x){if(!(x instanceof Uint8Array)){if(!x)throw new A(x);if(typeof x!="object")throw new A(x);if(!("BYTES_PER_ELEMENT"in x))throw new A(x);if(x.BYTES_PER_ELEMENT!==1||x.constructor.name!=="Uint8Array")throw new A(x)}}function u(...x){let j=0;for(const M of x)j+=M.length;const D=new Uint8Array(j);for(let M=0,L=0;M<x.length;M++){const H=x[M];D.set(H,L),L+=H.length}return D}function l(x){return x instanceof Uint8Array?x:typeof x=="string"?g(x):d(x)}function d(x){return x instanceof Uint8Array?x:new Uint8Array(x)}function f(x,j={}){const{size:D}=j,M=new Uint8Array(1);return M[0]=Number(x),typeof D=="number"?(s.assertSize(M,D),w(M,D)):M}function g(x,j={}){const{size:D}=j;let M=x;D&&(i.assertSize(x,D),M=r.padRight(x,D));let L=M.slice(2);L.length%2&&(L=`0${L}`);const H=L.length/2,z=new Uint8Array(H);for(let V=0,G=0;V<H;V++){const ee=s.charCodeToBase16(L.charCodeAt(G++)),X=s.charCodeToBase16(L.charCodeAt(G++));if(ee===void 0||X===void 0)throw new e.BaseError(`Invalid byte sequence ("${L[G-2]}${L[G-1]}" in "${L}").`);z[V]=ee*16+X}return z}function h(x,j){const D=r.fromNumber(x,j);return g(D)}function p(x,j={}){const{size:D}=j,M=a.encode(x);return typeof D=="number"?(s.assertSize(M,D),I(M,D)):M}function y(x,j){return(0,t.equalBytes)(x,j)}function w(x,j){return s.pad(x,{dir:"left",size:j})}function I(x,j){return s.pad(x,{dir:"right",size:j})}function v(x){return crypto.getRandomValues(new Uint8Array(x))}function E(x){return x.length}function b(x,j,D,M={}){const{strict:L}=M;s.assertStartOffset(x,j);const H=x.slice(j,D);return L&&s.assertEndOffset(H,j,D),H}function m(x,j={}){const{size:D}=j;typeof D<"u"&&s.assertSize(x,D);const M=r.fromBytes(x,j);return r.toBigInt(M,j)}function _(x,j={}){const{size:D}=j;let M=x;if(typeof D<"u"&&(s.assertSize(M,D),M=T(M)),M.length>1||M[0]>1)throw new B(M);return!!M[0]}function O(x,j={}){return r.fromBytes(x,j)}function C(x,j={}){const{size:D}=j;typeof D<"u"&&s.assertSize(x,D);const M=r.fromBytes(x,j);return r.toNumber(M,j)}function S(x,j={}){const{size:D}=j;let M=x;return typeof D<"u"&&(s.assertSize(M,D),M=N(M)),o.decode(M)}function T(x){return s.trim(x,{dir:"left"})}function N(x){return s.trim(x,{dir:"right"})}function R(x){try{return c(x),!0}catch{return!1}}class B extends e.BaseError{constructor(j){super(`Bytes value \`${j}\` is not a valid boolean.`,{metaMessages:["The bytes array must contain a single byte of either a `0` or `1` value."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.InvalidBytesBooleanError"})}}yt.InvalidBytesBooleanError=B;class A extends e.BaseError{constructor(j){super(`Value \`${typeof j=="object"?n.stringify(j):j}\` of type \`${typeof j}\` is an invalid Bytes value.`,{metaMessages:["Bytes values must be of type `Bytes`."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.InvalidBytesTypeError"})}}yt.InvalidBytesTypeError=A;class P extends e.BaseError{constructor({givenSize:j,maxSize:D}){super(`Size cannot exceed \`${D}\` bytes. Given size: \`${j}\` bytes.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.SizeOverflowError"})}}yt.SizeOverflowError=P;class k extends e.BaseError{constructor({offset:j,position:D,size:M}){super(`Slice ${D==="start"?"starting":"ending"} at offset \`${j}\` is out-of-bounds (size: \`${M}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.SliceOffsetOutOfBoundsError"})}}yt.SliceOffsetOutOfBoundsError=k;class U extends e.BaseError{constructor({size:j,targetSize:D,type:M}){super(`${M.charAt(0).toUpperCase()}${M.slice(1).toLowerCase()} size (\`${j}\`) exceeds padding size (\`${D}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.SizeExceedsPaddingSizeError"})}}return yt.SizeExceedsPaddingSizeError=U,yt}var yU;function so(){if(yU)return st;yU=1,Object.defineProperty(st,"__esModule",{value:!0}),st.SizeExceedsPaddingSizeError=st.SliceOffsetOutOfBoundsError=st.SizeOverflowError=st.InvalidLengthError=st.InvalidHexValueError=st.InvalidHexTypeError=st.InvalidHexBooleanError=st.IntegerOutOfRangeError=void 0,st.assert=c,st.concat=u,st.from=l,st.fromBoolean=d,st.fromBytes=f,st.fromNumber=g,st.fromString=h,st.isEqual=p,st.padLeft=y,st.padRight=w,st.random=I,st.slice=v,st.size=E,st.trimLeft=b,st.trimRight=m,st.toBigInt=_,st.toBoolean=O,st.toBytes=C,st.toNumber=S,st.toString=T,st.validate=N;const t=EW(),e=of(),r=vc(),n=QN(),s=vW(),i=_W(),o=new TextEncoder,a=Array.from({length:256},(D,M)=>M.toString(16).padStart(2,"0"));function c(D,M={}){const{strict:L=!1}=M;if(!D)throw new A(D);if(typeof D!="string")throw new A(D);if(L&&!/^0x[0-9a-fA-F]*$/.test(D))throw new P(D);if(!D.startsWith("0x"))throw new P(D)}function u(...D){return`0x${D.reduce((M,L)=>M+L.replace("0x",""),"")}`}function l(D){return D instanceof Uint8Array?f(D):Array.isArray(D)?f(new Uint8Array(D)):D}function d(D,M={}){const L=`0x${Number(D)}`;return typeof M.size=="number"?(i.assertSize(L,M.size),y(L,M.size)):L}function f(D,M={}){let L="";for(let z=0;z<D.length;z++)L+=a[D[z]];const H=`0x${L}`;return typeof M.size=="number"?(i.assertSize(H,M.size),w(H,M.size)):H}function g(D,M={}){const{signed:L,size:H}=M,z=BigInt(D);let V;H?L?V=(1n<<BigInt(H)*8n-1n)-1n:V=2n**(BigInt(H)*8n)-1n:typeof D=="number"&&(V=BigInt(Number.MAX_SAFE_INTEGER));const G=typeof V=="bigint"&&L?-V-1n:0;if(V&&z>V||z<G){const oe=typeof D=="bigint"?"n":"";throw new R({max:V?`${V}${oe}`:void 0,min:`${G}${oe}`,signed:L,size:H,value:`${D}${oe}`})}const X=`0x${(L&&z<0?(1n<<BigInt(H*8))+BigInt(z):z).toString(16)}`;return H?y(X,H):X}function h(D,M={}){return f(o.encode(D),M)}function p(D,M){return(0,t.equalBytes)(e.fromHex(D),e.fromHex(M))}function y(D,M){return i.pad(D,{dir:"left",size:M})}function w(D,M){return i.pad(D,{dir:"right",size:M})}function I(D){return f(e.random(D))}function v(D,M,L,H={}){const{strict:z}=H;i.assertStartOffset(D,M);const V=`0x${D.replace("0x","").slice((M??0)*2,(L??D.length)*2)}`;return z&&i.assertEndOffset(V,M,L),V}function E(D){return Math.ceil((D.length-2)/2)}function b(D){return i.trim(D,{dir:"left"})}function m(D){return i.trim(D,{dir:"right"})}function _(D,M={}){const{signed:L}=M;M.size&&i.assertSize(D,M.size);const H=BigInt(D);if(!L)return H;const z=(D.length-2)/2,V=(1n<<BigInt(z)*8n)-1n,G=V>>1n;return H<=G?H:H-V-1n}function O(D,M={}){M.size&&i.assertSize(D,M.size);const L=b(D);if(L==="0x")return!1;if(L==="0x1")return!0;throw new B(D)}function C(D,M={}){return e.fromHex(D,M)}function S(D,M={}){const{signed:L,size:H}=M;return Number(!L&&!H?D:_(D,M))}function T(D,M={}){const{size:L}=M;let H=e.fromHex(D);return L&&(s.assertSize(H,L),H=e.trimRight(H)),new TextDecoder().decode(H)}function N(D,M={}){const{strict:L=!1}=M;try{return c(D,{strict:L}),!0}catch{return!1}}class R extends r.BaseError{constructor({max:M,min:L,signed:H,size:z,value:V}
314){super(`Number \`${V}\` is not in safe${z?` ${z*8}-bit`:""}${H?" signed":" unsigned"} integer range ${M?`(\`${L}\` to \`${M}\`)`:`(above \`${L}\`)`}`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.IntegerOutOfRangeError"})}}st.IntegerOutOfRangeError=R;class B extends r.BaseError{constructor(M){super(`Hex value \`"${M}"\` is not a valid boolean.`,{metaMessages:['The hex value must be `"0x0"` (false) or `"0x1"` (true).']}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.InvalidHexBooleanError"})}}st.InvalidHexBooleanError=B;class A extends r.BaseError{constructor(M){super(`Value \`${typeof M=="object"?n.stringify(M):M}\` of type \`${typeof M}\` is an invalid hex type.`,{metaMessages:['Hex types must be represented as `"0x${string}"`.']}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.InvalidHexTypeError"})}}st.InvalidHexTypeError=A;class P extends r.BaseError{constructor(M){super(`Value \`${M}\` is an invalid hex value.`,{metaMessages:['Hex values must start with `"0x"` and contain only hexadecimal characters (0-9, a-f, A-F).']}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.InvalidHexValueError"})}}st.InvalidHexValueError=P;class k extends r.BaseError{constructor(M){super(`Hex value \`"${M}"\` is an odd length (${M.length-2} nibbles).`,{metaMessages:["It must be an even length."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.InvalidLengthError"})}}st.InvalidLengthError=k;class U extends r.BaseError{constructor({givenSize:M,maxSize:L}){super(`Size cannot exceed \`${L}\` bytes. Given size: \`${M}\` bytes.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SizeOverflowError"})}}st.SizeOverflowError=U;class x extends r.BaseError{constructor({offset:M,position:L,size:H}){super(`Slice ${L==="start"?"starting":"ending"} at offset \`${M}\` is out-of-bounds (size: \`${H}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SliceOffsetOutOfBoundsError"})}}st.SliceOffsetOutOfBoundsError=x;class j extends r.BaseError{constructor({size:M,targetSize:L,type:H}){super(`${H.charAt(0).toUpperCase()}${H.slice(1).toLowerCase()} size (\`${M}\`) exceeds padding size (\`${L}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SizeExceedsPaddingSizeError"})}}return st.SizeExceedsPaddingSizeError=j,st}var lm={},bU;function T_e(){if(bU)return lm;bU=1,Object.defineProperty(lm,"__esModule",{value:!0}),lm.fromRpc=e,lm.toRpc=r;const t=so();function e(n){return{...n,amount:BigInt(n.amount),index:Number(n.index),validatorIndex:Number(n.validatorIndex)}}function r(n){return{address:n.address,amount:t.fromNumber(n.amount),index:t.fromNumber(n.index),validatorIndex:t.fromNumber(n.validatorIndex)}}return lm}var wU;function P_e(){if(wU)return im;wU=1,Object.defineProperty(im,"__esModule",{value:!0}),im.fromRpc=r,im.toRpc=n;const t=so(),e=T_e();function r(s){return{...s.baseFeePerGas&&{baseFeePerGas:BigInt(s.baseFeePerGas)},...s.blobBaseFee&&{blobBaseFee:BigInt(s.blobBaseFee)},...s.feeRecipient&&{feeRecipient:s.feeRecipient},...s.gasLimit&&{gasLimit:BigInt(s.gasLimit)},...s.number&&{number:BigInt(s.number)},...s.prevRandao&&{prevRandao:BigInt(s.prevRandao)},...s.time&&{time:BigInt(s.time)},...s.withdrawals&&{withdrawals:s.withdrawals.map(e.fromRpc)}}}function n(s){return{...typeof s.baseFeePerGas=="bigint"&&{baseFeePerGas:t.fromNumber(s.baseFeePerGas)},...typeof s.blobBaseFee=="bigint"&&{blobBaseFee:t.fromNumber(s.blobBaseFee)},...typeof s.feeRecipient=="string"&&{feeRecipient:s.feeRecipient},...typeof s.gasLimit=="bigint"&&{gasLimit:t.fromNumber(s.gasLimit)},...typeof s.number=="bigint"&&{number:t.fromNumber(s.number)},...typeof s.prevRandao=="bigint"&&{prevRandao:t.fromNumber(s.prevRandao)},...typeof s.time=="bigint"&&{time:t.fromNumber(s.time)},...s.withdrawals&&{withdrawals:s.withdrawals.map(e.toRpc)}}}return im}var EU;function AW(){if(EU)return OE;EU=1,Object.defineProperty(OE,"__esModule",{value:!0}),OE.simulateBlocks=p;const t=P_e(),e=pn(),r=lr(),n=zu(),s=pc(),i=wc(),o=yi(),a=Be(),c=Wu(
314),u=U0(),l=xC(),d=bc(),f=gc(),g=gN(),h=mc();async function p(y,w){const{blockNumber:I,blockTag:v="latest",blocks:E,returnFullTransactions:b,traceTransfers:m,validation:_}=w;try{const O=[];for(const N of E){const R=N.blockOverrides?t.toRpc(N.blockOverrides):void 0,B=N.calls.map(P=>{const k=P,U=k.account?(0,e.parseAccount)(k.account):void 0,x={...k,data:k.abi?(0,o.encodeFunctionData)(k):k.data,from:k.from??(U==null?void 0:U.address)};return(0,h.assertRequest)(x),(0,f.formatTransactionRequest)(x)}),A=N.stateOverrides?(0,g.serializeStateOverride)(N.stateOverrides):void 0;O.push({blockOverrides:R,calls:B,stateOverrides:A})}const S=(I?(0,a.numberToHex)(I):void 0)||v;return(await y.request({method:"eth_simulateV1",params:[{blockStateCalls:O,returnFullTransactions:b,traceTransfers:m,validation:_},S]})).map((N,R)=>({...(0,l.formatBlock)(N),calls:N.calls.map((B,A)=>{var V,G;const{abi:P,args:k,functionName:U,to:x}=E[R].calls[A],j=((V=B.error)==null?void 0:V.data)??B.returnData,D=BigInt(B.gasUsed),M=(G=B.logs)==null?void 0:G.map(ee=>(0,d.formatLog)(ee)),L=B.status==="0x1"?"success":"failure",H=P&&L==="success"?(0,i.decodeFunctionResult)({abi:P,data:j,functionName:U}):null,z=(()=>{var X;if(L==="success")return;let ee;if(((X=B.error)==null?void 0:X.data)==="0x"?ee=new r.AbiDecodingZeroDataError:B.error&&(ee=new n.RawContractError(B.error)),!!ee)return(0,c.getContractError)(ee,{abi:P??[],address:x,args:k,functionName:U??"<unknown>"})})();return{data:j,gasUsed:D,logs:M,status:L,...L==="success"?{result:H}:{error:z}}})}))}catch(O){const C=O,S=(0,u.getNodeError)(C,{});throw S instanceof s.UnknownNodeError?C:S}}return OE}var NE={},zc={},MS={},dm={},fm={},vU;function O_e(){return vU||(vU=1,Object.defineProperty(fm,"__esModule",{value:!0}),fm.version=void 0,fm.version="1.2.3"),fm}var _U;function Lp(){if(_U)return dm;_U=1,Object.defineProperty(dm,"__esModule",{value:!0}),dm.BaseError=void 0;const t=O_e();class e extends Error{constructor(n,s={}){var c;const i=s.cause instanceof e?s.cause.details:(c=s.cause)!=null&&c.message?s.cause.message:s.details,o=s.cause instanceof e&&s.cause.docsPath||s.docsPath,a=[n||"An error occurred.","",...s.metaMessages?[...s.metaMessages,""]:[],...o?[`Docs: https://abitype.dev${o}`]:[],...i?[`Details: ${i}`]:[],`Version: abitype@${t.version}`].join(`
315`);super(a),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiTypeError"}),s.cause&&(this.cause=s.cause),this.details=i,this.docsPath=o,this.metaMessages=s.metaMessages,this.shortMessage=n}}return dm.BaseError=e,dm}var xE={},AU;function N_e(){if(AU)return xE;AU=1,Object.defineProperty(xE,"__esModule",{value:!0}),xE.narrow=t;function t(e){return e}return xE}var RE={},BE={},kE={},jE={},po={},CU;function KC(){if(CU)return po;CU=1,Object.defineProperty(po,"__esModule",{value:!0}),po.isTupleRegex=po.integerRegex=po.bytesRegex=void 0,po.execTyped=t;function t(e,r){const n=e.exec(r);return n==null?void 0:n.groups}return po.bytesRegex=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,po.integerRegex=/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/,po.isTupleRegex=/^\(.+?\).*?$/,po}var IU;function CW(){if(IU)return jE;IU=1,Object.defineProperty(jE,"__esModule",{value:!0}),jE.formatAbiParameter=r;const t=KC(),e=/^tuple(?<array>(\[(\d*)\])*)$/;function r(n){let s=n.type;if(e.test(n.type)&&"components"in n){s="(";const i=n.components.length;for(let a=0;a<i;a++){const c=n.components[a];s+=r(c),a<i-1&&(s+=", ")}const o=(0,t.execTyped)(e,n.type);return s+=`)${(o==null?void 0:o.array)||""}`,r({...n,type:s})}return"indexed"in n&&n.indexed&&(s=`${s} indexed`),n.name?`${s} ${n.name}`:s}return jE}var SU;function IW(){if(SU)return kE;SU=1,Object.defineProperty(kE,"__esModule",{value:!0}),kE.formatAbiParameters=e;const t=CW();function e(r){let n="";const s=r.length;for(let i=0;i<s;i++){const o=r[i];n+=(0,t.formatAbiParameter)(o),i!==s-1&&(n+=", ")}return n}return kE}var TU;function SW(){if(TU)return BE;TU=1,Object.defineProperty(BE,"__esModule",{value:!0}),BE.formatAbiItem=e;const t=IW();function e(r){var n;return r.type==="function"?`function ${r.name}(${(0,t.formatAbiParameters)(r.inputs)})${r.stateMutability&&r.stateMutability!=="nonpayable"?` ${r.stateMutability}`:""}${(n=r.outputs)!=null&&n.length?` returns (${(0,t.formatAbiParameters)(r.outputs)})`:""}`:r.type==="event"?`event ${r.name}(${(0,t.formatAbiParameters)(r.inputs)})`:r.type==="error"?`error ${r.name}(${(0,t.formatAbiParameters)(r.inputs)}
315)`:r.type==="constructor"?`constructor(${(0,t.formatAbiParameters)(r.inputs)})${r.stateMutability==="payable"?" payable":""}`:r.type==="fallback"?`fallback() external${r.stateMutability==="payable"?" payable":""}`:"receive() external payable"}return BE}var PU;function x_e(){if(PU)return RE;PU=1,Object.defineProperty(RE,"__esModule",{value:!0}),RE.formatAbi=e;const t=SW();function e(r){const n=[],s=r.length;for(let i=0;i<s;i++){const o=r[i],a=(0,t.formatAbiItem)(o);n.push(a)}return n}return RE}var DE={},br={},OU;function Fp(){if(OU)return br;OU=1,Object.defineProperty(br,"__esModule",{value:!0}),br.functionModifiers=br.eventModifiers=br.modifiers=void 0,br.isErrorSignature=r,br.execErrorSignature=n,br.isEventSignature=i,br.execEventSignature=o,br.isFunctionSignature=c,br.execFunctionSignature=u,br.isStructSignature=d,br.execStructSignature=f,br.isConstructorSignature=h,br.execConstructorSignature=p,br.isFallbackSignature=w,br.execFallbackSignature=I,br.isReceiveSignature=E;const t=KC(),e=/^error (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function r(b){return e.test(b)}function n(b){return(0,t.execTyped)(e,b)}const s=/^event (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function i(b){return s.test(b)}function o(b){return(0,t.execTyped)(s,b)}const a=/^function (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)(?: (?<scope>external|public{1}))?(?: (?<stateMutability>pure|view|nonpayable|payable{1}))?(?: returns\s?\((?<returns>.*?)\))?$/;function c(b){return a.test(b)}function u(b){return(0,t.execTyped)(a,b)}const l=/^struct (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*) \{(?<properties>.*?)\}$/;function d(b){return l.test(b)}function f(b){return(0,t.execTyped)(l,b)}const g=/^constructor\((?<parameters>.*?)\)(?:\s(?<stateMutability>payable{1}))?$/;function h(b){return g.test(b)}function p(b){return(0,t.execTyped)(g,b)}const y=/^fallback\(\) external(?:\s(?<stateMutability>payable{1}))?$/;function w(b){return y.test(b)}function I(b){return(0,t.execTyped)(y,b)}const v=/^receive\(\) external payable$/;function E(b){return v.test(b)}return br.modifiers=new Set(["memory","indexed","storage","calldata"]),br.eventModifiers=new Set(["indexed"]),br.functionModifiers=new Set(["calldata","memory","storage"]),br}var UE={},Aa={},NU;function ZC(){if(NU)return Aa;NU=1,Object.defineProperty(Aa,"__esModule",{value:!0}),Aa.UnknownSolidityTypeError=Aa.UnknownTypeError=Aa.InvalidAbiItemError=void 0;const t=Lp();class e extends t.BaseError{constructor({signature:i}){super("Failed to parse ABI item.",{details:`parseAbiItem(${JSON.stringify(i,null,2)})`,docsPath:"/api/human#parseabiitem-1"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiItemError"})}}Aa.InvalidAbiItemError=e;class r extends t.BaseError{constructor({type:i}){super("Unknown type.",{metaMessages:[`Type "${i}" is not a valid ABI type. Perhaps you forgot to include a struct signature?`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownTypeError"})}}Aa.UnknownTypeError=r;class n extends t.BaseError{constructor({type:i}){super("Unknown type.",{metaMessages:[`Type "${i}" is not a valid ABI type.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSolidityTypeError"})}}return Aa.UnknownSolidityTypeError=n,Aa}var sn={},xU;function Q0(){if(xU)return sn;xU=1,Object.defineProperty(sn,"__esModule",{value:!0}),sn.InvalidAbiTypeParameterError=sn.InvalidFunctionModifierError=sn.InvalidModifierError=sn.SolidityProtectedKeywordError=sn.InvalidParameterError=sn.InvalidAbiParametersError=sn.InvalidAbiParameterError=void 0;const t=Lp();class e extends t.BaseError{constructor({param:u}){super("Failed to parse ABI parameter.",{details:`parseAbiParameter(${JSON.stringify(u,null,2)})`,docsPath:"/api/human#parseabiparameter-1"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiParameterError"})}}sn.InvalidAbiParameterError=e;class r extends t.BaseError{constructor({params:u}){super("Failed to parse ABI parameters.",{details:`parseAbiParameters(${JSON.stringify(u,null,2)})`,docsPath:"/api/human#parseabiparameters-1"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiParametersError"})}}sn.InvalidAbiParametersError=r;class n extends t.BaseError{constructor({param:u}){super("Invalid ABI parameter.",{details:u}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParameterError"})}}sn.InvalidParameterError=n;class s extends t.BaseError{constructor({param:u,name:l}){super("Invalid ABI parameter.",{details:u,metaMessages:[`"${l}" is a protected Solidity keyword. More info: https://docs.soliditylang.org/en/latest/cheatsheet.html`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SolidityProtectedKeywordError"})}}sn.SolidityProtectedKeywordError=s;class i extends t.BaseError{constructor({param:u,type:l,modifier:d}){super("Invalid ABI parameter.",{details:u,metaMessages:[`Modifier "${d}" not allowed${l?` in "${l}" type`:""}.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidModifierError"})}}sn.InvalidModifierError=i;class o extends t.BaseError{constructor({param:u,type:l,modifier:d}){super("Invalid ABI parameter.",{details:u,metaMessages:[`Modifier "${d}" not allowed${l?` in "${l}" type`:""}.`,`Data location can only be specified for array, struct, or mapping types, but "${d}" was given.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidFunctionModifierError"})}}sn.InvalidFunctionModifierError=o;class a extends t.BaseError{constructor({abiParameter:u}){super("Invalid ABI parameter.",{details:JSON.stringify(u,null,2),metaMessages:["ABI parameter type is invali
315d."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiTypeParameterError"})}}return sn.InvalidAbiTypeParameterError=a,sn}var Ca={},RU;function XN(){if(RU)return Ca;RU=1,Object.defineProperty(Ca,"__esModule",{value:!0}),Ca.InvalidStructSignatureError=Ca.UnknownSignatureError=Ca.InvalidSignatureError=void 0;const t=Lp();class e extends t.BaseError{constructor({signature:i,type:o}){super(`Invalid ${o} signature.`,{details:i}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidSignatureError"})}}Ca.InvalidSignatureError=e;class r extends t.BaseError{constructor({signature:i}){super("Unknown signature.",{details:i}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSignatureError"})}}Ca.UnknownSignatureError=r;class n extends t.BaseError{constructor({signature:i}){super("Invalid struct signature.",{details:i,metaMessages:["No properties exist."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidStructSignatureError"})}}return Ca.InvalidStructSignatureError=n,Ca}var hm={},BU;function TW(){if(BU)return hm;BU=1,Object.defineProperty(hm,"__esModule",{value:!0}),hm.CircularReferenceError=void 0;const t=Lp();class e extends t.BaseError{constructor({type:n}){super("Circular reference detected.",{metaMessages:[`Struct "${n}" is a circular reference.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"CircularReferenceError"})}}return hm.CircularReferenceError=e,hm}var os={},pm={},kU;function PW(){if(kU)return pm;kU=1,Object.defineProperty(pm,"__esModule",{value:!0}),pm.InvalidParenthesisError=void 0;const t=Lp();class e extends t.BaseError{constructor({current:n,depth:s}){super("Unbalanced parentheses.",{metaMessages:[`"${n.trim()}" has too many ${s>0?"opening":"closing"} parentheses.`],details:`Depth "${s}"`}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParenthesisError"})}}return pm.InvalidParenthesisError=e,pm}var Df={},jU;function R_e(){if(jU)return Df;jU=1,Object.defineProperty(Df,"__esModule",{value:!0}),Df.parameterCache=void 0,Df.getParameterCacheKey=t;function t(e,r,n){let s="";if(n)for(const i of Object.entries(n)){if(!i)continue;let o="";for(const a of i[1])o+=`[${a.type}${a.name?`:${a.name}`:""}]`;s+=`(${i[0]}{${o}})`}return r?`${r}:${e}${s}`:`${e}${s}`}return Df.parameterCache=new Map([["address",{type:"address"}],["bool",{type:"bool"}],["bytes",{type:"bytes"}],["bytes32",{type:"bytes32"}],["int",{type:"int256"}],["int256",{type:"int256"}],["string",{type:"string"}],["uint",{type:"uint256"}],["uint8",{type:"uint8"}],["uint16",{type:"uint16"}],["uint24",{type:"uint24"}],["uint32",{type:"uint32"}],["uint64",{type:"uint64"}],["uint96",{type:"uint96"}],["uint112",{type:"uint112"}],["uint160",{type:"uint160"}],["uint192",{type:"uint192"}],["uint256",{type:"uint256"}],["address owner",{type:"address",name:"owner"}],["address to",{type:"address",name:"to"}],["bool approved",{type:"bool",name:"approved"}],["bytes _data",{type:"bytes",name:"_data"}],["bytes data",{type:"bytes",name:"data"}],["bytes signature",{type:"bytes",name:"signature"}],["bytes32 hash",{type:"bytes32",name:"hash"}],["bytes32 r",{type:"bytes32",name:"r"}],["bytes32 root",{type:"bytes32",name:"root"}],["bytes32 s",{type:"bytes32",name:"s"}],["string name",{type:"string",name:"name"}],["string symbol",{type:"string",name:"symbol"}],["string tokenURI",{type:"string",name:"tokenURI"}],["uint tokenId",{type:"uint256",name:"tokenId"}],["uint8 v",{type:"uint8",name:"v"}],["uint256 balance",{type:"uint256",name:"balance"}],["uint256 tokenId",{type:"uint256",name:"tokenId"}],["uint256 value",{type:"uint256",name:"value"}],["event:address indexed from",{type:"address",name:"from",indexed:!0}],["event:address indexed to",{type:"address",name:"to",indexed:!0}],["event:uint indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}],["event:uint256 indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}]]),Df}var DU;function Tp(){if(DU)return os;DU=1,Object.defineProperty(os,"__esModule",{value:!0}),os.parseSignature=a,os.parseFunctionSignature=c,os.parseEventSignature=u,os.parseErrorSignature=l,os.parseConstructorSignature=d,os.parseFallbackSignature=f,os.parseAbiParameter=y,os.splitParameters=w,os.isSolidityType=I,os.isSolidityKeyword=E,os.isValidDataLocation=b;const t=KC(),e=ZC(),r=Q0(),n=XN(),s=PW(),i=R_e(),o=Fp();function a(m,_={}){if((0,o.isFunctionSignature)(m))return c(m,_);if((0,o.isEventSignature)(m))return u(m,_);if((0,o.isErrorSignature)(m))return l(m,_);if((0,o.isConstructorSignature)(m))return d(m,_);if((0,o.isFallbackSignature)(m))return f(m);if((0,o.isReceiveSignature)(m))return{type:"receive",stateMutability:"payable"};throw new n.UnknownSignatureError({signature:m})}function c(m,_={}){const O=(0,o.execFunctionSignature)(m);if(!O)throw new n.InvalidSignatureError({signature:m,type:"function"});const C=w(O.parameters),S=[],T=C.length;for(let R=0;R<T;R++)S.push(y(C[R],{modifiers:o.functionModifiers,structs:_,type:"function"}));const N=[];if(O.returns){const R=w(O.returns),B=R.length;for(let A=0;A<B;A++)N.push(y(R[A],{modifiers:o.functionModifiers,structs:_,type:"function"}))}return{name:O.name,type:"function",stateMutability:O.stateMutability??"nonpayable",inputs:S,outputs:N}}function u(m,_={}){const O=(0,o.execEventSignature)(m);if(!O)throw new n.InvalidSignatureError({signature:m,type:"event"});const C=w(O.parameters),S=[],T=C.length;for(let N=0;N<T;N++)S.push(y(C[N],{modifiers:o.eventModifiers,structs:_,type:"event"}));return{name:O.name,type:"event",inputs:S}}function l(m,_={}){const O=(0,o.execErrorSignature)(m);if(!O)throw new n.InvalidSignatureError({signature:m,type:"error"});const C=w(O.parameters),S=[],T=C.length;for(let N=0;N<T;N++)S.push(y(C[N],{structs:_,type:"error"}));return{name:O.name,type:"error",inputs:S}}function d(m,_={}){const O=(0,o.execConstructorSignature)(m);if(!O)throw new n.InvalidSignatureError({signature:m,type:"constructor"});const C=w(O.parameters),S=[],T=C.length;for(let N=0;N<T;N++)S.push(y(C[N],{structs:_,type:"constructor"}));return{type:"constructor",stateMutability:O.stateMutability??"nonpayable",inputs:S}}function f(m){const _=(0,o.execFallbackSignature)(m);if(!_)throw new n.InvalidSignatureError({signature:m,type:"fallback"});return{type:"fallback",stateMutability:_.stateMutability??"nonpayable"}}const g=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*(?:\spayable)?)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,h=/^\((?<type>.+?)\)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,p=/^u?int$/;function y(m,_){var k,U;const O=(0,i.getParameterCacheKey)(m,_==null?void 0:_.type,_==null?void 0:_.structs);if(i.parameterCache.has(O))return i.parameterCache.get(O);const C=t.isTupleRegex.test(m),S=(0,t.execTyped)(C?h:g,m);if(!S)throw new r.InvalidParameterError({param:m});if(S.name&&E(S.name))throw new r.SolidityProtectedKeywordError({param:m,name:S.name});const T=S.name?{name:S.name}:{},N=S.modifier==="indexed"?{indexed:!0}:{},R=(_==null?void 0:_.structs)??{};let B,A={};if(C){B="tuple";const x=w(S.type),j=[],D=x.length;for(let M=0;M<D;M++)j.push(y(x[M],{structs:R}));A={components:j}}else if(S.type in R)B="tuple",A={components:R[S.type]};else if(p.test(S.type))B=`${S.type}256`;else if(S.type==="address payable")B="address";else if(B=S.type,(_==null?void 0:_.type)!=="struct"&&!I(B))throw new e.UnknownSolidityTypeError({type:B});if(S.modifier){if(!((U=(k=_==null?void 0:_.modifiers)==null?void 0:k.has)!=null&&U.call(k,S.modifier)))throw new r.InvalidModifierError({param:m,type:_==null?void 0:_.type,modifier:S.modifier});
315if(o.functionModifiers.has(S.modifier)&&!b(B,!!S.array))throw new r.InvalidFunctionModifierError({param:m,type:_==null?void 0:_.type,modifier:S.modifier})}const P={type:`${B}${S.array??""}`,...T,...N,...A};return i.parameterCache.set(O,P),P}function w(m,_=[],O="",C=0){const S=m.trim().length;for(let T=0;T<S;T++){const N=m[T],R=m.slice(T+1);switch(N){case",":return C===0?w(R,[..._,O.trim()]):w(R,_,`${O}${N}`,C);case"(":return w(R,_,`${O}${N}`,C+1);case")":return w(R,_,`${O}${N}`,C-1);default:return w(R,_,`${O}${N}`,C)}}if(O==="")return _;if(C!==0)throw new s.InvalidParenthesisError({current:O,depth:C});return _.push(O.trim()),_}function I(m){return m==="address"||m==="bool"||m==="function"||m==="string"||t.bytesRegex.test(m)||t.integerRegex.test(m)}const v=/^(?:after|alias|anonymous|apply|auto|byte|calldata|case|catch|constant|copyof|default|defined|error|event|external|false|final|function|immutable|implements|in|indexed|inline|internal|let|mapping|match|memory|mutable|null|of|override|partial|private|promise|public|pure|reference|relocatable|return|returns|sizeof|static|storage|struct|super|supports|switch|this|true|try|typedef|typeof|var|view|virtual)$/;function E(m){return m==="address"||m==="bool"||m==="function"||m==="string"||m==="tuple"||t.bytesRegex.test(m)||t.integerRegex.test(m)||v.test(m)}function b(m,_){return _||m==="bytes"||m==="string"||m==="tuple"}return os}var UU;function YC(){if(UU)return UE;UU=1,Object.defineProperty(UE,"__esModule",{value:!0}),UE.parseStructs=a;const t=KC(),e=ZC(),r=Q0(),n=XN(),s=TW(),i=Fp(),o=Tp();function a(l){const d={},f=l.length;for(let y=0;y<f;y++){const w=l[y];if(!(0,i.isStructSignature)(w))continue;const I=(0,i.execStructSignature)(w);if(!I)throw new n.InvalidSignatureError({signature:w,type:"struct"});const v=I.properties.split(";"),E=[],b=v.length;for(let m=0;m<b;m++){const O=v[m].trim();if(!O)continue;const C=(0,o.parseAbiParameter)(O,{type:"struct"});E.push(C)}if(!E.length)throw new n.InvalidStructSignatureError({signature:w});d[I.name]=E}const g={},h=Object.entries(d),p=h.length;for(let y=0;y<p;y++){const[w,I]=h[y];g[w]=u(I,d)}return g}const c=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?$/;function u(l=[],d={},f=new Set){const g=[],h=l.length;for(let p=0;p<h;p++){const y=l[p];if(t.isTupleRegex.test(y.type))g.push(y);else{const I=(0,t.execTyped)(c,y.type);if(!(I!=null&&I.type))throw new r.InvalidAbiTypeParameterError({abiParameter:y});const{array:v,type:E}=I;if(E in d){if(f.has(E))throw new s.CircularReferenceError({type:E});g.push({...y,type:`tuple${v??""}`,components:u(d[E],d,new Set([...f,E]))})}else if((0,o.isSolidityType)(E))g.push(y);else throw new e.UnknownTypeError({type:E})}}return g}return UE}var MU;function B_e(){if(MU)return DE;MU=1,Object.defineProperty(DE,"__esModule",{value:!0}),DE.parseAbi=n;const t=Fp(),e=YC(),r=Tp();function n(s){const i=(0,e.parseStructs)(s),o=[],a=s.length;for(let c=0;c<a;c++){const u=s[c];(0,t.isStructSignature)(u)||o.push((0,r.parseSignature)(u,i))}return o}return DE}var ME={},$U;function k_e(){if($U)return ME;$U=1,Object.defineProperty(ME,"__esModule",{value:!0}),ME.parseAbiItem=s;const t=ZC(),e=Fp(),r=YC(),n=Tp();function s(i){let o;if(typeof i=="string")o=(0,n.parseSignature)(i);else{const a=(0,r.parseStructs)(i),c=i.length;for(let u=0;u<c;u++){const l=i[u];if(!(0,e.isStructSignature)(l)){o=(0,n.parseSignature)(l,a);break}}}if(!o)throw new t.InvalidAbiItemError({signature:i});return o}return ME}var $E={},LU;function j_e(){if(LU)return $E;LU=1,Object.defineProperty($E,"__esModule",{value:!0}),$E.parseAbiParameter=s;const t=Q0(),e=Fp(),r=YC(),n=Tp();function s(i){let o;if(typeof i=="string")o=(0,n.parseAbiParameter)(i,{modifiers:e.modifiers});else{const a=(0,r.parseStructs)(i),c=i.length;for(let u=0;u<c;u++){const l=i[u];if(!(0,e.isStructSignature)(l)){o=(0,n.parseAbiParameter)(l,{modifiers:e.modifiers,structs:a});break}}}if(!o)throw new t.InvalidAbiParameterError({param:i});return o}return $E}var LE={},FU;function D_e(){if(FU)return LE;FU=1,Object.defineProperty(LE,"__esModule",{value:!0}),LE.parseAbiParameters=i;const t=Q0(),e=Fp(),r=YC(),n=Tp(),s=Tp();function i(o){const a=[];
315if(typeof o=="string"){const c=(0,n.splitParameters)(o),u=c.length;for(let l=0;l<u;l++)a.push((0,s.parseAbiParameter)(c[l],{modifiers:e.modifiers}))}else{const c=(0,r.parseStructs)(o),u=o.length;for(let l=0;l<u;l++){const d=o[l];if((0,e.isStructSignature)(d))continue;const f=(0,n.splitParameters)(d),g=f.length;for(let h=0;h<g;h++)a.push((0,s.parseAbiParameter)(f[h],{modifiers:e.modifiers,structs:c}))}}if(a.length===0)throw new t.InvalidAbiParametersError({params:o});return a}return LE}var HU;function JC(){return HU||(HU=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.CircularReferenceError=t.InvalidParenthesisError=t.UnknownSignatureError=t.InvalidSignatureError=t.InvalidStructSignatureError=t.InvalidAbiParameterError=t.InvalidAbiParametersError=t.InvalidParameterError=t.SolidityProtectedKeywordError=t.InvalidModifierError=t.InvalidFunctionModifierError=t.InvalidAbiTypeParameterError=t.UnknownSolidityTypeError=t.InvalidAbiItemError=t.UnknownTypeError=t.parseAbiParameters=t.parseAbiParameter=t.parseAbiItem=t.parseAbi=t.formatAbiParameters=t.formatAbiParameter=t.formatAbiItem=t.formatAbi=t.narrow=t.BaseError=void 0;var e=Lp();Object.defineProperty(t,"BaseError",{enumerable:!0,get:function(){return e.BaseError}});var r=N_e();Object.defineProperty(t,"narrow",{enumerable:!0,get:function(){return r.narrow}});var n=x_e();Object.defineProperty(t,"formatAbi",{enumerable:!0,get:function(){return n.formatAbi}});var s=SW();Object.defineProperty(t,"formatAbiItem",{enumerable:!0,get:function(){return s.formatAbiItem}});var i=CW();Object.defineProperty(t,"formatAbiParameter",{enumerable:!0,get:function(){return i.formatAbiParameter}});var o=IW();Object.defineProperty(t,"formatAbiParameters",{enumerable:!0,get:function(){return o.formatAbiParameters}});var a=B_e();Object.defineProperty(t,"parseAbi",{enumerable:!0,get:function(){return a.parseAbi}});var c=k_e();Object.defineProperty(t,"parseAbiItem",{enumerable:!0,get:function(){return c.parseAbiItem}});var u=j_e();Object.defineProperty(t,"parseAbiParameter",{enumerable:!0,get:function(){return u.parseAbiParameter}});var l=D_e();Object.defineProperty(t,"parseAbiParameters",{enumerable:!0,get:function(){return l.parseAbiParameters}});var d=ZC();Object.defineProperty(t,"UnknownTypeError",{enumerable:!0,get:function(){return d.UnknownTypeError}}),Object.defineProperty(t,"InvalidAbiItemError",{enumerable:!0,get:function(){return d.InvalidAbiItemError}}),Object.defineProperty(t,"UnknownSolidityTypeError",{enumerable:!0,get:function(){return d.UnknownSolidityTypeError}});var f=Q0();Object.defineProperty(t,"InvalidAbiTypeParameterError",{enumerable:!0,get:function(){return f.InvalidAbiTypeParameterError}}),Object.defineProperty(t,"InvalidFunctionModifierError",{enumerable:!0,get:function(){return f.InvalidFunctionModifierError}}),Object.defineProperty(t,"InvalidModifierError",{enumerable:!0,get:function(){return f.InvalidModifierError}}),Object.defineProperty(t,"SolidityProtectedKeywordError",{enumerable:!0,get:function(){return f.SolidityProtectedKeywordError}}),Object.defineProperty(t,"InvalidParameterError",{enumerable:!0,get:function(){return f.InvalidParameterError}}),Object.defineProperty(t,"InvalidAbiParametersError",{enumerable:!0,get:function(){return f.InvalidAbiParametersError}}),Object.defineProperty(t,"InvalidAbiParameterError",{enumerable:!0,get:function(){return f.InvalidAbiParameterError}});var g=XN();Object.defineProperty(t,"InvalidStructSignatureError",{enumerable:!0,get:function(){return g.InvalidStructSignatureError}}),Object.defineProperty(t,"InvalidSignatureError",{enumerable:!0,get:function(){return g.InvalidSignatureError}}),Object.defineProperty(t,"UnknownSignatureError",{enumerable:!0,get:function(){return g.UnknownSignatureError}});var h=PW();Object.defineProperty(t,"InvalidParenthesisError",{enumerable:!0,get:function(){return h.InvalidParenthesisError}});var p=TW();Object.defineProperty(t,"CircularReferenceError",{enumerable:!0,get:function(){return p.CircularReferenceError}})}(MS)),MS}var jn={},Al={},Cl={},Dn={},wn={},qU;function OW(){if(qU)return wn;qU=1,Object.defineProperty(wn,"__esModule",{value:!0}),wn.SHA512_IV=wn.SHA384_IV=wn.SHA224_IV=wn.SHA256_IV=wn.HashMD=void 0,wn.setBigUint64=e,wn.Chi=r,wn.Maj=n;const t=Sp();function e(i,o,a,c){if(typeof i.setBigUint64=="function")return i.setBigUint64(o,a,
315c);const u=BigInt(32),l=BigInt(4294967295),d=Number(a>>u&l),f=Number(a&l),g=c?4:0,h=c?0:4;i.setUint32(o+g,d,c),i.setUint32(o+h,f,c)}function r(i,o,a){return i&o^~i&a}function n(i,o,a){return i&o^i&a^o&a}class s extends t.Hash{constructor(o,a,c,u){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=o,this.outputLen=a,this.padOffset=c,this.isLE=u,this.buffer=new Uint8Array(o),this.view=(0,t.createView)(this.buffer)}update(o){(0,t.aexists)(this),o=(0,t.toBytes)(o),(0,t.abytes)(o);const{view:a,buffer:c,blockLen:u}=this,l=o.length;for(let d=0;d<l;){const f=Math.min(u-this.pos,l-d);if(f===u){const g=(0,t.createView)(o);for(;u<=l-d;d+=u)this.process(g,d);continue}c.set(o.subarray(d,d+f),this.pos),this.pos+=f,d+=f,this.pos===u&&(this.process(a,0),this.pos=0)}return this.length+=o.length,this.roundClean(),this}digestInto(o){(0,t.aexists)(this),(0,t.aoutput)(o,this),this.finished=!0;const{buffer:a,view:c,blockLen:u,isLE:l}=this;let{pos:d}=this;a[d++]=128,(0,t.clean)(this.buffer.subarray(d)),this.padOffset>u-d&&(this.process(c,0),d=0);for(let y=d;y<u;y++)a[y]=0;e(c,u-8,BigInt(this.length*8),l),this.process(c,0);const f=(0,t.createView)(o),g=this.outputLen;if(g%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const h=g/4,p=this.get();if(h>p.length)throw new Error("_sha2: outputLen bigger than state");for(let y=0;y<h;y++)f.setUint32(4*y,p[y],l)}digest(){const{buffer:o,outputLen:a}=this;this.digestInto(o);const c=o.slice(0,a);return this.destroy(),c}_cloneInto(o){o||(o=new this.constructor),o.set(...this.get());const{blockLen:a,buffer:c,length:u,finished:l,destroyed:d,pos:f}=this;return o.destroyed=d,o.finished=l,o.length=u,o.pos=f,u%a&&o.buffer.set(c),o}clone(){return this._cloneInto()}}return wn.HashMD=s,wn.SHA256_IV=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),wn.SHA224_IV=Uint32Array.from([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]),wn.SHA384_IV=Uint32Array.from([3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]),wn.SHA512_IV=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209]),wn}var zU;function U_e(){if(zU)return Dn;zU=1,Object.defineProperty(Dn,"__esModule",{value:!0}),Dn.ripemd160=Dn.RIPEMD160=Dn.md5=Dn.MD5=Dn.sha1=Dn.SHA1=void 0;const t=OW(),e=Sp(),r=Uint32Array.from([1732584193,4023233417,2562383102,271733878,3285377520]),n=new Uint32Array(80);class s extends t.HashMD{constructor(){super(64,20,8,!1),this.A=r[0]|0,this.B=r[1]|0,this.C=r[2]|0,this.D=r[3]|0,this.E=r[4]|0}get(){const{A:C,B:S,C:T,D:N,E:R}=this;return[C,S,T,N,R]}set(C,S,T,N,R){this.A=C|0,this.B=S|0,this.C=T|0,this.D=N|0,this.E=R|0}process(C,S){for(let P=0;P<16;P++,S+=4)n[P]=C.getUint32(S,!1);for(let P=16;P<80;P++)n[P]=(0,e.rotl)(n[P-3]^n[P-8]^n[P-14]^n[P-16],1);let{A:T,B:N,C:R,D:B,E:A}=this;for(let P=0;P<80;P++){let k,U;P<20?(k=(0,t.Chi)(N,R,B),U=1518500249):P<40?(k=N^R^B,U=1859775393):P<60?(k=(0,t.Maj)(N,R,B),U=2400959708):(k=N^R^B,U=3395469782);const x=(0,e.rotl)(T,5)+k+A+U+n[P]|0;A=B,B=R,R=(0,e.rotl)(N,30),N=T,T=x}T=T+this.A|0,N=N+this.B|0,R=R+this.C|0,B=B+this.D|0,A=A+this.E|0,this.set(T,N,R,B,A)}roundClean(){(0,e.clean)(n)}destroy(){this.set(0,0,0,0,0),(0,e.clean)(this.buffer)}}Dn.SHA1=s,Dn.sha1=(0,e.createHasher)(()=>new s);const i=Math.pow(2,32),o=Array.from({length:64},(O,C)=>Math.floor(i*Math.abs(Math.sin(C+1)))),a=r.slice(0,4),c=new Uint32Array(16);class u extends t.HashMD{constructor(){super(64,16,8,!0),this.A=a[0]|0,this.B=a[1]|0,this.C=a[2]|0,this.D=a[3]|0}get(){const{A:C,B:S,C:T,D:N}=this;return[C,S,T,N]}set(C,S,T,N){this.A=C|0,this.B=S|0,this.C=T|0,this.D=N|0}process(C,S){for(let A=0;A<16;A++,S+=4)c[A]=C.getUint32(S,!0);let{A:T,B:N,C:R,D:B}=this;for(let A=0;A<64;A++){let P,k,U;A<16?(P=(0,t.Chi)(N,R,B),k=A,U=[7,12,17,22]):A<32?(P=(0,t.Chi)(B,N,R),k=(5*A+1)%16,U=[5,9,14,20]):A<48?(P=N^R^B,k=(3*A+5)%16,U=[4,11,16,23]):(P=R^(N|~B),k=7*A%16,U=[6,10,15,21]),P=P+T+o[A]+c[k],T=B,B=R,R=N,N=N+(0,e.rotl)(P,U[A%4])}T=T+this.A|0,N=N+this.B|0,R=R+this.C|0,B=B+this.D|0,this.set(T,N,R,B)}roundClean(){(0,e.clean)(c)}destroy(){this.set(0,0,0,0),(0,e.clean)(this.buffer)}}
315Dn.MD5=u,Dn.md5=(0,e.createHasher)(()=>new u);const l=Uint8Array.from([7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8]),d=Uint8Array.from(new Array(16).fill(0).map((O,C)=>C)),f=d.map(O=>(9*O+5)%16),g=(()=>{const S=[[d],[f]];for(let T=0;T<4;T++)for(let N of S)N.push(N[T].map(R=>l[R]));return S})(),h=g[0],p=g[1],y=[[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8],[12,13,11,15,6,9,9,7,12,15,11,13,7,8,7,7],[13,15,14,11,7,7,6,8,13,14,13,12,5,5,6,9],[14,11,12,14,8,6,5,5,15,12,15,14,9,9,8,6],[15,12,13,13,9,5,8,6,14,11,12,11,8,6,5,5]].map(O=>Uint8Array.from(O)),w=h.map((O,C)=>O.map(S=>y[C][S])),I=p.map((O,C)=>O.map(S=>y[C][S])),v=Uint32Array.from([0,1518500249,1859775393,2400959708,2840853838]),E=Uint32Array.from([1352829926,1548603684,1836072691,2053994217,0]);function b(O,C,S,T){return O===0?C^S^T:O===1?C&S|~C&T:O===2?(C|~S)^T:O===3?C&T|S&~T:C^(S|~T)}const m=new Uint32Array(16);class _ extends t.HashMD{constructor(){super(64,20,8,!0),this.h0=1732584193,this.h1=-271733879,this.h2=-1732584194,this.h3=271733878,this.h4=-1009589776}get(){const{h0:C,h1:S,h2:T,h3:N,h4:R}=this;return[C,S,T,N,R]}set(C,S,T,N,R){this.h0=C|0,this.h1=S|0,this.h2=T|0,this.h3=N|0,this.h4=R|0}process(C,S){for(let D=0;D<16;D++,S+=4)m[D]=C.getUint32(S,!0);let T=this.h0|0,N=T,R=this.h1|0,B=R,A=this.h2|0,P=A,k=this.h3|0,U=k,x=this.h4|0,j=x;for(let D=0;D<5;D++){const M=4-D,L=v[D],H=E[D],z=h[D],V=p[D],G=w[D],ee=I[D];for(let X=0;X<16;X++){const oe=(0,e.rotl)(T+b(D,R,A,k)+m[z[X]]+L,G[X])+x|0;T=x,x=k,k=(0,e.rotl)(A,10)|0,A=R,R=oe}for(let X=0;X<16;X++){const oe=(0,e.rotl)(N+b(M,B,P,U)+m[V[X]]+H,ee[X])+j|0;N=j,j=U,U=(0,e.rotl)(P,10)|0,P=B,B=oe}}this.set(this.h1+A+U|0,this.h2+k+j|0,this.h3+x+N|0,this.h4+T+B|0,this.h0+R+P|0)}roundClean(){(0,e.clean)(m)}destroy(){this.destroyed=!0,(0,e.clean)(this.buffer),this.set(0,0,0,0,0)}}return Dn.RIPEMD160=_,Dn.ripemd160=(0,e.createHasher)(()=>new _),Dn}var WU;function M_e(){if(WU)return Cl;WU=1,Object.defineProperty(Cl,"__esModule",{value:!0}),Cl.ripemd160=Cl.RIPEMD160=void 0;const t=U_e();return Cl.RIPEMD160=t.RIPEMD160,Cl.ripemd160=t.ripemd160,Cl}var Zt={},Qe={},VU;function NW(){if(VU)return Qe;VU=1,Object.defineProperty(Qe,"__esModule",{value:!0}),Qe.toBig=Qe.shrSL=Qe.shrSH=Qe.rotrSL=Qe.rotrSH=Qe.rotrBL=Qe.rotrBH=Qe.rotr32L=Qe.rotr32H=Qe.rotlSL=Qe.rotlSH=Qe.rotlBL=Qe.rotlBH=Qe.add5L=Qe.add5H=Qe.add4L=Qe.add4H=Qe.add3L=Qe.add3H=void 0,Qe.add=w,Qe.fromBig=r,Qe.split=n;const t=BigInt(2**32-1),e=BigInt(32);function r(C,S=!1){return S?{h:Number(C&t),l:Number(C>>e&t)}:{h:Number(C>>e&t)|0,l:Number(C&t)|0}}function n(C,S=!1){const T=C.length;let N=new Uint32Array(T),R=new Uint32Array(T);for(let B=0;B<T;B++){const{h:A,l:P}=r(C[B],S);[N[B],R[B]]=[A,P]}return[N,R]}const s=(C,S)=>BigInt(C>>>0)<<e|BigInt(S>>>0);Qe.toBig=s;const i=(C,S,T)=>C>>>T;Qe.shrSH=i;const o=(C,S,T)=>C<<32-T|S>>>T;Qe.shrSL=o;const a=(C,S,T)=>C>>>T|S<<32-T;Qe.rotrSH=a;const c=(C,S,T)=>C<<32-T|S>>>T;Qe.rotrSL=c;const u=(C,S,T)=>C<<64-T|S>>>T-32;Qe.rotrBH=u;const l=(C,S,T)=>C>>>T-32|S<<64-T;Qe.rotrBL=l;const d=(C,S)=>S;Qe.rotr32H=d;const f=(C,S)=>C;Qe.rotr32L=f;const g=(C,S,T)=>C<<T|S>>>32-T;Qe.rotlSH=g;const h=(C,S,T)=>S<<T|C>>>32-T;Qe.rotlSL=h;const p=(C,S,T)=>S<<T-32|C>>>64-T;Qe.rotlBH=p;const y=(C,S,T)=>C<<T-32|S>>>64-T;Qe.rotlBL=y;function w(C,S,T,N){const R=(S>>>0)+(N>>>0);return{h:C+T+(R/2**32|0)|0,l:R|0}}const I=(C,S,T)=>(C>>>0)+(S>>>0)+(T>>>0);Qe.add3L=I;const v=(C,S,T,N)=>S+T+N+(C/2**32|0)|0;Qe.add3H=v;const E=(C,S,T,N)=>(C>>>0)+(S>>>0)+(T>>>0)+(N>>>0);Qe.add4L=E;const b=(C,S,T,N,R)=>S+T+N+R+(C/2**32|0)|0;Qe.add4H=b;const m=(C,S,T,N,R)=>(C>>>0)+(S>>>0)+(T>>>0)+(N>>>0)+(R>>>0);Qe.add5L=m;const _=(C,S,T,N,R,B)=>S+T+N+R+B+(C/2**32|0)|0;Qe.add5H=_;const O={fromBig:r,split:n,toBig:s,shrSH:i,shrSL:o,rotrSH:a,rotrSL:c,rotrBH:u,rotrBL:l,rotr32H:d,rotr32L:f,rotlSH:g,rotlSL:h,rotlBH:p,rotlBL:y,add:w,add3L:I,add3H:v,add4L:E,add4H:b,add5H:_,add5L:m};return Qe.default=O,Qe}var GU;function $_e(){if(GU)return Zt;GU=1,Object.defineProperty(Zt,"__esModule",{value:!0}),Zt.shake256=Zt.shake128=Zt.keccak_512=Zt.keccak_384=Zt.keccak_256=Zt.keccak_224=Zt.sha3_512=Zt.sha3_384=Zt.sha3_256=Zt.sha3_224=Zt.Keccak=void 0,Zt.keccakP=y;const t=NW(),e=Sp(),r=BigInt(0),n=BigInt(1),s=BigInt(2),i=BigInt(7),o=BigInt(256),a=BigInt(113),c=[],u=[],l=[];for(let E=0,b=n,m=1,_=0;E<24;E++){[m,_]=[_,(2*m+3*_)%5],c.push(2*(5*_+m)),u.push((E+1)*(E+2)/2%64);let O=r;for(let C=0;C<7;C++)b=(b<<n^(b>>i)*a)%o,b&s&&(O^=n<<(n<<BigInt(C))-n);l.push(O)}const d=(0,t.split)(l,!0),f=d[0],g=d[1],h=(E,b,m)=>m>32?(0,t.rotlBH)(E,b,m):(0,t.rotlSH)(E,b,m),p=(E,b,m)=>m>32?(0,t.rotlBL)(E,b,m):(0,t.rotlSL)(E,b,m);function y(E,b=24){const m=new Uint32Array(10);for(let _=24-b;_<24;_++){for(let S=0;S<10;S++)m[S]=E[S]^E[S+10]^E[S+20]^E[S+30]^E[S+40];for(let S=0;S<10;S+=2){const T=(S+8)%10,N=(S+2)%10,R=m[N],B=m[N+1],A=h(R,B,1)^m[T],P=p(R,B,1)^m[T+1];for(let k=0;k<50;k+=10)E[S+k]^=A,E[S+k+1]^=P}let O=E[2],C=E[3];for(let S=0;S<24;S++){const T=u[S],N=h(O,C,T),R=p(O,C,T),B=c[S];O=E[B],C=E[B+1],E[B]=N,E[B+1]=R}for(let S=0;S<50;S+=10){for(let T=0;T<10;T++)m[T]=E[S+T];for(let T=0;T<10;T++)E[S+T]^=~m[(T+2)%10]&m[(T+4)%10]}E[0]^=f[_],E[1]^=g[_]}(0,e.clean)(m)}class w extends e.Hash{constructor(b,m,_,O=!1,C=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=b,this.suffix=m,this.outputLen=_,this.enableXOF=O,this.rounds=C,(0,e.anumber)(_),!(0<b&&b<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=(0,e.u32)(this.state)}clone(){return this._cloneInto()}keccak(){(0,e.swap32IfBE)(this.state32),y(this.state32,this.rounds),(0,e.swap32IfBE)(this.state32),this.posOut=0,this.pos=0}update(b){(0,e.aexists)(this),b=(0,e.toBytes)(b),(0,e.abytes)(b);const{blockLen:m,state:_}=this,O=b.length;for(let C=0;C<O;){const S=Math.min(m-this.pos,O-C);for(let T=0;T<S;T++)_[this.pos++]^=b[C++];this.pos===m&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:b,suffix:m,pos:_,blockLen:O}=this;b[_]^=m,(m&128)!==0&&_===O-1&&this.keccak(),b[O-1]^=128,this.keccak()}writeInto(b){(0,e.aexists)(this,!1),(0,e.abytes)(b),this.finish();const m=this.state,{blockLen:_}=this;for(let O=0,C=b.length;O<C;){this.posOut>=_&&this.keccak();const S=Math.min(_-this.posOut,C-O);b.set(m.subarray(this.posOut,this.posOut+S),O),this.posOut+=S,O+=S}return b}xofInto(b){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(b)}xof(b){return(0,e.anumber)(b),this.xofInto(new Uint8Array(b))}digestInto(b){if((0,e.aoutput)(b,this),this.finished)throw new Error("digest() was already called");return this.writeInto(b),this.destroy(),b}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,(0,e.clean)(this.state)}_cloneInto(b){const{blockLen:m,suffix:_,outputLen:O,rounds:C,enableXOF:S}=this;return b||(b=new w(m,_,O,S,C)),b.state32.set(this.state32),b.pos=this.pos,b.posOut=this.posOut,b.finished=this.finished,b.rounds=C,b.suffix=_,b.outputLen=O,b.enableXOF=S,b.destroyed=this.destroyed,b}}Zt.Keccak=w;const I=(E,b,m)=>(0,e.createHasher)(()=>new w(b,E,m));Zt.sha3_224=I(6,144,224/8),Zt.sha3_256=I(6,136,256/8),Zt.sha3_384=I(6,104,384/8),Zt.sha3_512=I(6,72,512/8),Zt.keccak_224=I(1,144,224/8),Zt.keccak_256=I(1,136,256/8),Zt.keccak_384=I(1,
315104,384/8),Zt.keccak_512=I(1,72,512/8);const v=(E,b,m)=>(0,e.createXOFer)((_={})=>new w(b,E,_.dkLen===void 0?m:_.dkLen,!0));return Zt.shake128=v(31,168,128/8),Zt.shake256=v(31,136,256/8),Zt}var Si={},qt={},KU;function L_e(){if(KU)return qt;KU=1,Object.defineProperty(qt,"__esModule",{value:!0}),qt.sha512_224=qt.sha512_256=qt.sha384=qt.sha512=qt.sha224=qt.sha256=qt.SHA512_256=qt.SHA512_224=qt.SHA384=qt.SHA512=qt.SHA224=qt.SHA256=void 0;const t=OW(),e=NW(),r=Sp(),n=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),s=new Uint32Array(64);class i extends t.HashMD{constructor(v=32){super(64,v,8,!1),this.A=t.SHA256_IV[0]|0,this.B=t.SHA256_IV[1]|0,this.C=t.SHA256_IV[2]|0,this.D=t.SHA256_IV[3]|0,this.E=t.SHA256_IV[4]|0,this.F=t.SHA256_IV[5]|0,this.G=t.SHA256_IV[6]|0,this.H=t.SHA256_IV[7]|0}get(){const{A:v,B:E,C:b,D:m,E:_,F:O,G:C,H:S}=this;return[v,E,b,m,_,O,C,S]}set(v,E,b,m,_,O,C,S){this.A=v|0,this.B=E|0,this.C=b|0,this.D=m|0,this.E=_|0,this.F=O|0,this.G=C|0,this.H=S|0}process(v,E){for(let R=0;R<16;R++,E+=4)s[R]=v.getUint32(E,!1);for(let R=16;R<64;R++){const B=s[R-15],A=s[R-2],P=(0,r.rotr)(B,7)^(0,r.rotr)(B,18)^B>>>3,k=(0,r.rotr)(A,17)^(0,r.rotr)(A,19)^A>>>10;s[R]=k+s[R-7]+P+s[R-16]|0}let{A:b,B:m,C:_,D:O,E:C,F:S,G:T,H:N}=this;for(let R=0;R<64;R++){const B=(0,r.rotr)(C,6)^(0,r.rotr)(C,11)^(0,r.rotr)(C,25),A=N+B+(0,t.Chi)(C,S,T)+n[R]+s[R]|0,k=((0,r.rotr)(b,2)^(0,r.rotr)(b,13)^(0,r.rotr)(b,22))+(0,t.Maj)(b,m,_)|0;N=T,T=S,S=C,C=O+A|0,O=_,_=m,m=b,b=A+k|0}b=b+this.A|0,m=m+this.B|0,_=_+this.C|0,O=O+this.D|0,C=C+this.E|0,S=S+this.F|0,T=T+this.G|0,N=N+this.H|0,this.set(b,m,_,O,C,S,T,N)}roundClean(){(0,r.clean)(s)}destroy(){this.set(0,0,0,0,0,0,0,0),(0,r.clean)(this.buffer)}}qt.SHA256=i;class o extends i{constructor(){super(28),this.A=t.SHA224_IV[0]|0,this.B=t.SHA224_IV[1]|0,this.C=t.SHA224_IV[2]|0,this.D=t.SHA224_IV[3]|0,this.E=t.SHA224_IV[4]|0,this.F=t.SHA224_IV[5]|0,this.G=t.SHA224_IV[6]|0,this.H=t.SHA224_IV[7]|0}}qt.SHA224=o;const a=e.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e3585
3155771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(I=>BigInt(I))),c=a[0],u=a[1],l=new Uint32Array(80),d=new Uint32Array(80);class f extends t.HashMD{constructor(v=64){super(128,v,16,!1),this.Ah=t.SHA512_IV[0]|0,this.Al=t.SHA512_IV[1]|0,this.Bh=t.SHA512_IV[2]|0,this.Bl=t.SHA512_IV[3]|0,this.Ch=t.SHA512_IV[4]|0,this.Cl=t.SHA512_IV[5]|0,this.Dh=t.SHA512_IV[6]|0,this.Dl=t.SHA512_IV[7]|0,this.Eh=t.SHA512_IV[8]|0,this.El=t.SHA512_IV[9]|0,this.Fh=t.SHA512_IV[10]|0,this.Fl=t.SHA512_IV[11]|0,this.Gh=t.SHA512_IV[12]|0,this.Gl=t.SHA512_IV[13]|0,this.Hh=t.SHA512_IV[14]|0,this.Hl=t.SHA512_IV[15]|0}get(){const{Ah:v,Al:E,Bh:b,Bl:m,Ch:_,Cl:O,Dh:C,Dl:S,Eh:T,El:N,Fh:R,Fl:B,Gh:A,Gl:P,Hh:k,Hl:U}=this;return[v,E,b,m,_,O,C,S,T,N,R,B,A,P,k,U]}set(v,E,b,m,_,O,C,S,T,N,R,B,A,P,k,U){this.Ah=v|0,this.Al=E|0,this.Bh=b|0,this.Bl=m|0,this.Ch=_|0,this.Cl=O|0,this.Dh=C|0,this.Dl=S|0,this.Eh=T|0,this.El=N|0,this.Fh=R|0,this.Fl=B|0,this.Gh=A|0,this.Gl=P|0,this.Hh=k|0,this.Hl=U|0}process(v,E){for(let D=0;D<16;D++,E+=4)l[D]=v.getUint32(E),d[D]=v.getUint32(E+=4);for(let D=16;D<80;D++){const M=l[D-15]|0,L=d[D-15]|0,H=e.rotrSH(M,L,1)^e.rotrSH(M,L,8)^e.shrSH(M,L,7),z=e.rotrSL(M,L,1)^e.rotrSL(M,L,8)^e.shrSL(M,L,7),V=l[D-2]|0,G=d[D-2]|0,ee=e.rotrSH(V,G,19)^e.rotrBH(V,G,61)^e.shrSH(V,G,6),X=e.rotrSL(V,G,19)^e.rotrBL(V,G,61)^e.shrSL(V,G,6),oe=e.add4L(z,X,d[D-7],d[D-16]),te=e.add4H(oe,H,ee,l[D-7],l[D-16]);l[D]=te|0,d[D]=oe|0}let{Ah:b,Al:m,Bh:_,Bl:O,Ch:C,Cl:S,Dh:T,Dl:N,Eh:R,El:B,Fh:A,Fl:P,Gh:k,Gl:U,Hh:x,Hl:j}=this;for(let D=0;D<80;D++){const M=e.rotrSH(R,B,14)^e.rotrSH(R,B,18)^e.rotrBH(R,B,41),L=e.rotrSL(R,B,14)^e.rotrSL(R,B,18)^e.rotrBL(R,B,41),H=R&A^~R&k,z=B&P^~B&U,V=e.add5L(j,L,z,u[D],d[D]),G=e.add5H(V,x,M,H,c[D],l[D]),ee=V|0,X=e.rotrSH(b,m,28)^e.rotrBH(b,m,34)^e.rotrBH(b,m,39),oe=e.rotrSL(b,m,28)^e.rotrBL(b,m,34)^e.rotrBL(b,m,39),te=b&_^b&C^_&C,fe=m&O^m&S^O&S;x=k|0,j=U|0,k=A|0,U=P|0,A=R|0,P=B|0,{h:R,l:B}=e.add(T|0,N|0,G|0,ee|0),T=C|0,N=S|0,C=_|0,S=O|0,_=b|0,O=m|0;const Se=e.add3L(ee,oe,fe);b=e.add3H(Se,G,X,te),m=Se|0}({h:b,l:m}=e.add(this.Ah|0,this.Al|0,b|0,m|0)),{h:_,l:O}=e.add(this.Bh|0,this.Bl|0,_|0,O|0),{h:C,l:S}=e.add(this.Ch|0,this.Cl|0,C|0,S|0),{h:T,l:N}=e.add(this.Dh|0,this.Dl|0,T|0,N|0),{h:R,l:B}=e.add(this.Eh|0,this.El|0,R|0,B|0),{h:A,l:P}=e.add(this.Fh|0,this.Fl|0,A|0,P|0),{h:k,l:U}=e.add(this.Gh|0,this.Gl|0,k|0,U|0),{h:x,l:j}=e.add(this.Hh|0,this.Hl|0,x|0,j|0),this.set(b,m,_,O,C,S,T,N,R,B,A,P,k,U,x,j)}roundClean(){(0,r.clean)(l,d)}destroy(){(0,r.clean)(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}qt.SHA512=f;class g extends f{constructor(){super(48),this.Ah=t.SHA384_IV[0]|0,this.Al=t.SHA384_IV[1]|0,this.Bh=t.SHA384_IV[2]|0,this.Bl=t.SHA384_IV[3]|0,this.Ch=t.SHA384_IV[4]|0,this.Cl=t.SHA384_IV[5]|0,this.Dh=t.SHA384_IV[6]|0,this.Dl=t.SHA384_IV[7]|0,this.Eh=t.SHA384_IV[8]|0,this.El=t.SHA384_IV[9]|0,this.Fh=t.SHA384_IV[10]|0,this.Fl=t.SHA384_IV[11]|0,this.Gh=t.SHA384_IV[12]|0,this.Gl=t.SHA384_IV[13]|0,this.Hh=t.SHA384_IV[14]|0,this.Hl=t.SHA384_IV[15]|0}}qt.SHA384=g;const h=Uint32Array.from([2352822216,424955298,1944164710,2312950998,502970286,855612546,1738396948,1479516111,258812777,2077511080,2011393907,79989058,1067287976,1780299464,286451373,2446758561]),p=Uint32Array.from([573645204,4230739756,2673172387,3360449730,596883563,1867755857,2520282905,1497426621,2519219938,2827943907,3193839141,1401305490,721525244,746961066,246885852,2177182882]);class y extends f{constructor(){super(28),this.Ah=h[0]|0,this.Al=h[1]|0,this.Bh=h[2]|0,this.Bl=h[3]|0,this.Ch=h[4]|0,this.Cl=h[5]|0,this.Dh=h[6]|0,this.Dl=h[7]|0,this.Eh=h[8]|0,this.El=h[9]|0,this.Fh=h[10]|0,this.Fl=h[11]|0,this.Gh=h[12]|0,this.Gl=h[13]|0,this.Hh=h[14]|0,this.Hl=h[15]|0}}qt.SHA512_224=y;class w extends f{constructor(){super(32),this.Ah=p[0]|0,this.Al=p[1]|0,this.Bh=p[2]|0,this.Bl=p[3]|0,this.Ch=p[4]|0,this.Cl=p[5]|0,this.Dh=p[6]|0,this.Dl=p[7]|0,this.Eh=p[8]|0,this.El=p[9]|0,this.Fh=p[10]|0,this.Fl=p[11]|0,this.Gh=p[12]|0,this.Gl=p[13]|0,this.Hh=p[14]|0,this.Hl=p[15]|0}}return qt.SHA512_256=w,qt.sha256=(0,r.createHasher)(()=>new i),qt.sha224=(0,r.createHasher)(()=>new o),qt.sha512=(0,r.createHasher)(()=>new f),qt.sha384=(0,r.createHasher)(()=>new g),qt.sha512_256=(0,r.createHasher)(()=>new w),qt.sha512_224=(0,r.createHasher)(()=>new y),qt}var ZU;function F_e(){if(ZU)return Si;ZU=1,Object.defineProperty(Si,"__esModule",{value:!0}),Si.sha224=Si.SHA224=Si.sha256=Si.SHA256=void 0;const t=L_e();return Si.SHA256=t.SHA256,Si.sha256=t.sha256,Si.SHA224=t.SHA224,Si.sha224=t.sha224,Si}var YU;function xW(){if(YU)return Al;
315YU=1,Object.defineProperty(Al,"__esModule",{value:!0}),Al.keccak256=i,Al.ripemd160=o,Al.sha256=a,Al.validate=c;const t=M_e(),e=$_e(),r=F_e(),n=of(),s=so();function i(u,l={}){const{as:d=typeof u=="string"?"Hex":"Bytes"}=l,f=(0,e.keccak_256)(n.from(u));return d==="Bytes"?f:s.fromBytes(f)}function o(u,l={}){const{as:d=typeof u=="string"?"Hex":"Bytes"}=l,f=(0,t.ripemd160)(n.from(u));return d==="Bytes"?f:s.fromBytes(f)}function a(u,l={}){const{as:d=typeof u=="string"?"Hex":"Bytes"}=l,f=(0,r.sha256)(n.from(u));return d==="Bytes"?f:s.fromBytes(f)}function c(u){return s.validate(u)&&s.size(u)===32}return Al}var Uf={},Un={},Mf={},gm={},JU;function H_e(){if(JU)return gm;JU=1,Object.defineProperty(gm,"__esModule",{value:!0}),gm.LruMap=void 0;class t extends Map{constructor(r){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=r}get(r){const n=super.get(r);return super.has(r)&&n!==void 0&&(this.delete(r),super.set(r,n)),n}set(r,n){if(super.set(r,n),this.maxSize&&this.size>this.maxSize){const s=this.keys().next().value;s&&this.delete(s)}return this}}return gm.LruMap=t,gm}var QU;function q_e(){if(QU)return Mf;QU=1,Object.defineProperty(Mf,"__esModule",{value:!0}),Mf.checksum=void 0,Mf.clear=r;const t=H_e(),e={checksum:new t.LruMap(8192)};Mf.checksum=e.checksum;function r(){for(const n of Object.values(e))n.clear()}return Mf}var vr={},XU;function z_e(){if(XU)return vr;XU=1,Object.defineProperty(vr,"__esModule",{value:!0}),vr.InvalidSerializedSizeError=vr.InvalidUncompressedPrefixError=vr.InvalidCompressedPrefixError=vr.InvalidPrefixError=vr.InvalidError=void 0,vr.assert=s,vr.compress=i,vr.from=o,vr.fromBytes=a,vr.fromHex=c,vr.toBytes=u,vr.toHex=l,vr.validate=d;const t=of(),e=vc(),r=so(),n=QN();function s(w,I={}){const{compressed:v}=I,{prefix:E,x:b,y:m}=w;if(v===!1||typeof b=="bigint"&&typeof m=="bigint"){if(E!==4)throw new g({prefix:E,cause:new p});return}if(v===!0||typeof b=="bigint"&&typeof m>"u"){if(E!==3&&E!==2)throw new g({prefix:E,cause:new h});return}throw new f({publicKey:w})}function i(w){const{x:I,y:v}=w;return{prefix:v%2n===0n?2:3,x:I}}function o(w){const I=(()=>{if(r.validate(w))return c(w);if(t.validate(w))return a(w);const{prefix:v,x:E,y:b}=w;return typeof E=="bigint"&&typeof b=="bigint"?{prefix:v??4,x:E,y:b}:{prefix:v,x:E}})();return s(I),I}function a(w){return c(r.fromBytes(w))}function c(w){if(w.length!==132&&w.length!==130&&w.length!==68)throw new y({publicKey:w});if(w.length===130){const E=BigInt(r.slice(w,0,32)),b=BigInt(r.slice(w,32,64));return{prefix:4,x:E,y:b}}if(w.length===132){const E=Number(r.slice(w,0,1)),b=BigInt(r.slice(w,1,33)),m=BigInt(r.slice(w,33,65));return{prefix:E,x:b,y:m}}const I=Number(r.slice(w,0,1)),v=BigInt(r.slice(w,1,33));return{prefix:I,x:v}}function u(w,I={}){return t.fromHex(l(w,I))}function l(w,I={}){s(w);const{prefix:v,x:E,y:b}=w,{includePrefix:m=!0}=I;return r.concat(m?r.fromNumber(v,{size:1}):"0x",r.fromNumber(E,{size:32}),typeof b=="bigint"?r.fromNumber(b,{size:32}):"0x")}function d(w,I={}){try{return s(w,I),!0}catch{return!1}}class f extends e.BaseError{constructor({publicKey:I}){super(`Value \`${n.stringify(I)}\` is not a valid public key.`,{metaMessages:["Public key must contain:","- an `x` and `prefix` value (compressed)","- an `x`, `y`, and `prefix` value (uncompressed)"]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PublicKey.InvalidError"})}}vr.InvalidError=f;class g extends e.BaseError{constructor({prefix:I,cause:v}){super(`Prefix "${I}" is invalid.`,{cause:v}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PublicKey.InvalidPrefixError"})}}vr.InvalidPrefixError=g;class h extends e.BaseError{constructor(){super("Prefix must be 2 or 3 for compressed public keys."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PublicKey.InvalidCompressedPrefixError"})}}vr.InvalidCompressedPrefixError=h;class p extends e.BaseError{constructor(){super("Prefix must be 4 for uncompressed public keys."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PublicKey.InvalidUncompressedPrefixError"})}}vr.InvalidUncompressedPrefixError=p;class y extends e.BaseError{constructor({publicKey:I}){super(`Value \`${I}
315\` is an invalid public key size.`,{metaMessages:["Expected: 33 bytes (compressed + prefix), 64 bytes (uncompressed) or 65 bytes (uncompressed + prefix).",`Received ${r.size(r.from(I))} bytes.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PublicKey.InvalidSerializedSizeError"})}}return vr.InvalidSerializedSizeError=y,vr}var eM;function ex(){if(eM)return Un;eM=1,Object.defineProperty(Un,"__esModule",{value:!0}),Un.InvalidChecksumError=Un.InvalidInputError=Un.InvalidAddressError=void 0,Un.assert=o,Un.checksum=a,Un.from=c,Un.fromPublicKey=u,Un.isEqual=l,Un.validate=d;const t=of(),e=q_e(),r=vc(),n=xW(),s=z_e(),i=/^0x[a-fA-F0-9]{40}$/;function o(p,y={}){const{strict:w=!0}=y;if(!i.test(p))throw new f({address:p,cause:new g});if(w){if(p.toLowerCase()===p)return;if(a(p)!==p)throw new f({address:p,cause:new h})}}function a(p){if(e.checksum.has(p))return e.checksum.get(p);o(p,{strict:!1});const y=p.substring(2).toLowerCase(),w=n.keccak256(t.fromString(y),{as:"Bytes"}),I=y.split("");for(let E=0;E<40;E+=2)w[E>>1]>>4>=8&&I[E]&&(I[E]=I[E].toUpperCase()),(w[E>>1]&15)>=8&&I[E+1]&&(I[E+1]=I[E+1].toUpperCase());const v=`0x${I.join("")}`;return e.checksum.set(p,v),v}function c(p,y={}){const{checksum:w=!1}=y;return o(p),w?a(p):p}function u(p,y={}){const w=n.keccak256(`0x${s.toHex(p).slice(4)}`).substring(26);return c(`0x${w}`,y)}function l(p,y){return o(p,{strict:!1}),o(y,{strict:!1}),p.toLowerCase()===y.toLowerCase()}function d(p,y={}){const{strict:w=!0}=y??{};try{return o(p,{strict:w}),!0}catch{return!1}}class f extends r.BaseError{constructor({address:y,cause:w}){super(`Address "${y}" is invalid.`,{cause:w}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidAddressError"})}}Un.InvalidAddressError=f;class g extends r.BaseError{constructor(){super("Address is not a 20 byte (40 hexadecimal character) value."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidInputError"})}}Un.InvalidInputError=g;class h extends r.BaseError{constructor(){super("Address does not match its checksum counterpart."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidChecksumError"})}}return Un.InvalidChecksumError=h,Un}var tM;function W_e(){if(tM)return Uf;tM=1,Object.defineProperty(Uf,"__esModule",{value:!0}),Uf.normalizeSignature=r,Uf.isArgOfType=n,Uf.getAmbiguousTypes=s;const t=ex(),e=vc();function r(i){let o=!0,a="",c=0,u="",l=!1;for(let d=0;d<i.length;d++){const f=i[d];if(["(",")",","].includes(f)&&(o=!0),f==="("&&c++,f===")"&&c--,!!o){if(c===0){if(f===" "&&["event","function","error",""].includes(u))u="";else if(u+=f,f===")"){l=!0;break}continue}if(f===" "){i[d-1]!==","&&a!==","&&a!==",("&&(a="",o=!1);continue}u+=f,a+=f}}if(!l)throw new e.BaseError("Unable to normalize signature.");return u}function n(i,o){const a=typeof i,c=o.type;switch(c){case"address":return t.validate(i,{strict:!1});case"bool":return a==="boolean";case"function":return a==="string";case"string":return a==="string";default:return c==="tuple"&&"components"in o?Object.values(o.components).every((u,l)=>n(Object.values(i)[l],u)):/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(c)?a==="number"||a==="bigint":/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(c)?a==="string"||i instanceof Uint8Array:/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(c)?Array.isArray(i)&&i.every(u=>n(u,{...o,type:c.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function s(i,o,a){for(const c in i){const u=i[c],l=o[c];if(u.type==="tuple"&&l.type==="tuple"&&"components"in u&&"components"in l)return s(u.components,l.components,a[c]);const d=[u.type,l.type];if(d.includes("address")&&d.includes("bytes20")?!0:d.includes("address")&&d.includes("string")?t.validate(a[c],{strict:!1}):d.includes("address")&&d.includes("bytes")?t.validate(a[c],{strict:!1}):!1)return d}}return Uf}var rM;function RW(){if(rM)return jn;rM=1,Object.defineProperty(jn,"__esModule",{value:!0}),jn.InvalidSelectorSizeError=jn.NotFoundError=jn.AmbiguityError=void 0,jn.format=i,jn.from=o,jn.fromAbi=a,jn.getSelector=c,jn.getSignature=u,jn.getSignatureHash=l;const t=JC(),e=vc(),r=xW(),n=so(),s=W_e();function i(h){return t.formatAbiItem(h)}function o(h,p={}){const{prepare:y=!0}=p,w=Array.isArray(h)||typeof h=="string"?t.parseAbiItem(h):h;return{...w,...y?{hash:l(w)}:{}}}function a(h,p,y){const{args:w=[],prepare:I=!0}=y??{},v=n.validate(p,{strict:!1}),E=h.filter(_=>v?_.type==="function"||_.type==="error"?c(_)===n.slice(p,0,4):_.type==="event"?l(_)===
315p:!1:"name"in _&&_.name===p);if(E.length===0)throw new f({name:p});if(E.length===1)return{...E[0],...I?{hash:l(E[0])}:{}};let b;for(const _ of E){if(!("inputs"in _))continue;if(!w||w.length===0){if(!_.inputs||_.inputs.length===0)return{..._,...I?{hash:l(_)}:{}};continue}if(!_.inputs||_.inputs.length===0||_.inputs.length!==w.length)continue;if(w.every((C,S)=>{const T="inputs"in _&&_.inputs[S];return T?s.isArgOfType(C,T):!1})){if(b&&"inputs"in b&&b.inputs){const C=s.getAmbiguousTypes(_.inputs,b.inputs,w);if(C)throw new d({abiItem:_,type:C[0]},{abiItem:b,type:C[1]})}b=_}}const m=(()=>{if(b)return b;const[_,...O]=E;return{..._,overloads:O}})();if(!m)throw new f({name:p});return{...m,...I?{hash:l(m)}:{}}}function c(h){return n.slice(l(h),0,4)}function u(h){const p=typeof h=="string"?h:t.formatAbiItem(h);return s.normalizeSignature(p)}function l(h){return typeof h!="string"&&"hash"in h&&h.hash?h.hash:r.keccak256(n.fromString(u(h)))}class d extends e.BaseError{constructor(p,y){super("Found ambiguous types in overloaded ABI Items.",{metaMessages:[`\`${p.type}\` in \`${s.normalizeSignature(t.formatAbiItem(p.abiItem))}\`, and`,`\`${y.type}\` in \`${s.normalizeSignature(t.formatAbiItem(y.abiItem))}\``,"","These types encode differently and cannot be distinguished at runtime.","Remove one of the ambiguous items in the ABI."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiItem.AmbiguityError"})}}jn.AmbiguityError=d;class f extends e.BaseError{constructor({name:p,data:y,type:w="item"}){const I=p?` with name "${p}"`:y?` with data "${y}"`:"";super(`ABI ${w}${I} not found.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiItem.NotFoundError"})}}jn.NotFoundError=f;class g extends e.BaseError{constructor({data:p}){super(`Selector size is invalid. Expected 4 bytes. Received ${n.size(p)} bytes ("${p}").`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiItem.InvalidSelectorSizeError"})}}return jn.InvalidSelectorSizeError=g,jn}var dr={},Z={},nM;function BW(){return nM||(nM=1,Object.defineProperty(Z,"__esModule",{value:!0}),Z.minInt120=Z.minInt112=Z.minInt104=Z.minInt96=Z.minInt88=Z.minInt80=Z.minInt72=Z.minInt64=Z.minInt56=Z.minInt48=Z.minInt40=Z.minInt32=Z.minInt24=Z.minInt16=Z.minInt8=Z.maxInt256=Z.maxInt248=Z.maxInt240=Z.maxInt232=Z.maxInt224=Z.maxInt216=Z.maxInt208=Z.maxInt200=Z.maxInt192=Z.maxInt184=Z.maxInt176=Z.maxInt168=Z.maxInt160=Z.maxInt152=Z.maxInt144=Z.maxInt136=Z.maxInt128=Z.maxInt120=Z.maxInt112=Z.maxInt104=Z.maxInt96=Z.maxInt88=Z.maxInt80=Z.maxInt72=Z.maxInt64=Z.maxInt56=Z.maxInt48=Z.maxInt40=Z.maxInt32=Z.maxInt24=Z.maxInt16=Z.maxInt8=Z.integerRegex=Z.bytesRegex=Z.arrayRegex=void 0,Z.maxUint256=Z.maxUint248=Z.maxUint240=Z.maxUint232=Z.maxUint224=Z.maxUint216=Z.maxUint208=Z.maxUint200=Z.maxUint192=Z.maxUint184=Z.maxUint176=Z.maxUint168=Z.maxUint160=Z.maxUint152=Z.maxUint144=Z.maxUint136=Z.maxUint128=Z.maxUint120=Z.maxUint112=Z.maxUint104=Z.maxUint96=Z.maxUint88=Z.maxUint80=Z.maxUint72=Z.maxUint64=Z.maxUint56=Z.maxUint48=Z.maxUint40=Z.maxUint32=Z.maxUint24=Z.maxUint16=Z.maxUint8=Z.minInt256=Z.minInt248=Z.minInt240=Z.minInt232=Z.minInt224=Z.minInt216=Z.minInt208=Z.minInt200=Z.minInt192=Z.minInt184=Z.minInt176=Z.minInt168=Z.minInt160=Z.minInt152=Z.minInt144=Z.minInt136=Z.minInt128=void 0,Z.arrayRegex=/^(.*)\[([0-9]*)\]$/,Z.bytesRegex=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,Z.integerRegex=/^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/,Z.maxInt8=2n**(8n-1n)-1n,Z.maxInt16=2n**(16n-1n)-1n,Z.maxInt24=2n**(24n-1n)-1n,Z.maxInt32=2n**(32n-1n)-1n,Z.maxInt40=2n**(40n-1n)-1n,Z.maxInt48=2n**(48n-1n)-1n,Z.maxInt56=2n**(56n-1n)-1n,Z.maxInt64=2n**(64n-1n)-1n,Z.maxInt72=2n**(72n-1n)-1n,Z.maxInt80=2n**(80n-1n)-1n,Z.maxInt88=2n**(88n-1n)-1n,Z.maxInt96=2n**(96n-1n)-1n,Z.maxInt104=2n**(104n-1n)-1n,Z.maxInt112=2n**(112n-1n)-1n,Z.maxInt120=2n**(120n-1n)-1n,Z.maxInt128=2n**(128n-1n)-1n,Z.maxInt136=2n**(136n-1n)-1n,Z.maxInt144=2n**(144n-1n)-1n,Z.maxInt152=2n**(152n-1n)-1n,Z.maxInt160=2n**(160n-1n)-1n,Z.maxInt168=2n**(168
315n-1n)-1n,Z.maxInt176=2n**(176n-1n)-1n,Z.maxInt184=2n**(184n-1n)-1n,Z.maxInt192=2n**(192n-1n)-1n,Z.maxInt200=2n**(200n-1n)-1n,Z.maxInt208=2n**(208n-1n)-1n,Z.maxInt216=2n**(216n-1n)-1n,Z.maxInt224=2n**(224n-1n)-1n,Z.maxInt232=2n**(232n-1n)-1n,Z.maxInt240=2n**(240n-1n)-1n,Z.maxInt248=2n**(248n-1n)-1n,Z.maxInt256=2n**(256n-1n)-1n,Z.minInt8=-(2n**(8n-1n)),Z.minInt16=-(2n**(16n-1n)),Z.minInt24=-(2n**(24n-1n)),Z.minInt32=-(2n**(32n-1n)),Z.minInt40=-(2n**(40n-1n)),Z.minInt48=-(2n**(48n-1n)),Z.minInt56=-(2n**(56n-1n)),Z.minInt64=-(2n**(64n-1n)),Z.minInt72=-(2n**(72n-1n)),Z.minInt80=-(2n**(80n-1n)),Z.minInt88=-(2n**(88n-1n)),Z.minInt96=-(2n**(96n-1n)),Z.minInt104=-(2n**(104n-1n)),Z.minInt112=-(2n**(112n-1n)),Z.minInt120=-(2n**(120n-1n)),Z.minInt128=-(2n**(128n-1n)),Z.minInt136=-(2n**(136n-1n)),Z.minInt144=-(2n**(144n-1n)),Z.minInt152=-(2n**(152n-1n)),Z.minInt160=-(2n**(160n-1n)),Z.minInt168=-(2n**(168n-1n)),Z.minInt176=-(2n**(176n-1n)),Z.minInt184=-(2n**(184n-1n)),Z.minInt192=-(2n**(192n-1n)),Z.minInt200=-(2n**(200n-1n)),Z.minInt208=-(2n**(208n-1n)),Z.minInt216=-(2n**(216n-1n)),Z.minInt224=-(2n**(224n-1n)),Z.minInt232=-(2n**(232n-1n)),Z.minInt240=-(2n**(240n-1n)),Z.minInt248=-(2n**(248n-1n)),Z.minInt256=-(2n**(256n-1n)),Z.maxUint8=2n**8n-1n,Z.maxUint16=2n**16n-1n,Z.maxUint24=2n**24n-1n,Z.maxUint32=2n**32n-1n,Z.maxUint40=2n**40n-1n,Z.maxUint48=2n**48n-1n,Z.maxUint56=2n**56n-1n,Z.maxUint64=2n**64n-1n,Z.maxUint72=2n**72n-1n,Z.maxUint80=2n**80n-1n,Z.maxUint88=2n**88n-1n,Z.maxUint96=2n**96n-1n,Z.maxUint104=2n**104n-1n,Z.maxUint112=2n**112n-1n,Z.maxUint120=2n**120n-1n,Z.maxUint128=2n**128n-1n,Z.maxUint136=2n**136n-1n,Z.maxUint144=2n**144n-1n,Z.maxUint152=2n**152n-1n,Z.maxUint160=2n**160n-1n,Z.maxUint168=2n**168n-1n,Z.maxUint176=2n**176n-1n,Z.maxUint184=2n**184n-1n,Z.maxUint192=2n**192n-1n,Z.maxUint200=2n**200n-1n,Z.maxUint208=2n**208n-1n,Z.maxUint216=2n**216n-1n,Z.maxUint224=2n**224n-1n,Z.maxUint232=2n**232n-1n,Z.maxUint240=2n**240n-1n,Z.maxUint248=2n**248n-1n,Z.maxUint256=2n**256n-1n),Z}var fr={},sM;function V_e(){if(sM)return fr;sM=1,Object.defineProperty(fr,"__esModule",{value:!0}),fr.decodeParameter=o,fr.decodeAddress=u,fr.decodeArray=l,fr.decodeBool=d,fr.decodeBytes=f,fr.decodeNumber=g,fr.decodeTuple=h,fr.decodeString=p,fr.prepareParameters=y,fr.prepareParameter=w,fr.encode=I,fr.encodeAddress=v,fr.encodeArray=E,fr.encodeBytes=b,fr.encodeBoolean=m,fr.encodeNumber=_,fr.encodeString=O,fr.encodeTuple=C,fr.getArrayComponents=S,fr.hasDynamicChild=T;const t=tx(),e=ex(),r=of(),n=vc(),s=so(),i=BW();function o(N,R,B){const{checksumAddress:A,staticPosition:P}=B,k=S(R.type);if(k){const[U,x]=k;return l(N,{...R,type:x},{checksumAddress:A,length:U,staticPosition:P})}if(R.type==="tuple")return h(N,R,{checksumAddress:A,staticPosition:P});if(R.type==="address")return u(N,{checksum:A});if(R.type==="bool")return d(N);if(R.type.startsWith("bytes"))return f(N,R,{staticPosition:P});if(R.type.startsWith("uint")||R.type.startsWith("int"))return g(N,R);if(R.type==="string")return p(N,{staticPosition:P});throw new t.InvalidTypeError(R.type)}const a=32,c=32;function u(N,R={}){const{checksum:B=!1}=R,A=N.readBytes(32);return[(k=>B?e.checksum(k):k)(s.fromBytes(r.slice(A,-20))),32]}function l(N,R,B){const{checksumAddress:A,length:P,staticPosition:k}=B;if(!P){const j=r.toNumber(N.readBytes(c)),D=k+j,M=D+a;N.setPosition(D);const L=r.toNumber(N.readBytes(a)),H=T(R);let z=0;const V=[];for(let G=0;G<L;++G){N.setPosition(M+(H?G*32:z));const[ee,X]=o(N,R,{checksumAddress:A,staticPosition:M});z+=X,V.push(ee)}return N.setPosition(k+32),[V,32]}if(T(R)){const j=r.toNumber(N.readBytes(c)),D=k+j,M=[];for(let L=0;L<P;++L){N.setPosition(D+L*32);const[H]=o(N,R,{checksumAddress:A,staticPosition:D});M.push(H)}return N.setPosition(k+32),[M,32]}let U=0;const x=[];for(let j=0;j<P;++j){const[D,M]=o(N,R,{checksumAddress:A,staticPosition:k+U});U+=M,x.push(D)}return[x,U]}function d(N){return[r.toBoolean(N.readBytes(32),{size:32}),32]}function f(N,R,{staticPosition:B}){const[A,P]=R.type.split("bytes");if(!P){const U=r.toNumber(N.readBytes(32));N.setPosition(B+U);const x=r.toNumber(N.readBytes(32));if(x===0)return N.setPosition(B+32),["0x",32];const j=N.readBytes(x);return N.setPosition(B+32),[s.fromBytes(j),32]}return[s.fromBytes(N.readBytes(Number.parseInt(P),32)),32]}function g(N,R){const B=R.type.startsWith("int"),A=Number.parseInt(R.type.split("int")[1]||"256"),P=N.readBytes(32);return[A>48?r.toBigInt(P,{signed:B}):r.toNumber(P,{signed:B}),32]}function h(N,R,B){const{checksumAddress:A,staticPosition:P}=B,k=R.components.length===0||R.components.some(({name:j})=>!j),U=k?[]:{};let x=0;if(T(R)){const j=r.toNumber(N.readBytes(c)),D=P+j;for(let M=0;M<R.components.length;
315++M){const L=R.components[M];N.setPosition(D+x);const[H,z]=o(N,L,{checksumAddress:A,staticPosition:D});x+=z,U[k?M:L==null?void 0:L.name]=H}return N.setPosition(P+32),[U,32]}for(let j=0;j<R.components.length;++j){const D=R.components[j],[M,L]=o(N,D,{checksumAddress:A,staticPosition:P});U[k?j:D==null?void 0:D.name]=M,x+=L}return[U,x]}function p(N,{staticPosition:R}){const B=r.toNumber(N.readBytes(32)),A=R+B;N.setPosition(A);const P=r.toNumber(N.readBytes(32));if(P===0)return N.setPosition(R+32),["",32];const k=N.readBytes(P,32),U=r.toString(r.trimLeft(k));return N.setPosition(R+32),[U,32]}function y({checksumAddress:N,parameters:R,values:B}){const A=[];for(let P=0;P<R.length;P++)A.push(w({checksumAddress:N,parameter:R[P],value:B[P]}));return A}function w({checksumAddress:N=!1,parameter:R,value:B}){const A=R,P=S(A.type);if(P){const[k,U]=P;return E(B,{checksumAddress:N,length:k,parameter:{...A,type:U}})}if(A.type==="tuple")return C(B,{checksumAddress:N,parameter:A});if(A.type==="address")return v(B,{checksum:N});if(A.type==="bool")return m(B);if(A.type.startsWith("uint")||A.type.startsWith("int")){const k=A.type.startsWith("int"),[,,U="256"]=i.integerRegex.exec(A.type)??[];return _(B,{signed:k,size:Number(U)})}if(A.type.startsWith("bytes"))return b(B,{type:A.type});if(A.type==="string")return O(B);throw new t.InvalidTypeError(A.type)}function I(N){let R=0;for(let k=0;k<N.length;k++){const{dynamic:U,encoded:x}=N[k];U?R+=32:R+=s.size(x)}const B=[],A=[];let P=0;for(let k=0;k<N.length;k++){const{dynamic:U,encoded:x}=N[k];U?(B.push(s.fromNumber(R+P,{size:32})),A.push(x),P+=s.size(x)):B.push(x)}return s.concat(...B,...A)}function v(N,R){const{checksum:B=!1}=R;return e.assert(N,{strict:B}),{dynamic:!1,encoded:s.padLeft(N.toLowerCase())}}function E(N,R){const{checksumAddress:B,length:A,parameter:P}=R,k=A===null;if(!Array.isArray(N))throw new t.InvalidArrayError(N);if(!k&&N.length!==A)throw new t.ArrayLengthMismatchError({expectedLength:A,givenLength:N.length,type:`${P.type}[${A}]`});let U=!1;const x=[];for(let j=0;j<N.length;j++){const D=w({checksumAddress:B,parameter:P,value:N[j]});D.dynamic&&(U=!0),x.push(D)}if(k||U){const j=I(x);if(k){const D=s.fromNumber(x.length,{size:32});return{dynamic:!0,encoded:x.length>0?s.concat(D,j):D}}if(U)return{dynamic:!0,encoded:j}}return{dynamic:!1,encoded:s.concat(...x.map(({encoded:j})=>j))}}function b(N,{type:R}){const[,B]=R.split("bytes"),A=s.size(N);if(!B){let P=N;return A%32!==0&&(P=s.padRight(P,Math.ceil((N.length-2)/2/32)*32)),{dynamic:!0,encoded:s.concat(s.padLeft(s.fromNumber(A,{size:32})),P)}}if(A!==Number.parseInt(B))throw new t.BytesSizeMismatchError({expectedSize:Number.parseInt(B),value:N});return{dynamic:!1,encoded:s.padRight(N)}}function m(N){if(typeof N!="boolean")throw new n.BaseError(`Invalid boolean value: "${N}" (type: ${typeof N}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:s.padLeft(s.fromBoolean(N))}}function _(N,{signed:R,size:B}){if(typeof B=="number"){const A=2n**(BigInt(B)-(R?1n:0n))-1n,P=R?-A-1n:0n;if(N>A||N<P)throw new s.IntegerOutOfRangeError({max:A.toString(),min:P.toString(),signed:R,size:B/8,value:N.toString()})}return{dynamic:!1,encoded:s.fromNumber(N,{size:32,signed:R})}}function O(N){const R=s.fromString(N),B=Math.ceil(s.size(R)/32),A=[];for(let P=0;P<B;P++)A.push(s.padRight(s.slice(R,P*32,(P+1)*32)));return{dynamic:!0,encoded:s.concat(s.padRight(s.fromNumber(s.size(R),{size:32})),...A)}}function C(N,R){const{checksumAddress:B,parameter:A}=R;let P=!1;const k=[];for(let U=0;U<A.components.length;U++){const x=A.components[U],j=Array.isArray(N)?U:x.name,D=w({checksumAddress:B,parameter:x,value:N[j]});k.push(D),D.dynamic&&(P=!0)}return{dynamic:P,encoded:P?I(k):s.concat(...k.map(({encoded:U})=>U))}}function S(N){const R=N.match(/^(.*)\[(\d+)?\]$/);return R?[R[2]?Number(R[2]):null,R[1]]:void 0}function T(N){var A;const{type:R}=N;if(R==="string"||R==="bytes"||R.endsWith("[]"))return!0;if(R==="tuple")return(A=N.components)==null?void 0:A.some(T);const B=S(N.type);return!!(B&&T({...N,type:B[1]}))}return fr}var go={},iM;function G_e(){if(iM)return go;iM=1,Object.defineProperty(go,"__esModule",{value:!0}),go.RecursiveReadLimitExceededError=go.PositionOutOfBoundsError=go.NegativeOffsetError=void 0,go.
315create=r;const t=vc(),e={bytes:new Uint8Array,dataView:new DataView(new ArrayBuffer(0)),position:0,positionReadCount:new Map,recursiveReadCount:0,recursiveReadLimit:Number.POSITIVE_INFINITY,assertReadLimit(){if(this.recursiveReadCount>=this.recursiveReadLimit)throw new i({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(o){if(o<0||o>this.bytes.length-1)throw new s({length:this.bytes.length,position:o})},decrementPosition(o){if(o<0)throw new n({offset:o});const a=this.position-o;this.assertPosition(a),this.position=a},getReadCount(o){return this.positionReadCount.get(o||this.position)||0},incrementPosition(o){if(o<0)throw new n({offset:o});const a=this.position+o;this.assertPosition(a),this.position=a},inspectByte(o){const a=o??this.position;return this.assertPosition(a),this.bytes[a]},inspectBytes(o,a){const c=a??this.position;return this.assertPosition(c+o-1),this.bytes.subarray(c,c+o)},inspectUint8(o){const a=o??this.position;return this.assertPosition(a),this.bytes[a]},inspectUint16(o){const a=o??this.position;return this.assertPosition(a+1),this.dataView.getUint16(a)},inspectUint24(o){const a=o??this.position;return this.assertPosition(a+2),(this.dataView.getUint16(a)<<8)+this.dataView.getUint8(a+2)},inspectUint32(o){const a=o??this.position;return this.assertPosition(a+3),this.dataView.getUint32(a)},pushByte(o){this.assertPosition(this.position),this.bytes[this.position]=o,this.position++},pushBytes(o){this.assertPosition(this.position+o.length-1),this.bytes.set(o,this.position),this.position+=o.length},pushUint8(o){this.assertPosition(this.position),this.bytes[this.position]=o,this.position++},pushUint16(o){this.assertPosition(this.position+1),this.dataView.setUint16(this.position,o),this.position+=2},pushUint24(o){this.assertPosition(this.position+2),this.dataView.setUint16(this.position,o>>8),this.dataView.setUint8(this.position+2,o&255),this.position+=3},pushUint32(o){this.assertPosition(this.position+3),this.dataView.setUint32(this.position,o),this.position+=4},readByte(){this.assertReadLimit(),this._touch();const o=this.inspectByte();return this.position++,o},readBytes(o,a){this.assertReadLimit(),this._touch();const c=this.inspectBytes(o);return this.position+=a??o,c},readUint8(){this.assertReadLimit(),this._touch();const o=this.inspectUint8();return this.position+=1,o},readUint16(){this.assertReadLimit(),this._touch();const o=this.inspectUint16();return this.position+=2,o},readUint24(){this.assertReadLimit(),this._touch();const o=this.inspectUint24();return this.position+=3,o},readUint32(){this.assertReadLimit(),this._touch();const o=this.inspectUint32();return this.position+=4,o},get remaining(){return this.bytes.length-this.position},setPosition(o){const a=this.position;return this.assertPosition(o),this.position=o,()=>this.position=a},_touch(){if(this.recursiveReadLimit===Number.POSITIVE_INFINITY)return;const o=this.getReadCount();this.positionReadCount.set(this.position,o+1),o>0&&this.recursiveReadCount++}};function r(o,{recursiveReadLimit:a=8192}={}){const c=Object.create(e);return c.bytes=o,c.dataView=new DataView(o.buffer,o.byteOffset,o.byteLength),c.positionReadCount=new Map,c.recursiveReadLimit=a,c}class n extends t.BaseError{constructor({offset:a}){super(`Offset \`${a}\` cannot be negative.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Cursor.NegativeOffsetError"})}}go.NegativeOffsetError=n;class s extends t.BaseError{constructor({length:a,position:c}){super(`Position \`${c}\` is out of bounds (\`0 < position < ${a}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Cursor.PositionOutOfBoundsError"})}}go.PositionOutOfBoundsError=s;class i extends t.BaseError{constructor({count:a,limit:c}){super(`Recursive read limit of \`${c}\` exceeded (recursive read count: \`${a}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Cursor.RecursiveReadLimitExceededError"})}}return go.RecursiveReadLimitExceededError=i,go}var oM;function tx(){if(oM)return dr;
315oM=1,Object.defineProperty(dr,"__esModule",{value:!0}),dr.InvalidTypeError=dr.InvalidArrayError=dr.LengthMismatchError=dr.BytesSizeMismatchError=dr.ArrayLengthMismatchError=dr.ZeroDataError=dr.DataSizeTooSmallError=void 0,dr.decode=c,dr.encode=u,dr.encodePacked=l,dr.format=d,dr.from=f;const t=JC(),e=ex(),r=of(),n=vc(),s=so(),i=BW(),o=V_e(),a=G_e();function c(E,b,m={}){const{as:_="Array",checksumAddress:O=!1}=m,C=typeof b=="string"?r.fromHex(b):b,S=a.create(C);if(r.size(C)===0&&E.length>0)throw new h;if(r.size(C)&&r.size(C)<32)throw new g({data:typeof b=="string"?b:s.fromBytes(b),parameters:E,size:r.size(C)});let T=0;const N=_==="Array"?[]:{};for(let R=0;R<E.length;++R){const B=E[R];S.setPosition(T);const[A,P]=o.decodeParameter(S,B,{checksumAddress:O,staticPosition:0});T+=P,_==="Array"?N.push(A):N[B.name??R]=A}return N}function u(E,b,m){const{checksumAddress:_=!1}=m??{};if(E.length!==b.length)throw new w({expectedLength:E.length,givenLength:b.length});const O=o.prepareParameters({checksumAddress:_,parameters:E,values:b}),C=o.encode(O);return C.length===0?"0x":C}function l(E,b){if(E.length!==b.length)throw new w({expectedLength:E.length,givenLength:b.length});const m=[];for(let _=0;_<E.length;_++){const O=E[_],C=b[_];m.push(l.encode(O,C))}return s.concat(...m)}(function(E){function b(m,_,O=!1){if(m==="address"){const N=_;return e.assert(N),s.padLeft(N.toLowerCase(),O?32:0)}if(m==="string")return s.fromString(_);if(m==="bytes")return _;if(m==="bool")return s.padLeft(s.fromBoolean(_),O?32:1);const C=m.match(i.integerRegex);if(C){const[N,R,B="256"]=C,A=Number.parseInt(B)/8;return s.fromNumber(_,{size:O?32:A,signed:R==="int"})}const S=m.match(i.bytesRegex);if(S){const[N,R]=S;if(Number.parseInt(R)!==(_.length-2)/2)throw new y({expectedSize:Number.parseInt(R),value:_});return s.padRight(_,O?32:0)}const T=m.match(i.arrayRegex);if(T&&Array.isArray(_)){const[N,R]=T,B=[];for(let A=0;A<_.length;A++)B.push(b(R,_[A],!0));return B.length===0?"0x":s.concat(...B)}throw new v(m)}E.encode=b})(l||(dr.encodePacked=l={}));function d(E){return t.formatAbiParameters(E)}function f(E){return Array.isArray(E)&&typeof E[0]=="string"||typeof E=="string"?t.parseAbiParameters(E):E}class g extends n.BaseError{constructor({data:b,parameters:m,size:_}){super(`Data size of ${_} bytes is too small for given parameters.`,{metaMessages:[`Params: (${t.formatAbiParameters(m)})`,`Data:   ${b} (${_} bytes)`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.DataSizeTooSmallError"})}}dr.DataSizeTooSmallError=g;class h extends n.BaseError{constructor(){super('Cannot decode zero data ("0x") with ABI parameters.'),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.ZeroDataError"})}}dr.ZeroDataError=h;class p extends n.BaseError{constructor({expectedLength:b,givenLength:m,type:_}){super(`Array length mismatch for type \`${_}\`. Expected: \`${b}\`. Given: \`${m}\`.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.ArrayLengthMismatchError"})}}dr.ArrayLengthMismatchError=p;class y extends n.BaseError{constructor({expectedSize:b,value:m}){super(`Size of bytes "${m}" (bytes${s.size(m)}) does not match expected size (bytes${b}).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.BytesSizeMismatchError"})}}dr.BytesSizeMismatchError=y;class w extends n.BaseError{constructor({expectedLength:b,givenLength:m}){super(["ABI encoding parameters/values length mismatch.",`Expected length (parameters): ${b}`,`Given length (values): ${m}`].join(`
316`)),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.LengthMismatchError"})}}dr.LengthMismatchError=w;class I extends n.BaseError{constructor(b){super(`Value \`${b}\` is not a valid array.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.InvalidArrayError"})}}dr.InvalidArrayError=I;class v extends n.BaseError{constructor(b){super(`Type \`${b}\` is not a valid ABI Type.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.InvalidTypeError"})}}return dr.InvalidTypeError=v,dr}var aM;function K_e(){if(aM)return zc;aM=1,Object.defineProperty(zc,"__esModule",{value:!0}),zc.decode=s,zc.encode=i,zc.format=o,zc.from=a,zc.fromAbi=c;const t=JC(),e=RW(),r=tx(),n=so();function s(u,l){const{bytecode:d}=l;
316if(u.inputs.length===0)return;const f=l.data.replace(d,"0x");return r.decode(u.inputs,f)}function i(u,l){var g;const{bytecode:d,args:f}=l;return n.concat(d,(g=u.inputs)!=null&&g.length&&(f!=null&&f.length)?r.encode(u.inputs,f):"0x")}function o(u){return t.formatAbiItem(u)}function a(u){return e.from(u)}function c(u){const l=u.find(d=>d.type==="constructor");if(!l)throw new e.NotFoundError({name:"constructor"});return l}return zc}var Ti={},cM;function Z_e(){if(cM)return Ti;cM=1,Object.defineProperty(Ti,"__esModule",{value:!0}),Ti.decodeData=s,Ti.decodeResult=i,Ti.encodeData=o,Ti.encodeResult=a,Ti.format=c,Ti.from=u,Ti.fromAbi=l,Ti.getSelector=d;const t=JC(),e=RW(),r=tx(),n=so();function s(f,g){const{overloads:h}=f;if(n.size(g)<4)throw new e.InvalidSelectorSizeError({data:g});if(f.inputs.length===0)return;const p=h?l([f,...h],g):f;if(!(n.size(g)<=4))return r.decode(p.inputs,n.slice(g,4))}function i(f,g,h={}){const p=r.decode(f.outputs,g,h);if(!(p&&Object.keys(p).length===0))return p&&Object.keys(p).length===1?Array.isArray(p)?p[0]:Object.values(p)[0]:p}function o(f,...g){const{overloads:h}=f,p=h?l([f,...h],f.name,{args:g[0]}):f,y=d(p),w=g.length>0?r.encode(p.inputs,g[0]):void 0;return w?n.concat(y,w):y}function a(f,g,h={}){const{as:p="Array"}=h,y=f.outputs.length===1?[g]:Array.isArray(g)?g:p==="Object"?Object.values(g):[g];return r.encode(f.outputs,y)}function c(f){return t.formatAbiItem(f)}function u(f,g={}){return e.from(f,g)}function l(f,g,h){const p=e.fromAbi(f,g,h);if(p.type!=="function")throw new e.NotFoundError({name:g,type:"function"});return p}function d(f){return e.getSelector(f)}return Ti}var Pi={},uM;function kW(){return uM||(uM=1,Object.defineProperty(Pi,"__esModule",{value:!0}),Pi.zeroAddress=Pi.ethAddress=Pi.entryPoint07Address=Pi.entryPoint06Address=void 0,Pi.entryPoint06Address="0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789",Pi.entryPoint07Address="0x0000000071727De22E5E9d8BAf0edAc6f37da032",Pi.ethAddress="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",Pi.zeroAddress="0x0000000000000000000000000000000000000000"),Pi}var lM;function Y_e(){if(lM)return NE;lM=1,Object.defineProperty(NE,"__esModule",{value:!0}),NE.simulateCalls=d;const t=K_e(),e=Z_e(),r=pn(),n=kW(),s=UC(),i=ut(),o=yi(),a=YN(),c=Wz(),u=AW(),l="0x6080604052348015600e575f80fd5b5061016d8061001c5f395ff3fe608060405234801561000f575f80fd5b5060043610610029575f3560e01c8063f8b2cb4f1461002d575b5f80fd5b610047600480360381019061004291906100db565b61005d565b604051610054919061011e565b60405180910390f35b5f8173ffffffffffffffffffffffffffffffffffffffff16319050919050565b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100aa82610081565b9050919050565b6100ba816100a0565b81146100c4575f80fd5b50565b5f813590506100d5816100b1565b92915050565b5f602082840312156100f0576100ef61007d565b5b5f6100fd848285016100c7565b91505092915050565b5f819050919050565b61011881610106565b82525050565b5f6020820190506101315f83018461010f565b9291505056fea26469706673582212203b9fe929fe995c7cf9887f0bdba8a36dd78e8b73f149b17d2d9ad7cd09d2dc6264736f6c634300081a0033";async function d(f,g){const{blockNumber:h,blockTag:p,calls:y,stateOverrides:w,traceAssetChanges:I,traceTransfers:v,validation:E}=g,b=g.account?(0,r.parseAccount)(g.account):void 0;if(I&&!b)throw new i.BaseError("`account` is required when `traceAssetChanges` is true");const m=b?t.encode(t.from("constructor(bytes, bytes)"),{bytecode:s.deploylessCallViaBytecodeBytecode,args:[l,e.encodeData(e.from("function getBalance(address)"),[b.address])]}):void 0,_=I?await Promise.all(g.calls.map(async te=>{if(!te.data&&!te.abi)return;const{accessList:fe}=await(0,c.createAccessList)(f,{account:b.address,...te,data:te.abi?(0,o.encodeFunctionData)(te):te.data});return fe.map(({address:Se,storageKeys:le})=>le.length>0?Se:null)})).then(te=>te.flat().filter(Boolean)):[],O=w==null?void 0:w.map(te=>te.address===(b==null?void 0:b.address)?{...te,nonce:0}:te),C=await(0,u.simulateBlocks)(f,{blockNumber:h,blockTag:p,blocks:[...I?[{calls:[{data:m}],stateOverrides:w},{calls:_.map((te,fe)=>({abi:[e.from("function balanceOf(address) returns (uint256)")],functionName:"balanceOf",args:[b.address],to:te,from:n.zeroAddress,nonce:fe})),stateOverrides:[{address:n.zeroAddress,nonce:0}]}]:[],{calls:[...y,{}].map((te,fe)=>({...te,from:b==null?void 0:b.address,nonce:fe})),stateOverrides:O},...I?[{calls:[{data:m}]},{calls:_.map((te,fe)=>({abi:[e.from("function balanceOf(address) returns (uint256)")],functionName:"balanceOf",args:[b.address],to:te,from:n.zeroAddress,nonce:fe})),stateOverrides:[{address:n.zeroAddress,nonce:0}]},{calls:_.map((te,fe)=>({to:te,abi:[e.from("function decimals() returns (uint256)")],functionName:"decimals",from:n.zeroAddress,nonce:fe})),stateOverrides:[{address:n.zeroAddress,nonce:0}]},{calls:_.map((te,fe)=>({to:te,abi:[e.from("function tokenURI(uint256) returns (string)")],functionName:"tokenURI",args:[0n],from:n.zeroAddress,nonce:fe})),stateOverrides:[{address:n.zeroAddress,nonce:0}]},{calls:_.map((te,fe)=>({to:te,abi:[e.from("function symbol() returns (string)")],functionName:"symbol",from:n.zeroAddress,nonce:fe})),stateOverrides:[{address:n.zeroAddress,nonce:0}]}]:[]],traceTransfers:v,validation:E}),S=I?C[2]:C[0],[T,N,,R,B,A,P,k]=I?C:[],{calls:U,...x}=S,j=U.slice(0,-1)??[],D=(T==null?void 0:T.calls)??[],M=(N==null?void 0:N.calls)??[],L=[...D,...M].map(te=>te.status==="success"?(0,a.hexToBigInt)(te.data):null),H=(R==null?void 0:R.calls)??[],z=(B==null?void 0:B.calls)??[],V=[...H,...z].map(te=>te.status==="success"?(0,a.hexToBigInt)(te.data):null),G=((A==null?void 0:A.calls)??[]).map(te=>te.status==="success"?te.result:null),ee=((k==null?void 0:k.calls)??[]).map(te=>te.status==="success"?te.result:null),X=((P==null?void 0:P.calls)??[]).map(te=>te.status==="success"?te.result:null),oe=[];for(const[te,fe]of V.entries()){const Se=L[te];if(typeof fe!="bigint"||typeof Se!="bigint")continue;const le=G[te-1],we=ee[te-1],ve=X[te-1],ae=te===0?{address:n.ethAddress,decimals:18,symbol
316:"ETH"}:{address:_[te-1],decimals:ve||le?Number(le??1):void 0,symbol:we??void 0};oe.some(re=>re.token.address===ae.address)||oe.push({token:ae,value:{pre:Se,post:fe,diff:fe-Se}})}return{assetChanges:oe,block:x,results:j}}return NE}var FE={},HE={},qE={},dM;function jW(){if(dM)return qE;dM=1,Object.defineProperty(qE,"__esModule",{value:!0}),qE.serializeSignature=n;const t=j0(),e=Lr(),r=Yt();function n({r:s,s:i,to:o="hex",v:a,yParity:c}){const u=(()=>{if(c===0||c===1)return c;if(a&&(a===27n||a===28n||a>=35n))return a%2n===0n?1:0;throw new Error("Invalid `v` or `yParity` value")})(),l=`0x${new t.secp256k1.Signature((0,e.hexToBigInt)(s),(0,e.hexToBigInt)(i)).toCompactHex()}${u===0?"1b":"1c"}`;return o==="hex"?l:(0,r.hexToBytes)(l)}return qE}var fM;function rx(){if(fM)return HE;fM=1,Object.defineProperty(HE,"__esModule",{value:!0}),HE.verifyHash=p;const t=sf(),e=UC(),r=zu(),n=z0(),s=mi(),i=yc(),o=Qn(),a=Be(),c=Vt(),u=YN(),l=zC(),d=Vu(),f=VN(),g=jW(),h=W0();async function p(y,w){var T,N,R;const{address:I,factory:v,factoryData:E,hash:b,signature:m,universalSignatureVerifierAddress:_=(R=(N=(T=y.chain)==null?void 0:T.contracts)==null?void 0:N.universalSignatureVerifier)==null?void 0:R.address,...O}=w,C=(0,o.isHex)(m)?m:typeof m=="object"&&"r"in m&&"s"in m?(0,g.serializeSignature)(m):(0,a.bytesToHex)(m),S=await(async()=>!v&&!E||(0,l.isErc6492Signature)(C)?C:(0,f.serializeErc6492Signature)({address:v,data:E,signature:C}))();try{const B=_?{to:_,data:(0,u.encodeFunctionData)({abi:t.universalSignatureValidatorAbi,functionName:"isValidSig",args:[I,b,S]}),...O}:{data:(0,n.encodeDeployData)({abi:t.universalSignatureValidatorAbi,args:[I,b,S],bytecode:e.universalSignatureValidatorByteCode}),...O},{data:A}=await(0,c.getAction)(y,h.call,"call")(B);return(0,u.hexToBool)(A??"0x0")}catch(B){try{if((0,i.isAddressEqual)((0,s.getAddress)(I),await(0,d.recoverAddress)({hash:b,signature:m})))return!0}catch{}if(B instanceof r.CallExecutionError)return!1;throw B}}return HE}var hM;function J_e(){if(hM)return FE;hM=1,Object.defineProperty(FE,"__esModule",{value:!0}),FE.verifyMessage=r;const t=J0(),e=rx();async function r(n,{address:s,message:i,factory:o,factoryData:a,signature:c,...u}){const l=(0,t.hashMessage)(i);return(0,e.verifyHash)(n,{address:s,factory:o,factoryData:a,hash:l,signature:c,...u})}return FE}var zE={},pM;function Q_e(){if(pM)return zE;pM=1,Object.defineProperty(zE,"__esModule",{value:!0}),zE.verifyTypedData=r;const t=Y0(),e=rx();async function r(n,s){const{address:i,factory:o,factoryData:a,signature:c,message:u,primaryType:l,types:d,domain:f,...g}=s,h=(0,t.hashTypedData)({message:u,primaryType:l,types:d,domain:f});return(0,e.verifyHash)(n,{address:i,factory:o,factoryData:a,hash:h,signature:c,...g})}return zE}var WE={},VE={},gM;function DW(){if(gM)return VE;gM=1,Object.defineProperty(VE,"__esModule",{value:!0}),VE.watchBlockNumber=o;const t=Lr(),e=Vt(),r=$p(),n=V0(),s=xn(),i=G0();function o(a,{emitOnBegin:c=!1,emitMissed:u=!1,onBlockNumber:l,onError:d,poll:f,pollingInterval:g=a.pollingInterval}){const h=typeof f<"u"?f:!(a.transport.type==="webSocket"||a.transport.type==="fallback"&&a.transport.transports[0].c
316onfig.type==="webSocket");let p;return h?(()=>{const I=(0,s.stringify)(["watchBlockNumber",a.uid,c,u,g]);return(0,r.observe)(I,{onBlockNumber:l,onError:d},v=>(0,n.poll)(async()=>{var E;try{const b=await(0,e.getAction)(a,i.getBlockNumber,"getBlockNumber")({cacheTime:0});if(p){if(b===p)return;if(b-p>1&&u)for(let m=p+1n;m<b;m++)v.onBlockNumber(m,p),p=m}(!p||b>p)&&(v.onBlockNumber(b,p),p=b)}catch(b){(E=v.onError)==null||E.call(v,b)}},{emitOnBegin:c,interval:g}))})():(()=>{const I=(0,s.stringify)(["watchBlockNumber",a.uid,c,u]);return(0,r.observe)(I,{onBlockNumber:l,onError:d},v=>{let E=!0,b=()=>E=!1;return(async()=>{try{const m=(()=>{if(a.transport.type==="fallback"){const O=a.transport.transports.find(C=>C.config.type==="webSocket");return O?O.value:a.transport}return a.transport})(),{unsubscribe:_}=await m.subscribe({params:["newHeads"],onData(O){var S;if(!E)return;const C=(0,t.hexToBigInt)((S=O.result)==null?void 0:S.number);v.onBlockNumber(C,p),p=C},onError(O){var C;(C=v.onError)==null||C.call(v,O)}});b=_,E||b()}catch(m){d==null||d(m)}})(),()=>b()})})()}return VE}var mM;function X_e(){if(mM)return WE;mM=1,Object.defineProperty(WE,"__esModule",{value:!0}),WE.waitForTransactionReceipt=d;const t=yN(),e=Zs(),r=Vt(),n=$p(),s=Bz(),i=RN(),o=xn(),a=Mp(),c=JN(),u=wW(),l=DW();async function d(f,{confirmations:g=1,hash:h,onReplaced:p,pollingInterval:y=f.pollingInterval,retryCount:w=6,retryDelay:I=({count:E})=>~~(1<<E)*200,timeout:v=18e4}){const E=(0,o.stringify)(["waitForTransactionReceipt",f.uid,h]);let b,m,_,O=!1;const{promise:C,resolve:S,reject:T}=(0,s.withResolvers)(),N=v?setTimeout(()=>T(new e.WaitForTransactionReceiptTimeoutError({hash:h})),v):void 0,R=(0,n.observe)(E,{onReplaced:p,resolve:S,reject:T},B=>{const A=(0,r.getAction)(f,l.watchBlockNumber,"watchBlockNumber")({emitMissed:!0,emitOnBegin:!0,poll:!0,pollingInterval:y,async onBlockNumber(P){const k=x=>{clearTimeout(N),A(),x(),R()};let U=P;if(!O)try{if(_){if(g>1&&(!_.blockNumber||U-_.blockNumber+1n<g))return;k(()=>B.resolve(_));return}if(b||(O=!0,await(0,i.withRetry)(async()=>{b=await(0,r.getAction)(f,c.getTransaction,"getTransaction")({hash:h}),b.blockNumber&&(U=b.blockNumber)},{delay:I,retryCount:w}),O=!1),_=await(0,r.getAction)(f,u.getTransactionReceipt,"getTransactionReceipt")({hash:h}),g>1&&(!_.blockNumber||U-_.blockNumber+1n<g))return;k(()=>B.resolve(_))}catch(x){if(x instanceof e.TransactionNotFoundError||x instanceof e.TransactionReceiptNotFoundError){if(!b){O=!1;return}try{m=b,O=!0;const j=await(0,i.withRetry)(()=>(0,r.getAction)(f,a.getBlock,"getBlock")({blockNumber:U,includeTransactions:!0}),{delay:I,retryCount:w,shouldRetry:({error:L})=>L instanceof t.BlockNotFoundError});O=!1;const D=j.transactions.find(({from:L,nonce:H})=>L===m.from&&H===m.nonce);if(!D||(_=await(0,r.getAction)(f,u.getTransactionReceipt,"getTransactionReceipt")({hash:D.hash}),g>1&&(!_.blockNumber||U-_.blockNumber+1n<g)))return;let M="replaced";D.to===m.to&&D.value===m.value&&D.input===m.input?M="repriced":D.from===D.to&&D.value===0n&&(M="cancelled"),k(()=>{var L;(L=B.onReplaced)==null||L.call(B,{reason:M,replacedTransaction:m,transaction:D,transactionReceipt:_}),B.resolve(_)})}catch(j){k(()=>B.reject(j))}}else k(()=>B.reject(x))}}})});return C}return WE}var GE={},yM;function eAe(){if(yM)return GE;yM=1,Object.defineProperty(GE,"__esModule",{value:!0}),GE.watchBlocks=i;const t=Vt(),e=$p(),r=V0(),n=xn(),s=Mp();function i(o,{blockTag:a="latest",emitMissed:c=!1,emitOnBegin:u=!1,onBlock:l,onError:d,includeTransactions:f,poll:g,pollingInterval:h=o.pollingInterval}){const p=typeof g<"u"?g:!(o.transport.type==="webSocket"||o.transport.type==="fallback"&&o.transport.transports[0].c
316onfig.type==="webSocket"),y=f??!1;let w;return p?(()=>{const E=(0,n.stringify)(["watchBlocks",o.uid,a,c,u,y,h]);return(0,e.observe)(E,{onBlock:l,onError:d},b=>(0,r.poll)(async()=>{var m;try{const _=await(0,t.getAction)(o,s.getBlock,"getBlock")({blockTag:a,includeTransactions:y});if(_.number&&(w!=null&&w.number)){if(_.number===w.number)return;if(_.number-w.number>1&&c)for(let O=(w==null?void 0:w.number)+1n;O<_.number;O++){const C=await(0,t.getAction)(o,s.getBlock,"getBlock")({blockNumber:O,includeTransactions:y});b.onBlock(C,w),w=C}}(!(w!=null&&w.number)||a==="pending"&&!(_!=null&&_.number)||_.number&&_.number>w.number)&&(b.onBlock(_,w),w=_)}catch(_){(m=b.onError)==null||m.call(b,_)}},{emitOnBegin:u,interval:h}))})():(()=>{let E=!0,b=!0,m=()=>E=!1;return(async()=>{try{u&&(0,t.getAction)(o,s.getBlock,"getBlock")({blockTag:a,includeTransactions:y}).then(C=>{E&&b&&(l(C,void 0),b=!1)});const _=(()=>{if(o.transport.type==="fallback"){const C=o.transport.transports.find(S=>S.config.type==="webSocket");return C?C.value:o.transport}return o.transport})(),{unsubscribe:O}=await _.subscribe({params:["newHeads"],async onData(C){if(!E)return;const S=await(0,t.getAction)(o,s.getBlock,"getBlock")({blockNumber:C.blockNumber,includeTransactions:y}).catch(()=>{});E&&(l(S,w),b=!1,w=S)},onError(C){d==null||d(C)}});m=O,E||m()}catch(_){d==null||d(_)}})(),()=>m()})()}return GE}var KE={},bM;function tAe(){if(bM)return KE;bM=1,Object.defineProperty(KE,"__esModule",{value:!0}),KE.watchEvent=h;const t=tf(),e=$p(),r=V0(),n=xn(),s=lr(),i=nf(),o=F0(),a=bc(),c=Vt(),u=Vz(),l=G0(),d=MC(),f=CN(),g=$C();function h(p,{address:y,args:w,batch:I=!0,event:v,events:E,fromBlock:b,onError:m,onLogs:_,poll:O,pollingInterval:C=p.pollingInterval,strict:S}){const T=typeof O<"u"?O:typeof b=="bigint"?!0:!(p.transport.type==="webSocket"||p.transport.type==="fallback"&&p.transport.transports[0].c
316onfig.type==="webSocket"),N=S??!1;return T?(()=>{const A=(0,n.stringify)(["watchEvent",y,w,I,p.uid,v,C,b]);return(0,e.observe)(A,{onLogs:_,onError:m},P=>{let k;b!==void 0&&(k=b-1n);let U,x=!1;const j=(0,r.poll)(async()=>{var D;if(!x){try{U=await(0,c.getAction)(p,u.createEventFilter,"createEventFilter")({address:y,args:w,event:v,events:E,strict:N,fromBlock:b})}catch{}x=!0;return}try{let M;if(U)M=await(0,c.getAction)(p,d.getFilterChanges,"getFilterChanges")({filter:U});else{const L=await(0,c.getAction)(p,l.getBlockNumber,"getBlockNumber")({});k&&k!==L?M=await(0,c.getAction)(p,f.getLogs,"getLogs")({address:y,args:w,event:v,events:E,fromBlock:k+1n,toBlock:L}):M=[],k=L}if(M.length===0)return;if(I)P.onLogs(M);else for(const L of M)P.onLogs([L])}catch(M){U&&M instanceof i.InvalidInputRpcError&&(x=!1),(D=P.onError)==null||D.call(P,M)}},{emitOnBegin:!0,interval:C});return async()=>{U&&await(0,c.getAction)(p,g.uninstallFilter,"uninstallFilter")({filter:U}),j()}})})():(()=>{let A=!0,P=()=>A=!1;return(async()=>{try{const k=(()=>{if(p.transport.type==="fallback"){const D=p.transport.transports.find(M=>M.config.type==="webSocket");return D?D.value:p.transport}return p.transport})(),U=E??(v?[v]:void 0);let x=[];U&&(x=[U.flatMap(M=>(0,t.encodeEventTopics)({abi:[M],eventName:M.name,args:w}))],v&&(x=x[0]));const{unsubscribe:j}=await k.subscribe({params:["logs",{address:y,topics:x}],onData(D){var L;if(!A)return;const M=D.result;try{const{eventName:H,args:z}=(0,o.decodeEventLog)({abi:U??[],data:M.data,topics:M.topics,strict:N}),V=(0,a.formatLog)(M,{args:z,eventName:H});_([V])}catch(H){let z,V;if(H instanceof s.DecodeLogDataMismatch||H instanceof s.DecodeLogTopicsMismatch){if(S)return;z=H.abiItem.name,V=(L=H.abiItem.inputs)==null?void 0:L.some(ee=>!("name"in ee&&ee.name))}const G=(0,a.formatLog)(M,{args:V?[]:{},eventName:z});_([G])}},onError(D){m==null||m(D)}});P=j,A||P()}catch(k){m==null||m(k)}})(),()=>P()})()}return KE}var ZE={},wM;function rAe(){if(wM)return ZE;wM=1,Object.defineProperty(ZE,"__esModule",{value:!0}),ZE.watchPendingTransactions=a;const t=Vt(),e=$p(),r=V0(),n=xn(),s=Gz(),i=MC(),o=$C();function a(c,{batch:u=!0,onError:l,onTransactions:d,poll:f,pollingInterval:g=c.pollingInterval}){return(typeof f<"u"?f:c.transport.type!=="webSocket")?(()=>{const w=(0,n.stringify)(["watchPendingTransactions",c.uid,u,g]);return(0,e.observe)(w,{onTransactions:d,onError:l},I=>{let v;const E=(0,r.poll)(async()=>{var b;try{if(!v)try{v=await(0,t.getAction)(c,s.createPendingTransactionFilter,"createPendingTransactionFilter")({});return}catch(_){throw E(),_}const m=await(0,t.getAction)(c,i.getFilterChanges,"getFilterChanges")({filter:v});if(m.length===0)return;if(u)I.onTransactions(m);else for(const _ of m)I.onTransactions([_])}catch(m){(b=I.onError)==null||b.call(I,m)}},{emitOnBegin:!0,interval:g});return async()=>{v&&await(0,t.getAction)(c,o.uninstallFilter,"uninstallFilter")({filter:v}),E()}})})():(()=>{let w=!0,I=()=>w=!1;return(async()=>{try{const{unsubscribe:v}=await c.transport.subscribe({params:["newPendingTransactions"],onData(E){if(!w)return;const b=E.result;d([b])},onError(E){l==null||l(E)}});I=v,w||I()}catch(v){l==null||l(v)}})(),()=>I()})()}return ZE}var YE={},JE={},EM;function nAe(){if(EM)return JE;EM=1,Object.defineProperty(JE,"__esModule",{value:!0}),JE.parseSiweMessage=t;function t(n){var h,p,y;const{scheme:s,statement:i,...o}=((h=n.match(e))==null?void 0:h.groups)??{},{chainId:a,expirationTime:c,issuedAt:u,notBefore:l,requestId:d,...f}=((p=n.match(r))==null?void 0:p.groups)??{},g=(y=n.split("Resources:")[1])==null?void 0:y.split(`
317- `).slice(1);return{...o,...f,...a?{chainId:Number(a)}:{},...c?{expirationTime:new Date(c)}:{},...u?{issuedAt:new Date(u)}:{},...l?{notBefore:new Date(l)}:{},...d?{requestId:d}:{},...g?{resources:g}:{},...s?{scheme:s}:{},...i?{statement:i}:{}}}const e=/^(?:(?<scheme>[a-zA-Z][a-zA-Z0-9+-.]*):\/\/)?(?<domain>[a-zA-Z0-9+-.]*(?::[0-9]{1,5})?) (?:wants you to sign in with your Ethereum account:\n)(?<address>0x[a-fA-F0-9]{40})\n\n(?:(?<statement>.*)\n\n)?/,r=/(?:URI: (?<uri>.+))\n(?:Version: (?<version>.+))\n(?:Chain ID: (?<chainId>\d+))\n(?:Nonce: (?<nonce>[a-zA-Z0-9]+))\n(?:Issued At: (?<issuedAt>.+))(?:\nExpiration Time: (?<expirationTime>.+))?(?:\nNot Before: (?<notBefore>.+))?(?:\nRequest ID: (?<requestId>.+))?/;return JE}var QE={},vM;function sAe(){if(vM)return QE;vM=1,Object.defineProperty(QE,"__esModule",{value:!0}),QE.validateSiweMessage=e;const t=yc();function e(r){const{address:n,domain:s,message:i,nonce:o,scheme:a,time:c=new Date}=r;if(s&&i.domain!==s||o&&i.nonce!==o||a&&i.scheme!==a||i.expirationTime&&c>=i.expirationTime||i.notBefore&&c<i.notBefore)return!1;try{if(!i.address||n&&!(0,t.isAddressEqual)(i.address,n))return!1}catch{return!1}return!0}return QE}var _M;function iAe(){if(_M)return YE;_M=1,Object.defineProperty(YE,"__esModule",{value:!0}),YE.verifySiweMessage=s;const t=J0(),e=nAe(),r=sAe(),n=rx();
317async function s(i,o){const{address:a,domain:c,message:u,nonce:l,scheme:d,signature:f,time:g=new Date,...h}=o,p=(0,e.parseSiweMessage)(u);if(!p.address||!(0,r.validateSiweMessage)({address:a,domain:c,message:p,nonce:l,scheme:d,time:g}))return!1;const w=(0,t.hashMessage)(u);return(0,n.verifyHash)(i,{address:p.address,hash:w,signature:f,...h})}return YE}var AM;function UW(){if(AM)return I1;AM=1,Object.defineProperty(I1,"__esModule",{value:!0}),I1.publicActions=ve;const t=Jve(),e=e_e(),r=t_e(),n=r_e(),s=zz(),i=W0(),o=Wz(),a=n_e(),c=uN(),u=Vz(),l=Gz(),d=Rz(),f=Tz(),g=AN(),h=Sz(),p=xz(),y=s_e(),w=Mp(),I=G0(),v=i_e(),E=L0(),b=o_e(),m=IN(),_=c_e(),O=l_e(),C=MC(),S=d_e(),T=bN(),N=CN(),R=w_e(),B=E_e(),A=JN(),P=v_e(),k=wN(),U=wW(),x=__e(),j=Ec(),D=AW(),M=Y_e(),L=kz(),H=$C(),z=J_e(),V=Q_e(),G=X_e(),ee=DW(),X=eAe(),oe=jz(),te=tAe(),fe=rAe(),Se=iAe(),le=DC(),we=NN();function ve(ae){return{call:re=>(0,i.call)(ae,re),createAccessList:re=>(0,o.createAccessList)(ae,re),createBlockFilter:()=>(0,a.createBlockFilter)(ae),createContractEventFilter:re=>(0,c.createContractEventFilter)(ae,re),createEventFilter:re=>(0,u.createEventFilter)(ae,re),createPendingTransactionFilter:()=>(0,l.createPendingTransactionFilter)(ae),estimateContractGas:re=>(0,d.estimateContractGas)(ae,re),estimateGas:re=>(0,g.estimateGas)(ae,re),getBalance:re=>(0,p.getBalance)(ae,re),getBlobBaseFee:()=>(0,y.getBlobBaseFee)(ae),getBlock:re=>(0,w.getBlock)(ae,re),getBlockNumber:re=>(0,I.getBlockNumber)(ae,re),getBlockTransactionCount:re=>(0,v.getBlockTransactionCount)(ae,re),getBytecode:re=>(0,b.getCode)(ae,re),getChainId:()=>(0,E.getChainId)(ae),getCode:re=>(0,b.getCode)(ae,re),getContractEvents:re=>(0,m.getContractEvents)(ae,re),getEip712Domain:re=>(0,_.getEip712Domain)(ae,re),getEnsAddress:re=>(0,t.getEnsAddress)(ae,re),getEnsAvatar:re=>(0,e.getEnsAvatar)(ae,re),getEnsName:re=>(0,r.getEnsName)(ae,re),getEnsResolver:re=>(0,n.getEnsResolver)(ae,re),getEnsText:re=>(0,s.getEnsText)(ae,re),getFeeHistory:re=>(0,O.getFeeHistory)(ae,re),estimateFeesPerGas:re=>(0,f.estimateFeesPerGas)(ae,re),getFilterChanges:re=>(0,C.getFilterChanges)(ae,re),getFilterLogs:re=>(0,S.getFilterLogs)(ae,re),getGasPrice:()=>(0,T.getGasPrice)(ae),getLogs:re=>(0,N.getLogs)(ae,re),getProof:re=>(0,R.getProof)(ae,re),estimateMaxPriorityFeePerGas:re=>(0,h.estimateMaxPriorityFeePerGas)(ae,re),getStorageAt:re=>(0,B.getStorageAt)(ae,re),getTransaction:re=>(0,A.getTransaction)(ae,re),getTransactionConfirmations:re=>(0,P.getTransactionConfirmations)(ae,re),getTransactionCount:re=>(0,k.getTransactionCount)(ae,re),getTransactionReceipt:re=>(0,U.getTransactionReceipt)(ae,re),multicall:re=>(0,x.multicall)(ae,re),prepareTransactionRequest:re=>(0,le.prepareTransactionRequest)(ae,re),readContract:re=>(0,j.readContract)(ae,re),sendRawTransaction:re=>(0,we.sendRawTransaction)(ae,re),simulate:re=>(0,D.simulateBlocks)(ae,re),simulateBlocks:re=>(0,D.simulateBlocks)(ae,re),simulateCalls:re=>(0,M.simulateCalls)(ae,re),simulateContract:re=>(0,L.simulateContract)(ae,re),verifyMessage:re=>(0,z.verifyMessage)(ae,re),verifySiweMessage:re=>(0,Se.verifySiweMessage)(ae,re),verifyTypedData:re=>(0,V.verifyTypedData)(ae,re),uninstallFilter:re=>(0,H.uninstallFilter)(ae,re),waitForTransactionReceipt:re=>(0,G.waitForTransactionReceipt)(ae,re),watchBlocks:re=>(0,X.watchBlocks)(ae,re),watchBlockNumber:re=>(0,ee.watchBlockNumber)(ae,re),watchContractEvent:re=>(0,oe.watchContractEvent)(ae,re),watchEvent:re=>(0,te.watchEvent)(ae,re),watchPendingTransactions:re=>(0,fe.watchPendingTransactions)(ae,re)}}return I1}var CM;function oAe(){if(CM)return C1;CM=1,Object.defineProperty(C1,"__esModule",{value:!0}),C1.createPublicClient=r;const t=FC(),e=UW();function r(n){const{key:s="public",name:i="Public Client"}=n;return(0,t.createClient)({...n,key:s,name:i,type:"publicClient"}).extend(e.publicActions)}return C1}var XE={},ev={},tv={},IM;function aAe(){if(IM)return tv;IM=1,Object.defineProperty(tv,"__esModule",{value:!0}),tv.dropTransaction=t;async function t(e,{hash:r}){await e.request({method:`${e.mode}_dropTransaction`,params:[r]})}return tv}var rv={},SM;function cAe(){if(SM)return rv;
317SM=1,Object.defineProperty(rv,"__esModule",{value:!0}),rv.dumpState=t;async function t(e){return e.request({method:`${e.mode}_dumpState`})}return rv}var nv={},TM;function uAe(){if(TM)return nv;TM=1,Object.defineProperty(nv,"__esModule",{value:!0}),nv.getAutomine=t;async function t(e){return e.mode==="ganache"?await e.request({method:"eth_mining"}):await e.request({method:`${e.mode}_getAutomine`})}return nv}var sv={},PM;function lAe(){if(PM)return sv;PM=1,Object.defineProperty(sv,"__esModule",{value:!0}),sv.getTxpoolContent=t;async function t(e){return await e.request({method:"txpool_content"})}return sv}var iv={},OM;function dAe(){if(OM)return iv;OM=1,Object.defineProperty(iv,"__esModule",{value:!0}),iv.getTxpoolStatus=e;const t=Lr();async function e(r){const{pending:n,queued:s}=await r.request({method:"txpool_status"});return{pending:(0,t.hexToNumber)(n),queued:(0,t.hexToNumber)(s)}}return iv}var ov={},NM;function fAe(){if(NM)return ov;NM=1,Object.defineProperty(ov,"__esModule",{value:!0}),ov.impersonateAccount=t;async function t(e,{address:r}){await e.request({method:`${e.mode}_impersonateAccount`,params:[r]})}return ov}var av={},xM;function hAe(){if(xM)return av;xM=1,Object.defineProperty(av,"__esModule",{value:!0}),av.increaseTime=e;const t=Be();async function e(r,{seconds:n}){return await r.request({method:"evm_increaseTime",params:[(0,t.numberToHex)(n)]})}return av}var cv={},RM;function pAe(){if(RM)return cv;RM=1,Object.defineProperty(cv,"__esModule",{value:!0}),cv.inspectTxpool=t;async function t(e){return await e.request({method:"txpool_inspect"})}return cv}var uv={},BM;function gAe(){if(BM)return uv;BM=1,Object.defineProperty(uv,"__esModule",{value:!0}),uv.loadState=t;async function t(e,{state:r}){await e.request({method:`${e.mode}_loadState`,params:[r]})}return uv}var lv={},kM;function mAe(){if(kM)return lv;
317kM=1,Object.defineProperty(lv,"__esModule",{value:!0}),lv.mine=e;const t=Be();async function e(r,{blocks:n,interval:s}){r.mode==="ganache"?await r.request({method:"evm_mine",params:[{blocks:(0,t.numberToHex)(n)}]}):await r.request({method:`${r.mode}_mine`,params:[(0,t.numberToHex)(n),(0,t.numberToHex)(s||0)]})}return lv}var dv={},jM;function yAe(){if(jM)return dv;jM=1,Object.defineProperty(dv,"__esModule",{value:!0}),dv.removeBlockTimestampInterval=t;async function t(e){await e.request({method:`${e.mode}_removeBlockTimestampInterval`})}return dv}var fv={},DM;function bAe(){if(DM)return fv;DM=1,Object.defineProperty(fv,"__esModule",{value:!0}),fv.reset=t;async function t(e,{blockNumber:r,jsonRpcUrl:n}={}){await e.request({method:`${e.mode}_reset`,params:[{forking:{blockNumber:Number(r),jsonRpcUrl:n}}]})}return fv}var hv={},UM;function wAe(){if(UM)return hv;UM=1,Object.defineProperty(hv,"__esModule",{value:!0}),hv.revert=t;async function t(e,{id:r}){await e.request({method:"evm_revert",params:[r]})}return hv}var pv={},MM;function EAe(){if(MM)return pv;MM=1,Object.defineProperty(pv,"__esModule",{value:!0}),pv.sendUnsignedTransaction=r;const t=Up(),e=gc();async function r(n,s){var E,b,m;const{accessList:i,data:o,from:a,gas:c,gasPrice:u,maxFeePerGas:l,maxPriorityFeePerGas:d,nonce:f,to:g,value:h,...p}=s,y=(m=(b=(E=n.chain)==null?void 0:E.formatters)==null?void 0:b.transactionRequest)==null?void 0:m.format,I=(y||e.formatTransactionRequest)({...(0,t.extract)(p,{format:y}),accessList:i,data:o,from:a,gas:c,gasPrice:u,maxFeePerGas:l,maxPriorityFeePerGas:d,nonce:f,to:g,value:h});return await n.request({method:"eth_sendUnsignedTransaction",params:[I]})}return pv}var gv={},$M;function vAe(){if($M)return gv;$M=1,Object.defineProperty(gv,"__esModule",{value:!0}),gv.setAutomine=t;async function t(e,r){e.mode==="ganache"?r?await e.request({method:"miner_start"}):await e.request({method:"miner_stop"}):await e.request({method:"evm_setAutomine",params:[r]})}return gv}var mv={},LM;function _Ae(){if(LM)return mv;LM=1,Object.defineProperty(mv,"__esModule",{value:!0}),mv.setBalance=e;const t=Be();async function e(r,{address:n,value:s}){r.mode==="ganache"?await r.request({method:"evm_setAccountBalance",params:[n,(0,t.numberToHex)(s)]}):await r.request({method:`${r.mode}_setBalance`,params:[n,(0,t.numberToHex)(s)]})}return mv}var yv={},FM;function AAe(){if(FM)return yv;FM=1,Object.defineProperty(yv,"__esModule",{value:!0}),yv.setBlockGasLimit=e;const t=Be();async function e(r,{gasLimit:n}){await r.request({method:"evm_setBlockGasLimit",params:[(0,t.numberToHex)(n)]})}return yv}var bv={},HM;function CAe(){if(HM)return bv;HM=1,Object.defineProperty(bv,"__esModule",{value:!0}),bv.setBlockTimestampInterval=t;async function t(e,{interval:r}){const n=e.mode==="hardhat"?r*1e3:r;await e.request({method:`${e.mode}_setBlockTimestampInterval`,params:[n]})}return bv}var wv={},qM;function IAe(){if(qM)return wv;qM=1,Object.defineProperty(wv,"__esModule",{value:!0}),wv.setCode=t;async function t(e,{address:r,bytecode:n}){e.mode==="ganache"?await e.request({method:"evm_setAccountCode",params:[r,n]}):await e.request({method:`${e.mode}_setCode`,params:[r,n]})}return wv}var Ev={},zM;function SAe(){if(zM)return Ev;zM=1,Object.defineProperty(Ev,"__esModule",{value:!0}),Ev.setCoinbase=t;async function t(e,{address:r}){await e.request({method:`${e.mode}_setCoinbase`,params:[r]})}return Ev}var vv={},WM;function TAe(){if(WM)return vv;
317WM=1,Object.defineProperty(vv,"__esModule",{value:!0}),vv.setIntervalMining=t;async function t(e,{interval:r}){const n=e.mode==="hardhat"?r*1e3:r;await e.request({method:"evm_setIntervalMining",params:[n]})}return vv}var _v={},VM;function PAe(){if(VM)return _v;VM=1,Object.defineProperty(_v,"__esModule",{value:!0}),_v.setLoggingEnabled=t;async function t(e,r){await e.request({method:`${e.mode}_setLoggingEnabled`,params:[r]})}return _v}var Av={},GM;function OAe(){if(GM)return Av;GM=1,Object.defineProperty(Av,"__esModule",{value:!0}),Av.setMinGasPrice=e;const t=Be();async function e(r,{gasPrice:n}){await r.request({method:`${r.mode}_setMinGasPrice`,params:[(0,t.numberToHex)(n)]})}return Av}var Cv={},KM;function NAe(){if(KM)return Cv;KM=1,Object.defineProperty(Cv,"__esModule",{value:!0}),Cv.setNextBlockBaseFeePerGas=e;const t=Be();async function e(r,{baseFeePerGas:n}){await r.request({method:`${r.mode}_setNextBlockBaseFeePerGas`,params:[(0,t.numberToHex)(n)]})}return Cv}var Iv={},ZM;function xAe(){if(ZM)return Iv;ZM=1,Object.defineProperty(Iv,"__esModule",{value:!0}),Iv.setNextBlockTimestamp=e;const t=Be();async function e(r,{timestamp:n}){await r.request({method:"evm_setNextBlockTimestamp",params:[(0,t.numberToHex)(n)]})}return Iv}var Sv={},YM;function RAe(){if(YM)return Sv;YM=1,Object.defineProperty(Sv,"__esModule",{value:!0}),Sv.setNonce=e;const t=Be();async function e(r,{address:n,nonce:s}){await r.request({method:`${r.mode}_setNonce`,params:[n,(0,t.numberToHex)(s)]})}return Sv}var Tv={},JM;function BAe(){if(JM)return Tv;JM=1,Object.defineProperty(Tv,"__esModule",{value:!0}),Tv.setRpcUrl=t;async function t(e,r){await e.request({method:`${e.mode}_setRpcUrl`,params:[r]})}return Tv}var Pv={},QM;function kAe(){if(QM)return Pv;QM=1,Object.defineProperty(Pv,"__esModule",{value:!0}),Pv.setStorageAt=e;const t=Be();async function e(r,{address:n,index:s,value:i}){await r.request({method:`${r.mode}_setStorageAt`,params:[n,typeof s=="number"?(0,t.numberToHex)(s):s,i]})}return Pv}var Ov={},XM;function jAe(){if(XM)return Ov;XM=1,Object.defineProperty(Ov,"__esModule",{value:!0}),Ov.snapshot=t;async function t(e){return await e.request({method:"evm_snapshot"})}return Ov}var Nv={},e$;function DAe(){if(e$)return Nv;e$=1,Object.defineProperty(Nv,"__esModule",{value:!0}),Nv.stopImpersonatingAccount=t;async function t(e,{address:r}){await e.request({method:`${e.mode}_stopImpersonatingAccount`,params:[r]})}return Nv}var t$;function MW(){if(t$)return ev;
317t$=1,Object.defineProperty(ev,"__esModule",{value:!0}),ev.testActions=B;const t=aAe(),e=cAe(),r=uAe(),n=lAe(),s=dAe(),i=fAe(),o=hAe(),a=pAe(),c=gAe(),u=mAe(),l=yAe(),d=bAe(),f=wAe(),g=EAe(),h=vAe(),p=_Ae(),y=AAe(),w=CAe(),I=IAe(),v=SAe(),E=TAe(),b=PAe(),m=OAe(),_=NAe(),O=xAe(),C=RAe(),S=BAe(),T=kAe(),N=jAe(),R=DAe();function B({mode:A}){return P=>{const k=P.extend(()=>({mode:A}));return{dropTransaction:U=>(0,t.dropTransaction)(k,U),dumpState:()=>(0,e.dumpState)(k),getAutomine:()=>(0,r.getAutomine)(k),getTxpoolContent:()=>(0,n.getTxpoolContent)(k),getTxpoolStatus:()=>(0,s.getTxpoolStatus)(k),impersonateAccount:U=>(0,i.impersonateAccount)(k,U),increaseTime:U=>(0,o.increaseTime)(k,U),inspectTxpool:()=>(0,a.inspectTxpool)(k),loadState:U=>(0,c.loadState)(k,U),mine:U=>(0,u.mine)(k,U),removeBlockTimestampInterval:()=>(0,l.removeBlockTimestampInterval)(k),reset:U=>(0,d.reset)(k,U),revert:U=>(0,f.revert)(k,U),sendUnsignedTransaction:U=>(0,g.sendUnsignedTransaction)(k,U),setAutomine:U=>(0,h.setAutomine)(k,U),setBalance:U=>(0,p.setBalance)(k,U),setBlockGasLimit:U=>(0,y.setBlockGasLimit)(k,U),setBlockTimestampInterval:U=>(0,w.setBlockTimestampInterval)(k,U),setCode:U=>(0,I.setCode)(k,U),setCoinbase:U=>(0,v.setCoinbase)(k,U),setIntervalMining:U=>(0,E.setIntervalMining)(k,U),setLoggingEnabled:U=>(0,b.setLoggingEnabled)(k,U),setMinGasPrice:U=>(0,m.setMinGasPrice)(k,U),setNextBlockBaseFeePerGas:U=>(0,_.setNextBlockBaseFeePerGas)(k,U),setNextBlockTimestamp:U=>(0,O.setNextBlockTimestamp)(k,U),setNonce:U=>(0,C.setNonce)(k,U),setRpcUrl:U=>(0,S.setRpcUrl)(k,U),setStorageAt:U=>(0,T.setStorageAt)(k,U),snapshot:()=>(0,N.snapshot)(k),stopImpersonatingAccount:U=>(0,R.stopImpersonatingAccount)(k,U)}}}return ev}var r$;function UAe(){if(r$)return XE;r$=1,Object.defineProperty(XE,"__esModule",{value:!0}),XE.createTestClient=r;const t=FC(),e=MW();function r(n){const{key:s="test",name:i="Test Client",mode:o}=n;return(0,t.createClient)({...n,key:s,name:i,type:"testClient"}).extend(c=>({mode:o,...(0,e.testActions)({mode:o})(c)}))}return XE}var xv={},Rv={},n$;function MAe(){if(n$)return Rv;n$=1,Object.defineProperty(Rv,"__esModule",{value:!0}),Rv.addChain=e;const t=Be();async function e(r,{chain:n}){const{id:s,name:i,nativeCurrency:o,rpcUrls:a,blockExplorers:c}=n;await r.request({method:"wallet_addEthereumChain",params:[{chainId:(0,t.numberToHex)(s),chainName:i,nativeCurrency:o,rpcUrls:a.default.http,blockExplorerUrls:c?Object.values(c).map(({url:u})=>u):void 0}]},{dedupe:!0,retryCount:0})}return Rv}var Bv={},s$;function $Ae(){if(s$)return Bv;s$=1,Object.defineProperty(Bv,"__esModule",{value:!0}),Bv.deployContract=r;const t=z0(),e=xN();function r(n,s){const{abi:i,args:o,bytecode:a,...c}=s,u=(0,t.encodeDeployData)({abi:i,args:o,bytecode:a});return(0,e.sendTransaction)(n,{...c,data:u})}return Bv}var kv={},i$;function LAe(){if(i$)return kv;i$=1,Object.defineProperty(kv,"__esModule",{value:!0}),kv.getAddresses=e;const t=mi();async function e(r){var s;return((s=r.account)==null?void 0:s.type)==="local"?[r.account.address]:(await r.request({method:"eth_accounts"},{dedupe:!0})).map(i=>(0,t.checksumAddress)(i))}return kv}var jv={},o$;function FAe(){if(o$)return jv;o$=1,Object.defineProperty(jv,"__esModule",{value:!0}),jv.getPermissions=t;async function t(e){return await e.request({method:"wallet_getPermissions"},{dedupe:!0})}return jv}var Dv={},a$;function HAe(){if(a$)return Dv;a$=1,Object.defineProperty(Dv,"__esModule",{value:!0}),Dv.requestAddresses=e;const t=mi();async function e(r){return(await r.request({method:"eth_requestAccounts"},{dedupe:!0,retryCount:0})).map(s=>(0,t.getAddress)(s))}return Dv}var Uv={},c$;function qAe(){if(c$)return Uv;c$=1,Object.defineProperty(Uv,"__esModule",{value:!0}),Uv.requestPermissions=t;async function t(e,r){return e.request({method:"wallet_requestPermissions",params:[r]},{retryCount:0})}return Uv}var Mv={},u$;function zAe(){if(u$)return Mv;u$=1,Object.defineProperty(Mv,"__esModule",{value:!0}),Mv.signMessage=n;const t=pn(),e=K0(),r=Be();async function n(s,{account:i=s.account,message:o}){if(!i)throw new e.AccountNotFoundError({docsPath:"/docs/actions/wallet/signMessage"});const a=(0,t.parseAccount)(i);if(a.signMessage)return a.signMessage({message:o});
317const c=typeof o=="string"?(0,r.stringToHex)(o):o.raw instanceof Uint8Array?(0,r.toHex)(o.raw):o.raw;return s.request({method:"personal_sign",params:[c,a.address]},{retryCount:0})}return Mv}var $v={},l$;function WAe(){if(l$)return $v;l$=1,Object.defineProperty($v,"__esModule",{value:!0}),$v.signTransaction=c;const t=pn(),e=K0(),r=LC(),n=Be(),s=gc(),i=Vt(),o=mc(),a=L0();async function c(u,l){var I,v,E,b;const{account:d=u.account,chain:f=u.chain,...g}=l;if(!d)throw new e.AccountNotFoundError({docsPath:"/docs/actions/wallet/signTransaction"});const h=(0,t.parseAccount)(d);(0,o.assertRequest)({account:h,...l});const p=await(0,i.getAction)(u,a.getChainId,"getChainId")({});f!==null&&(0,r.assertCurrentChain)({currentChainId:p,chain:f});const y=(f==null?void 0:f.formatters)||((I=u.chain)==null?void 0:I.formatters),w=((v=y==null?void 0:y.transactionRequest)==null?void 0:v.format)||s.formatTransactionRequest;return h.signTransaction?h.signTransaction({...g,chainId:p},{serializer:(b=(E=u.chain)==null?void 0:E.serializers)==null?void 0:b.transaction}):await u.request({method:"eth_signTransaction",params:[{...w(g),chainId:(0,n.numberToHex)(p),from:h.address}]},{retryCount:0})}return $v}var Lv={},d$;function VAe(){if(d$)return Lv;d$=1,Object.defineProperty(Lv,"__esModule",{value:!0}),Lv.signTypedData=n;const t=pn(),e=K0(),r=qC();async function n(s,i){const{account:o=s.account,domain:a,message:c,primaryType:u}=i;if(!o)throw new e.AccountNotFoundError({docsPath:"/docs/actions/wallet/signTypedData"});const l=(0,t.parseAccount)(o),d={EIP712Domain:(0,r.getTypesForEIP712Domain)({domain:a}),...i.types};if((0,r.validateTypedData)({domain:a,message:c,primaryType:u,types:d}),l.signTypedData)return l.signTypedData({domain:a,message:c,primaryType:u,types:d});const f=(0,r.serializeTypedData)({domain:a,message:c,primaryType:u,types:d});return s.request({method:"eth_signTypedData_v4",params:[l.address,f]},{retryCount:0})}return Lv}var Fv={},f$;function GAe(){if(f$)return Fv;f$=1,Object.defineProperty(Fv,"__esModule",{value:!0}),Fv.switchChain=e;const t=Be();async function e(r,{id:n}){await r.request({method:"wallet_switchEthereumChain",params:[{chainId:(0,t.numberToHex)(n)}]},{retryCount:0})}return Fv}var Hv={},h$;function KAe(){if(h$)return Hv;h$=1,Object.defineProperty(Hv,"__esModule",{value:!0}),Hv.watchAsset=t;async function t(e,r){return await e.request({method:"wallet_watchAsset",params:r},{retryCount:0})}return Hv}var p$;function $W(){if(p$)return xv;p$=1,Object.defineProperty(xv,"__esModule",{value:!0}),xv.walletActions=y;const t=L0(),e=MAe(),r=$Ae(),n=LAe(),s=FAe(),i=DC(),o=HAe(),a=qAe(),c=NN(),u=xN(),l=zAe(),d=WAe(),f=VAe(),g=GAe(),h=KAe(),p=Uz();function y(w){return{addChain:I=>(0,e.addChain)(w,I),deployContract:I=>(0,r.deployContract)(w,I),getAddresses:()=>(0,n.getAddresses)(w),getChainId:()=>(0,t.getChainId)(w),getPermissions:()=>(0,s.getPermissions)(w),prepareTransactionRequest:I=>(0,i.prepareTransactionRequest)(w,I),requestAddresses:()=>(0,o.requestAddresses)(w),requestPermissions:I=>(0,a.requestPermissions)(w,I),sendRawTransaction:I=>(0,c.sendRawTransaction)(w,I),sendTransaction:I=>(0,u.sendTransaction)(w,I),signMessage:I=>(0,l.signMessage)(w,I),signTransaction:I=>(0,d.signTransaction)(w,I),signTypedData:I=>(0,f.signTypedData)(w,I),switchChain:I=>(0,g.switchChain)(w,I),watchAsset:I=>(0,h.watchAsset)(w,I),writeContract:I=>(0,p.writeContract)(w,I)}}return xv}var qv={},g$;function ZAe(){if(g$)return qv;g$=1,Object.defineProperty(qv,"__esModule",{value:!0}),qv.createWalletClient=r;const t=FC(),e=$W();function r(n){const{key:s="wallet",name:i="Wallet Client",transport:o}=n;return(0,t.createClient)({...n,key:s,name:i,transport:o,type:"walletClient"}).extend(e.walletActions)}return qv}var zv={},m$;function YAe(){if(m$)return zv;m$=1,Object.defineProperty(zv,"__esModule",{value:!0}),zv.webSocket=i;const t=no(),e=BN(),r=Jz(),n=MN(),s=Z0();function i(o,a={}){const{keepAlive:c,key:u="webSocket",methods:l,name:d="WebSocket JSON-RPC",reconnect:f,retryDelay:g}=a;return({chain:h,retryCount:p,timeout:y})=>{var E;
317const w=a.retryCount??p,I=y??a.timeout??1e4,v=o||((E=h==null?void 0:h.rpcUrls.default.webSocket)==null?void 0:E[0]);if(!v)throw new e.UrlRequiredError;return(0,s.createTransport)({key:u,methods:l,name:d,async request({method:b,params:m}){const _={method:b,params:m},O=await(0,n.getWebSocketRpcClient)(v,{keepAlive:c,reconnect:f}),{error:C,result:S}=await O.requestAsync({body:_,timeout:I});if(C)throw new t.RpcRequestError({body:_,error:C,url:v});return S},retryCount:w,retryDelay:g,timeout:I,type:"webSocket"},{getSocket(){return(0,r.getSocket)(v)},getRpcClient(){return(0,n.getWebSocketRpcClient)(v)},async subscribe({params:b,onData:m,onError:_}){const O=await(0,n.getWebSocketRpcClient)(v),{result:C}=await new Promise((S,T)=>O.request({body:{method:"eth_subscribe",params:b},onError(N){T(N),_==null||_(N)},onResponse(N){if(N.error){T(N.error),_==null||_(N.error);return}if(typeof N.id=="number"){S(N);return}N.method==="eth_subscription"&&m(N.params)}}));return{subscriptionId:C,async unsubscribe(){return new Promise(S=>O.request({body:{method:"eth_unsubscribe",params:[C]},onResponse:S}))}}}})}}return zv}var mm={},y$;function JAe(){if(y$)return mm;y$=1,Object.defineProperty(mm,"__esModule",{value:!0}),mm.ProviderRpcError=void 0;class t extends Error{constructor(r,n){super(n),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.code=r,this.details=n}}return mm.ProviderRpcError=t,mm}var Wv={},b$;function QAe(){if(b$)return Wv;b$=1,Object.defineProperty(Wv,"__esModule",{value:!0}),Wv.decodeDeployData=n;const t=lr(),e=qu(),r="/docs/contract/decodeDeployData";function n(s){const{abi:i,bytecode:o,data:a}=s;if(a===o)return{bytecode:o};const c=i.find(l=>"type"in l&&l.type==="constructor");if(!c)throw new t.AbiConstructorNotFoundError({docsPath:r});if(!("inputs"in c))throw new t.AbiConstructorParamsNotFoundError({docsPath:r});if(!c.inputs||c.inputs.length===0)throw new t.AbiConstructorParamsNotFoundError({docsPath:r});return{args:(0,e.decodeAbiParameters)(c.inputs,`0x${a.replace(o,"")}`),bytecode:o}}return Wv}var Vv={},w$;function XAe(){if(w$)return Vv;w$=1,Object.defineProperty(Vv,"__esModule",{value:!0}),Vv.compactSignatureToSignature=r;const t=Yt(),e=Be();function r({r:n,yParityAndS:s}){const i=(0,t.hexToBytes)(s),o=i[0]&128?1:0,a=i;return o===1&&(a[0]&=127),{r:n,s:(0,e.bytesToHex)(a),yParity:o}}return Vv}var Gv={},E$;function eCe(){if(E$)return Gv;E$=1,Object.defineProperty(Gv,"__esModule",{value:!0}),Gv.parseCompactSignature=r;const t=j0(),e=Be();function r(n){const{r:s,s:i}=t.secp256k1.Signature.fromCompact(n.slice(2,130));return{r:(0,e.numberToHex)(s,{size:32}),yParityAndS:(0,e.numberToHex)(i,{size:32})}}return Gv}var Kv={},v$;function tCe(){if(v$)return Kv;v$=1,Object.defineProperty(Kv,"__esModule",{value:!0}),Kv.parseSignature=r;const t=j0(),e=Be();function r(n){const{r:s,s:i}=t.secp256k1.Signature.fromCompact(n.slice(2,130)),o=+`0x${n.slice(130)}`,[a,c]=(()=>{if(o===0||o===1)return[void 0,o];if(o===27)return[BigInt(o),0];if(o===28)return[BigInt(o),1];throw new Error("Invalid yParityOrV value")})();return typeof a<"u"?{r:(0,e.numberToHex)(s,{size:32}),s:(0,e.numberToHex)(i,{size:32}),v:a,yParity:c}:{r:(0,e.numberToHex)(s,{size:32}),s:(0,e.numberToHex)(i,{size:32}),yParity:c}}return Kv}var Zv={},_$;
317function rCe(){if(_$)return Zv;_$=1,Object.defineProperty(Zv,"__esModule",{value:!0}),Zv.recoverTransactionAddress=s;const t=Is(),e=KN(),r=VC(),n=Vu();async function s(i){const{serializedTransaction:o,signature:a}=i,c=(0,e.parseTransaction)(o),u=a??{r:c.r,s:c.s,v:c.v,yParity:c.yParity},l=(0,r.serializeTransaction)({...c,r:void 0,s:void 0,v:void 0,yParity:void 0,sidecars:void 0});return await(0,n.recoverAddress)({hash:(0,t.keccak256)(l),signature:u})}return Zv}var Yv={},A$;function nCe(){if(A$)return Yv;A$=1,Object.defineProperty(Yv,"__esModule",{value:!0}),Yv.signatureToCompactSignature=r;const t=Yt(),e=Be();function r(n){const{r:s,s:i,v:o,yParity:a}=n,c=Number(a??o-27n);let u=i;if(c===1){const l=(0,t.hexToBytes)(i);l[0]|=128,u=(0,e.bytesToHex)(l)}return{r:s,yParityAndS:u}}return Yv}var Jv={},C$;function sCe(){if(C$)return Jv;C$=1,Object.defineProperty(Jv,"__esModule",{value:!0}),Jv.serializeCompactSignature=r;const t=j0(),e=Lr();function r({r:n,yParityAndS:s}){return`0x${new t.secp256k1.Signature((0,e.hexToBigInt)(n),(0,e.hexToBigInt)(s)).toCompactHex()}`}return Jv}var Qv={},I$;function iCe(){if(I$)return Qv;I$=1,Object.defineProperty(Qv,"__esModule",{value:!0}),Qv.sidecarsToVersionedHashes=e;const t=vN();function e(r){const{sidecars:n,version:s}=r,i=r.to??(typeof n[0].blob=="string"?"hex":"bytes"),o=[];for(const{commitment:a}of n)o.push((0,t.commitmentToVersionedHash)({commitment:a,to:i,version:s}));return o}return Qv}var Xv={},S$;function oCe(){if(S$)return Xv;S$=1,Object.defineProperty(Xv,"__esModule",{value:!0}),Xv.fromBlobs=n;const t=R0(),e=Yt(),r=Be();function n(s){const i=s.to??(typeof s.blobs[0]=="string"?"hex":"bytes"),o=typeof s.blobs[0]=="string"?s.blobs.map(d=>(0,e.hexToBytes)(d)):s.blobs,a=o.reduce((d,f)=>d+f.length,0),c=(0,t.createCursor)(new Uint8Array(a));let u=!0;for(const d of o){const f=(0,t.createCursor)(d);for(;u&&f.position<d.length;){f.incrementPosition(1);let g=31;d.length-f.position<31&&(g=d.length-f.position);for(const h in Array.from({length:g})){const p=f.readByte();if(p===128&&!f.inspectBytes(f.remaining).includes(128)){u=!1;break}c.pushByte(p)}}}const l=c.bytes.slice(0,c.position);return i==="hex"?(0,r.bytesToHex)(l):l}return Xv}var e_={},T$;function LW(){if(T$)return e_;
317T$=1,Object.defineProperty(e_,"__esModule",{value:!0}),e_.defineKzg=t;function t({blobToKzgCommitment:e,computeBlobKzgProof:r}){return{blobToKzgCommitment:e,computeBlobKzgProof:r}}return e_}var t_={},P$;function aCe(){if(P$)return t_;P$=1,Object.defineProperty(t_,"__esModule",{value:!0}),t_.setupKzg=e;const t=LW();function e(r,n){try{r.loadTrustedSetup(n)}catch(s){const i=s;if(!i.message.includes("trusted setup is already loaded"))throw i}return(0,t.defineKzg)(r)}return t_}var O$;function cCe(){return O$||(O$=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.maxInt32=t.maxInt24=t.maxInt16=t.maxInt8=t.weiUnits=t.gweiUnits=t.etherUnits=t.universalSignatureValidatorByteCode=t.deploylessCallViaFactoryBytecode=t.deploylessCallViaBytecodeBytecode=t.zeroAddress=t.ethAddress=t.universalSignatureValidatorAbi=t.erc4626Abi=t.erc721Abi=t.erc20Abi_bytes32=t.erc20Abi=t.multicall3Abi=t.webSocket=t.createWalletClient=t.createTransport=t.walletActions=t.testActions=t.publicActions=t.createTestClient=t.createPublicClient=t.http=t.fallback=t.custom=t.rpcSchema=t.createClient=t.getContract=t.parseAbiParameters=t.parseAbiParameter=t.parseAbiItem=t.parseAbi=t.UnknownSignatureError=t.UnknownTypeError=t.SolidityProtectedKeywordError=t.InvalidStructSignatureError=t.InvalidSignatureError=t.InvalidParenthesisError=t.InvalidParameterError=t.InvalidModifierError=t.InvalidFunctionModifierError=t.InvalidAbiTypeParameterError=t.InvalidAbiItemError=t.InvalidAbiParametersError=t.InvalidAbiParameterError=t.CircularReferenceError=void 0,t.maxUint176=t.maxUint168=t.maxUint160=t.maxUint152=t.maxUint144=t.maxUint136=t.maxUint128=t.maxUint120=t.maxUint112=t.maxUint104=t.maxUint96=t.maxUint88=t.maxUint80=t.maxUint72=t.maxUint64=t.maxUint56=t.maxUint48=t.maxUint40=t.maxUint32=t.maxUint24=t.maxUint16=t.maxUint8=t.maxInt256=t.maxInt248=t.maxInt240=t.maxInt232=t.maxInt224=t.maxInt216=t.maxInt208=t.maxInt200=t.maxInt192=t.maxInt184=t.maxInt176=t.maxInt168=t.maxInt160=t.maxInt152=t.maxInt144=t.maxInt136=t.maxInt128=t.maxInt120=t.maxInt112=t.maxInt104=t.maxInt96=t.maxInt88=t.maxInt80=t.maxInt72=t.maxInt64=t.maxInt56=t.maxInt48=t.maxInt40=void 0,t.AbiEncodingArrayLengthMismatchError=t.AbiDecodingZeroDataError=t.AbiDecodingDataSizeTooSmallError=t.AbiDecodingDataSizeInvalidError=t.AbiConstructorParamsNotFoundError=t.AbiConstructorNotFoundError=t.presignMessagePrefix=t.zeroHash=t.minInt256=t.minInt248=t.minInt240=t.minInt232=t.minInt224=t.minInt216=t.minInt208=t.minInt200=t.minInt192=t.minInt184=t.minInt176=t.minInt168=t.minInt160=t.minInt152=t.minInt144=t.minInt136=t.minInt128=t.minInt120=t.minInt112=t.minInt104=t.minInt96=t.minInt88=t.minInt80=t.minInt72=t.minInt64=t.minInt56=t.minInt48=t.minInt40=t.minInt32=t.minInt24=t.minInt16=t.minInt8=t.maxUint256=t.maxUint248=t.maxUint240=t.maxUint232=t.maxUint224=t.maxUint216=t.maxUint208=t.maxUint200=t.maxUint192=t.maxUint184=void 0,t.UnknownRpcError=t.UnauthorizedProviderError=t.TransactionRejectedRpcError=t.SwitchChainError=t.RpcError=t.ResourceUnavailableRpcError=t.ResourceNotFoundRpcError=t.ProviderRpcError=t.ProviderDisconnectedError=t.ParseRpcError=t.MethodNotSupportedRpcError=t.MethodNotFoundRpcError=t.LimitExceededRpcError=t.JsonRpcVersionUnsupportedError=t.InvalidRequestRpcError=t.InvalidParamsRpcError=t.InvalidInputRpcError=t.InternalRpcError=t.ChainDisconnectedError=t.MaxFeePerGasTooLowError=t.Eip1559FeesNotSupportedError=t.BaseFeeScalarError=t.CounterfactualDeploymentFailedError=t.RawContractError=t.ContractFunctionZeroDataError=t.ContractFunctionRevertedError=t.ContractFunctionExecutionError=t.CallExecutionError=t.BlockNotFoundError=t.setErrorConfig=t.BaseError=t.UnsupportedPackedAbiType=t.InvalidDefinitionTypeError=t.InvalidArrayError=t.InvalidAbiEncodingTypeError=t.InvalidAbiDecodingTypeError=t.DecodeLogTopicsMismatch=t.DecodeLogDataMismatch=t.BytesSizeMismatchError=t.AbiFunctionSignatureNotFoundError=t.AbiFunctionOutputsNotFoundError=t.AbiFunctionNotFoundError=t.AbiEventSignatureNotFoundError=t.AbiEventSignatureEmptyTopicsError=t.AbiEventNotFoundError=t.AbiErrorSignatureNotFoundError=t.AbiErrorNotFoundError=t.AbiErrorInputsNotFoundError=t.AbiEncodingBytesSizeMismatchError=t.AbiEncodingLengthMismatchError=void 0,t.AccountStateConflictError=t.UrlRequiredError=t.SliceOffsetOutOfBoundsError=t.SizeExceedsPaddingSizeError=t.WaitForTransactionReceiptTimeoutError=t.TransactionReceiptNotFoundError=t.TransactionNotFoundError=t.TransactionExecutionError=t.InvalidStorageKeySizeError=t.InvalidSerializedTransactionTypeError=t.InvalidSerializedTransactionError=t.InvalidSerializableTransactionError=t.InvalidLegacyVError=t.FeeConflictError=t.InvalidAddressError=t.WebSocketRequestError=t.SocketClosedError=t.TimeoutError=t.RpcRequestError=t.HttpRequestError=t.FilterTypeNotSupportedError=t.UnknownNodeError=t.TransactionTypeNotSupportedError=t.TipAboveFeeCapError=t.NonceTooLowError=t.NonceTooHighError=t.NonceMaxValueError=t.IntrinsicGasTooLowError=t.IntrinsicGasTooHighError=t.InsufficientFundsError=t.FeeCapTooLowError=t.FeeCapTooHighError=t.ExecutionRevertedError=t.EstimateGasExecutionError=t.InvalidDecimalNumberError=t.EnsAvatarUnsupportedNamespaceError=t.EnsAvatarInvalidNftUriError=t.EnsAvatarUriResolutionError=t.SizeOverflowError=t.InvalidHexValueError=t.InvalidHexBooleanError=t.IntegerOutOfRangeError=t.InvalidBytesBooleanError=t.InvalidChainIdError=t.ClientChainNotConfiguredError=t.ChainNotFoundError=t.ChainMismatchError=t.ChainDoesNotSupportContract=t.UserRejectedRequestError=t.UnsupportedProviderMethodError=void 0,t.recoverTransactionAddress=t.recoverPublicKey=t.recoverMessageAddress=t.recoverAddress=t.parseSignature=t.hexToSignature=t.parseCompactSignature=t.hexToCompactSignature=t.compactSignatureToSignature=t.hashTypedData=t.hashStruct=t.hashDomain=t.getTransactionType=t.getSerializedTransactionType=t.getCreateAddress=t.getCreate2Address=t.getContractAddress=t.getAbiItem=t.rpcTransactionType=t.formatTransactionRequest=t.defineTransactionRequest=t.formatTransactionReceipt=t.defineTransactionReceipt=t.transactionType=t.formatTransaction=t.defineTransaction=t.parseEventLogs=t.encodeFunctionResult=t.prepareEncodeFunctionData=t.encodeFunctionData=t.encodeEventTopics=t.encodeErrorResult=t.encodeDeployData=t.encodeAbiParameters=t.decodeFunctionResult=t.decodeFunctionData=t.decodeEventLog=t.decodeErrorResult=t.decodeDeployData=t.decodeAbiParameters=t.formatLog=t.formatBlock=t.defineBlock=t.namehash=t.labelhash=t.EIP1193ProviderRpcError=t.InvalidStructTypeError=t.InvalidPrimaryTypeError=t.InvalidDomainError=t.StateAssignmentC
317onflictError=void 0,t.concat=t.setupKzg=t.defineKzg=t.toBlobs=t.toBlobSidecars=t.fromBlobs=t.blobsToProofs=t.sidecarsToVersionedHashes=t.commitmentsToVersionedHashes=t.commitmentToVersionedHash=t.blobsToCommitments=t.offchainLookupSignature=t.offchainLookupAbiItem=t.offchainLookup=t.ccipFetch=t.ccipRequest=t.fromBytes=t.bytesToString=t.bytesToNumber=t.bytesToBool=t.bytesToBigInt=t.toHex=t.stringToHex=t.numberToHex=t.bytesToHex=t.boolToHex=t.toBytes=t.stringToBytes=t.numberToBytes=t.hexToBytes=t.boolToBytes=t.assertTransactionLegacy=t.assertTransactionEIP2930=t.assertTransactionEIP1559=t.assertRequest=t.serializeErc6492Signature=t.isErc6492Signature=t.parseErc6492Signature=t.verifyTypedData=t.verifyMessage=t.verifyHash=t.toRlp=t.hexToRlp=t.bytesToRlp=t.serializeSignature=t.signatureToHex=t.serializeCompactSignature=t.compactSignatureToHex=t.signatureToCompactSignature=t.recoverTypedDataAddress=void 0,t.serializeTransaction=t.serializeAccessList=t.parseUnits=t.parseTransaction=t.parseGwei=t.parseEther=t.padHex=t.padBytes=t.pad=t.ripemd160=t.sha256=t.keccak256=t.isHex=t.isHash=t.isBytes=t.isAddressEqual=t.isAddress=t.toPrefixedMessage=t.hashMessage=t.toFunctionHash=t.toEventHash=t.getFunctionSignature=t.toFunctionSignature=t.getEventSignature=t.toEventSignature=t.getFunctionSelector=t.toFunctionSelector=t.getEventSelector=t.toEventSelector=t.getContractError=t.getAddress=t.checksumAddress=t.fromRlp=t.hexToString=t.hexToNumber=t.hexToBool=t.hexToBigInt=t.fromHex=t.formatUnits=t.formatGwei=t.formatEther=t.withTimeout=t.withRetry=t.encodePacked=t.getChainContractAddress=t.extractChain=t.defineChain=t.assertCurrentChain=t.concatHex=t.concatBytes=void 0,t.nonceManager=t.createNonceManager=t.getTypesForEIP712Domain=t.domainSeparator=t.validateTypedData=t.serializeTypedData=t.trim=t.stringify=t.sliceHex=t.sliceBytes=t.slice=t.size=void 0;var e=vC();Object.defineProperty(t,"CircularReferenceError",{enumerable:!0,get:function(){return e.CircularReferenceError}}),Object.defineProperty(t,"InvalidAbiParameterError",{enumerable:!0,get:function(){return e.InvalidAbiParameterError}}),Object.defineProperty(t,"InvalidAbiParametersError",{enumerable:!0,get:function(){return e.InvalidAbiParametersError}}),Object.defineProperty(t,"InvalidAbiItemError",{enumerable:!0,get:function(){return e.InvalidAbiItemError}}),Object.defineProperty(t,"InvalidAbiTypeParameterError",{enumerable:!0,get:function(){return e.InvalidAbiTypeParameterError}}),Object.defineProperty(t,"InvalidFunctionModifierError",{enumerable:!0,get:function(){return e.InvalidFunctionModifierError}}),Object.defineProperty(t,"InvalidModifierError",{enumerable:!0,get:function(){return e.InvalidModifierError}}),Object.defineProperty(t,"InvalidParameterError",{enumerable:!0,get:function(){return e.InvalidParameterError}}),Object.defineProperty(t,"InvalidParenthesisError",{enumerable:!0,get:function(){return e.InvalidParenthesisError}}),Object.defineProperty(t,"InvalidSignatureError",{enumerable:!0,get:function(){return e.InvalidSignatureError}}),Object.defineProperty(t,"InvalidStructSignatureError",{enumerable:!0,get:function(){return e.InvalidStructSignatureError}}),Object.defineProperty(t,"SolidityProtectedKeywordError",{enumerable:!0,get:function(){return e.SolidityProtectedKeywordError}}),Object.defineProperty(t,"UnknownTypeError",{enumerable:!0,get:function(){return e.UnknownTypeError}}),Object.defineProperty(t,"UnknownSignatureError",{enumerable:!0,get:function(){return e.UnknownSignatureError}}),Object.defineProperty(t,"parseAbi",{enumerable:!0,get:function(){return e.parseAbi}}),Object.defineProperty(t,"parseAbiItem",{enumerable:!0,get:function(){return e.parseAbiItem}}),Object.defineProperty(t,"parseAbiParameter",{enumerable:!0,get:function(){return e.parseAbiParameter}}),Object.defineProperty(t,"parseAbiParameters",{enumerable:!0,get:function(){return e.parseAbiParameters}});var r=Wve();Object.defineProperty(t,"getContract",{enumerable:!0,get:function(){return r.getContract}});var n=FC();Object.defineProperty(t,"createClient",{enumerable:!0,get:function(){return n.createClient}}),Object.defineProperty(t,"rpcSchema",{enumerable:!0,get:function(){return n.rpcSchema}});var s=Gve();Object.defineProperty(t,"custom",{enumerable:!0,get:function(){return s.custom}});var i=Kve();Object.defineProperty(t,"fallback",{enumerable:!0,get:function(){return i.fallback}});var o=Zve();Object.defineProperty(t,"http",{enumerable:!0,get:function(){return o.http}});var a=oAe();Object.defineProperty(t,"createPublicClient",{enumerable:!0,get:function(){return a.createPublicClient}});var c=UAe();Object.defineProperty(t,"createTestClient",{enumerable:!0,get:function(){return c.createTestClient}});var u=UW();Object.defineProperty(t,"publicActions",{enumerable:!0,get:function(){return u.publicActions}});var l=MW();Object.defineProperty(t,"testActions",{enumerable:!0,get:function(){return l.testActions}});var d=$W();Object.defineProperty(t,"walletActions",{enumerable:!0,get:function(){return d.walletActions}});var f=Z0();Object.defineProperty(t,"createTransport",{enumerable:!0,get:function(){return f.createTransport}});var g=ZAe();Object.defineProperty(t,"createWalletClient",{enumerable:!0,get:function(){return g.createWalletClient}});var h=YAe();Object.defineProperty(t,"webSocket",{enumerable:!0,get:function(){return h.webSocket}});var p=sf();Object.defineProperty(t,"multicall3Abi",{enumerable:!0,get:function(){return p.multicall3Abi}}),Object.defineProperty(t,"erc20Abi",{enumerable:!0,get:function(){return p.erc20Abi}}),Object.defineProperty(t,"erc20Abi_bytes32",{enumerable:!0,get:function(){return p.erc20Abi_bytes32}}
317),Object.defineProperty(t,"erc721Abi",{enumerable:!0,get:function(){return p.erc721Abi}}),Object.defineProperty(t,"erc4626Abi",{enumerable:!0,get:function(){return p.erc4626Abi}}),Object.defineProperty(t,"universalSignatureValidatorAbi",{enumerable:!0,get:function(){return p.universalSignatureValidatorAbi}});var y=kW();Object.defineProperty(t,"ethAddress",{enumerable:!0,get:function(){return y.ethAddress}}),Object.defineProperty(t,"zeroAddress",{enumerable:!0,get:function(){return y.zeroAddress}});var w=UC();Object.defineProperty(t,"deploylessCallViaBytecodeBytecode",{enumerable:!0,get:function(){return w.deploylessCallViaBytecodeBytecode}}),Object.defineProperty(t,"deploylessCallViaFactoryBytecode",{enumerable:!0,get:function(){return w.deploylessCallViaFactoryBytecode}}),Object.defineProperty(t,"universalSignatureValidatorByteCode",{enumerable:!0,get:function(){return w.universalSignatureValidatorByteCode}});var I=B0();Object.defineProperty(t,"etherUnits",{enumerable:!0,get:function(){return I.etherUnits}}),Object.defineProperty(t,"gweiUnits",{enumerable:!0,get:function(){return I.gweiUnits}}),Object.defineProperty(t,"weiUnits",{enumerable:!0,get:function(){return I.weiUnits}});var v=mN();Object.defineProperty(t,"maxInt8",{enumerable:!0,get:function(){return v.maxInt8}}),Object.defineProperty(t,"maxInt16",{enumerable:!0,get:function(){return v.maxInt16}}),Object.defineProperty(t,"maxInt24",{enumerable:!0,get:function(){return v.maxInt24}}),Object.defineProperty(t,"maxInt32",{enumerable:!0,get:function(){return v.maxInt32}}),Object.defineProperty(t,"maxInt40",{enumerable:!0,get:function(){return v.maxInt40}}),Object.defineProperty(t,"maxInt48",{enumerable:!0,get:function(){return v.maxInt48}}),Object.defineProperty(t,"maxInt56",{enumerable:!0,get:function(){return v.maxInt56}}),Object.defineProperty(t,"maxInt64",{enumerable:!0,get:function(){return v.maxInt64}}),Object.defineProperty(t,"maxInt72",{enumerable:!0,get:function(){return v.maxInt72}}),Object.defineProperty(t,"maxInt80",{enumerable:!0,get:function(){return v.maxInt80}}),Object.defineProperty(t,"maxInt88",{enumerable:!0,get:function(){return v.maxInt88}}),Object.defineProperty(t,"maxInt96",{enumerable:!0,get:function(){return v.maxInt96}}),Object.defineProperty(t,"maxInt104",{enumerable:!0,get:function(){return v.maxInt104}}),Object.defineProperty(t,"maxInt112",{enumerable:!0,get:function(){return v.maxInt112}}),Object.defineProperty(t,"maxInt120",{enumerable:!0,get:function(){return v.maxInt120}}),Object.defineProperty(t,"maxInt128",{enumerable:!0,get:function(){return v.maxInt128}}),Object.defineProperty(t,"maxInt136",{enumerable:!0,get:function(){return v.maxInt136}}),Object.defineProperty(t,"maxInt144",{enumerable:!0,get:function(){return v.maxInt144}}),Object.defineProperty(t,"maxInt152",{enumerable:!0,get:function(){return v.maxInt152}}),Object.defineProperty(t,"maxInt160",{enumerable:!0,get:function(){return v.maxInt160}}),Object.defineProperty(t,"maxInt168",{enumerable:!0,get:function(){return v.maxInt168}}),Object.defineProperty(t,"maxInt176",{enumerable:!0,get:function(){return v.maxInt176}}),Object.defineProperty(t,"maxInt184",{enumerable:!0,get:function(){return v.maxInt184}}),Object.defineProperty(t,"maxInt192",{enumerable:!0,get:function(){return v.maxInt192}}),Object.defineProperty(t,"maxInt200",{enumerable:!0,get:function(){return v.maxInt200}}),Object.defineProperty(t,"maxInt208",{enumerable:!0,get:function(){return v.maxInt208}}),Object.defineProperty(t,"maxInt216",{enumerable:!0,get:function(){return v.maxInt216}}),Object.defineProperty(t,"maxInt224",{enumerable:!0,get:function(){return v.maxInt224}}),Object.defineProperty(t,"maxInt232",{enumerable:!0,get:function(){return v.maxInt232}}),Object.defineProperty(t,"maxInt240",{enumerable:!0,get:function(){return v.maxInt240}}),Object.defineProperty(t,"maxInt248",{enumerable:!0,get:function(){return v.maxInt248}}),Object.defineProperty(t,"maxInt256",{enumerable:!0,get:function(){return v.maxInt256}}),Object.defineProperty(t,"maxUint8",{enumerable:!0,get:function(){return v.maxUint8}}),Object.defineProperty(t,"maxUint16",{enumerable:!0,get:function(){return v.maxUint16}}),Object.defineProperty(t,"maxUint24",{enumerable:!0,get:function(){return v.maxUint24}}
317),Object.defineProperty(t,"maxUint32",{enumerable:!0,get:function(){return v.maxUint32}}),Object.defineProperty(t,"maxUint40",{enumerable:!0,get:function(){return v.maxUint40}}),Object.defineProperty(t,"maxUint48",{enumerable:!0,get:function(){return v.maxUint48}}),Object.defineProperty(t,"maxUint56",{enumerable:!0,get:function(){return v.maxUint56}}),Object.defineProperty(t,"maxUint64",{enumerable:!0,get:function(){return v.maxUint64}}),Object.defineProperty(t,"maxUint72",{enumerable:!0,get:function(){return v.maxUint72}}),Object.defineProperty(t,"maxUint80",{enumerable:!0,get:function(){return v.maxUint80}}),Object.defineProperty(t,"maxUint88",{enumerable:!0,get:function(){return v.maxUint88}}),Object.defineProperty(t,"maxUint96",{enumerable:!0,get:function(){return v.maxUint96}}),Object.defineProperty(t,"maxUint104",{enumerable:!0,get:function(){return v.maxUint104}}),Object.defineProperty(t,"maxUint112",{enumerable:!0,get:function(){return v.maxUint112}}),Object.defineProperty(t,"maxUint120",{enumerable:!0,get:function(){return v.maxUint120}}),Object.defineProperty(t,"maxUint128",{enumerable:!0,get:function(){return v.maxUint128}}),Object.defineProperty(t,"maxUint136",{enumerable:!0,get:function(){return v.maxUint136}}),Object.defineProperty(t,"maxUint144",{enumerable:!0,get:function(){return v.maxUint144}}),Object.defineProperty(t,"maxUint152",{enumerable:!0,get:function(){return v.maxUint152}}),Object.defineProperty(t,"maxUint160",{enumerable:!0,get:function(){return v.maxUint160}}),Object.defineProperty(t,"maxUint168",{enumerable:!0,get:function(){return v.maxUint168}}),Object.defineProperty(t,"maxUint176",{enumerable:!0,get:function(){return v.maxUint176}}),Object.defineProperty(t,"maxUint184",{enumerable:!0,get:function(){return v.maxUint184}}),Object.defineProperty(t,"maxUint192",{enumerable:!0,get:function(){return v.maxUint192}}),Object.defineProperty(t,"maxUint200",{enumerable:!0,get:function(){return v.maxUint200}}),Object.defineProperty(t,"maxUint208",{enumerable:!0,get:function(){return v.maxUint208}}),Object.defineProperty(t,"maxUint216",{enumerable:!0,get:function(){return v.maxUint216}}),Object.defineProperty(t,"maxUint224",{enumerable:!0,get:function(){return v.maxUint224}}),Object.defineProperty(t,"maxUint232",{enumerable:!0,get:function(){return v.maxUint232}}),Object.defineProperty(t,"maxUint240",{enumerable:!0,get:function(){return v.maxUint240}}),Object.defineProperty(t,"maxUint248",{enumerable:!0,get:function(){return v.maxUint248}}),Object.defineProperty(t,"maxUint256",{enumerable:!0,get:function(){return v.maxUint256}}),Object.defineProperty(t,"minInt8",{enumerable:!0,get:function(){return v.minInt8}}),Object.defineProperty(t,"minInt16",{enumerable:!0,get:function(){return v.minInt16}}),Object.defineProperty(t,"minInt24",{enumerable:!0,get:function(){return v.minInt24}}),Object.defineProperty(t,"minInt32",{enumerable:!0,get:function(){return v.minInt32}}),Object.defineProperty(t,"minInt40",{enumerable:!0,get:function(){return v.minInt40}}),Object.defineProperty(t,"minInt48",{enumerable:!0,get:function(){return v.minInt48}}),Object.defineProperty(t,"minInt56",{enumerable:!0,get:function(){return v.minInt56}}),Object.defineProperty(t,"minInt64",{enumerable:!0,get:function(){return v.minInt64}}),Object.defineProperty(t,"minInt72",{enumerable:!0,get:function(){return v.minInt72}}),Object.defineProperty(t,"minInt80",{enumerable:!0,get:function(){return v.minInt80}}),Object.defineProperty(t,"minInt88",{enumerable:!0,get:function(){return v.minInt88}}),Object.defineProperty(t,"minInt96",{enumerable:!0,get:function(){return v.minInt96}}),Object.defineProperty(t,"minInt104",{enumerable:!0,get:function(){return v.minInt104}}),Object.defineProperty(t,"minInt112",{enumerable:!0,get:function(){return v.minInt112}}),Object.defineProperty(t,"minInt120",{enumerable:!0,get:function(){return v.minInt120}}),Object.defineProperty(t,"minInt128",{enumerable:!0,get:function(){return v.minInt128}}),Object.defineProperty(t,"minInt136",{enumerable:!0,get:function(){return v.minInt136}}),Object.defineProperty(t,"minInt144",{enumerable:!0,get:function(){return v.minInt144}}),Object.defineProperty(t,"minInt152",{enumerable:!0,get:function(){return v.minInt152}}),Object.defineProperty(t,"minInt160",{enumerable:!0,get:function(){return v.minInt160}}),Object.defineProperty(t,"minInt168",{enumerable:!0,get:function(){return v.minInt168}}),Object.defineProperty(t,"minInt176",{enumerable:!0,get:function(){return v.minInt176}}),Object.defineProperty(t,"minInt184",{enumerable:!0,get:function(){return v.minInt184}}),Object.defineProperty(t,"minInt192",{enumerable:!0,get:function(){return v.minInt192}}),Object.defineProperty(t,"minInt200",{enumerable:!0,get:function(){return v.minInt200}}),Object.defineProperty(t,"minInt208",{enumerable:!0,get:function(){return v.minInt208}}),Object.defineProperty(t,"minInt216",{enumerable:!0,get:function(){return v.minInt216}}),Object.defineProperty(t,"minInt224",{enumerable:!0,get:function(){return v.minInt224}}),Object.defineProperty(t,"minInt232",{enumerable:!0,get:function(){return v.minInt232}}),Object.defineProperty(t,"minInt240",{enumerable:!0,get:function(){return v.minInt240}}),Object.defineProperty(t,"minInt248",{enumerable:!0,get:function(){return v.minInt248}}),Object.defineProperty(t,"minInt256",{enumerable:!0,get:function(){return v.minInt256}});var E=WN();Object.defineProperty(t,"zeroHash",{enumerable:!0,get:function(){return E.zeroHash}});var b=uW();Object.defineProperty(t,"presignMessagePrefix",{enumerable:!0,get:function(){return b.presignMessagePrefix}});var m=lr();Object.defineProperty(t,"AbiConstructorNotFoundError",{enumerable:!0,get:function(){return m.AbiConstructorNotFoundError}}),Object.defineProperty(t,"AbiConstructorParamsNotFoundError",{enumerable:!0,get:function(){return m.AbiConstructorParamsNotFoundError}}),Object.defineProperty(t,"AbiDecodingDataSizeInvalidError",{enumerable:!0,get:function(){return m.AbiDecodingDataSizeInvalidError}}),Object.defineProperty(t,"AbiDecodingDataSizeTooSmallError",{enumerable:!0,get:function(){return m.AbiDecodingDataSizeTooSmallError}}),Object.defineProperty(t,"AbiDecodingZeroDataError",{enumerable:!0,get:function(){return m.AbiDecodingZeroDataError}}
317),Object.defineProperty(t,"AbiEncodingArrayLengthMismatchError",{enumerable:!0,get:function(){return m.AbiEncodingArrayLengthMismatchError}}),Object.defineProperty(t,"AbiEncodingLengthMismatchError",{enumerable:!0,get:function(){return m.AbiEncodingLengthMismatchError}}),Object.defineProperty(t,"AbiEncodingBytesSizeMismatchError",{enumerable:!0,get:function(){return m.AbiEncodingBytesSizeMismatchError}}),Object.defineProperty(t,"AbiErrorInputsNotFoundError",{enumerable:!0,get:function(){return m.AbiErrorInputsNotFoundError}}),Object.defineProperty(t,"AbiErrorNotFoundError",{enumerable:!0,get:function(){return m.AbiErrorNotFoundError}}),Object.defineProperty(t,"AbiErrorSignatureNotFoundError",{enumerable:!0,get:function(){return m.AbiErrorSignatureNotFoundError}}),Object.defineProperty(t,"AbiEventNotFoundError",{enumerable:!0,get:function(){return m.AbiEventNotFoundError}}),Object.defineProperty(t,"AbiEventSignatureEmptyTopicsError",{enumerable:!0,get:function(){return m.AbiEventSignatureEmptyTopicsError}}),Object.defineProperty(t,"AbiEventSignatureNotFoundError",{enumerable:!0,get:function(){return m.AbiEventSignatureNotFoundError}}),Object.defineProperty(t,"AbiFunctionNotFoundError",{enumerable:!0,get:function(){return m.AbiFunctionNotFoundError}}),Object.defineProperty(t,"AbiFunctionOutputsNotFoundError",{enumerable:!0,get:function(){return m.AbiFunctionOutputsNotFoundError}}),Object.defineProperty(t,"AbiFunctionSignatureNotFoundError",{enumerable:!0,get:function(){return m.AbiFunctionSignatureNotFoundError}}),Object.defineProperty(t,"BytesSizeMismatchError",{enumerable:!0,get:function(){return m.BytesSizeMismatchError}}),Object.defineProperty(t,"DecodeLogDataMismatch",{enumerable:!0,get:function(){return m.DecodeLogDataMismatch}}),Object.defineProperty(t,"DecodeLogTopicsMismatch",{enumerable:!0,get:function(){return m.DecodeLogTopicsMismatch}}),Object.defineProperty(t,"InvalidAbiDecodingTypeError",{enumerable:!0,get:function(){return m.InvalidAbiDecodingTypeError}}),Object.defineProperty(t,"InvalidAbiEncodingTypeError",{enumerable:!0,get:function(){return m.InvalidAbiEncodingTypeError}}),Object.defineProperty(t,"InvalidArrayError",{enumerable:!0,get:function(){return m.InvalidArrayError}}),Object.defineProperty(t,"InvalidDefinitionTypeError",{enumerable:!0,get:function(){return m.InvalidDefinitionTypeError}}),Object.defineProperty(t,"UnsupportedPackedAbiType",{enumerable:!0,get:function(){return m.UnsupportedPackedAbiType}});var _=ut();Object.defineProperty(t,"BaseError",{enumerable:!0,get:function(){return _.BaseError}}),Object.defineProperty(t,"setErrorConfig",{enumerable:!0,get:function(){return _.setErrorConfig}});var O=yN();Object.defineProperty(t,"BlockNotFoundError",{enumerable:!0,get:function(){return O.BlockNotFoundError}});var C=zu();Object.defineProperty(t,"CallExecutionError",{enumerable:!0,get:function(){return C.CallExecutionError}}),Object.defineProperty(t,"ContractFunctionExecutionError",{enumerable:!0,get:function(){return C.ContractFunctionExecutionError}}),Object.defineProperty(t,"ContractFunctionRevertedError",{enumerable:!0,get:function(){return C.ContractFunctionRevertedError}}),Object.defineProperty(t,"ContractFunctionZeroDataError",{enumerable:!0,get:function(){return C.ContractFunctionZeroDataError}}),Object.defineProperty(t,"RawContractError",{enumerable:!0,get:function(){return C.RawContractError}}),Object.defineProperty(t,"CounterfactualDeploymentFailedError",{enumerable:!0,get:function(){return C.CounterfactualDeploymentFailedError}});var S=NC();Object.defineProperty(t,"BaseFeeScalarError",{enumerable:!0,get:function(){return S.BaseFeeScalarError}}),Object.defineProperty(t,"Eip1559FeesNotSupportedError",{enumerable:!0,get:function(){return S.Eip1559FeesNotSupportedError}}),Object.defineProperty(t,"MaxFeePerGasTooLowError",{enumerable:!0,get:function(){return S.MaxFeePerGasTooLowError}});var T=nf();Object.defineProperty(t,"ChainDisconnectedError",{enumerable:!0,get:function(){return T.ChainDisconnectedError}}),Object.defineProperty(t,"InternalRpcError",{enumerable:!0,get:function(){return T.InternalRpcError}}),Object.defineProperty(t,"InvalidInputRpcError",{enumerable:!0,get:function(){return T.InvalidInputRpcError}}),Object.defineProperty(t,"InvalidParamsRpcError",{enumerable:!0,get:function(){return T.InvalidParamsRpcError}}),Object.defineProperty(t,"InvalidRequestRpcError",{enumerable:!0,get:function(){return T.InvalidRequestRpcError}}),Object.defineProperty(t,"JsonRpcVersionUnsupportedError",{enumerable:!0,get:function(){return T.JsonRpcVersionUnsupportedError}}),Object.defineProperty(t,"LimitExceededRpcError",{enumerable:!0,get:function(){return T.LimitExceededRpcError}}),Object.defineProperty(t,"MethodNotFoundRpcError",{enumerable:!0,get:function(){return T.MethodNotFoundRpcError}}),Object.defineProperty(t,"MethodNotSupportedRpcError",{enumerable:!0,get:function(){return T.MethodNotSupportedRpcError}}),Object.defineProperty(t,"ParseRpcError",{enumerable:!0,get:function(){return T.ParseRpcError}}),Object.defineProperty(t,"ProviderDisconnectedError",{enumerable:!0,get:function(){return T.ProviderDisconnectedError}}),Object.defineProperty(t,"ProviderRpcError",{enumerable:!0,get:function(){return T.ProviderRpcError}}),Object.defineProperty(t,"ResourceNotFoundRpcError",{enumerable:!0,get:function(){return T.ResourceNotFoundRpcError}}),Object.defineProperty(t,"ResourceUnavailableRpcError",{enumerable:!0,get:function(){return T.ResourceUnavailableRpcError}}),Object.defineProperty(t,"RpcError",{enumerable:!0,get:function(){return T.RpcError}}),Object.defineProperty(t,"SwitchChainError",{enumerable:!0,get:function(){return T.SwitchChainError}}),Object.defineProperty(t,"TransactionRejectedRpcError",{enumerable:!0,get:function(){return T.TransactionRejectedRpcError}}),Object.defineProperty(t,"UnauthorizedProviderError",{enumerable:!0,get:function(){return T.UnauthorizedProviderError}}),Object.defineProperty(t,"UnknownRpcError",{enumerable:!0,get:function(){return T.UnknownRpcError}}),Object.defineProperty(t,"UnsupportedProviderMethodError",{enumerable:!0,get:function(){return T.UnsupportedProviderMethodError}}),Object.defineProperty(t,"UserRejectedRequestError",{enumerable:!0,get:function(){return T.UserRejectedRequestError}});var N=q0();Object.defineProperty(t,"ChainDoesNotSupportContract",{enumerable:!0,get:function(){return N.ChainDoesNotSupportContract}}),Object.defineProperty(t,"ChainMismatchError",{enumerable:!0,get:function(){return N.ChainMismatchError}}),Object.defineProperty(t,"ChainNotFoundError",{enumerable:!0,get:function(){return N.ChainNotFoundError}}),Object.defineProperty(t,"ClientChainNotConfiguredError",{enumerable:!0,get:function(){return N.ClientChainNotConfiguredError}}),Object.defineProperty(t,"InvalidChainIdError",{enumerable:!0,get:function(){return N.InvalidChainIdError}});var R=jp();Object.defineProperty(t,"InvalidBytesBooleanError",{enumerable:!0,get:function(){return R.InvalidBytesBooleanError}}),Object.defineProperty(t,"IntegerOutOfRangeError",{enumerable:!0,get:function(){return R.IntegerOutOfRangeError}}),Object.defineProperty(t,"InvalidHexBooleanError",{enumerable:!0,get:function(){return R.InvalidHexBooleanError}}),Object.defineProperty(t,"InvalidHexValueError",{enumerable:!0,get:function(){return R.InvalidHexValueError}}),Object.defineProperty(t,"SizeOverflowError",{enumerable:!0,get:function(){return R.SizeOverflowError}});var B=qz();Object.defineProperty(t,"EnsAvatarUriResolutionError",{enumerable:!0,get:function(){return B.EnsAvatarUriResolutionError}}),Object.defineProperty(t,"EnsAvatarInvalidNftUriError",{enumerable:!0,get:function(){return B.EnsAvatarInvalidNftUriError}}),Object.defineProperty(t,"EnsAvatarUnsupportedNamespaceError",{enumerable:!0,get:function(){return B.EnsAvatarUnsupportedNamespaceError}});var A=gW();Object.defineProperty(t,"InvalidDecimalNumberError",{enumerable:!0,get:function(){return A.InvalidDecimalNumberError}});var P=Cz();Object.defineProperty(t,"EstimateGasExecutionError",{enumerable:!0,get:function(){return P.EstimateGasExecutionError}});var k=pc();Object.defineProperty(t,"ExecutionRevertedError",{enumerable:!0,get:function(){return k.ExecutionRevertedError}}),Object.defineProperty(t,"FeeCapTooHighError",{enumerable:!0,get:function(){return k.FeeCapTooHighError}}),Object.defineProperty(t,"FeeCapTooLowError",{enumerable:!0,get:function(){return k.FeeCapTooLowError}}),Object.defineProperty(t,"InsufficientFundsError",{enumerable:!0,get:function(){return k.InsufficientFundsError}}),Object.defineProperty(t,"IntrinsicGasTooHighError",{enumerable:!0,get:function(){return k.IntrinsicGasTooHighError}}),Object.defineProperty(t,"IntrinsicGasTooLowError",{enumerable:!0,get:function(){return k.IntrinsicGasTooLowError}}),Object.defineProperty(t,"NonceMaxValueError",{enumerable:!0,get:function(){return k.NonceMaxValueError}}),Object.defineProperty(t,"NonceTooHighError",{enumerable:!0,get:function(){return k.NonceTooHighError}}),Object.defineProperty(t,"NonceTooLowError",{enumerable:!0,get:function(){return k.NonceTooLowError}}),Object.defineProperty(t,"TipAboveFeeCapError",{enumerable:!0,get:function(){return k.TipAboveFeeCapError}}),Object.defineProperty(t,"TransactionTypeNotSupportedError",{enumerable:!0,get:function(){return k.TransactionTypeNotSupportedError}}),Object.defineProperty(t,"UnknownNodeError",{enumerable:!0,get:function(){return k.UnknownNodeError}});var U=gz();Object.defineProperty(t,"FilterTypeNotSupportedError",{enumerable:!0,get:function(){return U.FilterTypeNotSupportedError}});var x=no();Object.defineProperty(t,"HttpRequestError",{enumerable:!0,get:function(){return x.HttpRequestError}}),Object.defineProperty(t,"RpcRequestError",{enumerable:!0,get:function(){return x.RpcRequestError}}),Object.defineProperty(t,"TimeoutError",{enumerable:!0,get:function(){return x.TimeoutError}}),Object.defineProperty(t,"SocketClosedError",{enumerable:!0,get:function(){return x.SocketClosedError}}),Object.defineProperty(t,"WebSocketRequestError",{enumerable:!0,get:function(){return x.WebSocketRequestError}});var j=eo();Object.defineProperty(t,"InvalidAddressError",{enumerable:!0,get:function(){return j.InvalidAddressError}});var D=Zs();Object.defineProperty(t,"FeeConflictError",{enumerable:!0,get:function(){return D.FeeConflictError}}),Object.defineProperty(t,"InvalidLegacyVError",{enumerable:!0,get:function(){return D.InvalidLegacyVError}}),Object.defineProperty(t,"InvalidSerializableTransactionError",{enumerable:!0,get:function(){return D.InvalidSerializableTransactionError}}),Object.defineProperty(t,"InvalidSerializedTransactionError",{enumerable:!0,get:function(){return D.InvalidSerializedTransactionError}}),Object.defineProperty(t,"InvalidSerializedTransactionTypeError",{enumerable:!0,get:function(){return D.InvalidSerializedTransactionTypeError}}),Object.defineProperty(t,"InvalidStorageKeySizeError",{enumerable:!0,get:function(){return D.InvalidStorageKeySizeError}}),Object.defineProperty(t,"TransactionExecutionError",{enumerable:!0,get:function(){return D.TransactionExecutionError}}),Object.defineProperty(t,"TransactionNotFoundError",{enumerable:!0,get:function(){return D.TransactionNotFoundError}}),Object.defineProperty(t,"TransactionReceiptNotFoundError",{enumerable:!0,get:function(){return D.TransactionReceiptNotFoundError}}),Object.defineProperty(t,"WaitForTransactionReceiptTimeoutError",{enumerable:!0,get:function(){return D.WaitForTransactionReceiptTimeoutError}});var M=_C();Object.defineProperty(t,"SizeExceedsPaddingSizeError",{enumerable:!0,get:function(){return M.SizeExceedsPaddingSizeError}}),Object.defineProperty(t,"SliceOffsetOutOfBoundsError",{enumerable:!0,get:function(){return M.SliceOffsetOutOfBoundsError}});var L=BN();Object.defineProperty(t,"UrlRequiredError",{enumerable:!0,get:function(){return L.UrlRequiredError}});var H=fN();Object.defineProperty(t,"AccountStateConflictError",{enumerable:!0,get:function(){return H.AccountStateConflictError}}
317),Object.defineProperty(t,"StateAssignmentConflictError",{enumerable:!0,get:function(){return H.StateAssignmentConflictError}});var z=Qz();Object.defineProperty(t,"InvalidDomainError",{enumerable:!0,get:function(){return z.InvalidDomainError}}),Object.defineProperty(t,"InvalidPrimaryTypeError",{enumerable:!0,get:function(){return z.InvalidPrimaryTypeError}}),Object.defineProperty(t,"InvalidStructTypeError",{enumerable:!0,get:function(){return z.InvalidStructTypeError}});var V=JAe();Object.defineProperty(t,"EIP1193ProviderRpcError",{enumerable:!0,get:function(){return V.ProviderRpcError}});var G=Hz();Object.defineProperty(t,"labelhash",{enumerable:!0,get:function(){return G.labelhash}});var ee=UN();Object.defineProperty(t,"namehash",{enumerable:!0,get:function(){return ee.namehash}});var X=xC();Object.defineProperty(t,"defineBlock",{enumerable:!0,get:function(){return X.defineBlock}}),Object.defineProperty(t,"formatBlock",{enumerable:!0,get:function(){return X.formatBlock}});var oe=bc();Object.defineProperty(t,"formatLog",{enumerable:!0,get:function(){return oe.formatLog}});var te=qu();Object.defineProperty(t,"decodeAbiParameters",{enumerable:!0,get:function(){return te.decodeAbiParameters}});var fe=QAe();Object.defineProperty(t,"decodeDeployData",{enumerable:!0,get:function(){return fe.decodeDeployData}});var Se=TC();Object.defineProperty(t,"decodeErrorResult",{enumerable:!0,get:function(){return Se.decodeErrorResult}});var le=F0();Object.defineProperty(t,"decodeEventLog",{enumerable:!0,get:function(){return le.decodeEventLog}});var we=Xz();Object.defineProperty(t,"decodeFunctionData",{enumerable:!0,get:function(){return we.decodeFunctionData}});var ve=wc();Object.defineProperty(t,"decodeFunctionResult",{enumerable:!0,get:function(){return ve.decodeFunctionResult}});var ae=ro();Object.defineProperty(t,"encodeAbiParameters",{enumerable:!0,get:function(){return ae.encodeAbiParameters}});var re=z0();Object.defineProperty(t,"encodeDeployData",{enumerable:!0,get:function(){return re.encodeDeployData}});var wt=eW();Object.defineProperty(t,"encodeErrorResult",{enumerable:!0,get:function(){return wt.encodeErrorResult}});var Ot=tf();Object.defineProperty(t,"encodeEventTopics",{enumerable:!0,get:function(){return Ot.encodeEventTopics}});var pt=yi();Object.defineProperty(t,"encodeFunctionData",{enumerable:!0,get:function(){return pt.encodeFunctionData}});var nr=mz();Object.defineProperty(t,"prepareEncodeFunctionData",{enumerable:!0,get:function(){return nr.prepareEncodeFunctionData}});var Jt=tW();Object.defineProperty(t,"encodeFunctionResult",{enumerable:!0,get:function(){return Jt.encodeFunctionResult}});var sr=H0();Object.defineProperty(t,"parseEventLogs",{enumerable:!0,get:function(){return sr.parseEventLogs}});var ie=$0();Object.defineProperty(t,"defineTransaction",{enumerable:!0,get:function(){return ie.defineTransaction}}),Object.defineProperty(t,"formatTransaction",{enumerable:!0,get:function(){return ie.formatTransaction}}),Object.defineProperty(t,"transactionType",{enumerable:!0,get:function(){return ie.transactionType}});var de=LN();Object.defineProperty(t,"defineTransactionReceipt",{enumerable:!0,get:function(){return de.defineTransactionReceipt}}),Object.defineProperty(t,"formatTransactionReceipt",{enumerable:!0,get:function(){return de.formatTransactionReceipt}});var Ce=gc();Object.defineProperty(t,"defineTransactionRequest",{enumerable:!0,get:function(){return Ce.defineTransactionRequest}}),Object.defineProperty(t,"formatTransactionRequest",{enumerable:!0,get:function(){return Ce.formatTransactionRequest}}),Object.defineProperty(t,"rpcTransactionType",{enumerable:!0,get:function(){return Ce.rpcTransactionType}});var ze=hc();Object.defineProperty(t,"getAbiItem",{enumerable:!0,get:function(){return ze.getAbiItem}});var Ut=nW();Object.defineProperty(t,"getContractAddress",{enumerable:!0,get:function(){return Ut.getContractAddress}}),Object.defineProperty(t,"getCreate2Address",{enumerable:!0,get:function(){return Ut.getCreate2Address}}),Object.defineProperty(t,"getCreateAddress",{enumerable:!0,get:function(){return Ut.getCreateAddress}});var es=GN();Object.defineProperty(t,"getSerializedTransactionType",{enumerable:!0,get:function(){return es.getSerializedTransactionType}});var Vo=jC();Object.defineProperty(t,"getTransactionType",{enumerable:!0,get:function(){return Vo.getTransactionType}});var Ss=Y0();Object.defineProperty(t,"hashDomain",{enumerable:!0,get:function(){return Ss.hashDomain}}),Object.defineProperty(t,"hashStruct",{enumerable:!0,get:function(){return Ss.hashStruct}}),Object.defineProperty(t,"hashTypedData",{enumerable:!0,get:function(){return Ss.hashTypedData}
317});var Go=XAe();Object.defineProperty(t,"compactSignatureToSignature",{enumerable:!0,get:function(){return Go.compactSignatureToSignature}});var io=eCe();Object.defineProperty(t,"hexToCompactSignature",{enumerable:!0,get:function(){return io.parseCompactSignature}}),Object.defineProperty(t,"parseCompactSignature",{enumerable:!0,get:function(){return io.parseCompactSignature}});var bi=tCe();Object.defineProperty(t,"hexToSignature",{enumerable:!0,get:function(){return bi.parseSignature}}),Object.defineProperty(t,"parseSignature",{enumerable:!0,get:function(){return bi.parseSignature}});var QC=Vu();Object.defineProperty(t,"recoverAddress",{enumerable:!0,get:function(){return QC.recoverAddress}});var X0=qN();Object.defineProperty(t,"recoverMessageAddress",{enumerable:!0,get:function(){return X0.recoverMessageAddress}});var XC=pN();Object.defineProperty(t,"recoverPublicKey",{enumerable:!0,get:function(){return XC.recoverPublicKey}});var e2=rCe();Object.defineProperty(t,"recoverTransactionAddress",{enumerable:!0,get:function(){return e2.recoverTransactionAddress}});var t2=zN();Object.defineProperty(t,"recoverTypedDataAddress",{enumerable:!0,get:function(){return t2.recoverTypedDataAddress}});var r2=nCe();Object.defineProperty(t,"signatureToCompactSignature",{enumerable:!0,get:function(){return r2.signatureToCompactSignature}});var eb=sCe();Object.defineProperty(t,"compactSignatureToHex",{enumerable:!0,get:function(){return eb.serializeCompactSignature}}),Object.defineProperty(t,"serializeCompactSignature",{enumerable:!0,get:function(){return eb.serializeCompactSignature}});var tb=jW();Object.defineProperty(t,"signatureToHex",{enumerable:!0,get:function(){return tb.serializeSignature}}),Object.defineProperty(t,"serializeSignature",{enumerable:!0,get:function(){return tb.serializeSignature}});var Hp=D0();Object.defineProperty(t,"bytesToRlp",{enumerable:!0,get:function(){return Hp.bytesToRlp}}),Object.defineProperty(t,"hexToRlp",{enumerable:!0,get:function(){return Hp.hexToRlp}}),Object.defineProperty(t,"toRlp",{enumerable:!0,get:function(){return Hp.toRlp}});var n2=dW();Object.defineProperty(t,"verifyHash",{enumerable:!0,get:function(){return n2.verifyHash}});var s2=fW();Object.defineProperty(t,"verifyMessage",{enumerable:!0,get:function(){return s2.verifyMessage}});var i2=hW();Object.defineProperty(t,"verifyTypedData",{enumerable:!0,get:function(){return i2.verifyTypedData}});var o2=pW();Object.defineProperty(t,"parseErc6492Signature",{enumerable:!0,get:function(){return o2.parseErc6492Signature}});var a2=zC();Object.defineProperty(t,"isErc6492Signature",{enumerable:!0,get:function(){return a2.isErc6492Signature}});var c2=VN();Object.defineProperty(t,"serializeErc6492Signature",{enumerable:!0,get:function(){return c2.serializeErc6492Signature}});var u2=mc();Object.defineProperty(t,"assertRequest",{enumerable:!0,get:function(){return u2.assertRequest}});var Ku=WC();Object.defineProperty(t,"assertTransactionEIP1559",{enumerable:!0,get:function(){return Ku.assertTransactionEIP1559}}),Object.defineProperty(t,"assertTransactionEIP2930",{enumerable:!0,get:function(){return Ku.assertTransactionEIP2930}}),Object.defineProperty(t,"assertTransactionLegacy",{enumerable:!0,get:function(){return Ku.assertTransactionLegacy}});var Zu=Yt();Object.defineProperty(t,"boolToBytes",{enumerable:!0,get:function(){return Zu.boolToBytes}}),Object.defineProperty(t,"hexToBytes",{enumerable:!0,get:function(){return Zu.hexToBytes}}),Object.defineProperty(t,"numberToBytes",{enumerable:!0,get:function(){return Zu.numberToBytes}}),Object.defineProperty(t,"stringToBytes",{enumerable:!0,get:function(){return Zu.stringToBytes}}),Object.defineProperty(t,"toBytes",{enumerable:!0,get:function(){return Zu.toBytes}});var Yu=Be();Object.defineProperty(t,"boolToHex",{enumerable:!0,get:function(){return Yu.boolToHex}}),Object.defineProperty(t,"bytesToHex",{enumerable:!0,get:function(){return Yu.bytesToHex}}),Object.defineProperty(t,"numberToHex",{enumerable:!0,get:function(){return Yu.numberToHex}}),Object.defineProperty(t,"stringToHex",{enumerable:!0,get:function(){return Yu.stringToHex}}),Object.defineProperty(t,"toHex",{enumerable:!0,get:function(){return Yu.toHex}});var Ju=dN();Object.defineProperty(t,"bytesToBigInt",{enumerable:!0,get:function(){return Ju.bytesToBigInt}}),Object.defineProperty(t,"bytesToBool",{enumerable:!0,get:function(){return Ju.bytesToBool}}),Object.defineProperty(t,"bytesToNumber",{enumerable:!0,get:function(){return Ju.bytesToNumber}}),Object.defineProperty(t,"bytesToString",{enumerable:!0,get:function(){return Ju.bytesToString}}),Object.defineProperty(t,"fromBytes",{enumerable:!0,get:function(){return Ju.fromBytes}});var Qu=PN();Object.defineProperty(t,"ccipRequest",{enumerable:!0,get:function(){return Qu.ccipRequest}}),Object.defineProperty(t,"ccipFetch",{enumerable:!0,get:function(){return Qu.ccipRequest}}),Object.defineProperty(t,"offchainLookup",{enumerable:!0,get:function(){return Qu.offchainLookup}}),Object.defineProperty(t,"offchainLookupAbiItem",{enumerable:!0,get:function(){return Qu.offchainLookupAbiItem}}),Object.defineProperty(t,"offchainLookupSignature",{enumerable:!0,get:function(){return Qu.offchainLookupSignature}});var l2=RC();Object.defineProperty(t,"blobsToCommitments",{enumerable:!0,get:function(){return l2.blobsToCommitments}});var d2=vN();Object.defineProperty(t,"commitmentToVersionedHash",{enumerable:!0,get:function(){return d2.commitmentToVersionedHash}});var f2=_N();Object.defineProperty(t,"commitmentsToVersionedHashes",{enumerable:!0,get:function(){return f2.commitmentsToVersionedHashes}});var h2=iCe();Object.defineProperty(t,"sidecarsToVersionedHashes",{enumerable:!0,get:function(){return h2.sidecarsToVersionedHashes}});
317var p2=BC();Object.defineProperty(t,"blobsToProofs",{enumerable:!0,get:function(){return p2.blobsToProofs}});var rb=oCe();Object.defineProperty(t,"fromBlobs",{enumerable:!0,get:function(){return rb.fromBlobs}});var WW=kC();Object.defineProperty(t,"toBlobSidecars",{enumerable:!0,get:function(){return WW.toBlobSidecars}});var VW=Nz();Object.defineProperty(t,"toBlobs",{enumerable:!0,get:function(){return VW.toBlobs}});var GW=LW();Object.defineProperty(t,"defineKzg",{enumerable:!0,get:function(){return GW.defineKzg}});var KW=aCe();Object.defineProperty(t,"setupKzg",{enumerable:!0,get:function(){return KW.setupKzg}});var g2=Xn();Object.defineProperty(t,"concat",{enumerable:!0,get:function(){return g2.concat}}),Object.defineProperty(t,"concatBytes",{enumerable:!0,get:function(){return g2.concatBytes}}),Object.defineProperty(t,"concatHex",{enumerable:!0,get:function(){return g2.concatHex}});var ZW=LC();Object.defineProperty(t,"assertCurrentChain",{enumerable:!0,get:function(){return ZW.assertCurrentChain}});var YW=Kz();Object.defineProperty(t,"defineChain",{enumerable:!0,get:function(){return YW.defineChain}});var JW=Zz();Object.defineProperty(t,"extractChain",{enumerable:!0,get:function(){return JW.extractChain}});var QW=Gu();Object.defineProperty(t,"getChainContractAddress",{enumerable:!0,get:function(){return QW.getChainContractAddress}});var XW=rW();Object.defineProperty(t,"encodePacked",{enumerable:!0,get:function(){return XW.encodePacked}});var eV=RN();Object.defineProperty(t,"withRetry",{enumerable:!0,get:function(){return eV.withRetry}});var tV=kN();Object.defineProperty(t,"withTimeout",{enumerable:!0,get:function(){return tV.withTimeout}});var rV=k0();Object.defineProperty(t,"formatEther",{enumerable:!0,get:function(){return rV.formatEther}});var nV=rf();Object.defineProperty(t,"formatGwei",{enumerable:!0,get:function(){return nV.formatGwei}});var sV=PC();Object.defineProperty(t,"formatUnits",{enumerable:!0,get:function(){return sV.formatUnits}});var qp=Lr();Object.defineProperty(t,"fromHex",{enumerable:!0,get:function(){return qp.fromHex}}),Object.defineProperty(t,"hexToBigInt",{enumerable:!0,get:function(){return qp.hexToBigInt}}),Object.defineProperty(t,"hexToBool",{enumerable:!0,get:function(){return qp.hexToBool}}),Object.defineProperty(t,"hexToNumber",{enumerable:!0,get:function(){return qp.hexToNumber}}),Object.defineProperty(t,"hexToString",{enumerable:!0,get:function(){return qp.hexToString}});var iV=FN();Object.defineProperty(t,"fromRlp",{enumerable:!0,get:function(){return iV.fromRlp}});var ax=mi();Object.defineProperty(t,"checksumAddress",{enumerable:!0,get:function(){return ax.checksumAddress}}),Object.defineProperty(t,"getAddress",{enumerable:!0,get:function(){return ax.getAddress}});var oV=Wu();Object.defineProperty(t,"getContractError",{enumerable:!0,get:function(){return oV.getContractError}});var cx=Dp();Object.defineProperty(t,"toEventSelector",{enumerable:!0,get:function(){return cx.toEventSelector}}),Object.defineProperty(t,"getEventSelector",{enumerable:!0,get:function(){return cx.toEventSelector}});var ux=ef();Object.defineProperty(t,"toFunctionSelector",{enumerable:!0,get:function(){return ux.toFunctionSelector}}),Object.defineProperty(t,"getFunctionSelector",{enumerable:!0,get:function(){return ux.toFunctionSelector}});var lx=sW();Object.defineProperty(t,"toEventSignature",{enumerable:!0,get:function(){return lx.toEventSignature}}),Object.defineProperty(t,"getEventSignature",{enumerable:!0,get:function(){return lx.toEventSignature}});var dx=iW();Object.defineProperty(t,"toFunctionSignature",{enumerable:!0,get:function(){return dx.toFunctionSignature}}),Object.defineProperty(t,"getFunctionSignature",{enumerable:!0,get:function(){return dx.toFunctionSignature}});var aV=oW();Object.defineProperty(t,"toEventHash",{enumerable:!0,get:function(){return aV.toEventHash}});var cV=aW();Object.defineProperty(t,"toFunctionHash",{enumerable:!0,get:function(){return cV.toFunctionHash}});var uV=J0();Object.defineProperty(t,"hashMessage",{enumerable:!0,get:function(){return uV.hashMessage}});var lV=lW();Object.defineProperty(t,"toPrefixedMessage",{enumerable:!0,get:function(){return lV.toPrefixedMessage}});var dV=Ks();Object.defineProperty(t,"isAddress",{enumerable:!0,get:function(){return dV.isAddress}});var fV=yc();Object.defineProperty(t,"isAddressEqual",{enumerable:!0,get:function(){return fV.isAddressEqual}});var hV=$N();Object.defineProperty(t,"isBytes",{enumerable:!0,get:function(){return hV.isBytes}});var pV=HN();Object.defineProperty(t,"isHash",{enumerable:!0,get:function(){return pV.isHash}});var gV=Qn();Object.defineProperty(t,"isHex",{enumerable:!0,get:function(){return gV.isHex}});var mV=Is();Object.defineProperty(t,"keccak256",{enumerable:!0,get:function(){return m
317V.keccak256}});var yV=EN();Object.defineProperty(t,"sha256",{enumerable:!0,get:function(){return yV.sha256}});var bV=cW();Object.defineProperty(t,"ripemd160",{enumerable:!0,get:function(){return bV.ripemd160}});var m2=Fu();Object.defineProperty(t,"pad",{enumerable:!0,get:function(){return m2.pad}}),Object.defineProperty(t,"padBytes",{enumerable:!0,get:function(){return m2.padBytes}}),Object.defineProperty(t,"padHex",{enumerable:!0,get:function(){return m2.padHex}});var wV=mW();Object.defineProperty(t,"parseEther",{enumerable:!0,get:function(){return wV.parseEther}});var EV=yW();Object.defineProperty(t,"parseGwei",{enumerable:!0,get:function(){return EV.parseGwei}});var vV=KN();Object.defineProperty(t,"parseTransaction",{enumerable:!0,get:function(){return vV.parseTransaction}});var _V=GC();Object.defineProperty(t,"parseUnits",{enumerable:!0,get:function(){return _V.parseUnits}});var AV=ZN();Object.defineProperty(t,"serializeAccessList",{enumerable:!0,get:function(){return AV.serializeAccessList}});var CV=VC();Object.defineProperty(t,"serializeTransaction",{enumerable:!0,get:function(){return CV.serializeTransaction}});var IV=Gs();Object.defineProperty(t,"size",{enumerable:!0,get:function(){return IV.size}});var y2=to();Object.defineProperty(t,"slice",{enumerable:!0,get:function(){return y2.slice}}),Object.defineProperty(t,"sliceBytes",{enumerable:!0,get:function(){return y2.sliceBytes}}),Object.defineProperty(t,"sliceHex",{enumerable:!0,get:function(){return y2.sliceHex}});var SV=xn();Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return SV.stringify}});var TV=Hu();Object.defineProperty(t,"trim",{enumerable:!0,get:function(){return TV.trim}});var nb=qC();Object.defineProperty(t,"serializeTypedData",{enumerable:!0,get:function(){return nb.serializeTypedData}}),Object.defineProperty(t,"validateTypedData",{enumerable:!0,get:function(){return nb.validateTypedData}}),Object.defineProperty(t,"domainSeparator",{enumerable:!0,get:function(){return nb.domainSeparator}}),Object.defineProperty(t,"getTypesForEIP712Domain",{enumerable:!0,get:function(){return nb.getTypesForEIP712Domain}});var fx=bW();Object.defineProperty(t,"createNonceManager",{enumerable:!0,get:function(){return fx.createNonceManager}}),Object.defineProperty(t,"nonceManager",{enumerable:!0,get:function(){return fx.nonceManager}})}(hS)),hS}var Il={},N$;function uCe(){if(N$)return Il;N$=1,Object.defineProperty(Il,"__esModule",{value:!0}),Il.MAGIC_VALUE_BYTES=Il.MAGIC_VALUE=void 0;const t="0x1626ba7e";Il.MAGIC_VALUE=t;const e="0x20c13b0b";return Il.MAGIC_VALUE_BYTES=e,Il}var r_={},ym={},Sl={},x$;function FW(){if(x$)return Sl;x$=1,Object.defineProperty(Sl,"__esModule",{value:!0}),Sl.PermissionsError=Sl.PERMISSIONS_REQUEST_REJECTED=void 0,Sl.PERMISSIONS_REQUEST_REJECTED=4001;class t extends Error{constructor(r,n,s){super(r),this.code=n,this.data=s,Object.setPrototypeOf(this,t.prototype)}}return Sl.PermissionsError=t,Sl}var R$;function HW(){if(R$)return ym;R$=1,Object.defineProperty(ym,"__esModule",{value:!0}),ym.Wallet=void 0;const t=Qd(),e=FW();class r{constructor(s){this.communicator=s}async getPermissions(){return(await this.communicator.send(t.Methods.wallet_getPermissions,void 0)).data}async requestPermissions(s){if(!this.isPermissionRequestValid(s))throw new e.PermissionsError("Permissions request is invalid",e.PERMISSIONS_REQUEST_REJECTED);try{return(await this.communicator.send(t.Methods.wallet_requestPermissions,s)).data}catch{throw new e.PermissionsError("Permissions rejected",e.PERMISSIONS_REQUEST_REJECTED)}}isPermissionRequestValid(s){return s.every(i=>typeof i=="object"?Object.keys(i).every(o=>!!Object.values(t.RestrictedMethods).includes(o)):!1)}}return ym.Wallet=r,ym}var B$;function lCe(){if(B$)return r_;B$=1,Object.defineProperty(r_,"__esModule",{value:!0});const t=HW(),e=FW(),r=(s,i)=>i.some(o=>o.parentCapability===s),n=()=>(s,i,o)=>{const a=o.value;return o.value=async function(){const c=new t.Wallet(this.communicator);let u=await c.getPermissions();if(r(i,u)||(u=await c.requestPermissions([{[i]:{}}])),!r(i,u))throw new e.PermissionsError("Permissions rejected",e.PERMISSIONS_REQUEST_REJECTED);return a.apply(this)},o};return r_.default=n,r_}var k$;function dCe(){if(k$)return ca;k$=1;var t=ca&&ca.__decorate||function(u,l,d,f){var g=arguments.length,h=g<3?l:f===null?f=Object.getOwnPropertyDescriptor(l,d):f,p;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")h=Reflect.decorate(u,l,d,f);else for(var y=u.length-1;y>=0;y--)(p=u[y])&&(h=(g<3?p(h):g>3?p(l,d,h):p(l,d))||h);return g>3&&h&&Object.defineProperty(l,d,h),h}
317,e=ca&&ca.__importDefault||function(u){return u&&u.__esModule?u:{default:u}};Object.defineProperty(ca,"__esModule",{value:!0}),ca.Safe=void 0;const r=cCe(),n=uCe(),s=Qd(),i=oN(),o=iN(),a=e(lCe());class c{constructor(l){this.communicator=l}async getChainInfo(){return(await this.communicator.send(s.Methods.getChainInfo,void 0)).data}async getInfo(){return(await this.communicator.send(s.Methods.getSafeInfo,void 0)).data}async experimental_getBalances({currency:l="usd"}={}){return(await this.communicator.send(s.Methods.getSafeBalances,{currency:l})).data}async check1271Signature(l,d="0x"){const f=await this.getInfo(),g=(0,r.encodeFunctionData)({abi:[{constant:!1,inputs:[{name:"_dataHash",type:"bytes32"},{name:"_signature",type:"bytes"}],name:"isValidSignature",outputs:[{name:"",type:"bytes4"}],payable:!1,stateMutability:"nonpayable",type:"function"}],functionName:"isValidSignature",args:[l,d]}),h={call:i.RPC_CALLS.eth_call,params:[{to:f.safeAddress,data:g},"latest"]};try{return(await this.communicator.send(s.Methods.rpcCall,h)).data.slice(0,10).toLowerCase()===n.MAGIC_VALUE}catch{return!1}}async check1271SignatureBytes(l,d="0x"){const f=await this.getInfo(),g=(0,r.encodeFunctionData)({abi:[{constant:!1,inputs:[{name:"_data",type:"bytes"},{name:"_signature",type:"bytes"}],name:"isValidSignature",outputs:[{name:"",type:"bytes4"}],payable:!1,stateMutability:"nonpayable",type:"function"}],functionName:"isValidSignature",args:[l,d]}),h={call:i.RPC_CALLS.eth_call,params:[{to:f.safeAddress,data:g},"latest"]};try{return(await this.communicator.send(s.Methods.rpcCall,h)).data.slice(0,10).toLowerCase()===n.MAGIC_VALUE_BYTES}catch{return!1}}calculateMessageHash(l){return(0,r.hashMessage)(l)}calculateTypedMessageHash(l){const d=typeof l.domain.chainId=="object"?l.domain.chainId.toNumber():Number(l.domain.chainId);let f=l.primaryType;if(!f){const g=Object.values(l.types),h=Object.keys(l.types).filter(p=>g.every(y=>y.every(({type:w})=>w.replace("[","").replace("]","")!==p)));if(h.length===0||h.length>1)throw new Error("Please specify primaryType");f=h[0]}return(0,r.hashTypedData)({message:l.message,domain:{...l.domain,chainId:d,verifyingContract:l.domain.verifyingContract,salt:l.domain.salt},types:l.types,primaryType:f})}async getOffChainSignature(l){return(await this.communicator.send(s.Methods.getOffChainSignature,l)).data}async isMessageSigned(l,d="0x"){let f;if(typeof l=="string"&&(f=async()=>{const g=this.calculateMessageHash(l);return await this.isMessageHashSigned(g,d)}),(0,o.isObjectEIP712TypedData)(l)&&(f=async()=>{const g=this.calculateTypedMessageHash(l);return await this.isMessageHashSigned(g,d)}),f)return await f();throw new Error("Invalid message type")}async isMessageHashSigned(l,d="0x"){const f=[this.check1271Signature.bind(this),this.check1271SignatureBytes.bind(this)];for(const g of f)if(await g(l,d))return!0;return!1}async getEnvironmentInfo(){return(await this.communicator.send(s.Methods.getEnvironmentInfo,void 0)).data}async requestAddressBook(){return(await this.communicator.send(s.Methods.requestAddressBook,void 0)).data}}return ca.Safe=c,t([(0,a.default)()],c.prototype,"requestAddressBook",null),ca}var j$;function D$(){if(j$)return vf;j$=1;var t=vf&&vf.__importDefault||function(a){return a&&a.__esModule?a:{default:a}};Object.defineProperty(vf,"__esModule",{value:!0});const e=t(tve()),r=Eve(),n=vve(),s=dCe(),i=HW();class o{constructor(c={}){const{allowedDomains:u=null,debug:l=!1}=c;this.communicator=new e.default(u,l),this.eth=new n.Eth(this.communicator),this.txs=new r.TXs(this.communicator),this.safe=new s.Safe(this.communicator),this.wallet=new i.Wallet(this.communicator)}}return vf.default=o,vf}var U$;function fCe(){return U$||(U$=1,function(t){var e=sa&&sa.__createBinding||(Object.create?function(o,a,c,u){u===void 0&&(u=c);var l=Object.getOwnPropertyDescriptor(a,c);(!l||("get"in l?!a.__esModule:l.writable||l.configurable))&&(l={enumerable:!0,get:function(){return a[c]}}),Object.defineProperty(o,u,l)}:function(o,a,c,u){u===void 0&&(u=c),o[u]=a[c]}),r=sa&&sa.__exportStar||function(o,a){for(var c in o)c!=="default"&&!Object.prototype.hasOwnProperty.call(a,c)&&e(a,o,c)},n=sa&&sa.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};
317Object.defineProperty(t,"__esModule",{value:!0}),t.getSDKVersion=void 0;const s=n(D$());t.default=s.default,r(D$(),t),r(iN(),t),r(Qd(),t),r(uz(),t);var i=cz();Object.defineProperty(t,"getSDKVersion",{enumerable:!0,get:function(){return i.getSDKVersion}}),r(oN(),t)}(sa)),sa}var Tl={},M$;function hCe(){if(M$)return Tl;M$=1,Object.defineProperty(Tl,"__esModule",{value:!0}),Tl.numberToHex=Tl.getLowerCase=void 0;function t(r){return r&&r.toLowerCase()}Tl.getLowerCase=t;function e(r){return`0x${r.toString(16)}`}return Tl.numberToHex=e,Tl}var $$;function pCe(){if($$)return fg;$$=1,Object.defineProperty(fg,"__esModule",{value:!0}),fg.SafeAppProvider=void 0;const t=fCe(),e=rF(),r=hCe();class n extends e.EventEmitter{constructor(i,o){super(),this.submittedTxs=new Map,this.safe=i,this.sdk=o}async connect(){this.emit("connect",{chainId:this.chainId})}async disconnect(){}get chainId(){return this.safe.chainId}async request(i){var c,u,l,d;const{method:o,params:a=[]}=i;switch(o){case"eth_accounts":return[this.safe.safeAddress];case"net_version":case"eth_chainId":return(0,r.numberToHex)(this.chainId);case"personal_sign":{const[y,w]=a;if(this.safe.safeAddress.toLowerCase()!==w.toLowerCase())throw new Error("The address or message hash is invalid");const I=await this.sdk.txs.signMessage(y);return("signature"in I?I.signature:void 0)||"0x"}case"eth_sign":{const[y,w]=a;if(this.safe.safeAddress.toLowerCase()!==y.toLowerCase()||!w.startsWith("0x"))throw new Error("The address or message hash is invalid");const I=await this.sdk.txs.signMessage(w);return("signature"in I?I.signature:void 0)||"0x"}case"eth_signTypedData":case"eth_signTypedData_v4":{const[y,w]=a,I=typeof w=="string"?JSON.parse(w):w;if(this.safe.safeAddress.toLowerCase()!==y.toLowerCase())throw new Error("The address is invalid");const v=await this.sdk.txs.signTypedMessage(I);return("signature"in v?v.signature:void 0)||"0x"}case"eth_sendTransaction":const f={...a[0],value:a[0].value||"0",data:a[0].data||"0x"};typeof f.gas=="string"&&f.gas.startsWith("0x")&&(f.gas=parseInt(f.gas,16));const g=await this.sdk.txs.send({txs:[f],params:{safeTxGas:f.gas}});return this.submittedTxs.set(g.safeTxHash,{from:this.safe.safeAddress,hash:g.safeTxHash,gas:0,gasPrice:"0x00",nonce:0,input:f.data,value:f.value,to:f.to,blockHash:null,blockNumber:null,transactionIndex:null}),g.safeTxHash;case"eth_blockNumber":return(await this.sdk.eth.getBlockByNumber(["latest"])).number;case"eth_getBalance":return this.sdk.eth.getBalance([(0,r.getLowerCase)(a[0]),a[1]]);case"eth_getCode":return this.sdk.eth.getCode([(0,r.getLowerCase)(a[0]),a[1]]);case"eth_getTransactionCount":return this.sdk.eth.getTransactionCount([(0,r.getLowerCase)(a[0]),a[1]]);case"eth_getStorageAt":return this.sdk.eth.getStorageAt([(0,r.getLowerCase)(a[0]),a[1],a[2]]);case"eth_getBlockByNumber":return this.sdk.eth.getBlockByNumber([a[0],a[1]]);case"eth_getBlockByHash":return this.sdk.eth.getBlockByHash([a[0],a[1]]);case"eth_getTransactionByHash":let p=a[0];try{p=(await this.sdk.txs.getBySafeTxHash(p)).txHash||p}catch{}return this.submittedTxs.has(p)?this.submittedTxs.get(p):this.sdk.eth.getTransactionByHash([p]).then(y=>(y&&(y.hash=a[0]),y));case"eth_getTransactionReceipt":{let y=a[0];try{y=(await this.sdk.txs.getBySafeTxHash(y)).txHash||y}catch{}return this.sdk.eth.getTransactionReceipt([y]).then(w=>(w&&(w.transactionHash=a[0]),w))}case"eth_estimateGas":return this.sdk.eth.getEstimateGas(a[0]);case"eth_call":return this.sdk.eth.call([a[0],a[1]]);case"eth_getLogs":return this.sdk.eth.getPastLogs([a[0]]);case"eth_gasPrice":return this.sdk.eth.getGasPrice();case"wallet_getPermissions":return this.sdk.wallet.getPermissions();case"wallet_requestPermissions":return this.sdk.wallet.requestPermissions(a[0]);case"safe_setSettings":return this.sdk.eth.setSafeSettings([a[0]]);case"wallet_sendCalls":{const{from:y,calls:w,chainId:I}=a[0];if(I!==(0,r.numberToHex)(this.chainId))throw new Error(`Safe is not on chain ${I}`);if(y!==this.safe.safeAddress)throw Error("Invalid from address");const v=w.map((m,_)=>{if(!m.to)throw new Error(`Invalid call #${_}: missing "to" field`);return{to:m.to,data:m.data??"0x",value:m.value??(0,r.numberToHex)(0)}}),{safeTxHash:E}=await this.sdk.txs.send({txs:v});return{id:E}}case"wallet_getCallsStatus":{const y=a[0],w={[t.TransactionStatus.AWAITING_CONFIRMATIONS]:100,[t.TransactionStatus.AWAITING_EXECUTION]:100,[t.TransactionStatus.SUCCESS]:200,[t.TransactionStatus.CANCELLED]:400,[t.TransactionStatus.FAILED]:500}
317,I=await this.sdk.txs.getBySafeTxHash(y),v={version:"1.0",id:y,chainId:(0,r.numberToHex)(this.chainId),status:w[I.txStatus]};if(!I.txHash)return v;const E=await this.sdk.eth.getTransactionReceipt([I.txHash]);if(!E)return v;const b=((u=(c=I.txData)==null?void 0:c.dataDecoded)==null?void 0:u.method)!=="multiSend"?1:((d=(l=I.txData.dataDecoded.parameters)==null?void 0:l[0].valueDecoded)==null?void 0:d.length)??1,m=Number(E.blockNumber),_=Number(E.gasUsed);return v.receipts=Array(b).fill({logs:E.logs,status:(0,r.numberToHex)(I.txStatus===t.TransactionStatus.SUCCESS?1:0),blockHash:E.blockHash,blockNumber:(0,r.numberToHex)(m),gasUsed:(0,r.numberToHex)(_),transactionHash:I.txHash}),v}case"wallet_showCallsStatus":throw new Error(`"${i.method}" not supported`);case"wallet_getCapabilities":return{[(0,r.numberToHex)(this.chainId)]:{atomicBatch:{supported:!0}}};default:throw Error(`"${i.method}" not implemented`)}}send(i,o){i||o("Undefined request"),this.request(i).then(a=>o(null,{jsonrpc:"2.0",id:i.id,result:a})).catch(a=>o(a,null))}}return fg.SafeAppProvider=n,fg}var L$;function gCe(){return L$||(L$=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.SafeAppProvider=void 0;var e=pCe();Object.defineProperty(t,"SafeAppProvider",{enumerable:!0,get:function(){return e.SafeAppProvider}})}(aS)),aS}var mCe=gCe();class yCe extends mCe.SafeAppProvider{request(e){return e.method==="eth_requestAccounts"?this.request({method:"eth_accounts",params:[]}):super.request(e)}}class bCe extends yC{async initialize(){const{default:e}=await Wr(async()=>{const{default:i}=await import("./index-BQaIjDHO.js");return{default:i}},__vite__mapDeps([61,2,3,5,7])),r=new e,n=await r.safe.getInfo(),s=new yCe(n,r);await s.connect().catch(i=>{console.info("Failed to auto-connect to Safe:",i)}),this.provider=s,this.initialized=!0}async getProvider(){return Promise.resolve(this.provider)}}class wCe extends yC{async initialize(){if(!(typeof window>"u")&&window.ethereum)return this.provider=window.ethereum,this.initialized=!0,Promise.resolve()}}const $f={signMessage:async(t,e,r)=>{if(!e)throw new Error("signMessage - provider is undefined");const n=zt(t)?t:De(Fo(t));return await e.request({method:"personal_sign",params:[n,r]})},estimateGas:async(t,e,r,n)=>{if(!e)throw new Error("estimateGas - provider is undefined");if(!r)throw new Error("estimateGas - address is undefined");if(t.chainNamespace&&t.chainNamespace!=="eip155")throw new Error("estimateGas - chainNamespace is not eip155");const s={from:t.address,to:t.to,data:t.data,type:0},i=new oS(e,n);return await new yh(i,r).estimateGas(s)},sendTransaction:async(t,e,r,n)=>{if(!e)throw new Error("sendTransaction - provider is undefined");if(!r)throw new Error("sendTransaction - address is undefined");if(t.chainNamespace&&t.chainNamespace!=="eip155")throw new Error("sendTransaction - chainNamespace is not eip155");const s={to:t.to,value:t.value,gasLimit:t.gas,gasPrice:t.gasPrice,data:t.data,type:0},i=new oS(e,n),c=await(await new yh(i,r).sendTransaction(s)).wait();return(c==null?void 0:c.hash)||null},writeContract:async(t,e,r,n)=>{if(!e)throw new Error("writeContract - provider is undefined");if(!r)throw new Error("writeContract - address is undefined");const s=new oS(e,n),i=new yh(s,r),o=new mh(t.tokenAddress,t.abi,i);if(!o||!t.method)throw new Error("Contract method is undefined");const a=o[t.method];if(a)return await a(...t.args);throw new Error("Contract method is undefined")},parseWalletCapabilities:t=>{try{return JSON.parse(t)}catch{throw new Error("Error parsing wallet capabilities")}},parseUnits:q0e,formatUnits:Tq};class ECe extends rq{constructor(){super({adapterType:Y.ADAPTER_TYPES.ETHERS,namespace:Y.CHAIN.EVM}),this.balancePromises={},this.ethersProviders={}}async createEthersConfig(){const{metadata:e,enableCoinbase:r,enableBaseAccount:n,enableInjected:s,enableEIP6963:i}=se.state;if(e){if(s!==!1){const o=new wCe;await o.initialize(),this.ethersProviders.injected=o}if(n!==!1&&(this.ethersProviders.baseAccount=new QEe),r!==!1&&(this.ethersProviders.coinbaseWallet=new XEe),be.isSafeApp()){const o=new bCe;await o.initialize(),this.ethersProviders.safe=o}return{...this.ethersProviders,EIP6963:i!==!1,metadata:e}}}async signMessage(e){const{message:r,address:n,provider:s}=e;if(!s)throw new Error("Provider is undefined");try{return{signature:await $f.signMessage(r,s,n)}}catch{throw new Error("EthersAdapter:signMessage - Sign message failed")}}async sendTransaction(e){var s,i;if(!e.provider)throw new Error("Provider is undefined");const r=(s=q.getAccountData(Y.CHAIN.EVM))==null?void 0:s.address;if(!r)throw new Error("Address is undefined");return{hash:await $f.sendTransaction({value:Number.isNaN(Number(e.value))?BigInt(0):BigInt(e.value),to:e.to,data:e.data?e.data:"0x",gas:e.gas?BigInt(e.gas):void 0,gasPrice:e.gasPrice?BigInt(e.gasPrice):void 0,address:r},e.provider,r,Number((i=e.caipNetwork)==null?void 0:i.id))}}async writeContract(e){var s;if(!e.provider)throw new Error("Provider is undefined");const{address:r}=Rr.parseCaipAddress(e.caipAddress);return{hash:await $f.writeContract(e,e.provider,r,Number((s=e.caipNetwork)==null?void 0:s.id))}}async estimateGas(e){const{provider:r,caipNetwork:n,address:s}=e;if(!r)throw new Error("Provider is undefined");try{return{gas:await $f.estimateGas({data:e.data,to:e.to,address:s},r,s,Number(n==null?void 0:n.id))}}catch{throw new Error("EthersAdapter:estimateGas - Estimate gas failed")}}parseUnits(e){return $f.parseUnits(e.value,e.decimals)}formatUnits(e){return $f.formatUnits(e.value,e.decimals)}async syncConnection(e){const{id:r,chainId:n}=e,s=this.connectors.find(c=>c.id===r),i=s==null?void 0:s.provider;if(!i)throw new Error("Provider not found");const o=await i.request({method:"eth_requestAccounts"}),a=await i.request({method:"eth_chainId"});
317if(this.listenProviderEvents(r,i),!o[0])throw new Error("No accounts found");if(!(s!=null&&s.type))throw new Error("Connector type not found");return{address:this.toChecksummedAddress(o[0]),chainId:Number(a)||Number(n),provider:i,type:s.type,id:r}}async syncConnectors(){var n;this.ethersConfig=await this.createEthersConfig(),(n=this.ethersConfig)!=null&&n.EIP6963&&this.listenInjectedConnector(!0);const r=Object.keys(this.ethersConfig||{}).filter(s=>s!=="metadata"&&s!=="EIP6963").map(async s=>{var o;const i=s===Y.CONNECTOR_ID.INJECTED;if(this.namespace){const a=this.ethersProviders[s];this.addConnector({id:s,explorerId:Hs.ConnectorExplorerIds[s],imageUrl:(o=qs.state.connectorImages)==null?void 0:o[s],name:Hs.ConnectorNamesMap[s]||"Unknown",imageId:Hs.ConnectorImageIds[s],type:Hs.ConnectorTypesMap[s]??"EXTERNAL",info:i?void 0:{rdns:s},chain:this.namespace,chains:[],provider:await(a==null?void 0:a.getProvider())})}});await Promise.all(r)}async disconnectAll(){return{connections:await Promise.all(this.connections.map(async r=>{const n=this.connectors.find(s=>zi.isLowerCaseMatch(s.id,r.connectorId));if(!n)throw new Error("Connector not found");return await this.disconnect({id:n.id}),r}))}}async writeSolanaTransaction(){return Promise.resolve({hash:""})}async syncConnections({connectToFirstConnector:e}){const r=this.getCaipNetworks();await Promise.all(this.connectors.filter(n=>{const{hasDisconnected:s,hasConnected:i}=zi.getConnectorStorageInfo(n.id,this.namespace);return!s&&i}).map(async n=>{if(n.id===Y.CONNECTOR_ID.WALLET_CONNECT){const s=Lo.getWalletConnectAccounts(this.universalProvider,this.namespace),i=r.find(o=>{var a,c;return o.chainNamespace===this.namespace&&o.id.toString()===((c=(a=s[0])==null?void 0:a.chainId)==null?void 0:c.toString())});s.length>0&&this.addConnection({connectorId:n.id,accounts:s.map(o=>({address:o.address})),caipNetwork:i})}else{const{accounts:s,chainId:i}=await an.fetchProviderData(n);if(s.length>0&&i){const o=r.find(a=>a.chainNamespace===this.namespace&&a.id.toString()===i.toString());this.addConnection({connectorId:n.id,accounts:s.map(a=>({address:a})),caipNetwork:o}),n.provider&&n.id!==Y.CONNECTOR_ID.AUTH&&n.id!==Y.CONNECTOR_ID.WALLET_CONNECT&&this.listenProviderEvents(n.id,n.provider)}}})),e&&this.emitFirstAvailableConnection()}async setUniversalProvider(e){this.universalProvider=e;const r=Y.CONNECTOR_ID.WALLET_CONNECT;return Lo.listenWcProvider({universalProvider:e,namespace:Y.CHAIN.EVM,onConnect:n=>this.onConnect(n,r),onDisconnect:()=>this.onDisconnect(r),onAccountsChanged:n=>this.onAccountsChanged(n,r,!1),onChainChanged:n=>this.onChainChanged(n,r)}),this.addConnector(new nq({provider:e,caipNetworks:this.getCaipNetworks(),namespace:Y.CHAIN.EVM})),Promise.resolve()}eip6963EventHandler(e){var r;if(e.detail){const{info:n,provider:s}=e.detail;if(!((r=this.connectors)==null?void 0:r.find(o=>o.name===(n==null?void 0:n.name)))){const o=Hs.ConnectorTypesMap[Y.CONNECTOR_ID.EIP6963],a=(n==null?void 0:n.rdns)||(n==null?void 0:n.name)||(n==null?void 0:n.uuid);this.namespace&&a&&this.addConnector({id:a,type:o,explorerId:Hs.ConnectorExplorerIds[n.rdns||""]??Hs.ConnectorExplorerIds[n.name||""],imageUrl:n==null?void 0:n.icon,name:(n==null?void 0:n.name)||"Unknown",provider:s,info:n,chain:this.namespace,chains:[]})}}}listenInjectedConnector(e){if(typeof window<"u"&&e){const r=this.eip6963EventHandler.bind(this);window.addEventListener(Y.EIP6963_ANNOUNCE_EVENT,r),window.dispatchEvent(new Event(Y.EIP6963_REQUEST_EVENT))}}async connect({id:e,address:r,type:n,chainId:s,socialUri:i}){try{const o=this.connectors.find(f=>zi.isLowerCaseMatch(f.id,e));if(!o)throw new Error("Connector not found");const a=this.getConnection({address:r,connectorId:e,connections:this.connections,connectors:this.connectors});if(a){const f=a.caipNetwork;if(!f)throw new Error("EthersAdapter:connect - could not find the caipNetwork to connect");if(a.account){const g=this.ethersProviders[o.id];return!o.provider&&g&&(await g.initialize(),o.provider=await g.getProvider()),this.emit("accountChanged",{address:this.toChecksummedAddress(a.account.address),chainId:f.id,connector:o}),{address:this.toChecksummedAddress(a.account.address),chainId:f.id,provider:o.provider,type:o.type,id:e}}}let c=o==null?void 0:o.provider;const u=this.ethersProviders[o.id];if(u&&(await u.initialize(),c=await u.getProvider()),!c)throw new Error("Provider not found");o.provider=c;let l=[],d;if(n===Y.CONNECTOR_TYPE_AUTH){const{address:f,accounts:g}=await Sn.authConnectorAuthenticate({authConnector:c,chainNamespace:Y.CHAIN.EVM,chainId:s,socialUri:i,preferredAccountType:qn("eip155")}),h=this.getCaipNetworks().find(p=>p.id.toString()===(s==null?void 0:s.toString()));l=[f],this.addConnection({connectorId:e,accounts:g?g.map(p=>({address:p.address})):l.map(p=>({address:p})),caipNetwork:h,auth:{name:ce.getConnectedSocialProvider(),username:ce.getConnectedSocialUsername()}}
317),this.emit("accountChanged",{address:this.toChecksummedAddress(l[0]),chainId:Number(s),connector:o})}else{l=await c.request({method:"eth_requestAccounts"}),d=await c.request({method:"eth_chainId"});const f=this.getCaipNetworks().find(g=>g.id.toString()===(s==null?void 0:s.toString()));if(d!==s){if(!f)throw new Error("EthersAdapter:connect - could not find the caipNetwork to switch");try{await(c==null?void 0:c.request({method:"wallet_switchEthereumChain",params:[{chainId:bh.numberToHexString(f.id)}]}))}catch{throw new Error("EthersAdapter:connect - Switch network failed")}}this.emit("accountChanged",{address:this.toChecksummedAddress(l[0]),chainId:Number(s),connector:o}),this.addConnection({connectorId:e,accounts:l.map(g=>({address:g})),caipNetwork:f}),o.id!==Y.CONNECTOR_ID.WALLET_CONNECT&&this.listenProviderEvents(e,c)}return{address:this.toChecksummedAddress(l[0]),chainId:Number(s),provider:c,type:n,id:e}}catch(o){throw Oo.isUserRejectedRequestError(o)?new MP(o):o}}async reconnect(e){const{id:r,chainId:n}=e,s=this.connectors.find(i=>i.id===r);s&&s.type==="AUTH"&&n&&await Sn.authConnectorAuthenticate({authConnector:s.provider,chainNamespace:Y.CHAIN.EVM,chainId:n,preferredAccountType:qn("eip155")})}async getAccounts(e){const r=this.connectors.find(a=>a.id===e.id),n=r==null?void 0:r.provider;if(!n||!r)throw new Error("Provider not found");const s=this.getConnection({connectorId:e.id,connections:this.connections,connectors:this.connectors});if(s&&s.caipNetwork)return{accounts:s.accounts.map(({address:a})=>{var c;return be.createAccount({caipAddress:`${(c=s==null?void 0:s.caipNetwork)==null?void 0:c.caipNetworkId}:${a}`,type:"eoa"})})};if(e.id===Y.CONNECTOR_ID.AUTH){const a=r.provider;if(!a.user)return{accounts:[]};const{accounts:c,address:u,chainId:l}=a.user;return Promise.resolve({accounts:(c||[{address:u,type:"eoa"}]).map(d=>be.createAccount({caipAddress:`eip155:${l}:${d.address}`,type:d.type}))})}const i=await n.request({method:"eth_requestAccounts"}),o=q.getActiveCaipNetwork(this.namespace);return{accounts:o?i.map(a=>be.createAccount({caipAddress:`${o==null?void 0:o.caipNetworkId}:${a}`,type:"eoa"})):[]}}async disconnect(e){var r;if(e.id){const n=this.connectors.find(i=>zi.isLowerCaseMatch(i.id,e.id));if(!n)throw new Error("Connector not found");const s=this.getConnection({connectorId:e.id,connections:this.connections,connectors:this.connectors});switch(n.type){case Y.CONNECTOR_TYPE_WALLET_CONNECT:n.provider.session&&n.provider.disconnect();break;case Y.CONNECTOR_TYPE_AUTH:await((r=n.provider)==null?void 0:r.disconnect());break;case Y.CONNECTOR_TYPE_ANNOUNCED:case Y.CONNECTOR_TYPE_EXTERNAL:await this.revokeProviderPermissions(n.provider);break;default:throw new Error("Unsupported provider type")}return n.id&&(this.removeProviderListeners(n.id),this.deleteConnection(n.id)),this.connections.length===0?this.emit("disconnect"):this.emitFirstAvailableConnection(),{connections:s?[s]:[]}}return this.disconnectAll()}async getBalance(e){const r=e.address,n=this.getCaipNetworks().find(s=>{var i;return s.id.toString()===((i=e.chainId)==null?void 0:i.toString())});if(!r)return Promise.resolve({balance:"0.00",symbol:"ETH"});if(n&&n.chainNamespace===Y.CHAIN.EVM){const s=`${n.caipNetworkId}:${r}`,i=this.balancePromises[s];if(i)return i;const o=ce.getNativeBalanceCacheForCaipAddress(s);if(o)return{balance:o.balance,symbol:o.symbol};const a=new YEe(n.rpcUrls.default.http[0],{chainId:n.id,name:n.name});if(a)try{return this.balancePromises[s]=new Promise(async c=>{try{const u=await a.getBalance(r),l=z0e(u);ce.updateNativeBalanceCache({caipAddress:s,balance:l,symbol:n.nativeCurrency.symbol,timestamp:Date.now()}),c({balance:l,symbol:n.nativeCurrency.symbol})}catch{c({balance:"0.00",symbol:"ETH"})}}).finally(()=>{delete this.balancePromises[s]}),this.balancePromises[s]||{balance:"0.00",symbol:"ETH"}}catch{return{balance:"0.00",symbol:"ETH"}}}return{balance:"0.00",symbol:"ETH"}}async switchNetwork(e){var i,o;const{caipNetwork:r}=e,n=_t.getProviderId(r.chainNamespace),s=_t.getProvider(r.chainNamespace);if(n==="AUTH"||n==="WALLET_CONNECT"){await super.switchNetwork(e);return}if(!s)throw new Error("Provider not found");try{await(s==null?void 0:s.request({method:"wallet_switchEthereumChain",params:[{chainId:bh.numberToHexString(r.id)}]}))}catch(a){if(a.code===Au.ERROR_CODE_UNRECOGNIZED_CHAIN_ID||a.code===Au.ERROR_INVALID_CHAIN_ID||a.code===Au.ERROR_CODE_DEFAULT||((o=(i=a==null?void 0:a.data)==null?void 0:i.originalError)==null?void 0:o.code)===Au.E
317RROR_CODE_UNRECOGNIZED_CHAIN_ID)await bh.addEthereumChain(s,r);else if(n==="ANNOUNCED"||n==="EXTERNAL"||n==="INJECTED")throw new Error("Chain is not supported")}}getWalletConnectProvider(){var e;return(e=this.connectors.find(r=>r.type==="WALLET_CONNECT"))==null?void 0:e.provider}async revokeProviderPermissions(e){try{(await e.request({method:"wallet_getPermissions"})).find(s=>s.parentCapability==="eth_accounts")&&await e.request({method:"wallet_revokePermissions",params:[{eth_accounts:{}}]})}catch(r){console.info("Could not revoke permissions from wallet. Disconnecting...",r)}}async getCapabilities(e){const r=_t.getProvider(Y.CHAIN.EVM);if(!r)throw new Error("Provider is undefined");return await r.request({method:"wallet_getCapabilities",params:[e]})}async grantPermissions(e){const r=_t.getProvider(Y.CHAIN.EVM);if(!r)throw new Error("Provider is undefined");return await r.request({method:"wallet_grantPermissions",params:e})}async revokePermissions(e){const r=_t.getProvider(Y.CHAIN.EVM);if(!r)throw new Error("Provider is undefined");return await r.request({method:"wallet_revokePermissions",params:[e]})}async walletGetAssets(e){const r=_t.getProvider(Y.CHAIN.EVM);if(!r)throw new Error("Provider is undefined");return await r.request({method:"wallet_getAssets",params:[e]})}toChecksummedAddress(e){try{return Dt(e.toLowerCase())}catch{return e}}}const F$={FIVE_MINUTES_IN_MS:3e5},H$=[];function vCe(t){async function e(){try{const s=await t.methods.getSession();if(!s)return;if(!(s!=null&&s.address))throw new Error("SIWE session is missing address");if(!(s!=null&&s.chainId))throw new Error("SIWE session is missing chainId");return s}catch(s){console.warn("AppKit:SIWE:getSession - error:",s);return}}let r;async function n(){return r||(r=(async()=>{var s,i;try{await t.methods.signOut(),(i=(s=t.methods).onSignOut)==null||i.call(s)}finally{r=void 0}})(),r)}return H$.forEach(s=>s()),H$.push(q.subscribeKey("activeCaipAddress",async s=>{if(t.options.signOutOnDisconnect&&!s){await e()&&await n();return}if(s){const i=await e();if(i&&t.options.signOutOnAccountChange){const o=i==null?void 0:i.address,a=be==null?void 0:be.getPlainAddress(s);!zi.isLowerCaseMatch(o,a)&&await n()}}})),{async createMessage(s){var u,l;const i=await((l=(u=t.methods).getMessageParams)==null?void 0:l.call(u));if(!i)throw new Error("Failed to get message params!");const o=await t.getNonce(s.accountAddress),a=i.iat||new Date().toISOString(),c="1";return{nonce:o,version:c,requestId:i.requestId,accountAddress:s.accountAddress,chainId:s.chainId,domain:i.domain,uri:i.uri,notBefore:i.nbf,resources:i.resources,statement:i.statement,expirationTime:i.exp,issuedAt:a,toString:()=>t.createMessage({...i,chainId:Tm.caipNetworkIdToNumber(s.chainId)||1,address:`did:pkh:${s.chainId}:${s.accountAddress}`,nonce:o,version:c,iat:a})}},async addSession(s){var o,a;if(!Tm.parseEvmChainId(s.data.chainId))return Promise.resolve();if(await t.methods.verifyMessage(s)){const c=s.data.accountAddress,u=Tm.parseEvmChainId(s.data.chainId);return(a=(o=t.methods).onSignIn)==null||a.call(o,{address:c,chainId:u}),Promise.resolve()}throw new Error("Failed to verify message")},async revokeSession(s,i){try{await n()}catch(o){console.warn("AppKit:SIWE:revokeSession - signOut error",o)}},async setSessions(s){if(s.length===0)try{await n()}catch(i){console.warn("AppKit:SIWE:setSessions - signOut error",i)}else{const i=s.find(o=>{var a;return o.data.chainId===((a=Vf())==null?void 0:a.caipNetworkId)})||s[0];await this.addSession(i)}},async getSessions(s,i){try{if(!s.startsWith("eip155:"))return[{data:{accountAddress:i,chainId:s},message:"",signature:""}];const o=await e(),a=`${Y.CHAIN.EVM}:${o==null?void 0:o.chainId}`,c=o==null?void 0:o.address,u=s,l=t.options.signOutOnNetworkChange,d=t.options.signOutOnAccountChange,f=l&&a!==u,g=d&&!zi.isLowerCaseMatch(c,i);return!o||(f||g)?[]:[{data:{accountAddress:o.address,chainId:a},message:"",signature:""}]}catch(o){return console.warn("AppKit:SIWE:getSessions - error:",o),[]}},getRequired(){return t.options.required??!0},signOutOnDisconnect:t.options.signOutOnDisconnect}}class _Ce{constructor(e){const{required:r=!0,enabled:n=!0,nonceRefetchIntervalMs:s=F$.FIVE_MINUTES_IN_MS,sessionRefetchIntervalMs:i=F$.FIVE_MINUTES_IN_MS,signOutOnAccountChange:o=!0,signOutOnDisconnect:a=!0,signOutOnNetworkChange:c=!0,...u}=e;this.options={required:r,enabled:n,nonceRefetchIntervalMs:s,sessionRefetchIntervalMs:i,signOutOnDisconnect:a,signOutOnAccountChange:o,signOutOnNetworkChange:c},this.methods=u}mapToSIWX(){return vCe(this)}async getNonce(e){const r=await this.methods.getNonce(e);if(!r)throw new Error("siweControllerClient:getNonce - nonce is undefined");return r}
317async getMessageParams(){var e,r;return await((r=(e=this.methods).getMessageParams)==null?void 0:r.call(e))||{}}createMessage(e){const r=this.methods.createMessage(e);if(!r)throw new Error("siweControllerClient:createMessage - message is undefined");return r}async verifyMessage(e){return await this.methods.verifyMessage(e)}async getSession(){const e=await this.methods.getSession();if(!e)throw new Error("siweControllerClient:getSession - session is undefined");return e}async signIn(){await Sn.requestSignMessage();const e=await this.methods.getSession();if(!e)throw new Error("Error verifying SIWE signature");return e}async signOut(){const e=Sn.getSIWX();return e?(await e.setSessions([]),!0):!1}}function ACe(t){return new _Ce(t)}const CCe=(t,e)=>{const r=eG(t,e);let n=!1,s=!1;return{nonceIssued:()=>{s=!0,n&&r.arm()},settled:()=>{s=!1,r.disarm()},pickerOpened:()=>{n||(n=!0,s&&r.arm())},pickerClosed:()=>{n=!1,r.disarm()},isPickerOpen:()=>n}},ICe=["c57ca95b47569778a828d19178114f4db188b89b763c899ba0be274e97267d96","aba1f652e61fd536e8a7a5cd5e0319c9047c435ef8f7e907717361ff33bb3588","2f0e39323be165a0972147140c7b822be17e5eb464a5e8558ac0e0ab01c48944","8a0ee50d1f22f6651afcae7eb4253e52a3310b90af5daef78a8c4929a9bb99d4","971e689d0a5be527bac79629b4ee9b925e82208e5168b733496a09c0faed0709"],SCe=()=>typeof navigator<"u"&&/Android/i.test(navigator.userAgent),TCe=()=>{if(typeof window>"u"||!SCe())return;const t=window.open;window.open=function(r,...n){if(typeof r=="string"&&(r.startsWith("metamask://")||r.startsWith("x-app-open-wallet://"))){let s=r;try{s=decodeURIComponent(r)}catch{s=r}return t.call(window,s,...n)}return t.call(window,r,...n)}},PCe=2e4,OCe=15e3,NCe=3e4,xCe=12e4;let Mr=null;const ru=CCe(xCe,()=>Mr==null?void 0:Mr.onFailure({kind:"timeout",step:"wallet signature"})),$S=t=>{ru.settled();const e=nG(t);return e.kind==="play_block"?(Mr==null||Mr.closeModal(),e):(Mr==null||Mr.onFailure(e),e)},RCe=t=>{Mr=t},BCe=ACe({getMessageParams:async()=>({domain:window.location.host,uri:window.location.origin,chains:[1,2020],statement:"Please sign with your account"}),createMessage:({address:t,...e})=>gO(e,t),getNonce:async()=>{try{const t=await w2($V(),PCe,"walletConnect nonce");return ru.nonceIssued(),t}catch(t){throw ru.isPickerOpen()?$S(t):ru.settled(),t}},getSession:async()=>{try{return await w2(MV(),OCe,"walletConnect session")}catch{return null}},verifyMessage:async({message:t,signature:e})=>{ru.settled();try{await tG();const r=xV(),n=await w2(RV({message:t,signature:e,...r??{},captchaToken:DV.getState(),adFormUid:jV(),...kV(),...BV()}),NCe,"walletConnect verify");return!n.token&&!n.oneTime2FAToken?($S(new Error("walletConnect verify answered without a session token")),!1):(UV(),setTimeout(()=>{const s=(Mr==null?void 0:Mr.getRedirectTo())??null;if(rG("walletConnect"),n.oneTime2FAToken){Mr==null||Mr.openTwoFactor(n.oneTime2FAToken);return}if(s){window.location.href=s;return}Mr==null||Mr.onAuthenticated()},50),!0)}catch(r){return $S(r),!1}},signOut:async()=>(ru.settled(),await NV(),!0)});TCe();class qW extends Error{constructor(){super("VITE_WALLET_CONNECT_PROJECT_ID is not set"),this.name="WalletConnectNotConfiguredError"}}if(!G$.walletConnectProjectId)throw new qW;const nx=y0e({adapters:[new ECe],networks:[w0e,b0e],metadata:{name:"this app",description:"Whale",url:typeof window>"u"?"":window.location.origin,icons:["/random/1.webp"]},projectId:G$.walletConnectProjectId,allWallets:"SHOW",siweConfig:BCe,featuredWalletIds:ICe,features:{analytics:!0,socials:!1,email:!1,allWallets:!0,swaps:!1}}),zW=t=>{if(t){ru.pickerOpened();return}ru.pickerClosed()};zW(nx.isOpen());nx.subscribeState(t=>zW(t.open));const bIe=Object.freeze(Object.defineProperty({__proto__:null,WalletConnectNotConfiguredError:qW,setWalletConnectHandlers:RCe,walletConnectModal:nx},Symbol.toStringTag,{value:"Module"}));export{EJ as $,Cy as A,Wt as B,my as C,Ey as D,VP as E,vJ as F,Ll as G,Pm as H,bL as I,fy as J,gy as K,lp as L,ay as M,IJ as N,Cs as O,iy as P,ly as Q,o_ as R,yL as S,NJ as T,i2e as U,dy as V,As as W,yy as X,up as Y,hy as Z,vy as _,h2e as a,JP as a$,wy as a0,by as a1,py as a2,Ed as a3,EQ as a4,BL as a5,pL as a6,Pp as a7,GY as a8,VY as a9,Bo as aA,sIe as aB,oIe as aC,nIe as aD,lt as aE,se as aF,eL as aG,QL as aH,Ve as aI,aIe as aJ,cr as aK,ln as aL,fIe as aM,pIe as aN,gIe as aO,m_ as aP,lIe as aQ,eu as aR,u0e as aS,pi as aT,Fe as aU,me as aV,Y as aW,qn as aX,Tr as aY,WQ as aZ,An as a_,jx as aa,i_ as ab,YY as ac,QCe as ad,XCe as ae,e2e as af,rJ as ag,qP as ah,nJ as ai,sJ as aj,t2e as ak,QY as al,wL as am,EL as an,eJ as ao,Dx as ap,UJ as aq,qJ as ar,
317wd as as,M_ as at,GL as au,rr as av,iIe as aw,q as ax,Xe as ay,be as az,WCe as b,d2e as b$,pe as b0,WP as b1,Od as b2,a0 as b3,Zr as b4,vu as b5,ds as b6,zm as b7,ce as b8,ft as b9,cq as bA,QT as bB,pp as bC,yve as bD,b0e as bE,w0e as bF,oF as bG,JX as bH,QX as bI,ER as bJ,an as bK,Ty as bL,Ja as bM,Ff as bN,YL as bO,GQ as bP,gJ as bQ,mJ as bR,Uu as bS,n2e as bT,s2e as bU,KCe as bV,DJ as bW,RL as bX,jJ as bY,MJ as bZ,a2e as b_,Ws as ba,Ue as bb,Le as bc,Fn as bd,Ae as be,WY as bf,Cn as bg,dIe as bh,Wm as bi,Ur as bj,at as bk,Dm as bl,aT as bm,qs as bn,Nd as bo,Oo as bp,a_ as bq,Sn as br,hIe as bs,XL as bt,_t as bu,OG as bv,Rr as bw,l0 as bx,zi as by,g2e as bz,KL as c,c2e as c0,l2e as c1,u2e as c2,VL as c3,f2e as c4,Tm as c5,Vf as c6,p2e as c7,bIe as c8,YCe as d,ub as e,Jx as f,KY as g,hb as h,ZY as i,_J as j,SJ as k,TJ as l,o2e as m,PJ as n,AJ as o,CJ as p,OJ as q,SL as r,bQ as s,Lx as t,Ay as u,_y as v,cp as w,uy as x,cy as y,oy as z};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.