@dcl/blog-site 0.2.2 → 0.2.3-23948667956.commit-cfe47f9

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 (302) hide show
  1. package/assets/QueryClientProvider-mZKMZTwe.js +2 -0
  2. package/assets/RoobertPRO-Bold-DDyOqNrI.woff2 +0 -0
  3. package/assets/SignInRedirect-CXUOqOjy.js +11 -0
  4. package/assets/X-3yocgepi.js +15 -0
  5. package/assets/___vite-browser-external_commonjs-proxy-BqV5D26a.js +1 -0
  6. package/assets/__federation_expose_App-CMGDAIUH.js +1 -0
  7. package/assets/__federation_fn_import-C51lglKS.js +1 -0
  8. package/assets/__federation_shared_@dcl/hooks-Dm9PRmKy.js +535 -0
  9. package/assets/__federation_shared_@dcl/schemas-CVwtHlVJ.js +1 -0
  10. package/assets/__federation_shared_@emotion/react-AmEOkpjC.js +1 -0
  11. package/assets/__federation_shared_@emotion/styled-aZ9bk9Xh.js +1 -0
  12. package/assets/__federation_shared_@reduxjs/toolkit-DIZvwqf7.js +1 -0
  13. package/assets/__federation_shared_decentraland-ui2-KxrbFOTA.js +358 -0
  14. package/assets/__federation_shared_react-B3tlNTLg.js +1 -0
  15. package/assets/__federation_shared_react-dom-CCS4dT_K.js +1 -0
  16. package/assets/__federation_shared_react-redux-Ckcz2edF.js +13 -0
  17. package/assets/__federation_shared_react-router-dom-jUWpDOjR.js +49 -0
  18. package/assets/__federation_shared_viem-Cdp7wK0V.js +2 -0
  19. package/assets/__federation_shared_wagmi-CHWRoybR.js +17 -0
  20. package/assets/__vite-optional-peer-dep_lottie-react_decentraland-ui2-BIHI7g3E.js +1 -0
  21. package/assets/_commonjsHelpers-C4iS2aBk.js +1 -0
  22. package/assets/{add-Dnkf3E3Q.js → add-DHMb_tRw.js} +2 -2
  23. package/assets/all-wallets-Bo3QRxXL.js +6 -0
  24. package/assets/{app-store-C9FH4_zP.js → app-store-BHwDXU8D.js} +2 -2
  25. package/assets/{apple-Dm5w1W69.js → apple-BFX-plRw.js} +2 -2
  26. package/assets/arrow-bottom-Djx9NXV2.js +8 -0
  27. package/assets/{arrow-bottom-circle-Bgw9yiHN.js → arrow-bottom-circle-DcJnW2eo.js} +2 -2
  28. package/assets/arrow-left-BS_dJGSP.js +8 -0
  29. package/assets/arrow-right-B-mwy0Iu.js +8 -0
  30. package/assets/arrow-top-Di1bbZG1.js +8 -0
  31. package/assets/auto-track-pkMvCaah.js +1 -0
  32. package/assets/{bank-qNUWniDB.js → bank-B9SMq-ix.js} +2 -2
  33. package/assets/{basic-DJvhbg9L.js → basic-DijYF-IW.js} +124 -124
  34. package/assets/biconomy-CCw3vtwR.js +1 -0
  35. package/assets/{browser-Du0KKb8R.js → browser-CdKdszu-.js} +2 -2
  36. package/assets/{card-BpDAuOwe.js → card-CQu4Eu8c.js} +2 -2
  37. package/assets/ccip-AgQ5AD9v.js +1 -0
  38. package/assets/chains-D88UzVoE.js +1 -0
  39. package/assets/{checkmark-srdyV91l.js → checkmark-D2vezo75.js} +2 -2
  40. package/assets/{checkmark-bold-BYtPga6u.js → checkmark-bold-DriAapzP.js} +2 -2
  41. package/assets/chevron-bottom-CcFEOVdH.js +8 -0
  42. package/assets/chevron-left-BXS-ybhL.js +8 -0
  43. package/assets/chevron-right-TvO5COya.js +8 -0
  44. package/assets/chevron-top-D84SgxMg.js +8 -0
  45. package/assets/{chrome-store-D-UYtj15.js → chrome-store-rpsfVQln.js} +2 -2
  46. package/assets/{clock-BGyfn2Ix.js → clock-BMJ2gt7b.js} +2 -2
  47. package/assets/close-kAWkeKAP.js +8 -0
  48. package/assets/{coinPlaceholder-o1yCmFLN.js → coinPlaceholder-Dz8MKewa.js} +2 -2
  49. package/assets/common-D37S_OFt.js +1 -0
  50. package/assets/{compass-BrX88OdU.js → compass-BednEqu-.js} +2 -2
  51. package/assets/controller-D0Gc4Hsp.js +2 -0
  52. package/assets/{copy-CGKLgPMf.js → copy-D7rBk-hZ.js} +2 -2
  53. package/assets/core-Bn8Mr-tS.js +907 -0
  54. package/assets/create-submenu-Bu20F8-Z.webp +0 -0
  55. package/assets/createBundlerClient-DhRCLsYO.js +4 -0
  56. package/assets/createClient-C9QPJaZu.js +1 -0
  57. package/assets/cursor-C8UG2IDe.js +3 -0
  58. package/assets/{cursor-transparent--gaS-5ET.js → cursor-transparent-CyP0H3C5.js} +2 -2
  59. package/assets/decimals-B7Pm5rZk.js +1 -0
  60. package/assets/decimals-DedKFk8m.js +1 -0
  61. package/assets/defineChain-7I0Ce1VT.js +1 -0
  62. package/assets/{desktop-D3dzP-FX.js → desktop-LBcRpcZE.js} +2 -2
  63. package/assets/detectExtension-C2uVeK-n.js +1 -0
  64. package/assets/{disconnect-CsHX0nla.js → disconnect-DEBEe-yK.js} +2 -2
  65. package/assets/{discord-TnXCJHRv.js → discord-BlVFKMf0.js} +2 -2
  66. package/assets/emotion-react.browser.esm-BzYQLDSp.js +8 -0
  67. package/assets/emotion-use-insertion-effect-with-fallbacks.browser.esm-TsHx33zg.js +1 -0
  68. package/assets/encode-DvvW4ZKt.js +2 -0
  69. package/assets/engine-CD7SeAap.js +1 -0
  70. package/assets/estimate-gas-CeHGaIbG.js +3 -0
  71. package/assets/estimate-l1-fee-ClMO5l7U.js +1 -0
  72. package/assets/eth_estimateGas-C2ENZ_HR.js +1 -0
  73. package/assets/eth_getStorageAt-BHgF2qz5.js +1 -0
  74. package/assets/eth_getTransactionCount-DWnnw2mX.js +1 -0
  75. package/assets/ethereum-dN7ENYl_.js +1 -0
  76. package/assets/{etherscan-BNOTAlpJ.js → etherscan-C_pqcV9R.js} +2 -2
  77. package/assets/events-B5inrCVE.js +1 -0
  78. package/assets/{exclamation-triangle-3cTnBFEz.js → exclamation-triangle-R9Xq3IaG.js} +2 -2
  79. package/assets/explore-submenu-BFVuYMi9.webp +0 -0
  80. package/assets/{extension-C7i3kBcJ.js → extension-DkA_7Cbg.js} +2 -2
  81. package/assets/external-link-BPOw_fuW.js +8 -0
  82. package/assets/extractIPFS-B4LGER25.js +1 -0
  83. package/assets/{facebook-BtRXxuTh.js → facebook-CMZk_t1A.js} +2 -2
  84. package/assets/{farcaster-DuvCkOsj.js → farcaster-CveILPqa.js} +2 -2
  85. package/assets/fee-data-BKBGP5kG.js +1 -0
  86. package/assets/fetchTokenMetadata-BLDHgO8L.js +2 -0
  87. package/assets/{filters-q4uY0GXA.js → filters-BspTrZpX.js} +2 -2
  88. package/assets/get-ecosystem-wallet-info-D3PrM5FE.js +1 -0
  89. package/assets/getBalance-D7nzATjL.js +2 -0
  90. package/assets/getInstalledModules-Ck_Gj8FO.js +1 -0
  91. package/assets/getNFT-BcCS23O_.js +1 -0
  92. package/assets/getNFT-DXdMP0Q5.js +2 -0
  93. package/assets/{github-DdvkoPeB.js → github-DoFHEMIF.js} +2 -2
  94. package/assets/{google-d4Ql9qix.js → google-NTQi9GVe.js} +2 -2
  95. package/assets/governance-submenu-VTIKvCIL.webp +0 -0
  96. package/assets/{help-circle-BY_Weu8t.js → help-circle-DV0uNPdn.js} +2 -2
  97. package/assets/hex-B0Rx0hII.js +2 -0
  98. package/assets/{id-BJNb6vOI.js → id-UAVc1FOO.js} +1 -1
  99. package/assets/{image-DIsXNsXJ.js → image-BeHBzCPG.js} +2 -2
  100. package/assets/in-app-wallet-calls-CvFtsXP9.js +1 -0
  101. package/assets/index-B2OCb4Ez.js +1 -0
  102. package/assets/index-B65z14KI.js +4 -0
  103. package/assets/index-BAhlRyDG.js +1 -0
  104. package/assets/{index-DOqN8xaU.js → index-BTtTX-5z.js} +1 -1
  105. package/assets/index-BjzJcZq6.js +1 -0
  106. package/assets/index-BjzJcZq6__bundled.js +24 -0
  107. package/assets/index-BozJS3za.js +12 -0
  108. package/assets/index-C05H8NDX.js +1 -0
  109. package/assets/index-C1IoT2if.js +3 -0
  110. package/assets/index-C2hdqzGT.js +2 -0
  111. package/assets/index-CgMDPZul.js +13 -0
  112. package/assets/index-CjuQOkbh.js +2 -0
  113. package/assets/index-CpR9p5nk.js +1 -0
  114. package/assets/index-D1lXZVQu.js +45 -0
  115. package/assets/index-D6ZAha0r.js +395 -0
  116. package/assets/{index-X-a697cI.js → index-DJ7GgcJ9.js} +2 -2
  117. package/assets/index-DajuSfcu.js +2 -0
  118. package/assets/index-DeklogZX.js +1 -0
  119. package/assets/index-DmAaXUNv.js +1 -0
  120. package/assets/index-Dy0yjznp.js +1 -0
  121. package/assets/index-Dy0yjznp__bundled.js +9 -0
  122. package/assets/index-HvoTJwGm.js +1 -0
  123. package/assets/index-MYKNZAUu.js +8 -0
  124. package/assets/index-Tsk25L8E.js +1 -0
  125. package/assets/index.es-C8Kfv-K1.js +11 -0
  126. package/assets/index.es-CAXGMBEH.js +1 -0
  127. package/assets/index.es-D3pP9hN4.js +27 -0
  128. package/assets/index.es-D5YKsq2-.js +2 -0
  129. package/assets/index.umd-DK712HHb.js +1 -0
  130. package/assets/{info-BvPgRaaJ.js → info-CzcA85TO.js} +2 -2
  131. package/assets/{info-circle-sWcom9RD.js → info-circle-D3Mr3R9u.js} +2 -2
  132. package/assets/is-plan-event-enabled-DeNtQvA5.js +1 -0
  133. package/assets/json-BHzNJmTy.js +1 -0
  134. package/assets/jsx-runtime-DncYoG30.js +1 -0
  135. package/assets/jsx-runtime-DncYoG30__bundled.js +9 -0
  136. package/assets/learn-submenu-sfxVP5Db.webp +0 -0
  137. package/assets/{lightbulb-HJchniSu.js → lightbulb-B2FZtM_8.js} +2 -2
  138. package/assets/localBatchGatewayRequest-BIEAG3VG.js +1 -0
  139. package/assets/{mail-DlRijJmV.js → mail-CkhGbows.js} +2 -2
  140. package/assets/marketplace-submenu-CixWTv8_.webp +0 -0
  141. package/assets/{mobile-CoiDw6cg.js → mobile-1H3FtqAS.js} +2 -2
  142. package/assets/{more-LUiRL6x4.js → more-CZiQi624.js} +2 -2
  143. package/assets/{network-placeholder-Cj3jgVfo.js → network-placeholder-DA2bm2rC.js} +2 -2
  144. package/assets/{nftPlaceholder-LkhQmGFs.js → nftPlaceholder-C9t5Ydxp.js} +2 -2
  145. package/assets/off-D8z0OQ3M.js +8 -0
  146. package/assets/op-gas-fee-reducer-CfxMcvXl.js +1 -0
  147. package/assets/openzeppelin-ZKz6sLW9.js +1 -0
  148. package/assets/ownerOf-D1aXOt9Q.js +1 -0
  149. package/assets/parseNft-LjEwmOst.js +2 -0
  150. package/assets/passkeys-CTJ4NPfL.js +1 -0
  151. package/assets/{play-store-DBit2AoS.js → play-store-_X5LrPwx.js} +2 -2
  152. package/assets/{plus-CZe-WgSN.js → plus-JriDhMxt.js} +2 -2
  153. package/assets/preload-helper-BorDCKdG.js +1 -0
  154. package/assets/publicKeyToAddress-CxEKPAKT.js +1 -0
  155. package/assets/{qr-code-BhW7ZXY-.js → qr-code-DaB080BF.js} +2 -2
  156. package/assets/{qr-overlay-DsRPQv6v.js → qr-overlay-CGnFhcTk.js} +1 -1
  157. package/assets/{recycle-horizontal-DBnWoDRV.js → recycle-horizontal-CGeFmMrT.js} +2 -2
  158. package/assets/redux-BNDF-Lt-.js +1 -0
  159. package/assets/{refresh-qvocxvcf.js → refresh-Dgvxxw5C.js} +2 -2
  160. package/assets/remoteEntry.js +1 -0
  161. package/assets/{reown-logo-C-45v-AJ.js → reown-logo-CBX48aN9.js} +2 -2
  162. package/assets/resolveImplementation-Cb2bL1tx.js +1 -0
  163. package/assets/rich-text-react-renderer.es5-D_tE7AHo.js +2 -0
  164. package/assets/rpc-ti0b0r_u.js +3 -0
  165. package/assets/search-DamXBOxM.js +8 -0
  166. package/assets/secp256k1-UEF-yOzn.js +1 -0
  167. package/assets/{send-DI2x4DfJ.js → send-BLpUSx_G.js} +2 -2
  168. package/assets/send-batch-transaction-DnH876GL.js +1 -0
  169. package/assets/send-eip712-transaction-D_FU-Avh.js +2 -0
  170. package/assets/send-gasless-transaction-MP1Q_mLW.js +2 -0
  171. package/assets/serializeTransaction-mtsVBaO6.js +1 -0
  172. package/assets/session-proposal-CM3P7DaL.js +1 -0
  173. package/assets/session-request-Dqw67u3p.js +2 -0
  174. package/assets/sha256-DYtpy1Qz.js +1 -0
  175. package/assets/signing-BFeVjjPi.js +5 -0
  176. package/assets/store-DOLZnwHk.js +1 -0
  177. package/assets/{swapHorizontal-eTjjU7d8.js → swapHorizontal-Br-MZ1tO.js} +2 -2
  178. package/assets/{swapHorizontalBold-B86nJTAP.js → swapHorizontalBold-CkUNbZ1G.js} +2 -2
  179. package/assets/{swapHorizontalMedium-CNT7ELrN.js → swapHorizontalMedium-D3qEQNb5.js} +2 -2
  180. package/assets/{swapHorizontalRoundedBold-R_inXmIh.js → swapHorizontalRoundedBold-CzzBPCtt.js} +2 -2
  181. package/assets/{swapVertical-DBChOUj8.js → swapVertical-Mrn3zm_W.js} +2 -2
  182. package/assets/{telegram-DjYbgHgS.js → telegram-ZTLC9FiA.js} +2 -2
  183. package/assets/thirdweb-CHfVLLbM.js +1 -0
  184. package/assets/thirdweb-D5ezTmuN.js +27 -0
  185. package/assets/{three-dots-VoULPGrI.js → three-dots-DYl4uQjm.js} +2 -2
  186. package/assets/totalSupply-B5jHW8gx.js +1 -0
  187. package/assets/tslib.es6-DbvBTznf.js +1 -0
  188. package/assets/{twitch-ETBgqGHE.js → twitch-DPLkA98Q.js} +2 -2
  189. package/assets/{twitterIcon-N584dzfh.js → twitterIcon-BEY_UAyG.js} +2 -2
  190. package/assets/uid-D00jCazq.js +44 -0
  191. package/assets/{uint8-array-CjVHUazS.js → uint8-array-DZKEMhA1.js} +1 -1
  192. package/assets/utils-C7urdXtO.js +2 -0
  193. package/assets/utils-CozXUO91.js +1 -0
  194. package/assets/{verify-Dp4bztGk.js → verify-DuPdiufm.js} +2 -2
  195. package/assets/{verify-filled-B7WhO3Kn.js → verify-filled-CdqEW5AP.js} +2 -2
  196. package/assets/{w3m-modal-BmEHfmEu.js → w3m-modal-BLzhBUlF.js} +34 -34
  197. package/assets/wait-for-tx-receipt-B-o5aPQ8.js +1 -0
  198. package/assets/{wallet-tXSvlbUa.js → wallet-CZw1g3L8.js} +2 -2
  199. package/assets/{wallet-placeholder-B2e9Wl_u.js → wallet-placeholder-OAkoJuru.js} +2 -2
  200. package/assets/{walletconnect-D70wSjLs.js → walletconnect-BJ3w7-IU.js} +4 -4
  201. package/assets/wallets-Q5RcRyG6.js +16 -0
  202. package/assets/{warning-circle-CsTkZ4Rl.js → warning-circle-DpDeOZKv.js} +2 -2
  203. package/assets/web-connector-CB7tpRui.js +9 -0
  204. package/assets/webSocket-dQW3n9NM.js +3 -0
  205. package/assets/withCache-DYumIHzL.js +1 -0
  206. package/assets/{x-DwOCQuex.js → x-liJqLZUi.js} +2 -2
  207. package/assets/zora-sepolia-DNJ2DQat.js +1 -0
  208. package/index.html +17 -3
  209. package/package.json +3 -3
  210. package/assets/RoobertPRO-Bold-BLoSpx-h.otf +0 -0
  211. package/assets/all-wallets-C5N9p7Oh.js +0 -6
  212. package/assets/arrow-bottom-CXaxVEeb.js +0 -8
  213. package/assets/arrow-left-pgI3hg3C.js +0 -8
  214. package/assets/arrow-right-CyKp2yFa.js +0 -8
  215. package/assets/arrow-top-B2waxVPx.js +0 -8
  216. package/assets/auto-track-BvFI9h3i.js +0 -1
  217. package/assets/biconomy-DZsFbmF0.js +0 -1
  218. package/assets/ccip-CpLmER95.js +0 -1
  219. package/assets/chains-BJ1WS73W.js +0 -1
  220. package/assets/chevron-bottom-C2aa3E9i.js +0 -8
  221. package/assets/chevron-left-jGoftk_A.js +0 -8
  222. package/assets/chevron-right-Dt6SfcNy.js +0 -8
  223. package/assets/chevron-top-CBCgyIVe.js +0 -8
  224. package/assets/close-BQpWkcd5.js +0 -8
  225. package/assets/common-B5-2TPMC.js +0 -1
  226. package/assets/controller-BW9fJMCh.js +0 -2
  227. package/assets/core-f4taWsy5.js +0 -908
  228. package/assets/create-submenu-DEFVbrc5.png +0 -0
  229. package/assets/createBundlerClient-r1Kofl9Y.js +0 -8
  230. package/assets/cursor-l_ly71I2.js +0 -3
  231. package/assets/decimals-BB5yEnWu.js +0 -1
  232. package/assets/decimals-D7yTLBH-.js +0 -1
  233. package/assets/detectExtension-BOyq5ueD.js +0 -1
  234. package/assets/engine-COatTZhI.js +0 -1
  235. package/assets/estimate-l1-fee-gm3XrWSf.js +0 -1
  236. package/assets/eth_estimateGas-A6ba-Fl3.js +0 -1
  237. package/assets/eth_getStorageAt-DiqyV3Wq.js +0 -1
  238. package/assets/eth_getTransactionCount-CF50onAO.js +0 -1
  239. package/assets/ethereum-Bb-GI0c-.js +0 -1
  240. package/assets/events-CjOrSHaz.js +0 -1
  241. package/assets/explore-submenu-KVl6Dc-h.png +0 -0
  242. package/assets/external-link-C6RRSRES.js +0 -8
  243. package/assets/extractIPFS-BchHnCEN.js +0 -1
  244. package/assets/fetchTokenMetadata-ClRC5ORW.js +0 -2
  245. package/assets/get-ecosystem-wallet-info-C2CJ_2OU.js +0 -1
  246. package/assets/getBalance-DGuxWuYL.js +0 -1
  247. package/assets/getInstalledModules-A3tAP18V.js +0 -1
  248. package/assets/getNFT-C7cllYFm.js +0 -1
  249. package/assets/getNFT-CQKD7QHk.js +0 -2
  250. package/assets/governance-submenu-CXxLX9nT.png +0 -0
  251. package/assets/hashTypedData-7WNMs5EV.js +0 -1
  252. package/assets/in-app-wallet-calls-CIRR0eJZ.js +0 -1
  253. package/assets/index-B1P0UjN9.js +0 -1
  254. package/assets/index-BNdVKnva.js +0 -2
  255. package/assets/index-BtvcwkC4.js +0 -1
  256. package/assets/index-C3CMrfih.js +0 -1
  257. package/assets/index-C8ynIJrk.js +0 -395
  258. package/assets/index-Ca6sys5l.js +0 -3
  259. package/assets/index-CvqvWWYJ.js +0 -2
  260. package/assets/index-CxA55UWl.js +0 -1
  261. package/assets/index-D-W42D03.js +0 -12
  262. package/assets/index-DC9TKWAz.js +0 -23
  263. package/assets/index-DFfsl0Io.js +0 -4
  264. package/assets/index-DN2JqH-l.js +0 -895
  265. package/assets/index-DfqIHbWG.js +0 -2
  266. package/assets/index-pQ6ZXw4u.js +0 -13
  267. package/assets/index-qMD90g0X.js +0 -1
  268. package/assets/index.es-B2O4h03u.js +0 -12
  269. package/assets/index.es-BEAksKXY.js +0 -2
  270. package/assets/index.es-Dxxm_SKC.js +0 -1
  271. package/assets/index.es-MXG0VeeZ.js +0 -27
  272. package/assets/index.umd-DvfMpbcY.js +0 -1
  273. package/assets/is-plan-event-enabled-DS1Agtkw.js +0 -1
  274. package/assets/learn-submenu-Xs1jOwfy.png +0 -0
  275. package/assets/localBatchGatewayRequest-CHeIulW5.js +0 -1
  276. package/assets/marketplace-submenu-CjxTqNhj.png +0 -0
  277. package/assets/off-BCDn43Xl.js +0 -8
  278. package/assets/openzeppelin-_xpy9vRo.js +0 -1
  279. package/assets/ownerOf-ClSM4brX.js +0 -1
  280. package/assets/parseNft-BmEusGKu.js +0 -2
  281. package/assets/passkeys-CqFedyqV.js +0 -1
  282. package/assets/resolveImplementation-BssH7H5b.js +0 -1
  283. package/assets/rpc-DMtarHL0.js +0 -3
  284. package/assets/search-CAzZVrZw.js +0 -8
  285. package/assets/secp256k1-C_4ya0Qz.js +0 -1
  286. package/assets/secp256k1-CnKxz2gu.js +0 -1
  287. package/assets/secp256k1-oGq0B4P7.js +0 -1
  288. package/assets/send-batch-transaction-DfUNUZ4Z.js +0 -1
  289. package/assets/send-eip712-transaction-Ro5QmOlW.js +0 -2
  290. package/assets/send-gasless-transaction-B-Uu5KdW.js +0 -2
  291. package/assets/session-proposal-CRjqbz7W.js +0 -1
  292. package/assets/session-request-BI3BlMfs.js +0 -2
  293. package/assets/sha256-ChRob2fv.js +0 -1
  294. package/assets/signing-B1K_Jdsm.js +0 -30
  295. package/assets/thirdweb-0Fl_ECmE.js +0 -27
  296. package/assets/thirdweb-DZ2vK6IO.js +0 -1
  297. package/assets/totalSupply-ClM38QOc.js +0 -1
  298. package/assets/utils-B3vUvlNq.js +0 -1
  299. package/assets/wait-for-tx-receipt-pc2BJc62.js +0 -1
  300. package/assets/wallets-Dj6CY1yi.js +0 -17
  301. package/assets/web-connector-CiZO9RvI.js +0 -9
  302. package/assets/zora-sepolia-CZ4Tf1UH.js +0 -1
@@ -0,0 +1,16 @@
1
+ const __vite__fileDeps=["assets/index-CgMDPZul.js","assets/__federation_fn_import-C51lglKS.js","assets/createBundlerClient-DhRCLsYO.js","assets/uid-D00jCazq.js","assets/preload-helper-BorDCKdG.js","assets/createClient-C9QPJaZu.js","assets/hooks.module-Cpp96UEK.js","assets/_commonjsHelpers-C4iS2aBk.js","assets/serializeTransaction-mtsVBaO6.js","assets/defineChain-7I0Ce1VT.js","assets/SignInRedirect-CXUOqOjy.js","assets/jsx-runtime-DncYoG30.js","assets/index-Dy0yjznp.js","assets/X-3yocgepi.js","assets/emotion-react.browser.esm-BzYQLDSp.js","assets/emotion-use-insertion-effect-with-fallbacks.browser.esm-TsHx33zg.js","assets/rich-text-react-renderer.es5-D_tE7AHo.js","assets/redux-BNDF-Lt-.js","assets/QueryClientProvider-mZKMZTwe.js","assets/index-nibyPLVP.js","assets/index-C1IoT2if.js","assets/index-6E4L_h32.js","assets/web-connector-CB7tpRui.js","assets/withCache-DYumIHzL.js","assets/json-BHzNJmTy.js","assets/utils-CozXUO91.js","assets/estimate-gas-CeHGaIbG.js","assets/hex-B0Rx0hII.js","assets/op-gas-fee-reducer-CfxMcvXl.js","assets/signing-BFeVjjPi.js","assets/fee-data-BKBGP5kG.js","assets/rpc-ti0b0r_u.js","assets/encode-DvvW4ZKt.js","assets/sleep-mAKpSMLY.js","assets/index-DajuSfcu.js","assets/send-eip712-transaction-D_FU-Avh.js","assets/utils-C7urdXtO.js","assets/sha256-DYtpy1Qz.js","assets/controller-D0Gc4Hsp.js","assets/qr-overlay-CGnFhcTk.js","assets/getBalance-D7nzATjL.js","assets/decimals-DedKFk8m.js","assets/session-request-Dqw67u3p.js","assets/in-app-wallet-calls-CvFtsXP9.js","assets/wait-for-tx-receipt-B-o5aPQ8.js","assets/send-batch-transaction-DnH876GL.js","assets/eth_getTransactionCount-DWnnw2mX.js"],__vite__mapDeps=i=>i.map(i=>__vite__fileDeps[i]);
2
+ import{R as Ad,S as Ll,T as xl,U as Vl,j as Td,f as Pd,V as Sl,D as Od,W as Rd,P as xs,b as Cl,X as bo,Y as $l,B as Dd,Q as ga,_ as Ld,c as xd,N as Ea,K as Vd,q as kl,u as Sd,$ as fn,p as Cd,t as $d,g as kd,J as Ud,O as Nd,a0 as Bd}from"./signing-BFeVjjPi.js";import{u as xi,z as qd,q as Md,A as Ul,y as zd,v as Tr,Q as Nl,h as Ne,a as Pn,n as Ue,s as Io,i as jd,t as Ao}from"./hex-B0Rx0hII.js";import{g as J,C as Kd,b as pi,t as To,a as Po,c as Fd,d as Hd,n as Wd,D as va}from"./estimate-gas-CeHGaIbG.js";import{getCachedChainIfExists as Dn,getCachedChain as be,getChainMetadata as Oo,getChainSymbol as Gd,getChainDecimals as Zd,getChainNativeCurrencyName as Yd,defineChain as Jd,cacheChains as Qd}from"./utils-CozXUO91.js";import{importShared as Ro}from"./__federation_fn_import-C51lglKS.js";import{encode as Xd}from"./encode-DvvW4ZKt.js";import{r as ba}from"./op-gas-fee-reducer-CfxMcvXl.js";import{_ as a}from"./preload-helper-BorDCKdG.js";import{g as ep,d as Bl,w as ql,b as Vi,a as $r}from"./withCache-DYumIHzL.js";import{stringify as Ee}from"./json-BHzNJmTy.js";import{c as tp}from"./store-DOLZnwHk.js";import{getRpcClient as Si}from"./rpc-ti0b0r_u.js";import{p as np}from"./publicKeyToAddress-CxEKPAKT.js";import{t as rp}from"./fee-data-BKBGP5kG.js";import{e as Ln,N as Ml}from"./events-B5inrCVE.js";import{q as jr,b as fi,s as Do,I as Wn,d as Ia,g as ip,e as M,h as zn,C as sp,j as zl,l as op,m as ap,n as Vs,k as Lo,A as cp,E as ze,r as lp,y as rt,a as nn,t as Gn,O as jl,o as up,u as hp,v as xo,w as Vo,f as _i,P as Aa,Q as dp,x as pp,z as gn,c as Kl,B as Ct,D as Ot,F as jt}from"./index.es-D3pP9hN4.js";import{c as fp,a as _p,k as wp,d as mp,s as yp,g as Ta}from"./index-nibyPLVP.js";import{e as gp}from"./ethereum-dN7ENYl_.js";function Ep(n=32){return xi(vp(n))}function vp(n=32){return globalThis.crypto.getRandomValues(new Uint8Array(n))}function bp(n){const t=qd(n);return Md("0x19",Ul(`Ethereum Signed Message:
3
+ `+zd(t)),t)}function Ip(n){return Ad(bp(n))}const z1="0xfffffffffffffffffffffffffffffff0000000000000000000000000000000007aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1c",Ap="0x85e23b94e7F5E9cC1fF78BCe78cfb15B81f0DF00",Tp="0x4be0ddfebca9a5a4a617dee4dece99e7c862dceb",Ci="0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789",Pp="0x0000000071727De22E5E9d8BAf0edAc6f37da032",Op=50000n,Rp=n=>Dp(n||Ci)==="v0.7"?Tp:Ap,Fl=n=>{const t=ep().bundler;return t.startsWith("localhost:")?`http://${t}/v2?chain=${n.id}`:`https://${n.id}.${t}/v2`},Dp=n=>{const t=J(n);if(t===Ci)return"v0.6";if(t===Pp)return"v0.7";throw new Error("Unknown paymaster version")};async function Ye(n){const{client:t,ecosystem:e,walletType:r,walletAddress:i,chainId:s}=n;return Kd({client:t,data:{action:"connect",chainId:s,source:"connectWallet",walletAddress:i,walletType:r},ecosystem:e})}function So(n){const t=n.domain;return t?.chainId!==void 0&&Tr(t.chainId)&&(n.domain={...n.domain,chainId:Nl(n.domain.chainId)}),n}const Lp={"0x0":"reverted","0x1":"success"};function Co(n){const[t,e]=(()=>{const r=n.status;return r>=100&&r<200?["pending",r]:r>=200&&r<300?["success",r]:r>=300&&r<700?["failure",r]:r==="CONFIRMED"?["success",200]:r==="PENDING"?["pending",100]:[void 0,r]})();return{...n,atomic:n.atomic,chainId:n.chainId?Pn(n.chainId):void 0,receipts:n.receipts?.map(r=>({...r,blockNumber:Ne(r.blockNumber),gasUsed:Ne(r.gasUsed),status:Lp[r.status]}))??[],status:t,statusCode:e,version:n.version}}function $o(n,t){const e={};for(const[r,i]of Object.entries(n)){e[Number(r)]={};const s={};for(const[o,c]of Object.entries(i))s[o]=c;e[Number(r)]=s}return typeof t=="number"?{[t]:e[t]}:e}async function ko(n,t){const e=n.calls[0];if(!e)throw new Error("No calls to send");const{calls:r,capabilities:i,version:s="2.0.0",chain:o=e.chain}=n,c=await Promise.all(r.map(async u=>{const{to:h,value:d}=u;if(h===void 0&&u.data===void 0)throw new Error("Cannot send call, `to` or `data` must be provided.");const[p,f,w]=await Promise.all([ba(h),Xd(u),ba(d)]);return p?{data:f,to:J(p),value:typeof w=="bigint"||typeof w=="number"?Ue(w):void 0}:{data:f,to:void 0,value:void 0}}));return{callParams:[{atomicRequired:n.atomicRequired??!1,calls:c,capabilities:i,chainId:Ue(o.id),from:J(t.address),version:s}],chain:o}}function Uo(n){return xp(n).map(t=>{try{const e=new URL(t);return e.hostname.endsWith(".thirdweb.com")&&(e.pathname="",e.search=""),e.toString()}catch{return t}})}function xp(n,t,e="http"){const r=[];for(const i of n.rpc)e==="http"&&!i.startsWith("http")||e==="ws"&&!i.startsWith("ws")||(i.includes("${THIRDWEB_API_KEY}")?r.push(i.replace("${THIRDWEB_API_KEY}","")):i.includes("${")||r.push(i));if(r.length===0)throw new Error(`No RPC available for chainId "${n.chainId}" with mode ${e}`);return r}function gt(n){return typeof n=="number"?n:pi(n)?Pn(n):typeof n=="bigint"?Number(n):Number.parseInt(n,10)}function Vp(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}function Sp(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}function Hl(){return!Vp()&&!Sp()}const Rt="com.coinbase.wallet",qt="org.base.account",Wl="io.metamask",Cp="me.rainbow",$p="io.zerion.wallet",wi={async getItem(n){try{if(typeof window<"u"&&window.localStorage)return localStorage.getItem(n)}catch{}return null},async removeItem(n){typeof window<"u"&&window.localStorage&&localStorage.removeItem(n)},async setItem(n,t){try{typeof window<"u"&&window.localStorage&&localStorage.setItem(n,t)}catch{}}};function No(n){return n.startsWith("http://")||n.startsWith("https://")}function Gl(n,t){if(!No(n))return Zl(n,t);let e=n;e.endsWith("/")||(e=`${e}/`);const r=encodeURIComponent(t);return{href:e,redirect:`${e}wc?uri=${r}`}}function Zl(n,t){if(No(n))return Gl(n,t);let e=n;e.includes("://")||(e=n.replaceAll("/","").replaceAll(":",""),e=`${e}://`),e.endsWith("/")||(e=`${e}/`);const r=encodeURIComponent(t);return{href:e,redirect:`${e}wc?uri=${r}`}}function kp(n,t){return No(n)?Gl(n,t):Zl(n,t)}function Up(){if(typeof navigator>"u")return!1;const n=Bl(navigator.userAgent);return n?n.toLowerCase().includes("android"):!1}function Np(){if(typeof navigator>"u")return!1;const n=Bl(navigator.userAgent);return n?n.toLowerCase().includes("ios")||n.toLowerCase().includes("mac")&&navigator.maxTouchPoints>1:!1}function Bp(){return typeof window>"u"||typeof navigator>"u"?!1:"ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0}function qp(){return typeof window>"u"?!1:"orientation"in window||"onorientationchange"in window}function Pa(){return!!(Up()||Np()||Bp()&&qp()||typeof window<"u"&&window.innerWidth<640)}function Gi(n){if(window!==window.top)window.open(n);else if(n.startsWith("http")){const e=document.createElement("a");e.href=n,e.target="_blank",e.rel="noreferrer noopener",e.click()}else window.location.href=n}function Zn(n){return typeof n=="string"?n.startsWith("ecosystem."):n.id.startsWith("ecosystem.")}async function Yl(n,t){if(Zn(n)){const{getEcosystemWalletInfo:e}=await a(async()=>{const{getEcosystemWalletInfo:r}=await import("./get-ecosystem-wallet-info-D3PrM5FE.js");return{getEcosystemWalletInfo:r}},[]);return t?e(n).then(r=>r.image_id):e(n)}switch(n){case"smart":return t?a(()=>import("./image-BnYtBA0B.js"),[]).then(e=>e.default):a(()=>import("./index-BuSavAVK.js"),[]).then(e=>e.wallet);case"inApp":return t?a(()=>import("./image-YhquT9-B.js"),[]).then(e=>e.default):a(()=>import("./index-B6yqoFuC.js"),[]).then(e=>e.wallet);case"walletConnect":return t?a(()=>import("./image-B3sWXgWp.js"),[]).then(e=>e.default):a(()=>import("./index-B21BIk0D.js"),[]).then(e=>e.wallet);case"embedded":return t?a(()=>import("./image-CE6B5igp.js"),[]).then(e=>e.default):a(()=>import("./index-CZfaBXw3.js"),[]).then(e=>e.wallet);case"adapter":return t?a(()=>import("./image-CaoCxndE.js"),[]).then(e=>e.default):a(()=>import("./index-DkPRLpmE.js"),[]).then(e=>e.wallet);case"io.1inch.wallet":return t?a(()=>import("./image-DcM8byf5.js"),[]).then(e=>e.default):a(()=>import("./index-B8SH8PS4.js"),[]).then(e=>e.wallet);case"com.binance.wallet":return t?a(()=>import("./image-B6woX8-F.js"),[]).then(e=>e.default):a(()=>import("./index-D1Wt1Kx7.js"),[]).then(e=>e.wallet);case"com.ledger":return t?a(()=>import("./image-CGobRsqC.js"),[]).then(e=>e.default):a(()=>import("./index-C63hJ0G0.js"),[]).then(e=>e.wallet);case"com.bitpay":return t?a(()=>import("./image-oGFA7lCe.js"),[]).then(e=>e.default):a(()=>import("./index-Bl6ScMn3.js"),[]).then(e=>e.wallet);case"com.bestwallet":return t?a(()=>import("./image-YzdSnFCd.js"),[]).then(e=>e.default):a(()=>import("./index-C_fnrq8t.js"),[]).then(e=>e.wallet);case"io.metamask":return t?a(()=>import("./image-rAE1A9js.js"),[]).then(e=>e.default):a(()=>import("./index-DaZnaClT.js"),[]).then(e=>e.wallet);case"com.trustwallet.app":return t?a(()=>import("./image-DhOOZChF.js"),[]).then(e=>e.default):a(()=>import("./index-9552Tb-C.js"),[]).then(e=>e.wallet);case"com.fireblocks":return t?a(()=>import("./image-C_rXI8lY.js"),[]).then(e=>e.default):a(()=>import("./index-fm1oF4Rd.js"),[]).then(e=>e.wallet);case"com.bitget.web3":return t?a(()=>import("./image-Cyu_SKNX.js"),[]).then(e=>e.default):a(()=>import("./index-7Xw6Dozy.js"),[]).then(e=>e.wallet);case"pro.tokenpocket":return t?a(()=>import("./image--EMjkbyZ.js"),[]).then(e=>e.default):a(()=>import("./index-C6d9DLRH.js"),[]).then(e=>e.wallet);case"com.safepal":return t?a(()=>import("./image-CPrfOTN2.js"),[]).then(e=>e.default):a(()=>import("./index-BKoDPf_i.js"),[]).then(e=>e.wallet);case"org.uniswap":return t?a(()=>import("./image-DzLDqqsm.js"),[]).then(e=>e.default):a(()=>import("./index-j8mIFeCA.js"),[]).then(e=>e.wallet);case"io.zerion.wallet":return t?a(()=>import("./image-CXpsLPxr.js"),[]).then(e=>e.default):a(()=>import("./index-CAYpPiIA.js"),[]).then(e=>e.wallet);case"com.elrond.maiar.wallet":return t?a(()=>import("./image-Zh059TUR.js"),[]).then(e=>e.default):a(()=>import("./index-CN99OAiz.js"),[]).then(e=>e.wallet);case"com.crypto.wallet":return t?a(()=>import("./image-BbeMBRJP.js"),[]).then(e=>e.default):a(()=>import("./index-DoeeKGAI.js"),[]).then(e=>e.wallet);case"com.bitcoin":return t?a(()=>import("./image-CIhcwJo_.js"),[]).then(e=>e.default):a(()=>import("./index-COFjg0BY.js"),[]).then(e=>e.wallet);case"com.bifrostwallet":return t?a(()=>import("./image-BJbq9ykO.js"),[]).then(e=>e.default):a(()=>import("./index-Cw9NGSPc.js"),[]).then(e=>e.wallet);case"jp.co.rakuten-wallet":return t?a(()=>import("./image-CkSdZpFq.js"),[]).then(e=>e.default):a(()=>import("./index-CU6dgzkA.js"),[]).then(e=>e.wallet);case"com.bybit":return t?a(()=>import("./image-CVPmP4Bl.js"),[]).then(e=>e.default):a(()=>import("./index-m0YDsCpu.js"),[]).then(e=>e.wallet);case"com.blockchain.login":return t?a(()=>import("./image-BvEJhPGs.js"),[]).then(e=>e.default):a(()=>import("./index-C8VMxu1Z.js"),[]).then(e=>e.wallet);case"io.trezor":return t?a(()=>import("./image-BQXnGJhx.js"),[]).then(e=>e.default):a(()=>import("./index-CDqfDzT6.js"),[]).then(e=>e.wallet);case"im.token":return t?a(()=>import("./image-ChDeiuh7.js"),[]).then(e=>e.default):a(()=>import("./index-iJWzlNVI.js"),[]).then(e=>e.wallet);case"global.safe":return t?a(()=>import("./image-B6ncW7rJ.js"),[]).then(e=>e.default):a(()=>import("./index-HPp1Id1p.js"),[]).then(e=>e.wallet);case"xyz.ctrl":return t?a(()=>import("./image-DsOpF0U0.js"),[]).then(e=>e.default):a(()=>import("./index-CW6lKp1A.js"),[]).then(e=>e.wallet);case"co.arculus":return t?a(()=>import("./image-CYFfk7g3.js"),[]).then(e=>e.default):a(()=>import("./index-s6ugJH3L.js"),[]).then(e=>e.wallet);case"com.roninchain.wallet":return t?a(()=>import("./image-BMgLTkFN.js"),[]).then(e=>e.default):a(()=>import("./index-caEr82M6.js"),[]).then(e=>e.wallet);case"com.okex.wallet":return t?a(()=>import("./image-Ck2fht2U.js"),[]).then(e=>e.default):a(()=>import("./index-CbEIEIEo.js"),[]).then(e=>e.wallet);case"com.wemixplay":return t?a(()=>import("./image-Dfhapk7_.js"),[]).then(e=>e.default):a(()=>import("./index-C8AQSvJD.js"),[]).then(e=>e.wallet);case"com.tangem":return t?a(()=>import("./image-xMsS8TDb.js"),[]).then(e=>e.default):a(()=>import("./index-CKXDw-uc.js"),[]).then(e=>e.wallet);case"com.exodus":return t?a(()=>import("./image-BULUy74S.js"),[]).then(e=>e.default):a(()=>import("./index-DszThTMl.js"),[]).then(e=>e.wallet);case"com.hashpack.wallet":return t?a(()=>import("./image-BFzDP99B.js"),[]).then(e=>e.default):a(()=>import("./index-wBbkQCZY.js"),[]).then(e=>e.wallet);case"id.co.pintu":return t?a(()=>import("./image-CsH_NRy-.js"),[]).then(e=>e.default):a(()=>import("./index-DHDm_YtM.js"),[]).then(e=>e.wallet);case"network.blackfort":return t?a(()=>import("./image-CTLwieHz.js"),[]).then(e=>e.default):a(()=>import("./index-DZRVQyzq.js"),[]).then(e=>e.wallet);case"com.wigwam.wallet":return t?a(()=>import("./image-xaEWk6k8.js"),[]).then(e=>e.default):a(()=>import("./index-BA0Hn6eE.js"),[]).then(e=>e.wallet);case"app.backpack":return t?a(()=>import("./image-YbQrvLSP.js"),[]).then(e=>e.default):a(()=>import("./index-B8BWAl26.js"),[]).then(e=>e.wallet);case"app.subwallet":return t?a(()=>import("./image-BdqmMP8T.js"),[]).then(e=>e.default):a(()=>import("./index-7C_yDnI4.js"),[]).then(e=>e.wallet);case"cc.avacus":return t?a(()=>import("./image-uGs9mRWl.js"),[]).then(e=>e.default):a(()=>import("./index-BFZxo6Jc.js"),[]).then(e=>e.wallet);case"me.rainbow":return t?a(()=>import("./image-DSGxNIm1.js"),[]).then(e=>e.default):a(()=>import("./index-3d3uK5Ax.js"),[]).then(e=>e.wallet);case"so.onekey.app.wallet":return t?a(()=>import("./image-CwaGmiHI.js"),[]).then(e=>e.default):a(()=>import("./index-CUEmD5dS.js"),[]).then(e=>e.wallet);case"me.haha":return t?a(()=>import("./image-Npe5Xkhl.js"),[]).then(e=>e.default):a(()=>import("./index-B7GQyWAF.js"),[]).then(e=>e.wallet);case"com.bee":return t?a(()=>import("./image-Sy6X7CtO.js"),[]).then(e=>e.default):a(()=>import("./index-CQ3aQg5G.js"),[]).then(e=>e.wallet);case"ag.jup":return t?a(()=>import("./image-BuqgjEJD.js"),[]).then(e=>e.default):a(()=>import("./index-D30RfPa1.js"),[]).then(e=>e.wallet);case"app.keplr":return t?a(()=>import("./image-DpeCw-px.js"),[]).then(e=>e.default):a(()=>import("./index-BnsE1W-S.js"),[]).then(e=>e.wallet);case"org.hot-labs":return t?a(()=>import("./image-DFf3lDA_.js"),[]).then(e=>e.default):a(()=>import("./index-DDwu-IMz.js"),[]).then(e=>e.wallet);case"com.dcentwallet":return t?a(()=>import("./image-CUPOo6zK.js"),[]).then(e=>e.default):a(()=>import("./index-Bm92iZMY.js"),[]).then(e=>e.wallet);case"com.kraken":return t?a(()=>import("./image-BP17CoHz.js"),[]).then(e=>e.default):a(()=>import("./index-BFGXqrJS.js"),[]).then(e=>e.wallet);case"com.kucoin":return t?a(()=>import("./image-JIl7mHMQ.js"),[]).then(e=>e.default):a(()=>import("./index-DRVDpxj6.js"),[]).then(e=>e.wallet);case"io.magiceden.wallet":return t?a(()=>import("./image-B7QIFAir.js"),[]).then(e=>e.default):a(()=>import("./index-DMTU8hfu.js"),[]).then(e=>e.wallet);case"com.tomi":return t?a(()=>import("./image-COwCE3RO.js"),[]).then(e=>e.default):a(()=>import("./index-C7njqxXR.js"),[]).then(e=>e.wallet);case"io.ibvm":return t?a(()=>import("./image-CVBI4BwD.js"),[]).then(e=>e.default):a(()=>import("./index-HzSvsrak.js"),[]).then(e=>e.wallet);case"com.mewwallet":return t?a(()=>import("./image-Dx4ya6_y.js"),[]).then(e=>e.default):a(()=>import("./index-DEzKWTBJ.js"),[]).then(e=>e.wallet);case"com.socios.app":return t?a(()=>import("./image-COKP1J8V.js"),[]).then(e=>e.default):a(()=>import("./index-D06ftJGd.js"),[]).then(e=>e.wallet);case"xyz.argent":return t?a(()=>import("./image-5mReG_-1.js"),[]).then(e=>e.default):a(()=>import("./index-CQPZVLgk.js"),[]).then(e=>e.wallet);case"org.thorwallet":return t?a(()=>import("./image-Dmp2jTO0.js"),[]).then(e=>e.default):a(()=>import("./index-NO3dCFlG.js"),[]).then(e=>e.wallet);case"io.internetmoney":return t?a(()=>import("./image-D4PYvYqY.js"),[]).then(e=>e.default):a(()=>import("./index-BZwq4W5O.js"),[]).then(e=>e.wallet);case"org.mathwallet":return t?a(()=>import("./image-mMy4SSmg.js"),[]).then(e=>e.default):a(()=>import("./index-lGNYNhMi.js"),[]).then(e=>e.wallet);case"io.cypherhq":return t?a(()=>import("./image-B14TCFf5.js"),[]).then(e=>e.default):a(()=>import("./index-yURkkC3L.js"),[]).then(e=>e.wallet);case"io.novawallet":return t?a(()=>import("./image-DDso8kuB.js"),[]).then(e=>e.default):a(()=>import("./index-C91aPf2g.js"),[]).then(e=>e.wallet);case"io.yowallet":return t?a(()=>import("./image-Bx8buncY.js"),[]).then(e=>e.default):a(()=>import("./index-B062fuzr.js"),[]).then(e=>e.wallet);case"com.flowfoundation.wallet":return t?a(()=>import("./image-Da2xkAVi.js"),[]).then(e=>e.default):a(()=>import("./index-CBVJzm96.js"),[]).then(e=>e.wallet);case"app.kabila":return t?a(()=>import("./image-B-l20wIO.js"),[]).then(e=>e.default):a(()=>import("./index-cTRIo3rN.js"),[]).then(e=>e.wallet);case"com.opera":return t?a(()=>import("./image-sDrIF89f.js"),[]).then(e=>e.default):a(()=>import("./index-lIOVfT2m.js"),[]).then(e=>e.wallet);case"com.valoraapp":return t?a(()=>import("./image-5QXPaavh.js"),[]).then(e=>e.default):a(()=>import("./index-C6baQHax.js"),[]).then(e=>e.wallet);case"com.robinhood.wallet":return t?a(()=>import("./image-DBehogZh.js"),[]).then(e=>e.default):a(()=>import("./index-bzH6W7xo.js"),[]).then(e=>e.wallet);case"com.chain":return t?a(()=>import("./image-qsAyF5Oj.js"),[]).then(e=>e.default):a(()=>import("./index-npRlG_V2.js"),[]).then(e=>e.wallet);case"io.huddln":return t?a(()=>import("./image-CQm90J-d.js"),[]).then(e=>e.default):a(()=>import("./index-DILut-jL.js"),[]).then(e=>e.wallet);case"app.core.extension":return t?a(()=>import("./image-De2xpum1.js"),[]).then(e=>e.default):a(()=>import("./index-BtfbjCVr.js"),[]).then(e=>e.wallet);case"world.freedom":return t?a(()=>import("./image-COnY36UD.js"),[]).then(e=>e.default):a(()=>import("./index-BZUSQkq9.js"),[]).then(e=>e.wallet);case"money.unstoppable":return t?a(()=>import("./image-Bvw8wNRu.js"),[]).then(e=>e.default):a(()=>import("./index-CW8D5Pv5.js"),[]).then(e=>e.wallet);case"pk.modular":return t?a(()=>import("./image-CaHdVXd1.js"),[]).then(e=>e.default):a(()=>import("./index-1CA6ps09.js"),[]).then(e=>e.wallet);case"app.wombat":return t?a(()=>import("./image-ExeF69qZ.js"),[]).then(e=>e.default):a(()=>import("./index-D9Jrno_D.js"),[]).then(e=>e.wallet);case"com.klipwallet":return t?a(()=>import("./image-8vXf4Xjy.js"),[]).then(e=>e.default):a(()=>import("./index-CcNQ53IV.js"),[]).then(e=>e.wallet);case"com.gemwallet":return t?a(()=>import("./image-M7TV7WaH.js"),[]).then(e=>e.default):a(()=>import("./index-BtZsXMJj.js"),[]).then(e=>e.wallet);case"com.sabay.wallet":return t?a(()=>import("./image-CsNgSbbt.js"),[]).then(e=>e.default):a(()=>import("./index-BVAmxcaa.js"),[]).then(e=>e.wallet);case"com.zengo":return t?a(()=>import("./image-DNtaIeSw.js"),[]).then(e=>e.default):a(()=>import("./index-DDk7D3eE.js"),[]).then(e=>e.wallet);case"xyz.joeywallet":return t?a(()=>import("./image-CTsHGgDx.js"),[]).then(e=>e.default):a(()=>import("./index-Im6F3t68.js"),[]).then(e=>e.wallet);case"io.tokoin":return t?a(()=>import("./image-DQzzFCs2.js"),[]).then(e=>e.default):a(()=>import("./index-Bwjy4Jw7.js"),[]).then(e=>e.wallet);case"io.alpha-u.wallet.web":return t?a(()=>import("./image-DLiMUWBI.js"),[]).then(e=>e.default):a(()=>import("./index-DFt1vT8N.js"),[]).then(e=>e.wallet);case"network.cvl":return t?a(()=>import("./image-CtZg2vKX.js"),[]).then(e=>e.default):a(()=>import("./index-D2vPh3Mc.js"),[]).then(e=>e.wallet);case"io.leapwallet":return t?a(()=>import("./image-DHnnMCFG.js"),[]).then(e=>e.default):a(()=>import("./index-BdkJrfxl.js"),[]).then(e=>e.wallet);case"io.xenea":return t?a(()=>import("./image-B5ZxW0VG.js"),[]).then(e=>e.default):a(()=>import("./index-C8mAROh2.js"),[]).then(e=>e.wallet);case"com.oasys-wallet":return t?a(()=>import("./image-W7SfqKZe.js"),[]).then(e=>e.default):a(()=>import("./index-gQ8zpnGO.js"),[]).then(e=>e.wallet);case"com.bitso":return t?a(()=>import("./image-LfonVSeq.js"),[]).then(e=>e.default):a(()=>import("./index-YcqLCtWD.js"),[]).then(e=>e.wallet);case"io.enjin":return t?a(()=>import("./image-BnXzDKuV.js"),[]).then(e=>e.default):a(()=>import("./index-Jmrm9oUu.js"),[]).then(e=>e.wallet);case"com.coldwallet":return t?a(()=>import("./image-CVrpZdwi.js"),[]).then(e=>e.default):a(()=>import("./index-CkqupmC6.js"),[]).then(e=>e.wallet);case"org.creditcoin.app":return t?a(()=>import("./image-CzL8n4ZU.js"),[]).then(e=>e.default):a(()=>import("./index-B94SpzOt.js"),[]).then(e=>e.wallet);case"app.everspace":return t?a(()=>import("./image-ripXpF5P.js"),[]).then(e=>e.default):a(()=>import("./index-COlGaDkw.js"),[]).then(e=>e.wallet);case"app.zeal":return t?a(()=>import("./image-hO8Jv2oh.js"),[]).then(e=>e.default):a(()=>import("./index-B6n-vVE0.js"),[]).then(e=>e.wallet);case"app.whitewallet":return t?a(()=>import("./image-D7wXb0Un.js"),[]).then(e=>e.default):a(()=>import("./index-SCBLsVUL.js"),[]).then(e=>e.wallet);case"ai.purewallet":return t?a(()=>import("./image-K1HoU8Qi.js"),[]).then(e=>e.default):a(()=>import("./index-DZ2hd5eC.js"),[]).then(e=>e.wallet);case"com.fastex.wallet":return t?a(()=>import("./image-lBIlUHFP.js"),[]).then(e=>e.default):a(()=>import("./index-CMzQk3O6.js"),[]).then(e=>e.wallet);case"io.kriptomat":return t?a(()=>import("./image-6ouyxZRt.js"),[]).then(e=>e.default):a(()=>import("./index-wk2CJ7i5.js"),[]).then(e=>e.wallet);case"com.ullapay":return t?a(()=>import("./image-Bn2sAgXJ.js"),[]).then(e=>e.default):a(()=>import("./index-D_d6gemZ.js"),[]).then(e=>e.wallet);case"io.atomicwallet":return t?a(()=>import("./image-D55LvXjp.js"),[]).then(e=>e.default):a(()=>import("./index-DEV4egrN.js"),[]).then(e=>e.wallet);case"com.pionewallet":return t?a(()=>import("./image-B_0Cqkss.js"),[]).then(e=>e.default):a(()=>import("./index-BogX5ITG.js"),[]).then(e=>e.wallet);case"io.oxalus":return t?a(()=>import("./image-DTa4RXUa.js"),[]).then(e=>e.default):a(()=>import("./index-CuQBw1y6.js"),[]).then(e=>e.wallet);case"xyz.uniultra.wallet":return t?a(()=>import("./image-BSLjXnNe.js"),[]).then(e=>e.default):a(()=>import("./index-CJYo3Znz.js"),[]).then(e=>e.wallet);case"xyz.frontier.wallet":return t?a(()=>import("./image-Bdtwdp85.js"),[]).then(e=>e.default):a(()=>import("./index--YTVamH2.js"),[]).then(e=>e.wallet);case"com.coolbitx.cwsapp":return t?a(()=>import("./image-DWR067hG.js"),[]).then(e=>e.default):a(()=>import("./index-tkvX3w1X.js"),[]).then(e=>e.wallet);case"org.gooddollar":return t?a(()=>import("./image-y3eCNAT6.js"),[]).then(e=>e.default):a(()=>import("./index-C7N44kNF.js"),[]).then(e=>e.wallet);case"com.cakewallet":return t?a(()=>import("./image-BqQffU2u.js"),[]).then(e=>e.default):a(()=>import("./index-DPCPDLBT.js"),[]).then(e=>e.wallet);case"com.ellipal":return t?a(()=>import("./image-vuuCn07N.js"),[]).then(e=>e.default):a(()=>import("./index-jTpsrMvb.js"),[]).then(e=>e.wallet);case"app.krystal":return t?a(()=>import("./image-C2QANSRr.js"),[]).then(e=>e.default):a(()=>import("./index-B7dAHFam.js"),[]).then(e=>e.wallet);case"com.monarchwallet":return t?a(()=>import("./image-BNA4BP9T.js"),[]).then(e=>e.default):a(()=>import("./index-C7WD5W_Z.js"),[]).then(e=>e.wallet);case"com.burritowallet":return t?a(()=>import("./image-BI-5Z38o.js"),[]).then(e=>e.default):a(()=>import("./index-DpRqa1iX.js"),[]).then(e=>e.wallet);case"co.family.wallet":return t?a(()=>import("./image-CECsJh3H.js"),[]).then(e=>e.default):a(()=>import("./index-DrzmRQ9S.js"),[]).then(e=>e.wallet);case"com.mtpelerin":return t?a(()=>import("./image-BDOqiI6p.js"),[]).then(e=>e.default):a(()=>import("./index-bQArImNA.js"),[]).then(e=>e.wallet);case"app.keyring":return t?a(()=>import("./image-BH6pi8gb.js"),[]).then(e=>e.default):a(()=>import("./index-DLGneTkB.js"),[]).then(e=>e.wallet);case"cc.localtrade.lab":return t?a(()=>import("./image-DRqNpoe6.js"),[]).then(e=>e.default):a(()=>import("./index-D-qw7id5.js"),[]).then(e=>e.wallet);case"tech.okto":return t?a(()=>import("./image-uk4MysVY.js"),[]).then(e=>e.default):a(()=>import("./index-C5ZfEOey.js"),[]).then(e=>e.wallet);case"com.xcapit":return t?a(()=>import("./image-BjFjHCOg.js"),[]).then(e=>e.default):a(()=>import("./index-DbAxetvE.js"),[]).then(e=>e.wallet);case"com.gayawallet":return t?a(()=>import("./image-DC9Wj56E.js"),[]).then(e=>e.default):a(()=>import("./index-D4VnhuTS.js"),[]).then(e=>e.wallet);case"app.nightly":return t?a(()=>import("./image-Bv8VGwx8.js"),[]).then(e=>e.default):a(()=>import("./index-uM5GtqSd.js"),[]).then(e=>e.wallet);case"com.coin98":return t?a(()=>import("./image-Co9P7WAh.js"),[]).then(e=>e.default):a(()=>import("./index-CxBkKx5Q.js"),[]).then(e=>e.wallet);case"xyz.coca":return t?a(()=>import("./image-DaxrbegS.js"),[]).then(e=>e.default):a(()=>import("./index-CAfHv9Ye.js"),[]).then(e=>e.wallet);case"app.linen":return t?a(()=>import("./image-CljvD_on.js"),[]).then(e=>e.default):a(()=>import("./index-DTPO88lj.js"),[]).then(e=>e.wallet);case"dev.auroracloud":return t?a(()=>import("./image-BbwfB3J_.js"),[]).then(e=>e.default):a(()=>import("./index-DqYjD_64.js"),[]).then(e=>e.wallet);case"com.coinomi":return t?a(()=>import("./image-CyezMyAx.js"),[]).then(e=>e.default):a(()=>import("./index-B-oXIR8J.js"),[]).then(e=>e.wallet);case"my.mone":return t?a(()=>import("./image-B7h27Vsd.js"),[]).then(e=>e.default):a(()=>import("./index-3jJtZlGN.js"),[]).then(e=>e.wallet);case"org.alephium":return t?a(()=>import("./image-DDUR5y02.js"),[]).then(e=>e.default):a(()=>import("./index-CRTSSeuy.js"),[]).then(e=>e.wallet);case"com.alicebob":return t?a(()=>import("./image-BKjOwOZU.js"),[]).then(e=>e.default):a(()=>import("./index-DYiL0IsZ.js"),[]).then(e=>e.wallet);case"io.koalawallet":return t?a(()=>import("./image-CTAbQz5j.js"),[]).then(e=>e.default):a(()=>import("./index-DPXkoJXK.js"),[]).then(e=>e.wallet);case"com.veworld":return t?a(()=>import("./image-DKBlkqWK.js"),[]).then(e=>e.default):a(()=>import("./index-DV2Q2KhC.js"),[]).then(e=>e.wallet);case"com.withpaper":return t?a(()=>import("./image-DbBiNCFK.js"),[]).then(e=>e.default):a(()=>import("./index-CExunyqd.js"),[]).then(e=>e.wallet);case"io.noone":return t?a(()=>import("./image-CwDXHpUj.js"),[]).then(e=>e.default):a(()=>import("./index-BEFk-36A.js"),[]).then(e=>e.wallet);case"network.haqq":return t?a(()=>import("./image-BaRuJqy0.js"),[]).then(e=>e.default):a(()=>import("./index--t3K2suC.js"),[]).then(e=>e.wallet);case"io.ricewallet":return t?a(()=>import("./image-CmVMIVLM.js"),[]).then(e=>e.default):a(()=>import("./index-C_j7AjFr.js"),[]).then(e=>e.wallet);case"me.iopay":return t?a(()=>import("./image-CMJsc-Ir.js"),[]).then(e=>e.default):a(()=>import("./index-bsKYZmcs.js"),[]).then(e=>e.wallet);case"app.walletnow":return t?a(()=>import("./image-CmkiYZaU.js"),[]).then(e=>e.default):a(()=>import("./index-C_C9JdoE.js"),[]).then(e=>e.wallet);case"io.okse":return t?a(()=>import("./image-CZ9z1ucT.js"),[]).then(e=>e.default):a(()=>import("./index-_a8zNWKv.js"),[]).then(e=>e.wallet);case"network.over":return t?a(()=>import("./image-Cq54pcgl.js"),[]).then(e=>e.default):a(()=>import("./index-BDifUsn3.js"),[]).then(e=>e.wallet);case"com.aktionariat":return t?a(()=>import("./image-Cc6jyxLi.js"),[]).then(e=>e.default):a(()=>import("./index-Pw2thZ4h.js"),[]).then(e=>e.wallet);case"com.paybolt":return t?a(()=>import("./image-cwzgrAkh.js"),[]).then(e=>e.default):a(()=>import("./index-BxqRct_I.js"),[]).then(e=>e.wallet);case"com.plasma-wallet":return t?a(()=>import("./image-BVO9IT_6.js"),[]).then(e=>e.default):a(()=>import("./index-fiGpKN6W.js"),[]).then(e=>e.wallet);case"org.bytebank":return t?a(()=>import("./image-BP2Ox9Qn.js"),[]).then(e=>e.default):a(()=>import("./index-S5s6rAc3.js"),[]).then(e=>e.wallet);case"io.ethermail":return t?a(()=>import("./image-Duck5tqn.js"),[]).then(e=>e.default):a(()=>import("./index-BoCHG1VO.js"),[]).then(e=>e.wallet);case"com.optowallet":return t?a(()=>import("./image-W-Y_Nm-s.js"),[]).then(e=>e.default):a(()=>import("./index-BP-yDgcx.js"),[]).then(e=>e.wallet);case"finance.openwallet":return t?a(()=>import("./image-M_AWRaKs.js"),[]).then(e=>e.default):a(()=>import("./index-Cv59xn6_.js"),[]).then(e=>e.wallet);case"xyz.sequence":return t?a(()=>import("./image-o3pjQDbu.js"),[]).then(e=>e.default):a(()=>import("./index-D7Gl-ZGb.js"),[]).then(e=>e.wallet);case"com.foxwallet":return t?a(()=>import("./image-DcX8AUYd.js"),[]).then(e=>e.default):a(()=>import("./index-BARF52iT.js"),[]).then(e=>e.wallet);case"app.hbwallet":return t?a(()=>import("./image-BlogSp8o.js"),[]).then(e=>e.default):a(()=>import("./index-CW58bOV7.js"),[]).then(e=>e.wallet);case"it.airgap":return t?a(()=>import("./image-5CGX_QL3.js"),[]).then(e=>e.default):a(()=>import("./index-YDG1R00C.js"),[]).then(e=>e.wallet);case"com.holdstation":return t?a(()=>import("./image-BcNLqzB4.js"),[]).then(e=>e.default):a(()=>import("./index-9Ml23qSY.js"),[]).then(e=>e.wallet);case"io.universaleverything":return t?a(()=>import("./image-D3z3GjMO.js"),[]).then(e=>e.default):a(()=>import("./index-qmNRbp6W.js"),[]).then(e=>e.wallet);case"com.abra":return t?a(()=>import("./image-CCgX-pcz.js"),[]).then(e=>e.default):a(()=>import("./index-_36_A-pH.js"),[]).then(e=>e.wallet);case"org.thepulsewallet":return t?a(()=>import("./image-BxfO9qDl.js"),[]).then(e=>e.default):a(()=>import("./index-DgNvhZ_M.js"),[]).then(e=>e.wallet);case"com.premanft":return t?a(()=>import("./image-pKZ5ApxC.js"),[]).then(e=>e.default):a(()=>import("./index-CbGJyo5C.js"),[]).then(e=>e.wallet);case"xyz.timelesswallet":return t?a(()=>import("./image-DUs_WIFe.js"),[]).then(e=>e.default):a(()=>import("./index-WXvxLSve.js"),[]).then(e=>e.wallet);case"org.bitizen":return t?a(()=>import("./image-TQ3Nh_VF.js"),[]).then(e=>e.default):a(()=>import("./index-Db_DlPJs.js"),[]).then(e=>e.wallet);case"app.ultimate":return t?a(()=>import("./image-ClyvBbEv.js"),[]).then(e=>e.default):a(()=>import("./index-D2Z8_AUU.js"),[]).then(e=>e.wallet);case"io.compasswallet":return t?a(()=>import("./image-D6x5dtDG.js"),[]).then(e=>e.default):a(()=>import("./index-2qmxPQhP.js"),[]).then(e=>e.wallet);case"app.fizzwallet":return t?a(()=>import("./image-E3PT44xu.js"),[]).then(e=>e.default):a(()=>import("./index-DAYuEFQ-.js"),[]).then(e=>e.wallet);case"com.xovawallet":return t?a(()=>import("./image-B02ECgsY.js"),[]).then(e=>e.default):a(()=>import("./index-Bap5Lkty.js"),[]).then(e=>e.wallet);case"app.nicegram":return t?a(()=>import("./image-DH5ootHk.js"),[]).then(e=>e.default):a(()=>import("./index-BEXV42kp.js"),[]).then(e=>e.wallet);case"io.zelcore":return t?a(()=>import("./image-CLUlwzEU.js"),[]).then(e=>e.default):a(()=>import("./index-BLO6pY9b.js"),[]).then(e=>e.wallet);case"app.freighter":return t?a(()=>import("./image-BanazMP9.js"),[]).then(e=>e.default):a(()=>import("./index-CcdGs50g.js"),[]).then(e=>e.wallet);case"app.stickey":return t?a(()=>import("./image-_t2-K1ZP.js"),[]).then(e=>e.default):a(()=>import("./index-Cu2rQjR7.js"),[]).then(e=>e.wallet);case"app.coinstats":return t?a(()=>import("./image-BlZLdRma.js"),[]).then(e=>e.default):a(()=>import("./index-j8xu_BhO.js"),[]).then(e=>e.wallet);case"io.harti":return t?a(()=>import("./image-Xfz-LkLu.js"),[]).then(e=>e.default):a(()=>import("./index-DPhI9JUn.js"),[]).then(e=>e.wallet);case"io.dttd":return t?a(()=>import("./image-pEGSGt6h.js"),[]).then(e=>e.default):a(()=>import("./index-CXYI0OjH.js"),[]).then(e=>e.wallet);case"com.tellaw":return t?a(()=>import("./image-sm-_D7TO.js"),[]).then(e=>e.default):a(()=>import("./index-Ddqy22qU.js"),[]).then(e=>e.wallet);case"io.klever":return t?a(()=>import("./image-BBFbQZtc.js"),[]).then(e=>e.default):a(()=>import("./index-BJAcAgB9.js"),[]).then(e=>e.wallet);case"com.unstoppabledomains":return t?a(()=>import("./image-EUVXQieb.js"),[]).then(e=>e.default):a(()=>import("./index-B1XrJIPH.js"),[]).then(e=>e.wallet);case"is.callback":return t?a(()=>import("./image-Mf3UQvEC.js"),[]).then(e=>e.default):a(()=>import("./index-DTtDhdi2.js"),[]).then(e=>e.wallet);case"ai.pundi":return t?a(()=>import("./image-9BTuaiXb.js"),[]).then(e=>e.default):a(()=>import("./index-Ca7jbqnT.js"),[]).then(e=>e.wallet);case"io.summonersarena":return t?a(()=>import("./image-3-p5LJAk.js"),[]).then(e=>e.default):a(()=>import("./index-ovz39Egy.js"),[]).then(e=>e.wallet);case"io.fizen":return t?a(()=>import("./image-CZLdphQJ.js"),[]).then(e=>e.default):a(()=>import("./index-WwjGYjHa.js"),[]).then(e=>e.wallet);case"fi.pillar":return t?a(()=>import("./image-CVAbhfmI.js"),[]).then(e=>e.default):a(()=>import("./index-BFJUkm8C.js"),[]).then(e=>e.wallet);case"world.ixo":return t?a(()=>import("./image-CsTNl20e.js"),[]).then(e=>e.default):a(()=>import("./index-C-A1j44m.js"),[]).then(e=>e.wallet);case"org.thetatoken":return t?a(()=>import("./image-BstOz2Sd.js"),[]).then(e=>e.default):a(()=>import("./index-BlU4B6pe.js"),[]).then(e=>e.wallet);case"net.gateweb3":return t?a(()=>import("./image-CypdirPa.js"),[]).then(e=>e.default):a(()=>import("./index-BkM7PWkU.js"),[]).then(e=>e.wallet);case"app.ammer":return t?a(()=>import("./image-BfGkQCHU.js"),[]).then(e=>e.default):a(()=>import("./index-C0HCn7GN.js"),[]).then(e=>e.wallet);case"us.binance":return t?a(()=>import("./image-DgkgLcDL.js"),[]).then(e=>e.default):a(()=>import("./index-BuhGQjsZ.js"),[]).then(e=>e.wallet);case"io.yusetoken":return t?a(()=>import("./image-CSAN5rKt.js"),[]).then(e=>e.default):a(()=>import("./index-DQ8_v09O.js"),[]).then(e=>e.wallet);case"co.muza":return t?a(()=>import("./image-CRsMfPT0.js"),[]).then(e=>e.default):a(()=>import("./index-5IpGHzAv.js"),[]).then(e=>e.wallet);case"io.hyperpay":return t?a(()=>import("./image-D8scG8aP.js"),[]).then(e=>e.default):a(()=>import("./index-BXZiXU-9.js"),[]).then(e=>e.wallet);case"io.cosmostation":return t?a(()=>import("./image-BYUgGshq.js"),[]).then(e=>e.default):a(()=>import("./index-RiIluuCN.js"),[]).then(e=>e.wallet);case"app.ryipay":return t?a(()=>import("./image-oKct0i27.js"),[]).then(e=>e.default):a(()=>import("./index-CdvxolxE.js"),[]).then(e=>e.wallet);case"io.wallet3":return t?a(()=>import("./image-DJLc6AlW.js"),[]).then(e=>e.default):a(()=>import("./index-C_5dy4gh.js"),[]).then(e=>e.wallet);case"org.dota168":return t?a(()=>import("./image-D3VAu6BC.js"),[]).then(e=>e.default):a(()=>import("./index-BP76iXI2.js"),[]).then(e=>e.wallet);case"com.bitpie":return t?a(()=>import("./image-BUsH-M52.js"),[]).then(e=>e.default):a(()=>import("./index-BKN05ia6.js"),[]).then(e=>e.wallet);case"com.coininn":return t?a(()=>import("./image-B_AAvjJY.js"),[]).then(e=>e.default):a(()=>import("./index-l2eJJ7mG.js"),[]).then(e=>e.wallet);case"me.easy":return t?a(()=>import("./image-BjKXKIhU.js"),[]).then(e=>e.default):a(()=>import("./index-4WvPsM5O.js"),[]).then(e=>e.wallet);case"io.shido":return t?a(()=>import("./image-BGZ2pFmO.js"),[]).then(e=>e.default):a(()=>import("./index-SaOy8OjI.js"),[]).then(e=>e.wallet);case"com.neonwallet":return t?a(()=>import("./image-D2051qUc.js"),[]).then(e=>e.default):a(()=>import("./index-CUJUgO36.js"),[]).then(e=>e.wallet);case"com.secuxtech":return t?a(()=>import("./image-DHHZDLK-.js"),[]).then(e=>e.default):a(()=>import("./index-D1G_5OyD.js"),[]).then(e=>e.wallet);case"com.unitywallet":return t?a(()=>import("./image-BqmT5urK.js"),[]).then(e=>e.default):a(()=>import("./index-BqxSKkSq.js"),[]).then(e=>e.wallet);case"io.miraiapp":return t?a(()=>import("./image-Bi1elmSL.js"),[]).then(e=>e.default):a(()=>import("./index-D0rQT1_1.js"),[]).then(e=>e.wallet);case"com.beexo":return t?a(()=>import("./image-MGwelZJS.js"),[]).then(e=>e.default):a(()=>import("./index-Bbv-4GNB.js"),[]).then(e=>e.wallet);case"social.halo":return t?a(()=>import("./image-CbnSXqJS.js"),[]).then(e=>e.default):a(()=>import("./index-KpPak-wu.js"),[]).then(e=>e.wallet);case"com.gemspocket":return t?a(()=>import("./image-DpGIEKrK.js"),[]).then(e=>e.default):a(()=>import("./index-RpXAvNRL.js"),[]).then(e=>e.wallet);case"app.status":return t?a(()=>import("./image-9509MPsE.js"),[]).then(e=>e.default):a(()=>import("./index-DLMSD3H_.js"),[]).then(e=>e.wallet);case"com.midoin":return t?a(()=>import("./image-BocNs9ze.js"),[]).then(e=>e.default):a(()=>import("./index-CrBWjlui.js"),[]).then(e=>e.wallet);case"id.competence":return t?a(()=>import("./image-CaqftHzf.js"),[]).then(e=>e.default):a(()=>import("./index-CGMXxK_x.js"),[]).then(e=>e.wallet);case"com.safemoon":return t?a(()=>import("./image-BcfiUDv-.js"),[]).then(e=>e.default):a(()=>import("./index-BgECKCj8.js"),[]).then(e=>e.wallet);case"llc.besc":return t?a(()=>import("./image-DLwHWQ4l.js"),[]).then(e=>e.default):a(()=>import("./index-CbMeskkV.js"),[]).then(e=>e.wallet);case"baby.smart":return t?a(()=>import("./image-VxDqDj0T.js"),[]).then(e=>e.default):a(()=>import("./index-BmKJ1abQ.js"),[]).then(e=>e.wallet);case"app.onto":return t?a(()=>import("./image-BCXqBewH.js"),[]).then(e=>e.default):a(()=>import("./index-BPFXH4g9.js"),[]).then(e=>e.wallet);case"com.ivirse":return t?a(()=>import("./image-8DkN4eFx.js"),[]).then(e=>e.default):a(()=>import("./index-CqWFxNbG.js"),[]).then(e=>e.wallet);case"one.mixin.messenger":return t?a(()=>import("./image-DecSbpNG.js"),[]).then(e=>e.default):a(()=>import("./index-PjYIiHEb.js"),[]).then(e=>e.wallet);case"cash.abpay":return t?a(()=>import("./image-Bb4ZLG-2.js"),[]).then(e=>e.default):a(()=>import("./index-BrvgJVgh.js"),[]).then(e=>e.wallet);case"ch.dssecurity":return t?a(()=>import("./image-ddsU9gPS.js"),[]).then(e=>e.default):a(()=>import("./index-DDdoZFD-.js"),[]).then(e=>e.wallet);case"com.concordium.wallet":return t?a(()=>import("./image-W5rUOVDT.js"),[]).then(e=>e.default):a(()=>import("./index-B5BAsv-B.js"),[]).then(e=>e.wallet);case"io.zkape":return t?a(()=>import("./image-Bm-o9RF3.js"),[]).then(e=>e.default):a(()=>import("./index-yLatYZZK.js"),[]).then(e=>e.wallet);case"com.paliwallet":return t?a(()=>import("./image-DqH_Lyo9.js"),[]).then(e=>e.default):a(()=>import("./index-C93NlSEw.js"),[]).then(e=>e.wallet);case"io.pitaka":return t?a(()=>import("./image-Bo8CHmCG.js"),[]).then(e=>e.default):a(()=>import("./index-DeQey0SH.js"),[]).then(e=>e.wallet);case"com.saitamatoken":return t?a(()=>import("./image-AlOoIjkb.js"),[]).then(e=>e.default):a(()=>import("./index-CNkg8_tm.js"),[]).then(e=>e.wallet);case"org.mugambo":return t?a(()=>import("./image-vXNBwFvw.js"),[]).then(e=>e.default):a(()=>import("./index-CqJjpCD5.js"),[]).then(e=>e.wallet);case"fi.stablez":return t?a(()=>import("./image-CruMo9Ar.js"),[]).then(e=>e.default):a(()=>import("./index-Wz7obrZB.js"),[]).then(e=>e.wallet);case"io.legacynetwork":return t?a(()=>import("./image-Dgb3Vdrr.js"),[]).then(e=>e.default):a(()=>import("./index-DLHjxUiX.js"),[]).then(e=>e.wallet);case"com.meld.app":return t?a(()=>import("./image-DrobCWF2.js"),[]).then(e=>e.default):a(()=>import("./index-BqLb859N.js"),[]).then(e=>e.wallet);case"io.bladewallet":return t?a(()=>import("./image-nqueMEws.js"),[]).then(e=>e.default):a(()=>import("./index-C0I75rp3.js"),[]).then(e=>e.wallet);case"com.authentrend":return t?a(()=>import("./image-CmzmxiTz.js"),[]).then(e=>e.default):a(()=>import("./index-0qRtNAQn.js"),[]).then(e=>e.wallet);case"com.webauth":return t?a(()=>import("./image-EyKsXf_1.js"),[]).then(e=>e.default):a(()=>import("./index-BXnDDK-y.js"),[]).then(e=>e.wallet);case"xyz.tucop":return t?a(()=>import("./image-8r04P3UP.js"),[]).then(e=>e.default):a(()=>import("./index-Bbznecif.js"),[]).then(e=>e.wallet);case"pro.fintoken":return t?a(()=>import("./image-BBez6ov1.js"),[]).then(e=>e.default):a(()=>import("./index-CP3DQPwx.js"),[]).then(e=>e.wallet);case"io.nash":return t?a(()=>import("./image--fcqsYch.js"),[]).then(e=>e.default):a(()=>import("./index-Bx9srovK.js"),[]).then(e=>e.wallet);case"vc.uincubator.api":return t?a(()=>import("./image-CyLv-qKv.js"),[]).then(e=>e.default):a(()=>import("./index-B5AZ3O3C.js"),[]).then(e=>e.wallet);case"io.unagi.unawallet":return t?a(()=>import("./image-C6ewnpHo.js"),[]).then(e=>e.default):a(()=>import("./index-CD7cY8HX.js"),[]).then(e=>e.wallet);case"io.nonbank":return t?a(()=>import("./image-TA_PkYBz.js"),[]).then(e=>e.default):a(()=>import("./index-DSWhMtMn.js"),[]).then(e=>e.wallet);case"io.armana.portal":return t?a(()=>import("./image-CI3i53ES.js"),[]).then(e=>e.default):a(()=>import("./index-DuTQzi4Z.js"),[]).then(e=>e.wallet);case"com.x9wallet":return t?a(()=>import("./image-BnT6IaIq.js"),[]).then(e=>e.default):a(()=>import("./index-K7y9yqJI.js"),[]).then(e=>e.wallet);case"io.kigo":return t?a(()=>import("./image-D9i7y0RW.js"),[]).then(e=>e.default):a(()=>import("./index-BIFgx20V.js"),[]).then(e=>e.wallet);case"com.alphawallet":return t?a(()=>import("./image-xJO47ptb.js"),[]).then(e=>e.default):a(()=>import("./index-B78E3fcT.js"),[]).then(e=>e.wallet);case"com.getcogni":return t?a(()=>import("./image-CwsKp0mM.js"),[]).then(e=>e.default):a(()=>import("./index-BNlDhEDg.js"),[]).then(e=>e.wallet);case"app.sinum":return t?a(()=>import("./image-DTy0DgOV.js"),[]).then(e=>e.default):a(()=>import("./index-D5GVUjIM.js"),[]).then(e=>e.wallet);case"finance.soulswap.app":return t?a(()=>import("./image-BI8lK7Gl.js"),[]).then(e=>e.default):a(()=>import("./index-CB_NguTF.js"),[]).then(e=>e.wallet);case"io.loopring.wallet":return t?a(()=>import("./image-BdLvgjKp.js"),[]).then(e=>e.default):a(()=>import("./index-DpoJvg5R.js"),[]).then(e=>e.wallet);case"com.shapeshift":return t?a(()=>import("./image-T2oAotCg.js"),[]).then(e=>e.default):a(()=>import("./index-CdMxme0L.js"),[]).then(e=>e.wallet);case"io.trinity-tech":return t?a(()=>import("./image-bHVCC2t9.js"),[]).then(e=>e.default):a(()=>import("./index-JNZoio_2.js"),[]).then(e=>e.wallet);case"money.keychain":return t?a(()=>import("./image-CHotlokX.js"),[]).then(e=>e.default):a(()=>import("./index-C2CZkwuV.js"),[]).then(e=>e.wallet);case"com.superhero.cordova":return t?a(()=>import("./image-CsmwtAjX.js"),[]).then(e=>e.default):a(()=>import("./index-C5X26G0P.js"),[]).then(e=>e.wallet);case"com.bettatrade":return t?a(()=>import("./image-B4MULACL.js"),[]).then(e=>e.default):a(()=>import("./index-qNIXx6_B.js"),[]).then(e=>e.wallet);case"online.puzzle":return t?a(()=>import("./image-C4hEqt6v.js"),[]).then(e=>e.default):a(()=>import("./index-D2-ySoTs.js"),[]).then(e=>e.wallet);case"gg.indi":return t?a(()=>import("./image-DdicXBNF.js"),[]).then(e=>e.default):a(()=>import("./index-BTkNDmCP.js"),[]).then(e=>e.wallet);case"io.tradestrike":return t?a(()=>import("./image-Bsv1aEQB.js"),[]).then(e=>e.default):a(()=>import("./index-CLtv9-lU.js"),[]).then(e=>e.wallet);case"xyz.echooo":return t?a(()=>import("./image-C7H4CQ65.js"),[]).then(e=>e.default):a(()=>import("./index-B-UTLjBc.js"),[]).then(e=>e.wallet);case"com.kryptogo":return t?a(()=>import("./image-D3ALeCj7.js"),[]).then(e=>e.default):a(()=>import("./index-BtBx3hi1.js"),[]).then(e=>e.wallet);case"io.trustasset":return t?a(()=>import("./image-BfmBx3-B.js"),[]).then(e=>e.default):a(()=>import("./index-MECmwSvw.js"),[]).then(e=>e.wallet);case"app.utorg":return t?a(()=>import("./image-CyF2UJbG.js"),[]).then(e=>e.default):a(()=>import("./index-DK-e_E51.js"),[]).then(e=>e.wallet);case"app.dfinnwallet":return t?a(()=>import("./image-DGLcwgsS.js"),[]).then(e=>e.default):a(()=>import("./index-DR-ujXcj.js"),[]).then(e=>e.wallet);case"org.rezor":return t?a(()=>import("./image-D_0i3ZH4.js"),[]).then(e=>e.default):a(()=>import("./index-DlKNOIdN.js"),[]).then(e=>e.wallet);case"io.legionnetwork":return t?a(()=>import("./image-BszqTwo7.js"),[]).then(e=>e.default):a(()=>import("./index-DMyHg26L.js"),[]).then(e=>e.wallet);case"cc.maxwallet":return t?a(()=>import("./image-CxvWjDXv.js"),[]).then(e=>e.default):a(()=>import("./index-Dy45c3qF.js"),[]).then(e=>e.wallet);case"com.ripio":return t?a(()=>import("./image-DZpGtN5l.js"),[]).then(e=>e.default):a(()=>import("./index-BoC-cn90.js"),[]).then(e=>e.wallet);case"com.fxwallet":return t?a(()=>import("./image-Bkj-ZRbS.js"),[]).then(e=>e.default):a(()=>import("./index-D8dYcFAn.js"),[]).then(e=>e.wallet);case"inc.tomo":return t?a(()=>import("./image-rw28GAIu.js"),[]).then(e=>e.default):a(()=>import("./index-Bh8eOJMM.js"),[]).then(e=>e.wallet);case"me.komet.app":return t?a(()=>import("./image-29vwsAfI.js"),[]).then(e=>e.default):a(()=>import("./index-CapnWgEl.js"),[]).then(e=>e.wallet);case"io.guardiianwallet":return t?a(()=>import("./image-DIDeRhKH.js"),[]).then(e=>e.default):a(()=>import("./index-CWTqaiN6.js"),[]).then(e=>e.wallet);case"io.hacken.hai":return t?a(()=>import("./image-Fq457JJn.js"),[]).then(e=>e.default):a(()=>import("./index-BH1-nK1j.js"),[]).then(e=>e.wallet);case"com.zypto":return t?a(()=>import("./image-D9OC6Qfy.js"),[]).then(e=>e.default):a(()=>import("./index-5U2ZJeh5.js"),[]).then(e=>e.wallet);case"io.nabox":return t?a(()=>import("./image-CJb0NNxX.js"),[]).then(e=>e.default):a(()=>import("./index-Cl87iGjg.js"),[]).then(e=>e.wallet);case"com.tastycrypto":return t?a(()=>import("./image-IpgDqPq2.js"),[]).then(e=>e.default):a(()=>import("./index-CXgqt45P.js"),[]).then(e=>e.wallet);case"com.ballet":return t?a(()=>import("./image-DNyYhMNV.js"),[]).then(e=>e.default):a(()=>import("./index-DhFHq_nZ.js"),[]).then(e=>e.wallet);case"io.talken":return t?a(()=>import("./image-DjXN5hvv.js"),[]).then(e=>e.default):a(()=>import("./index-CuJtvtqs.js"),[]).then(e=>e.wallet);case"io.wallacy":return t?a(()=>import("./image-CdGvq_lV.js"),[]).then(e=>e.default):a(()=>import("./index-DcUozftP.js"),[]).then(e=>e.wallet);case"network.mrhb":return t?a(()=>import("./image-CaBQfcNB.js"),[]).then(e=>e.default):a(()=>import("./index-BpspMk9l.js"),[]).then(e=>e.wallet);case"io.pockie":return t?a(()=>import("./image-D13kcv8b.js"),[]).then(e=>e.default):a(()=>import("./index-Bd7BhrCK.js"),[]).then(e=>e.wallet);case"me.astrox":return t?a(()=>import("./image-BGSprUxs.js"),[]).then(e=>e.default):a(()=>import("./index-BM9GzZ_o.js"),[]).then(e=>e.wallet);case"com.thirdweb":return t?a(()=>import("./image--O11VYbP.js"),[]).then(e=>e.default):a(()=>import("./index-VZmM-6RJ.js"),[]).then(e=>e.wallet);case"com.poolsmobility.wallet":return t?a(()=>import("./image-CUFBkGzy.js"),[]).then(e=>e.default):a(()=>import("./index-DMyDV-OH.js"),[]).then(e=>e.wallet);case"xyz.roam.wallet":return t?a(()=>import("./image-BBk5bBxJ.js"),[]).then(e=>e.default):a(()=>import("./index-DACt8hFb.js"),[]).then(e=>e.wallet);case"app.gamic":return t?a(()=>import("./image-CbmAI5Wi.js"),[]).then(e=>e.default):a(()=>import("./index-D09WfuKj.js"),[]).then(e=>e.wallet);case"app.m1nty":return t?a(()=>import("./image-8Zz6I0OH.js"),[]).then(e=>e.default):a(()=>import("./index-CU6cpe0O.js"),[]).then(e=>e.wallet);case"network.trustkeys":return t?a(()=>import("./image-BJAlBW3-.js"),[]).then(e=>e.default):a(()=>import("./index-BSA2BPZ9.js"),[]).then(e=>e.wallet);case"com.caesiumlab":return t?a(()=>import("./image-DLtkWmCC.js"),[]).then(e=>e.default):a(()=>import("./index-CZNdz8B6.js"),[]).then(e=>e.wallet);case"app.catecoin":return t?a(()=>import("./image-BIIaxSfC.js"),[]).then(e=>e.default):a(()=>import("./index-DNynPGua.js"),[]).then(e=>e.wallet);case"com.hootark":return t?a(()=>import("./image-BQTKy54v.js"),[]).then(e=>e.default):a(()=>import("./index-DhlaSoR4.js"),[]).then(e=>e.wallet);case"com.crossmint":return t?a(()=>import("./image-DrH3Wn2w.js"),[]).then(e=>e.default):a(()=>import("./index-Czf-i91G.js"),[]).then(e=>e.wallet);case"com.coincircle":return t?a(()=>import("./image-DOcz3CQ4.js"),[]).then(e=>e.default):a(()=>import("./index-Crs9jVrm.js"),[]).then(e=>e.wallet);case"io.bharatbox":return t?a(()=>import("./image-D1eN-vq9.js"),[]).then(e=>e.default):a(()=>import("./index-CdYRC4Ux.js"),[]).then(e=>e.wallet);case"nl.greenhood.wallet":return t?a(()=>import("./image-Cyy1KupU.js"),[]).then(e=>e.default):a(()=>import("./index-BPgl8Hhp.js"),[]).then(e=>e.wallet);case"co.swopme":return t?a(()=>import("./image-B6SAWLjq.js"),[]).then(e=>e.default):a(()=>import("./index-DMAP8qTI.js"),[]).then(e=>e.wallet);case"com.kresus":return t?a(()=>import("./image-DesBMjvP.js"),[]).then(e=>e.default):a(()=>import("./index-oEcArN4B.js"),[]).then(e=>e.wallet);case"com.dolletwallet":return t?a(()=>import("./image-fjbgiffe.js"),[]).then(e=>e.default):a(()=>import("./index-CCIAeA2T.js"),[]).then(e=>e.wallet);case"net.shinobi-wallet":return t?a(()=>import("./image-WbOd8jAJ.js"),[]).then(e=>e.default):a(()=>import("./index-CZmLnawh.js"),[]).then(e=>e.wallet);case"com.azcoiner":return t?a(()=>import("./image-BQcTbEVl.js"),[]).then(e=>e.default):a(()=>import("./index-t6B_NULY.js"),[]).then(e=>e.wallet);case"com.passwallet.app":return t?a(()=>import("./image-DJYKaoNi.js"),[]).then(e=>e.default):a(()=>import("./index-Ct6AYfZ-.js"),[]).then(e=>e.wallet);case"app.qubic.wallet":return t?a(()=>import("./image-BBZFtk5k.js"),[]).then(e=>e.default):a(()=>import("./index-DoKwRUhz.js"),[]).then(e=>e.wallet);case"com.coinex.wallet":return t?a(()=>import("./image-CfglWSsQ.js"),[]).then(e=>e.default):a(()=>import("./index-DMEV07wA.js"),[]).then(e=>e.wallet);case"app.xverse":return t?a(()=>import("./image-DETlLb_v.js"),[]).then(e=>e.default):a(()=>import("./index-DAlw00ee.js"),[]).then(e=>e.wallet);case"com.flash-wallet":return t?a(()=>import("./image-BzGwleUn.js"),[]).then(e=>e.default):a(()=>import("./index-7BdGIDy3.js"),[]).then(e=>e.wallet);case"com.vgxfoundation":return t?a(()=>import("./image-C6NJnfCW.js"),[]).then(e=>e.default):a(()=>import("./index-CsAX4sL-.js"),[]).then(e=>e.wallet);case"org.arianee":return t?a(()=>import("./image-B6VmDbM6.js"),[]).then(e=>e.default):a(()=>import("./index-Cx8lAzRu.js"),[]).then(e=>e.wallet);case"io.myabcwallet":return t?a(()=>import("./image-jv6wUF7a.js"),[]).then(e=>e.default):a(()=>import("./index-3an-fsOm.js"),[]).then(e=>e.wallet);case"io.owallet":return t?a(()=>import("./image-DGhNZ1rS.js"),[]).then(e=>e.default):a(()=>import("./index-D2_d10WC.js"),[]).then(e=>e.wallet);case"io.zelus":return t?a(()=>import("./image-1epPqHV4.js"),[]).then(e=>e.default):a(()=>import("./index-hUldZ-v8.js"),[]).then(e=>e.wallet);case"net.myrenegade":return t?a(()=>import("./image-SJHuomz2.js"),[]).then(e=>e.default):a(()=>import("./index-C5gBqe1B.js"),[]).then(e=>e.wallet);case"io.clingon":return t?a(()=>import("./image-2s8lIjLJ.js"),[]).then(e=>e.default):a(()=>import("./index-Dk8LF9Yk.js"),[]).then(e=>e.wallet);case"com.icewal":return t?a(()=>import("./image-rdvu9IOp.js"),[]).then(e=>e.default):a(()=>import("./index-Cd5Dye5X.js"),[]).then(e=>e.wallet);case"io.streakk":return t?a(()=>import("./image-CcPbeTXv.js"),[]).then(e=>e.default):a(()=>import("./index-CrGDBMbK.js"),[]).then(e=>e.wallet);case"com.dokwallet":return t?a(()=>import("./image-BRPzDWpX.js"),[]).then(e=>e.default):a(()=>import("./index-xEbiF_Me.js"),[]).then(e=>e.wallet);case"finance.porta":return t?a(()=>import("./image-BNvlqRxs.js"),[]).then(e=>e.default):a(()=>import("./index-DSL1LhIu.js"),[]).then(e=>e.wallet);case"io.prettygood.x":return t?a(()=>import("./image-BhmKXBqm.js"),[]).then(e=>e.default):a(()=>import("./index-DfafaK4Q.js"),[]).then(e=>e.wallet);case"io.earthwallet":return t?a(()=>import("./image-BOJcifnx.js"),[]).then(e=>e.default):a(()=>import("./index-BmwlJTQ-.js"),[]).then(e=>e.wallet);case"net.spatium.wallet":return t?a(()=>import("./image-CmrOpLf4.js"),[]).then(e=>e.default):a(()=>import("./index-Fd858RJQ.js"),[]).then(e=>e.wallet);case"live.superex":return t?a(()=>import("./image-ByHnaba8.js"),[]).then(e=>e.default):a(()=>import("./index-DqVvpGRi.js"),[]).then(e=>e.wallet);case"com.adftechnology":return t?a(()=>import("./image-C6LRjQzh.js"),[]).then(e=>e.default):a(()=>import("./index-C-b1qpM9.js"),[]).then(e=>e.wallet);case"com.bscecowallet":return t?a(()=>import("./image-8u03hBEl.js"),[]).then(e=>e.default):a(()=>import("./index-Dn2svNQz.js"),[]).then(e=>e.wallet);case"io.wallypto":return t?a(()=>import("./image-CRU88082.js"),[]).then(e=>e.default):a(()=>import("./index-j06jujv2.js"),[]).then(e=>e.wallet);case"com.reown":return t?a(()=>import("./image-D3tLM-DF.js"),[]).then(e=>e.default):a(()=>import("./index-DibwKtF2.js"),[]).then(e=>e.wallet);case"finance.voltage":return t?a(()=>import("./image-ZVoqlWXW.js"),[]).then(e=>e.default):a(()=>import("./index-XRQW1mUN.js"),[]).then(e=>e.wallet);case"com.walletconnect":return t?a(()=>import("./image-BAS5CqSz.js"),[]).then(e=>e.default):a(()=>import("./index-B-BftUxa.js"),[]).then(e=>e.wallet);case"io.passpay":return t?a(()=>import("./image-Ci0UFTFy.js"),[]).then(e=>e.default):a(()=>import("./index-CP_9UNXA.js"),[]).then(e=>e.wallet);case"technology.obvious":return t?a(()=>import("./image-ZLtraAGN.js"),[]).then(e=>e.default):a(()=>import("./index-BzNpkHfI.js"),[]).then(e=>e.wallet);case"io.plutope":return t?a(()=>import("./image-Bz03or90.js"),[]).then(e=>e.default):a(()=>import("./index-CszQa87W.js"),[]).then(e=>e.wallet);case"io.buzz-up":return t?a(()=>import("./image-BsQYdoXP.js"),[]).then(e=>e.default):a(()=>import("./index-BoJGVmma.js"),[]).then(e=>e.wallet);case"co.xellar":return t?a(()=>import("./image-D2QL-j27.js"),[]).then(e=>e.default):a(()=>import("./index-cdlur5jM.js"),[]).then(e=>e.wallet);case"com.kaxaa":return t?a(()=>import("./image-DPzEe6a_.js"),[]).then(e=>e.default):a(()=>import("./index-DFSGuScS.js"),[]).then(e=>e.wallet);case"org.shefi":return t?a(()=>import("./image-DwUGDFj5.js"),[]).then(e=>e.default):a(()=>import("./index-Dtavj5eK.js"),[]).then(e=>e.wallet);case"xyz.orion":return t?a(()=>import("./image-CCDmsN6r.js"),[]).then(e=>e.default):a(()=>import("./index-Ba2OoCBH.js"),[]).then(e=>e.wallet);case"world.dosi.vault":return t?a(()=>import("./image-Cy0vmJls.js"),[]).then(e=>e.default):a(()=>import("./index-eujSyrnd.js"),[]).then(e=>e.wallet);case"network.gridlock":return t?a(()=>import("./image-CxyHP7w7.js"),[]).then(e=>e.default):a(()=>import("./index-Ce98wt2N.js"),[]).then(e=>e.wallet);case"finance.plena":return t?a(()=>import("./image-Cwg1QVuh.js"),[]).then(e=>e.default):a(()=>import("./index-BG1ZQeCA.js"),[]).then(e=>e.wallet);case"cc.dropp":return t?a(()=>import("./image-CAIffJi4.js"),[]).then(e=>e.default):a(()=>import("./index-HFnaQWCU.js"),[]).then(e=>e.wallet);case"io.scramberry":return t?a(()=>import("./image-D8ARN-Gu.js"),[]).then(e=>e.default):a(()=>import("./index-BIcsFldg.js"),[]).then(e=>e.wallet);case"xyz.bonuz":return t?a(()=>import("./image-HcidEyjv.js"),[]).then(e=>e.default):a(()=>import("./index-BZhX-e71.js"),[]).then(e=>e.wallet);case"com.bmawallet":return t?a(()=>import("./image-kZBIIBVa.js"),[]).then(e=>e.default):a(()=>import("./index-BM8c6qO-.js"),[]).then(e=>e.wallet);case"co.lifedefi":return t?a(()=>import("./image-DRpXk5be.js"),[]).then(e=>e.default):a(()=>import("./index-otRo5H2H.js"),[]).then(e=>e.wallet);case"com.get-verso":return t?a(()=>import("./image-CgzMLfDa.js"),[]).then(e=>e.default):a(()=>import("./index-DAEFTu29.js"),[]).then(e=>e.wallet);case"io.blocto":return t?a(()=>import("./image-FnAIuX7S.js"),[]).then(e=>e.default):a(()=>import("./index-ZITrt5Fi.js"),[]).then(e=>e.wallet);case"com.pandoshi":return t?a(()=>import("./image-PWpnYSKI.js"),[]).then(e=>e.default):a(()=>import("./index-BmXd0pys.js"),[]).then(e=>e.wallet);case"io.getclave":return t?a(()=>import("./image-rvsWf8U_.js"),[]).then(e=>e.default):a(()=>import("./index--rITGawC.js"),[]).then(e=>e.wallet);case"technology.jambo":return t?a(()=>import("./image-Bx8ULApC.js"),[]).then(e=>e.default):a(()=>import("./index-C2KnoZm4.js"),[]).then(e=>e.wallet);case"app.edge":return t?a(()=>import("./image-1-dOu4Yt.js"),[]).then(e=>e.default):a(()=>import("./index-stFagoJS.js"),[]).then(e=>e.wallet);case"io.banksocial":return t?a(()=>import("./image-OrIz0o8m.js"),[]).then(e=>e.default):a(()=>import("./index-Ia3LffGn.js"),[]).then(e=>e.wallet);case"io.konio":return t?a(()=>import("./image-C2Wl7RAy.js"),[]).then(e=>e.default):a(()=>import("./index-B-kI7R4f.js"),[]).then(e=>e.wallet);case"com.qubetics":return t?a(()=>import("./image-DLvMDcgw.js"),[]).then(e=>e.default):a(()=>import("./index-C_j5E1ow.js"),[]).then(e=>e.wallet);case"app.imem":return t?a(()=>import("./image-Atwyf6cQ.js"),[]).then(e=>e.default):a(()=>import("./index-KXLAu1y1.js"),[]).then(e=>e.wallet);case"com.purechain":return t?a(()=>import("./image-DgU8tR58.js"),[]).then(e=>e.default):a(()=>import("./index-G-h-xM0C.js"),[]).then(e=>e.wallet);case"io.ethos":return t?a(()=>import("./image-DmNOl1OW.js"),[]).then(e=>e.default):a(()=>import("./index-DmLPMpkA.js"),[]).then(e=>e.wallet);case"io.didwallet":return t?a(()=>import("./image-CzKmxeZp.js"),[]).then(e=>e.default):a(()=>import("./index-QGSP4PI8.js"),[]).then(e=>e.wallet);case"com.dextrade":return t?a(()=>import("./image-B_ozWfd0.js"),[]).then(e=>e.default):a(()=>import("./index-CdOxXIip.js"),[]).then(e=>e.wallet);case"org.kelp":return t?a(()=>import("./image-CcKS-8-S.js"),[]).then(e=>e.default):a(()=>import("./index-DUBZIaC-.js"),[]).then(e=>e.wallet);case"xyz.nestwallet":return t?a(()=>import("./image-Bq1UxveY.js"),[]).then(e=>e.default):a(()=>import("./index-uKvrIGe-.js"),[]).then(e=>e.wallet);case"com.cryptnox":return t?a(()=>import("./image-UFnS_pK0.js"),[]).then(e=>e.default):a(()=>import("./index-ComRbnem.js"),[]).then(e=>e.wallet);case"land.liker":return t?a(()=>import("./image-C_JPqQZj.js"),[]).then(e=>e.default):a(()=>import("./index-CId5PD0X.js"),[]).then(e=>e.wallet);case"io.hippowallet":return t?a(()=>import("./image-BdJA4XzW.js"),[]).then(e=>e.default):a(()=>import("./index-BTzbgIH6.js"),[]).then(e=>e.wallet);case"io.certhis":return t?a(()=>import("./image-bSOL4gQb.js"),[]).then(e=>e.default):a(()=>import("./index-BxtNhRvf.js"),[]).then(e=>e.wallet);case"io.safecryptowallet":return t?a(()=>import("./image-DFF2Z6Pk.js"),[]).then(e=>e.default):a(()=>import("./index-CWdL5XwO.js"),[]).then(e=>e.wallet);case"com.saify":return t?a(()=>import("./image-DOwBqPVS.js"),[]).then(e=>e.default):a(()=>import("./index-De1eZyIJ.js"),[]).then(e=>e.wallet);case"com.tiduswallet":return t?a(()=>import("./image-DzJAqGfB.js"),[]).then(e=>e.default):a(()=>import("./index-BMPGw_D6.js"),[]).then(e=>e.wallet);case"io.uptn.dapp-web":return t?a(()=>import("./image-C4ELurjg.js"),[]).then(e=>e.default):a(()=>import("./index-jsmqr-24.js"),[]).then(e=>e.wallet);case"com.it.onewallet":return t?a(()=>import("./image-CWCOKSln.js"),[]).then(e=>e.default):a(()=>import("./index-DHNwai-Z.js"),[]).then(e=>e.wallet);case"com.rktechworks":return t?a(()=>import("./image-BhECDi_9.js"),[]).then(e=>e.default):a(()=>import("./index-D6xvjdG0.js"),[]).then(e=>e.wallet);case"com.revelator.wallet":return t?a(()=>import("./image-nW5JvdXC.js"),[]).then(e=>e.default):a(()=>import("./index-CNl69Nv0.js"),[]).then(e=>e.wallet);case"com.sinohope":return t?a(()=>import("./image-D7P0qSfx.js"),[]).then(e=>e.default):a(()=>import("./index-DKzyJcIY.js"),[]).then(e=>e.wallet);case"network.dgg":return t?a(()=>import("./image-DrraBYJZ.js"),[]).then(e=>e.default):a(()=>import("./index-DnUUaSfF.js"),[]).then(e=>e.wallet);case"io.up":return t?a(()=>import("./image-DbpOM2LD.js"),[]).then(e=>e.default):a(()=>import("./index-BuWGQyCe.js"),[]).then(e=>e.wallet);case"com.lif3":return t?a(()=>import("./image-DC2DOoz2.js"),[]).then(e=>e.default):a(()=>import("./index-BKkJhanY.js"),[]).then(e=>e.wallet);case"io.bimwallet":return t?a(()=>import("./image-BKSQyIc5.js"),[]).then(e=>e.default):a(()=>import("./index-3DerMn1X.js"),[]).then(e=>e.wallet);case"pub.dg":return t?a(()=>import("./image-C4KoLZ1v.js"),[]).then(e=>e.default):a(()=>import("./index-D6d2Y6jv.js"),[]).then(e=>e.wallet);case"com.wemix":return t?a(()=>import("./image-CawBnBIo.js"),[]).then(e=>e.default):a(()=>import("./index-18L0wZ74.js"),[]).then(e=>e.wallet);case"com.pierwallet":return t?a(()=>import("./image-DA8Sg5HZ.js"),[]).then(e=>e.default):a(()=>import("./index-mJTgSazQ.js"),[]).then(e=>e.wallet);case"net.stasis":return t?a(()=>import("./image-CyE6Mi3e.js"),[]).then(e=>e.default):a(()=>import("./index-CJ8I9s4o.js"),[]).then(e=>e.wallet);case"com.peakdefi":return t?a(()=>import("./image-DUcJQ0b3.js"),[]).then(e=>e.default):a(()=>import("./index-DEMIRENu.js"),[]).then(e=>e.wallet);case"com.3swallet":return t?a(()=>import("./image-CD3he1Tj.js"),[]).then(e=>e.default):a(()=>import("./index-DVGcX2HE.js"),[]).then(e=>e.wallet);case"com.example.subdomain":return t?a(()=>import("./image-Cs2bevZt.js"),[]).then(e=>e.default):a(()=>import("./index-CJt068xh.js"),[]).then(e=>e.wallet);case"com.reown.appkit-lab":return t?a(()=>import("./image-CnDG0aor.js"),[]).then(e=>e.default):a(()=>import("./index-BzfyCotn.js"),[]).then(e=>e.wallet);case"com.opz":return t?a(()=>import("./image-D1qvgd7h.js"),[]).then(e=>e.default):a(()=>import("./index-CMGByxdA.js"),[]).then(e=>e.wallet);case"ai.spotonchain.platform":return t?a(()=>import("./image-C6QSWUy4.js"),[]).then(e=>e.default):a(()=>import("./index-Ba7PpD6d.js"),[]).then(e=>e.wallet);case"org.dailychain.wallet":return t?a(()=>import("./image-BJ_lqI1X.js"),[]).then(e=>e.default):a(()=>import("./index-DQa9pNJd.js"),[]).then(e=>e.wallet);case"app.omni":return t?a(()=>import("./image-CqLwuE__.js"),[]).then(e=>e.default):a(()=>import("./index-D_7wDcMK.js"),[]).then(e=>e.wallet);case"id.plumaa":return t?a(()=>import("./image-BvJKCSpY.js"),[]).then(e=>e.default):a(()=>import("./index-D45a0k-1.js"),[]).then(e=>e.wallet);case"io.ttmwallet":return t?a(()=>import("./image-Chg2WzE1.js"),[]).then(e=>e.default):a(()=>import("./index-CLikIjn_.js"),[]).then(e=>e.wallet);case"io.kgen":return t?a(()=>import("./image-DFYGQEwh.js"),[]).then(e=>e.default):a(()=>import("./index-BQWXi0by.js"),[]).then(e=>e.wallet);case"com.nufinetes":return t?a(()=>import("./image-CpFHTO_m.js"),[]).then(e=>e.default):a(()=>import("./index-B8De2hoC.js"),[]).then(e=>e.wallet);case"com.squirrelwallet":return t?a(()=>import("./image-bHJO6btW.js"),[]).then(e=>e.default):a(()=>import("./index-DyaPXLoO.js"),[]).then(e=>e.wallet);case"eu.trusteeglobal":return t?a(()=>import("./image-cDoShVvl.js"),[]).then(e=>e.default):a(()=>import("./index-B51294pb.js"),[]).then(e=>e.wallet);case"com.daffione":return t?a(()=>import("./image-Dtc98pdf.js"),[]).then(e=>e.default):a(()=>import("./index-BIXqJF5y.js"),[]).then(e=>e.wallet);case"com.saakuru.app":return t?a(()=>import("./image-TQLBEOIW.js"),[]).then(e=>e.default):a(()=>import("./index-CjVYDT09.js"),[]).then(e=>e.wallet);case"io.r0ar":return t?a(()=>import("./image-4bx5chOJ.js"),[]).then(e=>e.default):a(()=>import("./index-CfCXSq_b.js"),[]).then(e=>e.wallet);case"com.nodle":return t?a(()=>import("./image-tiHbZ1Vk.js"),[]).then(e=>e.default):a(()=>import("./index-BwL47YsA.js"),[]).then(e=>e.wallet);case"app.tofee":return t?a(()=>import("./image-DpHbdMp9.js"),[]).then(e=>e.default):a(()=>import("./index-Bk-uZV0j.js"),[]).then(e=>e.wallet);case"io.pltwallet":return t?a(()=>import("./image-BIDqxk8w.js"),[]).then(e=>e.default):a(()=>import("./index-eiEAIzdd.js"),[]).then(e=>e.wallet);case"org.talkapp":return t?a(()=>import("./image-BkKo9DtA.js"),[]).then(e=>e.default):a(()=>import("./index-BGGk2Hck.js"),[]).then(e=>e.wallet);case"io.ready":return t?a(()=>import("./image-BwjeUYie.js"),[]).then(e=>e.default):a(()=>import("./index-BQwDdmmS.js"),[]).then(e=>e.wallet);case"app.w3wallet":return t?a(()=>import("./image-Covp72ND.js"),[]).then(e=>e.default):a(()=>import("./index-Cb41eDDJ.js"),[]).then(e=>e.wallet);case"pro.ds.app":return t?a(()=>import("./image-Bktw-NJ-.js"),[]).then(e=>e.default):a(()=>import("./index-b5ABnFKj.js"),[]).then(e=>e.wallet);case"com.reown.docs":return t?a(()=>import("./image-V4qYiUxw.js"),[]).then(e=>e.default):a(()=>import("./index-DsgD7D-8.js"),[]).then(e=>e.wallet);case"com.apollox":return t?a(()=>import("./image-ss2LFlQu.js"),[]).then(e=>e.default):a(()=>import("./index-BLMjeGJ-.js"),[]).then(e=>e.wallet);case"com.ipmb":return t?a(()=>import("./image-CirJIT7l.js"),[]).then(e=>e.default):a(()=>import("./index-DP0utIbV.js"),[]).then(e=>e.wallet);case"com.payperless":return t?a(()=>import("./image-q4XfUN6v.js"),[]).then(e=>e.default):a(()=>import("./index-szNElS1a.js"),[]).then(e=>e.wallet);case"com.obliowallet":return t?a(()=>import("./image-BGxqJH7c.js"),[]).then(e=>e.default):a(()=>import("./index-JuvDLDuk.js"),[]).then(e=>e.wallet);case"app.keeper-wallet":return t?a(()=>import("./image-Dpgf4dcg.js"),[]).then(e=>e.default):a(()=>import("./index-DlfGjmz4.js"),[]).then(e=>e.wallet);case"io.paraswap":return t?a(()=>import("./image-CQKjvlto.js"),[]).then(e=>e.default):a(()=>import("./index-DjLE3t9q.js"),[]).then(e=>e.wallet);case"org.ecoinwallet":return t?a(()=>import("./image-C3Va51zP.js"),[]).then(e=>e.default):a(()=>import("./index-DFZNHq44.js"),[]).then(e=>e.wallet);case"fi.dropmate":return t?a(()=>import("./image-5xiz28Wo.js"),[]).then(e=>e.default):a(()=>import("./index-p0ATWoVh.js"),[]).then(e=>e.wallet);case"com.cryptokara":return t?a(()=>import("./image-Dqbrewdt.js"),[]).then(e=>e.default):a(()=>import("./index-Cfzzcvgo.js"),[]).then(e=>e.wallet);case"co.cyber.wallet":return t?a(()=>import("./image-BvkSxpXq.js"),[]).then(e=>e.default):a(()=>import("./index-e_qeQmc1.js"),[]).then(e=>e.wallet);case"com.kriptonio":return t?a(()=>import("./image-D_cIj1db.js"),[]).then(e=>e.default):a(()=>import("./index-Dxm6Y7eO.js"),[]).then(e=>e.wallet);case"digital.minerva":return t?a(()=>import("./image-D5wxf47e.js"),[]).then(e=>e.default):a(()=>import("./index-HnCuhDYJ.js"),[]).then(e=>e.wallet);case"com.mpcvault.broswerplugin":return t?a(()=>import("./image-BN4ovMrn.js"),[]).then(e=>e.default):a(()=>import("./index-BXY5tnuK.js"),[]).then(e=>e.wallet);case"com.liberawallet":return t?a(()=>import("./image-DyrMImIL.js"),[]).then(e=>e.default):a(()=>import("./index-Dqyfi4dm.js"),[]).then(e=>e.wallet);case"io.helixid":return t?a(()=>import("./image-Dkp4M1ik.js"),[]).then(e=>e.default):a(()=>import("./index-RJhc6LnM.js"),[]).then(e=>e.wallet);case"com.broearn":return t?a(()=>import("./image-JyGUnQ_N.js"),[]).then(e=>e.default):a(()=>import("./index-WsH2ZGfO.js"),[]).then(e=>e.wallet);case"io.altme":return t?a(()=>import("./image-MQbcgW7z.js"),[]).then(e=>e.default):a(()=>import("./index-CpMkh5pZ.js"),[]).then(e=>e.wallet);case"app.herewallet":return t?a(()=>import("./image-gnC_p3Da.js"),[]).then(e=>e.default):a(()=>import("./index-CecEswCv.js"),[]).then(e=>e.wallet);case"com.coinsdo":return t?a(()=>import("./image-DrHhCSDD.js"),[]).then(e=>e.default):a(()=>import("./index-DJYG2Vtc.js"),[]).then(e=>e.wallet);case"trade.flooz.wallet":return t?a(()=>import("./image-DaaIjpQJ.js"),[]).then(e=>e.default):a(()=>import("./index-C6EDKfcJ.js"),[]).then(e=>e.wallet);case"com.tapwallet":return t?a(()=>import("./image-BxeDPEwg.js"),[]).then(e=>e.default):a(()=>import("./index-BwCUvEoQ.js"),[]).then(e=>e.wallet);case"fun.tobi":return t?a(()=>import("./image-DmhgJWq-.js"),[]).then(e=>e.default):a(()=>import("./index-C1adBKyv.js"),[]).then(e=>e.wallet);case"com.bitnovo":return t?a(()=>import("./image-BTZyVpoA.js"),[]).then(e=>e.default):a(()=>import("./index-CaZIFXyW.js"),[]).then(e=>e.wallet);case"io.xucre":return t?a(()=>import("./image-DZ-B-aVa.js"),[]).then(e=>e.default):a(()=>import("./index-BBDAdmKp.js"),[]).then(e=>e.wallet);case"app.girin":return t?a(()=>import("./image-CkQb0YUH.js"),[]).then(e=>e.default):a(()=>import("./index-CpJZxSfI.js"),[]).then(e=>e.wallet);case"finance.panaroma":return t?a(()=>import("./image-Z9k3mhsb.js"),[]).then(e=>e.default):a(()=>import("./index-BIeLm-x3.js"),[]).then(e=>e.wallet);case"app.clot":return t?a(()=>import("./image-DZplWZyD.js"),[]).then(e=>e.default):a(()=>import("./index-BVQeUBdj.js"),[]).then(e=>e.wallet);case"io.transi":return t?a(()=>import("./image-Dc5zhKf6.js"),[]).then(e=>e.default):a(()=>import("./index-DDggnqr4.js"),[]).then(e=>e.wallet);case"world.qoin":return t?a(()=>import("./image-BPAkEl8k.js"),[]).then(e=>e.default):a(()=>import("./index-C9taR4Do.js"),[]).then(e=>e.wallet);case"com.greengloryglobal":return t?a(()=>import("./image-lOdcUtWG.js"),[]).then(e=>e.default):a(()=>import("./index-C-OT0KJG.js"),[]).then(e=>e.wallet);case"com.amazewallet":return t?a(()=>import("./image-2wmDBIB6.js"),[]).then(e=>e.default):a(()=>import("./index-DvXpQOkv.js"),[]).then(e=>e.wallet);case"zone.bitverse":return t?a(()=>import("./image-C6aZzydG.js"),[]).then(e=>e.default):a(()=>import("./index-CN6XdMAo.js"),[]).then(e=>e.wallet);case"social.gm2":return t?a(()=>import("./image-BqtrMo-7.js"),[]).then(e=>e.default):a(()=>import("./index-Coq7--sH.js"),[]).then(e=>e.wallet);case"io.ozonewallet":return t?a(()=>import("./image-BtnrRGhZ.js"),[]).then(e=>e.default):a(()=>import("./index-DFc7lZHb.js"),[]).then(e=>e.wallet);case"io.ukiss":return t?a(()=>import("./image-DFYwzuHA.js"),[]).then(e=>e.default):a(()=>import("./index-CE9n_StB.js"),[]).then(e=>e.wallet);case"finance.islamicoin":return t?a(()=>import("./image-CWG4tRzZ.js"),[]).then(e=>e.default):a(()=>import("./index-pcLdliEp.js"),[]).then(e=>e.wallet);case"io.copiosa":return t?a(()=>import("./image-DuQoo_kR.js"),[]).then(e=>e.default):a(()=>import("./index-CWmGdvBR.js"),[]).then(e=>e.wallet);case"world.fncy":return t?a(()=>import("./image-B5M2ftPa.js"),[]).then(e=>e.default):a(()=>import("./index-Ba45jQBJ.js"),[]).then(e=>e.wallet);case"io.moonstake":return t?a(()=>import("./image-zsArRLIF.js"),[]).then(e=>e.default):a(()=>import("./index-C7HuhgLE.js"),[]).then(e=>e.wallet);case"com.trusteeglobal":return t?a(()=>import("./image-iR_slvRo.js"),[]).then(e=>e.default):a(()=>import("./index-CNLH4wrU.js"),[]).then(e=>e.wallet);case"net.spatium":return t?a(()=>import("./image-DBFrM6tr.js"),[]).then(e=>e.default):a(()=>import("./index-BJBC3bLU.js"),[]).then(e=>e.wallet);case"co.filwallet":return t?a(()=>import("./image-Do8rO3zE.js"),[]).then(e=>e.default):a(()=>import("./index-D7FslwZl.js"),[]).then(e=>e.wallet);case"money.snowball":return t?a(()=>import("./image-3Q7PfsJG.js"),[]).then(e=>e.default):a(()=>import("./index-yOwMLl2f.js"),[]).then(e=>e.wallet);case"com.ennowallet":return t?a(()=>import("./image-Ccx8wDSE.js"),[]).then(e=>e.default):a(()=>import("./index-BRIQuVzg.js"),[]).then(e=>e.wallet);case"io.safematrix":return t?a(()=>import("./image-BX4sAPzh.js"),[]).then(e=>e.default):a(()=>import("./index-Yk_iQY25.js"),[]).then(e=>e.wallet);case"pro.assure":return t?a(()=>import("./image-DMTT8AeN.js"),[]).then(e=>e.default):a(()=>import("./index-BfYVYwh5.js"),[]).then(e=>e.wallet);case"com.neftipedia":return t?a(()=>import("./image-vrSaD0K9.js"),[]).then(e=>e.default):a(()=>import("./index-BHZDuU0I.js"),[]).then(e=>e.wallet);case"io.goldbit":return t?a(()=>import("./image-CtiFcEL8.js"),[]).then(e=>e.default):a(()=>import("./index-DFrKYv4g.js"),[]).then(e=>e.wallet);case"com.coingrig":return t?a(()=>import("./image-NsVKBwxZ.js"),[]).then(e=>e.default):a(()=>import("./index-DcyXtFTG.js"),[]).then(e=>e.wallet);case"io.xfun":return t?a(()=>import("./image-CPMDxql6.js"),[]).then(e=>e.default):a(()=>import("./index-B05algAv.js"),[]).then(e=>e.wallet);case"com.antiersolutions":return t?a(()=>import("./image-BMh4HSr7.js"),[]).then(e=>e.default):a(()=>import("./index-DufOfQ90.js"),[]).then(e=>e.wallet);case"com.itoken":return t?a(()=>import("./image-BwBO8BTi.js"),[]).then(e=>e.default):a(()=>import("./index-BftqI1FU.js"),[]).then(e=>e.wallet);case"com.cardstack":return t?a(()=>import("./image-D7Sd6W8U.js"),[]).then(e=>e.default):a(()=>import("./index-BiHhxeDt.js"),[]).then(e=>e.wallet);case"io.slavi":return t?a(()=>import("./image-BQUnnXTb.js"),[]).then(e=>e.default):a(()=>import("./index-Kt6GlPCW.js"),[]).then(e=>e.wallet);case"tech.defiantapp":return t?a(()=>import("./image-D4-YMi52.js"),[]).then(e=>e.default):a(()=>import("./index-DPic1oJg.js"),[]).then(e=>e.wallet);case"com.dexari":return t?a(()=>import("./image-BoANtDMS.js"),[]).then(e=>e.default):a(()=>import("./index-DPFoWmV6.js"),[]).then(e=>e.wallet);case"io.cfcx":return t?a(()=>import("./image-139plIjh.js"),[]).then(e=>e.default):a(()=>import("./index-Cws1zSAX.js"),[]).then(e=>e.wallet);case"com.socjsc":return t?a(()=>import("./image-Crp2YP47.js"),[]).then(e=>e.default):a(()=>import("./index-C_XOoDbk.js"),[]).then(e=>e.wallet);case"com.tokenb":return t?a(()=>import("./image-8LnJ1bNt.js"),[]).then(e=>e.default):a(()=>import("./index-DcwbqEHj.js"),[]).then(e=>e.wallet);case"org.onyx":return t?a(()=>import("./image-DKcWaLtu.js"),[]).then(e=>e.default):a(()=>import("./index-C5NL4PoV.js"),[]).then(e=>e.wallet);case"io.gk8":return t?a(()=>import("./image-ZwibGfzR.js"),[]).then(e=>e.default):a(()=>import("./index-CLxj2t1J.js"),[]).then(e=>e.wallet);case"com.anchorage":return t?a(()=>import("./image-OT0Fb2Nb.js"),[]).then(e=>e.default):a(()=>import("./index-aoLVKFG1.js"),[]).then(e=>e.wallet);case"com.hashport.wallet":return t?a(()=>import("./image-DooF_Vfs.js"),[]).then(e=>e.default):a(()=>import("./index-DICTy0sa.js"),[]).then(e=>e.wallet);case"io.billionwallet":return t?a(()=>import("./image-DDBzbPSl.js"),[]).then(e=>e.default):a(()=>import("./index-CmCRou09.js"),[]).then(e=>e.wallet);case"com.dlicom":return t?a(()=>import("./image-lXBTHYnD.js"),[]).then(e=>e.default):a(()=>import("./index-l8DhIVZW.js"),[]).then(e=>e.wallet);case"com.tychiwallet":return t?a(()=>import("./image-pcyfaNhf.js"),[]).then(e=>e.default):a(()=>import("./index-B3vR_dtk.js"),[]).then(e=>e.wallet);case"at.swe":return t?a(()=>import("./image-C8_9fy1e.js"),[]).then(e=>e.default):a(()=>import("./index-ficai7Ce.js"),[]).then(e=>e.wallet);case"network.wali":return t?a(()=>import("./image-CSyxcTwp.js"),[]).then(e=>e.default):a(()=>import("./index-Dzkop1Gk.js"),[]).then(e=>e.wallet);case"io.diamante":return t?a(()=>import("./image-Dh9w9A8z.js"),[]).then(e=>e.default):a(()=>import("./index-C1a5oPtZ.js"),[]).then(e=>e.wallet);case"ai.interlinklabs":return t?a(()=>import("./image-Dz82Zyfj.js"),[]).then(e=>e.default):a(()=>import("./index-BTqXeJHf.js"),[]).then(e=>e.wallet);case"com.walllet":return t?a(()=>import("./image-VFWT6oS6.js"),[]).then(e=>e.default):a(()=>import("./index-DPgWRg9-.js"),[]).then(e=>e.wallet);case"org.lunascape":return t?a(()=>import("./image-D4nkyGrg.js"),[]).then(e=>e.default):a(()=>import("./index-4Nmn8ium.js"),[]).then(e=>e.wallet);case"com.nvxowallet":return t?a(()=>import("./image-BoS2kgXC.js"),[]).then(e=>e.default):a(()=>import("./index-CRRdY0XA.js"),[]).then(e=>e.wallet);case"today.paywithcrypto.wallet":return t?a(()=>import("./image-CsUCYFyx.js"),[]).then(e=>e.default):a(()=>import("./index-CFUSXkKo.js"),[]).then(e=>e.wallet);case"ai.iluminary":return t?a(()=>import("./image-CEuSmI3b.js"),[]).then(e=>e.default):a(()=>import("./index-D1j-SvoJ.js"),[]).then(e=>e.wallet);case"io.reactwallet":return t?a(()=>import("./image-B3lDLhwe.js"),[]).then(e=>e.default):a(()=>import("./index-CTs1t6rA.js"),[]).then(e=>e.wallet);case"com.rewardywallet":return t?a(()=>import("./image-DVyDRAAO.js"),[]).then(e=>e.default):a(()=>import("./index-cF_6KJvb.js"),[]).then(e=>e.wallet);case"io.walletv":return t?a(()=>import("./image-CTBdimeM.js"),[]).then(e=>e.default):a(()=>import("./index-He5kaR9n.js"),[]).then(e=>e.wallet);case"app.outlawgames":return t?a(()=>import("./image-BPqXYngz.js"),[]).then(e=>e.default):a(()=>import("./index-D2hPph8l.js"),[]).then(e=>e.wallet);case"io.ironwallet":return t?a(()=>import("./image-BKNtkg6s.js"),[]).then(e=>e.default):a(()=>import("./index-B1-qcL-p.js"),[]).then(e=>e.wallet);case"com.mecowallet":return t?a(()=>import("./image-m7IlStdm.js"),[]).then(e=>e.default):a(()=>import("./index-BdgyG9Qa.js"),[]).then(e=>e.wallet);case"com.onlybulls":return t?a(()=>import("./image-qLUwfjzV.js"),[]).then(e=>e.default):a(()=>import("./index-DPPIbXj8.js"),[]).then(e=>e.wallet);case"me.qiewallet":return t?a(()=>import("./image-BHJFFIIN.js"),[]).then(e=>e.default):a(()=>import("./index-D6zAueb_.js"),[]).then(e=>e.wallet);case"fund.lflabs":return t?a(()=>import("./image-dO78_uyn.js"),[]).then(e=>e.default):a(()=>import("./index-BBkeSt5m.js"),[]).then(e=>e.wallet);case"io.walletverse":return t?a(()=>import("./image-DUk3AUBd.js"),[]).then(e=>e.default):a(()=>import("./index-CfO_m3oL.js"),[]).then(e=>e.wallet);case"com.berasig":return t?a(()=>import("./image-CisWvLpc.js"),[]).then(e=>e.default):a(()=>import("./index-Cg1E5HxJ.js"),[]).then(e=>e.wallet);case"app.phantom":return t?a(()=>import("./image-6levnvAC.js"),[]).then(e=>e.default):a(()=>import("./index-IBUgXgOa.js"),[]).then(e=>e.wallet);case"com.coinbase.wallet":return t?a(()=>import("./image-C6EsuPXB.js"),[]).then(e=>e.default):a(()=>import("./index-BILUwmJ9.js"),[]).then(e=>e.wallet);case"io.rabby":return t?a(()=>import("./image-CZ2qSHpt.js"),[]).then(e=>e.default):a(()=>import("./index-Bprjmfje.js"),[]).then(e=>e.wallet);case"com.brave.wallet":return t?a(()=>import("./image-9Jtg22X3.js"),[]).then(e=>e.default):a(()=>import("./index-DKbx-y78.js"),[]).then(e=>e.wallet);case"fi.nu":return t?a(()=>import("./image-BAl5qyeX.js"),[]).then(e=>e.default):a(()=>import("./index-BXi61TZ5.js"),[]).then(e=>e.wallet);case"pro.hinkal.walletconnect":return t?a(()=>import("./image-d8n8A6si.js"),[]).then(e=>e.default):a(()=>import("./index-CujrNB-Q.js"),[]).then(e=>e.wallet);case"com.moongate.one":return t?a(()=>import("./image-DZc2BYzk.js"),[]).then(e=>e.default):a(()=>import("./index-B2WV7sR7.js"),[]).then(e=>e.wallet);case"tech.levain":return t?a(()=>import("./image-DcIu3U38.js"),[]).then(e=>e.default):a(()=>import("./index-CEpc_g8h.js"),[]).then(e=>e.wallet);case"com.enkrypt":return t?a(()=>import("./image-DvpdMMzF.js"),[]).then(e=>e.default):a(()=>import("./index-Cc4uopde.js"),[]).then(e=>e.wallet);case"com.scramble":return t?a(()=>import("./image-DT5Fvf2s.js"),[]).then(e=>e.default):a(()=>import("./index-D4Sgj1mL.js"),[]).then(e=>e.wallet);case"io.finoa":return t?a(()=>import("./image-D_i0o0Nv.js"),[]).then(e=>e.default):a(()=>import("./index-DFghxfjK.js"),[]).then(e=>e.wallet);case"com.blazpay.wallet":return t?a(()=>import("./image-CgHABHdL.js"),[]).then(e=>e.default):a(()=>import("./index-B_OXuBhF.js"),[]).then(e=>e.wallet);case"io.getjoin.prd":return t?a(()=>import("./image-CmWdSXJI.js"),[]).then(e=>e.default):a(()=>import("./index-QvBzJwgv.js"),[]).then(e=>e.wallet);case"xyz.talisman":return t?a(()=>import("./image-VlTaWJmy.js"),[]).then(e=>e.default):a(()=>import("./index-BgbYZOnC.js"),[]).then(e=>e.wallet);case"eu.flashsoft.clear-wallet":return t?a(()=>import("./image-gxCVLutB.js"),[]).then(e=>e.default):a(()=>import("./index-BBiL2lyk.js"),[]).then(e=>e.wallet);case"app.berasig":return t?a(()=>import("./image-BjTMD2k8.js"),[]).then(e=>e.default):a(()=>import("./index-DkcP2fCc.js"),[]).then(e=>e.wallet);case"com.wallet.reown":return t?a(()=>import("./image-CC2_AL18.js"),[]).then(e=>e.default):a(()=>import("./index-BEx6ckei.js"),[]).then(e=>e.wallet);case"io.runonflux.sspwallet":return t?a(()=>import("./image-DfzpWAED.js"),[]).then(e=>e.default):a(()=>import("./index-CrUcAJK0.js"),[]).then(e=>e.wallet);case"com.blanqlabs.wallet":return t?a(()=>import("./image-wR942Jk6.js"),[]).then(e=>e.default):a(()=>import("./index-DBst6Hla.js"),[]).then(e=>e.wallet);case"io.hero.wallet":return t?a(()=>import("./image-BbH7e9pw.js"),[]).then(e=>e.default):a(()=>import("./index-BBANTdk4.js"),[]).then(e=>e.wallet);case"network.verified.custody":return t?a(()=>import("./image-DpjDzWCs.js"),[]).then(e=>e.default):a(()=>import("./index-CyhgnW_d.js"),[]).then(e=>e.wallet);case"console.utila.io":return t?a(()=>import("./image-C7tHBnQp.js"),[]).then(e=>e.default):a(()=>import("./index-BrOCsLbf.js"),[]).then(e=>e.wallet);case"com.micet.wallet":return t?a(()=>import("./image-On2ij4Ix.js"),[]).then(e=>e.default):a(()=>import("./index-JAAqCLcG.js"),[]).then(e=>e.wallet);case"world.dolphinode.chain":return t?a(()=>import("./image-BXzPnbc4.js"),[]).then(e=>e.default):a(()=>import("./index-CiwBOkla.js"),[]).then(e=>e.wallet);case"com.lootrush":return t?a(()=>import("./image-t4jvKgpV.js"),[]).then(e=>e.default):a(()=>import("./index-BLsnOBhg.js"),[]).then(e=>e.wallet);case"xyz.dawnwallet":return t?a(()=>import("./image-bpacFMFT.js"),[]).then(e=>e.default):a(()=>import("./index-BqK7Phb6.js"),[]).then(e=>e.wallet);case"xyz.abs":return t?a(()=>import("./image-DFo7XMVJ.js"),[]).then(e=>e.default):a(()=>import("./index-8Ff6vDUD.js"),[]).then(e=>e.wallet);case"sh.frame":return t?a(()=>import("./image-C1w2WpL5.js"),[]).then(e=>e.default):a(()=>import("./index-cAvSYrmF.js"),[]).then(e=>e.wallet);case"io.useglyph":return t?a(()=>import("./image-C46yxCl4.js"),[]).then(e=>e.default):a(()=>import("./index-DE_8irSD.js"),[]).then(e=>e.wallet);case"org.base.account":return t?a(()=>import("./image-Ds78yECl.js"),[]).then(e=>e.default):a(()=>import("./index-kNZGxYSe.js"),[]).then(e=>e.wallet);default:throw new Error(`Wallet with id ${n} not found`)}}function Mp(){const n=new Map;return{emit(t,e){const r=n.get(t);if(r)for(const i of r)i(e)},subscribe(t,e){return n.has(t)?n.get(t)?.add(e):n.set(t,new Set([e])),()=>{const r=n.get(t);r&&r.delete(e)}}}}function xn(){return Mp()}function zp(n){const{createOptions:t}=n,e=xn();let r,i;function s(){r=void 0,i=void 0}let o=async()=>{},c=async h=>{i=h};const l=e.subscribe("chainChanged",h=>{i=h}),u=e.subscribe("disconnect",()=>{s(),l(),u()});return e.subscribe("accountChanged",h=>{r=h}),{autoConnect:async h=>{const{autoConnectBaseAccountSDK:d}=await a(async()=>{const{autoConnectBaseAccountSDK:E}=await Promise.resolve().then(()=>Ra);return{autoConnectBaseAccountSDK:E}},void 0),p=await n.providerFactory(),[f,w,m,_]=await d(h,e,p);return r=f,i=w,o=m,c=_,Ye({chainId:i.id,client:h.client,walletAddress:r.address,walletType:qt}),r},connect:async h=>{const{connectBaseAccountSDK:d}=await a(async()=>{const{connectBaseAccountSDK:E}=await Promise.resolve().then(()=>Ra);return{connectBaseAccountSDK:E}},void 0),p=await n.providerFactory(),[f,w,m,_]=await d(h,e,p);return r=f,i=w,o=m,c=_,Ye({chainId:i.id,client:h.client,walletAddress:r.address,walletType:qt}),r},disconnect:async()=>{s(),await o()},getAccount:()=>r,getChain(){if(i)return i=Dn(i.id)||i,i},getConfig:()=>t,id:qt,subscribe:e.subscribe,switchChain:async h=>{await c(h)}}}function mi(){if(!Hl())return{description:"thirdweb powered dApp",logoUrl:"https://thirdweb.com/favicon.ico",name:"thirdweb powered dApp",url:"https://thirdweb.com"};const{protocol:n,hostname:t,port:e}=window.location;let r=`${n}//${t}`;e&&e!=="80"&&e!=="443"&&(r+=`:${e}`);const i=`${r}/favicon.ico`;return{description:window.document.title||"thirdweb powered dApp",logoUrl:i,name:window.document.title||"thirdweb powered dApp",url:r}}let Zi,Kr;async function Jl(n){if(Zi){if(n&&Kr){const s=Kr.chains?.map(u=>u.id)||[],o=n.chains?.map(u=>u.id)||[],c=s.length===o.length&&s.every((u,h)=>u===o[h]),l=n.appMetadata?.name===Kr.appMetadata?.name;(!c||!l)&&console.warn("[Base Account SDK] Provider already initialized with different options. The Base Account SDK uses a singleton provider - subsequent configurations are ignored. Create only one Base Account wallet instance per application.")}return Zi}const{createBaseAccountSDK:t}=await a(async()=>{const{createBaseAccountSDK:s}=await import("./index-CgMDPZul.js");return{createBaseAccountSDK:s}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19])),e=mi(),i=t({appName:n?.appMetadata?.name||e.name||"thirdweb powered dApp",appLogoUrl:n?.appMetadata?.logoUrl||e.logoUrl||null,appChainIds:n?.chains?.map(s=>s.id)||[]}).getProvider();return Zi=i,Kr=n,i}function Ql(n){return n.id===qt}function Oa({provider:n,address:t,client:e}){const r={address:J(t),async sendTransaction(i){const s=await n.request({method:"eth_sendTransaction",params:[{accessList:i.accessList,data:i.data,from:J(t),gas:i.gas?Ue(i.gas):void 0,to:i.to,value:i.value?Ue(i.value):void 0}]});return To({chainId:i.chainId,client:e,contractAddress:i.to??void 0,gasPrice:i.gasPrice,transactionHash:s,walletAddress:J(t),walletType:qt}),{transactionHash:s}},async signMessage({message:i}){if(!r.address)throw new Error("Provider not setup");const s=typeof i=="string"?Io(i):i.raw instanceof Uint8Array?xi(i.raw):i.raw,o=await n.request({method:"personal_sign",params:[s,r.address]});if(!Tr(o))throw new Error("Invalid signature returned");return o},async signTypedData(i){if(!r.address)throw new Error("Provider not setup");const{domain:s,message:o,primaryType:c}=So(i),l={EIP712Domain:Ll(s),...i.types};xl({domain:s,message:o,primaryType:c,types:l});const u=Vl({domain:s??{},message:o,primaryType:c,types:l}),h=await n.request({method:"eth_signTypedData_v4",params:[r.address,u]});if(!Tr(h))throw new Error("Invalid signed payload returned");return h},sendCalls:async i=>{try{const{callParams:s,chain:o}=await ko(i,r),c=await n.request({method:"wallet_sendCalls",params:s});return c&&typeof c=="object"&&"id"in c?{chain:o,client:e,id:c.id}:{chain:o,client:e,id:c}}catch(s){throw/unsupport|not support/i.test(s.message)?new Error(`${qt} errored calling wallet_sendCalls, with error: ${s instanceof Error?s.message:Ee(s)}`):s}},async getCallsStatus(i){try{const s=await n.request({method:"wallet_getCallsStatus",params:[i.id]});return Co(s)}catch(s){throw/unsupport|not support/i.test(s.message)?new Error(`${qt} does not support wallet_getCallsStatus, reach out to them directly to request EIP-5792 support.`):s}},async getCapabilities(i){const s=i.chainId;try{const o=await n.request({method:"wallet_getCapabilities",params:[J(r.address)]});return $o(o,s)}catch(o){if(/unsupport|not support|not available/i.test(o.message))return{message:`${qt} does not support wallet_getCapabilities, reach out to them directly to request EIP-5792 support.`};throw o}}};return r}function Xl(n,t,e,r,i){const s=Oa({address:n,client:i,provider:e});async function o(){e.off("accountsChanged",l),e.off("chainChanged",u),e.off("disconnect",c),await e.disconnect()}async function c(){o(),r.emit("disconnect",void 0)}function l(h){if(h[0]){const d=Oa({address:J(h[0]),client:i,provider:e});r.emit("accountChanged",d),r.emit("accountsChanged",h)}else c()}function u(h){const d=be(gt(h));r.emit("chainChanged",d)}return e.on("accountsChanged",l),e.on("chainChanged",u),e.on("disconnect",c),[s,t,c,h=>eu(e,h)]}async function jp(n,t,e){const r=await e.request({method:"eth_requestAccounts"});if(!r[0])throw new Error("No accounts found");const i=J(r[0]),s=await e.request({method:"eth_chainId"}),o=gt(s);let c=n.chain&&n.chain.id===o?n.chain:be(o);return o&&n?.chain&&o!==n?.chain.id&&(await eu(e,n.chain),c=n.chain),Xl(i,c,e,t,n.client)}async function Kp(n,t,e){const i=(await e.request({method:"eth_accounts"}))[0];if(!i)throw new Error("No accounts found");const s=await e.request({method:"eth_chainId"}),o=gt(s),c=n.chain&&n.chain.id===o?n.chain:be(o);return Xl(i,c,e,t,n.client)}async function eu(n,t){const e=await n.request({method:"eth_chainId"});if(be(gt(e))?.id===t.id)return;const i=Ue(t.id);try{await n.request({method:"wallet_switchEthereumChain",params:[{chainId:i}]})}catch(s){const o=await Oo(t);s?.code===4902&&await n.request({method:"wallet_addEthereumChain",params:[{blockExplorerUrls:o.explorers?.map(c=>c.url)||[],chainId:i,chainName:o.name,nativeCurrency:o.nativeCurrency,rpcUrls:Uo(o)}]})}}const Ra=Object.freeze(Object.defineProperty({__proto__:null,autoConnectBaseAccountSDK:Kp,connectBaseAccountSDK:jp,getBaseAccountWebProvider:Jl,isBaseAccountSDKWallet:Ql},Symbol.toStringTag,{value:"Module"}));function Fp(n){const{createOptions:t}=n,e=xn();let r,i;function s(){r=void 0,i=void 0}let o=async()=>{},c=async h=>{i=h};const l=e.subscribe("chainChanged",h=>{i=h}),u=e.subscribe("disconnect",()=>{s(),l(),u()});return e.subscribe("accountChanged",h=>{r=h}),{autoConnect:async h=>{const{autoConnectCoinbaseWalletSDK:d}=await a(async()=>{const{autoConnectCoinbaseWalletSDK:E}=await Promise.resolve().then(()=>La);return{autoConnectCoinbaseWalletSDK:E}},void 0),p=await n.providerFactory(),[f,w,m,_]=await d(h,e,p);return r=f,i=w,o=m,c=_,Ye({chainId:i.id,client:h.client,walletAddress:r.address,walletType:Rt}),r},connect:async h=>{const{connectCoinbaseWalletSDK:d}=await a(async()=>{const{connectCoinbaseWalletSDK:E}=await Promise.resolve().then(()=>La);return{connectCoinbaseWalletSDK:E}},void 0),p=await n.providerFactory(),[f,w,m,_]=await d(h,e,p);return r=f,i=w,o=m,c=_,Ye({chainId:i.id,client:h.client,walletAddress:r.address,walletType:Rt}),r},disconnect:async()=>{s(),await o()},getAccount:()=>r,getChain(){if(i)return i=Dn(i.id)||i,i},getConfig:()=>t,id:Rt,onConnectRequested:async()=>{if(n.onConnectRequested){const h=await n.providerFactory();return n.onConnectRequested?.(h)}},subscribe:e.subscribe,switchChain:async h=>{await c(h)}}}async function tu(n){await n?.communicator?.waitForPopupLoaded?.()}const Hp=Object.freeze(Object.defineProperty({__proto__:null,showCoinbasePopup:tu},Symbol.toStringTag,{value:"Module"}));let Yi;async function nu(n){if(!Yi){let t=(await a(()=>import("./index-C1IoT2if.js"),__vite__mapDeps([20,7,6,21]))).default;typeof t!="function"&&typeof t.default=="function"&&(t=t.default);const r=new t({appChainIds:n?.chains?n.chains.map(i=>i.id):void 0,appLogoUrl:n?.appMetadata?.logoUrl||mi().logoUrl,appName:n?.appMetadata?.name||mi().name}).makeWeb3Provider(n?.walletConfig);return Yi=r,r}return Yi}function Da({provider:n,address:t,client:e}){const r={address:J(t),onTransactionRequested:async()=>{window.localStorage&&window.localStorage.getItem("-CBWSDK:SignerConfigurator:SignerType")==="scw"&&await tu(n)},async sendTransaction(i){const s=await n.request({method:"eth_sendTransaction",params:[{accessList:i.accessList,data:i.data,from:J(t),gas:i.gas?Ue(i.gas):void 0,to:i.to,value:i.value?Ue(i.value):void 0}]});return To({chainId:i.chainId,client:e,contractAddress:i.to??void 0,gasPrice:i.gasPrice,transactionHash:s,walletAddress:J(t),walletType:Rt}),{transactionHash:s}},async signMessage({message:i}){if(!r.address)throw new Error("Provider not setup");const s=typeof i=="string"?Io(i):i.raw instanceof Uint8Array?xi(i.raw):i.raw,o=await n.request({method:"personal_sign",params:[s,r.address]});if(!Tr(o))throw new Error("Invalid signature returned");return o},async signTypedData(i){if(!r.address)throw new Error("Provider not setup");const{domain:s,message:o,primaryType:c}=So(i),l={EIP712Domain:Ll(s),...i.types};xl({domain:s,message:o,primaryType:c,types:l});const u=Vl({domain:s??{},message:o,primaryType:c,types:l}),h=await n.request({method:"eth_signTypedData_v4",params:[r.address,u]});if(!Tr(h))throw new Error("Invalid signed payload returned");return h},sendCalls:async i=>{try{const{callParams:s,chain:o}=await ko(i,r),c=await n.request({method:"wallet_sendCalls",params:s});return c&&typeof c=="object"&&"id"in c?{chain:o,client:e,id:c.id}:{chain:o,client:e,id:c}}catch(s){throw/unsupport|not support/i.test(s.message)?new Error(`${Rt} errored calling wallet_sendCalls, with error: ${s instanceof Error?s.message:Ee(s)}`):s}},async getCallsStatus(i){try{const s=await n.request({method:"wallet_getCallsStatus",params:[i.id]});return Co(s)}catch(s){throw/unsupport|not support/i.test(s.message)?new Error(`${Rt} does not support wallet_getCallsStatus, reach out to them directly to request EIP-5792 support.`):s}},async getCallsStatusRaw(i){try{return await n.request({method:"wallet_getCallsStatus",params:[i.id]})}catch(s){throw/unsupport|not support/i.test(s.message)?new Error(`${Rt} does not support wallet_getCallsStatus, reach out to them directly to request EIP-5792 support.`):s}},async getCapabilities(i){const s=i.chainId;try{const o=await n.request({method:"wallet_getCapabilities",params:[J(r.address)]});return $o(o,s)}catch(o){if(/unsupport|not support|not available/i.test(o.message))return{message:`${Rt} does not support wallet_getCapabilities, reach out to them directly to request EIP-5792 support.`};throw o}}};return r}function ru(n,t,e,r,i){const s=Da({address:n,client:i,provider:e});async function o(){e.removeListener("accountsChanged",l),e.removeListener("chainChanged",u),e.removeListener("disconnect",c),await e.disconnect()}async function c(){o(),r.emit("disconnect",void 0)}function l(h){if(h[0]){const d=Da({address:J(h[0]),client:i,provider:e});r.emit("accountChanged",d),r.emit("accountsChanged",h)}else c()}function u(h){const d=be(gt(h));r.emit("chainChanged",d)}return e.on("accountsChanged",l),e.on("chainChanged",u),e.on("disconnect",c),[s,t,c,h=>iu(e,h)]}async function Wp(n,t,e){const r=await e.request({method:"eth_requestAccounts"});if(!r[0])throw new Error("No accounts found");const i=J(r[0]),s=await e.request({method:"eth_chainId"}),o=gt(s);let c=n.chain&&n.chain.id===o?n.chain:be(o);return o&&n?.chain&&o!==n?.chain.id&&(await iu(e,n.chain),c=n.chain),ru(i,c,e,t,n.client)}async function Gp(n,t,e){const i=(await e.request({method:"eth_accounts"}))[0];if(!i)throw new Error("No accounts found");const s=await e.request({method:"eth_chainId"}),o=gt(s),c=n.chain&&n.chain.id===o?n.chain:be(o);return ru(i,c,e,t,n.client)}async function iu(n,t){const e=await n.request({method:"eth_chainId"});if(be(gt(e))?.id===t.id)return;const i=Ue(t.id);try{await n.request({method:"wallet_switchEthereumChain",params:[{chainId:i}]})}catch(s){const o=await Oo(t);s?.code===4902&&await n.request({method:"wallet_addEthereumChain",params:[{blockExplorerUrls:o.explorers?.map(c=>c.url)||[],chainId:i,chainName:o.name,nativeCurrency:o.nativeCurrency,rpcUrls:Uo(o)}]})}}const La=Object.freeze(Object.defineProperty({__proto__:null,autoConnectCoinbaseWalletSDK:Gp,connectCoinbaseWalletSDK:Wp,getCoinbaseWebProvider:nu},Symbol.toStringTag,{value:"Module"}));async function Zp(n){return ql(async()=>{const e=await(await fetch(`${Vi("inAppWallet")}/api/2024-05-05/ecosystem-wallet`,{headers:{"x-ecosystem-id":n}})).json();if(!e||e.code==="UNAUTHORIZED")throw new Error(e.message||`Could not find ecosystem wallet with id ${n}, please check your ecosystem wallet configuration.`);return e.authOptions?.includes("siwe")&&(e.authOptions=e.authOptions.filter(r=>r!=="siwe"),e.authOptions.push("wallet")),e},{cacheKey:`ecosystem-wallet-options-${n}`,cacheTime:1e3*60*5})}const Ji=new Map;async function dr(n,t,e){const r=Ee({clientId:n.clientId,ecosystem:e,partialSecretKey:n.secretKey?.slice(0,5)});if(Ji.has(r))return Ji.get(r);const i=await t(n);return Ji.set(r,i),i}function su(n){const{createOptions:t,connectorFactory:e,ecosystem:r}=n,i=r?r.id:"inApp",s=xn();let o=t,c,l,u,h,d=null;const p=async f=>{if(r){const w=await Zp(r.id),m=w?.smartAccountOptions;if(m)if(w.smartAccountOptions.executionMode==="EIP7702")o={...o,executionMode:{mode:"EIP7702",sponsorGas:m.sponsorGas}};else{const{defaultChainId:E}=w.smartAccountOptions,v=f?.chain??(E?be(E):void 0);if(!v)throw new Error("A chain must be provided either via 'chain' in connect options or 'defaultChainId' in ecosystem configuration. Please pass it via connect() or update the ecosystem configuration.");o={...o,smartAccount:{chain:v,factoryAddress:m.accountFactoryAddress,sponsorGas:m.sponsorGas}}}}};return{autoConnect:async f=>{const{autoConnectInAppWallet:w}=await a(async()=>{const{autoConnectInAppWallet:g}=await Promise.resolve().then(()=>Ds);return{autoConnectInAppWallet:g}},void 0),m=await dr(f.client,e,r);await p();const{account:_,chain:E,adminAccount:v}=await w(f,o,m);h=f.client,c=_,l=v,u=E;try{d=await m.storage.getAuthCookie()}catch(g){console.error("Failed to retrieve auth token:",g),d=null}return Ye({chainId:u.id,client:f.client,ecosystem:r,walletAddress:c.address,walletType:i}),c},connect:async f=>{const{connectInAppWallet:w}=await a(async()=>{const{connectInAppWallet:g}=await Promise.resolve().then(()=>Ds);return{connectInAppWallet:g}},void 0),m=await dr(f.client,e,r);await p();const{account:_,chain:E,adminAccount:v}=await w(f,o,m);h=f.client,c=_,l=v,u=E;try{d=await m.storage.getAuthCookie()}catch(g){console.error("Failed to retrieve auth token:",g),d=null}return Ye({chainId:u.id,client:f.client,ecosystem:r,walletAddress:c.address,walletType:i}),c},disconnect:async()=>{if(h&&!(await(await dr(h,e,r)).logout()).success)throw new Error("Failed to logout");c=void 0,l=void 0,u=void 0,d=null,s.emit("disconnect",void 0)},getAccount:()=>c,getAdminAccount:()=>l,getAuthToken:()=>d,getChain(){if(u)return u=Dn(u.id)||u,u},getConfig:()=>o,id:i,subscribe:s.subscribe,switchChain:async f=>{if((o?.smartAccount||o?.executionMode?.mode==="EIP4337")&&h&&c){const{autoConnectInAppWallet:w}=await a(async()=>{const{autoConnectInAppWallet:g}=await Promise.resolve().then(()=>Ds);return{autoConnectInAppWallet:g}},void 0),m=await dr(h,e,r);await p({chain:f});const{account:_,chain:E,adminAccount:v}=await w({chain:f,client:h},o,m);l=v,c=_,u=E}else u=f;s.emit("chainChanged",f)}}}function ou(...n){const[t,e]=n,r={id:t,partnerId:e?.partnerId};return su({connectorFactory:async i=>{const{InAppWebConnector:s}=await a(async()=>{const{InAppWebConnector:o}=await import("./web-connector-CB7tpRui.js");return{InAppWebConnector:o}},__vite__mapDeps([22,4,23,24,25,1,26,27,28,29,30,31,32,33]));return new s({client:i,ecosystem:r,storage:e?.storage})},createOptions:{auth:{...e?.auth,options:[]},partnerId:r.partnerId},ecosystem:r})}function Ss(n){return su({connectorFactory:async t=>{const{InAppWebConnector:e}=await a(async()=>{const{InAppWebConnector:r}=await import("./web-connector-CB7tpRui.js");return{InAppWebConnector:r}},__vite__mapDeps([22,4,23,24,25,1,26,27,28,29,30,31,32,33]));return new e({client:t,passkeyDomain:n?.auth?.passkeyDomain,storage:n?.storage})},createOptions:n})}function Bo(n){const t=xn();let e,r,i,s;return{autoConnect:async o=>{const{connectSmartAccount:c}=await a(async()=>{const{connectSmartAccount:h}=await import("./index-DajuSfcu.js");return{connectSmartAccount:h}},__vite__mapDeps([34,4,26,1,27,28,23,24,25,29,30,31,32,35,36,37])),[l,u]=await c(o,n);return s=o,e=l,i=u,Ye({chainId:i.id,client:o.client,walletAddress:e.address,walletType:"smart"}),e},connect:async o=>{const{connectSmartAccount:c}=await a(async()=>{const{connectSmartAccount:h}=await import("./index-DajuSfcu.js");return{connectSmartAccount:h}},__vite__mapDeps([34,4,26,1,27,28,23,24,25,29,30,31,32,35,36,37])),[l,u]=await c(o,n);return r=o.personalAccount,s=o,e=l,i=u,Ye({chainId:i.id,client:o.client,walletAddress:e.address,walletType:"smart"}),t.emit("accountChanged",e),e},disconnect:async()=>{if(e){const{disconnectSmartAccount:o}=await a(async()=>{const{disconnectSmartAccount:c}=await import("./index-DajuSfcu.js");return{disconnectSmartAccount:c}},__vite__mapDeps([34,4,26,1,27,28,23,24,25,29,30,31,32,35,36,37]));await o(e)}e=void 0,r=void 0,i=void 0,t.emit("disconnect",void 0)},getAccount:()=>e,getAdminAccount:()=>r,getChain(){if(i)return i=Dn(i.id)||i,i},getConfig:()=>n,id:"smart",subscribe:t.subscribe,switchChain:async o=>{if(!s)throw new Error("Cannot switch chain without a previous connection");if(!await Td(o)){const d=Po({address:n.factoryAddress||Rp(n.overrides?.entrypointAddress),chain:o,client:s.client});if(!await Pd(d))throw new Error(`Factory contract not deployed on chain: ${o.id}`)}const{connectSmartAccount:l}=await a(async()=>{const{connectSmartAccount:d}=await import("./index-DajuSfcu.js");return{connectSmartAccount:d}},__vite__mapDeps([34,4,26,1,27,28,23,24,25,29,30,31,32,35,36,37])),[u,h]=await l({...s,chain:o},{...n,chain:o});e=u,i=h,t.emit("accountChanged",u),t.emit("chainChanged",h)}}}function mt(...n){const[t,e]=n;switch(!0){case t==="smart":return Bo(e);case(t==="embedded"||t==="inApp"):return Ss(e);case Zn(t):return ou(...n);case t===Rt:{const r=e;return Fp({createOptions:r,onConnectRequested:async i=>{const{showCoinbasePopup:s}=await a(async()=>{const{showCoinbasePopup:o}=await Promise.resolve().then(()=>Hp);return{showCoinbasePopup:o}},void 0);return s(i)},providerFactory:()=>nu(r)})}case t===qt:{const r=e;return zp({createOptions:r,providerFactory:()=>Jl(r)})}default:{let c=function(){i=void 0,s=void 0};const r=xn();let i,s,o,l=async()=>{};const u=r.subscribe("disconnect",()=>{c(),o?.(),u()});r.subscribe("accountChanged",f=>{i=f});let h=async()=>{throw new Error("Not implemented yet")};const d=Pa()?f=>Gi(f):void 0,p={autoConnect:async f=>{const{injectedProvider:w}=await a(async()=>{const{injectedProvider:m}=await Promise.resolve().then(()=>Va);return{injectedProvider:m}},void 0);if(t!=="walletConnect"&&w(t)){const{autoConnectEip1193Wallet:m}=await a(async()=>{const{autoConnectEip1193Wallet:I}=await Promise.resolve().then(()=>Ca);return{autoConnectEip1193Wallet:I}},void 0),[_,E,v,g]=await m({chain:f.chain,client:f.client,emitter:r,id:t,provider:Cs(t)});return i=_,s=E,l=v,h=g,o=r.subscribe("chainChanged",I=>{s=I}),Ye({chainId:s.id,client:f.client,walletAddress:i.address,walletType:t}),i}if(f&&"client"in f){const{autoConnectWC:m}=await a(async()=>{const{autoConnectWC:I}=await import("./controller-D0Gc4Hsp.js");return{autoConnectWC:I}},__vite__mapDeps([38,4,1,26,27,28,23,24,25])),[_,E,v,g]=await m(f,r,p.id,wi,d);return i=_,s=E,l=v,h=g,Ye({chainId:s.id,client:f.client,walletAddress:i.address,walletType:t}),i}throw new Error("Failed to auto connect")},connect:async f=>{async function w(E){const{connectWC:v}=await a(async()=>{const{connectWC:I}=await import("./controller-D0Gc4Hsp.js");return{connectWC:I}},__vite__mapDeps([38,4,1,26,27,28,23,24,25]));let g;try{const[I,b,L,x]=await v({...E,walletConnect:{...E.walletConnect,onDisplayUri:E.walletConnect?.onDisplayUri||(async S=>{if(typeof window<"u"&&typeof document<"u")if(Pa()){const y=await Yl(t),D=y.mobile.native||y.mobile.universal;Gi(D?kp(D,S).redirect:S);return}else try{const{createQROverlay:y}=await a(async()=>{const{createQROverlay:D}=await import("./qr-overlay-CGnFhcTk.js");return{createQROverlay:D}},__vite__mapDeps([39,4]));g&&g.destroy(),g=y(S,{theme:E.walletConnect?.qrModalOptions?.themeMode??"dark",qrSize:280,showCloseButton:!0,onCancel:()=>{E.walletConnect?.onCancel?.()}})}catch(y){console.error("Failed to create QR overlay:",y)}})}},r,p.id,wi,d);return g&&(g.destroy(),g=void 0),i=I,s=b,l=L,h=x,Ye({chainId:s.id,client:E.client,walletAddress:i.address,walletType:t}),i}catch(I){throw g&&(g.destroy(),g=void 0),I}}if(t==="walletConnect"){const{client:E,chain:v,...g}=f;return w({chain:v,client:E,walletConnect:{...g}})}const m=f&&"walletConnect"in f,{injectedProvider:_}=await a(async()=>{const{injectedProvider:E}=await Promise.resolve().then(()=>Va);return{injectedProvider:E}},void 0);if(_(t)&&!m){const{connectEip1193Wallet:E}=await a(async()=>{const{connectEip1193Wallet:L}=await Promise.resolve().then(()=>Ca);return{connectEip1193Wallet:L}},void 0),[v,g,I,b]=await E({chain:f.chain,client:f.client,emitter:r,id:t,provider:Cs(t)});return i=v,s=g,l=I,h=b,o=r.subscribe("chainChanged",L=>{s=L}),Ye({chainId:s.id,client:f.client,walletAddress:i.address,walletType:t}),i}if(f&&"client"in f)return w(f);throw new Error("Failed to connect")},disconnect:async()=>{c(),await l()},getAccount:()=>i,getChain(){if(s)return s=Dn(s.id)||s,s},getConfig:()=>n[1],id:t,subscribe:r.subscribe,switchChain:async f=>{try{await h(f),s=f}catch(w){console.error("Error switching chain",w)}}};return p}}}function Yp(){return mt("walletConnect")}const xa=Hl()?tp():void 0;function qo(n){return Mo().find(e=>e.info.rdns===n)?.provider}function au(){return Mo().map(e=>e.info.rdns).map(e=>mt(e))}function Jp(){if(xa)return xa}function Mo(){const n=Jp()?.getProviders()||[];for(const t of n)if(t.info.rdns==="io.metamask.mobile"){t.info.rdns=Wl;break}return n}const Va=Object.freeze(Object.defineProperty({__proto__:null,getInstalledWalletProviders:Mo,getInstalledWallets:au,injectedProvider:qo},Symbol.toStringTag,{value:"Module"})),{getTypesForEIP712Domain:Qp,serializeTypedData:Xp,stringify:ef,validateTypedData:tf,withTimeout:nf}=await Ro("viem");function Cs(n){const t=qo(n);if(!t)throw new Error(`No injected provider found for wallet: "${n}"`);return t}async function cu({id:n,provider:t,emitter:e,client:r,chain:i}){let s,c=0;for(;!s?.[0]&&c<3;){try{s=await t.request({method:"eth_requestAccounts"})}catch(p){if(console.error(p),rf(p)?.toLowerCase()?.includes("rejected"))throw p;await new Promise(f=>setTimeout(f,500))}c++}const l=s?.[0];if(!l)throw new Error("Failed to connect to wallet, no accounts available");const u=J(l),h=await t.request({method:"eth_chainId"}).then(gt).catch(p=>{throw new Error("Error reading chainId from provider",p)});let d=i&&i.id===h?i:be(h);try{i&&typeof i.id<"u"&&i.id!==h&&(await hu(t,i),d=i)}catch{console.warn(`Error switching to chain ${i?.id} - defaulting to wallet chain (${h})`)}return uu({address:u,chain:d,client:r,emitter:e,id:n,provider:t})}async function lu({id:n,provider:t,emitter:e,client:r,chain:i}){const o=(await t.request({method:"eth_accounts"}))[0];if(!o)throw new Error("Failed to connect to wallet, no accounts available");const c=J(o),l=await t.request({method:"eth_chainId"}).then(gt),u=i&&i.id===l?i:be(l);return uu({address:c,chain:u,client:r,emitter:e,id:n,provider:t})}function Sa({provider:n,address:t,client:e,id:r}){const i={address:J(t),async sendTransaction(s){const c=[{...s.gasPrice?{gasPrice:Ue(s.gasPrice)}:{maxFeePerGas:s.maxFeePerGas?Ue(s.maxFeePerGas):void 0,maxPriorityFeePerGas:s.maxPriorityFeePerGas?Ue(s.maxPriorityFeePerGas):void 0},from:this.address,gas:s.gas?Ue(s.gas):void 0,nonce:s.nonce?Ue(s.nonce):void 0,to:s.to?J(s.to):void 0,data:s.data,value:s.value?Ue(s.value):void 0,authorizationList:s.authorizationList?Rd(s.authorizationList):void 0,accessList:s.accessList,...s.eip712}];try{const l=await n.request({method:"eth_sendTransaction",params:c});return To({chainId:s.chainId,client:e,contractAddress:s.to??void 0,gasPrice:s.gasPrice,transactionHash:l,walletAddress:J(t),walletType:r}),{transactionHash:l}}catch(l){throw Fd(l)&&Hd({chainId:s.chainId,client:e,contractAddress:s.to||void 0,error:l,transactionValue:s.value,walletAddress:J(t)}),l}},async signMessage({message:s}){if(!i.address)throw new Error("Provider not setup");const o=typeof s=="string"?Io(s):s.raw instanceof Uint8Array?xi(s.raw):s.raw;return await n.request({method:"personal_sign",params:[o,J(i.address)]})},async signAuthorization(s){const o=Sl(s);let c;try{c=await n.request({method:"eth_sign",params:[J(i.address),o]})}catch{c=await n.request({method:"secp256k1_sign",params:[o]})}if(!c)throw new Error("Failed to sign authorization");const l=Od(c);return{...s,...l}},async signTypedData(s){if(!n||!i.address)throw new Error("Provider not setup");const o=So(s),{domain:c,message:l,primaryType:u}=o,h={EIP712Domain:Qp({domain:c}),...o.types};tf({domain:c,message:l,primaryType:u,types:h});const d=Xp({domain:c??{},message:l,primaryType:u,types:h});return await n.request({method:"eth_signTypedData_v4",params:[J(i.address),d]})},async watchAsset(s){return await n.request({method:"wallet_watchAsset",params:s},{retryCount:0})},async sendCalls(s){try{const{callParams:o,chain:c}=await ko(s,i),l=await n.request({method:"wallet_sendCalls",params:o});return l&&typeof l=="object"&&"id"in l?{chain:c,client:e,id:l.id}:{chain:c,client:e,id:l}}catch(o){throw/unsupport|not support/i.test(o.message)?new Error(`${r} errored calling wallet_sendCalls, with error: ${o instanceof Error?o.message:ef(o)}`):o}},async getCallsStatus(s){try{const o=await n.request({method:"wallet_getCallsStatus",params:[s.id]});return Co(o)}catch(o){throw/unsupport|not support/i.test(o.message)?new Error(`${r} does not support wallet_getCallsStatus, reach out to them directly to request EIP-5792 support.`):o}},async getCallsStatusRaw(s){try{return await n.request({method:"wallet_getCallsStatus",params:[s.id]})}catch(o){throw/unsupport|not support/i.test(o.message)?new Error(`${r} does not support wallet_getCallsStatus, reach out to them directly to request EIP-5792 support.`):o}},async getCapabilities(s){const o=s.chainId;try{const c=await n.request({method:"wallet_getCapabilities",params:[J(i.address),o?[Ue(o)]:void 0]});return $o(c,o)}catch(c){if(/unsupport|not support|not available/i.test(c.message))return{message:`${r} does not support wallet_getCapabilities, reach out to them directly to request EIP-5792 support.`};throw c}}};return i}async function uu({provider:n,address:t,chain:e,emitter:r,client:i,id:s}){const o=Sa({address:t,client:i,id:s,provider:n});async function c(){n.removeListener("accountsChanged",u),n.removeListener("chainChanged",h),n.removeListener("disconnect",l);try{await nf(()=>n.request({method:"wallet_revokePermissions",params:[{eth_accounts:{}}]}),{timeout:100})}catch{}}async function l(){c(),r.emit("disconnect",void 0)}function u(d){if(d[0]){const p=Sa({address:J(d[0]),client:i,id:s,provider:n});r.emit("accountChanged",p),r.emit("accountsChanged",d)}else l()}function h(d){const p=be(gt(d));r.emit("chainChanged",p)}return n.on&&(n.on("accountsChanged",u),n.on("chainChanged",h),n.on("disconnect",l)),[o,e,l,d=>hu(n,d)]}async function hu(n,t){const e=Ue(t.id);try{await n.request({method:"wallet_switchEthereumChain",params:[{chainId:e}]})}catch{const r=await Oo(t);await n.request({method:"wallet_addEthereumChain",params:[{blockExplorerUrls:r.explorers?.map(i=>i.url),chainId:e,chainName:r.name,nativeCurrency:r.nativeCurrency,rpcUrls:Uo(r)}]})}}function rf(n){return n instanceof Error?n.message:typeof n=="string"?n:typeof n=="object"&&n!==null?JSON.stringify(n):String(n)}const Ca=Object.freeze(Object.defineProperty({__proto__:null,autoConnectEip1193Wallet:lu,connectEip1193Wallet:cu,getInjectedProvider:Cs},Symbol.toStringTag,{value:"Module"}));function sf(n){const t=n.walletId??"adapter",e=xn();let r,i,s;const o=async p=>(s=typeof n.provider=="function"?await n.provider(p):n.provider,s),c=e.subscribe("chainChanged",p=>{i=p});function l(){r=void 0,i=void 0}let u=async()=>{};const h=e.subscribe("disconnect",()=>{l(),c(),h()});e.subscribe("accountChanged",p=>{r=p});let d=async p=>{await s?.request({method:"wallet_switchEthereumChain",params:[{chainId:jd(p.id)}]})};return{autoConnect:async p=>{const[f,w,m,_]=await lu({chain:p.chain,client:p.client,emitter:e,id:t,provider:await o({chainId:p.chain?.id})});return r=f,i=w,u=m,d=_,e.emit("onConnect",p),Ye({client:p.client,walletAddress:r.address,walletType:t}),r},connect:async p=>{const[f,w,m,_]=await cu({chain:p.chain,client:p.client,emitter:e,id:t,provider:await o({chainId:p.chain?.id})});return r=f,i=w,u=m,d=_,e.emit("onConnect",p),Ye({client:p.client,walletAddress:r.address,walletType:t}),r},disconnect:async()=>{l(),await u(),e.emit("disconnect",void 0)},getAccount:()=>r,getChain(){if(i)return i=Dn(i.id)||i,i},getConfig:()=>{},id:t,subscribe:e.subscribe,switchChain:async p=>{await d(p),e.emit("chainChanged",p)}}}function of(n){const{chain:t,client:e,wallet:r,connectOverride:i}=n,s=Si({chain:t,client:e});return{on:r.subscribe,removeListener:()=>{},request:async o=>{switch(o.method){case"eth_sendTransaction":{const c=r.getAccount();if(!c)throw new Error("Account not connected");return(await Cl({account:c,transaction:xs({...o.params[0],chain:t,client:e})})).transactionHash}case"eth_estimateGas":{const c=r.getAccount();if(!c)throw new Error("Account not connected");return Wd({account:c,transaction:xs({...o.params[0],chain:t,client:e})})}case"personal_sign":{const c=r.getAccount();if(!c)throw new Error("Account not connected");return c.signMessage({message:{raw:o.params[0]}})}case"eth_signTypedData_v4":{const c=r.getAccount();if(!c)throw new Error("Account not connected");const l=JSON.parse(o.params[1]);return c.signTypedData(l)}case"eth_accounts":{const c=r.getAccount();return c?[c.address]:[]}case"eth_requestAccounts":{const c=r.getAccount();if(c)return[c.address];const l=i?await i(r):await r.connect({client:e}).catch(u=>(console.error("Error connecting wallet",u),null));if(!l)throw new Error("Unable to connect wallet - try passing a connectOverride function");return[l.address]}case"wallet_switchEthereumChain":case"wallet_addEthereumChain":{const l=o.params[0].chainId;if(!l)throw new Error("Chain ID is required");const u=pi(l)?Pn(l):l,h=be(u);return r.switchChain(h)}case"wallet_getCapabilities":{const c=r.getAccount();if(!c)throw new Error("Account not connected");if(!c.getCapabilities)throw new Error("Wallet does not support EIP-5792");const l=o.params[1];if(l&&Array.isArray(l)){const u=l[0],h=pi(u)?Pn(u):Number(u);return c.getCapabilities(h?{chainId:h}:{})}return c.getCapabilities({})}case"wallet_sendCalls":{const c=r.getAccount();if(!c)throw new Error("Account not connected");if(!c.sendCalls)throw new Error("Wallet does not support EIP-5792");return c.sendCalls({...o.params[0],chain:t})}case"wallet_getCallsStatus":{const c=r.getAccount();if(!c)throw new Error("Account not connected");if(!c.getCallsStatusRaw)throw new Error("Wallet does not support EIP-5792");return await c.getCallsStatusRaw({id:o.params[0],chain:t,client:e})}default:return s(o)}}}}const af=Object.freeze(Object.defineProperty({__proto__:null,fromProvider:sf,toProvider:of},Symbol.toStringTag,{value:"Module"}));function cf(n){const t=xn();let e=n.chain;return{autoConnect:async()=>(t.emit("onConnect",n),n.adaptedAccount),connect:async()=>(t.emit("onConnect",n),n.adaptedAccount),disconnect:async()=>{await n.onDisconnect(),t.emit("disconnect",void 0)},getAccount(){return n.adaptedAccount},getChain(){return e=Dn(e.id)||e,e},getConfig(){return n},id:"adapter",subscribe:t.subscribe,switchChain:async r=>{await n.switchChain(r),e=r,t.emit("chainChanged",r)}}}async function lf(){return(await a(async()=>{const{default:n}=await import("./wallet-infos-BHI_w6r-.js");return{default:n}},[])).default}async function Vn(n,t){return dr(n,async e=>{const{InAppWebConnector:r}=await a(async()=>{const{InAppWebConnector:i}=await import("./web-connector-CB7tpRui.js");return{InAppWebConnector:i}},__vite__mapDeps([22,4,23,24,25,1,26,27,28,29,30,31,32,33]));return new r({client:e,ecosystem:t})},t)}async function du(n){const{client:t,ecosystem:e}=n,i=await(await Vn(t,e)).getUser();switch(i.status){case"Logged In, Wallet Initialized":return i}}async function uf(n){const t=await du(n);if(t&&"email"in t.authDetails)return t.authDetails.email}async function hf(n){const t=await du(n);if(t&&"phoneNumber"in t.authDetails)return t.authDetails.phoneNumber}async function df(n){return(await Vn(n.client,n.ecosystem)).preAuthenticate(n)}async function pf(n){return(await Vn(n.client,n.ecosystem)).authenticate(n)}async function ff(n){const t=await Vn(n.client,n.ecosystem);if(!t.authenticateWithRedirect)throw new Error("authenticateWithRedirect is not supported on this platform");return t.authenticateWithRedirect(n.strategy,n.mode,n.redirectUrl)}async function _f(n){return await(await Vn(n.client,n.ecosystem)).linkProfile(n)}async function wf(n){return await(await Vn(n.client,n.ecosystem)).unlinkProfile(n.profileToUnlink,n.allowAccountDeletion)}async function mf(n){return(await Vn(n.client,n.ecosystem)).getProfiles()}function $a(n){if(!Number.isSafeInteger(n)||n<0)throw new Error("positive integer expected, got "+n)}function yf(n){return n instanceof Uint8Array||ArrayBuffer.isView(n)&&n.constructor.name==="Uint8Array"}function $i(n,...t){if(!yf(n))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(n.length))throw new Error("Uint8Array expected of length "+t+", got length="+n.length)}function gf(n){if(typeof n!="function"||typeof n.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");$a(n.outputLen),$a(n.blockLen)}function yi(n,t=!0){if(n.destroyed)throw new Error("Hash instance has been destroyed");if(t&&n.finished)throw new Error("Hash#digest() has already been called")}function Ef(n,t){$i(n);const e=t.outputLen;if(n.length<e)throw new Error("digestInto() expects output buffer of length at least "+e)}const Cn=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function Qi(n){return new DataView(n.buffer,n.byteOffset,n.byteLength)}function bt(n,t){return n<<32-t|n>>>t}typeof Uint8Array.from([]).toHex=="function"&&Uint8Array.fromHex;function vf(n){if(typeof n!="string")throw new Error("utf8ToBytes expected string, got "+typeof n);return new Uint8Array(new TextEncoder().encode(n))}function zo(n){return typeof n=="string"&&(n=vf(n)),$i(n),n}function bf(...n){let t=0;for(let r=0;r<n.length;r++){const i=n[r];$i(i),t+=i.length}const e=new Uint8Array(t);for(let r=0,i=0;r<n.length;r++){const s=n[r];e.set(s,i),i+=s.length}return e}class pu{clone(){return this._cloneInto()}}function If(n){const t=r=>n().update(zo(r)).digest(),e=n();return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=()=>n(),t}function Af(n=32){if(Cn&&typeof Cn.getRandomValues=="function")return Cn.getRandomValues(new Uint8Array(n));if(Cn&&typeof Cn.randomBytes=="function")return Uint8Array.from(Cn.randomBytes(n));throw new Error("crypto.getRandomValues must be defined")}function Tf(n,t,e,r){if(typeof n.setBigUint64=="function")return n.setBigUint64(t,e,r);const i=BigInt(32),s=BigInt(4294967295),o=Number(e>>i&s),c=Number(e&s),l=r?4:0,u=r?0:4;n.setUint32(t+l,o,r),n.setUint32(t+u,c,r)}function Pf(n,t,e){return n&t^~n&e}function Of(n,t,e){return n&t^n&e^t&e}class Rf extends pu{constructor(t,e,r,i){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=t,this.outputLen=e,this.padOffset=r,this.isLE=i,this.buffer=new Uint8Array(t),this.view=Qi(this.buffer)}update(t){yi(this);const{view:e,buffer:r,blockLen:i}=this;t=zo(t);const s=t.length;for(let o=0;o<s;){const c=Math.min(i-this.pos,s-o);if(c===i){const l=Qi(t);for(;i<=s-o;o+=i)this.process(l,o);continue}r.set(t.subarray(o,o+c),this.pos),this.pos+=c,o+=c,this.pos===i&&(this.process(e,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){yi(this),Ef(t,this),this.finished=!0;const{buffer:e,view:r,blockLen:i,isLE:s}=this;let{pos:o}=this;e[o++]=128,this.buffer.subarray(o).fill(0),this.padOffset>i-o&&(this.process(r,0),o=0);for(let d=o;d<i;d++)e[d]=0;Tf(r,i-8,BigInt(this.length*8),s),this.process(r,0);const c=Qi(t),l=this.outputLen;if(l%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const u=l/4,h=this.get();if(u>h.length)throw new Error("_sha2: outputLen bigger than state");for(let d=0;d<u;d++)c.setUint32(4*d,h[d],s)}digest(){const{buffer:t,outputLen:e}=this;this.digestInto(t);const r=t.slice(0,e);return this.destroy(),r}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:e,buffer:r,length:i,finished:s,destroyed:o,pos:c}=this;return t.length=i,t.pos=c,t.finished=s,t.destroyed=o,i%e&&t.buffer.set(r),t}}const Df=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]),Kt=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Ft=new Uint32Array(64);class Lf extends Rf{constructor(t=32){super(64,t,8,!1),this.A=Kt[0]|0,this.B=Kt[1]|0,this.C=Kt[2]|0,this.D=Kt[3]|0,this.E=Kt[4]|0,this.F=Kt[5]|0,this.G=Kt[6]|0,this.H=Kt[7]|0}get(){const{A:t,B:e,C:r,D:i,E:s,F:o,G:c,H:l}=this;return[t,e,r,i,s,o,c,l]}set(t,e,r,i,s,o,c,l){this.A=t|0,this.B=e|0,this.C=r|0,this.D=i|0,this.E=s|0,this.F=o|0,this.G=c|0,this.H=l|0}process(t,e){for(let d=0;d<16;d++,e+=4)Ft[d]=t.getUint32(e,!1);for(let d=16;d<64;d++){const p=Ft[d-15],f=Ft[d-2],w=bt(p,7)^bt(p,18)^p>>>3,m=bt(f,17)^bt(f,19)^f>>>10;Ft[d]=m+Ft[d-7]+w+Ft[d-16]|0}let{A:r,B:i,C:s,D:o,E:c,F:l,G:u,H:h}=this;for(let d=0;d<64;d++){const p=bt(c,6)^bt(c,11)^bt(c,25),f=h+p+Pf(c,l,u)+Df[d]+Ft[d]|0,m=(bt(r,2)^bt(r,13)^bt(r,22))+Of(r,i,s)|0;h=u,u=l,l=c,c=o+f|0,o=s,s=i,i=r,r=f+m|0}r=r+this.A|0,i=i+this.B|0,s=s+this.C|0,o=o+this.D|0,c=c+this.E|0,l=l+this.F|0,u=u+this.G|0,h=h+this.H|0,this.set(r,i,s,o,c,l,u,h)}roundClean(){Ft.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const xf=If(()=>new Lf);class fu extends pu{constructor(t,e){super(),this.finished=!1,this.destroyed=!1,gf(t);const r=zo(e);if(this.iHash=t.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const i=this.blockLen,s=new Uint8Array(i);s.set(r.length>i?t.create().update(r).digest():r);for(let o=0;o<s.length;o++)s[o]^=54;this.iHash.update(s),this.oHash=t.create();for(let o=0;o<s.length;o++)s[o]^=106;this.oHash.update(s),s.fill(0)}update(t){return yi(this),this.iHash.update(t),this}digestInto(t){yi(this),$i(t,this.outputLen),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){const t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));const{oHash:e,iHash:r,finished:i,destroyed:s,blockLen:o,outputLen:c}=this;return t=t,t.finished=i,t.destroyed=s,t.blockLen=o,t.outputLen=c,t.oHash=e._cloneInto(t.oHash),t.iHash=r._cloneInto(t.iHash),t}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const _u=(n,t,e)=>new fu(n,t).update(e).digest();_u.create=(n,t)=>new fu(n,t);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const jo=BigInt(0),$s=BigInt(1);function jn(n){return n instanceof Uint8Array||ArrayBuffer.isView(n)&&n.constructor.name==="Uint8Array"}function Ko(n){if(!jn(n))throw new Error("Uint8Array expected")}function Pr(n,t){if(typeof t!="boolean")throw new Error(n+" boolean expected, got "+t)}function Fr(n){const t=n.toString(16);return t.length&1?"0"+t:t}function wu(n){if(typeof n!="string")throw new Error("hex string expected, got "+typeof n);return n===""?jo:BigInt("0x"+n)}const mu=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",Vf=Array.from({length:256},(n,t)=>t.toString(16).padStart(2,"0"));function Or(n){if(Ko(n),mu)return n.toHex();let t="";for(let e=0;e<n.length;e++)t+=Vf[n[e]];return t}const Vt={_0:48,_9:57,A:65,F:70,a:97,f:102};function ka(n){if(n>=Vt._0&&n<=Vt._9)return n-Vt._0;if(n>=Vt.A&&n<=Vt.F)return n-(Vt.A-10);if(n>=Vt.a&&n<=Vt.f)return n-(Vt.a-10)}function gi(n){if(typeof n!="string")throw new Error("hex string expected, got "+typeof n);if(mu)return Uint8Array.fromHex(n);const t=n.length,e=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);const r=new Uint8Array(e);for(let i=0,s=0;i<e;i++,s+=2){const o=ka(n.charCodeAt(s)),c=ka(n.charCodeAt(s+1));if(o===void 0||c===void 0){const l=n[s]+n[s+1];throw new Error('hex string expected, got non-hex character "'+l+'" at index '+s)}r[i]=o*16+c}return r}function An(n){return wu(Or(n))}function yu(n){return Ko(n),wu(Or(Uint8Array.from(n).reverse()))}function Rr(n,t){return gi(n.toString(16).padStart(t*2,"0"))}function gu(n,t){return Rr(n,t).reverse()}function wt(n,t,e){let r;if(typeof t=="string")try{r=gi(t)}catch(s){throw new Error(n+" must be hex string or Uint8Array, cause: "+s)}else if(jn(t))r=Uint8Array.from(t);else throw new Error(n+" must be hex string or Uint8Array");const i=r.length;if(typeof e=="number"&&i!==e)throw new Error(n+" of length "+e+" expected, got "+i);return r}function Ei(...n){let t=0;for(let r=0;r<n.length;r++){const i=n[r];Ko(i),t+=i.length}const e=new Uint8Array(t);for(let r=0,i=0;r<n.length;r++){const s=n[r];e.set(s,i),i+=s.length}return e}const Xi=n=>typeof n=="bigint"&&jo<=n;function Fo(n,t,e){return Xi(n)&&Xi(t)&&Xi(e)&&t<=n&&n<e}function Mn(n,t,e,r){if(!Fo(t,e,r))throw new Error("expected valid "+n+": "+e+" <= n < "+r+", got "+t)}function Sf(n){let t;for(t=0;n>jo;n>>=$s,t+=1);return t}const ki=n=>($s<<BigInt(n))-$s,es=n=>new Uint8Array(n),Ua=n=>Uint8Array.from(n);function Cf(n,t,e){if(typeof n!="number"||n<2)throw new Error("hashLen must be a number");if(typeof t!="number"||t<2)throw new Error("qByteLen must be a number");if(typeof e!="function")throw new Error("hmacFn must be a function");let r=es(n),i=es(n),s=0;const o=()=>{r.fill(1),i.fill(0),s=0},c=(...d)=>e(i,r,...d),l=(d=es(0))=>{i=c(Ua([0]),d),r=c(),d.length!==0&&(i=c(Ua([1]),d),r=c())},u=()=>{if(s++>=1e3)throw new Error("drbg: tried 1000 values");let d=0;const p=[];for(;d<t;){r=c();const f=r.slice();p.push(f),d+=r.length}return Ei(...p)};return(d,p)=>{o(),l(d);let f;for(;!(f=p(u()));)l();return o(),f}}const $f={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"||jn(n),isSafeInteger:n=>Number.isSafeInteger(n),array:n=>Array.isArray(n),field:(n,t)=>t.Fp.isValid(n),hash:n=>typeof n=="function"&&Number.isSafeInteger(n.outputLen)};function Ui(n,t,e={}){const r=(i,s,o)=>{const c=$f[s];if(typeof c!="function")throw new Error("invalid validator function");const l=n[i];if(!(o&&l===void 0)&&!c(l,n))throw new Error("param "+String(i)+" is invalid. Expected "+s+", got "+l)};for(const[i,s]of Object.entries(t))r(i,s,!1);for(const[i,s]of Object.entries(e))r(i,s,!0);return n}function Na(n){const t=new WeakMap;return(e,...r)=>{const i=t.get(e);if(i!==void 0)return i;const s=n(e,...r);return t.set(e,s),s}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const ve=BigInt(0),he=BigInt(1),mn=BigInt(2),kf=BigInt(3),ks=BigInt(4),Ba=BigInt(5),qa=BigInt(8);function We(n,t){const e=n%t;return e>=ve?e:t+e}function Uf(n,t,e){if(t<ve)throw new Error("invalid exponent, negatives unsupported");if(e<=ve)throw new Error("invalid modulus");if(e===he)return ve;let r=he;for(;t>ve;)t&he&&(r=r*n%e),n=n*n%e,t>>=he;return r}function it(n,t,e){let r=n;for(;t-- >ve;)r*=r,r%=e;return r}function Us(n,t){if(n===ve)throw new Error("invert: expected non-zero number");if(t<=ve)throw new Error("invert: expected positive modulus, got "+t);let e=We(n,t),r=t,i=ve,s=he;for(;e!==ve;){const c=r/e,l=r%e,u=i-s*c;r=e,e=l,i=s,s=u}if(r!==he)throw new Error("invert: does not exist");return We(i,t)}function Nf(n){const t=(n-he)/mn;let e,r,i;for(e=n-he,r=0;e%mn===ve;e/=mn,r++);for(i=mn;i<n&&Uf(i,t,n)!==n-he;i++)if(i>1e3)throw new Error("Cannot find square root: likely non-prime P");if(r===1){const o=(n+he)/ks;return function(l,u){const h=l.pow(u,o);if(!l.eql(l.sqr(h),u))throw new Error("Cannot find square root");return h}}const s=(e+he)/mn;return function(c,l){if(c.pow(l,t)===c.neg(c.ONE))throw new Error("Cannot find square root");let u=r,h=c.pow(c.mul(c.ONE,i),e),d=c.pow(l,s),p=c.pow(l,e);for(;!c.eql(p,c.ONE);){if(c.eql(p,c.ZERO))return c.ZERO;let f=1;for(let m=c.sqr(p);f<u&&!c.eql(m,c.ONE);f++)m=c.sqr(m);const w=c.pow(h,he<<BigInt(u-f-1));h=c.sqr(w),d=c.mul(d,w),p=c.mul(p,h),u=f}return d}}function Bf(n){if(n%ks===kf){const t=(n+he)/ks;return function(r,i){const s=r.pow(i,t);if(!r.eql(r.sqr(s),i))throw new Error("Cannot find square root");return s}}if(n%qa===Ba){const t=(n-Ba)/qa;return function(r,i){const s=r.mul(i,mn),o=r.pow(s,t),c=r.mul(i,o),l=r.mul(r.mul(c,mn),o),u=r.mul(c,r.sub(l,r.ONE));if(!r.eql(r.sqr(u),i))throw new Error("Cannot find square root");return u}}return Nf(n)}const qf=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Mf(n){const t={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},e=qf.reduce((r,i)=>(r[i]="function",r),t);return Ui(n,e)}function zf(n,t,e){if(e<ve)throw new Error("invalid exponent, negatives unsupported");if(e===ve)return n.ONE;if(e===he)return t;let r=n.ONE,i=t;for(;e>ve;)e&he&&(r=n.mul(r,i)),i=n.sqr(i),e>>=he;return r}function jf(n,t){const e=new Array(t.length),r=t.reduce((s,o,c)=>n.is0(o)?s:(e[c]=s,n.mul(s,o)),n.ONE),i=n.inv(r);return t.reduceRight((s,o,c)=>n.is0(o)?s:(e[c]=n.mul(s,e[c]),n.mul(s,o)),i),e}function Eu(n,t){const e=t!==void 0?t:n.toString(2).length,r=Math.ceil(e/8);return{nBitLength:e,nByteLength:r}}function vu(n,t,e=!1,r={}){if(n<=ve)throw new Error("invalid field: expected ORDER > 0, got "+n);const{nBitLength:i,nByteLength:s}=Eu(n,t);if(s>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let o;const c=Object.freeze({ORDER:n,isLE:e,BITS:i,BYTES:s,MASK:ki(i),ZERO:ve,ONE:he,create:l=>We(l,n),isValid:l=>{if(typeof l!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof l);return ve<=l&&l<n},is0:l=>l===ve,isOdd:l=>(l&he)===he,neg:l=>We(-l,n),eql:(l,u)=>l===u,sqr:l=>We(l*l,n),add:(l,u)=>We(l+u,n),sub:(l,u)=>We(l-u,n),mul:(l,u)=>We(l*u,n),pow:(l,u)=>zf(c,l,u),div:(l,u)=>We(l*Us(u,n),n),sqrN:l=>l*l,addN:(l,u)=>l+u,subN:(l,u)=>l-u,mulN:(l,u)=>l*u,inv:l=>Us(l,n),sqrt:r.sqrt||(l=>(o||(o=Bf(n)),o(c,l))),invertBatch:l=>jf(c,l),cmov:(l,u,h)=>h?u:l,toBytes:l=>e?gu(l,s):Rr(l,s),fromBytes:l=>{if(l.length!==s)throw new Error("Field.fromBytes: expected "+s+" bytes, got "+l.length);return e?yu(l):An(l)}});return Object.freeze(c)}function bu(n){if(typeof n!="bigint")throw new Error("field order must be bigint");const t=n.toString(2).length;return Math.ceil(t/8)}function Iu(n){const t=bu(n);return t+Math.ceil(t/2)}function Kf(n,t,e=!1){const r=n.length,i=bu(t),s=Iu(t);if(r<16||r<s||r>1024)throw new Error("expected "+s+"-1024 bytes of input, got "+r);const o=e?yu(n):An(n),c=We(o,t-he)+he;return e?gu(c,i):Rr(c,i)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Ma=BigInt(0),Ns=BigInt(1);function ts(n,t){const e=t.negate();return n?e:t}function Au(n,t){if(!Number.isSafeInteger(n)||n<=0||n>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+n)}function ns(n,t){Au(n,t);const e=Math.ceil(t/n)+1,r=2**(n-1),i=2**n,s=ki(n),o=BigInt(n);return{windows:e,windowSize:r,mask:s,maxNumber:i,shiftBy:o}}function za(n,t,e){const{windowSize:r,mask:i,maxNumber:s,shiftBy:o}=e;let c=Number(n&i),l=n>>o;c>r&&(c-=s,l+=Ns);const u=t*r,h=u+Math.abs(c)-1,d=c===0,p=c<0,f=t%2!==0;return{nextN:l,offset:h,isZero:d,isNeg:p,isNegF:f,offsetF:u}}function Ff(n,t){if(!Array.isArray(n))throw new Error("array expected");n.forEach((e,r)=>{if(!(e instanceof t))throw new Error("invalid point at index "+r)})}function Hf(n,t){if(!Array.isArray(n))throw new Error("array of scalars expected");n.forEach((e,r)=>{if(!t.isValid(e))throw new Error("invalid scalar at index "+r)})}const rs=new WeakMap,Tu=new WeakMap;function is(n){return Tu.get(n)||1}function Wf(n,t){return{constTimeNegate:ts,hasPrecomputes(e){return is(e)!==1},unsafeLadder(e,r,i=n.ZERO){let s=e;for(;r>Ma;)r&Ns&&(i=i.add(s)),s=s.double(),r>>=Ns;return i},precomputeWindow(e,r){const{windows:i,windowSize:s}=ns(r,t),o=[];let c=e,l=c;for(let u=0;u<i;u++){l=c,o.push(l);for(let h=1;h<s;h++)l=l.add(c),o.push(l);c=l.double()}return o},wNAF(e,r,i){let s=n.ZERO,o=n.BASE;const c=ns(e,t);for(let l=0;l<c.windows;l++){const{nextN:u,offset:h,isZero:d,isNeg:p,isNegF:f,offsetF:w}=za(i,l,c);i=u,d?o=o.add(ts(f,r[w])):s=s.add(ts(p,r[h]))}return{p:s,f:o}},wNAFUnsafe(e,r,i,s=n.ZERO){const o=ns(e,t);for(let c=0;c<o.windows&&i!==Ma;c++){const{nextN:l,offset:u,isZero:h,isNeg:d}=za(i,c,o);if(i=l,!h){const p=r[u];s=s.add(d?p.negate():p)}}return s},getPrecomputes(e,r,i){let s=rs.get(r);return s||(s=this.precomputeWindow(r,e),e!==1&&rs.set(r,i(s))),s},wNAFCached(e,r,i){const s=is(e);return this.wNAF(s,this.getPrecomputes(s,e,i),r)},wNAFCachedUnsafe(e,r,i,s){const o=is(e);return o===1?this.unsafeLadder(e,r,s):this.wNAFUnsafe(o,this.getPrecomputes(o,e,i),r,s)},setWindowSize(e,r){Au(r,t),Tu.set(e,r),rs.delete(e)}}}function Gf(n,t,e,r){if(Ff(e,n),Hf(r,t),e.length!==r.length)throw new Error("arrays of points and scalars must have equal length");const i=n.ZERO,s=Sf(BigInt(e.length)),o=s>12?s-3:s>4?s-2:s?2:1,c=ki(o),l=new Array(Number(c)+1).fill(i),u=Math.floor((t.BITS-1)/o)*o;let h=i;for(let d=u;d>=0;d-=o){l.fill(i);for(let f=0;f<r.length;f++){const w=r[f],m=Number(w>>BigInt(d)&c);l[m]=l[m].add(e[f])}let p=i;for(let f=l.length-1,w=i;f>0;f--)w=w.add(l[f]),p=p.add(w);if(h=h.add(p),d!==0)for(let f=0;f<o;f++)h=h.double()}return h}function Pu(n){return Mf(n.Fp),Ui(n,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...Eu(n.n,n.nBitLength),...n,p:n.Fp.ORDER})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function ja(n){n.lowS!==void 0&&Pr("lowS",n.lowS),n.prehash!==void 0&&Pr("prehash",n.prehash)}function Zf(n){const t=Pu(n);Ui(t,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:e,Fp:r,a:i}=t;if(e){if(!r.eql(i,r.ZERO))throw new Error("invalid endomorphism, can only be defined for Koblitz curves that have a=0");if(typeof e!="object"||typeof e.beta!="bigint"||typeof e.splitScalar!="function")throw new Error("invalid endomorphism, expected beta: bigint and splitScalar: function")}return Object.freeze({...t})}class Yf extends Error{constructor(t=""){super(t)}}const Ut={Err:Yf,_tlv:{encode:(n,t)=>{const{Err:e}=Ut;if(n<0||n>256)throw new e("tlv.encode: wrong tag");if(t.length&1)throw new e("tlv.encode: unpadded data");const r=t.length/2,i=Fr(r);if(i.length/2&128)throw new e("tlv.encode: long form length too big");const s=r>127?Fr(i.length/2|128):"";return Fr(n)+s+i+t},decode(n,t){const{Err:e}=Ut;let r=0;if(n<0||n>256)throw new e("tlv.encode: wrong tag");if(t.length<2||t[r++]!==n)throw new e("tlv.decode: wrong tlv");const i=t[r++],s=!!(i&128);let o=0;if(!s)o=i;else{const l=i&127;if(!l)throw new e("tlv.decode(long): indefinite length not supported");if(l>4)throw new e("tlv.decode(long): byte length is too big");const u=t.subarray(r,r+l);if(u.length!==l)throw new e("tlv.decode: length bytes not complete");if(u[0]===0)throw new e("tlv.decode(long): zero leftmost byte");for(const h of u)o=o<<8|h;if(r+=l,o<128)throw new e("tlv.decode(long): not minimal encoding")}const c=t.subarray(r,r+o);if(c.length!==o)throw new e("tlv.decode: wrong value length");return{v:c,l:t.subarray(r+o)}}},_int:{encode(n){const{Err:t}=Ut;if(n<Bt)throw new t("integer: negative integers are not allowed");let e=Fr(n);if(Number.parseInt(e[0],16)&8&&(e="00"+e),e.length&1)throw new t("unexpected DER parsing assertion: unpadded hex");return e},decode(n){const{Err:t}=Ut;if(n[0]&128)throw new t("invalid signature integer: negative");if(n[0]===0&&!(n[1]&128))throw new t("invalid signature integer: unnecessary leading zero");return An(n)}},toSig(n){const{Err:t,_int:e,_tlv:r}=Ut,i=wt("signature",n),{v:s,l:o}=r.decode(48,i);if(o.length)throw new t("invalid signature: left bytes after parsing");const{v:c,l}=r.decode(2,s),{v:u,l:h}=r.decode(2,l);if(h.length)throw new t("invalid signature: left bytes after parsing");return{r:e.decode(c),s:e.decode(u)}},hexFromSig(n){const{_tlv:t,_int:e}=Ut,r=t.encode(2,e.encode(n.r)),i=t.encode(2,e.encode(n.s)),s=r+i;return t.encode(48,s)}},Bt=BigInt(0),ge=BigInt(1);BigInt(2);const Ka=BigInt(3);BigInt(4);function Jf(n){const t=Zf(n),{Fp:e}=t,r=vu(t.n,t.nBitLength),i=t.toBytes||((m,_,E)=>{const v=_.toAffine();return Ei(Uint8Array.from([4]),e.toBytes(v.x),e.toBytes(v.y))}),s=t.fromBytes||(m=>{const _=m.subarray(1),E=e.fromBytes(_.subarray(0,e.BYTES)),v=e.fromBytes(_.subarray(e.BYTES,2*e.BYTES));return{x:E,y:v}});function o(m){const{a:_,b:E}=t,v=e.sqr(m),g=e.mul(v,m);return e.add(e.add(g,e.mul(m,_)),E)}if(!e.eql(e.sqr(t.Gy),o(t.Gx)))throw new Error("bad generator point: equation left != right");function c(m){return Fo(m,ge,t.n)}function l(m){const{allowedPrivateKeyLengths:_,nByteLength:E,wrapPrivateKey:v,n:g}=t;if(_&&typeof m!="bigint"){if(jn(m)&&(m=Or(m)),typeof m!="string"||!_.includes(m.length))throw new Error("invalid private key");m=m.padStart(E*2,"0")}let I;try{I=typeof m=="bigint"?m:An(wt("private key",m,E))}catch{throw new Error("invalid private key, expected hex or "+E+" bytes, got "+typeof m)}return v&&(I=We(I,g)),Mn("private key",I,ge,g),I}function u(m){if(!(m instanceof p))throw new Error("ProjectivePoint expected")}const h=Na((m,_)=>{const{px:E,py:v,pz:g}=m;if(e.eql(g,e.ONE))return{x:E,y:v};const I=m.is0();_==null&&(_=I?e.ONE:e.inv(g));const b=e.mul(E,_),L=e.mul(v,_),x=e.mul(g,_);if(I)return{x:e.ZERO,y:e.ZERO};if(!e.eql(x,e.ONE))throw new Error("invZ was invalid");return{x:b,y:L}}),d=Na(m=>{if(m.is0()){if(t.allowInfinityPoint&&!e.is0(m.py))return;throw new Error("bad point: ZERO")}const{x:_,y:E}=m.toAffine();if(!e.isValid(_)||!e.isValid(E))throw new Error("bad point: x or y not FE");const v=e.sqr(E),g=o(_);if(!e.eql(v,g))throw new Error("bad point: equation left != right");if(!m.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});class p{constructor(_,E,v){if(_==null||!e.isValid(_))throw new Error("x required");if(E==null||!e.isValid(E))throw new Error("y required");if(v==null||!e.isValid(v))throw new Error("z required");this.px=_,this.py=E,this.pz=v,Object.freeze(this)}static fromAffine(_){const{x:E,y:v}=_||{};if(!_||!e.isValid(E)||!e.isValid(v))throw new Error("invalid affine point");if(_ instanceof p)throw new Error("projective point not allowed");const g=I=>e.eql(I,e.ZERO);return g(E)&&g(v)?p.ZERO:new p(E,v,e.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(_){const E=e.invertBatch(_.map(v=>v.pz));return _.map((v,g)=>v.toAffine(E[g])).map(p.fromAffine)}static fromHex(_){const E=p.fromAffine(s(wt("pointHex",_)));return E.assertValidity(),E}static fromPrivateKey(_){return p.BASE.multiply(l(_))}static msm(_,E){return Gf(p,r,_,E)}_setWindowSize(_){w.setWindowSize(this,_)}assertValidity(){d(this)}hasEvenY(){const{y:_}=this.toAffine();if(e.isOdd)return!e.isOdd(_);throw new Error("Field doesn't support isOdd")}equals(_){u(_);const{px:E,py:v,pz:g}=this,{px:I,py:b,pz:L}=_,x=e.eql(e.mul(E,L),e.mul(I,g)),S=e.eql(e.mul(v,L),e.mul(b,g));return x&&S}negate(){return new p(this.px,e.neg(this.py),this.pz)}double(){const{a:_,b:E}=t,v=e.mul(E,Ka),{px:g,py:I,pz:b}=this;let L=e.ZERO,x=e.ZERO,S=e.ZERO,y=e.mul(g,g),D=e.mul(I,I),T=e.mul(b,b),O=e.mul(g,I);return O=e.add(O,O),S=e.mul(g,b),S=e.add(S,S),L=e.mul(_,S),x=e.mul(v,T),x=e.add(L,x),L=e.sub(D,x),x=e.add(D,x),x=e.mul(L,x),L=e.mul(O,L),S=e.mul(v,S),T=e.mul(_,T),O=e.sub(y,T),O=e.mul(_,O),O=e.add(O,S),S=e.add(y,y),y=e.add(S,y),y=e.add(y,T),y=e.mul(y,O),x=e.add(x,y),T=e.mul(I,b),T=e.add(T,T),y=e.mul(T,O),L=e.sub(L,y),S=e.mul(T,D),S=e.add(S,S),S=e.add(S,S),new p(L,x,S)}add(_){u(_);const{px:E,py:v,pz:g}=this,{px:I,py:b,pz:L}=_;let x=e.ZERO,S=e.ZERO,y=e.ZERO;const D=t.a,T=e.mul(t.b,Ka);let O=e.mul(E,I),C=e.mul(v,b),A=e.mul(g,L),P=e.add(E,v),R=e.add(I,b);P=e.mul(P,R),R=e.add(O,C),P=e.sub(P,R),R=e.add(E,g);let V=e.add(I,L);return R=e.mul(R,V),V=e.add(O,A),R=e.sub(R,V),V=e.add(v,g),x=e.add(b,L),V=e.mul(V,x),x=e.add(C,A),V=e.sub(V,x),y=e.mul(D,R),x=e.mul(T,A),y=e.add(x,y),x=e.sub(C,y),y=e.add(C,y),S=e.mul(x,y),C=e.add(O,O),C=e.add(C,O),A=e.mul(D,A),R=e.mul(T,R),C=e.add(C,A),A=e.sub(O,A),A=e.mul(D,A),R=e.add(R,A),O=e.mul(C,R),S=e.add(S,O),O=e.mul(V,R),x=e.mul(P,x),x=e.sub(x,O),O=e.mul(P,C),y=e.mul(V,y),y=e.add(y,O),new p(x,S,y)}subtract(_){return this.add(_.negate())}is0(){return this.equals(p.ZERO)}wNAF(_){return w.wNAFCached(this,_,p.normalizeZ)}multiplyUnsafe(_){const{endo:E,n:v}=t;Mn("scalar",_,Bt,v);const g=p.ZERO;if(_===Bt)return g;if(this.is0()||_===ge)return this;if(!E||w.hasPrecomputes(this))return w.wNAFCachedUnsafe(this,_,p.normalizeZ);let{k1neg:I,k1:b,k2neg:L,k2:x}=E.splitScalar(_),S=g,y=g,D=this;for(;b>Bt||x>Bt;)b&ge&&(S=S.add(D)),x&ge&&(y=y.add(D)),D=D.double(),b>>=ge,x>>=ge;return I&&(S=S.negate()),L&&(y=y.negate()),y=new p(e.mul(y.px,E.beta),y.py,y.pz),S.add(y)}multiply(_){const{endo:E,n:v}=t;Mn("scalar",_,ge,v);let g,I;if(E){const{k1neg:b,k1:L,k2neg:x,k2:S}=E.splitScalar(_);let{p:y,f:D}=this.wNAF(L),{p:T,f:O}=this.wNAF(S);y=w.constTimeNegate(b,y),T=w.constTimeNegate(x,T),T=new p(e.mul(T.px,E.beta),T.py,T.pz),g=y.add(T),I=D.add(O)}else{const{p:b,f:L}=this.wNAF(_);g=b,I=L}return p.normalizeZ([g,I])[0]}multiplyAndAddUnsafe(_,E,v){const g=p.BASE,I=(L,x)=>x===Bt||x===ge||!L.equals(g)?L.multiplyUnsafe(x):L.multiply(x),b=I(this,E).add(I(_,v));return b.is0()?void 0:b}toAffine(_){return h(this,_)}isTorsionFree(){const{h:_,isTorsionFree:E}=t;if(_===ge)return!0;if(E)return E(p,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:_,clearCofactor:E}=t;return _===ge?this:E?E(p,this):this.multiplyUnsafe(t.h)}toRawBytes(_=!0){return Pr("isCompressed",_),this.assertValidity(),i(p,this,_)}toHex(_=!0){return Pr("isCompressed",_),Or(this.toRawBytes(_))}}p.BASE=new p(t.Gx,t.Gy,e.ONE),p.ZERO=new p(e.ZERO,e.ONE,e.ZERO);const f=t.nBitLength,w=Wf(p,t.endo?Math.ceil(f/2):f);return{CURVE:t,ProjectivePoint:p,normPrivateKeyToScalar:l,weierstrassEquation:o,isWithinCurveOrder:c}}function Qf(n){const t=Pu(n);return Ui(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}function Xf(n){const t=Qf(n),{Fp:e,n:r}=t,i=e.BYTES+1,s=2*e.BYTES+1;function o(A){return We(A,r)}function c(A){return Us(A,r)}const{ProjectivePoint:l,normPrivateKeyToScalar:u,weierstrassEquation:h,isWithinCurveOrder:d}=Jf({...t,toBytes(A,P,R){const V=P.toAffine(),k=e.toBytes(V.x),$=Ei;return Pr("isCompressed",R),R?$(Uint8Array.from([P.hasEvenY()?2:3]),k):$(Uint8Array.from([4]),k,e.toBytes(V.y))},fromBytes(A){const P=A.length,R=A[0],V=A.subarray(1);if(P===i&&(R===2||R===3)){const k=An(V);if(!Fo(k,ge,e.ORDER))throw new Error("Point is not on curve");const $=h(k);let q;try{q=e.sqrt($)}catch(F){const K=F instanceof Error?": "+F.message:"";throw new Error("Point is not on curve"+K)}const N=(q&ge)===ge;return(R&1)===1!==N&&(q=e.neg(q)),{x:k,y:q}}else if(P===s&&R===4){const k=e.fromBytes(V.subarray(0,e.BYTES)),$=e.fromBytes(V.subarray(e.BYTES,2*e.BYTES));return{x:k,y:$}}else{const k=i,$=s;throw new Error("invalid Point, expected length of "+k+", or uncompressed "+$+", got "+P)}}}),p=A=>Or(Rr(A,t.nByteLength));function f(A){const P=r>>ge;return A>P}function w(A){return f(A)?o(-A):A}const m=(A,P,R)=>An(A.slice(P,R));class _{constructor(P,R,V){Mn("r",P,ge,r),Mn("s",R,ge,r),this.r=P,this.s=R,V!=null&&(this.recovery=V),Object.freeze(this)}static fromCompact(P){const R=t.nByteLength;return P=wt("compactSignature",P,R*2),new _(m(P,0,R),m(P,R,2*R))}static fromDER(P){const{r:R,s:V}=Ut.toSig(wt("DER",P));return new _(R,V)}assertValidity(){}addRecoveryBit(P){return new _(this.r,this.s,P)}recoverPublicKey(P){const{r:R,s:V,recovery:k}=this,$=L(wt("msgHash",P));if(k==null||![0,1,2,3].includes(k))throw new Error("recovery id invalid");const q=k===2||k===3?R+t.n:R;if(q>=e.ORDER)throw new Error("recovery id 2 or 3 invalid");const N=k&1?"03":"02",j=l.fromHex(N+p(q)),F=c(q),K=o(-$*F),H=o(V*F),G=l.BASE.multiplyAndAddUnsafe(j,K,H);if(!G)throw new Error("point at infinify");return G.assertValidity(),G}hasHighS(){return f(this.s)}normalizeS(){return this.hasHighS()?new _(this.r,o(-this.s),this.recovery):this}toDERRawBytes(){return gi(this.toDERHex())}toDERHex(){return Ut.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return gi(this.toCompactHex())}toCompactHex(){return p(this.r)+p(this.s)}}const E={isValidPrivateKey(A){try{return u(A),!0}catch{return!1}},normPrivateKeyToScalar:u,randomPrivateKey:()=>{const A=Iu(t.n);return Kf(t.randomBytes(A),t.n)},precompute(A=8,P=l.BASE){return P._setWindowSize(A),P.multiply(BigInt(3)),P}};function v(A,P=!0){return l.fromPrivateKey(A).toRawBytes(P)}function g(A){const P=jn(A),R=typeof A=="string",V=(P||R)&&A.length;return P?V===i||V===s:R?V===2*i||V===2*s:A instanceof l}function I(A,P,R=!0){if(g(A))throw new Error("first arg must be private key");if(!g(P))throw new Error("second arg must be public key");return l.fromHex(P).multiply(u(A)).toRawBytes(R)}const b=t.bits2int||function(A){if(A.length>8192)throw new Error("input is too large");const P=An(A),R=A.length*8-t.nBitLength;return R>0?P>>BigInt(R):P},L=t.bits2int_modN||function(A){return o(b(A))},x=ki(t.nBitLength);function S(A){return Mn("num < 2^"+t.nBitLength,A,Bt,x),Rr(A,t.nByteLength)}function y(A,P,R=D){if(["recovered","canonical"].some(re=>re in R))throw new Error("sign() legacy options not supported");const{hash:V,randomBytes:k}=t;let{lowS:$,prehash:q,extraEntropy:N}=R;$==null&&($=!0),A=wt("msgHash",A),ja(R),q&&(A=wt("prehashed msgHash",V(A)));const j=L(A),F=u(P),K=[S(F),S(j)];if(N!=null&&N!==!1){const re=N===!0?k(e.BYTES):N;K.push(wt("extraEntropy",re))}const H=Ei(...K),G=j;function ce(re){const te=b(re);if(!d(te))return;const De=c(te),Be=l.BASE.multiply(te).toAffine(),Et=o(Be.x);if(Et===Bt)return;const pn=o(De*o(G+Et*F));if(pn===Bt)return;let vt=(Be.x===Et?0:2)|Number(Be.y&ge),zr=pn;return $&&f(pn)&&(zr=w(pn),vt^=1),new _(Et,zr,vt)}return{seed:H,k2sig:ce}}const D={lowS:t.lowS,prehash:!1},T={lowS:t.lowS,prehash:!1};function O(A,P,R=D){const{seed:V,k2sig:k}=y(A,P,R),$=t;return Cf($.hash.outputLen,$.nByteLength,$.hmac)(V,k)}l.BASE._setWindowSize(8);function C(A,P,R,V=T){const k=A;P=wt("msgHash",P),R=wt("publicKey",R);const{lowS:$,prehash:q,format:N}=V;if(ja(V),"strict"in V)throw new Error("options.strict was renamed to lowS");if(N!==void 0&&N!=="compact"&&N!=="der")throw new Error("format must be compact or der");const j=typeof k=="string"||jn(k),F=!j&&!N&&typeof k=="object"&&k!==null&&typeof k.r=="bigint"&&typeof k.s=="bigint";if(!j&&!F)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");let K,H;try{if(F&&(K=new _(k.r,k.s)),j){try{N!=="compact"&&(K=_.fromDER(k))}catch(vt){if(!(vt instanceof Ut.Err))throw vt}!K&&N!=="der"&&(K=_.fromCompact(k))}H=l.fromHex(R)}catch{return!1}if(!K||$&&K.hasHighS())return!1;q&&(P=t.hash(P));const{r:G,s:ce}=K,re=L(P),te=c(ce),De=o(re*te),Be=o(G*te),Et=l.BASE.multiplyAndAddUnsafe(H,De,Be)?.toAffine();return Et?o(Et.x)===G:!1}return{CURVE:t,getPublicKey:v,getSharedSecret:I,sign:O,verify:C,ProjectivePoint:l,Signature:_,utils:E}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function e_(n){return{hash:n,hmac:(t,...e)=>_u(n,t,bf(...e)),randomBytes:Af}}function t_(n,t){const e=r=>Xf({...n,...e_(r)});return{...e(t),create:e}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Ou=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),Fa=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),n_=BigInt(1),Bs=BigInt(2),Ha=(n,t)=>(n+t/Bs)/t;function r_(n){const t=Ou,e=BigInt(3),r=BigInt(6),i=BigInt(11),s=BigInt(22),o=BigInt(23),c=BigInt(44),l=BigInt(88),u=n*n*n%t,h=u*u*n%t,d=it(h,e,t)*h%t,p=it(d,e,t)*h%t,f=it(p,Bs,t)*u%t,w=it(f,i,t)*f%t,m=it(w,s,t)*w%t,_=it(m,c,t)*m%t,E=it(_,l,t)*_%t,v=it(E,c,t)*m%t,g=it(v,e,t)*h%t,I=it(g,o,t)*w%t,b=it(I,r,t)*u%t,L=it(b,Bs,t);if(!qs.eql(qs.sqr(L),n))throw new Error("Cannot find square root");return L}const qs=vu(Ou,void 0,void 0,{sqrt:r_}),Ho=t_({a:BigInt(0),b:BigInt(7),Fp:qs,n:Fa,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:n=>{const t=Fa,e=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-n_*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),s=e,o=BigInt("0x100000000000000000000000000000000"),c=Ha(s*n,t),l=Ha(-r*n,t);let u=We(n-c*e-l*i,t),h=We(-c*r-l*s,t);const d=u>o,p=h>o;if(d&&(u=t-u),p&&(h=t-h),u>o||h>o)throw new Error("splitScalar: Endomorphism failed, k="+n);return{k1neg:d,k1:u,k2neg:p,k2:h}}}},xf);BigInt(0);Ho.ProjectivePoint;function i_(n){if("privateKey"in n){const t=Ip(typeof n.message=="object"?n.message.raw:Ul(n.message)),e=bo({payload:t,privateKey:n.privateKey});return $l(e)}if("account"in n){const{message:t,account:e}=n;return e.signMessage({message:t})}throw new Error("Either privateKey or account is required")}function s_(n){const{privateKey:t,...e}=n;typeof e.domain?.chainId=="string"&&(e.domain.chainId=Nl(e.domain.chainId));const r=Dd(e),i=bo({payload:r,privateKey:t});return $l(i)}function Ms(n){const{client:t}=n,e=`0x${n.privateKey.replace(/^0x/,"")}`,r=Ao(Ho.getPublicKey(e.slice(2),!1)),i=np(r);return{address:J(i),sendTransaction:async o=>{const c=Si({chain:be(o.chainId),client:t}),l=ga({privateKey:e,transaction:o});return{transactionHash:await xd(c,l)}},signAuthorization:async o=>{const c=bo({payload:Sl(o),privateKey:e});return Ld(o,{signature:c})},signMessage:async({message:o})=>i_({message:o,privateKey:e}),signTransaction:async o=>ga({privateKey:e,transaction:o}),signTypedData:async o=>s_({...o,privateKey:e})}}async function o_(n){const t=Ao(Ho.utils.randomPrivateKey());return Ms({client:n.client,privateKey:t})}async function a_(n){const{address:t,client:e,chain:r}=n,i=n.tokenAddress||(r.id===42429?"0x20c0000000000000000000000000000000000000":void 0);if(i&&J(i)!==J(Ea)){const{getBalance:h}=await a(async()=>{const{getBalance:d}=await import("./getBalance-D7nzATjL.js");return{getBalance:d}},__vite__mapDeps([40,30,1,27,31,25,23,24,28,29,4,26,32,41]));return h({address:t,contract:Po({address:i,chain:r,client:e})})}const s=Si({chain:r,client:e}),[o,c,l,u]=await Promise.all([Gd(r),Zd(r),Yd(r),Vd(s,{address:t})]);return{chainId:r.id,decimals:c,displayValue:rp(u,c),name:l,symbol:o,tokenAddress:i??Ea,value:u}}function c_(n){return!n||typeof n.then!="function"?Promise.resolve(n):n}function ye(n,...t){try{return c_(n(...t))}catch(e){return Promise.reject(e)}}function l_(n){const t=typeof n;return n===null||t!=="object"&&t!=="function"}function u_(n){const t=Object.getPrototypeOf(n);return!t||t.isPrototypeOf(Object)}function ii(n){if(l_(n))return String(n);if(u_(n)||Array.isArray(n))return JSON.stringify(n);if(typeof n.toJSON=="function")return ii(n.toJSON());throw new Error("[unstorage] Cannot stringify value!")}const zs="base64:";function h_(n){return typeof n=="string"?n:zs+f_(n)}function d_(n){return typeof n!="string"||!n.startsWith(zs)?n:p_(n.slice(zs.length))}function p_(n){return globalThis.Buffer?Buffer.from(n,"base64"):Uint8Array.from(globalThis.atob(n),t=>t.codePointAt(0))}function f_(n){return globalThis.Buffer?Buffer.from(n).toString("base64"):globalThis.btoa(String.fromCodePoint(...n))}function Ke(n){return n&&n.split("?")[0]?.replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,"")||""}function __(...n){return Ke(n.join(":"))}function Hr(n){return n=Ke(n),n?n+":":""}function w_(n,t){if(t===void 0)return!0;let e=0,r=n.indexOf(":");for(;r>-1;)e++,r=n.indexOf(":",r+1);return e<=t}function m_(n,t){return t?n.startsWith(t)&&n[n.length-1]!=="$":n[n.length-1]!=="$"}const y_="memory",g_=()=>{const n=new Map;return{name:y_,getInstance:()=>n,hasItem(t){return n.has(t)},getItem(t){return n.get(t)??null},getItemRaw(t){return n.get(t)??null},setItem(t,e){n.set(t,e)},setItemRaw(t,e){n.set(t,e)},removeItem(t){n.delete(t)},getKeys(){return[...n.keys()]},clear(){n.clear()},dispose(){n.clear()}}};function E_(n={}){const t={mounts:{"":n.driver||g_()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},e=u=>{for(const h of t.mountpoints)if(u.startsWith(h))return{base:h,relativeKey:u.slice(h.length),driver:t.mounts[h]};return{base:"",relativeKey:u,driver:t.mounts[""]}},r=(u,h)=>t.mountpoints.filter(d=>d.startsWith(u)||h&&u.startsWith(d)).map(d=>({relativeBase:u.length>d.length?u.slice(d.length):void 0,mountpoint:d,driver:t.mounts[d]})),i=(u,h)=>{if(t.watching){h=Ke(h);for(const d of t.watchListeners)d(u,h)}},s=async()=>{if(!t.watching){t.watching=!0;for(const u in t.mounts)t.unwatch[u]=await Wa(t.mounts[u],i,u)}},o=async()=>{if(t.watching){for(const u in t.unwatch)await t.unwatch[u]();t.unwatch={},t.watching=!1}},c=(u,h,d)=>{const p=new Map,f=w=>{let m=p.get(w.base);return m||(m={driver:w.driver,base:w.base,items:[]},p.set(w.base,m)),m};for(const w of u){const m=typeof w=="string",_=Ke(m?w:w.key),E=m?void 0:w.value,v=m||!w.options?h:{...h,...w.options},g=e(_);f(g).items.push({key:_,value:E,relativeKey:g.relativeKey,options:v})}return Promise.all([...p.values()].map(w=>d(w))).then(w=>w.flat())},l={hasItem(u,h={}){u=Ke(u);const{relativeKey:d,driver:p}=e(u);return ye(p.hasItem,d,h)},getItem(u,h={}){u=Ke(u);const{relativeKey:d,driver:p}=e(u);return ye(p.getItem,d,h).then(f=>jr(f))},getItems(u,h={}){return c(u,h,d=>d.driver.getItems?ye(d.driver.getItems,d.items.map(p=>({key:p.relativeKey,options:p.options})),h).then(p=>p.map(f=>({key:__(d.base,f.key),value:jr(f.value)}))):Promise.all(d.items.map(p=>ye(d.driver.getItem,p.relativeKey,p.options).then(f=>({key:p.key,value:jr(f)})))))},getItemRaw(u,h={}){u=Ke(u);const{relativeKey:d,driver:p}=e(u);return p.getItemRaw?ye(p.getItemRaw,d,h):ye(p.getItem,d,h).then(f=>d_(f))},async setItem(u,h,d={}){if(h===void 0)return l.removeItem(u);u=Ke(u);const{relativeKey:p,driver:f}=e(u);f.setItem&&(await ye(f.setItem,p,ii(h),d),f.watch||i("update",u))},async setItems(u,h){await c(u,h,async d=>{if(d.driver.setItems)return ye(d.driver.setItems,d.items.map(p=>({key:p.relativeKey,value:ii(p.value),options:p.options})),h);d.driver.setItem&&await Promise.all(d.items.map(p=>ye(d.driver.setItem,p.relativeKey,ii(p.value),p.options)))})},async setItemRaw(u,h,d={}){if(h===void 0)return l.removeItem(u,d);u=Ke(u);const{relativeKey:p,driver:f}=e(u);if(f.setItemRaw)await ye(f.setItemRaw,p,h,d);else if(f.setItem)await ye(f.setItem,p,h_(h),d);else return;f.watch||i("update",u)},async removeItem(u,h={}){typeof h=="boolean"&&(h={removeMeta:h}),u=Ke(u);const{relativeKey:d,driver:p}=e(u);p.removeItem&&(await ye(p.removeItem,d,h),(h.removeMeta||h.removeMata)&&await ye(p.removeItem,d+"$",h),p.watch||i("remove",u))},async getMeta(u,h={}){typeof h=="boolean"&&(h={nativeOnly:h}),u=Ke(u);const{relativeKey:d,driver:p}=e(u),f=Object.create(null);if(p.getMeta&&Object.assign(f,await ye(p.getMeta,d,h)),!h.nativeOnly){const w=await ye(p.getItem,d+"$",h).then(m=>jr(m));w&&typeof w=="object"&&(typeof w.atime=="string"&&(w.atime=new Date(w.atime)),typeof w.mtime=="string"&&(w.mtime=new Date(w.mtime)),Object.assign(f,w))}return f},setMeta(u,h,d={}){return this.setItem(u+"$",h,d)},removeMeta(u,h={}){return this.removeItem(u+"$",h)},async getKeys(u,h={}){u=Hr(u);const d=r(u,!0);let p=[];const f=[];let w=!0;for(const _ of d){_.driver.flags?.maxDepth||(w=!1);const E=await ye(_.driver.getKeys,_.relativeBase,h);for(const v of E){const g=_.mountpoint+Ke(v);p.some(I=>g.startsWith(I))||f.push(g)}p=[_.mountpoint,...p.filter(v=>!v.startsWith(_.mountpoint))]}const m=h.maxDepth!==void 0&&!w;return f.filter(_=>(!m||w_(_,h.maxDepth))&&m_(_,u))},async clear(u,h={}){u=Hr(u),await Promise.all(r(u,!1).map(async d=>{if(d.driver.clear)return ye(d.driver.clear,d.relativeBase,h);if(d.driver.removeItem){const p=await d.driver.getKeys(d.relativeBase||"",h);return Promise.all(p.map(f=>d.driver.removeItem(f,h)))}}))},async dispose(){await Promise.all(Object.values(t.mounts).map(u=>Ga(u)))},async watch(u){return await s(),t.watchListeners.push(u),async()=>{t.watchListeners=t.watchListeners.filter(h=>h!==u),t.watchListeners.length===0&&await o()}},async unwatch(){t.watchListeners=[],await o()},mount(u,h){if(u=Hr(u),u&&t.mounts[u])throw new Error(`already mounted at ${u}`);return u&&(t.mountpoints.push(u),t.mountpoints.sort((d,p)=>p.length-d.length)),t.mounts[u]=h,t.watching&&Promise.resolve(Wa(h,i,u)).then(d=>{t.unwatch[u]=d}).catch(console.error),l},async unmount(u,h=!0){u=Hr(u),!(!u||!t.mounts[u])&&(t.watching&&u in t.unwatch&&(t.unwatch[u]?.(),delete t.unwatch[u]),h&&await Ga(t.mounts[u]),t.mountpoints=t.mountpoints.filter(d=>d!==u),delete t.mounts[u])},getMount(u=""){u=Ke(u)+":";const h=e(u);return{driver:h.driver,base:h.base}},getMounts(u="",h={}){return u=Ke(u),r(u,h.parents).map(p=>({driver:p.driver,base:p.mountpoint}))},keys:(u,h={})=>l.getKeys(u,h),get:(u,h={})=>l.getItem(u,h),set:(u,h,d={})=>l.setItem(u,h,d),has:(u,h={})=>l.hasItem(u,h),del:(u,h={})=>l.removeItem(u,h),remove:(u,h={})=>l.removeItem(u,h)};return l}function Wa(n,t,e){return n.watch?n.watch((r,i)=>t(r,e+i)):()=>{}}async function Ga(n){typeof n.dispose=="function"&&await ye(n.dispose)}const v_="idb-keyval";var b_=(n={})=>{const t=n.base&&n.base.length>0?`${n.base}:`:"",e=i=>t+i;let r;return n.dbName&&n.storeName&&(r=fp(n.dbName,n.storeName)),{name:v_,options:n,async hasItem(i){return!(typeof await Ta(e(i),r)>"u")},async getItem(i){return await Ta(e(i),r)??null},setItem(i,s){return yp(e(i),s,r)},removeItem(i){return mp(e(i),r)},getKeys(){return wp(r)},clear(){return _p(r)}}};const I_="WALLET_CONNECT_V2_INDEXED_DB",A_="keyvaluestorage";class T_{constructor(){this.indexedDb=E_({driver:b_({dbName:I_,storeName:A_})})}async getKeys(){return this.indexedDb.getKeys()}async getEntries(){return(await this.indexedDb.getItems(await this.indexedDb.getKeys())).map(t=>[t.key,t.value])}async getItem(t){const e=await this.indexedDb.getItem(t);if(e!==null)return e}async setItem(t,e){await this.indexedDb.setItem(t,Do(e))}async removeItem(t){await this.indexedDb.removeItem(t)}}var ss=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},si={exports:{}};(function(){let n;function t(){}n=t,n.prototype.getItem=function(e){return this.hasOwnProperty(e)?String(this[e]):null},n.prototype.setItem=function(e,r){this[e]=String(r)},n.prototype.removeItem=function(e){delete this[e]},n.prototype.clear=function(){const e=this;Object.keys(e).forEach(function(r){e[r]=void 0,delete e[r]})},n.prototype.key=function(e){return e=e||0,Object.keys(this)[e]},n.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof ss<"u"&&ss.localStorage?si.exports=ss.localStorage:typeof window<"u"&&window.localStorage?si.exports=window.localStorage:si.exports=new t})();function P_(n){var t;return[n[0],fi((t=n[1])!=null?t:"")]}let O_=class{constructor(){this.localStorage=si.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(P_)}async getItem(t){const e=this.localStorage.getItem(t);if(e!==null)return fi(e)}async setItem(t,e){this.localStorage.setItem(t,Do(e))}async removeItem(t){this.localStorage.removeItem(t)}};const R_="wc_storage_version",Za=1,D_=async(n,t,e)=>{const r=R_,i=await t.getItem(r);if(i&&i>=Za){e(t);return}const s=await n.getKeys();if(!s.length){e(t);return}const o=[];for(;s.length;){const c=s.shift();if(!c)continue;const l=c.toLowerCase();if(l.includes("wc@")||l.includes("walletconnect")||l.includes("wc_")||l.includes("wallet_connect")){const u=await n.getItem(c);await t.setItem(c,u),o.push(c)}}await t.setItem(r,Za),e(t),L_(n,o)},L_=async(n,t)=>{t.length&&t.forEach(async e=>{await n.removeItem(e)})};let x_=class{constructor(){this.initialized=!1,this.setInitialized=e=>{this.storage=e,this.initialized=!0};const t=new O_;this.storage=t;try{const e=new T_;D_(t,e,this.setInitialized)}catch{this.initialized=!0}}async getKeys(){return await this.initialize(),this.storage.getKeys()}async getEntries(){return await this.initialize(),this.storage.getEntries()}async getItem(t){return await this.initialize(),this.storage.getItem(t)}async setItem(t,e){return await this.initialize(),this.storage.setItem(t,e)}async removeItem(t){return await this.initialize(),this.storage.removeItem(t)}async initialize(){this.initialized||await new Promise(t=>{const e=setInterval(()=>{this.initialized&&(clearInterval(e),t())},20)})}};var V_=Object.defineProperty,S_=(n,t,e)=>t in n?V_(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,Ya=(n,t,e)=>S_(n,typeof t!="symbol"?t+"":t,e);class C_ extends Wn{constructor(t){super(),this.opts=t,Ya(this,"protocol","wc"),Ya(this,"version",2)}}var $_=Object.defineProperty,k_=(n,t,e)=>t in n?$_(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,U_=(n,t,e)=>k_(n,t+"",e);class N_ extends Wn{constructor(t,e){super(),this.core=t,this.logger=e,U_(this,"records",new Map)}}class B_{constructor(t,e){this.logger=t,this.core=e}}let q_=class extends Wn{constructor(t,e){super(),this.relayer=t,this.logger=e}},M_=class extends Wn{constructor(t){super()}},z_=class{constructor(t,e,r,i){this.core=t,this.logger=e,this.name=r}},j_=class extends Wn{constructor(t,e){super(),this.relayer=t,this.logger=e}};class K_ extends Wn{constructor(t,e){super(),this.core=t,this.logger=e}}let F_=class{constructor(t,e,r){this.core=t,this.logger=e,this.store=r}},H_=class{constructor(t,e){this.projectId=t,this.logger=e}},W_=class{constructor(t,e,r){this.core=t,this.logger=e,this.telemetryEnabled=r}};var G_=Object.defineProperty,Z_=(n,t,e)=>t in n?G_(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,Ja=(n,t,e)=>Z_(n,typeof t!="symbol"?t+"":t,e);let Y_=class{constructor(t){this.opts=t,Ja(this,"protocol","wc"),Ja(this,"version",2)}},J_=class{constructor(t){this.client=t}};function Q_(n){if(n.length>=255)throw new TypeError("Alphabet too long");const t=new Uint8Array(256);for(let u=0;u<t.length;u++)t[u]=255;for(let u=0;u<n.length;u++){const h=n.charAt(u),d=h.charCodeAt(0);if(t[d]!==255)throw new TypeError(h+" is ambiguous");t[d]=u}const e=n.length,r=n.charAt(0),i=Math.log(e)/Math.log(256),s=Math.log(256)/Math.log(e);function o(u){if(u instanceof Uint8Array||(ArrayBuffer.isView(u)?u=new Uint8Array(u.buffer,u.byteOffset,u.byteLength):Array.isArray(u)&&(u=Uint8Array.from(u))),!(u instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(u.length===0)return"";let h=0,d=0,p=0;const f=u.length;for(;p!==f&&u[p]===0;)p++,h++;const w=(f-p)*s+1>>>0,m=new Uint8Array(w);for(;p!==f;){let v=u[p],g=0;for(let I=w-1;(v!==0||g<d)&&I!==-1;I--,g++)v+=256*m[I]>>>0,m[I]=v%e>>>0,v=v/e>>>0;if(v!==0)throw new Error("Non-zero carry");d=g,p++}let _=w-d;for(;_!==w&&m[_]===0;)_++;let E=r.repeat(h);for(;_<w;++_)E+=n.charAt(m[_]);return E}function c(u){if(typeof u!="string")throw new TypeError("Expected String");if(u.length===0)return new Uint8Array;let h=0,d=0,p=0;for(;u[h]===r;)d++,h++;const f=(u.length-h)*i+1>>>0,w=new Uint8Array(f);for(;h<u.length;){const v=u.charCodeAt(h);if(v>255)return;let g=t[v];if(g===255)return;let I=0;for(let b=f-1;(g!==0||I<p)&&b!==-1;b--,I++)g+=e*w[b]>>>0,w[b]=g%256>>>0,g=g/256>>>0;if(g!==0)throw new Error("Non-zero carry");p=I,h++}let m=f-p;for(;m!==f&&w[m]===0;)m++;const _=new Uint8Array(d+(f-m));let E=d;for(;m!==f;)_[E++]=w[m++];return _}function l(u){const h=c(u);if(h)return h;throw new Error("Non-base"+e+" character")}return{encode:o,decodeUnsafe:c,decode:l}}var X_="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";const kr=Q_(X_);function ew(n){const t=n.length;let e=0,r=0;for(;r<t;){let i=n.charCodeAt(r++);if(i&4294967168)if(!(i&4294965248))e+=2;else{if(i>=55296&&i<=56319&&r<t){const s=n.charCodeAt(r);(s&64512)===56320&&(++r,i=((i&1023)<<10)+(s&1023)+65536)}i&4294901760?e+=4:e+=3}else{e++;continue}}return e}function tw(n,t,e){const r=n.length;let i=e,s=0;for(;s<r;){let o=n.charCodeAt(s++);if(o&4294967168)if(!(o&4294965248))t[i++]=o>>6&31|192;else{if(o>=55296&&o<=56319&&s<r){const c=n.charCodeAt(s);(c&64512)===56320&&(++s,o=((o&1023)<<10)+(c&1023)+65536)}o&4294901760?(t[i++]=o>>18&7|240,t[i++]=o>>12&63|128,t[i++]=o>>6&63|128):(t[i++]=o>>12&15|224,t[i++]=o>>6&63|128)}else{t[i++]=o;continue}t[i++]=o&63|128}}const nw=new TextEncoder,rw=50;function iw(n,t,e){nw.encodeInto(n,t.subarray(e))}function sw(n,t,e){n.length>rw?iw(n,t,e):tw(n,t,e)}const ow=4096;function Ru(n,t,e){let r=t;const i=r+e,s=[];let o="";for(;r<i;){const c=n[r++];if(!(c&128))s.push(c);else if((c&224)===192){const l=n[r++]&63;s.push((c&31)<<6|l)}else if((c&240)===224){const l=n[r++]&63,u=n[r++]&63;s.push((c&31)<<12|l<<6|u)}else if((c&248)===240){const l=n[r++]&63,u=n[r++]&63,h=n[r++]&63;let d=(c&7)<<18|l<<12|u<<6|h;d>65535&&(d-=65536,s.push(d>>>10&1023|55296),d=56320|d&1023),s.push(d)}else s.push(c);s.length>=ow&&(o+=String.fromCharCode(...s),s.length=0)}return s.length>0&&(o+=String.fromCharCode(...s)),o}const aw=new TextDecoder,cw=200;function lw(n,t,e){const r=n.subarray(t,t+e);return aw.decode(r)}function uw(n,t,e){return e>cw?lw(n,t,e):Ru(n,t,e)}class Wr{constructor(t,e){this.type=t,this.data=e}}class tt extends Error{constructor(t){super(t);const e=Object.create(tt.prototype);Object.setPrototypeOf(this,e),Object.defineProperty(this,"name",{configurable:!0,enumerable:!1,value:tt.name})}}const er=4294967295;function hw(n,t,e){const r=e/4294967296,i=e;n.setUint32(t,r),n.setUint32(t+4,i)}function Du(n,t,e){const r=Math.floor(e/4294967296),i=e;n.setUint32(t,r),n.setUint32(t+4,i)}function Lu(n,t){const e=n.getInt32(t),r=n.getUint32(t+4);return e*4294967296+r}function dw(n,t){const e=n.getUint32(t),r=n.getUint32(t+4);return e*4294967296+r}const pw=-1,fw=4294967296-1,_w=17179869184-1;function ww({sec:n,nsec:t}){if(n>=0&&t>=0&&n<=_w)if(t===0&&n<=fw){const e=new Uint8Array(4);return new DataView(e.buffer).setUint32(0,n),e}else{const e=n/4294967296,r=n&4294967295,i=new Uint8Array(8),s=new DataView(i.buffer);return s.setUint32(0,t<<2|e&3),s.setUint32(4,r),i}else{const e=new Uint8Array(12),r=new DataView(e.buffer);return r.setUint32(0,t),Du(r,4,n),e}}function mw(n){const t=n.getTime(),e=Math.floor(t/1e3),r=(t-e*1e3)*1e6,i=Math.floor(r/1e9);return{sec:e+i,nsec:r-i*1e9}}function yw(n){if(n instanceof Date){const t=mw(n);return ww(t)}else return null}function gw(n){const t=new DataView(n.buffer,n.byteOffset,n.byteLength);switch(n.byteLength){case 4:return{sec:t.getUint32(0),nsec:0};case 8:{const e=t.getUint32(0),r=t.getUint32(4),i=(e&3)*4294967296+r,s=e>>>2;return{sec:i,nsec:s}}case 12:{const e=Lu(t,4),r=t.getUint32(0);return{sec:e,nsec:r}}default:throw new tt(`Unrecognized data size for timestamp (expected 4, 8, or 12): ${n.length}`)}}function Ew(n){const t=gw(n);return new Date(t.sec*1e3+t.nsec/1e6)}const vw={type:pw,encode:yw,decode:Ew};class vi{constructor(){this.builtInEncoders=[],this.builtInDecoders=[],this.encoders=[],this.decoders=[],this.register(vw)}register({type:t,encode:e,decode:r}){if(t>=0)this.encoders[t]=e,this.decoders[t]=r;else{const i=-1-t;this.builtInEncoders[i]=e,this.builtInDecoders[i]=r}}tryToEncode(t,e){for(let r=0;r<this.builtInEncoders.length;r++){const i=this.builtInEncoders[r];if(i!=null){const s=i(t,e);if(s!=null){const o=-1-r;return new Wr(o,s)}}}for(let r=0;r<this.encoders.length;r++){const i=this.encoders[r];if(i!=null){const s=i(t,e);if(s!=null){const o=r;return new Wr(o,s)}}}return t instanceof Wr?t:null}decode(t,e,r){const i=e<0?this.builtInDecoders[-1-e]:this.decoders[e];return i?i(t,e,r):new Wr(e,t)}}vi.defaultCodec=new vi;function bw(n){return n instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&n instanceof SharedArrayBuffer}function js(n){return n instanceof Uint8Array?n:ArrayBuffer.isView(n)?new Uint8Array(n.buffer,n.byteOffset,n.byteLength):bw(n)?new Uint8Array(n):Uint8Array.from(n)}const Iw=100,Aw=2048;class Wo{constructor(t){this.entered=!1,this.extensionCodec=t?.extensionCodec??vi.defaultCodec,this.context=t?.context,this.useBigInt64=t?.useBigInt64??!1,this.maxDepth=t?.maxDepth??Iw,this.initialBufferSize=t?.initialBufferSize??Aw,this.sortKeys=t?.sortKeys??!1,this.forceFloat32=t?.forceFloat32??!1,this.ignoreUndefined=t?.ignoreUndefined??!1,this.forceIntegerToFloat=t?.forceIntegerToFloat??!1,this.pos=0,this.view=new DataView(new ArrayBuffer(this.initialBufferSize)),this.bytes=new Uint8Array(this.view.buffer)}clone(){return new Wo({extensionCodec:this.extensionCodec,context:this.context,useBigInt64:this.useBigInt64,maxDepth:this.maxDepth,initialBufferSize:this.initialBufferSize,sortKeys:this.sortKeys,forceFloat32:this.forceFloat32,ignoreUndefined:this.ignoreUndefined,forceIntegerToFloat:this.forceIntegerToFloat})}reinitializeState(){this.pos=0}encodeSharedRef(t){if(this.entered)return this.clone().encodeSharedRef(t);try{return this.entered=!0,this.reinitializeState(),this.doEncode(t,1),this.bytes.subarray(0,this.pos)}finally{this.entered=!1}}encode(t){if(this.entered)return this.clone().encode(t);try{return this.entered=!0,this.reinitializeState(),this.doEncode(t,1),this.bytes.slice(0,this.pos)}finally{this.entered=!1}}doEncode(t,e){if(e>this.maxDepth)throw new Error(`Too deep objects in depth ${e}`);t==null?this.encodeNil():typeof t=="boolean"?this.encodeBoolean(t):typeof t=="number"?this.forceIntegerToFloat?this.encodeNumberAsFloat(t):this.encodeNumber(t):typeof t=="string"?this.encodeString(t):this.useBigInt64&&typeof t=="bigint"?this.encodeBigInt64(t):this.encodeObject(t,e)}ensureBufferSizeToWrite(t){const e=this.pos+t;this.view.byteLength<e&&this.resizeBuffer(e*2)}resizeBuffer(t){const e=new ArrayBuffer(t),r=new Uint8Array(e),i=new DataView(e);r.set(this.bytes),this.view=i,this.bytes=r}encodeNil(){this.writeU8(192)}encodeBoolean(t){t===!1?this.writeU8(194):this.writeU8(195)}encodeNumber(t){!this.forceIntegerToFloat&&Number.isSafeInteger(t)?t>=0?t<128?this.writeU8(t):t<256?(this.writeU8(204),this.writeU8(t)):t<65536?(this.writeU8(205),this.writeU16(t)):t<4294967296?(this.writeU8(206),this.writeU32(t)):this.useBigInt64?this.encodeNumberAsFloat(t):(this.writeU8(207),this.writeU64(t)):t>=-32?this.writeU8(224|t+32):t>=-128?(this.writeU8(208),this.writeI8(t)):t>=-32768?(this.writeU8(209),this.writeI16(t)):t>=-2147483648?(this.writeU8(210),this.writeI32(t)):this.useBigInt64?this.encodeNumberAsFloat(t):(this.writeU8(211),this.writeI64(t)):this.encodeNumberAsFloat(t)}encodeNumberAsFloat(t){this.forceFloat32?(this.writeU8(202),this.writeF32(t)):(this.writeU8(203),this.writeF64(t))}encodeBigInt64(t){t>=BigInt(0)?(this.writeU8(207),this.writeBigUint64(t)):(this.writeU8(211),this.writeBigInt64(t))}writeStringHeader(t){if(t<32)this.writeU8(160+t);else if(t<256)this.writeU8(217),this.writeU8(t);else if(t<65536)this.writeU8(218),this.writeU16(t);else if(t<4294967296)this.writeU8(219),this.writeU32(t);else throw new Error(`Too long string: ${t} bytes in UTF-8`)}encodeString(t){const r=ew(t);this.ensureBufferSizeToWrite(5+r),this.writeStringHeader(r),sw(t,this.bytes,this.pos),this.pos+=r}encodeObject(t,e){const r=this.extensionCodec.tryToEncode(t,this.context);if(r!=null)this.encodeExtension(r);else if(Array.isArray(t))this.encodeArray(t,e);else if(ArrayBuffer.isView(t))this.encodeBinary(t);else if(typeof t=="object")this.encodeMap(t,e);else throw new Error(`Unrecognized object: ${Object.prototype.toString.apply(t)}`)}encodeBinary(t){const e=t.byteLength;if(e<256)this.writeU8(196),this.writeU8(e);else if(e<65536)this.writeU8(197),this.writeU16(e);else if(e<4294967296)this.writeU8(198),this.writeU32(e);else throw new Error(`Too large binary: ${e}`);const r=js(t);this.writeU8a(r)}encodeArray(t,e){const r=t.length;if(r<16)this.writeU8(144+r);else if(r<65536)this.writeU8(220),this.writeU16(r);else if(r<4294967296)this.writeU8(221),this.writeU32(r);else throw new Error(`Too large array: ${r}`);for(const i of t)this.doEncode(i,e+1)}countWithoutUndefined(t,e){let r=0;for(const i of e)t[i]!==void 0&&r++;return r}encodeMap(t,e){const r=Object.keys(t);this.sortKeys&&r.sort();const i=this.ignoreUndefined?this.countWithoutUndefined(t,r):r.length;if(i<16)this.writeU8(128+i);else if(i<65536)this.writeU8(222),this.writeU16(i);else if(i<4294967296)this.writeU8(223),this.writeU32(i);else throw new Error(`Too large map object: ${i}`);for(const s of r){const o=t[s];this.ignoreUndefined&&o===void 0||(this.encodeString(s),this.doEncode(o,e+1))}}encodeExtension(t){if(typeof t.data=="function"){const r=t.data(this.pos+6),i=r.length;if(i>=4294967296)throw new Error(`Too large extension object: ${i}`);this.writeU8(201),this.writeU32(i),this.writeI8(t.type),this.writeU8a(r);return}const e=t.data.length;if(e===1)this.writeU8(212);else if(e===2)this.writeU8(213);else if(e===4)this.writeU8(214);else if(e===8)this.writeU8(215);else if(e===16)this.writeU8(216);else if(e<256)this.writeU8(199),this.writeU8(e);else if(e<65536)this.writeU8(200),this.writeU16(e);else if(e<4294967296)this.writeU8(201),this.writeU32(e);else throw new Error(`Too large extension object: ${e}`);this.writeI8(t.type),this.writeU8a(t.data)}writeU8(t){this.ensureBufferSizeToWrite(1),this.view.setUint8(this.pos,t),this.pos++}writeU8a(t){const e=t.length;this.ensureBufferSizeToWrite(e),this.bytes.set(t,this.pos),this.pos+=e}writeI8(t){this.ensureBufferSizeToWrite(1),this.view.setInt8(this.pos,t),this.pos++}writeU16(t){this.ensureBufferSizeToWrite(2),this.view.setUint16(this.pos,t),this.pos+=2}writeI16(t){this.ensureBufferSizeToWrite(2),this.view.setInt16(this.pos,t),this.pos+=2}writeU32(t){this.ensureBufferSizeToWrite(4),this.view.setUint32(this.pos,t),this.pos+=4}writeI32(t){this.ensureBufferSizeToWrite(4),this.view.setInt32(this.pos,t),this.pos+=4}writeF32(t){this.ensureBufferSizeToWrite(4),this.view.setFloat32(this.pos,t),this.pos+=4}writeF64(t){this.ensureBufferSizeToWrite(8),this.view.setFloat64(this.pos,t),this.pos+=8}writeU64(t){this.ensureBufferSizeToWrite(8),hw(this.view,this.pos,t),this.pos+=8}writeI64(t){this.ensureBufferSizeToWrite(8),Du(this.view,this.pos,t),this.pos+=8}writeBigUint64(t){this.ensureBufferSizeToWrite(8),this.view.setBigUint64(this.pos,t),this.pos+=8}writeBigInt64(t){this.ensureBufferSizeToWrite(8),this.view.setBigInt64(this.pos,t),this.pos+=8}}function Tw(n,t){return new Wo(t).encodeSharedRef(n)}function os(n){return`${n<0?"-":""}0x${Math.abs(n).toString(16).padStart(2,"0")}`}const Pw=16,Ow=16;class Rw{constructor(t=Pw,e=Ow){this.hit=0,this.miss=0,this.maxKeyLength=t,this.maxLengthPerKey=e,this.caches=[];for(let r=0;r<this.maxKeyLength;r++)this.caches.push([])}canBeCached(t){return t>0&&t<=this.maxKeyLength}find(t,e,r){const i=this.caches[r-1];e:for(const s of i){const o=s.bytes;for(let c=0;c<r;c++)if(o[c]!==t[e+c])continue e;return s.str}return null}store(t,e){const r=this.caches[t.length-1],i={bytes:t,str:e};r.length>=this.maxLengthPerKey?r[Math.random()*r.length|0]=i:r.push(i)}decode(t,e,r){const i=this.find(t,e,r);if(i!=null)return this.hit++,i;this.miss++;const s=Ru(t,e,r),o=Uint8Array.prototype.slice.call(t,e,e+r);return this.store(o,s),s}}const Ks="array",mr="map_key",xu="map_value",Dw=n=>{if(typeof n=="string"||typeof n=="number")return n;throw new tt("The type of key must be string or number but "+typeof n)};class Lw{constructor(){this.stack=[],this.stackHeadPosition=-1}get length(){return this.stackHeadPosition+1}top(){return this.stack[this.stackHeadPosition]}pushArrayState(t){const e=this.getUninitializedStateFromPool();e.type=Ks,e.position=0,e.size=t,e.array=new Array(t)}pushMapState(t){const e=this.getUninitializedStateFromPool();e.type=mr,e.readCount=0,e.size=t,e.map={}}getUninitializedStateFromPool(){if(this.stackHeadPosition++,this.stackHeadPosition===this.stack.length){const t={type:void 0,size:0,array:void 0,position:0,readCount:0,map:void 0,key:null};this.stack.push(t)}return this.stack[this.stackHeadPosition]}release(t){if(this.stack[this.stackHeadPosition]!==t)throw new Error("Invalid stack state. Released state is not on top of the stack.");if(t.type===Ks){const r=t;r.size=0,r.array=void 0,r.position=0,r.type=void 0}if(t.type===mr||t.type===xu){const r=t;r.size=0,r.map=void 0,r.readCount=0,r.type=void 0}this.stackHeadPosition--}reset(){this.stack.length=0,this.stackHeadPosition=-1}}const tr=-1,Go=new DataView(new ArrayBuffer(0)),xw=new Uint8Array(Go.buffer);try{Go.getInt8(0)}catch(n){if(!(n instanceof RangeError))throw new Error("This module is not supported in the current JavaScript engine because DataView does not throw RangeError on out-of-bounds access")}const Qa=new RangeError("Insufficient data"),Vw=new Rw;class Zo{constructor(t){this.totalPos=0,this.pos=0,this.view=Go,this.bytes=xw,this.headByte=tr,this.stack=new Lw,this.entered=!1,this.extensionCodec=t?.extensionCodec??vi.defaultCodec,this.context=t?.context,this.useBigInt64=t?.useBigInt64??!1,this.rawStrings=t?.rawStrings??!1,this.maxStrLength=t?.maxStrLength??er,this.maxBinLength=t?.maxBinLength??er,this.maxArrayLength=t?.maxArrayLength??er,this.maxMapLength=t?.maxMapLength??er,this.maxExtLength=t?.maxExtLength??er,this.keyDecoder=t?.keyDecoder!==void 0?t.keyDecoder:Vw,this.mapKeyConverter=t?.mapKeyConverter??Dw}clone(){return new Zo({extensionCodec:this.extensionCodec,context:this.context,useBigInt64:this.useBigInt64,rawStrings:this.rawStrings,maxStrLength:this.maxStrLength,maxBinLength:this.maxBinLength,maxArrayLength:this.maxArrayLength,maxMapLength:this.maxMapLength,maxExtLength:this.maxExtLength,keyDecoder:this.keyDecoder})}reinitializeState(){this.totalPos=0,this.headByte=tr,this.stack.reset()}setBuffer(t){const e=js(t);this.bytes=e,this.view=new DataView(e.buffer,e.byteOffset,e.byteLength),this.pos=0}appendBuffer(t){if(this.headByte===tr&&!this.hasRemaining(1))this.setBuffer(t);else{const e=this.bytes.subarray(this.pos),r=js(t),i=new Uint8Array(e.length+r.length);i.set(e),i.set(r,e.length),this.setBuffer(i)}}hasRemaining(t){return this.view.byteLength-this.pos>=t}createExtraByteError(t){const{view:e,pos:r}=this;return new RangeError(`Extra ${e.byteLength-r} of ${e.byteLength} byte(s) found at buffer[${t}]`)}decode(t){if(this.entered)return this.clone().decode(t);try{this.entered=!0,this.reinitializeState(),this.setBuffer(t);const e=this.doDecodeSync();if(this.hasRemaining(1))throw this.createExtraByteError(this.pos);return e}finally{this.entered=!1}}*decodeMulti(t){if(this.entered){yield*this.clone().decodeMulti(t);return}try{for(this.entered=!0,this.reinitializeState(),this.setBuffer(t);this.hasRemaining(1);)yield this.doDecodeSync()}finally{this.entered=!1}}async decodeAsync(t){if(this.entered)return this.clone().decodeAsync(t);try{this.entered=!0;let e=!1,r;for await(const c of t){if(e)throw this.entered=!1,this.createExtraByteError(this.totalPos);this.appendBuffer(c);try{r=this.doDecodeSync(),e=!0}catch(l){if(!(l instanceof RangeError))throw l}this.totalPos+=this.pos}if(e){if(this.hasRemaining(1))throw this.createExtraByteError(this.totalPos);return r}const{headByte:i,pos:s,totalPos:o}=this;throw new RangeError(`Insufficient data in parsing ${os(i)} at ${o} (${s} in the current buffer)`)}finally{this.entered=!1}}decodeArrayStream(t){return this.decodeMultiAsync(t,!0)}decodeStream(t){return this.decodeMultiAsync(t,!1)}async*decodeMultiAsync(t,e){if(this.entered){yield*this.clone().decodeMultiAsync(t,e);return}try{this.entered=!0;let r=e,i=-1;for await(const s of t){if(e&&i===0)throw this.createExtraByteError(this.totalPos);this.appendBuffer(s),r&&(i=this.readArraySize(),r=!1,this.complete());try{for(;yield this.doDecodeSync(),--i!==0;);}catch(o){if(!(o instanceof RangeError))throw o}this.totalPos+=this.pos}}finally{this.entered=!1}}doDecodeSync(){e:for(;;){const t=this.readHeadByte();let e;if(t>=224)e=t-256;else if(t<192)if(t<128)e=t;else if(t<144){const i=t-128;if(i!==0){this.pushMapState(i),this.complete();continue e}else e={}}else if(t<160){const i=t-144;if(i!==0){this.pushArrayState(i),this.complete();continue e}else e=[]}else{const i=t-160;e=this.decodeString(i,0)}else if(t===192)e=null;else if(t===194)e=!1;else if(t===195)e=!0;else if(t===202)e=this.readF32();else if(t===203)e=this.readF64();else if(t===204)e=this.readU8();else if(t===205)e=this.readU16();else if(t===206)e=this.readU32();else if(t===207)this.useBigInt64?e=this.readU64AsBigInt():e=this.readU64();else if(t===208)e=this.readI8();else if(t===209)e=this.readI16();else if(t===210)e=this.readI32();else if(t===211)this.useBigInt64?e=this.readI64AsBigInt():e=this.readI64();else if(t===217){const i=this.lookU8();e=this.decodeString(i,1)}else if(t===218){const i=this.lookU16();e=this.decodeString(i,2)}else if(t===219){const i=this.lookU32();e=this.decodeString(i,4)}else if(t===220){const i=this.readU16();if(i!==0){this.pushArrayState(i),this.complete();continue e}else e=[]}else if(t===221){const i=this.readU32();if(i!==0){this.pushArrayState(i),this.complete();continue e}else e=[]}else if(t===222){const i=this.readU16();if(i!==0){this.pushMapState(i),this.complete();continue e}else e={}}else if(t===223){const i=this.readU32();if(i!==0){this.pushMapState(i),this.complete();continue e}else e={}}else if(t===196){const i=this.lookU8();e=this.decodeBinary(i,1)}else if(t===197){const i=this.lookU16();e=this.decodeBinary(i,2)}else if(t===198){const i=this.lookU32();e=this.decodeBinary(i,4)}else if(t===212)e=this.decodeExtension(1,0);else if(t===213)e=this.decodeExtension(2,0);else if(t===214)e=this.decodeExtension(4,0);else if(t===215)e=this.decodeExtension(8,0);else if(t===216)e=this.decodeExtension(16,0);else if(t===199){const i=this.lookU8();e=this.decodeExtension(i,1)}else if(t===200){const i=this.lookU16();e=this.decodeExtension(i,2)}else if(t===201){const i=this.lookU32();e=this.decodeExtension(i,4)}else throw new tt(`Unrecognized type byte: ${os(t)}`);this.complete();const r=this.stack;for(;r.length>0;){const i=r.top();if(i.type===Ks)if(i.array[i.position]=e,i.position++,i.position===i.size)e=i.array,r.release(i);else continue e;else if(i.type===mr){if(e==="__proto__")throw new tt("The key __proto__ is not allowed");i.key=this.mapKeyConverter(e),i.type=xu;continue e}else if(i.map[i.key]=e,i.readCount++,i.readCount===i.size)e=i.map,r.release(i);else{i.key=null,i.type=mr;continue e}}return e}}readHeadByte(){return this.headByte===tr&&(this.headByte=this.readU8()),this.headByte}complete(){this.headByte=tr}readArraySize(){const t=this.readHeadByte();switch(t){case 220:return this.readU16();case 221:return this.readU32();default:{if(t<160)return t-144;throw new tt(`Unrecognized array type byte: ${os(t)}`)}}}pushMapState(t){if(t>this.maxMapLength)throw new tt(`Max length exceeded: map length (${t}) > maxMapLengthLength (${this.maxMapLength})`);this.stack.pushMapState(t)}pushArrayState(t){if(t>this.maxArrayLength)throw new tt(`Max length exceeded: array length (${t}) > maxArrayLength (${this.maxArrayLength})`);this.stack.pushArrayState(t)}decodeString(t,e){return!this.rawStrings||this.stateIsMapKey()?this.decodeUtf8String(t,e):this.decodeBinary(t,e)}decodeUtf8String(t,e){if(t>this.maxStrLength)throw new tt(`Max length exceeded: UTF-8 byte length (${t}) > maxStrLength (${this.maxStrLength})`);if(this.bytes.byteLength<this.pos+e+t)throw Qa;const r=this.pos+e;let i;return this.stateIsMapKey()&&this.keyDecoder?.canBeCached(t)?i=this.keyDecoder.decode(this.bytes,r,t):i=uw(this.bytes,r,t),this.pos+=e+t,i}stateIsMapKey(){return this.stack.length>0?this.stack.top().type===mr:!1}decodeBinary(t,e){if(t>this.maxBinLength)throw new tt(`Max length exceeded: bin length (${t}) > maxBinLength (${this.maxBinLength})`);if(!this.hasRemaining(t+e))throw Qa;const r=this.pos+e,i=this.bytes.subarray(r,r+t);return this.pos+=e+t,i}decodeExtension(t,e){if(t>this.maxExtLength)throw new tt(`Max length exceeded: ext length (${t}) > maxExtLength (${this.maxExtLength})`);const r=this.view.getInt8(this.pos+e),i=this.decodeBinary(t,e+1);return this.extensionCodec.decode(i,r,this.context)}lookU8(){return this.view.getUint8(this.pos)}lookU16(){return this.view.getUint16(this.pos)}lookU32(){return this.view.getUint32(this.pos)}readU8(){const t=this.view.getUint8(this.pos);return this.pos++,t}readI8(){const t=this.view.getInt8(this.pos);return this.pos++,t}readU16(){const t=this.view.getUint16(this.pos);return this.pos+=2,t}readI16(){const t=this.view.getInt16(this.pos);return this.pos+=2,t}readU32(){const t=this.view.getUint32(this.pos);return this.pos+=4,t}readI32(){const t=this.view.getInt32(this.pos);return this.pos+=4,t}readU64(){const t=dw(this.view,this.pos);return this.pos+=8,t}readI64(){const t=Lu(this.view,this.pos);return this.pos+=8,t}readU64AsBigInt(){const t=this.view.getBigUint64(this.pos);return this.pos+=8,t}readI64AsBigInt(){const t=this.view.getBigInt64(this.pos);return this.pos+=8,t}readF32(){const t=this.view.getFloat32(this.pos);return this.pos+=4,t}readF64(){const t=this.view.getFloat64(this.pos);return this.pos+=8,t}}function Sw(n,t){return new Zo(t).decode(n)}/*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) */function Cw(n){return n instanceof Uint8Array||ArrayBuffer.isView(n)&&n.constructor.name==="Uint8Array"}function Vu(n,t){return Array.isArray(t)?t.length===0?!0:n?t.every(e=>typeof e=="string"):t.every(e=>Number.isSafeInteger(e)):!1}function bi(n,t){if(typeof t!="string")throw new Error(`${n}: string expected`);return!0}function Yo(n){if(!Number.isSafeInteger(n))throw new Error(`invalid integer: ${n}`)}function Fs(n){if(!Array.isArray(n))throw new Error("array expected")}function Ii(n,t){if(!Vu(!0,t))throw new Error(`${n}: array of strings expected`)}function $w(n,t){if(!Vu(!1,t))throw new Error(`${n}: array of numbers expected`)}function kw(...n){const t=s=>s,e=(s,o)=>c=>s(o(c)),r=n.map(s=>s.encode).reduceRight(e,t),i=n.map(s=>s.decode).reduce(e,t);return{encode:r,decode:i}}function Uw(n){const t=typeof n=="string"?n.split(""):n,e=t.length;Ii("alphabet",t);const r=new Map(t.map((i,s)=>[i,s]));return{encode:i=>(Fs(i),i.map(s=>{if(!Number.isSafeInteger(s)||s<0||s>=e)throw new Error(`alphabet.encode: digit index outside alphabet "${s}". Allowed: ${n}`);return t[s]})),decode:i=>(Fs(i),i.map(s=>{bi("alphabet.decode",s);const o=r.get(s);if(o===void 0)throw new Error(`Unknown letter: "${s}". Allowed: ${n}`);return o}))}}function Nw(n=""){return bi("join",n),{encode:t=>(Ii("join.decode",t),t.join(n)),decode:t=>(bi("join.decode",t),t.split(n))}}function Bw(n,t="="){return Yo(n),bi("padding",t),{encode(e){for(Ii("padding.encode",e);e.length*n%8;)e.push(t);return e},decode(e){Ii("padding.decode",e);let r=e.length;if(r*n%8)throw new Error("padding: invalid, string should have whole number of bytes");for(;r>0&&e[r-1]===t;r--)if((r-1)*n%8===0)throw new Error("padding: invalid, string has too much padding");return e.slice(0,r)}}}const Su=(n,t)=>t===0?n:Su(t,n%t),Ai=(n,t)=>n+(t-Su(n,t)),as=(()=>{let n=[];for(let t=0;t<40;t++)n.push(2**t);return n})();function Xa(n,t,e,r){if(Fs(n),t<=0||t>32)throw new Error(`convertRadix2: wrong from=${t}`);if(e<=0||e>32)throw new Error(`convertRadix2: wrong to=${e}`);if(Ai(t,e)>32)throw new Error(`convertRadix2: carry overflow from=${t} to=${e} carryBits=${Ai(t,e)}`);let i=0,s=0;const o=as[t],c=as[e]-1,l=[];for(const u of n){if(Yo(u),u>=o)throw new Error(`convertRadix2: invalid data word=${u} from=${t}`);if(i=i<<t|u,s+t>32)throw new Error(`convertRadix2: carry overflow pos=${s} from=${t}`);for(s+=t;s>=e;s-=e)l.push((i>>s-e&c)>>>0);const h=as[s];if(h===void 0)throw new Error("invalid carry");i&=h-1}if(i=i<<e-s&c,!r&&s>=t)throw new Error("Excess padding");if(!r&&i>0)throw new Error(`Non-zero padding: ${i}`);return r&&s>0&&l.push(i>>>0),l}function qw(n,t=!1){if(Yo(n),n<=0||n>32)throw new Error("radix2: bits should be in (0..32]");if(Ai(8,n)>32||Ai(n,8)>32)throw new Error("radix2: carry overflow");return{encode:e=>{if(!Cw(e))throw new Error("radix2.encode input should be Uint8Array");return Xa(Array.from(e),8,n,!t)},decode:e=>($w("radix2.decode",e),Uint8Array.from(Xa(e,n,8,t)))}}const Mw=kw(qw(5),Uw("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"),Bw(5),Nw(""));function Jo(n){return globalThis.Buffer!=null?new Uint8Array(n.buffer,n.byteOffset,n.byteLength):n}function Cu(n=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?Jo(globalThis.Buffer.allocUnsafe(n)):new Uint8Array(n)}function yr(n,t){t||(t=n.reduce((i,s)=>i+s.length,0));const e=Cu(t);let r=0;for(const i of n)e.set(i,r),r+=i.length;return Jo(e)}function $u(n,t,e,r){return{name:n,prefix:t,encoder:{name:n,prefix:t,encode:e},decoder:{decode:r}}}const ec=$u("utf8","u",n=>"u"+new TextDecoder("utf8").decode(n),n=>new TextEncoder().encode(n.substring(1))),cs=$u("ascii","a",n=>{let t="a";for(let e=0;e<n.length;e++)t+=String.fromCharCode(n[e]);return t},n=>{n=n.substring(1);const t=Cu(n.length);for(let e=0;e<n.length;e++)t[e]=n.charCodeAt(e);return t}),ku={utf8:ec,"utf-8":ec,hex:Ia.base16,latin1:cs,ascii:cs,binary:cs,...Ia};function ut(n,t="utf8"){const e=ku[t];if(!e)throw new Error(`Unsupported encoding "${t}"`);return(t==="utf8"||t==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?Jo(globalThis.Buffer.from(n,"utf-8")):e.decoder.decode(`${e.prefix}${n}`)}function Qe(n,t="utf8"){const e=ku[t];if(!e)throw new Error(`Unsupported encoding "${t}"`);return(t==="utf8"||t==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(n.buffer,n.byteOffset,n.byteLength).toString("utf8"):e.encoder.encode(n).substring(1)}const zw="Input must be an string, Buffer or Uint8Array";function jw(n){let t;if(n instanceof Uint8Array)t=n;else if(typeof n=="string")t=new TextEncoder().encode(n);else throw new Error(zw);return t}function Kw(n){return Array.prototype.map.call(n,function(t){return(t<16?"0":"")+t.toString(16)}).join("")}function Gr(n){return(4294967296+n).toString(16).substring(1)}function Fw(n,t,e){let r=`
4
+ `+n+" = ";for(let i=0;i<t.length;i+=2){if(e===32)r+=Gr(t[i]).toUpperCase(),r+=" ",r+=Gr(t[i+1]).toUpperCase();else if(e===64)r+=Gr(t[i+1]).toUpperCase(),r+=Gr(t[i]).toUpperCase();else throw new Error("Invalid size "+e);i%6===4?r+=`
5
+ `+new Array(n.length+4).join(" "):i<t.length-2&&(r+=" ")}console.log(r)}function Hw(n,t,e){let r=new Date().getTime();const i=new Uint8Array(t);for(let o=0;o<t;o++)i[o]=o%256;const s=new Date().getTime();console.log("Generated random input in "+(s-r)+"ms"),r=s;for(let o=0;o<e;o++){const c=n(i),l=new Date().getTime(),u=l-r;r=l,console.log("Hashed in "+u+"ms: "+c.substring(0,20)+"..."),console.log(Math.round(t/(1<<20)/(u/1e3)*100)/100+" MB PER SECOND")}}var Uu={normalizeInput:jw,toHex:Kw,debugPrint:Fw,testSpeed:Hw};const oi=Uu;function Zr(n,t,e){const r=n[t]+n[e];let i=n[t+1]+n[e+1];r>=4294967296&&i++,n[t]=r,n[t+1]=i}function tc(n,t,e,r){let i=n[t]+e;e<0&&(i+=4294967296);let s=n[t+1]+r;i>=4294967296&&s++,n[t]=i,n[t+1]=s}function Nu(n,t){return n[t]^n[t+1]<<8^n[t+2]<<16^n[t+3]<<24}function Ht(n,t,e,r,i,s){const o=pr[i],c=pr[i+1],l=pr[s],u=pr[s+1];Zr(W,n,t),tc(W,n,o,c);let h=W[r]^W[n],d=W[r+1]^W[n+1];W[r]=d,W[r+1]=h,Zr(W,e,r),h=W[t]^W[e],d=W[t+1]^W[e+1],W[t]=h>>>24^d<<8,W[t+1]=d>>>24^h<<8,Zr(W,n,t),tc(W,n,l,u),h=W[r]^W[n],d=W[r+1]^W[n+1],W[r]=h>>>16^d<<16,W[r+1]=d>>>16^h<<16,Zr(W,e,r),h=W[t]^W[e],d=W[t+1]^W[e+1],W[t]=d>>>31^h<<1,W[t+1]=h>>>31^d<<1}const Bu=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),Ww=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3],Le=new Uint8Array(Ww.map(function(n){return n*2})),W=new Uint32Array(32),pr=new Uint32Array(32);function qu(n,t){let e=0;for(e=0;e<16;e++)W[e]=n.h[e],W[e+16]=Bu[e];for(W[24]=W[24]^n.t,W[25]=W[25]^n.t/4294967296,t&&(W[28]=~W[28],W[29]=~W[29]),e=0;e<32;e++)pr[e]=Nu(n.b,4*e);for(e=0;e<12;e++)Ht(0,8,16,24,Le[e*16+0],Le[e*16+1]),Ht(2,10,18,26,Le[e*16+2],Le[e*16+3]),Ht(4,12,20,28,Le[e*16+4],Le[e*16+5]),Ht(6,14,22,30,Le[e*16+6],Le[e*16+7]),Ht(0,10,20,30,Le[e*16+8],Le[e*16+9]),Ht(2,12,22,24,Le[e*16+10],Le[e*16+11]),Ht(4,14,16,26,Le[e*16+12],Le[e*16+13]),Ht(6,8,18,28,Le[e*16+14],Le[e*16+15]);for(e=0;e<16;e++)n.h[e]=n.h[e]^W[e]^W[e+16]}const Wt=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);function Mu(n,t,e,r){if(n===0||n>64)throw new Error("Illegal output length, expected 0 < length <= 64");if(t&&t.length>64)throw new Error("Illegal key, expected Uint8Array with 0 < length <= 64");if(e&&e.length!==16)throw new Error("Illegal salt, expected Uint8Array with length is 16");if(r&&r.length!==16)throw new Error("Illegal personal, expected Uint8Array with length is 16");const i={b:new Uint8Array(128),h:new Uint32Array(16),t:0,c:0,outlen:n};Wt.fill(0),Wt[0]=n,t&&(Wt[1]=t.length),Wt[2]=1,Wt[3]=1,e&&Wt.set(e,32),r&&Wt.set(r,48);for(let s=0;s<16;s++)i.h[s]=Bu[s]^Nu(Wt,s*4);return t&&(Qo(i,t),i.c=128),i}function Qo(n,t){for(let e=0;e<t.length;e++)n.c===128&&(n.t+=n.c,qu(n,!1),n.c=0),n.b[n.c++]=t[e]}function zu(n){for(n.t+=n.c;n.c<128;)n.b[n.c++]=0;qu(n,!0);const t=new Uint8Array(n.outlen);for(let e=0;e<n.outlen;e++)t[e]=n.h[e>>2]>>8*(e&3);return t}function ju(n,t,e,r,i){e=e||64,n=oi.normalizeInput(n),r&&(r=oi.normalizeInput(r)),i&&(i=oi.normalizeInput(i));const s=Mu(e,t,r,i);return Qo(s,n),zu(s)}function Gw(n,t,e,r,i){const s=ju(n,t,e,r,i);return oi.toHex(s)}var Zw={blake2b:ju,blake2bHex:Gw,blake2bInit:Mu,blake2bUpdate:Qo,blake2bFinal:zu};const Ku=Uu;function Yw(n,t){return n[t]^n[t+1]<<8^n[t+2]<<16^n[t+3]<<24}function Gt(n,t,e,r,i,s){ee[n]=ee[n]+ee[t]+i,ee[r]=Yr(ee[r]^ee[n],16),ee[e]=ee[e]+ee[r],ee[t]=Yr(ee[t]^ee[e],12),ee[n]=ee[n]+ee[t]+s,ee[r]=Yr(ee[r]^ee[n],8),ee[e]=ee[e]+ee[r],ee[t]=Yr(ee[t]^ee[e],7)}function Yr(n,t){return n>>>t^n<<32-t}const Fu=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),xe=new Uint8Array([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0]),ee=new Uint32Array(16),Ie=new Uint32Array(16);function Hu(n,t){let e=0;for(e=0;e<8;e++)ee[e]=n.h[e],ee[e+8]=Fu[e];for(ee[12]^=n.t,ee[13]^=n.t/4294967296,t&&(ee[14]=~ee[14]),e=0;e<16;e++)Ie[e]=Yw(n.b,4*e);for(e=0;e<10;e++)Gt(0,4,8,12,Ie[xe[e*16+0]],Ie[xe[e*16+1]]),Gt(1,5,9,13,Ie[xe[e*16+2]],Ie[xe[e*16+3]]),Gt(2,6,10,14,Ie[xe[e*16+4]],Ie[xe[e*16+5]]),Gt(3,7,11,15,Ie[xe[e*16+6]],Ie[xe[e*16+7]]),Gt(0,5,10,15,Ie[xe[e*16+8]],Ie[xe[e*16+9]]),Gt(1,6,11,12,Ie[xe[e*16+10]],Ie[xe[e*16+11]]),Gt(2,7,8,13,Ie[xe[e*16+12]],Ie[xe[e*16+13]]),Gt(3,4,9,14,Ie[xe[e*16+14]],Ie[xe[e*16+15]]);for(e=0;e<8;e++)n.h[e]^=ee[e]^ee[e+8]}function Wu(n,t){if(!(n>0&&n<=32))throw new Error("Incorrect output length, should be in [1, 32]");const e=t?t.length:0;if(t&&!(e>0&&e<=32))throw new Error("Incorrect key length, should be in [1, 32]");const r={h:new Uint32Array(Fu),b:new Uint8Array(64),c:0,t:0,outlen:n};return r.h[0]^=16842752^e<<8^n,e>0&&(Xo(r,t),r.c=64),r}function Xo(n,t){for(let e=0;e<t.length;e++)n.c===64&&(n.t+=n.c,Hu(n,!1),n.c=0),n.b[n.c++]=t[e]}function Gu(n){for(n.t+=n.c;n.c<64;)n.b[n.c++]=0;Hu(n,!0);const t=new Uint8Array(n.outlen);for(let e=0;e<n.outlen;e++)t[e]=n.h[e>>2]>>8*(e&3)&255;return t}function Zu(n,t,e){e=e||32,n=Ku.normalizeInput(n);const r=Wu(e,t);return Xo(r,n),Gu(r)}function Jw(n,t,e){const r=Zu(n,t,e);return Ku.toHex(r)}var Qw={blake2s:Zu,blake2sHex:Jw,blake2sInit:Wu,blake2sUpdate:Xo,blake2sFinal:Gu};const nr=Zw,rr=Qw;var Xw={blake2b:nr.blake2b,blake2bHex:nr.blake2bHex,blake2bInit:nr.blake2bInit,blake2bUpdate:nr.blake2bUpdate,blake2bFinal:nr.blake2bFinal,blake2s:rr.blake2s,blake2sHex:rr.blake2sHex,blake2sInit:rr.blake2sInit,blake2sUpdate:rr.blake2sUpdate,blake2sFinal:rr.blake2sFinal},em={};const{recoverAddress:tm}=await Ro("viem"),nm=":";function ai(n){const[t,e]=n.split(nm);return{namespace:t,reference:e}}function Yu(n,t){return n.includes(":")?[n]:t.chains||[]}var rm=Object.defineProperty,im=Object.defineProperties,sm=Object.getOwnPropertyDescriptors,nc=Object.getOwnPropertySymbols,om=Object.prototype.hasOwnProperty,am=Object.prototype.propertyIsEnumerable,Hs=(n,t,e)=>t in n?rm(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,rc=(n,t)=>{for(var e in t||(t={}))om.call(t,e)&&Hs(n,e,t[e]);if(nc)for(var e of nc(t))am.call(t,e)&&Hs(n,e,t[e]);return n},cm=(n,t)=>im(n,sm(t)),ic=(n,t,e)=>Hs(n,typeof t!="symbol"?t+"":t,e);const lm="ReactNative",nt={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},um="js";function Ti(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}function hn(){return!zn()&&!!zl()&&navigator.product===lm}function hm(){return hn()&&typeof global<"u"&&typeof(global==null?void 0:global.Platform)<"u"&&(global==null?void 0:global.Platform.OS)==="android"}function dm(){return hn()&&typeof global<"u"&&typeof(global==null?void 0:global.Platform)<"u"&&(global==null?void 0:global.Platform.OS)==="ios"}function Yn(){return!Ti()&&!!zl()&&!!zn()}function Ur(){return hn()?nt.reactNative:Ti()?nt.node:Yn()?nt.browser:nt.unknown}function sc(){var n;try{return hn()&&typeof global<"u"&&typeof(global==null?void 0:global.Application)<"u"?(n=global.Application)==null?void 0:n.applicationId:void 0}catch{return}}function pm(n,t){const e=new URLSearchParams(n);for(const r of Object.keys(t).sort())if(t.hasOwnProperty(r)){const i=t[r];i!==void 0&&e.set(r,i)}return e.toString()}function fm(n){var t,e;const r=Ju();try{return n!=null&&n.url&&r.url&&new URL(n.url).host!==new URL(r.url).host&&(console.warn(`The configured WalletConnect 'metadata.url':${n.url} differs from the actual page url:${r.url}. This is probably unintended and can lead to issues.`),n.url=r.url),(t=n?.icons)!=null&&t.length&&n.icons.length>0&&(n.icons=n.icons.filter(i=>i!=="")),cm(rc(rc({},r),n),{url:n?.url||r.url,name:n?.name||r.name,description:n?.description||r.description,icons:(e=n?.icons)!=null&&e.length&&n.icons.length>0?n.icons:r.icons})}catch(i){return console.warn("Error populating app metadata",i),n||r}}function Ju(){return ip()||{name:"",description:"",url:"",icons:[""]}}function _m(){if(Ur()===nt.reactNative&&typeof global<"u"&&typeof(global==null?void 0:global.Platform)<"u"){const{OS:e,Version:r}=global.Platform;return[e,r].join("-")}const n=op();if(n===null)return"unknown";const t=n.os?n.os.replace(" ","").toLowerCase():"unknown";return n.type==="browser"?[t,n.name,n.version].join("-"):[t,n.version].join("-")}function wm(){var n;const t=Ur();return t===nt.browser?[t,((n=ap())==null?void 0:n.host)||"unknown"].join(":"):t}function Qu(n,t,e){const r=_m(),i=wm();return[[n,t].join("-"),[um,e].join("-"),r,i].join("/")}function mm({protocol:n,version:t,relayUrl:e,sdkVersion:r,auth:i,projectId:s,useOnCloseEvent:o,bundleId:c,packageName:l}){const u=e.split("?"),h=Qu(n,t,r),d={auth:i,ua:h,projectId:s,useOnCloseEvent:o,packageName:l||void 0,bundleId:c||void 0},p=pm(u[1]||"",d);return u[0]+"?"+p}function En(n,t){return n.filter(e=>t.includes(e)).length===n.length}function Ws(n){return Object.fromEntries(n.entries())}function Gs(n){return new Map(Object.entries(n))}function wn(n=M.FIVE_MINUTES,t){const e=M.toMiliseconds(n||M.FIVE_MINUTES);let r,i,s,o;return{resolve:c=>{s&&r&&(clearTimeout(s),r(c),o=Promise.resolve(c))},reject:c=>{s&&i&&(clearTimeout(s),i(c))},done:()=>new Promise((c,l)=>{if(o)return c(o);s=setTimeout(()=>{const u=new Error(t);o=Promise.reject(u),l(u)},e),r=c,i=l})}}function Dt(n,t,e){return new Promise(async(r,i)=>{const s=setTimeout(()=>i(new Error(e)),t);try{const o=await n;r(o)}catch(o){i(o)}clearTimeout(s)})}function Xu(n,t){if(typeof t=="string"&&t.startsWith(`${n}:`))return t;if(n.toLowerCase()==="topic"){if(typeof t!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${t}`}else if(n.toLowerCase()==="id"){if(typeof t!="number")throw new Error('Value must be "number" for expirer target type: id');return`id:${t}`}throw new Error(`Unknown expirer target type: ${n}`)}function ym(n){return Xu("topic",n)}function gm(n){return Xu("id",n)}function eh(n){const[t,e]=n.split(":"),r={id:void 0,topic:void 0};if(t==="topic"&&typeof e=="string")r.topic=e;else if(t==="id"&&Number.isInteger(Number(e)))r.id=Number(e);else throw new Error(`Invalid target, expected id:number or topic:string, got ${t}:${e}`);return r}function _e(n,t){return M.fromMiliseconds(Date.now()+M.toMiliseconds(n))}function rn(n){return Date.now()>=M.toMiliseconds(n)}function ne(n,t){return`${n}${t?`:${t}`:""}`}function Tn(n=[],t=[]){return[...new Set([...n,...t])]}async function Em({id:n,topic:t,wcDeepLink:e}){var r;try{if(!e)return;const i=typeof e=="string"?JSON.parse(e):e,s=i?.href;if(typeof s!="string")return;const o=vm(s,n,t),c=Ur();if(c===nt.browser){if(!((r=zn())!=null&&r.hasFocus())){console.warn("Document does not have focus, skipping deeplink.");return}bm(o)}else c===nt.reactNative&&typeof(global==null?void 0:global.Linking)<"u"&&await global.Linking.openURL(o)}catch(i){console.error(i)}}function vm(n,t,e){const r=`requestId=${t}&sessionTopic=${e}`;n.endsWith("/")&&(n=n.slice(0,-1));let i=`${n}`;if(n.startsWith("https://t.me")){const s=n.includes("?")?"&startapp=":"?startapp=";i=`${i}${s}${Pm(r,!0)}`}else i=`${i}/wc?${r}`;return i}function bm(n){let t="_self";Tm()?t="_top":(Am()||n.startsWith("https://")||n.startsWith("http://"))&&(t="_blank"),window.open(n,t,"noreferrer noopener")}async function Im(n,t){let e="";try{if(Yn()&&(e=localStorage.getItem(t),e))return e;e=await n.getItem(t)}catch(r){console.error(r)}return e}function oc(n,t){if(!n.includes(t))return null;const e=n.split(/([&,?,=])/),r=e.indexOf(t);return e[r+2]}function ac(){return typeof crypto<"u"&&crypto!=null&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu,n=>{const t=Math.random()*16|0;return(n==="x"?t:t&3|8).toString(16)})}function ea(){return typeof process<"u"&&em.IS_VITEST==="true"}function Am(){return typeof window<"u"&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)}function Tm(){try{return window.self!==window.top}catch{return!1}}function Pm(n,t=!1){const e=Buffer.from(n).toString("base64");return t?e.replace(/[=]/g,""):e}function th(n){return Buffer.from(n,"base64").toString("utf-8")}function Om(n){return new Promise(t=>setTimeout(t,n))}let Rm=class{constructor({limit:t}){ic(this,"limit"),ic(this,"set"),this.limit=t,this.set=new Set}add(t){if(!this.set.has(t)){if(this.set.size>=this.limit){const e=this.set.values().next().value;e&&this.set.delete(e)}this.set.add(t)}}has(t){return this.set.has(t)}};const Jr=BigInt(2**32-1),cc=BigInt(32);function nh(n,t=!1){return t?{h:Number(n&Jr),l:Number(n>>cc&Jr)}:{h:Number(n>>cc&Jr)|0,l:Number(n&Jr)|0}}function rh(n,t=!1){const e=n.length;let r=new Uint32Array(e),i=new Uint32Array(e);for(let s=0;s<e;s++){const{h:o,l:c}=nh(n[s],t);[r[s],i[s]]=[o,c]}return[r,i]}const lc=(n,t,e)=>n>>>e,uc=(n,t,e)=>n<<32-e|t>>>e,sn=(n,t,e)=>n>>>e|t<<32-e,on=(n,t,e)=>n<<32-e|t>>>e,fr=(n,t,e)=>n<<64-e|t>>>e-32,_r=(n,t,e)=>n>>>e-32|t<<64-e,Dm=(n,t)=>t,Lm=(n,t)=>n,xm=(n,t,e)=>n<<e|t>>>32-e,Vm=(n,t,e)=>t<<e|n>>>32-e,Sm=(n,t,e)=>t<<e-32|n>>>64-e,Cm=(n,t,e)=>n<<e-32|t>>>64-e;function _t(n,t,e,r){const i=(t>>>0)+(r>>>0);return{h:n+e+(i/2**32|0)|0,l:i|0}}const ta=(n,t,e)=>(n>>>0)+(t>>>0)+(e>>>0),na=(n,t,e,r)=>t+e+r+(n/2**32|0)|0,$m=(n,t,e,r)=>(n>>>0)+(t>>>0)+(e>>>0)+(r>>>0),km=(n,t,e,r,i)=>t+e+r+i+(n/2**32|0)|0,Um=(n,t,e,r,i)=>(n>>>0)+(t>>>0)+(e>>>0)+(r>>>0)+(i>>>0),Nm=(n,t,e,r,i,s)=>t+e+r+i+s+(n/2**32|0)|0,$n=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;function ra(n){return n instanceof Uint8Array||ArrayBuffer.isView(n)&&n.constructor.name==="Uint8Array"}function zt(n){if(!Number.isSafeInteger(n)||n<0)throw new Error("positive integer expected, got "+n)}function ht(n,...t){if(!ra(n))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(n.length))throw new Error("Uint8Array expected of length "+t+", got length="+n.length)}function ia(n){if(typeof n!="function"||typeof n.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");zt(n.outputLen),zt(n.blockLen)}function un(n,t=!0){if(n.destroyed)throw new Error("Hash instance has been destroyed");if(t&&n.finished)throw new Error("Hash#digest() has already been called")}function sa(n,t){ht(n);const e=t.outputLen;if(n.length<e)throw new Error("digestInto() expects output buffer of length at least "+e)}function Dr(n){return new Uint32Array(n.buffer,n.byteOffset,Math.floor(n.byteLength/4))}function dt(...n){for(let t=0;t<n.length;t++)n[t].fill(0)}function ls(n){return new DataView(n.buffer,n.byteOffset,n.byteLength)}function It(n,t){return n<<32-t|n>>>t}const ih=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function sh(n){return n<<24&4278190080|n<<8&16711680|n>>>8&65280|n>>>24&255}const $t=ih?n=>n:n=>sh(n);function Bm(n){for(let t=0;t<n.length;t++)n[t]=sh(n[t]);return n}const an=ih?n=>n:Bm,oh=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",qm=Array.from({length:256},(n,t)=>t.toString(16).padStart(2,"0"));function Lr(n){if(ht(n),oh)return n.toHex();let t="";for(let e=0;e<n.length;e++)t+=qm[n[e]];return t}const St={_0:48,_9:57,A:65,F:70,a:97,f:102};function hc(n){if(n>=St._0&&n<=St._9)return n-St._0;if(n>=St.A&&n<=St.F)return n-(St.A-10);if(n>=St.a&&n<=St.f)return n-(St.a-10)}function oa(n){if(typeof n!="string")throw new Error("hex string expected, got "+typeof n);if(oh)return Uint8Array.fromHex(n);const t=n.length,e=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);const r=new Uint8Array(e);for(let i=0,s=0;i<e;i++,s+=2){const o=hc(n.charCodeAt(s)),c=hc(n.charCodeAt(s+1));if(o===void 0||c===void 0){const l=n[s]+n[s+1];throw new Error('hex string expected, got non-hex character "'+l+'" at index '+s)}r[i]=o*16+c}return r}function Mm(n){if(typeof n!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(n))}function yt(n){return typeof n=="string"&&(n=Mm(n)),ht(n),n}function vn(...n){let t=0;for(let r=0;r<n.length;r++){const i=n[r];ht(i),t+=i.length}const e=new Uint8Array(t);for(let r=0,i=0;r<n.length;r++){const s=n[r];e.set(s,i),i+=s.length}return e}class Ni{}function Nr(n){const t=r=>n().update(yt(r)).digest(),e=n();return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=()=>n(),t}function zm(n){const t=(r,i)=>n(i).update(yt(r)).digest(),e=n({});return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=r=>n(r),t}function Jn(n=32){if($n&&typeof $n.getRandomValues=="function")return $n.getRandomValues(new Uint8Array(n));if($n&&typeof $n.randomBytes=="function")return Uint8Array.from($n.randomBytes(n));throw new Error("crypto.getRandomValues must be defined")}const jm=BigInt(0),ir=BigInt(1),Km=BigInt(2),Fm=BigInt(7),Hm=BigInt(256),Wm=BigInt(113),ah=[],ch=[],lh=[];for(let n=0,t=ir,e=1,r=0;n<24;n++){[e,r]=[r,(2*e+3*r)%5],ah.push(2*(5*r+e)),ch.push((n+1)*(n+2)/2%64);let i=jm;for(let s=0;s<7;s++)t=(t<<ir^(t>>Fm)*Wm)%Hm,t&Km&&(i^=ir<<(ir<<BigInt(s))-ir);lh.push(i)}const uh=rh(lh,!0),Gm=uh[0],Zm=uh[1],dc=(n,t,e)=>e>32?Sm(n,t,e):xm(n,t,e),pc=(n,t,e)=>e>32?Cm(n,t,e):Vm(n,t,e);function Ym(n,t=24){const e=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let o=0;o<10;o++)e[o]=n[o]^n[o+10]^n[o+20]^n[o+30]^n[o+40];for(let o=0;o<10;o+=2){const c=(o+8)%10,l=(o+2)%10,u=e[l],h=e[l+1],d=dc(u,h,1)^e[c],p=pc(u,h,1)^e[c+1];for(let f=0;f<50;f+=10)n[o+f]^=d,n[o+f+1]^=p}let i=n[2],s=n[3];for(let o=0;o<24;o++){const c=ch[o],l=dc(i,s,c),u=pc(i,s,c),h=ah[o];i=n[h],s=n[h+1],n[h]=l,n[h+1]=u}for(let o=0;o<50;o+=10){for(let c=0;c<10;c++)e[c]=n[o+c];for(let c=0;c<10;c++)n[o+c]^=~e[(c+2)%10]&e[(c+4)%10]}n[0]^=Gm[r],n[1]^=Zm[r]}dt(e)}let Jm=class hh extends Ni{constructor(t,e,r,i=!1,s=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=t,this.suffix=e,this.outputLen=r,this.enableXOF=i,this.rounds=s,zt(r),!(0<t&&t<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=Dr(this.state)}clone(){return this._cloneInto()}keccak(){an(this.state32),Ym(this.state32,this.rounds),an(this.state32),this.posOut=0,this.pos=0}update(t){un(this),t=yt(t),ht(t);const{blockLen:e,state:r}=this,i=t.length;for(let s=0;s<i;){const o=Math.min(e-this.pos,i-s);for(let c=0;c<o;c++)r[this.pos++]^=t[s++];this.pos===e&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:t,suffix:e,pos:r,blockLen:i}=this;t[r]^=e,e&128&&r===i-1&&this.keccak(),t[i-1]^=128,this.keccak()}writeInto(t){un(this,!1),ht(t),this.finish();const e=this.state,{blockLen:r}=this;for(let i=0,s=t.length;i<s;){this.posOut>=r&&this.keccak();const o=Math.min(r-this.posOut,s-i);t.set(e.subarray(this.posOut,this.posOut+o),i),this.posOut+=o,i+=o}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return zt(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(sa(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,dt(this.state)}_cloneInto(t){const{blockLen:e,suffix:r,outputLen:i,rounds:s,enableXOF:o}=this;return t||(t=new hh(e,r,i,o,s)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=s,t.suffix=r,t.outputLen=i,t.enableXOF=o,t.destroyed=this.destroyed,t}};const Qm=(n,t,e)=>Nr(()=>new Jm(t,n,e)),Xm=Qm(1,136,256/8);function ey(n,t,e,r){if(typeof n.setBigUint64=="function")return n.setBigUint64(t,e,r);const i=BigInt(32),s=BigInt(4294967295),o=Number(e>>i&s),c=Number(e&s),l=r?4:0,u=r?0:4;n.setUint32(t+l,o,r),n.setUint32(t+u,c,r)}function ty(n,t,e){return n&t^~n&e}function ny(n,t,e){return n&t^n&e^t&e}let dh=class extends Ni{constructor(t,e,r,i){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=t,this.outputLen=e,this.padOffset=r,this.isLE=i,this.buffer=new Uint8Array(t),this.view=ls(this.buffer)}update(t){un(this),t=yt(t),ht(t);const{view:e,buffer:r,blockLen:i}=this,s=t.length;for(let o=0;o<s;){const c=Math.min(i-this.pos,s-o);if(c===i){const l=ls(t);for(;i<=s-o;o+=i)this.process(l,o);continue}r.set(t.subarray(o,o+c),this.pos),this.pos+=c,o+=c,this.pos===i&&(this.process(e,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){un(this),sa(t,this),this.finished=!0;const{buffer:e,view:r,blockLen:i,isLE:s}=this;let{pos:o}=this;e[o++]=128,dt(this.buffer.subarray(o)),this.padOffset>i-o&&(this.process(r,0),o=0);for(let d=o;d<i;d++)e[d]=0;ey(r,i-8,BigInt(this.length*8),s),this.process(r,0);const c=ls(t),l=this.outputLen;if(l%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const u=l/4,h=this.get();if(u>h.length)throw new Error("_sha2: outputLen bigger than state");for(let d=0;d<u;d++)c.setUint32(4*d,h[d],s)}digest(){const{buffer:t,outputLen:e}=this;this.digestInto(t);const r=t.slice(0,e);return this.destroy(),r}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:e,buffer:r,length:i,finished:s,destroyed:o,pos:c}=this;return t.destroyed=o,t.finished=s,t.length=i,t.pos=c,i%e&&t.buffer.set(r),t}clone(){return this._cloneInto()}};const Zt=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Ve=Uint32Array.from([3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]),Se=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209]),ry=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]),Yt=new Uint32Array(64);let iy=class extends dh{constructor(t=32){super(64,t,8,!1),this.A=Zt[0]|0,this.B=Zt[1]|0,this.C=Zt[2]|0,this.D=Zt[3]|0,this.E=Zt[4]|0,this.F=Zt[5]|0,this.G=Zt[6]|0,this.H=Zt[7]|0}get(){const{A:t,B:e,C:r,D:i,E:s,F:o,G:c,H:l}=this;return[t,e,r,i,s,o,c,l]}set(t,e,r,i,s,o,c,l){this.A=t|0,this.B=e|0,this.C=r|0,this.D=i|0,this.E=s|0,this.F=o|0,this.G=c|0,this.H=l|0}process(t,e){for(let d=0;d<16;d++,e+=4)Yt[d]=t.getUint32(e,!1);for(let d=16;d<64;d++){const p=Yt[d-15],f=Yt[d-2],w=It(p,7)^It(p,18)^p>>>3,m=It(f,17)^It(f,19)^f>>>10;Yt[d]=m+Yt[d-7]+w+Yt[d-16]|0}let{A:r,B:i,C:s,D:o,E:c,F:l,G:u,H:h}=this;for(let d=0;d<64;d++){const p=It(c,6)^It(c,11)^It(c,25),f=h+p+ty(c,l,u)+ry[d]+Yt[d]|0,w=(It(r,2)^It(r,13)^It(r,22))+ny(r,i,s)|0;h=u,u=l,l=c,c=o+f|0,o=s,s=i,i=r,r=f+w|0}r=r+this.A|0,i=i+this.B|0,s=s+this.C|0,o=o+this.D|0,c=c+this.E|0,l=l+this.F|0,u=u+this.G|0,h=h+this.H|0,this.set(r,i,s,o,c,l,u,h)}roundClean(){dt(Yt)}destroy(){this.set(0,0,0,0,0,0,0,0),dt(this.buffer)}};const ph=rh(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(n=>BigInt(n))),sy=ph[0],oy=ph[1],Jt=new Uint32Array(80),Qt=new Uint32Array(80);let aa=class extends dh{constructor(t=64){super(128,t,16,!1),this.Ah=Se[0]|0,this.Al=Se[1]|0,this.Bh=Se[2]|0,this.Bl=Se[3]|0,this.Ch=Se[4]|0,this.Cl=Se[5]|0,this.Dh=Se[6]|0,this.Dl=Se[7]|0,this.Eh=Se[8]|0,this.El=Se[9]|0,this.Fh=Se[10]|0,this.Fl=Se[11]|0,this.Gh=Se[12]|0,this.Gl=Se[13]|0,this.Hh=Se[14]|0,this.Hl=Se[15]|0}get(){const{Ah:t,Al:e,Bh:r,Bl:i,Ch:s,Cl:o,Dh:c,Dl:l,Eh:u,El:h,Fh:d,Fl:p,Gh:f,Gl:w,Hh:m,Hl:_}=this;return[t,e,r,i,s,o,c,l,u,h,d,p,f,w,m,_]}set(t,e,r,i,s,o,c,l,u,h,d,p,f,w,m,_){this.Ah=t|0,this.Al=e|0,this.Bh=r|0,this.Bl=i|0,this.Ch=s|0,this.Cl=o|0,this.Dh=c|0,this.Dl=l|0,this.Eh=u|0,this.El=h|0,this.Fh=d|0,this.Fl=p|0,this.Gh=f|0,this.Gl=w|0,this.Hh=m|0,this.Hl=_|0}process(t,e){for(let g=0;g<16;g++,e+=4)Jt[g]=t.getUint32(e),Qt[g]=t.getUint32(e+=4);for(let g=16;g<80;g++){const I=Jt[g-15]|0,b=Qt[g-15]|0,L=sn(I,b,1)^sn(I,b,8)^lc(I,b,7),x=on(I,b,1)^on(I,b,8)^uc(I,b,7),S=Jt[g-2]|0,y=Qt[g-2]|0,D=sn(S,y,19)^fr(S,y,61)^lc(S,y,6),T=on(S,y,19)^_r(S,y,61)^uc(S,y,6),O=$m(x,T,Qt[g-7],Qt[g-16]),C=km(O,L,D,Jt[g-7],Jt[g-16]);Jt[g]=C|0,Qt[g]=O|0}let{Ah:r,Al:i,Bh:s,Bl:o,Ch:c,Cl:l,Dh:u,Dl:h,Eh:d,El:p,Fh:f,Fl:w,Gh:m,Gl:_,Hh:E,Hl:v}=this;for(let g=0;g<80;g++){const I=sn(d,p,14)^sn(d,p,18)^fr(d,p,41),b=on(d,p,14)^on(d,p,18)^_r(d,p,41),L=d&f^~d&m,x=p&w^~p&_,S=Um(v,b,x,oy[g],Qt[g]),y=Nm(S,E,I,L,sy[g],Jt[g]),D=S|0,T=sn(r,i,28)^fr(r,i,34)^fr(r,i,39),O=on(r,i,28)^_r(r,i,34)^_r(r,i,39),C=r&s^r&c^s&c,A=i&o^i&l^o&l;E=m|0,v=_|0,m=f|0,_=w|0,f=d|0,w=p|0,{h:d,l:p}=_t(u|0,h|0,y|0,D|0),u=c|0,h=l|0,c=s|0,l=o|0,s=r|0,o=i|0;const P=ta(D,O,A);r=na(P,y,T,C),i=P|0}({h:r,l:i}=_t(this.Ah|0,this.Al|0,r|0,i|0)),{h:s,l:o}=_t(this.Bh|0,this.Bl|0,s|0,o|0),{h:c,l}=_t(this.Ch|0,this.Cl|0,c|0,l|0),{h:u,l:h}=_t(this.Dh|0,this.Dl|0,u|0,h|0),{h:d,l:p}=_t(this.Eh|0,this.El|0,d|0,p|0),{h:f,l:w}=_t(this.Fh|0,this.Fl|0,f|0,w|0),{h:m,l:_}=_t(this.Gh|0,this.Gl|0,m|0,_|0),{h:E,l:v}=_t(this.Hh|0,this.Hl|0,E|0,v|0),this.set(r,i,s,o,c,l,u,h,d,p,f,w,m,_,E,v)}roundClean(){dt(Jt,Qt)}destroy(){dt(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}},ay=class extends aa{constructor(){super(48),this.Ah=Ve[0]|0,this.Al=Ve[1]|0,this.Bh=Ve[2]|0,this.Bl=Ve[3]|0,this.Ch=Ve[4]|0,this.Cl=Ve[5]|0,this.Dh=Ve[6]|0,this.Dl=Ve[7]|0,this.Eh=Ve[8]|0,this.El=Ve[9]|0,this.Fh=Ve[10]|0,this.Fl=Ve[11]|0,this.Gh=Ve[12]|0,this.Gl=Ve[13]|0,this.Hh=Ve[14]|0,this.Hl=Ve[15]|0}};const Ce=Uint32Array.from([573645204,4230739756,2673172387,3360449730,596883563,1867755857,2520282905,1497426621,2519219938,2827943907,3193839141,1401305490,721525244,746961066,246885852,2177182882]);class cy extends aa{constructor(){super(32),this.Ah=Ce[0]|0,this.Al=Ce[1]|0,this.Bh=Ce[2]|0,this.Bl=Ce[3]|0,this.Ch=Ce[4]|0,this.Cl=Ce[5]|0,this.Dh=Ce[6]|0,this.Dl=Ce[7]|0,this.Eh=Ce[8]|0,this.El=Ce[9]|0,this.Fh=Ce[10]|0,this.Fl=Ce[11]|0,this.Gh=Ce[12]|0,this.Gl=Ce[13]|0,this.Hh=Ce[14]|0,this.Hl=Ce[15]|0}}const Bi=Nr(()=>new iy),ly=Nr(()=>new aa),uy=Nr(()=>new ay),hy=Nr(()=>new cy),dy=Uint8Array.from([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9]),fe=Uint32Array.from([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),z=new Uint32Array(32);function Xt(n,t,e,r,i,s){const o=i[s],c=i[s+1];let l=z[2*n],u=z[2*n+1],h=z[2*t],d=z[2*t+1],p=z[2*e],f=z[2*e+1],w=z[2*r],m=z[2*r+1],_=ta(l,h,o);u=na(_,u,d,c),l=_|0,{Dh:m,Dl:w}={Dh:m^u,Dl:w^l},{Dh:m,Dl:w}={Dh:Dm(m,w),Dl:Lm(m)},{h:f,l:p}=_t(f,p,m,w),{Bh:d,Bl:h}={Bh:d^f,Bl:h^p},{Bh:d,Bl:h}={Bh:sn(d,h,24),Bl:on(d,h,24)},z[2*n]=l,z[2*n+1]=u,z[2*t]=h,z[2*t+1]=d,z[2*e]=p,z[2*e+1]=f,z[2*r]=w,z[2*r+1]=m}function en(n,t,e,r,i,s){const o=i[s],c=i[s+1];let l=z[2*n],u=z[2*n+1],h=z[2*t],d=z[2*t+1],p=z[2*e],f=z[2*e+1],w=z[2*r],m=z[2*r+1],_=ta(l,h,o);u=na(_,u,d,c),l=_|0,{Dh:m,Dl:w}={Dh:m^u,Dl:w^l},{Dh:m,Dl:w}={Dh:sn(m,w,16),Dl:on(m,w,16)},{h:f,l:p}=_t(f,p,m,w),{Bh:d,Bl:h}={Bh:d^f,Bl:h^p},{Bh:d,Bl:h}={Bh:fr(d,h,63),Bl:_r(d,h,63)},z[2*n]=l,z[2*n+1]=u,z[2*t]=h,z[2*t+1]=d,z[2*e]=p,z[2*e+1]=f,z[2*r]=w,z[2*r+1]=m}function py(n,t={},e,r,i){if(zt(e),n<0||n>e)throw new Error("outputLen bigger than keyLen");const{key:s,salt:o,personalization:c}=t;if(s!==void 0&&(s.length<1||s.length>e))throw new Error("key length must be undefined or 1.."+e);if(o!==void 0&&o.length!==r)throw new Error("salt must be undefined or "+r);if(c!==void 0&&c.length!==i)throw new Error("personalization must be undefined or "+i)}class fy extends Ni{constructor(t,e){super(),this.finished=!1,this.destroyed=!1,this.length=0,this.pos=0,zt(t),zt(e),this.blockLen=t,this.outputLen=e,this.buffer=new Uint8Array(t),this.buffer32=Dr(this.buffer)}update(t){un(this),t=yt(t),ht(t);const{blockLen:e,buffer:r,buffer32:i}=this,s=t.length,o=t.byteOffset,c=t.buffer;for(let l=0;l<s;){this.pos===e&&(an(i),this.compress(i,0,!1),an(i),this.pos=0);const u=Math.min(e-this.pos,s-l),h=o+l;if(u===e&&!(h%4)&&l+u<s){const d=new Uint32Array(c,h,Math.floor((s-l)/4));an(d);for(let p=0;l+e<s;p+=i.length,l+=e)this.length+=e,this.compress(d,p,!1);an(d);continue}r.set(t.subarray(l,l+u),this.pos),this.pos+=u,this.length+=u,l+=u}return this}digestInto(t){un(this),sa(t,this);const{pos:e,buffer32:r}=this;this.finished=!0,dt(this.buffer.subarray(e)),an(r),this.compress(r,0,!0),an(r);const i=Dr(t);this.get().forEach((s,o)=>i[o]=$t(s))}digest(){const{buffer:t,outputLen:e}=this;this.digestInto(t);const r=t.slice(0,e);return this.destroy(),r}_cloneInto(t){const{buffer:e,length:r,finished:i,destroyed:s,outputLen:o,pos:c}=this;return t||(t=new this.constructor({dkLen:o})),t.set(...this.get()),t.buffer.set(e),t.destroyed=s,t.finished=i,t.length=r,t.pos=c,t.outputLen=o,t}clone(){return this._cloneInto()}}class _y extends fy{constructor(t={}){const e=t.dkLen===void 0?64:t.dkLen;super(128,e),this.v0l=fe[0]|0,this.v0h=fe[1]|0,this.v1l=fe[2]|0,this.v1h=fe[3]|0,this.v2l=fe[4]|0,this.v2h=fe[5]|0,this.v3l=fe[6]|0,this.v3h=fe[7]|0,this.v4l=fe[8]|0,this.v4h=fe[9]|0,this.v5l=fe[10]|0,this.v5h=fe[11]|0,this.v6l=fe[12]|0,this.v6h=fe[13]|0,this.v7l=fe[14]|0,this.v7h=fe[15]|0,py(e,t,64,16,16);let{key:r,personalization:i,salt:s}=t,o=0;if(r!==void 0&&(r=yt(r),o=r.length),this.v0l^=this.outputLen|o<<8|65536|1<<24,s!==void 0){s=yt(s);const c=Dr(s);this.v4l^=$t(c[0]),this.v4h^=$t(c[1]),this.v5l^=$t(c[2]),this.v5h^=$t(c[3])}if(i!==void 0){i=yt(i);const c=Dr(i);this.v6l^=$t(c[0]),this.v6h^=$t(c[1]),this.v7l^=$t(c[2]),this.v7h^=$t(c[3])}if(r!==void 0){const c=new Uint8Array(this.blockLen);c.set(r),this.update(c)}}get(){let{v0l:t,v0h:e,v1l:r,v1h:i,v2l:s,v2h:o,v3l:c,v3h:l,v4l:u,v4h:h,v5l:d,v5h:p,v6l:f,v6h:w,v7l:m,v7h:_}=this;return[t,e,r,i,s,o,c,l,u,h,d,p,f,w,m,_]}set(t,e,r,i,s,o,c,l,u,h,d,p,f,w,m,_){this.v0l=t|0,this.v0h=e|0,this.v1l=r|0,this.v1h=i|0,this.v2l=s|0,this.v2h=o|0,this.v3l=c|0,this.v3h=l|0,this.v4l=u|0,this.v4h=h|0,this.v5l=d|0,this.v5h=p|0,this.v6l=f|0,this.v6h=w|0,this.v7l=m|0,this.v7h=_|0}compress(t,e,r){this.get().forEach((l,u)=>z[u]=l),z.set(fe,16);let{h:i,l:s}=nh(BigInt(this.length));z[24]=fe[8]^s,z[25]=fe[9]^i,r&&(z[28]=~z[28],z[29]=~z[29]);let o=0;const c=dy;for(let l=0;l<12;l++)Xt(0,4,8,12,t,e+2*c[o++]),en(0,4,8,12,t,e+2*c[o++]),Xt(1,5,9,13,t,e+2*c[o++]),en(1,5,9,13,t,e+2*c[o++]),Xt(2,6,10,14,t,e+2*c[o++]),en(2,6,10,14,t,e+2*c[o++]),Xt(3,7,11,15,t,e+2*c[o++]),en(3,7,11,15,t,e+2*c[o++]),Xt(0,5,10,15,t,e+2*c[o++]),en(0,5,10,15,t,e+2*c[o++]),Xt(1,6,11,12,t,e+2*c[o++]),en(1,6,11,12,t,e+2*c[o++]),Xt(2,7,8,13,t,e+2*c[o++]),en(2,7,8,13,t,e+2*c[o++]),Xt(3,4,9,14,t,e+2*c[o++]),en(3,4,9,14,t,e+2*c[o++]);this.v0l^=z[0]^z[16],this.v0h^=z[1]^z[17],this.v1l^=z[2]^z[18],this.v1h^=z[3]^z[19],this.v2l^=z[4]^z[20],this.v2h^=z[5]^z[21],this.v3l^=z[6]^z[22],this.v3h^=z[7]^z[23],this.v4l^=z[8]^z[24],this.v4h^=z[9]^z[25],this.v5l^=z[10]^z[26],this.v5h^=z[11]^z[27],this.v6l^=z[12]^z[28],this.v6h^=z[13]^z[29],this.v7l^=z[14]^z[30],this.v7h^=z[15]^z[31],dt(z)}destroy(){this.destroyed=!0,dt(this.buffer32),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const wy=zm(n=>new _y(n)),my="https://rpc.walletconnect.org/v1";function fh(n){const t=`Ethereum Signed Message:
6
+ ${n.length}`,e=new TextEncoder().encode(t+n);return"0x"+Buffer.from(Xm(e)).toString("hex")}async function yy(n,t,e,r,i,s){switch(e.t){case"eip191":return await gy(n,t,e.s);case"eip1271":return await Ey(n,t,e.s,r,i,s);default:throw new Error(`verifySignature failed: Attempted to verify CacaoSignature with unknown type: ${e.t}`)}}async function gy(n,t,e){return(await tm({hash:fh(t),signature:e})).toLowerCase()===n.toLowerCase()}async function Ey(n,t,e,r,i,s){const o=ai(r);if(!o.namespace||!o.reference)throw new Error(`isValidEip1271Signature failed: chainId must be in CAIP-2 format, received: ${r}`);try{const c="0x1626ba7e",l="0000000000000000000000000000000000000000000000000000000000000040",u=e.substring(2),h=(u.length/2).toString(16).padStart(64,"0"),d=(t.startsWith("0x")?t:fh(t)).substring(2),p=c+d+l+h+u,f=await fetch(`${s||my}/?chainId=${r}&projectId=${i}`,{headers:{"Content-Type":"application/json"},method:"POST",body:JSON.stringify({id:vy(),jsonrpc:"2.0",method:"eth_call",params:[{to:n,data:p},"latest"]})}),{result:w}=await f.json();return w?w.slice(0,c.length).toLowerCase()===c.toLowerCase():!1}catch(c){return console.error("isValidEip1271Signature: ",c),!1}}function vy(){return Date.now()+Math.floor(Math.random()*1e3)}function by(n){const t=atob(n),e=new Uint8Array(t.length);for(let o=0;o<t.length;o++)e[o]=t.charCodeAt(o);const r=e[0];if(r===0)throw new Error("No signatures found");const i=1+r*64;if(e.length<i)throw new Error("Transaction data too short for claimed signature count");if(e.length<100)throw new Error("Transaction too short");const s=Buffer.from(n,"base64").slice(1,65);return kr.encode(s)}function Iy(n){const t=new Uint8Array(Buffer.from(n,"base64")),e=Array.from("TransactionData::").map(s=>s.charCodeAt(0)),r=new Uint8Array(e.length+t.length);r.set(e),r.set(t,e.length);const i=wy(r,{dkLen:32});return kr.encode(i)}function fc(n){const t=new Uint8Array(Bi(Ay(n)));return kr.encode(t)}function Ay(n){if(n instanceof Uint8Array)return n;if(Array.isArray(n))return new Uint8Array(n);if(typeof n=="object"&&n!=null&&n.data)return new Uint8Array(Object.values(n.data));if(typeof n=="object"&&n)return new Uint8Array(Object.values(n));throw new Error("getNearUint8ArrayFromBytes: Unexpected result type from bytes array")}function _c(n){const t=Buffer.from(n,"base64"),e=Sw(t).txn;if(!e)throw new Error("Invalid signed transaction: missing 'txn' field");const r=Tw(e),i=Buffer.from("TX"),s=Buffer.concat([i,Buffer.from(r)]),o=hy(s);return Mw.encode(o).replace(/=+$/,"")}function us(n){const t=[];let e=BigInt(n);for(;e>=BigInt(128);)t.push(Number(e&BigInt(127)|BigInt(128))),e>>=BigInt(7);return t.push(Number(e)),Buffer.from(t)}function Ty(n){const t=Buffer.from(n.signed.bodyBytes,"base64"),e=Buffer.from(n.signed.authInfoBytes,"base64"),r=Buffer.from(n.signature.signature,"base64"),i=[];i.push(Buffer.from([10])),i.push(us(t.length)),i.push(t),i.push(Buffer.from([18])),i.push(us(e.length)),i.push(e),i.push(Buffer.from([26])),i.push(us(r.length)),i.push(r);const s=Buffer.concat(i),o=Bi(s);return Buffer.from(o).toString("hex").toUpperCase()}var Py=Object.defineProperty,Oy=Object.defineProperties,Ry=Object.getOwnPropertyDescriptors,wc=Object.getOwnPropertySymbols,Dy=Object.prototype.hasOwnProperty,Ly=Object.prototype.propertyIsEnumerable,mc=(n,t,e)=>t in n?Py(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,xy=(n,t)=>{for(var e in t||(t={}))Dy.call(t,e)&&mc(n,e,t[e]);if(wc)for(var e of wc(t))Ly.call(t,e)&&mc(n,e,t[e]);return n},Vy=(n,t)=>Oy(n,Ry(t));const Sy="did:pkh:",ca=n=>n?.split(":"),Cy=n=>{const t=n&&ca(n);if(t)return n.includes(Sy)?t[3]:t[1]},Zs=n=>{const t=n&&ca(n);if(t)return t[2]+":"+t[3]},Pi=n=>{const t=n&&ca(n);if(t)return t.pop()};async function yc(n){const{cacao:t,projectId:e}=n,{s:r,p:i}=t,s=_h(i,i.iss),o=Pi(i.iss);return await yy(o,s,r,Zs(i.iss),e)}const _h=(n,t)=>{const e=`${n.domain} wants you to sign in with your Ethereum account:`,r=Pi(t);if(!n.aud&&!n.uri)throw new Error("Either `aud` or `uri` is required to construct the message");let i=n.statement||void 0;const s=`URI: ${n.aud||n.uri}`,o=`Version: ${n.version}`,c=`Chain ID: ${Cy(t)}`,l=`Nonce: ${n.nonce}`,u=`Issued At: ${n.iat}`,h=n.exp?`Expiration Time: ${n.exp}`:void 0,d=n.nbf?`Not Before: ${n.nbf}`:void 0,p=n.requestId?`Request ID: ${n.requestId}`:void 0,f=n.resources?`Resources:${n.resources.map(m=>`
7
+ - ${m}`).join("")}`:void 0,w=ci(n.resources);if(w){const m=xr(w);i=jy(i,m)}return[e,r,"",i,"",s,o,c,l,u,h,d,p,f].filter(m=>m!=null).join(`
8
+ `)};function $y(n){return Buffer.from(JSON.stringify(n)).toString("base64")}function ky(n){return JSON.parse(Buffer.from(n,"base64").toString("utf-8"))}function On(n){if(!n)throw new Error("No recap provided, value is undefined");if(!n.att)throw new Error("No `att` property found");const t=Object.keys(n.att);if(!(t!=null&&t.length))throw new Error("No resources found in `att` property");t.forEach(e=>{const r=n.att[e];if(Array.isArray(r))throw new Error(`Resource must be an object: ${e}`);if(typeof r!="object")throw new Error(`Resource must be an object: ${e}`);if(!Object.keys(r).length)throw new Error(`Resource object is empty: ${e}`);Object.keys(r).forEach(i=>{const s=r[i];if(!Array.isArray(s))throw new Error(`Ability limits ${i} must be an array of objects, found: ${s}`);if(!s.length)throw new Error(`Value of ${i} is empty array, must be an array with objects`);s.forEach(o=>{if(typeof o!="object")throw new Error(`Ability limits (${i}) must be an array of objects, found: ${o}`)})})})}function Uy(n,t,e,r={}){return e?.sort((i,s)=>i.localeCompare(s)),{att:{[n]:Ny(t,e,r)}}}function Ny(n,t,e={}){t=t?.sort((i,s)=>i.localeCompare(s));const r=t.map(i=>({[`${n}/${i}`]:[e]}));return Object.assign({},...r)}function wh(n){return On(n),`urn:recap:${$y(n).replace(/=/g,"")}`}function xr(n){const t=ky(n.replace("urn:recap:",""));return On(t),t}function By(n,t,e){const r=Uy(n,t,e);return wh(r)}function qy(n){return n&&n.includes("urn:recap:")}function My(n,t){const e=xr(n),r=xr(t),i=zy(e,r);return wh(i)}function zy(n,t){On(n),On(t);const e=Object.keys(n.att).concat(Object.keys(t.att)).sort((i,s)=>i.localeCompare(s)),r={att:{}};return e.forEach(i=>{var s,o;Object.keys(((s=n.att)==null?void 0:s[i])||{}).concat(Object.keys(((o=t.att)==null?void 0:o[i])||{})).sort((c,l)=>c.localeCompare(l)).forEach(c=>{var l,u;r.att[i]=Vy(xy({},r.att[i]),{[c]:((l=n.att[i])==null?void 0:l[c])||((u=t.att[i])==null?void 0:u[c])})})}),r}function jy(n="",t){On(t);const e="I further authorize the stated URI to perform the following actions on my behalf: ";if(n.includes(e))return n;const r=[];let i=0;Object.keys(t.att).forEach(c=>{const l=Object.keys(t.att[c]).map(d=>({ability:d.split("/")[0],action:d.split("/")[1]}));l.sort((d,p)=>d.action.localeCompare(p.action));const u={};l.forEach(d=>{u[d.ability]||(u[d.ability]=[]),u[d.ability].push(d.action)});const h=Object.keys(u).map(d=>(i++,`(${i}) '${d}': '${u[d].join("', '")}' for '${c}'.`));r.push(h.join(", ").replace(".,","."))});const s=r.join(" "),o=`${e}${s}`;return`${n?n+" ":""}${o}`}function gc(n){var t;const e=xr(n);On(e);const r=(t=e.att)==null?void 0:t.eip155;return r?Object.keys(r).map(i=>i.split("/")[1]):[]}function Ec(n){const t=xr(n);On(t);const e=[];return Object.values(t.att).forEach(r=>{Object.values(r).forEach(i=>{var s;(s=i?.[0])!=null&&s.chains&&e.push(i[0].chains)})}),[...new Set(e.flat())]}function ci(n){if(!n)return;const t=n?.[n.length-1];return qy(t)?t:void 0}/*! noble-ciphers - MIT License (c) 2023 Paul Miller (paulmillr.com) */function mh(n){return n instanceof Uint8Array||ArrayBuffer.isView(n)&&n.constructor.name==="Uint8Array"}function Ys(n){if(typeof n!="boolean")throw new Error(`boolean expected, not ${n}`)}function hs(n){if(!Number.isSafeInteger(n)||n<0)throw new Error("positive integer expected, got "+n)}function Ge(n,...t){if(!mh(n))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(n.length))throw new Error("Uint8Array expected of length "+t+", got length="+n.length)}function vc(n,t=!0){if(n.destroyed)throw new Error("Hash instance has been destroyed");if(t&&n.finished)throw new Error("Hash#digest() has already been called")}function Ky(n,t){Ge(n);const e=t.outputLen;if(n.length<e)throw new Error("digestInto() expects output buffer of length at least "+e)}function ln(n){return new Uint32Array(n.buffer,n.byteOffset,Math.floor(n.byteLength/4))}function Kn(...n){for(let t=0;t<n.length;t++)n[t].fill(0)}function Fy(n){return new DataView(n.buffer,n.byteOffset,n.byteLength)}const Hy=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function Wy(n){if(typeof n!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(n))}function Js(n){if(typeof n=="string")n=Wy(n);else if(mh(n))n=Qs(n);else throw new Error("Uint8Array expected, got "+typeof n);return n}function Gy(n,t){if(t==null||typeof t!="object")throw new Error("options must be defined");return Object.assign(n,t)}function Zy(n,t){if(n.length!==t.length)return!1;let e=0;for(let r=0;r<n.length;r++)e|=n[r]^t[r];return e===0}const Yy=(n,t)=>{function e(r,...i){if(Ge(r),!Hy)throw new Error("Non little-endian hardware is not yet supported");if(n.nonceLength!==void 0){const u=i[0];if(!u)throw new Error("nonce / iv required");n.varSizeNonce?Ge(u):Ge(u,n.nonceLength)}const s=n.tagLength;s&&i[1]!==void 0&&Ge(i[1]);const o=t(r,...i),c=(u,h)=>{if(h!==void 0){if(u!==2)throw new Error("cipher output not supported");Ge(h)}};let l=!1;return{encrypt(u,h){if(l)throw new Error("cannot encrypt() twice with same key + nonce");return l=!0,Ge(u),c(o.encrypt.length,h),o.encrypt(u,h)},decrypt(u,h){if(Ge(u),s&&u.length<s)throw new Error("invalid ciphertext length: smaller than tagLength="+s);return c(o.decrypt.length,h),o.decrypt(u,h)}}}return Object.assign(e,n),e};function bc(n,t,e=!0){if(t===void 0)return new Uint8Array(n);if(t.length!==n)throw new Error("invalid output length, expected "+n+", got: "+t.length);if(e&&!Qy(t))throw new Error("invalid output, must be aligned");return t}function Ic(n,t,e,r){if(typeof n.setBigUint64=="function")return n.setBigUint64(t,e,r);const i=BigInt(32),s=BigInt(4294967295),o=Number(e>>i&s),c=Number(e&s);n.setUint32(t+4,o,r),n.setUint32(t+0,c,r)}function Jy(n,t,e){Ys(e);const r=new Uint8Array(16),i=Fy(r);return Ic(i,0,BigInt(t),e),Ic(i,8,BigInt(n),e),r}function Qy(n){return n.byteOffset%4===0}function Qs(n){return Uint8Array.from(n)}const yh=n=>Uint8Array.from(n.split("").map(t=>t.charCodeAt(0))),Xy=yh("expand 16-byte k"),eg=yh("expand 32-byte k"),tg=ln(Xy),ng=ln(eg);function Q(n,t){return n<<t|n>>>32-t}function Xs(n){return n.byteOffset%4===0}const Qr=64,rg=16,gh=2**32-1,Ac=new Uint32Array;function ig(n,t,e,r,i,s,o,c){const l=i.length,u=new Uint8Array(Qr),h=ln(u),d=Xs(i)&&Xs(s),p=d?ln(i):Ac,f=d?ln(s):Ac;for(let w=0;w<l;o++){if(n(t,e,r,h,o,c),o>=gh)throw new Error("arx: counter overflow");const m=Math.min(Qr,l-w);if(d&&m===Qr){const _=w/4;if(w%4!==0)throw new Error("arx: invalid block position");for(let E=0,v;E<rg;E++)v=_+E,f[v]=p[v]^h[E];w+=Qr;continue}for(let _=0,E;_<m;_++)E=w+_,s[E]=i[E]^u[_];w+=m}}function sg(n,t){const{allowShortKeys:e,extendNonceFn:r,counterLength:i,counterRight:s,rounds:o}=Gy({allowShortKeys:!1,counterLength:8,counterRight:!1,rounds:20},t);if(typeof n!="function")throw new Error("core must be a function");return hs(i),hs(o),Ys(s),Ys(e),(c,l,u,h,d=0)=>{Ge(c),Ge(l),Ge(u);const p=u.length;if(h===void 0&&(h=new Uint8Array(p)),Ge(h),hs(d),d<0||d>=gh)throw new Error("arx: counter overflow");if(h.length<p)throw new Error(`arx: output (${h.length}) is shorter than data (${p})`);const f=[];let w=c.length,m,_;if(w===32)f.push(m=Qs(c)),_=ng;else if(w===16&&e)m=new Uint8Array(32),m.set(c),m.set(c,16),_=tg,f.push(m);else throw new Error(`arx: invalid 32-byte key, got length=${w}`);Xs(l)||f.push(l=Qs(l));const E=ln(m);if(r){if(l.length!==24)throw new Error("arx: extended nonce must be 24 bytes");r(_,E,ln(l.subarray(0,16)),E),l=l.subarray(16)}const v=16-i;if(v!==l.length)throw new Error(`arx: nonce must be ${v} or 16 bytes`);if(v!==12){const I=new Uint8Array(12);I.set(l,s?0:12-l.length),l=I,f.push(l)}const g=ln(l);return ig(n,_,E,g,u,h,d,o),Kn(...f),h}}const Ae=(n,t)=>n[t++]&255|(n[t++]&255)<<8;class og{constructor(t){this.blockLen=16,this.outputLen=16,this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.pos=0,this.finished=!1,t=Js(t),Ge(t,32);const e=Ae(t,0),r=Ae(t,2),i=Ae(t,4),s=Ae(t,6),o=Ae(t,8),c=Ae(t,10),l=Ae(t,12),u=Ae(t,14);this.r[0]=e&8191,this.r[1]=(e>>>13|r<<3)&8191,this.r[2]=(r>>>10|i<<6)&7939,this.r[3]=(i>>>7|s<<9)&8191,this.r[4]=(s>>>4|o<<12)&255,this.r[5]=o>>>1&8190,this.r[6]=(o>>>14|c<<2)&8191,this.r[7]=(c>>>11|l<<5)&8065,this.r[8]=(l>>>8|u<<8)&8191,this.r[9]=u>>>5&127;for(let h=0;h<8;h++)this.pad[h]=Ae(t,16+2*h)}process(t,e,r=!1){const i=r?0:2048,{h:s,r:o}=this,c=o[0],l=o[1],u=o[2],h=o[3],d=o[4],p=o[5],f=o[6],w=o[7],m=o[8],_=o[9],E=Ae(t,e+0),v=Ae(t,e+2),g=Ae(t,e+4),I=Ae(t,e+6),b=Ae(t,e+8),L=Ae(t,e+10),x=Ae(t,e+12),S=Ae(t,e+14);let y=s[0]+(E&8191),D=s[1]+((E>>>13|v<<3)&8191),T=s[2]+((v>>>10|g<<6)&8191),O=s[3]+((g>>>7|I<<9)&8191),C=s[4]+((I>>>4|b<<12)&8191),A=s[5]+(b>>>1&8191),P=s[6]+((b>>>14|L<<2)&8191),R=s[7]+((L>>>11|x<<5)&8191),V=s[8]+((x>>>8|S<<8)&8191),k=s[9]+(S>>>5|i),$=0,q=$+y*c+D*(5*_)+T*(5*m)+O*(5*w)+C*(5*f);$=q>>>13,q&=8191,q+=A*(5*p)+P*(5*d)+R*(5*h)+V*(5*u)+k*(5*l),$+=q>>>13,q&=8191;let N=$+y*l+D*c+T*(5*_)+O*(5*m)+C*(5*w);$=N>>>13,N&=8191,N+=A*(5*f)+P*(5*p)+R*(5*d)+V*(5*h)+k*(5*u),$+=N>>>13,N&=8191;let j=$+y*u+D*l+T*c+O*(5*_)+C*(5*m);$=j>>>13,j&=8191,j+=A*(5*w)+P*(5*f)+R*(5*p)+V*(5*d)+k*(5*h),$+=j>>>13,j&=8191;let F=$+y*h+D*u+T*l+O*c+C*(5*_);$=F>>>13,F&=8191,F+=A*(5*m)+P*(5*w)+R*(5*f)+V*(5*p)+k*(5*d),$+=F>>>13,F&=8191;let K=$+y*d+D*h+T*u+O*l+C*c;$=K>>>13,K&=8191,K+=A*(5*_)+P*(5*m)+R*(5*w)+V*(5*f)+k*(5*p),$+=K>>>13,K&=8191;let H=$+y*p+D*d+T*h+O*u+C*l;$=H>>>13,H&=8191,H+=A*c+P*(5*_)+R*(5*m)+V*(5*w)+k*(5*f),$+=H>>>13,H&=8191;let G=$+y*f+D*p+T*d+O*h+C*u;$=G>>>13,G&=8191,G+=A*l+P*c+R*(5*_)+V*(5*m)+k*(5*w),$+=G>>>13,G&=8191;let ce=$+y*w+D*f+T*p+O*d+C*h;$=ce>>>13,ce&=8191,ce+=A*u+P*l+R*c+V*(5*_)+k*(5*m),$+=ce>>>13,ce&=8191;let re=$+y*m+D*w+T*f+O*p+C*d;$=re>>>13,re&=8191,re+=A*h+P*u+R*l+V*c+k*(5*_),$+=re>>>13,re&=8191;let te=$+y*_+D*m+T*w+O*f+C*p;$=te>>>13,te&=8191,te+=A*d+P*h+R*u+V*l+k*c,$+=te>>>13,te&=8191,$=($<<2)+$|0,$=$+q|0,q=$&8191,$=$>>>13,N+=$,s[0]=q,s[1]=N,s[2]=j,s[3]=F,s[4]=K,s[5]=H,s[6]=G,s[7]=ce,s[8]=re,s[9]=te}finalize(){const{h:t,pad:e}=this,r=new Uint16Array(10);let i=t[1]>>>13;t[1]&=8191;for(let c=2;c<10;c++)t[c]+=i,i=t[c]>>>13,t[c]&=8191;t[0]+=i*5,i=t[0]>>>13,t[0]&=8191,t[1]+=i,i=t[1]>>>13,t[1]&=8191,t[2]+=i,r[0]=t[0]+5,i=r[0]>>>13,r[0]&=8191;for(let c=1;c<10;c++)r[c]=t[c]+i,i=r[c]>>>13,r[c]&=8191;r[9]-=8192;let s=(i^1)-1;for(let c=0;c<10;c++)r[c]&=s;s=~s;for(let c=0;c<10;c++)t[c]=t[c]&s|r[c];t[0]=(t[0]|t[1]<<13)&65535,t[1]=(t[1]>>>3|t[2]<<10)&65535,t[2]=(t[2]>>>6|t[3]<<7)&65535,t[3]=(t[3]>>>9|t[4]<<4)&65535,t[4]=(t[4]>>>12|t[5]<<1|t[6]<<14)&65535,t[5]=(t[6]>>>2|t[7]<<11)&65535,t[6]=(t[7]>>>5|t[8]<<8)&65535,t[7]=(t[8]>>>8|t[9]<<5)&65535;let o=t[0]+e[0];t[0]=o&65535;for(let c=1;c<8;c++)o=(t[c]+e[c]|0)+(o>>>16)|0,t[c]=o&65535;Kn(r)}update(t){vc(this),t=Js(t),Ge(t);const{buffer:e,blockLen:r}=this,i=t.length;for(let s=0;s<i;){const o=Math.min(r-this.pos,i-s);if(o===r){for(;r<=i-s;s+=r)this.process(t,s);continue}e.set(t.subarray(s,s+o),this.pos),this.pos+=o,s+=o,this.pos===r&&(this.process(e,0,!1),this.pos=0)}return this}destroy(){Kn(this.h,this.r,this.buffer,this.pad)}digestInto(t){vc(this),Ky(t,this),this.finished=!0;const{buffer:e,h:r}=this;let{pos:i}=this;if(i){for(e[i++]=1;i<16;i++)e[i]=0;this.process(e,0,!0)}this.finalize();let s=0;for(let o=0;o<8;o++)t[s++]=r[o]>>>0,t[s++]=r[o]>>>8;return t}digest(){const{buffer:t,outputLen:e}=this;this.digestInto(t);const r=t.slice(0,e);return this.destroy(),r}}function ag(n){const t=(r,i)=>n(i).update(Js(r)).digest(),e=n(new Uint8Array(32));return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=r=>n(r),t}const cg=ag(n=>new og(n));function lg(n,t,e,r,i,s=20){let o=n[0],c=n[1],l=n[2],u=n[3],h=t[0],d=t[1],p=t[2],f=t[3],w=t[4],m=t[5],_=t[6],E=t[7],v=i,g=e[0],I=e[1],b=e[2],L=o,x=c,S=l,y=u,D=h,T=d,O=p,C=f,A=w,P=m,R=_,V=E,k=v,$=g,q=I,N=b;for(let F=0;F<s;F+=2)L=L+D|0,k=Q(k^L,16),A=A+k|0,D=Q(D^A,12),L=L+D|0,k=Q(k^L,8),A=A+k|0,D=Q(D^A,7),x=x+T|0,$=Q($^x,16),P=P+$|0,T=Q(T^P,12),x=x+T|0,$=Q($^x,8),P=P+$|0,T=Q(T^P,7),S=S+O|0,q=Q(q^S,16),R=R+q|0,O=Q(O^R,12),S=S+O|0,q=Q(q^S,8),R=R+q|0,O=Q(O^R,7),y=y+C|0,N=Q(N^y,16),V=V+N|0,C=Q(C^V,12),y=y+C|0,N=Q(N^y,8),V=V+N|0,C=Q(C^V,7),L=L+T|0,N=Q(N^L,16),R=R+N|0,T=Q(T^R,12),L=L+T|0,N=Q(N^L,8),R=R+N|0,T=Q(T^R,7),x=x+O|0,k=Q(k^x,16),V=V+k|0,O=Q(O^V,12),x=x+O|0,k=Q(k^x,8),V=V+k|0,O=Q(O^V,7),S=S+C|0,$=Q($^S,16),A=A+$|0,C=Q(C^A,12),S=S+C|0,$=Q($^S,8),A=A+$|0,C=Q(C^A,7),y=y+D|0,q=Q(q^y,16),P=P+q|0,D=Q(D^P,12),y=y+D|0,q=Q(q^y,8),P=P+q|0,D=Q(D^P,7);let j=0;r[j++]=o+L|0,r[j++]=c+x|0,r[j++]=l+S|0,r[j++]=u+y|0,r[j++]=h+D|0,r[j++]=d+T|0,r[j++]=p+O|0,r[j++]=f+C|0,r[j++]=w+A|0,r[j++]=m+P|0,r[j++]=_+R|0,r[j++]=E+V|0,r[j++]=v+k|0,r[j++]=g+$|0,r[j++]=I+q|0,r[j++]=b+N|0}const ug=sg(lg,{counterRight:!1,counterLength:4,allowShortKeys:!1}),hg=new Uint8Array(16),Tc=(n,t)=>{n.update(t);const e=t.length%16;e&&n.update(hg.subarray(e))},dg=new Uint8Array(32);function Pc(n,t,e,r,i){const s=n(t,e,dg),o=cg.create(s);i&&Tc(o,i),Tc(o,r);const c=Jy(r.length,i?i.length:0,!0);o.update(c);const l=o.digest();return Kn(s,c),l}const pg=n=>(t,e,r)=>({encrypt(i,s){const o=i.length;s=bc(o+16,s,!1),s.set(i);const c=s.subarray(0,-16);n(t,e,c,c,1);const l=Pc(n,t,e,c,r);return s.set(l,o),Kn(l),s},decrypt(i,s){s=bc(i.length-16,s,!1);const o=i.subarray(0,-16),c=i.subarray(-16),l=Pc(n,t,e,o,r);if(!Zy(c,l))throw new Error("invalid tag");return s.set(i.subarray(0,-16)),n(t,e,s,s,1),Kn(l),s}}),Eh=Yy({blockSize:64,nonceLength:12,tagLength:16},pg(ug));let vh=class extends Ni{constructor(t,e){super(),this.finished=!1,this.destroyed=!1,ia(t);const r=yt(e);if(this.iHash=t.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const i=this.blockLen,s=new Uint8Array(i);s.set(r.length>i?t.create().update(r).digest():r);for(let o=0;o<s.length;o++)s[o]^=54;this.iHash.update(s),this.oHash=t.create();for(let o=0;o<s.length;o++)s[o]^=106;this.oHash.update(s),dt(s)}update(t){return un(this),this.iHash.update(t),this}digestInto(t){un(this),ht(t,this.outputLen),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){const t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));const{oHash:e,iHash:r,finished:i,destroyed:s,blockLen:o,outputLen:c}=this;return t=t,t.finished=i,t.destroyed=s,t.blockLen=o,t.outputLen=c,t.oHash=e._cloneInto(t.oHash),t.iHash=r._cloneInto(t.iHash),t}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}};const qi=(n,t,e)=>new vh(n,t).update(e).digest();qi.create=(n,t)=>new vh(n,t);function fg(n,t,e){return ia(n),e===void 0&&(e=new Uint8Array(n.outputLen)),qi(n,yt(e),yt(t))}const ds=Uint8Array.from([0]),Oc=Uint8Array.of();function _g(n,t,e,r=32){ia(n),zt(r);const i=n.outputLen;if(r>255*i)throw new Error("Length should be <= 255*HashLen");const s=Math.ceil(r/i);e===void 0&&(e=Oc);const o=new Uint8Array(s*i),c=qi.create(n,t),l=c._cloneInto(),u=new Uint8Array(c.outputLen);for(let h=0;h<s;h++)ds[0]=h+1,l.update(h===0?Oc:u).update(e).update(ds).digestInto(u),o.set(u,i*h),c._cloneInto(l);return c.destroy(),l.destroy(),dt(u,ds),o.slice(0,r)}const wg=(n,t,e,r,i)=>_g(n,fg(n,t,e),r,i),Mi=Bi,la=BigInt(0),eo=BigInt(1);function Oi(n,t){if(typeof t!="boolean")throw new Error(n+" boolean expected, got "+t)}function Xr(n){const t=n.toString(16);return t.length&1?"0"+t:t}function bh(n){if(typeof n!="string")throw new Error("hex string expected, got "+typeof n);return n===""?la:BigInt("0x"+n)}function zi(n){return bh(Lr(n))}function Ri(n){return ht(n),bh(Lr(Uint8Array.from(n).reverse()))}function ua(n,t){return oa(n.toString(16).padStart(t*2,"0"))}function ha(n,t){return ua(n,t).reverse()}function He(n,t,e){let r;if(typeof t=="string")try{r=oa(t)}catch(s){throw new Error(n+" must be hex string or Uint8Array, cause: "+s)}else if(ra(t))r=Uint8Array.from(t);else throw new Error(n+" must be hex string or Uint8Array");const i=r.length;if(typeof e=="number"&&i!==e)throw new Error(n+" of length "+e+" expected, got "+i);return r}const ps=n=>typeof n=="bigint"&&la<=n;function mg(n,t,e){return ps(n)&&ps(t)&&ps(e)&&t<=n&&n<e}function to(n,t,e,r){if(!mg(t,e,r))throw new Error("expected valid "+n+": "+e+" <= n < "+r+", got "+t)}function yg(n){let t;for(t=0;n>la;n>>=eo,t+=1);return t}const ji=n=>(eo<<BigInt(n))-eo;function gg(n,t,e){if(typeof n!="number"||n<2)throw new Error("hashLen must be a number");if(typeof t!="number"||t<2)throw new Error("qByteLen must be a number");if(typeof e!="function")throw new Error("hmacFn must be a function");const r=p=>new Uint8Array(p),i=p=>Uint8Array.of(p);let s=r(n),o=r(n),c=0;const l=()=>{s.fill(1),o.fill(0),c=0},u=(...p)=>e(o,s,...p),h=(p=r(0))=>{o=u(i(0),p),s=u(),p.length!==0&&(o=u(i(1),p),s=u())},d=()=>{if(c++>=1e3)throw new Error("drbg: tried 1000 values");let p=0;const f=[];for(;p<t;){s=u();const w=s.slice();f.push(w),p+=s.length}return vn(...f)};return(p,f)=>{l(),h(p);let w;for(;!(w=f(d()));)h();return l(),w}}function Ki(n,t,e={}){if(!n||typeof n!="object")throw new Error("expected valid options object");function r(i,s,o){const c=n[i];if(o&&c===void 0)return;const l=typeof c;if(l!==s||c===null)throw new Error(`param "${i}" is invalid: expected ${s}, got ${l}`)}Object.entries(t).forEach(([i,s])=>r(i,s,!1)),Object.entries(e).forEach(([i,s])=>r(i,s,!0))}function Rc(n){const t=new WeakMap;return(e,...r)=>{const i=t.get(e);if(i!==void 0)return i;const s=n(e,...r);return t.set(e,s),s}}const Je=BigInt(0),qe=BigInt(1),bn=BigInt(2),Eg=BigInt(3),Ih=BigInt(4),Ah=BigInt(5),Th=BigInt(8);function lt(n,t){const e=n%t;return e>=Je?e:t+e}function ft(n,t,e){let r=n;for(;t-- >Je;)r*=r,r%=e;return r}function Dc(n,t){if(n===Je)throw new Error("invert: expected non-zero number");if(t<=Je)throw new Error("invert: expected positive modulus, got "+t);let e=lt(n,t),r=t,i=Je,s=qe;for(;e!==Je;){const o=r/e,c=r%e,l=i-s*o;r=e,e=c,i=s,s=l}if(r!==qe)throw new Error("invert: does not exist");return lt(i,t)}function Ph(n,t){const e=(n.ORDER+qe)/Ih,r=n.pow(t,e);if(!n.eql(n.sqr(r),t))throw new Error("Cannot find square root");return r}function vg(n,t){const e=(n.ORDER-Ah)/Th,r=n.mul(t,bn),i=n.pow(r,e),s=n.mul(t,i),o=n.mul(n.mul(s,bn),i),c=n.mul(s,n.sub(o,n.ONE));if(!n.eql(n.sqr(c),t))throw new Error("Cannot find square root");return c}function bg(n){if(n<BigInt(3))throw new Error("sqrt is not defined for small field");let t=n-qe,e=0;for(;t%bn===Je;)t/=bn,e++;let r=bn;const i=Qn(n);for(;Lc(i,r)===1;)if(r++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(e===1)return Ph;let s=i.pow(r,t);const o=(t+qe)/bn;return function(c,l){if(c.is0(l))return l;if(Lc(c,l)!==1)throw new Error("Cannot find square root");let u=e,h=c.mul(c.ONE,s),d=c.pow(l,t),p=c.pow(l,o);for(;!c.eql(d,c.ONE);){if(c.is0(d))return c.ZERO;let f=1,w=c.sqr(d);for(;!c.eql(w,c.ONE);)if(f++,w=c.sqr(w),f===u)throw new Error("Cannot find square root");const m=qe<<BigInt(u-f-1),_=c.pow(h,m);u=f,h=c.sqr(_),d=c.mul(d,h),p=c.mul(p,_)}return p}}function Ig(n){return n%Ih===Eg?Ph:n%Th===Ah?vg:bg(n)}const Ag=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Tg(n){const t={ORDER:"bigint",MASK:"bigint",BYTES:"number",BITS:"number"},e=Ag.reduce((r,i)=>(r[i]="function",r),t);return Ki(n,e),n}function Pg(n,t,e){if(e<Je)throw new Error("invalid exponent, negatives unsupported");if(e===Je)return n.ONE;if(e===qe)return t;let r=n.ONE,i=t;for(;e>Je;)e&qe&&(r=n.mul(r,i)),i=n.sqr(i),e>>=qe;return r}function Oh(n,t,e=!1){const r=new Array(t.length).fill(e?n.ZERO:void 0),i=t.reduce((o,c,l)=>n.is0(c)?o:(r[l]=o,n.mul(o,c)),n.ONE),s=n.inv(i);return t.reduceRight((o,c,l)=>n.is0(c)?o:(r[l]=n.mul(o,r[l]),n.mul(o,c)),s),r}function Lc(n,t){const e=(n.ORDER-qe)/bn,r=n.pow(t,e),i=n.eql(r,n.ONE),s=n.eql(r,n.ZERO),o=n.eql(r,n.neg(n.ONE));if(!i&&!s&&!o)throw new Error("invalid Legendre symbol result");return i?1:s?0:-1}function Og(n,t){t!==void 0&&zt(t);const e=t!==void 0?t:n.toString(2).length,r=Math.ceil(e/8);return{nBitLength:e,nByteLength:r}}function Qn(n,t,e=!1,r={}){if(n<=Je)throw new Error("invalid field: expected ORDER > 0, got "+n);let i,s;if(typeof t=="object"&&t!=null){if(r.sqrt||e)throw new Error("cannot specify opts in two arguments");const h=t;h.BITS&&(i=h.BITS),h.sqrt&&(s=h.sqrt),typeof h.isLE=="boolean"&&(e=h.isLE)}else typeof t=="number"&&(i=t),r.sqrt&&(s=r.sqrt);const{nBitLength:o,nByteLength:c}=Og(n,i);if(c>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let l;const u=Object.freeze({ORDER:n,isLE:e,BITS:o,BYTES:c,MASK:ji(o),ZERO:Je,ONE:qe,create:h=>lt(h,n),isValid:h=>{if(typeof h!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof h);return Je<=h&&h<n},is0:h=>h===Je,isValidNot0:h=>!u.is0(h)&&u.isValid(h),isOdd:h=>(h&qe)===qe,neg:h=>lt(-h,n),eql:(h,d)=>h===d,sqr:h=>lt(h*h,n),add:(h,d)=>lt(h+d,n),sub:(h,d)=>lt(h-d,n),mul:(h,d)=>lt(h*d,n),pow:(h,d)=>Pg(u,h,d),div:(h,d)=>lt(h*Dc(d,n),n),sqrN:h=>h*h,addN:(h,d)=>h+d,subN:(h,d)=>h-d,mulN:(h,d)=>h*d,inv:h=>Dc(h,n),sqrt:s||(h=>(l||(l=Ig(n)),l(u,h))),toBytes:h=>e?ha(h,c):ua(h,c),fromBytes:h=>{if(h.length!==c)throw new Error("Field.fromBytes: expected "+c+" bytes, got "+h.length);return e?Ri(h):zi(h)},invertBatch:h=>Oh(u,h),cmov:(h,d,p)=>p?d:h});return Object.freeze(u)}function Rh(n){if(typeof n!="bigint")throw new Error("field order must be bigint");const t=n.toString(2).length;return Math.ceil(t/8)}function Dh(n){const t=Rh(n);return t+Math.ceil(t/2)}function Rg(n,t,e=!1){const r=n.length,i=Rh(t),s=Dh(t);if(r<16||r<s||r>1024)throw new Error("expected "+s+"-1024 bytes of input, got "+r);const o=e?Ri(n):zi(n),c=lt(o,t-qe)+qe;return e?ha(c,i):ua(c,i)}const Fn=BigInt(0),In=BigInt(1);function gr(n,t){const e=t.negate();return n?e:t}function Dg(n,t,e){const r=s=>s.pz,i=Oh(n.Fp,e.map(r));return e.map((s,o)=>s.toAffine(i[o])).map(n.fromAffine)}function Lh(n,t){if(!Number.isSafeInteger(n)||n<=0||n>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+n)}function fs(n,t){Lh(n,t);const e=Math.ceil(t/n)+1,r=2**(n-1),i=2**n,s=ji(n),o=BigInt(n);return{windows:e,windowSize:r,mask:s,maxNumber:i,shiftBy:o}}function xc(n,t,e){const{windowSize:r,mask:i,maxNumber:s,shiftBy:o}=e;let c=Number(n&i),l=n>>o;c>r&&(c-=s,l+=In);const u=t*r,h=u+Math.abs(c)-1,d=c===0,p=c<0,f=t%2!==0;return{nextN:l,offset:h,isZero:d,isNeg:p,isNegF:f,offsetF:u}}function Lg(n,t){if(!Array.isArray(n))throw new Error("array expected");n.forEach((e,r)=>{if(!(e instanceof t))throw new Error("invalid point at index "+r)})}function xg(n,t){if(!Array.isArray(n))throw new Error("array of scalars expected");n.forEach((e,r)=>{if(!t.isValid(e))throw new Error("invalid scalar at index "+r)})}const _s=new WeakMap,xh=new WeakMap;function ws(n){return xh.get(n)||1}function Vc(n){if(n!==Fn)throw new Error("invalid wNAF")}function Vg(n,t){return{constTimeNegate:gr,hasPrecomputes(e){return ws(e)!==1},unsafeLadder(e,r,i=n.ZERO){let s=e;for(;r>Fn;)r&In&&(i=i.add(s)),s=s.double(),r>>=In;return i},precomputeWindow(e,r){const{windows:i,windowSize:s}=fs(r,t),o=[];let c=e,l=c;for(let u=0;u<i;u++){l=c,o.push(l);for(let h=1;h<s;h++)l=l.add(c),o.push(l);c=l.double()}return o},wNAF(e,r,i){let s=n.ZERO,o=n.BASE;const c=fs(e,t);for(let l=0;l<c.windows;l++){const{nextN:u,offset:h,isZero:d,isNeg:p,isNegF:f,offsetF:w}=xc(i,l,c);i=u,d?o=o.add(gr(f,r[w])):s=s.add(gr(p,r[h]))}return Vc(i),{p:s,f:o}},wNAFUnsafe(e,r,i,s=n.ZERO){const o=fs(e,t);for(let c=0;c<o.windows&&i!==Fn;c++){const{nextN:l,offset:u,isZero:h,isNeg:d}=xc(i,c,o);if(i=l,!h){const p=r[u];s=s.add(d?p.negate():p)}}return Vc(i),s},getPrecomputes(e,r,i){let s=_s.get(r);return s||(s=this.precomputeWindow(r,e),e!==1&&(typeof i=="function"&&(s=i(s)),_s.set(r,s))),s},wNAFCached(e,r,i){const s=ws(e);return this.wNAF(s,this.getPrecomputes(s,e,i),r)},wNAFCachedUnsafe(e,r,i,s){const o=ws(e);return o===1?this.unsafeLadder(e,r,s):this.wNAFUnsafe(o,this.getPrecomputes(o,e,i),r,s)},setWindowSize(e,r){Lh(r,t),xh.set(e,r),_s.delete(e)}}}function Sg(n,t,e,r){let i=t,s=n.ZERO,o=n.ZERO;for(;e>Fn||r>Fn;)e&In&&(s=s.add(i)),r&In&&(o=o.add(i)),i=i.double(),e>>=In,r>>=In;return{p1:s,p2:o}}function Cg(n,t,e,r){Lg(e,n),xg(r,t);const i=e.length,s=r.length;if(i!==s)throw new Error("arrays of points and scalars must have equal length");const o=n.ZERO,c=yg(BigInt(i));let l=1;c>12?l=c-3:c>4?l=c-2:c>0&&(l=2);const u=ji(l),h=new Array(Number(u)+1).fill(o),d=Math.floor((t.BITS-1)/l)*l;let p=o;for(let f=d;f>=0;f-=l){h.fill(o);for(let m=0;m<s;m++){const _=r[m],E=Number(_>>BigInt(f)&u);h[E]=h[E].add(e[m])}let w=o;for(let m=h.length-1,_=o;m>0;m--)_=_.add(h[m]),w=w.add(_);if(p=p.add(w),f!==0)for(let m=0;m<l;m++)p=p.double()}return p}function Sc(n,t){if(t){if(t.ORDER!==n)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return Tg(t),t}else return Qn(n)}function $g(n,t,e={}){if(!t||typeof t!="object")throw new Error(`expected valid ${n} CURVE object`);for(const o of["p","n","h"]){const c=t[o];if(!(typeof c=="bigint"&&c>Fn))throw new Error(`CURVE.${o} must be positive bigint`)}const r=Sc(t.p,e.Fp),i=Sc(t.n,e.Fn),s=["Gx","Gy","a","b"];for(const o of s)if(!r.isValid(t[o]))throw new Error(`CURVE.${o} must be valid field element of CURVE.Fp`);return{Fp:r,Fn:i}}BigInt(0),BigInt(1),BigInt(2),BigInt(8);const sr=BigInt(0),kn=BigInt(1),ei=BigInt(2);function kg(n){return Ki(n,{adjustScalarBytes:"function",powPminus2:"function"}),Object.freeze({...n})}function Ug(n){const t=kg(n),{P:e,type:r,adjustScalarBytes:i,powPminus2:s,randomBytes:o}=t,c=r==="x25519";if(!c&&r!=="x448")throw new Error("invalid type");const l=o||Jn,u=c?255:448,h=c?32:56,d=BigInt(c?9:5),p=BigInt(c?121665:39081),f=c?ei**BigInt(254):ei**BigInt(447),w=c?BigInt(8)*ei**BigInt(251)-kn:BigInt(4)*ei**BigInt(445)-kn,m=f+w+kn,_=y=>lt(y,e),E=v(d);function v(y){return ha(_(y),h)}function g(y){const D=He("u coordinate",y,h);return c&&(D[31]&=127),_(Ri(D))}function I(y){return Ri(i(He("scalar",y,h)))}function b(y,D){const T=S(g(D),I(y));if(T===sr)throw new Error("invalid private or public key received");return v(T)}function L(y){return b(y,E)}function x(y,D,T){const O=_(y*(D-T));return D=_(D-O),T=_(T+O),{x_2:D,x_3:T}}function S(y,D){to("u",y,sr,e),to("scalar",D,f,m);const T=D,O=y;let C=kn,A=sr,P=y,R=kn,V=sr;for(let $=BigInt(u-1);$>=sr;$--){const q=T>>$&kn;V^=q,{x_2:C,x_3:P}=x(V,C,P),{x_2:A,x_3:R}=x(V,A,R),V=q;const N=C+A,j=_(N*N),F=C-A,K=_(F*F),H=j-K,G=P+R,ce=P-R,re=_(ce*N),te=_(G*F),De=re+te,Be=re-te;P=_(De*De),R=_(O*_(Be*Be)),C=_(j*K),A=_(H*(j+_(p*H)))}({x_2:C,x_3:P}=x(V,C,P)),{x_2:A,x_3:R}=x(V,A,R);const k=s(A);return _(C*k)}return{scalarMult:b,scalarMultBase:L,getSharedSecret:(y,D)=>b(y,D),getPublicKey:y=>L(y),utils:{randomPrivateKey:()=>l(h)},GuBytes:E.slice()}}BigInt(0);const Ng=BigInt(1),Cc=BigInt(2),Bg=BigInt(3),qg=BigInt(5);BigInt(8);const Vh={p:BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed"),n:BigInt("0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed"),a:BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec"),d:BigInt("0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3"),Gx:BigInt("0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a"),Gy:BigInt("0x6666666666666666666666666666666666666666666666666666666666666658")};function Mg(n){const t=BigInt(10),e=BigInt(20),r=BigInt(40),i=BigInt(80),s=Vh.p,o=n*n%s*n%s,c=ft(o,Cc,s)*o%s,l=ft(c,Ng,s)*n%s,u=ft(l,qg,s)*l%s,h=ft(u,t,s)*u%s,d=ft(h,e,s)*h%s,p=ft(d,r,s)*d%s,f=ft(p,i,s)*p%s,w=ft(f,i,s)*p%s,m=ft(w,t,s)*u%s;return{pow_p_5_8:ft(m,Cc,s)*n%s,b2:o}}function zg(n){return n[0]&=248,n[31]&=127,n[31]|=64,n}const no=(()=>{const n=Vh.p;return Ug({P:n,type:"x25519",powPminus2:t=>{const{pow_p_5_8:e,b2:r}=Mg(t);return lt(ft(e,Bg,n)*r,n)},adjustScalarBytes:zg})})();function $c(n){n.lowS!==void 0&&Oi("lowS",n.lowS),n.prehash!==void 0&&Oi("prehash",n.prehash)}class jg extends Error{constructor(t=""){super(t)}}const Nt={Err:jg,_tlv:{encode:(n,t)=>{const{Err:e}=Nt;if(n<0||n>256)throw new e("tlv.encode: wrong tag");if(t.length&1)throw new e("tlv.encode: unpadded data");const r=t.length/2,i=Xr(r);if(i.length/2&128)throw new e("tlv.encode: long form length too big");const s=r>127?Xr(i.length/2|128):"";return Xr(n)+s+i+t},decode(n,t){const{Err:e}=Nt;let r=0;if(n<0||n>256)throw new e("tlv.encode: wrong tag");if(t.length<2||t[r++]!==n)throw new e("tlv.decode: wrong tlv");const i=t[r++],s=!!(i&128);let o=0;if(!s)o=i;else{const l=i&127;if(!l)throw new e("tlv.decode(long): indefinite length not supported");if(l>4)throw new e("tlv.decode(long): byte length is too big");const u=t.subarray(r,r+l);if(u.length!==l)throw new e("tlv.decode: length bytes not complete");if(u[0]===0)throw new e("tlv.decode(long): zero leftmost byte");for(const h of u)o=o<<8|h;if(r+=l,o<128)throw new e("tlv.decode(long): not minimal encoding")}const c=t.subarray(r,r+o);if(c.length!==o)throw new e("tlv.decode: wrong value length");return{v:c,l:t.subarray(r+o)}}},_int:{encode(n){const{Err:t}=Nt;if(n<Er)throw new t("integer: negative integers are not allowed");let e=Xr(n);if(Number.parseInt(e[0],16)&8&&(e="00"+e),e.length&1)throw new t("unexpected DER parsing assertion: unpadded hex");return e},decode(n){const{Err:t}=Nt;if(n[0]&128)throw new t("invalid signature integer: negative");if(n[0]===0&&!(n[1]&128))throw new t("invalid signature integer: unnecessary leading zero");return zi(n)}},toSig(n){const{Err:t,_int:e,_tlv:r}=Nt,i=He("signature",n),{v:s,l:o}=r.decode(48,i);if(o.length)throw new t("invalid signature: left bytes after parsing");const{v:c,l}=r.decode(2,s),{v:u,l:h}=r.decode(2,l);if(h.length)throw new t("invalid signature: left bytes after parsing");return{r:e.decode(c),s:e.decode(u)}},hexFromSig(n){const{_tlv:t,_int:e}=Nt,r=t.encode(2,e.encode(n.r)),i=t.encode(2,e.encode(n.s)),s=r+i;return t.encode(48,s)}},Er=BigInt(0),vr=BigInt(1),Kg=BigInt(2),ti=BigInt(3),Fg=BigInt(4);function Hg(n,t,e){function r(i){const s=n.sqr(i),o=n.mul(s,i);return n.add(n.add(o,n.mul(i,t)),e)}return r}function Sh(n,t,e){const{BYTES:r}=n;function i(s){let o;if(typeof s=="bigint")o=s;else{let c=He("private key",s);if(t){if(!t.includes(c.length*2))throw new Error("invalid private key");const l=new Uint8Array(r);l.set(c,l.length-c.length),c=l}try{o=n.fromBytes(c)}catch{throw new Error(`invalid private key: expected ui8a of size ${r}, got ${typeof s}`)}}if(e&&(o=n.create(o)),!n.isValidNot0(o))throw new Error("invalid private key: out of range [1..N-1]");return o}return i}function Wg(n,t={}){const{Fp:e,Fn:r}=$g("weierstrass",n,t),{h:i,n:s}=n;Ki(t,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object",wrapPrivateKey:"boolean"});const{endo:o}=t;if(o&&(!e.is0(n.a)||typeof o.beta!="bigint"||typeof o.splitScalar!="function"))throw new Error('invalid endo: expected "beta": bigint and "splitScalar": function');function c(){if(!e.isOdd)throw new Error("compression is not supported: Field does not have .isOdd()")}function l(S,y,D){const{x:T,y:O}=y.toAffine(),C=e.toBytes(T);if(Oi("isCompressed",D),D){c();const A=!e.isOdd(O);return vn(Ch(A),C)}else return vn(Uint8Array.of(4),C,e.toBytes(O))}function u(S){ht(S);const y=e.BYTES,D=y+1,T=2*y+1,O=S.length,C=S[0],A=S.subarray(1);if(O===D&&(C===2||C===3)){const P=e.fromBytes(A);if(!e.isValid(P))throw new Error("bad point: is not on curve, wrong x");const R=p(P);let V;try{V=e.sqrt(R)}catch($){const q=$ instanceof Error?": "+$.message:"";throw new Error("bad point: is not on curve, sqrt error"+q)}c();const k=e.isOdd(V);return(C&1)===1!==k&&(V=e.neg(V)),{x:P,y:V}}else if(O===T&&C===4){const P=e.fromBytes(A.subarray(y*0,y*1)),R=e.fromBytes(A.subarray(y*1,y*2));if(!f(P,R))throw new Error("bad point: is not on curve");return{x:P,y:R}}else throw new Error(`bad point: got length ${O}, expected compressed=${D} or uncompressed=${T}`)}const h=t.toBytes||l,d=t.fromBytes||u,p=Hg(e,n.a,n.b);function f(S,y){const D=e.sqr(y),T=p(S);return e.eql(D,T)}if(!f(n.Gx,n.Gy))throw new Error("bad curve params: generator point");const w=e.mul(e.pow(n.a,ti),Fg),m=e.mul(e.sqr(n.b),BigInt(27));if(e.is0(e.add(w,m)))throw new Error("bad curve params: a or b");function _(S,y,D=!1){if(!e.isValid(y)||D&&e.is0(y))throw new Error(`bad point coordinate ${S}`);return y}function E(S){if(!(S instanceof b))throw new Error("ProjectivePoint expected")}const v=Rc((S,y)=>{const{px:D,py:T,pz:O}=S;if(e.eql(O,e.ONE))return{x:D,y:T};const C=S.is0();y==null&&(y=C?e.ONE:e.inv(O));const A=e.mul(D,y),P=e.mul(T,y),R=e.mul(O,y);if(C)return{x:e.ZERO,y:e.ZERO};if(!e.eql(R,e.ONE))throw new Error("invZ was invalid");return{x:A,y:P}}),g=Rc(S=>{if(S.is0()){if(t.allowInfinityPoint&&!e.is0(S.py))return;throw new Error("bad point: ZERO")}const{x:y,y:D}=S.toAffine();if(!e.isValid(y)||!e.isValid(D))throw new Error("bad point: x or y not field elements");if(!f(y,D))throw new Error("bad point: equation left != right");if(!S.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});function I(S,y,D,T,O){return D=new b(e.mul(D.px,S),D.py,D.pz),y=gr(T,y),D=gr(O,D),y.add(D)}class b{constructor(y,D,T){this.px=_("x",y),this.py=_("y",D,!0),this.pz=_("z",T),Object.freeze(this)}static fromAffine(y){const{x:D,y:T}=y||{};if(!y||!e.isValid(D)||!e.isValid(T))throw new Error("invalid affine point");if(y instanceof b)throw new Error("projective point not allowed");return e.is0(D)&&e.is0(T)?b.ZERO:new b(D,T,e.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(y){return Dg(b,"pz",y)}static fromBytes(y){return ht(y),b.fromHex(y)}static fromHex(y){const D=b.fromAffine(d(He("pointHex",y)));return D.assertValidity(),D}static fromPrivateKey(y){const D=Sh(r,t.allowedPrivateKeyLengths,t.wrapPrivateKey);return b.BASE.multiply(D(y))}static msm(y,D){return Cg(b,r,y,D)}precompute(y=8,D=!0){return x.setWindowSize(this,y),D||this.multiply(ti),this}_setWindowSize(y){this.precompute(y)}assertValidity(){g(this)}hasEvenY(){const{y}=this.toAffine();if(!e.isOdd)throw new Error("Field doesn't support isOdd");return!e.isOdd(y)}equals(y){E(y);const{px:D,py:T,pz:O}=this,{px:C,py:A,pz:P}=y,R=e.eql(e.mul(D,P),e.mul(C,O)),V=e.eql(e.mul(T,P),e.mul(A,O));return R&&V}negate(){return new b(this.px,e.neg(this.py),this.pz)}double(){const{a:y,b:D}=n,T=e.mul(D,ti),{px:O,py:C,pz:A}=this;let P=e.ZERO,R=e.ZERO,V=e.ZERO,k=e.mul(O,O),$=e.mul(C,C),q=e.mul(A,A),N=e.mul(O,C);return N=e.add(N,N),V=e.mul(O,A),V=e.add(V,V),P=e.mul(y,V),R=e.mul(T,q),R=e.add(P,R),P=e.sub($,R),R=e.add($,R),R=e.mul(P,R),P=e.mul(N,P),V=e.mul(T,V),q=e.mul(y,q),N=e.sub(k,q),N=e.mul(y,N),N=e.add(N,V),V=e.add(k,k),k=e.add(V,k),k=e.add(k,q),k=e.mul(k,N),R=e.add(R,k),q=e.mul(C,A),q=e.add(q,q),k=e.mul(q,N),P=e.sub(P,k),V=e.mul(q,$),V=e.add(V,V),V=e.add(V,V),new b(P,R,V)}add(y){E(y);const{px:D,py:T,pz:O}=this,{px:C,py:A,pz:P}=y;let R=e.ZERO,V=e.ZERO,k=e.ZERO;const $=n.a,q=e.mul(n.b,ti);let N=e.mul(D,C),j=e.mul(T,A),F=e.mul(O,P),K=e.add(D,T),H=e.add(C,A);K=e.mul(K,H),H=e.add(N,j),K=e.sub(K,H),H=e.add(D,O);let G=e.add(C,P);return H=e.mul(H,G),G=e.add(N,F),H=e.sub(H,G),G=e.add(T,O),R=e.add(A,P),G=e.mul(G,R),R=e.add(j,F),G=e.sub(G,R),k=e.mul($,H),R=e.mul(q,F),k=e.add(R,k),R=e.sub(j,k),k=e.add(j,k),V=e.mul(R,k),j=e.add(N,N),j=e.add(j,N),F=e.mul($,F),H=e.mul(q,H),j=e.add(j,F),F=e.sub(N,F),F=e.mul($,F),H=e.add(H,F),N=e.mul(j,H),V=e.add(V,N),N=e.mul(G,H),R=e.mul(K,R),R=e.sub(R,N),N=e.mul(K,j),k=e.mul(G,k),k=e.add(k,N),new b(R,V,k)}subtract(y){return this.add(y.negate())}is0(){return this.equals(b.ZERO)}multiply(y){const{endo:D}=t;if(!r.isValidNot0(y))throw new Error("invalid scalar: out of range");let T,O;const C=A=>x.wNAFCached(this,A,b.normalizeZ);if(D){const{k1neg:A,k1:P,k2neg:R,k2:V}=D.splitScalar(y),{p:k,f:$}=C(P),{p:q,f:N}=C(V);O=$.add(N),T=I(D.beta,k,q,A,R)}else{const{p:A,f:P}=C(y);T=A,O=P}return b.normalizeZ([T,O])[0]}multiplyUnsafe(y){const{endo:D}=t,T=this;if(!r.isValid(y))throw new Error("invalid scalar: out of range");if(y===Er||T.is0())return b.ZERO;if(y===vr)return T;if(x.hasPrecomputes(this))return this.multiply(y);if(D){const{k1neg:O,k1:C,k2neg:A,k2:P}=D.splitScalar(y),{p1:R,p2:V}=Sg(b,T,C,P);return I(D.beta,R,V,O,A)}else return x.wNAFCachedUnsafe(T,y)}multiplyAndAddUnsafe(y,D,T){const O=this.multiplyUnsafe(D).add(y.multiplyUnsafe(T));return O.is0()?void 0:O}toAffine(y){return v(this,y)}isTorsionFree(){const{isTorsionFree:y}=t;return i===vr?!0:y?y(b,this):x.wNAFCachedUnsafe(this,s).is0()}clearCofactor(){const{clearCofactor:y}=t;return i===vr?this:y?y(b,this):this.multiplyUnsafe(i)}toBytes(y=!0){return Oi("isCompressed",y),this.assertValidity(),h(b,this,y)}toRawBytes(y=!0){return this.toBytes(y)}toHex(y=!0){return Lr(this.toBytes(y))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}}b.BASE=new b(n.Gx,n.Gy,e.ONE),b.ZERO=new b(e.ZERO,e.ONE,e.ZERO),b.Fp=e,b.Fn=r;const L=r.BITS,x=Vg(b,t.endo?Math.ceil(L/2):L);return b}function Ch(n){return Uint8Array.of(n?2:3)}function Gg(n,t,e={}){Ki(t,{hash:"function"},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"});const r=t.randomBytes||Jn,i=t.hmac||((T,...O)=>qi(t.hash,T,vn(...O))),{Fp:s,Fn:o}=n,{ORDER:c,BITS:l}=o;function u(T){const O=c>>vr;return T>O}function h(T){return u(T)?o.neg(T):T}function d(T,O){if(!o.isValidNot0(O))throw new Error(`invalid signature ${T}: out of range 1..CURVE.n`)}class p{constructor(O,C,A){d("r",O),d("s",C),this.r=O,this.s=C,A!=null&&(this.recovery=A),Object.freeze(this)}static fromCompact(O){const C=o.BYTES,A=He("compactSignature",O,C*2);return new p(o.fromBytes(A.subarray(0,C)),o.fromBytes(A.subarray(C,C*2)))}static fromDER(O){const{r:C,s:A}=Nt.toSig(He("DER",O));return new p(C,A)}assertValidity(){}addRecoveryBit(O){return new p(this.r,this.s,O)}recoverPublicKey(O){const C=s.ORDER,{r:A,s:P,recovery:R}=this;if(R==null||![0,1,2,3].includes(R))throw new Error("recovery id invalid");if(c*Kg<C&&R>1)throw new Error("recovery id is ambiguous for h>1 curve");const V=R===2||R===3?A+c:A;if(!s.isValid(V))throw new Error("recovery id 2 or 3 invalid");const k=s.toBytes(V),$=n.fromHex(vn(Ch((R&1)===0),k)),q=o.inv(V),N=g(He("msgHash",O)),j=o.create(-N*q),F=o.create(P*q),K=n.BASE.multiplyUnsafe(j).add($.multiplyUnsafe(F));if(K.is0())throw new Error("point at infinify");return K.assertValidity(),K}hasHighS(){return u(this.s)}normalizeS(){return this.hasHighS()?new p(this.r,o.neg(this.s),this.recovery):this}toBytes(O){if(O==="compact")return vn(o.toBytes(this.r),o.toBytes(this.s));if(O==="der")return oa(Nt.hexFromSig(this));throw new Error("invalid format")}toDERRawBytes(){return this.toBytes("der")}toDERHex(){return Lr(this.toBytes("der"))}toCompactRawBytes(){return this.toBytes("compact")}toCompactHex(){return Lr(this.toBytes("compact"))}}const f=Sh(o,e.allowedPrivateKeyLengths,e.wrapPrivateKey),w={isValidPrivateKey(T){try{return f(T),!0}catch{return!1}},normPrivateKeyToScalar:f,randomPrivateKey:()=>{const T=c;return Rg(r(Dh(T)),T)},precompute(T=8,O=n.BASE){return O.precompute(T,!1)}};function m(T,O=!0){return n.fromPrivateKey(T).toBytes(O)}function _(T){if(typeof T=="bigint")return!1;if(T instanceof n)return!0;const O=He("key",T).length,C=s.BYTES,A=C+1,P=2*C+1;if(!(e.allowedPrivateKeyLengths||o.BYTES===A))return O===A||O===P}function E(T,O,C=!0){if(_(T)===!0)throw new Error("first arg must be private key");if(_(O)===!1)throw new Error("second arg must be public key");return n.fromHex(O).multiply(f(T)).toBytes(C)}const v=t.bits2int||function(T){if(T.length>8192)throw new Error("input is too large");const O=zi(T),C=T.length*8-l;return C>0?O>>BigInt(C):O},g=t.bits2int_modN||function(T){return o.create(v(T))},I=ji(l);function b(T){return to("num < 2^"+l,T,Er,I),o.toBytes(T)}function L(T,O,C=x){if(["recovered","canonical"].some(K=>K in C))throw new Error("sign() legacy options not supported");const{hash:A}=t;let{lowS:P,prehash:R,extraEntropy:V}=C;P==null&&(P=!0),T=He("msgHash",T),$c(C),R&&(T=He("prehashed msgHash",A(T)));const k=g(T),$=f(O),q=[b($),b(k)];if(V!=null&&V!==!1){const K=V===!0?r(s.BYTES):V;q.push(He("extraEntropy",K))}const N=vn(...q),j=k;function F(K){const H=v(K);if(!o.isValidNot0(H))return;const G=o.inv(H),ce=n.BASE.multiply(H).toAffine(),re=o.create(ce.x);if(re===Er)return;const te=o.create(G*o.create(j+re*$));if(te===Er)return;let De=(ce.x===re?0:2)|Number(ce.y&vr),Be=te;return P&&u(te)&&(Be=h(te),De^=1),new p(re,Be,De)}return{seed:N,k2sig:F}}const x={lowS:t.lowS,prehash:!1},S={lowS:t.lowS,prehash:!1};function y(T,O,C=x){const{seed:A,k2sig:P}=L(T,O,C);return gg(t.hash.outputLen,o.BYTES,i)(A,P)}n.BASE.precompute(8);function D(T,O,C,A=S){const P=T;O=He("msgHash",O),C=He("publicKey",C),$c(A);const{lowS:R,prehash:V,format:k}=A;if("strict"in A)throw new Error("options.strict was renamed to lowS");if(k!==void 0&&!["compact","der","js"].includes(k))throw new Error('format must be "compact", "der" or "js"');const $=typeof P=="string"||ra(P),q=!$&&!k&&typeof P=="object"&&P!==null&&typeof P.r=="bigint"&&typeof P.s=="bigint";if(!$&&!q)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");let N,j;try{if(q)if(k===void 0||k==="js")N=new p(P.r,P.s);else throw new Error("invalid format");if($){try{k!=="compact"&&(N=p.fromDER(P))}catch(De){if(!(De instanceof Nt.Err))throw De}!N&&k!=="der"&&(N=p.fromCompact(P))}j=n.fromHex(C)}catch{return!1}if(!N||R&&N.hasHighS())return!1;V&&(O=t.hash(O));const{r:F,s:K}=N,H=g(O),G=o.inv(K),ce=o.create(H*G),re=o.create(F*G),te=n.BASE.multiplyUnsafe(ce).add(j.multiplyUnsafe(re));return te.is0()?!1:o.create(te.x)===F}return Object.freeze({getPublicKey:m,getSharedSecret:E,sign:y,verify:D,utils:w,Point:n,Signature:p})}function Zg(n){const t={a:n.a,b:n.b,p:n.Fp.ORDER,n:n.n,h:n.h,Gx:n.Gx,Gy:n.Gy},e=n.Fp,r=Qn(t.n,n.nBitLength),i={Fp:e,Fn:r,allowedPrivateKeyLengths:n.allowedPrivateKeyLengths,allowInfinityPoint:n.allowInfinityPoint,endo:n.endo,wrapPrivateKey:n.wrapPrivateKey,isTorsionFree:n.isTorsionFree,clearCofactor:n.clearCofactor,fromBytes:n.fromBytes,toBytes:n.toBytes};return{CURVE:t,curveOpts:i}}function Yg(n){const{CURVE:t,curveOpts:e}=Zg(n),r={hash:n.hash,hmac:n.hmac,randomBytes:n.randomBytes,lowS:n.lowS,bits2int:n.bits2int,bits2int_modN:n.bits2int_modN};return{CURVE:t,curveOpts:e,ecdsaOpts:r}}function Jg(n,t){return Object.assign({},t,{ProjectivePoint:t.Point,CURVE:n})}function Qg(n){const{CURVE:t,curveOpts:e,ecdsaOpts:r}=Yg(n),i=Wg(t,e),s=Gg(i,r,e);return Jg(n,s)}function ro(n,t){const e=r=>Qg({...n,hash:r});return{...e(t),create:e}}const $h={p:BigInt("0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff"),n:BigInt("0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551"),h:BigInt(1),a:BigInt("0xffffffff00000001000000000000000000000000fffffffffffffffffffffffc"),b:BigInt("0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b"),Gx:BigInt("0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296"),Gy:BigInt("0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5")},kh={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffff0000000000000000ffffffff"),n:BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffc7634d81f4372ddf581a0db248b0a77aecec196accc52973"),h:BigInt(1),a:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffff0000000000000000fffffffc"),b:BigInt("0xb3312fa7e23ee7e4988e056be3f82d19181d9c6efe8141120314088f5013875ac656398d8a2ed19d2a85c8edd3ec2aef"),Gx:BigInt("0xaa87ca22be8b05378eb1c71ef320ad746e1d3b628ba79b9859f741e082542a385502f25dbf55296c3a545e3872760ab7"),Gy:BigInt("0x3617de4a96262c6f5d9e98bf9292dc29f8f41dbd289a147ce9da3113b5f0b8c00a60b1ce1d7e819d7a431d7c90ea0e5f")},Uh={p:BigInt("0x1ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),n:BigInt("0x01fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa51868783bf2f966b7fcc0148f709a5d03bb5c9b8899c47aebb6fb71e91386409"),h:BigInt(1),a:BigInt("0x1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc"),b:BigInt("0x0051953eb9618e1c9a1f929a21a0b68540eea2da725b99b315f3b8b489918ef109e156193951ec7e937b1652c0bd3bb1bf073573df883d2c34f1ef451fd46b503f00"),Gx:BigInt("0x00c6858e06b70404e9cd9e3ecb662395b4429c648139053fb521f828af606b4d3dbaa14b5e77efe75928fe1dc127a2ffa8de3348b3c1856a429bf97e7e31c2e5bd66"),Gy:BigInt("0x011839296a789a3bc0045c8a5fb42c7d1bd998f54449579b446817afbd17273e662c97ee72995ef42640c550b9013fad0761353c7086a272c24088be94769fd16650")},Xg=Qn($h.p),e0=Qn(kh.p),t0=Qn(Uh.p),n0=ro({...$h,Fp:Xg,lowS:!1},Bi);ro({...kh,Fp:e0,lowS:!1},uy),ro({...Uh,Fp:t0,lowS:!1,allowedPrivateKeyLengths:[130,131,132]},ly);const r0=n0,Nh="base10",Me="base16",Ze="base64pad",cn="base64url",Br="utf8",Bh=0,Mt=1,qr=2,i0=0,kc=1,br=12,da=32;function s0(){const n=no.utils.randomPrivateKey(),t=no.getPublicKey(n);return{privateKey:Qe(n,Me),publicKey:Qe(t,Me)}}function io(){const n=Jn(da);return Qe(n,Me)}function o0(n,t){const e=no.getSharedSecret(ut(n,Me),ut(t,Me)),r=wg(Mi,e,void 0,void 0,da);return Qe(r,Me)}function li(n){const t=Mi(ut(n,Me));return Qe(t,Me)}function ct(n){const t=Mi(ut(n,Br));return Qe(t,Me)}function qh(n){return ut(`${n}`,Nh)}function Rn(n){return Number(Qe(n,Nh))}function Mh(n){return n.replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function zh(n){const t=n.replace(/-/g,"+").replace(/_/g,"/"),e=(4-t.length%4)%4;return t+"=".repeat(e)}function a0(n){const t=qh(typeof n.type<"u"?n.type:Bh);if(Rn(t)===Mt&&typeof n.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");const e=typeof n.senderPublicKey<"u"?ut(n.senderPublicKey,Me):void 0,r=typeof n.iv<"u"?ut(n.iv,Me):Jn(br),i=ut(n.symKey,Me),s=Eh(i,r).encrypt(ut(n.message,Br)),o=jh({type:t,sealed:s,iv:r,senderPublicKey:e});return n.encoding===cn?Mh(o):o}function c0(n){const t=ut(n.symKey,Me),{sealed:e,iv:r}=Vr({encoded:n.encoded,encoding:n.encoding}),i=Eh(t,r).decrypt(e);if(i===null)throw new Error("Failed to decrypt");return Qe(i,Br)}function l0(n,t){const e=qh(qr),r=Jn(br),i=ut(n,Br),s=jh({type:e,sealed:i,iv:r});return t===cn?Mh(s):s}function u0(n,t){const{sealed:e}=Vr({encoded:n,encoding:t});return Qe(e,Br)}function jh(n){if(Rn(n.type)===qr)return Qe(yr([n.type,n.sealed]),Ze);if(Rn(n.type)===Mt){if(typeof n.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return Qe(yr([n.type,n.senderPublicKey,n.iv,n.sealed]),Ze)}return Qe(yr([n.type,n.iv,n.sealed]),Ze)}function Vr(n){const t=(n.encoding||Ze)===cn?zh(n.encoded):n.encoded,e=ut(t,Ze),r=e.slice(i0,kc),i=kc;if(Rn(r)===Mt){const l=i+da,u=l+br,h=e.slice(i,l),d=e.slice(l,u),p=e.slice(u);return{type:r,sealed:p,iv:d,senderPublicKey:h}}if(Rn(r)===qr){const l=e.slice(i),u=Jn(br);return{type:r,sealed:l,iv:u}}const s=i+br,o=e.slice(i,s),c=e.slice(s);return{type:r,sealed:c,iv:o}}function h0(n,t){const e=Vr({encoded:n,encoding:t?.encoding});return Kh({type:Rn(e.type),senderPublicKey:typeof e.senderPublicKey<"u"?Qe(e.senderPublicKey,Me):void 0,receiverPublicKey:t?.receiverPublicKey})}function Kh(n){const t=n?.type||Bh;if(t===Mt){if(typeof n?.senderPublicKey>"u")throw new Error("missing sender public key");if(typeof n?.receiverPublicKey>"u")throw new Error("missing receiver public key")}return{type:t,senderPublicKey:n?.senderPublicKey,receiverPublicKey:n?.receiverPublicKey}}function Uc(n){return n.type===Mt&&typeof n.senderPublicKey=="string"&&typeof n.receiverPublicKey=="string"}function Nc(n){return n.type===qr}function d0(n){const t=Buffer.from(n.x,"base64"),e=Buffer.from(n.y,"base64");return yr([new Uint8Array([4]),t,e])}function p0(n,t){const[e,r,i]=n.split("."),s=Buffer.from(zh(i),"base64");if(s.length!==64)throw new Error("Invalid signature length");const o=s.slice(0,32),c=s.slice(32,64),l=`${e}.${r}`,u=Mi(l),h=d0(t);if(!r0.verify(yr([o,c]),u,h))throw new Error("Invalid signature");return Vs(n).payload}const f0="irn";function Di(n){return n?.relay||{protocol:f0}}function qn(n){const t=sp[n];if(typeof t>"u")throw new Error(`Relay Protocol not supported: ${n}`);return t}function _0(n,t="-"){const e={},r="relay"+t;return Object.keys(n).forEach(i=>{if(i.startsWith(r)){const s=i.replace(r,""),o=n[i];e[s]=o}}),e}function Bc(n){if(!n.includes("wc:")){const u=th(n);u!=null&&u.includes("wc:")&&(n=u)}n=n.includes("wc://")?n.replace("wc://",""):n,n=n.includes("wc:")?n.replace("wc:",""):n;const t=n.indexOf(":"),e=n.indexOf("?")!==-1?n.indexOf("?"):void 0,r=n.substring(0,t),i=n.substring(t+1,e).split("@"),s=typeof e<"u"?n.substring(e):"",o=new URLSearchParams(s),c={};o.forEach((u,h)=>{c[h]=u});const l=typeof c.methods=="string"?c.methods.split(","):void 0;return{protocol:r,topic:w0(i[0]),version:parseInt(i[1],10),symKey:c.symKey,relay:_0(c),methods:l,expiryTimestamp:c.expiryTimestamp?parseInt(c.expiryTimestamp,10):void 0}}function w0(n){return n.startsWith("//")?n.substring(2):n}function m0(n,t="-"){const e="relay",r={};return Object.keys(n).forEach(i=>{const s=i,o=e+t+s;n[s]&&(r[o]=n[s])}),r}function qc(n){const t=new URLSearchParams,e=m0(n.relay);Object.keys(e).sort().forEach(i=>{t.set(i,e[i])}),t.set("symKey",n.symKey),n.expiryTimestamp&&t.set("expiryTimestamp",n.expiryTimestamp.toString()),n.methods&&t.set("methods",n.methods.join(","));const r=t.toString();return`${n.protocol}:${n.topic}@${n.version}?${r}`}function ni(n,t,e){return`${n}?wc_ev=${e}&topic=${t}`}var y0=Object.defineProperty,g0=Object.defineProperties,E0=Object.getOwnPropertyDescriptors,Mc=Object.getOwnPropertySymbols,v0=Object.prototype.hasOwnProperty,b0=Object.prototype.propertyIsEnumerable,zc=(n,t,e)=>t in n?y0(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,I0=(n,t)=>{for(var e in t||(t={}))v0.call(t,e)&&zc(n,e,t[e]);if(Mc)for(var e of Mc(t))b0.call(t,e)&&zc(n,e,t[e]);return n},A0=(n,t)=>g0(n,E0(t));function Xn(n){const t=[];return n.forEach(e=>{const[r,i]=e.split(":");t.push(`${r}:${i}`)}),t}function T0(n){const t=[];return Object.values(n).forEach(e=>{t.push(...Xn(e.accounts))}),t}function P0(n,t){const e=[];return Object.values(n).forEach(r=>{Xn(r.accounts).includes(t)&&e.push(...r.methods)}),e}function O0(n,t){const e=[];return Object.values(n).forEach(r=>{Xn(r.accounts).includes(t)&&e.push(...r.events)}),e}function Fh(n){return n.includes(":")}function R0(n){return Fh(n)?n.split(":")[0]:n}function jc(n){var t,e,r;const i={};if(!Sr(n))return i;for(const[s,o]of Object.entries(n)){const c=Fh(s)?[s]:o.chains,l=o.methods||[],u=o.events||[],h=R0(s);i[h]=A0(I0({},i[h]),{chains:Tn(c,(t=i[h])==null?void 0:t.chains),methods:Tn(l,(e=i[h])==null?void 0:e.methods),events:Tn(u,(r=i[h])==null?void 0:r.events)})}return i}function D0(n){const t={};return n?.forEach(e=>{var r;const[i,s]=e.split(":");t[i]||(t[i]={accounts:[],chains:[],events:[],methods:[]}),t[i].accounts.push(e),(r=t[i].chains)==null||r.push(`${i}:${s}`)}),t}function Kc(n,t){t=t.map(r=>r.replace("did:pkh:",""));const e=D0(t);for(const[r,i]of Object.entries(e))i.methods?i.methods=Tn(i.methods,n):i.methods=n,i.events=["chainChanged","accountsChanged"];return e}function L0(n,t){var e,r,i,s,o,c;const l=jc(n),u=jc(t),h={},d=Object.keys(l).concat(Object.keys(u));for(const p of d)h[p]={chains:Tn((e=l[p])==null?void 0:e.chains,(r=u[p])==null?void 0:r.chains),methods:Tn((i=l[p])==null?void 0:i.methods,(s=u[p])==null?void 0:s.methods),events:Tn((o=l[p])==null?void 0:o.events,(c=u[p])==null?void 0:c.events)};return h}const x0={INVALID_METHOD:{message:"Invalid method.",code:1001},INVALID_EVENT:{message:"Invalid event.",code:1002},INVALID_UPDATE_REQUEST:{message:"Invalid update request.",code:1003},INVALID_EXTEND_REQUEST:{message:"Invalid extend request.",code:1004},INVALID_SESSION_SETTLE_REQUEST:{message:"Invalid session settle request.",code:1005},UNAUTHORIZED_METHOD:{message:"Unauthorized method.",code:3001},UNAUTHORIZED_EVENT:{message:"Unauthorized event.",code:3002},UNAUTHORIZED_UPDATE_REQUEST:{message:"Unauthorized update request.",code:3003},UNAUTHORIZED_EXTEND_REQUEST:{message:"Unauthorized extend request.",code:3004},USER_REJECTED:{message:"User rejected.",code:5e3},USER_REJECTED_CHAINS:{message:"User rejected chains.",code:5001},USER_REJECTED_METHODS:{message:"User rejected methods.",code:5002},USER_REJECTED_EVENTS:{message:"User rejected events.",code:5003},UNSUPPORTED_CHAINS:{message:"Unsupported chains.",code:5100},UNSUPPORTED_METHODS:{message:"Unsupported methods.",code:5101},UNSUPPORTED_EVENTS:{message:"Unsupported events.",code:5102},UNSUPPORTED_ACCOUNTS:{message:"Unsupported accounts.",code:5103},UNSUPPORTED_NAMESPACE_KEY:{message:"Unsupported namespace key.",code:5104},USER_DISCONNECTED:{message:"User disconnected.",code:6e3},SESSION_SETTLEMENT_FAILED:{message:"Session settlement failed.",code:7e3},WC_METHOD_UNSUPPORTED:{message:"Unsupported wc_ method.",code:10001}},V0={NOT_INITIALIZED:{message:"Not initialized.",code:1},NO_MATCHING_KEY:{message:"No matching key.",code:2},RESTORE_WILL_OVERRIDE:{message:"Restore will override.",code:3},RESUBSCRIBED:{message:"Resubscribed.",code:4},MISSING_OR_INVALID:{message:"Missing or invalid.",code:5},EXPIRED:{message:"Expired.",code:6},UNKNOWN_TYPE:{message:"Unknown type.",code:7},MISMATCHED_TOPIC:{message:"Mismatched topic.",code:8},NON_CONFORMING_NAMESPACES:{message:"Non conforming namespaces.",code:9}};function B(n,t){const{message:e,code:r}=V0[n];return{message:t?`${e} ${t}`:e,code:r}}function le(n,t){const{message:e,code:r}=x0[n];return{message:t?`${e} ${t}`:e,code:r}}function Hn(n,t){return!!Array.isArray(n)}function Sr(n){return Object.getPrototypeOf(n)===Object.prototype&&Object.keys(n).length}function we(n){return typeof n>"u"}function pe(n,t){return t&&we(n)?!0:typeof n=="string"&&!!n.trim().length}function pa(n,t){return t&&we(n)?!0:typeof n=="number"&&!isNaN(n)}function S0(n,t){const{requiredNamespaces:e}=t,r=Object.keys(n.namespaces),i=Object.keys(e);let s=!0;return En(i,r)?(r.forEach(o=>{const{accounts:c,methods:l,events:u}=n.namespaces[o],h=Xn(c),d=e[o];(!En(Yu(o,d),h)||!En(d.methods,l)||!En(d.events,u))&&(s=!1)}),s):!1}function Li(n){return pe(n,!1)&&n.includes(":")?n.split(":").length===2:!1}function C0(n){if(pe(n,!1)&&n.includes(":")){const t=n.split(":");if(t.length===3){const e=t[0]+":"+t[1];return!!t[2]&&Li(e)}}return!1}function $0(n){function t(e){try{return typeof new URL(e)<"u"}catch{return!1}}try{if(pe(n,!1)){if(t(n))return!0;const e=th(n);return t(e)}}catch{}return!1}function k0(n){var t;return(t=n?.proposer)==null?void 0:t.publicKey}function U0(n){return n?.topic}function N0(n,t){let e=null;return pe(n?.publicKey,!1)||(e=B("MISSING_OR_INVALID",`${t} controller public key should be a string`)),e}function Fc(n){let t=!0;return Hn(n)?n.length&&(t=n.every(e=>pe(e,!1))):t=!1,t}function B0(n,t,e){let r=null;return Hn(t)&&t.length?t.forEach(i=>{r||Li(i)||(r=le("UNSUPPORTED_CHAINS",`${e}, chain ${i} should be a string and conform to "namespace:chainId" format`))}):Li(n)||(r=le("UNSUPPORTED_CHAINS",`${e}, chains must be defined as "namespace:chainId" e.g. "eip155:1": {...} in the namespace key OR as an array of CAIP-2 chainIds e.g. eip155: { chains: ["eip155:1", "eip155:5"] }`)),r}function q0(n,t,e){let r=null;return Object.entries(n).forEach(([i,s])=>{if(r)return;const o=B0(i,Yu(i,s),`${t} ${e}`);o&&(r=o)}),r}function M0(n,t){let e=null;return Hn(n)?n.forEach(r=>{e||C0(r)||(e=le("UNSUPPORTED_ACCOUNTS",`${t}, account ${r} should be a string and conform to "namespace:chainId:address" format`))}):e=le("UNSUPPORTED_ACCOUNTS",`${t}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),e}function z0(n,t){let e=null;return Object.values(n).forEach(r=>{if(e)return;const i=M0(r?.accounts,`${t} namespace`);i&&(e=i)}),e}function j0(n,t){let e=null;return Fc(n?.methods)?Fc(n?.events)||(e=le("UNSUPPORTED_EVENTS",`${t}, events should be an array of strings or empty array for no events`)):e=le("UNSUPPORTED_METHODS",`${t}, methods should be an array of strings or empty array for no methods`),e}function Hh(n,t){let e=null;return Object.values(n).forEach(r=>{if(e)return;const i=j0(r,`${t}, namespace`);i&&(e=i)}),e}function K0(n,t,e){let r=null;if(n&&Sr(n)){const i=Hh(n,t);i&&(r=i);const s=q0(n,t,e);s&&(r=s)}else r=B("MISSING_OR_INVALID",`${t}, ${e} should be an object with data`);return r}function ms(n,t){let e=null;if(n&&Sr(n)){const r=Hh(n,t);r&&(e=r);const i=z0(n,t);i&&(e=i)}else e=B("MISSING_OR_INVALID",`${t}, namespaces should be an object with data`);return e}function Wh(n){return pe(n.protocol,!0)}function F0(n,t){let e=!1;return n?n&&Hn(n)&&n.length&&n.forEach(r=>{e=Wh(r)}):e=!0,e}function H0(n){return typeof n=="number"}function Fe(n){return typeof n<"u"&&typeof n!==null}function W0(n){return!(!n||typeof n!="object"||!n.code||!pa(n.code,!1)||!n.message||!pe(n.message,!1))}function G0(n){return!(we(n)||!pe(n.method,!1))}function Z0(n){return!(we(n)||we(n.result)&&we(n.error)||!pa(n.id,!1)||!pe(n.jsonrpc,!1))}function Y0(n){return!(we(n)||!pe(n.name,!1))}function Hc(n,t){return!(!Li(t)||!T0(n).includes(t))}function J0(n,t,e){return pe(e,!1)?P0(n,t).includes(e):!1}function Q0(n,t,e){return pe(e,!1)?O0(n,t).includes(e):!1}function Wc(n,t,e){let r=null;const i=X0(n),s=eE(t),o=Object.keys(i),c=Object.keys(s),l=Gc(Object.keys(n)),u=Gc(Object.keys(t)),h=l.filter(d=>!u.includes(d));return h.length&&(r=B("NON_CONFORMING_NAMESPACES",`${e} namespaces keys don't satisfy requiredNamespaces.
9
+ Required: ${h.toString()}
10
+ Received: ${Object.keys(t).toString()}`)),En(o,c)||(r=B("NON_CONFORMING_NAMESPACES",`${e} namespaces chains don't satisfy required namespaces.
11
+ Required: ${o.toString()}
12
+ Approved: ${c.toString()}`)),Object.keys(t).forEach(d=>{if(!d.includes(":")||r)return;const p=Xn(t[d].accounts);p.includes(d)||(r=B("NON_CONFORMING_NAMESPACES",`${e} namespaces accounts don't satisfy namespace accounts for ${d}
13
+ Required: ${d}
14
+ Approved: ${p.toString()}`))}),o.forEach(d=>{r||(En(i[d].methods,s[d].methods)?En(i[d].events,s[d].events)||(r=B("NON_CONFORMING_NAMESPACES",`${e} namespaces events don't satisfy namespace events for ${d}`)):r=B("NON_CONFORMING_NAMESPACES",`${e} namespaces methods don't satisfy namespace methods for ${d}`))}),r}function X0(n){const t={};return Object.keys(n).forEach(e=>{var r;e.includes(":")?t[e]=n[e]:(r=n[e].chains)==null||r.forEach(i=>{t[i]={methods:n[e].methods,events:n[e].events}})}),t}function Gc(n){return[...new Set(n.map(t=>t.includes(":")?t.split(":")[0]:t))]}function eE(n){const t={};return Object.keys(n).forEach(e=>{e.includes(":")?t[e]=n[e]:Xn(n[e].accounts)?.forEach(i=>{t[i]={accounts:n[e].accounts.filter(s=>s.includes(`${i}:`)),methods:n[e].methods,events:n[e].events}})}),t}function tE(n,t){return pa(n,!1)&&n<=t.max&&n>=t.min}function Zc(){const n=Ur();return new Promise(t=>{switch(n){case nt.browser:t(nE());break;case nt.reactNative:t(rE());break;case nt.node:t(iE());break;default:t(!0)}})}function nE(){return Yn()&&navigator?.onLine}async function rE(){return hn()&&typeof global<"u"&&global!=null&&global.NetInfo?(await(global==null?void 0:global.NetInfo.fetch()))?.isConnected:!0}function iE(){return!0}function sE(n){switch(Ur()){case nt.browser:oE(n);break;case nt.reactNative:aE(n);break}}function oE(n){!hn()&&Yn()&&(window.addEventListener("online",()=>n(!0)),window.addEventListener("offline",()=>n(!1)))}function aE(n){hn()&&typeof global<"u"&&global!=null&&global.NetInfo&&global?.NetInfo.addEventListener(t=>n(t?.isConnected))}function cE(){var n;return Yn()&&zn()?((n=zn())==null?void 0:n.visibilityState)==="visible":!0}const ys={};class or{static get(t){return ys[t]}static set(t,e){ys[t]=e}static delete(t){delete ys[t]}}function lE(n){const t=kr.decode(n);if(t.length<33)throw new Error("Too short to contain a public key");return t.slice(1,33)}function uE({publicKey:n,signature:t,payload:e}){var r;const i=so(e.method),s=128|parseInt(((r=e.version)==null?void 0:r.toString())||"4"),o=pE(e.address),c=e.era==="00"?new Uint8Array([0]):so(e.era);if(c.length!==1&&c.length!==2)throw new Error("Invalid era length");const l=parseInt(e.nonce,16),u=new Uint8Array([l&255,l>>8&255]),h=BigInt(`0x${dE(e.tip)}`),d=_E(h),p=new Uint8Array([0,...n,o,...t,...c,...u,...d,...i]),f=fE(p.length+1);return new Uint8Array([...f,s,...p])}function hE(n){const t=so(n),e=Xw.blake2b(t,void 0,32);return"0x"+Buffer.from(e).toString("hex")}function so(n){return new Uint8Array(n.replace(/^0x/,"").match(/.{1,2}/g).map(t=>parseInt(t,16)))}function dE(n){return n.startsWith("0x")?n.slice(2):n}function pE(n){const t=kr.decode(n)[0];return t===42?0:t===60?2:1}function fE(n){if(n<64)return new Uint8Array([n<<2]);if(n<16384){const t=n<<2|1;return new Uint8Array([t&255,t>>8&255])}else if(n<1<<30){const t=n<<2|2;return new Uint8Array([t&255,t>>8&255,t>>16&255,t>>24&255])}else throw new Error("Compact encoding > 2^30 not supported")}function _E(n){if(n<BigInt(1)<<BigInt(6))return new Uint8Array([Number(n<<BigInt(2))]);if(n<BigInt(1)<<BigInt(14)){const t=n<<BigInt(2)|BigInt(1);return new Uint8Array([Number(t&BigInt(255)),Number(t>>BigInt(8)&BigInt(255))])}else if(n<BigInt(1)<<BigInt(30)){const t=n<<BigInt(2)|BigInt(2);return new Uint8Array([Number(t&BigInt(255)),Number(t>>BigInt(8)&BigInt(255)),Number(t>>BigInt(16)&BigInt(255)),Number(t>>BigInt(24)&BigInt(255))])}else throw new Error("BigInt compact encoding not supported > 2^30")}function wE(n){const t=Uint8Array.from(Buffer.from(n.signature,"hex")),e=lE(n.transaction.address),r=uE({publicKey:e,signature:t,payload:n.transaction}),i=Buffer.from(r).toString("hex");return hE(i)}var mE={};const Gh="wc",Zh=2,oo="core",xt=`${Gh}@2:${oo}:`,yE={logger:"error"},gE={database:":memory:"},EE="crypto",Yc="client_ed25519_seed",vE=M.ONE_DAY,bE="keychain",IE="0.3",AE="messages",TE="0.3",PE=M.SIX_HOURS,OE="publisher",Yh="irn",RE="error",Jh="wss://relay.walletconnect.org",DE="relayer",ue={message:"relayer_message",message_ack:"relayer_message_ack",connect:"relayer_connect",disconnect:"relayer_disconnect",error:"relayer_error",connection_stalled:"relayer_connection_stalled",transport_closed:"relayer_transport_closed",publish:"relayer_publish"},LE="_subscription",st={payload:"payload",connect:"connect",disconnect:"disconnect",error:"error"},xE=.1,ao="2.21.8",ae={link_mode:"link_mode",relay:"relay"},ui={inbound:"inbound",outbound:"outbound"},VE="0.3",SE="WALLETCONNECT_CLIENT_ID",Jc="WALLETCONNECT_LINK_MODE_APPS",et={created:"subscription_created",deleted:"subscription_deleted",expired:"subscription_expired",disabled:"subscription_disabled",sync:"subscription_sync",resubscribed:"subscription_resubscribed"},CE="subscription",$E="0.3",kE="pairing",UE="0.3",ar={wc_pairingDelete:{req:{ttl:M.ONE_DAY,prompt:!1,tag:1e3},res:{ttl:M.ONE_DAY,prompt:!1,tag:1001}},wc_pairingPing:{req:{ttl:M.THIRTY_SECONDS,prompt:!1,tag:1002},res:{ttl:M.THIRTY_SECONDS,prompt:!1,tag:1003}},unregistered_method:{req:{ttl:M.ONE_DAY,prompt:!1,tag:0},res:{ttl:M.ONE_DAY,prompt:!1,tag:0}}},yn={create:"pairing_create",expire:"pairing_expire",delete:"pairing_delete",ping:"pairing_ping"},pt={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},NE="history",BE="0.3",qE="expirer",at={created:"expirer_created",deleted:"expirer_deleted",expired:"expirer_expired",sync:"expirer_sync"},ME="0.3",zE="verify-api",jE="https://verify.walletconnect.com",Qh="https://verify.walletconnect.org",Ir=Qh,KE=`${Ir}/v3`,FE=[jE,Qh],HE="echo",WE="https://echo.walletconnect.com",Pt={pairing_started:"pairing_started",pairing_uri_validation_success:"pairing_uri_validation_success",pairing_uri_not_expired:"pairing_uri_not_expired",store_new_pairing:"store_new_pairing",subscribing_pairing_topic:"subscribing_pairing_topic",subscribe_pairing_topic_success:"subscribe_pairing_topic_success",existing_pairing:"existing_pairing",pairing_not_expired:"pairing_not_expired",emit_inactive_pairing:"emit_inactive_pairing",emit_session_proposal:"emit_session_proposal",subscribing_to_pairing_topic:"subscribing_to_pairing_topic"},kt={no_wss_connection:"no_wss_connection",no_internet_connection:"no_internet_connection",malformed_pairing_uri:"malformed_pairing_uri",active_pairing_already_exists:"active_pairing_already_exists",subscribe_pairing_topic_failure:"subscribe_pairing_topic_failure",pairing_expired:"pairing_expired",proposal_expired:"proposal_expired",proposal_listener_not_found:"proposal_listener_not_found"},tn={session_approve_started:"session_approve_started",proposal_not_expired:"proposal_not_expired",session_namespaces_validation_success:"session_namespaces_validation_success",create_session_topic:"create_session_topic",subscribing_session_topic:"subscribing_session_topic",subscribe_session_topic_success:"subscribe_session_topic_success",publishing_session_approve:"publishing_session_approve",session_approve_publish_success:"session_approve_publish_success",store_session:"store_session",publishing_session_settle:"publishing_session_settle",session_settle_publish_success:"session_settle_publish_success"},cr={no_internet_connection:"no_internet_connection",no_wss_connection:"no_wss_connection",proposal_expired:"proposal_expired",subscribe_session_topic_failure:"subscribe_session_topic_failure",session_approve_publish_failure:"session_approve_publish_failure",session_settle_publish_failure:"session_settle_publish_failure",session_approve_namespace_validation_failure:"session_approve_namespace_validation_failure",proposal_not_found:"proposal_not_found"},_n={authenticated_session_approve_started:"authenticated_session_approve_started",create_authenticated_session_topic:"create_authenticated_session_topic",cacaos_verified:"cacaos_verified",store_authenticated_session:"store_authenticated_session",subscribing_authenticated_session_topic:"subscribing_authenticated_session_topic",subscribe_authenticated_session_topic_success:"subscribe_authenticated_session_topic_success",publishing_authenticated_session_approve:"publishing_authenticated_session_approve"},lr={no_internet_connection:"no_internet_connection",invalid_cacao:"invalid_cacao",subscribe_authenticated_session_topic_failure:"subscribe_authenticated_session_topic_failure",authenticated_session_approve_publish_failure:"authenticated_session_approve_publish_failure",authenticated_session_pending_request_not_found:"authenticated_session_pending_request_not_found"},GE=.1,ZE="event-client",YE=86400,JE="https://pulse.walletconnect.org/batch";function QE(n,t){if(n.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),r=0;r<e.length;r++)e[r]=255;for(var i=0;i<n.length;i++){var s=n.charAt(i),o=s.charCodeAt(0);if(e[o]!==255)throw new TypeError(s+" is ambiguous");e[o]=i}var c=n.length,l=n.charAt(0),u=Math.log(c)/Math.log(256),h=Math.log(256)/Math.log(c);function d(w){if(w instanceof Uint8Array||(ArrayBuffer.isView(w)?w=new Uint8Array(w.buffer,w.byteOffset,w.byteLength):Array.isArray(w)&&(w=Uint8Array.from(w))),!(w instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(w.length===0)return"";for(var m=0,_=0,E=0,v=w.length;E!==v&&w[E]===0;)E++,m++;for(var g=(v-E)*h+1>>>0,I=new Uint8Array(g);E!==v;){for(var b=w[E],L=0,x=g-1;(b!==0||L<_)&&x!==-1;x--,L++)b+=256*I[x]>>>0,I[x]=b%c>>>0,b=b/c>>>0;if(b!==0)throw new Error("Non-zero carry");_=L,E++}for(var S=g-_;S!==g&&I[S]===0;)S++;for(var y=l.repeat(m);S<g;++S)y+=n.charAt(I[S]);return y}function p(w){if(typeof w!="string")throw new TypeError("Expected String");if(w.length===0)return new Uint8Array;var m=0;if(w[m]!==" "){for(var _=0,E=0;w[m]===l;)_++,m++;for(var v=(w.length-m)*u+1>>>0,g=new Uint8Array(v);w[m];){var I=e[w.charCodeAt(m)];if(I===255)return;for(var b=0,L=v-1;(I!==0||b<E)&&L!==-1;L--,b++)I+=c*g[L]>>>0,g[L]=I%256>>>0,I=I/256>>>0;if(I!==0)throw new Error("Non-zero carry");E=b,m++}if(w[m]!==" "){for(var x=v-E;x!==v&&g[x]===0;)x++;for(var S=new Uint8Array(_+(v-x)),y=_;x!==v;)S[y++]=g[x++];return S}}}function f(w){var m=p(w);if(m)return m;throw new Error(`Non-${t} character`)}return{encode:d,decodeUnsafe:p,decode:f}}var XE=QE,ev=XE;const Xh=n=>{if(n instanceof Uint8Array&&n.constructor.name==="Uint8Array")return n;if(n instanceof ArrayBuffer)return new Uint8Array(n);if(ArrayBuffer.isView(n))return new Uint8Array(n.buffer,n.byteOffset,n.byteLength);throw new Error("Unknown type, must be binary type")},tv=n=>new TextEncoder().encode(n),nv=n=>new TextDecoder().decode(n);class rv{constructor(t,e,r){this.name=t,this.prefix=e,this.baseEncode=r}encode(t){if(t instanceof Uint8Array)return`${this.prefix}${this.baseEncode(t)}`;throw Error("Unknown type, must be binary type")}}class iv{constructor(t,e,r){if(this.name=t,this.prefix=e,e.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=e.codePointAt(0),this.baseDecode=r}decode(t){if(typeof t=="string"){if(t.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(t)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(t.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(t){return ed(this,t)}}class sv{constructor(t){this.decoders=t}or(t){return ed(this,t)}decode(t){const e=t[0],r=this.decoders[e];if(r)return r.decode(t);throw RangeError(`Unable to decode multibase string ${JSON.stringify(t)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const ed=(n,t)=>new sv({...n.decoders||{[n.prefix]:n},...t.decoders||{[t.prefix]:t}});class ov{constructor(t,e,r,i){this.name=t,this.prefix=e,this.baseEncode=r,this.baseDecode=i,this.encoder=new rv(t,e,r),this.decoder=new iv(t,e,i)}encode(t){return this.encoder.encode(t)}decode(t){return this.decoder.decode(t)}}const Fi=({name:n,prefix:t,encode:e,decode:r})=>new ov(n,t,e,r),Mr=({prefix:n,name:t,alphabet:e})=>{const{encode:r,decode:i}=ev(e,t);return Fi({prefix:n,name:t,encode:r,decode:s=>Xh(i(s))})},av=(n,t,e,r)=>{const i={};for(let h=0;h<t.length;++h)i[t[h]]=h;let s=n.length;for(;n[s-1]==="=";)--s;const o=new Uint8Array(s*e/8|0);let c=0,l=0,u=0;for(let h=0;h<s;++h){const d=i[n[h]];if(d===void 0)throw new SyntaxError(`Non-${r} character`);l=l<<e|d,c+=e,c>=8&&(c-=8,o[u++]=255&l>>c)}if(c>=e||255&l<<8-c)throw new SyntaxError("Unexpected end of data");return o},cv=(n,t,e)=>{const r=t[t.length-1]==="=",i=(1<<e)-1;let s="",o=0,c=0;for(let l=0;l<n.length;++l)for(c=c<<8|n[l],o+=8;o>e;)o-=e,s+=t[i&c>>o];if(o&&(s+=t[i&c<<e-o]),r)for(;s.length*e&7;)s+="=";return s},Re=({name:n,prefix:t,bitsPerChar:e,alphabet:r})=>Fi({prefix:t,name:n,encode(i){return cv(i,r,e)},decode(i){return av(i,r,e,n)}}),lv=Fi({prefix:"\0",name:"identity",encode:n=>nv(n),decode:n=>tv(n)});var uv=Object.freeze({__proto__:null,identity:lv});const hv=Re({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var dv=Object.freeze({__proto__:null,base2:hv});const pv=Re({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var fv=Object.freeze({__proto__:null,base8:pv});const _v=Mr({prefix:"9",name:"base10",alphabet:"0123456789"});var wv=Object.freeze({__proto__:null,base10:_v});const mv=Re({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),yv=Re({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var gv=Object.freeze({__proto__:null,base16:mv,base16upper:yv});const Ev=Re({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),vv=Re({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),bv=Re({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Iv=Re({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Av=Re({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Tv=Re({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Pv=Re({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Ov=Re({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Rv=Re({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Dv=Object.freeze({__proto__:null,base32:Ev,base32upper:vv,base32pad:bv,base32padupper:Iv,base32hex:Av,base32hexupper:Tv,base32hexpad:Pv,base32hexpadupper:Ov,base32z:Rv});const Lv=Mr({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),xv=Mr({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var Vv=Object.freeze({__proto__:null,base36:Lv,base36upper:xv});const Sv=Mr({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Cv=Mr({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var $v=Object.freeze({__proto__:null,base58btc:Sv,base58flickr:Cv});const kv=Re({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Uv=Re({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Nv=Re({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Bv=Re({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var qv=Object.freeze({__proto__:null,base64:kv,base64pad:Uv,base64url:Nv,base64urlpad:Bv});const td=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),Mv=td.reduce((n,t,e)=>(n[e]=t,n),[]),zv=td.reduce((n,t,e)=>(n[t.codePointAt(0)]=e,n),[]);function jv(n){return n.reduce((t,e)=>(t+=Mv[e],t),"")}function Kv(n){const t=[];for(const e of n){const r=zv[e.codePointAt(0)];if(r===void 0)throw new Error(`Non-base256emoji character: ${e}`);t.push(r)}return new Uint8Array(t)}const Fv=Fi({prefix:"🚀",name:"base256emoji",encode:jv,decode:Kv});var Hv=Object.freeze({__proto__:null,base256emoji:Fv}),Wv=nd,Qc=128,Gv=-128,Zv=Math.pow(2,31);function nd(n,t,e){t=t||[],e=e||0;for(var r=e;n>=Zv;)t[e++]=n&255|Qc,n/=128;for(;n&Gv;)t[e++]=n&255|Qc,n>>>=7;return t[e]=n|0,nd.bytes=e-r+1,t}var Yv=co,Jv=128,Xc=127;function co(n,r){var e=0,r=r||0,i=0,s=r,o,c=n.length;do{if(s>=c)throw co.bytes=0,new RangeError("Could not decode varint");o=n[s++],e+=i<28?(o&Xc)<<i:(o&Xc)*Math.pow(2,i),i+=7}while(o>=Jv);return co.bytes=s-r,e}var Qv=Math.pow(2,7),Xv=Math.pow(2,14),eb=Math.pow(2,21),tb=Math.pow(2,28),nb=Math.pow(2,35),rb=Math.pow(2,42),ib=Math.pow(2,49),sb=Math.pow(2,56),ob=Math.pow(2,63),ab=function(n){return n<Qv?1:n<Xv?2:n<eb?3:n<tb?4:n<nb?5:n<rb?6:n<ib?7:n<sb?8:n<ob?9:10},cb={encode:Wv,decode:Yv,encodingLength:ab},rd=cb;const el=(n,t,e=0)=>(rd.encode(n,t,e),t),tl=n=>rd.encodingLength(n),lo=(n,t)=>{const e=t.byteLength,r=tl(n),i=r+tl(e),s=new Uint8Array(i+e);return el(n,s,0),el(e,s,r),s.set(t,i),new lb(n,e,t,s)};class lb{constructor(t,e,r,i){this.code=t,this.size=e,this.digest=r,this.bytes=i}}const id=({name:n,code:t,encode:e})=>new ub(n,t,e);class ub{constructor(t,e,r){this.name=t,this.code=e,this.encode=r}digest(t){if(t instanceof Uint8Array){const e=this.encode(t);return e instanceof Uint8Array?lo(this.code,e):e.then(r=>lo(this.code,r))}else throw Error("Unknown type, must be binary type")}}const sd=n=>async t=>new Uint8Array(await crypto.subtle.digest(n,t)),hb=id({name:"sha2-256",code:18,encode:sd("SHA-256")}),db=id({name:"sha2-512",code:19,encode:sd("SHA-512")});var pb=Object.freeze({__proto__:null,sha256:hb,sha512:db});const od=0,fb="identity",ad=Xh,_b=n=>lo(od,ad(n)),wb={code:od,name:fb,encode:ad,digest:_b};var mb=Object.freeze({__proto__:null,identity:wb});new TextEncoder,new TextDecoder;const nl={...uv,...dv,...fv,...wv,...gv,...Dv,...Vv,...$v,...qv,...Hv};({...pb,...mb});function cd(n){return globalThis.Buffer!=null?new Uint8Array(n.buffer,n.byteOffset,n.byteLength):n}function yb(n=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?cd(globalThis.Buffer.allocUnsafe(n)):new Uint8Array(n)}function ld(n,t,e,r){return{name:n,prefix:t,encoder:{name:n,prefix:t,encode:e},decoder:{decode:r}}}const rl=ld("utf8","u",n=>"u"+new TextDecoder("utf8").decode(n),n=>new TextEncoder().encode(n.substring(1))),gs=ld("ascii","a",n=>{let t="a";for(let e=0;e<n.length;e++)t+=String.fromCharCode(n[e]);return t},n=>{n=n.substring(1);const t=yb(n.length);for(let e=0;e<n.length;e++)t[e]=n.charCodeAt(e);return t}),gb={utf8:rl,"utf-8":rl,hex:nl.base16,latin1:gs,ascii:gs,binary:gs,...nl};function Eb(n,t="utf8"){const e=gb[t];if(!e)throw new Error(`Unsupported encoding "${t}"`);return(t==="utf8"||t==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?cd(globalThis.Buffer.from(n,"utf-8")):e.decoder.decode(`${e.prefix}${n}`)}var vb=Object.defineProperty,bb=(n,t,e)=>t in n?vb(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,At=(n,t,e)=>bb(n,typeof t!="symbol"?t+"":t,e);class Ib{constructor(t,e){this.core=t,this.logger=e,At(this,"keychain",new Map),At(this,"name",bE),At(this,"version",IE),At(this,"initialized",!1),At(this,"storagePrefix",xt),At(this,"init",async()=>{if(!this.initialized){const r=await this.getKeyChain();typeof r<"u"&&(this.keychain=r),this.initialized=!0}}),At(this,"has",r=>(this.isInitialized(),this.keychain.has(r))),At(this,"set",async(r,i)=>{this.isInitialized(),this.keychain.set(r,i),await this.persist()}),At(this,"get",r=>{this.isInitialized();const i=this.keychain.get(r);if(typeof i>"u"){const{message:s}=B("NO_MATCHING_KEY",`${this.name}: ${r}`);throw new Error(s)}return i}),At(this,"del",async r=>{this.isInitialized(),this.keychain.delete(r),await this.persist()}),this.core=t,this.logger=ze(e,this.name)}get context(){return rt(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(t){await this.core.storage.setItem(this.storageKey,Ws(t))}async getKeyChain(){const t=await this.core.storage.getItem(this.storageKey);return typeof t<"u"?Gs(t):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){const{message:t}=B("NOT_INITIALIZED",this.name);throw new Error(t)}}}var Ab=Object.defineProperty,Tb=(n,t,e)=>t in n?Ab(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,Te=(n,t,e)=>Tb(n,typeof t!="symbol"?t+"":t,e);class Pb{constructor(t,e,r){this.core=t,this.logger=e,Te(this,"name",EE),Te(this,"keychain"),Te(this,"randomSessionIdentifier",io()),Te(this,"initialized",!1),Te(this,"init",async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)}),Te(this,"hasKeys",i=>(this.isInitialized(),this.keychain.has(i))),Te(this,"getClientId",async()=>{this.isInitialized();const i=await this.getClientSeed(),s=Aa(i);return dp(s.publicKey)}),Te(this,"generateKeyPair",()=>{this.isInitialized();const i=s0();return this.setPrivateKey(i.publicKey,i.privateKey)}),Te(this,"signJWT",async i=>{this.isInitialized();const s=await this.getClientSeed(),o=Aa(s),c=this.randomSessionIdentifier;return await pp(c,i,vE,o)}),Te(this,"generateSharedKey",(i,s,o)=>{this.isInitialized();const c=this.getPrivateKey(i),l=o0(c,s);return this.setSymKey(l,o)}),Te(this,"setSymKey",async(i,s)=>{this.isInitialized();const o=s||li(i);return await this.keychain.set(o,i),o}),Te(this,"deleteKeyPair",async i=>{this.isInitialized(),await this.keychain.del(i)}),Te(this,"deleteSymKey",async i=>{this.isInitialized(),await this.keychain.del(i)}),Te(this,"encode",async(i,s,o)=>{this.isInitialized();const c=Kh(o),l=Do(s);if(Nc(c))return l0(l,o?.encoding);if(Uc(c)){const p=c.senderPublicKey,f=c.receiverPublicKey;i=await this.generateSharedKey(p,f)}const u=this.getSymKey(i),{type:h,senderPublicKey:d}=c;return a0({type:h,symKey:u,message:l,senderPublicKey:d,encoding:o?.encoding})}),Te(this,"decode",async(i,s,o)=>{this.isInitialized();const c=h0(s,o);if(Nc(c)){const l=u0(s,o?.encoding);return fi(l)}if(Uc(c)){const l=c.receiverPublicKey,u=c.senderPublicKey;i=await this.generateSharedKey(l,u)}try{const l=this.getSymKey(i),u=c0({symKey:l,encoded:s,encoding:o?.encoding});return fi(u)}catch(l){this.logger.error(`Failed to decode message from topic: '${i}', clientId: '${await this.getClientId()}'`),this.logger.error(l)}}),Te(this,"getPayloadType",(i,s=Ze)=>{const o=Vr({encoded:i,encoding:s});return Rn(o.type)}),Te(this,"getPayloadSenderPublicKey",(i,s=Ze)=>{const o=Vr({encoded:i,encoding:s});return o.senderPublicKey?Qe(o.senderPublicKey,Me):void 0}),this.core=t,this.logger=ze(e,this.name),this.keychain=r||new Ib(this.core,this.logger)}get context(){return rt(this.logger)}async setPrivateKey(t,e){return await this.keychain.set(t,e),t}getPrivateKey(t){return this.keychain.get(t)}async getClientSeed(){let t="";try{t=this.keychain.get(Yc)}catch{t=io(),await this.keychain.set(Yc,t)}return Eb(t,"base16")}getSymKey(t){return this.keychain.get(t)}isInitialized(){if(!this.initialized){const{message:t}=B("NOT_INITIALIZED",this.name);throw new Error(t)}}}var Ob=Object.defineProperty,Rb=Object.defineProperties,Db=Object.getOwnPropertyDescriptors,il=Object.getOwnPropertySymbols,Lb=Object.prototype.hasOwnProperty,xb=Object.prototype.propertyIsEnumerable,uo=(n,t,e)=>t in n?Ob(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,Vb=(n,t)=>{for(var e in t||(t={}))Lb.call(t,e)&&uo(n,e,t[e]);if(il)for(var e of il(t))xb.call(t,e)&&uo(n,e,t[e]);return n},Sb=(n,t)=>Rb(n,Db(t)),Xe=(n,t,e)=>uo(n,typeof t!="symbol"?t+"":t,e);class Cb extends B_{constructor(t,e){super(t,e),this.logger=t,this.core=e,Xe(this,"messages",new Map),Xe(this,"messagesWithoutClientAck",new Map),Xe(this,"name",AE),Xe(this,"version",TE),Xe(this,"initialized",!1),Xe(this,"storagePrefix",xt),Xe(this,"init",async()=>{if(!this.initialized){this.logger.trace("Initialized");try{const r=await this.getRelayerMessages();typeof r<"u"&&(this.messages=r);const i=await this.getRelayerMessagesWithoutClientAck();typeof i<"u"&&(this.messagesWithoutClientAck=i),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(r){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(r)}finally{this.initialized=!0}}}),Xe(this,"set",async(r,i,s)=>{this.isInitialized();const o=ct(i);let c=this.messages.get(r);if(typeof c>"u"&&(c={}),typeof c[o]<"u")return o;if(c[o]=i,this.messages.set(r,c),s===ui.inbound){const l=this.messagesWithoutClientAck.get(r)||{};this.messagesWithoutClientAck.set(r,Sb(Vb({},l),{[o]:i}))}return await this.persist(),o}),Xe(this,"get",r=>{this.isInitialized();let i=this.messages.get(r);return typeof i>"u"&&(i={}),i}),Xe(this,"getWithoutAck",r=>{this.isInitialized();const i={};for(const s of r){const o=this.messagesWithoutClientAck.get(s)||{};i[s]=Object.values(o)}return i}),Xe(this,"has",(r,i)=>{this.isInitialized();const s=this.get(r),o=ct(i);return typeof s[o]<"u"}),Xe(this,"ack",async(r,i)=>{this.isInitialized();const s=this.messagesWithoutClientAck.get(r);if(typeof s>"u")return;const o=ct(i);delete s[o],Object.keys(s).length===0?this.messagesWithoutClientAck.delete(r):this.messagesWithoutClientAck.set(r,s),await this.persist()}),Xe(this,"del",async r=>{this.isInitialized(),this.messages.delete(r),this.messagesWithoutClientAck.delete(r),await this.persist()}),this.logger=ze(t,this.name),this.core=e}get context(){return rt(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get storageKeyWithoutClientAck(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name+"_withoutClientAck"}async setRelayerMessages(t){await this.core.storage.setItem(this.storageKey,Ws(t))}async setRelayerMessagesWithoutClientAck(t){await this.core.storage.setItem(this.storageKeyWithoutClientAck,Ws(t))}async getRelayerMessages(){const t=await this.core.storage.getItem(this.storageKey);return typeof t<"u"?Gs(t):void 0}async getRelayerMessagesWithoutClientAck(){const t=await this.core.storage.getItem(this.storageKeyWithoutClientAck);return typeof t<"u"?Gs(t):void 0}async persist(){await this.setRelayerMessages(this.messages),await this.setRelayerMessagesWithoutClientAck(this.messagesWithoutClientAck)}isInitialized(){if(!this.initialized){const{message:t}=B("NOT_INITIALIZED",this.name);throw new Error(t)}}}var $b=Object.defineProperty,kb=Object.defineProperties,Ub=Object.getOwnPropertyDescriptors,sl=Object.getOwnPropertySymbols,Nb=Object.prototype.hasOwnProperty,Bb=Object.prototype.propertyIsEnumerable,ho=(n,t,e)=>t in n?$b(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,Un=(n,t)=>{for(var e in t||(t={}))Nb.call(t,e)&&ho(n,e,t[e]);if(sl)for(var e of sl(t))Bb.call(t,e)&&ho(n,e,t[e]);return n},ol=(n,t)=>kb(n,Ub(t)),ot=(n,t,e)=>ho(n,typeof t!="symbol"?t+"":t,e);class qb extends q_{constructor(t,e){super(t,e),this.relayer=t,this.logger=e,ot(this,"events",new Ln.EventEmitter),ot(this,"name",OE),ot(this,"queue",new Map),ot(this,"publishTimeout",M.toMiliseconds(M.ONE_MINUTE)),ot(this,"initialPublishTimeout",M.toMiliseconds(M.ONE_SECOND*15)),ot(this,"needsTransportRestart",!1),ot(this,"publish",async(r,i,s)=>{var o,c,l,u,h;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:r,message:i,opts:s}});const d=s?.ttl||PE,p=s?.prompt||!1,f=s?.tag||0,w=s?.id||gn().toString(),m=qn(Di().protocol),_={id:w,method:s?.publishMethod||m.publish,params:Un({topic:r,message:i,ttl:d,prompt:p,tag:f,attestation:s?.attestation},s?.tvf&&{tvf:s.tvf})},E=`Failed to publish payload, please try again. id:${w} tag:${f}`;try{we((o=_.params)==null?void 0:o.prompt)&&((c=_.params)==null||delete c.prompt),we((l=_.params)==null?void 0:l.tag)&&((u=_.params)==null||delete u.tag);const v=new Promise(async g=>{const I=({id:L})=>{var x;((x=_.id)==null?void 0:x.toString())===L.toString()&&(this.removeRequestFromQueue(L),this.relayer.events.removeListener(ue.publish,I),g())};this.relayer.events.on(ue.publish,I);const b=Dt(new Promise((L,x)=>{this.rpcPublish(_,s).then(L).catch(S=>{this.logger.warn(S,S?.message),x(S)})}),this.initialPublishTimeout,`Failed initial publish, retrying.... id:${w} tag:${f}`);try{await b,this.events.removeListener(ue.publish,I)}catch(L){this.queue.set(w,{request:_,opts:s,attempt:1}),this.logger.warn(L,L?.message)}});this.logger.trace({type:"method",method:"publish",params:{id:w,topic:r,message:i,opts:s}}),await Dt(v,this.publishTimeout,E)}catch(v){if(this.logger.debug("Failed to Publish Payload"),this.logger.error(v),(h=s?.internal)!=null&&h.throwOnFailedPublish)throw v}finally{this.queue.delete(w)}}),ot(this,"publishCustom",async r=>{var i,s,o,c,l;this.logger.debug("Publishing custom payload"),this.logger.trace({type:"method",method:"publishCustom",params:r});const{payload:u,opts:h={}}=r,{attestation:d,tvf:p,publishMethod:f,prompt:w,tag:m,ttl:_=M.FIVE_MINUTES}=h,E=h.id||gn().toString(),v=qn(Di().protocol),g=f||v.publish,I={id:E,method:g,params:Un(ol(Un({},u),{ttl:_,prompt:w,tag:m,attestation:d}),p)},b=`Failed to publish custom payload, please try again. id:${E} tag:${m}`;try{we((i=I.params)==null?void 0:i.prompt)&&((s=I.params)==null||delete s.prompt),we((o=I.params)==null?void 0:o.tag)&&((c=I.params)==null||delete c.tag);const L=new Promise(async x=>{const S=({id:D})=>{var T;((T=I.id)==null?void 0:T.toString())===D.toString()&&(this.removeRequestFromQueue(D),this.relayer.events.removeListener(ue.publish,S),x())};this.relayer.events.on(ue.publish,S);const y=Dt(new Promise((D,T)=>{this.rpcPublish(I,h).then(D).catch(O=>{this.logger.warn(O,O?.message),T(O)})}),this.initialPublishTimeout,`Failed initial custom payload publish, retrying.... method:${g} id:${E} tag:${m}`);try{await y,this.events.removeListener(ue.publish,S)}catch(D){this.queue.set(E,{request:I,opts:h,attempt:1}),this.logger.warn(D,D?.message)}});this.logger.trace({type:"method",method:"publish",params:{id:E,payload:u,opts:h}}),await Dt(L,this.publishTimeout,b)}catch(L){if(this.logger.debug("Failed to Publish Payload"),this.logger.error(L),(l=h?.internal)!=null&&l.throwOnFailedPublish)throw L}finally{this.queue.delete(E)}}),ot(this,"on",(r,i)=>{this.events.on(r,i)}),ot(this,"once",(r,i)=>{this.events.once(r,i)}),ot(this,"off",(r,i)=>{this.events.off(r,i)}),ot(this,"removeListener",(r,i)=>{this.events.removeListener(r,i)}),this.relayer=t,this.logger=ze(e,this.name),this.registerEventListeners()}get context(){return rt(this.logger)}async rpcPublish(t,e){this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:t});const r=await this.relayer.request(t);return this.relayer.events.emit(ue.publish,Un(Un({},t),e)),this.logger.debug("Successfully Published Payload"),r}removeRequestFromQueue(t){this.queue.delete(t)}checkQueue(){this.queue.forEach(async(t,e)=>{var r;const i=t.attempt+1;this.queue.set(e,ol(Un({},t),{attempt:i})),this.logger.warn({},`Publisher: queue->publishing: ${t.request.id}, tag: ${(r=t.request.params)==null?void 0:r.tag}, attempt: ${i}`),await this.rpcPublish(t.request,t.opts),this.logger.warn({},`Publisher: queue->published: ${t.request.id}`)})}registerEventListeners(){this.relayer.core.heartbeat.on(Gn.pulse,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit(ue.connection_stalled);return}this.checkQueue()}),this.relayer.on(ue.message_ack,t=>{this.removeRequestFromQueue(t.id.toString())})}}var Mb=Object.defineProperty,zb=(n,t,e)=>t in n?Mb(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,Nn=(n,t,e)=>zb(n,typeof t!="symbol"?t+"":t,e);class jb{constructor(){Nn(this,"map",new Map),Nn(this,"set",(t,e)=>{const r=this.get(t);this.exists(t,e)||this.map.set(t,[...r,e])}),Nn(this,"get",t=>this.map.get(t)||[]),Nn(this,"exists",(t,e)=>this.get(t).includes(e)),Nn(this,"delete",(t,e)=>{if(typeof e>"u"){this.map.delete(t);return}if(!this.map.has(t))return;const r=this.get(t);if(!this.exists(t,e))return;const i=r.filter(s=>s!==e);if(!i.length){this.map.delete(t);return}this.map.set(t,i)}),Nn(this,"clear",()=>{this.map.clear()})}get topics(){return Array.from(this.map.keys())}}var Kb=Object.defineProperty,Fb=Object.defineProperties,Hb=Object.getOwnPropertyDescriptors,al=Object.getOwnPropertySymbols,Wb=Object.prototype.hasOwnProperty,Gb=Object.prototype.propertyIsEnumerable,po=(n,t,e)=>t in n?Kb(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,ur=(n,t)=>{for(var e in t||(t={}))Wb.call(t,e)&&po(n,e,t[e]);if(al)for(var e of al(t))Gb.call(t,e)&&po(n,e,t[e]);return n},Es=(n,t)=>Fb(n,Hb(t)),se=(n,t,e)=>po(n,typeof t!="symbol"?t+"":t,e);class Zb extends j_{constructor(t,e){super(t,e),this.relayer=t,this.logger=e,se(this,"subscriptions",new Map),se(this,"topicMap",new jb),se(this,"events",new Ln.EventEmitter),se(this,"name",CE),se(this,"version",$E),se(this,"pending",new Map),se(this,"cached",[]),se(this,"initialized",!1),se(this,"storagePrefix",xt),se(this,"subscribeTimeout",M.toMiliseconds(M.ONE_MINUTE)),se(this,"initialSubscribeTimeout",M.toMiliseconds(M.ONE_SECOND*15)),se(this,"clientId"),se(this,"batchSubscribeTopicsLimit",500),se(this,"init",async()=>{this.initialized||(this.logger.trace("Initialized"),this.registerEventListeners(),await this.restore()),this.initialized=!0}),se(this,"subscribe",async(r,i)=>{var s;this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:r,opts:i}});try{const o=Di(i),c={topic:r,relay:o,transportType:i?.transportType};(s=i?.internal)!=null&&s.skipSubscribe||this.pending.set(r,c);const l=await this.rpcSubscribe(r,o,i);return typeof l=="string"&&(this.onSubscribe(l,c),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:r,opts:i}})),l}catch(o){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(o),o}}),se(this,"unsubscribe",async(r,i)=>{this.isInitialized(),typeof i?.id<"u"?await this.unsubscribeById(r,i.id,i):await this.unsubscribeByTopic(r,i)}),se(this,"isSubscribed",r=>new Promise(i=>{i(this.topicMap.topics.includes(r))})),se(this,"isKnownTopic",r=>new Promise(i=>{i(this.topicMap.topics.includes(r)||this.pending.has(r)||this.cached.some(s=>s.topic===r))})),se(this,"on",(r,i)=>{this.events.on(r,i)}),se(this,"once",(r,i)=>{this.events.once(r,i)}),se(this,"off",(r,i)=>{this.events.off(r,i)}),se(this,"removeListener",(r,i)=>{this.events.removeListener(r,i)}),se(this,"start",async()=>{await this.onConnect()}),se(this,"stop",async()=>{await this.onDisconnect()}),se(this,"restart",async()=>{await this.restore(),await this.onRestart()}),se(this,"checkPending",async()=>{if(this.pending.size===0&&(!this.initialized||!this.relayer.connected))return;const r=[];this.pending.forEach(i=>{r.push(i)}),await this.batchSubscribe(r)}),se(this,"registerEventListeners",()=>{this.relayer.core.heartbeat.on(Gn.pulse,async()=>{await this.checkPending()}),this.events.on(et.created,async r=>{const i=et.created;this.logger.info(`Emitting ${i}`),this.logger.debug({type:"event",event:i,data:r}),await this.persist()}),this.events.on(et.deleted,async r=>{const i=et.deleted;this.logger.info(`Emitting ${i}`),this.logger.debug({type:"event",event:i,data:r}),await this.persist()})}),this.relayer=t,this.logger=ze(e,this.name),this.clientId=""}get context(){return rt(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.relayer.core.customStoragePrefix+"//"+this.name}get length(){return this.subscriptions.size}get ids(){return Array.from(this.subscriptions.keys())}get values(){return Array.from(this.subscriptions.values())}get topics(){return this.topicMap.topics}get hasAnyTopics(){return this.topicMap.topics.length>0||this.pending.size>0||this.cached.length>0||this.subscriptions.size>0}hasSubscription(t,e){let r=!1;try{r=this.getSubscription(t).topic===e}catch{}return r}reset(){this.cached=[],this.initialized=!0}onDisable(){this.values.length>0&&(this.cached=this.values),this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(t,e){const r=this.topicMap.get(t);await Promise.all(r.map(async i=>await this.unsubscribeById(t,i,e)))}async unsubscribeById(t,e,r){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:t,id:e,opts:r}});try{const i=Di(r);await this.restartToComplete({topic:t,id:e,relay:i}),await this.rpcUnsubscribe(t,e,i);const s=le("USER_DISCONNECTED",`${this.name}, ${t}`);await this.onUnsubscribe(t,e,s),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:t,id:e,opts:r}})}catch(i){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(i),i}}async rpcSubscribe(t,e,r){var i,s;const o=await this.getSubscriptionId(t);if((i=r?.internal)!=null&&i.skipSubscribe)return o;(!r||r?.transportType===ae.relay)&&await this.restartToComplete({topic:t,id:t,relay:e});const c={method:qn(e.protocol).subscribe,params:{topic:t}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:c});const l=(s=r?.internal)==null?void 0:s.throwOnFailedPublish;try{if(r?.transportType===ae.link_mode)return setTimeout(()=>{(this.relayer.connected||this.relayer.connecting)&&this.relayer.request(c).catch(d=>this.logger.warn(d))},M.toMiliseconds(M.ONE_SECOND)),o;const u=new Promise(async d=>{const p=f=>{f.topic===t&&(this.events.removeListener(et.created,p),d(f.id))};this.events.on(et.created,p);try{const f=await Dt(new Promise((w,m)=>{this.relayer.request(c).catch(_=>{this.logger.warn(_,_?.message),m(_)}).then(w)}),this.initialSubscribeTimeout,`Subscribing to ${t} failed, please try again`);this.events.removeListener(et.created,p),d(f)}catch{}}),h=await Dt(u,this.subscribeTimeout,`Subscribing to ${t} failed, please try again`);if(!h&&l)throw new Error(`Subscribing to ${t} failed, please try again`);return h?o:null}catch(u){if(this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(ue.connection_stalled),l)throw u}return null}async rpcBatchSubscribe(t){if(!t.length)return;const e=t[0].relay,r={method:qn(e.protocol).batchSubscribe,params:{topics:t.map(i=>i.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:r});try{await await Dt(new Promise(i=>{this.relayer.request(r).catch(s=>this.logger.warn(s)).then(i)}),this.subscribeTimeout,"rpcBatchSubscribe failed, please try again")}catch{this.relayer.events.emit(ue.connection_stalled)}}async rpcBatchFetchMessages(t){if(!t.length)return;const e=t[0].relay,r={method:qn(e.protocol).batchFetchMessages,params:{topics:t.map(s=>s.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:r});let i;try{i=await await Dt(new Promise((s,o)=>{this.relayer.request(r).catch(c=>{this.logger.warn(c),o(c)}).then(s)}),this.subscribeTimeout,"rpcBatchFetchMessages failed, please try again")}catch{this.relayer.events.emit(ue.connection_stalled)}return i}rpcUnsubscribe(t,e,r){const i={method:qn(r.protocol).unsubscribe,params:{topic:t,id:e}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i}),this.relayer.request(i)}onSubscribe(t,e){this.setSubscription(t,Es(ur({},e),{id:t})),this.pending.delete(e.topic)}onBatchSubscribe(t){t.length&&t.forEach(e=>{this.setSubscription(e.id,ur({},e)),this.pending.delete(e.topic)})}async onUnsubscribe(t,e,r){this.events.removeAllListeners(e),this.hasSubscription(e,t)&&this.deleteSubscription(e,r),await this.relayer.messages.del(t)}async setRelayerSubscriptions(t){await this.relayer.core.storage.setItem(this.storageKey,t)}async getRelayerSubscriptions(){return await this.relayer.core.storage.getItem(this.storageKey)}setSubscription(t,e){this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:t,subscription:e}),this.addSubscription(t,e)}addSubscription(t,e){this.subscriptions.set(t,ur({},e)),this.topicMap.set(e.topic,t),this.events.emit(et.created,e)}getSubscription(t){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:t});const e=this.subscriptions.get(t);if(!e){const{message:r}=B("NO_MATCHING_KEY",`${this.name}: ${t}`);throw new Error(r)}return e}deleteSubscription(t,e){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:t,reason:e});const r=this.getSubscription(t);this.subscriptions.delete(t),this.topicMap.delete(r.topic,t),this.events.emit(et.deleted,Es(ur({},r),{reason:e}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(et.sync)}async onRestart(){if(this.cached.length){const t=[...this.cached],e=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let r=0;r<e;r++){const i=t.splice(0,this.batchSubscribeTopicsLimit);await this.batchSubscribe(i)}}this.events.emit(et.resubscribed)}async restore(){try{const t=await this.getRelayerSubscriptions();if(typeof t>"u"||!t.length)return;if(this.subscriptions.size&&!t.every(e=>{var r;return e.topic===((r=this.subscriptions.get(e.id))==null?void 0:r.topic)})){const{message:e}=B("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(e)}this.cached=t,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:"method",method:"restore",subscriptions:this.values})}catch(t){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(t)}}async batchSubscribe(t){t.length&&(await this.rpcBatchSubscribe(t),this.onBatchSubscribe(await Promise.all(t.map(async e=>Es(ur({},e),{id:await this.getSubscriptionId(e.topic)})))))}async batchFetchMessages(t){if(!t.length)return;this.logger.trace(`Fetching batch messages for ${t.length} subscriptions`);const e=await this.rpcBatchFetchMessages(t);e&&e.messages&&(await Om(M.toMiliseconds(M.ONE_SECOND)),await this.relayer.handleBatchMessageEvents(e.messages))}async onConnect(){await this.restart(),this.reset()}onDisconnect(){this.onDisable()}isInitialized(){if(!this.initialized){const{message:t}=B("NOT_INITIALIZED",this.name);throw new Error(t)}}async restartToComplete(t){!this.relayer.connected&&!this.relayer.connecting&&(this.cached.push(t),await this.relayer.transportOpen())}async getClientId(){return this.clientId||(this.clientId=await this.relayer.core.crypto.getClientId()),this.clientId}async getSubscriptionId(t){return ct(t+await this.getClientId())}}var Yb=Object.defineProperty,cl=Object.getOwnPropertySymbols,Jb=Object.prototype.hasOwnProperty,Qb=Object.prototype.propertyIsEnumerable,fo=(n,t,e)=>t in n?Yb(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,ll=(n,t)=>{for(var e in t||(t={}))Jb.call(t,e)&&fo(n,e,t[e]);if(cl)for(var e of cl(t))Qb.call(t,e)&&fo(n,e,t[e]);return n},X=(n,t,e)=>fo(n,typeof t!="symbol"?t+"":t,e);class Xb extends M_{constructor(t){super(t),X(this,"protocol","wc"),X(this,"version",2),X(this,"core"),X(this,"logger"),X(this,"events",new Ln.EventEmitter),X(this,"provider"),X(this,"messages"),X(this,"subscriber"),X(this,"publisher"),X(this,"name",DE),X(this,"transportExplicitlyClosed",!1),X(this,"initialized",!1),X(this,"connectionAttemptInProgress",!1),X(this,"relayUrl"),X(this,"projectId"),X(this,"packageName"),X(this,"bundleId"),X(this,"hasExperiencedNetworkDisruption",!1),X(this,"pingTimeout"),X(this,"heartBeatTimeout",M.toMiliseconds(M.THIRTY_SECONDS+M.FIVE_SECONDS)),X(this,"reconnectTimeout"),X(this,"connectPromise"),X(this,"reconnectInProgress",!1),X(this,"requestsInFlight",[]),X(this,"connectTimeout",M.toMiliseconds(M.ONE_SECOND*15)),X(this,"request",async e=>{var r,i;this.logger.debug("Publishing Request Payload");const s=e.id||gn().toString();await this.toEstablishConnection();try{this.logger.trace({id:s,method:e.method,topic:(r=e.params)==null?void 0:r.topic},"relayer.request - publishing...");const o=`${s}:${((i=e.params)==null?void 0:i.tag)||""}`;this.requestsInFlight.push(o);const c=await this.provider.request(e);return this.requestsInFlight=this.requestsInFlight.filter(l=>l!==o),c}catch(o){throw this.logger.debug(`Failed to Publish Request: ${s}`),o}}),X(this,"resetPingTimeout",()=>{Ti()&&(clearTimeout(this.pingTimeout),this.pingTimeout=setTimeout(()=>{var e,r,i,s;try{this.logger.debug({},"pingTimeout: Connection stalled, terminating..."),(s=(i=(r=(e=this.provider)==null?void 0:e.connection)==null?void 0:r.socket)==null?void 0:i.terminate)==null||s.call(i)}catch(o){this.logger.warn(o,o?.message)}},this.heartBeatTimeout))}),X(this,"onPayloadHandler",e=>{this.onProviderPayload(e),this.resetPingTimeout()}),X(this,"onConnectHandler",()=>{this.logger.warn({},"Relayer connected 🛜"),this.startPingTimeout(),this.events.emit(ue.connect)}),X(this,"onDisconnectHandler",()=>{this.logger.warn({},"Relayer disconnected 🛑"),this.requestsInFlight=[],this.onProviderDisconnect()}),X(this,"onProviderErrorHandler",e=>{this.logger.fatal(`Fatal socket error: ${e.message}`),this.events.emit(ue.error,e),this.logger.fatal("Fatal socket error received, closing transport"),this.transportClose()}),X(this,"registerProviderListeners",()=>{this.provider.on(st.payload,this.onPayloadHandler),this.provider.on(st.connect,this.onConnectHandler),this.provider.on(st.disconnect,this.onDisconnectHandler),this.provider.on(st.error,this.onProviderErrorHandler)}),this.core=t.core,this.logger=typeof t.logger<"u"&&typeof t.logger!="string"?ze(t.logger,this.name):jl(Lo({level:t.logger||RE})),this.messages=new Cb(this.logger,t.core),this.subscriber=new Zb(this,this.logger),this.publisher=new qb(this,this.logger),this.projectId=t?.projectId,this.relayUrl=t?.relayUrl||Jh,hm()?this.packageName=sc():dm()&&(this.bundleId=sc()),this.provider={}}async init(){this.logger.trace("Initialized"),this.registerEventListeners(),await Promise.all([this.messages.init(),this.subscriber.init()]),this.initialized=!0,this.transportOpen().catch(t=>this.logger.warn(t,t?.message))}get context(){return rt(this.logger)}get connected(){var t,e,r;return((r=(e=(t=this.provider)==null?void 0:t.connection)==null?void 0:e.socket)==null?void 0:r.readyState)===1||!1}get connecting(){var t,e,r;return((r=(e=(t=this.provider)==null?void 0:t.connection)==null?void 0:e.socket)==null?void 0:r.readyState)===0||this.connectPromise!==void 0||!1}async publish(t,e,r){this.isInitialized(),await this.publisher.publish(t,e,r),await this.recordMessageEvent({topic:t,message:e,publishedAt:Date.now(),transportType:ae.relay},ui.outbound)}async publishCustom(t){this.isInitialized(),await this.publisher.publishCustom(t)}async subscribe(t,e){var r,i,s;this.isInitialized(),(!(e!=null&&e.transportType)||e?.transportType==="relay")&&await this.toEstablishConnection();const o=typeof((r=e?.internal)==null?void 0:r.throwOnFailedPublish)>"u"?!0:(i=e?.internal)==null?void 0:i.throwOnFailedPublish;let c=((s=this.subscriber.topicMap.get(t))==null?void 0:s[0])||"",l;const u=h=>{h.topic===t&&(this.subscriber.off(et.created,u),l())};return await Promise.all([new Promise(h=>{l=h,this.subscriber.on(et.created,u)}),new Promise(async(h,d)=>{c=await this.subscriber.subscribe(t,ll({internal:{throwOnFailedPublish:o}},e)).catch(p=>{o&&d(p)})||c,h()})]),c}async unsubscribe(t,e){this.isInitialized(),await this.subscriber.unsubscribe(t,e)}on(t,e){this.events.on(t,e)}once(t,e){this.events.once(t,e)}off(t,e){this.events.off(t,e)}removeListener(t,e){this.events.removeListener(t,e)}async transportDisconnect(){this.provider.disconnect&&(this.hasExperiencedNetworkDisruption||this.connected)?await Dt(this.provider.disconnect(),2e3,"provider.disconnect()").catch(()=>this.onProviderDisconnect()):this.onProviderDisconnect()}async transportClose(){this.transportExplicitlyClosed=!0,await this.transportDisconnect()}async transportOpen(t){if(!this.subscriber.hasAnyTopics){this.logger.info("Starting WS connection skipped because the client has no topics to work with.");return}if(this.connectPromise?(this.logger.debug({},"Waiting for existing connection attempt to resolve..."),await this.connectPromise,this.logger.debug({},"Existing connection attempt resolved")):(this.connectPromise=new Promise(async(e,r)=>{await this.connect(t).then(e).catch(r).finally(()=>{this.connectPromise=void 0})}),await this.connectPromise),!this.connected)throw new Error(`Couldn't establish socket connection to the relay server: ${this.relayUrl}`)}async restartTransport(t){this.logger.debug({},"Restarting transport..."),!this.connectionAttemptInProgress&&(this.relayUrl=t||this.relayUrl,await this.confirmOnlineStateOrThrow(),await this.transportClose(),await this.transportOpen())}async confirmOnlineStateOrThrow(){if(!await Zc())throw new Error("No internet connection detected. Please restart your network and try again.")}async handleBatchMessageEvents(t){if(t?.length===0){this.logger.trace("Batch message events is empty. Ignoring...");return}const e=t.sort((r,i)=>r.publishedAt-i.publishedAt);this.logger.debug(`Batch of ${e.length} message events sorted`);for(const r of e)try{await this.onMessageEvent(r)}catch(i){this.logger.warn(i,"Error while processing batch message event: "+i?.message)}this.logger.trace(`Batch of ${e.length} message events processed`)}async onLinkMessageEvent(t,e){const{topic:r}=t;if(!e.sessionExists){const i=_e(M.FIVE_MINUTES),s={topic:r,expiry:i,relay:{protocol:"irn"},active:!1};await this.core.pairing.pairings.set(r,s)}this.events.emit(ue.message,t),await this.recordMessageEvent(t,ui.inbound)}async connect(t){await this.confirmOnlineStateOrThrow(),t&&t!==this.relayUrl&&(this.relayUrl=t,await this.transportDisconnect()),this.connectionAttemptInProgress=!0,this.transportExplicitlyClosed=!1;let e=1;for(;e<6;){try{if(this.transportExplicitlyClosed)break;this.logger.debug({},`Connecting to ${this.relayUrl}, attempt: ${e}...`),await this.createProvider(),await new Promise(async(r,i)=>{const s=()=>{i(new Error("Connection interrupted while trying to connect"))};this.provider.once(st.disconnect,s),await Dt(new Promise((o,c)=>{this.provider.connect().then(o).catch(c)}),this.connectTimeout,`Socket stalled when trying to connect to ${this.relayUrl}`).catch(o=>{i(o)}).finally(()=>{this.provider.off(st.disconnect,s),clearTimeout(this.reconnectTimeout)}),await new Promise(async(o,c)=>{const l=()=>{i(new Error("Connection interrupted while trying to subscribe"))};this.provider.once(st.disconnect,l),await this.subscriber.start().then(o).catch(c).finally(()=>{this.provider.off(st.disconnect,l)})}),this.hasExperiencedNetworkDisruption=!1,r()})}catch(r){await this.subscriber.stop();const i=r;this.logger.warn({},i.message),this.hasExperiencedNetworkDisruption=!0}finally{this.connectionAttemptInProgress=!1}if(this.connected){this.logger.debug({},`Connected to ${this.relayUrl} successfully on attempt: ${e}`);break}await new Promise(r=>setTimeout(r,M.toMiliseconds(e*1))),e++}}startPingTimeout(){var t,e,r,i,s;if(Ti())try{(e=(t=this.provider)==null?void 0:t.connection)!=null&&e.socket&&((s=(i=(r=this.provider)==null?void 0:r.connection)==null?void 0:i.socket)==null||s.on("ping",()=>{this.resetPingTimeout()})),this.resetPingTimeout()}catch(o){this.logger.warn(o,o?.message)}}async createProvider(){this.provider.connection&&this.unregisterProviderListeners();const t=await this.core.crypto.signJWT(this.relayUrl);this.provider=new up(new hp(mm({sdkVersion:ao,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:t,useOnCloseEvent:!0,bundleId:this.bundleId,packageName:this.packageName}))),this.registerProviderListeners()}async recordMessageEvent(t,e){const{topic:r,message:i}=t;await this.messages.set(r,i,e)}async shouldIgnoreMessageEvent(t){const{topic:e,message:r}=t;if(!r||r.length===0)return this.logger.warn(`Ignoring invalid/empty message: ${r}`),!0;if(!await this.subscriber.isKnownTopic(e))return this.logger.warn(`Ignoring message for unknown topic ${e}`),!0;const i=this.messages.has(e,r);return i&&this.logger.warn(`Ignoring duplicate message: ${r}`),i}async onProviderPayload(t){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:t}),xo(t)){if(!t.method.endsWith(LE))return;const e=t.params,{topic:r,message:i,publishedAt:s,attestation:o}=e.data,c={topic:r,message:i,publishedAt:s,transportType:ae.relay,attestation:o};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(ll({type:"event",event:e.id},c)),this.events.emit(e.id,c),await this.acknowledgePayload(t),await this.onMessageEvent(c)}else Vo(t)&&this.events.emit(ue.message_ack,t)}async onMessageEvent(t){await this.shouldIgnoreMessageEvent(t)||(await this.recordMessageEvent(t,ui.inbound),this.events.emit(ue.message,t))}async acknowledgePayload(t){const e=_i(t.id,!0);await this.provider.connection.send(e)}unregisterProviderListeners(){this.provider.off(st.payload,this.onPayloadHandler),this.provider.off(st.connect,this.onConnectHandler),this.provider.off(st.disconnect,this.onDisconnectHandler),this.provider.off(st.error,this.onProviderErrorHandler),clearTimeout(this.pingTimeout)}async registerEventListeners(){let t=await Zc();sE(async e=>{t!==e&&(t=e,e?await this.transportOpen().catch(r=>this.logger.error(r,r?.message)):(this.hasExperiencedNetworkDisruption=!0,await this.transportDisconnect(),this.transportExplicitlyClosed=!1))}),this.core.heartbeat.on(Gn.pulse,async()=>{if(!this.transportExplicitlyClosed&&!this.connected&&cE())try{await this.confirmOnlineStateOrThrow(),await this.transportOpen()}catch(e){this.logger.warn(e,e?.message)}})}async onProviderDisconnect(){clearTimeout(this.pingTimeout),this.events.emit(ue.disconnect),this.connectionAttemptInProgress=!1,!this.reconnectInProgress&&(this.reconnectInProgress=!0,await this.subscriber.stop(),this.subscriber.hasAnyTopics&&(this.transportExplicitlyClosed||(this.reconnectTimeout=setTimeout(async()=>{await this.transportOpen().catch(t=>this.logger.error(t,t?.message)),this.reconnectTimeout=void 0,this.reconnectInProgress=!1},M.toMiliseconds(xE)))))}isInitialized(){if(!this.initialized){const{message:t}=B("NOT_INITIALIZED",this.name);throw new Error(t)}}async toEstablishConnection(){if(await this.confirmOnlineStateOrThrow(),!this.connected){if(this.connectPromise){await this.connectPromise;return}await this.connect()}}}function eI(n,t){return n===t||Number.isNaN(n)&&Number.isNaN(t)}function ul(n){return Object.getOwnPropertySymbols(n).filter(t=>Object.prototype.propertyIsEnumerable.call(n,t))}function hl(n){return n==null?n===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(n)}const tI="[object RegExp]",nI="[object String]",rI="[object Number]",iI="[object Boolean]",dl="[object Arguments]",sI="[object Symbol]",oI="[object Date]",aI="[object Map]",cI="[object Set]",lI="[object Array]",uI="[object Function]",hI="[object ArrayBuffer]",vs="[object Object]",dI="[object Error]",pI="[object DataView]",fI="[object Uint8Array]",_I="[object Uint8ClampedArray]",wI="[object Uint16Array]",mI="[object Uint32Array]",yI="[object BigUint64Array]",gI="[object Int8Array]",EI="[object Int16Array]",vI="[object Int32Array]",bI="[object BigInt64Array]",II="[object Float32Array]",AI="[object Float64Array]";function TI(){}function pl(n){if(!n||typeof n!="object")return!1;const t=Object.getPrototypeOf(n);return t===null||t===Object.prototype||Object.getPrototypeOf(t)===null?Object.prototype.toString.call(n)==="[object Object]":!1}function PI(n,t,e){return wr(n,t,void 0,void 0,void 0,void 0,e)}function wr(n,t,e,r,i,s,o){const c=o(n,t,e,r,i,s);if(c!==void 0)return c;if(typeof n==typeof t)switch(typeof n){case"bigint":case"string":case"boolean":case"symbol":case"undefined":return n===t;case"number":return n===t||Object.is(n,t);case"function":return n===t;case"object":return Ar(n,t,s,o)}return Ar(n,t,s,o)}function Ar(n,t,e,r){if(Object.is(n,t))return!0;let i=hl(n),s=hl(t);if(i===dl&&(i=vs),s===dl&&(s=vs),i!==s)return!1;switch(i){case nI:return n.toString()===t.toString();case rI:{const l=n.valueOf(),u=t.valueOf();return eI(l,u)}case iI:case oI:case sI:return Object.is(n.valueOf(),t.valueOf());case tI:return n.source===t.source&&n.flags===t.flags;case uI:return n===t}e=e??new Map;const o=e.get(n),c=e.get(t);if(o!=null&&c!=null)return o===t;e.set(n,t),e.set(t,n);try{switch(i){case aI:{if(n.size!==t.size)return!1;for(const[l,u]of n.entries())if(!t.has(l)||!wr(u,t.get(l),l,n,t,e,r))return!1;return!0}case cI:{if(n.size!==t.size)return!1;const l=Array.from(n.values()),u=Array.from(t.values());for(let h=0;h<l.length;h++){const d=l[h],p=u.findIndex(f=>wr(d,f,void 0,n,t,e,r));if(p===-1)return!1;u.splice(p,1)}return!0}case lI:case fI:case _I:case wI:case mI:case yI:case gI:case EI:case vI:case bI:case II:case AI:{if(typeof Buffer<"u"&&Buffer.isBuffer(n)!==Buffer.isBuffer(t)||n.length!==t.length)return!1;for(let l=0;l<n.length;l++)if(!wr(n[l],t[l],l,n,t,e,r))return!1;return!0}case hI:return n.byteLength!==t.byteLength?!1:Ar(new Uint8Array(n),new Uint8Array(t),e,r);case pI:return n.byteLength!==t.byteLength||n.byteOffset!==t.byteOffset?!1:Ar(new Uint8Array(n),new Uint8Array(t),e,r);case dI:return n.name===t.name&&n.message===t.message;case vs:{if(!(Ar(n.constructor,t.constructor,e,r)||pl(n)&&pl(t)))return!1;const l=[...Object.keys(n),...ul(n)],u=[...Object.keys(t),...ul(t)];if(l.length!==u.length)return!1;for(let h=0;h<l.length;h++){const d=l[h],p=n[d];if(!Object.hasOwn(t,d))return!1;const f=t[d];if(!wr(p,f,d,n,t,e,r))return!1}return!0}default:return!1}}finally{e.delete(n),e.delete(t)}}function OI(n,t){return PI(n,t,TI)}var RI=Object.defineProperty,fl=Object.getOwnPropertySymbols,DI=Object.prototype.hasOwnProperty,LI=Object.prototype.propertyIsEnumerable,_o=(n,t,e)=>t in n?RI(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,_l=(n,t)=>{for(var e in t||(t={}))DI.call(t,e)&&_o(n,e,t[e]);if(fl)for(var e of fl(t))LI.call(t,e)&&_o(n,e,t[e]);return n},je=(n,t,e)=>_o(n,typeof t!="symbol"?t+"":t,e);class Sn extends z_{constructor(t,e,r,i=xt,s=void 0){super(t,e,r,i),this.core=t,this.logger=e,this.name=r,je(this,"map",new Map),je(this,"version",VE),je(this,"cached",[]),je(this,"initialized",!1),je(this,"getKey"),je(this,"storagePrefix",xt),je(this,"recentlyDeleted",[]),je(this,"recentlyDeletedLimit",200),je(this,"init",async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(o=>{this.getKey&&o!==null&&!we(o)?this.map.set(this.getKey(o),o):k0(o)?this.map.set(o.id,o):U0(o)&&this.map.set(o.topic,o)}),this.cached=[],this.initialized=!0)}),je(this,"set",async(o,c)=>{this.isInitialized(),this.map.has(o)?await this.update(o,c):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:o,value:c}),this.map.set(o,c),await this.persist())}),je(this,"get",o=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:o}),this.getData(o))),je(this,"getAll",o=>(this.isInitialized(),o?this.values.filter(c=>Object.keys(o).every(l=>OI(c[l],o[l]))):this.values)),je(this,"update",async(o,c)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:o,update:c});const l=_l(_l({},this.getData(o)),c);this.map.set(o,l),await this.persist()}),je(this,"delete",async(o,c)=>{this.isInitialized(),this.map.has(o)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:o,reason:c}),this.map.delete(o),this.addToRecentlyDeleted(o),await this.persist())}),this.logger=ze(e,this.name),this.storagePrefix=i,this.getKey=s}get context(){return rt(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.map.size}get keys(){return Array.from(this.map.keys())}get values(){return Array.from(this.map.values())}addToRecentlyDeleted(t){this.recentlyDeleted.push(t),this.recentlyDeleted.length>=this.recentlyDeletedLimit&&this.recentlyDeleted.splice(0,this.recentlyDeletedLimit/2)}async setDataStore(t){await this.core.storage.setItem(this.storageKey,t)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(t){const e=this.map.get(t);if(!e){if(this.recentlyDeleted.includes(t)){const{message:i}=B("MISSING_OR_INVALID",`Record was recently deleted - ${this.name}: ${t}`);throw this.logger.error(i),new Error(i)}const{message:r}=B("NO_MATCHING_KEY",`${this.name}: ${t}`);throw this.logger.error(r),new Error(r)}return e}async persist(){await this.setDataStore(this.values)}async restore(){try{const t=await this.getDataStore();if(typeof t>"u"||!t.length)return;if(this.map.size){const{message:e}=B("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),new Error(e)}this.cached=t,this.logger.debug(`Successfully Restored value for ${this.name}`),this.logger.trace({type:"method",method:"restore",value:this.values})}catch(t){this.logger.debug(`Failed to Restore value for ${this.name}`),this.logger.error(t)}}isInitialized(){if(!this.initialized){const{message:t}=B("NOT_INITIALIZED",this.name);throw new Error(t)}}}var xI=Object.defineProperty,VI=(n,t,e)=>t in n?xI(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,Z=(n,t,e)=>VI(n,typeof t!="symbol"?t+"":t,e);class SI{constructor(t,e){this.core=t,this.logger=e,Z(this,"name",kE),Z(this,"version",UE),Z(this,"events",new Ml),Z(this,"pairings"),Z(this,"initialized",!1),Z(this,"storagePrefix",xt),Z(this,"ignoredPayloadTypes",[Mt]),Z(this,"registeredMethods",[]),Z(this,"init",async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"))}),Z(this,"register",({methods:r})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...r])]}),Z(this,"create",async r=>{this.isInitialized();const i=io(),s=await this.core.crypto.setSymKey(i),o=_e(M.FIVE_MINUTES),c={protocol:Yh},l={topic:s,expiry:o,relay:c,active:!1,methods:r?.methods},u=qc({protocol:this.core.protocol,version:this.core.version,topic:s,symKey:i,relay:c,expiryTimestamp:o,methods:r?.methods});return this.events.emit(yn.create,l),this.core.expirer.set(s,o),await this.pairings.set(s,l),await this.core.relayer.subscribe(s,{transportType:r?.transportType,internal:r?.internal}),{topic:s,uri:u}}),Z(this,"pair",async r=>{this.isInitialized();const i=this.core.eventClient.createEvent({properties:{topic:r?.uri,trace:[Pt.pairing_started]}});this.isValidPair(r,i);const{topic:s,symKey:o,relay:c,expiryTimestamp:l,methods:u}=Bc(r.uri);i.props.properties.topic=s,i.addTrace(Pt.pairing_uri_validation_success),i.addTrace(Pt.pairing_uri_not_expired);let h;if(this.pairings.keys.includes(s)){if(h=this.pairings.get(s),i.addTrace(Pt.existing_pairing),h.active)throw i.setError(kt.active_pairing_already_exists),new Error(`Pairing already exists: ${s}. Please try again with a new connection URI.`);i.addTrace(Pt.pairing_not_expired)}const d=l||_e(M.FIVE_MINUTES),p={topic:s,relay:c,expiry:d,active:!1,methods:u};this.core.expirer.set(s,d),await this.pairings.set(s,p),i.addTrace(Pt.store_new_pairing),r.activatePairing&&await this.activate({topic:s}),this.events.emit(yn.create,p),i.addTrace(Pt.emit_inactive_pairing),this.core.crypto.keychain.has(s)||await this.core.crypto.setSymKey(o,s),i.addTrace(Pt.subscribing_pairing_topic);try{await this.core.relayer.confirmOnlineStateOrThrow()}catch{i.setError(kt.no_internet_connection)}try{await this.core.relayer.subscribe(s,{relay:c})}catch(f){throw i.setError(kt.subscribe_pairing_topic_failure),f}return i.addTrace(Pt.subscribe_pairing_topic_success),p}),Z(this,"activate",async({topic:r})=>{this.isInitialized();const i=_e(M.FIVE_MINUTES);this.core.expirer.set(r,i),await this.pairings.update(r,{active:!0,expiry:i})}),Z(this,"ping",async r=>{this.isInitialized(),await this.isValidPing(r),this.logger.warn("ping() is deprecated and will be removed in the next major release.");const{topic:i}=r;if(this.pairings.keys.includes(i)){const s=await this.sendRequest(i,"wc_pairingPing",{}),{done:o,resolve:c,reject:l}=wn();this.events.once(ne("pairing_ping",s),({error:u})=>{u?l(u):c()}),await o()}}),Z(this,"updateExpiry",async({topic:r,expiry:i})=>{this.isInitialized(),await this.pairings.update(r,{expiry:i})}),Z(this,"updateMetadata",async({topic:r,metadata:i})=>{this.isInitialized(),await this.pairings.update(r,{peerMetadata:i})}),Z(this,"getPairings",()=>(this.isInitialized(),this.pairings.values)),Z(this,"disconnect",async r=>{this.isInitialized(),await this.isValidDisconnect(r);const{topic:i}=r;this.pairings.keys.includes(i)&&(await this.sendRequest(i,"wc_pairingDelete",le("USER_DISCONNECTED")),await this.deletePairing(i))}),Z(this,"formatUriFromPairing",r=>{this.isInitialized();const{topic:i,relay:s,expiry:o,methods:c}=r,l=this.core.crypto.keychain.get(i);return qc({protocol:this.core.protocol,version:this.core.version,topic:i,symKey:l,relay:s,expiryTimestamp:o,methods:c})}),Z(this,"sendRequest",async(r,i,s)=>{const o=nn(i,s),c=await this.core.crypto.encode(r,o),l=ar[i].req;return this.core.history.set(r,o),this.core.relayer.publish(r,c,l),o.id}),Z(this,"sendResult",async(r,i,s)=>{const o=_i(r,s),c=await this.core.crypto.encode(i,o),l=(await this.core.history.get(i,r)).request.method,u=ar[l].res;await this.core.relayer.publish(i,c,u),await this.core.history.resolve(o)}),Z(this,"sendError",async(r,i,s)=>{const o=Kl(r,s),c=await this.core.crypto.encode(i,o),l=(await this.core.history.get(i,r)).request.method,u=ar[l]?ar[l].res:ar.unregistered_method.res;await this.core.relayer.publish(i,c,u),await this.core.history.resolve(o)}),Z(this,"deletePairing",async(r,i)=>{await this.core.relayer.unsubscribe(r),await Promise.all([this.pairings.delete(r,le("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(r),i?Promise.resolve():this.core.expirer.del(r)])}),Z(this,"cleanup",async()=>{const r=this.pairings.getAll().filter(i=>rn(i.expiry));await Promise.all(r.map(i=>this.deletePairing(i.topic)))}),Z(this,"onRelayEventRequest",async r=>{const{topic:i,payload:s}=r;switch(s.method){case"wc_pairingPing":return await this.onPairingPingRequest(i,s);case"wc_pairingDelete":return await this.onPairingDeleteRequest(i,s);default:return await this.onUnknownRpcMethodRequest(i,s)}}),Z(this,"onRelayEventResponse",async r=>{const{topic:i,payload:s}=r,o=(await this.core.history.get(i,s.id)).request.method;switch(o){case"wc_pairingPing":return this.onPairingPingResponse(i,s);default:return this.onUnknownRpcMethodResponse(o)}}),Z(this,"onPairingPingRequest",async(r,i)=>{const{id:s}=i;try{this.isValidPing({topic:r}),await this.sendResult(s,r,!0),this.events.emit(yn.ping,{id:s,topic:r})}catch(o){await this.sendError(s,r,o),this.logger.error(o)}}),Z(this,"onPairingPingResponse",(r,i)=>{const{id:s}=i;setTimeout(()=>{Ct(i)?this.events.emit(ne("pairing_ping",s),{}):Ot(i)&&this.events.emit(ne("pairing_ping",s),{error:i.error})},500)}),Z(this,"onPairingDeleteRequest",async(r,i)=>{const{id:s}=i;try{this.isValidDisconnect({topic:r}),await this.deletePairing(r),this.events.emit(yn.delete,{id:s,topic:r})}catch(o){await this.sendError(s,r,o),this.logger.error(o)}}),Z(this,"onUnknownRpcMethodRequest",async(r,i)=>{const{id:s,method:o}=i;try{if(this.registeredMethods.includes(o))return;const c=le("WC_METHOD_UNSUPPORTED",o);await this.sendError(s,r,c),this.logger.error(c)}catch(c){await this.sendError(s,r,c),this.logger.error(c)}}),Z(this,"onUnknownRpcMethodResponse",r=>{this.registeredMethods.includes(r)||this.logger.error(le("WC_METHOD_UNSUPPORTED",r))}),Z(this,"isValidPair",(r,i)=>{var s;if(!Fe(r)){const{message:c}=B("MISSING_OR_INVALID",`pair() params: ${r}`);throw i.setError(kt.malformed_pairing_uri),new Error(c)}if(!$0(r.uri)){const{message:c}=B("MISSING_OR_INVALID",`pair() uri: ${r.uri}`);throw i.setError(kt.malformed_pairing_uri),new Error(c)}const o=Bc(r?.uri);if(!((s=o?.relay)!=null&&s.protocol)){const{message:c}=B("MISSING_OR_INVALID","pair() uri#relay-protocol");throw i.setError(kt.malformed_pairing_uri),new Error(c)}if(!(o!=null&&o.symKey)){const{message:c}=B("MISSING_OR_INVALID","pair() uri#symKey");throw i.setError(kt.malformed_pairing_uri),new Error(c)}if(o!=null&&o.expiryTimestamp&&M.toMiliseconds(o?.expiryTimestamp)<Date.now()){i.setError(kt.pairing_expired);const{message:c}=B("EXPIRED","pair() URI has expired. Please try again with a new connection URI.");throw new Error(c)}}),Z(this,"isValidPing",async r=>{if(!Fe(r)){const{message:s}=B("MISSING_OR_INVALID",`ping() params: ${r}`);throw new Error(s)}const{topic:i}=r;await this.isValidPairingTopic(i)}),Z(this,"isValidDisconnect",async r=>{if(!Fe(r)){const{message:s}=B("MISSING_OR_INVALID",`disconnect() params: ${r}`);throw new Error(s)}const{topic:i}=r;await this.isValidPairingTopic(i)}),Z(this,"isValidPairingTopic",async r=>{if(!pe(r,!1)){const{message:i}=B("MISSING_OR_INVALID",`pairing topic should be a string: ${r}`);throw new Error(i)}if(!this.pairings.keys.includes(r)){const{message:i}=B("NO_MATCHING_KEY",`pairing topic doesn't exist: ${r}`);throw new Error(i)}if(rn(this.pairings.get(r).expiry)){await this.deletePairing(r);const{message:i}=B("EXPIRED",`pairing topic: ${r}`);throw new Error(i)}}),this.core=t,this.logger=ze(e,this.name),this.pairings=new Sn(this.core,this.logger,this.name,this.storagePrefix)}get context(){return rt(this.logger)}isInitialized(){if(!this.initialized){const{message:t}=B("NOT_INITIALIZED",this.name);throw new Error(t)}}registerRelayerEvents(){this.core.relayer.on(ue.message,async t=>{const{topic:e,message:r,transportType:i}=t;if(this.pairings.keys.includes(e)&&i!==ae.link_mode&&!this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(r)))try{const s=await this.core.crypto.decode(e,r);xo(s)?(this.core.history.set(e,s),await this.onRelayEventRequest({topic:e,payload:s})):Vo(s)&&(await this.core.history.resolve(s),await this.onRelayEventResponse({topic:e,payload:s}),this.core.history.delete(e,s.id)),await this.core.relayer.messages.ack(e,r)}catch(s){this.logger.error(s)}})}registerExpirerEvents(){this.core.expirer.on(at.expired,async t=>{const{topic:e}=eh(t.target);e&&this.pairings.keys.includes(e)&&(await this.deletePairing(e,!0),this.events.emit(yn.expire,{topic:e}))})}}var CI=Object.defineProperty,$I=(n,t,e)=>t in n?CI(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,Pe=(n,t,e)=>$I(n,typeof t!="symbol"?t+"":t,e);class kI extends N_{constructor(t,e){super(t,e),this.core=t,this.logger=e,Pe(this,"records",new Map),Pe(this,"events",new Ln.EventEmitter),Pe(this,"name",NE),Pe(this,"version",BE),Pe(this,"cached",[]),Pe(this,"initialized",!1),Pe(this,"storagePrefix",xt),Pe(this,"init",async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(r=>this.records.set(r.id,r)),this.cached=[],this.registerEventListeners(),this.initialized=!0)}),Pe(this,"set",(r,i,s)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:r,request:i,chainId:s}),this.records.has(i.id))return;const o={id:i.id,topic:r,request:{method:i.method,params:i.params||null},chainId:s,expiry:_e(M.THIRTY_DAYS)};this.records.set(o.id,o),this.persist(),this.events.emit(pt.created,o)}),Pe(this,"resolve",async r=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:r}),!this.records.has(r.id))return;const i=await this.getRecord(r.id);typeof i.response>"u"&&(i.response=Ot(r)?{error:r.error}:{result:r.result},this.records.set(i.id,i),this.persist(),this.events.emit(pt.updated,i))}),Pe(this,"get",async(r,i)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:r,id:i}),await this.getRecord(i))),Pe(this,"delete",(r,i)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:i}),this.values.forEach(s=>{if(s.topic===r){if(typeof i<"u"&&s.id!==i)return;this.records.delete(s.id),this.events.emit(pt.deleted,s)}}),this.persist()}),Pe(this,"exists",async(r,i)=>(this.isInitialized(),this.records.has(i)?(await this.getRecord(i)).topic===r:!1)),Pe(this,"on",(r,i)=>{this.events.on(r,i)}),Pe(this,"once",(r,i)=>{this.events.once(r,i)}),Pe(this,"off",(r,i)=>{this.events.off(r,i)}),Pe(this,"removeListener",(r,i)=>{this.events.removeListener(r,i)}),this.logger=ze(e,this.name)}get context(){return rt(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get size(){return this.records.size}get keys(){return Array.from(this.records.keys())}get values(){return Array.from(this.records.values())}get pending(){const t=[];return this.values.forEach(e=>{if(typeof e.response<"u")return;const r={topic:e.topic,request:nn(e.request.method,e.request.params,e.id),chainId:e.chainId};return t.push(r)}),t}async setJsonRpcRecords(t){await this.core.storage.setItem(this.storageKey,t)}async getJsonRpcRecords(){return await this.core.storage.getItem(this.storageKey)}getRecord(t){this.isInitialized();const e=this.records.get(t);if(!e){const{message:r}=B("NO_MATCHING_KEY",`${this.name}: ${t}`);throw new Error(r)}return e}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(pt.sync)}async restore(){try{const t=await this.getJsonRpcRecords();if(typeof t>"u"||!t.length)return;if(this.records.size){const{message:e}=B("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),new Error(e)}this.cached=t,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",records:this.values})}catch(t){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(t)}}registerEventListeners(){this.events.on(pt.created,t=>{const e=pt.created;this.logger.info(`Emitting ${e}`),this.logger.debug({type:"event",event:e,record:t})}),this.events.on(pt.updated,t=>{const e=pt.updated;this.logger.info(`Emitting ${e}`),this.logger.debug({type:"event",event:e,record:t})}),this.events.on(pt.deleted,t=>{const e=pt.deleted;this.logger.info(`Emitting ${e}`),this.logger.debug({type:"event",event:e,record:t})}),this.core.heartbeat.on(Gn.pulse,()=>{this.cleanup()})}cleanup(){try{this.isInitialized();let t=!1;this.records.forEach(e=>{M.toMiliseconds(e.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${e.id}`),this.records.delete(e.id),this.events.emit(pt.deleted,e,!1),t=!0)}),t&&this.persist()}catch(t){this.logger.warn(t)}}isInitialized(){if(!this.initialized){const{message:t}=B("NOT_INITIALIZED",this.name);throw new Error(t)}}}var UI=Object.defineProperty,NI=(n,t,e)=>t in n?UI(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,$e=(n,t,e)=>NI(n,typeof t!="symbol"?t+"":t,e);class BI extends K_{constructor(t,e){super(t,e),this.core=t,this.logger=e,$e(this,"expirations",new Map),$e(this,"events",new Ln.EventEmitter),$e(this,"name",qE),$e(this,"version",ME),$e(this,"cached",[]),$e(this,"initialized",!1),$e(this,"storagePrefix",xt),$e(this,"init",async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(r=>this.expirations.set(r.target,r)),this.cached=[],this.registerEventListeners(),this.initialized=!0)}),$e(this,"has",r=>{try{const i=this.formatTarget(r);return typeof this.getExpiration(i)<"u"}catch{return!1}}),$e(this,"set",(r,i)=>{this.isInitialized();const s=this.formatTarget(r),o={target:s,expiry:i};this.expirations.set(s,o),this.checkExpiry(s,o),this.events.emit(at.created,{target:s,expiration:o})}),$e(this,"get",r=>{this.isInitialized();const i=this.formatTarget(r);return this.getExpiration(i)}),$e(this,"del",r=>{if(this.isInitialized(),this.has(r)){const i=this.formatTarget(r),s=this.getExpiration(i);this.expirations.delete(i),this.events.emit(at.deleted,{target:i,expiration:s})}}),$e(this,"on",(r,i)=>{this.events.on(r,i)}),$e(this,"once",(r,i)=>{this.events.once(r,i)}),$e(this,"off",(r,i)=>{this.events.off(r,i)}),$e(this,"removeListener",(r,i)=>{this.events.removeListener(r,i)}),this.logger=ze(e,this.name)}get context(){return rt(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.expirations.size}get keys(){return Array.from(this.expirations.keys())}get values(){return Array.from(this.expirations.values())}formatTarget(t){if(typeof t=="string")return ym(t);if(typeof t=="number")return gm(t);const{message:e}=B("UNKNOWN_TYPE",`Target type: ${typeof t}`);throw new Error(e)}async setExpirations(t){await this.core.storage.setItem(this.storageKey,t)}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit(at.sync)}async restore(){try{const t=await this.getExpirations();if(typeof t>"u"||!t.length)return;if(this.expirations.size){const{message:e}=B("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),new Error(e)}this.cached=t,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values})}catch(t){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(t)}}getExpiration(t){const e=this.expirations.get(t);if(!e){const{message:r}=B("NO_MATCHING_KEY",`${this.name}: ${t}`);throw this.logger.warn(r),new Error(r)}return e}checkExpiry(t,e){const{expiry:r}=e;M.toMiliseconds(r)-Date.now()<=0&&this.expire(t,e)}expire(t,e){this.expirations.delete(t),this.events.emit(at.expired,{target:t,expiration:e})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((t,e)=>this.checkExpiry(e,t))}registerEventListeners(){this.core.heartbeat.on(Gn.pulse,()=>this.checkExpirations()),this.events.on(at.created,t=>{const e=at.created;this.logger.info(`Emitting ${e}`),this.logger.debug({type:"event",event:e,data:t}),this.persist()}),this.events.on(at.expired,t=>{const e=at.expired;this.logger.info(`Emitting ${e}`),this.logger.debug({type:"event",event:e,data:t}),this.persist()}),this.events.on(at.deleted,t=>{const e=at.deleted;this.logger.info(`Emitting ${e}`),this.logger.debug({type:"event",event:e,data:t}),this.persist()})}isInitialized(){if(!this.initialized){const{message:t}=B("NOT_INITIALIZED",this.name);throw new Error(t)}}}var qI=Object.defineProperty,MI=(n,t,e)=>t in n?qI(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,de=(n,t,e)=>MI(n,typeof t!="symbol"?t+"":t,e);class zI extends F_{constructor(t,e,r){super(t,e,r),this.core=t,this.logger=e,this.store=r,de(this,"name",zE),de(this,"abortController"),de(this,"isDevEnv"),de(this,"verifyUrlV3",KE),de(this,"storagePrefix",xt),de(this,"version",Zh),de(this,"publicKey"),de(this,"fetchPromise"),de(this,"init",async()=>{var i;this.isDevEnv||(this.publicKey=await this.store.getItem(this.storeKey),this.publicKey&&M.toMiliseconds((i=this.publicKey)==null?void 0:i.expiresAt)<Date.now()&&(this.logger.debug("verify v2 public key expired"),await this.removePublicKey()))}),de(this,"register",async i=>{if(!Yn()||this.isDevEnv)return;const s=window.location.origin,{id:o,decryptedId:c}=i,l=`${this.verifyUrlV3}/attestation?projectId=${this.core.projectId}&origin=${s}&id=${o}&decryptedId=${c}`;try{const u=zn(),h=this.startAbortTimer(M.ONE_SECOND*5),d=await new Promise((p,f)=>{const w=()=>{window.removeEventListener("message",_),u.body.removeChild(m),f("attestation aborted")};this.abortController.signal.addEventListener("abort",w);const m=u.createElement("iframe");m.src=l,m.style.display="none",m.addEventListener("error",w,{signal:this.abortController.signal});const _=E=>{if(E.data&&typeof E.data=="string")try{const v=JSON.parse(E.data);if(v.type==="verify_attestation"){if(Vs(v.attestation).payload.id!==o)return;clearInterval(h),u.body.removeChild(m),this.abortController.signal.removeEventListener("abort",w),window.removeEventListener("message",_),p(v.attestation===null?"":v.attestation)}}catch(v){this.logger.warn(v)}};u.body.appendChild(m),window.addEventListener("message",_,{signal:this.abortController.signal})});return this.logger.debug("jwt attestation",d),d}catch(u){this.logger.warn(u)}return""}),de(this,"resolve",async i=>{if(this.isDevEnv)return"";const{attestationId:s,hash:o,encryptedId:c}=i;if(s===""){this.logger.debug("resolve: attestationId is empty, skipping");return}if(s){if(Vs(s).payload.id!==c)return;const u=await this.isValidJwtAttestation(s);if(u){if(!u.isVerified){this.logger.warn("resolve: jwt attestation: origin url not verified");return}return u}}if(!o)return;const l=this.getVerifyUrl(i?.verifyUrl);return this.fetchAttestation(o,l)}),de(this,"fetchAttestation",async(i,s)=>{this.logger.debug(`resolving attestation: ${i} from url: ${s}`);const o=this.startAbortTimer(M.ONE_SECOND*5),c=await fetch(`${s}/attestation/${i}?v2Supported=true`,{signal:this.abortController.signal});return clearTimeout(o),c.status===200?await c.json():void 0}),de(this,"getVerifyUrl",i=>{let s=i||Ir;return FE.includes(s)||(this.logger.info(`verify url: ${s}, not included in trusted list, assigning default: ${Ir}`),s=Ir),s}),de(this,"fetchPublicKey",async()=>{try{this.logger.debug(`fetching public key from: ${this.verifyUrlV3}`);const i=this.startAbortTimer(M.FIVE_SECONDS),s=await fetch(`${this.verifyUrlV3}/public-key`,{signal:this.abortController.signal});return clearTimeout(i),await s.json()}catch(i){this.logger.warn(i)}}),de(this,"persistPublicKey",async i=>{this.logger.debug("persisting public key to local storage",i),await this.store.setItem(this.storeKey,i),this.publicKey=i}),de(this,"removePublicKey",async()=>{this.logger.debug("removing verify v2 public key from storage"),await this.store.removeItem(this.storeKey),this.publicKey=void 0}),de(this,"isValidJwtAttestation",async i=>{const s=await this.getPublicKey();try{if(s)return this.validateAttestation(i,s)}catch(c){this.logger.error(c),this.logger.warn("error validating attestation")}const o=await this.fetchAndPersistPublicKey();try{if(o)return this.validateAttestation(i,o)}catch(c){this.logger.error(c),this.logger.warn("error validating attestation")}}),de(this,"getPublicKey",async()=>this.publicKey?this.publicKey:await this.fetchAndPersistPublicKey()),de(this,"fetchAndPersistPublicKey",async()=>{if(this.fetchPromise)return await this.fetchPromise,this.publicKey;this.fetchPromise=new Promise(async s=>{const o=await this.fetchPublicKey();o&&(await this.persistPublicKey(o),s(o))});const i=await this.fetchPromise;return this.fetchPromise=void 0,i}),de(this,"validateAttestation",(i,s)=>{const o=p0(i,s.publicKey),c={hasExpired:M.toMiliseconds(o.exp)<Date.now(),payload:o};if(c.hasExpired)throw this.logger.warn("resolve: jwt attestation expired"),new Error("JWT attestation expired");return{origin:c.payload.origin,isScam:c.payload.isScam,isVerified:c.payload.isVerified}}),this.logger=ze(e,this.name),this.abortController=new AbortController,this.isDevEnv=ea(),this.init()}get storeKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//verify:public:key"}get context(){return rt(this.logger)}startAbortTimer(t){return this.abortController=new AbortController,setTimeout(()=>this.abortController.abort(),M.toMiliseconds(t))}}var jI=Object.defineProperty,KI=(n,t,e)=>t in n?jI(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,wl=(n,t,e)=>KI(n,typeof t!="symbol"?t+"":t,e);class FI extends H_{constructor(t,e){super(t,e),this.projectId=t,this.logger=e,wl(this,"context",HE),wl(this,"registerDeviceToken",async r=>{const{clientId:i,token:s,notificationType:o,enableEncrypted:c=!1}=r,l=`${WE}/${this.projectId}/clients`;await fetch(l,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:i,type:o,token:s,always_raw:c})})}),this.logger=ze(e,this.context)}}var HI=Object.defineProperty,ml=Object.getOwnPropertySymbols,WI=Object.prototype.hasOwnProperty,GI=Object.prototype.propertyIsEnumerable,wo=(n,t,e)=>t in n?HI(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,hr=(n,t)=>{for(var e in t||(t={}))WI.call(t,e)&&wo(n,e,t[e]);if(ml)for(var e of ml(t))GI.call(t,e)&&wo(n,e,t[e]);return n},me=(n,t,e)=>wo(n,typeof t!="symbol"?t+"":t,e);class ZI extends W_{constructor(t,e,r=!0){super(t,e,r),this.core=t,this.logger=e,me(this,"context",ZE),me(this,"storagePrefix",xt),me(this,"storageVersion",GE),me(this,"events",new Map),me(this,"shouldPersist",!1),me(this,"init",async()=>{if(!ea())try{const i={eventId:ac(),timestamp:Date.now(),domain:this.getAppDomain(),props:{event:"INIT",type:"",properties:{client_id:await this.core.crypto.getClientId(),user_agent:Qu(this.core.relayer.protocol,this.core.relayer.version,ao)}}};await this.sendEvent([i])}catch(i){this.logger.warn(i)}}),me(this,"createEvent",i=>{const{event:s="ERROR",type:o="",properties:{topic:c,trace:l}}=i,u=ac(),h=this.core.projectId||"",d=Date.now(),p=hr({eventId:u,timestamp:d,props:{event:s,type:o,properties:{topic:c,trace:l}},bundleId:h,domain:this.getAppDomain()},this.setMethods(u));return this.telemetryEnabled&&(this.events.set(u,p),this.shouldPersist=!0),p}),me(this,"getEvent",i=>{const{eventId:s,topic:o}=i;if(s)return this.events.get(s);const c=Array.from(this.events.values()).find(l=>l.props.properties.topic===o);if(c)return hr(hr({},c),this.setMethods(c.eventId))}),me(this,"deleteEvent",i=>{const{eventId:s}=i;this.events.delete(s),this.shouldPersist=!0}),me(this,"setEventListeners",()=>{this.core.heartbeat.on(Gn.pulse,async()=>{this.shouldPersist&&await this.persist(),this.events.forEach(i=>{M.fromMiliseconds(Date.now())-M.fromMiliseconds(i.timestamp)>YE&&(this.events.delete(i.eventId),this.shouldPersist=!0)})})}),me(this,"setMethods",i=>({addTrace:s=>this.addTrace(i,s),setError:s=>this.setError(i,s)})),me(this,"addTrace",(i,s)=>{const o=this.events.get(i);o&&(o.props.properties.trace.push(s),this.events.set(i,o),this.shouldPersist=!0)}),me(this,"setError",(i,s)=>{const o=this.events.get(i);o&&(o.props.type=s,o.timestamp=Date.now(),this.events.set(i,o),this.shouldPersist=!0)}),me(this,"persist",async()=>{await this.core.storage.setItem(this.storageKey,Array.from(this.events.values())),this.shouldPersist=!1}),me(this,"restore",async()=>{try{const i=await this.core.storage.getItem(this.storageKey)||[];if(!i.length)return;i.forEach(s=>{this.events.set(s.eventId,hr(hr({},s),this.setMethods(s.eventId)))})}catch(i){this.logger.warn(i)}}),me(this,"submit",async()=>{if(!this.telemetryEnabled||this.events.size===0)return;const i=[];for(const[s,o]of this.events)o.props.type&&i.push(o);if(i.length!==0)try{if((await this.sendEvent(i)).ok)for(const s of i)this.events.delete(s.eventId),this.shouldPersist=!0}catch(s){this.logger.warn(s)}}),me(this,"sendEvent",async i=>{const s=this.getAppDomain()?"":"&sp=desktop";return await fetch(`${JE}?projectId=${this.core.projectId}&st=events_sdk&sv=js-${ao}${s}`,{method:"POST",body:JSON.stringify(i)})}),me(this,"getAppDomain",()=>Ju().url),this.logger=ze(e,this.context),this.telemetryEnabled=r,r?this.restore().then(async()=>{await this.submit(),this.setEventListeners()}):this.persist()}get storageKey(){return this.storagePrefix+this.storageVersion+this.core.customStoragePrefix+"//"+this.context}}var YI=Object.defineProperty,yl=Object.getOwnPropertySymbols,JI=Object.prototype.hasOwnProperty,QI=Object.prototype.propertyIsEnumerable,mo=(n,t,e)=>t in n?YI(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,gl=(n,t)=>{for(var e in t||(t={}))JI.call(t,e)&&mo(n,e,t[e]);if(yl)for(var e of yl(t))QI.call(t,e)&&mo(n,e,t[e]);return n},oe=(n,t,e)=>mo(n,typeof t!="symbol"?t+"":t,e);class fa extends C_{constructor(t){var e;super(t),oe(this,"protocol",Gh),oe(this,"version",Zh),oe(this,"name",oo),oe(this,"relayUrl"),oe(this,"projectId"),oe(this,"customStoragePrefix"),oe(this,"events",new Ln.EventEmitter),oe(this,"logger"),oe(this,"heartbeat"),oe(this,"relayer"),oe(this,"crypto"),oe(this,"storage"),oe(this,"history"),oe(this,"expirer"),oe(this,"pairing"),oe(this,"verify"),oe(this,"echoClient"),oe(this,"linkModeSupportedApps"),oe(this,"eventClient"),oe(this,"initialized",!1),oe(this,"logChunkController"),oe(this,"on",(c,l)=>this.events.on(c,l)),oe(this,"once",(c,l)=>this.events.once(c,l)),oe(this,"off",(c,l)=>this.events.off(c,l)),oe(this,"removeListener",(c,l)=>this.events.removeListener(c,l)),oe(this,"dispatchEnvelope",({topic:c,message:l,sessionExists:u})=>{if(!c||!l)return;const h={topic:c,message:l,publishedAt:Date.now(),transportType:ae.link_mode};this.relayer.onLinkMessageEvent(h,{sessionExists:u})});const r=this.getGlobalCore(t?.customStoragePrefix);if(r)try{return this.customStoragePrefix=r.customStoragePrefix,this.logger=r.logger,this.heartbeat=r.heartbeat,this.crypto=r.crypto,this.history=r.history,this.expirer=r.expirer,this.storage=r.storage,this.relayer=r.relayer,this.pairing=r.pairing,this.verify=r.verify,this.echoClient=r.echoClient,this.linkModeSupportedApps=r.linkModeSupportedApps,this.eventClient=r.eventClient,this.initialized=r.initialized,this.logChunkController=r.logChunkController,r}catch(c){console.warn("Failed to copy global core",c)}this.projectId=t?.projectId,this.relayUrl=t?.relayUrl||Jh,this.customStoragePrefix=t!=null&&t.customStoragePrefix?`:${t.customStoragePrefix}`:"";const i=Lo({level:typeof t?.logger=="string"&&t.logger?t.logger:yE.logger,name:oo}),{logger:s,chunkLoggerController:o}=cp({opts:i,maxSizeInBytes:t?.maxLogBlobSizeInBytes,loggerOverride:t?.logger});this.logChunkController=o,(e=this.logChunkController)!=null&&e.downloadLogsBlobInBrowser&&(window.downloadLogsBlobInBrowser=async()=>{var c,l;(c=this.logChunkController)!=null&&c.downloadLogsBlobInBrowser&&((l=this.logChunkController)==null||l.downloadLogsBlobInBrowser({clientId:await this.crypto.getClientId()}))}),this.logger=ze(s,this.name),this.heartbeat=new lp,this.crypto=new Pb(this,this.logger,t?.keychain),this.history=new kI(this,this.logger),this.expirer=new BI(this,this.logger),this.storage=t!=null&&t.storage?t.storage:new x_(gl(gl({},gE),t?.storageOptions)),this.relayer=new Xb({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new SI(this,this.logger),this.verify=new zI(this,this.logger,this.storage),this.echoClient=new FI(this.projectId||"",this.logger),this.linkModeSupportedApps=[],this.eventClient=new ZI(this,this.logger,t?.telemetryEnabled),this.setGlobalCore(this)}static async init(t){const e=new fa(t);await e.initialize();const r=await e.crypto.getClientId();return await e.storage.setItem(SE,r),e}get context(){return rt(this.logger)}async start(){this.initialized||await this.initialize()}async getLogsBlob(){var t;return(t=this.logChunkController)==null?void 0:t.logsToBlob({clientId:await this.crypto.getClientId()})}async addLinkModeSupportedApp(t){this.linkModeSupportedApps.includes(t)||(this.linkModeSupportedApps.push(t),await this.storage.setItem(Jc,this.linkModeSupportedApps))}async initialize(){this.logger.trace("Initialized");try{await this.crypto.init(),await this.history.init(),await this.expirer.init(),await this.relayer.init(),await this.heartbeat.init(),await this.pairing.init(),this.linkModeSupportedApps=await this.storage.getItem(Jc)||[],this.initialized=!0,this.logger.info("Core Initialization Success")}catch(t){throw this.logger.warn(`Core Initialization Failure at epoch ${Date.now()}`,t),this.logger.error(t.message),t}}getGlobalCore(t=""){try{if(this.isGlobalCoreDisabled())return;const e=`_walletConnectCore_${t}`,r=`${e}_count`;return globalThis[r]=(globalThis[r]||0)+1,globalThis[r]>1&&console.warn(`WalletConnect Core is already initialized. This is probably a mistake and can lead to unexpected behavior. Init() was called ${globalThis[r]} times.`),globalThis[e]}catch(e){console.warn("Failed to get global WalletConnect core",e);return}}setGlobalCore(t){var e;try{if(this.isGlobalCoreDisabled())return;const r=`_walletConnectCore_${((e=t.opts)==null?void 0:e.customStoragePrefix)||""}`;globalThis[r]=t}catch(r){console.warn("Failed to set global WalletConnect core",r)}}isGlobalCoreDisabled(){try{return typeof process<"u"&&mE.DISABLE_GLOBAL_CORE==="true"}catch{return!0}}}const XI=fa,ud="wc",hd=2,dd="client",_a=`${ud}@${hd}:${dd}:`,bs={name:dd,logger:"error"},El="WALLETCONNECT_DEEPLINK_CHOICE",eA="proposal",vl="Proposal expired",tA="session",Bn=M.SEVEN_DAYS,nA="engine",Oe={wc_sessionPropose:{req:{ttl:M.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:M.FIVE_MINUTES,prompt:!1,tag:1101},reject:{ttl:M.FIVE_MINUTES,prompt:!1,tag:1120},autoReject:{ttl:M.FIVE_MINUTES,prompt:!1,tag:1121}},wc_sessionSettle:{req:{ttl:M.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:M.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:M.ONE_DAY,prompt:!1,tag:1104},res:{ttl:M.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:M.ONE_DAY,prompt:!1,tag:1106},res:{ttl:M.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:M.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:M.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:M.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:M.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:M.ONE_DAY,prompt:!1,tag:1112},res:{ttl:M.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:M.ONE_DAY,prompt:!1,tag:1114},res:{ttl:M.ONE_DAY,prompt:!1,tag:1115}},wc_sessionAuthenticate:{req:{ttl:M.ONE_HOUR,prompt:!0,tag:1116},res:{ttl:M.ONE_HOUR,prompt:!1,tag:1117},reject:{ttl:M.FIVE_MINUTES,prompt:!1,tag:1118},autoReject:{ttl:M.FIVE_MINUTES,prompt:!1,tag:1119}}},Is={min:M.FIVE_MINUTES,max:M.SEVEN_DAYS},Tt={idle:"IDLE",active:"ACTIVE"},rA={eth_sendTransaction:{key:""},eth_sendRawTransaction:{key:""},wallet_sendCalls:{key:""},solana_signTransaction:{key:"signature"},solana_signAllTransactions:{key:"transactions"},solana_signAndSendTransaction:{key:"signature"},sui_signAndExecuteTransaction:{key:"digest"},sui_signTransaction:{key:""},hedera_signAndExecuteTransaction:{key:"transactionId"},hedera_executeTransaction:{key:"transactionId"},near_signTransaction:{key:""},near_signTransactions:{key:""},tron_signTransaction:{key:"txID"},xrpl_signTransaction:{key:""},xrpl_signTransactionFor:{key:""},algo_signTxn:{key:""},sendTransfer:{key:"txid"},stacks_stxTransfer:{key:"txId"},polkadot_signTransaction:{key:""},cosmos_signDirect:{key:""}},iA="request",sA=["wc_sessionPropose","wc_sessionRequest","wc_authRequest","wc_sessionAuthenticate"],oA="wc",aA="auth",cA="authKeys",lA="pairingTopics",uA="requests",Hi=`${oA}@${1.5}:${aA}:`,hi=`${Hi}:PUB_KEY`;var hA=Object.defineProperty,dA=Object.defineProperties,pA=Object.getOwnPropertyDescriptors,bl=Object.getOwnPropertySymbols,fA=Object.prototype.hasOwnProperty,_A=Object.prototype.propertyIsEnumerable,yo=(n,t,e)=>t in n?hA(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,ie=(n,t)=>{for(var e in t||(t={}))fA.call(t,e)&&yo(n,e,t[e]);if(bl)for(var e of bl(t))_A.call(t,e)&&yo(n,e,t[e]);return n},ke=(n,t)=>dA(n,pA(t)),U=(n,t,e)=>yo(n,typeof t!="symbol"?t+"":t,e);class wA extends J_{constructor(t){super(t),U(this,"name",nA),U(this,"events",new Ml),U(this,"initialized",!1),U(this,"requestQueue",{state:Tt.idle,queue:[]}),U(this,"sessionRequestQueue",{state:Tt.idle,queue:[]}),U(this,"emittedSessionRequests",new Rm({limit:500})),U(this,"requestQueueDelay",M.ONE_SECOND),U(this,"expectedPairingMethodMap",new Map),U(this,"recentlyDeletedMap",new Map),U(this,"recentlyDeletedLimit",200),U(this,"relayMessageCache",[]),U(this,"pendingSessions",new Map),U(this,"init",async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.registerPairingEvents(),await this.registerLinkModeListeners(),this.client.core.pairing.register({methods:Object.keys(Oe)}),this.initialized=!0,setTimeout(async()=>{await this.processPendingMessageEvents(),this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()},M.toMiliseconds(this.requestQueueDelay)))}),U(this,"connect",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();const r=ke(ie({},e),{requiredNamespaces:e.requiredNamespaces||{},optionalNamespaces:e.optionalNamespaces||{}});await this.isValidConnect(r),r.optionalNamespaces=L0(r.requiredNamespaces,r.optionalNamespaces),r.requiredNamespaces={};const{pairingTopic:i,requiredNamespaces:s,optionalNamespaces:o,sessionProperties:c,scopedProperties:l,relays:u}=r;let h=i,d,p=!1;try{if(h){const L=this.client.core.pairing.pairings.get(h);this.client.logger.warn("connect() with existing pairing topic is deprecated and will be removed in the next major release."),p=L.active}}catch(L){throw this.client.logger.error(`connect() -> pairing.get(${h}) failed`),L}if(!h||!p){const{topic:L,uri:x}=await this.client.core.pairing.create({internal:{skipSubscribe:!0}});h=L,d=x}if(!h){const{message:L}=B("NO_MATCHING_KEY",`connect() pairing topic: ${h}`);throw new Error(L)}const f=await this.client.core.crypto.generateKeyPair(),w=Oe.wc_sessionPropose.req.ttl||M.FIVE_MINUTES,m=_e(w),_=ke(ie(ie({requiredNamespaces:s,optionalNamespaces:o,relays:u??[{protocol:Yh}],proposer:{publicKey:f,metadata:this.client.metadata},expiryTimestamp:m,pairingTopic:h},c&&{sessionProperties:c}),l&&{scopedProperties:l}),{id:jt()}),E=ne("session_connect",_.id),{reject:v,resolve:g,done:I}=wn(w,vl),b=({id:L})=>{L===_.id&&(this.client.events.off("proposal_expire",b),this.pendingSessions.delete(_.id),this.events.emit(E,{error:{message:vl,code:0}}))};return this.client.events.on("proposal_expire",b),this.events.once(E,({error:L,session:x})=>{this.client.events.off("proposal_expire",b),L?v(L):x&&g(x)}),await this.sendProposeSession({proposal:_,publishOpts:{internal:{throwOnFailedPublish:!0},tvf:{correlationId:_.id}}}),await this.setProposal(_.id,_),{uri:d,approval:I}}),U(this,"pair",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{return await this.client.core.pairing.pair(e)}catch(r){throw this.client.logger.error("pair() failed"),r}}),U(this,"approve",async e=>{var r,i,s;const o=this.client.core.eventClient.createEvent({properties:{topic:(r=e?.id)==null?void 0:r.toString(),trace:[tn.session_approve_started]}});try{this.isInitialized(),await this.confirmOnlineStateOrThrow()}catch(y){throw o.setError(cr.no_internet_connection),y}try{await this.isValidProposalId(e?.id)}catch(y){throw this.client.logger.error(`approve() -> proposal.get(${e?.id}) failed`),o.setError(cr.proposal_not_found),y}try{await this.isValidApprove(e)}catch(y){throw this.client.logger.error("approve() -> isValidApprove() failed"),o.setError(cr.session_approve_namespace_validation_failure),y}const{id:c,relayProtocol:l,namespaces:u,sessionProperties:h,scopedProperties:d,sessionConfig:p}=e,f=this.client.proposal.get(c);this.client.core.eventClient.deleteEvent({eventId:o.eventId});const{pairingTopic:w,proposer:m,requiredNamespaces:_,optionalNamespaces:E}=f;let v=(i=this.client.core.eventClient)==null?void 0:i.getEvent({topic:w});v||(v=(s=this.client.core.eventClient)==null?void 0:s.createEvent({type:tn.session_approve_started,properties:{topic:w,trace:[tn.session_approve_started,tn.session_namespaces_validation_success]}}));const g=await this.client.core.crypto.generateKeyPair(),I=m.publicKey,b=await this.client.core.crypto.generateSharedKey(g,I),L=ie(ie(ie({relay:{protocol:l??"irn"},namespaces:u,controller:{publicKey:g,metadata:this.client.metadata},expiry:_e(Bn)},h&&{sessionProperties:h}),d&&{scopedProperties:d}),p&&{sessionConfig:p}),x=ae.relay;v.addTrace(tn.subscribing_session_topic);try{await this.client.core.relayer.subscribe(b,{transportType:x,internal:{skipSubscribe:!0}})}catch(y){throw v.setError(cr.subscribe_session_topic_failure),y}v.addTrace(tn.subscribe_session_topic_success);const S=ke(ie({},L),{topic:b,requiredNamespaces:_,optionalNamespaces:E,pairingTopic:w,acknowledged:!1,self:L.controller,peer:{publicKey:m.publicKey,metadata:m.metadata},controller:g,transportType:ae.relay});await this.client.session.set(b,S),v.addTrace(tn.store_session);try{await this.sendApproveSession({sessionTopic:b,proposal:f,pairingProposalResponse:{relay:{protocol:l??"irn"},responderPublicKey:g},sessionSettleRequest:L,publishOpts:{internal:{throwOnFailedPublish:!0},tvf:{correlationId:c}}}),v.addTrace(tn.session_approve_publish_success)}catch(y){throw this.client.logger.error(y),this.client.session.delete(b,le("USER_DISCONNECTED")),await this.client.core.relayer.unsubscribe(b),y}return this.client.core.eventClient.deleteEvent({eventId:v.eventId}),await this.client.core.pairing.updateMetadata({topic:w,metadata:m.metadata}),await this.deleteProposal(c),await this.client.core.pairing.activate({topic:w}),await this.setExpiry(b,_e(Bn)),{topic:b,acknowledged:()=>Promise.resolve(this.client.session.get(b))}}),U(this,"reject",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidReject(e)}catch(o){throw this.client.logger.error("reject() -> isValidReject() failed"),o}const{id:r,reason:i}=e;let s;try{s=this.client.proposal.get(r).pairingTopic}catch(o){throw this.client.logger.error(`reject() -> proposal.get(${r}) failed`),o}s&&await this.sendError({id:r,topic:s,error:i,rpcOpts:Oe.wc_sessionPropose.reject}),await this.deleteProposal(r)}),U(this,"update",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidUpdate(e)}catch(d){throw this.client.logger.error("update() -> isValidUpdate() failed"),d}const{topic:r,namespaces:i}=e,{done:s,resolve:o,reject:c}=wn(),l=jt(),u=gn().toString(),h=this.client.session.get(r).namespaces;return this.events.once(ne("session_update",l),({error:d})=>{d?c(d):o()}),await this.client.session.update(r,{namespaces:i}),await this.sendRequest({topic:r,method:"wc_sessionUpdate",params:{namespaces:i},throwOnFailedPublish:!0,clientRpcId:l,relayRpcId:u}).catch(d=>{this.client.logger.error(d),this.client.session.update(r,{namespaces:h}),c(d)}),{acknowledged:s}}),U(this,"extend",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidExtend(e)}catch(l){throw this.client.logger.error("extend() -> isValidExtend() failed"),l}const{topic:r}=e,i=jt(),{done:s,resolve:o,reject:c}=wn();return this.events.once(ne("session_extend",i),({error:l})=>{l?c(l):o()}),await this.setExpiry(r,_e(Bn)),this.sendRequest({topic:r,method:"wc_sessionExtend",params:{},clientRpcId:i,throwOnFailedPublish:!0}).catch(l=>{c(l)}),{acknowledged:s}}),U(this,"request",async e=>{this.isInitialized();try{await this.isValidRequest(e)}catch(_){throw this.client.logger.error("request() -> isValidRequest() failed"),_}const{chainId:r,request:i,topic:s,expiry:o=Oe.wc_sessionRequest.req.ttl}=e,c=this.client.session.get(s);c?.transportType===ae.relay&&await this.confirmOnlineStateOrThrow();const l=jt(),u=gn().toString(),{done:h,resolve:d,reject:p}=wn(o,"Request expired. Please try again.");this.events.once(ne("session_request",l),({error:_,result:E})=>{_?p(_):d(E)});const f="wc_sessionRequest",w=this.getAppLinkIfEnabled(c.peer.metadata,c.transportType);if(w)return await this.sendRequest({clientRpcId:l,relayRpcId:u,topic:s,method:f,params:{request:ke(ie({},i),{expiryTimestamp:_e(o)}),chainId:r},expiry:o,throwOnFailedPublish:!0,appLink:w}).catch(_=>p(_)),this.client.events.emit("session_request_sent",{topic:s,request:i,chainId:r,id:l}),await h();const m={request:ke(ie({},i),{expiryTimestamp:_e(o)}),chainId:r};return await Promise.all([new Promise(async _=>{await this.sendRequest({clientRpcId:l,relayRpcId:u,topic:s,method:f,params:m,expiry:o,throwOnFailedPublish:!0,tvf:this.getTVFParams(l,m)}).catch(E=>p(E)),this.client.events.emit("session_request_sent",{topic:s,request:i,chainId:r,id:l}),_()}),new Promise(async _=>{var E;if(!((E=c.sessionConfig)!=null&&E.disableDeepLink)){const v=await Im(this.client.core.storage,El);await Em({id:l,topic:s,wcDeepLink:v})}_()}),h()]).then(_=>_[2])}),U(this,"respond",async e=>{this.isInitialized(),await this.isValidRespond(e);const{topic:r,response:i}=e,{id:s}=i,o=this.client.session.get(r);o.transportType===ae.relay&&await this.confirmOnlineStateOrThrow();const c=this.getAppLinkIfEnabled(o.peer.metadata,o.transportType);Ct(i)?await this.sendResult({id:s,topic:r,result:i.result,throwOnFailedPublish:!0,appLink:c}):Ot(i)&&await this.sendError({id:s,topic:r,error:i.error,appLink:c}),this.cleanupAfterResponse(e)}),U(this,"ping",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidPing(e)}catch(i){throw this.client.logger.error("ping() -> isValidPing() failed"),i}const{topic:r}=e;if(this.client.session.keys.includes(r)){const i=jt(),s=gn().toString(),{done:o,resolve:c,reject:l}=wn();this.events.once(ne("session_ping",i),({error:u})=>{u?l(u):c()}),await Promise.all([this.sendRequest({topic:r,method:"wc_sessionPing",params:{},throwOnFailedPublish:!0,clientRpcId:i,relayRpcId:s}),o()])}else this.client.core.pairing.pairings.keys.includes(r)&&(this.client.logger.warn("ping() on pairing topic is deprecated and will be removed in the next major release."),await this.client.core.pairing.ping({topic:r}))}),U(this,"emit",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidEmit(e);const{topic:r,event:i,chainId:s}=e,o=gn().toString(),c=jt();await this.sendRequest({topic:r,method:"wc_sessionEvent",params:{event:i,chainId:s},throwOnFailedPublish:!0,relayRpcId:o,clientRpcId:c})}),U(this,"disconnect",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidDisconnect(e);const{topic:r}=e;if(this.client.session.keys.includes(r))await this.sendRequest({topic:r,method:"wc_sessionDelete",params:le("USER_DISCONNECTED"),throwOnFailedPublish:!0}),await this.deleteSession({topic:r,emitEvent:!1});else if(this.client.core.pairing.pairings.keys.includes(r))await this.client.core.pairing.disconnect({topic:r});else{const{message:i}=B("MISMATCHED_TOPIC",`Session or pairing topic not found: ${r}`);throw new Error(i)}}),U(this,"find",e=>(this.isInitialized(),this.client.session.getAll().filter(r=>S0(r,e)))),U(this,"getPendingSessionRequests",()=>this.client.pendingRequest.getAll()),U(this,"authenticate",async(e,r)=>{var i;this.isInitialized(),this.isValidAuthenticate(e);const s=r&&this.client.core.linkModeSupportedApps.includes(r)&&((i=this.client.metadata.redirect)==null?void 0:i.linkMode),o=s?ae.link_mode:ae.relay;o===ae.relay&&await this.confirmOnlineStateOrThrow();const{chains:c,statement:l="",uri:u,domain:h,nonce:d,type:p,exp:f,nbf:w,methods:m=[],expiry:_}=e,E=[...e.resources||[]],{topic:v,uri:g}=await this.client.core.pairing.create({methods:["wc_sessionAuthenticate"],transportType:o});this.client.logger.info({message:"Generated new pairing",pairing:{topic:v,uri:g}});const I=await this.client.core.crypto.generateKeyPair(),b=li(I);if(await Promise.all([this.client.auth.authKeys.set(hi,{responseTopic:b,publicKey:I}),this.client.auth.pairingTopics.set(b,{topic:b,pairingTopic:v})]),await this.client.core.relayer.subscribe(b,{transportType:o}),this.client.logger.info(`sending request to new pairing topic: ${v}`),m.length>0){const{namespace:$}=ai(c[0]);let q=By($,"request",m);ci(E)&&(q=My(q,E.pop())),E.push(q)}const L=_&&_>Oe.wc_sessionAuthenticate.req.ttl?_:Oe.wc_sessionAuthenticate.req.ttl,x={authPayload:{type:p??"caip122",chains:c,statement:l,aud:u,domain:h,version:"1",nonce:d,iat:new Date().toISOString(),exp:f,nbf:w,resources:E},requester:{publicKey:I,metadata:this.client.metadata},expiryTimestamp:_e(L)},S={eip155:{chains:c,methods:[...new Set(["personal_sign",...m])],events:["chainChanged","accountsChanged"]}},y={requiredNamespaces:{},optionalNamespaces:S,relays:[{protocol:"irn"}],pairingTopic:v,proposer:{publicKey:I,metadata:this.client.metadata},expiryTimestamp:_e(Oe.wc_sessionPropose.req.ttl),id:jt()},{done:D,resolve:T,reject:O}=wn(L,"Request expired"),C=jt(),A=ne("session_connect",y.id),P=ne("session_request",C),R=async({error:$,session:q})=>{this.events.off(P,V),$?O($):q&&T({session:q})},V=async $=>{var q,N,j;if(await this.deletePendingAuthRequest(C,{message:"fulfilled",code:0}),$.error){const te=le("WC_METHOD_UNSUPPORTED","wc_sessionAuthenticate");return $.error.code===te.code?void 0:(this.events.off(A,R),O($.error.message))}await this.deleteProposal(y.id),this.events.off(A,R);const{cacaos:F,responder:K}=$.result,H=[],G=[];for(const te of F){await yc({cacao:te,projectId:this.client.core.projectId})||(this.client.logger.error(te,"Signature verification failed"),O(le("SESSION_SETTLEMENT_FAILED","Signature verification failed")));const{p:De}=te,Be=ci(De.resources),Et=[Zs(De.iss)],pn=Pi(De.iss);if(Be){const vt=gc(Be),zr=Ec(Be);H.push(...vt),Et.push(...zr)}for(const vt of Et)G.push(`${vt}:${pn}`)}const ce=await this.client.core.crypto.generateSharedKey(I,K.publicKey);let re;H.length>0&&(re={topic:ce,acknowledged:!0,self:{publicKey:I,metadata:this.client.metadata},peer:K,controller:K.publicKey,expiry:_e(Bn),requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:v,namespaces:Kc([...new Set(H)],[...new Set(G)]),transportType:o},await this.client.core.relayer.subscribe(ce,{transportType:o}),await this.client.session.set(ce,re),v&&await this.client.core.pairing.updateMetadata({topic:v,metadata:K.metadata}),re=this.client.session.get(ce)),(q=this.client.metadata.redirect)!=null&&q.linkMode&&(N=K.metadata.redirect)!=null&&N.linkMode&&(j=K.metadata.redirect)!=null&&j.universal&&r&&(this.client.core.addLinkModeSupportedApp(K.metadata.redirect.universal),this.client.session.update(ce,{transportType:ae.link_mode})),T({auths:F,session:re})};this.events.once(A,R),this.events.once(P,V);let k;try{if(s){const $=nn("wc_sessionAuthenticate",x,C);this.client.core.history.set(v,$);const q=await this.client.core.crypto.encode("",$,{type:qr,encoding:cn});k=ni(r,v,q)}else await Promise.all([this.sendRequest({topic:v,method:"wc_sessionAuthenticate",params:x,expiry:e.expiry,throwOnFailedPublish:!0,clientRpcId:C}),this.sendRequest({topic:v,method:"wc_sessionPropose",params:y,expiry:Oe.wc_sessionPropose.req.ttl,throwOnFailedPublish:!0,clientRpcId:y.id})])}catch($){throw this.events.off(A,R),this.events.off(P,V),$}return await this.setProposal(y.id,y),await this.setAuthRequest(C,{request:ke(ie({},x),{verifyContext:{}}),pairingTopic:v,transportType:o}),{uri:k??g,response:D}}),U(this,"approveSessionAuthenticate",async e=>{const{id:r,auths:i}=e,s=this.client.core.eventClient.createEvent({properties:{topic:r.toString(),trace:[_n.authenticated_session_approve_started]}});try{this.isInitialized()}catch(_){throw s.setError(lr.no_internet_connection),_}const o=this.getPendingAuthRequest(r);if(!o)throw s.setError(lr.authenticated_session_pending_request_not_found),new Error(`Could not find pending auth request with id ${r}`);const c=o.transportType||ae.relay;c===ae.relay&&await this.confirmOnlineStateOrThrow();const l=o.requester.publicKey,u=await this.client.core.crypto.generateKeyPair(),h=li(l),d={type:Mt,receiverPublicKey:l,senderPublicKey:u},p=[],f=[];for(const _ of i){if(!await yc({cacao:_,projectId:this.client.core.projectId})){s.setError(lr.invalid_cacao);const b=le("SESSION_SETTLEMENT_FAILED","Signature verification failed");throw await this.sendError({id:r,topic:h,error:b,encodeOpts:d}),new Error(b.message)}s.addTrace(_n.cacaos_verified);const{p:E}=_,v=ci(E.resources),g=[Zs(E.iss)],I=Pi(E.iss);if(v){const b=gc(v),L=Ec(v);p.push(...b),g.push(...L)}for(const b of g)f.push(`${b}:${I}`)}const w=await this.client.core.crypto.generateSharedKey(u,l);s.addTrace(_n.create_authenticated_session_topic);let m;if(p?.length>0){m={topic:w,acknowledged:!0,self:{publicKey:u,metadata:this.client.metadata},peer:{publicKey:l,metadata:o.requester.metadata},controller:l,expiry:_e(Bn),authentication:i,requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:o.pairingTopic,namespaces:Kc([...new Set(p)],[...new Set(f)]),transportType:c},s.addTrace(_n.subscribing_authenticated_session_topic);try{await this.client.core.relayer.subscribe(w,{transportType:c})}catch(_){throw s.setError(lr.subscribe_authenticated_session_topic_failure),_}s.addTrace(_n.subscribe_authenticated_session_topic_success),await this.client.session.set(w,m),s.addTrace(_n.store_authenticated_session),await this.client.core.pairing.updateMetadata({topic:o.pairingTopic,metadata:o.requester.metadata})}s.addTrace(_n.publishing_authenticated_session_approve);try{await this.sendResult({topic:h,id:r,result:{cacaos:i,responder:{publicKey:u,metadata:this.client.metadata}},encodeOpts:d,throwOnFailedPublish:!0,appLink:this.getAppLinkIfEnabled(o.requester.metadata,c)})}catch(_){throw s.setError(lr.authenticated_session_approve_publish_failure),_}return await this.client.auth.requests.delete(r,{message:"fulfilled",code:0}),await this.client.core.pairing.activate({topic:o.pairingTopic}),this.client.core.eventClient.deleteEvent({eventId:s.eventId}),{session:m}}),U(this,"rejectSessionAuthenticate",async e=>{this.isInitialized();const{id:r,reason:i}=e,s=this.getPendingAuthRequest(r);if(!s)throw new Error(`Could not find pending auth request with id ${r}`);s.transportType===ae.relay&&await this.confirmOnlineStateOrThrow();const o=s.requester.publicKey,c=await this.client.core.crypto.generateKeyPair(),l=li(o),u={type:Mt,receiverPublicKey:o,senderPublicKey:c};await this.sendError({id:r,topic:l,error:i,encodeOpts:u,rpcOpts:Oe.wc_sessionAuthenticate.reject,appLink:this.getAppLinkIfEnabled(s.requester.metadata,s.transportType)}),await this.client.auth.requests.delete(r,{message:"rejected",code:0}),await this.deleteProposal(r)}),U(this,"formatAuthMessage",e=>{this.isInitialized();const{request:r,iss:i}=e;return _h(r,i)}),U(this,"processRelayMessageCache",()=>{setTimeout(async()=>{if(this.relayMessageCache.length!==0)for(;this.relayMessageCache.length>0;)try{const e=this.relayMessageCache.shift();e&&await this.onRelayMessage(e)}catch(e){this.client.logger.error(e)}},50)}),U(this,"cleanupDuplicatePairings",async e=>{if(e.pairingTopic)try{const r=this.client.core.pairing.pairings.get(e.pairingTopic),i=this.client.core.pairing.pairings.getAll().filter(s=>{var o,c;return((o=s.peerMetadata)==null?void 0:o.url)&&((c=s.peerMetadata)==null?void 0:c.url)===e.peer.metadata.url&&s.topic&&s.topic!==r.topic});if(i.length===0)return;this.client.logger.info(`Cleaning up ${i.length} duplicate pairing(s)`),await Promise.all(i.map(s=>this.client.core.pairing.disconnect({topic:s.topic}))),this.client.logger.info("Duplicate pairings clean up finished")}catch(r){this.client.logger.error(r)}}),U(this,"deleteSession",async e=>{var r;const{topic:i,expirerHasDeleted:s=!1,emitEvent:o=!0,id:c=0}=e,{self:l}=this.client.session.get(i);await this.client.core.relayer.unsubscribe(i),await this.client.session.delete(i,le("USER_DISCONNECTED")),this.addToRecentlyDeleted(i,"session"),this.client.core.crypto.keychain.has(l.publicKey)&&await this.client.core.crypto.deleteKeyPair(l.publicKey),this.client.core.crypto.keychain.has(i)&&await this.client.core.crypto.deleteSymKey(i),s||this.client.core.expirer.del(i),this.client.core.storage.removeItem(El).catch(u=>this.client.logger.warn(u)),this.getPendingSessionRequests().forEach(u=>{u.topic===i&&this.deletePendingSessionRequest(u.id,le("USER_DISCONNECTED"))}),i===((r=this.sessionRequestQueue.queue[0])==null?void 0:r.topic)&&(this.sessionRequestQueue.state=Tt.idle),o&&this.client.events.emit("session_delete",{id:c,topic:i})}),U(this,"deleteProposal",async(e,r)=>{if(r)try{const i=this.client.proposal.get(e);this.client.core.eventClient.getEvent({topic:i.pairingTopic})?.setError(cr.proposal_expired)}catch{}await Promise.all([this.client.proposal.delete(e,le("USER_DISCONNECTED")),r?Promise.resolve():this.client.core.expirer.del(e)]),this.addToRecentlyDeleted(e,"proposal")}),U(this,"deletePendingSessionRequest",async(e,r,i=!1)=>{await Promise.all([this.client.pendingRequest.delete(e,r),i?Promise.resolve():this.client.core.expirer.del(e)]),this.addToRecentlyDeleted(e,"request"),this.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter(s=>s.id!==e),i&&(this.sessionRequestQueue.state=Tt.idle,this.client.events.emit("session_request_expire",{id:e}))}),U(this,"deletePendingAuthRequest",async(e,r,i=!1)=>{await Promise.all([this.client.auth.requests.delete(e,r),i?Promise.resolve():this.client.core.expirer.del(e)])}),U(this,"setExpiry",async(e,r)=>{this.client.session.keys.includes(e)&&(this.client.core.expirer.set(e,r),await this.client.session.update(e,{expiry:r}))}),U(this,"setProposal",async(e,r)=>{this.client.core.expirer.set(e,_e(Oe.wc_sessionPropose.req.ttl)),await this.client.proposal.set(e,r)}),U(this,"setAuthRequest",async(e,r)=>{const{request:i,pairingTopic:s,transportType:o=ae.relay}=r;this.client.core.expirer.set(e,i.expiryTimestamp),await this.client.auth.requests.set(e,{authPayload:i.authPayload,requester:i.requester,expiryTimestamp:i.expiryTimestamp,id:e,pairingTopic:s,verifyContext:i.verifyContext,transportType:o})}),U(this,"setPendingSessionRequest",async e=>{const{id:r,topic:i,params:s,verifyContext:o}=e,c=s.request.expiryTimestamp||_e(Oe.wc_sessionRequest.req.ttl);this.client.core.expirer.set(r,c),await this.client.pendingRequest.set(r,{id:r,topic:i,params:s,verifyContext:o})}),U(this,"sendRequest",async e=>{const{topic:r,method:i,params:s,expiry:o,relayRpcId:c,clientRpcId:l,throwOnFailedPublish:u,appLink:h,tvf:d,publishOpts:p={}}=e,f=nn(i,s,l);let w;const m=!!h;try{const v=m?cn:Ze;w=await this.client.core.crypto.encode(r,f,{encoding:v})}catch(v){throw await this.cleanup(),this.client.logger.error(`sendRequest() -> core.crypto.encode() for topic ${r} failed`),v}let _;if(sA.includes(i)){const v=ct(JSON.stringify(f)),g=ct(w);_=await this.client.core.verify.register({id:g,decryptedId:v})}const E=ie(ie({},Oe[i].req),p);if(E.attestation=_,o&&(E.ttl=o),c&&(E.id=c),this.client.core.history.set(r,f),m){const v=ni(h,r,w);await global.Linking.openURL(v,this.client.name)}else E.tvf=ke(ie({},d),{correlationId:f.id}),u?(E.internal=ke(ie({},E.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(r,w,E)):this.client.core.relayer.publish(r,w,E).catch(v=>this.client.logger.error(v));return f.id}),U(this,"sendProposeSession",async e=>{const{proposal:r,publishOpts:i}=e,s=nn("wc_sessionPropose",r,r.id);this.client.core.history.set(r.pairingTopic,s);const o=await this.client.core.crypto.encode(r.pairingTopic,s,{encoding:Ze}),c=ct(JSON.stringify(s)),l=ct(o),u=await this.client.core.verify.register({id:l,decryptedId:c});await this.client.core.relayer.publishCustom({payload:{pairingTopic:r.pairingTopic,sessionProposal:o},opts:ke(ie({},i),{publishMethod:"wc_proposeSession",attestation:u})})}),U(this,"sendApproveSession",async e=>{const{sessionTopic:r,pairingProposalResponse:i,proposal:s,sessionSettleRequest:o,publishOpts:c}=e,l=_i(s.id,i),u=await this.client.core.crypto.encode(s.pairingTopic,l,{encoding:Ze}),h=nn("wc_sessionSettle",o,c?.id),d=await this.client.core.crypto.encode(r,h,{encoding:Ze});this.client.core.history.set(r,h),await this.client.core.relayer.publishCustom({payload:{sessionTopic:r,pairingTopic:s.pairingTopic,sessionProposalResponse:u,sessionSettlementRequest:d},opts:ke(ie({},c),{publishMethod:"wc_approveSession"})})}),U(this,"sendResult",async e=>{const{id:r,topic:i,result:s,throwOnFailedPublish:o,encodeOpts:c,appLink:l}=e,u=_i(r,s);let h;const d=l&&typeof(global==null?void 0:global.Linking)<"u";try{const w=d?cn:Ze;h=await this.client.core.crypto.encode(i,u,ke(ie({},c||{}),{encoding:w}))}catch(w){throw await this.cleanup(),this.client.logger.error(`sendResult() -> core.crypto.encode() for topic ${i} failed`),w}let p,f;try{p=await this.client.core.history.get(i,r);const w=p.request;try{f=this.getTVFParams(r,w.params,s)}catch(m){this.client.logger.warn(`sendResult() -> getTVFParams() failed: ${m?.message}`)}}catch(w){throw this.client.logger.error(`sendResult() -> history.get(${i}, ${r}) failed`),w}if(d){const w=ni(l,i,h);await global.Linking.openURL(w,this.client.name)}else{const w=p.request.method,m=Oe[w].res;m.tvf=ke(ie({},f),{correlationId:r}),o?(m.internal=ke(ie({},m.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(i,h,m)):this.client.core.relayer.publish(i,h,m).catch(_=>this.client.logger.error(_))}await this.client.core.history.resolve(u)}),U(this,"sendError",async e=>{const{id:r,topic:i,error:s,encodeOpts:o,rpcOpts:c,appLink:l}=e,u=Kl(r,s);let h;const d=l&&typeof(global==null?void 0:global.Linking)<"u";try{const f=d?cn:Ze;h=await this.client.core.crypto.encode(i,u,ke(ie({},o||{}),{encoding:f}))}catch(f){throw await this.cleanup(),this.client.logger.error(`sendError() -> core.crypto.encode() for topic ${i} failed`),f}let p;try{p=await this.client.core.history.get(i,r)}catch(f){throw this.client.logger.error(`sendError() -> history.get(${i}, ${r}) failed`),f}if(d){const f=ni(l,i,h);await global.Linking.openURL(f,this.client.name)}else{const f=p.request.method,w=c||Oe[f].res;this.client.core.relayer.publish(i,h,w)}await this.client.core.history.resolve(u)}),U(this,"cleanup",async()=>{const e=[],r=[];this.client.session.getAll().forEach(i=>{let s=!1;rn(i.expiry)&&(s=!0),this.client.core.crypto.keychain.has(i.topic)||(s=!0),s&&e.push(i.topic)}),this.client.proposal.getAll().forEach(i=>{rn(i.expiryTimestamp)&&r.push(i.id)}),await Promise.all([...e.map(i=>this.deleteSession({topic:i})),...r.map(i=>this.deleteProposal(i))])}),U(this,"onProviderMessageEvent",async e=>{!this.initialized||this.relayMessageCache.length>0?this.relayMessageCache.push(e):await this.onRelayMessage(e)}),U(this,"onRelayEventRequest",async e=>{this.requestQueue.queue.push(e),await this.processRequestsQueue()}),U(this,"processRequestsQueue",async()=>{if(this.requestQueue.state===Tt.active){this.client.logger.info("Request queue already active, skipping...");return}for(this.client.logger.info(`Request queue starting with ${this.requestQueue.queue.length} requests`);this.requestQueue.queue.length>0;){this.requestQueue.state=Tt.active;const e=this.requestQueue.queue.shift();if(e)try{await this.processRequest(e)}catch(r){this.client.logger.warn(r)}}this.requestQueue.state=Tt.idle}),U(this,"processRequest",async e=>{const{topic:r,payload:i,attestation:s,transportType:o,encryptedId:c}=e,l=i.method;if(!this.shouldIgnorePairingRequest({topic:r,requestMethod:l}))switch(l){case"wc_sessionPropose":return await this.onSessionProposeRequest({topic:r,payload:i,attestation:s,encryptedId:c});case"wc_sessionSettle":return await this.onSessionSettleRequest(r,i);case"wc_sessionUpdate":return await this.onSessionUpdateRequest(r,i);case"wc_sessionExtend":return await this.onSessionExtendRequest(r,i);case"wc_sessionPing":return await this.onSessionPingRequest(r,i);case"wc_sessionDelete":return await this.onSessionDeleteRequest(r,i);case"wc_sessionRequest":return await this.onSessionRequest({topic:r,payload:i,attestation:s,encryptedId:c,transportType:o});case"wc_sessionEvent":return await this.onSessionEventRequest(r,i);case"wc_sessionAuthenticate":return await this.onSessionAuthenticateRequest({topic:r,payload:i,attestation:s,encryptedId:c,transportType:o});default:return this.client.logger.info(`Unsupported request method ${l}`)}}),U(this,"onRelayEventResponse",async e=>{const{topic:r,payload:i,transportType:s}=e,o=(await this.client.core.history.get(r,i.id)).request.method;switch(o){case"wc_sessionPropose":return this.onSessionProposeResponse(r,i,s);case"wc_sessionSettle":return this.onSessionSettleResponse(r,i);case"wc_sessionUpdate":return this.onSessionUpdateResponse(r,i);case"wc_sessionExtend":return this.onSessionExtendResponse(r,i);case"wc_sessionPing":return this.onSessionPingResponse(r,i);case"wc_sessionRequest":return this.onSessionRequestResponse(r,i);case"wc_sessionAuthenticate":return this.onSessionAuthenticateResponse(r,i);default:return this.client.logger.info(`Unsupported response method ${o}`)}}),U(this,"onRelayEventUnknownPayload",e=>{const{topic:r}=e,{message:i}=B("MISSING_OR_INVALID",`Decoded payload on topic ${r} is not identifiable as a JSON-RPC request or a response.`);throw new Error(i)}),U(this,"shouldIgnorePairingRequest",e=>{const{topic:r,requestMethod:i}=e,s=this.expectedPairingMethodMap.get(r);return!s||s.includes(i)?!1:!!(s.includes("wc_sessionAuthenticate")&&this.client.events.listenerCount("session_authenticate")>0)}),U(this,"onSessionProposeRequest",async e=>{const{topic:r,payload:i,attestation:s,encryptedId:o}=e,{params:c,id:l}=i;try{const u=this.client.core.eventClient.getEvent({topic:r});this.client.events.listenerCount("session_proposal")===0&&(console.warn("No listener for session_proposal event"),u?.setError(kt.proposal_listener_not_found)),this.isValidConnect(ie({},i.params));const h=c.expiryTimestamp||_e(Oe.wc_sessionPropose.req.ttl),d=ie({id:l,pairingTopic:r,expiryTimestamp:h,attestation:s,encryptedId:o},c);await this.setProposal(l,d);const p=await this.getVerifyContext({attestationId:s,hash:ct(JSON.stringify(i)),encryptedId:o,metadata:d.proposer.metadata});u?.addTrace(Pt.emit_session_proposal),this.client.events.emit("session_proposal",{id:l,params:d,verifyContext:p})}catch(u){await this.sendError({id:l,topic:r,error:u,rpcOpts:Oe.wc_sessionPropose.autoReject}),this.client.logger.error(u)}}),U(this,"onSessionProposeResponse",async(e,r,i)=>{const{id:s}=r;if(Ct(r)){const{result:o}=r;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:o});const c=this.client.proposal.get(s);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:c});const l=c.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:l});const u=o.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:u});const h=await this.client.core.crypto.generateSharedKey(l,u);this.pendingSessions.set(s,{sessionTopic:h,pairingTopic:e,proposalId:s,publicKey:l});const d=await this.client.core.relayer.subscribe(h,{transportType:i});this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:d}),await this.client.core.pairing.activate({topic:e})}else if(Ot(r)){await this.deleteProposal(s);const o=ne("session_connect",s);if(this.events.listenerCount(o)===0)throw new Error(`emitting ${o} without any listeners, 954`);this.events.emit(o,{error:r.error})}}),U(this,"onSessionSettleRequest",async(e,r)=>{const{id:i,params:s}=r;try{this.isValidSessionSettleRequest(s);const{relay:o,controller:c,expiry:l,namespaces:u,sessionProperties:h,scopedProperties:d,sessionConfig:p}=r.params,f=[...this.pendingSessions.values()].find(_=>_.sessionTopic===e);if(!f)return this.client.logger.error(`Pending session not found for topic ${e}`);const w=this.client.proposal.get(f.proposalId),m=ke(ie(ie(ie({topic:e,relay:o,expiry:l,namespaces:u,acknowledged:!0,pairingTopic:f.pairingTopic,requiredNamespaces:w.requiredNamespaces,optionalNamespaces:w.optionalNamespaces,controller:c.publicKey,self:{publicKey:f.publicKey,metadata:this.client.metadata},peer:{publicKey:c.publicKey,metadata:c.metadata}},h&&{sessionProperties:h}),d&&{scopedProperties:d}),p&&{sessionConfig:p}),{transportType:ae.relay});await this.client.session.set(m.topic,m),await this.setExpiry(m.topic,m.expiry),await this.client.core.pairing.updateMetadata({topic:f.pairingTopic,metadata:m.peer.metadata}),this.client.events.emit("session_connect",{session:m}),this.events.emit(ne("session_connect",f.proposalId),{session:m}),this.pendingSessions.delete(f.proposalId),this.deleteProposal(f.proposalId,!1),this.cleanupDuplicatePairings(m),await this.sendResult({id:r.id,topic:e,result:!0})}catch(o){await this.sendError({id:i,topic:e,error:o}),this.client.logger.error(o)}}),U(this,"onSessionSettleResponse",async(e,r)=>{const{id:i}=r;Ct(r)?(await this.client.session.update(e,{acknowledged:!0}),this.events.emit(ne("session_approve",i),{})):Ot(r)&&(await this.client.session.delete(e,le("USER_DISCONNECTED")),this.events.emit(ne("session_approve",i),{error:r.error}))}),U(this,"onSessionUpdateRequest",async(e,r)=>{const{params:i,id:s}=r;try{const o=`${e}_session_update`,c=or.get(o);if(c&&this.isRequestOutOfSync(c,s)){this.client.logger.warn(`Discarding out of sync request - ${s}`),this.sendError({id:s,topic:e,error:le("INVALID_UPDATE_REQUEST")});return}this.isValidUpdate(ie({topic:e},i));try{or.set(o,s),await this.client.session.update(e,{namespaces:i.namespaces}),await this.sendResult({id:s,topic:e,result:!0})}catch(l){throw or.delete(o),l}this.client.events.emit("session_update",{id:s,topic:e,params:i})}catch(o){await this.sendError({id:s,topic:e,error:o}),this.client.logger.error(o)}}),U(this,"isRequestOutOfSync",(e,r)=>r.toString().slice(0,-3)<e.toString().slice(0,-3)),U(this,"onSessionUpdateResponse",(e,r)=>{const{id:i}=r,s=ne("session_update",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);Ct(r)?this.events.emit(ne("session_update",i),{}):Ot(r)&&this.events.emit(ne("session_update",i),{error:r.error})}),U(this,"onSessionExtendRequest",async(e,r)=>{const{id:i}=r;try{this.isValidExtend({topic:e}),await this.setExpiry(e,_e(Bn)),await this.sendResult({id:i,topic:e,result:!0}),this.client.events.emit("session_extend",{id:i,topic:e})}catch(s){await this.sendError({id:i,topic:e,error:s}),this.client.logger.error(s)}}),U(this,"onSessionExtendResponse",(e,r)=>{const{id:i}=r,s=ne("session_extend",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);Ct(r)?this.events.emit(ne("session_extend",i),{}):Ot(r)&&this.events.emit(ne("session_extend",i),{error:r.error})}),U(this,"onSessionPingRequest",async(e,r)=>{const{id:i}=r;try{this.isValidPing({topic:e}),await this.sendResult({id:i,topic:e,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_ping",{id:i,topic:e})}catch(s){await this.sendError({id:i,topic:e,error:s}),this.client.logger.error(s)}}),U(this,"onSessionPingResponse",(e,r)=>{const{id:i}=r,s=ne("session_ping",i);setTimeout(()=>{if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners 2176`);Ct(r)?this.events.emit(ne("session_ping",i),{}):Ot(r)&&this.events.emit(ne("session_ping",i),{error:r.error})},500)}),U(this,"onSessionDeleteRequest",async(e,r)=>{const{id:i}=r;try{this.isValidDisconnect({topic:e,reason:r.params}),await Promise.all([new Promise(s=>{this.client.core.relayer.once(ue.publish,async()=>{s(await this.deleteSession({topic:e,id:i}))})}),this.sendResult({id:i,topic:e,result:!0}),this.cleanupPendingSentRequestsForTopic({topic:e,error:le("USER_DISCONNECTED")})]).catch(s=>this.client.logger.error(s))}catch(s){this.client.logger.error(s)}}),U(this,"onSessionRequest",async e=>{var r,i,s;const{topic:o,payload:c,attestation:l,encryptedId:u,transportType:h}=e,{id:d,params:p}=c;try{await this.isValidRequest(ie({topic:o},p));const f=this.client.session.get(o),w=await this.getVerifyContext({attestationId:l,hash:ct(JSON.stringify(nn("wc_sessionRequest",p,d))),encryptedId:u,metadata:f.peer.metadata,transportType:h}),m={id:d,topic:o,params:p,verifyContext:w};await this.setPendingSessionRequest(m),h===ae.link_mode&&(r=f.peer.metadata.redirect)!=null&&r.universal&&this.client.core.addLinkModeSupportedApp((i=f.peer.metadata.redirect)==null?void 0:i.universal),(s=this.client.signConfig)!=null&&s.disableRequestQueue?this.emitSessionRequest(m):(this.addSessionRequestToSessionRequestQueue(m),this.processSessionRequestQueue())}catch(f){await this.sendError({id:d,topic:o,error:f}),this.client.logger.error(f)}}),U(this,"onSessionRequestResponse",(e,r)=>{const{id:i}=r,s=ne("session_request",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);Ct(r)?this.events.emit(ne("session_request",i),{result:r.result}):Ot(r)&&this.events.emit(ne("session_request",i),{error:r.error})}),U(this,"onSessionEventRequest",async(e,r)=>{const{id:i,params:s}=r;try{const o=`${e}_session_event_${s.event.name}`,c=or.get(o);if(c&&this.isRequestOutOfSync(c,i)){this.client.logger.info(`Discarding out of sync request - ${i}`);return}this.isValidEmit(ie({topic:e},s)),this.client.events.emit("session_event",{id:i,topic:e,params:s}),or.set(o,i)}catch(o){await this.sendError({id:i,topic:e,error:o}),this.client.logger.error(o)}}),U(this,"onSessionAuthenticateResponse",(e,r)=>{const{id:i}=r;this.client.logger.trace({type:"method",method:"onSessionAuthenticateResponse",topic:e,payload:r}),Ct(r)?this.events.emit(ne("session_request",i),{result:r.result}):Ot(r)&&this.events.emit(ne("session_request",i),{error:r.error})}),U(this,"onSessionAuthenticateRequest",async e=>{var r;const{topic:i,payload:s,attestation:o,encryptedId:c,transportType:l}=e;try{const{requester:u,authPayload:h,expiryTimestamp:d}=s.params,p=await this.getVerifyContext({attestationId:o,hash:ct(JSON.stringify(s)),encryptedId:c,metadata:u.metadata,transportType:l}),f={requester:u,pairingTopic:i,id:s.id,authPayload:h,verifyContext:p,expiryTimestamp:d};await this.setAuthRequest(s.id,{request:f,pairingTopic:i,transportType:l}),l===ae.link_mode&&(r=u.metadata.redirect)!=null&&r.universal&&this.client.core.addLinkModeSupportedApp(u.metadata.redirect.universal),this.client.events.emit("session_authenticate",{topic:i,params:s.params,id:s.id,verifyContext:p})}catch(u){this.client.logger.error(u);const h=s.params.requester.publicKey,d=await this.client.core.crypto.generateKeyPair(),p=this.getAppLinkIfEnabled(s.params.requester.metadata,l),f={type:Mt,receiverPublicKey:h,senderPublicKey:d};await this.sendError({id:s.id,topic:i,error:u,encodeOpts:f,rpcOpts:Oe.wc_sessionAuthenticate.autoReject,appLink:p})}}),U(this,"addSessionRequestToSessionRequestQueue",e=>{this.sessionRequestQueue.queue.push(e)}),U(this,"cleanupAfterResponse",e=>{this.deletePendingSessionRequest(e.response.id,{message:"fulfilled",code:0}),setTimeout(()=>{this.sessionRequestQueue.state=Tt.idle,this.processSessionRequestQueue()},M.toMiliseconds(this.requestQueueDelay))}),U(this,"cleanupPendingSentRequestsForTopic",({topic:e,error:r})=>{const i=this.client.core.history.pending;i.length>0&&i.filter(s=>s.topic===e&&s.request.method==="wc_sessionRequest").forEach(s=>{const o=s.request.id,c=ne("session_request",o);if(this.events.listenerCount(c)===0)throw new Error(`emitting ${c} without any listeners`);this.events.emit(ne("session_request",s.request.id),{error:r})})}),U(this,"processSessionRequestQueue",()=>{if(this.sessionRequestQueue.state===Tt.active){this.client.logger.info("session request queue is already active.");return}const e=this.sessionRequestQueue.queue[0];if(!e){this.client.logger.info("session request queue is empty.");return}try{this.emitSessionRequest(e)}catch(r){this.client.logger.error(r)}}),U(this,"emitSessionRequest",e=>{if(this.emittedSessionRequests.has(e.id)){this.client.logger.warn({id:e.id},`Skipping emitting \`session_request\` event for duplicate request. id: ${e.id}`);return}this.sessionRequestQueue.state=Tt.active,this.emittedSessionRequests.add(e.id),this.client.events.emit("session_request",e)}),U(this,"onPairingCreated",e=>{if(e.methods&&this.expectedPairingMethodMap.set(e.topic,e.methods),e.active)return;const r=this.client.proposal.getAll().find(i=>i.pairingTopic===e.topic);r&&this.onSessionProposeRequest({topic:e.topic,payload:nn("wc_sessionPropose",ke(ie({},r),{requiredNamespaces:r.requiredNamespaces,optionalNamespaces:r.optionalNamespaces,relays:r.relays,proposer:r.proposer,sessionProperties:r.sessionProperties,scopedProperties:r.scopedProperties}),r.id),attestation:r.attestation,encryptedId:r.encryptedId})}),U(this,"isValidConnect",async e=>{if(!Fe(e)){const{message:u}=B("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(e)}`);throw new Error(u)}const{pairingTopic:r,requiredNamespaces:i,optionalNamespaces:s,sessionProperties:o,scopedProperties:c,relays:l}=e;if(we(r)||await this.isValidPairingTopic(r),!F0(l)){const{message:u}=B("MISSING_OR_INVALID",`connect() relays: ${l}`);throw new Error(u)}if(!we(i)&&Sr(i)!==0){const u="requiredNamespaces are deprecated and are automatically assigned to optionalNamespaces";["fatal","error","silent"].includes(this.client.logger.level)?console.warn(u):this.client.logger.warn(u),this.validateNamespaces(i,"requiredNamespaces")}if(!we(s)&&Sr(s)!==0&&this.validateNamespaces(s,"optionalNamespaces"),we(o)||this.validateSessionProps(o,"sessionProperties"),!we(c)){this.validateSessionProps(c,"scopedProperties");const u=Object.keys(i||{}).concat(Object.keys(s||{}));if(!Object.keys(c).every(h=>u.includes(h.split(":")[0])))throw new Error(`Scoped properties must be a subset of required/optional namespaces, received: ${JSON.stringify(c)}, required/optional namespaces: ${JSON.stringify(u)}`)}}),U(this,"validateNamespaces",(e,r)=>{const i=K0(e,"connect()",r);if(i)throw new Error(i.message)}),U(this,"isValidApprove",async e=>{if(!Fe(e))throw new Error(B("MISSING_OR_INVALID",`approve() params: ${e}`).message);const{id:r,namespaces:i,relayProtocol:s,sessionProperties:o,scopedProperties:c}=e;this.checkRecentlyDeleted(r),await this.isValidProposalId(r);const l=this.client.proposal.get(r),u=ms(i,"approve()");if(u)throw new Error(u.message);const h=Wc(l.requiredNamespaces,i,"approve()");if(h)throw new Error(h.message);if(!pe(s,!0)){const{message:d}=B("MISSING_OR_INVALID",`approve() relayProtocol: ${s}`);throw new Error(d)}if(we(o)||this.validateSessionProps(o,"sessionProperties"),!we(c)){this.validateSessionProps(c,"scopedProperties");const d=new Set(Object.keys(i));if(!Object.keys(c).every(p=>d.has(p.split(":")[0])))throw new Error(`Scoped properties must be a subset of approved namespaces, received: ${JSON.stringify(c)}, approved namespaces: ${Array.from(d).join(", ")}`)}}),U(this,"isValidReject",async e=>{if(!Fe(e)){const{message:s}=B("MISSING_OR_INVALID",`reject() params: ${e}`);throw new Error(s)}const{id:r,reason:i}=e;if(this.checkRecentlyDeleted(r),await this.isValidProposalId(r),!W0(i)){const{message:s}=B("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(i)}`);throw new Error(s)}}),U(this,"isValidSessionSettleRequest",e=>{if(!Fe(e)){const{message:u}=B("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${e}`);throw new Error(u)}const{relay:r,controller:i,namespaces:s,expiry:o}=e;if(!Wh(r)){const{message:u}=B("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(u)}const c=N0(i,"onSessionSettleRequest()");if(c)throw new Error(c.message);const l=ms(s,"onSessionSettleRequest()");if(l)throw new Error(l.message);if(rn(o)){const{message:u}=B("EXPIRED","onSessionSettleRequest()");throw new Error(u)}}),U(this,"isValidUpdate",async e=>{if(!Fe(e)){const{message:l}=B("MISSING_OR_INVALID",`update() params: ${e}`);throw new Error(l)}const{topic:r,namespaces:i}=e;this.checkRecentlyDeleted(r),await this.isValidSessionTopic(r);const s=this.client.session.get(r),o=ms(i,"update()");if(o)throw new Error(o.message);const c=Wc(s.requiredNamespaces,i,"update()");if(c)throw new Error(c.message)}),U(this,"isValidExtend",async e=>{if(!Fe(e)){const{message:i}=B("MISSING_OR_INVALID",`extend() params: ${e}`);throw new Error(i)}const{topic:r}=e;this.checkRecentlyDeleted(r),await this.isValidSessionTopic(r)}),U(this,"isValidRequest",async e=>{if(!Fe(e)){const{message:l}=B("MISSING_OR_INVALID",`request() params: ${e}`);throw new Error(l)}const{topic:r,request:i,chainId:s,expiry:o}=e;this.checkRecentlyDeleted(r),await this.isValidSessionTopic(r);const{namespaces:c}=this.client.session.get(r);if(!Hc(c,s)){const{message:l}=B("MISSING_OR_INVALID",`request() chainId: ${s}`);throw new Error(l)}if(!G0(i)){const{message:l}=B("MISSING_OR_INVALID",`request() ${JSON.stringify(i)}`);throw new Error(l)}if(!J0(c,s,i.method)){const{message:l}=B("MISSING_OR_INVALID",`request() method: ${i.method}`);throw new Error(l)}if(o&&!tE(o,Is)){const{message:l}=B("MISSING_OR_INVALID",`request() expiry: ${o}. Expiry must be a number (in seconds) between ${Is.min} and ${Is.max}`);throw new Error(l)}}),U(this,"isValidRespond",async e=>{var r;if(!Fe(e)){const{message:o}=B("MISSING_OR_INVALID",`respond() params: ${e}`);throw new Error(o)}const{topic:i,response:s}=e;try{await this.isValidSessionTopic(i)}catch(o){throw(r=e?.response)!=null&&r.id&&this.cleanupAfterResponse(e),o}if(!Z0(s)){const{message:o}=B("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(s)}`);throw new Error(o)}}),U(this,"isValidPing",async e=>{if(!Fe(e)){const{message:i}=B("MISSING_OR_INVALID",`ping() params: ${e}`);throw new Error(i)}const{topic:r}=e;await this.isValidSessionOrPairingTopic(r)}),U(this,"isValidEmit",async e=>{if(!Fe(e)){const{message:c}=B("MISSING_OR_INVALID",`emit() params: ${e}`);throw new Error(c)}const{topic:r,event:i,chainId:s}=e;await this.isValidSessionTopic(r);const{namespaces:o}=this.client.session.get(r);if(!Hc(o,s)){const{message:c}=B("MISSING_OR_INVALID",`emit() chainId: ${s}`);throw new Error(c)}if(!Y0(i)){const{message:c}=B("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(c)}if(!Q0(o,s,i.name)){const{message:c}=B("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(c)}}),U(this,"isValidDisconnect",async e=>{if(!Fe(e)){const{message:i}=B("MISSING_OR_INVALID",`disconnect() params: ${e}`);throw new Error(i)}const{topic:r}=e;await this.isValidSessionOrPairingTopic(r)}),U(this,"isValidAuthenticate",e=>{const{chains:r,uri:i,domain:s,nonce:o}=e;if(!Array.isArray(r)||r.length===0)throw new Error("chains is required and must be a non-empty array");if(!pe(i,!1))throw new Error("uri is required parameter");if(!pe(s,!1))throw new Error("domain is required parameter");if(!pe(o,!1))throw new Error("nonce is required parameter");if([...new Set(r.map(l=>ai(l).namespace))].length>1)throw new Error("Multi-namespace requests are not supported. Please request single namespace only.");const{namespace:c}=ai(r[0]);if(c!=="eip155")throw new Error("Only eip155 namespace is supported for authenticated sessions. Please use .connect() for non-eip155 chains.")}),U(this,"getVerifyContext",async e=>{const{attestationId:r,hash:i,encryptedId:s,metadata:o,transportType:c}=e,l={verified:{verifyUrl:o.verifyUrl||Ir,validation:"UNKNOWN",origin:o.url||""}};try{if(c===ae.link_mode){const h=this.getAppLinkIfEnabled(o,c);return l.verified.validation=h&&new URL(h).origin===new URL(o.url).origin?"VALID":"INVALID",l}const u=await this.client.core.verify.resolve({attestationId:r,hash:i,encryptedId:s,verifyUrl:o.verifyUrl});u&&(l.verified.origin=u.origin,l.verified.isScam=u.isScam,l.verified.validation=u.origin===new URL(o.url).origin?"VALID":"INVALID")}catch(u){this.client.logger.warn(u)}return this.client.logger.debug(`Verify context: ${JSON.stringify(l)}`),l}),U(this,"validateSessionProps",(e,r)=>{Object.values(e).forEach((i,s)=>{if(i==null){const{message:o}=B("MISSING_OR_INVALID",`${r} must contain an existing value for each key. Received: ${i} for key ${Object.keys(e)[s]}`);throw new Error(o)}})}),U(this,"getPendingAuthRequest",e=>{const r=this.client.auth.requests.get(e);return typeof r=="object"?r:void 0}),U(this,"addToRecentlyDeleted",(e,r)=>{if(this.recentlyDeletedMap.set(e,r),this.recentlyDeletedMap.size>=this.recentlyDeletedLimit){let i=0;const s=this.recentlyDeletedLimit/2;for(const o of this.recentlyDeletedMap.keys()){if(i++>=s)break;this.recentlyDeletedMap.delete(o)}}}),U(this,"checkRecentlyDeleted",e=>{const r=this.recentlyDeletedMap.get(e);if(r){const{message:i}=B("MISSING_OR_INVALID",`Record was recently deleted - ${r}: ${e}`);throw new Error(i)}}),U(this,"isLinkModeEnabled",(e,r)=>{var i,s,o,c,l,u,h,d,p;return!e||r!==ae.link_mode?!1:((s=(i=this.client.metadata)==null?void 0:i.redirect)==null?void 0:s.linkMode)===!0&&((c=(o=this.client.metadata)==null?void 0:o.redirect)==null?void 0:c.universal)!==void 0&&((u=(l=this.client.metadata)==null?void 0:l.redirect)==null?void 0:u.universal)!==""&&((h=e?.redirect)==null?void 0:h.universal)!==void 0&&((d=e?.redirect)==null?void 0:d.universal)!==""&&((p=e?.redirect)==null?void 0:p.linkMode)===!0&&this.client.core.linkModeSupportedApps.includes(e.redirect.universal)&&typeof(global==null?void 0:global.Linking)<"u"}),U(this,"getAppLinkIfEnabled",(e,r)=>{var i;return this.isLinkModeEnabled(e,r)?(i=e?.redirect)==null?void 0:i.universal:void 0}),U(this,"handleLinkModeMessage",({url:e})=>{if(!e||!e.includes("wc_ev")||!e.includes("topic"))return;const r=oc(e,"topic")||"",i=decodeURIComponent(oc(e,"wc_ev")||""),s=this.client.session.keys.includes(r);s&&this.client.session.update(r,{transportType:ae.link_mode}),this.client.core.dispatchEnvelope({topic:r,message:i,sessionExists:s})}),U(this,"registerLinkModeListeners",async()=>{var e;if(ea()||hn()&&(e=this.client.metadata.redirect)!=null&&e.linkMode){const r=global==null?void 0:global.Linking;if(typeof r<"u"){r.addEventListener("url",this.handleLinkModeMessage,this.client.name);const i=await r.getInitialURL();i&&setTimeout(()=>{this.handleLinkModeMessage({url:i})},50)}}}),U(this,"getTVFParams",(e,r,i)=>{var s,o,c;if(!((s=r.request)!=null&&s.method))return{};const l={correlationId:e,rpcMethods:[r.request.method],chainId:r.chainId};try{const u=this.extractTxHashesFromResult(r.request,i);l.txHashes=u,l.contractAddresses=this.isValidContractData(r.request.params)?[(c=(o=r.request.params)==null?void 0:o[0])==null?void 0:c.to]:[]}catch(u){this.client.logger.warn("Error getting TVF params",u)}return l}),U(this,"isValidContractData",e=>{var r;if(!e)return!1;try{const i=e?.data||((r=e?.[0])==null?void 0:r.data);if(!i.startsWith("0x"))return!1;const s=i.slice(2);return/^[0-9a-fA-F]*$/.test(s)?s.length%2===0:!1}catch{}return!1}),U(this,"extractTxHashesFromResult",(e,r)=>{var i;try{if(!r)return[];const s=e.method,o=rA[s];if(s==="sui_signTransaction")return[Iy(r.transactionBytes)];if(s==="near_signTransaction")return[fc(r)];if(s==="near_signTransactions")return r.map(l=>fc(l));if(s==="xrpl_signTransactionFor"||s==="xrpl_signTransaction")return[(i=r.tx_json)==null?void 0:i.hash];if(s==="polkadot_signTransaction")return[wE({transaction:e.params.transactionPayload,signature:r.signature})];if(s==="algo_signTxn")return Hn(r)?r.map(l=>_c(l)):[_c(r)];if(s==="cosmos_signDirect")return[Ty(r)];if(typeof r=="string")return[r];const c=r[o.key];if(Hn(c))return s==="solana_signAllTransactions"?c.map(l=>by(l)):c;if(typeof c=="string")return[c]}catch(s){this.client.logger.warn("Error extracting tx hashes from result",s)}return[]})}async processPendingMessageEvents(){try{const t=this.client.session.keys,e=this.client.core.relayer.messages.getWithoutAck(t);for(const[r,i]of Object.entries(e))for(const s of i)try{await this.onProviderMessageEvent({topic:r,message:s,publishedAt:Date.now()})}catch{this.client.logger.warn(`Error processing pending message event for topic: ${r}, message: ${s}`)}}catch(t){this.client.logger.warn("processPendingMessageEvents failed",t)}}isInitialized(){if(!this.initialized){const{message:t}=B("NOT_INITIALIZED",this.name);throw new Error(t)}}async confirmOnlineStateOrThrow(){await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(ue.message,t=>{this.onProviderMessageEvent(t)})}async onRelayMessage(t){const{topic:e,message:r,attestation:i,transportType:s}=t,{publicKey:o}=this.client.auth.authKeys.keys.includes(hi)?this.client.auth.authKeys.get(hi):{publicKey:void 0};try{const c=await this.client.core.crypto.decode(e,r,{receiverPublicKey:o,encoding:s===ae.link_mode?cn:Ze});xo(c)?(this.client.core.history.set(e,c),await this.onRelayEventRequest({topic:e,payload:c,attestation:i,transportType:s,encryptedId:ct(r)})):Vo(c)?(await this.client.core.history.resolve(c),await this.onRelayEventResponse({topic:e,payload:c,transportType:s}),this.client.core.history.delete(e,c.id)):await this.onRelayEventUnknownPayload({topic:e,payload:c,transportType:s}),await this.client.core.relayer.messages.ack(e,r)}catch(c){this.client.logger.error(c)}}registerExpirerEvents(){this.client.core.expirer.on(at.expired,async t=>{const{topic:e,id:r}=eh(t.target);if(r&&this.client.pendingRequest.keys.includes(r))return await this.deletePendingSessionRequest(r,B("EXPIRED"),!0);if(r&&this.client.auth.requests.keys.includes(r))return await this.deletePendingAuthRequest(r,B("EXPIRED"),!0);e?this.client.session.keys.includes(e)&&(await this.deleteSession({topic:e,expirerHasDeleted:!0}),this.client.events.emit("session_expire",{topic:e})):r&&(await this.deleteProposal(r,!0),this.client.events.emit("proposal_expire",{id:r}))})}registerPairingEvents(){this.client.core.pairing.events.on(yn.create,t=>this.onPairingCreated(t)),this.client.core.pairing.events.on(yn.delete,t=>{this.addToRecentlyDeleted(t.topic,"pairing")})}isValidPairingTopic(t){if(!pe(t,!1)){const{message:e}=B("MISSING_OR_INVALID",`pairing topic should be a string: ${t}`);throw new Error(e)}if(!this.client.core.pairing.pairings.keys.includes(t)){const{message:e}=B("NO_MATCHING_KEY",`pairing topic doesn't exist: ${t}`);throw new Error(e)}if(rn(this.client.core.pairing.pairings.get(t).expiry)){const{message:e}=B("EXPIRED",`pairing topic: ${t}`);throw new Error(e)}}async isValidSessionTopic(t){if(!pe(t,!1)){const{message:e}=B("MISSING_OR_INVALID",`session topic should be a string: ${t}`);throw new Error(e)}if(this.checkRecentlyDeleted(t),!this.client.session.keys.includes(t)){const{message:e}=B("NO_MATCHING_KEY",`session topic doesn't exist: ${t}`);throw new Error(e)}if(rn(this.client.session.get(t).expiry)){await this.deleteSession({topic:t});const{message:e}=B("EXPIRED",`session topic: ${t}`);throw new Error(e)}if(!this.client.core.crypto.keychain.has(t)){const{message:e}=B("MISSING_OR_INVALID",`session topic does not exist in keychain: ${t}`);throw await this.deleteSession({topic:t}),new Error(e)}}async isValidSessionOrPairingTopic(t){if(this.checkRecentlyDeleted(t),this.client.session.keys.includes(t))await this.isValidSessionTopic(t);else if(this.client.core.pairing.pairings.keys.includes(t))this.isValidPairingTopic(t);else if(pe(t,!1)){const{message:e}=B("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${t}`);throw new Error(e)}else{const{message:e}=B("MISSING_OR_INVALID",`session or pairing topic should be a string: ${t}`);throw new Error(e)}}async isValidProposalId(t){if(!H0(t)){const{message:e}=B("MISSING_OR_INVALID",`proposal id should be a number: ${t}`);throw new Error(e)}if(!this.client.proposal.keys.includes(t)){const{message:e}=B("NO_MATCHING_KEY",`proposal id doesn't exist: ${t}`);throw new Error(e)}if(rn(this.client.proposal.get(t).expiryTimestamp)){await this.deleteProposal(t);const{message:e}=B("EXPIRED",`proposal id: ${t}`);throw new Error(e)}}}class mA extends Sn{constructor(t,e){super(t,e,eA,_a),this.core=t,this.logger=e}}class yA extends Sn{constructor(t,e){super(t,e,tA,_a),this.core=t,this.logger=e}}class gA extends Sn{constructor(t,e){super(t,e,iA,_a,r=>r.id),this.core=t,this.logger=e}}class EA extends Sn{constructor(t,e){super(t,e,cA,Hi,()=>hi),this.core=t,this.logger=e}}class vA extends Sn{constructor(t,e){super(t,e,lA,Hi),this.core=t,this.logger=e}}class bA extends Sn{constructor(t,e){super(t,e,uA,Hi,r=>r.id),this.core=t,this.logger=e}}var IA=Object.defineProperty,AA=(n,t,e)=>t in n?IA(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,As=(n,t,e)=>AA(n,typeof t!="symbol"?t+"":t,e);class TA{constructor(t,e){this.core=t,this.logger=e,As(this,"authKeys"),As(this,"pairingTopics"),As(this,"requests"),this.authKeys=new EA(this.core,this.logger),this.pairingTopics=new vA(this.core,this.logger),this.requests=new bA(this.core,this.logger)}async init(){await this.authKeys.init(),await this.pairingTopics.init(),await this.requests.init()}}var PA=Object.defineProperty,OA=(n,t,e)=>t in n?PA(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,Y=(n,t,e)=>OA(n,typeof t!="symbol"?t+"":t,e);class wa extends Y_{constructor(t){super(t),Y(this,"protocol",ud),Y(this,"version",hd),Y(this,"name",bs.name),Y(this,"metadata"),Y(this,"core"),Y(this,"logger"),Y(this,"events",new Ln.EventEmitter),Y(this,"engine"),Y(this,"session"),Y(this,"proposal"),Y(this,"pendingRequest"),Y(this,"auth"),Y(this,"signConfig"),Y(this,"on",(r,i)=>this.events.on(r,i)),Y(this,"once",(r,i)=>this.events.once(r,i)),Y(this,"off",(r,i)=>this.events.off(r,i)),Y(this,"removeListener",(r,i)=>this.events.removeListener(r,i)),Y(this,"removeAllListeners",r=>this.events.removeAllListeners(r)),Y(this,"connect",async r=>{try{return await this.engine.connect(r)}catch(i){throw this.logger.error(i.message),i}}),Y(this,"pair",async r=>{try{return await this.engine.pair(r)}catch(i){throw this.logger.error(i.message),i}}),Y(this,"approve",async r=>{try{return await this.engine.approve(r)}catch(i){throw this.logger.error(i.message),i}}),Y(this,"reject",async r=>{try{return await this.engine.reject(r)}catch(i){throw this.logger.error(i.message),i}}),Y(this,"update",async r=>{try{return await this.engine.update(r)}catch(i){throw this.logger.error(i.message),i}}),Y(this,"extend",async r=>{try{return await this.engine.extend(r)}catch(i){throw this.logger.error(i.message),i}}),Y(this,"request",async r=>{try{return await this.engine.request(r)}catch(i){throw this.logger.error(i.message),i}}),Y(this,"respond",async r=>{try{return await this.engine.respond(r)}catch(i){throw this.logger.error(i.message),i}}),Y(this,"ping",async r=>{try{return await this.engine.ping(r)}catch(i){throw this.logger.error(i.message),i}}),Y(this,"emit",async r=>{try{return await this.engine.emit(r)}catch(i){throw this.logger.error(i.message),i}}),Y(this,"disconnect",async r=>{try{return await this.engine.disconnect(r)}catch(i){throw this.logger.error(i.message),i}}),Y(this,"find",r=>{try{return this.engine.find(r)}catch(i){throw this.logger.error(i.message),i}}),Y(this,"getPendingSessionRequests",()=>{try{return this.engine.getPendingSessionRequests()}catch(r){throw this.logger.error(r.message),r}}),Y(this,"authenticate",async(r,i)=>{try{return await this.engine.authenticate(r,i)}catch(s){throw this.logger.error(s.message),s}}),Y(this,"formatAuthMessage",r=>{try{return this.engine.formatAuthMessage(r)}catch(i){throw this.logger.error(i.message),i}}),Y(this,"approveSessionAuthenticate",async r=>{try{return await this.engine.approveSessionAuthenticate(r)}catch(i){throw this.logger.error(i.message),i}}),Y(this,"rejectSessionAuthenticate",async r=>{try{return await this.engine.rejectSessionAuthenticate(r)}catch(i){throw this.logger.error(i.message),i}}),this.name=t?.name||bs.name,this.metadata=fm(t?.metadata),this.signConfig=t?.signConfig;const e=typeof t?.logger<"u"&&typeof t?.logger!="string"?t.logger:jl(Lo({level:t?.logger||bs.logger}));this.core=t?.core||new XI(t),this.logger=ze(e,this.name),this.session=new yA(this.core,this.logger),this.proposal=new mA(this.core,this.logger),this.pendingRequest=new gA(this.core,this.logger),this.engine=new wA(this),this.auth=new TA(this.core,this.logger)}static async init(t){const e=new wa(t);return await e.initialize(),e}get context(){return rt(this.logger)}get pairing(){return this.core.pairing.pairings}async initialize(){this.logger.trace("Initialized");try{await this.core.start(),await this.session.init(),await this.proposal.init(),await this.pendingRequest.init(),await this.auth.init(),await this.engine.init(),this.logger.info("SignClient Initialization Success")}catch(t){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(t.message),t}}}const RA=wa,DA="08c4b07e3ad25f1a27c14a4e8cecb6f0",oT="eip155";async function LA(n){const{account:t,chainId:e,params:[r]}=n;if(!t.sendRawTransaction)throw new Error("The current account does not support sending raw transactions");return(await t.sendRawTransaction({chainId:e,rawTransaction:r})).transactionHash}function Wi(n,t){if(va(n.address)!==va(t))throw new Error(`Failed to validate account address (${n.address}), differs from ${t}`)}function aT(n){const t=n.split(":"),e=Number.parseInt(t[1]??"0");if(t.length!==2||t[0]!=="eip155"||e===0||!e)throw new Error(`Invalid chainId ${n}, should have the format 'eip155:1'`);return e}async function xA(n){const{account:t,chainId:e,thirdwebClient:r,params:[i]}=n;i.from!==void 0&&Wi(t,i.from);const s=xs({chain:be(e),client:r,data:i.data,gas:i.gas?Ne(i.gas):void 0,gasPrice:i.gasPrice?Ne(i.gasPrice):void 0,to:i.to,value:i.value?Ne(i.value):void 0});return(await Cl({account:t,transaction:s})).transactionHash}async function Il(n){const{account:t,params:e}=n;return Wi(t,e[1]),t.signMessage({message:{raw:e[0]}})}async function VA(n){const{account:t,params:[e]}=n;if(!t.signTransaction)throw new Error("The current account does not support signing transactions");return e.from!==void 0&&Wi(t,e.from),t.signTransaction({data:e.data,gas:e.gas?Ne(e.gas):void 0,gasPrice:e.gasPrice?Ne(e.gasPrice):void 0,nonce:e.nonce?Pn(e.nonce):void 0,to:e.to,value:e.value?Ne(e.value):void 0})}async function Al(n){const{account:t,params:e}=n;return Wi(t,e[0]),t.signTypedData(typeof e[1]=="string"?JSON.parse(e[1]):e[1])}async function pd(n){const{wallet:t,params:e}=n;return t.getChain()?.id===Pn(e[0].chainId)||await t.switchChain(Jd(Pn(e[0].chainId))),"0x1"}const cT=Object.freeze(Object.defineProperty({__proto__:null,handleSwitchChain:pd},Symbol.toStringTag,{value:"Module"})),lT="/sdk/2022-08-12/embedded-wallet",Ts=n=>`thirdwebEwsWalletUserId-${n}`,SA="walletToken",Ps=n=>`${SA}-${n}`,Tl=n=>`passkey-credential-id-${n}`,CA="a",Os=(n,t)=>`${CA}-${n}-${t}`,Pl=n=>`walletConnectSessions-${n}`,Ol=n=>`thirdweb_guest_session_id_${n}`,Rl=new Map;class ma{constructor({storage:t,clientId:e,ecosystem:r}){Object.defineProperty(this,"key",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"storage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ecosystem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.storage=t,this.key=$A(e,r?.id),this.ecosystem=r}async getItem(t){return this.storage?this.storage.getItem(t):Rl.get(t)??null}async setItem(t,e){if(this.storage)return this.storage.setItem(t,e);Rl.set(t,e)}async removeItem(t){const e=await this.getItem(t);return this.storage&&e?(this.storage.removeItem(t),!0):!1}async getWalletConnectSessions(){return this.getItem(Pl(this.key))}async saveWalletConnectSessions(t){await this.setItem(Pl(this.key),t)}async savePasskeyCredentialId(t){await this.setItem(Tl(this.key),t)}async getPasskeyCredentialId(){return this.getItem(Tl(this.key))}async saveAuthCookie(t){await this.setItem(Ps(this.key),t)}async getAuthCookie(){return this.getItem(Ps(this.key))}async removeAuthCookie(){return this.removeItem(Ps(this.key))}async saveDeviceShare(t,e){await this.saveWalletUserId(e),await this.setItem(Os(this.key,e),t)}async getDeviceShare(){const t=await this.getWalletUserId();return t?this.getItem(Os(this.key,t)):null}async removeDeviceShare(){const t=await this.getWalletUserId();return t?this.removeItem(Os(this.key,t)):!1}async getWalletUserId(){return this.getItem(Ts(this.key))}async saveWalletUserId(t){await this.setItem(Ts(this.key),t)}async removeWalletUserId(){return this.removeItem(Ts(this.key))}async getGuestSessionId(){return this.getItem(Ol(this.key))}async saveGuestSessionId(t){await this.setItem(Ol(this.key),t)}}const $A=(n,t)=>`${n}${t?`-${t}`:""}`;let Lt;async function fd(){if(!Lt)return[];const n=await Lt.getWalletConnectSessions();return JSON.parse(n??"[]")}function kA(n){Lt||(Lt=new ma({clientId:n.clientId,storage:null}))}async function uT(n){if(!Lt)return;const t=await Lt.getWalletConnectSessions(),e=JSON.parse(t??"[]");e.push(n),await Lt.saveWalletConnectSessions(Ee(e))}async function UA(n){if(!Lt)return;const t=await Lt.getWalletConnectSessions(),r=JSON.parse(t??"[]").filter(i=>i.topic!==n.topic);await Lt.saveWalletConnectSessions(Ee(r))}let Rs=new WeakMap;const NA={eth_sendRawTransaction:LA,eth_sendTransaction:xA,eth_sign:Il,eth_signTransaction:VA,eth_signTypedData:Al,eth_signTypedData_v4:Al,personal_sign:Il,wallet_addEthereumChain:n=>{throw new Error("Unsupported request method: wallet_addEthereumChain")},wallet_switchEthereumChain:pd};async function BA(n){const{wallet:t,requestHandlers:e,onConnect:r,onDisconnect:i,client:s}=n,o=n.chains&&n.chains.length>10?(console.warn("WalletConnect: Can specify no more than 10 chains, truncating to the first 10 provided chains..."),n.chains.slice(0,10)):n.chains;if(Rs.has(s))return Rs.get(s);kA({clientId:n.client.clientId});const c=mi(),l=await RA.init({metadata:{description:n.appMetadata?.description??c.description,icons:[n.appMetadata?.logoUrl??c.logoUrl],name:n.appMetadata?.name??c.name,url:n.appMetadata?.url??c.url},projectId:n.projectId??DA});l.on("session_proposal",async h=>{const{onSessionProposal:d}=await a(async()=>{const{onSessionProposal:p}=await import("./session-proposal-CM3P7DaL.js");return{onSessionProposal:p}},[]);await d({chains:o,event:h,onConnect:r,wallet:t,walletConnectClient:l}).catch(p=>{if(n.onError)n.onError(p);else throw p})}),l.on("session_request",async h=>{const{fulfillRequest:d}=await a(async()=>{const{fulfillRequest:p}=await import("./session-request-Dqw67u3p.js");return{fulfillRequest:p}},__vite__mapDeps([42,4]));await d({event:h,handlers:e,thirdwebClient:s,wallet:t,walletConnectClient:l}).catch(p=>{if(n.onError)n.onError(p);else throw p})}),l.on("session_event",async h=>{}),l.on("session_ping",h=>{}),l.on("session_delete",async h=>{await _d({session:{topic:h.topic},walletConnectClient:l}).catch(d=>{if(n.onError)n.onError(d);else throw d})});const u=l.disconnect;return l.disconnect=async h=>{const d=await u(h).catch(()=>{});return i&&zA({onDisconnect:i,topic:h.topic}),d},Rs.set(n.client,l),l}function qA(n){const{uri:t,walletConnectClient:e}=n;e.core.pairing.pair({uri:t})}async function MA(){return fd()}async function _d(n){UA(n.session);try{await n.walletConnectClient.disconnect({reason:{code:6e3,message:"Disconnected"},topic:n.session.topic})}catch{}}async function zA(n){const{topic:t,onDisconnect:e}=n,r=await fd();e(r.find(i=>i.topic===t)??{topic:t})}function jA(n){return[mt("inApp",{executionMode:n?.executionMode}),mt(Wl),mt(Rt,{appMetadata:n?.appMetadata,chains:n?.chains}),mt(Cp),mt("io.rabby"),mt($p),mt("com.okex.wallet")]}function KA(n,t){const e=new Set;let r=n();const i=()=>{for(const o of e)o()},s=o=>{r=o,i()};for(const o of t)o.subscribe(()=>{s(n())});return{getValue(){return r},subscribe(o){return e.add(o),()=>{e.delete(o)}}}}function ri(n,t,e=!0){e&&n();const r=t.map(i=>i.subscribe(()=>{n()}));return()=>{for(const i of r)i()}}const Cr="tw:connected-wallet-params";async function hT(n,t,e){if(!HA(e))throw new Error("given params are not stringifiable");const r=await n.getItem(Cr);let i;if(r){try{i=JSON.parse(r)}catch{i={}}i[t]=e}else i={[t]:e};n.setItem(Cr,Ee(i))}async function FA(n,t){const e=await n.getItem(Cr);let r;if(e){try{r=JSON.parse(e)}catch{r={}}delete r[t],n.setItem(Cr,Ee(r))}}async function dT(n,t){const e=await n.getItem(Cr);if(!e)return null;try{const r=JSON.parse(e);return r?.[t]?r[t]:null}catch{return null}}function HA(n){try{return Ee(n),!0}catch{return!1}}function WA(n){let t;return()=>(t||(t=n()),t)}function GA(n={}){return kl({filters:n,signature:"event UserOperationRevertReason(bytes32 indexed userOpHash, address indexed sender, uint256 nonce, bytes revertReason)"})}function ZA(n={}){return kl({filters:n,signature:"event PostOpRevertReason(bytes32 indexed userOpHash, address indexed sender, uint256 nonce, bytes revertReason)"})}function YA(n){const{receipt:t}=n,e={...t,blockNumber:t.blockNumber?BigInt(t.blockNumber):null,contractAddress:t.contractAddress?t.contractAddress:null,cumulativeGasUsed:t.cumulativeGasUsed?BigInt(t.cumulativeGasUsed):null,effectiveGasPrice:t.effectiveGasPrice?BigInt(t.effectiveGasPrice):null,gasUsed:t.gasUsed?BigInt(t.gasUsed):null,logs:t.logs,status:t.status,to:t.to?t.to:null,transactionHash:t.transactionHash,transactionIndex:t.transactionIndex,type:t.type};return t.blobGasPrice&&(e.blobGasPrice=BigInt(t.blobGasPrice)),t.blobGasUsed&&(e.blobGasUsed=BigInt(t.blobGasUsed)),{...n,actualGasCost:BigInt(n.actualGasCost),actualGasUsed:BigInt(n.actualGasUsed),nonce:BigInt(n.nonce),receipt:e,userOpHash:n.userOpHash}}const pT=()=>{const n=BigInt(Math.floor(Math.random()*4294967296)),t=BigInt(Math.floor(Math.random()*4294967296)),e=BigInt(Math.floor(Math.random()*4294967296)),r=BigInt(Math.floor(Math.random()*4294967296)),i=BigInt(Math.floor(Math.random()*4294967296)),s=BigInt(Math.floor(Math.random()*4294967296));return n<<BigInt(160)|t<<BigInt(128)|e<<BigInt(96)|r<<BigInt(64)|i<<BigInt(32)|s};function wd(n){return Object.fromEntries(Object.entries(n).map(([t,e])=>[t,e==null||pi(e)?e:Ao(e)]))}const{decodeErrorResult:JA}=await Ro("viem");async function fT(n){return dn({...n,operation:"eth_sendUserOperation",params:[wd(n.userOp),n.options.entrypointAddress??Ci]})}async function _T(n,t){const e=await dn({...n,operation:"eth_estimateUserOperationGas",params:[wd(n.userOp),n.options.entrypointAddress??Ci,t??{}]});return{callGasLimit:Ne(e.callGasLimit)+Op,paymasterPostOpGasLimit:e.paymasterPostOpGasLimit!==void 0?Ne(e.paymasterPostOpGasLimit):void 0,paymasterVerificationGasLimit:e.paymasterVerificationGasLimit!==void 0?Ne(e.paymasterVerificationGasLimit):void 0,preVerificationGas:Ne(e.preVerificationGas),verificationGas:e.verificationGas!==void 0?Ne(e.verificationGas):void 0,verificationGasLimit:Ne(e.verificationGasLimit)}}async function wT(n){const t=await dn({...n,operation:"thirdweb_getUserOperationGasPrice",params:[]});return{maxFeePerGas:Ne(t.maxFeePerGas),maxPriorityFeePerGas:Ne(t.maxPriorityFeePerGas)}}async function mT(n){const t=await QA(n);if(t){if(t.success===!1){const r=Sd({events:[GA(),ZA()],logs:t.logs})[0]?.args?.revertReason;if(!r)throw new Error(`UserOp failed at txHash: ${t.receipt.transactionHash}`);const i=JA({data:r});throw new Error(`UserOp failed with reason: '${i.args.join(",")}' at txHash: ${t.receipt.transactionHash}`)}return t.receipt}}async function QA(n){const t=await dn({operation:"eth_getUserOperationReceipt",options:n,params:[n.userOpHash]});if(t)return YA(t)}async function yT(n){const t=await dn({operation:"zk_paymasterData",options:n.options,params:[n.transaction]});return{paymaster:t.paymaster,paymasterInput:t.paymasterInput}}async function XA(n){const t=await dn({...n,operation:"tw_execute",params:[n.eoaAddress,n.wrappedCalls,n.signature,n.authorization]});if(!t.queueId)throw new Error(`Error executing 7702 transaction: ${Ee(t)}`);return{transactionId:t.queueId}}async function e1(n){return{transactionHash:(await dn({...n,operation:"tw_getTransactionHash",params:[n.transactionId]})).transactionHash}}async function gT(n){return{transactionHash:(await dn({operation:"zk_broadcastTransaction",options:n.options,params:[{...n.transaction,signedTransaction:n.signedTransaction}]})).transactionHash}}async function dn(n){const{options:t,operation:e,params:r}=n,i=t.bundlerUrl??Fl(t.chain),o=await $r(t.client)(i,{useAuthToken:!0,body:Ee({id:1,jsonrpc:"2.0",method:e,params:r}),headers:{"Content-Type":"application/json"},method:"POST"}),c=await o.json();if(!o.ok||c.error){let l=c.error||o.statusText;typeof l=="object"&&(l=Ee(l));const u=c.code||"UNKNOWN";throw new Error(`${e} error: ${l}
15
+ Status: ${o.status}
16
+ Code: ${u}`)}return c.result}function go(n){if(!n)return!1;if(n.id==="smart")return!0;if(n.id==="inApp"||Zn(n)){const t=n.getConfig();if(t&&"smartAccount"in t&&t.smartAccount)return!0;if(t?.executionMode){const e=t.executionMode;return e.mode==="EIP4337"||e.mode==="EIP7702"}}return!1}const md="thirdweb:connected-wallet-ids",di="thirdweb:active-wallet-id",Eo="thirdweb:active-chain",Dl="thirdweb:last-used-wallet-id";function t1(n){const t=fn(void 0),e=fn(void 0),r=fn(void 0),i=fn("unknown"),s=fn(new Map);ri(()=>{Qd([...s.getValue().values()])},[s]),ri(()=>{const g=r.getValue();if(!g)return;const I=s.getValue().get(g.id);!I||I===g||r.setValue(I)},[s,r]);const o=fn(new Map),c=fn(!1),l=KA(()=>Array.from(o.getValue().values()),[o]),u=g=>{const I=o.getValue();if(I.has(g.id))return;const b=new Map(I);b.set(g.id,g),o.setValue(b)},h=g=>{const I=o.getValue(),b=new Map(I);b.delete(g.id),o.setValue(b)},d=g=>{FA(n,g.id),h(g),t.getValue()===g&&(n.removeItem(di),e.setValue(void 0),r.setValue(void 0),t.setValue(void 0),i.setValue("disconnected"))},p=g=>{d(g),g.disconnect()},f=async(g,I)=>{if(!g.getAccount())throw new Error("Cannot set a wallet without an account as active");const L=await(async()=>I?.accountAbstraction&&!go(g)?await n1(g,I.client,I.accountAbstraction,d):g)();return await n.setItem(di,g.id),await n.setItem(Dl,g.id),u(g),I?.setWalletAsActive!==!1&&m(L),g.subscribe("accountChanged",async()=>{const x=await f(g,I);I?.onConnect?.(x,l.getValue())}),L},w=async(g,I)=>{const b=await f(g,I);return I?.onConnect?.(b,l.getValue()),b},m=g=>{const I=g.getAccount();if(!I)throw new Error("Cannot set a wallet without an account as active");u(g),t.setValue(g),e.setValue(I),r.setValue(g.getChain()),i.setValue("connected");const b=D=>{e.setValue(D)},L=g.subscribe("accountChanged",b),x=g.subscribe("chainChanged",D=>r.setValue(D)),S=g.subscribe("disconnect",()=>{y()}),y=()=>{d(g),L(),x(),S()}},_=async g=>{m(g),g.id!=="smart"&&(await n.setItem(di,g.id),await n.setItem(Dl,g.id))};ri(()=>{const g=r.getValue();g?n.setItem(Eo,Ee(g)):n.removeItem(Eo)},[r],!1),ri(async()=>{const I=l.getValue().map(b=>b?.id).filter(b=>!!b);n.setItem(md,Ee(Array.from(new Set([...I]))))},[l],!1);const E=async g=>{const I=t.getValue();if(!I)throw new Error("No active wallet found");if(!I.switchChain)throw new Error("Wallet does not support switching chains");if(go(I)){const b=await ya(n);if(b){const L=l.getValue().find(x=>x.id===b);if(L){await L.switchChain(g),await I.switchChain(g),m(I);return}}await I.switchChain(g),m(I)}else await I.switchChain(g);r.setValue(I.getChain())};function v(g){const I=s.getValue();if(g.every(x=>{const S=I.get(x.id);return Ee(S)===Ee(x)}))return;const L=new Map(I);for(const x of g)L.set(x.id,x);s.setValue(L)}return{activeAccountStore:e,activeWalletChainStore:r,activeWalletConnectionStatusStore:i,activeWalletStore:t,addConnectedWallet:u,connect:w,connectedWallets:l,defineChains:v,disconnectWallet:p,handleConnection:f,isAutoConnecting:c,removeConnectedWallet:h,setActiveWallet:_,switchActiveWalletChain:E}}async function yd(n){try{const t=await n.getItem(md);return t?JSON.parse(t):[]}catch{return[]}}async function ya(n){try{const t=await n.getItem(di);if(t)return t}catch{}return null}async function gd(n){try{const t=await n.getItem(Eo);if(t)return JSON.parse(t)}catch{}return null}const n1=async(n,t,e,r)=>{const i=n.getAccount();if(!i)throw new Error("Cannot set a wallet without an account as active");const s=Bo(e);await s.connect({chain:e.chain,client:t,personalAccount:i});const o=n.subscribe("disconnect",()=>{c()}),c=()=>{o(),r(s)};return s};function Ed(n,t){return new Promise((e,r)=>{const i=setTimeout(()=>{r(new Error(t.message))},t.ms);n.then(s=>{clearTimeout(i),e(s)},s=>{clearTimeout(i),r(s)})})}async function r1({client:n,ecosystem:t,tokenToLink:e,storage:r}){const i=$r(n,t),s=Vi("inAppWallet"),o=await r.getAuthCookie();if(!o)throw new Error("Failed to link account, no user logged in");const c={Authorization:`Bearer iaw-auth-token:${o}`,"Content-Type":"application/json"},l=await i(`${s}/api/2024-05-05/account/connect`,{body:Ee({accountAuthTokenToConnect:e}),headers:c,method:"POST"});if(!l.ok){const h=await l.json();throw new Error(h.message||"Failed to link account.")}const{linkedAccounts:u}=await l.json();return u??[]}async function ET({client:n,ecosystem:t,profileToUnlink:e,allowAccountDeletion:r=!1,storage:i}){const s=$r(n,t),o=Vi("inAppWallet"),c=await i.getAuthCookie();if(!c)throw new Error("Failed to unlink account, no user logged in");const l={Authorization:`Bearer iaw-auth-token:${c}`,"Content-Type":"application/json"},u=await s(`${o}/api/2024-05-05/account/disconnect`,{body:Ee({allowAccountDeletion:r,details:e.details,type:e.type}),headers:l,method:"POST"});if(!u.ok){const d=await u.json();throw new Error(d.message||"Failed to unlink account.")}const{linkedAccounts:h}=await u.json();return h??[]}async function vT({client:n,ecosystem:t,storage:e}){const r=$r(n,t),i=Vi("inAppWallet"),s=await e.getAuthCookie();if(!s)throw new Error("Failed to get linked accounts, no user logged in");const o={Authorization:`Bearer iaw-auth-token:${s}`,"Content-Type":"application/json"},c=await r(`${i}/api/2024-05-05/accounts`,{headers:o,method:"GET"});if(!c.ok){const u=await c.json();throw new Error(u.message||"Failed to get linked accounts.")}const{linkedAccounts:l}=await c.json();return l??[]}const vd=["google","apple","facebook","discord","line","x","tiktok","epic","coinbase","farcaster","telegram","github","twitch","steam"],bT=[...vd,"guest","backend","email","phone","passkey","wallet"],i1="0x3f707e6b",s1=[{type:"tuple[]",name:"calls",components:[{type:"address",name:"target"},{type:"uint256",name:"value"},{type:"bytes",name:"data"}]}],o1=[];function a1(n){const t=WA(async()=>"asyncParams"in n?await n.asyncParams():n);return Cd({contract:n.contract,method:[i1,s1,o1],params:async()=>[(await t()).calls],value:async()=>(await t()).overrides?.value,accessList:async()=>(await t()).overrides?.accessList,gas:async()=>(await t()).overrides?.gas,gasPrice:async()=>(await t()).overrides?.gasPrice,maxFeePerGas:async()=>(await t()).overrides?.maxFeePerGas,maxPriorityFeePerGas:async()=>(await t()).overrides?.maxPriorityFeePerGas,nonce:async()=>(await t()).overrides?.nonce,extraGas:async()=>(await t()).overrides?.extraGas,erc20Value:async()=>(await t()).overrides?.erc20Value,authorizationList:async()=>(await t()).overrides?.authorizationList})}async function c1(n){const{client:t,chain:e,bundlerUrl:r}=n,i=r??Fl(e),s=`delegation-contract:${i}`;return ql(async()=>{const c=await $r(t)(i,{useAuthToken:!0,body:Ee({id:1,jsonrpc:"2.0",method:"tw_getDelegationContract",params:[]}),headers:{"Content-Type":"application/json"},method:"POST"});if(!c.ok)throw new Error(`Failed to fetch delegation contract: ${c.status} ${c.statusText}`);const l=await c.json();if(l.error)throw new Error(`Delegation contract RPC error: ${JSON.stringify(l.error)}`);if(!l.result?.delegationContract)throw new Error("Invalid response: missing delegationContract in result");return l.result.delegationContract},{cacheKey:s,cacheTime:24*60*60*1e3})}const l1=n=>{const{client:t,adminAccount:e,sponsorGas:r}=n,i=async o=>{const c=o[0];if(!c)throw new Error("No transactions provided");const l=be(c.chainId),u=Po({address:e.address,chain:l,client:t,abi:p1});let h=c.authorizationList?.[0];const d=await c1({client:t,chain:l});if(h&&h.address?.toLowerCase()!==d.toLowerCase())throw new Error(`Authorization address does not match expected delegation contract address. Expected ${d} but got ${h.address}`);if(!h&&!await h1(u,d)){let m=c.nonce?BigInt(c.nonce):BigInt(await u1({client:t,address:e.address,chain:l}));m+=r?0n:1n;const _=await e.signAuthorization?.({address:J(d),chainId:c.chainId,nonce:m});if(!_)throw new Error("Failed to sign authorization");h=_}if(r){const w={calls:o.map(v=>({data:v.data??"0x",target:J(v.to??""),value:v.value??0n})),uid:Ep()},m=await e.signTypedData({domain:{chainId:c.chainId,name:"MinimalAccount",verifyingContract:u.address,version:"1"},message:w,primaryType:"WrappedCalls",types:{Call:[{name:"target",type:"address"},{name:"value",type:"uint256"},{name:"data",type:"bytes"}],WrappedCalls:[{name:"calls",type:"Call[]"},{name:"uid",type:"bytes32"}]}}),_=await XA({authorization:h,eoaAddress:J(e.address),options:{chain:be(c.chainId),client:t},signature:m,wrappedCalls:w});return{transactionHash:await d1({options:{chain:be(c.chainId),client:t},transactionId:_.transactionId})}}const p=a1({calls:o.map(w=>({data:w.data??"0x",target:J(w.to??""),value:w.value??0n})),contract:u,overrides:{authorizationList:h?[h]:void 0,value:o.reduce((w,m)=>w+(m.value??0n),0n)}}),f=await $d({from:e.address,transaction:p});return e.sendTransaction(f)},s={address:e.address,sendBatchTransaction:async o=>i(o),sendTransaction:async o=>i([o]),signMessage:({message:o,originalMessage:c,chainId:l})=>e.signMessage({chainId:l,message:o,originalMessage:c}),signTypedData:o=>e.signTypedData(o),sendCalls:async o=>{const{inAppWalletSendCalls:c}=await a(async()=>{const{inAppWalletSendCalls:p}=await import("./in-app-wallet-calls-CvFtsXP9.js");return{inAppWalletSendCalls:p}},__vite__mapDeps([43,44,1,31,25,23,24,33,27,45,29,4,30,28,26,32])),l=o.calls[0];if(!l)throw new Error("No calls to send");const u=l.client,h=l.chain||o.chain,d=await c({account:s,calls:o.calls,chain:h});return{chain:h,client:u,id:d}},getCallsStatus:async o=>{const{inAppWalletGetCallsStatus:c}=await a(async()=>{const{inAppWalletGetCallsStatus:l}=await import("./in-app-wallet-calls-CvFtsXP9.js");return{inAppWalletGetCallsStatus:l}},__vite__mapDeps([43,44,1,31,25,23,24,33,27,45,29,4,30,28,26,32]));return c(o)},getCallsStatusRaw:async o=>{const{inAppWalletGetCallsStatusRaw:c}=await a(async()=>{const{inAppWalletGetCallsStatusRaw:l}=await import("./in-app-wallet-calls-CvFtsXP9.js");return{inAppWalletGetCallsStatusRaw:l}},__vite__mapDeps([43,44,1,31,25,23,24,33,27,45,29,4,30,28,26,32]));return c(o)},getCapabilities:async o=>({[o.chainId??1]:{atomic:{status:"supported"},paymasterService:{supported:r??!1}}})};return s};async function u1(n){const{client:t,address:e,chain:r}=n,i=Si({chain:r,client:t});return await a(async()=>{const{eth_getTransactionCount:o}=await import("./eth_getTransactionCount-DWnnw2mX.js");return{eth_getTransactionCount:o}},__vite__mapDeps([46,27])).then(({eth_getTransactionCount:o})=>o(i,{address:J(e),blockTag:"pending"}))}async function h1(n,t){const e=await kd(n),r=e.length>0&&e.startsWith("0xef0100"),i=`0x${e.slice(8,48)}`;return r&&i.toLowerCase()===t.toLowerCase()}async function d1(n){const t=n.timeoutMs||3e5,e=n.intervalMs||1e3,r=Date.now()+t;for(;Date.now()<r;){const i=await e1({options:n.options,transactionId:n.transactionId});if(i.transactionHash)return i.transactionHash;await new Promise(s=>setTimeout(s,e))}throw new Error(`Timeout waiting for transaction to be mined on chain ${n.options.chain.id} with transactionId: ${n.transactionId}`)}const p1=[{type:"receive",stateMutability:"payable"},{type:"function",name:"createSessionWithSig",inputs:[{name:"sessionSpec",type:"tuple",internalType:"struct SessionLib.SessionSpec",components:[{name:"signer",type:"address",internalType:"address"},{name:"isWildcard",type:"bool",internalType:"bool"},{name:"expiresAt",type:"uint256",internalType:"uint256"},{name:"callPolicies",type:"tuple[]",internalType:"struct SessionLib.CallSpec[]",components:[{name:"target",type:"address",internalType:"address"},{name:"selector",type:"bytes4",internalType:"bytes4"},{name:"maxValuePerUse",type:"uint256",internalType:"uint256"},{name:"valueLimit",type:"tuple",internalType:"struct SessionLib.UsageLimit",components:[{name:"limitType",type:"uint8",internalType:"enum SessionLib.LimitType"},{name:"limit",type:"uint256",internalType:"uint256"},{name:"period",type:"uint256",internalType:"uint256"}]},{name:"constraints",type:"tuple[]",internalType:"struct SessionLib.Constraint[]",components:[{name:"condition",type:"uint8",internalType:"enum SessionLib.Condition"},{name:"index",type:"uint64",internalType:"uint64"},{name:"refValue",type:"bytes32",internalType:"bytes32"},{name:"limit",type:"tuple",internalType:"struct SessionLib.UsageLimit",components:[{name:"limitType",type:"uint8",internalType:"enum SessionLib.LimitType"},{name:"limit",type:"uint256",internalType:"uint256"},{name:"period",type:"uint256",internalType:"uint256"}]}]}]},{name:"transferPolicies",type:"tuple[]",internalType:"struct SessionLib.TransferSpec[]",components:[{name:"target",type:"address",internalType:"address"},{name:"maxValuePerUse",type:"uint256",internalType:"uint256"},{name:"valueLimit",type:"tuple",internalType:"struct SessionLib.UsageLimit",components:[{name:"limitType",type:"uint8",internalType:"enum SessionLib.LimitType"},{name:"limit",type:"uint256",internalType:"uint256"},{name:"period",type:"uint256",internalType:"uint256"}]}]},{name:"uid",type:"bytes32",internalType:"bytes32"}]},{name:"signature",type:"bytes",internalType:"bytes"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"eip712Domain",inputs:[],outputs:[{name:"fields",type:"bytes1",internalType:"bytes1"},{name:"name",type:"string",internalType:"string"},{name:"version",type:"string",internalType:"string"},{name:"chainId",type:"uint256",internalType:"uint256"},{name:"verifyingContract",type:"address",internalType:"address"},{name:"salt",type:"bytes32",internalType:"bytes32"},{name:"extensions",type:"uint256[]",internalType:"uint256[]"}],stateMutability:"view"},{type:"function",name:"execute",inputs:[{name:"calls",type:"tuple[]",internalType:"struct Call[]",components:[{name:"target",type:"address",internalType:"address"},{name:"value",type:"uint256",internalType:"uint256"},{name:"data",type:"bytes",internalType:"bytes"}]}],outputs:[],stateMutability:"payable"},{type:"function",name:"executeWithSig",inputs:[{name:"wrappedCalls",type:"tuple",internalType:"struct WrappedCalls",components:[{name:"calls",type:"tuple[]",internalType:"struct Call[]",components:[{name:"target",type:"address",internalType:"address"},{name:"value",type:"uint256",internalType:"uint256"},{name:"data",type:"bytes",internalType:"bytes"}]},{name:"uid",type:"bytes32",internalType:"bytes32"}]},{name:"signature",type:"bytes",internalType:"bytes"}],outputs:[],stateMutability:"payable"},{type:"function",name:"getCallPoliciesForSigner",inputs:[{name:"signer",type:"address",internalType:"address"}],outputs:[{name:"",type:"tuple[]",internalType:"struct SessionLib.CallSpec[]",components:[{name:"target",type:"address",internalType:"address"},{name:"selector",type:"bytes4",internalType:"bytes4"},{name:"maxValuePerUse",type:"uint256",internalType:"uint256"},{name:"valueLimit",type:"tuple",internalType:"struct SessionLib.UsageLimit",components:[{name:"limitType",type:"uint8",internalType:"enum SessionLib.LimitType"},{name:"limit",type:"uint256",internalType:"uint256"},{name:"period",type:"uint256",internalType:"uint256"}]},{name:"constraints",type:"tuple[]",internalType:"struct SessionLib.Constraint[]",components:[{name:"condition",type:"uint8",internalType:"enum SessionLib.Condition"},{name:"index",type:"uint64",internalType:"uint64"},{name:"refValue",type:"bytes32",internalType:"bytes32"},{name:"limit",type:"tuple",internalType:"struct SessionLib.UsageLimit",components:[{name:"limitType",type:"uint8",internalType:"enum SessionLib.LimitType"},{name:"limit",type:"uint256",internalType:"uint256"},{name:"period",type:"uint256",internalType:"uint256"}]}]}]}],stateMutability:"view"},{type:"function",name:"getSessionExpirationForSigner",inputs:[{name:"signer",type:"address",internalType:"address"}],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"function",name:"getSessionStateForSigner",inputs:[{name:"signer",type:"address",internalType:"address"}],outputs:[{name:"",type:"tuple",internalType:"struct SessionLib.SessionState",components:[{name:"transferValue",type:"tuple[]",internalType:"struct SessionLib.LimitState[]",components:[{name:"remaining",type:"uint256",internalType:"uint256"},{name:"target",type:"address",internalType:"address"},{name:"selector",type:"bytes4",internalType:"bytes4"},{name:"index",type:"uint256",internalType:"uint256"}]},{name:"callValue",type:"tuple[]",internalType:"struct SessionLib.LimitState[]",components:[{name:"remaining",type:"uint256",internalType:"uint256"},{name:"target",type:"address",internalType:"address"},{name:"selector",type:"bytes4",internalType:"bytes4"},{name:"index",type:"uint256",internalType:"uint256"}]},{name:"callParams",type:"tuple[]",internalType:"struct SessionLib.LimitState[]",components:[{name:"remaining",type:"uint256",internalType:"uint256"},{name:"target",type:"address",internalType:"address"},{name:"selector",type:"bytes4",internalType:"bytes4"},{name:"index",type:"uint256",internalType:"uint256"}]}]}],stateMutability:"view"},{type:"function",name:"getTransferPoliciesForSigner",inputs:[{name:"signer",type:"address",internalType:"address"}],outputs:[{name:"",type:"tuple[]",internalType:"struct SessionLib.TransferSpec[]",components:[{name:"target",type:"address",internalType:"address"},{name:"maxValuePerUse",type:"uint256",internalType:"uint256"},{name:"valueLimit",type:"tuple",internalType:"struct SessionLib.UsageLimit",components:[{name:"limitType",type:"uint8",internalType:"enum SessionLib.LimitType"},{name:"limit",type:"uint256",internalType:"uint256"},{name:"period",type:"uint256",internalType:"uint256"}]}]}],stateMutability:"view"},{type:"function",name:"isWildcardSigner",inputs:[{name:"signer",type:"address",internalType:"address"}],outputs:[{name:"",type:"bool",internalType:"bool"}],stateMutability:"view"},{type:"function",name:"onERC1155BatchReceived",inputs:[{name:"",type:"address",internalType:"address"},{name:"",type:"address",internalType:"address"},{name:"",type:"uint256[]",internalType:"uint256[]"},{name:"",type:"uint256[]",internalType:"uint256[]"},{name:"",type:"bytes",internalType:"bytes"}],outputs:[{name:"",type:"bytes4",internalType:"bytes4"}],stateMutability:"nonpayable"},{type:"function",name:"onERC1155Received",inputs:[{name:"",type:"address",internalType:"address"},{name:"",type:"address",internalType:"address"},{name:"",type:"uint256",internalType:"uint256"},{name:"",type:"uint256",internalType:"uint256"},{name:"",type:"bytes",internalType:"bytes"}],outputs:[{name:"",type:"bytes4",internalType:"bytes4"}],stateMutability:"nonpayable"},{type:"function",name:"onERC721Received",inputs:[{name:"",type:"address",internalType:"address"},{name:"",type:"address",internalType:"address"},{name:"",type:"uint256",internalType:"uint256"},{name:"",type:"bytes",internalType:"bytes"}],outputs:[{name:"",type:"bytes4",internalType:"bytes4"}],stateMutability:"nonpayable"},{type:"function",name:"supportsInterface",inputs:[{name:"interfaceId",type:"bytes4",internalType:"bytes4"}],outputs:[{name:"",type:"bool",internalType:"bool"}],stateMutability:"view"},{type:"event",name:"Executed",inputs:[{name:"to",type:"address",indexed:!0,internalType:"address"},{name:"value",type:"uint256",indexed:!1,internalType:"uint256"},{name:"data",type:"bytes",indexed:!1,internalType:"bytes"}],anonymous:!1},{type:"event",name:"SessionCreated",inputs:[{name:"signer",type:"address",indexed:!0,internalType:"address"},{name:"sessionSpec",type:"tuple",indexed:!1,internalType:"struct SessionLib.SessionSpec",components:[{name:"signer",type:"address",internalType:"address"},{name:"isWildcard",type:"bool",internalType:"bool"},{name:"expiresAt",type:"uint256",internalType:"uint256"},{name:"callPolicies",type:"tuple[]",internalType:"struct SessionLib.CallSpec[]",components:[{name:"target",type:"address",internalType:"address"},{name:"selector",type:"bytes4",internalType:"bytes4"},{name:"maxValuePerUse",type:"uint256",internalType:"uint256"},{name:"valueLimit",type:"tuple",internalType:"struct SessionLib.UsageLimit",components:[{name:"limitType",type:"uint8",internalType:"enum SessionLib.LimitType"},{name:"limit",type:"uint256",internalType:"uint256"},{name:"period",type:"uint256",internalType:"uint256"}]},{name:"constraints",type:"tuple[]",internalType:"struct SessionLib.Constraint[]",components:[{name:"condition",type:"uint8",internalType:"enum SessionLib.Condition"},{name:"index",type:"uint64",internalType:"uint64"},{name:"refValue",type:"bytes32",internalType:"bytes32"},{name:"limit",type:"tuple",internalType:"struct SessionLib.UsageLimit",components:[{name:"limitType",type:"uint8",internalType:"enum SessionLib.LimitType"},{name:"limit",type:"uint256",internalType:"uint256"},{name:"period",type:"uint256",internalType:"uint256"}]}]}]},{name:"transferPolicies",type:"tuple[]",internalType:"struct SessionLib.TransferSpec[]",components:[{name:"target",type:"address",internalType:"address"},{name:"maxValuePerUse",type:"uint256",internalType:"uint256"},{name:"valueLimit",type:"tuple",internalType:"struct SessionLib.UsageLimit",components:[{name:"limitType",type:"uint8",internalType:"enum SessionLib.LimitType"},{name:"limit",type:"uint256",internalType:"uint256"},{name:"period",type:"uint256",internalType:"uint256"}]}]},{name:"uid",type:"bytes32",internalType:"bytes32"}]}],anonymous:!1},{type:"event",name:"ValueReceived",inputs:[{name:"from",type:"address",indexed:!0,internalType:"address"},{name:"value",type:"uint256",indexed:!1,internalType:"uint256"}],anonymous:!1},{type:"error",name:"AllowanceExceeded",inputs:[{name:"allowanceUsage",type:"uint256",internalType:"uint256"},{name:"limit",type:"uint256",internalType:"uint256"},{name:"period",type:"uint64",internalType:"uint64"}]},{type:"error",name:"CallPolicyViolated",inputs:[{name:"target",type:"address",internalType:"address"},{name:"selector",type:"bytes4",internalType:"bytes4"}]},{type:"error",name:"CallReverted",inputs:[]},{type:"error",name:"ConditionFailed",inputs:[{name:"param",type:"bytes32",internalType:"bytes32"},{name:"refValue",type:"bytes32",internalType:"bytes32"},{name:"condition",type:"uint8",internalType:"uint8"}]},{type:"error",name:"InvalidDataLength",inputs:[{name:"actualLength",type:"uint256",internalType:"uint256"},{name:"expectedLength",type:"uint256",internalType:"uint256"}]},{type:"error",name:"InvalidSignature",inputs:[{name:"msgSender",type:"address",internalType:"address"},{name:"thisAddress",type:"address",internalType:"address"}]},{type:"error",name:"LifetimeUsageExceeded",inputs:[{name:"lifetimeUsage",type:"uint256",internalType:"uint256"},{name:"limit",type:"uint256",internalType:"uint256"}]},{type:"error",name:"MaxValueExceeded",inputs:[{name:"value",type:"uint256",internalType:"uint256"},{name:"maxValuePerUse",type:"uint256",internalType:"uint256"}]},{type:"error",name:"NoCallsToExecute",inputs:[]},{type:"error",name:"SessionExpired",inputs:[]},{type:"error",name:"SessionExpiresTooSoon",inputs:[]},{type:"error",name:"SessionZeroSigner",inputs:[]},{type:"error",name:"TransferPolicyViolated",inputs:[{name:"target",type:"address",internalType:"address"}]},{type:"error",name:"UIDAlreadyProcessed",inputs:[]}];function bd(n){return n.id==="inApp"||n.id==="embedded"}async function f1(n,t,e){if(t?.auth?.mode!=="popup"&&t?.auth?.mode!==void 0&&e.authenticateWithRedirect){const s=n.strategy;vd.includes(s)&&await e.authenticateWithRedirect(s,t?.auth?.mode,t?.auth?.redirectUrl)}const i=(await e.connect(n)).user.account;return Id({authAccount:i,client:n.client,createOptions:t,desiredChain:n.chain})}async function _1(n,t,e){n.authResult&&e.loginWithAuthToken&&await e.loginWithAuthToken(n.authResult);const r=await m1(e);if(!r)throw new Error("Failed to authenticate user.");const i=r.account;return Id({authAccount:i,client:n.client,createOptions:t,desiredChain:n.chain})}async function w1(n){const{connectSmartAccount:t}=await a(async()=>{const{connectSmartAccount:e}=await import("./index-DajuSfcu.js");return{connectSmartAccount:e}},__vite__mapDeps([34,4,26,1,27,28,23,24,25,29,30,31,32,35,36,37]));return t({chain:n.chain,client:n.client,personalAccount:n.authAccount},n.smartAccountOptions)}async function m1(n){const t=await n.getUser();switch(t.status){case"Logged In, Wallet Initialized":return t}}async function Id(n){const{createOptions:t,authAccount:e,desiredChain:r,client:i}=n;let s,o;const c=t&&"executionMode"in t?t.executionMode:void 0;if(c&&(c.mode==="EIP4337"?s=c.smartAccount:c.mode==="EIP7702"&&(o=c)),t&&"smartAccount"in t&&t?.smartAccount&&(s=t.smartAccount),s){const[l,u]=await w1({authAccount:e,chain:r,client:i,smartAccountOptions:s});return{account:l,adminAccount:e,chain:u}}if(o){const l=r;if(!l)throw new Error("Chain is required for EIP-7702 execution, pass a chain when connecting the inAppWallet.");return{account:l1({adminAccount:e,client:i,sponsorGas:o.sponsorGas}),adminAccount:e,chain:l}}return{account:e,chain:r||gp}}const Ds=Object.freeze(Object.defineProperty({__proto__:null,autoConnectInAppWallet:_1,connectInAppWallet:f1,isInAppWallet:bd},Symbol.toStringTag,{value:"Module"}));function y1(n){const t=r=>bd(r)||Zn(r),e=go(n.wallet)&&n.connectedWallets.some(r=>t(r)&&r.getAccount()?.address?.toLowerCase()===n.wallet.getAdminAccount?.()?.address?.toLowerCase());return t(n.wallet)||e}function g1(){if(typeof document>"u")return;const n=new URLSearchParams(window.location.search);let t;const e=window.location.hash||"";let r=e;const i=e.indexOf("?");i!==-1&&(t=new URLSearchParams(e.substring(i)),r=e.substring(0,i));const s=n.get("walletId")??t?.get("walletId")??void 0,o=n.get("authResult")??t?.get("authResult")??void 0,c=n.get("authProvider")??t?.get("authProvider")??void 0,l=n.get("authCookie")??t?.get("authCookie")??void 0,u=n.get("authFlow")??t?.get("authFlow")??void 0;if((l||o)&&s){const h=(()=>{if(o)return n.delete("authResult"),t?.delete("authResult"),JSON.parse(decodeURIComponent(o))})();n.delete("walletId"),n.delete("authProvider"),n.delete("authCookie"),n.delete("authFlow"),t?.delete("walletId"),t?.delete("authProvider"),t?.delete("authCookie"),t?.delete("authFlow");const d=n.toString(),p=d?`?${d}`:"";let f=r;if(t){const w=t.toString();w&&(f=`${r}?${w}`)}return window.history.pushState({},"",`${window.location.pathname}${p}${f}`),{authCookie:l,authFlow:u,authProvider:c,authResult:h,walletId:s}}}let Ls;const E1=async n=>{if(Ls&&!n.force&&await Ls)return!0;const t=v1(n);return Ls=t,t},v1=async({storage:n,props:t,createWalletFn:e,manager:r,connectOverride:i,setLastAuthProvider:s})=>{const{wallets:o,onConnect:c}=t,l=t.timeout??15e3;let u=!1;r.isAutoConnecting.setValue(!0);let[h,d]=await Promise.all([yd(n),ya(n)]);const p=g1();if(p?.authFlow==="link"&&p.authResult)return await b1({client:t.client,connectOverride:i,createWalletFn:e,manager:r,onConnect:c,props:t,setLastAuthProvider:s,storage:n,timeout:l,urlToken:p,wallets:o});const f=o.find(b=>b.id===p?.walletId);if(p?.authCookie&&f&&await new ma({clientId:t.client.clientId,ecosystem:Zn(f)?{id:f.id,partnerId:f.getConfig()?.partnerId}:void 0,storage:n}).saveAuthCookie(p.authCookie),p?.walletId&&(d=p.walletId,h=h?.includes(p.walletId)?h:[p.walletId,...h||[]]),p?.authProvider&&await s?.(p.authProvider,n),!h)return u;const w=await gd(n)||t.chain,m=h.map(b=>{const L=o.find(x=>x.id===b);return L||e(b)}),_=d&&(m.find(b=>b.id===d)||e(d));if(_){r.activeWalletConnectionStatusStore.setValue("connecting"),await Ed(vo({authResult:p?.authResult,client:t.client,lastConnectedChain:w,wallet:_}),{message:`AutoConnect timeout: ${l}ms limit exceeded.`,ms:l}).catch(b=>{console.warn(b.message),t.onTimeout&&t.onTimeout()});try{await(i?i(_):r.connect(_,{accountAbstraction:t.accountAbstraction,client:t.client}))}catch(b){b instanceof Error&&console.warn("Error auto connecting wallet:",b.message),r.activeWalletConnectionStatusStore.setValue("disconnected")}}else r.activeWalletConnectionStatusStore.setValue("disconnected");const E=m.filter(b=>b.id!==d&&h.includes(b.id));for(const b of E)try{await vo({authResult:p?.authResult,client:t.client,lastConnectedChain:w,wallet:b}),r.addConnectedWallet(b)}catch{}_&&y1({connectedWallets:_?[_,...E]:E,wallet:_})&&t.siweAuth?.requiresAuth&&!t.siweAuth?.isLoggedIn&&!t.siweAuth?.isLoggingIn&&await t.siweAuth?.doLogin().catch(b=>{console.warn("Error signing in with SIWE:",b.message)}),r.isAutoConnecting.setValue(!1);const g=r.activeWalletStore.getValue(),I=r.connectedWallets.getValue();if(g){u=!0;try{c?.(g,I)}catch(b){console.error("Error calling onConnect callback:",b)}}else r.activeWalletConnectionStatusStore.setValue("disconnected");return u};async function b1(n){const{client:t,connectOverride:e,createWalletFn:r,manager:i,onConnect:s,props:o,setLastAuthProvider:c,storage:l,timeout:u,urlToken:h,wallets:d}=n,[p,f]=await Promise.all([yd(l),ya(l)]),w=await gd(l)||o.chain;if(!f||!p)return console.warn("No stored wallet found for linking flow"),i.isAutoConnecting.setValue(!1),!1;h.authProvider&&await c?.(h.authProvider,l);const m=d.find(I=>I.id===f)||r(f);i.activeWalletConnectionStatusStore.setValue("connecting");try{await Ed(vo({authResult:void 0,client:t,lastConnectedChain:w,wallet:m}),{message:`AutoConnect timeout: ${u}ms limit exceeded.`,ms:u}),await(e?e(m):i.connect(m,{accountAbstraction:o.accountAbstraction,client:t}))}catch(I){return console.warn("Failed to auto-connect for linking:",I),i.activeWalletConnectionStatusStore.setValue("disconnected"),i.isAutoConnecting.setValue(!1),!1}const _=Zn(m)?{id:m.id,partnerId:m.getConfig()?.partnerId}:void 0,E=new ma({clientId:t.clientId,ecosystem:_,storage:l});try{await r1({client:t,ecosystem:_,storage:E,tokenToLink:h.authResult.storedToken.cookieString})}catch(I){console.error("Failed to link profile after redirect:",I)}i.isAutoConnecting.setValue(!1);const v=i.activeWalletStore.getValue(),g=i.connectedWallets.getValue();if(v){try{s?.(v,g)}catch(I){console.error("Error calling onConnect callback:",I)}return!0}return!1}async function vo(n){return n.wallet.autoConnect({authResult:n.authResult,chain:n.lastConnectedChain,client:n.client})}async function I1(n){const t=n.wallets||jA(n),e=t1(wi);return await E1({createWalletFn:mt,manager:e,props:{...n,wallets:t},storage:wi})}const IT=Object.freeze(Object.defineProperty({__proto__:null,DefaultWalletConnectRequestHandlers:NA,EIP1193:af,authenticate:pf,authenticateWithRedirect:ff,autoConnect:I1,createWallet:mt,createWalletAdapter:cf,createWalletConnectClient:BA,createWalletConnectSession:qA,deploySmartAccount:Ud,disconnectWalletConnectSession:_d,ecosystemWallet:ou,embeddedWallet:Ss,generateAccount:o_,getActiveWalletConnectSessions:MA,getAllWalletsList:lf,getInstalledWallets:au,getProfiles:mf,getUser:Nd,getUserEmail:uf,getUserPhoneNumber:hf,getWalletBalance:a_,getWalletInfo:Yl,inAppWallet:Ss,injectedProvider:qo,isBaseAccountSDKWallet:Ql,linkProfile:_f,preAuthenticate:df,privateKeyAccount:Ms,privateKeyToAccount:Ms,randomPrivateKey:Bd,smartWallet:Bo,unlinkProfile:wf,walletConnect:Yp},Symbol.toStringTag,{value:"Module"}));export{vT as $,Dp as A,mT as B,wT as C,DA as D,Ci as E,ai as F,pT as G,_T as H,z1 as I,Pp as J,le as K,Rp as L,yT as M,oT as N,gT as O,Fh as P,fT as Q,go as R,bT as S,ma as T,wi as U,Sr as V,lT as W,vd as X,R0 as Y,r1 as Z,ET as _,dT as a,cT as a0,IT as a1,Yl as b,mi as c,uT as d,_d as e,kp as f,Zp as g,fd as h,aT as i,LA as j,xA as k,VA as l,Al as m,gt as n,Il as o,So as p,Hn as q,Ep as r,hT as s,wa as t,Tn as u,rn as v,_e as w,WA as x,Fl as y,wd as z};