@dcl/auth-site 4.20.1-29287535500.commit-21e2097 → 4.21.0

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.
Files changed (115) hide show
  1. package/assets/{ConstantsUtil-DkgBhC-3.js → ConstantsUtil-SfeDQRNO.js} +1 -1
  2. package/assets/{ContentfulRichText-CpTGRqW5.js → ContentfulRichText-B493-l1G.js} +1 -1
  3. package/assets/{ExchangeController-DAuyR32a.js → ExchangeController-Cl7LpW_9.js} +1 -1
  4. package/assets/{HelpersUtil-BmBOHU8y.js → HelpersUtil-BqxjBOsb.js} +1 -1
  5. package/assets/LoginPage-3mBiytHd.js +1 -0
  6. package/assets/{NetworkUtil-hPciM8MB.js → NetworkUtil-WtQP9K5L.js} +1 -1
  7. package/assets/{SwapController-BuTlR-rE.js → SwapController-C3sOw1fb.js} +1 -1
  8. package/assets/{W3MFrameProviderSingleton-C1QswdNU.js → W3MFrameProviderSingleton-GariHyC1.js} +3 -3
  9. package/assets/{biconomy-Fnzq2AaG.js → biconomy-ok_Fev4O.js} +1 -1
  10. package/assets/{browser-yuJ3wGx6.js → browser-CL7pc_C2.js} +1 -1
  11. package/assets/browser-ponyfill-B9OjpPGs.js +1 -0
  12. package/assets/{ccip-CAaY56-g.js → ccip-BlbxM0LQ.js} +1 -1
  13. package/assets/{ccip-DLLDQWdG.js → ccip-CFiU7kCg.js} +1 -1
  14. package/assets/{chains-BWttGtkR.js → chains-CGXwPY-w.js} +1 -1
  15. package/assets/{common-7lNGOStV.js → common-CvKtb4n1.js} +1 -1
  16. package/assets/{controller-Bi4psLHv.js → controller-BFbz0Wfy.js} +2 -2
  17. package/assets/{data-capture-D-C94jSy.js → data-capture-Bjp5qmbu.js} +1 -1
  18. package/assets/{email-B62o62VS.js → email-dOZOTXLM.js} +1 -1
  19. package/assets/{embedded-wallet-Bufr94SG.js → embedded-wallet-4C0zCBzD.js} +1 -1
  20. package/assets/{engine-Ds35bLsp.js → engine-BF4fgHph.js} +1 -1
  21. package/assets/{estimate-l1-fee-BJHE4ePY.js → estimate-l1-fee-DFM9SNlY.js} +1 -1
  22. package/assets/{ethereum-B7A4SHAX.js → ethereum-D1IvEqvR.js} +1 -1
  23. package/assets/{extractIPFS-DgWXFyTF.js → extractIPFS-DJ38044A.js} +1 -1
  24. package/assets/{features-yOzv-e_q.js → features-Dq7eLLHj.js} +1 -1
  25. package/assets/{fetchTokenMetadata-CdsDJI22.js → fetchTokenMetadata-DFbXfV36.js} +1 -1
  26. package/assets/{fortmatic-DSTwSTGw.js → fortmatic-VXwlmn3x.js} +1 -1
  27. package/assets/{get-ecosystem-wallet-info-r53Q9L1F.js → get-ecosystem-wallet-info-7Lw-sZ_z.js} +1 -1
  28. package/assets/{getBalance-DYKZS6Hn.js → getBalance-lwqG5BkA.js} +1 -1
  29. package/assets/{getInstalledModules-BsaRLOBo.js → getInstalledModules-BqEUrGDu.js} +1 -1
  30. package/assets/{getNFT-BT0va_ps.js → getNFT-CdoOvyuq.js} +2 -2
  31. package/assets/{getNFT-DyXFPTtJ.js → getNFT-qEDnShr-.js} +1 -1
  32. package/assets/{if-defined-BGHXcjlf.js → if-defined-CqpJarBn.js} +1 -1
  33. package/assets/{in-app-wallet-calls-D-jHkY3c.js → in-app-wallet-calls-DnbOJdqi.js} +1 -1
  34. package/assets/{index-CkD9exTg.js → index-48_zL_8V.js} +3 -3
  35. package/assets/{index-ClytS1EG.js → index-4Rm21Jcs.js} +1 -1
  36. package/assets/{index-BXRMK8j1.js → index-B4nv3uRr.js} +1 -1
  37. package/assets/{index-2jBQ38d_.js → index-B90inivw.js} +1 -1
  38. package/assets/{index-CmNc8trc.js → index-BGzx8xC8.js} +1 -1
  39. package/assets/{index-CYuFlPOC.js → index-BNctYT5W.js} +1 -1
  40. package/assets/{index-DAvzQoJc.js → index-BZnk5nGE.js} +1 -1
  41. package/assets/{index-bLgqUt1C.js → index-BehUnmBQ.js} +1 -1
  42. package/assets/{index-zorQVT5C.js → index-BgA11815.js} +1 -1
  43. package/assets/{index-Ds1ydXx9.js → index-BgjSH5C0.js} +2 -2
  44. package/assets/{index-DPoBMxER.js → index-Bmtxr8ck.js} +1 -1
  45. package/assets/{index-BHfrnWbK.js → index-BnEh4tgY.js} +1 -1
  46. package/assets/{index-C6oKjgTD.js → index-BnMK4rtE.js} +1 -1
  47. package/assets/{index-Ynxfq_j7.js → index-BxDS7YgF.js} +1 -1
  48. package/assets/{index-JXnAd7HU.js → index-C0a8a3_a.js} +1 -1
  49. package/assets/{index-BORKfZ0w.js → index-C2wXt8bX.js} +1 -1
  50. package/assets/{index-CUTvqvnd.js → index-C9zadnoP.js} +1 -1
  51. package/assets/{index-Xt3c8bVw.js → index-CA_7NqLN.js} +2 -2
  52. package/assets/{index-DAn6fi4B.js → index-CJQ7XUF1.js} +1 -1
  53. package/assets/{index-Co20Wufm.js → index-CMVgYvcj.js} +1 -1
  54. package/assets/{index-CbNgsots.js → index-CNiv2JYH.js} +1 -1
  55. package/assets/{index-D0kxJqlX.js → index-COjWxfCR.js} +1 -1
  56. package/assets/{index-SvnadGeW.js → index-CSkZf6TU.js} +1 -1
  57. package/assets/{index-DfmwgrQl.js → index-CVYOFAvL.js} +1 -1
  58. package/assets/{index-BU93e28H.js → index-CVqr-7Pt.js} +1 -1
  59. package/assets/{index-mkKLfL50.js → index-CZRVN2vE.js} +1 -1
  60. package/assets/{index-h7zgn9mx.js → index-C_o5O_iU.js} +9 -9
  61. package/assets/{index-xfbV3wiz.js → index-CgTPsSZC.js} +1 -1
  62. package/assets/{index-ClM-sGXu.js → index-CmYKoHtM.js} +1 -1
  63. package/assets/{index-BWW9faHX.js → index-CpyBHHGL.js} +1 -1
  64. package/assets/{index-D3A-KZkC.js → index-CusnlpEv.js} +1 -1
  65. package/assets/{index-BuAaz9-i.js → index-Czf8Yu5V.js} +1 -1
  66. package/assets/{index-j12pitQF.js → index-D28HIM1b.js} +1 -1
  67. package/assets/{index-Db4WTF-F.js → index-D3-eBZaP.js} +1 -1
  68. package/assets/{index-DrOlu4Tm.js → index-DJKVllQq.js} +1 -1
  69. package/assets/{index-B5GQLMSc.js → index-DLztodpx.js} +3 -3
  70. package/assets/{index-BAbd-m37.js → index-DO37X-UR.js} +1 -1
  71. package/assets/{index-DqM7glUM.js → index-DWhePAr8.js} +1 -1
  72. package/assets/index-DdAb4cgP.css +1 -0
  73. package/assets/{index-DrBxmxAk.js → index-DhrbQM9o.js} +1 -1
  74. package/assets/{index-DXlOrQan.js → index-DkoCaWFP.js} +1 -1
  75. package/assets/{index-Dd6WSWIJ.js → index-DpgCenmo.js} +1 -1
  76. package/assets/{index-C2UZfzQ-.js → index-Dqf3E5Am.js} +1 -1
  77. package/assets/{index-Cjq04DXG.js → index-DxTxoCQ5.js} +1 -1
  78. package/assets/{index-H1RtENWs.js → index-MOkgM3CG.js} +1 -1
  79. package/assets/{index-BpVXwPYi.js → index-aGypPCn4.js} +1 -1
  80. package/assets/{index-DiMYCz_K.js → index-lExqs17M.js} +1 -1
  81. package/assets/{index-BXwt6qMC.js → index-ltBsvN7l.js} +1 -1
  82. package/assets/{index.es-BGCdZ8iz.js → index.es-DnpWJXa6.js} +1 -1
  83. package/assets/{index.es-q-O--bde.js → index.es-obcdOSPN.js} +1 -1
  84. package/assets/{native-JpImfY6X.js → native-B7Tb9XD0.js} +1 -1
  85. package/assets/{networks-B-X638Cy.js → networks-xZgfuUkI.js} +3 -3
  86. package/assets/{onramp-OnMvtDz0.js → onramp-DRY-VmEl.js} +1 -1
  87. package/assets/{openzeppelin-BU8bW370.js → openzeppelin-BZfSJIk4.js} +1 -1
  88. package/assets/{ownerOf-TveQWfL6.js → ownerOf-Chv3cItD.js} +1 -1
  89. package/assets/{parseNft-CfxuqOgy.js → parseNft-d6d6Hp6d.js} +2 -2
  90. package/assets/{pay-with-exchange-Ck0Cj6VC.js → pay-with-exchange-Fws3sgDP.js} +1 -1
  91. package/assets/{qr-overlay-EnFVg6ne.js → qr-overlay-CRwPPsut.js} +3 -3
  92. package/assets/{receive-ucd1iMgu.js → receive-ENeHUThj.js} +1 -1
  93. package/assets/{ref-BIDK04Qt.js → ref-BJXu_ix1.js} +1 -1
  94. package/assets/{resolveImplementation-CRGcSdv-.js → resolveImplementation-BDMCDrvF.js} +1 -1
  95. package/assets/{secp256k1-GERMcQ1g.js → secp256k1-CAuxtucr.js} +1 -1
  96. package/assets/{send-NLAJsBux.js → send-BVveMXEO.js} +1 -1
  97. package/assets/{send-eip712-transaction-haPD8e0J.js → send-eip712-transaction-BLYLbaE2.js} +1 -1
  98. package/assets/{send-gasless-transaction-BZ-k8SPZ.js → send-gasless-transaction-H5yovUSA.js} +2 -2
  99. package/assets/{session-proposal-CvW06ECh.js → session-proposal-BOVuEqZb.js} +1 -1
  100. package/assets/{session-request-hdyj4KFj.js → session-request-u0q6IDVU.js} +2 -2
  101. package/assets/{socials-C0OswFfG.js → socials-CT51nzyt.js} +1 -1
  102. package/assets/{swaps-Ylmuyai3.js → swaps-DcnyL-aF.js} +1 -1
  103. package/assets/{thirdweb-DwEJXXOk.js → thirdweb-RfTGDewD.js} +5 -5
  104. package/assets/{totalSupply-DIe1jFWb.js → totalSupply-D1tOGyvE.js} +1 -1
  105. package/assets/{transactions-D2TvDz1u.js → transactions-LbE_YtGz.js} +1 -1
  106. package/assets/{ui-CCQzH9lw.js → ui-CUXWd4jk.js} +5 -5
  107. package/assets/{vendor-DNqBwP4B.js → vendor-DlkLYSlV.js} +1 -1
  108. package/assets/{w3m-modal-NV3fM5nf.js → w3m-modal-BSFcMGCh.js} +1 -1
  109. package/assets/{wallets-BbpGg0Ps.js → wallets-OS7LlF3P.js} +5 -5
  110. package/assets/{web-connector-v65JqJ1n.js → web-connector-3zdQreYv.js} +3 -3
  111. package/index.html +5 -5
  112. package/package.json +2 -2
  113. package/assets/LoginPage-CyMLzwvv.js +0 -1
  114. package/assets/browser-ponyfill-RildGPMW.js +0 -1
  115. package/assets/index-DXHA7qZa.css +0 -1
@@ -1,6 +1,6 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/get-ecosystem-wallet-info-r53Q9L1F.js","assets/thirdweb-DwEJXXOk.js","assets/store-CraP4F4Y.js","assets/ui-CCQzH9lw.js","assets/vendor-DNqBwP4B.js","assets/index-h7zgn9mx.js","assets/index-DXHA7qZa.css","assets/index-DXlOrQan.js","assets/index-H1RtENWs.js","assets/index-nibyPLVP.js","assets/ethereum-B7A4SHAX.js","assets/index-ClM-sGXu.js","assets/vanilla-BwPktXNc.js","assets/hooks.module-MHgUT2ti.js","assets/clsx.m-DHulAg21.js","assets/index-bLgqUt1C.js","assets/web-connector-v65JqJ1n.js","assets/index-Xt3c8bVw.js","assets/send-eip712-transaction-haPD8e0J.js","assets/controller-Bi4psLHv.js","assets/qr-overlay-EnFVg6ne.js","assets/getBalance-DYKZS6Hn.js","assets/secp256k1-GERMcQ1g.js","assets/session-proposal-CvW06ECh.js","assets/session-request-hdyj4KFj.js","assets/in-app-wallet-calls-D-jHkY3c.js"])))=>i.map(i=>d[i]);
2
- import{bF as uh,bG as nr,bH as Sc,bI as si,ac as Ve,Q as Po,R as hh,n as De,f as Z,F as zr,p as Kt,bJ as Cc,_ as a,bK as li,b as ge,aI as $s,s as we,bL as $c,bM as kc,bN as Uc,j as ks,u as Us,t as Ns,Y as Nc,as as nn,ak as dh,x as Bs,al as ph,a5 as _h,b7 as fh,h as mh,v as yh,i as wh,bO as Bc,bP as gh,bQ as Eh,aq as vh,ar as bh,bR as Ih,bS as Ah,l as sn,bT as Th,bU as Jn,an as Mc,bV as Ph,bW as Oh,bX as Ms,bY as qc,bZ as Rh,N as qs,b_ as zc,b$ as Lh,c0 as Oo,c1 as Dh,P as Vh,c2 as Ro,c3 as xh,c4 as Sh,c5 as Ch,c6 as $h,a1 as kh,g as Uh,aB as Nh,c7 as Lo,d as Bh,c8 as jc,a9 as Kc,ab as _r,aa as Fc,c9 as Mh,aV as qh,ca as zh,cb as Jt,cc as jh,a2 as Kh,o as Fh,y as Wh,J as Hh,cd as Gh,ce as Jh,cf as Yh}from"./thirdweb-DwEJXXOk.js";import{c as Zh}from"./store-CraP4F4Y.js";import{B as ee,g as K}from"./ui-CCQzH9lw.js";import{e as ui,N as Wc}from"./index-h7zgn9mx.js";import{d as br,a as jr,s as sr,I as Ti,e as Qh,g as tt,t as je,h as B,j as Rt,C as Xh,k as ed,l as Yi,m as Yn,D as fr,n as td,q as id,c as Nt,r as Pi,o as rd,u as nd,v as zs,w as js,b as Kr,P as Do,Q as sd,x as od,y as Xt,f as Hc,z as bt,A as _t,B as Dt}from"./index-DXlOrQan.js";import{c as ad,a as cd,k as ld,d as ud,s as hd,g as Vo}from"./index-nibyPLVP.js";import"./index-H1RtENWs.js";import{e as dd}from"./ethereum-B7A4SHAX.js";async function qe(i){const{client:t,ecosystem:e,walletType:r,walletAddress:n,chainId:s}=i;return uh({client:t,data:{action:"connect",chainId:s,source:"connectWallet",walletAddress:n,walletType:r},ecosystem:e})}function Ks(i){const t=i.domain;return(t==null?void 0:t.chainId)!==void 0&&nr(t.chainId)&&(i.domain={...i.domain,chainId:Sc(i.domain.chainId)}),i}const pd={"0x0":"reverted","0x1":"success"};function Fs(i){var r;const[t,e]=(()=>{const n=i.status;return n>=100&&n<200?["pending",n]:n>=200&&n<300?["success",n]:n>=300&&n<700?["failure",n]:n==="CONFIRMED"?["success",200]:n==="PENDING"?["pending",100]:[void 0,n]})();return{...i,atomic:i.atomic,chainId:i.chainId?si(i.chainId):void 0,receipts:((r=i.receipts)==null?void 0:r.map(n=>({...n,blockNumber:Ve(n.blockNumber),gasUsed:Ve(n.gasUsed),status:pd[n.status]})))??[],status:t,statusCode:e,version:i.version}}function Ws(i,t){const e={};for(const[r,n]of Object.entries(i)){e[Number(r)]={};const s={};for(const[o,c]of Object.entries(n))s[o]=c;e[Number(r)]=s}return typeof t=="number"?{[t]:e[t]}:e}async function Hs(i,t){const e=i.calls[0];if(!e)throw new Error("No calls to send");const{calls:r,capabilities:n,version:s="2.0.0",chain:o=e.chain}=i,c=await Promise.all(r.map(async u=>{const{to:h,value:d}=u;if(h===void 0&&u.data===void 0)throw new Error("Cannot send call, `to` or `data` must be provided.");const[p,_,f]=await Promise.all([Po(h),hh(u),Po(d)]);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:i.atomicRequired??!1,calls:c,capabilities:n,chainId:De(o.id),from:Z(t.address),version:s}],chain:o}}function Gs(i){return _d(i).map(t=>{try{const e=new URL(t);return e.hostname.endsWith(".thirdweb.com")&&(e.pathname="",e.search=""),e.toString()}catch{return t}})}function _d(i,t,e="http"){const r=[];for(const n of i.rpc)e==="http"&&!n.startsWith("http")||e==="ws"&&!n.startsWith("ws")||(n.includes("${THIRDWEB_API_KEY}")?r.push(n.replace("${THIRDWEB_API_KEY}","")):n.includes("${")||r.push(n));if(r.length===0)throw new Error(`No RPC available for chainId "${i.chainId}" with mode ${e}`);return r}function lt(i){return typeof i=="number"?i:zr(i)?si(i):typeof i=="bigint"?Number(i):Number.parseInt(i,10)}function fd(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}function md(){return typeof Kt<"u"&&typeof Kt.versions<"u"&&typeof Kt.versions.node<"u"}function Gc(){return!fd()&&!md()}const ft="com.coinbase.wallet",Pt="org.base.account",Jc="io.metamask",yd="me.rainbow",wd="io.zerion.wallet",Fr={async getItem(i){try{if(typeof window<"u"&&window.localStorage)return localStorage.getItem(i)}catch{}return null},async removeItem(i){typeof window<"u"&&window.localStorage&&localStorage.removeItem(i)},async setItem(i,t){try{typeof window<"u"&&window.localStorage&&localStorage.setItem(i,t)}catch{}}};function Js(i){return i.startsWith("http://")||i.startsWith("https://")}function Yc(i,t){if(!Js(i))return Zc(i,t);let e=i;e.endsWith("/")||(e=`${e}/`);const r=encodeURIComponent(t);return{href:e,redirect:`${e}wc?uri=${r}`}}function Zc(i,t){if(Js(i))return Yc(i,t);let e=i;e.includes("://")||(e=i.replaceAll("/","").replaceAll(":",""),e=`${e}://`),e.endsWith("/")||(e=`${e}/`);const r=encodeURIComponent(t);return{href:e,redirect:`${e}wc?uri=${r}`}}function gd(i,t){return Js(i)?Yc(i,t):Zc(i,t)}function Ed(){if(typeof navigator>"u")return!1;const i=Cc(navigator.userAgent);return i?i.toLowerCase().includes("android"):!1}function vd(){if(typeof navigator>"u")return!1;const i=Cc(navigator.userAgent);return i?i.toLowerCase().includes("ios")||i.toLowerCase().includes("mac")&&navigator.maxTouchPoints>1:!1}function bd(){return typeof window>"u"||typeof navigator>"u"?!1:"ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0}function Id(){return typeof window>"u"?!1:"orientation"in window||"onorientationchange"in window}function xo(){return!!(Ed()||vd()||bd()&&Id()||typeof window<"u"&&window.innerWidth<640)}function wn(i){if(window!==window.top)window.open(i);else if(i.startsWith("http")){const e=document.createElement("a");e.href=i,e.target="_blank",e.rel="noreferrer noopener",e.click()}else window.location.href=i}function Oi(i){return typeof i=="string"?i.startsWith("ecosystem."):i.id.startsWith("ecosystem.")}async function Qc(i,t){if(Oi(i)){const{getEcosystemWalletInfo:e}=await a(async()=>{const{getEcosystemWalletInfo:r}=await import("./get-ecosystem-wallet-info-r53Q9L1F.js");return{getEcosystemWalletInfo:r}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10]));return t?e(i).then(r=>r.image_id):e(i)}switch(i){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 ${i} not found`)}}function Ad(){const i=new Map;return{emit(t,e){const r=i.get(t);if(r)for(const n of r)n(e)},subscribe(t,e){var r;return i.has(t)?(r=i.get(t))==null||r.add(e):i.set(t,new Set([e])),()=>{const n=i.get(t);n&&n.delete(e)}}}}function hi(){return Ad()}function Td(i){const{createOptions:t}=i,e=hi();let r,n;function s(){r=void 0,n=void 0}let o=async()=>{},c=async h=>{n=h};const l=e.subscribe("chainChanged",h=>{n=h}),u=e.subscribe("disconnect",()=>{s(),l(),u()});return e.subscribe("accountChanged",h=>{r=h}),{autoConnect:async h=>{const{autoConnectBaseAccountSDK:d}=await a(async()=>{const{autoConnectBaseAccountSDK:b}=await Promise.resolve().then(()=>Co);return{autoConnectBaseAccountSDK:b}},void 0),p=await i.providerFactory(),[_,f,m,y]=await d(h,e,p);return r=_,n=f,o=m,c=y,qe({chainId:n.id,client:h.client,walletAddress:r.address,walletType:Pt}),r},connect:async h=>{const{connectBaseAccountSDK:d}=await a(async()=>{const{connectBaseAccountSDK:b}=await Promise.resolve().then(()=>Co);return{connectBaseAccountSDK:b}},void 0),p=await i.providerFactory(),[_,f,m,y]=await d(h,e,p);return r=_,n=f,o=m,c=y,qe({chainId:n.id,client:h.client,walletAddress:r.address,walletType:Pt}),r},disconnect:async()=>{s(),await o()},getAccount:()=>r,getChain(){if(n)return n=li(n.id)||n,n},getConfig:()=>t,id:Pt,subscribe:e.subscribe,switchChain:async h=>{await c(h)}}}function Wr(){if(!Gc())return{description:"thirdweb powered dApp",logoUrl:"https://thirdweb.com/favicon.ico",name:"thirdweb powered dApp",url:"https://thirdweb.com"};const{protocol:i,hostname:t,port:e}=window.location;let r=`${i}//${t}`;e&&e!=="80"&&e!=="443"&&(r+=`:${e}`);const n=`${r}/favicon.ico`;return{description:window.document.title||"thirdweb powered dApp",logoUrl:n,name:window.document.title||"thirdweb powered dApp",url:r}}let gn,Ir;async function Xc(i){var s,o,c,l,u,h,d;if(gn){if(i&&Ir){const p=((s=Ir.chains)==null?void 0:s.map(y=>y.id))||[],_=((o=i.chains)==null?void 0:o.map(y=>y.id))||[],f=p.length===_.length&&p.every((y,b)=>y===_[b]),m=((c=i.appMetadata)==null?void 0:c.name)===((l=Ir.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 gn}const{createBaseAccountSDK:t}=await a(async()=>{const{createBaseAccountSDK:p}=await import("./index-ClM-sGXu.js");return{createBaseAccountSDK:p}},__vite__mapDeps([11,12,13,14,1,3,4,9])),e=Wr(),n=t({appName:((u=i==null?void 0:i.appMetadata)==null?void 0:u.name)||e.name||"thirdweb powered dApp",appLogoUrl:((h=i==null?void 0:i.appMetadata)==null?void 0:h.logoUrl)||e.logoUrl||null,appChainIds:((d=i==null?void 0:i.chains)==null?void 0:d.map(p=>p.id))||[]}).getProvider();return gn=n,Ir=i,n}function el(i){return i.id===Pt}function So({provider:i,address:t,client:e}){const r={address:Z(t),async sendTransaction(n){const s=await i.request({method:"eth_sendTransaction",params:[{accessList:n.accessList,data:n.data,from:Z(t),gas:n.gas?De(n.gas):void 0,to:n.to,value:n.value?De(n.value):void 0}]});return Ns({chainId:n.chainId,client:e,contractAddress:n.to??void 0,gasPrice:n.gasPrice,transactionHash:s,walletAddress:Z(t),walletType:Pt}),{transactionHash:s}},async signMessage({message:n}){if(!r.address)throw new Error("Provider not setup");const s=typeof n=="string"?ks(n):n.raw instanceof Uint8Array?Us(n.raw):n.raw,o=await i.request({method:"personal_sign",params:[s,r.address]});if(!nr(o))throw new Error("Invalid signature returned");return o},async signTypedData(n){if(!r.address)throw new Error("Provider not setup");const{domain:s,message:o,primaryType:c}=Ks(n),l={EIP712Domain:$c(s),...n.types};kc({domain:s,message:o,primaryType:c,types:l});const u=Uc({domain:s??{},message:o,primaryType:c,types:l}),h=await i.request({method:"eth_signTypedData_v4",params:[r.address,u]});if(!nr(h))throw new Error("Invalid signed payload returned");return h},sendCalls:async n=>{try{const{callParams:s,chain:o}=await Hs(n,r),c=await i.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(n){try{const s=await i.request({method:"wallet_getCallsStatus",params:[n.id]});return Fs(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(n){const s=n.chainId;try{const o=await i.request({method:"wallet_getCapabilities",params:[Z(r.address)]});return Ws(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 r}function tl(i,t,e,r,n){const s=So({address:i,client:n,provider:e});async function o(){e.off("accountsChanged",l),e.off("chainChanged",u),e.off("disconnect",c),await e.disconnect()}async function c(){o(),r.emit("disconnect",void 0)}function l(h){if(h[0]){const d=So({address:Z(h[0]),client:n,provider:e});r.emit("accountChanged",d),r.emit("accountsChanged",h)}else c()}function u(h){const d=ge(lt(h));r.emit("chainChanged",d)}return e.on("accountsChanged",l),e.on("chainChanged",u),e.on("disconnect",c),[s,t,c,h=>il(e,h)]}async function Pd(i,t,e){const r=await e.request({method:"eth_requestAccounts"});if(!r[0])throw new Error("No accounts found");const n=Z(r[0]),s=await e.request({method:"eth_chainId"}),o=lt(s);let c=i.chain&&i.chain.id===o?i.chain:ge(o);return o&&(i!=null&&i.chain)&&o!==(i==null?void 0:i.chain.id)&&(await il(e,i.chain),c=i.chain),tl(n,c,e,t,i.client)}async function Od(i,t,e){const n=(await e.request({method:"eth_accounts"}))[0];if(!n)throw new Error("No accounts found");const s=await e.request({method:"eth_chainId"}),o=lt(s),c=i.chain&&i.chain.id===o?i.chain:ge(o);return tl(n,c,e,t,i.client)}async function il(i,t){var s;const e=await i.request({method:"eth_chainId"}),r=ge(lt(e));if((r==null?void 0:r.id)===t.id)return;const n=De(t.id);try{await i.request({method:"wallet_switchEthereumChain",params:[{chainId:n}]})}catch(o){const c=await $s(t);(o==null?void 0:o.code)===4902&&await i.request({method:"wallet_addEthereumChain",params:[{blockExplorerUrls:((s=c.explorers)==null?void 0:s.map(l=>l.url))||[],chainId:n,chainName:c.name,nativeCurrency:c.nativeCurrency,rpcUrls:Gs(c)}]})}}const Co=Object.freeze(Object.defineProperty({__proto__:null,autoConnectBaseAccountSDK:Od,connectBaseAccountSDK:Pd,getBaseAccountWebProvider:Xc,isBaseAccountSDKWallet:el},Symbol.toStringTag,{value:"Module"}));function Rd(i){const{createOptions:t}=i,e=hi();let r,n;function s(){r=void 0,n=void 0}let o=async()=>{},c=async h=>{n=h};const l=e.subscribe("chainChanged",h=>{n=h}),u=e.subscribe("disconnect",()=>{s(),l(),u()});return e.subscribe("accountChanged",h=>{r=h}),{autoConnect:async h=>{const{autoConnectCoinbaseWalletSDK:d}=await a(async()=>{const{autoConnectCoinbaseWalletSDK:b}=await Promise.resolve().then(()=>ko);return{autoConnectCoinbaseWalletSDK:b}},void 0),p=await i.providerFactory(),[_,f,m,y]=await d(h,e,p);return r=_,n=f,o=m,c=y,qe({chainId:n.id,client:h.client,walletAddress:r.address,walletType:ft}),r},connect:async h=>{const{connectCoinbaseWalletSDK:d}=await a(async()=>{const{connectCoinbaseWalletSDK:b}=await Promise.resolve().then(()=>ko);return{connectCoinbaseWalletSDK:b}},void 0),p=await i.providerFactory(),[_,f,m,y]=await d(h,e,p);return r=_,n=f,o=m,c=y,qe({chainId:n.id,client:h.client,walletAddress:r.address,walletType:ft}),r},disconnect:async()=>{s(),await o()},getAccount:()=>r,getChain(){if(n)return n=li(n.id)||n,n},getConfig:()=>t,id:ft,onConnectRequested:async()=>{var h;if(i.onConnectRequested){const d=await i.providerFactory();return(h=i.onConnectRequested)==null?void 0:h.call(i,d)}},subscribe:e.subscribe,switchChain:async h=>{await c(h)}}}async function rl(i){var t,e;await((e=(t=i==null?void 0:i.communicator)==null?void 0:t.waitForPopupLoaded)==null?void 0:e.call(t))}const Ld=Object.freeze(Object.defineProperty({__proto__:null,showCoinbasePopup:rl},Symbol.toStringTag,{value:"Module"}));let En;async function nl(i){var t,e;if(!En){let r=(await a(()=>import("./index-bLgqUt1C.js"),__vite__mapDeps([15,3,4,1,14,13]))).default;typeof r!="function"&&typeof r.default=="function"&&(r=r.default);const s=new r({appChainIds:i!=null&&i.chains?i.chains.map(o=>o.id):void 0,appLogoUrl:((t=i==null?void 0:i.appMetadata)==null?void 0:t.logoUrl)||Wr().logoUrl,appName:((e=i==null?void 0:i.appMetadata)==null?void 0:e.name)||Wr().name}).makeWeb3Provider(i==null?void 0:i.walletConfig);return En=s,s}return En}function $o({provider:i,address:t,client:e}){const r={address:Z(t),onTransactionRequested:async()=>{window.localStorage&&window.localStorage.getItem("-CBWSDK:SignerConfigurator:SignerType")==="scw"&&await rl(i)},async sendTransaction(n){const s=await i.request({method:"eth_sendTransaction",params:[{accessList:n.accessList,data:n.data,from:Z(t),gas:n.gas?De(n.gas):void 0,to:n.to,value:n.value?De(n.value):void 0}]});return Ns({chainId:n.chainId,client:e,contractAddress:n.to??void 0,gasPrice:n.gasPrice,transactionHash:s,walletAddress:Z(t),walletType:ft}),{transactionHash:s}},async signMessage({message:n}){if(!r.address)throw new Error("Provider not setup");const s=typeof n=="string"?ks(n):n.raw instanceof Uint8Array?Us(n.raw):n.raw,o=await i.request({method:"personal_sign",params:[s,r.address]});if(!nr(o))throw new Error("Invalid signature returned");return o},async signTypedData(n){if(!r.address)throw new Error("Provider not setup");const{domain:s,message:o,primaryType:c}=Ks(n),l={EIP712Domain:$c(s),...n.types};kc({domain:s,message:o,primaryType:c,types:l});const u=Uc({domain:s??{},message:o,primaryType:c,types:l}),h=await i.request({method:"eth_signTypedData_v4",params:[r.address,u]});if(!nr(h))throw new Error("Invalid signed payload returned");return h},sendCalls:async n=>{try{const{callParams:s,chain:o}=await Hs(n,r),c=await i.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(n){try{const s=await i.request({method:"wallet_getCallsStatus",params:[n.id]});return Fs(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(n){try{return await i.request({method:"wallet_getCallsStatus",params:[n.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(n){const s=n.chainId;try{const o=await i.request({method:"wallet_getCapabilities",params:[Z(r.address)]});return Ws(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 r}function sl(i,t,e,r,n){const s=$o({address:i,client:n,provider:e});async function o(){e.removeListener("accountsChanged",l),e.removeListener("chainChanged",u),e.removeListener("disconnect",c),await e.disconnect()}async function c(){o(),r.emit("disconnect",void 0)}function l(h){if(h[0]){const d=$o({address:Z(h[0]),client:n,provider:e});r.emit("accountChanged",d),r.emit("accountsChanged",h)}else c()}function u(h){const d=ge(lt(h));r.emit("chainChanged",d)}return e.on("accountsChanged",l),e.on("chainChanged",u),e.on("disconnect",c),[s,t,c,h=>ol(e,h)]}async function Dd(i,t,e){const r=await e.request({method:"eth_requestAccounts"});if(!r[0])throw new Error("No accounts found");const n=Z(r[0]),s=await e.request({method:"eth_chainId"}),o=lt(s);let c=i.chain&&i.chain.id===o?i.chain:ge(o);return o&&(i!=null&&i.chain)&&o!==(i==null?void 0:i.chain.id)&&(await ol(e,i.chain),c=i.chain),sl(n,c,e,t,i.client)}async function Vd(i,t,e){const n=(await e.request({method:"eth_accounts"}))[0];if(!n)throw new Error("No accounts found");const s=await e.request({method:"eth_chainId"}),o=lt(s),c=i.chain&&i.chain.id===o?i.chain:ge(o);return sl(n,c,e,t,i.client)}async function ol(i,t){var s;const e=await i.request({method:"eth_chainId"}),r=ge(lt(e));if((r==null?void 0:r.id)===t.id)return;const n=De(t.id);try{await i.request({method:"wallet_switchEthereumChain",params:[{chainId:n}]})}catch(o){const c=await $s(t);(o==null?void 0:o.code)===4902&&await i.request({method:"wallet_addEthereumChain",params:[{blockExplorerUrls:((s=c.explorers)==null?void 0:s.map(l=>l.url))||[],chainId:n,chainName:c.name,nativeCurrency:c.nativeCurrency,rpcUrls:Gs(c)}]})}}const ko=Object.freeze(Object.defineProperty({__proto__:null,autoConnectCoinbaseWalletSDK:Vd,connectCoinbaseWalletSDK:Dd,getCoinbaseWebProvider:nl},Symbol.toStringTag,{value:"Module"}));async function xd(i){return Nc(async()=>{var r;const e=await(await fetch(`${nn("inAppWallet")}/api/2024-05-05/ecosystem-wallet`,{headers:{"x-ecosystem-id":i}})).json();if(!e||e.code==="UNAUTHORIZED")throw new Error(e.message||`Could not find ecosystem wallet with id ${i}, please check your ecosystem wallet configuration.`);return(r=e.authOptions)!=null&&r.includes("siwe")&&(e.authOptions=e.authOptions.filter(n=>n!=="siwe"),e.authOptions.push("wallet")),e},{cacheKey:`ecosystem-wallet-options-${i}`,cacheTime:1e3*60*5})}const vn=new Map;async function Wi(i,t,e){var s;const r=we({clientId:i.clientId,ecosystem:e,partialSecretKey:(s=i.secretKey)==null?void 0:s.slice(0,5)});if(vn.has(r))return vn.get(r);const n=await t(i);return vn.set(r,n),n}function al(i){const{createOptions:t,connectorFactory:e,ecosystem:r}=i,n=r?r.id:"inApp",s=hi();let o=t,c,l,u,h,d=null;const p=async _=>{if(r){const f=await xd(r.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,R=(_==null?void 0:_.chain)??(b?ge(b):void 0);if(!R)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:R,factoryAddress:m.accountFactoryAddress,sponsorGas:m.sponsorGas}}}}};return{autoConnect:async _=>{const{autoConnectInAppWallet:f}=await a(async()=>{const{autoConnectInAppWallet:v}=await Promise.resolve().then(()=>Hn);return{autoConnectInAppWallet:v}},void 0),m=await Wi(_.client,e,r);await p();const{account:y,chain:b,adminAccount:R}=await f(_,o,m);h=_.client,c=y,l=R,u=b;try{d=await m.storage.getAuthCookie()}catch(v){console.error("Failed to retrieve auth token:",v),d=null}return qe({chainId:u.id,client:_.client,ecosystem:r,walletAddress:c.address,walletType:n}),c},connect:async _=>{const{connectInAppWallet:f}=await a(async()=>{const{connectInAppWallet:v}=await Promise.resolve().then(()=>Hn);return{connectInAppWallet:v}},void 0),m=await Wi(_.client,e,r);await p();const{account:y,chain:b,adminAccount:R}=await f(_,o,m);h=_.client,c=y,l=R,u=b;try{d=await m.storage.getAuthCookie()}catch(v){console.error("Failed to retrieve auth token:",v),d=null}return qe({chainId:u.id,client:_.client,ecosystem:r,walletAddress:c.address,walletType:n}),c},disconnect:async()=>{if(h&&!(await(await Wi(h,e,r)).logout()).success)throw new Error("Failed to logout");c=void 0,l=void 0,u=void 0,d=null,s.emit("disconnect",void 0)},getAccount:()=>c,getAdminAccount:()=>l,getAuthToken:()=>d,getChain(){if(u)return u=li(u.id)||u,u},getConfig:()=>o,id:n,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")&&h&&c){const{autoConnectInAppWallet:m}=await a(async()=>{const{autoConnectInAppWallet:P}=await Promise.resolve().then(()=>Hn);return{autoConnectInAppWallet:P}},void 0),y=await Wi(h,e,r);await p({chain:_});const{account:b,chain:R,adminAccount:v}=await m({chain:_,client:h},o,y);l=v,c=b,u=R}else u=_;s.emit("chainChanged",_)}}}function cl(...i){const[t,e]=i,r={id:t,partnerId:e==null?void 0:e.partnerId};return al({connectorFactory:async n=>{const{InAppWebConnector:s}=await a(async()=>{const{InAppWebConnector:o}=await import("./web-connector-v65JqJ1n.js");return{InAppWebConnector:o}},__vite__mapDeps([16,1,2,3,4,5,6,7,8,9,10]));return new s({client:n,ecosystem:r,storage:e==null?void 0:e.storage})},createOptions:{auth:{...e==null?void 0:e.auth,options:[]},partnerId:r.partnerId},ecosystem:r})}function Zn(i){return al({connectorFactory:async t=>{var r;const{InAppWebConnector:e}=await a(async()=>{const{InAppWebConnector:n}=await import("./web-connector-v65JqJ1n.js");return{InAppWebConnector:n}},__vite__mapDeps([16,1,2,3,4,5,6,7,8,9,10]));return new e({client:t,passkeyDomain:(r=i==null?void 0:i.auth)==null?void 0:r.passkeyDomain,storage:i==null?void 0:i.storage})},createOptions:i})}function Ys(i){const t=hi();let e,r,n,s;return{autoConnect:async o=>{const{connectSmartAccount:c}=await a(async()=>{const{connectSmartAccount:h}=await import("./index-Xt3c8bVw.js");return{connectSmartAccount:h}},__vite__mapDeps([17,1,18,2,3,4,5,6,7,8,9,10])),[l,u]=await c(o,i);return s=o,e=l,n=u,qe({chainId:n.id,client:o.client,walletAddress:e.address,walletType:"smart"}),e},connect:async o=>{const{connectSmartAccount:c}=await a(async()=>{const{connectSmartAccount:h}=await import("./index-Xt3c8bVw.js");return{connectSmartAccount:h}},__vite__mapDeps([17,1,18,2,3,4,5,6,7,8,9,10])),[l,u]=await c(o,i);return r=o.personalAccount,s=o,e=l,n=u,qe({chainId:n.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-Xt3c8bVw.js");return{disconnectSmartAccount:c}},__vite__mapDeps([17,1,18,2,3,4,5,6,7,8,9,10]));await o(e)}e=void 0,r=void 0,n=void 0,t.emit("disconnect",void 0)},getAccount:()=>e,getAdminAccount:()=>r,getChain(){if(n)return n=li(n.id)||n,n},getConfig:()=>i,id:"smart",subscribe:t.subscribe,switchChain:async o=>{var d;if(!s)throw new Error("Cannot switch chain without a previous connection");if(!await dh(o)){const p=Bs({address:i.factoryAddress||ph((d=i.overrides)==null?void 0:d.entrypointAddress),chain:o,client:s.client});if(!await _h(p))throw new Error(`Factory contract not deployed on chain: ${o.id}`)}const{connectSmartAccount:l}=await a(async()=>{const{connectSmartAccount:p}=await import("./index-Xt3c8bVw.js");return{connectSmartAccount:p}},__vite__mapDeps([17,1,18,2,3,4,5,6,7,8,9,10])),[u,h]=await l({...s,chain:o},{...i,chain:o});e=u,n=h,t.emit("accountChanged",u),t.emit("chainChanged",h)}}}function at(...i){const[t,e]=i;switch(!0){case t==="smart":return Ys(e);case(t==="embedded"||t==="inApp"):return Zn(e);case Oi(t):return cl(...i);case t===ft:{const r=e;return Rd({createOptions:r,onConnectRequested:async n=>{const{showCoinbasePopup:s}=await a(async()=>{const{showCoinbasePopup:o}=await Promise.resolve().then(()=>Ld);return{showCoinbasePopup:o}},void 0);return s(n)},providerFactory:()=>nl(r)})}case t===Pt:{const r=e;return Td({createOptions:r,providerFactory:()=>Xc(r)})}default:{let c=function(){n=void 0,s=void 0};const r=hi();let n,s,o,l=async()=>{};const u=r.subscribe("disconnect",()=>{c(),o==null||o(),u()});r.subscribe("accountChanged",_=>{n=_});let h=async()=>{throw new Error("Not implemented yet")};const d=xo()?_=>wn(_):void 0,p={autoConnect:async _=>{const{injectedProvider:f}=await a(async()=>{const{injectedProvider:m}=await Promise.resolve().then(()=>No);return{injectedProvider:m}},void 0);if(t!=="walletConnect"&&f(t)){const{autoConnectEip1193Wallet:m}=await a(async()=>{const{autoConnectEip1193Wallet:P}=await Promise.resolve().then(()=>Mo);return{autoConnectEip1193Wallet:P}},void 0),[y,b,R,v]=await m({chain:_.chain,client:_.client,emitter:r,id:t,provider:Qn(t)});return n=y,s=b,l=R,h=v,o=r.subscribe("chainChanged",P=>{s=P}),qe({chainId:s.id,client:_.client,walletAddress:n.address,walletType:t}),n}if(_&&"client"in _){const{autoConnectWC:m}=await a(async()=>{const{autoConnectWC:P}=await import("./controller-Bi4psLHv.js");return{autoConnectWC:P}},__vite__mapDeps([19,1,2,3,4,5,6,7,8,9,10])),[y,b,R,v]=await m(_,r,p.id,Fr,d);return n=y,s=b,l=R,h=v,qe({chainId:s.id,client:_.client,walletAddress:n.address,walletType:t}),n}throw new Error("Failed to auto connect")},connect:async _=>{async function f(b){var P;const{connectWC:R}=await a(async()=>{const{connectWC:T}=await import("./controller-Bi4psLHv.js");return{connectWC:T}},__vite__mapDeps([19,1,2,3,4,5,6,7,8,9,10]));let v;try{const[T,g,D,L]=await R({...b,walletConnect:{...b.walletConnect,onDisplayUri:((P=b.walletConnect)==null?void 0:P.onDisplayUri)||(async w=>{var E,I;if(typeof window<"u"&&typeof document<"u")if(xo()){const A=await Qc(t),V=A.mobile.native||A.mobile.universal;wn(V?gd(V,w).redirect:w);return}else try{const{createQROverlay:A}=await a(async()=>{const{createQROverlay:V}=await import("./qr-overlay-EnFVg6ne.js");return{createQROverlay:V}},__vite__mapDeps([20,1]));v&&v.destroy(),v=A(w,{theme:((I=(E=b.walletConnect)==null?void 0:E.qrModalOptions)==null?void 0:I.themeMode)??"dark",qrSize:280,showCloseButton:!0,onCancel:()=>{var V,O;(O=(V=b.walletConnect)==null?void 0:V.onCancel)==null||O.call(V)}})}catch(A){console.error("Failed to create QR overlay:",A)}})}},r,p.id,Fr,d);return v&&(v.destroy(),v=void 0),n=T,s=g,l=D,h=L,qe({chainId:s.id,client:b.client,walletAddress:n.address,walletType:t}),n}catch(T){throw v&&(v.destroy(),v=void 0),T}}if(t==="walletConnect"){const{client:b,chain:R,...v}=_;return f({chain:R,client:b,walletConnect:{...v}})}const m=_&&"walletConnect"in _,{injectedProvider:y}=await a(async()=>{const{injectedProvider:b}=await Promise.resolve().then(()=>No);return{injectedProvider:b}},void 0);if(y(t)&&!m){const{connectEip1193Wallet:b}=await a(async()=>{const{connectEip1193Wallet:g}=await Promise.resolve().then(()=>Mo);return{connectEip1193Wallet:g}},void 0),[R,v,P,T]=await b({chain:_.chain,client:_.client,emitter:r,id:t,provider:Qn(t)});return n=R,s=v,l=P,h=T,o=r.subscribe("chainChanged",g=>{s=g}),qe({chainId:s.id,client:_.client,walletAddress:n.address,walletType:t}),n}if(_&&"client"in _)return f(_);throw new Error("Failed to connect")},disconnect:async()=>{c(),await l()},getAccount:()=>n,getChain(){if(s)return s=li(s.id)||s,s},getConfig:()=>i[1],id:t,subscribe:r.subscribe,switchChain:async _=>{try{await h(_),s=_}catch(f){console.error("Error switching chain",f)}}};return p}}}function Sd(){return at("walletConnect")}const Uo=Gc()?Zh():void 0;function Zs(i){const t=Qs().find(e=>e.info.rdns===i);return t==null?void 0:t.provider}function ll(){return Qs().map(e=>e.info.rdns).map(e=>at(e))}function Cd(){if(Uo)return Uo}function Qs(){var t;const i=((t=Cd())==null?void 0:t.getProviders())||[];for(const e of i)if(e.info.rdns==="io.metamask.mobile"){e.info.rdns=Jc;break}return i}const No=Object.freeze(Object.defineProperty({__proto__:null,getInstalledWalletProviders:Qs,getInstalledWallets:ll,injectedProvider:Zs},Symbol.toStringTag,{value:"Module"}));function Qn(i){const t=Zs(i);if(!t)throw new Error(`No injected provider found for wallet: "${i}"`);return t}async function ul({id:i,provider:t,emitter:e,client:r,chain:n}){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=$d(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),h=await t.request({method:"eth_chainId"}).then(lt).catch(f=>{throw new Error("Error reading chainId from provider",f)});let d=n&&n.id===h?n:ge(h);try{n&&typeof n.id<"u"&&n.id!==h&&(await pl(t,n),d=n)}catch{console.warn(`Error switching to chain ${n==null?void 0:n.id} - defaulting to wallet chain (${h})`)}return dl({address:u,chain:d,client:r,emitter:e,id:i,provider:t})}async function hl({id:i,provider:t,emitter:e,client:r,chain:n}){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=n&&n.id===l?n:ge(l);return dl({address:c,chain:u,client:r,emitter:e,id:i,provider:t})}function Bo({provider:i,address:t,client:e,id:r}){const n={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?Eh(s.authorizationList):void 0,accessList:s.accessList,...s.eip712}];try{const l=await i.request({method:"eth_sendTransaction",params:c});return Ns({chainId:s.chainId,client:e,contractAddress:s.to??void 0,gasPrice:s.gasPrice,transactionHash:l,walletAddress:Z(t),walletType:r}),{transactionHash:l}}catch(l){throw vh(l)&&bh({chainId:s.chainId,client:e,contractAddress:s.to||void 0,error:l,transactionValue:s.value,walletAddress:Z(t)}),l}},async signMessage({message:s}){if(!n.address)throw new Error("Provider not setup");const o=typeof s=="string"?ks(s):s.raw instanceof Uint8Array?Us(s.raw):s.raw;return await i.request({method:"personal_sign",params:[o,Z(n.address)]})},async signAuthorization(s){const o=Bc(s);let c;try{c=await i.request({method:"eth_sign",params:[Z(n.address),o]})}catch{c=await i.request({method:"secp256k1_sign",params:[o]})}if(!c)throw new Error("Failed to sign authorization");const l=gh(c);return{...s,...l}},async signTypedData(s){if(!i||!n.address)throw new Error("Provider not setup");const o=Ks(s),{domain:c,message:l,primaryType:u}=o,h={EIP712Domain:mh({domain:c}),...o.types};yh({domain:c,message:l,primaryType:u,types:h});const d=wh({domain:c??{},message:l,primaryType:u,types:h});return await i.request({method:"eth_signTypedData_v4",params:[Z(n.address),d]})},async watchAsset(s){return await i.request({method:"wallet_watchAsset",params:s},{retryCount:0})},async sendCalls(s){try{const{callParams:o,chain:c}=await Hs(s,n),l=await i.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(`${r} errored calling wallet_sendCalls, with error: ${o instanceof Error?o.message:fh(o)}`):o}},async getCallsStatus(s){try{const o=await i.request({method:"wallet_getCallsStatus",params:[s.id]});return Fs(o)}catch(o){throw/unsupport|not support/i.test(o.message)?new Error(`${r} does not support wallet_getCallsStatus, reach out to them directly to request EIP-5792 support.`):o}},async getCallsStatusRaw(s){try{return await i.request({method:"wallet_getCallsStatus",params:[s.id]})}catch(o){throw/unsupport|not support/i.test(o.message)?new Error(`${r} 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 i.request({method:"wallet_getCapabilities",params:[Z(n.address),o?[De(o)]:void 0]});return Ws(c,o)}catch(c){if(/unsupport|not support|not available/i.test(c.message))return{message:`${r} does not support wallet_getCapabilities, reach out to them directly to request EIP-5792 support.`};throw c}}};return n}async function dl({provider:i,address:t,chain:e,emitter:r,client:n,id:s}){const o=Bo({address:t,client:n,id:s,provider:i});async function c(){i.removeListener("accountsChanged",u),i.removeListener("chainChanged",h),i.removeListener("disconnect",l);try{await Ih(()=>i.request({method:"wallet_revokePermissions",params:[{eth_accounts:{}}]}),{timeout:100})}catch{}}async function l(){c(),r.emit("disconnect",void 0)}function u(d){if(d[0]){const p=Bo({address:Z(d[0]),client:n,id:s,provider:i});r.emit("accountChanged",p),r.emit("accountsChanged",d)}else l()}function h(d){const p=ge(lt(d));r.emit("chainChanged",p)}return i.on&&(i.on("accountsChanged",u),i.on("chainChanged",h),i.on("disconnect",l)),[o,e,l,d=>pl(i,d)]}async function pl(i,t){var r;const e=De(t.id);try{await i.request({method:"wallet_switchEthereumChain",params:[{chainId:e}]})}catch{const n=await $s(t);await i.request({method:"wallet_addEthereumChain",params:[{blockExplorerUrls:(r=n.explorers)==null?void 0:r.map(s=>s.url),chainId:e,chainName:n.name,nativeCurrency:n.nativeCurrency,rpcUrls:Gs(n)}]})}}function $d(i){return i instanceof Error?i.message:typeof i=="string"?i:typeof i=="object"&&i!==null?JSON.stringify(i):String(i)}const Mo=Object.freeze(Object.defineProperty({__proto__:null,autoConnectEip1193Wallet:hl,connectEip1193Wallet:ul,getInjectedProvider:Qn},Symbol.toStringTag,{value:"Module"}));function kd(i){const t=i.walletId??"adapter",e=hi();let r,n,s;const o=async p=>(s=typeof i.provider=="function"?await i.provider(p):i.provider,s),c=e.subscribe("chainChanged",p=>{n=p});function l(){r=void 0,n=void 0}let u=async()=>{};const h=e.subscribe("disconnect",()=>{l(),c(),h()});e.subscribe("accountChanged",p=>{r=p});let d=async p=>{await(s==null?void 0:s.request({method:"wallet_switchEthereumChain",params:[{chainId:Ah(p.id)}]}))};return{autoConnect:async p=>{var b;const[_,f,m,y]=await hl({chain:p.chain,client:p.client,emitter:e,id:t,provider:await o({chainId:(b=p.chain)==null?void 0:b.id})});return r=_,n=f,u=m,d=y,e.emit("onConnect",p),qe({client:p.client,walletAddress:r.address,walletType:t}),r},connect:async p=>{var b;const[_,f,m,y]=await ul({chain:p.chain,client:p.client,emitter:e,id:t,provider:await o({chainId:(b=p.chain)==null?void 0:b.id})});return r=_,n=f,u=m,d=y,e.emit("onConnect",p),qe({client:p.client,walletAddress:r.address,walletType:t}),r},disconnect:async()=>{l(),await u(),e.emit("disconnect",void 0)},getAccount:()=>r,getChain(){if(n)return n=li(n.id)||n,n},getConfig:()=>{},id:t,subscribe:e.subscribe,switchChain:async p=>{await d(p),e.emit("chainChanged",p)}}}function Ud(i){const{chain:t,client:e,wallet:r,connectOverride:n}=i,s=sn({chain:t,client:e});return{on:r.subscribe,removeListener:()=>{},request:async o=>{switch(o.method){case"eth_sendTransaction":{const c=r.getAccount();if(!c)throw new Error("Account not connected");return(await Mc({account:c,transaction:Jn({...o.params[0],chain:t,client:e})})).transactionHash}case"eth_estimateGas":{const c=r.getAccount();if(!c)throw new Error("Account not connected");return Th({account:c,transaction:Jn({...o.params[0],chain:t,client:e})})}case"personal_sign":{const c=r.getAccount();if(!c)throw new Error("Account not connected");return c.signMessage({message:{raw:o.params[0]}})}case"eth_signTypedData_v4":{const c=r.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=r.getAccount();return c?[c.address]:[]}case"eth_requestAccounts":{const c=r.getAccount();if(c)return[c.address];const l=n?await n(r):await r.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=zr(l)?si(l):l,h=ge(u);return r.switchChain(h)}case"wallet_getCapabilities":{const c=r.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],h=zr(u)?si(u):Number(u);return c.getCapabilities(h?{chainId:h}:{})}return c.getCapabilities({})}case"wallet_sendCalls":{const c=r.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=r.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 Nd=Object.freeze(Object.defineProperty({__proto__:null,fromProvider:kd,toProvider:Ud},Symbol.toStringTag,{value:"Module"}));function Bd(i){const t=hi();let e=i.chain;return{autoConnect:async()=>(t.emit("onConnect",i),i.adaptedAccount),connect:async()=>(t.emit("onConnect",i),i.adaptedAccount),disconnect:async()=>{await i.onDisconnect(),t.emit("disconnect",void 0)},getAccount(){return i.adaptedAccount},getChain(){return e=li(e.id)||e,e},getConfig(){return i},id:"adapter",subscribe:t.subscribe,switchChain:async r=>{await i.switchChain(r),e=r,t.emit("chainChanged",r)}}}async function Md(){return(await a(async()=>{const{default:i}=await import("./wallet-infos-BHI_w6r-.js");return{default:i}},[])).default}async function di(i,t){return Wi(i,async e=>{const{InAppWebConnector:r}=await a(async()=>{const{InAppWebConnector:n}=await import("./web-connector-v65JqJ1n.js");return{InAppWebConnector:n}},__vite__mapDeps([16,1,2,3,4,5,6,7,8,9,10]));return new r({client:e,ecosystem:t})},t)}async function _l(i){const{client:t,ecosystem:e}=i,n=await(await di(t,e)).getUser();switch(n.status){case"Logged In, Wallet Initialized":return n}}async function qd(i){const t=await _l(i);if(t&&"email"in t.authDetails)return t.authDetails.email}async function zd(i){const t=await _l(i);if(t&&"phoneNumber"in t.authDetails)return t.authDetails.phoneNumber}async function jd(i){return(await di(i.client,i.ecosystem)).preAuthenticate(i)}async function Kd(i){return(await di(i.client,i.ecosystem)).authenticate(i)}async function Fd(i){const t=await di(i.client,i.ecosystem);if(!t.authenticateWithRedirect)throw new Error("authenticateWithRedirect is not supported on this platform");return t.authenticateWithRedirect(i.strategy,i.mode,i.redirectUrl)}async function Wd(i){return await(await di(i.client,i.ecosystem)).linkProfile(i)}async function Hd(i){return await(await di(i.client,i.ecosystem)).unlinkProfile(i.profileToUnlink,i.allowAccountDeletion)}async function Gd(i){return(await di(i.client,i.ecosystem)).getProfiles()}function Jd(i){if("privateKey"in i){const t=Ph(typeof i.message=="object"?i.message.raw:Oh(i.message)),e=Ms({payload:t,privateKey:i.privateKey});return qc(e)}if("account"in i){const{message:t,account:e}=i;return e.signMessage({message:t})}throw new Error("Either privateKey or account is required")}function Yd(i){var s;const{privateKey:t,...e}=i;typeof((s=e.domain)==null?void 0:s.chainId)=="string"&&(e.domain.chainId=Sc(e.domain.chainId));const r=Rh(e),n=Ms({payload:r,privateKey:t});return qc(n)}function Xn(i){const{client:t}=i,e=`0x${i.privateKey.replace(/^0x/,"")}`,r=qs(zc.getPublicKey(e.slice(2),!1)),n=Lh(r);return{address:Z(n),sendTransaction:async o=>{const c=sn({chain:ge(o.chainId),client:t}),l=Oo({privateKey:e,transaction:o});return{transactionHash:await Vh(c,l)}},signAuthorization:async o=>{const c=Ms({payload:Bc(o),privateKey:e});return Dh(o,{signature:c})},signMessage:async({message:o})=>Jd({message:o,privateKey:e}),signTransaction:async o=>Oo({privateKey:e,transaction:o}),signTypedData:async o=>Yd({...o,privateKey:e})}}async function Zd(i){const t=qs(zc.utils.randomPrivateKey());return Xn({client:i.client,privateKey:t})}async function Qd(i){const{address:t,client:e,chain:r}=i,n=i.tokenAddress||(r.id===42429?"0x20c0000000000000000000000000000000000000":void 0);if(n&&Z(n)!==Z(Ro)){const{getBalance:h}=await a(async()=>{const{getBalance:d}=await import("./getBalance-DYKZS6Hn.js");return{getBalance:d}},__vite__mapDeps([21,1]));return h({address:t,contract:Bs({address:n,chain:r,client:e})})}const s=sn({chain:r,client:e}),[o,c,l,u]=await Promise.all([xh(r),Sh(r),Ch(r),$h(s,{address:t})]);return{chainId:r.id,decimals:c,displayValue:kh(u,c),name:l,symbol:o,tokenAddress:n??Ro,value:u}}function Xd(i){return!i||typeof i.then!="function"?Promise.resolve(i):i}function ye(i,...t){try{return Xd(i(...t))}catch(e){return Promise.reject(e)}}function ep(i){const t=typeof i;return i===null||t!=="object"&&t!=="function"}function tp(i){const t=Object.getPrototypeOf(i);return!t||t.isPrototypeOf(Object)}function Cr(i){if(ep(i))return String(i);if(tp(i)||Array.isArray(i))return JSON.stringify(i);if(typeof i.toJSON=="function")return Cr(i.toJSON());throw new Error("[unstorage] Cannot stringify value!")}const es="base64:";function ip(i){return typeof i=="string"?i:es+sp(i)}function rp(i){return typeof i!="string"||!i.startsWith(es)?i:np(i.slice(es.length))}function np(i){return globalThis.Buffer?ee.from(i,"base64"):Uint8Array.from(globalThis.atob(i),t=>t.codePointAt(0))}function sp(i){return globalThis.Buffer?ee.from(i).toString("base64"):globalThis.btoa(String.fromCodePoint(...i))}function ke(i){var t;return i&&((t=i.split("?")[0])==null?void 0:t.replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,""))||""}function op(...i){return ke(i.join(":"))}function Ar(i){return i=ke(i),i?i+":":""}function ap(i,t){if(t===void 0)return!0;let e=0,r=i.indexOf(":");for(;r>-1;)e++,r=i.indexOf(":",r+1);return e<=t}function cp(i,t){return t?i.startsWith(t)&&i[i.length-1]!=="$":i[i.length-1]!=="$"}const lp="memory",up=()=>{const i=new Map;return{name:lp,getInstance:()=>i,hasItem(t){return i.has(t)},getItem(t){return i.get(t)??null},getItemRaw(t){return i.get(t)??null},setItem(t,e){i.set(t,e)},setItemRaw(t,e){i.set(t,e)},removeItem(t){i.delete(t)},getKeys(){return[...i.keys()]},clear(){i.clear()},dispose(){i.clear()}}};function hp(i={}){const t={mounts:{"":i.driver||up()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},e=u=>{for(const h of t.mountpoints)if(u.startsWith(h))return{base:h,relativeKey:u.slice(h.length),driver:t.mounts[h]};return{base:"",relativeKey:u,driver:t.mounts[""]}},r=(u,h)=>t.mountpoints.filter(d=>d.startsWith(u)||h&&u.startsWith(d)).map(d=>({relativeBase:u.length>d.length?u.slice(d.length):void 0,mountpoint:d,driver:t.mounts[d]})),n=(u,h)=>{if(t.watching){h=ke(h);for(const d of t.watchListeners)d(u,h)}},s=async()=>{if(!t.watching){t.watching=!0;for(const u in t.mounts)t.unwatch[u]=await qo(t.mounts[u],n,u)}},o=async()=>{if(t.watching){for(const u in t.unwatch)await t.unwatch[u]();t.unwatch={},t.watching=!1}},c=(u,h,d)=>{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,R=m||!f.options?h:{...h,...f.options},v=e(y);_(v).items.push({key:y,value:b,relativeKey:v.relativeKey,options:R})}return Promise.all([...p.values()].map(f=>d(f))).then(f=>f.flat())},l={hasItem(u,h={}){u=ke(u);const{relativeKey:d,driver:p}=e(u);return ye(p.hasItem,d,h)},getItem(u,h={}){u=ke(u);const{relativeKey:d,driver:p}=e(u);return ye(p.getItem,d,h).then(_=>br(_))},getItems(u,h={}){return c(u,h,d=>d.driver.getItems?ye(d.driver.getItems,d.items.map(p=>({key:p.relativeKey,options:p.options})),h).then(p=>p.map(_=>({key:op(d.base,_.key),value:br(_.value)}))):Promise.all(d.items.map(p=>ye(d.driver.getItem,p.relativeKey,p.options).then(_=>({key:p.key,value:br(_)})))))},getItemRaw(u,h={}){u=ke(u);const{relativeKey:d,driver:p}=e(u);return p.getItemRaw?ye(p.getItemRaw,d,h):ye(p.getItem,d,h).then(_=>rp(_))},async setItem(u,h,d={}){if(h===void 0)return l.removeItem(u);u=ke(u);const{relativeKey:p,driver:_}=e(u);_.setItem&&(await ye(_.setItem,p,Cr(h),d),_.watch||n("update",u))},async setItems(u,h){await c(u,h,async d=>{if(d.driver.setItems)return ye(d.driver.setItems,d.items.map(p=>({key:p.relativeKey,value:Cr(p.value),options:p.options})),h);d.driver.setItem&&await Promise.all(d.items.map(p=>ye(d.driver.setItem,p.relativeKey,Cr(p.value),p.options)))})},async setItemRaw(u,h,d={}){if(h===void 0)return l.removeItem(u,d);u=ke(u);const{relativeKey:p,driver:_}=e(u);if(_.setItemRaw)await ye(_.setItemRaw,p,h,d);else if(_.setItem)await ye(_.setItem,p,ip(h),d);else return;_.watch||n("update",u)},async removeItem(u,h={}){typeof h=="boolean"&&(h={removeMeta:h}),u=ke(u);const{relativeKey:d,driver:p}=e(u);p.removeItem&&(await ye(p.removeItem,d,h),(h.removeMeta||h.removeMata)&&await ye(p.removeItem,d+"$",h),p.watch||n("remove",u))},async getMeta(u,h={}){typeof h=="boolean"&&(h={nativeOnly:h}),u=ke(u);const{relativeKey:d,driver:p}=e(u),_=Object.create(null);if(p.getMeta&&Object.assign(_,await ye(p.getMeta,d,h)),!h.nativeOnly){const f=await ye(p.getItem,d+"$",h).then(m=>br(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,h,d={}){return this.setItem(u+"$",h,d)},removeMeta(u,h={}){return this.removeItem(u+"$",h)},async getKeys(u,h={}){var y;u=Ar(u);const d=r(u,!0);let p=[];const _=[];let f=!0;for(const b of d){(y=b.driver.flags)!=null&&y.maxDepth||(f=!1);const R=await ye(b.driver.getKeys,b.relativeBase,h);for(const v of R){const P=b.mountpoint+ke(v);p.some(T=>P.startsWith(T))||_.push(P)}p=[b.mountpoint,...p.filter(v=>!v.startsWith(b.mountpoint))]}const m=h.maxDepth!==void 0&&!f;return _.filter(b=>(!m||ap(b,h.maxDepth))&&cp(b,u))},async clear(u,h={}){u=Ar(u),await Promise.all(r(u,!1).map(async d=>{if(d.driver.clear)return ye(d.driver.clear,d.relativeBase,h);if(d.driver.removeItem){const p=await d.driver.getKeys(d.relativeBase||"",h);return Promise.all(p.map(_=>d.driver.removeItem(_,h)))}}))},async dispose(){await Promise.all(Object.values(t.mounts).map(u=>zo(u)))},async watch(u){return await s(),t.watchListeners.push(u),async()=>{t.watchListeners=t.watchListeners.filter(h=>h!==u),t.watchListeners.length===0&&await o()}},async unwatch(){t.watchListeners=[],await o()},mount(u,h){if(u=Ar(u),u&&t.mounts[u])throw new Error(`already mounted at ${u}`);return u&&(t.mountpoints.push(u),t.mountpoints.sort((d,p)=>p.length-d.length)),t.mounts[u]=h,t.watching&&Promise.resolve(qo(h,n,u)).then(d=>{t.unwatch[u]=d}).catch(console.error),l},async unmount(u,h=!0){var d,p;u=Ar(u),!(!u||!t.mounts[u])&&(t.watching&&u in t.unwatch&&((p=(d=t.unwatch)[u])==null||p.call(d),delete t.unwatch[u]),h&&await zo(t.mounts[u]),t.mountpoints=t.mountpoints.filter(_=>_!==u),delete t.mounts[u])},getMount(u=""){u=ke(u)+":";const h=e(u);return{driver:h.driver,base:h.base}},getMounts(u="",h={}){return u=ke(u),r(u,h.parents).map(p=>({driver:p.driver,base:p.mountpoint}))},keys:(u,h={})=>l.getKeys(u,h),get:(u,h={})=>l.getItem(u,h),set:(u,h,d={})=>l.setItem(u,h,d),has:(u,h={})=>l.hasItem(u,h),del:(u,h={})=>l.removeItem(u,h),remove:(u,h={})=>l.removeItem(u,h)};return l}function qo(i,t,e){return i.watch?i.watch((r,n)=>t(r,e+n)):()=>{}}async function zo(i){typeof i.dispose=="function"&&await ye(i.dispose)}const dp="idb-keyval";var pp=(i={})=>{const t=i.base&&i.base.length>0?`${i.base}:`:"",e=n=>t+n;let r;return i.dbName&&i.storeName&&(r=ad(i.dbName,i.storeName)),{name:dp,options:i,async hasItem(n){return!(typeof await Vo(e(n),r)>"u")},async getItem(n){return await Vo(e(n),r)??null},setItem(n,s){return hd(e(n),s,r)},removeItem(n){return ud(e(n),r)},getKeys(){return ld(r)},clear(){return cd(r)}}};const _p="WALLET_CONNECT_V2_INDEXED_DB",fp="keyvaluestorage";let mp=class{constructor(){this.indexedDb=hp({driver:pp({dbName:_p,storeName:fp})})}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,sr(e))}async removeItem(t){await this.indexedDb.removeItem(t)}};var bn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof K<"u"?K:typeof self<"u"?self:{},$r={exports:{}};(function(){let i;function t(){}i=t,i.prototype.getItem=function(e){return this.hasOwnProperty(e)?String(this[e]):null},i.prototype.setItem=function(e,r){this[e]=String(r)},i.prototype.removeItem=function(e){delete this[e]},i.prototype.clear=function(){const e=this;Object.keys(e).forEach(function(r){e[r]=void 0,delete e[r]})},i.prototype.key=function(e){return e=e||0,Object.keys(this)[e]},i.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof bn<"u"&&bn.localStorage?$r.exports=bn.localStorage:typeof window<"u"&&window.localStorage?$r.exports=window.localStorage:$r.exports=new t})();function yp(i){var t;return[i[0],jr((t=i[1])!=null?t:"")]}let wp=class{constructor(){this.localStorage=$r.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(yp)}async getItem(t){const e=this.localStorage.getItem(t);if(e!==null)return jr(e)}async setItem(t,e){this.localStorage.setItem(t,sr(e))}async removeItem(t){this.localStorage.removeItem(t)}};const gp="wc_storage_version",jo=1,Ep=async(i,t,e)=>{const r=gp,n=await t.getItem(r);if(n&&n>=jo){e(t);return}const s=await i.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 i.getItem(c);await t.setItem(c,u),o.push(c)}}await t.setItem(r,jo),e(t),vp(i,o)},vp=async(i,t)=>{t.length&&t.forEach(async e=>{await i.removeItem(e)})};let bp=class{constructor(){this.initialized=!1,this.setInitialized=e=>{this.storage=e,this.initialized=!0};const t=new wp;this.storage=t;try{const e=new mp;Ep(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 In,Ko;function Ip(){if(Ko)return In;Ko=1;function i(e){try{return JSON.stringify(e)}catch{return'"[Circular]"'}}In=t;function t(e,r,n){var s=n&&n.stringify||i,o=1;if(typeof e=="object"&&e!==null){var c=r.length+o;if(c===1)return e;var l=new Array(c);l[0]=s(e);for(var u=1;u<c;u++)l[u]=s(r[u]);return l.join(" ")}if(typeof e!="string")return e;var h=r.length;if(h===0)return e;for(var d="",p=1-o,_=-1,f=e&&e.length||0,m=0;m<f;){if(e.charCodeAt(m)===37&&m+1<f){switch(_=_>-1?_:0,e.charCodeAt(m+1)){case 100:case 102:if(p>=h||r[p]==null)break;_<m&&(d+=e.slice(_,m)),d+=Number(r[p]),_=m+2,m++;break;case 105:if(p>=h||r[p]==null)break;_<m&&(d+=e.slice(_,m)),d+=Math.floor(Number(r[p])),_=m+2,m++;break;case 79:case 111:case 106:if(p>=h||r[p]===void 0)break;_<m&&(d+=e.slice(_,m));var y=typeof r[p];if(y==="string"){d+="'"+r[p]+"'",_=m+2,m++;break}if(y==="function"){d+=r[p].name||"<anonymous>",_=m+2,m++;break}d+=s(r[p]),_=m+2,m++;break;case 115:if(p>=h)break;_<m&&(d+=e.slice(_,m)),d+=String(r[p]),_=m+2,m++;break;case 37:_<m&&(d+=e.slice(_,m)),d+="%",_=m+2,m++,p--;break}++p}++m}return _===-1?e:(_<f&&(d+=e.slice(_)),d)}return In}var An,Fo;function Ap(){if(Fo)return An;Fo=1;const i=Ip();An=n;const t=T().console||{},e={mapHttpRequest:f,mapHttpResponse:f,wrapRequestSerializer:m,wrapResponseSerializer:m,wrapErrorSerializer:m,req:f,res:f,err:p};function r(g,D){return Array.isArray(g)?g.filter(function(w){return w!=="!stdSerializers.err"}):g===!0?Object.keys(D):!1}function n(g){g=g||{},g.browser=g.browser||{};const D=g.browser.transmit;if(D&&typeof D.send!="function")throw Error("pino: transmit option must have a send function");const L=g.browser.write||t;g.browser.write&&(g.browser.asObject=!0);const w=g.serializers||{},E=r(g.browser.serialize,w);let I=g.browser.serialize;Array.isArray(g.browser.serialize)&&g.browser.serialize.indexOf("!stdSerializers.err")>-1&&(I=!1);const A=["error","fatal","warn","info","debug","trace"];typeof L=="function"&&(L.error=L.fatal=L.warn=L.info=L.debug=L.trace=L),g.enabled===!1&&(g.level="silent");const V=g.level||"info",O=Object.create(L);O.log||(O.log=y),Object.defineProperty(O,"levelVal",{get:$}),Object.defineProperty(O,"level",{get:k,set:M});const x={transmit:D,serialize:E,asObject:g.browser.asObject,levels:A,timestamp:_(g)};O.levels=n.levels,O.level=V,O.setMaxListeners=O.getMaxListeners=O.emit=O.addListener=O.on=O.prependListener=O.once=O.prependOnceListener=O.removeListener=O.removeAllListeners=O.listeners=O.listenerCount=O.eventNames=O.write=O.flush=y,O.serializers=w,O._serialize=E,O._stdErrSerialize=I,O.child=C,D&&(O._logEvent=d());function $(){return this.level==="silent"?1/0:this.levels.values[this.level]}function k(){return this._level}function M(U){if(U!=="silent"&&!this.levels.values[U])throw Error("unknown level "+U);this._level=U,s(x,O,"error","log"),s(x,O,"fatal","error"),s(x,O,"warn","error"),s(x,O,"info","log"),s(x,O,"debug","log"),s(x,O,"trace","log")}function C(U,z){if(!U)throw new Error("missing bindings for child Pino");z=z||{},E&&U.serializers&&(z.serializers=U.serializers);const j=z.serializers;if(E&&j){var F=Object.assign({},w,j),W=g.browser.serialize===!0?Object.keys(F):E;delete U.serializers,l([U],W,F,this._stdErrSerialize)}function H(G){this._childLevel=(G._childLevel|0)+1,this.error=u(G,U,"error"),this.fatal=u(G,U,"fatal"),this.warn=u(G,U,"warn"),this.info=u(G,U,"info"),this.debug=u(G,U,"debug"),this.trace=u(G,U,"trace"),F&&(this.serializers=F,this._serialize=W),D&&(this._logEvent=d([].concat(G._logEvent.bindings,U)))}return H.prototype=this,new H(this)}return O}n.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"}},n.stdSerializers=e,n.stdTimeFunctions=Object.assign({},{nullTime:b,epochTime:R,unixTime:v,isoTime:P});function s(g,D,L,w){const E=Object.getPrototypeOf(D);D[L]=D.levelVal>D.levels.values[L]?y:E[L]?E[L]:t[L]||t[w]||y,o(g,D,L)}function o(g,D,L){!g.transmit&&D[L]===y||(D[L]=function(w){return function(){const I=g.timestamp(),A=new Array(arguments.length),V=Object.getPrototypeOf&&Object.getPrototypeOf(this)===t?t:this;for(var O=0;O<A.length;O++)A[O]=arguments[O];if(g.serialize&&!g.asObject&&l(A,this._serialize,this.serializers,this._stdErrSerialize),g.asObject?w.call(V,c(this,L,A,I)):w.apply(V,A),g.transmit){const x=g.transmit.level||D.level,$=n.levels.values[x],k=n.levels.values[L];if(k<$)return;h(this,{ts:I,methodLevel:L,methodValue:k,transmitValue:n.levels.values[g.transmit.level||D.level],send:g.transmit.send,val:D.levelVal},A)}}}(D[L]))}function c(g,D,L,w){g._serialize&&l(L,g._serialize,g.serializers,g._stdErrSerialize);const E=L.slice();let I=E[0];const A={};w&&(A.time=w),A.level=n.levels.values[D];let V=(g._childLevel|0)+1;if(V<1&&(V=1),I!==null&&typeof I=="object"){for(;V--&&typeof E[0]=="object";)Object.assign(A,E.shift());I=E.length?i(E.shift(),E):void 0}else typeof I=="string"&&(I=i(E.shift(),E));return I!==void 0&&(A.msg=I),A}function l(g,D,L,w){for(const E in g)if(w&&g[E]instanceof Error)g[E]=n.stdSerializers.err(g[E]);else if(typeof g[E]=="object"&&!Array.isArray(g[E]))for(const I in g[E])D&&D.indexOf(I)>-1&&I in L&&(g[E][I]=L[I](g[E][I]))}function u(g,D,L){return function(){const w=new Array(1+arguments.length);w[0]=D;for(var E=1;E<w.length;E++)w[E]=arguments[E-1];return g[L].apply(this,w)}}function h(g,D,L){const w=D.send,E=D.ts,I=D.methodLevel,A=D.methodValue,V=D.val,O=g._logEvent.bindings;l(L,g._serialize||Object.keys(g.serializers),g.serializers,g._stdErrSerialize===void 0?!0:g._stdErrSerialize),g._logEvent.ts=E,g._logEvent.messages=L.filter(function(x){return O.indexOf(x)===-1}),g._logEvent.level.label=I,g._logEvent.level.value=A,w(I,g._logEvent,V),g._logEvent=d(O)}function d(g){return{ts:0,messages:[],bindings:g||[],level:{label:"",value:0}}}function p(g){const D={type:g.constructor.name,msg:g.message,stack:g.stack};for(const L in g)D[L]===void 0&&(D[L]=g[L]);return D}function _(g){return typeof g.timestamp=="function"?g.timestamp:g.timestamp===!1?b:R}function f(){return{}}function m(g){return g}function y(){}function b(){return!1}function R(){return Date.now()}function v(){return Math.round(Date.now()/1e3)}function P(){return new Date(Date.now()).toISOString()}function T(){function g(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 g(self)||g(window)||g(this)||{}}}return An}var Ei=Ap();const on=Uh(Ei),Tp={level:"info"},mr="custom_context",Xs=1e3*1024;let Pp=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}},Wo=class{constructor(t){this.head=null,this.tail=null,this.lengthInNodes=0,this.maxSizeInBytes=t,this.sizeInBytes=0}append(t){const e=new Pp(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 fl{constructor(t,e=Xs){this.level=t??"error",this.levelValue=Ei.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=e,this.logs=new Wo(this.MAX_LOG_SIZE_IN_BYTES)}forwardToConsole(t,e){e===Ei.levels.values.error?console.error(t):e===Ei.levels.values.warn?console.warn(t):e===Ei.levels.values.debug?console.debug(t):e===Ei.levels.values.trace?console.trace(t):console.log(t)}appendToLogs(t){this.logs.append(sr({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 Wo(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(t){const e=this.getLogArray();return e.push(sr({extraMetadata:t})),new Blob(e,{type:"application/json"})}}let Op=class{constructor(t,e=Xs){this.baseChunkLogger=new fl(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)),r=document.createElement("a");r.href=e,r.download=`walletconnect-logs-${new Date().toISOString()}.txt`,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(e)}},Rp=class{constructor(t,e=Xs){this.baseChunkLogger=new fl(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 Lp=Object.defineProperty,Dp=Object.defineProperties,Vp=Object.getOwnPropertyDescriptors,Ho=Object.getOwnPropertySymbols,xp=Object.prototype.hasOwnProperty,Sp=Object.prototype.propertyIsEnumerable,Go=(i,t,e)=>t in i?Lp(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Hr=(i,t)=>{for(var e in t||(t={}))xp.call(t,e)&&Go(i,e,t[e]);if(Ho)for(var e of Ho(t))Sp.call(t,e)&&Go(i,e,t[e]);return i},Gr=(i,t)=>Dp(i,Vp(t));function eo(i){return Gr(Hr({},i),{level:(i==null?void 0:i.level)||Tp.level})}function Cp(i,t=mr){return i[t]||""}function $p(i,t,e=mr){return i[e]=t,i}function Ke(i,t=mr){let e="";return typeof i.bindings>"u"?e=Cp(i,t):e=i.bindings().context||"",e}function kp(i,t,e=mr){const r=Ke(i,e);return r.trim()?`${r}/${t}`:t}function Ce(i,t,e=mr){const r=kp(i,t,e),n=i.child({context:r});return $p(n,r,e)}function Up(i){var t,e;const r=new Op((t=i.opts)==null?void 0:t.level,i.maxSizeInBytes);return{logger:on(Gr(Hr({},i.opts),{level:"trace",browser:Gr(Hr({},(e=i.opts)==null?void 0:e.browser),{write:n=>r.write(n)})})),chunkLoggerController:r}}function Np(i){var t;const e=new Rp((t=i.opts)==null?void 0:t.level,i.maxSizeInBytes);return{logger:on(Gr(Hr({},i.opts),{level:"trace"}),e),chunkLoggerController:e}}function Bp(i){return typeof i.loggerOverride<"u"&&typeof i.loggerOverride!="string"?{logger:i.loggerOverride,chunkLoggerController:null}:typeof window<"u"?Up(i):Np(i)}var Mp=Object.defineProperty,qp=(i,t,e)=>t in i?Mp(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Jo=(i,t,e)=>qp(i,typeof t!="symbol"?t+"":t,e);class zp extends Ti{constructor(t){super(),this.opts=t,Jo(this,"protocol","wc"),Jo(this,"version",2)}}var jp=Object.defineProperty,Kp=(i,t,e)=>t in i?jp(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Fp=(i,t,e)=>Kp(i,t+"",e);class Wp extends Ti{constructor(t,e){super(),this.core=t,this.logger=e,Fp(this,"records",new Map)}}class Hp{constructor(t,e){this.logger=t,this.core=e}}class Gp extends Ti{constructor(t,e){super(),this.relayer=t,this.logger=e}}let Jp=class extends Ti{constructor(t){super()}},Yp=class{constructor(t,e,r,n){this.core=t,this.logger=e,this.name=r}},Zp=class extends Ti{constructor(t,e){super(),this.relayer=t,this.logger=e}};class Qp extends Ti{constructor(t,e){super(),this.core=t,this.logger=e}}let Xp=class{constructor(t,e,r){this.core=t,this.logger=e,this.store=r}},e_=class{constructor(t,e){this.projectId=t,this.logger=e}},t_=class{constructor(t,e,r){this.core=t,this.logger=e,this.telemetryEnabled=r}};var i_=Object.defineProperty,r_=(i,t,e)=>t in i?i_(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Yo=(i,t,e)=>r_(i,typeof t!="symbol"?t+"":t,e);let n_=class{constructor(t){this.opts=t,Yo(this,"protocol","wc"),Yo(this,"version",2)}},s_=class{constructor(t){this.client=t}};function or(i,{strict:t=!0}={}){return!i||typeof i!="string"?!1:t?/^0x[0-9a-fA-F]*$/.test(i):i.startsWith("0x")}function ts(i){return or(i,{strict:!1})?Math.ceil((i.length-2)/2):i.length}const ml="2.31.0";let Ci={getDocsUrl:({docsBaseUrl:i,docsPath:t="",docsSlug:e})=>t?`${i??"https://viem.sh"}${t}${e?`#${e}`:""}`:void 0,version:`viem@${ml}`};class oi extends Error{constructor(t,e={}){var c;const r=(()=>{var l;return e.cause instanceof oi?e.cause.details:(l=e.cause)!=null&&l.message?e.cause.message:e.details})(),n=e.cause instanceof oi&&e.cause.docsPath||e.docsPath,s=(c=Ci.getDocsUrl)==null?void 0:c.call(Ci,{...e,docsPath:n}),o=[t||"An error occurred.","",...e.metaMessages?[...e.metaMessages,""]:[],...s?[`Docs: ${s}`]:[],...r?[`Details: ${r}`]:[],...Ci.version?[`Version: ${Ci.version}`]:[]].join(`
3
- `);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=r,this.docsPath=n,this.metaMessages=e.metaMessages,this.name=e.name??this.name,this.shortMessage=t,this.version=ml}walk(t){return yl(this,t)}}function yl(i,t){return t!=null&&t(i)?i:i&&typeof i=="object"&&"cause"in i&&i.cause!==void 0?yl(i.cause,t):t?null:i}class wl extends oi{constructor({size:t,targetSize:e,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (${t}) exceeds padding size (${e}).`,{name:"SizeExceedsPaddingSizeError"})}}function Ri(i,{dir:t,size:e=32}={}){return typeof i=="string"?o_(i,{dir:t,size:e}):a_(i,{dir:t,size:e})}function o_(i,{dir:t,size:e=32}={}){if(e===null)return i;const r=i.replace("0x","");if(r.length>e*2)throw new wl({size:Math.ceil(r.length/2),targetSize:e,type:"hex"});return`0x${r[t==="right"?"padEnd":"padStart"](e*2,"0")}`}function a_(i,{dir:t,size:e=32}={}){if(e===null)return i;if(i.length>e)throw new wl({size:i.length,targetSize:e,type:"bytes"});const r=new Uint8Array(e);for(let n=0;n<e;n++){const s=t==="right";r[s?n:e-n-1]=i[s?n:i.length-n-1]}return r}class c_ extends oi{constructor({max:t,min:e,signed:r,size:n,value:s}){super(`Number "${s}" is not in safe ${n?`${n*8}-bit ${r?"signed":"unsigned"} `:""}integer range ${t?`(${e} to ${t})`:`(above ${e})`}`,{name:"IntegerOutOfRangeError"})}}class l_ extends oi{constructor({givenSize:t,maxSize:e}){super(`Size cannot exceed ${e} bytes. Given size: ${t} bytes.`,{name:"SizeOverflowError"})}}function Li(i,{size:t}){if(ts(i)>t)throw new l_({givenSize:ts(i),maxSize:t})}function is(i,t={}){const{signed:e}=t;t.size&&Li(i,{size:t.size});const r=BigInt(i);if(!e)return r;const n=(i.length-2)/2,s=(1n<<BigInt(n)*8n-1n)-1n;return r<=s?r:r-BigInt(`0x${"f".padStart(n*2,"f")}`)-1n}function u_(i,t={}){return Number(is(i,t))}const h_=Array.from({length:256},(i,t)=>t.toString(16).padStart(2,"0"));function rs(i,t={}){return typeof i=="number"||typeof i=="bigint"?El(i,t):typeof i=="string"?__(i,t):typeof i=="boolean"?d_(i,t):gl(i,t)}function d_(i,t={}){const e=`0x${Number(i)}`;return typeof t.size=="number"?(Li(e,{size:t.size}),Ri(e,{size:t.size})):e}function gl(i,t={}){let e="";for(let n=0;n<i.length;n++)e+=h_[i[n]];const r=`0x${e}`;return typeof t.size=="number"?(Li(r,{size:t.size}),Ri(r,{dir:"right",size:t.size})):r}function El(i,t={}){const{signed:e,size:r}=t,n=BigInt(i);let s;r?e?s=(1n<<BigInt(r)*8n-1n)-1n:s=2n**(BigInt(r)*8n)-1n:typeof i=="number"&&(s=BigInt(Number.MAX_SAFE_INTEGER));const o=typeof s=="bigint"&&e?-s-1n:0;if(s&&n>s||n<o){const l=typeof i=="bigint"?"n":"";throw new c_({max:s?`${s}${l}`:void 0,min:`${o}${l}`,signed:e,size:r,value:`${i}${l}`})}const c=`0x${(e&&n<0?(1n<<BigInt(r*8))+BigInt(n):n).toString(16)}`;return r?Ri(c,{size:r}):c}const p_=new TextEncoder;function __(i,t={}){const e=p_.encode(i);return gl(e,t)}const f_=new TextEncoder;function m_(i,t={}){return typeof i=="number"||typeof i=="bigint"?w_(i,t):typeof i=="boolean"?y_(i,t):or(i)?vl(i,t):bl(i,t)}function y_(i,t={}){const e=new Uint8Array(1);return e[0]=Number(i),typeof t.size=="number"?(Li(e,{size:t.size}),Ri(e,{size:t.size})):e}const Et={zero:48,nine:57,A:65,F:70,a:97,f:102};function Zo(i){if(i>=Et.zero&&i<=Et.nine)return i-Et.zero;if(i>=Et.A&&i<=Et.F)return i-(Et.A-10);if(i>=Et.a&&i<=Et.f)return i-(Et.a-10)}function vl(i,t={}){let e=i;t.size&&(Li(e,{size:t.size}),e=Ri(e,{dir:"right",size:t.size}));let r=e.slice(2);r.length%2&&(r=`0${r}`);const n=r.length/2,s=new Uint8Array(n);for(let o=0,c=0;o<n;o++){const l=Zo(r.charCodeAt(c++)),u=Zo(r.charCodeAt(c++));if(l===void 0||u===void 0)throw new oi(`Invalid byte sequence ("${r[c-2]}${r[c-1]}" in "${r}").`);s[o]=l*16+u}return s}function w_(i,t){const e=El(i,t);return vl(e)}function bl(i,t={}){const e=f_.encode(i);return typeof t.size=="number"?(Li(e,{size:t.size}),Ri(e,{dir:"right",size:t.size})):e}const Tr=BigInt(2**32-1),Qo=BigInt(32);function g_(i,t=!1){return t?{h:Number(i&Tr),l:Number(i>>Qo&Tr)}:{h:Number(i>>Qo&Tr)|0,l:Number(i&Tr)|0}}function E_(i,t=!1){const e=i.length;let r=new Uint32Array(e),n=new Uint32Array(e);for(let s=0;s<e;s++){const{h:o,l:c}=g_(i[s],t);[r[s],n[s]]=[o,c]}return[r,n]}const v_=(i,t,e)=>i<<e|t>>>32-e,b_=(i,t,e)=>t<<e|i>>>32-e,I_=(i,t,e)=>t<<e-32|i>>>64-e,A_=(i,t,e)=>i<<e-32|t>>>64-e,_i=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function T_(i){return i instanceof Uint8Array||ArrayBuffer.isView(i)&&i.constructor.name==="Uint8Array"}function Jr(i){if(!Number.isSafeInteger(i)||i<0)throw new Error("positive integer expected, got "+i)}function ar(i,...t){if(!T_(i))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(i.length))throw new Error("Uint8Array expected of length "+t+", got length="+i.length)}function vA(i){if(typeof i!="function"||typeof i.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");Jr(i.outputLen),Jr(i.blockLen)}function Xo(i,t=!0){if(i.destroyed)throw new Error("Hash instance has been destroyed");if(t&&i.finished)throw new Error("Hash#digest() has already been called")}function P_(i,t){ar(i);const e=t.outputLen;if(i.length<e)throw new Error("digestInto() expects output buffer of length at least "+e)}function O_(i){return new Uint32Array(i.buffer,i.byteOffset,Math.floor(i.byteLength/4))}function Il(...i){for(let t=0;t<i.length;t++)i[t].fill(0)}function bA(i){return new DataView(i.buffer,i.byteOffset,i.byteLength)}function IA(i,t){return i<<32-t|i>>>t}const R_=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function L_(i){return i<<24&4278190080|i<<8&16711680|i>>>8&65280|i>>>24&255}function D_(i){for(let t=0;t<i.length;t++)i[t]=L_(i[t]);return i}const ea=R_?i=>i:D_;function V_(i){if(typeof i!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(i))}function Al(i){return typeof i=="string"&&(i=V_(i)),ar(i),i}function AA(...i){let t=0;for(let r=0;r<i.length;r++){const n=i[r];ar(n),t+=n.length}const e=new Uint8Array(t);for(let r=0,n=0;r<i.length;r++){const s=i[r];e.set(s,n),n+=s.length}return e}class x_{}function S_(i){const t=r=>i().update(Al(r)).digest(),e=i();return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=()=>i(),t}function TA(i=32){if(_i&&typeof _i.getRandomValues=="function")return _i.getRandomValues(new Uint8Array(i));if(_i&&typeof _i.randomBytes=="function")return Uint8Array.from(_i.randomBytes(i));throw new Error("crypto.getRandomValues must be defined")}const C_=BigInt(0),$i=BigInt(1),$_=BigInt(2),k_=BigInt(7),U_=BigInt(256),N_=BigInt(113),Tl=[],Pl=[],Ol=[];for(let i=0,t=$i,e=1,r=0;i<24;i++){[e,r]=[r,(2*e+3*r)%5],Tl.push(2*(5*r+e)),Pl.push((i+1)*(i+2)/2%64);let n=C_;for(let s=0;s<7;s++)t=(t<<$i^(t>>k_)*N_)%U_,t&$_&&(n^=$i<<($i<<BigInt(s))-$i);Ol.push(n)}const Rl=E_(Ol,!0),B_=Rl[0],M_=Rl[1],ta=(i,t,e)=>e>32?I_(i,t,e):v_(i,t,e),ia=(i,t,e)=>e>32?A_(i,t,e):b_(i,t,e);function q_(i,t=24){const e=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let o=0;o<10;o++)e[o]=i[o]^i[o+10]^i[o+20]^i[o+30]^i[o+40];for(let o=0;o<10;o+=2){const c=(o+8)%10,l=(o+2)%10,u=e[l],h=e[l+1],d=ta(u,h,1)^e[c],p=ia(u,h,1)^e[c+1];for(let _=0;_<50;_+=10)i[o+_]^=d,i[o+_+1]^=p}let n=i[2],s=i[3];for(let o=0;o<24;o++){const c=Pl[o],l=ta(n,s,c),u=ia(n,s,c),h=Tl[o];n=i[h],s=i[h+1],i[h]=l,i[h+1]=u}for(let o=0;o<50;o+=10){for(let c=0;c<10;c++)e[c]=i[o+c];for(let c=0;c<10;c++)i[o+c]^=~e[(c+2)%10]&e[(c+4)%10]}i[0]^=B_[r],i[1]^=M_[r]}Il(e)}class to extends x_{constructor(t,e,r,n=!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=r,this.enableXOF=n,this.rounds=s,Jr(r),!(0<t&&t<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=O_(this.state)}clone(){return this._cloneInto()}keccak(){ea(this.state32),q_(this.state32,this.rounds),ea(this.state32),this.posOut=0,this.pos=0}update(t){Xo(this),t=Al(t),ar(t);const{blockLen:e,state:r}=this,n=t.length;for(let s=0;s<n;){const o=Math.min(e-this.pos,n-s);for(let c=0;c<o;c++)r[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:r,blockLen:n}=this;t[r]^=e,e&128&&r===n-1&&this.keccak(),t[n-1]^=128,this.keccak()}writeInto(t){Xo(this,!1),ar(t),this.finish();const e=this.state,{blockLen:r}=this;for(let n=0,s=t.length;n<s;){this.posOut>=r&&this.keccak();const o=Math.min(r-this.posOut,s-n);t.set(e.subarray(this.posOut,this.posOut+o),n),this.posOut+=o,n+=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 Jr(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(P_(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,Il(this.state)}_cloneInto(t){const{blockLen:e,suffix:r,outputLen:n,rounds:s,enableXOF:o}=this;return t||(t=new to(e,r,n,o,s)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=s,t.suffix=r,t.outputLen=n,t.enableXOF=o,t.destroyed=this.destroyed,t}}const z_=(i,t,e)=>S_(()=>new to(t,i,e)),j_=z_(1,136,256/8);function Ll(i,t){const e=t||"hex",r=j_(or(i,{strict:!1})?m_(i):i);return e==="bytes"?r:rs(r)}class K_ 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 r=this.keys().next().value;r&&this.delete(r)}return this}}const Tn=new K_(8192);function F_(i,t){if(Tn.has(`${i}.${t}`))return Tn.get(`${i}.${t}`);const e=i.substring(2).toLowerCase(),r=Ll(bl(e),"bytes"),n=e.split("");for(let o=0;o<40;o+=2)r[o>>1]>>4>=8&&n[o]&&(n[o]=n[o].toUpperCase()),(r[o>>1]&15)>=8&&n[o+1]&&(n[o+1]=n[o+1].toUpperCase());const s=`0x${n.join("")}`;return Tn.set(`${i}.${t}`,s),s}function W_(i){const t=Ll(`0x${i.substring(4)}`).substring(26);return F_(`0x${t}`)}async function H_({hash:i,signature:t}){const e=or(i)?i:rs(i),{secp256k1:r}=await a(async()=>{const{secp256k1:o}=await import("./secp256k1-GERMcQ1g.js");return{secp256k1:o}},__vite__mapDeps([22,1,2,3,4,5,6,7,8,9,10]));return`0x${(()=>{if(typeof t=="object"&&"r"in t&&"s"in t){const{r:u,s:h,v:d,yParity:p}=t,_=Number(p??d),f=ra(_);return new r.Signature(is(u),is(h)).addRecoveryBit(f)}const o=or(t)?t:rs(t);if(ts(o)!==65)throw new Error("invalid signature length");const c=u_(`0x${o.slice(130)}`),l=ra(c);return r.Signature.fromCompact(o.substring(2,130)).addRecoveryBit(l)})().recoverPublicKey(e.substring(2)).toHex(!1)}`}function ra(i){if(i===0||i===1)return i;if(i===27)return 0;if(i===28)return 1;throw new Error("Invalid yParityOrV value")}async function G_({hash:i,signature:t}){return W_(await H_({hash:i,signature:t}))}function J_(i){const t=i.length;let e=0,r=0;for(;r<t;){let n=i.charCodeAt(r++);if(n&4294967168)if(!(n&4294965248))e+=2;else{if(n>=55296&&n<=56319&&r<t){const s=i.charCodeAt(r);(s&64512)===56320&&(++r,n=((n&1023)<<10)+(s&1023)+65536)}n&4294901760?e+=4:e+=3}else{e++;continue}}return e}function Y_(i,t,e){const r=i.length;let n=e,s=0;for(;s<r;){let o=i.charCodeAt(s++);if(o&4294967168)if(!(o&4294965248))t[n++]=o>>6&31|192;else{if(o>=55296&&o<=56319&&s<r){const c=i.charCodeAt(s);(c&64512)===56320&&(++s,o=((o&1023)<<10)+(c&1023)+65536)}o&4294901760?(t[n++]=o>>18&7|240,t[n++]=o>>12&63|128,t[n++]=o>>6&63|128):(t[n++]=o>>12&15|224,t[n++]=o>>6&63|128)}else{t[n++]=o;continue}t[n++]=o&63|128}}const Z_=new TextEncoder,Q_=50;function X_(i,t,e){Z_.encodeInto(i,t.subarray(e))}function ef(i,t,e){i.length>Q_?X_(i,t,e):Y_(i,t,e)}const tf=4096;function Dl(i,t,e){let r=t;const n=r+e,s=[];let o="";for(;r<n;){const c=i[r++];if(!(c&128))s.push(c);else if((c&224)===192){const l=i[r++]&63;s.push((c&31)<<6|l)}else if((c&240)===224){const l=i[r++]&63,u=i[r++]&63;s.push((c&31)<<12|l<<6|u)}else if((c&248)===240){const l=i[r++]&63,u=i[r++]&63,h=i[r++]&63;let d=(c&7)<<18|l<<12|u<<6|h;d>65535&&(d-=65536,s.push(d>>>10&1023|55296),d=56320|d&1023),s.push(d)}else s.push(c);s.length>=tf&&(o+=String.fromCharCode(...s),s.length=0)}return s.length>0&&(o+=String.fromCharCode(...s)),o}const rf=new TextDecoder,nf=200;function sf(i,t,e){const r=i.subarray(t,t+e);return rf.decode(r)}function of(i,t,e){return e>nf?sf(i,t,e):Dl(i,t,e)}class Pr{constructor(t,e){this.type=t,this.data=e}}class He extends Error{constructor(t){super(t);const e=Object.create(He.prototype);Object.setPrototypeOf(this,e),Object.defineProperty(this,"name",{configurable:!0,enumerable:!1,value:He.name})}}const ki=4294967295;function af(i,t,e){const r=e/4294967296,n=e;i.setUint32(t,r),i.setUint32(t+4,n)}function Vl(i,t,e){const r=Math.floor(e/4294967296),n=e;i.setUint32(t,r),i.setUint32(t+4,n)}function xl(i,t){const e=i.getInt32(t),r=i.getUint32(t+4);return e*4294967296+r}function cf(i,t){const e=i.getUint32(t),r=i.getUint32(t+4);return e*4294967296+r}const lf=-1,uf=4294967296-1,hf=17179869184-1;function df({sec:i,nsec:t}){if(i>=0&&t>=0&&i<=hf)if(t===0&&i<=uf){const e=new Uint8Array(4);return new DataView(e.buffer).setUint32(0,i),e}else{const e=i/4294967296,r=i&4294967295,n=new Uint8Array(8),s=new DataView(n.buffer);return s.setUint32(0,t<<2|e&3),s.setUint32(4,r),n}else{const e=new Uint8Array(12),r=new DataView(e.buffer);return r.setUint32(0,t),Vl(r,4,i),e}}function pf(i){const t=i.getTime(),e=Math.floor(t/1e3),r=(t-e*1e3)*1e6,n=Math.floor(r/1e9);return{sec:e+n,nsec:r-n*1e9}}function _f(i){if(i instanceof Date){const t=pf(i);return df(t)}else return null}function ff(i){const t=new DataView(i.buffer,i.byteOffset,i.byteLength);switch(i.byteLength){case 4:return{sec:t.getUint32(0),nsec:0};case 8:{const e=t.getUint32(0),r=t.getUint32(4),n=(e&3)*4294967296+r,s=e>>>2;return{sec:n,nsec:s}}case 12:{const e=xl(t,4),r=t.getUint32(0);return{sec:e,nsec:r}}default:throw new He(`Unrecognized data size for timestamp (expected 4, 8, or 12): ${i.length}`)}}function mf(i){const t=ff(i);return new Date(t.sec*1e3+t.nsec/1e6)}const yf={type:lf,encode:_f,decode:mf};class Yr{constructor(){this.builtInEncoders=[],this.builtInDecoders=[],this.encoders=[],this.decoders=[],this.register(yf)}register({type:t,encode:e,decode:r}){if(t>=0)this.encoders[t]=e,this.decoders[t]=r;else{const n=-1-t;this.builtInEncoders[n]=e,this.builtInDecoders[n]=r}}tryToEncode(t,e){for(let r=0;r<this.builtInEncoders.length;r++){const n=this.builtInEncoders[r];if(n!=null){const s=n(t,e);if(s!=null){const o=-1-r;return new Pr(o,s)}}}for(let r=0;r<this.encoders.length;r++){const n=this.encoders[r];if(n!=null){const s=n(t,e);if(s!=null){const o=r;return new Pr(o,s)}}}return t instanceof Pr?t:null}decode(t,e,r){const n=e<0?this.builtInDecoders[-1-e]:this.decoders[e];return n?n(t,e,r):new Pr(e,t)}}Yr.defaultCodec=new Yr;function wf(i){return i instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&i instanceof SharedArrayBuffer}function ns(i){return i instanceof Uint8Array?i:ArrayBuffer.isView(i)?new Uint8Array(i.buffer,i.byteOffset,i.byteLength):wf(i)?new Uint8Array(i):Uint8Array.from(i)}const gf=100,Ef=2048;class io{constructor(t){this.entered=!1,this.extensionCodec=(t==null?void 0:t.extensionCodec)??Yr.defaultCodec,this.context=t==null?void 0:t.context,this.useBigInt64=(t==null?void 0:t.useBigInt64)??!1,this.maxDepth=(t==null?void 0:t.maxDepth)??gf,this.initialBufferSize=(t==null?void 0:t.initialBufferSize)??Ef,this.sortKeys=(t==null?void 0:t.sortKeys)??!1,this.forceFloat32=(t==null?void 0:t.forceFloat32)??!1,this.ignoreUndefined=(t==null?void 0:t.ignoreUndefined)??!1,this.forceIntegerToFloat=(t==null?void 0:t.forceIntegerToFloat)??!1,this.pos=0,this.view=new DataView(new ArrayBuffer(this.initialBufferSize)),this.bytes=new Uint8Array(this.view.buffer)}clone(){return new io({extensionCodec:this.extensionCodec,context:this.context,useBigInt64:this.useBigInt64,maxDepth:this.maxDepth,initialBufferSize:this.initialBufferSize,sortKeys:this.sortKeys,forceFloat32:this.forceFloat32,ignoreUndefined:this.ignoreUndefined,forceIntegerToFloat:this.forceIntegerToFloat})}reinitializeState(){this.pos=0}encodeSharedRef(t){if(this.entered)return this.clone().encodeSharedRef(t);try{return this.entered=!0,this.reinitializeState(),this.doEncode(t,1),this.bytes.subarray(0,this.pos)}finally{this.entered=!1}}encode(t){if(this.entered)return this.clone().encode(t);try{return this.entered=!0,this.reinitializeState(),this.doEncode(t,1),this.bytes.slice(0,this.pos)}finally{this.entered=!1}}doEncode(t,e){if(e>this.maxDepth)throw new Error(`Too deep objects in depth ${e}`);t==null?this.encodeNil():typeof t=="boolean"?this.encodeBoolean(t):typeof t=="number"?this.forceIntegerToFloat?this.encodeNumberAsFloat(t):this.encodeNumber(t):typeof t=="string"?this.encodeString(t):this.useBigInt64&&typeof t=="bigint"?this.encodeBigInt64(t):this.encodeObject(t,e)}ensureBufferSizeToWrite(t){const e=this.pos+t;this.view.byteLength<e&&this.resizeBuffer(e*2)}resizeBuffer(t){const e=new ArrayBuffer(t),r=new Uint8Array(e),n=new DataView(e);r.set(this.bytes),this.view=n,this.bytes=r}encodeNil(){this.writeU8(192)}encodeBoolean(t){t===!1?this.writeU8(194):this.writeU8(195)}encodeNumber(t){!this.forceIntegerToFloat&&Number.isSafeInteger(t)?t>=0?t<128?this.writeU8(t):t<256?(this.writeU8(204),this.writeU8(t)):t<65536?(this.writeU8(205),this.writeU16(t)):t<4294967296?(this.writeU8(206),this.writeU32(t)):this.useBigInt64?this.encodeNumberAsFloat(t):(this.writeU8(207),this.writeU64(t)):t>=-32?this.writeU8(224|t+32):t>=-128?(this.writeU8(208),this.writeI8(t)):t>=-32768?(this.writeU8(209),this.writeI16(t)):t>=-2147483648?(this.writeU8(210),this.writeI32(t)):this.useBigInt64?this.encodeNumberAsFloat(t):(this.writeU8(211),this.writeI64(t)):this.encodeNumberAsFloat(t)}encodeNumberAsFloat(t){this.forceFloat32?(this.writeU8(202),this.writeF32(t)):(this.writeU8(203),this.writeF64(t))}encodeBigInt64(t){t>=BigInt(0)?(this.writeU8(207),this.writeBigUint64(t)):(this.writeU8(211),this.writeBigInt64(t))}writeStringHeader(t){if(t<32)this.writeU8(160+t);else if(t<256)this.writeU8(217),this.writeU8(t);else if(t<65536)this.writeU8(218),this.writeU16(t);else if(t<4294967296)this.writeU8(219),this.writeU32(t);else throw new Error(`Too long string: ${t} bytes in UTF-8`)}encodeString(t){const r=J_(t);this.ensureBufferSizeToWrite(5+r),this.writeStringHeader(r),ef(t,this.bytes,this.pos),this.pos+=r}encodeObject(t,e){const r=this.extensionCodec.tryToEncode(t,this.context);if(r!=null)this.encodeExtension(r);else if(Array.isArray(t))this.encodeArray(t,e);else if(ArrayBuffer.isView(t))this.encodeBinary(t);else if(typeof t=="object")this.encodeMap(t,e);else throw new Error(`Unrecognized object: ${Object.prototype.toString.apply(t)}`)}encodeBinary(t){const e=t.byteLength;if(e<256)this.writeU8(196),this.writeU8(e);else if(e<65536)this.writeU8(197),this.writeU16(e);else if(e<4294967296)this.writeU8(198),this.writeU32(e);else throw new Error(`Too large binary: ${e}`);const r=ns(t);this.writeU8a(r)}encodeArray(t,e){const r=t.length;if(r<16)this.writeU8(144+r);else if(r<65536)this.writeU8(220),this.writeU16(r);else if(r<4294967296)this.writeU8(221),this.writeU32(r);else throw new Error(`Too large array: ${r}`);for(const n of t)this.doEncode(n,e+1)}countWithoutUndefined(t,e){let r=0;for(const n of e)t[n]!==void 0&&r++;return r}encodeMap(t,e){const r=Object.keys(t);this.sortKeys&&r.sort();const n=this.ignoreUndefined?this.countWithoutUndefined(t,r):r.length;if(n<16)this.writeU8(128+n);else if(n<65536)this.writeU8(222),this.writeU16(n);else if(n<4294967296)this.writeU8(223),this.writeU32(n);else throw new Error(`Too large map object: ${n}`);for(const s of r){const o=t[s];this.ignoreUndefined&&o===void 0||(this.encodeString(s),this.doEncode(o,e+1))}}encodeExtension(t){if(typeof t.data=="function"){const r=t.data(this.pos+6),n=r.length;if(n>=4294967296)throw new Error(`Too large extension object: ${n}`);this.writeU8(201),this.writeU32(n),this.writeI8(t.type),this.writeU8a(r);return}const e=t.data.length;if(e===1)this.writeU8(212);else if(e===2)this.writeU8(213);else if(e===4)this.writeU8(214);else if(e===8)this.writeU8(215);else if(e===16)this.writeU8(216);else if(e<256)this.writeU8(199),this.writeU8(e);else if(e<65536)this.writeU8(200),this.writeU16(e);else if(e<4294967296)this.writeU8(201),this.writeU32(e);else throw new Error(`Too large extension object: ${e}`);this.writeI8(t.type),this.writeU8a(t.data)}writeU8(t){this.ensureBufferSizeToWrite(1),this.view.setUint8(this.pos,t),this.pos++}writeU8a(t){const e=t.length;this.ensureBufferSizeToWrite(e),this.bytes.set(t,this.pos),this.pos+=e}writeI8(t){this.ensureBufferSizeToWrite(1),this.view.setInt8(this.pos,t),this.pos++}writeU16(t){this.ensureBufferSizeToWrite(2),this.view.setUint16(this.pos,t),this.pos+=2}writeI16(t){this.ensureBufferSizeToWrite(2),this.view.setInt16(this.pos,t),this.pos+=2}writeU32(t){this.ensureBufferSizeToWrite(4),this.view.setUint32(this.pos,t),this.pos+=4}writeI32(t){this.ensureBufferSizeToWrite(4),this.view.setInt32(this.pos,t),this.pos+=4}writeF32(t){this.ensureBufferSizeToWrite(4),this.view.setFloat32(this.pos,t),this.pos+=4}writeF64(t){this.ensureBufferSizeToWrite(8),this.view.setFloat64(this.pos,t),this.pos+=8}writeU64(t){this.ensureBufferSizeToWrite(8),af(this.view,this.pos,t),this.pos+=8}writeI64(t){this.ensureBufferSizeToWrite(8),Vl(this.view,this.pos,t),this.pos+=8}writeBigUint64(t){this.ensureBufferSizeToWrite(8),this.view.setBigUint64(this.pos,t),this.pos+=8}writeBigInt64(t){this.ensureBufferSizeToWrite(8),this.view.setBigInt64(this.pos,t),this.pos+=8}}function vf(i,t){return new io(t).encodeSharedRef(i)}function Pn(i){return`${i<0?"-":""}0x${Math.abs(i).toString(16).padStart(2,"0")}`}const bf=16,If=16;class Af{constructor(t=bf,e=If){this.hit=0,this.miss=0,this.maxKeyLength=t,this.maxLengthPerKey=e,this.caches=[];for(let r=0;r<this.maxKeyLength;r++)this.caches.push([])}canBeCached(t){return t>0&&t<=this.maxKeyLength}find(t,e,r){const n=this.caches[r-1];e:for(const s of n){const o=s.bytes;for(let c=0;c<r;c++)if(o[c]!==t[e+c])continue e;return s.str}return null}store(t,e){const r=this.caches[t.length-1],n={bytes:t,str:e};r.length>=this.maxLengthPerKey?r[Math.random()*r.length|0]=n:r.push(n)}decode(t,e,r){const n=this.find(t,e,r);if(n!=null)return this.hit++,n;this.miss++;const s=Dl(t,e,r),o=Uint8Array.prototype.slice.call(t,e,e+r);return this.store(o,s),s}}const ss="array",Zi="map_key",Sl="map_value",Tf=i=>{if(typeof i=="string"||typeof i=="number")return i;throw new He("The type of key must be string or number but "+typeof i)};class Pf{constructor(){this.stack=[],this.stackHeadPosition=-1}get length(){return this.stackHeadPosition+1}top(){return this.stack[this.stackHeadPosition]}pushArrayState(t){const e=this.getUninitializedStateFromPool();e.type=ss,e.position=0,e.size=t,e.array=new Array(t)}pushMapState(t){const e=this.getUninitializedStateFromPool();e.type=Zi,e.readCount=0,e.size=t,e.map={}}getUninitializedStateFromPool(){if(this.stackHeadPosition++,this.stackHeadPosition===this.stack.length){const t={type:void 0,size:0,array:void 0,position:0,readCount:0,map:void 0,key:null};this.stack.push(t)}return this.stack[this.stackHeadPosition]}release(t){if(this.stack[this.stackHeadPosition]!==t)throw new Error("Invalid stack state. Released state is not on top of the stack.");if(t.type===ss){const r=t;r.size=0,r.array=void 0,r.position=0,r.type=void 0}if(t.type===Zi||t.type===Sl){const r=t;r.size=0,r.map=void 0,r.readCount=0,r.type=void 0}this.stackHeadPosition--}reset(){this.stack.length=0,this.stackHeadPosition=-1}}const Ui=-1,ro=new DataView(new ArrayBuffer(0)),Of=new Uint8Array(ro.buffer);try{ro.getInt8(0)}catch(i){if(!(i instanceof RangeError))throw new Error("This module is not supported in the current JavaScript engine because DataView does not throw RangeError on out-of-bounds access")}const na=new RangeError("Insufficient data"),Rf=new Af;class no{constructor(t){this.totalPos=0,this.pos=0,this.view=ro,this.bytes=Of,this.headByte=Ui,this.stack=new Pf,this.entered=!1,this.extensionCodec=(t==null?void 0:t.extensionCodec)??Yr.defaultCodec,this.context=t==null?void 0:t.context,this.useBigInt64=(t==null?void 0:t.useBigInt64)??!1,this.rawStrings=(t==null?void 0:t.rawStrings)??!1,this.maxStrLength=(t==null?void 0:t.maxStrLength)??ki,this.maxBinLength=(t==null?void 0:t.maxBinLength)??ki,this.maxArrayLength=(t==null?void 0:t.maxArrayLength)??ki,this.maxMapLength=(t==null?void 0:t.maxMapLength)??ki,this.maxExtLength=(t==null?void 0:t.maxExtLength)??ki,this.keyDecoder=(t==null?void 0:t.keyDecoder)!==void 0?t.keyDecoder:Rf,this.mapKeyConverter=(t==null?void 0:t.mapKeyConverter)??Tf}clone(){return new no({extensionCodec:this.extensionCodec,context:this.context,useBigInt64:this.useBigInt64,rawStrings:this.rawStrings,maxStrLength:this.maxStrLength,maxBinLength:this.maxBinLength,maxArrayLength:this.maxArrayLength,maxMapLength:this.maxMapLength,maxExtLength:this.maxExtLength,keyDecoder:this.keyDecoder})}reinitializeState(){this.totalPos=0,this.headByte=Ui,this.stack.reset()}setBuffer(t){const e=ns(t);this.bytes=e,this.view=new DataView(e.buffer,e.byteOffset,e.byteLength),this.pos=0}appendBuffer(t){if(this.headByte===Ui&&!this.hasRemaining(1))this.setBuffer(t);else{const e=this.bytes.subarray(this.pos),r=ns(t),n=new Uint8Array(e.length+r.length);n.set(e),n.set(r,e.length),this.setBuffer(n)}}hasRemaining(t){return this.view.byteLength-this.pos>=t}createExtraByteError(t){const{view:e,pos:r}=this;return new RangeError(`Extra ${e.byteLength-r} of ${e.byteLength} byte(s) found at buffer[${t}]`)}decode(t){if(this.entered)return this.clone().decode(t);try{this.entered=!0,this.reinitializeState(),this.setBuffer(t);const e=this.doDecodeSync();if(this.hasRemaining(1))throw this.createExtraByteError(this.pos);return e}finally{this.entered=!1}}*decodeMulti(t){if(this.entered){yield*this.clone().decodeMulti(t);return}try{for(this.entered=!0,this.reinitializeState(),this.setBuffer(t);this.hasRemaining(1);)yield this.doDecodeSync()}finally{this.entered=!1}}async decodeAsync(t){if(this.entered)return this.clone().decodeAsync(t);try{this.entered=!0;let e=!1,r;for await(const c of t){if(e)throw this.entered=!1,this.createExtraByteError(this.totalPos);this.appendBuffer(c);try{r=this.doDecodeSync(),e=!0}catch(l){if(!(l instanceof RangeError))throw l}this.totalPos+=this.pos}if(e){if(this.hasRemaining(1))throw this.createExtraByteError(this.totalPos);return r}const{headByte:n,pos:s,totalPos:o}=this;throw new RangeError(`Insufficient data in parsing ${Pn(n)} at ${o} (${s} in the current buffer)`)}finally{this.entered=!1}}decodeArrayStream(t){return this.decodeMultiAsync(t,!0)}decodeStream(t){return this.decodeMultiAsync(t,!1)}async*decodeMultiAsync(t,e){if(this.entered){yield*this.clone().decodeMultiAsync(t,e);return}try{this.entered=!0;let r=e,n=-1;for await(const s of t){if(e&&n===0)throw this.createExtraByteError(this.totalPos);this.appendBuffer(s),r&&(n=this.readArraySize(),r=!1,this.complete());try{for(;yield this.doDecodeSync(),--n!==0;);}catch(o){if(!(o instanceof RangeError))throw o}this.totalPos+=this.pos}}finally{this.entered=!1}}doDecodeSync(){e:for(;;){const t=this.readHeadByte();let e;if(t>=224)e=t-256;else if(t<192)if(t<128)e=t;else if(t<144){const n=t-128;if(n!==0){this.pushMapState(n),this.complete();continue e}else e={}}else if(t<160){const n=t-144;if(n!==0){this.pushArrayState(n),this.complete();continue e}else e=[]}else{const n=t-160;e=this.decodeString(n,0)}else if(t===192)e=null;else if(t===194)e=!1;else if(t===195)e=!0;else if(t===202)e=this.readF32();else if(t===203)e=this.readF64();else if(t===204)e=this.readU8();else if(t===205)e=this.readU16();else if(t===206)e=this.readU32();else if(t===207)this.useBigInt64?e=this.readU64AsBigInt():e=this.readU64();else if(t===208)e=this.readI8();else if(t===209)e=this.readI16();else if(t===210)e=this.readI32();else if(t===211)this.useBigInt64?e=this.readI64AsBigInt():e=this.readI64();else if(t===217){const n=this.lookU8();e=this.decodeString(n,1)}else if(t===218){const n=this.lookU16();e=this.decodeString(n,2)}else if(t===219){const n=this.lookU32();e=this.decodeString(n,4)}else if(t===220){const n=this.readU16();if(n!==0){this.pushArrayState(n),this.complete();continue e}else e=[]}else if(t===221){const n=this.readU32();if(n!==0){this.pushArrayState(n),this.complete();continue e}else e=[]}else if(t===222){const n=this.readU16();if(n!==0){this.pushMapState(n),this.complete();continue e}else e={}}else if(t===223){const n=this.readU32();if(n!==0){this.pushMapState(n),this.complete();continue e}else e={}}else if(t===196){const n=this.lookU8();e=this.decodeBinary(n,1)}else if(t===197){const n=this.lookU16();e=this.decodeBinary(n,2)}else if(t===198){const n=this.lookU32();e=this.decodeBinary(n,4)}else if(t===212)e=this.decodeExtension(1,0);else if(t===213)e=this.decodeExtension(2,0);else if(t===214)e=this.decodeExtension(4,0);else if(t===215)e=this.decodeExtension(8,0);else if(t===216)e=this.decodeExtension(16,0);else if(t===199){const n=this.lookU8();e=this.decodeExtension(n,1)}else if(t===200){const n=this.lookU16();e=this.decodeExtension(n,2)}else if(t===201){const n=this.lookU32();e=this.decodeExtension(n,4)}else throw new He(`Unrecognized type byte: ${Pn(t)}`);this.complete();const r=this.stack;for(;r.length>0;){const n=r.top();if(n.type===ss)if(n.array[n.position]=e,n.position++,n.position===n.size)e=n.array,r.release(n);else continue e;else if(n.type===Zi){if(e==="__proto__")throw new He("The key __proto__ is not allowed");n.key=this.mapKeyConverter(e),n.type=Sl;continue e}else if(n.map[n.key]=e,n.readCount++,n.readCount===n.size)e=n.map,r.release(n);else{n.key=null,n.type=Zi;continue e}}return e}}readHeadByte(){return this.headByte===Ui&&(this.headByte=this.readU8()),this.headByte}complete(){this.headByte=Ui}readArraySize(){const t=this.readHeadByte();switch(t){case 220:return this.readU16();case 221:return this.readU32();default:{if(t<160)return t-144;throw new He(`Unrecognized array type byte: ${Pn(t)}`)}}}pushMapState(t){if(t>this.maxMapLength)throw new He(`Max length exceeded: map length (${t}) > maxMapLengthLength (${this.maxMapLength})`);this.stack.pushMapState(t)}pushArrayState(t){if(t>this.maxArrayLength)throw new He(`Max length exceeded: array length (${t}) > maxArrayLength (${this.maxArrayLength})`);this.stack.pushArrayState(t)}decodeString(t,e){return!this.rawStrings||this.stateIsMapKey()?this.decodeUtf8String(t,e):this.decodeBinary(t,e)}decodeUtf8String(t,e){var s;if(t>this.maxStrLength)throw new He(`Max length exceeded: UTF-8 byte length (${t}) > maxStrLength (${this.maxStrLength})`);if(this.bytes.byteLength<this.pos+e+t)throw na;const r=this.pos+e;let n;return this.stateIsMapKey()&&((s=this.keyDecoder)!=null&&s.canBeCached(t))?n=this.keyDecoder.decode(this.bytes,r,t):n=of(this.bytes,r,t),this.pos+=e+t,n}stateIsMapKey(){return this.stack.length>0?this.stack.top().type===Zi:!1}decodeBinary(t,e){if(t>this.maxBinLength)throw new He(`Max length exceeded: bin length (${t}) > maxBinLength (${this.maxBinLength})`);if(!this.hasRemaining(t+e))throw na;const r=this.pos+e,n=this.bytes.subarray(r,r+t);return this.pos+=e+t,n}decodeExtension(t,e){if(t>this.maxExtLength)throw new He(`Max length exceeded: ext length (${t}) > maxExtLength (${this.maxExtLength})`);const r=this.view.getInt8(this.pos+e),n=this.decodeBinary(t,e+1);return this.extensionCodec.decode(n,r,this.context)}lookU8(){return this.view.getUint8(this.pos)}lookU16(){return this.view.getUint16(this.pos)}lookU32(){return this.view.getUint32(this.pos)}readU8(){const t=this.view.getUint8(this.pos);return this.pos++,t}readI8(){const t=this.view.getInt8(this.pos);return this.pos++,t}readU16(){const t=this.view.getUint16(this.pos);return this.pos+=2,t}readI16(){const t=this.view.getInt16(this.pos);return this.pos+=2,t}readU32(){const t=this.view.getUint32(this.pos);return this.pos+=4,t}readI32(){const t=this.view.getInt32(this.pos);return this.pos+=4,t}readU64(){const t=cf(this.view,this.pos);return this.pos+=8,t}readI64(){const t=xl(this.view,this.pos);return this.pos+=8,t}readU64AsBigInt(){const t=this.view.getBigUint64(this.pos);return this.pos+=8,t}readI64AsBigInt(){const t=this.view.getBigInt64(this.pos);return this.pos+=8,t}readF32(){const t=this.view.getFloat32(this.pos);return this.pos+=4,t}readF64(){const t=this.view.getFloat64(this.pos);return this.pos+=8,t}}function Lf(i,t){return new no(t).decode(i)}var Df={};const Vf=":";function kr(i){const[t,e]=i.split(Vf);return{namespace:t,reference:e}}function Cl(i,t){return i.includes(":")?[i]:t.chains||[]}var xf=Object.defineProperty,Sf=Object.defineProperties,Cf=Object.getOwnPropertyDescriptors,sa=Object.getOwnPropertySymbols,$f=Object.prototype.hasOwnProperty,kf=Object.prototype.propertyIsEnumerable,os=(i,t,e)=>t in i?xf(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,oa=(i,t)=>{for(var e in t||(t={}))$f.call(t,e)&&os(i,e,t[e]);if(sa)for(var e of sa(t))kf.call(t,e)&&os(i,e,t[e]);return i},Uf=(i,t)=>Sf(i,Cf(t)),aa=(i,t,e)=>os(i,typeof t!="symbol"?t+"":t,e);const Nf="ReactNative",Ge={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},Bf="js";function Zr(){return typeof Kt<"u"&&typeof Kt.versions<"u"&&typeof Kt.versions.node<"u"}function Ht(){return!Rt.getDocument()&&!!Rt.getNavigator()&&navigator.product===Nf}function Mf(){return Ht()&&typeof K<"u"&&typeof(K==null?void 0:K.Platform)<"u"&&(K==null?void 0:K.Platform.OS)==="android"}function qf(){return Ht()&&typeof K<"u"&&typeof(K==null?void 0:K.Platform)<"u"&&(K==null?void 0:K.Platform.OS)==="ios"}function Di(){return!Zr()&&!!Rt.getNavigator()&&!!Rt.getDocument()}function yr(){return Ht()?Ge.reactNative:Zr()?Ge.node:Di()?Ge.browser:Ge.unknown}function ca(){var i;try{return Ht()&&typeof K<"u"&&typeof(K==null?void 0:K.Application)<"u"?(i=K.Application)==null?void 0:i.applicationId:void 0}catch{return}}function zf(i,t){const e=new URLSearchParams(i);for(const r of Object.keys(t).sort())if(t.hasOwnProperty(r)){const n=t[r];n!==void 0&&e.set(r,n)}return e.toString()}function jf(i){var t,e;const r=$l();try{return i!=null&&i.url&&r.url&&new URL(i.url).host!==new URL(r.url).host&&(console.warn(`The configured WalletConnect 'metadata.url':${i.url} differs from the actual page url:${r.url}. This is probably unintended and can lead to issues.`),i.url=r.url),(t=i==null?void 0:i.icons)!=null&&t.length&&i.icons.length>0&&(i.icons=i.icons.filter(n=>n!=="")),Uf(oa(oa({},r),i),{url:(i==null?void 0:i.url)||r.url,name:(i==null?void 0:i.name)||r.name,description:(i==null?void 0:i.description)||r.description,icons:(e=i==null?void 0:i.icons)!=null&&e.length&&i.icons.length>0?i.icons:r.icons})}catch(n){return console.warn("Error populating app metadata",n),i||r}}function $l(){return Qh.getWindowMetadata()||{name:"",description:"",url:"",icons:[""]}}function Kf(){if(yr()===Ge.reactNative&&typeof K<"u"&&typeof(K==null?void 0:K.Platform)<"u"){const{OS:e,Version:r}=K.Platform;return[e,r].join("-")}const i=ed();if(i===null)return"unknown";const t=i.os?i.os.replace(" ","").toLowerCase():"unknown";return i.type==="browser"?[t,i.name,i.version].join("-"):[t,i.version].join("-")}function Ff(){var i;const t=yr();return t===Ge.browser?[t,((i=Rt.getLocation())==null?void 0:i.host)||"unknown"].join(":"):t}function kl(i,t,e){const r=Kf(),n=Ff();return[[i,t].join("-"),[Bf,e].join("-"),r,n].join("/")}function Wf({protocol:i,version:t,relayUrl:e,sdkVersion:r,auth:n,projectId:s,useOnCloseEvent:o,bundleId:c,packageName:l}){const u=e.split("?"),h=kl(i,t,r),d={auth:n,ua:h,projectId:s,useOnCloseEvent:o,packageName:l||void 0,bundleId:c||void 0},p=zf(u[1]||"",d);return u[0]+"?"+p}function ei(i,t){return i.filter(e=>t.includes(e)).length===i.length}function as(i){return Object.fromEntries(i.entries())}function cs(i){return new Map(Object.entries(i))}function Zt(i=B.FIVE_MINUTES,t){const e=B.toMiliseconds(i||B.FIVE_MINUTES);let r,n,s,o;return{resolve:c=>{s&&r&&(clearTimeout(s),r(c),o=Promise.resolve(c))},reject:c=>{s&&n&&(clearTimeout(s),n(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),r=c,n=l})}}function mt(i,t,e){return new Promise(async(r,n)=>{const s=setTimeout(()=>n(new Error(e)),t);try{const o=await i;r(o)}catch(o){n(o)}clearTimeout(s)})}function Ul(i,t){if(typeof t=="string"&&t.startsWith(`${i}:`))return t;if(i.toLowerCase()==="topic"){if(typeof t!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${t}`}else if(i.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: ${i}`)}function Hf(i){return Ul("topic",i)}function Gf(i){return Ul("id",i)}function Nl(i){const[t,e]=i.split(":"),r={id:void 0,topic:void 0};if(t==="topic"&&typeof e=="string")r.topic=e;else if(t==="id"&&Number.isInteger(Number(e)))r.id=Number(e);else throw new Error(`Invalid target, expected id:number or topic:string, got ${t}:${e}`);return r}function _e(i,t){return B.fromMiliseconds(Date.now()+B.toMiliseconds(i))}function Bt(i){return Date.now()>=B.toMiliseconds(i)}function te(i,t){return`${i}${t?`:${t}`:""}`}function ni(i=[],t=[]){return[...new Set([...i,...t])]}async function Jf({id:i,topic:t,wcDeepLink:e}){var r;try{if(!e)return;const n=typeof e=="string"?JSON.parse(e):e,s=n==null?void 0:n.href;if(typeof s!="string")return;const o=Yf(s,i,t),c=yr();if(c===Ge.browser){if(!((r=Rt.getDocument())!=null&&r.hasFocus())){console.warn("Document does not have focus, skipping deeplink.");return}Zf(o)}else c===Ge.reactNative&&typeof(K==null?void 0:K.Linking)<"u"&&await K.Linking.openURL(o)}catch(n){console.error(n)}}function Yf(i,t,e){const r=`requestId=${t}&sessionTopic=${e}`;i.endsWith("/")&&(i=i.slice(0,-1));let n=`${i}`;if(i.startsWith("https://t.me")){const s=i.includes("?")?"&startapp=":"?startapp=";n=`${n}${s}${tm(r,!0)}`}else n=`${n}/wc?${r}`;return n}function Zf(i){let t="_self";em()?t="_top":(Xf()||i.startsWith("https://")||i.startsWith("http://"))&&(t="_blank"),window.open(i,t,"noreferrer noopener")}async function Qf(i,t){let e="";try{if(Di()&&(e=localStorage.getItem(t),e))return e;e=await i.getItem(t)}catch(r){console.error(r)}return e}function la(i,t){if(!i.includes(t))return null;const e=i.split(/([&,?,=])/),r=e.indexOf(t);return e[r+2]}function ua(){return typeof crypto<"u"&&crypto!=null&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu,i=>{const t=Math.random()*16|0;return(i==="x"?t:t&3|8).toString(16)})}function so(){return typeof Kt<"u"&&Df.IS_VITEST==="true"}function Xf(){return typeof window<"u"&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)}function em(){try{return window.self!==window.top}catch{return!1}}function tm(i,t=!1){const e=ee.from(i).toString("base64");return t?e.replace(/[=]/g,""):e}function Bl(i){return ee.from(i,"base64").toString("utf-8")}function im(i){return new Promise(t=>setTimeout(t,i))}let rm=class{constructor({limit:t}){aa(this,"limit"),aa(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 Or=BigInt(2**32-1),ha=BigInt(32);function Ml(i,t=!1){return t?{h:Number(i&Or),l:Number(i>>ha&Or)}:{h:Number(i>>ha&Or)|0,l:Number(i&Or)|0}}function ql(i,t=!1){const e=i.length;let r=new Uint32Array(e),n=new Uint32Array(e);for(let s=0;s<e;s++){const{h:o,l:c}=Ml(i[s],t);[r[s],n[s]]=[o,c]}return[r,n]}const da=(i,t,e)=>i>>>e,pa=(i,t,e)=>i<<32-e|t>>>e,Mt=(i,t,e)=>i>>>e|t<<32-e,qt=(i,t,e)=>i<<32-e|t>>>e,Hi=(i,t,e)=>i<<64-e|t>>>e-32,Gi=(i,t,e)=>i>>>e-32|t<<64-e,nm=(i,t)=>t,sm=(i,t)=>i,om=(i,t,e)=>i<<e|t>>>32-e,am=(i,t,e)=>t<<e|i>>>32-e,cm=(i,t,e)=>t<<e-32|i>>>64-e,lm=(i,t,e)=>i<<e-32|t>>>64-e;function ot(i,t,e,r){const n=(t>>>0)+(r>>>0);return{h:i+e+(n/2**32|0)|0,l:n|0}}const oo=(i,t,e)=>(i>>>0)+(t>>>0)+(e>>>0),ao=(i,t,e,r)=>t+e+r+(i/2**32|0)|0,um=(i,t,e,r)=>(i>>>0)+(t>>>0)+(e>>>0)+(r>>>0),hm=(i,t,e,r,n)=>t+e+r+n+(i/2**32|0)|0,dm=(i,t,e,r,n)=>(i>>>0)+(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0),pm=(i,t,e,r,n,s)=>t+e+r+n+s+(i/2**32|0)|0,fi=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;function co(i){return i instanceof Uint8Array||ArrayBuffer.isView(i)&&i.constructor.name==="Uint8Array"}function Lt(i){if(!Number.isSafeInteger(i)||i<0)throw new Error("positive integer expected, got "+i)}function it(i,...t){if(!co(i))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(i.length))throw new Error("Uint8Array expected of length "+t+", got length="+i.length)}function lo(i){if(typeof i!="function"||typeof i.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");Lt(i.outputLen),Lt(i.blockLen)}function Wt(i,t=!0){if(i.destroyed)throw new Error("Hash instance has been destroyed");if(t&&i.finished)throw new Error("Hash#digest() has already been called")}function uo(i,t){it(i);const e=t.outputLen;if(i.length<e)throw new Error("digestInto() expects output buffer of length at least "+e)}function cr(i){return new Uint32Array(i.buffer,i.byteOffset,Math.floor(i.byteLength/4))}function rt(...i){for(let t=0;t<i.length;t++)i[t].fill(0)}function On(i){return new DataView(i.buffer,i.byteOffset,i.byteLength)}function ut(i,t){return i<<32-t|i>>>t}const zl=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function jl(i){return i<<24&4278190080|i<<8&16711680|i>>>8&65280|i>>>24&255}const It=zl?i=>i:i=>jl(i);function _m(i){for(let t=0;t<i.length;t++)i[t]=jl(i[t]);return i}const zt=zl?i=>i:_m,Kl=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",fm=Array.from({length:256},(i,t)=>t.toString(16).padStart(2,"0"));function lr(i){if(it(i),Kl)return i.toHex();let t="";for(let e=0;e<i.length;e++)t+=fm[i[e]];return t}const vt={_0:48,_9:57,A:65,F:70,a:97,f:102};function _a(i){if(i>=vt._0&&i<=vt._9)return i-vt._0;if(i>=vt.A&&i<=vt.F)return i-(vt.A-10);if(i>=vt.a&&i<=vt.f)return i-(vt.a-10)}function ho(i){if(typeof i!="string")throw new Error("hex string expected, got "+typeof i);if(Kl)return Uint8Array.fromHex(i);const t=i.length,e=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);const r=new Uint8Array(e);for(let n=0,s=0;n<e;n++,s+=2){const o=_a(i.charCodeAt(s)),c=_a(i.charCodeAt(s+1));if(o===void 0||c===void 0){const l=i[s]+i[s+1];throw new Error('hex string expected, got non-hex character "'+l+'" at index '+s)}r[n]=o*16+c}return r}function mm(i){if(typeof i!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(i))}function ct(i){return typeof i=="string"&&(i=mm(i)),it(i),i}function ti(...i){let t=0;for(let r=0;r<i.length;r++){const n=i[r];it(n),t+=n.length}const e=new Uint8Array(t);for(let r=0,n=0;r<i.length;r++){const s=i[r];e.set(s,n),n+=s.length}return e}class an{}function wr(i){const t=r=>i().update(ct(r)).digest(),e=i();return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=()=>i(),t}function ym(i){const t=(r,n)=>i(n).update(ct(r)).digest(),e=i({});return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=r=>i(r),t}function Vi(i=32){if(fi&&typeof fi.getRandomValues=="function")return fi.getRandomValues(new Uint8Array(i));if(fi&&typeof fi.randomBytes=="function")return Uint8Array.from(fi.randomBytes(i));throw new Error("crypto.getRandomValues must be defined")}const wm=BigInt(0),Ni=BigInt(1),gm=BigInt(2),Em=BigInt(7),vm=BigInt(256),bm=BigInt(113),Fl=[],Wl=[],Hl=[];for(let i=0,t=Ni,e=1,r=0;i<24;i++){[e,r]=[r,(2*e+3*r)%5],Fl.push(2*(5*r+e)),Wl.push((i+1)*(i+2)/2%64);let n=wm;for(let s=0;s<7;s++)t=(t<<Ni^(t>>Em)*bm)%vm,t&gm&&(n^=Ni<<(Ni<<BigInt(s))-Ni);Hl.push(n)}const Gl=ql(Hl,!0),Im=Gl[0],Am=Gl[1],fa=(i,t,e)=>e>32?cm(i,t,e):om(i,t,e),ma=(i,t,e)=>e>32?lm(i,t,e):am(i,t,e);function Tm(i,t=24){const e=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let o=0;o<10;o++)e[o]=i[o]^i[o+10]^i[o+20]^i[o+30]^i[o+40];for(let o=0;o<10;o+=2){const c=(o+8)%10,l=(o+2)%10,u=e[l],h=e[l+1],d=fa(u,h,1)^e[c],p=ma(u,h,1)^e[c+1];for(let _=0;_<50;_+=10)i[o+_]^=d,i[o+_+1]^=p}let n=i[2],s=i[3];for(let o=0;o<24;o++){const c=Wl[o],l=fa(n,s,c),u=ma(n,s,c),h=Fl[o];n=i[h],s=i[h+1],i[h]=l,i[h+1]=u}for(let o=0;o<50;o+=10){for(let c=0;c<10;c++)e[c]=i[o+c];for(let c=0;c<10;c++)i[o+c]^=~e[(c+2)%10]&e[(c+4)%10]}i[0]^=Im[r],i[1]^=Am[r]}rt(e)}let Pm=class Jl extends an{constructor(t,e,r,n=!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=r,this.enableXOF=n,this.rounds=s,Lt(r),!(0<t&&t<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=cr(this.state)}clone(){return this._cloneInto()}keccak(){zt(this.state32),Tm(this.state32,this.rounds),zt(this.state32),this.posOut=0,this.pos=0}update(t){Wt(this),t=ct(t),it(t);const{blockLen:e,state:r}=this,n=t.length;for(let s=0;s<n;){const o=Math.min(e-this.pos,n-s);for(let c=0;c<o;c++)r[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:r,blockLen:n}=this;t[r]^=e,e&128&&r===n-1&&this.keccak(),t[n-1]^=128,this.keccak()}writeInto(t){Wt(this,!1),it(t),this.finish();const e=this.state,{blockLen:r}=this;for(let n=0,s=t.length;n<s;){this.posOut>=r&&this.keccak();const o=Math.min(r-this.posOut,s-n);t.set(e.subarray(this.posOut,this.posOut+o),n),this.posOut+=o,n+=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(uo(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:r,outputLen:n,rounds:s,enableXOF:o}=this;return t||(t=new Jl(e,r,n,o,s)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=s,t.suffix=r,t.outputLen=n,t.enableXOF=o,t.destroyed=this.destroyed,t}};const Om=(i,t,e)=>wr(()=>new Pm(t,i,e)),Rm=Om(1,136,256/8);function Lm(i,t,e,r){if(typeof i.setBigUint64=="function")return i.setBigUint64(t,e,r);const n=BigInt(32),s=BigInt(4294967295),o=Number(e>>n&s),c=Number(e&s),l=r?4:0,u=r?0:4;i.setUint32(t+l,o,r),i.setUint32(t+u,c,r)}function Dm(i,t,e){return i&t^~i&e}function Vm(i,t,e){return i&t^i&e^t&e}let Yl=class extends an{constructor(t,e,r,n){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=t,this.outputLen=e,this.padOffset=r,this.isLE=n,this.buffer=new Uint8Array(t),this.view=On(this.buffer)}update(t){Wt(this),t=ct(t),it(t);const{view:e,buffer:r,blockLen:n}=this,s=t.length;for(let o=0;o<s;){const c=Math.min(n-this.pos,s-o);if(c===n){const l=On(t);for(;n<=s-o;o+=n)this.process(l,o);continue}r.set(t.subarray(o,o+c),this.pos),this.pos+=c,o+=c,this.pos===n&&(this.process(e,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){Wt(this),uo(t,this),this.finished=!0;const{buffer:e,view:r,blockLen:n,isLE:s}=this;let{pos:o}=this;e[o++]=128,rt(this.buffer.subarray(o)),this.padOffset>n-o&&(this.process(r,0),o=0);for(let d=o;d<n;d++)e[d]=0;Lm(r,n-8,BigInt(this.length*8),s),this.process(r,0);const c=On(t),l=this.outputLen;if(l%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const u=l/4,h=this.get();if(u>h.length)throw new Error("_sha2: outputLen bigger than state");for(let d=0;d<u;d++)c.setUint32(4*d,h[d],s)}digest(){const{buffer:t,outputLen:e}=this;this.digestInto(t);const r=t.slice(0,e);return this.destroy(),r}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:e,buffer:r,length:n,finished:s,destroyed:o,pos:c}=this;return t.destroyed=o,t.finished=s,t.length=n,t.pos=c,n%e&&t.buffer.set(r),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]),xm=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]),xt=new Uint32Array(64);let Sm=class extends Yl{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:r,D:n,E:s,F:o,G:c,H:l}=this;return[t,e,r,n,s,o,c,l]}set(t,e,r,n,s,o,c,l){this.A=t|0,this.B=e|0,this.C=r|0,this.D=n|0,this.E=s|0,this.F=o|0,this.G=c|0,this.H=l|0}process(t,e){for(let d=0;d<16;d++,e+=4)xt[d]=t.getUint32(e,!1);for(let d=16;d<64;d++){const p=xt[d-15],_=xt[d-2],f=ut(p,7)^ut(p,18)^p>>>3,m=ut(_,17)^ut(_,19)^_>>>10;xt[d]=m+xt[d-7]+f+xt[d-16]|0}let{A:r,B:n,C:s,D:o,E:c,F:l,G:u,H:h}=this;for(let d=0;d<64;d++){const p=ut(c,6)^ut(c,11)^ut(c,25),_=h+p+Dm(c,l,u)+xm[d]+xt[d]|0,f=(ut(r,2)^ut(r,13)^ut(r,22))+Vm(r,n,s)|0;h=u,u=l,l=c,c=o+_|0,o=s,s=n,n=r,r=_+f|0}r=r+this.A|0,n=n+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,h=h+this.H|0,this.set(r,n,s,o,c,l,u,h)}roundClean(){rt(xt)}destroy(){this.set(0,0,0,0,0,0,0,0),rt(this.buffer)}};const Zl=ql(["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(i=>BigInt(i))),Cm=Zl[0],$m=Zl[1],St=new Uint32Array(80),Ct=new Uint32Array(80);let po=class extends Yl{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:r,Bl:n,Ch:s,Cl:o,Dh:c,Dl:l,Eh:u,El:h,Fh:d,Fl:p,Gh:_,Gl:f,Hh:m,Hl:y}=this;return[t,e,r,n,s,o,c,l,u,h,d,p,_,f,m,y]}set(t,e,r,n,s,o,c,l,u,h,d,p,_,f,m,y){this.Ah=t|0,this.Al=e|0,this.Bh=r|0,this.Bl=n|0,this.Ch=s|0,this.Cl=o|0,this.Dh=c|0,this.Dl=l|0,this.Eh=u|0,this.El=h|0,this.Fh=d|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 v=0;v<16;v++,e+=4)St[v]=t.getUint32(e),Ct[v]=t.getUint32(e+=4);for(let v=16;v<80;v++){const P=St[v-15]|0,T=Ct[v-15]|0,g=Mt(P,T,1)^Mt(P,T,8)^da(P,T,7),D=qt(P,T,1)^qt(P,T,8)^pa(P,T,7),L=St[v-2]|0,w=Ct[v-2]|0,E=Mt(L,w,19)^Hi(L,w,61)^da(L,w,6),I=qt(L,w,19)^Gi(L,w,61)^pa(L,w,6),A=um(D,I,Ct[v-7],Ct[v-16]),V=hm(A,g,E,St[v-7],St[v-16]);St[v]=V|0,Ct[v]=A|0}let{Ah:r,Al:n,Bh:s,Bl:o,Ch:c,Cl:l,Dh:u,Dl:h,Eh:d,El:p,Fh:_,Fl:f,Gh:m,Gl:y,Hh:b,Hl:R}=this;for(let v=0;v<80;v++){const P=Mt(d,p,14)^Mt(d,p,18)^Hi(d,p,41),T=qt(d,p,14)^qt(d,p,18)^Gi(d,p,41),g=d&_^~d&m,D=p&f^~p&y,L=dm(R,T,D,$m[v],Ct[v]),w=pm(L,b,P,g,Cm[v],St[v]),E=L|0,I=Mt(r,n,28)^Hi(r,n,34)^Hi(r,n,39),A=qt(r,n,28)^Gi(r,n,34)^Gi(r,n,39),V=r&s^r&c^s&c,O=n&o^n&l^o&l;b=m|0,R=y|0,m=_|0,y=f|0,_=d|0,f=p|0,{h:d,l:p}=ot(u|0,h|0,w|0,E|0),u=c|0,h=l|0,c=s|0,l=o|0,s=r|0,o=n|0;const x=oo(E,A,O);r=ao(x,w,I,V),n=x|0}({h:r,l:n}=ot(this.Ah|0,this.Al|0,r|0,n|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:h}=ot(this.Dh|0,this.Dl|0,u|0,h|0),{h:d,l:p}=ot(this.Eh|0,this.El|0,d|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:R}=ot(this.Hh|0,this.Hl|0,b|0,R|0),this.set(r,n,s,o,c,l,u,h,d,p,_,f,m,y,b,R)}roundClean(){rt(St,Ct)}destroy(){rt(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}},km=class extends po{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 Um extends po{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 cn=wr(()=>new Sm),Nm=wr(()=>new po),Bm=wr(()=>new km),Mm=wr(()=>new Um),qm=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]),q=new Uint32Array(32);function $t(i,t,e,r,n,s){const o=n[s],c=n[s+1];let l=q[2*i],u=q[2*i+1],h=q[2*t],d=q[2*t+1],p=q[2*e],_=q[2*e+1],f=q[2*r],m=q[2*r+1],y=oo(l,h,o);u=ao(y,u,d,c),l=y|0,{Dh:m,Dl:f}={Dh:m^u,Dl:f^l},{Dh:m,Dl:f}={Dh:nm(m,f),Dl:sm(m)},{h:_,l:p}=ot(_,p,m,f),{Bh:d,Bl:h}={Bh:d^_,Bl:h^p},{Bh:d,Bl:h}={Bh:Mt(d,h,24),Bl:qt(d,h,24)},q[2*i]=l,q[2*i+1]=u,q[2*t]=h,q[2*t+1]=d,q[2*e]=p,q[2*e+1]=_,q[2*r]=f,q[2*r+1]=m}function kt(i,t,e,r,n,s){const o=n[s],c=n[s+1];let l=q[2*i],u=q[2*i+1],h=q[2*t],d=q[2*t+1],p=q[2*e],_=q[2*e+1],f=q[2*r],m=q[2*r+1],y=oo(l,h,o);u=ao(y,u,d,c),l=y|0,{Dh:m,Dl:f}={Dh:m^u,Dl:f^l},{Dh:m,Dl:f}={Dh:Mt(m,f,16),Dl:qt(m,f,16)},{h:_,l:p}=ot(_,p,m,f),{Bh:d,Bl:h}={Bh:d^_,Bl:h^p},{Bh:d,Bl:h}={Bh:Hi(d,h,63),Bl:Gi(d,h,63)},q[2*i]=l,q[2*i+1]=u,q[2*t]=h,q[2*t+1]=d,q[2*e]=p,q[2*e+1]=_,q[2*r]=f,q[2*r+1]=m}function zm(i,t={},e,r,n){if(Lt(e),i<0||i>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!==r)throw new Error("salt must be undefined or "+r);if(c!==void 0&&c.length!==n)throw new Error("personalization must be undefined or "+n)}class jm extends an{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=cr(this.buffer)}update(t){Wt(this),t=ct(t),it(t);const{blockLen:e,buffer:r,buffer32:n}=this,s=t.length,o=t.byteOffset,c=t.buffer;for(let l=0;l<s;){this.pos===e&&(zt(n),this.compress(n,0,!1),zt(n),this.pos=0);const u=Math.min(e-this.pos,s-l),h=o+l;if(u===e&&!(h%4)&&l+u<s){const d=new Uint32Array(c,h,Math.floor((s-l)/4));zt(d);for(let p=0;l+e<s;p+=n.length,l+=e)this.length+=e,this.compress(d,p,!1);zt(d);continue}r.set(t.subarray(l,l+u),this.pos),this.pos+=u,this.length+=u,l+=u}return this}digestInto(t){Wt(this),uo(t,this);const{pos:e,buffer32:r}=this;this.finished=!0,rt(this.buffer.subarray(e)),zt(r),this.compress(r,0,!0),zt(r);const n=cr(t);this.get().forEach((s,o)=>n[o]=It(s))}digest(){const{buffer:t,outputLen:e}=this;this.digestInto(t);const r=t.slice(0,e);return this.destroy(),r}_cloneInto(t){const{buffer:e,length:r,finished:n,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=n,t.length=r,t.pos=c,t.outputLen=o,t}clone(){return this._cloneInto()}}class Km extends jm{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,zm(e,t,64,16,16);let{key:r,personalization:n,salt:s}=t,o=0;if(r!==void 0&&(r=ct(r),o=r.length),this.v0l^=this.outputLen|o<<8|65536|1<<24,s!==void 0){s=ct(s);const c=cr(s);this.v4l^=It(c[0]),this.v4h^=It(c[1]),this.v5l^=It(c[2]),this.v5h^=It(c[3])}if(n!==void 0){n=ct(n);const c=cr(n);this.v6l^=It(c[0]),this.v6h^=It(c[1]),this.v7l^=It(c[2]),this.v7h^=It(c[3])}if(r!==void 0){const c=new Uint8Array(this.blockLen);c.set(r),this.update(c)}}get(){let{v0l:t,v0h:e,v1l:r,v1h:n,v2l:s,v2h:o,v3l:c,v3h:l,v4l:u,v4h:h,v5l:d,v5h:p,v6l:_,v6h:f,v7l:m,v7h:y}=this;return[t,e,r,n,s,o,c,l,u,h,d,p,_,f,m,y]}set(t,e,r,n,s,o,c,l,u,h,d,p,_,f,m,y){this.v0l=t|0,this.v0h=e|0,this.v1l=r|0,this.v1h=n|0,this.v2l=s|0,this.v2h=o|0,this.v3l=c|0,this.v3h=l|0,this.v4l=u|0,this.v4h=h|0,this.v5l=d|0,this.v5h=p|0,this.v6l=_|0,this.v6h=f|0,this.v7l=m|0,this.v7h=y|0}compress(t,e,r){this.get().forEach((l,u)=>q[u]=l),q.set(pe,16);let{h:n,l:s}=Ml(BigInt(this.length));q[24]=pe[8]^s,q[25]=pe[9]^n,r&&(q[28]=~q[28],q[29]=~q[29]);let o=0;const c=qm;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^=q[0]^q[16],this.v0h^=q[1]^q[17],this.v1l^=q[2]^q[18],this.v1h^=q[3]^q[19],this.v2l^=q[4]^q[20],this.v2h^=q[5]^q[21],this.v3l^=q[6]^q[22],this.v3h^=q[7]^q[23],this.v4l^=q[8]^q[24],this.v4h^=q[9]^q[25],this.v5l^=q[10]^q[26],this.v5h^=q[11]^q[27],this.v6l^=q[12]^q[28],this.v6h^=q[13]^q[29],this.v7l^=q[14]^q[30],this.v7h^=q[15]^q[31],rt(q)}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 Fm=ym(i=>new Km(i)),Wm="https://rpc.walletconnect.org/v1";function Ql(i){const t=`Ethereum Signed Message:
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/get-ecosystem-wallet-info-7Lw-sZ_z.js","assets/thirdweb-RfTGDewD.js","assets/store-CraP4F4Y.js","assets/ui-CUXWd4jk.js","assets/vendor-DlkLYSlV.js","assets/index-C_o5O_iU.js","assets/index-DdAb4cgP.css","assets/index-DkoCaWFP.js","assets/index-MOkgM3CG.js","assets/index-nibyPLVP.js","assets/ethereum-D1IvEqvR.js","assets/index-CmYKoHtM.js","assets/vanilla-BwPktXNc.js","assets/hooks.module-MHgUT2ti.js","assets/clsx.m-DHulAg21.js","assets/index-BehUnmBQ.js","assets/web-connector-3zdQreYv.js","assets/index-CA_7NqLN.js","assets/send-eip712-transaction-BLYLbaE2.js","assets/controller-BFbz0Wfy.js","assets/qr-overlay-CRwPPsut.js","assets/getBalance-lwqG5BkA.js","assets/secp256k1-CAuxtucr.js","assets/session-proposal-BOVuEqZb.js","assets/session-request-u0q6IDVU.js","assets/in-app-wallet-calls-DnbOJdqi.js"])))=>i.map(i=>d[i]);
2
+ import{bF as uh,bG as nr,bH as Sc,bI as si,ac as Ve,Q as Po,R as hh,n as De,f as Z,F as zr,p as Kt,bJ as Cc,_ as a,bK as li,b as ge,aI as $s,s as we,bL as $c,bM as kc,bN as Uc,j as ks,u as Us,t as Ns,Y as Nc,as as nn,ak as dh,x as Bs,al as ph,a5 as _h,b7 as fh,h as mh,v as yh,i as wh,bO as Bc,bP as gh,bQ as Eh,aq as vh,ar as bh,bR as Ih,bS as Ah,l as sn,bT as Th,bU as Jn,an as Mc,bV as Ph,bW as Oh,bX as Ms,bY as qc,bZ as Rh,N as qs,b_ as zc,b$ as Lh,c0 as Oo,c1 as Dh,P as Vh,c2 as Ro,c3 as xh,c4 as Sh,c5 as Ch,c6 as $h,a1 as kh,g as Uh,aB as Nh,c7 as Lo,d as Bh,c8 as jc,a9 as Kc,ab as _r,aa as Fc,c9 as Mh,aV as qh,ca as zh,cb as Jt,cc as jh,a2 as Kh,o as Fh,y as Wh,J as Hh,cd as Gh,ce as Jh,cf as Yh}from"./thirdweb-RfTGDewD.js";import{c as Zh}from"./store-CraP4F4Y.js";import{B as ee,g as K}from"./ui-CUXWd4jk.js";import{e as ui,N as Wc}from"./index-C_o5O_iU.js";import{d as br,a as jr,s as sr,I as Ti,e as Qh,g as tt,t as je,h as B,j as Rt,C as Xh,k as ed,l as Yi,m as Yn,D as fr,n as td,q as id,c as Nt,r as Pi,o as rd,u as nd,v as zs,w as js,b as Kr,P as Do,Q as sd,x as od,y as Xt,f as Hc,z as bt,A as _t,B as Dt}from"./index-DkoCaWFP.js";import{c as ad,a as cd,k as ld,d as ud,s as hd,g as Vo}from"./index-nibyPLVP.js";import"./index-MOkgM3CG.js";import{e as dd}from"./ethereum-D1IvEqvR.js";async function qe(i){const{client:t,ecosystem:e,walletType:r,walletAddress:n,chainId:s}=i;return uh({client:t,data:{action:"connect",chainId:s,source:"connectWallet",walletAddress:n,walletType:r},ecosystem:e})}function Ks(i){const t=i.domain;return(t==null?void 0:t.chainId)!==void 0&&nr(t.chainId)&&(i.domain={...i.domain,chainId:Sc(i.domain.chainId)}),i}const pd={"0x0":"reverted","0x1":"success"};function Fs(i){var r;const[t,e]=(()=>{const n=i.status;return n>=100&&n<200?["pending",n]:n>=200&&n<300?["success",n]:n>=300&&n<700?["failure",n]:n==="CONFIRMED"?["success",200]:n==="PENDING"?["pending",100]:[void 0,n]})();return{...i,atomic:i.atomic,chainId:i.chainId?si(i.chainId):void 0,receipts:((r=i.receipts)==null?void 0:r.map(n=>({...n,blockNumber:Ve(n.blockNumber),gasUsed:Ve(n.gasUsed),status:pd[n.status]})))??[],status:t,statusCode:e,version:i.version}}function Ws(i,t){const e={};for(const[r,n]of Object.entries(i)){e[Number(r)]={};const s={};for(const[o,c]of Object.entries(n))s[o]=c;e[Number(r)]=s}return typeof t=="number"?{[t]:e[t]}:e}async function Hs(i,t){const e=i.calls[0];if(!e)throw new Error("No calls to send");const{calls:r,capabilities:n,version:s="2.0.0",chain:o=e.chain}=i,c=await Promise.all(r.map(async u=>{const{to:h,value:d}=u;if(h===void 0&&u.data===void 0)throw new Error("Cannot send call, `to` or `data` must be provided.");const[p,_,f]=await Promise.all([Po(h),hh(u),Po(d)]);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:i.atomicRequired??!1,calls:c,capabilities:n,chainId:De(o.id),from:Z(t.address),version:s}],chain:o}}function Gs(i){return _d(i).map(t=>{try{const e=new URL(t);return e.hostname.endsWith(".thirdweb.com")&&(e.pathname="",e.search=""),e.toString()}catch{return t}})}function _d(i,t,e="http"){const r=[];for(const n of i.rpc)e==="http"&&!n.startsWith("http")||e==="ws"&&!n.startsWith("ws")||(n.includes("${THIRDWEB_API_KEY}")?r.push(n.replace("${THIRDWEB_API_KEY}","")):n.includes("${")||r.push(n));if(r.length===0)throw new Error(`No RPC available for chainId "${i.chainId}" with mode ${e}`);return r}function lt(i){return typeof i=="number"?i:zr(i)?si(i):typeof i=="bigint"?Number(i):Number.parseInt(i,10)}function fd(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}function md(){return typeof Kt<"u"&&typeof Kt.versions<"u"&&typeof Kt.versions.node<"u"}function Gc(){return!fd()&&!md()}const ft="com.coinbase.wallet",Pt="org.base.account",Jc="io.metamask",yd="me.rainbow",wd="io.zerion.wallet",Fr={async getItem(i){try{if(typeof window<"u"&&window.localStorage)return localStorage.getItem(i)}catch{}return null},async removeItem(i){typeof window<"u"&&window.localStorage&&localStorage.removeItem(i)},async setItem(i,t){try{typeof window<"u"&&window.localStorage&&localStorage.setItem(i,t)}catch{}}};function Js(i){return i.startsWith("http://")||i.startsWith("https://")}function Yc(i,t){if(!Js(i))return Zc(i,t);let e=i;e.endsWith("/")||(e=`${e}/`);const r=encodeURIComponent(t);return{href:e,redirect:`${e}wc?uri=${r}`}}function Zc(i,t){if(Js(i))return Yc(i,t);let e=i;e.includes("://")||(e=i.replaceAll("/","").replaceAll(":",""),e=`${e}://`),e.endsWith("/")||(e=`${e}/`);const r=encodeURIComponent(t);return{href:e,redirect:`${e}wc?uri=${r}`}}function gd(i,t){return Js(i)?Yc(i,t):Zc(i,t)}function Ed(){if(typeof navigator>"u")return!1;const i=Cc(navigator.userAgent);return i?i.toLowerCase().includes("android"):!1}function vd(){if(typeof navigator>"u")return!1;const i=Cc(navigator.userAgent);return i?i.toLowerCase().includes("ios")||i.toLowerCase().includes("mac")&&navigator.maxTouchPoints>1:!1}function bd(){return typeof window>"u"||typeof navigator>"u"?!1:"ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0}function Id(){return typeof window>"u"?!1:"orientation"in window||"onorientationchange"in window}function xo(){return!!(Ed()||vd()||bd()&&Id()||typeof window<"u"&&window.innerWidth<640)}function wn(i){if(window!==window.top)window.open(i);else if(i.startsWith("http")){const e=document.createElement("a");e.href=i,e.target="_blank",e.rel="noreferrer noopener",e.click()}else window.location.href=i}function Oi(i){return typeof i=="string"?i.startsWith("ecosystem."):i.id.startsWith("ecosystem.")}async function Qc(i,t){if(Oi(i)){const{getEcosystemWalletInfo:e}=await a(async()=>{const{getEcosystemWalletInfo:r}=await import("./get-ecosystem-wallet-info-7Lw-sZ_z.js");return{getEcosystemWalletInfo:r}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10]));return t?e(i).then(r=>r.image_id):e(i)}switch(i){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 ${i} not found`)}}function Ad(){const i=new Map;return{emit(t,e){const r=i.get(t);if(r)for(const n of r)n(e)},subscribe(t,e){var r;return i.has(t)?(r=i.get(t))==null||r.add(e):i.set(t,new Set([e])),()=>{const n=i.get(t);n&&n.delete(e)}}}}function hi(){return Ad()}function Td(i){const{createOptions:t}=i,e=hi();let r,n;function s(){r=void 0,n=void 0}let o=async()=>{},c=async h=>{n=h};const l=e.subscribe("chainChanged",h=>{n=h}),u=e.subscribe("disconnect",()=>{s(),l(),u()});return e.subscribe("accountChanged",h=>{r=h}),{autoConnect:async h=>{const{autoConnectBaseAccountSDK:d}=await a(async()=>{const{autoConnectBaseAccountSDK:b}=await Promise.resolve().then(()=>Co);return{autoConnectBaseAccountSDK:b}},void 0),p=await i.providerFactory(),[_,f,m,y]=await d(h,e,p);return r=_,n=f,o=m,c=y,qe({chainId:n.id,client:h.client,walletAddress:r.address,walletType:Pt}),r},connect:async h=>{const{connectBaseAccountSDK:d}=await a(async()=>{const{connectBaseAccountSDK:b}=await Promise.resolve().then(()=>Co);return{connectBaseAccountSDK:b}},void 0),p=await i.providerFactory(),[_,f,m,y]=await d(h,e,p);return r=_,n=f,o=m,c=y,qe({chainId:n.id,client:h.client,walletAddress:r.address,walletType:Pt}),r},disconnect:async()=>{s(),await o()},getAccount:()=>r,getChain(){if(n)return n=li(n.id)||n,n},getConfig:()=>t,id:Pt,subscribe:e.subscribe,switchChain:async h=>{await c(h)}}}function Wr(){if(!Gc())return{description:"thirdweb powered dApp",logoUrl:"https://thirdweb.com/favicon.ico",name:"thirdweb powered dApp",url:"https://thirdweb.com"};const{protocol:i,hostname:t,port:e}=window.location;let r=`${i}//${t}`;e&&e!=="80"&&e!=="443"&&(r+=`:${e}`);const n=`${r}/favicon.ico`;return{description:window.document.title||"thirdweb powered dApp",logoUrl:n,name:window.document.title||"thirdweb powered dApp",url:r}}let gn,Ir;async function Xc(i){var s,o,c,l,u,h,d;if(gn){if(i&&Ir){const p=((s=Ir.chains)==null?void 0:s.map(y=>y.id))||[],_=((o=i.chains)==null?void 0:o.map(y=>y.id))||[],f=p.length===_.length&&p.every((y,b)=>y===_[b]),m=((c=i.appMetadata)==null?void 0:c.name)===((l=Ir.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 gn}const{createBaseAccountSDK:t}=await a(async()=>{const{createBaseAccountSDK:p}=await import("./index-CmYKoHtM.js");return{createBaseAccountSDK:p}},__vite__mapDeps([11,12,13,14,1,3,4,9])),e=Wr(),n=t({appName:((u=i==null?void 0:i.appMetadata)==null?void 0:u.name)||e.name||"thirdweb powered dApp",appLogoUrl:((h=i==null?void 0:i.appMetadata)==null?void 0:h.logoUrl)||e.logoUrl||null,appChainIds:((d=i==null?void 0:i.chains)==null?void 0:d.map(p=>p.id))||[]}).getProvider();return gn=n,Ir=i,n}function el(i){return i.id===Pt}function So({provider:i,address:t,client:e}){const r={address:Z(t),async sendTransaction(n){const s=await i.request({method:"eth_sendTransaction",params:[{accessList:n.accessList,data:n.data,from:Z(t),gas:n.gas?De(n.gas):void 0,to:n.to,value:n.value?De(n.value):void 0}]});return Ns({chainId:n.chainId,client:e,contractAddress:n.to??void 0,gasPrice:n.gasPrice,transactionHash:s,walletAddress:Z(t),walletType:Pt}),{transactionHash:s}},async signMessage({message:n}){if(!r.address)throw new Error("Provider not setup");const s=typeof n=="string"?ks(n):n.raw instanceof Uint8Array?Us(n.raw):n.raw,o=await i.request({method:"personal_sign",params:[s,r.address]});if(!nr(o))throw new Error("Invalid signature returned");return o},async signTypedData(n){if(!r.address)throw new Error("Provider not setup");const{domain:s,message:o,primaryType:c}=Ks(n),l={EIP712Domain:$c(s),...n.types};kc({domain:s,message:o,primaryType:c,types:l});const u=Uc({domain:s??{},message:o,primaryType:c,types:l}),h=await i.request({method:"eth_signTypedData_v4",params:[r.address,u]});if(!nr(h))throw new Error("Invalid signed payload returned");return h},sendCalls:async n=>{try{const{callParams:s,chain:o}=await Hs(n,r),c=await i.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(n){try{const s=await i.request({method:"wallet_getCallsStatus",params:[n.id]});return Fs(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(n){const s=n.chainId;try{const o=await i.request({method:"wallet_getCapabilities",params:[Z(r.address)]});return Ws(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 r}function tl(i,t,e,r,n){const s=So({address:i,client:n,provider:e});async function o(){e.off("accountsChanged",l),e.off("chainChanged",u),e.off("disconnect",c),await e.disconnect()}async function c(){o(),r.emit("disconnect",void 0)}function l(h){if(h[0]){const d=So({address:Z(h[0]),client:n,provider:e});r.emit("accountChanged",d),r.emit("accountsChanged",h)}else c()}function u(h){const d=ge(lt(h));r.emit("chainChanged",d)}return e.on("accountsChanged",l),e.on("chainChanged",u),e.on("disconnect",c),[s,t,c,h=>il(e,h)]}async function Pd(i,t,e){const r=await e.request({method:"eth_requestAccounts"});if(!r[0])throw new Error("No accounts found");const n=Z(r[0]),s=await e.request({method:"eth_chainId"}),o=lt(s);let c=i.chain&&i.chain.id===o?i.chain:ge(o);return o&&(i!=null&&i.chain)&&o!==(i==null?void 0:i.chain.id)&&(await il(e,i.chain),c=i.chain),tl(n,c,e,t,i.client)}async function Od(i,t,e){const n=(await e.request({method:"eth_accounts"}))[0];if(!n)throw new Error("No accounts found");const s=await e.request({method:"eth_chainId"}),o=lt(s),c=i.chain&&i.chain.id===o?i.chain:ge(o);return tl(n,c,e,t,i.client)}async function il(i,t){var s;const e=await i.request({method:"eth_chainId"}),r=ge(lt(e));if((r==null?void 0:r.id)===t.id)return;const n=De(t.id);try{await i.request({method:"wallet_switchEthereumChain",params:[{chainId:n}]})}catch(o){const c=await $s(t);(o==null?void 0:o.code)===4902&&await i.request({method:"wallet_addEthereumChain",params:[{blockExplorerUrls:((s=c.explorers)==null?void 0:s.map(l=>l.url))||[],chainId:n,chainName:c.name,nativeCurrency:c.nativeCurrency,rpcUrls:Gs(c)}]})}}const Co=Object.freeze(Object.defineProperty({__proto__:null,autoConnectBaseAccountSDK:Od,connectBaseAccountSDK:Pd,getBaseAccountWebProvider:Xc,isBaseAccountSDKWallet:el},Symbol.toStringTag,{value:"Module"}));function Rd(i){const{createOptions:t}=i,e=hi();let r,n;function s(){r=void 0,n=void 0}let o=async()=>{},c=async h=>{n=h};const l=e.subscribe("chainChanged",h=>{n=h}),u=e.subscribe("disconnect",()=>{s(),l(),u()});return e.subscribe("accountChanged",h=>{r=h}),{autoConnect:async h=>{const{autoConnectCoinbaseWalletSDK:d}=await a(async()=>{const{autoConnectCoinbaseWalletSDK:b}=await Promise.resolve().then(()=>ko);return{autoConnectCoinbaseWalletSDK:b}},void 0),p=await i.providerFactory(),[_,f,m,y]=await d(h,e,p);return r=_,n=f,o=m,c=y,qe({chainId:n.id,client:h.client,walletAddress:r.address,walletType:ft}),r},connect:async h=>{const{connectCoinbaseWalletSDK:d}=await a(async()=>{const{connectCoinbaseWalletSDK:b}=await Promise.resolve().then(()=>ko);return{connectCoinbaseWalletSDK:b}},void 0),p=await i.providerFactory(),[_,f,m,y]=await d(h,e,p);return r=_,n=f,o=m,c=y,qe({chainId:n.id,client:h.client,walletAddress:r.address,walletType:ft}),r},disconnect:async()=>{s(),await o()},getAccount:()=>r,getChain(){if(n)return n=li(n.id)||n,n},getConfig:()=>t,id:ft,onConnectRequested:async()=>{var h;if(i.onConnectRequested){const d=await i.providerFactory();return(h=i.onConnectRequested)==null?void 0:h.call(i,d)}},subscribe:e.subscribe,switchChain:async h=>{await c(h)}}}async function rl(i){var t,e;await((e=(t=i==null?void 0:i.communicator)==null?void 0:t.waitForPopupLoaded)==null?void 0:e.call(t))}const Ld=Object.freeze(Object.defineProperty({__proto__:null,showCoinbasePopup:rl},Symbol.toStringTag,{value:"Module"}));let En;async function nl(i){var t,e;if(!En){let r=(await a(()=>import("./index-BehUnmBQ.js"),__vite__mapDeps([15,3,4,1,14,13]))).default;typeof r!="function"&&typeof r.default=="function"&&(r=r.default);const s=new r({appChainIds:i!=null&&i.chains?i.chains.map(o=>o.id):void 0,appLogoUrl:((t=i==null?void 0:i.appMetadata)==null?void 0:t.logoUrl)||Wr().logoUrl,appName:((e=i==null?void 0:i.appMetadata)==null?void 0:e.name)||Wr().name}).makeWeb3Provider(i==null?void 0:i.walletConfig);return En=s,s}return En}function $o({provider:i,address:t,client:e}){const r={address:Z(t),onTransactionRequested:async()=>{window.localStorage&&window.localStorage.getItem("-CBWSDK:SignerConfigurator:SignerType")==="scw"&&await rl(i)},async sendTransaction(n){const s=await i.request({method:"eth_sendTransaction",params:[{accessList:n.accessList,data:n.data,from:Z(t),gas:n.gas?De(n.gas):void 0,to:n.to,value:n.value?De(n.value):void 0}]});return Ns({chainId:n.chainId,client:e,contractAddress:n.to??void 0,gasPrice:n.gasPrice,transactionHash:s,walletAddress:Z(t),walletType:ft}),{transactionHash:s}},async signMessage({message:n}){if(!r.address)throw new Error("Provider not setup");const s=typeof n=="string"?ks(n):n.raw instanceof Uint8Array?Us(n.raw):n.raw,o=await i.request({method:"personal_sign",params:[s,r.address]});if(!nr(o))throw new Error("Invalid signature returned");return o},async signTypedData(n){if(!r.address)throw new Error("Provider not setup");const{domain:s,message:o,primaryType:c}=Ks(n),l={EIP712Domain:$c(s),...n.types};kc({domain:s,message:o,primaryType:c,types:l});const u=Uc({domain:s??{},message:o,primaryType:c,types:l}),h=await i.request({method:"eth_signTypedData_v4",params:[r.address,u]});if(!nr(h))throw new Error("Invalid signed payload returned");return h},sendCalls:async n=>{try{const{callParams:s,chain:o}=await Hs(n,r),c=await i.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(n){try{const s=await i.request({method:"wallet_getCallsStatus",params:[n.id]});return Fs(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(n){try{return await i.request({method:"wallet_getCallsStatus",params:[n.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(n){const s=n.chainId;try{const o=await i.request({method:"wallet_getCapabilities",params:[Z(r.address)]});return Ws(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 r}function sl(i,t,e,r,n){const s=$o({address:i,client:n,provider:e});async function o(){e.removeListener("accountsChanged",l),e.removeListener("chainChanged",u),e.removeListener("disconnect",c),await e.disconnect()}async function c(){o(),r.emit("disconnect",void 0)}function l(h){if(h[0]){const d=$o({address:Z(h[0]),client:n,provider:e});r.emit("accountChanged",d),r.emit("accountsChanged",h)}else c()}function u(h){const d=ge(lt(h));r.emit("chainChanged",d)}return e.on("accountsChanged",l),e.on("chainChanged",u),e.on("disconnect",c),[s,t,c,h=>ol(e,h)]}async function Dd(i,t,e){const r=await e.request({method:"eth_requestAccounts"});if(!r[0])throw new Error("No accounts found");const n=Z(r[0]),s=await e.request({method:"eth_chainId"}),o=lt(s);let c=i.chain&&i.chain.id===o?i.chain:ge(o);return o&&(i!=null&&i.chain)&&o!==(i==null?void 0:i.chain.id)&&(await ol(e,i.chain),c=i.chain),sl(n,c,e,t,i.client)}async function Vd(i,t,e){const n=(await e.request({method:"eth_accounts"}))[0];if(!n)throw new Error("No accounts found");const s=await e.request({method:"eth_chainId"}),o=lt(s),c=i.chain&&i.chain.id===o?i.chain:ge(o);return sl(n,c,e,t,i.client)}async function ol(i,t){var s;const e=await i.request({method:"eth_chainId"}),r=ge(lt(e));if((r==null?void 0:r.id)===t.id)return;const n=De(t.id);try{await i.request({method:"wallet_switchEthereumChain",params:[{chainId:n}]})}catch(o){const c=await $s(t);(o==null?void 0:o.code)===4902&&await i.request({method:"wallet_addEthereumChain",params:[{blockExplorerUrls:((s=c.explorers)==null?void 0:s.map(l=>l.url))||[],chainId:n,chainName:c.name,nativeCurrency:c.nativeCurrency,rpcUrls:Gs(c)}]})}}const ko=Object.freeze(Object.defineProperty({__proto__:null,autoConnectCoinbaseWalletSDK:Vd,connectCoinbaseWalletSDK:Dd,getCoinbaseWebProvider:nl},Symbol.toStringTag,{value:"Module"}));async function xd(i){return Nc(async()=>{var r;const e=await(await fetch(`${nn("inAppWallet")}/api/2024-05-05/ecosystem-wallet`,{headers:{"x-ecosystem-id":i}})).json();if(!e||e.code==="UNAUTHORIZED")throw new Error(e.message||`Could not find ecosystem wallet with id ${i}, please check your ecosystem wallet configuration.`);return(r=e.authOptions)!=null&&r.includes("siwe")&&(e.authOptions=e.authOptions.filter(n=>n!=="siwe"),e.authOptions.push("wallet")),e},{cacheKey:`ecosystem-wallet-options-${i}`,cacheTime:1e3*60*5})}const vn=new Map;async function Wi(i,t,e){var s;const r=we({clientId:i.clientId,ecosystem:e,partialSecretKey:(s=i.secretKey)==null?void 0:s.slice(0,5)});if(vn.has(r))return vn.get(r);const n=await t(i);return vn.set(r,n),n}function al(i){const{createOptions:t,connectorFactory:e,ecosystem:r}=i,n=r?r.id:"inApp",s=hi();let o=t,c,l,u,h,d=null;const p=async _=>{if(r){const f=await xd(r.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,R=(_==null?void 0:_.chain)??(b?ge(b):void 0);if(!R)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:R,factoryAddress:m.accountFactoryAddress,sponsorGas:m.sponsorGas}}}}};return{autoConnect:async _=>{const{autoConnectInAppWallet:f}=await a(async()=>{const{autoConnectInAppWallet:v}=await Promise.resolve().then(()=>Hn);return{autoConnectInAppWallet:v}},void 0),m=await Wi(_.client,e,r);await p();const{account:y,chain:b,adminAccount:R}=await f(_,o,m);h=_.client,c=y,l=R,u=b;try{d=await m.storage.getAuthCookie()}catch(v){console.error("Failed to retrieve auth token:",v),d=null}return qe({chainId:u.id,client:_.client,ecosystem:r,walletAddress:c.address,walletType:n}),c},connect:async _=>{const{connectInAppWallet:f}=await a(async()=>{const{connectInAppWallet:v}=await Promise.resolve().then(()=>Hn);return{connectInAppWallet:v}},void 0),m=await Wi(_.client,e,r);await p();const{account:y,chain:b,adminAccount:R}=await f(_,o,m);h=_.client,c=y,l=R,u=b;try{d=await m.storage.getAuthCookie()}catch(v){console.error("Failed to retrieve auth token:",v),d=null}return qe({chainId:u.id,client:_.client,ecosystem:r,walletAddress:c.address,walletType:n}),c},disconnect:async()=>{if(h&&!(await(await Wi(h,e,r)).logout()).success)throw new Error("Failed to logout");c=void 0,l=void 0,u=void 0,d=null,s.emit("disconnect",void 0)},getAccount:()=>c,getAdminAccount:()=>l,getAuthToken:()=>d,getChain(){if(u)return u=li(u.id)||u,u},getConfig:()=>o,id:n,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")&&h&&c){const{autoConnectInAppWallet:m}=await a(async()=>{const{autoConnectInAppWallet:P}=await Promise.resolve().then(()=>Hn);return{autoConnectInAppWallet:P}},void 0),y=await Wi(h,e,r);await p({chain:_});const{account:b,chain:R,adminAccount:v}=await m({chain:_,client:h},o,y);l=v,c=b,u=R}else u=_;s.emit("chainChanged",_)}}}function cl(...i){const[t,e]=i,r={id:t,partnerId:e==null?void 0:e.partnerId};return al({connectorFactory:async n=>{const{InAppWebConnector:s}=await a(async()=>{const{InAppWebConnector:o}=await import("./web-connector-3zdQreYv.js");return{InAppWebConnector:o}},__vite__mapDeps([16,1,2,3,4,5,6,7,8,9,10]));return new s({client:n,ecosystem:r,storage:e==null?void 0:e.storage})},createOptions:{auth:{...e==null?void 0:e.auth,options:[]},partnerId:r.partnerId},ecosystem:r})}function Zn(i){return al({connectorFactory:async t=>{var r;const{InAppWebConnector:e}=await a(async()=>{const{InAppWebConnector:n}=await import("./web-connector-3zdQreYv.js");return{InAppWebConnector:n}},__vite__mapDeps([16,1,2,3,4,5,6,7,8,9,10]));return new e({client:t,passkeyDomain:(r=i==null?void 0:i.auth)==null?void 0:r.passkeyDomain,storage:i==null?void 0:i.storage})},createOptions:i})}function Ys(i){const t=hi();let e,r,n,s;return{autoConnect:async o=>{const{connectSmartAccount:c}=await a(async()=>{const{connectSmartAccount:h}=await import("./index-CA_7NqLN.js");return{connectSmartAccount:h}},__vite__mapDeps([17,1,18,2,3,4,5,6,7,8,9,10])),[l,u]=await c(o,i);return s=o,e=l,n=u,qe({chainId:n.id,client:o.client,walletAddress:e.address,walletType:"smart"}),e},connect:async o=>{const{connectSmartAccount:c}=await a(async()=>{const{connectSmartAccount:h}=await import("./index-CA_7NqLN.js");return{connectSmartAccount:h}},__vite__mapDeps([17,1,18,2,3,4,5,6,7,8,9,10])),[l,u]=await c(o,i);return r=o.personalAccount,s=o,e=l,n=u,qe({chainId:n.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-CA_7NqLN.js");return{disconnectSmartAccount:c}},__vite__mapDeps([17,1,18,2,3,4,5,6,7,8,9,10]));await o(e)}e=void 0,r=void 0,n=void 0,t.emit("disconnect",void 0)},getAccount:()=>e,getAdminAccount:()=>r,getChain(){if(n)return n=li(n.id)||n,n},getConfig:()=>i,id:"smart",subscribe:t.subscribe,switchChain:async o=>{var d;if(!s)throw new Error("Cannot switch chain without a previous connection");if(!await dh(o)){const p=Bs({address:i.factoryAddress||ph((d=i.overrides)==null?void 0:d.entrypointAddress),chain:o,client:s.client});if(!await _h(p))throw new Error(`Factory contract not deployed on chain: ${o.id}`)}const{connectSmartAccount:l}=await a(async()=>{const{connectSmartAccount:p}=await import("./index-CA_7NqLN.js");return{connectSmartAccount:p}},__vite__mapDeps([17,1,18,2,3,4,5,6,7,8,9,10])),[u,h]=await l({...s,chain:o},{...i,chain:o});e=u,n=h,t.emit("accountChanged",u),t.emit("chainChanged",h)}}}function at(...i){const[t,e]=i;switch(!0){case t==="smart":return Ys(e);case(t==="embedded"||t==="inApp"):return Zn(e);case Oi(t):return cl(...i);case t===ft:{const r=e;return Rd({createOptions:r,onConnectRequested:async n=>{const{showCoinbasePopup:s}=await a(async()=>{const{showCoinbasePopup:o}=await Promise.resolve().then(()=>Ld);return{showCoinbasePopup:o}},void 0);return s(n)},providerFactory:()=>nl(r)})}case t===Pt:{const r=e;return Td({createOptions:r,providerFactory:()=>Xc(r)})}default:{let c=function(){n=void 0,s=void 0};const r=hi();let n,s,o,l=async()=>{};const u=r.subscribe("disconnect",()=>{c(),o==null||o(),u()});r.subscribe("accountChanged",_=>{n=_});let h=async()=>{throw new Error("Not implemented yet")};const d=xo()?_=>wn(_):void 0,p={autoConnect:async _=>{const{injectedProvider:f}=await a(async()=>{const{injectedProvider:m}=await Promise.resolve().then(()=>No);return{injectedProvider:m}},void 0);if(t!=="walletConnect"&&f(t)){const{autoConnectEip1193Wallet:m}=await a(async()=>{const{autoConnectEip1193Wallet:P}=await Promise.resolve().then(()=>Mo);return{autoConnectEip1193Wallet:P}},void 0),[y,b,R,v]=await m({chain:_.chain,client:_.client,emitter:r,id:t,provider:Qn(t)});return n=y,s=b,l=R,h=v,o=r.subscribe("chainChanged",P=>{s=P}),qe({chainId:s.id,client:_.client,walletAddress:n.address,walletType:t}),n}if(_&&"client"in _){const{autoConnectWC:m}=await a(async()=>{const{autoConnectWC:P}=await import("./controller-BFbz0Wfy.js");return{autoConnectWC:P}},__vite__mapDeps([19,1,2,3,4,5,6,7,8,9,10])),[y,b,R,v]=await m(_,r,p.id,Fr,d);return n=y,s=b,l=R,h=v,qe({chainId:s.id,client:_.client,walletAddress:n.address,walletType:t}),n}throw new Error("Failed to auto connect")},connect:async _=>{async function f(b){var P;const{connectWC:R}=await a(async()=>{const{connectWC:T}=await import("./controller-BFbz0Wfy.js");return{connectWC:T}},__vite__mapDeps([19,1,2,3,4,5,6,7,8,9,10]));let v;try{const[T,g,D,L]=await R({...b,walletConnect:{...b.walletConnect,onDisplayUri:((P=b.walletConnect)==null?void 0:P.onDisplayUri)||(async w=>{var E,I;if(typeof window<"u"&&typeof document<"u")if(xo()){const A=await Qc(t),V=A.mobile.native||A.mobile.universal;wn(V?gd(V,w).redirect:w);return}else try{const{createQROverlay:A}=await a(async()=>{const{createQROverlay:V}=await import("./qr-overlay-CRwPPsut.js");return{createQROverlay:V}},__vite__mapDeps([20,1]));v&&v.destroy(),v=A(w,{theme:((I=(E=b.walletConnect)==null?void 0:E.qrModalOptions)==null?void 0:I.themeMode)??"dark",qrSize:280,showCloseButton:!0,onCancel:()=>{var V,O;(O=(V=b.walletConnect)==null?void 0:V.onCancel)==null||O.call(V)}})}catch(A){console.error("Failed to create QR overlay:",A)}})}},r,p.id,Fr,d);return v&&(v.destroy(),v=void 0),n=T,s=g,l=D,h=L,qe({chainId:s.id,client:b.client,walletAddress:n.address,walletType:t}),n}catch(T){throw v&&(v.destroy(),v=void 0),T}}if(t==="walletConnect"){const{client:b,chain:R,...v}=_;return f({chain:R,client:b,walletConnect:{...v}})}const m=_&&"walletConnect"in _,{injectedProvider:y}=await a(async()=>{const{injectedProvider:b}=await Promise.resolve().then(()=>No);return{injectedProvider:b}},void 0);if(y(t)&&!m){const{connectEip1193Wallet:b}=await a(async()=>{const{connectEip1193Wallet:g}=await Promise.resolve().then(()=>Mo);return{connectEip1193Wallet:g}},void 0),[R,v,P,T]=await b({chain:_.chain,client:_.client,emitter:r,id:t,provider:Qn(t)});return n=R,s=v,l=P,h=T,o=r.subscribe("chainChanged",g=>{s=g}),qe({chainId:s.id,client:_.client,walletAddress:n.address,walletType:t}),n}if(_&&"client"in _)return f(_);throw new Error("Failed to connect")},disconnect:async()=>{c(),await l()},getAccount:()=>n,getChain(){if(s)return s=li(s.id)||s,s},getConfig:()=>i[1],id:t,subscribe:r.subscribe,switchChain:async _=>{try{await h(_),s=_}catch(f){console.error("Error switching chain",f)}}};return p}}}function Sd(){return at("walletConnect")}const Uo=Gc()?Zh():void 0;function Zs(i){const t=Qs().find(e=>e.info.rdns===i);return t==null?void 0:t.provider}function ll(){return Qs().map(e=>e.info.rdns).map(e=>at(e))}function Cd(){if(Uo)return Uo}function Qs(){var t;const i=((t=Cd())==null?void 0:t.getProviders())||[];for(const e of i)if(e.info.rdns==="io.metamask.mobile"){e.info.rdns=Jc;break}return i}const No=Object.freeze(Object.defineProperty({__proto__:null,getInstalledWalletProviders:Qs,getInstalledWallets:ll,injectedProvider:Zs},Symbol.toStringTag,{value:"Module"}));function Qn(i){const t=Zs(i);if(!t)throw new Error(`No injected provider found for wallet: "${i}"`);return t}async function ul({id:i,provider:t,emitter:e,client:r,chain:n}){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=$d(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),h=await t.request({method:"eth_chainId"}).then(lt).catch(f=>{throw new Error("Error reading chainId from provider",f)});let d=n&&n.id===h?n:ge(h);try{n&&typeof n.id<"u"&&n.id!==h&&(await pl(t,n),d=n)}catch{console.warn(`Error switching to chain ${n==null?void 0:n.id} - defaulting to wallet chain (${h})`)}return dl({address:u,chain:d,client:r,emitter:e,id:i,provider:t})}async function hl({id:i,provider:t,emitter:e,client:r,chain:n}){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=n&&n.id===l?n:ge(l);return dl({address:c,chain:u,client:r,emitter:e,id:i,provider:t})}function Bo({provider:i,address:t,client:e,id:r}){const n={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?Eh(s.authorizationList):void 0,accessList:s.accessList,...s.eip712}];try{const l=await i.request({method:"eth_sendTransaction",params:c});return Ns({chainId:s.chainId,client:e,contractAddress:s.to??void 0,gasPrice:s.gasPrice,transactionHash:l,walletAddress:Z(t),walletType:r}),{transactionHash:l}}catch(l){throw vh(l)&&bh({chainId:s.chainId,client:e,contractAddress:s.to||void 0,error:l,transactionValue:s.value,walletAddress:Z(t)}),l}},async signMessage({message:s}){if(!n.address)throw new Error("Provider not setup");const o=typeof s=="string"?ks(s):s.raw instanceof Uint8Array?Us(s.raw):s.raw;return await i.request({method:"personal_sign",params:[o,Z(n.address)]})},async signAuthorization(s){const o=Bc(s);let c;try{c=await i.request({method:"eth_sign",params:[Z(n.address),o]})}catch{c=await i.request({method:"secp256k1_sign",params:[o]})}if(!c)throw new Error("Failed to sign authorization");const l=gh(c);return{...s,...l}},async signTypedData(s){if(!i||!n.address)throw new Error("Provider not setup");const o=Ks(s),{domain:c,message:l,primaryType:u}=o,h={EIP712Domain:mh({domain:c}),...o.types};yh({domain:c,message:l,primaryType:u,types:h});const d=wh({domain:c??{},message:l,primaryType:u,types:h});return await i.request({method:"eth_signTypedData_v4",params:[Z(n.address),d]})},async watchAsset(s){return await i.request({method:"wallet_watchAsset",params:s},{retryCount:0})},async sendCalls(s){try{const{callParams:o,chain:c}=await Hs(s,n),l=await i.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(`${r} errored calling wallet_sendCalls, with error: ${o instanceof Error?o.message:fh(o)}`):o}},async getCallsStatus(s){try{const o=await i.request({method:"wallet_getCallsStatus",params:[s.id]});return Fs(o)}catch(o){throw/unsupport|not support/i.test(o.message)?new Error(`${r} does not support wallet_getCallsStatus, reach out to them directly to request EIP-5792 support.`):o}},async getCallsStatusRaw(s){try{return await i.request({method:"wallet_getCallsStatus",params:[s.id]})}catch(o){throw/unsupport|not support/i.test(o.message)?new Error(`${r} 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 i.request({method:"wallet_getCapabilities",params:[Z(n.address),o?[De(o)]:void 0]});return Ws(c,o)}catch(c){if(/unsupport|not support|not available/i.test(c.message))return{message:`${r} does not support wallet_getCapabilities, reach out to them directly to request EIP-5792 support.`};throw c}}};return n}async function dl({provider:i,address:t,chain:e,emitter:r,client:n,id:s}){const o=Bo({address:t,client:n,id:s,provider:i});async function c(){i.removeListener("accountsChanged",u),i.removeListener("chainChanged",h),i.removeListener("disconnect",l);try{await Ih(()=>i.request({method:"wallet_revokePermissions",params:[{eth_accounts:{}}]}),{timeout:100})}catch{}}async function l(){c(),r.emit("disconnect",void 0)}function u(d){if(d[0]){const p=Bo({address:Z(d[0]),client:n,id:s,provider:i});r.emit("accountChanged",p),r.emit("accountsChanged",d)}else l()}function h(d){const p=ge(lt(d));r.emit("chainChanged",p)}return i.on&&(i.on("accountsChanged",u),i.on("chainChanged",h),i.on("disconnect",l)),[o,e,l,d=>pl(i,d)]}async function pl(i,t){var r;const e=De(t.id);try{await i.request({method:"wallet_switchEthereumChain",params:[{chainId:e}]})}catch{const n=await $s(t);await i.request({method:"wallet_addEthereumChain",params:[{blockExplorerUrls:(r=n.explorers)==null?void 0:r.map(s=>s.url),chainId:e,chainName:n.name,nativeCurrency:n.nativeCurrency,rpcUrls:Gs(n)}]})}}function $d(i){return i instanceof Error?i.message:typeof i=="string"?i:typeof i=="object"&&i!==null?JSON.stringify(i):String(i)}const Mo=Object.freeze(Object.defineProperty({__proto__:null,autoConnectEip1193Wallet:hl,connectEip1193Wallet:ul,getInjectedProvider:Qn},Symbol.toStringTag,{value:"Module"}));function kd(i){const t=i.walletId??"adapter",e=hi();let r,n,s;const o=async p=>(s=typeof i.provider=="function"?await i.provider(p):i.provider,s),c=e.subscribe("chainChanged",p=>{n=p});function l(){r=void 0,n=void 0}let u=async()=>{};const h=e.subscribe("disconnect",()=>{l(),c(),h()});e.subscribe("accountChanged",p=>{r=p});let d=async p=>{await(s==null?void 0:s.request({method:"wallet_switchEthereumChain",params:[{chainId:Ah(p.id)}]}))};return{autoConnect:async p=>{var b;const[_,f,m,y]=await hl({chain:p.chain,client:p.client,emitter:e,id:t,provider:await o({chainId:(b=p.chain)==null?void 0:b.id})});return r=_,n=f,u=m,d=y,e.emit("onConnect",p),qe({client:p.client,walletAddress:r.address,walletType:t}),r},connect:async p=>{var b;const[_,f,m,y]=await ul({chain:p.chain,client:p.client,emitter:e,id:t,provider:await o({chainId:(b=p.chain)==null?void 0:b.id})});return r=_,n=f,u=m,d=y,e.emit("onConnect",p),qe({client:p.client,walletAddress:r.address,walletType:t}),r},disconnect:async()=>{l(),await u(),e.emit("disconnect",void 0)},getAccount:()=>r,getChain(){if(n)return n=li(n.id)||n,n},getConfig:()=>{},id:t,subscribe:e.subscribe,switchChain:async p=>{await d(p),e.emit("chainChanged",p)}}}function Ud(i){const{chain:t,client:e,wallet:r,connectOverride:n}=i,s=sn({chain:t,client:e});return{on:r.subscribe,removeListener:()=>{},request:async o=>{switch(o.method){case"eth_sendTransaction":{const c=r.getAccount();if(!c)throw new Error("Account not connected");return(await Mc({account:c,transaction:Jn({...o.params[0],chain:t,client:e})})).transactionHash}case"eth_estimateGas":{const c=r.getAccount();if(!c)throw new Error("Account not connected");return Th({account:c,transaction:Jn({...o.params[0],chain:t,client:e})})}case"personal_sign":{const c=r.getAccount();if(!c)throw new Error("Account not connected");return c.signMessage({message:{raw:o.params[0]}})}case"eth_signTypedData_v4":{const c=r.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=r.getAccount();return c?[c.address]:[]}case"eth_requestAccounts":{const c=r.getAccount();if(c)return[c.address];const l=n?await n(r):await r.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=zr(l)?si(l):l,h=ge(u);return r.switchChain(h)}case"wallet_getCapabilities":{const c=r.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],h=zr(u)?si(u):Number(u);return c.getCapabilities(h?{chainId:h}:{})}return c.getCapabilities({})}case"wallet_sendCalls":{const c=r.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=r.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 Nd=Object.freeze(Object.defineProperty({__proto__:null,fromProvider:kd,toProvider:Ud},Symbol.toStringTag,{value:"Module"}));function Bd(i){const t=hi();let e=i.chain;return{autoConnect:async()=>(t.emit("onConnect",i),i.adaptedAccount),connect:async()=>(t.emit("onConnect",i),i.adaptedAccount),disconnect:async()=>{await i.onDisconnect(),t.emit("disconnect",void 0)},getAccount(){return i.adaptedAccount},getChain(){return e=li(e.id)||e,e},getConfig(){return i},id:"adapter",subscribe:t.subscribe,switchChain:async r=>{await i.switchChain(r),e=r,t.emit("chainChanged",r)}}}async function Md(){return(await a(async()=>{const{default:i}=await import("./wallet-infos-BHI_w6r-.js");return{default:i}},[])).default}async function di(i,t){return Wi(i,async e=>{const{InAppWebConnector:r}=await a(async()=>{const{InAppWebConnector:n}=await import("./web-connector-3zdQreYv.js");return{InAppWebConnector:n}},__vite__mapDeps([16,1,2,3,4,5,6,7,8,9,10]));return new r({client:e,ecosystem:t})},t)}async function _l(i){const{client:t,ecosystem:e}=i,n=await(await di(t,e)).getUser();switch(n.status){case"Logged In, Wallet Initialized":return n}}async function qd(i){const t=await _l(i);if(t&&"email"in t.authDetails)return t.authDetails.email}async function zd(i){const t=await _l(i);if(t&&"phoneNumber"in t.authDetails)return t.authDetails.phoneNumber}async function jd(i){return(await di(i.client,i.ecosystem)).preAuthenticate(i)}async function Kd(i){return(await di(i.client,i.ecosystem)).authenticate(i)}async function Fd(i){const t=await di(i.client,i.ecosystem);if(!t.authenticateWithRedirect)throw new Error("authenticateWithRedirect is not supported on this platform");return t.authenticateWithRedirect(i.strategy,i.mode,i.redirectUrl)}async function Wd(i){return await(await di(i.client,i.ecosystem)).linkProfile(i)}async function Hd(i){return await(await di(i.client,i.ecosystem)).unlinkProfile(i.profileToUnlink,i.allowAccountDeletion)}async function Gd(i){return(await di(i.client,i.ecosystem)).getProfiles()}function Jd(i){if("privateKey"in i){const t=Ph(typeof i.message=="object"?i.message.raw:Oh(i.message)),e=Ms({payload:t,privateKey:i.privateKey});return qc(e)}if("account"in i){const{message:t,account:e}=i;return e.signMessage({message:t})}throw new Error("Either privateKey or account is required")}function Yd(i){var s;const{privateKey:t,...e}=i;typeof((s=e.domain)==null?void 0:s.chainId)=="string"&&(e.domain.chainId=Sc(e.domain.chainId));const r=Rh(e),n=Ms({payload:r,privateKey:t});return qc(n)}function Xn(i){const{client:t}=i,e=`0x${i.privateKey.replace(/^0x/,"")}`,r=qs(zc.getPublicKey(e.slice(2),!1)),n=Lh(r);return{address:Z(n),sendTransaction:async o=>{const c=sn({chain:ge(o.chainId),client:t}),l=Oo({privateKey:e,transaction:o});return{transactionHash:await Vh(c,l)}},signAuthorization:async o=>{const c=Ms({payload:Bc(o),privateKey:e});return Dh(o,{signature:c})},signMessage:async({message:o})=>Jd({message:o,privateKey:e}),signTransaction:async o=>Oo({privateKey:e,transaction:o}),signTypedData:async o=>Yd({...o,privateKey:e})}}async function Zd(i){const t=qs(zc.utils.randomPrivateKey());return Xn({client:i.client,privateKey:t})}async function Qd(i){const{address:t,client:e,chain:r}=i,n=i.tokenAddress||(r.id===42429?"0x20c0000000000000000000000000000000000000":void 0);if(n&&Z(n)!==Z(Ro)){const{getBalance:h}=await a(async()=>{const{getBalance:d}=await import("./getBalance-lwqG5BkA.js");return{getBalance:d}},__vite__mapDeps([21,1]));return h({address:t,contract:Bs({address:n,chain:r,client:e})})}const s=sn({chain:r,client:e}),[o,c,l,u]=await Promise.all([xh(r),Sh(r),Ch(r),$h(s,{address:t})]);return{chainId:r.id,decimals:c,displayValue:kh(u,c),name:l,symbol:o,tokenAddress:n??Ro,value:u}}function Xd(i){return!i||typeof i.then!="function"?Promise.resolve(i):i}function ye(i,...t){try{return Xd(i(...t))}catch(e){return Promise.reject(e)}}function ep(i){const t=typeof i;return i===null||t!=="object"&&t!=="function"}function tp(i){const t=Object.getPrototypeOf(i);return!t||t.isPrototypeOf(Object)}function Cr(i){if(ep(i))return String(i);if(tp(i)||Array.isArray(i))return JSON.stringify(i);if(typeof i.toJSON=="function")return Cr(i.toJSON());throw new Error("[unstorage] Cannot stringify value!")}const es="base64:";function ip(i){return typeof i=="string"?i:es+sp(i)}function rp(i){return typeof i!="string"||!i.startsWith(es)?i:np(i.slice(es.length))}function np(i){return globalThis.Buffer?ee.from(i,"base64"):Uint8Array.from(globalThis.atob(i),t=>t.codePointAt(0))}function sp(i){return globalThis.Buffer?ee.from(i).toString("base64"):globalThis.btoa(String.fromCodePoint(...i))}function ke(i){var t;return i&&((t=i.split("?")[0])==null?void 0:t.replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,""))||""}function op(...i){return ke(i.join(":"))}function Ar(i){return i=ke(i),i?i+":":""}function ap(i,t){if(t===void 0)return!0;let e=0,r=i.indexOf(":");for(;r>-1;)e++,r=i.indexOf(":",r+1);return e<=t}function cp(i,t){return t?i.startsWith(t)&&i[i.length-1]!=="$":i[i.length-1]!=="$"}const lp="memory",up=()=>{const i=new Map;return{name:lp,getInstance:()=>i,hasItem(t){return i.has(t)},getItem(t){return i.get(t)??null},getItemRaw(t){return i.get(t)??null},setItem(t,e){i.set(t,e)},setItemRaw(t,e){i.set(t,e)},removeItem(t){i.delete(t)},getKeys(){return[...i.keys()]},clear(){i.clear()},dispose(){i.clear()}}};function hp(i={}){const t={mounts:{"":i.driver||up()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},e=u=>{for(const h of t.mountpoints)if(u.startsWith(h))return{base:h,relativeKey:u.slice(h.length),driver:t.mounts[h]};return{base:"",relativeKey:u,driver:t.mounts[""]}},r=(u,h)=>t.mountpoints.filter(d=>d.startsWith(u)||h&&u.startsWith(d)).map(d=>({relativeBase:u.length>d.length?u.slice(d.length):void 0,mountpoint:d,driver:t.mounts[d]})),n=(u,h)=>{if(t.watching){h=ke(h);for(const d of t.watchListeners)d(u,h)}},s=async()=>{if(!t.watching){t.watching=!0;for(const u in t.mounts)t.unwatch[u]=await qo(t.mounts[u],n,u)}},o=async()=>{if(t.watching){for(const u in t.unwatch)await t.unwatch[u]();t.unwatch={},t.watching=!1}},c=(u,h,d)=>{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,R=m||!f.options?h:{...h,...f.options},v=e(y);_(v).items.push({key:y,value:b,relativeKey:v.relativeKey,options:R})}return Promise.all([...p.values()].map(f=>d(f))).then(f=>f.flat())},l={hasItem(u,h={}){u=ke(u);const{relativeKey:d,driver:p}=e(u);return ye(p.hasItem,d,h)},getItem(u,h={}){u=ke(u);const{relativeKey:d,driver:p}=e(u);return ye(p.getItem,d,h).then(_=>br(_))},getItems(u,h={}){return c(u,h,d=>d.driver.getItems?ye(d.driver.getItems,d.items.map(p=>({key:p.relativeKey,options:p.options})),h).then(p=>p.map(_=>({key:op(d.base,_.key),value:br(_.value)}))):Promise.all(d.items.map(p=>ye(d.driver.getItem,p.relativeKey,p.options).then(_=>({key:p.key,value:br(_)})))))},getItemRaw(u,h={}){u=ke(u);const{relativeKey:d,driver:p}=e(u);return p.getItemRaw?ye(p.getItemRaw,d,h):ye(p.getItem,d,h).then(_=>rp(_))},async setItem(u,h,d={}){if(h===void 0)return l.removeItem(u);u=ke(u);const{relativeKey:p,driver:_}=e(u);_.setItem&&(await ye(_.setItem,p,Cr(h),d),_.watch||n("update",u))},async setItems(u,h){await c(u,h,async d=>{if(d.driver.setItems)return ye(d.driver.setItems,d.items.map(p=>({key:p.relativeKey,value:Cr(p.value),options:p.options})),h);d.driver.setItem&&await Promise.all(d.items.map(p=>ye(d.driver.setItem,p.relativeKey,Cr(p.value),p.options)))})},async setItemRaw(u,h,d={}){if(h===void 0)return l.removeItem(u,d);u=ke(u);const{relativeKey:p,driver:_}=e(u);if(_.setItemRaw)await ye(_.setItemRaw,p,h,d);else if(_.setItem)await ye(_.setItem,p,ip(h),d);else return;_.watch||n("update",u)},async removeItem(u,h={}){typeof h=="boolean"&&(h={removeMeta:h}),u=ke(u);const{relativeKey:d,driver:p}=e(u);p.removeItem&&(await ye(p.removeItem,d,h),(h.removeMeta||h.removeMata)&&await ye(p.removeItem,d+"$",h),p.watch||n("remove",u))},async getMeta(u,h={}){typeof h=="boolean"&&(h={nativeOnly:h}),u=ke(u);const{relativeKey:d,driver:p}=e(u),_=Object.create(null);if(p.getMeta&&Object.assign(_,await ye(p.getMeta,d,h)),!h.nativeOnly){const f=await ye(p.getItem,d+"$",h).then(m=>br(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,h,d={}){return this.setItem(u+"$",h,d)},removeMeta(u,h={}){return this.removeItem(u+"$",h)},async getKeys(u,h={}){var y;u=Ar(u);const d=r(u,!0);let p=[];const _=[];let f=!0;for(const b of d){(y=b.driver.flags)!=null&&y.maxDepth||(f=!1);const R=await ye(b.driver.getKeys,b.relativeBase,h);for(const v of R){const P=b.mountpoint+ke(v);p.some(T=>P.startsWith(T))||_.push(P)}p=[b.mountpoint,...p.filter(v=>!v.startsWith(b.mountpoint))]}const m=h.maxDepth!==void 0&&!f;return _.filter(b=>(!m||ap(b,h.maxDepth))&&cp(b,u))},async clear(u,h={}){u=Ar(u),await Promise.all(r(u,!1).map(async d=>{if(d.driver.clear)return ye(d.driver.clear,d.relativeBase,h);if(d.driver.removeItem){const p=await d.driver.getKeys(d.relativeBase||"",h);return Promise.all(p.map(_=>d.driver.removeItem(_,h)))}}))},async dispose(){await Promise.all(Object.values(t.mounts).map(u=>zo(u)))},async watch(u){return await s(),t.watchListeners.push(u),async()=>{t.watchListeners=t.watchListeners.filter(h=>h!==u),t.watchListeners.length===0&&await o()}},async unwatch(){t.watchListeners=[],await o()},mount(u,h){if(u=Ar(u),u&&t.mounts[u])throw new Error(`already mounted at ${u}`);return u&&(t.mountpoints.push(u),t.mountpoints.sort((d,p)=>p.length-d.length)),t.mounts[u]=h,t.watching&&Promise.resolve(qo(h,n,u)).then(d=>{t.unwatch[u]=d}).catch(console.error),l},async unmount(u,h=!0){var d,p;u=Ar(u),!(!u||!t.mounts[u])&&(t.watching&&u in t.unwatch&&((p=(d=t.unwatch)[u])==null||p.call(d),delete t.unwatch[u]),h&&await zo(t.mounts[u]),t.mountpoints=t.mountpoints.filter(_=>_!==u),delete t.mounts[u])},getMount(u=""){u=ke(u)+":";const h=e(u);return{driver:h.driver,base:h.base}},getMounts(u="",h={}){return u=ke(u),r(u,h.parents).map(p=>({driver:p.driver,base:p.mountpoint}))},keys:(u,h={})=>l.getKeys(u,h),get:(u,h={})=>l.getItem(u,h),set:(u,h,d={})=>l.setItem(u,h,d),has:(u,h={})=>l.hasItem(u,h),del:(u,h={})=>l.removeItem(u,h),remove:(u,h={})=>l.removeItem(u,h)};return l}function qo(i,t,e){return i.watch?i.watch((r,n)=>t(r,e+n)):()=>{}}async function zo(i){typeof i.dispose=="function"&&await ye(i.dispose)}const dp="idb-keyval";var pp=(i={})=>{const t=i.base&&i.base.length>0?`${i.base}:`:"",e=n=>t+n;let r;return i.dbName&&i.storeName&&(r=ad(i.dbName,i.storeName)),{name:dp,options:i,async hasItem(n){return!(typeof await Vo(e(n),r)>"u")},async getItem(n){return await Vo(e(n),r)??null},setItem(n,s){return hd(e(n),s,r)},removeItem(n){return ud(e(n),r)},getKeys(){return ld(r)},clear(){return cd(r)}}};const _p="WALLET_CONNECT_V2_INDEXED_DB",fp="keyvaluestorage";let mp=class{constructor(){this.indexedDb=hp({driver:pp({dbName:_p,storeName:fp})})}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,sr(e))}async removeItem(t){await this.indexedDb.removeItem(t)}};var bn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof K<"u"?K:typeof self<"u"?self:{},$r={exports:{}};(function(){let i;function t(){}i=t,i.prototype.getItem=function(e){return this.hasOwnProperty(e)?String(this[e]):null},i.prototype.setItem=function(e,r){this[e]=String(r)},i.prototype.removeItem=function(e){delete this[e]},i.prototype.clear=function(){const e=this;Object.keys(e).forEach(function(r){e[r]=void 0,delete e[r]})},i.prototype.key=function(e){return e=e||0,Object.keys(this)[e]},i.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof bn<"u"&&bn.localStorage?$r.exports=bn.localStorage:typeof window<"u"&&window.localStorage?$r.exports=window.localStorage:$r.exports=new t})();function yp(i){var t;return[i[0],jr((t=i[1])!=null?t:"")]}let wp=class{constructor(){this.localStorage=$r.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(yp)}async getItem(t){const e=this.localStorage.getItem(t);if(e!==null)return jr(e)}async setItem(t,e){this.localStorage.setItem(t,sr(e))}async removeItem(t){this.localStorage.removeItem(t)}};const gp="wc_storage_version",jo=1,Ep=async(i,t,e)=>{const r=gp,n=await t.getItem(r);if(n&&n>=jo){e(t);return}const s=await i.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 i.getItem(c);await t.setItem(c,u),o.push(c)}}await t.setItem(r,jo),e(t),vp(i,o)},vp=async(i,t)=>{t.length&&t.forEach(async e=>{await i.removeItem(e)})};let bp=class{constructor(){this.initialized=!1,this.setInitialized=e=>{this.storage=e,this.initialized=!0};const t=new wp;this.storage=t;try{const e=new mp;Ep(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 In,Ko;function Ip(){if(Ko)return In;Ko=1;function i(e){try{return JSON.stringify(e)}catch{return'"[Circular]"'}}In=t;function t(e,r,n){var s=n&&n.stringify||i,o=1;if(typeof e=="object"&&e!==null){var c=r.length+o;if(c===1)return e;var l=new Array(c);l[0]=s(e);for(var u=1;u<c;u++)l[u]=s(r[u]);return l.join(" ")}if(typeof e!="string")return e;var h=r.length;if(h===0)return e;for(var d="",p=1-o,_=-1,f=e&&e.length||0,m=0;m<f;){if(e.charCodeAt(m)===37&&m+1<f){switch(_=_>-1?_:0,e.charCodeAt(m+1)){case 100:case 102:if(p>=h||r[p]==null)break;_<m&&(d+=e.slice(_,m)),d+=Number(r[p]),_=m+2,m++;break;case 105:if(p>=h||r[p]==null)break;_<m&&(d+=e.slice(_,m)),d+=Math.floor(Number(r[p])),_=m+2,m++;break;case 79:case 111:case 106:if(p>=h||r[p]===void 0)break;_<m&&(d+=e.slice(_,m));var y=typeof r[p];if(y==="string"){d+="'"+r[p]+"'",_=m+2,m++;break}if(y==="function"){d+=r[p].name||"<anonymous>",_=m+2,m++;break}d+=s(r[p]),_=m+2,m++;break;case 115:if(p>=h)break;_<m&&(d+=e.slice(_,m)),d+=String(r[p]),_=m+2,m++;break;case 37:_<m&&(d+=e.slice(_,m)),d+="%",_=m+2,m++,p--;break}++p}++m}return _===-1?e:(_<f&&(d+=e.slice(_)),d)}return In}var An,Fo;function Ap(){if(Fo)return An;Fo=1;const i=Ip();An=n;const t=T().console||{},e={mapHttpRequest:f,mapHttpResponse:f,wrapRequestSerializer:m,wrapResponseSerializer:m,wrapErrorSerializer:m,req:f,res:f,err:p};function r(g,D){return Array.isArray(g)?g.filter(function(w){return w!=="!stdSerializers.err"}):g===!0?Object.keys(D):!1}function n(g){g=g||{},g.browser=g.browser||{};const D=g.browser.transmit;if(D&&typeof D.send!="function")throw Error("pino: transmit option must have a send function");const L=g.browser.write||t;g.browser.write&&(g.browser.asObject=!0);const w=g.serializers||{},E=r(g.browser.serialize,w);let I=g.browser.serialize;Array.isArray(g.browser.serialize)&&g.browser.serialize.indexOf("!stdSerializers.err")>-1&&(I=!1);const A=["error","fatal","warn","info","debug","trace"];typeof L=="function"&&(L.error=L.fatal=L.warn=L.info=L.debug=L.trace=L),g.enabled===!1&&(g.level="silent");const V=g.level||"info",O=Object.create(L);O.log||(O.log=y),Object.defineProperty(O,"levelVal",{get:$}),Object.defineProperty(O,"level",{get:k,set:M});const x={transmit:D,serialize:E,asObject:g.browser.asObject,levels:A,timestamp:_(g)};O.levels=n.levels,O.level=V,O.setMaxListeners=O.getMaxListeners=O.emit=O.addListener=O.on=O.prependListener=O.once=O.prependOnceListener=O.removeListener=O.removeAllListeners=O.listeners=O.listenerCount=O.eventNames=O.write=O.flush=y,O.serializers=w,O._serialize=E,O._stdErrSerialize=I,O.child=C,D&&(O._logEvent=d());function $(){return this.level==="silent"?1/0:this.levels.values[this.level]}function k(){return this._level}function M(U){if(U!=="silent"&&!this.levels.values[U])throw Error("unknown level "+U);this._level=U,s(x,O,"error","log"),s(x,O,"fatal","error"),s(x,O,"warn","error"),s(x,O,"info","log"),s(x,O,"debug","log"),s(x,O,"trace","log")}function C(U,z){if(!U)throw new Error("missing bindings for child Pino");z=z||{},E&&U.serializers&&(z.serializers=U.serializers);const j=z.serializers;if(E&&j){var F=Object.assign({},w,j),W=g.browser.serialize===!0?Object.keys(F):E;delete U.serializers,l([U],W,F,this._stdErrSerialize)}function H(G){this._childLevel=(G._childLevel|0)+1,this.error=u(G,U,"error"),this.fatal=u(G,U,"fatal"),this.warn=u(G,U,"warn"),this.info=u(G,U,"info"),this.debug=u(G,U,"debug"),this.trace=u(G,U,"trace"),F&&(this.serializers=F,this._serialize=W),D&&(this._logEvent=d([].concat(G._logEvent.bindings,U)))}return H.prototype=this,new H(this)}return O}n.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"}},n.stdSerializers=e,n.stdTimeFunctions=Object.assign({},{nullTime:b,epochTime:R,unixTime:v,isoTime:P});function s(g,D,L,w){const E=Object.getPrototypeOf(D);D[L]=D.levelVal>D.levels.values[L]?y:E[L]?E[L]:t[L]||t[w]||y,o(g,D,L)}function o(g,D,L){!g.transmit&&D[L]===y||(D[L]=function(w){return function(){const I=g.timestamp(),A=new Array(arguments.length),V=Object.getPrototypeOf&&Object.getPrototypeOf(this)===t?t:this;for(var O=0;O<A.length;O++)A[O]=arguments[O];if(g.serialize&&!g.asObject&&l(A,this._serialize,this.serializers,this._stdErrSerialize),g.asObject?w.call(V,c(this,L,A,I)):w.apply(V,A),g.transmit){const x=g.transmit.level||D.level,$=n.levels.values[x],k=n.levels.values[L];if(k<$)return;h(this,{ts:I,methodLevel:L,methodValue:k,transmitValue:n.levels.values[g.transmit.level||D.level],send:g.transmit.send,val:D.levelVal},A)}}}(D[L]))}function c(g,D,L,w){g._serialize&&l(L,g._serialize,g.serializers,g._stdErrSerialize);const E=L.slice();let I=E[0];const A={};w&&(A.time=w),A.level=n.levels.values[D];let V=(g._childLevel|0)+1;if(V<1&&(V=1),I!==null&&typeof I=="object"){for(;V--&&typeof E[0]=="object";)Object.assign(A,E.shift());I=E.length?i(E.shift(),E):void 0}else typeof I=="string"&&(I=i(E.shift(),E));return I!==void 0&&(A.msg=I),A}function l(g,D,L,w){for(const E in g)if(w&&g[E]instanceof Error)g[E]=n.stdSerializers.err(g[E]);else if(typeof g[E]=="object"&&!Array.isArray(g[E]))for(const I in g[E])D&&D.indexOf(I)>-1&&I in L&&(g[E][I]=L[I](g[E][I]))}function u(g,D,L){return function(){const w=new Array(1+arguments.length);w[0]=D;for(var E=1;E<w.length;E++)w[E]=arguments[E-1];return g[L].apply(this,w)}}function h(g,D,L){const w=D.send,E=D.ts,I=D.methodLevel,A=D.methodValue,V=D.val,O=g._logEvent.bindings;l(L,g._serialize||Object.keys(g.serializers),g.serializers,g._stdErrSerialize===void 0?!0:g._stdErrSerialize),g._logEvent.ts=E,g._logEvent.messages=L.filter(function(x){return O.indexOf(x)===-1}),g._logEvent.level.label=I,g._logEvent.level.value=A,w(I,g._logEvent,V),g._logEvent=d(O)}function d(g){return{ts:0,messages:[],bindings:g||[],level:{label:"",value:0}}}function p(g){const D={type:g.constructor.name,msg:g.message,stack:g.stack};for(const L in g)D[L]===void 0&&(D[L]=g[L]);return D}function _(g){return typeof g.timestamp=="function"?g.timestamp:g.timestamp===!1?b:R}function f(){return{}}function m(g){return g}function y(){}function b(){return!1}function R(){return Date.now()}function v(){return Math.round(Date.now()/1e3)}function P(){return new Date(Date.now()).toISOString()}function T(){function g(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 g(self)||g(window)||g(this)||{}}}return An}var Ei=Ap();const on=Uh(Ei),Tp={level:"info"},mr="custom_context",Xs=1e3*1024;let Pp=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}},Wo=class{constructor(t){this.head=null,this.tail=null,this.lengthInNodes=0,this.maxSizeInBytes=t,this.sizeInBytes=0}append(t){const e=new Pp(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 fl{constructor(t,e=Xs){this.level=t??"error",this.levelValue=Ei.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=e,this.logs=new Wo(this.MAX_LOG_SIZE_IN_BYTES)}forwardToConsole(t,e){e===Ei.levels.values.error?console.error(t):e===Ei.levels.values.warn?console.warn(t):e===Ei.levels.values.debug?console.debug(t):e===Ei.levels.values.trace?console.trace(t):console.log(t)}appendToLogs(t){this.logs.append(sr({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 Wo(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(t){const e=this.getLogArray();return e.push(sr({extraMetadata:t})),new Blob(e,{type:"application/json"})}}let Op=class{constructor(t,e=Xs){this.baseChunkLogger=new fl(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)),r=document.createElement("a");r.href=e,r.download=`walletconnect-logs-${new Date().toISOString()}.txt`,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(e)}},Rp=class{constructor(t,e=Xs){this.baseChunkLogger=new fl(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 Lp=Object.defineProperty,Dp=Object.defineProperties,Vp=Object.getOwnPropertyDescriptors,Ho=Object.getOwnPropertySymbols,xp=Object.prototype.hasOwnProperty,Sp=Object.prototype.propertyIsEnumerable,Go=(i,t,e)=>t in i?Lp(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Hr=(i,t)=>{for(var e in t||(t={}))xp.call(t,e)&&Go(i,e,t[e]);if(Ho)for(var e of Ho(t))Sp.call(t,e)&&Go(i,e,t[e]);return i},Gr=(i,t)=>Dp(i,Vp(t));function eo(i){return Gr(Hr({},i),{level:(i==null?void 0:i.level)||Tp.level})}function Cp(i,t=mr){return i[t]||""}function $p(i,t,e=mr){return i[e]=t,i}function Ke(i,t=mr){let e="";return typeof i.bindings>"u"?e=Cp(i,t):e=i.bindings().context||"",e}function kp(i,t,e=mr){const r=Ke(i,e);return r.trim()?`${r}/${t}`:t}function Ce(i,t,e=mr){const r=kp(i,t,e),n=i.child({context:r});return $p(n,r,e)}function Up(i){var t,e;const r=new Op((t=i.opts)==null?void 0:t.level,i.maxSizeInBytes);return{logger:on(Gr(Hr({},i.opts),{level:"trace",browser:Gr(Hr({},(e=i.opts)==null?void 0:e.browser),{write:n=>r.write(n)})})),chunkLoggerController:r}}function Np(i){var t;const e=new Rp((t=i.opts)==null?void 0:t.level,i.maxSizeInBytes);return{logger:on(Gr(Hr({},i.opts),{level:"trace"}),e),chunkLoggerController:e}}function Bp(i){return typeof i.loggerOverride<"u"&&typeof i.loggerOverride!="string"?{logger:i.loggerOverride,chunkLoggerController:null}:typeof window<"u"?Up(i):Np(i)}var Mp=Object.defineProperty,qp=(i,t,e)=>t in i?Mp(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Jo=(i,t,e)=>qp(i,typeof t!="symbol"?t+"":t,e);class zp extends Ti{constructor(t){super(),this.opts=t,Jo(this,"protocol","wc"),Jo(this,"version",2)}}var jp=Object.defineProperty,Kp=(i,t,e)=>t in i?jp(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Fp=(i,t,e)=>Kp(i,t+"",e);class Wp extends Ti{constructor(t,e){super(),this.core=t,this.logger=e,Fp(this,"records",new Map)}}class Hp{constructor(t,e){this.logger=t,this.core=e}}class Gp extends Ti{constructor(t,e){super(),this.relayer=t,this.logger=e}}let Jp=class extends Ti{constructor(t){super()}},Yp=class{constructor(t,e,r,n){this.core=t,this.logger=e,this.name=r}},Zp=class extends Ti{constructor(t,e){super(),this.relayer=t,this.logger=e}};class Qp extends Ti{constructor(t,e){super(),this.core=t,this.logger=e}}let Xp=class{constructor(t,e,r){this.core=t,this.logger=e,this.store=r}},e_=class{constructor(t,e){this.projectId=t,this.logger=e}},t_=class{constructor(t,e,r){this.core=t,this.logger=e,this.telemetryEnabled=r}};var i_=Object.defineProperty,r_=(i,t,e)=>t in i?i_(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Yo=(i,t,e)=>r_(i,typeof t!="symbol"?t+"":t,e);let n_=class{constructor(t){this.opts=t,Yo(this,"protocol","wc"),Yo(this,"version",2)}},s_=class{constructor(t){this.client=t}};function or(i,{strict:t=!0}={}){return!i||typeof i!="string"?!1:t?/^0x[0-9a-fA-F]*$/.test(i):i.startsWith("0x")}function ts(i){return or(i,{strict:!1})?Math.ceil((i.length-2)/2):i.length}const ml="2.31.0";let Ci={getDocsUrl:({docsBaseUrl:i,docsPath:t="",docsSlug:e})=>t?`${i??"https://viem.sh"}${t}${e?`#${e}`:""}`:void 0,version:`viem@${ml}`};class oi extends Error{constructor(t,e={}){var c;const r=(()=>{var l;return e.cause instanceof oi?e.cause.details:(l=e.cause)!=null&&l.message?e.cause.message:e.details})(),n=e.cause instanceof oi&&e.cause.docsPath||e.docsPath,s=(c=Ci.getDocsUrl)==null?void 0:c.call(Ci,{...e,docsPath:n}),o=[t||"An error occurred.","",...e.metaMessages?[...e.metaMessages,""]:[],...s?[`Docs: ${s}`]:[],...r?[`Details: ${r}`]:[],...Ci.version?[`Version: ${Ci.version}`]:[]].join(`
3
+ `);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=r,this.docsPath=n,this.metaMessages=e.metaMessages,this.name=e.name??this.name,this.shortMessage=t,this.version=ml}walk(t){return yl(this,t)}}function yl(i,t){return t!=null&&t(i)?i:i&&typeof i=="object"&&"cause"in i&&i.cause!==void 0?yl(i.cause,t):t?null:i}class wl extends oi{constructor({size:t,targetSize:e,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (${t}) exceeds padding size (${e}).`,{name:"SizeExceedsPaddingSizeError"})}}function Ri(i,{dir:t,size:e=32}={}){return typeof i=="string"?o_(i,{dir:t,size:e}):a_(i,{dir:t,size:e})}function o_(i,{dir:t,size:e=32}={}){if(e===null)return i;const r=i.replace("0x","");if(r.length>e*2)throw new wl({size:Math.ceil(r.length/2),targetSize:e,type:"hex"});return`0x${r[t==="right"?"padEnd":"padStart"](e*2,"0")}`}function a_(i,{dir:t,size:e=32}={}){if(e===null)return i;if(i.length>e)throw new wl({size:i.length,targetSize:e,type:"bytes"});const r=new Uint8Array(e);for(let n=0;n<e;n++){const s=t==="right";r[s?n:e-n-1]=i[s?n:i.length-n-1]}return r}class c_ extends oi{constructor({max:t,min:e,signed:r,size:n,value:s}){super(`Number "${s}" is not in safe ${n?`${n*8}-bit ${r?"signed":"unsigned"} `:""}integer range ${t?`(${e} to ${t})`:`(above ${e})`}`,{name:"IntegerOutOfRangeError"})}}class l_ extends oi{constructor({givenSize:t,maxSize:e}){super(`Size cannot exceed ${e} bytes. Given size: ${t} bytes.`,{name:"SizeOverflowError"})}}function Li(i,{size:t}){if(ts(i)>t)throw new l_({givenSize:ts(i),maxSize:t})}function is(i,t={}){const{signed:e}=t;t.size&&Li(i,{size:t.size});const r=BigInt(i);if(!e)return r;const n=(i.length-2)/2,s=(1n<<BigInt(n)*8n-1n)-1n;return r<=s?r:r-BigInt(`0x${"f".padStart(n*2,"f")}`)-1n}function u_(i,t={}){return Number(is(i,t))}const h_=Array.from({length:256},(i,t)=>t.toString(16).padStart(2,"0"));function rs(i,t={}){return typeof i=="number"||typeof i=="bigint"?El(i,t):typeof i=="string"?__(i,t):typeof i=="boolean"?d_(i,t):gl(i,t)}function d_(i,t={}){const e=`0x${Number(i)}`;return typeof t.size=="number"?(Li(e,{size:t.size}),Ri(e,{size:t.size})):e}function gl(i,t={}){let e="";for(let n=0;n<i.length;n++)e+=h_[i[n]];const r=`0x${e}`;return typeof t.size=="number"?(Li(r,{size:t.size}),Ri(r,{dir:"right",size:t.size})):r}function El(i,t={}){const{signed:e,size:r}=t,n=BigInt(i);let s;r?e?s=(1n<<BigInt(r)*8n-1n)-1n:s=2n**(BigInt(r)*8n)-1n:typeof i=="number"&&(s=BigInt(Number.MAX_SAFE_INTEGER));const o=typeof s=="bigint"&&e?-s-1n:0;if(s&&n>s||n<o){const l=typeof i=="bigint"?"n":"";throw new c_({max:s?`${s}${l}`:void 0,min:`${o}${l}`,signed:e,size:r,value:`${i}${l}`})}const c=`0x${(e&&n<0?(1n<<BigInt(r*8))+BigInt(n):n).toString(16)}`;return r?Ri(c,{size:r}):c}const p_=new TextEncoder;function __(i,t={}){const e=p_.encode(i);return gl(e,t)}const f_=new TextEncoder;function m_(i,t={}){return typeof i=="number"||typeof i=="bigint"?w_(i,t):typeof i=="boolean"?y_(i,t):or(i)?vl(i,t):bl(i,t)}function y_(i,t={}){const e=new Uint8Array(1);return e[0]=Number(i),typeof t.size=="number"?(Li(e,{size:t.size}),Ri(e,{size:t.size})):e}const Et={zero:48,nine:57,A:65,F:70,a:97,f:102};function Zo(i){if(i>=Et.zero&&i<=Et.nine)return i-Et.zero;if(i>=Et.A&&i<=Et.F)return i-(Et.A-10);if(i>=Et.a&&i<=Et.f)return i-(Et.a-10)}function vl(i,t={}){let e=i;t.size&&(Li(e,{size:t.size}),e=Ri(e,{dir:"right",size:t.size}));let r=e.slice(2);r.length%2&&(r=`0${r}`);const n=r.length/2,s=new Uint8Array(n);for(let o=0,c=0;o<n;o++){const l=Zo(r.charCodeAt(c++)),u=Zo(r.charCodeAt(c++));if(l===void 0||u===void 0)throw new oi(`Invalid byte sequence ("${r[c-2]}${r[c-1]}" in "${r}").`);s[o]=l*16+u}return s}function w_(i,t){const e=El(i,t);return vl(e)}function bl(i,t={}){const e=f_.encode(i);return typeof t.size=="number"?(Li(e,{size:t.size}),Ri(e,{dir:"right",size:t.size})):e}const Tr=BigInt(2**32-1),Qo=BigInt(32);function g_(i,t=!1){return t?{h:Number(i&Tr),l:Number(i>>Qo&Tr)}:{h:Number(i>>Qo&Tr)|0,l:Number(i&Tr)|0}}function E_(i,t=!1){const e=i.length;let r=new Uint32Array(e),n=new Uint32Array(e);for(let s=0;s<e;s++){const{h:o,l:c}=g_(i[s],t);[r[s],n[s]]=[o,c]}return[r,n]}const v_=(i,t,e)=>i<<e|t>>>32-e,b_=(i,t,e)=>t<<e|i>>>32-e,I_=(i,t,e)=>t<<e-32|i>>>64-e,A_=(i,t,e)=>i<<e-32|t>>>64-e,_i=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function T_(i){return i instanceof Uint8Array||ArrayBuffer.isView(i)&&i.constructor.name==="Uint8Array"}function Jr(i){if(!Number.isSafeInteger(i)||i<0)throw new Error("positive integer expected, got "+i)}function ar(i,...t){if(!T_(i))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(i.length))throw new Error("Uint8Array expected of length "+t+", got length="+i.length)}function vA(i){if(typeof i!="function"||typeof i.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");Jr(i.outputLen),Jr(i.blockLen)}function Xo(i,t=!0){if(i.destroyed)throw new Error("Hash instance has been destroyed");if(t&&i.finished)throw new Error("Hash#digest() has already been called")}function P_(i,t){ar(i);const e=t.outputLen;if(i.length<e)throw new Error("digestInto() expects output buffer of length at least "+e)}function O_(i){return new Uint32Array(i.buffer,i.byteOffset,Math.floor(i.byteLength/4))}function Il(...i){for(let t=0;t<i.length;t++)i[t].fill(0)}function bA(i){return new DataView(i.buffer,i.byteOffset,i.byteLength)}function IA(i,t){return i<<32-t|i>>>t}const R_=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function L_(i){return i<<24&4278190080|i<<8&16711680|i>>>8&65280|i>>>24&255}function D_(i){for(let t=0;t<i.length;t++)i[t]=L_(i[t]);return i}const ea=R_?i=>i:D_;function V_(i){if(typeof i!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(i))}function Al(i){return typeof i=="string"&&(i=V_(i)),ar(i),i}function AA(...i){let t=0;for(let r=0;r<i.length;r++){const n=i[r];ar(n),t+=n.length}const e=new Uint8Array(t);for(let r=0,n=0;r<i.length;r++){const s=i[r];e.set(s,n),n+=s.length}return e}class x_{}function S_(i){const t=r=>i().update(Al(r)).digest(),e=i();return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=()=>i(),t}function TA(i=32){if(_i&&typeof _i.getRandomValues=="function")return _i.getRandomValues(new Uint8Array(i));if(_i&&typeof _i.randomBytes=="function")return Uint8Array.from(_i.randomBytes(i));throw new Error("crypto.getRandomValues must be defined")}const C_=BigInt(0),$i=BigInt(1),$_=BigInt(2),k_=BigInt(7),U_=BigInt(256),N_=BigInt(113),Tl=[],Pl=[],Ol=[];for(let i=0,t=$i,e=1,r=0;i<24;i++){[e,r]=[r,(2*e+3*r)%5],Tl.push(2*(5*r+e)),Pl.push((i+1)*(i+2)/2%64);let n=C_;for(let s=0;s<7;s++)t=(t<<$i^(t>>k_)*N_)%U_,t&$_&&(n^=$i<<($i<<BigInt(s))-$i);Ol.push(n)}const Rl=E_(Ol,!0),B_=Rl[0],M_=Rl[1],ta=(i,t,e)=>e>32?I_(i,t,e):v_(i,t,e),ia=(i,t,e)=>e>32?A_(i,t,e):b_(i,t,e);function q_(i,t=24){const e=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let o=0;o<10;o++)e[o]=i[o]^i[o+10]^i[o+20]^i[o+30]^i[o+40];for(let o=0;o<10;o+=2){const c=(o+8)%10,l=(o+2)%10,u=e[l],h=e[l+1],d=ta(u,h,1)^e[c],p=ia(u,h,1)^e[c+1];for(let _=0;_<50;_+=10)i[o+_]^=d,i[o+_+1]^=p}let n=i[2],s=i[3];for(let o=0;o<24;o++){const c=Pl[o],l=ta(n,s,c),u=ia(n,s,c),h=Tl[o];n=i[h],s=i[h+1],i[h]=l,i[h+1]=u}for(let o=0;o<50;o+=10){for(let c=0;c<10;c++)e[c]=i[o+c];for(let c=0;c<10;c++)i[o+c]^=~e[(c+2)%10]&e[(c+4)%10]}i[0]^=B_[r],i[1]^=M_[r]}Il(e)}class to extends x_{constructor(t,e,r,n=!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=r,this.enableXOF=n,this.rounds=s,Jr(r),!(0<t&&t<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=O_(this.state)}clone(){return this._cloneInto()}keccak(){ea(this.state32),q_(this.state32,this.rounds),ea(this.state32),this.posOut=0,this.pos=0}update(t){Xo(this),t=Al(t),ar(t);const{blockLen:e,state:r}=this,n=t.length;for(let s=0;s<n;){const o=Math.min(e-this.pos,n-s);for(let c=0;c<o;c++)r[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:r,blockLen:n}=this;t[r]^=e,e&128&&r===n-1&&this.keccak(),t[n-1]^=128,this.keccak()}writeInto(t){Xo(this,!1),ar(t),this.finish();const e=this.state,{blockLen:r}=this;for(let n=0,s=t.length;n<s;){this.posOut>=r&&this.keccak();const o=Math.min(r-this.posOut,s-n);t.set(e.subarray(this.posOut,this.posOut+o),n),this.posOut+=o,n+=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 Jr(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(P_(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,Il(this.state)}_cloneInto(t){const{blockLen:e,suffix:r,outputLen:n,rounds:s,enableXOF:o}=this;return t||(t=new to(e,r,n,o,s)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=s,t.suffix=r,t.outputLen=n,t.enableXOF=o,t.destroyed=this.destroyed,t}}const z_=(i,t,e)=>S_(()=>new to(t,i,e)),j_=z_(1,136,256/8);function Ll(i,t){const e=t||"hex",r=j_(or(i,{strict:!1})?m_(i):i);return e==="bytes"?r:rs(r)}class K_ 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 r=this.keys().next().value;r&&this.delete(r)}return this}}const Tn=new K_(8192);function F_(i,t){if(Tn.has(`${i}.${t}`))return Tn.get(`${i}.${t}`);const e=i.substring(2).toLowerCase(),r=Ll(bl(e),"bytes"),n=e.split("");for(let o=0;o<40;o+=2)r[o>>1]>>4>=8&&n[o]&&(n[o]=n[o].toUpperCase()),(r[o>>1]&15)>=8&&n[o+1]&&(n[o+1]=n[o+1].toUpperCase());const s=`0x${n.join("")}`;return Tn.set(`${i}.${t}`,s),s}function W_(i){const t=Ll(`0x${i.substring(4)}`).substring(26);return F_(`0x${t}`)}async function H_({hash:i,signature:t}){const e=or(i)?i:rs(i),{secp256k1:r}=await a(async()=>{const{secp256k1:o}=await import("./secp256k1-CAuxtucr.js");return{secp256k1:o}},__vite__mapDeps([22,1,2,3,4,5,6,7,8,9,10]));return`0x${(()=>{if(typeof t=="object"&&"r"in t&&"s"in t){const{r:u,s:h,v:d,yParity:p}=t,_=Number(p??d),f=ra(_);return new r.Signature(is(u),is(h)).addRecoveryBit(f)}const o=or(t)?t:rs(t);if(ts(o)!==65)throw new Error("invalid signature length");const c=u_(`0x${o.slice(130)}`),l=ra(c);return r.Signature.fromCompact(o.substring(2,130)).addRecoveryBit(l)})().recoverPublicKey(e.substring(2)).toHex(!1)}`}function ra(i){if(i===0||i===1)return i;if(i===27)return 0;if(i===28)return 1;throw new Error("Invalid yParityOrV value")}async function G_({hash:i,signature:t}){return W_(await H_({hash:i,signature:t}))}function J_(i){const t=i.length;let e=0,r=0;for(;r<t;){let n=i.charCodeAt(r++);if(n&4294967168)if(!(n&4294965248))e+=2;else{if(n>=55296&&n<=56319&&r<t){const s=i.charCodeAt(r);(s&64512)===56320&&(++r,n=((n&1023)<<10)+(s&1023)+65536)}n&4294901760?e+=4:e+=3}else{e++;continue}}return e}function Y_(i,t,e){const r=i.length;let n=e,s=0;for(;s<r;){let o=i.charCodeAt(s++);if(o&4294967168)if(!(o&4294965248))t[n++]=o>>6&31|192;else{if(o>=55296&&o<=56319&&s<r){const c=i.charCodeAt(s);(c&64512)===56320&&(++s,o=((o&1023)<<10)+(c&1023)+65536)}o&4294901760?(t[n++]=o>>18&7|240,t[n++]=o>>12&63|128,t[n++]=o>>6&63|128):(t[n++]=o>>12&15|224,t[n++]=o>>6&63|128)}else{t[n++]=o;continue}t[n++]=o&63|128}}const Z_=new TextEncoder,Q_=50;function X_(i,t,e){Z_.encodeInto(i,t.subarray(e))}function ef(i,t,e){i.length>Q_?X_(i,t,e):Y_(i,t,e)}const tf=4096;function Dl(i,t,e){let r=t;const n=r+e,s=[];let o="";for(;r<n;){const c=i[r++];if(!(c&128))s.push(c);else if((c&224)===192){const l=i[r++]&63;s.push((c&31)<<6|l)}else if((c&240)===224){const l=i[r++]&63,u=i[r++]&63;s.push((c&31)<<12|l<<6|u)}else if((c&248)===240){const l=i[r++]&63,u=i[r++]&63,h=i[r++]&63;let d=(c&7)<<18|l<<12|u<<6|h;d>65535&&(d-=65536,s.push(d>>>10&1023|55296),d=56320|d&1023),s.push(d)}else s.push(c);s.length>=tf&&(o+=String.fromCharCode(...s),s.length=0)}return s.length>0&&(o+=String.fromCharCode(...s)),o}const rf=new TextDecoder,nf=200;function sf(i,t,e){const r=i.subarray(t,t+e);return rf.decode(r)}function of(i,t,e){return e>nf?sf(i,t,e):Dl(i,t,e)}class Pr{constructor(t,e){this.type=t,this.data=e}}class He extends Error{constructor(t){super(t);const e=Object.create(He.prototype);Object.setPrototypeOf(this,e),Object.defineProperty(this,"name",{configurable:!0,enumerable:!1,value:He.name})}}const ki=4294967295;function af(i,t,e){const r=e/4294967296,n=e;i.setUint32(t,r),i.setUint32(t+4,n)}function Vl(i,t,e){const r=Math.floor(e/4294967296),n=e;i.setUint32(t,r),i.setUint32(t+4,n)}function xl(i,t){const e=i.getInt32(t),r=i.getUint32(t+4);return e*4294967296+r}function cf(i,t){const e=i.getUint32(t),r=i.getUint32(t+4);return e*4294967296+r}const lf=-1,uf=4294967296-1,hf=17179869184-1;function df({sec:i,nsec:t}){if(i>=0&&t>=0&&i<=hf)if(t===0&&i<=uf){const e=new Uint8Array(4);return new DataView(e.buffer).setUint32(0,i),e}else{const e=i/4294967296,r=i&4294967295,n=new Uint8Array(8),s=new DataView(n.buffer);return s.setUint32(0,t<<2|e&3),s.setUint32(4,r),n}else{const e=new Uint8Array(12),r=new DataView(e.buffer);return r.setUint32(0,t),Vl(r,4,i),e}}function pf(i){const t=i.getTime(),e=Math.floor(t/1e3),r=(t-e*1e3)*1e6,n=Math.floor(r/1e9);return{sec:e+n,nsec:r-n*1e9}}function _f(i){if(i instanceof Date){const t=pf(i);return df(t)}else return null}function ff(i){const t=new DataView(i.buffer,i.byteOffset,i.byteLength);switch(i.byteLength){case 4:return{sec:t.getUint32(0),nsec:0};case 8:{const e=t.getUint32(0),r=t.getUint32(4),n=(e&3)*4294967296+r,s=e>>>2;return{sec:n,nsec:s}}case 12:{const e=xl(t,4),r=t.getUint32(0);return{sec:e,nsec:r}}default:throw new He(`Unrecognized data size for timestamp (expected 4, 8, or 12): ${i.length}`)}}function mf(i){const t=ff(i);return new Date(t.sec*1e3+t.nsec/1e6)}const yf={type:lf,encode:_f,decode:mf};class Yr{constructor(){this.builtInEncoders=[],this.builtInDecoders=[],this.encoders=[],this.decoders=[],this.register(yf)}register({type:t,encode:e,decode:r}){if(t>=0)this.encoders[t]=e,this.decoders[t]=r;else{const n=-1-t;this.builtInEncoders[n]=e,this.builtInDecoders[n]=r}}tryToEncode(t,e){for(let r=0;r<this.builtInEncoders.length;r++){const n=this.builtInEncoders[r];if(n!=null){const s=n(t,e);if(s!=null){const o=-1-r;return new Pr(o,s)}}}for(let r=0;r<this.encoders.length;r++){const n=this.encoders[r];if(n!=null){const s=n(t,e);if(s!=null){const o=r;return new Pr(o,s)}}}return t instanceof Pr?t:null}decode(t,e,r){const n=e<0?this.builtInDecoders[-1-e]:this.decoders[e];return n?n(t,e,r):new Pr(e,t)}}Yr.defaultCodec=new Yr;function wf(i){return i instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&i instanceof SharedArrayBuffer}function ns(i){return i instanceof Uint8Array?i:ArrayBuffer.isView(i)?new Uint8Array(i.buffer,i.byteOffset,i.byteLength):wf(i)?new Uint8Array(i):Uint8Array.from(i)}const gf=100,Ef=2048;class io{constructor(t){this.entered=!1,this.extensionCodec=(t==null?void 0:t.extensionCodec)??Yr.defaultCodec,this.context=t==null?void 0:t.context,this.useBigInt64=(t==null?void 0:t.useBigInt64)??!1,this.maxDepth=(t==null?void 0:t.maxDepth)??gf,this.initialBufferSize=(t==null?void 0:t.initialBufferSize)??Ef,this.sortKeys=(t==null?void 0:t.sortKeys)??!1,this.forceFloat32=(t==null?void 0:t.forceFloat32)??!1,this.ignoreUndefined=(t==null?void 0:t.ignoreUndefined)??!1,this.forceIntegerToFloat=(t==null?void 0:t.forceIntegerToFloat)??!1,this.pos=0,this.view=new DataView(new ArrayBuffer(this.initialBufferSize)),this.bytes=new Uint8Array(this.view.buffer)}clone(){return new io({extensionCodec:this.extensionCodec,context:this.context,useBigInt64:this.useBigInt64,maxDepth:this.maxDepth,initialBufferSize:this.initialBufferSize,sortKeys:this.sortKeys,forceFloat32:this.forceFloat32,ignoreUndefined:this.ignoreUndefined,forceIntegerToFloat:this.forceIntegerToFloat})}reinitializeState(){this.pos=0}encodeSharedRef(t){if(this.entered)return this.clone().encodeSharedRef(t);try{return this.entered=!0,this.reinitializeState(),this.doEncode(t,1),this.bytes.subarray(0,this.pos)}finally{this.entered=!1}}encode(t){if(this.entered)return this.clone().encode(t);try{return this.entered=!0,this.reinitializeState(),this.doEncode(t,1),this.bytes.slice(0,this.pos)}finally{this.entered=!1}}doEncode(t,e){if(e>this.maxDepth)throw new Error(`Too deep objects in depth ${e}`);t==null?this.encodeNil():typeof t=="boolean"?this.encodeBoolean(t):typeof t=="number"?this.forceIntegerToFloat?this.encodeNumberAsFloat(t):this.encodeNumber(t):typeof t=="string"?this.encodeString(t):this.useBigInt64&&typeof t=="bigint"?this.encodeBigInt64(t):this.encodeObject(t,e)}ensureBufferSizeToWrite(t){const e=this.pos+t;this.view.byteLength<e&&this.resizeBuffer(e*2)}resizeBuffer(t){const e=new ArrayBuffer(t),r=new Uint8Array(e),n=new DataView(e);r.set(this.bytes),this.view=n,this.bytes=r}encodeNil(){this.writeU8(192)}encodeBoolean(t){t===!1?this.writeU8(194):this.writeU8(195)}encodeNumber(t){!this.forceIntegerToFloat&&Number.isSafeInteger(t)?t>=0?t<128?this.writeU8(t):t<256?(this.writeU8(204),this.writeU8(t)):t<65536?(this.writeU8(205),this.writeU16(t)):t<4294967296?(this.writeU8(206),this.writeU32(t)):this.useBigInt64?this.encodeNumberAsFloat(t):(this.writeU8(207),this.writeU64(t)):t>=-32?this.writeU8(224|t+32):t>=-128?(this.writeU8(208),this.writeI8(t)):t>=-32768?(this.writeU8(209),this.writeI16(t)):t>=-2147483648?(this.writeU8(210),this.writeI32(t)):this.useBigInt64?this.encodeNumberAsFloat(t):(this.writeU8(211),this.writeI64(t)):this.encodeNumberAsFloat(t)}encodeNumberAsFloat(t){this.forceFloat32?(this.writeU8(202),this.writeF32(t)):(this.writeU8(203),this.writeF64(t))}encodeBigInt64(t){t>=BigInt(0)?(this.writeU8(207),this.writeBigUint64(t)):(this.writeU8(211),this.writeBigInt64(t))}writeStringHeader(t){if(t<32)this.writeU8(160+t);else if(t<256)this.writeU8(217),this.writeU8(t);else if(t<65536)this.writeU8(218),this.writeU16(t);else if(t<4294967296)this.writeU8(219),this.writeU32(t);else throw new Error(`Too long string: ${t} bytes in UTF-8`)}encodeString(t){const r=J_(t);this.ensureBufferSizeToWrite(5+r),this.writeStringHeader(r),ef(t,this.bytes,this.pos),this.pos+=r}encodeObject(t,e){const r=this.extensionCodec.tryToEncode(t,this.context);if(r!=null)this.encodeExtension(r);else if(Array.isArray(t))this.encodeArray(t,e);else if(ArrayBuffer.isView(t))this.encodeBinary(t);else if(typeof t=="object")this.encodeMap(t,e);else throw new Error(`Unrecognized object: ${Object.prototype.toString.apply(t)}`)}encodeBinary(t){const e=t.byteLength;if(e<256)this.writeU8(196),this.writeU8(e);else if(e<65536)this.writeU8(197),this.writeU16(e);else if(e<4294967296)this.writeU8(198),this.writeU32(e);else throw new Error(`Too large binary: ${e}`);const r=ns(t);this.writeU8a(r)}encodeArray(t,e){const r=t.length;if(r<16)this.writeU8(144+r);else if(r<65536)this.writeU8(220),this.writeU16(r);else if(r<4294967296)this.writeU8(221),this.writeU32(r);else throw new Error(`Too large array: ${r}`);for(const n of t)this.doEncode(n,e+1)}countWithoutUndefined(t,e){let r=0;for(const n of e)t[n]!==void 0&&r++;return r}encodeMap(t,e){const r=Object.keys(t);this.sortKeys&&r.sort();const n=this.ignoreUndefined?this.countWithoutUndefined(t,r):r.length;if(n<16)this.writeU8(128+n);else if(n<65536)this.writeU8(222),this.writeU16(n);else if(n<4294967296)this.writeU8(223),this.writeU32(n);else throw new Error(`Too large map object: ${n}`);for(const s of r){const o=t[s];this.ignoreUndefined&&o===void 0||(this.encodeString(s),this.doEncode(o,e+1))}}encodeExtension(t){if(typeof t.data=="function"){const r=t.data(this.pos+6),n=r.length;if(n>=4294967296)throw new Error(`Too large extension object: ${n}`);this.writeU8(201),this.writeU32(n),this.writeI8(t.type),this.writeU8a(r);return}const e=t.data.length;if(e===1)this.writeU8(212);else if(e===2)this.writeU8(213);else if(e===4)this.writeU8(214);else if(e===8)this.writeU8(215);else if(e===16)this.writeU8(216);else if(e<256)this.writeU8(199),this.writeU8(e);else if(e<65536)this.writeU8(200),this.writeU16(e);else if(e<4294967296)this.writeU8(201),this.writeU32(e);else throw new Error(`Too large extension object: ${e}`);this.writeI8(t.type),this.writeU8a(t.data)}writeU8(t){this.ensureBufferSizeToWrite(1),this.view.setUint8(this.pos,t),this.pos++}writeU8a(t){const e=t.length;this.ensureBufferSizeToWrite(e),this.bytes.set(t,this.pos),this.pos+=e}writeI8(t){this.ensureBufferSizeToWrite(1),this.view.setInt8(this.pos,t),this.pos++}writeU16(t){this.ensureBufferSizeToWrite(2),this.view.setUint16(this.pos,t),this.pos+=2}writeI16(t){this.ensureBufferSizeToWrite(2),this.view.setInt16(this.pos,t),this.pos+=2}writeU32(t){this.ensureBufferSizeToWrite(4),this.view.setUint32(this.pos,t),this.pos+=4}writeI32(t){this.ensureBufferSizeToWrite(4),this.view.setInt32(this.pos,t),this.pos+=4}writeF32(t){this.ensureBufferSizeToWrite(4),this.view.setFloat32(this.pos,t),this.pos+=4}writeF64(t){this.ensureBufferSizeToWrite(8),this.view.setFloat64(this.pos,t),this.pos+=8}writeU64(t){this.ensureBufferSizeToWrite(8),af(this.view,this.pos,t),this.pos+=8}writeI64(t){this.ensureBufferSizeToWrite(8),Vl(this.view,this.pos,t),this.pos+=8}writeBigUint64(t){this.ensureBufferSizeToWrite(8),this.view.setBigUint64(this.pos,t),this.pos+=8}writeBigInt64(t){this.ensureBufferSizeToWrite(8),this.view.setBigInt64(this.pos,t),this.pos+=8}}function vf(i,t){return new io(t).encodeSharedRef(i)}function Pn(i){return`${i<0?"-":""}0x${Math.abs(i).toString(16).padStart(2,"0")}`}const bf=16,If=16;class Af{constructor(t=bf,e=If){this.hit=0,this.miss=0,this.maxKeyLength=t,this.maxLengthPerKey=e,this.caches=[];for(let r=0;r<this.maxKeyLength;r++)this.caches.push([])}canBeCached(t){return t>0&&t<=this.maxKeyLength}find(t,e,r){const n=this.caches[r-1];e:for(const s of n){const o=s.bytes;for(let c=0;c<r;c++)if(o[c]!==t[e+c])continue e;return s.str}return null}store(t,e){const r=this.caches[t.length-1],n={bytes:t,str:e};r.length>=this.maxLengthPerKey?r[Math.random()*r.length|0]=n:r.push(n)}decode(t,e,r){const n=this.find(t,e,r);if(n!=null)return this.hit++,n;this.miss++;const s=Dl(t,e,r),o=Uint8Array.prototype.slice.call(t,e,e+r);return this.store(o,s),s}}const ss="array",Zi="map_key",Sl="map_value",Tf=i=>{if(typeof i=="string"||typeof i=="number")return i;throw new He("The type of key must be string or number but "+typeof i)};class Pf{constructor(){this.stack=[],this.stackHeadPosition=-1}get length(){return this.stackHeadPosition+1}top(){return this.stack[this.stackHeadPosition]}pushArrayState(t){const e=this.getUninitializedStateFromPool();e.type=ss,e.position=0,e.size=t,e.array=new Array(t)}pushMapState(t){const e=this.getUninitializedStateFromPool();e.type=Zi,e.readCount=0,e.size=t,e.map={}}getUninitializedStateFromPool(){if(this.stackHeadPosition++,this.stackHeadPosition===this.stack.length){const t={type:void 0,size:0,array:void 0,position:0,readCount:0,map:void 0,key:null};this.stack.push(t)}return this.stack[this.stackHeadPosition]}release(t){if(this.stack[this.stackHeadPosition]!==t)throw new Error("Invalid stack state. Released state is not on top of the stack.");if(t.type===ss){const r=t;r.size=0,r.array=void 0,r.position=0,r.type=void 0}if(t.type===Zi||t.type===Sl){const r=t;r.size=0,r.map=void 0,r.readCount=0,r.type=void 0}this.stackHeadPosition--}reset(){this.stack.length=0,this.stackHeadPosition=-1}}const Ui=-1,ro=new DataView(new ArrayBuffer(0)),Of=new Uint8Array(ro.buffer);try{ro.getInt8(0)}catch(i){if(!(i instanceof RangeError))throw new Error("This module is not supported in the current JavaScript engine because DataView does not throw RangeError on out-of-bounds access")}const na=new RangeError("Insufficient data"),Rf=new Af;class no{constructor(t){this.totalPos=0,this.pos=0,this.view=ro,this.bytes=Of,this.headByte=Ui,this.stack=new Pf,this.entered=!1,this.extensionCodec=(t==null?void 0:t.extensionCodec)??Yr.defaultCodec,this.context=t==null?void 0:t.context,this.useBigInt64=(t==null?void 0:t.useBigInt64)??!1,this.rawStrings=(t==null?void 0:t.rawStrings)??!1,this.maxStrLength=(t==null?void 0:t.maxStrLength)??ki,this.maxBinLength=(t==null?void 0:t.maxBinLength)??ki,this.maxArrayLength=(t==null?void 0:t.maxArrayLength)??ki,this.maxMapLength=(t==null?void 0:t.maxMapLength)??ki,this.maxExtLength=(t==null?void 0:t.maxExtLength)??ki,this.keyDecoder=(t==null?void 0:t.keyDecoder)!==void 0?t.keyDecoder:Rf,this.mapKeyConverter=(t==null?void 0:t.mapKeyConverter)??Tf}clone(){return new no({extensionCodec:this.extensionCodec,context:this.context,useBigInt64:this.useBigInt64,rawStrings:this.rawStrings,maxStrLength:this.maxStrLength,maxBinLength:this.maxBinLength,maxArrayLength:this.maxArrayLength,maxMapLength:this.maxMapLength,maxExtLength:this.maxExtLength,keyDecoder:this.keyDecoder})}reinitializeState(){this.totalPos=0,this.headByte=Ui,this.stack.reset()}setBuffer(t){const e=ns(t);this.bytes=e,this.view=new DataView(e.buffer,e.byteOffset,e.byteLength),this.pos=0}appendBuffer(t){if(this.headByte===Ui&&!this.hasRemaining(1))this.setBuffer(t);else{const e=this.bytes.subarray(this.pos),r=ns(t),n=new Uint8Array(e.length+r.length);n.set(e),n.set(r,e.length),this.setBuffer(n)}}hasRemaining(t){return this.view.byteLength-this.pos>=t}createExtraByteError(t){const{view:e,pos:r}=this;return new RangeError(`Extra ${e.byteLength-r} of ${e.byteLength} byte(s) found at buffer[${t}]`)}decode(t){if(this.entered)return this.clone().decode(t);try{this.entered=!0,this.reinitializeState(),this.setBuffer(t);const e=this.doDecodeSync();if(this.hasRemaining(1))throw this.createExtraByteError(this.pos);return e}finally{this.entered=!1}}*decodeMulti(t){if(this.entered){yield*this.clone().decodeMulti(t);return}try{for(this.entered=!0,this.reinitializeState(),this.setBuffer(t);this.hasRemaining(1);)yield this.doDecodeSync()}finally{this.entered=!1}}async decodeAsync(t){if(this.entered)return this.clone().decodeAsync(t);try{this.entered=!0;let e=!1,r;for await(const c of t){if(e)throw this.entered=!1,this.createExtraByteError(this.totalPos);this.appendBuffer(c);try{r=this.doDecodeSync(),e=!0}catch(l){if(!(l instanceof RangeError))throw l}this.totalPos+=this.pos}if(e){if(this.hasRemaining(1))throw this.createExtraByteError(this.totalPos);return r}const{headByte:n,pos:s,totalPos:o}=this;throw new RangeError(`Insufficient data in parsing ${Pn(n)} at ${o} (${s} in the current buffer)`)}finally{this.entered=!1}}decodeArrayStream(t){return this.decodeMultiAsync(t,!0)}decodeStream(t){return this.decodeMultiAsync(t,!1)}async*decodeMultiAsync(t,e){if(this.entered){yield*this.clone().decodeMultiAsync(t,e);return}try{this.entered=!0;let r=e,n=-1;for await(const s of t){if(e&&n===0)throw this.createExtraByteError(this.totalPos);this.appendBuffer(s),r&&(n=this.readArraySize(),r=!1,this.complete());try{for(;yield this.doDecodeSync(),--n!==0;);}catch(o){if(!(o instanceof RangeError))throw o}this.totalPos+=this.pos}}finally{this.entered=!1}}doDecodeSync(){e:for(;;){const t=this.readHeadByte();let e;if(t>=224)e=t-256;else if(t<192)if(t<128)e=t;else if(t<144){const n=t-128;if(n!==0){this.pushMapState(n),this.complete();continue e}else e={}}else if(t<160){const n=t-144;if(n!==0){this.pushArrayState(n),this.complete();continue e}else e=[]}else{const n=t-160;e=this.decodeString(n,0)}else if(t===192)e=null;else if(t===194)e=!1;else if(t===195)e=!0;else if(t===202)e=this.readF32();else if(t===203)e=this.readF64();else if(t===204)e=this.readU8();else if(t===205)e=this.readU16();else if(t===206)e=this.readU32();else if(t===207)this.useBigInt64?e=this.readU64AsBigInt():e=this.readU64();else if(t===208)e=this.readI8();else if(t===209)e=this.readI16();else if(t===210)e=this.readI32();else if(t===211)this.useBigInt64?e=this.readI64AsBigInt():e=this.readI64();else if(t===217){const n=this.lookU8();e=this.decodeString(n,1)}else if(t===218){const n=this.lookU16();e=this.decodeString(n,2)}else if(t===219){const n=this.lookU32();e=this.decodeString(n,4)}else if(t===220){const n=this.readU16();if(n!==0){this.pushArrayState(n),this.complete();continue e}else e=[]}else if(t===221){const n=this.readU32();if(n!==0){this.pushArrayState(n),this.complete();continue e}else e=[]}else if(t===222){const n=this.readU16();if(n!==0){this.pushMapState(n),this.complete();continue e}else e={}}else if(t===223){const n=this.readU32();if(n!==0){this.pushMapState(n),this.complete();continue e}else e={}}else if(t===196){const n=this.lookU8();e=this.decodeBinary(n,1)}else if(t===197){const n=this.lookU16();e=this.decodeBinary(n,2)}else if(t===198){const n=this.lookU32();e=this.decodeBinary(n,4)}else if(t===212)e=this.decodeExtension(1,0);else if(t===213)e=this.decodeExtension(2,0);else if(t===214)e=this.decodeExtension(4,0);else if(t===215)e=this.decodeExtension(8,0);else if(t===216)e=this.decodeExtension(16,0);else if(t===199){const n=this.lookU8();e=this.decodeExtension(n,1)}else if(t===200){const n=this.lookU16();e=this.decodeExtension(n,2)}else if(t===201){const n=this.lookU32();e=this.decodeExtension(n,4)}else throw new He(`Unrecognized type byte: ${Pn(t)}`);this.complete();const r=this.stack;for(;r.length>0;){const n=r.top();if(n.type===ss)if(n.array[n.position]=e,n.position++,n.position===n.size)e=n.array,r.release(n);else continue e;else if(n.type===Zi){if(e==="__proto__")throw new He("The key __proto__ is not allowed");n.key=this.mapKeyConverter(e),n.type=Sl;continue e}else if(n.map[n.key]=e,n.readCount++,n.readCount===n.size)e=n.map,r.release(n);else{n.key=null,n.type=Zi;continue e}}return e}}readHeadByte(){return this.headByte===Ui&&(this.headByte=this.readU8()),this.headByte}complete(){this.headByte=Ui}readArraySize(){const t=this.readHeadByte();switch(t){case 220:return this.readU16();case 221:return this.readU32();default:{if(t<160)return t-144;throw new He(`Unrecognized array type byte: ${Pn(t)}`)}}}pushMapState(t){if(t>this.maxMapLength)throw new He(`Max length exceeded: map length (${t}) > maxMapLengthLength (${this.maxMapLength})`);this.stack.pushMapState(t)}pushArrayState(t){if(t>this.maxArrayLength)throw new He(`Max length exceeded: array length (${t}) > maxArrayLength (${this.maxArrayLength})`);this.stack.pushArrayState(t)}decodeString(t,e){return!this.rawStrings||this.stateIsMapKey()?this.decodeUtf8String(t,e):this.decodeBinary(t,e)}decodeUtf8String(t,e){var s;if(t>this.maxStrLength)throw new He(`Max length exceeded: UTF-8 byte length (${t}) > maxStrLength (${this.maxStrLength})`);if(this.bytes.byteLength<this.pos+e+t)throw na;const r=this.pos+e;let n;return this.stateIsMapKey()&&((s=this.keyDecoder)!=null&&s.canBeCached(t))?n=this.keyDecoder.decode(this.bytes,r,t):n=of(this.bytes,r,t),this.pos+=e+t,n}stateIsMapKey(){return this.stack.length>0?this.stack.top().type===Zi:!1}decodeBinary(t,e){if(t>this.maxBinLength)throw new He(`Max length exceeded: bin length (${t}) > maxBinLength (${this.maxBinLength})`);if(!this.hasRemaining(t+e))throw na;const r=this.pos+e,n=this.bytes.subarray(r,r+t);return this.pos+=e+t,n}decodeExtension(t,e){if(t>this.maxExtLength)throw new He(`Max length exceeded: ext length (${t}) > maxExtLength (${this.maxExtLength})`);const r=this.view.getInt8(this.pos+e),n=this.decodeBinary(t,e+1);return this.extensionCodec.decode(n,r,this.context)}lookU8(){return this.view.getUint8(this.pos)}lookU16(){return this.view.getUint16(this.pos)}lookU32(){return this.view.getUint32(this.pos)}readU8(){const t=this.view.getUint8(this.pos);return this.pos++,t}readI8(){const t=this.view.getInt8(this.pos);return this.pos++,t}readU16(){const t=this.view.getUint16(this.pos);return this.pos+=2,t}readI16(){const t=this.view.getInt16(this.pos);return this.pos+=2,t}readU32(){const t=this.view.getUint32(this.pos);return this.pos+=4,t}readI32(){const t=this.view.getInt32(this.pos);return this.pos+=4,t}readU64(){const t=cf(this.view,this.pos);return this.pos+=8,t}readI64(){const t=xl(this.view,this.pos);return this.pos+=8,t}readU64AsBigInt(){const t=this.view.getBigUint64(this.pos);return this.pos+=8,t}readI64AsBigInt(){const t=this.view.getBigInt64(this.pos);return this.pos+=8,t}readF32(){const t=this.view.getFloat32(this.pos);return this.pos+=4,t}readF64(){const t=this.view.getFloat64(this.pos);return this.pos+=8,t}}function Lf(i,t){return new no(t).decode(i)}var Df={};const Vf=":";function kr(i){const[t,e]=i.split(Vf);return{namespace:t,reference:e}}function Cl(i,t){return i.includes(":")?[i]:t.chains||[]}var xf=Object.defineProperty,Sf=Object.defineProperties,Cf=Object.getOwnPropertyDescriptors,sa=Object.getOwnPropertySymbols,$f=Object.prototype.hasOwnProperty,kf=Object.prototype.propertyIsEnumerable,os=(i,t,e)=>t in i?xf(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,oa=(i,t)=>{for(var e in t||(t={}))$f.call(t,e)&&os(i,e,t[e]);if(sa)for(var e of sa(t))kf.call(t,e)&&os(i,e,t[e]);return i},Uf=(i,t)=>Sf(i,Cf(t)),aa=(i,t,e)=>os(i,typeof t!="symbol"?t+"":t,e);const Nf="ReactNative",Ge={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},Bf="js";function Zr(){return typeof Kt<"u"&&typeof Kt.versions<"u"&&typeof Kt.versions.node<"u"}function Ht(){return!Rt.getDocument()&&!!Rt.getNavigator()&&navigator.product===Nf}function Mf(){return Ht()&&typeof K<"u"&&typeof(K==null?void 0:K.Platform)<"u"&&(K==null?void 0:K.Platform.OS)==="android"}function qf(){return Ht()&&typeof K<"u"&&typeof(K==null?void 0:K.Platform)<"u"&&(K==null?void 0:K.Platform.OS)==="ios"}function Di(){return!Zr()&&!!Rt.getNavigator()&&!!Rt.getDocument()}function yr(){return Ht()?Ge.reactNative:Zr()?Ge.node:Di()?Ge.browser:Ge.unknown}function ca(){var i;try{return Ht()&&typeof K<"u"&&typeof(K==null?void 0:K.Application)<"u"?(i=K.Application)==null?void 0:i.applicationId:void 0}catch{return}}function zf(i,t){const e=new URLSearchParams(i);for(const r of Object.keys(t).sort())if(t.hasOwnProperty(r)){const n=t[r];n!==void 0&&e.set(r,n)}return e.toString()}function jf(i){var t,e;const r=$l();try{return i!=null&&i.url&&r.url&&new URL(i.url).host!==new URL(r.url).host&&(console.warn(`The configured WalletConnect 'metadata.url':${i.url} differs from the actual page url:${r.url}. This is probably unintended and can lead to issues.`),i.url=r.url),(t=i==null?void 0:i.icons)!=null&&t.length&&i.icons.length>0&&(i.icons=i.icons.filter(n=>n!=="")),Uf(oa(oa({},r),i),{url:(i==null?void 0:i.url)||r.url,name:(i==null?void 0:i.name)||r.name,description:(i==null?void 0:i.description)||r.description,icons:(e=i==null?void 0:i.icons)!=null&&e.length&&i.icons.length>0?i.icons:r.icons})}catch(n){return console.warn("Error populating app metadata",n),i||r}}function $l(){return Qh.getWindowMetadata()||{name:"",description:"",url:"",icons:[""]}}function Kf(){if(yr()===Ge.reactNative&&typeof K<"u"&&typeof(K==null?void 0:K.Platform)<"u"){const{OS:e,Version:r}=K.Platform;return[e,r].join("-")}const i=ed();if(i===null)return"unknown";const t=i.os?i.os.replace(" ","").toLowerCase():"unknown";return i.type==="browser"?[t,i.name,i.version].join("-"):[t,i.version].join("-")}function Ff(){var i;const t=yr();return t===Ge.browser?[t,((i=Rt.getLocation())==null?void 0:i.host)||"unknown"].join(":"):t}function kl(i,t,e){const r=Kf(),n=Ff();return[[i,t].join("-"),[Bf,e].join("-"),r,n].join("/")}function Wf({protocol:i,version:t,relayUrl:e,sdkVersion:r,auth:n,projectId:s,useOnCloseEvent:o,bundleId:c,packageName:l}){const u=e.split("?"),h=kl(i,t,r),d={auth:n,ua:h,projectId:s,useOnCloseEvent:o,packageName:l||void 0,bundleId:c||void 0},p=zf(u[1]||"",d);return u[0]+"?"+p}function ei(i,t){return i.filter(e=>t.includes(e)).length===i.length}function as(i){return Object.fromEntries(i.entries())}function cs(i){return new Map(Object.entries(i))}function Zt(i=B.FIVE_MINUTES,t){const e=B.toMiliseconds(i||B.FIVE_MINUTES);let r,n,s,o;return{resolve:c=>{s&&r&&(clearTimeout(s),r(c),o=Promise.resolve(c))},reject:c=>{s&&n&&(clearTimeout(s),n(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),r=c,n=l})}}function mt(i,t,e){return new Promise(async(r,n)=>{const s=setTimeout(()=>n(new Error(e)),t);try{const o=await i;r(o)}catch(o){n(o)}clearTimeout(s)})}function Ul(i,t){if(typeof t=="string"&&t.startsWith(`${i}:`))return t;if(i.toLowerCase()==="topic"){if(typeof t!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${t}`}else if(i.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: ${i}`)}function Hf(i){return Ul("topic",i)}function Gf(i){return Ul("id",i)}function Nl(i){const[t,e]=i.split(":"),r={id:void 0,topic:void 0};if(t==="topic"&&typeof e=="string")r.topic=e;else if(t==="id"&&Number.isInteger(Number(e)))r.id=Number(e);else throw new Error(`Invalid target, expected id:number or topic:string, got ${t}:${e}`);return r}function _e(i,t){return B.fromMiliseconds(Date.now()+B.toMiliseconds(i))}function Bt(i){return Date.now()>=B.toMiliseconds(i)}function te(i,t){return`${i}${t?`:${t}`:""}`}function ni(i=[],t=[]){return[...new Set([...i,...t])]}async function Jf({id:i,topic:t,wcDeepLink:e}){var r;try{if(!e)return;const n=typeof e=="string"?JSON.parse(e):e,s=n==null?void 0:n.href;if(typeof s!="string")return;const o=Yf(s,i,t),c=yr();if(c===Ge.browser){if(!((r=Rt.getDocument())!=null&&r.hasFocus())){console.warn("Document does not have focus, skipping deeplink.");return}Zf(o)}else c===Ge.reactNative&&typeof(K==null?void 0:K.Linking)<"u"&&await K.Linking.openURL(o)}catch(n){console.error(n)}}function Yf(i,t,e){const r=`requestId=${t}&sessionTopic=${e}`;i.endsWith("/")&&(i=i.slice(0,-1));let n=`${i}`;if(i.startsWith("https://t.me")){const s=i.includes("?")?"&startapp=":"?startapp=";n=`${n}${s}${tm(r,!0)}`}else n=`${n}/wc?${r}`;return n}function Zf(i){let t="_self";em()?t="_top":(Xf()||i.startsWith("https://")||i.startsWith("http://"))&&(t="_blank"),window.open(i,t,"noreferrer noopener")}async function Qf(i,t){let e="";try{if(Di()&&(e=localStorage.getItem(t),e))return e;e=await i.getItem(t)}catch(r){console.error(r)}return e}function la(i,t){if(!i.includes(t))return null;const e=i.split(/([&,?,=])/),r=e.indexOf(t);return e[r+2]}function ua(){return typeof crypto<"u"&&crypto!=null&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu,i=>{const t=Math.random()*16|0;return(i==="x"?t:t&3|8).toString(16)})}function so(){return typeof Kt<"u"&&Df.IS_VITEST==="true"}function Xf(){return typeof window<"u"&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)}function em(){try{return window.self!==window.top}catch{return!1}}function tm(i,t=!1){const e=ee.from(i).toString("base64");return t?e.replace(/[=]/g,""):e}function Bl(i){return ee.from(i,"base64").toString("utf-8")}function im(i){return new Promise(t=>setTimeout(t,i))}let rm=class{constructor({limit:t}){aa(this,"limit"),aa(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 Or=BigInt(2**32-1),ha=BigInt(32);function Ml(i,t=!1){return t?{h:Number(i&Or),l:Number(i>>ha&Or)}:{h:Number(i>>ha&Or)|0,l:Number(i&Or)|0}}function ql(i,t=!1){const e=i.length;let r=new Uint32Array(e),n=new Uint32Array(e);for(let s=0;s<e;s++){const{h:o,l:c}=Ml(i[s],t);[r[s],n[s]]=[o,c]}return[r,n]}const da=(i,t,e)=>i>>>e,pa=(i,t,e)=>i<<32-e|t>>>e,Mt=(i,t,e)=>i>>>e|t<<32-e,qt=(i,t,e)=>i<<32-e|t>>>e,Hi=(i,t,e)=>i<<64-e|t>>>e-32,Gi=(i,t,e)=>i>>>e-32|t<<64-e,nm=(i,t)=>t,sm=(i,t)=>i,om=(i,t,e)=>i<<e|t>>>32-e,am=(i,t,e)=>t<<e|i>>>32-e,cm=(i,t,e)=>t<<e-32|i>>>64-e,lm=(i,t,e)=>i<<e-32|t>>>64-e;function ot(i,t,e,r){const n=(t>>>0)+(r>>>0);return{h:i+e+(n/2**32|0)|0,l:n|0}}const oo=(i,t,e)=>(i>>>0)+(t>>>0)+(e>>>0),ao=(i,t,e,r)=>t+e+r+(i/2**32|0)|0,um=(i,t,e,r)=>(i>>>0)+(t>>>0)+(e>>>0)+(r>>>0),hm=(i,t,e,r,n)=>t+e+r+n+(i/2**32|0)|0,dm=(i,t,e,r,n)=>(i>>>0)+(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0),pm=(i,t,e,r,n,s)=>t+e+r+n+s+(i/2**32|0)|0,fi=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;function co(i){return i instanceof Uint8Array||ArrayBuffer.isView(i)&&i.constructor.name==="Uint8Array"}function Lt(i){if(!Number.isSafeInteger(i)||i<0)throw new Error("positive integer expected, got "+i)}function it(i,...t){if(!co(i))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(i.length))throw new Error("Uint8Array expected of length "+t+", got length="+i.length)}function lo(i){if(typeof i!="function"||typeof i.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");Lt(i.outputLen),Lt(i.blockLen)}function Wt(i,t=!0){if(i.destroyed)throw new Error("Hash instance has been destroyed");if(t&&i.finished)throw new Error("Hash#digest() has already been called")}function uo(i,t){it(i);const e=t.outputLen;if(i.length<e)throw new Error("digestInto() expects output buffer of length at least "+e)}function cr(i){return new Uint32Array(i.buffer,i.byteOffset,Math.floor(i.byteLength/4))}function rt(...i){for(let t=0;t<i.length;t++)i[t].fill(0)}function On(i){return new DataView(i.buffer,i.byteOffset,i.byteLength)}function ut(i,t){return i<<32-t|i>>>t}const zl=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function jl(i){return i<<24&4278190080|i<<8&16711680|i>>>8&65280|i>>>24&255}const It=zl?i=>i:i=>jl(i);function _m(i){for(let t=0;t<i.length;t++)i[t]=jl(i[t]);return i}const zt=zl?i=>i:_m,Kl=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",fm=Array.from({length:256},(i,t)=>t.toString(16).padStart(2,"0"));function lr(i){if(it(i),Kl)return i.toHex();let t="";for(let e=0;e<i.length;e++)t+=fm[i[e]];return t}const vt={_0:48,_9:57,A:65,F:70,a:97,f:102};function _a(i){if(i>=vt._0&&i<=vt._9)return i-vt._0;if(i>=vt.A&&i<=vt.F)return i-(vt.A-10);if(i>=vt.a&&i<=vt.f)return i-(vt.a-10)}function ho(i){if(typeof i!="string")throw new Error("hex string expected, got "+typeof i);if(Kl)return Uint8Array.fromHex(i);const t=i.length,e=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);const r=new Uint8Array(e);for(let n=0,s=0;n<e;n++,s+=2){const o=_a(i.charCodeAt(s)),c=_a(i.charCodeAt(s+1));if(o===void 0||c===void 0){const l=i[s]+i[s+1];throw new Error('hex string expected, got non-hex character "'+l+'" at index '+s)}r[n]=o*16+c}return r}function mm(i){if(typeof i!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(i))}function ct(i){return typeof i=="string"&&(i=mm(i)),it(i),i}function ti(...i){let t=0;for(let r=0;r<i.length;r++){const n=i[r];it(n),t+=n.length}const e=new Uint8Array(t);for(let r=0,n=0;r<i.length;r++){const s=i[r];e.set(s,n),n+=s.length}return e}class an{}function wr(i){const t=r=>i().update(ct(r)).digest(),e=i();return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=()=>i(),t}function ym(i){const t=(r,n)=>i(n).update(ct(r)).digest(),e=i({});return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=r=>i(r),t}function Vi(i=32){if(fi&&typeof fi.getRandomValues=="function")return fi.getRandomValues(new Uint8Array(i));if(fi&&typeof fi.randomBytes=="function")return Uint8Array.from(fi.randomBytes(i));throw new Error("crypto.getRandomValues must be defined")}const wm=BigInt(0),Ni=BigInt(1),gm=BigInt(2),Em=BigInt(7),vm=BigInt(256),bm=BigInt(113),Fl=[],Wl=[],Hl=[];for(let i=0,t=Ni,e=1,r=0;i<24;i++){[e,r]=[r,(2*e+3*r)%5],Fl.push(2*(5*r+e)),Wl.push((i+1)*(i+2)/2%64);let n=wm;for(let s=0;s<7;s++)t=(t<<Ni^(t>>Em)*bm)%vm,t&gm&&(n^=Ni<<(Ni<<BigInt(s))-Ni);Hl.push(n)}const Gl=ql(Hl,!0),Im=Gl[0],Am=Gl[1],fa=(i,t,e)=>e>32?cm(i,t,e):om(i,t,e),ma=(i,t,e)=>e>32?lm(i,t,e):am(i,t,e);function Tm(i,t=24){const e=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let o=0;o<10;o++)e[o]=i[o]^i[o+10]^i[o+20]^i[o+30]^i[o+40];for(let o=0;o<10;o+=2){const c=(o+8)%10,l=(o+2)%10,u=e[l],h=e[l+1],d=fa(u,h,1)^e[c],p=ma(u,h,1)^e[c+1];for(let _=0;_<50;_+=10)i[o+_]^=d,i[o+_+1]^=p}let n=i[2],s=i[3];for(let o=0;o<24;o++){const c=Wl[o],l=fa(n,s,c),u=ma(n,s,c),h=Fl[o];n=i[h],s=i[h+1],i[h]=l,i[h+1]=u}for(let o=0;o<50;o+=10){for(let c=0;c<10;c++)e[c]=i[o+c];for(let c=0;c<10;c++)i[o+c]^=~e[(c+2)%10]&e[(c+4)%10]}i[0]^=Im[r],i[1]^=Am[r]}rt(e)}let Pm=class Jl extends an{constructor(t,e,r,n=!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=r,this.enableXOF=n,this.rounds=s,Lt(r),!(0<t&&t<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=cr(this.state)}clone(){return this._cloneInto()}keccak(){zt(this.state32),Tm(this.state32,this.rounds),zt(this.state32),this.posOut=0,this.pos=0}update(t){Wt(this),t=ct(t),it(t);const{blockLen:e,state:r}=this,n=t.length;for(let s=0;s<n;){const o=Math.min(e-this.pos,n-s);for(let c=0;c<o;c++)r[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:r,blockLen:n}=this;t[r]^=e,e&128&&r===n-1&&this.keccak(),t[n-1]^=128,this.keccak()}writeInto(t){Wt(this,!1),it(t),this.finish();const e=this.state,{blockLen:r}=this;for(let n=0,s=t.length;n<s;){this.posOut>=r&&this.keccak();const o=Math.min(r-this.posOut,s-n);t.set(e.subarray(this.posOut,this.posOut+o),n),this.posOut+=o,n+=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(uo(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:r,outputLen:n,rounds:s,enableXOF:o}=this;return t||(t=new Jl(e,r,n,o,s)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=s,t.suffix=r,t.outputLen=n,t.enableXOF=o,t.destroyed=this.destroyed,t}};const Om=(i,t,e)=>wr(()=>new Pm(t,i,e)),Rm=Om(1,136,256/8);function Lm(i,t,e,r){if(typeof i.setBigUint64=="function")return i.setBigUint64(t,e,r);const n=BigInt(32),s=BigInt(4294967295),o=Number(e>>n&s),c=Number(e&s),l=r?4:0,u=r?0:4;i.setUint32(t+l,o,r),i.setUint32(t+u,c,r)}function Dm(i,t,e){return i&t^~i&e}function Vm(i,t,e){return i&t^i&e^t&e}let Yl=class extends an{constructor(t,e,r,n){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=t,this.outputLen=e,this.padOffset=r,this.isLE=n,this.buffer=new Uint8Array(t),this.view=On(this.buffer)}update(t){Wt(this),t=ct(t),it(t);const{view:e,buffer:r,blockLen:n}=this,s=t.length;for(let o=0;o<s;){const c=Math.min(n-this.pos,s-o);if(c===n){const l=On(t);for(;n<=s-o;o+=n)this.process(l,o);continue}r.set(t.subarray(o,o+c),this.pos),this.pos+=c,o+=c,this.pos===n&&(this.process(e,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){Wt(this),uo(t,this),this.finished=!0;const{buffer:e,view:r,blockLen:n,isLE:s}=this;let{pos:o}=this;e[o++]=128,rt(this.buffer.subarray(o)),this.padOffset>n-o&&(this.process(r,0),o=0);for(let d=o;d<n;d++)e[d]=0;Lm(r,n-8,BigInt(this.length*8),s),this.process(r,0);const c=On(t),l=this.outputLen;if(l%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const u=l/4,h=this.get();if(u>h.length)throw new Error("_sha2: outputLen bigger than state");for(let d=0;d<u;d++)c.setUint32(4*d,h[d],s)}digest(){const{buffer:t,outputLen:e}=this;this.digestInto(t);const r=t.slice(0,e);return this.destroy(),r}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:e,buffer:r,length:n,finished:s,destroyed:o,pos:c}=this;return t.destroyed=o,t.finished=s,t.length=n,t.pos=c,n%e&&t.buffer.set(r),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]),xm=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]),xt=new Uint32Array(64);let Sm=class extends Yl{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:r,D:n,E:s,F:o,G:c,H:l}=this;return[t,e,r,n,s,o,c,l]}set(t,e,r,n,s,o,c,l){this.A=t|0,this.B=e|0,this.C=r|0,this.D=n|0,this.E=s|0,this.F=o|0,this.G=c|0,this.H=l|0}process(t,e){for(let d=0;d<16;d++,e+=4)xt[d]=t.getUint32(e,!1);for(let d=16;d<64;d++){const p=xt[d-15],_=xt[d-2],f=ut(p,7)^ut(p,18)^p>>>3,m=ut(_,17)^ut(_,19)^_>>>10;xt[d]=m+xt[d-7]+f+xt[d-16]|0}let{A:r,B:n,C:s,D:o,E:c,F:l,G:u,H:h}=this;for(let d=0;d<64;d++){const p=ut(c,6)^ut(c,11)^ut(c,25),_=h+p+Dm(c,l,u)+xm[d]+xt[d]|0,f=(ut(r,2)^ut(r,13)^ut(r,22))+Vm(r,n,s)|0;h=u,u=l,l=c,c=o+_|0,o=s,s=n,n=r,r=_+f|0}r=r+this.A|0,n=n+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,h=h+this.H|0,this.set(r,n,s,o,c,l,u,h)}roundClean(){rt(xt)}destroy(){this.set(0,0,0,0,0,0,0,0),rt(this.buffer)}};const Zl=ql(["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(i=>BigInt(i))),Cm=Zl[0],$m=Zl[1],St=new Uint32Array(80),Ct=new Uint32Array(80);let po=class extends Yl{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:r,Bl:n,Ch:s,Cl:o,Dh:c,Dl:l,Eh:u,El:h,Fh:d,Fl:p,Gh:_,Gl:f,Hh:m,Hl:y}=this;return[t,e,r,n,s,o,c,l,u,h,d,p,_,f,m,y]}set(t,e,r,n,s,o,c,l,u,h,d,p,_,f,m,y){this.Ah=t|0,this.Al=e|0,this.Bh=r|0,this.Bl=n|0,this.Ch=s|0,this.Cl=o|0,this.Dh=c|0,this.Dl=l|0,this.Eh=u|0,this.El=h|0,this.Fh=d|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 v=0;v<16;v++,e+=4)St[v]=t.getUint32(e),Ct[v]=t.getUint32(e+=4);for(let v=16;v<80;v++){const P=St[v-15]|0,T=Ct[v-15]|0,g=Mt(P,T,1)^Mt(P,T,8)^da(P,T,7),D=qt(P,T,1)^qt(P,T,8)^pa(P,T,7),L=St[v-2]|0,w=Ct[v-2]|0,E=Mt(L,w,19)^Hi(L,w,61)^da(L,w,6),I=qt(L,w,19)^Gi(L,w,61)^pa(L,w,6),A=um(D,I,Ct[v-7],Ct[v-16]),V=hm(A,g,E,St[v-7],St[v-16]);St[v]=V|0,Ct[v]=A|0}let{Ah:r,Al:n,Bh:s,Bl:o,Ch:c,Cl:l,Dh:u,Dl:h,Eh:d,El:p,Fh:_,Fl:f,Gh:m,Gl:y,Hh:b,Hl:R}=this;for(let v=0;v<80;v++){const P=Mt(d,p,14)^Mt(d,p,18)^Hi(d,p,41),T=qt(d,p,14)^qt(d,p,18)^Gi(d,p,41),g=d&_^~d&m,D=p&f^~p&y,L=dm(R,T,D,$m[v],Ct[v]),w=pm(L,b,P,g,Cm[v],St[v]),E=L|0,I=Mt(r,n,28)^Hi(r,n,34)^Hi(r,n,39),A=qt(r,n,28)^Gi(r,n,34)^Gi(r,n,39),V=r&s^r&c^s&c,O=n&o^n&l^o&l;b=m|0,R=y|0,m=_|0,y=f|0,_=d|0,f=p|0,{h:d,l:p}=ot(u|0,h|0,w|0,E|0),u=c|0,h=l|0,c=s|0,l=o|0,s=r|0,o=n|0;const x=oo(E,A,O);r=ao(x,w,I,V),n=x|0}({h:r,l:n}=ot(this.Ah|0,this.Al|0,r|0,n|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:h}=ot(this.Dh|0,this.Dl|0,u|0,h|0),{h:d,l:p}=ot(this.Eh|0,this.El|0,d|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:R}=ot(this.Hh|0,this.Hl|0,b|0,R|0),this.set(r,n,s,o,c,l,u,h,d,p,_,f,m,y,b,R)}roundClean(){rt(St,Ct)}destroy(){rt(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}},km=class extends po{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 Um extends po{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 cn=wr(()=>new Sm),Nm=wr(()=>new po),Bm=wr(()=>new km),Mm=wr(()=>new Um),qm=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]),q=new Uint32Array(32);function $t(i,t,e,r,n,s){const o=n[s],c=n[s+1];let l=q[2*i],u=q[2*i+1],h=q[2*t],d=q[2*t+1],p=q[2*e],_=q[2*e+1],f=q[2*r],m=q[2*r+1],y=oo(l,h,o);u=ao(y,u,d,c),l=y|0,{Dh:m,Dl:f}={Dh:m^u,Dl:f^l},{Dh:m,Dl:f}={Dh:nm(m,f),Dl:sm(m)},{h:_,l:p}=ot(_,p,m,f),{Bh:d,Bl:h}={Bh:d^_,Bl:h^p},{Bh:d,Bl:h}={Bh:Mt(d,h,24),Bl:qt(d,h,24)},q[2*i]=l,q[2*i+1]=u,q[2*t]=h,q[2*t+1]=d,q[2*e]=p,q[2*e+1]=_,q[2*r]=f,q[2*r+1]=m}function kt(i,t,e,r,n,s){const o=n[s],c=n[s+1];let l=q[2*i],u=q[2*i+1],h=q[2*t],d=q[2*t+1],p=q[2*e],_=q[2*e+1],f=q[2*r],m=q[2*r+1],y=oo(l,h,o);u=ao(y,u,d,c),l=y|0,{Dh:m,Dl:f}={Dh:m^u,Dl:f^l},{Dh:m,Dl:f}={Dh:Mt(m,f,16),Dl:qt(m,f,16)},{h:_,l:p}=ot(_,p,m,f),{Bh:d,Bl:h}={Bh:d^_,Bl:h^p},{Bh:d,Bl:h}={Bh:Hi(d,h,63),Bl:Gi(d,h,63)},q[2*i]=l,q[2*i+1]=u,q[2*t]=h,q[2*t+1]=d,q[2*e]=p,q[2*e+1]=_,q[2*r]=f,q[2*r+1]=m}function zm(i,t={},e,r,n){if(Lt(e),i<0||i>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!==r)throw new Error("salt must be undefined or "+r);if(c!==void 0&&c.length!==n)throw new Error("personalization must be undefined or "+n)}class jm extends an{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=cr(this.buffer)}update(t){Wt(this),t=ct(t),it(t);const{blockLen:e,buffer:r,buffer32:n}=this,s=t.length,o=t.byteOffset,c=t.buffer;for(let l=0;l<s;){this.pos===e&&(zt(n),this.compress(n,0,!1),zt(n),this.pos=0);const u=Math.min(e-this.pos,s-l),h=o+l;if(u===e&&!(h%4)&&l+u<s){const d=new Uint32Array(c,h,Math.floor((s-l)/4));zt(d);for(let p=0;l+e<s;p+=n.length,l+=e)this.length+=e,this.compress(d,p,!1);zt(d);continue}r.set(t.subarray(l,l+u),this.pos),this.pos+=u,this.length+=u,l+=u}return this}digestInto(t){Wt(this),uo(t,this);const{pos:e,buffer32:r}=this;this.finished=!0,rt(this.buffer.subarray(e)),zt(r),this.compress(r,0,!0),zt(r);const n=cr(t);this.get().forEach((s,o)=>n[o]=It(s))}digest(){const{buffer:t,outputLen:e}=this;this.digestInto(t);const r=t.slice(0,e);return this.destroy(),r}_cloneInto(t){const{buffer:e,length:r,finished:n,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=n,t.length=r,t.pos=c,t.outputLen=o,t}clone(){return this._cloneInto()}}class Km extends jm{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,zm(e,t,64,16,16);let{key:r,personalization:n,salt:s}=t,o=0;if(r!==void 0&&(r=ct(r),o=r.length),this.v0l^=this.outputLen|o<<8|65536|1<<24,s!==void 0){s=ct(s);const c=cr(s);this.v4l^=It(c[0]),this.v4h^=It(c[1]),this.v5l^=It(c[2]),this.v5h^=It(c[3])}if(n!==void 0){n=ct(n);const c=cr(n);this.v6l^=It(c[0]),this.v6h^=It(c[1]),this.v7l^=It(c[2]),this.v7h^=It(c[3])}if(r!==void 0){const c=new Uint8Array(this.blockLen);c.set(r),this.update(c)}}get(){let{v0l:t,v0h:e,v1l:r,v1h:n,v2l:s,v2h:o,v3l:c,v3h:l,v4l:u,v4h:h,v5l:d,v5h:p,v6l:_,v6h:f,v7l:m,v7h:y}=this;return[t,e,r,n,s,o,c,l,u,h,d,p,_,f,m,y]}set(t,e,r,n,s,o,c,l,u,h,d,p,_,f,m,y){this.v0l=t|0,this.v0h=e|0,this.v1l=r|0,this.v1h=n|0,this.v2l=s|0,this.v2h=o|0,this.v3l=c|0,this.v3h=l|0,this.v4l=u|0,this.v4h=h|0,this.v5l=d|0,this.v5h=p|0,this.v6l=_|0,this.v6h=f|0,this.v7l=m|0,this.v7h=y|0}compress(t,e,r){this.get().forEach((l,u)=>q[u]=l),q.set(pe,16);let{h:n,l:s}=Ml(BigInt(this.length));q[24]=pe[8]^s,q[25]=pe[9]^n,r&&(q[28]=~q[28],q[29]=~q[29]);let o=0;const c=qm;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^=q[0]^q[16],this.v0h^=q[1]^q[17],this.v1l^=q[2]^q[18],this.v1h^=q[3]^q[19],this.v2l^=q[4]^q[20],this.v2h^=q[5]^q[21],this.v3l^=q[6]^q[22],this.v3h^=q[7]^q[23],this.v4l^=q[8]^q[24],this.v4h^=q[9]^q[25],this.v5l^=q[10]^q[26],this.v5h^=q[11]^q[27],this.v6l^=q[12]^q[28],this.v6h^=q[13]^q[29],this.v7l^=q[14]^q[30],this.v7h^=q[15]^q[31],rt(q)}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 Fm=ym(i=>new Km(i)),Wm="https://rpc.walletconnect.org/v1";function Ql(i){const t=`Ethereum Signed Message:
4
4
  ${i.length}`,e=new TextEncoder().encode(t+i);return"0x"+ee.from(Rm(e)).toString("hex")}async function Hm(i,t,e,r,n,s){switch(e.t){case"eip191":return await Gm(i,t,e.s);case"eip1271":return await Jm(i,t,e.s,r,n,s);default:throw new Error(`verifySignature failed: Attempted to verify CacaoSignature with unknown type: ${e.t}`)}}async function Gm(i,t,e){return(await G_({hash:Ql(t),signature:e})).toLowerCase()===i.toLowerCase()}async function Jm(i,t,e,r,n,s){const o=kr(r);if(!o.namespace||!o.reference)throw new Error(`isValidEip1271Signature failed: chainId must be in CAIP-2 format, received: ${r}`);try{const c="0x1626ba7e",l="0000000000000000000000000000000000000000000000000000000000000040",u=e.substring(2),h=(u.length/2).toString(16).padStart(64,"0"),d=(t.startsWith("0x")?t:Ql(t)).substring(2),p=c+d+l+h+u,_=await fetch(`${s||Wm}/?chainId=${r}&projectId=${n}`,{headers:{"Content-Type":"application/json"},method:"POST",body:JSON.stringify({id:Ym(),jsonrpc:"2.0",method:"eth_call",params:[{to:i,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 Ym(){return Date.now()+Math.floor(Math.random()*1e3)}function Zm(i){const t=atob(i),e=new Uint8Array(t.length);for(let o=0;o<t.length;o++)e[o]=t.charCodeAt(o);const r=e[0];if(r===0)throw new Error("No signatures found");const n=1+r*64;if(e.length<n)throw new Error("Transaction data too short for claimed signature count");if(e.length<100)throw new Error("Transaction too short");const s=ee.from(i,"base64").slice(1,65);return fr.encode(s)}function Qm(i){const t=new Uint8Array(ee.from(i,"base64")),e=Array.from("TransactionData::").map(s=>s.charCodeAt(0)),r=new Uint8Array(e.length+t.length);r.set(e),r.set(t,e.length);const n=Fm(r,{dkLen:32});return fr.encode(n)}function ya(i){const t=new Uint8Array(cn(Xm(i)));return fr.encode(t)}function Xm(i){if(i instanceof Uint8Array)return i;if(Array.isArray(i))return new Uint8Array(i);if(typeof i=="object"&&i!=null&&i.data)return new Uint8Array(Object.values(i.data));if(typeof i=="object"&&i)return new Uint8Array(Object.values(i));throw new Error("getNearUint8ArrayFromBytes: Unexpected result type from bytes array")}function wa(i){const t=ee.from(i,"base64"),e=Lf(t).txn;if(!e)throw new Error("Invalid signed transaction: missing 'txn' field");const r=vf(e),n=ee.from("TX"),s=ee.concat([n,ee.from(r)]),o=Mm(s);return Nh.encode(o).replace(/=+$/,"")}function Rn(i){const t=[];let e=BigInt(i);for(;e>=BigInt(128);)t.push(Number(e&BigInt(127)|BigInt(128))),e>>=BigInt(7);return t.push(Number(e)),ee.from(t)}function ey(i){const t=ee.from(i.signed.bodyBytes,"base64"),e=ee.from(i.signed.authInfoBytes,"base64"),r=ee.from(i.signature.signature,"base64"),n=[];n.push(ee.from([10])),n.push(Rn(t.length)),n.push(t),n.push(ee.from([18])),n.push(Rn(e.length)),n.push(e),n.push(ee.from([26])),n.push(Rn(r.length)),n.push(r);const s=ee.concat(n),o=cn(s);return ee.from(o).toString("hex").toUpperCase()}var ty=Object.defineProperty,iy=Object.defineProperties,ry=Object.getOwnPropertyDescriptors,ga=Object.getOwnPropertySymbols,ny=Object.prototype.hasOwnProperty,sy=Object.prototype.propertyIsEnumerable,Ea=(i,t,e)=>t in i?ty(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,oy=(i,t)=>{for(var e in t||(t={}))ny.call(t,e)&&Ea(i,e,t[e]);if(ga)for(var e of ga(t))sy.call(t,e)&&Ea(i,e,t[e]);return i},ay=(i,t)=>iy(i,ry(t));const cy="did:pkh:",_o=i=>i==null?void 0:i.split(":"),ly=i=>{const t=i&&_o(i);if(t)return i.includes(cy)?t[3]:t[1]},ls=i=>{const t=i&&_o(i);if(t)return t[2]+":"+t[3]},Qr=i=>{const t=i&&_o(i);if(t)return t.pop()};async function va(i){const{cacao:t,projectId:e}=i,{s:r,p:n}=t,s=Xl(n,n.iss),o=Qr(n.iss);return await Hm(o,s,r,ls(n.iss),e)}const Xl=(i,t)=>{const e=`${i.domain} wants you to sign in with your Ethereum account:`,r=Qr(t);if(!i.aud&&!i.uri)throw new Error("Either `aud` or `uri` is required to construct the message");let n=i.statement||void 0;const s=`URI: ${i.aud||i.uri}`,o=`Version: ${i.version}`,c=`Chain ID: ${ly(t)}`,l=`Nonce: ${i.nonce}`,u=`Issued At: ${i.iat}`,h=i.exp?`Expiration Time: ${i.exp}`:void 0,d=i.nbf?`Not Before: ${i.nbf}`:void 0,p=i.requestId?`Request ID: ${i.requestId}`:void 0,_=i.resources?`Resources:${i.resources.map(m=>`
5
5
  - ${m}`).join("")}`:void 0,f=Ur(i.resources);if(f){const m=ur(f);n=wy(n,m)}return[e,r,"",n,"",s,o,c,l,u,h,d,p,_].filter(m=>m!=null).join(`
6
6
  `)};function uy(i){return ee.from(JSON.stringify(i)).toString("base64")}function hy(i){return JSON.parse(ee.from(i,"base64").toString("utf-8"))}function ai(i){if(!i)throw new Error("No recap provided, value is undefined");if(!i.att)throw new Error("No `att` property found");const t=Object.keys(i.att);if(!(t!=null&&t.length))throw new Error("No resources found in `att` property");t.forEach(e=>{const r=i.att[e];if(Array.isArray(r))throw new Error(`Resource must be an object: ${e}`);if(typeof r!="object")throw new Error(`Resource must be an object: ${e}`);if(!Object.keys(r).length)throw new Error(`Resource object is empty: ${e}`);Object.keys(r).forEach(n=>{const s=r[n];if(!Array.isArray(s))throw new Error(`Ability limits ${n} must be an array of objects, found: ${s}`);if(!s.length)throw new Error(`Value of ${n} is empty array, must be an array with objects`);s.forEach(o=>{if(typeof o!="object")throw new Error(`Ability limits (${n}) must be an array of objects, found: ${o}`)})})})}function dy(i,t,e,r={}){return e==null||e.sort((n,s)=>n.localeCompare(s)),{att:{[i]:py(t,e,r)}}}function py(i,t,e={}){t=t==null?void 0:t.sort((n,s)=>n.localeCompare(s));const r=t.map(n=>({[`${i}/${n}`]:[e]}));return Object.assign({},...r)}function eu(i){return ai(i),`urn:recap:${uy(i).replace(/=/g,"")}`}function ur(i){const t=hy(i.replace("urn:recap:",""));return ai(t),t}function _y(i,t,e){const r=dy(i,t,e);return eu(r)}function fy(i){return i&&i.includes("urn:recap:")}function my(i,t){const e=ur(i),r=ur(t),n=yy(e,r);return eu(n)}function yy(i,t){ai(i),ai(t);const e=Object.keys(i.att).concat(Object.keys(t.att)).sort((n,s)=>n.localeCompare(s)),r={att:{}};return e.forEach(n=>{var s,o;Object.keys(((s=i.att)==null?void 0:s[n])||{}).concat(Object.keys(((o=t.att)==null?void 0:o[n])||{})).sort((c,l)=>c.localeCompare(l)).forEach(c=>{var l,u;r.att[n]=ay(oy({},r.att[n]),{[c]:((l=i.att[n])==null?void 0:l[c])||((u=t.att[n])==null?void 0:u[c])})})}),r}function wy(i="",t){ai(t);const e="I further authorize the stated URI to perform the following actions on my behalf: ";if(i.includes(e))return i;const r=[];let n=0;Object.keys(t.att).forEach(c=>{const l=Object.keys(t.att[c]).map(d=>({ability:d.split("/")[0],action:d.split("/")[1]}));l.sort((d,p)=>d.action.localeCompare(p.action));const u={};l.forEach(d=>{u[d.ability]||(u[d.ability]=[]),u[d.ability].push(d.action)});const h=Object.keys(u).map(d=>(n++,`(${n}) '${d}': '${u[d].join("', '")}' for '${c}'.`));r.push(h.join(", ").replace(".,","."))});const s=r.join(" "),o=`${e}${s}`;return`${i?i+" ":""}${o}`}function ba(i){var t;const e=ur(i);ai(e);const r=(t=e.att)==null?void 0:t.eip155;return r?Object.keys(r).map(n=>n.split("/")[1]):[]}function Ia(i){const t=ur(i);ai(t);const e=[];return Object.values(t.att).forEach(r=>{Object.values(r).forEach(n=>{var s;(s=n==null?void 0:n[0])!=null&&s.chains&&e.push(n[0].chains)})}),[...new Set(e.flat())]}function Ur(i){if(!i)return;const t=i==null?void 0:i[i.length-1];return fy(t)?t:void 0}/*! noble-ciphers - MIT License (c) 2023 Paul Miller (paulmillr.com) */function tu(i){return i instanceof Uint8Array||ArrayBuffer.isView(i)&&i.constructor.name==="Uint8Array"}function us(i){if(typeof i!="boolean")throw new Error(`boolean expected, not ${i}`)}function Ln(i){if(!Number.isSafeInteger(i)||i<0)throw new Error("positive integer expected, got "+i)}function Be(i,...t){if(!tu(i))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(i.length))throw new Error("Uint8Array expected of length "+t+", got length="+i.length)}function Aa(i,t=!0){if(i.destroyed)throw new Error("Hash instance has been destroyed");if(t&&i.finished)throw new Error("Hash#digest() has already been called")}function gy(i,t){Be(i);const e=t.outputLen;if(i.length<e)throw new Error("digestInto() expects output buffer of length at least "+e)}function Ft(i){return new Uint32Array(i.buffer,i.byteOffset,Math.floor(i.byteLength/4))}function bi(...i){for(let t=0;t<i.length;t++)i[t].fill(0)}function Ey(i){return new DataView(i.buffer,i.byteOffset,i.byteLength)}const vy=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function by(i){if(typeof i!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(i))}function hs(i){if(typeof i=="string")i=by(i);else if(tu(i))i=ds(i);else throw new Error("Uint8Array expected, got "+typeof i);return i}function Iy(i,t){if(t==null||typeof t!="object")throw new Error("options must be defined");return Object.assign(i,t)}function Ay(i,t){if(i.length!==t.length)return!1;let e=0;for(let r=0;r<i.length;r++)e|=i[r]^t[r];return e===0}const Ty=(i,t)=>{function e(r,...n){if(Be(r),!vy)throw new Error("Non little-endian hardware is not yet supported");if(i.nonceLength!==void 0){const u=n[0];if(!u)throw new Error("nonce / iv required");i.varSizeNonce?Be(u):Be(u,i.nonceLength)}const s=i.tagLength;s&&n[1]!==void 0&&Be(n[1]);const o=t(r,...n),c=(u,h)=>{if(h!==void 0){if(u!==2)throw new Error("cipher output not supported");Be(h)}};let l=!1;return{encrypt(u,h){if(l)throw new Error("cannot encrypt() twice with same key + nonce");return l=!0,Be(u),c(o.encrypt.length,h),o.encrypt(u,h)},decrypt(u,h){if(Be(u),s&&u.length<s)throw new Error("invalid ciphertext length: smaller than tagLength="+s);return c(o.decrypt.length,h),o.decrypt(u,h)}}}return Object.assign(e,i),e};function Ta(i,t,e=!0){if(t===void 0)return new Uint8Array(i);if(t.length!==i)throw new Error("invalid output length, expected "+i+", got: "+t.length);if(e&&!Oy(t))throw new Error("invalid output, must be aligned");return t}function Pa(i,t,e,r){if(typeof i.setBigUint64=="function")return i.setBigUint64(t,e,r);const n=BigInt(32),s=BigInt(4294967295),o=Number(e>>n&s),c=Number(e&s);i.setUint32(t+4,o,r),i.setUint32(t+0,c,r)}function Py(i,t,e){us(e);const r=new Uint8Array(16),n=Ey(r);return Pa(n,0,BigInt(t),e),Pa(n,8,BigInt(i),e),r}function Oy(i){return i.byteOffset%4===0}function ds(i){return Uint8Array.from(i)}const iu=i=>Uint8Array.from(i.split("").map(t=>t.charCodeAt(0))),Ry=iu("expand 16-byte k"),Ly=iu("expand 32-byte k"),Dy=Ft(Ry),Vy=Ft(Ly);function Q(i,t){return i<<t|i>>>32-t}function ps(i){return i.byteOffset%4===0}const Rr=64,xy=16,ru=2**32-1,Oa=new Uint32Array;function Sy(i,t,e,r,n,s,o,c){const l=n.length,u=new Uint8Array(Rr),h=Ft(u),d=ps(n)&&ps(s),p=d?Ft(n):Oa,_=d?Ft(s):Oa;for(let f=0;f<l;o++){if(i(t,e,r,h,o,c),o>=ru)throw new Error("arx: counter overflow");const m=Math.min(Rr,l-f);if(d&&m===Rr){const y=f/4;if(f%4!==0)throw new Error("arx: invalid block position");for(let b=0,R;b<xy;b++)R=y+b,_[R]=p[R]^h[b];f+=Rr;continue}for(let y=0,b;y<m;y++)b=f+y,s[b]=n[b]^u[y];f+=m}}function Cy(i,t){const{allowShortKeys:e,extendNonceFn:r,counterLength:n,counterRight:s,rounds:o}=Iy({allowShortKeys:!1,counterLength:8,counterRight:!1,rounds:20},t);if(typeof i!="function")throw new Error("core must be a function");return Ln(n),Ln(o),us(s),us(e),(c,l,u,h,d=0)=>{Be(c),Be(l),Be(u);const p=u.length;if(h===void 0&&(h=new Uint8Array(p)),Be(h),Ln(d),d<0||d>=ru)throw new Error("arx: counter overflow");if(h.length<p)throw new Error(`arx: output (${h.length}) is shorter than data (${p})`);const _=[];let f=c.length,m,y;if(f===32)_.push(m=ds(c)),y=Vy;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}`);ps(l)||_.push(l=ds(l));const b=Ft(m);if(r){if(l.length!==24)throw new Error("arx: extended nonce must be 24 bytes");r(y,b,Ft(l.subarray(0,16)),b),l=l.subarray(16)}const R=16-n;if(R!==l.length)throw new Error(`arx: nonce must be ${R} or 16 bytes`);if(R!==12){const P=new Uint8Array(12);P.set(l,s?0:12-l.length),l=P,_.push(l)}const v=Ft(l);return Sy(i,y,b,v,u,h,d,o),bi(..._),h}}const Ee=(i,t)=>i[t++]&255|(i[t++]&255)<<8;class $y{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=hs(t),Be(t,32);const e=Ee(t,0),r=Ee(t,2),n=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|r<<3)&8191,this.r[2]=(r>>>10|n<<6)&7939,this.r[3]=(n>>>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 h=0;h<8;h++)this.pad[h]=Ee(t,16+2*h)}process(t,e,r=!1){const n=r?0:2048,{h:s,r:o}=this,c=o[0],l=o[1],u=o[2],h=o[3],d=o[4],p=o[5],_=o[6],f=o[7],m=o[8],y=o[9],b=Ee(t,e+0),R=Ee(t,e+2),v=Ee(t,e+4),P=Ee(t,e+6),T=Ee(t,e+8),g=Ee(t,e+10),D=Ee(t,e+12),L=Ee(t,e+14);let w=s[0]+(b&8191),E=s[1]+((b>>>13|R<<3)&8191),I=s[2]+((R>>>10|v<<6)&8191),A=s[3]+((v>>>7|P<<9)&8191),V=s[4]+((P>>>4|T<<12)&8191),O=s[5]+(T>>>1&8191),x=s[6]+((T>>>14|g<<2)&8191),$=s[7]+((g>>>11|D<<5)&8191),k=s[8]+((D>>>8|L<<8)&8191),M=s[9]+(L>>>5|n),C=0,U=C+w*c+E*(5*y)+I*(5*m)+A*(5*f)+V*(5*_);C=U>>>13,U&=8191,U+=O*(5*p)+x*(5*d)+$*(5*h)+k*(5*u)+M*(5*l),C+=U>>>13,U&=8191;let z=C+w*l+E*c+I*(5*y)+A*(5*m)+V*(5*f);C=z>>>13,z&=8191,z+=O*(5*_)+x*(5*p)+$*(5*d)+k*(5*h)+M*(5*u),C+=z>>>13,z&=8191;let j=C+w*u+E*l+I*c+A*(5*y)+V*(5*m);C=j>>>13,j&=8191,j+=O*(5*f)+x*(5*_)+$*(5*p)+k*(5*d)+M*(5*h),C+=j>>>13,j&=8191;let F=C+w*h+E*u+I*l+A*c+V*(5*y);C=F>>>13,F&=8191,F+=O*(5*m)+x*(5*f)+$*(5*_)+k*(5*p)+M*(5*d),C+=F>>>13,F&=8191;let W=C+w*d+E*h+I*u+A*l+V*c;C=W>>>13,W&=8191,W+=O*(5*y)+x*(5*m)+$*(5*f)+k*(5*_)+M*(5*p),C+=W>>>13,W&=8191;let H=C+w*p+E*d+I*h+A*u+V*l;C=H>>>13,H&=8191,H+=O*c+x*(5*y)+$*(5*m)+k*(5*f)+M*(5*_),C+=H>>>13,H&=8191;let G=C+w*_+E*p+I*d+A*h+V*u;C=G>>>13,G&=8191,G+=O*l+x*c+$*(5*y)+k*(5*m)+M*(5*f),C+=G>>>13,G&=8191;let ue=C+w*f+E*_+I*p+A*d+V*h;C=ue>>>13,ue&=8191,ue+=O*u+x*l+$*c+k*(5*y)+M*(5*m),C+=ue>>>13,ue&=8191;let ce=C+w*m+E*f+I*_+A*p+V*d;C=ce>>>13,ce&=8191,ce+=O*h+x*u+$*l+k*c+M*(5*y),C+=ce>>>13,ce&=8191;let oe=C+w*y+E*m+I*f+A*_+V*p;C=oe>>>13,oe&=8191,oe+=O*d+x*h+$*u+k*l+M*c,C+=oe>>>13,oe&=8191,C=(C<<2)+C|0,C=C+U|0,U=C&8191,C=C>>>13,z+=C,s[0]=U,s[1]=z,s[2]=j,s[3]=F,s[4]=W,s[5]=H,s[6]=G,s[7]=ue,s[8]=ce,s[9]=oe}finalize(){const{h:t,pad:e}=this,r=new Uint16Array(10);let n=t[1]>>>13;t[1]&=8191;for(let c=2;c<10;c++)t[c]+=n,n=t[c]>>>13,t[c]&=8191;t[0]+=n*5,n=t[0]>>>13,t[0]&=8191,t[1]+=n,n=t[1]>>>13,t[1]&=8191,t[2]+=n,r[0]=t[0]+5,n=r[0]>>>13,r[0]&=8191;for(let c=1;c<10;c++)r[c]=t[c]+n,n=r[c]>>>13,r[c]&=8191;r[9]-=8192;let s=(n^1)-1;for(let c=0;c<10;c++)r[c]&=s;s=~s;for(let c=0;c<10;c++)t[c]=t[c]&s|r[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;bi(r)}update(t){Aa(this),t=hs(t),Be(t);const{buffer:e,blockLen:r}=this,n=t.length;for(let s=0;s<n;){const o=Math.min(r-this.pos,n-s);if(o===r){for(;r<=n-s;s+=r)this.process(t,s);continue}e.set(t.subarray(s,s+o),this.pos),this.pos+=o,s+=o,this.pos===r&&(this.process(e,0,!1),this.pos=0)}return this}destroy(){bi(this.h,this.r,this.buffer,this.pad)}digestInto(t){Aa(this),gy(t,this),this.finished=!0;const{buffer:e,h:r}=this;let{pos:n}=this;if(n){for(e[n++]=1;n<16;n++)e[n]=0;this.process(e,0,!0)}this.finalize();let s=0;for(let o=0;o<8;o++)t[s++]=r[o]>>>0,t[s++]=r[o]>>>8;return t}digest(){const{buffer:t,outputLen:e}=this;this.digestInto(t);const r=t.slice(0,e);return this.destroy(),r}}function ky(i){const t=(r,n)=>i(n).update(hs(r)).digest(),e=i(new Uint8Array(32));return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=r=>i(r),t}const Uy=ky(i=>new $y(i));function Ny(i,t,e,r,n,s=20){let o=i[0],c=i[1],l=i[2],u=i[3],h=t[0],d=t[1],p=t[2],_=t[3],f=t[4],m=t[5],y=t[6],b=t[7],R=n,v=e[0],P=e[1],T=e[2],g=o,D=c,L=l,w=u,E=h,I=d,A=p,V=_,O=f,x=m,$=y,k=b,M=R,C=v,U=P,z=T;for(let F=0;F<s;F+=2)g=g+E|0,M=Q(M^g,16),O=O+M|0,E=Q(E^O,12),g=g+E|0,M=Q(M^g,8),O=O+M|0,E=Q(E^O,7),D=D+I|0,C=Q(C^D,16),x=x+C|0,I=Q(I^x,12),D=D+I|0,C=Q(C^D,8),x=x+C|0,I=Q(I^x,7),L=L+A|0,U=Q(U^L,16),$=$+U|0,A=Q(A^$,12),L=L+A|0,U=Q(U^L,8),$=$+U|0,A=Q(A^$,7),w=w+V|0,z=Q(z^w,16),k=k+z|0,V=Q(V^k,12),w=w+V|0,z=Q(z^w,8),k=k+z|0,V=Q(V^k,7),g=g+I|0,z=Q(z^g,16),$=$+z|0,I=Q(I^$,12),g=g+I|0,z=Q(z^g,8),$=$+z|0,I=Q(I^$,7),D=D+A|0,M=Q(M^D,16),k=k+M|0,A=Q(A^k,12),D=D+A|0,M=Q(M^D,8),k=k+M|0,A=Q(A^k,7),L=L+V|0,C=Q(C^L,16),O=O+C|0,V=Q(V^O,12),L=L+V|0,C=Q(C^L,8),O=O+C|0,V=Q(V^O,7),w=w+E|0,U=Q(U^w,16),x=x+U|0,E=Q(E^x,12),w=w+E|0,U=Q(U^w,8),x=x+U|0,E=Q(E^x,7);let j=0;r[j++]=o+g|0,r[j++]=c+D|0,r[j++]=l+L|0,r[j++]=u+w|0,r[j++]=h+E|0,r[j++]=d+I|0,r[j++]=p+A|0,r[j++]=_+V|0,r[j++]=f+O|0,r[j++]=m+x|0,r[j++]=y+$|0,r[j++]=b+k|0,r[j++]=R+M|0,r[j++]=v+C|0,r[j++]=P+U|0,r[j++]=T+z|0}const By=Cy(Ny,{counterRight:!1,counterLength:4,allowShortKeys:!1}),My=new Uint8Array(16),Ra=(i,t)=>{i.update(t);const e=t.length%16;e&&i.update(My.subarray(e))},qy=new Uint8Array(32);function La(i,t,e,r,n){const s=i(t,e,qy),o=Uy.create(s);n&&Ra(o,n),Ra(o,r);const c=Py(r.length,n?n.length:0,!0);o.update(c);const l=o.digest();return bi(s,c),l}const zy=i=>(t,e,r)=>({encrypt(n,s){const o=n.length;s=Ta(o+16,s,!1),s.set(n);const c=s.subarray(0,-16);i(t,e,c,c,1);const l=La(i,t,e,c,r);return s.set(l,o),bi(l),s},decrypt(n,s){s=Ta(n.length-16,s,!1);const o=n.subarray(0,-16),c=n.subarray(-16),l=La(i,t,e,o,r);if(!Ay(c,l))throw new Error("invalid tag");return s.set(n.subarray(0,-16)),i(t,e,s,s,1),bi(l),s}}),nu=Ty({blockSize:64,nonceLength:12,tagLength:16},zy(By));let su=class extends an{constructor(t,e){super(),this.finished=!1,this.destroyed=!1,lo(t);const r=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 n=this.blockLen,s=new Uint8Array(n);s.set(r.length>n?t.create().update(r).digest():r);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),it(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:r,finished:n,destroyed:s,blockLen:o,outputLen:c}=this;return t=t,t.finished=n,t.destroyed=s,t.blockLen=o,t.outputLen=c,t.oHash=e._cloneInto(t.oHash),t.iHash=r._cloneInto(t.iHash),t}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}};const ln=(i,t,e)=>new su(i,t).update(e).digest();ln.create=(i,t)=>new su(i,t);function jy(i,t,e){return lo(i),e===void 0&&(e=new Uint8Array(i.outputLen)),ln(i,ct(e),ct(t))}const Dn=Uint8Array.from([0]),Da=Uint8Array.of();function Ky(i,t,e,r=32){lo(i),Lt(r);const n=i.outputLen;if(r>255*n)throw new Error("Length should be <= 255*HashLen");const s=Math.ceil(r/n);e===void 0&&(e=Da);const o=new Uint8Array(s*n),c=ln.create(i,t),l=c._cloneInto(),u=new Uint8Array(c.outputLen);for(let h=0;h<s;h++)Dn[0]=h+1,l.update(h===0?Da:u).update(e).update(Dn).digestInto(u),o.set(u,n*h),c._cloneInto(l);return c.destroy(),l.destroy(),rt(u,Dn),o.slice(0,r)}const Fy=(i,t,e,r,n)=>Ky(i,jy(i,t,e),r,n),un=cn,fo=BigInt(0),_s=BigInt(1);function Xr(i,t){if(typeof t!="boolean")throw new Error(i+" boolean expected, got "+t)}function Lr(i){const t=i.toString(16);return t.length&1?"0"+t:t}function ou(i){if(typeof i!="string")throw new Error("hex string expected, got "+typeof i);return i===""?fo:BigInt("0x"+i)}function hn(i){return ou(lr(i))}function en(i){return it(i),ou(lr(Uint8Array.from(i).reverse()))}function mo(i,t){return ho(i.toString(16).padStart(t*2,"0"))}function yo(i,t){return mo(i,t).reverse()}function Ne(i,t,e){let r;if(typeof t=="string")try{r=ho(t)}catch(s){throw new Error(i+" must be hex string or Uint8Array, cause: "+s)}else if(co(t))r=Uint8Array.from(t);else throw new Error(i+" must be hex string or Uint8Array");const n=r.length;if(typeof e=="number"&&n!==e)throw new Error(i+" of length "+e+" expected, got "+n);return r}const Vn=i=>typeof i=="bigint"&&fo<=i;function Wy(i,t,e){return Vn(i)&&Vn(t)&&Vn(e)&&t<=i&&i<e}function fs(i,t,e,r){if(!Wy(t,e,r))throw new Error("expected valid "+i+": "+e+" <= n < "+r+", got "+t)}function Hy(i){let t;for(t=0;i>fo;i>>=_s,t+=1);return t}const dn=i=>(_s<<BigInt(i))-_s;function Gy(i,t,e){if(typeof i!="number"||i<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 r=p=>new Uint8Array(p),n=p=>Uint8Array.of(p);let s=r(i),o=r(i),c=0;const l=()=>{s.fill(1),o.fill(0),c=0},u=(...p)=>e(o,s,...p),h=(p=r(0))=>{o=u(n(0),p),s=u(),p.length!==0&&(o=u(n(1),p),s=u())},d=()=>{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 ti(..._)};return(p,_)=>{l(),h(p);let f;for(;!(f=_(d()));)h();return l(),f}}function pn(i,t,e={}){if(!i||typeof i!="object")throw new Error("expected valid options object");function r(n,s,o){const c=i[n];if(o&&c===void 0)return;const l=typeof c;if(l!==s||c===null)throw new Error(`param "${n}" is invalid: expected ${s}, got ${l}`)}Object.entries(t).forEach(([n,s])=>r(n,s,!1)),Object.entries(e).forEach(([n,s])=>r(n,s,!0))}function Va(i){const t=new WeakMap;return(e,...r)=>{const n=t.get(e);if(n!==void 0)return n;const s=i(e,...r);return t.set(e,s),s}}const ze=BigInt(0),xe=BigInt(1),ii=BigInt(2),Jy=BigInt(3),au=BigInt(4),cu=BigInt(5),lu=BigInt(8);function et(i,t){const e=i%t;return e>=ze?e:t+e}function st(i,t,e){let r=i;for(;t-- >ze;)r*=r,r%=e;return r}function xa(i,t){if(i===ze)throw new Error("invert: expected non-zero number");if(t<=ze)throw new Error("invert: expected positive modulus, got "+t);let e=et(i,t),r=t,n=ze,s=xe;for(;e!==ze;){const o=r/e,c=r%e,l=n-s*o;r=e,e=c,n=s,s=l}if(r!==xe)throw new Error("invert: does not exist");return et(n,t)}function uu(i,t){const e=(i.ORDER+xe)/au,r=i.pow(t,e);if(!i.eql(i.sqr(r),t))throw new Error("Cannot find square root");return r}function Yy(i,t){const e=(i.ORDER-cu)/lu,r=i.mul(t,ii),n=i.pow(r,e),s=i.mul(t,n),o=i.mul(i.mul(s,ii),n),c=i.mul(s,i.sub(o,i.ONE));if(!i.eql(i.sqr(c),t))throw new Error("Cannot find square root");return c}function Zy(i){if(i<BigInt(3))throw new Error("sqrt is not defined for small field");let t=i-xe,e=0;for(;t%ii===ze;)t/=ii,e++;let r=ii;const n=xi(i);for(;Sa(n,r)===1;)if(r++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(e===1)return uu;let s=n.pow(r,t);const o=(t+xe)/ii;return function(c,l){if(c.is0(l))return l;if(Sa(c,l)!==1)throw new Error("Cannot find square root");let u=e,h=c.mul(c.ONE,s),d=c.pow(l,t),p=c.pow(l,o);for(;!c.eql(d,c.ONE);){if(c.is0(d))return c.ZERO;let _=1,f=c.sqr(d);for(;!c.eql(f,c.ONE);)if(_++,f=c.sqr(f),_===u)throw new Error("Cannot find square root");const m=xe<<BigInt(u-_-1),y=c.pow(h,m);u=_,h=c.sqr(y),d=c.mul(d,h),p=c.mul(p,y)}return p}}function Qy(i){return i%au===Jy?uu:i%lu===cu?Yy:Zy(i)}const Xy=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function ew(i){const t={ORDER:"bigint",MASK:"bigint",BYTES:"number",BITS:"number"},e=Xy.reduce((r,n)=>(r[n]="function",r),t);return pn(i,e),i}function tw(i,t,e){if(e<ze)throw new Error("invalid exponent, negatives unsupported");if(e===ze)return i.ONE;if(e===xe)return t;let r=i.ONE,n=t;for(;e>ze;)e&xe&&(r=i.mul(r,n)),n=i.sqr(n),e>>=xe;return r}function hu(i,t,e=!1){const r=new Array(t.length).fill(e?i.ZERO:void 0),n=t.reduce((o,c,l)=>i.is0(c)?o:(r[l]=o,i.mul(o,c)),i.ONE),s=i.inv(n);return t.reduceRight((o,c,l)=>i.is0(c)?o:(r[l]=i.mul(o,r[l]),i.mul(o,c)),s),r}function Sa(i,t){const e=(i.ORDER-xe)/ii,r=i.pow(t,e),n=i.eql(r,i.ONE),s=i.eql(r,i.ZERO),o=i.eql(r,i.neg(i.ONE));if(!n&&!s&&!o)throw new Error("invalid Legendre symbol result");return n?1:s?0:-1}function iw(i,t){t!==void 0&&Lt(t);const e=t!==void 0?t:i.toString(2).length,r=Math.ceil(e/8);return{nBitLength:e,nByteLength:r}}function xi(i,t,e=!1,r={}){if(i<=ze)throw new Error("invalid field: expected ORDER > 0, got "+i);let n,s;if(typeof t=="object"&&t!=null){if(r.sqrt||e)throw new Error("cannot specify opts in two arguments");const h=t;h.BITS&&(n=h.BITS),h.sqrt&&(s=h.sqrt),typeof h.isLE=="boolean"&&(e=h.isLE)}else typeof t=="number"&&(n=t),r.sqrt&&(s=r.sqrt);const{nBitLength:o,nByteLength:c}=iw(i,n);if(c>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let l;const u=Object.freeze({ORDER:i,isLE:e,BITS:o,BYTES:c,MASK:dn(o),ZERO:ze,ONE:xe,create:h=>et(h,i),isValid:h=>{if(typeof h!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof h);return ze<=h&&h<i},is0:h=>h===ze,isValidNot0:h=>!u.is0(h)&&u.isValid(h),isOdd:h=>(h&xe)===xe,neg:h=>et(-h,i),eql:(h,d)=>h===d,sqr:h=>et(h*h,i),add:(h,d)=>et(h+d,i),sub:(h,d)=>et(h-d,i),mul:(h,d)=>et(h*d,i),pow:(h,d)=>tw(u,h,d),div:(h,d)=>et(h*xa(d,i),i),sqrN:h=>h*h,addN:(h,d)=>h+d,subN:(h,d)=>h-d,mulN:(h,d)=>h*d,inv:h=>xa(h,i),sqrt:s||(h=>(l||(l=Qy(i)),l(u,h))),toBytes:h=>e?yo(h,c):mo(h,c),fromBytes:h=>{if(h.length!==c)throw new Error("Field.fromBytes: expected "+c+" bytes, got "+h.length);return e?en(h):hn(h)},invertBatch:h=>hu(u,h),cmov:(h,d,p)=>p?d:h});return Object.freeze(u)}function du(i){if(typeof i!="bigint")throw new Error("field order must be bigint");const t=i.toString(2).length;return Math.ceil(t/8)}function pu(i){const t=du(i);return t+Math.ceil(t/2)}function rw(i,t,e=!1){const r=i.length,n=du(t),s=pu(t);if(r<16||r<s||r>1024)throw new Error("expected "+s+"-1024 bytes of input, got "+r);const o=e?en(i):hn(i),c=et(o,t-xe)+xe;return e?yo(c,n):mo(c,n)}const Ii=BigInt(0),ri=BigInt(1);function Qi(i,t){const e=t.negate();return i?e:t}function nw(i,t,e){const r=s=>s.pz,n=hu(i.Fp,e.map(r));return e.map((s,o)=>s.toAffine(n[o])).map(i.fromAffine)}function _u(i,t){if(!Number.isSafeInteger(i)||i<=0||i>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+i)}function xn(i,t){_u(i,t);const e=Math.ceil(t/i)+1,r=2**(i-1),n=2**i,s=dn(i),o=BigInt(i);return{windows:e,windowSize:r,mask:s,maxNumber:n,shiftBy:o}}function Ca(i,t,e){const{windowSize:r,mask:n,maxNumber:s,shiftBy:o}=e;let c=Number(i&n),l=i>>o;c>r&&(c-=s,l+=ri);const u=t*r,h=u+Math.abs(c)-1,d=c===0,p=c<0,_=t%2!==0;return{nextN:l,offset:h,isZero:d,isNeg:p,isNegF:_,offsetF:u}}function sw(i,t){if(!Array.isArray(i))throw new Error("array expected");i.forEach((e,r)=>{if(!(e instanceof t))throw new Error("invalid point at index "+r)})}function ow(i,t){if(!Array.isArray(i))throw new Error("array of scalars expected");i.forEach((e,r)=>{if(!t.isValid(e))throw new Error("invalid scalar at index "+r)})}const Sn=new WeakMap,fu=new WeakMap;function Cn(i){return fu.get(i)||1}function $a(i){if(i!==Ii)throw new Error("invalid wNAF")}function aw(i,t){return{constTimeNegate:Qi,hasPrecomputes(e){return Cn(e)!==1},unsafeLadder(e,r,n=i.ZERO){let s=e;for(;r>Ii;)r&ri&&(n=n.add(s)),s=s.double(),r>>=ri;return n},precomputeWindow(e,r){const{windows:n,windowSize:s}=xn(r,t),o=[];let c=e,l=c;for(let u=0;u<n;u++){l=c,o.push(l);for(let h=1;h<s;h++)l=l.add(c),o.push(l);c=l.double()}return o},wNAF(e,r,n){let s=i.ZERO,o=i.BASE;const c=xn(e,t);for(let l=0;l<c.windows;l++){const{nextN:u,offset:h,isZero:d,isNeg:p,isNegF:_,offsetF:f}=Ca(n,l,c);n=u,d?o=o.add(Qi(_,r[f])):s=s.add(Qi(p,r[h]))}return $a(n),{p:s,f:o}},wNAFUnsafe(e,r,n,s=i.ZERO){const o=xn(e,t);for(let c=0;c<o.windows&&n!==Ii;c++){const{nextN:l,offset:u,isZero:h,isNeg:d}=Ca(n,c,o);if(n=l,!h){const p=r[u];s=s.add(d?p.negate():p)}}return $a(n),s},getPrecomputes(e,r,n){let s=Sn.get(r);return s||(s=this.precomputeWindow(r,e),e!==1&&(typeof n=="function"&&(s=n(s)),Sn.set(r,s))),s},wNAFCached(e,r,n){const s=Cn(e);return this.wNAF(s,this.getPrecomputes(s,e,n),r)},wNAFCachedUnsafe(e,r,n,s){const o=Cn(e);return o===1?this.unsafeLadder(e,r,s):this.wNAFUnsafe(o,this.getPrecomputes(o,e,n),r,s)},setWindowSize(e,r){_u(r,t),fu.set(e,r),Sn.delete(e)}}}function cw(i,t,e,r){let n=t,s=i.ZERO,o=i.ZERO;for(;e>Ii||r>Ii;)e&ri&&(s=s.add(n)),r&ri&&(o=o.add(n)),n=n.double(),e>>=ri,r>>=ri;return{p1:s,p2:o}}function lw(i,t,e,r){sw(e,i),ow(r,t);const n=e.length,s=r.length;if(n!==s)throw new Error("arrays of points and scalars must have equal length");const o=i.ZERO,c=Hy(BigInt(n));let l=1;c>12?l=c-3:c>4?l=c-2:c>0&&(l=2);const u=dn(l),h=new Array(Number(u)+1).fill(o),d=Math.floor((t.BITS-1)/l)*l;let p=o;for(let _=d;_>=0;_-=l){h.fill(o);for(let m=0;m<s;m++){const y=r[m],b=Number(y>>BigInt(_)&u);h[b]=h[b].add(e[m])}let f=o;for(let m=h.length-1,y=o;m>0;m--)y=y.add(h[m]),f=f.add(y);if(p=p.add(f),_!==0)for(let m=0;m<l;m++)p=p.double()}return p}function ka(i,t){if(t){if(t.ORDER!==i)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return ew(t),t}else return xi(i)}function uw(i,t,e={}){if(!t||typeof t!="object")throw new Error(`expected valid ${i} CURVE object`);for(const o of["p","n","h"]){const c=t[o];if(!(typeof c=="bigint"&&c>Ii))throw new Error(`CURVE.${o} must be positive bigint`)}const r=ka(t.p,e.Fp),n=ka(t.n,e.Fn),s=["Gx","Gy","a","b"];for(const o of s)if(!r.isValid(t[o]))throw new Error(`CURVE.${o} must be valid field element of CURVE.Fp`);return{Fp:r,Fn:n}}BigInt(0),BigInt(1),BigInt(2),BigInt(8);const Bi=BigInt(0),mi=BigInt(1),Dr=BigInt(2);function hw(i){return pn(i,{adjustScalarBytes:"function",powPminus2:"function"}),Object.freeze({...i})}function dw(i){const t=hw(i),{P:e,type:r,adjustScalarBytes:n,powPminus2:s,randomBytes:o}=t,c=r==="x25519";if(!c&&r!=="x448")throw new Error("invalid type");const l=o||Vi,u=c?255:448,h=c?32:56,d=BigInt(c?9:5),p=BigInt(c?121665:39081),_=c?Dr**BigInt(254):Dr**BigInt(447),f=c?BigInt(8)*Dr**BigInt(251)-mi:BigInt(4)*Dr**BigInt(445)-mi,m=_+f+mi,y=w=>et(w,e),b=R(d);function R(w){return yo(y(w),h)}function v(w){const E=Ne("u coordinate",w,h);return c&&(E[31]&=127),y(en(E))}function P(w){return en(n(Ne("scalar",w,h)))}function T(w,E){const I=L(v(E),P(w));if(I===Bi)throw new Error("invalid private or public key received");return R(I)}function g(w){return T(w,b)}function D(w,E,I){const A=y(w*(E-I));return E=y(E-A),I=y(I+A),{x_2:E,x_3:I}}function L(w,E){fs("u",w,Bi,e),fs("scalar",E,_,m);const I=E,A=w;let V=mi,O=Bi,x=w,$=mi,k=Bi;for(let C=BigInt(u-1);C>=Bi;C--){const U=I>>C&mi;k^=U,{x_2:V,x_3:x}=D(k,V,x),{x_2:O,x_3:$}=D(k,O,$),k=U;const z=V+O,j=y(z*z),F=V-O,W=y(F*F),H=j-W,G=x+$,ue=x-$,ce=y(ue*z),oe=y(G*F),Je=ce+oe,gt=ce-oe;x=y(Je*Je),$=y(A*y(gt*gt)),V=y(j*W),O=y(H*(j+y(p*H)))}({x_2:V,x_3:x}=D(k,V,x)),{x_2:O,x_3:$}=D(k,O,$);const M=s(O);return y(V*M)}return{scalarMult:T,scalarMultBase:g,getSharedSecret:(w,E)=>T(w,E),getPublicKey:w=>g(w),utils:{randomPrivateKey:()=>l(h)},GuBytes:b.slice()}}BigInt(0);const pw=BigInt(1),Ua=BigInt(2),_w=BigInt(3),fw=BigInt(5);BigInt(8);const mu={p:BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed"),n:BigInt("0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed"),a:BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec"),d:BigInt("0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3"),Gx:BigInt("0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a"),Gy:BigInt("0x6666666666666666666666666666666666666666666666666666666666666658")};function mw(i){const t=BigInt(10),e=BigInt(20),r=BigInt(40),n=BigInt(80),s=mu.p,o=i*i%s*i%s,c=st(o,Ua,s)*o%s,l=st(c,pw,s)*i%s,u=st(l,fw,s)*l%s,h=st(u,t,s)*u%s,d=st(h,e,s)*h%s,p=st(d,r,s)*d%s,_=st(p,n,s)*p%s,f=st(_,n,s)*p%s,m=st(f,t,s)*u%s;return{pow_p_5_8:st(m,Ua,s)*i%s,b2:o}}function yw(i){return i[0]&=248,i[31]&=127,i[31]|=64,i}const ms=(()=>{const i=mu.p;return dw({P:i,type:"x25519",powPminus2:t=>{const{pow_p_5_8:e,b2:r}=mw(t);return et(st(e,_w,i)*r,i)},adjustScalarBytes:yw})})();function Na(i){i.lowS!==void 0&&Xr("lowS",i.lowS),i.prehash!==void 0&&Xr("prehash",i.prehash)}class ww extends Error{constructor(t=""){super(t)}}const Tt={Err:ww,_tlv:{encode:(i,t)=>{const{Err:e}=Tt;if(i<0||i>256)throw new e("tlv.encode: wrong tag");if(t.length&1)throw new e("tlv.encode: unpadded data");const r=t.length/2,n=Lr(r);if(n.length/2&128)throw new e("tlv.encode: long form length too big");const s=r>127?Lr(n.length/2|128):"";return Lr(i)+s+n+t},decode(i,t){const{Err:e}=Tt;let r=0;if(i<0||i>256)throw new e("tlv.encode: wrong tag");if(t.length<2||t[r++]!==i)throw new e("tlv.decode: wrong tlv");const n=t[r++],s=!!(n&128);let o=0;if(!s)o=n;else{const l=n&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(r,r+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 h of u)o=o<<8|h;if(r+=l,o<128)throw new e("tlv.decode(long): not minimal encoding")}const c=t.subarray(r,r+o);if(c.length!==o)throw new e("tlv.decode: wrong value length");return{v:c,l:t.subarray(r+o)}}},_int:{encode(i){const{Err:t}=Tt;if(i<Xi)throw new t("integer: negative integers are not allowed");let e=Lr(i);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(i){const{Err:t}=Tt;if(i[0]&128)throw new t("invalid signature integer: negative");if(i[0]===0&&!(i[1]&128))throw new t("invalid signature integer: unnecessary leading zero");return hn(i)}},toSig(i){const{Err:t,_int:e,_tlv:r}=Tt,n=Ne("signature",i),{v:s,l:o}=r.decode(48,n);if(o.length)throw new t("invalid signature: left bytes after parsing");const{v:c,l}=r.decode(2,s),{v:u,l:h}=r.decode(2,l);if(h.length)throw new t("invalid signature: left bytes after parsing");return{r:e.decode(c),s:e.decode(u)}},hexFromSig(i){const{_tlv:t,_int:e}=Tt,r=t.encode(2,e.encode(i.r)),n=t.encode(2,e.encode(i.s)),s=r+n;return t.encode(48,s)}},Xi=BigInt(0),er=BigInt(1),gw=BigInt(2),Vr=BigInt(3),Ew=BigInt(4);function vw(i,t,e){function r(n){const s=i.sqr(n),o=i.mul(s,n);return i.add(i.add(o,i.mul(n,t)),e)}return r}function yu(i,t,e){const{BYTES:r}=i;function n(s){let o;if(typeof s=="bigint")o=s;else{let c=Ne("private key",s);if(t){if(!t.includes(c.length*2))throw new Error("invalid private key");const l=new Uint8Array(r);l.set(c,l.length-c.length),c=l}try{o=i.fromBytes(c)}catch{throw new Error(`invalid private key: expected ui8a of size ${r}, got ${typeof s}`)}}if(e&&(o=i.create(o)),!i.isValidNot0(o))throw new Error("invalid private key: out of range [1..N-1]");return o}return n}function bw(i,t={}){const{Fp:e,Fn:r}=uw("weierstrass",i,t),{h:n,n:s}=i;pn(t,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object",wrapPrivateKey:"boolean"});const{endo:o}=t;if(o&&(!e.is0(i.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,E){const{x:I,y:A}=w.toAffine(),V=e.toBytes(I);if(Xr("isCompressed",E),E){c();const O=!e.isOdd(A);return ti(wu(O),V)}else return ti(Uint8Array.of(4),V,e.toBytes(A))}function u(L){it(L);const w=e.BYTES,E=w+1,I=2*w+1,A=L.length,V=L[0],O=L.subarray(1);if(A===E&&(V===2||V===3)){const x=e.fromBytes(O);if(!e.isValid(x))throw new Error("bad point: is not on curve, wrong x");const $=p(x);let k;try{k=e.sqrt($)}catch(C){const U=C instanceof Error?": "+C.message:"";throw new Error("bad point: is not on curve, sqrt error"+U)}c();const M=e.isOdd(k);return(V&1)===1!==M&&(k=e.neg(k)),{x,y:k}}else if(A===I&&V===4){const x=e.fromBytes(O.subarray(w*0,w*1)),$=e.fromBytes(O.subarray(w*1,w*2));if(!_(x,$))throw new Error("bad point: is not on curve");return{x,y:$}}else throw new Error(`bad point: got length ${A}, expected compressed=${E} or uncompressed=${I}`)}const h=t.toBytes||l,d=t.fromBytes||u,p=vw(e,i.a,i.b);function _(L,w){const E=e.sqr(w),I=p(L);return e.eql(E,I)}if(!_(i.Gx,i.Gy))throw new Error("bad curve params: generator point");const f=e.mul(e.pow(i.a,Vr),Ew),m=e.mul(e.sqr(i.b),BigInt(27));if(e.is0(e.add(f,m)))throw new Error("bad curve params: a or b");function y(L,w,E=!1){if(!e.isValid(w)||E&&e.is0(w))throw new Error(`bad point coordinate ${L}`);return w}function b(L){if(!(L instanceof T))throw new Error("ProjectivePoint expected")}const R=Va((L,w)=>{const{px:E,py:I,pz:A}=L;if(e.eql(A,e.ONE))return{x:E,y:I};const V=L.is0();w==null&&(w=V?e.ONE:e.inv(A));const O=e.mul(E,w),x=e.mul(I,w),$=e.mul(A,w);if(V)return{x:e.ZERO,y:e.ZERO};if(!e.eql($,e.ONE))throw new Error("invZ was invalid");return{x:O,y:x}}),v=Va(L=>{if(L.is0()){if(t.allowInfinityPoint&&!e.is0(L.py))return;throw new Error("bad point: ZERO")}const{x:w,y:E}=L.toAffine();if(!e.isValid(w)||!e.isValid(E))throw new Error("bad point: x or y not field elements");if(!_(w,E))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,E,I,A){return E=new T(e.mul(E.px,L),E.py,E.pz),w=Qi(I,w),E=Qi(A,E),w.add(E)}class T{constructor(w,E,I){this.px=y("x",w),this.py=y("y",E,!0),this.pz=y("z",I),Object.freeze(this)}static fromAffine(w){const{x:E,y:I}=w||{};if(!w||!e.isValid(E)||!e.isValid(I))throw new Error("invalid affine point");if(w instanceof T)throw new Error("projective point not allowed");return e.is0(E)&&e.is0(I)?T.ZERO:new T(E,I,e.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(w){return nw(T,"pz",w)}static fromBytes(w){return it(w),T.fromHex(w)}static fromHex(w){const E=T.fromAffine(d(Ne("pointHex",w)));return E.assertValidity(),E}static fromPrivateKey(w){const E=yu(r,t.allowedPrivateKeyLengths,t.wrapPrivateKey);return T.BASE.multiply(E(w))}static msm(w,E){return lw(T,r,w,E)}precompute(w=8,E=!0){return D.setWindowSize(this,w),E||this.multiply(Vr),this}_setWindowSize(w){this.precompute(w)}assertValidity(){v(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:E,py:I,pz:A}=this,{px:V,py:O,pz:x}=w,$=e.eql(e.mul(E,x),e.mul(V,A)),k=e.eql(e.mul(I,x),e.mul(O,A));return $&&k}negate(){return new T(this.px,e.neg(this.py),this.pz)}double(){const{a:w,b:E}=i,I=e.mul(E,Vr),{px:A,py:V,pz:O}=this;let x=e.ZERO,$=e.ZERO,k=e.ZERO,M=e.mul(A,A),C=e.mul(V,V),U=e.mul(O,O),z=e.mul(A,V);return z=e.add(z,z),k=e.mul(A,O),k=e.add(k,k),x=e.mul(w,k),$=e.mul(I,U),$=e.add(x,$),x=e.sub(C,$),$=e.add(C,$),$=e.mul(x,$),x=e.mul(z,x),k=e.mul(I,k),U=e.mul(w,U),z=e.sub(M,U),z=e.mul(w,z),z=e.add(z,k),k=e.add(M,M),M=e.add(k,M),M=e.add(M,U),M=e.mul(M,z),$=e.add($,M),U=e.mul(V,O),U=e.add(U,U),M=e.mul(U,z),x=e.sub(x,M),k=e.mul(U,C),k=e.add(k,k),k=e.add(k,k),new T(x,$,k)}add(w){b(w);const{px:E,py:I,pz:A}=this,{px:V,py:O,pz:x}=w;let $=e.ZERO,k=e.ZERO,M=e.ZERO;const C=i.a,U=e.mul(i.b,Vr);let z=e.mul(E,V),j=e.mul(I,O),F=e.mul(A,x),W=e.add(E,I),H=e.add(V,O);W=e.mul(W,H),H=e.add(z,j),W=e.sub(W,H),H=e.add(E,A);let G=e.add(V,x);return H=e.mul(H,G),G=e.add(z,F),H=e.sub(H,G),G=e.add(I,A),$=e.add(O,x),G=e.mul(G,$),$=e.add(j,F),G=e.sub(G,$),M=e.mul(C,H),$=e.mul(U,F),M=e.add($,M),$=e.sub(j,M),M=e.add(j,M),k=e.mul($,M),j=e.add(z,z),j=e.add(j,z),F=e.mul(C,F),H=e.mul(U,H),j=e.add(j,F),F=e.sub(z,F),F=e.mul(C,F),H=e.add(H,F),z=e.mul(j,H),k=e.add(k,z),z=e.mul(G,H),$=e.mul(W,$),$=e.sub($,z),z=e.mul(W,j),M=e.mul(G,M),M=e.add(M,z),new T($,k,M)}subtract(w){return this.add(w.negate())}is0(){return this.equals(T.ZERO)}multiply(w){const{endo:E}=t;if(!r.isValidNot0(w))throw new Error("invalid scalar: out of range");let I,A;const V=O=>D.wNAFCached(this,O,T.normalizeZ);if(E){const{k1neg:O,k1:x,k2neg:$,k2:k}=E.splitScalar(w),{p:M,f:C}=V(x),{p:U,f:z}=V(k);A=C.add(z),I=P(E.beta,M,U,O,$)}else{const{p:O,f:x}=V(w);I=O,A=x}return T.normalizeZ([I,A])[0]}multiplyUnsafe(w){const{endo:E}=t,I=this;if(!r.isValid(w))throw new Error("invalid scalar: out of range");if(w===Xi||I.is0())return T.ZERO;if(w===er)return I;if(D.hasPrecomputes(this))return this.multiply(w);if(E){const{k1neg:A,k1:V,k2neg:O,k2:x}=E.splitScalar(w),{p1:$,p2:k}=cw(T,I,V,x);return P(E.beta,$,k,A,O)}else return D.wNAFCachedUnsafe(I,w)}multiplyAndAddUnsafe(w,E,I){const A=this.multiplyUnsafe(E).add(w.multiplyUnsafe(I));return A.is0()?void 0:A}toAffine(w){return R(this,w)}isTorsionFree(){const{isTorsionFree:w}=t;return n===er?!0:w?w(T,this):D.wNAFCachedUnsafe(this,s).is0()}clearCofactor(){const{clearCofactor:w}=t;return n===er?this:w?w(T,this):this.multiplyUnsafe(n)}toBytes(w=!0){return Xr("isCompressed",w),this.assertValidity(),h(T,this,w)}toRawBytes(w=!0){return this.toBytes(w)}toHex(w=!0){return lr(this.toBytes(w))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}}T.BASE=new T(i.Gx,i.Gy,e.ONE),T.ZERO=new T(e.ZERO,e.ONE,e.ZERO),T.Fp=e,T.Fn=r;const g=r.BITS,D=aw(T,t.endo?Math.ceil(g/2):g);return T}function wu(i){return Uint8Array.of(i?2:3)}function Iw(i,t,e={}){pn(t,{hash:"function"},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"});const r=t.randomBytes||Vi,n=t.hmac||((I,...A)=>ln(t.hash,I,ti(...A))),{Fp:s,Fn:o}=i,{ORDER:c,BITS:l}=o;function u(I){const A=c>>er;return I>A}function h(I){return u(I)?o.neg(I):I}function d(I,A){if(!o.isValidNot0(A))throw new Error(`invalid signature ${I}: out of range 1..CURVE.n`)}class p{constructor(A,V,O){d("r",A),d("s",V),this.r=A,this.s=V,O!=null&&(this.recovery=O),Object.freeze(this)}static fromCompact(A){const V=o.BYTES,O=Ne("compactSignature",A,V*2);return new p(o.fromBytes(O.subarray(0,V)),o.fromBytes(O.subarray(V,V*2)))}static fromDER(A){const{r:V,s:O}=Tt.toSig(Ne("DER",A));return new p(V,O)}assertValidity(){}addRecoveryBit(A){return new p(this.r,this.s,A)}recoverPublicKey(A){const V=s.ORDER,{r:O,s:x,recovery:$}=this;if($==null||![0,1,2,3].includes($))throw new Error("recovery id invalid");if(c*gw<V&&$>1)throw new Error("recovery id is ambiguous for h>1 curve");const k=$===2||$===3?O+c:O;if(!s.isValid(k))throw new Error("recovery id 2 or 3 invalid");const M=s.toBytes(k),C=i.fromHex(ti(wu(($&1)===0),M)),U=o.inv(k),z=v(Ne("msgHash",A)),j=o.create(-z*U),F=o.create(x*U),W=i.BASE.multiplyUnsafe(j).add(C.multiplyUnsafe(F));if(W.is0())throw new Error("point at infinify");return W.assertValidity(),W}hasHighS(){return u(this.s)}normalizeS(){return this.hasHighS()?new p(this.r,o.neg(this.s),this.recovery):this}toBytes(A){if(A==="compact")return ti(o.toBytes(this.r),o.toBytes(this.s));if(A==="der")return ho(Tt.hexFromSig(this));throw new Error("invalid format")}toDERRawBytes(){return this.toBytes("der")}toDERHex(){return lr(this.toBytes("der"))}toCompactRawBytes(){return this.toBytes("compact")}toCompactHex(){return lr(this.toBytes("compact"))}}const _=yu(o,e.allowedPrivateKeyLengths,e.wrapPrivateKey),f={isValidPrivateKey(I){try{return _(I),!0}catch{return!1}},normPrivateKeyToScalar:_,randomPrivateKey:()=>{const I=c;return rw(r(pu(I)),I)},precompute(I=8,A=i.BASE){return A.precompute(I,!1)}};function m(I,A=!0){return i.fromPrivateKey(I).toBytes(A)}function y(I){if(typeof I=="bigint")return!1;if(I instanceof i)return!0;const A=Ne("key",I).length,V=s.BYTES,O=V+1,x=2*V+1;if(!(e.allowedPrivateKeyLengths||o.BYTES===O))return A===O||A===x}function b(I,A,V=!0){if(y(I)===!0)throw new Error("first arg must be private key");if(y(A)===!1)throw new Error("second arg must be public key");return i.fromHex(A).multiply(_(I)).toBytes(V)}const R=t.bits2int||function(I){if(I.length>8192)throw new Error("input is too large");const A=hn(I),V=I.length*8-l;return V>0?A>>BigInt(V):A},v=t.bits2int_modN||function(I){return o.create(R(I))},P=dn(l);function T(I){return fs("num < 2^"+l,I,Xi,P),o.toBytes(I)}function g(I,A,V=D){if(["recovered","canonical"].some(W=>W in V))throw new Error("sign() legacy options not supported");const{hash:O}=t;let{lowS:x,prehash:$,extraEntropy:k}=V;x==null&&(x=!0),I=Ne("msgHash",I),Na(V),$&&(I=Ne("prehashed msgHash",O(I)));const M=v(I),C=_(A),U=[T(C),T(M)];if(k!=null&&k!==!1){const W=k===!0?r(s.BYTES):k;U.push(Ne("extraEntropy",W))}const z=ti(...U),j=M;function F(W){const H=R(W);if(!o.isValidNot0(H))return;const G=o.inv(H),ue=i.BASE.multiply(H).toAffine(),ce=o.create(ue.x);if(ce===Xi)return;const oe=o.create(G*o.create(j+ce*C));if(oe===Xi)return;let Je=(ue.x===ce?0:2)|Number(ue.y&er),gt=oe;return x&&u(oe)&&(gt=h(oe),Je^=1),new p(ce,gt,Je)}return{seed:z,k2sig:F}}const D={lowS:t.lowS,prehash:!1},L={lowS:t.lowS,prehash:!1};function w(I,A,V=D){const{seed:O,k2sig:x}=g(I,A,V);return Gy(t.hash.outputLen,o.BYTES,n)(O,x)}i.BASE.precompute(8);function E(I,A,V,O=L){const x=I;A=Ne("msgHash",A),V=Ne("publicKey",V),Na(O);const{lowS:$,prehash:k,format:M}=O;if("strict"in O)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 x=="string"||co(x),U=!C&&!M&&typeof x=="object"&&x!==null&&typeof x.r=="bigint"&&typeof x.s=="bigint";if(!C&&!U)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");let z,j;try{if(U)if(M===void 0||M==="js")z=new p(x.r,x.s);else throw new Error("invalid format");if(C){try{M!=="compact"&&(z=p.fromDER(x))}catch(Je){if(!(Je instanceof Tt.Err))throw Je}!z&&M!=="der"&&(z=p.fromCompact(x))}j=i.fromHex(V)}catch{return!1}if(!z||$&&z.hasHighS())return!1;k&&(A=t.hash(A));const{r:F,s:W}=z,H=v(A),G=o.inv(W),ue=o.create(H*G),ce=o.create(F*G),oe=i.BASE.multiplyUnsafe(ue).add(j.multiplyUnsafe(ce));return oe.is0()?!1:o.create(oe.x)===F}return Object.freeze({getPublicKey:m,getSharedSecret:b,sign:w,verify:E,utils:f,Point:i,Signature:p})}function Aw(i){const t={a:i.a,b:i.b,p:i.Fp.ORDER,n:i.n,h:i.h,Gx:i.Gx,Gy:i.Gy},e=i.Fp,r=xi(t.n,i.nBitLength),n={Fp:e,Fn:r,allowedPrivateKeyLengths:i.allowedPrivateKeyLengths,allowInfinityPoint:i.allowInfinityPoint,endo:i.endo,wrapPrivateKey:i.wrapPrivateKey,isTorsionFree:i.isTorsionFree,clearCofactor:i.clearCofactor,fromBytes:i.fromBytes,toBytes:i.toBytes};return{CURVE:t,curveOpts:n}}function Tw(i){const{CURVE:t,curveOpts:e}=Aw(i),r={hash:i.hash,hmac:i.hmac,randomBytes:i.randomBytes,lowS:i.lowS,bits2int:i.bits2int,bits2int_modN:i.bits2int_modN};return{CURVE:t,curveOpts:e,ecdsaOpts:r}}function Pw(i,t){return Object.assign({},t,{ProjectivePoint:t.Point,CURVE:i})}function Ow(i){const{CURVE:t,curveOpts:e,ecdsaOpts:r}=Tw(i),n=bw(t,e),s=Iw(n,r,e);return Pw(i,s)}function ys(i,t){const e=r=>Ow({...i,hash:r});return{...e(t),create:e}}const gu={p:BigInt("0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff"),n:BigInt("0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551"),h:BigInt(1),a:BigInt("0xffffffff00000001000000000000000000000000fffffffffffffffffffffffc"),b:BigInt("0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b"),Gx:BigInt("0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296"),Gy:BigInt("0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5")},Eu={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffff0000000000000000ffffffff"),n:BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffc7634d81f4372ddf581a0db248b0a77aecec196accc52973"),h:BigInt(1),a:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffff0000000000000000fffffffc"),b:BigInt("0xb3312fa7e23ee7e4988e056be3f82d19181d9c6efe8141120314088f5013875ac656398d8a2ed19d2a85c8edd3ec2aef"),Gx:BigInt("0xaa87ca22be8b05378eb1c71ef320ad746e1d3b628ba79b9859f741e082542a385502f25dbf55296c3a545e3872760ab7"),Gy:BigInt("0x3617de4a96262c6f5d9e98bf9292dc29f8f41dbd289a147ce9da3113b5f0b8c00a60b1ce1d7e819d7a431d7c90ea0e5f")},vu={p:BigInt("0x1ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),n:BigInt("0x01fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa51868783bf2f966b7fcc0148f709a5d03bb5c9b8899c47aebb6fb71e91386409"),h:BigInt(1),a:BigInt("0x1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc"),b:BigInt("0x0051953eb9618e1c9a1f929a21a0b68540eea2da725b99b315f3b8b489918ef109e156193951ec7e937b1652c0bd3bb1bf073573df883d2c34f1ef451fd46b503f00"),Gx:BigInt("0x00c6858e06b70404e9cd9e3ecb662395b4429c648139053fb521f828af606b4d3dbaa14b5e77efe75928fe1dc127a2ffa8de3348b3c1856a429bf97e7e31c2e5bd66"),Gy:BigInt("0x011839296a789a3bc0045c8a5fb42c7d1bd998f54449579b446817afbd17273e662c97ee72995ef42640c550b9013fad0761353c7086a272c24088be94769fd16650")},Rw=xi(gu.p),Lw=xi(Eu.p),Dw=xi(vu.p),Vw=ys({...gu,Fp:Rw,lowS:!1},cn);ys({...Eu,Fp:Lw,lowS:!1},Bm),ys({...vu,Fp:Dw,lowS:!1,allowedPrivateKeyLengths:[130,131,132]},Nm);const xw=Vw,bu="base10",Se="base16",Me="base64pad",jt="base64url",gr="utf8",Iu=0,Ot=1,Er=2,Sw=0,Ba=1,tr=12,wo=32;function Cw(){const i=ms.utils.randomPrivateKey(),t=ms.getPublicKey(i);return{privateKey:je(i,Se),publicKey:je(t,Se)}}function ws(){const i=Vi(wo);return je(i,Se)}function $w(i,t){const e=ms.getSharedSecret(tt(i,Se),tt(t,Se)),r=Fy(un,e,void 0,void 0,wo);return je(r,Se)}function Nr(i){const t=un(tt(i,Se));return je(t,Se)}function Xe(i){const t=un(tt(i,gr));return je(t,Se)}function Au(i){return tt(`${i}`,bu)}function ci(i){return Number(je(i,bu))}function Tu(i){return i.replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function Pu(i){const t=i.replace(/-/g,"+").replace(/_/g,"/"),e=(4-t.length%4)%4;return t+"=".repeat(e)}function kw(i){const t=Au(typeof i.type<"u"?i.type:Iu);if(ci(t)===Ot&&typeof i.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");const e=typeof i.senderPublicKey<"u"?tt(i.senderPublicKey,Se):void 0,r=typeof i.iv<"u"?tt(i.iv,Se):Vi(tr),n=tt(i.symKey,Se),s=nu(n,r).encrypt(tt(i.message,gr)),o=Ou({type:t,sealed:s,iv:r,senderPublicKey:e});return i.encoding===jt?Tu(o):o}function Uw(i){const t=tt(i.symKey,Se),{sealed:e,iv:r}=hr({encoded:i.encoded,encoding:i.encoding}),n=nu(t,r).decrypt(e);if(n===null)throw new Error("Failed to decrypt");return je(n,gr)}function Nw(i,t){const e=Au(Er),r=Vi(tr),n=tt(i,gr),s=Ou({type:e,sealed:n,iv:r});return t===jt?Tu(s):s}function Bw(i,t){const{sealed:e}=hr({encoded:i,encoding:t});return je(e,gr)}function Ou(i){if(ci(i.type)===Er)return je(Yi([i.type,i.sealed]),Me);if(ci(i.type)===Ot){if(typeof i.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return je(Yi([i.type,i.senderPublicKey,i.iv,i.sealed]),Me)}return je(Yi([i.type,i.iv,i.sealed]),Me)}function hr(i){const t=(i.encoding||Me)===jt?Pu(i.encoded):i.encoded,e=tt(t,Me),r=e.slice(Sw,Ba),n=Ba;if(ci(r)===Ot){const l=n+wo,u=l+tr,h=e.slice(n,l),d=e.slice(l,u),p=e.slice(u);return{type:r,sealed:p,iv:d,senderPublicKey:h}}if(ci(r)===Er){const l=e.slice(n),u=Vi(tr);return{type:r,sealed:l,iv:u}}const s=n+tr,o=e.slice(n,s),c=e.slice(s);return{type:r,sealed:c,iv:o}}function Mw(i,t){const e=hr({encoded:i,encoding:t==null?void 0:t.encoding});return Ru({type:ci(e.type),senderPublicKey:typeof e.senderPublicKey<"u"?je(e.senderPublicKey,Se):void 0,receiverPublicKey:t==null?void 0:t.receiverPublicKey})}function Ru(i){const t=(i==null?void 0:i.type)||Iu;if(t===Ot){if(typeof(i==null?void 0:i.senderPublicKey)>"u")throw new Error("missing sender public key");if(typeof(i==null?void 0:i.receiverPublicKey)>"u")throw new Error("missing receiver public key")}return{type:t,senderPublicKey:i==null?void 0:i.senderPublicKey,receiverPublicKey:i==null?void 0:i.receiverPublicKey}}function Ma(i){return i.type===Ot&&typeof i.senderPublicKey=="string"&&typeof i.receiverPublicKey=="string"}function qa(i){return i.type===Er}function qw(i){const t=ee.from(i.x,"base64"),e=ee.from(i.y,"base64");return Yi([new Uint8Array([4]),t,e])}function zw(i,t){const[e,r,n]=i.split("."),s=ee.from(Pu(n),"base64");if(s.length!==64)throw new Error("Invalid signature length");const o=s.slice(0,32),c=s.slice(32,64),l=`${e}.${r}`,u=un(l),h=qw(t);if(!xw.verify(Yi([o,c]),u,h))throw new Error("Invalid signature");return Yn(i).payload}const jw="irn";function tn(i){return(i==null?void 0:i.relay)||{protocol:jw}}function vi(i){const t=Xh[i];if(typeof t>"u")throw new Error(`Relay Protocol not supported: ${i}`);return t}function Kw(i,t="-"){const e={},r="relay"+t;return Object.keys(i).forEach(n=>{if(n.startsWith(r)){const s=n.replace(r,""),o=i[n];e[s]=o}}),e}function za(i){if(!i.includes("wc:")){const u=Bl(i);u!=null&&u.includes("wc:")&&(i=u)}i=i.includes("wc://")?i.replace("wc://",""):i,i=i.includes("wc:")?i.replace("wc:",""):i;const t=i.indexOf(":"),e=i.indexOf("?")!==-1?i.indexOf("?"):void 0,r=i.substring(0,t),n=i.substring(t+1,e).split("@"),s=typeof e<"u"?i.substring(e):"",o=new URLSearchParams(s),c={};o.forEach((u,h)=>{c[h]=u});const l=typeof c.methods=="string"?c.methods.split(","):void 0;return{protocol:r,topic:Fw(n[0]),version:parseInt(n[1],10),symKey:c.symKey,relay:Kw(c),methods:l,expiryTimestamp:c.expiryTimestamp?parseInt(c.expiryTimestamp,10):void 0}}function Fw(i){return i.startsWith("//")?i.substring(2):i}function Ww(i,t="-"){const e="relay",r={};return Object.keys(i).forEach(n=>{const s=n,o=e+t+s;i[s]&&(r[o]=i[s])}),r}function ja(i){const t=new URLSearchParams,e=Ww(i.relay);Object.keys(e).sort().forEach(n=>{t.set(n,e[n])}),t.set("symKey",i.symKey),i.expiryTimestamp&&t.set("expiryTimestamp",i.expiryTimestamp.toString()),i.methods&&t.set("methods",i.methods.join(","));const r=t.toString();return`${i.protocol}:${i.topic}@${i.version}?${r}`}function xr(i,t,e){return`${i}?wc_ev=${e}&topic=${t}`}var Hw=Object.defineProperty,Gw=Object.defineProperties,Jw=Object.getOwnPropertyDescriptors,Ka=Object.getOwnPropertySymbols,Yw=Object.prototype.hasOwnProperty,Zw=Object.prototype.propertyIsEnumerable,Fa=(i,t,e)=>t in i?Hw(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Qw=(i,t)=>{for(var e in t||(t={}))Yw.call(t,e)&&Fa(i,e,t[e]);if(Ka)for(var e of Ka(t))Zw.call(t,e)&&Fa(i,e,t[e]);return i},Xw=(i,t)=>Gw(i,Jw(t));function Si(i){const t=[];return i.forEach(e=>{const[r,n]=e.split(":");t.push(`${r}:${n}`)}),t}function eg(i){const t=[];return Object.values(i).forEach(e=>{t.push(...Si(e.accounts))}),t}function tg(i,t){const e=[];return Object.values(i).forEach(r=>{Si(r.accounts).includes(t)&&e.push(...r.methods)}),e}function ig(i,t){const e=[];return Object.values(i).forEach(r=>{Si(r.accounts).includes(t)&&e.push(...r.events)}),e}function Lu(i){return i.includes(":")}function rg(i){return Lu(i)?i.split(":")[0]:i}function Wa(i){var t,e,r;const n={};if(!dr(i))return n;for(const[s,o]of Object.entries(i)){const c=Lu(s)?[s]:o.chains,l=o.methods||[],u=o.events||[],h=rg(s);n[h]=Xw(Qw({},n[h]),{chains:ni(c,(t=n[h])==null?void 0:t.chains),methods:ni(l,(e=n[h])==null?void 0:e.methods),events:ni(u,(r=n[h])==null?void 0:r.events)})}return n}function ng(i){const t={};return i==null||i.forEach(e=>{var r;const[n,s]=e.split(":");t[n]||(t[n]={accounts:[],chains:[],events:[],methods:[]}),t[n].accounts.push(e),(r=t[n].chains)==null||r.push(`${n}:${s}`)}),t}function Ha(i,t){t=t.map(r=>r.replace("did:pkh:",""));const e=ng(t);for(const[r,n]of Object.entries(e))n.methods?n.methods=ni(n.methods,i):n.methods=i,n.events=["chainChanged","accountsChanged"];return e}function sg(i,t){var e,r,n,s,o,c;const l=Wa(i),u=Wa(t),h={},d=Object.keys(l).concat(Object.keys(u));for(const p of d)h[p]={chains:ni((e=l[p])==null?void 0:e.chains,(r=u[p])==null?void 0:r.chains),methods:ni((n=l[p])==null?void 0:n.methods,(s=u[p])==null?void 0:s.methods),events:ni((o=l[p])==null?void 0:o.events,(c=u[p])==null?void 0:c.events)};return h}const og={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}},ag={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 N(i,t){const{message:e,code:r}=ag[i];return{message:t?`${e} ${t}`:e,code:r}}function ae(i,t){const{message:e,code:r}=og[i];return{message:t?`${e} ${t}`:e,code:r}}function Ai(i,t){return Array.isArray(i)?typeof t<"u"&&i.length?i.every(t):!0:!1}function dr(i){return Object.getPrototypeOf(i)===Object.prototype&&Object.keys(i).length}function fe(i){return typeof i>"u"}function de(i,t){return t&&fe(i)?!0:typeof i=="string"&&!!i.trim().length}function go(i,t){return t&&fe(i)?!0:typeof i=="number"&&!isNaN(i)}function cg(i,t){const{requiredNamespaces:e}=t,r=Object.keys(i.namespaces),n=Object.keys(e);let s=!0;return ei(n,r)?(r.forEach(o=>{const{accounts:c,methods:l,events:u}=i.namespaces[o],h=Si(c),d=e[o];(!ei(Cl(o,d),h)||!ei(d.methods,l)||!ei(d.events,u))&&(s=!1)}),s):!1}function rn(i){return de(i,!1)&&i.includes(":")?i.split(":").length===2:!1}function lg(i){if(de(i,!1)&&i.includes(":")){const t=i.split(":");if(t.length===3){const e=t[0]+":"+t[1];return!!t[2]&&rn(e)}}return!1}function ug(i){function t(e){try{return typeof new URL(e)<"u"}catch{return!1}}try{if(de(i,!1)){if(t(i))return!0;const e=Bl(i);return t(e)}}catch{}return!1}function hg(i){var t;return(t=i==null?void 0:i.proposer)==null?void 0:t.publicKey}function dg(i){return i==null?void 0:i.topic}function pg(i,t){let e=null;return de(i==null?void 0:i.publicKey,!1)||(e=N("MISSING_OR_INVALID",`${t} controller public key should be a string`)),e}function Ga(i){let t=!0;return Ai(i)?i.length&&(t=i.every(e=>de(e,!1))):t=!1,t}function _g(i,t,e){let r=null;return Ai(t)&&t.length?t.forEach(n=>{r||rn(n)||(r=ae("UNSUPPORTED_CHAINS",`${e}, chain ${n} should be a string and conform to "namespace:chainId" format`))}):rn(i)||(r=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"] }`)),r}function fg(i,t,e){let r=null;return Object.entries(i).forEach(([n,s])=>{if(r)return;const o=_g(n,Cl(n,s),`${t} ${e}`);o&&(r=o)}),r}function mg(i,t){let e=null;return Ai(i)?i.forEach(r=>{e||lg(r)||(e=ae("UNSUPPORTED_ACCOUNTS",`${t}, account ${r} 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 yg(i,t){let e=null;return Object.values(i).forEach(r=>{if(e)return;const n=mg(r==null?void 0:r.accounts,`${t} namespace`);n&&(e=n)}),e}function wg(i,t){let e=null;return Ga(i==null?void 0:i.methods)?Ga(i==null?void 0:i.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 Du(i,t){let e=null;return Object.values(i).forEach(r=>{if(e)return;const n=wg(r,`${t}, namespace`);n&&(e=n)}),e}function gg(i,t,e){let r=null;if(i&&dr(i)){const n=Du(i,t);n&&(r=n);const s=fg(i,t,e);s&&(r=s)}else r=N("MISSING_OR_INVALID",`${t}, ${e} should be an object with data`);return r}function $n(i,t){let e=null;if(i&&dr(i)){const r=Du(i,t);r&&(e=r);const n=yg(i,t);n&&(e=n)}else e=N("MISSING_OR_INVALID",`${t}, namespaces should be an object with data`);return e}function Vu(i){return de(i.protocol,!0)}function Eg(i,t){let e=!1;return i?i&&Ai(i)&&i.length&&i.forEach(r=>{e=Vu(r)}):e=!0,e}function vg(i){return typeof i=="number"}function Ue(i){return typeof i<"u"&&typeof i!==null}function bg(i){return!(!i||typeof i!="object"||!i.code||!go(i.code,!1)||!i.message||!de(i.message,!1))}function Ig(i){return!(fe(i)||!de(i.method,!1))}function Ag(i){return!(fe(i)||fe(i.result)&&fe(i.error)||!go(i.id,!1)||!de(i.jsonrpc,!1))}function Tg(i){return!(fe(i)||!de(i.name,!1))}function Ja(i,t){return!(!rn(t)||!eg(i).includes(t))}function Pg(i,t,e){return de(e,!1)?tg(i,t).includes(e):!1}function Og(i,t,e){return de(e,!1)?ig(i,t).includes(e):!1}function Ya(i,t,e){let r=null;const n=Rg(i),s=Lg(t),o=Object.keys(n),c=Object.keys(s),l=Za(Object.keys(i)),u=Za(Object.keys(t)),h=l.filter(d=>!u.includes(d));return h.length&&(r=N("NON_CONFORMING_NAMESPACES",`${e} namespaces keys don't satisfy requiredNamespaces.
@@ -9,6 +9,6 @@ ${i.length}`,e=new TextEncoder().encode(t+i);return"0x"+ee.from(Rm(e)).toString(
9
9
  Required: ${o.toString()}
10
10
  Approved: ${c.toString()}`)),Object.keys(t).forEach(d=>{if(!d.includes(":")||r)return;const p=Si(t[d].accounts);p.includes(d)||(r=N("NON_CONFORMING_NAMESPACES",`${e} namespaces accounts don't satisfy namespace accounts for ${d}
11
11
  Required: ${d}
12
- Approved: ${p.toString()}`))}),o.forEach(d=>{r||(ei(n[d].methods,s[d].methods)?ei(n[d].events,s[d].events)||(r=N("NON_CONFORMING_NAMESPACES",`${e} namespaces events don't satisfy namespace events for ${d}`)):r=N("NON_CONFORMING_NAMESPACES",`${e} namespaces methods don't satisfy namespace methods for ${d}`))}),r}function Rg(i){const t={};return Object.keys(i).forEach(e=>{var r;e.includes(":")?t[e]=i[e]:(r=i[e].chains)==null||r.forEach(n=>{t[n]={methods:i[e].methods,events:i[e].events}})}),t}function Za(i){return[...new Set(i.map(t=>t.includes(":")?t.split(":")[0]:t))]}function Lg(i){const t={};return Object.keys(i).forEach(e=>{if(e.includes(":"))t[e]=i[e];else{const r=Si(i[e].accounts);r==null||r.forEach(n=>{t[n]={accounts:i[e].accounts.filter(s=>s.includes(`${n}:`)),methods:i[e].methods,events:i[e].events}})}}),t}function Dg(i,t){return go(i,!1)&&i<=t.max&&i>=t.min}function Qa(){const i=yr();return new Promise(t=>{switch(i){case Ge.browser:t(Vg());break;case Ge.reactNative:t(xg());break;case Ge.node:t(Sg());break;default:t(!0)}})}function Vg(){return Di()&&(navigator==null?void 0:navigator.onLine)}async function xg(){if(Ht()&&typeof K<"u"&&K!=null&&K.NetInfo){const i=await(K==null?void 0:K.NetInfo.fetch());return i==null?void 0:i.isConnected}return!0}function Sg(){return!0}function Cg(i){switch(yr()){case Ge.browser:$g(i);break;case Ge.reactNative:kg(i);break}}function $g(i){!Ht()&&Di()&&(window.addEventListener("online",()=>i(!0)),window.addEventListener("offline",()=>i(!1)))}function kg(i){var t;Ht()&&typeof K<"u"&&K!=null&&K.NetInfo&&((t=K)==null||t.NetInfo.addEventListener(e=>i(e==null?void 0:e.isConnected)))}function Ug(){var i;return Di()&&Rt.getDocument()?((i=Rt.getDocument())==null?void 0:i.visibilityState)==="visible":!0}const kn={};class Mi{static get(t){return kn[t]}static set(t,e){kn[t]=e}static delete(t){delete kn[t]}}function Ng(i){const t=fr.decode(i);if(t.length<33)throw new Error("Too short to contain a public key");return t.slice(1,33)}function Bg({publicKey:i,signature:t,payload:e}){var r;const n=gs(e.method),s=128|parseInt(((r=e.version)==null?void 0:r.toString())||"4"),o=zg(e.address),c=e.era==="00"?new Uint8Array([0]):gs(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]),h=BigInt(`0x${qg(e.tip)}`),d=Kg(h),p=new Uint8Array([0,...i,o,...t,...c,...u,...d,...n]),_=jg(p.length+1);return new Uint8Array([..._,s,...p])}function Mg(i){const t=gs(i),e=td.blake2b(t,void 0,32);return"0x"+ee.from(e).toString("hex")}function gs(i){return new Uint8Array(i.replace(/^0x/,"").match(/.{1,2}/g).map(t=>parseInt(t,16)))}function qg(i){return i.startsWith("0x")?i.slice(2):i}function zg(i){const t=fr.decode(i)[0];return t===42?0:t===60?2:1}function jg(i){if(i<64)return new Uint8Array([i<<2]);if(i<16384){const t=i<<2|1;return new Uint8Array([t&255,t>>8&255])}else if(i<1<<30){const t=i<<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 Kg(i){if(i<BigInt(1)<<BigInt(6))return new Uint8Array([Number(i<<BigInt(2))]);if(i<BigInt(1)<<BigInt(14)){const t=i<<BigInt(2)|BigInt(1);return new Uint8Array([Number(t&BigInt(255)),Number(t>>BigInt(8)&BigInt(255))])}else if(i<BigInt(1)<<BigInt(30)){const t=i<<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 Fg(i){const t=Uint8Array.from(ee.from(i.signature,"hex")),e=Ng(i.transaction.address),r=Bg({publicKey:e,signature:t,payload:i.transaction}),n=ee.from(r).toString("hex");return Mg(n)}var Wg={};const xu="wc",Su=2,Es="core",wt=`${xu}@2:${Es}:`,Hg={logger:"error"},Gg={database:":memory:"},Jg="crypto",Xa="client_ed25519_seed",Yg=B.ONE_DAY,Zg="keychain",Qg="0.3",Xg="messages",eE="0.3",tE=B.SIX_HOURS,iE="publisher",Cu="irn",rE="error",$u="wss://relay.walletconnect.org",nE="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"},sE="_subscription",Ye={payload:"payload",connect:"connect",disconnect:"disconnect",error:"error"},oE=.1,vs="2.21.8",se={link_mode:"link_mode",relay:"relay"},Br={inbound:"inbound",outbound:"outbound"},aE="0.3",cE="WALLETCONNECT_CLIENT_ID",ec="WALLETCONNECT_LINK_MODE_APPS",We={created:"subscription_created",deleted:"subscription_deleted",expired:"subscription_expired",disabled:"subscription_disabled",sync:"subscription_sync",resubscribed:"subscription_resubscribed"},lE="subscription",uE="0.3",hE="pairing",dE="0.3",qi={wc_pairingDelete:{req:{ttl:B.ONE_DAY,prompt:!1,tag:1e3},res:{ttl:B.ONE_DAY,prompt:!1,tag:1001}},wc_pairingPing:{req:{ttl:B.THIRTY_SECONDS,prompt:!1,tag:1002},res:{ttl:B.THIRTY_SECONDS,prompt:!1,tag:1003}},unregistered_method:{req:{ttl:B.ONE_DAY,prompt:!1,tag:0},res:{ttl:B.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"},pE="history",_E="0.3",fE="expirer",Qe={created:"expirer_created",deleted:"expirer_deleted",expired:"expirer_expired",sync:"expirer_sync"},mE="0.3",yE="verify-api",wE="https://verify.walletconnect.com",ku="https://verify.walletconnect.org",ir=ku,gE=`${ir}/v3`,EE=[wE,ku],vE="echo",bE="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"},Ut={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"},zi={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"},Yt={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"},ji={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,AE="event-client",TE=86400,PE="https://pulse.walletconnect.org/batch";function OE(i,t){if(i.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),r=0;r<e.length;r++)e[r]=255;for(var n=0;n<i.length;n++){var s=i.charAt(n),o=s.charCodeAt(0);if(e[o]!==255)throw new TypeError(s+" is ambiguous");e[o]=n}var c=i.length,l=i.charAt(0),u=Math.log(c)/Math.log(256),h=Math.log(256)/Math.log(c);function d(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,R=f.length;b!==R&&f[b]===0;)b++,m++;for(var v=(R-b)*h+1>>>0,P=new Uint8Array(v);b!==R;){for(var T=f[b],g=0,D=v-1;(T!==0||g<y)&&D!==-1;D--,g++)T+=256*P[D]>>>0,P[D]=T%c>>>0,T=T/c>>>0;if(T!==0)throw new Error("Non-zero carry");y=g,b++}for(var L=v-y;L!==v&&P[L]===0;)L++;for(var w=l.repeat(m);L<v;++L)w+=i.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 R=(f.length-m)*u+1>>>0,v=new Uint8Array(R);f[m];){var P=e[f.charCodeAt(m)];if(P===255)return;for(var T=0,g=R-1;(P!==0||T<b)&&g!==-1;g--,T++)P+=c*v[g]>>>0,v[g]=P%256>>>0,P=P/256>>>0;if(P!==0)throw new Error("Non-zero carry");b=T,m++}if(f[m]!==" "){for(var D=R-b;D!==R&&v[D]===0;)D++;for(var L=new Uint8Array(y+(R-D)),w=y;D!==R;)L[w++]=v[D++];return L}}}function _(f){var m=p(f);if(m)return m;throw new Error(`Non-${t} character`)}return{encode:d,decodeUnsafe:p,decode:_}}var RE=OE,LE=RE;const Uu=i=>{if(i instanceof Uint8Array&&i.constructor.name==="Uint8Array")return i;if(i instanceof ArrayBuffer)return new Uint8Array(i);if(ArrayBuffer.isView(i))return new Uint8Array(i.buffer,i.byteOffset,i.byteLength);throw new Error("Unknown type, must be binary type")},DE=i=>new TextEncoder().encode(i),VE=i=>new TextDecoder().decode(i);class xE{constructor(t,e,r){this.name=t,this.prefix=e,this.baseEncode=r}encode(t){if(t instanceof Uint8Array)return`${this.prefix}${this.baseEncode(t)}`;throw Error("Unknown type, must be binary type")}}class SE{constructor(t,e,r){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=r}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 Nu(this,t)}}class CE{constructor(t){this.decoders=t}or(t){return Nu(this,t)}decode(t){const e=t[0],r=this.decoders[e];if(r)return r.decode(t);throw RangeError(`Unable to decode multibase string ${JSON.stringify(t)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const Nu=(i,t)=>new CE({...i.decoders||{[i.prefix]:i},...t.decoders||{[t.prefix]:t}});class $E{constructor(t,e,r,n){this.name=t,this.prefix=e,this.baseEncode=r,this.baseDecode=n,this.encoder=new xE(t,e,r),this.decoder=new SE(t,e,n)}encode(t){return this.encoder.encode(t)}decode(t){return this.decoder.decode(t)}}const _n=({name:i,prefix:t,encode:e,decode:r})=>new $E(i,t,e,r),vr=({prefix:i,name:t,alphabet:e})=>{const{encode:r,decode:n}=LE(e,t);return _n({prefix:i,name:t,encode:r,decode:s=>Uu(n(s))})},kE=(i,t,e,r)=>{const n={};for(let h=0;h<t.length;++h)n[t[h]]=h;let s=i.length;for(;i[s-1]==="=";)--s;const o=new Uint8Array(s*e/8|0);let c=0,l=0,u=0;for(let h=0;h<s;++h){const d=n[i[h]];if(d===void 0)throw new SyntaxError(`Non-${r} character`);l=l<<e|d,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},UE=(i,t,e)=>{const r=t[t.length-1]==="=",n=(1<<e)-1;let s="",o=0,c=0;for(let l=0;l<i.length;++l)for(c=c<<8|i[l],o+=8;o>e;)o-=e,s+=t[n&c>>o];if(o&&(s+=t[n&c<<e-o]),r)for(;s.length*e&7;)s+="=";return s},Ae=({name:i,prefix:t,bitsPerChar:e,alphabet:r})=>_n({prefix:t,name:i,encode(n){return UE(n,r,e)},decode(n){return kE(n,r,e,i)}}),NE=_n({prefix:"\0",name:"identity",encode:i=>VE(i),decode:i=>DE(i)});var BE=Object.freeze({__proto__:null,identity:NE});const ME=Ae({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var qE=Object.freeze({__proto__:null,base2:ME});const zE=Ae({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var jE=Object.freeze({__proto__:null,base8:zE});const KE=vr({prefix:"9",name:"base10",alphabet:"0123456789"});var FE=Object.freeze({__proto__:null,base10:KE});const WE=Ae({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),HE=Ae({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var GE=Object.freeze({__proto__:null,base16:WE,base16upper:HE});const JE=Ae({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),YE=Ae({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),ZE=Ae({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),QE=Ae({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),XE=Ae({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),e0=Ae({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),t0=Ae({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),i0=Ae({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),r0=Ae({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var n0=Object.freeze({__proto__:null,base32:JE,base32upper:YE,base32pad:ZE,base32padupper:QE,base32hex:XE,base32hexupper:e0,base32hexpad:t0,base32hexpadupper:i0,base32z:r0});const s0=vr({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),o0=vr({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var a0=Object.freeze({__proto__:null,base36:s0,base36upper:o0});const c0=vr({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),l0=vr({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var u0=Object.freeze({__proto__:null,base58btc:c0,base58flickr:l0});const h0=Ae({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),d0=Ae({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),p0=Ae({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),_0=Ae({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var f0=Object.freeze({__proto__:null,base64:h0,base64pad:d0,base64url:p0,base64urlpad:_0});const Bu=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),m0=Bu.reduce((i,t,e)=>(i[e]=t,i),[]),y0=Bu.reduce((i,t,e)=>(i[t.codePointAt(0)]=e,i),[]);function w0(i){return i.reduce((t,e)=>(t+=m0[e],t),"")}function g0(i){const t=[];for(const e of i){const r=y0[e.codePointAt(0)];if(r===void 0)throw new Error(`Non-base256emoji character: ${e}`);t.push(r)}return new Uint8Array(t)}const E0=_n({prefix:"🚀",name:"base256emoji",encode:w0,decode:g0});var v0=Object.freeze({__proto__:null,base256emoji:E0}),b0=Mu,tc=128,I0=-128,A0=Math.pow(2,31);function Mu(i,t,e){t=t||[],e=e||0;for(var r=e;i>=A0;)t[e++]=i&255|tc,i/=128;for(;i&I0;)t[e++]=i&255|tc,i>>>=7;return t[e]=i|0,Mu.bytes=e-r+1,t}var T0=bs,P0=128,ic=127;function bs(i,r){var e=0,r=r||0,n=0,s=r,o,c=i.length;do{if(s>=c)throw bs.bytes=0,new RangeError("Could not decode varint");o=i[s++],e+=n<28?(o&ic)<<n:(o&ic)*Math.pow(2,n),n+=7}while(o>=P0);return bs.bytes=s-r,e}var O0=Math.pow(2,7),R0=Math.pow(2,14),L0=Math.pow(2,21),D0=Math.pow(2,28),V0=Math.pow(2,35),x0=Math.pow(2,42),S0=Math.pow(2,49),C0=Math.pow(2,56),$0=Math.pow(2,63),k0=function(i){return i<O0?1:i<R0?2:i<L0?3:i<D0?4:i<V0?5:i<x0?6:i<S0?7:i<C0?8:i<$0?9:10},U0={encode:b0,decode:T0,encodingLength:k0},qu=U0;const rc=(i,t,e=0)=>(qu.encode(i,t,e),t),nc=i=>qu.encodingLength(i),Is=(i,t)=>{const e=t.byteLength,r=nc(i),n=r+nc(e),s=new Uint8Array(n+e);return rc(i,s,0),rc(e,s,r),s.set(t,n),new N0(i,e,t,s)};class N0{constructor(t,e,r,n){this.code=t,this.size=e,this.digest=r,this.bytes=n}}const zu=({name:i,code:t,encode:e})=>new B0(i,t,e);class B0{constructor(t,e,r){this.name=t,this.code=e,this.encode=r}digest(t){if(t instanceof Uint8Array){const e=this.encode(t);return e instanceof Uint8Array?Is(this.code,e):e.then(r=>Is(this.code,r))}else throw Error("Unknown type, must be binary type")}}const ju=i=>async t=>new Uint8Array(await crypto.subtle.digest(i,t)),M0=zu({name:"sha2-256",code:18,encode:ju("SHA-256")}),q0=zu({name:"sha2-512",code:19,encode:ju("SHA-512")});var z0=Object.freeze({__proto__:null,sha256:M0,sha512:q0});const Ku=0,j0="identity",Fu=Uu,K0=i=>Is(Ku,Fu(i)),F0={code:Ku,name:j0,encode:Fu,digest:K0};var W0=Object.freeze({__proto__:null,identity:F0});new TextEncoder,new TextDecoder;const sc={...BE,...qE,...jE,...FE,...GE,...n0,...a0,...u0,...f0,...v0};({...z0,...W0});function Wu(i){return globalThis.Buffer!=null?new Uint8Array(i.buffer,i.byteOffset,i.byteLength):i}function H0(i=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?Wu(globalThis.Buffer.allocUnsafe(i)):new Uint8Array(i)}function Hu(i,t,e,r){return{name:i,prefix:t,encoder:{name:i,prefix:t,encode:e},decoder:{decode:r}}}const oc=Hu("utf8","u",i=>"u"+new TextDecoder("utf8").decode(i),i=>new TextEncoder().encode(i.substring(1))),Un=Hu("ascii","a",i=>{let t="a";for(let e=0;e<i.length;e++)t+=String.fromCharCode(i[e]);return t},i=>{i=i.substring(1);const t=H0(i.length);for(let e=0;e<i.length;e++)t[e]=i.charCodeAt(e);return t}),G0={utf8:oc,"utf-8":oc,hex:sc.base16,latin1:Un,ascii:Un,binary:Un,...sc};function J0(i,t="utf8"){const e=G0[t];if(!e)throw new Error(`Unsupported encoding "${t}"`);return(t==="utf8"||t==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?Wu(globalThis.Buffer.from(i,"utf-8")):e.decoder.decode(`${e.prefix}${i}`)}var Y0=Object.defineProperty,Z0=(i,t,e)=>t in i?Y0(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,ht=(i,t,e)=>Z0(i,typeof t!="symbol"?t+"":t,e);class Q0{constructor(t,e){this.core=t,this.logger=e,ht(this,"keychain",new Map),ht(this,"name",Zg),ht(this,"version",Qg),ht(this,"initialized",!1),ht(this,"storagePrefix",wt),ht(this,"init",async()=>{if(!this.initialized){const r=await this.getKeyChain();typeof r<"u"&&(this.keychain=r),this.initialized=!0}}),ht(this,"has",r=>(this.isInitialized(),this.keychain.has(r))),ht(this,"set",async(r,n)=>{this.isInitialized(),this.keychain.set(r,n),await this.persist()}),ht(this,"get",r=>{this.isInitialized();const n=this.keychain.get(r);if(typeof n>"u"){const{message:s}=N("NO_MATCHING_KEY",`${this.name}: ${r}`);throw new Error(s)}return n}),ht(this,"del",async r=>{this.isInitialized(),this.keychain.delete(r),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,as(t))}async getKeyChain(){const t=await this.core.storage.getItem(this.storageKey);return typeof t<"u"?cs(t):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){const{message:t}=N("NOT_INITIALIZED",this.name);throw new Error(t)}}}var X0=Object.defineProperty,ev=(i,t,e)=>t in i?X0(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,ve=(i,t,e)=>ev(i,typeof t!="symbol"?t+"":t,e);class tv{constructor(t,e,r){this.core=t,this.logger=e,ve(this,"name",Jg),ve(this,"keychain"),ve(this,"randomSessionIdentifier",ws()),ve(this,"initialized",!1),ve(this,"init",async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)}),ve(this,"hasKeys",n=>(this.isInitialized(),this.keychain.has(n))),ve(this,"getClientId",async()=>{this.isInitialized();const n=await this.getClientSeed(),s=Do(n);return sd(s.publicKey)}),ve(this,"generateKeyPair",()=>{this.isInitialized();const n=Cw();return this.setPrivateKey(n.publicKey,n.privateKey)}),ve(this,"signJWT",async n=>{this.isInitialized();const s=await this.getClientSeed(),o=Do(s),c=this.randomSessionIdentifier;return await od(c,n,Yg,o)}),ve(this,"generateSharedKey",(n,s,o)=>{this.isInitialized();const c=this.getPrivateKey(n),l=$w(c,s);return this.setSymKey(l,o)}),ve(this,"setSymKey",async(n,s)=>{this.isInitialized();const o=s||Nr(n);return await this.keychain.set(o,n),o}),ve(this,"deleteKeyPair",async n=>{this.isInitialized(),await this.keychain.del(n)}),ve(this,"deleteSymKey",async n=>{this.isInitialized(),await this.keychain.del(n)}),ve(this,"encode",async(n,s,o)=>{this.isInitialized();const c=Ru(o),l=sr(s);if(qa(c))return Nw(l,o==null?void 0:o.encoding);if(Ma(c)){const p=c.senderPublicKey,_=c.receiverPublicKey;n=await this.generateSharedKey(p,_)}const u=this.getSymKey(n),{type:h,senderPublicKey:d}=c;return kw({type:h,symKey:u,message:l,senderPublicKey:d,encoding:o==null?void 0:o.encoding})}),ve(this,"decode",async(n,s,o)=>{this.isInitialized();const c=Mw(s,o);if(qa(c)){const l=Bw(s,o==null?void 0:o.encoding);return jr(l)}if(Ma(c)){const l=c.receiverPublicKey,u=c.senderPublicKey;n=await this.generateSharedKey(l,u)}try{const l=this.getSymKey(n),u=Uw({symKey:l,encoded:s,encoding:o==null?void 0:o.encoding});return jr(u)}catch(l){this.logger.error(`Failed to decode message from topic: '${n}', clientId: '${await this.getClientId()}'`),this.logger.error(l)}}),ve(this,"getPayloadType",(n,s=Me)=>{const o=hr({encoded:n,encoding:s});return ci(o.type)}),ve(this,"getPayloadSenderPublicKey",(n,s=Me)=>{const o=hr({encoded:n,encoding:s});return o.senderPublicKey?je(o.senderPublicKey,Se):void 0}),this.core=t,this.logger=Ce(e,this.name),this.keychain=r||new Q0(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(Xa)}catch{t=ws(),await this.keychain.set(Xa,t)}return J0(t,"base16")}getSymKey(t){return this.keychain.get(t)}isInitialized(){if(!this.initialized){const{message:t}=N("NOT_INITIALIZED",this.name);throw new Error(t)}}}var iv=Object.defineProperty,rv=Object.defineProperties,nv=Object.getOwnPropertyDescriptors,ac=Object.getOwnPropertySymbols,sv=Object.prototype.hasOwnProperty,ov=Object.prototype.propertyIsEnumerable,As=(i,t,e)=>t in i?iv(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,av=(i,t)=>{for(var e in t||(t={}))sv.call(t,e)&&As(i,e,t[e]);if(ac)for(var e of ac(t))ov.call(t,e)&&As(i,e,t[e]);return i},cv=(i,t)=>rv(i,nv(t)),Fe=(i,t,e)=>As(i,typeof t!="symbol"?t+"":t,e);class lv extends Hp{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",Xg),Fe(this,"version",eE),Fe(this,"initialized",!1),Fe(this,"storagePrefix",wt),Fe(this,"init",async()=>{if(!this.initialized){this.logger.trace("Initialized");try{const r=await this.getRelayerMessages();typeof r<"u"&&(this.messages=r);const n=await this.getRelayerMessagesWithoutClientAck();typeof n<"u"&&(this.messagesWithoutClientAck=n),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(r){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(r)}finally{this.initialized=!0}}}),Fe(this,"set",async(r,n,s)=>{this.isInitialized();const o=Xe(n);let c=this.messages.get(r);if(typeof c>"u"&&(c={}),typeof c[o]<"u")return o;if(c[o]=n,this.messages.set(r,c),s===Br.inbound){const l=this.messagesWithoutClientAck.get(r)||{};this.messagesWithoutClientAck.set(r,cv(av({},l),{[o]:n}))}return await this.persist(),o}),Fe(this,"get",r=>{this.isInitialized();let n=this.messages.get(r);return typeof n>"u"&&(n={}),n}),Fe(this,"getWithoutAck",r=>{this.isInitialized();const n={};for(const s of r){const o=this.messagesWithoutClientAck.get(s)||{};n[s]=Object.values(o)}return n}),Fe(this,"has",(r,n)=>{this.isInitialized();const s=this.get(r),o=Xe(n);return typeof s[o]<"u"}),Fe(this,"ack",async(r,n)=>{this.isInitialized();const s=this.messagesWithoutClientAck.get(r);if(typeof s>"u")return;const o=Xe(n);delete s[o],Object.keys(s).length===0?this.messagesWithoutClientAck.delete(r):this.messagesWithoutClientAck.set(r,s),await this.persist()}),Fe(this,"del",async r=>{this.isInitialized(),this.messages.delete(r),this.messagesWithoutClientAck.delete(r),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,as(t))}async setRelayerMessagesWithoutClientAck(t){await this.core.storage.setItem(this.storageKeyWithoutClientAck,as(t))}async getRelayerMessages(){const t=await this.core.storage.getItem(this.storageKey);return typeof t<"u"?cs(t):void 0}async getRelayerMessagesWithoutClientAck(){const t=await this.core.storage.getItem(this.storageKeyWithoutClientAck);return typeof t<"u"?cs(t):void 0}async persist(){await this.setRelayerMessages(this.messages),await this.setRelayerMessagesWithoutClientAck(this.messagesWithoutClientAck)}isInitialized(){if(!this.initialized){const{message:t}=N("NOT_INITIALIZED",this.name);throw new Error(t)}}}var uv=Object.defineProperty,hv=Object.defineProperties,dv=Object.getOwnPropertyDescriptors,cc=Object.getOwnPropertySymbols,pv=Object.prototype.hasOwnProperty,_v=Object.prototype.propertyIsEnumerable,Ts=(i,t,e)=>t in i?uv(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,yi=(i,t)=>{for(var e in t||(t={}))pv.call(t,e)&&Ts(i,e,t[e]);if(cc)for(var e of cc(t))_v.call(t,e)&&Ts(i,e,t[e]);return i},lc=(i,t)=>hv(i,dv(t)),Ze=(i,t,e)=>Ts(i,typeof t!="symbol"?t+"":t,e);class fv extends Gp{constructor(t,e){super(t,e),this.relayer=t,this.logger=e,Ze(this,"events",new ui.EventEmitter),Ze(this,"name",iE),Ze(this,"queue",new Map),Ze(this,"publishTimeout",B.toMiliseconds(B.ONE_MINUTE)),Ze(this,"initialPublishTimeout",B.toMiliseconds(B.ONE_SECOND*15)),Ze(this,"needsTransportRestart",!1),Ze(this,"publish",async(r,n,s)=>{var o,c,l,u,h;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:r,message:n,opts:s}});const d=(s==null?void 0:s.ttl)||tE,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=vi(tn().protocol),y={id:f,method:(s==null?void 0:s.publishMethod)||m.publish,params:yi({topic:r,message:n,ttl:d,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 R=new Promise(async v=>{const P=({id:g})=>{var D;((D=y.id)==null?void 0:D.toString())===g.toString()&&(this.removeRequestFromQueue(g),this.relayer.events.removeListener(le.publish,P),v())};this.relayer.events.on(le.publish,P);const T=mt(new Promise((g,D)=>{this.rpcPublish(y,s).then(g).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 T,this.events.removeListener(le.publish,P)}catch(g){this.queue.set(f,{request:y,opts:s,attempt:1}),this.logger.warn(g,g==null?void 0:g.message)}});this.logger.trace({type:"method",method:"publish",params:{id:f,topic:r,message:n,opts:s}}),await mt(R,this.publishTimeout,b)}catch(R){if(this.logger.debug("Failed to Publish Payload"),this.logger.error(R),(h=s==null?void 0:s.internal)!=null&&h.throwOnFailedPublish)throw R}finally{this.queue.delete(f)}}),Ze(this,"publishCustom",async r=>{var n,s,o,c,l;this.logger.debug("Publishing custom payload"),this.logger.trace({type:"method",method:"publishCustom",params:r});const{payload:u,opts:h={}}=r,{attestation:d,tvf:p,publishMethod:_,prompt:f,tag:m,ttl:y=B.FIVE_MINUTES}=h,b=h.id||Xt().toString(),R=vi(tn().protocol),v=_||R.publish,P={id:b,method:v,params:yi(lc(yi({},u),{ttl:y,prompt:f,tag:m,attestation:d}),p)},T=`Failed to publish custom payload, please try again. id:${b} tag:${m}`;try{fe((n=P.params)==null?void 0:n.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 g=new Promise(async D=>{const L=({id:E})=>{var I;((I=P.id)==null?void 0:I.toString())===E.toString()&&(this.removeRequestFromQueue(E),this.relayer.events.removeListener(le.publish,L),D())};this.relayer.events.on(le.publish,L);const w=mt(new Promise((E,I)=>{this.rpcPublish(P,h).then(E).catch(A=>{this.logger.warn(A,A==null?void 0:A.message),I(A)})}),this.initialPublishTimeout,`Failed initial custom payload publish, retrying.... method:${v} id:${b} tag:${m}`);try{await w,this.events.removeListener(le.publish,L)}catch(E){this.queue.set(b,{request:P,opts:h,attempt:1}),this.logger.warn(E,E==null?void 0:E.message)}});this.logger.trace({type:"method",method:"publish",params:{id:b,payload:u,opts:h}}),await mt(g,this.publishTimeout,T)}catch(g){if(this.logger.debug("Failed to Publish Payload"),this.logger.error(g),(l=h==null?void 0:h.internal)!=null&&l.throwOnFailedPublish)throw g}finally{this.queue.delete(b)}}),Ze(this,"on",(r,n)=>{this.events.on(r,n)}),Ze(this,"once",(r,n)=>{this.events.once(r,n)}),Ze(this,"off",(r,n)=>{this.events.off(r,n)}),Ze(this,"removeListener",(r,n)=>{this.events.removeListener(r,n)}),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 r=await this.relayer.request(t);return this.relayer.events.emit(le.publish,yi(yi({},t),e)),this.logger.debug("Successfully Published Payload"),r}removeRequestFromQueue(t){this.queue.delete(t)}checkQueue(){this.queue.forEach(async(t,e)=>{var r;const n=t.attempt+1;this.queue.set(e,lc(yi({},t),{attempt:n})),this.logger.warn({},`Publisher: queue->publishing: ${t.request.id}, tag: ${(r=t.request.params)==null?void 0:r.tag}, attempt: ${n}`),await this.rpcPublish(t.request,t.opts),this.logger.warn({},`Publisher: queue->published: ${t.request.id}`)})}registerEventListeners(){this.relayer.core.heartbeat.on(Pi.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 mv=Object.defineProperty,yv=(i,t,e)=>t in i?mv(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,wi=(i,t,e)=>yv(i,typeof t!="symbol"?t+"":t,e);class wv{constructor(){wi(this,"map",new Map),wi(this,"set",(t,e)=>{const r=this.get(t);this.exists(t,e)||this.map.set(t,[...r,e])}),wi(this,"get",t=>this.map.get(t)||[]),wi(this,"exists",(t,e)=>this.get(t).includes(e)),wi(this,"delete",(t,e)=>{if(typeof e>"u"){this.map.delete(t);return}if(!this.map.has(t))return;const r=this.get(t);if(!this.exists(t,e))return;const n=r.filter(s=>s!==e);if(!n.length){this.map.delete(t);return}this.map.set(t,n)}),wi(this,"clear",()=>{this.map.clear()})}get topics(){return Array.from(this.map.keys())}}var gv=Object.defineProperty,Ev=Object.defineProperties,vv=Object.getOwnPropertyDescriptors,uc=Object.getOwnPropertySymbols,bv=Object.prototype.hasOwnProperty,Iv=Object.prototype.propertyIsEnumerable,Ps=(i,t,e)=>t in i?gv(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Ki=(i,t)=>{for(var e in t||(t={}))bv.call(t,e)&&Ps(i,e,t[e]);if(uc)for(var e of uc(t))Iv.call(t,e)&&Ps(i,e,t[e]);return i},Nn=(i,t)=>Ev(i,vv(t)),re=(i,t,e)=>Ps(i,typeof t!="symbol"?t+"":t,e);class Av extends Zp{constructor(t,e){super(t,e),this.relayer=t,this.logger=e,re(this,"subscriptions",new Map),re(this,"topicMap",new wv),re(this,"events",new ui.EventEmitter),re(this,"name",lE),re(this,"version",uE),re(this,"pending",new Map),re(this,"cached",[]),re(this,"initialized",!1),re(this,"storagePrefix",wt),re(this,"subscribeTimeout",B.toMiliseconds(B.ONE_MINUTE)),re(this,"initialSubscribeTimeout",B.toMiliseconds(B.ONE_SECOND*15)),re(this,"clientId"),re(this,"batchSubscribeTopicsLimit",500),re(this,"init",async()=>{this.initialized||(this.logger.trace("Initialized"),this.registerEventListeners(),await this.restore()),this.initialized=!0}),re(this,"subscribe",async(r,n)=>{var s;this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:r,opts:n}});try{const o=tn(n),c={topic:r,relay:o,transportType:n==null?void 0:n.transportType};(s=n==null?void 0:n.internal)!=null&&s.skipSubscribe||this.pending.set(r,c);const l=await this.rpcSubscribe(r,o,n);return typeof l=="string"&&(this.onSubscribe(l,c),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:r,opts:n}})),l}catch(o){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(o),o}}),re(this,"unsubscribe",async(r,n)=>{this.isInitialized(),typeof(n==null?void 0:n.id)<"u"?await this.unsubscribeById(r,n.id,n):await this.unsubscribeByTopic(r,n)}),re(this,"isSubscribed",r=>new Promise(n=>{n(this.topicMap.topics.includes(r))})),re(this,"isKnownTopic",r=>new Promise(n=>{n(this.topicMap.topics.includes(r)||this.pending.has(r)||this.cached.some(s=>s.topic===r))})),re(this,"on",(r,n)=>{this.events.on(r,n)}),re(this,"once",(r,n)=>{this.events.once(r,n)}),re(this,"off",(r,n)=>{this.events.off(r,n)}),re(this,"removeListener",(r,n)=>{this.events.removeListener(r,n)}),re(this,"start",async()=>{await this.onConnect()}),re(this,"stop",async()=>{await this.onDisconnect()}),re(this,"restart",async()=>{await this.restore(),await this.onRestart()}),re(this,"checkPending",async()=>{if(this.pending.size===0&&(!this.initialized||!this.relayer.connected))return;const r=[];this.pending.forEach(n=>{r.push(n)}),await this.batchSubscribe(r)}),re(this,"registerEventListeners",()=>{this.relayer.core.heartbeat.on(Pi.pulse,async()=>{await this.checkPending()}),this.events.on(We.created,async r=>{const n=We.created;this.logger.info(`Emitting ${n}`),this.logger.debug({type:"event",event:n,data:r}),await this.persist()}),this.events.on(We.deleted,async r=>{const n=We.deleted;this.logger.info(`Emitting ${n}`),this.logger.debug({type:"event",event:n,data:r}),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 r=!1;try{r=this.getSubscription(t).topic===e}catch{}return r}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 r=this.topicMap.get(t);await Promise.all(r.map(async n=>await this.unsubscribeById(t,n,e)))}async unsubscribeById(t,e,r){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:t,id:e,opts:r}});try{const n=tn(r);await this.restartToComplete({topic:t,id:e,relay:n}),await this.rpcUnsubscribe(t,e,n);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:r}})}catch(n){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(n),n}}async rpcSubscribe(t,e,r){var n,s;const o=await this.getSubscriptionId(t);if((n=r==null?void 0:r.internal)!=null&&n.skipSubscribe)return o;(!r||(r==null?void 0:r.transportType)===se.relay)&&await this.restartToComplete({topic:t,id:t,relay:e});const c={method:vi(e.protocol).subscribe,params:{topic:t}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:c});const l=(s=r==null?void 0:r.internal)==null?void 0:s.throwOnFailedPublish;try{if((r==null?void 0:r.transportType)===se.link_mode)return setTimeout(()=>{(this.relayer.connected||this.relayer.connecting)&&this.relayer.request(c).catch(d=>this.logger.warn(d))},B.toMiliseconds(B.ONE_SECOND)),o;const u=new Promise(async d=>{const p=_=>{_.topic===t&&(this.events.removeListener(We.created,p),d(_.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),d(_)}catch{}}),h=await mt(u,this.subscribeTimeout,`Subscribing to ${t} failed, please try again`);if(!h&&l)throw new Error(`Subscribing to ${t} failed, please try again`);return h?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,r={method:vi(e.protocol).batchSubscribe,params:{topics:t.map(n=>n.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:r});try{await await mt(new Promise(n=>{this.relayer.request(r).catch(s=>this.logger.warn(s)).then(n)}),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,r={method:vi(e.protocol).batchFetchMessages,params:{topics:t.map(s=>s.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:r});let n;try{n=await await mt(new Promise((s,o)=>{this.relayer.request(r).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 n}rpcUnsubscribe(t,e,r){const n={method:vi(r.protocol).unsubscribe,params:{topic:t,id:e}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n}),this.relayer.request(n)}onSubscribe(t,e){this.setSubscription(t,Nn(Ki({},e),{id:t})),this.pending.delete(e.topic)}onBatchSubscribe(t){t.length&&t.forEach(e=>{this.setSubscription(e.id,Ki({},e)),this.pending.delete(e.topic)})}async onUnsubscribe(t,e,r){this.events.removeAllListeners(e),this.hasSubscription(e,t)&&this.deleteSubscription(e,r),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,Ki({},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:r}=N("NO_MATCHING_KEY",`${this.name}: ${t}`);throw new Error(r)}return e}deleteSubscription(t,e){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:t,reason:e});const r=this.getSubscription(t);this.subscriptions.delete(t),this.topicMap.delete(r.topic,t),this.events.emit(We.deleted,Nn(Ki({},r),{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 r=0;r<e;r++){const n=t.splice(0,this.batchSubscribeTopicsLimit);await this.batchSubscribe(n)}}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 r;return e.topic===((r=this.subscriptions.get(e.id))==null?void 0:r.topic)})){const{message:e}=N("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=>Nn(Ki({},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 im(B.toMiliseconds(B.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}=N("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 Xe(t+await this.getClientId())}}var Tv=Object.defineProperty,hc=Object.getOwnPropertySymbols,Pv=Object.prototype.hasOwnProperty,Ov=Object.prototype.propertyIsEnumerable,Os=(i,t,e)=>t in i?Tv(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,dc=(i,t)=>{for(var e in t||(t={}))Pv.call(t,e)&&Os(i,e,t[e]);if(hc)for(var e of hc(t))Ov.call(t,e)&&Os(i,e,t[e]);return i},X=(i,t,e)=>Os(i,typeof t!="symbol"?t+"":t,e);class Rv extends Jp{constructor(t){super(t),X(this,"protocol","wc"),X(this,"version",2),X(this,"core"),X(this,"logger"),X(this,"events",new ui.EventEmitter),X(this,"provider"),X(this,"messages"),X(this,"subscriber"),X(this,"publisher"),X(this,"name",nE),X(this,"transportExplicitlyClosed",!1),X(this,"initialized",!1),X(this,"connectionAttemptInProgress",!1),X(this,"relayUrl"),X(this,"projectId"),X(this,"packageName"),X(this,"bundleId"),X(this,"hasExperiencedNetworkDisruption",!1),X(this,"pingTimeout"),X(this,"heartBeatTimeout",B.toMiliseconds(B.THIRTY_SECONDS+B.FIVE_SECONDS)),X(this,"reconnectTimeout"),X(this,"connectPromise"),X(this,"reconnectInProgress",!1),X(this,"requestsInFlight",[]),X(this,"connectTimeout",B.toMiliseconds(B.ONE_SECOND*15)),X(this,"request",async e=>{var r,n;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:(r=e.params)==null?void 0:r.topic},"relayer.request - publishing...");const o=`${s}:${((n=e.params)==null?void 0:n.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}}),X(this,"resetPingTimeout",()=>{Zr()&&(clearTimeout(this.pingTimeout),this.pingTimeout=setTimeout(()=>{var e,r,n,s;try{this.logger.debug({},"pingTimeout: Connection stalled, terminating..."),(s=(n=(r=(e=this.provider)==null?void 0:e.connection)==null?void 0:r.socket)==null?void 0:n.terminate)==null||s.call(n)}catch(o){this.logger.warn(o,o==null?void 0:o.message)}},this.heartBeatTimeout))}),X(this,"onPayloadHandler",e=>{this.onProviderPayload(e),this.resetPingTimeout()}),X(this,"onConnectHandler",()=>{this.logger.warn({},"Relayer connected 🛜"),this.startPingTimeout(),this.events.emit(le.connect)}),X(this,"onDisconnectHandler",()=>{this.logger.warn({},"Relayer disconnected 🛑"),this.requestsInFlight=[],this.onProviderDisconnect()}),X(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()}),X(this,"registerProviderListeners",()=>{this.provider.on(Ye.payload,this.onPayloadHandler),this.provider.on(Ye.connect,this.onConnectHandler),this.provider.on(Ye.disconnect,this.onDisconnectHandler),this.provider.on(Ye.error,this.onProviderErrorHandler)}),this.core=t.core,this.logger=typeof t.logger<"u"&&typeof t.logger!="string"?Ce(t.logger,this.name):on(eo({level:t.logger||rE})),this.messages=new lv(this.logger,t.core),this.subscriber=new Av(this,this.logger),this.publisher=new fv(this,this.logger),this.projectId=t==null?void 0:t.projectId,this.relayUrl=(t==null?void 0:t.relayUrl)||$u,Mf()?this.packageName=ca():qf()&&(this.bundleId=ca()),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,r;return((r=(e=(t=this.provider)==null?void 0:t.connection)==null?void 0:e.socket)==null?void 0:r.readyState)===1||!1}get connecting(){var t,e,r;return((r=(e=(t=this.provider)==null?void 0:t.connection)==null?void 0:e.socket)==null?void 0:r.readyState)===0||this.connectPromise!==void 0||!1}async publish(t,e,r){this.isInitialized(),await this.publisher.publish(t,e,r),await this.recordMessageEvent({topic:t,message:e,publishedAt:Date.now(),transportType:se.relay},Br.outbound)}async publishCustom(t){this.isInitialized(),await this.publisher.publishCustom(t)}async subscribe(t,e){var r,n,s;this.isInitialized(),(!(e!=null&&e.transportType)||(e==null?void 0:e.transportType)==="relay")&&await this.toEstablishConnection();const o=typeof((r=e==null?void 0:e.internal)==null?void 0:r.throwOnFailedPublish)>"u"?!0:(n=e==null?void 0:e.internal)==null?void 0:n.throwOnFailedPublish;let c=((s=this.subscriber.topicMap.get(t))==null?void 0:s[0])||"",l;const u=h=>{h.topic===t&&(this.subscriber.off(We.created,u),l())};return await Promise.all([new Promise(h=>{l=h,this.subscriber.on(We.created,u)}),new Promise(async(h,d)=>{c=await this.subscriber.subscribe(t,dc({internal:{throwOnFailedPublish:o}},e)).catch(p=>{o&&d(p)})||c,h()})]),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,r)=>{await this.connect(t).then(e).catch(r).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 Qa())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((r,n)=>r.publishedAt-n.publishedAt);this.logger.debug(`Batch of ${e.length} message events sorted`);for(const r of e)try{await this.onMessageEvent(r)}catch(n){this.logger.warn(n,"Error while processing batch message event: "+(n==null?void 0:n.message))}this.logger.trace(`Batch of ${e.length} message events processed`)}async onLinkMessageEvent(t,e){const{topic:r}=t;if(!e.sessionExists){const n=_e(B.FIVE_MINUTES),s={topic:r,expiry:n,relay:{protocol:"irn"},active:!1};await this.core.pairing.pairings.set(r,s)}this.events.emit(le.message,t),await this.recordMessageEvent(t,Br.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(r,n)=>{const s=()=>{n(new Error("Connection interrupted while trying to connect"))};this.provider.once(Ye.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=>{n(o)}).finally(()=>{this.provider.off(Ye.disconnect,s),clearTimeout(this.reconnectTimeout)}),await new Promise(async(o,c)=>{const l=()=>{n(new Error("Connection interrupted while trying to subscribe"))};this.provider.once(Ye.disconnect,l),await this.subscriber.start().then(o).catch(c).finally(()=>{this.provider.off(Ye.disconnect,l)})}),this.hasExperiencedNetworkDisruption=!1,r()})}catch(r){await this.subscriber.stop();const n=r;this.logger.warn({},n.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(r=>setTimeout(r,B.toMiliseconds(e*1))),e++}}startPingTimeout(){var t,e,r,n,s;if(Zr())try{(e=(t=this.provider)==null?void 0:t.connection)!=null&&e.socket&&((s=(n=(r=this.provider)==null?void 0:r.connection)==null?void 0:n.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 rd(new nd(Wf({sdkVersion:vs,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:r,message:n}=t;await this.messages.set(r,n,e)}async shouldIgnoreMessageEvent(t){const{topic:e,message:r}=t;if(!r||r.length===0)return this.logger.warn(`Ignoring invalid/empty message: ${r}`),!0;if(!await this.subscriber.isKnownTopic(e))return this.logger.warn(`Ignoring message for unknown topic ${e}`),!0;const n=this.messages.has(e,r);return n&&this.logger.warn(`Ignoring duplicate message: ${r}`),n}async onProviderPayload(t){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:t}),zs(t)){if(!t.method.endsWith(sE))return;const e=t.params,{topic:r,message:n,publishedAt:s,attestation:o}=e.data,c={topic:r,message:n,publishedAt:s,transportType:se.relay,attestation:o};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(dc({type:"event",event:e.id},c)),this.events.emit(e.id,c),await this.acknowledgePayload(t),await this.onMessageEvent(c)}else js(t)&&this.events.emit(le.message_ack,t)}async onMessageEvent(t){await this.shouldIgnoreMessageEvent(t)||(await this.recordMessageEvent(t,Br.inbound),this.events.emit(le.message,t))}async acknowledgePayload(t){const e=Kr(t.id,!0);await this.provider.connection.send(e)}unregisterProviderListeners(){this.provider.off(Ye.payload,this.onPayloadHandler),this.provider.off(Ye.connect,this.onConnectHandler),this.provider.off(Ye.disconnect,this.onDisconnectHandler),this.provider.off(Ye.error,this.onProviderErrorHandler),clearTimeout(this.pingTimeout)}async registerEventListeners(){let t=await Qa();Cg(async e=>{t!==e&&(t=e,e?await this.transportOpen().catch(r=>this.logger.error(r,r==null?void 0:r.message)):(this.hasExperiencedNetworkDisruption=!0,await this.transportDisconnect(),this.transportExplicitlyClosed=!1))}),this.core.heartbeat.on(Pi.pulse,async()=>{if(!this.transportExplicitlyClosed&&!this.connected&&Ug())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},B.toMiliseconds(oE)))))}isInitialized(){if(!this.initialized){const{message:t}=N("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 Lv(i,t){return i===t||Number.isNaN(i)&&Number.isNaN(t)}function pc(i){return Object.getOwnPropertySymbols(i).filter(t=>Object.prototype.propertyIsEnumerable.call(i,t))}function _c(i){return i==null?i===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(i)}const Dv="[object RegExp]",Vv="[object String]",xv="[object Number]",Sv="[object Boolean]",fc="[object Arguments]",Cv="[object Symbol]",$v="[object Date]",kv="[object Map]",Uv="[object Set]",Nv="[object Array]",Bv="[object Function]",Mv="[object ArrayBuffer]",Bn="[object Object]",qv="[object Error]",zv="[object DataView]",jv="[object Uint8Array]",Kv="[object Uint8ClampedArray]",Fv="[object Uint16Array]",Wv="[object Uint32Array]",Hv="[object BigUint64Array]",Gv="[object Int8Array]",Jv="[object Int16Array]",Yv="[object Int32Array]",Zv="[object BigInt64Array]",Qv="[object Float32Array]",Xv="[object Float64Array]";function eb(){}function mc(i){if(!i||typeof i!="object")return!1;const t=Object.getPrototypeOf(i);return t===null||t===Object.prototype||Object.getPrototypeOf(t)===null?Object.prototype.toString.call(i)==="[object Object]":!1}function tb(i,t,e){return Ji(i,t,void 0,void 0,void 0,void 0,e)}function Ji(i,t,e,r,n,s,o){const c=o(i,t,e,r,n,s);if(c!==void 0)return c;if(typeof i==typeof t)switch(typeof i){case"bigint":case"string":case"boolean":case"symbol":case"undefined":return i===t;case"number":return i===t||Object.is(i,t);case"function":return i===t;case"object":return rr(i,t,s,o)}return rr(i,t,s,o)}function rr(i,t,e,r){if(Object.is(i,t))return!0;let n=_c(i),s=_c(t);if(n===fc&&(n=Bn),s===fc&&(s=Bn),n!==s)return!1;switch(n){case Vv:return i.toString()===t.toString();case xv:{const l=i.valueOf(),u=t.valueOf();return Lv(l,u)}case Sv:case $v:case Cv:return Object.is(i.valueOf(),t.valueOf());case Dv:return i.source===t.source&&i.flags===t.flags;case Bv:return i===t}e=e??new Map;const o=e.get(i),c=e.get(t);if(o!=null&&c!=null)return o===t;e.set(i,t),e.set(t,i);try{switch(n){case kv:{if(i.size!==t.size)return!1;for(const[l,u]of i.entries())if(!t.has(l)||!Ji(u,t.get(l),l,i,t,e,r))return!1;return!0}case Uv:{if(i.size!==t.size)return!1;const l=Array.from(i.values()),u=Array.from(t.values());for(let h=0;h<l.length;h++){const d=l[h],p=u.findIndex(_=>Ji(d,_,void 0,i,t,e,r));if(p===-1)return!1;u.splice(p,1)}return!0}case Nv:case jv:case Kv:case Fv:case Wv:case Hv:case Gv:case Jv:case Yv:case Zv:case Qv:case Xv:{if(typeof ee<"u"&&ee.isBuffer(i)!==ee.isBuffer(t)||i.length!==t.length)return!1;for(let l=0;l<i.length;l++)if(!Ji(i[l],t[l],l,i,t,e,r))return!1;return!0}case Mv:return i.byteLength!==t.byteLength?!1:rr(new Uint8Array(i),new Uint8Array(t),e,r);case zv:return i.byteLength!==t.byteLength||i.byteOffset!==t.byteOffset?!1:rr(new Uint8Array(i),new Uint8Array(t),e,r);case qv:return i.name===t.name&&i.message===t.message;case Bn:{if(!(rr(i.constructor,t.constructor,e,r)||mc(i)&&mc(t)))return!1;const l=[...Object.keys(i),...pc(i)],u=[...Object.keys(t),...pc(t)];if(l.length!==u.length)return!1;for(let h=0;h<l.length;h++){const d=l[h],p=i[d];if(!Object.hasOwn(t,d))return!1;const _=t[d];if(!Ji(p,_,d,i,t,e,r))return!1}return!0}default:return!1}}finally{e.delete(i),e.delete(t)}}function ib(i,t){return tb(i,t,eb)}var rb=Object.defineProperty,yc=Object.getOwnPropertySymbols,nb=Object.prototype.hasOwnProperty,sb=Object.prototype.propertyIsEnumerable,Rs=(i,t,e)=>t in i?rb(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,wc=(i,t)=>{for(var e in t||(t={}))nb.call(t,e)&&Rs(i,e,t[e]);if(yc)for(var e of yc(t))sb.call(t,e)&&Rs(i,e,t[e]);return i},$e=(i,t,e)=>Rs(i,typeof t!="symbol"?t+"":t,e);class pi extends Yp{constructor(t,e,r,n=wt,s=void 0){super(t,e,r,n),this.core=t,this.logger=e,this.name=r,$e(this,"map",new Map),$e(this,"version",aE),$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):hg(o)?this.map.set(o.id,o):dg(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=>ib(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=wc(wc({},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=n,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:n}=N("MISSING_OR_INVALID",`Record was recently deleted - ${this.name}: ${t}`);throw this.logger.error(n),new Error(n)}const{message:r}=N("NO_MATCHING_KEY",`${this.name}: ${t}`);throw this.logger.error(r),new Error(r)}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}=N("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}=N("NOT_INITIALIZED",this.name);throw new Error(t)}}}var ob=Object.defineProperty,ab=(i,t,e)=>t in i?ob(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,J=(i,t,e)=>ab(i,typeof t!="symbol"?t+"":t,e);class cb{constructor(t,e){this.core=t,this.logger=e,J(this,"name",hE),J(this,"version",dE),J(this,"events",new Wc),J(this,"pairings"),J(this,"initialized",!1),J(this,"storagePrefix",wt),J(this,"ignoredPayloadTypes",[Ot]),J(this,"registeredMethods",[]),J(this,"init",async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"))}),J(this,"register",({methods:r})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...r])]}),J(this,"create",async r=>{this.isInitialized();const n=ws(),s=await this.core.crypto.setSymKey(n),o=_e(B.FIVE_MINUTES),c={protocol:Cu},l={topic:s,expiry:o,relay:c,active:!1,methods:r==null?void 0:r.methods},u=ja({protocol:this.core.protocol,version:this.core.version,topic:s,symKey:n,relay:c,expiryTimestamp:o,methods:r==null?void 0:r.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:r==null?void 0:r.transportType,internal:r==null?void 0:r.internal}),{topic:s,uri:u}}),J(this,"pair",async r=>{this.isInitialized();const n=this.core.eventClient.createEvent({properties:{topic:r==null?void 0:r.uri,trace:[pt.pairing_started]}});this.isValidPair(r,n);const{topic:s,symKey:o,relay:c,expiryTimestamp:l,methods:u}=za(r.uri);n.props.properties.topic=s,n.addTrace(pt.pairing_uri_validation_success),n.addTrace(pt.pairing_uri_not_expired);let h;if(this.pairings.keys.includes(s)){if(h=this.pairings.get(s),n.addTrace(pt.existing_pairing),h.active)throw n.setError(At.active_pairing_already_exists),new Error(`Pairing already exists: ${s}. Please try again with a new connection URI.`);n.addTrace(pt.pairing_not_expired)}const d=l||_e(B.FIVE_MINUTES),p={topic:s,relay:c,expiry:d,active:!1,methods:u};this.core.expirer.set(s,d),await this.pairings.set(s,p),n.addTrace(pt.store_new_pairing),r.activatePairing&&await this.activate({topic:s}),this.events.emit(Qt.create,p),n.addTrace(pt.emit_inactive_pairing),this.core.crypto.keychain.has(s)||await this.core.crypto.setSymKey(o,s),n.addTrace(pt.subscribing_pairing_topic);try{await this.core.relayer.confirmOnlineStateOrThrow()}catch{n.setError(At.no_internet_connection)}try{await this.core.relayer.subscribe(s,{relay:c})}catch(_){throw n.setError(At.subscribe_pairing_topic_failure),_}return n.addTrace(pt.subscribe_pairing_topic_success),p}),J(this,"activate",async({topic:r})=>{this.isInitialized();const n=_e(B.FIVE_MINUTES);this.core.expirer.set(r,n),await this.pairings.update(r,{active:!0,expiry:n})}),J(this,"ping",async r=>{this.isInitialized(),await this.isValidPing(r),this.logger.warn("ping() is deprecated and will be removed in the next major release.");const{topic:n}=r;if(this.pairings.keys.includes(n)){const s=await this.sendRequest(n,"wc_pairingPing",{}),{done:o,resolve:c,reject:l}=Zt();this.events.once(te("pairing_ping",s),({error:u})=>{u?l(u):c()}),await o()}}),J(this,"updateExpiry",async({topic:r,expiry:n})=>{this.isInitialized(),await this.pairings.update(r,{expiry:n})}),J(this,"updateMetadata",async({topic:r,metadata:n})=>{this.isInitialized(),await this.pairings.update(r,{peerMetadata:n})}),J(this,"getPairings",()=>(this.isInitialized(),this.pairings.values)),J(this,"disconnect",async r=>{this.isInitialized(),await this.isValidDisconnect(r);const{topic:n}=r;this.pairings.keys.includes(n)&&(await this.sendRequest(n,"wc_pairingDelete",ae("USER_DISCONNECTED")),await this.deletePairing(n))}),J(this,"formatUriFromPairing",r=>{this.isInitialized();const{topic:n,relay:s,expiry:o,methods:c}=r,l=this.core.crypto.keychain.get(n);return ja({protocol:this.core.protocol,version:this.core.version,topic:n,symKey:l,relay:s,expiryTimestamp:o,methods:c})}),J(this,"sendRequest",async(r,n,s)=>{const o=Nt(n,s),c=await this.core.crypto.encode(r,o),l=qi[n].req;return this.core.history.set(r,o),this.core.relayer.publish(r,c,l),o.id}),J(this,"sendResult",async(r,n,s)=>{const o=Kr(r,s),c=await this.core.crypto.encode(n,o),l=(await this.core.history.get(n,r)).request.method,u=qi[l].res;await this.core.relayer.publish(n,c,u),await this.core.history.resolve(o)}),J(this,"sendError",async(r,n,s)=>{const o=Hc(r,s),c=await this.core.crypto.encode(n,o),l=(await this.core.history.get(n,r)).request.method,u=qi[l]?qi[l].res:qi.unregistered_method.res;await this.core.relayer.publish(n,c,u),await this.core.history.resolve(o)}),J(this,"deletePairing",async(r,n)=>{await this.core.relayer.unsubscribe(r),await Promise.all([this.pairings.delete(r,ae("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(r),n?Promise.resolve():this.core.expirer.del(r)])}),J(this,"cleanup",async()=>{const r=this.pairings.getAll().filter(n=>Bt(n.expiry));await Promise.all(r.map(n=>this.deletePairing(n.topic)))}),J(this,"onRelayEventRequest",async r=>{const{topic:n,payload:s}=r;switch(s.method){case"wc_pairingPing":return await this.onPairingPingRequest(n,s);case"wc_pairingDelete":return await this.onPairingDeleteRequest(n,s);default:return await this.onUnknownRpcMethodRequest(n,s)}}),J(this,"onRelayEventResponse",async r=>{const{topic:n,payload:s}=r,o=(await this.core.history.get(n,s.id)).request.method;switch(o){case"wc_pairingPing":return this.onPairingPingResponse(n,s);default:return this.onUnknownRpcMethodResponse(o)}}),J(this,"onPairingPingRequest",async(r,n)=>{const{id:s}=n;try{this.isValidPing({topic:r}),await this.sendResult(s,r,!0),this.events.emit(Qt.ping,{id:s,topic:r})}catch(o){await this.sendError(s,r,o),this.logger.error(o)}}),J(this,"onPairingPingResponse",(r,n)=>{const{id:s}=n;setTimeout(()=>{bt(n)?this.events.emit(te("pairing_ping",s),{}):_t(n)&&this.events.emit(te("pairing_ping",s),{error:n.error})},500)}),J(this,"onPairingDeleteRequest",async(r,n)=>{const{id:s}=n;try{this.isValidDisconnect({topic:r}),await this.deletePairing(r),this.events.emit(Qt.delete,{id:s,topic:r})}catch(o){await this.sendError(s,r,o),this.logger.error(o)}}),J(this,"onUnknownRpcMethodRequest",async(r,n)=>{const{id:s,method:o}=n;try{if(this.registeredMethods.includes(o))return;const c=ae("WC_METHOD_UNSUPPORTED",o);await this.sendError(s,r,c),this.logger.error(c)}catch(c){await this.sendError(s,r,c),this.logger.error(c)}}),J(this,"onUnknownRpcMethodResponse",r=>{this.registeredMethods.includes(r)||this.logger.error(ae("WC_METHOD_UNSUPPORTED",r))}),J(this,"isValidPair",(r,n)=>{var s;if(!Ue(r)){const{message:c}=N("MISSING_OR_INVALID",`pair() params: ${r}`);throw n.setError(At.malformed_pairing_uri),new Error(c)}if(!ug(r.uri)){const{message:c}=N("MISSING_OR_INVALID",`pair() uri: ${r.uri}`);throw n.setError(At.malformed_pairing_uri),new Error(c)}const o=za(r==null?void 0:r.uri);if(!((s=o==null?void 0:o.relay)!=null&&s.protocol)){const{message:c}=N("MISSING_OR_INVALID","pair() uri#relay-protocol");throw n.setError(At.malformed_pairing_uri),new Error(c)}if(!(o!=null&&o.symKey)){const{message:c}=N("MISSING_OR_INVALID","pair() uri#symKey");throw n.setError(At.malformed_pairing_uri),new Error(c)}if(o!=null&&o.expiryTimestamp&&B.toMiliseconds(o==null?void 0:o.expiryTimestamp)<Date.now()){n.setError(At.pairing_expired);const{message:c}=N("EXPIRED","pair() URI has expired. Please try again with a new connection URI.");throw new Error(c)}}),J(this,"isValidPing",async r=>{if(!Ue(r)){const{message:s}=N("MISSING_OR_INVALID",`ping() params: ${r}`);throw new Error(s)}const{topic:n}=r;await this.isValidPairingTopic(n)}),J(this,"isValidDisconnect",async r=>{if(!Ue(r)){const{message:s}=N("MISSING_OR_INVALID",`disconnect() params: ${r}`);throw new Error(s)}const{topic:n}=r;await this.isValidPairingTopic(n)}),J(this,"isValidPairingTopic",async r=>{if(!de(r,!1)){const{message:n}=N("MISSING_OR_INVALID",`pairing topic should be a string: ${r}`);throw new Error(n)}if(!this.pairings.keys.includes(r)){const{message:n}=N("NO_MATCHING_KEY",`pairing topic doesn't exist: ${r}`);throw new Error(n)}if(Bt(this.pairings.get(r).expiry)){await this.deletePairing(r);const{message:n}=N("EXPIRED",`pairing topic: ${r}`);throw new Error(n)}}),this.core=t,this.logger=Ce(e,this.name),this.pairings=new pi(this.core,this.logger,this.name,this.storagePrefix)}get context(){return Ke(this.logger)}isInitialized(){if(!this.initialized){const{message:t}=N("NOT_INITIALIZED",this.name);throw new Error(t)}}registerRelayerEvents(){this.core.relayer.on(le.message,async t=>{const{topic:e,message:r,transportType:n}=t;if(this.pairings.keys.includes(e)&&n!==se.link_mode&&!this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(r)))try{const s=await this.core.crypto.decode(e,r);zs(s)?(this.core.history.set(e,s),await this.onRelayEventRequest({topic:e,payload:s})):js(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,r)}catch(s){this.logger.error(s)}})}registerExpirerEvents(){this.core.expirer.on(Qe.expired,async t=>{const{topic:e}=Nl(t.target);e&&this.pairings.keys.includes(e)&&(await this.deletePairing(e,!0),this.events.emit(Qt.expire,{topic:e}))})}}var lb=Object.defineProperty,ub=(i,t,e)=>t in i?lb(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,be=(i,t,e)=>ub(i,typeof t!="symbol"?t+"":t,e);class hb extends Wp{constructor(t,e){super(t,e),this.core=t,this.logger=e,be(this,"records",new Map),be(this,"events",new ui.EventEmitter),be(this,"name",pE),be(this,"version",_E),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(r=>this.records.set(r.id,r)),this.cached=[],this.registerEventListeners(),this.initialized=!0)}),be(this,"set",(r,n,s)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:r,request:n,chainId:s}),this.records.has(n.id))return;const o={id:n.id,topic:r,request:{method:n.method,params:n.params||null},chainId:s,expiry:_e(B.THIRTY_DAYS)};this.records.set(o.id,o),this.persist(),this.events.emit(nt.created,o)}),be(this,"resolve",async r=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:r}),!this.records.has(r.id))return;const n=await this.getRecord(r.id);typeof n.response>"u"&&(n.response=_t(r)?{error:r.error}:{result:r.result},this.records.set(n.id,n),this.persist(),this.events.emit(nt.updated,n))}),be(this,"get",async(r,n)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:r,id:n}),await this.getRecord(n))),be(this,"delete",(r,n)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:n}),this.values.forEach(s=>{if(s.topic===r){if(typeof n<"u"&&s.id!==n)return;this.records.delete(s.id),this.events.emit(nt.deleted,s)}}),this.persist()}),be(this,"exists",async(r,n)=>(this.isInitialized(),this.records.has(n)?(await this.getRecord(n)).topic===r:!1)),be(this,"on",(r,n)=>{this.events.on(r,n)}),be(this,"once",(r,n)=>{this.events.once(r,n)}),be(this,"off",(r,n)=>{this.events.off(r,n)}),be(this,"removeListener",(r,n)=>{this.events.removeListener(r,n)}),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 r={topic:e.topic,request:Nt(e.request.method,e.request.params,e.id),chainId:e.chainId};return t.push(r)}),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:r}=N("NO_MATCHING_KEY",`${this.name}: ${t}`);throw new Error(r)}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}=N("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(Pi.pulse,()=>{this.cleanup()})}cleanup(){try{this.isInitialized();let t=!1;this.records.forEach(e=>{B.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}=N("NOT_INITIALIZED",this.name);throw new Error(t)}}}var db=Object.defineProperty,pb=(i,t,e)=>t in i?db(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Re=(i,t,e)=>pb(i,typeof t!="symbol"?t+"":t,e);class _b extends Qp{constructor(t,e){super(t,e),this.core=t,this.logger=e,Re(this,"expirations",new Map),Re(this,"events",new ui.EventEmitter),Re(this,"name",fE),Re(this,"version",mE),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(r=>this.expirations.set(r.target,r)),this.cached=[],this.registerEventListeners(),this.initialized=!0)}),Re(this,"has",r=>{try{const n=this.formatTarget(r);return typeof this.getExpiration(n)<"u"}catch{return!1}}),Re(this,"set",(r,n)=>{this.isInitialized();const s=this.formatTarget(r),o={target:s,expiry:n};this.expirations.set(s,o),this.checkExpiry(s,o),this.events.emit(Qe.created,{target:s,expiration:o})}),Re(this,"get",r=>{this.isInitialized();const n=this.formatTarget(r);return this.getExpiration(n)}),Re(this,"del",r=>{if(this.isInitialized(),this.has(r)){const n=this.formatTarget(r),s=this.getExpiration(n);this.expirations.delete(n),this.events.emit(Qe.deleted,{target:n,expiration:s})}}),Re(this,"on",(r,n)=>{this.events.on(r,n)}),Re(this,"once",(r,n)=>{this.events.once(r,n)}),Re(this,"off",(r,n)=>{this.events.off(r,n)}),Re(this,"removeListener",(r,n)=>{this.events.removeListener(r,n)}),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 Hf(t);if(typeof t=="number")return Gf(t);const{message:e}=N("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(Qe.sync)}async restore(){try{const t=await this.getExpirations();if(typeof t>"u"||!t.length)return;if(this.expirations.size){const{message:e}=N("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:r}=N("NO_MATCHING_KEY",`${this.name}: ${t}`);throw this.logger.warn(r),new Error(r)}return e}checkExpiry(t,e){const{expiry:r}=e;B.toMiliseconds(r)-Date.now()<=0&&this.expire(t,e)}expire(t,e){this.expirations.delete(t),this.events.emit(Qe.expired,{target:t,expiration:e})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((t,e)=>this.checkExpiry(e,t))}registerEventListeners(){this.core.heartbeat.on(Pi.pulse,()=>this.checkExpirations()),this.events.on(Qe.created,t=>{const e=Qe.created;this.logger.info(`Emitting ${e}`),this.logger.debug({type:"event",event:e,data:t}),this.persist()}),this.events.on(Qe.expired,t=>{const e=Qe.expired;this.logger.info(`Emitting ${e}`),this.logger.debug({type:"event",event:e,data:t}),this.persist()}),this.events.on(Qe.deleted,t=>{const e=Qe.deleted;this.logger.info(`Emitting ${e}`),this.logger.debug({type:"event",event:e,data:t}),this.persist()})}isInitialized(){if(!this.initialized){const{message:t}=N("NOT_INITIALIZED",this.name);throw new Error(t)}}}var fb=Object.defineProperty,mb=(i,t,e)=>t in i?fb(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,he=(i,t,e)=>mb(i,typeof t!="symbol"?t+"":t,e);class yb extends Xp{constructor(t,e,r){super(t,e,r),this.core=t,this.logger=e,this.store=r,he(this,"name",yE),he(this,"abortController"),he(this,"isDevEnv"),he(this,"verifyUrlV3",gE),he(this,"storagePrefix",wt),he(this,"version",Su),he(this,"publicKey"),he(this,"fetchPromise"),he(this,"init",async()=>{var n;this.isDevEnv||(this.publicKey=await this.store.getItem(this.storeKey),this.publicKey&&B.toMiliseconds((n=this.publicKey)==null?void 0:n.expiresAt)<Date.now()&&(this.logger.debug("verify v2 public key expired"),await this.removePublicKey()))}),he(this,"register",async n=>{if(!Di()||this.isDevEnv)return;const s=window.location.origin,{id:o,decryptedId:c}=n,l=`${this.verifyUrlV3}/attestation?projectId=${this.core.projectId}&origin=${s}&id=${o}&decryptedId=${c}`;try{const u=Rt.getDocument(),h=this.startAbortTimer(B.ONE_SECOND*5),d=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 R=JSON.parse(b.data);if(R.type==="verify_attestation"){if(Yn(R.attestation).payload.id!==o)return;clearInterval(h),u.body.removeChild(m),this.abortController.signal.removeEventListener("abort",f),window.removeEventListener("message",y),p(R.attestation===null?"":R.attestation)}}catch(R){this.logger.warn(R)}};u.body.appendChild(m),window.addEventListener("message",y,{signal:this.abortController.signal})});return this.logger.debug("jwt attestation",d),d}catch(u){this.logger.warn(u)}return""}),he(this,"resolve",async n=>{if(this.isDevEnv)return"";const{attestationId:s,hash:o,encryptedId:c}=n;if(s===""){this.logger.debug("resolve: attestationId is empty, skipping");return}if(s){if(Yn(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(n==null?void 0:n.verifyUrl);return this.fetchAttestation(o,l)}),he(this,"fetchAttestation",async(n,s)=>{this.logger.debug(`resolving attestation: ${n} from url: ${s}`);const o=this.startAbortTimer(B.ONE_SECOND*5),c=await fetch(`${s}/attestation/${n}?v2Supported=true`,{signal:this.abortController.signal});return clearTimeout(o),c.status===200?await c.json():void 0}),he(this,"getVerifyUrl",n=>{let s=n||ir;return EE.includes(s)||(this.logger.info(`verify url: ${s}, not included in trusted list, assigning default: ${ir}`),s=ir),s}),he(this,"fetchPublicKey",async()=>{try{this.logger.debug(`fetching public key from: ${this.verifyUrlV3}`);const n=this.startAbortTimer(B.FIVE_SECONDS),s=await fetch(`${this.verifyUrlV3}/public-key`,{signal:this.abortController.signal});return clearTimeout(n),await s.json()}catch(n){this.logger.warn(n)}}),he(this,"persistPublicKey",async n=>{this.logger.debug("persisting public key to local storage",n),await this.store.setItem(this.storeKey,n),this.publicKey=n}),he(this,"removePublicKey",async()=>{this.logger.debug("removing verify v2 public key from storage"),await this.store.removeItem(this.storeKey),this.publicKey=void 0}),he(this,"isValidJwtAttestation",async n=>{const s=await this.getPublicKey();try{if(s)return this.validateAttestation(n,s)}catch(c){this.logger.error(c),this.logger.warn("error validating attestation")}const o=await this.fetchAndPersistPublicKey();try{if(o)return this.validateAttestation(n,o)}catch(c){this.logger.error(c),this.logger.warn("error validating attestation")}}),he(this,"getPublicKey",async()=>this.publicKey?this.publicKey:await this.fetchAndPersistPublicKey()),he(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 n=await this.fetchPromise;return this.fetchPromise=void 0,n}),he(this,"validateAttestation",(n,s)=>{const o=zw(n,s.publicKey),c={hasExpired:B.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=so(),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(),B.toMiliseconds(t))}}var wb=Object.defineProperty,gb=(i,t,e)=>t in i?wb(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,gc=(i,t,e)=>gb(i,typeof t!="symbol"?t+"":t,e);class Eb extends e_{constructor(t,e){super(t,e),this.projectId=t,this.logger=e,gc(this,"context",vE),gc(this,"registerDeviceToken",async r=>{const{clientId:n,token:s,notificationType:o,enableEncrypted:c=!1}=r,l=`${bE}/${this.projectId}/clients`;await fetch(l,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:n,type:o,token:s,always_raw:c})})}),this.logger=Ce(e,this.context)}}var vb=Object.defineProperty,Ec=Object.getOwnPropertySymbols,bb=Object.prototype.hasOwnProperty,Ib=Object.prototype.propertyIsEnumerable,Ls=(i,t,e)=>t in i?vb(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Fi=(i,t)=>{for(var e in t||(t={}))bb.call(t,e)&&Ls(i,e,t[e]);if(Ec)for(var e of Ec(t))Ib.call(t,e)&&Ls(i,e,t[e]);return i},me=(i,t,e)=>Ls(i,typeof t!="symbol"?t+"":t,e);class Ab extends t_{constructor(t,e,r=!0){super(t,e,r),this.core=t,this.logger=e,me(this,"context",AE),me(this,"storagePrefix",wt),me(this,"storageVersion",IE),me(this,"events",new Map),me(this,"shouldPersist",!1),me(this,"init",async()=>{if(!so())try{const n={eventId:ua(),timestamp:Date.now(),domain:this.getAppDomain(),props:{event:"INIT",type:"",properties:{client_id:await this.core.crypto.getClientId(),user_agent:kl(this.core.relayer.protocol,this.core.relayer.version,vs)}}};await this.sendEvent([n])}catch(n){this.logger.warn(n)}}),me(this,"createEvent",n=>{const{event:s="ERROR",type:o="",properties:{topic:c,trace:l}}=n,u=ua(),h=this.core.projectId||"",d=Date.now(),p=Fi({eventId:u,timestamp:d,props:{event:s,type:o,properties:{topic:c,trace:l}},bundleId:h,domain:this.getAppDomain()},this.setMethods(u));return this.telemetryEnabled&&(this.events.set(u,p),this.shouldPersist=!0),p}),me(this,"getEvent",n=>{const{eventId:s,topic:o}=n;if(s)return this.events.get(s);const c=Array.from(this.events.values()).find(l=>l.props.properties.topic===o);if(c)return Fi(Fi({},c),this.setMethods(c.eventId))}),me(this,"deleteEvent",n=>{const{eventId:s}=n;this.events.delete(s),this.shouldPersist=!0}),me(this,"setEventListeners",()=>{this.core.heartbeat.on(Pi.pulse,async()=>{this.shouldPersist&&await this.persist(),this.events.forEach(n=>{B.fromMiliseconds(Date.now())-B.fromMiliseconds(n.timestamp)>TE&&(this.events.delete(n.eventId),this.shouldPersist=!0)})})}),me(this,"setMethods",n=>({addTrace:s=>this.addTrace(n,s),setError:s=>this.setError(n,s)})),me(this,"addTrace",(n,s)=>{const o=this.events.get(n);o&&(o.props.properties.trace.push(s),this.events.set(n,o),this.shouldPersist=!0)}),me(this,"setError",(n,s)=>{const o=this.events.get(n);o&&(o.props.type=s,o.timestamp=Date.now(),this.events.set(n,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 n=await this.core.storage.getItem(this.storageKey)||[];if(!n.length)return;n.forEach(s=>{this.events.set(s.eventId,Fi(Fi({},s),this.setMethods(s.eventId)))})}catch(n){this.logger.warn(n)}}),me(this,"submit",async()=>{if(!this.telemetryEnabled||this.events.size===0)return;const n=[];for(const[s,o]of this.events)o.props.type&&n.push(o);if(n.length!==0)try{if((await this.sendEvent(n)).ok)for(const s of n)this.events.delete(s.eventId),this.shouldPersist=!0}catch(s){this.logger.warn(s)}}),me(this,"sendEvent",async n=>{const s=this.getAppDomain()?"":"&sp=desktop";return await fetch(`${PE}?projectId=${this.core.projectId}&st=events_sdk&sv=js-${vs}${s}`,{method:"POST",body:JSON.stringify(n)})}),me(this,"getAppDomain",()=>$l().url),this.logger=Ce(e,this.context),this.telemetryEnabled=r,r?this.restore().then(async()=>{await this.submit(),this.setEventListeners()}):this.persist()}get storageKey(){return this.storagePrefix+this.storageVersion+this.core.customStoragePrefix+"//"+this.context}}var Tb=Object.defineProperty,vc=Object.getOwnPropertySymbols,Pb=Object.prototype.hasOwnProperty,Ob=Object.prototype.propertyIsEnumerable,Ds=(i,t,e)=>t in i?Tb(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,bc=(i,t)=>{for(var e in t||(t={}))Pb.call(t,e)&&Ds(i,e,t[e]);if(vc)for(var e of vc(t))Ob.call(t,e)&&Ds(i,e,t[e]);return i},ne=(i,t,e)=>Ds(i,typeof t!="symbol"?t+"":t,e);class Eo extends zp{constructor(t){var e;super(t),ne(this,"protocol",xu),ne(this,"version",Su),ne(this,"name",Es),ne(this,"relayUrl"),ne(this,"projectId"),ne(this,"customStoragePrefix"),ne(this,"events",new ui.EventEmitter),ne(this,"logger"),ne(this,"heartbeat"),ne(this,"relayer"),ne(this,"crypto"),ne(this,"storage"),ne(this,"history"),ne(this,"expirer"),ne(this,"pairing"),ne(this,"verify"),ne(this,"echoClient"),ne(this,"linkModeSupportedApps"),ne(this,"eventClient"),ne(this,"initialized",!1),ne(this,"logChunkController"),ne(this,"on",(c,l)=>this.events.on(c,l)),ne(this,"once",(c,l)=>this.events.once(c,l)),ne(this,"off",(c,l)=>this.events.off(c,l)),ne(this,"removeListener",(c,l)=>this.events.removeListener(c,l)),ne(this,"dispatchEnvelope",({topic:c,message:l,sessionExists:u})=>{if(!c||!l)return;const h={topic:c,message:l,publishedAt:Date.now(),transportType:se.link_mode};this.relayer.onLinkMessageEvent(h,{sessionExists:u})});const r=this.getGlobalCore(t==null?void 0:t.customStoragePrefix);if(r)try{return this.customStoragePrefix=r.customStoragePrefix,this.logger=r.logger,this.heartbeat=r.heartbeat,this.crypto=r.crypto,this.history=r.history,this.expirer=r.expirer,this.storage=r.storage,this.relayer=r.relayer,this.pairing=r.pairing,this.verify=r.verify,this.echoClient=r.echoClient,this.linkModeSupportedApps=r.linkModeSupportedApps,this.eventClient=r.eventClient,this.initialized=r.initialized,this.logChunkController=r.logChunkController,r}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)||$u,this.customStoragePrefix=t!=null&&t.customStoragePrefix?`:${t.customStoragePrefix}`:"";const n=eo({level:typeof(t==null?void 0:t.logger)=="string"&&t.logger?t.logger:Hg.logger,name:Es}),{logger:s,chunkLoggerController:o}=Bp({opts:n,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 id,this.crypto=new tv(this,this.logger,t==null?void 0:t.keychain),this.history=new hb(this,this.logger),this.expirer=new _b(this,this.logger),this.storage=t!=null&&t.storage?t.storage:new bp(bc(bc({},Gg),t==null?void 0:t.storageOptions)),this.relayer=new Rv({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new cb(this,this.logger),this.verify=new yb(this,this.logger,this.storage),this.echoClient=new Eb(this.projectId||"",this.logger),this.linkModeSupportedApps=[],this.eventClient=new Ab(this,this.logger,t==null?void 0:t.telemetryEnabled),this.setGlobalCore(this)}static async init(t){const e=new Eo(t);await e.initialize();const r=await e.crypto.getClientId();return await e.storage.setItem(cE,r),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(ec,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(ec)||[],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}`,r=`${e}_count`;return globalThis[r]=(globalThis[r]||0)+1,globalThis[r]>1&&console.warn(`WalletConnect Core is already initialized. This is probably a mistake and can lead to unexpected behavior. Init() was called ${globalThis[r]} 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 r=`_walletConnectCore_${((e=t.opts)==null?void 0:e.customStoragePrefix)||""}`;globalThis[r]=t}catch(r){console.warn("Failed to set global WalletConnect core",r)}}isGlobalCoreDisabled(){try{return typeof Kt<"u"&&Wg.DISABLE_GLOBAL_CORE==="true"}catch{return!0}}}const Rb=Eo,Gu="wc",Ju=2,Yu="client",vo=`${Gu}@${Ju}:${Yu}:`,Mn={name:Yu,logger:"error"},Ic="WALLETCONNECT_DEEPLINK_CHOICE",Lb="proposal",Ac="Proposal expired",Db="session",gi=B.SEVEN_DAYS,Vb="engine",Ie={wc_sessionPropose:{req:{ttl:B.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:B.FIVE_MINUTES,prompt:!1,tag:1101},reject:{ttl:B.FIVE_MINUTES,prompt:!1,tag:1120},autoReject:{ttl:B.FIVE_MINUTES,prompt:!1,tag:1121}},wc_sessionSettle:{req:{ttl:B.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:B.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:B.ONE_DAY,prompt:!1,tag:1104},res:{ttl:B.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:B.ONE_DAY,prompt:!1,tag:1106},res:{ttl:B.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:B.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:B.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:B.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:B.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:B.ONE_DAY,prompt:!1,tag:1112},res:{ttl:B.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:B.ONE_DAY,prompt:!1,tag:1114},res:{ttl:B.ONE_DAY,prompt:!1,tag:1115}},wc_sessionAuthenticate:{req:{ttl:B.ONE_HOUR,prompt:!0,tag:1116},res:{ttl:B.ONE_HOUR,prompt:!1,tag:1117},reject:{ttl:B.FIVE_MINUTES,prompt:!1,tag:1118},autoReject:{ttl:B.FIVE_MINUTES,prompt:!1,tag:1119}}},qn={min:B.FIVE_MINUTES,max:B.SEVEN_DAYS},dt={idle:"IDLE",active:"ACTIVE"},xb={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:""}},Sb="request",Cb=["wc_sessionPropose","wc_sessionRequest","wc_authRequest","wc_sessionAuthenticate"],$b="wc",kb="auth",Ub="authKeys",Nb="pairingTopics",Bb="requests",fn=`${$b}@${1.5}:${kb}:`,Mr=`${fn}:PUB_KEY`;var Mb=Object.defineProperty,qb=Object.defineProperties,zb=Object.getOwnPropertyDescriptors,Tc=Object.getOwnPropertySymbols,jb=Object.prototype.hasOwnProperty,Kb=Object.prototype.propertyIsEnumerable,Vs=(i,t,e)=>t in i?Mb(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,ie=(i,t)=>{for(var e in t||(t={}))jb.call(t,e)&&Vs(i,e,t[e]);if(Tc)for(var e of Tc(t))Kb.call(t,e)&&Vs(i,e,t[e]);return i},Le=(i,t)=>qb(i,zb(t)),S=(i,t,e)=>Vs(i,typeof t!="symbol"?t+"":t,e);class Fb extends s_{constructor(t){super(t),S(this,"name",Vb),S(this,"events",new Wc),S(this,"initialized",!1),S(this,"requestQueue",{state:dt.idle,queue:[]}),S(this,"sessionRequestQueue",{state:dt.idle,queue:[]}),S(this,"emittedSessionRequests",new rm({limit:500})),S(this,"requestQueueDelay",B.ONE_SECOND),S(this,"expectedPairingMethodMap",new Map),S(this,"recentlyDeletedMap",new Map),S(this,"recentlyDeletedLimit",200),S(this,"relayMessageCache",[]),S(this,"pendingSessions",new Map),S(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()},B.toMiliseconds(this.requestQueueDelay)))}),S(this,"connect",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();const r=Le(ie({},e),{requiredNamespaces:e.requiredNamespaces||{},optionalNamespaces:e.optionalNamespaces||{}});await this.isValidConnect(r),r.optionalNamespaces=sg(r.requiredNamespaces,r.optionalNamespaces),r.requiredNamespaces={};const{pairingTopic:n,requiredNamespaces:s,optionalNamespaces:o,sessionProperties:c,scopedProperties:l,relays:u}=r;let h=n,d,p=!1;try{if(h){const g=this.client.core.pairing.pairings.get(h);this.client.logger.warn("connect() with existing pairing topic is deprecated and will be removed in the next major release."),p=g.active}}catch(g){throw this.client.logger.error(`connect() -> pairing.get(${h}) failed`),g}if(!h||!p){const{topic:g,uri:D}=await this.client.core.pairing.create({internal:{skipSubscribe:!0}});h=g,d=D}if(!h){const{message:g}=N("NO_MATCHING_KEY",`connect() pairing topic: ${h}`);throw new Error(g)}const _=await this.client.core.crypto.generateKeyPair(),f=Ie.wc_sessionPropose.req.ttl||B.FIVE_MINUTES,m=_e(f),y=Le(ie(ie({requiredNamespaces:s,optionalNamespaces:o,relays:u??[{protocol:Cu}],proposer:{publicKey:_,metadata:this.client.metadata},expiryTimestamp:m,pairingTopic:h},c&&{sessionProperties:c}),l&&{scopedProperties:l}),{id:Dt()}),b=te("session_connect",y.id),{reject:R,resolve:v,done:P}=Zt(f,Ac),T=({id:g})=>{g===y.id&&(this.client.events.off("proposal_expire",T),this.pendingSessions.delete(y.id),this.events.emit(b,{error:{message:Ac,code:0}}))};return this.client.events.on("proposal_expire",T),this.events.once(b,({error:g,session:D})=>{this.client.events.off("proposal_expire",T),g?R(g):D&&v(D)}),await this.sendProposeSession({proposal:y,publishOpts:{internal:{throwOnFailedPublish:!0},tvf:{correlationId:y.id}}}),await this.setProposal(y.id,y),{uri:d,approval:P}}),S(this,"pair",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{return await this.client.core.pairing.pair(e)}catch(r){throw this.client.logger.error("pair() failed"),r}}),S(this,"approve",async e=>{var r,n,s;const o=this.client.core.eventClient.createEvent({properties:{topic:(r=e==null?void 0:e.id)==null?void 0:r.toString(),trace:[Ut.session_approve_started]}});try{this.isInitialized(),await this.confirmOnlineStateOrThrow()}catch(w){throw o.setError(zi.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(zi.proposal_not_found),w}try{await this.isValidApprove(e)}catch(w){throw this.client.logger.error("approve() -> isValidApprove() failed"),o.setError(zi.session_approve_namespace_validation_failure),w}const{id:c,relayProtocol:l,namespaces:u,sessionProperties:h,scopedProperties:d,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 R=(n=this.client.core.eventClient)==null?void 0:n.getEvent({topic:f});R||(R=(s=this.client.core.eventClient)==null?void 0:s.createEvent({type:Ut.session_approve_started,properties:{topic:f,trace:[Ut.session_approve_started,Ut.session_namespaces_validation_success]}}));const v=await this.client.core.crypto.generateKeyPair(),P=m.publicKey,T=await this.client.core.crypto.generateSharedKey(v,P),g=ie(ie(ie({relay:{protocol:l??"irn"},namespaces:u,controller:{publicKey:v,metadata:this.client.metadata},expiry:_e(gi)},h&&{sessionProperties:h}),d&&{scopedProperties:d}),p&&{sessionConfig:p}),D=se.relay;R.addTrace(Ut.subscribing_session_topic);try{await this.client.core.relayer.subscribe(T,{transportType:D,internal:{skipSubscribe:!0}})}catch(w){throw R.setError(zi.subscribe_session_topic_failure),w}R.addTrace(Ut.subscribe_session_topic_success);const L=Le(ie({},g),{topic:T,requiredNamespaces:y,optionalNamespaces:b,pairingTopic:f,acknowledged:!1,self:g.controller,peer:{publicKey:m.publicKey,metadata:m.metadata},controller:v,transportType:se.relay});await this.client.session.set(T,L),R.addTrace(Ut.store_session);try{await this.sendApproveSession({sessionTopic:T,proposal:_,pairingProposalResponse:{relay:{protocol:l??"irn"},responderPublicKey:v},sessionSettleRequest:g,publishOpts:{internal:{throwOnFailedPublish:!0},tvf:{correlationId:c}}}),R.addTrace(Ut.session_approve_publish_success)}catch(w){throw this.client.logger.error(w),this.client.session.delete(T,ae("USER_DISCONNECTED")),await this.client.core.relayer.unsubscribe(T),w}return this.client.core.eventClient.deleteEvent({eventId:R.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(T,_e(gi)),{topic:T,acknowledged:()=>Promise.resolve(this.client.session.get(T))}}),S(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:r,reason:n}=e;let s;try{s=this.client.proposal.get(r).pairingTopic}catch(o){throw this.client.logger.error(`reject() -> proposal.get(${r}) failed`),o}s&&await this.sendError({id:r,topic:s,error:n,rpcOpts:Ie.wc_sessionPropose.reject}),await this.deleteProposal(r)}),S(this,"update",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidUpdate(e)}catch(d){throw this.client.logger.error("update() -> isValidUpdate() failed"),d}const{topic:r,namespaces:n}=e,{done:s,resolve:o,reject:c}=Zt(),l=Dt(),u=Xt().toString(),h=this.client.session.get(r).namespaces;return this.events.once(te("session_update",l),({error:d})=>{d?c(d):o()}),await this.client.session.update(r,{namespaces:n}),await this.sendRequest({topic:r,method:"wc_sessionUpdate",params:{namespaces:n},throwOnFailedPublish:!0,clientRpcId:l,relayRpcId:u}).catch(d=>{this.client.logger.error(d),this.client.session.update(r,{namespaces:h}),c(d)}),{acknowledged:s}}),S(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:r}=e,n=Dt(),{done:s,resolve:o,reject:c}=Zt();return this.events.once(te("session_extend",n),({error:l})=>{l?c(l):o()}),await this.setExpiry(r,_e(gi)),this.sendRequest({topic:r,method:"wc_sessionExtend",params:{},clientRpcId:n,throwOnFailedPublish:!0}).catch(l=>{c(l)}),{acknowledged:s}}),S(this,"request",async e=>{this.isInitialized();try{await this.isValidRequest(e)}catch(y){throw this.client.logger.error("request() -> isValidRequest() failed"),y}const{chainId:r,request:n,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:h,resolve:d,reject:p}=Zt(o,"Request expired. Please try again.");this.events.once(te("session_request",l),({error:y,result:b})=>{y?p(y):d(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(ie({},n),{expiryTimestamp:_e(o)}),chainId:r},expiry:o,throwOnFailedPublish:!0,appLink:f}).catch(y=>p(y)),this.client.events.emit("session_request_sent",{topic:s,request:n,chainId:r,id:l}),await h();const m={request:Le(ie({},n),{expiryTimestamp:_e(o)}),chainId:r};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:n,chainId:r,id:l}),y()}),new Promise(async y=>{var b;if(!((b=c.sessionConfig)!=null&&b.disableDeepLink)){const R=await Qf(this.client.core.storage,Ic);await Jf({id:l,topic:s,wcDeepLink:R})}y()}),h()]).then(y=>y[2])}),S(this,"respond",async e=>{this.isInitialized(),await this.isValidRespond(e);const{topic:r,response:n}=e,{id:s}=n,o=this.client.session.get(r);o.transportType===se.relay&&await this.confirmOnlineStateOrThrow();const c=this.getAppLinkIfEnabled(o.peer.metadata,o.transportType);bt(n)?await this.sendResult({id:s,topic:r,result:n.result,throwOnFailedPublish:!0,appLink:c}):_t(n)&&await this.sendError({id:s,topic:r,error:n.error,appLink:c}),this.cleanupAfterResponse(e)}),S(this,"ping",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidPing(e)}catch(n){throw this.client.logger.error("ping() -> isValidPing() failed"),n}const{topic:r}=e;if(this.client.session.keys.includes(r)){const n=Dt(),s=Xt().toString(),{done:o,resolve:c,reject:l}=Zt();this.events.once(te("session_ping",n),({error:u})=>{u?l(u):c()}),await Promise.all([this.sendRequest({topic:r,method:"wc_sessionPing",params:{},throwOnFailedPublish:!0,clientRpcId:n,relayRpcId:s}),o()])}else this.client.core.pairing.pairings.keys.includes(r)&&(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:r}))}),S(this,"emit",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidEmit(e);const{topic:r,event:n,chainId:s}=e,o=Xt().toString(),c=Dt();await this.sendRequest({topic:r,method:"wc_sessionEvent",params:{event:n,chainId:s},throwOnFailedPublish:!0,relayRpcId:o,clientRpcId:c})}),S(this,"disconnect",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidDisconnect(e);const{topic:r}=e;if(this.client.session.keys.includes(r))await this.sendRequest({topic:r,method:"wc_sessionDelete",params:ae("USER_DISCONNECTED"),throwOnFailedPublish:!0}),await this.deleteSession({topic:r,emitEvent:!1});else if(this.client.core.pairing.pairings.keys.includes(r))await this.client.core.pairing.disconnect({topic:r});else{const{message:n}=N("MISMATCHED_TOPIC",`Session or pairing topic not found: ${r}`);throw new Error(n)}}),S(this,"find",e=>(this.isInitialized(),this.client.session.getAll().filter(r=>cg(r,e)))),S(this,"getPendingSessionRequests",()=>this.client.pendingRequest.getAll()),S(this,"authenticate",async(e,r)=>{var n;this.isInitialized(),this.isValidAuthenticate(e);const s=r&&this.client.core.linkModeSupportedApps.includes(r)&&((n=this.client.metadata.redirect)==null?void 0:n.linkMode),o=s?se.link_mode:se.relay;o===se.relay&&await this.confirmOnlineStateOrThrow();const{chains:c,statement:l="",uri:u,domain:h,nonce:d,type:p,exp:_,nbf:f,methods:m=[],expiry:y}=e,b=[...e.resources||[]],{topic:R,uri:v}=await this.client.core.pairing.create({methods:["wc_sessionAuthenticate"],transportType:o});this.client.logger.info({message:"Generated new pairing",pairing:{topic:R,uri:v}});const P=await this.client.core.crypto.generateKeyPair(),T=Nr(P);if(await Promise.all([this.client.auth.authKeys.set(Mr,{responseTopic:T,publicKey:P}),this.client.auth.pairingTopics.set(T,{topic:T,pairingTopic:R})]),await this.client.core.relayer.subscribe(T,{transportType:o}),this.client.logger.info(`sending request to new pairing topic: ${R}`),m.length>0){const{namespace:C}=kr(c[0]);let U=_y(C,"request",m);Ur(b)&&(U=my(U,b.pop())),b.push(U)}const g=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:h,version:"1",nonce:d,iat:new Date().toISOString(),exp:_,nbf:f,resources:b},requester:{publicKey:P,metadata:this.client.metadata},expiryTimestamp:_e(g)},L={eip155:{chains:c,methods:[...new Set(["personal_sign",...m])],events:["chainChanged","accountsChanged"]}},w={requiredNamespaces:{},optionalNamespaces:L,relays:[{protocol:"irn"}],pairingTopic:R,proposer:{publicKey:P,metadata:this.client.metadata},expiryTimestamp:_e(Ie.wc_sessionPropose.req.ttl),id:Dt()},{done:E,resolve:I,reject:A}=Zt(g,"Request expired"),V=Dt(),O=te("session_connect",w.id),x=te("session_request",V),$=async({error:C,session:U})=>{this.events.off(x,k),C?A(C):U&&I({session:U})},k=async C=>{var U,z,j;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(O,$),A(C.error.message))}await this.deleteProposal(w.id),this.events.off(O,$);const{cacaos:F,responder:W}=C.result,H=[],G=[];for(const oe of F){await va({cacao:oe,projectId:this.client.core.projectId})||(this.client.logger.error(oe,"Signature verification failed"),A(ae("SESSION_SETTLEMENT_FAILED","Signature verification failed")));const{p:Je}=oe,gt=Ur(Je.resources),To=[ls(Je.iss)],ch=Qr(Je.iss);if(gt){const yn=ba(gt),lh=Ia(gt);H.push(...yn),To.push(...lh)}for(const yn of To)G.push(`${yn}:${ch}`)}const ue=await this.client.core.crypto.generateSharedKey(P,W.publicKey);let ce;H.length>0&&(ce={topic:ue,acknowledged:!0,self:{publicKey:P,metadata:this.client.metadata},peer:W,controller:W.publicKey,expiry:_e(gi),requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:R,namespaces:Ha([...new Set(H)],[...new Set(G)]),transportType:o},await this.client.core.relayer.subscribe(ue,{transportType:o}),await this.client.session.set(ue,ce),R&&await this.client.core.pairing.updateMetadata({topic:R,metadata:W.metadata}),ce=this.client.session.get(ue)),(U=this.client.metadata.redirect)!=null&&U.linkMode&&(z=W.metadata.redirect)!=null&&z.linkMode&&(j=W.metadata.redirect)!=null&&j.universal&&r&&(this.client.core.addLinkModeSupportedApp(W.metadata.redirect.universal),this.client.session.update(ue,{transportType:se.link_mode})),I({auths:F,session:ce})};this.events.once(O,$),this.events.once(x,k);let M;try{if(s){const C=Nt("wc_sessionAuthenticate",D,V);this.client.core.history.set(R,C);const U=await this.client.core.crypto.encode("",C,{type:Er,encoding:jt});M=xr(r,R,U)}else await Promise.all([this.sendRequest({topic:R,method:"wc_sessionAuthenticate",params:D,expiry:e.expiry,throwOnFailedPublish:!0,clientRpcId:V}),this.sendRequest({topic:R,method:"wc_sessionPropose",params:w,expiry:Ie.wc_sessionPropose.req.ttl,throwOnFailedPublish:!0,clientRpcId:w.id})])}catch(C){throw this.events.off(O,$),this.events.off(x,k),C}return await this.setProposal(w.id,w),await this.setAuthRequest(V,{request:Le(ie({},D),{verifyContext:{}}),pairingTopic:R,transportType:o}),{uri:M??v,response:E}}),S(this,"approveSessionAuthenticate",async e=>{const{id:r,auths:n}=e,s=this.client.core.eventClient.createEvent({properties:{topic:r.toString(),trace:[Yt.authenticated_session_approve_started]}});try{this.isInitialized()}catch(y){throw s.setError(ji.no_internet_connection),y}const o=this.getPendingAuthRequest(r);if(!o)throw s.setError(ji.authenticated_session_pending_request_not_found),new Error(`Could not find pending auth request with id ${r}`);const c=o.transportType||se.relay;c===se.relay&&await this.confirmOnlineStateOrThrow();const l=o.requester.publicKey,u=await this.client.core.crypto.generateKeyPair(),h=Nr(l),d={type:Ot,receiverPublicKey:l,senderPublicKey:u},p=[],_=[];for(const y of n){if(!await va({cacao:y,projectId:this.client.core.projectId})){s.setError(ji.invalid_cacao);const T=ae("SESSION_SETTLEMENT_FAILED","Signature verification failed");throw await this.sendError({id:r,topic:h,error:T,encodeOpts:d}),new Error(T.message)}s.addTrace(Yt.cacaos_verified);const{p:b}=y,R=Ur(b.resources),v=[ls(b.iss)],P=Qr(b.iss);if(R){const T=ba(R),g=Ia(R);p.push(...T),v.push(...g)}for(const T of v)_.push(`${T}:${P}`)}const f=await this.client.core.crypto.generateSharedKey(u,l);s.addTrace(Yt.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(gi),authentication:n,requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:o.pairingTopic,namespaces:Ha([...new Set(p)],[...new Set(_)]),transportType:c},s.addTrace(Yt.subscribing_authenticated_session_topic);try{await this.client.core.relayer.subscribe(f,{transportType:c})}catch(y){throw s.setError(ji.subscribe_authenticated_session_topic_failure),y}s.addTrace(Yt.subscribe_authenticated_session_topic_success),await this.client.session.set(f,m),s.addTrace(Yt.store_authenticated_session),await this.client.core.pairing.updateMetadata({topic:o.pairingTopic,metadata:o.requester.metadata})}s.addTrace(Yt.publishing_authenticated_session_approve);try{await this.sendResult({topic:h,id:r,result:{cacaos:n,responder:{publicKey:u,metadata:this.client.metadata}},encodeOpts:d,throwOnFailedPublish:!0,appLink:this.getAppLinkIfEnabled(o.requester.metadata,c)})}catch(y){throw s.setError(ji.authenticated_session_approve_publish_failure),y}return await this.client.auth.requests.delete(r,{message:"fulfilled",code:0}),await this.client.core.pairing.activate({topic:o.pairingTopic}),this.client.core.eventClient.deleteEvent({eventId:s.eventId}),{session:m}}),S(this,"rejectSessionAuthenticate",async e=>{this.isInitialized();const{id:r,reason:n}=e,s=this.getPendingAuthRequest(r);if(!s)throw new Error(`Could not find pending auth request with id ${r}`);s.transportType===se.relay&&await this.confirmOnlineStateOrThrow();const o=s.requester.publicKey,c=await this.client.core.crypto.generateKeyPair(),l=Nr(o),u={type:Ot,receiverPublicKey:o,senderPublicKey:c};await this.sendError({id:r,topic:l,error:n,encodeOpts:u,rpcOpts:Ie.wc_sessionAuthenticate.reject,appLink:this.getAppLinkIfEnabled(s.requester.metadata,s.transportType)}),await this.client.auth.requests.delete(r,{message:"rejected",code:0}),await this.deleteProposal(r)}),S(this,"formatAuthMessage",e=>{this.isInitialized();const{request:r,iss:n}=e;return Xl(r,n)}),S(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)}),S(this,"cleanupDuplicatePairings",async e=>{if(e.pairingTopic)try{const r=this.client.core.pairing.pairings.get(e.pairingTopic),n=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!==r.topic});if(n.length===0)return;this.client.logger.info(`Cleaning up ${n.length} duplicate pairing(s)`),await Promise.all(n.map(s=>this.client.core.pairing.disconnect({topic:s.topic}))),this.client.logger.info("Duplicate pairings clean up finished")}catch(r){this.client.logger.error(r)}}),S(this,"deleteSession",async e=>{var r;const{topic:n,expirerHasDeleted:s=!1,emitEvent:o=!0,id:c=0}=e,{self:l}=this.client.session.get(n);await this.client.core.relayer.unsubscribe(n),await this.client.session.delete(n,ae("USER_DISCONNECTED")),this.addToRecentlyDeleted(n,"session"),this.client.core.crypto.keychain.has(l.publicKey)&&await this.client.core.crypto.deleteKeyPair(l.publicKey),this.client.core.crypto.keychain.has(n)&&await this.client.core.crypto.deleteSymKey(n),s||this.client.core.expirer.del(n),this.client.core.storage.removeItem(Ic).catch(u=>this.client.logger.warn(u)),this.getPendingSessionRequests().forEach(u=>{u.topic===n&&this.deletePendingSessionRequest(u.id,ae("USER_DISCONNECTED"))}),n===((r=this.sessionRequestQueue.queue[0])==null?void 0:r.topic)&&(this.sessionRequestQueue.state=dt.idle),o&&this.client.events.emit("session_delete",{id:c,topic:n})}),S(this,"deleteProposal",async(e,r)=>{if(r)try{const n=this.client.proposal.get(e),s=this.client.core.eventClient.getEvent({topic:n.pairingTopic});s==null||s.setError(zi.proposal_expired)}catch{}await Promise.all([this.client.proposal.delete(e,ae("USER_DISCONNECTED")),r?Promise.resolve():this.client.core.expirer.del(e)]),this.addToRecentlyDeleted(e,"proposal")}),S(this,"deletePendingSessionRequest",async(e,r,n=!1)=>{await Promise.all([this.client.pendingRequest.delete(e,r),n?Promise.resolve():this.client.core.expirer.del(e)]),this.addToRecentlyDeleted(e,"request"),this.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter(s=>s.id!==e),n&&(this.sessionRequestQueue.state=dt.idle,this.client.events.emit("session_request_expire",{id:e}))}),S(this,"deletePendingAuthRequest",async(e,r,n=!1)=>{await Promise.all([this.client.auth.requests.delete(e,r),n?Promise.resolve():this.client.core.expirer.del(e)])}),S(this,"setExpiry",async(e,r)=>{this.client.session.keys.includes(e)&&(this.client.core.expirer.set(e,r),await this.client.session.update(e,{expiry:r}))}),S(this,"setProposal",async(e,r)=>{this.client.core.expirer.set(e,_e(Ie.wc_sessionPropose.req.ttl)),await this.client.proposal.set(e,r)}),S(this,"setAuthRequest",async(e,r)=>{const{request:n,pairingTopic:s,transportType:o=se.relay}=r;this.client.core.expirer.set(e,n.expiryTimestamp),await this.client.auth.requests.set(e,{authPayload:n.authPayload,requester:n.requester,expiryTimestamp:n.expiryTimestamp,id:e,pairingTopic:s,verifyContext:n.verifyContext,transportType:o})}),S(this,"setPendingSessionRequest",async e=>{const{id:r,topic:n,params:s,verifyContext:o}=e,c=s.request.expiryTimestamp||_e(Ie.wc_sessionRequest.req.ttl);this.client.core.expirer.set(r,c),await this.client.pendingRequest.set(r,{id:r,topic:n,params:s,verifyContext:o})}),S(this,"sendRequest",async e=>{const{topic:r,method:n,params:s,expiry:o,relayRpcId:c,clientRpcId:l,throwOnFailedPublish:u,appLink:h,tvf:d,publishOpts:p={}}=e,_=Nt(n,s,l);let f;const m=!!h;try{const R=m?jt:Me;f=await this.client.core.crypto.encode(r,_,{encoding:R})}catch(R){throw await this.cleanup(),this.client.logger.error(`sendRequest() -> core.crypto.encode() for topic ${r} failed`),R}let y;if(Cb.includes(n)){const R=Xe(JSON.stringify(_)),v=Xe(f);y=await this.client.core.verify.register({id:v,decryptedId:R})}const b=ie(ie({},Ie[n].req),p);if(b.attestation=y,o&&(b.ttl=o),c&&(b.id=c),this.client.core.history.set(r,_),m){const R=xr(h,r,f);await K.Linking.openURL(R,this.client.name)}else b.tvf=Le(ie({},d),{correlationId:_.id}),u?(b.internal=Le(ie({},b.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(r,f,b)):this.client.core.relayer.publish(r,f,b).catch(R=>this.client.logger.error(R));return _.id}),S(this,"sendProposeSession",async e=>{const{proposal:r,publishOpts:n}=e,s=Nt("wc_sessionPropose",r,r.id);this.client.core.history.set(r.pairingTopic,s);const o=await this.client.core.crypto.encode(r.pairingTopic,s,{encoding:Me}),c=Xe(JSON.stringify(s)),l=Xe(o),u=await this.client.core.verify.register({id:l,decryptedId:c});await this.client.core.relayer.publishCustom({payload:{pairingTopic:r.pairingTopic,sessionProposal:o},opts:Le(ie({},n),{publishMethod:"wc_proposeSession",attestation:u})})}),S(this,"sendApproveSession",async e=>{const{sessionTopic:r,pairingProposalResponse:n,proposal:s,sessionSettleRequest:o,publishOpts:c}=e,l=Kr(s.id,n),u=await this.client.core.crypto.encode(s.pairingTopic,l,{encoding:Me}),h=Nt("wc_sessionSettle",o,c==null?void 0:c.id),d=await this.client.core.crypto.encode(r,h,{encoding:Me});this.client.core.history.set(r,h),await this.client.core.relayer.publishCustom({payload:{sessionTopic:r,pairingTopic:s.pairingTopic,sessionProposalResponse:u,sessionSettlementRequest:d},opts:Le(ie({},c),{publishMethod:"wc_approveSession"})})}),S(this,"sendResult",async e=>{const{id:r,topic:n,result:s,throwOnFailedPublish:o,encodeOpts:c,appLink:l}=e,u=Kr(r,s);let h;const d=l&&typeof(K==null?void 0:K.Linking)<"u";try{const f=d?jt:Me;h=await this.client.core.crypto.encode(n,u,Le(ie({},c||{}),{encoding:f}))}catch(f){throw await this.cleanup(),this.client.logger.error(`sendResult() -> core.crypto.encode() for topic ${n} failed`),f}let p,_;try{p=await this.client.core.history.get(n,r);const f=p.request;try{_=this.getTVFParams(r,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(${n}, ${r}) failed`),f}if(d){const f=xr(l,n,h);await K.Linking.openURL(f,this.client.name)}else{const f=p.request.method,m=Ie[f].res;m.tvf=Le(ie({},_),{correlationId:r}),o?(m.internal=Le(ie({},m.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(n,h,m)):this.client.core.relayer.publish(n,h,m).catch(y=>this.client.logger.error(y))}await this.client.core.history.resolve(u)}),S(this,"sendError",async e=>{const{id:r,topic:n,error:s,encodeOpts:o,rpcOpts:c,appLink:l}=e,u=Hc(r,s);let h;const d=l&&typeof(K==null?void 0:K.Linking)<"u";try{const _=d?jt:Me;h=await this.client.core.crypto.encode(n,u,Le(ie({},o||{}),{encoding:_}))}catch(_){throw await this.cleanup(),this.client.logger.error(`sendError() -> core.crypto.encode() for topic ${n} failed`),_}let p;try{p=await this.client.core.history.get(n,r)}catch(_){throw this.client.logger.error(`sendError() -> history.get(${n}, ${r}) failed`),_}if(d){const _=xr(l,n,h);await K.Linking.openURL(_,this.client.name)}else{const _=p.request.method,f=c||Ie[_].res;this.client.core.relayer.publish(n,h,f)}await this.client.core.history.resolve(u)}),S(this,"cleanup",async()=>{const e=[],r=[];this.client.session.getAll().forEach(n=>{let s=!1;Bt(n.expiry)&&(s=!0),this.client.core.crypto.keychain.has(n.topic)||(s=!0),s&&e.push(n.topic)}),this.client.proposal.getAll().forEach(n=>{Bt(n.expiryTimestamp)&&r.push(n.id)}),await Promise.all([...e.map(n=>this.deleteSession({topic:n})),...r.map(n=>this.deleteProposal(n))])}),S(this,"onProviderMessageEvent",async e=>{!this.initialized||this.relayMessageCache.length>0?this.relayMessageCache.push(e):await this.onRelayMessage(e)}),S(this,"onRelayEventRequest",async e=>{this.requestQueue.queue.push(e),await this.processRequestsQueue()}),S(this,"processRequestsQueue",async()=>{if(this.requestQueue.state===dt.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=dt.active;const e=this.requestQueue.queue.shift();if(e)try{await this.processRequest(e)}catch(r){this.client.logger.warn(r)}}this.requestQueue.state=dt.idle}),S(this,"processRequest",async e=>{const{topic:r,payload:n,attestation:s,transportType:o,encryptedId:c}=e,l=n.method;if(!this.shouldIgnorePairingRequest({topic:r,requestMethod:l}))switch(l){case"wc_sessionPropose":return await this.onSessionProposeRequest({topic:r,payload:n,attestation:s,encryptedId:c});case"wc_sessionSettle":return await this.onSessionSettleRequest(r,n);case"wc_sessionUpdate":return await this.onSessionUpdateRequest(r,n);case"wc_sessionExtend":return await this.onSessionExtendRequest(r,n);case"wc_sessionPing":return await this.onSessionPingRequest(r,n);case"wc_sessionDelete":return await this.onSessionDeleteRequest(r,n);case"wc_sessionRequest":return await this.onSessionRequest({topic:r,payload:n,attestation:s,encryptedId:c,transportType:o});case"wc_sessionEvent":return await this.onSessionEventRequest(r,n);case"wc_sessionAuthenticate":return await this.onSessionAuthenticateRequest({topic:r,payload:n,attestation:s,encryptedId:c,transportType:o});default:return this.client.logger.info(`Unsupported request method ${l}`)}}),S(this,"onRelayEventResponse",async e=>{const{topic:r,payload:n,transportType:s}=e,o=(await this.client.core.history.get(r,n.id)).request.method;switch(o){case"wc_sessionPropose":return this.onSessionProposeResponse(r,n,s);case"wc_sessionSettle":return this.onSessionSettleResponse(r,n);case"wc_sessionUpdate":return this.onSessionUpdateResponse(r,n);case"wc_sessionExtend":return this.onSessionExtendResponse(r,n);case"wc_sessionPing":return this.onSessionPingResponse(r,n);case"wc_sessionRequest":return this.onSessionRequestResponse(r,n);case"wc_sessionAuthenticate":return this.onSessionAuthenticateResponse(r,n);default:return this.client.logger.info(`Unsupported response method ${o}`)}}),S(this,"onRelayEventUnknownPayload",e=>{const{topic:r}=e,{message:n}=N("MISSING_OR_INVALID",`Decoded payload on topic ${r} is not identifiable as a JSON-RPC request or a response.`);throw new Error(n)}),S(this,"shouldIgnorePairingRequest",e=>{const{topic:r,requestMethod:n}=e,s=this.expectedPairingMethodMap.get(r);return!s||s.includes(n)?!1:!!(s.includes("wc_sessionAuthenticate")&&this.client.events.listenerCount("session_authenticate")>0)}),S(this,"onSessionProposeRequest",async e=>{const{topic:r,payload:n,attestation:s,encryptedId:o}=e,{params:c,id:l}=n;try{const u=this.client.core.eventClient.getEvent({topic:r});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(ie({},n.params));const h=c.expiryTimestamp||_e(Ie.wc_sessionPropose.req.ttl),d=ie({id:l,pairingTopic:r,expiryTimestamp:h,attestation:s,encryptedId:o},c);await this.setProposal(l,d);const p=await this.getVerifyContext({attestationId:s,hash:Xe(JSON.stringify(n)),encryptedId:o,metadata:d.proposer.metadata});u==null||u.addTrace(pt.emit_session_proposal),this.client.events.emit("session_proposal",{id:l,params:d,verifyContext:p})}catch(u){await this.sendError({id:l,topic:r,error:u,rpcOpts:Ie.wc_sessionPropose.autoReject}),this.client.logger.error(u)}}),S(this,"onSessionProposeResponse",async(e,r,n)=>{const{id:s}=r;if(bt(r)){const{result:o}=r;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 h=await this.client.core.crypto.generateSharedKey(l,u);this.pendingSessions.set(s,{sessionTopic:h,pairingTopic:e,proposalId:s,publicKey:l});const d=await this.client.core.relayer.subscribe(h,{transportType:n});this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:d}),await this.client.core.pairing.activate({topic:e})}else if(_t(r)){await this.deleteProposal(s);const o=te("session_connect",s);if(this.events.listenerCount(o)===0)throw new Error(`emitting ${o} without any listeners, 954`);this.events.emit(o,{error:r.error})}}),S(this,"onSessionSettleRequest",async(e,r)=>{const{id:n,params:s}=r;try{this.isValidSessionSettleRequest(s);const{relay:o,controller:c,expiry:l,namespaces:u,sessionProperties:h,scopedProperties:d,sessionConfig:p}=r.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(ie(ie(ie({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}},h&&{sessionProperties:h}),d&&{scopedProperties:d}),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(te("session_connect",_.proposalId),{session:m}),this.pendingSessions.delete(_.proposalId),this.deleteProposal(_.proposalId,!1),this.cleanupDuplicatePairings(m),await this.sendResult({id:r.id,topic:e,result:!0})}catch(o){await this.sendError({id:n,topic:e,error:o}),this.client.logger.error(o)}}),S(this,"onSessionSettleResponse",async(e,r)=>{const{id:n}=r;bt(r)?(await this.client.session.update(e,{acknowledged:!0}),this.events.emit(te("session_approve",n),{})):_t(r)&&(await this.client.session.delete(e,ae("USER_DISCONNECTED")),this.events.emit(te("session_approve",n),{error:r.error}))}),S(this,"onSessionUpdateRequest",async(e,r)=>{const{params:n,id:s}=r;try{const o=`${e}_session_update`,c=Mi.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(ie({topic:e},n));try{Mi.set(o,s),await this.client.session.update(e,{namespaces:n.namespaces}),await this.sendResult({id:s,topic:e,result:!0})}catch(l){throw Mi.delete(o),l}this.client.events.emit("session_update",{id:s,topic:e,params:n})}catch(o){await this.sendError({id:s,topic:e,error:o}),this.client.logger.error(o)}}),S(this,"isRequestOutOfSync",(e,r)=>r.toString().slice(0,-3)<e.toString().slice(0,-3)),S(this,"onSessionUpdateResponse",(e,r)=>{const{id:n}=r,s=te("session_update",n);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);bt(r)?this.events.emit(te("session_update",n),{}):_t(r)&&this.events.emit(te("session_update",n),{error:r.error})}),S(this,"onSessionExtendRequest",async(e,r)=>{const{id:n}=r;try{this.isValidExtend({topic:e}),await this.setExpiry(e,_e(gi)),await this.sendResult({id:n,topic:e,result:!0}),this.client.events.emit("session_extend",{id:n,topic:e})}catch(s){await this.sendError({id:n,topic:e,error:s}),this.client.logger.error(s)}}),S(this,"onSessionExtendResponse",(e,r)=>{const{id:n}=r,s=te("session_extend",n);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);bt(r)?this.events.emit(te("session_extend",n),{}):_t(r)&&this.events.emit(te("session_extend",n),{error:r.error})}),S(this,"onSessionPingRequest",async(e,r)=>{const{id:n}=r;try{this.isValidPing({topic:e}),await this.sendResult({id:n,topic:e,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_ping",{id:n,topic:e})}catch(s){await this.sendError({id:n,topic:e,error:s}),this.client.logger.error(s)}}),S(this,"onSessionPingResponse",(e,r)=>{const{id:n}=r,s=te("session_ping",n);setTimeout(()=>{if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners 2176`);bt(r)?this.events.emit(te("session_ping",n),{}):_t(r)&&this.events.emit(te("session_ping",n),{error:r.error})},500)}),S(this,"onSessionDeleteRequest",async(e,r)=>{const{id:n}=r;try{this.isValidDisconnect({topic:e,reason:r.params}),await Promise.all([new Promise(s=>{this.client.core.relayer.once(le.publish,async()=>{s(await this.deleteSession({topic:e,id:n}))})}),this.sendResult({id:n,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)}}),S(this,"onSessionRequest",async e=>{var r,n,s;const{topic:o,payload:c,attestation:l,encryptedId:u,transportType:h}=e,{id:d,params:p}=c;try{await this.isValidRequest(ie({topic:o},p));const _=this.client.session.get(o),f=await this.getVerifyContext({attestationId:l,hash:Xe(JSON.stringify(Nt("wc_sessionRequest",p,d))),encryptedId:u,metadata:_.peer.metadata,transportType:h}),m={id:d,topic:o,params:p,verifyContext:f};await this.setPendingSessionRequest(m),h===se.link_mode&&(r=_.peer.metadata.redirect)!=null&&r.universal&&this.client.core.addLinkModeSupportedApp((n=_.peer.metadata.redirect)==null?void 0:n.universal),(s=this.client.signConfig)!=null&&s.disableRequestQueue?this.emitSessionRequest(m):(this.addSessionRequestToSessionRequestQueue(m),this.processSessionRequestQueue())}catch(_){await this.sendError({id:d,topic:o,error:_}),this.client.logger.error(_)}}),S(this,"onSessionRequestResponse",(e,r)=>{const{id:n}=r,s=te("session_request",n);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);bt(r)?this.events.emit(te("session_request",n),{result:r.result}):_t(r)&&this.events.emit(te("session_request",n),{error:r.error})}),S(this,"onSessionEventRequest",async(e,r)=>{const{id:n,params:s}=r;try{const o=`${e}_session_event_${s.event.name}`,c=Mi.get(o);if(c&&this.isRequestOutOfSync(c,n)){this.client.logger.info(`Discarding out of sync request - ${n}`);return}this.isValidEmit(ie({topic:e},s)),this.client.events.emit("session_event",{id:n,topic:e,params:s}),Mi.set(o,n)}catch(o){await this.sendError({id:n,topic:e,error:o}),this.client.logger.error(o)}}),S(this,"onSessionAuthenticateResponse",(e,r)=>{const{id:n}=r;this.client.logger.trace({type:"method",method:"onSessionAuthenticateResponse",topic:e,payload:r}),bt(r)?this.events.emit(te("session_request",n),{result:r.result}):_t(r)&&this.events.emit(te("session_request",n),{error:r.error})}),S(this,"onSessionAuthenticateRequest",async e=>{var r;const{topic:n,payload:s,attestation:o,encryptedId:c,transportType:l}=e;try{const{requester:u,authPayload:h,expiryTimestamp:d}=s.params,p=await this.getVerifyContext({attestationId:o,hash:Xe(JSON.stringify(s)),encryptedId:c,metadata:u.metadata,transportType:l}),_={requester:u,pairingTopic:n,id:s.id,authPayload:h,verifyContext:p,expiryTimestamp:d};await this.setAuthRequest(s.id,{request:_,pairingTopic:n,transportType:l}),l===se.link_mode&&(r=u.metadata.redirect)!=null&&r.universal&&this.client.core.addLinkModeSupportedApp(u.metadata.redirect.universal),this.client.events.emit("session_authenticate",{topic:n,params:s.params,id:s.id,verifyContext:p})}catch(u){this.client.logger.error(u);const h=s.params.requester.publicKey,d=await this.client.core.crypto.generateKeyPair(),p=this.getAppLinkIfEnabled(s.params.requester.metadata,l),_={type:Ot,receiverPublicKey:h,senderPublicKey:d};await this.sendError({id:s.id,topic:n,error:u,encodeOpts:_,rpcOpts:Ie.wc_sessionAuthenticate.autoReject,appLink:p})}}),S(this,"addSessionRequestToSessionRequestQueue",e=>{this.sessionRequestQueue.queue.push(e)}),S(this,"cleanupAfterResponse",e=>{this.deletePendingSessionRequest(e.response.id,{message:"fulfilled",code:0}),setTimeout(()=>{this.sessionRequestQueue.state=dt.idle,this.processSessionRequestQueue()},B.toMiliseconds(this.requestQueueDelay))}),S(this,"cleanupPendingSentRequestsForTopic",({topic:e,error:r})=>{const n=this.client.core.history.pending;n.length>0&&n.filter(s=>s.topic===e&&s.request.method==="wc_sessionRequest").forEach(s=>{const o=s.request.id,c=te("session_request",o);if(this.events.listenerCount(c)===0)throw new Error(`emitting ${c} without any listeners`);this.events.emit(te("session_request",s.request.id),{error:r})})}),S(this,"processSessionRequestQueue",()=>{if(this.sessionRequestQueue.state===dt.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(r){this.client.logger.error(r)}}),S(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=dt.active,this.emittedSessionRequests.add(e.id),this.client.events.emit("session_request",e)}),S(this,"onPairingCreated",e=>{if(e.methods&&this.expectedPairingMethodMap.set(e.topic,e.methods),e.active)return;const r=this.client.proposal.getAll().find(n=>n.pairingTopic===e.topic);r&&this.onSessionProposeRequest({topic:e.topic,payload:Nt("wc_sessionPropose",Le(ie({},r),{requiredNamespaces:r.requiredNamespaces,optionalNamespaces:r.optionalNamespaces,relays:r.relays,proposer:r.proposer,sessionProperties:r.sessionProperties,scopedProperties:r.scopedProperties}),r.id),attestation:r.attestation,encryptedId:r.encryptedId})}),S(this,"isValidConnect",async e=>{if(!Ue(e)){const{message:u}=N("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(e)}`);throw new Error(u)}const{pairingTopic:r,requiredNamespaces:n,optionalNamespaces:s,sessionProperties:o,scopedProperties:c,relays:l}=e;if(fe(r)||await this.isValidPairingTopic(r),!Eg(l)){const{message:u}=N("MISSING_OR_INVALID",`connect() relays: ${l}`);throw new Error(u)}if(!fe(n)&&dr(n)!==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(n,"requiredNamespaces")}if(!fe(s)&&dr(s)!==0&&this.validateNamespaces(s,"optionalNamespaces"),fe(o)||this.validateSessionProps(o,"sessionProperties"),!fe(c)){this.validateSessionProps(c,"scopedProperties");const u=Object.keys(n||{}).concat(Object.keys(s||{}));if(!Object.keys(c).every(h=>u.includes(h.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)}`)}}),S(this,"validateNamespaces",(e,r)=>{const n=gg(e,"connect()",r);if(n)throw new Error(n.message)}),S(this,"isValidApprove",async e=>{if(!Ue(e))throw new Error(N("MISSING_OR_INVALID",`approve() params: ${e}`).message);const{id:r,namespaces:n,relayProtocol:s,sessionProperties:o,scopedProperties:c}=e;this.checkRecentlyDeleted(r),await this.isValidProposalId(r);const l=this.client.proposal.get(r),u=$n(n,"approve()");if(u)throw new Error(u.message);const h=Ya(l.requiredNamespaces,n,"approve()");if(h)throw new Error(h.message);if(!de(s,!0)){const{message:d}=N("MISSING_OR_INVALID",`approve() relayProtocol: ${s}`);throw new Error(d)}if(fe(o)||this.validateSessionProps(o,"sessionProperties"),!fe(c)){this.validateSessionProps(c,"scopedProperties");const d=new Set(Object.keys(n));if(!Object.keys(c).every(p=>d.has(p.split(":")[0])))throw new Error(`Scoped properties must be a subset of approved namespaces, received: ${JSON.stringify(c)}, approved namespaces: ${Array.from(d).join(", ")}`)}}),S(this,"isValidReject",async e=>{if(!Ue(e)){const{message:s}=N("MISSING_OR_INVALID",`reject() params: ${e}`);throw new Error(s)}const{id:r,reason:n}=e;if(this.checkRecentlyDeleted(r),await this.isValidProposalId(r),!bg(n)){const{message:s}=N("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(n)}`);throw new Error(s)}}),S(this,"isValidSessionSettleRequest",e=>{if(!Ue(e)){const{message:u}=N("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${e}`);throw new Error(u)}const{relay:r,controller:n,namespaces:s,expiry:o}=e;if(!Vu(r)){const{message:u}=N("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(u)}const c=pg(n,"onSessionSettleRequest()");if(c)throw new Error(c.message);const l=$n(s,"onSessionSettleRequest()");if(l)throw new Error(l.message);if(Bt(o)){const{message:u}=N("EXPIRED","onSessionSettleRequest()");throw new Error(u)}}),S(this,"isValidUpdate",async e=>{if(!Ue(e)){const{message:l}=N("MISSING_OR_INVALID",`update() params: ${e}`);throw new Error(l)}const{topic:r,namespaces:n}=e;this.checkRecentlyDeleted(r),await this.isValidSessionTopic(r);const s=this.client.session.get(r),o=$n(n,"update()");if(o)throw new Error(o.message);const c=Ya(s.requiredNamespaces,n,"update()");if(c)throw new Error(c.message)}),S(this,"isValidExtend",async e=>{if(!Ue(e)){const{message:n}=N("MISSING_OR_INVALID",`extend() params: ${e}`);throw new Error(n)}const{topic:r}=e;this.checkRecentlyDeleted(r),await this.isValidSessionTopic(r)}),S(this,"isValidRequest",async e=>{if(!Ue(e)){const{message:l}=N("MISSING_OR_INVALID",`request() params: ${e}`);throw new Error(l)}const{topic:r,request:n,chainId:s,expiry:o}=e;this.checkRecentlyDeleted(r),await this.isValidSessionTopic(r);const{namespaces:c}=this.client.session.get(r);if(!Ja(c,s)){const{message:l}=N("MISSING_OR_INVALID",`request() chainId: ${s}`);throw new Error(l)}if(!Ig(n)){const{message:l}=N("MISSING_OR_INVALID",`request() ${JSON.stringify(n)}`);throw new Error(l)}if(!Pg(c,s,n.method)){const{message:l}=N("MISSING_OR_INVALID",`request() method: ${n.method}`);throw new Error(l)}if(o&&!Dg(o,qn)){const{message:l}=N("MISSING_OR_INVALID",`request() expiry: ${o}. Expiry must be a number (in seconds) between ${qn.min} and ${qn.max}`);throw new Error(l)}}),S(this,"isValidRespond",async e=>{var r;if(!Ue(e)){const{message:o}=N("MISSING_OR_INVALID",`respond() params: ${e}`);throw new Error(o)}const{topic:n,response:s}=e;try{await this.isValidSessionTopic(n)}catch(o){throw(r=e==null?void 0:e.response)!=null&&r.id&&this.cleanupAfterResponse(e),o}if(!Ag(s)){const{message:o}=N("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(s)}`);throw new Error(o)}}),S(this,"isValidPing",async e=>{if(!Ue(e)){const{message:n}=N("MISSING_OR_INVALID",`ping() params: ${e}`);throw new Error(n)}const{topic:r}=e;await this.isValidSessionOrPairingTopic(r)}),S(this,"isValidEmit",async e=>{if(!Ue(e)){const{message:c}=N("MISSING_OR_INVALID",`emit() params: ${e}`);throw new Error(c)}const{topic:r,event:n,chainId:s}=e;await this.isValidSessionTopic(r);const{namespaces:o}=this.client.session.get(r);if(!Ja(o,s)){const{message:c}=N("MISSING_OR_INVALID",`emit() chainId: ${s}`);throw new Error(c)}if(!Tg(n)){const{message:c}=N("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(n)}`);throw new Error(c)}if(!Og(o,s,n.name)){const{message:c}=N("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(n)}`);throw new Error(c)}}),S(this,"isValidDisconnect",async e=>{if(!Ue(e)){const{message:n}=N("MISSING_OR_INVALID",`disconnect() params: ${e}`);throw new Error(n)}const{topic:r}=e;await this.isValidSessionOrPairingTopic(r)}),S(this,"isValidAuthenticate",e=>{const{chains:r,uri:n,domain:s,nonce:o}=e;if(!Array.isArray(r)||r.length===0)throw new Error("chains is required and must be a non-empty array");if(!de(n,!1))throw new Error("uri is required parameter");if(!de(s,!1))throw new Error("domain is required parameter");if(!de(o,!1))throw new Error("nonce is required parameter");if([...new Set(r.map(l=>kr(l).namespace))].length>1)throw new Error("Multi-namespace requests are not supported. Please request single namespace only.");const{namespace:c}=kr(r[0]);if(c!=="eip155")throw new Error("Only eip155 namespace is supported for authenticated sessions. Please use .connect() for non-eip155 chains.")}),S(this,"getVerifyContext",async e=>{const{attestationId:r,hash:n,encryptedId:s,metadata:o,transportType:c}=e,l={verified:{verifyUrl:o.verifyUrl||ir,validation:"UNKNOWN",origin:o.url||""}};try{if(c===se.link_mode){const h=this.getAppLinkIfEnabled(o,c);return l.verified.validation=h&&new URL(h).origin===new URL(o.url).origin?"VALID":"INVALID",l}const u=await this.client.core.verify.resolve({attestationId:r,hash:n,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}),S(this,"validateSessionProps",(e,r)=>{Object.values(e).forEach((n,s)=>{if(n==null){const{message:o}=N("MISSING_OR_INVALID",`${r} must contain an existing value for each key. Received: ${n} for key ${Object.keys(e)[s]}`);throw new Error(o)}})}),S(this,"getPendingAuthRequest",e=>{const r=this.client.auth.requests.get(e);return typeof r=="object"?r:void 0}),S(this,"addToRecentlyDeleted",(e,r)=>{if(this.recentlyDeletedMap.set(e,r),this.recentlyDeletedMap.size>=this.recentlyDeletedLimit){let n=0;const s=this.recentlyDeletedLimit/2;for(const o of this.recentlyDeletedMap.keys()){if(n++>=s)break;this.recentlyDeletedMap.delete(o)}}}),S(this,"checkRecentlyDeleted",e=>{const r=this.recentlyDeletedMap.get(e);if(r){const{message:n}=N("MISSING_OR_INVALID",`Record was recently deleted - ${r}: ${e}`);throw new Error(n)}}),S(this,"isLinkModeEnabled",(e,r)=>{var n,s,o,c,l,u,h,d,p;return!e||r!==se.link_mode?!1:((s=(n=this.client.metadata)==null?void 0:n.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)!==""&&((h=e==null?void 0:e.redirect)==null?void 0:h.universal)!==void 0&&((d=e==null?void 0:e.redirect)==null?void 0:d.universal)!==""&&((p=e==null?void 0:e.redirect)==null?void 0:p.linkMode)===!0&&this.client.core.linkModeSupportedApps.includes(e.redirect.universal)&&typeof(K==null?void 0:K.Linking)<"u"}),S(this,"getAppLinkIfEnabled",(e,r)=>{var n;return this.isLinkModeEnabled(e,r)?(n=e==null?void 0:e.redirect)==null?void 0:n.universal:void 0}),S(this,"handleLinkModeMessage",({url:e})=>{if(!e||!e.includes("wc_ev")||!e.includes("topic"))return;const r=la(e,"topic")||"",n=decodeURIComponent(la(e,"wc_ev")||""),s=this.client.session.keys.includes(r);s&&this.client.session.update(r,{transportType:se.link_mode}),this.client.core.dispatchEnvelope({topic:r,message:n,sessionExists:s})}),S(this,"registerLinkModeListeners",async()=>{var e;if(so()||Ht()&&(e=this.client.metadata.redirect)!=null&&e.linkMode){const r=K==null?void 0:K.Linking;if(typeof r<"u"){r.addEventListener("url",this.handleLinkModeMessage,this.client.name);const n=await r.getInitialURL();n&&setTimeout(()=>{this.handleLinkModeMessage({url:n})},50)}}}),S(this,"getTVFParams",(e,r,n)=>{var s,o,c;if(!((s=r.request)!=null&&s.method))return{};const l={correlationId:e,rpcMethods:[r.request.method],chainId:r.chainId};try{const u=this.extractTxHashesFromResult(r.request,n);l.txHashes=u,l.contractAddresses=this.isValidContractData(r.request.params)?[(c=(o=r.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}),S(this,"isValidContractData",e=>{var r;if(!e)return!1;try{const n=(e==null?void 0:e.data)||((r=e==null?void 0:e[0])==null?void 0:r.data);if(!n.startsWith("0x"))return!1;const s=n.slice(2);return/^[0-9a-fA-F]*$/.test(s)?s.length%2===0:!1}catch{}return!1}),S(this,"extractTxHashesFromResult",(e,r)=>{var n;try{if(!r)return[];const s=e.method,o=xb[s];if(s==="sui_signTransaction")return[Qm(r.transactionBytes)];if(s==="near_signTransaction")return[ya(r)];if(s==="near_signTransactions")return r.map(l=>ya(l));if(s==="xrpl_signTransactionFor"||s==="xrpl_signTransaction")return[(n=r.tx_json)==null?void 0:n.hash];if(s==="polkadot_signTransaction")return[Fg({transaction:e.params.transactionPayload,signature:r.signature})];if(s==="algo_signTxn")return Ai(r)?r.map(l=>wa(l)):[wa(r)];if(s==="cosmos_signDirect")return[ey(r)];if(typeof r=="string")return[r];const c=r[o.key];if(Ai(c))return s==="solana_signAllTransactions"?c.map(l=>Zm(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[r,n]of Object.entries(e))for(const s of n)try{await this.onProviderMessageEvent({topic:r,message:s,publishedAt:Date.now()})}catch{this.client.logger.warn(`Error processing pending message event for topic: ${r}, message: ${s}`)}}catch(t){this.client.logger.warn("processPendingMessageEvents failed",t)}}isInitialized(){if(!this.initialized){const{message:t}=N("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:r,attestation:n,transportType:s}=t,{publicKey:o}=this.client.auth.authKeys.keys.includes(Mr)?this.client.auth.authKeys.get(Mr):{publicKey:void 0};try{const c=await this.client.core.crypto.decode(e,r,{receiverPublicKey:o,encoding:s===se.link_mode?jt:Me});zs(c)?(this.client.core.history.set(e,c),await this.onRelayEventRequest({topic:e,payload:c,attestation:n,transportType:s,encryptedId:Xe(r)})):js(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,r)}catch(c){this.client.logger.error(c)}}registerExpirerEvents(){this.client.core.expirer.on(Qe.expired,async t=>{const{topic:e,id:r}=Nl(t.target);if(r&&this.client.pendingRequest.keys.includes(r))return await this.deletePendingSessionRequest(r,N("EXPIRED"),!0);if(r&&this.client.auth.requests.keys.includes(r))return await this.deletePendingAuthRequest(r,N("EXPIRED"),!0);e?this.client.session.keys.includes(e)&&(await this.deleteSession({topic:e,expirerHasDeleted:!0}),this.client.events.emit("session_expire",{topic:e})):r&&(await this.deleteProposal(r,!0),this.client.events.emit("proposal_expire",{id:r}))})}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(!de(t,!1)){const{message:e}=N("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}=N("NO_MATCHING_KEY",`pairing topic doesn't exist: ${t}`);throw new Error(e)}if(Bt(this.client.core.pairing.pairings.get(t).expiry)){const{message:e}=N("EXPIRED",`pairing topic: ${t}`);throw new Error(e)}}async isValidSessionTopic(t){if(!de(t,!1)){const{message:e}=N("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}=N("NO_MATCHING_KEY",`session topic doesn't exist: ${t}`);throw new Error(e)}if(Bt(this.client.session.get(t).expiry)){await this.deleteSession({topic:t});const{message:e}=N("EXPIRED",`session topic: ${t}`);throw new Error(e)}if(!this.client.core.crypto.keychain.has(t)){const{message:e}=N("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(de(t,!1)){const{message:e}=N("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${t}`);throw new Error(e)}else{const{message:e}=N("MISSING_OR_INVALID",`session or pairing topic should be a string: ${t}`);throw new Error(e)}}async isValidProposalId(t){if(!vg(t)){const{message:e}=N("MISSING_OR_INVALID",`proposal id should be a number: ${t}`);throw new Error(e)}if(!this.client.proposal.keys.includes(t)){const{message:e}=N("NO_MATCHING_KEY",`proposal id doesn't exist: ${t}`);throw new Error(e)}if(Bt(this.client.proposal.get(t).expiryTimestamp)){await this.deleteProposal(t);const{message:e}=N("EXPIRED",`proposal id: ${t}`);throw new Error(e)}}}class Wb extends pi{constructor(t,e){super(t,e,Lb,vo),this.core=t,this.logger=e}}class Hb extends pi{constructor(t,e){super(t,e,Db,vo),this.core=t,this.logger=e}}class Gb extends pi{constructor(t,e){super(t,e,Sb,vo,r=>r.id),this.core=t,this.logger=e}}class Jb extends pi{constructor(t,e){super(t,e,Ub,fn,()=>Mr),this.core=t,this.logger=e}}class Yb extends pi{constructor(t,e){super(t,e,Nb,fn),this.core=t,this.logger=e}}class Zb extends pi{constructor(t,e){super(t,e,Bb,fn,r=>r.id),this.core=t,this.logger=e}}var Qb=Object.defineProperty,Xb=(i,t,e)=>t in i?Qb(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,zn=(i,t,e)=>Xb(i,typeof t!="symbol"?t+"":t,e);class eI{constructor(t,e){this.core=t,this.logger=e,zn(this,"authKeys"),zn(this,"pairingTopics"),zn(this,"requests"),this.authKeys=new Jb(this.core,this.logger),this.pairingTopics=new Yb(this.core,this.logger),this.requests=new Zb(this.core,this.logger)}async init(){await this.authKeys.init(),await this.pairingTopics.init(),await this.requests.init()}}var tI=Object.defineProperty,iI=(i,t,e)=>t in i?tI(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Y=(i,t,e)=>iI(i,typeof t!="symbol"?t+"":t,e);class bo extends n_{constructor(t){super(t),Y(this,"protocol",Gu),Y(this,"version",Ju),Y(this,"name",Mn.name),Y(this,"metadata"),Y(this,"core"),Y(this,"logger"),Y(this,"events",new ui.EventEmitter),Y(this,"engine"),Y(this,"session"),Y(this,"proposal"),Y(this,"pendingRequest"),Y(this,"auth"),Y(this,"signConfig"),Y(this,"on",(r,n)=>this.events.on(r,n)),Y(this,"once",(r,n)=>this.events.once(r,n)),Y(this,"off",(r,n)=>this.events.off(r,n)),Y(this,"removeListener",(r,n)=>this.events.removeListener(r,n)),Y(this,"removeAllListeners",r=>this.events.removeAllListeners(r)),Y(this,"connect",async r=>{try{return await this.engine.connect(r)}catch(n){throw this.logger.error(n.message),n}}),Y(this,"pair",async r=>{try{return await this.engine.pair(r)}catch(n){throw this.logger.error(n.message),n}}),Y(this,"approve",async r=>{try{return await this.engine.approve(r)}catch(n){throw this.logger.error(n.message),n}}),Y(this,"reject",async r=>{try{return await this.engine.reject(r)}catch(n){throw this.logger.error(n.message),n}}),Y(this,"update",async r=>{try{return await this.engine.update(r)}catch(n){throw this.logger.error(n.message),n}}),Y(this,"extend",async r=>{try{return await this.engine.extend(r)}catch(n){throw this.logger.error(n.message),n}}),Y(this,"request",async r=>{try{return await this.engine.request(r)}catch(n){throw this.logger.error(n.message),n}}),Y(this,"respond",async r=>{try{return await this.engine.respond(r)}catch(n){throw this.logger.error(n.message),n}}),Y(this,"ping",async r=>{try{return await this.engine.ping(r)}catch(n){throw this.logger.error(n.message),n}}),Y(this,"emit",async r=>{try{return await this.engine.emit(r)}catch(n){throw this.logger.error(n.message),n}}),Y(this,"disconnect",async r=>{try{return await this.engine.disconnect(r)}catch(n){throw this.logger.error(n.message),n}}),Y(this,"find",r=>{try{return this.engine.find(r)}catch(n){throw this.logger.error(n.message),n}}),Y(this,"getPendingSessionRequests",()=>{try{return this.engine.getPendingSessionRequests()}catch(r){throw this.logger.error(r.message),r}}),Y(this,"authenticate",async(r,n)=>{try{return await this.engine.authenticate(r,n)}catch(s){throw this.logger.error(s.message),s}}),Y(this,"formatAuthMessage",r=>{try{return this.engine.formatAuthMessage(r)}catch(n){throw this.logger.error(n.message),n}}),Y(this,"approveSessionAuthenticate",async r=>{try{return await this.engine.approveSessionAuthenticate(r)}catch(n){throw this.logger.error(n.message),n}}),Y(this,"rejectSessionAuthenticate",async r=>{try{return await this.engine.rejectSessionAuthenticate(r)}catch(n){throw this.logger.error(n.message),n}}),this.name=(t==null?void 0:t.name)||Mn.name,this.metadata=jf(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:on(eo({level:(t==null?void 0:t.logger)||Mn.logger}));this.core=(t==null?void 0:t.core)||new Rb(t),this.logger=Ce(e,this.name),this.session=new Hb(this.core,this.logger),this.proposal=new Wb(this.core,this.logger),this.pendingRequest=new Gb(this.core,this.logger),this.engine=new Fb(this),this.auth=new eI(this.core,this.logger)}static async init(t){const e=new bo(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 rI=bo,nI="08c4b07e3ad25f1a27c14a4e8cecb6f0",xA="eip155";async function sI(i){const{account:t,chainId:e,params:[r]}=i;if(!t.sendRawTransaction)throw new Error("The current account does not support sending raw transactions");return(await t.sendRawTransaction({chainId:e,rawTransaction:r})).transactionHash}function mn(i,t){if(Lo(i.address)!==Lo(t))throw new Error(`Failed to validate account address (${i.address}), differs from ${t}`)}function SA(i){const t=i.split(":"),e=Number.parseInt(t[1]??"0");if(t.length!==2||t[0]!=="eip155"||e===0||!e)throw new Error(`Invalid chainId ${i}, should have the format 'eip155:1'`);return e}async function oI(i){const{account:t,chainId:e,thirdwebClient:r,params:[n]}=i;n.from!==void 0&&mn(t,n.from);const s=Jn({chain:ge(e),client:r,data:n.data,gas:n.gas?Ve(n.gas):void 0,gasPrice:n.gasPrice?Ve(n.gasPrice):void 0,to:n.to,value:n.value?Ve(n.value):void 0});return(await Mc({account:t,transaction:s})).transactionHash}async function Pc(i){const{account:t,params:e}=i;return mn(t,e[1]),t.signMessage({message:{raw:e[0]}})}async function aI(i){const{account:t,params:[e]}=i;if(!t.signTransaction)throw new Error("The current account does not support signing transactions");return e.from!==void 0&&mn(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?si(e.nonce):void 0,to:e.to,value:e.value?Ve(e.value):void 0})}async function Oc(i){const{account:t,params:e}=i;return mn(t,e[0]),t.signTypedData(typeof e[1]=="string"?JSON.parse(e[1]):e[1])}async function Zu(i){var r;const{wallet:t,params:e}=i;return((r=t.getChain())==null?void 0:r.id)===si(e[0].chainId)||await t.switchChain(Bh(si(e[0].chainId))),"0x1"}const CA=Object.freeze(Object.defineProperty({__proto__:null,handleSwitchChain:Zu},Symbol.toStringTag,{value:"Module"})),$A="/sdk/2022-08-12/embedded-wallet",jn=i=>`thirdwebEwsWalletUserId-${i}`,cI="walletToken",Kn=i=>`${cI}-${i}`,Rc=i=>`passkey-credential-id-${i}`,lI="a",Fn=(i,t)=>`${lI}-${i}-${t}`,Lc=i=>`walletConnectSessions-${i}`,Dc=i=>`thirdweb_guest_session_id_${i}`,Vc=new Map;class Io{constructor({storage:t,clientId:e,ecosystem:r}){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=uI(e,r==null?void 0:r.id),this.ecosystem=r}async getItem(t){return this.storage?this.storage.getItem(t):Vc.get(t)??null}async setItem(t,e){if(this.storage)return this.storage.setItem(t,e);Vc.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(Lc(this.key))}async saveWalletConnectSessions(t){await this.setItem(Lc(this.key),t)}async savePasskeyCredentialId(t){await this.setItem(Rc(this.key),t)}async getPasskeyCredentialId(){return this.getItem(Rc(this.key))}async saveAuthCookie(t){await this.setItem(Kn(this.key),t)}async getAuthCookie(){return this.getItem(Kn(this.key))}async removeAuthCookie(){return this.removeItem(Kn(this.key))}async saveDeviceShare(t,e){await this.saveWalletUserId(e),await this.setItem(Fn(this.key,e),t)}async getDeviceShare(){const t=await this.getWalletUserId();return t?this.getItem(Fn(this.key,t)):null}async removeDeviceShare(){const t=await this.getWalletUserId();return t?this.removeItem(Fn(this.key,t)):!1}async getWalletUserId(){return this.getItem(jn(this.key))}async saveWalletUserId(t){await this.setItem(jn(this.key),t)}async removeWalletUserId(){return this.removeItem(jn(this.key))}async getGuestSessionId(){return this.getItem(Dc(this.key))}async saveGuestSessionId(t){await this.setItem(Dc(this.key),t)}}const uI=(i,t)=>`${i}${t?`-${t}`:""}`;let yt;async function Qu(){if(!yt)return[];const i=await yt.getWalletConnectSessions();return JSON.parse(i??"[]")}function hI(i){yt||(yt=new Io({clientId:i.clientId,storage:null}))}async function kA(i){if(!yt)return;const t=await yt.getWalletConnectSessions(),e=JSON.parse(t??"[]");e.push(i),await yt.saveWalletConnectSessions(we(e))}async function dI(i){if(!yt)return;const t=await yt.getWalletConnectSessions(),r=JSON.parse(t??"[]").filter(n=>n.topic!==i.topic);await yt.saveWalletConnectSessions(we(r))}let Wn=new WeakMap;const pI={eth_sendRawTransaction:sI,eth_sendTransaction:oI,eth_sign:Pc,eth_signTransaction:aI,eth_signTypedData:Oc,eth_signTypedData_v4:Oc,personal_sign:Pc,wallet_addEthereumChain:i=>{throw new Error("Unsupported request method: wallet_addEthereumChain")},wallet_switchEthereumChain:Zu};async function _I(i){var h,d,p,_;const{wallet:t,requestHandlers:e,onConnect:r,onDisconnect:n,client:s}=i,o=i.chains&&i.chains.length>10?(console.warn("WalletConnect: Can specify no more than 10 chains, truncating to the first 10 provided chains..."),i.chains.slice(0,10)):i.chains;if(Wn.has(s))return Wn.get(s);hI({clientId:i.client.clientId});const c=Wr(),l=await rI.init({metadata:{description:((h=i.appMetadata)==null?void 0:h.description)??c.description,icons:[((d=i.appMetadata)==null?void 0:d.logoUrl)??c.logoUrl],name:((p=i.appMetadata)==null?void 0:p.name)??c.name,url:((_=i.appMetadata)==null?void 0:_.url)??c.url},projectId:i.projectId??nI});l.on("session_proposal",async f=>{const{onSessionProposal:m}=await a(async()=>{const{onSessionProposal:y}=await import("./session-proposal-CvW06ECh.js");return{onSessionProposal:y}},__vite__mapDeps([23,1,2,3,4,5,6,7,8,9,10]));await m({chains:o,event:f,onConnect:r,wallet:t,walletConnectClient:l}).catch(y=>{if(i.onError)i.onError(y);else throw y})}),l.on("session_request",async f=>{const{fulfillRequest:m}=await a(async()=>{const{fulfillRequest:y}=await import("./session-request-hdyj4KFj.js");return{fulfillRequest:y}},__vite__mapDeps([24,1,2,3,4,5,6,7,8,9,10]));await m({event:f,handlers:e,thirdwebClient:s,wallet:t,walletConnectClient:l}).catch(y=>{if(i.onError)i.onError(y);else throw y})}),l.on("session_event",async f=>{}),l.on("session_ping",f=>{}),l.on("session_delete",async f=>{await Xu({session:{topic:f.topic},walletConnectClient:l}).catch(m=>{if(i.onError)i.onError(m);else throw m})});const u=l.disconnect;return l.disconnect=async f=>{const m=await u(f).catch(()=>{});return n&&yI({onDisconnect:n,topic:f.topic}),m},Wn.set(i.client,l),l}function fI(i){const{uri:t,walletConnectClient:e}=i;e.core.pairing.pair({uri:t})}async function mI(){return Qu()}async function Xu(i){dI(i.session);try{await i.walletConnectClient.disconnect({reason:{code:6e3,message:"Disconnected"},topic:i.session.topic})}catch{}}async function yI(i){const{topic:t,onDisconnect:e}=i,r=await Qu();e(r.find(n=>n.topic===t)??{topic:t})}function wI(i){return[at("inApp",{executionMode:i==null?void 0:i.executionMode}),at(Jc),at(ft,{appMetadata:i==null?void 0:i.appMetadata,chains:i==null?void 0:i.chains}),at(yd),at("io.rabby"),at(wd),at("com.okex.wallet")]}function gI(i,t){const e=new Set;let r=i();const n=()=>{for(const o of e)o()},s=o=>{r=o,n()};for(const o of t)o.subscribe(()=>{s(i())});return{getValue(){return r},subscribe(o){return e.add(o),()=>{e.delete(o)}}}}function Sr(i,t,e=!0){e&&i();const r=t.map(n=>n.subscribe(()=>{i()}));return()=>{for(const n of r)n()}}const pr="tw:connected-wallet-params";async function UA(i,t,e){if(!vI(e))throw new Error("given params are not stringifiable");const r=await i.getItem(pr);let n;if(r){try{n=JSON.parse(r)}catch{n={}}n[t]=e}else n={[t]:e};i.setItem(pr,we(n))}async function EI(i,t){const e=await i.getItem(pr);let r;if(e){try{r=JSON.parse(e)}catch{r={}}delete r[t],i.setItem(pr,we(r))}}async function NA(i,t){const e=await i.getItem(pr);if(!e)return null;try{const r=JSON.parse(e);return r!=null&&r[t]?r[t]:null}catch{return null}}function vI(i){try{return we(i),!0}catch{return!1}}function bI(i){let t;return()=>(t||(t=i()),t)}function II(i={}){return jc({filters:i,signature:"event UserOperationRevertReason(bytes32 indexed userOpHash, address indexed sender, uint256 nonce, bytes revertReason)"})}function AI(i={}){return jc({filters:i,signature:"event PostOpRevertReason(bytes32 indexed userOpHash, address indexed sender, uint256 nonce, bytes revertReason)"})}function TI(i){const{receipt:t}=i,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)),{...i,actualGasCost:BigInt(i.actualGasCost),actualGasUsed:BigInt(i.actualGasUsed),nonce:BigInt(i.nonce),receipt:e,userOpHash:i.userOpHash}}const BA=()=>{const i=BigInt(Math.floor(Math.random()*4294967296)),t=BigInt(Math.floor(Math.random()*4294967296)),e=BigInt(Math.floor(Math.random()*4294967296)),r=BigInt(Math.floor(Math.random()*4294967296)),n=BigInt(Math.floor(Math.random()*4294967296)),s=BigInt(Math.floor(Math.random()*4294967296));return i<<BigInt(160)|t<<BigInt(128)|e<<BigInt(96)|r<<BigInt(64)|n<<BigInt(32)|s};function eh(i){return Object.fromEntries(Object.entries(i).map(([t,e])=>[t,e==null||zr(e)?e:qs(e)]))}async function MA(i){return Gt({...i,operation:"eth_sendUserOperation",params:[eh(i.userOp),i.options.entrypointAddress??Fc]})}async function qA(i,t){const e=await Gt({...i,operation:"eth_estimateUserOperationGas",params:[eh(i.userOp),i.options.entrypointAddress??Fc,t??{}]});return{callGasLimit:Ve(e.callGasLimit)+zh,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 zA(i){const t=await Gt({...i,operation:"thirdweb_getUserOperationGasPrice",params:[]});return{maxFeePerGas:Ve(t.maxFeePerGas),maxPriorityFeePerGas:Ve(t.maxPriorityFeePerGas)}}async function jA(i){var e,r;const t=await PI(i);if(t){if(t.success===!1){const s=(r=(e=Mh({events:[II(),AI()],logs:t.logs})[0])==null?void 0:e.args)==null?void 0:r.revertReason;if(!s)throw new Error(`UserOp failed at txHash: ${t.receipt.transactionHash}`);const o=qh({data:s});throw new Error(`UserOp failed with reason: '${o.args.join(",")}' at txHash: ${t.receipt.transactionHash}`)}return t.receipt}}async function PI(i){const t=await Gt({operation:"eth_getUserOperationReceipt",options:i,params:[i.userOpHash]});if(t)return TI(t)}async function KA(i){const t=await Gt({operation:"zk_paymasterData",options:i.options,params:[i.transaction]});return{paymaster:t.paymaster,paymasterInput:t.paymasterInput}}async function OI(i){const t=await Gt({...i,operation:"tw_execute",params:[i.eoaAddress,i.wrappedCalls,i.signature,i.authorization]});if(!t.queueId)throw new Error(`Error executing 7702 transaction: ${we(t)}`);return{transactionId:t.queueId}}async function RI(i){return{transactionHash:(await Gt({...i,operation:"tw_getTransactionHash",params:[i.transactionId]})).transactionHash}}async function FA(i){return{transactionHash:(await Gt({operation:"zk_broadcastTransaction",options:i.options,params:[{...i.transaction,signedTransaction:i.signedTransaction}]})).transactionHash}}async function Gt(i){const{options:t,operation:e,params:r}=i,n=t.bundlerUrl??Kc(t.chain),o=await _r(t.client)(n,{useAuthToken:!0,body:we({id:1,jsonrpc:"2.0",method:e,params:r}),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}
12
+ Approved: ${p.toString()}`))}),o.forEach(d=>{r||(ei(n[d].methods,s[d].methods)?ei(n[d].events,s[d].events)||(r=N("NON_CONFORMING_NAMESPACES",`${e} namespaces events don't satisfy namespace events for ${d}`)):r=N("NON_CONFORMING_NAMESPACES",`${e} namespaces methods don't satisfy namespace methods for ${d}`))}),r}function Rg(i){const t={};return Object.keys(i).forEach(e=>{var r;e.includes(":")?t[e]=i[e]:(r=i[e].chains)==null||r.forEach(n=>{t[n]={methods:i[e].methods,events:i[e].events}})}),t}function Za(i){return[...new Set(i.map(t=>t.includes(":")?t.split(":")[0]:t))]}function Lg(i){const t={};return Object.keys(i).forEach(e=>{if(e.includes(":"))t[e]=i[e];else{const r=Si(i[e].accounts);r==null||r.forEach(n=>{t[n]={accounts:i[e].accounts.filter(s=>s.includes(`${n}:`)),methods:i[e].methods,events:i[e].events}})}}),t}function Dg(i,t){return go(i,!1)&&i<=t.max&&i>=t.min}function Qa(){const i=yr();return new Promise(t=>{switch(i){case Ge.browser:t(Vg());break;case Ge.reactNative:t(xg());break;case Ge.node:t(Sg());break;default:t(!0)}})}function Vg(){return Di()&&(navigator==null?void 0:navigator.onLine)}async function xg(){if(Ht()&&typeof K<"u"&&K!=null&&K.NetInfo){const i=await(K==null?void 0:K.NetInfo.fetch());return i==null?void 0:i.isConnected}return!0}function Sg(){return!0}function Cg(i){switch(yr()){case Ge.browser:$g(i);break;case Ge.reactNative:kg(i);break}}function $g(i){!Ht()&&Di()&&(window.addEventListener("online",()=>i(!0)),window.addEventListener("offline",()=>i(!1)))}function kg(i){var t;Ht()&&typeof K<"u"&&K!=null&&K.NetInfo&&((t=K)==null||t.NetInfo.addEventListener(e=>i(e==null?void 0:e.isConnected)))}function Ug(){var i;return Di()&&Rt.getDocument()?((i=Rt.getDocument())==null?void 0:i.visibilityState)==="visible":!0}const kn={};class Mi{static get(t){return kn[t]}static set(t,e){kn[t]=e}static delete(t){delete kn[t]}}function Ng(i){const t=fr.decode(i);if(t.length<33)throw new Error("Too short to contain a public key");return t.slice(1,33)}function Bg({publicKey:i,signature:t,payload:e}){var r;const n=gs(e.method),s=128|parseInt(((r=e.version)==null?void 0:r.toString())||"4"),o=zg(e.address),c=e.era==="00"?new Uint8Array([0]):gs(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]),h=BigInt(`0x${qg(e.tip)}`),d=Kg(h),p=new Uint8Array([0,...i,o,...t,...c,...u,...d,...n]),_=jg(p.length+1);return new Uint8Array([..._,s,...p])}function Mg(i){const t=gs(i),e=td.blake2b(t,void 0,32);return"0x"+ee.from(e).toString("hex")}function gs(i){return new Uint8Array(i.replace(/^0x/,"").match(/.{1,2}/g).map(t=>parseInt(t,16)))}function qg(i){return i.startsWith("0x")?i.slice(2):i}function zg(i){const t=fr.decode(i)[0];return t===42?0:t===60?2:1}function jg(i){if(i<64)return new Uint8Array([i<<2]);if(i<16384){const t=i<<2|1;return new Uint8Array([t&255,t>>8&255])}else if(i<1<<30){const t=i<<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 Kg(i){if(i<BigInt(1)<<BigInt(6))return new Uint8Array([Number(i<<BigInt(2))]);if(i<BigInt(1)<<BigInt(14)){const t=i<<BigInt(2)|BigInt(1);return new Uint8Array([Number(t&BigInt(255)),Number(t>>BigInt(8)&BigInt(255))])}else if(i<BigInt(1)<<BigInt(30)){const t=i<<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 Fg(i){const t=Uint8Array.from(ee.from(i.signature,"hex")),e=Ng(i.transaction.address),r=Bg({publicKey:e,signature:t,payload:i.transaction}),n=ee.from(r).toString("hex");return Mg(n)}var Wg={};const xu="wc",Su=2,Es="core",wt=`${xu}@2:${Es}:`,Hg={logger:"error"},Gg={database:":memory:"},Jg="crypto",Xa="client_ed25519_seed",Yg=B.ONE_DAY,Zg="keychain",Qg="0.3",Xg="messages",eE="0.3",tE=B.SIX_HOURS,iE="publisher",Cu="irn",rE="error",$u="wss://relay.walletconnect.org",nE="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"},sE="_subscription",Ye={payload:"payload",connect:"connect",disconnect:"disconnect",error:"error"},oE=.1,vs="2.21.8",se={link_mode:"link_mode",relay:"relay"},Br={inbound:"inbound",outbound:"outbound"},aE="0.3",cE="WALLETCONNECT_CLIENT_ID",ec="WALLETCONNECT_LINK_MODE_APPS",We={created:"subscription_created",deleted:"subscription_deleted",expired:"subscription_expired",disabled:"subscription_disabled",sync:"subscription_sync",resubscribed:"subscription_resubscribed"},lE="subscription",uE="0.3",hE="pairing",dE="0.3",qi={wc_pairingDelete:{req:{ttl:B.ONE_DAY,prompt:!1,tag:1e3},res:{ttl:B.ONE_DAY,prompt:!1,tag:1001}},wc_pairingPing:{req:{ttl:B.THIRTY_SECONDS,prompt:!1,tag:1002},res:{ttl:B.THIRTY_SECONDS,prompt:!1,tag:1003}},unregistered_method:{req:{ttl:B.ONE_DAY,prompt:!1,tag:0},res:{ttl:B.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"},pE="history",_E="0.3",fE="expirer",Qe={created:"expirer_created",deleted:"expirer_deleted",expired:"expirer_expired",sync:"expirer_sync"},mE="0.3",yE="verify-api",wE="https://verify.walletconnect.com",ku="https://verify.walletconnect.org",ir=ku,gE=`${ir}/v3`,EE=[wE,ku],vE="echo",bE="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"},Ut={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"},zi={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"},Yt={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"},ji={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,AE="event-client",TE=86400,PE="https://pulse.walletconnect.org/batch";function OE(i,t){if(i.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),r=0;r<e.length;r++)e[r]=255;for(var n=0;n<i.length;n++){var s=i.charAt(n),o=s.charCodeAt(0);if(e[o]!==255)throw new TypeError(s+" is ambiguous");e[o]=n}var c=i.length,l=i.charAt(0),u=Math.log(c)/Math.log(256),h=Math.log(256)/Math.log(c);function d(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,R=f.length;b!==R&&f[b]===0;)b++,m++;for(var v=(R-b)*h+1>>>0,P=new Uint8Array(v);b!==R;){for(var T=f[b],g=0,D=v-1;(T!==0||g<y)&&D!==-1;D--,g++)T+=256*P[D]>>>0,P[D]=T%c>>>0,T=T/c>>>0;if(T!==0)throw new Error("Non-zero carry");y=g,b++}for(var L=v-y;L!==v&&P[L]===0;)L++;for(var w=l.repeat(m);L<v;++L)w+=i.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 R=(f.length-m)*u+1>>>0,v=new Uint8Array(R);f[m];){var P=e[f.charCodeAt(m)];if(P===255)return;for(var T=0,g=R-1;(P!==0||T<b)&&g!==-1;g--,T++)P+=c*v[g]>>>0,v[g]=P%256>>>0,P=P/256>>>0;if(P!==0)throw new Error("Non-zero carry");b=T,m++}if(f[m]!==" "){for(var D=R-b;D!==R&&v[D]===0;)D++;for(var L=new Uint8Array(y+(R-D)),w=y;D!==R;)L[w++]=v[D++];return L}}}function _(f){var m=p(f);if(m)return m;throw new Error(`Non-${t} character`)}return{encode:d,decodeUnsafe:p,decode:_}}var RE=OE,LE=RE;const Uu=i=>{if(i instanceof Uint8Array&&i.constructor.name==="Uint8Array")return i;if(i instanceof ArrayBuffer)return new Uint8Array(i);if(ArrayBuffer.isView(i))return new Uint8Array(i.buffer,i.byteOffset,i.byteLength);throw new Error("Unknown type, must be binary type")},DE=i=>new TextEncoder().encode(i),VE=i=>new TextDecoder().decode(i);class xE{constructor(t,e,r){this.name=t,this.prefix=e,this.baseEncode=r}encode(t){if(t instanceof Uint8Array)return`${this.prefix}${this.baseEncode(t)}`;throw Error("Unknown type, must be binary type")}}class SE{constructor(t,e,r){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=r}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 Nu(this,t)}}class CE{constructor(t){this.decoders=t}or(t){return Nu(this,t)}decode(t){const e=t[0],r=this.decoders[e];if(r)return r.decode(t);throw RangeError(`Unable to decode multibase string ${JSON.stringify(t)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const Nu=(i,t)=>new CE({...i.decoders||{[i.prefix]:i},...t.decoders||{[t.prefix]:t}});class $E{constructor(t,e,r,n){this.name=t,this.prefix=e,this.baseEncode=r,this.baseDecode=n,this.encoder=new xE(t,e,r),this.decoder=new SE(t,e,n)}encode(t){return this.encoder.encode(t)}decode(t){return this.decoder.decode(t)}}const _n=({name:i,prefix:t,encode:e,decode:r})=>new $E(i,t,e,r),vr=({prefix:i,name:t,alphabet:e})=>{const{encode:r,decode:n}=LE(e,t);return _n({prefix:i,name:t,encode:r,decode:s=>Uu(n(s))})},kE=(i,t,e,r)=>{const n={};for(let h=0;h<t.length;++h)n[t[h]]=h;let s=i.length;for(;i[s-1]==="=";)--s;const o=new Uint8Array(s*e/8|0);let c=0,l=0,u=0;for(let h=0;h<s;++h){const d=n[i[h]];if(d===void 0)throw new SyntaxError(`Non-${r} character`);l=l<<e|d,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},UE=(i,t,e)=>{const r=t[t.length-1]==="=",n=(1<<e)-1;let s="",o=0,c=0;for(let l=0;l<i.length;++l)for(c=c<<8|i[l],o+=8;o>e;)o-=e,s+=t[n&c>>o];if(o&&(s+=t[n&c<<e-o]),r)for(;s.length*e&7;)s+="=";return s},Ae=({name:i,prefix:t,bitsPerChar:e,alphabet:r})=>_n({prefix:t,name:i,encode(n){return UE(n,r,e)},decode(n){return kE(n,r,e,i)}}),NE=_n({prefix:"\0",name:"identity",encode:i=>VE(i),decode:i=>DE(i)});var BE=Object.freeze({__proto__:null,identity:NE});const ME=Ae({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var qE=Object.freeze({__proto__:null,base2:ME});const zE=Ae({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var jE=Object.freeze({__proto__:null,base8:zE});const KE=vr({prefix:"9",name:"base10",alphabet:"0123456789"});var FE=Object.freeze({__proto__:null,base10:KE});const WE=Ae({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),HE=Ae({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var GE=Object.freeze({__proto__:null,base16:WE,base16upper:HE});const JE=Ae({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),YE=Ae({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),ZE=Ae({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),QE=Ae({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),XE=Ae({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),e0=Ae({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),t0=Ae({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),i0=Ae({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),r0=Ae({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var n0=Object.freeze({__proto__:null,base32:JE,base32upper:YE,base32pad:ZE,base32padupper:QE,base32hex:XE,base32hexupper:e0,base32hexpad:t0,base32hexpadupper:i0,base32z:r0});const s0=vr({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),o0=vr({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var a0=Object.freeze({__proto__:null,base36:s0,base36upper:o0});const c0=vr({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),l0=vr({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var u0=Object.freeze({__proto__:null,base58btc:c0,base58flickr:l0});const h0=Ae({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),d0=Ae({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),p0=Ae({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),_0=Ae({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var f0=Object.freeze({__proto__:null,base64:h0,base64pad:d0,base64url:p0,base64urlpad:_0});const Bu=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),m0=Bu.reduce((i,t,e)=>(i[e]=t,i),[]),y0=Bu.reduce((i,t,e)=>(i[t.codePointAt(0)]=e,i),[]);function w0(i){return i.reduce((t,e)=>(t+=m0[e],t),"")}function g0(i){const t=[];for(const e of i){const r=y0[e.codePointAt(0)];if(r===void 0)throw new Error(`Non-base256emoji character: ${e}`);t.push(r)}return new Uint8Array(t)}const E0=_n({prefix:"🚀",name:"base256emoji",encode:w0,decode:g0});var v0=Object.freeze({__proto__:null,base256emoji:E0}),b0=Mu,tc=128,I0=-128,A0=Math.pow(2,31);function Mu(i,t,e){t=t||[],e=e||0;for(var r=e;i>=A0;)t[e++]=i&255|tc,i/=128;for(;i&I0;)t[e++]=i&255|tc,i>>>=7;return t[e]=i|0,Mu.bytes=e-r+1,t}var T0=bs,P0=128,ic=127;function bs(i,r){var e=0,r=r||0,n=0,s=r,o,c=i.length;do{if(s>=c)throw bs.bytes=0,new RangeError("Could not decode varint");o=i[s++],e+=n<28?(o&ic)<<n:(o&ic)*Math.pow(2,n),n+=7}while(o>=P0);return bs.bytes=s-r,e}var O0=Math.pow(2,7),R0=Math.pow(2,14),L0=Math.pow(2,21),D0=Math.pow(2,28),V0=Math.pow(2,35),x0=Math.pow(2,42),S0=Math.pow(2,49),C0=Math.pow(2,56),$0=Math.pow(2,63),k0=function(i){return i<O0?1:i<R0?2:i<L0?3:i<D0?4:i<V0?5:i<x0?6:i<S0?7:i<C0?8:i<$0?9:10},U0={encode:b0,decode:T0,encodingLength:k0},qu=U0;const rc=(i,t,e=0)=>(qu.encode(i,t,e),t),nc=i=>qu.encodingLength(i),Is=(i,t)=>{const e=t.byteLength,r=nc(i),n=r+nc(e),s=new Uint8Array(n+e);return rc(i,s,0),rc(e,s,r),s.set(t,n),new N0(i,e,t,s)};class N0{constructor(t,e,r,n){this.code=t,this.size=e,this.digest=r,this.bytes=n}}const zu=({name:i,code:t,encode:e})=>new B0(i,t,e);class B0{constructor(t,e,r){this.name=t,this.code=e,this.encode=r}digest(t){if(t instanceof Uint8Array){const e=this.encode(t);return e instanceof Uint8Array?Is(this.code,e):e.then(r=>Is(this.code,r))}else throw Error("Unknown type, must be binary type")}}const ju=i=>async t=>new Uint8Array(await crypto.subtle.digest(i,t)),M0=zu({name:"sha2-256",code:18,encode:ju("SHA-256")}),q0=zu({name:"sha2-512",code:19,encode:ju("SHA-512")});var z0=Object.freeze({__proto__:null,sha256:M0,sha512:q0});const Ku=0,j0="identity",Fu=Uu,K0=i=>Is(Ku,Fu(i)),F0={code:Ku,name:j0,encode:Fu,digest:K0};var W0=Object.freeze({__proto__:null,identity:F0});new TextEncoder,new TextDecoder;const sc={...BE,...qE,...jE,...FE,...GE,...n0,...a0,...u0,...f0,...v0};({...z0,...W0});function Wu(i){return globalThis.Buffer!=null?new Uint8Array(i.buffer,i.byteOffset,i.byteLength):i}function H0(i=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?Wu(globalThis.Buffer.allocUnsafe(i)):new Uint8Array(i)}function Hu(i,t,e,r){return{name:i,prefix:t,encoder:{name:i,prefix:t,encode:e},decoder:{decode:r}}}const oc=Hu("utf8","u",i=>"u"+new TextDecoder("utf8").decode(i),i=>new TextEncoder().encode(i.substring(1))),Un=Hu("ascii","a",i=>{let t="a";for(let e=0;e<i.length;e++)t+=String.fromCharCode(i[e]);return t},i=>{i=i.substring(1);const t=H0(i.length);for(let e=0;e<i.length;e++)t[e]=i.charCodeAt(e);return t}),G0={utf8:oc,"utf-8":oc,hex:sc.base16,latin1:Un,ascii:Un,binary:Un,...sc};function J0(i,t="utf8"){const e=G0[t];if(!e)throw new Error(`Unsupported encoding "${t}"`);return(t==="utf8"||t==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?Wu(globalThis.Buffer.from(i,"utf-8")):e.decoder.decode(`${e.prefix}${i}`)}var Y0=Object.defineProperty,Z0=(i,t,e)=>t in i?Y0(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,ht=(i,t,e)=>Z0(i,typeof t!="symbol"?t+"":t,e);class Q0{constructor(t,e){this.core=t,this.logger=e,ht(this,"keychain",new Map),ht(this,"name",Zg),ht(this,"version",Qg),ht(this,"initialized",!1),ht(this,"storagePrefix",wt),ht(this,"init",async()=>{if(!this.initialized){const r=await this.getKeyChain();typeof r<"u"&&(this.keychain=r),this.initialized=!0}}),ht(this,"has",r=>(this.isInitialized(),this.keychain.has(r))),ht(this,"set",async(r,n)=>{this.isInitialized(),this.keychain.set(r,n),await this.persist()}),ht(this,"get",r=>{this.isInitialized();const n=this.keychain.get(r);if(typeof n>"u"){const{message:s}=N("NO_MATCHING_KEY",`${this.name}: ${r}`);throw new Error(s)}return n}),ht(this,"del",async r=>{this.isInitialized(),this.keychain.delete(r),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,as(t))}async getKeyChain(){const t=await this.core.storage.getItem(this.storageKey);return typeof t<"u"?cs(t):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){const{message:t}=N("NOT_INITIALIZED",this.name);throw new Error(t)}}}var X0=Object.defineProperty,ev=(i,t,e)=>t in i?X0(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,ve=(i,t,e)=>ev(i,typeof t!="symbol"?t+"":t,e);class tv{constructor(t,e,r){this.core=t,this.logger=e,ve(this,"name",Jg),ve(this,"keychain"),ve(this,"randomSessionIdentifier",ws()),ve(this,"initialized",!1),ve(this,"init",async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)}),ve(this,"hasKeys",n=>(this.isInitialized(),this.keychain.has(n))),ve(this,"getClientId",async()=>{this.isInitialized();const n=await this.getClientSeed(),s=Do(n);return sd(s.publicKey)}),ve(this,"generateKeyPair",()=>{this.isInitialized();const n=Cw();return this.setPrivateKey(n.publicKey,n.privateKey)}),ve(this,"signJWT",async n=>{this.isInitialized();const s=await this.getClientSeed(),o=Do(s),c=this.randomSessionIdentifier;return await od(c,n,Yg,o)}),ve(this,"generateSharedKey",(n,s,o)=>{this.isInitialized();const c=this.getPrivateKey(n),l=$w(c,s);return this.setSymKey(l,o)}),ve(this,"setSymKey",async(n,s)=>{this.isInitialized();const o=s||Nr(n);return await this.keychain.set(o,n),o}),ve(this,"deleteKeyPair",async n=>{this.isInitialized(),await this.keychain.del(n)}),ve(this,"deleteSymKey",async n=>{this.isInitialized(),await this.keychain.del(n)}),ve(this,"encode",async(n,s,o)=>{this.isInitialized();const c=Ru(o),l=sr(s);if(qa(c))return Nw(l,o==null?void 0:o.encoding);if(Ma(c)){const p=c.senderPublicKey,_=c.receiverPublicKey;n=await this.generateSharedKey(p,_)}const u=this.getSymKey(n),{type:h,senderPublicKey:d}=c;return kw({type:h,symKey:u,message:l,senderPublicKey:d,encoding:o==null?void 0:o.encoding})}),ve(this,"decode",async(n,s,o)=>{this.isInitialized();const c=Mw(s,o);if(qa(c)){const l=Bw(s,o==null?void 0:o.encoding);return jr(l)}if(Ma(c)){const l=c.receiverPublicKey,u=c.senderPublicKey;n=await this.generateSharedKey(l,u)}try{const l=this.getSymKey(n),u=Uw({symKey:l,encoded:s,encoding:o==null?void 0:o.encoding});return jr(u)}catch(l){this.logger.error(`Failed to decode message from topic: '${n}', clientId: '${await this.getClientId()}'`),this.logger.error(l)}}),ve(this,"getPayloadType",(n,s=Me)=>{const o=hr({encoded:n,encoding:s});return ci(o.type)}),ve(this,"getPayloadSenderPublicKey",(n,s=Me)=>{const o=hr({encoded:n,encoding:s});return o.senderPublicKey?je(o.senderPublicKey,Se):void 0}),this.core=t,this.logger=Ce(e,this.name),this.keychain=r||new Q0(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(Xa)}catch{t=ws(),await this.keychain.set(Xa,t)}return J0(t,"base16")}getSymKey(t){return this.keychain.get(t)}isInitialized(){if(!this.initialized){const{message:t}=N("NOT_INITIALIZED",this.name);throw new Error(t)}}}var iv=Object.defineProperty,rv=Object.defineProperties,nv=Object.getOwnPropertyDescriptors,ac=Object.getOwnPropertySymbols,sv=Object.prototype.hasOwnProperty,ov=Object.prototype.propertyIsEnumerable,As=(i,t,e)=>t in i?iv(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,av=(i,t)=>{for(var e in t||(t={}))sv.call(t,e)&&As(i,e,t[e]);if(ac)for(var e of ac(t))ov.call(t,e)&&As(i,e,t[e]);return i},cv=(i,t)=>rv(i,nv(t)),Fe=(i,t,e)=>As(i,typeof t!="symbol"?t+"":t,e);class lv extends Hp{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",Xg),Fe(this,"version",eE),Fe(this,"initialized",!1),Fe(this,"storagePrefix",wt),Fe(this,"init",async()=>{if(!this.initialized){this.logger.trace("Initialized");try{const r=await this.getRelayerMessages();typeof r<"u"&&(this.messages=r);const n=await this.getRelayerMessagesWithoutClientAck();typeof n<"u"&&(this.messagesWithoutClientAck=n),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(r){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(r)}finally{this.initialized=!0}}}),Fe(this,"set",async(r,n,s)=>{this.isInitialized();const o=Xe(n);let c=this.messages.get(r);if(typeof c>"u"&&(c={}),typeof c[o]<"u")return o;if(c[o]=n,this.messages.set(r,c),s===Br.inbound){const l=this.messagesWithoutClientAck.get(r)||{};this.messagesWithoutClientAck.set(r,cv(av({},l),{[o]:n}))}return await this.persist(),o}),Fe(this,"get",r=>{this.isInitialized();let n=this.messages.get(r);return typeof n>"u"&&(n={}),n}),Fe(this,"getWithoutAck",r=>{this.isInitialized();const n={};for(const s of r){const o=this.messagesWithoutClientAck.get(s)||{};n[s]=Object.values(o)}return n}),Fe(this,"has",(r,n)=>{this.isInitialized();const s=this.get(r),o=Xe(n);return typeof s[o]<"u"}),Fe(this,"ack",async(r,n)=>{this.isInitialized();const s=this.messagesWithoutClientAck.get(r);if(typeof s>"u")return;const o=Xe(n);delete s[o],Object.keys(s).length===0?this.messagesWithoutClientAck.delete(r):this.messagesWithoutClientAck.set(r,s),await this.persist()}),Fe(this,"del",async r=>{this.isInitialized(),this.messages.delete(r),this.messagesWithoutClientAck.delete(r),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,as(t))}async setRelayerMessagesWithoutClientAck(t){await this.core.storage.setItem(this.storageKeyWithoutClientAck,as(t))}async getRelayerMessages(){const t=await this.core.storage.getItem(this.storageKey);return typeof t<"u"?cs(t):void 0}async getRelayerMessagesWithoutClientAck(){const t=await this.core.storage.getItem(this.storageKeyWithoutClientAck);return typeof t<"u"?cs(t):void 0}async persist(){await this.setRelayerMessages(this.messages),await this.setRelayerMessagesWithoutClientAck(this.messagesWithoutClientAck)}isInitialized(){if(!this.initialized){const{message:t}=N("NOT_INITIALIZED",this.name);throw new Error(t)}}}var uv=Object.defineProperty,hv=Object.defineProperties,dv=Object.getOwnPropertyDescriptors,cc=Object.getOwnPropertySymbols,pv=Object.prototype.hasOwnProperty,_v=Object.prototype.propertyIsEnumerable,Ts=(i,t,e)=>t in i?uv(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,yi=(i,t)=>{for(var e in t||(t={}))pv.call(t,e)&&Ts(i,e,t[e]);if(cc)for(var e of cc(t))_v.call(t,e)&&Ts(i,e,t[e]);return i},lc=(i,t)=>hv(i,dv(t)),Ze=(i,t,e)=>Ts(i,typeof t!="symbol"?t+"":t,e);class fv extends Gp{constructor(t,e){super(t,e),this.relayer=t,this.logger=e,Ze(this,"events",new ui.EventEmitter),Ze(this,"name",iE),Ze(this,"queue",new Map),Ze(this,"publishTimeout",B.toMiliseconds(B.ONE_MINUTE)),Ze(this,"initialPublishTimeout",B.toMiliseconds(B.ONE_SECOND*15)),Ze(this,"needsTransportRestart",!1),Ze(this,"publish",async(r,n,s)=>{var o,c,l,u,h;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:r,message:n,opts:s}});const d=(s==null?void 0:s.ttl)||tE,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=vi(tn().protocol),y={id:f,method:(s==null?void 0:s.publishMethod)||m.publish,params:yi({topic:r,message:n,ttl:d,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 R=new Promise(async v=>{const P=({id:g})=>{var D;((D=y.id)==null?void 0:D.toString())===g.toString()&&(this.removeRequestFromQueue(g),this.relayer.events.removeListener(le.publish,P),v())};this.relayer.events.on(le.publish,P);const T=mt(new Promise((g,D)=>{this.rpcPublish(y,s).then(g).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 T,this.events.removeListener(le.publish,P)}catch(g){this.queue.set(f,{request:y,opts:s,attempt:1}),this.logger.warn(g,g==null?void 0:g.message)}});this.logger.trace({type:"method",method:"publish",params:{id:f,topic:r,message:n,opts:s}}),await mt(R,this.publishTimeout,b)}catch(R){if(this.logger.debug("Failed to Publish Payload"),this.logger.error(R),(h=s==null?void 0:s.internal)!=null&&h.throwOnFailedPublish)throw R}finally{this.queue.delete(f)}}),Ze(this,"publishCustom",async r=>{var n,s,o,c,l;this.logger.debug("Publishing custom payload"),this.logger.trace({type:"method",method:"publishCustom",params:r});const{payload:u,opts:h={}}=r,{attestation:d,tvf:p,publishMethod:_,prompt:f,tag:m,ttl:y=B.FIVE_MINUTES}=h,b=h.id||Xt().toString(),R=vi(tn().protocol),v=_||R.publish,P={id:b,method:v,params:yi(lc(yi({},u),{ttl:y,prompt:f,tag:m,attestation:d}),p)},T=`Failed to publish custom payload, please try again. id:${b} tag:${m}`;try{fe((n=P.params)==null?void 0:n.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 g=new Promise(async D=>{const L=({id:E})=>{var I;((I=P.id)==null?void 0:I.toString())===E.toString()&&(this.removeRequestFromQueue(E),this.relayer.events.removeListener(le.publish,L),D())};this.relayer.events.on(le.publish,L);const w=mt(new Promise((E,I)=>{this.rpcPublish(P,h).then(E).catch(A=>{this.logger.warn(A,A==null?void 0:A.message),I(A)})}),this.initialPublishTimeout,`Failed initial custom payload publish, retrying.... method:${v} id:${b} tag:${m}`);try{await w,this.events.removeListener(le.publish,L)}catch(E){this.queue.set(b,{request:P,opts:h,attempt:1}),this.logger.warn(E,E==null?void 0:E.message)}});this.logger.trace({type:"method",method:"publish",params:{id:b,payload:u,opts:h}}),await mt(g,this.publishTimeout,T)}catch(g){if(this.logger.debug("Failed to Publish Payload"),this.logger.error(g),(l=h==null?void 0:h.internal)!=null&&l.throwOnFailedPublish)throw g}finally{this.queue.delete(b)}}),Ze(this,"on",(r,n)=>{this.events.on(r,n)}),Ze(this,"once",(r,n)=>{this.events.once(r,n)}),Ze(this,"off",(r,n)=>{this.events.off(r,n)}),Ze(this,"removeListener",(r,n)=>{this.events.removeListener(r,n)}),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 r=await this.relayer.request(t);return this.relayer.events.emit(le.publish,yi(yi({},t),e)),this.logger.debug("Successfully Published Payload"),r}removeRequestFromQueue(t){this.queue.delete(t)}checkQueue(){this.queue.forEach(async(t,e)=>{var r;const n=t.attempt+1;this.queue.set(e,lc(yi({},t),{attempt:n})),this.logger.warn({},`Publisher: queue->publishing: ${t.request.id}, tag: ${(r=t.request.params)==null?void 0:r.tag}, attempt: ${n}`),await this.rpcPublish(t.request,t.opts),this.logger.warn({},`Publisher: queue->published: ${t.request.id}`)})}registerEventListeners(){this.relayer.core.heartbeat.on(Pi.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 mv=Object.defineProperty,yv=(i,t,e)=>t in i?mv(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,wi=(i,t,e)=>yv(i,typeof t!="symbol"?t+"":t,e);class wv{constructor(){wi(this,"map",new Map),wi(this,"set",(t,e)=>{const r=this.get(t);this.exists(t,e)||this.map.set(t,[...r,e])}),wi(this,"get",t=>this.map.get(t)||[]),wi(this,"exists",(t,e)=>this.get(t).includes(e)),wi(this,"delete",(t,e)=>{if(typeof e>"u"){this.map.delete(t);return}if(!this.map.has(t))return;const r=this.get(t);if(!this.exists(t,e))return;const n=r.filter(s=>s!==e);if(!n.length){this.map.delete(t);return}this.map.set(t,n)}),wi(this,"clear",()=>{this.map.clear()})}get topics(){return Array.from(this.map.keys())}}var gv=Object.defineProperty,Ev=Object.defineProperties,vv=Object.getOwnPropertyDescriptors,uc=Object.getOwnPropertySymbols,bv=Object.prototype.hasOwnProperty,Iv=Object.prototype.propertyIsEnumerable,Ps=(i,t,e)=>t in i?gv(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Ki=(i,t)=>{for(var e in t||(t={}))bv.call(t,e)&&Ps(i,e,t[e]);if(uc)for(var e of uc(t))Iv.call(t,e)&&Ps(i,e,t[e]);return i},Nn=(i,t)=>Ev(i,vv(t)),re=(i,t,e)=>Ps(i,typeof t!="symbol"?t+"":t,e);class Av extends Zp{constructor(t,e){super(t,e),this.relayer=t,this.logger=e,re(this,"subscriptions",new Map),re(this,"topicMap",new wv),re(this,"events",new ui.EventEmitter),re(this,"name",lE),re(this,"version",uE),re(this,"pending",new Map),re(this,"cached",[]),re(this,"initialized",!1),re(this,"storagePrefix",wt),re(this,"subscribeTimeout",B.toMiliseconds(B.ONE_MINUTE)),re(this,"initialSubscribeTimeout",B.toMiliseconds(B.ONE_SECOND*15)),re(this,"clientId"),re(this,"batchSubscribeTopicsLimit",500),re(this,"init",async()=>{this.initialized||(this.logger.trace("Initialized"),this.registerEventListeners(),await this.restore()),this.initialized=!0}),re(this,"subscribe",async(r,n)=>{var s;this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:r,opts:n}});try{const o=tn(n),c={topic:r,relay:o,transportType:n==null?void 0:n.transportType};(s=n==null?void 0:n.internal)!=null&&s.skipSubscribe||this.pending.set(r,c);const l=await this.rpcSubscribe(r,o,n);return typeof l=="string"&&(this.onSubscribe(l,c),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:r,opts:n}})),l}catch(o){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(o),o}}),re(this,"unsubscribe",async(r,n)=>{this.isInitialized(),typeof(n==null?void 0:n.id)<"u"?await this.unsubscribeById(r,n.id,n):await this.unsubscribeByTopic(r,n)}),re(this,"isSubscribed",r=>new Promise(n=>{n(this.topicMap.topics.includes(r))})),re(this,"isKnownTopic",r=>new Promise(n=>{n(this.topicMap.topics.includes(r)||this.pending.has(r)||this.cached.some(s=>s.topic===r))})),re(this,"on",(r,n)=>{this.events.on(r,n)}),re(this,"once",(r,n)=>{this.events.once(r,n)}),re(this,"off",(r,n)=>{this.events.off(r,n)}),re(this,"removeListener",(r,n)=>{this.events.removeListener(r,n)}),re(this,"start",async()=>{await this.onConnect()}),re(this,"stop",async()=>{await this.onDisconnect()}),re(this,"restart",async()=>{await this.restore(),await this.onRestart()}),re(this,"checkPending",async()=>{if(this.pending.size===0&&(!this.initialized||!this.relayer.connected))return;const r=[];this.pending.forEach(n=>{r.push(n)}),await this.batchSubscribe(r)}),re(this,"registerEventListeners",()=>{this.relayer.core.heartbeat.on(Pi.pulse,async()=>{await this.checkPending()}),this.events.on(We.created,async r=>{const n=We.created;this.logger.info(`Emitting ${n}`),this.logger.debug({type:"event",event:n,data:r}),await this.persist()}),this.events.on(We.deleted,async r=>{const n=We.deleted;this.logger.info(`Emitting ${n}`),this.logger.debug({type:"event",event:n,data:r}),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 r=!1;try{r=this.getSubscription(t).topic===e}catch{}return r}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 r=this.topicMap.get(t);await Promise.all(r.map(async n=>await this.unsubscribeById(t,n,e)))}async unsubscribeById(t,e,r){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:t,id:e,opts:r}});try{const n=tn(r);await this.restartToComplete({topic:t,id:e,relay:n}),await this.rpcUnsubscribe(t,e,n);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:r}})}catch(n){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(n),n}}async rpcSubscribe(t,e,r){var n,s;const o=await this.getSubscriptionId(t);if((n=r==null?void 0:r.internal)!=null&&n.skipSubscribe)return o;(!r||(r==null?void 0:r.transportType)===se.relay)&&await this.restartToComplete({topic:t,id:t,relay:e});const c={method:vi(e.protocol).subscribe,params:{topic:t}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:c});const l=(s=r==null?void 0:r.internal)==null?void 0:s.throwOnFailedPublish;try{if((r==null?void 0:r.transportType)===se.link_mode)return setTimeout(()=>{(this.relayer.connected||this.relayer.connecting)&&this.relayer.request(c).catch(d=>this.logger.warn(d))},B.toMiliseconds(B.ONE_SECOND)),o;const u=new Promise(async d=>{const p=_=>{_.topic===t&&(this.events.removeListener(We.created,p),d(_.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),d(_)}catch{}}),h=await mt(u,this.subscribeTimeout,`Subscribing to ${t} failed, please try again`);if(!h&&l)throw new Error(`Subscribing to ${t} failed, please try again`);return h?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,r={method:vi(e.protocol).batchSubscribe,params:{topics:t.map(n=>n.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:r});try{await await mt(new Promise(n=>{this.relayer.request(r).catch(s=>this.logger.warn(s)).then(n)}),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,r={method:vi(e.protocol).batchFetchMessages,params:{topics:t.map(s=>s.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:r});let n;try{n=await await mt(new Promise((s,o)=>{this.relayer.request(r).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 n}rpcUnsubscribe(t,e,r){const n={method:vi(r.protocol).unsubscribe,params:{topic:t,id:e}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n}),this.relayer.request(n)}onSubscribe(t,e){this.setSubscription(t,Nn(Ki({},e),{id:t})),this.pending.delete(e.topic)}onBatchSubscribe(t){t.length&&t.forEach(e=>{this.setSubscription(e.id,Ki({},e)),this.pending.delete(e.topic)})}async onUnsubscribe(t,e,r){this.events.removeAllListeners(e),this.hasSubscription(e,t)&&this.deleteSubscription(e,r),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,Ki({},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:r}=N("NO_MATCHING_KEY",`${this.name}: ${t}`);throw new Error(r)}return e}deleteSubscription(t,e){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:t,reason:e});const r=this.getSubscription(t);this.subscriptions.delete(t),this.topicMap.delete(r.topic,t),this.events.emit(We.deleted,Nn(Ki({},r),{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 r=0;r<e;r++){const n=t.splice(0,this.batchSubscribeTopicsLimit);await this.batchSubscribe(n)}}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 r;return e.topic===((r=this.subscriptions.get(e.id))==null?void 0:r.topic)})){const{message:e}=N("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=>Nn(Ki({},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 im(B.toMiliseconds(B.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}=N("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 Xe(t+await this.getClientId())}}var Tv=Object.defineProperty,hc=Object.getOwnPropertySymbols,Pv=Object.prototype.hasOwnProperty,Ov=Object.prototype.propertyIsEnumerable,Os=(i,t,e)=>t in i?Tv(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,dc=(i,t)=>{for(var e in t||(t={}))Pv.call(t,e)&&Os(i,e,t[e]);if(hc)for(var e of hc(t))Ov.call(t,e)&&Os(i,e,t[e]);return i},X=(i,t,e)=>Os(i,typeof t!="symbol"?t+"":t,e);class Rv extends Jp{constructor(t){super(t),X(this,"protocol","wc"),X(this,"version",2),X(this,"core"),X(this,"logger"),X(this,"events",new ui.EventEmitter),X(this,"provider"),X(this,"messages"),X(this,"subscriber"),X(this,"publisher"),X(this,"name",nE),X(this,"transportExplicitlyClosed",!1),X(this,"initialized",!1),X(this,"connectionAttemptInProgress",!1),X(this,"relayUrl"),X(this,"projectId"),X(this,"packageName"),X(this,"bundleId"),X(this,"hasExperiencedNetworkDisruption",!1),X(this,"pingTimeout"),X(this,"heartBeatTimeout",B.toMiliseconds(B.THIRTY_SECONDS+B.FIVE_SECONDS)),X(this,"reconnectTimeout"),X(this,"connectPromise"),X(this,"reconnectInProgress",!1),X(this,"requestsInFlight",[]),X(this,"connectTimeout",B.toMiliseconds(B.ONE_SECOND*15)),X(this,"request",async e=>{var r,n;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:(r=e.params)==null?void 0:r.topic},"relayer.request - publishing...");const o=`${s}:${((n=e.params)==null?void 0:n.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}}),X(this,"resetPingTimeout",()=>{Zr()&&(clearTimeout(this.pingTimeout),this.pingTimeout=setTimeout(()=>{var e,r,n,s;try{this.logger.debug({},"pingTimeout: Connection stalled, terminating..."),(s=(n=(r=(e=this.provider)==null?void 0:e.connection)==null?void 0:r.socket)==null?void 0:n.terminate)==null||s.call(n)}catch(o){this.logger.warn(o,o==null?void 0:o.message)}},this.heartBeatTimeout))}),X(this,"onPayloadHandler",e=>{this.onProviderPayload(e),this.resetPingTimeout()}),X(this,"onConnectHandler",()=>{this.logger.warn({},"Relayer connected 🛜"),this.startPingTimeout(),this.events.emit(le.connect)}),X(this,"onDisconnectHandler",()=>{this.logger.warn({},"Relayer disconnected 🛑"),this.requestsInFlight=[],this.onProviderDisconnect()}),X(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()}),X(this,"registerProviderListeners",()=>{this.provider.on(Ye.payload,this.onPayloadHandler),this.provider.on(Ye.connect,this.onConnectHandler),this.provider.on(Ye.disconnect,this.onDisconnectHandler),this.provider.on(Ye.error,this.onProviderErrorHandler)}),this.core=t.core,this.logger=typeof t.logger<"u"&&typeof t.logger!="string"?Ce(t.logger,this.name):on(eo({level:t.logger||rE})),this.messages=new lv(this.logger,t.core),this.subscriber=new Av(this,this.logger),this.publisher=new fv(this,this.logger),this.projectId=t==null?void 0:t.projectId,this.relayUrl=(t==null?void 0:t.relayUrl)||$u,Mf()?this.packageName=ca():qf()&&(this.bundleId=ca()),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,r;return((r=(e=(t=this.provider)==null?void 0:t.connection)==null?void 0:e.socket)==null?void 0:r.readyState)===1||!1}get connecting(){var t,e,r;return((r=(e=(t=this.provider)==null?void 0:t.connection)==null?void 0:e.socket)==null?void 0:r.readyState)===0||this.connectPromise!==void 0||!1}async publish(t,e,r){this.isInitialized(),await this.publisher.publish(t,e,r),await this.recordMessageEvent({topic:t,message:e,publishedAt:Date.now(),transportType:se.relay},Br.outbound)}async publishCustom(t){this.isInitialized(),await this.publisher.publishCustom(t)}async subscribe(t,e){var r,n,s;this.isInitialized(),(!(e!=null&&e.transportType)||(e==null?void 0:e.transportType)==="relay")&&await this.toEstablishConnection();const o=typeof((r=e==null?void 0:e.internal)==null?void 0:r.throwOnFailedPublish)>"u"?!0:(n=e==null?void 0:e.internal)==null?void 0:n.throwOnFailedPublish;let c=((s=this.subscriber.topicMap.get(t))==null?void 0:s[0])||"",l;const u=h=>{h.topic===t&&(this.subscriber.off(We.created,u),l())};return await Promise.all([new Promise(h=>{l=h,this.subscriber.on(We.created,u)}),new Promise(async(h,d)=>{c=await this.subscriber.subscribe(t,dc({internal:{throwOnFailedPublish:o}},e)).catch(p=>{o&&d(p)})||c,h()})]),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,r)=>{await this.connect(t).then(e).catch(r).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 Qa())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((r,n)=>r.publishedAt-n.publishedAt);this.logger.debug(`Batch of ${e.length} message events sorted`);for(const r of e)try{await this.onMessageEvent(r)}catch(n){this.logger.warn(n,"Error while processing batch message event: "+(n==null?void 0:n.message))}this.logger.trace(`Batch of ${e.length} message events processed`)}async onLinkMessageEvent(t,e){const{topic:r}=t;if(!e.sessionExists){const n=_e(B.FIVE_MINUTES),s={topic:r,expiry:n,relay:{protocol:"irn"},active:!1};await this.core.pairing.pairings.set(r,s)}this.events.emit(le.message,t),await this.recordMessageEvent(t,Br.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(r,n)=>{const s=()=>{n(new Error("Connection interrupted while trying to connect"))};this.provider.once(Ye.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=>{n(o)}).finally(()=>{this.provider.off(Ye.disconnect,s),clearTimeout(this.reconnectTimeout)}),await new Promise(async(o,c)=>{const l=()=>{n(new Error("Connection interrupted while trying to subscribe"))};this.provider.once(Ye.disconnect,l),await this.subscriber.start().then(o).catch(c).finally(()=>{this.provider.off(Ye.disconnect,l)})}),this.hasExperiencedNetworkDisruption=!1,r()})}catch(r){await this.subscriber.stop();const n=r;this.logger.warn({},n.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(r=>setTimeout(r,B.toMiliseconds(e*1))),e++}}startPingTimeout(){var t,e,r,n,s;if(Zr())try{(e=(t=this.provider)==null?void 0:t.connection)!=null&&e.socket&&((s=(n=(r=this.provider)==null?void 0:r.connection)==null?void 0:n.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 rd(new nd(Wf({sdkVersion:vs,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:r,message:n}=t;await this.messages.set(r,n,e)}async shouldIgnoreMessageEvent(t){const{topic:e,message:r}=t;if(!r||r.length===0)return this.logger.warn(`Ignoring invalid/empty message: ${r}`),!0;if(!await this.subscriber.isKnownTopic(e))return this.logger.warn(`Ignoring message for unknown topic ${e}`),!0;const n=this.messages.has(e,r);return n&&this.logger.warn(`Ignoring duplicate message: ${r}`),n}async onProviderPayload(t){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:t}),zs(t)){if(!t.method.endsWith(sE))return;const e=t.params,{topic:r,message:n,publishedAt:s,attestation:o}=e.data,c={topic:r,message:n,publishedAt:s,transportType:se.relay,attestation:o};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(dc({type:"event",event:e.id},c)),this.events.emit(e.id,c),await this.acknowledgePayload(t),await this.onMessageEvent(c)}else js(t)&&this.events.emit(le.message_ack,t)}async onMessageEvent(t){await this.shouldIgnoreMessageEvent(t)||(await this.recordMessageEvent(t,Br.inbound),this.events.emit(le.message,t))}async acknowledgePayload(t){const e=Kr(t.id,!0);await this.provider.connection.send(e)}unregisterProviderListeners(){this.provider.off(Ye.payload,this.onPayloadHandler),this.provider.off(Ye.connect,this.onConnectHandler),this.provider.off(Ye.disconnect,this.onDisconnectHandler),this.provider.off(Ye.error,this.onProviderErrorHandler),clearTimeout(this.pingTimeout)}async registerEventListeners(){let t=await Qa();Cg(async e=>{t!==e&&(t=e,e?await this.transportOpen().catch(r=>this.logger.error(r,r==null?void 0:r.message)):(this.hasExperiencedNetworkDisruption=!0,await this.transportDisconnect(),this.transportExplicitlyClosed=!1))}),this.core.heartbeat.on(Pi.pulse,async()=>{if(!this.transportExplicitlyClosed&&!this.connected&&Ug())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},B.toMiliseconds(oE)))))}isInitialized(){if(!this.initialized){const{message:t}=N("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 Lv(i,t){return i===t||Number.isNaN(i)&&Number.isNaN(t)}function pc(i){return Object.getOwnPropertySymbols(i).filter(t=>Object.prototype.propertyIsEnumerable.call(i,t))}function _c(i){return i==null?i===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(i)}const Dv="[object RegExp]",Vv="[object String]",xv="[object Number]",Sv="[object Boolean]",fc="[object Arguments]",Cv="[object Symbol]",$v="[object Date]",kv="[object Map]",Uv="[object Set]",Nv="[object Array]",Bv="[object Function]",Mv="[object ArrayBuffer]",Bn="[object Object]",qv="[object Error]",zv="[object DataView]",jv="[object Uint8Array]",Kv="[object Uint8ClampedArray]",Fv="[object Uint16Array]",Wv="[object Uint32Array]",Hv="[object BigUint64Array]",Gv="[object Int8Array]",Jv="[object Int16Array]",Yv="[object Int32Array]",Zv="[object BigInt64Array]",Qv="[object Float32Array]",Xv="[object Float64Array]";function eb(){}function mc(i){if(!i||typeof i!="object")return!1;const t=Object.getPrototypeOf(i);return t===null||t===Object.prototype||Object.getPrototypeOf(t)===null?Object.prototype.toString.call(i)==="[object Object]":!1}function tb(i,t,e){return Ji(i,t,void 0,void 0,void 0,void 0,e)}function Ji(i,t,e,r,n,s,o){const c=o(i,t,e,r,n,s);if(c!==void 0)return c;if(typeof i==typeof t)switch(typeof i){case"bigint":case"string":case"boolean":case"symbol":case"undefined":return i===t;case"number":return i===t||Object.is(i,t);case"function":return i===t;case"object":return rr(i,t,s,o)}return rr(i,t,s,o)}function rr(i,t,e,r){if(Object.is(i,t))return!0;let n=_c(i),s=_c(t);if(n===fc&&(n=Bn),s===fc&&(s=Bn),n!==s)return!1;switch(n){case Vv:return i.toString()===t.toString();case xv:{const l=i.valueOf(),u=t.valueOf();return Lv(l,u)}case Sv:case $v:case Cv:return Object.is(i.valueOf(),t.valueOf());case Dv:return i.source===t.source&&i.flags===t.flags;case Bv:return i===t}e=e??new Map;const o=e.get(i),c=e.get(t);if(o!=null&&c!=null)return o===t;e.set(i,t),e.set(t,i);try{switch(n){case kv:{if(i.size!==t.size)return!1;for(const[l,u]of i.entries())if(!t.has(l)||!Ji(u,t.get(l),l,i,t,e,r))return!1;return!0}case Uv:{if(i.size!==t.size)return!1;const l=Array.from(i.values()),u=Array.from(t.values());for(let h=0;h<l.length;h++){const d=l[h],p=u.findIndex(_=>Ji(d,_,void 0,i,t,e,r));if(p===-1)return!1;u.splice(p,1)}return!0}case Nv:case jv:case Kv:case Fv:case Wv:case Hv:case Gv:case Jv:case Yv:case Zv:case Qv:case Xv:{if(typeof ee<"u"&&ee.isBuffer(i)!==ee.isBuffer(t)||i.length!==t.length)return!1;for(let l=0;l<i.length;l++)if(!Ji(i[l],t[l],l,i,t,e,r))return!1;return!0}case Mv:return i.byteLength!==t.byteLength?!1:rr(new Uint8Array(i),new Uint8Array(t),e,r);case zv:return i.byteLength!==t.byteLength||i.byteOffset!==t.byteOffset?!1:rr(new Uint8Array(i),new Uint8Array(t),e,r);case qv:return i.name===t.name&&i.message===t.message;case Bn:{if(!(rr(i.constructor,t.constructor,e,r)||mc(i)&&mc(t)))return!1;const l=[...Object.keys(i),...pc(i)],u=[...Object.keys(t),...pc(t)];if(l.length!==u.length)return!1;for(let h=0;h<l.length;h++){const d=l[h],p=i[d];if(!Object.hasOwn(t,d))return!1;const _=t[d];if(!Ji(p,_,d,i,t,e,r))return!1}return!0}default:return!1}}finally{e.delete(i),e.delete(t)}}function ib(i,t){return tb(i,t,eb)}var rb=Object.defineProperty,yc=Object.getOwnPropertySymbols,nb=Object.prototype.hasOwnProperty,sb=Object.prototype.propertyIsEnumerable,Rs=(i,t,e)=>t in i?rb(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,wc=(i,t)=>{for(var e in t||(t={}))nb.call(t,e)&&Rs(i,e,t[e]);if(yc)for(var e of yc(t))sb.call(t,e)&&Rs(i,e,t[e]);return i},$e=(i,t,e)=>Rs(i,typeof t!="symbol"?t+"":t,e);class pi extends Yp{constructor(t,e,r,n=wt,s=void 0){super(t,e,r,n),this.core=t,this.logger=e,this.name=r,$e(this,"map",new Map),$e(this,"version",aE),$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):hg(o)?this.map.set(o.id,o):dg(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=>ib(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=wc(wc({},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=n,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:n}=N("MISSING_OR_INVALID",`Record was recently deleted - ${this.name}: ${t}`);throw this.logger.error(n),new Error(n)}const{message:r}=N("NO_MATCHING_KEY",`${this.name}: ${t}`);throw this.logger.error(r),new Error(r)}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}=N("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}=N("NOT_INITIALIZED",this.name);throw new Error(t)}}}var ob=Object.defineProperty,ab=(i,t,e)=>t in i?ob(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,J=(i,t,e)=>ab(i,typeof t!="symbol"?t+"":t,e);class cb{constructor(t,e){this.core=t,this.logger=e,J(this,"name",hE),J(this,"version",dE),J(this,"events",new Wc),J(this,"pairings"),J(this,"initialized",!1),J(this,"storagePrefix",wt),J(this,"ignoredPayloadTypes",[Ot]),J(this,"registeredMethods",[]),J(this,"init",async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"))}),J(this,"register",({methods:r})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...r])]}),J(this,"create",async r=>{this.isInitialized();const n=ws(),s=await this.core.crypto.setSymKey(n),o=_e(B.FIVE_MINUTES),c={protocol:Cu},l={topic:s,expiry:o,relay:c,active:!1,methods:r==null?void 0:r.methods},u=ja({protocol:this.core.protocol,version:this.core.version,topic:s,symKey:n,relay:c,expiryTimestamp:o,methods:r==null?void 0:r.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:r==null?void 0:r.transportType,internal:r==null?void 0:r.internal}),{topic:s,uri:u}}),J(this,"pair",async r=>{this.isInitialized();const n=this.core.eventClient.createEvent({properties:{topic:r==null?void 0:r.uri,trace:[pt.pairing_started]}});this.isValidPair(r,n);const{topic:s,symKey:o,relay:c,expiryTimestamp:l,methods:u}=za(r.uri);n.props.properties.topic=s,n.addTrace(pt.pairing_uri_validation_success),n.addTrace(pt.pairing_uri_not_expired);let h;if(this.pairings.keys.includes(s)){if(h=this.pairings.get(s),n.addTrace(pt.existing_pairing),h.active)throw n.setError(At.active_pairing_already_exists),new Error(`Pairing already exists: ${s}. Please try again with a new connection URI.`);n.addTrace(pt.pairing_not_expired)}const d=l||_e(B.FIVE_MINUTES),p={topic:s,relay:c,expiry:d,active:!1,methods:u};this.core.expirer.set(s,d),await this.pairings.set(s,p),n.addTrace(pt.store_new_pairing),r.activatePairing&&await this.activate({topic:s}),this.events.emit(Qt.create,p),n.addTrace(pt.emit_inactive_pairing),this.core.crypto.keychain.has(s)||await this.core.crypto.setSymKey(o,s),n.addTrace(pt.subscribing_pairing_topic);try{await this.core.relayer.confirmOnlineStateOrThrow()}catch{n.setError(At.no_internet_connection)}try{await this.core.relayer.subscribe(s,{relay:c})}catch(_){throw n.setError(At.subscribe_pairing_topic_failure),_}return n.addTrace(pt.subscribe_pairing_topic_success),p}),J(this,"activate",async({topic:r})=>{this.isInitialized();const n=_e(B.FIVE_MINUTES);this.core.expirer.set(r,n),await this.pairings.update(r,{active:!0,expiry:n})}),J(this,"ping",async r=>{this.isInitialized(),await this.isValidPing(r),this.logger.warn("ping() is deprecated and will be removed in the next major release.");const{topic:n}=r;if(this.pairings.keys.includes(n)){const s=await this.sendRequest(n,"wc_pairingPing",{}),{done:o,resolve:c,reject:l}=Zt();this.events.once(te("pairing_ping",s),({error:u})=>{u?l(u):c()}),await o()}}),J(this,"updateExpiry",async({topic:r,expiry:n})=>{this.isInitialized(),await this.pairings.update(r,{expiry:n})}),J(this,"updateMetadata",async({topic:r,metadata:n})=>{this.isInitialized(),await this.pairings.update(r,{peerMetadata:n})}),J(this,"getPairings",()=>(this.isInitialized(),this.pairings.values)),J(this,"disconnect",async r=>{this.isInitialized(),await this.isValidDisconnect(r);const{topic:n}=r;this.pairings.keys.includes(n)&&(await this.sendRequest(n,"wc_pairingDelete",ae("USER_DISCONNECTED")),await this.deletePairing(n))}),J(this,"formatUriFromPairing",r=>{this.isInitialized();const{topic:n,relay:s,expiry:o,methods:c}=r,l=this.core.crypto.keychain.get(n);return ja({protocol:this.core.protocol,version:this.core.version,topic:n,symKey:l,relay:s,expiryTimestamp:o,methods:c})}),J(this,"sendRequest",async(r,n,s)=>{const o=Nt(n,s),c=await this.core.crypto.encode(r,o),l=qi[n].req;return this.core.history.set(r,o),this.core.relayer.publish(r,c,l),o.id}),J(this,"sendResult",async(r,n,s)=>{const o=Kr(r,s),c=await this.core.crypto.encode(n,o),l=(await this.core.history.get(n,r)).request.method,u=qi[l].res;await this.core.relayer.publish(n,c,u),await this.core.history.resolve(o)}),J(this,"sendError",async(r,n,s)=>{const o=Hc(r,s),c=await this.core.crypto.encode(n,o),l=(await this.core.history.get(n,r)).request.method,u=qi[l]?qi[l].res:qi.unregistered_method.res;await this.core.relayer.publish(n,c,u),await this.core.history.resolve(o)}),J(this,"deletePairing",async(r,n)=>{await this.core.relayer.unsubscribe(r),await Promise.all([this.pairings.delete(r,ae("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(r),n?Promise.resolve():this.core.expirer.del(r)])}),J(this,"cleanup",async()=>{const r=this.pairings.getAll().filter(n=>Bt(n.expiry));await Promise.all(r.map(n=>this.deletePairing(n.topic)))}),J(this,"onRelayEventRequest",async r=>{const{topic:n,payload:s}=r;switch(s.method){case"wc_pairingPing":return await this.onPairingPingRequest(n,s);case"wc_pairingDelete":return await this.onPairingDeleteRequest(n,s);default:return await this.onUnknownRpcMethodRequest(n,s)}}),J(this,"onRelayEventResponse",async r=>{const{topic:n,payload:s}=r,o=(await this.core.history.get(n,s.id)).request.method;switch(o){case"wc_pairingPing":return this.onPairingPingResponse(n,s);default:return this.onUnknownRpcMethodResponse(o)}}),J(this,"onPairingPingRequest",async(r,n)=>{const{id:s}=n;try{this.isValidPing({topic:r}),await this.sendResult(s,r,!0),this.events.emit(Qt.ping,{id:s,topic:r})}catch(o){await this.sendError(s,r,o),this.logger.error(o)}}),J(this,"onPairingPingResponse",(r,n)=>{const{id:s}=n;setTimeout(()=>{bt(n)?this.events.emit(te("pairing_ping",s),{}):_t(n)&&this.events.emit(te("pairing_ping",s),{error:n.error})},500)}),J(this,"onPairingDeleteRequest",async(r,n)=>{const{id:s}=n;try{this.isValidDisconnect({topic:r}),await this.deletePairing(r),this.events.emit(Qt.delete,{id:s,topic:r})}catch(o){await this.sendError(s,r,o),this.logger.error(o)}}),J(this,"onUnknownRpcMethodRequest",async(r,n)=>{const{id:s,method:o}=n;try{if(this.registeredMethods.includes(o))return;const c=ae("WC_METHOD_UNSUPPORTED",o);await this.sendError(s,r,c),this.logger.error(c)}catch(c){await this.sendError(s,r,c),this.logger.error(c)}}),J(this,"onUnknownRpcMethodResponse",r=>{this.registeredMethods.includes(r)||this.logger.error(ae("WC_METHOD_UNSUPPORTED",r))}),J(this,"isValidPair",(r,n)=>{var s;if(!Ue(r)){const{message:c}=N("MISSING_OR_INVALID",`pair() params: ${r}`);throw n.setError(At.malformed_pairing_uri),new Error(c)}if(!ug(r.uri)){const{message:c}=N("MISSING_OR_INVALID",`pair() uri: ${r.uri}`);throw n.setError(At.malformed_pairing_uri),new Error(c)}const o=za(r==null?void 0:r.uri);if(!((s=o==null?void 0:o.relay)!=null&&s.protocol)){const{message:c}=N("MISSING_OR_INVALID","pair() uri#relay-protocol");throw n.setError(At.malformed_pairing_uri),new Error(c)}if(!(o!=null&&o.symKey)){const{message:c}=N("MISSING_OR_INVALID","pair() uri#symKey");throw n.setError(At.malformed_pairing_uri),new Error(c)}if(o!=null&&o.expiryTimestamp&&B.toMiliseconds(o==null?void 0:o.expiryTimestamp)<Date.now()){n.setError(At.pairing_expired);const{message:c}=N("EXPIRED","pair() URI has expired. Please try again with a new connection URI.");throw new Error(c)}}),J(this,"isValidPing",async r=>{if(!Ue(r)){const{message:s}=N("MISSING_OR_INVALID",`ping() params: ${r}`);throw new Error(s)}const{topic:n}=r;await this.isValidPairingTopic(n)}),J(this,"isValidDisconnect",async r=>{if(!Ue(r)){const{message:s}=N("MISSING_OR_INVALID",`disconnect() params: ${r}`);throw new Error(s)}const{topic:n}=r;await this.isValidPairingTopic(n)}),J(this,"isValidPairingTopic",async r=>{if(!de(r,!1)){const{message:n}=N("MISSING_OR_INVALID",`pairing topic should be a string: ${r}`);throw new Error(n)}if(!this.pairings.keys.includes(r)){const{message:n}=N("NO_MATCHING_KEY",`pairing topic doesn't exist: ${r}`);throw new Error(n)}if(Bt(this.pairings.get(r).expiry)){await this.deletePairing(r);const{message:n}=N("EXPIRED",`pairing topic: ${r}`);throw new Error(n)}}),this.core=t,this.logger=Ce(e,this.name),this.pairings=new pi(this.core,this.logger,this.name,this.storagePrefix)}get context(){return Ke(this.logger)}isInitialized(){if(!this.initialized){const{message:t}=N("NOT_INITIALIZED",this.name);throw new Error(t)}}registerRelayerEvents(){this.core.relayer.on(le.message,async t=>{const{topic:e,message:r,transportType:n}=t;if(this.pairings.keys.includes(e)&&n!==se.link_mode&&!this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(r)))try{const s=await this.core.crypto.decode(e,r);zs(s)?(this.core.history.set(e,s),await this.onRelayEventRequest({topic:e,payload:s})):js(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,r)}catch(s){this.logger.error(s)}})}registerExpirerEvents(){this.core.expirer.on(Qe.expired,async t=>{const{topic:e}=Nl(t.target);e&&this.pairings.keys.includes(e)&&(await this.deletePairing(e,!0),this.events.emit(Qt.expire,{topic:e}))})}}var lb=Object.defineProperty,ub=(i,t,e)=>t in i?lb(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,be=(i,t,e)=>ub(i,typeof t!="symbol"?t+"":t,e);class hb extends Wp{constructor(t,e){super(t,e),this.core=t,this.logger=e,be(this,"records",new Map),be(this,"events",new ui.EventEmitter),be(this,"name",pE),be(this,"version",_E),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(r=>this.records.set(r.id,r)),this.cached=[],this.registerEventListeners(),this.initialized=!0)}),be(this,"set",(r,n,s)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:r,request:n,chainId:s}),this.records.has(n.id))return;const o={id:n.id,topic:r,request:{method:n.method,params:n.params||null},chainId:s,expiry:_e(B.THIRTY_DAYS)};this.records.set(o.id,o),this.persist(),this.events.emit(nt.created,o)}),be(this,"resolve",async r=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:r}),!this.records.has(r.id))return;const n=await this.getRecord(r.id);typeof n.response>"u"&&(n.response=_t(r)?{error:r.error}:{result:r.result},this.records.set(n.id,n),this.persist(),this.events.emit(nt.updated,n))}),be(this,"get",async(r,n)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:r,id:n}),await this.getRecord(n))),be(this,"delete",(r,n)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:n}),this.values.forEach(s=>{if(s.topic===r){if(typeof n<"u"&&s.id!==n)return;this.records.delete(s.id),this.events.emit(nt.deleted,s)}}),this.persist()}),be(this,"exists",async(r,n)=>(this.isInitialized(),this.records.has(n)?(await this.getRecord(n)).topic===r:!1)),be(this,"on",(r,n)=>{this.events.on(r,n)}),be(this,"once",(r,n)=>{this.events.once(r,n)}),be(this,"off",(r,n)=>{this.events.off(r,n)}),be(this,"removeListener",(r,n)=>{this.events.removeListener(r,n)}),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 r={topic:e.topic,request:Nt(e.request.method,e.request.params,e.id),chainId:e.chainId};return t.push(r)}),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:r}=N("NO_MATCHING_KEY",`${this.name}: ${t}`);throw new Error(r)}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}=N("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(Pi.pulse,()=>{this.cleanup()})}cleanup(){try{this.isInitialized();let t=!1;this.records.forEach(e=>{B.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}=N("NOT_INITIALIZED",this.name);throw new Error(t)}}}var db=Object.defineProperty,pb=(i,t,e)=>t in i?db(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Re=(i,t,e)=>pb(i,typeof t!="symbol"?t+"":t,e);class _b extends Qp{constructor(t,e){super(t,e),this.core=t,this.logger=e,Re(this,"expirations",new Map),Re(this,"events",new ui.EventEmitter),Re(this,"name",fE),Re(this,"version",mE),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(r=>this.expirations.set(r.target,r)),this.cached=[],this.registerEventListeners(),this.initialized=!0)}),Re(this,"has",r=>{try{const n=this.formatTarget(r);return typeof this.getExpiration(n)<"u"}catch{return!1}}),Re(this,"set",(r,n)=>{this.isInitialized();const s=this.formatTarget(r),o={target:s,expiry:n};this.expirations.set(s,o),this.checkExpiry(s,o),this.events.emit(Qe.created,{target:s,expiration:o})}),Re(this,"get",r=>{this.isInitialized();const n=this.formatTarget(r);return this.getExpiration(n)}),Re(this,"del",r=>{if(this.isInitialized(),this.has(r)){const n=this.formatTarget(r),s=this.getExpiration(n);this.expirations.delete(n),this.events.emit(Qe.deleted,{target:n,expiration:s})}}),Re(this,"on",(r,n)=>{this.events.on(r,n)}),Re(this,"once",(r,n)=>{this.events.once(r,n)}),Re(this,"off",(r,n)=>{this.events.off(r,n)}),Re(this,"removeListener",(r,n)=>{this.events.removeListener(r,n)}),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 Hf(t);if(typeof t=="number")return Gf(t);const{message:e}=N("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(Qe.sync)}async restore(){try{const t=await this.getExpirations();if(typeof t>"u"||!t.length)return;if(this.expirations.size){const{message:e}=N("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:r}=N("NO_MATCHING_KEY",`${this.name}: ${t}`);throw this.logger.warn(r),new Error(r)}return e}checkExpiry(t,e){const{expiry:r}=e;B.toMiliseconds(r)-Date.now()<=0&&this.expire(t,e)}expire(t,e){this.expirations.delete(t),this.events.emit(Qe.expired,{target:t,expiration:e})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((t,e)=>this.checkExpiry(e,t))}registerEventListeners(){this.core.heartbeat.on(Pi.pulse,()=>this.checkExpirations()),this.events.on(Qe.created,t=>{const e=Qe.created;this.logger.info(`Emitting ${e}`),this.logger.debug({type:"event",event:e,data:t}),this.persist()}),this.events.on(Qe.expired,t=>{const e=Qe.expired;this.logger.info(`Emitting ${e}`),this.logger.debug({type:"event",event:e,data:t}),this.persist()}),this.events.on(Qe.deleted,t=>{const e=Qe.deleted;this.logger.info(`Emitting ${e}`),this.logger.debug({type:"event",event:e,data:t}),this.persist()})}isInitialized(){if(!this.initialized){const{message:t}=N("NOT_INITIALIZED",this.name);throw new Error(t)}}}var fb=Object.defineProperty,mb=(i,t,e)=>t in i?fb(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,he=(i,t,e)=>mb(i,typeof t!="symbol"?t+"":t,e);class yb extends Xp{constructor(t,e,r){super(t,e,r),this.core=t,this.logger=e,this.store=r,he(this,"name",yE),he(this,"abortController"),he(this,"isDevEnv"),he(this,"verifyUrlV3",gE),he(this,"storagePrefix",wt),he(this,"version",Su),he(this,"publicKey"),he(this,"fetchPromise"),he(this,"init",async()=>{var n;this.isDevEnv||(this.publicKey=await this.store.getItem(this.storeKey),this.publicKey&&B.toMiliseconds((n=this.publicKey)==null?void 0:n.expiresAt)<Date.now()&&(this.logger.debug("verify v2 public key expired"),await this.removePublicKey()))}),he(this,"register",async n=>{if(!Di()||this.isDevEnv)return;const s=window.location.origin,{id:o,decryptedId:c}=n,l=`${this.verifyUrlV3}/attestation?projectId=${this.core.projectId}&origin=${s}&id=${o}&decryptedId=${c}`;try{const u=Rt.getDocument(),h=this.startAbortTimer(B.ONE_SECOND*5),d=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 R=JSON.parse(b.data);if(R.type==="verify_attestation"){if(Yn(R.attestation).payload.id!==o)return;clearInterval(h),u.body.removeChild(m),this.abortController.signal.removeEventListener("abort",f),window.removeEventListener("message",y),p(R.attestation===null?"":R.attestation)}}catch(R){this.logger.warn(R)}};u.body.appendChild(m),window.addEventListener("message",y,{signal:this.abortController.signal})});return this.logger.debug("jwt attestation",d),d}catch(u){this.logger.warn(u)}return""}),he(this,"resolve",async n=>{if(this.isDevEnv)return"";const{attestationId:s,hash:o,encryptedId:c}=n;if(s===""){this.logger.debug("resolve: attestationId is empty, skipping");return}if(s){if(Yn(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(n==null?void 0:n.verifyUrl);return this.fetchAttestation(o,l)}),he(this,"fetchAttestation",async(n,s)=>{this.logger.debug(`resolving attestation: ${n} from url: ${s}`);const o=this.startAbortTimer(B.ONE_SECOND*5),c=await fetch(`${s}/attestation/${n}?v2Supported=true`,{signal:this.abortController.signal});return clearTimeout(o),c.status===200?await c.json():void 0}),he(this,"getVerifyUrl",n=>{let s=n||ir;return EE.includes(s)||(this.logger.info(`verify url: ${s}, not included in trusted list, assigning default: ${ir}`),s=ir),s}),he(this,"fetchPublicKey",async()=>{try{this.logger.debug(`fetching public key from: ${this.verifyUrlV3}`);const n=this.startAbortTimer(B.FIVE_SECONDS),s=await fetch(`${this.verifyUrlV3}/public-key`,{signal:this.abortController.signal});return clearTimeout(n),await s.json()}catch(n){this.logger.warn(n)}}),he(this,"persistPublicKey",async n=>{this.logger.debug("persisting public key to local storage",n),await this.store.setItem(this.storeKey,n),this.publicKey=n}),he(this,"removePublicKey",async()=>{this.logger.debug("removing verify v2 public key from storage"),await this.store.removeItem(this.storeKey),this.publicKey=void 0}),he(this,"isValidJwtAttestation",async n=>{const s=await this.getPublicKey();try{if(s)return this.validateAttestation(n,s)}catch(c){this.logger.error(c),this.logger.warn("error validating attestation")}const o=await this.fetchAndPersistPublicKey();try{if(o)return this.validateAttestation(n,o)}catch(c){this.logger.error(c),this.logger.warn("error validating attestation")}}),he(this,"getPublicKey",async()=>this.publicKey?this.publicKey:await this.fetchAndPersistPublicKey()),he(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 n=await this.fetchPromise;return this.fetchPromise=void 0,n}),he(this,"validateAttestation",(n,s)=>{const o=zw(n,s.publicKey),c={hasExpired:B.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=so(),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(),B.toMiliseconds(t))}}var wb=Object.defineProperty,gb=(i,t,e)=>t in i?wb(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,gc=(i,t,e)=>gb(i,typeof t!="symbol"?t+"":t,e);class Eb extends e_{constructor(t,e){super(t,e),this.projectId=t,this.logger=e,gc(this,"context",vE),gc(this,"registerDeviceToken",async r=>{const{clientId:n,token:s,notificationType:o,enableEncrypted:c=!1}=r,l=`${bE}/${this.projectId}/clients`;await fetch(l,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:n,type:o,token:s,always_raw:c})})}),this.logger=Ce(e,this.context)}}var vb=Object.defineProperty,Ec=Object.getOwnPropertySymbols,bb=Object.prototype.hasOwnProperty,Ib=Object.prototype.propertyIsEnumerable,Ls=(i,t,e)=>t in i?vb(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Fi=(i,t)=>{for(var e in t||(t={}))bb.call(t,e)&&Ls(i,e,t[e]);if(Ec)for(var e of Ec(t))Ib.call(t,e)&&Ls(i,e,t[e]);return i},me=(i,t,e)=>Ls(i,typeof t!="symbol"?t+"":t,e);class Ab extends t_{constructor(t,e,r=!0){super(t,e,r),this.core=t,this.logger=e,me(this,"context",AE),me(this,"storagePrefix",wt),me(this,"storageVersion",IE),me(this,"events",new Map),me(this,"shouldPersist",!1),me(this,"init",async()=>{if(!so())try{const n={eventId:ua(),timestamp:Date.now(),domain:this.getAppDomain(),props:{event:"INIT",type:"",properties:{client_id:await this.core.crypto.getClientId(),user_agent:kl(this.core.relayer.protocol,this.core.relayer.version,vs)}}};await this.sendEvent([n])}catch(n){this.logger.warn(n)}}),me(this,"createEvent",n=>{const{event:s="ERROR",type:o="",properties:{topic:c,trace:l}}=n,u=ua(),h=this.core.projectId||"",d=Date.now(),p=Fi({eventId:u,timestamp:d,props:{event:s,type:o,properties:{topic:c,trace:l}},bundleId:h,domain:this.getAppDomain()},this.setMethods(u));return this.telemetryEnabled&&(this.events.set(u,p),this.shouldPersist=!0),p}),me(this,"getEvent",n=>{const{eventId:s,topic:o}=n;if(s)return this.events.get(s);const c=Array.from(this.events.values()).find(l=>l.props.properties.topic===o);if(c)return Fi(Fi({},c),this.setMethods(c.eventId))}),me(this,"deleteEvent",n=>{const{eventId:s}=n;this.events.delete(s),this.shouldPersist=!0}),me(this,"setEventListeners",()=>{this.core.heartbeat.on(Pi.pulse,async()=>{this.shouldPersist&&await this.persist(),this.events.forEach(n=>{B.fromMiliseconds(Date.now())-B.fromMiliseconds(n.timestamp)>TE&&(this.events.delete(n.eventId),this.shouldPersist=!0)})})}),me(this,"setMethods",n=>({addTrace:s=>this.addTrace(n,s),setError:s=>this.setError(n,s)})),me(this,"addTrace",(n,s)=>{const o=this.events.get(n);o&&(o.props.properties.trace.push(s),this.events.set(n,o),this.shouldPersist=!0)}),me(this,"setError",(n,s)=>{const o=this.events.get(n);o&&(o.props.type=s,o.timestamp=Date.now(),this.events.set(n,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 n=await this.core.storage.getItem(this.storageKey)||[];if(!n.length)return;n.forEach(s=>{this.events.set(s.eventId,Fi(Fi({},s),this.setMethods(s.eventId)))})}catch(n){this.logger.warn(n)}}),me(this,"submit",async()=>{if(!this.telemetryEnabled||this.events.size===0)return;const n=[];for(const[s,o]of this.events)o.props.type&&n.push(o);if(n.length!==0)try{if((await this.sendEvent(n)).ok)for(const s of n)this.events.delete(s.eventId),this.shouldPersist=!0}catch(s){this.logger.warn(s)}}),me(this,"sendEvent",async n=>{const s=this.getAppDomain()?"":"&sp=desktop";return await fetch(`${PE}?projectId=${this.core.projectId}&st=events_sdk&sv=js-${vs}${s}`,{method:"POST",body:JSON.stringify(n)})}),me(this,"getAppDomain",()=>$l().url),this.logger=Ce(e,this.context),this.telemetryEnabled=r,r?this.restore().then(async()=>{await this.submit(),this.setEventListeners()}):this.persist()}get storageKey(){return this.storagePrefix+this.storageVersion+this.core.customStoragePrefix+"//"+this.context}}var Tb=Object.defineProperty,vc=Object.getOwnPropertySymbols,Pb=Object.prototype.hasOwnProperty,Ob=Object.prototype.propertyIsEnumerable,Ds=(i,t,e)=>t in i?Tb(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,bc=(i,t)=>{for(var e in t||(t={}))Pb.call(t,e)&&Ds(i,e,t[e]);if(vc)for(var e of vc(t))Ob.call(t,e)&&Ds(i,e,t[e]);return i},ne=(i,t,e)=>Ds(i,typeof t!="symbol"?t+"":t,e);class Eo extends zp{constructor(t){var e;super(t),ne(this,"protocol",xu),ne(this,"version",Su),ne(this,"name",Es),ne(this,"relayUrl"),ne(this,"projectId"),ne(this,"customStoragePrefix"),ne(this,"events",new ui.EventEmitter),ne(this,"logger"),ne(this,"heartbeat"),ne(this,"relayer"),ne(this,"crypto"),ne(this,"storage"),ne(this,"history"),ne(this,"expirer"),ne(this,"pairing"),ne(this,"verify"),ne(this,"echoClient"),ne(this,"linkModeSupportedApps"),ne(this,"eventClient"),ne(this,"initialized",!1),ne(this,"logChunkController"),ne(this,"on",(c,l)=>this.events.on(c,l)),ne(this,"once",(c,l)=>this.events.once(c,l)),ne(this,"off",(c,l)=>this.events.off(c,l)),ne(this,"removeListener",(c,l)=>this.events.removeListener(c,l)),ne(this,"dispatchEnvelope",({topic:c,message:l,sessionExists:u})=>{if(!c||!l)return;const h={topic:c,message:l,publishedAt:Date.now(),transportType:se.link_mode};this.relayer.onLinkMessageEvent(h,{sessionExists:u})});const r=this.getGlobalCore(t==null?void 0:t.customStoragePrefix);if(r)try{return this.customStoragePrefix=r.customStoragePrefix,this.logger=r.logger,this.heartbeat=r.heartbeat,this.crypto=r.crypto,this.history=r.history,this.expirer=r.expirer,this.storage=r.storage,this.relayer=r.relayer,this.pairing=r.pairing,this.verify=r.verify,this.echoClient=r.echoClient,this.linkModeSupportedApps=r.linkModeSupportedApps,this.eventClient=r.eventClient,this.initialized=r.initialized,this.logChunkController=r.logChunkController,r}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)||$u,this.customStoragePrefix=t!=null&&t.customStoragePrefix?`:${t.customStoragePrefix}`:"";const n=eo({level:typeof(t==null?void 0:t.logger)=="string"&&t.logger?t.logger:Hg.logger,name:Es}),{logger:s,chunkLoggerController:o}=Bp({opts:n,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 id,this.crypto=new tv(this,this.logger,t==null?void 0:t.keychain),this.history=new hb(this,this.logger),this.expirer=new _b(this,this.logger),this.storage=t!=null&&t.storage?t.storage:new bp(bc(bc({},Gg),t==null?void 0:t.storageOptions)),this.relayer=new Rv({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new cb(this,this.logger),this.verify=new yb(this,this.logger,this.storage),this.echoClient=new Eb(this.projectId||"",this.logger),this.linkModeSupportedApps=[],this.eventClient=new Ab(this,this.logger,t==null?void 0:t.telemetryEnabled),this.setGlobalCore(this)}static async init(t){const e=new Eo(t);await e.initialize();const r=await e.crypto.getClientId();return await e.storage.setItem(cE,r),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(ec,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(ec)||[],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}`,r=`${e}_count`;return globalThis[r]=(globalThis[r]||0)+1,globalThis[r]>1&&console.warn(`WalletConnect Core is already initialized. This is probably a mistake and can lead to unexpected behavior. Init() was called ${globalThis[r]} 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 r=`_walletConnectCore_${((e=t.opts)==null?void 0:e.customStoragePrefix)||""}`;globalThis[r]=t}catch(r){console.warn("Failed to set global WalletConnect core",r)}}isGlobalCoreDisabled(){try{return typeof Kt<"u"&&Wg.DISABLE_GLOBAL_CORE==="true"}catch{return!0}}}const Rb=Eo,Gu="wc",Ju=2,Yu="client",vo=`${Gu}@${Ju}:${Yu}:`,Mn={name:Yu,logger:"error"},Ic="WALLETCONNECT_DEEPLINK_CHOICE",Lb="proposal",Ac="Proposal expired",Db="session",gi=B.SEVEN_DAYS,Vb="engine",Ie={wc_sessionPropose:{req:{ttl:B.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:B.FIVE_MINUTES,prompt:!1,tag:1101},reject:{ttl:B.FIVE_MINUTES,prompt:!1,tag:1120},autoReject:{ttl:B.FIVE_MINUTES,prompt:!1,tag:1121}},wc_sessionSettle:{req:{ttl:B.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:B.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:B.ONE_DAY,prompt:!1,tag:1104},res:{ttl:B.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:B.ONE_DAY,prompt:!1,tag:1106},res:{ttl:B.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:B.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:B.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:B.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:B.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:B.ONE_DAY,prompt:!1,tag:1112},res:{ttl:B.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:B.ONE_DAY,prompt:!1,tag:1114},res:{ttl:B.ONE_DAY,prompt:!1,tag:1115}},wc_sessionAuthenticate:{req:{ttl:B.ONE_HOUR,prompt:!0,tag:1116},res:{ttl:B.ONE_HOUR,prompt:!1,tag:1117},reject:{ttl:B.FIVE_MINUTES,prompt:!1,tag:1118},autoReject:{ttl:B.FIVE_MINUTES,prompt:!1,tag:1119}}},qn={min:B.FIVE_MINUTES,max:B.SEVEN_DAYS},dt={idle:"IDLE",active:"ACTIVE"},xb={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:""}},Sb="request",Cb=["wc_sessionPropose","wc_sessionRequest","wc_authRequest","wc_sessionAuthenticate"],$b="wc",kb="auth",Ub="authKeys",Nb="pairingTopics",Bb="requests",fn=`${$b}@${1.5}:${kb}:`,Mr=`${fn}:PUB_KEY`;var Mb=Object.defineProperty,qb=Object.defineProperties,zb=Object.getOwnPropertyDescriptors,Tc=Object.getOwnPropertySymbols,jb=Object.prototype.hasOwnProperty,Kb=Object.prototype.propertyIsEnumerable,Vs=(i,t,e)=>t in i?Mb(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,ie=(i,t)=>{for(var e in t||(t={}))jb.call(t,e)&&Vs(i,e,t[e]);if(Tc)for(var e of Tc(t))Kb.call(t,e)&&Vs(i,e,t[e]);return i},Le=(i,t)=>qb(i,zb(t)),S=(i,t,e)=>Vs(i,typeof t!="symbol"?t+"":t,e);class Fb extends s_{constructor(t){super(t),S(this,"name",Vb),S(this,"events",new Wc),S(this,"initialized",!1),S(this,"requestQueue",{state:dt.idle,queue:[]}),S(this,"sessionRequestQueue",{state:dt.idle,queue:[]}),S(this,"emittedSessionRequests",new rm({limit:500})),S(this,"requestQueueDelay",B.ONE_SECOND),S(this,"expectedPairingMethodMap",new Map),S(this,"recentlyDeletedMap",new Map),S(this,"recentlyDeletedLimit",200),S(this,"relayMessageCache",[]),S(this,"pendingSessions",new Map),S(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()},B.toMiliseconds(this.requestQueueDelay)))}),S(this,"connect",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();const r=Le(ie({},e),{requiredNamespaces:e.requiredNamespaces||{},optionalNamespaces:e.optionalNamespaces||{}});await this.isValidConnect(r),r.optionalNamespaces=sg(r.requiredNamespaces,r.optionalNamespaces),r.requiredNamespaces={};const{pairingTopic:n,requiredNamespaces:s,optionalNamespaces:o,sessionProperties:c,scopedProperties:l,relays:u}=r;let h=n,d,p=!1;try{if(h){const g=this.client.core.pairing.pairings.get(h);this.client.logger.warn("connect() with existing pairing topic is deprecated and will be removed in the next major release."),p=g.active}}catch(g){throw this.client.logger.error(`connect() -> pairing.get(${h}) failed`),g}if(!h||!p){const{topic:g,uri:D}=await this.client.core.pairing.create({internal:{skipSubscribe:!0}});h=g,d=D}if(!h){const{message:g}=N("NO_MATCHING_KEY",`connect() pairing topic: ${h}`);throw new Error(g)}const _=await this.client.core.crypto.generateKeyPair(),f=Ie.wc_sessionPropose.req.ttl||B.FIVE_MINUTES,m=_e(f),y=Le(ie(ie({requiredNamespaces:s,optionalNamespaces:o,relays:u??[{protocol:Cu}],proposer:{publicKey:_,metadata:this.client.metadata},expiryTimestamp:m,pairingTopic:h},c&&{sessionProperties:c}),l&&{scopedProperties:l}),{id:Dt()}),b=te("session_connect",y.id),{reject:R,resolve:v,done:P}=Zt(f,Ac),T=({id:g})=>{g===y.id&&(this.client.events.off("proposal_expire",T),this.pendingSessions.delete(y.id),this.events.emit(b,{error:{message:Ac,code:0}}))};return this.client.events.on("proposal_expire",T),this.events.once(b,({error:g,session:D})=>{this.client.events.off("proposal_expire",T),g?R(g):D&&v(D)}),await this.sendProposeSession({proposal:y,publishOpts:{internal:{throwOnFailedPublish:!0},tvf:{correlationId:y.id}}}),await this.setProposal(y.id,y),{uri:d,approval:P}}),S(this,"pair",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{return await this.client.core.pairing.pair(e)}catch(r){throw this.client.logger.error("pair() failed"),r}}),S(this,"approve",async e=>{var r,n,s;const o=this.client.core.eventClient.createEvent({properties:{topic:(r=e==null?void 0:e.id)==null?void 0:r.toString(),trace:[Ut.session_approve_started]}});try{this.isInitialized(),await this.confirmOnlineStateOrThrow()}catch(w){throw o.setError(zi.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(zi.proposal_not_found),w}try{await this.isValidApprove(e)}catch(w){throw this.client.logger.error("approve() -> isValidApprove() failed"),o.setError(zi.session_approve_namespace_validation_failure),w}const{id:c,relayProtocol:l,namespaces:u,sessionProperties:h,scopedProperties:d,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 R=(n=this.client.core.eventClient)==null?void 0:n.getEvent({topic:f});R||(R=(s=this.client.core.eventClient)==null?void 0:s.createEvent({type:Ut.session_approve_started,properties:{topic:f,trace:[Ut.session_approve_started,Ut.session_namespaces_validation_success]}}));const v=await this.client.core.crypto.generateKeyPair(),P=m.publicKey,T=await this.client.core.crypto.generateSharedKey(v,P),g=ie(ie(ie({relay:{protocol:l??"irn"},namespaces:u,controller:{publicKey:v,metadata:this.client.metadata},expiry:_e(gi)},h&&{sessionProperties:h}),d&&{scopedProperties:d}),p&&{sessionConfig:p}),D=se.relay;R.addTrace(Ut.subscribing_session_topic);try{await this.client.core.relayer.subscribe(T,{transportType:D,internal:{skipSubscribe:!0}})}catch(w){throw R.setError(zi.subscribe_session_topic_failure),w}R.addTrace(Ut.subscribe_session_topic_success);const L=Le(ie({},g),{topic:T,requiredNamespaces:y,optionalNamespaces:b,pairingTopic:f,acknowledged:!1,self:g.controller,peer:{publicKey:m.publicKey,metadata:m.metadata},controller:v,transportType:se.relay});await this.client.session.set(T,L),R.addTrace(Ut.store_session);try{await this.sendApproveSession({sessionTopic:T,proposal:_,pairingProposalResponse:{relay:{protocol:l??"irn"},responderPublicKey:v},sessionSettleRequest:g,publishOpts:{internal:{throwOnFailedPublish:!0},tvf:{correlationId:c}}}),R.addTrace(Ut.session_approve_publish_success)}catch(w){throw this.client.logger.error(w),this.client.session.delete(T,ae("USER_DISCONNECTED")),await this.client.core.relayer.unsubscribe(T),w}return this.client.core.eventClient.deleteEvent({eventId:R.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(T,_e(gi)),{topic:T,acknowledged:()=>Promise.resolve(this.client.session.get(T))}}),S(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:r,reason:n}=e;let s;try{s=this.client.proposal.get(r).pairingTopic}catch(o){throw this.client.logger.error(`reject() -> proposal.get(${r}) failed`),o}s&&await this.sendError({id:r,topic:s,error:n,rpcOpts:Ie.wc_sessionPropose.reject}),await this.deleteProposal(r)}),S(this,"update",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidUpdate(e)}catch(d){throw this.client.logger.error("update() -> isValidUpdate() failed"),d}const{topic:r,namespaces:n}=e,{done:s,resolve:o,reject:c}=Zt(),l=Dt(),u=Xt().toString(),h=this.client.session.get(r).namespaces;return this.events.once(te("session_update",l),({error:d})=>{d?c(d):o()}),await this.client.session.update(r,{namespaces:n}),await this.sendRequest({topic:r,method:"wc_sessionUpdate",params:{namespaces:n},throwOnFailedPublish:!0,clientRpcId:l,relayRpcId:u}).catch(d=>{this.client.logger.error(d),this.client.session.update(r,{namespaces:h}),c(d)}),{acknowledged:s}}),S(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:r}=e,n=Dt(),{done:s,resolve:o,reject:c}=Zt();return this.events.once(te("session_extend",n),({error:l})=>{l?c(l):o()}),await this.setExpiry(r,_e(gi)),this.sendRequest({topic:r,method:"wc_sessionExtend",params:{},clientRpcId:n,throwOnFailedPublish:!0}).catch(l=>{c(l)}),{acknowledged:s}}),S(this,"request",async e=>{this.isInitialized();try{await this.isValidRequest(e)}catch(y){throw this.client.logger.error("request() -> isValidRequest() failed"),y}const{chainId:r,request:n,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:h,resolve:d,reject:p}=Zt(o,"Request expired. Please try again.");this.events.once(te("session_request",l),({error:y,result:b})=>{y?p(y):d(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(ie({},n),{expiryTimestamp:_e(o)}),chainId:r},expiry:o,throwOnFailedPublish:!0,appLink:f}).catch(y=>p(y)),this.client.events.emit("session_request_sent",{topic:s,request:n,chainId:r,id:l}),await h();const m={request:Le(ie({},n),{expiryTimestamp:_e(o)}),chainId:r};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:n,chainId:r,id:l}),y()}),new Promise(async y=>{var b;if(!((b=c.sessionConfig)!=null&&b.disableDeepLink)){const R=await Qf(this.client.core.storage,Ic);await Jf({id:l,topic:s,wcDeepLink:R})}y()}),h()]).then(y=>y[2])}),S(this,"respond",async e=>{this.isInitialized(),await this.isValidRespond(e);const{topic:r,response:n}=e,{id:s}=n,o=this.client.session.get(r);o.transportType===se.relay&&await this.confirmOnlineStateOrThrow();const c=this.getAppLinkIfEnabled(o.peer.metadata,o.transportType);bt(n)?await this.sendResult({id:s,topic:r,result:n.result,throwOnFailedPublish:!0,appLink:c}):_t(n)&&await this.sendError({id:s,topic:r,error:n.error,appLink:c}),this.cleanupAfterResponse(e)}),S(this,"ping",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidPing(e)}catch(n){throw this.client.logger.error("ping() -> isValidPing() failed"),n}const{topic:r}=e;if(this.client.session.keys.includes(r)){const n=Dt(),s=Xt().toString(),{done:o,resolve:c,reject:l}=Zt();this.events.once(te("session_ping",n),({error:u})=>{u?l(u):c()}),await Promise.all([this.sendRequest({topic:r,method:"wc_sessionPing",params:{},throwOnFailedPublish:!0,clientRpcId:n,relayRpcId:s}),o()])}else this.client.core.pairing.pairings.keys.includes(r)&&(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:r}))}),S(this,"emit",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidEmit(e);const{topic:r,event:n,chainId:s}=e,o=Xt().toString(),c=Dt();await this.sendRequest({topic:r,method:"wc_sessionEvent",params:{event:n,chainId:s},throwOnFailedPublish:!0,relayRpcId:o,clientRpcId:c})}),S(this,"disconnect",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidDisconnect(e);const{topic:r}=e;if(this.client.session.keys.includes(r))await this.sendRequest({topic:r,method:"wc_sessionDelete",params:ae("USER_DISCONNECTED"),throwOnFailedPublish:!0}),await this.deleteSession({topic:r,emitEvent:!1});else if(this.client.core.pairing.pairings.keys.includes(r))await this.client.core.pairing.disconnect({topic:r});else{const{message:n}=N("MISMATCHED_TOPIC",`Session or pairing topic not found: ${r}`);throw new Error(n)}}),S(this,"find",e=>(this.isInitialized(),this.client.session.getAll().filter(r=>cg(r,e)))),S(this,"getPendingSessionRequests",()=>this.client.pendingRequest.getAll()),S(this,"authenticate",async(e,r)=>{var n;this.isInitialized(),this.isValidAuthenticate(e);const s=r&&this.client.core.linkModeSupportedApps.includes(r)&&((n=this.client.metadata.redirect)==null?void 0:n.linkMode),o=s?se.link_mode:se.relay;o===se.relay&&await this.confirmOnlineStateOrThrow();const{chains:c,statement:l="",uri:u,domain:h,nonce:d,type:p,exp:_,nbf:f,methods:m=[],expiry:y}=e,b=[...e.resources||[]],{topic:R,uri:v}=await this.client.core.pairing.create({methods:["wc_sessionAuthenticate"],transportType:o});this.client.logger.info({message:"Generated new pairing",pairing:{topic:R,uri:v}});const P=await this.client.core.crypto.generateKeyPair(),T=Nr(P);if(await Promise.all([this.client.auth.authKeys.set(Mr,{responseTopic:T,publicKey:P}),this.client.auth.pairingTopics.set(T,{topic:T,pairingTopic:R})]),await this.client.core.relayer.subscribe(T,{transportType:o}),this.client.logger.info(`sending request to new pairing topic: ${R}`),m.length>0){const{namespace:C}=kr(c[0]);let U=_y(C,"request",m);Ur(b)&&(U=my(U,b.pop())),b.push(U)}const g=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:h,version:"1",nonce:d,iat:new Date().toISOString(),exp:_,nbf:f,resources:b},requester:{publicKey:P,metadata:this.client.metadata},expiryTimestamp:_e(g)},L={eip155:{chains:c,methods:[...new Set(["personal_sign",...m])],events:["chainChanged","accountsChanged"]}},w={requiredNamespaces:{},optionalNamespaces:L,relays:[{protocol:"irn"}],pairingTopic:R,proposer:{publicKey:P,metadata:this.client.metadata},expiryTimestamp:_e(Ie.wc_sessionPropose.req.ttl),id:Dt()},{done:E,resolve:I,reject:A}=Zt(g,"Request expired"),V=Dt(),O=te("session_connect",w.id),x=te("session_request",V),$=async({error:C,session:U})=>{this.events.off(x,k),C?A(C):U&&I({session:U})},k=async C=>{var U,z,j;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(O,$),A(C.error.message))}await this.deleteProposal(w.id),this.events.off(O,$);const{cacaos:F,responder:W}=C.result,H=[],G=[];for(const oe of F){await va({cacao:oe,projectId:this.client.core.projectId})||(this.client.logger.error(oe,"Signature verification failed"),A(ae("SESSION_SETTLEMENT_FAILED","Signature verification failed")));const{p:Je}=oe,gt=Ur(Je.resources),To=[ls(Je.iss)],ch=Qr(Je.iss);if(gt){const yn=ba(gt),lh=Ia(gt);H.push(...yn),To.push(...lh)}for(const yn of To)G.push(`${yn}:${ch}`)}const ue=await this.client.core.crypto.generateSharedKey(P,W.publicKey);let ce;H.length>0&&(ce={topic:ue,acknowledged:!0,self:{publicKey:P,metadata:this.client.metadata},peer:W,controller:W.publicKey,expiry:_e(gi),requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:R,namespaces:Ha([...new Set(H)],[...new Set(G)]),transportType:o},await this.client.core.relayer.subscribe(ue,{transportType:o}),await this.client.session.set(ue,ce),R&&await this.client.core.pairing.updateMetadata({topic:R,metadata:W.metadata}),ce=this.client.session.get(ue)),(U=this.client.metadata.redirect)!=null&&U.linkMode&&(z=W.metadata.redirect)!=null&&z.linkMode&&(j=W.metadata.redirect)!=null&&j.universal&&r&&(this.client.core.addLinkModeSupportedApp(W.metadata.redirect.universal),this.client.session.update(ue,{transportType:se.link_mode})),I({auths:F,session:ce})};this.events.once(O,$),this.events.once(x,k);let M;try{if(s){const C=Nt("wc_sessionAuthenticate",D,V);this.client.core.history.set(R,C);const U=await this.client.core.crypto.encode("",C,{type:Er,encoding:jt});M=xr(r,R,U)}else await Promise.all([this.sendRequest({topic:R,method:"wc_sessionAuthenticate",params:D,expiry:e.expiry,throwOnFailedPublish:!0,clientRpcId:V}),this.sendRequest({topic:R,method:"wc_sessionPropose",params:w,expiry:Ie.wc_sessionPropose.req.ttl,throwOnFailedPublish:!0,clientRpcId:w.id})])}catch(C){throw this.events.off(O,$),this.events.off(x,k),C}return await this.setProposal(w.id,w),await this.setAuthRequest(V,{request:Le(ie({},D),{verifyContext:{}}),pairingTopic:R,transportType:o}),{uri:M??v,response:E}}),S(this,"approveSessionAuthenticate",async e=>{const{id:r,auths:n}=e,s=this.client.core.eventClient.createEvent({properties:{topic:r.toString(),trace:[Yt.authenticated_session_approve_started]}});try{this.isInitialized()}catch(y){throw s.setError(ji.no_internet_connection),y}const o=this.getPendingAuthRequest(r);if(!o)throw s.setError(ji.authenticated_session_pending_request_not_found),new Error(`Could not find pending auth request with id ${r}`);const c=o.transportType||se.relay;c===se.relay&&await this.confirmOnlineStateOrThrow();const l=o.requester.publicKey,u=await this.client.core.crypto.generateKeyPair(),h=Nr(l),d={type:Ot,receiverPublicKey:l,senderPublicKey:u},p=[],_=[];for(const y of n){if(!await va({cacao:y,projectId:this.client.core.projectId})){s.setError(ji.invalid_cacao);const T=ae("SESSION_SETTLEMENT_FAILED","Signature verification failed");throw await this.sendError({id:r,topic:h,error:T,encodeOpts:d}),new Error(T.message)}s.addTrace(Yt.cacaos_verified);const{p:b}=y,R=Ur(b.resources),v=[ls(b.iss)],P=Qr(b.iss);if(R){const T=ba(R),g=Ia(R);p.push(...T),v.push(...g)}for(const T of v)_.push(`${T}:${P}`)}const f=await this.client.core.crypto.generateSharedKey(u,l);s.addTrace(Yt.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(gi),authentication:n,requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:o.pairingTopic,namespaces:Ha([...new Set(p)],[...new Set(_)]),transportType:c},s.addTrace(Yt.subscribing_authenticated_session_topic);try{await this.client.core.relayer.subscribe(f,{transportType:c})}catch(y){throw s.setError(ji.subscribe_authenticated_session_topic_failure),y}s.addTrace(Yt.subscribe_authenticated_session_topic_success),await this.client.session.set(f,m),s.addTrace(Yt.store_authenticated_session),await this.client.core.pairing.updateMetadata({topic:o.pairingTopic,metadata:o.requester.metadata})}s.addTrace(Yt.publishing_authenticated_session_approve);try{await this.sendResult({topic:h,id:r,result:{cacaos:n,responder:{publicKey:u,metadata:this.client.metadata}},encodeOpts:d,throwOnFailedPublish:!0,appLink:this.getAppLinkIfEnabled(o.requester.metadata,c)})}catch(y){throw s.setError(ji.authenticated_session_approve_publish_failure),y}return await this.client.auth.requests.delete(r,{message:"fulfilled",code:0}),await this.client.core.pairing.activate({topic:o.pairingTopic}),this.client.core.eventClient.deleteEvent({eventId:s.eventId}),{session:m}}),S(this,"rejectSessionAuthenticate",async e=>{this.isInitialized();const{id:r,reason:n}=e,s=this.getPendingAuthRequest(r);if(!s)throw new Error(`Could not find pending auth request with id ${r}`);s.transportType===se.relay&&await this.confirmOnlineStateOrThrow();const o=s.requester.publicKey,c=await this.client.core.crypto.generateKeyPair(),l=Nr(o),u={type:Ot,receiverPublicKey:o,senderPublicKey:c};await this.sendError({id:r,topic:l,error:n,encodeOpts:u,rpcOpts:Ie.wc_sessionAuthenticate.reject,appLink:this.getAppLinkIfEnabled(s.requester.metadata,s.transportType)}),await this.client.auth.requests.delete(r,{message:"rejected",code:0}),await this.deleteProposal(r)}),S(this,"formatAuthMessage",e=>{this.isInitialized();const{request:r,iss:n}=e;return Xl(r,n)}),S(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)}),S(this,"cleanupDuplicatePairings",async e=>{if(e.pairingTopic)try{const r=this.client.core.pairing.pairings.get(e.pairingTopic),n=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!==r.topic});if(n.length===0)return;this.client.logger.info(`Cleaning up ${n.length} duplicate pairing(s)`),await Promise.all(n.map(s=>this.client.core.pairing.disconnect({topic:s.topic}))),this.client.logger.info("Duplicate pairings clean up finished")}catch(r){this.client.logger.error(r)}}),S(this,"deleteSession",async e=>{var r;const{topic:n,expirerHasDeleted:s=!1,emitEvent:o=!0,id:c=0}=e,{self:l}=this.client.session.get(n);await this.client.core.relayer.unsubscribe(n),await this.client.session.delete(n,ae("USER_DISCONNECTED")),this.addToRecentlyDeleted(n,"session"),this.client.core.crypto.keychain.has(l.publicKey)&&await this.client.core.crypto.deleteKeyPair(l.publicKey),this.client.core.crypto.keychain.has(n)&&await this.client.core.crypto.deleteSymKey(n),s||this.client.core.expirer.del(n),this.client.core.storage.removeItem(Ic).catch(u=>this.client.logger.warn(u)),this.getPendingSessionRequests().forEach(u=>{u.topic===n&&this.deletePendingSessionRequest(u.id,ae("USER_DISCONNECTED"))}),n===((r=this.sessionRequestQueue.queue[0])==null?void 0:r.topic)&&(this.sessionRequestQueue.state=dt.idle),o&&this.client.events.emit("session_delete",{id:c,topic:n})}),S(this,"deleteProposal",async(e,r)=>{if(r)try{const n=this.client.proposal.get(e),s=this.client.core.eventClient.getEvent({topic:n.pairingTopic});s==null||s.setError(zi.proposal_expired)}catch{}await Promise.all([this.client.proposal.delete(e,ae("USER_DISCONNECTED")),r?Promise.resolve():this.client.core.expirer.del(e)]),this.addToRecentlyDeleted(e,"proposal")}),S(this,"deletePendingSessionRequest",async(e,r,n=!1)=>{await Promise.all([this.client.pendingRequest.delete(e,r),n?Promise.resolve():this.client.core.expirer.del(e)]),this.addToRecentlyDeleted(e,"request"),this.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter(s=>s.id!==e),n&&(this.sessionRequestQueue.state=dt.idle,this.client.events.emit("session_request_expire",{id:e}))}),S(this,"deletePendingAuthRequest",async(e,r,n=!1)=>{await Promise.all([this.client.auth.requests.delete(e,r),n?Promise.resolve():this.client.core.expirer.del(e)])}),S(this,"setExpiry",async(e,r)=>{this.client.session.keys.includes(e)&&(this.client.core.expirer.set(e,r),await this.client.session.update(e,{expiry:r}))}),S(this,"setProposal",async(e,r)=>{this.client.core.expirer.set(e,_e(Ie.wc_sessionPropose.req.ttl)),await this.client.proposal.set(e,r)}),S(this,"setAuthRequest",async(e,r)=>{const{request:n,pairingTopic:s,transportType:o=se.relay}=r;this.client.core.expirer.set(e,n.expiryTimestamp),await this.client.auth.requests.set(e,{authPayload:n.authPayload,requester:n.requester,expiryTimestamp:n.expiryTimestamp,id:e,pairingTopic:s,verifyContext:n.verifyContext,transportType:o})}),S(this,"setPendingSessionRequest",async e=>{const{id:r,topic:n,params:s,verifyContext:o}=e,c=s.request.expiryTimestamp||_e(Ie.wc_sessionRequest.req.ttl);this.client.core.expirer.set(r,c),await this.client.pendingRequest.set(r,{id:r,topic:n,params:s,verifyContext:o})}),S(this,"sendRequest",async e=>{const{topic:r,method:n,params:s,expiry:o,relayRpcId:c,clientRpcId:l,throwOnFailedPublish:u,appLink:h,tvf:d,publishOpts:p={}}=e,_=Nt(n,s,l);let f;const m=!!h;try{const R=m?jt:Me;f=await this.client.core.crypto.encode(r,_,{encoding:R})}catch(R){throw await this.cleanup(),this.client.logger.error(`sendRequest() -> core.crypto.encode() for topic ${r} failed`),R}let y;if(Cb.includes(n)){const R=Xe(JSON.stringify(_)),v=Xe(f);y=await this.client.core.verify.register({id:v,decryptedId:R})}const b=ie(ie({},Ie[n].req),p);if(b.attestation=y,o&&(b.ttl=o),c&&(b.id=c),this.client.core.history.set(r,_),m){const R=xr(h,r,f);await K.Linking.openURL(R,this.client.name)}else b.tvf=Le(ie({},d),{correlationId:_.id}),u?(b.internal=Le(ie({},b.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(r,f,b)):this.client.core.relayer.publish(r,f,b).catch(R=>this.client.logger.error(R));return _.id}),S(this,"sendProposeSession",async e=>{const{proposal:r,publishOpts:n}=e,s=Nt("wc_sessionPropose",r,r.id);this.client.core.history.set(r.pairingTopic,s);const o=await this.client.core.crypto.encode(r.pairingTopic,s,{encoding:Me}),c=Xe(JSON.stringify(s)),l=Xe(o),u=await this.client.core.verify.register({id:l,decryptedId:c});await this.client.core.relayer.publishCustom({payload:{pairingTopic:r.pairingTopic,sessionProposal:o},opts:Le(ie({},n),{publishMethod:"wc_proposeSession",attestation:u})})}),S(this,"sendApproveSession",async e=>{const{sessionTopic:r,pairingProposalResponse:n,proposal:s,sessionSettleRequest:o,publishOpts:c}=e,l=Kr(s.id,n),u=await this.client.core.crypto.encode(s.pairingTopic,l,{encoding:Me}),h=Nt("wc_sessionSettle",o,c==null?void 0:c.id),d=await this.client.core.crypto.encode(r,h,{encoding:Me});this.client.core.history.set(r,h),await this.client.core.relayer.publishCustom({payload:{sessionTopic:r,pairingTopic:s.pairingTopic,sessionProposalResponse:u,sessionSettlementRequest:d},opts:Le(ie({},c),{publishMethod:"wc_approveSession"})})}),S(this,"sendResult",async e=>{const{id:r,topic:n,result:s,throwOnFailedPublish:o,encodeOpts:c,appLink:l}=e,u=Kr(r,s);let h;const d=l&&typeof(K==null?void 0:K.Linking)<"u";try{const f=d?jt:Me;h=await this.client.core.crypto.encode(n,u,Le(ie({},c||{}),{encoding:f}))}catch(f){throw await this.cleanup(),this.client.logger.error(`sendResult() -> core.crypto.encode() for topic ${n} failed`),f}let p,_;try{p=await this.client.core.history.get(n,r);const f=p.request;try{_=this.getTVFParams(r,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(${n}, ${r}) failed`),f}if(d){const f=xr(l,n,h);await K.Linking.openURL(f,this.client.name)}else{const f=p.request.method,m=Ie[f].res;m.tvf=Le(ie({},_),{correlationId:r}),o?(m.internal=Le(ie({},m.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(n,h,m)):this.client.core.relayer.publish(n,h,m).catch(y=>this.client.logger.error(y))}await this.client.core.history.resolve(u)}),S(this,"sendError",async e=>{const{id:r,topic:n,error:s,encodeOpts:o,rpcOpts:c,appLink:l}=e,u=Hc(r,s);let h;const d=l&&typeof(K==null?void 0:K.Linking)<"u";try{const _=d?jt:Me;h=await this.client.core.crypto.encode(n,u,Le(ie({},o||{}),{encoding:_}))}catch(_){throw await this.cleanup(),this.client.logger.error(`sendError() -> core.crypto.encode() for topic ${n} failed`),_}let p;try{p=await this.client.core.history.get(n,r)}catch(_){throw this.client.logger.error(`sendError() -> history.get(${n}, ${r}) failed`),_}if(d){const _=xr(l,n,h);await K.Linking.openURL(_,this.client.name)}else{const _=p.request.method,f=c||Ie[_].res;this.client.core.relayer.publish(n,h,f)}await this.client.core.history.resolve(u)}),S(this,"cleanup",async()=>{const e=[],r=[];this.client.session.getAll().forEach(n=>{let s=!1;Bt(n.expiry)&&(s=!0),this.client.core.crypto.keychain.has(n.topic)||(s=!0),s&&e.push(n.topic)}),this.client.proposal.getAll().forEach(n=>{Bt(n.expiryTimestamp)&&r.push(n.id)}),await Promise.all([...e.map(n=>this.deleteSession({topic:n})),...r.map(n=>this.deleteProposal(n))])}),S(this,"onProviderMessageEvent",async e=>{!this.initialized||this.relayMessageCache.length>0?this.relayMessageCache.push(e):await this.onRelayMessage(e)}),S(this,"onRelayEventRequest",async e=>{this.requestQueue.queue.push(e),await this.processRequestsQueue()}),S(this,"processRequestsQueue",async()=>{if(this.requestQueue.state===dt.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=dt.active;const e=this.requestQueue.queue.shift();if(e)try{await this.processRequest(e)}catch(r){this.client.logger.warn(r)}}this.requestQueue.state=dt.idle}),S(this,"processRequest",async e=>{const{topic:r,payload:n,attestation:s,transportType:o,encryptedId:c}=e,l=n.method;if(!this.shouldIgnorePairingRequest({topic:r,requestMethod:l}))switch(l){case"wc_sessionPropose":return await this.onSessionProposeRequest({topic:r,payload:n,attestation:s,encryptedId:c});case"wc_sessionSettle":return await this.onSessionSettleRequest(r,n);case"wc_sessionUpdate":return await this.onSessionUpdateRequest(r,n);case"wc_sessionExtend":return await this.onSessionExtendRequest(r,n);case"wc_sessionPing":return await this.onSessionPingRequest(r,n);case"wc_sessionDelete":return await this.onSessionDeleteRequest(r,n);case"wc_sessionRequest":return await this.onSessionRequest({topic:r,payload:n,attestation:s,encryptedId:c,transportType:o});case"wc_sessionEvent":return await this.onSessionEventRequest(r,n);case"wc_sessionAuthenticate":return await this.onSessionAuthenticateRequest({topic:r,payload:n,attestation:s,encryptedId:c,transportType:o});default:return this.client.logger.info(`Unsupported request method ${l}`)}}),S(this,"onRelayEventResponse",async e=>{const{topic:r,payload:n,transportType:s}=e,o=(await this.client.core.history.get(r,n.id)).request.method;switch(o){case"wc_sessionPropose":return this.onSessionProposeResponse(r,n,s);case"wc_sessionSettle":return this.onSessionSettleResponse(r,n);case"wc_sessionUpdate":return this.onSessionUpdateResponse(r,n);case"wc_sessionExtend":return this.onSessionExtendResponse(r,n);case"wc_sessionPing":return this.onSessionPingResponse(r,n);case"wc_sessionRequest":return this.onSessionRequestResponse(r,n);case"wc_sessionAuthenticate":return this.onSessionAuthenticateResponse(r,n);default:return this.client.logger.info(`Unsupported response method ${o}`)}}),S(this,"onRelayEventUnknownPayload",e=>{const{topic:r}=e,{message:n}=N("MISSING_OR_INVALID",`Decoded payload on topic ${r} is not identifiable as a JSON-RPC request or a response.`);throw new Error(n)}),S(this,"shouldIgnorePairingRequest",e=>{const{topic:r,requestMethod:n}=e,s=this.expectedPairingMethodMap.get(r);return!s||s.includes(n)?!1:!!(s.includes("wc_sessionAuthenticate")&&this.client.events.listenerCount("session_authenticate")>0)}),S(this,"onSessionProposeRequest",async e=>{const{topic:r,payload:n,attestation:s,encryptedId:o}=e,{params:c,id:l}=n;try{const u=this.client.core.eventClient.getEvent({topic:r});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(ie({},n.params));const h=c.expiryTimestamp||_e(Ie.wc_sessionPropose.req.ttl),d=ie({id:l,pairingTopic:r,expiryTimestamp:h,attestation:s,encryptedId:o},c);await this.setProposal(l,d);const p=await this.getVerifyContext({attestationId:s,hash:Xe(JSON.stringify(n)),encryptedId:o,metadata:d.proposer.metadata});u==null||u.addTrace(pt.emit_session_proposal),this.client.events.emit("session_proposal",{id:l,params:d,verifyContext:p})}catch(u){await this.sendError({id:l,topic:r,error:u,rpcOpts:Ie.wc_sessionPropose.autoReject}),this.client.logger.error(u)}}),S(this,"onSessionProposeResponse",async(e,r,n)=>{const{id:s}=r;if(bt(r)){const{result:o}=r;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 h=await this.client.core.crypto.generateSharedKey(l,u);this.pendingSessions.set(s,{sessionTopic:h,pairingTopic:e,proposalId:s,publicKey:l});const d=await this.client.core.relayer.subscribe(h,{transportType:n});this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:d}),await this.client.core.pairing.activate({topic:e})}else if(_t(r)){await this.deleteProposal(s);const o=te("session_connect",s);if(this.events.listenerCount(o)===0)throw new Error(`emitting ${o} without any listeners, 954`);this.events.emit(o,{error:r.error})}}),S(this,"onSessionSettleRequest",async(e,r)=>{const{id:n,params:s}=r;try{this.isValidSessionSettleRequest(s);const{relay:o,controller:c,expiry:l,namespaces:u,sessionProperties:h,scopedProperties:d,sessionConfig:p}=r.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(ie(ie(ie({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}},h&&{sessionProperties:h}),d&&{scopedProperties:d}),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(te("session_connect",_.proposalId),{session:m}),this.pendingSessions.delete(_.proposalId),this.deleteProposal(_.proposalId,!1),this.cleanupDuplicatePairings(m),await this.sendResult({id:r.id,topic:e,result:!0})}catch(o){await this.sendError({id:n,topic:e,error:o}),this.client.logger.error(o)}}),S(this,"onSessionSettleResponse",async(e,r)=>{const{id:n}=r;bt(r)?(await this.client.session.update(e,{acknowledged:!0}),this.events.emit(te("session_approve",n),{})):_t(r)&&(await this.client.session.delete(e,ae("USER_DISCONNECTED")),this.events.emit(te("session_approve",n),{error:r.error}))}),S(this,"onSessionUpdateRequest",async(e,r)=>{const{params:n,id:s}=r;try{const o=`${e}_session_update`,c=Mi.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(ie({topic:e},n));try{Mi.set(o,s),await this.client.session.update(e,{namespaces:n.namespaces}),await this.sendResult({id:s,topic:e,result:!0})}catch(l){throw Mi.delete(o),l}this.client.events.emit("session_update",{id:s,topic:e,params:n})}catch(o){await this.sendError({id:s,topic:e,error:o}),this.client.logger.error(o)}}),S(this,"isRequestOutOfSync",(e,r)=>r.toString().slice(0,-3)<e.toString().slice(0,-3)),S(this,"onSessionUpdateResponse",(e,r)=>{const{id:n}=r,s=te("session_update",n);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);bt(r)?this.events.emit(te("session_update",n),{}):_t(r)&&this.events.emit(te("session_update",n),{error:r.error})}),S(this,"onSessionExtendRequest",async(e,r)=>{const{id:n}=r;try{this.isValidExtend({topic:e}),await this.setExpiry(e,_e(gi)),await this.sendResult({id:n,topic:e,result:!0}),this.client.events.emit("session_extend",{id:n,topic:e})}catch(s){await this.sendError({id:n,topic:e,error:s}),this.client.logger.error(s)}}),S(this,"onSessionExtendResponse",(e,r)=>{const{id:n}=r,s=te("session_extend",n);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);bt(r)?this.events.emit(te("session_extend",n),{}):_t(r)&&this.events.emit(te("session_extend",n),{error:r.error})}),S(this,"onSessionPingRequest",async(e,r)=>{const{id:n}=r;try{this.isValidPing({topic:e}),await this.sendResult({id:n,topic:e,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_ping",{id:n,topic:e})}catch(s){await this.sendError({id:n,topic:e,error:s}),this.client.logger.error(s)}}),S(this,"onSessionPingResponse",(e,r)=>{const{id:n}=r,s=te("session_ping",n);setTimeout(()=>{if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners 2176`);bt(r)?this.events.emit(te("session_ping",n),{}):_t(r)&&this.events.emit(te("session_ping",n),{error:r.error})},500)}),S(this,"onSessionDeleteRequest",async(e,r)=>{const{id:n}=r;try{this.isValidDisconnect({topic:e,reason:r.params}),await Promise.all([new Promise(s=>{this.client.core.relayer.once(le.publish,async()=>{s(await this.deleteSession({topic:e,id:n}))})}),this.sendResult({id:n,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)}}),S(this,"onSessionRequest",async e=>{var r,n,s;const{topic:o,payload:c,attestation:l,encryptedId:u,transportType:h}=e,{id:d,params:p}=c;try{await this.isValidRequest(ie({topic:o},p));const _=this.client.session.get(o),f=await this.getVerifyContext({attestationId:l,hash:Xe(JSON.stringify(Nt("wc_sessionRequest",p,d))),encryptedId:u,metadata:_.peer.metadata,transportType:h}),m={id:d,topic:o,params:p,verifyContext:f};await this.setPendingSessionRequest(m),h===se.link_mode&&(r=_.peer.metadata.redirect)!=null&&r.universal&&this.client.core.addLinkModeSupportedApp((n=_.peer.metadata.redirect)==null?void 0:n.universal),(s=this.client.signConfig)!=null&&s.disableRequestQueue?this.emitSessionRequest(m):(this.addSessionRequestToSessionRequestQueue(m),this.processSessionRequestQueue())}catch(_){await this.sendError({id:d,topic:o,error:_}),this.client.logger.error(_)}}),S(this,"onSessionRequestResponse",(e,r)=>{const{id:n}=r,s=te("session_request",n);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);bt(r)?this.events.emit(te("session_request",n),{result:r.result}):_t(r)&&this.events.emit(te("session_request",n),{error:r.error})}),S(this,"onSessionEventRequest",async(e,r)=>{const{id:n,params:s}=r;try{const o=`${e}_session_event_${s.event.name}`,c=Mi.get(o);if(c&&this.isRequestOutOfSync(c,n)){this.client.logger.info(`Discarding out of sync request - ${n}`);return}this.isValidEmit(ie({topic:e},s)),this.client.events.emit("session_event",{id:n,topic:e,params:s}),Mi.set(o,n)}catch(o){await this.sendError({id:n,topic:e,error:o}),this.client.logger.error(o)}}),S(this,"onSessionAuthenticateResponse",(e,r)=>{const{id:n}=r;this.client.logger.trace({type:"method",method:"onSessionAuthenticateResponse",topic:e,payload:r}),bt(r)?this.events.emit(te("session_request",n),{result:r.result}):_t(r)&&this.events.emit(te("session_request",n),{error:r.error})}),S(this,"onSessionAuthenticateRequest",async e=>{var r;const{topic:n,payload:s,attestation:o,encryptedId:c,transportType:l}=e;try{const{requester:u,authPayload:h,expiryTimestamp:d}=s.params,p=await this.getVerifyContext({attestationId:o,hash:Xe(JSON.stringify(s)),encryptedId:c,metadata:u.metadata,transportType:l}),_={requester:u,pairingTopic:n,id:s.id,authPayload:h,verifyContext:p,expiryTimestamp:d};await this.setAuthRequest(s.id,{request:_,pairingTopic:n,transportType:l}),l===se.link_mode&&(r=u.metadata.redirect)!=null&&r.universal&&this.client.core.addLinkModeSupportedApp(u.metadata.redirect.universal),this.client.events.emit("session_authenticate",{topic:n,params:s.params,id:s.id,verifyContext:p})}catch(u){this.client.logger.error(u);const h=s.params.requester.publicKey,d=await this.client.core.crypto.generateKeyPair(),p=this.getAppLinkIfEnabled(s.params.requester.metadata,l),_={type:Ot,receiverPublicKey:h,senderPublicKey:d};await this.sendError({id:s.id,topic:n,error:u,encodeOpts:_,rpcOpts:Ie.wc_sessionAuthenticate.autoReject,appLink:p})}}),S(this,"addSessionRequestToSessionRequestQueue",e=>{this.sessionRequestQueue.queue.push(e)}),S(this,"cleanupAfterResponse",e=>{this.deletePendingSessionRequest(e.response.id,{message:"fulfilled",code:0}),setTimeout(()=>{this.sessionRequestQueue.state=dt.idle,this.processSessionRequestQueue()},B.toMiliseconds(this.requestQueueDelay))}),S(this,"cleanupPendingSentRequestsForTopic",({topic:e,error:r})=>{const n=this.client.core.history.pending;n.length>0&&n.filter(s=>s.topic===e&&s.request.method==="wc_sessionRequest").forEach(s=>{const o=s.request.id,c=te("session_request",o);if(this.events.listenerCount(c)===0)throw new Error(`emitting ${c} without any listeners`);this.events.emit(te("session_request",s.request.id),{error:r})})}),S(this,"processSessionRequestQueue",()=>{if(this.sessionRequestQueue.state===dt.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(r){this.client.logger.error(r)}}),S(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=dt.active,this.emittedSessionRequests.add(e.id),this.client.events.emit("session_request",e)}),S(this,"onPairingCreated",e=>{if(e.methods&&this.expectedPairingMethodMap.set(e.topic,e.methods),e.active)return;const r=this.client.proposal.getAll().find(n=>n.pairingTopic===e.topic);r&&this.onSessionProposeRequest({topic:e.topic,payload:Nt("wc_sessionPropose",Le(ie({},r),{requiredNamespaces:r.requiredNamespaces,optionalNamespaces:r.optionalNamespaces,relays:r.relays,proposer:r.proposer,sessionProperties:r.sessionProperties,scopedProperties:r.scopedProperties}),r.id),attestation:r.attestation,encryptedId:r.encryptedId})}),S(this,"isValidConnect",async e=>{if(!Ue(e)){const{message:u}=N("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(e)}`);throw new Error(u)}const{pairingTopic:r,requiredNamespaces:n,optionalNamespaces:s,sessionProperties:o,scopedProperties:c,relays:l}=e;if(fe(r)||await this.isValidPairingTopic(r),!Eg(l)){const{message:u}=N("MISSING_OR_INVALID",`connect() relays: ${l}`);throw new Error(u)}if(!fe(n)&&dr(n)!==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(n,"requiredNamespaces")}if(!fe(s)&&dr(s)!==0&&this.validateNamespaces(s,"optionalNamespaces"),fe(o)||this.validateSessionProps(o,"sessionProperties"),!fe(c)){this.validateSessionProps(c,"scopedProperties");const u=Object.keys(n||{}).concat(Object.keys(s||{}));if(!Object.keys(c).every(h=>u.includes(h.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)}`)}}),S(this,"validateNamespaces",(e,r)=>{const n=gg(e,"connect()",r);if(n)throw new Error(n.message)}),S(this,"isValidApprove",async e=>{if(!Ue(e))throw new Error(N("MISSING_OR_INVALID",`approve() params: ${e}`).message);const{id:r,namespaces:n,relayProtocol:s,sessionProperties:o,scopedProperties:c}=e;this.checkRecentlyDeleted(r),await this.isValidProposalId(r);const l=this.client.proposal.get(r),u=$n(n,"approve()");if(u)throw new Error(u.message);const h=Ya(l.requiredNamespaces,n,"approve()");if(h)throw new Error(h.message);if(!de(s,!0)){const{message:d}=N("MISSING_OR_INVALID",`approve() relayProtocol: ${s}`);throw new Error(d)}if(fe(o)||this.validateSessionProps(o,"sessionProperties"),!fe(c)){this.validateSessionProps(c,"scopedProperties");const d=new Set(Object.keys(n));if(!Object.keys(c).every(p=>d.has(p.split(":")[0])))throw new Error(`Scoped properties must be a subset of approved namespaces, received: ${JSON.stringify(c)}, approved namespaces: ${Array.from(d).join(", ")}`)}}),S(this,"isValidReject",async e=>{if(!Ue(e)){const{message:s}=N("MISSING_OR_INVALID",`reject() params: ${e}`);throw new Error(s)}const{id:r,reason:n}=e;if(this.checkRecentlyDeleted(r),await this.isValidProposalId(r),!bg(n)){const{message:s}=N("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(n)}`);throw new Error(s)}}),S(this,"isValidSessionSettleRequest",e=>{if(!Ue(e)){const{message:u}=N("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${e}`);throw new Error(u)}const{relay:r,controller:n,namespaces:s,expiry:o}=e;if(!Vu(r)){const{message:u}=N("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(u)}const c=pg(n,"onSessionSettleRequest()");if(c)throw new Error(c.message);const l=$n(s,"onSessionSettleRequest()");if(l)throw new Error(l.message);if(Bt(o)){const{message:u}=N("EXPIRED","onSessionSettleRequest()");throw new Error(u)}}),S(this,"isValidUpdate",async e=>{if(!Ue(e)){const{message:l}=N("MISSING_OR_INVALID",`update() params: ${e}`);throw new Error(l)}const{topic:r,namespaces:n}=e;this.checkRecentlyDeleted(r),await this.isValidSessionTopic(r);const s=this.client.session.get(r),o=$n(n,"update()");if(o)throw new Error(o.message);const c=Ya(s.requiredNamespaces,n,"update()");if(c)throw new Error(c.message)}),S(this,"isValidExtend",async e=>{if(!Ue(e)){const{message:n}=N("MISSING_OR_INVALID",`extend() params: ${e}`);throw new Error(n)}const{topic:r}=e;this.checkRecentlyDeleted(r),await this.isValidSessionTopic(r)}),S(this,"isValidRequest",async e=>{if(!Ue(e)){const{message:l}=N("MISSING_OR_INVALID",`request() params: ${e}`);throw new Error(l)}const{topic:r,request:n,chainId:s,expiry:o}=e;this.checkRecentlyDeleted(r),await this.isValidSessionTopic(r);const{namespaces:c}=this.client.session.get(r);if(!Ja(c,s)){const{message:l}=N("MISSING_OR_INVALID",`request() chainId: ${s}`);throw new Error(l)}if(!Ig(n)){const{message:l}=N("MISSING_OR_INVALID",`request() ${JSON.stringify(n)}`);throw new Error(l)}if(!Pg(c,s,n.method)){const{message:l}=N("MISSING_OR_INVALID",`request() method: ${n.method}`);throw new Error(l)}if(o&&!Dg(o,qn)){const{message:l}=N("MISSING_OR_INVALID",`request() expiry: ${o}. Expiry must be a number (in seconds) between ${qn.min} and ${qn.max}`);throw new Error(l)}}),S(this,"isValidRespond",async e=>{var r;if(!Ue(e)){const{message:o}=N("MISSING_OR_INVALID",`respond() params: ${e}`);throw new Error(o)}const{topic:n,response:s}=e;try{await this.isValidSessionTopic(n)}catch(o){throw(r=e==null?void 0:e.response)!=null&&r.id&&this.cleanupAfterResponse(e),o}if(!Ag(s)){const{message:o}=N("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(s)}`);throw new Error(o)}}),S(this,"isValidPing",async e=>{if(!Ue(e)){const{message:n}=N("MISSING_OR_INVALID",`ping() params: ${e}`);throw new Error(n)}const{topic:r}=e;await this.isValidSessionOrPairingTopic(r)}),S(this,"isValidEmit",async e=>{if(!Ue(e)){const{message:c}=N("MISSING_OR_INVALID",`emit() params: ${e}`);throw new Error(c)}const{topic:r,event:n,chainId:s}=e;await this.isValidSessionTopic(r);const{namespaces:o}=this.client.session.get(r);if(!Ja(o,s)){const{message:c}=N("MISSING_OR_INVALID",`emit() chainId: ${s}`);throw new Error(c)}if(!Tg(n)){const{message:c}=N("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(n)}`);throw new Error(c)}if(!Og(o,s,n.name)){const{message:c}=N("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(n)}`);throw new Error(c)}}),S(this,"isValidDisconnect",async e=>{if(!Ue(e)){const{message:n}=N("MISSING_OR_INVALID",`disconnect() params: ${e}`);throw new Error(n)}const{topic:r}=e;await this.isValidSessionOrPairingTopic(r)}),S(this,"isValidAuthenticate",e=>{const{chains:r,uri:n,domain:s,nonce:o}=e;if(!Array.isArray(r)||r.length===0)throw new Error("chains is required and must be a non-empty array");if(!de(n,!1))throw new Error("uri is required parameter");if(!de(s,!1))throw new Error("domain is required parameter");if(!de(o,!1))throw new Error("nonce is required parameter");if([...new Set(r.map(l=>kr(l).namespace))].length>1)throw new Error("Multi-namespace requests are not supported. Please request single namespace only.");const{namespace:c}=kr(r[0]);if(c!=="eip155")throw new Error("Only eip155 namespace is supported for authenticated sessions. Please use .connect() for non-eip155 chains.")}),S(this,"getVerifyContext",async e=>{const{attestationId:r,hash:n,encryptedId:s,metadata:o,transportType:c}=e,l={verified:{verifyUrl:o.verifyUrl||ir,validation:"UNKNOWN",origin:o.url||""}};try{if(c===se.link_mode){const h=this.getAppLinkIfEnabled(o,c);return l.verified.validation=h&&new URL(h).origin===new URL(o.url).origin?"VALID":"INVALID",l}const u=await this.client.core.verify.resolve({attestationId:r,hash:n,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}),S(this,"validateSessionProps",(e,r)=>{Object.values(e).forEach((n,s)=>{if(n==null){const{message:o}=N("MISSING_OR_INVALID",`${r} must contain an existing value for each key. Received: ${n} for key ${Object.keys(e)[s]}`);throw new Error(o)}})}),S(this,"getPendingAuthRequest",e=>{const r=this.client.auth.requests.get(e);return typeof r=="object"?r:void 0}),S(this,"addToRecentlyDeleted",(e,r)=>{if(this.recentlyDeletedMap.set(e,r),this.recentlyDeletedMap.size>=this.recentlyDeletedLimit){let n=0;const s=this.recentlyDeletedLimit/2;for(const o of this.recentlyDeletedMap.keys()){if(n++>=s)break;this.recentlyDeletedMap.delete(o)}}}),S(this,"checkRecentlyDeleted",e=>{const r=this.recentlyDeletedMap.get(e);if(r){const{message:n}=N("MISSING_OR_INVALID",`Record was recently deleted - ${r}: ${e}`);throw new Error(n)}}),S(this,"isLinkModeEnabled",(e,r)=>{var n,s,o,c,l,u,h,d,p;return!e||r!==se.link_mode?!1:((s=(n=this.client.metadata)==null?void 0:n.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)!==""&&((h=e==null?void 0:e.redirect)==null?void 0:h.universal)!==void 0&&((d=e==null?void 0:e.redirect)==null?void 0:d.universal)!==""&&((p=e==null?void 0:e.redirect)==null?void 0:p.linkMode)===!0&&this.client.core.linkModeSupportedApps.includes(e.redirect.universal)&&typeof(K==null?void 0:K.Linking)<"u"}),S(this,"getAppLinkIfEnabled",(e,r)=>{var n;return this.isLinkModeEnabled(e,r)?(n=e==null?void 0:e.redirect)==null?void 0:n.universal:void 0}),S(this,"handleLinkModeMessage",({url:e})=>{if(!e||!e.includes("wc_ev")||!e.includes("topic"))return;const r=la(e,"topic")||"",n=decodeURIComponent(la(e,"wc_ev")||""),s=this.client.session.keys.includes(r);s&&this.client.session.update(r,{transportType:se.link_mode}),this.client.core.dispatchEnvelope({topic:r,message:n,sessionExists:s})}),S(this,"registerLinkModeListeners",async()=>{var e;if(so()||Ht()&&(e=this.client.metadata.redirect)!=null&&e.linkMode){const r=K==null?void 0:K.Linking;if(typeof r<"u"){r.addEventListener("url",this.handleLinkModeMessage,this.client.name);const n=await r.getInitialURL();n&&setTimeout(()=>{this.handleLinkModeMessage({url:n})},50)}}}),S(this,"getTVFParams",(e,r,n)=>{var s,o,c;if(!((s=r.request)!=null&&s.method))return{};const l={correlationId:e,rpcMethods:[r.request.method],chainId:r.chainId};try{const u=this.extractTxHashesFromResult(r.request,n);l.txHashes=u,l.contractAddresses=this.isValidContractData(r.request.params)?[(c=(o=r.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}),S(this,"isValidContractData",e=>{var r;if(!e)return!1;try{const n=(e==null?void 0:e.data)||((r=e==null?void 0:e[0])==null?void 0:r.data);if(!n.startsWith("0x"))return!1;const s=n.slice(2);return/^[0-9a-fA-F]*$/.test(s)?s.length%2===0:!1}catch{}return!1}),S(this,"extractTxHashesFromResult",(e,r)=>{var n;try{if(!r)return[];const s=e.method,o=xb[s];if(s==="sui_signTransaction")return[Qm(r.transactionBytes)];if(s==="near_signTransaction")return[ya(r)];if(s==="near_signTransactions")return r.map(l=>ya(l));if(s==="xrpl_signTransactionFor"||s==="xrpl_signTransaction")return[(n=r.tx_json)==null?void 0:n.hash];if(s==="polkadot_signTransaction")return[Fg({transaction:e.params.transactionPayload,signature:r.signature})];if(s==="algo_signTxn")return Ai(r)?r.map(l=>wa(l)):[wa(r)];if(s==="cosmos_signDirect")return[ey(r)];if(typeof r=="string")return[r];const c=r[o.key];if(Ai(c))return s==="solana_signAllTransactions"?c.map(l=>Zm(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[r,n]of Object.entries(e))for(const s of n)try{await this.onProviderMessageEvent({topic:r,message:s,publishedAt:Date.now()})}catch{this.client.logger.warn(`Error processing pending message event for topic: ${r}, message: ${s}`)}}catch(t){this.client.logger.warn("processPendingMessageEvents failed",t)}}isInitialized(){if(!this.initialized){const{message:t}=N("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:r,attestation:n,transportType:s}=t,{publicKey:o}=this.client.auth.authKeys.keys.includes(Mr)?this.client.auth.authKeys.get(Mr):{publicKey:void 0};try{const c=await this.client.core.crypto.decode(e,r,{receiverPublicKey:o,encoding:s===se.link_mode?jt:Me});zs(c)?(this.client.core.history.set(e,c),await this.onRelayEventRequest({topic:e,payload:c,attestation:n,transportType:s,encryptedId:Xe(r)})):js(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,r)}catch(c){this.client.logger.error(c)}}registerExpirerEvents(){this.client.core.expirer.on(Qe.expired,async t=>{const{topic:e,id:r}=Nl(t.target);if(r&&this.client.pendingRequest.keys.includes(r))return await this.deletePendingSessionRequest(r,N("EXPIRED"),!0);if(r&&this.client.auth.requests.keys.includes(r))return await this.deletePendingAuthRequest(r,N("EXPIRED"),!0);e?this.client.session.keys.includes(e)&&(await this.deleteSession({topic:e,expirerHasDeleted:!0}),this.client.events.emit("session_expire",{topic:e})):r&&(await this.deleteProposal(r,!0),this.client.events.emit("proposal_expire",{id:r}))})}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(!de(t,!1)){const{message:e}=N("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}=N("NO_MATCHING_KEY",`pairing topic doesn't exist: ${t}`);throw new Error(e)}if(Bt(this.client.core.pairing.pairings.get(t).expiry)){const{message:e}=N("EXPIRED",`pairing topic: ${t}`);throw new Error(e)}}async isValidSessionTopic(t){if(!de(t,!1)){const{message:e}=N("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}=N("NO_MATCHING_KEY",`session topic doesn't exist: ${t}`);throw new Error(e)}if(Bt(this.client.session.get(t).expiry)){await this.deleteSession({topic:t});const{message:e}=N("EXPIRED",`session topic: ${t}`);throw new Error(e)}if(!this.client.core.crypto.keychain.has(t)){const{message:e}=N("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(de(t,!1)){const{message:e}=N("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${t}`);throw new Error(e)}else{const{message:e}=N("MISSING_OR_INVALID",`session or pairing topic should be a string: ${t}`);throw new Error(e)}}async isValidProposalId(t){if(!vg(t)){const{message:e}=N("MISSING_OR_INVALID",`proposal id should be a number: ${t}`);throw new Error(e)}if(!this.client.proposal.keys.includes(t)){const{message:e}=N("NO_MATCHING_KEY",`proposal id doesn't exist: ${t}`);throw new Error(e)}if(Bt(this.client.proposal.get(t).expiryTimestamp)){await this.deleteProposal(t);const{message:e}=N("EXPIRED",`proposal id: ${t}`);throw new Error(e)}}}class Wb extends pi{constructor(t,e){super(t,e,Lb,vo),this.core=t,this.logger=e}}class Hb extends pi{constructor(t,e){super(t,e,Db,vo),this.core=t,this.logger=e}}class Gb extends pi{constructor(t,e){super(t,e,Sb,vo,r=>r.id),this.core=t,this.logger=e}}class Jb extends pi{constructor(t,e){super(t,e,Ub,fn,()=>Mr),this.core=t,this.logger=e}}class Yb extends pi{constructor(t,e){super(t,e,Nb,fn),this.core=t,this.logger=e}}class Zb extends pi{constructor(t,e){super(t,e,Bb,fn,r=>r.id),this.core=t,this.logger=e}}var Qb=Object.defineProperty,Xb=(i,t,e)=>t in i?Qb(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,zn=(i,t,e)=>Xb(i,typeof t!="symbol"?t+"":t,e);class eI{constructor(t,e){this.core=t,this.logger=e,zn(this,"authKeys"),zn(this,"pairingTopics"),zn(this,"requests"),this.authKeys=new Jb(this.core,this.logger),this.pairingTopics=new Yb(this.core,this.logger),this.requests=new Zb(this.core,this.logger)}async init(){await this.authKeys.init(),await this.pairingTopics.init(),await this.requests.init()}}var tI=Object.defineProperty,iI=(i,t,e)=>t in i?tI(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Y=(i,t,e)=>iI(i,typeof t!="symbol"?t+"":t,e);class bo extends n_{constructor(t){super(t),Y(this,"protocol",Gu),Y(this,"version",Ju),Y(this,"name",Mn.name),Y(this,"metadata"),Y(this,"core"),Y(this,"logger"),Y(this,"events",new ui.EventEmitter),Y(this,"engine"),Y(this,"session"),Y(this,"proposal"),Y(this,"pendingRequest"),Y(this,"auth"),Y(this,"signConfig"),Y(this,"on",(r,n)=>this.events.on(r,n)),Y(this,"once",(r,n)=>this.events.once(r,n)),Y(this,"off",(r,n)=>this.events.off(r,n)),Y(this,"removeListener",(r,n)=>this.events.removeListener(r,n)),Y(this,"removeAllListeners",r=>this.events.removeAllListeners(r)),Y(this,"connect",async r=>{try{return await this.engine.connect(r)}catch(n){throw this.logger.error(n.message),n}}),Y(this,"pair",async r=>{try{return await this.engine.pair(r)}catch(n){throw this.logger.error(n.message),n}}),Y(this,"approve",async r=>{try{return await this.engine.approve(r)}catch(n){throw this.logger.error(n.message),n}}),Y(this,"reject",async r=>{try{return await this.engine.reject(r)}catch(n){throw this.logger.error(n.message),n}}),Y(this,"update",async r=>{try{return await this.engine.update(r)}catch(n){throw this.logger.error(n.message),n}}),Y(this,"extend",async r=>{try{return await this.engine.extend(r)}catch(n){throw this.logger.error(n.message),n}}),Y(this,"request",async r=>{try{return await this.engine.request(r)}catch(n){throw this.logger.error(n.message),n}}),Y(this,"respond",async r=>{try{return await this.engine.respond(r)}catch(n){throw this.logger.error(n.message),n}}),Y(this,"ping",async r=>{try{return await this.engine.ping(r)}catch(n){throw this.logger.error(n.message),n}}),Y(this,"emit",async r=>{try{return await this.engine.emit(r)}catch(n){throw this.logger.error(n.message),n}}),Y(this,"disconnect",async r=>{try{return await this.engine.disconnect(r)}catch(n){throw this.logger.error(n.message),n}}),Y(this,"find",r=>{try{return this.engine.find(r)}catch(n){throw this.logger.error(n.message),n}}),Y(this,"getPendingSessionRequests",()=>{try{return this.engine.getPendingSessionRequests()}catch(r){throw this.logger.error(r.message),r}}),Y(this,"authenticate",async(r,n)=>{try{return await this.engine.authenticate(r,n)}catch(s){throw this.logger.error(s.message),s}}),Y(this,"formatAuthMessage",r=>{try{return this.engine.formatAuthMessage(r)}catch(n){throw this.logger.error(n.message),n}}),Y(this,"approveSessionAuthenticate",async r=>{try{return await this.engine.approveSessionAuthenticate(r)}catch(n){throw this.logger.error(n.message),n}}),Y(this,"rejectSessionAuthenticate",async r=>{try{return await this.engine.rejectSessionAuthenticate(r)}catch(n){throw this.logger.error(n.message),n}}),this.name=(t==null?void 0:t.name)||Mn.name,this.metadata=jf(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:on(eo({level:(t==null?void 0:t.logger)||Mn.logger}));this.core=(t==null?void 0:t.core)||new Rb(t),this.logger=Ce(e,this.name),this.session=new Hb(this.core,this.logger),this.proposal=new Wb(this.core,this.logger),this.pendingRequest=new Gb(this.core,this.logger),this.engine=new Fb(this),this.auth=new eI(this.core,this.logger)}static async init(t){const e=new bo(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 rI=bo,nI="08c4b07e3ad25f1a27c14a4e8cecb6f0",xA="eip155";async function sI(i){const{account:t,chainId:e,params:[r]}=i;if(!t.sendRawTransaction)throw new Error("The current account does not support sending raw transactions");return(await t.sendRawTransaction({chainId:e,rawTransaction:r})).transactionHash}function mn(i,t){if(Lo(i.address)!==Lo(t))throw new Error(`Failed to validate account address (${i.address}), differs from ${t}`)}function SA(i){const t=i.split(":"),e=Number.parseInt(t[1]??"0");if(t.length!==2||t[0]!=="eip155"||e===0||!e)throw new Error(`Invalid chainId ${i}, should have the format 'eip155:1'`);return e}async function oI(i){const{account:t,chainId:e,thirdwebClient:r,params:[n]}=i;n.from!==void 0&&mn(t,n.from);const s=Jn({chain:ge(e),client:r,data:n.data,gas:n.gas?Ve(n.gas):void 0,gasPrice:n.gasPrice?Ve(n.gasPrice):void 0,to:n.to,value:n.value?Ve(n.value):void 0});return(await Mc({account:t,transaction:s})).transactionHash}async function Pc(i){const{account:t,params:e}=i;return mn(t,e[1]),t.signMessage({message:{raw:e[0]}})}async function aI(i){const{account:t,params:[e]}=i;if(!t.signTransaction)throw new Error("The current account does not support signing transactions");return e.from!==void 0&&mn(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?si(e.nonce):void 0,to:e.to,value:e.value?Ve(e.value):void 0})}async function Oc(i){const{account:t,params:e}=i;return mn(t,e[0]),t.signTypedData(typeof e[1]=="string"?JSON.parse(e[1]):e[1])}async function Zu(i){var r;const{wallet:t,params:e}=i;return((r=t.getChain())==null?void 0:r.id)===si(e[0].chainId)||await t.switchChain(Bh(si(e[0].chainId))),"0x1"}const CA=Object.freeze(Object.defineProperty({__proto__:null,handleSwitchChain:Zu},Symbol.toStringTag,{value:"Module"})),$A="/sdk/2022-08-12/embedded-wallet",jn=i=>`thirdwebEwsWalletUserId-${i}`,cI="walletToken",Kn=i=>`${cI}-${i}`,Rc=i=>`passkey-credential-id-${i}`,lI="a",Fn=(i,t)=>`${lI}-${i}-${t}`,Lc=i=>`walletConnectSessions-${i}`,Dc=i=>`thirdweb_guest_session_id_${i}`,Vc=new Map;class Io{constructor({storage:t,clientId:e,ecosystem:r}){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=uI(e,r==null?void 0:r.id),this.ecosystem=r}async getItem(t){return this.storage?this.storage.getItem(t):Vc.get(t)??null}async setItem(t,e){if(this.storage)return this.storage.setItem(t,e);Vc.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(Lc(this.key))}async saveWalletConnectSessions(t){await this.setItem(Lc(this.key),t)}async savePasskeyCredentialId(t){await this.setItem(Rc(this.key),t)}async getPasskeyCredentialId(){return this.getItem(Rc(this.key))}async saveAuthCookie(t){await this.setItem(Kn(this.key),t)}async getAuthCookie(){return this.getItem(Kn(this.key))}async removeAuthCookie(){return this.removeItem(Kn(this.key))}async saveDeviceShare(t,e){await this.saveWalletUserId(e),await this.setItem(Fn(this.key,e),t)}async getDeviceShare(){const t=await this.getWalletUserId();return t?this.getItem(Fn(this.key,t)):null}async removeDeviceShare(){const t=await this.getWalletUserId();return t?this.removeItem(Fn(this.key,t)):!1}async getWalletUserId(){return this.getItem(jn(this.key))}async saveWalletUserId(t){await this.setItem(jn(this.key),t)}async removeWalletUserId(){return this.removeItem(jn(this.key))}async getGuestSessionId(){return this.getItem(Dc(this.key))}async saveGuestSessionId(t){await this.setItem(Dc(this.key),t)}}const uI=(i,t)=>`${i}${t?`-${t}`:""}`;let yt;async function Qu(){if(!yt)return[];const i=await yt.getWalletConnectSessions();return JSON.parse(i??"[]")}function hI(i){yt||(yt=new Io({clientId:i.clientId,storage:null}))}async function kA(i){if(!yt)return;const t=await yt.getWalletConnectSessions(),e=JSON.parse(t??"[]");e.push(i),await yt.saveWalletConnectSessions(we(e))}async function dI(i){if(!yt)return;const t=await yt.getWalletConnectSessions(),r=JSON.parse(t??"[]").filter(n=>n.topic!==i.topic);await yt.saveWalletConnectSessions(we(r))}let Wn=new WeakMap;const pI={eth_sendRawTransaction:sI,eth_sendTransaction:oI,eth_sign:Pc,eth_signTransaction:aI,eth_signTypedData:Oc,eth_signTypedData_v4:Oc,personal_sign:Pc,wallet_addEthereumChain:i=>{throw new Error("Unsupported request method: wallet_addEthereumChain")},wallet_switchEthereumChain:Zu};async function _I(i){var h,d,p,_;const{wallet:t,requestHandlers:e,onConnect:r,onDisconnect:n,client:s}=i,o=i.chains&&i.chains.length>10?(console.warn("WalletConnect: Can specify no more than 10 chains, truncating to the first 10 provided chains..."),i.chains.slice(0,10)):i.chains;if(Wn.has(s))return Wn.get(s);hI({clientId:i.client.clientId});const c=Wr(),l=await rI.init({metadata:{description:((h=i.appMetadata)==null?void 0:h.description)??c.description,icons:[((d=i.appMetadata)==null?void 0:d.logoUrl)??c.logoUrl],name:((p=i.appMetadata)==null?void 0:p.name)??c.name,url:((_=i.appMetadata)==null?void 0:_.url)??c.url},projectId:i.projectId??nI});l.on("session_proposal",async f=>{const{onSessionProposal:m}=await a(async()=>{const{onSessionProposal:y}=await import("./session-proposal-BOVuEqZb.js");return{onSessionProposal:y}},__vite__mapDeps([23,1,2,3,4,5,6,7,8,9,10]));await m({chains:o,event:f,onConnect:r,wallet:t,walletConnectClient:l}).catch(y=>{if(i.onError)i.onError(y);else throw y})}),l.on("session_request",async f=>{const{fulfillRequest:m}=await a(async()=>{const{fulfillRequest:y}=await import("./session-request-u0q6IDVU.js");return{fulfillRequest:y}},__vite__mapDeps([24,1,2,3,4,5,6,7,8,9,10]));await m({event:f,handlers:e,thirdwebClient:s,wallet:t,walletConnectClient:l}).catch(y=>{if(i.onError)i.onError(y);else throw y})}),l.on("session_event",async f=>{}),l.on("session_ping",f=>{}),l.on("session_delete",async f=>{await Xu({session:{topic:f.topic},walletConnectClient:l}).catch(m=>{if(i.onError)i.onError(m);else throw m})});const u=l.disconnect;return l.disconnect=async f=>{const m=await u(f).catch(()=>{});return n&&yI({onDisconnect:n,topic:f.topic}),m},Wn.set(i.client,l),l}function fI(i){const{uri:t,walletConnectClient:e}=i;e.core.pairing.pair({uri:t})}async function mI(){return Qu()}async function Xu(i){dI(i.session);try{await i.walletConnectClient.disconnect({reason:{code:6e3,message:"Disconnected"},topic:i.session.topic})}catch{}}async function yI(i){const{topic:t,onDisconnect:e}=i,r=await Qu();e(r.find(n=>n.topic===t)??{topic:t})}function wI(i){return[at("inApp",{executionMode:i==null?void 0:i.executionMode}),at(Jc),at(ft,{appMetadata:i==null?void 0:i.appMetadata,chains:i==null?void 0:i.chains}),at(yd),at("io.rabby"),at(wd),at("com.okex.wallet")]}function gI(i,t){const e=new Set;let r=i();const n=()=>{for(const o of e)o()},s=o=>{r=o,n()};for(const o of t)o.subscribe(()=>{s(i())});return{getValue(){return r},subscribe(o){return e.add(o),()=>{e.delete(o)}}}}function Sr(i,t,e=!0){e&&i();const r=t.map(n=>n.subscribe(()=>{i()}));return()=>{for(const n of r)n()}}const pr="tw:connected-wallet-params";async function UA(i,t,e){if(!vI(e))throw new Error("given params are not stringifiable");const r=await i.getItem(pr);let n;if(r){try{n=JSON.parse(r)}catch{n={}}n[t]=e}else n={[t]:e};i.setItem(pr,we(n))}async function EI(i,t){const e=await i.getItem(pr);let r;if(e){try{r=JSON.parse(e)}catch{r={}}delete r[t],i.setItem(pr,we(r))}}async function NA(i,t){const e=await i.getItem(pr);if(!e)return null;try{const r=JSON.parse(e);return r!=null&&r[t]?r[t]:null}catch{return null}}function vI(i){try{return we(i),!0}catch{return!1}}function bI(i){let t;return()=>(t||(t=i()),t)}function II(i={}){return jc({filters:i,signature:"event UserOperationRevertReason(bytes32 indexed userOpHash, address indexed sender, uint256 nonce, bytes revertReason)"})}function AI(i={}){return jc({filters:i,signature:"event PostOpRevertReason(bytes32 indexed userOpHash, address indexed sender, uint256 nonce, bytes revertReason)"})}function TI(i){const{receipt:t}=i,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)),{...i,actualGasCost:BigInt(i.actualGasCost),actualGasUsed:BigInt(i.actualGasUsed),nonce:BigInt(i.nonce),receipt:e,userOpHash:i.userOpHash}}const BA=()=>{const i=BigInt(Math.floor(Math.random()*4294967296)),t=BigInt(Math.floor(Math.random()*4294967296)),e=BigInt(Math.floor(Math.random()*4294967296)),r=BigInt(Math.floor(Math.random()*4294967296)),n=BigInt(Math.floor(Math.random()*4294967296)),s=BigInt(Math.floor(Math.random()*4294967296));return i<<BigInt(160)|t<<BigInt(128)|e<<BigInt(96)|r<<BigInt(64)|n<<BigInt(32)|s};function eh(i){return Object.fromEntries(Object.entries(i).map(([t,e])=>[t,e==null||zr(e)?e:qs(e)]))}async function MA(i){return Gt({...i,operation:"eth_sendUserOperation",params:[eh(i.userOp),i.options.entrypointAddress??Fc]})}async function qA(i,t){const e=await Gt({...i,operation:"eth_estimateUserOperationGas",params:[eh(i.userOp),i.options.entrypointAddress??Fc,t??{}]});return{callGasLimit:Ve(e.callGasLimit)+zh,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 zA(i){const t=await Gt({...i,operation:"thirdweb_getUserOperationGasPrice",params:[]});return{maxFeePerGas:Ve(t.maxFeePerGas),maxPriorityFeePerGas:Ve(t.maxPriorityFeePerGas)}}async function jA(i){var e,r;const t=await PI(i);if(t){if(t.success===!1){const s=(r=(e=Mh({events:[II(),AI()],logs:t.logs})[0])==null?void 0:e.args)==null?void 0:r.revertReason;if(!s)throw new Error(`UserOp failed at txHash: ${t.receipt.transactionHash}`);const o=qh({data:s});throw new Error(`UserOp failed with reason: '${o.args.join(",")}' at txHash: ${t.receipt.transactionHash}`)}return t.receipt}}async function PI(i){const t=await Gt({operation:"eth_getUserOperationReceipt",options:i,params:[i.userOpHash]});if(t)return TI(t)}async function KA(i){const t=await Gt({operation:"zk_paymasterData",options:i.options,params:[i.transaction]});return{paymaster:t.paymaster,paymasterInput:t.paymasterInput}}async function OI(i){const t=await Gt({...i,operation:"tw_execute",params:[i.eoaAddress,i.wrappedCalls,i.signature,i.authorization]});if(!t.queueId)throw new Error(`Error executing 7702 transaction: ${we(t)}`);return{transactionId:t.queueId}}async function RI(i){return{transactionHash:(await Gt({...i,operation:"tw_getTransactionHash",params:[i.transactionId]})).transactionHash}}async function FA(i){return{transactionHash:(await Gt({operation:"zk_broadcastTransaction",options:i.options,params:[{...i.transaction,signedTransaction:i.signedTransaction}]})).transactionHash}}async function Gt(i){const{options:t,operation:e,params:r}=i,n=t.bundlerUrl??Kc(t.chain),o=await _r(t.client)(n,{useAuthToken:!0,body:we({id:1,jsonrpc:"2.0",method:e,params:r}),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
13
  Status: ${o.status}
14
- Code: ${u}`)}return c.result}function xs(i){if(!i)return!1;if(i.id==="smart")return!0;if(i.id==="inApp"||Oi(i)){const t=i.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 th="thirdweb:connected-wallet-ids",qr="thirdweb:active-wallet-id",Ss="thirdweb:active-chain",xc="thirdweb:last-used-wallet-id";function LI(i){const t=Jt(void 0),e=Jt(void 0),r=Jt(void 0),n=Jt("unknown"),s=Jt(new Map);Sr(()=>{jh([...s.getValue().values()])},[s]),Sr(()=>{const v=r.getValue();if(!v)return;const P=s.getValue().get(v.id);!P||P===v||r.setValue(P)},[s,r]);const o=Jt(new Map),c=Jt(!1),l=gI(()=>Array.from(o.getValue().values()),[o]),u=v=>{const P=o.getValue();if(P.has(v.id))return;const T=new Map(P);T.set(v.id,v),o.setValue(T)},h=v=>{const P=o.getValue(),T=new Map(P);T.delete(v.id),o.setValue(T)},d=v=>{EI(i,v.id),h(v),t.getValue()===v&&(i.removeItem(qr),e.setValue(void 0),r.setValue(void 0),t.setValue(void 0),n.setValue("disconnected"))},p=v=>{d(v),v.disconnect()},_=async(v,P)=>{if(!v.getAccount())throw new Error("Cannot set a wallet without an account as active");const g=await(async()=>P!=null&&P.accountAbstraction&&!xs(v)?await DI(v,P.client,P.accountAbstraction,d):v)();return await i.setItem(qr,v.id),await i.setItem(xc,v.id),u(v),(P==null?void 0:P.setWalletAsActive)!==!1&&m(g),v.subscribe("accountChanged",async()=>{var L;const D=await _(v,P);(L=P==null?void 0:P.onConnect)==null||L.call(P,D,l.getValue())}),g},f=async(v,P)=>{var g;const T=await _(v,P);return(g=P==null?void 0:P.onConnect)==null||g.call(P,T,l.getValue()),T},m=v=>{const P=v.getAccount();if(!P)throw new Error("Cannot set a wallet without an account as active");u(v),t.setValue(v),e.setValue(P),r.setValue(v.getChain()),n.setValue("connected");const T=E=>{e.setValue(E)},g=v.subscribe("accountChanged",T),D=v.subscribe("chainChanged",E=>r.setValue(E)),L=v.subscribe("disconnect",()=>{w()}),w=()=>{d(v),g(),D(),L()}},y=async v=>{m(v),v.id!=="smart"&&(await i.setItem(qr,v.id),await i.setItem(xc,v.id))};Sr(()=>{const v=r.getValue();v?i.setItem(Ss,we(v)):i.removeItem(Ss)},[r],!1),Sr(async()=>{const P=l.getValue().map(T=>T==null?void 0:T.id).filter(T=>!!T);i.setItem(th,we(Array.from(new Set([...P]))))},[l],!1);const b=async v=>{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(xs(P)){const T=await Ao(i);if(T){const g=l.getValue().find(D=>D.id===T);if(g){await g.switchChain(v),await P.switchChain(v),m(P);return}}await P.switchChain(v),m(P)}else await P.switchChain(v);r.setValue(P.getChain())};function R(v){const P=s.getValue();if(v.every(D=>{const L=P.get(D.id);return we(L)===we(D)}))return;const g=new Map(P);for(const D of v)g.set(D.id,D);s.setValue(g)}return{activeAccountStore:e,activeWalletChainStore:r,activeWalletConnectionStatusStore:n,activeWalletStore:t,addConnectedWallet:u,connect:f,connectedWallets:l,defineChains:R,disconnectWallet:p,handleConnection:_,isAutoConnecting:c,removeConnectedWallet:h,setActiveWallet:y,switchActiveWalletChain:b}}async function ih(i){try{const t=await i.getItem(th);return t?JSON.parse(t):[]}catch{return[]}}async function Ao(i){try{const t=await i.getItem(qr);if(t)return t}catch{}return null}async function rh(i){try{const t=await i.getItem(Ss);if(t)return JSON.parse(t)}catch{}return null}const DI=async(i,t,e,r)=>{const n=i.getAccount();if(!n)throw new Error("Cannot set a wallet without an account as active");const s=Ys(e);await s.connect({chain:e.chain,client:t,personalAccount:n});const o=i.subscribe("disconnect",()=>{c()}),c=()=>{o(),r(s)};return s};function nh(i,t){return new Promise((e,r)=>{const n=setTimeout(()=>{r(new Error(t.message))},t.ms);i.then(s=>{clearTimeout(n),e(s)},s=>{clearTimeout(n),r(s)})})}async function VI({client:i,ecosystem:t,tokenToLink:e,storage:r}){const n=_r(i,t),s=nn("inAppWallet"),o=await r.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 n(`${s}/api/2024-05-05/account/connect`,{body:we({accountAuthTokenToConnect:e}),headers:c,method:"POST"});if(!l.ok){const h=await l.json();throw new Error(h.message||"Failed to link account.")}const{linkedAccounts:u}=await l.json();return u??[]}async function WA({client:i,ecosystem:t,profileToUnlink:e,allowAccountDeletion:r=!1,storage:n}){const s=_r(i,t),o=nn("inAppWallet"),c=await n.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:r,details:e.details,type:e.type}),headers:l,method:"POST"});if(!u.ok){const d=await u.json();throw new Error(d.message||"Failed to unlink account.")}const{linkedAccounts:h}=await u.json();return h??[]}async function HA({client:i,ecosystem:t,storage:e}){const r=_r(i,t),n=nn("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 r(`${n}/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 sh=["google","apple","facebook","discord","line","x","tiktok","epic","coinbase","farcaster","telegram","github","twitch","steam"],GA=[...sh,"guest","backend","email","phone","passkey","wallet"],xI="0x3f707e6b",SI=[{type:"tuple[]",name:"calls",components:[{type:"address",name:"target"},{type:"uint256",name:"value"},{type:"bytes",name:"data"}]}],CI=[];function $I(i){const t=bI(async()=>"asyncParams"in i?await i.asyncParams():i);return Kh({contract:i.contract,method:[xI,SI,CI],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 kI(i){const{client:t,chain:e,bundlerUrl:r}=i,n=r??Kc(e),s=`delegation-contract:${n}`;return Nc(async()=>{var u;const c=await _r(t)(n,{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 UI=i=>{const{client:t,adminAccount:e,sponsorGas:r}=i,n=async o=>{var f,m,y;const c=o[0];if(!c)throw new Error("No transactions provided");const l=ge(c.chainId),u=Bs({address:e.address,chain:l,client:t,abi:qI});let h=(f=c.authorizationList)==null?void 0:f[0];const d=await kI({client:t,chain:l});if(h&&((m=h.address)==null?void 0:m.toLowerCase())!==d.toLowerCase())throw new Error(`Authorization address does not match expected delegation contract address. Expected ${d} but got ${h.address}`);if(!h&&!await BI(u,d)){let R=c.nonce?BigInt(c.nonce):BigInt(await NI({client:t,address:e.address,chain:l}));R+=r?0n:1n;const v=await((y=e.signAuthorization)==null?void 0:y.call(e,{address:Z(d),chainId:c.chainId,nonce:R}));if(!v)throw new Error("Failed to sign authorization");h=v}if(r){const b={calls:o.map(T=>({data:T.data??"0x",target:Z(T.to??""),value:T.value??0n})),uid:Fh()},R=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"}]}}),v=await OI({authorization:h,eoaAddress:Z(e.address),options:{chain:ge(c.chainId),client:t},signature:R,wrappedCalls:b});return{transactionHash:await MI({options:{chain:ge(c.chainId),client:t},transactionId:v.transactionId})}}const p=$I({calls:o.map(b=>({data:b.data??"0x",target:Z(b.to??""),value:b.value??0n})),contract:u,overrides:{authorizationList:h?[h]:void 0,value:o.reduce((b,R)=>b+(R.value??0n),0n)}}),_=await Wh({from:e.address,transaction:p});return e.sendTransaction(_)},s={address:e.address,sendBatchTransaction:async o=>n(o),sendTransaction:async o=>n([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-D-jHkY3c.js");return{inAppWalletSendCalls:p}},__vite__mapDeps([25,1])),l=o.calls[0];if(!l)throw new Error("No calls to send");const u=l.client,h=l.chain||o.chain,d=await c({account:s,calls:o.calls,chain:h});return{chain:h,client:u,id:d}},getCallsStatus:async o=>{const{inAppWalletGetCallsStatus:c}=await a(async()=>{const{inAppWalletGetCallsStatus:l}=await import("./in-app-wallet-calls-D-jHkY3c.js");return{inAppWalletGetCallsStatus:l}},__vite__mapDeps([25,1]));return c(o)},getCallsStatusRaw:async o=>{const{inAppWalletGetCallsStatusRaw:c}=await a(async()=>{const{inAppWalletGetCallsStatusRaw:l}=await import("./in-app-wallet-calls-D-jHkY3c.js");return{inAppWalletGetCallsStatusRaw:l}},__vite__mapDeps([25,1]));return c(o)},getCapabilities:async o=>({[o.chainId??1]:{atomic:{status:"supported"},paymasterService:{supported:r??!1}}})};return s};async function NI(i){const{client:t,address:e,chain:r}=i,n=sn({chain:r,client:t});return await a(async()=>{const{eth_getTransactionCount:o}=await import("./thirdweb-DwEJXXOk.js").then(c=>c.cl);return{eth_getTransactionCount:o}},[]).then(({eth_getTransactionCount:o})=>o(n,{address:Z(e),blockTag:"pending"}))}async function BI(i,t){const e=await Hh(i),r=e.length>0&&e.startsWith("0xef0100"),n=`0x${e.slice(8,48)}`;return r&&n.toLowerCase()===t.toLowerCase()}async function MI(i){const t=i.timeoutMs||3e5,e=i.intervalMs||1e3,r=Date.now()+t;for(;Date.now()<r;){const n=await RI({options:i.options,transactionId:i.transactionId});if(n.transactionHash)return n.transactionHash;await new Promise(s=>setTimeout(s,e))}throw new Error(`Timeout waiting for transaction to be mined on chain ${i.options.chain.id} with transactionId: ${i.transactionId}`)}const qI=[{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 oh(i){return i.id==="inApp"||i.id==="embedded"}async function zI(i,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=i.strategy;sh.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 n=(await e.connect(i)).user.account;return ah({authAccount:n,client:i.client,createOptions:t,desiredChain:i.chain})}async function jI(i,t,e){i.authResult&&e.loginWithAuthToken&&await e.loginWithAuthToken(i.authResult);const r=await FI(e);if(!r)throw new Error("Failed to authenticate user.");const n=r.account;return ah({authAccount:n,client:i.client,createOptions:t,desiredChain:i.chain})}async function KI(i){const{connectSmartAccount:t}=await a(async()=>{const{connectSmartAccount:e}=await import("./index-Xt3c8bVw.js");return{connectSmartAccount:e}},__vite__mapDeps([17,1,18,2,3,4,5,6,7,8,9,10]));return t({chain:i.chain,client:i.client,personalAccount:i.authAccount},i.smartAccountOptions)}async function FI(i){const t=await i.getUser();switch(t.status){case"Logged In, Wallet Initialized":return t}}async function ah(i){const{createOptions:t,authAccount:e,desiredChain:r,client:n}=i;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 KI({authAccount:e,chain:r,client:n,smartAccountOptions:s});return{account:l,adminAccount:e,chain:u}}if(o){const l=r;if(!l)throw new Error("Chain is required for EIP-7702 execution, pass a chain when connecting the inAppWallet.");return{account:UI({adminAccount:e,client:n,sponsorGas:o.sponsorGas}),adminAccount:e,chain:l}}return{account:e,chain:r||dd}}const Hn=Object.freeze(Object.defineProperty({__proto__:null,autoConnectInAppWallet:jI,connectInAppWallet:zI,isInAppWallet:oh},Symbol.toStringTag,{value:"Module"}));function WI(i){const t=r=>oh(r)||Oi(r),e=xs(i.wallet)&&i.connectedWallets.some(r=>{var n,s,o,c,l,u;return t(r)&&((s=(n=r.getAccount())==null?void 0:n.address)==null?void 0:s.toLowerCase())===((u=(l=(c=(o=i.wallet).getAdminAccount)==null?void 0:c.call(o))==null?void 0:l.address)==null?void 0:u.toLowerCase())});return t(i.wallet)||e}function HI(){if(typeof document>"u")return;const i=new URLSearchParams(window.location.search);let t;const e=window.location.hash||"";let r=e;const n=e.indexOf("?");n!==-1&&(t=new URLSearchParams(e.substring(n)),r=e.substring(0,n));const s=i.get("walletId")??(t==null?void 0:t.get("walletId"))??void 0,o=i.get("authResult")??(t==null?void 0:t.get("authResult"))??void 0,c=i.get("authProvider")??(t==null?void 0:t.get("authProvider"))??void 0,l=i.get("authCookie")??(t==null?void 0:t.get("authCookie"))??void 0,u=i.get("authFlow")??(t==null?void 0:t.get("authFlow"))??void 0;if((l||o)&&s){const h=(()=>{if(o)return i.delete("authResult"),t==null||t.delete("authResult"),JSON.parse(decodeURIComponent(o))})();i.delete("walletId"),i.delete("authProvider"),i.delete("authCookie"),i.delete("authFlow"),t==null||t.delete("walletId"),t==null||t.delete("authProvider"),t==null||t.delete("authCookie"),t==null||t.delete("authFlow");const d=i.toString(),p=d?`?${d}`:"";let _=r;if(t){const f=t.toString();f&&(_=`${r}?${f}`)}return window.history.pushState({},"",`${window.location.pathname}${p}${_}`),{authCookie:l,authFlow:u,authProvider:c,authResult:h,walletId:s}}}let Gn;const GI=async i=>{if(Gn&&!i.force&&await Gn)return!0;const t=JI(i);return Gn=t,t},JI=async({storage:i,props:t,createWalletFn:e,manager:r,connectOverride:n,setLastAuthProvider:s})=>{var T,g,D,L,w;const{wallets:o,onConnect:c}=t,l=t.timeout??15e3;let u=!1;r.isAutoConnecting.setValue(!0);let[h,d]=await Promise.all([ih(i),Ao(i)]);const p=HI();if((p==null?void 0:p.authFlow)==="link"&&p.authResult)return await YI({client:t.client,connectOverride:n,createWalletFn:e,manager:r,onConnect:c,props:t,setLastAuthProvider:s,storage:i,timeout:l,urlToken:p,wallets:o});const _=o.find(E=>E.id===(p==null?void 0:p.walletId));if(p!=null&&p.authCookie&&_&&await new Io({clientId:t.client.clientId,ecosystem:Oi(_)?{id:_.id,partnerId:(T=_.getConfig())==null?void 0:T.partnerId}:void 0,storage:i}).saveAuthCookie(p.authCookie),p!=null&&p.walletId&&(d=p.walletId,h=h!=null&&h.includes(p.walletId)?h:[p.walletId,...h||[]]),p!=null&&p.authProvider&&await(s==null?void 0:s(p.authProvider,i)),!h)return u;const f=await rh(i)||t.chain,m=h.map(E=>{const I=o.find(A=>A.id===E);return I||e(E)}),y=d&&(m.find(E=>E.id===d)||e(d));if(y){r.activeWalletConnectionStatusStore.setValue("connecting"),await nh(Cs({authResult:p==null?void 0:p.authResult,client:t.client,lastConnectedChain:f,wallet:y}),{message:`AutoConnect timeout: ${l}ms limit exceeded.`,ms:l}).catch(E=>{console.warn(E.message),t.onTimeout&&t.onTimeout()});try{await(n?n(y):r.connect(y,{accountAbstraction:t.accountAbstraction,client:t.client}))}catch(E){E instanceof Error&&console.warn("Error auto connecting wallet:",E.message),r.activeWalletConnectionStatusStore.setValue("disconnected")}}else r.activeWalletConnectionStatusStore.setValue("disconnected");const b=m.filter(E=>E.id!==d&&h.includes(E.id));for(const E of b)try{await Cs({authResult:p==null?void 0:p.authResult,client:t.client,lastConnectedChain:f,wallet:E}),r.addConnectedWallet(E)}catch{}y&&WI({connectedWallets:y?[y,...b]:b,wallet:y})&&((g=t.siweAuth)!=null&&g.requiresAuth)&&!((D=t.siweAuth)!=null&&D.isLoggedIn)&&!((L=t.siweAuth)!=null&&L.isLoggingIn)&&await((w=t.siweAuth)==null?void 0:w.doLogin().catch(E=>{console.warn("Error signing in with SIWE:",E.message)})),r.isAutoConnecting.setValue(!1);const v=r.activeWalletStore.getValue(),P=r.connectedWallets.getValue();if(v){u=!0;try{c==null||c(v,P)}catch(E){console.error("Error calling onConnect callback:",E)}}else r.activeWalletConnectionStatusStore.setValue("disconnected");return u};async function YI(i){var P;const{client:t,connectOverride:e,createWalletFn:r,manager:n,onConnect:s,props:o,setLastAuthProvider:c,storage:l,timeout:u,urlToken:h,wallets:d}=i,[p,_]=await Promise.all([ih(l),Ao(l)]),f=await rh(l)||o.chain;if(!_||!p)return console.warn("No stored wallet found for linking flow"),n.isAutoConnecting.setValue(!1),!1;h.authProvider&&await(c==null?void 0:c(h.authProvider,l));const m=d.find(T=>T.id===_)||r(_);n.activeWalletConnectionStatusStore.setValue("connecting");try{await nh(Cs({authResult:void 0,client:t,lastConnectedChain:f,wallet:m}),{message:`AutoConnect timeout: ${u}ms limit exceeded.`,ms:u}),await(e?e(m):n.connect(m,{accountAbstraction:o.accountAbstraction,client:t}))}catch(T){return console.warn("Failed to auto-connect for linking:",T),n.activeWalletConnectionStatusStore.setValue("disconnected"),n.isAutoConnecting.setValue(!1),!1}const y=Oi(m)?{id:m.id,partnerId:(P=m.getConfig())==null?void 0:P.partnerId}:void 0,b=new Io({clientId:t.clientId,ecosystem:y,storage:l});try{await VI({client:t,ecosystem:y,storage:b,tokenToLink:h.authResult.storedToken.cookieString})}catch(T){console.error("Failed to link profile after redirect:",T)}n.isAutoConnecting.setValue(!1);const R=n.activeWalletStore.getValue(),v=n.connectedWallets.getValue();if(R){try{s==null||s(R,v)}catch(T){console.error("Error calling onConnect callback:",T)}return!0}return!1}async function Cs(i){return i.wallet.autoConnect({authResult:i.authResult,chain:i.lastConnectedChain,client:i.client})}async function ZI(i){const t=i.wallets||wI(i),e=LI(Fr);return await GI({createWalletFn:at,manager:e,props:{...i,wallets:t},storage:Fr})}const JA=Object.freeze(Object.defineProperty({__proto__:null,DefaultWalletConnectRequestHandlers:pI,EIP1193:Nd,authenticate:Kd,authenticateWithRedirect:Fd,autoConnect:ZI,createWallet:at,createWalletAdapter:Bd,createWalletConnectClient:_I,createWalletConnectSession:fI,deploySmartAccount:Yh,disconnectWalletConnectSession:Xu,ecosystemWallet:cl,embeddedWallet:Zn,generateAccount:Zd,getActiveWalletConnectSessions:mI,getAllWalletsList:Md,getInstalledWallets:ll,getProfiles:Gd,getUser:Jh,getUserEmail:qd,getUserPhoneNumber:zd,getWalletBalance:Qd,getWalletInfo:Qc,inAppWallet:Zn,injectedProvider:Zs,isBaseAccountSDKWallet:el,linkProfile:Wd,preAuthenticate:jd,privateKeyAccount:Xn,privateKeyToAccount:Xn,randomPrivateKey:Gh,smartWallet:Ys,unlinkProfile:Hd,walletConnect:Sd},Symbol.toStringTag,{value:"Module"}));export{xs as $,ar as A,on as B,P_ as C,nI as D,Il as E,kr as F,S_ as G,x_ as H,IA as I,vA as J,ae as K,Jr as L,TA as M,xA as N,AA as O,Lu as P,bI as Q,eh as R,jA as S,zA as T,BA as U,dr as V,qA as W,KA as X,rg as Y,FA as Z,MA as _,NA as a,GA as a0,Io as a1,Fr as a2,$A as a3,sh as a4,VI as a5,WA as a6,HA as a7,CA as a8,JA as a9,Qc as b,Wr as c,kA as d,Xu as e,gd as f,xd as g,Qu as h,SA as i,sI as j,oI as k,aI as l,Oc as m,lt as n,Pc as o,Ks as p,eo as q,Ai as r,UA as s,bo as t,ni as u,Bt as v,_e as w,bA as x,Xo as y,Al as z};
14
+ Code: ${u}`)}return c.result}function xs(i){if(!i)return!1;if(i.id==="smart")return!0;if(i.id==="inApp"||Oi(i)){const t=i.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 th="thirdweb:connected-wallet-ids",qr="thirdweb:active-wallet-id",Ss="thirdweb:active-chain",xc="thirdweb:last-used-wallet-id";function LI(i){const t=Jt(void 0),e=Jt(void 0),r=Jt(void 0),n=Jt("unknown"),s=Jt(new Map);Sr(()=>{jh([...s.getValue().values()])},[s]),Sr(()=>{const v=r.getValue();if(!v)return;const P=s.getValue().get(v.id);!P||P===v||r.setValue(P)},[s,r]);const o=Jt(new Map),c=Jt(!1),l=gI(()=>Array.from(o.getValue().values()),[o]),u=v=>{const P=o.getValue();if(P.has(v.id))return;const T=new Map(P);T.set(v.id,v),o.setValue(T)},h=v=>{const P=o.getValue(),T=new Map(P);T.delete(v.id),o.setValue(T)},d=v=>{EI(i,v.id),h(v),t.getValue()===v&&(i.removeItem(qr),e.setValue(void 0),r.setValue(void 0),t.setValue(void 0),n.setValue("disconnected"))},p=v=>{d(v),v.disconnect()},_=async(v,P)=>{if(!v.getAccount())throw new Error("Cannot set a wallet without an account as active");const g=await(async()=>P!=null&&P.accountAbstraction&&!xs(v)?await DI(v,P.client,P.accountAbstraction,d):v)();return await i.setItem(qr,v.id),await i.setItem(xc,v.id),u(v),(P==null?void 0:P.setWalletAsActive)!==!1&&m(g),v.subscribe("accountChanged",async()=>{var L;const D=await _(v,P);(L=P==null?void 0:P.onConnect)==null||L.call(P,D,l.getValue())}),g},f=async(v,P)=>{var g;const T=await _(v,P);return(g=P==null?void 0:P.onConnect)==null||g.call(P,T,l.getValue()),T},m=v=>{const P=v.getAccount();if(!P)throw new Error("Cannot set a wallet without an account as active");u(v),t.setValue(v),e.setValue(P),r.setValue(v.getChain()),n.setValue("connected");const T=E=>{e.setValue(E)},g=v.subscribe("accountChanged",T),D=v.subscribe("chainChanged",E=>r.setValue(E)),L=v.subscribe("disconnect",()=>{w()}),w=()=>{d(v),g(),D(),L()}},y=async v=>{m(v),v.id!=="smart"&&(await i.setItem(qr,v.id),await i.setItem(xc,v.id))};Sr(()=>{const v=r.getValue();v?i.setItem(Ss,we(v)):i.removeItem(Ss)},[r],!1),Sr(async()=>{const P=l.getValue().map(T=>T==null?void 0:T.id).filter(T=>!!T);i.setItem(th,we(Array.from(new Set([...P]))))},[l],!1);const b=async v=>{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(xs(P)){const T=await Ao(i);if(T){const g=l.getValue().find(D=>D.id===T);if(g){await g.switchChain(v),await P.switchChain(v),m(P);return}}await P.switchChain(v),m(P)}else await P.switchChain(v);r.setValue(P.getChain())};function R(v){const P=s.getValue();if(v.every(D=>{const L=P.get(D.id);return we(L)===we(D)}))return;const g=new Map(P);for(const D of v)g.set(D.id,D);s.setValue(g)}return{activeAccountStore:e,activeWalletChainStore:r,activeWalletConnectionStatusStore:n,activeWalletStore:t,addConnectedWallet:u,connect:f,connectedWallets:l,defineChains:R,disconnectWallet:p,handleConnection:_,isAutoConnecting:c,removeConnectedWallet:h,setActiveWallet:y,switchActiveWalletChain:b}}async function ih(i){try{const t=await i.getItem(th);return t?JSON.parse(t):[]}catch{return[]}}async function Ao(i){try{const t=await i.getItem(qr);if(t)return t}catch{}return null}async function rh(i){try{const t=await i.getItem(Ss);if(t)return JSON.parse(t)}catch{}return null}const DI=async(i,t,e,r)=>{const n=i.getAccount();if(!n)throw new Error("Cannot set a wallet without an account as active");const s=Ys(e);await s.connect({chain:e.chain,client:t,personalAccount:n});const o=i.subscribe("disconnect",()=>{c()}),c=()=>{o(),r(s)};return s};function nh(i,t){return new Promise((e,r)=>{const n=setTimeout(()=>{r(new Error(t.message))},t.ms);i.then(s=>{clearTimeout(n),e(s)},s=>{clearTimeout(n),r(s)})})}async function VI({client:i,ecosystem:t,tokenToLink:e,storage:r}){const n=_r(i,t),s=nn("inAppWallet"),o=await r.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 n(`${s}/api/2024-05-05/account/connect`,{body:we({accountAuthTokenToConnect:e}),headers:c,method:"POST"});if(!l.ok){const h=await l.json();throw new Error(h.message||"Failed to link account.")}const{linkedAccounts:u}=await l.json();return u??[]}async function WA({client:i,ecosystem:t,profileToUnlink:e,allowAccountDeletion:r=!1,storage:n}){const s=_r(i,t),o=nn("inAppWallet"),c=await n.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:r,details:e.details,type:e.type}),headers:l,method:"POST"});if(!u.ok){const d=await u.json();throw new Error(d.message||"Failed to unlink account.")}const{linkedAccounts:h}=await u.json();return h??[]}async function HA({client:i,ecosystem:t,storage:e}){const r=_r(i,t),n=nn("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 r(`${n}/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 sh=["google","apple","facebook","discord","line","x","tiktok","epic","coinbase","farcaster","telegram","github","twitch","steam"],GA=[...sh,"guest","backend","email","phone","passkey","wallet"],xI="0x3f707e6b",SI=[{type:"tuple[]",name:"calls",components:[{type:"address",name:"target"},{type:"uint256",name:"value"},{type:"bytes",name:"data"}]}],CI=[];function $I(i){const t=bI(async()=>"asyncParams"in i?await i.asyncParams():i);return Kh({contract:i.contract,method:[xI,SI,CI],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 kI(i){const{client:t,chain:e,bundlerUrl:r}=i,n=r??Kc(e),s=`delegation-contract:${n}`;return Nc(async()=>{var u;const c=await _r(t)(n,{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 UI=i=>{const{client:t,adminAccount:e,sponsorGas:r}=i,n=async o=>{var f,m,y;const c=o[0];if(!c)throw new Error("No transactions provided");const l=ge(c.chainId),u=Bs({address:e.address,chain:l,client:t,abi:qI});let h=(f=c.authorizationList)==null?void 0:f[0];const d=await kI({client:t,chain:l});if(h&&((m=h.address)==null?void 0:m.toLowerCase())!==d.toLowerCase())throw new Error(`Authorization address does not match expected delegation contract address. Expected ${d} but got ${h.address}`);if(!h&&!await BI(u,d)){let R=c.nonce?BigInt(c.nonce):BigInt(await NI({client:t,address:e.address,chain:l}));R+=r?0n:1n;const v=await((y=e.signAuthorization)==null?void 0:y.call(e,{address:Z(d),chainId:c.chainId,nonce:R}));if(!v)throw new Error("Failed to sign authorization");h=v}if(r){const b={calls:o.map(T=>({data:T.data??"0x",target:Z(T.to??""),value:T.value??0n})),uid:Fh()},R=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"}]}}),v=await OI({authorization:h,eoaAddress:Z(e.address),options:{chain:ge(c.chainId),client:t},signature:R,wrappedCalls:b});return{transactionHash:await MI({options:{chain:ge(c.chainId),client:t},transactionId:v.transactionId})}}const p=$I({calls:o.map(b=>({data:b.data??"0x",target:Z(b.to??""),value:b.value??0n})),contract:u,overrides:{authorizationList:h?[h]:void 0,value:o.reduce((b,R)=>b+(R.value??0n),0n)}}),_=await Wh({from:e.address,transaction:p});return e.sendTransaction(_)},s={address:e.address,sendBatchTransaction:async o=>n(o),sendTransaction:async o=>n([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-DnbOJdqi.js");return{inAppWalletSendCalls:p}},__vite__mapDeps([25,1])),l=o.calls[0];if(!l)throw new Error("No calls to send");const u=l.client,h=l.chain||o.chain,d=await c({account:s,calls:o.calls,chain:h});return{chain:h,client:u,id:d}},getCallsStatus:async o=>{const{inAppWalletGetCallsStatus:c}=await a(async()=>{const{inAppWalletGetCallsStatus:l}=await import("./in-app-wallet-calls-DnbOJdqi.js");return{inAppWalletGetCallsStatus:l}},__vite__mapDeps([25,1]));return c(o)},getCallsStatusRaw:async o=>{const{inAppWalletGetCallsStatusRaw:c}=await a(async()=>{const{inAppWalletGetCallsStatusRaw:l}=await import("./in-app-wallet-calls-DnbOJdqi.js");return{inAppWalletGetCallsStatusRaw:l}},__vite__mapDeps([25,1]));return c(o)},getCapabilities:async o=>({[o.chainId??1]:{atomic:{status:"supported"},paymasterService:{supported:r??!1}}})};return s};async function NI(i){const{client:t,address:e,chain:r}=i,n=sn({chain:r,client:t});return await a(async()=>{const{eth_getTransactionCount:o}=await import("./thirdweb-RfTGDewD.js").then(c=>c.cl);return{eth_getTransactionCount:o}},[]).then(({eth_getTransactionCount:o})=>o(n,{address:Z(e),blockTag:"pending"}))}async function BI(i,t){const e=await Hh(i),r=e.length>0&&e.startsWith("0xef0100"),n=`0x${e.slice(8,48)}`;return r&&n.toLowerCase()===t.toLowerCase()}async function MI(i){const t=i.timeoutMs||3e5,e=i.intervalMs||1e3,r=Date.now()+t;for(;Date.now()<r;){const n=await RI({options:i.options,transactionId:i.transactionId});if(n.transactionHash)return n.transactionHash;await new Promise(s=>setTimeout(s,e))}throw new Error(`Timeout waiting for transaction to be mined on chain ${i.options.chain.id} with transactionId: ${i.transactionId}`)}const qI=[{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 oh(i){return i.id==="inApp"||i.id==="embedded"}async function zI(i,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=i.strategy;sh.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 n=(await e.connect(i)).user.account;return ah({authAccount:n,client:i.client,createOptions:t,desiredChain:i.chain})}async function jI(i,t,e){i.authResult&&e.loginWithAuthToken&&await e.loginWithAuthToken(i.authResult);const r=await FI(e);if(!r)throw new Error("Failed to authenticate user.");const n=r.account;return ah({authAccount:n,client:i.client,createOptions:t,desiredChain:i.chain})}async function KI(i){const{connectSmartAccount:t}=await a(async()=>{const{connectSmartAccount:e}=await import("./index-CA_7NqLN.js");return{connectSmartAccount:e}},__vite__mapDeps([17,1,18,2,3,4,5,6,7,8,9,10]));return t({chain:i.chain,client:i.client,personalAccount:i.authAccount},i.smartAccountOptions)}async function FI(i){const t=await i.getUser();switch(t.status){case"Logged In, Wallet Initialized":return t}}async function ah(i){const{createOptions:t,authAccount:e,desiredChain:r,client:n}=i;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 KI({authAccount:e,chain:r,client:n,smartAccountOptions:s});return{account:l,adminAccount:e,chain:u}}if(o){const l=r;if(!l)throw new Error("Chain is required for EIP-7702 execution, pass a chain when connecting the inAppWallet.");return{account:UI({adminAccount:e,client:n,sponsorGas:o.sponsorGas}),adminAccount:e,chain:l}}return{account:e,chain:r||dd}}const Hn=Object.freeze(Object.defineProperty({__proto__:null,autoConnectInAppWallet:jI,connectInAppWallet:zI,isInAppWallet:oh},Symbol.toStringTag,{value:"Module"}));function WI(i){const t=r=>oh(r)||Oi(r),e=xs(i.wallet)&&i.connectedWallets.some(r=>{var n,s,o,c,l,u;return t(r)&&((s=(n=r.getAccount())==null?void 0:n.address)==null?void 0:s.toLowerCase())===((u=(l=(c=(o=i.wallet).getAdminAccount)==null?void 0:c.call(o))==null?void 0:l.address)==null?void 0:u.toLowerCase())});return t(i.wallet)||e}function HI(){if(typeof document>"u")return;const i=new URLSearchParams(window.location.search);let t;const e=window.location.hash||"";let r=e;const n=e.indexOf("?");n!==-1&&(t=new URLSearchParams(e.substring(n)),r=e.substring(0,n));const s=i.get("walletId")??(t==null?void 0:t.get("walletId"))??void 0,o=i.get("authResult")??(t==null?void 0:t.get("authResult"))??void 0,c=i.get("authProvider")??(t==null?void 0:t.get("authProvider"))??void 0,l=i.get("authCookie")??(t==null?void 0:t.get("authCookie"))??void 0,u=i.get("authFlow")??(t==null?void 0:t.get("authFlow"))??void 0;if((l||o)&&s){const h=(()=>{if(o)return i.delete("authResult"),t==null||t.delete("authResult"),JSON.parse(decodeURIComponent(o))})();i.delete("walletId"),i.delete("authProvider"),i.delete("authCookie"),i.delete("authFlow"),t==null||t.delete("walletId"),t==null||t.delete("authProvider"),t==null||t.delete("authCookie"),t==null||t.delete("authFlow");const d=i.toString(),p=d?`?${d}`:"";let _=r;if(t){const f=t.toString();f&&(_=`${r}?${f}`)}return window.history.pushState({},"",`${window.location.pathname}${p}${_}`),{authCookie:l,authFlow:u,authProvider:c,authResult:h,walletId:s}}}let Gn;const GI=async i=>{if(Gn&&!i.force&&await Gn)return!0;const t=JI(i);return Gn=t,t},JI=async({storage:i,props:t,createWalletFn:e,manager:r,connectOverride:n,setLastAuthProvider:s})=>{var T,g,D,L,w;const{wallets:o,onConnect:c}=t,l=t.timeout??15e3;let u=!1;r.isAutoConnecting.setValue(!0);let[h,d]=await Promise.all([ih(i),Ao(i)]);const p=HI();if((p==null?void 0:p.authFlow)==="link"&&p.authResult)return await YI({client:t.client,connectOverride:n,createWalletFn:e,manager:r,onConnect:c,props:t,setLastAuthProvider:s,storage:i,timeout:l,urlToken:p,wallets:o});const _=o.find(E=>E.id===(p==null?void 0:p.walletId));if(p!=null&&p.authCookie&&_&&await new Io({clientId:t.client.clientId,ecosystem:Oi(_)?{id:_.id,partnerId:(T=_.getConfig())==null?void 0:T.partnerId}:void 0,storage:i}).saveAuthCookie(p.authCookie),p!=null&&p.walletId&&(d=p.walletId,h=h!=null&&h.includes(p.walletId)?h:[p.walletId,...h||[]]),p!=null&&p.authProvider&&await(s==null?void 0:s(p.authProvider,i)),!h)return u;const f=await rh(i)||t.chain,m=h.map(E=>{const I=o.find(A=>A.id===E);return I||e(E)}),y=d&&(m.find(E=>E.id===d)||e(d));if(y){r.activeWalletConnectionStatusStore.setValue("connecting"),await nh(Cs({authResult:p==null?void 0:p.authResult,client:t.client,lastConnectedChain:f,wallet:y}),{message:`AutoConnect timeout: ${l}ms limit exceeded.`,ms:l}).catch(E=>{console.warn(E.message),t.onTimeout&&t.onTimeout()});try{await(n?n(y):r.connect(y,{accountAbstraction:t.accountAbstraction,client:t.client}))}catch(E){E instanceof Error&&console.warn("Error auto connecting wallet:",E.message),r.activeWalletConnectionStatusStore.setValue("disconnected")}}else r.activeWalletConnectionStatusStore.setValue("disconnected");const b=m.filter(E=>E.id!==d&&h.includes(E.id));for(const E of b)try{await Cs({authResult:p==null?void 0:p.authResult,client:t.client,lastConnectedChain:f,wallet:E}),r.addConnectedWallet(E)}catch{}y&&WI({connectedWallets:y?[y,...b]:b,wallet:y})&&((g=t.siweAuth)!=null&&g.requiresAuth)&&!((D=t.siweAuth)!=null&&D.isLoggedIn)&&!((L=t.siweAuth)!=null&&L.isLoggingIn)&&await((w=t.siweAuth)==null?void 0:w.doLogin().catch(E=>{console.warn("Error signing in with SIWE:",E.message)})),r.isAutoConnecting.setValue(!1);const v=r.activeWalletStore.getValue(),P=r.connectedWallets.getValue();if(v){u=!0;try{c==null||c(v,P)}catch(E){console.error("Error calling onConnect callback:",E)}}else r.activeWalletConnectionStatusStore.setValue("disconnected");return u};async function YI(i){var P;const{client:t,connectOverride:e,createWalletFn:r,manager:n,onConnect:s,props:o,setLastAuthProvider:c,storage:l,timeout:u,urlToken:h,wallets:d}=i,[p,_]=await Promise.all([ih(l),Ao(l)]),f=await rh(l)||o.chain;if(!_||!p)return console.warn("No stored wallet found for linking flow"),n.isAutoConnecting.setValue(!1),!1;h.authProvider&&await(c==null?void 0:c(h.authProvider,l));const m=d.find(T=>T.id===_)||r(_);n.activeWalletConnectionStatusStore.setValue("connecting");try{await nh(Cs({authResult:void 0,client:t,lastConnectedChain:f,wallet:m}),{message:`AutoConnect timeout: ${u}ms limit exceeded.`,ms:u}),await(e?e(m):n.connect(m,{accountAbstraction:o.accountAbstraction,client:t}))}catch(T){return console.warn("Failed to auto-connect for linking:",T),n.activeWalletConnectionStatusStore.setValue("disconnected"),n.isAutoConnecting.setValue(!1),!1}const y=Oi(m)?{id:m.id,partnerId:(P=m.getConfig())==null?void 0:P.partnerId}:void 0,b=new Io({clientId:t.clientId,ecosystem:y,storage:l});try{await VI({client:t,ecosystem:y,storage:b,tokenToLink:h.authResult.storedToken.cookieString})}catch(T){console.error("Failed to link profile after redirect:",T)}n.isAutoConnecting.setValue(!1);const R=n.activeWalletStore.getValue(),v=n.connectedWallets.getValue();if(R){try{s==null||s(R,v)}catch(T){console.error("Error calling onConnect callback:",T)}return!0}return!1}async function Cs(i){return i.wallet.autoConnect({authResult:i.authResult,chain:i.lastConnectedChain,client:i.client})}async function ZI(i){const t=i.wallets||wI(i),e=LI(Fr);return await GI({createWalletFn:at,manager:e,props:{...i,wallets:t},storage:Fr})}const JA=Object.freeze(Object.defineProperty({__proto__:null,DefaultWalletConnectRequestHandlers:pI,EIP1193:Nd,authenticate:Kd,authenticateWithRedirect:Fd,autoConnect:ZI,createWallet:at,createWalletAdapter:Bd,createWalletConnectClient:_I,createWalletConnectSession:fI,deploySmartAccount:Yh,disconnectWalletConnectSession:Xu,ecosystemWallet:cl,embeddedWallet:Zn,generateAccount:Zd,getActiveWalletConnectSessions:mI,getAllWalletsList:Md,getInstalledWallets:ll,getProfiles:Gd,getUser:Jh,getUserEmail:qd,getUserPhoneNumber:zd,getWalletBalance:Qd,getWalletInfo:Qc,inAppWallet:Zn,injectedProvider:Zs,isBaseAccountSDKWallet:el,linkProfile:Wd,preAuthenticate:jd,privateKeyAccount:Xn,privateKeyToAccount:Xn,randomPrivateKey:Gh,smartWallet:Ys,unlinkProfile:Hd,walletConnect:Sd},Symbol.toStringTag,{value:"Module"}));export{xs as $,ar as A,on as B,P_ as C,nI as D,Il as E,kr as F,S_ as G,x_ as H,IA as I,vA as J,ae as K,Jr as L,TA as M,xA as N,AA as O,Lu as P,bI as Q,eh as R,jA as S,zA as T,BA as U,dr as V,qA as W,KA as X,rg as Y,FA as Z,MA as _,NA as a,GA as a0,Io as a1,Fr as a2,$A as a3,sh as a4,VI as a5,WA as a6,HA as a7,CA as a8,JA as a9,Qc as b,Wr as c,kA as d,Xu as e,gd as f,xd as g,Qu as h,SA as i,sI as j,oI as k,aI as l,Oc as m,lt as n,Pc as o,Ks as p,eo as q,Ai as r,UA as s,bo as t,ni as u,Bt as v,_e as w,bA as x,Xo as y,Al as z};