@dcl/marketplace-site 8.26.2-28438598732.commit-9be9bba → 8.26.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/{ConstantsUtil-DPJhqMeI.js → ConstantsUtil-BVe08SFv.js} +1 -1
- package/assets/{ExchangeController-dDDBhM7G.js → ExchangeController-D7I2RcZT.js} +1 -1
- package/assets/{HelpersUtil-Bp3sdXDl.js → HelpersUtil-ChksFsB0.js} +1 -1
- package/assets/{NetworkUtil-D9Apb7PC.js → NetworkUtil-CHwzbV4h.js} +1 -1
- package/assets/{SwapController-D2uQloTv.js → SwapController-BDPAlwW-.js} +1 -1
- package/assets/{biconomy-CSoC-rI8.js → biconomy-CbcBq0Ty.js} +1 -1
- package/assets/{browser-CnlaB8aC.js → browser-BIe69NGp.js} +1 -1
- package/assets/{ccip-Cu5lEKSq.js → ccip-D97o_Zdl.js} +1 -1
- package/assets/{ccip-Cj7-LEGv.js → ccip-e5a5X4c5.js} +1 -1
- package/assets/{chains-r7J7qhHp.js → chains-Bx-tlqt8.js} +1 -1
- package/assets/{common-D7MWUpES.js → common-B8yAeqHw.js} +1 -1
- package/assets/{controller-BjIVvsNj.js → controller-ChEtySr4.js} +2 -2
- package/assets/{data-capture-CL1x_TWk.js → data-capture-CVZHhrkz.js} +1 -1
- package/assets/{decimals-BxBfm4F8.js → decimals-Bg-x-yWm.js} +1 -1
- package/assets/decimals-unishlFr.js +1 -0
- package/assets/{detectExtension-DQYjL7QT.js → detectExtension-6BActM5c.js} +1 -1
- package/assets/{email-Dt5oL7h7.js → email-DFvQIcUa.js} +1 -1
- package/assets/{embedded-wallet-CxlQMgyC.js → embedded-wallet-Bkzfg8Q-.js} +1 -1
- package/assets/{engine-CWrMFEHj.js → engine-D56ezgnV.js} +1 -1
- package/assets/{estimate-l1-fee-BA0rS8_T.js → estimate-l1-fee-CdZ3w41f.js} +1 -1
- package/assets/eth_estimateGas-ETW4xztT.js +1 -0
- package/assets/{eth_getStorageAt-D-YjRD8M.js → eth_getStorageAt-CXsNN6pn.js} +1 -1
- package/assets/{eth_getTransactionCount-hf8F-dbS.js → eth_getTransactionCount-qsl0Cr9u.js} +1 -1
- package/assets/{ethereum-x457AqDc.js → ethereum-CEtGPAUd.js} +1 -1
- package/assets/{extractIPFS-uIQNCz58.js → extractIPFS-DIUED-Pg.js} +1 -1
- package/assets/{features-DpOkT5eu.js → features-BDgwSdkw.js} +1 -1
- package/assets/{fetchTokenMetadata-BzHNZoJx.js → fetchTokenMetadata-B08gZ7bo.js} +2 -2
- package/assets/{fortmatic-C9-_drsj.js → fortmatic-v2xaLqWX.js} +1 -1
- package/assets/{get-ecosystem-wallet-info-DVkt4lO-.js → get-ecosystem-wallet-info-Dy07hdCI.js} +1 -1
- package/assets/{getBalance-Dg__EkP1.js → getBalance-DsI9g0TY.js} +2 -2
- package/assets/{getInstalledModules-6mBUE3YV.js → getInstalledModules-Du4PQQY7.js} +1 -1
- package/assets/{getNFT-DI2UbpHZ.js → getNFT-BV-kLyDv.js} +2 -2
- package/assets/{getNFT-M3sK_31w.js → getNFT-BaIgXH0L.js} +1 -1
- package/assets/{hashTypedData-JpWupk8Z.js → hashTypedData-BcqP-VKp.js} +1 -1
- package/assets/{hooks.module-BdVNI2aP.js → hooks.module-2VF1s86u.js} +1 -1
- package/assets/{if-defined-CScwbni5.js → if-defined-Ds3urhgS.js} +1 -1
- package/assets/{in-app-wallet-calls-BLeiSGXo.js → in-app-wallet-calls-Bdrxdgac.js} +1 -1
- package/assets/{index-CnFUmLYv.css → index--i8cFVe-.css} +4 -4
- package/assets/{index-oPjWMwGZ.js → index-4DIz2OLU.js} +1 -1
- package/assets/{index-C64ohPrX.js → index-B-V1pT7O.js} +1 -1
- package/assets/{index-BGEwPdAj.js → index-B1Yn6LZ7.js} +1 -1
- package/assets/{index-DFcdgpvJ.js → index-B86FVXsF.js} +1 -1
- package/assets/{index-mxkvGiB-.js → index-B8ywPsk7.js} +1 -1
- package/assets/{index-DRgXv-Kn.js → index-B99H637p.js} +1 -1
- package/assets/{index-DS8Dfzvp.js → index-BCg8xZps.js} +1 -1
- package/assets/{index-CyAqAEl0.js → index-BFN2JwZf.js} +1 -1
- package/assets/{index-CkL1VqhG.js → index-BMj8di1o.js} +1 -1
- package/assets/{index-BSEhKdxS.js → index-BX-MdUp7.js} +1 -1
- package/assets/{index-BzsXZXiV.js → index-BqbPuN49.js} +2 -2
- package/assets/{index-CuBLbtoZ.js → index-BrVrHHcA.js} +1 -1
- package/assets/{index-DuZ8iGP2.js → index-BrayI2is.js} +1 -1
- package/assets/{index-CNlLDagM.js → index-BvwJ4NFY.js} +1 -1
- package/assets/{index-C1c8kneY.js → index-ByKRDdXr.js} +1 -1
- package/assets/{index-BJpbrEV7.js → index-Byvz3GUv.js} +1 -1
- package/assets/{index-BZel7GPS.js → index-CEGG1TLL.js} +5 -5
- package/assets/{index-DD7iMQzJ.js → index-CMWe_uTx.js} +1 -1
- package/assets/{index-CcLcbAJR.js → index-CVDRowk6.js} +1 -1
- package/assets/{index-pg3gVqDq.js → index-CZvdQ09D.js} +1 -1
- package/assets/{index-DvAfYHns.js → index-Cb869yYJ.js} +1 -1
- package/assets/{index-DMx12jGt.js → index-CkEDC948.js} +1 -1
- package/assets/{index-BdQYipn_.js → index-Cn7IwhQW.js} +1 -1
- package/assets/{index-oMud_shx.js → index-CyXq8LLv.js} +1 -1
- package/assets/{index-CSZIVLyQ.js → index-D4O7QrQN.js} +1 -1
- package/assets/{index-DkKbloi0.js → index-DBOW59t5.js} +1 -1
- package/assets/{index-BfrT8V4g.js → index-DLrth3RC.js} +1 -1
- package/assets/{index-D8kIKvzY.js → index-DPDHrphZ.js} +1 -1
- package/assets/{index-D67VpjIw.js → index-DSz9GFR1.js} +1 -1
- package/assets/{index-Cj4EAkNq.js → index-DTHNWrSK.js} +1 -1
- package/assets/{index-B8OqPQn0.js → index-Df7WkvHL.js} +1 -1
- package/assets/{index-BOjSzafE.js → index-Dk1r4ews.js} +1 -1
- package/assets/{index-D7UaaJaW.js → index-DnQCkOoU.js} +1 -1
- package/assets/{index-DiaiZT1E.js → index-KB_OlOsY.js} +1 -1
- package/assets/{index-FZQUryan.js → index-LJw8fTYh.js} +1 -1
- package/assets/{index-CJrxaZov.js → index-PL5hyrXD.js} +1 -1
- package/assets/{index-CdL8rBqX.js → index-Pi1Cu9h8.js} +1 -1
- package/assets/{index-C3xCnLWR.js → index-TsJ5aihM.js} +1 -1
- package/assets/{index-sWOsl5Mq.js → index-ck0-AGvi.js} +9 -9
- package/assets/{index-U1mrx0Bi.js → index-cvVZg_4X.js} +1 -1
- package/assets/{index-CkFR0MQl.js → index-vFAtXWYb.js} +1 -1
- package/assets/{index-CwyZjPUn.js → index-yCStn-Jf.js} +1 -1
- package/assets/{index.es-K-9xnuOr.js → index.es-D5-9dS_L.js} +1 -1
- package/assets/{index.es-BNdtevav.js → index.es-DmegW8iA.js} +1 -1
- package/assets/{index.es-C_YmGTsa.js → index.es-GZOcqfUt.js} +1 -1
- package/assets/{networks-3zvikuaU.js → networks-s96UMzHA.js} +1 -1
- package/assets/{onramp-DvYnrw4s.js → onramp-BUgdMu2R.js} +1 -1
- package/assets/{openzeppelin-RkIBKfVK.js → openzeppelin-CekW9wve.js} +1 -1
- package/assets/{ownerOf-JpXqTWrQ.js → ownerOf-C-8LA9rh.js} +1 -1
- package/assets/{parseNft-eA-ntahV.js → parseNft-BuLJ6CN_.js} +2 -2
- package/assets/{parseSignature-BF9XoBVw.js → parseSignature-BF7SmcrH.js} +3 -3
- package/assets/{pay-with-exchange-CBu8dDvu.js → pay-with-exchange-CQ-1PkzS.js} +1 -1
- package/assets/{qr-overlay-DzX75qoo.js → qr-overlay-KOiqNJ7X.js} +3 -3
- package/assets/{receive-CEk6pgz7.js → receive-DdQ-eNuq.js} +1 -1
- package/assets/{ref-5yClEFwG.js → ref-Cf_ViboH.js} +1 -1
- package/assets/{resolveImplementation-DDsaIAFL.js → resolveImplementation-Dml3QyNc.js} +1 -1
- package/assets/{rpc-0WxzKp4G.js → rpc-Ab24KkZg.js} +1 -1
- package/assets/{secp256k1-CgGDcudz.js → secp256k1-b-PbPirG.js} +1 -1
- package/assets/{send-DsuDpLhH.js → send-DYChYkEs.js} +1 -1
- package/assets/{send-batch-transaction-Bu_2rhYZ.js → send-batch-transaction-BgxJyMqO.js} +1 -1
- package/assets/{send-eip712-transaction-DwOwlCqR.js → send-eip712-transaction-B2xYx25b.js} +2 -2
- package/assets/{send-gasless-transaction-DhgWzw2O.js → send-gasless-transaction-DHhfap7k.js} +2 -2
- package/assets/{session-proposal-gCtrzWm4.js → session-proposal-BnHJBpnN.js} +1 -1
- package/assets/{session-request-CbcWY9Ja.js → session-request-oxggTqvw.js} +2 -2
- package/assets/{sha256-ClaNMra1.js → sha256-B6qHgPJw.js} +1 -1
- package/assets/{signing-CDXpwg1w.js → signing-CBJKy3lp.js} +5 -5
- package/assets/{socials-DhDCwExF.js → socials-DkK77CE4.js} +1 -1
- package/assets/{swaps-F_xZ0dzZ.js → swaps-CONEC-rn.js} +1 -1
- package/assets/{thirdweb-CnE8pMyg.js → thirdweb-CXdV8otn.js} +3 -3
- package/assets/{totalSupply-DKJF9DIi.js → totalSupply-DewA9IDx.js} +1 -1
- package/assets/{transactionReceipt-CX3mUtae.js → transactionReceipt-CIDOJhxr.js} +1 -1
- package/assets/{transactions-Di8L0T-_.js → transactions-DeTiWVbv.js} +1 -1
- package/assets/utils-CSELsIOA.js +1 -0
- package/assets/{verifyHash-CGn48zoz.js → verifyHash-BIPQuk0X.js} +3 -3
- package/assets/{w3m-modal-GUBTCSBO.js → w3m-modal-DL2ymkGa.js} +1 -1
- package/assets/{wait-for-tx-receipt-BvWtLCnm.js → wait-for-tx-receipt-rcWke49s.js} +1 -1
- package/assets/{wallets-MLt9VdIg.js → wallets-Cs85dk6n.js} +6 -6
- package/assets/{web-connector-BKvHD2Ne.js → web-connector-BSznc5-3.js} +3 -3
- package/assets/{zora-sepolia-QvmvwDKI.js → zora-sepolia-fy3MjZbS.js} +1 -1
- package/index.html +5 -5
- package/package.json +2 -2
- package/assets/decimals-BJPY5y0c.js +0 -1
- package/assets/eth_estimateGas-B-vKWEoE.js +0 -1
- package/assets/utils-DcLg-vXm.js +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/get-ecosystem-wallet-info-
|
|
2
|
-
import{u as ri,cf as nd,cg as id,ch as sd,ci as Rc,cj as od,g as Z,ck as ad,cl as tn,cm as Lc,a as sr,h as Ve,x as vo,w as cd,n as De,o as qn,j as we,cn as Dc,co as Vc,cp as Sc,k as xs,l as Cs,ai as ld,b as $s,ae as ud,C as dd,cq as xc,aM as hd,cr as pd,am as _d,an as fd,cs as md,m as ni,az as yd,aW as Gi,v as Cc,ct as ks,cu as $c,aK as wd,V as Ns,cv as kc,aV as bo,cw as gd,W as Ed,aB as Io,aP as vd,aa as bd,cx as Ao,aw as Nc,ay as Id,E as Ad,cy as Jt,ab as Td,t as Pd,H as Od,cz as Rd,aT as Ld,b8 as Dd}from"./signing-
|
|
3
|
-
`+od(t)),t)}function wh(r){return nd(yh(r))}const qI="0xfffffffffffffffffffffffffffffff0000000000000000000000000000000007aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1c",gh="0x85e23b94e7F5E9cC1fF78BCe78cfb15B81f0DF00",Eh="0x4be0ddfebca9a5a4a617dee4dece99e7c862dceb",si="0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789",vh="0x0000000071727De22E5E9d8BAf0edAc6f37da032",bh=50000n,Ih=r=>Ah(r||si)==="v0.7"?Eh:gh,Kc=r=>{const t=Vd().bundler;return t.startsWith("localhost:")?`http://${t}/v2?chain=${r.id}`:`https://${r.id}.${t}/v2`},Ah=r=>{const t=Z(r);if(t===si)return"v0.6";if(t===vh)return"v0.7";throw new Error("Unknown paymaster version")};async function Be(r){const{client:t,ecosystem:e,walletType:n,walletAddress:i,chainId:s}=r;return ad({client:t,data:{action:"connect",chainId:s,source:"connectWallet",walletAddress:i,walletType:n},ecosystem:e})}function js(r){const t=r.domain;return(t==null?void 0:t.chainId)!==void 0&&tn(t.chainId)&&(r.domain={...r.domain,chainId:Lc(r.domain.chainId)}),r}const Th={"0x0":"reverted","0x1":"success"};function zs(r){var n;const[t,e]=(()=>{const i=r.status;return i>=100&&i<200?["pending",i]:i>=200&&i<300?["success",i]:i>=300&&i<700?["failure",i]:i==="CONFIRMED"?["success",200]:i==="PENDING"?["pending",100]:[void 0,i]})();return{...r,atomic:r.atomic,chainId:r.chainId?sr(r.chainId):void 0,receipts:((n=r.receipts)==null?void 0:n.map(i=>({...i,blockNumber:Ve(i.blockNumber),gasUsed:Ve(i.gasUsed),status:Th[i.status]})))??[],status:t,statusCode:e,version:r.version}}function Ks(r,t){const e={};for(const[n,i]of Object.entries(r)){e[Number(n)]={};const s={};for(const[o,c]of Object.entries(i))s[o]=c;e[Number(n)]=s}return typeof t=="number"?{[t]:e[t]}:e}async function Fs(r,t){const e=r.calls[0];if(!e)throw new Error("No calls to send");const{calls:n,capabilities:i,version:s="2.0.0",chain:o=e.chain}=r,c=await Promise.all(n.map(async u=>{const{to:d,value:h}=u;if(d===void 0&&u.data===void 0)throw new Error("Cannot send call, `to` or `data` must be provided.");const[p,_,f]=await Promise.all([vo(d),cd(u),vo(h)]);return p?{data:_,to:Z(p),value:typeof f=="bigint"||typeof f=="number"?De(f):void 0}:{data:_,to:void 0,value:void 0}}));return{callParams:[{atomicRequired:r.atomicRequired??!1,calls:c,capabilities:i,chainId:De(o.id),from:Z(t.address),version:s}],chain:o}}function Ws(r){return Ph(r).map(t=>{try{const e=new URL(t);return e.hostname.endsWith(".thirdweb.com")&&(e.pathname="",e.search=""),e.toString()}catch{return t}})}function Ph(r,t,e="http"){const n=[];for(const i of r.rpc)e==="http"&&!i.startsWith("http")||e==="ws"&&!i.startsWith("ws")||(i.includes("${THIRDWEB_API_KEY}")?n.push(i.replace("${THIRDWEB_API_KEY}","")):i.includes("${")||n.push(i));if(n.length===0)throw new Error(`No RPC available for chainId "${r.chainId}" with mode ${e}`);return n}function lt(r){return typeof r=="number"?r:qn(r)?sr(r):typeof r=="bigint"?Number(r):Number.parseInt(r,10)}function Oh(r){if(typeof window>"u")return;const t=e=>r(e.detail);return window.addEventListener("eip6963:announceProvider",t),window.dispatchEvent(new CustomEvent("eip6963:requestProvider")),()=>window.removeEventListener("eip6963:announceProvider",t)}function Rh(){const r=new Set;let t=[];const e=()=>Oh(i=>{t.some(({info:s})=>s.uuid===i.info.uuid)||(t=[...t,i],r.forEach(s=>s(t,{added:[i]})))});let n=e();return{_listeners(){return r},clear(){r.forEach(i=>i([],{removed:[...t]})),t=[]},destroy(){this.clear(),r.clear(),n==null||n()},findProvider({rdns:i}){return t.find(s=>s.info.rdns===i)},getProviders(){return t},reset(){this.clear(),n==null||n(),n=e()},subscribe(i,{emitImmediately:s}={}){return r.add(i),s&&i(t,{added:t}),()=>r.delete(i)}}}function Lh(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}function Dh(){return typeof Kt<"u"&&typeof Kt.versions<"u"&&typeof Kt.versions.node<"u"}function Fc(){return!Lh()&&!Dh()}const ft="com.coinbase.wallet",Pt="org.base.account",Wc="io.metamask",Vh="me.rainbow",Sh="io.zerion.wallet",Fn={async getItem(r){try{if(typeof window<"u"&&window.localStorage)return localStorage.getItem(r)}catch{}return null},async removeItem(r){typeof window<"u"&&window.localStorage&&localStorage.removeItem(r)},async setItem(r,t){try{typeof window<"u"&&window.localStorage&&localStorage.setItem(r,t)}catch{}}};function Hs(r){return r.startsWith("http://")||r.startsWith("https://")}function Hc(r,t){if(!Hs(r))return Gc(r,t);let e=r;e.endsWith("/")||(e=`${e}/`);const n=encodeURIComponent(t);return{href:e,redirect:`${e}wc?uri=${n}`}}function Gc(r,t){if(Hs(r))return Hc(r,t);let e=r;e.includes("://")||(e=r.replaceAll("/","").replaceAll(":",""),e=`${e}://`),e.endsWith("/")||(e=`${e}/`);const n=encodeURIComponent(t);return{href:e,redirect:`${e}wc?uri=${n}`}}function xh(r,t){return Hs(r)?Hc(r,t):Gc(r,t)}function Ch(){if(typeof navigator>"u")return!1;const r=Uc(navigator.userAgent);return r?r.toLowerCase().includes("android"):!1}function $h(){if(typeof navigator>"u")return!1;const r=Uc(navigator.userAgent);return r?r.toLowerCase().includes("ios")||r.toLowerCase().includes("mac")&&navigator.maxTouchPoints>1:!1}function kh(){return typeof window>"u"||typeof navigator>"u"?!1:"ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0}function Nh(){return typeof window>"u"?!1:"orientation"in window||"onorientationchange"in window}function Ro(){return!!(Ch()||$h()||kh()&&Nh()||typeof window<"u"&&window.innerWidth<640)}function gi(r){if(window!==window.top)window.open(r);else if(r.startsWith("http")){const e=document.createElement("a");e.href=r,e.target="_blank",e.rel="noreferrer noopener",e.click()}else window.location.href=r}function Or(r){return typeof r=="string"?r.startsWith("ecosystem."):r.id.startsWith("ecosystem.")}async function Jc(r,t){if(Or(r)){const{getEcosystemWalletInfo:e}=await a(async()=>{const{getEcosystemWalletInfo:n}=await import("./get-ecosystem-wallet-info-DVkt4lO-.js");return{getEcosystemWalletInfo:n}},__vite__mapDeps([0,1,2,3,4,5,6,7]));return t?e(r).then(n=>n.image_id):e(r)}switch(r){case"smart":return t?a(()=>import("./image-BnYtBA0B.js"),[]).then(e=>e.default):a(()=>import("./index-BuSavAVK.js"),[]).then(e=>e.wallet);case"inApp":return t?a(()=>import("./image-YhquT9-B.js"),[]).then(e=>e.default):a(()=>import("./index-B6yqoFuC.js"),[]).then(e=>e.wallet);case"walletConnect":return t?a(()=>import("./image-B3sWXgWp.js"),[]).then(e=>e.default):a(()=>import("./index-B21BIk0D.js"),[]).then(e=>e.wallet);case"embedded":return t?a(()=>import("./image-CE6B5igp.js"),[]).then(e=>e.default):a(()=>import("./index-CZfaBXw3.js"),[]).then(e=>e.wallet);case"adapter":return t?a(()=>import("./image-CaoCxndE.js"),[]).then(e=>e.default):a(()=>import("./index-DkPRLpmE.js"),[]).then(e=>e.wallet);case"io.1inch.wallet":return t?a(()=>import("./image-DcM8byf5.js"),[]).then(e=>e.default):a(()=>import("./index-B8SH8PS4.js"),[]).then(e=>e.wallet);case"com.binance.wallet":return t?a(()=>import("./image-B6woX8-F.js"),[]).then(e=>e.default):a(()=>import("./index-D1Wt1Kx7.js"),[]).then(e=>e.wallet);case"com.ledger":return t?a(()=>import("./image-CGobRsqC.js"),[]).then(e=>e.default):a(()=>import("./index-C63hJ0G0.js"),[]).then(e=>e.wallet);case"com.bitpay":return t?a(()=>import("./image-oGFA7lCe.js"),[]).then(e=>e.default):a(()=>import("./index-Bl6ScMn3.js"),[]).then(e=>e.wallet);case"com.bestwallet":return t?a(()=>import("./image-YzdSnFCd.js"),[]).then(e=>e.default):a(()=>import("./index-C_fnrq8t.js"),[]).then(e=>e.wallet);case"io.metamask":return t?a(()=>import("./image-rAE1A9js.js"),[]).then(e=>e.default):a(()=>import("./index-DaZnaClT.js"),[]).then(e=>e.wallet);case"com.trustwallet.app":return t?a(()=>import("./image-DhOOZChF.js"),[]).then(e=>e.default):a(()=>import("./index-9552Tb-C.js"),[]).then(e=>e.wallet);case"com.fireblocks":return t?a(()=>import("./image-C_rXI8lY.js"),[]).then(e=>e.default):a(()=>import("./index-fm1oF4Rd.js"),[]).then(e=>e.wallet);case"com.bitget.web3":return t?a(()=>import("./image-Cyu_SKNX.js"),[]).then(e=>e.default):a(()=>import("./index-7Xw6Dozy.js"),[]).then(e=>e.wallet);case"pro.tokenpocket":return t?a(()=>import("./image--EMjkbyZ.js"),[]).then(e=>e.default):a(()=>import("./index-C6d9DLRH.js"),[]).then(e=>e.wallet);case"com.safepal":return t?a(()=>import("./image-CPrfOTN2.js"),[]).then(e=>e.default):a(()=>import("./index-BKoDPf_i.js"),[]).then(e=>e.wallet);case"org.uniswap":return t?a(()=>import("./image-DzLDqqsm.js"),[]).then(e=>e.default):a(()=>import("./index-j8mIFeCA.js"),[]).then(e=>e.wallet);case"io.zerion.wallet":return t?a(()=>import("./image-CXpsLPxr.js"),[]).then(e=>e.default):a(()=>import("./index-CAYpPiIA.js"),[]).then(e=>e.wallet);case"com.elrond.maiar.wallet":return t?a(()=>import("./image-Zh059TUR.js"),[]).then(e=>e.default):a(()=>import("./index-CN99OAiz.js"),[]).then(e=>e.wallet);case"com.crypto.wallet":return t?a(()=>import("./image-BbeMBRJP.js"),[]).then(e=>e.default):a(()=>import("./index-DoeeKGAI.js"),[]).then(e=>e.wallet);case"com.bitcoin":return t?a(()=>import("./image-CIhcwJo_.js"),[]).then(e=>e.default):a(()=>import("./index-COFjg0BY.js"),[]).then(e=>e.wallet);case"com.bifrostwallet":return t?a(()=>import("./image-BJbq9ykO.js"),[]).then(e=>e.default):a(()=>import("./index-Cw9NGSPc.js"),[]).then(e=>e.wallet);case"jp.co.rakuten-wallet":return t?a(()=>import("./image-CkSdZpFq.js"),[]).then(e=>e.default):a(()=>import("./index-CU6dgzkA.js"),[]).then(e=>e.wallet);case"com.bybit":return t?a(()=>import("./image-CVPmP4Bl.js"),[]).then(e=>e.default):a(()=>import("./index-m0YDsCpu.js"),[]).then(e=>e.wallet);case"com.blockchain.login":return t?a(()=>import("./image-BvEJhPGs.js"),[]).then(e=>e.default):a(()=>import("./index-C8VMxu1Z.js"),[]).then(e=>e.wallet);case"io.trezor":return t?a(()=>import("./image-BQXnGJhx.js"),[]).then(e=>e.default):a(()=>import("./index-CDqfDzT6.js"),[]).then(e=>e.wallet);case"im.token":return t?a(()=>import("./image-ChDeiuh7.js"),[]).then(e=>e.default):a(()=>import("./index-iJWzlNVI.js"),[]).then(e=>e.wallet);case"global.safe":return t?a(()=>import("./image-B6ncW7rJ.js"),[]).then(e=>e.default):a(()=>import("./index-HPp1Id1p.js"),[]).then(e=>e.wallet);case"xyz.ctrl":return t?a(()=>import("./image-DsOpF0U0.js"),[]).then(e=>e.default):a(()=>import("./index-CW6lKp1A.js"),[]).then(e=>e.wallet);case"co.arculus":return t?a(()=>import("./image-CYFfk7g3.js"),[]).then(e=>e.default):a(()=>import("./index-s6ugJH3L.js"),[]).then(e=>e.wallet);case"com.roninchain.wallet":return t?a(()=>import("./image-BMgLTkFN.js"),[]).then(e=>e.default):a(()=>import("./index-caEr82M6.js"),[]).then(e=>e.wallet);case"com.okex.wallet":return t?a(()=>import("./image-Ck2fht2U.js"),[]).then(e=>e.default):a(()=>import("./index-CbEIEIEo.js"),[]).then(e=>e.wallet);case"com.wemixplay":return t?a(()=>import("./image-Dfhapk7_.js"),[]).then(e=>e.default):a(()=>import("./index-C8AQSvJD.js"),[]).then(e=>e.wallet);case"com.tangem":return t?a(()=>import("./image-xMsS8TDb.js"),[]).then(e=>e.default):a(()=>import("./index-CKXDw-uc.js"),[]).then(e=>e.wallet);case"com.exodus":return t?a(()=>import("./image-BULUy74S.js"),[]).then(e=>e.default):a(()=>import("./index-DszThTMl.js"),[]).then(e=>e.wallet);case"com.hashpack.wallet":return t?a(()=>import("./image-BFzDP99B.js"),[]).then(e=>e.default):a(()=>import("./index-wBbkQCZY.js"),[]).then(e=>e.wallet);case"id.co.pintu":return t?a(()=>import("./image-CsH_NRy-.js"),[]).then(e=>e.default):a(()=>import("./index-DHDm_YtM.js"),[]).then(e=>e.wallet);case"network.blackfort":return t?a(()=>import("./image-CTLwieHz.js"),[]).then(e=>e.default):a(()=>import("./index-DZRVQyzq.js"),[]).then(e=>e.wallet);case"com.wigwam.wallet":return t?a(()=>import("./image-xaEWk6k8.js"),[]).then(e=>e.default):a(()=>import("./index-BA0Hn6eE.js"),[]).then(e=>e.wallet);case"app.backpack":return t?a(()=>import("./image-YbQrvLSP.js"),[]).then(e=>e.default):a(()=>import("./index-B8BWAl26.js"),[]).then(e=>e.wallet);case"app.subwallet":return t?a(()=>import("./image-BdqmMP8T.js"),[]).then(e=>e.default):a(()=>import("./index-7C_yDnI4.js"),[]).then(e=>e.wallet);case"cc.avacus":return t?a(()=>import("./image-uGs9mRWl.js"),[]).then(e=>e.default):a(()=>import("./index-BFZxo6Jc.js"),[]).then(e=>e.wallet);case"me.rainbow":return t?a(()=>import("./image-DSGxNIm1.js"),[]).then(e=>e.default):a(()=>import("./index-3d3uK5Ax.js"),[]).then(e=>e.wallet);case"so.onekey.app.wallet":return t?a(()=>import("./image-CwaGmiHI.js"),[]).then(e=>e.default):a(()=>import("./index-CUEmD5dS.js"),[]).then(e=>e.wallet);case"me.haha":return t?a(()=>import("./image-Npe5Xkhl.js"),[]).then(e=>e.default):a(()=>import("./index-B7GQyWAF.js"),[]).then(e=>e.wallet);case"com.bee":return t?a(()=>import("./image-Sy6X7CtO.js"),[]).then(e=>e.default):a(()=>import("./index-CQ3aQg5G.js"),[]).then(e=>e.wallet);case"ag.jup":return t?a(()=>import("./image-BuqgjEJD.js"),[]).then(e=>e.default):a(()=>import("./index-D30RfPa1.js"),[]).then(e=>e.wallet);case"app.keplr":return t?a(()=>import("./image-DpeCw-px.js"),[]).then(e=>e.default):a(()=>import("./index-BnsE1W-S.js"),[]).then(e=>e.wallet);case"org.hot-labs":return t?a(()=>import("./image-DFf3lDA_.js"),[]).then(e=>e.default):a(()=>import("./index-DDwu-IMz.js"),[]).then(e=>e.wallet);case"com.dcentwallet":return t?a(()=>import("./image-CUPOo6zK.js"),[]).then(e=>e.default):a(()=>import("./index-Bm92iZMY.js"),[]).then(e=>e.wallet);case"com.kraken":return t?a(()=>import("./image-BP17CoHz.js"),[]).then(e=>e.default):a(()=>import("./index-BFGXqrJS.js"),[]).then(e=>e.wallet);case"com.kucoin":return t?a(()=>import("./image-JIl7mHMQ.js"),[]).then(e=>e.default):a(()=>import("./index-DRVDpxj6.js"),[]).then(e=>e.wallet);case"io.magiceden.wallet":return t?a(()=>import("./image-B7QIFAir.js"),[]).then(e=>e.default):a(()=>import("./index-DMTU8hfu.js"),[]).then(e=>e.wallet);case"com.tomi":return t?a(()=>import("./image-COwCE3RO.js"),[]).then(e=>e.default):a(()=>import("./index-C7njqxXR.js"),[]).then(e=>e.wallet);case"io.ibvm":return t?a(()=>import("./image-CVBI4BwD.js"),[]).then(e=>e.default):a(()=>import("./index-HzSvsrak.js"),[]).then(e=>e.wallet);case"com.mewwallet":return t?a(()=>import("./image-Dx4ya6_y.js"),[]).then(e=>e.default):a(()=>import("./index-DEzKWTBJ.js"),[]).then(e=>e.wallet);case"com.socios.app":return t?a(()=>import("./image-COKP1J8V.js"),[]).then(e=>e.default):a(()=>import("./index-D06ftJGd.js"),[]).then(e=>e.wallet);case"xyz.argent":return t?a(()=>import("./image-5mReG_-1.js"),[]).then(e=>e.default):a(()=>import("./index-CQPZVLgk.js"),[]).then(e=>e.wallet);case"org.thorwallet":return t?a(()=>import("./image-Dmp2jTO0.js"),[]).then(e=>e.default):a(()=>import("./index-NO3dCFlG.js"),[]).then(e=>e.wallet);case"io.internetmoney":return t?a(()=>import("./image-D4PYvYqY.js"),[]).then(e=>e.default):a(()=>import("./index-BZwq4W5O.js"),[]).then(e=>e.wallet);case"org.mathwallet":return t?a(()=>import("./image-mMy4SSmg.js"),[]).then(e=>e.default):a(()=>import("./index-lGNYNhMi.js"),[]).then(e=>e.wallet);case"io.cypherhq":return t?a(()=>import("./image-B14TCFf5.js"),[]).then(e=>e.default):a(()=>import("./index-yURkkC3L.js"),[]).then(e=>e.wallet);case"io.novawallet":return t?a(()=>import("./image-DDso8kuB.js"),[]).then(e=>e.default):a(()=>import("./index-C91aPf2g.js"),[]).then(e=>e.wallet);case"io.yowallet":return t?a(()=>import("./image-Bx8buncY.js"),[]).then(e=>e.default):a(()=>import("./index-B062fuzr.js"),[]).then(e=>e.wallet);case"com.flowfoundation.wallet":return t?a(()=>import("./image-Da2xkAVi.js"),[]).then(e=>e.default):a(()=>import("./index-CBVJzm96.js"),[]).then(e=>e.wallet);case"app.kabila":return t?a(()=>import("./image-B-l20wIO.js"),[]).then(e=>e.default):a(()=>import("./index-cTRIo3rN.js"),[]).then(e=>e.wallet);case"com.opera":return t?a(()=>import("./image-sDrIF89f.js"),[]).then(e=>e.default):a(()=>import("./index-lIOVfT2m.js"),[]).then(e=>e.wallet);case"com.valoraapp":return t?a(()=>import("./image-5QXPaavh.js"),[]).then(e=>e.default):a(()=>import("./index-C6baQHax.js"),[]).then(e=>e.wallet);case"com.robinhood.wallet":return t?a(()=>import("./image-DBehogZh.js"),[]).then(e=>e.default):a(()=>import("./index-bzH6W7xo.js"),[]).then(e=>e.wallet);case"com.chain":return t?a(()=>import("./image-qsAyF5Oj.js"),[]).then(e=>e.default):a(()=>import("./index-npRlG_V2.js"),[]).then(e=>e.wallet);case"io.huddln":return t?a(()=>import("./image-CQm90J-d.js"),[]).then(e=>e.default):a(()=>import("./index-DILut-jL.js"),[]).then(e=>e.wallet);case"app.core.extension":return t?a(()=>import("./image-De2xpum1.js"),[]).then(e=>e.default):a(()=>import("./index-BtfbjCVr.js"),[]).then(e=>e.wallet);case"world.freedom":return t?a(()=>import("./image-COnY36UD.js"),[]).then(e=>e.default):a(()=>import("./index-BZUSQkq9.js"),[]).then(e=>e.wallet);case"money.unstoppable":return t?a(()=>import("./image-Bvw8wNRu.js"),[]).then(e=>e.default):a(()=>import("./index-CW8D5Pv5.js"),[]).then(e=>e.wallet);case"pk.modular":return t?a(()=>import("./image-CaHdVXd1.js"),[]).then(e=>e.default):a(()=>import("./index-1CA6ps09.js"),[]).then(e=>e.wallet);case"app.wombat":return t?a(()=>import("./image-ExeF69qZ.js"),[]).then(e=>e.default):a(()=>import("./index-D9Jrno_D.js"),[]).then(e=>e.wallet);case"com.klipwallet":return t?a(()=>import("./image-8vXf4Xjy.js"),[]).then(e=>e.default):a(()=>import("./index-CcNQ53IV.js"),[]).then(e=>e.wallet);case"com.gemwallet":return t?a(()=>import("./image-M7TV7WaH.js"),[]).then(e=>e.default):a(()=>import("./index-BtZsXMJj.js"),[]).then(e=>e.wallet);case"com.sabay.wallet":return t?a(()=>import("./image-CsNgSbbt.js"),[]).then(e=>e.default):a(()=>import("./index-BVAmxcaa.js"),[]).then(e=>e.wallet);case"com.zengo":return t?a(()=>import("./image-DNtaIeSw.js"),[]).then(e=>e.default):a(()=>import("./index-DDk7D3eE.js"),[]).then(e=>e.wallet);case"xyz.joeywallet":return t?a(()=>import("./image-CTsHGgDx.js"),[]).then(e=>e.default):a(()=>import("./index-Im6F3t68.js"),[]).then(e=>e.wallet);case"io.tokoin":return t?a(()=>import("./image-DQzzFCs2.js"),[]).then(e=>e.default):a(()=>import("./index-Bwjy4Jw7.js"),[]).then(e=>e.wallet);case"io.alpha-u.wallet.web":return t?a(()=>import("./image-DLiMUWBI.js"),[]).then(e=>e.default):a(()=>import("./index-DFt1vT8N.js"),[]).then(e=>e.wallet);case"network.cvl":return t?a(()=>import("./image-CtZg2vKX.js"),[]).then(e=>e.default):a(()=>import("./index-D2vPh3Mc.js"),[]).then(e=>e.wallet);case"io.leapwallet":return t?a(()=>import("./image-DHnnMCFG.js"),[]).then(e=>e.default):a(()=>import("./index-BdkJrfxl.js"),[]).then(e=>e.wallet);case"io.xenea":return t?a(()=>import("./image-B5ZxW0VG.js"),[]).then(e=>e.default):a(()=>import("./index-C8mAROh2.js"),[]).then(e=>e.wallet);case"com.oasys-wallet":return t?a(()=>import("./image-W7SfqKZe.js"),[]).then(e=>e.default):a(()=>import("./index-gQ8zpnGO.js"),[]).then(e=>e.wallet);case"com.bitso":return t?a(()=>import("./image-LfonVSeq.js"),[]).then(e=>e.default):a(()=>import("./index-YcqLCtWD.js"),[]).then(e=>e.wallet);case"io.enjin":return t?a(()=>import("./image-BnXzDKuV.js"),[]).then(e=>e.default):a(()=>import("./index-Jmrm9oUu.js"),[]).then(e=>e.wallet);case"com.coldwallet":return t?a(()=>import("./image-CVrpZdwi.js"),[]).then(e=>e.default):a(()=>import("./index-CkqupmC6.js"),[]).then(e=>e.wallet);case"org.creditcoin.app":return t?a(()=>import("./image-CzL8n4ZU.js"),[]).then(e=>e.default):a(()=>import("./index-B94SpzOt.js"),[]).then(e=>e.wallet);case"app.everspace":return t?a(()=>import("./image-ripXpF5P.js"),[]).then(e=>e.default):a(()=>import("./index-COlGaDkw.js"),[]).then(e=>e.wallet);case"app.zeal":return t?a(()=>import("./image-hO8Jv2oh.js"),[]).then(e=>e.default):a(()=>import("./index-B6n-vVE0.js"),[]).then(e=>e.wallet);case"app.whitewallet":return t?a(()=>import("./image-D7wXb0Un.js"),[]).then(e=>e.default):a(()=>import("./index-SCBLsVUL.js"),[]).then(e=>e.wallet);case"ai.purewallet":return t?a(()=>import("./image-K1HoU8Qi.js"),[]).then(e=>e.default):a(()=>import("./index-DZ2hd5eC.js"),[]).then(e=>e.wallet);case"com.fastex.wallet":return t?a(()=>import("./image-lBIlUHFP.js"),[]).then(e=>e.default):a(()=>import("./index-CMzQk3O6.js"),[]).then(e=>e.wallet);case"io.kriptomat":return t?a(()=>import("./image-6ouyxZRt.js"),[]).then(e=>e.default):a(()=>import("./index-wk2CJ7i5.js"),[]).then(e=>e.wallet);case"com.ullapay":return t?a(()=>import("./image-Bn2sAgXJ.js"),[]).then(e=>e.default):a(()=>import("./index-D_d6gemZ.js"),[]).then(e=>e.wallet);case"io.atomicwallet":return t?a(()=>import("./image-D55LvXjp.js"),[]).then(e=>e.default):a(()=>import("./index-DEV4egrN.js"),[]).then(e=>e.wallet);case"com.pionewallet":return t?a(()=>import("./image-B_0Cqkss.js"),[]).then(e=>e.default):a(()=>import("./index-BogX5ITG.js"),[]).then(e=>e.wallet);case"io.oxalus":return t?a(()=>import("./image-DTa4RXUa.js"),[]).then(e=>e.default):a(()=>import("./index-CuQBw1y6.js"),[]).then(e=>e.wallet);case"xyz.uniultra.wallet":return t?a(()=>import("./image-BSLjXnNe.js"),[]).then(e=>e.default):a(()=>import("./index-CJYo3Znz.js"),[]).then(e=>e.wallet);case"xyz.frontier.wallet":return t?a(()=>import("./image-Bdtwdp85.js"),[]).then(e=>e.default):a(()=>import("./index--YTVamH2.js"),[]).then(e=>e.wallet);case"com.coolbitx.cwsapp":return t?a(()=>import("./image-DWR067hG.js"),[]).then(e=>e.default):a(()=>import("./index-tkvX3w1X.js"),[]).then(e=>e.wallet);case"org.gooddollar":return t?a(()=>import("./image-y3eCNAT6.js"),[]).then(e=>e.default):a(()=>import("./index-C7N44kNF.js"),[]).then(e=>e.wallet);case"com.cakewallet":return t?a(()=>import("./image-BqQffU2u.js"),[]).then(e=>e.default):a(()=>import("./index-DPCPDLBT.js"),[]).then(e=>e.wallet);case"com.ellipal":return t?a(()=>import("./image-vuuCn07N.js"),[]).then(e=>e.default):a(()=>import("./index-jTpsrMvb.js"),[]).then(e=>e.wallet);case"app.krystal":return t?a(()=>import("./image-C2QANSRr.js"),[]).then(e=>e.default):a(()=>import("./index-B7dAHFam.js"),[]).then(e=>e.wallet);case"com.monarchwallet":return t?a(()=>import("./image-BNA4BP9T.js"),[]).then(e=>e.default):a(()=>import("./index-C7WD5W_Z.js"),[]).then(e=>e.wallet);case"com.burritowallet":return t?a(()=>import("./image-BI-5Z38o.js"),[]).then(e=>e.default):a(()=>import("./index-DpRqa1iX.js"),[]).then(e=>e.wallet);case"co.family.wallet":return t?a(()=>import("./image-CECsJh3H.js"),[]).then(e=>e.default):a(()=>import("./index-DrzmRQ9S.js"),[]).then(e=>e.wallet);case"com.mtpelerin":return t?a(()=>import("./image-BDOqiI6p.js"),[]).then(e=>e.default):a(()=>import("./index-bQArImNA.js"),[]).then(e=>e.wallet);case"app.keyring":return t?a(()=>import("./image-BH6pi8gb.js"),[]).then(e=>e.default):a(()=>import("./index-DLGneTkB.js"),[]).then(e=>e.wallet);case"cc.localtrade.lab":return t?a(()=>import("./image-DRqNpoe6.js"),[]).then(e=>e.default):a(()=>import("./index-D-qw7id5.js"),[]).then(e=>e.wallet);case"tech.okto":return t?a(()=>import("./image-uk4MysVY.js"),[]).then(e=>e.default):a(()=>import("./index-C5ZfEOey.js"),[]).then(e=>e.wallet);case"com.xcapit":return t?a(()=>import("./image-BjFjHCOg.js"),[]).then(e=>e.default):a(()=>import("./index-DbAxetvE.js"),[]).then(e=>e.wallet);case"com.gayawallet":return t?a(()=>import("./image-DC9Wj56E.js"),[]).then(e=>e.default):a(()=>import("./index-D4VnhuTS.js"),[]).then(e=>e.wallet);case"app.nightly":return t?a(()=>import("./image-Bv8VGwx8.js"),[]).then(e=>e.default):a(()=>import("./index-uM5GtqSd.js"),[]).then(e=>e.wallet);case"com.coin98":return t?a(()=>import("./image-Co9P7WAh.js"),[]).then(e=>e.default):a(()=>import("./index-CxBkKx5Q.js"),[]).then(e=>e.wallet);case"xyz.coca":return t?a(()=>import("./image-DaxrbegS.js"),[]).then(e=>e.default):a(()=>import("./index-CAfHv9Ye.js"),[]).then(e=>e.wallet);case"app.linen":return t?a(()=>import("./image-CljvD_on.js"),[]).then(e=>e.default):a(()=>import("./index-DTPO88lj.js"),[]).then(e=>e.wallet);case"dev.auroracloud":return t?a(()=>import("./image-BbwfB3J_.js"),[]).then(e=>e.default):a(()=>import("./index-DqYjD_64.js"),[]).then(e=>e.wallet);case"com.coinomi":return t?a(()=>import("./image-CyezMyAx.js"),[]).then(e=>e.default):a(()=>import("./index-B-oXIR8J.js"),[]).then(e=>e.wallet);case"my.mone":return t?a(()=>import("./image-B7h27Vsd.js"),[]).then(e=>e.default):a(()=>import("./index-3jJtZlGN.js"),[]).then(e=>e.wallet);case"org.alephium":return t?a(()=>import("./image-DDUR5y02.js"),[]).then(e=>e.default):a(()=>import("./index-CRTSSeuy.js"),[]).then(e=>e.wallet);case"com.alicebob":return t?a(()=>import("./image-BKjOwOZU.js"),[]).then(e=>e.default):a(()=>import("./index-DYiL0IsZ.js"),[]).then(e=>e.wallet);case"io.koalawallet":return t?a(()=>import("./image-CTAbQz5j.js"),[]).then(e=>e.default):a(()=>import("./index-DPXkoJXK.js"),[]).then(e=>e.wallet);case"com.veworld":return t?a(()=>import("./image-DKBlkqWK.js"),[]).then(e=>e.default):a(()=>import("./index-DV2Q2KhC.js"),[]).then(e=>e.wallet);case"com.withpaper":return t?a(()=>import("./image-DbBiNCFK.js"),[]).then(e=>e.default):a(()=>import("./index-CExunyqd.js"),[]).then(e=>e.wallet);case"io.noone":return t?a(()=>import("./image-CwDXHpUj.js"),[]).then(e=>e.default):a(()=>import("./index-BEFk-36A.js"),[]).then(e=>e.wallet);case"network.haqq":return t?a(()=>import("./image-BaRuJqy0.js"),[]).then(e=>e.default):a(()=>import("./index--t3K2suC.js"),[]).then(e=>e.wallet);case"io.ricewallet":return t?a(()=>import("./image-CmVMIVLM.js"),[]).then(e=>e.default):a(()=>import("./index-C_j7AjFr.js"),[]).then(e=>e.wallet);case"me.iopay":return t?a(()=>import("./image-CMJsc-Ir.js"),[]).then(e=>e.default):a(()=>import("./index-bsKYZmcs.js"),[]).then(e=>e.wallet);case"app.walletnow":return t?a(()=>import("./image-CmkiYZaU.js"),[]).then(e=>e.default):a(()=>import("./index-C_C9JdoE.js"),[]).then(e=>e.wallet);case"io.okse":return t?a(()=>import("./image-CZ9z1ucT.js"),[]).then(e=>e.default):a(()=>import("./index-_a8zNWKv.js"),[]).then(e=>e.wallet);case"network.over":return t?a(()=>import("./image-Cq54pcgl.js"),[]).then(e=>e.default):a(()=>import("./index-BDifUsn3.js"),[]).then(e=>e.wallet);case"com.aktionariat":return t?a(()=>import("./image-Cc6jyxLi.js"),[]).then(e=>e.default):a(()=>import("./index-Pw2thZ4h.js"),[]).then(e=>e.wallet);case"com.paybolt":return t?a(()=>import("./image-cwzgrAkh.js"),[]).then(e=>e.default):a(()=>import("./index-BxqRct_I.js"),[]).then(e=>e.wallet);case"com.plasma-wallet":return t?a(()=>import("./image-BVO9IT_6.js"),[]).then(e=>e.default):a(()=>import("./index-fiGpKN6W.js"),[]).then(e=>e.wallet);case"org.bytebank":return t?a(()=>import("./image-BP2Ox9Qn.js"),[]).then(e=>e.default):a(()=>import("./index-S5s6rAc3.js"),[]).then(e=>e.wallet);case"io.ethermail":return t?a(()=>import("./image-Duck5tqn.js"),[]).then(e=>e.default):a(()=>import("./index-BoCHG1VO.js"),[]).then(e=>e.wallet);case"com.optowallet":return t?a(()=>import("./image-W-Y_Nm-s.js"),[]).then(e=>e.default):a(()=>import("./index-BP-yDgcx.js"),[]).then(e=>e.wallet);case"finance.openwallet":return t?a(()=>import("./image-M_AWRaKs.js"),[]).then(e=>e.default):a(()=>import("./index-Cv59xn6_.js"),[]).then(e=>e.wallet);case"xyz.sequence":return t?a(()=>import("./image-o3pjQDbu.js"),[]).then(e=>e.default):a(()=>import("./index-D7Gl-ZGb.js"),[]).then(e=>e.wallet);case"com.foxwallet":return t?a(()=>import("./image-DcX8AUYd.js"),[]).then(e=>e.default):a(()=>import("./index-BARF52iT.js"),[]).then(e=>e.wallet);case"app.hbwallet":return t?a(()=>import("./image-BlogSp8o.js"),[]).then(e=>e.default):a(()=>import("./index-CW58bOV7.js"),[]).then(e=>e.wallet);case"it.airgap":return t?a(()=>import("./image-5CGX_QL3.js"),[]).then(e=>e.default):a(()=>import("./index-YDG1R00C.js"),[]).then(e=>e.wallet);case"com.holdstation":return t?a(()=>import("./image-BcNLqzB4.js"),[]).then(e=>e.default):a(()=>import("./index-9Ml23qSY.js"),[]).then(e=>e.wallet);case"io.universaleverything":return t?a(()=>import("./image-D3z3GjMO.js"),[]).then(e=>e.default):a(()=>import("./index-qmNRbp6W.js"),[]).then(e=>e.wallet);case"com.abra":return t?a(()=>import("./image-CCgX-pcz.js"),[]).then(e=>e.default):a(()=>import("./index-_36_A-pH.js"),[]).then(e=>e.wallet);case"org.thepulsewallet":return t?a(()=>import("./image-BxfO9qDl.js"),[]).then(e=>e.default):a(()=>import("./index-DgNvhZ_M.js"),[]).then(e=>e.wallet);case"com.premanft":return t?a(()=>import("./image-pKZ5ApxC.js"),[]).then(e=>e.default):a(()=>import("./index-CbGJyo5C.js"),[]).then(e=>e.wallet);case"xyz.timelesswallet":return t?a(()=>import("./image-DUs_WIFe.js"),[]).then(e=>e.default):a(()=>import("./index-WXvxLSve.js"),[]).then(e=>e.wallet);case"org.bitizen":return t?a(()=>import("./image-TQ3Nh_VF.js"),[]).then(e=>e.default):a(()=>import("./index-Db_DlPJs.js"),[]).then(e=>e.wallet);case"app.ultimate":return t?a(()=>import("./image-ClyvBbEv.js"),[]).then(e=>e.default):a(()=>import("./index-D2Z8_AUU.js"),[]).then(e=>e.wallet);case"io.compasswallet":return t?a(()=>import("./image-D6x5dtDG.js"),[]).then(e=>e.default):a(()=>import("./index-2qmxPQhP.js"),[]).then(e=>e.wallet);case"app.fizzwallet":return t?a(()=>import("./image-E3PT44xu.js"),[]).then(e=>e.default):a(()=>import("./index-DAYuEFQ-.js"),[]).then(e=>e.wallet);case"com.xovawallet":return t?a(()=>import("./image-B02ECgsY.js"),[]).then(e=>e.default):a(()=>import("./index-Bap5Lkty.js"),[]).then(e=>e.wallet);case"app.nicegram":return t?a(()=>import("./image-DH5ootHk.js"),[]).then(e=>e.default):a(()=>import("./index-BEXV42kp.js"),[]).then(e=>e.wallet);case"io.zelcore":return t?a(()=>import("./image-CLUlwzEU.js"),[]).then(e=>e.default):a(()=>import("./index-BLO6pY9b.js"),[]).then(e=>e.wallet);case"app.freighter":return t?a(()=>import("./image-BanazMP9.js"),[]).then(e=>e.default):a(()=>import("./index-CcdGs50g.js"),[]).then(e=>e.wallet);case"app.stickey":return t?a(()=>import("./image-_t2-K1ZP.js"),[]).then(e=>e.default):a(()=>import("./index-Cu2rQjR7.js"),[]).then(e=>e.wallet);case"app.coinstats":return t?a(()=>import("./image-BlZLdRma.js"),[]).then(e=>e.default):a(()=>import("./index-j8xu_BhO.js"),[]).then(e=>e.wallet);case"io.harti":return t?a(()=>import("./image-Xfz-LkLu.js"),[]).then(e=>e.default):a(()=>import("./index-DPhI9JUn.js"),[]).then(e=>e.wallet);case"io.dttd":return t?a(()=>import("./image-pEGSGt6h.js"),[]).then(e=>e.default):a(()=>import("./index-CXYI0OjH.js"),[]).then(e=>e.wallet);case"com.tellaw":return t?a(()=>import("./image-sm-_D7TO.js"),[]).then(e=>e.default):a(()=>import("./index-Ddqy22qU.js"),[]).then(e=>e.wallet);case"io.klever":return t?a(()=>import("./image-BBFbQZtc.js"),[]).then(e=>e.default):a(()=>import("./index-BJAcAgB9.js"),[]).then(e=>e.wallet);case"com.unstoppabledomains":return t?a(()=>import("./image-EUVXQieb.js"),[]).then(e=>e.default):a(()=>import("./index-B1XrJIPH.js"),[]).then(e=>e.wallet);case"is.callback":return t?a(()=>import("./image-Mf3UQvEC.js"),[]).then(e=>e.default):a(()=>import("./index-DTtDhdi2.js"),[]).then(e=>e.wallet);case"ai.pundi":return t?a(()=>import("./image-9BTuaiXb.js"),[]).then(e=>e.default):a(()=>import("./index-Ca7jbqnT.js"),[]).then(e=>e.wallet);case"io.summonersarena":return t?a(()=>import("./image-3-p5LJAk.js"),[]).then(e=>e.default):a(()=>import("./index-ovz39Egy.js"),[]).then(e=>e.wallet);case"io.fizen":return t?a(()=>import("./image-CZLdphQJ.js"),[]).then(e=>e.default):a(()=>import("./index-WwjGYjHa.js"),[]).then(e=>e.wallet);case"fi.pillar":return t?a(()=>import("./image-CVAbhfmI.js"),[]).then(e=>e.default):a(()=>import("./index-BFJUkm8C.js"),[]).then(e=>e.wallet);case"world.ixo":return t?a(()=>import("./image-CsTNl20e.js"),[]).then(e=>e.default):a(()=>import("./index-C-A1j44m.js"),[]).then(e=>e.wallet);case"org.thetatoken":return t?a(()=>import("./image-BstOz2Sd.js"),[]).then(e=>e.default):a(()=>import("./index-BlU4B6pe.js"),[]).then(e=>e.wallet);case"net.gateweb3":return t?a(()=>import("./image-CypdirPa.js"),[]).then(e=>e.default):a(()=>import("./index-BkM7PWkU.js"),[]).then(e=>e.wallet);case"app.ammer":return t?a(()=>import("./image-BfGkQCHU.js"),[]).then(e=>e.default):a(()=>import("./index-C0HCn7GN.js"),[]).then(e=>e.wallet);case"us.binance":return t?a(()=>import("./image-DgkgLcDL.js"),[]).then(e=>e.default):a(()=>import("./index-BuhGQjsZ.js"),[]).then(e=>e.wallet);case"io.yusetoken":return t?a(()=>import("./image-CSAN5rKt.js"),[]).then(e=>e.default):a(()=>import("./index-DQ8_v09O.js"),[]).then(e=>e.wallet);case"co.muza":return t?a(()=>import("./image-CRsMfPT0.js"),[]).then(e=>e.default):a(()=>import("./index-5IpGHzAv.js"),[]).then(e=>e.wallet);case"io.hyperpay":return t?a(()=>import("./image-D8scG8aP.js"),[]).then(e=>e.default):a(()=>import("./index-BXZiXU-9.js"),[]).then(e=>e.wallet);case"io.cosmostation":return t?a(()=>import("./image-BYUgGshq.js"),[]).then(e=>e.default):a(()=>import("./index-RiIluuCN.js"),[]).then(e=>e.wallet);case"app.ryipay":return t?a(()=>import("./image-oKct0i27.js"),[]).then(e=>e.default):a(()=>import("./index-CdvxolxE.js"),[]).then(e=>e.wallet);case"io.wallet3":return t?a(()=>import("./image-DJLc6AlW.js"),[]).then(e=>e.default):a(()=>import("./index-C_5dy4gh.js"),[]).then(e=>e.wallet);case"org.dota168":return t?a(()=>import("./image-D3VAu6BC.js"),[]).then(e=>e.default):a(()=>import("./index-BP76iXI2.js"),[]).then(e=>e.wallet);case"com.bitpie":return t?a(()=>import("./image-BUsH-M52.js"),[]).then(e=>e.default):a(()=>import("./index-BKN05ia6.js"),[]).then(e=>e.wallet);case"com.coininn":return t?a(()=>import("./image-B_AAvjJY.js"),[]).then(e=>e.default):a(()=>import("./index-l2eJJ7mG.js"),[]).then(e=>e.wallet);case"me.easy":return t?a(()=>import("./image-BjKXKIhU.js"),[]).then(e=>e.default):a(()=>import("./index-4WvPsM5O.js"),[]).then(e=>e.wallet);case"io.shido":return t?a(()=>import("./image-BGZ2pFmO.js"),[]).then(e=>e.default):a(()=>import("./index-SaOy8OjI.js"),[]).then(e=>e.wallet);case"com.neonwallet":return t?a(()=>import("./image-D2051qUc.js"),[]).then(e=>e.default):a(()=>import("./index-CUJUgO36.js"),[]).then(e=>e.wallet);case"com.secuxtech":return t?a(()=>import("./image-DHHZDLK-.js"),[]).then(e=>e.default):a(()=>import("./index-D1G_5OyD.js"),[]).then(e=>e.wallet);case"com.unitywallet":return t?a(()=>import("./image-BqmT5urK.js"),[]).then(e=>e.default):a(()=>import("./index-BqxSKkSq.js"),[]).then(e=>e.wallet);case"io.miraiapp":return t?a(()=>import("./image-Bi1elmSL.js"),[]).then(e=>e.default):a(()=>import("./index-D0rQT1_1.js"),[]).then(e=>e.wallet);case"com.beexo":return t?a(()=>import("./image-MGwelZJS.js"),[]).then(e=>e.default):a(()=>import("./index-Bbv-4GNB.js"),[]).then(e=>e.wallet);case"social.halo":return t?a(()=>import("./image-CbnSXqJS.js"),[]).then(e=>e.default):a(()=>import("./index-KpPak-wu.js"),[]).then(e=>e.wallet);case"com.gemspocket":return t?a(()=>import("./image-DpGIEKrK.js"),[]).then(e=>e.default):a(()=>import("./index-RpXAvNRL.js"),[]).then(e=>e.wallet);case"app.status":return t?a(()=>import("./image-9509MPsE.js"),[]).then(e=>e.default):a(()=>import("./index-DLMSD3H_.js"),[]).then(e=>e.wallet);case"com.midoin":return t?a(()=>import("./image-BocNs9ze.js"),[]).then(e=>e.default):a(()=>import("./index-CrBWjlui.js"),[]).then(e=>e.wallet);case"id.competence":return t?a(()=>import("./image-CaqftHzf.js"),[]).then(e=>e.default):a(()=>import("./index-CGMXxK_x.js"),[]).then(e=>e.wallet);case"com.safemoon":return t?a(()=>import("./image-BcfiUDv-.js"),[]).then(e=>e.default):a(()=>import("./index-BgECKCj8.js"),[]).then(e=>e.wallet);case"llc.besc":return t?a(()=>import("./image-DLwHWQ4l.js"),[]).then(e=>e.default):a(()=>import("./index-CbMeskkV.js"),[]).then(e=>e.wallet);case"baby.smart":return t?a(()=>import("./image-VxDqDj0T.js"),[]).then(e=>e.default):a(()=>import("./index-BmKJ1abQ.js"),[]).then(e=>e.wallet);case"app.onto":return t?a(()=>import("./image-BCXqBewH.js"),[]).then(e=>e.default):a(()=>import("./index-BPFXH4g9.js"),[]).then(e=>e.wallet);case"com.ivirse":return t?a(()=>import("./image-8DkN4eFx.js"),[]).then(e=>e.default):a(()=>import("./index-CqWFxNbG.js"),[]).then(e=>e.wallet);case"one.mixin.messenger":return t?a(()=>import("./image-DecSbpNG.js"),[]).then(e=>e.default):a(()=>import("./index-PjYIiHEb.js"),[]).then(e=>e.wallet);case"cash.abpay":return t?a(()=>import("./image-Bb4ZLG-2.js"),[]).then(e=>e.default):a(()=>import("./index-BrvgJVgh.js"),[]).then(e=>e.wallet);case"ch.dssecurity":return t?a(()=>import("./image-ddsU9gPS.js"),[]).then(e=>e.default):a(()=>import("./index-DDdoZFD-.js"),[]).then(e=>e.wallet);case"com.concordium.wallet":return t?a(()=>import("./image-W5rUOVDT.js"),[]).then(e=>e.default):a(()=>import("./index-B5BAsv-B.js"),[]).then(e=>e.wallet);case"io.zkape":return t?a(()=>import("./image-Bm-o9RF3.js"),[]).then(e=>e.default):a(()=>import("./index-yLatYZZK.js"),[]).then(e=>e.wallet);case"com.paliwallet":return t?a(()=>import("./image-DqH_Lyo9.js"),[]).then(e=>e.default):a(()=>import("./index-C93NlSEw.js"),[]).then(e=>e.wallet);case"io.pitaka":return t?a(()=>import("./image-Bo8CHmCG.js"),[]).then(e=>e.default):a(()=>import("./index-DeQey0SH.js"),[]).then(e=>e.wallet);case"com.saitamatoken":return t?a(()=>import("./image-AlOoIjkb.js"),[]).then(e=>e.default):a(()=>import("./index-CNkg8_tm.js"),[]).then(e=>e.wallet);case"org.mugambo":return t?a(()=>import("./image-vXNBwFvw.js"),[]).then(e=>e.default):a(()=>import("./index-CqJjpCD5.js"),[]).then(e=>e.wallet);case"fi.stablez":return t?a(()=>import("./image-CruMo9Ar.js"),[]).then(e=>e.default):a(()=>import("./index-Wz7obrZB.js"),[]).then(e=>e.wallet);case"io.legacynetwork":return t?a(()=>import("./image-Dgb3Vdrr.js"),[]).then(e=>e.default):a(()=>import("./index-DLHjxUiX.js"),[]).then(e=>e.wallet);case"com.meld.app":return t?a(()=>import("./image-DrobCWF2.js"),[]).then(e=>e.default):a(()=>import("./index-BqLb859N.js"),[]).then(e=>e.wallet);case"io.bladewallet":return t?a(()=>import("./image-nqueMEws.js"),[]).then(e=>e.default):a(()=>import("./index-C0I75rp3.js"),[]).then(e=>e.wallet);case"com.authentrend":return t?a(()=>import("./image-CmzmxiTz.js"),[]).then(e=>e.default):a(()=>import("./index-0qRtNAQn.js"),[]).then(e=>e.wallet);case"com.webauth":return t?a(()=>import("./image-EyKsXf_1.js"),[]).then(e=>e.default):a(()=>import("./index-BXnDDK-y.js"),[]).then(e=>e.wallet);case"xyz.tucop":return t?a(()=>import("./image-8r04P3UP.js"),[]).then(e=>e.default):a(()=>import("./index-Bbznecif.js"),[]).then(e=>e.wallet);case"pro.fintoken":return t?a(()=>import("./image-BBez6ov1.js"),[]).then(e=>e.default):a(()=>import("./index-CP3DQPwx.js"),[]).then(e=>e.wallet);case"io.nash":return t?a(()=>import("./image--fcqsYch.js"),[]).then(e=>e.default):a(()=>import("./index-Bx9srovK.js"),[]).then(e=>e.wallet);case"vc.uincubator.api":return t?a(()=>import("./image-CyLv-qKv.js"),[]).then(e=>e.default):a(()=>import("./index-B5AZ3O3C.js"),[]).then(e=>e.wallet);case"io.unagi.unawallet":return t?a(()=>import("./image-C6ewnpHo.js"),[]).then(e=>e.default):a(()=>import("./index-CD7cY8HX.js"),[]).then(e=>e.wallet);case"io.nonbank":return t?a(()=>import("./image-TA_PkYBz.js"),[]).then(e=>e.default):a(()=>import("./index-DSWhMtMn.js"),[]).then(e=>e.wallet);case"io.armana.portal":return t?a(()=>import("./image-CI3i53ES.js"),[]).then(e=>e.default):a(()=>import("./index-DuTQzi4Z.js"),[]).then(e=>e.wallet);case"com.x9wallet":return t?a(()=>import("./image-BnT6IaIq.js"),[]).then(e=>e.default):a(()=>import("./index-K7y9yqJI.js"),[]).then(e=>e.wallet);case"io.kigo":return t?a(()=>import("./image-D9i7y0RW.js"),[]).then(e=>e.default):a(()=>import("./index-BIFgx20V.js"),[]).then(e=>e.wallet);case"com.alphawallet":return t?a(()=>import("./image-xJO47ptb.js"),[]).then(e=>e.default):a(()=>import("./index-B78E3fcT.js"),[]).then(e=>e.wallet);case"com.getcogni":return t?a(()=>import("./image-CwsKp0mM.js"),[]).then(e=>e.default):a(()=>import("./index-BNlDhEDg.js"),[]).then(e=>e.wallet);case"app.sinum":return t?a(()=>import("./image-DTy0DgOV.js"),[]).then(e=>e.default):a(()=>import("./index-D5GVUjIM.js"),[]).then(e=>e.wallet);case"finance.soulswap.app":return t?a(()=>import("./image-BI8lK7Gl.js"),[]).then(e=>e.default):a(()=>import("./index-CB_NguTF.js"),[]).then(e=>e.wallet);case"io.loopring.wallet":return t?a(()=>import("./image-BdLvgjKp.js"),[]).then(e=>e.default):a(()=>import("./index-DpoJvg5R.js"),[]).then(e=>e.wallet);case"com.shapeshift":return t?a(()=>import("./image-T2oAotCg.js"),[]).then(e=>e.default):a(()=>import("./index-CdMxme0L.js"),[]).then(e=>e.wallet);case"io.trinity-tech":return t?a(()=>import("./image-bHVCC2t9.js"),[]).then(e=>e.default):a(()=>import("./index-JNZoio_2.js"),[]).then(e=>e.wallet);case"money.keychain":return t?a(()=>import("./image-CHotlokX.js"),[]).then(e=>e.default):a(()=>import("./index-C2CZkwuV.js"),[]).then(e=>e.wallet);case"com.superhero.cordova":return t?a(()=>import("./image-CsmwtAjX.js"),[]).then(e=>e.default):a(()=>import("./index-C5X26G0P.js"),[]).then(e=>e.wallet);case"com.bettatrade":return t?a(()=>import("./image-B4MULACL.js"),[]).then(e=>e.default):a(()=>import("./index-qNIXx6_B.js"),[]).then(e=>e.wallet);case"online.puzzle":return t?a(()=>import("./image-C4hEqt6v.js"),[]).then(e=>e.default):a(()=>import("./index-D2-ySoTs.js"),[]).then(e=>e.wallet);case"gg.indi":return t?a(()=>import("./image-DdicXBNF.js"),[]).then(e=>e.default):a(()=>import("./index-BTkNDmCP.js"),[]).then(e=>e.wallet);case"io.tradestrike":return t?a(()=>import("./image-Bsv1aEQB.js"),[]).then(e=>e.default):a(()=>import("./index-CLtv9-lU.js"),[]).then(e=>e.wallet);case"xyz.echooo":return t?a(()=>import("./image-C7H4CQ65.js"),[]).then(e=>e.default):a(()=>import("./index-B-UTLjBc.js"),[]).then(e=>e.wallet);case"com.kryptogo":return t?a(()=>import("./image-D3ALeCj7.js"),[]).then(e=>e.default):a(()=>import("./index-BtBx3hi1.js"),[]).then(e=>e.wallet);case"io.trustasset":return t?a(()=>import("./image-BfmBx3-B.js"),[]).then(e=>e.default):a(()=>import("./index-MECmwSvw.js"),[]).then(e=>e.wallet);case"app.utorg":return t?a(()=>import("./image-CyF2UJbG.js"),[]).then(e=>e.default):a(()=>import("./index-DK-e_E51.js"),[]).then(e=>e.wallet);case"app.dfinnwallet":return t?a(()=>import("./image-DGLcwgsS.js"),[]).then(e=>e.default):a(()=>import("./index-DR-ujXcj.js"),[]).then(e=>e.wallet);case"org.rezor":return t?a(()=>import("./image-D_0i3ZH4.js"),[]).then(e=>e.default):a(()=>import("./index-DlKNOIdN.js"),[]).then(e=>e.wallet);case"io.legionnetwork":return t?a(()=>import("./image-BszqTwo7.js"),[]).then(e=>e.default):a(()=>import("./index-DMyHg26L.js"),[]).then(e=>e.wallet);case"cc.maxwallet":return t?a(()=>import("./image-CxvWjDXv.js"),[]).then(e=>e.default):a(()=>import("./index-Dy45c3qF.js"),[]).then(e=>e.wallet);case"com.ripio":return t?a(()=>import("./image-DZpGtN5l.js"),[]).then(e=>e.default):a(()=>import("./index-BoC-cn90.js"),[]).then(e=>e.wallet);case"com.fxwallet":return t?a(()=>import("./image-Bkj-ZRbS.js"),[]).then(e=>e.default):a(()=>import("./index-D8dYcFAn.js"),[]).then(e=>e.wallet);case"inc.tomo":return t?a(()=>import("./image-rw28GAIu.js"),[]).then(e=>e.default):a(()=>import("./index-Bh8eOJMM.js"),[]).then(e=>e.wallet);case"me.komet.app":return t?a(()=>import("./image-29vwsAfI.js"),[]).then(e=>e.default):a(()=>import("./index-CapnWgEl.js"),[]).then(e=>e.wallet);case"io.guardiianwallet":return t?a(()=>import("./image-DIDeRhKH.js"),[]).then(e=>e.default):a(()=>import("./index-CWTqaiN6.js"),[]).then(e=>e.wallet);case"io.hacken.hai":return t?a(()=>import("./image-Fq457JJn.js"),[]).then(e=>e.default):a(()=>import("./index-BH1-nK1j.js"),[]).then(e=>e.wallet);case"com.zypto":return t?a(()=>import("./image-D9OC6Qfy.js"),[]).then(e=>e.default):a(()=>import("./index-5U2ZJeh5.js"),[]).then(e=>e.wallet);case"io.nabox":return t?a(()=>import("./image-CJb0NNxX.js"),[]).then(e=>e.default):a(()=>import("./index-Cl87iGjg.js"),[]).then(e=>e.wallet);case"com.tastycrypto":return t?a(()=>import("./image-IpgDqPq2.js"),[]).then(e=>e.default):a(()=>import("./index-CXgqt45P.js"),[]).then(e=>e.wallet);case"com.ballet":return t?a(()=>import("./image-DNyYhMNV.js"),[]).then(e=>e.default):a(()=>import("./index-DhFHq_nZ.js"),[]).then(e=>e.wallet);case"io.talken":return t?a(()=>import("./image-DjXN5hvv.js"),[]).then(e=>e.default):a(()=>import("./index-CuJtvtqs.js"),[]).then(e=>e.wallet);case"io.wallacy":return t?a(()=>import("./image-CdGvq_lV.js"),[]).then(e=>e.default):a(()=>import("./index-DcUozftP.js"),[]).then(e=>e.wallet);case"network.mrhb":return t?a(()=>import("./image-CaBQfcNB.js"),[]).then(e=>e.default):a(()=>import("./index-BpspMk9l.js"),[]).then(e=>e.wallet);case"io.pockie":return t?a(()=>import("./image-D13kcv8b.js"),[]).then(e=>e.default):a(()=>import("./index-Bd7BhrCK.js"),[]).then(e=>e.wallet);case"me.astrox":return t?a(()=>import("./image-BGSprUxs.js"),[]).then(e=>e.default):a(()=>import("./index-BM9GzZ_o.js"),[]).then(e=>e.wallet);case"com.thirdweb":return t?a(()=>import("./image--O11VYbP.js"),[]).then(e=>e.default):a(()=>import("./index-VZmM-6RJ.js"),[]).then(e=>e.wallet);case"com.poolsmobility.wallet":return t?a(()=>import("./image-CUFBkGzy.js"),[]).then(e=>e.default):a(()=>import("./index-DMyDV-OH.js"),[]).then(e=>e.wallet);case"xyz.roam.wallet":return t?a(()=>import("./image-BBk5bBxJ.js"),[]).then(e=>e.default):a(()=>import("./index-DACt8hFb.js"),[]).then(e=>e.wallet);case"app.gamic":return t?a(()=>import("./image-CbmAI5Wi.js"),[]).then(e=>e.default):a(()=>import("./index-D09WfuKj.js"),[]).then(e=>e.wallet);case"app.m1nty":return t?a(()=>import("./image-8Zz6I0OH.js"),[]).then(e=>e.default):a(()=>import("./index-CU6cpe0O.js"),[]).then(e=>e.wallet);case"network.trustkeys":return t?a(()=>import("./image-BJAlBW3-.js"),[]).then(e=>e.default):a(()=>import("./index-BSA2BPZ9.js"),[]).then(e=>e.wallet);case"com.caesiumlab":return t?a(()=>import("./image-DLtkWmCC.js"),[]).then(e=>e.default):a(()=>import("./index-CZNdz8B6.js"),[]).then(e=>e.wallet);case"app.catecoin":return t?a(()=>import("./image-BIIaxSfC.js"),[]).then(e=>e.default):a(()=>import("./index-DNynPGua.js"),[]).then(e=>e.wallet);case"com.hootark":return t?a(()=>import("./image-BQTKy54v.js"),[]).then(e=>e.default):a(()=>import("./index-DhlaSoR4.js"),[]).then(e=>e.wallet);case"com.crossmint":return t?a(()=>import("./image-DrH3Wn2w.js"),[]).then(e=>e.default):a(()=>import("./index-Czf-i91G.js"),[]).then(e=>e.wallet);case"com.coincircle":return t?a(()=>import("./image-DOcz3CQ4.js"),[]).then(e=>e.default):a(()=>import("./index-Crs9jVrm.js"),[]).then(e=>e.wallet);case"io.bharatbox":return t?a(()=>import("./image-D1eN-vq9.js"),[]).then(e=>e.default):a(()=>import("./index-CdYRC4Ux.js"),[]).then(e=>e.wallet);case"nl.greenhood.wallet":return t?a(()=>import("./image-Cyy1KupU.js"),[]).then(e=>e.default):a(()=>import("./index-BPgl8Hhp.js"),[]).then(e=>e.wallet);case"co.swopme":return t?a(()=>import("./image-B6SAWLjq.js"),[]).then(e=>e.default):a(()=>import("./index-DMAP8qTI.js"),[]).then(e=>e.wallet);case"com.kresus":return t?a(()=>import("./image-DesBMjvP.js"),[]).then(e=>e.default):a(()=>import("./index-oEcArN4B.js"),[]).then(e=>e.wallet);case"com.dolletwallet":return t?a(()=>import("./image-fjbgiffe.js"),[]).then(e=>e.default):a(()=>import("./index-CCIAeA2T.js"),[]).then(e=>e.wallet);case"net.shinobi-wallet":return t?a(()=>import("./image-WbOd8jAJ.js"),[]).then(e=>e.default):a(()=>import("./index-CZmLnawh.js"),[]).then(e=>e.wallet);case"com.azcoiner":return t?a(()=>import("./image-BQcTbEVl.js"),[]).then(e=>e.default):a(()=>import("./index-t6B_NULY.js"),[]).then(e=>e.wallet);case"com.passwallet.app":return t?a(()=>import("./image-DJYKaoNi.js"),[]).then(e=>e.default):a(()=>import("./index-Ct6AYfZ-.js"),[]).then(e=>e.wallet);case"app.qubic.wallet":return t?a(()=>import("./image-BBZFtk5k.js"),[]).then(e=>e.default):a(()=>import("./index-DoKwRUhz.js"),[]).then(e=>e.wallet);case"com.coinex.wallet":return t?a(()=>import("./image-CfglWSsQ.js"),[]).then(e=>e.default):a(()=>import("./index-DMEV07wA.js"),[]).then(e=>e.wallet);case"app.xverse":return t?a(()=>import("./image-DETlLb_v.js"),[]).then(e=>e.default):a(()=>import("./index-DAlw00ee.js"),[]).then(e=>e.wallet);case"com.flash-wallet":return t?a(()=>import("./image-BzGwleUn.js"),[]).then(e=>e.default):a(()=>import("./index-7BdGIDy3.js"),[]).then(e=>e.wallet);case"com.vgxfoundation":return t?a(()=>import("./image-C6NJnfCW.js"),[]).then(e=>e.default):a(()=>import("./index-CsAX4sL-.js"),[]).then(e=>e.wallet);case"org.arianee":return t?a(()=>import("./image-B6VmDbM6.js"),[]).then(e=>e.default):a(()=>import("./index-Cx8lAzRu.js"),[]).then(e=>e.wallet);case"io.myabcwallet":return t?a(()=>import("./image-jv6wUF7a.js"),[]).then(e=>e.default):a(()=>import("./index-3an-fsOm.js"),[]).then(e=>e.wallet);case"io.owallet":return t?a(()=>import("./image-DGhNZ1rS.js"),[]).then(e=>e.default):a(()=>import("./index-D2_d10WC.js"),[]).then(e=>e.wallet);case"io.zelus":return t?a(()=>import("./image-1epPqHV4.js"),[]).then(e=>e.default):a(()=>import("./index-hUldZ-v8.js"),[]).then(e=>e.wallet);case"net.myrenegade":return t?a(()=>import("./image-SJHuomz2.js"),[]).then(e=>e.default):a(()=>import("./index-C5gBqe1B.js"),[]).then(e=>e.wallet);case"io.clingon":return t?a(()=>import("./image-2s8lIjLJ.js"),[]).then(e=>e.default):a(()=>import("./index-Dk8LF9Yk.js"),[]).then(e=>e.wallet);case"com.icewal":return t?a(()=>import("./image-rdvu9IOp.js"),[]).then(e=>e.default):a(()=>import("./index-Cd5Dye5X.js"),[]).then(e=>e.wallet);case"io.streakk":return t?a(()=>import("./image-CcPbeTXv.js"),[]).then(e=>e.default):a(()=>import("./index-CrGDBMbK.js"),[]).then(e=>e.wallet);case"com.dokwallet":return t?a(()=>import("./image-BRPzDWpX.js"),[]).then(e=>e.default):a(()=>import("./index-xEbiF_Me.js"),[]).then(e=>e.wallet);case"finance.porta":return t?a(()=>import("./image-BNvlqRxs.js"),[]).then(e=>e.default):a(()=>import("./index-DSL1LhIu.js"),[]).then(e=>e.wallet);case"io.prettygood.x":return t?a(()=>import("./image-BhmKXBqm.js"),[]).then(e=>e.default):a(()=>import("./index-DfafaK4Q.js"),[]).then(e=>e.wallet);case"io.earthwallet":return t?a(()=>import("./image-BOJcifnx.js"),[]).then(e=>e.default):a(()=>import("./index-BmwlJTQ-.js"),[]).then(e=>e.wallet);case"net.spatium.wallet":return t?a(()=>import("./image-CmrOpLf4.js"),[]).then(e=>e.default):a(()=>import("./index-Fd858RJQ.js"),[]).then(e=>e.wallet);case"live.superex":return t?a(()=>import("./image-ByHnaba8.js"),[]).then(e=>e.default):a(()=>import("./index-DqVvpGRi.js"),[]).then(e=>e.wallet);case"com.adftechnology":return t?a(()=>import("./image-C6LRjQzh.js"),[]).then(e=>e.default):a(()=>import("./index-C-b1qpM9.js"),[]).then(e=>e.wallet);case"com.bscecowallet":return t?a(()=>import("./image-8u03hBEl.js"),[]).then(e=>e.default):a(()=>import("./index-Dn2svNQz.js"),[]).then(e=>e.wallet);case"io.wallypto":return t?a(()=>import("./image-CRU88082.js"),[]).then(e=>e.default):a(()=>import("./index-j06jujv2.js"),[]).then(e=>e.wallet);case"com.reown":return t?a(()=>import("./image-D3tLM-DF.js"),[]).then(e=>e.default):a(()=>import("./index-DibwKtF2.js"),[]).then(e=>e.wallet);case"finance.voltage":return t?a(()=>import("./image-ZVoqlWXW.js"),[]).then(e=>e.default):a(()=>import("./index-XRQW1mUN.js"),[]).then(e=>e.wallet);case"com.walletconnect":return t?a(()=>import("./image-BAS5CqSz.js"),[]).then(e=>e.default):a(()=>import("./index-B-BftUxa.js"),[]).then(e=>e.wallet);case"io.passpay":return t?a(()=>import("./image-Ci0UFTFy.js"),[]).then(e=>e.default):a(()=>import("./index-CP_9UNXA.js"),[]).then(e=>e.wallet);case"technology.obvious":return t?a(()=>import("./image-ZLtraAGN.js"),[]).then(e=>e.default):a(()=>import("./index-BzNpkHfI.js"),[]).then(e=>e.wallet);case"io.plutope":return t?a(()=>import("./image-Bz03or90.js"),[]).then(e=>e.default):a(()=>import("./index-CszQa87W.js"),[]).then(e=>e.wallet);case"io.buzz-up":return t?a(()=>import("./image-BsQYdoXP.js"),[]).then(e=>e.default):a(()=>import("./index-BoJGVmma.js"),[]).then(e=>e.wallet);case"co.xellar":return t?a(()=>import("./image-D2QL-j27.js"),[]).then(e=>e.default):a(()=>import("./index-cdlur5jM.js"),[]).then(e=>e.wallet);case"com.kaxaa":return t?a(()=>import("./image-DPzEe6a_.js"),[]).then(e=>e.default):a(()=>import("./index-DFSGuScS.js"),[]).then(e=>e.wallet);case"org.shefi":return t?a(()=>import("./image-DwUGDFj5.js"),[]).then(e=>e.default):a(()=>import("./index-Dtavj5eK.js"),[]).then(e=>e.wallet);case"xyz.orion":return t?a(()=>import("./image-CCDmsN6r.js"),[]).then(e=>e.default):a(()=>import("./index-Ba2OoCBH.js"),[]).then(e=>e.wallet);case"world.dosi.vault":return t?a(()=>import("./image-Cy0vmJls.js"),[]).then(e=>e.default):a(()=>import("./index-eujSyrnd.js"),[]).then(e=>e.wallet);case"network.gridlock":return t?a(()=>import("./image-CxyHP7w7.js"),[]).then(e=>e.default):a(()=>import("./index-Ce98wt2N.js"),[]).then(e=>e.wallet);case"finance.plena":return t?a(()=>import("./image-Cwg1QVuh.js"),[]).then(e=>e.default):a(()=>import("./index-BG1ZQeCA.js"),[]).then(e=>e.wallet);case"cc.dropp":return t?a(()=>import("./image-CAIffJi4.js"),[]).then(e=>e.default):a(()=>import("./index-HFnaQWCU.js"),[]).then(e=>e.wallet);case"io.scramberry":return t?a(()=>import("./image-D8ARN-Gu.js"),[]).then(e=>e.default):a(()=>import("./index-BIcsFldg.js"),[]).then(e=>e.wallet);case"xyz.bonuz":return t?a(()=>import("./image-HcidEyjv.js"),[]).then(e=>e.default):a(()=>import("./index-BZhX-e71.js"),[]).then(e=>e.wallet);case"com.bmawallet":return t?a(()=>import("./image-kZBIIBVa.js"),[]).then(e=>e.default):a(()=>import("./index-BM8c6qO-.js"),[]).then(e=>e.wallet);case"co.lifedefi":return t?a(()=>import("./image-DRpXk5be.js"),[]).then(e=>e.default):a(()=>import("./index-otRo5H2H.js"),[]).then(e=>e.wallet);case"com.get-verso":return t?a(()=>import("./image-CgzMLfDa.js"),[]).then(e=>e.default):a(()=>import("./index-DAEFTu29.js"),[]).then(e=>e.wallet);case"io.blocto":return t?a(()=>import("./image-FnAIuX7S.js"),[]).then(e=>e.default):a(()=>import("./index-ZITrt5Fi.js"),[]).then(e=>e.wallet);case"com.pandoshi":return t?a(()=>import("./image-PWpnYSKI.js"),[]).then(e=>e.default):a(()=>import("./index-BmXd0pys.js"),[]).then(e=>e.wallet);case"io.getclave":return t?a(()=>import("./image-rvsWf8U_.js"),[]).then(e=>e.default):a(()=>import("./index--rITGawC.js"),[]).then(e=>e.wallet);case"technology.jambo":return t?a(()=>import("./image-Bx8ULApC.js"),[]).then(e=>e.default):a(()=>import("./index-C2KnoZm4.js"),[]).then(e=>e.wallet);case"app.edge":return t?a(()=>import("./image-1-dOu4Yt.js"),[]).then(e=>e.default):a(()=>import("./index-stFagoJS.js"),[]).then(e=>e.wallet);case"io.banksocial":return t?a(()=>import("./image-OrIz0o8m.js"),[]).then(e=>e.default):a(()=>import("./index-Ia3LffGn.js"),[]).then(e=>e.wallet);case"io.konio":return t?a(()=>import("./image-C2Wl7RAy.js"),[]).then(e=>e.default):a(()=>import("./index-B-kI7R4f.js"),[]).then(e=>e.wallet);case"com.qubetics":return t?a(()=>import("./image-DLvMDcgw.js"),[]).then(e=>e.default):a(()=>import("./index-C_j5E1ow.js"),[]).then(e=>e.wallet);case"app.imem":return t?a(()=>import("./image-Atwyf6cQ.js"),[]).then(e=>e.default):a(()=>import("./index-KXLAu1y1.js"),[]).then(e=>e.wallet);case"com.purechain":return t?a(()=>import("./image-DgU8tR58.js"),[]).then(e=>e.default):a(()=>import("./index-G-h-xM0C.js"),[]).then(e=>e.wallet);case"io.ethos":return t?a(()=>import("./image-DmNOl1OW.js"),[]).then(e=>e.default):a(()=>import("./index-DmLPMpkA.js"),[]).then(e=>e.wallet);case"io.didwallet":return t?a(()=>import("./image-CzKmxeZp.js"),[]).then(e=>e.default):a(()=>import("./index-QGSP4PI8.js"),[]).then(e=>e.wallet);case"com.dextrade":return t?a(()=>import("./image-B_ozWfd0.js"),[]).then(e=>e.default):a(()=>import("./index-CdOxXIip.js"),[]).then(e=>e.wallet);case"org.kelp":return t?a(()=>import("./image-CcKS-8-S.js"),[]).then(e=>e.default):a(()=>import("./index-DUBZIaC-.js"),[]).then(e=>e.wallet);case"xyz.nestwallet":return t?a(()=>import("./image-Bq1UxveY.js"),[]).then(e=>e.default):a(()=>import("./index-uKvrIGe-.js"),[]).then(e=>e.wallet);case"com.cryptnox":return t?a(()=>import("./image-UFnS_pK0.js"),[]).then(e=>e.default):a(()=>import("./index-ComRbnem.js"),[]).then(e=>e.wallet);case"land.liker":return t?a(()=>import("./image-C_JPqQZj.js"),[]).then(e=>e.default):a(()=>import("./index-CId5PD0X.js"),[]).then(e=>e.wallet);case"io.hippowallet":return t?a(()=>import("./image-BdJA4XzW.js"),[]).then(e=>e.default):a(()=>import("./index-BTzbgIH6.js"),[]).then(e=>e.wallet);case"io.certhis":return t?a(()=>import("./image-bSOL4gQb.js"),[]).then(e=>e.default):a(()=>import("./index-BxtNhRvf.js"),[]).then(e=>e.wallet);case"io.safecryptowallet":return t?a(()=>import("./image-DFF2Z6Pk.js"),[]).then(e=>e.default):a(()=>import("./index-CWdL5XwO.js"),[]).then(e=>e.wallet);case"com.saify":return t?a(()=>import("./image-DOwBqPVS.js"),[]).then(e=>e.default):a(()=>import("./index-De1eZyIJ.js"),[]).then(e=>e.wallet);case"com.tiduswallet":return t?a(()=>import("./image-DzJAqGfB.js"),[]).then(e=>e.default):a(()=>import("./index-BMPGw_D6.js"),[]).then(e=>e.wallet);case"io.uptn.dapp-web":return t?a(()=>import("./image-C4ELurjg.js"),[]).then(e=>e.default):a(()=>import("./index-jsmqr-24.js"),[]).then(e=>e.wallet);case"com.it.onewallet":return t?a(()=>import("./image-CWCOKSln.js"),[]).then(e=>e.default):a(()=>import("./index-DHNwai-Z.js"),[]).then(e=>e.wallet);case"com.rktechworks":return t?a(()=>import("./image-BhECDi_9.js"),[]).then(e=>e.default):a(()=>import("./index-D6xvjdG0.js"),[]).then(e=>e.wallet);case"com.revelator.wallet":return t?a(()=>import("./image-nW5JvdXC.js"),[]).then(e=>e.default):a(()=>import("./index-CNl69Nv0.js"),[]).then(e=>e.wallet);case"com.sinohope":return t?a(()=>import("./image-D7P0qSfx.js"),[]).then(e=>e.default):a(()=>import("./index-DKzyJcIY.js"),[]).then(e=>e.wallet);case"network.dgg":return t?a(()=>import("./image-DrraBYJZ.js"),[]).then(e=>e.default):a(()=>import("./index-DnUUaSfF.js"),[]).then(e=>e.wallet);case"io.up":return t?a(()=>import("./image-DbpOM2LD.js"),[]).then(e=>e.default):a(()=>import("./index-BuWGQyCe.js"),[]).then(e=>e.wallet);case"com.lif3":return t?a(()=>import("./image-DC2DOoz2.js"),[]).then(e=>e.default):a(()=>import("./index-BKkJhanY.js"),[]).then(e=>e.wallet);case"io.bimwallet":return t?a(()=>import("./image-BKSQyIc5.js"),[]).then(e=>e.default):a(()=>import("./index-3DerMn1X.js"),[]).then(e=>e.wallet);case"pub.dg":return t?a(()=>import("./image-C4KoLZ1v.js"),[]).then(e=>e.default):a(()=>import("./index-D6d2Y6jv.js"),[]).then(e=>e.wallet);case"com.wemix":return t?a(()=>import("./image-CawBnBIo.js"),[]).then(e=>e.default):a(()=>import("./index-18L0wZ74.js"),[]).then(e=>e.wallet);case"com.pierwallet":return t?a(()=>import("./image-DA8Sg5HZ.js"),[]).then(e=>e.default):a(()=>import("./index-mJTgSazQ.js"),[]).then(e=>e.wallet);case"net.stasis":return t?a(()=>import("./image-CyE6Mi3e.js"),[]).then(e=>e.default):a(()=>import("./index-CJ8I9s4o.js"),[]).then(e=>e.wallet);case"com.peakdefi":return t?a(()=>import("./image-DUcJQ0b3.js"),[]).then(e=>e.default):a(()=>import("./index-DEMIRENu.js"),[]).then(e=>e.wallet);case"com.3swallet":return t?a(()=>import("./image-CD3he1Tj.js"),[]).then(e=>e.default):a(()=>import("./index-DVGcX2HE.js"),[]).then(e=>e.wallet);case"com.example.subdomain":return t?a(()=>import("./image-Cs2bevZt.js"),[]).then(e=>e.default):a(()=>import("./index-CJt068xh.js"),[]).then(e=>e.wallet);case"com.reown.appkit-lab":return t?a(()=>import("./image-CnDG0aor.js"),[]).then(e=>e.default):a(()=>import("./index-BzfyCotn.js"),[]).then(e=>e.wallet);case"com.opz":return t?a(()=>import("./image-D1qvgd7h.js"),[]).then(e=>e.default):a(()=>import("./index-CMGByxdA.js"),[]).then(e=>e.wallet);case"ai.spotonchain.platform":return t?a(()=>import("./image-C6QSWUy4.js"),[]).then(e=>e.default):a(()=>import("./index-Ba7PpD6d.js"),[]).then(e=>e.wallet);case"org.dailychain.wallet":return t?a(()=>import("./image-BJ_lqI1X.js"),[]).then(e=>e.default):a(()=>import("./index-DQa9pNJd.js"),[]).then(e=>e.wallet);case"app.omni":return t?a(()=>import("./image-CqLwuE__.js"),[]).then(e=>e.default):a(()=>import("./index-D_7wDcMK.js"),[]).then(e=>e.wallet);case"id.plumaa":return t?a(()=>import("./image-BvJKCSpY.js"),[]).then(e=>e.default):a(()=>import("./index-D45a0k-1.js"),[]).then(e=>e.wallet);case"io.ttmwallet":return t?a(()=>import("./image-Chg2WzE1.js"),[]).then(e=>e.default):a(()=>import("./index-CLikIjn_.js"),[]).then(e=>e.wallet);case"io.kgen":return t?a(()=>import("./image-DFYGQEwh.js"),[]).then(e=>e.default):a(()=>import("./index-BQWXi0by.js"),[]).then(e=>e.wallet);case"com.nufinetes":return t?a(()=>import("./image-CpFHTO_m.js"),[]).then(e=>e.default):a(()=>import("./index-B8De2hoC.js"),[]).then(e=>e.wallet);case"com.squirrelwallet":return t?a(()=>import("./image-bHJO6btW.js"),[]).then(e=>e.default):a(()=>import("./index-DyaPXLoO.js"),[]).then(e=>e.wallet);case"eu.trusteeglobal":return t?a(()=>import("./image-cDoShVvl.js"),[]).then(e=>e.default):a(()=>import("./index-B51294pb.js"),[]).then(e=>e.wallet);case"com.daffione":return t?a(()=>import("./image-Dtc98pdf.js"),[]).then(e=>e.default):a(()=>import("./index-BIXqJF5y.js"),[]).then(e=>e.wallet);case"com.saakuru.app":return t?a(()=>import("./image-TQLBEOIW.js"),[]).then(e=>e.default):a(()=>import("./index-CjVYDT09.js"),[]).then(e=>e.wallet);case"io.r0ar":return t?a(()=>import("./image-4bx5chOJ.js"),[]).then(e=>e.default):a(()=>import("./index-CfCXSq_b.js"),[]).then(e=>e.wallet);case"com.nodle":return t?a(()=>import("./image-tiHbZ1Vk.js"),[]).then(e=>e.default):a(()=>import("./index-BwL47YsA.js"),[]).then(e=>e.wallet);case"app.tofee":return t?a(()=>import("./image-DpHbdMp9.js"),[]).then(e=>e.default):a(()=>import("./index-Bk-uZV0j.js"),[]).then(e=>e.wallet);case"io.pltwallet":return t?a(()=>import("./image-BIDqxk8w.js"),[]).then(e=>e.default):a(()=>import("./index-eiEAIzdd.js"),[]).then(e=>e.wallet);case"org.talkapp":return t?a(()=>import("./image-BkKo9DtA.js"),[]).then(e=>e.default):a(()=>import("./index-BGGk2Hck.js"),[]).then(e=>e.wallet);case"io.ready":return t?a(()=>import("./image-BwjeUYie.js"),[]).then(e=>e.default):a(()=>import("./index-BQwDdmmS.js"),[]).then(e=>e.wallet);case"app.w3wallet":return t?a(()=>import("./image-Covp72ND.js"),[]).then(e=>e.default):a(()=>import("./index-Cb41eDDJ.js"),[]).then(e=>e.wallet);case"pro.ds.app":return t?a(()=>import("./image-Bktw-NJ-.js"),[]).then(e=>e.default):a(()=>import("./index-b5ABnFKj.js"),[]).then(e=>e.wallet);case"com.reown.docs":return t?a(()=>import("./image-V4qYiUxw.js"),[]).then(e=>e.default):a(()=>import("./index-DsgD7D-8.js"),[]).then(e=>e.wallet);case"com.apollox":return t?a(()=>import("./image-ss2LFlQu.js"),[]).then(e=>e.default):a(()=>import("./index-BLMjeGJ-.js"),[]).then(e=>e.wallet);case"com.ipmb":return t?a(()=>import("./image-CirJIT7l.js"),[]).then(e=>e.default):a(()=>import("./index-DP0utIbV.js"),[]).then(e=>e.wallet);case"com.payperless":return t?a(()=>import("./image-q4XfUN6v.js"),[]).then(e=>e.default):a(()=>import("./index-szNElS1a.js"),[]).then(e=>e.wallet);case"com.obliowallet":return t?a(()=>import("./image-BGxqJH7c.js"),[]).then(e=>e.default):a(()=>import("./index-JuvDLDuk.js"),[]).then(e=>e.wallet);case"app.keeper-wallet":return t?a(()=>import("./image-Dpgf4dcg.js"),[]).then(e=>e.default):a(()=>import("./index-DlfGjmz4.js"),[]).then(e=>e.wallet);case"io.paraswap":return t?a(()=>import("./image-CQKjvlto.js"),[]).then(e=>e.default):a(()=>import("./index-DjLE3t9q.js"),[]).then(e=>e.wallet);case"org.ecoinwallet":return t?a(()=>import("./image-C3Va51zP.js"),[]).then(e=>e.default):a(()=>import("./index-DFZNHq44.js"),[]).then(e=>e.wallet);case"fi.dropmate":return t?a(()=>import("./image-5xiz28Wo.js"),[]).then(e=>e.default):a(()=>import("./index-p0ATWoVh.js"),[]).then(e=>e.wallet);case"com.cryptokara":return t?a(()=>import("./image-Dqbrewdt.js"),[]).then(e=>e.default):a(()=>import("./index-Cfzzcvgo.js"),[]).then(e=>e.wallet);case"co.cyber.wallet":return t?a(()=>import("./image-BvkSxpXq.js"),[]).then(e=>e.default):a(()=>import("./index-e_qeQmc1.js"),[]).then(e=>e.wallet);case"com.kriptonio":return t?a(()=>import("./image-D_cIj1db.js"),[]).then(e=>e.default):a(()=>import("./index-Dxm6Y7eO.js"),[]).then(e=>e.wallet);case"digital.minerva":return t?a(()=>import("./image-D5wxf47e.js"),[]).then(e=>e.default):a(()=>import("./index-HnCuhDYJ.js"),[]).then(e=>e.wallet);case"com.mpcvault.broswerplugin":return t?a(()=>import("./image-BN4ovMrn.js"),[]).then(e=>e.default):a(()=>import("./index-BXY5tnuK.js"),[]).then(e=>e.wallet);case"com.liberawallet":return t?a(()=>import("./image-DyrMImIL.js"),[]).then(e=>e.default):a(()=>import("./index-Dqyfi4dm.js"),[]).then(e=>e.wallet);case"io.helixid":return t?a(()=>import("./image-Dkp4M1ik.js"),[]).then(e=>e.default):a(()=>import("./index-RJhc6LnM.js"),[]).then(e=>e.wallet);case"com.broearn":return t?a(()=>import("./image-JyGUnQ_N.js"),[]).then(e=>e.default):a(()=>import("./index-WsH2ZGfO.js"),[]).then(e=>e.wallet);case"io.altme":return t?a(()=>import("./image-MQbcgW7z.js"),[]).then(e=>e.default):a(()=>import("./index-CpMkh5pZ.js"),[]).then(e=>e.wallet);case"app.herewallet":return t?a(()=>import("./image-gnC_p3Da.js"),[]).then(e=>e.default):a(()=>import("./index-CecEswCv.js"),[]).then(e=>e.wallet);case"com.coinsdo":return t?a(()=>import("./image-DrHhCSDD.js"),[]).then(e=>e.default):a(()=>import("./index-DJYG2Vtc.js"),[]).then(e=>e.wallet);case"trade.flooz.wallet":return t?a(()=>import("./image-DaaIjpQJ.js"),[]).then(e=>e.default):a(()=>import("./index-C6EDKfcJ.js"),[]).then(e=>e.wallet);case"com.tapwallet":return t?a(()=>import("./image-BxeDPEwg.js"),[]).then(e=>e.default):a(()=>import("./index-BwCUvEoQ.js"),[]).then(e=>e.wallet);case"fun.tobi":return t?a(()=>import("./image-DmhgJWq-.js"),[]).then(e=>e.default):a(()=>import("./index-C1adBKyv.js"),[]).then(e=>e.wallet);case"com.bitnovo":return t?a(()=>import("./image-BTZyVpoA.js"),[]).then(e=>e.default):a(()=>import("./index-CaZIFXyW.js"),[]).then(e=>e.wallet);case"io.xucre":return t?a(()=>import("./image-DZ-B-aVa.js"),[]).then(e=>e.default):a(()=>import("./index-BBDAdmKp.js"),[]).then(e=>e.wallet);case"app.girin":return t?a(()=>import("./image-CkQb0YUH.js"),[]).then(e=>e.default):a(()=>import("./index-CpJZxSfI.js"),[]).then(e=>e.wallet);case"finance.panaroma":return t?a(()=>import("./image-Z9k3mhsb.js"),[]).then(e=>e.default):a(()=>import("./index-BIeLm-x3.js"),[]).then(e=>e.wallet);case"app.clot":return t?a(()=>import("./image-DZplWZyD.js"),[]).then(e=>e.default):a(()=>import("./index-BVQeUBdj.js"),[]).then(e=>e.wallet);case"io.transi":return t?a(()=>import("./image-Dc5zhKf6.js"),[]).then(e=>e.default):a(()=>import("./index-DDggnqr4.js"),[]).then(e=>e.wallet);case"world.qoin":return t?a(()=>import("./image-BPAkEl8k.js"),[]).then(e=>e.default):a(()=>import("./index-C9taR4Do.js"),[]).then(e=>e.wallet);case"com.greengloryglobal":return t?a(()=>import("./image-lOdcUtWG.js"),[]).then(e=>e.default):a(()=>import("./index-C-OT0KJG.js"),[]).then(e=>e.wallet);case"com.amazewallet":return t?a(()=>import("./image-2wmDBIB6.js"),[]).then(e=>e.default):a(()=>import("./index-DvXpQOkv.js"),[]).then(e=>e.wallet);case"zone.bitverse":return t?a(()=>import("./image-C6aZzydG.js"),[]).then(e=>e.default):a(()=>import("./index-CN6XdMAo.js"),[]).then(e=>e.wallet);case"social.gm2":return t?a(()=>import("./image-BqtrMo-7.js"),[]).then(e=>e.default):a(()=>import("./index-Coq7--sH.js"),[]).then(e=>e.wallet);case"io.ozonewallet":return t?a(()=>import("./image-BtnrRGhZ.js"),[]).then(e=>e.default):a(()=>import("./index-DFc7lZHb.js"),[]).then(e=>e.wallet);case"io.ukiss":return t?a(()=>import("./image-DFYwzuHA.js"),[]).then(e=>e.default):a(()=>import("./index-CE9n_StB.js"),[]).then(e=>e.wallet);case"finance.islamicoin":return t?a(()=>import("./image-CWG4tRzZ.js"),[]).then(e=>e.default):a(()=>import("./index-pcLdliEp.js"),[]).then(e=>e.wallet);case"io.copiosa":return t?a(()=>import("./image-DuQoo_kR.js"),[]).then(e=>e.default):a(()=>import("./index-CWmGdvBR.js"),[]).then(e=>e.wallet);case"world.fncy":return t?a(()=>import("./image-B5M2ftPa.js"),[]).then(e=>e.default):a(()=>import("./index-Ba45jQBJ.js"),[]).then(e=>e.wallet);case"io.moonstake":return t?a(()=>import("./image-zsArRLIF.js"),[]).then(e=>e.default):a(()=>import("./index-C7HuhgLE.js"),[]).then(e=>e.wallet);case"com.trusteeglobal":return t?a(()=>import("./image-iR_slvRo.js"),[]).then(e=>e.default):a(()=>import("./index-CNLH4wrU.js"),[]).then(e=>e.wallet);case"net.spatium":return t?a(()=>import("./image-DBFrM6tr.js"),[]).then(e=>e.default):a(()=>import("./index-BJBC3bLU.js"),[]).then(e=>e.wallet);case"co.filwallet":return t?a(()=>import("./image-Do8rO3zE.js"),[]).then(e=>e.default):a(()=>import("./index-D7FslwZl.js"),[]).then(e=>e.wallet);case"money.snowball":return t?a(()=>import("./image-3Q7PfsJG.js"),[]).then(e=>e.default):a(()=>import("./index-yOwMLl2f.js"),[]).then(e=>e.wallet);case"com.ennowallet":return t?a(()=>import("./image-Ccx8wDSE.js"),[]).then(e=>e.default):a(()=>import("./index-BRIQuVzg.js"),[]).then(e=>e.wallet);case"io.safematrix":return t?a(()=>import("./image-BX4sAPzh.js"),[]).then(e=>e.default):a(()=>import("./index-Yk_iQY25.js"),[]).then(e=>e.wallet);case"pro.assure":return t?a(()=>import("./image-DMTT8AeN.js"),[]).then(e=>e.default):a(()=>import("./index-BfYVYwh5.js"),[]).then(e=>e.wallet);case"com.neftipedia":return t?a(()=>import("./image-vrSaD0K9.js"),[]).then(e=>e.default):a(()=>import("./index-BHZDuU0I.js"),[]).then(e=>e.wallet);case"io.goldbit":return t?a(()=>import("./image-CtiFcEL8.js"),[]).then(e=>e.default):a(()=>import("./index-DFrKYv4g.js"),[]).then(e=>e.wallet);case"com.coingrig":return t?a(()=>import("./image-NsVKBwxZ.js"),[]).then(e=>e.default):a(()=>import("./index-DcyXtFTG.js"),[]).then(e=>e.wallet);case"io.xfun":return t?a(()=>import("./image-CPMDxql6.js"),[]).then(e=>e.default):a(()=>import("./index-B05algAv.js"),[]).then(e=>e.wallet);case"com.antiersolutions":return t?a(()=>import("./image-BMh4HSr7.js"),[]).then(e=>e.default):a(()=>import("./index-DufOfQ90.js"),[]).then(e=>e.wallet);case"com.itoken":return t?a(()=>import("./image-BwBO8BTi.js"),[]).then(e=>e.default):a(()=>import("./index-BftqI1FU.js"),[]).then(e=>e.wallet);case"com.cardstack":return t?a(()=>import("./image-D7Sd6W8U.js"),[]).then(e=>e.default):a(()=>import("./index-BiHhxeDt.js"),[]).then(e=>e.wallet);case"io.slavi":return t?a(()=>import("./image-BQUnnXTb.js"),[]).then(e=>e.default):a(()=>import("./index-Kt6GlPCW.js"),[]).then(e=>e.wallet);case"tech.defiantapp":return t?a(()=>import("./image-D4-YMi52.js"),[]).then(e=>e.default):a(()=>import("./index-DPic1oJg.js"),[]).then(e=>e.wallet);case"com.dexari":return t?a(()=>import("./image-BoANtDMS.js"),[]).then(e=>e.default):a(()=>import("./index-DPFoWmV6.js"),[]).then(e=>e.wallet);case"io.cfcx":return t?a(()=>import("./image-139plIjh.js"),[]).then(e=>e.default):a(()=>import("./index-Cws1zSAX.js"),[]).then(e=>e.wallet);case"com.socjsc":return t?a(()=>import("./image-Crp2YP47.js"),[]).then(e=>e.default):a(()=>import("./index-C_XOoDbk.js"),[]).then(e=>e.wallet);case"com.tokenb":return t?a(()=>import("./image-8LnJ1bNt.js"),[]).then(e=>e.default):a(()=>import("./index-DcwbqEHj.js"),[]).then(e=>e.wallet);case"org.onyx":return t?a(()=>import("./image-DKcWaLtu.js"),[]).then(e=>e.default):a(()=>import("./index-C5NL4PoV.js"),[]).then(e=>e.wallet);case"io.gk8":return t?a(()=>import("./image-ZwibGfzR.js"),[]).then(e=>e.default):a(()=>import("./index-CLxj2t1J.js"),[]).then(e=>e.wallet);case"com.anchorage":return t?a(()=>import("./image-OT0Fb2Nb.js"),[]).then(e=>e.default):a(()=>import("./index-aoLVKFG1.js"),[]).then(e=>e.wallet);case"com.hashport.wallet":return t?a(()=>import("./image-DooF_Vfs.js"),[]).then(e=>e.default):a(()=>import("./index-DICTy0sa.js"),[]).then(e=>e.wallet);case"io.billionwallet":return t?a(()=>import("./image-DDBzbPSl.js"),[]).then(e=>e.default):a(()=>import("./index-CmCRou09.js"),[]).then(e=>e.wallet);case"com.dlicom":return t?a(()=>import("./image-lXBTHYnD.js"),[]).then(e=>e.default):a(()=>import("./index-l8DhIVZW.js"),[]).then(e=>e.wallet);case"com.tychiwallet":return t?a(()=>import("./image-pcyfaNhf.js"),[]).then(e=>e.default):a(()=>import("./index-B3vR_dtk.js"),[]).then(e=>e.wallet);case"at.swe":return t?a(()=>import("./image-C8_9fy1e.js"),[]).then(e=>e.default):a(()=>import("./index-ficai7Ce.js"),[]).then(e=>e.wallet);case"network.wali":return t?a(()=>import("./image-CSyxcTwp.js"),[]).then(e=>e.default):a(()=>import("./index-Dzkop1Gk.js"),[]).then(e=>e.wallet);case"io.diamante":return t?a(()=>import("./image-Dh9w9A8z.js"),[]).then(e=>e.default):a(()=>import("./index-C1a5oPtZ.js"),[]).then(e=>e.wallet);case"ai.interlinklabs":return t?a(()=>import("./image-Dz82Zyfj.js"),[]).then(e=>e.default):a(()=>import("./index-BTqXeJHf.js"),[]).then(e=>e.wallet);case"com.walllet":return t?a(()=>import("./image-VFWT6oS6.js"),[]).then(e=>e.default):a(()=>import("./index-DPgWRg9-.js"),[]).then(e=>e.wallet);case"org.lunascape":return t?a(()=>import("./image-D4nkyGrg.js"),[]).then(e=>e.default):a(()=>import("./index-4Nmn8ium.js"),[]).then(e=>e.wallet);case"com.nvxowallet":return t?a(()=>import("./image-BoS2kgXC.js"),[]).then(e=>e.default):a(()=>import("./index-CRRdY0XA.js"),[]).then(e=>e.wallet);case"today.paywithcrypto.wallet":return t?a(()=>import("./image-CsUCYFyx.js"),[]).then(e=>e.default):a(()=>import("./index-CFUSXkKo.js"),[]).then(e=>e.wallet);case"ai.iluminary":return t?a(()=>import("./image-CEuSmI3b.js"),[]).then(e=>e.default):a(()=>import("./index-D1j-SvoJ.js"),[]).then(e=>e.wallet);case"io.reactwallet":return t?a(()=>import("./image-B3lDLhwe.js"),[]).then(e=>e.default):a(()=>import("./index-CTs1t6rA.js"),[]).then(e=>e.wallet);case"com.rewardywallet":return t?a(()=>import("./image-DVyDRAAO.js"),[]).then(e=>e.default):a(()=>import("./index-cF_6KJvb.js"),[]).then(e=>e.wallet);case"io.walletv":return t?a(()=>import("./image-CTBdimeM.js"),[]).then(e=>e.default):a(()=>import("./index-He5kaR9n.js"),[]).then(e=>e.wallet);case"app.outlawgames":return t?a(()=>import("./image-BPqXYngz.js"),[]).then(e=>e.default):a(()=>import("./index-D2hPph8l.js"),[]).then(e=>e.wallet);case"io.ironwallet":return t?a(()=>import("./image-BKNtkg6s.js"),[]).then(e=>e.default):a(()=>import("./index-B1-qcL-p.js"),[]).then(e=>e.wallet);case"com.mecowallet":return t?a(()=>import("./image-m7IlStdm.js"),[]).then(e=>e.default):a(()=>import("./index-BdgyG9Qa.js"),[]).then(e=>e.wallet);case"com.onlybulls":return t?a(()=>import("./image-qLUwfjzV.js"),[]).then(e=>e.default):a(()=>import("./index-DPPIbXj8.js"),[]).then(e=>e.wallet);case"me.qiewallet":return t?a(()=>import("./image-BHJFFIIN.js"),[]).then(e=>e.default):a(()=>import("./index-D6zAueb_.js"),[]).then(e=>e.wallet);case"fund.lflabs":return t?a(()=>import("./image-dO78_uyn.js"),[]).then(e=>e.default):a(()=>import("./index-BBkeSt5m.js"),[]).then(e=>e.wallet);case"io.walletverse":return t?a(()=>import("./image-DUk3AUBd.js"),[]).then(e=>e.default):a(()=>import("./index-CfO_m3oL.js"),[]).then(e=>e.wallet);case"com.berasig":return t?a(()=>import("./image-CisWvLpc.js"),[]).then(e=>e.default):a(()=>import("./index-Cg1E5HxJ.js"),[]).then(e=>e.wallet);case"app.phantom":return t?a(()=>import("./image-6levnvAC.js"),[]).then(e=>e.default):a(()=>import("./index-IBUgXgOa.js"),[]).then(e=>e.wallet);case"com.coinbase.wallet":return t?a(()=>import("./image-C6EsuPXB.js"),[]).then(e=>e.default):a(()=>import("./index-BILUwmJ9.js"),[]).then(e=>e.wallet);case"io.rabby":return t?a(()=>import("./image-CZ2qSHpt.js"),[]).then(e=>e.default):a(()=>import("./index-Bprjmfje.js"),[]).then(e=>e.wallet);case"com.brave.wallet":return t?a(()=>import("./image-9Jtg22X3.js"),[]).then(e=>e.default):a(()=>import("./index-DKbx-y78.js"),[]).then(e=>e.wallet);case"fi.nu":return t?a(()=>import("./image-BAl5qyeX.js"),[]).then(e=>e.default):a(()=>import("./index-BXi61TZ5.js"),[]).then(e=>e.wallet);case"pro.hinkal.walletconnect":return t?a(()=>import("./image-d8n8A6si.js"),[]).then(e=>e.default):a(()=>import("./index-CujrNB-Q.js"),[]).then(e=>e.wallet);case"com.moongate.one":return t?a(()=>import("./image-DZc2BYzk.js"),[]).then(e=>e.default):a(()=>import("./index-B2WV7sR7.js"),[]).then(e=>e.wallet);case"tech.levain":return t?a(()=>import("./image-DcIu3U38.js"),[]).then(e=>e.default):a(()=>import("./index-CEpc_g8h.js"),[]).then(e=>e.wallet);case"com.enkrypt":return t?a(()=>import("./image-DvpdMMzF.js"),[]).then(e=>e.default):a(()=>import("./index-Cc4uopde.js"),[]).then(e=>e.wallet);case"com.scramble":return t?a(()=>import("./image-DT5Fvf2s.js"),[]).then(e=>e.default):a(()=>import("./index-D4Sgj1mL.js"),[]).then(e=>e.wallet);case"io.finoa":return t?a(()=>import("./image-D_i0o0Nv.js"),[]).then(e=>e.default):a(()=>import("./index-DFghxfjK.js"),[]).then(e=>e.wallet);case"com.blazpay.wallet":return t?a(()=>import("./image-CgHABHdL.js"),[]).then(e=>e.default):a(()=>import("./index-B_OXuBhF.js"),[]).then(e=>e.wallet);case"io.getjoin.prd":return t?a(()=>import("./image-CmWdSXJI.js"),[]).then(e=>e.default):a(()=>import("./index-QvBzJwgv.js"),[]).then(e=>e.wallet);case"xyz.talisman":return t?a(()=>import("./image-VlTaWJmy.js"),[]).then(e=>e.default):a(()=>import("./index-BgbYZOnC.js"),[]).then(e=>e.wallet);case"eu.flashsoft.clear-wallet":return t?a(()=>import("./image-gxCVLutB.js"),[]).then(e=>e.default):a(()=>import("./index-BBiL2lyk.js"),[]).then(e=>e.wallet);case"app.berasig":return t?a(()=>import("./image-BjTMD2k8.js"),[]).then(e=>e.default):a(()=>import("./index-DkcP2fCc.js"),[]).then(e=>e.wallet);case"com.wallet.reown":return t?a(()=>import("./image-CC2_AL18.js"),[]).then(e=>e.default):a(()=>import("./index-BEx6ckei.js"),[]).then(e=>e.wallet);case"io.runonflux.sspwallet":return t?a(()=>import("./image-DfzpWAED.js"),[]).then(e=>e.default):a(()=>import("./index-CrUcAJK0.js"),[]).then(e=>e.wallet);case"com.blanqlabs.wallet":return t?a(()=>import("./image-wR942Jk6.js"),[]).then(e=>e.default):a(()=>import("./index-DBst6Hla.js"),[]).then(e=>e.wallet);case"io.hero.wallet":return t?a(()=>import("./image-BbH7e9pw.js"),[]).then(e=>e.default):a(()=>import("./index-BBANTdk4.js"),[]).then(e=>e.wallet);case"network.verified.custody":return t?a(()=>import("./image-DpjDzWCs.js"),[]).then(e=>e.default):a(()=>import("./index-CyhgnW_d.js"),[]).then(e=>e.wallet);case"console.utila.io":return t?a(()=>import("./image-C7tHBnQp.js"),[]).then(e=>e.default):a(()=>import("./index-BrOCsLbf.js"),[]).then(e=>e.wallet);case"com.micet.wallet":return t?a(()=>import("./image-On2ij4Ix.js"),[]).then(e=>e.default):a(()=>import("./index-JAAqCLcG.js"),[]).then(e=>e.wallet);case"world.dolphinode.chain":return t?a(()=>import("./image-BXzPnbc4.js"),[]).then(e=>e.default):a(()=>import("./index-CiwBOkla.js"),[]).then(e=>e.wallet);case"com.lootrush":return t?a(()=>import("./image-t4jvKgpV.js"),[]).then(e=>e.default):a(()=>import("./index-BLsnOBhg.js"),[]).then(e=>e.wallet);case"xyz.dawnwallet":return t?a(()=>import("./image-bpacFMFT.js"),[]).then(e=>e.default):a(()=>import("./index-BqK7Phb6.js"),[]).then(e=>e.wallet);case"xyz.abs":return t?a(()=>import("./image-DFo7XMVJ.js"),[]).then(e=>e.default):a(()=>import("./index-8Ff6vDUD.js"),[]).then(e=>e.wallet);case"sh.frame":return t?a(()=>import("./image-C1w2WpL5.js"),[]).then(e=>e.default):a(()=>import("./index-cAvSYrmF.js"),[]).then(e=>e.wallet);case"io.useglyph":return t?a(()=>import("./image-C46yxCl4.js"),[]).then(e=>e.default):a(()=>import("./index-DE_8irSD.js"),[]).then(e=>e.wallet);case"org.base.account":return t?a(()=>import("./image-Ds78yECl.js"),[]).then(e=>e.default):a(()=>import("./index-kNZGxYSe.js"),[]).then(e=>e.wallet);default:throw new Error(`Wallet with id ${r} not found`)}}function Uh(){const r=new Map;return{emit(t,e){const n=r.get(t);if(n)for(const i of n)i(e)},subscribe(t,e){var n;return r.has(t)?(n=r.get(t))==null||n.add(e):r.set(t,new Set([e])),()=>{const i=r.get(t);i&&i.delete(e)}}}}function dr(){return Uh()}function qh(r){const{createOptions:t}=r,e=dr();let n,i;function s(){n=void 0,i=void 0}let o=async()=>{},c=async d=>{i=d};const l=e.subscribe("chainChanged",d=>{i=d}),u=e.subscribe("disconnect",()=>{s(),l(),u()});return e.subscribe("accountChanged",d=>{n=d}),{autoConnect:async d=>{const{autoConnectBaseAccountSDK:h}=await a(async()=>{const{autoConnectBaseAccountSDK:b}=await Promise.resolve().then(()=>Do);return{autoConnectBaseAccountSDK:b}},void 0),p=await r.providerFactory(),[_,f,m,y]=await h(d,e,p);return n=_,i=f,o=m,c=y,Be({chainId:i.id,client:d.client,walletAddress:n.address,walletType:Pt}),n},connect:async d=>{const{connectBaseAccountSDK:h}=await a(async()=>{const{connectBaseAccountSDK:b}=await Promise.resolve().then(()=>Do);return{connectBaseAccountSDK:b}},void 0),p=await r.providerFactory(),[_,f,m,y]=await h(d,e,p);return n=_,i=f,o=m,c=y,Be({chainId:i.id,client:d.client,walletAddress:n.address,walletType:Pt}),n},disconnect:async()=>{s(),await o()},getAccount:()=>n,getChain(){if(i)return i=lr(i.id)||i,i},getConfig:()=>t,id:Pt,subscribe:e.subscribe,switchChain:async d=>{await c(d)}}}function Wn(){if(!Fc())return{description:"thirdweb powered dApp",logoUrl:"https://thirdweb.com/favicon.ico",name:"thirdweb powered dApp",url:"https://thirdweb.com"};const{protocol:r,hostname:t,port:e}=window.location;let n=`${r}//${t}`;e&&e!=="80"&&e!=="443"&&(n+=`:${e}`);const i=`${n}/favicon.ico`;return{description:window.document.title||"thirdweb powered dApp",logoUrl:i,name:window.document.title||"thirdweb powered dApp",url:n}}let Ei,vn;async function Zc(r){var s,o,c,l,u,d,h;if(Ei){if(r&&vn){const p=((s=vn.chains)==null?void 0:s.map(y=>y.id))||[],_=((o=r.chains)==null?void 0:o.map(y=>y.id))||[],f=p.length===_.length&&p.every((y,b)=>y===_[b]),m=((c=r.appMetadata)==null?void 0:c.name)===((l=vn.appMetadata)==null?void 0:l.name);(!f||!m)&&console.warn("[Base Account SDK] Provider already initialized with different options. The Base Account SDK uses a singleton provider - subsequent configurations are ignored. Create only one Base Account wallet instance per application.")}return Ei}const{createBaseAccountSDK:t}=await a(async()=>{const{createBaseAccountSDK:p}=await import("./index-CwyZjPUn.js");return{createBaseAccountSDK:p}},__vite__mapDeps([8,9,3,4,1,2,10,11,12,13,5,6,14,15])),e=Wn(),i=t({appName:((u=r==null?void 0:r.appMetadata)==null?void 0:u.name)||e.name||"thirdweb powered dApp",appLogoUrl:((d=r==null?void 0:r.appMetadata)==null?void 0:d.logoUrl)||e.logoUrl||null,appChainIds:((h=r==null?void 0:r.chains)==null?void 0:h.map(p=>p.id))||[]}).getProvider();return Ei=i,vn=r,i}function Yc(r){return r.id===Pt}function Lo({provider:r,address:t,client:e}){const n={address:Z(t),async sendTransaction(i){const s=await r.request({method:"eth_sendTransaction",params:[{accessList:i.accessList,data:i.data,from:Z(t),gas:i.gas?De(i.gas):void 0,to:i.to,value:i.value?De(i.value):void 0}]});return Cs({chainId:i.chainId,client:e,contractAddress:i.to??void 0,gasPrice:i.gasPrice,transactionHash:s,walletAddress:Z(t),walletType:Pt}),{transactionHash:s}},async signMessage({message:i}){if(!n.address)throw new Error("Provider not setup");const s=typeof i=="string"?xs(i):i.raw instanceof Uint8Array?ri(i.raw):i.raw,o=await r.request({method:"personal_sign",params:[s,n.address]});if(!tn(o))throw new Error("Invalid signature returned");return o},async signTypedData(i){if(!n.address)throw new Error("Provider not setup");const{domain:s,message:o,primaryType:c}=js(i),l={EIP712Domain:Dc(s),...i.types};Vc({domain:s,message:o,primaryType:c,types:l});const u=Sc({domain:s??{},message:o,primaryType:c,types:l}),d=await r.request({method:"eth_signTypedData_v4",params:[n.address,u]});if(!tn(d))throw new Error("Invalid signed payload returned");return d},sendCalls:async i=>{try{const{callParams:s,chain:o}=await Fs(i,n),c=await r.request({method:"wallet_sendCalls",params:s});return c&&typeof c=="object"&&"id"in c?{chain:o,client:e,id:c.id}:{chain:o,client:e,id:c}}catch(s){throw/unsupport|not support/i.test(s.message)?new Error(`${Pt} errored calling wallet_sendCalls, with error: ${s instanceof Error?s.message:we(s)}`):s}},async getCallsStatus(i){try{const s=await r.request({method:"wallet_getCallsStatus",params:[i.id]});return zs(s)}catch(s){throw/unsupport|not support/i.test(s.message)?new Error(`${Pt} does not support wallet_getCallsStatus, reach out to them directly to request EIP-5792 support.`):s}},async getCapabilities(i){const s=i.chainId;try{const o=await r.request({method:"wallet_getCapabilities",params:[Z(n.address)]});return Ks(o,s)}catch(o){if(/unsupport|not support|not available/i.test(o.message))return{message:`${Pt} does not support wallet_getCapabilities, reach out to them directly to request EIP-5792 support.`};throw o}}};return n}function Qc(r,t,e,n,i){const s=Lo({address:r,client:i,provider:e});async function o(){e.off("accountsChanged",l),e.off("chainChanged",u),e.off("disconnect",c),await e.disconnect()}async function c(){o(),n.emit("disconnect",void 0)}function l(d){if(d[0]){const h=Lo({address:Z(d[0]),client:i,provider:e});n.emit("accountChanged",h),n.emit("accountsChanged",d)}else c()}function u(d){const h=ge(lt(d));n.emit("chainChanged",h)}return e.on("accountsChanged",l),e.on("chainChanged",u),e.on("disconnect",c),[s,t,c,d=>Xc(e,d)]}async function Mh(r,t,e){const n=await e.request({method:"eth_requestAccounts"});if(!n[0])throw new Error("No accounts found");const i=Z(n[0]),s=await e.request({method:"eth_chainId"}),o=lt(s);let c=r.chain&&r.chain.id===o?r.chain:ge(o);return o&&(r!=null&&r.chain)&&o!==(r==null?void 0:r.chain.id)&&(await Xc(e,r.chain),c=r.chain),Qc(i,c,e,t,r.client)}async function Bh(r,t,e){const i=(await e.request({method:"eth_accounts"}))[0];if(!i)throw new Error("No accounts found");const s=await e.request({method:"eth_chainId"}),o=lt(s),c=r.chain&&r.chain.id===o?r.chain:ge(o);return Qc(i,c,e,t,r.client)}async function Xc(r,t){var s;const e=await r.request({method:"eth_chainId"}),n=ge(lt(e));if((n==null?void 0:n.id)===t.id)return;const i=De(t.id);try{await r.request({method:"wallet_switchEthereumChain",params:[{chainId:i}]})}catch(o){const c=await Us(t);(o==null?void 0:o.code)===4902&&await r.request({method:"wallet_addEthereumChain",params:[{blockExplorerUrls:((s=c.explorers)==null?void 0:s.map(l=>l.url))||[],chainId:i,chainName:c.name,nativeCurrency:c.nativeCurrency,rpcUrls:Ws(c)}]})}}const Do=Object.freeze(Object.defineProperty({__proto__:null,autoConnectBaseAccountSDK:Bh,connectBaseAccountSDK:Mh,getBaseAccountWebProvider:Zc,isBaseAccountSDKWallet:Yc},Symbol.toStringTag,{value:"Module"}));function jh(r){const{createOptions:t}=r,e=dr();let n,i;function s(){n=void 0,i=void 0}let o=async()=>{},c=async d=>{i=d};const l=e.subscribe("chainChanged",d=>{i=d}),u=e.subscribe("disconnect",()=>{s(),l(),u()});return e.subscribe("accountChanged",d=>{n=d}),{autoConnect:async d=>{const{autoConnectCoinbaseWalletSDK:h}=await a(async()=>{const{autoConnectCoinbaseWalletSDK:b}=await Promise.resolve().then(()=>So);return{autoConnectCoinbaseWalletSDK:b}},void 0),p=await r.providerFactory(),[_,f,m,y]=await h(d,e,p);return n=_,i=f,o=m,c=y,Be({chainId:i.id,client:d.client,walletAddress:n.address,walletType:ft}),n},connect:async d=>{const{connectCoinbaseWalletSDK:h}=await a(async()=>{const{connectCoinbaseWalletSDK:b}=await Promise.resolve().then(()=>So);return{connectCoinbaseWalletSDK:b}},void 0),p=await r.providerFactory(),[_,f,m,y]=await h(d,e,p);return n=_,i=f,o=m,c=y,Be({chainId:i.id,client:d.client,walletAddress:n.address,walletType:ft}),n},disconnect:async()=>{s(),await o()},getAccount:()=>n,getChain(){if(i)return i=lr(i.id)||i,i},getConfig:()=>t,id:ft,onConnectRequested:async()=>{var d;if(r.onConnectRequested){const h=await r.providerFactory();return(d=r.onConnectRequested)==null?void 0:d.call(r,h)}},subscribe:e.subscribe,switchChain:async d=>{await c(d)}}}async function el(r){var t,e;await((e=(t=r==null?void 0:r.communicator)==null?void 0:t.waitForPopupLoaded)==null?void 0:e.call(t))}const zh=Object.freeze(Object.defineProperty({__proto__:null,showCoinbasePopup:el},Symbol.toStringTag,{value:"Module"}));let vi;async function tl(r){var t,e;if(!vi){let n=(await a(()=>import("./index-C64ohPrX.js"),__vite__mapDeps([16,3,4,1,2,9]))).default;typeof n!="function"&&typeof n.default=="function"&&(n=n.default);const s=new n({appChainIds:r!=null&&r.chains?r.chains.map(o=>o.id):void 0,appLogoUrl:((t=r==null?void 0:r.appMetadata)==null?void 0:t.logoUrl)||Wn().logoUrl,appName:((e=r==null?void 0:r.appMetadata)==null?void 0:e.name)||Wn().name}).makeWeb3Provider(r==null?void 0:r.walletConfig);return vi=s,s}return vi}function Vo({provider:r,address:t,client:e}){const n={address:Z(t),onTransactionRequested:async()=>{window.localStorage&&window.localStorage.getItem("-CBWSDK:SignerConfigurator:SignerType")==="scw"&&await el(r)},async sendTransaction(i){const s=await r.request({method:"eth_sendTransaction",params:[{accessList:i.accessList,data:i.data,from:Z(t),gas:i.gas?De(i.gas):void 0,to:i.to,value:i.value?De(i.value):void 0}]});return Cs({chainId:i.chainId,client:e,contractAddress:i.to??void 0,gasPrice:i.gasPrice,transactionHash:s,walletAddress:Z(t),walletType:ft}),{transactionHash:s}},async signMessage({message:i}){if(!n.address)throw new Error("Provider not setup");const s=typeof i=="string"?xs(i):i.raw instanceof Uint8Array?ri(i.raw):i.raw,o=await r.request({method:"personal_sign",params:[s,n.address]});if(!tn(o))throw new Error("Invalid signature returned");return o},async signTypedData(i){if(!n.address)throw new Error("Provider not setup");const{domain:s,message:o,primaryType:c}=js(i),l={EIP712Domain:Dc(s),...i.types};Vc({domain:s,message:o,primaryType:c,types:l});const u=Sc({domain:s??{},message:o,primaryType:c,types:l}),d=await r.request({method:"eth_signTypedData_v4",params:[n.address,u]});if(!tn(d))throw new Error("Invalid signed payload returned");return d},sendCalls:async i=>{try{const{callParams:s,chain:o}=await Fs(i,n),c=await r.request({method:"wallet_sendCalls",params:s});return c&&typeof c=="object"&&"id"in c?{chain:o,client:e,id:c.id}:{chain:o,client:e,id:c}}catch(s){throw/unsupport|not support/i.test(s.message)?new Error(`${ft} errored calling wallet_sendCalls, with error: ${s instanceof Error?s.message:we(s)}`):s}},async getCallsStatus(i){try{const s=await r.request({method:"wallet_getCallsStatus",params:[i.id]});return zs(s)}catch(s){throw/unsupport|not support/i.test(s.message)?new Error(`${ft} does not support wallet_getCallsStatus, reach out to them directly to request EIP-5792 support.`):s}},async getCallsStatusRaw(i){try{return await r.request({method:"wallet_getCallsStatus",params:[i.id]})}catch(s){throw/unsupport|not support/i.test(s.message)?new Error(`${ft} does not support wallet_getCallsStatus, reach out to them directly to request EIP-5792 support.`):s}},async getCapabilities(i){const s=i.chainId;try{const o=await r.request({method:"wallet_getCapabilities",params:[Z(n.address)]});return Ks(o,s)}catch(o){if(/unsupport|not support|not available/i.test(o.message))return{message:`${ft} does not support wallet_getCapabilities, reach out to them directly to request EIP-5792 support.`};throw o}}};return n}function rl(r,t,e,n,i){const s=Vo({address:r,client:i,provider:e});async function o(){e.removeListener("accountsChanged",l),e.removeListener("chainChanged",u),e.removeListener("disconnect",c),await e.disconnect()}async function c(){o(),n.emit("disconnect",void 0)}function l(d){if(d[0]){const h=Vo({address:Z(d[0]),client:i,provider:e});n.emit("accountChanged",h),n.emit("accountsChanged",d)}else c()}function u(d){const h=ge(lt(d));n.emit("chainChanged",h)}return e.on("accountsChanged",l),e.on("chainChanged",u),e.on("disconnect",c),[s,t,c,d=>nl(e,d)]}async function Kh(r,t,e){const n=await e.request({method:"eth_requestAccounts"});if(!n[0])throw new Error("No accounts found");const i=Z(n[0]),s=await e.request({method:"eth_chainId"}),o=lt(s);let c=r.chain&&r.chain.id===o?r.chain:ge(o);return o&&(r!=null&&r.chain)&&o!==(r==null?void 0:r.chain.id)&&(await nl(e,r.chain),c=r.chain),rl(i,c,e,t,r.client)}async function Fh(r,t,e){const i=(await e.request({method:"eth_accounts"}))[0];if(!i)throw new Error("No accounts found");const s=await e.request({method:"eth_chainId"}),o=lt(s),c=r.chain&&r.chain.id===o?r.chain:ge(o);return rl(i,c,e,t,r.client)}async function nl(r,t){var s;const e=await r.request({method:"eth_chainId"}),n=ge(lt(e));if((n==null?void 0:n.id)===t.id)return;const i=De(t.id);try{await r.request({method:"wallet_switchEthereumChain",params:[{chainId:i}]})}catch(o){const c=await Us(t);(o==null?void 0:o.code)===4902&&await r.request({method:"wallet_addEthereumChain",params:[{blockExplorerUrls:((s=c.explorers)==null?void 0:s.map(l=>l.url))||[],chainId:i,chainName:c.name,nativeCurrency:c.nativeCurrency,rpcUrls:Ws(c)}]})}}const So=Object.freeze(Object.defineProperty({__proto__:null,autoConnectCoinbaseWalletSDK:Fh,connectCoinbaseWalletSDK:Kh,getCoinbaseWebProvider:tl},Symbol.toStringTag,{value:"Module"}));async function Wh(r){return qc(async()=>{var n;const e=await(await fetch(`${ii("inAppWallet")}/api/2024-05-05/ecosystem-wallet`,{headers:{"x-ecosystem-id":r}})).json();if(!e||e.code==="UNAUTHORIZED")throw new Error(e.message||`Could not find ecosystem wallet with id ${r}, please check your ecosystem wallet configuration.`);return(n=e.authOptions)!=null&&n.includes("siwe")&&(e.authOptions=e.authOptions.filter(i=>i!=="siwe"),e.authOptions.push("wallet")),e},{cacheKey:`ecosystem-wallet-options-${r}`,cacheTime:1e3*60*5})}const bi=new Map;async function Kr(r,t,e){var s;const n=we({clientId:r.clientId,ecosystem:e,partialSecretKey:(s=r.secretKey)==null?void 0:s.slice(0,5)});if(bi.has(n))return bi.get(n);const i=await t(r);return bi.set(n,i),i}function il(r){const{createOptions:t,connectorFactory:e,ecosystem:n}=r,i=n?n.id:"inApp",s=dr();let o=t,c,l,u,d,h=null;const p=async _=>{if(n){const f=await Wh(n.id),m=f==null?void 0:f.smartAccountOptions;if(m)if(f.smartAccountOptions.executionMode==="EIP7702")o={...o,executionMode:{mode:"EIP7702",sponsorGas:m.sponsorGas}};else{const{defaultChainId:b}=f.smartAccountOptions,O=(_==null?void 0:_.chain)??(b?ge(b):void 0);if(!O)throw new Error("A chain must be provided either via 'chain' in connect options or 'defaultChainId' in ecosystem configuration. Please pass it via connect() or update the ecosystem configuration.");o={...o,smartAccount:{chain:O,factoryAddress:m.accountFactoryAddress,sponsorGas:m.sponsorGas}}}}};return{autoConnect:async _=>{const{autoConnectInAppWallet:f}=await a(async()=>{const{autoConnectInAppWallet:g}=await Promise.resolve().then(()=>Wi);return{autoConnectInAppWallet:g}},void 0),m=await Kr(_.client,e,n);await p();const{account:y,chain:b,adminAccount:O}=await f(_,o,m);d=_.client,c=y,l=O,u=b;try{h=await m.storage.getAuthCookie()}catch(g){console.error("Failed to retrieve auth token:",g),h=null}return Be({chainId:u.id,client:_.client,ecosystem:n,walletAddress:c.address,walletType:i}),c},connect:async _=>{const{connectInAppWallet:f}=await a(async()=>{const{connectInAppWallet:g}=await Promise.resolve().then(()=>Wi);return{connectInAppWallet:g}},void 0),m=await Kr(_.client,e,n);await p();const{account:y,chain:b,adminAccount:O}=await f(_,o,m);d=_.client,c=y,l=O,u=b;try{h=await m.storage.getAuthCookie()}catch(g){console.error("Failed to retrieve auth token:",g),h=null}return Be({chainId:u.id,client:_.client,ecosystem:n,walletAddress:c.address,walletType:i}),c},disconnect:async()=>{if(d&&!(await(await Kr(d,e,n)).logout()).success)throw new Error("Failed to logout");c=void 0,l=void 0,u=void 0,h=null,s.emit("disconnect",void 0)},getAccount:()=>c,getAdminAccount:()=>l,getAuthToken:()=>h,getChain(){if(u)return u=lr(u.id)||u,u},getConfig:()=>o,id:i,subscribe:s.subscribe,switchChain:async _=>{var f;if((o!=null&&o.smartAccount||((f=o==null?void 0:o.executionMode)==null?void 0:f.mode)==="EIP4337")&&d&&c){const{autoConnectInAppWallet:m}=await a(async()=>{const{autoConnectInAppWallet:P}=await Promise.resolve().then(()=>Wi);return{autoConnectInAppWallet:P}},void 0),y=await Kr(d,e,n);await p({chain:_});const{account:b,chain:O,adminAccount:g}=await m({chain:_,client:d},o,y);l=g,c=b,u=O}else u=_;s.emit("chainChanged",_)}}}function sl(...r){const[t,e]=r,n={id:t,partnerId:e==null?void 0:e.partnerId};return il({connectorFactory:async i=>{const{InAppWebConnector:s}=await a(async()=>{const{InAppWebConnector:o}=await import("./web-connector-BKvHD2Ne.js");return{InAppWebConnector:o}},__vite__mapDeps([17,3,4,2,1,18,5,6,7]));return new s({client:i,ecosystem:n,storage:e==null?void 0:e.storage})},createOptions:{auth:{...e==null?void 0:e.auth,options:[]},partnerId:n.partnerId},ecosystem:n})}function Yi(r){return il({connectorFactory:async t=>{var n;const{InAppWebConnector:e}=await a(async()=>{const{InAppWebConnector:i}=await import("./web-connector-BKvHD2Ne.js");return{InAppWebConnector:i}},__vite__mapDeps([17,3,4,2,1,18,5,6,7]));return new e({client:t,passkeyDomain:(n=r==null?void 0:r.auth)==null?void 0:n.passkeyDomain,storage:r==null?void 0:r.storage})},createOptions:r})}function Gs(r){const t=dr();let e,n,i,s;return{autoConnect:async o=>{const{connectSmartAccount:c}=await a(async()=>{const{connectSmartAccount:d}=await import("./index-BzsXZXiV.js");return{connectSmartAccount:d}},__vite__mapDeps([19,3,4,1,2,20,11,5,6,7])),[l,u]=await c(o,r);return s=o,e=l,i=u,Be({chainId:i.id,client:o.client,walletAddress:e.address,walletType:"smart"}),e},connect:async o=>{const{connectSmartAccount:c}=await a(async()=>{const{connectSmartAccount:d}=await import("./index-BzsXZXiV.js");return{connectSmartAccount:d}},__vite__mapDeps([19,3,4,1,2,20,11,5,6,7])),[l,u]=await c(o,r);return n=o.personalAccount,s=o,e=l,i=u,Be({chainId:i.id,client:o.client,walletAddress:e.address,walletType:"smart"}),t.emit("accountChanged",e),e},disconnect:async()=>{if(e){const{disconnectSmartAccount:o}=await a(async()=>{const{disconnectSmartAccount:c}=await import("./index-BzsXZXiV.js");return{disconnectSmartAccount:c}},__vite__mapDeps([19,3,4,1,2,20,11,5,6,7]));await o(e)}e=void 0,n=void 0,i=void 0,t.emit("disconnect",void 0)},getAccount:()=>e,getAdminAccount:()=>n,getChain(){if(i)return i=lr(i.id)||i,i},getConfig:()=>r,id:"smart",subscribe:t.subscribe,switchChain:async o=>{var h;if(!s)throw new Error("Cannot switch chain without a previous connection");if(!await ld(o)){const p=$s({address:r.factoryAddress||Ih((h=r.overrides)==null?void 0:h.entrypointAddress),chain:o,client:s.client});if(!await ud(p))throw new Error(`Factory contract not deployed on chain: ${o.id}`)}const{connectSmartAccount:l}=await a(async()=>{const{connectSmartAccount:p}=await import("./index-BzsXZXiV.js");return{connectSmartAccount:p}},__vite__mapDeps([19,3,4,1,2,20,11,5,6,7])),[u,d]=await l({...s,chain:o},{...r,chain:o});e=u,i=d,t.emit("accountChanged",u),t.emit("chainChanged",d)}}}function at(...r){const[t,e]=r;switch(!0){case t==="smart":return Gs(e);case(t==="embedded"||t==="inApp"):return Yi(e);case Or(t):return sl(...r);case t===ft:{const n=e;return jh({createOptions:n,onConnectRequested:async i=>{const{showCoinbasePopup:s}=await a(async()=>{const{showCoinbasePopup:o}=await Promise.resolve().then(()=>zh);return{showCoinbasePopup:o}},void 0);return s(i)},providerFactory:()=>tl(n)})}case t===Pt:{const n=e;return qh({createOptions:n,providerFactory:()=>Zc(n)})}default:{let c=function(){i=void 0,s=void 0};const n=dr();let i,s,o,l=async()=>{};const u=n.subscribe("disconnect",()=>{c(),o==null||o(),u()});n.subscribe("accountChanged",_=>{i=_});let d=async()=>{throw new Error("Not implemented yet")};const h=Ro()?_=>gi(_):void 0,p={autoConnect:async _=>{const{injectedProvider:f}=await a(async()=>{const{injectedProvider:m}=await Promise.resolve().then(()=>Co);return{injectedProvider:m}},void 0);if(t!=="walletConnect"&&f(t)){const{autoConnectEip1193Wallet:m}=await a(async()=>{const{autoConnectEip1193Wallet:P}=await Promise.resolve().then(()=>ko);return{autoConnectEip1193Wallet:P}},void 0),[y,b,O,g]=await m({chain:_.chain,client:_.client,emitter:n,id:t,provider:Qi(t)});return i=y,s=b,l=O,d=g,o=n.subscribe("chainChanged",P=>{s=P}),Be({chainId:s.id,client:_.client,walletAddress:i.address,walletType:t}),i}if(_&&"client"in _){const{autoConnectWC:m}=await a(async()=>{const{autoConnectWC:P}=await import("./controller-BjIVvsNj.js");return{autoConnectWC:P}},__vite__mapDeps([21,3,4,1,2,13,5,6,7])),[y,b,O,g]=await m(_,n,p.id,Fn,h);return i=y,s=b,l=O,d=g,Be({chainId:s.id,client:_.client,walletAddress:i.address,walletType:t}),i}throw new Error("Failed to auto connect")},connect:async _=>{async function f(b){var P;const{connectWC:O}=await a(async()=>{const{connectWC:A}=await import("./controller-BjIVvsNj.js");return{connectWC:A}},__vite__mapDeps([21,3,4,1,2,13,5,6,7]));let g;try{const[A,E,D,L]=await O({...b,walletConnect:{...b.walletConnect,onDisplayUri:((P=b.walletConnect)==null?void 0:P.onDisplayUri)||(async w=>{var v,I;if(typeof window<"u"&&typeof document<"u")if(Ro()){const T=await Jc(t),V=T.mobile.native||T.mobile.universal;gi(V?xh(V,w).redirect:w);return}else try{const{createQROverlay:T}=await a(async()=>{const{createQROverlay:V}=await import("./qr-overlay-DzX75qoo.js");return{createQROverlay:V}},__vite__mapDeps([22,3,4]));g&&g.destroy(),g=T(w,{theme:((I=(v=b.walletConnect)==null?void 0:v.qrModalOptions)==null?void 0:I.themeMode)??"dark",qrSize:280,showCloseButton:!0,onCancel:()=>{var V,R;(R=(V=b.walletConnect)==null?void 0:V.onCancel)==null||R.call(V)}})}catch(T){console.error("Failed to create QR overlay:",T)}})}},n,p.id,Fn,h);return g&&(g.destroy(),g=void 0),i=A,s=E,l=D,d=L,Be({chainId:s.id,client:b.client,walletAddress:i.address,walletType:t}),i}catch(A){throw g&&(g.destroy(),g=void 0),A}}if(t==="walletConnect"){const{client:b,chain:O,...g}=_;return f({chain:O,client:b,walletConnect:{...g}})}const m=_&&"walletConnect"in _,{injectedProvider:y}=await a(async()=>{const{injectedProvider:b}=await Promise.resolve().then(()=>Co);return{injectedProvider:b}},void 0);if(y(t)&&!m){const{connectEip1193Wallet:b}=await a(async()=>{const{connectEip1193Wallet:E}=await Promise.resolve().then(()=>ko);return{connectEip1193Wallet:E}},void 0),[O,g,P,A]=await b({chain:_.chain,client:_.client,emitter:n,id:t,provider:Qi(t)});return i=O,s=g,l=P,d=A,o=n.subscribe("chainChanged",E=>{s=E}),Be({chainId:s.id,client:_.client,walletAddress:i.address,walletType:t}),i}if(_&&"client"in _)return f(_);throw new Error("Failed to connect")},disconnect:async()=>{c(),await l()},getAccount:()=>i,getChain(){if(s)return s=lr(s.id)||s,s},getConfig:()=>r[1],id:t,subscribe:n.subscribe,switchChain:async _=>{try{await d(_),s=_}catch(f){console.error("Error switching chain",f)}}};return p}}}function Hh(){return at("walletConnect")}const xo=Fc()?Rh():void 0;function Js(r){const t=Zs().find(e=>e.info.rdns===r);return t==null?void 0:t.provider}function ol(){return Zs().map(e=>e.info.rdns).map(e=>at(e))}function Gh(){if(xo)return xo}function Zs(){var t;const r=((t=Gh())==null?void 0:t.getProviders())||[];for(const e of r)if(e.info.rdns==="io.metamask.mobile"){e.info.rdns=Wc;break}return r}const Co=Object.freeze(Object.defineProperty({__proto__:null,getInstalledWalletProviders:Zs,getInstalledWallets:ol,injectedProvider:Js},Symbol.toStringTag,{value:"Module"}));function Qi(r){const t=Js(r);if(!t)throw new Error(`No injected provider found for wallet: "${r}"`);return t}async function al({id:r,provider:t,emitter:e,client:n,chain:i}){var p,_;let s,c=0;for(;!(s!=null&&s[0])&&c<3;){try{s=await t.request({method:"eth_requestAccounts"})}catch(f){if(console.error(f),(_=(p=Jh(f))==null?void 0:p.toLowerCase())!=null&&_.includes("rejected"))throw f;await new Promise(m=>setTimeout(m,500))}c++}const l=s==null?void 0:s[0];if(!l)throw new Error("Failed to connect to wallet, no accounts available");const u=Z(l),d=await t.request({method:"eth_chainId"}).then(lt).catch(f=>{throw new Error("Error reading chainId from provider",f)});let h=i&&i.id===d?i:ge(d);try{i&&typeof i.id<"u"&&i.id!==d&&(await ul(t,i),h=i)}catch{console.warn(`Error switching to chain ${i==null?void 0:i.id} - defaulting to wallet chain (${d})`)}return ll({address:u,chain:h,client:n,emitter:e,id:r,provider:t})}async function cl({id:r,provider:t,emitter:e,client:n,chain:i}){const o=(await t.request({method:"eth_accounts"}))[0];if(!o)throw new Error("Failed to connect to wallet, no accounts available");const c=Z(o),l=await t.request({method:"eth_chainId"}).then(lt),u=i&&i.id===l?i:ge(l);return ll({address:c,chain:u,client:n,emitter:e,id:r,provider:t})}function $o({provider:r,address:t,client:e,id:n}){const i={address:Z(t),async sendTransaction(s){const c=[{...s.gasPrice?{gasPrice:De(s.gasPrice)}:{maxFeePerGas:s.maxFeePerGas?De(s.maxFeePerGas):void 0,maxPriorityFeePerGas:s.maxPriorityFeePerGas?De(s.maxPriorityFeePerGas):void 0},from:this.address,gas:s.gas?De(s.gas):void 0,nonce:s.nonce?De(s.nonce):void 0,to:s.to?Z(s.to):void 0,data:s.data,value:s.value?De(s.value):void 0,authorizationList:s.authorizationList?pd(s.authorizationList):void 0,accessList:s.accessList,...s.eip712}];try{const l=await r.request({method:"eth_sendTransaction",params:c});return Cs({chainId:s.chainId,client:e,contractAddress:s.to??void 0,gasPrice:s.gasPrice,transactionHash:l,walletAddress:Z(t),walletType:n}),{transactionHash:l}}catch(l){throw _d(l)&&fd({chainId:s.chainId,client:e,contractAddress:s.to||void 0,error:l,transactionValue:s.value,walletAddress:Z(t)}),l}},async signMessage({message:s}){if(!i.address)throw new Error("Provider not setup");const o=typeof s=="string"?xs(s):s.raw instanceof Uint8Array?ri(s.raw):s.raw;return await r.request({method:"personal_sign",params:[o,Z(i.address)]})},async signAuthorization(s){const o=xc(s);let c;try{c=await r.request({method:"eth_sign",params:[Z(i.address),o]})}catch{c=await r.request({method:"secp256k1_sign",params:[o]})}if(!c)throw new Error("Failed to sign authorization");const l=hd(c);return{...s,...l}},async signTypedData(s){if(!r||!i.address)throw new Error("Provider not setup");const o=js(s),{domain:c,message:l,primaryType:u}=o,d={EIP712Domain:Ud({domain:c}),...o.types};qd({domain:c,message:l,primaryType:u,types:d});const h=Md({domain:c??{},message:l,primaryType:u,types:d});return await r.request({method:"eth_signTypedData_v4",params:[Z(i.address),h]})},async watchAsset(s){return await r.request({method:"wallet_watchAsset",params:s},{retryCount:0})},async sendCalls(s){try{const{callParams:o,chain:c}=await Fs(s,i),l=await r.request({method:"wallet_sendCalls",params:o});return l&&typeof l=="object"&&"id"in l?{chain:c,client:e,id:l.id}:{chain:c,client:e,id:l}}catch(o){throw/unsupport|not support/i.test(o.message)?new Error(`${n} errored calling wallet_sendCalls, with error: ${o instanceof Error?o.message:dd(o)}`):o}},async getCallsStatus(s){try{const o=await r.request({method:"wallet_getCallsStatus",params:[s.id]});return zs(o)}catch(o){throw/unsupport|not support/i.test(o.message)?new Error(`${n} does not support wallet_getCallsStatus, reach out to them directly to request EIP-5792 support.`):o}},async getCallsStatusRaw(s){try{return await r.request({method:"wallet_getCallsStatus",params:[s.id]})}catch(o){throw/unsupport|not support/i.test(o.message)?new Error(`${n} does not support wallet_getCallsStatus, reach out to them directly to request EIP-5792 support.`):o}},async getCapabilities(s){const o=s.chainId;try{const c=await r.request({method:"wallet_getCapabilities",params:[Z(i.address),o?[De(o)]:void 0]});return Ks(c,o)}catch(c){if(/unsupport|not support|not available/i.test(c.message))return{message:`${n} does not support wallet_getCapabilities, reach out to them directly to request EIP-5792 support.`};throw c}}};return i}async function ll({provider:r,address:t,chain:e,emitter:n,client:i,id:s}){const o=$o({address:t,client:i,id:s,provider:r});async function c(){r.removeListener("accountsChanged",u),r.removeListener("chainChanged",d),r.removeListener("disconnect",l);try{await Bd(()=>r.request({method:"wallet_revokePermissions",params:[{eth_accounts:{}}]}),{timeout:100})}catch{}}async function l(){c(),n.emit("disconnect",void 0)}function u(h){if(h[0]){const p=$o({address:Z(h[0]),client:i,id:s,provider:r});n.emit("accountChanged",p),n.emit("accountsChanged",h)}else l()}function d(h){const p=ge(lt(h));n.emit("chainChanged",p)}return r.on&&(r.on("accountsChanged",u),r.on("chainChanged",d),r.on("disconnect",l)),[o,e,l,h=>ul(r,h)]}async function ul(r,t){var n;const e=De(t.id);try{await r.request({method:"wallet_switchEthereumChain",params:[{chainId:e}]})}catch{const i=await Us(t);await r.request({method:"wallet_addEthereumChain",params:[{blockExplorerUrls:(n=i.explorers)==null?void 0:n.map(s=>s.url),chainId:e,chainName:i.name,nativeCurrency:i.nativeCurrency,rpcUrls:Ws(i)}]})}}function Jh(r){return r instanceof Error?r.message:typeof r=="string"?r:typeof r=="object"&&r!==null?JSON.stringify(r):String(r)}const ko=Object.freeze(Object.defineProperty({__proto__:null,autoConnectEip1193Wallet:cl,connectEip1193Wallet:al,getInjectedProvider:Qi},Symbol.toStringTag,{value:"Module"}));function Zh(r){const t=r.walletId??"adapter",e=dr();let n,i,s;const o=async p=>(s=typeof r.provider=="function"?await r.provider(p):r.provider,s),c=e.subscribe("chainChanged",p=>{i=p});function l(){n=void 0,i=void 0}let u=async()=>{};const d=e.subscribe("disconnect",()=>{l(),c(),d()});e.subscribe("accountChanged",p=>{n=p});let h=async p=>{await(s==null?void 0:s.request({method:"wallet_switchEthereumChain",params:[{chainId:md(p.id)}]}))};return{autoConnect:async p=>{var b;const[_,f,m,y]=await cl({chain:p.chain,client:p.client,emitter:e,id:t,provider:await o({chainId:(b=p.chain)==null?void 0:b.id})});return n=_,i=f,u=m,h=y,e.emit("onConnect",p),Be({client:p.client,walletAddress:n.address,walletType:t}),n},connect:async p=>{var b;const[_,f,m,y]=await al({chain:p.chain,client:p.client,emitter:e,id:t,provider:await o({chainId:(b=p.chain)==null?void 0:b.id})});return n=_,i=f,u=m,h=y,e.emit("onConnect",p),Be({client:p.client,walletAddress:n.address,walletType:t}),n},disconnect:async()=>{l(),await u(),e.emit("disconnect",void 0)},getAccount:()=>n,getChain(){if(i)return i=lr(i.id)||i,i},getConfig:()=>{},id:t,subscribe:e.subscribe,switchChain:async p=>{await h(p),e.emit("chainChanged",p)}}}function Yh(r){const{chain:t,client:e,wallet:n,connectOverride:i}=r,s=ni({chain:t,client:e});return{on:n.subscribe,removeListener:()=>{},request:async o=>{switch(o.method){case"eth_sendTransaction":{const c=n.getAccount();if(!c)throw new Error("Account not connected");return(await Cc({account:c,transaction:Gi({...o.params[0],chain:t,client:e})})).transactionHash}case"eth_estimateGas":{const c=n.getAccount();if(!c)throw new Error("Account not connected");return yd({account:c,transaction:Gi({...o.params[0],chain:t,client:e})})}case"personal_sign":{const c=n.getAccount();if(!c)throw new Error("Account not connected");return c.signMessage({message:{raw:o.params[0]}})}case"eth_signTypedData_v4":{const c=n.getAccount();if(!c)throw new Error("Account not connected");const l=JSON.parse(o.params[1]);return c.signTypedData(l)}case"eth_accounts":{const c=n.getAccount();return c?[c.address]:[]}case"eth_requestAccounts":{const c=n.getAccount();if(c)return[c.address];const l=i?await i(n):await n.connect({client:e}).catch(u=>(console.error("Error connecting wallet",u),null));if(!l)throw new Error("Unable to connect wallet - try passing a connectOverride function");return[l.address]}case"wallet_switchEthereumChain":case"wallet_addEthereumChain":{const l=o.params[0].chainId;if(!l)throw new Error("Chain ID is required");const u=qn(l)?sr(l):l,d=ge(u);return n.switchChain(d)}case"wallet_getCapabilities":{const c=n.getAccount();if(!c)throw new Error("Account not connected");if(!c.getCapabilities)throw new Error("Wallet does not support EIP-5792");const l=o.params[1];if(l&&Array.isArray(l)){const u=l[0],d=qn(u)?sr(u):Number(u);return c.getCapabilities(d?{chainId:d}:{})}return c.getCapabilities({})}case"wallet_sendCalls":{const c=n.getAccount();if(!c)throw new Error("Account not connected");if(!c.sendCalls)throw new Error("Wallet does not support EIP-5792");return c.sendCalls({...o.params[0],chain:t})}case"wallet_getCallsStatus":{const c=n.getAccount();if(!c)throw new Error("Account not connected");if(!c.getCallsStatusRaw)throw new Error("Wallet does not support EIP-5792");return await c.getCallsStatusRaw({id:o.params[0],chain:t,client:e})}default:return s(o)}}}}const Qh=Object.freeze(Object.defineProperty({__proto__:null,fromProvider:Zh,toProvider:Yh},Symbol.toStringTag,{value:"Module"}));function Xh(r){const t=dr();let e=r.chain;return{autoConnect:async()=>(t.emit("onConnect",r),r.adaptedAccount),connect:async()=>(t.emit("onConnect",r),r.adaptedAccount),disconnect:async()=>{await r.onDisconnect(),t.emit("disconnect",void 0)},getAccount(){return r.adaptedAccount},getChain(){return e=lr(e.id)||e,e},getConfig(){return r},id:"adapter",subscribe:t.subscribe,switchChain:async n=>{await r.switchChain(n),e=n,t.emit("chainChanged",n)}}}async function ep(){return(await a(async()=>{const{default:r}=await import("./wallet-infos-BHI_w6r-.js");return{default:r}},[])).default}async function hr(r,t){return Kr(r,async e=>{const{InAppWebConnector:n}=await a(async()=>{const{InAppWebConnector:i}=await import("./web-connector-BKvHD2Ne.js");return{InAppWebConnector:i}},__vite__mapDeps([17,3,4,2,1,18,5,6,7]));return new n({client:e,ecosystem:t})},t)}async function dl(r){const{client:t,ecosystem:e}=r,i=await(await hr(t,e)).getUser();switch(i.status){case"Logged In, Wallet Initialized":return i}}async function tp(r){const t=await dl(r);if(t&&"email"in t.authDetails)return t.authDetails.email}async function rp(r){const t=await dl(r);if(t&&"phoneNumber"in t.authDetails)return t.authDetails.phoneNumber}async function np(r){return(await hr(r.client,r.ecosystem)).preAuthenticate(r)}async function ip(r){return(await hr(r.client,r.ecosystem)).authenticate(r)}async function sp(r){const t=await hr(r.client,r.ecosystem);if(!t.authenticateWithRedirect)throw new Error("authenticateWithRedirect is not supported on this platform");return t.authenticateWithRedirect(r.strategy,r.mode,r.redirectUrl)}async function op(r){return await(await hr(r.client,r.ecosystem)).linkProfile(r)}async function ap(r){return await(await hr(r.client,r.ecosystem)).unlinkProfile(r.profileToUnlink,r.allowAccountDeletion)}async function cp(r){return(await hr(r.client,r.ecosystem)).getProfiles()}function lp(r){if("privateKey"in r){const t=wh(typeof r.message=="object"?r.message.raw:Rc(r.message)),e=ks({payload:t,privateKey:r.privateKey});return $c(e)}if("account"in r){const{message:t,account:e}=r;return e.signMessage({message:t})}throw new Error("Either privateKey or account is required")}function up(r){var s;const{privateKey:t,...e}=r;typeof((s=e.domain)==null?void 0:s.chainId)=="string"&&(e.domain.chainId=Lc(e.domain.chainId));const n=wd(e),i=ks({payload:n,privateKey:t});return $c(i)}function Xi(r){const{client:t}=r,e=`0x${r.privateKey.replace(/^0x/,"")}`,n=Ns(kc.getPublicKey(e.slice(2),!1)),i=jd(n);return{address:Z(i),sendTransaction:async o=>{const c=ni({chain:ge(o.chainId),client:t}),l=bo({privateKey:e,transaction:o});return{transactionHash:await Ed(c,l)}},signAuthorization:async o=>{const c=ks({payload:xc(o),privateKey:e});return gd(o,{signature:c})},signMessage:async({message:o})=>lp({message:o,privateKey:e}),signTransaction:async o=>bo({privateKey:e,transaction:o}),signTypedData:async o=>up({...o,privateKey:e})}}async function dp(r){const t=Ns(kc.utils.randomPrivateKey());return Xi({client:r.client,privateKey:t})}async function hp(r){const{address:t,client:e,chain:n}=r,i=r.tokenAddress||(n.id===42429?"0x20c0000000000000000000000000000000000000":void 0);if(i&&Z(i)!==Z(Io)){const{getBalance:d}=await a(async()=>{const{getBalance:h}=await import("./getBalance-Dg__EkP1.js");return{getBalance:h}},__vite__mapDeps([23,1,2,3,4,24]));return d({address:t,contract:$s({address:i,chain:n,client:e})})}const s=ni({chain:n,client:e}),[o,c,l,u]=await Promise.all([Sd(n),xd(n),Cd(n),vd(s,{address:t})]);return{chainId:n.id,decimals:c,displayValue:bd(u,c),name:l,symbol:o,tokenAddress:i??Io,value:u}}function pp(r){return!r||typeof r.then!="function"?Promise.resolve(r):r}function ye(r,...t){try{return pp(r(...t))}catch(e){return Promise.reject(e)}}function _p(r){const t=typeof r;return r===null||t!=="object"&&t!=="function"}function fp(r){const t=Object.getPrototypeOf(r);return!t||t.isPrototypeOf(Object)}function Vn(r){if(_p(r))return String(r);if(fp(r)||Array.isArray(r))return JSON.stringify(r);if(typeof r.toJSON=="function")return Vn(r.toJSON());throw new Error("[unstorage] Cannot stringify value!")}const es="base64:";function mp(r){return typeof r=="string"?r:es+gp(r)}function yp(r){return typeof r!="string"||!r.startsWith(es)?r:wp(r.slice(es.length))}function wp(r){return globalThis.Buffer?Buffer.from(r,"base64"):Uint8Array.from(globalThis.atob(r),t=>t.codePointAt(0))}function gp(r){return globalThis.Buffer?Buffer.from(r).toString("base64"):globalThis.btoa(String.fromCodePoint(...r))}function ke(r){var t;return r&&((t=r.split("?")[0])==null?void 0:t.replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,""))||""}function Ep(...r){return ke(r.join(":"))}function bn(r){return r=ke(r),r?r+":":""}function vp(r,t){if(t===void 0)return!0;let e=0,n=r.indexOf(":");for(;n>-1;)e++,n=r.indexOf(":",n+1);return e<=t}function bp(r,t){return t?r.startsWith(t)&&r[r.length-1]!=="$":r[r.length-1]!=="$"}const Ip="memory",Ap=()=>{const r=new Map;return{name:Ip,getInstance:()=>r,hasItem(t){return r.has(t)},getItem(t){return r.get(t)??null},getItemRaw(t){return r.get(t)??null},setItem(t,e){r.set(t,e)},setItemRaw(t,e){r.set(t,e)},removeItem(t){r.delete(t)},getKeys(){return[...r.keys()]},clear(){r.clear()},dispose(){r.clear()}}};function Tp(r={}){const t={mounts:{"":r.driver||Ap()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},e=u=>{for(const d of t.mountpoints)if(u.startsWith(d))return{base:d,relativeKey:u.slice(d.length),driver:t.mounts[d]};return{base:"",relativeKey:u,driver:t.mounts[""]}},n=(u,d)=>t.mountpoints.filter(h=>h.startsWith(u)||d&&u.startsWith(h)).map(h=>({relativeBase:u.length>h.length?u.slice(h.length):void 0,mountpoint:h,driver:t.mounts[h]})),i=(u,d)=>{if(t.watching){d=ke(d);for(const h of t.watchListeners)h(u,d)}},s=async()=>{if(!t.watching){t.watching=!0;for(const u in t.mounts)t.unwatch[u]=await No(t.mounts[u],i,u)}},o=async()=>{if(t.watching){for(const u in t.unwatch)await t.unwatch[u]();t.unwatch={},t.watching=!1}},c=(u,d,h)=>{const p=new Map,_=f=>{let m=p.get(f.base);return m||(m={driver:f.driver,base:f.base,items:[]},p.set(f.base,m)),m};for(const f of u){const m=typeof f=="string",y=ke(m?f:f.key),b=m?void 0:f.value,O=m||!f.options?d:{...d,...f.options},g=e(y);_(g).items.push({key:y,value:b,relativeKey:g.relativeKey,options:O})}return Promise.all([...p.values()].map(f=>h(f))).then(f=>f.flat())},l={hasItem(u,d={}){u=ke(u);const{relativeKey:h,driver:p}=e(u);return ye(p.hasItem,h,d)},getItem(u,d={}){u=ke(u);const{relativeKey:h,driver:p}=e(u);return ye(p.getItem,h,d).then(_=>En(_))},getItems(u,d={}){return c(u,d,h=>h.driver.getItems?ye(h.driver.getItems,h.items.map(p=>({key:p.relativeKey,options:p.options})),d).then(p=>p.map(_=>({key:Ep(h.base,_.key),value:En(_.value)}))):Promise.all(h.items.map(p=>ye(h.driver.getItem,p.relativeKey,p.options).then(_=>({key:p.key,value:En(_)})))))},getItemRaw(u,d={}){u=ke(u);const{relativeKey:h,driver:p}=e(u);return p.getItemRaw?ye(p.getItemRaw,h,d):ye(p.getItem,h,d).then(_=>yp(_))},async setItem(u,d,h={}){if(d===void 0)return l.removeItem(u);u=ke(u);const{relativeKey:p,driver:_}=e(u);_.setItem&&(await ye(_.setItem,p,Vn(d),h),_.watch||i("update",u))},async setItems(u,d){await c(u,d,async h=>{if(h.driver.setItems)return ye(h.driver.setItems,h.items.map(p=>({key:p.relativeKey,value:Vn(p.value),options:p.options})),d);h.driver.setItem&&await Promise.all(h.items.map(p=>ye(h.driver.setItem,p.relativeKey,Vn(p.value),p.options)))})},async setItemRaw(u,d,h={}){if(d===void 0)return l.removeItem(u,h);u=ke(u);const{relativeKey:p,driver:_}=e(u);if(_.setItemRaw)await ye(_.setItemRaw,p,d,h);else if(_.setItem)await ye(_.setItem,p,mp(d),h);else return;_.watch||i("update",u)},async removeItem(u,d={}){typeof d=="boolean"&&(d={removeMeta:d}),u=ke(u);const{relativeKey:h,driver:p}=e(u);p.removeItem&&(await ye(p.removeItem,h,d),(d.removeMeta||d.removeMata)&&await ye(p.removeItem,h+"$",d),p.watch||i("remove",u))},async getMeta(u,d={}){typeof d=="boolean"&&(d={nativeOnly:d}),u=ke(u);const{relativeKey:h,driver:p}=e(u),_=Object.create(null);if(p.getMeta&&Object.assign(_,await ye(p.getMeta,h,d)),!d.nativeOnly){const f=await ye(p.getItem,h+"$",d).then(m=>En(m));f&&typeof f=="object"&&(typeof f.atime=="string"&&(f.atime=new Date(f.atime)),typeof f.mtime=="string"&&(f.mtime=new Date(f.mtime)),Object.assign(_,f))}return _},setMeta(u,d,h={}){return this.setItem(u+"$",d,h)},removeMeta(u,d={}){return this.removeItem(u+"$",d)},async getKeys(u,d={}){var y;u=bn(u);const h=n(u,!0);let p=[];const _=[];let f=!0;for(const b of h){(y=b.driver.flags)!=null&&y.maxDepth||(f=!1);const O=await ye(b.driver.getKeys,b.relativeBase,d);for(const g of O){const P=b.mountpoint+ke(g);p.some(A=>P.startsWith(A))||_.push(P)}p=[b.mountpoint,...p.filter(g=>!g.startsWith(b.mountpoint))]}const m=d.maxDepth!==void 0&&!f;return _.filter(b=>(!m||vp(b,d.maxDepth))&&bp(b,u))},async clear(u,d={}){u=bn(u),await Promise.all(n(u,!1).map(async h=>{if(h.driver.clear)return ye(h.driver.clear,h.relativeBase,d);if(h.driver.removeItem){const p=await h.driver.getKeys(h.relativeBase||"",d);return Promise.all(p.map(_=>h.driver.removeItem(_,d)))}}))},async dispose(){await Promise.all(Object.values(t.mounts).map(u=>Uo(u)))},async watch(u){return await s(),t.watchListeners.push(u),async()=>{t.watchListeners=t.watchListeners.filter(d=>d!==u),t.watchListeners.length===0&&await o()}},async unwatch(){t.watchListeners=[],await o()},mount(u,d){if(u=bn(u),u&&t.mounts[u])throw new Error(`already mounted at ${u}`);return u&&(t.mountpoints.push(u),t.mountpoints.sort((h,p)=>p.length-h.length)),t.mounts[u]=d,t.watching&&Promise.resolve(No(d,i,u)).then(h=>{t.unwatch[u]=h}).catch(console.error),l},async unmount(u,d=!0){var h,p;u=bn(u),!(!u||!t.mounts[u])&&(t.watching&&u in t.unwatch&&((p=(h=t.unwatch)[u])==null||p.call(h),delete t.unwatch[u]),d&&await Uo(t.mounts[u]),t.mountpoints=t.mountpoints.filter(_=>_!==u),delete t.mounts[u])},getMount(u=""){u=ke(u)+":";const d=e(u);return{driver:d.driver,base:d.base}},getMounts(u="",d={}){return u=ke(u),n(u,d.parents).map(p=>({driver:p.driver,base:p.mountpoint}))},keys:(u,d={})=>l.getKeys(u,d),get:(u,d={})=>l.getItem(u,d),set:(u,d,h={})=>l.setItem(u,d,h),has:(u,d={})=>l.hasItem(u,d),del:(u,d={})=>l.removeItem(u,d),remove:(u,d={})=>l.removeItem(u,d)};return l}function No(r,t,e){return r.watch?r.watch((n,i)=>t(n,e+i)):()=>{}}async function Uo(r){typeof r.dispose=="function"&&await ye(r.dispose)}var qo={};const Pp="idb-keyval";var Op=(r={})=>{const t=r.base&&r.base.length>0?`${r.base}:`:"",e=i=>t+i;let n;return r.dbName&&r.storeName&&(n=zd(r.dbName,r.storeName)),{name:Pp,options:r,async hasItem(i){return!(typeof await To(e(i),n)>"u")},async getItem(i){return await To(e(i),n)??null},setItem(i,s){return Hd(e(i),s,n)},removeItem(i){return Wd(e(i),n)},getKeys(){return Fd(n)},clear(){return Kd(n)}}};const Rp="WALLET_CONNECT_V2_INDEXED_DB",Lp="keyvaluestorage";let Dp=class{constructor(){this.indexedDb=Tp({driver:Op({dbName:Rp,storeName:Lp})})}async getKeys(){return this.indexedDb.getKeys()}async getEntries(){return(await this.indexedDb.getItems(await this.indexedDb.getKeys())).map(t=>[t.key,t.value])}async getItem(t){const e=await this.indexedDb.getItem(t);if(e!==null)return e}async setItem(t,e){await this.indexedDb.setItem(t,rn(e))}async removeItem(t){await this.indexedDb.removeItem(t)}};var Ii=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof qo<"u"?qo:typeof self<"u"?self:{},Sn={exports:{}};(function(){let r;function t(){}r=t,r.prototype.getItem=function(e){return this.hasOwnProperty(e)?String(this[e]):null},r.prototype.setItem=function(e,n){this[e]=String(n)},r.prototype.removeItem=function(e){delete this[e]},r.prototype.clear=function(){const e=this;Object.keys(e).forEach(function(n){e[n]=void 0,delete e[n]})},r.prototype.key=function(e){return e=e||0,Object.keys(this)[e]},r.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof Ii<"u"&&Ii.localStorage?Sn.exports=Ii.localStorage:typeof window<"u"&&window.localStorage?Sn.exports=window.localStorage:Sn.exports=new t})();function Vp(r){var t;return[r[0],Mn((t=r[1])!=null?t:"")]}let Sp=class{constructor(){this.localStorage=Sn.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(Vp)}async getItem(t){const e=this.localStorage.getItem(t);if(e!==null)return Mn(e)}async setItem(t,e){this.localStorage.setItem(t,rn(e))}async removeItem(t){this.localStorage.removeItem(t)}};const xp="wc_storage_version",Mo=1,Cp=async(r,t,e)=>{const n=xp,i=await t.getItem(n);if(i&&i>=Mo){e(t);return}const s=await r.getKeys();if(!s.length){e(t);return}const o=[];for(;s.length;){const c=s.shift();if(!c)continue;const l=c.toLowerCase();if(l.includes("wc@")||l.includes("walletconnect")||l.includes("wc_")||l.includes("wallet_connect")){const u=await r.getItem(c);await t.setItem(c,u),o.push(c)}}await t.setItem(n,Mo),e(t),$p(r,o)},$p=async(r,t)=>{t.length&&t.forEach(async e=>{await r.removeItem(e)})};let kp=class{constructor(){this.initialized=!1,this.setInitialized=e=>{this.storage=e,this.initialized=!0};const t=new Sp;this.storage=t;try{const e=new Dp;Cp(t,e,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(t){return await this.initialize(),this.storage.getItem(t)}async setItem(t,e){return await this.initialize(),this.storage.setItem(t,e)}async removeItem(t){return await this.initialize(),this.storage.removeItem(t)}async initialize(){this.initialized||await new Promise(t=>{const e=setInterval(()=>{this.initialized&&(clearInterval(e),t())},20)})}};var Ai,Bo;function Np(){if(Bo)return Ai;Bo=1;const r=Gd();Ai=i;const t=A().console||{},e={mapHttpRequest:f,mapHttpResponse:f,wrapRequestSerializer:m,wrapResponseSerializer:m,wrapErrorSerializer:m,req:f,res:f,err:p};function n(E,D){return Array.isArray(E)?E.filter(function(w){return w!=="!stdSerializers.err"}):E===!0?Object.keys(D):!1}function i(E){E=E||{},E.browser=E.browser||{};const D=E.browser.transmit;if(D&&typeof D.send!="function")throw Error("pino: transmit option must have a send function");const L=E.browser.write||t;E.browser.write&&(E.browser.asObject=!0);const w=E.serializers||{},v=n(E.browser.serialize,w);let I=E.browser.serialize;Array.isArray(E.browser.serialize)&&E.browser.serialize.indexOf("!stdSerializers.err")>-1&&(I=!1);const T=["error","fatal","warn","info","debug","trace"];typeof L=="function"&&(L.error=L.fatal=L.warn=L.info=L.debug=L.trace=L),E.enabled===!1&&(E.level="silent");const V=E.level||"info",R=Object.create(L);R.log||(R.log=y),Object.defineProperty(R,"levelVal",{get:$}),Object.defineProperty(R,"level",{get:k,set:M});const S={transmit:D,serialize:v,asObject:E.browser.asObject,levels:T,timestamp:_(E)};R.levels=i.levels,R.level=V,R.setMaxListeners=R.getMaxListeners=R.emit=R.addListener=R.on=R.prependListener=R.once=R.prependOnceListener=R.removeListener=R.removeAllListeners=R.listeners=R.listenerCount=R.eventNames=R.write=R.flush=y,R.serializers=w,R._serialize=v,R._stdErrSerialize=I,R.child=C,D&&(R._logEvent=h());function $(){return this.level==="silent"?1/0:this.levels.values[this.level]}function k(){return this._level}function M(N){if(N!=="silent"&&!this.levels.values[N])throw Error("unknown level "+N);this._level=N,s(S,R,"error","log"),s(S,R,"fatal","error"),s(S,R,"warn","error"),s(S,R,"info","log"),s(S,R,"debug","log"),s(S,R,"trace","log")}function C(N,j){if(!N)throw new Error("missing bindings for child Pino");j=j||{},v&&N.serializers&&(j.serializers=N.serializers);const z=j.serializers;if(v&&z){var K=Object.assign({},w,z),F=E.browser.serialize===!0?Object.keys(K):v;delete N.serializers,l([N],F,K,this._stdErrSerialize)}function W(H){this._childLevel=(H._childLevel|0)+1,this.error=u(H,N,"error"),this.fatal=u(H,N,"fatal"),this.warn=u(H,N,"warn"),this.info=u(H,N,"info"),this.debug=u(H,N,"debug"),this.trace=u(H,N,"trace"),K&&(this.serializers=K,this._serialize=F),D&&(this._logEvent=h([].concat(H._logEvent.bindings,N)))}return W.prototype=this,new W(this)}return R}i.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"}},i.stdSerializers=e,i.stdTimeFunctions=Object.assign({},{nullTime:b,epochTime:O,unixTime:g,isoTime:P});function s(E,D,L,w){const v=Object.getPrototypeOf(D);D[L]=D.levelVal>D.levels.values[L]?y:v[L]?v[L]:t[L]||t[w]||y,o(E,D,L)}function o(E,D,L){!E.transmit&&D[L]===y||(D[L]=function(w){return function(){const I=E.timestamp(),T=new Array(arguments.length),V=Object.getPrototypeOf&&Object.getPrototypeOf(this)===t?t:this;for(var R=0;R<T.length;R++)T[R]=arguments[R];if(E.serialize&&!E.asObject&&l(T,this._serialize,this.serializers,this._stdErrSerialize),E.asObject?w.call(V,c(this,L,T,I)):w.apply(V,T),E.transmit){const S=E.transmit.level||D.level,$=i.levels.values[S],k=i.levels.values[L];if(k<$)return;d(this,{ts:I,methodLevel:L,methodValue:k,transmitValue:i.levels.values[E.transmit.level||D.level],send:E.transmit.send,val:D.levelVal},T)}}}(D[L]))}function c(E,D,L,w){E._serialize&&l(L,E._serialize,E.serializers,E._stdErrSerialize);const v=L.slice();let I=v[0];const T={};w&&(T.time=w),T.level=i.levels.values[D];let V=(E._childLevel|0)+1;if(V<1&&(V=1),I!==null&&typeof I=="object"){for(;V--&&typeof v[0]=="object";)Object.assign(T,v.shift());I=v.length?r(v.shift(),v):void 0}else typeof I=="string"&&(I=r(v.shift(),v));return I!==void 0&&(T.msg=I),T}function l(E,D,L,w){for(const v in E)if(w&&E[v]instanceof Error)E[v]=i.stdSerializers.err(E[v]);else if(typeof E[v]=="object"&&!Array.isArray(E[v]))for(const I in E[v])D&&D.indexOf(I)>-1&&I in L&&(E[v][I]=L[I](E[v][I]))}function u(E,D,L){return function(){const w=new Array(1+arguments.length);w[0]=D;for(var v=1;v<w.length;v++)w[v]=arguments[v-1];return E[L].apply(this,w)}}function d(E,D,L){const w=D.send,v=D.ts,I=D.methodLevel,T=D.methodValue,V=D.val,R=E._logEvent.bindings;l(L,E._serialize||Object.keys(E.serializers),E.serializers,E._stdErrSerialize===void 0?!0:E._stdErrSerialize),E._logEvent.ts=v,E._logEvent.messages=L.filter(function(S){return R.indexOf(S)===-1}),E._logEvent.level.label=I,E._logEvent.level.value=T,w(I,E._logEvent,V),E._logEvent=h(R)}function h(E){return{ts:0,messages:[],bindings:E||[],level:{label:"",value:0}}}function p(E){const D={type:E.constructor.name,msg:E.message,stack:E.stack};for(const L in E)D[L]===void 0&&(D[L]=E[L]);return D}function _(E){return typeof E.timestamp=="function"?E.timestamp:E.timestamp===!1?b:O}function f(){return{}}function m(E){return E}function y(){}function b(){return!1}function O(){return Date.now()}function g(){return Math.round(Date.now()/1e3)}function P(){return new Date(Date.now()).toISOString()}function A(){function E(D){return typeof D<"u"&&D}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 E(self)||E(window)||E(this)||{}}}return Ai}var Er=Np();const oi=Nd(Er),Up={level:"info"},pn="custom_context",Ys=1e3*1024;let qp=class{constructor(t){this.nodeValue=t,this.sizeInBytes=new TextEncoder().encode(this.nodeValue).length,this.next=null}get value(){return this.nodeValue}get size(){return this.sizeInBytes}},jo=class{constructor(t){this.head=null,this.tail=null,this.lengthInNodes=0,this.maxSizeInBytes=t,this.sizeInBytes=0}append(t){const e=new qp(t);if(e.size>this.maxSizeInBytes)throw new Error(`[LinkedList] Value too big to insert into list: ${t} with size ${e.size}`);for(;this.size+e.size>this.maxSizeInBytes;)this.shift();this.head?(this.tail&&(this.tail.next=e),this.tail=e):(this.head=e,this.tail=e),this.lengthInNodes++,this.sizeInBytes+=e.size}shift(){if(!this.head)return;const t=this.head;this.head=this.head.next,this.head||(this.tail=null),this.lengthInNodes--,this.sizeInBytes-=t.size}toArray(){const t=[];let e=this.head;for(;e!==null;)t.push(e.value),e=e.next;return t}get length(){return this.lengthInNodes}get size(){return this.sizeInBytes}toOrderedArray(){return Array.from(this)}[Symbol.iterator](){let t=this.head;return{next:()=>{if(!t)return{done:!0,value:null};const e=t.value;return t=t.next,{done:!1,value:e}}}}};class hl{constructor(t,e=Ys){this.level=t??"error",this.levelValue=Er.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=e,this.logs=new jo(this.MAX_LOG_SIZE_IN_BYTES)}forwardToConsole(t,e){e===Er.levels.values.error?console.error(t):e===Er.levels.values.warn?console.warn(t):e===Er.levels.values.debug?console.debug(t):e===Er.levels.values.trace?console.trace(t):console.log(t)}appendToLogs(t){this.logs.append(rn({timestamp:new Date().toISOString(),log:t}));const e=typeof t=="string"?JSON.parse(t).level:t.level;e>=this.levelValue&&this.forwardToConsole(t,e)}getLogs(){return this.logs}clearLogs(){this.logs=new jo(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(t){const e=this.getLogArray();return e.push(rn({extraMetadata:t})),new Blob(e,{type:"application/json"})}}let Mp=class{constructor(t,e=Ys){this.baseChunkLogger=new hl(t,e)}write(t){this.baseChunkLogger.appendToLogs(t)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(t){return this.baseChunkLogger.logsToBlob(t)}downloadLogsBlobInBrowser(t){const e=URL.createObjectURL(this.logsToBlob(t)),n=document.createElement("a");n.href=e,n.download=`walletconnect-logs-${new Date().toISOString()}.txt`,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(e)}},Bp=class{constructor(t,e=Ys){this.baseChunkLogger=new hl(t,e)}write(t){this.baseChunkLogger.appendToLogs(t)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(t){return this.baseChunkLogger.logsToBlob(t)}};var jp=Object.defineProperty,zp=Object.defineProperties,Kp=Object.getOwnPropertyDescriptors,zo=Object.getOwnPropertySymbols,Fp=Object.prototype.hasOwnProperty,Wp=Object.prototype.propertyIsEnumerable,Ko=(r,t,e)=>t in r?jp(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Hn=(r,t)=>{for(var e in t||(t={}))Fp.call(t,e)&&Ko(r,e,t[e]);if(zo)for(var e of zo(t))Wp.call(t,e)&&Ko(r,e,t[e]);return r},Gn=(r,t)=>zp(r,Kp(t));function Qs(r){return Gn(Hn({},r),{level:(r==null?void 0:r.level)||Up.level})}function Hp(r,t=pn){return r[t]||""}function Gp(r,t,e=pn){return r[e]=t,r}function Ke(r,t=pn){let e="";return typeof r.bindings>"u"?e=Hp(r,t):e=r.bindings().context||"",e}function Jp(r,t,e=pn){const n=Ke(r,e);return n.trim()?`${n}/${t}`:t}function Ce(r,t,e=pn){const n=Jp(r,t,e),i=r.child({context:n});return Gp(i,n,e)}function Zp(r){var t,e;const n=new Mp((t=r.opts)==null?void 0:t.level,r.maxSizeInBytes);return{logger:oi(Gn(Hn({},r.opts),{level:"trace",browser:Gn(Hn({},(e=r.opts)==null?void 0:e.browser),{write:i=>n.write(i)})})),chunkLoggerController:n}}function Yp(r){var t;const e=new Bp((t=r.opts)==null?void 0:t.level,r.maxSizeInBytes);return{logger:oi(Gn(Hn({},r.opts),{level:"trace"}),e),chunkLoggerController:e}}function Qp(r){return typeof r.loggerOverride<"u"&&typeof r.loggerOverride!="string"?{logger:r.loggerOverride,chunkLoggerController:null}:typeof window<"u"?Zp(r):Yp(r)}var Xp=Object.defineProperty,e_=(r,t,e)=>t in r?Xp(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Fo=(r,t,e)=>e_(r,typeof t!="symbol"?t+"":t,e);class t_ extends Tr{constructor(t){super(),this.opts=t,Fo(this,"protocol","wc"),Fo(this,"version",2)}}var r_=Object.defineProperty,n_=(r,t,e)=>t in r?r_(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,i_=(r,t,e)=>n_(r,t+"",e);class s_ extends Tr{constructor(t,e){super(),this.core=t,this.logger=e,i_(this,"records",new Map)}}class o_{constructor(t,e){this.logger=t,this.core=e}}class a_ extends Tr{constructor(t,e){super(),this.relayer=t,this.logger=e}}let c_=class extends Tr{constructor(t){super()}},l_=class{constructor(t,e,n,i){this.core=t,this.logger=e,this.name=n}},u_=class extends Tr{constructor(t,e){super(),this.relayer=t,this.logger=e}};class d_ extends Tr{constructor(t,e){super(),this.core=t,this.logger=e}}let h_=class{constructor(t,e,n){this.core=t,this.logger=e,this.store=n}},p_=class{constructor(t,e){this.projectId=t,this.logger=e}},__=class{constructor(t,e,n){this.core=t,this.logger=e,this.telemetryEnabled=n}};var f_=Object.defineProperty,m_=(r,t,e)=>t in r?f_(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Wo=(r,t,e)=>m_(r,typeof t!="symbol"?t+"":t,e);let y_=class{constructor(t){this.opts=t,Wo(this,"protocol","wc"),Wo(this,"version",2)}},w_=class{constructor(t){this.client=t}};function nn(r,{strict:t=!0}={}){return!r||typeof r!="string"?!1:t?/^0x[0-9a-fA-F]*$/.test(r):r.startsWith("0x")}function ts(r){return nn(r,{strict:!1})?Math.ceil((r.length-2)/2):r.length}const pl="2.31.0";let Cr={getDocsUrl:({docsBaseUrl:r,docsPath:t="",docsSlug:e})=>t?`${r??"https://viem.sh"}${t}${e?`#${e}`:""}`:void 0,version:`viem@${pl}`};class or extends Error{constructor(t,e={}){var c;const n=(()=>{var l;return e.cause instanceof or?e.cause.details:(l=e.cause)!=null&&l.message?e.cause.message:e.details})(),i=e.cause instanceof or&&e.cause.docsPath||e.docsPath,s=(c=Cr.getDocsUrl)==null?void 0:c.call(Cr,{...e,docsPath:i}),o=[t||"An error occurred.","",...e.metaMessages?[...e.metaMessages,""]:[],...s?[`Docs: ${s}`]:[],...n?[`Details: ${n}`]:[],...Cr.version?[`Version: ${Cr.version}`]:[]].join(`
|
|
4
|
-
`);super(o,e.cause?{cause:e.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=i,this.metaMessages=e.metaMessages,this.name=e.name??this.name,this.shortMessage=t,this.version=pl}walk(t){return _l(this,t)}}function _l(r,t){return t!=null&&t(r)?r:r&&typeof r=="object"&&"cause"in r&&r.cause!==void 0?_l(r.cause,t):t?null:r}class fl extends or{constructor({size:t,targetSize:e,type:n}){super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} size (${t}) exceeds padding size (${e}).`,{name:"SizeExceedsPaddingSizeError"})}}function Rr(r,{dir:t,size:e=32}={}){return typeof r=="string"?g_(r,{dir:t,size:e}):E_(r,{dir:t,size:e})}function g_(r,{dir:t,size:e=32}={}){if(e===null)return r;const n=r.replace("0x","");if(n.length>e*2)throw new fl({size:Math.ceil(n.length/2),targetSize:e,type:"hex"});return`0x${n[t==="right"?"padEnd":"padStart"](e*2,"0")}`}function E_(r,{dir:t,size:e=32}={}){if(e===null)return r;if(r.length>e)throw new fl({size:r.length,targetSize:e,type:"bytes"});const n=new Uint8Array(e);for(let i=0;i<e;i++){const s=t==="right";n[s?i:e-i-1]=r[s?i:r.length-i-1]}return n}class v_ extends or{constructor({max:t,min:e,signed:n,size:i,value:s}){super(`Number "${s}" is not in safe ${i?`${i*8}-bit ${n?"signed":"unsigned"} `:""}integer range ${t?`(${e} to ${t})`:`(above ${e})`}`,{name:"IntegerOutOfRangeError"})}}class b_ extends or{constructor({givenSize:t,maxSize:e}){super(`Size cannot exceed ${e} bytes. Given size: ${t} bytes.`,{name:"SizeOverflowError"})}}function Lr(r,{size:t}){if(ts(r)>t)throw new b_({givenSize:ts(r),maxSize:t})}function rs(r,t={}){const{signed:e}=t;t.size&&Lr(r,{size:t.size});const n=BigInt(r);if(!e)return n;const i=(r.length-2)/2,s=(1n<<BigInt(i)*8n-1n)-1n;return n<=s?n:n-BigInt(`0x${"f".padStart(i*2,"f")}`)-1n}function I_(r,t={}){return Number(rs(r,t))}const A_=Array.from({length:256},(r,t)=>t.toString(16).padStart(2,"0"));function ns(r,t={}){return typeof r=="number"||typeof r=="bigint"?yl(r,t):typeof r=="string"?O_(r,t):typeof r=="boolean"?T_(r,t):ml(r,t)}function T_(r,t={}){const e=`0x${Number(r)}`;return typeof t.size=="number"?(Lr(e,{size:t.size}),Rr(e,{size:t.size})):e}function ml(r,t={}){let e="";for(let i=0;i<r.length;i++)e+=A_[r[i]];const n=`0x${e}`;return typeof t.size=="number"?(Lr(n,{size:t.size}),Rr(n,{dir:"right",size:t.size})):n}function yl(r,t={}){const{signed:e,size:n}=t,i=BigInt(r);let s;n?e?s=(1n<<BigInt(n)*8n-1n)-1n:s=2n**(BigInt(n)*8n)-1n:typeof r=="number"&&(s=BigInt(Number.MAX_SAFE_INTEGER));const o=typeof s=="bigint"&&e?-s-1n:0;if(s&&i>s||i<o){const l=typeof r=="bigint"?"n":"";throw new v_({max:s?`${s}${l}`:void 0,min:`${o}${l}`,signed:e,size:n,value:`${r}${l}`})}const c=`0x${(e&&i<0?(1n<<BigInt(n*8))+BigInt(i):i).toString(16)}`;return n?Rr(c,{size:n}):c}const P_=new TextEncoder;function O_(r,t={}){const e=P_.encode(r);return ml(e,t)}const R_=new TextEncoder;function L_(r,t={}){return typeof r=="number"||typeof r=="bigint"?V_(r,t):typeof r=="boolean"?D_(r,t):nn(r)?wl(r,t):gl(r,t)}function D_(r,t={}){const e=new Uint8Array(1);return e[0]=Number(r),typeof t.size=="number"?(Lr(e,{size:t.size}),Rr(e,{size:t.size})):e}const Et={zero:48,nine:57,A:65,F:70,a:97,f:102};function Ho(r){if(r>=Et.zero&&r<=Et.nine)return r-Et.zero;if(r>=Et.A&&r<=Et.F)return r-(Et.A-10);if(r>=Et.a&&r<=Et.f)return r-(Et.a-10)}function wl(r,t={}){let e=r;t.size&&(Lr(e,{size:t.size}),e=Rr(e,{dir:"right",size:t.size}));let n=e.slice(2);n.length%2&&(n=`0${n}`);const i=n.length/2,s=new Uint8Array(i);for(let o=0,c=0;o<i;o++){const l=Ho(n.charCodeAt(c++)),u=Ho(n.charCodeAt(c++));if(l===void 0||u===void 0)throw new or(`Invalid byte sequence ("${n[c-2]}${n[c-1]}" in "${n}").`);s[o]=l*16+u}return s}function V_(r,t){const e=yl(r,t);return wl(e)}function gl(r,t={}){const e=R_.encode(r);return typeof t.size=="number"?(Lr(e,{size:t.size}),Rr(e,{dir:"right",size:t.size})):e}const In=BigInt(2**32-1),Go=BigInt(32);function S_(r,t=!1){return t?{h:Number(r&In),l:Number(r>>Go&In)}:{h:Number(r>>Go&In)|0,l:Number(r&In)|0}}function x_(r,t=!1){const e=r.length;let n=new Uint32Array(e),i=new Uint32Array(e);for(let s=0;s<e;s++){const{h:o,l:c}=S_(r[s],t);[n[s],i[s]]=[o,c]}return[n,i]}const C_=(r,t,e)=>r<<e|t>>>32-e,$_=(r,t,e)=>t<<e|r>>>32-e,k_=(r,t,e)=>t<<e-32|r>>>64-e,N_=(r,t,e)=>r<<e-32|t>>>64-e,_r=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function U_(r){return r instanceof Uint8Array||ArrayBuffer.isView(r)&&r.constructor.name==="Uint8Array"}function Jn(r){if(!Number.isSafeInteger(r)||r<0)throw new Error("positive integer expected, got "+r)}function sn(r,...t){if(!U_(r))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(r.length))throw new Error("Uint8Array expected of length "+t+", got length="+r.length)}function tA(r){if(typeof r!="function"||typeof r.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");Jn(r.outputLen),Jn(r.blockLen)}function Jo(r,t=!0){if(r.destroyed)throw new Error("Hash instance has been destroyed");if(t&&r.finished)throw new Error("Hash#digest() has already been called")}function q_(r,t){sn(r);const e=t.outputLen;if(r.length<e)throw new Error("digestInto() expects output buffer of length at least "+e)}function M_(r){return new Uint32Array(r.buffer,r.byteOffset,Math.floor(r.byteLength/4))}function El(...r){for(let t=0;t<r.length;t++)r[t].fill(0)}function rA(r){return new DataView(r.buffer,r.byteOffset,r.byteLength)}function nA(r,t){return r<<32-t|r>>>t}const B_=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function j_(r){return r<<24&4278190080|r<<8&16711680|r>>>8&65280|r>>>24&255}function z_(r){for(let t=0;t<r.length;t++)r[t]=j_(r[t]);return r}const Zo=B_?r=>r:z_;function K_(r){if(typeof r!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(r))}function vl(r){return typeof r=="string"&&(r=K_(r)),sn(r),r}function iA(...r){let t=0;for(let n=0;n<r.length;n++){const i=r[n];sn(i),t+=i.length}const e=new Uint8Array(t);for(let n=0,i=0;n<r.length;n++){const s=r[n];e.set(s,i),i+=s.length}return e}class F_{}function W_(r){const t=n=>r().update(vl(n)).digest(),e=r();return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=()=>r(),t}function sA(r=32){if(_r&&typeof _r.getRandomValues=="function")return _r.getRandomValues(new Uint8Array(r));if(_r&&typeof _r.randomBytes=="function")return Uint8Array.from(_r.randomBytes(r));throw new Error("crypto.getRandomValues must be defined")}const H_=BigInt(0),$r=BigInt(1),G_=BigInt(2),J_=BigInt(7),Z_=BigInt(256),Y_=BigInt(113),bl=[],Il=[],Al=[];for(let r=0,t=$r,e=1,n=0;r<24;r++){[e,n]=[n,(2*e+3*n)%5],bl.push(2*(5*n+e)),Il.push((r+1)*(r+2)/2%64);let i=H_;for(let s=0;s<7;s++)t=(t<<$r^(t>>J_)*Y_)%Z_,t&G_&&(i^=$r<<($r<<BigInt(s))-$r);Al.push(i)}const Tl=x_(Al,!0),Q_=Tl[0],X_=Tl[1],Yo=(r,t,e)=>e>32?k_(r,t,e):C_(r,t,e),Qo=(r,t,e)=>e>32?N_(r,t,e):$_(r,t,e);function ef(r,t=24){const e=new Uint32Array(10);for(let n=24-t;n<24;n++){for(let o=0;o<10;o++)e[o]=r[o]^r[o+10]^r[o+20]^r[o+30]^r[o+40];for(let o=0;o<10;o+=2){const c=(o+8)%10,l=(o+2)%10,u=e[l],d=e[l+1],h=Yo(u,d,1)^e[c],p=Qo(u,d,1)^e[c+1];for(let _=0;_<50;_+=10)r[o+_]^=h,r[o+_+1]^=p}let i=r[2],s=r[3];for(let o=0;o<24;o++){const c=Il[o],l=Yo(i,s,c),u=Qo(i,s,c),d=bl[o];i=r[d],s=r[d+1],r[d]=l,r[d+1]=u}for(let o=0;o<50;o+=10){for(let c=0;c<10;c++)e[c]=r[o+c];for(let c=0;c<10;c++)r[o+c]^=~e[(c+2)%10]&e[(c+4)%10]}r[0]^=Q_[n],r[1]^=X_[n]}El(e)}class Xs extends F_{constructor(t,e,n,i=!1,s=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=t,this.suffix=e,this.outputLen=n,this.enableXOF=i,this.rounds=s,Jn(n),!(0<t&&t<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=M_(this.state)}clone(){return this._cloneInto()}keccak(){Zo(this.state32),ef(this.state32,this.rounds),Zo(this.state32),this.posOut=0,this.pos=0}update(t){Jo(this),t=vl(t),sn(t);const{blockLen:e,state:n}=this,i=t.length;for(let s=0;s<i;){const o=Math.min(e-this.pos,i-s);for(let c=0;c<o;c++)n[this.pos++]^=t[s++];this.pos===e&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:t,suffix:e,pos:n,blockLen:i}=this;t[n]^=e,(e&128)!==0&&n===i-1&&this.keccak(),t[i-1]^=128,this.keccak()}writeInto(t){Jo(this,!1),sn(t),this.finish();const e=this.state,{blockLen:n}=this;for(let i=0,s=t.length;i<s;){this.posOut>=n&&this.keccak();const o=Math.min(n-this.posOut,s-i);t.set(e.subarray(this.posOut,this.posOut+o),i),this.posOut+=o,i+=o}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return Jn(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(q_(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,El(this.state)}_cloneInto(t){const{blockLen:e,suffix:n,outputLen:i,rounds:s,enableXOF:o}=this;return t||(t=new Xs(e,n,i,o,s)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=s,t.suffix=n,t.outputLen=i,t.enableXOF=o,t.destroyed=this.destroyed,t}}const tf=(r,t,e)=>W_(()=>new Xs(t,r,e)),rf=tf(1,136,256/8);function Pl(r,t){const e=t||"hex",n=rf(nn(r,{strict:!1})?L_(r):r);return e==="bytes"?n:ns(n)}class nf extends Map{constructor(t){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=t}get(t){const e=super.get(t);return super.has(t)&&e!==void 0&&(this.delete(t),super.set(t,e)),e}set(t,e){if(super.set(t,e),this.maxSize&&this.size>this.maxSize){const n=this.keys().next().value;n&&this.delete(n)}return this}}const Ti=new nf(8192);function sf(r,t){if(Ti.has(`${r}.${t}`))return Ti.get(`${r}.${t}`);const e=r.substring(2).toLowerCase(),n=Pl(gl(e),"bytes"),i=e.split("");for(let o=0;o<40;o+=2)n[o>>1]>>4>=8&&i[o]&&(i[o]=i[o].toUpperCase()),(n[o>>1]&15)>=8&&i[o+1]&&(i[o+1]=i[o+1].toUpperCase());const s=`0x${i.join("")}`;return Ti.set(`${r}.${t}`,s),s}function of(r){const t=Pl(`0x${r.substring(4)}`).substring(26);return sf(`0x${t}`)}async function af({hash:r,signature:t}){const e=nn(r)?r:ns(r),{secp256k1:n}=await a(async()=>{const{secp256k1:o}=await import("./secp256k1-CgGDcudz.js");return{secp256k1:o}},__vite__mapDeps([25,1,2,3,4,5,6,7]));return`0x${(()=>{if(typeof t=="object"&&"r"in t&&"s"in t){const{r:u,s:d,v:h,yParity:p}=t,_=Number(p??h),f=Xo(_);return new n.Signature(rs(u),rs(d)).addRecoveryBit(f)}const o=nn(t)?t:ns(t);if(ts(o)!==65)throw new Error("invalid signature length");const c=I_(`0x${o.slice(130)}`),l=Xo(c);return n.Signature.fromCompact(o.substring(2,130)).addRecoveryBit(l)})().recoverPublicKey(e.substring(2)).toHex(!1)}`}function Xo(r){if(r===0||r===1)return r;if(r===27)return 0;if(r===28)return 1;throw new Error("Invalid yParityOrV value")}async function cf({hash:r,signature:t}){return of(await af({hash:r,signature:t}))}function lf(r){if(r.length>=255)throw new TypeError("Alphabet too long");const t=new Uint8Array(256);for(let u=0;u<t.length;u++)t[u]=255;for(let u=0;u<r.length;u++){const d=r.charAt(u),h=d.charCodeAt(0);if(t[h]!==255)throw new TypeError(d+" is ambiguous");t[h]=u}const e=r.length,n=r.charAt(0),i=Math.log(e)/Math.log(256),s=Math.log(256)/Math.log(e);function o(u){if(u instanceof Uint8Array||(ArrayBuffer.isView(u)?u=new Uint8Array(u.buffer,u.byteOffset,u.byteLength):Array.isArray(u)&&(u=Uint8Array.from(u))),!(u instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(u.length===0)return"";let d=0,h=0,p=0;const _=u.length;for(;p!==_&&u[p]===0;)p++,d++;const f=(_-p)*s+1>>>0,m=new Uint8Array(f);for(;p!==_;){let O=u[p],g=0;for(let P=f-1;(O!==0||g<h)&&P!==-1;P--,g++)O+=256*m[P]>>>0,m[P]=O%e>>>0,O=O/e>>>0;if(O!==0)throw new Error("Non-zero carry");h=g,p++}let y=f-h;for(;y!==f&&m[y]===0;)y++;let b=n.repeat(d);for(;y<f;++y)b+=r.charAt(m[y]);return b}function c(u){if(typeof u!="string")throw new TypeError("Expected String");if(u.length===0)return new Uint8Array;let d=0,h=0,p=0;for(;u[d]===n;)h++,d++;const _=(u.length-d)*i+1>>>0,f=new Uint8Array(_);for(;d<u.length;){const O=u.charCodeAt(d);if(O>255)return;let g=t[O];if(g===255)return;let P=0;for(let A=_-1;(g!==0||P<p)&&A!==-1;A--,P++)g+=e*f[A]>>>0,f[A]=g%256>>>0,g=g/256>>>0;if(g!==0)throw new Error("Non-zero carry");p=P,d++}let m=_-p;for(;m!==_&&f[m]===0;)m++;const y=new Uint8Array(h+(_-m));let b=h;for(;m!==_;)y[b++]=f[m++];return y}function l(u){const d=c(u);if(d)return d;throw new Error("Non-base"+e+" character")}return{encode:o,decodeUnsafe:c,decode:l}}var uf="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";const _n=lf(uf);var X={},df={};const hf=":";function xn(r){const[t,e]=r.split(hf);return{namespace:t,reference:e}}function Ol(r,t){return r.includes(":")?[r]:t.chains||[]}var pf=Object.defineProperty,_f=Object.defineProperties,ff=Object.getOwnPropertyDescriptors,ea=Object.getOwnPropertySymbols,mf=Object.prototype.hasOwnProperty,yf=Object.prototype.propertyIsEnumerable,is=(r,t,e)=>t in r?pf(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,ta=(r,t)=>{for(var e in t||(t={}))mf.call(t,e)&&is(r,e,t[e]);if(ea)for(var e of ea(t))yf.call(t,e)&&is(r,e,t[e]);return r},wf=(r,t)=>_f(r,ff(t)),ra=(r,t,e)=>is(r,typeof t!="symbol"?t+"":t,e);const gf="ReactNative",He={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},Ef="js";function Zn(){return typeof Kt<"u"&&typeof Kt.versions<"u"&&typeof Kt.versions.node<"u"}function Ht(){return!Rt.getDocument()&&!!Rt.getNavigator()&&navigator.product===gf}function vf(){return Ht()&&typeof X<"u"&&typeof(X==null?void 0:X.Platform)<"u"&&(X==null?void 0:X.Platform.OS)==="android"}function bf(){return Ht()&&typeof X<"u"&&typeof(X==null?void 0:X.Platform)<"u"&&(X==null?void 0:X.Platform.OS)==="ios"}function Dr(){return!Zn()&&!!Rt.getNavigator()&&!!Rt.getDocument()}function fn(){return Ht()?He.reactNative:Zn()?He.node:Dr()?He.browser:He.unknown}function na(){var r;try{return Ht()&&typeof X<"u"&&typeof(X==null?void 0:X.Application)<"u"?(r=X.Application)==null?void 0:r.applicationId:void 0}catch{return}}function If(r,t){const e=new URLSearchParams(r);for(const n of Object.keys(t).sort())if(t.hasOwnProperty(n)){const i=t[n];i!==void 0&&e.set(n,i)}return e.toString()}function Af(r){var t,e;const n=Rl();try{return r!=null&&r.url&&n.url&&new URL(r.url).host!==new URL(n.url).host&&(console.warn(`The configured WalletConnect 'metadata.url':${r.url} differs from the actual page url:${n.url}. This is probably unintended and can lead to issues.`),r.url=n.url),(t=r==null?void 0:r.icons)!=null&&t.length&&r.icons.length>0&&(r.icons=r.icons.filter(i=>i!=="")),wf(ta(ta({},n),r),{url:(r==null?void 0:r.url)||n.url,name:(r==null?void 0:r.name)||n.name,description:(r==null?void 0:r.description)||n.description,icons:(e=r==null?void 0:r.icons)!=null&&e.length&&r.icons.length>0?r.icons:n.icons})}catch(i){return console.warn("Error populating app metadata",i),r||n}}function Rl(){return Jd.getWindowMetadata()||{name:"",description:"",url:"",icons:[""]}}function Tf(){if(fn()===He.reactNative&&typeof X<"u"&&typeof(X==null?void 0:X.Platform)<"u"){const{OS:e,Version:n}=X.Platform;return[e,n].join("-")}const r=Yd();if(r===null)return"unknown";const t=r.os?r.os.replace(" ","").toLowerCase():"unknown";return r.type==="browser"?[t,r.name,r.version].join("-"):[t,r.version].join("-")}function Pf(){var r;const t=fn();return t===He.browser?[t,((r=Rt.getLocation())==null?void 0:r.host)||"unknown"].join(":"):t}function Ll(r,t,e){const n=Tf(),i=Pf();return[[r,t].join("-"),[Ef,e].join("-"),n,i].join("/")}function Of({protocol:r,version:t,relayUrl:e,sdkVersion:n,auth:i,projectId:s,useOnCloseEvent:o,bundleId:c,packageName:l}){const u=e.split("?"),d=Ll(r,t,n),h={auth:i,ua:d,projectId:s,useOnCloseEvent:o,packageName:l||void 0,bundleId:c||void 0},p=If(u[1]||"",h);return u[0]+"?"+p}function er(r,t){return r.filter(e=>t.includes(e)).length===r.length}function ss(r){return Object.fromEntries(r.entries())}function os(r){return new Map(Object.entries(r))}function Yt(r=q.FIVE_MINUTES,t){const e=q.toMiliseconds(r||q.FIVE_MINUTES);let n,i,s,o;return{resolve:c=>{s&&n&&(clearTimeout(s),n(c),o=Promise.resolve(c))},reject:c=>{s&&i&&(clearTimeout(s),i(c))},done:()=>new Promise((c,l)=>{if(o)return c(o);s=setTimeout(()=>{const u=new Error(t);o=Promise.reject(u),l(u)},e),n=c,i=l})}}function mt(r,t,e){return new Promise(async(n,i)=>{const s=setTimeout(()=>i(new Error(e)),t);try{const o=await r;n(o)}catch(o){i(o)}clearTimeout(s)})}function Dl(r,t){if(typeof t=="string"&&t.startsWith(`${r}:`))return t;if(r.toLowerCase()==="topic"){if(typeof t!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${t}`}else if(r.toLowerCase()==="id"){if(typeof t!="number")throw new Error('Value must be "number" for expirer target type: id');return`id:${t}`}throw new Error(`Unknown expirer target type: ${r}`)}function Rf(r){return Dl("topic",r)}function Lf(r){return Dl("id",r)}function Vl(r){const[t,e]=r.split(":"),n={id:void 0,topic:void 0};if(t==="topic"&&typeof e=="string")n.topic=e;else if(t==="id"&&Number.isInteger(Number(e)))n.id=Number(e);else throw new Error(`Invalid target, expected id:number or topic:string, got ${t}:${e}`);return n}function _e(r,t){return q.fromMiliseconds(Date.now()+q.toMiliseconds(r))}function qt(r){return Date.now()>=q.toMiliseconds(r)}function ee(r,t){return`${r}${t?`:${t}`:""}`}function ir(r=[],t=[]){return[...new Set([...r,...t])]}async function Df({id:r,topic:t,wcDeepLink:e}){var n;try{if(!e)return;const i=typeof e=="string"?JSON.parse(e):e,s=i==null?void 0:i.href;if(typeof s!="string")return;const o=Vf(s,r,t),c=fn();if(c===He.browser){if(!((n=Rt.getDocument())!=null&&n.hasFocus())){console.warn("Document does not have focus, skipping deeplink.");return}Sf(o)}else c===He.reactNative&&typeof(X==null?void 0:X.Linking)<"u"&&await X.Linking.openURL(o)}catch(i){console.error(i)}}function Vf(r,t,e){const n=`requestId=${t}&sessionTopic=${e}`;r.endsWith("/")&&(r=r.slice(0,-1));let i=`${r}`;if(r.startsWith("https://t.me")){const s=r.includes("?")?"&startapp=":"?startapp=";i=`${i}${s}${kf(n,!0)}`}else i=`${i}/wc?${n}`;return i}function Sf(r){let t="_self";$f()?t="_top":(Cf()||r.startsWith("https://")||r.startsWith("http://"))&&(t="_blank"),window.open(r,t,"noreferrer noopener")}async function xf(r,t){let e="";try{if(Dr()&&(e=localStorage.getItem(t),e))return e;e=await r.getItem(t)}catch(n){console.error(n)}return e}function ia(r,t){if(!r.includes(t))return null;const e=r.split(/([&,?,=])/),n=e.indexOf(t);return e[n+2]}function sa(){return typeof crypto<"u"&&crypto!=null&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu,r=>{const t=Math.random()*16|0;return(r==="x"?t:t&3|8).toString(16)})}function eo(){return typeof Kt<"u"&&df.IS_VITEST==="true"}function Cf(){return typeof window<"u"&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)}function $f(){try{return window.self!==window.top}catch{return!1}}function kf(r,t=!1){const e=re.from(r).toString("base64");return t?e.replace(/[=]/g,""):e}function Sl(r){return re.from(r,"base64").toString("utf-8")}function Nf(r){return new Promise(t=>setTimeout(t,r))}let Uf=class{constructor({limit:t}){ra(this,"limit"),ra(this,"set"),this.limit=t,this.set=new Set}add(t){if(!this.set.has(t)){if(this.set.size>=this.limit){const e=this.set.values().next().value;e&&this.set.delete(e)}this.set.add(t)}}has(t){return this.set.has(t)}};const An=BigInt(2**32-1),oa=BigInt(32);function xl(r,t=!1){return t?{h:Number(r&An),l:Number(r>>oa&An)}:{h:Number(r>>oa&An)|0,l:Number(r&An)|0}}function Cl(r,t=!1){const e=r.length;let n=new Uint32Array(e),i=new Uint32Array(e);for(let s=0;s<e;s++){const{h:o,l:c}=xl(r[s],t);[n[s],i[s]]=[o,c]}return[n,i]}const aa=(r,t,e)=>r>>>e,ca=(r,t,e)=>r<<32-e|t>>>e,Mt=(r,t,e)=>r>>>e|t<<32-e,Bt=(r,t,e)=>r<<32-e|t>>>e,Fr=(r,t,e)=>r<<64-e|t>>>e-32,Wr=(r,t,e)=>r>>>e-32|t<<64-e,qf=(r,t)=>t,Mf=(r,t)=>r,Bf=(r,t,e)=>r<<e|t>>>32-e,jf=(r,t,e)=>t<<e|r>>>32-e,zf=(r,t,e)=>t<<e-32|r>>>64-e,Kf=(r,t,e)=>r<<e-32|t>>>64-e;function ot(r,t,e,n){const i=(t>>>0)+(n>>>0);return{h:r+e+(i/2**32|0)|0,l:i|0}}const to=(r,t,e)=>(r>>>0)+(t>>>0)+(e>>>0),ro=(r,t,e,n)=>t+e+n+(r/2**32|0)|0,Ff=(r,t,e,n)=>(r>>>0)+(t>>>0)+(e>>>0)+(n>>>0),Wf=(r,t,e,n,i)=>t+e+n+i+(r/2**32|0)|0,Hf=(r,t,e,n,i)=>(r>>>0)+(t>>>0)+(e>>>0)+(n>>>0)+(i>>>0),Gf=(r,t,e,n,i,s)=>t+e+n+i+s+(r/2**32|0)|0,fr=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;function no(r){return r instanceof Uint8Array||ArrayBuffer.isView(r)&&r.constructor.name==="Uint8Array"}function Lt(r){if(!Number.isSafeInteger(r)||r<0)throw new Error("positive integer expected, got "+r)}function tt(r,...t){if(!no(r))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(r.length))throw new Error("Uint8Array expected of length "+t+", got length="+r.length)}function io(r){if(typeof r!="function"||typeof r.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");Lt(r.outputLen),Lt(r.blockLen)}function Wt(r,t=!0){if(r.destroyed)throw new Error("Hash instance has been destroyed");if(t&&r.finished)throw new Error("Hash#digest() has already been called")}function so(r,t){tt(r);const e=t.outputLen;if(r.length<e)throw new Error("digestInto() expects output buffer of length at least "+e)}function on(r){return new Uint32Array(r.buffer,r.byteOffset,Math.floor(r.byteLength/4))}function rt(...r){for(let t=0;t<r.length;t++)r[t].fill(0)}function Pi(r){return new DataView(r.buffer,r.byteOffset,r.byteLength)}function ut(r,t){return r<<32-t|r>>>t}const $l=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function kl(r){return r<<24&4278190080|r<<8&16711680|r>>>8&65280|r>>>24&255}const It=$l?r=>r:r=>kl(r);function Jf(r){for(let t=0;t<r.length;t++)r[t]=kl(r[t]);return r}const jt=$l?r=>r:Jf,Nl=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",Zf=Array.from({length:256},(r,t)=>t.toString(16).padStart(2,"0"));function an(r){if(tt(r),Nl)return r.toHex();let t="";for(let e=0;e<r.length;e++)t+=Zf[r[e]];return t}const vt={_0:48,_9:57,A:65,F:70,a:97,f:102};function la(r){if(r>=vt._0&&r<=vt._9)return r-vt._0;if(r>=vt.A&&r<=vt.F)return r-(vt.A-10);if(r>=vt.a&&r<=vt.f)return r-(vt.a-10)}function oo(r){if(typeof r!="string")throw new Error("hex string expected, got "+typeof r);if(Nl)return Uint8Array.fromHex(r);const t=r.length,e=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);const n=new Uint8Array(e);for(let i=0,s=0;i<e;i++,s+=2){const o=la(r.charCodeAt(s)),c=la(r.charCodeAt(s+1));if(o===void 0||c===void 0){const l=r[s]+r[s+1];throw new Error('hex string expected, got non-hex character "'+l+'" at index '+s)}n[i]=o*16+c}return n}function Yf(r){if(typeof r!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(r))}function ct(r){return typeof r=="string"&&(r=Yf(r)),tt(r),r}function tr(...r){let t=0;for(let n=0;n<r.length;n++){const i=r[n];tt(i),t+=i.length}const e=new Uint8Array(t);for(let n=0,i=0;n<r.length;n++){const s=r[n];e.set(s,i),i+=s.length}return e}class ai{}function mn(r){const t=n=>r().update(ct(n)).digest(),e=r();return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=()=>r(),t}function Qf(r){const t=(n,i)=>r(i).update(ct(n)).digest(),e=r({});return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=n=>r(n),t}function Vr(r=32){if(fr&&typeof fr.getRandomValues=="function")return fr.getRandomValues(new Uint8Array(r));if(fr&&typeof fr.randomBytes=="function")return Uint8Array.from(fr.randomBytes(r));throw new Error("crypto.getRandomValues must be defined")}const Xf=BigInt(0),kr=BigInt(1),em=BigInt(2),tm=BigInt(7),rm=BigInt(256),nm=BigInt(113),Ul=[],ql=[],Ml=[];for(let r=0,t=kr,e=1,n=0;r<24;r++){[e,n]=[n,(2*e+3*n)%5],Ul.push(2*(5*n+e)),ql.push((r+1)*(r+2)/2%64);let i=Xf;for(let s=0;s<7;s++)t=(t<<kr^(t>>tm)*nm)%rm,t&em&&(i^=kr<<(kr<<BigInt(s))-kr);Ml.push(i)}const Bl=Cl(Ml,!0),im=Bl[0],sm=Bl[1],ua=(r,t,e)=>e>32?zf(r,t,e):Bf(r,t,e),da=(r,t,e)=>e>32?Kf(r,t,e):jf(r,t,e);function om(r,t=24){const e=new Uint32Array(10);for(let n=24-t;n<24;n++){for(let o=0;o<10;o++)e[o]=r[o]^r[o+10]^r[o+20]^r[o+30]^r[o+40];for(let o=0;o<10;o+=2){const c=(o+8)%10,l=(o+2)%10,u=e[l],d=e[l+1],h=ua(u,d,1)^e[c],p=da(u,d,1)^e[c+1];for(let _=0;_<50;_+=10)r[o+_]^=h,r[o+_+1]^=p}let i=r[2],s=r[3];for(let o=0;o<24;o++){const c=ql[o],l=ua(i,s,c),u=da(i,s,c),d=Ul[o];i=r[d],s=r[d+1],r[d]=l,r[d+1]=u}for(let o=0;o<50;o+=10){for(let c=0;c<10;c++)e[c]=r[o+c];for(let c=0;c<10;c++)r[o+c]^=~e[(c+2)%10]&e[(c+4)%10]}r[0]^=im[n],r[1]^=sm[n]}rt(e)}let am=class jl extends ai{constructor(t,e,n,i=!1,s=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=t,this.suffix=e,this.outputLen=n,this.enableXOF=i,this.rounds=s,Lt(n),!(0<t&&t<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=on(this.state)}clone(){return this._cloneInto()}keccak(){jt(this.state32),om(this.state32,this.rounds),jt(this.state32),this.posOut=0,this.pos=0}update(t){Wt(this),t=ct(t),tt(t);const{blockLen:e,state:n}=this,i=t.length;for(let s=0;s<i;){const o=Math.min(e-this.pos,i-s);for(let c=0;c<o;c++)n[this.pos++]^=t[s++];this.pos===e&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:t,suffix:e,pos:n,blockLen:i}=this;t[n]^=e,(e&128)!==0&&n===i-1&&this.keccak(),t[i-1]^=128,this.keccak()}writeInto(t){Wt(this,!1),tt(t),this.finish();const e=this.state,{blockLen:n}=this;for(let i=0,s=t.length;i<s;){this.posOut>=n&&this.keccak();const o=Math.min(n-this.posOut,s-i);t.set(e.subarray(this.posOut,this.posOut+o),i),this.posOut+=o,i+=o}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return Lt(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(so(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,rt(this.state)}_cloneInto(t){const{blockLen:e,suffix:n,outputLen:i,rounds:s,enableXOF:o}=this;return t||(t=new jl(e,n,i,o,s)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=s,t.suffix=n,t.outputLen=i,t.enableXOF=o,t.destroyed=this.destroyed,t}};const cm=(r,t,e)=>mn(()=>new am(t,r,e)),lm=cm(1,136,256/8);function um(r,t,e,n){if(typeof r.setBigUint64=="function")return r.setBigUint64(t,e,n);const i=BigInt(32),s=BigInt(4294967295),o=Number(e>>i&s),c=Number(e&s),l=n?4:0,u=n?0:4;r.setUint32(t+l,o,n),r.setUint32(t+u,c,n)}function dm(r,t,e){return r&t^~r&e}function hm(r,t,e){return r&t^r&e^t&e}let zl=class extends ai{constructor(t,e,n,i){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=t,this.outputLen=e,this.padOffset=n,this.isLE=i,this.buffer=new Uint8Array(t),this.view=Pi(this.buffer)}update(t){Wt(this),t=ct(t),tt(t);const{view:e,buffer:n,blockLen:i}=this,s=t.length;for(let o=0;o<s;){const c=Math.min(i-this.pos,s-o);if(c===i){const l=Pi(t);for(;i<=s-o;o+=i)this.process(l,o);continue}n.set(t.subarray(o,o+c),this.pos),this.pos+=c,o+=c,this.pos===i&&(this.process(e,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){Wt(this),so(t,this),this.finished=!0;const{buffer:e,view:n,blockLen:i,isLE:s}=this;let{pos:o}=this;e[o++]=128,rt(this.buffer.subarray(o)),this.padOffset>i-o&&(this.process(n,0),o=0);for(let h=o;h<i;h++)e[h]=0;um(n,i-8,BigInt(this.length*8),s),this.process(n,0);const c=Pi(t),l=this.outputLen;if(l%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const u=l/4,d=this.get();if(u>d.length)throw new Error("_sha2: outputLen bigger than state");for(let h=0;h<u;h++)c.setUint32(4*h,d[h],s)}digest(){const{buffer:t,outputLen:e}=this;this.digestInto(t);const n=t.slice(0,e);return this.destroy(),n}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:e,buffer:n,length:i,finished:s,destroyed:o,pos:c}=this;return t.destroyed=o,t.finished=s,t.length=i,t.pos=c,i%e&&t.buffer.set(n),t}clone(){return this._cloneInto()}};const Vt=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Te=Uint32Array.from([3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]),Pe=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209]),pm=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]),St=new Uint32Array(64);let _m=class extends zl{constructor(t=32){super(64,t,8,!1),this.A=Vt[0]|0,this.B=Vt[1]|0,this.C=Vt[2]|0,this.D=Vt[3]|0,this.E=Vt[4]|0,this.F=Vt[5]|0,this.G=Vt[6]|0,this.H=Vt[7]|0}get(){const{A:t,B:e,C:n,D:i,E:s,F:o,G:c,H:l}=this;return[t,e,n,i,s,o,c,l]}set(t,e,n,i,s,o,c,l){this.A=t|0,this.B=e|0,this.C=n|0,this.D=i|0,this.E=s|0,this.F=o|0,this.G=c|0,this.H=l|0}process(t,e){for(let h=0;h<16;h++,e+=4)St[h]=t.getUint32(e,!1);for(let h=16;h<64;h++){const p=St[h-15],_=St[h-2],f=ut(p,7)^ut(p,18)^p>>>3,m=ut(_,17)^ut(_,19)^_>>>10;St[h]=m+St[h-7]+f+St[h-16]|0}let{A:n,B:i,C:s,D:o,E:c,F:l,G:u,H:d}=this;for(let h=0;h<64;h++){const p=ut(c,6)^ut(c,11)^ut(c,25),_=d+p+dm(c,l,u)+pm[h]+St[h]|0,f=(ut(n,2)^ut(n,13)^ut(n,22))+hm(n,i,s)|0;d=u,u=l,l=c,c=o+_|0,o=s,s=i,i=n,n=_+f|0}n=n+this.A|0,i=i+this.B|0,s=s+this.C|0,o=o+this.D|0,c=c+this.E|0,l=l+this.F|0,u=u+this.G|0,d=d+this.H|0,this.set(n,i,s,o,c,l,u,d)}roundClean(){rt(St)}destroy(){this.set(0,0,0,0,0,0,0,0),rt(this.buffer)}};const Kl=Cl(["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","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(r=>BigInt(r))),fm=Kl[0],mm=Kl[1],xt=new Uint32Array(80),Ct=new Uint32Array(80);let ao=class extends zl{constructor(t=64){super(128,t,16,!1),this.Ah=Pe[0]|0,this.Al=Pe[1]|0,this.Bh=Pe[2]|0,this.Bl=Pe[3]|0,this.Ch=Pe[4]|0,this.Cl=Pe[5]|0,this.Dh=Pe[6]|0,this.Dl=Pe[7]|0,this.Eh=Pe[8]|0,this.El=Pe[9]|0,this.Fh=Pe[10]|0,this.Fl=Pe[11]|0,this.Gh=Pe[12]|0,this.Gl=Pe[13]|0,this.Hh=Pe[14]|0,this.Hl=Pe[15]|0}get(){const{Ah:t,Al:e,Bh:n,Bl:i,Ch:s,Cl:o,Dh:c,Dl:l,Eh:u,El:d,Fh:h,Fl:p,Gh:_,Gl:f,Hh:m,Hl:y}=this;return[t,e,n,i,s,o,c,l,u,d,h,p,_,f,m,y]}set(t,e,n,i,s,o,c,l,u,d,h,p,_,f,m,y){this.Ah=t|0,this.Al=e|0,this.Bh=n|0,this.Bl=i|0,this.Ch=s|0,this.Cl=o|0,this.Dh=c|0,this.Dl=l|0,this.Eh=u|0,this.El=d|0,this.Fh=h|0,this.Fl=p|0,this.Gh=_|0,this.Gl=f|0,this.Hh=m|0,this.Hl=y|0}process(t,e){for(let g=0;g<16;g++,e+=4)xt[g]=t.getUint32(e),Ct[g]=t.getUint32(e+=4);for(let g=16;g<80;g++){const P=xt[g-15]|0,A=Ct[g-15]|0,E=Mt(P,A,1)^Mt(P,A,8)^aa(P,A,7),D=Bt(P,A,1)^Bt(P,A,8)^ca(P,A,7),L=xt[g-2]|0,w=Ct[g-2]|0,v=Mt(L,w,19)^Fr(L,w,61)^aa(L,w,6),I=Bt(L,w,19)^Wr(L,w,61)^ca(L,w,6),T=Ff(D,I,Ct[g-7],Ct[g-16]),V=Wf(T,E,v,xt[g-7],xt[g-16]);xt[g]=V|0,Ct[g]=T|0}let{Ah:n,Al:i,Bh:s,Bl:o,Ch:c,Cl:l,Dh:u,Dl:d,Eh:h,El:p,Fh:_,Fl:f,Gh:m,Gl:y,Hh:b,Hl:O}=this;for(let g=0;g<80;g++){const P=Mt(h,p,14)^Mt(h,p,18)^Fr(h,p,41),A=Bt(h,p,14)^Bt(h,p,18)^Wr(h,p,41),E=h&_^~h&m,D=p&f^~p&y,L=Hf(O,A,D,mm[g],Ct[g]),w=Gf(L,b,P,E,fm[g],xt[g]),v=L|0,I=Mt(n,i,28)^Fr(n,i,34)^Fr(n,i,39),T=Bt(n,i,28)^Wr(n,i,34)^Wr(n,i,39),V=n&s^n&c^s&c,R=i&o^i&l^o&l;b=m|0,O=y|0,m=_|0,y=f|0,_=h|0,f=p|0,{h,l:p}=ot(u|0,d|0,w|0,v|0),u=c|0,d=l|0,c=s|0,l=o|0,s=n|0,o=i|0;const S=to(v,T,R);n=ro(S,w,I,V),i=S|0}({h:n,l:i}=ot(this.Ah|0,this.Al|0,n|0,i|0)),{h:s,l:o}=ot(this.Bh|0,this.Bl|0,s|0,o|0),{h:c,l}=ot(this.Ch|0,this.Cl|0,c|0,l|0),{h:u,l:d}=ot(this.Dh|0,this.Dl|0,u|0,d|0),{h,l:p}=ot(this.Eh|0,this.El|0,h|0,p|0),{h:_,l:f}=ot(this.Fh|0,this.Fl|0,_|0,f|0),{h:m,l:y}=ot(this.Gh|0,this.Gl|0,m|0,y|0),{h:b,l:O}=ot(this.Hh|0,this.Hl|0,b|0,O|0),this.set(n,i,s,o,c,l,u,d,h,p,_,f,m,y,b,O)}roundClean(){rt(xt,Ct)}destroy(){rt(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}},ym=class extends ao{constructor(){super(48),this.Ah=Te[0]|0,this.Al=Te[1]|0,this.Bh=Te[2]|0,this.Bl=Te[3]|0,this.Ch=Te[4]|0,this.Cl=Te[5]|0,this.Dh=Te[6]|0,this.Dl=Te[7]|0,this.Eh=Te[8]|0,this.El=Te[9]|0,this.Fh=Te[10]|0,this.Fl=Te[11]|0,this.Gh=Te[12]|0,this.Gl=Te[13]|0,this.Hh=Te[14]|0,this.Hl=Te[15]|0}};const Oe=Uint32Array.from([573645204,4230739756,2673172387,3360449730,596883563,1867755857,2520282905,1497426621,2519219938,2827943907,3193839141,1401305490,721525244,746961066,246885852,2177182882]);class wm extends ao{constructor(){super(32),this.Ah=Oe[0]|0,this.Al=Oe[1]|0,this.Bh=Oe[2]|0,this.Bl=Oe[3]|0,this.Ch=Oe[4]|0,this.Cl=Oe[5]|0,this.Dh=Oe[6]|0,this.Dl=Oe[7]|0,this.Eh=Oe[8]|0,this.El=Oe[9]|0,this.Fh=Oe[10]|0,this.Fl=Oe[11]|0,this.Gh=Oe[12]|0,this.Gl=Oe[13]|0,this.Hh=Oe[14]|0,this.Hl=Oe[15]|0}}const ci=mn(()=>new _m),gm=mn(()=>new ao),Em=mn(()=>new ym),vm=mn(()=>new wm),bm=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]),pe=Uint32Array.from([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),B=new Uint32Array(32);function $t(r,t,e,n,i,s){const o=i[s],c=i[s+1];let l=B[2*r],u=B[2*r+1],d=B[2*t],h=B[2*t+1],p=B[2*e],_=B[2*e+1],f=B[2*n],m=B[2*n+1],y=to(l,d,o);u=ro(y,u,h,c),l=y|0,{Dh:m,Dl:f}={Dh:m^u,Dl:f^l},{Dh:m,Dl:f}={Dh:qf(m,f),Dl:Mf(m)},{h:_,l:p}=ot(_,p,m,f),{Bh:h,Bl:d}={Bh:h^_,Bl:d^p},{Bh:h,Bl:d}={Bh:Mt(h,d,24),Bl:Bt(h,d,24)},B[2*r]=l,B[2*r+1]=u,B[2*t]=d,B[2*t+1]=h,B[2*e]=p,B[2*e+1]=_,B[2*n]=f,B[2*n+1]=m}function kt(r,t,e,n,i,s){const o=i[s],c=i[s+1];let l=B[2*r],u=B[2*r+1],d=B[2*t],h=B[2*t+1],p=B[2*e],_=B[2*e+1],f=B[2*n],m=B[2*n+1],y=to(l,d,o);u=ro(y,u,h,c),l=y|0,{Dh:m,Dl:f}={Dh:m^u,Dl:f^l},{Dh:m,Dl:f}={Dh:Mt(m,f,16),Dl:Bt(m,f,16)},{h:_,l:p}=ot(_,p,m,f),{Bh:h,Bl:d}={Bh:h^_,Bl:d^p},{Bh:h,Bl:d}={Bh:Fr(h,d,63),Bl:Wr(h,d,63)},B[2*r]=l,B[2*r+1]=u,B[2*t]=d,B[2*t+1]=h,B[2*e]=p,B[2*e+1]=_,B[2*n]=f,B[2*n+1]=m}function Im(r,t={},e,n,i){if(Lt(e),r<0||r>e)throw new Error("outputLen bigger than keyLen");const{key:s,salt:o,personalization:c}=t;if(s!==void 0&&(s.length<1||s.length>e))throw new Error("key length must be undefined or 1.."+e);if(o!==void 0&&o.length!==n)throw new Error("salt must be undefined or "+n);if(c!==void 0&&c.length!==i)throw new Error("personalization must be undefined or "+i)}class Am extends ai{constructor(t,e){super(),this.finished=!1,this.destroyed=!1,this.length=0,this.pos=0,Lt(t),Lt(e),this.blockLen=t,this.outputLen=e,this.buffer=new Uint8Array(t),this.buffer32=on(this.buffer)}update(t){Wt(this),t=ct(t),tt(t);const{blockLen:e,buffer:n,buffer32:i}=this,s=t.length,o=t.byteOffset,c=t.buffer;for(let l=0;l<s;){this.pos===e&&(jt(i),this.compress(i,0,!1),jt(i),this.pos=0);const u=Math.min(e-this.pos,s-l),d=o+l;if(u===e&&!(d%4)&&l+u<s){const h=new Uint32Array(c,d,Math.floor((s-l)/4));jt(h);for(let p=0;l+e<s;p+=i.length,l+=e)this.length+=e,this.compress(h,p,!1);jt(h);continue}n.set(t.subarray(l,l+u),this.pos),this.pos+=u,this.length+=u,l+=u}return this}digestInto(t){Wt(this),so(t,this);const{pos:e,buffer32:n}=this;this.finished=!0,rt(this.buffer.subarray(e)),jt(n),this.compress(n,0,!0),jt(n);const i=on(t);this.get().forEach((s,o)=>i[o]=It(s))}digest(){const{buffer:t,outputLen:e}=this;this.digestInto(t);const n=t.slice(0,e);return this.destroy(),n}_cloneInto(t){const{buffer:e,length:n,finished:i,destroyed:s,outputLen:o,pos:c}=this;return t||(t=new this.constructor({dkLen:o})),t.set(...this.get()),t.buffer.set(e),t.destroyed=s,t.finished=i,t.length=n,t.pos=c,t.outputLen=o,t}clone(){return this._cloneInto()}}class Tm extends Am{constructor(t={}){const e=t.dkLen===void 0?64:t.dkLen;super(128,e),this.v0l=pe[0]|0,this.v0h=pe[1]|0,this.v1l=pe[2]|0,this.v1h=pe[3]|0,this.v2l=pe[4]|0,this.v2h=pe[5]|0,this.v3l=pe[6]|0,this.v3h=pe[7]|0,this.v4l=pe[8]|0,this.v4h=pe[9]|0,this.v5l=pe[10]|0,this.v5h=pe[11]|0,this.v6l=pe[12]|0,this.v6h=pe[13]|0,this.v7l=pe[14]|0,this.v7h=pe[15]|0,Im(e,t,64,16,16);let{key:n,personalization:i,salt:s}=t,o=0;if(n!==void 0&&(n=ct(n),o=n.length),this.v0l^=this.outputLen|o<<8|65536|1<<24,s!==void 0){s=ct(s);const c=on(s);this.v4l^=It(c[0]),this.v4h^=It(c[1]),this.v5l^=It(c[2]),this.v5h^=It(c[3])}if(i!==void 0){i=ct(i);const c=on(i);this.v6l^=It(c[0]),this.v6h^=It(c[1]),this.v7l^=It(c[2]),this.v7h^=It(c[3])}if(n!==void 0){const c=new Uint8Array(this.blockLen);c.set(n),this.update(c)}}get(){let{v0l:t,v0h:e,v1l:n,v1h:i,v2l:s,v2h:o,v3l:c,v3h:l,v4l:u,v4h:d,v5l:h,v5h:p,v6l:_,v6h:f,v7l:m,v7h:y}=this;return[t,e,n,i,s,o,c,l,u,d,h,p,_,f,m,y]}set(t,e,n,i,s,o,c,l,u,d,h,p,_,f,m,y){this.v0l=t|0,this.v0h=e|0,this.v1l=n|0,this.v1h=i|0,this.v2l=s|0,this.v2h=o|0,this.v3l=c|0,this.v3h=l|0,this.v4l=u|0,this.v4h=d|0,this.v5l=h|0,this.v5h=p|0,this.v6l=_|0,this.v6h=f|0,this.v7l=m|0,this.v7h=y|0}compress(t,e,n){this.get().forEach((l,u)=>B[u]=l),B.set(pe,16);let{h:i,l:s}=xl(BigInt(this.length));B[24]=pe[8]^s,B[25]=pe[9]^i,n&&(B[28]=~B[28],B[29]=~B[29]);let o=0;const c=bm;for(let l=0;l<12;l++)$t(0,4,8,12,t,e+2*c[o++]),kt(0,4,8,12,t,e+2*c[o++]),$t(1,5,9,13,t,e+2*c[o++]),kt(1,5,9,13,t,e+2*c[o++]),$t(2,6,10,14,t,e+2*c[o++]),kt(2,6,10,14,t,e+2*c[o++]),$t(3,7,11,15,t,e+2*c[o++]),kt(3,7,11,15,t,e+2*c[o++]),$t(0,5,10,15,t,e+2*c[o++]),kt(0,5,10,15,t,e+2*c[o++]),$t(1,6,11,12,t,e+2*c[o++]),kt(1,6,11,12,t,e+2*c[o++]),$t(2,7,8,13,t,e+2*c[o++]),kt(2,7,8,13,t,e+2*c[o++]),$t(3,4,9,14,t,e+2*c[o++]),kt(3,4,9,14,t,e+2*c[o++]);this.v0l^=B[0]^B[16],this.v0h^=B[1]^B[17],this.v1l^=B[2]^B[18],this.v1h^=B[3]^B[19],this.v2l^=B[4]^B[20],this.v2h^=B[5]^B[21],this.v3l^=B[6]^B[22],this.v3h^=B[7]^B[23],this.v4l^=B[8]^B[24],this.v4h^=B[9]^B[25],this.v5l^=B[10]^B[26],this.v5h^=B[11]^B[27],this.v6l^=B[12]^B[28],this.v6h^=B[13]^B[29],this.v7l^=B[14]^B[30],this.v7h^=B[15]^B[31],rt(B)}destroy(){this.destroyed=!0,rt(this.buffer32),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const Pm=Qf(r=>new Tm(r)),Om="https://rpc.walletconnect.org/v1";function Fl(r){const t=`Ethereum Signed Message:
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/get-ecosystem-wallet-info-Dy07hdCI.js","assets/signing-CBJKy3lp.js","assets/utils-CSELsIOA.js","assets/index-ck0-AGvi.js","assets/index--i8cFVe-.css","assets/hashTypedData-BcqP-VKp.js","assets/index.es-GZOcqfUt.js","assets/ethereum-CEtGPAUd.js","assets/index-yCStn-Jf.js","assets/hooks.module-2VF1s86u.js","assets/transactionReceipt-CIDOJhxr.js","assets/sha256-B6qHgPJw.js","assets/parseSignature-BF7SmcrH.js","assets/rpc-Ab24KkZg.js","assets/sha256-BkDJVsVC.js","assets/hmac-iNLmz6XQ.js","assets/index-B-V1pT7O.js","assets/web-connector-BSznc5-3.js","assets/sleep-mAKpSMLY.js","assets/index-BqbPuN49.js","assets/send-eip712-transaction-B2xYx25b.js","assets/controller-ChEtySr4.js","assets/qr-overlay-KOiqNJ7X.js","assets/getBalance-DsI9g0TY.js","assets/decimals-Bg-x-yWm.js","assets/secp256k1-b-PbPirG.js","assets/session-proposal-BnHJBpnN.js","assets/session-request-oxggTqvw.js","assets/in-app-wallet-calls-Bdrxdgac.js","assets/wait-for-tx-receipt-rcWke49s.js","assets/send-batch-transaction-BgxJyMqO.js","assets/eth_getTransactionCount-qsl0Cr9u.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{u as ri,cf as nd,cg as id,ch as sd,ci as Rc,cj as od,g as Z,ck as ad,cl as tn,cm as Lc,a as sr,h as Ve,x as vo,w as cd,n as De,o as qn,j as we,cn as Dc,co as Vc,cp as Sc,k as xs,l as Cs,ai as ld,b as $s,ae as ud,C as dd,cq as xc,aM as hd,cr as pd,am as _d,an as fd,cs as md,m as ni,az as yd,aW as Gi,v as Cc,ct as ks,cu as $c,aK as wd,V as Ns,cv as kc,aV as bo,cw as gd,W as Ed,aB as Io,aP as vd,aa as bd,cx as Ao,aw as Nc,ay as Id,E as Ad,cy as Jt,ab as Td,t as Pd,H as Od,cz as Rd,aT as Ld,b8 as Dd}from"./signing-CBJKy3lp.js";import{f as Vd,k as Uc,l as lr,a as ge,j as Us,w as qc,e as ii,m as Sd,n as xd,o as Cd,d as $d,c as hn,p as kd}from"./utils-CSELsIOA.js";import{b as Kt,_ as a,g as Nd,i as et,t as ze,B as re,j as Gr,e as ur,k as Mc}from"./index-ck0-AGvi.js";import{g as Ud,v as qd,s as Md,w as Bd,p as jd}from"./hashTypedData-BcqP-VKp.js";import{d as En,b as Mn,s as rn,e as zd,g as Kd,k as Fd,h as Wd,j as Hd,l as To,r as Gd,I as Tr,m as Jd,n as q,q as Rt,C as Zd,t as Yd,u as Ji,v as Qd,w as Xd,x as eh,y as th,a as Ut,z as Pr,o as rh,A as nh,B as qs,D as Ms,f as Bn,P as Po,Q as ih,E as sh,F as Xt,c as Bc,G as bt,H as _t,J as Dt}from"./index.es-GZOcqfUt.js";import{e as oh}from"./ethereum-CEtGPAUd.js";function ah(r=32){return ri(ch(r))}function ch(r=32){return globalThis.crypto.getRandomValues(new Uint8Array(r))}/*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) */function lh(r){return r instanceof Uint8Array||ArrayBuffer.isView(r)&&r.constructor.name==="Uint8Array"}function jc(r,t){return Array.isArray(t)?t.length===0?!0:r?t.every(e=>typeof e=="string"):t.every(e=>Number.isSafeInteger(e)):!1}function jn(r,t){if(typeof t!="string")throw new Error(`${r}: string expected`);return!0}function Bs(r){if(!Number.isSafeInteger(r))throw new Error(`invalid integer: ${r}`)}function Zi(r){if(!Array.isArray(r))throw new Error("array expected")}function zn(r,t){if(!jc(!0,t))throw new Error(`${r}: array of strings expected`)}function uh(r,t){if(!jc(!1,t))throw new Error(`${r}: array of numbers expected`)}function dh(...r){const t=s=>s,e=(s,o)=>c=>s(o(c)),n=r.map(s=>s.encode).reduceRight(e,t),i=r.map(s=>s.decode).reduce(e,t);return{encode:n,decode:i}}function hh(r){const t=typeof r=="string"?r.split(""):r,e=t.length;zn("alphabet",t);const n=new Map(t.map((i,s)=>[i,s]));return{encode:i=>(Zi(i),i.map(s=>{if(!Number.isSafeInteger(s)||s<0||s>=e)throw new Error(`alphabet.encode: digit index outside alphabet "${s}". Allowed: ${r}`);return t[s]})),decode:i=>(Zi(i),i.map(s=>{jn("alphabet.decode",s);const o=n.get(s);if(o===void 0)throw new Error(`Unknown letter: "${s}". Allowed: ${r}`);return o}))}}function ph(r=""){return jn("join",r),{encode:t=>(zn("join.decode",t),t.join(r)),decode:t=>(jn("join.decode",t),t.split(r))}}function _h(r,t="="){return Bs(r),jn("padding",t),{encode(e){for(zn("padding.encode",e);e.length*r%8;)e.push(t);return e},decode(e){zn("padding.decode",e);let n=e.length;if(n*r%8)throw new Error("padding: invalid, string should have whole number of bytes");for(;n>0&&e[n-1]===t;n--)if((n-1)*r%8===0)throw new Error("padding: invalid, string has too much padding");return e.slice(0,n)}}}const zc=(r,t)=>t===0?r:zc(t,r%t),Kn=(r,t)=>r+(t-zc(r,t)),wi=(()=>{let r=[];for(let t=0;t<40;t++)r.push(2**t);return r})();function Oo(r,t,e,n){if(Zi(r),t<=0||t>32)throw new Error(`convertRadix2: wrong from=${t}`);if(e<=0||e>32)throw new Error(`convertRadix2: wrong to=${e}`);if(Kn(t,e)>32)throw new Error(`convertRadix2: carry overflow from=${t} to=${e} carryBits=${Kn(t,e)}`);let i=0,s=0;const o=wi[t],c=wi[e]-1,l=[];for(const u of r){if(Bs(u),u>=o)throw new Error(`convertRadix2: invalid data word=${u} from=${t}`);if(i=i<<t|u,s+t>32)throw new Error(`convertRadix2: carry overflow pos=${s} from=${t}`);for(s+=t;s>=e;s-=e)l.push((i>>s-e&c)>>>0);const d=wi[s];if(d===void 0)throw new Error("invalid carry");i&=d-1}if(i=i<<e-s&c,!n&&s>=t)throw new Error("Excess padding");if(!n&&i>0)throw new Error(`Non-zero padding: ${i}`);return n&&s>0&&l.push(i>>>0),l}function fh(r,t=!1){if(Bs(r),r<=0||r>32)throw new Error("radix2: bits should be in (0..32]");if(Kn(8,r)>32||Kn(r,8)>32)throw new Error("radix2: carry overflow");return{encode:e=>{if(!lh(e))throw new Error("radix2.encode input should be Uint8Array");return Oo(Array.from(e),8,r,!t)},decode:e=>(uh("radix2.decode",e),Uint8Array.from(Oo(e,r,8,t)))}}const mh=dh(fh(5),hh("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"),_h(5),ph(""));function yh(r){const t=id(r);return sd("0x19",Rc(`Ethereum Signed Message:
|
|
3
|
+
`+od(t)),t)}function wh(r){return nd(yh(r))}const qI="0xfffffffffffffffffffffffffffffff0000000000000000000000000000000007aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1c",gh="0x85e23b94e7F5E9cC1fF78BCe78cfb15B81f0DF00",Eh="0x4be0ddfebca9a5a4a617dee4dece99e7c862dceb",si="0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789",vh="0x0000000071727De22E5E9d8BAf0edAc6f37da032",bh=50000n,Ih=r=>Ah(r||si)==="v0.7"?Eh:gh,Kc=r=>{const t=Vd().bundler;return t.startsWith("localhost:")?`http://${t}/v2?chain=${r.id}`:`https://${r.id}.${t}/v2`},Ah=r=>{const t=Z(r);if(t===si)return"v0.6";if(t===vh)return"v0.7";throw new Error("Unknown paymaster version")};async function Be(r){const{client:t,ecosystem:e,walletType:n,walletAddress:i,chainId:s}=r;return ad({client:t,data:{action:"connect",chainId:s,source:"connectWallet",walletAddress:i,walletType:n},ecosystem:e})}function js(r){const t=r.domain;return(t==null?void 0:t.chainId)!==void 0&&tn(t.chainId)&&(r.domain={...r.domain,chainId:Lc(r.domain.chainId)}),r}const Th={"0x0":"reverted","0x1":"success"};function zs(r){var n;const[t,e]=(()=>{const i=r.status;return i>=100&&i<200?["pending",i]:i>=200&&i<300?["success",i]:i>=300&&i<700?["failure",i]:i==="CONFIRMED"?["success",200]:i==="PENDING"?["pending",100]:[void 0,i]})();return{...r,atomic:r.atomic,chainId:r.chainId?sr(r.chainId):void 0,receipts:((n=r.receipts)==null?void 0:n.map(i=>({...i,blockNumber:Ve(i.blockNumber),gasUsed:Ve(i.gasUsed),status:Th[i.status]})))??[],status:t,statusCode:e,version:r.version}}function Ks(r,t){const e={};for(const[n,i]of Object.entries(r)){e[Number(n)]={};const s={};for(const[o,c]of Object.entries(i))s[o]=c;e[Number(n)]=s}return typeof t=="number"?{[t]:e[t]}:e}async function Fs(r,t){const e=r.calls[0];if(!e)throw new Error("No calls to send");const{calls:n,capabilities:i,version:s="2.0.0",chain:o=e.chain}=r,c=await Promise.all(n.map(async u=>{const{to:d,value:h}=u;if(d===void 0&&u.data===void 0)throw new Error("Cannot send call, `to` or `data` must be provided.");const[p,_,f]=await Promise.all([vo(d),cd(u),vo(h)]);return p?{data:_,to:Z(p),value:typeof f=="bigint"||typeof f=="number"?De(f):void 0}:{data:_,to:void 0,value:void 0}}));return{callParams:[{atomicRequired:r.atomicRequired??!1,calls:c,capabilities:i,chainId:De(o.id),from:Z(t.address),version:s}],chain:o}}function Ws(r){return Ph(r).map(t=>{try{const e=new URL(t);return e.hostname.endsWith(".thirdweb.com")&&(e.pathname="",e.search=""),e.toString()}catch{return t}})}function Ph(r,t,e="http"){const n=[];for(const i of r.rpc)e==="http"&&!i.startsWith("http")||e==="ws"&&!i.startsWith("ws")||(i.includes("${THIRDWEB_API_KEY}")?n.push(i.replace("${THIRDWEB_API_KEY}","")):i.includes("${")||n.push(i));if(n.length===0)throw new Error(`No RPC available for chainId "${r.chainId}" with mode ${e}`);return n}function lt(r){return typeof r=="number"?r:qn(r)?sr(r):typeof r=="bigint"?Number(r):Number.parseInt(r,10)}function Oh(r){if(typeof window>"u")return;const t=e=>r(e.detail);return window.addEventListener("eip6963:announceProvider",t),window.dispatchEvent(new CustomEvent("eip6963:requestProvider")),()=>window.removeEventListener("eip6963:announceProvider",t)}function Rh(){const r=new Set;let t=[];const e=()=>Oh(i=>{t.some(({info:s})=>s.uuid===i.info.uuid)||(t=[...t,i],r.forEach(s=>s(t,{added:[i]})))});let n=e();return{_listeners(){return r},clear(){r.forEach(i=>i([],{removed:[...t]})),t=[]},destroy(){this.clear(),r.clear(),n==null||n()},findProvider({rdns:i}){return t.find(s=>s.info.rdns===i)},getProviders(){return t},reset(){this.clear(),n==null||n(),n=e()},subscribe(i,{emitImmediately:s}={}){return r.add(i),s&&i(t,{added:t}),()=>r.delete(i)}}}function Lh(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}function Dh(){return typeof Kt<"u"&&typeof Kt.versions<"u"&&typeof Kt.versions.node<"u"}function Fc(){return!Lh()&&!Dh()}const ft="com.coinbase.wallet",Pt="org.base.account",Wc="io.metamask",Vh="me.rainbow",Sh="io.zerion.wallet",Fn={async getItem(r){try{if(typeof window<"u"&&window.localStorage)return localStorage.getItem(r)}catch{}return null},async removeItem(r){typeof window<"u"&&window.localStorage&&localStorage.removeItem(r)},async setItem(r,t){try{typeof window<"u"&&window.localStorage&&localStorage.setItem(r,t)}catch{}}};function Hs(r){return r.startsWith("http://")||r.startsWith("https://")}function Hc(r,t){if(!Hs(r))return Gc(r,t);let e=r;e.endsWith("/")||(e=`${e}/`);const n=encodeURIComponent(t);return{href:e,redirect:`${e}wc?uri=${n}`}}function Gc(r,t){if(Hs(r))return Hc(r,t);let e=r;e.includes("://")||(e=r.replaceAll("/","").replaceAll(":",""),e=`${e}://`),e.endsWith("/")||(e=`${e}/`);const n=encodeURIComponent(t);return{href:e,redirect:`${e}wc?uri=${n}`}}function xh(r,t){return Hs(r)?Hc(r,t):Gc(r,t)}function Ch(){if(typeof navigator>"u")return!1;const r=Uc(navigator.userAgent);return r?r.toLowerCase().includes("android"):!1}function $h(){if(typeof navigator>"u")return!1;const r=Uc(navigator.userAgent);return r?r.toLowerCase().includes("ios")||r.toLowerCase().includes("mac")&&navigator.maxTouchPoints>1:!1}function kh(){return typeof window>"u"||typeof navigator>"u"?!1:"ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0}function Nh(){return typeof window>"u"?!1:"orientation"in window||"onorientationchange"in window}function Ro(){return!!(Ch()||$h()||kh()&&Nh()||typeof window<"u"&&window.innerWidth<640)}function gi(r){if(window!==window.top)window.open(r);else if(r.startsWith("http")){const e=document.createElement("a");e.href=r,e.target="_blank",e.rel="noreferrer noopener",e.click()}else window.location.href=r}function Or(r){return typeof r=="string"?r.startsWith("ecosystem."):r.id.startsWith("ecosystem.")}async function Jc(r,t){if(Or(r)){const{getEcosystemWalletInfo:e}=await a(async()=>{const{getEcosystemWalletInfo:n}=await import("./get-ecosystem-wallet-info-Dy07hdCI.js");return{getEcosystemWalletInfo:n}},__vite__mapDeps([0,1,2,3,4,5,6,7]));return t?e(r).then(n=>n.image_id):e(r)}switch(r){case"smart":return t?a(()=>import("./image-BnYtBA0B.js"),[]).then(e=>e.default):a(()=>import("./index-BuSavAVK.js"),[]).then(e=>e.wallet);case"inApp":return t?a(()=>import("./image-YhquT9-B.js"),[]).then(e=>e.default):a(()=>import("./index-B6yqoFuC.js"),[]).then(e=>e.wallet);case"walletConnect":return t?a(()=>import("./image-B3sWXgWp.js"),[]).then(e=>e.default):a(()=>import("./index-B21BIk0D.js"),[]).then(e=>e.wallet);case"embedded":return t?a(()=>import("./image-CE6B5igp.js"),[]).then(e=>e.default):a(()=>import("./index-CZfaBXw3.js"),[]).then(e=>e.wallet);case"adapter":return t?a(()=>import("./image-CaoCxndE.js"),[]).then(e=>e.default):a(()=>import("./index-DkPRLpmE.js"),[]).then(e=>e.wallet);case"io.1inch.wallet":return t?a(()=>import("./image-DcM8byf5.js"),[]).then(e=>e.default):a(()=>import("./index-B8SH8PS4.js"),[]).then(e=>e.wallet);case"com.binance.wallet":return t?a(()=>import("./image-B6woX8-F.js"),[]).then(e=>e.default):a(()=>import("./index-D1Wt1Kx7.js"),[]).then(e=>e.wallet);case"com.ledger":return t?a(()=>import("./image-CGobRsqC.js"),[]).then(e=>e.default):a(()=>import("./index-C63hJ0G0.js"),[]).then(e=>e.wallet);case"com.bitpay":return t?a(()=>import("./image-oGFA7lCe.js"),[]).then(e=>e.default):a(()=>import("./index-Bl6ScMn3.js"),[]).then(e=>e.wallet);case"com.bestwallet":return t?a(()=>import("./image-YzdSnFCd.js"),[]).then(e=>e.default):a(()=>import("./index-C_fnrq8t.js"),[]).then(e=>e.wallet);case"io.metamask":return t?a(()=>import("./image-rAE1A9js.js"),[]).then(e=>e.default):a(()=>import("./index-DaZnaClT.js"),[]).then(e=>e.wallet);case"com.trustwallet.app":return t?a(()=>import("./image-DhOOZChF.js"),[]).then(e=>e.default):a(()=>import("./index-9552Tb-C.js"),[]).then(e=>e.wallet);case"com.fireblocks":return t?a(()=>import("./image-C_rXI8lY.js"),[]).then(e=>e.default):a(()=>import("./index-fm1oF4Rd.js"),[]).then(e=>e.wallet);case"com.bitget.web3":return t?a(()=>import("./image-Cyu_SKNX.js"),[]).then(e=>e.default):a(()=>import("./index-7Xw6Dozy.js"),[]).then(e=>e.wallet);case"pro.tokenpocket":return t?a(()=>import("./image--EMjkbyZ.js"),[]).then(e=>e.default):a(()=>import("./index-C6d9DLRH.js"),[]).then(e=>e.wallet);case"com.safepal":return t?a(()=>import("./image-CPrfOTN2.js"),[]).then(e=>e.default):a(()=>import("./index-BKoDPf_i.js"),[]).then(e=>e.wallet);case"org.uniswap":return t?a(()=>import("./image-DzLDqqsm.js"),[]).then(e=>e.default):a(()=>import("./index-j8mIFeCA.js"),[]).then(e=>e.wallet);case"io.zerion.wallet":return t?a(()=>import("./image-CXpsLPxr.js"),[]).then(e=>e.default):a(()=>import("./index-CAYpPiIA.js"),[]).then(e=>e.wallet);case"com.elrond.maiar.wallet":return t?a(()=>import("./image-Zh059TUR.js"),[]).then(e=>e.default):a(()=>import("./index-CN99OAiz.js"),[]).then(e=>e.wallet);case"com.crypto.wallet":return t?a(()=>import("./image-BbeMBRJP.js"),[]).then(e=>e.default):a(()=>import("./index-DoeeKGAI.js"),[]).then(e=>e.wallet);case"com.bitcoin":return t?a(()=>import("./image-CIhcwJo_.js"),[]).then(e=>e.default):a(()=>import("./index-COFjg0BY.js"),[]).then(e=>e.wallet);case"com.bifrostwallet":return t?a(()=>import("./image-BJbq9ykO.js"),[]).then(e=>e.default):a(()=>import("./index-Cw9NGSPc.js"),[]).then(e=>e.wallet);case"jp.co.rakuten-wallet":return t?a(()=>import("./image-CkSdZpFq.js"),[]).then(e=>e.default):a(()=>import("./index-CU6dgzkA.js"),[]).then(e=>e.wallet);case"com.bybit":return t?a(()=>import("./image-CVPmP4Bl.js"),[]).then(e=>e.default):a(()=>import("./index-m0YDsCpu.js"),[]).then(e=>e.wallet);case"com.blockchain.login":return t?a(()=>import("./image-BvEJhPGs.js"),[]).then(e=>e.default):a(()=>import("./index-C8VMxu1Z.js"),[]).then(e=>e.wallet);case"io.trezor":return t?a(()=>import("./image-BQXnGJhx.js"),[]).then(e=>e.default):a(()=>import("./index-CDqfDzT6.js"),[]).then(e=>e.wallet);case"im.token":return t?a(()=>import("./image-ChDeiuh7.js"),[]).then(e=>e.default):a(()=>import("./index-iJWzlNVI.js"),[]).then(e=>e.wallet);case"global.safe":return t?a(()=>import("./image-B6ncW7rJ.js"),[]).then(e=>e.default):a(()=>import("./index-HPp1Id1p.js"),[]).then(e=>e.wallet);case"xyz.ctrl":return t?a(()=>import("./image-DsOpF0U0.js"),[]).then(e=>e.default):a(()=>import("./index-CW6lKp1A.js"),[]).then(e=>e.wallet);case"co.arculus":return t?a(()=>import("./image-CYFfk7g3.js"),[]).then(e=>e.default):a(()=>import("./index-s6ugJH3L.js"),[]).then(e=>e.wallet);case"com.roninchain.wallet":return t?a(()=>import("./image-BMgLTkFN.js"),[]).then(e=>e.default):a(()=>import("./index-caEr82M6.js"),[]).then(e=>e.wallet);case"com.okex.wallet":return t?a(()=>import("./image-Ck2fht2U.js"),[]).then(e=>e.default):a(()=>import("./index-CbEIEIEo.js"),[]).then(e=>e.wallet);case"com.wemixplay":return t?a(()=>import("./image-Dfhapk7_.js"),[]).then(e=>e.default):a(()=>import("./index-C8AQSvJD.js"),[]).then(e=>e.wallet);case"com.tangem":return t?a(()=>import("./image-xMsS8TDb.js"),[]).then(e=>e.default):a(()=>import("./index-CKXDw-uc.js"),[]).then(e=>e.wallet);case"com.exodus":return t?a(()=>import("./image-BULUy74S.js"),[]).then(e=>e.default):a(()=>import("./index-DszThTMl.js"),[]).then(e=>e.wallet);case"com.hashpack.wallet":return t?a(()=>import("./image-BFzDP99B.js"),[]).then(e=>e.default):a(()=>import("./index-wBbkQCZY.js"),[]).then(e=>e.wallet);case"id.co.pintu":return t?a(()=>import("./image-CsH_NRy-.js"),[]).then(e=>e.default):a(()=>import("./index-DHDm_YtM.js"),[]).then(e=>e.wallet);case"network.blackfort":return t?a(()=>import("./image-CTLwieHz.js"),[]).then(e=>e.default):a(()=>import("./index-DZRVQyzq.js"),[]).then(e=>e.wallet);case"com.wigwam.wallet":return t?a(()=>import("./image-xaEWk6k8.js"),[]).then(e=>e.default):a(()=>import("./index-BA0Hn6eE.js"),[]).then(e=>e.wallet);case"app.backpack":return t?a(()=>import("./image-YbQrvLSP.js"),[]).then(e=>e.default):a(()=>import("./index-B8BWAl26.js"),[]).then(e=>e.wallet);case"app.subwallet":return t?a(()=>import("./image-BdqmMP8T.js"),[]).then(e=>e.default):a(()=>import("./index-7C_yDnI4.js"),[]).then(e=>e.wallet);case"cc.avacus":return t?a(()=>import("./image-uGs9mRWl.js"),[]).then(e=>e.default):a(()=>import("./index-BFZxo6Jc.js"),[]).then(e=>e.wallet);case"me.rainbow":return t?a(()=>import("./image-DSGxNIm1.js"),[]).then(e=>e.default):a(()=>import("./index-3d3uK5Ax.js"),[]).then(e=>e.wallet);case"so.onekey.app.wallet":return t?a(()=>import("./image-CwaGmiHI.js"),[]).then(e=>e.default):a(()=>import("./index-CUEmD5dS.js"),[]).then(e=>e.wallet);case"me.haha":return t?a(()=>import("./image-Npe5Xkhl.js"),[]).then(e=>e.default):a(()=>import("./index-B7GQyWAF.js"),[]).then(e=>e.wallet);case"com.bee":return t?a(()=>import("./image-Sy6X7CtO.js"),[]).then(e=>e.default):a(()=>import("./index-CQ3aQg5G.js"),[]).then(e=>e.wallet);case"ag.jup":return t?a(()=>import("./image-BuqgjEJD.js"),[]).then(e=>e.default):a(()=>import("./index-D30RfPa1.js"),[]).then(e=>e.wallet);case"app.keplr":return t?a(()=>import("./image-DpeCw-px.js"),[]).then(e=>e.default):a(()=>import("./index-BnsE1W-S.js"),[]).then(e=>e.wallet);case"org.hot-labs":return t?a(()=>import("./image-DFf3lDA_.js"),[]).then(e=>e.default):a(()=>import("./index-DDwu-IMz.js"),[]).then(e=>e.wallet);case"com.dcentwallet":return t?a(()=>import("./image-CUPOo6zK.js"),[]).then(e=>e.default):a(()=>import("./index-Bm92iZMY.js"),[]).then(e=>e.wallet);case"com.kraken":return t?a(()=>import("./image-BP17CoHz.js"),[]).then(e=>e.default):a(()=>import("./index-BFGXqrJS.js"),[]).then(e=>e.wallet);case"com.kucoin":return t?a(()=>import("./image-JIl7mHMQ.js"),[]).then(e=>e.default):a(()=>import("./index-DRVDpxj6.js"),[]).then(e=>e.wallet);case"io.magiceden.wallet":return t?a(()=>import("./image-B7QIFAir.js"),[]).then(e=>e.default):a(()=>import("./index-DMTU8hfu.js"),[]).then(e=>e.wallet);case"com.tomi":return t?a(()=>import("./image-COwCE3RO.js"),[]).then(e=>e.default):a(()=>import("./index-C7njqxXR.js"),[]).then(e=>e.wallet);case"io.ibvm":return t?a(()=>import("./image-CVBI4BwD.js"),[]).then(e=>e.default):a(()=>import("./index-HzSvsrak.js"),[]).then(e=>e.wallet);case"com.mewwallet":return t?a(()=>import("./image-Dx4ya6_y.js"),[]).then(e=>e.default):a(()=>import("./index-DEzKWTBJ.js"),[]).then(e=>e.wallet);case"com.socios.app":return t?a(()=>import("./image-COKP1J8V.js"),[]).then(e=>e.default):a(()=>import("./index-D06ftJGd.js"),[]).then(e=>e.wallet);case"xyz.argent":return t?a(()=>import("./image-5mReG_-1.js"),[]).then(e=>e.default):a(()=>import("./index-CQPZVLgk.js"),[]).then(e=>e.wallet);case"org.thorwallet":return t?a(()=>import("./image-Dmp2jTO0.js"),[]).then(e=>e.default):a(()=>import("./index-NO3dCFlG.js"),[]).then(e=>e.wallet);case"io.internetmoney":return t?a(()=>import("./image-D4PYvYqY.js"),[]).then(e=>e.default):a(()=>import("./index-BZwq4W5O.js"),[]).then(e=>e.wallet);case"org.mathwallet":return t?a(()=>import("./image-mMy4SSmg.js"),[]).then(e=>e.default):a(()=>import("./index-lGNYNhMi.js"),[]).then(e=>e.wallet);case"io.cypherhq":return t?a(()=>import("./image-B14TCFf5.js"),[]).then(e=>e.default):a(()=>import("./index-yURkkC3L.js"),[]).then(e=>e.wallet);case"io.novawallet":return t?a(()=>import("./image-DDso8kuB.js"),[]).then(e=>e.default):a(()=>import("./index-C91aPf2g.js"),[]).then(e=>e.wallet);case"io.yowallet":return t?a(()=>import("./image-Bx8buncY.js"),[]).then(e=>e.default):a(()=>import("./index-B062fuzr.js"),[]).then(e=>e.wallet);case"com.flowfoundation.wallet":return t?a(()=>import("./image-Da2xkAVi.js"),[]).then(e=>e.default):a(()=>import("./index-CBVJzm96.js"),[]).then(e=>e.wallet);case"app.kabila":return t?a(()=>import("./image-B-l20wIO.js"),[]).then(e=>e.default):a(()=>import("./index-cTRIo3rN.js"),[]).then(e=>e.wallet);case"com.opera":return t?a(()=>import("./image-sDrIF89f.js"),[]).then(e=>e.default):a(()=>import("./index-lIOVfT2m.js"),[]).then(e=>e.wallet);case"com.valoraapp":return t?a(()=>import("./image-5QXPaavh.js"),[]).then(e=>e.default):a(()=>import("./index-C6baQHax.js"),[]).then(e=>e.wallet);case"com.robinhood.wallet":return t?a(()=>import("./image-DBehogZh.js"),[]).then(e=>e.default):a(()=>import("./index-bzH6W7xo.js"),[]).then(e=>e.wallet);case"com.chain":return t?a(()=>import("./image-qsAyF5Oj.js"),[]).then(e=>e.default):a(()=>import("./index-npRlG_V2.js"),[]).then(e=>e.wallet);case"io.huddln":return t?a(()=>import("./image-CQm90J-d.js"),[]).then(e=>e.default):a(()=>import("./index-DILut-jL.js"),[]).then(e=>e.wallet);case"app.core.extension":return t?a(()=>import("./image-De2xpum1.js"),[]).then(e=>e.default):a(()=>import("./index-BtfbjCVr.js"),[]).then(e=>e.wallet);case"world.freedom":return t?a(()=>import("./image-COnY36UD.js"),[]).then(e=>e.default):a(()=>import("./index-BZUSQkq9.js"),[]).then(e=>e.wallet);case"money.unstoppable":return t?a(()=>import("./image-Bvw8wNRu.js"),[]).then(e=>e.default):a(()=>import("./index-CW8D5Pv5.js"),[]).then(e=>e.wallet);case"pk.modular":return t?a(()=>import("./image-CaHdVXd1.js"),[]).then(e=>e.default):a(()=>import("./index-1CA6ps09.js"),[]).then(e=>e.wallet);case"app.wombat":return t?a(()=>import("./image-ExeF69qZ.js"),[]).then(e=>e.default):a(()=>import("./index-D9Jrno_D.js"),[]).then(e=>e.wallet);case"com.klipwallet":return t?a(()=>import("./image-8vXf4Xjy.js"),[]).then(e=>e.default):a(()=>import("./index-CcNQ53IV.js"),[]).then(e=>e.wallet);case"com.gemwallet":return t?a(()=>import("./image-M7TV7WaH.js"),[]).then(e=>e.default):a(()=>import("./index-BtZsXMJj.js"),[]).then(e=>e.wallet);case"com.sabay.wallet":return t?a(()=>import("./image-CsNgSbbt.js"),[]).then(e=>e.default):a(()=>import("./index-BVAmxcaa.js"),[]).then(e=>e.wallet);case"com.zengo":return t?a(()=>import("./image-DNtaIeSw.js"),[]).then(e=>e.default):a(()=>import("./index-DDk7D3eE.js"),[]).then(e=>e.wallet);case"xyz.joeywallet":return t?a(()=>import("./image-CTsHGgDx.js"),[]).then(e=>e.default):a(()=>import("./index-Im6F3t68.js"),[]).then(e=>e.wallet);case"io.tokoin":return t?a(()=>import("./image-DQzzFCs2.js"),[]).then(e=>e.default):a(()=>import("./index-Bwjy4Jw7.js"),[]).then(e=>e.wallet);case"io.alpha-u.wallet.web":return t?a(()=>import("./image-DLiMUWBI.js"),[]).then(e=>e.default):a(()=>import("./index-DFt1vT8N.js"),[]).then(e=>e.wallet);case"network.cvl":return t?a(()=>import("./image-CtZg2vKX.js"),[]).then(e=>e.default):a(()=>import("./index-D2vPh3Mc.js"),[]).then(e=>e.wallet);case"io.leapwallet":return t?a(()=>import("./image-DHnnMCFG.js"),[]).then(e=>e.default):a(()=>import("./index-BdkJrfxl.js"),[]).then(e=>e.wallet);case"io.xenea":return t?a(()=>import("./image-B5ZxW0VG.js"),[]).then(e=>e.default):a(()=>import("./index-C8mAROh2.js"),[]).then(e=>e.wallet);case"com.oasys-wallet":return t?a(()=>import("./image-W7SfqKZe.js"),[]).then(e=>e.default):a(()=>import("./index-gQ8zpnGO.js"),[]).then(e=>e.wallet);case"com.bitso":return t?a(()=>import("./image-LfonVSeq.js"),[]).then(e=>e.default):a(()=>import("./index-YcqLCtWD.js"),[]).then(e=>e.wallet);case"io.enjin":return t?a(()=>import("./image-BnXzDKuV.js"),[]).then(e=>e.default):a(()=>import("./index-Jmrm9oUu.js"),[]).then(e=>e.wallet);case"com.coldwallet":return t?a(()=>import("./image-CVrpZdwi.js"),[]).then(e=>e.default):a(()=>import("./index-CkqupmC6.js"),[]).then(e=>e.wallet);case"org.creditcoin.app":return t?a(()=>import("./image-CzL8n4ZU.js"),[]).then(e=>e.default):a(()=>import("./index-B94SpzOt.js"),[]).then(e=>e.wallet);case"app.everspace":return t?a(()=>import("./image-ripXpF5P.js"),[]).then(e=>e.default):a(()=>import("./index-COlGaDkw.js"),[]).then(e=>e.wallet);case"app.zeal":return t?a(()=>import("./image-hO8Jv2oh.js"),[]).then(e=>e.default):a(()=>import("./index-B6n-vVE0.js"),[]).then(e=>e.wallet);case"app.whitewallet":return t?a(()=>import("./image-D7wXb0Un.js"),[]).then(e=>e.default):a(()=>import("./index-SCBLsVUL.js"),[]).then(e=>e.wallet);case"ai.purewallet":return t?a(()=>import("./image-K1HoU8Qi.js"),[]).then(e=>e.default):a(()=>import("./index-DZ2hd5eC.js"),[]).then(e=>e.wallet);case"com.fastex.wallet":return t?a(()=>import("./image-lBIlUHFP.js"),[]).then(e=>e.default):a(()=>import("./index-CMzQk3O6.js"),[]).then(e=>e.wallet);case"io.kriptomat":return t?a(()=>import("./image-6ouyxZRt.js"),[]).then(e=>e.default):a(()=>import("./index-wk2CJ7i5.js"),[]).then(e=>e.wallet);case"com.ullapay":return t?a(()=>import("./image-Bn2sAgXJ.js"),[]).then(e=>e.default):a(()=>import("./index-D_d6gemZ.js"),[]).then(e=>e.wallet);case"io.atomicwallet":return t?a(()=>import("./image-D55LvXjp.js"),[]).then(e=>e.default):a(()=>import("./index-DEV4egrN.js"),[]).then(e=>e.wallet);case"com.pionewallet":return t?a(()=>import("./image-B_0Cqkss.js"),[]).then(e=>e.default):a(()=>import("./index-BogX5ITG.js"),[]).then(e=>e.wallet);case"io.oxalus":return t?a(()=>import("./image-DTa4RXUa.js"),[]).then(e=>e.default):a(()=>import("./index-CuQBw1y6.js"),[]).then(e=>e.wallet);case"xyz.uniultra.wallet":return t?a(()=>import("./image-BSLjXnNe.js"),[]).then(e=>e.default):a(()=>import("./index-CJYo3Znz.js"),[]).then(e=>e.wallet);case"xyz.frontier.wallet":return t?a(()=>import("./image-Bdtwdp85.js"),[]).then(e=>e.default):a(()=>import("./index--YTVamH2.js"),[]).then(e=>e.wallet);case"com.coolbitx.cwsapp":return t?a(()=>import("./image-DWR067hG.js"),[]).then(e=>e.default):a(()=>import("./index-tkvX3w1X.js"),[]).then(e=>e.wallet);case"org.gooddollar":return t?a(()=>import("./image-y3eCNAT6.js"),[]).then(e=>e.default):a(()=>import("./index-C7N44kNF.js"),[]).then(e=>e.wallet);case"com.cakewallet":return t?a(()=>import("./image-BqQffU2u.js"),[]).then(e=>e.default):a(()=>import("./index-DPCPDLBT.js"),[]).then(e=>e.wallet);case"com.ellipal":return t?a(()=>import("./image-vuuCn07N.js"),[]).then(e=>e.default):a(()=>import("./index-jTpsrMvb.js"),[]).then(e=>e.wallet);case"app.krystal":return t?a(()=>import("./image-C2QANSRr.js"),[]).then(e=>e.default):a(()=>import("./index-B7dAHFam.js"),[]).then(e=>e.wallet);case"com.monarchwallet":return t?a(()=>import("./image-BNA4BP9T.js"),[]).then(e=>e.default):a(()=>import("./index-C7WD5W_Z.js"),[]).then(e=>e.wallet);case"com.burritowallet":return t?a(()=>import("./image-BI-5Z38o.js"),[]).then(e=>e.default):a(()=>import("./index-DpRqa1iX.js"),[]).then(e=>e.wallet);case"co.family.wallet":return t?a(()=>import("./image-CECsJh3H.js"),[]).then(e=>e.default):a(()=>import("./index-DrzmRQ9S.js"),[]).then(e=>e.wallet);case"com.mtpelerin":return t?a(()=>import("./image-BDOqiI6p.js"),[]).then(e=>e.default):a(()=>import("./index-bQArImNA.js"),[]).then(e=>e.wallet);case"app.keyring":return t?a(()=>import("./image-BH6pi8gb.js"),[]).then(e=>e.default):a(()=>import("./index-DLGneTkB.js"),[]).then(e=>e.wallet);case"cc.localtrade.lab":return t?a(()=>import("./image-DRqNpoe6.js"),[]).then(e=>e.default):a(()=>import("./index-D-qw7id5.js"),[]).then(e=>e.wallet);case"tech.okto":return t?a(()=>import("./image-uk4MysVY.js"),[]).then(e=>e.default):a(()=>import("./index-C5ZfEOey.js"),[]).then(e=>e.wallet);case"com.xcapit":return t?a(()=>import("./image-BjFjHCOg.js"),[]).then(e=>e.default):a(()=>import("./index-DbAxetvE.js"),[]).then(e=>e.wallet);case"com.gayawallet":return t?a(()=>import("./image-DC9Wj56E.js"),[]).then(e=>e.default):a(()=>import("./index-D4VnhuTS.js"),[]).then(e=>e.wallet);case"app.nightly":return t?a(()=>import("./image-Bv8VGwx8.js"),[]).then(e=>e.default):a(()=>import("./index-uM5GtqSd.js"),[]).then(e=>e.wallet);case"com.coin98":return t?a(()=>import("./image-Co9P7WAh.js"),[]).then(e=>e.default):a(()=>import("./index-CxBkKx5Q.js"),[]).then(e=>e.wallet);case"xyz.coca":return t?a(()=>import("./image-DaxrbegS.js"),[]).then(e=>e.default):a(()=>import("./index-CAfHv9Ye.js"),[]).then(e=>e.wallet);case"app.linen":return t?a(()=>import("./image-CljvD_on.js"),[]).then(e=>e.default):a(()=>import("./index-DTPO88lj.js"),[]).then(e=>e.wallet);case"dev.auroracloud":return t?a(()=>import("./image-BbwfB3J_.js"),[]).then(e=>e.default):a(()=>import("./index-DqYjD_64.js"),[]).then(e=>e.wallet);case"com.coinomi":return t?a(()=>import("./image-CyezMyAx.js"),[]).then(e=>e.default):a(()=>import("./index-B-oXIR8J.js"),[]).then(e=>e.wallet);case"my.mone":return t?a(()=>import("./image-B7h27Vsd.js"),[]).then(e=>e.default):a(()=>import("./index-3jJtZlGN.js"),[]).then(e=>e.wallet);case"org.alephium":return t?a(()=>import("./image-DDUR5y02.js"),[]).then(e=>e.default):a(()=>import("./index-CRTSSeuy.js"),[]).then(e=>e.wallet);case"com.alicebob":return t?a(()=>import("./image-BKjOwOZU.js"),[]).then(e=>e.default):a(()=>import("./index-DYiL0IsZ.js"),[]).then(e=>e.wallet);case"io.koalawallet":return t?a(()=>import("./image-CTAbQz5j.js"),[]).then(e=>e.default):a(()=>import("./index-DPXkoJXK.js"),[]).then(e=>e.wallet);case"com.veworld":return t?a(()=>import("./image-DKBlkqWK.js"),[]).then(e=>e.default):a(()=>import("./index-DV2Q2KhC.js"),[]).then(e=>e.wallet);case"com.withpaper":return t?a(()=>import("./image-DbBiNCFK.js"),[]).then(e=>e.default):a(()=>import("./index-CExunyqd.js"),[]).then(e=>e.wallet);case"io.noone":return t?a(()=>import("./image-CwDXHpUj.js"),[]).then(e=>e.default):a(()=>import("./index-BEFk-36A.js"),[]).then(e=>e.wallet);case"network.haqq":return t?a(()=>import("./image-BaRuJqy0.js"),[]).then(e=>e.default):a(()=>import("./index--t3K2suC.js"),[]).then(e=>e.wallet);case"io.ricewallet":return t?a(()=>import("./image-CmVMIVLM.js"),[]).then(e=>e.default):a(()=>import("./index-C_j7AjFr.js"),[]).then(e=>e.wallet);case"me.iopay":return t?a(()=>import("./image-CMJsc-Ir.js"),[]).then(e=>e.default):a(()=>import("./index-bsKYZmcs.js"),[]).then(e=>e.wallet);case"app.walletnow":return t?a(()=>import("./image-CmkiYZaU.js"),[]).then(e=>e.default):a(()=>import("./index-C_C9JdoE.js"),[]).then(e=>e.wallet);case"io.okse":return t?a(()=>import("./image-CZ9z1ucT.js"),[]).then(e=>e.default):a(()=>import("./index-_a8zNWKv.js"),[]).then(e=>e.wallet);case"network.over":return t?a(()=>import("./image-Cq54pcgl.js"),[]).then(e=>e.default):a(()=>import("./index-BDifUsn3.js"),[]).then(e=>e.wallet);case"com.aktionariat":return t?a(()=>import("./image-Cc6jyxLi.js"),[]).then(e=>e.default):a(()=>import("./index-Pw2thZ4h.js"),[]).then(e=>e.wallet);case"com.paybolt":return t?a(()=>import("./image-cwzgrAkh.js"),[]).then(e=>e.default):a(()=>import("./index-BxqRct_I.js"),[]).then(e=>e.wallet);case"com.plasma-wallet":return t?a(()=>import("./image-BVO9IT_6.js"),[]).then(e=>e.default):a(()=>import("./index-fiGpKN6W.js"),[]).then(e=>e.wallet);case"org.bytebank":return t?a(()=>import("./image-BP2Ox9Qn.js"),[]).then(e=>e.default):a(()=>import("./index-S5s6rAc3.js"),[]).then(e=>e.wallet);case"io.ethermail":return t?a(()=>import("./image-Duck5tqn.js"),[]).then(e=>e.default):a(()=>import("./index-BoCHG1VO.js"),[]).then(e=>e.wallet);case"com.optowallet":return t?a(()=>import("./image-W-Y_Nm-s.js"),[]).then(e=>e.default):a(()=>import("./index-BP-yDgcx.js"),[]).then(e=>e.wallet);case"finance.openwallet":return t?a(()=>import("./image-M_AWRaKs.js"),[]).then(e=>e.default):a(()=>import("./index-Cv59xn6_.js"),[]).then(e=>e.wallet);case"xyz.sequence":return t?a(()=>import("./image-o3pjQDbu.js"),[]).then(e=>e.default):a(()=>import("./index-D7Gl-ZGb.js"),[]).then(e=>e.wallet);case"com.foxwallet":return t?a(()=>import("./image-DcX8AUYd.js"),[]).then(e=>e.default):a(()=>import("./index-BARF52iT.js"),[]).then(e=>e.wallet);case"app.hbwallet":return t?a(()=>import("./image-BlogSp8o.js"),[]).then(e=>e.default):a(()=>import("./index-CW58bOV7.js"),[]).then(e=>e.wallet);case"it.airgap":return t?a(()=>import("./image-5CGX_QL3.js"),[]).then(e=>e.default):a(()=>import("./index-YDG1R00C.js"),[]).then(e=>e.wallet);case"com.holdstation":return t?a(()=>import("./image-BcNLqzB4.js"),[]).then(e=>e.default):a(()=>import("./index-9Ml23qSY.js"),[]).then(e=>e.wallet);case"io.universaleverything":return t?a(()=>import("./image-D3z3GjMO.js"),[]).then(e=>e.default):a(()=>import("./index-qmNRbp6W.js"),[]).then(e=>e.wallet);case"com.abra":return t?a(()=>import("./image-CCgX-pcz.js"),[]).then(e=>e.default):a(()=>import("./index-_36_A-pH.js"),[]).then(e=>e.wallet);case"org.thepulsewallet":return t?a(()=>import("./image-BxfO9qDl.js"),[]).then(e=>e.default):a(()=>import("./index-DgNvhZ_M.js"),[]).then(e=>e.wallet);case"com.premanft":return t?a(()=>import("./image-pKZ5ApxC.js"),[]).then(e=>e.default):a(()=>import("./index-CbGJyo5C.js"),[]).then(e=>e.wallet);case"xyz.timelesswallet":return t?a(()=>import("./image-DUs_WIFe.js"),[]).then(e=>e.default):a(()=>import("./index-WXvxLSve.js"),[]).then(e=>e.wallet);case"org.bitizen":return t?a(()=>import("./image-TQ3Nh_VF.js"),[]).then(e=>e.default):a(()=>import("./index-Db_DlPJs.js"),[]).then(e=>e.wallet);case"app.ultimate":return t?a(()=>import("./image-ClyvBbEv.js"),[]).then(e=>e.default):a(()=>import("./index-D2Z8_AUU.js"),[]).then(e=>e.wallet);case"io.compasswallet":return t?a(()=>import("./image-D6x5dtDG.js"),[]).then(e=>e.default):a(()=>import("./index-2qmxPQhP.js"),[]).then(e=>e.wallet);case"app.fizzwallet":return t?a(()=>import("./image-E3PT44xu.js"),[]).then(e=>e.default):a(()=>import("./index-DAYuEFQ-.js"),[]).then(e=>e.wallet);case"com.xovawallet":return t?a(()=>import("./image-B02ECgsY.js"),[]).then(e=>e.default):a(()=>import("./index-Bap5Lkty.js"),[]).then(e=>e.wallet);case"app.nicegram":return t?a(()=>import("./image-DH5ootHk.js"),[]).then(e=>e.default):a(()=>import("./index-BEXV42kp.js"),[]).then(e=>e.wallet);case"io.zelcore":return t?a(()=>import("./image-CLUlwzEU.js"),[]).then(e=>e.default):a(()=>import("./index-BLO6pY9b.js"),[]).then(e=>e.wallet);case"app.freighter":return t?a(()=>import("./image-BanazMP9.js"),[]).then(e=>e.default):a(()=>import("./index-CcdGs50g.js"),[]).then(e=>e.wallet);case"app.stickey":return t?a(()=>import("./image-_t2-K1ZP.js"),[]).then(e=>e.default):a(()=>import("./index-Cu2rQjR7.js"),[]).then(e=>e.wallet);case"app.coinstats":return t?a(()=>import("./image-BlZLdRma.js"),[]).then(e=>e.default):a(()=>import("./index-j8xu_BhO.js"),[]).then(e=>e.wallet);case"io.harti":return t?a(()=>import("./image-Xfz-LkLu.js"),[]).then(e=>e.default):a(()=>import("./index-DPhI9JUn.js"),[]).then(e=>e.wallet);case"io.dttd":return t?a(()=>import("./image-pEGSGt6h.js"),[]).then(e=>e.default):a(()=>import("./index-CXYI0OjH.js"),[]).then(e=>e.wallet);case"com.tellaw":return t?a(()=>import("./image-sm-_D7TO.js"),[]).then(e=>e.default):a(()=>import("./index-Ddqy22qU.js"),[]).then(e=>e.wallet);case"io.klever":return t?a(()=>import("./image-BBFbQZtc.js"),[]).then(e=>e.default):a(()=>import("./index-BJAcAgB9.js"),[]).then(e=>e.wallet);case"com.unstoppabledomains":return t?a(()=>import("./image-EUVXQieb.js"),[]).then(e=>e.default):a(()=>import("./index-B1XrJIPH.js"),[]).then(e=>e.wallet);case"is.callback":return t?a(()=>import("./image-Mf3UQvEC.js"),[]).then(e=>e.default):a(()=>import("./index-DTtDhdi2.js"),[]).then(e=>e.wallet);case"ai.pundi":return t?a(()=>import("./image-9BTuaiXb.js"),[]).then(e=>e.default):a(()=>import("./index-Ca7jbqnT.js"),[]).then(e=>e.wallet);case"io.summonersarena":return t?a(()=>import("./image-3-p5LJAk.js"),[]).then(e=>e.default):a(()=>import("./index-ovz39Egy.js"),[]).then(e=>e.wallet);case"io.fizen":return t?a(()=>import("./image-CZLdphQJ.js"),[]).then(e=>e.default):a(()=>import("./index-WwjGYjHa.js"),[]).then(e=>e.wallet);case"fi.pillar":return t?a(()=>import("./image-CVAbhfmI.js"),[]).then(e=>e.default):a(()=>import("./index-BFJUkm8C.js"),[]).then(e=>e.wallet);case"world.ixo":return t?a(()=>import("./image-CsTNl20e.js"),[]).then(e=>e.default):a(()=>import("./index-C-A1j44m.js"),[]).then(e=>e.wallet);case"org.thetatoken":return t?a(()=>import("./image-BstOz2Sd.js"),[]).then(e=>e.default):a(()=>import("./index-BlU4B6pe.js"),[]).then(e=>e.wallet);case"net.gateweb3":return t?a(()=>import("./image-CypdirPa.js"),[]).then(e=>e.default):a(()=>import("./index-BkM7PWkU.js"),[]).then(e=>e.wallet);case"app.ammer":return t?a(()=>import("./image-BfGkQCHU.js"),[]).then(e=>e.default):a(()=>import("./index-C0HCn7GN.js"),[]).then(e=>e.wallet);case"us.binance":return t?a(()=>import("./image-DgkgLcDL.js"),[]).then(e=>e.default):a(()=>import("./index-BuhGQjsZ.js"),[]).then(e=>e.wallet);case"io.yusetoken":return t?a(()=>import("./image-CSAN5rKt.js"),[]).then(e=>e.default):a(()=>import("./index-DQ8_v09O.js"),[]).then(e=>e.wallet);case"co.muza":return t?a(()=>import("./image-CRsMfPT0.js"),[]).then(e=>e.default):a(()=>import("./index-5IpGHzAv.js"),[]).then(e=>e.wallet);case"io.hyperpay":return t?a(()=>import("./image-D8scG8aP.js"),[]).then(e=>e.default):a(()=>import("./index-BXZiXU-9.js"),[]).then(e=>e.wallet);case"io.cosmostation":return t?a(()=>import("./image-BYUgGshq.js"),[]).then(e=>e.default):a(()=>import("./index-RiIluuCN.js"),[]).then(e=>e.wallet);case"app.ryipay":return t?a(()=>import("./image-oKct0i27.js"),[]).then(e=>e.default):a(()=>import("./index-CdvxolxE.js"),[]).then(e=>e.wallet);case"io.wallet3":return t?a(()=>import("./image-DJLc6AlW.js"),[]).then(e=>e.default):a(()=>import("./index-C_5dy4gh.js"),[]).then(e=>e.wallet);case"org.dota168":return t?a(()=>import("./image-D3VAu6BC.js"),[]).then(e=>e.default):a(()=>import("./index-BP76iXI2.js"),[]).then(e=>e.wallet);case"com.bitpie":return t?a(()=>import("./image-BUsH-M52.js"),[]).then(e=>e.default):a(()=>import("./index-BKN05ia6.js"),[]).then(e=>e.wallet);case"com.coininn":return t?a(()=>import("./image-B_AAvjJY.js"),[]).then(e=>e.default):a(()=>import("./index-l2eJJ7mG.js"),[]).then(e=>e.wallet);case"me.easy":return t?a(()=>import("./image-BjKXKIhU.js"),[]).then(e=>e.default):a(()=>import("./index-4WvPsM5O.js"),[]).then(e=>e.wallet);case"io.shido":return t?a(()=>import("./image-BGZ2pFmO.js"),[]).then(e=>e.default):a(()=>import("./index-SaOy8OjI.js"),[]).then(e=>e.wallet);case"com.neonwallet":return t?a(()=>import("./image-D2051qUc.js"),[]).then(e=>e.default):a(()=>import("./index-CUJUgO36.js"),[]).then(e=>e.wallet);case"com.secuxtech":return t?a(()=>import("./image-DHHZDLK-.js"),[]).then(e=>e.default):a(()=>import("./index-D1G_5OyD.js"),[]).then(e=>e.wallet);case"com.unitywallet":return t?a(()=>import("./image-BqmT5urK.js"),[]).then(e=>e.default):a(()=>import("./index-BqxSKkSq.js"),[]).then(e=>e.wallet);case"io.miraiapp":return t?a(()=>import("./image-Bi1elmSL.js"),[]).then(e=>e.default):a(()=>import("./index-D0rQT1_1.js"),[]).then(e=>e.wallet);case"com.beexo":return t?a(()=>import("./image-MGwelZJS.js"),[]).then(e=>e.default):a(()=>import("./index-Bbv-4GNB.js"),[]).then(e=>e.wallet);case"social.halo":return t?a(()=>import("./image-CbnSXqJS.js"),[]).then(e=>e.default):a(()=>import("./index-KpPak-wu.js"),[]).then(e=>e.wallet);case"com.gemspocket":return t?a(()=>import("./image-DpGIEKrK.js"),[]).then(e=>e.default):a(()=>import("./index-RpXAvNRL.js"),[]).then(e=>e.wallet);case"app.status":return t?a(()=>import("./image-9509MPsE.js"),[]).then(e=>e.default):a(()=>import("./index-DLMSD3H_.js"),[]).then(e=>e.wallet);case"com.midoin":return t?a(()=>import("./image-BocNs9ze.js"),[]).then(e=>e.default):a(()=>import("./index-CrBWjlui.js"),[]).then(e=>e.wallet);case"id.competence":return t?a(()=>import("./image-CaqftHzf.js"),[]).then(e=>e.default):a(()=>import("./index-CGMXxK_x.js"),[]).then(e=>e.wallet);case"com.safemoon":return t?a(()=>import("./image-BcfiUDv-.js"),[]).then(e=>e.default):a(()=>import("./index-BgECKCj8.js"),[]).then(e=>e.wallet);case"llc.besc":return t?a(()=>import("./image-DLwHWQ4l.js"),[]).then(e=>e.default):a(()=>import("./index-CbMeskkV.js"),[]).then(e=>e.wallet);case"baby.smart":return t?a(()=>import("./image-VxDqDj0T.js"),[]).then(e=>e.default):a(()=>import("./index-BmKJ1abQ.js"),[]).then(e=>e.wallet);case"app.onto":return t?a(()=>import("./image-BCXqBewH.js"),[]).then(e=>e.default):a(()=>import("./index-BPFXH4g9.js"),[]).then(e=>e.wallet);case"com.ivirse":return t?a(()=>import("./image-8DkN4eFx.js"),[]).then(e=>e.default):a(()=>import("./index-CqWFxNbG.js"),[]).then(e=>e.wallet);case"one.mixin.messenger":return t?a(()=>import("./image-DecSbpNG.js"),[]).then(e=>e.default):a(()=>import("./index-PjYIiHEb.js"),[]).then(e=>e.wallet);case"cash.abpay":return t?a(()=>import("./image-Bb4ZLG-2.js"),[]).then(e=>e.default):a(()=>import("./index-BrvgJVgh.js"),[]).then(e=>e.wallet);case"ch.dssecurity":return t?a(()=>import("./image-ddsU9gPS.js"),[]).then(e=>e.default):a(()=>import("./index-DDdoZFD-.js"),[]).then(e=>e.wallet);case"com.concordium.wallet":return t?a(()=>import("./image-W5rUOVDT.js"),[]).then(e=>e.default):a(()=>import("./index-B5BAsv-B.js"),[]).then(e=>e.wallet);case"io.zkape":return t?a(()=>import("./image-Bm-o9RF3.js"),[]).then(e=>e.default):a(()=>import("./index-yLatYZZK.js"),[]).then(e=>e.wallet);case"com.paliwallet":return t?a(()=>import("./image-DqH_Lyo9.js"),[]).then(e=>e.default):a(()=>import("./index-C93NlSEw.js"),[]).then(e=>e.wallet);case"io.pitaka":return t?a(()=>import("./image-Bo8CHmCG.js"),[]).then(e=>e.default):a(()=>import("./index-DeQey0SH.js"),[]).then(e=>e.wallet);case"com.saitamatoken":return t?a(()=>import("./image-AlOoIjkb.js"),[]).then(e=>e.default):a(()=>import("./index-CNkg8_tm.js"),[]).then(e=>e.wallet);case"org.mugambo":return t?a(()=>import("./image-vXNBwFvw.js"),[]).then(e=>e.default):a(()=>import("./index-CqJjpCD5.js"),[]).then(e=>e.wallet);case"fi.stablez":return t?a(()=>import("./image-CruMo9Ar.js"),[]).then(e=>e.default):a(()=>import("./index-Wz7obrZB.js"),[]).then(e=>e.wallet);case"io.legacynetwork":return t?a(()=>import("./image-Dgb3Vdrr.js"),[]).then(e=>e.default):a(()=>import("./index-DLHjxUiX.js"),[]).then(e=>e.wallet);case"com.meld.app":return t?a(()=>import("./image-DrobCWF2.js"),[]).then(e=>e.default):a(()=>import("./index-BqLb859N.js"),[]).then(e=>e.wallet);case"io.bladewallet":return t?a(()=>import("./image-nqueMEws.js"),[]).then(e=>e.default):a(()=>import("./index-C0I75rp3.js"),[]).then(e=>e.wallet);case"com.authentrend":return t?a(()=>import("./image-CmzmxiTz.js"),[]).then(e=>e.default):a(()=>import("./index-0qRtNAQn.js"),[]).then(e=>e.wallet);case"com.webauth":return t?a(()=>import("./image-EyKsXf_1.js"),[]).then(e=>e.default):a(()=>import("./index-BXnDDK-y.js"),[]).then(e=>e.wallet);case"xyz.tucop":return t?a(()=>import("./image-8r04P3UP.js"),[]).then(e=>e.default):a(()=>import("./index-Bbznecif.js"),[]).then(e=>e.wallet);case"pro.fintoken":return t?a(()=>import("./image-BBez6ov1.js"),[]).then(e=>e.default):a(()=>import("./index-CP3DQPwx.js"),[]).then(e=>e.wallet);case"io.nash":return t?a(()=>import("./image--fcqsYch.js"),[]).then(e=>e.default):a(()=>import("./index-Bx9srovK.js"),[]).then(e=>e.wallet);case"vc.uincubator.api":return t?a(()=>import("./image-CyLv-qKv.js"),[]).then(e=>e.default):a(()=>import("./index-B5AZ3O3C.js"),[]).then(e=>e.wallet);case"io.unagi.unawallet":return t?a(()=>import("./image-C6ewnpHo.js"),[]).then(e=>e.default):a(()=>import("./index-CD7cY8HX.js"),[]).then(e=>e.wallet);case"io.nonbank":return t?a(()=>import("./image-TA_PkYBz.js"),[]).then(e=>e.default):a(()=>import("./index-DSWhMtMn.js"),[]).then(e=>e.wallet);case"io.armana.portal":return t?a(()=>import("./image-CI3i53ES.js"),[]).then(e=>e.default):a(()=>import("./index-DuTQzi4Z.js"),[]).then(e=>e.wallet);case"com.x9wallet":return t?a(()=>import("./image-BnT6IaIq.js"),[]).then(e=>e.default):a(()=>import("./index-K7y9yqJI.js"),[]).then(e=>e.wallet);case"io.kigo":return t?a(()=>import("./image-D9i7y0RW.js"),[]).then(e=>e.default):a(()=>import("./index-BIFgx20V.js"),[]).then(e=>e.wallet);case"com.alphawallet":return t?a(()=>import("./image-xJO47ptb.js"),[]).then(e=>e.default):a(()=>import("./index-B78E3fcT.js"),[]).then(e=>e.wallet);case"com.getcogni":return t?a(()=>import("./image-CwsKp0mM.js"),[]).then(e=>e.default):a(()=>import("./index-BNlDhEDg.js"),[]).then(e=>e.wallet);case"app.sinum":return t?a(()=>import("./image-DTy0DgOV.js"),[]).then(e=>e.default):a(()=>import("./index-D5GVUjIM.js"),[]).then(e=>e.wallet);case"finance.soulswap.app":return t?a(()=>import("./image-BI8lK7Gl.js"),[]).then(e=>e.default):a(()=>import("./index-CB_NguTF.js"),[]).then(e=>e.wallet);case"io.loopring.wallet":return t?a(()=>import("./image-BdLvgjKp.js"),[]).then(e=>e.default):a(()=>import("./index-DpoJvg5R.js"),[]).then(e=>e.wallet);case"com.shapeshift":return t?a(()=>import("./image-T2oAotCg.js"),[]).then(e=>e.default):a(()=>import("./index-CdMxme0L.js"),[]).then(e=>e.wallet);case"io.trinity-tech":return t?a(()=>import("./image-bHVCC2t9.js"),[]).then(e=>e.default):a(()=>import("./index-JNZoio_2.js"),[]).then(e=>e.wallet);case"money.keychain":return t?a(()=>import("./image-CHotlokX.js"),[]).then(e=>e.default):a(()=>import("./index-C2CZkwuV.js"),[]).then(e=>e.wallet);case"com.superhero.cordova":return t?a(()=>import("./image-CsmwtAjX.js"),[]).then(e=>e.default):a(()=>import("./index-C5X26G0P.js"),[]).then(e=>e.wallet);case"com.bettatrade":return t?a(()=>import("./image-B4MULACL.js"),[]).then(e=>e.default):a(()=>import("./index-qNIXx6_B.js"),[]).then(e=>e.wallet);case"online.puzzle":return t?a(()=>import("./image-C4hEqt6v.js"),[]).then(e=>e.default):a(()=>import("./index-D2-ySoTs.js"),[]).then(e=>e.wallet);case"gg.indi":return t?a(()=>import("./image-DdicXBNF.js"),[]).then(e=>e.default):a(()=>import("./index-BTkNDmCP.js"),[]).then(e=>e.wallet);case"io.tradestrike":return t?a(()=>import("./image-Bsv1aEQB.js"),[]).then(e=>e.default):a(()=>import("./index-CLtv9-lU.js"),[]).then(e=>e.wallet);case"xyz.echooo":return t?a(()=>import("./image-C7H4CQ65.js"),[]).then(e=>e.default):a(()=>import("./index-B-UTLjBc.js"),[]).then(e=>e.wallet);case"com.kryptogo":return t?a(()=>import("./image-D3ALeCj7.js"),[]).then(e=>e.default):a(()=>import("./index-BtBx3hi1.js"),[]).then(e=>e.wallet);case"io.trustasset":return t?a(()=>import("./image-BfmBx3-B.js"),[]).then(e=>e.default):a(()=>import("./index-MECmwSvw.js"),[]).then(e=>e.wallet);case"app.utorg":return t?a(()=>import("./image-CyF2UJbG.js"),[]).then(e=>e.default):a(()=>import("./index-DK-e_E51.js"),[]).then(e=>e.wallet);case"app.dfinnwallet":return t?a(()=>import("./image-DGLcwgsS.js"),[]).then(e=>e.default):a(()=>import("./index-DR-ujXcj.js"),[]).then(e=>e.wallet);case"org.rezor":return t?a(()=>import("./image-D_0i3ZH4.js"),[]).then(e=>e.default):a(()=>import("./index-DlKNOIdN.js"),[]).then(e=>e.wallet);case"io.legionnetwork":return t?a(()=>import("./image-BszqTwo7.js"),[]).then(e=>e.default):a(()=>import("./index-DMyHg26L.js"),[]).then(e=>e.wallet);case"cc.maxwallet":return t?a(()=>import("./image-CxvWjDXv.js"),[]).then(e=>e.default):a(()=>import("./index-Dy45c3qF.js"),[]).then(e=>e.wallet);case"com.ripio":return t?a(()=>import("./image-DZpGtN5l.js"),[]).then(e=>e.default):a(()=>import("./index-BoC-cn90.js"),[]).then(e=>e.wallet);case"com.fxwallet":return t?a(()=>import("./image-Bkj-ZRbS.js"),[]).then(e=>e.default):a(()=>import("./index-D8dYcFAn.js"),[]).then(e=>e.wallet);case"inc.tomo":return t?a(()=>import("./image-rw28GAIu.js"),[]).then(e=>e.default):a(()=>import("./index-Bh8eOJMM.js"),[]).then(e=>e.wallet);case"me.komet.app":return t?a(()=>import("./image-29vwsAfI.js"),[]).then(e=>e.default):a(()=>import("./index-CapnWgEl.js"),[]).then(e=>e.wallet);case"io.guardiianwallet":return t?a(()=>import("./image-DIDeRhKH.js"),[]).then(e=>e.default):a(()=>import("./index-CWTqaiN6.js"),[]).then(e=>e.wallet);case"io.hacken.hai":return t?a(()=>import("./image-Fq457JJn.js"),[]).then(e=>e.default):a(()=>import("./index-BH1-nK1j.js"),[]).then(e=>e.wallet);case"com.zypto":return t?a(()=>import("./image-D9OC6Qfy.js"),[]).then(e=>e.default):a(()=>import("./index-5U2ZJeh5.js"),[]).then(e=>e.wallet);case"io.nabox":return t?a(()=>import("./image-CJb0NNxX.js"),[]).then(e=>e.default):a(()=>import("./index-Cl87iGjg.js"),[]).then(e=>e.wallet);case"com.tastycrypto":return t?a(()=>import("./image-IpgDqPq2.js"),[]).then(e=>e.default):a(()=>import("./index-CXgqt45P.js"),[]).then(e=>e.wallet);case"com.ballet":return t?a(()=>import("./image-DNyYhMNV.js"),[]).then(e=>e.default):a(()=>import("./index-DhFHq_nZ.js"),[]).then(e=>e.wallet);case"io.talken":return t?a(()=>import("./image-DjXN5hvv.js"),[]).then(e=>e.default):a(()=>import("./index-CuJtvtqs.js"),[]).then(e=>e.wallet);case"io.wallacy":return t?a(()=>import("./image-CdGvq_lV.js"),[]).then(e=>e.default):a(()=>import("./index-DcUozftP.js"),[]).then(e=>e.wallet);case"network.mrhb":return t?a(()=>import("./image-CaBQfcNB.js"),[]).then(e=>e.default):a(()=>import("./index-BpspMk9l.js"),[]).then(e=>e.wallet);case"io.pockie":return t?a(()=>import("./image-D13kcv8b.js"),[]).then(e=>e.default):a(()=>import("./index-Bd7BhrCK.js"),[]).then(e=>e.wallet);case"me.astrox":return t?a(()=>import("./image-BGSprUxs.js"),[]).then(e=>e.default):a(()=>import("./index-BM9GzZ_o.js"),[]).then(e=>e.wallet);case"com.thirdweb":return t?a(()=>import("./image--O11VYbP.js"),[]).then(e=>e.default):a(()=>import("./index-VZmM-6RJ.js"),[]).then(e=>e.wallet);case"com.poolsmobility.wallet":return t?a(()=>import("./image-CUFBkGzy.js"),[]).then(e=>e.default):a(()=>import("./index-DMyDV-OH.js"),[]).then(e=>e.wallet);case"xyz.roam.wallet":return t?a(()=>import("./image-BBk5bBxJ.js"),[]).then(e=>e.default):a(()=>import("./index-DACt8hFb.js"),[]).then(e=>e.wallet);case"app.gamic":return t?a(()=>import("./image-CbmAI5Wi.js"),[]).then(e=>e.default):a(()=>import("./index-D09WfuKj.js"),[]).then(e=>e.wallet);case"app.m1nty":return t?a(()=>import("./image-8Zz6I0OH.js"),[]).then(e=>e.default):a(()=>import("./index-CU6cpe0O.js"),[]).then(e=>e.wallet);case"network.trustkeys":return t?a(()=>import("./image-BJAlBW3-.js"),[]).then(e=>e.default):a(()=>import("./index-BSA2BPZ9.js"),[]).then(e=>e.wallet);case"com.caesiumlab":return t?a(()=>import("./image-DLtkWmCC.js"),[]).then(e=>e.default):a(()=>import("./index-CZNdz8B6.js"),[]).then(e=>e.wallet);case"app.catecoin":return t?a(()=>import("./image-BIIaxSfC.js"),[]).then(e=>e.default):a(()=>import("./index-DNynPGua.js"),[]).then(e=>e.wallet);case"com.hootark":return t?a(()=>import("./image-BQTKy54v.js"),[]).then(e=>e.default):a(()=>import("./index-DhlaSoR4.js"),[]).then(e=>e.wallet);case"com.crossmint":return t?a(()=>import("./image-DrH3Wn2w.js"),[]).then(e=>e.default):a(()=>import("./index-Czf-i91G.js"),[]).then(e=>e.wallet);case"com.coincircle":return t?a(()=>import("./image-DOcz3CQ4.js"),[]).then(e=>e.default):a(()=>import("./index-Crs9jVrm.js"),[]).then(e=>e.wallet);case"io.bharatbox":return t?a(()=>import("./image-D1eN-vq9.js"),[]).then(e=>e.default):a(()=>import("./index-CdYRC4Ux.js"),[]).then(e=>e.wallet);case"nl.greenhood.wallet":return t?a(()=>import("./image-Cyy1KupU.js"),[]).then(e=>e.default):a(()=>import("./index-BPgl8Hhp.js"),[]).then(e=>e.wallet);case"co.swopme":return t?a(()=>import("./image-B6SAWLjq.js"),[]).then(e=>e.default):a(()=>import("./index-DMAP8qTI.js"),[]).then(e=>e.wallet);case"com.kresus":return t?a(()=>import("./image-DesBMjvP.js"),[]).then(e=>e.default):a(()=>import("./index-oEcArN4B.js"),[]).then(e=>e.wallet);case"com.dolletwallet":return t?a(()=>import("./image-fjbgiffe.js"),[]).then(e=>e.default):a(()=>import("./index-CCIAeA2T.js"),[]).then(e=>e.wallet);case"net.shinobi-wallet":return t?a(()=>import("./image-WbOd8jAJ.js"),[]).then(e=>e.default):a(()=>import("./index-CZmLnawh.js"),[]).then(e=>e.wallet);case"com.azcoiner":return t?a(()=>import("./image-BQcTbEVl.js"),[]).then(e=>e.default):a(()=>import("./index-t6B_NULY.js"),[]).then(e=>e.wallet);case"com.passwallet.app":return t?a(()=>import("./image-DJYKaoNi.js"),[]).then(e=>e.default):a(()=>import("./index-Ct6AYfZ-.js"),[]).then(e=>e.wallet);case"app.qubic.wallet":return t?a(()=>import("./image-BBZFtk5k.js"),[]).then(e=>e.default):a(()=>import("./index-DoKwRUhz.js"),[]).then(e=>e.wallet);case"com.coinex.wallet":return t?a(()=>import("./image-CfglWSsQ.js"),[]).then(e=>e.default):a(()=>import("./index-DMEV07wA.js"),[]).then(e=>e.wallet);case"app.xverse":return t?a(()=>import("./image-DETlLb_v.js"),[]).then(e=>e.default):a(()=>import("./index-DAlw00ee.js"),[]).then(e=>e.wallet);case"com.flash-wallet":return t?a(()=>import("./image-BzGwleUn.js"),[]).then(e=>e.default):a(()=>import("./index-7BdGIDy3.js"),[]).then(e=>e.wallet);case"com.vgxfoundation":return t?a(()=>import("./image-C6NJnfCW.js"),[]).then(e=>e.default):a(()=>import("./index-CsAX4sL-.js"),[]).then(e=>e.wallet);case"org.arianee":return t?a(()=>import("./image-B6VmDbM6.js"),[]).then(e=>e.default):a(()=>import("./index-Cx8lAzRu.js"),[]).then(e=>e.wallet);case"io.myabcwallet":return t?a(()=>import("./image-jv6wUF7a.js"),[]).then(e=>e.default):a(()=>import("./index-3an-fsOm.js"),[]).then(e=>e.wallet);case"io.owallet":return t?a(()=>import("./image-DGhNZ1rS.js"),[]).then(e=>e.default):a(()=>import("./index-D2_d10WC.js"),[]).then(e=>e.wallet);case"io.zelus":return t?a(()=>import("./image-1epPqHV4.js"),[]).then(e=>e.default):a(()=>import("./index-hUldZ-v8.js"),[]).then(e=>e.wallet);case"net.myrenegade":return t?a(()=>import("./image-SJHuomz2.js"),[]).then(e=>e.default):a(()=>import("./index-C5gBqe1B.js"),[]).then(e=>e.wallet);case"io.clingon":return t?a(()=>import("./image-2s8lIjLJ.js"),[]).then(e=>e.default):a(()=>import("./index-Dk8LF9Yk.js"),[]).then(e=>e.wallet);case"com.icewal":return t?a(()=>import("./image-rdvu9IOp.js"),[]).then(e=>e.default):a(()=>import("./index-Cd5Dye5X.js"),[]).then(e=>e.wallet);case"io.streakk":return t?a(()=>import("./image-CcPbeTXv.js"),[]).then(e=>e.default):a(()=>import("./index-CrGDBMbK.js"),[]).then(e=>e.wallet);case"com.dokwallet":return t?a(()=>import("./image-BRPzDWpX.js"),[]).then(e=>e.default):a(()=>import("./index-xEbiF_Me.js"),[]).then(e=>e.wallet);case"finance.porta":return t?a(()=>import("./image-BNvlqRxs.js"),[]).then(e=>e.default):a(()=>import("./index-DSL1LhIu.js"),[]).then(e=>e.wallet);case"io.prettygood.x":return t?a(()=>import("./image-BhmKXBqm.js"),[]).then(e=>e.default):a(()=>import("./index-DfafaK4Q.js"),[]).then(e=>e.wallet);case"io.earthwallet":return t?a(()=>import("./image-BOJcifnx.js"),[]).then(e=>e.default):a(()=>import("./index-BmwlJTQ-.js"),[]).then(e=>e.wallet);case"net.spatium.wallet":return t?a(()=>import("./image-CmrOpLf4.js"),[]).then(e=>e.default):a(()=>import("./index-Fd858RJQ.js"),[]).then(e=>e.wallet);case"live.superex":return t?a(()=>import("./image-ByHnaba8.js"),[]).then(e=>e.default):a(()=>import("./index-DqVvpGRi.js"),[]).then(e=>e.wallet);case"com.adftechnology":return t?a(()=>import("./image-C6LRjQzh.js"),[]).then(e=>e.default):a(()=>import("./index-C-b1qpM9.js"),[]).then(e=>e.wallet);case"com.bscecowallet":return t?a(()=>import("./image-8u03hBEl.js"),[]).then(e=>e.default):a(()=>import("./index-Dn2svNQz.js"),[]).then(e=>e.wallet);case"io.wallypto":return t?a(()=>import("./image-CRU88082.js"),[]).then(e=>e.default):a(()=>import("./index-j06jujv2.js"),[]).then(e=>e.wallet);case"com.reown":return t?a(()=>import("./image-D3tLM-DF.js"),[]).then(e=>e.default):a(()=>import("./index-DibwKtF2.js"),[]).then(e=>e.wallet);case"finance.voltage":return t?a(()=>import("./image-ZVoqlWXW.js"),[]).then(e=>e.default):a(()=>import("./index-XRQW1mUN.js"),[]).then(e=>e.wallet);case"com.walletconnect":return t?a(()=>import("./image-BAS5CqSz.js"),[]).then(e=>e.default):a(()=>import("./index-B-BftUxa.js"),[]).then(e=>e.wallet);case"io.passpay":return t?a(()=>import("./image-Ci0UFTFy.js"),[]).then(e=>e.default):a(()=>import("./index-CP_9UNXA.js"),[]).then(e=>e.wallet);case"technology.obvious":return t?a(()=>import("./image-ZLtraAGN.js"),[]).then(e=>e.default):a(()=>import("./index-BzNpkHfI.js"),[]).then(e=>e.wallet);case"io.plutope":return t?a(()=>import("./image-Bz03or90.js"),[]).then(e=>e.default):a(()=>import("./index-CszQa87W.js"),[]).then(e=>e.wallet);case"io.buzz-up":return t?a(()=>import("./image-BsQYdoXP.js"),[]).then(e=>e.default):a(()=>import("./index-BoJGVmma.js"),[]).then(e=>e.wallet);case"co.xellar":return t?a(()=>import("./image-D2QL-j27.js"),[]).then(e=>e.default):a(()=>import("./index-cdlur5jM.js"),[]).then(e=>e.wallet);case"com.kaxaa":return t?a(()=>import("./image-DPzEe6a_.js"),[]).then(e=>e.default):a(()=>import("./index-DFSGuScS.js"),[]).then(e=>e.wallet);case"org.shefi":return t?a(()=>import("./image-DwUGDFj5.js"),[]).then(e=>e.default):a(()=>import("./index-Dtavj5eK.js"),[]).then(e=>e.wallet);case"xyz.orion":return t?a(()=>import("./image-CCDmsN6r.js"),[]).then(e=>e.default):a(()=>import("./index-Ba2OoCBH.js"),[]).then(e=>e.wallet);case"world.dosi.vault":return t?a(()=>import("./image-Cy0vmJls.js"),[]).then(e=>e.default):a(()=>import("./index-eujSyrnd.js"),[]).then(e=>e.wallet);case"network.gridlock":return t?a(()=>import("./image-CxyHP7w7.js"),[]).then(e=>e.default):a(()=>import("./index-Ce98wt2N.js"),[]).then(e=>e.wallet);case"finance.plena":return t?a(()=>import("./image-Cwg1QVuh.js"),[]).then(e=>e.default):a(()=>import("./index-BG1ZQeCA.js"),[]).then(e=>e.wallet);case"cc.dropp":return t?a(()=>import("./image-CAIffJi4.js"),[]).then(e=>e.default):a(()=>import("./index-HFnaQWCU.js"),[]).then(e=>e.wallet);case"io.scramberry":return t?a(()=>import("./image-D8ARN-Gu.js"),[]).then(e=>e.default):a(()=>import("./index-BIcsFldg.js"),[]).then(e=>e.wallet);case"xyz.bonuz":return t?a(()=>import("./image-HcidEyjv.js"),[]).then(e=>e.default):a(()=>import("./index-BZhX-e71.js"),[]).then(e=>e.wallet);case"com.bmawallet":return t?a(()=>import("./image-kZBIIBVa.js"),[]).then(e=>e.default):a(()=>import("./index-BM8c6qO-.js"),[]).then(e=>e.wallet);case"co.lifedefi":return t?a(()=>import("./image-DRpXk5be.js"),[]).then(e=>e.default):a(()=>import("./index-otRo5H2H.js"),[]).then(e=>e.wallet);case"com.get-verso":return t?a(()=>import("./image-CgzMLfDa.js"),[]).then(e=>e.default):a(()=>import("./index-DAEFTu29.js"),[]).then(e=>e.wallet);case"io.blocto":return t?a(()=>import("./image-FnAIuX7S.js"),[]).then(e=>e.default):a(()=>import("./index-ZITrt5Fi.js"),[]).then(e=>e.wallet);case"com.pandoshi":return t?a(()=>import("./image-PWpnYSKI.js"),[]).then(e=>e.default):a(()=>import("./index-BmXd0pys.js"),[]).then(e=>e.wallet);case"io.getclave":return t?a(()=>import("./image-rvsWf8U_.js"),[]).then(e=>e.default):a(()=>import("./index--rITGawC.js"),[]).then(e=>e.wallet);case"technology.jambo":return t?a(()=>import("./image-Bx8ULApC.js"),[]).then(e=>e.default):a(()=>import("./index-C2KnoZm4.js"),[]).then(e=>e.wallet);case"app.edge":return t?a(()=>import("./image-1-dOu4Yt.js"),[]).then(e=>e.default):a(()=>import("./index-stFagoJS.js"),[]).then(e=>e.wallet);case"io.banksocial":return t?a(()=>import("./image-OrIz0o8m.js"),[]).then(e=>e.default):a(()=>import("./index-Ia3LffGn.js"),[]).then(e=>e.wallet);case"io.konio":return t?a(()=>import("./image-C2Wl7RAy.js"),[]).then(e=>e.default):a(()=>import("./index-B-kI7R4f.js"),[]).then(e=>e.wallet);case"com.qubetics":return t?a(()=>import("./image-DLvMDcgw.js"),[]).then(e=>e.default):a(()=>import("./index-C_j5E1ow.js"),[]).then(e=>e.wallet);case"app.imem":return t?a(()=>import("./image-Atwyf6cQ.js"),[]).then(e=>e.default):a(()=>import("./index-KXLAu1y1.js"),[]).then(e=>e.wallet);case"com.purechain":return t?a(()=>import("./image-DgU8tR58.js"),[]).then(e=>e.default):a(()=>import("./index-G-h-xM0C.js"),[]).then(e=>e.wallet);case"io.ethos":return t?a(()=>import("./image-DmNOl1OW.js"),[]).then(e=>e.default):a(()=>import("./index-DmLPMpkA.js"),[]).then(e=>e.wallet);case"io.didwallet":return t?a(()=>import("./image-CzKmxeZp.js"),[]).then(e=>e.default):a(()=>import("./index-QGSP4PI8.js"),[]).then(e=>e.wallet);case"com.dextrade":return t?a(()=>import("./image-B_ozWfd0.js"),[]).then(e=>e.default):a(()=>import("./index-CdOxXIip.js"),[]).then(e=>e.wallet);case"org.kelp":return t?a(()=>import("./image-CcKS-8-S.js"),[]).then(e=>e.default):a(()=>import("./index-DUBZIaC-.js"),[]).then(e=>e.wallet);case"xyz.nestwallet":return t?a(()=>import("./image-Bq1UxveY.js"),[]).then(e=>e.default):a(()=>import("./index-uKvrIGe-.js"),[]).then(e=>e.wallet);case"com.cryptnox":return t?a(()=>import("./image-UFnS_pK0.js"),[]).then(e=>e.default):a(()=>import("./index-ComRbnem.js"),[]).then(e=>e.wallet);case"land.liker":return t?a(()=>import("./image-C_JPqQZj.js"),[]).then(e=>e.default):a(()=>import("./index-CId5PD0X.js"),[]).then(e=>e.wallet);case"io.hippowallet":return t?a(()=>import("./image-BdJA4XzW.js"),[]).then(e=>e.default):a(()=>import("./index-BTzbgIH6.js"),[]).then(e=>e.wallet);case"io.certhis":return t?a(()=>import("./image-bSOL4gQb.js"),[]).then(e=>e.default):a(()=>import("./index-BxtNhRvf.js"),[]).then(e=>e.wallet);case"io.safecryptowallet":return t?a(()=>import("./image-DFF2Z6Pk.js"),[]).then(e=>e.default):a(()=>import("./index-CWdL5XwO.js"),[]).then(e=>e.wallet);case"com.saify":return t?a(()=>import("./image-DOwBqPVS.js"),[]).then(e=>e.default):a(()=>import("./index-De1eZyIJ.js"),[]).then(e=>e.wallet);case"com.tiduswallet":return t?a(()=>import("./image-DzJAqGfB.js"),[]).then(e=>e.default):a(()=>import("./index-BMPGw_D6.js"),[]).then(e=>e.wallet);case"io.uptn.dapp-web":return t?a(()=>import("./image-C4ELurjg.js"),[]).then(e=>e.default):a(()=>import("./index-jsmqr-24.js"),[]).then(e=>e.wallet);case"com.it.onewallet":return t?a(()=>import("./image-CWCOKSln.js"),[]).then(e=>e.default):a(()=>import("./index-DHNwai-Z.js"),[]).then(e=>e.wallet);case"com.rktechworks":return t?a(()=>import("./image-BhECDi_9.js"),[]).then(e=>e.default):a(()=>import("./index-D6xvjdG0.js"),[]).then(e=>e.wallet);case"com.revelator.wallet":return t?a(()=>import("./image-nW5JvdXC.js"),[]).then(e=>e.default):a(()=>import("./index-CNl69Nv0.js"),[]).then(e=>e.wallet);case"com.sinohope":return t?a(()=>import("./image-D7P0qSfx.js"),[]).then(e=>e.default):a(()=>import("./index-DKzyJcIY.js"),[]).then(e=>e.wallet);case"network.dgg":return t?a(()=>import("./image-DrraBYJZ.js"),[]).then(e=>e.default):a(()=>import("./index-DnUUaSfF.js"),[]).then(e=>e.wallet);case"io.up":return t?a(()=>import("./image-DbpOM2LD.js"),[]).then(e=>e.default):a(()=>import("./index-BuWGQyCe.js"),[]).then(e=>e.wallet);case"com.lif3":return t?a(()=>import("./image-DC2DOoz2.js"),[]).then(e=>e.default):a(()=>import("./index-BKkJhanY.js"),[]).then(e=>e.wallet);case"io.bimwallet":return t?a(()=>import("./image-BKSQyIc5.js"),[]).then(e=>e.default):a(()=>import("./index-3DerMn1X.js"),[]).then(e=>e.wallet);case"pub.dg":return t?a(()=>import("./image-C4KoLZ1v.js"),[]).then(e=>e.default):a(()=>import("./index-D6d2Y6jv.js"),[]).then(e=>e.wallet);case"com.wemix":return t?a(()=>import("./image-CawBnBIo.js"),[]).then(e=>e.default):a(()=>import("./index-18L0wZ74.js"),[]).then(e=>e.wallet);case"com.pierwallet":return t?a(()=>import("./image-DA8Sg5HZ.js"),[]).then(e=>e.default):a(()=>import("./index-mJTgSazQ.js"),[]).then(e=>e.wallet);case"net.stasis":return t?a(()=>import("./image-CyE6Mi3e.js"),[]).then(e=>e.default):a(()=>import("./index-CJ8I9s4o.js"),[]).then(e=>e.wallet);case"com.peakdefi":return t?a(()=>import("./image-DUcJQ0b3.js"),[]).then(e=>e.default):a(()=>import("./index-DEMIRENu.js"),[]).then(e=>e.wallet);case"com.3swallet":return t?a(()=>import("./image-CD3he1Tj.js"),[]).then(e=>e.default):a(()=>import("./index-DVGcX2HE.js"),[]).then(e=>e.wallet);case"com.example.subdomain":return t?a(()=>import("./image-Cs2bevZt.js"),[]).then(e=>e.default):a(()=>import("./index-CJt068xh.js"),[]).then(e=>e.wallet);case"com.reown.appkit-lab":return t?a(()=>import("./image-CnDG0aor.js"),[]).then(e=>e.default):a(()=>import("./index-BzfyCotn.js"),[]).then(e=>e.wallet);case"com.opz":return t?a(()=>import("./image-D1qvgd7h.js"),[]).then(e=>e.default):a(()=>import("./index-CMGByxdA.js"),[]).then(e=>e.wallet);case"ai.spotonchain.platform":return t?a(()=>import("./image-C6QSWUy4.js"),[]).then(e=>e.default):a(()=>import("./index-Ba7PpD6d.js"),[]).then(e=>e.wallet);case"org.dailychain.wallet":return t?a(()=>import("./image-BJ_lqI1X.js"),[]).then(e=>e.default):a(()=>import("./index-DQa9pNJd.js"),[]).then(e=>e.wallet);case"app.omni":return t?a(()=>import("./image-CqLwuE__.js"),[]).then(e=>e.default):a(()=>import("./index-D_7wDcMK.js"),[]).then(e=>e.wallet);case"id.plumaa":return t?a(()=>import("./image-BvJKCSpY.js"),[]).then(e=>e.default):a(()=>import("./index-D45a0k-1.js"),[]).then(e=>e.wallet);case"io.ttmwallet":return t?a(()=>import("./image-Chg2WzE1.js"),[]).then(e=>e.default):a(()=>import("./index-CLikIjn_.js"),[]).then(e=>e.wallet);case"io.kgen":return t?a(()=>import("./image-DFYGQEwh.js"),[]).then(e=>e.default):a(()=>import("./index-BQWXi0by.js"),[]).then(e=>e.wallet);case"com.nufinetes":return t?a(()=>import("./image-CpFHTO_m.js"),[]).then(e=>e.default):a(()=>import("./index-B8De2hoC.js"),[]).then(e=>e.wallet);case"com.squirrelwallet":return t?a(()=>import("./image-bHJO6btW.js"),[]).then(e=>e.default):a(()=>import("./index-DyaPXLoO.js"),[]).then(e=>e.wallet);case"eu.trusteeglobal":return t?a(()=>import("./image-cDoShVvl.js"),[]).then(e=>e.default):a(()=>import("./index-B51294pb.js"),[]).then(e=>e.wallet);case"com.daffione":return t?a(()=>import("./image-Dtc98pdf.js"),[]).then(e=>e.default):a(()=>import("./index-BIXqJF5y.js"),[]).then(e=>e.wallet);case"com.saakuru.app":return t?a(()=>import("./image-TQLBEOIW.js"),[]).then(e=>e.default):a(()=>import("./index-CjVYDT09.js"),[]).then(e=>e.wallet);case"io.r0ar":return t?a(()=>import("./image-4bx5chOJ.js"),[]).then(e=>e.default):a(()=>import("./index-CfCXSq_b.js"),[]).then(e=>e.wallet);case"com.nodle":return t?a(()=>import("./image-tiHbZ1Vk.js"),[]).then(e=>e.default):a(()=>import("./index-BwL47YsA.js"),[]).then(e=>e.wallet);case"app.tofee":return t?a(()=>import("./image-DpHbdMp9.js"),[]).then(e=>e.default):a(()=>import("./index-Bk-uZV0j.js"),[]).then(e=>e.wallet);case"io.pltwallet":return t?a(()=>import("./image-BIDqxk8w.js"),[]).then(e=>e.default):a(()=>import("./index-eiEAIzdd.js"),[]).then(e=>e.wallet);case"org.talkapp":return t?a(()=>import("./image-BkKo9DtA.js"),[]).then(e=>e.default):a(()=>import("./index-BGGk2Hck.js"),[]).then(e=>e.wallet);case"io.ready":return t?a(()=>import("./image-BwjeUYie.js"),[]).then(e=>e.default):a(()=>import("./index-BQwDdmmS.js"),[]).then(e=>e.wallet);case"app.w3wallet":return t?a(()=>import("./image-Covp72ND.js"),[]).then(e=>e.default):a(()=>import("./index-Cb41eDDJ.js"),[]).then(e=>e.wallet);case"pro.ds.app":return t?a(()=>import("./image-Bktw-NJ-.js"),[]).then(e=>e.default):a(()=>import("./index-b5ABnFKj.js"),[]).then(e=>e.wallet);case"com.reown.docs":return t?a(()=>import("./image-V4qYiUxw.js"),[]).then(e=>e.default):a(()=>import("./index-DsgD7D-8.js"),[]).then(e=>e.wallet);case"com.apollox":return t?a(()=>import("./image-ss2LFlQu.js"),[]).then(e=>e.default):a(()=>import("./index-BLMjeGJ-.js"),[]).then(e=>e.wallet);case"com.ipmb":return t?a(()=>import("./image-CirJIT7l.js"),[]).then(e=>e.default):a(()=>import("./index-DP0utIbV.js"),[]).then(e=>e.wallet);case"com.payperless":return t?a(()=>import("./image-q4XfUN6v.js"),[]).then(e=>e.default):a(()=>import("./index-szNElS1a.js"),[]).then(e=>e.wallet);case"com.obliowallet":return t?a(()=>import("./image-BGxqJH7c.js"),[]).then(e=>e.default):a(()=>import("./index-JuvDLDuk.js"),[]).then(e=>e.wallet);case"app.keeper-wallet":return t?a(()=>import("./image-Dpgf4dcg.js"),[]).then(e=>e.default):a(()=>import("./index-DlfGjmz4.js"),[]).then(e=>e.wallet);case"io.paraswap":return t?a(()=>import("./image-CQKjvlto.js"),[]).then(e=>e.default):a(()=>import("./index-DjLE3t9q.js"),[]).then(e=>e.wallet);case"org.ecoinwallet":return t?a(()=>import("./image-C3Va51zP.js"),[]).then(e=>e.default):a(()=>import("./index-DFZNHq44.js"),[]).then(e=>e.wallet);case"fi.dropmate":return t?a(()=>import("./image-5xiz28Wo.js"),[]).then(e=>e.default):a(()=>import("./index-p0ATWoVh.js"),[]).then(e=>e.wallet);case"com.cryptokara":return t?a(()=>import("./image-Dqbrewdt.js"),[]).then(e=>e.default):a(()=>import("./index-Cfzzcvgo.js"),[]).then(e=>e.wallet);case"co.cyber.wallet":return t?a(()=>import("./image-BvkSxpXq.js"),[]).then(e=>e.default):a(()=>import("./index-e_qeQmc1.js"),[]).then(e=>e.wallet);case"com.kriptonio":return t?a(()=>import("./image-D_cIj1db.js"),[]).then(e=>e.default):a(()=>import("./index-Dxm6Y7eO.js"),[]).then(e=>e.wallet);case"digital.minerva":return t?a(()=>import("./image-D5wxf47e.js"),[]).then(e=>e.default):a(()=>import("./index-HnCuhDYJ.js"),[]).then(e=>e.wallet);case"com.mpcvault.broswerplugin":return t?a(()=>import("./image-BN4ovMrn.js"),[]).then(e=>e.default):a(()=>import("./index-BXY5tnuK.js"),[]).then(e=>e.wallet);case"com.liberawallet":return t?a(()=>import("./image-DyrMImIL.js"),[]).then(e=>e.default):a(()=>import("./index-Dqyfi4dm.js"),[]).then(e=>e.wallet);case"io.helixid":return t?a(()=>import("./image-Dkp4M1ik.js"),[]).then(e=>e.default):a(()=>import("./index-RJhc6LnM.js"),[]).then(e=>e.wallet);case"com.broearn":return t?a(()=>import("./image-JyGUnQ_N.js"),[]).then(e=>e.default):a(()=>import("./index-WsH2ZGfO.js"),[]).then(e=>e.wallet);case"io.altme":return t?a(()=>import("./image-MQbcgW7z.js"),[]).then(e=>e.default):a(()=>import("./index-CpMkh5pZ.js"),[]).then(e=>e.wallet);case"app.herewallet":return t?a(()=>import("./image-gnC_p3Da.js"),[]).then(e=>e.default):a(()=>import("./index-CecEswCv.js"),[]).then(e=>e.wallet);case"com.coinsdo":return t?a(()=>import("./image-DrHhCSDD.js"),[]).then(e=>e.default):a(()=>import("./index-DJYG2Vtc.js"),[]).then(e=>e.wallet);case"trade.flooz.wallet":return t?a(()=>import("./image-DaaIjpQJ.js"),[]).then(e=>e.default):a(()=>import("./index-C6EDKfcJ.js"),[]).then(e=>e.wallet);case"com.tapwallet":return t?a(()=>import("./image-BxeDPEwg.js"),[]).then(e=>e.default):a(()=>import("./index-BwCUvEoQ.js"),[]).then(e=>e.wallet);case"fun.tobi":return t?a(()=>import("./image-DmhgJWq-.js"),[]).then(e=>e.default):a(()=>import("./index-C1adBKyv.js"),[]).then(e=>e.wallet);case"com.bitnovo":return t?a(()=>import("./image-BTZyVpoA.js"),[]).then(e=>e.default):a(()=>import("./index-CaZIFXyW.js"),[]).then(e=>e.wallet);case"io.xucre":return t?a(()=>import("./image-DZ-B-aVa.js"),[]).then(e=>e.default):a(()=>import("./index-BBDAdmKp.js"),[]).then(e=>e.wallet);case"app.girin":return t?a(()=>import("./image-CkQb0YUH.js"),[]).then(e=>e.default):a(()=>import("./index-CpJZxSfI.js"),[]).then(e=>e.wallet);case"finance.panaroma":return t?a(()=>import("./image-Z9k3mhsb.js"),[]).then(e=>e.default):a(()=>import("./index-BIeLm-x3.js"),[]).then(e=>e.wallet);case"app.clot":return t?a(()=>import("./image-DZplWZyD.js"),[]).then(e=>e.default):a(()=>import("./index-BVQeUBdj.js"),[]).then(e=>e.wallet);case"io.transi":return t?a(()=>import("./image-Dc5zhKf6.js"),[]).then(e=>e.default):a(()=>import("./index-DDggnqr4.js"),[]).then(e=>e.wallet);case"world.qoin":return t?a(()=>import("./image-BPAkEl8k.js"),[]).then(e=>e.default):a(()=>import("./index-C9taR4Do.js"),[]).then(e=>e.wallet);case"com.greengloryglobal":return t?a(()=>import("./image-lOdcUtWG.js"),[]).then(e=>e.default):a(()=>import("./index-C-OT0KJG.js"),[]).then(e=>e.wallet);case"com.amazewallet":return t?a(()=>import("./image-2wmDBIB6.js"),[]).then(e=>e.default):a(()=>import("./index-DvXpQOkv.js"),[]).then(e=>e.wallet);case"zone.bitverse":return t?a(()=>import("./image-C6aZzydG.js"),[]).then(e=>e.default):a(()=>import("./index-CN6XdMAo.js"),[]).then(e=>e.wallet);case"social.gm2":return t?a(()=>import("./image-BqtrMo-7.js"),[]).then(e=>e.default):a(()=>import("./index-Coq7--sH.js"),[]).then(e=>e.wallet);case"io.ozonewallet":return t?a(()=>import("./image-BtnrRGhZ.js"),[]).then(e=>e.default):a(()=>import("./index-DFc7lZHb.js"),[]).then(e=>e.wallet);case"io.ukiss":return t?a(()=>import("./image-DFYwzuHA.js"),[]).then(e=>e.default):a(()=>import("./index-CE9n_StB.js"),[]).then(e=>e.wallet);case"finance.islamicoin":return t?a(()=>import("./image-CWG4tRzZ.js"),[]).then(e=>e.default):a(()=>import("./index-pcLdliEp.js"),[]).then(e=>e.wallet);case"io.copiosa":return t?a(()=>import("./image-DuQoo_kR.js"),[]).then(e=>e.default):a(()=>import("./index-CWmGdvBR.js"),[]).then(e=>e.wallet);case"world.fncy":return t?a(()=>import("./image-B5M2ftPa.js"),[]).then(e=>e.default):a(()=>import("./index-Ba45jQBJ.js"),[]).then(e=>e.wallet);case"io.moonstake":return t?a(()=>import("./image-zsArRLIF.js"),[]).then(e=>e.default):a(()=>import("./index-C7HuhgLE.js"),[]).then(e=>e.wallet);case"com.trusteeglobal":return t?a(()=>import("./image-iR_slvRo.js"),[]).then(e=>e.default):a(()=>import("./index-CNLH4wrU.js"),[]).then(e=>e.wallet);case"net.spatium":return t?a(()=>import("./image-DBFrM6tr.js"),[]).then(e=>e.default):a(()=>import("./index-BJBC3bLU.js"),[]).then(e=>e.wallet);case"co.filwallet":return t?a(()=>import("./image-Do8rO3zE.js"),[]).then(e=>e.default):a(()=>import("./index-D7FslwZl.js"),[]).then(e=>e.wallet);case"money.snowball":return t?a(()=>import("./image-3Q7PfsJG.js"),[]).then(e=>e.default):a(()=>import("./index-yOwMLl2f.js"),[]).then(e=>e.wallet);case"com.ennowallet":return t?a(()=>import("./image-Ccx8wDSE.js"),[]).then(e=>e.default):a(()=>import("./index-BRIQuVzg.js"),[]).then(e=>e.wallet);case"io.safematrix":return t?a(()=>import("./image-BX4sAPzh.js"),[]).then(e=>e.default):a(()=>import("./index-Yk_iQY25.js"),[]).then(e=>e.wallet);case"pro.assure":return t?a(()=>import("./image-DMTT8AeN.js"),[]).then(e=>e.default):a(()=>import("./index-BfYVYwh5.js"),[]).then(e=>e.wallet);case"com.neftipedia":return t?a(()=>import("./image-vrSaD0K9.js"),[]).then(e=>e.default):a(()=>import("./index-BHZDuU0I.js"),[]).then(e=>e.wallet);case"io.goldbit":return t?a(()=>import("./image-CtiFcEL8.js"),[]).then(e=>e.default):a(()=>import("./index-DFrKYv4g.js"),[]).then(e=>e.wallet);case"com.coingrig":return t?a(()=>import("./image-NsVKBwxZ.js"),[]).then(e=>e.default):a(()=>import("./index-DcyXtFTG.js"),[]).then(e=>e.wallet);case"io.xfun":return t?a(()=>import("./image-CPMDxql6.js"),[]).then(e=>e.default):a(()=>import("./index-B05algAv.js"),[]).then(e=>e.wallet);case"com.antiersolutions":return t?a(()=>import("./image-BMh4HSr7.js"),[]).then(e=>e.default):a(()=>import("./index-DufOfQ90.js"),[]).then(e=>e.wallet);case"com.itoken":return t?a(()=>import("./image-BwBO8BTi.js"),[]).then(e=>e.default):a(()=>import("./index-BftqI1FU.js"),[]).then(e=>e.wallet);case"com.cardstack":return t?a(()=>import("./image-D7Sd6W8U.js"),[]).then(e=>e.default):a(()=>import("./index-BiHhxeDt.js"),[]).then(e=>e.wallet);case"io.slavi":return t?a(()=>import("./image-BQUnnXTb.js"),[]).then(e=>e.default):a(()=>import("./index-Kt6GlPCW.js"),[]).then(e=>e.wallet);case"tech.defiantapp":return t?a(()=>import("./image-D4-YMi52.js"),[]).then(e=>e.default):a(()=>import("./index-DPic1oJg.js"),[]).then(e=>e.wallet);case"com.dexari":return t?a(()=>import("./image-BoANtDMS.js"),[]).then(e=>e.default):a(()=>import("./index-DPFoWmV6.js"),[]).then(e=>e.wallet);case"io.cfcx":return t?a(()=>import("./image-139plIjh.js"),[]).then(e=>e.default):a(()=>import("./index-Cws1zSAX.js"),[]).then(e=>e.wallet);case"com.socjsc":return t?a(()=>import("./image-Crp2YP47.js"),[]).then(e=>e.default):a(()=>import("./index-C_XOoDbk.js"),[]).then(e=>e.wallet);case"com.tokenb":return t?a(()=>import("./image-8LnJ1bNt.js"),[]).then(e=>e.default):a(()=>import("./index-DcwbqEHj.js"),[]).then(e=>e.wallet);case"org.onyx":return t?a(()=>import("./image-DKcWaLtu.js"),[]).then(e=>e.default):a(()=>import("./index-C5NL4PoV.js"),[]).then(e=>e.wallet);case"io.gk8":return t?a(()=>import("./image-ZwibGfzR.js"),[]).then(e=>e.default):a(()=>import("./index-CLxj2t1J.js"),[]).then(e=>e.wallet);case"com.anchorage":return t?a(()=>import("./image-OT0Fb2Nb.js"),[]).then(e=>e.default):a(()=>import("./index-aoLVKFG1.js"),[]).then(e=>e.wallet);case"com.hashport.wallet":return t?a(()=>import("./image-DooF_Vfs.js"),[]).then(e=>e.default):a(()=>import("./index-DICTy0sa.js"),[]).then(e=>e.wallet);case"io.billionwallet":return t?a(()=>import("./image-DDBzbPSl.js"),[]).then(e=>e.default):a(()=>import("./index-CmCRou09.js"),[]).then(e=>e.wallet);case"com.dlicom":return t?a(()=>import("./image-lXBTHYnD.js"),[]).then(e=>e.default):a(()=>import("./index-l8DhIVZW.js"),[]).then(e=>e.wallet);case"com.tychiwallet":return t?a(()=>import("./image-pcyfaNhf.js"),[]).then(e=>e.default):a(()=>import("./index-B3vR_dtk.js"),[]).then(e=>e.wallet);case"at.swe":return t?a(()=>import("./image-C8_9fy1e.js"),[]).then(e=>e.default):a(()=>import("./index-ficai7Ce.js"),[]).then(e=>e.wallet);case"network.wali":return t?a(()=>import("./image-CSyxcTwp.js"),[]).then(e=>e.default):a(()=>import("./index-Dzkop1Gk.js"),[]).then(e=>e.wallet);case"io.diamante":return t?a(()=>import("./image-Dh9w9A8z.js"),[]).then(e=>e.default):a(()=>import("./index-C1a5oPtZ.js"),[]).then(e=>e.wallet);case"ai.interlinklabs":return t?a(()=>import("./image-Dz82Zyfj.js"),[]).then(e=>e.default):a(()=>import("./index-BTqXeJHf.js"),[]).then(e=>e.wallet);case"com.walllet":return t?a(()=>import("./image-VFWT6oS6.js"),[]).then(e=>e.default):a(()=>import("./index-DPgWRg9-.js"),[]).then(e=>e.wallet);case"org.lunascape":return t?a(()=>import("./image-D4nkyGrg.js"),[]).then(e=>e.default):a(()=>import("./index-4Nmn8ium.js"),[]).then(e=>e.wallet);case"com.nvxowallet":return t?a(()=>import("./image-BoS2kgXC.js"),[]).then(e=>e.default):a(()=>import("./index-CRRdY0XA.js"),[]).then(e=>e.wallet);case"today.paywithcrypto.wallet":return t?a(()=>import("./image-CsUCYFyx.js"),[]).then(e=>e.default):a(()=>import("./index-CFUSXkKo.js"),[]).then(e=>e.wallet);case"ai.iluminary":return t?a(()=>import("./image-CEuSmI3b.js"),[]).then(e=>e.default):a(()=>import("./index-D1j-SvoJ.js"),[]).then(e=>e.wallet);case"io.reactwallet":return t?a(()=>import("./image-B3lDLhwe.js"),[]).then(e=>e.default):a(()=>import("./index-CTs1t6rA.js"),[]).then(e=>e.wallet);case"com.rewardywallet":return t?a(()=>import("./image-DVyDRAAO.js"),[]).then(e=>e.default):a(()=>import("./index-cF_6KJvb.js"),[]).then(e=>e.wallet);case"io.walletv":return t?a(()=>import("./image-CTBdimeM.js"),[]).then(e=>e.default):a(()=>import("./index-He5kaR9n.js"),[]).then(e=>e.wallet);case"app.outlawgames":return t?a(()=>import("./image-BPqXYngz.js"),[]).then(e=>e.default):a(()=>import("./index-D2hPph8l.js"),[]).then(e=>e.wallet);case"io.ironwallet":return t?a(()=>import("./image-BKNtkg6s.js"),[]).then(e=>e.default):a(()=>import("./index-B1-qcL-p.js"),[]).then(e=>e.wallet);case"com.mecowallet":return t?a(()=>import("./image-m7IlStdm.js"),[]).then(e=>e.default):a(()=>import("./index-BdgyG9Qa.js"),[]).then(e=>e.wallet);case"com.onlybulls":return t?a(()=>import("./image-qLUwfjzV.js"),[]).then(e=>e.default):a(()=>import("./index-DPPIbXj8.js"),[]).then(e=>e.wallet);case"me.qiewallet":return t?a(()=>import("./image-BHJFFIIN.js"),[]).then(e=>e.default):a(()=>import("./index-D6zAueb_.js"),[]).then(e=>e.wallet);case"fund.lflabs":return t?a(()=>import("./image-dO78_uyn.js"),[]).then(e=>e.default):a(()=>import("./index-BBkeSt5m.js"),[]).then(e=>e.wallet);case"io.walletverse":return t?a(()=>import("./image-DUk3AUBd.js"),[]).then(e=>e.default):a(()=>import("./index-CfO_m3oL.js"),[]).then(e=>e.wallet);case"com.berasig":return t?a(()=>import("./image-CisWvLpc.js"),[]).then(e=>e.default):a(()=>import("./index-Cg1E5HxJ.js"),[]).then(e=>e.wallet);case"app.phantom":return t?a(()=>import("./image-6levnvAC.js"),[]).then(e=>e.default):a(()=>import("./index-IBUgXgOa.js"),[]).then(e=>e.wallet);case"com.coinbase.wallet":return t?a(()=>import("./image-C6EsuPXB.js"),[]).then(e=>e.default):a(()=>import("./index-BILUwmJ9.js"),[]).then(e=>e.wallet);case"io.rabby":return t?a(()=>import("./image-CZ2qSHpt.js"),[]).then(e=>e.default):a(()=>import("./index-Bprjmfje.js"),[]).then(e=>e.wallet);case"com.brave.wallet":return t?a(()=>import("./image-9Jtg22X3.js"),[]).then(e=>e.default):a(()=>import("./index-DKbx-y78.js"),[]).then(e=>e.wallet);case"fi.nu":return t?a(()=>import("./image-BAl5qyeX.js"),[]).then(e=>e.default):a(()=>import("./index-BXi61TZ5.js"),[]).then(e=>e.wallet);case"pro.hinkal.walletconnect":return t?a(()=>import("./image-d8n8A6si.js"),[]).then(e=>e.default):a(()=>import("./index-CujrNB-Q.js"),[]).then(e=>e.wallet);case"com.moongate.one":return t?a(()=>import("./image-DZc2BYzk.js"),[]).then(e=>e.default):a(()=>import("./index-B2WV7sR7.js"),[]).then(e=>e.wallet);case"tech.levain":return t?a(()=>import("./image-DcIu3U38.js"),[]).then(e=>e.default):a(()=>import("./index-CEpc_g8h.js"),[]).then(e=>e.wallet);case"com.enkrypt":return t?a(()=>import("./image-DvpdMMzF.js"),[]).then(e=>e.default):a(()=>import("./index-Cc4uopde.js"),[]).then(e=>e.wallet);case"com.scramble":return t?a(()=>import("./image-DT5Fvf2s.js"),[]).then(e=>e.default):a(()=>import("./index-D4Sgj1mL.js"),[]).then(e=>e.wallet);case"io.finoa":return t?a(()=>import("./image-D_i0o0Nv.js"),[]).then(e=>e.default):a(()=>import("./index-DFghxfjK.js"),[]).then(e=>e.wallet);case"com.blazpay.wallet":return t?a(()=>import("./image-CgHABHdL.js"),[]).then(e=>e.default):a(()=>import("./index-B_OXuBhF.js"),[]).then(e=>e.wallet);case"io.getjoin.prd":return t?a(()=>import("./image-CmWdSXJI.js"),[]).then(e=>e.default):a(()=>import("./index-QvBzJwgv.js"),[]).then(e=>e.wallet);case"xyz.talisman":return t?a(()=>import("./image-VlTaWJmy.js"),[]).then(e=>e.default):a(()=>import("./index-BgbYZOnC.js"),[]).then(e=>e.wallet);case"eu.flashsoft.clear-wallet":return t?a(()=>import("./image-gxCVLutB.js"),[]).then(e=>e.default):a(()=>import("./index-BBiL2lyk.js"),[]).then(e=>e.wallet);case"app.berasig":return t?a(()=>import("./image-BjTMD2k8.js"),[]).then(e=>e.default):a(()=>import("./index-DkcP2fCc.js"),[]).then(e=>e.wallet);case"com.wallet.reown":return t?a(()=>import("./image-CC2_AL18.js"),[]).then(e=>e.default):a(()=>import("./index-BEx6ckei.js"),[]).then(e=>e.wallet);case"io.runonflux.sspwallet":return t?a(()=>import("./image-DfzpWAED.js"),[]).then(e=>e.default):a(()=>import("./index-CrUcAJK0.js"),[]).then(e=>e.wallet);case"com.blanqlabs.wallet":return t?a(()=>import("./image-wR942Jk6.js"),[]).then(e=>e.default):a(()=>import("./index-DBst6Hla.js"),[]).then(e=>e.wallet);case"io.hero.wallet":return t?a(()=>import("./image-BbH7e9pw.js"),[]).then(e=>e.default):a(()=>import("./index-BBANTdk4.js"),[]).then(e=>e.wallet);case"network.verified.custody":return t?a(()=>import("./image-DpjDzWCs.js"),[]).then(e=>e.default):a(()=>import("./index-CyhgnW_d.js"),[]).then(e=>e.wallet);case"console.utila.io":return t?a(()=>import("./image-C7tHBnQp.js"),[]).then(e=>e.default):a(()=>import("./index-BrOCsLbf.js"),[]).then(e=>e.wallet);case"com.micet.wallet":return t?a(()=>import("./image-On2ij4Ix.js"),[]).then(e=>e.default):a(()=>import("./index-JAAqCLcG.js"),[]).then(e=>e.wallet);case"world.dolphinode.chain":return t?a(()=>import("./image-BXzPnbc4.js"),[]).then(e=>e.default):a(()=>import("./index-CiwBOkla.js"),[]).then(e=>e.wallet);case"com.lootrush":return t?a(()=>import("./image-t4jvKgpV.js"),[]).then(e=>e.default):a(()=>import("./index-BLsnOBhg.js"),[]).then(e=>e.wallet);case"xyz.dawnwallet":return t?a(()=>import("./image-bpacFMFT.js"),[]).then(e=>e.default):a(()=>import("./index-BqK7Phb6.js"),[]).then(e=>e.wallet);case"xyz.abs":return t?a(()=>import("./image-DFo7XMVJ.js"),[]).then(e=>e.default):a(()=>import("./index-8Ff6vDUD.js"),[]).then(e=>e.wallet);case"sh.frame":return t?a(()=>import("./image-C1w2WpL5.js"),[]).then(e=>e.default):a(()=>import("./index-cAvSYrmF.js"),[]).then(e=>e.wallet);case"io.useglyph":return t?a(()=>import("./image-C46yxCl4.js"),[]).then(e=>e.default):a(()=>import("./index-DE_8irSD.js"),[]).then(e=>e.wallet);case"org.base.account":return t?a(()=>import("./image-Ds78yECl.js"),[]).then(e=>e.default):a(()=>import("./index-kNZGxYSe.js"),[]).then(e=>e.wallet);default:throw new Error(`Wallet with id ${r} not found`)}}function Uh(){const r=new Map;return{emit(t,e){const n=r.get(t);if(n)for(const i of n)i(e)},subscribe(t,e){var n;return r.has(t)?(n=r.get(t))==null||n.add(e):r.set(t,new Set([e])),()=>{const i=r.get(t);i&&i.delete(e)}}}}function dr(){return Uh()}function qh(r){const{createOptions:t}=r,e=dr();let n,i;function s(){n=void 0,i=void 0}let o=async()=>{},c=async d=>{i=d};const l=e.subscribe("chainChanged",d=>{i=d}),u=e.subscribe("disconnect",()=>{s(),l(),u()});return e.subscribe("accountChanged",d=>{n=d}),{autoConnect:async d=>{const{autoConnectBaseAccountSDK:h}=await a(async()=>{const{autoConnectBaseAccountSDK:b}=await Promise.resolve().then(()=>Do);return{autoConnectBaseAccountSDK:b}},void 0),p=await r.providerFactory(),[_,f,m,y]=await h(d,e,p);return n=_,i=f,o=m,c=y,Be({chainId:i.id,client:d.client,walletAddress:n.address,walletType:Pt}),n},connect:async d=>{const{connectBaseAccountSDK:h}=await a(async()=>{const{connectBaseAccountSDK:b}=await Promise.resolve().then(()=>Do);return{connectBaseAccountSDK:b}},void 0),p=await r.providerFactory(),[_,f,m,y]=await h(d,e,p);return n=_,i=f,o=m,c=y,Be({chainId:i.id,client:d.client,walletAddress:n.address,walletType:Pt}),n},disconnect:async()=>{s(),await o()},getAccount:()=>n,getChain(){if(i)return i=lr(i.id)||i,i},getConfig:()=>t,id:Pt,subscribe:e.subscribe,switchChain:async d=>{await c(d)}}}function Wn(){if(!Fc())return{description:"thirdweb powered dApp",logoUrl:"https://thirdweb.com/favicon.ico",name:"thirdweb powered dApp",url:"https://thirdweb.com"};const{protocol:r,hostname:t,port:e}=window.location;let n=`${r}//${t}`;e&&e!=="80"&&e!=="443"&&(n+=`:${e}`);const i=`${n}/favicon.ico`;return{description:window.document.title||"thirdweb powered dApp",logoUrl:i,name:window.document.title||"thirdweb powered dApp",url:n}}let Ei,vn;async function Zc(r){var s,o,c,l,u,d,h;if(Ei){if(r&&vn){const p=((s=vn.chains)==null?void 0:s.map(y=>y.id))||[],_=((o=r.chains)==null?void 0:o.map(y=>y.id))||[],f=p.length===_.length&&p.every((y,b)=>y===_[b]),m=((c=r.appMetadata)==null?void 0:c.name)===((l=vn.appMetadata)==null?void 0:l.name);(!f||!m)&&console.warn("[Base Account SDK] Provider already initialized with different options. The Base Account SDK uses a singleton provider - subsequent configurations are ignored. Create only one Base Account wallet instance per application.")}return Ei}const{createBaseAccountSDK:t}=await a(async()=>{const{createBaseAccountSDK:p}=await import("./index-yCStn-Jf.js");return{createBaseAccountSDK:p}},__vite__mapDeps([8,9,3,4,1,2,10,11,12,13,5,6,14,15])),e=Wn(),i=t({appName:((u=r==null?void 0:r.appMetadata)==null?void 0:u.name)||e.name||"thirdweb powered dApp",appLogoUrl:((d=r==null?void 0:r.appMetadata)==null?void 0:d.logoUrl)||e.logoUrl||null,appChainIds:((h=r==null?void 0:r.chains)==null?void 0:h.map(p=>p.id))||[]}).getProvider();return Ei=i,vn=r,i}function Yc(r){return r.id===Pt}function Lo({provider:r,address:t,client:e}){const n={address:Z(t),async sendTransaction(i){const s=await r.request({method:"eth_sendTransaction",params:[{accessList:i.accessList,data:i.data,from:Z(t),gas:i.gas?De(i.gas):void 0,to:i.to,value:i.value?De(i.value):void 0}]});return Cs({chainId:i.chainId,client:e,contractAddress:i.to??void 0,gasPrice:i.gasPrice,transactionHash:s,walletAddress:Z(t),walletType:Pt}),{transactionHash:s}},async signMessage({message:i}){if(!n.address)throw new Error("Provider not setup");const s=typeof i=="string"?xs(i):i.raw instanceof Uint8Array?ri(i.raw):i.raw,o=await r.request({method:"personal_sign",params:[s,n.address]});if(!tn(o))throw new Error("Invalid signature returned");return o},async signTypedData(i){if(!n.address)throw new Error("Provider not setup");const{domain:s,message:o,primaryType:c}=js(i),l={EIP712Domain:Dc(s),...i.types};Vc({domain:s,message:o,primaryType:c,types:l});const u=Sc({domain:s??{},message:o,primaryType:c,types:l}),d=await r.request({method:"eth_signTypedData_v4",params:[n.address,u]});if(!tn(d))throw new Error("Invalid signed payload returned");return d},sendCalls:async i=>{try{const{callParams:s,chain:o}=await Fs(i,n),c=await r.request({method:"wallet_sendCalls",params:s});return c&&typeof c=="object"&&"id"in c?{chain:o,client:e,id:c.id}:{chain:o,client:e,id:c}}catch(s){throw/unsupport|not support/i.test(s.message)?new Error(`${Pt} errored calling wallet_sendCalls, with error: ${s instanceof Error?s.message:we(s)}`):s}},async getCallsStatus(i){try{const s=await r.request({method:"wallet_getCallsStatus",params:[i.id]});return zs(s)}catch(s){throw/unsupport|not support/i.test(s.message)?new Error(`${Pt} does not support wallet_getCallsStatus, reach out to them directly to request EIP-5792 support.`):s}},async getCapabilities(i){const s=i.chainId;try{const o=await r.request({method:"wallet_getCapabilities",params:[Z(n.address)]});return Ks(o,s)}catch(o){if(/unsupport|not support|not available/i.test(o.message))return{message:`${Pt} does not support wallet_getCapabilities, reach out to them directly to request EIP-5792 support.`};throw o}}};return n}function Qc(r,t,e,n,i){const s=Lo({address:r,client:i,provider:e});async function o(){e.off("accountsChanged",l),e.off("chainChanged",u),e.off("disconnect",c),await e.disconnect()}async function c(){o(),n.emit("disconnect",void 0)}function l(d){if(d[0]){const h=Lo({address:Z(d[0]),client:i,provider:e});n.emit("accountChanged",h),n.emit("accountsChanged",d)}else c()}function u(d){const h=ge(lt(d));n.emit("chainChanged",h)}return e.on("accountsChanged",l),e.on("chainChanged",u),e.on("disconnect",c),[s,t,c,d=>Xc(e,d)]}async function Mh(r,t,e){const n=await e.request({method:"eth_requestAccounts"});if(!n[0])throw new Error("No accounts found");const i=Z(n[0]),s=await e.request({method:"eth_chainId"}),o=lt(s);let c=r.chain&&r.chain.id===o?r.chain:ge(o);return o&&(r!=null&&r.chain)&&o!==(r==null?void 0:r.chain.id)&&(await Xc(e,r.chain),c=r.chain),Qc(i,c,e,t,r.client)}async function Bh(r,t,e){const i=(await e.request({method:"eth_accounts"}))[0];if(!i)throw new Error("No accounts found");const s=await e.request({method:"eth_chainId"}),o=lt(s),c=r.chain&&r.chain.id===o?r.chain:ge(o);return Qc(i,c,e,t,r.client)}async function Xc(r,t){var s;const e=await r.request({method:"eth_chainId"}),n=ge(lt(e));if((n==null?void 0:n.id)===t.id)return;const i=De(t.id);try{await r.request({method:"wallet_switchEthereumChain",params:[{chainId:i}]})}catch(o){const c=await Us(t);(o==null?void 0:o.code)===4902&&await r.request({method:"wallet_addEthereumChain",params:[{blockExplorerUrls:((s=c.explorers)==null?void 0:s.map(l=>l.url))||[],chainId:i,chainName:c.name,nativeCurrency:c.nativeCurrency,rpcUrls:Ws(c)}]})}}const Do=Object.freeze(Object.defineProperty({__proto__:null,autoConnectBaseAccountSDK:Bh,connectBaseAccountSDK:Mh,getBaseAccountWebProvider:Zc,isBaseAccountSDKWallet:Yc},Symbol.toStringTag,{value:"Module"}));function jh(r){const{createOptions:t}=r,e=dr();let n,i;function s(){n=void 0,i=void 0}let o=async()=>{},c=async d=>{i=d};const l=e.subscribe("chainChanged",d=>{i=d}),u=e.subscribe("disconnect",()=>{s(),l(),u()});return e.subscribe("accountChanged",d=>{n=d}),{autoConnect:async d=>{const{autoConnectCoinbaseWalletSDK:h}=await a(async()=>{const{autoConnectCoinbaseWalletSDK:b}=await Promise.resolve().then(()=>So);return{autoConnectCoinbaseWalletSDK:b}},void 0),p=await r.providerFactory(),[_,f,m,y]=await h(d,e,p);return n=_,i=f,o=m,c=y,Be({chainId:i.id,client:d.client,walletAddress:n.address,walletType:ft}),n},connect:async d=>{const{connectCoinbaseWalletSDK:h}=await a(async()=>{const{connectCoinbaseWalletSDK:b}=await Promise.resolve().then(()=>So);return{connectCoinbaseWalletSDK:b}},void 0),p=await r.providerFactory(),[_,f,m,y]=await h(d,e,p);return n=_,i=f,o=m,c=y,Be({chainId:i.id,client:d.client,walletAddress:n.address,walletType:ft}),n},disconnect:async()=>{s(),await o()},getAccount:()=>n,getChain(){if(i)return i=lr(i.id)||i,i},getConfig:()=>t,id:ft,onConnectRequested:async()=>{var d;if(r.onConnectRequested){const h=await r.providerFactory();return(d=r.onConnectRequested)==null?void 0:d.call(r,h)}},subscribe:e.subscribe,switchChain:async d=>{await c(d)}}}async function el(r){var t,e;await((e=(t=r==null?void 0:r.communicator)==null?void 0:t.waitForPopupLoaded)==null?void 0:e.call(t))}const zh=Object.freeze(Object.defineProperty({__proto__:null,showCoinbasePopup:el},Symbol.toStringTag,{value:"Module"}));let vi;async function tl(r){var t,e;if(!vi){let n=(await a(()=>import("./index-B-V1pT7O.js"),__vite__mapDeps([16,3,4,1,2,9]))).default;typeof n!="function"&&typeof n.default=="function"&&(n=n.default);const s=new n({appChainIds:r!=null&&r.chains?r.chains.map(o=>o.id):void 0,appLogoUrl:((t=r==null?void 0:r.appMetadata)==null?void 0:t.logoUrl)||Wn().logoUrl,appName:((e=r==null?void 0:r.appMetadata)==null?void 0:e.name)||Wn().name}).makeWeb3Provider(r==null?void 0:r.walletConfig);return vi=s,s}return vi}function Vo({provider:r,address:t,client:e}){const n={address:Z(t),onTransactionRequested:async()=>{window.localStorage&&window.localStorage.getItem("-CBWSDK:SignerConfigurator:SignerType")==="scw"&&await el(r)},async sendTransaction(i){const s=await r.request({method:"eth_sendTransaction",params:[{accessList:i.accessList,data:i.data,from:Z(t),gas:i.gas?De(i.gas):void 0,to:i.to,value:i.value?De(i.value):void 0}]});return Cs({chainId:i.chainId,client:e,contractAddress:i.to??void 0,gasPrice:i.gasPrice,transactionHash:s,walletAddress:Z(t),walletType:ft}),{transactionHash:s}},async signMessage({message:i}){if(!n.address)throw new Error("Provider not setup");const s=typeof i=="string"?xs(i):i.raw instanceof Uint8Array?ri(i.raw):i.raw,o=await r.request({method:"personal_sign",params:[s,n.address]});if(!tn(o))throw new Error("Invalid signature returned");return o},async signTypedData(i){if(!n.address)throw new Error("Provider not setup");const{domain:s,message:o,primaryType:c}=js(i),l={EIP712Domain:Dc(s),...i.types};Vc({domain:s,message:o,primaryType:c,types:l});const u=Sc({domain:s??{},message:o,primaryType:c,types:l}),d=await r.request({method:"eth_signTypedData_v4",params:[n.address,u]});if(!tn(d))throw new Error("Invalid signed payload returned");return d},sendCalls:async i=>{try{const{callParams:s,chain:o}=await Fs(i,n),c=await r.request({method:"wallet_sendCalls",params:s});return c&&typeof c=="object"&&"id"in c?{chain:o,client:e,id:c.id}:{chain:o,client:e,id:c}}catch(s){throw/unsupport|not support/i.test(s.message)?new Error(`${ft} errored calling wallet_sendCalls, with error: ${s instanceof Error?s.message:we(s)}`):s}},async getCallsStatus(i){try{const s=await r.request({method:"wallet_getCallsStatus",params:[i.id]});return zs(s)}catch(s){throw/unsupport|not support/i.test(s.message)?new Error(`${ft} does not support wallet_getCallsStatus, reach out to them directly to request EIP-5792 support.`):s}},async getCallsStatusRaw(i){try{return await r.request({method:"wallet_getCallsStatus",params:[i.id]})}catch(s){throw/unsupport|not support/i.test(s.message)?new Error(`${ft} does not support wallet_getCallsStatus, reach out to them directly to request EIP-5792 support.`):s}},async getCapabilities(i){const s=i.chainId;try{const o=await r.request({method:"wallet_getCapabilities",params:[Z(n.address)]});return Ks(o,s)}catch(o){if(/unsupport|not support|not available/i.test(o.message))return{message:`${ft} does not support wallet_getCapabilities, reach out to them directly to request EIP-5792 support.`};throw o}}};return n}function rl(r,t,e,n,i){const s=Vo({address:r,client:i,provider:e});async function o(){e.removeListener("accountsChanged",l),e.removeListener("chainChanged",u),e.removeListener("disconnect",c),await e.disconnect()}async function c(){o(),n.emit("disconnect",void 0)}function l(d){if(d[0]){const h=Vo({address:Z(d[0]),client:i,provider:e});n.emit("accountChanged",h),n.emit("accountsChanged",d)}else c()}function u(d){const h=ge(lt(d));n.emit("chainChanged",h)}return e.on("accountsChanged",l),e.on("chainChanged",u),e.on("disconnect",c),[s,t,c,d=>nl(e,d)]}async function Kh(r,t,e){const n=await e.request({method:"eth_requestAccounts"});if(!n[0])throw new Error("No accounts found");const i=Z(n[0]),s=await e.request({method:"eth_chainId"}),o=lt(s);let c=r.chain&&r.chain.id===o?r.chain:ge(o);return o&&(r!=null&&r.chain)&&o!==(r==null?void 0:r.chain.id)&&(await nl(e,r.chain),c=r.chain),rl(i,c,e,t,r.client)}async function Fh(r,t,e){const i=(await e.request({method:"eth_accounts"}))[0];if(!i)throw new Error("No accounts found");const s=await e.request({method:"eth_chainId"}),o=lt(s),c=r.chain&&r.chain.id===o?r.chain:ge(o);return rl(i,c,e,t,r.client)}async function nl(r,t){var s;const e=await r.request({method:"eth_chainId"}),n=ge(lt(e));if((n==null?void 0:n.id)===t.id)return;const i=De(t.id);try{await r.request({method:"wallet_switchEthereumChain",params:[{chainId:i}]})}catch(o){const c=await Us(t);(o==null?void 0:o.code)===4902&&await r.request({method:"wallet_addEthereumChain",params:[{blockExplorerUrls:((s=c.explorers)==null?void 0:s.map(l=>l.url))||[],chainId:i,chainName:c.name,nativeCurrency:c.nativeCurrency,rpcUrls:Ws(c)}]})}}const So=Object.freeze(Object.defineProperty({__proto__:null,autoConnectCoinbaseWalletSDK:Fh,connectCoinbaseWalletSDK:Kh,getCoinbaseWebProvider:tl},Symbol.toStringTag,{value:"Module"}));async function Wh(r){return qc(async()=>{var n;const e=await(await fetch(`${ii("inAppWallet")}/api/2024-05-05/ecosystem-wallet`,{headers:{"x-ecosystem-id":r}})).json();if(!e||e.code==="UNAUTHORIZED")throw new Error(e.message||`Could not find ecosystem wallet with id ${r}, please check your ecosystem wallet configuration.`);return(n=e.authOptions)!=null&&n.includes("siwe")&&(e.authOptions=e.authOptions.filter(i=>i!=="siwe"),e.authOptions.push("wallet")),e},{cacheKey:`ecosystem-wallet-options-${r}`,cacheTime:1e3*60*5})}const bi=new Map;async function Kr(r,t,e){var s;const n=we({clientId:r.clientId,ecosystem:e,partialSecretKey:(s=r.secretKey)==null?void 0:s.slice(0,5)});if(bi.has(n))return bi.get(n);const i=await t(r);return bi.set(n,i),i}function il(r){const{createOptions:t,connectorFactory:e,ecosystem:n}=r,i=n?n.id:"inApp",s=dr();let o=t,c,l,u,d,h=null;const p=async _=>{if(n){const f=await Wh(n.id),m=f==null?void 0:f.smartAccountOptions;if(m)if(f.smartAccountOptions.executionMode==="EIP7702")o={...o,executionMode:{mode:"EIP7702",sponsorGas:m.sponsorGas}};else{const{defaultChainId:b}=f.smartAccountOptions,O=(_==null?void 0:_.chain)??(b?ge(b):void 0);if(!O)throw new Error("A chain must be provided either via 'chain' in connect options or 'defaultChainId' in ecosystem configuration. Please pass it via connect() or update the ecosystem configuration.");o={...o,smartAccount:{chain:O,factoryAddress:m.accountFactoryAddress,sponsorGas:m.sponsorGas}}}}};return{autoConnect:async _=>{const{autoConnectInAppWallet:f}=await a(async()=>{const{autoConnectInAppWallet:g}=await Promise.resolve().then(()=>Wi);return{autoConnectInAppWallet:g}},void 0),m=await Kr(_.client,e,n);await p();const{account:y,chain:b,adminAccount:O}=await f(_,o,m);d=_.client,c=y,l=O,u=b;try{h=await m.storage.getAuthCookie()}catch(g){console.error("Failed to retrieve auth token:",g),h=null}return Be({chainId:u.id,client:_.client,ecosystem:n,walletAddress:c.address,walletType:i}),c},connect:async _=>{const{connectInAppWallet:f}=await a(async()=>{const{connectInAppWallet:g}=await Promise.resolve().then(()=>Wi);return{connectInAppWallet:g}},void 0),m=await Kr(_.client,e,n);await p();const{account:y,chain:b,adminAccount:O}=await f(_,o,m);d=_.client,c=y,l=O,u=b;try{h=await m.storage.getAuthCookie()}catch(g){console.error("Failed to retrieve auth token:",g),h=null}return Be({chainId:u.id,client:_.client,ecosystem:n,walletAddress:c.address,walletType:i}),c},disconnect:async()=>{if(d&&!(await(await Kr(d,e,n)).logout()).success)throw new Error("Failed to logout");c=void 0,l=void 0,u=void 0,h=null,s.emit("disconnect",void 0)},getAccount:()=>c,getAdminAccount:()=>l,getAuthToken:()=>h,getChain(){if(u)return u=lr(u.id)||u,u},getConfig:()=>o,id:i,subscribe:s.subscribe,switchChain:async _=>{var f;if((o!=null&&o.smartAccount||((f=o==null?void 0:o.executionMode)==null?void 0:f.mode)==="EIP4337")&&d&&c){const{autoConnectInAppWallet:m}=await a(async()=>{const{autoConnectInAppWallet:P}=await Promise.resolve().then(()=>Wi);return{autoConnectInAppWallet:P}},void 0),y=await Kr(d,e,n);await p({chain:_});const{account:b,chain:O,adminAccount:g}=await m({chain:_,client:d},o,y);l=g,c=b,u=O}else u=_;s.emit("chainChanged",_)}}}function sl(...r){const[t,e]=r,n={id:t,partnerId:e==null?void 0:e.partnerId};return il({connectorFactory:async i=>{const{InAppWebConnector:s}=await a(async()=>{const{InAppWebConnector:o}=await import("./web-connector-BSznc5-3.js");return{InAppWebConnector:o}},__vite__mapDeps([17,3,4,2,1,18,5,6,7]));return new s({client:i,ecosystem:n,storage:e==null?void 0:e.storage})},createOptions:{auth:{...e==null?void 0:e.auth,options:[]},partnerId:n.partnerId},ecosystem:n})}function Yi(r){return il({connectorFactory:async t=>{var n;const{InAppWebConnector:e}=await a(async()=>{const{InAppWebConnector:i}=await import("./web-connector-BSznc5-3.js");return{InAppWebConnector:i}},__vite__mapDeps([17,3,4,2,1,18,5,6,7]));return new e({client:t,passkeyDomain:(n=r==null?void 0:r.auth)==null?void 0:n.passkeyDomain,storage:r==null?void 0:r.storage})},createOptions:r})}function Gs(r){const t=dr();let e,n,i,s;return{autoConnect:async o=>{const{connectSmartAccount:c}=await a(async()=>{const{connectSmartAccount:d}=await import("./index-BqbPuN49.js");return{connectSmartAccount:d}},__vite__mapDeps([19,3,4,1,2,20,11,5,6,7])),[l,u]=await c(o,r);return s=o,e=l,i=u,Be({chainId:i.id,client:o.client,walletAddress:e.address,walletType:"smart"}),e},connect:async o=>{const{connectSmartAccount:c}=await a(async()=>{const{connectSmartAccount:d}=await import("./index-BqbPuN49.js");return{connectSmartAccount:d}},__vite__mapDeps([19,3,4,1,2,20,11,5,6,7])),[l,u]=await c(o,r);return n=o.personalAccount,s=o,e=l,i=u,Be({chainId:i.id,client:o.client,walletAddress:e.address,walletType:"smart"}),t.emit("accountChanged",e),e},disconnect:async()=>{if(e){const{disconnectSmartAccount:o}=await a(async()=>{const{disconnectSmartAccount:c}=await import("./index-BqbPuN49.js");return{disconnectSmartAccount:c}},__vite__mapDeps([19,3,4,1,2,20,11,5,6,7]));await o(e)}e=void 0,n=void 0,i=void 0,t.emit("disconnect",void 0)},getAccount:()=>e,getAdminAccount:()=>n,getChain(){if(i)return i=lr(i.id)||i,i},getConfig:()=>r,id:"smart",subscribe:t.subscribe,switchChain:async o=>{var h;if(!s)throw new Error("Cannot switch chain without a previous connection");if(!await ld(o)){const p=$s({address:r.factoryAddress||Ih((h=r.overrides)==null?void 0:h.entrypointAddress),chain:o,client:s.client});if(!await ud(p))throw new Error(`Factory contract not deployed on chain: ${o.id}`)}const{connectSmartAccount:l}=await a(async()=>{const{connectSmartAccount:p}=await import("./index-BqbPuN49.js");return{connectSmartAccount:p}},__vite__mapDeps([19,3,4,1,2,20,11,5,6,7])),[u,d]=await l({...s,chain:o},{...r,chain:o});e=u,i=d,t.emit("accountChanged",u),t.emit("chainChanged",d)}}}function at(...r){const[t,e]=r;switch(!0){case t==="smart":return Gs(e);case(t==="embedded"||t==="inApp"):return Yi(e);case Or(t):return sl(...r);case t===ft:{const n=e;return jh({createOptions:n,onConnectRequested:async i=>{const{showCoinbasePopup:s}=await a(async()=>{const{showCoinbasePopup:o}=await Promise.resolve().then(()=>zh);return{showCoinbasePopup:o}},void 0);return s(i)},providerFactory:()=>tl(n)})}case t===Pt:{const n=e;return qh({createOptions:n,providerFactory:()=>Zc(n)})}default:{let c=function(){i=void 0,s=void 0};const n=dr();let i,s,o,l=async()=>{};const u=n.subscribe("disconnect",()=>{c(),o==null||o(),u()});n.subscribe("accountChanged",_=>{i=_});let d=async()=>{throw new Error("Not implemented yet")};const h=Ro()?_=>gi(_):void 0,p={autoConnect:async _=>{const{injectedProvider:f}=await a(async()=>{const{injectedProvider:m}=await Promise.resolve().then(()=>Co);return{injectedProvider:m}},void 0);if(t!=="walletConnect"&&f(t)){const{autoConnectEip1193Wallet:m}=await a(async()=>{const{autoConnectEip1193Wallet:P}=await Promise.resolve().then(()=>ko);return{autoConnectEip1193Wallet:P}},void 0),[y,b,O,g]=await m({chain:_.chain,client:_.client,emitter:n,id:t,provider:Qi(t)});return i=y,s=b,l=O,d=g,o=n.subscribe("chainChanged",P=>{s=P}),Be({chainId:s.id,client:_.client,walletAddress:i.address,walletType:t}),i}if(_&&"client"in _){const{autoConnectWC:m}=await a(async()=>{const{autoConnectWC:P}=await import("./controller-ChEtySr4.js");return{autoConnectWC:P}},__vite__mapDeps([21,3,4,1,2,13,5,6,7])),[y,b,O,g]=await m(_,n,p.id,Fn,h);return i=y,s=b,l=O,d=g,Be({chainId:s.id,client:_.client,walletAddress:i.address,walletType:t}),i}throw new Error("Failed to auto connect")},connect:async _=>{async function f(b){var P;const{connectWC:O}=await a(async()=>{const{connectWC:A}=await import("./controller-ChEtySr4.js");return{connectWC:A}},__vite__mapDeps([21,3,4,1,2,13,5,6,7]));let g;try{const[A,E,D,L]=await O({...b,walletConnect:{...b.walletConnect,onDisplayUri:((P=b.walletConnect)==null?void 0:P.onDisplayUri)||(async w=>{var v,I;if(typeof window<"u"&&typeof document<"u")if(Ro()){const T=await Jc(t),V=T.mobile.native||T.mobile.universal;gi(V?xh(V,w).redirect:w);return}else try{const{createQROverlay:T}=await a(async()=>{const{createQROverlay:V}=await import("./qr-overlay-KOiqNJ7X.js");return{createQROverlay:V}},__vite__mapDeps([22,3,4]));g&&g.destroy(),g=T(w,{theme:((I=(v=b.walletConnect)==null?void 0:v.qrModalOptions)==null?void 0:I.themeMode)??"dark",qrSize:280,showCloseButton:!0,onCancel:()=>{var V,R;(R=(V=b.walletConnect)==null?void 0:V.onCancel)==null||R.call(V)}})}catch(T){console.error("Failed to create QR overlay:",T)}})}},n,p.id,Fn,h);return g&&(g.destroy(),g=void 0),i=A,s=E,l=D,d=L,Be({chainId:s.id,client:b.client,walletAddress:i.address,walletType:t}),i}catch(A){throw g&&(g.destroy(),g=void 0),A}}if(t==="walletConnect"){const{client:b,chain:O,...g}=_;return f({chain:O,client:b,walletConnect:{...g}})}const m=_&&"walletConnect"in _,{injectedProvider:y}=await a(async()=>{const{injectedProvider:b}=await Promise.resolve().then(()=>Co);return{injectedProvider:b}},void 0);if(y(t)&&!m){const{connectEip1193Wallet:b}=await a(async()=>{const{connectEip1193Wallet:E}=await Promise.resolve().then(()=>ko);return{connectEip1193Wallet:E}},void 0),[O,g,P,A]=await b({chain:_.chain,client:_.client,emitter:n,id:t,provider:Qi(t)});return i=O,s=g,l=P,d=A,o=n.subscribe("chainChanged",E=>{s=E}),Be({chainId:s.id,client:_.client,walletAddress:i.address,walletType:t}),i}if(_&&"client"in _)return f(_);throw new Error("Failed to connect")},disconnect:async()=>{c(),await l()},getAccount:()=>i,getChain(){if(s)return s=lr(s.id)||s,s},getConfig:()=>r[1],id:t,subscribe:n.subscribe,switchChain:async _=>{try{await d(_),s=_}catch(f){console.error("Error switching chain",f)}}};return p}}}function Hh(){return at("walletConnect")}const xo=Fc()?Rh():void 0;function Js(r){const t=Zs().find(e=>e.info.rdns===r);return t==null?void 0:t.provider}function ol(){return Zs().map(e=>e.info.rdns).map(e=>at(e))}function Gh(){if(xo)return xo}function Zs(){var t;const r=((t=Gh())==null?void 0:t.getProviders())||[];for(const e of r)if(e.info.rdns==="io.metamask.mobile"){e.info.rdns=Wc;break}return r}const Co=Object.freeze(Object.defineProperty({__proto__:null,getInstalledWalletProviders:Zs,getInstalledWallets:ol,injectedProvider:Js},Symbol.toStringTag,{value:"Module"}));function Qi(r){const t=Js(r);if(!t)throw new Error(`No injected provider found for wallet: "${r}"`);return t}async function al({id:r,provider:t,emitter:e,client:n,chain:i}){var p,_;let s,c=0;for(;!(s!=null&&s[0])&&c<3;){try{s=await t.request({method:"eth_requestAccounts"})}catch(f){if(console.error(f),(_=(p=Jh(f))==null?void 0:p.toLowerCase())!=null&&_.includes("rejected"))throw f;await new Promise(m=>setTimeout(m,500))}c++}const l=s==null?void 0:s[0];if(!l)throw new Error("Failed to connect to wallet, no accounts available");const u=Z(l),d=await t.request({method:"eth_chainId"}).then(lt).catch(f=>{throw new Error("Error reading chainId from provider",f)});let h=i&&i.id===d?i:ge(d);try{i&&typeof i.id<"u"&&i.id!==d&&(await ul(t,i),h=i)}catch{console.warn(`Error switching to chain ${i==null?void 0:i.id} - defaulting to wallet chain (${d})`)}return ll({address:u,chain:h,client:n,emitter:e,id:r,provider:t})}async function cl({id:r,provider:t,emitter:e,client:n,chain:i}){const o=(await t.request({method:"eth_accounts"}))[0];if(!o)throw new Error("Failed to connect to wallet, no accounts available");const c=Z(o),l=await t.request({method:"eth_chainId"}).then(lt),u=i&&i.id===l?i:ge(l);return ll({address:c,chain:u,client:n,emitter:e,id:r,provider:t})}function $o({provider:r,address:t,client:e,id:n}){const i={address:Z(t),async sendTransaction(s){const c=[{...s.gasPrice?{gasPrice:De(s.gasPrice)}:{maxFeePerGas:s.maxFeePerGas?De(s.maxFeePerGas):void 0,maxPriorityFeePerGas:s.maxPriorityFeePerGas?De(s.maxPriorityFeePerGas):void 0},from:this.address,gas:s.gas?De(s.gas):void 0,nonce:s.nonce?De(s.nonce):void 0,to:s.to?Z(s.to):void 0,data:s.data,value:s.value?De(s.value):void 0,authorizationList:s.authorizationList?pd(s.authorizationList):void 0,accessList:s.accessList,...s.eip712}];try{const l=await r.request({method:"eth_sendTransaction",params:c});return Cs({chainId:s.chainId,client:e,contractAddress:s.to??void 0,gasPrice:s.gasPrice,transactionHash:l,walletAddress:Z(t),walletType:n}),{transactionHash:l}}catch(l){throw _d(l)&&fd({chainId:s.chainId,client:e,contractAddress:s.to||void 0,error:l,transactionValue:s.value,walletAddress:Z(t)}),l}},async signMessage({message:s}){if(!i.address)throw new Error("Provider not setup");const o=typeof s=="string"?xs(s):s.raw instanceof Uint8Array?ri(s.raw):s.raw;return await r.request({method:"personal_sign",params:[o,Z(i.address)]})},async signAuthorization(s){const o=xc(s);let c;try{c=await r.request({method:"eth_sign",params:[Z(i.address),o]})}catch{c=await r.request({method:"secp256k1_sign",params:[o]})}if(!c)throw new Error("Failed to sign authorization");const l=hd(c);return{...s,...l}},async signTypedData(s){if(!r||!i.address)throw new Error("Provider not setup");const o=js(s),{domain:c,message:l,primaryType:u}=o,d={EIP712Domain:Ud({domain:c}),...o.types};qd({domain:c,message:l,primaryType:u,types:d});const h=Md({domain:c??{},message:l,primaryType:u,types:d});return await r.request({method:"eth_signTypedData_v4",params:[Z(i.address),h]})},async watchAsset(s){return await r.request({method:"wallet_watchAsset",params:s},{retryCount:0})},async sendCalls(s){try{const{callParams:o,chain:c}=await Fs(s,i),l=await r.request({method:"wallet_sendCalls",params:o});return l&&typeof l=="object"&&"id"in l?{chain:c,client:e,id:l.id}:{chain:c,client:e,id:l}}catch(o){throw/unsupport|not support/i.test(o.message)?new Error(`${n} errored calling wallet_sendCalls, with error: ${o instanceof Error?o.message:dd(o)}`):o}},async getCallsStatus(s){try{const o=await r.request({method:"wallet_getCallsStatus",params:[s.id]});return zs(o)}catch(o){throw/unsupport|not support/i.test(o.message)?new Error(`${n} does not support wallet_getCallsStatus, reach out to them directly to request EIP-5792 support.`):o}},async getCallsStatusRaw(s){try{return await r.request({method:"wallet_getCallsStatus",params:[s.id]})}catch(o){throw/unsupport|not support/i.test(o.message)?new Error(`${n} does not support wallet_getCallsStatus, reach out to them directly to request EIP-5792 support.`):o}},async getCapabilities(s){const o=s.chainId;try{const c=await r.request({method:"wallet_getCapabilities",params:[Z(i.address),o?[De(o)]:void 0]});return Ks(c,o)}catch(c){if(/unsupport|not support|not available/i.test(c.message))return{message:`${n} does not support wallet_getCapabilities, reach out to them directly to request EIP-5792 support.`};throw c}}};return i}async function ll({provider:r,address:t,chain:e,emitter:n,client:i,id:s}){const o=$o({address:t,client:i,id:s,provider:r});async function c(){r.removeListener("accountsChanged",u),r.removeListener("chainChanged",d),r.removeListener("disconnect",l);try{await Bd(()=>r.request({method:"wallet_revokePermissions",params:[{eth_accounts:{}}]}),{timeout:100})}catch{}}async function l(){c(),n.emit("disconnect",void 0)}function u(h){if(h[0]){const p=$o({address:Z(h[0]),client:i,id:s,provider:r});n.emit("accountChanged",p),n.emit("accountsChanged",h)}else l()}function d(h){const p=ge(lt(h));n.emit("chainChanged",p)}return r.on&&(r.on("accountsChanged",u),r.on("chainChanged",d),r.on("disconnect",l)),[o,e,l,h=>ul(r,h)]}async function ul(r,t){var n;const e=De(t.id);try{await r.request({method:"wallet_switchEthereumChain",params:[{chainId:e}]})}catch{const i=await Us(t);await r.request({method:"wallet_addEthereumChain",params:[{blockExplorerUrls:(n=i.explorers)==null?void 0:n.map(s=>s.url),chainId:e,chainName:i.name,nativeCurrency:i.nativeCurrency,rpcUrls:Ws(i)}]})}}function Jh(r){return r instanceof Error?r.message:typeof r=="string"?r:typeof r=="object"&&r!==null?JSON.stringify(r):String(r)}const ko=Object.freeze(Object.defineProperty({__proto__:null,autoConnectEip1193Wallet:cl,connectEip1193Wallet:al,getInjectedProvider:Qi},Symbol.toStringTag,{value:"Module"}));function Zh(r){const t=r.walletId??"adapter",e=dr();let n,i,s;const o=async p=>(s=typeof r.provider=="function"?await r.provider(p):r.provider,s),c=e.subscribe("chainChanged",p=>{i=p});function l(){n=void 0,i=void 0}let u=async()=>{};const d=e.subscribe("disconnect",()=>{l(),c(),d()});e.subscribe("accountChanged",p=>{n=p});let h=async p=>{await(s==null?void 0:s.request({method:"wallet_switchEthereumChain",params:[{chainId:md(p.id)}]}))};return{autoConnect:async p=>{var b;const[_,f,m,y]=await cl({chain:p.chain,client:p.client,emitter:e,id:t,provider:await o({chainId:(b=p.chain)==null?void 0:b.id})});return n=_,i=f,u=m,h=y,e.emit("onConnect",p),Be({client:p.client,walletAddress:n.address,walletType:t}),n},connect:async p=>{var b;const[_,f,m,y]=await al({chain:p.chain,client:p.client,emitter:e,id:t,provider:await o({chainId:(b=p.chain)==null?void 0:b.id})});return n=_,i=f,u=m,h=y,e.emit("onConnect",p),Be({client:p.client,walletAddress:n.address,walletType:t}),n},disconnect:async()=>{l(),await u(),e.emit("disconnect",void 0)},getAccount:()=>n,getChain(){if(i)return i=lr(i.id)||i,i},getConfig:()=>{},id:t,subscribe:e.subscribe,switchChain:async p=>{await h(p),e.emit("chainChanged",p)}}}function Yh(r){const{chain:t,client:e,wallet:n,connectOverride:i}=r,s=ni({chain:t,client:e});return{on:n.subscribe,removeListener:()=>{},request:async o=>{switch(o.method){case"eth_sendTransaction":{const c=n.getAccount();if(!c)throw new Error("Account not connected");return(await Cc({account:c,transaction:Gi({...o.params[0],chain:t,client:e})})).transactionHash}case"eth_estimateGas":{const c=n.getAccount();if(!c)throw new Error("Account not connected");return yd({account:c,transaction:Gi({...o.params[0],chain:t,client:e})})}case"personal_sign":{const c=n.getAccount();if(!c)throw new Error("Account not connected");return c.signMessage({message:{raw:o.params[0]}})}case"eth_signTypedData_v4":{const c=n.getAccount();if(!c)throw new Error("Account not connected");const l=JSON.parse(o.params[1]);return c.signTypedData(l)}case"eth_accounts":{const c=n.getAccount();return c?[c.address]:[]}case"eth_requestAccounts":{const c=n.getAccount();if(c)return[c.address];const l=i?await i(n):await n.connect({client:e}).catch(u=>(console.error("Error connecting wallet",u),null));if(!l)throw new Error("Unable to connect wallet - try passing a connectOverride function");return[l.address]}case"wallet_switchEthereumChain":case"wallet_addEthereumChain":{const l=o.params[0].chainId;if(!l)throw new Error("Chain ID is required");const u=qn(l)?sr(l):l,d=ge(u);return n.switchChain(d)}case"wallet_getCapabilities":{const c=n.getAccount();if(!c)throw new Error("Account not connected");if(!c.getCapabilities)throw new Error("Wallet does not support EIP-5792");const l=o.params[1];if(l&&Array.isArray(l)){const u=l[0],d=qn(u)?sr(u):Number(u);return c.getCapabilities(d?{chainId:d}:{})}return c.getCapabilities({})}case"wallet_sendCalls":{const c=n.getAccount();if(!c)throw new Error("Account not connected");if(!c.sendCalls)throw new Error("Wallet does not support EIP-5792");return c.sendCalls({...o.params[0],chain:t})}case"wallet_getCallsStatus":{const c=n.getAccount();if(!c)throw new Error("Account not connected");if(!c.getCallsStatusRaw)throw new Error("Wallet does not support EIP-5792");return await c.getCallsStatusRaw({id:o.params[0],chain:t,client:e})}default:return s(o)}}}}const Qh=Object.freeze(Object.defineProperty({__proto__:null,fromProvider:Zh,toProvider:Yh},Symbol.toStringTag,{value:"Module"}));function Xh(r){const t=dr();let e=r.chain;return{autoConnect:async()=>(t.emit("onConnect",r),r.adaptedAccount),connect:async()=>(t.emit("onConnect",r),r.adaptedAccount),disconnect:async()=>{await r.onDisconnect(),t.emit("disconnect",void 0)},getAccount(){return r.adaptedAccount},getChain(){return e=lr(e.id)||e,e},getConfig(){return r},id:"adapter",subscribe:t.subscribe,switchChain:async n=>{await r.switchChain(n),e=n,t.emit("chainChanged",n)}}}async function ep(){return(await a(async()=>{const{default:r}=await import("./wallet-infos-BHI_w6r-.js");return{default:r}},[])).default}async function hr(r,t){return Kr(r,async e=>{const{InAppWebConnector:n}=await a(async()=>{const{InAppWebConnector:i}=await import("./web-connector-BSznc5-3.js");return{InAppWebConnector:i}},__vite__mapDeps([17,3,4,2,1,18,5,6,7]));return new n({client:e,ecosystem:t})},t)}async function dl(r){const{client:t,ecosystem:e}=r,i=await(await hr(t,e)).getUser();switch(i.status){case"Logged In, Wallet Initialized":return i}}async function tp(r){const t=await dl(r);if(t&&"email"in t.authDetails)return t.authDetails.email}async function rp(r){const t=await dl(r);if(t&&"phoneNumber"in t.authDetails)return t.authDetails.phoneNumber}async function np(r){return(await hr(r.client,r.ecosystem)).preAuthenticate(r)}async function ip(r){return(await hr(r.client,r.ecosystem)).authenticate(r)}async function sp(r){const t=await hr(r.client,r.ecosystem);if(!t.authenticateWithRedirect)throw new Error("authenticateWithRedirect is not supported on this platform");return t.authenticateWithRedirect(r.strategy,r.mode,r.redirectUrl)}async function op(r){return await(await hr(r.client,r.ecosystem)).linkProfile(r)}async function ap(r){return await(await hr(r.client,r.ecosystem)).unlinkProfile(r.profileToUnlink,r.allowAccountDeletion)}async function cp(r){return(await hr(r.client,r.ecosystem)).getProfiles()}function lp(r){if("privateKey"in r){const t=wh(typeof r.message=="object"?r.message.raw:Rc(r.message)),e=ks({payload:t,privateKey:r.privateKey});return $c(e)}if("account"in r){const{message:t,account:e}=r;return e.signMessage({message:t})}throw new Error("Either privateKey or account is required")}function up(r){var s;const{privateKey:t,...e}=r;typeof((s=e.domain)==null?void 0:s.chainId)=="string"&&(e.domain.chainId=Lc(e.domain.chainId));const n=wd(e),i=ks({payload:n,privateKey:t});return $c(i)}function Xi(r){const{client:t}=r,e=`0x${r.privateKey.replace(/^0x/,"")}`,n=Ns(kc.getPublicKey(e.slice(2),!1)),i=jd(n);return{address:Z(i),sendTransaction:async o=>{const c=ni({chain:ge(o.chainId),client:t}),l=bo({privateKey:e,transaction:o});return{transactionHash:await Ed(c,l)}},signAuthorization:async o=>{const c=ks({payload:xc(o),privateKey:e});return gd(o,{signature:c})},signMessage:async({message:o})=>lp({message:o,privateKey:e}),signTransaction:async o=>bo({privateKey:e,transaction:o}),signTypedData:async o=>up({...o,privateKey:e})}}async function dp(r){const t=Ns(kc.utils.randomPrivateKey());return Xi({client:r.client,privateKey:t})}async function hp(r){const{address:t,client:e,chain:n}=r,i=r.tokenAddress||(n.id===42429?"0x20c0000000000000000000000000000000000000":void 0);if(i&&Z(i)!==Z(Io)){const{getBalance:d}=await a(async()=>{const{getBalance:h}=await import("./getBalance-DsI9g0TY.js");return{getBalance:h}},__vite__mapDeps([23,1,2,3,4,24]));return d({address:t,contract:$s({address:i,chain:n,client:e})})}const s=ni({chain:n,client:e}),[o,c,l,u]=await Promise.all([Sd(n),xd(n),Cd(n),vd(s,{address:t})]);return{chainId:n.id,decimals:c,displayValue:bd(u,c),name:l,symbol:o,tokenAddress:i??Io,value:u}}function pp(r){return!r||typeof r.then!="function"?Promise.resolve(r):r}function ye(r,...t){try{return pp(r(...t))}catch(e){return Promise.reject(e)}}function _p(r){const t=typeof r;return r===null||t!=="object"&&t!=="function"}function fp(r){const t=Object.getPrototypeOf(r);return!t||t.isPrototypeOf(Object)}function Vn(r){if(_p(r))return String(r);if(fp(r)||Array.isArray(r))return JSON.stringify(r);if(typeof r.toJSON=="function")return Vn(r.toJSON());throw new Error("[unstorage] Cannot stringify value!")}const es="base64:";function mp(r){return typeof r=="string"?r:es+gp(r)}function yp(r){return typeof r!="string"||!r.startsWith(es)?r:wp(r.slice(es.length))}function wp(r){return globalThis.Buffer?Buffer.from(r,"base64"):Uint8Array.from(globalThis.atob(r),t=>t.codePointAt(0))}function gp(r){return globalThis.Buffer?Buffer.from(r).toString("base64"):globalThis.btoa(String.fromCodePoint(...r))}function ke(r){var t;return r&&((t=r.split("?")[0])==null?void 0:t.replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,""))||""}function Ep(...r){return ke(r.join(":"))}function bn(r){return r=ke(r),r?r+":":""}function vp(r,t){if(t===void 0)return!0;let e=0,n=r.indexOf(":");for(;n>-1;)e++,n=r.indexOf(":",n+1);return e<=t}function bp(r,t){return t?r.startsWith(t)&&r[r.length-1]!=="$":r[r.length-1]!=="$"}const Ip="memory",Ap=()=>{const r=new Map;return{name:Ip,getInstance:()=>r,hasItem(t){return r.has(t)},getItem(t){return r.get(t)??null},getItemRaw(t){return r.get(t)??null},setItem(t,e){r.set(t,e)},setItemRaw(t,e){r.set(t,e)},removeItem(t){r.delete(t)},getKeys(){return[...r.keys()]},clear(){r.clear()},dispose(){r.clear()}}};function Tp(r={}){const t={mounts:{"":r.driver||Ap()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},e=u=>{for(const d of t.mountpoints)if(u.startsWith(d))return{base:d,relativeKey:u.slice(d.length),driver:t.mounts[d]};return{base:"",relativeKey:u,driver:t.mounts[""]}},n=(u,d)=>t.mountpoints.filter(h=>h.startsWith(u)||d&&u.startsWith(h)).map(h=>({relativeBase:u.length>h.length?u.slice(h.length):void 0,mountpoint:h,driver:t.mounts[h]})),i=(u,d)=>{if(t.watching){d=ke(d);for(const h of t.watchListeners)h(u,d)}},s=async()=>{if(!t.watching){t.watching=!0;for(const u in t.mounts)t.unwatch[u]=await No(t.mounts[u],i,u)}},o=async()=>{if(t.watching){for(const u in t.unwatch)await t.unwatch[u]();t.unwatch={},t.watching=!1}},c=(u,d,h)=>{const p=new Map,_=f=>{let m=p.get(f.base);return m||(m={driver:f.driver,base:f.base,items:[]},p.set(f.base,m)),m};for(const f of u){const m=typeof f=="string",y=ke(m?f:f.key),b=m?void 0:f.value,O=m||!f.options?d:{...d,...f.options},g=e(y);_(g).items.push({key:y,value:b,relativeKey:g.relativeKey,options:O})}return Promise.all([...p.values()].map(f=>h(f))).then(f=>f.flat())},l={hasItem(u,d={}){u=ke(u);const{relativeKey:h,driver:p}=e(u);return ye(p.hasItem,h,d)},getItem(u,d={}){u=ke(u);const{relativeKey:h,driver:p}=e(u);return ye(p.getItem,h,d).then(_=>En(_))},getItems(u,d={}){return c(u,d,h=>h.driver.getItems?ye(h.driver.getItems,h.items.map(p=>({key:p.relativeKey,options:p.options})),d).then(p=>p.map(_=>({key:Ep(h.base,_.key),value:En(_.value)}))):Promise.all(h.items.map(p=>ye(h.driver.getItem,p.relativeKey,p.options).then(_=>({key:p.key,value:En(_)})))))},getItemRaw(u,d={}){u=ke(u);const{relativeKey:h,driver:p}=e(u);return p.getItemRaw?ye(p.getItemRaw,h,d):ye(p.getItem,h,d).then(_=>yp(_))},async setItem(u,d,h={}){if(d===void 0)return l.removeItem(u);u=ke(u);const{relativeKey:p,driver:_}=e(u);_.setItem&&(await ye(_.setItem,p,Vn(d),h),_.watch||i("update",u))},async setItems(u,d){await c(u,d,async h=>{if(h.driver.setItems)return ye(h.driver.setItems,h.items.map(p=>({key:p.relativeKey,value:Vn(p.value),options:p.options})),d);h.driver.setItem&&await Promise.all(h.items.map(p=>ye(h.driver.setItem,p.relativeKey,Vn(p.value),p.options)))})},async setItemRaw(u,d,h={}){if(d===void 0)return l.removeItem(u,h);u=ke(u);const{relativeKey:p,driver:_}=e(u);if(_.setItemRaw)await ye(_.setItemRaw,p,d,h);else if(_.setItem)await ye(_.setItem,p,mp(d),h);else return;_.watch||i("update",u)},async removeItem(u,d={}){typeof d=="boolean"&&(d={removeMeta:d}),u=ke(u);const{relativeKey:h,driver:p}=e(u);p.removeItem&&(await ye(p.removeItem,h,d),(d.removeMeta||d.removeMata)&&await ye(p.removeItem,h+"$",d),p.watch||i("remove",u))},async getMeta(u,d={}){typeof d=="boolean"&&(d={nativeOnly:d}),u=ke(u);const{relativeKey:h,driver:p}=e(u),_=Object.create(null);if(p.getMeta&&Object.assign(_,await ye(p.getMeta,h,d)),!d.nativeOnly){const f=await ye(p.getItem,h+"$",d).then(m=>En(m));f&&typeof f=="object"&&(typeof f.atime=="string"&&(f.atime=new Date(f.atime)),typeof f.mtime=="string"&&(f.mtime=new Date(f.mtime)),Object.assign(_,f))}return _},setMeta(u,d,h={}){return this.setItem(u+"$",d,h)},removeMeta(u,d={}){return this.removeItem(u+"$",d)},async getKeys(u,d={}){var y;u=bn(u);const h=n(u,!0);let p=[];const _=[];let f=!0;for(const b of h){(y=b.driver.flags)!=null&&y.maxDepth||(f=!1);const O=await ye(b.driver.getKeys,b.relativeBase,d);for(const g of O){const P=b.mountpoint+ke(g);p.some(A=>P.startsWith(A))||_.push(P)}p=[b.mountpoint,...p.filter(g=>!g.startsWith(b.mountpoint))]}const m=d.maxDepth!==void 0&&!f;return _.filter(b=>(!m||vp(b,d.maxDepth))&&bp(b,u))},async clear(u,d={}){u=bn(u),await Promise.all(n(u,!1).map(async h=>{if(h.driver.clear)return ye(h.driver.clear,h.relativeBase,d);if(h.driver.removeItem){const p=await h.driver.getKeys(h.relativeBase||"",d);return Promise.all(p.map(_=>h.driver.removeItem(_,d)))}}))},async dispose(){await Promise.all(Object.values(t.mounts).map(u=>Uo(u)))},async watch(u){return await s(),t.watchListeners.push(u),async()=>{t.watchListeners=t.watchListeners.filter(d=>d!==u),t.watchListeners.length===0&&await o()}},async unwatch(){t.watchListeners=[],await o()},mount(u,d){if(u=bn(u),u&&t.mounts[u])throw new Error(`already mounted at ${u}`);return u&&(t.mountpoints.push(u),t.mountpoints.sort((h,p)=>p.length-h.length)),t.mounts[u]=d,t.watching&&Promise.resolve(No(d,i,u)).then(h=>{t.unwatch[u]=h}).catch(console.error),l},async unmount(u,d=!0){var h,p;u=bn(u),!(!u||!t.mounts[u])&&(t.watching&&u in t.unwatch&&((p=(h=t.unwatch)[u])==null||p.call(h),delete t.unwatch[u]),d&&await Uo(t.mounts[u]),t.mountpoints=t.mountpoints.filter(_=>_!==u),delete t.mounts[u])},getMount(u=""){u=ke(u)+":";const d=e(u);return{driver:d.driver,base:d.base}},getMounts(u="",d={}){return u=ke(u),n(u,d.parents).map(p=>({driver:p.driver,base:p.mountpoint}))},keys:(u,d={})=>l.getKeys(u,d),get:(u,d={})=>l.getItem(u,d),set:(u,d,h={})=>l.setItem(u,d,h),has:(u,d={})=>l.hasItem(u,d),del:(u,d={})=>l.removeItem(u,d),remove:(u,d={})=>l.removeItem(u,d)};return l}function No(r,t,e){return r.watch?r.watch((n,i)=>t(n,e+i)):()=>{}}async function Uo(r){typeof r.dispose=="function"&&await ye(r.dispose)}var qo={};const Pp="idb-keyval";var Op=(r={})=>{const t=r.base&&r.base.length>0?`${r.base}:`:"",e=i=>t+i;let n;return r.dbName&&r.storeName&&(n=zd(r.dbName,r.storeName)),{name:Pp,options:r,async hasItem(i){return!(typeof await To(e(i),n)>"u")},async getItem(i){return await To(e(i),n)??null},setItem(i,s){return Hd(e(i),s,n)},removeItem(i){return Wd(e(i),n)},getKeys(){return Fd(n)},clear(){return Kd(n)}}};const Rp="WALLET_CONNECT_V2_INDEXED_DB",Lp="keyvaluestorage";let Dp=class{constructor(){this.indexedDb=Tp({driver:Op({dbName:Rp,storeName:Lp})})}async getKeys(){return this.indexedDb.getKeys()}async getEntries(){return(await this.indexedDb.getItems(await this.indexedDb.getKeys())).map(t=>[t.key,t.value])}async getItem(t){const e=await this.indexedDb.getItem(t);if(e!==null)return e}async setItem(t,e){await this.indexedDb.setItem(t,rn(e))}async removeItem(t){await this.indexedDb.removeItem(t)}};var Ii=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof qo<"u"?qo:typeof self<"u"?self:{},Sn={exports:{}};(function(){let r;function t(){}r=t,r.prototype.getItem=function(e){return this.hasOwnProperty(e)?String(this[e]):null},r.prototype.setItem=function(e,n){this[e]=String(n)},r.prototype.removeItem=function(e){delete this[e]},r.prototype.clear=function(){const e=this;Object.keys(e).forEach(function(n){e[n]=void 0,delete e[n]})},r.prototype.key=function(e){return e=e||0,Object.keys(this)[e]},r.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof Ii<"u"&&Ii.localStorage?Sn.exports=Ii.localStorage:typeof window<"u"&&window.localStorage?Sn.exports=window.localStorage:Sn.exports=new t})();function Vp(r){var t;return[r[0],Mn((t=r[1])!=null?t:"")]}let Sp=class{constructor(){this.localStorage=Sn.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(Vp)}async getItem(t){const e=this.localStorage.getItem(t);if(e!==null)return Mn(e)}async setItem(t,e){this.localStorage.setItem(t,rn(e))}async removeItem(t){this.localStorage.removeItem(t)}};const xp="wc_storage_version",Mo=1,Cp=async(r,t,e)=>{const n=xp,i=await t.getItem(n);if(i&&i>=Mo){e(t);return}const s=await r.getKeys();if(!s.length){e(t);return}const o=[];for(;s.length;){const c=s.shift();if(!c)continue;const l=c.toLowerCase();if(l.includes("wc@")||l.includes("walletconnect")||l.includes("wc_")||l.includes("wallet_connect")){const u=await r.getItem(c);await t.setItem(c,u),o.push(c)}}await t.setItem(n,Mo),e(t),$p(r,o)},$p=async(r,t)=>{t.length&&t.forEach(async e=>{await r.removeItem(e)})};let kp=class{constructor(){this.initialized=!1,this.setInitialized=e=>{this.storage=e,this.initialized=!0};const t=new Sp;this.storage=t;try{const e=new Dp;Cp(t,e,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(t){return await this.initialize(),this.storage.getItem(t)}async setItem(t,e){return await this.initialize(),this.storage.setItem(t,e)}async removeItem(t){return await this.initialize(),this.storage.removeItem(t)}async initialize(){this.initialized||await new Promise(t=>{const e=setInterval(()=>{this.initialized&&(clearInterval(e),t())},20)})}};var Ai,Bo;function Np(){if(Bo)return Ai;Bo=1;const r=Gd();Ai=i;const t=A().console||{},e={mapHttpRequest:f,mapHttpResponse:f,wrapRequestSerializer:m,wrapResponseSerializer:m,wrapErrorSerializer:m,req:f,res:f,err:p};function n(E,D){return Array.isArray(E)?E.filter(function(w){return w!=="!stdSerializers.err"}):E===!0?Object.keys(D):!1}function i(E){E=E||{},E.browser=E.browser||{};const D=E.browser.transmit;if(D&&typeof D.send!="function")throw Error("pino: transmit option must have a send function");const L=E.browser.write||t;E.browser.write&&(E.browser.asObject=!0);const w=E.serializers||{},v=n(E.browser.serialize,w);let I=E.browser.serialize;Array.isArray(E.browser.serialize)&&E.browser.serialize.indexOf("!stdSerializers.err")>-1&&(I=!1);const T=["error","fatal","warn","info","debug","trace"];typeof L=="function"&&(L.error=L.fatal=L.warn=L.info=L.debug=L.trace=L),E.enabled===!1&&(E.level="silent");const V=E.level||"info",R=Object.create(L);R.log||(R.log=y),Object.defineProperty(R,"levelVal",{get:$}),Object.defineProperty(R,"level",{get:k,set:M});const S={transmit:D,serialize:v,asObject:E.browser.asObject,levels:T,timestamp:_(E)};R.levels=i.levels,R.level=V,R.setMaxListeners=R.getMaxListeners=R.emit=R.addListener=R.on=R.prependListener=R.once=R.prependOnceListener=R.removeListener=R.removeAllListeners=R.listeners=R.listenerCount=R.eventNames=R.write=R.flush=y,R.serializers=w,R._serialize=v,R._stdErrSerialize=I,R.child=C,D&&(R._logEvent=h());function $(){return this.level==="silent"?1/0:this.levels.values[this.level]}function k(){return this._level}function M(N){if(N!=="silent"&&!this.levels.values[N])throw Error("unknown level "+N);this._level=N,s(S,R,"error","log"),s(S,R,"fatal","error"),s(S,R,"warn","error"),s(S,R,"info","log"),s(S,R,"debug","log"),s(S,R,"trace","log")}function C(N,j){if(!N)throw new Error("missing bindings for child Pino");j=j||{},v&&N.serializers&&(j.serializers=N.serializers);const z=j.serializers;if(v&&z){var K=Object.assign({},w,z),F=E.browser.serialize===!0?Object.keys(K):v;delete N.serializers,l([N],F,K,this._stdErrSerialize)}function W(H){this._childLevel=(H._childLevel|0)+1,this.error=u(H,N,"error"),this.fatal=u(H,N,"fatal"),this.warn=u(H,N,"warn"),this.info=u(H,N,"info"),this.debug=u(H,N,"debug"),this.trace=u(H,N,"trace"),K&&(this.serializers=K,this._serialize=F),D&&(this._logEvent=h([].concat(H._logEvent.bindings,N)))}return W.prototype=this,new W(this)}return R}i.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"}},i.stdSerializers=e,i.stdTimeFunctions=Object.assign({},{nullTime:b,epochTime:O,unixTime:g,isoTime:P});function s(E,D,L,w){const v=Object.getPrototypeOf(D);D[L]=D.levelVal>D.levels.values[L]?y:v[L]?v[L]:t[L]||t[w]||y,o(E,D,L)}function o(E,D,L){!E.transmit&&D[L]===y||(D[L]=function(w){return function(){const I=E.timestamp(),T=new Array(arguments.length),V=Object.getPrototypeOf&&Object.getPrototypeOf(this)===t?t:this;for(var R=0;R<T.length;R++)T[R]=arguments[R];if(E.serialize&&!E.asObject&&l(T,this._serialize,this.serializers,this._stdErrSerialize),E.asObject?w.call(V,c(this,L,T,I)):w.apply(V,T),E.transmit){const S=E.transmit.level||D.level,$=i.levels.values[S],k=i.levels.values[L];if(k<$)return;d(this,{ts:I,methodLevel:L,methodValue:k,transmitValue:i.levels.values[E.transmit.level||D.level],send:E.transmit.send,val:D.levelVal},T)}}}(D[L]))}function c(E,D,L,w){E._serialize&&l(L,E._serialize,E.serializers,E._stdErrSerialize);const v=L.slice();let I=v[0];const T={};w&&(T.time=w),T.level=i.levels.values[D];let V=(E._childLevel|0)+1;if(V<1&&(V=1),I!==null&&typeof I=="object"){for(;V--&&typeof v[0]=="object";)Object.assign(T,v.shift());I=v.length?r(v.shift(),v):void 0}else typeof I=="string"&&(I=r(v.shift(),v));return I!==void 0&&(T.msg=I),T}function l(E,D,L,w){for(const v in E)if(w&&E[v]instanceof Error)E[v]=i.stdSerializers.err(E[v]);else if(typeof E[v]=="object"&&!Array.isArray(E[v]))for(const I in E[v])D&&D.indexOf(I)>-1&&I in L&&(E[v][I]=L[I](E[v][I]))}function u(E,D,L){return function(){const w=new Array(1+arguments.length);w[0]=D;for(var v=1;v<w.length;v++)w[v]=arguments[v-1];return E[L].apply(this,w)}}function d(E,D,L){const w=D.send,v=D.ts,I=D.methodLevel,T=D.methodValue,V=D.val,R=E._logEvent.bindings;l(L,E._serialize||Object.keys(E.serializers),E.serializers,E._stdErrSerialize===void 0?!0:E._stdErrSerialize),E._logEvent.ts=v,E._logEvent.messages=L.filter(function(S){return R.indexOf(S)===-1}),E._logEvent.level.label=I,E._logEvent.level.value=T,w(I,E._logEvent,V),E._logEvent=h(R)}function h(E){return{ts:0,messages:[],bindings:E||[],level:{label:"",value:0}}}function p(E){const D={type:E.constructor.name,msg:E.message,stack:E.stack};for(const L in E)D[L]===void 0&&(D[L]=E[L]);return D}function _(E){return typeof E.timestamp=="function"?E.timestamp:E.timestamp===!1?b:O}function f(){return{}}function m(E){return E}function y(){}function b(){return!1}function O(){return Date.now()}function g(){return Math.round(Date.now()/1e3)}function P(){return new Date(Date.now()).toISOString()}function A(){function E(D){return typeof D<"u"&&D}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 E(self)||E(window)||E(this)||{}}}return Ai}var Er=Np();const oi=Nd(Er),Up={level:"info"},pn="custom_context",Ys=1e3*1024;let qp=class{constructor(t){this.nodeValue=t,this.sizeInBytes=new TextEncoder().encode(this.nodeValue).length,this.next=null}get value(){return this.nodeValue}get size(){return this.sizeInBytes}},jo=class{constructor(t){this.head=null,this.tail=null,this.lengthInNodes=0,this.maxSizeInBytes=t,this.sizeInBytes=0}append(t){const e=new qp(t);if(e.size>this.maxSizeInBytes)throw new Error(`[LinkedList] Value too big to insert into list: ${t} with size ${e.size}`);for(;this.size+e.size>this.maxSizeInBytes;)this.shift();this.head?(this.tail&&(this.tail.next=e),this.tail=e):(this.head=e,this.tail=e),this.lengthInNodes++,this.sizeInBytes+=e.size}shift(){if(!this.head)return;const t=this.head;this.head=this.head.next,this.head||(this.tail=null),this.lengthInNodes--,this.sizeInBytes-=t.size}toArray(){const t=[];let e=this.head;for(;e!==null;)t.push(e.value),e=e.next;return t}get length(){return this.lengthInNodes}get size(){return this.sizeInBytes}toOrderedArray(){return Array.from(this)}[Symbol.iterator](){let t=this.head;return{next:()=>{if(!t)return{done:!0,value:null};const e=t.value;return t=t.next,{done:!1,value:e}}}}};class hl{constructor(t,e=Ys){this.level=t??"error",this.levelValue=Er.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=e,this.logs=new jo(this.MAX_LOG_SIZE_IN_BYTES)}forwardToConsole(t,e){e===Er.levels.values.error?console.error(t):e===Er.levels.values.warn?console.warn(t):e===Er.levels.values.debug?console.debug(t):e===Er.levels.values.trace?console.trace(t):console.log(t)}appendToLogs(t){this.logs.append(rn({timestamp:new Date().toISOString(),log:t}));const e=typeof t=="string"?JSON.parse(t).level:t.level;e>=this.levelValue&&this.forwardToConsole(t,e)}getLogs(){return this.logs}clearLogs(){this.logs=new jo(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(t){const e=this.getLogArray();return e.push(rn({extraMetadata:t})),new Blob(e,{type:"application/json"})}}let Mp=class{constructor(t,e=Ys){this.baseChunkLogger=new hl(t,e)}write(t){this.baseChunkLogger.appendToLogs(t)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(t){return this.baseChunkLogger.logsToBlob(t)}downloadLogsBlobInBrowser(t){const e=URL.createObjectURL(this.logsToBlob(t)),n=document.createElement("a");n.href=e,n.download=`walletconnect-logs-${new Date().toISOString()}.txt`,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(e)}},Bp=class{constructor(t,e=Ys){this.baseChunkLogger=new hl(t,e)}write(t){this.baseChunkLogger.appendToLogs(t)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(t){return this.baseChunkLogger.logsToBlob(t)}};var jp=Object.defineProperty,zp=Object.defineProperties,Kp=Object.getOwnPropertyDescriptors,zo=Object.getOwnPropertySymbols,Fp=Object.prototype.hasOwnProperty,Wp=Object.prototype.propertyIsEnumerable,Ko=(r,t,e)=>t in r?jp(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Hn=(r,t)=>{for(var e in t||(t={}))Fp.call(t,e)&&Ko(r,e,t[e]);if(zo)for(var e of zo(t))Wp.call(t,e)&&Ko(r,e,t[e]);return r},Gn=(r,t)=>zp(r,Kp(t));function Qs(r){return Gn(Hn({},r),{level:(r==null?void 0:r.level)||Up.level})}function Hp(r,t=pn){return r[t]||""}function Gp(r,t,e=pn){return r[e]=t,r}function Ke(r,t=pn){let e="";return typeof r.bindings>"u"?e=Hp(r,t):e=r.bindings().context||"",e}function Jp(r,t,e=pn){const n=Ke(r,e);return n.trim()?`${n}/${t}`:t}function Ce(r,t,e=pn){const n=Jp(r,t,e),i=r.child({context:n});return Gp(i,n,e)}function Zp(r){var t,e;const n=new Mp((t=r.opts)==null?void 0:t.level,r.maxSizeInBytes);return{logger:oi(Gn(Hn({},r.opts),{level:"trace",browser:Gn(Hn({},(e=r.opts)==null?void 0:e.browser),{write:i=>n.write(i)})})),chunkLoggerController:n}}function Yp(r){var t;const e=new Bp((t=r.opts)==null?void 0:t.level,r.maxSizeInBytes);return{logger:oi(Gn(Hn({},r.opts),{level:"trace"}),e),chunkLoggerController:e}}function Qp(r){return typeof r.loggerOverride<"u"&&typeof r.loggerOverride!="string"?{logger:r.loggerOverride,chunkLoggerController:null}:typeof window<"u"?Zp(r):Yp(r)}var Xp=Object.defineProperty,e_=(r,t,e)=>t in r?Xp(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Fo=(r,t,e)=>e_(r,typeof t!="symbol"?t+"":t,e);class t_ extends Tr{constructor(t){super(),this.opts=t,Fo(this,"protocol","wc"),Fo(this,"version",2)}}var r_=Object.defineProperty,n_=(r,t,e)=>t in r?r_(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,i_=(r,t,e)=>n_(r,t+"",e);class s_ extends Tr{constructor(t,e){super(),this.core=t,this.logger=e,i_(this,"records",new Map)}}class o_{constructor(t,e){this.logger=t,this.core=e}}class a_ extends Tr{constructor(t,e){super(),this.relayer=t,this.logger=e}}let c_=class extends Tr{constructor(t){super()}},l_=class{constructor(t,e,n,i){this.core=t,this.logger=e,this.name=n}},u_=class extends Tr{constructor(t,e){super(),this.relayer=t,this.logger=e}};class d_ extends Tr{constructor(t,e){super(),this.core=t,this.logger=e}}let h_=class{constructor(t,e,n){this.core=t,this.logger=e,this.store=n}},p_=class{constructor(t,e){this.projectId=t,this.logger=e}},__=class{constructor(t,e,n){this.core=t,this.logger=e,this.telemetryEnabled=n}};var f_=Object.defineProperty,m_=(r,t,e)=>t in r?f_(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Wo=(r,t,e)=>m_(r,typeof t!="symbol"?t+"":t,e);let y_=class{constructor(t){this.opts=t,Wo(this,"protocol","wc"),Wo(this,"version",2)}},w_=class{constructor(t){this.client=t}};function nn(r,{strict:t=!0}={}){return!r||typeof r!="string"?!1:t?/^0x[0-9a-fA-F]*$/.test(r):r.startsWith("0x")}function ts(r){return nn(r,{strict:!1})?Math.ceil((r.length-2)/2):r.length}const pl="2.31.0";let Cr={getDocsUrl:({docsBaseUrl:r,docsPath:t="",docsSlug:e})=>t?`${r??"https://viem.sh"}${t}${e?`#${e}`:""}`:void 0,version:`viem@${pl}`};class or extends Error{constructor(t,e={}){var c;const n=(()=>{var l;return e.cause instanceof or?e.cause.details:(l=e.cause)!=null&&l.message?e.cause.message:e.details})(),i=e.cause instanceof or&&e.cause.docsPath||e.docsPath,s=(c=Cr.getDocsUrl)==null?void 0:c.call(Cr,{...e,docsPath:i}),o=[t||"An error occurred.","",...e.metaMessages?[...e.metaMessages,""]:[],...s?[`Docs: ${s}`]:[],...n?[`Details: ${n}`]:[],...Cr.version?[`Version: ${Cr.version}`]:[]].join(`
|
|
4
|
+
`);super(o,e.cause?{cause:e.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=i,this.metaMessages=e.metaMessages,this.name=e.name??this.name,this.shortMessage=t,this.version=pl}walk(t){return _l(this,t)}}function _l(r,t){return t!=null&&t(r)?r:r&&typeof r=="object"&&"cause"in r&&r.cause!==void 0?_l(r.cause,t):t?null:r}class fl extends or{constructor({size:t,targetSize:e,type:n}){super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} size (${t}) exceeds padding size (${e}).`,{name:"SizeExceedsPaddingSizeError"})}}function Rr(r,{dir:t,size:e=32}={}){return typeof r=="string"?g_(r,{dir:t,size:e}):E_(r,{dir:t,size:e})}function g_(r,{dir:t,size:e=32}={}){if(e===null)return r;const n=r.replace("0x","");if(n.length>e*2)throw new fl({size:Math.ceil(n.length/2),targetSize:e,type:"hex"});return`0x${n[t==="right"?"padEnd":"padStart"](e*2,"0")}`}function E_(r,{dir:t,size:e=32}={}){if(e===null)return r;if(r.length>e)throw new fl({size:r.length,targetSize:e,type:"bytes"});const n=new Uint8Array(e);for(let i=0;i<e;i++){const s=t==="right";n[s?i:e-i-1]=r[s?i:r.length-i-1]}return n}class v_ extends or{constructor({max:t,min:e,signed:n,size:i,value:s}){super(`Number "${s}" is not in safe ${i?`${i*8}-bit ${n?"signed":"unsigned"} `:""}integer range ${t?`(${e} to ${t})`:`(above ${e})`}`,{name:"IntegerOutOfRangeError"})}}class b_ extends or{constructor({givenSize:t,maxSize:e}){super(`Size cannot exceed ${e} bytes. Given size: ${t} bytes.`,{name:"SizeOverflowError"})}}function Lr(r,{size:t}){if(ts(r)>t)throw new b_({givenSize:ts(r),maxSize:t})}function rs(r,t={}){const{signed:e}=t;t.size&&Lr(r,{size:t.size});const n=BigInt(r);if(!e)return n;const i=(r.length-2)/2,s=(1n<<BigInt(i)*8n-1n)-1n;return n<=s?n:n-BigInt(`0x${"f".padStart(i*2,"f")}`)-1n}function I_(r,t={}){return Number(rs(r,t))}const A_=Array.from({length:256},(r,t)=>t.toString(16).padStart(2,"0"));function ns(r,t={}){return typeof r=="number"||typeof r=="bigint"?yl(r,t):typeof r=="string"?O_(r,t):typeof r=="boolean"?T_(r,t):ml(r,t)}function T_(r,t={}){const e=`0x${Number(r)}`;return typeof t.size=="number"?(Lr(e,{size:t.size}),Rr(e,{size:t.size})):e}function ml(r,t={}){let e="";for(let i=0;i<r.length;i++)e+=A_[r[i]];const n=`0x${e}`;return typeof t.size=="number"?(Lr(n,{size:t.size}),Rr(n,{dir:"right",size:t.size})):n}function yl(r,t={}){const{signed:e,size:n}=t,i=BigInt(r);let s;n?e?s=(1n<<BigInt(n)*8n-1n)-1n:s=2n**(BigInt(n)*8n)-1n:typeof r=="number"&&(s=BigInt(Number.MAX_SAFE_INTEGER));const o=typeof s=="bigint"&&e?-s-1n:0;if(s&&i>s||i<o){const l=typeof r=="bigint"?"n":"";throw new v_({max:s?`${s}${l}`:void 0,min:`${o}${l}`,signed:e,size:n,value:`${r}${l}`})}const c=`0x${(e&&i<0?(1n<<BigInt(n*8))+BigInt(i):i).toString(16)}`;return n?Rr(c,{size:n}):c}const P_=new TextEncoder;function O_(r,t={}){const e=P_.encode(r);return ml(e,t)}const R_=new TextEncoder;function L_(r,t={}){return typeof r=="number"||typeof r=="bigint"?V_(r,t):typeof r=="boolean"?D_(r,t):nn(r)?wl(r,t):gl(r,t)}function D_(r,t={}){const e=new Uint8Array(1);return e[0]=Number(r),typeof t.size=="number"?(Lr(e,{size:t.size}),Rr(e,{size:t.size})):e}const Et={zero:48,nine:57,A:65,F:70,a:97,f:102};function Ho(r){if(r>=Et.zero&&r<=Et.nine)return r-Et.zero;if(r>=Et.A&&r<=Et.F)return r-(Et.A-10);if(r>=Et.a&&r<=Et.f)return r-(Et.a-10)}function wl(r,t={}){let e=r;t.size&&(Lr(e,{size:t.size}),e=Rr(e,{dir:"right",size:t.size}));let n=e.slice(2);n.length%2&&(n=`0${n}`);const i=n.length/2,s=new Uint8Array(i);for(let o=0,c=0;o<i;o++){const l=Ho(n.charCodeAt(c++)),u=Ho(n.charCodeAt(c++));if(l===void 0||u===void 0)throw new or(`Invalid byte sequence ("${n[c-2]}${n[c-1]}" in "${n}").`);s[o]=l*16+u}return s}function V_(r,t){const e=yl(r,t);return wl(e)}function gl(r,t={}){const e=R_.encode(r);return typeof t.size=="number"?(Lr(e,{size:t.size}),Rr(e,{dir:"right",size:t.size})):e}const In=BigInt(2**32-1),Go=BigInt(32);function S_(r,t=!1){return t?{h:Number(r&In),l:Number(r>>Go&In)}:{h:Number(r>>Go&In)|0,l:Number(r&In)|0}}function x_(r,t=!1){const e=r.length;let n=new Uint32Array(e),i=new Uint32Array(e);for(let s=0;s<e;s++){const{h:o,l:c}=S_(r[s],t);[n[s],i[s]]=[o,c]}return[n,i]}const C_=(r,t,e)=>r<<e|t>>>32-e,$_=(r,t,e)=>t<<e|r>>>32-e,k_=(r,t,e)=>t<<e-32|r>>>64-e,N_=(r,t,e)=>r<<e-32|t>>>64-e,_r=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function U_(r){return r instanceof Uint8Array||ArrayBuffer.isView(r)&&r.constructor.name==="Uint8Array"}function Jn(r){if(!Number.isSafeInteger(r)||r<0)throw new Error("positive integer expected, got "+r)}function sn(r,...t){if(!U_(r))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(r.length))throw new Error("Uint8Array expected of length "+t+", got length="+r.length)}function tA(r){if(typeof r!="function"||typeof r.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");Jn(r.outputLen),Jn(r.blockLen)}function Jo(r,t=!0){if(r.destroyed)throw new Error("Hash instance has been destroyed");if(t&&r.finished)throw new Error("Hash#digest() has already been called")}function q_(r,t){sn(r);const e=t.outputLen;if(r.length<e)throw new Error("digestInto() expects output buffer of length at least "+e)}function M_(r){return new Uint32Array(r.buffer,r.byteOffset,Math.floor(r.byteLength/4))}function El(...r){for(let t=0;t<r.length;t++)r[t].fill(0)}function rA(r){return new DataView(r.buffer,r.byteOffset,r.byteLength)}function nA(r,t){return r<<32-t|r>>>t}const B_=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function j_(r){return r<<24&4278190080|r<<8&16711680|r>>>8&65280|r>>>24&255}function z_(r){for(let t=0;t<r.length;t++)r[t]=j_(r[t]);return r}const Zo=B_?r=>r:z_;function K_(r){if(typeof r!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(r))}function vl(r){return typeof r=="string"&&(r=K_(r)),sn(r),r}function iA(...r){let t=0;for(let n=0;n<r.length;n++){const i=r[n];sn(i),t+=i.length}const e=new Uint8Array(t);for(let n=0,i=0;n<r.length;n++){const s=r[n];e.set(s,i),i+=s.length}return e}class F_{}function W_(r){const t=n=>r().update(vl(n)).digest(),e=r();return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=()=>r(),t}function sA(r=32){if(_r&&typeof _r.getRandomValues=="function")return _r.getRandomValues(new Uint8Array(r));if(_r&&typeof _r.randomBytes=="function")return Uint8Array.from(_r.randomBytes(r));throw new Error("crypto.getRandomValues must be defined")}const H_=BigInt(0),$r=BigInt(1),G_=BigInt(2),J_=BigInt(7),Z_=BigInt(256),Y_=BigInt(113),bl=[],Il=[],Al=[];for(let r=0,t=$r,e=1,n=0;r<24;r++){[e,n]=[n,(2*e+3*n)%5],bl.push(2*(5*n+e)),Il.push((r+1)*(r+2)/2%64);let i=H_;for(let s=0;s<7;s++)t=(t<<$r^(t>>J_)*Y_)%Z_,t&G_&&(i^=$r<<($r<<BigInt(s))-$r);Al.push(i)}const Tl=x_(Al,!0),Q_=Tl[0],X_=Tl[1],Yo=(r,t,e)=>e>32?k_(r,t,e):C_(r,t,e),Qo=(r,t,e)=>e>32?N_(r,t,e):$_(r,t,e);function ef(r,t=24){const e=new Uint32Array(10);for(let n=24-t;n<24;n++){for(let o=0;o<10;o++)e[o]=r[o]^r[o+10]^r[o+20]^r[o+30]^r[o+40];for(let o=0;o<10;o+=2){const c=(o+8)%10,l=(o+2)%10,u=e[l],d=e[l+1],h=Yo(u,d,1)^e[c],p=Qo(u,d,1)^e[c+1];for(let _=0;_<50;_+=10)r[o+_]^=h,r[o+_+1]^=p}let i=r[2],s=r[3];for(let o=0;o<24;o++){const c=Il[o],l=Yo(i,s,c),u=Qo(i,s,c),d=bl[o];i=r[d],s=r[d+1],r[d]=l,r[d+1]=u}for(let o=0;o<50;o+=10){for(let c=0;c<10;c++)e[c]=r[o+c];for(let c=0;c<10;c++)r[o+c]^=~e[(c+2)%10]&e[(c+4)%10]}r[0]^=Q_[n],r[1]^=X_[n]}El(e)}class Xs extends F_{constructor(t,e,n,i=!1,s=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=t,this.suffix=e,this.outputLen=n,this.enableXOF=i,this.rounds=s,Jn(n),!(0<t&&t<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=M_(this.state)}clone(){return this._cloneInto()}keccak(){Zo(this.state32),ef(this.state32,this.rounds),Zo(this.state32),this.posOut=0,this.pos=0}update(t){Jo(this),t=vl(t),sn(t);const{blockLen:e,state:n}=this,i=t.length;for(let s=0;s<i;){const o=Math.min(e-this.pos,i-s);for(let c=0;c<o;c++)n[this.pos++]^=t[s++];this.pos===e&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:t,suffix:e,pos:n,blockLen:i}=this;t[n]^=e,(e&128)!==0&&n===i-1&&this.keccak(),t[i-1]^=128,this.keccak()}writeInto(t){Jo(this,!1),sn(t),this.finish();const e=this.state,{blockLen:n}=this;for(let i=0,s=t.length;i<s;){this.posOut>=n&&this.keccak();const o=Math.min(n-this.posOut,s-i);t.set(e.subarray(this.posOut,this.posOut+o),i),this.posOut+=o,i+=o}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return Jn(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(q_(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,El(this.state)}_cloneInto(t){const{blockLen:e,suffix:n,outputLen:i,rounds:s,enableXOF:o}=this;return t||(t=new Xs(e,n,i,o,s)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=s,t.suffix=n,t.outputLen=i,t.enableXOF=o,t.destroyed=this.destroyed,t}}const tf=(r,t,e)=>W_(()=>new Xs(t,r,e)),rf=tf(1,136,256/8);function Pl(r,t){const e=t||"hex",n=rf(nn(r,{strict:!1})?L_(r):r);return e==="bytes"?n:ns(n)}class nf extends Map{constructor(t){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=t}get(t){const e=super.get(t);return super.has(t)&&e!==void 0&&(this.delete(t),super.set(t,e)),e}set(t,e){if(super.set(t,e),this.maxSize&&this.size>this.maxSize){const n=this.keys().next().value;n&&this.delete(n)}return this}}const Ti=new nf(8192);function sf(r,t){if(Ti.has(`${r}.${t}`))return Ti.get(`${r}.${t}`);const e=r.substring(2).toLowerCase(),n=Pl(gl(e),"bytes"),i=e.split("");for(let o=0;o<40;o+=2)n[o>>1]>>4>=8&&i[o]&&(i[o]=i[o].toUpperCase()),(n[o>>1]&15)>=8&&i[o+1]&&(i[o+1]=i[o+1].toUpperCase());const s=`0x${i.join("")}`;return Ti.set(`${r}.${t}`,s),s}function of(r){const t=Pl(`0x${r.substring(4)}`).substring(26);return sf(`0x${t}`)}async function af({hash:r,signature:t}){const e=nn(r)?r:ns(r),{secp256k1:n}=await a(async()=>{const{secp256k1:o}=await import("./secp256k1-b-PbPirG.js");return{secp256k1:o}},__vite__mapDeps([25,1,2,3,4,5,6,7]));return`0x${(()=>{if(typeof t=="object"&&"r"in t&&"s"in t){const{r:u,s:d,v:h,yParity:p}=t,_=Number(p??h),f=Xo(_);return new n.Signature(rs(u),rs(d)).addRecoveryBit(f)}const o=nn(t)?t:ns(t);if(ts(o)!==65)throw new Error("invalid signature length");const c=I_(`0x${o.slice(130)}`),l=Xo(c);return n.Signature.fromCompact(o.substring(2,130)).addRecoveryBit(l)})().recoverPublicKey(e.substring(2)).toHex(!1)}`}function Xo(r){if(r===0||r===1)return r;if(r===27)return 0;if(r===28)return 1;throw new Error("Invalid yParityOrV value")}async function cf({hash:r,signature:t}){return of(await af({hash:r,signature:t}))}function lf(r){if(r.length>=255)throw new TypeError("Alphabet too long");const t=new Uint8Array(256);for(let u=0;u<t.length;u++)t[u]=255;for(let u=0;u<r.length;u++){const d=r.charAt(u),h=d.charCodeAt(0);if(t[h]!==255)throw new TypeError(d+" is ambiguous");t[h]=u}const e=r.length,n=r.charAt(0),i=Math.log(e)/Math.log(256),s=Math.log(256)/Math.log(e);function o(u){if(u instanceof Uint8Array||(ArrayBuffer.isView(u)?u=new Uint8Array(u.buffer,u.byteOffset,u.byteLength):Array.isArray(u)&&(u=Uint8Array.from(u))),!(u instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(u.length===0)return"";let d=0,h=0,p=0;const _=u.length;for(;p!==_&&u[p]===0;)p++,d++;const f=(_-p)*s+1>>>0,m=new Uint8Array(f);for(;p!==_;){let O=u[p],g=0;for(let P=f-1;(O!==0||g<h)&&P!==-1;P--,g++)O+=256*m[P]>>>0,m[P]=O%e>>>0,O=O/e>>>0;if(O!==0)throw new Error("Non-zero carry");h=g,p++}let y=f-h;for(;y!==f&&m[y]===0;)y++;let b=n.repeat(d);for(;y<f;++y)b+=r.charAt(m[y]);return b}function c(u){if(typeof u!="string")throw new TypeError("Expected String");if(u.length===0)return new Uint8Array;let d=0,h=0,p=0;for(;u[d]===n;)h++,d++;const _=(u.length-d)*i+1>>>0,f=new Uint8Array(_);for(;d<u.length;){const O=u.charCodeAt(d);if(O>255)return;let g=t[O];if(g===255)return;let P=0;for(let A=_-1;(g!==0||P<p)&&A!==-1;A--,P++)g+=e*f[A]>>>0,f[A]=g%256>>>0,g=g/256>>>0;if(g!==0)throw new Error("Non-zero carry");p=P,d++}let m=_-p;for(;m!==_&&f[m]===0;)m++;const y=new Uint8Array(h+(_-m));let b=h;for(;m!==_;)y[b++]=f[m++];return y}function l(u){const d=c(u);if(d)return d;throw new Error("Non-base"+e+" character")}return{encode:o,decodeUnsafe:c,decode:l}}var uf="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";const _n=lf(uf);var X={},df={};const hf=":";function xn(r){const[t,e]=r.split(hf);return{namespace:t,reference:e}}function Ol(r,t){return r.includes(":")?[r]:t.chains||[]}var pf=Object.defineProperty,_f=Object.defineProperties,ff=Object.getOwnPropertyDescriptors,ea=Object.getOwnPropertySymbols,mf=Object.prototype.hasOwnProperty,yf=Object.prototype.propertyIsEnumerable,is=(r,t,e)=>t in r?pf(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,ta=(r,t)=>{for(var e in t||(t={}))mf.call(t,e)&&is(r,e,t[e]);if(ea)for(var e of ea(t))yf.call(t,e)&&is(r,e,t[e]);return r},wf=(r,t)=>_f(r,ff(t)),ra=(r,t,e)=>is(r,typeof t!="symbol"?t+"":t,e);const gf="ReactNative",He={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},Ef="js";function Zn(){return typeof Kt<"u"&&typeof Kt.versions<"u"&&typeof Kt.versions.node<"u"}function Ht(){return!Rt.getDocument()&&!!Rt.getNavigator()&&navigator.product===gf}function vf(){return Ht()&&typeof X<"u"&&typeof(X==null?void 0:X.Platform)<"u"&&(X==null?void 0:X.Platform.OS)==="android"}function bf(){return Ht()&&typeof X<"u"&&typeof(X==null?void 0:X.Platform)<"u"&&(X==null?void 0:X.Platform.OS)==="ios"}function Dr(){return!Zn()&&!!Rt.getNavigator()&&!!Rt.getDocument()}function fn(){return Ht()?He.reactNative:Zn()?He.node:Dr()?He.browser:He.unknown}function na(){var r;try{return Ht()&&typeof X<"u"&&typeof(X==null?void 0:X.Application)<"u"?(r=X.Application)==null?void 0:r.applicationId:void 0}catch{return}}function If(r,t){const e=new URLSearchParams(r);for(const n of Object.keys(t).sort())if(t.hasOwnProperty(n)){const i=t[n];i!==void 0&&e.set(n,i)}return e.toString()}function Af(r){var t,e;const n=Rl();try{return r!=null&&r.url&&n.url&&new URL(r.url).host!==new URL(n.url).host&&(console.warn(`The configured WalletConnect 'metadata.url':${r.url} differs from the actual page url:${n.url}. This is probably unintended and can lead to issues.`),r.url=n.url),(t=r==null?void 0:r.icons)!=null&&t.length&&r.icons.length>0&&(r.icons=r.icons.filter(i=>i!=="")),wf(ta(ta({},n),r),{url:(r==null?void 0:r.url)||n.url,name:(r==null?void 0:r.name)||n.name,description:(r==null?void 0:r.description)||n.description,icons:(e=r==null?void 0:r.icons)!=null&&e.length&&r.icons.length>0?r.icons:n.icons})}catch(i){return console.warn("Error populating app metadata",i),r||n}}function Rl(){return Jd.getWindowMetadata()||{name:"",description:"",url:"",icons:[""]}}function Tf(){if(fn()===He.reactNative&&typeof X<"u"&&typeof(X==null?void 0:X.Platform)<"u"){const{OS:e,Version:n}=X.Platform;return[e,n].join("-")}const r=Yd();if(r===null)return"unknown";const t=r.os?r.os.replace(" ","").toLowerCase():"unknown";return r.type==="browser"?[t,r.name,r.version].join("-"):[t,r.version].join("-")}function Pf(){var r;const t=fn();return t===He.browser?[t,((r=Rt.getLocation())==null?void 0:r.host)||"unknown"].join(":"):t}function Ll(r,t,e){const n=Tf(),i=Pf();return[[r,t].join("-"),[Ef,e].join("-"),n,i].join("/")}function Of({protocol:r,version:t,relayUrl:e,sdkVersion:n,auth:i,projectId:s,useOnCloseEvent:o,bundleId:c,packageName:l}){const u=e.split("?"),d=Ll(r,t,n),h={auth:i,ua:d,projectId:s,useOnCloseEvent:o,packageName:l||void 0,bundleId:c||void 0},p=If(u[1]||"",h);return u[0]+"?"+p}function er(r,t){return r.filter(e=>t.includes(e)).length===r.length}function ss(r){return Object.fromEntries(r.entries())}function os(r){return new Map(Object.entries(r))}function Yt(r=q.FIVE_MINUTES,t){const e=q.toMiliseconds(r||q.FIVE_MINUTES);let n,i,s,o;return{resolve:c=>{s&&n&&(clearTimeout(s),n(c),o=Promise.resolve(c))},reject:c=>{s&&i&&(clearTimeout(s),i(c))},done:()=>new Promise((c,l)=>{if(o)return c(o);s=setTimeout(()=>{const u=new Error(t);o=Promise.reject(u),l(u)},e),n=c,i=l})}}function mt(r,t,e){return new Promise(async(n,i)=>{const s=setTimeout(()=>i(new Error(e)),t);try{const o=await r;n(o)}catch(o){i(o)}clearTimeout(s)})}function Dl(r,t){if(typeof t=="string"&&t.startsWith(`${r}:`))return t;if(r.toLowerCase()==="topic"){if(typeof t!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${t}`}else if(r.toLowerCase()==="id"){if(typeof t!="number")throw new Error('Value must be "number" for expirer target type: id');return`id:${t}`}throw new Error(`Unknown expirer target type: ${r}`)}function Rf(r){return Dl("topic",r)}function Lf(r){return Dl("id",r)}function Vl(r){const[t,e]=r.split(":"),n={id:void 0,topic:void 0};if(t==="topic"&&typeof e=="string")n.topic=e;else if(t==="id"&&Number.isInteger(Number(e)))n.id=Number(e);else throw new Error(`Invalid target, expected id:number or topic:string, got ${t}:${e}`);return n}function _e(r,t){return q.fromMiliseconds(Date.now()+q.toMiliseconds(r))}function qt(r){return Date.now()>=q.toMiliseconds(r)}function ee(r,t){return`${r}${t?`:${t}`:""}`}function ir(r=[],t=[]){return[...new Set([...r,...t])]}async function Df({id:r,topic:t,wcDeepLink:e}){var n;try{if(!e)return;const i=typeof e=="string"?JSON.parse(e):e,s=i==null?void 0:i.href;if(typeof s!="string")return;const o=Vf(s,r,t),c=fn();if(c===He.browser){if(!((n=Rt.getDocument())!=null&&n.hasFocus())){console.warn("Document does not have focus, skipping deeplink.");return}Sf(o)}else c===He.reactNative&&typeof(X==null?void 0:X.Linking)<"u"&&await X.Linking.openURL(o)}catch(i){console.error(i)}}function Vf(r,t,e){const n=`requestId=${t}&sessionTopic=${e}`;r.endsWith("/")&&(r=r.slice(0,-1));let i=`${r}`;if(r.startsWith("https://t.me")){const s=r.includes("?")?"&startapp=":"?startapp=";i=`${i}${s}${kf(n,!0)}`}else i=`${i}/wc?${n}`;return i}function Sf(r){let t="_self";$f()?t="_top":(Cf()||r.startsWith("https://")||r.startsWith("http://"))&&(t="_blank"),window.open(r,t,"noreferrer noopener")}async function xf(r,t){let e="";try{if(Dr()&&(e=localStorage.getItem(t),e))return e;e=await r.getItem(t)}catch(n){console.error(n)}return e}function ia(r,t){if(!r.includes(t))return null;const e=r.split(/([&,?,=])/),n=e.indexOf(t);return e[n+2]}function sa(){return typeof crypto<"u"&&crypto!=null&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu,r=>{const t=Math.random()*16|0;return(r==="x"?t:t&3|8).toString(16)})}function eo(){return typeof Kt<"u"&&df.IS_VITEST==="true"}function Cf(){return typeof window<"u"&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)}function $f(){try{return window.self!==window.top}catch{return!1}}function kf(r,t=!1){const e=re.from(r).toString("base64");return t?e.replace(/[=]/g,""):e}function Sl(r){return re.from(r,"base64").toString("utf-8")}function Nf(r){return new Promise(t=>setTimeout(t,r))}let Uf=class{constructor({limit:t}){ra(this,"limit"),ra(this,"set"),this.limit=t,this.set=new Set}add(t){if(!this.set.has(t)){if(this.set.size>=this.limit){const e=this.set.values().next().value;e&&this.set.delete(e)}this.set.add(t)}}has(t){return this.set.has(t)}};const An=BigInt(2**32-1),oa=BigInt(32);function xl(r,t=!1){return t?{h:Number(r&An),l:Number(r>>oa&An)}:{h:Number(r>>oa&An)|0,l:Number(r&An)|0}}function Cl(r,t=!1){const e=r.length;let n=new Uint32Array(e),i=new Uint32Array(e);for(let s=0;s<e;s++){const{h:o,l:c}=xl(r[s],t);[n[s],i[s]]=[o,c]}return[n,i]}const aa=(r,t,e)=>r>>>e,ca=(r,t,e)=>r<<32-e|t>>>e,Mt=(r,t,e)=>r>>>e|t<<32-e,Bt=(r,t,e)=>r<<32-e|t>>>e,Fr=(r,t,e)=>r<<64-e|t>>>e-32,Wr=(r,t,e)=>r>>>e-32|t<<64-e,qf=(r,t)=>t,Mf=(r,t)=>r,Bf=(r,t,e)=>r<<e|t>>>32-e,jf=(r,t,e)=>t<<e|r>>>32-e,zf=(r,t,e)=>t<<e-32|r>>>64-e,Kf=(r,t,e)=>r<<e-32|t>>>64-e;function ot(r,t,e,n){const i=(t>>>0)+(n>>>0);return{h:r+e+(i/2**32|0)|0,l:i|0}}const to=(r,t,e)=>(r>>>0)+(t>>>0)+(e>>>0),ro=(r,t,e,n)=>t+e+n+(r/2**32|0)|0,Ff=(r,t,e,n)=>(r>>>0)+(t>>>0)+(e>>>0)+(n>>>0),Wf=(r,t,e,n,i)=>t+e+n+i+(r/2**32|0)|0,Hf=(r,t,e,n,i)=>(r>>>0)+(t>>>0)+(e>>>0)+(n>>>0)+(i>>>0),Gf=(r,t,e,n,i,s)=>t+e+n+i+s+(r/2**32|0)|0,fr=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;function no(r){return r instanceof Uint8Array||ArrayBuffer.isView(r)&&r.constructor.name==="Uint8Array"}function Lt(r){if(!Number.isSafeInteger(r)||r<0)throw new Error("positive integer expected, got "+r)}function tt(r,...t){if(!no(r))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(r.length))throw new Error("Uint8Array expected of length "+t+", got length="+r.length)}function io(r){if(typeof r!="function"||typeof r.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");Lt(r.outputLen),Lt(r.blockLen)}function Wt(r,t=!0){if(r.destroyed)throw new Error("Hash instance has been destroyed");if(t&&r.finished)throw new Error("Hash#digest() has already been called")}function so(r,t){tt(r);const e=t.outputLen;if(r.length<e)throw new Error("digestInto() expects output buffer of length at least "+e)}function on(r){return new Uint32Array(r.buffer,r.byteOffset,Math.floor(r.byteLength/4))}function rt(...r){for(let t=0;t<r.length;t++)r[t].fill(0)}function Pi(r){return new DataView(r.buffer,r.byteOffset,r.byteLength)}function ut(r,t){return r<<32-t|r>>>t}const $l=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function kl(r){return r<<24&4278190080|r<<8&16711680|r>>>8&65280|r>>>24&255}const It=$l?r=>r:r=>kl(r);function Jf(r){for(let t=0;t<r.length;t++)r[t]=kl(r[t]);return r}const jt=$l?r=>r:Jf,Nl=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",Zf=Array.from({length:256},(r,t)=>t.toString(16).padStart(2,"0"));function an(r){if(tt(r),Nl)return r.toHex();let t="";for(let e=0;e<r.length;e++)t+=Zf[r[e]];return t}const vt={_0:48,_9:57,A:65,F:70,a:97,f:102};function la(r){if(r>=vt._0&&r<=vt._9)return r-vt._0;if(r>=vt.A&&r<=vt.F)return r-(vt.A-10);if(r>=vt.a&&r<=vt.f)return r-(vt.a-10)}function oo(r){if(typeof r!="string")throw new Error("hex string expected, got "+typeof r);if(Nl)return Uint8Array.fromHex(r);const t=r.length,e=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);const n=new Uint8Array(e);for(let i=0,s=0;i<e;i++,s+=2){const o=la(r.charCodeAt(s)),c=la(r.charCodeAt(s+1));if(o===void 0||c===void 0){const l=r[s]+r[s+1];throw new Error('hex string expected, got non-hex character "'+l+'" at index '+s)}n[i]=o*16+c}return n}function Yf(r){if(typeof r!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(r))}function ct(r){return typeof r=="string"&&(r=Yf(r)),tt(r),r}function tr(...r){let t=0;for(let n=0;n<r.length;n++){const i=r[n];tt(i),t+=i.length}const e=new Uint8Array(t);for(let n=0,i=0;n<r.length;n++){const s=r[n];e.set(s,i),i+=s.length}return e}class ai{}function mn(r){const t=n=>r().update(ct(n)).digest(),e=r();return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=()=>r(),t}function Qf(r){const t=(n,i)=>r(i).update(ct(n)).digest(),e=r({});return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=n=>r(n),t}function Vr(r=32){if(fr&&typeof fr.getRandomValues=="function")return fr.getRandomValues(new Uint8Array(r));if(fr&&typeof fr.randomBytes=="function")return Uint8Array.from(fr.randomBytes(r));throw new Error("crypto.getRandomValues must be defined")}const Xf=BigInt(0),kr=BigInt(1),em=BigInt(2),tm=BigInt(7),rm=BigInt(256),nm=BigInt(113),Ul=[],ql=[],Ml=[];for(let r=0,t=kr,e=1,n=0;r<24;r++){[e,n]=[n,(2*e+3*n)%5],Ul.push(2*(5*n+e)),ql.push((r+1)*(r+2)/2%64);let i=Xf;for(let s=0;s<7;s++)t=(t<<kr^(t>>tm)*nm)%rm,t&em&&(i^=kr<<(kr<<BigInt(s))-kr);Ml.push(i)}const Bl=Cl(Ml,!0),im=Bl[0],sm=Bl[1],ua=(r,t,e)=>e>32?zf(r,t,e):Bf(r,t,e),da=(r,t,e)=>e>32?Kf(r,t,e):jf(r,t,e);function om(r,t=24){const e=new Uint32Array(10);for(let n=24-t;n<24;n++){for(let o=0;o<10;o++)e[o]=r[o]^r[o+10]^r[o+20]^r[o+30]^r[o+40];for(let o=0;o<10;o+=2){const c=(o+8)%10,l=(o+2)%10,u=e[l],d=e[l+1],h=ua(u,d,1)^e[c],p=da(u,d,1)^e[c+1];for(let _=0;_<50;_+=10)r[o+_]^=h,r[o+_+1]^=p}let i=r[2],s=r[3];for(let o=0;o<24;o++){const c=ql[o],l=ua(i,s,c),u=da(i,s,c),d=Ul[o];i=r[d],s=r[d+1],r[d]=l,r[d+1]=u}for(let o=0;o<50;o+=10){for(let c=0;c<10;c++)e[c]=r[o+c];for(let c=0;c<10;c++)r[o+c]^=~e[(c+2)%10]&e[(c+4)%10]}r[0]^=im[n],r[1]^=sm[n]}rt(e)}let am=class jl extends ai{constructor(t,e,n,i=!1,s=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=t,this.suffix=e,this.outputLen=n,this.enableXOF=i,this.rounds=s,Lt(n),!(0<t&&t<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=on(this.state)}clone(){return this._cloneInto()}keccak(){jt(this.state32),om(this.state32,this.rounds),jt(this.state32),this.posOut=0,this.pos=0}update(t){Wt(this),t=ct(t),tt(t);const{blockLen:e,state:n}=this,i=t.length;for(let s=0;s<i;){const o=Math.min(e-this.pos,i-s);for(let c=0;c<o;c++)n[this.pos++]^=t[s++];this.pos===e&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:t,suffix:e,pos:n,blockLen:i}=this;t[n]^=e,(e&128)!==0&&n===i-1&&this.keccak(),t[i-1]^=128,this.keccak()}writeInto(t){Wt(this,!1),tt(t),this.finish();const e=this.state,{blockLen:n}=this;for(let i=0,s=t.length;i<s;){this.posOut>=n&&this.keccak();const o=Math.min(n-this.posOut,s-i);t.set(e.subarray(this.posOut,this.posOut+o),i),this.posOut+=o,i+=o}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return Lt(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(so(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,rt(this.state)}_cloneInto(t){const{blockLen:e,suffix:n,outputLen:i,rounds:s,enableXOF:o}=this;return t||(t=new jl(e,n,i,o,s)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=s,t.suffix=n,t.outputLen=i,t.enableXOF=o,t.destroyed=this.destroyed,t}};const cm=(r,t,e)=>mn(()=>new am(t,r,e)),lm=cm(1,136,256/8);function um(r,t,e,n){if(typeof r.setBigUint64=="function")return r.setBigUint64(t,e,n);const i=BigInt(32),s=BigInt(4294967295),o=Number(e>>i&s),c=Number(e&s),l=n?4:0,u=n?0:4;r.setUint32(t+l,o,n),r.setUint32(t+u,c,n)}function dm(r,t,e){return r&t^~r&e}function hm(r,t,e){return r&t^r&e^t&e}let zl=class extends ai{constructor(t,e,n,i){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=t,this.outputLen=e,this.padOffset=n,this.isLE=i,this.buffer=new Uint8Array(t),this.view=Pi(this.buffer)}update(t){Wt(this),t=ct(t),tt(t);const{view:e,buffer:n,blockLen:i}=this,s=t.length;for(let o=0;o<s;){const c=Math.min(i-this.pos,s-o);if(c===i){const l=Pi(t);for(;i<=s-o;o+=i)this.process(l,o);continue}n.set(t.subarray(o,o+c),this.pos),this.pos+=c,o+=c,this.pos===i&&(this.process(e,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){Wt(this),so(t,this),this.finished=!0;const{buffer:e,view:n,blockLen:i,isLE:s}=this;let{pos:o}=this;e[o++]=128,rt(this.buffer.subarray(o)),this.padOffset>i-o&&(this.process(n,0),o=0);for(let h=o;h<i;h++)e[h]=0;um(n,i-8,BigInt(this.length*8),s),this.process(n,0);const c=Pi(t),l=this.outputLen;if(l%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const u=l/4,d=this.get();if(u>d.length)throw new Error("_sha2: outputLen bigger than state");for(let h=0;h<u;h++)c.setUint32(4*h,d[h],s)}digest(){const{buffer:t,outputLen:e}=this;this.digestInto(t);const n=t.slice(0,e);return this.destroy(),n}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:e,buffer:n,length:i,finished:s,destroyed:o,pos:c}=this;return t.destroyed=o,t.finished=s,t.length=i,t.pos=c,i%e&&t.buffer.set(n),t}clone(){return this._cloneInto()}};const Vt=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Te=Uint32Array.from([3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]),Pe=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209]),pm=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]),St=new Uint32Array(64);let _m=class extends zl{constructor(t=32){super(64,t,8,!1),this.A=Vt[0]|0,this.B=Vt[1]|0,this.C=Vt[2]|0,this.D=Vt[3]|0,this.E=Vt[4]|0,this.F=Vt[5]|0,this.G=Vt[6]|0,this.H=Vt[7]|0}get(){const{A:t,B:e,C:n,D:i,E:s,F:o,G:c,H:l}=this;return[t,e,n,i,s,o,c,l]}set(t,e,n,i,s,o,c,l){this.A=t|0,this.B=e|0,this.C=n|0,this.D=i|0,this.E=s|0,this.F=o|0,this.G=c|0,this.H=l|0}process(t,e){for(let h=0;h<16;h++,e+=4)St[h]=t.getUint32(e,!1);for(let h=16;h<64;h++){const p=St[h-15],_=St[h-2],f=ut(p,7)^ut(p,18)^p>>>3,m=ut(_,17)^ut(_,19)^_>>>10;St[h]=m+St[h-7]+f+St[h-16]|0}let{A:n,B:i,C:s,D:o,E:c,F:l,G:u,H:d}=this;for(let h=0;h<64;h++){const p=ut(c,6)^ut(c,11)^ut(c,25),_=d+p+dm(c,l,u)+pm[h]+St[h]|0,f=(ut(n,2)^ut(n,13)^ut(n,22))+hm(n,i,s)|0;d=u,u=l,l=c,c=o+_|0,o=s,s=i,i=n,n=_+f|0}n=n+this.A|0,i=i+this.B|0,s=s+this.C|0,o=o+this.D|0,c=c+this.E|0,l=l+this.F|0,u=u+this.G|0,d=d+this.H|0,this.set(n,i,s,o,c,l,u,d)}roundClean(){rt(St)}destroy(){this.set(0,0,0,0,0,0,0,0),rt(this.buffer)}};const Kl=Cl(["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","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(r=>BigInt(r))),fm=Kl[0],mm=Kl[1],xt=new Uint32Array(80),Ct=new Uint32Array(80);let ao=class extends zl{constructor(t=64){super(128,t,16,!1),this.Ah=Pe[0]|0,this.Al=Pe[1]|0,this.Bh=Pe[2]|0,this.Bl=Pe[3]|0,this.Ch=Pe[4]|0,this.Cl=Pe[5]|0,this.Dh=Pe[6]|0,this.Dl=Pe[7]|0,this.Eh=Pe[8]|0,this.El=Pe[9]|0,this.Fh=Pe[10]|0,this.Fl=Pe[11]|0,this.Gh=Pe[12]|0,this.Gl=Pe[13]|0,this.Hh=Pe[14]|0,this.Hl=Pe[15]|0}get(){const{Ah:t,Al:e,Bh:n,Bl:i,Ch:s,Cl:o,Dh:c,Dl:l,Eh:u,El:d,Fh:h,Fl:p,Gh:_,Gl:f,Hh:m,Hl:y}=this;return[t,e,n,i,s,o,c,l,u,d,h,p,_,f,m,y]}set(t,e,n,i,s,o,c,l,u,d,h,p,_,f,m,y){this.Ah=t|0,this.Al=e|0,this.Bh=n|0,this.Bl=i|0,this.Ch=s|0,this.Cl=o|0,this.Dh=c|0,this.Dl=l|0,this.Eh=u|0,this.El=d|0,this.Fh=h|0,this.Fl=p|0,this.Gh=_|0,this.Gl=f|0,this.Hh=m|0,this.Hl=y|0}process(t,e){for(let g=0;g<16;g++,e+=4)xt[g]=t.getUint32(e),Ct[g]=t.getUint32(e+=4);for(let g=16;g<80;g++){const P=xt[g-15]|0,A=Ct[g-15]|0,E=Mt(P,A,1)^Mt(P,A,8)^aa(P,A,7),D=Bt(P,A,1)^Bt(P,A,8)^ca(P,A,7),L=xt[g-2]|0,w=Ct[g-2]|0,v=Mt(L,w,19)^Fr(L,w,61)^aa(L,w,6),I=Bt(L,w,19)^Wr(L,w,61)^ca(L,w,6),T=Ff(D,I,Ct[g-7],Ct[g-16]),V=Wf(T,E,v,xt[g-7],xt[g-16]);xt[g]=V|0,Ct[g]=T|0}let{Ah:n,Al:i,Bh:s,Bl:o,Ch:c,Cl:l,Dh:u,Dl:d,Eh:h,El:p,Fh:_,Fl:f,Gh:m,Gl:y,Hh:b,Hl:O}=this;for(let g=0;g<80;g++){const P=Mt(h,p,14)^Mt(h,p,18)^Fr(h,p,41),A=Bt(h,p,14)^Bt(h,p,18)^Wr(h,p,41),E=h&_^~h&m,D=p&f^~p&y,L=Hf(O,A,D,mm[g],Ct[g]),w=Gf(L,b,P,E,fm[g],xt[g]),v=L|0,I=Mt(n,i,28)^Fr(n,i,34)^Fr(n,i,39),T=Bt(n,i,28)^Wr(n,i,34)^Wr(n,i,39),V=n&s^n&c^s&c,R=i&o^i&l^o&l;b=m|0,O=y|0,m=_|0,y=f|0,_=h|0,f=p|0,{h,l:p}=ot(u|0,d|0,w|0,v|0),u=c|0,d=l|0,c=s|0,l=o|0,s=n|0,o=i|0;const S=to(v,T,R);n=ro(S,w,I,V),i=S|0}({h:n,l:i}=ot(this.Ah|0,this.Al|0,n|0,i|0)),{h:s,l:o}=ot(this.Bh|0,this.Bl|0,s|0,o|0),{h:c,l}=ot(this.Ch|0,this.Cl|0,c|0,l|0),{h:u,l:d}=ot(this.Dh|0,this.Dl|0,u|0,d|0),{h,l:p}=ot(this.Eh|0,this.El|0,h|0,p|0),{h:_,l:f}=ot(this.Fh|0,this.Fl|0,_|0,f|0),{h:m,l:y}=ot(this.Gh|0,this.Gl|0,m|0,y|0),{h:b,l:O}=ot(this.Hh|0,this.Hl|0,b|0,O|0),this.set(n,i,s,o,c,l,u,d,h,p,_,f,m,y,b,O)}roundClean(){rt(xt,Ct)}destroy(){rt(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}},ym=class extends ao{constructor(){super(48),this.Ah=Te[0]|0,this.Al=Te[1]|0,this.Bh=Te[2]|0,this.Bl=Te[3]|0,this.Ch=Te[4]|0,this.Cl=Te[5]|0,this.Dh=Te[6]|0,this.Dl=Te[7]|0,this.Eh=Te[8]|0,this.El=Te[9]|0,this.Fh=Te[10]|0,this.Fl=Te[11]|0,this.Gh=Te[12]|0,this.Gl=Te[13]|0,this.Hh=Te[14]|0,this.Hl=Te[15]|0}};const Oe=Uint32Array.from([573645204,4230739756,2673172387,3360449730,596883563,1867755857,2520282905,1497426621,2519219938,2827943907,3193839141,1401305490,721525244,746961066,246885852,2177182882]);class wm extends ao{constructor(){super(32),this.Ah=Oe[0]|0,this.Al=Oe[1]|0,this.Bh=Oe[2]|0,this.Bl=Oe[3]|0,this.Ch=Oe[4]|0,this.Cl=Oe[5]|0,this.Dh=Oe[6]|0,this.Dl=Oe[7]|0,this.Eh=Oe[8]|0,this.El=Oe[9]|0,this.Fh=Oe[10]|0,this.Fl=Oe[11]|0,this.Gh=Oe[12]|0,this.Gl=Oe[13]|0,this.Hh=Oe[14]|0,this.Hl=Oe[15]|0}}const ci=mn(()=>new _m),gm=mn(()=>new ao),Em=mn(()=>new ym),vm=mn(()=>new wm),bm=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]),pe=Uint32Array.from([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),B=new Uint32Array(32);function $t(r,t,e,n,i,s){const o=i[s],c=i[s+1];let l=B[2*r],u=B[2*r+1],d=B[2*t],h=B[2*t+1],p=B[2*e],_=B[2*e+1],f=B[2*n],m=B[2*n+1],y=to(l,d,o);u=ro(y,u,h,c),l=y|0,{Dh:m,Dl:f}={Dh:m^u,Dl:f^l},{Dh:m,Dl:f}={Dh:qf(m,f),Dl:Mf(m)},{h:_,l:p}=ot(_,p,m,f),{Bh:h,Bl:d}={Bh:h^_,Bl:d^p},{Bh:h,Bl:d}={Bh:Mt(h,d,24),Bl:Bt(h,d,24)},B[2*r]=l,B[2*r+1]=u,B[2*t]=d,B[2*t+1]=h,B[2*e]=p,B[2*e+1]=_,B[2*n]=f,B[2*n+1]=m}function kt(r,t,e,n,i,s){const o=i[s],c=i[s+1];let l=B[2*r],u=B[2*r+1],d=B[2*t],h=B[2*t+1],p=B[2*e],_=B[2*e+1],f=B[2*n],m=B[2*n+1],y=to(l,d,o);u=ro(y,u,h,c),l=y|0,{Dh:m,Dl:f}={Dh:m^u,Dl:f^l},{Dh:m,Dl:f}={Dh:Mt(m,f,16),Dl:Bt(m,f,16)},{h:_,l:p}=ot(_,p,m,f),{Bh:h,Bl:d}={Bh:h^_,Bl:d^p},{Bh:h,Bl:d}={Bh:Fr(h,d,63),Bl:Wr(h,d,63)},B[2*r]=l,B[2*r+1]=u,B[2*t]=d,B[2*t+1]=h,B[2*e]=p,B[2*e+1]=_,B[2*n]=f,B[2*n+1]=m}function Im(r,t={},e,n,i){if(Lt(e),r<0||r>e)throw new Error("outputLen bigger than keyLen");const{key:s,salt:o,personalization:c}=t;if(s!==void 0&&(s.length<1||s.length>e))throw new Error("key length must be undefined or 1.."+e);if(o!==void 0&&o.length!==n)throw new Error("salt must be undefined or "+n);if(c!==void 0&&c.length!==i)throw new Error("personalization must be undefined or "+i)}class Am extends ai{constructor(t,e){super(),this.finished=!1,this.destroyed=!1,this.length=0,this.pos=0,Lt(t),Lt(e),this.blockLen=t,this.outputLen=e,this.buffer=new Uint8Array(t),this.buffer32=on(this.buffer)}update(t){Wt(this),t=ct(t),tt(t);const{blockLen:e,buffer:n,buffer32:i}=this,s=t.length,o=t.byteOffset,c=t.buffer;for(let l=0;l<s;){this.pos===e&&(jt(i),this.compress(i,0,!1),jt(i),this.pos=0);const u=Math.min(e-this.pos,s-l),d=o+l;if(u===e&&!(d%4)&&l+u<s){const h=new Uint32Array(c,d,Math.floor((s-l)/4));jt(h);for(let p=0;l+e<s;p+=i.length,l+=e)this.length+=e,this.compress(h,p,!1);jt(h);continue}n.set(t.subarray(l,l+u),this.pos),this.pos+=u,this.length+=u,l+=u}return this}digestInto(t){Wt(this),so(t,this);const{pos:e,buffer32:n}=this;this.finished=!0,rt(this.buffer.subarray(e)),jt(n),this.compress(n,0,!0),jt(n);const i=on(t);this.get().forEach((s,o)=>i[o]=It(s))}digest(){const{buffer:t,outputLen:e}=this;this.digestInto(t);const n=t.slice(0,e);return this.destroy(),n}_cloneInto(t){const{buffer:e,length:n,finished:i,destroyed:s,outputLen:o,pos:c}=this;return t||(t=new this.constructor({dkLen:o})),t.set(...this.get()),t.buffer.set(e),t.destroyed=s,t.finished=i,t.length=n,t.pos=c,t.outputLen=o,t}clone(){return this._cloneInto()}}class Tm extends Am{constructor(t={}){const e=t.dkLen===void 0?64:t.dkLen;super(128,e),this.v0l=pe[0]|0,this.v0h=pe[1]|0,this.v1l=pe[2]|0,this.v1h=pe[3]|0,this.v2l=pe[4]|0,this.v2h=pe[5]|0,this.v3l=pe[6]|0,this.v3h=pe[7]|0,this.v4l=pe[8]|0,this.v4h=pe[9]|0,this.v5l=pe[10]|0,this.v5h=pe[11]|0,this.v6l=pe[12]|0,this.v6h=pe[13]|0,this.v7l=pe[14]|0,this.v7h=pe[15]|0,Im(e,t,64,16,16);let{key:n,personalization:i,salt:s}=t,o=0;if(n!==void 0&&(n=ct(n),o=n.length),this.v0l^=this.outputLen|o<<8|65536|1<<24,s!==void 0){s=ct(s);const c=on(s);this.v4l^=It(c[0]),this.v4h^=It(c[1]),this.v5l^=It(c[2]),this.v5h^=It(c[3])}if(i!==void 0){i=ct(i);const c=on(i);this.v6l^=It(c[0]),this.v6h^=It(c[1]),this.v7l^=It(c[2]),this.v7h^=It(c[3])}if(n!==void 0){const c=new Uint8Array(this.blockLen);c.set(n),this.update(c)}}get(){let{v0l:t,v0h:e,v1l:n,v1h:i,v2l:s,v2h:o,v3l:c,v3h:l,v4l:u,v4h:d,v5l:h,v5h:p,v6l:_,v6h:f,v7l:m,v7h:y}=this;return[t,e,n,i,s,o,c,l,u,d,h,p,_,f,m,y]}set(t,e,n,i,s,o,c,l,u,d,h,p,_,f,m,y){this.v0l=t|0,this.v0h=e|0,this.v1l=n|0,this.v1h=i|0,this.v2l=s|0,this.v2h=o|0,this.v3l=c|0,this.v3h=l|0,this.v4l=u|0,this.v4h=d|0,this.v5l=h|0,this.v5h=p|0,this.v6l=_|0,this.v6h=f|0,this.v7l=m|0,this.v7h=y|0}compress(t,e,n){this.get().forEach((l,u)=>B[u]=l),B.set(pe,16);let{h:i,l:s}=xl(BigInt(this.length));B[24]=pe[8]^s,B[25]=pe[9]^i,n&&(B[28]=~B[28],B[29]=~B[29]);let o=0;const c=bm;for(let l=0;l<12;l++)$t(0,4,8,12,t,e+2*c[o++]),kt(0,4,8,12,t,e+2*c[o++]),$t(1,5,9,13,t,e+2*c[o++]),kt(1,5,9,13,t,e+2*c[o++]),$t(2,6,10,14,t,e+2*c[o++]),kt(2,6,10,14,t,e+2*c[o++]),$t(3,7,11,15,t,e+2*c[o++]),kt(3,7,11,15,t,e+2*c[o++]),$t(0,5,10,15,t,e+2*c[o++]),kt(0,5,10,15,t,e+2*c[o++]),$t(1,6,11,12,t,e+2*c[o++]),kt(1,6,11,12,t,e+2*c[o++]),$t(2,7,8,13,t,e+2*c[o++]),kt(2,7,8,13,t,e+2*c[o++]),$t(3,4,9,14,t,e+2*c[o++]),kt(3,4,9,14,t,e+2*c[o++]);this.v0l^=B[0]^B[16],this.v0h^=B[1]^B[17],this.v1l^=B[2]^B[18],this.v1h^=B[3]^B[19],this.v2l^=B[4]^B[20],this.v2h^=B[5]^B[21],this.v3l^=B[6]^B[22],this.v3h^=B[7]^B[23],this.v4l^=B[8]^B[24],this.v4h^=B[9]^B[25],this.v5l^=B[10]^B[26],this.v5h^=B[11]^B[27],this.v6l^=B[12]^B[28],this.v6h^=B[13]^B[29],this.v7l^=B[14]^B[30],this.v7h^=B[15]^B[31],rt(B)}destroy(){this.destroyed=!0,rt(this.buffer32),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const Pm=Qf(r=>new Tm(r)),Om="https://rpc.walletconnect.org/v1";function Fl(r){const t=`Ethereum Signed Message:
|
|
5
5
|
${r.length}`,e=new TextEncoder().encode(t+r);return"0x"+re.from(lm(e)).toString("hex")}async function Rm(r,t,e,n,i,s){switch(e.t){case"eip191":return await Lm(r,t,e.s);case"eip1271":return await Dm(r,t,e.s,n,i,s);default:throw new Error(`verifySignature failed: Attempted to verify CacaoSignature with unknown type: ${e.t}`)}}async function Lm(r,t,e){return(await cf({hash:Fl(t),signature:e})).toLowerCase()===r.toLowerCase()}async function Dm(r,t,e,n,i,s){const o=xn(n);if(!o.namespace||!o.reference)throw new Error(`isValidEip1271Signature failed: chainId must be in CAIP-2 format, received: ${n}`);try{const c="0x1626ba7e",l="0000000000000000000000000000000000000000000000000000000000000040",u=e.substring(2),d=(u.length/2).toString(16).padStart(64,"0"),h=(t.startsWith("0x")?t:Fl(t)).substring(2),p=c+h+l+d+u,_=await fetch(`${s||Om}/?chainId=${n}&projectId=${i}`,{headers:{"Content-Type":"application/json"},method:"POST",body:JSON.stringify({id:Vm(),jsonrpc:"2.0",method:"eth_call",params:[{to:r,data:p},"latest"]})}),{result:f}=await _.json();return f?f.slice(0,c.length).toLowerCase()===c.toLowerCase():!1}catch(c){return console.error("isValidEip1271Signature: ",c),!1}}function Vm(){return Date.now()+Math.floor(Math.random()*1e3)}function Sm(r){const t=atob(r),e=new Uint8Array(t.length);for(let o=0;o<t.length;o++)e[o]=t.charCodeAt(o);const n=e[0];if(n===0)throw new Error("No signatures found");const i=1+n*64;if(e.length<i)throw new Error("Transaction data too short for claimed signature count");if(e.length<100)throw new Error("Transaction too short");const s=re.from(r,"base64").slice(1,65);return _n.encode(s)}function xm(r){const t=new Uint8Array(re.from(r,"base64")),e=Array.from("TransactionData::").map(s=>s.charCodeAt(0)),n=new Uint8Array(e.length+t.length);n.set(e),n.set(t,e.length);const i=Pm(n,{dkLen:32});return _n.encode(i)}function ha(r){const t=new Uint8Array(ci(Cm(r)));return _n.encode(t)}function Cm(r){if(r instanceof Uint8Array)return r;if(Array.isArray(r))return new Uint8Array(r);if(typeof r=="object"&&r!=null&&r.data)return new Uint8Array(Object.values(r.data));if(typeof r=="object"&&r)return new Uint8Array(Object.values(r));throw new Error("getNearUint8ArrayFromBytes: Unexpected result type from bytes array")}function pa(r){const t=re.from(r,"base64"),e=Qd(t).txn;if(!e)throw new Error("Invalid signed transaction: missing 'txn' field");const n=Xd(e),i=re.from("TX"),s=re.concat([i,re.from(n)]),o=vm(s);return mh.encode(o).replace(/=+$/,"")}function Oi(r){const t=[];let e=BigInt(r);for(;e>=BigInt(128);)t.push(Number(e&BigInt(127)|BigInt(128))),e>>=BigInt(7);return t.push(Number(e)),re.from(t)}function $m(r){const t=re.from(r.signed.bodyBytes,"base64"),e=re.from(r.signed.authInfoBytes,"base64"),n=re.from(r.signature.signature,"base64"),i=[];i.push(re.from([10])),i.push(Oi(t.length)),i.push(t),i.push(re.from([18])),i.push(Oi(e.length)),i.push(e),i.push(re.from([26])),i.push(Oi(n.length)),i.push(n);const s=re.concat(i),o=ci(s);return re.from(o).toString("hex").toUpperCase()}var km=Object.defineProperty,Nm=Object.defineProperties,Um=Object.getOwnPropertyDescriptors,_a=Object.getOwnPropertySymbols,qm=Object.prototype.hasOwnProperty,Mm=Object.prototype.propertyIsEnumerable,fa=(r,t,e)=>t in r?km(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Bm=(r,t)=>{for(var e in t||(t={}))qm.call(t,e)&&fa(r,e,t[e]);if(_a)for(var e of _a(t))Mm.call(t,e)&&fa(r,e,t[e]);return r},jm=(r,t)=>Nm(r,Um(t));const zm="did:pkh:",co=r=>r==null?void 0:r.split(":"),Km=r=>{const t=r&&co(r);if(t)return r.includes(zm)?t[3]:t[1]},as=r=>{const t=r&&co(r);if(t)return t[2]+":"+t[3]},Yn=r=>{const t=r&&co(r);if(t)return t.pop()};async function ma(r){const{cacao:t,projectId:e}=r,{s:n,p:i}=t,s=Wl(i,i.iss),o=Yn(i.iss);return await Rm(o,s,n,as(i.iss),e)}const Wl=(r,t)=>{const e=`${r.domain} wants you to sign in with your Ethereum account:`,n=Yn(t);if(!r.aud&&!r.uri)throw new Error("Either `aud` or `uri` is required to construct the message");let i=r.statement||void 0;const s=`URI: ${r.aud||r.uri}`,o=`Version: ${r.version}`,c=`Chain ID: ${Km(t)}`,l=`Nonce: ${r.nonce}`,u=`Issued At: ${r.iat}`,d=r.exp?`Expiration Time: ${r.exp}`:void 0,h=r.nbf?`Not Before: ${r.nbf}`:void 0,p=r.requestId?`Request ID: ${r.requestId}`:void 0,_=r.resources?`Resources:${r.resources.map(m=>`
|
|
6
6
|
- ${m}`).join("")}`:void 0,f=Cn(r.resources);if(f){const m=cn(f);i=Xm(i,m)}return[e,n,"",i,"",s,o,c,l,u,d,h,p,_].filter(m=>m!=null).join(`
|
|
7
7
|
`)};function Fm(r){return re.from(JSON.stringify(r)).toString("base64")}function Wm(r){return JSON.parse(re.from(r,"base64").toString("utf-8"))}function ar(r){if(!r)throw new Error("No recap provided, value is undefined");if(!r.att)throw new Error("No `att` property found");const t=Object.keys(r.att);if(!(t!=null&&t.length))throw new Error("No resources found in `att` property");t.forEach(e=>{const n=r.att[e];if(Array.isArray(n))throw new Error(`Resource must be an object: ${e}`);if(typeof n!="object")throw new Error(`Resource must be an object: ${e}`);if(!Object.keys(n).length)throw new Error(`Resource object is empty: ${e}`);Object.keys(n).forEach(i=>{const s=n[i];if(!Array.isArray(s))throw new Error(`Ability limits ${i} must be an array of objects, found: ${s}`);if(!s.length)throw new Error(`Value of ${i} is empty array, must be an array with objects`);s.forEach(o=>{if(typeof o!="object")throw new Error(`Ability limits (${i}) must be an array of objects, found: ${o}`)})})})}function Hm(r,t,e,n={}){return e==null||e.sort((i,s)=>i.localeCompare(s)),{att:{[r]:Gm(t,e,n)}}}function Gm(r,t,e={}){t=t==null?void 0:t.sort((i,s)=>i.localeCompare(s));const n=t.map(i=>({[`${r}/${i}`]:[e]}));return Object.assign({},...n)}function Hl(r){return ar(r),`urn:recap:${Fm(r).replace(/=/g,"")}`}function cn(r){const t=Wm(r.replace("urn:recap:",""));return ar(t),t}function Jm(r,t,e){const n=Hm(r,t,e);return Hl(n)}function Zm(r){return r&&r.includes("urn:recap:")}function Ym(r,t){const e=cn(r),n=cn(t),i=Qm(e,n);return Hl(i)}function Qm(r,t){ar(r),ar(t);const e=Object.keys(r.att).concat(Object.keys(t.att)).sort((i,s)=>i.localeCompare(s)),n={att:{}};return e.forEach(i=>{var s,o;Object.keys(((s=r.att)==null?void 0:s[i])||{}).concat(Object.keys(((o=t.att)==null?void 0:o[i])||{})).sort((c,l)=>c.localeCompare(l)).forEach(c=>{var l,u;n.att[i]=jm(Bm({},n.att[i]),{[c]:((l=r.att[i])==null?void 0:l[c])||((u=t.att[i])==null?void 0:u[c])})})}),n}function Xm(r="",t){ar(t);const e="I further authorize the stated URI to perform the following actions on my behalf: ";if(r.includes(e))return r;const n=[];let i=0;Object.keys(t.att).forEach(c=>{const l=Object.keys(t.att[c]).map(h=>({ability:h.split("/")[0],action:h.split("/")[1]}));l.sort((h,p)=>h.action.localeCompare(p.action));const u={};l.forEach(h=>{u[h.ability]||(u[h.ability]=[]),u[h.ability].push(h.action)});const d=Object.keys(u).map(h=>(i++,`(${i}) '${h}': '${u[h].join("', '")}' for '${c}'.`));n.push(d.join(", ").replace(".,","."))});const s=n.join(" "),o=`${e}${s}`;return`${r?r+" ":""}${o}`}function ya(r){var t;const e=cn(r);ar(e);const n=(t=e.att)==null?void 0:t.eip155;return n?Object.keys(n).map(i=>i.split("/")[1]):[]}function wa(r){const t=cn(r);ar(t);const e=[];return Object.values(t.att).forEach(n=>{Object.values(n).forEach(i=>{var s;(s=i==null?void 0:i[0])!=null&&s.chains&&e.push(i[0].chains)})}),[...new Set(e.flat())]}function Cn(r){if(!r)return;const t=r==null?void 0:r[r.length-1];return Zm(t)?t:void 0}/*! noble-ciphers - MIT License (c) 2023 Paul Miller (paulmillr.com) */function Gl(r){return r instanceof Uint8Array||ArrayBuffer.isView(r)&&r.constructor.name==="Uint8Array"}function cs(r){if(typeof r!="boolean")throw new Error(`boolean expected, not ${r}`)}function Ri(r){if(!Number.isSafeInteger(r)||r<0)throw new Error("positive integer expected, got "+r)}function qe(r,...t){if(!Gl(r))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(r.length))throw new Error("Uint8Array expected of length "+t+", got length="+r.length)}function ga(r,t=!0){if(r.destroyed)throw new Error("Hash instance has been destroyed");if(t&&r.finished)throw new Error("Hash#digest() has already been called")}function ey(r,t){qe(r);const e=t.outputLen;if(r.length<e)throw new Error("digestInto() expects output buffer of length at least "+e)}function Ft(r){return new Uint32Array(r.buffer,r.byteOffset,Math.floor(r.byteLength/4))}function br(...r){for(let t=0;t<r.length;t++)r[t].fill(0)}function ty(r){return new DataView(r.buffer,r.byteOffset,r.byteLength)}const ry=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function ny(r){if(typeof r!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(r))}function ls(r){if(typeof r=="string")r=ny(r);else if(Gl(r))r=us(r);else throw new Error("Uint8Array expected, got "+typeof r);return r}function iy(r,t){if(t==null||typeof t!="object")throw new Error("options must be defined");return Object.assign(r,t)}function sy(r,t){if(r.length!==t.length)return!1;let e=0;for(let n=0;n<r.length;n++)e|=r[n]^t[n];return e===0}const oy=(r,t)=>{function e(n,...i){if(qe(n),!ry)throw new Error("Non little-endian hardware is not yet supported");if(r.nonceLength!==void 0){const u=i[0];if(!u)throw new Error("nonce / iv required");r.varSizeNonce?qe(u):qe(u,r.nonceLength)}const s=r.tagLength;s&&i[1]!==void 0&&qe(i[1]);const o=t(n,...i),c=(u,d)=>{if(d!==void 0){if(u!==2)throw new Error("cipher output not supported");qe(d)}};let l=!1;return{encrypt(u,d){if(l)throw new Error("cannot encrypt() twice with same key + nonce");return l=!0,qe(u),c(o.encrypt.length,d),o.encrypt(u,d)},decrypt(u,d){if(qe(u),s&&u.length<s)throw new Error("invalid ciphertext length: smaller than tagLength="+s);return c(o.decrypt.length,d),o.decrypt(u,d)}}}return Object.assign(e,r),e};function Ea(r,t,e=!0){if(t===void 0)return new Uint8Array(r);if(t.length!==r)throw new Error("invalid output length, expected "+r+", got: "+t.length);if(e&&!cy(t))throw new Error("invalid output, must be aligned");return t}function va(r,t,e,n){if(typeof r.setBigUint64=="function")return r.setBigUint64(t,e,n);const i=BigInt(32),s=BigInt(4294967295),o=Number(e>>i&s),c=Number(e&s);r.setUint32(t+4,o,n),r.setUint32(t+0,c,n)}function ay(r,t,e){cs(e);const n=new Uint8Array(16),i=ty(n);return va(i,0,BigInt(t),e),va(i,8,BigInt(r),e),n}function cy(r){return r.byteOffset%4===0}function us(r){return Uint8Array.from(r)}const Jl=r=>Uint8Array.from(r.split("").map(t=>t.charCodeAt(0))),ly=Jl("expand 16-byte k"),uy=Jl("expand 32-byte k"),dy=Ft(ly),hy=Ft(uy);function Y(r,t){return r<<t|r>>>32-t}function ds(r){return r.byteOffset%4===0}const Tn=64,py=16,Zl=2**32-1,ba=new Uint32Array;function _y(r,t,e,n,i,s,o,c){const l=i.length,u=new Uint8Array(Tn),d=Ft(u),h=ds(i)&&ds(s),p=h?Ft(i):ba,_=h?Ft(s):ba;for(let f=0;f<l;o++){if(r(t,e,n,d,o,c),o>=Zl)throw new Error("arx: counter overflow");const m=Math.min(Tn,l-f);if(h&&m===Tn){const y=f/4;if(f%4!==0)throw new Error("arx: invalid block position");for(let b=0,O;b<py;b++)O=y+b,_[O]=p[O]^d[b];f+=Tn;continue}for(let y=0,b;y<m;y++)b=f+y,s[b]=i[b]^u[y];f+=m}}function fy(r,t){const{allowShortKeys:e,extendNonceFn:n,counterLength:i,counterRight:s,rounds:o}=iy({allowShortKeys:!1,counterLength:8,counterRight:!1,rounds:20},t);if(typeof r!="function")throw new Error("core must be a function");return Ri(i),Ri(o),cs(s),cs(e),(c,l,u,d,h=0)=>{qe(c),qe(l),qe(u);const p=u.length;if(d===void 0&&(d=new Uint8Array(p)),qe(d),Ri(h),h<0||h>=Zl)throw new Error("arx: counter overflow");if(d.length<p)throw new Error(`arx: output (${d.length}) is shorter than data (${p})`);const _=[];let f=c.length,m,y;if(f===32)_.push(m=us(c)),y=hy;else if(f===16&&e)m=new Uint8Array(32),m.set(c),m.set(c,16),y=dy,_.push(m);else throw new Error(`arx: invalid 32-byte key, got length=${f}`);ds(l)||_.push(l=us(l));const b=Ft(m);if(n){if(l.length!==24)throw new Error("arx: extended nonce must be 24 bytes");n(y,b,Ft(l.subarray(0,16)),b),l=l.subarray(16)}const O=16-i;if(O!==l.length)throw new Error(`arx: nonce must be ${O} or 16 bytes`);if(O!==12){const P=new Uint8Array(12);P.set(l,s?0:12-l.length),l=P,_.push(l)}const g=Ft(l);return _y(r,y,b,g,u,d,h,o),br(..._),d}}const Ee=(r,t)=>r[t++]&255|(r[t++]&255)<<8;class my{constructor(t){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,t=ls(t),qe(t,32);const e=Ee(t,0),n=Ee(t,2),i=Ee(t,4),s=Ee(t,6),o=Ee(t,8),c=Ee(t,10),l=Ee(t,12),u=Ee(t,14);this.r[0]=e&8191,this.r[1]=(e>>>13|n<<3)&8191,this.r[2]=(n>>>10|i<<6)&7939,this.r[3]=(i>>>7|s<<9)&8191,this.r[4]=(s>>>4|o<<12)&255,this.r[5]=o>>>1&8190,this.r[6]=(o>>>14|c<<2)&8191,this.r[7]=(c>>>11|l<<5)&8065,this.r[8]=(l>>>8|u<<8)&8191,this.r[9]=u>>>5&127;for(let d=0;d<8;d++)this.pad[d]=Ee(t,16+2*d)}process(t,e,n=!1){const i=n?0:2048,{h:s,r:o}=this,c=o[0],l=o[1],u=o[2],d=o[3],h=o[4],p=o[5],_=o[6],f=o[7],m=o[8],y=o[9],b=Ee(t,e+0),O=Ee(t,e+2),g=Ee(t,e+4),P=Ee(t,e+6),A=Ee(t,e+8),E=Ee(t,e+10),D=Ee(t,e+12),L=Ee(t,e+14);let w=s[0]+(b&8191),v=s[1]+((b>>>13|O<<3)&8191),I=s[2]+((O>>>10|g<<6)&8191),T=s[3]+((g>>>7|P<<9)&8191),V=s[4]+((P>>>4|A<<12)&8191),R=s[5]+(A>>>1&8191),S=s[6]+((A>>>14|E<<2)&8191),$=s[7]+((E>>>11|D<<5)&8191),k=s[8]+((D>>>8|L<<8)&8191),M=s[9]+(L>>>5|i),C=0,N=C+w*c+v*(5*y)+I*(5*m)+T*(5*f)+V*(5*_);C=N>>>13,N&=8191,N+=R*(5*p)+S*(5*h)+$*(5*d)+k*(5*u)+M*(5*l),C+=N>>>13,N&=8191;let j=C+w*l+v*c+I*(5*y)+T*(5*m)+V*(5*f);C=j>>>13,j&=8191,j+=R*(5*_)+S*(5*p)+$*(5*h)+k*(5*d)+M*(5*u),C+=j>>>13,j&=8191;let z=C+w*u+v*l+I*c+T*(5*y)+V*(5*m);C=z>>>13,z&=8191,z+=R*(5*f)+S*(5*_)+$*(5*p)+k*(5*h)+M*(5*d),C+=z>>>13,z&=8191;let K=C+w*d+v*u+I*l+T*c+V*(5*y);C=K>>>13,K&=8191,K+=R*(5*m)+S*(5*f)+$*(5*_)+k*(5*p)+M*(5*h),C+=K>>>13,K&=8191;let F=C+w*h+v*d+I*u+T*l+V*c;C=F>>>13,F&=8191,F+=R*(5*y)+S*(5*m)+$*(5*f)+k*(5*_)+M*(5*p),C+=F>>>13,F&=8191;let W=C+w*p+v*h+I*d+T*u+V*l;C=W>>>13,W&=8191,W+=R*c+S*(5*y)+$*(5*m)+k*(5*f)+M*(5*_),C+=W>>>13,W&=8191;let H=C+w*_+v*p+I*h+T*d+V*u;C=H>>>13,H&=8191,H+=R*l+S*c+$*(5*y)+k*(5*m)+M*(5*f),C+=H>>>13,H&=8191;let ue=C+w*f+v*_+I*p+T*h+V*d;C=ue>>>13,ue&=8191,ue+=R*u+S*l+$*c+k*(5*y)+M*(5*m),C+=ue>>>13,ue&=8191;let ce=C+w*m+v*f+I*_+T*p+V*h;C=ce>>>13,ce&=8191,ce+=R*d+S*u+$*l+k*c+M*(5*y),C+=ce>>>13,ce&=8191;let oe=C+w*y+v*m+I*f+T*_+V*p;C=oe>>>13,oe&=8191,oe+=R*h+S*d+$*u+k*l+M*c,C+=oe>>>13,oe&=8191,C=(C<<2)+C|0,C=C+N|0,N=C&8191,C=C>>>13,j+=C,s[0]=N,s[1]=j,s[2]=z,s[3]=K,s[4]=F,s[5]=W,s[6]=H,s[7]=ue,s[8]=ce,s[9]=oe}finalize(){const{h:t,pad:e}=this,n=new Uint16Array(10);let i=t[1]>>>13;t[1]&=8191;for(let c=2;c<10;c++)t[c]+=i,i=t[c]>>>13,t[c]&=8191;t[0]+=i*5,i=t[0]>>>13,t[0]&=8191,t[1]+=i,i=t[1]>>>13,t[1]&=8191,t[2]+=i,n[0]=t[0]+5,i=n[0]>>>13,n[0]&=8191;for(let c=1;c<10;c++)n[c]=t[c]+i,i=n[c]>>>13,n[c]&=8191;n[9]-=8192;let s=(i^1)-1;for(let c=0;c<10;c++)n[c]&=s;s=~s;for(let c=0;c<10;c++)t[c]=t[c]&s|n[c];t[0]=(t[0]|t[1]<<13)&65535,t[1]=(t[1]>>>3|t[2]<<10)&65535,t[2]=(t[2]>>>6|t[3]<<7)&65535,t[3]=(t[3]>>>9|t[4]<<4)&65535,t[4]=(t[4]>>>12|t[5]<<1|t[6]<<14)&65535,t[5]=(t[6]>>>2|t[7]<<11)&65535,t[6]=(t[7]>>>5|t[8]<<8)&65535,t[7]=(t[8]>>>8|t[9]<<5)&65535;let o=t[0]+e[0];t[0]=o&65535;for(let c=1;c<8;c++)o=(t[c]+e[c]|0)+(o>>>16)|0,t[c]=o&65535;br(n)}update(t){ga(this),t=ls(t),qe(t);const{buffer:e,blockLen:n}=this,i=t.length;for(let s=0;s<i;){const o=Math.min(n-this.pos,i-s);if(o===n){for(;n<=i-s;s+=n)this.process(t,s);continue}e.set(t.subarray(s,s+o),this.pos),this.pos+=o,s+=o,this.pos===n&&(this.process(e,0,!1),this.pos=0)}return this}destroy(){br(this.h,this.r,this.buffer,this.pad)}digestInto(t){ga(this),ey(t,this),this.finished=!0;const{buffer:e,h:n}=this;let{pos:i}=this;if(i){for(e[i++]=1;i<16;i++)e[i]=0;this.process(e,0,!0)}this.finalize();let s=0;for(let o=0;o<8;o++)t[s++]=n[o]>>>0,t[s++]=n[o]>>>8;return t}digest(){const{buffer:t,outputLen:e}=this;this.digestInto(t);const n=t.slice(0,e);return this.destroy(),n}}function yy(r){const t=(n,i)=>r(i).update(ls(n)).digest(),e=r(new Uint8Array(32));return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=n=>r(n),t}const wy=yy(r=>new my(r));function gy(r,t,e,n,i,s=20){let o=r[0],c=r[1],l=r[2],u=r[3],d=t[0],h=t[1],p=t[2],_=t[3],f=t[4],m=t[5],y=t[6],b=t[7],O=i,g=e[0],P=e[1],A=e[2],E=o,D=c,L=l,w=u,v=d,I=h,T=p,V=_,R=f,S=m,$=y,k=b,M=O,C=g,N=P,j=A;for(let K=0;K<s;K+=2)E=E+v|0,M=Y(M^E,16),R=R+M|0,v=Y(v^R,12),E=E+v|0,M=Y(M^E,8),R=R+M|0,v=Y(v^R,7),D=D+I|0,C=Y(C^D,16),S=S+C|0,I=Y(I^S,12),D=D+I|0,C=Y(C^D,8),S=S+C|0,I=Y(I^S,7),L=L+T|0,N=Y(N^L,16),$=$+N|0,T=Y(T^$,12),L=L+T|0,N=Y(N^L,8),$=$+N|0,T=Y(T^$,7),w=w+V|0,j=Y(j^w,16),k=k+j|0,V=Y(V^k,12),w=w+V|0,j=Y(j^w,8),k=k+j|0,V=Y(V^k,7),E=E+I|0,j=Y(j^E,16),$=$+j|0,I=Y(I^$,12),E=E+I|0,j=Y(j^E,8),$=$+j|0,I=Y(I^$,7),D=D+T|0,M=Y(M^D,16),k=k+M|0,T=Y(T^k,12),D=D+T|0,M=Y(M^D,8),k=k+M|0,T=Y(T^k,7),L=L+V|0,C=Y(C^L,16),R=R+C|0,V=Y(V^R,12),L=L+V|0,C=Y(C^L,8),R=R+C|0,V=Y(V^R,7),w=w+v|0,N=Y(N^w,16),S=S+N|0,v=Y(v^S,12),w=w+v|0,N=Y(N^w,8),S=S+N|0,v=Y(v^S,7);let z=0;n[z++]=o+E|0,n[z++]=c+D|0,n[z++]=l+L|0,n[z++]=u+w|0,n[z++]=d+v|0,n[z++]=h+I|0,n[z++]=p+T|0,n[z++]=_+V|0,n[z++]=f+R|0,n[z++]=m+S|0,n[z++]=y+$|0,n[z++]=b+k|0,n[z++]=O+M|0,n[z++]=g+C|0,n[z++]=P+N|0,n[z++]=A+j|0}const Ey=fy(gy,{counterRight:!1,counterLength:4,allowShortKeys:!1}),vy=new Uint8Array(16),Ia=(r,t)=>{r.update(t);const e=t.length%16;e&&r.update(vy.subarray(e))},by=new Uint8Array(32);function Aa(r,t,e,n,i){const s=r(t,e,by),o=wy.create(s);i&&Ia(o,i),Ia(o,n);const c=ay(n.length,i?i.length:0,!0);o.update(c);const l=o.digest();return br(s,c),l}const Iy=r=>(t,e,n)=>({encrypt(i,s){const o=i.length;s=Ea(o+16,s,!1),s.set(i);const c=s.subarray(0,-16);r(t,e,c,c,1);const l=Aa(r,t,e,c,n);return s.set(l,o),br(l),s},decrypt(i,s){s=Ea(i.length-16,s,!1);const o=i.subarray(0,-16),c=i.subarray(-16),l=Aa(r,t,e,o,n);if(!sy(c,l))throw new Error("invalid tag");return s.set(i.subarray(0,-16)),r(t,e,s,s,1),br(l),s}}),Yl=oy({blockSize:64,nonceLength:12,tagLength:16},Iy(Ey));let Ql=class extends ai{constructor(t,e){super(),this.finished=!1,this.destroyed=!1,io(t);const n=ct(e);if(this.iHash=t.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 i=this.blockLen,s=new Uint8Array(i);s.set(n.length>i?t.create().update(n).digest():n);for(let o=0;o<s.length;o++)s[o]^=54;this.iHash.update(s),this.oHash=t.create();for(let o=0;o<s.length;o++)s[o]^=106;this.oHash.update(s),rt(s)}update(t){return Wt(this),this.iHash.update(t),this}digestInto(t){Wt(this),tt(t,this.outputLen),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){const t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));const{oHash:e,iHash:n,finished:i,destroyed:s,blockLen:o,outputLen:c}=this;return t=t,t.finished=i,t.destroyed=s,t.blockLen=o,t.outputLen=c,t.oHash=e._cloneInto(t.oHash),t.iHash=n._cloneInto(t.iHash),t}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}};const li=(r,t,e)=>new Ql(r,t).update(e).digest();li.create=(r,t)=>new Ql(r,t);function Ay(r,t,e){return io(r),e===void 0&&(e=new Uint8Array(r.outputLen)),li(r,ct(e),ct(t))}const Li=Uint8Array.from([0]),Ta=Uint8Array.of();function Ty(r,t,e,n=32){io(r),Lt(n);const i=r.outputLen;if(n>255*i)throw new Error("Length should be <= 255*HashLen");const s=Math.ceil(n/i);e===void 0&&(e=Ta);const o=new Uint8Array(s*i),c=li.create(r,t),l=c._cloneInto(),u=new Uint8Array(c.outputLen);for(let d=0;d<s;d++)Li[0]=d+1,l.update(d===0?Ta:u).update(e).update(Li).digestInto(u),o.set(u,i*d),c._cloneInto(l);return c.destroy(),l.destroy(),rt(u,Li),o.slice(0,n)}const Py=(r,t,e,n,i)=>Ty(r,Ay(r,t,e),n,i),ui=ci,lo=BigInt(0),hs=BigInt(1);function Qn(r,t){if(typeof t!="boolean")throw new Error(r+" boolean expected, got "+t)}function Pn(r){const t=r.toString(16);return t.length&1?"0"+t:t}function Xl(r){if(typeof r!="string")throw new Error("hex string expected, got "+typeof r);return r===""?lo:BigInt("0x"+r)}function di(r){return Xl(an(r))}function Xn(r){return tt(r),Xl(an(Uint8Array.from(r).reverse()))}function uo(r,t){return oo(r.toString(16).padStart(t*2,"0"))}function ho(r,t){return uo(r,t).reverse()}function Ue(r,t,e){let n;if(typeof t=="string")try{n=oo(t)}catch(s){throw new Error(r+" must be hex string or Uint8Array, cause: "+s)}else if(no(t))n=Uint8Array.from(t);else throw new Error(r+" must be hex string or Uint8Array");const i=n.length;if(typeof e=="number"&&i!==e)throw new Error(r+" of length "+e+" expected, got "+i);return n}const Di=r=>typeof r=="bigint"&&lo<=r;function Oy(r,t,e){return Di(r)&&Di(t)&&Di(e)&&t<=r&&r<e}function ps(r,t,e,n){if(!Oy(t,e,n))throw new Error("expected valid "+r+": "+e+" <= n < "+n+", got "+t)}function Ry(r){let t;for(t=0;r>lo;r>>=hs,t+=1);return t}const hi=r=>(hs<<BigInt(r))-hs;function Ly(r,t,e){if(typeof r!="number"||r<2)throw new Error("hashLen must be a number");if(typeof t!="number"||t<2)throw new Error("qByteLen must be a number");if(typeof e!="function")throw new Error("hmacFn must be a function");const n=p=>new Uint8Array(p),i=p=>Uint8Array.of(p);let s=n(r),o=n(r),c=0;const l=()=>{s.fill(1),o.fill(0),c=0},u=(...p)=>e(o,s,...p),d=(p=n(0))=>{o=u(i(0),p),s=u(),p.length!==0&&(o=u(i(1),p),s=u())},h=()=>{if(c++>=1e3)throw new Error("drbg: tried 1000 values");let p=0;const _=[];for(;p<t;){s=u();const f=s.slice();_.push(f),p+=s.length}return tr(..._)};return(p,_)=>{l(),d(p);let f;for(;!(f=_(h()));)d();return l(),f}}function pi(r,t,e={}){if(!r||typeof r!="object")throw new Error("expected valid options object");function n(i,s,o){const c=r[i];if(o&&c===void 0)return;const l=typeof c;if(l!==s||c===null)throw new Error(`param "${i}" is invalid: expected ${s}, got ${l}`)}Object.entries(t).forEach(([i,s])=>n(i,s,!1)),Object.entries(e).forEach(([i,s])=>n(i,s,!0))}function Pa(r){const t=new WeakMap;return(e,...n)=>{const i=t.get(e);if(i!==void 0)return i;const s=r(e,...n);return t.set(e,s),s}}const je=BigInt(0),Se=BigInt(1),rr=BigInt(2),Dy=BigInt(3),eu=BigInt(4),tu=BigInt(5),ru=BigInt(8);function Xe(r,t){const e=r%t;return e>=je?e:t+e}function st(r,t,e){let n=r;for(;t-- >je;)n*=n,n%=e;return n}function Oa(r,t){if(r===je)throw new Error("invert: expected non-zero number");if(t<=je)throw new Error("invert: expected positive modulus, got "+t);let e=Xe(r,t),n=t,i=je,s=Se;for(;e!==je;){const o=n/e,c=n%e,l=i-s*o;n=e,e=c,i=s,s=l}if(n!==Se)throw new Error("invert: does not exist");return Xe(i,t)}function nu(r,t){const e=(r.ORDER+Se)/eu,n=r.pow(t,e);if(!r.eql(r.sqr(n),t))throw new Error("Cannot find square root");return n}function Vy(r,t){const e=(r.ORDER-tu)/ru,n=r.mul(t,rr),i=r.pow(n,e),s=r.mul(t,i),o=r.mul(r.mul(s,rr),i),c=r.mul(s,r.sub(o,r.ONE));if(!r.eql(r.sqr(c),t))throw new Error("Cannot find square root");return c}function Sy(r){if(r<BigInt(3))throw new Error("sqrt is not defined for small field");let t=r-Se,e=0;for(;t%rr===je;)t/=rr,e++;let n=rr;const i=Sr(r);for(;Ra(i,n)===1;)if(n++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(e===1)return nu;let s=i.pow(n,t);const o=(t+Se)/rr;return function(c,l){if(c.is0(l))return l;if(Ra(c,l)!==1)throw new Error("Cannot find square root");let u=e,d=c.mul(c.ONE,s),h=c.pow(l,t),p=c.pow(l,o);for(;!c.eql(h,c.ONE);){if(c.is0(h))return c.ZERO;let _=1,f=c.sqr(h);for(;!c.eql(f,c.ONE);)if(_++,f=c.sqr(f),_===u)throw new Error("Cannot find square root");const m=Se<<BigInt(u-_-1),y=c.pow(d,m);u=_,d=c.sqr(y),h=c.mul(h,d),p=c.mul(p,y)}return p}}function xy(r){return r%eu===Dy?nu:r%ru===tu?Vy:Sy(r)}const Cy=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function $y(r){const t={ORDER:"bigint",MASK:"bigint",BYTES:"number",BITS:"number"},e=Cy.reduce((n,i)=>(n[i]="function",n),t);return pi(r,e),r}function ky(r,t,e){if(e<je)throw new Error("invalid exponent, negatives unsupported");if(e===je)return r.ONE;if(e===Se)return t;let n=r.ONE,i=t;for(;e>je;)e&Se&&(n=r.mul(n,i)),i=r.sqr(i),e>>=Se;return n}function iu(r,t,e=!1){const n=new Array(t.length).fill(e?r.ZERO:void 0),i=t.reduce((o,c,l)=>r.is0(c)?o:(n[l]=o,r.mul(o,c)),r.ONE),s=r.inv(i);return t.reduceRight((o,c,l)=>r.is0(c)?o:(n[l]=r.mul(o,n[l]),r.mul(o,c)),s),n}function Ra(r,t){const e=(r.ORDER-Se)/rr,n=r.pow(t,e),i=r.eql(n,r.ONE),s=r.eql(n,r.ZERO),o=r.eql(n,r.neg(r.ONE));if(!i&&!s&&!o)throw new Error("invalid Legendre symbol result");return i?1:s?0:-1}function Ny(r,t){t!==void 0&&Lt(t);const e=t!==void 0?t:r.toString(2).length,n=Math.ceil(e/8);return{nBitLength:e,nByteLength:n}}function Sr(r,t,e=!1,n={}){if(r<=je)throw new Error("invalid field: expected ORDER > 0, got "+r);let i,s;if(typeof t=="object"&&t!=null){if(n.sqrt||e)throw new Error("cannot specify opts in two arguments");const d=t;d.BITS&&(i=d.BITS),d.sqrt&&(s=d.sqrt),typeof d.isLE=="boolean"&&(e=d.isLE)}else typeof t=="number"&&(i=t),n.sqrt&&(s=n.sqrt);const{nBitLength:o,nByteLength:c}=Ny(r,i);if(c>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let l;const u=Object.freeze({ORDER:r,isLE:e,BITS:o,BYTES:c,MASK:hi(o),ZERO:je,ONE:Se,create:d=>Xe(d,r),isValid:d=>{if(typeof d!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof d);return je<=d&&d<r},is0:d=>d===je,isValidNot0:d=>!u.is0(d)&&u.isValid(d),isOdd:d=>(d&Se)===Se,neg:d=>Xe(-d,r),eql:(d,h)=>d===h,sqr:d=>Xe(d*d,r),add:(d,h)=>Xe(d+h,r),sub:(d,h)=>Xe(d-h,r),mul:(d,h)=>Xe(d*h,r),pow:(d,h)=>ky(u,d,h),div:(d,h)=>Xe(d*Oa(h,r),r),sqrN:d=>d*d,addN:(d,h)=>d+h,subN:(d,h)=>d-h,mulN:(d,h)=>d*h,inv:d=>Oa(d,r),sqrt:s||(d=>(l||(l=xy(r)),l(u,d))),toBytes:d=>e?ho(d,c):uo(d,c),fromBytes:d=>{if(d.length!==c)throw new Error("Field.fromBytes: expected "+c+" bytes, got "+d.length);return e?Xn(d):di(d)},invertBatch:d=>iu(u,d),cmov:(d,h,p)=>p?h:d});return Object.freeze(u)}function su(r){if(typeof r!="bigint")throw new Error("field order must be bigint");const t=r.toString(2).length;return Math.ceil(t/8)}function ou(r){const t=su(r);return t+Math.ceil(t/2)}function Uy(r,t,e=!1){const n=r.length,i=su(t),s=ou(t);if(n<16||n<s||n>1024)throw new Error("expected "+s+"-1024 bytes of input, got "+n);const o=e?Xn(r):di(r),c=Xe(o,t-Se)+Se;return e?ho(c,i):uo(c,i)}const Ir=BigInt(0),nr=BigInt(1);function Jr(r,t){const e=t.negate();return r?e:t}function qy(r,t,e){const n=s=>s.pz,i=iu(r.Fp,e.map(n));return e.map((s,o)=>s.toAffine(i[o])).map(r.fromAffine)}function au(r,t){if(!Number.isSafeInteger(r)||r<=0||r>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+r)}function Vi(r,t){au(r,t);const e=Math.ceil(t/r)+1,n=2**(r-1),i=2**r,s=hi(r),o=BigInt(r);return{windows:e,windowSize:n,mask:s,maxNumber:i,shiftBy:o}}function La(r,t,e){const{windowSize:n,mask:i,maxNumber:s,shiftBy:o}=e;let c=Number(r&i),l=r>>o;c>n&&(c-=s,l+=nr);const u=t*n,d=u+Math.abs(c)-1,h=c===0,p=c<0,_=t%2!==0;return{nextN:l,offset:d,isZero:h,isNeg:p,isNegF:_,offsetF:u}}function My(r,t){if(!Array.isArray(r))throw new Error("array expected");r.forEach((e,n)=>{if(!(e instanceof t))throw new Error("invalid point at index "+n)})}function By(r,t){if(!Array.isArray(r))throw new Error("array of scalars expected");r.forEach((e,n)=>{if(!t.isValid(e))throw new Error("invalid scalar at index "+n)})}const Si=new WeakMap,cu=new WeakMap;function xi(r){return cu.get(r)||1}function Da(r){if(r!==Ir)throw new Error("invalid wNAF")}function jy(r,t){return{constTimeNegate:Jr,hasPrecomputes(e){return xi(e)!==1},unsafeLadder(e,n,i=r.ZERO){let s=e;for(;n>Ir;)n&nr&&(i=i.add(s)),s=s.double(),n>>=nr;return i},precomputeWindow(e,n){const{windows:i,windowSize:s}=Vi(n,t),o=[];let c=e,l=c;for(let u=0;u<i;u++){l=c,o.push(l);for(let d=1;d<s;d++)l=l.add(c),o.push(l);c=l.double()}return o},wNAF(e,n,i){let s=r.ZERO,o=r.BASE;const c=Vi(e,t);for(let l=0;l<c.windows;l++){const{nextN:u,offset:d,isZero:h,isNeg:p,isNegF:_,offsetF:f}=La(i,l,c);i=u,h?o=o.add(Jr(_,n[f])):s=s.add(Jr(p,n[d]))}return Da(i),{p:s,f:o}},wNAFUnsafe(e,n,i,s=r.ZERO){const o=Vi(e,t);for(let c=0;c<o.windows&&i!==Ir;c++){const{nextN:l,offset:u,isZero:d,isNeg:h}=La(i,c,o);if(i=l,!d){const p=n[u];s=s.add(h?p.negate():p)}}return Da(i),s},getPrecomputes(e,n,i){let s=Si.get(n);return s||(s=this.precomputeWindow(n,e),e!==1&&(typeof i=="function"&&(s=i(s)),Si.set(n,s))),s},wNAFCached(e,n,i){const s=xi(e);return this.wNAF(s,this.getPrecomputes(s,e,i),n)},wNAFCachedUnsafe(e,n,i,s){const o=xi(e);return o===1?this.unsafeLadder(e,n,s):this.wNAFUnsafe(o,this.getPrecomputes(o,e,i),n,s)},setWindowSize(e,n){au(n,t),cu.set(e,n),Si.delete(e)}}}function zy(r,t,e,n){let i=t,s=r.ZERO,o=r.ZERO;for(;e>Ir||n>Ir;)e&nr&&(s=s.add(i)),n&nr&&(o=o.add(i)),i=i.double(),e>>=nr,n>>=nr;return{p1:s,p2:o}}function Ky(r,t,e,n){My(e,r),By(n,t);const i=e.length,s=n.length;if(i!==s)throw new Error("arrays of points and scalars must have equal length");const o=r.ZERO,c=Ry(BigInt(i));let l=1;c>12?l=c-3:c>4?l=c-2:c>0&&(l=2);const u=hi(l),d=new Array(Number(u)+1).fill(o),h=Math.floor((t.BITS-1)/l)*l;let p=o;for(let _=h;_>=0;_-=l){d.fill(o);for(let m=0;m<s;m++){const y=n[m],b=Number(y>>BigInt(_)&u);d[b]=d[b].add(e[m])}let f=o;for(let m=d.length-1,y=o;m>0;m--)y=y.add(d[m]),f=f.add(y);if(p=p.add(f),_!==0)for(let m=0;m<l;m++)p=p.double()}return p}function Va(r,t){if(t){if(t.ORDER!==r)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return $y(t),t}else return Sr(r)}function Fy(r,t,e={}){if(!t||typeof t!="object")throw new Error(`expected valid ${r} CURVE object`);for(const o of["p","n","h"]){const c=t[o];if(!(typeof c=="bigint"&&c>Ir))throw new Error(`CURVE.${o} must be positive bigint`)}const n=Va(t.p,e.Fp),i=Va(t.n,e.Fn),s=["Gx","Gy","a","b"];for(const o of s)if(!n.isValid(t[o]))throw new Error(`CURVE.${o} must be valid field element of CURVE.Fp`);return{Fp:n,Fn:i}}BigInt(0),BigInt(1),BigInt(2),BigInt(8);const Nr=BigInt(0),mr=BigInt(1),On=BigInt(2);function Wy(r){return pi(r,{adjustScalarBytes:"function",powPminus2:"function"}),Object.freeze({...r})}function Hy(r){const t=Wy(r),{P:e,type:n,adjustScalarBytes:i,powPminus2:s,randomBytes:o}=t,c=n==="x25519";if(!c&&n!=="x448")throw new Error("invalid type");const l=o||Vr,u=c?255:448,d=c?32:56,h=BigInt(c?9:5),p=BigInt(c?121665:39081),_=c?On**BigInt(254):On**BigInt(447),f=c?BigInt(8)*On**BigInt(251)-mr:BigInt(4)*On**BigInt(445)-mr,m=_+f+mr,y=w=>Xe(w,e),b=O(h);function O(w){return ho(y(w),d)}function g(w){const v=Ue("u coordinate",w,d);return c&&(v[31]&=127),y(Xn(v))}function P(w){return Xn(i(Ue("scalar",w,d)))}function A(w,v){const I=L(g(v),P(w));if(I===Nr)throw new Error("invalid private or public key received");return O(I)}function E(w){return A(w,b)}function D(w,v,I){const T=y(w*(v-I));return v=y(v-T),I=y(I+T),{x_2:v,x_3:I}}function L(w,v){ps("u",w,Nr,e),ps("scalar",v,_,m);const I=v,T=w;let V=mr,R=Nr,S=w,$=mr,k=Nr;for(let C=BigInt(u-1);C>=Nr;C--){const N=I>>C&mr;k^=N,{x_2:V,x_3:S}=D(k,V,S),{x_2:R,x_3:$}=D(k,R,$),k=N;const j=V+R,z=y(j*j),K=V-R,F=y(K*K),W=z-F,H=S+$,ue=S-$,ce=y(ue*j),oe=y(H*K),Ge=ce+oe,gt=ce-oe;S=y(Ge*Ge),$=y(T*y(gt*gt)),V=y(z*F),R=y(W*(z+y(p*W)))}({x_2:V,x_3:S}=D(k,V,S)),{x_2:R,x_3:$}=D(k,R,$);const M=s(R);return y(V*M)}return{scalarMult:A,scalarMultBase:E,getSharedSecret:(w,v)=>A(w,v),getPublicKey:w=>E(w),utils:{randomPrivateKey:()=>l(d)},GuBytes:b.slice()}}BigInt(0);const Gy=BigInt(1),Sa=BigInt(2),Jy=BigInt(3),Zy=BigInt(5);BigInt(8);const lu={p:BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed"),n:BigInt("0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed"),a:BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec"),d:BigInt("0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3"),Gx:BigInt("0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a"),Gy:BigInt("0x6666666666666666666666666666666666666666666666666666666666666658")};function Yy(r){const t=BigInt(10),e=BigInt(20),n=BigInt(40),i=BigInt(80),s=lu.p,o=r*r%s*r%s,c=st(o,Sa,s)*o%s,l=st(c,Gy,s)*r%s,u=st(l,Zy,s)*l%s,d=st(u,t,s)*u%s,h=st(d,e,s)*d%s,p=st(h,n,s)*h%s,_=st(p,i,s)*p%s,f=st(_,i,s)*p%s,m=st(f,t,s)*u%s;return{pow_p_5_8:st(m,Sa,s)*r%s,b2:o}}function Qy(r){return r[0]&=248,r[31]&=127,r[31]|=64,r}const _s=(()=>{const r=lu.p;return Hy({P:r,type:"x25519",powPminus2:t=>{const{pow_p_5_8:e,b2:n}=Yy(t);return Xe(st(e,Jy,r)*n,r)},adjustScalarBytes:Qy})})();function xa(r){r.lowS!==void 0&&Qn("lowS",r.lowS),r.prehash!==void 0&&Qn("prehash",r.prehash)}class Xy extends Error{constructor(t=""){super(t)}}const Tt={Err:Xy,_tlv:{encode:(r,t)=>{const{Err:e}=Tt;if(r<0||r>256)throw new e("tlv.encode: wrong tag");if(t.length&1)throw new e("tlv.encode: unpadded data");const n=t.length/2,i=Pn(n);if(i.length/2&128)throw new e("tlv.encode: long form length too big");const s=n>127?Pn(i.length/2|128):"";return Pn(r)+s+i+t},decode(r,t){const{Err:e}=Tt;let n=0;if(r<0||r>256)throw new e("tlv.encode: wrong tag");if(t.length<2||t[n++]!==r)throw new e("tlv.decode: wrong tlv");const i=t[n++],s=!!(i&128);let o=0;if(!s)o=i;else{const l=i&127;if(!l)throw new e("tlv.decode(long): indefinite length not supported");if(l>4)throw new e("tlv.decode(long): byte length is too big");const u=t.subarray(n,n+l);if(u.length!==l)throw new e("tlv.decode: length bytes not complete");if(u[0]===0)throw new e("tlv.decode(long): zero leftmost byte");for(const d of u)o=o<<8|d;if(n+=l,o<128)throw new e("tlv.decode(long): not minimal encoding")}const c=t.subarray(n,n+o);if(c.length!==o)throw new e("tlv.decode: wrong value length");return{v:c,l:t.subarray(n+o)}}},_int:{encode(r){const{Err:t}=Tt;if(r<Zr)throw new t("integer: negative integers are not allowed");let e=Pn(r);if(Number.parseInt(e[0],16)&8&&(e="00"+e),e.length&1)throw new t("unexpected DER parsing assertion: unpadded hex");return e},decode(r){const{Err:t}=Tt;if(r[0]&128)throw new t("invalid signature integer: negative");if(r[0]===0&&!(r[1]&128))throw new t("invalid signature integer: unnecessary leading zero");return di(r)}},toSig(r){const{Err:t,_int:e,_tlv:n}=Tt,i=Ue("signature",r),{v:s,l:o}=n.decode(48,i);if(o.length)throw new t("invalid signature: left bytes after parsing");const{v:c,l}=n.decode(2,s),{v:u,l:d}=n.decode(2,l);if(d.length)throw new t("invalid signature: left bytes after parsing");return{r:e.decode(c),s:e.decode(u)}},hexFromSig(r){const{_tlv:t,_int:e}=Tt,n=t.encode(2,e.encode(r.r)),i=t.encode(2,e.encode(r.s)),s=n+i;return t.encode(48,s)}},Zr=BigInt(0),Yr=BigInt(1),ew=BigInt(2),Rn=BigInt(3),tw=BigInt(4);function rw(r,t,e){function n(i){const s=r.sqr(i),o=r.mul(s,i);return r.add(r.add(o,r.mul(i,t)),e)}return n}function uu(r,t,e){const{BYTES:n}=r;function i(s){let o;if(typeof s=="bigint")o=s;else{let c=Ue("private key",s);if(t){if(!t.includes(c.length*2))throw new Error("invalid private key");const l=new Uint8Array(n);l.set(c,l.length-c.length),c=l}try{o=r.fromBytes(c)}catch{throw new Error(`invalid private key: expected ui8a of size ${n}, got ${typeof s}`)}}if(e&&(o=r.create(o)),!r.isValidNot0(o))throw new Error("invalid private key: out of range [1..N-1]");return o}return i}function nw(r,t={}){const{Fp:e,Fn:n}=Fy("weierstrass",r,t),{h:i,n:s}=r;pi(t,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object",wrapPrivateKey:"boolean"});const{endo:o}=t;if(o&&(!e.is0(r.a)||typeof o.beta!="bigint"||typeof o.splitScalar!="function"))throw new Error('invalid endo: expected "beta": bigint and "splitScalar": function');function c(){if(!e.isOdd)throw new Error("compression is not supported: Field does not have .isOdd()")}function l(L,w,v){const{x:I,y:T}=w.toAffine(),V=e.toBytes(I);if(Qn("isCompressed",v),v){c();const R=!e.isOdd(T);return tr(du(R),V)}else return tr(Uint8Array.of(4),V,e.toBytes(T))}function u(L){tt(L);const w=e.BYTES,v=w+1,I=2*w+1,T=L.length,V=L[0],R=L.subarray(1);if(T===v&&(V===2||V===3)){const S=e.fromBytes(R);if(!e.isValid(S))throw new Error("bad point: is not on curve, wrong x");const $=p(S);let k;try{k=e.sqrt($)}catch(C){const N=C instanceof Error?": "+C.message:"";throw new Error("bad point: is not on curve, sqrt error"+N)}c();const M=e.isOdd(k);return(V&1)===1!==M&&(k=e.neg(k)),{x:S,y:k}}else if(T===I&&V===4){const S=e.fromBytes(R.subarray(w*0,w*1)),$=e.fromBytes(R.subarray(w*1,w*2));if(!_(S,$))throw new Error("bad point: is not on curve");return{x:S,y:$}}else throw new Error(`bad point: got length ${T}, expected compressed=${v} or uncompressed=${I}`)}const d=t.toBytes||l,h=t.fromBytes||u,p=rw(e,r.a,r.b);function _(L,w){const v=e.sqr(w),I=p(L);return e.eql(v,I)}if(!_(r.Gx,r.Gy))throw new Error("bad curve params: generator point");const f=e.mul(e.pow(r.a,Rn),tw),m=e.mul(e.sqr(r.b),BigInt(27));if(e.is0(e.add(f,m)))throw new Error("bad curve params: a or b");function y(L,w,v=!1){if(!e.isValid(w)||v&&e.is0(w))throw new Error(`bad point coordinate ${L}`);return w}function b(L){if(!(L instanceof A))throw new Error("ProjectivePoint expected")}const O=Pa((L,w)=>{const{px:v,py:I,pz:T}=L;if(e.eql(T,e.ONE))return{x:v,y:I};const V=L.is0();w==null&&(w=V?e.ONE:e.inv(T));const R=e.mul(v,w),S=e.mul(I,w),$=e.mul(T,w);if(V)return{x:e.ZERO,y:e.ZERO};if(!e.eql($,e.ONE))throw new Error("invZ was invalid");return{x:R,y:S}}),g=Pa(L=>{if(L.is0()){if(t.allowInfinityPoint&&!e.is0(L.py))return;throw new Error("bad point: ZERO")}const{x:w,y:v}=L.toAffine();if(!e.isValid(w)||!e.isValid(v))throw new Error("bad point: x or y not field elements");if(!_(w,v))throw new Error("bad point: equation left != right");if(!L.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});function P(L,w,v,I,T){return v=new A(e.mul(v.px,L),v.py,v.pz),w=Jr(I,w),v=Jr(T,v),w.add(v)}class A{constructor(w,v,I){this.px=y("x",w),this.py=y("y",v,!0),this.pz=y("z",I),Object.freeze(this)}static fromAffine(w){const{x:v,y:I}=w||{};if(!w||!e.isValid(v)||!e.isValid(I))throw new Error("invalid affine point");if(w instanceof A)throw new Error("projective point not allowed");return e.is0(v)&&e.is0(I)?A.ZERO:new A(v,I,e.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(w){return qy(A,"pz",w)}static fromBytes(w){return tt(w),A.fromHex(w)}static fromHex(w){const v=A.fromAffine(h(Ue("pointHex",w)));return v.assertValidity(),v}static fromPrivateKey(w){const v=uu(n,t.allowedPrivateKeyLengths,t.wrapPrivateKey);return A.BASE.multiply(v(w))}static msm(w,v){return Ky(A,n,w,v)}precompute(w=8,v=!0){return D.setWindowSize(this,w),v||this.multiply(Rn),this}_setWindowSize(w){this.precompute(w)}assertValidity(){g(this)}hasEvenY(){const{y:w}=this.toAffine();if(!e.isOdd)throw new Error("Field doesn't support isOdd");return!e.isOdd(w)}equals(w){b(w);const{px:v,py:I,pz:T}=this,{px:V,py:R,pz:S}=w,$=e.eql(e.mul(v,S),e.mul(V,T)),k=e.eql(e.mul(I,S),e.mul(R,T));return $&&k}negate(){return new A(this.px,e.neg(this.py),this.pz)}double(){const{a:w,b:v}=r,I=e.mul(v,Rn),{px:T,py:V,pz:R}=this;let S=e.ZERO,$=e.ZERO,k=e.ZERO,M=e.mul(T,T),C=e.mul(V,V),N=e.mul(R,R),j=e.mul(T,V);return j=e.add(j,j),k=e.mul(T,R),k=e.add(k,k),S=e.mul(w,k),$=e.mul(I,N),$=e.add(S,$),S=e.sub(C,$),$=e.add(C,$),$=e.mul(S,$),S=e.mul(j,S),k=e.mul(I,k),N=e.mul(w,N),j=e.sub(M,N),j=e.mul(w,j),j=e.add(j,k),k=e.add(M,M),M=e.add(k,M),M=e.add(M,N),M=e.mul(M,j),$=e.add($,M),N=e.mul(V,R),N=e.add(N,N),M=e.mul(N,j),S=e.sub(S,M),k=e.mul(N,C),k=e.add(k,k),k=e.add(k,k),new A(S,$,k)}add(w){b(w);const{px:v,py:I,pz:T}=this,{px:V,py:R,pz:S}=w;let $=e.ZERO,k=e.ZERO,M=e.ZERO;const C=r.a,N=e.mul(r.b,Rn);let j=e.mul(v,V),z=e.mul(I,R),K=e.mul(T,S),F=e.add(v,I),W=e.add(V,R);F=e.mul(F,W),W=e.add(j,z),F=e.sub(F,W),W=e.add(v,T);let H=e.add(V,S);return W=e.mul(W,H),H=e.add(j,K),W=e.sub(W,H),H=e.add(I,T),$=e.add(R,S),H=e.mul(H,$),$=e.add(z,K),H=e.sub(H,$),M=e.mul(C,W),$=e.mul(N,K),M=e.add($,M),$=e.sub(z,M),M=e.add(z,M),k=e.mul($,M),z=e.add(j,j),z=e.add(z,j),K=e.mul(C,K),W=e.mul(N,W),z=e.add(z,K),K=e.sub(j,K),K=e.mul(C,K),W=e.add(W,K),j=e.mul(z,W),k=e.add(k,j),j=e.mul(H,W),$=e.mul(F,$),$=e.sub($,j),j=e.mul(F,z),M=e.mul(H,M),M=e.add(M,j),new A($,k,M)}subtract(w){return this.add(w.negate())}is0(){return this.equals(A.ZERO)}multiply(w){const{endo:v}=t;if(!n.isValidNot0(w))throw new Error("invalid scalar: out of range");let I,T;const V=R=>D.wNAFCached(this,R,A.normalizeZ);if(v){const{k1neg:R,k1:S,k2neg:$,k2:k}=v.splitScalar(w),{p:M,f:C}=V(S),{p:N,f:j}=V(k);T=C.add(j),I=P(v.beta,M,N,R,$)}else{const{p:R,f:S}=V(w);I=R,T=S}return A.normalizeZ([I,T])[0]}multiplyUnsafe(w){const{endo:v}=t,I=this;if(!n.isValid(w))throw new Error("invalid scalar: out of range");if(w===Zr||I.is0())return A.ZERO;if(w===Yr)return I;if(D.hasPrecomputes(this))return this.multiply(w);if(v){const{k1neg:T,k1:V,k2neg:R,k2:S}=v.splitScalar(w),{p1:$,p2:k}=zy(A,I,V,S);return P(v.beta,$,k,T,R)}else return D.wNAFCachedUnsafe(I,w)}multiplyAndAddUnsafe(w,v,I){const T=this.multiplyUnsafe(v).add(w.multiplyUnsafe(I));return T.is0()?void 0:T}toAffine(w){return O(this,w)}isTorsionFree(){const{isTorsionFree:w}=t;return i===Yr?!0:w?w(A,this):D.wNAFCachedUnsafe(this,s).is0()}clearCofactor(){const{clearCofactor:w}=t;return i===Yr?this:w?w(A,this):this.multiplyUnsafe(i)}toBytes(w=!0){return Qn("isCompressed",w),this.assertValidity(),d(A,this,w)}toRawBytes(w=!0){return this.toBytes(w)}toHex(w=!0){return an(this.toBytes(w))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}}A.BASE=new A(r.Gx,r.Gy,e.ONE),A.ZERO=new A(e.ZERO,e.ONE,e.ZERO),A.Fp=e,A.Fn=n;const E=n.BITS,D=jy(A,t.endo?Math.ceil(E/2):E);return A}function du(r){return Uint8Array.of(r?2:3)}function iw(r,t,e={}){pi(t,{hash:"function"},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"});const n=t.randomBytes||Vr,i=t.hmac||((I,...T)=>li(t.hash,I,tr(...T))),{Fp:s,Fn:o}=r,{ORDER:c,BITS:l}=o;function u(I){const T=c>>Yr;return I>T}function d(I){return u(I)?o.neg(I):I}function h(I,T){if(!o.isValidNot0(T))throw new Error(`invalid signature ${I}: out of range 1..CURVE.n`)}class p{constructor(T,V,R){h("r",T),h("s",V),this.r=T,this.s=V,R!=null&&(this.recovery=R),Object.freeze(this)}static fromCompact(T){const V=o.BYTES,R=Ue("compactSignature",T,V*2);return new p(o.fromBytes(R.subarray(0,V)),o.fromBytes(R.subarray(V,V*2)))}static fromDER(T){const{r:V,s:R}=Tt.toSig(Ue("DER",T));return new p(V,R)}assertValidity(){}addRecoveryBit(T){return new p(this.r,this.s,T)}recoverPublicKey(T){const V=s.ORDER,{r:R,s:S,recovery:$}=this;if($==null||![0,1,2,3].includes($))throw new Error("recovery id invalid");if(c*ew<V&&$>1)throw new Error("recovery id is ambiguous for h>1 curve");const k=$===2||$===3?R+c:R;if(!s.isValid(k))throw new Error("recovery id 2 or 3 invalid");const M=s.toBytes(k),C=r.fromHex(tr(du(($&1)===0),M)),N=o.inv(k),j=g(Ue("msgHash",T)),z=o.create(-j*N),K=o.create(S*N),F=r.BASE.multiplyUnsafe(z).add(C.multiplyUnsafe(K));if(F.is0())throw new Error("point at infinify");return F.assertValidity(),F}hasHighS(){return u(this.s)}normalizeS(){return this.hasHighS()?new p(this.r,o.neg(this.s),this.recovery):this}toBytes(T){if(T==="compact")return tr(o.toBytes(this.r),o.toBytes(this.s));if(T==="der")return oo(Tt.hexFromSig(this));throw new Error("invalid format")}toDERRawBytes(){return this.toBytes("der")}toDERHex(){return an(this.toBytes("der"))}toCompactRawBytes(){return this.toBytes("compact")}toCompactHex(){return an(this.toBytes("compact"))}}const _=uu(o,e.allowedPrivateKeyLengths,e.wrapPrivateKey),f={isValidPrivateKey(I){try{return _(I),!0}catch{return!1}},normPrivateKeyToScalar:_,randomPrivateKey:()=>{const I=c;return Uy(n(ou(I)),I)},precompute(I=8,T=r.BASE){return T.precompute(I,!1)}};function m(I,T=!0){return r.fromPrivateKey(I).toBytes(T)}function y(I){if(typeof I=="bigint")return!1;if(I instanceof r)return!0;const T=Ue("key",I).length,V=s.BYTES,R=V+1,S=2*V+1;if(!(e.allowedPrivateKeyLengths||o.BYTES===R))return T===R||T===S}function b(I,T,V=!0){if(y(I)===!0)throw new Error("first arg must be private key");if(y(T)===!1)throw new Error("second arg must be public key");return r.fromHex(T).multiply(_(I)).toBytes(V)}const O=t.bits2int||function(I){if(I.length>8192)throw new Error("input is too large");const T=di(I),V=I.length*8-l;return V>0?T>>BigInt(V):T},g=t.bits2int_modN||function(I){return o.create(O(I))},P=hi(l);function A(I){return ps("num < 2^"+l,I,Zr,P),o.toBytes(I)}function E(I,T,V=D){if(["recovered","canonical"].some(F=>F in V))throw new Error("sign() legacy options not supported");const{hash:R}=t;let{lowS:S,prehash:$,extraEntropy:k}=V;S==null&&(S=!0),I=Ue("msgHash",I),xa(V),$&&(I=Ue("prehashed msgHash",R(I)));const M=g(I),C=_(T),N=[A(C),A(M)];if(k!=null&&k!==!1){const F=k===!0?n(s.BYTES):k;N.push(Ue("extraEntropy",F))}const j=tr(...N),z=M;function K(F){const W=O(F);if(!o.isValidNot0(W))return;const H=o.inv(W),ue=r.BASE.multiply(W).toAffine(),ce=o.create(ue.x);if(ce===Zr)return;const oe=o.create(H*o.create(z+ce*C));if(oe===Zr)return;let Ge=(ue.x===ce?0:2)|Number(ue.y&Yr),gt=oe;return S&&u(oe)&&(gt=d(oe),Ge^=1),new p(ce,gt,Ge)}return{seed:j,k2sig:K}}const D={lowS:t.lowS,prehash:!1},L={lowS:t.lowS,prehash:!1};function w(I,T,V=D){const{seed:R,k2sig:S}=E(I,T,V);return Ly(t.hash.outputLen,o.BYTES,i)(R,S)}r.BASE.precompute(8);function v(I,T,V,R=L){const S=I;T=Ue("msgHash",T),V=Ue("publicKey",V),xa(R);const{lowS:$,prehash:k,format:M}=R;if("strict"in R)throw new Error("options.strict was renamed to lowS");if(M!==void 0&&!["compact","der","js"].includes(M))throw new Error('format must be "compact", "der" or "js"');const C=typeof S=="string"||no(S),N=!C&&!M&&typeof S=="object"&&S!==null&&typeof S.r=="bigint"&&typeof S.s=="bigint";if(!C&&!N)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");let j,z;try{if(N)if(M===void 0||M==="js")j=new p(S.r,S.s);else throw new Error("invalid format");if(C){try{M!=="compact"&&(j=p.fromDER(S))}catch(Ge){if(!(Ge instanceof Tt.Err))throw Ge}!j&&M!=="der"&&(j=p.fromCompact(S))}z=r.fromHex(V)}catch{return!1}if(!j||$&&j.hasHighS())return!1;k&&(T=t.hash(T));const{r:K,s:F}=j,W=g(T),H=o.inv(F),ue=o.create(W*H),ce=o.create(K*H),oe=r.BASE.multiplyUnsafe(ue).add(z.multiplyUnsafe(ce));return oe.is0()?!1:o.create(oe.x)===K}return Object.freeze({getPublicKey:m,getSharedSecret:b,sign:w,verify:v,utils:f,Point:r,Signature:p})}function sw(r){const t={a:r.a,b:r.b,p:r.Fp.ORDER,n:r.n,h:r.h,Gx:r.Gx,Gy:r.Gy},e=r.Fp,n=Sr(t.n,r.nBitLength),i={Fp:e,Fn:n,allowedPrivateKeyLengths:r.allowedPrivateKeyLengths,allowInfinityPoint:r.allowInfinityPoint,endo:r.endo,wrapPrivateKey:r.wrapPrivateKey,isTorsionFree:r.isTorsionFree,clearCofactor:r.clearCofactor,fromBytes:r.fromBytes,toBytes:r.toBytes};return{CURVE:t,curveOpts:i}}function ow(r){const{CURVE:t,curveOpts:e}=sw(r),n={hash:r.hash,hmac:r.hmac,randomBytes:r.randomBytes,lowS:r.lowS,bits2int:r.bits2int,bits2int_modN:r.bits2int_modN};return{CURVE:t,curveOpts:e,ecdsaOpts:n}}function aw(r,t){return Object.assign({},t,{ProjectivePoint:t.Point,CURVE:r})}function cw(r){const{CURVE:t,curveOpts:e,ecdsaOpts:n}=ow(r),i=nw(t,e),s=iw(i,n,e);return aw(r,s)}function fs(r,t){const e=n=>cw({...r,hash:n});return{...e(t),create:e}}const hu={p:BigInt("0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff"),n:BigInt("0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551"),h:BigInt(1),a:BigInt("0xffffffff00000001000000000000000000000000fffffffffffffffffffffffc"),b:BigInt("0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b"),Gx:BigInt("0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296"),Gy:BigInt("0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5")},pu={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffff0000000000000000ffffffff"),n:BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffc7634d81f4372ddf581a0db248b0a77aecec196accc52973"),h:BigInt(1),a:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffff0000000000000000fffffffc"),b:BigInt("0xb3312fa7e23ee7e4988e056be3f82d19181d9c6efe8141120314088f5013875ac656398d8a2ed19d2a85c8edd3ec2aef"),Gx:BigInt("0xaa87ca22be8b05378eb1c71ef320ad746e1d3b628ba79b9859f741e082542a385502f25dbf55296c3a545e3872760ab7"),Gy:BigInt("0x3617de4a96262c6f5d9e98bf9292dc29f8f41dbd289a147ce9da3113b5f0b8c00a60b1ce1d7e819d7a431d7c90ea0e5f")},_u={p:BigInt("0x1ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),n:BigInt("0x01fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa51868783bf2f966b7fcc0148f709a5d03bb5c9b8899c47aebb6fb71e91386409"),h:BigInt(1),a:BigInt("0x1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc"),b:BigInt("0x0051953eb9618e1c9a1f929a21a0b68540eea2da725b99b315f3b8b489918ef109e156193951ec7e937b1652c0bd3bb1bf073573df883d2c34f1ef451fd46b503f00"),Gx:BigInt("0x00c6858e06b70404e9cd9e3ecb662395b4429c648139053fb521f828af606b4d3dbaa14b5e77efe75928fe1dc127a2ffa8de3348b3c1856a429bf97e7e31c2e5bd66"),Gy:BigInt("0x011839296a789a3bc0045c8a5fb42c7d1bd998f54449579b446817afbd17273e662c97ee72995ef42640c550b9013fad0761353c7086a272c24088be94769fd16650")},lw=Sr(hu.p),uw=Sr(pu.p),dw=Sr(_u.p),hw=fs({...hu,Fp:lw,lowS:!1},ci);fs({...pu,Fp:uw,lowS:!1},Em),fs({..._u,Fp:dw,lowS:!1,allowedPrivateKeyLengths:[130,131,132]},gm);const pw=hw,fu="base10",xe="base16",Me="base64pad",zt="base64url",yn="utf8",mu=0,Ot=1,wn=2,_w=0,Ca=1,Qr=12,po=32;function fw(){const r=_s.utils.randomPrivateKey(),t=_s.getPublicKey(r);return{privateKey:ze(r,xe),publicKey:ze(t,xe)}}function ms(){const r=Vr(po);return ze(r,xe)}function mw(r,t){const e=_s.getSharedSecret(et(r,xe),et(t,xe)),n=Py(ui,e,void 0,void 0,po);return ze(n,xe)}function $n(r){const t=ui(et(r,xe));return ze(t,xe)}function Qe(r){const t=ui(et(r,yn));return ze(t,xe)}function yu(r){return et(`${r}`,fu)}function cr(r){return Number(ze(r,fu))}function wu(r){return r.replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function gu(r){const t=r.replace(/-/g,"+").replace(/_/g,"/"),e=(4-t.length%4)%4;return t+"=".repeat(e)}function yw(r){const t=yu(typeof r.type<"u"?r.type:mu);if(cr(t)===Ot&&typeof r.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");const e=typeof r.senderPublicKey<"u"?et(r.senderPublicKey,xe):void 0,n=typeof r.iv<"u"?et(r.iv,xe):Vr(Qr),i=et(r.symKey,xe),s=Yl(i,n).encrypt(et(r.message,yn)),o=Eu({type:t,sealed:s,iv:n,senderPublicKey:e});return r.encoding===zt?wu(o):o}function ww(r){const t=et(r.symKey,xe),{sealed:e,iv:n}=ln({encoded:r.encoded,encoding:r.encoding}),i=Yl(t,n).decrypt(e);if(i===null)throw new Error("Failed to decrypt");return ze(i,yn)}function gw(r,t){const e=yu(wn),n=Vr(Qr),i=et(r,yn),s=Eu({type:e,sealed:i,iv:n});return t===zt?wu(s):s}function Ew(r,t){const{sealed:e}=ln({encoded:r,encoding:t});return ze(e,yn)}function Eu(r){if(cr(r.type)===wn)return ze(Gr([r.type,r.sealed]),Me);if(cr(r.type)===Ot){if(typeof r.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return ze(Gr([r.type,r.senderPublicKey,r.iv,r.sealed]),Me)}return ze(Gr([r.type,r.iv,r.sealed]),Me)}function ln(r){const t=(r.encoding||Me)===zt?gu(r.encoded):r.encoded,e=et(t,Me),n=e.slice(_w,Ca),i=Ca;if(cr(n)===Ot){const l=i+po,u=l+Qr,d=e.slice(i,l),h=e.slice(l,u),p=e.slice(u);return{type:n,sealed:p,iv:h,senderPublicKey:d}}if(cr(n)===wn){const l=e.slice(i),u=Vr(Qr);return{type:n,sealed:l,iv:u}}const s=i+Qr,o=e.slice(i,s),c=e.slice(s);return{type:n,sealed:c,iv:o}}function vw(r,t){const e=ln({encoded:r,encoding:t==null?void 0:t.encoding});return vu({type:cr(e.type),senderPublicKey:typeof e.senderPublicKey<"u"?ze(e.senderPublicKey,xe):void 0,receiverPublicKey:t==null?void 0:t.receiverPublicKey})}function vu(r){const t=(r==null?void 0:r.type)||mu;if(t===Ot){if(typeof(r==null?void 0:r.senderPublicKey)>"u")throw new Error("missing sender public key");if(typeof(r==null?void 0:r.receiverPublicKey)>"u")throw new Error("missing receiver public key")}return{type:t,senderPublicKey:r==null?void 0:r.senderPublicKey,receiverPublicKey:r==null?void 0:r.receiverPublicKey}}function $a(r){return r.type===Ot&&typeof r.senderPublicKey=="string"&&typeof r.receiverPublicKey=="string"}function ka(r){return r.type===wn}function bw(r){const t=re.from(r.x,"base64"),e=re.from(r.y,"base64");return Gr([new Uint8Array([4]),t,e])}function Iw(r,t){const[e,n,i]=r.split("."),s=re.from(gu(i),"base64");if(s.length!==64)throw new Error("Invalid signature length");const o=s.slice(0,32),c=s.slice(32,64),l=`${e}.${n}`,u=ui(l),d=bw(t);if(!pw.verify(Gr([o,c]),u,d))throw new Error("Invalid signature");return Ji(r).payload}const Aw="irn";function ei(r){return(r==null?void 0:r.relay)||{protocol:Aw}}function vr(r){const t=Zd[r];if(typeof t>"u")throw new Error(`Relay Protocol not supported: ${r}`);return t}function Tw(r,t="-"){const e={},n="relay"+t;return Object.keys(r).forEach(i=>{if(i.startsWith(n)){const s=i.replace(n,""),o=r[i];e[s]=o}}),e}function Na(r){if(!r.includes("wc:")){const u=Sl(r);u!=null&&u.includes("wc:")&&(r=u)}r=r.includes("wc://")?r.replace("wc://",""):r,r=r.includes("wc:")?r.replace("wc:",""):r;const t=r.indexOf(":"),e=r.indexOf("?")!==-1?r.indexOf("?"):void 0,n=r.substring(0,t),i=r.substring(t+1,e).split("@"),s=typeof e<"u"?r.substring(e):"",o=new URLSearchParams(s),c={};o.forEach((u,d)=>{c[d]=u});const l=typeof c.methods=="string"?c.methods.split(","):void 0;return{protocol:n,topic:Pw(i[0]),version:parseInt(i[1],10),symKey:c.symKey,relay:Tw(c),methods:l,expiryTimestamp:c.expiryTimestamp?parseInt(c.expiryTimestamp,10):void 0}}function Pw(r){return r.startsWith("//")?r.substring(2):r}function Ow(r,t="-"){const e="relay",n={};return Object.keys(r).forEach(i=>{const s=i,o=e+t+s;r[s]&&(n[o]=r[s])}),n}function Ua(r){const t=new URLSearchParams,e=Ow(r.relay);Object.keys(e).sort().forEach(i=>{t.set(i,e[i])}),t.set("symKey",r.symKey),r.expiryTimestamp&&t.set("expiryTimestamp",r.expiryTimestamp.toString()),r.methods&&t.set("methods",r.methods.join(","));const n=t.toString();return`${r.protocol}:${r.topic}@${r.version}?${n}`}function Ln(r,t,e){return`${r}?wc_ev=${e}&topic=${t}`}var Rw=Object.defineProperty,Lw=Object.defineProperties,Dw=Object.getOwnPropertyDescriptors,qa=Object.getOwnPropertySymbols,Vw=Object.prototype.hasOwnProperty,Sw=Object.prototype.propertyIsEnumerable,Ma=(r,t,e)=>t in r?Rw(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,xw=(r,t)=>{for(var e in t||(t={}))Vw.call(t,e)&&Ma(r,e,t[e]);if(qa)for(var e of qa(t))Sw.call(t,e)&&Ma(r,e,t[e]);return r},Cw=(r,t)=>Lw(r,Dw(t));function xr(r){const t=[];return r.forEach(e=>{const[n,i]=e.split(":");t.push(`${n}:${i}`)}),t}function $w(r){const t=[];return Object.values(r).forEach(e=>{t.push(...xr(e.accounts))}),t}function kw(r,t){const e=[];return Object.values(r).forEach(n=>{xr(n.accounts).includes(t)&&e.push(...n.methods)}),e}function Nw(r,t){const e=[];return Object.values(r).forEach(n=>{xr(n.accounts).includes(t)&&e.push(...n.events)}),e}function bu(r){return r.includes(":")}function Uw(r){return bu(r)?r.split(":")[0]:r}function Ba(r){var t,e,n;const i={};if(!un(r))return i;for(const[s,o]of Object.entries(r)){const c=bu(s)?[s]:o.chains,l=o.methods||[],u=o.events||[],d=Uw(s);i[d]=Cw(xw({},i[d]),{chains:ir(c,(t=i[d])==null?void 0:t.chains),methods:ir(l,(e=i[d])==null?void 0:e.methods),events:ir(u,(n=i[d])==null?void 0:n.events)})}return i}function qw(r){const t={};return r==null||r.forEach(e=>{var n;const[i,s]=e.split(":");t[i]||(t[i]={accounts:[],chains:[],events:[],methods:[]}),t[i].accounts.push(e),(n=t[i].chains)==null||n.push(`${i}:${s}`)}),t}function ja(r,t){t=t.map(n=>n.replace("did:pkh:",""));const e=qw(t);for(const[n,i]of Object.entries(e))i.methods?i.methods=ir(i.methods,r):i.methods=r,i.events=["chainChanged","accountsChanged"];return e}function Mw(r,t){var e,n,i,s,o,c;const l=Ba(r),u=Ba(t),d={},h=Object.keys(l).concat(Object.keys(u));for(const p of h)d[p]={chains:ir((e=l[p])==null?void 0:e.chains,(n=u[p])==null?void 0:n.chains),methods:ir((i=l[p])==null?void 0:i.methods,(s=u[p])==null?void 0:s.methods),events:ir((o=l[p])==null?void 0:o.events,(c=u[p])==null?void 0:c.events)};return d}const Bw={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}},jw={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 U(r,t){const{message:e,code:n}=jw[r];return{message:t?`${e} ${t}`:e,code:n}}function ae(r,t){const{message:e,code:n}=Bw[r];return{message:t?`${e} ${t}`:e,code:n}}function Ar(r,t){return!!Array.isArray(r)}function un(r){return Object.getPrototypeOf(r)===Object.prototype&&Object.keys(r).length}function fe(r){return typeof r>"u"}function he(r,t){return t&&fe(r)?!0:typeof r=="string"&&!!r.trim().length}function _o(r,t){return t&&fe(r)?!0:typeof r=="number"&&!isNaN(r)}function zw(r,t){const{requiredNamespaces:e}=t,n=Object.keys(r.namespaces),i=Object.keys(e);let s=!0;return er(i,n)?(n.forEach(o=>{const{accounts:c,methods:l,events:u}=r.namespaces[o],d=xr(c),h=e[o];(!er(Ol(o,h),d)||!er(h.methods,l)||!er(h.events,u))&&(s=!1)}),s):!1}function ti(r){return he(r,!1)&&r.includes(":")?r.split(":").length===2:!1}function Kw(r){if(he(r,!1)&&r.includes(":")){const t=r.split(":");if(t.length===3){const e=t[0]+":"+t[1];return!!t[2]&&ti(e)}}return!1}function Fw(r){function t(e){try{return typeof new URL(e)<"u"}catch{return!1}}try{if(he(r,!1)){if(t(r))return!0;const e=Sl(r);return t(e)}}catch{}return!1}function Ww(r){var t;return(t=r==null?void 0:r.proposer)==null?void 0:t.publicKey}function Hw(r){return r==null?void 0:r.topic}function Gw(r,t){let e=null;return he(r==null?void 0:r.publicKey,!1)||(e=U("MISSING_OR_INVALID",`${t} controller public key should be a string`)),e}function za(r){let t=!0;return Ar(r)?r.length&&(t=r.every(e=>he(e,!1))):t=!1,t}function Jw(r,t,e){let n=null;return Ar(t)&&t.length?t.forEach(i=>{n||ti(i)||(n=ae("UNSUPPORTED_CHAINS",`${e}, chain ${i} should be a string and conform to "namespace:chainId" format`))}):ti(r)||(n=ae("UNSUPPORTED_CHAINS",`${e}, 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 Zw(r,t,e){let n=null;return Object.entries(r).forEach(([i,s])=>{if(n)return;const o=Jw(i,Ol(i,s),`${t} ${e}`);o&&(n=o)}),n}function Yw(r,t){let e=null;return Ar(r)?r.forEach(n=>{e||Kw(n)||(e=ae("UNSUPPORTED_ACCOUNTS",`${t}, account ${n} should be a string and conform to "namespace:chainId:address" format`))}):e=ae("UNSUPPORTED_ACCOUNTS",`${t}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),e}function Qw(r,t){let e=null;return Object.values(r).forEach(n=>{if(e)return;const i=Yw(n==null?void 0:n.accounts,`${t} namespace`);i&&(e=i)}),e}function Xw(r,t){let e=null;return za(r==null?void 0:r.methods)?za(r==null?void 0:r.events)||(e=ae("UNSUPPORTED_EVENTS",`${t}, events should be an array of strings or empty array for no events`)):e=ae("UNSUPPORTED_METHODS",`${t}, methods should be an array of strings or empty array for no methods`),e}function Iu(r,t){let e=null;return Object.values(r).forEach(n=>{if(e)return;const i=Xw(n,`${t}, namespace`);i&&(e=i)}),e}function eg(r,t,e){let n=null;if(r&&un(r)){const i=Iu(r,t);i&&(n=i);const s=Zw(r,t,e);s&&(n=s)}else n=U("MISSING_OR_INVALID",`${t}, ${e} should be an object with data`);return n}function Ci(r,t){let e=null;if(r&&un(r)){const n=Iu(r,t);n&&(e=n);const i=Qw(r,t);i&&(e=i)}else e=U("MISSING_OR_INVALID",`${t}, namespaces should be an object with data`);return e}function Au(r){return he(r.protocol,!0)}function tg(r,t){let e=!1;return r?r&&Ar(r)&&r.length&&r.forEach(n=>{e=Au(n)}):e=!0,e}function rg(r){return typeof r=="number"}function Ne(r){return typeof r<"u"&&typeof r!==null}function ng(r){return!(!r||typeof r!="object"||!r.code||!_o(r.code,!1)||!r.message||!he(r.message,!1))}function ig(r){return!(fe(r)||!he(r.method,!1))}function sg(r){return!(fe(r)||fe(r.result)&&fe(r.error)||!_o(r.id,!1)||!he(r.jsonrpc,!1))}function og(r){return!(fe(r)||!he(r.name,!1))}function Ka(r,t){return!(!ti(t)||!$w(r).includes(t))}function ag(r,t,e){return he(e,!1)?kw(r,t).includes(e):!1}function cg(r,t,e){return he(e,!1)?Nw(r,t).includes(e):!1}function Fa(r,t,e){let n=null;const i=lg(r),s=ug(t),o=Object.keys(i),c=Object.keys(s),l=Wa(Object.keys(r)),u=Wa(Object.keys(t)),d=l.filter(h=>!u.includes(h));return d.length&&(n=U("NON_CONFORMING_NAMESPACES",`${e} namespaces keys don't satisfy requiredNamespaces.
|
|
@@ -10,6 +10,6 @@ ${r.length}`,e=new TextEncoder().encode(t+r);return"0x"+re.from(lm(e)).toString(
|
|
|
10
10
|
Required: ${o.toString()}
|
|
11
11
|
Approved: ${c.toString()}`)),Object.keys(t).forEach(h=>{if(!h.includes(":")||n)return;const p=xr(t[h].accounts);p.includes(h)||(n=U("NON_CONFORMING_NAMESPACES",`${e} namespaces accounts don't satisfy namespace accounts for ${h}
|
|
12
12
|
Required: ${h}
|
|
13
|
-
Approved: ${p.toString()}`))}),o.forEach(h=>{n||(er(i[h].methods,s[h].methods)?er(i[h].events,s[h].events)||(n=U("NON_CONFORMING_NAMESPACES",`${e} namespaces events don't satisfy namespace events for ${h}`)):n=U("NON_CONFORMING_NAMESPACES",`${e} namespaces methods don't satisfy namespace methods for ${h}`))}),n}function lg(r){const t={};return Object.keys(r).forEach(e=>{var n;e.includes(":")?t[e]=r[e]:(n=r[e].chains)==null||n.forEach(i=>{t[i]={methods:r[e].methods,events:r[e].events}})}),t}function Wa(r){return[...new Set(r.map(t=>t.includes(":")?t.split(":")[0]:t))]}function ug(r){const t={};return Object.keys(r).forEach(e=>{if(e.includes(":"))t[e]=r[e];else{const n=xr(r[e].accounts);n==null||n.forEach(i=>{t[i]={accounts:r[e].accounts.filter(s=>s.includes(`${i}:`)),methods:r[e].methods,events:r[e].events}})}}),t}function dg(r,t){return _o(r,!1)&&r<=t.max&&r>=t.min}function Ha(){const r=fn();return new Promise(t=>{switch(r){case He.browser:t(hg());break;case He.reactNative:t(pg());break;case He.node:t(_g());break;default:t(!0)}})}function hg(){return Dr()&&(navigator==null?void 0:navigator.onLine)}async function pg(){if(Ht()&&typeof X<"u"&&X!=null&&X.NetInfo){const r=await(X==null?void 0:X.NetInfo.fetch());return r==null?void 0:r.isConnected}return!0}function _g(){return!0}function fg(r){switch(fn()){case He.browser:mg(r);break;case He.reactNative:yg(r);break}}function mg(r){!Ht()&&Dr()&&(window.addEventListener("online",()=>r(!0)),window.addEventListener("offline",()=>r(!1)))}function yg(r){Ht()&&typeof X<"u"&&X!=null&&X.NetInfo&&(X==null||X.NetInfo.addEventListener(t=>r(t==null?void 0:t.isConnected)))}function wg(){var r;return Dr()&&Rt.getDocument()?((r=Rt.getDocument())==null?void 0:r.visibilityState)==="visible":!0}const $i={};class Ur{static get(t){return $i[t]}static set(t,e){$i[t]=e}static delete(t){delete $i[t]}}function gg(r){const t=_n.decode(r);if(t.length<33)throw new Error("Too short to contain a public key");return t.slice(1,33)}function Eg({publicKey:r,signature:t,payload:e}){var n;const i=ys(e.method),s=128|parseInt(((n=e.version)==null?void 0:n.toString())||"4"),o=Ig(e.address),c=e.era==="00"?new Uint8Array([0]):ys(e.era);if(c.length!==1&&c.length!==2)throw new Error("Invalid era length");const l=parseInt(e.nonce,16),u=new Uint8Array([l&255,l>>8&255]),d=BigInt(`0x${bg(e.tip)}`),h=Tg(d),p=new Uint8Array([0,...r,o,...t,...c,...u,...h,...i]),_=Ag(p.length+1);return new Uint8Array([..._,s,...p])}function vg(r){const t=ys(r),e=eh.blake2b(t,void 0,32);return"0x"+re.from(e).toString("hex")}function ys(r){return new Uint8Array(r.replace(/^0x/,"").match(/.{1,2}/g).map(t=>parseInt(t,16)))}function bg(r){return r.startsWith("0x")?r.slice(2):r}function Ig(r){const t=_n.decode(r)[0];return t===42?0:t===60?2:1}function Ag(r){if(r<64)return new Uint8Array([r<<2]);if(r<16384){const t=r<<2|1;return new Uint8Array([t&255,t>>8&255])}else if(r<1<<30){const t=r<<2|2;return new Uint8Array([t&255,t>>8&255,t>>16&255,t>>24&255])}else throw new Error("Compact encoding > 2^30 not supported")}function Tg(r){if(r<BigInt(1)<<BigInt(6))return new Uint8Array([Number(r<<BigInt(2))]);if(r<BigInt(1)<<BigInt(14)){const t=r<<BigInt(2)|BigInt(1);return new Uint8Array([Number(t&BigInt(255)),Number(t>>BigInt(8)&BigInt(255))])}else if(r<BigInt(1)<<BigInt(30)){const t=r<<BigInt(2)|BigInt(2);return new Uint8Array([Number(t&BigInt(255)),Number(t>>BigInt(8)&BigInt(255)),Number(t>>BigInt(16)&BigInt(255)),Number(t>>BigInt(24)&BigInt(255))])}else throw new Error("BigInt compact encoding not supported > 2^30")}function Pg(r){const t=Uint8Array.from(re.from(r.signature,"hex")),e=gg(r.transaction.address),n=Eg({publicKey:e,signature:t,payload:r.transaction}),i=re.from(n).toString("hex");return vg(i)}var Og={VITE_BASE_URL:"https://cdn.decentraland.org/@dcl/marketplace-site/8.26.2-28438598732.commit-9be9bba"};const Tu="wc",Pu=2,ws="core",wt=`${Tu}@2:${ws}:`,Rg={logger:"error"},Lg={database:":memory:"},Dg="crypto",Ga="client_ed25519_seed",Vg=q.ONE_DAY,Sg="keychain",xg="0.3",Cg="messages",$g="0.3",kg=q.SIX_HOURS,Ng="publisher",Ou="irn",Ug="error",Ru="wss://relay.walletconnect.org",qg="relayer",le={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"},Mg="_subscription",Je={payload:"payload",connect:"connect",disconnect:"disconnect",error:"error"},Bg=.1,gs="2.21.8",se={link_mode:"link_mode",relay:"relay"},kn={inbound:"inbound",outbound:"outbound"},jg="0.3",zg="WALLETCONNECT_CLIENT_ID",Ja="WALLETCONNECT_LINK_MODE_APPS",We={created:"subscription_created",deleted:"subscription_deleted",expired:"subscription_expired",disabled:"subscription_disabled",sync:"subscription_sync",resubscribed:"subscription_resubscribed"},Kg="subscription",Fg="0.3",Wg="pairing",Hg="0.3",qr={wc_pairingDelete:{req:{ttl:q.ONE_DAY,prompt:!1,tag:1e3},res:{ttl:q.ONE_DAY,prompt:!1,tag:1001}},wc_pairingPing:{req:{ttl:q.THIRTY_SECONDS,prompt:!1,tag:1002},res:{ttl:q.THIRTY_SECONDS,prompt:!1,tag:1003}},unregistered_method:{req:{ttl:q.ONE_DAY,prompt:!1,tag:0},res:{ttl:q.ONE_DAY,prompt:!1,tag:0}}},Qt={create:"pairing_create",expire:"pairing_expire",delete:"pairing_delete",ping:"pairing_ping"},nt={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},Gg="history",Jg="0.3",Zg="expirer",Ye={created:"expirer_created",deleted:"expirer_deleted",expired:"expirer_expired",sync:"expirer_sync"},Yg="0.3",Qg="verify-api",Xg="https://verify.walletconnect.com",Lu="https://verify.walletconnect.org",Xr=Lu,eE=`${Xr}/v3`,tE=[Xg,Lu],rE="echo",nE="https://echo.walletconnect.com",pt={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"},At={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"},Nt={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"},Mr={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"},Zt={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"},Br={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"},iE=.1,sE="event-client",oE=86400,aE="https://pulse.walletconnect.org/batch";function cE(r,t){if(r.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),n=0;n<e.length;n++)e[n]=255;for(var i=0;i<r.length;i++){var s=r.charAt(i),o=s.charCodeAt(0);if(e[o]!==255)throw new TypeError(s+" is ambiguous");e[o]=i}var c=r.length,l=r.charAt(0),u=Math.log(c)/Math.log(256),d=Math.log(256)/Math.log(c);function h(f){if(f instanceof Uint8Array||(ArrayBuffer.isView(f)?f=new Uint8Array(f.buffer,f.byteOffset,f.byteLength):Array.isArray(f)&&(f=Uint8Array.from(f))),!(f instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(f.length===0)return"";for(var m=0,y=0,b=0,O=f.length;b!==O&&f[b]===0;)b++,m++;for(var g=(O-b)*d+1>>>0,P=new Uint8Array(g);b!==O;){for(var A=f[b],E=0,D=g-1;(A!==0||E<y)&&D!==-1;D--,E++)A+=256*P[D]>>>0,P[D]=A%c>>>0,A=A/c>>>0;if(A!==0)throw new Error("Non-zero carry");y=E,b++}for(var L=g-y;L!==g&&P[L]===0;)L++;for(var w=l.repeat(m);L<g;++L)w+=r.charAt(P[L]);return w}function p(f){if(typeof f!="string")throw new TypeError("Expected String");if(f.length===0)return new Uint8Array;var m=0;if(f[m]!==" "){for(var y=0,b=0;f[m]===l;)y++,m++;for(var O=(f.length-m)*u+1>>>0,g=new Uint8Array(O);f[m];){var P=e[f.charCodeAt(m)];if(P===255)return;for(var A=0,E=O-1;(P!==0||A<b)&&E!==-1;E--,A++)P+=c*g[E]>>>0,g[E]=P%256>>>0,P=P/256>>>0;if(P!==0)throw new Error("Non-zero carry");b=A,m++}if(f[m]!==" "){for(var D=O-b;D!==O&&g[D]===0;)D++;for(var L=new Uint8Array(y+(O-D)),w=y;D!==O;)L[w++]=g[D++];return L}}}function _(f){var m=p(f);if(m)return m;throw new Error(`Non-${t} character`)}return{encode:h,decodeUnsafe:p,decode:_}}var lE=cE,uE=lE;const Du=r=>{if(r instanceof Uint8Array&&r.constructor.name==="Uint8Array")return r;if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return new Uint8Array(r.buffer,r.byteOffset,r.byteLength);throw new Error("Unknown type, must be binary type")},dE=r=>new TextEncoder().encode(r),hE=r=>new TextDecoder().decode(r);class pE{constructor(t,e,n){this.name=t,this.prefix=e,this.baseEncode=n}encode(t){if(t instanceof Uint8Array)return`${this.prefix}${this.baseEncode(t)}`;throw Error("Unknown type, must be binary type")}}class _E{constructor(t,e,n){if(this.name=t,this.prefix=e,e.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=e.codePointAt(0),this.baseDecode=n}decode(t){if(typeof t=="string"){if(t.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(t)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(t.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(t){return Vu(this,t)}}class fE{constructor(t){this.decoders=t}or(t){return Vu(this,t)}decode(t){const e=t[0],n=this.decoders[e];if(n)return n.decode(t);throw RangeError(`Unable to decode multibase string ${JSON.stringify(t)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const Vu=(r,t)=>new fE({...r.decoders||{[r.prefix]:r},...t.decoders||{[t.prefix]:t}});class mE{constructor(t,e,n,i){this.name=t,this.prefix=e,this.baseEncode=n,this.baseDecode=i,this.encoder=new pE(t,e,n),this.decoder=new _E(t,e,i)}encode(t){return this.encoder.encode(t)}decode(t){return this.decoder.decode(t)}}const _i=({name:r,prefix:t,encode:e,decode:n})=>new mE(r,t,e,n),gn=({prefix:r,name:t,alphabet:e})=>{const{encode:n,decode:i}=uE(e,t);return _i({prefix:r,name:t,encode:n,decode:s=>Du(i(s))})},yE=(r,t,e,n)=>{const i={};for(let d=0;d<t.length;++d)i[t[d]]=d;let s=r.length;for(;r[s-1]==="=";)--s;const o=new Uint8Array(s*e/8|0);let c=0,l=0,u=0;for(let d=0;d<s;++d){const h=i[r[d]];if(h===void 0)throw new SyntaxError(`Non-${n} character`);l=l<<e|h,c+=e,c>=8&&(c-=8,o[u++]=255&l>>c)}if(c>=e||255&l<<8-c)throw new SyntaxError("Unexpected end of data");return o},wE=(r,t,e)=>{const n=t[t.length-1]==="=",i=(1<<e)-1;let s="",o=0,c=0;for(let l=0;l<r.length;++l)for(c=c<<8|r[l],o+=8;o>e;)o-=e,s+=t[i&c>>o];if(o&&(s+=t[i&c<<e-o]),n)for(;s.length*e&7;)s+="=";return s},Ae=({name:r,prefix:t,bitsPerChar:e,alphabet:n})=>_i({prefix:t,name:r,encode(i){return wE(i,n,e)},decode(i){return yE(i,n,e,r)}}),gE=_i({prefix:"\0",name:"identity",encode:r=>hE(r),decode:r=>dE(r)});var EE=Object.freeze({__proto__:null,identity:gE});const vE=Ae({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var bE=Object.freeze({__proto__:null,base2:vE});const IE=Ae({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var AE=Object.freeze({__proto__:null,base8:IE});const TE=gn({prefix:"9",name:"base10",alphabet:"0123456789"});var PE=Object.freeze({__proto__:null,base10:TE});const OE=Ae({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),RE=Ae({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var LE=Object.freeze({__proto__:null,base16:OE,base16upper:RE});const DE=Ae({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),VE=Ae({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),SE=Ae({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),xE=Ae({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),CE=Ae({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),$E=Ae({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),kE=Ae({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),NE=Ae({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),UE=Ae({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var qE=Object.freeze({__proto__:null,base32:DE,base32upper:VE,base32pad:SE,base32padupper:xE,base32hex:CE,base32hexupper:$E,base32hexpad:kE,base32hexpadupper:NE,base32z:UE});const ME=gn({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),BE=gn({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var jE=Object.freeze({__proto__:null,base36:ME,base36upper:BE});const zE=gn({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),KE=gn({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var FE=Object.freeze({__proto__:null,base58btc:zE,base58flickr:KE});const WE=Ae({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),HE=Ae({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),GE=Ae({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),JE=Ae({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var ZE=Object.freeze({__proto__:null,base64:WE,base64pad:HE,base64url:GE,base64urlpad:JE});const Su=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),YE=Su.reduce((r,t,e)=>(r[e]=t,r),[]),QE=Su.reduce((r,t,e)=>(r[t.codePointAt(0)]=e,r),[]);function XE(r){return r.reduce((t,e)=>(t+=YE[e],t),"")}function e0(r){const t=[];for(const e of r){const n=QE[e.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${e}`);t.push(n)}return new Uint8Array(t)}const t0=_i({prefix:"🚀",name:"base256emoji",encode:XE,decode:e0});var r0=Object.freeze({__proto__:null,base256emoji:t0}),n0=xu,Za=128,i0=-128,s0=Math.pow(2,31);function xu(r,t,e){t=t||[],e=e||0;for(var n=e;r>=s0;)t[e++]=r&255|Za,r/=128;for(;r&i0;)t[e++]=r&255|Za,r>>>=7;return t[e]=r|0,xu.bytes=e-n+1,t}var o0=Es,a0=128,Ya=127;function Es(r,n){var e=0,n=n||0,i=0,s=n,o,c=r.length;do{if(s>=c)throw Es.bytes=0,new RangeError("Could not decode varint");o=r[s++],e+=i<28?(o&Ya)<<i:(o&Ya)*Math.pow(2,i),i+=7}while(o>=a0);return Es.bytes=s-n,e}var c0=Math.pow(2,7),l0=Math.pow(2,14),u0=Math.pow(2,21),d0=Math.pow(2,28),h0=Math.pow(2,35),p0=Math.pow(2,42),_0=Math.pow(2,49),f0=Math.pow(2,56),m0=Math.pow(2,63),y0=function(r){return r<c0?1:r<l0?2:r<u0?3:r<d0?4:r<h0?5:r<p0?6:r<_0?7:r<f0?8:r<m0?9:10},w0={encode:n0,decode:o0,encodingLength:y0},Cu=w0;const Qa=(r,t,e=0)=>(Cu.encode(r,t,e),t),Xa=r=>Cu.encodingLength(r),vs=(r,t)=>{const e=t.byteLength,n=Xa(r),i=n+Xa(e),s=new Uint8Array(i+e);return Qa(r,s,0),Qa(e,s,n),s.set(t,i),new g0(r,e,t,s)};class g0{constructor(t,e,n,i){this.code=t,this.size=e,this.digest=n,this.bytes=i}}const $u=({name:r,code:t,encode:e})=>new E0(r,t,e);class E0{constructor(t,e,n){this.name=t,this.code=e,this.encode=n}digest(t){if(t instanceof Uint8Array){const e=this.encode(t);return e instanceof Uint8Array?vs(this.code,e):e.then(n=>vs(this.code,n))}else throw Error("Unknown type, must be binary type")}}const ku=r=>async t=>new Uint8Array(await crypto.subtle.digest(r,t)),v0=$u({name:"sha2-256",code:18,encode:ku("SHA-256")}),b0=$u({name:"sha2-512",code:19,encode:ku("SHA-512")});var I0=Object.freeze({__proto__:null,sha256:v0,sha512:b0});const Nu=0,A0="identity",Uu=Du,T0=r=>vs(Nu,Uu(r)),P0={code:Nu,name:A0,encode:Uu,digest:T0};var O0=Object.freeze({__proto__:null,identity:P0});new TextEncoder,new TextDecoder;const ec={...EE,...bE,...AE,...PE,...LE,...qE,...jE,...FE,...ZE,...r0};({...I0,...O0});function qu(r){return globalThis.Buffer!=null?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):r}function R0(r=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?qu(globalThis.Buffer.allocUnsafe(r)):new Uint8Array(r)}function Mu(r,t,e,n){return{name:r,prefix:t,encoder:{name:r,prefix:t,encode:e},decoder:{decode:n}}}const tc=Mu("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),ki=Mu("ascii","a",r=>{let t="a";for(let e=0;e<r.length;e++)t+=String.fromCharCode(r[e]);return t},r=>{r=r.substring(1);const t=R0(r.length);for(let e=0;e<r.length;e++)t[e]=r.charCodeAt(e);return t}),L0={utf8:tc,"utf-8":tc,hex:ec.base16,latin1:ki,ascii:ki,binary:ki,...ec};function D0(r,t="utf8"){const e=L0[t];if(!e)throw new Error(`Unsupported encoding "${t}"`);return(t==="utf8"||t==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?qu(globalThis.Buffer.from(r,"utf-8")):e.decoder.decode(`${e.prefix}${r}`)}var V0=Object.defineProperty,S0=(r,t,e)=>t in r?V0(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,dt=(r,t,e)=>S0(r,typeof t!="symbol"?t+"":t,e);class x0{constructor(t,e){this.core=t,this.logger=e,dt(this,"keychain",new Map),dt(this,"name",Sg),dt(this,"version",xg),dt(this,"initialized",!1),dt(this,"storagePrefix",wt),dt(this,"init",async()=>{if(!this.initialized){const n=await this.getKeyChain();typeof n<"u"&&(this.keychain=n),this.initialized=!0}}),dt(this,"has",n=>(this.isInitialized(),this.keychain.has(n))),dt(this,"set",async(n,i)=>{this.isInitialized(),this.keychain.set(n,i),await this.persist()}),dt(this,"get",n=>{this.isInitialized();const i=this.keychain.get(n);if(typeof i>"u"){const{message:s}=U("NO_MATCHING_KEY",`${this.name}: ${n}`);throw new Error(s)}return i}),dt(this,"del",async n=>{this.isInitialized(),this.keychain.delete(n),await this.persist()}),this.core=t,this.logger=Ce(e,this.name)}get context(){return Ke(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(t){await this.core.storage.setItem(this.storageKey,ss(t))}async getKeyChain(){const t=await this.core.storage.getItem(this.storageKey);return typeof t<"u"?os(t):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){const{message:t}=U("NOT_INITIALIZED",this.name);throw new Error(t)}}}var C0=Object.defineProperty,$0=(r,t,e)=>t in r?C0(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,ve=(r,t,e)=>$0(r,typeof t!="symbol"?t+"":t,e);class k0{constructor(t,e,n){this.core=t,this.logger=e,ve(this,"name",Dg),ve(this,"keychain"),ve(this,"randomSessionIdentifier",ms()),ve(this,"initialized",!1),ve(this,"init",async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)}),ve(this,"hasKeys",i=>(this.isInitialized(),this.keychain.has(i))),ve(this,"getClientId",async()=>{this.isInitialized();const i=await this.getClientSeed(),s=Po(i);return ih(s.publicKey)}),ve(this,"generateKeyPair",()=>{this.isInitialized();const i=fw();return this.setPrivateKey(i.publicKey,i.privateKey)}),ve(this,"signJWT",async i=>{this.isInitialized();const s=await this.getClientSeed(),o=Po(s),c=this.randomSessionIdentifier;return await sh(c,i,Vg,o)}),ve(this,"generateSharedKey",(i,s,o)=>{this.isInitialized();const c=this.getPrivateKey(i),l=mw(c,s);return this.setSymKey(l,o)}),ve(this,"setSymKey",async(i,s)=>{this.isInitialized();const o=s||$n(i);return await this.keychain.set(o,i),o}),ve(this,"deleteKeyPair",async i=>{this.isInitialized(),await this.keychain.del(i)}),ve(this,"deleteSymKey",async i=>{this.isInitialized(),await this.keychain.del(i)}),ve(this,"encode",async(i,s,o)=>{this.isInitialized();const c=vu(o),l=rn(s);if(ka(c))return gw(l,o==null?void 0:o.encoding);if($a(c)){const p=c.senderPublicKey,_=c.receiverPublicKey;i=await this.generateSharedKey(p,_)}const u=this.getSymKey(i),{type:d,senderPublicKey:h}=c;return yw({type:d,symKey:u,message:l,senderPublicKey:h,encoding:o==null?void 0:o.encoding})}),ve(this,"decode",async(i,s,o)=>{this.isInitialized();const c=vw(s,o);if(ka(c)){const l=Ew(s,o==null?void 0:o.encoding);return Mn(l)}if($a(c)){const l=c.receiverPublicKey,u=c.senderPublicKey;i=await this.generateSharedKey(l,u)}try{const l=this.getSymKey(i),u=ww({symKey:l,encoded:s,encoding:o==null?void 0:o.encoding});return Mn(u)}catch(l){this.logger.error(`Failed to decode message from topic: '${i}', clientId: '${await this.getClientId()}'`),this.logger.error(l)}}),ve(this,"getPayloadType",(i,s=Me)=>{const o=ln({encoded:i,encoding:s});return cr(o.type)}),ve(this,"getPayloadSenderPublicKey",(i,s=Me)=>{const o=ln({encoded:i,encoding:s});return o.senderPublicKey?ze(o.senderPublicKey,xe):void 0}),this.core=t,this.logger=Ce(e,this.name),this.keychain=n||new x0(this.core,this.logger)}get context(){return Ke(this.logger)}async setPrivateKey(t,e){return await this.keychain.set(t,e),t}getPrivateKey(t){return this.keychain.get(t)}async getClientSeed(){let t="";try{t=this.keychain.get(Ga)}catch{t=ms(),await this.keychain.set(Ga,t)}return D0(t,"base16")}getSymKey(t){return this.keychain.get(t)}isInitialized(){if(!this.initialized){const{message:t}=U("NOT_INITIALIZED",this.name);throw new Error(t)}}}var N0=Object.defineProperty,U0=Object.defineProperties,q0=Object.getOwnPropertyDescriptors,rc=Object.getOwnPropertySymbols,M0=Object.prototype.hasOwnProperty,B0=Object.prototype.propertyIsEnumerable,bs=(r,t,e)=>t in r?N0(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,j0=(r,t)=>{for(var e in t||(t={}))M0.call(t,e)&&bs(r,e,t[e]);if(rc)for(var e of rc(t))B0.call(t,e)&&bs(r,e,t[e]);return r},z0=(r,t)=>U0(r,q0(t)),Fe=(r,t,e)=>bs(r,typeof t!="symbol"?t+"":t,e);class K0 extends o_{constructor(t,e){super(t,e),this.logger=t,this.core=e,Fe(this,"messages",new Map),Fe(this,"messagesWithoutClientAck",new Map),Fe(this,"name",Cg),Fe(this,"version",$g),Fe(this,"initialized",!1),Fe(this,"storagePrefix",wt),Fe(this,"init",async()=>{if(!this.initialized){this.logger.trace("Initialized");try{const n=await this.getRelayerMessages();typeof n<"u"&&(this.messages=n);const i=await this.getRelayerMessagesWithoutClientAck();typeof i<"u"&&(this.messagesWithoutClientAck=i),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}}}),Fe(this,"set",async(n,i,s)=>{this.isInitialized();const o=Qe(i);let c=this.messages.get(n);if(typeof c>"u"&&(c={}),typeof c[o]<"u")return o;if(c[o]=i,this.messages.set(n,c),s===kn.inbound){const l=this.messagesWithoutClientAck.get(n)||{};this.messagesWithoutClientAck.set(n,z0(j0({},l),{[o]:i}))}return await this.persist(),o}),Fe(this,"get",n=>{this.isInitialized();let i=this.messages.get(n);return typeof i>"u"&&(i={}),i}),Fe(this,"getWithoutAck",n=>{this.isInitialized();const i={};for(const s of n){const o=this.messagesWithoutClientAck.get(s)||{};i[s]=Object.values(o)}return i}),Fe(this,"has",(n,i)=>{this.isInitialized();const s=this.get(n),o=Qe(i);return typeof s[o]<"u"}),Fe(this,"ack",async(n,i)=>{this.isInitialized();const s=this.messagesWithoutClientAck.get(n);if(typeof s>"u")return;const o=Qe(i);delete s[o],Object.keys(s).length===0?this.messagesWithoutClientAck.delete(n):this.messagesWithoutClientAck.set(n,s),await this.persist()}),Fe(this,"del",async n=>{this.isInitialized(),this.messages.delete(n),this.messagesWithoutClientAck.delete(n),await this.persist()}),this.logger=Ce(t,this.name),this.core=e}get context(){return Ke(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(t){await this.core.storage.setItem(this.storageKey,ss(t))}async setRelayerMessagesWithoutClientAck(t){await this.core.storage.setItem(this.storageKeyWithoutClientAck,ss(t))}async getRelayerMessages(){const t=await this.core.storage.getItem(this.storageKey);return typeof t<"u"?os(t):void 0}async getRelayerMessagesWithoutClientAck(){const t=await this.core.storage.getItem(this.storageKeyWithoutClientAck);return typeof t<"u"?os(t):void 0}async persist(){await this.setRelayerMessages(this.messages),await this.setRelayerMessagesWithoutClientAck(this.messagesWithoutClientAck)}isInitialized(){if(!this.initialized){const{message:t}=U("NOT_INITIALIZED",this.name);throw new Error(t)}}}var F0=Object.defineProperty,W0=Object.defineProperties,H0=Object.getOwnPropertyDescriptors,nc=Object.getOwnPropertySymbols,G0=Object.prototype.hasOwnProperty,J0=Object.prototype.propertyIsEnumerable,Is=(r,t,e)=>t in r?F0(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,yr=(r,t)=>{for(var e in t||(t={}))G0.call(t,e)&&Is(r,e,t[e]);if(nc)for(var e of nc(t))J0.call(t,e)&&Is(r,e,t[e]);return r},ic=(r,t)=>W0(r,H0(t)),Ze=(r,t,e)=>Is(r,typeof t!="symbol"?t+"":t,e);class Z0 extends a_{constructor(t,e){super(t,e),this.relayer=t,this.logger=e,Ze(this,"events",new ur.EventEmitter),Ze(this,"name",Ng),Ze(this,"queue",new Map),Ze(this,"publishTimeout",q.toMiliseconds(q.ONE_MINUTE)),Ze(this,"initialPublishTimeout",q.toMiliseconds(q.ONE_SECOND*15)),Ze(this,"needsTransportRestart",!1),Ze(this,"publish",async(n,i,s)=>{var o,c,l,u,d;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:n,message:i,opts:s}});const h=(s==null?void 0:s.ttl)||kg,p=(s==null?void 0:s.prompt)||!1,_=(s==null?void 0:s.tag)||0,f=(s==null?void 0:s.id)||Xt().toString(),m=vr(ei().protocol),y={id:f,method:(s==null?void 0:s.publishMethod)||m.publish,params:yr({topic:n,message:i,ttl:h,prompt:p,tag:_,attestation:s==null?void 0:s.attestation},(s==null?void 0:s.tvf)&&{tvf:s.tvf})},b=`Failed to publish payload, please try again. id:${f} tag:${_}`;try{fe((o=y.params)==null?void 0:o.prompt)&&((c=y.params)==null||delete c.prompt),fe((l=y.params)==null?void 0:l.tag)&&((u=y.params)==null||delete u.tag);const O=new Promise(async g=>{const P=({id:E})=>{var D;((D=y.id)==null?void 0:D.toString())===E.toString()&&(this.removeRequestFromQueue(E),this.relayer.events.removeListener(le.publish,P),g())};this.relayer.events.on(le.publish,P);const A=mt(new Promise((E,D)=>{this.rpcPublish(y,s).then(E).catch(L=>{this.logger.warn(L,L==null?void 0:L.message),D(L)})}),this.initialPublishTimeout,`Failed initial publish, retrying.... id:${f} tag:${_}`);try{await A,this.events.removeListener(le.publish,P)}catch(E){this.queue.set(f,{request:y,opts:s,attempt:1}),this.logger.warn(E,E==null?void 0:E.message)}});this.logger.trace({type:"method",method:"publish",params:{id:f,topic:n,message:i,opts:s}}),await mt(O,this.publishTimeout,b)}catch(O){if(this.logger.debug("Failed to Publish Payload"),this.logger.error(O),(d=s==null?void 0:s.internal)!=null&&d.throwOnFailedPublish)throw O}finally{this.queue.delete(f)}}),Ze(this,"publishCustom",async n=>{var i,s,o,c,l;this.logger.debug("Publishing custom payload"),this.logger.trace({type:"method",method:"publishCustom",params:n});const{payload:u,opts:d={}}=n,{attestation:h,tvf:p,publishMethod:_,prompt:f,tag:m,ttl:y=q.FIVE_MINUTES}=d,b=d.id||Xt().toString(),O=vr(ei().protocol),g=_||O.publish,P={id:b,method:g,params:yr(ic(yr({},u),{ttl:y,prompt:f,tag:m,attestation:h}),p)},A=`Failed to publish custom payload, please try again. id:${b} tag:${m}`;try{fe((i=P.params)==null?void 0:i.prompt)&&((s=P.params)==null||delete s.prompt),fe((o=P.params)==null?void 0:o.tag)&&((c=P.params)==null||delete c.tag);const E=new Promise(async D=>{const L=({id:v})=>{var I;((I=P.id)==null?void 0:I.toString())===v.toString()&&(this.removeRequestFromQueue(v),this.relayer.events.removeListener(le.publish,L),D())};this.relayer.events.on(le.publish,L);const w=mt(new Promise((v,I)=>{this.rpcPublish(P,d).then(v).catch(T=>{this.logger.warn(T,T==null?void 0:T.message),I(T)})}),this.initialPublishTimeout,`Failed initial custom payload publish, retrying.... method:${g} id:${b} tag:${m}`);try{await w,this.events.removeListener(le.publish,L)}catch(v){this.queue.set(b,{request:P,opts:d,attempt:1}),this.logger.warn(v,v==null?void 0:v.message)}});this.logger.trace({type:"method",method:"publish",params:{id:b,payload:u,opts:d}}),await mt(E,this.publishTimeout,A)}catch(E){if(this.logger.debug("Failed to Publish Payload"),this.logger.error(E),(l=d==null?void 0:d.internal)!=null&&l.throwOnFailedPublish)throw E}finally{this.queue.delete(b)}}),Ze(this,"on",(n,i)=>{this.events.on(n,i)}),Ze(this,"once",(n,i)=>{this.events.once(n,i)}),Ze(this,"off",(n,i)=>{this.events.off(n,i)}),Ze(this,"removeListener",(n,i)=>{this.events.removeListener(n,i)}),this.relayer=t,this.logger=Ce(e,this.name),this.registerEventListeners()}get context(){return Ke(this.logger)}async rpcPublish(t,e){this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:t});const n=await this.relayer.request(t);return this.relayer.events.emit(le.publish,yr(yr({},t),e)),this.logger.debug("Successfully Published Payload"),n}removeRequestFromQueue(t){this.queue.delete(t)}checkQueue(){this.queue.forEach(async(t,e)=>{var n;const i=t.attempt+1;this.queue.set(e,ic(yr({},t),{attempt:i})),this.logger.warn({},`Publisher: queue->publishing: ${t.request.id}, tag: ${(n=t.request.params)==null?void 0:n.tag}, attempt: ${i}`),await this.rpcPublish(t.request,t.opts),this.logger.warn({},`Publisher: queue->published: ${t.request.id}`)})}registerEventListeners(){this.relayer.core.heartbeat.on(Pr.pulse,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit(le.connection_stalled);return}this.checkQueue()}),this.relayer.on(le.message_ack,t=>{this.removeRequestFromQueue(t.id.toString())})}}var Y0=Object.defineProperty,Q0=(r,t,e)=>t in r?Y0(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,wr=(r,t,e)=>Q0(r,typeof t!="symbol"?t+"":t,e);class X0{constructor(){wr(this,"map",new Map),wr(this,"set",(t,e)=>{const n=this.get(t);this.exists(t,e)||this.map.set(t,[...n,e])}),wr(this,"get",t=>this.map.get(t)||[]),wr(this,"exists",(t,e)=>this.get(t).includes(e)),wr(this,"delete",(t,e)=>{if(typeof e>"u"){this.map.delete(t);return}if(!this.map.has(t))return;const n=this.get(t);if(!this.exists(t,e))return;const i=n.filter(s=>s!==e);if(!i.length){this.map.delete(t);return}this.map.set(t,i)}),wr(this,"clear",()=>{this.map.clear()})}get topics(){return Array.from(this.map.keys())}}var ev=Object.defineProperty,tv=Object.defineProperties,rv=Object.getOwnPropertyDescriptors,sc=Object.getOwnPropertySymbols,nv=Object.prototype.hasOwnProperty,iv=Object.prototype.propertyIsEnumerable,As=(r,t,e)=>t in r?ev(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,jr=(r,t)=>{for(var e in t||(t={}))nv.call(t,e)&&As(r,e,t[e]);if(sc)for(var e of sc(t))iv.call(t,e)&&As(r,e,t[e]);return r},Ni=(r,t)=>tv(r,rv(t)),ne=(r,t,e)=>As(r,typeof t!="symbol"?t+"":t,e);class sv extends u_{constructor(t,e){super(t,e),this.relayer=t,this.logger=e,ne(this,"subscriptions",new Map),ne(this,"topicMap",new X0),ne(this,"events",new ur.EventEmitter),ne(this,"name",Kg),ne(this,"version",Fg),ne(this,"pending",new Map),ne(this,"cached",[]),ne(this,"initialized",!1),ne(this,"storagePrefix",wt),ne(this,"subscribeTimeout",q.toMiliseconds(q.ONE_MINUTE)),ne(this,"initialSubscribeTimeout",q.toMiliseconds(q.ONE_SECOND*15)),ne(this,"clientId"),ne(this,"batchSubscribeTopicsLimit",500),ne(this,"init",async()=>{this.initialized||(this.logger.trace("Initialized"),this.registerEventListeners(),await this.restore()),this.initialized=!0}),ne(this,"subscribe",async(n,i)=>{var s;this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}});try{const o=ei(i),c={topic:n,relay:o,transportType:i==null?void 0:i.transportType};(s=i==null?void 0:i.internal)!=null&&s.skipSubscribe||this.pending.set(n,c);const l=await this.rpcSubscribe(n,o,i);return typeof l=="string"&&(this.onSubscribe(l,c),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}})),l}catch(o){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(o),o}}),ne(this,"unsubscribe",async(n,i)=>{this.isInitialized(),typeof(i==null?void 0:i.id)<"u"?await this.unsubscribeById(n,i.id,i):await this.unsubscribeByTopic(n,i)}),ne(this,"isSubscribed",n=>new Promise(i=>{i(this.topicMap.topics.includes(n))})),ne(this,"isKnownTopic",n=>new Promise(i=>{i(this.topicMap.topics.includes(n)||this.pending.has(n)||this.cached.some(s=>s.topic===n))})),ne(this,"on",(n,i)=>{this.events.on(n,i)}),ne(this,"once",(n,i)=>{this.events.once(n,i)}),ne(this,"off",(n,i)=>{this.events.off(n,i)}),ne(this,"removeListener",(n,i)=>{this.events.removeListener(n,i)}),ne(this,"start",async()=>{await this.onConnect()}),ne(this,"stop",async()=>{await this.onDisconnect()}),ne(this,"restart",async()=>{await this.restore(),await this.onRestart()}),ne(this,"checkPending",async()=>{if(this.pending.size===0&&(!this.initialized||!this.relayer.connected))return;const n=[];this.pending.forEach(i=>{n.push(i)}),await this.batchSubscribe(n)}),ne(this,"registerEventListeners",()=>{this.relayer.core.heartbeat.on(Pr.pulse,async()=>{await this.checkPending()}),this.events.on(We.created,async n=>{const i=We.created;this.logger.info(`Emitting ${i}`),this.logger.debug({type:"event",event:i,data:n}),await this.persist()}),this.events.on(We.deleted,async n=>{const i=We.deleted;this.logger.info(`Emitting ${i}`),this.logger.debug({type:"event",event:i,data:n}),await this.persist()})}),this.relayer=t,this.logger=Ce(e,this.name),this.clientId=""}get context(){return Ke(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(t,e){let n=!1;try{n=this.getSubscription(t).topic===e}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(t,e){const n=this.topicMap.get(t);await Promise.all(n.map(async i=>await this.unsubscribeById(t,i,e)))}async unsubscribeById(t,e,n){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:t,id:e,opts:n}});try{const i=ei(n);await this.restartToComplete({topic:t,id:e,relay:i}),await this.rpcUnsubscribe(t,e,i);const s=ae("USER_DISCONNECTED",`${this.name}, ${t}`);await this.onUnsubscribe(t,e,s),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:t,id:e,opts:n}})}catch(i){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(i),i}}async rpcSubscribe(t,e,n){var i,s;const o=await this.getSubscriptionId(t);if((i=n==null?void 0:n.internal)!=null&&i.skipSubscribe)return o;(!n||(n==null?void 0:n.transportType)===se.relay)&&await this.restartToComplete({topic:t,id:t,relay:e});const c={method:vr(e.protocol).subscribe,params:{topic:t}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:c});const l=(s=n==null?void 0:n.internal)==null?void 0:s.throwOnFailedPublish;try{if((n==null?void 0:n.transportType)===se.link_mode)return setTimeout(()=>{(this.relayer.connected||this.relayer.connecting)&&this.relayer.request(c).catch(h=>this.logger.warn(h))},q.toMiliseconds(q.ONE_SECOND)),o;const u=new Promise(async h=>{const p=_=>{_.topic===t&&(this.events.removeListener(We.created,p),h(_.id))};this.events.on(We.created,p);try{const _=await mt(new Promise((f,m)=>{this.relayer.request(c).catch(y=>{this.logger.warn(y,y==null?void 0:y.message),m(y)}).then(f)}),this.initialSubscribeTimeout,`Subscribing to ${t} failed, please try again`);this.events.removeListener(We.created,p),h(_)}catch{}}),d=await mt(u,this.subscribeTimeout,`Subscribing to ${t} failed, please try again`);if(!d&&l)throw new Error(`Subscribing to ${t} failed, please try again`);return d?o:null}catch(u){if(this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(le.connection_stalled),l)throw u}return null}async rpcBatchSubscribe(t){if(!t.length)return;const e=t[0].relay,n={method:vr(e.protocol).batchSubscribe,params:{topics:t.map(i=>i.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});try{await await mt(new Promise(i=>{this.relayer.request(n).catch(s=>this.logger.warn(s)).then(i)}),this.subscribeTimeout,"rpcBatchSubscribe failed, please try again")}catch{this.relayer.events.emit(le.connection_stalled)}}async rpcBatchFetchMessages(t){if(!t.length)return;const e=t[0].relay,n={method:vr(e.protocol).batchFetchMessages,params:{topics:t.map(s=>s.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});let i;try{i=await await mt(new Promise((s,o)=>{this.relayer.request(n).catch(c=>{this.logger.warn(c),o(c)}).then(s)}),this.subscribeTimeout,"rpcBatchFetchMessages failed, please try again")}catch{this.relayer.events.emit(le.connection_stalled)}return i}rpcUnsubscribe(t,e,n){const i={method:vr(n.protocol).unsubscribe,params:{topic:t,id:e}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i}),this.relayer.request(i)}onSubscribe(t,e){this.setSubscription(t,Ni(jr({},e),{id:t})),this.pending.delete(e.topic)}onBatchSubscribe(t){t.length&&t.forEach(e=>{this.setSubscription(e.id,jr({},e)),this.pending.delete(e.topic)})}async onUnsubscribe(t,e,n){this.events.removeAllListeners(e),this.hasSubscription(e,t)&&this.deleteSubscription(e,n),await this.relayer.messages.del(t)}async setRelayerSubscriptions(t){await this.relayer.core.storage.setItem(this.storageKey,t)}async getRelayerSubscriptions(){return await this.relayer.core.storage.getItem(this.storageKey)}setSubscription(t,e){this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:t,subscription:e}),this.addSubscription(t,e)}addSubscription(t,e){this.subscriptions.set(t,jr({},e)),this.topicMap.set(e.topic,t),this.events.emit(We.created,e)}getSubscription(t){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:t});const e=this.subscriptions.get(t);if(!e){const{message:n}=U("NO_MATCHING_KEY",`${this.name}: ${t}`);throw new Error(n)}return e}deleteSubscription(t,e){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:t,reason:e});const n=this.getSubscription(t);this.subscriptions.delete(t),this.topicMap.delete(n.topic,t),this.events.emit(We.deleted,Ni(jr({},n),{reason:e}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(We.sync)}async onRestart(){if(this.cached.length){const t=[...this.cached],e=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let n=0;n<e;n++){const i=t.splice(0,this.batchSubscribeTopicsLimit);await this.batchSubscribe(i)}}this.events.emit(We.resubscribed)}async restore(){try{const t=await this.getRelayerSubscriptions();if(typeof t>"u"||!t.length)return;if(this.subscriptions.size&&!t.every(e=>{var n;return e.topic===((n=this.subscriptions.get(e.id))==null?void 0:n.topic)})){const{message:e}=U("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(e)}this.cached=t,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:"method",method:"restore",subscriptions:this.values})}catch(t){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(t)}}async batchSubscribe(t){t.length&&(await this.rpcBatchSubscribe(t),this.onBatchSubscribe(await Promise.all(t.map(async e=>Ni(jr({},e),{id:await this.getSubscriptionId(e.topic)})))))}async batchFetchMessages(t){if(!t.length)return;this.logger.trace(`Fetching batch messages for ${t.length} subscriptions`);const e=await this.rpcBatchFetchMessages(t);e&&e.messages&&(await Nf(q.toMiliseconds(q.ONE_SECOND)),await this.relayer.handleBatchMessageEvents(e.messages))}async onConnect(){await this.restart(),this.reset()}onDisconnect(){this.onDisable()}isInitialized(){if(!this.initialized){const{message:t}=U("NOT_INITIALIZED",this.name);throw new Error(t)}}async restartToComplete(t){!this.relayer.connected&&!this.relayer.connecting&&(this.cached.push(t),await this.relayer.transportOpen())}async getClientId(){return this.clientId||(this.clientId=await this.relayer.core.crypto.getClientId()),this.clientId}async getSubscriptionId(t){return Qe(t+await this.getClientId())}}var ov=Object.defineProperty,oc=Object.getOwnPropertySymbols,av=Object.prototype.hasOwnProperty,cv=Object.prototype.propertyIsEnumerable,Ts=(r,t,e)=>t in r?ov(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,ac=(r,t)=>{for(var e in t||(t={}))av.call(t,e)&&Ts(r,e,t[e]);if(oc)for(var e of oc(t))cv.call(t,e)&&Ts(r,e,t[e]);return r},Q=(r,t,e)=>Ts(r,typeof t!="symbol"?t+"":t,e);class lv extends c_{constructor(t){super(t),Q(this,"protocol","wc"),Q(this,"version",2),Q(this,"core"),Q(this,"logger"),Q(this,"events",new ur.EventEmitter),Q(this,"provider"),Q(this,"messages"),Q(this,"subscriber"),Q(this,"publisher"),Q(this,"name",qg),Q(this,"transportExplicitlyClosed",!1),Q(this,"initialized",!1),Q(this,"connectionAttemptInProgress",!1),Q(this,"relayUrl"),Q(this,"projectId"),Q(this,"packageName"),Q(this,"bundleId"),Q(this,"hasExperiencedNetworkDisruption",!1),Q(this,"pingTimeout"),Q(this,"heartBeatTimeout",q.toMiliseconds(q.THIRTY_SECONDS+q.FIVE_SECONDS)),Q(this,"reconnectTimeout"),Q(this,"connectPromise"),Q(this,"reconnectInProgress",!1),Q(this,"requestsInFlight",[]),Q(this,"connectTimeout",q.toMiliseconds(q.ONE_SECOND*15)),Q(this,"request",async e=>{var n,i;this.logger.debug("Publishing Request Payload");const s=e.id||Xt().toString();await this.toEstablishConnection();try{this.logger.trace({id:s,method:e.method,topic:(n=e.params)==null?void 0:n.topic},"relayer.request - publishing...");const o=`${s}:${((i=e.params)==null?void 0:i.tag)||""}`;this.requestsInFlight.push(o);const c=await this.provider.request(e);return this.requestsInFlight=this.requestsInFlight.filter(l=>l!==o),c}catch(o){throw this.logger.debug(`Failed to Publish Request: ${s}`),o}}),Q(this,"resetPingTimeout",()=>{Zn()&&(clearTimeout(this.pingTimeout),this.pingTimeout=setTimeout(()=>{var e,n,i,s;try{this.logger.debug({},"pingTimeout: Connection stalled, terminating..."),(s=(i=(n=(e=this.provider)==null?void 0:e.connection)==null?void 0:n.socket)==null?void 0:i.terminate)==null||s.call(i)}catch(o){this.logger.warn(o,o==null?void 0:o.message)}},this.heartBeatTimeout))}),Q(this,"onPayloadHandler",e=>{this.onProviderPayload(e),this.resetPingTimeout()}),Q(this,"onConnectHandler",()=>{this.logger.warn({},"Relayer connected 🛜"),this.startPingTimeout(),this.events.emit(le.connect)}),Q(this,"onDisconnectHandler",()=>{this.logger.warn({},"Relayer disconnected 🛑"),this.requestsInFlight=[],this.onProviderDisconnect()}),Q(this,"onProviderErrorHandler",e=>{this.logger.fatal(`Fatal socket error: ${e.message}`),this.events.emit(le.error,e),this.logger.fatal("Fatal socket error received, closing transport"),this.transportClose()}),Q(this,"registerProviderListeners",()=>{this.provider.on(Je.payload,this.onPayloadHandler),this.provider.on(Je.connect,this.onConnectHandler),this.provider.on(Je.disconnect,this.onDisconnectHandler),this.provider.on(Je.error,this.onProviderErrorHandler)}),this.core=t.core,this.logger=typeof t.logger<"u"&&typeof t.logger!="string"?Ce(t.logger,this.name):oi(Qs({level:t.logger||Ug})),this.messages=new K0(this.logger,t.core),this.subscriber=new sv(this,this.logger),this.publisher=new Z0(this,this.logger),this.projectId=t==null?void 0:t.projectId,this.relayUrl=(t==null?void 0:t.relayUrl)||Ru,vf()?this.packageName=na():bf()&&(this.bundleId=na()),this.provider={}}async init(){this.logger.trace("Initialized"),this.registerEventListeners(),await Promise.all([this.messages.init(),this.subscriber.init()]),this.initialized=!0,this.transportOpen().catch(t=>this.logger.warn(t,t==null?void 0:t.message))}get context(){return Ke(this.logger)}get connected(){var t,e,n;return((n=(e=(t=this.provider)==null?void 0:t.connection)==null?void 0:e.socket)==null?void 0:n.readyState)===1||!1}get connecting(){var t,e,n;return((n=(e=(t=this.provider)==null?void 0:t.connection)==null?void 0:e.socket)==null?void 0:n.readyState)===0||this.connectPromise!==void 0||!1}async publish(t,e,n){this.isInitialized(),await this.publisher.publish(t,e,n),await this.recordMessageEvent({topic:t,message:e,publishedAt:Date.now(),transportType:se.relay},kn.outbound)}async publishCustom(t){this.isInitialized(),await this.publisher.publishCustom(t)}async subscribe(t,e){var n,i,s;this.isInitialized(),(!(e!=null&&e.transportType)||(e==null?void 0:e.transportType)==="relay")&&await this.toEstablishConnection();const o=typeof((n=e==null?void 0:e.internal)==null?void 0:n.throwOnFailedPublish)>"u"?!0:(i=e==null?void 0:e.internal)==null?void 0:i.throwOnFailedPublish;let c=((s=this.subscriber.topicMap.get(t))==null?void 0:s[0])||"",l;const u=d=>{d.topic===t&&(this.subscriber.off(We.created,u),l())};return await Promise.all([new Promise(d=>{l=d,this.subscriber.on(We.created,u)}),new Promise(async(d,h)=>{c=await this.subscriber.subscribe(t,ac({internal:{throwOnFailedPublish:o}},e)).catch(p=>{o&&h(p)})||c,d()})]),c}async unsubscribe(t,e){this.isInitialized(),await this.subscriber.unsubscribe(t,e)}on(t,e){this.events.on(t,e)}once(t,e){this.events.once(t,e)}off(t,e){this.events.off(t,e)}removeListener(t,e){this.events.removeListener(t,e)}async transportDisconnect(){this.provider.disconnect&&(this.hasExperiencedNetworkDisruption||this.connected)?await mt(this.provider.disconnect(),2e3,"provider.disconnect()").catch(()=>this.onProviderDisconnect()):this.onProviderDisconnect()}async transportClose(){this.transportExplicitlyClosed=!0,await this.transportDisconnect()}async transportOpen(t){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(e,n)=>{await this.connect(t).then(e).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(t){this.logger.debug({},"Restarting transport..."),!this.connectionAttemptInProgress&&(this.relayUrl=t||this.relayUrl,await this.confirmOnlineStateOrThrow(),await this.transportClose(),await this.transportOpen())}async confirmOnlineStateOrThrow(){if(!await Ha())throw new Error("No internet connection detected. Please restart your network and try again.")}async handleBatchMessageEvents(t){if((t==null?void 0:t.length)===0){this.logger.trace("Batch message events is empty. Ignoring...");return}const e=t.sort((n,i)=>n.publishedAt-i.publishedAt);this.logger.debug(`Batch of ${e.length} message events sorted`);for(const n of e)try{await this.onMessageEvent(n)}catch(i){this.logger.warn(i,"Error while processing batch message event: "+(i==null?void 0:i.message))}this.logger.trace(`Batch of ${e.length} message events processed`)}async onLinkMessageEvent(t,e){const{topic:n}=t;if(!e.sessionExists){const i=_e(q.FIVE_MINUTES),s={topic:n,expiry:i,relay:{protocol:"irn"},active:!1};await this.core.pairing.pairings.set(n,s)}this.events.emit(le.message,t),await this.recordMessageEvent(t,kn.inbound)}async connect(t){await this.confirmOnlineStateOrThrow(),t&&t!==this.relayUrl&&(this.relayUrl=t,await this.transportDisconnect()),this.connectionAttemptInProgress=!0,this.transportExplicitlyClosed=!1;let e=1;for(;e<6;){try{if(this.transportExplicitlyClosed)break;this.logger.debug({},`Connecting to ${this.relayUrl}, attempt: ${e}...`),await this.createProvider(),await new Promise(async(n,i)=>{const s=()=>{i(new Error("Connection interrupted while trying to connect"))};this.provider.once(Je.disconnect,s),await mt(new Promise((o,c)=>{this.provider.connect().then(o).catch(c)}),this.connectTimeout,`Socket stalled when trying to connect to ${this.relayUrl}`).catch(o=>{i(o)}).finally(()=>{this.provider.off(Je.disconnect,s),clearTimeout(this.reconnectTimeout)}),await new Promise(async(o,c)=>{const l=()=>{i(new Error("Connection interrupted while trying to subscribe"))};this.provider.once(Je.disconnect,l),await this.subscriber.start().then(o).catch(c).finally(()=>{this.provider.off(Je.disconnect,l)})}),this.hasExperiencedNetworkDisruption=!1,n()})}catch(n){await this.subscriber.stop();const i=n;this.logger.warn({},i.message),this.hasExperiencedNetworkDisruption=!0}finally{this.connectionAttemptInProgress=!1}if(this.connected){this.logger.debug({},`Connected to ${this.relayUrl} successfully on attempt: ${e}`);break}await new Promise(n=>setTimeout(n,q.toMiliseconds(e*1))),e++}}startPingTimeout(){var t,e,n,i,s;if(Zn())try{(e=(t=this.provider)==null?void 0:t.connection)!=null&&e.socket&&((s=(i=(n=this.provider)==null?void 0:n.connection)==null?void 0:i.socket)==null||s.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 t=await this.core.crypto.signJWT(this.relayUrl);this.provider=new rh(new nh(Of({sdkVersion:gs,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:t,useOnCloseEvent:!0,bundleId:this.bundleId,packageName:this.packageName}))),this.registerProviderListeners()}async recordMessageEvent(t,e){const{topic:n,message:i}=t;await this.messages.set(n,i,e)}async shouldIgnoreMessageEvent(t){const{topic:e,message:n}=t;if(!n||n.length===0)return this.logger.warn(`Ignoring invalid/empty message: ${n}`),!0;if(!await this.subscriber.isKnownTopic(e))return this.logger.warn(`Ignoring message for unknown topic ${e}`),!0;const i=this.messages.has(e,n);return i&&this.logger.warn(`Ignoring duplicate message: ${n}`),i}async onProviderPayload(t){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:t}),qs(t)){if(!t.method.endsWith(Mg))return;const e=t.params,{topic:n,message:i,publishedAt:s,attestation:o}=e.data,c={topic:n,message:i,publishedAt:s,transportType:se.relay,attestation:o};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(ac({type:"event",event:e.id},c)),this.events.emit(e.id,c),await this.acknowledgePayload(t),await this.onMessageEvent(c)}else Ms(t)&&this.events.emit(le.message_ack,t)}async onMessageEvent(t){await this.shouldIgnoreMessageEvent(t)||(await this.recordMessageEvent(t,kn.inbound),this.events.emit(le.message,t))}async acknowledgePayload(t){const e=Bn(t.id,!0);await this.provider.connection.send(e)}unregisterProviderListeners(){this.provider.off(Je.payload,this.onPayloadHandler),this.provider.off(Je.connect,this.onConnectHandler),this.provider.off(Je.disconnect,this.onDisconnectHandler),this.provider.off(Je.error,this.onProviderErrorHandler),clearTimeout(this.pingTimeout)}async registerEventListeners(){let t=await Ha();fg(async e=>{t!==e&&(t=e,e?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(Pr.pulse,async()=>{if(!this.transportExplicitlyClosed&&!this.connected&&wg())try{await this.confirmOnlineStateOrThrow(),await this.transportOpen()}catch(e){this.logger.warn(e,e==null?void 0:e.message)}})}async onProviderDisconnect(){clearTimeout(this.pingTimeout),this.events.emit(le.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(t=>this.logger.error(t,t==null?void 0:t.message)),this.reconnectTimeout=void 0,this.reconnectInProgress=!1},q.toMiliseconds(Bg)))))}isInitialized(){if(!this.initialized){const{message:t}=U("NOT_INITIALIZED",this.name);throw new Error(t)}}async toEstablishConnection(){if(await this.confirmOnlineStateOrThrow(),!this.connected){if(this.connectPromise){await this.connectPromise;return}await this.connect()}}}function uv(r,t){return r===t||Number.isNaN(r)&&Number.isNaN(t)}function cc(r){return Object.getOwnPropertySymbols(r).filter(t=>Object.prototype.propertyIsEnumerable.call(r,t))}function lc(r){return r==null?r===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(r)}const dv="[object RegExp]",hv="[object String]",pv="[object Number]",_v="[object Boolean]",uc="[object Arguments]",fv="[object Symbol]",mv="[object Date]",yv="[object Map]",wv="[object Set]",gv="[object Array]",Ev="[object Function]",vv="[object ArrayBuffer]",Ui="[object Object]",bv="[object Error]",Iv="[object DataView]",Av="[object Uint8Array]",Tv="[object Uint8ClampedArray]",Pv="[object Uint16Array]",Ov="[object Uint32Array]",Rv="[object BigUint64Array]",Lv="[object Int8Array]",Dv="[object Int16Array]",Vv="[object Int32Array]",Sv="[object BigInt64Array]",xv="[object Float32Array]",Cv="[object Float64Array]";function $v(){}function dc(r){if(!r||typeof r!="object")return!1;const t=Object.getPrototypeOf(r);return t===null||t===Object.prototype||Object.getPrototypeOf(t)===null?Object.prototype.toString.call(r)==="[object Object]":!1}function kv(r,t,e){return Hr(r,t,void 0,void 0,void 0,void 0,e)}function Hr(r,t,e,n,i,s,o){const c=o(r,t,e,n,i,s);if(c!==void 0)return c;if(typeof r==typeof t)switch(typeof r){case"bigint":case"string":case"boolean":case"symbol":case"undefined":return r===t;case"number":return r===t||Object.is(r,t);case"function":return r===t;case"object":return en(r,t,s,o)}return en(r,t,s,o)}function en(r,t,e,n){if(Object.is(r,t))return!0;let i=lc(r),s=lc(t);if(i===uc&&(i=Ui),s===uc&&(s=Ui),i!==s)return!1;switch(i){case hv:return r.toString()===t.toString();case pv:{const l=r.valueOf(),u=t.valueOf();return uv(l,u)}case _v:case mv:case fv:return Object.is(r.valueOf(),t.valueOf());case dv:return r.source===t.source&&r.flags===t.flags;case Ev:return r===t}e=e??new Map;const o=e.get(r),c=e.get(t);if(o!=null&&c!=null)return o===t;e.set(r,t),e.set(t,r);try{switch(i){case yv:{if(r.size!==t.size)return!1;for(const[l,u]of r.entries())if(!t.has(l)||!Hr(u,t.get(l),l,r,t,e,n))return!1;return!0}case wv:{if(r.size!==t.size)return!1;const l=Array.from(r.values()),u=Array.from(t.values());for(let d=0;d<l.length;d++){const h=l[d],p=u.findIndex(_=>Hr(h,_,void 0,r,t,e,n));if(p===-1)return!1;u.splice(p,1)}return!0}case gv:case Av:case Tv:case Pv:case Ov:case Rv:case Lv:case Dv:case Vv:case Sv:case xv:case Cv:{if(typeof re<"u"&&re.isBuffer(r)!==re.isBuffer(t)||r.length!==t.length)return!1;for(let l=0;l<r.length;l++)if(!Hr(r[l],t[l],l,r,t,e,n))return!1;return!0}case vv:return r.byteLength!==t.byteLength?!1:en(new Uint8Array(r),new Uint8Array(t),e,n);case Iv:return r.byteLength!==t.byteLength||r.byteOffset!==t.byteOffset?!1:en(new Uint8Array(r),new Uint8Array(t),e,n);case bv:return r.name===t.name&&r.message===t.message;case Ui:{if(!(en(r.constructor,t.constructor,e,n)||dc(r)&&dc(t)))return!1;const l=[...Object.keys(r),...cc(r)],u=[...Object.keys(t),...cc(t)];if(l.length!==u.length)return!1;for(let d=0;d<l.length;d++){const h=l[d],p=r[h];if(!Object.hasOwn(t,h))return!1;const _=t[h];if(!Hr(p,_,h,r,t,e,n))return!1}return!0}default:return!1}}finally{e.delete(r),e.delete(t)}}function Nv(r,t){return kv(r,t,$v)}var Uv=Object.defineProperty,hc=Object.getOwnPropertySymbols,qv=Object.prototype.hasOwnProperty,Mv=Object.prototype.propertyIsEnumerable,Ps=(r,t,e)=>t in r?Uv(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,pc=(r,t)=>{for(var e in t||(t={}))qv.call(t,e)&&Ps(r,e,t[e]);if(hc)for(var e of hc(t))Mv.call(t,e)&&Ps(r,e,t[e]);return r},$e=(r,t,e)=>Ps(r,typeof t!="symbol"?t+"":t,e);class pr extends l_{constructor(t,e,n,i=wt,s=void 0){super(t,e,n,i),this.core=t,this.logger=e,this.name=n,$e(this,"map",new Map),$e(this,"version",jg),$e(this,"cached",[]),$e(this,"initialized",!1),$e(this,"getKey"),$e(this,"storagePrefix",wt),$e(this,"recentlyDeleted",[]),$e(this,"recentlyDeletedLimit",200),$e(this,"init",async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(o=>{this.getKey&&o!==null&&!fe(o)?this.map.set(this.getKey(o),o):Ww(o)?this.map.set(o.id,o):Hw(o)&&this.map.set(o.topic,o)}),this.cached=[],this.initialized=!0)}),$e(this,"set",async(o,c)=>{this.isInitialized(),this.map.has(o)?await this.update(o,c):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:o,value:c}),this.map.set(o,c),await this.persist())}),$e(this,"get",o=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:o}),this.getData(o))),$e(this,"getAll",o=>(this.isInitialized(),o?this.values.filter(c=>Object.keys(o).every(l=>Nv(c[l],o[l]))):this.values)),$e(this,"update",async(o,c)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:o,update:c});const l=pc(pc({},this.getData(o)),c);this.map.set(o,l),await this.persist()}),$e(this,"delete",async(o,c)=>{this.isInitialized(),this.map.has(o)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:o,reason:c}),this.map.delete(o),this.addToRecentlyDeleted(o),await this.persist())}),this.logger=Ce(e,this.name),this.storagePrefix=i,this.getKey=s}get context(){return Ke(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(t){this.recentlyDeleted.push(t),this.recentlyDeleted.length>=this.recentlyDeletedLimit&&this.recentlyDeleted.splice(0,this.recentlyDeletedLimit/2)}async setDataStore(t){await this.core.storage.setItem(this.storageKey,t)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(t){const e=this.map.get(t);if(!e){if(this.recentlyDeleted.includes(t)){const{message:i}=U("MISSING_OR_INVALID",`Record was recently deleted - ${this.name}: ${t}`);throw this.logger.error(i),new Error(i)}const{message:n}=U("NO_MATCHING_KEY",`${this.name}: ${t}`);throw this.logger.error(n),new Error(n)}return e}async persist(){await this.setDataStore(this.values)}async restore(){try{const t=await this.getDataStore();if(typeof t>"u"||!t.length)return;if(this.map.size){const{message:e}=U("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),new Error(e)}this.cached=t,this.logger.debug(`Successfully Restored value for ${this.name}`),this.logger.trace({type:"method",method:"restore",value:this.values})}catch(t){this.logger.debug(`Failed to Restore value for ${this.name}`),this.logger.error(t)}}isInitialized(){if(!this.initialized){const{message:t}=U("NOT_INITIALIZED",this.name);throw new Error(t)}}}var Bv=Object.defineProperty,jv=(r,t,e)=>t in r?Bv(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,G=(r,t,e)=>jv(r,typeof t!="symbol"?t+"":t,e);class zv{constructor(t,e){this.core=t,this.logger=e,G(this,"name",Wg),G(this,"version",Hg),G(this,"events",new Mc),G(this,"pairings"),G(this,"initialized",!1),G(this,"storagePrefix",wt),G(this,"ignoredPayloadTypes",[Ot]),G(this,"registeredMethods",[]),G(this,"init",async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"))}),G(this,"register",({methods:n})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...n])]}),G(this,"create",async n=>{this.isInitialized();const i=ms(),s=await this.core.crypto.setSymKey(i),o=_e(q.FIVE_MINUTES),c={protocol:Ou},l={topic:s,expiry:o,relay:c,active:!1,methods:n==null?void 0:n.methods},u=Ua({protocol:this.core.protocol,version:this.core.version,topic:s,symKey:i,relay:c,expiryTimestamp:o,methods:n==null?void 0:n.methods});return this.events.emit(Qt.create,l),this.core.expirer.set(s,o),await this.pairings.set(s,l),await this.core.relayer.subscribe(s,{transportType:n==null?void 0:n.transportType,internal:n==null?void 0:n.internal}),{topic:s,uri:u}}),G(this,"pair",async n=>{this.isInitialized();const i=this.core.eventClient.createEvent({properties:{topic:n==null?void 0:n.uri,trace:[pt.pairing_started]}});this.isValidPair(n,i);const{topic:s,symKey:o,relay:c,expiryTimestamp:l,methods:u}=Na(n.uri);i.props.properties.topic=s,i.addTrace(pt.pairing_uri_validation_success),i.addTrace(pt.pairing_uri_not_expired);let d;if(this.pairings.keys.includes(s)){if(d=this.pairings.get(s),i.addTrace(pt.existing_pairing),d.active)throw i.setError(At.active_pairing_already_exists),new Error(`Pairing already exists: ${s}. Please try again with a new connection URI.`);i.addTrace(pt.pairing_not_expired)}const h=l||_e(q.FIVE_MINUTES),p={topic:s,relay:c,expiry:h,active:!1,methods:u};this.core.expirer.set(s,h),await this.pairings.set(s,p),i.addTrace(pt.store_new_pairing),n.activatePairing&&await this.activate({topic:s}),this.events.emit(Qt.create,p),i.addTrace(pt.emit_inactive_pairing),this.core.crypto.keychain.has(s)||await this.core.crypto.setSymKey(o,s),i.addTrace(pt.subscribing_pairing_topic);try{await this.core.relayer.confirmOnlineStateOrThrow()}catch{i.setError(At.no_internet_connection)}try{await this.core.relayer.subscribe(s,{relay:c})}catch(_){throw i.setError(At.subscribe_pairing_topic_failure),_}return i.addTrace(pt.subscribe_pairing_topic_success),p}),G(this,"activate",async({topic:n})=>{this.isInitialized();const i=_e(q.FIVE_MINUTES);this.core.expirer.set(n,i),await this.pairings.update(n,{active:!0,expiry:i})}),G(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:i}=n;if(this.pairings.keys.includes(i)){const s=await this.sendRequest(i,"wc_pairingPing",{}),{done:o,resolve:c,reject:l}=Yt();this.events.once(ee("pairing_ping",s),({error:u})=>{u?l(u):c()}),await o()}}),G(this,"updateExpiry",async({topic:n,expiry:i})=>{this.isInitialized(),await this.pairings.update(n,{expiry:i})}),G(this,"updateMetadata",async({topic:n,metadata:i})=>{this.isInitialized(),await this.pairings.update(n,{peerMetadata:i})}),G(this,"getPairings",()=>(this.isInitialized(),this.pairings.values)),G(this,"disconnect",async n=>{this.isInitialized(),await this.isValidDisconnect(n);const{topic:i}=n;this.pairings.keys.includes(i)&&(await this.sendRequest(i,"wc_pairingDelete",ae("USER_DISCONNECTED")),await this.deletePairing(i))}),G(this,"formatUriFromPairing",n=>{this.isInitialized();const{topic:i,relay:s,expiry:o,methods:c}=n,l=this.core.crypto.keychain.get(i);return Ua({protocol:this.core.protocol,version:this.core.version,topic:i,symKey:l,relay:s,expiryTimestamp:o,methods:c})}),G(this,"sendRequest",async(n,i,s)=>{const o=Ut(i,s),c=await this.core.crypto.encode(n,o),l=qr[i].req;return this.core.history.set(n,o),this.core.relayer.publish(n,c,l),o.id}),G(this,"sendResult",async(n,i,s)=>{const o=Bn(n,s),c=await this.core.crypto.encode(i,o),l=(await this.core.history.get(i,n)).request.method,u=qr[l].res;await this.core.relayer.publish(i,c,u),await this.core.history.resolve(o)}),G(this,"sendError",async(n,i,s)=>{const o=Bc(n,s),c=await this.core.crypto.encode(i,o),l=(await this.core.history.get(i,n)).request.method,u=qr[l]?qr[l].res:qr.unregistered_method.res;await this.core.relayer.publish(i,c,u),await this.core.history.resolve(o)}),G(this,"deletePairing",async(n,i)=>{await this.core.relayer.unsubscribe(n),await Promise.all([this.pairings.delete(n,ae("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(n),i?Promise.resolve():this.core.expirer.del(n)])}),G(this,"cleanup",async()=>{const n=this.pairings.getAll().filter(i=>qt(i.expiry));await Promise.all(n.map(i=>this.deletePairing(i.topic)))}),G(this,"onRelayEventRequest",async n=>{const{topic:i,payload:s}=n;switch(s.method){case"wc_pairingPing":return await this.onPairingPingRequest(i,s);case"wc_pairingDelete":return await this.onPairingDeleteRequest(i,s);default:return await this.onUnknownRpcMethodRequest(i,s)}}),G(this,"onRelayEventResponse",async n=>{const{topic:i,payload:s}=n,o=(await this.core.history.get(i,s.id)).request.method;switch(o){case"wc_pairingPing":return this.onPairingPingResponse(i,s);default:return this.onUnknownRpcMethodResponse(o)}}),G(this,"onPairingPingRequest",async(n,i)=>{const{id:s}=i;try{this.isValidPing({topic:n}),await this.sendResult(s,n,!0),this.events.emit(Qt.ping,{id:s,topic:n})}catch(o){await this.sendError(s,n,o),this.logger.error(o)}}),G(this,"onPairingPingResponse",(n,i)=>{const{id:s}=i;setTimeout(()=>{bt(i)?this.events.emit(ee("pairing_ping",s),{}):_t(i)&&this.events.emit(ee("pairing_ping",s),{error:i.error})},500)}),G(this,"onPairingDeleteRequest",async(n,i)=>{const{id:s}=i;try{this.isValidDisconnect({topic:n}),await this.deletePairing(n),this.events.emit(Qt.delete,{id:s,topic:n})}catch(o){await this.sendError(s,n,o),this.logger.error(o)}}),G(this,"onUnknownRpcMethodRequest",async(n,i)=>{const{id:s,method:o}=i;try{if(this.registeredMethods.includes(o))return;const c=ae("WC_METHOD_UNSUPPORTED",o);await this.sendError(s,n,c),this.logger.error(c)}catch(c){await this.sendError(s,n,c),this.logger.error(c)}}),G(this,"onUnknownRpcMethodResponse",n=>{this.registeredMethods.includes(n)||this.logger.error(ae("WC_METHOD_UNSUPPORTED",n))}),G(this,"isValidPair",(n,i)=>{var s;if(!Ne(n)){const{message:c}=U("MISSING_OR_INVALID",`pair() params: ${n}`);throw i.setError(At.malformed_pairing_uri),new Error(c)}if(!Fw(n.uri)){const{message:c}=U("MISSING_OR_INVALID",`pair() uri: ${n.uri}`);throw i.setError(At.malformed_pairing_uri),new Error(c)}const o=Na(n==null?void 0:n.uri);if(!((s=o==null?void 0:o.relay)!=null&&s.protocol)){const{message:c}=U("MISSING_OR_INVALID","pair() uri#relay-protocol");throw i.setError(At.malformed_pairing_uri),new Error(c)}if(!(o!=null&&o.symKey)){const{message:c}=U("MISSING_OR_INVALID","pair() uri#symKey");throw i.setError(At.malformed_pairing_uri),new Error(c)}if(o!=null&&o.expiryTimestamp&&q.toMiliseconds(o==null?void 0:o.expiryTimestamp)<Date.now()){i.setError(At.pairing_expired);const{message:c}=U("EXPIRED","pair() URI has expired. Please try again with a new connection URI.");throw new Error(c)}}),G(this,"isValidPing",async n=>{if(!Ne(n)){const{message:s}=U("MISSING_OR_INVALID",`ping() params: ${n}`);throw new Error(s)}const{topic:i}=n;await this.isValidPairingTopic(i)}),G(this,"isValidDisconnect",async n=>{if(!Ne(n)){const{message:s}=U("MISSING_OR_INVALID",`disconnect() params: ${n}`);throw new Error(s)}const{topic:i}=n;await this.isValidPairingTopic(i)}),G(this,"isValidPairingTopic",async n=>{if(!he(n,!1)){const{message:i}=U("MISSING_OR_INVALID",`pairing topic should be a string: ${n}`);throw new Error(i)}if(!this.pairings.keys.includes(n)){const{message:i}=U("NO_MATCHING_KEY",`pairing topic doesn't exist: ${n}`);throw new Error(i)}if(qt(this.pairings.get(n).expiry)){await this.deletePairing(n);const{message:i}=U("EXPIRED",`pairing topic: ${n}`);throw new Error(i)}}),this.core=t,this.logger=Ce(e,this.name),this.pairings=new pr(this.core,this.logger,this.name,this.storagePrefix)}get context(){return Ke(this.logger)}isInitialized(){if(!this.initialized){const{message:t}=U("NOT_INITIALIZED",this.name);throw new Error(t)}}registerRelayerEvents(){this.core.relayer.on(le.message,async t=>{const{topic:e,message:n,transportType:i}=t;if(this.pairings.keys.includes(e)&&i!==se.link_mode&&!this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(n)))try{const s=await this.core.crypto.decode(e,n);qs(s)?(this.core.history.set(e,s),await this.onRelayEventRequest({topic:e,payload:s})):Ms(s)&&(await this.core.history.resolve(s),await this.onRelayEventResponse({topic:e,payload:s}),this.core.history.delete(e,s.id)),await this.core.relayer.messages.ack(e,n)}catch(s){this.logger.error(s)}})}registerExpirerEvents(){this.core.expirer.on(Ye.expired,async t=>{const{topic:e}=Vl(t.target);e&&this.pairings.keys.includes(e)&&(await this.deletePairing(e,!0),this.events.emit(Qt.expire,{topic:e}))})}}var Kv=Object.defineProperty,Fv=(r,t,e)=>t in r?Kv(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,be=(r,t,e)=>Fv(r,typeof t!="symbol"?t+"":t,e);class Wv extends s_{constructor(t,e){super(t,e),this.core=t,this.logger=e,be(this,"records",new Map),be(this,"events",new ur.EventEmitter),be(this,"name",Gg),be(this,"version",Jg),be(this,"cached",[]),be(this,"initialized",!1),be(this,"storagePrefix",wt),be(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)}),be(this,"set",(n,i,s)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:n,request:i,chainId:s}),this.records.has(i.id))return;const o={id:i.id,topic:n,request:{method:i.method,params:i.params||null},chainId:s,expiry:_e(q.THIRTY_DAYS)};this.records.set(o.id,o),this.persist(),this.events.emit(nt.created,o)}),be(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 i=await this.getRecord(n.id);typeof i.response>"u"&&(i.response=_t(n)?{error:n.error}:{result:n.result},this.records.set(i.id,i),this.persist(),this.events.emit(nt.updated,i))}),be(this,"get",async(n,i)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:n,id:i}),await this.getRecord(i))),be(this,"delete",(n,i)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:i}),this.values.forEach(s=>{if(s.topic===n){if(typeof i<"u"&&s.id!==i)return;this.records.delete(s.id),this.events.emit(nt.deleted,s)}}),this.persist()}),be(this,"exists",async(n,i)=>(this.isInitialized(),this.records.has(i)?(await this.getRecord(i)).topic===n:!1)),be(this,"on",(n,i)=>{this.events.on(n,i)}),be(this,"once",(n,i)=>{this.events.once(n,i)}),be(this,"off",(n,i)=>{this.events.off(n,i)}),be(this,"removeListener",(n,i)=>{this.events.removeListener(n,i)}),this.logger=Ce(e,this.name)}get context(){return Ke(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 t=[];return this.values.forEach(e=>{if(typeof e.response<"u")return;const n={topic:e.topic,request:Ut(e.request.method,e.request.params,e.id),chainId:e.chainId};return t.push(n)}),t}async setJsonRpcRecords(t){await this.core.storage.setItem(this.storageKey,t)}async getJsonRpcRecords(){return await this.core.storage.getItem(this.storageKey)}getRecord(t){this.isInitialized();const e=this.records.get(t);if(!e){const{message:n}=U("NO_MATCHING_KEY",`${this.name}: ${t}`);throw new Error(n)}return e}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(nt.sync)}async restore(){try{const t=await this.getJsonRpcRecords();if(typeof t>"u"||!t.length)return;if(this.records.size){const{message:e}=U("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),new Error(e)}this.cached=t,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",records:this.values})}catch(t){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(t)}}registerEventListeners(){this.events.on(nt.created,t=>{const e=nt.created;this.logger.info(`Emitting ${e}`),this.logger.debug({type:"event",event:e,record:t})}),this.events.on(nt.updated,t=>{const e=nt.updated;this.logger.info(`Emitting ${e}`),this.logger.debug({type:"event",event:e,record:t})}),this.events.on(nt.deleted,t=>{const e=nt.deleted;this.logger.info(`Emitting ${e}`),this.logger.debug({type:"event",event:e,record:t})}),this.core.heartbeat.on(Pr.pulse,()=>{this.cleanup()})}cleanup(){try{this.isInitialized();let t=!1;this.records.forEach(e=>{q.toMiliseconds(e.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${e.id}`),this.records.delete(e.id),this.events.emit(nt.deleted,e,!1),t=!0)}),t&&this.persist()}catch(t){this.logger.warn(t)}}isInitialized(){if(!this.initialized){const{message:t}=U("NOT_INITIALIZED",this.name);throw new Error(t)}}}var Hv=Object.defineProperty,Gv=(r,t,e)=>t in r?Hv(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Re=(r,t,e)=>Gv(r,typeof t!="symbol"?t+"":t,e);class Jv extends d_{constructor(t,e){super(t,e),this.core=t,this.logger=e,Re(this,"expirations",new Map),Re(this,"events",new ur.EventEmitter),Re(this,"name",Zg),Re(this,"version",Yg),Re(this,"cached",[]),Re(this,"initialized",!1),Re(this,"storagePrefix",wt),Re(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)}),Re(this,"has",n=>{try{const i=this.formatTarget(n);return typeof this.getExpiration(i)<"u"}catch{return!1}}),Re(this,"set",(n,i)=>{this.isInitialized();const s=this.formatTarget(n),o={target:s,expiry:i};this.expirations.set(s,o),this.checkExpiry(s,o),this.events.emit(Ye.created,{target:s,expiration:o})}),Re(this,"get",n=>{this.isInitialized();const i=this.formatTarget(n);return this.getExpiration(i)}),Re(this,"del",n=>{if(this.isInitialized(),this.has(n)){const i=this.formatTarget(n),s=this.getExpiration(i);this.expirations.delete(i),this.events.emit(Ye.deleted,{target:i,expiration:s})}}),Re(this,"on",(n,i)=>{this.events.on(n,i)}),Re(this,"once",(n,i)=>{this.events.once(n,i)}),Re(this,"off",(n,i)=>{this.events.off(n,i)}),Re(this,"removeListener",(n,i)=>{this.events.removeListener(n,i)}),this.logger=Ce(e,this.name)}get context(){return Ke(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(t){if(typeof t=="string")return Rf(t);if(typeof t=="number")return Lf(t);const{message:e}=U("UNKNOWN_TYPE",`Target type: ${typeof t}`);throw new Error(e)}async setExpirations(t){await this.core.storage.setItem(this.storageKey,t)}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit(Ye.sync)}async restore(){try{const t=await this.getExpirations();if(typeof t>"u"||!t.length)return;if(this.expirations.size){const{message:e}=U("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),new Error(e)}this.cached=t,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values})}catch(t){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(t)}}getExpiration(t){const e=this.expirations.get(t);if(!e){const{message:n}=U("NO_MATCHING_KEY",`${this.name}: ${t}`);throw this.logger.warn(n),new Error(n)}return e}checkExpiry(t,e){const{expiry:n}=e;q.toMiliseconds(n)-Date.now()<=0&&this.expire(t,e)}expire(t,e){this.expirations.delete(t),this.events.emit(Ye.expired,{target:t,expiration:e})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((t,e)=>this.checkExpiry(e,t))}registerEventListeners(){this.core.heartbeat.on(Pr.pulse,()=>this.checkExpirations()),this.events.on(Ye.created,t=>{const e=Ye.created;this.logger.info(`Emitting ${e}`),this.logger.debug({type:"event",event:e,data:t}),this.persist()}),this.events.on(Ye.expired,t=>{const e=Ye.expired;this.logger.info(`Emitting ${e}`),this.logger.debug({type:"event",event:e,data:t}),this.persist()}),this.events.on(Ye.deleted,t=>{const e=Ye.deleted;this.logger.info(`Emitting ${e}`),this.logger.debug({type:"event",event:e,data:t}),this.persist()})}isInitialized(){if(!this.initialized){const{message:t}=U("NOT_INITIALIZED",this.name);throw new Error(t)}}}var Zv=Object.defineProperty,Yv=(r,t,e)=>t in r?Zv(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,de=(r,t,e)=>Yv(r,typeof t!="symbol"?t+"":t,e);class Qv extends h_{constructor(t,e,n){super(t,e,n),this.core=t,this.logger=e,this.store=n,de(this,"name",Qg),de(this,"abortController"),de(this,"isDevEnv"),de(this,"verifyUrlV3",eE),de(this,"storagePrefix",wt),de(this,"version",Pu),de(this,"publicKey"),de(this,"fetchPromise"),de(this,"init",async()=>{var i;this.isDevEnv||(this.publicKey=await this.store.getItem(this.storeKey),this.publicKey&&q.toMiliseconds((i=this.publicKey)==null?void 0:i.expiresAt)<Date.now()&&(this.logger.debug("verify v2 public key expired"),await this.removePublicKey()))}),de(this,"register",async i=>{if(!Dr()||this.isDevEnv)return;const s=window.location.origin,{id:o,decryptedId:c}=i,l=`${this.verifyUrlV3}/attestation?projectId=${this.core.projectId}&origin=${s}&id=${o}&decryptedId=${c}`;try{const u=Rt.getDocument(),d=this.startAbortTimer(q.ONE_SECOND*5),h=await new Promise((p,_)=>{const f=()=>{window.removeEventListener("message",y),u.body.removeChild(m),_("attestation aborted")};this.abortController.signal.addEventListener("abort",f);const m=u.createElement("iframe");m.src=l,m.style.display="none",m.addEventListener("error",f,{signal:this.abortController.signal});const y=b=>{if(b.data&&typeof b.data=="string")try{const O=JSON.parse(b.data);if(O.type==="verify_attestation"){if(Ji(O.attestation).payload.id!==o)return;clearInterval(d),u.body.removeChild(m),this.abortController.signal.removeEventListener("abort",f),window.removeEventListener("message",y),p(O.attestation===null?"":O.attestation)}}catch(O){this.logger.warn(O)}};u.body.appendChild(m),window.addEventListener("message",y,{signal:this.abortController.signal})});return this.logger.debug("jwt attestation",h),h}catch(u){this.logger.warn(u)}return""}),de(this,"resolve",async i=>{if(this.isDevEnv)return"";const{attestationId:s,hash:o,encryptedId:c}=i;if(s===""){this.logger.debug("resolve: attestationId is empty, skipping");return}if(s){if(Ji(s).payload.id!==c)return;const u=await this.isValidJwtAttestation(s);if(u){if(!u.isVerified){this.logger.warn("resolve: jwt attestation: origin url not verified");return}return u}}if(!o)return;const l=this.getVerifyUrl(i==null?void 0:i.verifyUrl);return this.fetchAttestation(o,l)}),de(this,"fetchAttestation",async(i,s)=>{this.logger.debug(`resolving attestation: ${i} from url: ${s}`);const o=this.startAbortTimer(q.ONE_SECOND*5),c=await fetch(`${s}/attestation/${i}?v2Supported=true`,{signal:this.abortController.signal});return clearTimeout(o),c.status===200?await c.json():void 0}),de(this,"getVerifyUrl",i=>{let s=i||Xr;return tE.includes(s)||(this.logger.info(`verify url: ${s}, not included in trusted list, assigning default: ${Xr}`),s=Xr),s}),de(this,"fetchPublicKey",async()=>{try{this.logger.debug(`fetching public key from: ${this.verifyUrlV3}`);const i=this.startAbortTimer(q.FIVE_SECONDS),s=await fetch(`${this.verifyUrlV3}/public-key`,{signal:this.abortController.signal});return clearTimeout(i),await s.json()}catch(i){this.logger.warn(i)}}),de(this,"persistPublicKey",async i=>{this.logger.debug("persisting public key to local storage",i),await this.store.setItem(this.storeKey,i),this.publicKey=i}),de(this,"removePublicKey",async()=>{this.logger.debug("removing verify v2 public key from storage"),await this.store.removeItem(this.storeKey),this.publicKey=void 0}),de(this,"isValidJwtAttestation",async i=>{const s=await this.getPublicKey();try{if(s)return this.validateAttestation(i,s)}catch(c){this.logger.error(c),this.logger.warn("error validating attestation")}const o=await this.fetchAndPersistPublicKey();try{if(o)return this.validateAttestation(i,o)}catch(c){this.logger.error(c),this.logger.warn("error validating attestation")}}),de(this,"getPublicKey",async()=>this.publicKey?this.publicKey:await this.fetchAndPersistPublicKey()),de(this,"fetchAndPersistPublicKey",async()=>{if(this.fetchPromise)return await this.fetchPromise,this.publicKey;this.fetchPromise=new Promise(async s=>{const o=await this.fetchPublicKey();o&&(await this.persistPublicKey(o),s(o))});const i=await this.fetchPromise;return this.fetchPromise=void 0,i}),de(this,"validateAttestation",(i,s)=>{const o=Iw(i,s.publicKey),c={hasExpired:q.toMiliseconds(o.exp)<Date.now(),payload:o};if(c.hasExpired)throw this.logger.warn("resolve: jwt attestation expired"),new Error("JWT attestation expired");return{origin:c.payload.origin,isScam:c.payload.isScam,isVerified:c.payload.isVerified}}),this.logger=Ce(e,this.name),this.abortController=new AbortController,this.isDevEnv=eo(),this.init()}get storeKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//verify:public:key"}get context(){return Ke(this.logger)}startAbortTimer(t){return this.abortController=new AbortController,setTimeout(()=>this.abortController.abort(),q.toMiliseconds(t))}}var Xv=Object.defineProperty,eb=(r,t,e)=>t in r?Xv(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,_c=(r,t,e)=>eb(r,typeof t!="symbol"?t+"":t,e);class tb extends p_{constructor(t,e){super(t,e),this.projectId=t,this.logger=e,_c(this,"context",rE),_c(this,"registerDeviceToken",async n=>{const{clientId:i,token:s,notificationType:o,enableEncrypted:c=!1}=n,l=`${nE}/${this.projectId}/clients`;await fetch(l,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:i,type:o,token:s,always_raw:c})})}),this.logger=Ce(e,this.context)}}var rb=Object.defineProperty,fc=Object.getOwnPropertySymbols,nb=Object.prototype.hasOwnProperty,ib=Object.prototype.propertyIsEnumerable,Os=(r,t,e)=>t in r?rb(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,zr=(r,t)=>{for(var e in t||(t={}))nb.call(t,e)&&Os(r,e,t[e]);if(fc)for(var e of fc(t))ib.call(t,e)&&Os(r,e,t[e]);return r},me=(r,t,e)=>Os(r,typeof t!="symbol"?t+"":t,e);class sb extends __{constructor(t,e,n=!0){super(t,e,n),this.core=t,this.logger=e,me(this,"context",sE),me(this,"storagePrefix",wt),me(this,"storageVersion",iE),me(this,"events",new Map),me(this,"shouldPersist",!1),me(this,"init",async()=>{if(!eo())try{const i={eventId:sa(),timestamp:Date.now(),domain:this.getAppDomain(),props:{event:"INIT",type:"",properties:{client_id:await this.core.crypto.getClientId(),user_agent:Ll(this.core.relayer.protocol,this.core.relayer.version,gs)}}};await this.sendEvent([i])}catch(i){this.logger.warn(i)}}),me(this,"createEvent",i=>{const{event:s="ERROR",type:o="",properties:{topic:c,trace:l}}=i,u=sa(),d=this.core.projectId||"",h=Date.now(),p=zr({eventId:u,timestamp:h,props:{event:s,type:o,properties:{topic:c,trace:l}},bundleId:d,domain:this.getAppDomain()},this.setMethods(u));return this.telemetryEnabled&&(this.events.set(u,p),this.shouldPersist=!0),p}),me(this,"getEvent",i=>{const{eventId:s,topic:o}=i;if(s)return this.events.get(s);const c=Array.from(this.events.values()).find(l=>l.props.properties.topic===o);if(c)return zr(zr({},c),this.setMethods(c.eventId))}),me(this,"deleteEvent",i=>{const{eventId:s}=i;this.events.delete(s),this.shouldPersist=!0}),me(this,"setEventListeners",()=>{this.core.heartbeat.on(Pr.pulse,async()=>{this.shouldPersist&&await this.persist(),this.events.forEach(i=>{q.fromMiliseconds(Date.now())-q.fromMiliseconds(i.timestamp)>oE&&(this.events.delete(i.eventId),this.shouldPersist=!0)})})}),me(this,"setMethods",i=>({addTrace:s=>this.addTrace(i,s),setError:s=>this.setError(i,s)})),me(this,"addTrace",(i,s)=>{const o=this.events.get(i);o&&(o.props.properties.trace.push(s),this.events.set(i,o),this.shouldPersist=!0)}),me(this,"setError",(i,s)=>{const o=this.events.get(i);o&&(o.props.type=s,o.timestamp=Date.now(),this.events.set(i,o),this.shouldPersist=!0)}),me(this,"persist",async()=>{await this.core.storage.setItem(this.storageKey,Array.from(this.events.values())),this.shouldPersist=!1}),me(this,"restore",async()=>{try{const i=await this.core.storage.getItem(this.storageKey)||[];if(!i.length)return;i.forEach(s=>{this.events.set(s.eventId,zr(zr({},s),this.setMethods(s.eventId)))})}catch(i){this.logger.warn(i)}}),me(this,"submit",async()=>{if(!this.telemetryEnabled||this.events.size===0)return;const i=[];for(const[s,o]of this.events)o.props.type&&i.push(o);if(i.length!==0)try{if((await this.sendEvent(i)).ok)for(const s of i)this.events.delete(s.eventId),this.shouldPersist=!0}catch(s){this.logger.warn(s)}}),me(this,"sendEvent",async i=>{const s=this.getAppDomain()?"":"&sp=desktop";return await fetch(`${aE}?projectId=${this.core.projectId}&st=events_sdk&sv=js-${gs}${s}`,{method:"POST",body:JSON.stringify(i)})}),me(this,"getAppDomain",()=>Rl().url),this.logger=Ce(e,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 ob=Object.defineProperty,mc=Object.getOwnPropertySymbols,ab=Object.prototype.hasOwnProperty,cb=Object.prototype.propertyIsEnumerable,Rs=(r,t,e)=>t in r?ob(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,yc=(r,t)=>{for(var e in t||(t={}))ab.call(t,e)&&Rs(r,e,t[e]);if(mc)for(var e of mc(t))cb.call(t,e)&&Rs(r,e,t[e]);return r},ie=(r,t,e)=>Rs(r,typeof t!="symbol"?t+"":t,e);class fo extends t_{constructor(t){var e;super(t),ie(this,"protocol",Tu),ie(this,"version",Pu),ie(this,"name",ws),ie(this,"relayUrl"),ie(this,"projectId"),ie(this,"customStoragePrefix"),ie(this,"events",new ur.EventEmitter),ie(this,"logger"),ie(this,"heartbeat"),ie(this,"relayer"),ie(this,"crypto"),ie(this,"storage"),ie(this,"history"),ie(this,"expirer"),ie(this,"pairing"),ie(this,"verify"),ie(this,"echoClient"),ie(this,"linkModeSupportedApps"),ie(this,"eventClient"),ie(this,"initialized",!1),ie(this,"logChunkController"),ie(this,"on",(c,l)=>this.events.on(c,l)),ie(this,"once",(c,l)=>this.events.once(c,l)),ie(this,"off",(c,l)=>this.events.off(c,l)),ie(this,"removeListener",(c,l)=>this.events.removeListener(c,l)),ie(this,"dispatchEnvelope",({topic:c,message:l,sessionExists:u})=>{if(!c||!l)return;const d={topic:c,message:l,publishedAt:Date.now(),transportType:se.link_mode};this.relayer.onLinkMessageEvent(d,{sessionExists:u})});const n=this.getGlobalCore(t==null?void 0:t.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(c){console.warn("Failed to copy global core",c)}this.projectId=t==null?void 0:t.projectId,this.relayUrl=(t==null?void 0:t.relayUrl)||Ru,this.customStoragePrefix=t!=null&&t.customStoragePrefix?`:${t.customStoragePrefix}`:"";const i=Qs({level:typeof(t==null?void 0:t.logger)=="string"&&t.logger?t.logger:Rg.logger,name:ws}),{logger:s,chunkLoggerController:o}=Qp({opts:i,maxSizeInBytes:t==null?void 0:t.maxLogBlobSizeInBytes,loggerOverride:t==null?void 0:t.logger});this.logChunkController=o,(e=this.logChunkController)!=null&&e.downloadLogsBlobInBrowser&&(window.downloadLogsBlobInBrowser=async()=>{var c,l;(c=this.logChunkController)!=null&&c.downloadLogsBlobInBrowser&&((l=this.logChunkController)==null||l.downloadLogsBlobInBrowser({clientId:await this.crypto.getClientId()}))}),this.logger=Ce(s,this.name),this.heartbeat=new th,this.crypto=new k0(this,this.logger,t==null?void 0:t.keychain),this.history=new Wv(this,this.logger),this.expirer=new Jv(this,this.logger),this.storage=t!=null&&t.storage?t.storage:new kp(yc(yc({},Lg),t==null?void 0:t.storageOptions)),this.relayer=new lv({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new zv(this,this.logger),this.verify=new Qv(this,this.logger,this.storage),this.echoClient=new tb(this.projectId||"",this.logger),this.linkModeSupportedApps=[],this.eventClient=new sb(this,this.logger,t==null?void 0:t.telemetryEnabled),this.setGlobalCore(this)}static async init(t){const e=new fo(t);await e.initialize();const n=await e.crypto.getClientId();return await e.storage.setItem(zg,n),e}get context(){return Ke(this.logger)}async start(){this.initialized||await this.initialize()}async getLogsBlob(){var t;return(t=this.logChunkController)==null?void 0:t.logsToBlob({clientId:await this.crypto.getClientId()})}async addLinkModeSupportedApp(t){this.linkModeSupportedApps.includes(t)||(this.linkModeSupportedApps.push(t),await this.storage.setItem(Ja,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(Ja)||[],this.initialized=!0,this.logger.info("Core Initialization Success")}catch(t){throw this.logger.warn(`Core Initialization Failure at epoch ${Date.now()}`,t),this.logger.error(t.message),t}}getGlobalCore(t=""){try{if(this.isGlobalCoreDisabled())return;const e=`_walletConnectCore_${t}`,n=`${e}_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[e]}catch(e){console.warn("Failed to get global WalletConnect core",e);return}}setGlobalCore(t){var e;try{if(this.isGlobalCoreDisabled())return;const n=`_walletConnectCore_${((e=t.opts)==null?void 0:e.customStoragePrefix)||""}`;globalThis[n]=t}catch(n){console.warn("Failed to set global WalletConnect core",n)}}isGlobalCoreDisabled(){try{return typeof Kt<"u"&&Og.DISABLE_GLOBAL_CORE==="true"}catch{return!0}}}const lb=fo;var it={};const Bu="wc",ju=2,zu="client",mo=`${Bu}@${ju}:${zu}:`,qi={name:zu,logger:"error"},wc="WALLETCONNECT_DEEPLINK_CHOICE",ub="proposal",gc="Proposal expired",db="session",gr=q.SEVEN_DAYS,hb="engine",Ie={wc_sessionPropose:{req:{ttl:q.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:q.FIVE_MINUTES,prompt:!1,tag:1101},reject:{ttl:q.FIVE_MINUTES,prompt:!1,tag:1120},autoReject:{ttl:q.FIVE_MINUTES,prompt:!1,tag:1121}},wc_sessionSettle:{req:{ttl:q.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:q.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:q.ONE_DAY,prompt:!1,tag:1104},res:{ttl:q.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:q.ONE_DAY,prompt:!1,tag:1106},res:{ttl:q.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:q.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:q.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:q.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:q.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:q.ONE_DAY,prompt:!1,tag:1112},res:{ttl:q.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:q.ONE_DAY,prompt:!1,tag:1114},res:{ttl:q.ONE_DAY,prompt:!1,tag:1115}},wc_sessionAuthenticate:{req:{ttl:q.ONE_HOUR,prompt:!0,tag:1116},res:{ttl:q.ONE_HOUR,prompt:!1,tag:1117},reject:{ttl:q.FIVE_MINUTES,prompt:!1,tag:1118},autoReject:{ttl:q.FIVE_MINUTES,prompt:!1,tag:1119}}},Mi={min:q.FIVE_MINUTES,max:q.SEVEN_DAYS},ht={idle:"IDLE",active:"ACTIVE"},pb={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:""}},_b="request",fb=["wc_sessionPropose","wc_sessionRequest","wc_authRequest","wc_sessionAuthenticate"],mb="wc",yb="auth",wb="authKeys",gb="pairingTopics",Eb="requests",fi=`${mb}@${1.5}:${yb}:`,Nn=`${fi}:PUB_KEY`;var vb=Object.defineProperty,bb=Object.defineProperties,Ib=Object.getOwnPropertyDescriptors,Ec=Object.getOwnPropertySymbols,Ab=Object.prototype.hasOwnProperty,Tb=Object.prototype.propertyIsEnumerable,Ls=(r,t,e)=>t in r?vb(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,te=(r,t)=>{for(var e in t||(t={}))Ab.call(t,e)&&Ls(r,e,t[e]);if(Ec)for(var e of Ec(t))Tb.call(t,e)&&Ls(r,e,t[e]);return r},Le=(r,t)=>bb(r,Ib(t)),x=(r,t,e)=>Ls(r,typeof t!="symbol"?t+"":t,e);class Pb extends w_{constructor(t){super(t),x(this,"name",hb),x(this,"events",new Mc),x(this,"initialized",!1),x(this,"requestQueue",{state:ht.idle,queue:[]}),x(this,"sessionRequestQueue",{state:ht.idle,queue:[]}),x(this,"emittedSessionRequests",new Uf({limit:500})),x(this,"requestQueueDelay",q.ONE_SECOND),x(this,"expectedPairingMethodMap",new Map),x(this,"recentlyDeletedMap",new Map),x(this,"recentlyDeletedLimit",200),x(this,"relayMessageCache",[]),x(this,"pendingSessions",new Map),x(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(Ie)}),this.initialized=!0,setTimeout(async()=>{await this.processPendingMessageEvents(),this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()},q.toMiliseconds(this.requestQueueDelay)))}),x(this,"connect",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();const n=Le(te({},e),{requiredNamespaces:e.requiredNamespaces||{},optionalNamespaces:e.optionalNamespaces||{}});await this.isValidConnect(n),n.optionalNamespaces=Mw(n.requiredNamespaces,n.optionalNamespaces),n.requiredNamespaces={};const{pairingTopic:i,requiredNamespaces:s,optionalNamespaces:o,sessionProperties:c,scopedProperties:l,relays:u}=n;let d=i,h,p=!1;try{if(d){const E=this.client.core.pairing.pairings.get(d);this.client.logger.warn("connect() with existing pairing topic is deprecated and will be removed in the next major release."),p=E.active}}catch(E){throw this.client.logger.error(`connect() -> pairing.get(${d}) failed`),E}if(!d||!p){const{topic:E,uri:D}=await this.client.core.pairing.create({internal:{skipSubscribe:!0}});d=E,h=D}if(!d){const{message:E}=U("NO_MATCHING_KEY",`connect() pairing topic: ${d}`);throw new Error(E)}const _=await this.client.core.crypto.generateKeyPair(),f=Ie.wc_sessionPropose.req.ttl||q.FIVE_MINUTES,m=_e(f),y=Le(te(te({requiredNamespaces:s,optionalNamespaces:o,relays:u??[{protocol:Ou}],proposer:{publicKey:_,metadata:this.client.metadata},expiryTimestamp:m,pairingTopic:d},c&&{sessionProperties:c}),l&&{scopedProperties:l}),{id:Dt()}),b=ee("session_connect",y.id),{reject:O,resolve:g,done:P}=Yt(f,gc),A=({id:E})=>{E===y.id&&(this.client.events.off("proposal_expire",A),this.pendingSessions.delete(y.id),this.events.emit(b,{error:{message:gc,code:0}}))};return this.client.events.on("proposal_expire",A),this.events.once(b,({error:E,session:D})=>{this.client.events.off("proposal_expire",A),E?O(E):D&&g(D)}),await this.sendProposeSession({proposal:y,publishOpts:{internal:{throwOnFailedPublish:!0},tvf:{correlationId:y.id}}}),await this.setProposal(y.id,y),{uri:h,approval:P}}),x(this,"pair",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{return await this.client.core.pairing.pair(e)}catch(n){throw this.client.logger.error("pair() failed"),n}}),x(this,"approve",async e=>{var n,i,s;const o=this.client.core.eventClient.createEvent({properties:{topic:(n=e==null?void 0:e.id)==null?void 0:n.toString(),trace:[Nt.session_approve_started]}});try{this.isInitialized(),await this.confirmOnlineStateOrThrow()}catch(w){throw o.setError(Mr.no_internet_connection),w}try{await this.isValidProposalId(e==null?void 0:e.id)}catch(w){throw this.client.logger.error(`approve() -> proposal.get(${e==null?void 0:e.id}) failed`),o.setError(Mr.proposal_not_found),w}try{await this.isValidApprove(e)}catch(w){throw this.client.logger.error("approve() -> isValidApprove() failed"),o.setError(Mr.session_approve_namespace_validation_failure),w}const{id:c,relayProtocol:l,namespaces:u,sessionProperties:d,scopedProperties:h,sessionConfig:p}=e,_=this.client.proposal.get(c);this.client.core.eventClient.deleteEvent({eventId:o.eventId});const{pairingTopic:f,proposer:m,requiredNamespaces:y,optionalNamespaces:b}=_;let O=(i=this.client.core.eventClient)==null?void 0:i.getEvent({topic:f});O||(O=(s=this.client.core.eventClient)==null?void 0:s.createEvent({type:Nt.session_approve_started,properties:{topic:f,trace:[Nt.session_approve_started,Nt.session_namespaces_validation_success]}}));const g=await this.client.core.crypto.generateKeyPair(),P=m.publicKey,A=await this.client.core.crypto.generateSharedKey(g,P),E=te(te(te({relay:{protocol:l??"irn"},namespaces:u,controller:{publicKey:g,metadata:this.client.metadata},expiry:_e(gr)},d&&{sessionProperties:d}),h&&{scopedProperties:h}),p&&{sessionConfig:p}),D=se.relay;O.addTrace(Nt.subscribing_session_topic);try{await this.client.core.relayer.subscribe(A,{transportType:D,internal:{skipSubscribe:!0}})}catch(w){throw O.setError(Mr.subscribe_session_topic_failure),w}O.addTrace(Nt.subscribe_session_topic_success);const L=Le(te({},E),{topic:A,requiredNamespaces:y,optionalNamespaces:b,pairingTopic:f,acknowledged:!1,self:E.controller,peer:{publicKey:m.publicKey,metadata:m.metadata},controller:g,transportType:se.relay});await this.client.session.set(A,L),O.addTrace(Nt.store_session);try{await this.sendApproveSession({sessionTopic:A,proposal:_,pairingProposalResponse:{relay:{protocol:l??"irn"},responderPublicKey:g},sessionSettleRequest:E,publishOpts:{internal:{throwOnFailedPublish:!0},tvf:{correlationId:c}}}),O.addTrace(Nt.session_approve_publish_success)}catch(w){throw this.client.logger.error(w),this.client.session.delete(A,ae("USER_DISCONNECTED")),await this.client.core.relayer.unsubscribe(A),w}return this.client.core.eventClient.deleteEvent({eventId:O.eventId}),await this.client.core.pairing.updateMetadata({topic:f,metadata:m.metadata}),await this.deleteProposal(c),await this.client.core.pairing.activate({topic:f}),await this.setExpiry(A,_e(gr)),{topic:A,acknowledged:()=>Promise.resolve(this.client.session.get(A))}}),x(this,"reject",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidReject(e)}catch(o){throw this.client.logger.error("reject() -> isValidReject() failed"),o}const{id:n,reason:i}=e;let s;try{s=this.client.proposal.get(n).pairingTopic}catch(o){throw this.client.logger.error(`reject() -> proposal.get(${n}) failed`),o}s&&await this.sendError({id:n,topic:s,error:i,rpcOpts:Ie.wc_sessionPropose.reject}),await this.deleteProposal(n)}),x(this,"update",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidUpdate(e)}catch(h){throw this.client.logger.error("update() -> isValidUpdate() failed"),h}const{topic:n,namespaces:i}=e,{done:s,resolve:o,reject:c}=Yt(),l=Dt(),u=Xt().toString(),d=this.client.session.get(n).namespaces;return this.events.once(ee("session_update",l),({error:h})=>{h?c(h):o()}),await this.client.session.update(n,{namespaces:i}),await this.sendRequest({topic:n,method:"wc_sessionUpdate",params:{namespaces:i},throwOnFailedPublish:!0,clientRpcId:l,relayRpcId:u}).catch(h=>{this.client.logger.error(h),this.client.session.update(n,{namespaces:d}),c(h)}),{acknowledged:s}}),x(this,"extend",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidExtend(e)}catch(l){throw this.client.logger.error("extend() -> isValidExtend() failed"),l}const{topic:n}=e,i=Dt(),{done:s,resolve:o,reject:c}=Yt();return this.events.once(ee("session_extend",i),({error:l})=>{l?c(l):o()}),await this.setExpiry(n,_e(gr)),this.sendRequest({topic:n,method:"wc_sessionExtend",params:{},clientRpcId:i,throwOnFailedPublish:!0}).catch(l=>{c(l)}),{acknowledged:s}}),x(this,"request",async e=>{this.isInitialized();try{await this.isValidRequest(e)}catch(y){throw this.client.logger.error("request() -> isValidRequest() failed"),y}const{chainId:n,request:i,topic:s,expiry:o=Ie.wc_sessionRequest.req.ttl}=e,c=this.client.session.get(s);(c==null?void 0:c.transportType)===se.relay&&await this.confirmOnlineStateOrThrow();const l=Dt(),u=Xt().toString(),{done:d,resolve:h,reject:p}=Yt(o,"Request expired. Please try again.");this.events.once(ee("session_request",l),({error:y,result:b})=>{y?p(y):h(b)});const _="wc_sessionRequest",f=this.getAppLinkIfEnabled(c.peer.metadata,c.transportType);if(f)return await this.sendRequest({clientRpcId:l,relayRpcId:u,topic:s,method:_,params:{request:Le(te({},i),{expiryTimestamp:_e(o)}),chainId:n},expiry:o,throwOnFailedPublish:!0,appLink:f}).catch(y=>p(y)),this.client.events.emit("session_request_sent",{topic:s,request:i,chainId:n,id:l}),await d();const m={request:Le(te({},i),{expiryTimestamp:_e(o)}),chainId:n};return await Promise.all([new Promise(async y=>{await this.sendRequest({clientRpcId:l,relayRpcId:u,topic:s,method:_,params:m,expiry:o,throwOnFailedPublish:!0,tvf:this.getTVFParams(l,m)}).catch(b=>p(b)),this.client.events.emit("session_request_sent",{topic:s,request:i,chainId:n,id:l}),y()}),new Promise(async y=>{var b;if(!((b=c.sessionConfig)!=null&&b.disableDeepLink)){const O=await xf(this.client.core.storage,wc);await Df({id:l,topic:s,wcDeepLink:O})}y()}),d()]).then(y=>y[2])}),x(this,"respond",async e=>{this.isInitialized(),await this.isValidRespond(e);const{topic:n,response:i}=e,{id:s}=i,o=this.client.session.get(n);o.transportType===se.relay&&await this.confirmOnlineStateOrThrow();const c=this.getAppLinkIfEnabled(o.peer.metadata,o.transportType);bt(i)?await this.sendResult({id:s,topic:n,result:i.result,throwOnFailedPublish:!0,appLink:c}):_t(i)&&await this.sendError({id:s,topic:n,error:i.error,appLink:c}),this.cleanupAfterResponse(e)}),x(this,"ping",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidPing(e)}catch(i){throw this.client.logger.error("ping() -> isValidPing() failed"),i}const{topic:n}=e;if(this.client.session.keys.includes(n)){const i=Dt(),s=Xt().toString(),{done:o,resolve:c,reject:l}=Yt();this.events.once(ee("session_ping",i),({error:u})=>{u?l(u):c()}),await Promise.all([this.sendRequest({topic:n,method:"wc_sessionPing",params:{},throwOnFailedPublish:!0,clientRpcId:i,relayRpcId:s}),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}))}),x(this,"emit",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidEmit(e);const{topic:n,event:i,chainId:s}=e,o=Xt().toString(),c=Dt();await this.sendRequest({topic:n,method:"wc_sessionEvent",params:{event:i,chainId:s},throwOnFailedPublish:!0,relayRpcId:o,clientRpcId:c})}),x(this,"disconnect",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidDisconnect(e);const{topic:n}=e;if(this.client.session.keys.includes(n))await this.sendRequest({topic:n,method:"wc_sessionDelete",params:ae("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:i}=U("MISMATCHED_TOPIC",`Session or pairing topic not found: ${n}`);throw new Error(i)}}),x(this,"find",e=>(this.isInitialized(),this.client.session.getAll().filter(n=>zw(n,e)))),x(this,"getPendingSessionRequests",()=>this.client.pendingRequest.getAll()),x(this,"authenticate",async(e,n)=>{var i;this.isInitialized(),this.isValidAuthenticate(e);const s=n&&this.client.core.linkModeSupportedApps.includes(n)&&((i=this.client.metadata.redirect)==null?void 0:i.linkMode),o=s?se.link_mode:se.relay;o===se.relay&&await this.confirmOnlineStateOrThrow();const{chains:c,statement:l="",uri:u,domain:d,nonce:h,type:p,exp:_,nbf:f,methods:m=[],expiry:y}=e,b=[...e.resources||[]],{topic:O,uri:g}=await this.client.core.pairing.create({methods:["wc_sessionAuthenticate"],transportType:o});this.client.logger.info({message:"Generated new pairing",pairing:{topic:O,uri:g}});const P=await this.client.core.crypto.generateKeyPair(),A=$n(P);if(await Promise.all([this.client.auth.authKeys.set(Nn,{responseTopic:A,publicKey:P}),this.client.auth.pairingTopics.set(A,{topic:A,pairingTopic:O})]),await this.client.core.relayer.subscribe(A,{transportType:o}),this.client.logger.info(`sending request to new pairing topic: ${O}`),m.length>0){const{namespace:C}=xn(c[0]);let N=Jm(C,"request",m);Cn(b)&&(N=Ym(N,b.pop())),b.push(N)}const E=y&&y>Ie.wc_sessionAuthenticate.req.ttl?y:Ie.wc_sessionAuthenticate.req.ttl,D={authPayload:{type:p??"caip122",chains:c,statement:l,aud:u,domain:d,version:"1",nonce:h,iat:new Date().toISOString(),exp:_,nbf:f,resources:b},requester:{publicKey:P,metadata:this.client.metadata},expiryTimestamp:_e(E)},L={eip155:{chains:c,methods:[...new Set(["personal_sign",...m])],events:["chainChanged","accountsChanged"]}},w={requiredNamespaces:{},optionalNamespaces:L,relays:[{protocol:"irn"}],pairingTopic:O,proposer:{publicKey:P,metadata:this.client.metadata},expiryTimestamp:_e(Ie.wc_sessionPropose.req.ttl),id:Dt()},{done:v,resolve:I,reject:T}=Yt(E,"Request expired"),V=Dt(),R=ee("session_connect",w.id),S=ee("session_request",V),$=async({error:C,session:N})=>{this.events.off(S,k),C?T(C):N&&I({session:N})},k=async C=>{var N,j,z;if(await this.deletePendingAuthRequest(V,{message:"fulfilled",code:0}),C.error){const oe=ae("WC_METHOD_UNSUPPORTED","wc_sessionAuthenticate");return C.error.code===oe.code?void 0:(this.events.off(R,$),T(C.error.message))}await this.deleteProposal(w.id),this.events.off(R,$);const{cacaos:K,responder:F}=C.result,W=[],H=[];for(const oe of K){await ma({cacao:oe,projectId:this.client.core.projectId})||(this.client.logger.error(oe,"Signature verification failed"),T(ae("SESSION_SETTLEMENT_FAILED","Signature verification failed")));const{p:Ge}=oe,gt=Cn(Ge.resources),Eo=[as(Ge.iss)],td=Yn(Ge.iss);if(gt){const yi=ya(gt),rd=wa(gt);W.push(...yi),Eo.push(...rd)}for(const yi of Eo)H.push(`${yi}:${td}`)}const ue=await this.client.core.crypto.generateSharedKey(P,F.publicKey);let ce;W.length>0&&(ce={topic:ue,acknowledged:!0,self:{publicKey:P,metadata:this.client.metadata},peer:F,controller:F.publicKey,expiry:_e(gr),requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:O,namespaces:ja([...new Set(W)],[...new Set(H)]),transportType:o},await this.client.core.relayer.subscribe(ue,{transportType:o}),await this.client.session.set(ue,ce),O&&await this.client.core.pairing.updateMetadata({topic:O,metadata:F.metadata}),ce=this.client.session.get(ue)),(N=this.client.metadata.redirect)!=null&&N.linkMode&&(j=F.metadata.redirect)!=null&&j.linkMode&&(z=F.metadata.redirect)!=null&&z.universal&&n&&(this.client.core.addLinkModeSupportedApp(F.metadata.redirect.universal),this.client.session.update(ue,{transportType:se.link_mode})),I({auths:K,session:ce})};this.events.once(R,$),this.events.once(S,k);let M;try{if(s){const C=Ut("wc_sessionAuthenticate",D,V);this.client.core.history.set(O,C);const N=await this.client.core.crypto.encode("",C,{type:wn,encoding:zt});M=Ln(n,O,N)}else await Promise.all([this.sendRequest({topic:O,method:"wc_sessionAuthenticate",params:D,expiry:e.expiry,throwOnFailedPublish:!0,clientRpcId:V}),this.sendRequest({topic:O,method:"wc_sessionPropose",params:w,expiry:Ie.wc_sessionPropose.req.ttl,throwOnFailedPublish:!0,clientRpcId:w.id})])}catch(C){throw this.events.off(R,$),this.events.off(S,k),C}return await this.setProposal(w.id,w),await this.setAuthRequest(V,{request:Le(te({},D),{verifyContext:{}}),pairingTopic:O,transportType:o}),{uri:M??g,response:v}}),x(this,"approveSessionAuthenticate",async e=>{const{id:n,auths:i}=e,s=this.client.core.eventClient.createEvent({properties:{topic:n.toString(),trace:[Zt.authenticated_session_approve_started]}});try{this.isInitialized()}catch(y){throw s.setError(Br.no_internet_connection),y}const o=this.getPendingAuthRequest(n);if(!o)throw s.setError(Br.authenticated_session_pending_request_not_found),new Error(`Could not find pending auth request with id ${n}`);const c=o.transportType||se.relay;c===se.relay&&await this.confirmOnlineStateOrThrow();const l=o.requester.publicKey,u=await this.client.core.crypto.generateKeyPair(),d=$n(l),h={type:Ot,receiverPublicKey:l,senderPublicKey:u},p=[],_=[];for(const y of i){if(!await ma({cacao:y,projectId:this.client.core.projectId})){s.setError(Br.invalid_cacao);const A=ae("SESSION_SETTLEMENT_FAILED","Signature verification failed");throw await this.sendError({id:n,topic:d,error:A,encodeOpts:h}),new Error(A.message)}s.addTrace(Zt.cacaos_verified);const{p:b}=y,O=Cn(b.resources),g=[as(b.iss)],P=Yn(b.iss);if(O){const A=ya(O),E=wa(O);p.push(...A),g.push(...E)}for(const A of g)_.push(`${A}:${P}`)}const f=await this.client.core.crypto.generateSharedKey(u,l);s.addTrace(Zt.create_authenticated_session_topic);let m;if((p==null?void 0:p.length)>0){m={topic:f,acknowledged:!0,self:{publicKey:u,metadata:this.client.metadata},peer:{publicKey:l,metadata:o.requester.metadata},controller:l,expiry:_e(gr),authentication:i,requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:o.pairingTopic,namespaces:ja([...new Set(p)],[...new Set(_)]),transportType:c},s.addTrace(Zt.subscribing_authenticated_session_topic);try{await this.client.core.relayer.subscribe(f,{transportType:c})}catch(y){throw s.setError(Br.subscribe_authenticated_session_topic_failure),y}s.addTrace(Zt.subscribe_authenticated_session_topic_success),await this.client.session.set(f,m),s.addTrace(Zt.store_authenticated_session),await this.client.core.pairing.updateMetadata({topic:o.pairingTopic,metadata:o.requester.metadata})}s.addTrace(Zt.publishing_authenticated_session_approve);try{await this.sendResult({topic:d,id:n,result:{cacaos:i,responder:{publicKey:u,metadata:this.client.metadata}},encodeOpts:h,throwOnFailedPublish:!0,appLink:this.getAppLinkIfEnabled(o.requester.metadata,c)})}catch(y){throw s.setError(Br.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:s.eventId}),{session:m}}),x(this,"rejectSessionAuthenticate",async e=>{this.isInitialized();const{id:n,reason:i}=e,s=this.getPendingAuthRequest(n);if(!s)throw new Error(`Could not find pending auth request with id ${n}`);s.transportType===se.relay&&await this.confirmOnlineStateOrThrow();const o=s.requester.publicKey,c=await this.client.core.crypto.generateKeyPair(),l=$n(o),u={type:Ot,receiverPublicKey:o,senderPublicKey:c};await this.sendError({id:n,topic:l,error:i,encodeOpts:u,rpcOpts:Ie.wc_sessionAuthenticate.reject,appLink:this.getAppLinkIfEnabled(s.requester.metadata,s.transportType)}),await this.client.auth.requests.delete(n,{message:"rejected",code:0}),await this.deleteProposal(n)}),x(this,"formatAuthMessage",e=>{this.isInitialized();const{request:n,iss:i}=e;return Wl(n,i)}),x(this,"processRelayMessageCache",()=>{setTimeout(async()=>{if(this.relayMessageCache.length!==0)for(;this.relayMessageCache.length>0;)try{const e=this.relayMessageCache.shift();e&&await this.onRelayMessage(e)}catch(e){this.client.logger.error(e)}},50)}),x(this,"cleanupDuplicatePairings",async e=>{if(e.pairingTopic)try{const n=this.client.core.pairing.pairings.get(e.pairingTopic),i=this.client.core.pairing.pairings.getAll().filter(s=>{var o,c;return((o=s.peerMetadata)==null?void 0:o.url)&&((c=s.peerMetadata)==null?void 0:c.url)===e.peer.metadata.url&&s.topic&&s.topic!==n.topic});if(i.length===0)return;this.client.logger.info(`Cleaning up ${i.length} duplicate pairing(s)`),await Promise.all(i.map(s=>this.client.core.pairing.disconnect({topic:s.topic}))),this.client.logger.info("Duplicate pairings clean up finished")}catch(n){this.client.logger.error(n)}}),x(this,"deleteSession",async e=>{var n;const{topic:i,expirerHasDeleted:s=!1,emitEvent:o=!0,id:c=0}=e,{self:l}=this.client.session.get(i);await this.client.core.relayer.unsubscribe(i),await this.client.session.delete(i,ae("USER_DISCONNECTED")),this.addToRecentlyDeleted(i,"session"),this.client.core.crypto.keychain.has(l.publicKey)&&await this.client.core.crypto.deleteKeyPair(l.publicKey),this.client.core.crypto.keychain.has(i)&&await this.client.core.crypto.deleteSymKey(i),s||this.client.core.expirer.del(i),this.client.core.storage.removeItem(wc).catch(u=>this.client.logger.warn(u)),this.getPendingSessionRequests().forEach(u=>{u.topic===i&&this.deletePendingSessionRequest(u.id,ae("USER_DISCONNECTED"))}),i===((n=this.sessionRequestQueue.queue[0])==null?void 0:n.topic)&&(this.sessionRequestQueue.state=ht.idle),o&&this.client.events.emit("session_delete",{id:c,topic:i})}),x(this,"deleteProposal",async(e,n)=>{if(n)try{const i=this.client.proposal.get(e),s=this.client.core.eventClient.getEvent({topic:i.pairingTopic});s==null||s.setError(Mr.proposal_expired)}catch{}await Promise.all([this.client.proposal.delete(e,ae("USER_DISCONNECTED")),n?Promise.resolve():this.client.core.expirer.del(e)]),this.addToRecentlyDeleted(e,"proposal")}),x(this,"deletePendingSessionRequest",async(e,n,i=!1)=>{await Promise.all([this.client.pendingRequest.delete(e,n),i?Promise.resolve():this.client.core.expirer.del(e)]),this.addToRecentlyDeleted(e,"request"),this.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter(s=>s.id!==e),i&&(this.sessionRequestQueue.state=ht.idle,this.client.events.emit("session_request_expire",{id:e}))}),x(this,"deletePendingAuthRequest",async(e,n,i=!1)=>{await Promise.all([this.client.auth.requests.delete(e,n),i?Promise.resolve():this.client.core.expirer.del(e)])}),x(this,"setExpiry",async(e,n)=>{this.client.session.keys.includes(e)&&(this.client.core.expirer.set(e,n),await this.client.session.update(e,{expiry:n}))}),x(this,"setProposal",async(e,n)=>{this.client.core.expirer.set(e,_e(Ie.wc_sessionPropose.req.ttl)),await this.client.proposal.set(e,n)}),x(this,"setAuthRequest",async(e,n)=>{const{request:i,pairingTopic:s,transportType:o=se.relay}=n;this.client.core.expirer.set(e,i.expiryTimestamp),await this.client.auth.requests.set(e,{authPayload:i.authPayload,requester:i.requester,expiryTimestamp:i.expiryTimestamp,id:e,pairingTopic:s,verifyContext:i.verifyContext,transportType:o})}),x(this,"setPendingSessionRequest",async e=>{const{id:n,topic:i,params:s,verifyContext:o}=e,c=s.request.expiryTimestamp||_e(Ie.wc_sessionRequest.req.ttl);this.client.core.expirer.set(n,c),await this.client.pendingRequest.set(n,{id:n,topic:i,params:s,verifyContext:o})}),x(this,"sendRequest",async e=>{const{topic:n,method:i,params:s,expiry:o,relayRpcId:c,clientRpcId:l,throwOnFailedPublish:u,appLink:d,tvf:h,publishOpts:p={}}=e,_=Ut(i,s,l);let f;const m=!!d;try{const O=m?zt:Me;f=await this.client.core.crypto.encode(n,_,{encoding:O})}catch(O){throw await this.cleanup(),this.client.logger.error(`sendRequest() -> core.crypto.encode() for topic ${n} failed`),O}let y;if(fb.includes(i)){const O=Qe(JSON.stringify(_)),g=Qe(f);y=await this.client.core.verify.register({id:g,decryptedId:O})}const b=te(te({},Ie[i].req),p);if(b.attestation=y,o&&(b.ttl=o),c&&(b.id=c),this.client.core.history.set(n,_),m){const O=Ln(d,n,f);await it.Linking.openURL(O,this.client.name)}else b.tvf=Le(te({},h),{correlationId:_.id}),u?(b.internal=Le(te({},b.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(n,f,b)):this.client.core.relayer.publish(n,f,b).catch(O=>this.client.logger.error(O));return _.id}),x(this,"sendProposeSession",async e=>{const{proposal:n,publishOpts:i}=e,s=Ut("wc_sessionPropose",n,n.id);this.client.core.history.set(n.pairingTopic,s);const o=await this.client.core.crypto.encode(n.pairingTopic,s,{encoding:Me}),c=Qe(JSON.stringify(s)),l=Qe(o),u=await this.client.core.verify.register({id:l,decryptedId:c});await this.client.core.relayer.publishCustom({payload:{pairingTopic:n.pairingTopic,sessionProposal:o},opts:Le(te({},i),{publishMethod:"wc_proposeSession",attestation:u})})}),x(this,"sendApproveSession",async e=>{const{sessionTopic:n,pairingProposalResponse:i,proposal:s,sessionSettleRequest:o,publishOpts:c}=e,l=Bn(s.id,i),u=await this.client.core.crypto.encode(s.pairingTopic,l,{encoding:Me}),d=Ut("wc_sessionSettle",o,c==null?void 0:c.id),h=await this.client.core.crypto.encode(n,d,{encoding:Me});this.client.core.history.set(n,d),await this.client.core.relayer.publishCustom({payload:{sessionTopic:n,pairingTopic:s.pairingTopic,sessionProposalResponse:u,sessionSettlementRequest:h},opts:Le(te({},c),{publishMethod:"wc_approveSession"})})}),x(this,"sendResult",async e=>{const{id:n,topic:i,result:s,throwOnFailedPublish:o,encodeOpts:c,appLink:l}=e,u=Bn(n,s);let d;const h=l&&typeof(it==null?void 0:it.Linking)<"u";try{const f=h?zt:Me;d=await this.client.core.crypto.encode(i,u,Le(te({},c||{}),{encoding:f}))}catch(f){throw await this.cleanup(),this.client.logger.error(`sendResult() -> core.crypto.encode() for topic ${i} failed`),f}let p,_;try{p=await this.client.core.history.get(i,n);const f=p.request;try{_=this.getTVFParams(n,f.params,s)}catch(m){this.client.logger.warn(`sendResult() -> getTVFParams() failed: ${m==null?void 0:m.message}`)}}catch(f){throw this.client.logger.error(`sendResult() -> history.get(${i}, ${n}) failed`),f}if(h){const f=Ln(l,i,d);await it.Linking.openURL(f,this.client.name)}else{const f=p.request.method,m=Ie[f].res;m.tvf=Le(te({},_),{correlationId:n}),o?(m.internal=Le(te({},m.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(i,d,m)):this.client.core.relayer.publish(i,d,m).catch(y=>this.client.logger.error(y))}await this.client.core.history.resolve(u)}),x(this,"sendError",async e=>{const{id:n,topic:i,error:s,encodeOpts:o,rpcOpts:c,appLink:l}=e,u=Bc(n,s);let d;const h=l&&typeof(it==null?void 0:it.Linking)<"u";try{const _=h?zt:Me;d=await this.client.core.crypto.encode(i,u,Le(te({},o||{}),{encoding:_}))}catch(_){throw await this.cleanup(),this.client.logger.error(`sendError() -> core.crypto.encode() for topic ${i} failed`),_}let p;try{p=await this.client.core.history.get(i,n)}catch(_){throw this.client.logger.error(`sendError() -> history.get(${i}, ${n}) failed`),_}if(h){const _=Ln(l,i,d);await it.Linking.openURL(_,this.client.name)}else{const _=p.request.method,f=c||Ie[_].res;this.client.core.relayer.publish(i,d,f)}await this.client.core.history.resolve(u)}),x(this,"cleanup",async()=>{const e=[],n=[];this.client.session.getAll().forEach(i=>{let s=!1;qt(i.expiry)&&(s=!0),this.client.core.crypto.keychain.has(i.topic)||(s=!0),s&&e.push(i.topic)}),this.client.proposal.getAll().forEach(i=>{qt(i.expiryTimestamp)&&n.push(i.id)}),await Promise.all([...e.map(i=>this.deleteSession({topic:i})),...n.map(i=>this.deleteProposal(i))])}),x(this,"onProviderMessageEvent",async e=>{!this.initialized||this.relayMessageCache.length>0?this.relayMessageCache.push(e):await this.onRelayMessage(e)}),x(this,"onRelayEventRequest",async e=>{this.requestQueue.queue.push(e),await this.processRequestsQueue()}),x(this,"processRequestsQueue",async()=>{if(this.requestQueue.state===ht.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=ht.active;const e=this.requestQueue.queue.shift();if(e)try{await this.processRequest(e)}catch(n){this.client.logger.warn(n)}}this.requestQueue.state=ht.idle}),x(this,"processRequest",async e=>{const{topic:n,payload:i,attestation:s,transportType:o,encryptedId:c}=e,l=i.method;if(!this.shouldIgnorePairingRequest({topic:n,requestMethod:l}))switch(l){case"wc_sessionPropose":return await this.onSessionProposeRequest({topic:n,payload:i,attestation:s,encryptedId:c});case"wc_sessionSettle":return await this.onSessionSettleRequest(n,i);case"wc_sessionUpdate":return await this.onSessionUpdateRequest(n,i);case"wc_sessionExtend":return await this.onSessionExtendRequest(n,i);case"wc_sessionPing":return await this.onSessionPingRequest(n,i);case"wc_sessionDelete":return await this.onSessionDeleteRequest(n,i);case"wc_sessionRequest":return await this.onSessionRequest({topic:n,payload:i,attestation:s,encryptedId:c,transportType:o});case"wc_sessionEvent":return await this.onSessionEventRequest(n,i);case"wc_sessionAuthenticate":return await this.onSessionAuthenticateRequest({topic:n,payload:i,attestation:s,encryptedId:c,transportType:o});default:return this.client.logger.info(`Unsupported request method ${l}`)}}),x(this,"onRelayEventResponse",async e=>{const{topic:n,payload:i,transportType:s}=e,o=(await this.client.core.history.get(n,i.id)).request.method;switch(o){case"wc_sessionPropose":return this.onSessionProposeResponse(n,i,s);case"wc_sessionSettle":return this.onSessionSettleResponse(n,i);case"wc_sessionUpdate":return this.onSessionUpdateResponse(n,i);case"wc_sessionExtend":return this.onSessionExtendResponse(n,i);case"wc_sessionPing":return this.onSessionPingResponse(n,i);case"wc_sessionRequest":return this.onSessionRequestResponse(n,i);case"wc_sessionAuthenticate":return this.onSessionAuthenticateResponse(n,i);default:return this.client.logger.info(`Unsupported response method ${o}`)}}),x(this,"onRelayEventUnknownPayload",e=>{const{topic:n}=e,{message:i}=U("MISSING_OR_INVALID",`Decoded payload on topic ${n} is not identifiable as a JSON-RPC request or a response.`);throw new Error(i)}),x(this,"shouldIgnorePairingRequest",e=>{const{topic:n,requestMethod:i}=e,s=this.expectedPairingMethodMap.get(n);return!s||s.includes(i)?!1:!!(s.includes("wc_sessionAuthenticate")&&this.client.events.listenerCount("session_authenticate")>0)}),x(this,"onSessionProposeRequest",async e=>{const{topic:n,payload:i,attestation:s,encryptedId:o}=e,{params:c,id:l}=i;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(At.proposal_listener_not_found)),this.isValidConnect(te({},i.params));const d=c.expiryTimestamp||_e(Ie.wc_sessionPropose.req.ttl),h=te({id:l,pairingTopic:n,expiryTimestamp:d,attestation:s,encryptedId:o},c);await this.setProposal(l,h);const p=await this.getVerifyContext({attestationId:s,hash:Qe(JSON.stringify(i)),encryptedId:o,metadata:h.proposer.metadata});u==null||u.addTrace(pt.emit_session_proposal),this.client.events.emit("session_proposal",{id:l,params:h,verifyContext:p})}catch(u){await this.sendError({id:l,topic:n,error:u,rpcOpts:Ie.wc_sessionPropose.autoReject}),this.client.logger.error(u)}}),x(this,"onSessionProposeResponse",async(e,n,i)=>{const{id:s}=n;if(bt(n)){const{result:o}=n;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:o});const c=this.client.proposal.get(s);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:c});const l=c.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:l});const u=o.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:u});const d=await this.client.core.crypto.generateSharedKey(l,u);this.pendingSessions.set(s,{sessionTopic:d,pairingTopic:e,proposalId:s,publicKey:l});const h=await this.client.core.relayer.subscribe(d,{transportType:i});this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:h}),await this.client.core.pairing.activate({topic:e})}else if(_t(n)){await this.deleteProposal(s);const o=ee("session_connect",s);if(this.events.listenerCount(o)===0)throw new Error(`emitting ${o} without any listeners, 954`);this.events.emit(o,{error:n.error})}}),x(this,"onSessionSettleRequest",async(e,n)=>{const{id:i,params:s}=n;try{this.isValidSessionSettleRequest(s);const{relay:o,controller:c,expiry:l,namespaces:u,sessionProperties:d,scopedProperties:h,sessionConfig:p}=n.params,_=[...this.pendingSessions.values()].find(y=>y.sessionTopic===e);if(!_)return this.client.logger.error(`Pending session not found for topic ${e}`);const f=this.client.proposal.get(_.proposalId),m=Le(te(te(te({topic:e,relay:o,expiry:l,namespaces:u,acknowledged:!0,pairingTopic:_.pairingTopic,requiredNamespaces:f.requiredNamespaces,optionalNamespaces:f.optionalNamespaces,controller:c.publicKey,self:{publicKey:_.publicKey,metadata:this.client.metadata},peer:{publicKey:c.publicKey,metadata:c.metadata}},d&&{sessionProperties:d}),h&&{scopedProperties:h}),p&&{sessionConfig:p}),{transportType:se.relay});await this.client.session.set(m.topic,m),await this.setExpiry(m.topic,m.expiry),await this.client.core.pairing.updateMetadata({topic:_.pairingTopic,metadata:m.peer.metadata}),this.client.events.emit("session_connect",{session:m}),this.events.emit(ee("session_connect",_.proposalId),{session:m}),this.pendingSessions.delete(_.proposalId),this.deleteProposal(_.proposalId,!1),this.cleanupDuplicatePairings(m),await this.sendResult({id:n.id,topic:e,result:!0})}catch(o){await this.sendError({id:i,topic:e,error:o}),this.client.logger.error(o)}}),x(this,"onSessionSettleResponse",async(e,n)=>{const{id:i}=n;bt(n)?(await this.client.session.update(e,{acknowledged:!0}),this.events.emit(ee("session_approve",i),{})):_t(n)&&(await this.client.session.delete(e,ae("USER_DISCONNECTED")),this.events.emit(ee("session_approve",i),{error:n.error}))}),x(this,"onSessionUpdateRequest",async(e,n)=>{const{params:i,id:s}=n;try{const o=`${e}_session_update`,c=Ur.get(o);if(c&&this.isRequestOutOfSync(c,s)){this.client.logger.warn(`Discarding out of sync request - ${s}`),this.sendError({id:s,topic:e,error:ae("INVALID_UPDATE_REQUEST")});return}this.isValidUpdate(te({topic:e},i));try{Ur.set(o,s),await this.client.session.update(e,{namespaces:i.namespaces}),await this.sendResult({id:s,topic:e,result:!0})}catch(l){throw Ur.delete(o),l}this.client.events.emit("session_update",{id:s,topic:e,params:i})}catch(o){await this.sendError({id:s,topic:e,error:o}),this.client.logger.error(o)}}),x(this,"isRequestOutOfSync",(e,n)=>n.toString().slice(0,-3)<e.toString().slice(0,-3)),x(this,"onSessionUpdateResponse",(e,n)=>{const{id:i}=n,s=ee("session_update",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);bt(n)?this.events.emit(ee("session_update",i),{}):_t(n)&&this.events.emit(ee("session_update",i),{error:n.error})}),x(this,"onSessionExtendRequest",async(e,n)=>{const{id:i}=n;try{this.isValidExtend({topic:e}),await this.setExpiry(e,_e(gr)),await this.sendResult({id:i,topic:e,result:!0}),this.client.events.emit("session_extend",{id:i,topic:e})}catch(s){await this.sendError({id:i,topic:e,error:s}),this.client.logger.error(s)}}),x(this,"onSessionExtendResponse",(e,n)=>{const{id:i}=n,s=ee("session_extend",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);bt(n)?this.events.emit(ee("session_extend",i),{}):_t(n)&&this.events.emit(ee("session_extend",i),{error:n.error})}),x(this,"onSessionPingRequest",async(e,n)=>{const{id:i}=n;try{this.isValidPing({topic:e}),await this.sendResult({id:i,topic:e,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_ping",{id:i,topic:e})}catch(s){await this.sendError({id:i,topic:e,error:s}),this.client.logger.error(s)}}),x(this,"onSessionPingResponse",(e,n)=>{const{id:i}=n,s=ee("session_ping",i);setTimeout(()=>{if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners 2176`);bt(n)?this.events.emit(ee("session_ping",i),{}):_t(n)&&this.events.emit(ee("session_ping",i),{error:n.error})},500)}),x(this,"onSessionDeleteRequest",async(e,n)=>{const{id:i}=n;try{this.isValidDisconnect({topic:e,reason:n.params}),await Promise.all([new Promise(s=>{this.client.core.relayer.once(le.publish,async()=>{s(await this.deleteSession({topic:e,id:i}))})}),this.sendResult({id:i,topic:e,result:!0}),this.cleanupPendingSentRequestsForTopic({topic:e,error:ae("USER_DISCONNECTED")})]).catch(s=>this.client.logger.error(s))}catch(s){this.client.logger.error(s)}}),x(this,"onSessionRequest",async e=>{var n,i,s;const{topic:o,payload:c,attestation:l,encryptedId:u,transportType:d}=e,{id:h,params:p}=c;try{await this.isValidRequest(te({topic:o},p));const _=this.client.session.get(o),f=await this.getVerifyContext({attestationId:l,hash:Qe(JSON.stringify(Ut("wc_sessionRequest",p,h))),encryptedId:u,metadata:_.peer.metadata,transportType:d}),m={id:h,topic:o,params:p,verifyContext:f};await this.setPendingSessionRequest(m),d===se.link_mode&&(n=_.peer.metadata.redirect)!=null&&n.universal&&this.client.core.addLinkModeSupportedApp((i=_.peer.metadata.redirect)==null?void 0:i.universal),(s=this.client.signConfig)!=null&&s.disableRequestQueue?this.emitSessionRequest(m):(this.addSessionRequestToSessionRequestQueue(m),this.processSessionRequestQueue())}catch(_){await this.sendError({id:h,topic:o,error:_}),this.client.logger.error(_)}}),x(this,"onSessionRequestResponse",(e,n)=>{const{id:i}=n,s=ee("session_request",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);bt(n)?this.events.emit(ee("session_request",i),{result:n.result}):_t(n)&&this.events.emit(ee("session_request",i),{error:n.error})}),x(this,"onSessionEventRequest",async(e,n)=>{const{id:i,params:s}=n;try{const o=`${e}_session_event_${s.event.name}`,c=Ur.get(o);if(c&&this.isRequestOutOfSync(c,i)){this.client.logger.info(`Discarding out of sync request - ${i}`);return}this.isValidEmit(te({topic:e},s)),this.client.events.emit("session_event",{id:i,topic:e,params:s}),Ur.set(o,i)}catch(o){await this.sendError({id:i,topic:e,error:o}),this.client.logger.error(o)}}),x(this,"onSessionAuthenticateResponse",(e,n)=>{const{id:i}=n;this.client.logger.trace({type:"method",method:"onSessionAuthenticateResponse",topic:e,payload:n}),bt(n)?this.events.emit(ee("session_request",i),{result:n.result}):_t(n)&&this.events.emit(ee("session_request",i),{error:n.error})}),x(this,"onSessionAuthenticateRequest",async e=>{var n;const{topic:i,payload:s,attestation:o,encryptedId:c,transportType:l}=e;try{const{requester:u,authPayload:d,expiryTimestamp:h}=s.params,p=await this.getVerifyContext({attestationId:o,hash:Qe(JSON.stringify(s)),encryptedId:c,metadata:u.metadata,transportType:l}),_={requester:u,pairingTopic:i,id:s.id,authPayload:d,verifyContext:p,expiryTimestamp:h};await this.setAuthRequest(s.id,{request:_,pairingTopic:i,transportType:l}),l===se.link_mode&&(n=u.metadata.redirect)!=null&&n.universal&&this.client.core.addLinkModeSupportedApp(u.metadata.redirect.universal),this.client.events.emit("session_authenticate",{topic:i,params:s.params,id:s.id,verifyContext:p})}catch(u){this.client.logger.error(u);const d=s.params.requester.publicKey,h=await this.client.core.crypto.generateKeyPair(),p=this.getAppLinkIfEnabled(s.params.requester.metadata,l),_={type:Ot,receiverPublicKey:d,senderPublicKey:h};await this.sendError({id:s.id,topic:i,error:u,encodeOpts:_,rpcOpts:Ie.wc_sessionAuthenticate.autoReject,appLink:p})}}),x(this,"addSessionRequestToSessionRequestQueue",e=>{this.sessionRequestQueue.queue.push(e)}),x(this,"cleanupAfterResponse",e=>{this.deletePendingSessionRequest(e.response.id,{message:"fulfilled",code:0}),setTimeout(()=>{this.sessionRequestQueue.state=ht.idle,this.processSessionRequestQueue()},q.toMiliseconds(this.requestQueueDelay))}),x(this,"cleanupPendingSentRequestsForTopic",({topic:e,error:n})=>{const i=this.client.core.history.pending;i.length>0&&i.filter(s=>s.topic===e&&s.request.method==="wc_sessionRequest").forEach(s=>{const o=s.request.id,c=ee("session_request",o);if(this.events.listenerCount(c)===0)throw new Error(`emitting ${c} without any listeners`);this.events.emit(ee("session_request",s.request.id),{error:n})})}),x(this,"processSessionRequestQueue",()=>{if(this.sessionRequestQueue.state===ht.active){this.client.logger.info("session request queue is already active.");return}const e=this.sessionRequestQueue.queue[0];if(!e){this.client.logger.info("session request queue is empty.");return}try{this.emitSessionRequest(e)}catch(n){this.client.logger.error(n)}}),x(this,"emitSessionRequest",e=>{if(this.emittedSessionRequests.has(e.id)){this.client.logger.warn({id:e.id},`Skipping emitting \`session_request\` event for duplicate request. id: ${e.id}`);return}this.sessionRequestQueue.state=ht.active,this.emittedSessionRequests.add(e.id),this.client.events.emit("session_request",e)}),x(this,"onPairingCreated",e=>{if(e.methods&&this.expectedPairingMethodMap.set(e.topic,e.methods),e.active)return;const n=this.client.proposal.getAll().find(i=>i.pairingTopic===e.topic);n&&this.onSessionProposeRequest({topic:e.topic,payload:Ut("wc_sessionPropose",Le(te({},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})}),x(this,"isValidConnect",async e=>{if(!Ne(e)){const{message:u}=U("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(e)}`);throw new Error(u)}const{pairingTopic:n,requiredNamespaces:i,optionalNamespaces:s,sessionProperties:o,scopedProperties:c,relays:l}=e;if(fe(n)||await this.isValidPairingTopic(n),!tg(l)){const{message:u}=U("MISSING_OR_INVALID",`connect() relays: ${l}`);throw new Error(u)}if(!fe(i)&&un(i)!==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(i,"requiredNamespaces")}if(!fe(s)&&un(s)!==0&&this.validateNamespaces(s,"optionalNamespaces"),fe(o)||this.validateSessionProps(o,"sessionProperties"),!fe(c)){this.validateSessionProps(c,"scopedProperties");const u=Object.keys(i||{}).concat(Object.keys(s||{}));if(!Object.keys(c).every(d=>u.includes(d.split(":")[0])))throw new Error(`Scoped properties must be a subset of required/optional namespaces, received: ${JSON.stringify(c)}, required/optional namespaces: ${JSON.stringify(u)}`)}}),x(this,"validateNamespaces",(e,n)=>{const i=eg(e,"connect()",n);if(i)throw new Error(i.message)}),x(this,"isValidApprove",async e=>{if(!Ne(e))throw new Error(U("MISSING_OR_INVALID",`approve() params: ${e}`).message);const{id:n,namespaces:i,relayProtocol:s,sessionProperties:o,scopedProperties:c}=e;this.checkRecentlyDeleted(n),await this.isValidProposalId(n);const l=this.client.proposal.get(n),u=Ci(i,"approve()");if(u)throw new Error(u.message);const d=Fa(l.requiredNamespaces,i,"approve()");if(d)throw new Error(d.message);if(!he(s,!0)){const{message:h}=U("MISSING_OR_INVALID",`approve() relayProtocol: ${s}`);throw new Error(h)}if(fe(o)||this.validateSessionProps(o,"sessionProperties"),!fe(c)){this.validateSessionProps(c,"scopedProperties");const h=new Set(Object.keys(i));if(!Object.keys(c).every(p=>h.has(p.split(":")[0])))throw new Error(`Scoped properties must be a subset of approved namespaces, received: ${JSON.stringify(c)}, approved namespaces: ${Array.from(h).join(", ")}`)}}),x(this,"isValidReject",async e=>{if(!Ne(e)){const{message:s}=U("MISSING_OR_INVALID",`reject() params: ${e}`);throw new Error(s)}const{id:n,reason:i}=e;if(this.checkRecentlyDeleted(n),await this.isValidProposalId(n),!ng(i)){const{message:s}=U("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(i)}`);throw new Error(s)}}),x(this,"isValidSessionSettleRequest",e=>{if(!Ne(e)){const{message:u}=U("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${e}`);throw new Error(u)}const{relay:n,controller:i,namespaces:s,expiry:o}=e;if(!Au(n)){const{message:u}=U("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(u)}const c=Gw(i,"onSessionSettleRequest()");if(c)throw new Error(c.message);const l=Ci(s,"onSessionSettleRequest()");if(l)throw new Error(l.message);if(qt(o)){const{message:u}=U("EXPIRED","onSessionSettleRequest()");throw new Error(u)}}),x(this,"isValidUpdate",async e=>{if(!Ne(e)){const{message:l}=U("MISSING_OR_INVALID",`update() params: ${e}`);throw new Error(l)}const{topic:n,namespaces:i}=e;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n);const s=this.client.session.get(n),o=Ci(i,"update()");if(o)throw new Error(o.message);const c=Fa(s.requiredNamespaces,i,"update()");if(c)throw new Error(c.message)}),x(this,"isValidExtend",async e=>{if(!Ne(e)){const{message:i}=U("MISSING_OR_INVALID",`extend() params: ${e}`);throw new Error(i)}const{topic:n}=e;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n)}),x(this,"isValidRequest",async e=>{if(!Ne(e)){const{message:l}=U("MISSING_OR_INVALID",`request() params: ${e}`);throw new Error(l)}const{topic:n,request:i,chainId:s,expiry:o}=e;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n);const{namespaces:c}=this.client.session.get(n);if(!Ka(c,s)){const{message:l}=U("MISSING_OR_INVALID",`request() chainId: ${s}`);throw new Error(l)}if(!ig(i)){const{message:l}=U("MISSING_OR_INVALID",`request() ${JSON.stringify(i)}`);throw new Error(l)}if(!ag(c,s,i.method)){const{message:l}=U("MISSING_OR_INVALID",`request() method: ${i.method}`);throw new Error(l)}if(o&&!dg(o,Mi)){const{message:l}=U("MISSING_OR_INVALID",`request() expiry: ${o}. Expiry must be a number (in seconds) between ${Mi.min} and ${Mi.max}`);throw new Error(l)}}),x(this,"isValidRespond",async e=>{var n;if(!Ne(e)){const{message:o}=U("MISSING_OR_INVALID",`respond() params: ${e}`);throw new Error(o)}const{topic:i,response:s}=e;try{await this.isValidSessionTopic(i)}catch(o){throw(n=e==null?void 0:e.response)!=null&&n.id&&this.cleanupAfterResponse(e),o}if(!sg(s)){const{message:o}=U("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(s)}`);throw new Error(o)}}),x(this,"isValidPing",async e=>{if(!Ne(e)){const{message:i}=U("MISSING_OR_INVALID",`ping() params: ${e}`);throw new Error(i)}const{topic:n}=e;await this.isValidSessionOrPairingTopic(n)}),x(this,"isValidEmit",async e=>{if(!Ne(e)){const{message:c}=U("MISSING_OR_INVALID",`emit() params: ${e}`);throw new Error(c)}const{topic:n,event:i,chainId:s}=e;await this.isValidSessionTopic(n);const{namespaces:o}=this.client.session.get(n);if(!Ka(o,s)){const{message:c}=U("MISSING_OR_INVALID",`emit() chainId: ${s}`);throw new Error(c)}if(!og(i)){const{message:c}=U("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(c)}if(!cg(o,s,i.name)){const{message:c}=U("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(c)}}),x(this,"isValidDisconnect",async e=>{if(!Ne(e)){const{message:i}=U("MISSING_OR_INVALID",`disconnect() params: ${e}`);throw new Error(i)}const{topic:n}=e;await this.isValidSessionOrPairingTopic(n)}),x(this,"isValidAuthenticate",e=>{const{chains:n,uri:i,domain:s,nonce:o}=e;if(!Array.isArray(n)||n.length===0)throw new Error("chains is required and must be a non-empty array");if(!he(i,!1))throw new Error("uri is required parameter");if(!he(s,!1))throw new Error("domain is required parameter");if(!he(o,!1))throw new Error("nonce is required parameter");if([...new Set(n.map(l=>xn(l).namespace))].length>1)throw new Error("Multi-namespace requests are not supported. Please request single namespace only.");const{namespace:c}=xn(n[0]);if(c!=="eip155")throw new Error("Only eip155 namespace is supported for authenticated sessions. Please use .connect() for non-eip155 chains.")}),x(this,"getVerifyContext",async e=>{const{attestationId:n,hash:i,encryptedId:s,metadata:o,transportType:c}=e,l={verified:{verifyUrl:o.verifyUrl||Xr,validation:"UNKNOWN",origin:o.url||""}};try{if(c===se.link_mode){const d=this.getAppLinkIfEnabled(o,c);return l.verified.validation=d&&new URL(d).origin===new URL(o.url).origin?"VALID":"INVALID",l}const u=await this.client.core.verify.resolve({attestationId:n,hash:i,encryptedId:s,verifyUrl:o.verifyUrl});u&&(l.verified.origin=u.origin,l.verified.isScam=u.isScam,l.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(l)}`),l}),x(this,"validateSessionProps",(e,n)=>{Object.values(e).forEach((i,s)=>{if(i==null){const{message:o}=U("MISSING_OR_INVALID",`${n} must contain an existing value for each key. Received: ${i} for key ${Object.keys(e)[s]}`);throw new Error(o)}})}),x(this,"getPendingAuthRequest",e=>{const n=this.client.auth.requests.get(e);return typeof n=="object"?n:void 0}),x(this,"addToRecentlyDeleted",(e,n)=>{if(this.recentlyDeletedMap.set(e,n),this.recentlyDeletedMap.size>=this.recentlyDeletedLimit){let i=0;const s=this.recentlyDeletedLimit/2;for(const o of this.recentlyDeletedMap.keys()){if(i++>=s)break;this.recentlyDeletedMap.delete(o)}}}),x(this,"checkRecentlyDeleted",e=>{const n=this.recentlyDeletedMap.get(e);if(n){const{message:i}=U("MISSING_OR_INVALID",`Record was recently deleted - ${n}: ${e}`);throw new Error(i)}}),x(this,"isLinkModeEnabled",(e,n)=>{var i,s,o,c,l,u,d,h,p;return!e||n!==se.link_mode?!1:((s=(i=this.client.metadata)==null?void 0:i.redirect)==null?void 0:s.linkMode)===!0&&((c=(o=this.client.metadata)==null?void 0:o.redirect)==null?void 0:c.universal)!==void 0&&((u=(l=this.client.metadata)==null?void 0:l.redirect)==null?void 0:u.universal)!==""&&((d=e==null?void 0:e.redirect)==null?void 0:d.universal)!==void 0&&((h=e==null?void 0:e.redirect)==null?void 0:h.universal)!==""&&((p=e==null?void 0:e.redirect)==null?void 0:p.linkMode)===!0&&this.client.core.linkModeSupportedApps.includes(e.redirect.universal)&&typeof(it==null?void 0:it.Linking)<"u"}),x(this,"getAppLinkIfEnabled",(e,n)=>{var i;return this.isLinkModeEnabled(e,n)?(i=e==null?void 0:e.redirect)==null?void 0:i.universal:void 0}),x(this,"handleLinkModeMessage",({url:e})=>{if(!e||!e.includes("wc_ev")||!e.includes("topic"))return;const n=ia(e,"topic")||"",i=decodeURIComponent(ia(e,"wc_ev")||""),s=this.client.session.keys.includes(n);s&&this.client.session.update(n,{transportType:se.link_mode}),this.client.core.dispatchEnvelope({topic:n,message:i,sessionExists:s})}),x(this,"registerLinkModeListeners",async()=>{var e;if(eo()||Ht()&&(e=this.client.metadata.redirect)!=null&&e.linkMode){const n=it==null?void 0:it.Linking;if(typeof n<"u"){n.addEventListener("url",this.handleLinkModeMessage,this.client.name);const i=await n.getInitialURL();i&&setTimeout(()=>{this.handleLinkModeMessage({url:i})},50)}}}),x(this,"getTVFParams",(e,n,i)=>{var s,o,c;if(!((s=n.request)!=null&&s.method))return{};const l={correlationId:e,rpcMethods:[n.request.method],chainId:n.chainId};try{const u=this.extractTxHashesFromResult(n.request,i);l.txHashes=u,l.contractAddresses=this.isValidContractData(n.request.params)?[(c=(o=n.request.params)==null?void 0:o[0])==null?void 0:c.to]:[]}catch(u){this.client.logger.warn("Error getting TVF params",u)}return l}),x(this,"isValidContractData",e=>{var n;if(!e)return!1;try{const i=(e==null?void 0:e.data)||((n=e==null?void 0:e[0])==null?void 0:n.data);if(!i.startsWith("0x"))return!1;const s=i.slice(2);return/^[0-9a-fA-F]*$/.test(s)?s.length%2===0:!1}catch{}return!1}),x(this,"extractTxHashesFromResult",(e,n)=>{var i;try{if(!n)return[];const s=e.method,o=pb[s];if(s==="sui_signTransaction")return[xm(n.transactionBytes)];if(s==="near_signTransaction")return[ha(n)];if(s==="near_signTransactions")return n.map(l=>ha(l));if(s==="xrpl_signTransactionFor"||s==="xrpl_signTransaction")return[(i=n.tx_json)==null?void 0:i.hash];if(s==="polkadot_signTransaction")return[Pg({transaction:e.params.transactionPayload,signature:n.signature})];if(s==="algo_signTxn")return Ar(n)?n.map(l=>pa(l)):[pa(n)];if(s==="cosmos_signDirect")return[$m(n)];if(typeof n=="string")return[n];const c=n[o.key];if(Ar(c))return s==="solana_signAllTransactions"?c.map(l=>Sm(l)):c;if(typeof c=="string")return[c]}catch(s){this.client.logger.warn("Error extracting tx hashes from result",s)}return[]})}async processPendingMessageEvents(){try{const t=this.client.session.keys,e=this.client.core.relayer.messages.getWithoutAck(t);for(const[n,i]of Object.entries(e))for(const s of i)try{await this.onProviderMessageEvent({topic:n,message:s,publishedAt:Date.now()})}catch{this.client.logger.warn(`Error processing pending message event for topic: ${n}, message: ${s}`)}}catch(t){this.client.logger.warn("processPendingMessageEvents failed",t)}}isInitialized(){if(!this.initialized){const{message:t}=U("NOT_INITIALIZED",this.name);throw new Error(t)}}async confirmOnlineStateOrThrow(){await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(le.message,t=>{this.onProviderMessageEvent(t)})}async onRelayMessage(t){const{topic:e,message:n,attestation:i,transportType:s}=t,{publicKey:o}=this.client.auth.authKeys.keys.includes(Nn)?this.client.auth.authKeys.get(Nn):{publicKey:void 0};try{const c=await this.client.core.crypto.decode(e,n,{receiverPublicKey:o,encoding:s===se.link_mode?zt:Me});qs(c)?(this.client.core.history.set(e,c),await this.onRelayEventRequest({topic:e,payload:c,attestation:i,transportType:s,encryptedId:Qe(n)})):Ms(c)?(await this.client.core.history.resolve(c),await this.onRelayEventResponse({topic:e,payload:c,transportType:s}),this.client.core.history.delete(e,c.id)):await this.onRelayEventUnknownPayload({topic:e,payload:c,transportType:s}),await this.client.core.relayer.messages.ack(e,n)}catch(c){this.client.logger.error(c)}}registerExpirerEvents(){this.client.core.expirer.on(Ye.expired,async t=>{const{topic:e,id:n}=Vl(t.target);if(n&&this.client.pendingRequest.keys.includes(n))return await this.deletePendingSessionRequest(n,U("EXPIRED"),!0);if(n&&this.client.auth.requests.keys.includes(n))return await this.deletePendingAuthRequest(n,U("EXPIRED"),!0);e?this.client.session.keys.includes(e)&&(await this.deleteSession({topic:e,expirerHasDeleted:!0}),this.client.events.emit("session_expire",{topic:e})):n&&(await this.deleteProposal(n,!0),this.client.events.emit("proposal_expire",{id:n}))})}registerPairingEvents(){this.client.core.pairing.events.on(Qt.create,t=>this.onPairingCreated(t)),this.client.core.pairing.events.on(Qt.delete,t=>{this.addToRecentlyDeleted(t.topic,"pairing")})}isValidPairingTopic(t){if(!he(t,!1)){const{message:e}=U("MISSING_OR_INVALID",`pairing topic should be a string: ${t}`);throw new Error(e)}if(!this.client.core.pairing.pairings.keys.includes(t)){const{message:e}=U("NO_MATCHING_KEY",`pairing topic doesn't exist: ${t}`);throw new Error(e)}if(qt(this.client.core.pairing.pairings.get(t).expiry)){const{message:e}=U("EXPIRED",`pairing topic: ${t}`);throw new Error(e)}}async isValidSessionTopic(t){if(!he(t,!1)){const{message:e}=U("MISSING_OR_INVALID",`session topic should be a string: ${t}`);throw new Error(e)}if(this.checkRecentlyDeleted(t),!this.client.session.keys.includes(t)){const{message:e}=U("NO_MATCHING_KEY",`session topic doesn't exist: ${t}`);throw new Error(e)}if(qt(this.client.session.get(t).expiry)){await this.deleteSession({topic:t});const{message:e}=U("EXPIRED",`session topic: ${t}`);throw new Error(e)}if(!this.client.core.crypto.keychain.has(t)){const{message:e}=U("MISSING_OR_INVALID",`session topic does not exist in keychain: ${t}`);throw await this.deleteSession({topic:t}),new Error(e)}}async isValidSessionOrPairingTopic(t){if(this.checkRecentlyDeleted(t),this.client.session.keys.includes(t))await this.isValidSessionTopic(t);else if(this.client.core.pairing.pairings.keys.includes(t))this.isValidPairingTopic(t);else if(he(t,!1)){const{message:e}=U("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${t}`);throw new Error(e)}else{const{message:e}=U("MISSING_OR_INVALID",`session or pairing topic should be a string: ${t}`);throw new Error(e)}}async isValidProposalId(t){if(!rg(t)){const{message:e}=U("MISSING_OR_INVALID",`proposal id should be a number: ${t}`);throw new Error(e)}if(!this.client.proposal.keys.includes(t)){const{message:e}=U("NO_MATCHING_KEY",`proposal id doesn't exist: ${t}`);throw new Error(e)}if(qt(this.client.proposal.get(t).expiryTimestamp)){await this.deleteProposal(t);const{message:e}=U("EXPIRED",`proposal id: ${t}`);throw new Error(e)}}}class Ob extends pr{constructor(t,e){super(t,e,ub,mo),this.core=t,this.logger=e}}class Rb extends pr{constructor(t,e){super(t,e,db,mo),this.core=t,this.logger=e}}class Lb extends pr{constructor(t,e){super(t,e,_b,mo,n=>n.id),this.core=t,this.logger=e}}class Db extends pr{constructor(t,e){super(t,e,wb,fi,()=>Nn),this.core=t,this.logger=e}}class Vb extends pr{constructor(t,e){super(t,e,gb,fi),this.core=t,this.logger=e}}class Sb extends pr{constructor(t,e){super(t,e,Eb,fi,n=>n.id),this.core=t,this.logger=e}}var xb=Object.defineProperty,Cb=(r,t,e)=>t in r?xb(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Bi=(r,t,e)=>Cb(r,typeof t!="symbol"?t+"":t,e);class $b{constructor(t,e){this.core=t,this.logger=e,Bi(this,"authKeys"),Bi(this,"pairingTopics"),Bi(this,"requests"),this.authKeys=new Db(this.core,this.logger),this.pairingTopics=new Vb(this.core,this.logger),this.requests=new Sb(this.core,this.logger)}async init(){await this.authKeys.init(),await this.pairingTopics.init(),await this.requests.init()}}var kb=Object.defineProperty,Nb=(r,t,e)=>t in r?kb(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,J=(r,t,e)=>Nb(r,typeof t!="symbol"?t+"":t,e);class yo extends y_{constructor(t){super(t),J(this,"protocol",Bu),J(this,"version",ju),J(this,"name",qi.name),J(this,"metadata"),J(this,"core"),J(this,"logger"),J(this,"events",new ur.EventEmitter),J(this,"engine"),J(this,"session"),J(this,"proposal"),J(this,"pendingRequest"),J(this,"auth"),J(this,"signConfig"),J(this,"on",(n,i)=>this.events.on(n,i)),J(this,"once",(n,i)=>this.events.once(n,i)),J(this,"off",(n,i)=>this.events.off(n,i)),J(this,"removeListener",(n,i)=>this.events.removeListener(n,i)),J(this,"removeAllListeners",n=>this.events.removeAllListeners(n)),J(this,"connect",async n=>{try{return await this.engine.connect(n)}catch(i){throw this.logger.error(i.message),i}}),J(this,"pair",async n=>{try{return await this.engine.pair(n)}catch(i){throw this.logger.error(i.message),i}}),J(this,"approve",async n=>{try{return await this.engine.approve(n)}catch(i){throw this.logger.error(i.message),i}}),J(this,"reject",async n=>{try{return await this.engine.reject(n)}catch(i){throw this.logger.error(i.message),i}}),J(this,"update",async n=>{try{return await this.engine.update(n)}catch(i){throw this.logger.error(i.message),i}}),J(this,"extend",async n=>{try{return await this.engine.extend(n)}catch(i){throw this.logger.error(i.message),i}}),J(this,"request",async n=>{try{return await this.engine.request(n)}catch(i){throw this.logger.error(i.message),i}}),J(this,"respond",async n=>{try{return await this.engine.respond(n)}catch(i){throw this.logger.error(i.message),i}}),J(this,"ping",async n=>{try{return await this.engine.ping(n)}catch(i){throw this.logger.error(i.message),i}}),J(this,"emit",async n=>{try{return await this.engine.emit(n)}catch(i){throw this.logger.error(i.message),i}}),J(this,"disconnect",async n=>{try{return await this.engine.disconnect(n)}catch(i){throw this.logger.error(i.message),i}}),J(this,"find",n=>{try{return this.engine.find(n)}catch(i){throw this.logger.error(i.message),i}}),J(this,"getPendingSessionRequests",()=>{try{return this.engine.getPendingSessionRequests()}catch(n){throw this.logger.error(n.message),n}}),J(this,"authenticate",async(n,i)=>{try{return await this.engine.authenticate(n,i)}catch(s){throw this.logger.error(s.message),s}}),J(this,"formatAuthMessage",n=>{try{return this.engine.formatAuthMessage(n)}catch(i){throw this.logger.error(i.message),i}}),J(this,"approveSessionAuthenticate",async n=>{try{return await this.engine.approveSessionAuthenticate(n)}catch(i){throw this.logger.error(i.message),i}}),J(this,"rejectSessionAuthenticate",async n=>{try{return await this.engine.rejectSessionAuthenticate(n)}catch(i){throw this.logger.error(i.message),i}}),this.name=(t==null?void 0:t.name)||qi.name,this.metadata=Af(t==null?void 0:t.metadata),this.signConfig=t==null?void 0:t.signConfig;const e=typeof(t==null?void 0:t.logger)<"u"&&typeof(t==null?void 0:t.logger)!="string"?t.logger:oi(Qs({level:(t==null?void 0:t.logger)||qi.logger}));this.core=(t==null?void 0:t.core)||new lb(t),this.logger=Ce(e,this.name),this.session=new Rb(this.core,this.logger),this.proposal=new Ob(this.core,this.logger),this.pendingRequest=new Lb(this.core,this.logger),this.engine=new Pb(this),this.auth=new $b(this.core,this.logger)}static async init(t){const e=new yo(t);return await e.initialize(),e}get context(){return Ke(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(t){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(t.message),t}}}const Ub=yo,qb="08c4b07e3ad25f1a27c14a4e8cecb6f0",hA="eip155";async function Mb(r){const{account:t,chainId:e,params:[n]}=r;if(!t.sendRawTransaction)throw new Error("The current account does not support sending raw transactions");return(await t.sendRawTransaction({chainId:e,rawTransaction:n})).transactionHash}function mi(r,t){if(Ao(r.address)!==Ao(t))throw new Error(`Failed to validate account address (${r.address}), differs from ${t}`)}function pA(r){const t=r.split(":"),e=Number.parseInt(t[1]??"0");if(t.length!==2||t[0]!=="eip155"||e===0||!e)throw new Error(`Invalid chainId ${r}, should have the format 'eip155:1'`);return e}async function Bb(r){const{account:t,chainId:e,thirdwebClient:n,params:[i]}=r;i.from!==void 0&&mi(t,i.from);const s=Gi({chain:ge(e),client:n,data:i.data,gas:i.gas?Ve(i.gas):void 0,gasPrice:i.gasPrice?Ve(i.gasPrice):void 0,to:i.to,value:i.value?Ve(i.value):void 0});return(await Cc({account:t,transaction:s})).transactionHash}async function vc(r){const{account:t,params:e}=r;return mi(t,e[1]),t.signMessage({message:{raw:e[0]}})}async function jb(r){const{account:t,params:[e]}=r;if(!t.signTransaction)throw new Error("The current account does not support signing transactions");return e.from!==void 0&&mi(t,e.from),t.signTransaction({data:e.data,gas:e.gas?Ve(e.gas):void 0,gasPrice:e.gasPrice?Ve(e.gasPrice):void 0,nonce:e.nonce?sr(e.nonce):void 0,to:e.to,value:e.value?Ve(e.value):void 0})}async function bc(r){const{account:t,params:e}=r;return mi(t,e[0]),t.signTypedData(typeof e[1]=="string"?JSON.parse(e[1]):e[1])}async function Ku(r){var n;const{wallet:t,params:e}=r;return((n=t.getChain())==null?void 0:n.id)===sr(e[0].chainId)||await t.switchChain($d(sr(e[0].chainId))),"0x1"}const _A=Object.freeze(Object.defineProperty({__proto__:null,handleSwitchChain:Ku},Symbol.toStringTag,{value:"Module"})),fA="/sdk/2022-08-12/embedded-wallet",ji=r=>`thirdwebEwsWalletUserId-${r}`,zb="walletToken",zi=r=>`${zb}-${r}`,Ic=r=>`passkey-credential-id-${r}`,Kb="a",Ki=(r,t)=>`${Kb}-${r}-${t}`,Ac=r=>`walletConnectSessions-${r}`,Tc=r=>`thirdweb_guest_session_id_${r}`,Pc=new Map;class wo{constructor({storage:t,clientId:e,ecosystem:n}){Object.defineProperty(this,"key",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"storage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ecosystem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.storage=t,this.key=Fb(e,n==null?void 0:n.id),this.ecosystem=n}async getItem(t){return this.storage?this.storage.getItem(t):Pc.get(t)??null}async setItem(t,e){if(this.storage)return this.storage.setItem(t,e);Pc.set(t,e)}async removeItem(t){const e=await this.getItem(t);return this.storage&&e?(this.storage.removeItem(t),!0):!1}async getWalletConnectSessions(){return this.getItem(Ac(this.key))}async saveWalletConnectSessions(t){await this.setItem(Ac(this.key),t)}async savePasskeyCredentialId(t){await this.setItem(Ic(this.key),t)}async getPasskeyCredentialId(){return this.getItem(Ic(this.key))}async saveAuthCookie(t){await this.setItem(zi(this.key),t)}async getAuthCookie(){return this.getItem(zi(this.key))}async removeAuthCookie(){return this.removeItem(zi(this.key))}async saveDeviceShare(t,e){await this.saveWalletUserId(e),await this.setItem(Ki(this.key,e),t)}async getDeviceShare(){const t=await this.getWalletUserId();return t?this.getItem(Ki(this.key,t)):null}async removeDeviceShare(){const t=await this.getWalletUserId();return t?this.removeItem(Ki(this.key,t)):!1}async getWalletUserId(){return this.getItem(ji(this.key))}async saveWalletUserId(t){await this.setItem(ji(this.key),t)}async removeWalletUserId(){return this.removeItem(ji(this.key))}async getGuestSessionId(){return this.getItem(Tc(this.key))}async saveGuestSessionId(t){await this.setItem(Tc(this.key),t)}}const Fb=(r,t)=>`${r}${t?`-${t}`:""}`;let yt;async function Fu(){if(!yt)return[];const r=await yt.getWalletConnectSessions();return JSON.parse(r??"[]")}function Wb(r){yt||(yt=new wo({clientId:r.clientId,storage:null}))}async function mA(r){if(!yt)return;const t=await yt.getWalletConnectSessions(),e=JSON.parse(t??"[]");e.push(r),await yt.saveWalletConnectSessions(we(e))}async function Hb(r){if(!yt)return;const t=await yt.getWalletConnectSessions(),n=JSON.parse(t??"[]").filter(i=>i.topic!==r.topic);await yt.saveWalletConnectSessions(we(n))}let Fi=new WeakMap;const Gb={eth_sendRawTransaction:Mb,eth_sendTransaction:Bb,eth_sign:vc,eth_signTransaction:jb,eth_signTypedData:bc,eth_signTypedData_v4:bc,personal_sign:vc,wallet_addEthereumChain:r=>{throw new Error("Unsupported request method: wallet_addEthereumChain")},wallet_switchEthereumChain:Ku};async function Jb(r){var d,h,p,_;const{wallet:t,requestHandlers:e,onConnect:n,onDisconnect:i,client:s}=r,o=r.chains&&r.chains.length>10?(console.warn("WalletConnect: Can specify no more than 10 chains, truncating to the first 10 provided chains..."),r.chains.slice(0,10)):r.chains;if(Fi.has(s))return Fi.get(s);Wb({clientId:r.client.clientId});const c=Wn(),l=await Ub.init({metadata:{description:((d=r.appMetadata)==null?void 0:d.description)??c.description,icons:[((h=r.appMetadata)==null?void 0:h.logoUrl)??c.logoUrl],name:((p=r.appMetadata)==null?void 0:p.name)??c.name,url:((_=r.appMetadata)==null?void 0:_.url)??c.url},projectId:r.projectId??qb});l.on("session_proposal",async f=>{const{onSessionProposal:m}=await a(async()=>{const{onSessionProposal:y}=await import("./session-proposal-gCtrzWm4.js");return{onSessionProposal:y}},__vite__mapDeps([26,1,2,3,4,5,6,7]));await m({chains:o,event:f,onConnect:n,wallet:t,walletConnectClient:l}).catch(y=>{if(r.onError)r.onError(y);else throw y})}),l.on("session_request",async f=>{const{fulfillRequest:m}=await a(async()=>{const{fulfillRequest:y}=await import("./session-request-CbcWY9Ja.js");return{fulfillRequest:y}},__vite__mapDeps([27,3,4,1,2,5,6,7]));await m({event:f,handlers:e,thirdwebClient:s,wallet:t,walletConnectClient:l}).catch(y=>{if(r.onError)r.onError(y);else throw y})}),l.on("session_event",async f=>{}),l.on("session_ping",f=>{}),l.on("session_delete",async f=>{await Wu({session:{topic:f.topic},walletConnectClient:l}).catch(m=>{if(r.onError)r.onError(m);else throw m})});const u=l.disconnect;return l.disconnect=async f=>{const m=await u(f).catch(()=>{});return i&&Qb({onDisconnect:i,topic:f.topic}),m},Fi.set(r.client,l),l}function Zb(r){const{uri:t,walletConnectClient:e}=r;e.core.pairing.pair({uri:t})}async function Yb(){return Fu()}async function Wu(r){Hb(r.session);try{await r.walletConnectClient.disconnect({reason:{code:6e3,message:"Disconnected"},topic:r.session.topic})}catch{}}async function Qb(r){const{topic:t,onDisconnect:e}=r,n=await Fu();e(n.find(i=>i.topic===t)??{topic:t})}function Xb(r){return[at("inApp",{executionMode:r==null?void 0:r.executionMode}),at(Wc),at(ft,{appMetadata:r==null?void 0:r.appMetadata,chains:r==null?void 0:r.chains}),at(Vh),at("io.rabby"),at(Sh),at("com.okex.wallet")]}function eI(r,t){const e=new Set;let n=r();const i=()=>{for(const o of e)o()},s=o=>{n=o,i()};for(const o of t)o.subscribe(()=>{s(r())});return{getValue(){return n},subscribe(o){return e.add(o),()=>{e.delete(o)}}}}function Dn(r,t,e=!0){e&&r();const n=t.map(i=>i.subscribe(()=>{r()}));return()=>{for(const i of n)i()}}const dn="tw:connected-wallet-params";async function yA(r,t,e){if(!rI(e))throw new Error("given params are not stringifiable");const n=await r.getItem(dn);let i;if(n){try{i=JSON.parse(n)}catch{i={}}i[t]=e}else i={[t]:e};r.setItem(dn,we(i))}async function tI(r,t){const e=await r.getItem(dn);let n;if(e){try{n=JSON.parse(e)}catch{n={}}delete n[t],r.setItem(dn,we(n))}}async function wA(r,t){const e=await r.getItem(dn);if(!e)return null;try{const n=JSON.parse(e);return n!=null&&n[t]?n[t]:null}catch{return null}}function rI(r){try{return we(r),!0}catch{return!1}}function nI(r){let t;return()=>(t||(t=r()),t)}function iI(r={}){return Nc({filters:r,signature:"event UserOperationRevertReason(bytes32 indexed userOpHash, address indexed sender, uint256 nonce, bytes revertReason)"})}function sI(r={}){return Nc({filters:r,signature:"event PostOpRevertReason(bytes32 indexed userOpHash, address indexed sender, uint256 nonce, bytes revertReason)"})}function oI(r){const{receipt:t}=r,e={...t,blockNumber:t.blockNumber?BigInt(t.blockNumber):null,contractAddress:t.contractAddress?t.contractAddress:null,cumulativeGasUsed:t.cumulativeGasUsed?BigInt(t.cumulativeGasUsed):null,effectiveGasPrice:t.effectiveGasPrice?BigInt(t.effectiveGasPrice):null,gasUsed:t.gasUsed?BigInt(t.gasUsed):null,logs:t.logs,status:t.status,to:t.to?t.to:null,transactionHash:t.transactionHash,transactionIndex:t.transactionIndex,type:t.type};return t.blobGasPrice&&(e.blobGasPrice=BigInt(t.blobGasPrice)),t.blobGasUsed&&(e.blobGasUsed=BigInt(t.blobGasUsed)),{...r,actualGasCost:BigInt(r.actualGasCost),actualGasUsed:BigInt(r.actualGasUsed),nonce:BigInt(r.nonce),receipt:e,userOpHash:r.userOpHash}}const gA=()=>{const r=BigInt(Math.floor(Math.random()*4294967296)),t=BigInt(Math.floor(Math.random()*4294967296)),e=BigInt(Math.floor(Math.random()*4294967296)),n=BigInt(Math.floor(Math.random()*4294967296)),i=BigInt(Math.floor(Math.random()*4294967296)),s=BigInt(Math.floor(Math.random()*4294967296));return r<<BigInt(160)|t<<BigInt(128)|e<<BigInt(96)|n<<BigInt(64)|i<<BigInt(32)|s};function Hu(r){return Object.fromEntries(Object.entries(r).map(([t,e])=>[t,e==null||qn(e)?e:Ns(e)]))}async function EA(r){return Gt({...r,operation:"eth_sendUserOperation",params:[Hu(r.userOp),r.options.entrypointAddress??si]})}async function vA(r,t){const e=await Gt({...r,operation:"eth_estimateUserOperationGas",params:[Hu(r.userOp),r.options.entrypointAddress??si,t??{}]});return{callGasLimit:Ve(e.callGasLimit)+bh,paymasterPostOpGasLimit:e.paymasterPostOpGasLimit!==void 0?Ve(e.paymasterPostOpGasLimit):void 0,paymasterVerificationGasLimit:e.paymasterVerificationGasLimit!==void 0?Ve(e.paymasterVerificationGasLimit):void 0,preVerificationGas:Ve(e.preVerificationGas),verificationGas:e.verificationGas!==void 0?Ve(e.verificationGas):void 0,verificationGasLimit:Ve(e.verificationGasLimit)}}async function bA(r){const t=await Gt({...r,operation:"thirdweb_getUserOperationGasPrice",params:[]});return{maxFeePerGas:Ve(t.maxFeePerGas),maxPriorityFeePerGas:Ve(t.maxPriorityFeePerGas)}}async function IA(r){var e,n;const t=await aI(r);if(t){if(t.success===!1){const s=(n=(e=Id({events:[iI(),sI()],logs:t.logs})[0])==null?void 0:e.args)==null?void 0:n.revertReason;if(!s)throw new Error(`UserOp failed at txHash: ${t.receipt.transactionHash}`);const o=Ad({data:s});throw new Error(`UserOp failed with reason: '${o.args.join(",")}' at txHash: ${t.receipt.transactionHash}`)}return t.receipt}}async function aI(r){const t=await Gt({operation:"eth_getUserOperationReceipt",options:r,params:[r.userOpHash]});if(t)return oI(t)}async function AA(r){const t=await Gt({operation:"zk_paymasterData",options:r.options,params:[r.transaction]});return{paymaster:t.paymaster,paymasterInput:t.paymasterInput}}async function cI(r){const t=await Gt({...r,operation:"tw_execute",params:[r.eoaAddress,r.wrappedCalls,r.signature,r.authorization]});if(!t.queueId)throw new Error(`Error executing 7702 transaction: ${we(t)}`);return{transactionId:t.queueId}}async function lI(r){return{transactionHash:(await Gt({...r,operation:"tw_getTransactionHash",params:[r.transactionId]})).transactionHash}}async function TA(r){return{transactionHash:(await Gt({operation:"zk_broadcastTransaction",options:r.options,params:[{...r.transaction,signedTransaction:r.signedTransaction}]})).transactionHash}}async function Gt(r){const{options:t,operation:e,params:n}=r,i=t.bundlerUrl??Kc(t.chain),o=await hn(t.client)(i,{useAuthToken:!0,body:we({id:1,jsonrpc:"2.0",method:e,params:n}),headers:{"Content-Type":"application/json"},method:"POST"}),c=await o.json();if(!o.ok||c.error){let l=c.error||o.statusText;typeof l=="object"&&(l=we(l));const u=c.code||"UNKNOWN";throw new Error(`${e} error: ${l}
|
|
13
|
+
Approved: ${p.toString()}`))}),o.forEach(h=>{n||(er(i[h].methods,s[h].methods)?er(i[h].events,s[h].events)||(n=U("NON_CONFORMING_NAMESPACES",`${e} namespaces events don't satisfy namespace events for ${h}`)):n=U("NON_CONFORMING_NAMESPACES",`${e} namespaces methods don't satisfy namespace methods for ${h}`))}),n}function lg(r){const t={};return Object.keys(r).forEach(e=>{var n;e.includes(":")?t[e]=r[e]:(n=r[e].chains)==null||n.forEach(i=>{t[i]={methods:r[e].methods,events:r[e].events}})}),t}function Wa(r){return[...new Set(r.map(t=>t.includes(":")?t.split(":")[0]:t))]}function ug(r){const t={};return Object.keys(r).forEach(e=>{if(e.includes(":"))t[e]=r[e];else{const n=xr(r[e].accounts);n==null||n.forEach(i=>{t[i]={accounts:r[e].accounts.filter(s=>s.includes(`${i}:`)),methods:r[e].methods,events:r[e].events}})}}),t}function dg(r,t){return _o(r,!1)&&r<=t.max&&r>=t.min}function Ha(){const r=fn();return new Promise(t=>{switch(r){case He.browser:t(hg());break;case He.reactNative:t(pg());break;case He.node:t(_g());break;default:t(!0)}})}function hg(){return Dr()&&(navigator==null?void 0:navigator.onLine)}async function pg(){if(Ht()&&typeof X<"u"&&X!=null&&X.NetInfo){const r=await(X==null?void 0:X.NetInfo.fetch());return r==null?void 0:r.isConnected}return!0}function _g(){return!0}function fg(r){switch(fn()){case He.browser:mg(r);break;case He.reactNative:yg(r);break}}function mg(r){!Ht()&&Dr()&&(window.addEventListener("online",()=>r(!0)),window.addEventListener("offline",()=>r(!1)))}function yg(r){Ht()&&typeof X<"u"&&X!=null&&X.NetInfo&&(X==null||X.NetInfo.addEventListener(t=>r(t==null?void 0:t.isConnected)))}function wg(){var r;return Dr()&&Rt.getDocument()?((r=Rt.getDocument())==null?void 0:r.visibilityState)==="visible":!0}const $i={};class Ur{static get(t){return $i[t]}static set(t,e){$i[t]=e}static delete(t){delete $i[t]}}function gg(r){const t=_n.decode(r);if(t.length<33)throw new Error("Too short to contain a public key");return t.slice(1,33)}function Eg({publicKey:r,signature:t,payload:e}){var n;const i=ys(e.method),s=128|parseInt(((n=e.version)==null?void 0:n.toString())||"4"),o=Ig(e.address),c=e.era==="00"?new Uint8Array([0]):ys(e.era);if(c.length!==1&&c.length!==2)throw new Error("Invalid era length");const l=parseInt(e.nonce,16),u=new Uint8Array([l&255,l>>8&255]),d=BigInt(`0x${bg(e.tip)}`),h=Tg(d),p=new Uint8Array([0,...r,o,...t,...c,...u,...h,...i]),_=Ag(p.length+1);return new Uint8Array([..._,s,...p])}function vg(r){const t=ys(r),e=eh.blake2b(t,void 0,32);return"0x"+re.from(e).toString("hex")}function ys(r){return new Uint8Array(r.replace(/^0x/,"").match(/.{1,2}/g).map(t=>parseInt(t,16)))}function bg(r){return r.startsWith("0x")?r.slice(2):r}function Ig(r){const t=_n.decode(r)[0];return t===42?0:t===60?2:1}function Ag(r){if(r<64)return new Uint8Array([r<<2]);if(r<16384){const t=r<<2|1;return new Uint8Array([t&255,t>>8&255])}else if(r<1<<30){const t=r<<2|2;return new Uint8Array([t&255,t>>8&255,t>>16&255,t>>24&255])}else throw new Error("Compact encoding > 2^30 not supported")}function Tg(r){if(r<BigInt(1)<<BigInt(6))return new Uint8Array([Number(r<<BigInt(2))]);if(r<BigInt(1)<<BigInt(14)){const t=r<<BigInt(2)|BigInt(1);return new Uint8Array([Number(t&BigInt(255)),Number(t>>BigInt(8)&BigInt(255))])}else if(r<BigInt(1)<<BigInt(30)){const t=r<<BigInt(2)|BigInt(2);return new Uint8Array([Number(t&BigInt(255)),Number(t>>BigInt(8)&BigInt(255)),Number(t>>BigInt(16)&BigInt(255)),Number(t>>BigInt(24)&BigInt(255))])}else throw new Error("BigInt compact encoding not supported > 2^30")}function Pg(r){const t=Uint8Array.from(re.from(r.signature,"hex")),e=gg(r.transaction.address),n=Eg({publicKey:e,signature:t,payload:r.transaction}),i=re.from(n).toString("hex");return vg(i)}var Og={VITE_BASE_URL:"https://cdn.decentraland.org/@dcl/marketplace-site/8.26.2"};const Tu="wc",Pu=2,ws="core",wt=`${Tu}@2:${ws}:`,Rg={logger:"error"},Lg={database:":memory:"},Dg="crypto",Ga="client_ed25519_seed",Vg=q.ONE_DAY,Sg="keychain",xg="0.3",Cg="messages",$g="0.3",kg=q.SIX_HOURS,Ng="publisher",Ou="irn",Ug="error",Ru="wss://relay.walletconnect.org",qg="relayer",le={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"},Mg="_subscription",Je={payload:"payload",connect:"connect",disconnect:"disconnect",error:"error"},Bg=.1,gs="2.21.8",se={link_mode:"link_mode",relay:"relay"},kn={inbound:"inbound",outbound:"outbound"},jg="0.3",zg="WALLETCONNECT_CLIENT_ID",Ja="WALLETCONNECT_LINK_MODE_APPS",We={created:"subscription_created",deleted:"subscription_deleted",expired:"subscription_expired",disabled:"subscription_disabled",sync:"subscription_sync",resubscribed:"subscription_resubscribed"},Kg="subscription",Fg="0.3",Wg="pairing",Hg="0.3",qr={wc_pairingDelete:{req:{ttl:q.ONE_DAY,prompt:!1,tag:1e3},res:{ttl:q.ONE_DAY,prompt:!1,tag:1001}},wc_pairingPing:{req:{ttl:q.THIRTY_SECONDS,prompt:!1,tag:1002},res:{ttl:q.THIRTY_SECONDS,prompt:!1,tag:1003}},unregistered_method:{req:{ttl:q.ONE_DAY,prompt:!1,tag:0},res:{ttl:q.ONE_DAY,prompt:!1,tag:0}}},Qt={create:"pairing_create",expire:"pairing_expire",delete:"pairing_delete",ping:"pairing_ping"},nt={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},Gg="history",Jg="0.3",Zg="expirer",Ye={created:"expirer_created",deleted:"expirer_deleted",expired:"expirer_expired",sync:"expirer_sync"},Yg="0.3",Qg="verify-api",Xg="https://verify.walletconnect.com",Lu="https://verify.walletconnect.org",Xr=Lu,eE=`${Xr}/v3`,tE=[Xg,Lu],rE="echo",nE="https://echo.walletconnect.com",pt={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"},At={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"},Nt={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"},Mr={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"},Zt={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"},Br={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"},iE=.1,sE="event-client",oE=86400,aE="https://pulse.walletconnect.org/batch";function cE(r,t){if(r.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),n=0;n<e.length;n++)e[n]=255;for(var i=0;i<r.length;i++){var s=r.charAt(i),o=s.charCodeAt(0);if(e[o]!==255)throw new TypeError(s+" is ambiguous");e[o]=i}var c=r.length,l=r.charAt(0),u=Math.log(c)/Math.log(256),d=Math.log(256)/Math.log(c);function h(f){if(f instanceof Uint8Array||(ArrayBuffer.isView(f)?f=new Uint8Array(f.buffer,f.byteOffset,f.byteLength):Array.isArray(f)&&(f=Uint8Array.from(f))),!(f instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(f.length===0)return"";for(var m=0,y=0,b=0,O=f.length;b!==O&&f[b]===0;)b++,m++;for(var g=(O-b)*d+1>>>0,P=new Uint8Array(g);b!==O;){for(var A=f[b],E=0,D=g-1;(A!==0||E<y)&&D!==-1;D--,E++)A+=256*P[D]>>>0,P[D]=A%c>>>0,A=A/c>>>0;if(A!==0)throw new Error("Non-zero carry");y=E,b++}for(var L=g-y;L!==g&&P[L]===0;)L++;for(var w=l.repeat(m);L<g;++L)w+=r.charAt(P[L]);return w}function p(f){if(typeof f!="string")throw new TypeError("Expected String");if(f.length===0)return new Uint8Array;var m=0;if(f[m]!==" "){for(var y=0,b=0;f[m]===l;)y++,m++;for(var O=(f.length-m)*u+1>>>0,g=new Uint8Array(O);f[m];){var P=e[f.charCodeAt(m)];if(P===255)return;for(var A=0,E=O-1;(P!==0||A<b)&&E!==-1;E--,A++)P+=c*g[E]>>>0,g[E]=P%256>>>0,P=P/256>>>0;if(P!==0)throw new Error("Non-zero carry");b=A,m++}if(f[m]!==" "){for(var D=O-b;D!==O&&g[D]===0;)D++;for(var L=new Uint8Array(y+(O-D)),w=y;D!==O;)L[w++]=g[D++];return L}}}function _(f){var m=p(f);if(m)return m;throw new Error(`Non-${t} character`)}return{encode:h,decodeUnsafe:p,decode:_}}var lE=cE,uE=lE;const Du=r=>{if(r instanceof Uint8Array&&r.constructor.name==="Uint8Array")return r;if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return new Uint8Array(r.buffer,r.byteOffset,r.byteLength);throw new Error("Unknown type, must be binary type")},dE=r=>new TextEncoder().encode(r),hE=r=>new TextDecoder().decode(r);class pE{constructor(t,e,n){this.name=t,this.prefix=e,this.baseEncode=n}encode(t){if(t instanceof Uint8Array)return`${this.prefix}${this.baseEncode(t)}`;throw Error("Unknown type, must be binary type")}}class _E{constructor(t,e,n){if(this.name=t,this.prefix=e,e.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=e.codePointAt(0),this.baseDecode=n}decode(t){if(typeof t=="string"){if(t.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(t)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(t.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(t){return Vu(this,t)}}class fE{constructor(t){this.decoders=t}or(t){return Vu(this,t)}decode(t){const e=t[0],n=this.decoders[e];if(n)return n.decode(t);throw RangeError(`Unable to decode multibase string ${JSON.stringify(t)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const Vu=(r,t)=>new fE({...r.decoders||{[r.prefix]:r},...t.decoders||{[t.prefix]:t}});class mE{constructor(t,e,n,i){this.name=t,this.prefix=e,this.baseEncode=n,this.baseDecode=i,this.encoder=new pE(t,e,n),this.decoder=new _E(t,e,i)}encode(t){return this.encoder.encode(t)}decode(t){return this.decoder.decode(t)}}const _i=({name:r,prefix:t,encode:e,decode:n})=>new mE(r,t,e,n),gn=({prefix:r,name:t,alphabet:e})=>{const{encode:n,decode:i}=uE(e,t);return _i({prefix:r,name:t,encode:n,decode:s=>Du(i(s))})},yE=(r,t,e,n)=>{const i={};for(let d=0;d<t.length;++d)i[t[d]]=d;let s=r.length;for(;r[s-1]==="=";)--s;const o=new Uint8Array(s*e/8|0);let c=0,l=0,u=0;for(let d=0;d<s;++d){const h=i[r[d]];if(h===void 0)throw new SyntaxError(`Non-${n} character`);l=l<<e|h,c+=e,c>=8&&(c-=8,o[u++]=255&l>>c)}if(c>=e||255&l<<8-c)throw new SyntaxError("Unexpected end of data");return o},wE=(r,t,e)=>{const n=t[t.length-1]==="=",i=(1<<e)-1;let s="",o=0,c=0;for(let l=0;l<r.length;++l)for(c=c<<8|r[l],o+=8;o>e;)o-=e,s+=t[i&c>>o];if(o&&(s+=t[i&c<<e-o]),n)for(;s.length*e&7;)s+="=";return s},Ae=({name:r,prefix:t,bitsPerChar:e,alphabet:n})=>_i({prefix:t,name:r,encode(i){return wE(i,n,e)},decode(i){return yE(i,n,e,r)}}),gE=_i({prefix:"\0",name:"identity",encode:r=>hE(r),decode:r=>dE(r)});var EE=Object.freeze({__proto__:null,identity:gE});const vE=Ae({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var bE=Object.freeze({__proto__:null,base2:vE});const IE=Ae({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var AE=Object.freeze({__proto__:null,base8:IE});const TE=gn({prefix:"9",name:"base10",alphabet:"0123456789"});var PE=Object.freeze({__proto__:null,base10:TE});const OE=Ae({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),RE=Ae({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var LE=Object.freeze({__proto__:null,base16:OE,base16upper:RE});const DE=Ae({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),VE=Ae({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),SE=Ae({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),xE=Ae({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),CE=Ae({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),$E=Ae({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),kE=Ae({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),NE=Ae({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),UE=Ae({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var qE=Object.freeze({__proto__:null,base32:DE,base32upper:VE,base32pad:SE,base32padupper:xE,base32hex:CE,base32hexupper:$E,base32hexpad:kE,base32hexpadupper:NE,base32z:UE});const ME=gn({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),BE=gn({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var jE=Object.freeze({__proto__:null,base36:ME,base36upper:BE});const zE=gn({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),KE=gn({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var FE=Object.freeze({__proto__:null,base58btc:zE,base58flickr:KE});const WE=Ae({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),HE=Ae({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),GE=Ae({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),JE=Ae({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var ZE=Object.freeze({__proto__:null,base64:WE,base64pad:HE,base64url:GE,base64urlpad:JE});const Su=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),YE=Su.reduce((r,t,e)=>(r[e]=t,r),[]),QE=Su.reduce((r,t,e)=>(r[t.codePointAt(0)]=e,r),[]);function XE(r){return r.reduce((t,e)=>(t+=YE[e],t),"")}function e0(r){const t=[];for(const e of r){const n=QE[e.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${e}`);t.push(n)}return new Uint8Array(t)}const t0=_i({prefix:"🚀",name:"base256emoji",encode:XE,decode:e0});var r0=Object.freeze({__proto__:null,base256emoji:t0}),n0=xu,Za=128,i0=-128,s0=Math.pow(2,31);function xu(r,t,e){t=t||[],e=e||0;for(var n=e;r>=s0;)t[e++]=r&255|Za,r/=128;for(;r&i0;)t[e++]=r&255|Za,r>>>=7;return t[e]=r|0,xu.bytes=e-n+1,t}var o0=Es,a0=128,Ya=127;function Es(r,n){var e=0,n=n||0,i=0,s=n,o,c=r.length;do{if(s>=c)throw Es.bytes=0,new RangeError("Could not decode varint");o=r[s++],e+=i<28?(o&Ya)<<i:(o&Ya)*Math.pow(2,i),i+=7}while(o>=a0);return Es.bytes=s-n,e}var c0=Math.pow(2,7),l0=Math.pow(2,14),u0=Math.pow(2,21),d0=Math.pow(2,28),h0=Math.pow(2,35),p0=Math.pow(2,42),_0=Math.pow(2,49),f0=Math.pow(2,56),m0=Math.pow(2,63),y0=function(r){return r<c0?1:r<l0?2:r<u0?3:r<d0?4:r<h0?5:r<p0?6:r<_0?7:r<f0?8:r<m0?9:10},w0={encode:n0,decode:o0,encodingLength:y0},Cu=w0;const Qa=(r,t,e=0)=>(Cu.encode(r,t,e),t),Xa=r=>Cu.encodingLength(r),vs=(r,t)=>{const e=t.byteLength,n=Xa(r),i=n+Xa(e),s=new Uint8Array(i+e);return Qa(r,s,0),Qa(e,s,n),s.set(t,i),new g0(r,e,t,s)};class g0{constructor(t,e,n,i){this.code=t,this.size=e,this.digest=n,this.bytes=i}}const $u=({name:r,code:t,encode:e})=>new E0(r,t,e);class E0{constructor(t,e,n){this.name=t,this.code=e,this.encode=n}digest(t){if(t instanceof Uint8Array){const e=this.encode(t);return e instanceof Uint8Array?vs(this.code,e):e.then(n=>vs(this.code,n))}else throw Error("Unknown type, must be binary type")}}const ku=r=>async t=>new Uint8Array(await crypto.subtle.digest(r,t)),v0=$u({name:"sha2-256",code:18,encode:ku("SHA-256")}),b0=$u({name:"sha2-512",code:19,encode:ku("SHA-512")});var I0=Object.freeze({__proto__:null,sha256:v0,sha512:b0});const Nu=0,A0="identity",Uu=Du,T0=r=>vs(Nu,Uu(r)),P0={code:Nu,name:A0,encode:Uu,digest:T0};var O0=Object.freeze({__proto__:null,identity:P0});new TextEncoder,new TextDecoder;const ec={...EE,...bE,...AE,...PE,...LE,...qE,...jE,...FE,...ZE,...r0};({...I0,...O0});function qu(r){return globalThis.Buffer!=null?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):r}function R0(r=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?qu(globalThis.Buffer.allocUnsafe(r)):new Uint8Array(r)}function Mu(r,t,e,n){return{name:r,prefix:t,encoder:{name:r,prefix:t,encode:e},decoder:{decode:n}}}const tc=Mu("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),ki=Mu("ascii","a",r=>{let t="a";for(let e=0;e<r.length;e++)t+=String.fromCharCode(r[e]);return t},r=>{r=r.substring(1);const t=R0(r.length);for(let e=0;e<r.length;e++)t[e]=r.charCodeAt(e);return t}),L0={utf8:tc,"utf-8":tc,hex:ec.base16,latin1:ki,ascii:ki,binary:ki,...ec};function D0(r,t="utf8"){const e=L0[t];if(!e)throw new Error(`Unsupported encoding "${t}"`);return(t==="utf8"||t==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?qu(globalThis.Buffer.from(r,"utf-8")):e.decoder.decode(`${e.prefix}${r}`)}var V0=Object.defineProperty,S0=(r,t,e)=>t in r?V0(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,dt=(r,t,e)=>S0(r,typeof t!="symbol"?t+"":t,e);class x0{constructor(t,e){this.core=t,this.logger=e,dt(this,"keychain",new Map),dt(this,"name",Sg),dt(this,"version",xg),dt(this,"initialized",!1),dt(this,"storagePrefix",wt),dt(this,"init",async()=>{if(!this.initialized){const n=await this.getKeyChain();typeof n<"u"&&(this.keychain=n),this.initialized=!0}}),dt(this,"has",n=>(this.isInitialized(),this.keychain.has(n))),dt(this,"set",async(n,i)=>{this.isInitialized(),this.keychain.set(n,i),await this.persist()}),dt(this,"get",n=>{this.isInitialized();const i=this.keychain.get(n);if(typeof i>"u"){const{message:s}=U("NO_MATCHING_KEY",`${this.name}: ${n}`);throw new Error(s)}return i}),dt(this,"del",async n=>{this.isInitialized(),this.keychain.delete(n),await this.persist()}),this.core=t,this.logger=Ce(e,this.name)}get context(){return Ke(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(t){await this.core.storage.setItem(this.storageKey,ss(t))}async getKeyChain(){const t=await this.core.storage.getItem(this.storageKey);return typeof t<"u"?os(t):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){const{message:t}=U("NOT_INITIALIZED",this.name);throw new Error(t)}}}var C0=Object.defineProperty,$0=(r,t,e)=>t in r?C0(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,ve=(r,t,e)=>$0(r,typeof t!="symbol"?t+"":t,e);class k0{constructor(t,e,n){this.core=t,this.logger=e,ve(this,"name",Dg),ve(this,"keychain"),ve(this,"randomSessionIdentifier",ms()),ve(this,"initialized",!1),ve(this,"init",async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)}),ve(this,"hasKeys",i=>(this.isInitialized(),this.keychain.has(i))),ve(this,"getClientId",async()=>{this.isInitialized();const i=await this.getClientSeed(),s=Po(i);return ih(s.publicKey)}),ve(this,"generateKeyPair",()=>{this.isInitialized();const i=fw();return this.setPrivateKey(i.publicKey,i.privateKey)}),ve(this,"signJWT",async i=>{this.isInitialized();const s=await this.getClientSeed(),o=Po(s),c=this.randomSessionIdentifier;return await sh(c,i,Vg,o)}),ve(this,"generateSharedKey",(i,s,o)=>{this.isInitialized();const c=this.getPrivateKey(i),l=mw(c,s);return this.setSymKey(l,o)}),ve(this,"setSymKey",async(i,s)=>{this.isInitialized();const o=s||$n(i);return await this.keychain.set(o,i),o}),ve(this,"deleteKeyPair",async i=>{this.isInitialized(),await this.keychain.del(i)}),ve(this,"deleteSymKey",async i=>{this.isInitialized(),await this.keychain.del(i)}),ve(this,"encode",async(i,s,o)=>{this.isInitialized();const c=vu(o),l=rn(s);if(ka(c))return gw(l,o==null?void 0:o.encoding);if($a(c)){const p=c.senderPublicKey,_=c.receiverPublicKey;i=await this.generateSharedKey(p,_)}const u=this.getSymKey(i),{type:d,senderPublicKey:h}=c;return yw({type:d,symKey:u,message:l,senderPublicKey:h,encoding:o==null?void 0:o.encoding})}),ve(this,"decode",async(i,s,o)=>{this.isInitialized();const c=vw(s,o);if(ka(c)){const l=Ew(s,o==null?void 0:o.encoding);return Mn(l)}if($a(c)){const l=c.receiverPublicKey,u=c.senderPublicKey;i=await this.generateSharedKey(l,u)}try{const l=this.getSymKey(i),u=ww({symKey:l,encoded:s,encoding:o==null?void 0:o.encoding});return Mn(u)}catch(l){this.logger.error(`Failed to decode message from topic: '${i}', clientId: '${await this.getClientId()}'`),this.logger.error(l)}}),ve(this,"getPayloadType",(i,s=Me)=>{const o=ln({encoded:i,encoding:s});return cr(o.type)}),ve(this,"getPayloadSenderPublicKey",(i,s=Me)=>{const o=ln({encoded:i,encoding:s});return o.senderPublicKey?ze(o.senderPublicKey,xe):void 0}),this.core=t,this.logger=Ce(e,this.name),this.keychain=n||new x0(this.core,this.logger)}get context(){return Ke(this.logger)}async setPrivateKey(t,e){return await this.keychain.set(t,e),t}getPrivateKey(t){return this.keychain.get(t)}async getClientSeed(){let t="";try{t=this.keychain.get(Ga)}catch{t=ms(),await this.keychain.set(Ga,t)}return D0(t,"base16")}getSymKey(t){return this.keychain.get(t)}isInitialized(){if(!this.initialized){const{message:t}=U("NOT_INITIALIZED",this.name);throw new Error(t)}}}var N0=Object.defineProperty,U0=Object.defineProperties,q0=Object.getOwnPropertyDescriptors,rc=Object.getOwnPropertySymbols,M0=Object.prototype.hasOwnProperty,B0=Object.prototype.propertyIsEnumerable,bs=(r,t,e)=>t in r?N0(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,j0=(r,t)=>{for(var e in t||(t={}))M0.call(t,e)&&bs(r,e,t[e]);if(rc)for(var e of rc(t))B0.call(t,e)&&bs(r,e,t[e]);return r},z0=(r,t)=>U0(r,q0(t)),Fe=(r,t,e)=>bs(r,typeof t!="symbol"?t+"":t,e);class K0 extends o_{constructor(t,e){super(t,e),this.logger=t,this.core=e,Fe(this,"messages",new Map),Fe(this,"messagesWithoutClientAck",new Map),Fe(this,"name",Cg),Fe(this,"version",$g),Fe(this,"initialized",!1),Fe(this,"storagePrefix",wt),Fe(this,"init",async()=>{if(!this.initialized){this.logger.trace("Initialized");try{const n=await this.getRelayerMessages();typeof n<"u"&&(this.messages=n);const i=await this.getRelayerMessagesWithoutClientAck();typeof i<"u"&&(this.messagesWithoutClientAck=i),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}}}),Fe(this,"set",async(n,i,s)=>{this.isInitialized();const o=Qe(i);let c=this.messages.get(n);if(typeof c>"u"&&(c={}),typeof c[o]<"u")return o;if(c[o]=i,this.messages.set(n,c),s===kn.inbound){const l=this.messagesWithoutClientAck.get(n)||{};this.messagesWithoutClientAck.set(n,z0(j0({},l),{[o]:i}))}return await this.persist(),o}),Fe(this,"get",n=>{this.isInitialized();let i=this.messages.get(n);return typeof i>"u"&&(i={}),i}),Fe(this,"getWithoutAck",n=>{this.isInitialized();const i={};for(const s of n){const o=this.messagesWithoutClientAck.get(s)||{};i[s]=Object.values(o)}return i}),Fe(this,"has",(n,i)=>{this.isInitialized();const s=this.get(n),o=Qe(i);return typeof s[o]<"u"}),Fe(this,"ack",async(n,i)=>{this.isInitialized();const s=this.messagesWithoutClientAck.get(n);if(typeof s>"u")return;const o=Qe(i);delete s[o],Object.keys(s).length===0?this.messagesWithoutClientAck.delete(n):this.messagesWithoutClientAck.set(n,s),await this.persist()}),Fe(this,"del",async n=>{this.isInitialized(),this.messages.delete(n),this.messagesWithoutClientAck.delete(n),await this.persist()}),this.logger=Ce(t,this.name),this.core=e}get context(){return Ke(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(t){await this.core.storage.setItem(this.storageKey,ss(t))}async setRelayerMessagesWithoutClientAck(t){await this.core.storage.setItem(this.storageKeyWithoutClientAck,ss(t))}async getRelayerMessages(){const t=await this.core.storage.getItem(this.storageKey);return typeof t<"u"?os(t):void 0}async getRelayerMessagesWithoutClientAck(){const t=await this.core.storage.getItem(this.storageKeyWithoutClientAck);return typeof t<"u"?os(t):void 0}async persist(){await this.setRelayerMessages(this.messages),await this.setRelayerMessagesWithoutClientAck(this.messagesWithoutClientAck)}isInitialized(){if(!this.initialized){const{message:t}=U("NOT_INITIALIZED",this.name);throw new Error(t)}}}var F0=Object.defineProperty,W0=Object.defineProperties,H0=Object.getOwnPropertyDescriptors,nc=Object.getOwnPropertySymbols,G0=Object.prototype.hasOwnProperty,J0=Object.prototype.propertyIsEnumerable,Is=(r,t,e)=>t in r?F0(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,yr=(r,t)=>{for(var e in t||(t={}))G0.call(t,e)&&Is(r,e,t[e]);if(nc)for(var e of nc(t))J0.call(t,e)&&Is(r,e,t[e]);return r},ic=(r,t)=>W0(r,H0(t)),Ze=(r,t,e)=>Is(r,typeof t!="symbol"?t+"":t,e);class Z0 extends a_{constructor(t,e){super(t,e),this.relayer=t,this.logger=e,Ze(this,"events",new ur.EventEmitter),Ze(this,"name",Ng),Ze(this,"queue",new Map),Ze(this,"publishTimeout",q.toMiliseconds(q.ONE_MINUTE)),Ze(this,"initialPublishTimeout",q.toMiliseconds(q.ONE_SECOND*15)),Ze(this,"needsTransportRestart",!1),Ze(this,"publish",async(n,i,s)=>{var o,c,l,u,d;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:n,message:i,opts:s}});const h=(s==null?void 0:s.ttl)||kg,p=(s==null?void 0:s.prompt)||!1,_=(s==null?void 0:s.tag)||0,f=(s==null?void 0:s.id)||Xt().toString(),m=vr(ei().protocol),y={id:f,method:(s==null?void 0:s.publishMethod)||m.publish,params:yr({topic:n,message:i,ttl:h,prompt:p,tag:_,attestation:s==null?void 0:s.attestation},(s==null?void 0:s.tvf)&&{tvf:s.tvf})},b=`Failed to publish payload, please try again. id:${f} tag:${_}`;try{fe((o=y.params)==null?void 0:o.prompt)&&((c=y.params)==null||delete c.prompt),fe((l=y.params)==null?void 0:l.tag)&&((u=y.params)==null||delete u.tag);const O=new Promise(async g=>{const P=({id:E})=>{var D;((D=y.id)==null?void 0:D.toString())===E.toString()&&(this.removeRequestFromQueue(E),this.relayer.events.removeListener(le.publish,P),g())};this.relayer.events.on(le.publish,P);const A=mt(new Promise((E,D)=>{this.rpcPublish(y,s).then(E).catch(L=>{this.logger.warn(L,L==null?void 0:L.message),D(L)})}),this.initialPublishTimeout,`Failed initial publish, retrying.... id:${f} tag:${_}`);try{await A,this.events.removeListener(le.publish,P)}catch(E){this.queue.set(f,{request:y,opts:s,attempt:1}),this.logger.warn(E,E==null?void 0:E.message)}});this.logger.trace({type:"method",method:"publish",params:{id:f,topic:n,message:i,opts:s}}),await mt(O,this.publishTimeout,b)}catch(O){if(this.logger.debug("Failed to Publish Payload"),this.logger.error(O),(d=s==null?void 0:s.internal)!=null&&d.throwOnFailedPublish)throw O}finally{this.queue.delete(f)}}),Ze(this,"publishCustom",async n=>{var i,s,o,c,l;this.logger.debug("Publishing custom payload"),this.logger.trace({type:"method",method:"publishCustom",params:n});const{payload:u,opts:d={}}=n,{attestation:h,tvf:p,publishMethod:_,prompt:f,tag:m,ttl:y=q.FIVE_MINUTES}=d,b=d.id||Xt().toString(),O=vr(ei().protocol),g=_||O.publish,P={id:b,method:g,params:yr(ic(yr({},u),{ttl:y,prompt:f,tag:m,attestation:h}),p)},A=`Failed to publish custom payload, please try again. id:${b} tag:${m}`;try{fe((i=P.params)==null?void 0:i.prompt)&&((s=P.params)==null||delete s.prompt),fe((o=P.params)==null?void 0:o.tag)&&((c=P.params)==null||delete c.tag);const E=new Promise(async D=>{const L=({id:v})=>{var I;((I=P.id)==null?void 0:I.toString())===v.toString()&&(this.removeRequestFromQueue(v),this.relayer.events.removeListener(le.publish,L),D())};this.relayer.events.on(le.publish,L);const w=mt(new Promise((v,I)=>{this.rpcPublish(P,d).then(v).catch(T=>{this.logger.warn(T,T==null?void 0:T.message),I(T)})}),this.initialPublishTimeout,`Failed initial custom payload publish, retrying.... method:${g} id:${b} tag:${m}`);try{await w,this.events.removeListener(le.publish,L)}catch(v){this.queue.set(b,{request:P,opts:d,attempt:1}),this.logger.warn(v,v==null?void 0:v.message)}});this.logger.trace({type:"method",method:"publish",params:{id:b,payload:u,opts:d}}),await mt(E,this.publishTimeout,A)}catch(E){if(this.logger.debug("Failed to Publish Payload"),this.logger.error(E),(l=d==null?void 0:d.internal)!=null&&l.throwOnFailedPublish)throw E}finally{this.queue.delete(b)}}),Ze(this,"on",(n,i)=>{this.events.on(n,i)}),Ze(this,"once",(n,i)=>{this.events.once(n,i)}),Ze(this,"off",(n,i)=>{this.events.off(n,i)}),Ze(this,"removeListener",(n,i)=>{this.events.removeListener(n,i)}),this.relayer=t,this.logger=Ce(e,this.name),this.registerEventListeners()}get context(){return Ke(this.logger)}async rpcPublish(t,e){this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:t});const n=await this.relayer.request(t);return this.relayer.events.emit(le.publish,yr(yr({},t),e)),this.logger.debug("Successfully Published Payload"),n}removeRequestFromQueue(t){this.queue.delete(t)}checkQueue(){this.queue.forEach(async(t,e)=>{var n;const i=t.attempt+1;this.queue.set(e,ic(yr({},t),{attempt:i})),this.logger.warn({},`Publisher: queue->publishing: ${t.request.id}, tag: ${(n=t.request.params)==null?void 0:n.tag}, attempt: ${i}`),await this.rpcPublish(t.request,t.opts),this.logger.warn({},`Publisher: queue->published: ${t.request.id}`)})}registerEventListeners(){this.relayer.core.heartbeat.on(Pr.pulse,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit(le.connection_stalled);return}this.checkQueue()}),this.relayer.on(le.message_ack,t=>{this.removeRequestFromQueue(t.id.toString())})}}var Y0=Object.defineProperty,Q0=(r,t,e)=>t in r?Y0(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,wr=(r,t,e)=>Q0(r,typeof t!="symbol"?t+"":t,e);class X0{constructor(){wr(this,"map",new Map),wr(this,"set",(t,e)=>{const n=this.get(t);this.exists(t,e)||this.map.set(t,[...n,e])}),wr(this,"get",t=>this.map.get(t)||[]),wr(this,"exists",(t,e)=>this.get(t).includes(e)),wr(this,"delete",(t,e)=>{if(typeof e>"u"){this.map.delete(t);return}if(!this.map.has(t))return;const n=this.get(t);if(!this.exists(t,e))return;const i=n.filter(s=>s!==e);if(!i.length){this.map.delete(t);return}this.map.set(t,i)}),wr(this,"clear",()=>{this.map.clear()})}get topics(){return Array.from(this.map.keys())}}var ev=Object.defineProperty,tv=Object.defineProperties,rv=Object.getOwnPropertyDescriptors,sc=Object.getOwnPropertySymbols,nv=Object.prototype.hasOwnProperty,iv=Object.prototype.propertyIsEnumerable,As=(r,t,e)=>t in r?ev(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,jr=(r,t)=>{for(var e in t||(t={}))nv.call(t,e)&&As(r,e,t[e]);if(sc)for(var e of sc(t))iv.call(t,e)&&As(r,e,t[e]);return r},Ni=(r,t)=>tv(r,rv(t)),ne=(r,t,e)=>As(r,typeof t!="symbol"?t+"":t,e);class sv extends u_{constructor(t,e){super(t,e),this.relayer=t,this.logger=e,ne(this,"subscriptions",new Map),ne(this,"topicMap",new X0),ne(this,"events",new ur.EventEmitter),ne(this,"name",Kg),ne(this,"version",Fg),ne(this,"pending",new Map),ne(this,"cached",[]),ne(this,"initialized",!1),ne(this,"storagePrefix",wt),ne(this,"subscribeTimeout",q.toMiliseconds(q.ONE_MINUTE)),ne(this,"initialSubscribeTimeout",q.toMiliseconds(q.ONE_SECOND*15)),ne(this,"clientId"),ne(this,"batchSubscribeTopicsLimit",500),ne(this,"init",async()=>{this.initialized||(this.logger.trace("Initialized"),this.registerEventListeners(),await this.restore()),this.initialized=!0}),ne(this,"subscribe",async(n,i)=>{var s;this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}});try{const o=ei(i),c={topic:n,relay:o,transportType:i==null?void 0:i.transportType};(s=i==null?void 0:i.internal)!=null&&s.skipSubscribe||this.pending.set(n,c);const l=await this.rpcSubscribe(n,o,i);return typeof l=="string"&&(this.onSubscribe(l,c),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}})),l}catch(o){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(o),o}}),ne(this,"unsubscribe",async(n,i)=>{this.isInitialized(),typeof(i==null?void 0:i.id)<"u"?await this.unsubscribeById(n,i.id,i):await this.unsubscribeByTopic(n,i)}),ne(this,"isSubscribed",n=>new Promise(i=>{i(this.topicMap.topics.includes(n))})),ne(this,"isKnownTopic",n=>new Promise(i=>{i(this.topicMap.topics.includes(n)||this.pending.has(n)||this.cached.some(s=>s.topic===n))})),ne(this,"on",(n,i)=>{this.events.on(n,i)}),ne(this,"once",(n,i)=>{this.events.once(n,i)}),ne(this,"off",(n,i)=>{this.events.off(n,i)}),ne(this,"removeListener",(n,i)=>{this.events.removeListener(n,i)}),ne(this,"start",async()=>{await this.onConnect()}),ne(this,"stop",async()=>{await this.onDisconnect()}),ne(this,"restart",async()=>{await this.restore(),await this.onRestart()}),ne(this,"checkPending",async()=>{if(this.pending.size===0&&(!this.initialized||!this.relayer.connected))return;const n=[];this.pending.forEach(i=>{n.push(i)}),await this.batchSubscribe(n)}),ne(this,"registerEventListeners",()=>{this.relayer.core.heartbeat.on(Pr.pulse,async()=>{await this.checkPending()}),this.events.on(We.created,async n=>{const i=We.created;this.logger.info(`Emitting ${i}`),this.logger.debug({type:"event",event:i,data:n}),await this.persist()}),this.events.on(We.deleted,async n=>{const i=We.deleted;this.logger.info(`Emitting ${i}`),this.logger.debug({type:"event",event:i,data:n}),await this.persist()})}),this.relayer=t,this.logger=Ce(e,this.name),this.clientId=""}get context(){return Ke(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(t,e){let n=!1;try{n=this.getSubscription(t).topic===e}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(t,e){const n=this.topicMap.get(t);await Promise.all(n.map(async i=>await this.unsubscribeById(t,i,e)))}async unsubscribeById(t,e,n){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:t,id:e,opts:n}});try{const i=ei(n);await this.restartToComplete({topic:t,id:e,relay:i}),await this.rpcUnsubscribe(t,e,i);const s=ae("USER_DISCONNECTED",`${this.name}, ${t}`);await this.onUnsubscribe(t,e,s),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:t,id:e,opts:n}})}catch(i){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(i),i}}async rpcSubscribe(t,e,n){var i,s;const o=await this.getSubscriptionId(t);if((i=n==null?void 0:n.internal)!=null&&i.skipSubscribe)return o;(!n||(n==null?void 0:n.transportType)===se.relay)&&await this.restartToComplete({topic:t,id:t,relay:e});const c={method:vr(e.protocol).subscribe,params:{topic:t}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:c});const l=(s=n==null?void 0:n.internal)==null?void 0:s.throwOnFailedPublish;try{if((n==null?void 0:n.transportType)===se.link_mode)return setTimeout(()=>{(this.relayer.connected||this.relayer.connecting)&&this.relayer.request(c).catch(h=>this.logger.warn(h))},q.toMiliseconds(q.ONE_SECOND)),o;const u=new Promise(async h=>{const p=_=>{_.topic===t&&(this.events.removeListener(We.created,p),h(_.id))};this.events.on(We.created,p);try{const _=await mt(new Promise((f,m)=>{this.relayer.request(c).catch(y=>{this.logger.warn(y,y==null?void 0:y.message),m(y)}).then(f)}),this.initialSubscribeTimeout,`Subscribing to ${t} failed, please try again`);this.events.removeListener(We.created,p),h(_)}catch{}}),d=await mt(u,this.subscribeTimeout,`Subscribing to ${t} failed, please try again`);if(!d&&l)throw new Error(`Subscribing to ${t} failed, please try again`);return d?o:null}catch(u){if(this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(le.connection_stalled),l)throw u}return null}async rpcBatchSubscribe(t){if(!t.length)return;const e=t[0].relay,n={method:vr(e.protocol).batchSubscribe,params:{topics:t.map(i=>i.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});try{await await mt(new Promise(i=>{this.relayer.request(n).catch(s=>this.logger.warn(s)).then(i)}),this.subscribeTimeout,"rpcBatchSubscribe failed, please try again")}catch{this.relayer.events.emit(le.connection_stalled)}}async rpcBatchFetchMessages(t){if(!t.length)return;const e=t[0].relay,n={method:vr(e.protocol).batchFetchMessages,params:{topics:t.map(s=>s.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});let i;try{i=await await mt(new Promise((s,o)=>{this.relayer.request(n).catch(c=>{this.logger.warn(c),o(c)}).then(s)}),this.subscribeTimeout,"rpcBatchFetchMessages failed, please try again")}catch{this.relayer.events.emit(le.connection_stalled)}return i}rpcUnsubscribe(t,e,n){const i={method:vr(n.protocol).unsubscribe,params:{topic:t,id:e}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i}),this.relayer.request(i)}onSubscribe(t,e){this.setSubscription(t,Ni(jr({},e),{id:t})),this.pending.delete(e.topic)}onBatchSubscribe(t){t.length&&t.forEach(e=>{this.setSubscription(e.id,jr({},e)),this.pending.delete(e.topic)})}async onUnsubscribe(t,e,n){this.events.removeAllListeners(e),this.hasSubscription(e,t)&&this.deleteSubscription(e,n),await this.relayer.messages.del(t)}async setRelayerSubscriptions(t){await this.relayer.core.storage.setItem(this.storageKey,t)}async getRelayerSubscriptions(){return await this.relayer.core.storage.getItem(this.storageKey)}setSubscription(t,e){this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:t,subscription:e}),this.addSubscription(t,e)}addSubscription(t,e){this.subscriptions.set(t,jr({},e)),this.topicMap.set(e.topic,t),this.events.emit(We.created,e)}getSubscription(t){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:t});const e=this.subscriptions.get(t);if(!e){const{message:n}=U("NO_MATCHING_KEY",`${this.name}: ${t}`);throw new Error(n)}return e}deleteSubscription(t,e){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:t,reason:e});const n=this.getSubscription(t);this.subscriptions.delete(t),this.topicMap.delete(n.topic,t),this.events.emit(We.deleted,Ni(jr({},n),{reason:e}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(We.sync)}async onRestart(){if(this.cached.length){const t=[...this.cached],e=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let n=0;n<e;n++){const i=t.splice(0,this.batchSubscribeTopicsLimit);await this.batchSubscribe(i)}}this.events.emit(We.resubscribed)}async restore(){try{const t=await this.getRelayerSubscriptions();if(typeof t>"u"||!t.length)return;if(this.subscriptions.size&&!t.every(e=>{var n;return e.topic===((n=this.subscriptions.get(e.id))==null?void 0:n.topic)})){const{message:e}=U("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(e)}this.cached=t,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:"method",method:"restore",subscriptions:this.values})}catch(t){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(t)}}async batchSubscribe(t){t.length&&(await this.rpcBatchSubscribe(t),this.onBatchSubscribe(await Promise.all(t.map(async e=>Ni(jr({},e),{id:await this.getSubscriptionId(e.topic)})))))}async batchFetchMessages(t){if(!t.length)return;this.logger.trace(`Fetching batch messages for ${t.length} subscriptions`);const e=await this.rpcBatchFetchMessages(t);e&&e.messages&&(await Nf(q.toMiliseconds(q.ONE_SECOND)),await this.relayer.handleBatchMessageEvents(e.messages))}async onConnect(){await this.restart(),this.reset()}onDisconnect(){this.onDisable()}isInitialized(){if(!this.initialized){const{message:t}=U("NOT_INITIALIZED",this.name);throw new Error(t)}}async restartToComplete(t){!this.relayer.connected&&!this.relayer.connecting&&(this.cached.push(t),await this.relayer.transportOpen())}async getClientId(){return this.clientId||(this.clientId=await this.relayer.core.crypto.getClientId()),this.clientId}async getSubscriptionId(t){return Qe(t+await this.getClientId())}}var ov=Object.defineProperty,oc=Object.getOwnPropertySymbols,av=Object.prototype.hasOwnProperty,cv=Object.prototype.propertyIsEnumerable,Ts=(r,t,e)=>t in r?ov(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,ac=(r,t)=>{for(var e in t||(t={}))av.call(t,e)&&Ts(r,e,t[e]);if(oc)for(var e of oc(t))cv.call(t,e)&&Ts(r,e,t[e]);return r},Q=(r,t,e)=>Ts(r,typeof t!="symbol"?t+"":t,e);class lv extends c_{constructor(t){super(t),Q(this,"protocol","wc"),Q(this,"version",2),Q(this,"core"),Q(this,"logger"),Q(this,"events",new ur.EventEmitter),Q(this,"provider"),Q(this,"messages"),Q(this,"subscriber"),Q(this,"publisher"),Q(this,"name",qg),Q(this,"transportExplicitlyClosed",!1),Q(this,"initialized",!1),Q(this,"connectionAttemptInProgress",!1),Q(this,"relayUrl"),Q(this,"projectId"),Q(this,"packageName"),Q(this,"bundleId"),Q(this,"hasExperiencedNetworkDisruption",!1),Q(this,"pingTimeout"),Q(this,"heartBeatTimeout",q.toMiliseconds(q.THIRTY_SECONDS+q.FIVE_SECONDS)),Q(this,"reconnectTimeout"),Q(this,"connectPromise"),Q(this,"reconnectInProgress",!1),Q(this,"requestsInFlight",[]),Q(this,"connectTimeout",q.toMiliseconds(q.ONE_SECOND*15)),Q(this,"request",async e=>{var n,i;this.logger.debug("Publishing Request Payload");const s=e.id||Xt().toString();await this.toEstablishConnection();try{this.logger.trace({id:s,method:e.method,topic:(n=e.params)==null?void 0:n.topic},"relayer.request - publishing...");const o=`${s}:${((i=e.params)==null?void 0:i.tag)||""}`;this.requestsInFlight.push(o);const c=await this.provider.request(e);return this.requestsInFlight=this.requestsInFlight.filter(l=>l!==o),c}catch(o){throw this.logger.debug(`Failed to Publish Request: ${s}`),o}}),Q(this,"resetPingTimeout",()=>{Zn()&&(clearTimeout(this.pingTimeout),this.pingTimeout=setTimeout(()=>{var e,n,i,s;try{this.logger.debug({},"pingTimeout: Connection stalled, terminating..."),(s=(i=(n=(e=this.provider)==null?void 0:e.connection)==null?void 0:n.socket)==null?void 0:i.terminate)==null||s.call(i)}catch(o){this.logger.warn(o,o==null?void 0:o.message)}},this.heartBeatTimeout))}),Q(this,"onPayloadHandler",e=>{this.onProviderPayload(e),this.resetPingTimeout()}),Q(this,"onConnectHandler",()=>{this.logger.warn({},"Relayer connected 🛜"),this.startPingTimeout(),this.events.emit(le.connect)}),Q(this,"onDisconnectHandler",()=>{this.logger.warn({},"Relayer disconnected 🛑"),this.requestsInFlight=[],this.onProviderDisconnect()}),Q(this,"onProviderErrorHandler",e=>{this.logger.fatal(`Fatal socket error: ${e.message}`),this.events.emit(le.error,e),this.logger.fatal("Fatal socket error received, closing transport"),this.transportClose()}),Q(this,"registerProviderListeners",()=>{this.provider.on(Je.payload,this.onPayloadHandler),this.provider.on(Je.connect,this.onConnectHandler),this.provider.on(Je.disconnect,this.onDisconnectHandler),this.provider.on(Je.error,this.onProviderErrorHandler)}),this.core=t.core,this.logger=typeof t.logger<"u"&&typeof t.logger!="string"?Ce(t.logger,this.name):oi(Qs({level:t.logger||Ug})),this.messages=new K0(this.logger,t.core),this.subscriber=new sv(this,this.logger),this.publisher=new Z0(this,this.logger),this.projectId=t==null?void 0:t.projectId,this.relayUrl=(t==null?void 0:t.relayUrl)||Ru,vf()?this.packageName=na():bf()&&(this.bundleId=na()),this.provider={}}async init(){this.logger.trace("Initialized"),this.registerEventListeners(),await Promise.all([this.messages.init(),this.subscriber.init()]),this.initialized=!0,this.transportOpen().catch(t=>this.logger.warn(t,t==null?void 0:t.message))}get context(){return Ke(this.logger)}get connected(){var t,e,n;return((n=(e=(t=this.provider)==null?void 0:t.connection)==null?void 0:e.socket)==null?void 0:n.readyState)===1||!1}get connecting(){var t,e,n;return((n=(e=(t=this.provider)==null?void 0:t.connection)==null?void 0:e.socket)==null?void 0:n.readyState)===0||this.connectPromise!==void 0||!1}async publish(t,e,n){this.isInitialized(),await this.publisher.publish(t,e,n),await this.recordMessageEvent({topic:t,message:e,publishedAt:Date.now(),transportType:se.relay},kn.outbound)}async publishCustom(t){this.isInitialized(),await this.publisher.publishCustom(t)}async subscribe(t,e){var n,i,s;this.isInitialized(),(!(e!=null&&e.transportType)||(e==null?void 0:e.transportType)==="relay")&&await this.toEstablishConnection();const o=typeof((n=e==null?void 0:e.internal)==null?void 0:n.throwOnFailedPublish)>"u"?!0:(i=e==null?void 0:e.internal)==null?void 0:i.throwOnFailedPublish;let c=((s=this.subscriber.topicMap.get(t))==null?void 0:s[0])||"",l;const u=d=>{d.topic===t&&(this.subscriber.off(We.created,u),l())};return await Promise.all([new Promise(d=>{l=d,this.subscriber.on(We.created,u)}),new Promise(async(d,h)=>{c=await this.subscriber.subscribe(t,ac({internal:{throwOnFailedPublish:o}},e)).catch(p=>{o&&h(p)})||c,d()})]),c}async unsubscribe(t,e){this.isInitialized(),await this.subscriber.unsubscribe(t,e)}on(t,e){this.events.on(t,e)}once(t,e){this.events.once(t,e)}off(t,e){this.events.off(t,e)}removeListener(t,e){this.events.removeListener(t,e)}async transportDisconnect(){this.provider.disconnect&&(this.hasExperiencedNetworkDisruption||this.connected)?await mt(this.provider.disconnect(),2e3,"provider.disconnect()").catch(()=>this.onProviderDisconnect()):this.onProviderDisconnect()}async transportClose(){this.transportExplicitlyClosed=!0,await this.transportDisconnect()}async transportOpen(t){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(e,n)=>{await this.connect(t).then(e).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(t){this.logger.debug({},"Restarting transport..."),!this.connectionAttemptInProgress&&(this.relayUrl=t||this.relayUrl,await this.confirmOnlineStateOrThrow(),await this.transportClose(),await this.transportOpen())}async confirmOnlineStateOrThrow(){if(!await Ha())throw new Error("No internet connection detected. Please restart your network and try again.")}async handleBatchMessageEvents(t){if((t==null?void 0:t.length)===0){this.logger.trace("Batch message events is empty. Ignoring...");return}const e=t.sort((n,i)=>n.publishedAt-i.publishedAt);this.logger.debug(`Batch of ${e.length} message events sorted`);for(const n of e)try{await this.onMessageEvent(n)}catch(i){this.logger.warn(i,"Error while processing batch message event: "+(i==null?void 0:i.message))}this.logger.trace(`Batch of ${e.length} message events processed`)}async onLinkMessageEvent(t,e){const{topic:n}=t;if(!e.sessionExists){const i=_e(q.FIVE_MINUTES),s={topic:n,expiry:i,relay:{protocol:"irn"},active:!1};await this.core.pairing.pairings.set(n,s)}this.events.emit(le.message,t),await this.recordMessageEvent(t,kn.inbound)}async connect(t){await this.confirmOnlineStateOrThrow(),t&&t!==this.relayUrl&&(this.relayUrl=t,await this.transportDisconnect()),this.connectionAttemptInProgress=!0,this.transportExplicitlyClosed=!1;let e=1;for(;e<6;){try{if(this.transportExplicitlyClosed)break;this.logger.debug({},`Connecting to ${this.relayUrl}, attempt: ${e}...`),await this.createProvider(),await new Promise(async(n,i)=>{const s=()=>{i(new Error("Connection interrupted while trying to connect"))};this.provider.once(Je.disconnect,s),await mt(new Promise((o,c)=>{this.provider.connect().then(o).catch(c)}),this.connectTimeout,`Socket stalled when trying to connect to ${this.relayUrl}`).catch(o=>{i(o)}).finally(()=>{this.provider.off(Je.disconnect,s),clearTimeout(this.reconnectTimeout)}),await new Promise(async(o,c)=>{const l=()=>{i(new Error("Connection interrupted while trying to subscribe"))};this.provider.once(Je.disconnect,l),await this.subscriber.start().then(o).catch(c).finally(()=>{this.provider.off(Je.disconnect,l)})}),this.hasExperiencedNetworkDisruption=!1,n()})}catch(n){await this.subscriber.stop();const i=n;this.logger.warn({},i.message),this.hasExperiencedNetworkDisruption=!0}finally{this.connectionAttemptInProgress=!1}if(this.connected){this.logger.debug({},`Connected to ${this.relayUrl} successfully on attempt: ${e}`);break}await new Promise(n=>setTimeout(n,q.toMiliseconds(e*1))),e++}}startPingTimeout(){var t,e,n,i,s;if(Zn())try{(e=(t=this.provider)==null?void 0:t.connection)!=null&&e.socket&&((s=(i=(n=this.provider)==null?void 0:n.connection)==null?void 0:i.socket)==null||s.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 t=await this.core.crypto.signJWT(this.relayUrl);this.provider=new rh(new nh(Of({sdkVersion:gs,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:t,useOnCloseEvent:!0,bundleId:this.bundleId,packageName:this.packageName}))),this.registerProviderListeners()}async recordMessageEvent(t,e){const{topic:n,message:i}=t;await this.messages.set(n,i,e)}async shouldIgnoreMessageEvent(t){const{topic:e,message:n}=t;if(!n||n.length===0)return this.logger.warn(`Ignoring invalid/empty message: ${n}`),!0;if(!await this.subscriber.isKnownTopic(e))return this.logger.warn(`Ignoring message for unknown topic ${e}`),!0;const i=this.messages.has(e,n);return i&&this.logger.warn(`Ignoring duplicate message: ${n}`),i}async onProviderPayload(t){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:t}),qs(t)){if(!t.method.endsWith(Mg))return;const e=t.params,{topic:n,message:i,publishedAt:s,attestation:o}=e.data,c={topic:n,message:i,publishedAt:s,transportType:se.relay,attestation:o};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(ac({type:"event",event:e.id},c)),this.events.emit(e.id,c),await this.acknowledgePayload(t),await this.onMessageEvent(c)}else Ms(t)&&this.events.emit(le.message_ack,t)}async onMessageEvent(t){await this.shouldIgnoreMessageEvent(t)||(await this.recordMessageEvent(t,kn.inbound),this.events.emit(le.message,t))}async acknowledgePayload(t){const e=Bn(t.id,!0);await this.provider.connection.send(e)}unregisterProviderListeners(){this.provider.off(Je.payload,this.onPayloadHandler),this.provider.off(Je.connect,this.onConnectHandler),this.provider.off(Je.disconnect,this.onDisconnectHandler),this.provider.off(Je.error,this.onProviderErrorHandler),clearTimeout(this.pingTimeout)}async registerEventListeners(){let t=await Ha();fg(async e=>{t!==e&&(t=e,e?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(Pr.pulse,async()=>{if(!this.transportExplicitlyClosed&&!this.connected&&wg())try{await this.confirmOnlineStateOrThrow(),await this.transportOpen()}catch(e){this.logger.warn(e,e==null?void 0:e.message)}})}async onProviderDisconnect(){clearTimeout(this.pingTimeout),this.events.emit(le.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(t=>this.logger.error(t,t==null?void 0:t.message)),this.reconnectTimeout=void 0,this.reconnectInProgress=!1},q.toMiliseconds(Bg)))))}isInitialized(){if(!this.initialized){const{message:t}=U("NOT_INITIALIZED",this.name);throw new Error(t)}}async toEstablishConnection(){if(await this.confirmOnlineStateOrThrow(),!this.connected){if(this.connectPromise){await this.connectPromise;return}await this.connect()}}}function uv(r,t){return r===t||Number.isNaN(r)&&Number.isNaN(t)}function cc(r){return Object.getOwnPropertySymbols(r).filter(t=>Object.prototype.propertyIsEnumerable.call(r,t))}function lc(r){return r==null?r===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(r)}const dv="[object RegExp]",hv="[object String]",pv="[object Number]",_v="[object Boolean]",uc="[object Arguments]",fv="[object Symbol]",mv="[object Date]",yv="[object Map]",wv="[object Set]",gv="[object Array]",Ev="[object Function]",vv="[object ArrayBuffer]",Ui="[object Object]",bv="[object Error]",Iv="[object DataView]",Av="[object Uint8Array]",Tv="[object Uint8ClampedArray]",Pv="[object Uint16Array]",Ov="[object Uint32Array]",Rv="[object BigUint64Array]",Lv="[object Int8Array]",Dv="[object Int16Array]",Vv="[object Int32Array]",Sv="[object BigInt64Array]",xv="[object Float32Array]",Cv="[object Float64Array]";function $v(){}function dc(r){if(!r||typeof r!="object")return!1;const t=Object.getPrototypeOf(r);return t===null||t===Object.prototype||Object.getPrototypeOf(t)===null?Object.prototype.toString.call(r)==="[object Object]":!1}function kv(r,t,e){return Hr(r,t,void 0,void 0,void 0,void 0,e)}function Hr(r,t,e,n,i,s,o){const c=o(r,t,e,n,i,s);if(c!==void 0)return c;if(typeof r==typeof t)switch(typeof r){case"bigint":case"string":case"boolean":case"symbol":case"undefined":return r===t;case"number":return r===t||Object.is(r,t);case"function":return r===t;case"object":return en(r,t,s,o)}return en(r,t,s,o)}function en(r,t,e,n){if(Object.is(r,t))return!0;let i=lc(r),s=lc(t);if(i===uc&&(i=Ui),s===uc&&(s=Ui),i!==s)return!1;switch(i){case hv:return r.toString()===t.toString();case pv:{const l=r.valueOf(),u=t.valueOf();return uv(l,u)}case _v:case mv:case fv:return Object.is(r.valueOf(),t.valueOf());case dv:return r.source===t.source&&r.flags===t.flags;case Ev:return r===t}e=e??new Map;const o=e.get(r),c=e.get(t);if(o!=null&&c!=null)return o===t;e.set(r,t),e.set(t,r);try{switch(i){case yv:{if(r.size!==t.size)return!1;for(const[l,u]of r.entries())if(!t.has(l)||!Hr(u,t.get(l),l,r,t,e,n))return!1;return!0}case wv:{if(r.size!==t.size)return!1;const l=Array.from(r.values()),u=Array.from(t.values());for(let d=0;d<l.length;d++){const h=l[d],p=u.findIndex(_=>Hr(h,_,void 0,r,t,e,n));if(p===-1)return!1;u.splice(p,1)}return!0}case gv:case Av:case Tv:case Pv:case Ov:case Rv:case Lv:case Dv:case Vv:case Sv:case xv:case Cv:{if(typeof re<"u"&&re.isBuffer(r)!==re.isBuffer(t)||r.length!==t.length)return!1;for(let l=0;l<r.length;l++)if(!Hr(r[l],t[l],l,r,t,e,n))return!1;return!0}case vv:return r.byteLength!==t.byteLength?!1:en(new Uint8Array(r),new Uint8Array(t),e,n);case Iv:return r.byteLength!==t.byteLength||r.byteOffset!==t.byteOffset?!1:en(new Uint8Array(r),new Uint8Array(t),e,n);case bv:return r.name===t.name&&r.message===t.message;case Ui:{if(!(en(r.constructor,t.constructor,e,n)||dc(r)&&dc(t)))return!1;const l=[...Object.keys(r),...cc(r)],u=[...Object.keys(t),...cc(t)];if(l.length!==u.length)return!1;for(let d=0;d<l.length;d++){const h=l[d],p=r[h];if(!Object.hasOwn(t,h))return!1;const _=t[h];if(!Hr(p,_,h,r,t,e,n))return!1}return!0}default:return!1}}finally{e.delete(r),e.delete(t)}}function Nv(r,t){return kv(r,t,$v)}var Uv=Object.defineProperty,hc=Object.getOwnPropertySymbols,qv=Object.prototype.hasOwnProperty,Mv=Object.prototype.propertyIsEnumerable,Ps=(r,t,e)=>t in r?Uv(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,pc=(r,t)=>{for(var e in t||(t={}))qv.call(t,e)&&Ps(r,e,t[e]);if(hc)for(var e of hc(t))Mv.call(t,e)&&Ps(r,e,t[e]);return r},$e=(r,t,e)=>Ps(r,typeof t!="symbol"?t+"":t,e);class pr extends l_{constructor(t,e,n,i=wt,s=void 0){super(t,e,n,i),this.core=t,this.logger=e,this.name=n,$e(this,"map",new Map),$e(this,"version",jg),$e(this,"cached",[]),$e(this,"initialized",!1),$e(this,"getKey"),$e(this,"storagePrefix",wt),$e(this,"recentlyDeleted",[]),$e(this,"recentlyDeletedLimit",200),$e(this,"init",async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(o=>{this.getKey&&o!==null&&!fe(o)?this.map.set(this.getKey(o),o):Ww(o)?this.map.set(o.id,o):Hw(o)&&this.map.set(o.topic,o)}),this.cached=[],this.initialized=!0)}),$e(this,"set",async(o,c)=>{this.isInitialized(),this.map.has(o)?await this.update(o,c):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:o,value:c}),this.map.set(o,c),await this.persist())}),$e(this,"get",o=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:o}),this.getData(o))),$e(this,"getAll",o=>(this.isInitialized(),o?this.values.filter(c=>Object.keys(o).every(l=>Nv(c[l],o[l]))):this.values)),$e(this,"update",async(o,c)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:o,update:c});const l=pc(pc({},this.getData(o)),c);this.map.set(o,l),await this.persist()}),$e(this,"delete",async(o,c)=>{this.isInitialized(),this.map.has(o)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:o,reason:c}),this.map.delete(o),this.addToRecentlyDeleted(o),await this.persist())}),this.logger=Ce(e,this.name),this.storagePrefix=i,this.getKey=s}get context(){return Ke(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(t){this.recentlyDeleted.push(t),this.recentlyDeleted.length>=this.recentlyDeletedLimit&&this.recentlyDeleted.splice(0,this.recentlyDeletedLimit/2)}async setDataStore(t){await this.core.storage.setItem(this.storageKey,t)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(t){const e=this.map.get(t);if(!e){if(this.recentlyDeleted.includes(t)){const{message:i}=U("MISSING_OR_INVALID",`Record was recently deleted - ${this.name}: ${t}`);throw this.logger.error(i),new Error(i)}const{message:n}=U("NO_MATCHING_KEY",`${this.name}: ${t}`);throw this.logger.error(n),new Error(n)}return e}async persist(){await this.setDataStore(this.values)}async restore(){try{const t=await this.getDataStore();if(typeof t>"u"||!t.length)return;if(this.map.size){const{message:e}=U("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),new Error(e)}this.cached=t,this.logger.debug(`Successfully Restored value for ${this.name}`),this.logger.trace({type:"method",method:"restore",value:this.values})}catch(t){this.logger.debug(`Failed to Restore value for ${this.name}`),this.logger.error(t)}}isInitialized(){if(!this.initialized){const{message:t}=U("NOT_INITIALIZED",this.name);throw new Error(t)}}}var Bv=Object.defineProperty,jv=(r,t,e)=>t in r?Bv(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,G=(r,t,e)=>jv(r,typeof t!="symbol"?t+"":t,e);class zv{constructor(t,e){this.core=t,this.logger=e,G(this,"name",Wg),G(this,"version",Hg),G(this,"events",new Mc),G(this,"pairings"),G(this,"initialized",!1),G(this,"storagePrefix",wt),G(this,"ignoredPayloadTypes",[Ot]),G(this,"registeredMethods",[]),G(this,"init",async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"))}),G(this,"register",({methods:n})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...n])]}),G(this,"create",async n=>{this.isInitialized();const i=ms(),s=await this.core.crypto.setSymKey(i),o=_e(q.FIVE_MINUTES),c={protocol:Ou},l={topic:s,expiry:o,relay:c,active:!1,methods:n==null?void 0:n.methods},u=Ua({protocol:this.core.protocol,version:this.core.version,topic:s,symKey:i,relay:c,expiryTimestamp:o,methods:n==null?void 0:n.methods});return this.events.emit(Qt.create,l),this.core.expirer.set(s,o),await this.pairings.set(s,l),await this.core.relayer.subscribe(s,{transportType:n==null?void 0:n.transportType,internal:n==null?void 0:n.internal}),{topic:s,uri:u}}),G(this,"pair",async n=>{this.isInitialized();const i=this.core.eventClient.createEvent({properties:{topic:n==null?void 0:n.uri,trace:[pt.pairing_started]}});this.isValidPair(n,i);const{topic:s,symKey:o,relay:c,expiryTimestamp:l,methods:u}=Na(n.uri);i.props.properties.topic=s,i.addTrace(pt.pairing_uri_validation_success),i.addTrace(pt.pairing_uri_not_expired);let d;if(this.pairings.keys.includes(s)){if(d=this.pairings.get(s),i.addTrace(pt.existing_pairing),d.active)throw i.setError(At.active_pairing_already_exists),new Error(`Pairing already exists: ${s}. Please try again with a new connection URI.`);i.addTrace(pt.pairing_not_expired)}const h=l||_e(q.FIVE_MINUTES),p={topic:s,relay:c,expiry:h,active:!1,methods:u};this.core.expirer.set(s,h),await this.pairings.set(s,p),i.addTrace(pt.store_new_pairing),n.activatePairing&&await this.activate({topic:s}),this.events.emit(Qt.create,p),i.addTrace(pt.emit_inactive_pairing),this.core.crypto.keychain.has(s)||await this.core.crypto.setSymKey(o,s),i.addTrace(pt.subscribing_pairing_topic);try{await this.core.relayer.confirmOnlineStateOrThrow()}catch{i.setError(At.no_internet_connection)}try{await this.core.relayer.subscribe(s,{relay:c})}catch(_){throw i.setError(At.subscribe_pairing_topic_failure),_}return i.addTrace(pt.subscribe_pairing_topic_success),p}),G(this,"activate",async({topic:n})=>{this.isInitialized();const i=_e(q.FIVE_MINUTES);this.core.expirer.set(n,i),await this.pairings.update(n,{active:!0,expiry:i})}),G(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:i}=n;if(this.pairings.keys.includes(i)){const s=await this.sendRequest(i,"wc_pairingPing",{}),{done:o,resolve:c,reject:l}=Yt();this.events.once(ee("pairing_ping",s),({error:u})=>{u?l(u):c()}),await o()}}),G(this,"updateExpiry",async({topic:n,expiry:i})=>{this.isInitialized(),await this.pairings.update(n,{expiry:i})}),G(this,"updateMetadata",async({topic:n,metadata:i})=>{this.isInitialized(),await this.pairings.update(n,{peerMetadata:i})}),G(this,"getPairings",()=>(this.isInitialized(),this.pairings.values)),G(this,"disconnect",async n=>{this.isInitialized(),await this.isValidDisconnect(n);const{topic:i}=n;this.pairings.keys.includes(i)&&(await this.sendRequest(i,"wc_pairingDelete",ae("USER_DISCONNECTED")),await this.deletePairing(i))}),G(this,"formatUriFromPairing",n=>{this.isInitialized();const{topic:i,relay:s,expiry:o,methods:c}=n,l=this.core.crypto.keychain.get(i);return Ua({protocol:this.core.protocol,version:this.core.version,topic:i,symKey:l,relay:s,expiryTimestamp:o,methods:c})}),G(this,"sendRequest",async(n,i,s)=>{const o=Ut(i,s),c=await this.core.crypto.encode(n,o),l=qr[i].req;return this.core.history.set(n,o),this.core.relayer.publish(n,c,l),o.id}),G(this,"sendResult",async(n,i,s)=>{const o=Bn(n,s),c=await this.core.crypto.encode(i,o),l=(await this.core.history.get(i,n)).request.method,u=qr[l].res;await this.core.relayer.publish(i,c,u),await this.core.history.resolve(o)}),G(this,"sendError",async(n,i,s)=>{const o=Bc(n,s),c=await this.core.crypto.encode(i,o),l=(await this.core.history.get(i,n)).request.method,u=qr[l]?qr[l].res:qr.unregistered_method.res;await this.core.relayer.publish(i,c,u),await this.core.history.resolve(o)}),G(this,"deletePairing",async(n,i)=>{await this.core.relayer.unsubscribe(n),await Promise.all([this.pairings.delete(n,ae("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(n),i?Promise.resolve():this.core.expirer.del(n)])}),G(this,"cleanup",async()=>{const n=this.pairings.getAll().filter(i=>qt(i.expiry));await Promise.all(n.map(i=>this.deletePairing(i.topic)))}),G(this,"onRelayEventRequest",async n=>{const{topic:i,payload:s}=n;switch(s.method){case"wc_pairingPing":return await this.onPairingPingRequest(i,s);case"wc_pairingDelete":return await this.onPairingDeleteRequest(i,s);default:return await this.onUnknownRpcMethodRequest(i,s)}}),G(this,"onRelayEventResponse",async n=>{const{topic:i,payload:s}=n,o=(await this.core.history.get(i,s.id)).request.method;switch(o){case"wc_pairingPing":return this.onPairingPingResponse(i,s);default:return this.onUnknownRpcMethodResponse(o)}}),G(this,"onPairingPingRequest",async(n,i)=>{const{id:s}=i;try{this.isValidPing({topic:n}),await this.sendResult(s,n,!0),this.events.emit(Qt.ping,{id:s,topic:n})}catch(o){await this.sendError(s,n,o),this.logger.error(o)}}),G(this,"onPairingPingResponse",(n,i)=>{const{id:s}=i;setTimeout(()=>{bt(i)?this.events.emit(ee("pairing_ping",s),{}):_t(i)&&this.events.emit(ee("pairing_ping",s),{error:i.error})},500)}),G(this,"onPairingDeleteRequest",async(n,i)=>{const{id:s}=i;try{this.isValidDisconnect({topic:n}),await this.deletePairing(n),this.events.emit(Qt.delete,{id:s,topic:n})}catch(o){await this.sendError(s,n,o),this.logger.error(o)}}),G(this,"onUnknownRpcMethodRequest",async(n,i)=>{const{id:s,method:o}=i;try{if(this.registeredMethods.includes(o))return;const c=ae("WC_METHOD_UNSUPPORTED",o);await this.sendError(s,n,c),this.logger.error(c)}catch(c){await this.sendError(s,n,c),this.logger.error(c)}}),G(this,"onUnknownRpcMethodResponse",n=>{this.registeredMethods.includes(n)||this.logger.error(ae("WC_METHOD_UNSUPPORTED",n))}),G(this,"isValidPair",(n,i)=>{var s;if(!Ne(n)){const{message:c}=U("MISSING_OR_INVALID",`pair() params: ${n}`);throw i.setError(At.malformed_pairing_uri),new Error(c)}if(!Fw(n.uri)){const{message:c}=U("MISSING_OR_INVALID",`pair() uri: ${n.uri}`);throw i.setError(At.malformed_pairing_uri),new Error(c)}const o=Na(n==null?void 0:n.uri);if(!((s=o==null?void 0:o.relay)!=null&&s.protocol)){const{message:c}=U("MISSING_OR_INVALID","pair() uri#relay-protocol");throw i.setError(At.malformed_pairing_uri),new Error(c)}if(!(o!=null&&o.symKey)){const{message:c}=U("MISSING_OR_INVALID","pair() uri#symKey");throw i.setError(At.malformed_pairing_uri),new Error(c)}if(o!=null&&o.expiryTimestamp&&q.toMiliseconds(o==null?void 0:o.expiryTimestamp)<Date.now()){i.setError(At.pairing_expired);const{message:c}=U("EXPIRED","pair() URI has expired. Please try again with a new connection URI.");throw new Error(c)}}),G(this,"isValidPing",async n=>{if(!Ne(n)){const{message:s}=U("MISSING_OR_INVALID",`ping() params: ${n}`);throw new Error(s)}const{topic:i}=n;await this.isValidPairingTopic(i)}),G(this,"isValidDisconnect",async n=>{if(!Ne(n)){const{message:s}=U("MISSING_OR_INVALID",`disconnect() params: ${n}`);throw new Error(s)}const{topic:i}=n;await this.isValidPairingTopic(i)}),G(this,"isValidPairingTopic",async n=>{if(!he(n,!1)){const{message:i}=U("MISSING_OR_INVALID",`pairing topic should be a string: ${n}`);throw new Error(i)}if(!this.pairings.keys.includes(n)){const{message:i}=U("NO_MATCHING_KEY",`pairing topic doesn't exist: ${n}`);throw new Error(i)}if(qt(this.pairings.get(n).expiry)){await this.deletePairing(n);const{message:i}=U("EXPIRED",`pairing topic: ${n}`);throw new Error(i)}}),this.core=t,this.logger=Ce(e,this.name),this.pairings=new pr(this.core,this.logger,this.name,this.storagePrefix)}get context(){return Ke(this.logger)}isInitialized(){if(!this.initialized){const{message:t}=U("NOT_INITIALIZED",this.name);throw new Error(t)}}registerRelayerEvents(){this.core.relayer.on(le.message,async t=>{const{topic:e,message:n,transportType:i}=t;if(this.pairings.keys.includes(e)&&i!==se.link_mode&&!this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(n)))try{const s=await this.core.crypto.decode(e,n);qs(s)?(this.core.history.set(e,s),await this.onRelayEventRequest({topic:e,payload:s})):Ms(s)&&(await this.core.history.resolve(s),await this.onRelayEventResponse({topic:e,payload:s}),this.core.history.delete(e,s.id)),await this.core.relayer.messages.ack(e,n)}catch(s){this.logger.error(s)}})}registerExpirerEvents(){this.core.expirer.on(Ye.expired,async t=>{const{topic:e}=Vl(t.target);e&&this.pairings.keys.includes(e)&&(await this.deletePairing(e,!0),this.events.emit(Qt.expire,{topic:e}))})}}var Kv=Object.defineProperty,Fv=(r,t,e)=>t in r?Kv(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,be=(r,t,e)=>Fv(r,typeof t!="symbol"?t+"":t,e);class Wv extends s_{constructor(t,e){super(t,e),this.core=t,this.logger=e,be(this,"records",new Map),be(this,"events",new ur.EventEmitter),be(this,"name",Gg),be(this,"version",Jg),be(this,"cached",[]),be(this,"initialized",!1),be(this,"storagePrefix",wt),be(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)}),be(this,"set",(n,i,s)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:n,request:i,chainId:s}),this.records.has(i.id))return;const o={id:i.id,topic:n,request:{method:i.method,params:i.params||null},chainId:s,expiry:_e(q.THIRTY_DAYS)};this.records.set(o.id,o),this.persist(),this.events.emit(nt.created,o)}),be(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 i=await this.getRecord(n.id);typeof i.response>"u"&&(i.response=_t(n)?{error:n.error}:{result:n.result},this.records.set(i.id,i),this.persist(),this.events.emit(nt.updated,i))}),be(this,"get",async(n,i)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:n,id:i}),await this.getRecord(i))),be(this,"delete",(n,i)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:i}),this.values.forEach(s=>{if(s.topic===n){if(typeof i<"u"&&s.id!==i)return;this.records.delete(s.id),this.events.emit(nt.deleted,s)}}),this.persist()}),be(this,"exists",async(n,i)=>(this.isInitialized(),this.records.has(i)?(await this.getRecord(i)).topic===n:!1)),be(this,"on",(n,i)=>{this.events.on(n,i)}),be(this,"once",(n,i)=>{this.events.once(n,i)}),be(this,"off",(n,i)=>{this.events.off(n,i)}),be(this,"removeListener",(n,i)=>{this.events.removeListener(n,i)}),this.logger=Ce(e,this.name)}get context(){return Ke(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 t=[];return this.values.forEach(e=>{if(typeof e.response<"u")return;const n={topic:e.topic,request:Ut(e.request.method,e.request.params,e.id),chainId:e.chainId};return t.push(n)}),t}async setJsonRpcRecords(t){await this.core.storage.setItem(this.storageKey,t)}async getJsonRpcRecords(){return await this.core.storage.getItem(this.storageKey)}getRecord(t){this.isInitialized();const e=this.records.get(t);if(!e){const{message:n}=U("NO_MATCHING_KEY",`${this.name}: ${t}`);throw new Error(n)}return e}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(nt.sync)}async restore(){try{const t=await this.getJsonRpcRecords();if(typeof t>"u"||!t.length)return;if(this.records.size){const{message:e}=U("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),new Error(e)}this.cached=t,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",records:this.values})}catch(t){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(t)}}registerEventListeners(){this.events.on(nt.created,t=>{const e=nt.created;this.logger.info(`Emitting ${e}`),this.logger.debug({type:"event",event:e,record:t})}),this.events.on(nt.updated,t=>{const e=nt.updated;this.logger.info(`Emitting ${e}`),this.logger.debug({type:"event",event:e,record:t})}),this.events.on(nt.deleted,t=>{const e=nt.deleted;this.logger.info(`Emitting ${e}`),this.logger.debug({type:"event",event:e,record:t})}),this.core.heartbeat.on(Pr.pulse,()=>{this.cleanup()})}cleanup(){try{this.isInitialized();let t=!1;this.records.forEach(e=>{q.toMiliseconds(e.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${e.id}`),this.records.delete(e.id),this.events.emit(nt.deleted,e,!1),t=!0)}),t&&this.persist()}catch(t){this.logger.warn(t)}}isInitialized(){if(!this.initialized){const{message:t}=U("NOT_INITIALIZED",this.name);throw new Error(t)}}}var Hv=Object.defineProperty,Gv=(r,t,e)=>t in r?Hv(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Re=(r,t,e)=>Gv(r,typeof t!="symbol"?t+"":t,e);class Jv extends d_{constructor(t,e){super(t,e),this.core=t,this.logger=e,Re(this,"expirations",new Map),Re(this,"events",new ur.EventEmitter),Re(this,"name",Zg),Re(this,"version",Yg),Re(this,"cached",[]),Re(this,"initialized",!1),Re(this,"storagePrefix",wt),Re(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)}),Re(this,"has",n=>{try{const i=this.formatTarget(n);return typeof this.getExpiration(i)<"u"}catch{return!1}}),Re(this,"set",(n,i)=>{this.isInitialized();const s=this.formatTarget(n),o={target:s,expiry:i};this.expirations.set(s,o),this.checkExpiry(s,o),this.events.emit(Ye.created,{target:s,expiration:o})}),Re(this,"get",n=>{this.isInitialized();const i=this.formatTarget(n);return this.getExpiration(i)}),Re(this,"del",n=>{if(this.isInitialized(),this.has(n)){const i=this.formatTarget(n),s=this.getExpiration(i);this.expirations.delete(i),this.events.emit(Ye.deleted,{target:i,expiration:s})}}),Re(this,"on",(n,i)=>{this.events.on(n,i)}),Re(this,"once",(n,i)=>{this.events.once(n,i)}),Re(this,"off",(n,i)=>{this.events.off(n,i)}),Re(this,"removeListener",(n,i)=>{this.events.removeListener(n,i)}),this.logger=Ce(e,this.name)}get context(){return Ke(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(t){if(typeof t=="string")return Rf(t);if(typeof t=="number")return Lf(t);const{message:e}=U("UNKNOWN_TYPE",`Target type: ${typeof t}`);throw new Error(e)}async setExpirations(t){await this.core.storage.setItem(this.storageKey,t)}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit(Ye.sync)}async restore(){try{const t=await this.getExpirations();if(typeof t>"u"||!t.length)return;if(this.expirations.size){const{message:e}=U("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),new Error(e)}this.cached=t,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values})}catch(t){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(t)}}getExpiration(t){const e=this.expirations.get(t);if(!e){const{message:n}=U("NO_MATCHING_KEY",`${this.name}: ${t}`);throw this.logger.warn(n),new Error(n)}return e}checkExpiry(t,e){const{expiry:n}=e;q.toMiliseconds(n)-Date.now()<=0&&this.expire(t,e)}expire(t,e){this.expirations.delete(t),this.events.emit(Ye.expired,{target:t,expiration:e})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((t,e)=>this.checkExpiry(e,t))}registerEventListeners(){this.core.heartbeat.on(Pr.pulse,()=>this.checkExpirations()),this.events.on(Ye.created,t=>{const e=Ye.created;this.logger.info(`Emitting ${e}`),this.logger.debug({type:"event",event:e,data:t}),this.persist()}),this.events.on(Ye.expired,t=>{const e=Ye.expired;this.logger.info(`Emitting ${e}`),this.logger.debug({type:"event",event:e,data:t}),this.persist()}),this.events.on(Ye.deleted,t=>{const e=Ye.deleted;this.logger.info(`Emitting ${e}`),this.logger.debug({type:"event",event:e,data:t}),this.persist()})}isInitialized(){if(!this.initialized){const{message:t}=U("NOT_INITIALIZED",this.name);throw new Error(t)}}}var Zv=Object.defineProperty,Yv=(r,t,e)=>t in r?Zv(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,de=(r,t,e)=>Yv(r,typeof t!="symbol"?t+"":t,e);class Qv extends h_{constructor(t,e,n){super(t,e,n),this.core=t,this.logger=e,this.store=n,de(this,"name",Qg),de(this,"abortController"),de(this,"isDevEnv"),de(this,"verifyUrlV3",eE),de(this,"storagePrefix",wt),de(this,"version",Pu),de(this,"publicKey"),de(this,"fetchPromise"),de(this,"init",async()=>{var i;this.isDevEnv||(this.publicKey=await this.store.getItem(this.storeKey),this.publicKey&&q.toMiliseconds((i=this.publicKey)==null?void 0:i.expiresAt)<Date.now()&&(this.logger.debug("verify v2 public key expired"),await this.removePublicKey()))}),de(this,"register",async i=>{if(!Dr()||this.isDevEnv)return;const s=window.location.origin,{id:o,decryptedId:c}=i,l=`${this.verifyUrlV3}/attestation?projectId=${this.core.projectId}&origin=${s}&id=${o}&decryptedId=${c}`;try{const u=Rt.getDocument(),d=this.startAbortTimer(q.ONE_SECOND*5),h=await new Promise((p,_)=>{const f=()=>{window.removeEventListener("message",y),u.body.removeChild(m),_("attestation aborted")};this.abortController.signal.addEventListener("abort",f);const m=u.createElement("iframe");m.src=l,m.style.display="none",m.addEventListener("error",f,{signal:this.abortController.signal});const y=b=>{if(b.data&&typeof b.data=="string")try{const O=JSON.parse(b.data);if(O.type==="verify_attestation"){if(Ji(O.attestation).payload.id!==o)return;clearInterval(d),u.body.removeChild(m),this.abortController.signal.removeEventListener("abort",f),window.removeEventListener("message",y),p(O.attestation===null?"":O.attestation)}}catch(O){this.logger.warn(O)}};u.body.appendChild(m),window.addEventListener("message",y,{signal:this.abortController.signal})});return this.logger.debug("jwt attestation",h),h}catch(u){this.logger.warn(u)}return""}),de(this,"resolve",async i=>{if(this.isDevEnv)return"";const{attestationId:s,hash:o,encryptedId:c}=i;if(s===""){this.logger.debug("resolve: attestationId is empty, skipping");return}if(s){if(Ji(s).payload.id!==c)return;const u=await this.isValidJwtAttestation(s);if(u){if(!u.isVerified){this.logger.warn("resolve: jwt attestation: origin url not verified");return}return u}}if(!o)return;const l=this.getVerifyUrl(i==null?void 0:i.verifyUrl);return this.fetchAttestation(o,l)}),de(this,"fetchAttestation",async(i,s)=>{this.logger.debug(`resolving attestation: ${i} from url: ${s}`);const o=this.startAbortTimer(q.ONE_SECOND*5),c=await fetch(`${s}/attestation/${i}?v2Supported=true`,{signal:this.abortController.signal});return clearTimeout(o),c.status===200?await c.json():void 0}),de(this,"getVerifyUrl",i=>{let s=i||Xr;return tE.includes(s)||(this.logger.info(`verify url: ${s}, not included in trusted list, assigning default: ${Xr}`),s=Xr),s}),de(this,"fetchPublicKey",async()=>{try{this.logger.debug(`fetching public key from: ${this.verifyUrlV3}`);const i=this.startAbortTimer(q.FIVE_SECONDS),s=await fetch(`${this.verifyUrlV3}/public-key`,{signal:this.abortController.signal});return clearTimeout(i),await s.json()}catch(i){this.logger.warn(i)}}),de(this,"persistPublicKey",async i=>{this.logger.debug("persisting public key to local storage",i),await this.store.setItem(this.storeKey,i),this.publicKey=i}),de(this,"removePublicKey",async()=>{this.logger.debug("removing verify v2 public key from storage"),await this.store.removeItem(this.storeKey),this.publicKey=void 0}),de(this,"isValidJwtAttestation",async i=>{const s=await this.getPublicKey();try{if(s)return this.validateAttestation(i,s)}catch(c){this.logger.error(c),this.logger.warn("error validating attestation")}const o=await this.fetchAndPersistPublicKey();try{if(o)return this.validateAttestation(i,o)}catch(c){this.logger.error(c),this.logger.warn("error validating attestation")}}),de(this,"getPublicKey",async()=>this.publicKey?this.publicKey:await this.fetchAndPersistPublicKey()),de(this,"fetchAndPersistPublicKey",async()=>{if(this.fetchPromise)return await this.fetchPromise,this.publicKey;this.fetchPromise=new Promise(async s=>{const o=await this.fetchPublicKey();o&&(await this.persistPublicKey(o),s(o))});const i=await this.fetchPromise;return this.fetchPromise=void 0,i}),de(this,"validateAttestation",(i,s)=>{const o=Iw(i,s.publicKey),c={hasExpired:q.toMiliseconds(o.exp)<Date.now(),payload:o};if(c.hasExpired)throw this.logger.warn("resolve: jwt attestation expired"),new Error("JWT attestation expired");return{origin:c.payload.origin,isScam:c.payload.isScam,isVerified:c.payload.isVerified}}),this.logger=Ce(e,this.name),this.abortController=new AbortController,this.isDevEnv=eo(),this.init()}get storeKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//verify:public:key"}get context(){return Ke(this.logger)}startAbortTimer(t){return this.abortController=new AbortController,setTimeout(()=>this.abortController.abort(),q.toMiliseconds(t))}}var Xv=Object.defineProperty,eb=(r,t,e)=>t in r?Xv(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,_c=(r,t,e)=>eb(r,typeof t!="symbol"?t+"":t,e);class tb extends p_{constructor(t,e){super(t,e),this.projectId=t,this.logger=e,_c(this,"context",rE),_c(this,"registerDeviceToken",async n=>{const{clientId:i,token:s,notificationType:o,enableEncrypted:c=!1}=n,l=`${nE}/${this.projectId}/clients`;await fetch(l,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:i,type:o,token:s,always_raw:c})})}),this.logger=Ce(e,this.context)}}var rb=Object.defineProperty,fc=Object.getOwnPropertySymbols,nb=Object.prototype.hasOwnProperty,ib=Object.prototype.propertyIsEnumerable,Os=(r,t,e)=>t in r?rb(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,zr=(r,t)=>{for(var e in t||(t={}))nb.call(t,e)&&Os(r,e,t[e]);if(fc)for(var e of fc(t))ib.call(t,e)&&Os(r,e,t[e]);return r},me=(r,t,e)=>Os(r,typeof t!="symbol"?t+"":t,e);class sb extends __{constructor(t,e,n=!0){super(t,e,n),this.core=t,this.logger=e,me(this,"context",sE),me(this,"storagePrefix",wt),me(this,"storageVersion",iE),me(this,"events",new Map),me(this,"shouldPersist",!1),me(this,"init",async()=>{if(!eo())try{const i={eventId:sa(),timestamp:Date.now(),domain:this.getAppDomain(),props:{event:"INIT",type:"",properties:{client_id:await this.core.crypto.getClientId(),user_agent:Ll(this.core.relayer.protocol,this.core.relayer.version,gs)}}};await this.sendEvent([i])}catch(i){this.logger.warn(i)}}),me(this,"createEvent",i=>{const{event:s="ERROR",type:o="",properties:{topic:c,trace:l}}=i,u=sa(),d=this.core.projectId||"",h=Date.now(),p=zr({eventId:u,timestamp:h,props:{event:s,type:o,properties:{topic:c,trace:l}},bundleId:d,domain:this.getAppDomain()},this.setMethods(u));return this.telemetryEnabled&&(this.events.set(u,p),this.shouldPersist=!0),p}),me(this,"getEvent",i=>{const{eventId:s,topic:o}=i;if(s)return this.events.get(s);const c=Array.from(this.events.values()).find(l=>l.props.properties.topic===o);if(c)return zr(zr({},c),this.setMethods(c.eventId))}),me(this,"deleteEvent",i=>{const{eventId:s}=i;this.events.delete(s),this.shouldPersist=!0}),me(this,"setEventListeners",()=>{this.core.heartbeat.on(Pr.pulse,async()=>{this.shouldPersist&&await this.persist(),this.events.forEach(i=>{q.fromMiliseconds(Date.now())-q.fromMiliseconds(i.timestamp)>oE&&(this.events.delete(i.eventId),this.shouldPersist=!0)})})}),me(this,"setMethods",i=>({addTrace:s=>this.addTrace(i,s),setError:s=>this.setError(i,s)})),me(this,"addTrace",(i,s)=>{const o=this.events.get(i);o&&(o.props.properties.trace.push(s),this.events.set(i,o),this.shouldPersist=!0)}),me(this,"setError",(i,s)=>{const o=this.events.get(i);o&&(o.props.type=s,o.timestamp=Date.now(),this.events.set(i,o),this.shouldPersist=!0)}),me(this,"persist",async()=>{await this.core.storage.setItem(this.storageKey,Array.from(this.events.values())),this.shouldPersist=!1}),me(this,"restore",async()=>{try{const i=await this.core.storage.getItem(this.storageKey)||[];if(!i.length)return;i.forEach(s=>{this.events.set(s.eventId,zr(zr({},s),this.setMethods(s.eventId)))})}catch(i){this.logger.warn(i)}}),me(this,"submit",async()=>{if(!this.telemetryEnabled||this.events.size===0)return;const i=[];for(const[s,o]of this.events)o.props.type&&i.push(o);if(i.length!==0)try{if((await this.sendEvent(i)).ok)for(const s of i)this.events.delete(s.eventId),this.shouldPersist=!0}catch(s){this.logger.warn(s)}}),me(this,"sendEvent",async i=>{const s=this.getAppDomain()?"":"&sp=desktop";return await fetch(`${aE}?projectId=${this.core.projectId}&st=events_sdk&sv=js-${gs}${s}`,{method:"POST",body:JSON.stringify(i)})}),me(this,"getAppDomain",()=>Rl().url),this.logger=Ce(e,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 ob=Object.defineProperty,mc=Object.getOwnPropertySymbols,ab=Object.prototype.hasOwnProperty,cb=Object.prototype.propertyIsEnumerable,Rs=(r,t,e)=>t in r?ob(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,yc=(r,t)=>{for(var e in t||(t={}))ab.call(t,e)&&Rs(r,e,t[e]);if(mc)for(var e of mc(t))cb.call(t,e)&&Rs(r,e,t[e]);return r},ie=(r,t,e)=>Rs(r,typeof t!="symbol"?t+"":t,e);class fo extends t_{constructor(t){var e;super(t),ie(this,"protocol",Tu),ie(this,"version",Pu),ie(this,"name",ws),ie(this,"relayUrl"),ie(this,"projectId"),ie(this,"customStoragePrefix"),ie(this,"events",new ur.EventEmitter),ie(this,"logger"),ie(this,"heartbeat"),ie(this,"relayer"),ie(this,"crypto"),ie(this,"storage"),ie(this,"history"),ie(this,"expirer"),ie(this,"pairing"),ie(this,"verify"),ie(this,"echoClient"),ie(this,"linkModeSupportedApps"),ie(this,"eventClient"),ie(this,"initialized",!1),ie(this,"logChunkController"),ie(this,"on",(c,l)=>this.events.on(c,l)),ie(this,"once",(c,l)=>this.events.once(c,l)),ie(this,"off",(c,l)=>this.events.off(c,l)),ie(this,"removeListener",(c,l)=>this.events.removeListener(c,l)),ie(this,"dispatchEnvelope",({topic:c,message:l,sessionExists:u})=>{if(!c||!l)return;const d={topic:c,message:l,publishedAt:Date.now(),transportType:se.link_mode};this.relayer.onLinkMessageEvent(d,{sessionExists:u})});const n=this.getGlobalCore(t==null?void 0:t.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(c){console.warn("Failed to copy global core",c)}this.projectId=t==null?void 0:t.projectId,this.relayUrl=(t==null?void 0:t.relayUrl)||Ru,this.customStoragePrefix=t!=null&&t.customStoragePrefix?`:${t.customStoragePrefix}`:"";const i=Qs({level:typeof(t==null?void 0:t.logger)=="string"&&t.logger?t.logger:Rg.logger,name:ws}),{logger:s,chunkLoggerController:o}=Qp({opts:i,maxSizeInBytes:t==null?void 0:t.maxLogBlobSizeInBytes,loggerOverride:t==null?void 0:t.logger});this.logChunkController=o,(e=this.logChunkController)!=null&&e.downloadLogsBlobInBrowser&&(window.downloadLogsBlobInBrowser=async()=>{var c,l;(c=this.logChunkController)!=null&&c.downloadLogsBlobInBrowser&&((l=this.logChunkController)==null||l.downloadLogsBlobInBrowser({clientId:await this.crypto.getClientId()}))}),this.logger=Ce(s,this.name),this.heartbeat=new th,this.crypto=new k0(this,this.logger,t==null?void 0:t.keychain),this.history=new Wv(this,this.logger),this.expirer=new Jv(this,this.logger),this.storage=t!=null&&t.storage?t.storage:new kp(yc(yc({},Lg),t==null?void 0:t.storageOptions)),this.relayer=new lv({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new zv(this,this.logger),this.verify=new Qv(this,this.logger,this.storage),this.echoClient=new tb(this.projectId||"",this.logger),this.linkModeSupportedApps=[],this.eventClient=new sb(this,this.logger,t==null?void 0:t.telemetryEnabled),this.setGlobalCore(this)}static async init(t){const e=new fo(t);await e.initialize();const n=await e.crypto.getClientId();return await e.storage.setItem(zg,n),e}get context(){return Ke(this.logger)}async start(){this.initialized||await this.initialize()}async getLogsBlob(){var t;return(t=this.logChunkController)==null?void 0:t.logsToBlob({clientId:await this.crypto.getClientId()})}async addLinkModeSupportedApp(t){this.linkModeSupportedApps.includes(t)||(this.linkModeSupportedApps.push(t),await this.storage.setItem(Ja,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(Ja)||[],this.initialized=!0,this.logger.info("Core Initialization Success")}catch(t){throw this.logger.warn(`Core Initialization Failure at epoch ${Date.now()}`,t),this.logger.error(t.message),t}}getGlobalCore(t=""){try{if(this.isGlobalCoreDisabled())return;const e=`_walletConnectCore_${t}`,n=`${e}_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[e]}catch(e){console.warn("Failed to get global WalletConnect core",e);return}}setGlobalCore(t){var e;try{if(this.isGlobalCoreDisabled())return;const n=`_walletConnectCore_${((e=t.opts)==null?void 0:e.customStoragePrefix)||""}`;globalThis[n]=t}catch(n){console.warn("Failed to set global WalletConnect core",n)}}isGlobalCoreDisabled(){try{return typeof Kt<"u"&&Og.DISABLE_GLOBAL_CORE==="true"}catch{return!0}}}const lb=fo;var it={};const Bu="wc",ju=2,zu="client",mo=`${Bu}@${ju}:${zu}:`,qi={name:zu,logger:"error"},wc="WALLETCONNECT_DEEPLINK_CHOICE",ub="proposal",gc="Proposal expired",db="session",gr=q.SEVEN_DAYS,hb="engine",Ie={wc_sessionPropose:{req:{ttl:q.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:q.FIVE_MINUTES,prompt:!1,tag:1101},reject:{ttl:q.FIVE_MINUTES,prompt:!1,tag:1120},autoReject:{ttl:q.FIVE_MINUTES,prompt:!1,tag:1121}},wc_sessionSettle:{req:{ttl:q.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:q.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:q.ONE_DAY,prompt:!1,tag:1104},res:{ttl:q.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:q.ONE_DAY,prompt:!1,tag:1106},res:{ttl:q.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:q.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:q.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:q.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:q.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:q.ONE_DAY,prompt:!1,tag:1112},res:{ttl:q.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:q.ONE_DAY,prompt:!1,tag:1114},res:{ttl:q.ONE_DAY,prompt:!1,tag:1115}},wc_sessionAuthenticate:{req:{ttl:q.ONE_HOUR,prompt:!0,tag:1116},res:{ttl:q.ONE_HOUR,prompt:!1,tag:1117},reject:{ttl:q.FIVE_MINUTES,prompt:!1,tag:1118},autoReject:{ttl:q.FIVE_MINUTES,prompt:!1,tag:1119}}},Mi={min:q.FIVE_MINUTES,max:q.SEVEN_DAYS},ht={idle:"IDLE",active:"ACTIVE"},pb={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:""}},_b="request",fb=["wc_sessionPropose","wc_sessionRequest","wc_authRequest","wc_sessionAuthenticate"],mb="wc",yb="auth",wb="authKeys",gb="pairingTopics",Eb="requests",fi=`${mb}@${1.5}:${yb}:`,Nn=`${fi}:PUB_KEY`;var vb=Object.defineProperty,bb=Object.defineProperties,Ib=Object.getOwnPropertyDescriptors,Ec=Object.getOwnPropertySymbols,Ab=Object.prototype.hasOwnProperty,Tb=Object.prototype.propertyIsEnumerable,Ls=(r,t,e)=>t in r?vb(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,te=(r,t)=>{for(var e in t||(t={}))Ab.call(t,e)&&Ls(r,e,t[e]);if(Ec)for(var e of Ec(t))Tb.call(t,e)&&Ls(r,e,t[e]);return r},Le=(r,t)=>bb(r,Ib(t)),x=(r,t,e)=>Ls(r,typeof t!="symbol"?t+"":t,e);class Pb extends w_{constructor(t){super(t),x(this,"name",hb),x(this,"events",new Mc),x(this,"initialized",!1),x(this,"requestQueue",{state:ht.idle,queue:[]}),x(this,"sessionRequestQueue",{state:ht.idle,queue:[]}),x(this,"emittedSessionRequests",new Uf({limit:500})),x(this,"requestQueueDelay",q.ONE_SECOND),x(this,"expectedPairingMethodMap",new Map),x(this,"recentlyDeletedMap",new Map),x(this,"recentlyDeletedLimit",200),x(this,"relayMessageCache",[]),x(this,"pendingSessions",new Map),x(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(Ie)}),this.initialized=!0,setTimeout(async()=>{await this.processPendingMessageEvents(),this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()},q.toMiliseconds(this.requestQueueDelay)))}),x(this,"connect",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();const n=Le(te({},e),{requiredNamespaces:e.requiredNamespaces||{},optionalNamespaces:e.optionalNamespaces||{}});await this.isValidConnect(n),n.optionalNamespaces=Mw(n.requiredNamespaces,n.optionalNamespaces),n.requiredNamespaces={};const{pairingTopic:i,requiredNamespaces:s,optionalNamespaces:o,sessionProperties:c,scopedProperties:l,relays:u}=n;let d=i,h,p=!1;try{if(d){const E=this.client.core.pairing.pairings.get(d);this.client.logger.warn("connect() with existing pairing topic is deprecated and will be removed in the next major release."),p=E.active}}catch(E){throw this.client.logger.error(`connect() -> pairing.get(${d}) failed`),E}if(!d||!p){const{topic:E,uri:D}=await this.client.core.pairing.create({internal:{skipSubscribe:!0}});d=E,h=D}if(!d){const{message:E}=U("NO_MATCHING_KEY",`connect() pairing topic: ${d}`);throw new Error(E)}const _=await this.client.core.crypto.generateKeyPair(),f=Ie.wc_sessionPropose.req.ttl||q.FIVE_MINUTES,m=_e(f),y=Le(te(te({requiredNamespaces:s,optionalNamespaces:o,relays:u??[{protocol:Ou}],proposer:{publicKey:_,metadata:this.client.metadata},expiryTimestamp:m,pairingTopic:d},c&&{sessionProperties:c}),l&&{scopedProperties:l}),{id:Dt()}),b=ee("session_connect",y.id),{reject:O,resolve:g,done:P}=Yt(f,gc),A=({id:E})=>{E===y.id&&(this.client.events.off("proposal_expire",A),this.pendingSessions.delete(y.id),this.events.emit(b,{error:{message:gc,code:0}}))};return this.client.events.on("proposal_expire",A),this.events.once(b,({error:E,session:D})=>{this.client.events.off("proposal_expire",A),E?O(E):D&&g(D)}),await this.sendProposeSession({proposal:y,publishOpts:{internal:{throwOnFailedPublish:!0},tvf:{correlationId:y.id}}}),await this.setProposal(y.id,y),{uri:h,approval:P}}),x(this,"pair",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{return await this.client.core.pairing.pair(e)}catch(n){throw this.client.logger.error("pair() failed"),n}}),x(this,"approve",async e=>{var n,i,s;const o=this.client.core.eventClient.createEvent({properties:{topic:(n=e==null?void 0:e.id)==null?void 0:n.toString(),trace:[Nt.session_approve_started]}});try{this.isInitialized(),await this.confirmOnlineStateOrThrow()}catch(w){throw o.setError(Mr.no_internet_connection),w}try{await this.isValidProposalId(e==null?void 0:e.id)}catch(w){throw this.client.logger.error(`approve() -> proposal.get(${e==null?void 0:e.id}) failed`),o.setError(Mr.proposal_not_found),w}try{await this.isValidApprove(e)}catch(w){throw this.client.logger.error("approve() -> isValidApprove() failed"),o.setError(Mr.session_approve_namespace_validation_failure),w}const{id:c,relayProtocol:l,namespaces:u,sessionProperties:d,scopedProperties:h,sessionConfig:p}=e,_=this.client.proposal.get(c);this.client.core.eventClient.deleteEvent({eventId:o.eventId});const{pairingTopic:f,proposer:m,requiredNamespaces:y,optionalNamespaces:b}=_;let O=(i=this.client.core.eventClient)==null?void 0:i.getEvent({topic:f});O||(O=(s=this.client.core.eventClient)==null?void 0:s.createEvent({type:Nt.session_approve_started,properties:{topic:f,trace:[Nt.session_approve_started,Nt.session_namespaces_validation_success]}}));const g=await this.client.core.crypto.generateKeyPair(),P=m.publicKey,A=await this.client.core.crypto.generateSharedKey(g,P),E=te(te(te({relay:{protocol:l??"irn"},namespaces:u,controller:{publicKey:g,metadata:this.client.metadata},expiry:_e(gr)},d&&{sessionProperties:d}),h&&{scopedProperties:h}),p&&{sessionConfig:p}),D=se.relay;O.addTrace(Nt.subscribing_session_topic);try{await this.client.core.relayer.subscribe(A,{transportType:D,internal:{skipSubscribe:!0}})}catch(w){throw O.setError(Mr.subscribe_session_topic_failure),w}O.addTrace(Nt.subscribe_session_topic_success);const L=Le(te({},E),{topic:A,requiredNamespaces:y,optionalNamespaces:b,pairingTopic:f,acknowledged:!1,self:E.controller,peer:{publicKey:m.publicKey,metadata:m.metadata},controller:g,transportType:se.relay});await this.client.session.set(A,L),O.addTrace(Nt.store_session);try{await this.sendApproveSession({sessionTopic:A,proposal:_,pairingProposalResponse:{relay:{protocol:l??"irn"},responderPublicKey:g},sessionSettleRequest:E,publishOpts:{internal:{throwOnFailedPublish:!0},tvf:{correlationId:c}}}),O.addTrace(Nt.session_approve_publish_success)}catch(w){throw this.client.logger.error(w),this.client.session.delete(A,ae("USER_DISCONNECTED")),await this.client.core.relayer.unsubscribe(A),w}return this.client.core.eventClient.deleteEvent({eventId:O.eventId}),await this.client.core.pairing.updateMetadata({topic:f,metadata:m.metadata}),await this.deleteProposal(c),await this.client.core.pairing.activate({topic:f}),await this.setExpiry(A,_e(gr)),{topic:A,acknowledged:()=>Promise.resolve(this.client.session.get(A))}}),x(this,"reject",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidReject(e)}catch(o){throw this.client.logger.error("reject() -> isValidReject() failed"),o}const{id:n,reason:i}=e;let s;try{s=this.client.proposal.get(n).pairingTopic}catch(o){throw this.client.logger.error(`reject() -> proposal.get(${n}) failed`),o}s&&await this.sendError({id:n,topic:s,error:i,rpcOpts:Ie.wc_sessionPropose.reject}),await this.deleteProposal(n)}),x(this,"update",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidUpdate(e)}catch(h){throw this.client.logger.error("update() -> isValidUpdate() failed"),h}const{topic:n,namespaces:i}=e,{done:s,resolve:o,reject:c}=Yt(),l=Dt(),u=Xt().toString(),d=this.client.session.get(n).namespaces;return this.events.once(ee("session_update",l),({error:h})=>{h?c(h):o()}),await this.client.session.update(n,{namespaces:i}),await this.sendRequest({topic:n,method:"wc_sessionUpdate",params:{namespaces:i},throwOnFailedPublish:!0,clientRpcId:l,relayRpcId:u}).catch(h=>{this.client.logger.error(h),this.client.session.update(n,{namespaces:d}),c(h)}),{acknowledged:s}}),x(this,"extend",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidExtend(e)}catch(l){throw this.client.logger.error("extend() -> isValidExtend() failed"),l}const{topic:n}=e,i=Dt(),{done:s,resolve:o,reject:c}=Yt();return this.events.once(ee("session_extend",i),({error:l})=>{l?c(l):o()}),await this.setExpiry(n,_e(gr)),this.sendRequest({topic:n,method:"wc_sessionExtend",params:{},clientRpcId:i,throwOnFailedPublish:!0}).catch(l=>{c(l)}),{acknowledged:s}}),x(this,"request",async e=>{this.isInitialized();try{await this.isValidRequest(e)}catch(y){throw this.client.logger.error("request() -> isValidRequest() failed"),y}const{chainId:n,request:i,topic:s,expiry:o=Ie.wc_sessionRequest.req.ttl}=e,c=this.client.session.get(s);(c==null?void 0:c.transportType)===se.relay&&await this.confirmOnlineStateOrThrow();const l=Dt(),u=Xt().toString(),{done:d,resolve:h,reject:p}=Yt(o,"Request expired. Please try again.");this.events.once(ee("session_request",l),({error:y,result:b})=>{y?p(y):h(b)});const _="wc_sessionRequest",f=this.getAppLinkIfEnabled(c.peer.metadata,c.transportType);if(f)return await this.sendRequest({clientRpcId:l,relayRpcId:u,topic:s,method:_,params:{request:Le(te({},i),{expiryTimestamp:_e(o)}),chainId:n},expiry:o,throwOnFailedPublish:!0,appLink:f}).catch(y=>p(y)),this.client.events.emit("session_request_sent",{topic:s,request:i,chainId:n,id:l}),await d();const m={request:Le(te({},i),{expiryTimestamp:_e(o)}),chainId:n};return await Promise.all([new Promise(async y=>{await this.sendRequest({clientRpcId:l,relayRpcId:u,topic:s,method:_,params:m,expiry:o,throwOnFailedPublish:!0,tvf:this.getTVFParams(l,m)}).catch(b=>p(b)),this.client.events.emit("session_request_sent",{topic:s,request:i,chainId:n,id:l}),y()}),new Promise(async y=>{var b;if(!((b=c.sessionConfig)!=null&&b.disableDeepLink)){const O=await xf(this.client.core.storage,wc);await Df({id:l,topic:s,wcDeepLink:O})}y()}),d()]).then(y=>y[2])}),x(this,"respond",async e=>{this.isInitialized(),await this.isValidRespond(e);const{topic:n,response:i}=e,{id:s}=i,o=this.client.session.get(n);o.transportType===se.relay&&await this.confirmOnlineStateOrThrow();const c=this.getAppLinkIfEnabled(o.peer.metadata,o.transportType);bt(i)?await this.sendResult({id:s,topic:n,result:i.result,throwOnFailedPublish:!0,appLink:c}):_t(i)&&await this.sendError({id:s,topic:n,error:i.error,appLink:c}),this.cleanupAfterResponse(e)}),x(this,"ping",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidPing(e)}catch(i){throw this.client.logger.error("ping() -> isValidPing() failed"),i}const{topic:n}=e;if(this.client.session.keys.includes(n)){const i=Dt(),s=Xt().toString(),{done:o,resolve:c,reject:l}=Yt();this.events.once(ee("session_ping",i),({error:u})=>{u?l(u):c()}),await Promise.all([this.sendRequest({topic:n,method:"wc_sessionPing",params:{},throwOnFailedPublish:!0,clientRpcId:i,relayRpcId:s}),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}))}),x(this,"emit",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidEmit(e);const{topic:n,event:i,chainId:s}=e,o=Xt().toString(),c=Dt();await this.sendRequest({topic:n,method:"wc_sessionEvent",params:{event:i,chainId:s},throwOnFailedPublish:!0,relayRpcId:o,clientRpcId:c})}),x(this,"disconnect",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidDisconnect(e);const{topic:n}=e;if(this.client.session.keys.includes(n))await this.sendRequest({topic:n,method:"wc_sessionDelete",params:ae("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:i}=U("MISMATCHED_TOPIC",`Session or pairing topic not found: ${n}`);throw new Error(i)}}),x(this,"find",e=>(this.isInitialized(),this.client.session.getAll().filter(n=>zw(n,e)))),x(this,"getPendingSessionRequests",()=>this.client.pendingRequest.getAll()),x(this,"authenticate",async(e,n)=>{var i;this.isInitialized(),this.isValidAuthenticate(e);const s=n&&this.client.core.linkModeSupportedApps.includes(n)&&((i=this.client.metadata.redirect)==null?void 0:i.linkMode),o=s?se.link_mode:se.relay;o===se.relay&&await this.confirmOnlineStateOrThrow();const{chains:c,statement:l="",uri:u,domain:d,nonce:h,type:p,exp:_,nbf:f,methods:m=[],expiry:y}=e,b=[...e.resources||[]],{topic:O,uri:g}=await this.client.core.pairing.create({methods:["wc_sessionAuthenticate"],transportType:o});this.client.logger.info({message:"Generated new pairing",pairing:{topic:O,uri:g}});const P=await this.client.core.crypto.generateKeyPair(),A=$n(P);if(await Promise.all([this.client.auth.authKeys.set(Nn,{responseTopic:A,publicKey:P}),this.client.auth.pairingTopics.set(A,{topic:A,pairingTopic:O})]),await this.client.core.relayer.subscribe(A,{transportType:o}),this.client.logger.info(`sending request to new pairing topic: ${O}`),m.length>0){const{namespace:C}=xn(c[0]);let N=Jm(C,"request",m);Cn(b)&&(N=Ym(N,b.pop())),b.push(N)}const E=y&&y>Ie.wc_sessionAuthenticate.req.ttl?y:Ie.wc_sessionAuthenticate.req.ttl,D={authPayload:{type:p??"caip122",chains:c,statement:l,aud:u,domain:d,version:"1",nonce:h,iat:new Date().toISOString(),exp:_,nbf:f,resources:b},requester:{publicKey:P,metadata:this.client.metadata},expiryTimestamp:_e(E)},L={eip155:{chains:c,methods:[...new Set(["personal_sign",...m])],events:["chainChanged","accountsChanged"]}},w={requiredNamespaces:{},optionalNamespaces:L,relays:[{protocol:"irn"}],pairingTopic:O,proposer:{publicKey:P,metadata:this.client.metadata},expiryTimestamp:_e(Ie.wc_sessionPropose.req.ttl),id:Dt()},{done:v,resolve:I,reject:T}=Yt(E,"Request expired"),V=Dt(),R=ee("session_connect",w.id),S=ee("session_request",V),$=async({error:C,session:N})=>{this.events.off(S,k),C?T(C):N&&I({session:N})},k=async C=>{var N,j,z;if(await this.deletePendingAuthRequest(V,{message:"fulfilled",code:0}),C.error){const oe=ae("WC_METHOD_UNSUPPORTED","wc_sessionAuthenticate");return C.error.code===oe.code?void 0:(this.events.off(R,$),T(C.error.message))}await this.deleteProposal(w.id),this.events.off(R,$);const{cacaos:K,responder:F}=C.result,W=[],H=[];for(const oe of K){await ma({cacao:oe,projectId:this.client.core.projectId})||(this.client.logger.error(oe,"Signature verification failed"),T(ae("SESSION_SETTLEMENT_FAILED","Signature verification failed")));const{p:Ge}=oe,gt=Cn(Ge.resources),Eo=[as(Ge.iss)],td=Yn(Ge.iss);if(gt){const yi=ya(gt),rd=wa(gt);W.push(...yi),Eo.push(...rd)}for(const yi of Eo)H.push(`${yi}:${td}`)}const ue=await this.client.core.crypto.generateSharedKey(P,F.publicKey);let ce;W.length>0&&(ce={topic:ue,acknowledged:!0,self:{publicKey:P,metadata:this.client.metadata},peer:F,controller:F.publicKey,expiry:_e(gr),requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:O,namespaces:ja([...new Set(W)],[...new Set(H)]),transportType:o},await this.client.core.relayer.subscribe(ue,{transportType:o}),await this.client.session.set(ue,ce),O&&await this.client.core.pairing.updateMetadata({topic:O,metadata:F.metadata}),ce=this.client.session.get(ue)),(N=this.client.metadata.redirect)!=null&&N.linkMode&&(j=F.metadata.redirect)!=null&&j.linkMode&&(z=F.metadata.redirect)!=null&&z.universal&&n&&(this.client.core.addLinkModeSupportedApp(F.metadata.redirect.universal),this.client.session.update(ue,{transportType:se.link_mode})),I({auths:K,session:ce})};this.events.once(R,$),this.events.once(S,k);let M;try{if(s){const C=Ut("wc_sessionAuthenticate",D,V);this.client.core.history.set(O,C);const N=await this.client.core.crypto.encode("",C,{type:wn,encoding:zt});M=Ln(n,O,N)}else await Promise.all([this.sendRequest({topic:O,method:"wc_sessionAuthenticate",params:D,expiry:e.expiry,throwOnFailedPublish:!0,clientRpcId:V}),this.sendRequest({topic:O,method:"wc_sessionPropose",params:w,expiry:Ie.wc_sessionPropose.req.ttl,throwOnFailedPublish:!0,clientRpcId:w.id})])}catch(C){throw this.events.off(R,$),this.events.off(S,k),C}return await this.setProposal(w.id,w),await this.setAuthRequest(V,{request:Le(te({},D),{verifyContext:{}}),pairingTopic:O,transportType:o}),{uri:M??g,response:v}}),x(this,"approveSessionAuthenticate",async e=>{const{id:n,auths:i}=e,s=this.client.core.eventClient.createEvent({properties:{topic:n.toString(),trace:[Zt.authenticated_session_approve_started]}});try{this.isInitialized()}catch(y){throw s.setError(Br.no_internet_connection),y}const o=this.getPendingAuthRequest(n);if(!o)throw s.setError(Br.authenticated_session_pending_request_not_found),new Error(`Could not find pending auth request with id ${n}`);const c=o.transportType||se.relay;c===se.relay&&await this.confirmOnlineStateOrThrow();const l=o.requester.publicKey,u=await this.client.core.crypto.generateKeyPair(),d=$n(l),h={type:Ot,receiverPublicKey:l,senderPublicKey:u},p=[],_=[];for(const y of i){if(!await ma({cacao:y,projectId:this.client.core.projectId})){s.setError(Br.invalid_cacao);const A=ae("SESSION_SETTLEMENT_FAILED","Signature verification failed");throw await this.sendError({id:n,topic:d,error:A,encodeOpts:h}),new Error(A.message)}s.addTrace(Zt.cacaos_verified);const{p:b}=y,O=Cn(b.resources),g=[as(b.iss)],P=Yn(b.iss);if(O){const A=ya(O),E=wa(O);p.push(...A),g.push(...E)}for(const A of g)_.push(`${A}:${P}`)}const f=await this.client.core.crypto.generateSharedKey(u,l);s.addTrace(Zt.create_authenticated_session_topic);let m;if((p==null?void 0:p.length)>0){m={topic:f,acknowledged:!0,self:{publicKey:u,metadata:this.client.metadata},peer:{publicKey:l,metadata:o.requester.metadata},controller:l,expiry:_e(gr),authentication:i,requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:o.pairingTopic,namespaces:ja([...new Set(p)],[...new Set(_)]),transportType:c},s.addTrace(Zt.subscribing_authenticated_session_topic);try{await this.client.core.relayer.subscribe(f,{transportType:c})}catch(y){throw s.setError(Br.subscribe_authenticated_session_topic_failure),y}s.addTrace(Zt.subscribe_authenticated_session_topic_success),await this.client.session.set(f,m),s.addTrace(Zt.store_authenticated_session),await this.client.core.pairing.updateMetadata({topic:o.pairingTopic,metadata:o.requester.metadata})}s.addTrace(Zt.publishing_authenticated_session_approve);try{await this.sendResult({topic:d,id:n,result:{cacaos:i,responder:{publicKey:u,metadata:this.client.metadata}},encodeOpts:h,throwOnFailedPublish:!0,appLink:this.getAppLinkIfEnabled(o.requester.metadata,c)})}catch(y){throw s.setError(Br.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:s.eventId}),{session:m}}),x(this,"rejectSessionAuthenticate",async e=>{this.isInitialized();const{id:n,reason:i}=e,s=this.getPendingAuthRequest(n);if(!s)throw new Error(`Could not find pending auth request with id ${n}`);s.transportType===se.relay&&await this.confirmOnlineStateOrThrow();const o=s.requester.publicKey,c=await this.client.core.crypto.generateKeyPair(),l=$n(o),u={type:Ot,receiverPublicKey:o,senderPublicKey:c};await this.sendError({id:n,topic:l,error:i,encodeOpts:u,rpcOpts:Ie.wc_sessionAuthenticate.reject,appLink:this.getAppLinkIfEnabled(s.requester.metadata,s.transportType)}),await this.client.auth.requests.delete(n,{message:"rejected",code:0}),await this.deleteProposal(n)}),x(this,"formatAuthMessage",e=>{this.isInitialized();const{request:n,iss:i}=e;return Wl(n,i)}),x(this,"processRelayMessageCache",()=>{setTimeout(async()=>{if(this.relayMessageCache.length!==0)for(;this.relayMessageCache.length>0;)try{const e=this.relayMessageCache.shift();e&&await this.onRelayMessage(e)}catch(e){this.client.logger.error(e)}},50)}),x(this,"cleanupDuplicatePairings",async e=>{if(e.pairingTopic)try{const n=this.client.core.pairing.pairings.get(e.pairingTopic),i=this.client.core.pairing.pairings.getAll().filter(s=>{var o,c;return((o=s.peerMetadata)==null?void 0:o.url)&&((c=s.peerMetadata)==null?void 0:c.url)===e.peer.metadata.url&&s.topic&&s.topic!==n.topic});if(i.length===0)return;this.client.logger.info(`Cleaning up ${i.length} duplicate pairing(s)`),await Promise.all(i.map(s=>this.client.core.pairing.disconnect({topic:s.topic}))),this.client.logger.info("Duplicate pairings clean up finished")}catch(n){this.client.logger.error(n)}}),x(this,"deleteSession",async e=>{var n;const{topic:i,expirerHasDeleted:s=!1,emitEvent:o=!0,id:c=0}=e,{self:l}=this.client.session.get(i);await this.client.core.relayer.unsubscribe(i),await this.client.session.delete(i,ae("USER_DISCONNECTED")),this.addToRecentlyDeleted(i,"session"),this.client.core.crypto.keychain.has(l.publicKey)&&await this.client.core.crypto.deleteKeyPair(l.publicKey),this.client.core.crypto.keychain.has(i)&&await this.client.core.crypto.deleteSymKey(i),s||this.client.core.expirer.del(i),this.client.core.storage.removeItem(wc).catch(u=>this.client.logger.warn(u)),this.getPendingSessionRequests().forEach(u=>{u.topic===i&&this.deletePendingSessionRequest(u.id,ae("USER_DISCONNECTED"))}),i===((n=this.sessionRequestQueue.queue[0])==null?void 0:n.topic)&&(this.sessionRequestQueue.state=ht.idle),o&&this.client.events.emit("session_delete",{id:c,topic:i})}),x(this,"deleteProposal",async(e,n)=>{if(n)try{const i=this.client.proposal.get(e),s=this.client.core.eventClient.getEvent({topic:i.pairingTopic});s==null||s.setError(Mr.proposal_expired)}catch{}await Promise.all([this.client.proposal.delete(e,ae("USER_DISCONNECTED")),n?Promise.resolve():this.client.core.expirer.del(e)]),this.addToRecentlyDeleted(e,"proposal")}),x(this,"deletePendingSessionRequest",async(e,n,i=!1)=>{await Promise.all([this.client.pendingRequest.delete(e,n),i?Promise.resolve():this.client.core.expirer.del(e)]),this.addToRecentlyDeleted(e,"request"),this.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter(s=>s.id!==e),i&&(this.sessionRequestQueue.state=ht.idle,this.client.events.emit("session_request_expire",{id:e}))}),x(this,"deletePendingAuthRequest",async(e,n,i=!1)=>{await Promise.all([this.client.auth.requests.delete(e,n),i?Promise.resolve():this.client.core.expirer.del(e)])}),x(this,"setExpiry",async(e,n)=>{this.client.session.keys.includes(e)&&(this.client.core.expirer.set(e,n),await this.client.session.update(e,{expiry:n}))}),x(this,"setProposal",async(e,n)=>{this.client.core.expirer.set(e,_e(Ie.wc_sessionPropose.req.ttl)),await this.client.proposal.set(e,n)}),x(this,"setAuthRequest",async(e,n)=>{const{request:i,pairingTopic:s,transportType:o=se.relay}=n;this.client.core.expirer.set(e,i.expiryTimestamp),await this.client.auth.requests.set(e,{authPayload:i.authPayload,requester:i.requester,expiryTimestamp:i.expiryTimestamp,id:e,pairingTopic:s,verifyContext:i.verifyContext,transportType:o})}),x(this,"setPendingSessionRequest",async e=>{const{id:n,topic:i,params:s,verifyContext:o}=e,c=s.request.expiryTimestamp||_e(Ie.wc_sessionRequest.req.ttl);this.client.core.expirer.set(n,c),await this.client.pendingRequest.set(n,{id:n,topic:i,params:s,verifyContext:o})}),x(this,"sendRequest",async e=>{const{topic:n,method:i,params:s,expiry:o,relayRpcId:c,clientRpcId:l,throwOnFailedPublish:u,appLink:d,tvf:h,publishOpts:p={}}=e,_=Ut(i,s,l);let f;const m=!!d;try{const O=m?zt:Me;f=await this.client.core.crypto.encode(n,_,{encoding:O})}catch(O){throw await this.cleanup(),this.client.logger.error(`sendRequest() -> core.crypto.encode() for topic ${n} failed`),O}let y;if(fb.includes(i)){const O=Qe(JSON.stringify(_)),g=Qe(f);y=await this.client.core.verify.register({id:g,decryptedId:O})}const b=te(te({},Ie[i].req),p);if(b.attestation=y,o&&(b.ttl=o),c&&(b.id=c),this.client.core.history.set(n,_),m){const O=Ln(d,n,f);await it.Linking.openURL(O,this.client.name)}else b.tvf=Le(te({},h),{correlationId:_.id}),u?(b.internal=Le(te({},b.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(n,f,b)):this.client.core.relayer.publish(n,f,b).catch(O=>this.client.logger.error(O));return _.id}),x(this,"sendProposeSession",async e=>{const{proposal:n,publishOpts:i}=e,s=Ut("wc_sessionPropose",n,n.id);this.client.core.history.set(n.pairingTopic,s);const o=await this.client.core.crypto.encode(n.pairingTopic,s,{encoding:Me}),c=Qe(JSON.stringify(s)),l=Qe(o),u=await this.client.core.verify.register({id:l,decryptedId:c});await this.client.core.relayer.publishCustom({payload:{pairingTopic:n.pairingTopic,sessionProposal:o},opts:Le(te({},i),{publishMethod:"wc_proposeSession",attestation:u})})}),x(this,"sendApproveSession",async e=>{const{sessionTopic:n,pairingProposalResponse:i,proposal:s,sessionSettleRequest:o,publishOpts:c}=e,l=Bn(s.id,i),u=await this.client.core.crypto.encode(s.pairingTopic,l,{encoding:Me}),d=Ut("wc_sessionSettle",o,c==null?void 0:c.id),h=await this.client.core.crypto.encode(n,d,{encoding:Me});this.client.core.history.set(n,d),await this.client.core.relayer.publishCustom({payload:{sessionTopic:n,pairingTopic:s.pairingTopic,sessionProposalResponse:u,sessionSettlementRequest:h},opts:Le(te({},c),{publishMethod:"wc_approveSession"})})}),x(this,"sendResult",async e=>{const{id:n,topic:i,result:s,throwOnFailedPublish:o,encodeOpts:c,appLink:l}=e,u=Bn(n,s);let d;const h=l&&typeof(it==null?void 0:it.Linking)<"u";try{const f=h?zt:Me;d=await this.client.core.crypto.encode(i,u,Le(te({},c||{}),{encoding:f}))}catch(f){throw await this.cleanup(),this.client.logger.error(`sendResult() -> core.crypto.encode() for topic ${i} failed`),f}let p,_;try{p=await this.client.core.history.get(i,n);const f=p.request;try{_=this.getTVFParams(n,f.params,s)}catch(m){this.client.logger.warn(`sendResult() -> getTVFParams() failed: ${m==null?void 0:m.message}`)}}catch(f){throw this.client.logger.error(`sendResult() -> history.get(${i}, ${n}) failed`),f}if(h){const f=Ln(l,i,d);await it.Linking.openURL(f,this.client.name)}else{const f=p.request.method,m=Ie[f].res;m.tvf=Le(te({},_),{correlationId:n}),o?(m.internal=Le(te({},m.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(i,d,m)):this.client.core.relayer.publish(i,d,m).catch(y=>this.client.logger.error(y))}await this.client.core.history.resolve(u)}),x(this,"sendError",async e=>{const{id:n,topic:i,error:s,encodeOpts:o,rpcOpts:c,appLink:l}=e,u=Bc(n,s);let d;const h=l&&typeof(it==null?void 0:it.Linking)<"u";try{const _=h?zt:Me;d=await this.client.core.crypto.encode(i,u,Le(te({},o||{}),{encoding:_}))}catch(_){throw await this.cleanup(),this.client.logger.error(`sendError() -> core.crypto.encode() for topic ${i} failed`),_}let p;try{p=await this.client.core.history.get(i,n)}catch(_){throw this.client.logger.error(`sendError() -> history.get(${i}, ${n}) failed`),_}if(h){const _=Ln(l,i,d);await it.Linking.openURL(_,this.client.name)}else{const _=p.request.method,f=c||Ie[_].res;this.client.core.relayer.publish(i,d,f)}await this.client.core.history.resolve(u)}),x(this,"cleanup",async()=>{const e=[],n=[];this.client.session.getAll().forEach(i=>{let s=!1;qt(i.expiry)&&(s=!0),this.client.core.crypto.keychain.has(i.topic)||(s=!0),s&&e.push(i.topic)}),this.client.proposal.getAll().forEach(i=>{qt(i.expiryTimestamp)&&n.push(i.id)}),await Promise.all([...e.map(i=>this.deleteSession({topic:i})),...n.map(i=>this.deleteProposal(i))])}),x(this,"onProviderMessageEvent",async e=>{!this.initialized||this.relayMessageCache.length>0?this.relayMessageCache.push(e):await this.onRelayMessage(e)}),x(this,"onRelayEventRequest",async e=>{this.requestQueue.queue.push(e),await this.processRequestsQueue()}),x(this,"processRequestsQueue",async()=>{if(this.requestQueue.state===ht.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=ht.active;const e=this.requestQueue.queue.shift();if(e)try{await this.processRequest(e)}catch(n){this.client.logger.warn(n)}}this.requestQueue.state=ht.idle}),x(this,"processRequest",async e=>{const{topic:n,payload:i,attestation:s,transportType:o,encryptedId:c}=e,l=i.method;if(!this.shouldIgnorePairingRequest({topic:n,requestMethod:l}))switch(l){case"wc_sessionPropose":return await this.onSessionProposeRequest({topic:n,payload:i,attestation:s,encryptedId:c});case"wc_sessionSettle":return await this.onSessionSettleRequest(n,i);case"wc_sessionUpdate":return await this.onSessionUpdateRequest(n,i);case"wc_sessionExtend":return await this.onSessionExtendRequest(n,i);case"wc_sessionPing":return await this.onSessionPingRequest(n,i);case"wc_sessionDelete":return await this.onSessionDeleteRequest(n,i);case"wc_sessionRequest":return await this.onSessionRequest({topic:n,payload:i,attestation:s,encryptedId:c,transportType:o});case"wc_sessionEvent":return await this.onSessionEventRequest(n,i);case"wc_sessionAuthenticate":return await this.onSessionAuthenticateRequest({topic:n,payload:i,attestation:s,encryptedId:c,transportType:o});default:return this.client.logger.info(`Unsupported request method ${l}`)}}),x(this,"onRelayEventResponse",async e=>{const{topic:n,payload:i,transportType:s}=e,o=(await this.client.core.history.get(n,i.id)).request.method;switch(o){case"wc_sessionPropose":return this.onSessionProposeResponse(n,i,s);case"wc_sessionSettle":return this.onSessionSettleResponse(n,i);case"wc_sessionUpdate":return this.onSessionUpdateResponse(n,i);case"wc_sessionExtend":return this.onSessionExtendResponse(n,i);case"wc_sessionPing":return this.onSessionPingResponse(n,i);case"wc_sessionRequest":return this.onSessionRequestResponse(n,i);case"wc_sessionAuthenticate":return this.onSessionAuthenticateResponse(n,i);default:return this.client.logger.info(`Unsupported response method ${o}`)}}),x(this,"onRelayEventUnknownPayload",e=>{const{topic:n}=e,{message:i}=U("MISSING_OR_INVALID",`Decoded payload on topic ${n} is not identifiable as a JSON-RPC request or a response.`);throw new Error(i)}),x(this,"shouldIgnorePairingRequest",e=>{const{topic:n,requestMethod:i}=e,s=this.expectedPairingMethodMap.get(n);return!s||s.includes(i)?!1:!!(s.includes("wc_sessionAuthenticate")&&this.client.events.listenerCount("session_authenticate")>0)}),x(this,"onSessionProposeRequest",async e=>{const{topic:n,payload:i,attestation:s,encryptedId:o}=e,{params:c,id:l}=i;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(At.proposal_listener_not_found)),this.isValidConnect(te({},i.params));const d=c.expiryTimestamp||_e(Ie.wc_sessionPropose.req.ttl),h=te({id:l,pairingTopic:n,expiryTimestamp:d,attestation:s,encryptedId:o},c);await this.setProposal(l,h);const p=await this.getVerifyContext({attestationId:s,hash:Qe(JSON.stringify(i)),encryptedId:o,metadata:h.proposer.metadata});u==null||u.addTrace(pt.emit_session_proposal),this.client.events.emit("session_proposal",{id:l,params:h,verifyContext:p})}catch(u){await this.sendError({id:l,topic:n,error:u,rpcOpts:Ie.wc_sessionPropose.autoReject}),this.client.logger.error(u)}}),x(this,"onSessionProposeResponse",async(e,n,i)=>{const{id:s}=n;if(bt(n)){const{result:o}=n;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:o});const c=this.client.proposal.get(s);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:c});const l=c.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:l});const u=o.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:u});const d=await this.client.core.crypto.generateSharedKey(l,u);this.pendingSessions.set(s,{sessionTopic:d,pairingTopic:e,proposalId:s,publicKey:l});const h=await this.client.core.relayer.subscribe(d,{transportType:i});this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:h}),await this.client.core.pairing.activate({topic:e})}else if(_t(n)){await this.deleteProposal(s);const o=ee("session_connect",s);if(this.events.listenerCount(o)===0)throw new Error(`emitting ${o} without any listeners, 954`);this.events.emit(o,{error:n.error})}}),x(this,"onSessionSettleRequest",async(e,n)=>{const{id:i,params:s}=n;try{this.isValidSessionSettleRequest(s);const{relay:o,controller:c,expiry:l,namespaces:u,sessionProperties:d,scopedProperties:h,sessionConfig:p}=n.params,_=[...this.pendingSessions.values()].find(y=>y.sessionTopic===e);if(!_)return this.client.logger.error(`Pending session not found for topic ${e}`);const f=this.client.proposal.get(_.proposalId),m=Le(te(te(te({topic:e,relay:o,expiry:l,namespaces:u,acknowledged:!0,pairingTopic:_.pairingTopic,requiredNamespaces:f.requiredNamespaces,optionalNamespaces:f.optionalNamespaces,controller:c.publicKey,self:{publicKey:_.publicKey,metadata:this.client.metadata},peer:{publicKey:c.publicKey,metadata:c.metadata}},d&&{sessionProperties:d}),h&&{scopedProperties:h}),p&&{sessionConfig:p}),{transportType:se.relay});await this.client.session.set(m.topic,m),await this.setExpiry(m.topic,m.expiry),await this.client.core.pairing.updateMetadata({topic:_.pairingTopic,metadata:m.peer.metadata}),this.client.events.emit("session_connect",{session:m}),this.events.emit(ee("session_connect",_.proposalId),{session:m}),this.pendingSessions.delete(_.proposalId),this.deleteProposal(_.proposalId,!1),this.cleanupDuplicatePairings(m),await this.sendResult({id:n.id,topic:e,result:!0})}catch(o){await this.sendError({id:i,topic:e,error:o}),this.client.logger.error(o)}}),x(this,"onSessionSettleResponse",async(e,n)=>{const{id:i}=n;bt(n)?(await this.client.session.update(e,{acknowledged:!0}),this.events.emit(ee("session_approve",i),{})):_t(n)&&(await this.client.session.delete(e,ae("USER_DISCONNECTED")),this.events.emit(ee("session_approve",i),{error:n.error}))}),x(this,"onSessionUpdateRequest",async(e,n)=>{const{params:i,id:s}=n;try{const o=`${e}_session_update`,c=Ur.get(o);if(c&&this.isRequestOutOfSync(c,s)){this.client.logger.warn(`Discarding out of sync request - ${s}`),this.sendError({id:s,topic:e,error:ae("INVALID_UPDATE_REQUEST")});return}this.isValidUpdate(te({topic:e},i));try{Ur.set(o,s),await this.client.session.update(e,{namespaces:i.namespaces}),await this.sendResult({id:s,topic:e,result:!0})}catch(l){throw Ur.delete(o),l}this.client.events.emit("session_update",{id:s,topic:e,params:i})}catch(o){await this.sendError({id:s,topic:e,error:o}),this.client.logger.error(o)}}),x(this,"isRequestOutOfSync",(e,n)=>n.toString().slice(0,-3)<e.toString().slice(0,-3)),x(this,"onSessionUpdateResponse",(e,n)=>{const{id:i}=n,s=ee("session_update",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);bt(n)?this.events.emit(ee("session_update",i),{}):_t(n)&&this.events.emit(ee("session_update",i),{error:n.error})}),x(this,"onSessionExtendRequest",async(e,n)=>{const{id:i}=n;try{this.isValidExtend({topic:e}),await this.setExpiry(e,_e(gr)),await this.sendResult({id:i,topic:e,result:!0}),this.client.events.emit("session_extend",{id:i,topic:e})}catch(s){await this.sendError({id:i,topic:e,error:s}),this.client.logger.error(s)}}),x(this,"onSessionExtendResponse",(e,n)=>{const{id:i}=n,s=ee("session_extend",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);bt(n)?this.events.emit(ee("session_extend",i),{}):_t(n)&&this.events.emit(ee("session_extend",i),{error:n.error})}),x(this,"onSessionPingRequest",async(e,n)=>{const{id:i}=n;try{this.isValidPing({topic:e}),await this.sendResult({id:i,topic:e,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_ping",{id:i,topic:e})}catch(s){await this.sendError({id:i,topic:e,error:s}),this.client.logger.error(s)}}),x(this,"onSessionPingResponse",(e,n)=>{const{id:i}=n,s=ee("session_ping",i);setTimeout(()=>{if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners 2176`);bt(n)?this.events.emit(ee("session_ping",i),{}):_t(n)&&this.events.emit(ee("session_ping",i),{error:n.error})},500)}),x(this,"onSessionDeleteRequest",async(e,n)=>{const{id:i}=n;try{this.isValidDisconnect({topic:e,reason:n.params}),await Promise.all([new Promise(s=>{this.client.core.relayer.once(le.publish,async()=>{s(await this.deleteSession({topic:e,id:i}))})}),this.sendResult({id:i,topic:e,result:!0}),this.cleanupPendingSentRequestsForTopic({topic:e,error:ae("USER_DISCONNECTED")})]).catch(s=>this.client.logger.error(s))}catch(s){this.client.logger.error(s)}}),x(this,"onSessionRequest",async e=>{var n,i,s;const{topic:o,payload:c,attestation:l,encryptedId:u,transportType:d}=e,{id:h,params:p}=c;try{await this.isValidRequest(te({topic:o},p));const _=this.client.session.get(o),f=await this.getVerifyContext({attestationId:l,hash:Qe(JSON.stringify(Ut("wc_sessionRequest",p,h))),encryptedId:u,metadata:_.peer.metadata,transportType:d}),m={id:h,topic:o,params:p,verifyContext:f};await this.setPendingSessionRequest(m),d===se.link_mode&&(n=_.peer.metadata.redirect)!=null&&n.universal&&this.client.core.addLinkModeSupportedApp((i=_.peer.metadata.redirect)==null?void 0:i.universal),(s=this.client.signConfig)!=null&&s.disableRequestQueue?this.emitSessionRequest(m):(this.addSessionRequestToSessionRequestQueue(m),this.processSessionRequestQueue())}catch(_){await this.sendError({id:h,topic:o,error:_}),this.client.logger.error(_)}}),x(this,"onSessionRequestResponse",(e,n)=>{const{id:i}=n,s=ee("session_request",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);bt(n)?this.events.emit(ee("session_request",i),{result:n.result}):_t(n)&&this.events.emit(ee("session_request",i),{error:n.error})}),x(this,"onSessionEventRequest",async(e,n)=>{const{id:i,params:s}=n;try{const o=`${e}_session_event_${s.event.name}`,c=Ur.get(o);if(c&&this.isRequestOutOfSync(c,i)){this.client.logger.info(`Discarding out of sync request - ${i}`);return}this.isValidEmit(te({topic:e},s)),this.client.events.emit("session_event",{id:i,topic:e,params:s}),Ur.set(o,i)}catch(o){await this.sendError({id:i,topic:e,error:o}),this.client.logger.error(o)}}),x(this,"onSessionAuthenticateResponse",(e,n)=>{const{id:i}=n;this.client.logger.trace({type:"method",method:"onSessionAuthenticateResponse",topic:e,payload:n}),bt(n)?this.events.emit(ee("session_request",i),{result:n.result}):_t(n)&&this.events.emit(ee("session_request",i),{error:n.error})}),x(this,"onSessionAuthenticateRequest",async e=>{var n;const{topic:i,payload:s,attestation:o,encryptedId:c,transportType:l}=e;try{const{requester:u,authPayload:d,expiryTimestamp:h}=s.params,p=await this.getVerifyContext({attestationId:o,hash:Qe(JSON.stringify(s)),encryptedId:c,metadata:u.metadata,transportType:l}),_={requester:u,pairingTopic:i,id:s.id,authPayload:d,verifyContext:p,expiryTimestamp:h};await this.setAuthRequest(s.id,{request:_,pairingTopic:i,transportType:l}),l===se.link_mode&&(n=u.metadata.redirect)!=null&&n.universal&&this.client.core.addLinkModeSupportedApp(u.metadata.redirect.universal),this.client.events.emit("session_authenticate",{topic:i,params:s.params,id:s.id,verifyContext:p})}catch(u){this.client.logger.error(u);const d=s.params.requester.publicKey,h=await this.client.core.crypto.generateKeyPair(),p=this.getAppLinkIfEnabled(s.params.requester.metadata,l),_={type:Ot,receiverPublicKey:d,senderPublicKey:h};await this.sendError({id:s.id,topic:i,error:u,encodeOpts:_,rpcOpts:Ie.wc_sessionAuthenticate.autoReject,appLink:p})}}),x(this,"addSessionRequestToSessionRequestQueue",e=>{this.sessionRequestQueue.queue.push(e)}),x(this,"cleanupAfterResponse",e=>{this.deletePendingSessionRequest(e.response.id,{message:"fulfilled",code:0}),setTimeout(()=>{this.sessionRequestQueue.state=ht.idle,this.processSessionRequestQueue()},q.toMiliseconds(this.requestQueueDelay))}),x(this,"cleanupPendingSentRequestsForTopic",({topic:e,error:n})=>{const i=this.client.core.history.pending;i.length>0&&i.filter(s=>s.topic===e&&s.request.method==="wc_sessionRequest").forEach(s=>{const o=s.request.id,c=ee("session_request",o);if(this.events.listenerCount(c)===0)throw new Error(`emitting ${c} without any listeners`);this.events.emit(ee("session_request",s.request.id),{error:n})})}),x(this,"processSessionRequestQueue",()=>{if(this.sessionRequestQueue.state===ht.active){this.client.logger.info("session request queue is already active.");return}const e=this.sessionRequestQueue.queue[0];if(!e){this.client.logger.info("session request queue is empty.");return}try{this.emitSessionRequest(e)}catch(n){this.client.logger.error(n)}}),x(this,"emitSessionRequest",e=>{if(this.emittedSessionRequests.has(e.id)){this.client.logger.warn({id:e.id},`Skipping emitting \`session_request\` event for duplicate request. id: ${e.id}`);return}this.sessionRequestQueue.state=ht.active,this.emittedSessionRequests.add(e.id),this.client.events.emit("session_request",e)}),x(this,"onPairingCreated",e=>{if(e.methods&&this.expectedPairingMethodMap.set(e.topic,e.methods),e.active)return;const n=this.client.proposal.getAll().find(i=>i.pairingTopic===e.topic);n&&this.onSessionProposeRequest({topic:e.topic,payload:Ut("wc_sessionPropose",Le(te({},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})}),x(this,"isValidConnect",async e=>{if(!Ne(e)){const{message:u}=U("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(e)}`);throw new Error(u)}const{pairingTopic:n,requiredNamespaces:i,optionalNamespaces:s,sessionProperties:o,scopedProperties:c,relays:l}=e;if(fe(n)||await this.isValidPairingTopic(n),!tg(l)){const{message:u}=U("MISSING_OR_INVALID",`connect() relays: ${l}`);throw new Error(u)}if(!fe(i)&&un(i)!==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(i,"requiredNamespaces")}if(!fe(s)&&un(s)!==0&&this.validateNamespaces(s,"optionalNamespaces"),fe(o)||this.validateSessionProps(o,"sessionProperties"),!fe(c)){this.validateSessionProps(c,"scopedProperties");const u=Object.keys(i||{}).concat(Object.keys(s||{}));if(!Object.keys(c).every(d=>u.includes(d.split(":")[0])))throw new Error(`Scoped properties must be a subset of required/optional namespaces, received: ${JSON.stringify(c)}, required/optional namespaces: ${JSON.stringify(u)}`)}}),x(this,"validateNamespaces",(e,n)=>{const i=eg(e,"connect()",n);if(i)throw new Error(i.message)}),x(this,"isValidApprove",async e=>{if(!Ne(e))throw new Error(U("MISSING_OR_INVALID",`approve() params: ${e}`).message);const{id:n,namespaces:i,relayProtocol:s,sessionProperties:o,scopedProperties:c}=e;this.checkRecentlyDeleted(n),await this.isValidProposalId(n);const l=this.client.proposal.get(n),u=Ci(i,"approve()");if(u)throw new Error(u.message);const d=Fa(l.requiredNamespaces,i,"approve()");if(d)throw new Error(d.message);if(!he(s,!0)){const{message:h}=U("MISSING_OR_INVALID",`approve() relayProtocol: ${s}`);throw new Error(h)}if(fe(o)||this.validateSessionProps(o,"sessionProperties"),!fe(c)){this.validateSessionProps(c,"scopedProperties");const h=new Set(Object.keys(i));if(!Object.keys(c).every(p=>h.has(p.split(":")[0])))throw new Error(`Scoped properties must be a subset of approved namespaces, received: ${JSON.stringify(c)}, approved namespaces: ${Array.from(h).join(", ")}`)}}),x(this,"isValidReject",async e=>{if(!Ne(e)){const{message:s}=U("MISSING_OR_INVALID",`reject() params: ${e}`);throw new Error(s)}const{id:n,reason:i}=e;if(this.checkRecentlyDeleted(n),await this.isValidProposalId(n),!ng(i)){const{message:s}=U("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(i)}`);throw new Error(s)}}),x(this,"isValidSessionSettleRequest",e=>{if(!Ne(e)){const{message:u}=U("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${e}`);throw new Error(u)}const{relay:n,controller:i,namespaces:s,expiry:o}=e;if(!Au(n)){const{message:u}=U("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(u)}const c=Gw(i,"onSessionSettleRequest()");if(c)throw new Error(c.message);const l=Ci(s,"onSessionSettleRequest()");if(l)throw new Error(l.message);if(qt(o)){const{message:u}=U("EXPIRED","onSessionSettleRequest()");throw new Error(u)}}),x(this,"isValidUpdate",async e=>{if(!Ne(e)){const{message:l}=U("MISSING_OR_INVALID",`update() params: ${e}`);throw new Error(l)}const{topic:n,namespaces:i}=e;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n);const s=this.client.session.get(n),o=Ci(i,"update()");if(o)throw new Error(o.message);const c=Fa(s.requiredNamespaces,i,"update()");if(c)throw new Error(c.message)}),x(this,"isValidExtend",async e=>{if(!Ne(e)){const{message:i}=U("MISSING_OR_INVALID",`extend() params: ${e}`);throw new Error(i)}const{topic:n}=e;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n)}),x(this,"isValidRequest",async e=>{if(!Ne(e)){const{message:l}=U("MISSING_OR_INVALID",`request() params: ${e}`);throw new Error(l)}const{topic:n,request:i,chainId:s,expiry:o}=e;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n);const{namespaces:c}=this.client.session.get(n);if(!Ka(c,s)){const{message:l}=U("MISSING_OR_INVALID",`request() chainId: ${s}`);throw new Error(l)}if(!ig(i)){const{message:l}=U("MISSING_OR_INVALID",`request() ${JSON.stringify(i)}`);throw new Error(l)}if(!ag(c,s,i.method)){const{message:l}=U("MISSING_OR_INVALID",`request() method: ${i.method}`);throw new Error(l)}if(o&&!dg(o,Mi)){const{message:l}=U("MISSING_OR_INVALID",`request() expiry: ${o}. Expiry must be a number (in seconds) between ${Mi.min} and ${Mi.max}`);throw new Error(l)}}),x(this,"isValidRespond",async e=>{var n;if(!Ne(e)){const{message:o}=U("MISSING_OR_INVALID",`respond() params: ${e}`);throw new Error(o)}const{topic:i,response:s}=e;try{await this.isValidSessionTopic(i)}catch(o){throw(n=e==null?void 0:e.response)!=null&&n.id&&this.cleanupAfterResponse(e),o}if(!sg(s)){const{message:o}=U("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(s)}`);throw new Error(o)}}),x(this,"isValidPing",async e=>{if(!Ne(e)){const{message:i}=U("MISSING_OR_INVALID",`ping() params: ${e}`);throw new Error(i)}const{topic:n}=e;await this.isValidSessionOrPairingTopic(n)}),x(this,"isValidEmit",async e=>{if(!Ne(e)){const{message:c}=U("MISSING_OR_INVALID",`emit() params: ${e}`);throw new Error(c)}const{topic:n,event:i,chainId:s}=e;await this.isValidSessionTopic(n);const{namespaces:o}=this.client.session.get(n);if(!Ka(o,s)){const{message:c}=U("MISSING_OR_INVALID",`emit() chainId: ${s}`);throw new Error(c)}if(!og(i)){const{message:c}=U("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(c)}if(!cg(o,s,i.name)){const{message:c}=U("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(c)}}),x(this,"isValidDisconnect",async e=>{if(!Ne(e)){const{message:i}=U("MISSING_OR_INVALID",`disconnect() params: ${e}`);throw new Error(i)}const{topic:n}=e;await this.isValidSessionOrPairingTopic(n)}),x(this,"isValidAuthenticate",e=>{const{chains:n,uri:i,domain:s,nonce:o}=e;if(!Array.isArray(n)||n.length===0)throw new Error("chains is required and must be a non-empty array");if(!he(i,!1))throw new Error("uri is required parameter");if(!he(s,!1))throw new Error("domain is required parameter");if(!he(o,!1))throw new Error("nonce is required parameter");if([...new Set(n.map(l=>xn(l).namespace))].length>1)throw new Error("Multi-namespace requests are not supported. Please request single namespace only.");const{namespace:c}=xn(n[0]);if(c!=="eip155")throw new Error("Only eip155 namespace is supported for authenticated sessions. Please use .connect() for non-eip155 chains.")}),x(this,"getVerifyContext",async e=>{const{attestationId:n,hash:i,encryptedId:s,metadata:o,transportType:c}=e,l={verified:{verifyUrl:o.verifyUrl||Xr,validation:"UNKNOWN",origin:o.url||""}};try{if(c===se.link_mode){const d=this.getAppLinkIfEnabled(o,c);return l.verified.validation=d&&new URL(d).origin===new URL(o.url).origin?"VALID":"INVALID",l}const u=await this.client.core.verify.resolve({attestationId:n,hash:i,encryptedId:s,verifyUrl:o.verifyUrl});u&&(l.verified.origin=u.origin,l.verified.isScam=u.isScam,l.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(l)}`),l}),x(this,"validateSessionProps",(e,n)=>{Object.values(e).forEach((i,s)=>{if(i==null){const{message:o}=U("MISSING_OR_INVALID",`${n} must contain an existing value for each key. Received: ${i} for key ${Object.keys(e)[s]}`);throw new Error(o)}})}),x(this,"getPendingAuthRequest",e=>{const n=this.client.auth.requests.get(e);return typeof n=="object"?n:void 0}),x(this,"addToRecentlyDeleted",(e,n)=>{if(this.recentlyDeletedMap.set(e,n),this.recentlyDeletedMap.size>=this.recentlyDeletedLimit){let i=0;const s=this.recentlyDeletedLimit/2;for(const o of this.recentlyDeletedMap.keys()){if(i++>=s)break;this.recentlyDeletedMap.delete(o)}}}),x(this,"checkRecentlyDeleted",e=>{const n=this.recentlyDeletedMap.get(e);if(n){const{message:i}=U("MISSING_OR_INVALID",`Record was recently deleted - ${n}: ${e}`);throw new Error(i)}}),x(this,"isLinkModeEnabled",(e,n)=>{var i,s,o,c,l,u,d,h,p;return!e||n!==se.link_mode?!1:((s=(i=this.client.metadata)==null?void 0:i.redirect)==null?void 0:s.linkMode)===!0&&((c=(o=this.client.metadata)==null?void 0:o.redirect)==null?void 0:c.universal)!==void 0&&((u=(l=this.client.metadata)==null?void 0:l.redirect)==null?void 0:u.universal)!==""&&((d=e==null?void 0:e.redirect)==null?void 0:d.universal)!==void 0&&((h=e==null?void 0:e.redirect)==null?void 0:h.universal)!==""&&((p=e==null?void 0:e.redirect)==null?void 0:p.linkMode)===!0&&this.client.core.linkModeSupportedApps.includes(e.redirect.universal)&&typeof(it==null?void 0:it.Linking)<"u"}),x(this,"getAppLinkIfEnabled",(e,n)=>{var i;return this.isLinkModeEnabled(e,n)?(i=e==null?void 0:e.redirect)==null?void 0:i.universal:void 0}),x(this,"handleLinkModeMessage",({url:e})=>{if(!e||!e.includes("wc_ev")||!e.includes("topic"))return;const n=ia(e,"topic")||"",i=decodeURIComponent(ia(e,"wc_ev")||""),s=this.client.session.keys.includes(n);s&&this.client.session.update(n,{transportType:se.link_mode}),this.client.core.dispatchEnvelope({topic:n,message:i,sessionExists:s})}),x(this,"registerLinkModeListeners",async()=>{var e;if(eo()||Ht()&&(e=this.client.metadata.redirect)!=null&&e.linkMode){const n=it==null?void 0:it.Linking;if(typeof n<"u"){n.addEventListener("url",this.handleLinkModeMessage,this.client.name);const i=await n.getInitialURL();i&&setTimeout(()=>{this.handleLinkModeMessage({url:i})},50)}}}),x(this,"getTVFParams",(e,n,i)=>{var s,o,c;if(!((s=n.request)!=null&&s.method))return{};const l={correlationId:e,rpcMethods:[n.request.method],chainId:n.chainId};try{const u=this.extractTxHashesFromResult(n.request,i);l.txHashes=u,l.contractAddresses=this.isValidContractData(n.request.params)?[(c=(o=n.request.params)==null?void 0:o[0])==null?void 0:c.to]:[]}catch(u){this.client.logger.warn("Error getting TVF params",u)}return l}),x(this,"isValidContractData",e=>{var n;if(!e)return!1;try{const i=(e==null?void 0:e.data)||((n=e==null?void 0:e[0])==null?void 0:n.data);if(!i.startsWith("0x"))return!1;const s=i.slice(2);return/^[0-9a-fA-F]*$/.test(s)?s.length%2===0:!1}catch{}return!1}),x(this,"extractTxHashesFromResult",(e,n)=>{var i;try{if(!n)return[];const s=e.method,o=pb[s];if(s==="sui_signTransaction")return[xm(n.transactionBytes)];if(s==="near_signTransaction")return[ha(n)];if(s==="near_signTransactions")return n.map(l=>ha(l));if(s==="xrpl_signTransactionFor"||s==="xrpl_signTransaction")return[(i=n.tx_json)==null?void 0:i.hash];if(s==="polkadot_signTransaction")return[Pg({transaction:e.params.transactionPayload,signature:n.signature})];if(s==="algo_signTxn")return Ar(n)?n.map(l=>pa(l)):[pa(n)];if(s==="cosmos_signDirect")return[$m(n)];if(typeof n=="string")return[n];const c=n[o.key];if(Ar(c))return s==="solana_signAllTransactions"?c.map(l=>Sm(l)):c;if(typeof c=="string")return[c]}catch(s){this.client.logger.warn("Error extracting tx hashes from result",s)}return[]})}async processPendingMessageEvents(){try{const t=this.client.session.keys,e=this.client.core.relayer.messages.getWithoutAck(t);for(const[n,i]of Object.entries(e))for(const s of i)try{await this.onProviderMessageEvent({topic:n,message:s,publishedAt:Date.now()})}catch{this.client.logger.warn(`Error processing pending message event for topic: ${n}, message: ${s}`)}}catch(t){this.client.logger.warn("processPendingMessageEvents failed",t)}}isInitialized(){if(!this.initialized){const{message:t}=U("NOT_INITIALIZED",this.name);throw new Error(t)}}async confirmOnlineStateOrThrow(){await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(le.message,t=>{this.onProviderMessageEvent(t)})}async onRelayMessage(t){const{topic:e,message:n,attestation:i,transportType:s}=t,{publicKey:o}=this.client.auth.authKeys.keys.includes(Nn)?this.client.auth.authKeys.get(Nn):{publicKey:void 0};try{const c=await this.client.core.crypto.decode(e,n,{receiverPublicKey:o,encoding:s===se.link_mode?zt:Me});qs(c)?(this.client.core.history.set(e,c),await this.onRelayEventRequest({topic:e,payload:c,attestation:i,transportType:s,encryptedId:Qe(n)})):Ms(c)?(await this.client.core.history.resolve(c),await this.onRelayEventResponse({topic:e,payload:c,transportType:s}),this.client.core.history.delete(e,c.id)):await this.onRelayEventUnknownPayload({topic:e,payload:c,transportType:s}),await this.client.core.relayer.messages.ack(e,n)}catch(c){this.client.logger.error(c)}}registerExpirerEvents(){this.client.core.expirer.on(Ye.expired,async t=>{const{topic:e,id:n}=Vl(t.target);if(n&&this.client.pendingRequest.keys.includes(n))return await this.deletePendingSessionRequest(n,U("EXPIRED"),!0);if(n&&this.client.auth.requests.keys.includes(n))return await this.deletePendingAuthRequest(n,U("EXPIRED"),!0);e?this.client.session.keys.includes(e)&&(await this.deleteSession({topic:e,expirerHasDeleted:!0}),this.client.events.emit("session_expire",{topic:e})):n&&(await this.deleteProposal(n,!0),this.client.events.emit("proposal_expire",{id:n}))})}registerPairingEvents(){this.client.core.pairing.events.on(Qt.create,t=>this.onPairingCreated(t)),this.client.core.pairing.events.on(Qt.delete,t=>{this.addToRecentlyDeleted(t.topic,"pairing")})}isValidPairingTopic(t){if(!he(t,!1)){const{message:e}=U("MISSING_OR_INVALID",`pairing topic should be a string: ${t}`);throw new Error(e)}if(!this.client.core.pairing.pairings.keys.includes(t)){const{message:e}=U("NO_MATCHING_KEY",`pairing topic doesn't exist: ${t}`);throw new Error(e)}if(qt(this.client.core.pairing.pairings.get(t).expiry)){const{message:e}=U("EXPIRED",`pairing topic: ${t}`);throw new Error(e)}}async isValidSessionTopic(t){if(!he(t,!1)){const{message:e}=U("MISSING_OR_INVALID",`session topic should be a string: ${t}`);throw new Error(e)}if(this.checkRecentlyDeleted(t),!this.client.session.keys.includes(t)){const{message:e}=U("NO_MATCHING_KEY",`session topic doesn't exist: ${t}`);throw new Error(e)}if(qt(this.client.session.get(t).expiry)){await this.deleteSession({topic:t});const{message:e}=U("EXPIRED",`session topic: ${t}`);throw new Error(e)}if(!this.client.core.crypto.keychain.has(t)){const{message:e}=U("MISSING_OR_INVALID",`session topic does not exist in keychain: ${t}`);throw await this.deleteSession({topic:t}),new Error(e)}}async isValidSessionOrPairingTopic(t){if(this.checkRecentlyDeleted(t),this.client.session.keys.includes(t))await this.isValidSessionTopic(t);else if(this.client.core.pairing.pairings.keys.includes(t))this.isValidPairingTopic(t);else if(he(t,!1)){const{message:e}=U("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${t}`);throw new Error(e)}else{const{message:e}=U("MISSING_OR_INVALID",`session or pairing topic should be a string: ${t}`);throw new Error(e)}}async isValidProposalId(t){if(!rg(t)){const{message:e}=U("MISSING_OR_INVALID",`proposal id should be a number: ${t}`);throw new Error(e)}if(!this.client.proposal.keys.includes(t)){const{message:e}=U("NO_MATCHING_KEY",`proposal id doesn't exist: ${t}`);throw new Error(e)}if(qt(this.client.proposal.get(t).expiryTimestamp)){await this.deleteProposal(t);const{message:e}=U("EXPIRED",`proposal id: ${t}`);throw new Error(e)}}}class Ob extends pr{constructor(t,e){super(t,e,ub,mo),this.core=t,this.logger=e}}class Rb extends pr{constructor(t,e){super(t,e,db,mo),this.core=t,this.logger=e}}class Lb extends pr{constructor(t,e){super(t,e,_b,mo,n=>n.id),this.core=t,this.logger=e}}class Db extends pr{constructor(t,e){super(t,e,wb,fi,()=>Nn),this.core=t,this.logger=e}}class Vb extends pr{constructor(t,e){super(t,e,gb,fi),this.core=t,this.logger=e}}class Sb extends pr{constructor(t,e){super(t,e,Eb,fi,n=>n.id),this.core=t,this.logger=e}}var xb=Object.defineProperty,Cb=(r,t,e)=>t in r?xb(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Bi=(r,t,e)=>Cb(r,typeof t!="symbol"?t+"":t,e);class $b{constructor(t,e){this.core=t,this.logger=e,Bi(this,"authKeys"),Bi(this,"pairingTopics"),Bi(this,"requests"),this.authKeys=new Db(this.core,this.logger),this.pairingTopics=new Vb(this.core,this.logger),this.requests=new Sb(this.core,this.logger)}async init(){await this.authKeys.init(),await this.pairingTopics.init(),await this.requests.init()}}var kb=Object.defineProperty,Nb=(r,t,e)=>t in r?kb(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,J=(r,t,e)=>Nb(r,typeof t!="symbol"?t+"":t,e);class yo extends y_{constructor(t){super(t),J(this,"protocol",Bu),J(this,"version",ju),J(this,"name",qi.name),J(this,"metadata"),J(this,"core"),J(this,"logger"),J(this,"events",new ur.EventEmitter),J(this,"engine"),J(this,"session"),J(this,"proposal"),J(this,"pendingRequest"),J(this,"auth"),J(this,"signConfig"),J(this,"on",(n,i)=>this.events.on(n,i)),J(this,"once",(n,i)=>this.events.once(n,i)),J(this,"off",(n,i)=>this.events.off(n,i)),J(this,"removeListener",(n,i)=>this.events.removeListener(n,i)),J(this,"removeAllListeners",n=>this.events.removeAllListeners(n)),J(this,"connect",async n=>{try{return await this.engine.connect(n)}catch(i){throw this.logger.error(i.message),i}}),J(this,"pair",async n=>{try{return await this.engine.pair(n)}catch(i){throw this.logger.error(i.message),i}}),J(this,"approve",async n=>{try{return await this.engine.approve(n)}catch(i){throw this.logger.error(i.message),i}}),J(this,"reject",async n=>{try{return await this.engine.reject(n)}catch(i){throw this.logger.error(i.message),i}}),J(this,"update",async n=>{try{return await this.engine.update(n)}catch(i){throw this.logger.error(i.message),i}}),J(this,"extend",async n=>{try{return await this.engine.extend(n)}catch(i){throw this.logger.error(i.message),i}}),J(this,"request",async n=>{try{return await this.engine.request(n)}catch(i){throw this.logger.error(i.message),i}}),J(this,"respond",async n=>{try{return await this.engine.respond(n)}catch(i){throw this.logger.error(i.message),i}}),J(this,"ping",async n=>{try{return await this.engine.ping(n)}catch(i){throw this.logger.error(i.message),i}}),J(this,"emit",async n=>{try{return await this.engine.emit(n)}catch(i){throw this.logger.error(i.message),i}}),J(this,"disconnect",async n=>{try{return await this.engine.disconnect(n)}catch(i){throw this.logger.error(i.message),i}}),J(this,"find",n=>{try{return this.engine.find(n)}catch(i){throw this.logger.error(i.message),i}}),J(this,"getPendingSessionRequests",()=>{try{return this.engine.getPendingSessionRequests()}catch(n){throw this.logger.error(n.message),n}}),J(this,"authenticate",async(n,i)=>{try{return await this.engine.authenticate(n,i)}catch(s){throw this.logger.error(s.message),s}}),J(this,"formatAuthMessage",n=>{try{return this.engine.formatAuthMessage(n)}catch(i){throw this.logger.error(i.message),i}}),J(this,"approveSessionAuthenticate",async n=>{try{return await this.engine.approveSessionAuthenticate(n)}catch(i){throw this.logger.error(i.message),i}}),J(this,"rejectSessionAuthenticate",async n=>{try{return await this.engine.rejectSessionAuthenticate(n)}catch(i){throw this.logger.error(i.message),i}}),this.name=(t==null?void 0:t.name)||qi.name,this.metadata=Af(t==null?void 0:t.metadata),this.signConfig=t==null?void 0:t.signConfig;const e=typeof(t==null?void 0:t.logger)<"u"&&typeof(t==null?void 0:t.logger)!="string"?t.logger:oi(Qs({level:(t==null?void 0:t.logger)||qi.logger}));this.core=(t==null?void 0:t.core)||new lb(t),this.logger=Ce(e,this.name),this.session=new Rb(this.core,this.logger),this.proposal=new Ob(this.core,this.logger),this.pendingRequest=new Lb(this.core,this.logger),this.engine=new Pb(this),this.auth=new $b(this.core,this.logger)}static async init(t){const e=new yo(t);return await e.initialize(),e}get context(){return Ke(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(t){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(t.message),t}}}const Ub=yo,qb="08c4b07e3ad25f1a27c14a4e8cecb6f0",hA="eip155";async function Mb(r){const{account:t,chainId:e,params:[n]}=r;if(!t.sendRawTransaction)throw new Error("The current account does not support sending raw transactions");return(await t.sendRawTransaction({chainId:e,rawTransaction:n})).transactionHash}function mi(r,t){if(Ao(r.address)!==Ao(t))throw new Error(`Failed to validate account address (${r.address}), differs from ${t}`)}function pA(r){const t=r.split(":"),e=Number.parseInt(t[1]??"0");if(t.length!==2||t[0]!=="eip155"||e===0||!e)throw new Error(`Invalid chainId ${r}, should have the format 'eip155:1'`);return e}async function Bb(r){const{account:t,chainId:e,thirdwebClient:n,params:[i]}=r;i.from!==void 0&&mi(t,i.from);const s=Gi({chain:ge(e),client:n,data:i.data,gas:i.gas?Ve(i.gas):void 0,gasPrice:i.gasPrice?Ve(i.gasPrice):void 0,to:i.to,value:i.value?Ve(i.value):void 0});return(await Cc({account:t,transaction:s})).transactionHash}async function vc(r){const{account:t,params:e}=r;return mi(t,e[1]),t.signMessage({message:{raw:e[0]}})}async function jb(r){const{account:t,params:[e]}=r;if(!t.signTransaction)throw new Error("The current account does not support signing transactions");return e.from!==void 0&&mi(t,e.from),t.signTransaction({data:e.data,gas:e.gas?Ve(e.gas):void 0,gasPrice:e.gasPrice?Ve(e.gasPrice):void 0,nonce:e.nonce?sr(e.nonce):void 0,to:e.to,value:e.value?Ve(e.value):void 0})}async function bc(r){const{account:t,params:e}=r;return mi(t,e[0]),t.signTypedData(typeof e[1]=="string"?JSON.parse(e[1]):e[1])}async function Ku(r){var n;const{wallet:t,params:e}=r;return((n=t.getChain())==null?void 0:n.id)===sr(e[0].chainId)||await t.switchChain($d(sr(e[0].chainId))),"0x1"}const _A=Object.freeze(Object.defineProperty({__proto__:null,handleSwitchChain:Ku},Symbol.toStringTag,{value:"Module"})),fA="/sdk/2022-08-12/embedded-wallet",ji=r=>`thirdwebEwsWalletUserId-${r}`,zb="walletToken",zi=r=>`${zb}-${r}`,Ic=r=>`passkey-credential-id-${r}`,Kb="a",Ki=(r,t)=>`${Kb}-${r}-${t}`,Ac=r=>`walletConnectSessions-${r}`,Tc=r=>`thirdweb_guest_session_id_${r}`,Pc=new Map;class wo{constructor({storage:t,clientId:e,ecosystem:n}){Object.defineProperty(this,"key",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"storage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ecosystem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.storage=t,this.key=Fb(e,n==null?void 0:n.id),this.ecosystem=n}async getItem(t){return this.storage?this.storage.getItem(t):Pc.get(t)??null}async setItem(t,e){if(this.storage)return this.storage.setItem(t,e);Pc.set(t,e)}async removeItem(t){const e=await this.getItem(t);return this.storage&&e?(this.storage.removeItem(t),!0):!1}async getWalletConnectSessions(){return this.getItem(Ac(this.key))}async saveWalletConnectSessions(t){await this.setItem(Ac(this.key),t)}async savePasskeyCredentialId(t){await this.setItem(Ic(this.key),t)}async getPasskeyCredentialId(){return this.getItem(Ic(this.key))}async saveAuthCookie(t){await this.setItem(zi(this.key),t)}async getAuthCookie(){return this.getItem(zi(this.key))}async removeAuthCookie(){return this.removeItem(zi(this.key))}async saveDeviceShare(t,e){await this.saveWalletUserId(e),await this.setItem(Ki(this.key,e),t)}async getDeviceShare(){const t=await this.getWalletUserId();return t?this.getItem(Ki(this.key,t)):null}async removeDeviceShare(){const t=await this.getWalletUserId();return t?this.removeItem(Ki(this.key,t)):!1}async getWalletUserId(){return this.getItem(ji(this.key))}async saveWalletUserId(t){await this.setItem(ji(this.key),t)}async removeWalletUserId(){return this.removeItem(ji(this.key))}async getGuestSessionId(){return this.getItem(Tc(this.key))}async saveGuestSessionId(t){await this.setItem(Tc(this.key),t)}}const Fb=(r,t)=>`${r}${t?`-${t}`:""}`;let yt;async function Fu(){if(!yt)return[];const r=await yt.getWalletConnectSessions();return JSON.parse(r??"[]")}function Wb(r){yt||(yt=new wo({clientId:r.clientId,storage:null}))}async function mA(r){if(!yt)return;const t=await yt.getWalletConnectSessions(),e=JSON.parse(t??"[]");e.push(r),await yt.saveWalletConnectSessions(we(e))}async function Hb(r){if(!yt)return;const t=await yt.getWalletConnectSessions(),n=JSON.parse(t??"[]").filter(i=>i.topic!==r.topic);await yt.saveWalletConnectSessions(we(n))}let Fi=new WeakMap;const Gb={eth_sendRawTransaction:Mb,eth_sendTransaction:Bb,eth_sign:vc,eth_signTransaction:jb,eth_signTypedData:bc,eth_signTypedData_v4:bc,personal_sign:vc,wallet_addEthereumChain:r=>{throw new Error("Unsupported request method: wallet_addEthereumChain")},wallet_switchEthereumChain:Ku};async function Jb(r){var d,h,p,_;const{wallet:t,requestHandlers:e,onConnect:n,onDisconnect:i,client:s}=r,o=r.chains&&r.chains.length>10?(console.warn("WalletConnect: Can specify no more than 10 chains, truncating to the first 10 provided chains..."),r.chains.slice(0,10)):r.chains;if(Fi.has(s))return Fi.get(s);Wb({clientId:r.client.clientId});const c=Wn(),l=await Ub.init({metadata:{description:((d=r.appMetadata)==null?void 0:d.description)??c.description,icons:[((h=r.appMetadata)==null?void 0:h.logoUrl)??c.logoUrl],name:((p=r.appMetadata)==null?void 0:p.name)??c.name,url:((_=r.appMetadata)==null?void 0:_.url)??c.url},projectId:r.projectId??qb});l.on("session_proposal",async f=>{const{onSessionProposal:m}=await a(async()=>{const{onSessionProposal:y}=await import("./session-proposal-BnHJBpnN.js");return{onSessionProposal:y}},__vite__mapDeps([26,1,2,3,4,5,6,7]));await m({chains:o,event:f,onConnect:n,wallet:t,walletConnectClient:l}).catch(y=>{if(r.onError)r.onError(y);else throw y})}),l.on("session_request",async f=>{const{fulfillRequest:m}=await a(async()=>{const{fulfillRequest:y}=await import("./session-request-oxggTqvw.js");return{fulfillRequest:y}},__vite__mapDeps([27,3,4,1,2,5,6,7]));await m({event:f,handlers:e,thirdwebClient:s,wallet:t,walletConnectClient:l}).catch(y=>{if(r.onError)r.onError(y);else throw y})}),l.on("session_event",async f=>{}),l.on("session_ping",f=>{}),l.on("session_delete",async f=>{await Wu({session:{topic:f.topic},walletConnectClient:l}).catch(m=>{if(r.onError)r.onError(m);else throw m})});const u=l.disconnect;return l.disconnect=async f=>{const m=await u(f).catch(()=>{});return i&&Qb({onDisconnect:i,topic:f.topic}),m},Fi.set(r.client,l),l}function Zb(r){const{uri:t,walletConnectClient:e}=r;e.core.pairing.pair({uri:t})}async function Yb(){return Fu()}async function Wu(r){Hb(r.session);try{await r.walletConnectClient.disconnect({reason:{code:6e3,message:"Disconnected"},topic:r.session.topic})}catch{}}async function Qb(r){const{topic:t,onDisconnect:e}=r,n=await Fu();e(n.find(i=>i.topic===t)??{topic:t})}function Xb(r){return[at("inApp",{executionMode:r==null?void 0:r.executionMode}),at(Wc),at(ft,{appMetadata:r==null?void 0:r.appMetadata,chains:r==null?void 0:r.chains}),at(Vh),at("io.rabby"),at(Sh),at("com.okex.wallet")]}function eI(r,t){const e=new Set;let n=r();const i=()=>{for(const o of e)o()},s=o=>{n=o,i()};for(const o of t)o.subscribe(()=>{s(r())});return{getValue(){return n},subscribe(o){return e.add(o),()=>{e.delete(o)}}}}function Dn(r,t,e=!0){e&&r();const n=t.map(i=>i.subscribe(()=>{r()}));return()=>{for(const i of n)i()}}const dn="tw:connected-wallet-params";async function yA(r,t,e){if(!rI(e))throw new Error("given params are not stringifiable");const n=await r.getItem(dn);let i;if(n){try{i=JSON.parse(n)}catch{i={}}i[t]=e}else i={[t]:e};r.setItem(dn,we(i))}async function tI(r,t){const e=await r.getItem(dn);let n;if(e){try{n=JSON.parse(e)}catch{n={}}delete n[t],r.setItem(dn,we(n))}}async function wA(r,t){const e=await r.getItem(dn);if(!e)return null;try{const n=JSON.parse(e);return n!=null&&n[t]?n[t]:null}catch{return null}}function rI(r){try{return we(r),!0}catch{return!1}}function nI(r){let t;return()=>(t||(t=r()),t)}function iI(r={}){return Nc({filters:r,signature:"event UserOperationRevertReason(bytes32 indexed userOpHash, address indexed sender, uint256 nonce, bytes revertReason)"})}function sI(r={}){return Nc({filters:r,signature:"event PostOpRevertReason(bytes32 indexed userOpHash, address indexed sender, uint256 nonce, bytes revertReason)"})}function oI(r){const{receipt:t}=r,e={...t,blockNumber:t.blockNumber?BigInt(t.blockNumber):null,contractAddress:t.contractAddress?t.contractAddress:null,cumulativeGasUsed:t.cumulativeGasUsed?BigInt(t.cumulativeGasUsed):null,effectiveGasPrice:t.effectiveGasPrice?BigInt(t.effectiveGasPrice):null,gasUsed:t.gasUsed?BigInt(t.gasUsed):null,logs:t.logs,status:t.status,to:t.to?t.to:null,transactionHash:t.transactionHash,transactionIndex:t.transactionIndex,type:t.type};return t.blobGasPrice&&(e.blobGasPrice=BigInt(t.blobGasPrice)),t.blobGasUsed&&(e.blobGasUsed=BigInt(t.blobGasUsed)),{...r,actualGasCost:BigInt(r.actualGasCost),actualGasUsed:BigInt(r.actualGasUsed),nonce:BigInt(r.nonce),receipt:e,userOpHash:r.userOpHash}}const gA=()=>{const r=BigInt(Math.floor(Math.random()*4294967296)),t=BigInt(Math.floor(Math.random()*4294967296)),e=BigInt(Math.floor(Math.random()*4294967296)),n=BigInt(Math.floor(Math.random()*4294967296)),i=BigInt(Math.floor(Math.random()*4294967296)),s=BigInt(Math.floor(Math.random()*4294967296));return r<<BigInt(160)|t<<BigInt(128)|e<<BigInt(96)|n<<BigInt(64)|i<<BigInt(32)|s};function Hu(r){return Object.fromEntries(Object.entries(r).map(([t,e])=>[t,e==null||qn(e)?e:Ns(e)]))}async function EA(r){return Gt({...r,operation:"eth_sendUserOperation",params:[Hu(r.userOp),r.options.entrypointAddress??si]})}async function vA(r,t){const e=await Gt({...r,operation:"eth_estimateUserOperationGas",params:[Hu(r.userOp),r.options.entrypointAddress??si,t??{}]});return{callGasLimit:Ve(e.callGasLimit)+bh,paymasterPostOpGasLimit:e.paymasterPostOpGasLimit!==void 0?Ve(e.paymasterPostOpGasLimit):void 0,paymasterVerificationGasLimit:e.paymasterVerificationGasLimit!==void 0?Ve(e.paymasterVerificationGasLimit):void 0,preVerificationGas:Ve(e.preVerificationGas),verificationGas:e.verificationGas!==void 0?Ve(e.verificationGas):void 0,verificationGasLimit:Ve(e.verificationGasLimit)}}async function bA(r){const t=await Gt({...r,operation:"thirdweb_getUserOperationGasPrice",params:[]});return{maxFeePerGas:Ve(t.maxFeePerGas),maxPriorityFeePerGas:Ve(t.maxPriorityFeePerGas)}}async function IA(r){var e,n;const t=await aI(r);if(t){if(t.success===!1){const s=(n=(e=Id({events:[iI(),sI()],logs:t.logs})[0])==null?void 0:e.args)==null?void 0:n.revertReason;if(!s)throw new Error(`UserOp failed at txHash: ${t.receipt.transactionHash}`);const o=Ad({data:s});throw new Error(`UserOp failed with reason: '${o.args.join(",")}' at txHash: ${t.receipt.transactionHash}`)}return t.receipt}}async function aI(r){const t=await Gt({operation:"eth_getUserOperationReceipt",options:r,params:[r.userOpHash]});if(t)return oI(t)}async function AA(r){const t=await Gt({operation:"zk_paymasterData",options:r.options,params:[r.transaction]});return{paymaster:t.paymaster,paymasterInput:t.paymasterInput}}async function cI(r){const t=await Gt({...r,operation:"tw_execute",params:[r.eoaAddress,r.wrappedCalls,r.signature,r.authorization]});if(!t.queueId)throw new Error(`Error executing 7702 transaction: ${we(t)}`);return{transactionId:t.queueId}}async function lI(r){return{transactionHash:(await Gt({...r,operation:"tw_getTransactionHash",params:[r.transactionId]})).transactionHash}}async function TA(r){return{transactionHash:(await Gt({operation:"zk_broadcastTransaction",options:r.options,params:[{...r.transaction,signedTransaction:r.signedTransaction}]})).transactionHash}}async function Gt(r){const{options:t,operation:e,params:n}=r,i=t.bundlerUrl??Kc(t.chain),o=await hn(t.client)(i,{useAuthToken:!0,body:we({id:1,jsonrpc:"2.0",method:e,params:n}),headers:{"Content-Type":"application/json"},method:"POST"}),c=await o.json();if(!o.ok||c.error){let l=c.error||o.statusText;typeof l=="object"&&(l=we(l));const u=c.code||"UNKNOWN";throw new Error(`${e} error: ${l}
|
|
14
14
|
Status: ${o.status}
|
|
15
|
-
Code: ${u}`)}return c.result}function Ds(r){if(!r)return!1;if(r.id==="smart")return!0;if(r.id==="inApp"||Or(r)){const t=r.getConfig();if(t&&"smartAccount"in t&&t.smartAccount)return!0;if(t!=null&&t.executionMode){const e=t.executionMode;return e.mode==="EIP4337"||e.mode==="EIP7702"}}return!1}const Gu="thirdweb:connected-wallet-ids",Un="thirdweb:active-wallet-id",Vs="thirdweb:active-chain",Oc="thirdweb:last-used-wallet-id";function uI(r){const t=Jt(void 0),e=Jt(void 0),n=Jt(void 0),i=Jt("unknown"),s=Jt(new Map);Dn(()=>{kd([...s.getValue().values()])},[s]),Dn(()=>{const g=n.getValue();if(!g)return;const P=s.getValue().get(g.id);!P||P===g||n.setValue(P)},[s,n]);const o=Jt(new Map),c=Jt(!1),l=eI(()=>Array.from(o.getValue().values()),[o]),u=g=>{const P=o.getValue();if(P.has(g.id))return;const A=new Map(P);A.set(g.id,g),o.setValue(A)},d=g=>{const P=o.getValue(),A=new Map(P);A.delete(g.id),o.setValue(A)},h=g=>{tI(r,g.id),d(g),t.getValue()===g&&(r.removeItem(Un),e.setValue(void 0),n.setValue(void 0),t.setValue(void 0),i.setValue("disconnected"))},p=g=>{h(g),g.disconnect()},_=async(g,P)=>{if(!g.getAccount())throw new Error("Cannot set a wallet without an account as active");const E=await(async()=>P!=null&&P.accountAbstraction&&!Ds(g)?await dI(g,P.client,P.accountAbstraction,h):g)();return await r.setItem(Un,g.id),await r.setItem(Oc,g.id),u(g),(P==null?void 0:P.setWalletAsActive)!==!1&&m(E),g.subscribe("accountChanged",async()=>{var L;const D=await _(g,P);(L=P==null?void 0:P.onConnect)==null||L.call(P,D,l.getValue())}),E},f=async(g,P)=>{var E;const A=await _(g,P);return(E=P==null?void 0:P.onConnect)==null||E.call(P,A,l.getValue()),A},m=g=>{const P=g.getAccount();if(!P)throw new Error("Cannot set a wallet without an account as active");u(g),t.setValue(g),e.setValue(P),n.setValue(g.getChain()),i.setValue("connected");const A=v=>{e.setValue(v)},E=g.subscribe("accountChanged",A),D=g.subscribe("chainChanged",v=>n.setValue(v)),L=g.subscribe("disconnect",()=>{w()}),w=()=>{h(g),E(),D(),L()}},y=async g=>{m(g),g.id!=="smart"&&(await r.setItem(Un,g.id),await r.setItem(Oc,g.id))};Dn(()=>{const g=n.getValue();g?r.setItem(Vs,we(g)):r.removeItem(Vs)},[n],!1),Dn(async()=>{const P=l.getValue().map(A=>A==null?void 0:A.id).filter(A=>!!A);r.setItem(Gu,we(Array.from(new Set([...P]))))},[l],!1);const b=async g=>{const P=t.getValue();if(!P)throw new Error("No active wallet found");if(!P.switchChain)throw new Error("Wallet does not support switching chains");if(Ds(P)){const A=await go(r);if(A){const E=l.getValue().find(D=>D.id===A);if(E){await E.switchChain(g),await P.switchChain(g),m(P);return}}await P.switchChain(g),m(P)}else await P.switchChain(g);n.setValue(P.getChain())};function O(g){const P=s.getValue();if(g.every(D=>{const L=P.get(D.id);return we(L)===we(D)}))return;const E=new Map(P);for(const D of g)E.set(D.id,D);s.setValue(E)}return{activeAccountStore:e,activeWalletChainStore:n,activeWalletConnectionStatusStore:i,activeWalletStore:t,addConnectedWallet:u,connect:f,connectedWallets:l,defineChains:O,disconnectWallet:p,handleConnection:_,isAutoConnecting:c,removeConnectedWallet:d,setActiveWallet:y,switchActiveWalletChain:b}}async function Ju(r){try{const t=await r.getItem(Gu);return t?JSON.parse(t):[]}catch{return[]}}async function go(r){try{const t=await r.getItem(Un);if(t)return t}catch{}return null}async function Zu(r){try{const t=await r.getItem(Vs);if(t)return JSON.parse(t)}catch{}return null}const dI=async(r,t,e,n)=>{const i=r.getAccount();if(!i)throw new Error("Cannot set a wallet without an account as active");const s=Gs(e);await s.connect({chain:e.chain,client:t,personalAccount:i});const o=r.subscribe("disconnect",()=>{c()}),c=()=>{o(),n(s)};return s};function Yu(r,t){return new Promise((e,n)=>{const i=setTimeout(()=>{n(new Error(t.message))},t.ms);r.then(s=>{clearTimeout(i),e(s)},s=>{clearTimeout(i),n(s)})})}async function hI({client:r,ecosystem:t,tokenToLink:e,storage:n}){const i=hn(r,t),s=ii("inAppWallet"),o=await n.getAuthCookie();if(!o)throw new Error("Failed to link account, no user logged in");const c={Authorization:`Bearer iaw-auth-token:${o}`,"Content-Type":"application/json"},l=await i(`${s}/api/2024-05-05/account/connect`,{body:we({accountAuthTokenToConnect:e}),headers:c,method:"POST"});if(!l.ok){const d=await l.json();throw new Error(d.message||"Failed to link account.")}const{linkedAccounts:u}=await l.json();return u??[]}async function PA({client:r,ecosystem:t,profileToUnlink:e,allowAccountDeletion:n=!1,storage:i}){const s=hn(r,t),o=ii("inAppWallet"),c=await i.getAuthCookie();if(!c)throw new Error("Failed to unlink account, no user logged in");const l={Authorization:`Bearer iaw-auth-token:${c}`,"Content-Type":"application/json"},u=await s(`${o}/api/2024-05-05/account/disconnect`,{body:we({allowAccountDeletion:n,details:e.details,type:e.type}),headers:l,method:"POST"});if(!u.ok){const h=await u.json();throw new Error(h.message||"Failed to unlink account.")}const{linkedAccounts:d}=await u.json();return d??[]}async function OA({client:r,ecosystem:t,storage:e}){const n=hn(r,t),i=ii("inAppWallet"),s=await e.getAuthCookie();if(!s)throw new Error("Failed to get linked accounts, no user logged in");const o={Authorization:`Bearer iaw-auth-token:${s}`,"Content-Type":"application/json"},c=await n(`${i}/api/2024-05-05/accounts`,{headers:o,method:"GET"});if(!c.ok){const u=await c.json();throw new Error(u.message||"Failed to get linked accounts.")}const{linkedAccounts:l}=await c.json();return l??[]}const Qu=["google","apple","facebook","discord","line","x","tiktok","epic","coinbase","farcaster","telegram","github","twitch","steam"],RA=[...Qu,"guest","backend","email","phone","passkey","wallet"],pI="0x3f707e6b",_I=[{type:"tuple[]",name:"calls",components:[{type:"address",name:"target"},{type:"uint256",name:"value"},{type:"bytes",name:"data"}]}],fI=[];function mI(r){const t=nI(async()=>"asyncParams"in r?await r.asyncParams():r);return Td({contract:r.contract,method:[pI,_I,fI],params:async()=>[(await t()).calls],value:async()=>{var e;return(e=(await t()).overrides)==null?void 0:e.value},accessList:async()=>{var e;return(e=(await t()).overrides)==null?void 0:e.accessList},gas:async()=>{var e;return(e=(await t()).overrides)==null?void 0:e.gas},gasPrice:async()=>{var e;return(e=(await t()).overrides)==null?void 0:e.gasPrice},maxFeePerGas:async()=>{var e;return(e=(await t()).overrides)==null?void 0:e.maxFeePerGas},maxPriorityFeePerGas:async()=>{var e;return(e=(await t()).overrides)==null?void 0:e.maxPriorityFeePerGas},nonce:async()=>{var e;return(e=(await t()).overrides)==null?void 0:e.nonce},extraGas:async()=>{var e;return(e=(await t()).overrides)==null?void 0:e.extraGas},erc20Value:async()=>{var e;return(e=(await t()).overrides)==null?void 0:e.erc20Value},authorizationList:async()=>{var e;return(e=(await t()).overrides)==null?void 0:e.authorizationList}})}async function yI(r){const{client:t,chain:e,bundlerUrl:n}=r,i=n??Kc(e),s=`delegation-contract:${i}`;return qc(async()=>{var u;const c=await hn(t)(i,{useAuthToken:!0,body:we({id:1,jsonrpc:"2.0",method:"tw_getDelegationContract",params:[]}),headers:{"Content-Type":"application/json"},method:"POST"});if(!c.ok)throw new Error(`Failed to fetch delegation contract: ${c.status} ${c.statusText}`);const l=await c.json();if(l.error)throw new Error(`Delegation contract RPC error: ${JSON.stringify(l.error)}`);if(!((u=l.result)!=null&&u.delegationContract))throw new Error("Invalid response: missing delegationContract in result");return l.result.delegationContract},{cacheKey:s,cacheTime:24*60*60*1e3})}const wI=r=>{const{client:t,adminAccount:e,sponsorGas:n}=r,i=async o=>{var f,m,y;const c=o[0];if(!c)throw new Error("No transactions provided");const l=ge(c.chainId),u=$s({address:e.address,chain:l,client:t,abi:bI});let d=(f=c.authorizationList)==null?void 0:f[0];const h=await yI({client:t,chain:l});if(d&&((m=d.address)==null?void 0:m.toLowerCase())!==h.toLowerCase())throw new Error(`Authorization address does not match expected delegation contract address. Expected ${h} but got ${d.address}`);if(!d&&!await EI(u,h)){let O=c.nonce?BigInt(c.nonce):BigInt(await gI({client:t,address:e.address,chain:l}));O+=n?0n:1n;const g=await((y=e.signAuthorization)==null?void 0:y.call(e,{address:Z(h),chainId:c.chainId,nonce:O}));if(!g)throw new Error("Failed to sign authorization");d=g}if(n){const b={calls:o.map(A=>({data:A.data??"0x",target:Z(A.to??""),value:A.value??0n})),uid:ah()},O=await e.signTypedData({domain:{chainId:c.chainId,name:"MinimalAccount",verifyingContract:u.address,version:"1"},message:b,primaryType:"WrappedCalls",types:{Call:[{name:"target",type:"address"},{name:"value",type:"uint256"},{name:"data",type:"bytes"}],WrappedCalls:[{name:"calls",type:"Call[]"},{name:"uid",type:"bytes32"}]}}),g=await cI({authorization:d,eoaAddress:Z(e.address),options:{chain:ge(c.chainId),client:t},signature:O,wrappedCalls:b});return{transactionHash:await vI({options:{chain:ge(c.chainId),client:t},transactionId:g.transactionId})}}const p=mI({calls:o.map(b=>({data:b.data??"0x",target:Z(b.to??""),value:b.value??0n})),contract:u,overrides:{authorizationList:d?[d]:void 0,value:o.reduce((b,O)=>b+(O.value??0n),0n)}}),_=await Pd({from:e.address,transaction:p});return e.sendTransaction(_)},s={address:e.address,sendBatchTransaction:async o=>i(o),sendTransaction:async o=>i([o]),signMessage:({message:o,originalMessage:c,chainId:l})=>e.signMessage({chainId:l,message:o,originalMessage:c}),signTypedData:o=>e.signTypedData(o),sendCalls:async o=>{const{inAppWalletSendCalls:c}=await a(async()=>{const{inAppWalletSendCalls:p}=await import("./in-app-wallet-calls-BLeiSGXo.js");return{inAppWalletSendCalls:p}},__vite__mapDeps([28,29,10,1,2,3,4,18,30,5,6,7])),l=o.calls[0];if(!l)throw new Error("No calls to send");const u=l.client,d=l.chain||o.chain,h=await c({account:s,calls:o.calls,chain:d});return{chain:d,client:u,id:h}},getCallsStatus:async o=>{const{inAppWalletGetCallsStatus:c}=await a(async()=>{const{inAppWalletGetCallsStatus:l}=await import("./in-app-wallet-calls-BLeiSGXo.js");return{inAppWalletGetCallsStatus:l}},__vite__mapDeps([28,29,10,1,2,3,4,18,30,5,6,7]));return c(o)},getCallsStatusRaw:async o=>{const{inAppWalletGetCallsStatusRaw:c}=await a(async()=>{const{inAppWalletGetCallsStatusRaw:l}=await import("./in-app-wallet-calls-BLeiSGXo.js");return{inAppWalletGetCallsStatusRaw:l}},__vite__mapDeps([28,29,10,1,2,3,4,18,30,5,6,7]));return c(o)},getCapabilities:async o=>({[o.chainId??1]:{atomic:{status:"supported"},paymasterService:{supported:n??!1}}})};return s};async function gI(r){const{client:t,address:e,chain:n}=r,i=ni({chain:n,client:t});return await a(async()=>{const{eth_getTransactionCount:o}=await import("./eth_getTransactionCount-hf8F-dbS.js");return{eth_getTransactionCount:o}},__vite__mapDeps([31,1,2,3,4])).then(({eth_getTransactionCount:o})=>o(i,{address:Z(e),blockTag:"pending"}))}async function EI(r,t){const e=await Od(r),n=e.length>0&&e.startsWith("0xef0100"),i=`0x${e.slice(8,48)}`;return n&&i.toLowerCase()===t.toLowerCase()}async function vI(r){const t=r.timeoutMs||3e5,e=r.intervalMs||1e3,n=Date.now()+t;for(;Date.now()<n;){const i=await lI({options:r.options,transactionId:r.transactionId});if(i.transactionHash)return i.transactionHash;await new Promise(s=>setTimeout(s,e))}throw new Error(`Timeout waiting for transaction to be mined on chain ${r.options.chain.id} with transactionId: ${r.transactionId}`)}const bI=[{type:"receive",stateMutability:"payable"},{type:"function",name:"createSessionWithSig",inputs:[{name:"sessionSpec",type:"tuple",internalType:"struct SessionLib.SessionSpec",components:[{name:"signer",type:"address",internalType:"address"},{name:"isWildcard",type:"bool",internalType:"bool"},{name:"expiresAt",type:"uint256",internalType:"uint256"},{name:"callPolicies",type:"tuple[]",internalType:"struct SessionLib.CallSpec[]",components:[{name:"target",type:"address",internalType:"address"},{name:"selector",type:"bytes4",internalType:"bytes4"},{name:"maxValuePerUse",type:"uint256",internalType:"uint256"},{name:"valueLimit",type:"tuple",internalType:"struct SessionLib.UsageLimit",components:[{name:"limitType",type:"uint8",internalType:"enum SessionLib.LimitType"},{name:"limit",type:"uint256",internalType:"uint256"},{name:"period",type:"uint256",internalType:"uint256"}]},{name:"constraints",type:"tuple[]",internalType:"struct SessionLib.Constraint[]",components:[{name:"condition",type:"uint8",internalType:"enum SessionLib.Condition"},{name:"index",type:"uint64",internalType:"uint64"},{name:"refValue",type:"bytes32",internalType:"bytes32"},{name:"limit",type:"tuple",internalType:"struct SessionLib.UsageLimit",components:[{name:"limitType",type:"uint8",internalType:"enum SessionLib.LimitType"},{name:"limit",type:"uint256",internalType:"uint256"},{name:"period",type:"uint256",internalType:"uint256"}]}]}]},{name:"transferPolicies",type:"tuple[]",internalType:"struct SessionLib.TransferSpec[]",components:[{name:"target",type:"address",internalType:"address"},{name:"maxValuePerUse",type:"uint256",internalType:"uint256"},{name:"valueLimit",type:"tuple",internalType:"struct SessionLib.UsageLimit",components:[{name:"limitType",type:"uint8",internalType:"enum SessionLib.LimitType"},{name:"limit",type:"uint256",internalType:"uint256"},{name:"period",type:"uint256",internalType:"uint256"}]}]},{name:"uid",type:"bytes32",internalType:"bytes32"}]},{name:"signature",type:"bytes",internalType:"bytes"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"eip712Domain",inputs:[],outputs:[{name:"fields",type:"bytes1",internalType:"bytes1"},{name:"name",type:"string",internalType:"string"},{name:"version",type:"string",internalType:"string"},{name:"chainId",type:"uint256",internalType:"uint256"},{name:"verifyingContract",type:"address",internalType:"address"},{name:"salt",type:"bytes32",internalType:"bytes32"},{name:"extensions",type:"uint256[]",internalType:"uint256[]"}],stateMutability:"view"},{type:"function",name:"execute",inputs:[{name:"calls",type:"tuple[]",internalType:"struct Call[]",components:[{name:"target",type:"address",internalType:"address"},{name:"value",type:"uint256",internalType:"uint256"},{name:"data",type:"bytes",internalType:"bytes"}]}],outputs:[],stateMutability:"payable"},{type:"function",name:"executeWithSig",inputs:[{name:"wrappedCalls",type:"tuple",internalType:"struct WrappedCalls",components:[{name:"calls",type:"tuple[]",internalType:"struct Call[]",components:[{name:"target",type:"address",internalType:"address"},{name:"value",type:"uint256",internalType:"uint256"},{name:"data",type:"bytes",internalType:"bytes"}]},{name:"uid",type:"bytes32",internalType:"bytes32"}]},{name:"signature",type:"bytes",internalType:"bytes"}],outputs:[],stateMutability:"payable"},{type:"function",name:"getCallPoliciesForSigner",inputs:[{name:"signer",type:"address",internalType:"address"}],outputs:[{name:"",type:"tuple[]",internalType:"struct SessionLib.CallSpec[]",components:[{name:"target",type:"address",internalType:"address"},{name:"selector",type:"bytes4",internalType:"bytes4"},{name:"maxValuePerUse",type:"uint256",internalType:"uint256"},{name:"valueLimit",type:"tuple",internalType:"struct SessionLib.UsageLimit",components:[{name:"limitType",type:"uint8",internalType:"enum SessionLib.LimitType"},{name:"limit",type:"uint256",internalType:"uint256"},{name:"period",type:"uint256",internalType:"uint256"}]},{name:"constraints",type:"tuple[]",internalType:"struct SessionLib.Constraint[]",components:[{name:"condition",type:"uint8",internalType:"enum SessionLib.Condition"},{name:"index",type:"uint64",internalType:"uint64"},{name:"refValue",type:"bytes32",internalType:"bytes32"},{name:"limit",type:"tuple",internalType:"struct SessionLib.UsageLimit",components:[{name:"limitType",type:"uint8",internalType:"enum SessionLib.LimitType"},{name:"limit",type:"uint256",internalType:"uint256"},{name:"period",type:"uint256",internalType:"uint256"}]}]}]}],stateMutability:"view"},{type:"function",name:"getSessionExpirationForSigner",inputs:[{name:"signer",type:"address",internalType:"address"}],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"function",name:"getSessionStateForSigner",inputs:[{name:"signer",type:"address",internalType:"address"}],outputs:[{name:"",type:"tuple",internalType:"struct SessionLib.SessionState",components:[{name:"transferValue",type:"tuple[]",internalType:"struct SessionLib.LimitState[]",components:[{name:"remaining",type:"uint256",internalType:"uint256"},{name:"target",type:"address",internalType:"address"},{name:"selector",type:"bytes4",internalType:"bytes4"},{name:"index",type:"uint256",internalType:"uint256"}]},{name:"callValue",type:"tuple[]",internalType:"struct SessionLib.LimitState[]",components:[{name:"remaining",type:"uint256",internalType:"uint256"},{name:"target",type:"address",internalType:"address"},{name:"selector",type:"bytes4",internalType:"bytes4"},{name:"index",type:"uint256",internalType:"uint256"}]},{name:"callParams",type:"tuple[]",internalType:"struct SessionLib.LimitState[]",components:[{name:"remaining",type:"uint256",internalType:"uint256"},{name:"target",type:"address",internalType:"address"},{name:"selector",type:"bytes4",internalType:"bytes4"},{name:"index",type:"uint256",internalType:"uint256"}]}]}],stateMutability:"view"},{type:"function",name:"getTransferPoliciesForSigner",inputs:[{name:"signer",type:"address",internalType:"address"}],outputs:[{name:"",type:"tuple[]",internalType:"struct SessionLib.TransferSpec[]",components:[{name:"target",type:"address",internalType:"address"},{name:"maxValuePerUse",type:"uint256",internalType:"uint256"},{name:"valueLimit",type:"tuple",internalType:"struct SessionLib.UsageLimit",components:[{name:"limitType",type:"uint8",internalType:"enum SessionLib.LimitType"},{name:"limit",type:"uint256",internalType:"uint256"},{name:"period",type:"uint256",internalType:"uint256"}]}]}],stateMutability:"view"},{type:"function",name:"isWildcardSigner",inputs:[{name:"signer",type:"address",internalType:"address"}],outputs:[{name:"",type:"bool",internalType:"bool"}],stateMutability:"view"},{type:"function",name:"onERC1155BatchReceived",inputs:[{name:"",type:"address",internalType:"address"},{name:"",type:"address",internalType:"address"},{name:"",type:"uint256[]",internalType:"uint256[]"},{name:"",type:"uint256[]",internalType:"uint256[]"},{name:"",type:"bytes",internalType:"bytes"}],outputs:[{name:"",type:"bytes4",internalType:"bytes4"}],stateMutability:"nonpayable"},{type:"function",name:"onERC1155Received",inputs:[{name:"",type:"address",internalType:"address"},{name:"",type:"address",internalType:"address"},{name:"",type:"uint256",internalType:"uint256"},{name:"",type:"uint256",internalType:"uint256"},{name:"",type:"bytes",internalType:"bytes"}],outputs:[{name:"",type:"bytes4",internalType:"bytes4"}],stateMutability:"nonpayable"},{type:"function",name:"onERC721Received",inputs:[{name:"",type:"address",internalType:"address"},{name:"",type:"address",internalType:"address"},{name:"",type:"uint256",internalType:"uint256"},{name:"",type:"bytes",internalType:"bytes"}],outputs:[{name:"",type:"bytes4",internalType:"bytes4"}],stateMutability:"nonpayable"},{type:"function",name:"supportsInterface",inputs:[{name:"interfaceId",type:"bytes4",internalType:"bytes4"}],outputs:[{name:"",type:"bool",internalType:"bool"}],stateMutability:"view"},{type:"event",name:"Executed",inputs:[{name:"to",type:"address",indexed:!0,internalType:"address"},{name:"value",type:"uint256",indexed:!1,internalType:"uint256"},{name:"data",type:"bytes",indexed:!1,internalType:"bytes"}],anonymous:!1},{type:"event",name:"SessionCreated",inputs:[{name:"signer",type:"address",indexed:!0,internalType:"address"},{name:"sessionSpec",type:"tuple",indexed:!1,internalType:"struct SessionLib.SessionSpec",components:[{name:"signer",type:"address",internalType:"address"},{name:"isWildcard",type:"bool",internalType:"bool"},{name:"expiresAt",type:"uint256",internalType:"uint256"},{name:"callPolicies",type:"tuple[]",internalType:"struct SessionLib.CallSpec[]",components:[{name:"target",type:"address",internalType:"address"},{name:"selector",type:"bytes4",internalType:"bytes4"},{name:"maxValuePerUse",type:"uint256",internalType:"uint256"},{name:"valueLimit",type:"tuple",internalType:"struct SessionLib.UsageLimit",components:[{name:"limitType",type:"uint8",internalType:"enum SessionLib.LimitType"},{name:"limit",type:"uint256",internalType:"uint256"},{name:"period",type:"uint256",internalType:"uint256"}]},{name:"constraints",type:"tuple[]",internalType:"struct SessionLib.Constraint[]",components:[{name:"condition",type:"uint8",internalType:"enum SessionLib.Condition"},{name:"index",type:"uint64",internalType:"uint64"},{name:"refValue",type:"bytes32",internalType:"bytes32"},{name:"limit",type:"tuple",internalType:"struct SessionLib.UsageLimit",components:[{name:"limitType",type:"uint8",internalType:"enum SessionLib.LimitType"},{name:"limit",type:"uint256",internalType:"uint256"},{name:"period",type:"uint256",internalType:"uint256"}]}]}]},{name:"transferPolicies",type:"tuple[]",internalType:"struct SessionLib.TransferSpec[]",components:[{name:"target",type:"address",internalType:"address"},{name:"maxValuePerUse",type:"uint256",internalType:"uint256"},{name:"valueLimit",type:"tuple",internalType:"struct SessionLib.UsageLimit",components:[{name:"limitType",type:"uint8",internalType:"enum SessionLib.LimitType"},{name:"limit",type:"uint256",internalType:"uint256"},{name:"period",type:"uint256",internalType:"uint256"}]}]},{name:"uid",type:"bytes32",internalType:"bytes32"}]}],anonymous:!1},{type:"event",name:"ValueReceived",inputs:[{name:"from",type:"address",indexed:!0,internalType:"address"},{name:"value",type:"uint256",indexed:!1,internalType:"uint256"}],anonymous:!1},{type:"error",name:"AllowanceExceeded",inputs:[{name:"allowanceUsage",type:"uint256",internalType:"uint256"},{name:"limit",type:"uint256",internalType:"uint256"},{name:"period",type:"uint64",internalType:"uint64"}]},{type:"error",name:"CallPolicyViolated",inputs:[{name:"target",type:"address",internalType:"address"},{name:"selector",type:"bytes4",internalType:"bytes4"}]},{type:"error",name:"CallReverted",inputs:[]},{type:"error",name:"ConditionFailed",inputs:[{name:"param",type:"bytes32",internalType:"bytes32"},{name:"refValue",type:"bytes32",internalType:"bytes32"},{name:"condition",type:"uint8",internalType:"uint8"}]},{type:"error",name:"InvalidDataLength",inputs:[{name:"actualLength",type:"uint256",internalType:"uint256"},{name:"expectedLength",type:"uint256",internalType:"uint256"}]},{type:"error",name:"InvalidSignature",inputs:[{name:"msgSender",type:"address",internalType:"address"},{name:"thisAddress",type:"address",internalType:"address"}]},{type:"error",name:"LifetimeUsageExceeded",inputs:[{name:"lifetimeUsage",type:"uint256",internalType:"uint256"},{name:"limit",type:"uint256",internalType:"uint256"}]},{type:"error",name:"MaxValueExceeded",inputs:[{name:"value",type:"uint256",internalType:"uint256"},{name:"maxValuePerUse",type:"uint256",internalType:"uint256"}]},{type:"error",name:"NoCallsToExecute",inputs:[]},{type:"error",name:"SessionExpired",inputs:[]},{type:"error",name:"SessionExpiresTooSoon",inputs:[]},{type:"error",name:"SessionZeroSigner",inputs:[]},{type:"error",name:"TransferPolicyViolated",inputs:[{name:"target",type:"address",internalType:"address"}]},{type:"error",name:"UIDAlreadyProcessed",inputs:[]}];function Xu(r){return r.id==="inApp"||r.id==="embedded"}async function II(r,t,e){var s,o,c,l;if(((s=t==null?void 0:t.auth)==null?void 0:s.mode)!=="popup"&&((o=t==null?void 0:t.auth)==null?void 0:o.mode)!==void 0&&e.authenticateWithRedirect){const u=r.strategy;Qu.includes(u)&&await e.authenticateWithRedirect(u,(c=t==null?void 0:t.auth)==null?void 0:c.mode,(l=t==null?void 0:t.auth)==null?void 0:l.redirectUrl)}const i=(await e.connect(r)).user.account;return ed({authAccount:i,client:r.client,createOptions:t,desiredChain:r.chain})}async function AI(r,t,e){r.authResult&&e.loginWithAuthToken&&await e.loginWithAuthToken(r.authResult);const n=await PI(e);if(!n)throw new Error("Failed to authenticate user.");const i=n.account;return ed({authAccount:i,client:r.client,createOptions:t,desiredChain:r.chain})}async function TI(r){const{connectSmartAccount:t}=await a(async()=>{const{connectSmartAccount:e}=await import("./index-BzsXZXiV.js");return{connectSmartAccount:e}},__vite__mapDeps([19,3,4,1,2,20,11,5,6,7]));return t({chain:r.chain,client:r.client,personalAccount:r.authAccount},r.smartAccountOptions)}async function PI(r){const t=await r.getUser();switch(t.status){case"Logged In, Wallet Initialized":return t}}async function ed(r){const{createOptions:t,authAccount:e,desiredChain:n,client:i}=r;let s,o;const c=t&&"executionMode"in t?t.executionMode:void 0;if(c&&(c.mode==="EIP4337"?s=c.smartAccount:c.mode==="EIP7702"&&(o=c)),t&&"smartAccount"in t&&(t!=null&&t.smartAccount)&&(s=t.smartAccount),s){const[l,u]=await TI({authAccount:e,chain:n,client:i,smartAccountOptions:s});return{account:l,adminAccount:e,chain:u}}if(o){const l=n;if(!l)throw new Error("Chain is required for EIP-7702 execution, pass a chain when connecting the inAppWallet.");return{account:wI({adminAccount:e,client:i,sponsorGas:o.sponsorGas}),adminAccount:e,chain:l}}return{account:e,chain:n||oh}}const Wi=Object.freeze(Object.defineProperty({__proto__:null,autoConnectInAppWallet:AI,connectInAppWallet:II,isInAppWallet:Xu},Symbol.toStringTag,{value:"Module"}));function OI(r){const t=n=>Xu(n)||Or(n),e=Ds(r.wallet)&&r.connectedWallets.some(n=>{var i,s,o,c,l,u;return t(n)&&((s=(i=n.getAccount())==null?void 0:i.address)==null?void 0:s.toLowerCase())===((u=(l=(c=(o=r.wallet).getAdminAccount)==null?void 0:c.call(o))==null?void 0:l.address)==null?void 0:u.toLowerCase())});return t(r.wallet)||e}function RI(){if(typeof document>"u")return;const r=new URLSearchParams(window.location.search);let t;const e=window.location.hash||"";let n=e;const i=e.indexOf("?");i!==-1&&(t=new URLSearchParams(e.substring(i)),n=e.substring(0,i));const s=r.get("walletId")??(t==null?void 0:t.get("walletId"))??void 0,o=r.get("authResult")??(t==null?void 0:t.get("authResult"))??void 0,c=r.get("authProvider")??(t==null?void 0:t.get("authProvider"))??void 0,l=r.get("authCookie")??(t==null?void 0:t.get("authCookie"))??void 0,u=r.get("authFlow")??(t==null?void 0:t.get("authFlow"))??void 0;if((l||o)&&s){const d=(()=>{if(o)return r.delete("authResult"),t==null||t.delete("authResult"),JSON.parse(decodeURIComponent(o))})();r.delete("walletId"),r.delete("authProvider"),r.delete("authCookie"),r.delete("authFlow"),t==null||t.delete("walletId"),t==null||t.delete("authProvider"),t==null||t.delete("authCookie"),t==null||t.delete("authFlow");const h=r.toString(),p=h?`?${h}`:"";let _=n;if(t){const f=t.toString();f&&(_=`${n}?${f}`)}return window.history.pushState({},"",`${window.location.pathname}${p}${_}`),{authCookie:l,authFlow:u,authProvider:c,authResult:d,walletId:s}}}let Hi;const LI=async r=>{if(Hi&&!r.force&&await Hi)return!0;const t=DI(r);return Hi=t,t},DI=async({storage:r,props:t,createWalletFn:e,manager:n,connectOverride:i,setLastAuthProvider:s})=>{var A,E,D,L,w;const{wallets:o,onConnect:c}=t,l=t.timeout??15e3;let u=!1;n.isAutoConnecting.setValue(!0);let[d,h]=await Promise.all([Ju(r),go(r)]);const p=RI();if((p==null?void 0:p.authFlow)==="link"&&p.authResult)return await VI({client:t.client,connectOverride:i,createWalletFn:e,manager:n,onConnect:c,props:t,setLastAuthProvider:s,storage:r,timeout:l,urlToken:p,wallets:o});const _=o.find(v=>v.id===(p==null?void 0:p.walletId));if(p!=null&&p.authCookie&&_&&await new wo({clientId:t.client.clientId,ecosystem:Or(_)?{id:_.id,partnerId:(A=_.getConfig())==null?void 0:A.partnerId}:void 0,storage:r}).saveAuthCookie(p.authCookie),p!=null&&p.walletId&&(h=p.walletId,d=d!=null&&d.includes(p.walletId)?d:[p.walletId,...d||[]]),p!=null&&p.authProvider&&await(s==null?void 0:s(p.authProvider,r)),!d)return u;const f=await Zu(r)||t.chain,m=d.map(v=>{const I=o.find(T=>T.id===v);return I||e(v)}),y=h&&(m.find(v=>v.id===h)||e(h));if(y){n.activeWalletConnectionStatusStore.setValue("connecting"),await Yu(Ss({authResult:p==null?void 0:p.authResult,client:t.client,lastConnectedChain:f,wallet:y}),{message:`AutoConnect timeout: ${l}ms limit exceeded.`,ms:l}).catch(v=>{console.warn(v.message),t.onTimeout&&t.onTimeout()});try{await(i?i(y):n.connect(y,{accountAbstraction:t.accountAbstraction,client:t.client}))}catch(v){v instanceof Error&&console.warn("Error auto connecting wallet:",v.message),n.activeWalletConnectionStatusStore.setValue("disconnected")}}else n.activeWalletConnectionStatusStore.setValue("disconnected");const b=m.filter(v=>v.id!==h&&d.includes(v.id));for(const v of b)try{await Ss({authResult:p==null?void 0:p.authResult,client:t.client,lastConnectedChain:f,wallet:v}),n.addConnectedWallet(v)}catch{}y&&OI({connectedWallets:y?[y,...b]:b,wallet:y})&&((E=t.siweAuth)!=null&&E.requiresAuth)&&!((D=t.siweAuth)!=null&&D.isLoggedIn)&&!((L=t.siweAuth)!=null&&L.isLoggingIn)&&await((w=t.siweAuth)==null?void 0:w.doLogin().catch(v=>{console.warn("Error signing in with SIWE:",v.message)})),n.isAutoConnecting.setValue(!1);const g=n.activeWalletStore.getValue(),P=n.connectedWallets.getValue();if(g){u=!0;try{c==null||c(g,P)}catch(v){console.error("Error calling onConnect callback:",v)}}else n.activeWalletConnectionStatusStore.setValue("disconnected");return u};async function VI(r){var P;const{client:t,connectOverride:e,createWalletFn:n,manager:i,onConnect:s,props:o,setLastAuthProvider:c,storage:l,timeout:u,urlToken:d,wallets:h}=r,[p,_]=await Promise.all([Ju(l),go(l)]),f=await Zu(l)||o.chain;if(!_||!p)return console.warn("No stored wallet found for linking flow"),i.isAutoConnecting.setValue(!1),!1;d.authProvider&&await(c==null?void 0:c(d.authProvider,l));const m=h.find(A=>A.id===_)||n(_);i.activeWalletConnectionStatusStore.setValue("connecting");try{await Yu(Ss({authResult:void 0,client:t,lastConnectedChain:f,wallet:m}),{message:`AutoConnect timeout: ${u}ms limit exceeded.`,ms:u}),await(e?e(m):i.connect(m,{accountAbstraction:o.accountAbstraction,client:t}))}catch(A){return console.warn("Failed to auto-connect for linking:",A),i.activeWalletConnectionStatusStore.setValue("disconnected"),i.isAutoConnecting.setValue(!1),!1}const y=Or(m)?{id:m.id,partnerId:(P=m.getConfig())==null?void 0:P.partnerId}:void 0,b=new wo({clientId:t.clientId,ecosystem:y,storage:l});try{await hI({client:t,ecosystem:y,storage:b,tokenToLink:d.authResult.storedToken.cookieString})}catch(A){console.error("Failed to link profile after redirect:",A)}i.isAutoConnecting.setValue(!1);const O=i.activeWalletStore.getValue(),g=i.connectedWallets.getValue();if(O){try{s==null||s(O,g)}catch(A){console.error("Error calling onConnect callback:",A)}return!0}return!1}async function Ss(r){return r.wallet.autoConnect({authResult:r.authResult,chain:r.lastConnectedChain,client:r.client})}async function SI(r){const t=r.wallets||Xb(r),e=uI(Fn);return await LI({createWalletFn:at,manager:e,props:{...r,wallets:t},storage:Fn})}const LA=Object.freeze(Object.defineProperty({__proto__:null,DefaultWalletConnectRequestHandlers:Gb,EIP1193:Qh,authenticate:ip,authenticateWithRedirect:sp,autoConnect:SI,createWallet:at,createWalletAdapter:Xh,createWalletConnectClient:Jb,createWalletConnectSession:Zb,deploySmartAccount:Dd,disconnectWalletConnectSession:Wu,ecosystemWallet:sl,embeddedWallet:Yi,generateAccount:dp,getActiveWalletConnectSessions:Yb,getAllWalletsList:ep,getInstalledWallets:ol,getProfiles:cp,getUser:Ld,getUserEmail:tp,getUserPhoneNumber:rp,getWalletBalance:hp,getWalletInfo:Jc,inAppWallet:Yi,injectedProvider:Js,isBaseAccountSDKWallet:Yc,linkProfile:op,preAuthenticate:np,privateKeyAccount:Xi,privateKeyToAccount:Xi,randomPrivateKey:Rd,smartWallet:Gs,unlinkProfile:ap,walletConnect:Hh},Symbol.toStringTag,{value:"Module"}));export{vA as $,vl as A,oi as B,sn as C,qb as D,q_ as E,xn as F,El as G,F_ as H,W_ as I,nA as J,ae as K,tA as L,Jn as M,hA as N,sA as O,bu as P,iA as Q,nI as R,Kc as S,Hu as T,si as U,un as V,Ah as W,IA as X,Uw as Y,bA as Z,gA as _,wA as a,qI as a0,vh as a1,Ih as a2,AA as a3,TA as a4,EA as a5,Ds as a6,RA as a7,wo as a8,Fn as a9,fA as aa,Qu as ab,hI as ac,PA as ad,OA as ae,_A as af,LA as ag,Jc as b,Wn as c,mA as d,Wu as e,xh as f,Wh as g,Fu as h,pA as i,Mb as j,Bb as k,jb as l,bc as m,lt as n,vc as o,js as p,Qs as q,ah as r,yA as s,Ar as t,yo as u,ir as v,qt as w,_e as x,rA as y,Jo as z};
|
|
15
|
+
Code: ${u}`)}return c.result}function Ds(r){if(!r)return!1;if(r.id==="smart")return!0;if(r.id==="inApp"||Or(r)){const t=r.getConfig();if(t&&"smartAccount"in t&&t.smartAccount)return!0;if(t!=null&&t.executionMode){const e=t.executionMode;return e.mode==="EIP4337"||e.mode==="EIP7702"}}return!1}const Gu="thirdweb:connected-wallet-ids",Un="thirdweb:active-wallet-id",Vs="thirdweb:active-chain",Oc="thirdweb:last-used-wallet-id";function uI(r){const t=Jt(void 0),e=Jt(void 0),n=Jt(void 0),i=Jt("unknown"),s=Jt(new Map);Dn(()=>{kd([...s.getValue().values()])},[s]),Dn(()=>{const g=n.getValue();if(!g)return;const P=s.getValue().get(g.id);!P||P===g||n.setValue(P)},[s,n]);const o=Jt(new Map),c=Jt(!1),l=eI(()=>Array.from(o.getValue().values()),[o]),u=g=>{const P=o.getValue();if(P.has(g.id))return;const A=new Map(P);A.set(g.id,g),o.setValue(A)},d=g=>{const P=o.getValue(),A=new Map(P);A.delete(g.id),o.setValue(A)},h=g=>{tI(r,g.id),d(g),t.getValue()===g&&(r.removeItem(Un),e.setValue(void 0),n.setValue(void 0),t.setValue(void 0),i.setValue("disconnected"))},p=g=>{h(g),g.disconnect()},_=async(g,P)=>{if(!g.getAccount())throw new Error("Cannot set a wallet without an account as active");const E=await(async()=>P!=null&&P.accountAbstraction&&!Ds(g)?await dI(g,P.client,P.accountAbstraction,h):g)();return await r.setItem(Un,g.id),await r.setItem(Oc,g.id),u(g),(P==null?void 0:P.setWalletAsActive)!==!1&&m(E),g.subscribe("accountChanged",async()=>{var L;const D=await _(g,P);(L=P==null?void 0:P.onConnect)==null||L.call(P,D,l.getValue())}),E},f=async(g,P)=>{var E;const A=await _(g,P);return(E=P==null?void 0:P.onConnect)==null||E.call(P,A,l.getValue()),A},m=g=>{const P=g.getAccount();if(!P)throw new Error("Cannot set a wallet without an account as active");u(g),t.setValue(g),e.setValue(P),n.setValue(g.getChain()),i.setValue("connected");const A=v=>{e.setValue(v)},E=g.subscribe("accountChanged",A),D=g.subscribe("chainChanged",v=>n.setValue(v)),L=g.subscribe("disconnect",()=>{w()}),w=()=>{h(g),E(),D(),L()}},y=async g=>{m(g),g.id!=="smart"&&(await r.setItem(Un,g.id),await r.setItem(Oc,g.id))};Dn(()=>{const g=n.getValue();g?r.setItem(Vs,we(g)):r.removeItem(Vs)},[n],!1),Dn(async()=>{const P=l.getValue().map(A=>A==null?void 0:A.id).filter(A=>!!A);r.setItem(Gu,we(Array.from(new Set([...P]))))},[l],!1);const b=async g=>{const P=t.getValue();if(!P)throw new Error("No active wallet found");if(!P.switchChain)throw new Error("Wallet does not support switching chains");if(Ds(P)){const A=await go(r);if(A){const E=l.getValue().find(D=>D.id===A);if(E){await E.switchChain(g),await P.switchChain(g),m(P);return}}await P.switchChain(g),m(P)}else await P.switchChain(g);n.setValue(P.getChain())};function O(g){const P=s.getValue();if(g.every(D=>{const L=P.get(D.id);return we(L)===we(D)}))return;const E=new Map(P);for(const D of g)E.set(D.id,D);s.setValue(E)}return{activeAccountStore:e,activeWalletChainStore:n,activeWalletConnectionStatusStore:i,activeWalletStore:t,addConnectedWallet:u,connect:f,connectedWallets:l,defineChains:O,disconnectWallet:p,handleConnection:_,isAutoConnecting:c,removeConnectedWallet:d,setActiveWallet:y,switchActiveWalletChain:b}}async function Ju(r){try{const t=await r.getItem(Gu);return t?JSON.parse(t):[]}catch{return[]}}async function go(r){try{const t=await r.getItem(Un);if(t)return t}catch{}return null}async function Zu(r){try{const t=await r.getItem(Vs);if(t)return JSON.parse(t)}catch{}return null}const dI=async(r,t,e,n)=>{const i=r.getAccount();if(!i)throw new Error("Cannot set a wallet without an account as active");const s=Gs(e);await s.connect({chain:e.chain,client:t,personalAccount:i});const o=r.subscribe("disconnect",()=>{c()}),c=()=>{o(),n(s)};return s};function Yu(r,t){return new Promise((e,n)=>{const i=setTimeout(()=>{n(new Error(t.message))},t.ms);r.then(s=>{clearTimeout(i),e(s)},s=>{clearTimeout(i),n(s)})})}async function hI({client:r,ecosystem:t,tokenToLink:e,storage:n}){const i=hn(r,t),s=ii("inAppWallet"),o=await n.getAuthCookie();if(!o)throw new Error("Failed to link account, no user logged in");const c={Authorization:`Bearer iaw-auth-token:${o}`,"Content-Type":"application/json"},l=await i(`${s}/api/2024-05-05/account/connect`,{body:we({accountAuthTokenToConnect:e}),headers:c,method:"POST"});if(!l.ok){const d=await l.json();throw new Error(d.message||"Failed to link account.")}const{linkedAccounts:u}=await l.json();return u??[]}async function PA({client:r,ecosystem:t,profileToUnlink:e,allowAccountDeletion:n=!1,storage:i}){const s=hn(r,t),o=ii("inAppWallet"),c=await i.getAuthCookie();if(!c)throw new Error("Failed to unlink account, no user logged in");const l={Authorization:`Bearer iaw-auth-token:${c}`,"Content-Type":"application/json"},u=await s(`${o}/api/2024-05-05/account/disconnect`,{body:we({allowAccountDeletion:n,details:e.details,type:e.type}),headers:l,method:"POST"});if(!u.ok){const h=await u.json();throw new Error(h.message||"Failed to unlink account.")}const{linkedAccounts:d}=await u.json();return d??[]}async function OA({client:r,ecosystem:t,storage:e}){const n=hn(r,t),i=ii("inAppWallet"),s=await e.getAuthCookie();if(!s)throw new Error("Failed to get linked accounts, no user logged in");const o={Authorization:`Bearer iaw-auth-token:${s}`,"Content-Type":"application/json"},c=await n(`${i}/api/2024-05-05/accounts`,{headers:o,method:"GET"});if(!c.ok){const u=await c.json();throw new Error(u.message||"Failed to get linked accounts.")}const{linkedAccounts:l}=await c.json();return l??[]}const Qu=["google","apple","facebook","discord","line","x","tiktok","epic","coinbase","farcaster","telegram","github","twitch","steam"],RA=[...Qu,"guest","backend","email","phone","passkey","wallet"],pI="0x3f707e6b",_I=[{type:"tuple[]",name:"calls",components:[{type:"address",name:"target"},{type:"uint256",name:"value"},{type:"bytes",name:"data"}]}],fI=[];function mI(r){const t=nI(async()=>"asyncParams"in r?await r.asyncParams():r);return Td({contract:r.contract,method:[pI,_I,fI],params:async()=>[(await t()).calls],value:async()=>{var e;return(e=(await t()).overrides)==null?void 0:e.value},accessList:async()=>{var e;return(e=(await t()).overrides)==null?void 0:e.accessList},gas:async()=>{var e;return(e=(await t()).overrides)==null?void 0:e.gas},gasPrice:async()=>{var e;return(e=(await t()).overrides)==null?void 0:e.gasPrice},maxFeePerGas:async()=>{var e;return(e=(await t()).overrides)==null?void 0:e.maxFeePerGas},maxPriorityFeePerGas:async()=>{var e;return(e=(await t()).overrides)==null?void 0:e.maxPriorityFeePerGas},nonce:async()=>{var e;return(e=(await t()).overrides)==null?void 0:e.nonce},extraGas:async()=>{var e;return(e=(await t()).overrides)==null?void 0:e.extraGas},erc20Value:async()=>{var e;return(e=(await t()).overrides)==null?void 0:e.erc20Value},authorizationList:async()=>{var e;return(e=(await t()).overrides)==null?void 0:e.authorizationList}})}async function yI(r){const{client:t,chain:e,bundlerUrl:n}=r,i=n??Kc(e),s=`delegation-contract:${i}`;return qc(async()=>{var u;const c=await hn(t)(i,{useAuthToken:!0,body:we({id:1,jsonrpc:"2.0",method:"tw_getDelegationContract",params:[]}),headers:{"Content-Type":"application/json"},method:"POST"});if(!c.ok)throw new Error(`Failed to fetch delegation contract: ${c.status} ${c.statusText}`);const l=await c.json();if(l.error)throw new Error(`Delegation contract RPC error: ${JSON.stringify(l.error)}`);if(!((u=l.result)!=null&&u.delegationContract))throw new Error("Invalid response: missing delegationContract in result");return l.result.delegationContract},{cacheKey:s,cacheTime:24*60*60*1e3})}const wI=r=>{const{client:t,adminAccount:e,sponsorGas:n}=r,i=async o=>{var f,m,y;const c=o[0];if(!c)throw new Error("No transactions provided");const l=ge(c.chainId),u=$s({address:e.address,chain:l,client:t,abi:bI});let d=(f=c.authorizationList)==null?void 0:f[0];const h=await yI({client:t,chain:l});if(d&&((m=d.address)==null?void 0:m.toLowerCase())!==h.toLowerCase())throw new Error(`Authorization address does not match expected delegation contract address. Expected ${h} but got ${d.address}`);if(!d&&!await EI(u,h)){let O=c.nonce?BigInt(c.nonce):BigInt(await gI({client:t,address:e.address,chain:l}));O+=n?0n:1n;const g=await((y=e.signAuthorization)==null?void 0:y.call(e,{address:Z(h),chainId:c.chainId,nonce:O}));if(!g)throw new Error("Failed to sign authorization");d=g}if(n){const b={calls:o.map(A=>({data:A.data??"0x",target:Z(A.to??""),value:A.value??0n})),uid:ah()},O=await e.signTypedData({domain:{chainId:c.chainId,name:"MinimalAccount",verifyingContract:u.address,version:"1"},message:b,primaryType:"WrappedCalls",types:{Call:[{name:"target",type:"address"},{name:"value",type:"uint256"},{name:"data",type:"bytes"}],WrappedCalls:[{name:"calls",type:"Call[]"},{name:"uid",type:"bytes32"}]}}),g=await cI({authorization:d,eoaAddress:Z(e.address),options:{chain:ge(c.chainId),client:t},signature:O,wrappedCalls:b});return{transactionHash:await vI({options:{chain:ge(c.chainId),client:t},transactionId:g.transactionId})}}const p=mI({calls:o.map(b=>({data:b.data??"0x",target:Z(b.to??""),value:b.value??0n})),contract:u,overrides:{authorizationList:d?[d]:void 0,value:o.reduce((b,O)=>b+(O.value??0n),0n)}}),_=await Pd({from:e.address,transaction:p});return e.sendTransaction(_)},s={address:e.address,sendBatchTransaction:async o=>i(o),sendTransaction:async o=>i([o]),signMessage:({message:o,originalMessage:c,chainId:l})=>e.signMessage({chainId:l,message:o,originalMessage:c}),signTypedData:o=>e.signTypedData(o),sendCalls:async o=>{const{inAppWalletSendCalls:c}=await a(async()=>{const{inAppWalletSendCalls:p}=await import("./in-app-wallet-calls-Bdrxdgac.js");return{inAppWalletSendCalls:p}},__vite__mapDeps([28,29,10,1,2,3,4,18,30,5,6,7])),l=o.calls[0];if(!l)throw new Error("No calls to send");const u=l.client,d=l.chain||o.chain,h=await c({account:s,calls:o.calls,chain:d});return{chain:d,client:u,id:h}},getCallsStatus:async o=>{const{inAppWalletGetCallsStatus:c}=await a(async()=>{const{inAppWalletGetCallsStatus:l}=await import("./in-app-wallet-calls-Bdrxdgac.js");return{inAppWalletGetCallsStatus:l}},__vite__mapDeps([28,29,10,1,2,3,4,18,30,5,6,7]));return c(o)},getCallsStatusRaw:async o=>{const{inAppWalletGetCallsStatusRaw:c}=await a(async()=>{const{inAppWalletGetCallsStatusRaw:l}=await import("./in-app-wallet-calls-Bdrxdgac.js");return{inAppWalletGetCallsStatusRaw:l}},__vite__mapDeps([28,29,10,1,2,3,4,18,30,5,6,7]));return c(o)},getCapabilities:async o=>({[o.chainId??1]:{atomic:{status:"supported"},paymasterService:{supported:n??!1}}})};return s};async function gI(r){const{client:t,address:e,chain:n}=r,i=ni({chain:n,client:t});return await a(async()=>{const{eth_getTransactionCount:o}=await import("./eth_getTransactionCount-qsl0Cr9u.js");return{eth_getTransactionCount:o}},__vite__mapDeps([31,1,2,3,4])).then(({eth_getTransactionCount:o})=>o(i,{address:Z(e),blockTag:"pending"}))}async function EI(r,t){const e=await Od(r),n=e.length>0&&e.startsWith("0xef0100"),i=`0x${e.slice(8,48)}`;return n&&i.toLowerCase()===t.toLowerCase()}async function vI(r){const t=r.timeoutMs||3e5,e=r.intervalMs||1e3,n=Date.now()+t;for(;Date.now()<n;){const i=await lI({options:r.options,transactionId:r.transactionId});if(i.transactionHash)return i.transactionHash;await new Promise(s=>setTimeout(s,e))}throw new Error(`Timeout waiting for transaction to be mined on chain ${r.options.chain.id} with transactionId: ${r.transactionId}`)}const bI=[{type:"receive",stateMutability:"payable"},{type:"function",name:"createSessionWithSig",inputs:[{name:"sessionSpec",type:"tuple",internalType:"struct SessionLib.SessionSpec",components:[{name:"signer",type:"address",internalType:"address"},{name:"isWildcard",type:"bool",internalType:"bool"},{name:"expiresAt",type:"uint256",internalType:"uint256"},{name:"callPolicies",type:"tuple[]",internalType:"struct SessionLib.CallSpec[]",components:[{name:"target",type:"address",internalType:"address"},{name:"selector",type:"bytes4",internalType:"bytes4"},{name:"maxValuePerUse",type:"uint256",internalType:"uint256"},{name:"valueLimit",type:"tuple",internalType:"struct SessionLib.UsageLimit",components:[{name:"limitType",type:"uint8",internalType:"enum SessionLib.LimitType"},{name:"limit",type:"uint256",internalType:"uint256"},{name:"period",type:"uint256",internalType:"uint256"}]},{name:"constraints",type:"tuple[]",internalType:"struct SessionLib.Constraint[]",components:[{name:"condition",type:"uint8",internalType:"enum SessionLib.Condition"},{name:"index",type:"uint64",internalType:"uint64"},{name:"refValue",type:"bytes32",internalType:"bytes32"},{name:"limit",type:"tuple",internalType:"struct SessionLib.UsageLimit",components:[{name:"limitType",type:"uint8",internalType:"enum SessionLib.LimitType"},{name:"limit",type:"uint256",internalType:"uint256"},{name:"period",type:"uint256",internalType:"uint256"}]}]}]},{name:"transferPolicies",type:"tuple[]",internalType:"struct SessionLib.TransferSpec[]",components:[{name:"target",type:"address",internalType:"address"},{name:"maxValuePerUse",type:"uint256",internalType:"uint256"},{name:"valueLimit",type:"tuple",internalType:"struct SessionLib.UsageLimit",components:[{name:"limitType",type:"uint8",internalType:"enum SessionLib.LimitType"},{name:"limit",type:"uint256",internalType:"uint256"},{name:"period",type:"uint256",internalType:"uint256"}]}]},{name:"uid",type:"bytes32",internalType:"bytes32"}]},{name:"signature",type:"bytes",internalType:"bytes"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"eip712Domain",inputs:[],outputs:[{name:"fields",type:"bytes1",internalType:"bytes1"},{name:"name",type:"string",internalType:"string"},{name:"version",type:"string",internalType:"string"},{name:"chainId",type:"uint256",internalType:"uint256"},{name:"verifyingContract",type:"address",internalType:"address"},{name:"salt",type:"bytes32",internalType:"bytes32"},{name:"extensions",type:"uint256[]",internalType:"uint256[]"}],stateMutability:"view"},{type:"function",name:"execute",inputs:[{name:"calls",type:"tuple[]",internalType:"struct Call[]",components:[{name:"target",type:"address",internalType:"address"},{name:"value",type:"uint256",internalType:"uint256"},{name:"data",type:"bytes",internalType:"bytes"}]}],outputs:[],stateMutability:"payable"},{type:"function",name:"executeWithSig",inputs:[{name:"wrappedCalls",type:"tuple",internalType:"struct WrappedCalls",components:[{name:"calls",type:"tuple[]",internalType:"struct Call[]",components:[{name:"target",type:"address",internalType:"address"},{name:"value",type:"uint256",internalType:"uint256"},{name:"data",type:"bytes",internalType:"bytes"}]},{name:"uid",type:"bytes32",internalType:"bytes32"}]},{name:"signature",type:"bytes",internalType:"bytes"}],outputs:[],stateMutability:"payable"},{type:"function",name:"getCallPoliciesForSigner",inputs:[{name:"signer",type:"address",internalType:"address"}],outputs:[{name:"",type:"tuple[]",internalType:"struct SessionLib.CallSpec[]",components:[{name:"target",type:"address",internalType:"address"},{name:"selector",type:"bytes4",internalType:"bytes4"},{name:"maxValuePerUse",type:"uint256",internalType:"uint256"},{name:"valueLimit",type:"tuple",internalType:"struct SessionLib.UsageLimit",components:[{name:"limitType",type:"uint8",internalType:"enum SessionLib.LimitType"},{name:"limit",type:"uint256",internalType:"uint256"},{name:"period",type:"uint256",internalType:"uint256"}]},{name:"constraints",type:"tuple[]",internalType:"struct SessionLib.Constraint[]",components:[{name:"condition",type:"uint8",internalType:"enum SessionLib.Condition"},{name:"index",type:"uint64",internalType:"uint64"},{name:"refValue",type:"bytes32",internalType:"bytes32"},{name:"limit",type:"tuple",internalType:"struct SessionLib.UsageLimit",components:[{name:"limitType",type:"uint8",internalType:"enum SessionLib.LimitType"},{name:"limit",type:"uint256",internalType:"uint256"},{name:"period",type:"uint256",internalType:"uint256"}]}]}]}],stateMutability:"view"},{type:"function",name:"getSessionExpirationForSigner",inputs:[{name:"signer",type:"address",internalType:"address"}],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"function",name:"getSessionStateForSigner",inputs:[{name:"signer",type:"address",internalType:"address"}],outputs:[{name:"",type:"tuple",internalType:"struct SessionLib.SessionState",components:[{name:"transferValue",type:"tuple[]",internalType:"struct SessionLib.LimitState[]",components:[{name:"remaining",type:"uint256",internalType:"uint256"},{name:"target",type:"address",internalType:"address"},{name:"selector",type:"bytes4",internalType:"bytes4"},{name:"index",type:"uint256",internalType:"uint256"}]},{name:"callValue",type:"tuple[]",internalType:"struct SessionLib.LimitState[]",components:[{name:"remaining",type:"uint256",internalType:"uint256"},{name:"target",type:"address",internalType:"address"},{name:"selector",type:"bytes4",internalType:"bytes4"},{name:"index",type:"uint256",internalType:"uint256"}]},{name:"callParams",type:"tuple[]",internalType:"struct SessionLib.LimitState[]",components:[{name:"remaining",type:"uint256",internalType:"uint256"},{name:"target",type:"address",internalType:"address"},{name:"selector",type:"bytes4",internalType:"bytes4"},{name:"index",type:"uint256",internalType:"uint256"}]}]}],stateMutability:"view"},{type:"function",name:"getTransferPoliciesForSigner",inputs:[{name:"signer",type:"address",internalType:"address"}],outputs:[{name:"",type:"tuple[]",internalType:"struct SessionLib.TransferSpec[]",components:[{name:"target",type:"address",internalType:"address"},{name:"maxValuePerUse",type:"uint256",internalType:"uint256"},{name:"valueLimit",type:"tuple",internalType:"struct SessionLib.UsageLimit",components:[{name:"limitType",type:"uint8",internalType:"enum SessionLib.LimitType"},{name:"limit",type:"uint256",internalType:"uint256"},{name:"period",type:"uint256",internalType:"uint256"}]}]}],stateMutability:"view"},{type:"function",name:"isWildcardSigner",inputs:[{name:"signer",type:"address",internalType:"address"}],outputs:[{name:"",type:"bool",internalType:"bool"}],stateMutability:"view"},{type:"function",name:"onERC1155BatchReceived",inputs:[{name:"",type:"address",internalType:"address"},{name:"",type:"address",internalType:"address"},{name:"",type:"uint256[]",internalType:"uint256[]"},{name:"",type:"uint256[]",internalType:"uint256[]"},{name:"",type:"bytes",internalType:"bytes"}],outputs:[{name:"",type:"bytes4",internalType:"bytes4"}],stateMutability:"nonpayable"},{type:"function",name:"onERC1155Received",inputs:[{name:"",type:"address",internalType:"address"},{name:"",type:"address",internalType:"address"},{name:"",type:"uint256",internalType:"uint256"},{name:"",type:"uint256",internalType:"uint256"},{name:"",type:"bytes",internalType:"bytes"}],outputs:[{name:"",type:"bytes4",internalType:"bytes4"}],stateMutability:"nonpayable"},{type:"function",name:"onERC721Received",inputs:[{name:"",type:"address",internalType:"address"},{name:"",type:"address",internalType:"address"},{name:"",type:"uint256",internalType:"uint256"},{name:"",type:"bytes",internalType:"bytes"}],outputs:[{name:"",type:"bytes4",internalType:"bytes4"}],stateMutability:"nonpayable"},{type:"function",name:"supportsInterface",inputs:[{name:"interfaceId",type:"bytes4",internalType:"bytes4"}],outputs:[{name:"",type:"bool",internalType:"bool"}],stateMutability:"view"},{type:"event",name:"Executed",inputs:[{name:"to",type:"address",indexed:!0,internalType:"address"},{name:"value",type:"uint256",indexed:!1,internalType:"uint256"},{name:"data",type:"bytes",indexed:!1,internalType:"bytes"}],anonymous:!1},{type:"event",name:"SessionCreated",inputs:[{name:"signer",type:"address",indexed:!0,internalType:"address"},{name:"sessionSpec",type:"tuple",indexed:!1,internalType:"struct SessionLib.SessionSpec",components:[{name:"signer",type:"address",internalType:"address"},{name:"isWildcard",type:"bool",internalType:"bool"},{name:"expiresAt",type:"uint256",internalType:"uint256"},{name:"callPolicies",type:"tuple[]",internalType:"struct SessionLib.CallSpec[]",components:[{name:"target",type:"address",internalType:"address"},{name:"selector",type:"bytes4",internalType:"bytes4"},{name:"maxValuePerUse",type:"uint256",internalType:"uint256"},{name:"valueLimit",type:"tuple",internalType:"struct SessionLib.UsageLimit",components:[{name:"limitType",type:"uint8",internalType:"enum SessionLib.LimitType"},{name:"limit",type:"uint256",internalType:"uint256"},{name:"period",type:"uint256",internalType:"uint256"}]},{name:"constraints",type:"tuple[]",internalType:"struct SessionLib.Constraint[]",components:[{name:"condition",type:"uint8",internalType:"enum SessionLib.Condition"},{name:"index",type:"uint64",internalType:"uint64"},{name:"refValue",type:"bytes32",internalType:"bytes32"},{name:"limit",type:"tuple",internalType:"struct SessionLib.UsageLimit",components:[{name:"limitType",type:"uint8",internalType:"enum SessionLib.LimitType"},{name:"limit",type:"uint256",internalType:"uint256"},{name:"period",type:"uint256",internalType:"uint256"}]}]}]},{name:"transferPolicies",type:"tuple[]",internalType:"struct SessionLib.TransferSpec[]",components:[{name:"target",type:"address",internalType:"address"},{name:"maxValuePerUse",type:"uint256",internalType:"uint256"},{name:"valueLimit",type:"tuple",internalType:"struct SessionLib.UsageLimit",components:[{name:"limitType",type:"uint8",internalType:"enum SessionLib.LimitType"},{name:"limit",type:"uint256",internalType:"uint256"},{name:"period",type:"uint256",internalType:"uint256"}]}]},{name:"uid",type:"bytes32",internalType:"bytes32"}]}],anonymous:!1},{type:"event",name:"ValueReceived",inputs:[{name:"from",type:"address",indexed:!0,internalType:"address"},{name:"value",type:"uint256",indexed:!1,internalType:"uint256"}],anonymous:!1},{type:"error",name:"AllowanceExceeded",inputs:[{name:"allowanceUsage",type:"uint256",internalType:"uint256"},{name:"limit",type:"uint256",internalType:"uint256"},{name:"period",type:"uint64",internalType:"uint64"}]},{type:"error",name:"CallPolicyViolated",inputs:[{name:"target",type:"address",internalType:"address"},{name:"selector",type:"bytes4",internalType:"bytes4"}]},{type:"error",name:"CallReverted",inputs:[]},{type:"error",name:"ConditionFailed",inputs:[{name:"param",type:"bytes32",internalType:"bytes32"},{name:"refValue",type:"bytes32",internalType:"bytes32"},{name:"condition",type:"uint8",internalType:"uint8"}]},{type:"error",name:"InvalidDataLength",inputs:[{name:"actualLength",type:"uint256",internalType:"uint256"},{name:"expectedLength",type:"uint256",internalType:"uint256"}]},{type:"error",name:"InvalidSignature",inputs:[{name:"msgSender",type:"address",internalType:"address"},{name:"thisAddress",type:"address",internalType:"address"}]},{type:"error",name:"LifetimeUsageExceeded",inputs:[{name:"lifetimeUsage",type:"uint256",internalType:"uint256"},{name:"limit",type:"uint256",internalType:"uint256"}]},{type:"error",name:"MaxValueExceeded",inputs:[{name:"value",type:"uint256",internalType:"uint256"},{name:"maxValuePerUse",type:"uint256",internalType:"uint256"}]},{type:"error",name:"NoCallsToExecute",inputs:[]},{type:"error",name:"SessionExpired",inputs:[]},{type:"error",name:"SessionExpiresTooSoon",inputs:[]},{type:"error",name:"SessionZeroSigner",inputs:[]},{type:"error",name:"TransferPolicyViolated",inputs:[{name:"target",type:"address",internalType:"address"}]},{type:"error",name:"UIDAlreadyProcessed",inputs:[]}];function Xu(r){return r.id==="inApp"||r.id==="embedded"}async function II(r,t,e){var s,o,c,l;if(((s=t==null?void 0:t.auth)==null?void 0:s.mode)!=="popup"&&((o=t==null?void 0:t.auth)==null?void 0:o.mode)!==void 0&&e.authenticateWithRedirect){const u=r.strategy;Qu.includes(u)&&await e.authenticateWithRedirect(u,(c=t==null?void 0:t.auth)==null?void 0:c.mode,(l=t==null?void 0:t.auth)==null?void 0:l.redirectUrl)}const i=(await e.connect(r)).user.account;return ed({authAccount:i,client:r.client,createOptions:t,desiredChain:r.chain})}async function AI(r,t,e){r.authResult&&e.loginWithAuthToken&&await e.loginWithAuthToken(r.authResult);const n=await PI(e);if(!n)throw new Error("Failed to authenticate user.");const i=n.account;return ed({authAccount:i,client:r.client,createOptions:t,desiredChain:r.chain})}async function TI(r){const{connectSmartAccount:t}=await a(async()=>{const{connectSmartAccount:e}=await import("./index-BqbPuN49.js");return{connectSmartAccount:e}},__vite__mapDeps([19,3,4,1,2,20,11,5,6,7]));return t({chain:r.chain,client:r.client,personalAccount:r.authAccount},r.smartAccountOptions)}async function PI(r){const t=await r.getUser();switch(t.status){case"Logged In, Wallet Initialized":return t}}async function ed(r){const{createOptions:t,authAccount:e,desiredChain:n,client:i}=r;let s,o;const c=t&&"executionMode"in t?t.executionMode:void 0;if(c&&(c.mode==="EIP4337"?s=c.smartAccount:c.mode==="EIP7702"&&(o=c)),t&&"smartAccount"in t&&(t!=null&&t.smartAccount)&&(s=t.smartAccount),s){const[l,u]=await TI({authAccount:e,chain:n,client:i,smartAccountOptions:s});return{account:l,adminAccount:e,chain:u}}if(o){const l=n;if(!l)throw new Error("Chain is required for EIP-7702 execution, pass a chain when connecting the inAppWallet.");return{account:wI({adminAccount:e,client:i,sponsorGas:o.sponsorGas}),adminAccount:e,chain:l}}return{account:e,chain:n||oh}}const Wi=Object.freeze(Object.defineProperty({__proto__:null,autoConnectInAppWallet:AI,connectInAppWallet:II,isInAppWallet:Xu},Symbol.toStringTag,{value:"Module"}));function OI(r){const t=n=>Xu(n)||Or(n),e=Ds(r.wallet)&&r.connectedWallets.some(n=>{var i,s,o,c,l,u;return t(n)&&((s=(i=n.getAccount())==null?void 0:i.address)==null?void 0:s.toLowerCase())===((u=(l=(c=(o=r.wallet).getAdminAccount)==null?void 0:c.call(o))==null?void 0:l.address)==null?void 0:u.toLowerCase())});return t(r.wallet)||e}function RI(){if(typeof document>"u")return;const r=new URLSearchParams(window.location.search);let t;const e=window.location.hash||"";let n=e;const i=e.indexOf("?");i!==-1&&(t=new URLSearchParams(e.substring(i)),n=e.substring(0,i));const s=r.get("walletId")??(t==null?void 0:t.get("walletId"))??void 0,o=r.get("authResult")??(t==null?void 0:t.get("authResult"))??void 0,c=r.get("authProvider")??(t==null?void 0:t.get("authProvider"))??void 0,l=r.get("authCookie")??(t==null?void 0:t.get("authCookie"))??void 0,u=r.get("authFlow")??(t==null?void 0:t.get("authFlow"))??void 0;if((l||o)&&s){const d=(()=>{if(o)return r.delete("authResult"),t==null||t.delete("authResult"),JSON.parse(decodeURIComponent(o))})();r.delete("walletId"),r.delete("authProvider"),r.delete("authCookie"),r.delete("authFlow"),t==null||t.delete("walletId"),t==null||t.delete("authProvider"),t==null||t.delete("authCookie"),t==null||t.delete("authFlow");const h=r.toString(),p=h?`?${h}`:"";let _=n;if(t){const f=t.toString();f&&(_=`${n}?${f}`)}return window.history.pushState({},"",`${window.location.pathname}${p}${_}`),{authCookie:l,authFlow:u,authProvider:c,authResult:d,walletId:s}}}let Hi;const LI=async r=>{if(Hi&&!r.force&&await Hi)return!0;const t=DI(r);return Hi=t,t},DI=async({storage:r,props:t,createWalletFn:e,manager:n,connectOverride:i,setLastAuthProvider:s})=>{var A,E,D,L,w;const{wallets:o,onConnect:c}=t,l=t.timeout??15e3;let u=!1;n.isAutoConnecting.setValue(!0);let[d,h]=await Promise.all([Ju(r),go(r)]);const p=RI();if((p==null?void 0:p.authFlow)==="link"&&p.authResult)return await VI({client:t.client,connectOverride:i,createWalletFn:e,manager:n,onConnect:c,props:t,setLastAuthProvider:s,storage:r,timeout:l,urlToken:p,wallets:o});const _=o.find(v=>v.id===(p==null?void 0:p.walletId));if(p!=null&&p.authCookie&&_&&await new wo({clientId:t.client.clientId,ecosystem:Or(_)?{id:_.id,partnerId:(A=_.getConfig())==null?void 0:A.partnerId}:void 0,storage:r}).saveAuthCookie(p.authCookie),p!=null&&p.walletId&&(h=p.walletId,d=d!=null&&d.includes(p.walletId)?d:[p.walletId,...d||[]]),p!=null&&p.authProvider&&await(s==null?void 0:s(p.authProvider,r)),!d)return u;const f=await Zu(r)||t.chain,m=d.map(v=>{const I=o.find(T=>T.id===v);return I||e(v)}),y=h&&(m.find(v=>v.id===h)||e(h));if(y){n.activeWalletConnectionStatusStore.setValue("connecting"),await Yu(Ss({authResult:p==null?void 0:p.authResult,client:t.client,lastConnectedChain:f,wallet:y}),{message:`AutoConnect timeout: ${l}ms limit exceeded.`,ms:l}).catch(v=>{console.warn(v.message),t.onTimeout&&t.onTimeout()});try{await(i?i(y):n.connect(y,{accountAbstraction:t.accountAbstraction,client:t.client}))}catch(v){v instanceof Error&&console.warn("Error auto connecting wallet:",v.message),n.activeWalletConnectionStatusStore.setValue("disconnected")}}else n.activeWalletConnectionStatusStore.setValue("disconnected");const b=m.filter(v=>v.id!==h&&d.includes(v.id));for(const v of b)try{await Ss({authResult:p==null?void 0:p.authResult,client:t.client,lastConnectedChain:f,wallet:v}),n.addConnectedWallet(v)}catch{}y&&OI({connectedWallets:y?[y,...b]:b,wallet:y})&&((E=t.siweAuth)!=null&&E.requiresAuth)&&!((D=t.siweAuth)!=null&&D.isLoggedIn)&&!((L=t.siweAuth)!=null&&L.isLoggingIn)&&await((w=t.siweAuth)==null?void 0:w.doLogin().catch(v=>{console.warn("Error signing in with SIWE:",v.message)})),n.isAutoConnecting.setValue(!1);const g=n.activeWalletStore.getValue(),P=n.connectedWallets.getValue();if(g){u=!0;try{c==null||c(g,P)}catch(v){console.error("Error calling onConnect callback:",v)}}else n.activeWalletConnectionStatusStore.setValue("disconnected");return u};async function VI(r){var P;const{client:t,connectOverride:e,createWalletFn:n,manager:i,onConnect:s,props:o,setLastAuthProvider:c,storage:l,timeout:u,urlToken:d,wallets:h}=r,[p,_]=await Promise.all([Ju(l),go(l)]),f=await Zu(l)||o.chain;if(!_||!p)return console.warn("No stored wallet found for linking flow"),i.isAutoConnecting.setValue(!1),!1;d.authProvider&&await(c==null?void 0:c(d.authProvider,l));const m=h.find(A=>A.id===_)||n(_);i.activeWalletConnectionStatusStore.setValue("connecting");try{await Yu(Ss({authResult:void 0,client:t,lastConnectedChain:f,wallet:m}),{message:`AutoConnect timeout: ${u}ms limit exceeded.`,ms:u}),await(e?e(m):i.connect(m,{accountAbstraction:o.accountAbstraction,client:t}))}catch(A){return console.warn("Failed to auto-connect for linking:",A),i.activeWalletConnectionStatusStore.setValue("disconnected"),i.isAutoConnecting.setValue(!1),!1}const y=Or(m)?{id:m.id,partnerId:(P=m.getConfig())==null?void 0:P.partnerId}:void 0,b=new wo({clientId:t.clientId,ecosystem:y,storage:l});try{await hI({client:t,ecosystem:y,storage:b,tokenToLink:d.authResult.storedToken.cookieString})}catch(A){console.error("Failed to link profile after redirect:",A)}i.isAutoConnecting.setValue(!1);const O=i.activeWalletStore.getValue(),g=i.connectedWallets.getValue();if(O){try{s==null||s(O,g)}catch(A){console.error("Error calling onConnect callback:",A)}return!0}return!1}async function Ss(r){return r.wallet.autoConnect({authResult:r.authResult,chain:r.lastConnectedChain,client:r.client})}async function SI(r){const t=r.wallets||Xb(r),e=uI(Fn);return await LI({createWalletFn:at,manager:e,props:{...r,wallets:t},storage:Fn})}const LA=Object.freeze(Object.defineProperty({__proto__:null,DefaultWalletConnectRequestHandlers:Gb,EIP1193:Qh,authenticate:ip,authenticateWithRedirect:sp,autoConnect:SI,createWallet:at,createWalletAdapter:Xh,createWalletConnectClient:Jb,createWalletConnectSession:Zb,deploySmartAccount:Dd,disconnectWalletConnectSession:Wu,ecosystemWallet:sl,embeddedWallet:Yi,generateAccount:dp,getActiveWalletConnectSessions:Yb,getAllWalletsList:ep,getInstalledWallets:ol,getProfiles:cp,getUser:Ld,getUserEmail:tp,getUserPhoneNumber:rp,getWalletBalance:hp,getWalletInfo:Jc,inAppWallet:Yi,injectedProvider:Js,isBaseAccountSDKWallet:Yc,linkProfile:op,preAuthenticate:np,privateKeyAccount:Xi,privateKeyToAccount:Xi,randomPrivateKey:Rd,smartWallet:Gs,unlinkProfile:ap,walletConnect:Hh},Symbol.toStringTag,{value:"Module"}));export{vA as $,vl as A,oi as B,sn as C,qb as D,q_ as E,xn as F,El as G,F_ as H,W_ as I,nA as J,ae as K,tA as L,Jn as M,hA as N,sA as O,bu as P,iA as Q,nI as R,Kc as S,Hu as T,si as U,un as V,Ah as W,IA as X,Uw as Y,bA as Z,gA as _,wA as a,qI as a0,vh as a1,Ih as a2,AA as a3,TA as a4,EA as a5,Ds as a6,RA as a7,wo as a8,Fn as a9,fA as aa,Qu as ab,hI as ac,PA as ad,OA as ae,_A as af,LA as ag,Jc as b,Wn as c,mA as d,Wu as e,xh as f,Wh as g,Fu as h,pA as i,Mb as j,Bb as k,jb as l,bc as m,lt as n,vc as o,js as p,Qs as q,ah as r,yA as s,Ar as t,yo as u,ir as v,qt as w,_e as x,rA as y,Jo as z};
|