@dcl/shop 0.1.0-29489010081.commit-c04e72d → 0.1.0-29527153652.commit-d2eebfa

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 (234) hide show
  1. package/assets/{AnimatedBackground-C3tCIt3_.js → AnimatedBackground-BtDeGtuY.js} +3 -3
  2. package/assets/Assets-CicnCRkP.js +1 -0
  3. package/assets/Cart-bywt8_CL.js +1 -0
  4. package/assets/{CircularProgress-CFx6Tc-u.js → CircularProgress-3Y_POW5D.js} +4 -4
  5. package/assets/Collection-C4oILWgm.js +1 -0
  6. package/assets/Collection-CxRRuAdy.css +1 -0
  7. package/assets/{ConstantsUtil-rB_9qX5U.js → ConstantsUtil-BTo1-KgH.js} +1 -1
  8. package/assets/ContentClient-CEkpPq6Z.js +1 -0
  9. package/assets/Creator-C4puJP6z.js +1 -0
  10. package/assets/Creator-DJqbQ8AX.css +1 -0
  11. package/assets/DeploymentBuilder-DPr-ptgp.js +3 -0
  12. package/assets/{ExchangeController-BKVj-wUk.js → ExchangeController-D4CpJ8kl.js} +1 -1
  13. package/assets/GetCredits-gEfRJgGT.js +1 -0
  14. package/assets/{HelpersUtil-D3RJTtBW.js → HelpersUtil-BeiA-N3I.js} +1 -1
  15. package/assets/ImportListings-DgevLbSo.js +1 -0
  16. package/assets/ItemDetail-DFD_2ZeC.js +2 -0
  17. package/assets/{LoadMore-8Dx5lULo.js → LoadMore-DsKzH4Rv.js} +1 -1
  18. package/assets/MyAssets-C_jVBeCP.js +1 -0
  19. package/assets/{MyFavorites-CK5_WnC2.js → MyFavorites-B6ImIszd.js} +1 -1
  20. package/assets/{MyPurchases-CpT7mJeg.js → MyPurchases-BH0keZsh.js} +1 -1
  21. package/assets/{NetworkUtil-Cm_KFCNa.js → NetworkUtil-DInevqnn.js} +1 -1
  22. package/assets/{NotFound-CwEJRJsv.js → NotFound-BUwRH5h0.js} +1 -1
  23. package/assets/StoreSettings-BsV7iEJX.css +1 -0
  24. package/assets/StoreSettings-C66yF7xF.js +1 -0
  25. package/assets/Success-B2aNqHp6.js +1 -0
  26. package/assets/{SwapController-DdOdLkW2.js → SwapController-fK7v6beM.js} +1 -1
  27. package/assets/TradeService-BYjElQ_J.js +1 -0
  28. package/assets/{W3MFrameProviderSingleton-ZaFH8iXi.js → W3MFrameProviderSingleton-BvT93_mb.js} +3 -3
  29. package/assets/{WebCryptoP256-H5nw1_R9.js → WebCryptoP256-lk8Phz0j.js} +1 -1
  30. package/assets/{basic-ajzFEC0k.js → basic-DLKrLmdo.js} +1 -1
  31. package/assets/{biconomy-BthW3jTV.js → biconomy-7wiec39b.js} +1 -1
  32. package/assets/{browser-BMhVVB-A.js → browser-9oFjBwrz.js} +1 -1
  33. package/assets/browser-ponyfill-DMgE6PM5.js +2 -0
  34. package/assets/browser-ponyfill-Djb5Py6a.js +1 -0
  35. package/assets/{buy-DEy5oWx-.js → buy-DIwWkpJJ.js} +1 -1
  36. package/assets/{buy-gasless-VIo89iNM.js → buy-gasless-CFOJz7EI.js} +1 -1
  37. package/assets/categories-DYe3ZXtu.js +1 -0
  38. package/assets/categories-FoGfjyVm.css +1 -0
  39. package/assets/{ccip-BkNQa8cV.js → ccip-DNX1aV6c.js} +1 -1
  40. package/assets/{ccip-YAHPm4lT.js → ccip-Dgzo1FXe.js} +1 -1
  41. package/assets/{chains-ahXbxt0q.js → chains-BQ5Swd2q.js} +1 -1
  42. package/assets/collection-BHilCUwH.js +1 -0
  43. package/assets/{collection-Ds5shVfK.css → collection-CrgnzsVL.css} +1 -1
  44. package/assets/{common-B5mo5Owz.js → common-CBPtpBt7.js} +1 -1
  45. package/assets/controller-16-J3O8L.js +2 -0
  46. package/assets/{core-CYiLxEzM.js → core-DXuYXUj1.js} +4 -4
  47. package/assets/{custom-Dp9Dh7zL.js → custom-BTyOEs9D.js} +1 -1
  48. package/assets/{data-capture-BDOOE_ef.js → data-capture-DQHZCQ9R.js} +1 -1
  49. package/assets/{decimals-l9QqXFQS.js → decimals-DKkXzXLC.js} +1 -1
  50. package/assets/decimals-DWEHw5Cf.js +1 -0
  51. package/assets/default-cover-7vUE644d.jpeg +0 -0
  52. package/assets/{detectExtension-DbxURuLG.js → detectExtension-Wqss5tRf.js} +1 -1
  53. package/assets/{email-COb083lm.js → email-BA8oF4Sb.js} +1 -1
  54. package/assets/{embedded-wallet-AiyWyM1t.js → embedded-wallet-CmR3JoQA.js} +1 -1
  55. package/assets/emotion-styled.browser.esm-hMeaJLB-.js +1 -0
  56. package/assets/{engine-clsNVx05.js → engine-D7X1-7M_.js} +1 -1
  57. package/assets/{estimate-l1-fee-jUmzX2ld.js → estimate-l1-fee-mP34fdnr.js} +1 -1
  58. package/assets/eth_estimateGas-hNSxz4co.js +1 -0
  59. package/assets/{eth_getStorageAt-CvLG1_Jo.js → eth_getStorageAt-CcAHGbyZ.js} +1 -1
  60. package/assets/eth_getTransactionCount-kHoTdsNW.js +1 -0
  61. package/assets/{ethereum-CfGZ1o2B.js → ethereum-CD3dxaW_.js} +1 -1
  62. package/assets/{ethers-D-4WUfRB.js → ethers-DwWf2RqE.js} +1 -1
  63. package/assets/events-DQ172AOg.js +1 -0
  64. package/assets/{extractIPFS-w7ac0ws4.js → extractIPFS-ptBh3aqV.js} +1 -1
  65. package/assets/{features-CspU5qNv.js → features-Dadqu3Gy.js} +2 -2
  66. package/assets/{fetchTokenMetadata-BaEvnlSD.js → fetchTokenMetadata-Yjbzq3OX.js} +2 -2
  67. package/assets/{fortmatic-Be6frCcv.js → fortmatic-DhmlcDbL.js} +1 -1
  68. package/assets/get-ecosystem-wallet-info-BHxUH0sn.js +1 -0
  69. package/assets/{getBalance-DQeLy4UX.js → getBalance-CcpUJJbb.js} +2 -2
  70. package/assets/{getInstalledModules-56AfvyZo.js → getInstalledModules-B29UYWwx.js} +1 -1
  71. package/assets/{getNFT-Cuo1y-Dw.js → getNFT-C8XHKgBR.js} +1 -1
  72. package/assets/{getNFT-DIM-F27_.js → getNFT-DRamL_wJ.js} +2 -2
  73. package/assets/{hashTypedData-CHOppTRC.js → hashTypedData-B8qJCKv2.js} +1 -1
  74. package/assets/{hashTypedData-BLO0uf-r.js → hashTypedData-BRhQ_lPd.js} +1 -1
  75. package/assets/{import-JBeySj3d.js → import-C0KzuCTc.js} +1 -1
  76. package/assets/in-app-wallet-calls-BMeL3YV4.js +1 -0
  77. package/assets/index-B3ocNsJt.js +2 -0
  78. package/assets/{index-BIij5F98.js → index-BCzwAhbN.js} +1 -1
  79. package/assets/index-BL5vFwJv.js +1 -0
  80. package/assets/index-BPiKxEfw.js +1 -0
  81. package/assets/index-BSOhCppl.js +2 -0
  82. package/assets/{index-D9vktHzl.js → index-BWmqibNa.js} +1 -1
  83. package/assets/index-BcX-FSIU.css +1 -0
  84. package/assets/index-Bh8SuC59.js +74 -0
  85. package/assets/{index-DSsR20MG.js → index-BiY5ZJ1L.js} +1 -1
  86. package/assets/index-BmHevYxh.js +1 -0
  87. package/assets/index-BpmLS8_h.js +5 -0
  88. package/assets/{index-Fy50YzQ3.js → index-BsFR4koq.js} +1 -1
  89. package/assets/{index-D9Qz4bzh.js → index-BtK9ZDTb.js} +1 -1
  90. package/assets/{index-LXawog8O.js → index-BuUSB4r5.js} +2 -2
  91. package/assets/index-BxFWKJ00.js +8 -0
  92. package/assets/{index-GKORwvdA.js → index-BxnBUVzy.js} +1 -1
  93. package/assets/{index-BaSxcMLe.js → index-By6STTNb.js} +1 -1
  94. package/assets/{index-BqKiriHU.js → index-ByM1xTND.js} +1 -1
  95. package/assets/{index-ScgGQAhq.js → index-Bz7fb3vC.js} +1 -1
  96. package/assets/{index-C1zw_jvz.js → index-C0kv5kHB.js} +40 -40
  97. package/assets/{index-BHjrNg9z.js → index-C1AneBnm.js} +1 -1
  98. package/assets/{index-CP8m1u84.js → index-C5nVlEYH.js} +1 -1
  99. package/assets/index-CEeQH9eo.js +2 -0
  100. package/assets/{index-DEu_mGCU.js → index-CG-dA0rF.js} +1 -1
  101. package/assets/{index-DZdvpJR7.js → index-CGecUMNA.js} +1 -1
  102. package/assets/{index--Cp_hd__.js → index-CJQuE4Vh.js} +1 -1
  103. package/assets/{index-CgFd602S.js → index-CUe6g2db.js} +1 -1
  104. package/assets/{index-BD4IJd4v.js → index-CXOpVxKU.js} +1 -1
  105. package/assets/{index-C5sIT0tb.js → index-CYZw7sLz.js} +1 -1
  106. package/assets/{index-BKR9QEHq.js → index-Cd5vM2Jh.js} +1 -1
  107. package/assets/{index-BQkCy5n9.js → index-CjpJ162L.js} +1 -1
  108. package/assets/{index-BzBBEm1y.js → index-CrKpXY-Z.js} +1 -1
  109. package/assets/{index-NJd4P5K3.js → index-CuwAAEkV.js} +2 -2
  110. package/assets/{index-vd9YojnC.js → index-Czt6tP80.js} +1 -1
  111. package/assets/{index-Drll3iZv.js → index-D2HgI4Mu.js} +1 -1
  112. package/assets/{index-DwXY_0me.js → index-D4UonDIb.js} +3 -3
  113. package/assets/{index-D4UBoQqv.js → index-DFGIa8d3.js} +1 -1
  114. package/assets/index-DGIRcK5n.js +1 -0
  115. package/assets/index-DH3Yzbz3.js +1 -0
  116. package/assets/{index-Ba1nPvJW.js → index-DNGhO1UM.js} +1 -1
  117. package/assets/{index-4CyAhAID.js → index-DOk2P7Zl.js} +1 -1
  118. package/assets/{index-Bc_XrzTG.js → index-DT90wIp1.js} +1 -1
  119. package/assets/{index-Du5uk45Q.js → index-DVAVXeLV.js} +1 -1
  120. package/assets/{index-CFX7-nql.js → index-DVG9WYtE.js} +1 -1
  121. package/assets/{index-BTbJkw2h.js → index-DeBofuPQ.js} +1 -1
  122. package/assets/{index-BWWcY9Ui.js → index-Dex_bJg1.js} +2 -2
  123. package/assets/index-Df6T9jlW.js +14 -0
  124. package/assets/{index-BfMUWitg.js → index-Df8IehzX.js} +2 -2
  125. package/assets/{index-BaVtOO6t.js → index-DfyoH385.js} +1 -1
  126. package/assets/{index-Cq6p8O8N.js → index-DkIBv-8E.js} +1 -1
  127. package/assets/{index-DpKiyVfQ.js → index-Dl9lo-Tk.js} +1 -1
  128. package/assets/{index-BYMSEXnr.js → index-Dp3Py-Ws.js} +1 -1
  129. package/assets/{index-o6E9IjdT.js → index-Dqw_U4li.js} +1 -1
  130. package/assets/{index-BEoWhDOy.js → index-DvmI6WZg.js} +1 -1
  131. package/assets/{index-Cw0X2YFE.js → index-EYxoPD15.js} +1 -1
  132. package/assets/{index-BdXUoeDl.js → index-EiHJjF_U.js} +1 -1
  133. package/assets/{index-Ci_h9xYZ.js → index-Iapi1Q6R.js} +1 -1
  134. package/assets/{index-Bmyk-e0Z.js → index-_heiRLxG.js} +1 -1
  135. package/assets/{index-DsaI3D4d.js → index-iYlfzQJZ.js} +3 -3
  136. package/assets/{index-COTqPlSo.js → index-kA7_bUnK.js} +1 -1
  137. package/assets/{index-BYFbS7nW.js → index-rfcI92-3.js} +1 -1
  138. package/assets/{index-BPH4bq6L.js → index-sr7QrKQZ.js} +1 -1
  139. package/assets/{index-BF4WrGCQ.js → index-t67nymVk.js} +1 -1
  140. package/assets/index.es-BnHkek_2.js +1 -0
  141. package/assets/{index.es-CCFOZERa.js → index.es-DHouqHFo.js} +1 -1
  142. package/assets/{index.es-DgJoRPHo.js → index.es-DsvM4XzW.js} +4 -4
  143. package/assets/{localBatchGatewayRequest-_AoYEiK7.js → localBatchGatewayRequest-Cmn1dfqz.js} +1 -1
  144. package/assets/{mana-rate-C_85VLuc.js → mana-rate-DObImZN2.js} +1 -1
  145. package/assets/{native-8V193B3S.js → native-B49T_qnV.js} +1 -1
  146. package/assets/network-S_CrOtw4.js +1 -0
  147. package/assets/{networks-Ddls1APy.js → networks-D1cCGfqG.js} +1 -1
  148. package/assets/{onramp-CbrZeS8x.js → onramp-Dj3OMdJa.js} +1 -1
  149. package/assets/{openzeppelin-Dc0QLeyv.js → openzeppelin-jmYZOwb-.js} +1 -1
  150. package/assets/{ownerOf-DCCyyTsB.js → ownerOf-Cg8vrCG0.js} +1 -1
  151. package/assets/{parseNft-yLNtdVoG.js → parseNft-DQjOfM3E.js} +2 -2
  152. package/assets/{parseSignature-_XuTQKnp.js → parseSignature-BhGVGyy8.js} +1 -1
  153. package/assets/{parseSignature-BXcK95O1.js → parseSignature-D-2KGIjo.js} +3 -3
  154. package/assets/{pay-with-exchange-DnGEPz-9.js → pay-with-exchange-D7uxTE5e.js} +1 -1
  155. package/assets/{qr-overlay-D1woZopL.js → qr-overlay-ASsJZZn5.js} +3 -3
  156. package/assets/{react-iAgwec9M.js → react-C51i12iP.js} +1 -1
  157. package/assets/{receive-DxQFpvBx.js → receive--EqYLwG2.js} +1 -1
  158. package/assets/{resolveImplementation-BhJMvZcE.js → resolveImplementation-DyRnucGw.js} +1 -1
  159. package/assets/{rpc-DgEEESUq.js → rpc-CjcTpc0V.js} +1 -1
  160. package/assets/secp256k1-C3pUvKM8.js +1 -0
  161. package/assets/secp256k1-CuYcQbK2.js +1 -0
  162. package/assets/{secp256k1-JL5K1b6W.js → secp256k1-QnclhqY7.js} +1 -1
  163. package/assets/{send-DTIO_xKD.js → send-CH7qei4t.js} +1 -1
  164. package/assets/{send-batch-transaction-D_I1HvSE.js → send-batch-transaction-Cr5kGUem.js} +1 -1
  165. package/assets/{send-eip712-transaction-CB6q4yTz.js → send-eip712-transaction-DNEzCZTW.js} +2 -2
  166. package/assets/{send-gasless-transaction-BjkKopST.js → send-gasless-transaction-BnwvR3f6.js} +2 -2
  167. package/assets/{sendRawTransaction-Cl3fTy2r.js → sendRawTransaction-BIHxQG44.js} +3 -3
  168. package/assets/{serializeTransaction-B5MYVv86.js → serializeTransaction-DbiNVef8.js} +1 -1
  169. package/assets/session-proposal-DvE_C2Qm.js +1 -0
  170. package/assets/session-request-DF5W14aH.js +2 -0
  171. package/assets/{sha256-C4qHsWKZ.js → sha256-DhQnMvgr.js} +1 -1
  172. package/assets/{signing-CjtnBxxM.js → signing-BChtQR_k.js} +5 -5
  173. package/assets/{socials-DHKSWRNK.js → socials-ibz-qcug.js} +1 -1
  174. package/assets/{swaps-oR49jgCz.js → swaps-D5GQ3VUK.js} +1 -1
  175. package/assets/template-cover-1-BETekfHg.jpeg +0 -0
  176. package/assets/template-cover-2-Dni9s0i_.jpeg +0 -0
  177. package/assets/{thirdweb-DLsVRg5B.js → thirdweb-CaDKinrI.js} +3 -3
  178. package/assets/{totalSupply-BbnfAQRL.js → totalSupply-DaG75TVX.js} +1 -1
  179. package/assets/{trade-encoding-gNFeXeFL.js → trade-encoding-3-fY1Skv.js} +1 -1
  180. package/assets/{transactionReceipt-D2SEnNQ1.js → transactionReceipt-DVjUNlv8.js} +1 -1
  181. package/assets/transactions-DN5Djj2C.js +16 -0
  182. package/assets/{useInfiniteGrid-BA1C5BmN.js → useInfiniteGrid-BeqyJL-J.js} +1 -1
  183. package/assets/useStore-BgEatlVS.js +2 -0
  184. package/assets/{utils-DmMVfaK5.js → utils-rl7KiNyp.js} +1 -1
  185. package/assets/{verifyHash-ZaW4iQ5U.js → verifyHash-C2MKzB9x.js} +1 -1
  186. package/assets/{w3m-modal-jjoiIHiM.js → w3m-modal-Bpc7iV--.js} +1 -1
  187. package/assets/{w3m-modal-C7bXvOf6.js → w3m-modal-JCjAaYVQ.js} +1 -1
  188. package/assets/{wait-for-tx-receipt-DztajESX.js → wait-for-tx-receipt-4J-SfEVn.js} +1 -1
  189. package/assets/{wallet-kind-BCHFSy95.js → wallet-kind-DmRQR63L.js} +1 -1
  190. package/assets/{wallets-CdPPQGkU.js → wallets-CH6ovtsY.js} +6 -6
  191. package/assets/web-connector-fZY0b-3_.js +9 -0
  192. package/assets/{writeContract-DNofglus.js → writeContract-D6AcaE27.js} +1 -1
  193. package/assets/{zora-sepolia-6WiqQMBk.js → zora-sepolia-Cmu9LYjr.js} +1 -1
  194. package/assets/{zoraTestnet-IteRz7Y6.js → zoraTestnet-CHyjVmWt.js} +1 -1
  195. package/index.html +8 -8
  196. package/package.json +2 -2
  197. package/assets/Assets-DQEUXeMX.js +0 -1
  198. package/assets/Cart-lN_ulEt9.js +0 -1
  199. package/assets/Collection-9eLs13RF.js +0 -1
  200. package/assets/Creator-DkWw07V0.js +0 -1
  201. package/assets/GetCredits-Cd2MM2_C.js +0 -1
  202. package/assets/ImportListings-CCqLXiQR.js +0 -1
  203. package/assets/ItemDetail-kMMoE6GO.js +0 -2
  204. package/assets/MyAssets-Ds0g4zU7.js +0 -1
  205. package/assets/SkeletonCards-BhzQlTiQ.js +0 -1
  206. package/assets/Success-BDL2iZK2.js +0 -1
  207. package/assets/TradeService-B9iZ5DY4.js +0 -1
  208. package/assets/browser-ponyfill-B39o65AB.js +0 -2
  209. package/assets/collection-OLKHFYz-.js +0 -1
  210. package/assets/controller-CbQsCzNl.js +0 -2
  211. package/assets/decimals-CTbYR1AE.js +0 -1
  212. package/assets/emotion-styled.browser.esm-B8upHOUh.js +0 -1
  213. package/assets/eth_estimateGas-iM3Zr91m.js +0 -1
  214. package/assets/eth_getTransactionCount-jDyG_Ia6.js +0 -1
  215. package/assets/get-ecosystem-wallet-info-MdgEA2Qu.js +0 -1
  216. package/assets/in-app-wallet-calls-D-eIKfO6.js +0 -1
  217. package/assets/index-BPa10U7S.js +0 -2
  218. package/assets/index-Bv7abT8U.js +0 -1
  219. package/assets/index-C3sRipyF.js +0 -1
  220. package/assets/index-CWJl0T5f.js +0 -1
  221. package/assets/index-CfKPHln4.js +0 -1
  222. package/assets/index-Ctf6wteV.css +0 -1
  223. package/assets/index-D5-hMxEz.js +0 -74
  224. package/assets/index-DYvtCH-a.js +0 -2
  225. package/assets/index-pgfSp-jn.js +0 -2
  226. package/assets/index-wNInR-jL.js +0 -21
  227. package/assets/index.es-_RJxIHwU.js +0 -1
  228. package/assets/network-Ce6LZqru.js +0 -1
  229. package/assets/secp256k1-BRibcqku.js +0 -1
  230. package/assets/secp256k1-c93U_qwn.js +0 -1
  231. package/assets/session-proposal-DnoyWdz2.js +0 -1
  232. package/assets/session-request-83tzrKS9.js +0 -2
  233. package/assets/transactions-CmcaT-SG.js +0 -16
  234. package/assets/web-connector-C3v6OgPl.js +0 -9
@@ -1 +0,0 @@
1
- import{B as M}from"./index-C1zw_jvz.js";import{B as Tt,q as Mt,K as ot,t as J,u as Bt,Y as F,P as $t,F as B,V as R,v as z,w as At,x as Lt}from"./wallets-CdPPQGkU.js";import"./index-BQkCy5n9.js";import{b as Jt,o as g,c as Et}from"./index-Bc_XrzTG.js";import{f as P}from"./index.es-CCFOZERa.js";import{N as zt}from"./index-pgfSp-jn.js";import"./react-iAgwec9M.js";import"./ethers-D-4WUfRB.js";import"./signing-CjtnBxxM.js";import"./utils-DmMVfaK5.js";import"./store-CraP4F4Y.js";import"./hashTypedData-CHOppTRC.js";import"./index-nibyPLVP.js";import"./index-CJdot1dH.js";import"./index-BPH4bq6L.js";import"./ethereum-CfGZ1o2B.js";import"./browser-ponyfill-B39o65AB.js";const ct="error",Gt="wss://relay.walletconnect.org",Vt="wc",Kt="universal_provider",x=`${Vt}@2:${Kt}:`,St="https://rpc.walletconnect.org/v1/",qt="generic",Wt=`${St}bundler`,_="call_status",Yt=86400,v={DEFAULT_CHAIN_CHANGED:"default_chain_changed"};function it(i){return i==null||typeof i!="object"&&typeof i!="function"}function Nt(i){return Object.getOwnPropertySymbols(i).filter(t=>Object.prototype.propertyIsEnumerable.call(i,t))}function Dt(i){return i==null?i===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(i)}const Qt="[object RegExp]",_t="[object String]",Ft="[object Number]",Rt="[object Boolean]",xt="[object Arguments]",Xt="[object Symbol]",Zt="[object Date]",te="[object Map]",ee="[object Set]",ie="[object Array]",se="[object ArrayBuffer]",re="[object Object]",ne="[object DataView]",ae="[object Uint8Array]",oe="[object Uint8ClampedArray]",ce="[object Uint16Array]",he="[object Uint32Array]",pe="[object Int8Array]",ue="[object Int16Array]",le="[object Int32Array]",de="[object Float32Array]",fe="[object Float64Array]";function st(i){return ArrayBuffer.isView(i)&&!(i instanceof DataView)}function me(i,t){return D(i,void 0,i,new Map,t)}function D(i,t,e,s=new Map,n=void 0){const a=n==null?void 0:n(i,t,e,s);if(a!=null)return a;if(it(i))return i;if(s.has(i))return s.get(i);if(Array.isArray(i)){const r=new Array(i.length);s.set(i,r);for(let o=0;o<i.length;o++)r[o]=D(i[o],o,e,s,n);return Object.hasOwn(i,"index")&&(r.index=i.index),Object.hasOwn(i,"input")&&(r.input=i.input),r}if(i instanceof Date)return new Date(i.getTime());if(i instanceof RegExp){const r=new RegExp(i.source,i.flags);return r.lastIndex=i.lastIndex,r}if(i instanceof Map){const r=new Map;s.set(i,r);for(const[o,c]of i)r.set(o,D(c,o,e,s,n));return r}if(i instanceof Set){const r=new Set;s.set(i,r);for(const o of i)r.add(D(o,void 0,e,s,n));return r}if(typeof M<"u"&&M.isBuffer(i))return i.subarray();if(st(i)){const r=new(Object.getPrototypeOf(i)).constructor(i.length);s.set(i,r);for(let o=0;o<i.length;o++)r[o]=D(i[o],o,e,s,n);return r}if(i instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&i instanceof SharedArrayBuffer)return i.slice(0);if(i instanceof DataView){const r=new DataView(i.buffer.slice(0),i.byteOffset,i.byteLength);return s.set(i,r),y(r,i,e,s,n),r}if(typeof File<"u"&&i instanceof File){const r=new File([i],i.name,{type:i.type});return s.set(i,r),y(r,i,e,s,n),r}if(i instanceof Blob){const r=new Blob([i],{type:i.type});return s.set(i,r),y(r,i,e,s,n),r}if(i instanceof Error){const r=new i.constructor;return s.set(i,r),r.message=i.message,r.name=i.name,r.stack=i.stack,r.cause=i.cause,y(r,i,e,s,n),r}if(typeof i=="object"&&ve(i)){const r=Object.create(Object.getPrototypeOf(i));return s.set(i,r),y(r,i,e,s,n),r}return i}function y(i,t,e=i,s,n){const a=[...Object.keys(t),...Nt(t)];for(let r=0;r<a.length;r++){const o=a[r],c=Object.getOwnPropertyDescriptor(i,o);(c==null||c.writable)&&(i[o]=D(t[o],o,e,s,n))}}function ve(i){switch(Dt(i)){case xt:case ie:case se:case ne:case Rt:case Zt:case de:case fe:case pe:case ue:case le:case te:case Ft:case re:case Qt:case ee:case _t:case Xt:case ae:case oe:case ce:case he:return!0;default:return!1}}function ge(i,t){return me(i,(e,s,n,a)=>{if(typeof i=="object")switch(Object.prototype.toString.call(i)){case Ft:case _t:case Rt:{const r=new i.constructor(i==null?void 0:i.valueOf());return y(r,i),r}case xt:{const r={};return y(r,i),r.length=i.length,r[Symbol.iterator]=i[Symbol.iterator],r}default:return}})}function ht(i){return ge(i)}function pt(i){return i!==null&&typeof i=="object"&&Dt(i)==="[object Arguments]"}function ut(i){return typeof i=="object"&&i!==null}function Pe(){}function we(i){return st(i)}function be(i){var e;if(typeof i!="object"||i==null)return!1;if(Object.getPrototypeOf(i)===null)return!0;if(Object.prototype.toString.call(i)!=="[object Object]"){const s=i[Symbol.toStringTag];return s==null||!((e=Object.getOwnPropertyDescriptor(i,Symbol.toStringTag))!=null&&e.writable)?!1:i.toString()===`[object ${s}]`}let t=i;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(i)===t}function ye(i){if(it(i))return i;if(Array.isArray(i)||st(i)||i instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&i instanceof SharedArrayBuffer)return i.slice(0);const t=Object.getPrototypeOf(i),e=t.constructor;if(i instanceof Date||i instanceof Map||i instanceof Set)return new e(i);if(i instanceof RegExp){const s=new e(i);return s.lastIndex=i.lastIndex,s}if(i instanceof DataView)return new e(i.buffer.slice(0));if(i instanceof Error){const s=new e(i.message);return s.stack=i.stack,s.name=i.name,s.cause=i.cause,s}if(typeof File<"u"&&i instanceof File)return new e([i],i.name,{type:i.type,lastModified:i.lastModified});if(typeof i=="object"){const s=Object.create(t);return Object.assign(s,i)}return i}function Ce(i,...t){const e=t.slice(0,-1),s=t[t.length-1];let n=i;for(let a=0;a<e.length;a++){const r=e[a];n=Z(n,r,s,new Map)}return n}function Z(i,t,e,s){if(it(i)&&(i=Object(i)),t==null||typeof t!="object")return i;if(s.has(t))return ye(s.get(t));if(s.set(t,i),Array.isArray(t)){t=t.slice();for(let a=0;a<t.length;a++)t[a]=t[a]??void 0}const n=[...Object.keys(t),...Nt(t)];for(let a=0;a<n.length;a++){const r=n[a];let o=t[r],c=i[r];if(pt(o)&&(o={...o}),pt(c)&&(c={...c}),typeof M<"u"&&M.isBuffer(o)&&(o=ht(o)),Array.isArray(o))if(typeof c=="object"&&c!=null){const l=[],h=Reflect.ownKeys(c);for(let w=0;w<h.length;w++){const d=h[w];l[d]=c[d]}c=l}else c=[];const u=e(c,o,r,i,t,s);u!=null?i[r]=u:Array.isArray(o)||ut(c)&&ut(o)?i[r]=Z(c,o,e,s):c==null&&be(o)?i[r]=Z({},o,e,s):c==null&&we(o)?i[r]=ht(o):(c===void 0||o!==void 0)&&(i[r]=o)}return i}function Ie(i,...t){return Ce(i,...t,Pe)}var Oe=Object.defineProperty,je=Object.defineProperties,He=Object.getOwnPropertyDescriptors,lt=Object.getOwnPropertySymbols,$e=Object.prototype.hasOwnProperty,Ae=Object.prototype.propertyIsEnumerable,dt=(i,t,e)=>t in i?Oe(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,U=(i,t)=>{for(var e in t||(t={}))$e.call(t,e)&&dt(i,e,t[e]);if(lt)for(var e of lt(t))Ae.call(t,e)&&dt(i,e,t[e]);return i},Ee=(i,t)=>je(i,He(t));function f(i,t,e){var s;const n=B(i);return((s=t.rpcMap)==null?void 0:s[n.reference])||`${St}?chainId=${n.namespace}:${n.reference}&projectId=${e}`}function C(i){return i.includes(":")?i.split(":")[1]:i}function Ut(i){return i.map(t=>`${t.split(":")[0]}:${t.split(":")[1]}`)}function Se(i,t){const e=Object.keys(t.namespaces).filter(n=>n.includes(i));if(!e.length)return[];const s=[];return e.forEach(n=>{const a=t.namespaces[n].accounts;s.push(...a)}),s}function ft(i){return Object.fromEntries(Object.entries(i).filter(([t,e])=>{var s,n;return((s=e==null?void 0:e.chains)==null?void 0:s.length)&&((n=e==null?void 0:e.chains)==null?void 0:n.length)>0}))}function k(i={},t={}){const e=ft(mt(i)),s=ft(mt(t));return Ie(e,s)}function mt(i){var t,e,s,n,a;const r={};if(!R(i))return r;for(const[o,c]of Object.entries(i)){const u=$t(o)?[o]:c.chains,l=c.methods||[],h=c.events||[],w=c.rpcMap||{},d=F(o);r[d]=Ee(U(U({},r[d]),c),{chains:z(u,(t=r[d])==null?void 0:t.chains),methods:z(l,(e=r[d])==null?void 0:e.methods),events:z(h,(s=r[d])==null?void 0:s.events)}),(R(w)||R(((n=r[d])==null?void 0:n.rpcMap)||{}))&&(r[d].rpcMap=U(U({},w),(a=r[d])==null?void 0:a.rpcMap))}return r}function vt(i){return i.includes(":")?i.split(":")[2]:i}function gt(i){const t={};for(const[e,s]of Object.entries(i)){const n=s.methods||[],a=s.events||[],r=s.accounts||[],o=$t(e)?[e]:s.chains?s.chains:Ut(s.accounts);t[e]={chains:o,methods:n,events:a,accounts:r}}return t}function G(i){return typeof i=="number"?i:i.includes("0x")?parseInt(i,16):(i=i.includes(":")?i.split(":")[1]:i,isNaN(Number(i))?i:Number(i))}function qe(i){try{const t=JSON.parse(i);return typeof t=="object"&&t!==null&&!Array.isArray(t)}catch{return!1}}const kt={},p=i=>kt[i],V=(i,t)=>{kt[i]=t};var Ne=Object.defineProperty,Pt=Object.getOwnPropertySymbols,De=Object.prototype.hasOwnProperty,_e=Object.prototype.propertyIsEnumerable,wt=(i,t,e)=>t in i?Ne(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,bt=(i,t)=>{for(var e in t||(t={}))De.call(t,e)&&wt(i,e,t[e]);if(Pt)for(var e of Pt(t))_e.call(t,e)&&wt(i,e,t[e]);return i};const yt="eip155",Fe=["atomic","flow-control","paymasterService","sessionKeys","auxiliaryFunds"],Re=i=>i&&i.startsWith("0x")?BigInt(i).toString(10):i,K=i=>i&&i.startsWith("0x")?i:`0x${BigInt(i).toString(16)}`,Ct=i=>Object.keys(i).filter(t=>Fe.includes(t)).reduce((t,e)=>(t[e]=xe(i[e]),t),{}),xe=i=>typeof i=="string"&&qe(i)?JSON.parse(i):i,Ue=(i,t,e)=>{const{sessionProperties:s={},scopedProperties:n={}}=i,a={};if(!R(n)&&!R(s))return;const r=Ct(s);for(const o of e){const c=Re(o);if(!c)continue;a[K(c)]=r;const u=n==null?void 0:n[`${yt}:${c}`];if(u){const l=u==null?void 0:u[`${yt}:${c}:${t}`];a[K(c)]=bt(bt({},a[K(c)]),Ct(l||u))}}for(const[o,c]of Object.entries(a))Object.keys(c).length===0&&delete a[o];return Object.keys(a).length>0?a:void 0};var ke=Object.defineProperty,Te=(i,t,e)=>t in i?ke(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Me=(i,t,e)=>Te(i,t+"",e);let W;class rt{constructor(t){Me(this,"storage"),this.storage=t}async getItem(t){return await this.storage.getItem(t)}async setItem(t,e){return await this.storage.setItem(t,e)}async removeItem(t){return await this.storage.removeItem(t)}static getStorage(t){return W||(W=new rt(t)),W}}var Be=Object.defineProperty,Le=Object.defineProperties,Je=Object.getOwnPropertyDescriptors,It=Object.getOwnPropertySymbols,ze=Object.prototype.hasOwnProperty,Ge=Object.prototype.propertyIsEnumerable,Ot=(i,t,e)=>t in i?Be(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Ve=(i,t)=>{for(var e in t||(t={}))ze.call(t,e)&&Ot(i,e,t[e]);if(It)for(var e of It(t))Ge.call(t,e)&&Ot(i,e,t[e]);return i},Ke=(i,t)=>Le(i,Je(t));async function We(i,t){const e=B(i.result.capabilities.caip345.caip2),s=i.result.capabilities.caip345.transactionHashes,n=await Promise.allSettled(s.map(h=>Ye(e.reference,h,t))),a=n.filter(h=>h.status==="fulfilled").map(h=>h.value).filter(h=>h);n.filter(h=>h.status==="rejected").forEach(h=>console.warn("Failed to fetch transaction receipt:",h.reason));const r=!a.length||a.some(h=>!h),o=a.every(h=>(h==null?void 0:h.status)==="0x1"),c=a.every(h=>(h==null?void 0:h.status)==="0x0"),u=a.some(h=>(h==null?void 0:h.status)==="0x0");let l;return r?l=100:o?l=200:c?l=500:u&&(l=600),{id:i.result.id,version:i.request.version,atomic:i.request.atomicRequired,chainId:i.request.chainId,capabilities:i.result.capabilities,receipts:a,status:l}}async function Ye(i,t,e){return await e(parseInt(i)).request(Et("eth_getTransactionReceipt",[t]))}async function Qe({sendCalls:i,storage:t}){const e=await t.getItem(_);await t.setItem(_,Ke(Ve({},e),{[i.result.id]:{request:i.request,result:i.result,expiry:Lt(Yt)}}))}async function Xe({resultId:i,storage:t}){const e=await t.getItem(_);if(e){delete e[i],await t.setItem(_,e);for(const s in e)At(e[s].expiry)&&delete e[s];await t.setItem(_,e)}}async function Ze({resultId:i,storage:t}){const e=await t.getItem(_),s=e==null?void 0:e[i];if(s&&!At(s.expiry))return s;await Xe({resultId:i,storage:t})}var ti=Object.defineProperty,ei=(i,t,e)=>t in i?ti(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,I=(i,t,e)=>ei(i,typeof t!="symbol"?t+"":t,e);class ii{constructor(t){I(this,"name","polkadot"),I(this,"client"),I(this,"httpProviders"),I(this,"events"),I(this,"namespace"),I(this,"chainId"),this.namespace=t.namespace,this.events=p("events"),this.client=p("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,e){this.httpProviders[t]||this.setHttpProvider(t,e),this.chainId=t,this.events.emit(v.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getAccounts(){const t=this.namespace.accounts;return t?t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2])||[]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{var s;const n=C(e);t[n]=this.createHttpProvider(n,(s=this.namespace.rpcMap)==null?void 0:s[e])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const s=this.createHttpProvider(t,e);s&&(this.httpProviders[t]=s)}createHttpProvider(t,e){const s=e||f(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new g(new P(s,p("disableProviderPing")))}}var si=Object.defineProperty,ri=Object.defineProperties,ni=Object.getOwnPropertyDescriptors,jt=Object.getOwnPropertySymbols,ai=Object.prototype.hasOwnProperty,oi=Object.prototype.propertyIsEnumerable,tt=(i,t,e)=>t in i?si(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Y=(i,t)=>{for(var e in t||(t={}))ai.call(t,e)&&tt(i,e,t[e]);if(jt)for(var e of jt(t))oi.call(t,e)&&tt(i,e,t[e]);return i},Q=(i,t)=>ri(i,ni(t)),b=(i,t,e)=>tt(i,typeof t!="symbol"?t+"":t,e);class ci{constructor(t){b(this,"name","eip155"),b(this,"client"),b(this,"chainId"),b(this,"namespace"),b(this,"httpProviders"),b(this,"events"),b(this,"storage"),this.namespace=t.namespace,this.events=p("events"),this.client=p("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain()),this.storage=rt.getStorage(this.client.core.storage)}async request(t){switch(t.request.method){case"eth_requestAccounts":return this.getAccounts();case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(t);case"eth_chainId":return parseInt(this.getDefaultChain());case"wallet_getCapabilities":return await this.getCapabilities(t);case"wallet_getCallsStatus":return await this.getCallStatus(t);case"wallet_sendCalls":return await this.sendCalls(t)}return this.namespace.methods.includes(t.request.method)?await this.client.request(t):this.getHttpProvider().request(t.request)}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}setDefaultChain(t,e){this.httpProviders[t]||this.setHttpProvider(parseInt(t),e),this.chainId=parseInt(t),this.events.emit(v.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}createHttpProvider(t,e){const s=e||f(`${this.name}:${t}`,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new g(new P(s,p("disableProviderPing")))}setHttpProvider(t,e){const s=this.createHttpProvider(t,e);s&&(this.httpProviders[t]=s)}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{var s;const n=parseInt(C(e));t[n]=this.createHttpProvider(n,(s=this.namespace.rpcMap)==null?void 0:s[e])}),t}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}getHttpProvider(t){const e=t||this.chainId;return this.httpProviders[e]||(this.httpProviders=Q(Y({},this.httpProviders),{[e]:this.createHttpProvider(e)}),this.httpProviders[e])}async handleSwitchChain(t){var e,s;let n=t.request.params?(e=t.request.params[0])==null?void 0:e.chainId:"0x0";n=n.startsWith("0x")?n:`0x${n}`;const a=parseInt(n,16);if(this.isChainApproved(a))this.setDefaultChain(`${a}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:t.topic,request:{method:t.request.method,params:[{chainId:n}]},chainId:(s=this.namespace.chains)==null?void 0:s[0]}),this.setDefaultChain(`${a}`);else throw new Error(`Failed to switch to chain 'eip155:${a}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);return null}isChainApproved(t){return this.namespace.chains.includes(`${this.name}:${t}`)}async getCapabilities(t){var e,s,n,a,r;const o=(s=(e=t.request)==null?void 0:e.params)==null?void 0:s[0],c=((a=(n=t.request)==null?void 0:n.params)==null?void 0:a[1])||[];if(!o)throw new Error("Missing address parameter in `wallet_getCapabilities` request");const u=this.client.session.get(t.topic),l=((r=u==null?void 0:u.sessionProperties)==null?void 0:r.capabilities)||{},h=`${o}${c.join(",")}`,w=l==null?void 0:l[h];if(w)return w;let d;try{d=Ue(u,o,c)}catch(L){console.warn("Failed to extract capabilities from session",L)}if(d)return d;const at=await this.client.request(t);try{await this.client.session.update(t.topic,{sessionProperties:Q(Y({},u.sessionProperties||{}),{capabilities:Q(Y({},l||{}),{[h]:at})})})}catch(L){console.warn("Failed to update session with capabilities",L)}return at}async getCallStatus(t){var e,s,n;const a=this.client.session.get(t.topic),r=(e=a.sessionProperties)==null?void 0:e.bundler_name;if(r){const u=this.getBundlerUrl(t.chainId,r);try{return await this.getUserOperationReceipt(u,t)}catch(l){console.warn("Failed to fetch call status from bundler",l,u)}}const o=(s=a.sessionProperties)==null?void 0:s.bundler_url;if(o)try{return await this.getUserOperationReceipt(o,t)}catch(u){console.warn("Failed to fetch call status from custom bundler",u,o)}const c=await Ze({resultId:(n=t.request.params)==null?void 0:n[0],storage:this.storage});if(c)try{return await We(c,this.getHttpProvider.bind(this))}catch(u){console.warn("Failed to fetch call status from stored send calls",u,c)}if(this.namespace.methods.includes(t.request.method))return await this.client.request(t);throw new Error("Fetching call status not approved by the wallet.")}async getUserOperationReceipt(t,e){var s;const n=new URL(t),a=await fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Et("eth_getUserOperationReceipt",[(s=e.request.params)==null?void 0:s[0]]))});if(!a.ok)throw new Error(`Failed to fetch user operation receipt - ${a.status}`);return await a.json()}getBundlerUrl(t,e){return`${Wt}?projectId=${this.client.core.projectId}&chainId=${t}&bundler=${e}`}async sendCalls(t){var e,s,n;const a=await this.client.request(t),r=(e=t.request.params)==null?void 0:e[0],o=a==null?void 0:a.id,c=(a==null?void 0:a.capabilities)||{},u=(s=c==null?void 0:c.caip345)==null?void 0:s.caip2,l=(n=c==null?void 0:c.caip345)==null?void 0:n.transactionHashes;return!o||!u||!(l!=null&&l.length)||await Qe({sendCalls:{request:r,result:a},storage:this.storage}),a}}var hi=Object.defineProperty,pi=(i,t,e)=>t in i?hi(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,O=(i,t,e)=>pi(i,typeof t!="symbol"?t+"":t,e);class ui{constructor(t){O(this,"name","solana"),O(this,"client"),O(this,"httpProviders"),O(this,"events"),O(this,"namespace"),O(this,"chainId"),this.namespace=t.namespace,this.events=p("events"),this.client=p("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,e){this.httpProviders[t]||this.setHttpProvider(t,e),this.chainId=t,this.events.emit(v.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{var s;const n=C(e);t[n]=this.createHttpProvider(n,(s=this.namespace.rpcMap)==null?void 0:s[e])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const s=this.createHttpProvider(t,e);s&&(this.httpProviders[t]=s)}createHttpProvider(t,e){const s=e||f(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new g(new P(s,p("disableProviderPing")))}}var li=Object.defineProperty,di=(i,t,e)=>t in i?li(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,j=(i,t,e)=>di(i,typeof t!="symbol"?t+"":t,e);class fi{constructor(t){j(this,"name","cosmos"),j(this,"client"),j(this,"httpProviders"),j(this,"events"),j(this,"namespace"),j(this,"chainId"),this.namespace=t.namespace,this.events=p("events"),this.client=p("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,e){this.httpProviders[t]||this.setHttpProvider(t,e),this.chainId=t,this.events.emit(v.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{var s;const n=C(e);t[n]=this.createHttpProvider(n,(s=this.namespace.rpcMap)==null?void 0:s[e])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const s=this.createHttpProvider(t,e);s&&(this.httpProviders[t]=s)}createHttpProvider(t,e){const s=e||f(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new g(new P(s,p("disableProviderPing")))}}var mi=Object.defineProperty,vi=(i,t,e)=>t in i?mi(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,H=(i,t,e)=>vi(i,typeof t!="symbol"?t+"":t,e);class gi{constructor(t){H(this,"name","algorand"),H(this,"client"),H(this,"httpProviders"),H(this,"events"),H(this,"namespace"),H(this,"chainId"),this.namespace=t.namespace,this.events=p("events"),this.client=p("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,e){if(!this.httpProviders[t]){const s=e||f(`${this.name}:${t}`,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);this.setHttpProvider(t,s)}this.chainId=t,this.events.emit(v.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{var s;t[e]=this.createHttpProvider(e,(s=this.namespace.rpcMap)==null?void 0:s[e])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const s=this.createHttpProvider(t,e);s&&(this.httpProviders[t]=s)}createHttpProvider(t,e){const s=e||f(t,this.namespace,this.client.core.projectId);return typeof s>"u"?void 0:new g(new P(s,p("disableProviderPing")))}}var Pi=Object.defineProperty,wi=(i,t,e)=>t in i?Pi(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,$=(i,t,e)=>wi(i,typeof t!="symbol"?t+"":t,e);class bi{constructor(t){$(this,"name","cip34"),$(this,"client"),$(this,"httpProviders"),$(this,"events"),$(this,"namespace"),$(this,"chainId"),this.namespace=t.namespace,this.events=p("events"),this.client=p("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,e){this.httpProviders[t]||this.setHttpProvider(t,e),this.chainId=t,this.events.emit(v.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{const s=this.getCardanoRPCUrl(e),n=C(e);t[n]=this.createHttpProvider(n,s)}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}getCardanoRPCUrl(t){const e=this.namespace.rpcMap;if(e)return e[t]}setHttpProvider(t,e){const s=this.createHttpProvider(t,e);s&&(this.httpProviders[t]=s)}createHttpProvider(t,e){const s=e||this.getCardanoRPCUrl(t);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new g(new P(s,p("disableProviderPing")))}}var yi=Object.defineProperty,Ci=(i,t,e)=>t in i?yi(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,A=(i,t,e)=>Ci(i,typeof t!="symbol"?t+"":t,e);class Ii{constructor(t){A(this,"name","elrond"),A(this,"client"),A(this,"httpProviders"),A(this,"events"),A(this,"namespace"),A(this,"chainId"),this.namespace=t.namespace,this.events=p("events"),this.client=p("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,e){this.httpProviders[t]||this.setHttpProvider(t,e),this.chainId=t,this.events.emit(v.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{var s;const n=C(e);t[n]=this.createHttpProvider(n,(s=this.namespace.rpcMap)==null?void 0:s[e])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const s=this.createHttpProvider(t,e);s&&(this.httpProviders[t]=s)}createHttpProvider(t,e){const s=e||f(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new g(new P(s,p("disableProviderPing")))}}var Oi=Object.defineProperty,ji=(i,t,e)=>t in i?Oi(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,E=(i,t,e)=>ji(i,typeof t!="symbol"?t+"":t,e);class Hi{constructor(t){E(this,"name","multiversx"),E(this,"client"),E(this,"httpProviders"),E(this,"events"),E(this,"namespace"),E(this,"chainId"),this.namespace=t.namespace,this.events=p("events"),this.client=p("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,e){this.httpProviders[t]||this.setHttpProvider(t,e),this.chainId=t,this.events.emit(v.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{var s;const n=C(e);t[n]=this.createHttpProvider(n,(s=this.namespace.rpcMap)==null?void 0:s[e])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const s=this.createHttpProvider(t,e);s&&(this.httpProviders[t]=s)}createHttpProvider(t,e){const s=e||f(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new g(new P(s,p("disableProviderPing")))}}var $i=Object.defineProperty,Ai=(i,t,e)=>t in i?$i(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,S=(i,t,e)=>Ai(i,typeof t!="symbol"?t+"":t,e);class Ei{constructor(t){S(this,"name","near"),S(this,"client"),S(this,"httpProviders"),S(this,"events"),S(this,"namespace"),S(this,"chainId"),this.namespace=t.namespace,this.events=p("events"),this.client=p("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,e){if(this.chainId=t,!this.httpProviders[t]){const s=e||f(`${this.name}:${t}`,this.namespace);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);this.setHttpProvider(t,s)}this.events.emit(v.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2])||[]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{var s;t[e]=this.createHttpProvider(e,(s=this.namespace.rpcMap)==null?void 0:s[e])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const s=this.createHttpProvider(t,e);s&&(this.httpProviders[t]=s)}createHttpProvider(t,e){const s=e||f(t,this.namespace);return typeof s>"u"?void 0:new g(new P(s,p("disableProviderPing")))}}var Si=Object.defineProperty,qi=(i,t,e)=>t in i?Si(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,q=(i,t,e)=>qi(i,typeof t!="symbol"?t+"":t,e);class Ni{constructor(t){q(this,"name","tezos"),q(this,"client"),q(this,"httpProviders"),q(this,"events"),q(this,"namespace"),q(this,"chainId"),this.namespace=t.namespace,this.events=p("events"),this.client=p("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,e){if(this.chainId=t,!this.httpProviders[t]){const s=e||f(`${this.name}:${t}`,this.namespace);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);this.setHttpProvider(t,s)}this.events.emit(v.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2])||[]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{t[e]=this.createHttpProvider(e)}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const s=this.createHttpProvider(t,e);s&&(this.httpProviders[t]=s)}createHttpProvider(t,e){const s=e||f(t,this.namespace);return typeof s>"u"?void 0:new g(new P(s))}}var Di=Object.defineProperty,_i=(i,t,e)=>t in i?Di(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,N=(i,t,e)=>_i(i,typeof t!="symbol"?t+"":t,e);class Fi{constructor(t){N(this,"name",qt),N(this,"client"),N(this,"httpProviders"),N(this,"events"),N(this,"namespace"),N(this,"chainId"),this.namespace=t.namespace,this.events=p("events"),this.client=p("client"),this.chainId=this.getDefaultChain(),this.name=this.getNamespaceName(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace.chains=[...new Set((this.namespace.chains||[]).concat(t.chains||[]))],this.namespace.accounts=[...new Set((this.namespace.accounts||[]).concat(t.accounts||[]))],this.namespace.methods=[...new Set((this.namespace.methods||[]).concat(t.methods||[]))],this.namespace.events=[...new Set((this.namespace.events||[]).concat(t.events||[]))],this.httpProviders=this.createHttpProviders()}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider(t.chainId).request(t.request)}setDefaultChain(t,e){this.httpProviders[t]||this.setHttpProvider(t,e),this.chainId=t,this.events.emit(v.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getNamespaceName(){const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return B(t).namespace}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){var t,e;const s={};return(e=(t=this.namespace)==null?void 0:t.accounts)==null||e.forEach(n=>{const a=B(n);s[a.reference]=this.createHttpProvider(n)}),s}getHttpProvider(t){const e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const s=this.createHttpProvider(t,e);s&&(this.httpProviders[t]=s)}createHttpProvider(t,e){const s=e||f(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new g(new P(s,p("disableProviderPing")))}}var Ri=Object.defineProperty,xi=Object.defineProperties,Ui=Object.getOwnPropertyDescriptors,Ht=Object.getOwnPropertySymbols,ki=Object.prototype.hasOwnProperty,Ti=Object.prototype.propertyIsEnumerable,et=(i,t,e)=>t in i?Ri(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,T=(i,t)=>{for(var e in t||(t={}))ki.call(t,e)&&et(i,e,t[e]);if(Ht)for(var e of Ht(t))Ti.call(t,e)&&et(i,e,t[e]);return i},X=(i,t)=>xi(i,Ui(t)),m=(i,t,e)=>et(i,typeof t!="symbol"?t+"":t,e);class nt{constructor(t){m(this,"client"),m(this,"namespaces"),m(this,"optionalNamespaces"),m(this,"sessionProperties"),m(this,"scopedProperties"),m(this,"events",new zt),m(this,"rpcProviders",{}),m(this,"session"),m(this,"providerOpts"),m(this,"logger"),m(this,"uri"),m(this,"disableProviderPing",!1),this.providerOpts=t,this.logger=typeof(t==null?void 0:t.logger)<"u"&&typeof(t==null?void 0:t.logger)!="string"?t.logger:Tt(Mt({level:(t==null?void 0:t.logger)||ct})),this.disableProviderPing=(t==null?void 0:t.disableProviderPing)||!1}static async init(t){const e=new nt(t);return await e.initialize(),e}async request(t,e,s){const[n,a]=this.validateChain(e);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(n).request({request:T({},t),chainId:`${n}:${a}`,topic:this.session.topic,expiry:s})}sendAsync(t,e,s,n){const a=new Date().getTime();this.request(t,s,n).then(r=>e(null,Jt(a,r))).catch(r=>e(r,void 0))}async enable(){if(!this.client)throw new Error("Sign Client not initialized");return this.session||await this.connect({namespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties,scopedProperties:this.scopedProperties}),await this.requestAccounts()}async disconnect(){var t;if(!this.session)throw new Error("Please call connect() before enable()");await this.client.disconnect({topic:(t=this.session)==null?void 0:t.topic,reason:ot("USER_DISCONNECTED")}),await this.cleanup()}async connect(t){if(!this.client)throw new Error("Sign Client not initialized");if(this.setNamespaces(t),this.cleanupPendingPairings(),!t.skipPairing)return await this.pair(t.pairingTopic)}async authenticate(t,e){if(!this.client)throw new Error("Sign Client not initialized");this.setNamespaces(t),await this.cleanupPendingPairings();const{uri:s,response:n}=await this.client.authenticate(t,e);s&&(this.uri=s,this.events.emit("display_uri",s));const a=await n();if(this.session=a.session,this.session){const r=gt(this.session.namespaces);this.namespaces=k(this.namespaces,r),await this.persist("namespaces",this.namespaces),this.onConnect()}return a}on(t,e){this.events.on(t,e)}once(t,e){this.events.once(t,e)}removeListener(t,e){this.events.removeListener(t,e)}off(t,e){this.events.off(t,e)}get isWalletConnect(){return!0}async pair(t){const{uri:e,approval:s}=await this.client.connect({pairingTopic:t,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties,scopedProperties:this.scopedProperties});e&&(this.uri=e,this.events.emit("display_uri",e));const n=await s();this.session=n;const a=gt(n.namespaces);return this.namespaces=k(this.namespaces,a),await this.persist("namespaces",this.namespaces),await this.persist("optionalNamespaces",this.optionalNamespaces),this.onConnect(),this.session}setDefaultChain(t,e){try{if(!this.session)return;const[s,n]=this.validateChain(t);this.getProvider(s).setDefaultChain(n,e)}catch(s){if(!/Please call connect/.test(s.message))throw s}}async cleanupPendingPairings(t={}){try{this.logger.info("Cleaning up inactive pairings...");const e=this.client.pairing.getAll();if(!J(e))return;for(const s of e)t.deletePairings?this.client.core.expirer.set(s.topic,0):await this.client.core.relayer.subscriber.unsubscribe(s.topic);this.logger.info(`Inactive pairings cleared: ${e.length}`)}catch(e){this.logger.warn("Failed to cleanup pending pairings",e)}}abortPairingAttempt(){this.logger.warn("abortPairingAttempt is deprecated. This is now a no-op.")}async checkStorage(){this.namespaces=await this.getFromStore("namespaces")||{},this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.session&&this.createProviders()}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){var t,e;if(this.client=this.providerOpts.client||await Bt.init({core:this.providerOpts.core,logger:this.providerOpts.logger||ct,relayUrl:this.providerOpts.relayUrl||Gt,projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name,customStoragePrefix:this.providerOpts.customStoragePrefix,telemetryEnabled:this.providerOpts.telemetryEnabled}),this.providerOpts.session)try{this.session=this.client.session.get(this.providerOpts.session.topic)}catch(s){throw this.logger.error("Failed to get session",s),new Error(`The provided session: ${(e=(t=this.providerOpts)==null?void 0:t.session)==null?void 0:e.topic} doesn't exist in the Sign client`)}else{const s=this.client.session.getAll();this.session=s[0]}this.logger.trace("SignClient Initialized")}createProviders(){if(!this.client)throw new Error("Sign Client not initialized");if(!this.session)throw new Error("Session not initialized. Please call connect() before enable()");const t=[...new Set(Object.keys(this.session.namespaces).map(e=>F(e)))];V("client",this.client),V("events",this.events),V("disableProviderPing",this.disableProviderPing),t.forEach(e=>{if(!this.session)return;const s=Se(e,this.session);if((s==null?void 0:s.length)===0)return;const n=Ut(s),a=k(this.namespaces,this.optionalNamespaces),r=X(T({},a[e]),{accounts:s,chains:n});switch(e){case"eip155":this.rpcProviders[e]=new ci({namespace:r});break;case"algorand":this.rpcProviders[e]=new gi({namespace:r});break;case"solana":this.rpcProviders[e]=new ui({namespace:r});break;case"cosmos":this.rpcProviders[e]=new fi({namespace:r});break;case"polkadot":this.rpcProviders[e]=new ii({namespace:r});break;case"cip34":this.rpcProviders[e]=new bi({namespace:r});break;case"elrond":this.rpcProviders[e]=new Ii({namespace:r});break;case"multiversx":this.rpcProviders[e]=new Hi({namespace:r});break;case"near":this.rpcProviders[e]=new Ei({namespace:r});break;case"tezos":this.rpcProviders[e]=new Ni({namespace:r});break;default:this.rpcProviders[e]=new Fi({namespace:r})}})}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",t=>{var e;const{topic:s}=t;s===((e=this.session)==null?void 0:e.topic)&&this.events.emit("session_ping",t)}),this.client.on("session_event",t=>{var e;const{params:s,topic:n}=t;if(n!==((e=this.session)==null?void 0:e.topic))return;const{event:a}=s;if(a.name==="accountsChanged"){const r=a.data;r&&J(r)&&this.events.emit("accountsChanged",r.map(vt))}else if(a.name==="chainChanged"){const r=s.chainId,o=s.event.data,c=F(r),u=G(r)!==G(o)?`${c}:${G(o)}`:r;this.onChainChanged(u)}else this.events.emit(a.name,a.data);this.events.emit("session_event",t)}),this.client.on("session_update",({topic:t,params:e})=>{var s,n;if(t!==((s=this.session)==null?void 0:s.topic))return;const{namespaces:a}=e,r=(n=this.client)==null?void 0:n.session.get(t);this.session=X(T({},r),{namespaces:a}),this.onSessionUpdate(),this.events.emit("session_update",{topic:t,params:e})}),this.client.on("session_delete",async t=>{var e;t.topic===((e=this.session)==null?void 0:e.topic)&&(await this.cleanup(),this.events.emit("session_delete",t),this.events.emit("disconnect",X(T({},ot("USER_DISCONNECTED")),{data:t.topic})))}),this.on(v.DEFAULT_CHAIN_CHANGED,t=>{this.onChainChanged(t,!0)})}getProvider(t){return this.rpcProviders[t]||this.rpcProviders[qt]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(t=>{var e;this.getProvider(t).updateNamespace((e=this.session)==null?void 0:e.namespaces[t])})}setNamespaces(t){const{namespaces:e={},optionalNamespaces:s={},sessionProperties:n,scopedProperties:a}=t;this.optionalNamespaces=k(e,s),this.sessionProperties=n,this.scopedProperties=a}validateChain(t){const[e,s]=(t==null?void 0:t.split(":"))||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[e,s];if(e&&!Object.keys(this.namespaces||{}).map(r=>F(r)).includes(e))throw new Error(`Namespace '${e}' is not configured. Please call connect() first with namespace config.`);if(e&&s)return[e,s];const n=F(Object.keys(this.namespaces)[0]),a=this.rpcProviders[n].getDefaultChain();return[n,a]}async requestAccounts(){const[t]=this.validateChain();return await this.getProvider(t).requestAccounts()}async onChainChanged(t,e=!1){if(!this.namespaces)return;const[s,n]=this.validateChain(t);if(!n)return;this.updateNamespaceChain(s,n);const a=this.getProvider(s).getDefaultChain();e?(this.events.emit("chainChanged",n),this.emitAccountsChangedOnChainChange({namespace:s,previousChainId:a,newChainId:t})):this.getProvider(s).setDefaultChain(n),await this.persist("namespaces",this.namespaces)}emitAccountsChangedOnChainChange({namespace:t,previousChainId:e,newChainId:s}){var n,a;try{if(e===s)return;const r=(a=(n=this.session)==null?void 0:n.namespaces[t])==null?void 0:a.accounts;if(!r)return;const o=r.filter(c=>c.includes(`${s}:`)).map(vt);if(!J(o))return;this.events.emit("accountsChanged",o)}catch(r){this.logger.warn("Failed to emit accountsChanged on chain change",r)}}updateNamespaceChain(t,e){if(!this.namespaces)return;const s=this.namespaces[t]?t:`${t}:${e}`,n={chains:[],methods:[],events:[],defaultChain:e};this.namespaces[s]?this.namespaces[s]&&(this.namespaces[s].defaultChain=e):this.namespaces[s]=n}onConnect(){this.createProviders(),this.events.emit("connect",{session:this.session})}async cleanup(){this.namespaces=void 0,this.optionalNamespaces=void 0,this.sessionProperties=void 0,await this.deleteFromStore("namespaces"),await this.deleteFromStore("optionalNamespaces"),await this.deleteFromStore("sessionProperties"),this.session=void 0,this.cleanupPendingPairings({deletePairings:!0}),await this.cleanupStorage()}async persist(t,e){var s;const n=((s=this.session)==null?void 0:s.topic)||"";await this.client.core.storage.setItem(`${x}/${t}${n}`,e)}async getFromStore(t){var e;const s=((e=this.session)==null?void 0:e.topic)||"";return await this.client.core.storage.getItem(`${x}/${t}${s}`)}async deleteFromStore(t){var e;const s=((e=this.session)==null?void 0:e.topic)||"";await this.client.core.storage.removeItem(`${x}/${t}${s}`)}async cleanupStorage(){var t;try{if(((t=this.client)==null?void 0:t.session.length)>0)return;const e=await this.client.core.storage.getKeys();for(const s of e)s.startsWith(x)&&await this.client.core.storage.removeItem(s)}catch(e){this.logger.warn("Failed to cleanup storage",e)}}}const rs=nt;export{rs as UniversalProvider,nt as default};
@@ -1 +0,0 @@
1
- import{r}from"./index-C1zw_jvz.js";var e=r();export{e as n};
@@ -1 +0,0 @@
1
- import{H as Xt,c as At,a as Et,t as Qt,b as de,w as he,r as P,d as ge,e as we,f as pe,g as be}from"./index.es-DgJoRPHo.js";import"./index-C1zw_jvz.js";import"./react-iAgwec9M.js";import"./ethers-D-4WUfRB.js";import"./index-pgfSp-jn.js";import"./index-Bc_XrzTG.js";import"./index-BQkCy5n9.js";import"./index-nibyPLVP.js";import"./index-CJdot1dH.js";import"./index.es-CCFOZERa.js";import"./browser-ponyfill-B39o65AB.js";function ye(n,e,t,r){if(typeof n.setBigUint64=="function")return n.setBigUint64(e,t,r);const o=BigInt(32),s=BigInt(4294967295),c=Number(t>>o&s),f=Number(t&s),i=r?4:0,u=r?0:4;n.setUint32(e+i,c,r),n.setUint32(e+u,f,r)}function me(n,e,t){return n&e^~n&t}function xe(n,e,t){return n&e^n&t^e&t}class Ee extends Xt{constructor(e,t,r,o){super(),this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=o,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=At(this.buffer)}update(e){Et(this);const{view:t,buffer:r,blockLen:o}=this;e=Qt(e);const s=e.length;for(let c=0;c<s;){const f=Math.min(o-this.pos,s-c);if(f===o){const i=At(e);for(;o<=s-c;c+=o)this.process(i,c);continue}r.set(e.subarray(c,c+f),this.pos),this.pos+=f,c+=f,this.pos===o&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){Et(this),de(e,this),this.finished=!0;const{buffer:t,view:r,blockLen:o,isLE:s}=this;let{pos:c}=this;t[c++]=128,this.buffer.subarray(c).fill(0),this.padOffset>o-c&&(this.process(r,0),c=0);for(let h=c;h<o;h++)t[h]=0;ye(r,o-8,BigInt(this.length*8),s),this.process(r,0);const f=At(e),i=this.outputLen;if(i%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const u=i/4,y=this.get();if(u>y.length)throw new Error("_sha2: outputLen bigger than state");for(let h=0;h<u;h++)f.setUint32(4*h,y[h],s)}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const r=e.slice(0,t);return this.destroy(),r}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:t,buffer:r,length:o,finished:s,destroyed:c,pos:f}=this;return e.length=o,e.pos=f,e.finished=s,e.destroyed=c,o%t&&e.buffer.set(r),e}}const Be=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Q=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),J=new Uint32Array(64);class ve extends Ee{constructor(){super(64,32,8,!1),this.A=Q[0]|0,this.B=Q[1]|0,this.C=Q[2]|0,this.D=Q[3]|0,this.E=Q[4]|0,this.F=Q[5]|0,this.G=Q[6]|0,this.H=Q[7]|0}get(){const{A:e,B:t,C:r,D:o,E:s,F:c,G:f,H:i}=this;return[e,t,r,o,s,c,f,i]}set(e,t,r,o,s,c,f,i){this.A=e|0,this.B=t|0,this.C=r|0,this.D=o|0,this.E=s|0,this.F=c|0,this.G=f|0,this.H=i|0}process(e,t){for(let h=0;h<16;h++,t+=4)J[h]=e.getUint32(t,!1);for(let h=16;h<64;h++){const l=J[h-15],m=J[h-2],N=P(l,7)^P(l,18)^l>>>3,b=P(m,17)^P(m,19)^m>>>10;J[h]=b+J[h-7]+N+J[h-16]|0}let{A:r,B:o,C:s,D:c,E:f,F:i,G:u,H:y}=this;for(let h=0;h<64;h++){const l=P(f,6)^P(f,11)^P(f,25),m=y+l+me(f,i,u)+Be[h]+J[h]|0,b=(P(r,2)^P(r,13)^P(r,22))+xe(r,o,s)|0;y=u,u=i,i=f,f=c+m|0,c=s,s=o,o=r,r=m+b|0}r=r+this.A|0,o=o+this.B|0,s=s+this.C|0,c=c+this.D|0,f=f+this.E|0,i=i+this.F|0,u=u+this.G|0,y=y+this.H|0,this.set(r,o,s,c,f,i,u,y)}roundClean(){J.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const Se=he(()=>new ve);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Ct=BigInt(0),Jt=BigInt(1),Ae=BigInt(2);function it(n){return n instanceof Uint8Array||ArrayBuffer.isView(n)&&n.constructor.name==="Uint8Array"}function yt(n){if(!it(n))throw new Error("Uint8Array expected")}function at(n,e){if(typeof e!="boolean")throw new Error(n+" boolean expected, got "+e)}const Ie=Array.from({length:256},(n,e)=>e.toString(16).padStart(2,"0"));function ut(n){yt(n);let e="";for(let t=0;t<n.length;t++)e+=Ie[n[t]];return e}function wt(n){const e=n.toString(16);return e.length&1?"0"+e:e}function Zt(n){if(typeof n!="string")throw new Error("hex string expected, got "+typeof n);return n===""?Ct:BigInt("0x"+n)}const D={_0:48,_9:57,A:65,F:70,a:97,f:102};function jt(n){if(n>=D._0&&n<=D._9)return n-D._0;if(n>=D.A&&n<=D.F)return n-(D.A-10);if(n>=D.a&&n<=D.f)return n-(D.a-10)}function pt(n){if(typeof n!="string")throw new Error("hex string expected, got "+typeof n);const e=n.length,t=e/2;if(e%2)throw new Error("hex string expected, got unpadded hex of length "+e);const r=new Uint8Array(t);for(let o=0,s=0;o<t;o++,s+=2){const c=jt(n.charCodeAt(s)),f=jt(n.charCodeAt(s+1));if(c===void 0||f===void 0){const i=n[s]+n[s+1];throw new Error('hex string expected, got non-hex character "'+i+'" at index '+s)}r[o]=c*16+f}return r}function rt(n){return Zt(ut(n))}function Rt(n){return yt(n),Zt(ut(Uint8Array.from(n).reverse()))}function lt(n,e){return pt(n.toString(16).padStart(e*2,"0"))}function Mt(n,e){return lt(n,e).reverse()}function K(n,e,t){let r;if(typeof e=="string")try{r=pt(e)}catch(s){throw new Error(n+" must be hex string or Uint8Array, cause: "+s)}else if(it(e))r=Uint8Array.from(e);else throw new Error(n+" must be hex string or Uint8Array");const o=r.length;if(typeof t=="number"&&o!==t)throw new Error(n+" of length "+t+" expected, got "+o);return r}function bt(...n){let e=0;for(let r=0;r<n.length;r++){const o=n[r];yt(o),e+=o.length}const t=new Uint8Array(e);for(let r=0,o=0;r<n.length;r++){const s=n[r];t.set(s,o),o+=s.length}return t}const It=n=>typeof n=="bigint"&&Ct<=n;function Bt(n,e,t){return It(n)&&It(e)&&It(t)&&e<=n&&n<t}function ot(n,e,t,r){if(!Bt(e,t,r))throw new Error("expected valid "+n+": "+t+" <= n < "+r+", got "+e)}function te(n){let e;for(e=0;n>Ct;n>>=Jt,e+=1);return e}const Vt=n=>(Ae<<BigInt(n-1))-Jt,Nt=n=>new Uint8Array(n),Yt=n=>Uint8Array.from(n);function ee(n,e,t){if(typeof n!="number"||n<2)throw new Error("hashLen must be a number");if(typeof e!="number"||e<2)throw new Error("qByteLen must be a number");if(typeof t!="function")throw new Error("hmacFn must be a function");let r=Nt(n),o=Nt(n),s=0;const c=()=>{r.fill(1),o.fill(0),s=0},f=(...h)=>t(o,r,...h),i=(h=Nt())=>{o=f(Yt([0]),h),r=f(),h.length!==0&&(o=f(Yt([1]),h),r=f())},u=()=>{if(s++>=1e3)throw new Error("drbg: tried 1000 values");let h=0;const l=[];for(;h<e;){r=f();const m=r.slice();l.push(m),h+=r.length}return bt(...l)};return(h,l)=>{c(),i(h);let m;for(;!(m=l(u()));)i();return c(),m}}const Ne={bigint:n=>typeof n=="bigint",function:n=>typeof n=="function",boolean:n=>typeof n=="boolean",string:n=>typeof n=="string",stringOrUint8Array:n=>typeof n=="string"||it(n),isSafeInteger:n=>Number.isSafeInteger(n),array:n=>Array.isArray(n),field:(n,e)=>e.Fp.isValid(n),hash:n=>typeof n=="function"&&Number.isSafeInteger(n.outputLen)};function mt(n,e,t={}){const r=(o,s,c)=>{const f=Ne[s];if(typeof f!="function")throw new Error("invalid validator function");const i=n[o];if(!(c&&i===void 0)&&!f(i,n))throw new Error("param "+String(o)+" is invalid. Expected "+s+", got "+i)};for(const[o,s]of Object.entries(e))r(o,s,!1);for(const[o,s]of Object.entries(t))r(o,s,!0);return n}function Ut(n){const e=new WeakMap;return(t,...r)=>{const o=e.get(t);if(o!==void 0)return o;const s=n(t,...r);return e.set(t,s),s}}const qe=Object.freeze(Object.defineProperty({__proto__:null,aInRange:ot,abool:at,abytes:yt,bitLen:te,bitMask:Vt,bytesToHex:ut,bytesToNumberBE:rt,bytesToNumberLE:Rt,concatBytes:bt,createHmacDrbg:ee,ensureBytes:K,hexToBytes:pt,hexToNumber:Zt,inRange:Bt,isBytes:it,memoized:Ut,numberToBytesBE:lt,numberToBytesLE:Mt,numberToHexUnpadded:wt,validateObject:mt},Symbol.toStringTag,{value:"Module"}));class ne extends Xt{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,ge(e);const r=Qt(t);if(this.iHash=e.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const o=this.blockLen,s=new Uint8Array(o);s.set(r.length>o?e.create().update(r).digest():r);for(let c=0;c<s.length;c++)s[c]^=54;this.iHash.update(s),this.oHash=e.create();for(let c=0;c<s.length;c++)s[c]^=106;this.oHash.update(s),s.fill(0)}update(e){return Et(this),this.iHash.update(e),this}digestInto(e){Et(this),we(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){const e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||(e=Object.create(Object.getPrototypeOf(this),{}));const{oHash:t,iHash:r,finished:o,destroyed:s,blockLen:c,outputLen:f}=this;return e=e,e.finished=o,e.destroyed=s,e.blockLen=c,e.outputLen=f,e.oHash=t._cloneInto(e.oHash),e.iHash=r._cloneInto(e.iHash),e}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const re=(n,e,t)=>new ne(n,e).update(t).digest();re.create=(n,e)=>new ne(n,e);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const z=BigInt(0),_=BigInt(1),nt=BigInt(2),Oe=BigInt(3),_t=BigInt(4),Ft=BigInt(5),Kt=BigInt(8);function V(n,e){const t=n%e;return t>=z?t:e+t}function Le(n,e,t){if(e<z)throw new Error("invalid exponent, negatives unsupported");if(t<=z)throw new Error("invalid modulus");if(t===_)return z;let r=_;for(;e>z;)e&_&&(r=r*n%t),n=n*n%t,e>>=_;return r}function Y(n,e,t){let r=n;for(;e-- >z;)r*=r,r%=t;return r}function Tt(n,e){if(n===z)throw new Error("invert: expected non-zero number");if(e<=z)throw new Error("invert: expected positive modulus, got "+e);let t=V(n,e),r=e,o=z,s=_;for(;t!==z;){const f=r/t,i=r%t,u=o-s*f;r=t,t=i,o=s,s=u}if(r!==_)throw new Error("invert: does not exist");return V(o,e)}function He(n){const e=(n-_)/nt;let t,r,o;for(t=n-_,r=0;t%nt===z;t/=nt,r++);for(o=nt;o<n&&Le(o,e,n)!==n-_;o++)if(o>1e3)throw new Error("Cannot find square root: likely non-prime P");if(r===1){const c=(n+_)/_t;return function(i,u){const y=i.pow(u,c);if(!i.eql(i.sqr(y),u))throw new Error("Cannot find square root");return y}}const s=(t+_)/nt;return function(f,i){if(f.pow(i,e)===f.neg(f.ONE))throw new Error("Cannot find square root");let u=r,y=f.pow(f.mul(f.ONE,o),t),h=f.pow(i,s),l=f.pow(i,t);for(;!f.eql(l,f.ONE);){if(f.eql(l,f.ZERO))return f.ZERO;let m=1;for(let b=f.sqr(l);m<u&&!f.eql(b,f.ONE);m++)b=f.sqr(b);const N=f.pow(y,_<<BigInt(u-m-1));y=f.sqr(N),h=f.mul(h,N),l=f.mul(l,y),u=m}return h}}function Ue(n){if(n%_t===Oe){const e=(n+_)/_t;return function(r,o){const s=r.pow(o,e);if(!r.eql(r.sqr(s),o))throw new Error("Cannot find square root");return s}}if(n%Kt===Ft){const e=(n-Ft)/Kt;return function(r,o){const s=r.mul(o,nt),c=r.pow(s,e),f=r.mul(o,c),i=r.mul(r.mul(f,nt),c),u=r.mul(f,r.sub(i,r.ONE));if(!r.eql(r.sqr(u),o))throw new Error("Cannot find square root");return u}}return He(n)}const _e=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Te(n){const e={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},t=_e.reduce((r,o)=>(r[o]="function",r),e);return mt(n,t)}function ke(n,e,t){if(t<z)throw new Error("invalid exponent, negatives unsupported");if(t===z)return n.ONE;if(t===_)return e;let r=n.ONE,o=e;for(;t>z;)t&_&&(r=n.mul(r,o)),o=n.sqr(o),t>>=_;return r}function ze(n,e){const t=new Array(e.length),r=e.reduce((s,c,f)=>n.is0(c)?s:(t[f]=s,n.mul(s,c)),n.ONE),o=n.inv(r);return e.reduceRight((s,c,f)=>n.is0(c)?s:(t[f]=n.mul(s,t[f]),n.mul(s,c)),o),t}function oe(n,e){const t=e!==void 0?e:n.toString(2).length,r=Math.ceil(t/8);return{nBitLength:t,nByteLength:r}}function ie(n,e,t=!1,r={}){if(n<=z)throw new Error("invalid field: expected ORDER > 0, got "+n);const{nBitLength:o,nByteLength:s}=oe(n,e);if(s>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let c;const f=Object.freeze({ORDER:n,isLE:t,BITS:o,BYTES:s,MASK:Vt(o),ZERO:z,ONE:_,create:i=>V(i,n),isValid:i=>{if(typeof i!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof i);return z<=i&&i<n},is0:i=>i===z,isOdd:i=>(i&_)===_,neg:i=>V(-i,n),eql:(i,u)=>i===u,sqr:i=>V(i*i,n),add:(i,u)=>V(i+u,n),sub:(i,u)=>V(i-u,n),mul:(i,u)=>V(i*u,n),pow:(i,u)=>ke(f,i,u),div:(i,u)=>V(i*Tt(u,n),n),sqrN:i=>i*i,addN:(i,u)=>i+u,subN:(i,u)=>i-u,mulN:(i,u)=>i*u,inv:i=>Tt(i,n),sqrt:r.sqrt||(i=>(c||(c=Ue(n)),c(f,i))),invertBatch:i=>ze(f,i),cmov:(i,u,y)=>y?u:i,toBytes:i=>t?Mt(i,s):lt(i,s),fromBytes:i=>{if(i.length!==s)throw new Error("Field.fromBytes: expected "+s+" bytes, got "+i.length);return t?Rt(i):rt(i)}});return Object.freeze(f)}function se(n){if(typeof n!="bigint")throw new Error("field order must be bigint");const e=n.toString(2).length;return Math.ceil(e/8)}function ce(n){const e=se(n);return e+Math.ceil(e/2)}function Ce(n,e,t=!1){const r=n.length,o=se(e),s=ce(e);if(r<16||r<s||r>1024)throw new Error("expected "+s+"-1024 bytes of input, got "+r);const c=t?Rt(n):rt(n),f=V(c,e-_)+_;return t?Mt(f,o):lt(f,o)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Pt=BigInt(0),xt=BigInt(1);function qt(n,e){const t=e.negate();return n?t:e}function fe(n,e){if(!Number.isSafeInteger(n)||n<=0||n>e)throw new Error("invalid window size, expected [1.."+e+"], got W="+n)}function Ot(n,e){fe(n,e);const t=Math.ceil(e/n)+1,r=2**(n-1);return{windows:t,windowSize:r}}function Ze(n,e){if(!Array.isArray(n))throw new Error("array expected");n.forEach((t,r)=>{if(!(t instanceof e))throw new Error("invalid point at index "+r)})}function Re(n,e){if(!Array.isArray(n))throw new Error("array of scalars expected");n.forEach((t,r)=>{if(!e.isValid(t))throw new Error("invalid scalar at index "+r)})}const Lt=new WeakMap,ae=new WeakMap;function Ht(n){return ae.get(n)||1}function Me(n,e){return{constTimeNegate:qt,hasPrecomputes(t){return Ht(t)!==1},unsafeLadder(t,r,o=n.ZERO){let s=t;for(;r>Pt;)r&xt&&(o=o.add(s)),s=s.double(),r>>=xt;return o},precomputeWindow(t,r){const{windows:o,windowSize:s}=Ot(r,e),c=[];let f=t,i=f;for(let u=0;u<o;u++){i=f,c.push(i);for(let y=1;y<s;y++)i=i.add(f),c.push(i);f=i.double()}return c},wNAF(t,r,o){const{windows:s,windowSize:c}=Ot(t,e);let f=n.ZERO,i=n.BASE;const u=BigInt(2**t-1),y=2**t,h=BigInt(t);for(let l=0;l<s;l++){const m=l*c;let N=Number(o&u);o>>=h,N>c&&(N-=y,o+=xt);const b=m,a=m+Math.abs(N)-1,g=l%2!==0,x=N<0;N===0?i=i.add(qt(g,r[b])):f=f.add(qt(x,r[a]))}return{p:f,f:i}},wNAFUnsafe(t,r,o,s=n.ZERO){const{windows:c,windowSize:f}=Ot(t,e),i=BigInt(2**t-1),u=2**t,y=BigInt(t);for(let h=0;h<c;h++){const l=h*f;if(o===Pt)break;let m=Number(o&i);if(o>>=y,m>f&&(m-=u,o+=xt),m===0)continue;let N=r[l+Math.abs(m)-1];m<0&&(N=N.negate()),s=s.add(N)}return s},getPrecomputes(t,r,o){let s=Lt.get(r);return s||(s=this.precomputeWindow(r,t),t!==1&&Lt.set(r,o(s))),s},wNAFCached(t,r,o){const s=Ht(t);return this.wNAF(s,this.getPrecomputes(s,t,o),r)},wNAFCachedUnsafe(t,r,o,s){const c=Ht(t);return c===1?this.unsafeLadder(t,r,s):this.wNAFUnsafe(c,this.getPrecomputes(c,t,o),r,s)},setWindowSize(t,r){fe(r,e),ae.set(t,r),Lt.delete(t)}}}function Ve(n,e,t,r){if(Ze(t,n),Re(r,e),t.length!==r.length)throw new Error("arrays of points and scalars must have equal length");const o=n.ZERO,s=te(BigInt(t.length)),c=s>12?s-3:s>4?s-2:s?2:1,f=(1<<c)-1,i=new Array(f+1).fill(o),u=Math.floor((e.BITS-1)/c)*c;let y=o;for(let h=u;h>=0;h-=c){i.fill(o);for(let m=0;m<r.length;m++){const N=r[m],b=Number(N>>BigInt(h)&BigInt(f));i[b]=i[b].add(t[m])}let l=o;for(let m=i.length-1,N=o;m>0;m--)N=N.add(i[m]),l=l.add(N);if(y=y.add(l),h!==0)for(let m=0;m<c;m++)y=y.double()}return y}function ue(n){return Te(n.Fp),mt(n,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...oe(n.n,n.nBitLength),...n,p:n.Fp.ORDER})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function Gt(n){n.lowS!==void 0&&at("lowS",n.lowS),n.prehash!==void 0&&at("prehash",n.prehash)}function je(n){const e=ue(n);mt(e,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:t,Fp:r,a:o}=e;if(t){if(!r.eql(o,r.ZERO))throw new Error("invalid endomorphism, can only be defined for Koblitz curves that have a=0");if(typeof t!="object"||typeof t.beta!="bigint"||typeof t.splitScalar!="function")throw new Error("invalid endomorphism, expected beta: bigint and splitScalar: function")}return Object.freeze({...e})}const{bytesToNumberBE:Ye,hexToBytes:Fe}=qe;class Ke extends Error{constructor(e=""){super(e)}}const $={Err:Ke,_tlv:{encode:(n,e)=>{const{Err:t}=$;if(n<0||n>256)throw new t("tlv.encode: wrong tag");if(e.length&1)throw new t("tlv.encode: unpadded data");const r=e.length/2,o=wt(r);if(o.length/2&128)throw new t("tlv.encode: long form length too big");const s=r>127?wt(o.length/2|128):"";return wt(n)+s+o+e},decode(n,e){const{Err:t}=$;let r=0;if(n<0||n>256)throw new t("tlv.encode: wrong tag");if(e.length<2||e[r++]!==n)throw new t("tlv.decode: wrong tlv");const o=e[r++],s=!!(o&128);let c=0;if(!s)c=o;else{const i=o&127;if(!i)throw new t("tlv.decode(long): indefinite length not supported");if(i>4)throw new t("tlv.decode(long): byte length is too big");const u=e.subarray(r,r+i);if(u.length!==i)throw new t("tlv.decode: length bytes not complete");if(u[0]===0)throw new t("tlv.decode(long): zero leftmost byte");for(const y of u)c=c<<8|y;if(r+=i,c<128)throw new t("tlv.decode(long): not minimal encoding")}const f=e.subarray(r,r+c);if(f.length!==c)throw new t("tlv.decode: wrong value length");return{v:f,l:e.subarray(r+c)}}},_int:{encode(n){const{Err:e}=$;if(n<W)throw new e("integer: negative integers are not allowed");let t=wt(n);if(Number.parseInt(t[0],16)&8&&(t="00"+t),t.length&1)throw new e("unexpected DER parsing assertion: unpadded hex");return t},decode(n){const{Err:e}=$;if(n[0]&128)throw new e("invalid signature integer: negative");if(n[0]===0&&!(n[1]&128))throw new e("invalid signature integer: unnecessary leading zero");return Ye(n)}},toSig(n){const{Err:e,_int:t,_tlv:r}=$,o=typeof n=="string"?Fe(n):n;yt(o);const{v:s,l:c}=r.decode(48,o);if(c.length)throw new e("invalid signature: left bytes after parsing");const{v:f,l:i}=r.decode(2,s),{v:u,l:y}=r.decode(2,i);if(y.length)throw new e("invalid signature: left bytes after parsing");return{r:t.decode(f),s:t.decode(u)}},hexFromSig(n){const{_tlv:e,_int:t}=$,r=e.encode(2,t.encode(n.r)),o=e.encode(2,t.encode(n.s)),s=r+o;return e.encode(48,s)}},W=BigInt(0),k=BigInt(1);BigInt(2);const Dt=BigInt(3);BigInt(4);function Pe(n){const e=je(n),{Fp:t}=e,r=ie(e.n,e.nBitLength),o=e.toBytes||((b,a,g)=>{const x=a.toAffine();return bt(Uint8Array.from([4]),t.toBytes(x.x),t.toBytes(x.y))}),s=e.fromBytes||(b=>{const a=b.subarray(1),g=t.fromBytes(a.subarray(0,t.BYTES)),x=t.fromBytes(a.subarray(t.BYTES,2*t.BYTES));return{x:g,y:x}});function c(b){const{a,b:g}=e,x=t.sqr(b),E=t.mul(x,b);return t.add(t.add(E,t.mul(b,a)),g)}if(!t.eql(t.sqr(e.Gy),c(e.Gx)))throw new Error("bad generator point: equation left != right");function f(b){return Bt(b,k,e.n)}function i(b){const{allowedPrivateKeyLengths:a,nByteLength:g,wrapPrivateKey:x,n:E}=e;if(a&&typeof b!="bigint"){if(it(b)&&(b=ut(b)),typeof b!="string"||!a.includes(b.length))throw new Error("invalid private key");b=b.padStart(g*2,"0")}let q;try{q=typeof b=="bigint"?b:rt(K("private key",b,g))}catch{throw new Error("invalid private key, expected hex or "+g+" bytes, got "+typeof b)}return x&&(q=V(q,E)),ot("private key",q,k,E),q}function u(b){if(!(b instanceof l))throw new Error("ProjectivePoint expected")}const y=Ut((b,a)=>{const{px:g,py:x,pz:E}=b;if(t.eql(E,t.ONE))return{x:g,y:x};const q=b.is0();a==null&&(a=q?t.ONE:t.inv(E));const L=t.mul(g,a),I=t.mul(x,a),B=t.mul(E,a);if(q)return{x:t.ZERO,y:t.ZERO};if(!t.eql(B,t.ONE))throw new Error("invZ was invalid");return{x:L,y:I}}),h=Ut(b=>{if(b.is0()){if(e.allowInfinityPoint&&!t.is0(b.py))return;throw new Error("bad point: ZERO")}const{x:a,y:g}=b.toAffine();if(!t.isValid(a)||!t.isValid(g))throw new Error("bad point: x or y not FE");const x=t.sqr(g),E=c(a);if(!t.eql(x,E))throw new Error("bad point: equation left != right");if(!b.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});class l{constructor(a,g,x){if(this.px=a,this.py=g,this.pz=x,a==null||!t.isValid(a))throw new Error("x required");if(g==null||!t.isValid(g))throw new Error("y required");if(x==null||!t.isValid(x))throw new Error("z required");Object.freeze(this)}static fromAffine(a){const{x:g,y:x}=a||{};if(!a||!t.isValid(g)||!t.isValid(x))throw new Error("invalid affine point");if(a instanceof l)throw new Error("projective point not allowed");const E=q=>t.eql(q,t.ZERO);return E(g)&&E(x)?l.ZERO:new l(g,x,t.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(a){const g=t.invertBatch(a.map(x=>x.pz));return a.map((x,E)=>x.toAffine(g[E])).map(l.fromAffine)}static fromHex(a){const g=l.fromAffine(s(K("pointHex",a)));return g.assertValidity(),g}static fromPrivateKey(a){return l.BASE.multiply(i(a))}static msm(a,g){return Ve(l,r,a,g)}_setWindowSize(a){N.setWindowSize(this,a)}assertValidity(){h(this)}hasEvenY(){const{y:a}=this.toAffine();if(t.isOdd)return!t.isOdd(a);throw new Error("Field doesn't support isOdd")}equals(a){u(a);const{px:g,py:x,pz:E}=this,{px:q,py:L,pz:I}=a,B=t.eql(t.mul(g,I),t.mul(q,E)),A=t.eql(t.mul(x,I),t.mul(L,E));return B&&A}negate(){return new l(this.px,t.neg(this.py),this.pz)}double(){const{a,b:g}=e,x=t.mul(g,Dt),{px:E,py:q,pz:L}=this;let I=t.ZERO,B=t.ZERO,A=t.ZERO,v=t.mul(E,E),C=t.mul(q,q),U=t.mul(L,L),H=t.mul(E,q);return H=t.add(H,H),A=t.mul(E,L),A=t.add(A,A),I=t.mul(a,A),B=t.mul(x,U),B=t.add(I,B),I=t.sub(C,B),B=t.add(C,B),B=t.mul(I,B),I=t.mul(H,I),A=t.mul(x,A),U=t.mul(a,U),H=t.sub(v,U),H=t.mul(a,H),H=t.add(H,A),A=t.add(v,v),v=t.add(A,v),v=t.add(v,U),v=t.mul(v,H),B=t.add(B,v),U=t.mul(q,L),U=t.add(U,U),v=t.mul(U,H),I=t.sub(I,v),A=t.mul(U,C),A=t.add(A,A),A=t.add(A,A),new l(I,B,A)}add(a){u(a);const{px:g,py:x,pz:E}=this,{px:q,py:L,pz:I}=a;let B=t.ZERO,A=t.ZERO,v=t.ZERO;const C=e.a,U=t.mul(e.b,Dt);let H=t.mul(g,q),j=t.mul(x,L),d=t.mul(E,I),w=t.add(g,x),p=t.add(q,L);w=t.mul(w,p),p=t.add(H,j),w=t.sub(w,p),p=t.add(g,E);let S=t.add(q,I);return p=t.mul(p,S),S=t.add(H,d),p=t.sub(p,S),S=t.add(x,E),B=t.add(L,I),S=t.mul(S,B),B=t.add(j,d),S=t.sub(S,B),v=t.mul(C,p),B=t.mul(U,d),v=t.add(B,v),B=t.sub(j,v),v=t.add(j,v),A=t.mul(B,v),j=t.add(H,H),j=t.add(j,H),d=t.mul(C,d),p=t.mul(U,p),j=t.add(j,d),d=t.sub(H,d),d=t.mul(C,d),p=t.add(p,d),H=t.mul(j,p),A=t.add(A,H),H=t.mul(S,p),B=t.mul(w,B),B=t.sub(B,H),H=t.mul(w,j),v=t.mul(S,v),v=t.add(v,H),new l(B,A,v)}subtract(a){return this.add(a.negate())}is0(){return this.equals(l.ZERO)}wNAF(a){return N.wNAFCached(this,a,l.normalizeZ)}multiplyUnsafe(a){const{endo:g,n:x}=e;ot("scalar",a,W,x);const E=l.ZERO;if(a===W)return E;if(this.is0()||a===k)return this;if(!g||N.hasPrecomputes(this))return N.wNAFCachedUnsafe(this,a,l.normalizeZ);let{k1neg:q,k1:L,k2neg:I,k2:B}=g.splitScalar(a),A=E,v=E,C=this;for(;L>W||B>W;)L&k&&(A=A.add(C)),B&k&&(v=v.add(C)),C=C.double(),L>>=k,B>>=k;return q&&(A=A.negate()),I&&(v=v.negate()),v=new l(t.mul(v.px,g.beta),v.py,v.pz),A.add(v)}multiply(a){const{endo:g,n:x}=e;ot("scalar",a,k,x);let E,q;if(g){const{k1neg:L,k1:I,k2neg:B,k2:A}=g.splitScalar(a);let{p:v,f:C}=this.wNAF(I),{p:U,f:H}=this.wNAF(A);v=N.constTimeNegate(L,v),U=N.constTimeNegate(B,U),U=new l(t.mul(U.px,g.beta),U.py,U.pz),E=v.add(U),q=C.add(H)}else{const{p:L,f:I}=this.wNAF(a);E=L,q=I}return l.normalizeZ([E,q])[0]}multiplyAndAddUnsafe(a,g,x){const E=l.BASE,q=(I,B)=>B===W||B===k||!I.equals(E)?I.multiplyUnsafe(B):I.multiply(B),L=q(this,g).add(q(a,x));return L.is0()?void 0:L}toAffine(a){return y(this,a)}isTorsionFree(){const{h:a,isTorsionFree:g}=e;if(a===k)return!0;if(g)return g(l,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:a,clearCofactor:g}=e;return a===k?this:g?g(l,this):this.multiplyUnsafe(e.h)}toRawBytes(a=!0){return at("isCompressed",a),this.assertValidity(),o(l,this,a)}toHex(a=!0){return at("isCompressed",a),ut(this.toRawBytes(a))}}l.BASE=new l(e.Gx,e.Gy,t.ONE),l.ZERO=new l(t.ZERO,t.ONE,t.ZERO);const m=e.nBitLength,N=Me(l,e.endo?Math.ceil(m/2):m);return{CURVE:e,ProjectivePoint:l,normPrivateKeyToScalar:i,weierstrassEquation:c,isWithinCurveOrder:f}}function Ge(n){const e=ue(n);return mt(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}function De(n){const e=Ge(n),{Fp:t,n:r}=e,o=t.BYTES+1,s=2*t.BYTES+1;function c(d){return V(d,r)}function f(d){return Tt(d,r)}const{ProjectivePoint:i,normPrivateKeyToScalar:u,weierstrassEquation:y,isWithinCurveOrder:h}=Pe({...e,toBytes(d,w,p){const S=w.toAffine(),O=t.toBytes(S.x),T=bt;return at("isCompressed",p),p?T(Uint8Array.from([w.hasEvenY()?2:3]),O):T(Uint8Array.from([4]),O,t.toBytes(S.y))},fromBytes(d){const w=d.length,p=d[0],S=d.subarray(1);if(w===o&&(p===2||p===3)){const O=rt(S);if(!Bt(O,k,t.ORDER))throw new Error("Point is not on curve");const T=y(O);let R;try{R=t.sqrt(T)}catch(F){const M=F instanceof Error?": "+F.message:"";throw new Error("Point is not on curve"+M)}const Z=(R&k)===k;return(p&1)===1!==Z&&(R=t.neg(R)),{x:O,y:R}}else if(w===s&&p===4){const O=t.fromBytes(S.subarray(0,t.BYTES)),T=t.fromBytes(S.subarray(t.BYTES,2*t.BYTES));return{x:O,y:T}}else{const O=o,T=s;throw new Error("invalid Point, expected length of "+O+", or uncompressed "+T+", got "+w)}}}),l=d=>ut(lt(d,e.nByteLength));function m(d){const w=r>>k;return d>w}function N(d){return m(d)?c(-d):d}const b=(d,w,p)=>rt(d.slice(w,p));class a{constructor(w,p,S){this.r=w,this.s=p,this.recovery=S,this.assertValidity()}static fromCompact(w){const p=e.nByteLength;return w=K("compactSignature",w,p*2),new a(b(w,0,p),b(w,p,2*p))}static fromDER(w){const{r:p,s:S}=$.toSig(K("DER",w));return new a(p,S)}assertValidity(){ot("r",this.r,k,r),ot("s",this.s,k,r)}addRecoveryBit(w){return new a(this.r,this.s,w)}recoverPublicKey(w){const{r:p,s:S,recovery:O}=this,T=I(K("msgHash",w));if(O==null||![0,1,2,3].includes(O))throw new Error("recovery id invalid");const R=O===2||O===3?p+e.n:p;if(R>=t.ORDER)throw new Error("recovery id 2 or 3 invalid");const Z=(O&1)===0?"02":"03",G=i.fromHex(Z+l(R)),F=f(R),M=c(-T*F),st=c(S*F),X=i.BASE.multiplyAndAddUnsafe(G,M,st);if(!X)throw new Error("point at infinify");return X.assertValidity(),X}hasHighS(){return m(this.s)}normalizeS(){return this.hasHighS()?new a(this.r,c(-this.s),this.recovery):this}toDERRawBytes(){return pt(this.toDERHex())}toDERHex(){return $.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return pt(this.toCompactHex())}toCompactHex(){return l(this.r)+l(this.s)}}const g={isValidPrivateKey(d){try{return u(d),!0}catch{return!1}},normPrivateKeyToScalar:u,randomPrivateKey:()=>{const d=ce(e.n);return Ce(e.randomBytes(d),e.n)},precompute(d=8,w=i.BASE){return w._setWindowSize(d),w.multiply(BigInt(3)),w}};function x(d,w=!0){return i.fromPrivateKey(d).toRawBytes(w)}function E(d){const w=it(d),p=typeof d=="string",S=(w||p)&&d.length;return w?S===o||S===s:p?S===2*o||S===2*s:d instanceof i}function q(d,w,p=!0){if(E(d))throw new Error("first arg must be private key");if(!E(w))throw new Error("second arg must be public key");return i.fromHex(w).multiply(u(d)).toRawBytes(p)}const L=e.bits2int||function(d){if(d.length>8192)throw new Error("input is too large");const w=rt(d),p=d.length*8-e.nBitLength;return p>0?w>>BigInt(p):w},I=e.bits2int_modN||function(d){return c(L(d))},B=Vt(e.nBitLength);function A(d){return ot("num < 2^"+e.nBitLength,d,W,B),lt(d,e.nByteLength)}function v(d,w,p=C){if(["recovered","canonical"].some(tt=>tt in p))throw new Error("sign() legacy options not supported");const{hash:S,randomBytes:O}=e;let{lowS:T,prehash:R,extraEntropy:Z}=p;T==null&&(T=!0),d=K("msgHash",d),Gt(p),R&&(d=K("prehashed msgHash",S(d)));const G=I(d),F=u(w),M=[A(F),A(G)];if(Z!=null&&Z!==!1){const tt=Z===!0?O(t.BYTES):Z;M.push(K("extraEntropy",tt))}const st=bt(...M),X=G;function vt(tt){const ct=L(tt);if(!h(ct))return;const St=f(ct),dt=i.BASE.multiply(ct).toAffine(),et=c(dt.x);if(et===W)return;const ht=c(St*c(X+et*F));if(ht===W)return;let gt=(dt.x===et?0:2)|Number(dt.y&k),ft=ht;return T&&m(ht)&&(ft=N(ht),gt^=1),new a(et,ft,gt)}return{seed:st,k2sig:vt}}const C={lowS:e.lowS,prehash:!1},U={lowS:e.lowS,prehash:!1};function H(d,w,p=C){const{seed:S,k2sig:O}=v(d,w,p),T=e;return ee(T.hash.outputLen,T.nByteLength,T.hmac)(S,O)}i.BASE._setWindowSize(8);function j(d,w,p,S=U){var gt;const O=d;w=K("msgHash",w),p=K("publicKey",p);const{lowS:T,prehash:R,format:Z}=S;if(Gt(S),"strict"in S)throw new Error("options.strict was renamed to lowS");if(Z!==void 0&&Z!=="compact"&&Z!=="der")throw new Error("format must be compact or der");const G=typeof O=="string"||it(O),F=!G&&!Z&&typeof O=="object"&&O!==null&&typeof O.r=="bigint"&&typeof O.s=="bigint";if(!G&&!F)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");let M,st;try{if(F&&(M=new a(O.r,O.s)),G){try{Z!=="compact"&&(M=a.fromDER(O))}catch(ft){if(!(ft instanceof $.Err))throw ft}!M&&Z!=="der"&&(M=a.fromCompact(O))}st=i.fromHex(p)}catch{return!1}if(!M||T&&M.hasHighS())return!1;R&&(w=e.hash(w));const{r:X,s:vt}=M,tt=I(w),ct=f(vt),St=c(tt*ct),dt=c(X*ct),et=(gt=i.BASE.multiplyAndAddUnsafe(st,St,dt))==null?void 0:gt.toAffine();return et?c(et.x)===X:!1}return{CURVE:e,getPublicKey:x,getSharedSecret:q,sign:H,verify:j,ProjectivePoint:i,Signature:a,utils:g}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function $e(n){return{hash:n,hmac:(e,...t)=>re(n,e,be(...t)),randomBytes:pe}}function We(n,e){const t=r=>De({...n,...$e(r)});return{...t(e),create:t}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const le=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),$t=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),Xe=BigInt(1),kt=BigInt(2),Wt=(n,e)=>(n+e/kt)/e;function Qe(n){const e=le,t=BigInt(3),r=BigInt(6),o=BigInt(11),s=BigInt(22),c=BigInt(23),f=BigInt(44),i=BigInt(88),u=n*n*n%e,y=u*u*n%e,h=Y(y,t,e)*y%e,l=Y(h,t,e)*y%e,m=Y(l,kt,e)*u%e,N=Y(m,o,e)*m%e,b=Y(N,s,e)*N%e,a=Y(b,f,e)*b%e,g=Y(a,i,e)*a%e,x=Y(g,f,e)*b%e,E=Y(x,t,e)*y%e,q=Y(E,c,e)*N%e,L=Y(q,r,e)*u%e,I=Y(L,kt,e);if(!zt.eql(zt.sqr(I),n))throw new Error("Cannot find square root");return I}const zt=ie(le,void 0,void 0,{sqrt:Qe}),Je=We({a:BigInt(0),b:BigInt(7),Fp:zt,n:$t,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:n=>{const e=$t,t=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-Xe*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),o=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),s=t,c=BigInt("0x100000000000000000000000000000000"),f=Wt(s*n,e),i=Wt(-r*n,e);let u=V(n-f*t-i*o,e),y=V(-f*r-i*s,e);const h=u>c,l=y>c;if(h&&(u=e-u),l&&(y=e-y),u>c||y>c)throw new Error("splitScalar: Endomorphism failed, k="+n);return{k1neg:h,k1:u,k2neg:l,k2:y}}}},Se);BigInt(0);Je.ProjectivePoint;export{Je as secp256k1};
@@ -1 +0,0 @@
1
- import{H as Qt,y as At,z as mt,A as Jt,C as te,E as ye,G as bt,I as xe,J as G,L as Ee,M as Be,O as ve,Q as Se}from"./wallets-CdPPQGkU.js";import"./signing-CjtnBxxM.js";import"./utils-DmMVfaK5.js";import"./ethers-D-4WUfRB.js";import"./react-iAgwec9M.js";import"./index-C1zw_jvz.js";import"./store-CraP4F4Y.js";import"./hashTypedData-CHOppTRC.js";import"./index-pgfSp-jn.js";import"./index-Bc_XrzTG.js";import"./index-BQkCy5n9.js";import"./index-nibyPLVP.js";import"./index-CJdot1dH.js";import"./index-BPH4bq6L.js";import"./ethereum-CfGZ1o2B.js";function Ae(n,e,t,r){if(typeof n.setBigUint64=="function")return n.setBigUint64(e,t,r);const i=BigInt(32),s=BigInt(4294967295),c=Number(t>>i&s),f=Number(t&s),o=r?4:0,l=r?0:4;n.setUint32(e+o,c,r),n.setUint32(e+l,f,r)}function Ie(n,e,t){return n&e^~n&t}function Ne(n,e,t){return n&e^n&t^e&t}class Oe extends Qt{constructor(e,t,r,i){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=i,this.buffer=new Uint8Array(e),this.view=At(this.buffer)}update(e){mt(this),e=Jt(e),te(e);const{view:t,buffer:r,blockLen:i}=this,s=e.length;for(let c=0;c<s;){const f=Math.min(i-this.pos,s-c);if(f===i){const o=At(e);for(;i<=s-c;c+=i)this.process(o,c);continue}r.set(e.subarray(c,c+f),this.pos),this.pos+=f,c+=f,this.pos===i&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){mt(this),ye(e,this),this.finished=!0;const{buffer:t,view:r,blockLen:i,isLE:s}=this;let{pos:c}=this;t[c++]=128,bt(this.buffer.subarray(c)),this.padOffset>i-c&&(this.process(r,0),c=0);for(let h=c;h<i;h++)t[h]=0;Ae(r,i-8,BigInt(this.length*8),s),this.process(r,0);const f=At(e),o=this.outputLen;if(o%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const l=o/4,g=this.get();if(l>g.length)throw new Error("_sha2: outputLen bigger than state");for(let h=0;h<l;h++)f.setUint32(4*h,g[h],s)}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const r=e.slice(0,t);return this.destroy(),r}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:t,buffer:r,length:i,finished:s,destroyed:c,pos:f}=this;return e.destroyed=c,e.finished=s,e.length=i,e.pos=f,i%t&&e.buffer.set(r),e}clone(){return this._cloneInto()}}const J=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),qe=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]),tt=new Uint32Array(64);class He extends Oe{constructor(e=32){super(64,e,8,!1),this.A=J[0]|0,this.B=J[1]|0,this.C=J[2]|0,this.D=J[3]|0,this.E=J[4]|0,this.F=J[5]|0,this.G=J[6]|0,this.H=J[7]|0}get(){const{A:e,B:t,C:r,D:i,E:s,F:c,G:f,H:o}=this;return[e,t,r,i,s,c,f,o]}set(e,t,r,i,s,c,f,o){this.A=e|0,this.B=t|0,this.C=r|0,this.D=i|0,this.E=s|0,this.F=c|0,this.G=f|0,this.H=o|0}process(e,t){for(let h=0;h<16;h++,t+=4)tt[h]=e.getUint32(t,!1);for(let h=16;h<64;h++){const B=tt[h-15],q=tt[h-2],_=G(B,7)^G(B,18)^B>>>3,p=G(q,17)^G(q,19)^q>>>10;tt[h]=p+tt[h-7]+_+tt[h-16]|0}let{A:r,B:i,C:s,D:c,E:f,F:o,G:l,H:g}=this;for(let h=0;h<64;h++){const B=G(f,6)^G(f,11)^G(f,25),q=g+B+Ie(f,o,l)+qe[h]+tt[h]|0,p=(G(r,2)^G(r,13)^G(r,22))+Ne(r,i,s)|0;g=l,l=o,o=f,f=c+q|0,c=s,s=i,i=r,r=q+p|0}r=r+this.A|0,i=i+this.B|0,s=s+this.C|0,c=c+this.D|0,f=f+this.E|0,o=o+this.F|0,l=l+this.G|0,g=g+this.H|0,this.set(r,i,s,c,f,o,l,g)}roundClean(){bt(tt)}destroy(){this.set(0,0,0,0,0,0,0,0),bt(this.buffer)}}const Le=xe(()=>new He);class ee extends Qt{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,Ee(e);const r=Jt(t);if(this.iHash=e.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const i=this.blockLen,s=new Uint8Array(i);s.set(r.length>i?e.create().update(r).digest():r);for(let c=0;c<s.length;c++)s[c]^=54;this.iHash.update(s),this.oHash=e.create();for(let c=0;c<s.length;c++)s[c]^=106;this.oHash.update(s),bt(s)}update(e){return mt(this),this.iHash.update(e),this}digestInto(e){mt(this),te(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){const e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||(e=Object.create(Object.getPrototypeOf(this),{}));const{oHash:t,iHash:r,finished:i,destroyed:s,blockLen:c,outputLen:f}=this;return e=e,e.finished=i,e.destroyed=s,e.blockLen=c,e.outputLen=f,e.oHash=t._cloneInto(e.oHash),e.iHash=r._cloneInto(e.iHash),e}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const ne=(n,e,t)=>new ee(n,e).update(t).digest();ne.create=(n,e)=>new ee(n,e);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Ct=BigInt(0),Rt=BigInt(1);function wt(n){return n instanceof Uint8Array||ArrayBuffer.isView(n)&&n.constructor.name==="Uint8Array"}function Vt(n){if(!wt(n))throw new Error("Uint8Array expected")}function dt(n,e){if(typeof e!="boolean")throw new Error(n+" boolean expected, got "+e)}function pt(n){const e=n.toString(16);return e.length&1?"0"+e:e}function re(n){if(typeof n!="string")throw new Error("hex string expected, got "+typeof n);return n===""?Ct:BigInt("0x"+n)}const oe=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",Ue=Array.from({length:256},(n,e)=>e.toString(16).padStart(2,"0"));function ht(n){if(Vt(n),oe)return n.toHex();let e="";for(let t=0;t<n.length;t++)e+=Ue[n[t]];return e}const $={_0:48,_9:57,A:65,F:70,a:97,f:102};function Yt(n){if(n>=$._0&&n<=$._9)return n-$._0;if(n>=$.A&&n<=$.F)return n-($.A-10);if(n>=$.a&&n<=$.f)return n-($.a-10)}function yt(n){if(typeof n!="string")throw new Error("hex string expected, got "+typeof n);if(oe)return Uint8Array.fromHex(n);const e=n.length,t=e/2;if(e%2)throw new Error("hex string expected, got unpadded hex of length "+e);const r=new Uint8Array(t);for(let i=0,s=0;i<t;i++,s+=2){const c=Yt(n.charCodeAt(s)),f=Yt(n.charCodeAt(s+1));if(c===void 0||f===void 0){const o=n[s]+n[s+1];throw new Error('hex string expected, got non-hex character "'+o+'" at index '+s)}r[i]=c*16+f}return r}function ot(n){return re(ht(n))}function ie(n){return Vt(n),re(ht(Uint8Array.from(n).reverse()))}function gt(n,e){return yt(n.toString(16).padStart(e*2,"0"))}function se(n,e){return gt(n,e).reverse()}function K(n,e,t){let r;if(typeof e=="string")try{r=yt(e)}catch(s){throw new Error(n+" must be hex string or Uint8Array, cause: "+s)}else if(wt(e))r=Uint8Array.from(e);else throw new Error(n+" must be hex string or Uint8Array");const i=r.length;if(typeof t=="number"&&i!==t)throw new Error(n+" of length "+t+" expected, got "+i);return r}function xt(...n){let e=0;for(let r=0;r<n.length;r++){const i=n[r];Vt(i),e+=i.length}const t=new Uint8Array(e);for(let r=0,i=0;r<n.length;r++){const s=n[r];t.set(s,i),i+=s.length}return t}const It=n=>typeof n=="bigint"&&Ct<=n;function Mt(n,e,t){return It(n)&&It(e)&&It(t)&&e<=n&&n<t}function ft(n,e,t,r){if(!Mt(e,t,r))throw new Error("expected valid "+n+": "+t+" <= n < "+r+", got "+e)}function _e(n){let e;for(e=0;n>Ct;n>>=Rt,e+=1);return e}const Et=n=>(Rt<<BigInt(n))-Rt,Nt=n=>new Uint8Array(n),Kt=n=>Uint8Array.from(n);function Re(n,e,t){if(typeof n!="number"||n<2)throw new Error("hashLen must be a number");if(typeof e!="number"||e<2)throw new Error("qByteLen must be a number");if(typeof t!="function")throw new Error("hmacFn must be a function");let r=Nt(n),i=Nt(n),s=0;const c=()=>{r.fill(1),i.fill(0),s=0},f=(...h)=>t(i,r,...h),o=(h=Nt(0))=>{i=f(Kt([0]),h),r=f(),h.length!==0&&(i=f(Kt([1]),h),r=f())},l=()=>{if(s++>=1e3)throw new Error("drbg: tried 1000 values");let h=0;const B=[];for(;h<e;){r=f();const q=r.slice();B.push(q),h+=r.length}return xt(...B)};return(h,B)=>{c(),o(h);let q;for(;!(q=B(l()));)o();return c(),q}}const ze={bigint:n=>typeof n=="bigint",function:n=>typeof n=="function",boolean:n=>typeof n=="boolean",string:n=>typeof n=="string",stringOrUint8Array:n=>typeof n=="string"||wt(n),isSafeInteger:n=>Number.isSafeInteger(n),array:n=>Array.isArray(n),field:(n,e)=>e.Fp.isValid(n),hash:n=>typeof n=="function"&&Number.isSafeInteger(n.outputLen)};function Bt(n,e,t={}){const r=(i,s,c)=>{const f=ze[s];if(typeof f!="function")throw new Error("invalid validator function");const o=n[i];if(!(c&&o===void 0)&&!f(o,n))throw new Error("param "+String(i)+" is invalid. Expected "+s+", got "+o)};for(const[i,s]of Object.entries(e))r(i,s,!1);for(const[i,s]of Object.entries(t))r(i,s,!0);return n}function Pt(n){const e=new WeakMap;return(t,...r)=>{const i=e.get(t);if(i!==void 0)return i;const s=n(t,...r);return e.set(t,s),s}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const j=BigInt(0),C=BigInt(1),rt=BigInt(2),Te=BigInt(3),ce=BigInt(4),fe=BigInt(5),ae=BigInt(8);function M(n,e){const t=n%e;return t>=j?t:e+t}function Y(n,e,t){let r=n;for(;e-- >j;)r*=r,r%=t;return r}function zt(n,e){if(n===j)throw new Error("invert: expected non-zero number");if(e<=j)throw new Error("invert: expected positive modulus, got "+e);let t=M(n,e),r=e,i=j,s=C;for(;t!==j;){const f=r/t,o=r%t,l=i-s*f;r=t,t=o,i=s,s=l}if(r!==C)throw new Error("invert: does not exist");return M(i,e)}function ue(n,e){const t=(n.ORDER+C)/ce,r=n.pow(e,t);if(!n.eql(n.sqr(r),e))throw new Error("Cannot find square root");return r}function Ze(n,e){const t=(n.ORDER-fe)/ae,r=n.mul(e,rt),i=n.pow(r,t),s=n.mul(e,i),c=n.mul(n.mul(s,rt),i),f=n.mul(s,n.sub(c,n.ONE));if(!n.eql(n.sqr(f),e))throw new Error("Cannot find square root");return f}function ke(n){if(n<BigInt(3))throw new Error("sqrt is not defined for small field");let e=n-C,t=0;for(;e%rt===j;)e/=rt,t++;let r=rt;const i=jt(n);for(;Dt(i,r)===1;)if(r++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(t===1)return ue;let s=i.pow(r,e);const c=(e+C)/rt;return function(o,l){if(o.is0(l))return l;if(Dt(o,l)!==1)throw new Error("Cannot find square root");let g=t,h=o.mul(o.ONE,s),B=o.pow(l,e),q=o.pow(l,c);for(;!o.eql(B,o.ONE);){if(o.is0(B))return o.ZERO;let _=1,p=o.sqr(B);for(;!o.eql(p,o.ONE);)if(_++,p=o.sqr(p),_===g)throw new Error("Cannot find square root");const Z=C<<BigInt(g-_-1),R=o.pow(h,Z);g=_,h=o.sqr(R),B=o.mul(B,h),q=o.mul(q,R)}return q}}function Ce(n){return n%ce===Te?ue:n%ae===fe?Ze:ke(n)}const Ve=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Me(n){const e={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},t=Ve.reduce((r,i)=>(r[i]="function",r),e);return Bt(n,t)}function je(n,e,t){if(t<j)throw new Error("invalid exponent, negatives unsupported");if(t===j)return n.ONE;if(t===C)return e;let r=n.ONE,i=e;for(;t>j;)t&C&&(r=n.mul(r,i)),i=n.sqr(i),t>>=C;return r}function le(n,e,t=!1){const r=new Array(e.length).fill(t?n.ZERO:void 0),i=e.reduce((c,f,o)=>n.is0(f)?c:(r[o]=c,n.mul(c,f)),n.ONE),s=n.inv(i);return e.reduceRight((c,f,o)=>n.is0(f)?c:(r[o]=n.mul(c,r[o]),n.mul(c,f)),s),r}function Dt(n,e){const t=(n.ORDER-C)/rt,r=n.pow(e,t),i=n.eql(r,n.ONE),s=n.eql(r,n.ZERO),c=n.eql(r,n.neg(n.ONE));if(!i&&!s&&!c)throw new Error("invalid Legendre symbol result");return i?1:s?0:-1}function de(n,e){e!==void 0&&Be(e);const t=e!==void 0?e:n.toString(2).length,r=Math.ceil(t/8);return{nBitLength:t,nByteLength:r}}function jt(n,e,t=!1,r={}){if(n<=j)throw new Error("invalid field: expected ORDER > 0, got "+n);const{nBitLength:i,nByteLength:s}=de(n,e);if(s>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let c;const f=Object.freeze({ORDER:n,isLE:t,BITS:i,BYTES:s,MASK:Et(i),ZERO:j,ONE:C,create:o=>M(o,n),isValid:o=>{if(typeof o!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof o);return j<=o&&o<n},is0:o=>o===j,isOdd:o=>(o&C)===C,neg:o=>M(-o,n),eql:(o,l)=>o===l,sqr:o=>M(o*o,n),add:(o,l)=>M(o+l,n),sub:(o,l)=>M(o-l,n),mul:(o,l)=>M(o*l,n),pow:(o,l)=>je(f,o,l),div:(o,l)=>M(o*zt(l,n),n),sqrN:o=>o*o,addN:(o,l)=>o+l,subN:(o,l)=>o-l,mulN:(o,l)=>o*l,inv:o=>zt(o,n),sqrt:r.sqrt||(o=>(c||(c=Ce(n)),c(f,o))),toBytes:o=>t?se(o,s):gt(o,s),fromBytes:o=>{if(o.length!==s)throw new Error("Field.fromBytes: expected "+s+" bytes, got "+o.length);return t?ie(o):ot(o)},invertBatch:o=>le(f,o),cmov:(o,l,g)=>g?l:o});return Object.freeze(f)}function he(n){if(typeof n!="bigint")throw new Error("field order must be bigint");const e=n.toString(2).length;return Math.ceil(e/8)}function we(n){const e=he(n);return e+Math.ceil(e/2)}function Ye(n,e,t=!1){const r=n.length,i=he(e),s=we(e);if(r<16||r<s||r>1024)throw new Error("expected "+s+"-1024 bytes of input, got "+r);const c=t?ie(n):ot(n),f=M(c,e-C)+C;return t?se(f,i):gt(f,i)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Gt=BigInt(0),Tt=BigInt(1);function Ot(n,e){const t=e.negate();return n?t:e}function ge(n,e){if(!Number.isSafeInteger(n)||n<=0||n>e)throw new Error("invalid window size, expected [1.."+e+"], got W="+n)}function qt(n,e){ge(n,e);const t=Math.ceil(e/n)+1,r=2**(n-1),i=2**n,s=Et(n),c=BigInt(n);return{windows:t,windowSize:r,mask:s,maxNumber:i,shiftBy:c}}function Wt(n,e,t){const{windowSize:r,mask:i,maxNumber:s,shiftBy:c}=t;let f=Number(n&i),o=n>>c;f>r&&(f-=s,o+=Tt);const l=e*r,g=l+Math.abs(f)-1,h=f===0,B=f<0,q=e%2!==0;return{nextN:o,offset:g,isZero:h,isNeg:B,isNegF:q,offsetF:l}}function Ke(n,e){if(!Array.isArray(n))throw new Error("array expected");n.forEach((t,r)=>{if(!(t instanceof e))throw new Error("invalid point at index "+r)})}function Pe(n,e){if(!Array.isArray(n))throw new Error("array of scalars expected");n.forEach((t,r)=>{if(!e.isValid(t))throw new Error("invalid scalar at index "+r)})}const Ht=new WeakMap,pe=new WeakMap;function Lt(n){return pe.get(n)||1}function De(n,e){return{constTimeNegate:Ot,hasPrecomputes(t){return Lt(t)!==1},unsafeLadder(t,r,i=n.ZERO){let s=t;for(;r>Gt;)r&Tt&&(i=i.add(s)),s=s.double(),r>>=Tt;return i},precomputeWindow(t,r){const{windows:i,windowSize:s}=qt(r,e),c=[];let f=t,o=f;for(let l=0;l<i;l++){o=f,c.push(o);for(let g=1;g<s;g++)o=o.add(f),c.push(o);f=o.double()}return c},wNAF(t,r,i){let s=n.ZERO,c=n.BASE;const f=qt(t,e);for(let o=0;o<f.windows;o++){const{nextN:l,offset:g,isZero:h,isNeg:B,isNegF:q,offsetF:_}=Wt(i,o,f);i=l,h?c=c.add(Ot(q,r[_])):s=s.add(Ot(B,r[g]))}return{p:s,f:c}},wNAFUnsafe(t,r,i,s=n.ZERO){const c=qt(t,e);for(let f=0;f<c.windows&&i!==Gt;f++){const{nextN:o,offset:l,isZero:g,isNeg:h}=Wt(i,f,c);if(i=o,!g){const B=r[l];s=s.add(h?B.negate():B)}}return s},getPrecomputes(t,r,i){let s=Ht.get(r);return s||(s=this.precomputeWindow(r,t),t!==1&&Ht.set(r,i(s))),s},wNAFCached(t,r,i){const s=Lt(t);return this.wNAF(s,this.getPrecomputes(s,t,i),r)},wNAFCachedUnsafe(t,r,i,s){const c=Lt(t);return c===1?this.unsafeLadder(t,r,s):this.wNAFUnsafe(c,this.getPrecomputes(c,t,i),r,s)},setWindowSize(t,r){ge(r,e),pe.set(t,r),Ht.delete(t)}}}function Ge(n,e,t,r){Ke(t,n),Pe(r,e);const i=t.length,s=r.length;if(i!==s)throw new Error("arrays of points and scalars must have equal length");const c=n.ZERO,f=_e(BigInt(i));let o=1;f>12?o=f-3:f>4?o=f-2:f>0&&(o=2);const l=Et(o),g=new Array(Number(l)+1).fill(c),h=Math.floor((e.BITS-1)/o)*o;let B=c;for(let q=h;q>=0;q-=o){g.fill(c);for(let p=0;p<s;p++){const Z=r[p],R=Number(Z>>BigInt(q)&l);g[R]=g[R].add(t[p])}let _=c;for(let p=g.length-1,Z=c;p>0;p--)Z=Z.add(g[p]),_=_.add(Z);if(B=B.add(_),q!==0)for(let p=0;p<o;p++)B=B.double()}return B}function me(n){return Me(n.Fp),Bt(n,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...de(n.n,n.nBitLength),...n,p:n.Fp.ORDER})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function $t(n){n.lowS!==void 0&&dt("lowS",n.lowS),n.prehash!==void 0&&dt("prehash",n.prehash)}function We(n){const e=me(n);Bt(e,{a:"field",b:"field"},{allowInfinityPoint:"boolean",allowedPrivateKeyLengths:"array",clearCofactor:"function",fromBytes:"function",isTorsionFree:"function",toBytes:"function",wrapPrivateKey:"boolean"});const{endo:t,Fp:r,a:i}=e;if(t){if(!r.eql(i,r.ZERO))throw new Error("invalid endo: CURVE.a must be 0");if(typeof t!="object"||typeof t.beta!="bigint"||typeof t.splitScalar!="function")throw new Error('invalid endo: expected "beta": bigint and "splitScalar": function')}return Object.freeze({...e})}class $e extends Error{constructor(e=""){super(e)}}const F={Err:$e,_tlv:{encode:(n,e)=>{const{Err:t}=F;if(n<0||n>256)throw new t("tlv.encode: wrong tag");if(e.length&1)throw new t("tlv.encode: unpadded data");const r=e.length/2,i=pt(r);if(i.length/2&128)throw new t("tlv.encode: long form length too big");const s=r>127?pt(i.length/2|128):"";return pt(n)+s+i+e},decode(n,e){const{Err:t}=F;let r=0;if(n<0||n>256)throw new t("tlv.encode: wrong tag");if(e.length<2||e[r++]!==n)throw new t("tlv.decode: wrong tlv");const i=e[r++],s=!!(i&128);let c=0;if(!s)c=i;else{const o=i&127;if(!o)throw new t("tlv.decode(long): indefinite length not supported");if(o>4)throw new t("tlv.decode(long): byte length is too big");const l=e.subarray(r,r+o);if(l.length!==o)throw new t("tlv.decode: length bytes not complete");if(l[0]===0)throw new t("tlv.decode(long): zero leftmost byte");for(const g of l)c=c<<8|g;if(r+=o,c<128)throw new t("tlv.decode(long): not minimal encoding")}const f=e.subarray(r,r+c);if(f.length!==c)throw new t("tlv.decode: wrong value length");return{v:f,l:e.subarray(r+c)}}},_int:{encode(n){const{Err:e}=F;if(n<X)throw new e("integer: negative integers are not allowed");let t=pt(n);if(Number.parseInt(t[0],16)&8&&(t="00"+t),t.length&1)throw new e("unexpected DER parsing assertion: unpadded hex");return t},decode(n){const{Err:e}=F;if(n[0]&128)throw new e("invalid signature integer: negative");if(n[0]===0&&!(n[1]&128))throw new e("invalid signature integer: unnecessary leading zero");return ot(n)}},toSig(n){const{Err:e,_int:t,_tlv:r}=F,i=K("signature",n),{v:s,l:c}=r.decode(48,i);if(c.length)throw new e("invalid signature: left bytes after parsing");const{v:f,l:o}=r.decode(2,s),{v:l,l:g}=r.decode(2,o);if(g.length)throw new e("invalid signature: left bytes after parsing");return{r:t.decode(f),s:t.decode(l)}},hexFromSig(n){const{_tlv:e,_int:t}=F,r=e.encode(2,t.encode(n.r)),i=e.encode(2,t.encode(n.s)),s=r+i;return e.encode(48,s)}};function Ut(n,e){return ht(gt(n,e))}const X=BigInt(0),z=BigInt(1);BigInt(2);const _t=BigInt(3),Fe=BigInt(4);function Xe(n){const e=We(n),{Fp:t}=e,r=jt(e.n,e.nBitLength),i=e.toBytes||((A,a,w)=>{const b=a.toAffine();return xt(Uint8Array.from([4]),t.toBytes(b.x),t.toBytes(b.y))}),s=e.fromBytes||(A=>{const a=A.subarray(1),w=t.fromBytes(a.subarray(0,t.BYTES)),b=t.fromBytes(a.subarray(t.BYTES,2*t.BYTES));return{x:w,y:b}});function c(A){const{a,b:w}=e,b=t.sqr(A),v=t.mul(b,A);return t.add(t.add(v,t.mul(A,a)),w)}function f(A,a){const w=t.sqr(a),b=c(A);return t.eql(w,b)}if(!f(e.Gx,e.Gy))throw new Error("bad curve params: generator point");const o=t.mul(t.pow(e.a,_t),Fe),l=t.mul(t.sqr(e.b),BigInt(27));if(t.is0(t.add(o,l)))throw new Error("bad curve params: a or b");function g(A){return Mt(A,z,e.n)}function h(A){const{allowedPrivateKeyLengths:a,nByteLength:w,wrapPrivateKey:b,n:v}=e;if(a&&typeof A!="bigint"){if(wt(A)&&(A=ht(A)),typeof A!="string"||!a.includes(A.length))throw new Error("invalid private key");A=A.padStart(w*2,"0")}let O;try{O=typeof A=="bigint"?A:ot(K("private key",A,w))}catch{throw new Error("invalid private key, expected hex or "+w+" bytes, got "+typeof A)}return b&&(O=M(O,v)),ft("private key",O,z,v),O}function B(A){if(!(A instanceof p))throw new Error("ProjectivePoint expected")}const q=Pt((A,a)=>{const{px:w,py:b,pz:v}=A;if(t.eql(v,t.ONE))return{x:w,y:b};const O=A.is0();a==null&&(a=O?t.ONE:t.inv(v));const L=t.mul(w,a),H=t.mul(b,a),y=t.mul(v,a);if(O)return{x:t.ZERO,y:t.ZERO};if(!t.eql(y,t.ONE))throw new Error("invZ was invalid");return{x:L,y:H}}),_=Pt(A=>{if(A.is0()){if(e.allowInfinityPoint&&!t.is0(A.py))return;throw new Error("bad point: ZERO")}const{x:a,y:w}=A.toAffine();if(!t.isValid(a)||!t.isValid(w))throw new Error("bad point: x or y not FE");if(!f(a,w))throw new Error("bad point: equation left != right");if(!A.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});class p{constructor(a,w,b){if(a==null||!t.isValid(a))throw new Error("x required");if(w==null||!t.isValid(w)||t.is0(w))throw new Error("y required");if(b==null||!t.isValid(b))throw new Error("z required");this.px=a,this.py=w,this.pz=b,Object.freeze(this)}static fromAffine(a){const{x:w,y:b}=a||{};if(!a||!t.isValid(w)||!t.isValid(b))throw new Error("invalid affine point");if(a instanceof p)throw new Error("projective point not allowed");const v=O=>t.eql(O,t.ZERO);return v(w)&&v(b)?p.ZERO:new p(w,b,t.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(a){const w=le(t,a.map(b=>b.pz));return a.map((b,v)=>b.toAffine(w[v])).map(p.fromAffine)}static fromHex(a){const w=p.fromAffine(s(K("pointHex",a)));return w.assertValidity(),w}static fromPrivateKey(a){return p.BASE.multiply(h(a))}static msm(a,w){return Ge(p,r,a,w)}_setWindowSize(a){D.setWindowSize(this,a)}assertValidity(){_(this)}hasEvenY(){const{y:a}=this.toAffine();if(t.isOdd)return!t.isOdd(a);throw new Error("Field doesn't support isOdd")}equals(a){B(a);const{px:w,py:b,pz:v}=this,{px:O,py:L,pz:H}=a,y=t.eql(t.mul(w,H),t.mul(O,v)),N=t.eql(t.mul(b,H),t.mul(L,v));return y&&N}negate(){return new p(this.px,t.neg(this.py),this.pz)}double(){const{a,b:w}=e,b=t.mul(w,_t),{px:v,py:O,pz:L}=this;let H=t.ZERO,y=t.ZERO,N=t.ZERO,x=t.mul(v,v),T=t.mul(O,O),d=t.mul(L,L),u=t.mul(v,O);return u=t.add(u,u),N=t.mul(v,L),N=t.add(N,N),H=t.mul(a,N),y=t.mul(b,d),y=t.add(H,y),H=t.sub(T,y),y=t.add(T,y),y=t.mul(H,y),H=t.mul(u,H),N=t.mul(b,N),d=t.mul(a,d),u=t.sub(x,d),u=t.mul(a,u),u=t.add(u,N),N=t.add(x,x),x=t.add(N,x),x=t.add(x,d),x=t.mul(x,u),y=t.add(y,x),d=t.mul(O,L),d=t.add(d,d),x=t.mul(d,u),H=t.sub(H,x),N=t.mul(d,T),N=t.add(N,N),N=t.add(N,N),new p(H,y,N)}add(a){B(a);const{px:w,py:b,pz:v}=this,{px:O,py:L,pz:H}=a;let y=t.ZERO,N=t.ZERO,x=t.ZERO;const T=e.a,d=t.mul(e.b,_t);let u=t.mul(w,O),m=t.mul(b,L),I=t.mul(v,H),E=t.add(w,b),S=t.add(O,L);E=t.mul(E,S),S=t.add(u,m),E=t.sub(E,S),S=t.add(w,v);let U=t.add(O,H);return S=t.mul(S,U),U=t.add(u,I),S=t.sub(S,U),U=t.add(b,v),y=t.add(L,H),U=t.mul(U,y),y=t.add(m,I),U=t.sub(U,y),x=t.mul(T,S),y=t.mul(d,I),x=t.add(y,x),y=t.sub(m,x),x=t.add(m,x),N=t.mul(y,x),m=t.add(u,u),m=t.add(m,u),I=t.mul(T,I),S=t.mul(d,S),m=t.add(m,I),I=t.sub(u,I),I=t.mul(T,I),S=t.add(S,I),u=t.mul(m,S),N=t.add(N,u),u=t.mul(U,S),y=t.mul(E,y),y=t.sub(y,u),u=t.mul(E,m),x=t.mul(U,x),x=t.add(x,u),new p(y,N,x)}subtract(a){return this.add(a.negate())}is0(){return this.equals(p.ZERO)}wNAF(a){return D.wNAFCached(this,a,p.normalizeZ)}multiplyUnsafe(a){const{endo:w,n:b}=e;ft("scalar",a,X,b);const v=p.ZERO;if(a===X)return v;if(this.is0()||a===z)return this;if(!w||D.hasPrecomputes(this))return D.wNAFCachedUnsafe(this,a,p.normalizeZ);let{k1neg:O,k1:L,k2neg:H,k2:y}=w.splitScalar(a),N=v,x=v,T=this;for(;L>X||y>X;)L&z&&(N=N.add(T)),y&z&&(x=x.add(T)),T=T.double(),L>>=z,y>>=z;return O&&(N=N.negate()),H&&(x=x.negate()),x=new p(t.mul(x.px,w.beta),x.py,x.pz),N.add(x)}multiply(a){const{endo:w,n:b}=e;ft("scalar",a,z,b);let v,O;if(w){const{k1neg:L,k1:H,k2neg:y,k2:N}=w.splitScalar(a);let{p:x,f:T}=this.wNAF(H),{p:d,f:u}=this.wNAF(N);x=D.constTimeNegate(L,x),d=D.constTimeNegate(y,d),d=new p(t.mul(d.px,w.beta),d.py,d.pz),v=x.add(d),O=T.add(u)}else{const{p:L,f:H}=this.wNAF(a);v=L,O=H}return p.normalizeZ([v,O])[0]}multiplyAndAddUnsafe(a,w,b){const v=p.BASE,O=(H,y)=>y===X||y===z||!H.equals(v)?H.multiplyUnsafe(y):H.multiply(y),L=O(this,w).add(O(a,b));return L.is0()?void 0:L}toAffine(a){return q(this,a)}isTorsionFree(){const{h:a,isTorsionFree:w}=e;if(a===z)return!0;if(w)return w(p,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:a,clearCofactor:w}=e;return a===z?this:w?w(p,this):this.multiplyUnsafe(e.h)}toRawBytes(a=!0){return dt("isCompressed",a),this.assertValidity(),i(p,this,a)}toHex(a=!0){return dt("isCompressed",a),ht(this.toRawBytes(a))}}p.BASE=new p(e.Gx,e.Gy,t.ONE),p.ZERO=new p(t.ZERO,t.ONE,t.ZERO);const{endo:Z,nBitLength:R}=e,D=De(p,Z?Math.ceil(R/2):R);return{CURVE:e,ProjectivePoint:p,normPrivateKeyToScalar:h,weierstrassEquation:c,isWithinCurveOrder:g}}function Qe(n){const e=me(n);return Bt(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}function Je(n){const e=Qe(n),{Fp:t,n:r,nByteLength:i,nBitLength:s}=e,c=t.BYTES+1,f=2*t.BYTES+1;function o(d){return M(d,r)}function l(d){return zt(d,r)}const{ProjectivePoint:g,normPrivateKeyToScalar:h,weierstrassEquation:B,isWithinCurveOrder:q}=Xe({...e,toBytes(d,u,m){const I=u.toAffine(),E=t.toBytes(I.x),S=xt;return dt("isCompressed",m),m?S(Uint8Array.from([u.hasEvenY()?2:3]),E):S(Uint8Array.from([4]),E,t.toBytes(I.y))},fromBytes(d){const u=d.length,m=d[0],I=d.subarray(1);if(u===c&&(m===2||m===3)){const E=ot(I);if(!Mt(E,z,t.ORDER))throw new Error("Point is not on curve");const S=B(E);let U;try{U=t.sqrt(S)}catch(P){const V=P instanceof Error?": "+P.message:"";throw new Error("Point is not on curve"+V)}const k=(U&z)===z;return(m&1)===1!==k&&(U=t.neg(U)),{x:E,y:U}}else if(u===f&&m===4){const E=t.fromBytes(I.subarray(0,t.BYTES)),S=t.fromBytes(I.subarray(t.BYTES,2*t.BYTES));return{x:E,y:S}}else{const E=c,S=f;throw new Error("invalid Point, expected length of "+E+", or uncompressed "+S+", got "+u)}}});function _(d){const u=r>>z;return d>u}function p(d){return _(d)?o(-d):d}const Z=(d,u,m)=>ot(d.slice(u,m));class R{constructor(u,m,I){ft("r",u,z,r),ft("s",m,z,r),this.r=u,this.s=m,I!=null&&(this.recovery=I),Object.freeze(this)}static fromCompact(u){const m=i;return u=K("compactSignature",u,m*2),new R(Z(u,0,m),Z(u,m,2*m))}static fromDER(u){const{r:m,s:I}=F.toSig(K("DER",u));return new R(m,I)}assertValidity(){}addRecoveryBit(u){return new R(this.r,this.s,u)}recoverPublicKey(u){const{r:m,s:I,recovery:E}=this,S=v(K("msgHash",u));if(E==null||![0,1,2,3].includes(E))throw new Error("recovery id invalid");const U=E===2||E===3?m+e.n:m;if(U>=t.ORDER)throw new Error("recovery id 2 or 3 invalid");const k=(E&1)===0?"02":"03",W=g.fromHex(k+Ut(U,t.BYTES)),P=l(U),V=o(-S*P),it=o(I*P),Q=g.BASE.multiplyAndAddUnsafe(W,V,it);if(!Q)throw new Error("point at infinify");return Q.assertValidity(),Q}hasHighS(){return _(this.s)}normalizeS(){return this.hasHighS()?new R(this.r,o(-this.s),this.recovery):this}toDERRawBytes(){return yt(this.toDERHex())}toDERHex(){return F.hexFromSig(this)}toCompactRawBytes(){return yt(this.toCompactHex())}toCompactHex(){const u=i;return Ut(this.r,u)+Ut(this.s,u)}}const D={isValidPrivateKey(d){try{return h(d),!0}catch{return!1}},normPrivateKeyToScalar:h,randomPrivateKey:()=>{const d=we(e.n);return Ye(e.randomBytes(d),e.n)},precompute(d=8,u=g.BASE){return u._setWindowSize(d),u.multiply(BigInt(3)),u}};function A(d,u=!0){return g.fromPrivateKey(d).toRawBytes(u)}function a(d){if(typeof d=="bigint")return!1;if(d instanceof g)return!0;const m=K("key",d).length,I=t.BYTES,E=I+1,S=2*I+1;if(!(e.allowedPrivateKeyLengths||i===E))return m===E||m===S}function w(d,u,m=!0){if(a(d)===!0)throw new Error("first arg must be private key");if(a(u)===!1)throw new Error("second arg must be public key");return g.fromHex(u).multiply(h(d)).toRawBytes(m)}const b=e.bits2int||function(d){if(d.length>8192)throw new Error("input is too large");const u=ot(d),m=d.length*8-s;return m>0?u>>BigInt(m):u},v=e.bits2int_modN||function(d){return o(b(d))},O=Et(s);function L(d){return ft("num < 2^"+s,d,X,O),gt(d,i)}function H(d,u,m=y){if(["recovered","canonical"].some(et=>et in m))throw new Error("sign() legacy options not supported");const{hash:I,randomBytes:E}=e;let{lowS:S,prehash:U,extraEntropy:k}=m;S==null&&(S=!0),d=K("msgHash",d),$t(m),U&&(d=K("prehashed msgHash",I(d)));const W=v(d),P=h(u),V=[L(P),L(W)];if(k!=null&&k!==!1){const et=k===!0?E(t.BYTES):k;V.push(K("extraEntropy",et))}const it=xt(...V),Q=W;function vt(et){const st=b(et);if(!q(st))return;const St=l(st),at=g.BASE.multiply(st).toAffine(),nt=o(at.x);if(nt===X)return;const ut=o(St*o(Q+nt*P));if(ut===X)return;let lt=(at.x===nt?0:2)|Number(at.y&z),ct=ut;return S&&_(ut)&&(ct=p(ut),lt^=1),new R(nt,ct,lt)}return{seed:it,k2sig:vt}}const y={lowS:e.lowS,prehash:!1},N={lowS:e.lowS,prehash:!1};function x(d,u,m=y){const{seed:I,k2sig:E}=H(d,u,m),S=e;return Re(S.hash.outputLen,S.nByteLength,S.hmac)(I,E)}g.BASE._setWindowSize(8);function T(d,u,m,I=N){var lt;const E=d;u=K("msgHash",u),m=K("publicKey",m);const{lowS:S,prehash:U,format:k}=I;if($t(I),"strict"in I)throw new Error("options.strict was renamed to lowS");if(k!==void 0&&k!=="compact"&&k!=="der")throw new Error("format must be compact or der");const W=typeof E=="string"||wt(E),P=!W&&!k&&typeof E=="object"&&E!==null&&typeof E.r=="bigint"&&typeof E.s=="bigint";if(!W&&!P)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");let V,it;try{if(P&&(V=new R(E.r,E.s)),W){try{k!=="compact"&&(V=R.fromDER(E))}catch(ct){if(!(ct instanceof F.Err))throw ct}!V&&k!=="der"&&(V=R.fromCompact(E))}it=g.fromHex(m)}catch{return!1}if(!V||S&&V.hasHighS())return!1;U&&(u=e.hash(u));const{r:Q,s:vt}=V,et=v(u),st=l(vt),St=o(et*st),at=o(Q*st),nt=(lt=g.BASE.multiplyAndAddUnsafe(it,St,at))==null?void 0:lt.toAffine();return nt?o(nt.x)===Q:!1}return{CURVE:e,getPublicKey:A,getSharedSecret:w,sign:x,verify:T,ProjectivePoint:g,Signature:R,utils:D}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function tn(n){return{hash:n,hmac:(e,...t)=>ne(n,e,Se(...t)),randomBytes:ve}}function en(n,e){const t=r=>Je({...n,...tn(r)});return{...t(e),create:t}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const be=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),Ft=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),nn=BigInt(0),rn=BigInt(1),Zt=BigInt(2),Xt=(n,e)=>(n+e/Zt)/e;function on(n){const e=be,t=BigInt(3),r=BigInt(6),i=BigInt(11),s=BigInt(22),c=BigInt(23),f=BigInt(44),o=BigInt(88),l=n*n*n%e,g=l*l*n%e,h=Y(g,t,e)*g%e,B=Y(h,t,e)*g%e,q=Y(B,Zt,e)*l%e,_=Y(q,i,e)*q%e,p=Y(_,s,e)*_%e,Z=Y(p,f,e)*p%e,R=Y(Z,o,e)*Z%e,D=Y(R,f,e)*p%e,A=Y(D,t,e)*g%e,a=Y(A,c,e)*_%e,w=Y(a,r,e)*l%e,b=Y(w,Zt,e);if(!kt.eql(kt.sqr(b),n))throw new Error("Cannot find square root");return b}const kt=jt(be,void 0,void 0,{sqrt:on}),En=en({a:nn,b:BigInt(7),Fp:kt,n:Ft,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:n=>{const e=Ft,t=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-rn*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),s=t,c=BigInt("0x100000000000000000000000000000000"),f=Xt(s*n,e),o=Xt(-r*n,e);let l=M(n-f*t-o*i,e),g=M(-f*r-o*s,e);const h=l>c,B=g>c;if(h&&(l=e-l),B&&(g=e-g),l>c||g>c)throw new Error("splitScalar: Endomorphism failed, k="+n);return{k1neg:h,k1:l,k2neg:B,k2:g}}}},Le);export{En as secp256k1};
@@ -1 +0,0 @@
1
- import{d as b,e as E,h as k}from"./wallets-CdPPQGkU.js";import"./signing-CjtnBxxM.js";import"./utils-DmMVfaK5.js";import"./ethers-D-4WUfRB.js";import"./react-iAgwec9M.js";import"./index-C1zw_jvz.js";import"./store-CraP4F4Y.js";import"./hashTypedData-CHOppTRC.js";import"./index-pgfSp-jn.js";import"./index-Bc_XrzTG.js";import"./index-BQkCy5n9.js";import"./index-nibyPLVP.js";import"./index-CJdot1dH.js";import"./index-BPH4bq6L.js";import"./ethereum-CfGZ1o2B.js";async function R(a){var r,p;const{wallet:t,walletConnectClient:e,event:i,chains:s,onConnect:m}=a,d=t.getAccount();if(!d)throw new Error("No account connected to provided wallet");const n=(p=(r=i.verifyContext)==null?void 0:r.verified)==null?void 0:p.origin;n&&await A({origin:n,walletConnectClient:e});const o=await W({account:d,chains:s,sessionProposal:i,walletConnectClient:e});await b(o),t.subscribe("disconnect",()=>{E({session:o,walletConnectClient:e})}),m==null||m(o)}async function A({walletConnectClient:a,origin:t}){const e=await k();for(const i of e)i.origin===t&&await E({session:i,walletConnectClient:a})}async function W({account:a,walletConnectClient:t,sessionProposal:e,chains:i}){var n,o,r,p,w,f,v,l,u,g,N,h,S,y,$,C,q,x;if(!((n=e.params.requiredNamespaces)!=null&&n.eip155)&&!((o=e.params.optionalNamespaces)!=null&&o.eip155))throw new Error("No EIP155 namespace found in Wallet Connect session proposal");const s={chains:[...Array.from(new Set([...((w=(p=(r=e.params.requiredNamespaces)==null?void 0:r.eip155)==null?void 0:p.chains)==null?void 0:w.map(c=>`${c}:${a.address}`))??[],...((l=(v=(f=e.params.optionalNamespaces)==null?void 0:f.eip155)==null?void 0:v.chains)==null?void 0:l.map(c=>`${c}:${a.address}`))??[],...(i==null?void 0:i.map(c=>`eip155:${c.id}:${a.address}`))??[]]))],events:[...((g=(u=e.params.requiredNamespaces)==null?void 0:u.eip155)==null?void 0:g.events)??[],...((h=(N=e.params.optionalNamespaces)==null?void 0:N.eip155)==null?void 0:h.events)??[]],methods:[...((y=(S=e.params.requiredNamespaces)==null?void 0:S.eip155)==null?void 0:y.methods)??[],...((C=($=e.params.optionalNamespaces)==null?void 0:$.eip155)==null?void 0:C.methods)??[]]},d=await(await t.approve({id:e.id,namespaces:{eip155:{accounts:s.chains,events:s.events,methods:s.methods}}})).acknowledged();return{origin:((x=(q=e.verifyContext)==null?void 0:q.verified)==null?void 0:x.origin)||"Unknown origin",topic:d.topic}}export{W as acceptSessionProposal,A as disconnectExistingSessions,R as onSessionProposal};
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/wallets-CdPPQGkU.js","assets/signing-CjtnBxxM.js","assets/utils-DmMVfaK5.js","assets/ethers-D-4WUfRB.js","assets/react-iAgwec9M.js","assets/index-C1zw_jvz.js","assets/index-Ctf6wteV.css","assets/store-CraP4F4Y.js","assets/hashTypedData-CHOppTRC.js","assets/index-pgfSp-jn.js","assets/index-Bc_XrzTG.js","assets/index-BQkCy5n9.js","assets/index-nibyPLVP.js","assets/index-CJdot1dH.js","assets/index-BPH4bq6L.js","assets/ethereum-CfGZ1o2B.js"])))=>i.map(i=>d[i]);
2
- import{_ as g}from"./index-C1zw_jvz.js";import{i as o,j as f,k as T,l as C,m as p,o as m}from"./wallets-CdPPQGkU.js";import"./react-iAgwec9M.js";import"./ethers-D-4WUfRB.js";import"./signing-CjtnBxxM.js";import"./utils-DmMVfaK5.js";import"./store-CraP4F4Y.js";import"./hashTypedData-CHOppTRC.js";import"./index-pgfSp-jn.js";import"./index-Bc_XrzTG.js";import"./index-BQkCy5n9.js";import"./index-nibyPLVP.js";import"./index-CJdot1dH.js";import"./index-BPH4bq6L.js";import"./ethereum-CfGZ1o2B.js";async function H(c){const{wallet:r,walletConnectClient:w,thirdwebClient:h,event:{topic:_,id:d,params:{chainId:n,request:e}},handlers:a}=c,i=r.getAccount();if(!i)throw new Error("No account connected to provided wallet");let t;try{switch(e.method){case"personal_sign":{a!=null&&a.personal_sign?t=await a.personal_sign({account:i,params:e.params}):t=await m({account:i,params:e.params});break}case"eth_sign":{a!=null&&a.eth_sign?t=await a.eth_sign({account:i,params:e.params}):t=await m({account:i,params:e.params});break}case"eth_signTypedData":{a!=null&&a.eth_signTypedData?t=await a.eth_signTypedData({account:i,params:e.params}):t=await p({account:i,params:e.params});break}case"eth_signTypedData_v4":{a!=null&&a.eth_signTypedData_v4?t=await a.eth_signTypedData_v4({account:i,params:e.params}):t=await p({account:i,params:e.params});break}case"eth_signTransaction":{a!=null&&a.eth_signTransaction?t=await a.eth_signTransaction({account:i,params:e.params}):t=await C({account:i,params:e.params});break}case"eth_sendTransaction":{const s=o(n);a!=null&&a.eth_sendTransaction?t=await a.eth_sendTransaction({account:i,chainId:s,params:e.params}):t=await T({account:i,chainId:s,params:e.params,thirdwebClient:h});break}case"eth_sendRawTransaction":{const s=o(n);a!=null&&a.eth_sendRawTransaction?t=await a.eth_sendRawTransaction({account:i,chainId:s,params:e.params}):t=await f({account:i,chainId:s,params:e.params});break}case"wallet_addEthereumChain":{if(a!=null&&a.wallet_addEthereumChain)t=await a.wallet_addEthereumChain({params:e.params,wallet:r});else throw new Error("Unsupported request method: wallet_addEthereumChain");break}case"wallet_switchEthereumChain":{if(a!=null&&a.wallet_switchEthereumChain)t=await a.wallet_switchEthereumChain({params:e.params,wallet:r});else{const{handleSwitchChain:s}=await g(async()=>{const{handleSwitchChain:l}=await import("./wallets-CdPPQGkU.js").then(u=>u.af);return{handleSwitchChain:l}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]));t=await s({params:e.params,wallet:r})}break}default:{const s=a==null?void 0:a[e.method];if(s)t=await s({account:i,chainId:o(n),params:e.params});else throw new Error(`Unsupported request method: ${e.method}`)}}}catch(s){t={code:typeof s=="object"&&s!==null&&"code"in s?s.code:500,message:typeof s=="object"&&s!==null&&"message"in s?s.message:"Unknown error"}}w.respond({response:{id:d,jsonrpc:"2.0",result:t},topic:_})}export{H as fulfillRequest};
@@ -1,16 +0,0 @@
1
- import{a as c,i as s,b as f}from"./lit-element-B3y9oplH.js";import"./index-DwXY_0me.js";import{c as a}from"./index-BzBBEm1y.js";import"./index-o6E9IjdT.js";import"./index-C1zw_jvz.js";import"./react-iAgwec9M.js";import"./ethers-D-4WUfRB.js";import"./W3MFrameProviderSingleton-ZaFH8iXi.js";import"./index-BQkCy5n9.js";import"./index-pgfSp-jn.js";import"./browser-ponyfill-B39o65AB.js";import"./NetworkUtil-Cm_KFCNa.js";import"./index-Bc_XrzTG.js";import"./index-nibyPLVP.js";import"./index-BPH4bq6L.js";import"./index.es-CCFOZERa.js";import"./class-map-CxwNmq0D.js";import"./index-4CyAhAID.js";import"./index-Cq6p8O8N.js";import"./index-GKORwvdA.js";import"./index-BaVtOO6t.js";const d=c`
2
- :host > wui-flex:first-child {
3
- height: 500px;
4
- overflow-y: auto;
5
- overflow-x: hidden;
6
- scrollbar-width: none;
7
- }
8
-
9
- :host > wui-flex:first-child::-webkit-scrollbar {
10
- display: none;
11
- }
12
- `;var u=function(e,i,o,r){var n=arguments.length,t=n<3?i:r===null?r=Object.getOwnPropertyDescriptor(i,o):r,m;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")t=Reflect.decorate(e,i,o,r);else for(var p=e.length-1;p>=0;p--)(m=e[p])&&(t=(n<3?m(t):n>3?m(i,o,t):m(i,o))||t);return n>3&&t&&Object.defineProperty(i,o,t),t};let l=class extends s{render(){return f`
13
- <wui-flex flexDirection="column" .padding=${["0","3","3","3"]} gap="3">
14
- <w3m-activity-list page="activity"></w3m-activity-list>
15
- </wui-flex>
16
- `}};l.styles=d;l=u([a("w3m-transactions-view")],l);export{l as W3mTransactionsView};
@@ -1,9 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/eth_getTransactionCount-jDyG_Ia6.js","assets/signing-CjtnBxxM.js","assets/utils-DmMVfaK5.js","assets/ethers-D-4WUfRB.js","assets/react-iAgwec9M.js","assets/index-C1zw_jvz.js","assets/index-Ctf6wteV.css","assets/in-app-wallet-calls-D-eIKfO6.js","assets/wait-for-tx-receipt-DztajESX.js","assets/transactionReceipt-D2SEnNQ1.js","assets/sleep-mAKpSMLY.js","assets/send-batch-transaction-D_I1HvSE.js","assets/wallets-CdPPQGkU.js","assets/store-CraP4F4Y.js","assets/hashTypedData-CHOppTRC.js","assets/index-pgfSp-jn.js","assets/index-Bc_XrzTG.js","assets/index-BQkCy5n9.js","assets/index-nibyPLVP.js","assets/index-CJdot1dH.js","assets/index-BPH4bq6L.js","assets/ethereum-CfGZ1o2B.js","assets/passkeys-CW4jmTtA.js","assets/uint8-array-CjVHUazS.js"])))=>i.map(i=>d[i]);
2
- import{_ as y}from"./index-C1zw_jvz.js";import{e as p,c as g,a as I,f as O}from"./utils-DmMVfaK5.js";import{a7 as q,r as Q,p as D,a8 as F,a9 as U,aa as H,ab as J,ac as Y,ad as Z,ae as K}from"./wallets-CdPPQGkU.js";import{j as w,g as b,$ as X,m as P,W as N,l as B,V as W,o as ee,ao as te}from"./signing-CjtnBxxM.js";import{s as k}from"./sleep-mAKpSMLY.js";import"./react-iAgwec9M.js";import"./ethers-D-4WUfRB.js";import"./store-CraP4F4Y.js";import"./hashTypedData-CHOppTRC.js";import"./index-pgfSp-jn.js";import"./index-Bc_XrzTG.js";import"./index-BQkCy5n9.js";import"./index-nibyPLVP.js";import"./index-CJdot1dH.js";import"./index-BPH4bq6L.js";import"./ethereum-CfGZ1o2B.js";const T=new Map,ie={getItem:async i=>T.get(i)??null,removeItem:async i=>{T.delete(i)},setItem:async(i,e)=>{T.set(i,e)}};async function A({authToken:i,client:e,ecosystem:t}){const r=await g(e,t)(`${p("inAppWallet")}/api/2024-05-05/accounts`,{headers:{Authorization:`Bearer embedded-wallet-token:${i}`,"Content-Type":"application/json"},method:"GET"});if(!r.ok){const l=await r.text().catch(()=>"Unknown error");throw new Error(`Failed to get user info: ${l}`)}return await r.json()}const ae=p("inAppWallet"),ne=`${ae}/`,R=`${ne}api/2023-10-20`,re=`${R}/embedded-wallet/validate-custom-jwt`,se=`${R}/embedded-wallet/validate-custom-auth-endpoint`,M=(i,e)=>e instanceof Error?`${i}: ${e.message}`:`${i}: ${w(e)}`;async function oe(i){const t=await g(i.client,i.ecosystem)(se,{body:w({developerClientId:i.client.clientId,payload:i.payload}),headers:{"Content-Type":"application/json"},method:"POST"});if(!t.ok){const a=await t.json();throw new Error(`Custom auth endpoint authentication error: ${a.message}`)}try{const{verifiedToken:a}=await t.json();return{storedToken:a}}catch(a){throw new Error(M("Malformed response from post auth_endpoint authentication",a))}}const z=i=>{if(!q.includes(i))throw new Error(`Unknown auth option ${i}`);switch(i){case"wallet":return"siwe";default:return i}},v=({authOption:i,client:e,ecosystem:t,mode:a="popup",redirectUrl:r,authFlow:l})=>{if(a==="popup"&&r)throw new Error("Redirect URL is not supported for popup mode");if(a==="window"&&!r)throw new Error("Redirect URL is required for window mode");const c=z(i);let n=`${p("inAppWallet")}/api/2024-05-05/login/${c}?clientId=${e.clientId}`;if(t!=null&&t.partnerId?n=`${n}&ecosystemId=${t.id}&ecosystemPartnerId=${t.partnerId}`:t&&(n=`${n}&ecosystemId=${t.id}`),a!=="popup"){const o=new URL(r||window.location.href);o.searchParams.set("walletId",(t==null?void 0:t.id)||"inApp"),o.searchParams.set("authProvider",i),l&&o.searchParams.set("authFlow",l),n=`${n}&redirectUrl=${encodeURIComponent(o.toString())}`}return n},S=({authOption:i,client:e,ecosystem:t})=>{const a=z(i);let r=`${p("inAppWallet")}/api/2024-05-05/login/${a}/callback?clientId=${e.clientId}`;return t!=null&&t.partnerId?r=`${r}&ecosystemId=${t.id}&ecosystemPartnerId=${t.partnerId}`:t&&(r=`${r}&ecosystemId=${t.id}`),r};async function ce(i){const e=g(i.client,i.ecosystem),t=v({authOption:"backend",client:i.client,ecosystem:i.ecosystem}),a=await e(`${t}`,{body:w({walletSecret:i.walletSecret}),headers:{"Content-Type":"application/json"},method:"POST"});if(!a.ok){const r=await a.text();throw new Error(`Failed to generate backend account: ${r}`)}return await a.json()}async function le(i){let e=await i.storage.getGuestSessionId();e||(e=Q(32),i.storage.saveGuestSessionId(e));const t=g(i.client,i.ecosystem),a=S({authOption:"guest",client:i.client,ecosystem:i.ecosystem}),r=await t(`${a}`,{body:w({sessionId:e}),headers:{"Content-Type":"application/json"},method:"POST"});if(!r.ok){const l=await r.text();throw new Error(`Failed to generate guest account: ${r.status} ${r.statusText} ${l}`)}return await r.json()}async function de(i){const t=await g(i.client,i.ecosystem)(re,{body:w({developerClientId:i.client.clientId,jwt:i.jwt}),headers:{"Content-Type":"application/json"},method:"POST"});if(!t.ok){const a=await t.json();throw new Error(`JWT authentication error: ${a.message}`)}try{const{verifiedToken:a}=await t.json();return{storedToken:a}}catch(a){throw new Error(M("Malformed response from post jwt authentication",a))}}function x(){return`${p("inAppWallet")}/api/2024-05-05/login/passkey/callback`}function G(i,e){return`${p("inAppWallet")}/api/2024-05-05/login/passkey?type=${i}${e?`&username=${e}`:""}`}async function ue(i){var d,h,u;if(!i.passkeyClient.isAvailable())throw new Error("Passkeys are not available on this device");const e=g(i.client,i.ecosystem),t=i.username??we(i.ecosystem),r=await(await e(G("sign-up",t))).json();if(!r.challenge)throw new Error("No challenge received");const l=r.challenge,c=await i.passkeyClient.register({challenge:l,name:t,rp:i.rp}),n={};(d=i.ecosystem)!=null&&d.partnerId&&(n["x-ecosystem-partner-id"]=i.ecosystem.partnerId),(h=i.ecosystem)!=null&&h.id&&(n["x-ecosystem-id"]=i.ecosystem.id);const s=await(await e(x(),{body:w({authenticatorData:c.authenticatorData,clientData:c.clientData,credential:{algorithm:c.credential.algorithm,publicKey:c.credential.publicKey},credentialId:c.credentialId,origin:c.origin,rpId:i.rp.id,serverVerificationId:r.serverVerificationId,type:"sign-up",username:t}),headers:{"Content-Type":"application/json",...n},method:"POST"})).json();if(!s||!s.storedToken)throw new Error(`Error verifying passkey: ${s.message??"unknown error"}`);return await((u=i.storage)==null?void 0:u.savePasskeyCredentialId(c.credentialId)),s}async function he(i){var s,d,h,u;if(!i.passkeyClient.isAvailable())throw new Error("Passkeys are not available on this device");const e=g(i.client,i.ecosystem),[t,a]=await Promise.all([e(G("sign-in")).then(f=>f.json()),(s=i.storage)==null?void 0:s.getPasskeyCredentialId()]);if(!t.challenge)throw new Error("No challenge received");const r=t.challenge,l=await i.passkeyClient.authenticate({challenge:r,credentialId:a??void 0,rp:i.rp}),c={};(d=i.ecosystem)!=null&&d.partnerId&&(c["x-ecosystem-partner-id"]=i.ecosystem.partnerId),(h=i.ecosystem)!=null&&h.id&&(c["x-ecosystem-id"]=i.ecosystem.id);const o=await(await e(x(),{body:w({authenticatorData:l.authenticatorData,clientData:l.clientData,credentialId:l.credentialId,origin:l.origin,rpId:i.rp.id,serverVerificationId:t.serverVerificationId,signature:l.signature,type:"sign-in"}),headers:{"Content-Type":"application/json",...c},method:"POST"})).json();if(!o||!o.storedToken)throw new Error(`Error verifying passkey: ${o.message??"unknown error"}`);return await((u=i.storage)==null?void 0:u.savePasskeyCredentialId(l.credentialId)),o}function we(i){return`${(i==null?void 0:i.id)??"wallet"}-${new Date().toISOString()}`}function pe(i){let a=[`${i.domain} wants you to sign in with your Ethereum account:`,i.address].join(`
3
- `);a=[a,i.statement].join(`
4
-
5
- `),i.statement&&(a+=`
6
- `);const r=[];if(i.uri){const d=`URI: ${i.uri}`;r.push(d)}const l=`Version: ${i.version}`;if(r.push(l),i.chain_id){const d=`Chain ID: ${i.chain_id}`||"1";r.push(d)}const c=`Nonce: ${i.nonce}`;r.push(c);const n=`Issued At: ${i.issued_at}`;r.push(n);const o=`Expiration Time: ${i.expiration_time}`;if(r.push(o),i.invalid_before){const d=`Not Before: ${i.invalid_before}`;r.push(d)}i.resources&&r.push(["Resources:",...i.resources.map(d=>`- ${d}`)].join(`
7
- `));const s=r.join(`
8
- `);return[a,s].join(`
9
- `)}async function ge(i){const{payload:e,account:t}=i,a=await t.signMessage({message:pe(e)});return{payload:e,signature:a}}const me=["xyz.abs"];async function fe(i){const{wallet:e,client:t,ecosystem:a,chain:r}=i,l=me.includes(e.id)?r||I(1):I(1),c=e.getAccount()||await e.connect({chain:l,client:t}),n=g(t,a),o=await(async()=>{const h=v({authOption:"wallet",client:i.client,ecosystem:i.ecosystem}),u=await n(`${h}&address=${c.address}&chainId=${l.id}`);if(!u.ok)throw new Error("Failed to generate SIWE login payload");return await u.json()})(),{signature:s}=await ge({account:c,payload:o});return await(async()=>{const h=S({authOption:"wallet",client:i.client,ecosystem:i.ecosystem}),u=await n(`${h}&signature=${s}&payload=${encodeURIComponent(o)}`,{body:w({payload:o,signature:s}),headers:{"Content-Type":"application/json"},method:"POST"});if(!u.ok)throw new Error("Failed to verify SIWE signature");return await u.json()})()}async function ye({client:i,payload:e,storage:t}){const a=await t.getAuthCookie(),r=t.ecosystem,l=g(i,r);if(!a)throw new Error("No auth token found when signing message");const c={address:e.address,chainId:e.chainId,nonce:Number(e.nonce)},n=await l(`${p("inAppWallet")}/api/v1/enclave-wallet/sign-authorization`,{body:w(c),headers:{Authorization:`Bearer embedded-wallet-token:${a}`,"Content-Type":"application/json","x-thirdweb-client-id":i.clientId},method:"POST"});if(!n.ok)throw new Error(`Failed to sign message - ${n.status} ${n.statusText}`);return await n.json()}async function be({client:i,payload:{message:e,isRaw:t,originalMessage:a,chainId:r},storage:l}){const c=await l.getAuthCookie(),n=l.ecosystem,o=g(i,n);if(!c)throw new Error("No auth token found when signing message");const s=await o(`${p("inAppWallet")}/api/v1/enclave-wallet/sign-message`,{body:w({messagePayload:{chainId:r,isRaw:t,message:e,originalMessage:a}}),headers:{Authorization:`Bearer embedded-wallet-token:${c}`,"Content-Type":"application/json","x-thirdweb-client-id":i.clientId},method:"POST"});if(!s.ok)throw new Error(`Failed to sign message - ${s.status} ${s.statusText}`);return await s.json()}async function Ie({client:i,payload:e,storage:t}){const a=await t.getAuthCookie(),r=t.ecosystem,l=g(i,r);if(!a)throw new Error("No auth token found when signing transaction");const c=await l(`${p("inAppWallet")}/api/v1/enclave-wallet/sign-transaction`,{body:w({transactionPayload:e}),headers:{Authorization:`Bearer embedded-wallet-token:${a}`,"Content-Type":"application/json","x-thirdweb-client-id":i.clientId},method:"POST"});if(!c.ok)throw new Error(`Failed to sign transaction - ${c.status} ${c.statusText}`);return(await c.json()).signature}async function ve({client:i,payload:e,storage:t}){const a=await t.getAuthCookie(),r=t.ecosystem,l=g(i,r);if(!a)throw new Error("No auth token found when signing typed data");const c=await l(`${p("inAppWallet")}/api/v1/enclave-wallet/sign-typed-data`,{body:w({...e}),headers:{Authorization:`Bearer embedded-wallet-token:${a}`,"Content-Type":"application/json","x-thirdweb-client-id":i.clientId},method:"POST"});if(!c.ok)throw new Error(`Failed to sign typed data - ${c.status} ${c.statusText}`);return await c.json()}class ke{constructor({client:e,ecosystem:t,address:a,storage:r}){Object.defineProperty(this,"client",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ecosystem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"address",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"localStorage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.client=e,this.ecosystem=t,this.address=a,this.localStorage=r}async postWalletSetUp(e){await this.localStorage.saveAuthCookie(e.storedToken.cookieString)}async getUserWalletStatus(){var l,c;const e=await this.localStorage.getAuthCookie();if(!e)return{status:"Logged Out"};const t=await A({authToken:e,client:this.client,ecosystem:this.ecosystem});if(!t)return{status:"Logged Out"};const a=t.wallets[0],r={email:(l=t.linkedAccounts.find(n=>n.details.email!==void 0))==null?void 0:l.details.email,phoneNumber:(c=t.linkedAccounts.find(n=>n.details.phone!==void 0))==null?void 0:c.details.phone,recoveryShareManagement:"ENCLAVE",userWalletId:t.id||""};return a?{account:await this.getAccount(),authDetails:r,status:"Logged In, Wallet Initialized",walletAddress:a.address}:{authDetails:r,status:"Logged In, Wallet Uninitialized"}}async getAccount(){const e=this.client,t=this.localStorage,a=this.address,r=this.ecosystem,l=async n=>{const o=P({chain:I(n.chainId),client:e}),s={chainId:W(n.chainId),data:n.data,gas:m(n.gas),nonce:m(n.nonce)||W(await y(async()=>{const{eth_getTransactionCount:d}=await import("./eth_getTransactionCount-jDyG_Ia6.js");return{eth_getTransactionCount:d}},__vite__mapDeps([0,1,2,3,4,5,6])).then(({eth_getTransactionCount:d})=>d(o,{address:b(this.address),blockTag:"pending"}))),to:n.to?b(n.to):void 0,value:m(n.value)};return n.authorizationList&&n.authorizationList.length>0?(s.type=4,s.authorizationList=n.authorizationList,s.maxFeePerGas=m(n.maxFeePerGas),s.maxPriorityFeePerGas=m(n.maxPriorityFeePerGas)):m(n.maxFeePerGas)?(s.maxFeePerGas=m(n.maxFeePerGas),s.maxPriorityFeePerGas=m(n.maxPriorityFeePerGas),s.type=2):(s.gasPrice=m(n.gasPrice),s.type=0),Ie({client:e,payload:s,storage:t})},c={address:b(a),async sendTransaction(n){const o=P({chain:I(n.chainId),client:e}),s=await l(n),d=await N(o,s);return B({chainId:n.chainId,client:e,contractAddress:n.to??void 0,ecosystem:r,gasPrice:n.gasPrice,transactionHash:d,walletAddress:a,walletType:"inApp"}),{transactionHash:d}},async signAuthorization(n){const o=await ye({client:e,payload:n,storage:t});return{address:b(o.address),chainId:Number.parseInt(o.chainId),nonce:BigInt(o.nonce),r:BigInt(o.r),s:BigInt(o.s),yParity:Number.parseInt(o.yParity)}},async signMessage({message:n,originalMessage:o,chainId:s}){const d=typeof n=="string"?{chainId:s,isRaw:!1,message:n,originalMessage:o}:{chainId:s,isRaw:!0,message:typeof n.raw=="string"?n.raw:X(n.raw),originalMessage:o},{signature:h}=await be({client:e,payload:d,storage:t});return h},async signTransaction(n){if(!n.chainId)throw new Error("chainId required in tx to sign");return l({chainId:n.chainId,...n})},async signTypedData(n){const o=D(n),{signature:s}=await ve({client:e,payload:o,storage:t});return s},sendCalls:async n=>{const{inAppWalletSendCalls:o}=await y(async()=>{const{inAppWalletSendCalls:f}=await import("./in-app-wallet-calls-D-eIKfO6.js");return{inAppWalletSendCalls:f}},__vite__mapDeps([7,8,9,1,2,3,4,5,6,10,11,12,13,14,15,16,17,18,19,20,21])),s=n.calls[0];if(!s)throw new Error("No calls to send");const d=s.client,h=s.chain||n.chain,u=await o({account:c,calls:n.calls,chain:h});return{chain:h,client:d,id:u}},getCallsStatus:async n=>{const{inAppWalletGetCallsStatus:o}=await y(async()=>{const{inAppWalletGetCallsStatus:s}=await import("./in-app-wallet-calls-D-eIKfO6.js");return{inAppWalletGetCallsStatus:s}},__vite__mapDeps([7,8,9,1,2,3,4,5,6,10,11,12,13,14,15,16,17,18,19,20,21]));return o(n)},getCallsStatusRaw:async n=>{const{inAppWalletGetCallsStatusRaw:o}=await y(async()=>{const{inAppWalletGetCallsStatusRaw:s}=await import("./in-app-wallet-calls-D-eIKfO6.js");return{inAppWalletGetCallsStatusRaw:s}},__vite__mapDeps([7,8,9,1,2,3,4,5,6,10,11,12,13,14,15,16,17,18,19,20,21]));return o(n)},getCapabilities:async n=>({[n.chainId??1]:{atomic:{status:"unsupported"},paymasterService:{supported:!1}}})};return c}}function m(i){return i===void 0||ee(i)?i:W(i)}const Te={backgroundColor:"transparent",border:"none",colorScheme:"light",display:"none",height:"100%",pointerEvents:"all",position:"fixed",right:"0px",top:"0px",width:"100%",zIndex:"2147483646"},L=new Map;class Le{constructor({link:e,baseUrl:t,iframeId:a,container:r,onIframeInitialize:l,localStorage:c,clientId:n,ecosystem:o}){if(Object.defineProperty(this,"iframe",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"POLLING_INTERVAL_SECONDS",{enumerable:!0,configurable:!0,writable:!0,value:1.4}),Object.defineProperty(this,"iframeBaseUrl",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"localStorage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"clientId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ecosystem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.localStorage=c,this.clientId=n,this.ecosystem=o,this.iframeBaseUrl=t,typeof document>"u")return;r=r??document.body;let s=document.getElementById(a);const d=new URL(e);if(!s||s.src!==d.href){s=document.createElement("iframe");const h={...Te};Object.assign(s.style,h),s.setAttribute("id",a),s.setAttribute("fetchpriority","high"),r.appendChild(s),s.src=d.href;const u=f=>{if(f.data.eventType==="ewsIframeLoaded"){if(window.removeEventListener("message",u),!s){console.warn("thirdweb iFrame not found");return}this.onIframeLoadHandler(s,l)()}};window.addEventListener("message",u)}this.iframe=s}async onIframeLoadedInitVariables(){var e,t;return{authCookie:await this.localStorage.getAuthCookie(),clientId:this.clientId,deviceShareStored:await this.localStorage.getDeviceShare(),ecosystemId:(e=this.ecosystem)==null?void 0:e.id,partnerId:(t=this.ecosystem)==null?void 0:t.partnerId,walletUserId:await this.localStorage.getWalletUserId()}}onIframeLoadHandler(e,t){return async()=>{var l;const a=new MessageChannel,r=new Promise((c,n)=>{a.port1.onmessage=o=>{const{data:s}=o;a.port1.close(),s.success||n(new Error(s.error)),L.set(e.src,!0),t&&t(),c(!0)}});(l=e==null?void 0:e.contentWindow)==null||l.postMessage({data:await this.onIframeLoadedInitVariables(),eventType:"initIframe"},this.iframeBaseUrl,[a.port2]),await r}}async call({procedureName:e,params:t,showIframe:a=!1}){var c;if(!this.iframe)throw new Error("Iframe not found. You are likely calling this from the backend where the DOM is not available.");for(;!L.get(this.iframe.src);)await k(this.POLLING_INTERVAL_SECONDS*1e3);a&&(this.iframe.style.display="block",await k(.005*1e3));const r=new MessageChannel,l=new Promise((n,o)=>{r.port1.onmessage=async s=>{const{data:d}=s;r.port1.close(),a&&(await k(.1*1e3),this.iframe&&(this.iframe.style.display="none")),d.success?n(d.data):o(new Error(d.error))}});return(c=this.iframe.contentWindow)==null||c.postMessage({data:{...t,...await this.onIframeLoadedInitVariables()},eventType:e},this.iframeBaseUrl,[r.port2]),l}destroy(){this.iframe&&L.delete(this.iframe.src)}}class Pe extends Le{constructor({clientId:e,baseUrl:t,ecosystem:a}){super({baseUrl:t,clientId:e,container:typeof document>"u"?void 0:document.body,ecosystem:a,iframeId:Ae+((a==null?void 0:a.id)||""),link:We({baseUrl:t,clientId:e,ecosystem:a,path:H}).href,localStorage:new F({clientId:e,ecosystem:a,storage:U})}),this.clientId=e,this.ecosystem=a}}function We({clientId:i,baseUrl:e,path:t,ecosystem:a,queryParams:r}){var c;const l=new URL(`${t}`,e);if(r)for(const n of Object.keys(r))l.searchParams.set(n,((c=r[n])==null?void 0:c.toString())||"");return l.searchParams.set("clientId",i),(a==null?void 0:a.partnerId)!==void 0&&l.searchParams.set("partnerId",a.partnerId),(a==null?void 0:a.id)!==void 0&&l.searchParams.set("ecosystemId",a.id),l}const Ae="thirdweb-in-app-wallet-iframe";async function Se({client:i,ecosystem:e,authToken:t}){const r=await g(i,e)(`${p("inAppWallet")}/api/v1/enclave-wallet/generate`,{headers:{Authorization:`Bearer embedded-wallet-token:${t}`,"Content-Type":"application/json","x-thirdweb-client-id":i.clientId},method:"POST"});if(!r.ok)throw new Error(`Failed to generate wallet - ${r.status} ${r.statusText}`);const{wallet:l}=await r.json();return l}class Ee{constructor({baseUrl:e,querier:t,preLogin:a,postLogin:r,client:l,ecosystem:c}){Object.defineProperty(this,"LoginQuerier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"preLogin",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"postLogin",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"client",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"baseUrl",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ecosystem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.baseUrl=e,this.LoginQuerier=t,this.preLogin=a,this.postLogin=r,this.client=l,this.ecosystem=c}async sendEmailLoginOtp({email:e}){return await this.LoginQuerier.call({params:{email:e},procedureName:"sendThirdwebEmailLoginOtp"})}async sendSmsLoginOtp({phoneNumber:e}){return await this.LoginQuerier.call({params:{phoneNumber:e},procedureName:"sendThirdwebSmsLoginOtp"})}}class Oe extends Ee{async authenticateWithModal(){return this.LoginQuerier.call({params:void 0,procedureName:"loginWithThirdwebModal",showIframe:!0})}async loginWithModal(){await this.preLogin();const e=await this.authenticateWithModal();return this.postLogin(e)}async authenticateWithIframe({email:e}){return this.LoginQuerier.call({params:{email:e},procedureName:"loginWithThirdwebModal",showIframe:!0})}async loginWithIframe({email:e}){await this.preLogin();const t=await this.authenticateWithIframe({email:e});return this.postLogin(t)}async authenticateWithCustomJwt({encryptionKey:e,jwt:t}){if(!e||e.length===0)throw new Error("Encryption key is required for custom jwt auth");return this.LoginQuerier.call({params:{encryptionKey:e,jwt:t},procedureName:"loginWithCustomJwt"})}async loginWithCustomJwt({encryptionKey:e,jwt:t}){if(!e||e.length===0)throw new Error("Encryption key is required for custom jwt auth");await this.preLogin();const a=await this.authenticateWithCustomJwt({encryptionKey:e,jwt:t});return this.postLogin(a)}async authenticateWithCustomAuthEndpoint({encryptionKey:e,payload:t}){return this.LoginQuerier.call({params:{encryptionKey:e,payload:t},procedureName:"loginWithCustomAuthEndpoint"})}async loginWithCustomAuthEndpoint({encryptionKey:e,payload:t}){if(!e||e.length===0)throw new Error("Encryption key is required for custom auth");await this.preLogin();const a=await this.authenticateWithCustomAuthEndpoint({encryptionKey:e,payload:t});return this.postLogin(a)}async authenticateWithEmailOtp({email:e,otp:t,recoveryCode:a}){return this.LoginQuerier.call({params:{email:e,otp:t,recoveryCode:a},procedureName:"verifyThirdwebEmailLoginOtp"})}async loginWithEmailOtp({email:e,otp:t,recoveryCode:a}){const r=await this.authenticateWithEmailOtp({email:e,otp:t,recoveryCode:a});return this.postLogin(r)}async authenticateWithSmsOtp({phoneNumber:e,otp:t,recoveryCode:a}){return this.LoginQuerier.call({params:{otp:t,phoneNumber:e,recoveryCode:a},procedureName:"verifyThirdwebSmsLoginOtp"})}async loginWithSmsOtp({phoneNumber:e,otp:t,recoveryCode:a}){const r=await this.authenticateWithSmsOtp({otp:t,phoneNumber:e,recoveryCode:a});return this.postLogin(r)}}class Ce{constructor({client:e,querier:t,onAuthSuccess:a,ecosystem:r,baseUrl:l,localStorage:c}){Object.defineProperty(this,"client",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ecosystem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"AuthQuerier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"localStorage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"onAuthSuccess",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"BaseLogin",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.client=e,this.ecosystem=r,this.AuthQuerier=t,this.localStorage=c,this.onAuthSuccess=a,this.BaseLogin=new Oe({baseUrl:l,client:e,ecosystem:r,postLogin:async n=>this.postLogin(n),preLogin:async()=>{await this.preLogin()},querier:t})}async preLogin(){await this.logout()}async postLogin({storedToken:e,walletDetails:t}){return e.shouldStoreCookieString&&await this.localStorage.saveAuthCookie(e.cookieString),await this.onAuthSuccess({storedToken:e,walletDetails:t})}async loginWithAuthToken(e,t){var l;e.storedToken.authProvider!=="Backend"&&await this.preLogin();const a=await A({authToken:e.storedToken.cookieString,client:this.client,ecosystem:this.ecosystem});if(!a)throw new Error("Cannot login, no user found for auth token");if(a.wallets.length>0&&((l=a.wallets[0])==null?void 0:l.type)==="enclave")return this.postLogin({storedToken:e.storedToken,walletDetails:{walletAddress:a.wallets[0].address}});if(a.wallets.length===0){const c=await Se({authToken:e.storedToken.cookieString,client:this.client,ecosystem:this.ecosystem});return this.postLogin({storedToken:e.storedToken,walletDetails:{walletAddress:c.address}})}const r=await this.AuthQuerier.call({params:{recoveryCode:t,storedToken:e.storedToken},procedureName:"loginWithStoredTokenDetails"});return this.postLogin(r)}async loginWithModal(){return this.BaseLogin.loginWithModal()}async authenticateWithModal(){return this.BaseLogin.authenticateWithModal()}async loginWithIframe(e){return this.BaseLogin.loginWithIframe(e)}async authenticateWithIframe(e){return this.BaseLogin.authenticateWithIframe(e)}async loginWithCustomJwt(e){return this.BaseLogin.loginWithCustomJwt(e)}async authenticateWithCustomJwt(e){return this.BaseLogin.authenticateWithCustomJwt(e)}async loginWithCustomAuthEndpoint(e){return this.BaseLogin.loginWithCustomAuthEndpoint(e)}async authenticateWithCustomAuthEndpoint(e){return this.BaseLogin.authenticateWithCustomAuthEndpoint(e)}async sendEmailLoginOtp({email:e}){return this.BaseLogin.sendEmailLoginOtp({email:e})}async sendSmsLoginOtp({phoneNumber:e}){return this.BaseLogin.sendSmsLoginOtp({phoneNumber:e})}async loginWithEmailOtp(e){return await this.preLogin(),this.BaseLogin.loginWithEmailOtp(e)}async authenticateWithEmailOtp(e){return this.BaseLogin.authenticateWithEmailOtp(e)}async loginWithSmsOtp(e){return await this.preLogin(),this.BaseLogin.loginWithSmsOtp(e)}async authenticateWithSmsOtp(e){return this.BaseLogin.authenticateWithSmsOtp(e)}async logout(){const e=await this.localStorage.removeAuthCookie(),t=await this.localStorage.removeWalletUserId();return{success:e||t}}}const $e="width=350, height=500",C=({isWindowOpenedByFn:i,win:e,closeOpenedWindow:t})=>{i?e==null||e.close():e&&t?t(e):e&&e.close()};async function $(i){const e=v({...i,mode:i.mode||"redirect",authFlow:i.authFlow});i.mode==="redirect"?window.location.href=e:window.open(e),await new Promise(t=>setTimeout(t,5e3))}const je=async i=>{let e=i.openedWindow,t=!1;if(e||(e=window.open(v({...i,mode:"popup"}),`Login to ${i.authOption}`,$e),t=!0),!e)throw new Error("Something went wrong opening pop-up");return await new Promise((r,l)=>{const c=window.setInterval(async()=>{e.closed&&(clearInterval(c),window.removeEventListener("message",n),l(new Error("User closed login window")))},1e3),n=async o=>{if(o.origin===p("inAppWallet")){if(typeof o.data!="object"){l(new Error("Invalid event data"));return}switch(o.data.eventType){case"oauthSuccessResult":{window.removeEventListener("message",n),clearInterval(c),C({closeOpenedWindow:i.closeOpenedWindow,isWindowOpenedByFn:t,win:e}),o.data.authResult&&r(o.data.authResult);break}case"oauthFailureResult":{window.removeEventListener("message",n),clearInterval(c),C({closeOpenedWindow:i.closeOpenedWindow,isWindowOpenedByFn:t,win:e}),l(new Error(o.data.errorString));break}}}};window.addEventListener("message",n)})},_e=async i=>{const{client:e,ecosystem:t}=i,a=v({authOption:i.strategy,client:e,ecosystem:t}),r={"Content-Type":"application/json","x-client-id":e.clientId};t!=null&&t.id&&(r["x-ecosystem-id"]=t.id),t!=null&&t.partnerId&&(r["x-ecosystem-partner-id"]=t.partnerId);const l=(()=>{switch(i.strategy){case"email":return{email:i.email};case"phone":return{phone:i.phoneNumber}}})(),c=await fetch(a,{body:w(l),headers:r,method:"POST"});if(!c.ok){const n=await c.text();let o;try{const s=JSON.parse(n);s&&typeof s.message=="string"&&(o=s.message)}catch{}throw new Error(o||"Failed to send verification code")}return await c.json()},j=async i=>{const{client:e,ecosystem:t}=i,a=S({authOption:i.strategy,client:i.client,ecosystem:i.ecosystem}),r={"Content-Type":"application/json","x-client-id":e.clientId};t!=null&&t.id&&(r["x-ecosystem-id"]=t.id),t!=null&&t.partnerId&&(r["x-ecosystem-partner-id"]=t.partnerId);const l=(()=>{switch(i.strategy){case"email":return{code:i.verificationCode,email:i.email};case"phone":return{code:i.verificationCode,phone:i.phoneNumber}}})(),c=await fetch(a,{body:w(l),headers:r,method:"POST"});if(!c.ok)throw new Error("Failed to verify verification code");return await c.json()};class _{constructor({client:e,ecosystem:t,querier:a,localStorage:r}){Object.defineProperty(this,"client",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ecosystem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"walletManagerQuerier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"localStorage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.client=e,this.ecosystem=t,this.walletManagerQuerier=a,this.localStorage=r}async postWalletSetUp(e){e.deviceShareStored&&await this.localStorage.saveDeviceShare(e.deviceShareStored,e.storedToken.authDetails.userWalletId)}async getUserWalletStatus(){const e=await this.walletManagerQuerier.call({params:void 0,procedureName:"getUserStatus"});return e.status==="Logged In, Wallet Initialized"?{status:"Logged In, Wallet Initialized",...e.user,account:await this.getAccount()}:e.status==="Logged In, New Device"?{status:"Logged In, New Device",...e.user}:e.status==="Logged In, Wallet Uninitialized"?{status:"Logged In, Wallet Uninitialized",...e.user}:{status:e.status}}async getAccount(){var c;const e=this.walletManagerQuerier,t=this.client,a=(c=this.ecosystem)==null?void 0:c.partnerId,{address:r}=await e.call({params:void 0,procedureName:"getAddress"}),l=async n=>{const o={chainId:n.chainId,data:n.data,gasLimit:n.gas,nonce:n.nonce,to:n.to??void 0,value:n.value};n.maxFeePerGas?(o.accessList=n.accessList,o.maxFeePerGas=n.maxFeePerGas,o.maxPriorityFeePerGas=n.maxPriorityFeePerGas,o.type=2):(o.gasPrice=n.gasPrice,o.type=0);const s=O().rpc,{signedTransaction:d}=await e.call({params:{chainId:n.chainId,partnerId:a,rpcEndpoint:`https://${n.chainId}.${s}`,transaction:o},procedureName:"signTransaction"});return d};return{address:b(r),async sendTransaction(n){const o=P({chain:I(n.chainId),client:t}),s=await l(n),d=await N(o,s);return B({chainId:n.chainId,client:t,contractAddress:n.to??void 0,gasPrice:n.gasPrice,transactionHash:d,walletAddress:r,walletType:"inApp"}),{transactionHash:d}},async signMessage({message:n}){const o=typeof n=="string"?n:n.raw instanceof Uint8Array?n.raw:te(n.raw),{signedMessage:s}=await e.call({params:{chainId:1,message:o,partnerId:a},procedureName:"signMessage"});return s},async signTransaction(n){if(!n.chainId)throw new Error("chainId required in tx to sign");return l({...n,chainId:n.chainId})},async signTypedData(n){var E;const o=D(n);(E=o.types)!=null&&E.EIP712Domain&&(o.types.EIP712Domain=void 0);const s=o.domain,d=s==null?void 0:s.chainId,u={...s!=null&&s.verifyingContract?{verifyingContract:s==null?void 0:s.verifyingContract}:{},name:s==null?void 0:s.name,version:s==null?void 0:s.version};d&&(u.chainId=d);const f=O().rpc,{signedTypedData:V}=await e.call({params:{chainId:Number.parseInt(BigInt(d||1).toString()),domain:u,message:o.message,partnerId:a,rpcEndpoint:`https://${d}.${f}`,types:o.types},procedureName:"signTypedDataV4"});return V}}}}class Xe{isClientIdLegacyPaper(e){return e.indexOf("-")>0&&e.length===36}constructor({client:e,onAuthSuccess:t,ecosystem:a,passkeyDomain:r,storage:l}){if(Object.defineProperty(this,"client",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ecosystem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"querier",{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,"wallet",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"auth",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"passkeyDomain",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.isClientIdLegacyPaper(e.clientId))throw new Error("You are using a legacy clientId. Please use the clientId found on the thirdweb dashboard settings page");const c=p("inAppWallet");this.client=e,this.ecosystem=a,this.passkeyDomain=r,this.storage=new F({clientId:e.clientId,ecosystem:a,storage:l??Fe()}),this.querier=new Pe({baseUrl:c,clientId:e.clientId,ecosystem:a}),this.auth=new Ce({baseUrl:c,client:e,ecosystem:a,localStorage:this.storage,onAuthSuccess:async n=>{if(t==null||t(n),n.storedToken.authDetails.walletType==="sharded"&&(await this.querier.call({params:{storedToken:n.storedToken},procedureName:"migrateFromShardToEnclave"})||console.warn("Failed to migrate from sharded to enclave wallet, continuing with sharded wallet")),this.wallet=await this.initializeWallet(n.storedToken.cookieString),!this.wallet)throw new Error("Failed to initialize wallet");const o="deviceShareStored"in n.walletDetails?n.walletDetails.deviceShareStored:void 0;return await this.wallet.postWalletSetUp({deviceShareStored:o,storedToken:n.storedToken}),this.wallet instanceof _&&await this.querier.call({params:{authCookie:n.storedToken.cookieString,clientId:this.client.clientId,deviceShareStored:"deviceShareStored"in n.walletDetails?n.walletDetails.deviceShareStored:null,ecosystemId:a==null?void 0:a.id,partnerId:a==null?void 0:a.partnerId,walletUserId:n.storedToken.authDetails.userWalletId},procedureName:"initIframe"}),{user:{account:await this.wallet.getAccount(),authDetails:n.storedToken.authDetails,status:"Logged In, Wallet Initialized",walletAddress:n.walletDetails.walletAddress}}},querier:this.querier})}async initializeWallet(e){var r;const t=await this.storage.getAuthCookie();if(!e&&t===null)throw new Error("No auth token provided and no stored auth token found to initialize the wallet");const a=await A({authToken:e||t,client:this.client,ecosystem:this.ecosystem});if(!a)throw new Error("Cannot initialize wallet, no user logged in");if(a.wallets.length===0)throw new Error("Cannot initialize wallet, this user does not have a wallet generated yet");return((r=a.wallets[0])==null?void 0:r.type)==="enclave"?new ke({address:a.wallets[0].address,client:this.client,ecosystem:this.ecosystem,storage:this.storage}):new _({client:this.client,ecosystem:this.ecosystem,localStorage:this.storage,querier:this.querier})}async getUser(){if(!this.wallet){const e=await this.storage.getAuthCookie();if(!e)return{status:"Logged Out"};this.wallet=await this.initializeWallet(e)}if(!this.wallet)throw new Error("Wallet not initialized");return await this.wallet.getUserWalletStatus()}getAccount(){if(!this.wallet)throw new Error("Wallet not initialized");return this.wallet.getAccount()}async preAuthenticate(e){return _e({...e,client:this.client,ecosystem:this.ecosystem})}async authenticateWithRedirect(e,t,a){return $({authOption:e,client:this.client,ecosystem:this.ecosystem,mode:t,redirectUrl:a})}async loginWithAuthToken(e,t){return this.auth.loginWithAuthToken(e,t)}async authenticate(e){const t=e.strategy;switch(t){case"email":return j({...e,client:this.client,ecosystem:this.ecosystem});case"phone":return j({...e,client:this.client,ecosystem:this.ecosystem});case"auth_endpoint":return oe({client:this.client,ecosystem:this.ecosystem,payload:e.payload});case"jwt":return de({client:this.client,ecosystem:this.ecosystem,jwt:e.jwt});case"passkey":return this.passkeyAuth(e);case"iframe_email_verification":return this.auth.authenticateWithIframe({email:e.email});case"iframe":return this.auth.authenticateWithModal();case"apple":case"facebook":case"google":case"telegram":case"github":case"twitch":case"farcaster":case"line":case"x":case"tiktok":case"epic":case"steam":case"coinbase":case"discord":return je({authOption:t,client:this.client,closeOpenedWindow:e.closeOpenedWindow,ecosystem:this.ecosystem,openedWindow:e.openedWindow});case"guest":return le({client:this.client,ecosystem:this.ecosystem,storage:this.storage});case"backend":return ce({client:this.client,ecosystem:this.ecosystem,walletSecret:e.walletSecret});case"wallet":return fe({client:this.client,ecosystem:this.ecosystem,wallet:e.wallet,chain:e.chain})}}async connect(e){const t=e.strategy;switch(t){case"auth_endpoint":case"jwt":{const a=await this.authenticate(e);return await this.loginWithAuthToken(a,e.encryptionKey)}case"iframe_email_verification":return this.auth.loginWithIframe({email:e.email});case"iframe":return this.auth.loginWithModal();case"passkey":{const a=await this.passkeyAuth(e);return this.loginWithAuthToken(a)}case"backend":case"phone":case"email":case"wallet":case"apple":case"facebook":case"google":case"farcaster":case"telegram":case"github":case"line":case"x":case"tiktok":case"epic":case"guest":case"coinbase":case"twitch":case"steam":case"discord":{const a=await this.authenticate(e);return await this.auth.loginWithAuthToken(a)}default:De(t)}}async logout(){return await this.auth.logout()}async passkeyAuth(e){const{PasskeyWebClient:t}=await y(async()=>{const{PasskeyWebClient:n}=await import("./passkeys-CW4jmTtA.js");return{PasskeyWebClient:n}},__vite__mapDeps([22,23])),{passkeyName:a,storeLastUsedPasskey:r=!0}=e,l=new t,c=this.storage;return e.type==="sign-up"?ue({client:this.client,ecosystem:this.ecosystem,passkeyClient:l,rp:{id:this.passkeyDomain??window.location.hostname,name:this.passkeyDomain??window.document.title},storage:r?c:void 0,username:a}):he({client:this.client,ecosystem:this.ecosystem,passkeyClient:l,rp:{id:this.passkeyDomain??window.location.hostname,name:this.passkeyDomain??window.document.title},storage:r?c:void 0})}async linkProfileWithRedirect(e,t,a){return $({authOption:e,client:this.client,ecosystem:this.ecosystem,mode:t,redirectUrl:a,authFlow:"link"})}async linkProfile(e){if("strategy"in e&&J.includes(e.strategy)&&"mode"in e&&e.mode!=="popup"&&e.mode!==void 0)return await this.linkProfileWithRedirect(e.strategy,e.mode,"redirectUrl"in e?e.redirectUrl:void 0),[];const{storedToken:t}=await this.authenticate(e);return await Y({client:e.client,ecosystem:e.ecosystem||this.ecosystem,storage:this.storage,tokenToLink:t.cookieString})}async unlinkProfile(e,t){return await Z({allowAccountDeletion:t,client:this.client,ecosystem:this.ecosystem,profileToUnlink:e,storage:this.storage})}async getProfiles(){return K({client:this.client,ecosystem:this.ecosystem,storage:this.storage})}}function De(i,e){throw new Error(`Invalid param: ${i}`)}function Fe(){return typeof window<"u"&&window.localStorage?U:ie}export{Xe as InAppWebConnector};