@dcl/explore-site 0.0.1-24506067692.commit-7cbe267 → 0.0.1-24533810684.commit-08f2d1e

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 (171) hide show
  1. package/assets/HomePage-DPGatVCF.js +3 -0
  2. package/assets/{QueryClientProvider-S2cSmCUs.js → QueryClientProvider-diWVe5Kl.js} +1 -1
  3. package/assets/{SensorsRounded-TwgeIrvl.js → SensorsRounded-B5CYaxPg.js} +1 -1
  4. package/assets/Web3Inner-z-tSs8sf.js +1 -0
  5. package/assets/Web3SyncProvider-CypbX7iI.js +3 -0
  6. package/assets/__federation_expose_App-Bndnzp1U.js +1 -0
  7. package/assets/__federation_fn_import-BPa8h49G.js +1 -0
  8. package/assets/__federation_shared_@dcl/core-web3/lazy-BxXRMbjM.js +1 -0
  9. package/assets/__federation_shared_@dcl/core-web3-Bg69b_qh.js +2 -0
  10. package/assets/__federation_shared_@dcl/{hooks-DWUL36eR.js → hooks-mIJ2xjF0.js} +3 -3
  11. package/assets/__federation_shared_@emotion/react-CyrdJVjV.js +1 -0
  12. package/assets/__federation_shared_@emotion/{styled-CutIM4hd.js → styled--75jFTzr.js} +1 -1
  13. package/assets/{__federation_shared_decentraland-ui2-OcYWz3BJ.js → __federation_shared_decentraland-ui2-dJS9Vwj5.js} +6 -6
  14. package/assets/{__federation_shared_react-redux-BsRWKqZd.js → __federation_shared_react-redux-PotGTJzf.js} +1 -1
  15. package/assets/{__federation_shared_react-router-dom-D6fN_MPs.js → __federation_shared_react-router-dom-BOdQQ4Uh.js} +1 -1
  16. package/assets/__federation_shared_viem-DDBJYZTJ.js +2 -0
  17. package/assets/{__federation_shared_wagmi-V68qkOak.js → __federation_shared_wagmi-CgLPXn48.js} +1 -1
  18. package/assets/{add-DYSzlqDi.js → add-B6OUNwc7.js} +1 -1
  19. package/assets/{all-wallets-Cz1_BP21.js → all-wallets-BwSwHRpq.js} +1 -1
  20. package/assets/{app-store-DJD6if64.js → app-store-CF95uJ5u.js} +1 -1
  21. package/assets/{apple-ONzgQNZb.js → apple-D-T8pMcm.js} +1 -1
  22. package/assets/{arrow-bottom-CS4hUU5K.js → arrow-bottom-DdhQXQwO.js} +1 -1
  23. package/assets/{arrow-bottom-circle-tskAwsAe.js → arrow-bottom-circle-CFQGU7p7.js} +1 -1
  24. package/assets/{arrow-left-lVGPT4Ol.js → arrow-left-BD_NkLWm.js} +1 -1
  25. package/assets/{arrow-right-DCzkLJ85.js → arrow-right-DkGqRZiP.js} +1 -1
  26. package/assets/{arrow-top-BfoirqVJ.js → arrow-top-moQ8S34l.js} +1 -1
  27. package/assets/{auto-track-ylAeu8GC.js → auto-track-DWK83jm7.js} +1 -1
  28. package/assets/{bank-C3Dt70oH.js → bank-wlox9c4u.js} +1 -1
  29. package/assets/{basic-t1j5X-od.js → basic-FS2Z04Mz.js} +1 -1
  30. package/assets/{biconomy-BA_1W9dm.js → biconomy-BrXNiP4h.js} +1 -1
  31. package/assets/{browser-CJ0usHLI.js → browser-CUQ2zQTB.js} +1 -1
  32. package/assets/{card-Cz1gdgq-.js → card-NrYjwqUv.js} +1 -1
  33. package/assets/{ccip-D79frVW8.js → ccip-B5vuDNHH.js} +1 -1
  34. package/assets/{checkmark-C5jp9GGl.js → checkmark-566o88C-.js} +1 -1
  35. package/assets/{checkmark-bold-BTecpTuR.js → checkmark-bold-3uwTX7px.js} +1 -1
  36. package/assets/{chevron-bottom-BkF7oESa.js → chevron-bottom-CfzwLSb9.js} +1 -1
  37. package/assets/{chevron-left-D1L-jaav.js → chevron-left-ClLgeGWx.js} +1 -1
  38. package/assets/{chevron-right-D5rt8sAi.js → chevron-right-aRPuH5to.js} +1 -1
  39. package/assets/{chevron-top-hc8gcFpH.js → chevron-top-YRpl4M0m.js} +1 -1
  40. package/assets/{chrome-store-ChFX3FT3.js → chrome-store-DsmdHqVO.js} +1 -1
  41. package/assets/{clock-CzLodk_r.js → clock-CZ7NDF6g.js} +1 -1
  42. package/assets/{close-BuQlpuUL.js → close-B5lXMNNb.js} +1 -1
  43. package/assets/{coinPlaceholder-B2Z6-yue.js → coinPlaceholder-BjCnyfne.js} +1 -1
  44. package/assets/{compass-CZUlvUVM.js → compass-CS_Os52w.js} +1 -1
  45. package/assets/{controller-BtDVd_aq.js → controller-DvdeaE6y.js} +2 -2
  46. package/assets/{copy-DJv2Nr5v.js → copy-fG_5Fn5Z.js} +1 -1
  47. package/assets/{core-C4Q-G7Te.js → core-D1JqYuOS.js} +15 -15
  48. package/assets/{createBundlerClient-Br8fYUWc.js → createBundlerClient-CubtDgsV.js} +1 -1
  49. package/assets/{createClient-C3MOjVgY.js → createClient-CR8DDHzD.js} +1 -1
  50. package/assets/{cursor-K6zf8P8P.js → cursor-CxCHAFeZ.js} +1 -1
  51. package/assets/{cursor-transparent-BEmzJfXZ.js → cursor-transparent-Cv37G82O.js} +1 -1
  52. package/assets/{decimals-CfK2GdYT.js → decimals-CM2j75PQ.js} +1 -1
  53. package/assets/{decimals-BZqhR7BL.js → decimals-oozSYzUv.js} +1 -1
  54. package/assets/{desktop-CR4ncbsC.js → desktop-CQ5gYxno.js} +1 -1
  55. package/assets/{detectExtension-DQJnzr-F.js → detectExtension-Cd7CtJnn.js} +1 -1
  56. package/assets/{disconnect-Cxy_6Sd8.js → disconnect-BWSZMzR2.js} +1 -1
  57. package/assets/{discord-CJNZyUSm.js → discord-CUDtk8iW.js} +1 -1
  58. package/assets/{emotion-react.browser.esm-IRopa27p.js → emotion-react.browser.esm-C8ovg3zA.js} +1 -1
  59. package/assets/{emotion-use-insertion-effect-with-fallbacks.browser.esm-Dek7Kpe6.js → emotion-use-insertion-effect-with-fallbacks.browser.esm-ZrBNnPxm.js} +1 -1
  60. package/assets/{engine-mOtmwA6L.js → engine-BKFHNloO.js} +1 -1
  61. package/assets/{estimate-l1-fee-k8yGsKsO.js → estimate-l1-fee-CiVfMTJb.js} +1 -1
  62. package/assets/{eth_estimateGas-CmhCqkRZ.js → eth_estimateGas-DXVJK7bi.js} +1 -1
  63. package/assets/{eth_getStorageAt-CGBucoOx.js → eth_getStorageAt-BiqM4f8H.js} +1 -1
  64. package/assets/{eth_getTransactionCount-y2QsTvLw.js → eth_getTransactionCount-CWjm-hBg.js} +1 -1
  65. package/assets/{etherscan-b5mqHDR2.js → etherscan-C0HSXHEU.js} +1 -1
  66. package/assets/{exclamation-triangle-Bg5fRZpy.js → exclamation-triangle-cVJGZMmD.js} +1 -1
  67. package/assets/{extension-D1_3D1KE.js → extension-D5mTVlMf.js} +1 -1
  68. package/assets/{external-link-DUCz1m1z.js → external-link-nqqrcr3l.js} +1 -1
  69. package/assets/{extractIPFS-BeKSWGjo.js → extractIPFS-Q-wepBuj.js} +1 -1
  70. package/assets/{facebook-CvV-xdYv.js → facebook-BD0Z6bjG.js} +1 -1
  71. package/assets/{farcaster-DMlzK8Ar.js → farcaster-D5t_BpGY.js} +1 -1
  72. package/assets/{fetchTokenMetadata-C4NefnOo.js → fetchTokenMetadata-D7lU3SIa.js} +2 -2
  73. package/assets/{filters-DHyStwez.js → filters-DgOMNkF7.js} +1 -1
  74. package/assets/{get-ecosystem-wallet-info-CbWTwKG3.js → get-ecosystem-wallet-info-C7wEYhAI.js} +1 -1
  75. package/assets/{getBalance-D8M0DbBu.js → getBalance-D2STxyF1.js} +1 -1
  76. package/assets/{getInstalledModules-BurEvMNK.js → getInstalledModules-DCfjvoma.js} +1 -1
  77. package/assets/{getNFT-DQZppzzw.js → getNFT-9G3EvIo6.js} +2 -2
  78. package/assets/{getNFT-CH18R735.js → getNFT-C-zNHqto.js} +1 -1
  79. package/assets/{github-IilSsxgO.js → github-EgnJPOkx.js} +1 -1
  80. package/assets/{google-CCs_wu3I.js → google-ChAeFwWG.js} +1 -1
  81. package/assets/{help-circle-D_kmea0Q.js → help-circle-HHwusGfv.js} +1 -1
  82. package/assets/{id-CEDDxPyO.js → id-C3aQusJ1.js} +1 -1
  83. package/assets/{image-CacISnw5.js → image-DCBEX8iI.js} +1 -1
  84. package/assets/{in-app-wallet-calls-ZBHxiKkB.js → in-app-wallet-calls-BeM3jls_.js} +1 -1
  85. package/assets/{index-D0B01M8T.js → index-BNo5TVn1.js} +1 -1
  86. package/assets/{index-CeMOFIJl.js → index-BTcCF8pz.js} +1 -1
  87. package/assets/{index-C_nL-yLJ.js → index-C8369Kt3.js} +1 -1
  88. package/assets/{index-DSbNI5uF.js → index-CJxT02Ns.js} +1 -1
  89. package/assets/{index-BXOfMki0.js → index-CZsU5YW3.js} +1 -1
  90. package/assets/{index-BH6zTRml.js → index-CvY3anJm.js} +1 -1
  91. package/assets/index-Cxm_S31E.js +1 -0
  92. package/assets/{index-Bm1VTLe0.js → index-D1OpWHUo.js} +1 -1
  93. package/assets/index-DIcECrTc.js +2 -0
  94. package/assets/{index-BSdPSW5L.js → index-DRyfynLp.js} +2 -2
  95. package/assets/{index-DP4gqdTC.js → index-Dd7Rwv7H.js} +2 -2
  96. package/assets/index-Dy0yjznp.js +1 -1
  97. package/assets/index-VfkM29PH.js +1 -1
  98. package/assets/{index-DCzaGJ0h.js → index-nPgQlNn6.js} +3 -3
  99. package/assets/{index.es-f9VeuVCb.js → index.es-DNUnpMVo.js} +3 -3
  100. package/assets/{index.es-CvfHWDxQ.js → index.es-qiXhv63q.js} +1 -1
  101. package/assets/{info-DZvM_7Tg.js → info-Cg-tEK6c.js} +1 -1
  102. package/assets/{info-circle-CbTMexJv.js → info-circle-A5OoaMHb.js} +1 -1
  103. package/assets/jsx-runtime-B1l0k91v.js +1 -1
  104. package/assets/{lightbulb-yx2Mb3EV.js → lightbulb-DklKm46X.js} +1 -1
  105. package/assets/{mail-Dr3LWsa7.js → mail-BSh1g2Jd.js} +1 -1
  106. package/assets/{mobile-cqKuurbN.js → mobile-DY0gT7mE.js} +1 -1
  107. package/assets/{more-B2cKG2Cj.js → more-BMDmshJx.js} +1 -1
  108. package/assets/{network-placeholder-3q6GFkiF.js → network-placeholder-DU1RU4mB.js} +1 -1
  109. package/assets/{nftPlaceholder-PhYi3Gz0.js → nftPlaceholder-ZQBNuzRA.js} +1 -1
  110. package/assets/{off-DUI09dYV.js → off-DworvT8U.js} +1 -1
  111. package/assets/{openzeppelin-BX7BOYoL.js → openzeppelin-Cwt7PzKv.js} +1 -1
  112. package/assets/{ownerOf-BC019JN1.js → ownerOf-C-ehsDvS.js} +1 -1
  113. package/assets/{parseNft-B8R4kPQV.js → parseNft-CW2Wd1uX.js} +2 -2
  114. package/assets/{play-store-JeT38BY2.js → play-store-BUEXP4Ts.js} +1 -1
  115. package/assets/{plus--DWdZlCp.js → plus-BSLABLbR.js} +1 -1
  116. package/assets/preload-helper-rvnS1VMA.js +1 -0
  117. package/assets/{qr-code-BJDvJfO3.js → qr-code-Bhv4LYqU.js} +1 -1
  118. package/assets/{qr-overlay-ClttGQRf.js → qr-overlay-CEcTSSu9.js} +1 -1
  119. package/assets/{recycle-horizontal-Lkcjnn5n.js → recycle-horizontal-DKMdpTCz.js} +1 -1
  120. package/assets/{refresh-BT1jR4Dn.js → refresh-87LbOihu.js} +1 -1
  121. package/assets/remoteEntry.js +1 -1
  122. package/assets/{reown-logo-BS-2dm8x.js → reown-logo-BtZP1pGS.js} +1 -1
  123. package/assets/{resolveImplementation-DhbopK-R.js → resolveImplementation-Bq8n-Bjt.js} +1 -1
  124. package/assets/{search-BSl5mmgI.js → search-D5S6Hyhz.js} +1 -1
  125. package/assets/{send-CHeQ9oTi.js → send-DpgbB-mt.js} +1 -1
  126. package/assets/{send-batch-transaction-D1oj-0uI.js → send-batch-transaction-BALEJgO_.js} +1 -1
  127. package/assets/{send-eip712-transaction-RoGj1xEp.js → send-eip712-transaction-Dhph80lu.js} +2 -2
  128. package/assets/{send-gasless-transaction-BA1ne_Zw.js → send-gasless-transaction-BKHuNzKw.js} +2 -2
  129. package/assets/serializeAuthorizationList-thWU7FBF.js +1 -0
  130. package/assets/{session-proposal-D3Df17qP.js → session-proposal-HTjdwE7s.js} +1 -1
  131. package/assets/{session-request-FSnknvu5.js → session-request-BfWU2VwD.js} +2 -2
  132. package/assets/{signing-CJBbgcWH.js → signing-CPQmF9YX.js} +5 -5
  133. package/assets/slice-Dr1G42o6.js +1 -0
  134. package/assets/{swapHorizontal-cske8D4e.js → swapHorizontal-CQZjmlYk.js} +1 -1
  135. package/assets/{swapHorizontalBold-b6nHPenD.js → swapHorizontalBold-DYoOkH_7.js} +1 -1
  136. package/assets/{swapHorizontalMedium-DV93kJ8d.js → swapHorizontalMedium-GdF4wR0W.js} +1 -1
  137. package/assets/{swapHorizontalRoundedBold-B-tUcUDQ.js → swapHorizontalRoundedBold-CLPmazpV.js} +1 -1
  138. package/assets/{swapVertical-b60outJ9.js → swapVertical-Cz87s-yZ.js} +1 -1
  139. package/assets/{telegram-DYtfIm5p.js → telegram-DZICyDKX.js} +1 -1
  140. package/assets/{thirdweb-CSjGe06A.js → thirdweb-84h-CMUL.js} +3 -3
  141. package/assets/{three-dots-BEq0F5FJ.js → three-dots-BNuEs7h-.js} +1 -1
  142. package/assets/{totalSupply-CqPmrflK.js → totalSupply-Cf3-EivY.js} +1 -1
  143. package/assets/{twitch-VNmCX4fc.js → twitch-EZfFCvsb.js} +1 -1
  144. package/assets/{twitterIcon-DQdyBmm7.js → twitterIcon-D-EPzD6z.js} +1 -1
  145. package/assets/uid-Cg2-wLF5.js +44 -0
  146. package/assets/{verify-Ch-jj4sL.js → verify-C66JnFn0.js} +1 -1
  147. package/assets/{verify-filled-DAsUJrHR.js → verify-filled-CTRYZAWt.js} +1 -1
  148. package/assets/{w3m-modal-CwL-F657.js → w3m-modal-C_eW6nP7.js} +1 -1
  149. package/assets/{wait-for-tx-receipt-8QHIPUR1.js → wait-for-tx-receipt-D0woCUzS.js} +1 -1
  150. package/assets/{wallet-VPqOEzNs.js → wallet-CfN0W2cy.js} +1 -1
  151. package/assets/{wallet-placeholder-x8qRsSsI.js → wallet-placeholder-3kYYEaa5.js} +1 -1
  152. package/assets/{walletconnect-CQuMWn29.js → walletconnect-bmCQ7zYa.js} +1 -1
  153. package/assets/{wallets-DA1wJowE.js → wallets-DPgFGNNu.js} +5 -5
  154. package/assets/{warning-circle-BJ1YmKtQ.js → warning-circle-DTFLsDBk.js} +1 -1
  155. package/assets/{web-connector-C73Vanyj.js → web-connector-B-b80tlH.js} +3 -3
  156. package/assets/webSocket-CO2AWAe6.js +3 -0
  157. package/assets/{x-C855X9Jf.js → x-Btssr2Ai.js} +1 -1
  158. package/index.html +14 -16
  159. package/package.json +3 -3
  160. package/assets/HomePage-DuWKLuFD.js +0 -3
  161. package/assets/__federation_expose_App-B4QxDAu7.js +0 -1
  162. package/assets/__federation_fn_import-chtkoWq_.js +0 -1
  163. package/assets/__federation_shared_@dcl/core-web3-CqeOHBSV.js +0 -2
  164. package/assets/__federation_shared_@emotion/react-ClHMF0dJ.js +0 -1
  165. package/assets/__federation_shared_viem-CX1dsuPM.js +0 -2
  166. package/assets/index-Dr-PyceS.js +0 -2
  167. package/assets/index-qLRO6nWB.js +0 -1
  168. package/assets/preload-helper-B1n3wPb0.js +0 -1
  169. package/assets/serializeTransaction-gwTERWWq.js +0 -1
  170. package/assets/uid-BU7APsHa.js +0 -44
  171. package/assets/webSocket-G5Mbc2fm.js +0 -3
@@ -1,4 +1,4 @@
1
- import{importShared as pe}from"./__federation_fn_import-chtkoWq_.js";import{c as Gn,p as Ga,a as Za,b as Ya,t as Ja,g as Qa,e as Xa,d as eo}from"./createBundlerClient-Br8fYUWc.js";import{B as Mn,_ as q,h as wr,y as to}from"./hooks.module-Cpp96UEK.js";import{E as no}from"./index-CdrMQoR6.js";import{c as ro,g as io,d as so,s as ao}from"./index-nibyPLVP.js";import{ad as Ai,X as oo,V as vr}from"./uid-BU7APsHa.js";import{a as co}from"./_commonjsHelpers-C4iS2aBk.js";function Ii(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(n=Ii(e[t]))&&(r&&(r+=" "),r+=n);else for(t in e)e[t]&&(r&&(r+=" "),r+=t);return r}function Tt(){for(var e,t,n=0,r="";n<arguments.length;)(e=arguments[n++])&&(t=Ii(e))&&(r&&(r+=" "),r+=t);return r}const uo="0.1.1";function lo(){return uo}let Y=class jn extends Error{constructor(t,n={}){const r=(()=>{if(n.cause instanceof jn){if(n.cause.details)return n.cause.details;if(n.cause.shortMessage)return n.cause.shortMessage}return n.cause?.message?n.cause.message:n.details})(),i=n.cause instanceof jn&&n.cause.docsPath||n.docsPath,a=`https://oxlib.sh${i??""}`,o=[t||"An error occurred.",...n.metaMessages?["",...n.metaMessages]:[],...r||i?["",r?`Details: ${r}`:void 0,i?`See: ${a}`:void 0]:[]].filter(c=>typeof c=="string").join(`
1
+ import{importShared as pe}from"./__federation_fn_import-BPa8h49G.js";import{c as Gn,p as Ga,a as Za,b as Ya,t as Ja,g as Qa,e as Xa,d as eo}from"./createBundlerClient-CubtDgsV.js";import{B as Mn,_ as q,h as wr,y as to}from"./hooks.module-Cpp96UEK.js";import{E as no}from"./index-CdrMQoR6.js";import{c as ro,g as io,d as so,s as ao}from"./index-nibyPLVP.js";import{ad as Ai,X as oo,V as vr}from"./uid-Cg2-wLF5.js";import{a as co}from"./_commonjsHelpers-C4iS2aBk.js";function Ii(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(n=Ii(e[t]))&&(r&&(r+=" "),r+=n);else for(t in e)e[t]&&(r&&(r+=" "),r+=t);return r}function Tt(){for(var e,t,n=0,r="";n<arguments.length;)(e=arguments[n++])&&(t=Ii(e))&&(r&&(r+=" "),r+=t);return r}const uo="0.1.1";function lo(){return uo}let Y=class jn extends Error{constructor(t,n={}){const r=(()=>{if(n.cause instanceof jn){if(n.cause.details)return n.cause.details;if(n.cause.shortMessage)return n.cause.shortMessage}return n.cause?.message?n.cause.message:n.details})(),i=n.cause instanceof jn&&n.cause.docsPath||n.docsPath,a=`https://oxlib.sh${i??""}`,o=[t||"An error occurred.",...n.metaMessages?["",...n.metaMessages]:[],...r||i?["",r?`Details: ${r}`:void 0,i?`See: ${a}`:void 0]:[]].filter(c=>typeof c=="string").join(`
2
2
  `);super(o,n.cause?{cause:n.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:`ox@${lo()}`}),this.cause=n.cause,this.details=r,this.docs=a,this.docsPath=i,this.shortMessage=t}walk(t){return Ti(this,t)}};function Ti(e,t){return t?.(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause?Ti(e.cause,t):t?null:e}/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function fo(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function Zn(e,...t){if(!fo(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}function xr(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function ho(e,t){Zn(e);const n=t.outputLen;if(e.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}function Ln(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function bn(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function ke(e,t){return e<<32-t|e>>>t}function po(e){if(typeof e!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}function Ci(e){return typeof e=="string"&&(e=po(e)),Zn(e),e}let mo=class{};function bo(e){const t=r=>e().update(Ci(r)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function go(e,t,n,r){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,n,r);const i=BigInt(32),s=BigInt(4294967295),a=Number(n>>i&s),o=Number(n&s),c=r?4:0,u=r?0:4;e.setUint32(t+c,a,r),e.setUint32(t+u,o,r)}function yo(e,t,n){return e&t^~e&n}function wo(e,t,n){return e&t^e&n^t&n}let vo=class extends mo{constructor(t,n,r,i){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=t,this.outputLen=n,this.padOffset=r,this.isLE=i,this.buffer=new Uint8Array(t),this.view=bn(this.buffer)}update(t){xr(this),t=Ci(t),Zn(t);const{view:n,buffer:r,blockLen:i}=this,s=t.length;for(let a=0;a<s;){const o=Math.min(i-this.pos,s-a);if(o===i){const c=bn(t);for(;i<=s-a;a+=i)this.process(c,a);continue}r.set(t.subarray(a,a+o),this.pos),this.pos+=o,a+=o,this.pos===i&&(this.process(n,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){xr(this),ho(t,this),this.finished=!0;const{buffer:n,view:r,blockLen:i,isLE:s}=this;let{pos:a}=this;n[a++]=128,Ln(this.buffer.subarray(a)),this.padOffset>i-a&&(this.process(r,0),a=0);for(let d=a;d<i;d++)n[d]=0;go(r,i-8,BigInt(this.length*8),s),this.process(r,0);const o=bn(t),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const u=c/4,h=this.get();if(u>h.length)throw new Error("_sha2: outputLen bigger than state");for(let d=0;d<u;d++)o.setUint32(4*d,h[d],s)}digest(){const{buffer:t,outputLen:n}=this;this.digestInto(t);const r=t.slice(0,n);return this.destroy(),r}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:n,buffer:r,length:i,finished:s,destroyed:a,pos:o}=this;return t.destroyed=a,t.finished=s,t.length=i,t.pos=o,i%n&&t.buffer.set(r),t}clone(){return this._cloneInto()}};const Le=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),xo=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]),Re=new Uint32Array(64);let ko=class extends vo{constructor(t=32){super(64,t,8,!1),this.A=Le[0]|0,this.B=Le[1]|0,this.C=Le[2]|0,this.D=Le[3]|0,this.E=Le[4]|0,this.F=Le[5]|0,this.G=Le[6]|0,this.H=Le[7]|0}get(){const{A:t,B:n,C:r,D:i,E:s,F:a,G:o,H:c}=this;return[t,n,r,i,s,a,o,c]}set(t,n,r,i,s,a,o,c){this.A=t|0,this.B=n|0,this.C=r|0,this.D=i|0,this.E=s|0,this.F=a|0,this.G=o|0,this.H=c|0}process(t,n){for(let d=0;d<16;d++,n+=4)Re[d]=t.getUint32(n,!1);for(let d=16;d<64;d++){const l=Re[d-15],f=Re[d-2],y=ke(l,7)^ke(l,18)^l>>>3,w=ke(f,17)^ke(f,19)^f>>>10;Re[d]=w+Re[d-7]+y+Re[d-16]|0}let{A:r,B:i,C:s,D:a,E:o,F:c,G:u,H:h}=this;for(let d=0;d<64;d++){const l=ke(o,6)^ke(o,11)^ke(o,25),f=h+l+yo(o,c,u)+xo[d]+Re[d]|0,w=(ke(r,2)^ke(r,13)^ke(r,22))+wo(r,i,s)|0;h=u,u=c,c=o,o=a+f|0,a=s,s=i,i=r,r=f+w|0}r=r+this.A|0,i=i+this.B|0,s=s+this.C|0,a=a+this.D|0,o=o+this.E|0,c=c+this.F|0,u=u+this.G|0,h=h+this.H|0,this.set(r,i,s,a,o,c,u,h)}roundClean(){Ln(Re)}destroy(){this.set(0,0,0,0,0,0,0,0),Ln(this.buffer)}};const Eo=bo(()=>new ko),So=Eo,st=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function un(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function Rn(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function rt(e,...t){if(!un(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}function Oi(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");Rn(e.outputLen),Rn(e.blockLen)}function nn(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function _o(e,t){rt(e);const n=t.outputLen;if(e.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}function gt(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function gn(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function Ee(e,t){return e<<32-t|e>>>t}const Pi=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",Ao=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function ft(e){if(rt(e),Pi)return e.toHex();let t="";for(let n=0;n<e.length;n++)t+=Ao[e[n]];return t}const Te={_0:48,_9:57,A:65,F:70,a:97,f:102};function kr(e){if(e>=Te._0&&e<=Te._9)return e-Te._0;if(e>=Te.A&&e<=Te.F)return e-(Te.A-10);if(e>=Te.a&&e<=Te.f)return e-(Te.a-10)}function rn(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);if(Pi)return Uint8Array.fromHex(e);const t=e.length,n=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);const r=new Uint8Array(n);for(let i=0,s=0;i<n;i++,s+=2){const a=kr(e.charCodeAt(s)),o=kr(e.charCodeAt(s+1));if(a===void 0||o===void 0){const c=e[s]+e[s+1];throw new Error('hex string expected, got non-hex character "'+c+'" at index '+s)}r[i]=a*16+o}return r}function Io(e){if(typeof e!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}function Yn(e){return typeof e=="string"&&(e=Io(e)),rt(e),e}function Ke(...e){let t=0;for(let r=0;r<e.length;r++){const i=e[r];rt(i),t+=i.length}const n=new Uint8Array(t);for(let r=0,i=0;r<e.length;r++){const s=e[r];n.set(s,i),i+=s.length}return n}let Bi=class{};function Jn(e){const t=r=>e().update(Yn(r)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function Ni(e=32){if(st&&typeof st.getRandomValues=="function")return st.getRandomValues(new Uint8Array(e));if(st&&typeof st.randomBytes=="function")return Uint8Array.from(st.randomBytes(e));throw new Error("crypto.getRandomValues must be defined")}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Qn=BigInt(0),Dn=BigInt(1);function sn(e,t=""){if(typeof e!="boolean"){const n=t&&`"${t}"`;throw new Error(n+"expected boolean, got type="+typeof e)}return e}function Xe(e,t,n=""){const r=un(e),i=e?.length,s=t!==void 0;if(!r||s&&i!==t){const a=n&&`"${n}" `,o=s?` of length ${t}`:"",c=r?`length=${i}`:`type=${typeof e}`;throw new Error(a+"expected Uint8Array"+o+", got "+c)}return e}function Dt(e){const t=e.toString(16);return t.length&1?"0"+t:t}function Mi(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);return e===""?Qn:BigInt("0x"+e)}function ln(e){return Mi(ft(e))}function ji(e){return rt(e),Mi(ft(Uint8Array.from(e).reverse()))}function Xn(e,t){return rn(e.toString(16).padStart(t*2,"0"))}function Li(e,t){return Xn(e,t).reverse()}function ue(e,t,n){let r;if(typeof t=="string")try{r=rn(t)}catch(i){throw new Error(e+" must be hex string or Uint8Array, cause: "+i)}else if(un(t))r=Uint8Array.from(t);else throw new Error(e+" must be hex string or Uint8Array");return r.length,r}const yn=e=>typeof e=="bigint"&&Qn<=e;function To(e,t,n){return yn(e)&&yn(t)&&yn(n)&&t<=e&&e<n}function Co(e,t,n,r){if(!To(t,n,r))throw new Error("expected valid "+e+": "+n+" <= n < "+r+", got "+t)}function Ri(e){let t;for(t=0;e>Qn;e>>=Dn,t+=1);return t}const jt=e=>(Dn<<BigInt(e))-Dn;function Oo(e,t,n){if(typeof e!="number"||e<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 n!="function")throw new Error("hmacFn must be a function");const r=f=>new Uint8Array(f),i=f=>Uint8Array.of(f);let s=r(e),a=r(e),o=0;const c=()=>{s.fill(1),a.fill(0),o=0},u=(...f)=>n(a,s,...f),h=(f=r(0))=>{a=u(i(0),f),s=u(),f.length!==0&&(a=u(i(1),f),s=u())},d=()=>{if(o++>=1e3)throw new Error("drbg: tried 1000 values");let f=0;const y=[];for(;f<t;){s=u();const w=s.slice();y.push(w),f+=s.length}return Ke(...y)};return(f,y)=>{c(),h(f);let w;for(;!(w=y(d()));)h();return c(),w}}function er(e,t,n={}){if(!e||typeof e!="object")throw new Error("expected valid options object");function r(i,s,a){const o=e[i];if(a&&o===void 0)return;const c=typeof o;if(c!==s||o===null)throw new Error(`param "${i}" is invalid: expected ${s}, got ${c}`)}Object.entries(t).forEach(([i,s])=>r(i,s,!1)),Object.entries(n).forEach(([i,s])=>r(i,s,!0))}function Er(e){const t=new WeakMap;return(n,...r)=>{const i=t.get(n);if(i!==void 0)return i;const s=e(n,...r);return t.set(n,s),s}}const Po="#__bigint";function dn(e,t,n){return JSON.stringify(e,(r,i)=>typeof i=="bigint"?i.toString()+Po:i,n)}function Bo(e,t){if(wt(e)>t)throw new Go({givenSize:wt(e),maxSize:t})}function No(e,t){if(typeof t=="number"&&t>0&&t>wt(e)-1)throw new Ki({offset:t,position:"start",size:wt(e)})}function Mo(e,t,n){if(typeof t=="number"&&typeof n=="number"&&wt(e)!==n-t)throw new Ki({offset:n,position:"end",size:wt(e)})}const Ce={zero:48,nine:57,A:65,F:70,a:97,f:102};function Sr(e){if(e>=Ce.zero&&e<=Ce.nine)return e-Ce.zero;if(e>=Ce.A&&e<=Ce.F)return e-(Ce.A-10);if(e>=Ce.a&&e<=Ce.f)return e-(Ce.a-10)}function tr(e,t){if(Ge(e)>t)throw new Wo({givenSize:Ge(e),maxSize:t})}function jo(e,t){if(typeof t=="number"&&t>0&&t>Ge(e)-1)throw new qi({offset:t,position:"start",size:Ge(e)})}function Lo(e,t,n){if(typeof t=="number"&&typeof n=="number"&&Ge(e)!==n-t)throw new qi({offset:n,position:"end",size:Ge(e)})}function Di(e,t={}){const{dir:n,size:r=32}=t;if(r===0)return e;const i=e.replace("0x","");if(i.length>r*2)throw new Fo({size:Math.ceil(i.length/2),targetSize:r,type:"Hex"});return`0x${i[n==="right"?"padEnd":"padStart"](r*2,"0")}`}const Ro=new TextEncoder,Do=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Uo(e,t={}){const{strict:n=!1}=t;if(!e)throw new _r(e);if(typeof e!="string")throw new _r(e);if(n&&!/^0x[0-9a-fA-F]*$/.test(e))throw new Ar(e);if(!e.startsWith("0x"))throw new Ar(e)}function fn(...e){return`0x${e.reduce((t,n)=>t+n.replace("0x",""),"")}`}function Ui(e){return e instanceof Uint8Array?yt(e):Array.isArray(e)?yt(new Uint8Array(e)):e}function yt(e,t={}){let n="";for(let i=0;i<e.length;i++)n+=Do[e[i]];const r=`0x${n}`;return typeof t.size=="number"?(tr(r,t.size),$i(r,t.size)):r}function Ve(e,t={}){const{signed:n,size:r}=t,i=BigInt(e);let s;r?n?s=(1n<<BigInt(r)*8n-1n)-1n:s=2n**(BigInt(r)*8n)-1n:typeof e=="number"&&(s=BigInt(Number.MAX_SAFE_INTEGER));const a=typeof s=="bigint"&&n?-s-1n:0;if(s&&i>s||i<a){const u=typeof e=="bigint"?"n":"";throw new zo({max:s?`${s}${u}`:void 0,min:`${a}${u}`,signed:n,size:r,value:`${e}${u}`})}const c=`0x${(n&&i<0?(1n<<BigInt(r*8))+BigInt(i):i).toString(16)}`;return r?Ho(c,r):c}function Hi(e,t={}){return yt(Ro.encode(e),t)}function Ho(e,t){return Di(e,{dir:"left",size:t})}function $i(e,t){return Di(e,{dir:"right",size:t})}function be(e,t,n,r={}){const{strict:i}=r;jo(e,t);const s=`0x${e.replace("0x","").slice((t??0)*2,(n??e.length)*2)}`;return i&&Lo(s,t,n),s}function Ge(e){return Math.ceil((e.length-2)/2)}function $o(e,t={}){const{signed:n}=t;t.size&&tr(e,t.size);const r=BigInt(e);if(!n)return r;const i=(e.length-2)/2,s=(1n<<BigInt(i)*8n)-1n,a=s>>1n;return r<=a?r:r-s-1n}function qo(e,t={}){const{strict:n=!1}=t;try{return Uo(e,{strict:n}),!0}catch{return!1}}class zo extends Y{constructor({max:t,min:n,signed:r,size:i,value:s}){super(`Number \`${s}\` is not in safe${i?` ${i*8}-bit`:""}${r?" signed":" unsigned"} integer range ${t?`(\`${n}\` to \`${t}\`)`:`(above \`${n}\`)`}`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.IntegerOutOfRangeError"})}}class _r extends Y{constructor(t){super(`Value \`${typeof t=="object"?dn(t):t}\` of type \`${typeof t}\` is an invalid hex type.`,{metaMessages:['Hex types must be represented as `"0x${string}"`.']}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.InvalidHexTypeError"})}}class Ar extends Y{constructor(t){super(`Value \`${t}\` is an invalid hex value.`,{metaMessages:['Hex values must start with `"0x"` and contain only hexadecimal characters (0-9, a-f, A-F).']}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.InvalidHexValueError"})}}let Wo=class extends Y{constructor({givenSize:t,maxSize:n}){super(`Size cannot exceed \`${n}\` bytes. Given size: \`${t}\` bytes.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SizeOverflowError"})}},qi=class extends Y{constructor({offset:t,position:n,size:r}){super(`Slice ${n==="start"?"starting":"ending"} at offset \`${t}\` is out-of-bounds (size: \`${r}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SliceOffsetOutOfBoundsError"})}};class Fo extends Y{constructor({size:t,targetSize:n,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (\`${t}\`) exceeds padding size (\`${n}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SizeExceedsPaddingSizeError"})}}function Ko(e){if(!(e instanceof Uint8Array)){if(!e)throw new Ut(e);if(typeof e!="object")throw new Ut(e);if(!("BYTES_PER_ELEMENT"in e))throw new Ut(e);if(e.BYTES_PER_ELEMENT!==1||e.constructor.name!=="Uint8Array")throw new Ut(e)}}function zi(e){return e instanceof Uint8Array?e:typeof e=="string"?Fi(e):Wi(e)}function Wi(e){return e instanceof Uint8Array?e:new Uint8Array(e)}function Fi(e,t={}){const{size:n}=t;let r=e;n&&(tr(e,n),r=$i(e,n));let i=r.slice(2);i.length%2&&(i=`0${i}`);const s=i.length/2,a=new Uint8Array(s);for(let o=0,c=0;o<s;o++){const u=Sr(i.charCodeAt(c++)),h=Sr(i.charCodeAt(c++));if(u===void 0||h===void 0)throw new Y(`Invalid byte sequence ("${i[c-2]}${i[c-1]}" in "${i}").`);a[o]=u*16+h}return a}function wt(e){return e.length}function Ir(e,t,n,r={}){const{strict:i}=r;No(e,t);const s=e.slice(t,n);return i&&Mo(s,t,n),s}function Tr(e,t={}){const{size:n}=t;typeof n<"u"&&Bo(e,n);const r=yt(e,t);return $o(r,t)}function Vo(e){try{return Ko(e),!0}catch{return!1}}class Ut extends Y{constructor(t){super(`Value \`${typeof t=="object"?dn(t):t}\` of type \`${typeof t}\` is an invalid Bytes value.`,{metaMessages:["Bytes values must be of type `Bytes`."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.InvalidBytesTypeError"})}}class Go extends Y{constructor({givenSize:t,maxSize:n}){super(`Size cannot exceed \`${n}\` bytes. Given size: \`${t}\` bytes.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.SizeOverflowError"})}}class Ki extends Y{constructor({offset:t,position:n,size:r}){super(`Slice ${n==="start"?"starting":"ending"} at offset \`${t}\` is out-of-bounds (size: \`${r}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.SliceOffsetOutOfBoundsError"})}}function Vi(e,t={}){const{as:n=typeof e=="string"?"Hex":"Bytes"}=t,r=So(zi(e));return n==="Bytes"?r:yt(r)}function Gi(e,t={}){const{compressed:n}=t,{prefix:r,x:i,y:s}=e;if(n===!1||typeof i=="bigint"&&typeof s=="bigint"){if(r!==4)throw new Cr({prefix:r,cause:new Xo});return}if(n===!0||typeof i=="bigint"&&typeof s>"u"){if(r!==3&&r!==2)throw new Cr({prefix:r,cause:new Qo});return}throw new Jo({publicKey:e})}function Zo(e){const t=(()=>{if(qo(e))return Zi(e);if(Vo(e))return Yo(e);const{prefix:n,x:r,y:i}=e;return typeof r=="bigint"&&typeof i=="bigint"?{prefix:n??4,x:r,y:i}:{prefix:n,x:r}})();return Gi(t),t}function Yo(e){return Zi(yt(e))}function Zi(e){if(e.length!==132&&e.length!==130&&e.length!==68)throw new ec({publicKey:e});if(e.length===130){const r=BigInt(be(e,0,32)),i=BigInt(be(e,32,64));return{prefix:4,x:r,y:i}}if(e.length===132){const r=Number(be(e,0,1)),i=BigInt(be(e,1,33)),s=BigInt(be(e,33,65));return{prefix:r,x:i,y:s}}const t=Number(be(e,0,1)),n=BigInt(be(e,1,33));return{prefix:t,x:n}}function nr(e,t={}){Gi(e);const{prefix:n,x:r,y:i}=e,{includePrefix:s=!0}=t;return fn(s?Ve(n,{size:1}):"0x",Ve(r,{size:32}),typeof i=="bigint"?Ve(i,{size:32}):"0x")}class Jo extends Y{constructor({publicKey:t}){super(`Value \`${dn(t)}\` is not a valid public key.`,{metaMessages:["Public key must contain:","- an `x` and `prefix` value (compressed)","- an `x`, `y`, and `prefix` value (uncompressed)"]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PublicKey.InvalidError"})}}class Cr extends Y{constructor({prefix:t,cause:n}){super(`Prefix "${t}" is invalid.`,{cause:n}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PublicKey.InvalidPrefixError"})}}class Qo extends Y{constructor(){super("Prefix must be 2 or 3 for compressed public keys."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PublicKey.InvalidCompressedPrefixError"})}}class Xo extends Y{constructor(){super("Prefix must be 4 for uncompressed public keys."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PublicKey.InvalidUncompressedPrefixError"})}}let ec=class extends Y{constructor({publicKey:t}){super(`Value \`${t}\` is an invalid public key size.`,{metaMessages:["Expected: 33 bytes (compressed + prefix), 64 bytes (uncompressed) or 65 bytes (uncompressed + prefix).",`Received ${Ge(Ui(t))} bytes.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PublicKey.InvalidSerializedSizeError"})}};const Or=2n**256n-1n;function tc(e,t,n,r){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,n,r);const i=BigInt(32),s=BigInt(4294967295),a=Number(n>>i&s),o=Number(n&s),c=r?4:0,u=r?0:4;e.setUint32(t+c,a,r),e.setUint32(t+u,o,r)}function nc(e,t,n){return e&t^~e&n}function rc(e,t,n){return e&t^e&n^t&n}let Yi=class extends Bi{constructor(t,n,r,i){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=t,this.outputLen=n,this.padOffset=r,this.isLE=i,this.buffer=new Uint8Array(t),this.view=gn(this.buffer)}update(t){nn(this),t=Yn(t),rt(t);const{view:n,buffer:r,blockLen:i}=this,s=t.length;for(let a=0;a<s;){const o=Math.min(i-this.pos,s-a);if(o===i){const c=gn(t);for(;i<=s-a;a+=i)this.process(c,a);continue}r.set(t.subarray(a,a+o),this.pos),this.pos+=o,a+=o,this.pos===i&&(this.process(n,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){nn(this),_o(t,this),this.finished=!0;const{buffer:n,view:r,blockLen:i,isLE:s}=this;let{pos:a}=this;n[a++]=128,gt(this.buffer.subarray(a)),this.padOffset>i-a&&(this.process(r,0),a=0);for(let d=a;d<i;d++)n[d]=0;tc(r,i-8,BigInt(this.length*8),s),this.process(r,0);const o=gn(t),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const u=c/4,h=this.get();if(u>h.length)throw new Error("_sha2: outputLen bigger than state");for(let d=0;d<u;d++)o.setUint32(4*d,h[d],s)}digest(){const{buffer:t,outputLen:n}=this;this.digestInto(t);const r=t.slice(0,n);return this.destroy(),r}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:n,buffer:r,length:i,finished:s,destroyed:a,pos:o}=this;return t.destroyed=a,t.finished=s,t.length=i,t.pos=o,i%n&&t.buffer.set(r),t}clone(){return this._cloneInto()}};const De=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),ie=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]),Ht=BigInt(2**32-1),Pr=BigInt(32);function ic(e,t=!1){return t?{h:Number(e&Ht),l:Number(e>>Pr&Ht)}:{h:Number(e>>Pr&Ht)|0,l:Number(e&Ht)|0}}function sc(e,t=!1){const n=e.length;let r=new Uint32Array(n),i=new Uint32Array(n);for(let s=0;s<n;s++){const{h:a,l:o}=ic(e[s],t);[r[s],i[s]]=[a,o]}return[r,i]}const Br=(e,t,n)=>e>>>n,Nr=(e,t,n)=>e<<32-n|t>>>n,at=(e,t,n)=>e>>>n|t<<32-n,ot=(e,t,n)=>e<<32-n|t>>>n,$t=(e,t,n)=>e<<64-n|t>>>n-32,qt=(e,t,n)=>e>>>n-32|t<<64-n;function Oe(e,t,n,r){const i=(t>>>0)+(r>>>0);return{h:e+n+(i/2**32|0)|0,l:i|0}}const ac=(e,t,n)=>(e>>>0)+(t>>>0)+(n>>>0),oc=(e,t,n,r)=>t+n+r+(e/2**32|0)|0,cc=(e,t,n,r)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0),uc=(e,t,n,r,i)=>t+n+r+i+(e/2**32|0)|0,lc=(e,t,n,r,i)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0)+(i>>>0),dc=(e,t,n,r,i,s)=>t+n+r+i+s+(e/2**32|0)|0,fc=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]),Ue=new Uint32Array(64);let hc=class extends Yi{constructor(t=32){super(64,t,8,!1),this.A=De[0]|0,this.B=De[1]|0,this.C=De[2]|0,this.D=De[3]|0,this.E=De[4]|0,this.F=De[5]|0,this.G=De[6]|0,this.H=De[7]|0}get(){const{A:t,B:n,C:r,D:i,E:s,F:a,G:o,H:c}=this;return[t,n,r,i,s,a,o,c]}set(t,n,r,i,s,a,o,c){this.A=t|0,this.B=n|0,this.C=r|0,this.D=i|0,this.E=s|0,this.F=a|0,this.G=o|0,this.H=c|0}process(t,n){for(let d=0;d<16;d++,n+=4)Ue[d]=t.getUint32(n,!1);for(let d=16;d<64;d++){const l=Ue[d-15],f=Ue[d-2],y=Ee(l,7)^Ee(l,18)^l>>>3,w=Ee(f,17)^Ee(f,19)^f>>>10;Ue[d]=w+Ue[d-7]+y+Ue[d-16]|0}let{A:r,B:i,C:s,D:a,E:o,F:c,G:u,H:h}=this;for(let d=0;d<64;d++){const l=Ee(o,6)^Ee(o,11)^Ee(o,25),f=h+l+nc(o,c,u)+fc[d]+Ue[d]|0,w=(Ee(r,2)^Ee(r,13)^Ee(r,22))+rc(r,i,s)|0;h=u,u=c,c=o,o=a+f|0,a=s,s=i,i=r,r=f+w|0}r=r+this.A|0,i=i+this.B|0,s=s+this.C|0,a=a+this.D|0,o=o+this.E|0,c=c+this.F|0,u=u+this.G|0,h=h+this.H|0,this.set(r,i,s,a,o,c,u,h)}roundClean(){gt(Ue)}destroy(){this.set(0,0,0,0,0,0,0,0),gt(this.buffer)}};const Ji=sc(["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(e=>BigInt(e))),pc=Ji[0],mc=Ji[1],He=new Uint32Array(80),$e=new Uint32Array(80);class Qi extends Yi{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:n,Bh:r,Bl:i,Ch:s,Cl:a,Dh:o,Dl:c,Eh:u,El:h,Fh:d,Fl:l,Gh:f,Gl:y,Hh:w,Hl:k}=this;return[t,n,r,i,s,a,o,c,u,h,d,l,f,y,w,k]}set(t,n,r,i,s,a,o,c,u,h,d,l,f,y,w,k){this.Ah=t|0,this.Al=n|0,this.Bh=r|0,this.Bl=i|0,this.Ch=s|0,this.Cl=a|0,this.Dh=o|0,this.Dl=c|0,this.Eh=u|0,this.El=h|0,this.Fh=d|0,this.Fl=l|0,this.Gh=f|0,this.Gl=y|0,this.Hh=w|0,this.Hl=k|0}process(t,n){for(let S=0;S<16;S++,n+=4)He[S]=t.getUint32(n),$e[S]=t.getUint32(n+=4);for(let S=16;S<80;S++){const T=He[S-15]|0,D=$e[S-15]|0,ee=at(T,D,1)^at(T,D,8)^Br(T,D,7),te=ot(T,D,1)^ot(T,D,8)^Nr(T,D,7),F=He[S-2]|0,B=$e[S-2]|0,ge=at(F,B,19)^$t(F,B,61)^Br(F,B,6),le=ot(F,B,19)^qt(F,B,61)^Nr(F,B,6),b=cc(te,le,$e[S-7],$e[S-16]),p=uc(b,ee,ge,He[S-7],He[S-16]);He[S]=p|0,$e[S]=b|0}let{Ah:r,Al:i,Bh:s,Bl:a,Ch:o,Cl:c,Dh:u,Dl:h,Eh:d,El:l,Fh:f,Fl:y,Gh:w,Gl:k,Hh:_,Hl:$}=this;for(let S=0;S<80;S++){const T=at(d,l,14)^at(d,l,18)^$t(d,l,41),D=ot(d,l,14)^ot(d,l,18)^qt(d,l,41),ee=d&f^~d&w,te=l&y^~l&k,F=lc($,D,te,mc[S],$e[S]),B=dc(F,_,T,ee,pc[S],He[S]),ge=F|0,le=at(r,i,28)^$t(r,i,34)^$t(r,i,39),b=ot(r,i,28)^qt(r,i,34)^qt(r,i,39),p=r&s^r&o^s&o,g=i&a^i&c^a&c;_=w|0,$=k|0,w=f|0,k=y|0,f=d|0,y=l|0,{h:d,l}=Oe(u|0,h|0,B|0,ge|0),u=o|0,h=c|0,o=s|0,c=a|0,s=r|0,a=i|0;const m=ac(ge,b,g);r=oc(m,B,le,p),i=m|0}({h:r,l:i}=Oe(this.Ah|0,this.Al|0,r|0,i|0)),{h:s,l:a}=Oe(this.Bh|0,this.Bl|0,s|0,a|0),{h:o,l:c}=Oe(this.Ch|0,this.Cl|0,o|0,c|0),{h:u,l:h}=Oe(this.Dh|0,this.Dl|0,u|0,h|0),{h:d,l}=Oe(this.Eh|0,this.El|0,d|0,l|0),{h:f,l:y}=Oe(this.Fh|0,this.Fl|0,f|0,y|0),{h:w,l:k}=Oe(this.Gh|0,this.Gl|0,w|0,k|0),{h:_,l:$}=Oe(this.Hh|0,this.Hl|0,_|0,$|0),this.set(r,i,s,a,o,c,u,h,d,l,f,y,w,k,_,$)}roundClean(){gt(He,$e)}destroy(){gt(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}class bc extends Qi{constructor(){super(48),this.Ah=ie[0]|0,this.Al=ie[1]|0,this.Bh=ie[2]|0,this.Bl=ie[3]|0,this.Ch=ie[4]|0,this.Cl=ie[5]|0,this.Dh=ie[6]|0,this.Dl=ie[7]|0,this.Eh=ie[8]|0,this.El=ie[9]|0,this.Fh=ie[10]|0,this.Fl=ie[11]|0,this.Gh=ie[12]|0,this.Gl=ie[13]|0,this.Hh=ie[14]|0,this.Hl=ie[15]|0}}const gc=Jn(()=>new hc),yc=Jn(()=>new Qi),wc=Jn(()=>new bc);class Xi extends Bi{constructor(t,n){super(),this.finished=!1,this.destroyed=!1,Oi(t);const r=Yn(n);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 a=0;a<s.length;a++)s[a]^=54;this.iHash.update(s),this.oHash=t.create();for(let a=0;a<s.length;a++)s[a]^=106;this.oHash.update(s),gt(s)}update(t){return nn(this),this.iHash.update(t),this}digestInto(t){nn(this),rt(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:n,iHash:r,finished:i,destroyed:s,blockLen:a,outputLen:o}=this;return t=t,t.finished=i,t.destroyed=s,t.blockLen=a,t.outputLen=o,t.oHash=n._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 es=(e,t,n)=>new Xi(e,t).update(n).digest();es.create=(e,t)=>new Xi(e,t);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const fe=BigInt(0),oe=BigInt(1),et=BigInt(2),ts=BigInt(3),ns=BigInt(4),rs=BigInt(5),vc=BigInt(7),is=BigInt(8),xc=BigInt(9),ss=BigInt(16);function we(e,t){const n=e%t;return n>=fe?n:t+n}function Mr(e,t){if(e===fe)throw new Error("invert: expected non-zero number");if(t<=fe)throw new Error("invert: expected positive modulus, got "+t);let n=we(e,t),r=t,i=fe,s=oe;for(;n!==fe;){const o=r/n,c=r%n,u=i-s*o;r=n,n=c,i=s,s=u}if(r!==oe)throw new Error("invert: does not exist");return we(i,t)}function rr(e,t,n){if(!e.eql(e.sqr(t),n))throw new Error("Cannot find square root")}function as(e,t){const n=(e.ORDER+oe)/ns,r=e.pow(t,n);return rr(e,r,t),r}function kc(e,t){const n=(e.ORDER-rs)/is,r=e.mul(t,et),i=e.pow(r,n),s=e.mul(t,i),a=e.mul(e.mul(s,et),i),o=e.mul(s,e.sub(a,e.ONE));return rr(e,o,t),o}function Ec(e){const t=it(e),n=os(e),r=n(t,t.neg(t.ONE)),i=n(t,r),s=n(t,t.neg(r)),a=(e+vc)/ss;return(o,c)=>{let u=o.pow(c,a),h=o.mul(u,r);const d=o.mul(u,i),l=o.mul(u,s),f=o.eql(o.sqr(h),c),y=o.eql(o.sqr(d),c);u=o.cmov(u,h,f),h=o.cmov(l,d,y);const w=o.eql(o.sqr(h),c),k=o.cmov(u,h,w);return rr(o,k,c),k}}function os(e){if(e<ts)throw new Error("sqrt is not defined for small field");let t=e-oe,n=0;for(;t%et===fe;)t/=et,n++;let r=et;const i=it(e);for(;jr(i,r)===1;)if(r++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(n===1)return as;let s=i.pow(r,t);const a=(t+oe)/et;return function(c,u){if(c.is0(u))return u;if(jr(c,u)!==1)throw new Error("Cannot find square root");let h=n,d=c.mul(c.ONE,s),l=c.pow(u,t),f=c.pow(u,a);for(;!c.eql(l,c.ONE);){if(c.is0(l))return c.ZERO;let y=1,w=c.sqr(l);for(;!c.eql(w,c.ONE);)if(y++,w=c.sqr(w),y===h)throw new Error("Cannot find square root");const k=oe<<BigInt(h-y-1),_=c.pow(d,k);h=y,d=c.sqr(_),l=c.mul(l,d),f=c.mul(f,_)}return f}}function Sc(e){return e%ns===ts?as:e%is===rs?kc:e%ss===xc?Ec(e):os(e)}const _c=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Ac(e){const t={ORDER:"bigint",MASK:"bigint",BYTES:"number",BITS:"number"},n=_c.reduce((r,i)=>(r[i]="function",r),t);return er(e,n),e}function Ic(e,t,n){if(n<fe)throw new Error("invalid exponent, negatives unsupported");if(n===fe)return e.ONE;if(n===oe)return t;let r=e.ONE,i=t;for(;n>fe;)n&oe&&(r=e.mul(r,i)),i=e.sqr(i),n>>=oe;return r}function cs(e,t,n=!1){const r=new Array(t.length).fill(n?e.ZERO:void 0),i=t.reduce((a,o,c)=>e.is0(o)?a:(r[c]=a,e.mul(a,o)),e.ONE),s=e.inv(i);return t.reduceRight((a,o,c)=>e.is0(o)?a:(r[c]=e.mul(a,r[c]),e.mul(a,o)),s),r}function jr(e,t){const n=(e.ORDER-oe)/et,r=e.pow(t,n),i=e.eql(r,e.ONE),s=e.eql(r,e.ZERO),a=e.eql(r,e.neg(e.ONE));if(!i&&!s&&!a)throw new Error("invalid Legendre symbol result");return i?1:s?0:-1}function us(e,t){t!==void 0&&Rn(t);const n=t!==void 0?t:e.toString(2).length,r=Math.ceil(n/8);return{nBitLength:n,nByteLength:r}}function it(e,t,n=!1,r={}){if(e<=fe)throw new Error("invalid field: expected ORDER > 0, got "+e);let i,s,a=!1,o;if(typeof t=="object"&&t!=null){if(r.sqrt||n)throw new Error("cannot specify opts in two arguments");const l=t;l.BITS&&(i=l.BITS),l.sqrt&&(s=l.sqrt),typeof l.isLE=="boolean"&&(n=l.isLE),typeof l.modFromBytes=="boolean"&&(a=l.modFromBytes),o=l.allowedLengths}else typeof t=="number"&&(i=t),r.sqrt&&(s=r.sqrt);const{nBitLength:c,nByteLength:u}=us(e,i);if(u>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let h;const d=Object.freeze({ORDER:e,isLE:n,BITS:c,BYTES:u,MASK:jt(c),ZERO:fe,ONE:oe,allowedLengths:o,create:l=>we(l,e),isValid:l=>{if(typeof l!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof l);return fe<=l&&l<e},is0:l=>l===fe,isValidNot0:l=>!d.is0(l)&&d.isValid(l),isOdd:l=>(l&oe)===oe,neg:l=>we(-l,e),eql:(l,f)=>l===f,sqr:l=>we(l*l,e),add:(l,f)=>we(l+f,e),sub:(l,f)=>we(l-f,e),mul:(l,f)=>we(l*f,e),pow:(l,f)=>Ic(d,l,f),div:(l,f)=>we(l*Mr(f,e),e),sqrN:l=>l*l,addN:(l,f)=>l+f,subN:(l,f)=>l-f,mulN:(l,f)=>l*f,inv:l=>Mr(l,e),sqrt:s||(l=>(h||(h=Sc(e)),h(d,l))),toBytes:l=>n?Li(l,u):Xn(l,u),fromBytes:(l,f=!0)=>{if(o){if(!o.includes(l.length)||l.length>u)throw new Error("Field.fromBytes: expected "+o+" bytes, got "+l.length);const w=new Uint8Array(u);w.set(l,n?0:w.length-l.length),l=w}if(l.length!==u)throw new Error("Field.fromBytes: expected "+u+" bytes, got "+l.length);let y=n?ji(l):ln(l);if(a&&(y=we(y,e)),!f&&!d.isValid(y))throw new Error("invalid field element: outside of range 0..ORDER");return y},invertBatch:l=>cs(d,l),cmov:(l,f,y)=>y?f:l});return Object.freeze(d)}function ls(e){if(typeof e!="bigint")throw new Error("field order must be bigint");const t=e.toString(2).length;return Math.ceil(t/8)}function ds(e){const t=ls(e);return t+Math.ceil(t/2)}function Tc(e,t,n=!1){const r=e.length,i=ls(t),s=ds(t);if(r<16||r<s||r>1024)throw new Error("expected "+s+"-1024 bytes of input, got "+r);const a=n?ji(e):ln(e),o=we(a,t-oe)+oe;return n?Li(o,i):Xn(o,i)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const vt=BigInt(0),tt=BigInt(1);function an(e,t){const n=t.negate();return e?n:t}function wn(e,t){const n=cs(e.Fp,t.map(r=>r.Z));return t.map((r,i)=>e.fromAffine(r.toAffine(n[i])))}function fs(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+e)}function vn(e,t){fs(e,t);const n=Math.ceil(t/e)+1,r=2**(e-1),i=2**e,s=jt(e),a=BigInt(e);return{windows:n,windowSize:r,mask:s,maxNumber:i,shiftBy:a}}function Lr(e,t,n){const{windowSize:r,mask:i,maxNumber:s,shiftBy:a}=n;let o=Number(e&i),c=e>>a;o>r&&(o-=s,c+=tt);const u=t*r,h=u+Math.abs(o)-1,d=o===0,l=o<0,f=t%2!==0;return{nextN:c,offset:h,isZero:d,isNeg:l,isNegF:f,offsetF:u}}function Cc(e,t){if(!Array.isArray(e))throw new Error("array expected");e.forEach((n,r)=>{if(!(n instanceof t))throw new Error("invalid point at index "+r)})}function Oc(e,t){if(!Array.isArray(e))throw new Error("array of scalars expected");e.forEach((n,r)=>{if(!t.isValid(n))throw new Error("invalid scalar at index "+r)})}const xn=new WeakMap,hs=new WeakMap;function kn(e){return hs.get(e)||1}function Rr(e){if(e!==vt)throw new Error("invalid wNAF")}class Pc{constructor(t,n){this.BASE=t.BASE,this.ZERO=t.ZERO,this.Fn=t.Fn,this.bits=n}_unsafeLadder(t,n,r=this.ZERO){let i=t;for(;n>vt;)n&tt&&(r=r.add(i)),i=i.double(),n>>=tt;return r}precomputeWindow(t,n){const{windows:r,windowSize:i}=vn(n,this.bits),s=[];let a=t,o=a;for(let c=0;c<r;c++){o=a,s.push(o);for(let u=1;u<i;u++)o=o.add(a),s.push(o);a=o.double()}return s}wNAF(t,n,r){if(!this.Fn.isValid(r))throw new Error("invalid scalar");let i=this.ZERO,s=this.BASE;const a=vn(t,this.bits);for(let o=0;o<a.windows;o++){const{nextN:c,offset:u,isZero:h,isNeg:d,isNegF:l,offsetF:f}=Lr(r,o,a);r=c,h?s=s.add(an(l,n[f])):i=i.add(an(d,n[u]))}return Rr(r),{p:i,f:s}}wNAFUnsafe(t,n,r,i=this.ZERO){const s=vn(t,this.bits);for(let a=0;a<s.windows&&r!==vt;a++){const{nextN:o,offset:c,isZero:u,isNeg:h}=Lr(r,a,s);if(r=o,!u){const d=n[c];i=i.add(h?d.negate():d)}}return Rr(r),i}getPrecomputes(t,n,r){let i=xn.get(n);return i||(i=this.precomputeWindow(n,t),t!==1&&(typeof r=="function"&&(i=r(i)),xn.set(n,i))),i}cached(t,n,r){const i=kn(t);return this.wNAF(i,this.getPrecomputes(i,t,r),n)}unsafe(t,n,r,i){const s=kn(t);return s===1?this._unsafeLadder(t,n,i):this.wNAFUnsafe(s,this.getPrecomputes(s,t,r),n,i)}createCache(t,n){fs(n,this.bits),hs.set(t,n),xn.delete(t)}hasCache(t){return kn(t)!==1}}function Bc(e,t,n,r){let i=t,s=e.ZERO,a=e.ZERO;for(;n>vt||r>vt;)n&tt&&(s=s.add(i)),r&tt&&(a=a.add(i)),i=i.double(),n>>=tt,r>>=tt;return{p1:s,p2:a}}function Nc(e,t,n,r){Cc(n,e),Oc(r,t);const i=n.length,s=r.length;if(i!==s)throw new Error("arrays of points and scalars must have equal length");const a=e.ZERO,o=Ri(BigInt(i));let c=1;o>12?c=o-3:o>4?c=o-2:o>0&&(c=2);const u=jt(c),h=new Array(Number(u)+1).fill(a),d=Math.floor((t.BITS-1)/c)*c;let l=a;for(let f=d;f>=0;f-=c){h.fill(a);for(let w=0;w<s;w++){const k=r[w],_=Number(k>>BigInt(f)&u);h[_]=h[_].add(n[w])}let y=a;for(let w=h.length-1,k=a;w>0;w--)k=k.add(h[w]),y=y.add(k);if(l=l.add(y),f!==0)for(let w=0;w<c;w++)l=l.double()}return l}function Dr(e,t,n){if(t){if(t.ORDER!==e)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return Ac(t),t}else return it(e,{isLE:n})}function Mc(e,t,n={},r){if(r===void 0&&(r=e==="edwards"),!t||typeof t!="object")throw new Error(`expected valid ${e} CURVE object`);for(const c of["p","n","h"]){const u=t[c];if(!(typeof u=="bigint"&&u>vt))throw new Error(`CURVE.${c} must be positive bigint`)}const i=Dr(t.p,n.Fp,r),s=Dr(t.n,n.Fn,r),o=["Gx","Gy","a","b"];for(const c of o)if(!i.isValid(t[c]))throw new Error(`CURVE.${c} must be valid field element of CURVE.Fp`);return t=Object.freeze(Object.assign({},t)),{CURVE:t,Fp:i,Fn:s}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Ur=(e,t)=>(e+(e>=0?t:-t)/ps)/t;function jc(e,t,n){const[[r,i],[s,a]]=t,o=Ur(a*e,n),c=Ur(-i*e,n);let u=e-o*r-c*s,h=-o*i-c*a;const d=u<je,l=h<je;d&&(u=-u),l&&(h=-h);const f=jt(Math.ceil(Ri(n)/2))+ht;if(u<je||u>=f||h<je||h>=f)throw new Error("splitScalar (endomorphism): failed, k="+e);return{k1neg:d,k1:u,k2neg:l,k2:h}}function Un(e){if(!["compact","recovered","der"].includes(e))throw new Error('Signature format must be "compact", "recovered", or "der"');return e}function En(e,t){const n={};for(let r of Object.keys(t))n[r]=e[r]===void 0?t[r]:e[r];return sn(n.lowS,"lowS"),sn(n.prehash,"prehash"),n.format!==void 0&&Un(n.format),n}class Lc extends Error{constructor(t=""){super(t)}}const Be={Err:Lc,_tlv:{encode:(e,t)=>{const{Err:n}=Be;if(e<0||e>256)throw new n("tlv.encode: wrong tag");if(t.length&1)throw new n("tlv.encode: unpadded data");const r=t.length/2,i=Dt(r);if(i.length/2&128)throw new n("tlv.encode: long form length too big");const s=r>127?Dt(i.length/2|128):"";return Dt(e)+s+i+t},decode(e,t){const{Err:n}=Be;let r=0;if(e<0||e>256)throw new n("tlv.encode: wrong tag");if(t.length<2||t[r++]!==e)throw new n("tlv.decode: wrong tlv");const i=t[r++],s=!!(i&128);let a=0;if(!s)a=i;else{const c=i&127;if(!c)throw new n("tlv.decode(long): indefinite length not supported");if(c>4)throw new n("tlv.decode(long): byte length is too big");const u=t.subarray(r,r+c);if(u.length!==c)throw new n("tlv.decode: length bytes not complete");if(u[0]===0)throw new n("tlv.decode(long): zero leftmost byte");for(const h of u)a=a<<8|h;if(r+=c,a<128)throw new n("tlv.decode(long): not minimal encoding")}const o=t.subarray(r,r+a);if(o.length!==a)throw new n("tlv.decode: wrong value length");return{v:o,l:t.subarray(r+a)}}},_int:{encode(e){const{Err:t}=Be;if(e<je)throw new t("integer: negative integers are not allowed");let n=Dt(e);if(Number.parseInt(n[0],16)&8&&(n="00"+n),n.length&1)throw new t("unexpected DER parsing assertion: unpadded hex");return n},decode(e){const{Err:t}=Be;if(e[0]&128)throw new t("invalid signature integer: negative");if(e[0]===0&&!(e[1]&128))throw new t("invalid signature integer: unnecessary leading zero");return ln(e)}},toSig(e){const{Err:t,_int:n,_tlv:r}=Be,i=ue("signature",e),{v:s,l:a}=r.decode(48,i);if(a.length)throw new t("invalid signature: left bytes after parsing");const{v:o,l:c}=r.decode(2,s),{v:u,l:h}=r.decode(2,c);if(h.length)throw new t("invalid signature: left bytes after parsing");return{r:n.decode(o),s:n.decode(u)}},hexFromSig(e){const{_tlv:t,_int:n}=Be,r=t.encode(2,n.encode(e.r)),i=t.encode(2,n.encode(e.s)),s=r+i;return t.encode(48,s)}},je=BigInt(0),ht=BigInt(1),ps=BigInt(2),zt=BigInt(3),Rc=BigInt(4);function lt(e,t){const{BYTES:n}=e;let r;if(typeof t=="bigint")r=t;else{let i=ue("private key",t);try{r=e.fromBytes(i)}catch{throw new Error(`invalid private key: expected ui8a of size ${n}, got ${typeof t}`)}}if(!e.isValidNot0(r))throw new Error("invalid private key: out of range [1..N-1]");return r}function Dc(e,t={}){const n=Mc("weierstrass",e,t),{Fp:r,Fn:i}=n;let s=n.CURVE;const{h:a,n:o}=s;er(t,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object",wrapPrivateKey:"boolean"});const{endo:c}=t;if(c&&(!r.is0(s.a)||typeof c.beta!="bigint"||!Array.isArray(c.basises)))throw new Error('invalid endo: expected "beta": bigint and "basises": array');const u=bs(r,i);function h(){if(!r.isOdd)throw new Error("compression is not supported: Field does not have .isOdd()")}function d(b,p,g){const{x:m,y:v}=p.toAffine(),A=r.toBytes(m);if(sn(g,"isCompressed"),g){h();const O=!r.isOdd(v);return Ke(ms(O),A)}else return Ke(Uint8Array.of(4),A,r.toBytes(v))}function l(b){Xe(b,void 0,"Point");const{publicKey:p,publicKeyUncompressed:g}=u,m=b.length,v=b[0],A=b.subarray(1);if(m===p&&(v===2||v===3)){const O=r.fromBytes(A);if(!r.isValid(O))throw new Error("bad point: is not on curve, wrong x");const C=w(O);let I;try{I=r.sqrt(C)}catch(J){const W=J instanceof Error?": "+J.message:"";throw new Error("bad point: is not on curve, sqrt error"+W)}h();const N=r.isOdd(I);return(v&1)===1!==N&&(I=r.neg(I)),{x:O,y:I}}else if(m===g&&v===4){const O=r.BYTES,C=r.fromBytes(A.subarray(0,O)),I=r.fromBytes(A.subarray(O,O*2));if(!k(C,I))throw new Error("bad point: is not on curve");return{x:C,y:I}}else throw new Error(`bad point: got length ${m}, expected compressed=${p} or uncompressed=${g}`)}const f=t.toBytes||d,y=t.fromBytes||l;function w(b){const p=r.sqr(b),g=r.mul(p,b);return r.add(r.add(g,r.mul(b,s.a)),s.b)}function k(b,p){const g=r.sqr(p),m=w(b);return r.eql(g,m)}if(!k(s.Gx,s.Gy))throw new Error("bad curve params: generator point");const _=r.mul(r.pow(s.a,zt),Rc),$=r.mul(r.sqr(s.b),BigInt(27));if(r.is0(r.add(_,$)))throw new Error("bad curve params: a or b");function S(b,p,g=!1){if(!r.isValid(p)||g&&r.is0(p))throw new Error(`bad point coordinate ${b}`);return p}function T(b){if(!(b instanceof B))throw new Error("ProjectivePoint expected")}function D(b){if(!c||!c.basises)throw new Error("no endo");return jc(b,c.basises,i.ORDER)}const ee=Er((b,p)=>{const{X:g,Y:m,Z:v}=b;if(r.eql(v,r.ONE))return{x:g,y:m};const A=b.is0();p==null&&(p=A?r.ONE:r.inv(v));const O=r.mul(g,p),C=r.mul(m,p),I=r.mul(v,p);if(A)return{x:r.ZERO,y:r.ZERO};if(!r.eql(I,r.ONE))throw new Error("invZ was invalid");return{x:O,y:C}}),te=Er(b=>{if(b.is0()){if(t.allowInfinityPoint&&!r.is0(b.Y))return;throw new Error("bad point: ZERO")}const{x:p,y:g}=b.toAffine();if(!r.isValid(p)||!r.isValid(g))throw new Error("bad point: x or y not field elements");if(!k(p,g))throw new Error("bad point: equation left != right");if(!b.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});function F(b,p,g,m,v){return g=new B(r.mul(g.X,b),g.Y,g.Z),p=an(m,p),g=an(v,g),p.add(g)}class B{constructor(p,g,m){this.X=S("x",p),this.Y=S("y",g,!0),this.Z=S("z",m),Object.freeze(this)}static CURVE(){return s}static fromAffine(p){const{x:g,y:m}=p||{};if(!p||!r.isValid(g)||!r.isValid(m))throw new Error("invalid affine point");if(p instanceof B)throw new Error("projective point not allowed");return r.is0(g)&&r.is0(m)?B.ZERO:new B(g,m,r.ONE)}static fromBytes(p){const g=B.fromAffine(y(Xe(p,void 0,"point")));return g.assertValidity(),g}static fromHex(p){return B.fromBytes(ue("pointHex",p))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(p=8,g=!0){return le.createCache(this,p),g||this.multiply(zt),this}assertValidity(){te(this)}hasEvenY(){const{y:p}=this.toAffine();if(!r.isOdd)throw new Error("Field doesn't support isOdd");return!r.isOdd(p)}equals(p){T(p);const{X:g,Y:m,Z:v}=this,{X:A,Y:O,Z:C}=p,I=r.eql(r.mul(g,C),r.mul(A,v)),N=r.eql(r.mul(m,C),r.mul(O,v));return I&&N}negate(){return new B(this.X,r.neg(this.Y),this.Z)}double(){const{a:p,b:g}=s,m=r.mul(g,zt),{X:v,Y:A,Z:O}=this;let C=r.ZERO,I=r.ZERO,N=r.ZERO,M=r.mul(v,v),J=r.mul(A,A),W=r.mul(O,O),H=r.mul(v,A);return H=r.add(H,H),N=r.mul(v,O),N=r.add(N,N),C=r.mul(p,N),I=r.mul(m,W),I=r.add(C,I),C=r.sub(J,I),I=r.add(J,I),I=r.mul(C,I),C=r.mul(H,C),N=r.mul(m,N),W=r.mul(p,W),H=r.sub(M,W),H=r.mul(p,H),H=r.add(H,N),N=r.add(M,M),M=r.add(N,M),M=r.add(M,W),M=r.mul(M,H),I=r.add(I,M),W=r.mul(A,O),W=r.add(W,W),M=r.mul(W,H),C=r.sub(C,M),N=r.mul(W,J),N=r.add(N,N),N=r.add(N,N),new B(C,I,N)}add(p){T(p);const{X:g,Y:m,Z:v}=this,{X:A,Y:O,Z:C}=p;let I=r.ZERO,N=r.ZERO,M=r.ZERO;const J=s.a,W=r.mul(s.b,zt);let H=r.mul(g,A),K=r.mul(m,O),Q=r.mul(v,C),ce=r.add(g,m),V=r.add(A,O);ce=r.mul(ce,V),V=r.add(H,K),ce=r.sub(ce,V),V=r.add(g,v);let re=r.add(A,C);return V=r.mul(V,re),re=r.add(H,Q),V=r.sub(V,re),re=r.add(m,v),I=r.add(O,C),re=r.mul(re,I),I=r.add(K,Q),re=r.sub(re,I),M=r.mul(J,V),I=r.mul(W,Q),M=r.add(I,M),I=r.sub(K,M),M=r.add(K,M),N=r.mul(I,M),K=r.add(H,H),K=r.add(K,H),Q=r.mul(J,Q),V=r.mul(W,V),K=r.add(K,Q),Q=r.sub(H,Q),Q=r.mul(J,Q),V=r.add(V,Q),H=r.mul(K,V),N=r.add(N,H),H=r.mul(re,V),I=r.mul(ce,I),I=r.sub(I,H),H=r.mul(ce,K),M=r.mul(re,M),M=r.add(M,H),new B(I,N,M)}subtract(p){return this.add(p.negate())}is0(){return this.equals(B.ZERO)}multiply(p){const{endo:g}=t;if(!i.isValidNot0(p))throw new Error("invalid scalar: out of range");let m,v;const A=O=>le.cached(this,O,C=>wn(B,C));if(g){const{k1neg:O,k1:C,k2neg:I,k2:N}=D(p),{p:M,f:J}=A(C),{p:W,f:H}=A(N);v=J.add(H),m=F(g.beta,M,W,O,I)}else{const{p:O,f:C}=A(p);m=O,v=C}return wn(B,[m,v])[0]}multiplyUnsafe(p){const{endo:g}=t,m=this;if(!i.isValid(p))throw new Error("invalid scalar: out of range");if(p===je||m.is0())return B.ZERO;if(p===ht)return m;if(le.hasCache(this))return this.multiply(p);if(g){const{k1neg:v,k1:A,k2neg:O,k2:C}=D(p),{p1:I,p2:N}=Bc(B,m,A,C);return F(g.beta,I,N,v,O)}else return le.unsafe(m,p)}multiplyAndAddUnsafe(p,g,m){const v=this.multiplyUnsafe(g).add(p.multiplyUnsafe(m));return v.is0()?void 0:v}toAffine(p){return ee(this,p)}isTorsionFree(){const{isTorsionFree:p}=t;return a===ht?!0:p?p(B,this):le.unsafe(this,o).is0()}clearCofactor(){const{clearCofactor:p}=t;return a===ht?this:p?p(B,this):this.multiplyUnsafe(a)}isSmallOrder(){return this.multiplyUnsafe(a).is0()}toBytes(p=!0){return sn(p,"isCompressed"),this.assertValidity(),f(B,this,p)}toHex(p=!0){return ft(this.toBytes(p))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}get px(){return this.X}get py(){return this.X}get pz(){return this.Z}toRawBytes(p=!0){return this.toBytes(p)}_setWindowSize(p){this.precompute(p)}static normalizeZ(p){return wn(B,p)}static msm(p,g){return Nc(B,i,p,g)}static fromPrivateKey(p){return B.BASE.multiply(lt(i,p))}}B.BASE=new B(s.Gx,s.Gy,r.ONE),B.ZERO=new B(r.ZERO,r.ONE,r.ZERO),B.Fp=r,B.Fn=i;const ge=i.BITS,le=new Pc(B,t.endo?Math.ceil(ge/2):ge);return B.BASE.precompute(8),B}function ms(e){return Uint8Array.of(e?2:3)}function bs(e,t){return{secretKey:t.BYTES,publicKey:1+e.BYTES,publicKeyUncompressed:1+2*e.BYTES,publicKeyHasPrefix:!0,signature:2*t.BYTES}}function Uc(e,t={}){const{Fn:n}=e,r=t.randomBytes||Ni,i=Object.assign(bs(e.Fp,n),{seed:ds(n.ORDER)});function s(f){try{return!!lt(n,f)}catch{return!1}}function a(f,y){const{publicKey:w,publicKeyUncompressed:k}=i;try{const _=f.length;return y===!0&&_!==w||y===!1&&_!==k?!1:!!e.fromBytes(f)}catch{return!1}}function o(f=r(i.seed)){return Tc(Xe(f,i.seed,"seed"),n.ORDER)}function c(f,y=!0){return e.BASE.multiply(lt(n,f)).toBytes(y)}function u(f){const y=o(f);return{secretKey:y,publicKey:c(y)}}function h(f){if(typeof f=="bigint")return!1;if(f instanceof e)return!0;const{secretKey:y,publicKey:w,publicKeyUncompressed:k}=i;if(n.allowedLengths||y===w)return;const _=ue("key",f).length;return _===w||_===k}function d(f,y,w=!0){if(h(f)===!0)throw new Error("first arg must be private key");if(h(y)===!1)throw new Error("second arg must be public key");const k=lt(n,f);return e.fromHex(y).multiply(k).toBytes(w)}return Object.freeze({getPublicKey:c,getSharedSecret:d,keygen:u,Point:e,utils:{isValidSecretKey:s,isValidPublicKey:a,randomSecretKey:o,isValidPrivateKey:s,randomPrivateKey:o,normPrivateKeyToScalar:f=>lt(n,f),precompute(f=8,y=e.BASE){return y.precompute(f,!1)}},lengths:i})}function Hc(e,t,n={}){Oi(t),er(n,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"});const r=n.randomBytes||Ni,i=n.hmac||((g,...m)=>es(t,g,Ke(...m))),{Fp:s,Fn:a}=e,{ORDER:o,BITS:c}=a,{keygen:u,getPublicKey:h,getSharedSecret:d,utils:l,lengths:f}=Uc(e,n),y={prehash:!1,lowS:typeof n.lowS=="boolean"?n.lowS:!1,format:void 0,extraEntropy:!1},w="compact";function k(g){const m=o>>ht;return g>m}function _(g,m){if(!a.isValidNot0(m))throw new Error(`invalid signature ${g}: out of range 1..Point.Fn.ORDER`);return m}function $(g,m){Un(m);const v=f.signature,A=m==="compact"?v:m==="recovered"?v+1:void 0;return Xe(g,A,`${m} signature`)}class S{constructor(m,v,A){this.r=_("r",m),this.s=_("s",v),A!=null&&(this.recovery=A),Object.freeze(this)}static fromBytes(m,v=w){$(m,v);let A;if(v==="der"){const{r:N,s:M}=Be.toSig(Xe(m));return new S(N,M)}v==="recovered"&&(A=m[0],v="compact",m=m.subarray(1));const O=a.BYTES,C=m.subarray(0,O),I=m.subarray(O,O*2);return new S(a.fromBytes(C),a.fromBytes(I),A)}static fromHex(m,v){return this.fromBytes(rn(m),v)}addRecoveryBit(m){return new S(this.r,this.s,m)}recoverPublicKey(m){const v=s.ORDER,{r:A,s:O,recovery:C}=this;if(C==null||![0,1,2,3].includes(C))throw new Error("recovery id invalid");if(o*ps<v&&C>1)throw new Error("recovery id is ambiguous for h>1 curve");const N=C===2||C===3?A+o:A;if(!s.isValid(N))throw new Error("recovery id 2 or 3 invalid");const M=s.toBytes(N),J=e.fromBytes(Ke(ms((C&1)===0),M)),W=a.inv(N),H=D(ue("msgHash",m)),K=a.create(-H*W),Q=a.create(O*W),ce=e.BASE.multiplyUnsafe(K).add(J.multiplyUnsafe(Q));if(ce.is0())throw new Error("point at infinify");return ce.assertValidity(),ce}hasHighS(){return k(this.s)}toBytes(m=w){if(Un(m),m==="der")return rn(Be.hexFromSig(this));const v=a.toBytes(this.r),A=a.toBytes(this.s);if(m==="recovered"){if(this.recovery==null)throw new Error("recovery bit must be present");return Ke(Uint8Array.of(this.recovery),v,A)}return Ke(v,A)}toHex(m){return ft(this.toBytes(m))}assertValidity(){}static fromCompact(m){return S.fromBytes(ue("sig",m),"compact")}static fromDER(m){return S.fromBytes(ue("sig",m),"der")}normalizeS(){return this.hasHighS()?new S(this.r,a.neg(this.s),this.recovery):this}toDERRawBytes(){return this.toBytes("der")}toDERHex(){return ft(this.toBytes("der"))}toCompactRawBytes(){return this.toBytes("compact")}toCompactHex(){return ft(this.toBytes("compact"))}}const T=n.bits2int||function(m){if(m.length>8192)throw new Error("input is too large");const v=ln(m),A=m.length*8-c;return A>0?v>>BigInt(A):v},D=n.bits2int_modN||function(m){return a.create(T(m))},ee=jt(c);function te(g){return Co("num < 2^"+c,g,je,ee),a.toBytes(g)}function F(g,m){return Xe(g,void 0,"message"),m?Xe(t(g),void 0,"prehashed message"):g}function B(g,m,v){if(["recovered","canonical"].some(K=>K in v))throw new Error("sign() legacy options not supported");const{lowS:A,prehash:O,extraEntropy:C}=En(v,y);g=F(g,O);const I=D(g),N=lt(a,m),M=[te(N),te(I)];if(C!=null&&C!==!1){const K=C===!0?r(f.secretKey):C;M.push(ue("extraEntropy",K))}const J=Ke(...M),W=I;function H(K){const Q=T(K);if(!a.isValidNot0(Q))return;const ce=a.inv(Q),V=e.BASE.multiply(Q).toAffine(),re=a.create(V.x);if(re===je)return;const Rt=a.create(ce*a.create(W+re*N));if(Rt===je)return;let gr=(V.x===re?0:2)|Number(V.y&ht),yr=Rt;return A&&k(Rt)&&(yr=a.neg(Rt),gr^=1),new S(re,yr,gr)}return{seed:J,k2sig:H}}function ge(g,m,v={}){g=ue("message",g);const{seed:A,k2sig:O}=B(g,m,v);return Oo(t.outputLen,a.BYTES,i)(A,O)}function le(g){let m;const v=typeof g=="string"||un(g),A=!v&&g!==null&&typeof g=="object"&&typeof g.r=="bigint"&&typeof g.s=="bigint";if(!v&&!A)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");if(A)m=new S(g.r,g.s);else if(v){try{m=S.fromBytes(ue("sig",g),"der")}catch(O){if(!(O instanceof Be.Err))throw O}if(!m)try{m=S.fromBytes(ue("sig",g),"compact")}catch{return!1}}return m||!1}function b(g,m,v,A={}){const{lowS:O,prehash:C,format:I}=En(A,y);if(v=ue("publicKey",v),m=F(ue("message",m),C),"strict"in A)throw new Error("options.strict was renamed to lowS");const N=I===void 0?le(g):S.fromBytes(ue("sig",g),I);if(N===!1)return!1;try{const M=e.fromBytes(v);if(O&&N.hasHighS())return!1;const{r:J,s:W}=N,H=D(m),K=a.inv(W),Q=a.create(H*K),ce=a.create(J*K),V=e.BASE.multiplyUnsafe(Q).add(M.multiplyUnsafe(ce));return V.is0()?!1:a.create(V.x)===J}catch{return!1}}function p(g,m,v={}){const{prehash:A}=En(v,y);return m=F(m,A),S.fromBytes(g,"recovered").recoverPublicKey(m).toBytes()}return Object.freeze({keygen:u,getPublicKey:h,getSharedSecret:d,utils:l,lengths:f,Point:e,sign:ge,verify:b,recoverPublicKey:p,Signature:S,hash:t})}function $c(e){const t={a:e.a,b:e.b,p:e.Fp.ORDER,n:e.n,h:e.h,Gx:e.Gx,Gy:e.Gy},n=e.Fp;let r=e.allowedPrivateKeyLengths?Array.from(new Set(e.allowedPrivateKeyLengths.map(a=>Math.ceil(a/2)))):void 0;const i=it(t.n,{BITS:e.nBitLength,allowedLengths:r,modFromBytes:e.wrapPrivateKey}),s={Fp:n,Fn:i,allowInfinityPoint:e.allowInfinityPoint,endo:e.endo,isTorsionFree:e.isTorsionFree,clearCofactor:e.clearCofactor,fromBytes:e.fromBytes,toBytes:e.toBytes};return{CURVE:t,curveOpts:s}}function qc(e){const{CURVE:t,curveOpts:n}=$c(e),r={hmac:e.hmac,randomBytes:e.randomBytes,lowS:e.lowS,bits2int:e.bits2int,bits2int_modN:e.bits2int_modN};return{CURVE:t,curveOpts:n,hash:e.hash,ecdsaOpts:r}}function zc(e,t){const n=t.Point;return Object.assign({},t,{ProjectivePoint:n,CURVE:Object.assign({},e,us(n.Fn.ORDER,n.Fn.BITS))})}function Wc(e){const{CURVE:t,curveOpts:n,hash:r,ecdsaOpts:i}=qc(e),s=Dc(t,n),a=Hc(s,r,i);return zc(e,a)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function ir(e,t){const n=r=>Wc({...e,hash:r});return{...n(t),create:n}}function Fc(e,t={}){const{recovered:n}=t;if(typeof e.r>"u")throw new Sn({signature:e});if(typeof e.s>"u")throw new Sn({signature:e});if(n&&typeof e.yParity>"u")throw new Sn({signature:e});if(e.r<0n||e.r>Or)throw new Yc({value:e.r});if(e.s<0n||e.s>Or)throw new Jc({value:e.s});if(typeof e.yParity=="number"&&e.yParity!==0&&e.yParity!==1)throw new sr({value:e.yParity})}function gs(e){if(e.length!==130&&e.length!==132)throw new Zc({signature:e});const t=BigInt(be(e,0,32)),n=BigInt(be(e,32,64)),r=(()=>{const i=+`0x${e.slice(130)}`;if(!Number.isNaN(i))try{return Vc(i)}catch{throw new sr({value:i})}})();return typeof r>"u"?{r:t,s:n}:{r:t,s:n,yParity:r}}function Kc(e){Fc(e);const t=e.r,n=e.s;return fn(Ve(t,{size:32}),Ve(n,{size:32}),typeof e.yParity=="number"?Ve(Gc(e.yParity),{size:1}):"0x")}function Vc(e){if(e===0||e===27)return 0;if(e===1||e===28)return 1;if(e>=35)return e%2===0?1:0;throw new Qc({value:e})}function Gc(e){if(e===0)return 27;if(e===1)return 28;throw new sr({value:e})}class Zc extends Y{constructor({signature:t}){super(`Value \`${t}\` is an invalid signature size.`,{metaMessages:["Expected: 64 bytes or 65 bytes.",`Received ${Ge(Ui(t))} bytes.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidSerializedSizeError"})}}class Sn extends Y{constructor({signature:t}){super(`Signature \`${dn(t)}\` is missing either an \`r\`, \`s\`, or \`yParity\` property.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.MissingPropertiesError"})}}class Yc extends Y{constructor({value:t}){super(`Value \`${t}\` is an invalid r value. r must be a positive integer less than 2^256.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidRError"})}}class Jc extends Y{constructor({value:t}){super(`Value \`${t}\` is an invalid s value. s must be a positive integer less than 2^256.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidSError"})}}class sr extends Y{constructor({value:t}){super(`Value \`${t}\` is an invalid y-parity value. Y-parity must be 0 or 1.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidYParityError"})}}class Qc extends Y{constructor({value:t}){super(`Value \`${t}\` is an invalid v value. v must be 27, 28 or >=35.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidVError"})}}const Xc=new TextDecoder,Wt=Object.fromEntries(Array.from("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/").map((e,t)=>[t,e.charCodeAt(0)]));({...Object.fromEntries(Array.from("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/").map((e,t)=>[e.charCodeAt(0),t]))});function eu(e,t={}){const{pad:n=!0,url:r=!1}=t,i=new Uint8Array(Math.ceil(e.length/3)*4);for(let c=0,u=0;u<e.length;c+=4,u+=3){const h=(e[u]<<16)+(e[u+1]<<8)+(e[u+2]|0);i[c]=Wt[h>>18],i[c+1]=Wt[h>>12&63],i[c+2]=Wt[h>>6&63],i[c+3]=Wt[h&63]}const s=e.length%3,a=Math.floor(e.length/3)*4+(s&&s+1);let o=Xc.decode(new Uint8Array(i.buffer,0,a));return n&&s===1&&(o+="=="),n&&s===2&&(o+="="),r&&(o=o.replaceAll("+","-").replaceAll("/","_")),o}function tu(e,t={}){return eu(Fi(e),t)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const ys={p:BigInt("0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff"),n:BigInt("0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551"),h:BigInt(1),a:BigInt("0xffffffff00000001000000000000000000000000fffffffffffffffffffffffc"),b:BigInt("0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b"),Gx:BigInt("0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296"),Gy:BigInt("0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5")},ws={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffff0000000000000000ffffffff"),n:BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffc7634d81f4372ddf581a0db248b0a77aecec196accc52973"),h:BigInt(1),a:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffff0000000000000000fffffffc"),b:BigInt("0xb3312fa7e23ee7e4988e056be3f82d19181d9c6efe8141120314088f5013875ac656398d8a2ed19d2a85c8edd3ec2aef"),Gx:BigInt("0xaa87ca22be8b05378eb1c71ef320ad746e1d3b628ba79b9859f741e082542a385502f25dbf55296c3a545e3872760ab7"),Gy:BigInt("0x3617de4a96262c6f5d9e98bf9292dc29f8f41dbd289a147ce9da3113b5f0b8c00a60b1ce1d7e819d7a431d7c90ea0e5f")},vs={p:BigInt("0x1ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),n:BigInt("0x01fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa51868783bf2f966b7fcc0148f709a5d03bb5c9b8899c47aebb6fb71e91386409"),h:BigInt(1),a:BigInt("0x1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc"),b:BigInt("0x0051953eb9618e1c9a1f929a21a0b68540eea2da725b99b315f3b8b489918ef109e156193951ec7e937b1652c0bd3bb1bf073573df883d2c34f1ef451fd46b503f00"),Gx:BigInt("0x00c6858e06b70404e9cd9e3ecb662395b4429c648139053fb521f828af606b4d3dbaa14b5e77efe75928fe1dc127a2ffa8de3348b3c1856a429bf97e7e31c2e5bd66"),Gy:BigInt("0x011839296a789a3bc0045c8a5fb42c7d1bd998f54449579b446817afbd17273e662c97ee72995ef42640c550b9013fad0761353c7086a272c24088be94769fd16650")},nu=it(ys.p),ru=it(ws.p),iu=it(vs.p),su=ir({...ys,Fp:nu,lowS:!1},gc);ir({...ws,Fp:ru,lowS:!1},wc);ir({...vs,Fp:iu,lowS:!1,allowedPrivateKeyLengths:[130,131,132]},yc);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Hr=su;Uint8Array.from([105,171,180,181,160,222,75,198,42,42,32,31,141,37,186,233]);function au(e={}){const{flag:t=5,rpId:n=window.location.hostname,signCount:r=0}=e,i=Vi(Hi(n)),s=Ve(t,{size:1}),a=Ve(r,{size:4});return fn(i,s,a)}function ou(e){const{challenge:t,crossOrigin:n=!1,extraClientData:r,origin:i=window.location.origin}=e;return JSON.stringify({type:"webauthn.get",challenge:tu(t,{url:!0,pad:!1}),origin:i,crossOrigin:n,...r})}function cu(e){const{challenge:t,crossOrigin:n,extraClientData:r,flag:i,origin:s,rpId:a,signCount:o,userVerification:c="required"}=e,u=au({flag:i,rpId:a,signCount:o}),h=ou({challenge:t,crossOrigin:n,extraClientData:r,origin:s}),d=Vi(Hi(h)),l=h.indexOf('"challenge"'),f=h.indexOf('"type"'),y={authenticatorData:u,clientDataJSON:h,challengeIndex:l,typeIndex:f,userVerificationRequired:c==="required"},w=fn(u,d);return{metadata:y,payload:w}}async function uu(e={}){const{extractable:t=!1}=e,n=await globalThis.crypto.subtle.generateKey({name:"ECDSA",namedCurve:"P-256"},t,["sign","verify"]),r=await globalThis.crypto.subtle.exportKey("raw",n.publicKey),i=Zo(new Uint8Array(r));return{privateKey:n.privateKey,publicKey:i}}async function lu(e){const{payload:t,privateKey:n}=e,r=await globalThis.crypto.subtle.sign({name:"ECDSA",hash:"SHA-256"},n,zi(t)),i=Wi(new Uint8Array(r)),s=Tr(Ir(i,0,32));let a=Tr(Ir(i,32,64));return a>Hr.CURVE.n/2n&&(a=Hr.CURVE.n-a),{r:s,s:a}}const kt="4.3.6",xs="@coinbase/wallet-sdk",du=()=>({chains:[]}),fu=()=>({keys:{}}),hu=()=>({account:{}}),pu=()=>({subAccount:void 0}),mu=()=>({subAccountConfig:{}}),bu=()=>({spendPermissions:[]}),gu=()=>({config:{version:kt}}),Z=Gn(Ga((...e)=>Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},du(...e)),fu(...e)),hu(...e)),pu(...e)),bu(...e)),gu(...e)),mu(...e)),{name:"cbwsdk.store",storage:Za(()=>localStorage),partialize:e=>({chains:e.chains,keys:e.keys,account:e.account,subAccount:e.subAccount,spendPermissions:e.spendPermissions,config:e.config})})),yu={get:()=>Z.getState().subAccountConfig,set:e=>{Z.setState(t=>({subAccountConfig:Object.assign(Object.assign({},t.subAccountConfig),e)}))},clear:()=>{Z.setState({subAccountConfig:{}})}},wu={get:()=>Z.getState().subAccount,set:e=>{Z.setState(t=>({subAccount:t.subAccount?Object.assign(Object.assign({},t.subAccount),e):Object.assign({address:e.address},e)}))},clear:()=>{Z.setState({subAccount:void 0})}},vu={get:()=>Z.getState().spendPermissions,set:e=>{Z.setState({spendPermissions:e})},clear:()=>{Z.setState({spendPermissions:[]})}},xu={get:()=>Z.getState().account,set:e=>{Z.setState(t=>({account:Object.assign(Object.assign({},t.account),e)}))},clear:()=>{Z.setState({account:{}})}},ku={get:()=>Z.getState().chains,set:e=>{Z.setState({chains:e})},clear:()=>{Z.setState({chains:[]})}},Eu={get:e=>Z.getState().keys[e],set:(e,t)=>{Z.setState(n=>({keys:Object.assign(Object.assign({},n.keys),{[e]:t})}))},clear:()=>{Z.setState({keys:{}})}},ks={get:()=>Z.getState().config,set:e=>{Z.setState(t=>({config:Object.assign(Object.assign({},t.config),e)}))}},Su={subAccounts:wu,subAccountsConfig:yu,spendPermissions:vu,account:xu,chains:ku,keys:Eu,config:ks},E=Object.assign(Object.assign({},Z),Su),_u='!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.ClientAnalytics=t():e.ClientAnalytics=t()}(this,(function(){return(()=>{var e={792:e=>{var t={utf8:{stringToBytes:function(e){return t.bin.stringToBytes(unescape(encodeURIComponent(e)))},bytesToString:function(e){return decodeURIComponent(escape(t.bin.bytesToString(e)))}},bin:{stringToBytes:function(e){for(var t=[],n=0;n<e.length;n++)t.push(255&e.charCodeAt(n));return t},bytesToString:function(e){for(var t=[],n=0;n<e.length;n++)t.push(String.fromCharCode(e[n]));return t.join("")}}};e.exports=t},562:e=>{var t,n;t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n={rotl:function(e,t){return e<<t|e>>>32-t},rotr:function(e,t){return e<<32-t|e>>>t},endian:function(e){if(e.constructor==Number)return 16711935&n.rotl(e,8)|4278255360&n.rotl(e,24);for(var t=0;t<e.length;t++)e[t]=n.endian(e[t]);return e},randomBytes:function(e){for(var t=[];e>0;e--)t.push(Math.floor(256*Math.random()));return t},bytesToWords:function(e){for(var t=[],n=0,r=0;n<e.length;n++,r+=8)t[r>>>5]|=e[n]<<24-r%32;return t},wordsToBytes:function(e){for(var t=[],n=0;n<32*e.length;n+=8)t.push(e[n>>>5]>>>24-n%32&255);return t},bytesToHex:function(e){for(var t=[],n=0;n<e.length;n++)t.push((e[n]>>>4).toString(16)),t.push((15&e[n]).toString(16));return t.join("")},hexToBytes:function(e){for(var t=[],n=0;n<e.length;n+=2)t.push(parseInt(e.substr(n,2),16));return t},bytesToBase64:function(e){for(var n=[],r=0;r<e.length;r+=3)for(var i=e[r]<<16|e[r+1]<<8|e[r+2],a=0;a<4;a++)8*r+6*a<=8*e.length?n.push(t.charAt(i>>>6*(3-a)&63)):n.push("=");return n.join("")},base64ToBytes:function(e){e=e.replace(/[^A-Z0-9+\\/]/gi,"");for(var n=[],r=0,i=0;r<e.length;i=++r%4)0!=i&&n.push((t.indexOf(e.charAt(r-1))&Math.pow(2,-2*i+8)-1)<<2*i|t.indexOf(e.charAt(r))>>>6-2*i);return n}},e.exports=n},335:e=>{function t(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}e.exports=function(e){return null!=e&&(t(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&t(e.slice(0,0))}(e)||!!e._isBuffer)}},762:(e,t,n)=>{var r,i,a,o,s;r=n(562),i=n(792).utf8,a=n(335),o=n(792).bin,(s=function(e,t){e.constructor==String?e=t&&"binary"===t.encoding?o.stringToBytes(e):i.stringToBytes(e):a(e)?e=Array.prototype.slice.call(e,0):Array.isArray(e)||e.constructor===Uint8Array||(e=e.toString());for(var n=r.bytesToWords(e),c=8*e.length,u=1732584193,l=-271733879,d=-1732584194,p=271733878,m=0;m<n.length;m++)n[m]=16711935&(n[m]<<8|n[m]>>>24)|4278255360&(n[m]<<24|n[m]>>>8);n[c>>>5]|=128<<c%32,n[14+(c+64>>>9<<4)]=c;var f=s._ff,v=s._gg,g=s._hh,b=s._ii;for(m=0;m<n.length;m+=16){var h=u,w=l,y=d,T=p;u=f(u,l,d,p,n[m+0],7,-680876936),p=f(p,u,l,d,n[m+1],12,-389564586),d=f(d,p,u,l,n[m+2],17,606105819),l=f(l,d,p,u,n[m+3],22,-1044525330),u=f(u,l,d,p,n[m+4],7,-176418897),p=f(p,u,l,d,n[m+5],12,1200080426),d=f(d,p,u,l,n[m+6],17,-1473231341),l=f(l,d,p,u,n[m+7],22,-45705983),u=f(u,l,d,p,n[m+8],7,1770035416),p=f(p,u,l,d,n[m+9],12,-1958414417),d=f(d,p,u,l,n[m+10],17,-42063),l=f(l,d,p,u,n[m+11],22,-1990404162),u=f(u,l,d,p,n[m+12],7,1804603682),p=f(p,u,l,d,n[m+13],12,-40341101),d=f(d,p,u,l,n[m+14],17,-1502002290),u=v(u,l=f(l,d,p,u,n[m+15],22,1236535329),d,p,n[m+1],5,-165796510),p=v(p,u,l,d,n[m+6],9,-1069501632),d=v(d,p,u,l,n[m+11],14,643717713),l=v(l,d,p,u,n[m+0],20,-373897302),u=v(u,l,d,p,n[m+5],5,-701558691),p=v(p,u,l,d,n[m+10],9,38016083),d=v(d,p,u,l,n[m+15],14,-660478335),l=v(l,d,p,u,n[m+4],20,-405537848),u=v(u,l,d,p,n[m+9],5,568446438),p=v(p,u,l,d,n[m+14],9,-1019803690),d=v(d,p,u,l,n[m+3],14,-187363961),l=v(l,d,p,u,n[m+8],20,1163531501),u=v(u,l,d,p,n[m+13],5,-1444681467),p=v(p,u,l,d,n[m+2],9,-51403784),d=v(d,p,u,l,n[m+7],14,1735328473),u=g(u,l=v(l,d,p,u,n[m+12],20,-1926607734),d,p,n[m+5],4,-378558),p=g(p,u,l,d,n[m+8],11,-2022574463),d=g(d,p,u,l,n[m+11],16,1839030562),l=g(l,d,p,u,n[m+14],23,-35309556),u=g(u,l,d,p,n[m+1],4,-1530992060),p=g(p,u,l,d,n[m+4],11,1272893353),d=g(d,p,u,l,n[m+7],16,-155497632),l=g(l,d,p,u,n[m+10],23,-1094730640),u=g(u,l,d,p,n[m+13],4,681279174),p=g(p,u,l,d,n[m+0],11,-358537222),d=g(d,p,u,l,n[m+3],16,-722521979),l=g(l,d,p,u,n[m+6],23,76029189),u=g(u,l,d,p,n[m+9],4,-640364487),p=g(p,u,l,d,n[m+12],11,-421815835),d=g(d,p,u,l,n[m+15],16,530742520),u=b(u,l=g(l,d,p,u,n[m+2],23,-995338651),d,p,n[m+0],6,-198630844),p=b(p,u,l,d,n[m+7],10,1126891415),d=b(d,p,u,l,n[m+14],15,-1416354905),l=b(l,d,p,u,n[m+5],21,-57434055),u=b(u,l,d,p,n[m+12],6,1700485571),p=b(p,u,l,d,n[m+3],10,-1894986606),d=b(d,p,u,l,n[m+10],15,-1051523),l=b(l,d,p,u,n[m+1],21,-2054922799),u=b(u,l,d,p,n[m+8],6,1873313359),p=b(p,u,l,d,n[m+15],10,-30611744),d=b(d,p,u,l,n[m+6],15,-1560198380),l=b(l,d,p,u,n[m+13],21,1309151649),u=b(u,l,d,p,n[m+4],6,-145523070),p=b(p,u,l,d,n[m+11],10,-1120210379),d=b(d,p,u,l,n[m+2],15,718787259),l=b(l,d,p,u,n[m+9],21,-343485551),u=u+h>>>0,l=l+w>>>0,d=d+y>>>0,p=p+T>>>0}return r.endian([u,l,d,p])})._ff=function(e,t,n,r,i,a,o){var s=e+(t&n|~t&r)+(i>>>0)+o;return(s<<a|s>>>32-a)+t},s._gg=function(e,t,n,r,i,a,o){var s=e+(t&r|n&~r)+(i>>>0)+o;return(s<<a|s>>>32-a)+t},s._hh=function(e,t,n,r,i,a,o){var s=e+(t^n^r)+(i>>>0)+o;return(s<<a|s>>>32-a)+t},s._ii=function(e,t,n,r,i,a,o){var s=e+(n^(t|~r))+(i>>>0)+o;return(s<<a|s>>>32-a)+t},s._blocksize=16,s._digestsize=16,e.exports=function(e,t){if(null==e)throw new Error("Illegal argument "+e);var n=r.wordsToBytes(s(e,t));return t&&t.asBytes?n:t&&t.asString?o.bytesToString(n):r.bytesToHex(n)}},2:(e,t,n)=>{"use strict";n.r(t),n.d(t,{Perfume:()=>ze,incrementUjNavigation:()=>Le,markStep:()=>Re,markStepOnce:()=>qe});var r,i,a={isResourceTiming:!1,isElementTiming:!1,maxTime:3e4,reportOptions:{},enableNavigationTracking:!0},o=window,s=o.console,c=o.navigator,u=o.performance,l=function(){return c.deviceMemory},d=function(){return c.hardwareConcurrency},p="mark.",m=function(){return u&&!!u.getEntriesByType&&!!u.now&&!!u.mark},f="4g",v=!1,g={},b={value:0},h={value:{beacon:0,css:0,fetch:0,img:0,other:0,script:0,total:0,xmlhttprequest:0}},w={value:0},y={value:0},T={},k={isHidden:!1,didChange:!1},_=function(){k.isHidden=!1,document.hidden&&(k.isHidden=document.hidden,k.didChange=!0)},S=function(e,t){try{var n=new PerformanceObserver((function(e){t(e.getEntries())}));return n.observe({type:e,buffered:!0}),n}catch(e){s.warn("Perfume.js:",e)}return null},E=function(){return!!(d()&&d()<=4)||!!(l()&&l()<=4)},x=function(e,t){switch(e){case"slow-2g":case"2g":case"3g":return!0;default:return E()||t}},O=function(e){return parseFloat(e.toFixed(4))},j=function(e){return"number"!=typeof e?null:O(e/Math.pow(1024,2))},N=function(e,t,n,r,i){var s,u=function(){a.analyticsTracker&&(k.isHidden&&!["CLS","INP"].includes(e)||a.analyticsTracker({attribution:r,metricName:e,data:t,navigatorInformation:c?{deviceMemory:l()||0,hardwareConcurrency:d()||0,serviceWorkerStatus:"serviceWorker"in c?c.serviceWorker.controller?"controlled":"supported":"unsupported",isLowEndDevice:E(),isLowEndExperience:x(f,v)}:{},rating:n,navigationType:i}))};["CLS","INP"].includes(e)?u():(s=u,"requestIdleCallback"in o?o.requestIdleCallback(s,{timeout:3e3}):s())},I=function(e){e.forEach((function(e){if(!("self"!==e.name||e.startTime<b.value)){var t=e.duration-50;t>0&&(w.value+=t,y.value+=t)}}))};!function(e){e.instant="instant",e.quick="quick",e.moderate="moderate",e.slow="slow",e.unavoidable="unavoidable"}(r||(r={}));var P,M,B,C,D,A=((i={})[r.instant]={vitalsThresholds:[100,200],maxOutlierThreshold:1e4},i[r.quick]={vitalsThresholds:[200,500],maxOutlierThreshold:1e4},i[r.moderate]={vitalsThresholds:[500,1e3],maxOutlierThreshold:1e4},i[r.slow]={vitalsThresholds:[1e3,2e3],maxOutlierThreshold:1e4},i[r.unavoidable]={vitalsThresholds:[2e3,5e3],maxOutlierThreshold:2e4},i),L={RT:[100,200],TBT:[200,600],NTBT:[200,600]},U=function(e,t){return L[e]?t<=L[e][0]?"good":t<=L[e][1]?"needsImprovement":"poor":null},R=function(e,t,n){Object.keys(t).forEach((function(e){"number"==typeof t[e]&&(t[e]=O(t[e]))})),N(e,t,null,n||{})},q=function(e){var t=e.attribution,n=e.name,r=e.rating,i=e.value,o=e.navigationType;"FCP"===n&&(b.value=i),["FCP","LCP"].includes(n)&&!T[0]&&(T[0]=S("longtask",I)),"FID"===n&&setTimeout((function(){k.didChange||(q({attribution:t,name:"TBT",rating:U("TBT",w.value),value:w.value,navigationType:o}),R("dataConsumption",h.value))}),1e4);var s=O(i);s<=a.maxTime&&s>=0&&N(n,s,r,t,o)},F=function(){return window.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0]},z=function(e){if("loading"===document.readyState)return"loading";var t=F();if(t){if(e<t.domInteractive)return"loading";if(0===t.domContentLoadedEventStart||e<t.domContentLoadedEventStart)return"dom-interactive";if(0===t.domComplete||e<t.domComplete)return"dom-content-loaded"}return"complete"},K=function(e){var t=e.nodeName;return 1===e.nodeType?t.toLowerCase():t.toUpperCase().replace(/^#/,"")},$=function(e,t){var n="";try{for(;e&&9!==e.nodeType;){var r=e,i=r.id?"#"+r.id:K(r)+(r.className&&r.className.length?"."+r.className.replace(/\\s+/g,"."):"");if(n.length+i.length>(t||100)-1)return n||i;if(n=n?i+">"+n:i,r.id)break;e=r.parentNode}}catch(e){}return n},Q=-1,W=function(){return Q},H=function(e){addEventListener("pageshow",(function(t){t.persisted&&(Q=t.timeStamp,e(t))}),!0)},V=function(){var e=F();return e&&e.activationStart||0},J=function(e,t){var n=F(),r="navigate";return W()>=0?r="back-forward-cache":n&&(r=document.prerendering||V()>0?"prerender":document.wasDiscarded?"restore":n.type.replace(/_/g,"-")),{name:e,value:void 0===t?-1:t,rating:"good",delta:0,entries:[],id:"v3-".concat(Date.now(),"-").concat(Math.floor(8999999999999*Math.random())+1e12),navigationType:r}},X=function(e,t,n){try{if(PerformanceObserver.supportedEntryTypes.includes(e)){var r=new PerformanceObserver((function(e){Promise.resolve().then((function(){t(e.getEntries())}))}));return r.observe(Object.assign({type:e,buffered:!0},n||{})),r}}catch(e){}},G=function(e,t){var n=function n(r){"pagehide"!==r.type&&"hidden"!==document.visibilityState||(e(r),t&&(removeEventListener("visibilitychange",n,!0),removeEventListener("pagehide",n,!0)))};addEventListener("visibilitychange",n,!0),addEventListener("pagehide",n,!0)},Z=function(e,t,n,r){var i,a;return function(o){t.value>=0&&(o||r)&&((a=t.value-(i||0))||void 0===i)&&(i=t.value,t.delta=a,t.rating=function(e,t){return e>t[1]?"poor":e>t[0]?"needs-improvement":"good"}(t.value,n),e(t))}},Y=function(e){requestAnimationFrame((function(){return requestAnimationFrame((function(){return e()}))}))},ee=function(e){document.prerendering?addEventListener("prerenderingchange",(function(){return e()}),!0):e()},te=-1,ne=function(){return"hidden"!==document.visibilityState||document.prerendering?1/0:0},re=function(e){"hidden"===document.visibilityState&&te>-1&&(te="visibilitychange"===e.type?e.timeStamp:0,ae())},ie=function(){addEventListener("visibilitychange",re,!0),addEventListener("prerenderingchange",re,!0)},ae=function(){removeEventListener("visibilitychange",re,!0),removeEventListener("prerenderingchange",re,!0)},oe=function(){return te<0&&(te=ne(),ie(),H((function(){setTimeout((function(){te=ne(),ie()}),0)}))),{get firstHiddenTime(){return te}}},se=function(e,t){t=t||{},ee((function(){var n,r=[1800,3e3],i=oe(),a=J("FCP"),o=X("paint",(function(e){e.forEach((function(e){"first-contentful-paint"===e.name&&(o.disconnect(),e.startTime<i.firstHiddenTime&&(a.value=Math.max(e.startTime-V(),0),a.entries.push(e),n(!0)))}))}));o&&(n=Z(e,a,r,t.reportAllChanges),H((function(i){a=J("FCP"),n=Z(e,a,r,t.reportAllChanges),Y((function(){a.value=performance.now()-i.timeStamp,n(!0)}))})))}))},ce={passive:!0,capture:!0},ue=new Date,le=function(e,t){P||(P=t,M=e,B=new Date,me(removeEventListener),de())},de=function(){if(M>=0&&M<B-ue){var e={entryType:"first-input",name:P.type,target:P.target,cancelable:P.cancelable,startTime:P.timeStamp,processingStart:P.timeStamp+M};C.forEach((function(t){t(e)})),C=[]}},pe=function(e){if(e.cancelable){var t=(e.timeStamp>1e12?new Date:performance.now())-e.timeStamp;"pointerdown"==e.type?function(e,t){var n=function(){le(e,t),i()},r=function(){i()},i=function(){removeEventListener("pointerup",n,ce),removeEventListener("pointercancel",r,ce)};addEventListener("pointerup",n,ce),addEventListener("pointercancel",r,ce)}(t,e):le(t,e)}},me=function(e){["mousedown","keydown","touchstart","pointerdown"].forEach((function(t){return e(t,pe,ce)}))},fe=0,ve=1/0,ge=0,be=function(e){e.forEach((function(e){e.interactionId&&(ve=Math.min(ve,e.interactionId),ge=Math.max(ge,e.interactionId),fe=ge?(ge-ve)/7+1:0)}))},he=function(){return D?fe:performance.interactionCount||0},we=0,ye=function(){return he()-we},Te=[],ke={},_e=function(e){var t=Te[Te.length-1],n=ke[e.interactionId];if(n||Te.length<10||e.duration>t.latency){if(n)n.entries.push(e),n.latency=Math.max(n.latency,e.duration);else{var r={id:e.interactionId,latency:e.duration,entries:[e]};ke[r.id]=r,Te.push(r)}Te.sort((function(e,t){return t.latency-e.latency})),Te.splice(10).forEach((function(e){delete ke[e.id]}))}},Se={},Ee=function e(t){document.prerendering?ee((function(){return e(t)})):"complete"!==document.readyState?addEventListener("load",(function(){return e(t)}),!0):setTimeout(t,0)},xe=function(e,t){t=t||{};var n=[800,1800],r=J("TTFB"),i=Z(e,r,n,t.reportAllChanges);Ee((function(){var a=F();if(a){var o=a.responseStart;if(o<=0||o>performance.now())return;r.value=Math.max(o-V(),0),r.entries=[a],i(!0),H((function(){r=J("TTFB",0),(i=Z(e,r,n,t.reportAllChanges))(!0)}))}}))},Oe=function(e){e.forEach((function(e){e.identifier&&q({attribution:{identifier:e.identifier},name:"ET",rating:null,value:e.startTime})}))},je=function(e){e.forEach((function(e){if(a.isResourceTiming&&R("resourceTiming",e),e.decodedBodySize&&e.initiatorType){var t=e.decodedBodySize/1e3;h.value[e.initiatorType]+=t,h.value.total+=t}}))},Ne=function(){!function(e,t){xe((function(e){!function(e){if(e.entries.length){var t=e.entries[0],n=t.activationStart||0,r=Math.max(t.domainLookupStart-n,0),i=Math.max(t.connectStart-n,0),a=Math.max(t.requestStart-n,0);e.attribution={waitingTime:r,dnsTime:i-r,connectionTime:a-i,requestTime:e.value-a,navigationEntry:t}}else e.attribution={waitingTime:0,dnsTime:0,connectionTime:0,requestTime:0}}(e),function(e){e.value>0&&q(e)}(e)}),t)}(0,a.reportOptions.ttfb),function(e,t){!function(e,t){t=t||{},ee((function(){var e,n=[.1,.25],r=J("CLS"),i=-1,a=0,o=[],s=function(e){i>-1&&function(e){!function(e){if(e.entries.length){var t=e.entries.reduce((function(e,t){return e&&e.value>t.value?e:t}));if(t&&t.sources&&t.sources.length){var n=(r=t.sources).find((function(e){return e.node&&1===e.node.nodeType}))||r[0];if(n)return void(e.attribution={largestShiftTarget:$(n.node),largestShiftTime:t.startTime,largestShiftValue:t.value,largestShiftSource:n,largestShiftEntry:t,loadState:z(t.startTime)})}}var r;e.attribution={}}(e),function(e){q(e)}(e)}(e)},c=function(t){t.forEach((function(t){if(!t.hadRecentInput){var n=o[0],i=o[o.length-1];a&&t.startTime-i.startTime<1e3&&t.startTime-n.startTime<5e3?(a+=t.value,o.push(t)):(a=t.value,o=[t]),a>r.value&&(r.value=a,r.entries=o,e())}}))},u=X("layout-shift",c);u&&(e=Z(s,r,n,t.reportAllChanges),se((function(t){i=t.value,r.value<0&&(r.value=0,e())})),G((function(){c(u.takeRecords()),e(!0)})),H((function(){a=0,i=-1,r=J("CLS",0),e=Z(s,r,n,t.reportAllChanges),Y((function(){return e()}))})))}))}(0,t)}(0,a.reportOptions.cls),function(e,t){se((function(e){!function(e){if(e.entries.length){var t=F(),n=e.entries[e.entries.length-1];if(t){var r=t.activationStart||0,i=Math.max(0,t.responseStart-r);return void(e.attribution={timeToFirstByte:i,firstByteToFCP:e.value-i,loadState:z(e.entries[0].startTime),navigationEntry:t,fcpEntry:n})}}e.attribution={timeToFirstByte:0,firstByteToFCP:e.value,loadState:z(W())}}(e),function(e){q(e)}(e)}),t)}(0,a.reportOptions.fcp),function(e,t){!function(e,t){t=t||{},ee((function(){var n,r=[100,300],i=oe(),a=J("FID"),o=function(e){e.startTime<i.firstHiddenTime&&(a.value=e.processingStart-e.startTime,a.entries.push(e),n(!0))},s=function(e){e.forEach(o)},c=X("first-input",s);n=Z(e,a,r,t.reportAllChanges),c&&G((function(){s(c.takeRecords()),c.disconnect()}),!0),c&&H((function(){var i;a=J("FID"),n=Z(e,a,r,t.reportAllChanges),C=[],M=-1,P=null,me(addEventListener),i=o,C.push(i),de()}))}))}((function(e){!function(e){var t=e.entries[0];e.attribution={eventTarget:$(t.target),eventType:t.name,eventTime:t.startTime,eventEntry:t,loadState:z(t.startTime)}}(e),function(e){q(e)}(e)}),t)}(0,a.reportOptions.fid),function(e,t){!function(e,t){t=t||{},ee((function(){var n,r=[2500,4e3],i=oe(),a=J("LCP"),o=function(e){var t=e[e.length-1];if(t){var r=Math.max(t.startTime-V(),0);r<i.firstHiddenTime&&(a.value=r,a.entries=[t],n())}},s=X("largest-contentful-paint",o);if(s){n=Z(e,a,r,t.reportAllChanges);var c=function(){Se[a.id]||(o(s.takeRecords()),s.disconnect(),Se[a.id]=!0,n(!0))};["keydown","click"].forEach((function(e){addEventListener(e,c,{once:!0,capture:!0})})),G(c,!0),H((function(i){a=J("LCP"),n=Z(e,a,r,t.reportAllChanges),Y((function(){a.value=performance.now()-i.timeStamp,Se[a.id]=!0,n(!0)}))}))}}))}((function(e){!function(e){if(e.entries.length){var t=F();if(t){var n=t.activationStart||0,r=e.entries[e.entries.length-1],i=r.url&&performance.getEntriesByType("resource").filter((function(e){return e.name===r.url}))[0],a=Math.max(0,t.responseStart-n),o=Math.max(a,i?(i.requestStart||i.startTime)-n:0),s=Math.max(o,i?i.responseEnd-n:0),c=Math.max(s,r?r.startTime-n:0),u={element:$(r.element),timeToFirstByte:a,resourceLoadDelay:o-a,resourceLoadTime:s-o,elementRenderDelay:c-s,navigationEntry:t,lcpEntry:r};return r.url&&(u.url=r.url),i&&(u.lcpResourceEntry=i),void(e.attribution=u)}}e.attribution={timeToFirstByte:0,resourceLoadDelay:0,resourceLoadTime:0,elementRenderDelay:e.value}}(e),function(e){q(e)}(e)}),t)}(0,a.reportOptions.lcp),function(e,t){!function(e,t){t=t||{},ee((function(){var n=[200,500];"interactionCount"in performance||D||(D=X("event",be,{type:"event",buffered:!0,durationThreshold:0}));var r,i=J("INP"),a=function(e){e.forEach((function(e){e.interactionId&&_e(e),"first-input"===e.entryType&&!Te.some((function(t){return t.entries.some((function(t){return e.duration===t.duration&&e.startTime===t.startTime}))}))&&_e(e)}));var t,n=(t=Math.min(Te.length-1,Math.floor(ye()/50)),Te[t]);n&&n.latency!==i.value&&(i.value=n.latency,i.entries=n.entries,r())},o=X("event",a,{durationThreshold:t.durationThreshold||40});r=Z(e,i,n,t.reportAllChanges),o&&(o.observe({type:"first-input",buffered:!0}),G((function(){a(o.takeRecords()),i.value<0&&ye()>0&&(i.value=0,i.entries=[]),r(!0)})),H((function(){Te=[],we=he(),i=J("INP"),r=Z(e,i,n,t.reportAllChanges)})))}))}((function(t){!function(e){if(e.entries.length){var t=e.entries.sort((function(e,t){return t.duration-e.duration||t.processingEnd-t.processingStart-(e.processingEnd-e.processingStart)}))[0];e.attribution={eventTarget:$(t.target),eventType:t.name,eventTime:t.startTime,eventEntry:t,loadState:z(t.startTime)}}else e.attribution={}}(t),e(t)}),t)}((function(e){return q(e)}),a.reportOptions.inp),a.isResourceTiming&&S("resource",je),a.isElementTiming&&S("element",Oe)},Ie=function(e){var t="usageDetails"in e?e.usageDetails:{};R("storageEstimate",{quota:j(e.quota),usage:j(e.usage),caches:j(t.caches),indexedDB:j(t.indexedDB),serviceWorker:j(t.serviceWorkerRegistrations)})},Pe={finalMarkToStepsMap:{},startMarkToStepsMap:{},active:{},navigationSteps:{}},Me=function(e){delete Pe.active[e]},Be=function(){return Pe.navigationSteps},Ce=function(e){var t;return null!==(t=Be()[e])&&void 0!==t?t:{}},De=function(e,t,n){var r="step."+e,i=u.getEntriesByName(p+t).length>0;if(u.getEntriesByName(p+n).length>0&&a.steps){var o=A[a.steps[e].threshold],s=o.maxOutlierThreshold,c=o.vitalsThresholds;if(i){var l=u.measure(r,p+t,p+n),d=l.duration;if(d<=s){var m=function(e,t){return e<=t[0]?"good":e<=t[1]?"needsImprovement":"poor"}(d,c);d>=0&&(N("userJourneyStep",d,m,{stepName:e},void 0),u.measure("step.".concat(e,"_vitals_").concat(m),{start:l.startTime+l.duration,end:l.startTime+l.duration,detail:{type:"stepVital",duration:d}}))}}}},Ae=function(){var e=Be(),t=Pe.startMarkToStepsMap,n=Object.keys(e).length;if(0===n)return{};var r={},i=n-1,a=Ce(i);if(Object.keys(a).forEach((function(e){var n,i=null!==(n=t[e])&&void 0!==n?n:[];Object.keys(i).forEach((function(e){r[e]=!0}))})),n>1){var o=Ce(i-1);Object.keys(o).forEach((function(e){var n,i=null!==(n=t[e])&&void 0!==n?n:[];Object.keys(i).forEach((function(e){r[e]=!0}))}))}return r},Le=function(){var e,t=Object.keys(Pe.navigationSteps).length;Pe.navigationSteps[t]={};var n=Ae();null===(e=a.onMarkStep)||void 0===e||e.call(a,"",Object.keys(n))},Ue=function(e){var t,n,r,i,o,s,c;if(Pe.finalMarkToStepsMap[e]){!function(e){var t=Pe.navigationSteps,n=Pe.finalMarkToStepsMap,r=Object.keys(t).length;if(0!==r){var i=r-1,a=Ce(i);if(a&&n[e]){var o=n[e];o&&Object.keys(o).forEach((function(e){if(a[e]){var n=Ce(i)||{};n[e]=!1,t[i]=n}if(r>1){var o=i-1,s=Ce(o);s[e]&&(s[e]=!1,t[o]=s)}}))}}}(e);var u=Pe.finalMarkToStepsMap[e];Object.keys(u).forEach((function(t){var n=u[t];n.forEach(Me),Promise.all(n.map((function(n){return function(e,t,n,r){return new(n||(n=Promise))((function(e,t){function i(e){try{o(r.next(e))}catch(e){t(e)}}function a(e){try{o(r.throw(e))}catch(e){t(e)}}function o(t){var r;t.done?e(t.value):(r=t.value,r instanceof n?r:new n((function(e){e(r)}))).then(i,a)}o((r=r.apply(undefined,[])).next())}))}(0,0,void 0,(function(){return function(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(a){return function(s){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,r=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){o.label=a[1];break}if(6===a[0]&&o.label<i[1]){o.label=i[1],i=a;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(a);break}i[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}}(this,(function(r){switch(r.label){case 0:return[4,De(n,t,e)];case 1:return r.sent(),[2]}}))}))}))).catch((function(){}))}))}else r=e,i=Pe.navigationSteps,o=Object.keys(i).length,(c=Ce(s=(o>0?o:1)-1)||[])[r]=!0,i[s]=c,function(e){var t,n=null!==(t=Pe.startMarkToStepsMap[e])&&void 0!==t?t:[];Object.keys(n).forEach((function(e){Pe.active[e]||(Pe.active[e]=!0)}))}(e);if(a.enableNavigationTracking){var l=Ae();null===(t=a.onMarkStep)||void 0===t||t.call(a,e,Object.keys(l))}else null===(n=a.onMarkStep)||void 0===n||n.call(a,e,Object.keys(Pe.active))},Re=function(e){u.mark(p+e),Ue(e)},qe=function(e){0===u.getEntriesByName(p+e).length&&(u.mark(p+e),Ue(e))},Fe=0,ze=function(){function e(e){if(void 0===e&&(e={}),this.v="9.0.0-rc.3",a.analyticsTracker=e.analyticsTracker,a.isResourceTiming=!!e.resourceTiming,a.isElementTiming=!!e.elementTiming,a.maxTime=e.maxMeasureTime||a.maxTime,a.reportOptions=e.reportOptions||a.reportOptions,a.steps=e.steps,a.onMarkStep=e.onMarkStep,a.enableNavigationTracking=e.enableNavigationTracking,m()){"PerformanceObserver"in o&&Ne(),void 0!==document.hidden&&document.addEventListener("visibilitychange",_);var t=function(){if(!m())return{};var e=u.getEntriesByType("navigation")[0];if(!e)return{};var t=e.responseStart,n=e.responseEnd;return{fetchTime:n-e.fetchStart,workerTime:e.workerStart>0?n-e.workerStart:0,totalTime:n-e.requestStart,downloadTime:n-t,timeToFirstByte:t-e.requestStart,headerSize:e.transferSize-e.encodedBodySize||0,dnsLookupTime:e.domainLookupEnd-e.domainLookupStart,redirectTime:e.redirectEnd-e.redirectStart}}();R("navigationTiming",t),t.redirectTime&&q({attribution:{},name:"RT",rating:U("RT",t.redirectTime),value:t.redirectTime}),R("networkInformation",function(){if("connection"in c){var e=c.connection;return"object"!=typeof e?{}:(f=e.effectiveType,v=!!e.saveData,{downlink:e.downlink,effectiveType:e.effectiveType,rtt:e.rtt,saveData:!!e.saveData})}return{}}()),c&&c.storage&&"function"==typeof c.storage.estimate&&c.storage.estimate().then(Ie),a.steps&&a.steps&&(Pe.startMarkToStepsMap={},Pe.finalMarkToStepsMap={},Pe.active={},Pe.navigationSteps={},Object.entries(a.steps).forEach((function(e){var t,n,r=e[0],i=e[1].marks,a=i[0],o=i[1],s=null!==(n=Pe.startMarkToStepsMap[a])&&void 0!==n?n:{};if(s[r]=!0,Pe.startMarkToStepsMap[a]=s,Pe.finalMarkToStepsMap[o]){var c=Pe.finalMarkToStepsMap[o][a]||[];c.push(r),Pe.finalMarkToStepsMap[o][a]=c}else Pe.finalMarkToStepsMap[o]=((t={})[a]=[r],t)})))}}return e.prototype.start=function(e){m()&&!g[e]&&(g[e]=!0,u.mark("mark_".concat(e,"_start")))},e.prototype.end=function(e,t,n){if(void 0===t&&(t={}),void 0===n&&(n=!0),m()&&g[e]){u.mark("mark_".concat(e,"_end")),delete g[e];var r=function(e){u.measure(e,"mark_".concat(e,"_start"),"mark_".concat(e,"_end"));var t=u.getEntriesByName(e).pop();return t&&"measure"===t.entryType?t.duration:-1}(e);n&&R(e,O(r),t)}},e.prototype.endPaint=function(e,t){var n=this;setTimeout((function(){n.end(e,t)}))},e.prototype.clear=function(e){delete g[e],u.clearMarks&&(u.clearMarks("mark_".concat(e,"_start")),u.clearMarks("mark_".concat(e,"_end")))},e.prototype.markNTBT=function(){var e=this;this.start("ntbt"),y.value=0,clearTimeout(Fe),Fe=setTimeout((function(){e.end("ntbt",{},!1),q({attribution:{},name:"NTBT",rating:U("NTBT",y.value),value:y.value}),y.value=0}),2e3)},e}()},426:(e,t)=>{"use strict";Symbol.for("react.element"),Symbol.for("react.portal"),Symbol.for("react.fragment"),Symbol.for("react.strict_mode"),Symbol.for("react.profiler"),Symbol.for("react.provider"),Symbol.for("react.context"),Symbol.for("react.forward_ref"),Symbol.for("react.suspense"),Symbol.for("react.memo"),Symbol.for("react.lazy"),Symbol.iterator;var n={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},r=Object.assign,i={};function a(e,t,r){this.props=e,this.context=t,this.refs=i,this.updater=r||n}function o(){}function s(e,t,r){this.props=e,this.context=t,this.refs=i,this.updater=r||n}a.prototype.isReactComponent={},a.prototype.setState=function(e,t){if("object"!=typeof e&&"function"!=typeof e&&null!=e)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")},a.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},o.prototype=a.prototype;var c=s.prototype=new o;c.constructor=s,r(c,a.prototype),c.isPureReactComponent=!0;Array.isArray,Object.prototype.hasOwnProperty;var u={current:null};t.useCallback=function(e,t){return u.current.useCallback(e,t)},t.useEffect=function(e,t){return u.current.useEffect(e,t)},t.useRef=function(e){return u.current.useRef(e)}},784:(e,t,n)=>{"use strict";e.exports=n(426)},353:function(e,t,n){var r;!function(i,a){"use strict";var o="function",s="undefined",c="object",u="string",l="major",d="model",p="name",m="type",f="vendor",v="version",g="architecture",b="console",h="mobile",w="tablet",y="smarttv",T="wearable",k="embedded",_="Amazon",S="Apple",E="ASUS",x="BlackBerry",O="Browser",j="Chrome",N="Firefox",I="Google",P="Huawei",M="LG",B="Microsoft",C="Motorola",D="Opera",A="Samsung",L="Sharp",U="Sony",R="Xiaomi",q="Zebra",F="Facebook",z="Chromium OS",K="Mac OS",$=function(e){for(var t={},n=0;n<e.length;n++)t[e[n].toUpperCase()]=e[n];return t},Q=function(e,t){return typeof e===u&&-1!==W(t).indexOf(W(e))},W=function(e){return e.toLowerCase()},H=function(e,t){if(typeof e===u)return e=e.replace(/^\\s\\s*/,""),typeof t===s?e:e.substring(0,350)},V=function(e,t){for(var n,r,i,s,u,l,d=0;d<t.length&&!u;){var p=t[d],m=t[d+1];for(n=r=0;n<p.length&&!u&&p[n];)if(u=p[n++].exec(e))for(i=0;i<m.length;i++)l=u[++r],typeof(s=m[i])===c&&s.length>0?2===s.length?typeof s[1]==o?this[s[0]]=s[1].call(this,l):this[s[0]]=s[1]:3===s.length?typeof s[1]!==o||s[1].exec&&s[1].test?this[s[0]]=l?l.replace(s[1],s[2]):a:this[s[0]]=l?s[1].call(this,l,s[2]):a:4===s.length&&(this[s[0]]=l?s[3].call(this,l.replace(s[1],s[2])):a):this[s]=l||a;d+=2}},J=function(e,t){for(var n in t)if(typeof t[n]===c&&t[n].length>0){for(var r=0;r<t[n].length;r++)if(Q(t[n][r],e))return"?"===n?a:n}else if(Q(t[n],e))return"?"===n?a:n;return e},X={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},G={browser:[[/\\b(?:crmo|crios)\\/([\\w\\.]+)/i],[v,[p,"Chrome"]],[/edg(?:e|ios|a)?\\/([\\w\\.]+)/i],[v,[p,"Edge"]],[/(opera mini)\\/([-\\w\\.]+)/i,/(opera [mobiletab]{3,6})\\b.+version\\/([-\\w\\.]+)/i,/(opera)(?:.+version\\/|[\\/ ]+)([\\w\\.]+)/i],[p,v],[/opios[\\/ ]+([\\w\\.]+)/i],[v,[p,D+" Mini"]],[/\\bopr\\/([\\w\\.]+)/i],[v,[p,D]],[/(kindle)\\/([\\w\\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\\/ ]?([\\w\\.]*)/i,/(avant |iemobile|slim)(?:browser)?[\\/ ]?([\\w\\.]*)/i,/(ba?idubrowser)[\\/ ]?([\\w\\.]+)/i,/(?:ms|\\()(ie) ([\\w\\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|qq|duckduckgo)\\/([-\\w\\.]+)/i,/(heytap|ovi)browser\\/([\\d\\.]+)/i,/(weibo)__([\\d\\.]+)/i],[p,v],[/(?:\\buc? ?browser|(?:juc.+)ucweb)[\\/ ]?([\\w\\.]+)/i],[v,[p,"UC"+O]],[/microm.+\\bqbcore\\/([\\w\\.]+)/i,/\\bqbcore\\/([\\w\\.]+).+microm/i],[v,[p,"WeChat(Win) Desktop"]],[/micromessenger\\/([\\w\\.]+)/i],[v,[p,"WeChat"]],[/konqueror\\/([\\w\\.]+)/i],[v,[p,"Konqueror"]],[/trident.+rv[: ]([\\w\\.]{1,9})\\b.+like gecko/i],[v,[p,"IE"]],[/ya(?:search)?browser\\/([\\w\\.]+)/i],[v,[p,"Yandex"]],[/(avast|avg)\\/([\\w\\.]+)/i],[[p,/(.+)/,"$1 Secure "+O],v],[/\\bfocus\\/([\\w\\.]+)/i],[v,[p,N+" Focus"]],[/\\bopt\\/([\\w\\.]+)/i],[v,[p,D+" Touch"]],[/coc_coc\\w+\\/([\\w\\.]+)/i],[v,[p,"Coc Coc"]],[/dolfin\\/([\\w\\.]+)/i],[v,[p,"Dolphin"]],[/coast\\/([\\w\\.]+)/i],[v,[p,D+" Coast"]],[/miuibrowser\\/([\\w\\.]+)/i],[v,[p,"MIUI "+O]],[/fxios\\/([-\\w\\.]+)/i],[v,[p,N]],[/\\bqihu|(qi?ho?o?|360)browser/i],[[p,"360 "+O]],[/(oculus|samsung|sailfish|huawei)browser\\/([\\w\\.]+)/i],[[p,/(.+)/,"$1 "+O],v],[/(comodo_dragon)\\/([\\w\\.]+)/i],[[p,/_/g," "],v],[/(electron)\\/([\\w\\.]+) safari/i,/(tesla)(?: qtcarbrowser|\\/(20\\d\\d\\.[-\\w\\.]+))/i,/m?(qqbrowser|baiduboxapp|2345Explorer)[\\/ ]?([\\w\\.]+)/i],[p,v],[/(metasr)[\\/ ]?([\\w\\.]+)/i,/(lbbrowser)/i,/\\[(linkedin)app\\]/i],[p],[/((?:fban\\/fbios|fb_iab\\/fb4a)(?!.+fbav)|;fbav\\/([\\w\\.]+);)/i],[[p,F],v],[/(kakao(?:talk|story))[\\/ ]([\\w\\.]+)/i,/(naver)\\(.*?(\\d+\\.[\\w\\.]+).*\\)/i,/safari (line)\\/([\\w\\.]+)/i,/\\b(line)\\/([\\w\\.]+)\\/iab/i,/(chromium|instagram)[\\/ ]([-\\w\\.]+)/i],[p,v],[/\\bgsa\\/([\\w\\.]+) .*safari\\//i],[v,[p,"GSA"]],[/musical_ly(?:.+app_?version\\/|_)([\\w\\.]+)/i],[v,[p,"TikTok"]],[/headlesschrome(?:\\/([\\w\\.]+)| )/i],[v,[p,j+" Headless"]],[/ wv\\).+(chrome)\\/([\\w\\.]+)/i],[[p,j+" WebView"],v],[/droid.+ version\\/([\\w\\.]+)\\b.+(?:mobile safari|safari)/i],[v,[p,"Android "+O]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\\/v?([\\w\\.]+)/i],[p,v],[/version\\/([\\w\\.\\,]+) .*mobile\\/\\w+ (safari)/i],[v,[p,"Mobile Safari"]],[/version\\/([\\w(\\.|\\,)]+) .*(mobile ?safari|safari)/i],[v,p],[/webkit.+?(mobile ?safari|safari)(\\/[\\w\\.]+)/i],[p,[v,J,{"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"}]],[/(webkit|khtml)\\/([\\w\\.]+)/i],[p,v],[/(navigator|netscape\\d?)\\/([-\\w\\.]+)/i],[[p,"Netscape"],v],[/mobile vr; rv:([\\w\\.]+)\\).+firefox/i],[v,[p,N+" Reality"]],[/ekiohf.+(flow)\\/([\\w\\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror|klar)[\\/ ]?([\\w\\.\\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\\/([-\\w\\.]+)$/i,/(firefox)\\/([\\w\\.]+)/i,/(mozilla)\\/([\\w\\.]+) .+rv\\:.+gecko\\/\\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir|obigo|mosaic|(?:go|ice|up)[\\. ]?browser)[-\\/ ]?v?([\\w\\.]+)/i,/(links) \\(([\\w\\.]+)/i,/panasonic;(viera)/i],[p,v],[/(cobalt)\\/([\\w\\.]+)/i],[p,[v,/master.|lts./,""]]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\\)]/i],[[g,"amd64"]],[/(ia32(?=;))/i],[[g,W]],[/((?:i[346]|x)86)[;\\)]/i],[[g,"ia32"]],[/\\b(aarch64|arm(v?8e?l?|_?64))\\b/i],[[g,"arm64"]],[/\\b(arm(?:v[67])?ht?n?[fl]p?)\\b/i],[[g,"armhf"]],[/windows (ce|mobile); ppc;/i],[[g,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\\))/i],[[g,/ower/,"",W]],[/(sun4\\w)[;\\)]/i],[[g,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\\))|\\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\\b|pa-risc)/i],[[g,W]]],device:[[/\\b(sch-i[89]0\\d|shw-m380s|sm-[ptx]\\w{2,4}|gt-[pn]\\d{2,4}|sgh-t8[56]9|nexus 10)/i],[d,[f,A],[m,w]],[/\\b((?:s[cgp]h|gt|sm)-\\w+|sc[g-]?[\\d]+a?|galaxy nexus)/i,/samsung[- ]([-\\w]+)/i,/sec-(sgh\\w+)/i],[d,[f,A],[m,h]],[/(?:\\/|\\()(ip(?:hone|od)[\\w, ]*)(?:\\/|;)/i],[d,[f,S],[m,h]],[/\\((ipad);[-\\w\\),; ]+apple/i,/applecoremedia\\/[\\w\\.]+ \\((ipad)/i,/\\b(ipad)\\d\\d?,\\d\\d?[;\\]].+ios/i],[d,[f,S],[m,w]],[/(macintosh);/i],[d,[f,S]],[/\\b(sh-?[altvz]?\\d\\d[a-ekm]?)/i],[d,[f,L],[m,h]],[/\\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\\d{2})\\b(?!.+d\\/s)/i],[d,[f,P],[m,w]],[/(?:huawei|honor)([-\\w ]+)[;\\)]/i,/\\b(nexus 6p|\\w{2,4}e?-[atu]?[ln][\\dx][012359c][adn]?)\\b(?!.+d\\/s)/i],[d,[f,P],[m,h]],[/\\b(poco[\\w ]+)(?: bui|\\))/i,/\\b; (\\w+) build\\/hm\\1/i,/\\b(hm[-_ ]?note?[_ ]?(?:\\d\\w)?) bui/i,/\\b(redmi[\\-_ ]?(?:note|k)?[\\w_ ]+)(?: bui|\\))/i,/\\b(mi[-_ ]?(?:a\\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\\d?\\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\\))/i],[[d,/_/g," "],[f,R],[m,h]],[/\\b(mi[-_ ]?(?:pad)(?:[\\w_ ]+))(?: bui|\\))/i],[[d,/_/g," "],[f,R],[m,w]],[/; (\\w+) bui.+ oppo/i,/\\b(cph[12]\\d{3}|p(?:af|c[al]|d\\w|e[ar])[mt]\\d0|x9007|a101op)\\b/i],[d,[f,"OPPO"],[m,h]],[/vivo (\\w+)(?: bui|\\))/i,/\\b(v[12]\\d{3}\\w?[at])(?: bui|;)/i],[d,[f,"Vivo"],[m,h]],[/\\b(rmx[12]\\d{3})(?: bui|;|\\))/i],[d,[f,"Realme"],[m,h]],[/\\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\\b[\\w ]+build\\//i,/\\bmot(?:orola)?[- ](\\w*)/i,/((?:moto[\\w\\(\\) ]+|xt\\d{3,4}|nexus 6)(?= bui|\\)))/i],[d,[f,C],[m,h]],[/\\b(mz60\\d|xoom[2 ]{0,2}) build\\//i],[d,[f,C],[m,w]],[/((?=lg)?[vl]k\\-?\\d{3}) bui| 3\\.[-\\w; ]{10}lg?-([06cv9]{3,4})/i],[d,[f,M],[m,w]],[/(lm(?:-?f100[nv]?|-[\\w\\.]+)(?= bui|\\))|nexus [45])/i,/\\blg[-e;\\/ ]+((?!browser|netcast|android tv)\\w+)/i,/\\blg-?([\\d\\w]+) bui/i],[d,[f,M],[m,h]],[/(ideatab[-\\w ]+)/i,/lenovo ?(s[56]000[-\\w]+|tab(?:[\\w ]+)|yt[-\\d\\w]{6}|tb[-\\d\\w]{6})/i],[d,[f,"Lenovo"],[m,w]],[/(?:maemo|nokia).*(n900|lumia \\d+)/i,/nokia[-_ ]?([-\\w\\.]*)/i],[[d,/_/g," "],[f,"Nokia"],[m,h]],[/(pixel c)\\b/i],[d,[f,I],[m,w]],[/droid.+; (pixel[\\daxl ]{0,6})(?: bui|\\))/i],[d,[f,I],[m,h]],[/droid.+ (a?\\d[0-2]{2}so|[c-g]\\d{4}|so[-gl]\\w+|xq-a\\w[4-7][12])(?= bui|\\).+chrome\\/(?![1-6]{0,1}\\d\\.))/i],[d,[f,U],[m,h]],[/sony tablet [ps]/i,/\\b(?:sony)?sgp\\w+(?: bui|\\))/i],[[d,"Xperia Tablet"],[f,U],[m,w]],[/ (kb2005|in20[12]5|be20[12][59])\\b/i,/(?:one)?(?:plus)? (a\\d0\\d\\d)(?: b|\\))/i],[d,[f,"OnePlus"],[m,h]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\\))/i,/(kf[a-z]+)( bui|\\)).+silk\\//i],[d,[f,_],[m,w]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\\)).+silk\\//i],[[d,/(.+)/g,"Fire Phone $1"],[f,_],[m,h]],[/(playbook);[-\\w\\),; ]+(rim)/i],[d,f,[m,w]],[/\\b((?:bb[a-f]|st[hv])100-\\d)/i,/\\(bb10; (\\w+)/i],[d,[f,x],[m,h]],[/(?:\\b|asus_)(transfo[prime ]{4,10} \\w+|eeepc|slider \\w+|nexus 7|padfone|p00[cj])/i],[d,[f,E],[m,w]],[/ (z[bes]6[027][012][km][ls]|zenfone \\d\\w?)\\b/i],[d,[f,E],[m,h]],[/(nexus 9)/i],[d,[f,"HTC"],[m,w]],[/(htc)[-;_ ]{1,2}([\\w ]+(?=\\)| bui)|\\w+)/i,/(zte)[- ]([\\w ]+?)(?: bui|\\/|\\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\\.))|sony(?!-bra))[-_ ]?([-\\w]*)/i],[f,[d,/_/g," "],[m,h]],[/droid.+; ([ab][1-7]-?[0178a]\\d\\d?)/i],[d,[f,"Acer"],[m,w]],[/droid.+; (m[1-5] note) bui/i,/\\bmz-([-\\w]{2,})/i],[d,[f,"Meizu"],[m,h]],[/(blackberry|benq|palm(?=\\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[-_ ]?([-\\w]*)/i,/(hp) ([\\w ]+\\w)/i,/(asus)-?(\\w+)/i,/(microsoft); (lumia[\\w ]+)/i,/(lenovo)[-_ ]?([-\\w]+)/i,/(jolla)/i,/(oppo) ?([\\w ]+) bui/i],[f,d,[m,h]],[/(kobo)\\s(ereader|touch)/i,/(archos) (gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\\/([\\w\\.]+)/i,/(nook)[\\w ]+build\\/(\\w+)/i,/(dell) (strea[kpr\\d ]*[\\dko])/i,/(le[- ]+pan)[- ]+(\\w{1,9}) bui/i,/(trinity)[- ]*(t\\d{3}) bui/i,/(gigaset)[- ]+(q\\w{1,9}) bui/i,/(vodafone) ([\\w ]+)(?:\\)| bui)/i],[f,d,[m,w]],[/(surface duo)/i],[d,[f,B],[m,w]],[/droid [\\d\\.]+; (fp\\du?)(?: b|\\))/i],[d,[f,"Fairphone"],[m,h]],[/(u304aa)/i],[d,[f,"AT&T"],[m,h]],[/\\bsie-(\\w*)/i],[d,[f,"Siemens"],[m,h]],[/\\b(rct\\w+) b/i],[d,[f,"RCA"],[m,w]],[/\\b(venue[\\d ]{2,7}) b/i],[d,[f,"Dell"],[m,w]],[/\\b(q(?:mv|ta)\\w+) b/i],[d,[f,"Verizon"],[m,w]],[/\\b(?:barnes[& ]+noble |bn[rt])([\\w\\+ ]*) b/i],[d,[f,"Barnes & Noble"],[m,w]],[/\\b(tm\\d{3}\\w+) b/i],[d,[f,"NuVision"],[m,w]],[/\\b(k88) b/i],[d,[f,"ZTE"],[m,w]],[/\\b(nx\\d{3}j) b/i],[d,[f,"ZTE"],[m,h]],[/\\b(gen\\d{3}) b.+49h/i],[d,[f,"Swiss"],[m,h]],[/\\b(zur\\d{3}) b/i],[d,[f,"Swiss"],[m,w]],[/\\b((zeki)?tb.*\\b) b/i],[d,[f,"Zeki"],[m,w]],[/\\b([yr]\\d{2}) b/i,/\\b(dragon[- ]+touch |dt)(\\w{5}) b/i],[[f,"Dragon Touch"],d,[m,w]],[/\\b(ns-?\\w{0,9}) b/i],[d,[f,"Insignia"],[m,w]],[/\\b((nxa|next)-?\\w{0,9}) b/i],[d,[f,"NextBook"],[m,w]],[/\\b(xtreme\\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[f,"Voice"],d,[m,h]],[/\\b(lvtel\\-)?(v1[12]) b/i],[[f,"LvTel"],d,[m,h]],[/\\b(ph-1) /i],[d,[f,"Essential"],[m,h]],[/\\b(v(100md|700na|7011|917g).*\\b) b/i],[d,[f,"Envizen"],[m,w]],[/\\b(trio[-\\w\\. ]+) b/i],[d,[f,"MachSpeed"],[m,w]],[/\\btu_(1491) b/i],[d,[f,"Rotor"],[m,w]],[/(shield[\\w ]+) b/i],[d,[f,"Nvidia"],[m,w]],[/(sprint) (\\w+)/i],[f,d,[m,h]],[/(kin\\.[onetw]{3})/i],[[d,/\\./g," "],[f,B],[m,h]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\\)/i],[d,[f,q],[m,w]],[/droid.+; (ec30|ps20|tc[2-8]\\d[kx])\\)/i],[d,[f,q],[m,h]],[/smart-tv.+(samsung)/i],[f,[m,y]],[/hbbtv.+maple;(\\d+)/i],[[d,/^/,"SmartTV"],[f,A],[m,y]],[/(nux; netcast.+smarttv|lg (netcast\\.tv-201\\d|android tv))/i],[[f,M],[m,y]],[/(apple) ?tv/i],[f,[d,S+" TV"],[m,y]],[/crkey/i],[[d,j+"cast"],[f,I],[m,y]],[/droid.+aft(\\w)( bui|\\))/i],[d,[f,_],[m,y]],[/\\(dtv[\\);].+(aquos)/i,/(aquos-tv[\\w ]+)\\)/i],[d,[f,L],[m,y]],[/(bravia[\\w ]+)( bui|\\))/i],[d,[f,U],[m,y]],[/(mitv-\\w{5}) bui/i],[d,[f,R],[m,y]],[/Hbbtv.*(technisat) (.*);/i],[f,d,[m,y]],[/\\b(roku)[\\dx]*[\\)\\/]((?:dvp-)?[\\d\\.]*)/i,/hbbtv\\/\\d+\\.\\d+\\.\\d+ +\\([\\w\\+ ]*; *([\\w\\d][^;]*);([^;]*)/i],[[f,H],[d,H],[m,y]],[/\\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\\b/i],[[m,y]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[f,d,[m,b]],[/droid.+; (shield) bui/i],[d,[f,"Nvidia"],[m,b]],[/(playstation [345portablevi]+)/i],[d,[f,U],[m,b]],[/\\b(xbox(?: one)?(?!; xbox))[\\); ]/i],[d,[f,B],[m,b]],[/((pebble))app/i],[f,d,[m,T]],[/(watch)(?: ?os[,\\/]|\\d,\\d\\/)[\\d\\.]+/i],[d,[f,S],[m,T]],[/droid.+; (glass) \\d/i],[d,[f,I],[m,T]],[/droid.+; (wt63?0{2,3})\\)/i],[d,[f,q],[m,T]],[/(quest( 2| pro)?)/i],[d,[f,F],[m,T]],[/(tesla)(?: qtcarbrowser|\\/[-\\w\\.]+)/i],[f,[m,k]],[/(aeobc)\\b/i],[d,[f,_],[m,k]],[/droid .+?; ([^;]+?)(?: bui|\\) applew).+? mobile safari/i],[d,[m,h]],[/droid .+?; ([^;]+?)(?: bui|\\) applew).+?(?! mobile) safari/i],[d,[m,w]],[/\\b((tablet|tab)[;\\/]|focus\\/\\d(?!.+mobile))/i],[[m,w]],[/(phone|mobile(?:[;\\/]| [ \\w\\/\\.]*safari)|pda(?=.+windows ce))/i],[[m,h]],[/(android[-\\w\\. ]{0,9});.+buil/i],[d,[f,"Generic"]]],engine:[[/windows.+ edge\\/([\\w\\.]+)/i],[v,[p,"EdgeHTML"]],[/webkit\\/537\\.36.+chrome\\/(?!27)([\\w\\.]+)/i],[v,[p,"Blink"]],[/(presto)\\/([\\w\\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\\/([\\w\\.]+)/i,/ekioh(flow)\\/([\\w\\.]+)/i,/(khtml|tasman|links)[\\/ ]\\(?([\\w\\.]+)/i,/(icab)[\\/ ]([23]\\.[\\d\\.]+)/i,/\\b(libweb)/i],[p,v],[/rv\\:([\\w\\.]{1,9})\\b.+(gecko)/i],[v,p]],os:[[/microsoft (windows) (vista|xp)/i],[p,v],[/(windows) nt 6\\.2; (arm)/i,/(windows (?:phone(?: os)?|mobile))[\\/ ]?([\\d\\.\\w ]*)/i,/(windows)[\\/ ]?([ntce\\d\\. ]+\\w)(?!.+xbox)/i],[p,[v,J,X]],[/(win(?=3|9|n)|win 9x )([nt\\d\\.]+)/i],[[p,"Windows"],[v,J,X]],[/ip[honead]{2,4}\\b(?:.*os ([\\w]+) like mac|; opera)/i,/ios;fbsv\\/([\\d\\.]+)/i,/cfnetwork\\/.+darwin/i],[[v,/_/g,"."],[p,"iOS"]],[/(mac os x) ?([\\w\\. ]*)/i,/(macintosh|mac_powerpc\\b)(?!.+haiku)/i],[[p,K],[v,/_/g,"."]],[/droid ([\\w\\.]+)\\b.+(android[- ]x86|harmonyos)/i],[v,p],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\\/ ]?([\\w\\.]*)/i,/(blackberry)\\w*\\/([\\w\\.]*)/i,/(tizen|kaios)[\\/ ]([\\w\\.]+)/i,/\\((series40);/i],[p,v],[/\\(bb(10);/i],[v,[p,x]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\\/ ]?([\\w\\.]*)/i],[v,[p,"Symbian"]],[/mozilla\\/[\\d\\.]+ \\((?:mobile|tablet|tv|mobile; [\\w ]+); rv:.+ gecko\\/([\\w\\.]+)/i],[v,[p,N+" OS"]],[/web0s;.+rt(tv)/i,/\\b(?:hp)?wos(?:browser)?\\/([\\w\\.]+)/i],[v,[p,"webOS"]],[/watch(?: ?os[,\\/]|\\d,\\d\\/)([\\d\\.]+)/i],[v,[p,"watchOS"]],[/crkey\\/([\\d\\.]+)/i],[v,[p,j+"cast"]],[/(cros) [\\w]+(?:\\)| ([\\w\\.]+)\\b)/i],[[p,z],v],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\\/(\\d+\\.[\\w\\.]+)/i,/(nintendo|playstation) ([wids345portablevuch]+)/i,/(xbox); +xbox ([^\\);]+)/i,/\\b(joli|palm)\\b ?(?:os)?\\/?([\\w\\.]*)/i,/(mint)[\\/\\(\\) ]?(\\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\\/ ]?(?!chrom|package)([-\\w\\.]*)/i,/(hurd|linux) ?([\\w\\.]*)/i,/(gnu) ?([\\w\\.]*)/i,/\\b([-frentopcghs]{0,5}bsd|dragonfly)[\\/ ]?(?!amd|[ix346]{1,2}86)([\\w\\.]*)/i,/(haiku) (\\w+)/i],[p,v],[/(sunos) ?([\\w\\.\\d]*)/i],[[p,"Solaris"],v],[/((?:open)?solaris)[-\\/ ]?([\\w\\.]*)/i,/(aix) ((\\d)(?=\\.|\\)| )[\\w\\.])*/i,/\\b(beos|os\\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i,/(unix) ?([\\w\\.]*)/i],[p,v]]},Z=function(e,t){if(typeof e===c&&(t=e,e=a),!(this instanceof Z))return new Z(e,t).getResult();var n=typeof i!==s&&i.navigator?i.navigator:a,r=e||(n&&n.userAgent?n.userAgent:""),b=n&&n.userAgentData?n.userAgentData:a,y=t?function(e,t){var n={};for(var r in e)t[r]&&t[r].length%2==0?n[r]=t[r].concat(e[r]):n[r]=e[r];return n}(G,t):G,T=n&&n.userAgent==r;return this.getBrowser=function(){var e,t={};return t[p]=a,t[v]=a,V.call(t,r,y.browser),t[l]=typeof(e=t[v])===u?e.replace(/[^\\d\\.]/g,"").split(".")[0]:a,T&&n&&n.brave&&typeof n.brave.isBrave==o&&(t[p]="Brave"),t},this.getCPU=function(){var e={};return e[g]=a,V.call(e,r,y.cpu),e},this.getDevice=function(){var e={};return e[f]=a,e[d]=a,e[m]=a,V.call(e,r,y.device),T&&!e[m]&&b&&b.mobile&&(e[m]=h),T&&"Macintosh"==e[d]&&n&&typeof n.standalone!==s&&n.maxTouchPoints&&n.maxTouchPoints>2&&(e[d]="iPad",e[m]=w),e},this.getEngine=function(){var e={};return e[p]=a,e[v]=a,V.call(e,r,y.engine),e},this.getOS=function(){var e={};return e[p]=a,e[v]=a,V.call(e,r,y.os),T&&!e[p]&&b&&"Unknown"!=b.platform&&(e[p]=b.platform.replace(/chrome os/i,z).replace(/macos/i,K)),e},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return r},this.setUA=function(e){return r=typeof e===u&&e.length>350?H(e,350):e,this},this.setUA(r),this};Z.VERSION="1.0.35",Z.BROWSER=$([p,v,l]),Z.CPU=$([g]),Z.DEVICE=$([d,f,m,b,h,y,w,T,k]),Z.ENGINE=Z.OS=$([p,v]),typeof t!==s?(e.exports&&(t=e.exports=Z),t.UAParser=Z):n.amdO?(r=function(){return Z}.call(t,n,t,e))===a||(e.exports=r):typeof i!==s&&(i.UAParser=Z);var Y=typeof i!==s&&(i.jQuery||i.Zepto);if(Y&&!Y.ua){var ee=new Z;Y.ua=ee.getResult(),Y.ua.get=function(){return ee.getUA()},Y.ua.set=function(e){ee.setUA(e);var t=ee.getResult();for(var n in t)Y.ua[n]=t[n]}}}("object"==typeof window?window:this)}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var a=t[r]={exports:{}};return e[r].call(a.exports,a,a.exports,n),a.exports}n.amdO={},n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};return(()=>{"use strict";n.r(r),n.d(r,{ActionType:()=>f,AmplitudePlatformName:()=>g,AnalyticsEventImportance:()=>l,AnalyticsQueries:()=>e,AuthStatus:()=>b,ComponentType:()=>m,IThresholdTier:()=>Jt,MetricType:()=>d,PlatformName:()=>v,SessionActions:()=>h,SessionAutomatedEvents:()=>w,SessionRank:()=>y,SubjectType:()=>p,UserTypeCommerce:()=>c,UserTypeInsto:()=>i,UserTypeRetail:()=>t,UserTypeRetailBusinessBanking:()=>s,UserTypeRetailEmployeeInternal:()=>a,UserTypeRetailEmployeePersonal:()=>o,UserTypeWallet:()=>u,automatedEvents:()=>xn,automatedMappingConfig:()=>In,clearMarkEntry:()=>Vn,clearPerformanceMarkEntries:()=>Xn,config:()=>A,createEventConfig:()=>On,createNewSpan:()=>Ln,createNewTrace:()=>Un,device:()=>W,endPerfMark:()=>Jn,exposeExperiment:()=>wn,flushQueue:()=>or,generateUUID:()=>V,getAnalyticsHeaders:()=>sr,getReferrerData:()=>le,getTracingHeaders:()=>An,getTracingId:()=>Dn,getUrlHostname:()=>pe,getUrlParams:()=>me,getUrlPathname:()=>fe,getUserContext:()=>ar,identify:()=>Tn,identifyFlow:()=>xe,identity:()=>H,identityFlow:()=>Se,incrementUjNavigation:()=>an,init:()=>yn,initNextJsTrackPageview:()=>_n,initTrackPageview:()=>kn,isEventKeyFormatValid:()=>we,isSessionEnded:()=>pt,location:()=>re,logEvent:()=>$t,logMetric:()=>Ht,logPageView:()=>on,logTrace:()=>Rn,markNTBT:()=>tn,markStep:()=>nn,markStepOnce:()=>rn,onVisibilityChange:()=>ln,optIn:()=>En,optOut:()=>Sn,perfMark:()=>Wn,persistentData:()=>oe,postMessage:()=>K,recordSessionDuration:()=>pn,removeFromIdentifyFlow:()=>Ee,savePersistentData:()=>st,sendScheduledEvents:()=>Bt,setBreadcrumbs:()=>ie,setConfig:()=>U,setLocation:()=>ae,setPagePath:()=>ve,setPageview:()=>Kt,setPersistentData:()=>se,setSessionStart:()=>dt,setTime:()=>Ue,startPerfMark:()=>Hn,timeStone:()=>Le,useEventLogger:()=>Yn,useLogEventOnMount:()=>tr,usePerformanceMarks:()=>rr});let e=function(e){return e.fbclid="fbclid",e.gclid="gclid",e.msclkid="msclkid",e.ptclid="ptclid",e.ttclid="ttclid",e.utm_source="utm_source",e.utm_medium="utm_medium",e.utm_campaign="utm_campaign",e.utm_term="utm_term",e.utm_content="utm_content",e}({});const t=0,i=1,a=2,o=3,s=4,c=5,u=6;let l=function(e){return e.low="low",e.high="high",e}({}),d=function(e){return e.count="count",e.rate="rate",e.gauge="gauge",e.distribution="distribution",e.histogram="histogram",e}({}),p=function(e){return e.commerce_merchant="commerce_merchant",e.device="device",e.edp_fingerprint_id="edp_fingerprint_id",e.nft_user="nft_user",e.user="user",e.wallet_user="wallet_user",e.uuid="user_uuid",e}({}),m=function(e){return e.unknown="unknown",e.banner="banner",e.button="button",e.card="card",e.chart="chart",e.content_script="content_script",e.dropdown="dropdown",e.link="link",e.page="page",e.modal="modal",e.table="table",e.search_bar="search_bar",e.service_worker="service_worker",e.text="text",e.text_input="text_input",e.tray="tray",e.checkbox="checkbox",e.icon="icon",e}({}),f=function(e){return e.unknown="unknown",e.blur="blur",e.click="click",e.change="change",e.dismiss="dismiss",e.focus="focus",e.hover="hover",e.select="select",e.measurement="measurement",e.move="move",e.process="process",e.render="render",e.scroll="scroll",e.view="view",e.search="search",e.keyPress="keyPress",e}({}),v=function(e){return e.unknown="unknown",e.web="web",e.android="android",e.ios="ios",e.mobile_web="mobile_web",e.tablet_web="tablet_web",e.server="server",e.windows="windows",e.macos="macos",e.extension="extension",e}({}),g=function(e){return e.web="Web",e.ios="iOS",e.android="Android",e}({}),b=function(e){return e[e.notLoggedIn=0]="notLoggedIn",e[e.loggedIn=1]="loggedIn",e}({}),h=function(e){return e.ac="ac",e.af="af",e.ah="ah",e.al="al",e.am="am",e.ar="ar",e.as="as",e}({}),w=function(e){return e.pv="pv",e}({}),y=function(e){return e.xs="xs",e.s="s",e.m="m",e.l="l",e.xl="xl",e.xxl="xxl",e}({});const T="https://analytics-service-dev.cbhq.net",k=3e5,_=5e3,S="analytics-db",E="experiment-exposure-db",x="Analytics SDK:",O=Object.values(e),j="pageview",N="session_duration",I={navigationTiming:{eventName:"perf_navigation_timing"},redirectTime:{eventName:"perf_redirect_time"},RT:{eventName:"perf_redirect_time"},TTFB:{eventName:"perf_time_to_first_byte"},networkInformation:{eventName:"perf_network_information"},storageEstimate:{eventName:"perf_storage_estimate"},FCP:{eventName:"perf_first_contentful_paint"},FID:{eventName:"perf_first_input_delay"},LCP:{eventName:"perf_largest_contentful_paint"},CLS:{eventName:"perf_cumulative_layout_shift"},TBT:{eventName:"perf_total_blocking_time"},NTBT:{eventName:"perf_navigation_total_blocking_time"},INP:{eventName:"perf_interact_to_next_paint"},ET:{eventName:"perf_element_timing"},userJourneyStep:{eventName:"perf_user_journey_step"}},P="1",M="web";function B(){return B=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},B.apply(this,arguments)}const C=/^(https?:\\/\\/)/;function D(e){return{eventsEndpoint:e+"/amp",metricsEndPoint:e+"/metrics",exposureEndpoint:e+"/track-exposures",tracesEndpoint:e+"/traces"}}const A=B({authCookie:"logged_in",amplitudeApiKey:"",batchEventsPeriod:_,batchEventsThreshold:30,batchMetricsPeriod:_,batchMetricsThreshold:30,batchTracesPeriod:_,batchTracesThreshold:30,headers:{},interactionManager:null,isAlwaysAuthed:!1,isProd:!1,isInternalApplication:!1,onError:(e,t)=>{console.error(x,e,t)},platform:v.unknown,projectName:"",ricTimeoutScheduleEvent:1e3,ricTimeoutSetDevice:500,showDebugLogging:!1,trackUserId:!1,version:null,apiEndpoint:T},D(T),{steps:{}}),L=[].reduce(((e,t)=>n=>e(t(n))),(e=>{if(!e.isProd)return e.isInternalApplication?(e.apiEndpoint="https://analytics-service-internal-dev.cbhq.net",B({},e,D(e.apiEndpoint))):e;const t=(e=>e.apiEndpoint?C.test(e.apiEndpoint)?e.apiEndpoint:`https://${e.apiEndpoint}`:e.isInternalApplication?"https://analytics-service-internal.cbhq.net":"https://as.coinbase.com")(e);return B({},e,{apiEndpoint:t},D(t))})),U=e=>{const{batchEventsThreshold:t,batchMetricsThreshold:n,batchTracesThreshold:r}=e,i=[t,n,r];for(const e of i)if((e||0)>30){console.warn("You are setting the threshhold for the batch limit to be greater than 30. This may cause request overload.");break}Object.assign(A,L(e))},R=[v.web,v.mobile_web,v.tablet_web];function q(){return"android"===A.platform}function F(){return"ios"===A.platform}function z(){return R.includes(A.platform)}function K(e){if(z()&&navigator&&"serviceWorker"in navigator&&navigator.serviceWorker.controller)try{navigator.serviceWorker.controller.postMessage(e)}catch(e){e instanceof Error&&A.onError(e)}}var $=n(353),Q=n.n($);const W={amplitudeOSName:null,amplitudeOSVersion:null,amplitudeDeviceModel:null,amplitudePlatform:null,browserName:null,browserMajor:null,osName:null,userAgent:null,width:null,height:null},H={countryCode:null,deviceId:null,device_os:null,isOptOut:!1,languageCode:null,locale:null,jwt:null,session_lcc_id:null,userAgent:null,userId:null},V=e=>e?(e^16*Math.random()>>e/4).toString(16):"10000000-1000-4000-8000-100000000000".replace(/[018]/g,V),J=()=>A.isAlwaysAuthed||!!H.userId,X=()=>{const e={};return H.countryCode&&(e.country_code=H.countryCode),e},G=()=>{const{platform:e}=A;if(e===v.web)switch(!0){case window.matchMedia("(max-width: 560px)").matches:return v.mobile_web;case window.matchMedia("(max-width: 1024px, min-width: 561px)").matches:return v.tablet_web}return e},Z=()=>{var e,t,n,r,i;z()?("requestIdleCallback"in window?window.requestIdleCallback(ne,{timeout:A.ricTimeoutSetDevice}):ne(),W.amplitudePlatform=g.web,W.userAgent=(null==(e=window)||null==(e=e.navigator)?void 0:e.userAgent)||null,ee({height:null!=(t=null==(n=window)?void 0:n.innerHeight)?t:null,width:null!=(r=null==(i=window)?void 0:i.innerWidth)?r:null})):F()?(W.amplitudePlatform=g.ios,W.userAgent=H.userAgent,W.userAgent&&ne()):q()&&(W.userAgent=H.userAgent,W.amplitudePlatform=g.android,W.userAgent&&ne())},Y=e=>{Object.assign(H,e),z()&&K({identity:{isAuthed:!!H.userId,locale:H.locale||null}})},ee=e=>{W.height=e.height,W.width=e.width},te=()=>{U({platform:G()}),z()&&K({config:{platform:A.platform}})},ne=()=>{var e;performance.mark&&performance.mark("ua_parser_start");const t=new(Q())(null!=(e=W.userAgent)?e:"").getResult();W.browserName=t.browser.name||null,W.browserMajor=t.browser.major||null,W.osName=t.os.name||null,W.amplitudeOSName=W.browserName,W.amplitudeOSVersion=W.browserMajor,W.amplitudeDeviceModel=W.osName,K({device:{browserName:W.browserName,osName:W.osName}}),performance.mark&&(performance.mark("ua_parser_end"),performance.measure("ua_parser","ua_parser_start","ua_parser_end"))},re={breadcrumbs:[],initialUAAData:{},pageKey:"",pageKeyRegex:{},pagePath:"",prevPageKey:"",prevPagePath:""};function ie(e){Object.assign(re,{breadcrumbs:e})}function ae(e){Object.assign(re,e)}const oe={eventId:0,sequenceNumber:0,sessionId:0,lastEventTime:0,sessionStart:0,sessionUUID:null,userId:null,ac:0,af:0,ah:0,al:0,am:0,ar:0,as:0,pv:0};function se(e){Object.assign(oe,e)}function ce(){var e,t;return null!=(e=null==(t=document)?void 0:t.referrer)?e:""}function ue(){return ue=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ue.apply(this,arguments)}const le=()=>{const e=ce();if(!e)return{};const t=new URL(e);return t.hostname===pe()?{}:{referrer:e,referring_domain:t.hostname}},de=()=>{const e=new URLSearchParams(me()),t={};return O.forEach((n=>{e.has(n)&&(t[n]=(e.get(n)||"").toLowerCase())})),t},pe=()=>{var e;return(null==(e=window)||null==(e=e.location)?void 0:e.hostname)||""},me=()=>{var e;return(null==(e=window)||null==(e=e.location)?void 0:e.search)||""},fe=()=>{var e;return(null==(e=window)||null==(e=e.location)?void 0:e.pathname)||""},ve=()=>{const e=A.overrideWindowLocation?re.pagePath:fe()+me();e&&e!==re.pagePath&&(e!==re.pagePath&&ge(),re.pagePath=e,re.pageKeyRegex&&Object.keys(re.pageKeyRegex).some((e=>{if(re.pageKeyRegex[e].test(re.pagePath))return re.pageKey=e,!0})))},ge=()=>{if(z()){const e=ce();if(!re.prevPagePath&&e){const t=new URL(e);if(t.hostname===pe())return void(re.prevPagePath=t.pathname)}}re.prevPagePath=re.pagePath,re.prevPageKey=re.pageKey},be=e=>{z()&&Object.assign(e,z()?(Object.keys(re.initialUAAData).length>0||(new URLSearchParams(me()),re.initialUAAData=ue({},(()=>{const e={};return O.forEach((t=>{oe[t]&&(e[t]=oe[t])})),e})(),de(),le())),re.initialUAAData):re.initialUAAData)},he=/^[a-zd]+(_[a-zd]+)*$/;function we(e){return he.test(e)}function ye(){return ye=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ye.apply(this,arguments)}const Te=["action","component_type","component_name","context","logging_id"],ke=["num_non_hardware_accounts","ujs"],_e="ujs_",Se={};function Ee(e){e.forEach((e=>{ke.includes(e)&&delete Se[e]}))}function xe(e){var t;const n=Object.entries(e).reduce(((e,t)=>{const[n,r]=t;return!Te.includes(n)&&ke.includes(n)?we(n)?ye({},e,{[n]:r}):(A.onError(new Error("IdentityFlow property names must have snake case format"),{[n]:r}),e):e}),{});null!=(t=n.ujs)&&t.length&&(n.ujs=n.ujs.map((e=>`${_e}${e}`))),Object.assign(Se,n)}function Oe(){return A.platform!==v.unknown||(A.onError(new Error("SDK platform not initialized")),!1)}const je={eventsQueue:[],eventsScheduled:!1,metricsQueue:[],metricsScheduled:!1,tracesQueue:[],tracesScheduled:!1};function Ne(e){Object.assign(je,e)}const Ie={ac:0,af:0,ah:0,al:0,am:0,ar:0,as:0,pv:0,sqs:0},Pe={ac:20,af:5,ah:1,al:1,am:0,ar:10,as:20},Me={pv:25},Be={xs:0,s:1,m:1,l:2,xl:2,xxl:2},Ce=e=>e<15?y.xs:e<60?y.s:e<240?y.m:e<960?y.l:e<3840?y.xl:y.xxl,De=e=>{Object.assign(Ie,e)};function Ae(){return(new Date).getTime()}const Le={timeStart:Ae(),timeOnPagePath:0,timeOnPageKey:0,prevTimeOnPagePath:0,prevTimeOnPageKey:0,sessionDuration:0,sessionEnd:0,sessionStart:0,prevSessionDuration:0};function Ue(e){Object.assign(Le,e)}const Re=(e,t)=>t.some((t=>e instanceof t));let qe,Fe;const ze=new WeakMap,Ke=new WeakMap,$e=new WeakMap,Qe=new WeakMap,We=new WeakMap;let He={get(e,t,n){if(e instanceof IDBTransaction){if("done"===t)return Ke.get(e);if("objectStoreNames"===t)return e.objectStoreNames||$e.get(e);if("store"===t)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return Je(e[t])},set:(e,t,n)=>(e[t]=n,!0),has:(e,t)=>e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e};function Ve(e){return"function"==typeof e?(t=e)!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(Fe||(Fe=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(t)?function(...e){return t.apply(Xe(this),e),Je(ze.get(this))}:function(...e){return Je(t.apply(Xe(this),e))}:function(e,...n){const r=t.call(Xe(this),e,...n);return $e.set(r,e.sort?e.sort():[e]),Je(r)}:(e instanceof IDBTransaction&&function(e){if(Ke.has(e))return;const t=new Promise(((t,n)=>{const r=()=>{e.removeEventListener("complete",i),e.removeEventListener("error",a),e.removeEventListener("abort",a)},i=()=>{t(),r()},a=()=>{n(e.error||new DOMException("AbortError","AbortError")),r()};e.addEventListener("complete",i),e.addEventListener("error",a),e.addEventListener("abort",a)}));Ke.set(e,t)}(e),Re(e,qe||(qe=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction]))?new Proxy(e,He):e);var t}function Je(e){if(e instanceof IDBRequest)return function(e){const t=new Promise(((t,n)=>{const r=()=>{e.removeEventListener("success",i),e.removeEventListener("error",a)},i=()=>{t(Je(e.result)),r()},a=()=>{n(e.error),r()};e.addEventListener("success",i),e.addEventListener("error",a)}));return t.then((t=>{t instanceof IDBCursor&&ze.set(t,e)})).catch((()=>{})),We.set(t,e),t}(e);if(Qe.has(e))return Qe.get(e);const t=Ve(e);return t!==e&&(Qe.set(e,t),We.set(t,e)),t}const Xe=e=>We.get(e),Ge=["get","getKey","getAll","getAllKeys","count"],Ze=["put","add","delete","clear"],Ye=new Map;function et(e,t){if(!(e instanceof IDBDatabase)||t in e||"string"!=typeof t)return;if(Ye.get(t))return Ye.get(t);const n=t.replace(/FromIndex$/,""),r=t!==n,i=Ze.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!i&&!Ge.includes(n))return;const a=async function(e,...t){const a=this.transaction(e,i?"readwrite":"readonly");let o=a.store;return r&&(o=o.index(t.shift())),(await Promise.all([o[n](...t),i&&a.done]))[0]};return Ye.set(t,a),a}var tt;tt=He,He={...tt,get:(e,t,n)=>et(e,t)||tt.get(e,t,n),has:(e,t)=>!!et(e,t)||tt.has(e,t)};const nt={isReady:!1,idbKeyval:null};function rt(e){Object.assign(nt,e)}const it={},at=async e=>{if(!nt.idbKeyval)return Promise.resolve(null);try{return await nt.idbKeyval.get(e)}catch(e){return A.onError(new Error("IndexedDB:Get:InternalError")),Promise.resolve(null)}},ot=async(e,t)=>{if(nt.idbKeyval)try{await nt.idbKeyval.set(e,t)}catch(e){A.onError(new Error("IndexedDB:Set:InternalError"))}},st=()=>{"server"!==A.platform&&(se({sessionStart:Le.sessionStart,ac:Ie.ac,af:Ie.af,ah:Ie.ah,al:Ie.al,am:Ie.am,ar:Ie.ar,as:Ie.as,pv:Ie.pv}),H.userId&&se({userId:H.userId}),ot(S,oe))},ct="rgb(5,177,105)",ut=e=>{const{metricName:t,data:n}=e,r=e.importance||l.low;if(!A.showDebugLogging||!console)return;const i=`%c ${x}`,a=`color:${ct};font-size:11px;`,o=`Importance: ${r}`;console.group(i,a,t,o),n.forEach((e=>{e.event_type?console.log(e.event_type,e):console.log(e)})),console.groupEnd()},lt=e=>{const{metricName:t,data:n}=e,r=e.importance||l.low;if(!A.showDebugLogging||!console)return;const i=`color:${ct};font-size:11px;`,a=`%c ${x}`,o=`Importance: ${r}`;console.log(a,i,t,n,o)},dt=()=>{const e=Ae();oe.sessionId&&oe.lastEventTime&&oe.sessionUUID&&!pt(e)||(oe.sessionId=e,oe.sessionUUID=V(),Ue({sessionStart:e}),lt({metricName:"Started new session:",data:{persistentData:oe,timeStone:Le}})),oe.lastEventTime=e},pt=e=>e-oe.lastEventTime>18e5;function mt(){return mt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},mt.apply(this,arguments)}const ft=e=>{var t;(e=>{switch(e.action){case f.click:Ie.ac+=1;break;case f.focus:Ie.af+=1;break;case f.hover:Ie.ah+=1;break;case f.move:Ie.am+=1;break;case f.scroll:Ie.al+=1;break;case f.search:Ie.ar+=1;break;case f.select:Ie.as+=1}})(t=e),t.event_type!==j?t.event_type===N&&((e=>{if(!e.session_rank)return;const t=e.session_rank;Object.values(h).forEach((e=>{Ie.sqs+=Ie[e]*Pe[e]})),Object.values(w).forEach((e=>{Ie.sqs+=Ie[e]*Me[e]})),Ie.sqs*=Be[t]})(t),Object.assign(t,Ie),De({ac:0,af:0,ah:0,al:0,am:0,ar:0,as:0,pv:0,sqs:0})):Ie.pv+=1;const n=e.event_type;delete e.event_type;const r=e.deviceId?e.deviceId:null,i=e.timestamp;return delete e.timestamp,se({eventId:oe.eventId+1}),se({sequenceNumber:oe.sequenceNumber+1}),dt(),st(),{device_id:H.deviceId||r||null,user_id:H.userId,timestamp:i,event_id:oe.eventId,session_id:oe.sessionId||-1,event_type:n,version_name:A.version||null,platform:W.amplitudePlatform,os_name:W.amplitudeOSName,os_version:W.amplitudeOSVersion,device_model:W.amplitudeDeviceModel,language:H.languageCode,event_properties:mt({},e,{session_uuid:oe.sessionUUID,height:W.height,width:W.width}),user_properties:X(),uuid:V(),library:{name:"@cbhq/client-analytics",version:"10.6.0"},sequence_number:oe.sequenceNumber,user_agent:W.userAgent||H.userAgent}},vt=e=>e.map((e=>ft(e)));function gt(){return gt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},gt.apply(this,arguments)}const bt=e=>e.map((e=>(e=>{const t=e.tags||{},n=gt({authed:J()?"true":"false",platform:A.platform},t,{project_name:A.projectName,version_name:A.version||null});return{metric_name:e.metricName,page_path:e.pagePath||null,value:e.value,tags:n,type:e.metricType}})(e))),ht=e=>0!==je.metricsQueue.length&&(je.metricsQueue.length>=A.batchMetricsThreshold||(je.metricsScheduled||(je.metricsScheduled=!0,setTimeout((()=>{je.metricsScheduled=!1,e(bt(je.metricsQueue)),je.metricsQueue=[]}),A.batchMetricsPeriod)),!1)),wt=e=>0!==je.tracesQueue.length&&(je.tracesQueue.length>=A.batchTracesThreshold||(je.tracesScheduled||(je.tracesScheduled=!0,setTimeout((()=>{je.tracesScheduled=!1,e(je.tracesQueue),je.tracesQueue=[]}),A.batchTracesPeriod)),!1)),yt=e=>{var t;z()&&null!=(t=window)&&t.requestIdleCallback?window.requestIdleCallback(e,{timeout:A.ricTimeoutScheduleEvent}):(q()||F())&&A.interactionManager?A.interactionManager.runAfterInteractions(e):e()};function Tt(){return Tt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Tt.apply(this,arguments)}const kt="application/x-www-form-urlencoded; charset=UTF-8",_t=e=>{const{data:t,importance:n,isJSON:r,onError:i,url:a}=e,o=r?"application/json":kt,s=n||l.low,c=r?JSON.stringify(t):new URLSearchParams(t).toString();function u(){const e=new XMLHttpRequest;e.open("POST",a,!0),Object.keys(A.headers||{}).forEach((t=>{e.setRequestHeader(t,A.headers[t])})),e.setRequestHeader("Content-Type",kt),H.jwt&&e.setRequestHeader("authorization",`Bearer ${H.jwt}`),e.send(c)}if(!z()||r||!("sendBeacon"in navigator)||s!==l.low||A.headers&&0!==Object.keys(A.headers).length)if(z()&&!r)u();else{const e=Tt({},A.headers,{"Content-Type":o});H.jwt&&(e.Authorization=`Bearer ${H.jwt}`),fetch(a,{method:"POST",mode:"no-cors",headers:e,body:c}).catch((e=>{i(e,{context:"AnalyticsSDKApiError"})}))}else{const e=new Blob([c],{type:kt});try{navigator.sendBeacon.bind(navigator)(a,e)||u()}catch(e){console.error(e),u()}}};var St=n(762),Et=n.n(St);const xt=(e,t,n)=>{const r=e||"";return Et()("2"+r+t+n)};function Ot(){return Ot=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Ot.apply(this,arguments)}class jt extends Error{constructor(e){super(e),this.name="CircularJsonReference",this.message=e,"function"==typeof Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error(e).stack}}class Nt extends jt{constructor(...e){super(...e),this.name="DomReferenceInAnalyticsEvent"}}function It(){return It=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},It.apply(this,arguments)}const Pt=(e,t=l.low)=>{var n;e&&je.eventsQueue.push(e),nt.isReady&&(!A.trackUserId||H.userId?(t===l.high||(n=Mt,0!==je.eventsQueue.length&&(je.eventsQueue.length>=A.batchEventsThreshold||(je.eventsScheduled||(je.eventsScheduled=!0,setTimeout((()=>{je.eventsScheduled=!1,n(vt(je.eventsQueue)),je.eventsQueue=[]}),A.batchEventsPeriod)),0))))&&Bt():je.eventsQueue.length>10&&(A.trackUserId=!1,A.onError(new Error("userId not set in Logged-in"))))},Mt=(e,t=l.low)=>{if(H.isOptOut||0===e.length)return;let n;try{n=JSON.stringify(e)}catch(t){const r=e.map((e=>e.event_type)).join(", "),[i,a]=(e=>{try{const n=[];for(const r of e){const e=Ot({},r);r.event_properties&&(e.event_properties=Ot({},e.event_properties,{currentTarget:null,target:null,relatedTarget:null,_dispatchInstances:null,_targetInst:null,view:(t=r.event_properties.view,["string","number","boolean"].includes(typeof t)?r.event_properties.view:null)})),n.push(e)}return[!0,JSON.stringify(n)]}catch(e){return[!1,""]}var t})(e);if(!i)return void A.onError(new jt(t instanceof Error?t.message:"unknown"),{listEventType:r});n=a,A.onError(new Nt("Found DOM element reference"),{listEventType:r,stringifiedEventData:n})}const r=Ae().toString(),i=It({},{e:n,v:"2",upload_time:r},{client:A.amplitudeApiKey,checksum:xt(A.amplitudeApiKey,n,r)});_t({url:A.eventsEndpoint,data:i,importance:t,onError:A.onError}),ut({metricName:"Batch Events",data:e,importance:t})},Bt=()=>{Mt(vt(je.eventsQueue)),Ne({eventsQueue:[]})};function Ct(){return Ct=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Ct.apply(this,arguments)}const Dt=Object.values(f),At=Object.values(m),Lt=e=>Dt.includes(e)?e:f.unknown,Ut=e=>At.includes(e)?e:m.unknown,Rt=(e,t,n)=>{const r={auth:J()?b.loggedIn:b.notLoggedIn,action:Lt(e),component_type:Ut(t),logging_id:n,platform:A.platform,project_name:A.projectName};return"number"==typeof H.userTypeEnum&&(r.user_type_enum=H.userTypeEnum),r},qt=e=>{const t=Ae();if(!e)return A.onError(new Error("missing logData")),Ct({},Rt(f.unknown,m.unknown),{locale:H.locale,session_lcc_id:H.session_lcc_id,timestamp:t,time_start:Le.timeStart});const n=Ct({},e,Rt(e.action,e.componentType,e.loggingId),{locale:H.locale,session_lcc_id:H.session_lcc_id,timestamp:t,time_start:Le.timeStart});return delete n.componentType,delete n.loggingId,n},Ft={blacklistRegex:[],isEnabled:!1};function zt(){return{page_key:re.pageKey,page_path:re.pagePath,prev_page_key:re.prevPageKey,prev_page_path:re.prevPagePath}}function Kt(e){Object.assign(Ft,e)}function $t(e,t,n=l.low){if(H.isOptOut)return;if(!Oe())return;const r=qt(t);!function(e){Ft.isEnabled&&(ve(),Object.assign(e,zt()))}(r),be(r),function(e){Object.keys(Se).length>0&&Object.assign(e,Se)}(r),r.has_double_fired=!1,r.event_type=e,n===l.high?Pt(r,n):yt((()=>{Pt(r)}))}function Qt(e,t=!1){t?_t({url:A.metricsEndPoint,data:{metrics:e},isJSON:!0,onError:A.onError}):yt((()=>{_t({url:A.metricsEndPoint,data:{metrics:e},isJSON:!0,onError:A.onError})})),ut({metricName:"Batch Metrics",data:e})}function Wt(){return Wt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Wt.apply(this,arguments)}function Ht(e){if(!Oe())return;v.server!==A.platform&&!e.pagePath&&re.pagePath&&(e.pagePath=re.pagePath);const t=Object.keys(Se).length?Wt({},e.tags,Se):e.tags;t&&Object.assign(e,{tags:t}),je.metricsQueue.push(e),ht(Qt)&&(Qt(bt(je.metricsQueue)),je.metricsQueue=[])}function Vt(){return Vt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Vt.apply(this,arguments)}let Jt=function(e){return e.instant="instant",e.quick="quick",e.moderate="moderate",e.slow="slow",e.unavoidable="unavoidable",e}({});function Xt(e){return e.toLowerCase()}let Gt={};const Zt=(e,t)=>{null!=A&&A.onMarkStep&&A.onMarkStep(e,t),xe({ujs:t})};let Yt;const en={Perfume:()=>{},markStep:e=>{},markStepOnce:e=>{},incrementUjNavigation:()=>{}},tn=()=>{z()&&Yt&&Yt.markNTBT&&Yt.markNTBT()},nn=e=>{z()&&Yt&&en.markStep&&en.markStep(e)},rn=e=>{z()&&Yt&&en.markStepOnce&&en.markStepOnce(e)},an=()=>{z()&&Yt&&en.incrementUjNavigation&&en.incrementUjNavigation()};function on(e={callMarkNTBT:!0}){"unknown"!==A.platform&&(Ft.blacklistRegex.some((e=>e.test(fe())))||($t(j,{action:f.render,componentType:m.page}),e.callMarkNTBT&&tn()))}let sn=!1,cn=!1;const un=e=>{sn=!e.persisted},ln=(e,t="hidden",n=!1)=>{cn||(addEventListener("pagehide",un),addEventListener("beforeunload",(()=>{})),cn=!0),addEventListener("visibilitychange",(({timeStamp:n})=>{document.visibilityState===t&&e({timeStamp:n,isUnloading:sn})}),{capture:!0,once:n})},dn=36e3;function pn(){const e=pt(Ae());if(e&&(O.forEach((e=>{oe[e]&&delete oe[e]})),st()),!oe.lastEventTime||!Le.sessionStart||!e)return;const t=Math.round((oe.lastEventTime-Le.sessionStart)/1e3);if(t<1||t>dn)return;const n=Ce(t);$t(N,{action:f.measurement,componentType:m.page,session_duration:t,session_end:oe.lastEventTime,session_start:Le.sessionStart,session_rank:n})}function mn(){return mn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},mn.apply(this,arguments)}const fn=[],vn=[],gn=()=>{const e=fn.shift();e&&e()},bn=()=>{const e=vn.shift();e&&e()};let hn={};function wn(e){const t=function(e){return{test_name:e.testName,group_name:e.group,subject_id:e.subjectId,exposed_at:Ae(),subject_type:e.subjectType,platform:A.platform}}(e);hn[e.testName]=hn[e.testName]||0,hn[e.testName]+k>Ae()?lt({metricName:`Event: exposeExperiment ${e.testName} not sent`,data:t}):(hn[e.testName]=Ae(),ot(E,hn),lt({metricName:`Event: exposeExperiment ${e.testName} sent`,data:t}),_t({url:A.exposureEndpoint,data:[t],onError:(t,n)=>{hn[e.testName]=0,ot(E,hn),A.onError(t,n)},isJSON:!0,importance:l.high}))}const yn=e=>{var t,r,i;U(e),z()&&(H.languageCode=(null==(t=navigator)?void 0:t.languages[0])||(null==(r=navigator)?void 0:r.language)||""),te(),(()=>{var e;if(z()&&null!=(e=window)&&e.indexedDB){const e=function(e,t,{blocked:n,upgrade:r,blocking:i,terminated:a}={}){const o=indexedDB.open(e,t),s=Je(o);return r&&o.addEventListener("upgradeneeded",(e=>{r(Je(o.result),e.oldVersion,e.newVersion,Je(o.transaction),e)})),n&&o.addEventListener("blocked",(e=>n(e.oldVersion,e.newVersion,e))),s.then((e=>{a&&e.addEventListener("close",(()=>a())),i&&e.addEventListener("versionchange",(e=>i(e.oldVersion,e.newVersion,e)))})).catch((()=>{})),s}("keyval-store",1,{upgrade(e){e.createObjectStore("keyval")}});rt({idbKeyval:{get:async t=>(await e).get("keyval",t),set:async(t,n)=>(await e).put("keyval",n,t),delete:async t=>(await e).delete("keyval",t),keys:async()=>(await e).getAllKeys("keyval")}})}else rt({idbKeyval:{get:async e=>new Promise((t=>{t(it[e])})),set:async(e,t)=>new Promise((n=>{it[e]=t,n(e)})),delete:async e=>new Promise((()=>{delete it[e]})),keys:async()=>new Promise((e=>{e(Object.keys(it))}))}})})(),lt({metricName:"Initialized Analytics:",data:{deviceId:H.deviceId}}),fn.push((()=>{Pt()})),(async()=>{const e=await at(S);rt({isReady:!0}),gn(),e&&(bn(),se({eventId:e.eventId||oe.eventId,sequenceNumber:e.sequenceNumber||oe.sequenceNumber,sessionId:e.sessionId||oe.sessionId,lastEventTime:e.lastEventTime||oe.lastEventTime,sessionUUID:e.sessionUUID||oe.sessionUUID}),function(e){se(mn({},function(e){const t={};return O.forEach((n=>{e[n]&&(t[n]=e[n])})),t}(e),de()))}(e),Ue({sessionStart:e.sessionStart||oe.sessionStart}),De({ac:e.ac||Ie.ac,af:e.af||Ie.af,ah:e.ah||Ie.ah,al:e.al||Ie.al,am:e.am||Ie.am,ar:e.ar||Ie.ar,as:e.as||Ie.as,pv:e.pv||Ie.pv}),A.trackUserId&&Y({userId:e.userId||H.userId}),pn(),lt({metricName:"Initialized Analytics IndexedDB:",data:e}))})(),async function(){at(E).then((e=>{hn=null!=e?e:{}})).catch((e=>{e instanceof Error&&A.onError(e)}))}(),Z(),z()&&(ln((()=>{se({lastEventTime:Ae()}),st(),Bt()}),"hidden"),ln((()=>{pn()}),"visible")),z()&&(i=()=>{var e,t,n,r;te(),ee({width:null!=(e=null==(t=window)?void 0:t.innerWidth)?e:null,height:null!=(n=null==(r=window)?void 0:r.innerHeight)?n:null})},addEventListener("resize",(()=>{requestAnimationFrame((()=>{i()}))}))),(()=>{if(z())try{const e=n(2);en.markStep=e.markStep,en.markStepOnce=e.markStepOnce,en.incrementUjNavigation=e.incrementUjNavigation,Yt=new e.Perfume({analyticsTracker:e=>{const{data:t,attribution:n,metricName:r,navigatorInformation:i,rating:a}=e,o=I[r],s=(null==n?void 0:n.category)||null;if(!o&&!s)return;const c=(null==i?void 0:i.deviceMemory)||0,u=(null==i?void 0:i.hardwareConcurrency)||0,l=(null==i?void 0:i.isLowEndDevice)||!1,p=(null==i?void 0:i.isLowEndExperience)||!1,v=(null==i?void 0:i.serviceWorkerStatus)||"unsupported",g=Vt({deviceMemory:c,hardwareConcurrency:u,isLowEndDevice:l,isLowEndExperience:p,serviceWorkerStatus:v},Gt),b={is_low_end_device:l,is_low_end_experience:p,page_key:re.pageKey||"",save_data:t.saveData||!1,service_worker:v,is_perf_metric:!0};if("navigationTiming"===r)t&&"number"==typeof t.redirectTime&&Ht({metricName:I.redirectTime.eventName,metricType:d.histogram,tags:b,value:t.redirectTime||0});else if("TTFB"===r)$t(o.eventName,Vt({action:f.measurement,componentType:m.page,duration:t||null,vitalsScore:a||null},g)),Ht({metricName:I.TTFB.eventName,metricType:d.histogram,tags:Vt({},b),value:t}),a&&Ht({metricName:`perf_web_vitals_ttfb_${a}`,metricType:d.count,tags:b,value:1});else if("networkInformation"===r)null!=t&&t.effectiveType&&(Gt=t,$t(o.eventName,{action:f.measurement,componentType:m.page,networkInformationDownlink:t.downlink,networkInformationEffectiveType:t.effectiveType,networkInformationRtt:t.rtt,networkInformationSaveData:t.saveData,navigatorDeviceMemory:c,navigatorHardwareConcurrency:u}));else if("storageEstimate"===r)$t(o.eventName,Vt({action:f.measurement,componentType:m.page},t,g)),Ht({metricName:"perf_storage_estimate_caches",metricType:d.histogram,tags:b,value:t.caches}),Ht({metricName:"perf_storage_estimate_indexed_db",metricType:d.histogram,tags:b,value:t.indexedDB});else if("CLS"===r)$t(o.eventName,Vt({action:f.measurement,componentType:m.page,score:100*t||null,vitalsScore:a||null},g)),a&&Ht({metricName:`perf_web_vitals_cls_${a}`,metricType:d.count,tags:b,value:1});else if("FID"===r){const e=(null==n?void 0:n.performanceEntry)||null,r=parseInt((null==e?void 0:e.processingStart)||"");$t(o.eventName,Vt({action:f.measurement,componentType:m.page,duration:t||null,processingStart:null!=e&&e.processingStart?r:null,startTime:null!=e&&e.startTime?parseInt(e.startTime):null,vitalsScore:a||null},g)),a&&Ht({metricName:`perf_web_vitals_fidVitals_${a}`,metricType:d.count,tags:b,value:1})}else"userJourneyStep"===r?($t("perf_user_journey_step",Vt({action:f.measurement,componentType:m.page,duration:t||null,rating:null!=a?a:null,step_name:(null==n?void 0:n.stepName)||""},g)),Ht({metricName:`user_journey_step.${A.projectName}.${A.platform}.${(null==n?void 0:n.stepName)||""}_vitals_${a}`,metricType:d.count,tags:b,value:1}),Ht({metricName:`user_journey_step.${A.projectName}.${A.platform}.${(null==n?void 0:n.stepName)||""}`,metricType:d.distribution,tags:b,value:t||null})):I[r]&&t&&($t(o.eventName,Vt({action:f.measurement,componentType:m.page,duration:t||null,vitalsScore:a||null},g)),a&&(Ht({metricName:`perf_web_vitals_${Xt(r)}_${a}`,metricType:d.count,tags:b,value:1}),"LCP"===r&&Ht({metricName:`perf_web_vitals_${Xt(r)}`,metricType:d.distribution,tags:b,value:t})))},maxMeasureTime:3e4,steps:A.steps,onMarkStep:Zt})}catch(e){e instanceof Error&&A.onError(e)}})()},Tn=e=>{Y(e),e.userAgent&&Z(),lt({metricName:"Identify:",data:{countryCode:H.countryCode,deviceId:H.deviceId,userId:H.userId}})},kn=({blacklistRegex:e,pageKeyRegex:t,browserHistory:n})=>{Kt({blacklistRegex:e||[],isEnabled:!0}),ae({pageKeyRegex:t}),on({callMarkNTBT:!1}),n.listen((()=>{on()}))},_n=({blacklistRegex:e,pageKeyRegex:t,nextJsRouter:n})=>{Kt({blacklistRegex:e||[],isEnabled:!0}),ae({pageKeyRegex:t}),on({callMarkNTBT:!1}),n.events.on("routeChangeComplete",(()=>{on()}))},Sn=()=>{Y({isOptOut:!0}),ot(S,{})},En=()=>{Y({isOptOut:!1})},xn={Button:{label:"cb_button",uuid:"e921a074-40e6-4371-8700-134d5cd633e6",componentType:m.button}};function On(e,t,n){return{componentName:e,actions:t,data:n}}function jn(){return jn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},jn.apply(this,arguments)}function Nn(e,t,n){const{componentName:r,data:i}=n;$t(e.label,jn({componentType:e.componentType,action:t,loggingId:e.uuid,component_name:r},i))}const In={actionMapping:{onPress:f.click,onHover:f.hover},handlers:{Button:{[f.click]:e=>Nn(xn.Button,f.click,e),[f.hover]:e=>Nn(xn.Button,f.hover,e)}}};function Pn(e,t=!1){t?_t({url:A.tracesEndpoint,data:{traces:e},isJSON:!0,onError:A.onError}):yt((()=>{_t({url:A.tracesEndpoint,data:{traces:e},isJSON:!0,onError:A.onError})})),ut({metricName:"Batch Traces",data:e})}function Mn(){return Mn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Mn.apply(this,arguments)}const Bn=1e6;function Cn(e){return e*Bn}function Dn(e=function(){var e;return null==(e=window)?void 0:e.crypto}()){const t=new Uint32Array(2);return null==e||e.getRandomValues(t),((BigInt(t[0])<<BigInt(32))+BigInt(t[1])).toString()}function An(e,t){return{"x-datadog-origin":"rum","x-datadog-parent-id":t,"x-datadog-sampling-priority":"1","x-datadog-trace-id":e}}function Ln(e){var t;const{name:n,traceId:r,spanId:i,start:a,duration:o,resource:s,meta:c}=e;return{duration:o?Cn(o):0,name:n,resource:s,service:A.projectName,span_id:null!=i?i:Dn(),start:a?Cn(a):0,trace_id:null!=r?r:Dn(),parent_id:P,type:M,meta:Mn({platform:A.platform},re.pageKey?{page_key:re.pageKey}:{},null!=(t=Se.ujs)&&t.length?{last_ujs:Se.ujs[Se.ujs.length-1]}:{},null!=c?c:{})}}function Un(e){return[Ln(e)]}function Rn(e,t){Oe()&&function(e){return e.length>0}(e)&&(t&&function(e,t){e.forEach((e=>function(e,t){const n=Mn({},e.meta,t.meta),r={start:t.start?Cn(t.start):e.start,duration:t.duration?Cn(t.duration):e.duration};Object.assign(e,t,Mn({meta:n},r))}(e,t)))}(e,t),je.tracesQueue.push(e),wt(Pn)&&(Pn(je.tracesQueue),je.tracesQueue=[]))}function qn(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}function Fn(){return Fn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Fn.apply(this,arguments)}function zn(){return void 0!==typeof window&&"performance"in window&&"mark"in performance&&"getEntriesByName"in performance}function Kn(e,t){return`perf_${e}${null!=t&&t.label?`_${t.label}`:""}`}function $n(e,t,n){return`${Kn(e,n)}__${t}`}let Qn={};function Wn(e,t,n){if(!zn())return;const r=$n(e,t,n);if(performance.mark(r),"end"===t){const t=Kn(e,n);!function(e,t,n){try{performance.measure(e,t,n)}catch(e){A.onError(e)}}(t,$n(e,"start",n),r);const i=performance.getEntriesByName(t).pop();i&&Ht(Fn({metricName:e,metricType:d.distribution,value:i.duration},null!=n&&n.tags?{tags:n.tags}:{}))}}function Hn(e,t){if(!zn())return;const n=$n(e,"start",t);Qn[n]||(Wn(e,"start",t),Qn[n]=!0)}function Vn(e,t){const n=$n(e,"start",t),r=function(e,t){if(null==e)return{};var n,r,i={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}(Qn,[n].map(qn));Qn=r}function Jn(e,t){if(!zn())return;const n=$n(e,"start",t);Qn[n]&&(Wn(e,"end",t),Vn(e,t))}function Xn(){zn()&&(performance.clearMarks(),Qn={})}var Gn=n(784);function Zn(){return Zn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Zn.apply(this,arguments)}function Yn(e,t,n=l.low){const r=(0,Gn.useRef)(t);return(0,Gn.useEffect)((()=>{r.current=t}),[t]),(0,Gn.useCallback)((t=>{$t(e,Zn({},r.current,t),n)}),[e,n])}function er(){return er=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},er.apply(this,arguments)}function tr(e,t,n=l.low){(0,Gn.useEffect)((()=>{const r=er({},t,{action:f.render});$t(e,r,n)}),[])}function nr(){return nr=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},nr.apply(this,arguments)}const rr=function(e,t){return{markStartPerf:(0,Gn.useCallback)((()=>Hn(e,t)),[e,t]),markEndPerf:(0,Gn.useCallback)((n=>Jn(e,nr({},t,n))),[e,t])}};function ir(){return ir=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ir.apply(this,arguments)}function ar(){return Object.entries(ir({},Se,zt(),{sessionUUID:oe.sessionUUID,userId:oe.userId})).reduce(((e,t)=>{return null!=(n=t[1])&&""!==n?ir({},e,{[t[0]]:t[1]}):e;var n}),{})}async function or(){return new Promise((e=>{Mt(vt(je.eventsQueue)),Qt(bt(je.metricsQueue),!0),Pn(je.tracesQueue,!0),Ne({eventsQueue:[],metricsQueue:[],tracesQueue:[]}),e()}))}function sr(){return{"X-CB-Device-ID":H.deviceId||"unknown","X-CB-Is-Logged-In":H.userId?"true":"false","X-CB-Pagekey":re.pageKey||"unknown","X-CB-UJS":(e=Se.ujs,void 0===e||0===e.length?"":e.join(",")),"X-CB-Platform":A.platform||"unknown","X-CB-Project-Name":A.projectName||"unknown","X-CB-Session-UUID":oe.sessionUUID||"unknown","X-CB-Version-Name":A.version?String(A.version):"unknown"};var e}})(),r})()}));',Au=()=>new Promise((e,t)=>{if(window.ClientAnalytics)return e();try{const n=document.createElement("script");n.textContent=_u,n.type="text/javascript",document.head.appendChild(n),Iu(),document.head.removeChild(n),e()}catch{console.error("Failed to execute inlined telemetry script"),t()}}),Iu=()=>{var e,t,n;if(typeof window<"u"){const r=(n=(e=E.config.get().deviceId)!==null&&e!==void 0?e:(t=window.crypto)===null||t===void 0?void 0:t.randomUUID())!==null&&n!==void 0?n:"";if(window.ClientAnalytics){const{init:i,identify:s,PlatformName:a}=window.ClientAnalytics;i({isProd:!0,amplitudeApiKey:"c66737ad47ec354ced777935b0af822e",platform:a.web,projectName:"base_account_sdk",showDebugLogging:!1,version:"1.0.0",apiEndpoint:"https://cca-lite.coinbase.com"}),s({deviceId:r}),E.config.set({deviceId:r})}}},G={rpc:{invalidInput:-32e3,resourceNotFound:-32001,resourceUnavailable:-32002,transactionRejected:-32003,methodNotSupported:-32004,limitExceeded:-32005,parse:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internal:-32603},provider:{userRejectedRequest:4001,unauthorized:4100,unsupportedMethod:4200,disconnected:4900,chainDisconnected:4901,unsupportedChain:4902}},Hn={"-32700":{standard:"JSON RPC 2.0",message:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."},"-32600":{standard:"JSON RPC 2.0",message:"The JSON sent is not a valid Request object."},"-32601":{standard:"JSON RPC 2.0",message:"The method does not exist / is not available."},"-32602":{standard:"JSON RPC 2.0",message:"Invalid method parameter(s)."},"-32603":{standard:"JSON RPC 2.0",message:"Internal JSON-RPC error."},"-32000":{standard:"EIP-1474",message:"Invalid input."},"-32001":{standard:"EIP-1474",message:"Resource not found."},"-32002":{standard:"EIP-1474",message:"Resource unavailable."},"-32003":{standard:"EIP-1474",message:"Transaction rejected."},"-32004":{standard:"EIP-1474",message:"Method not supported."},"-32005":{standard:"EIP-1474",message:"Request limit exceeded."},4001:{standard:"EIP-1193",message:"User rejected the request."},4100:{standard:"EIP-1193",message:"The requested account and/or method has not been authorized by the user."},4200:{standard:"EIP-1193",message:"The requested method is not supported by this Ethereum provider."},4900:{standard:"EIP-1193",message:"The provider is disconnected from all chains."},4901:{standard:"EIP-1193",message:"The provider is disconnected from the specified chain."},4902:{standard:"EIP-3085",message:"Unrecognized chain ID."}},Es="Unspecified error message.",Tu="Unspecified server error.";function ar(e,t=Es){if(e&&Number.isInteger(e)){const n=e.toString();if($n(Hn,n))return Hn[n].message;if(Ss(e))return Tu}return t}function Cu(e){if(!Number.isInteger(e))return!1;const t=e.toString();return!!(Hn[t]||Ss(e))}function Ou(e,{shouldIncludeStack:t=!1}={}){const n={};if(e&&typeof e=="object"&&!Array.isArray(e)&&$n(e,"code")&&Cu(e.code)){const r=e;n.code=r.code,r.message&&typeof r.message=="string"?(n.message=r.message,$n(r,"data")&&(n.data=r.data)):(n.message=ar(n.code),n.data={originalError:$r(e)})}else n.code=G.rpc.internal,n.message=qr(e,"message")?e.message:Es,n.data={originalError:$r(e)};return t&&(n.stack=qr(e,"stack")?e.stack:void 0),n}function Ss(e){return e>=-32099&&e<=-32e3}function $r(e){return e&&typeof e=="object"&&!Array.isArray(e)?Object.assign({},e):e}function $n(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function qr(e,t){return typeof e=="object"&&e!==null&&t in e&&typeof e[t]=="string"}const x={rpc:{parse:e=>me(G.rpc.parse,e),invalidRequest:e=>me(G.rpc.invalidRequest,e),invalidParams:e=>me(G.rpc.invalidParams,e),methodNotFound:e=>me(G.rpc.methodNotFound,e),internal:e=>me(G.rpc.internal,e),server:e=>{if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Ethereum RPC Server errors must provide single object argument.");const{code:t}=e;if(!Number.isInteger(t)||t>-32005||t<-32099)throw new Error('"code" must be an integer such that: -32099 <= code <= -32005');return me(t,e)},invalidInput:e=>me(G.rpc.invalidInput,e),resourceNotFound:e=>me(G.rpc.resourceNotFound,e),resourceUnavailable:e=>me(G.rpc.resourceUnavailable,e),transactionRejected:e=>me(G.rpc.transactionRejected,e),methodNotSupported:e=>me(G.rpc.methodNotSupported,e),limitExceeded:e=>me(G.rpc.limitExceeded,e)},provider:{userRejectedRequest:e=>ct(G.provider.userRejectedRequest,e),unauthorized:e=>ct(G.provider.unauthorized,e),unsupportedMethod:e=>ct(G.provider.unsupportedMethod,e),disconnected:e=>ct(G.provider.disconnected,e),chainDisconnected:e=>ct(G.provider.chainDisconnected,e),unsupportedChain:e=>ct(G.provider.unsupportedChain,e),custom:e=>{if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Ethereum Provider custom errors must provide single object argument.");const{code:t,message:n,data:r}=e;if(!n||typeof n!="string")throw new Error('"message" must be a nonempty string');return new As(t,n,r)}}};function me(e,t){const[n,r]=_s(t);return new or(e,n||ar(e),r)}function ct(e,t){const[n,r]=_s(t);return new As(e,n||ar(e),r)}function _s(e){if(e){if(typeof e=="string")return[e];if(typeof e=="object"&&!Array.isArray(e)){const{message:t,data:n}=e;if(t&&typeof t!="string")throw new Error("Must specify string message.");return[t||void 0,n]}}return[]}class or extends Error{constructor(t,n,r){if(!Number.isInteger(t))throw new Error('"code" must be an integer.');if(!n||typeof n!="string")throw new Error('"message" must be a nonempty string.');super(n),this.code=t,r!==void 0&&(this.data=r)}}class As extends or{constructor(t,n,r){if(!Pu(t))throw new Error('"code" must be an integer such that: 1000 <= code <= 4999');super(t,n,r)}}function Pu(e){return Number.isInteger(e)&&e>=1e3&&e<=4999}function zr(e){return typeof e=="object"&&e!==null&&"code"in e&&"data"in e&&e.code===-32090&&typeof e.data=="object"&&e.data!==null&&"type"in e.data&&e.data.type==="INSUFFICIENT_FUNDS"}function Is(e){return typeof e=="object"&&e!==null&&"details"in e}function Bu(e){try{const t=JSON.parse(e.details);return new or(t.code,t.message,t.data)}catch{return null}}function Ts(){return e=>e}const Nt=Ts(),Nu=Ts();function Ne(e){return Math.floor(e)}const Cs=/^[0-9]*$/,Os=/^[a-f0-9]*$/;function Ye(e){return cr(crypto.getRandomValues(new Uint8Array(e)))}function cr(e){return[...e].map(t=>t.toString(16).padStart(2,"0")).join("")}function tn(e){return new Uint8Array(e.match(/.{1,2}/g).map(t=>Number.parseInt(t,16)))}function Ct(e,t=!1){const n=e.toString("hex");return Nt(t?`0x${n}`:n)}function _n(e){return Ct(zn(e),!0)}function Se(e){return Nu(e.toString(10))}function dt(e){return Nt(`0x${BigInt(e).toString(16)}`)}function Ps(e){return e.startsWith("0x")||e.startsWith("0X")}function ur(e){return Ps(e)?e.slice(2):e}function Bs(e){return Ps(e)?`0x${e.slice(2)}`:`0x${e}`}function hn(e){if(typeof e!="string")return!1;const t=ur(e).toLowerCase();return Os.test(t)}function qn(e,t=!1){if(typeof e=="string"){const n=ur(e).toLowerCase();if(Os.test(n))return Nt(t?`0x${n}`:n)}throw x.rpc.invalidParams(`"${String(e)}" is not a hexadecimal string`)}function lr(e,t=!1){let n=qn(e,!1);return n.length%2===1&&(n=Nt(`0${n}`)),t?Nt(`0x${n}`):n}function qe(e){if(typeof e=="string"){const t=ur(e).toLowerCase();if(hn(t)&&t.length===40)return Bs(t)}throw x.rpc.invalidParams(`Invalid Ethereum address: ${String(e)}`)}function zn(e){if(Buffer.isBuffer(e))return e;if(typeof e=="string"){if(hn(e)){const t=lr(e,!1);return Buffer.from(t,"hex")}return Buffer.from(e,"utf8")}throw x.rpc.invalidParams(`Not binary data: ${String(e)}`)}function Ot(e){if(typeof e=="number"&&Number.isInteger(e))return Ne(e);if(typeof e=="string"){if(Cs.test(e))return Ne(Number(e));if(hn(e))return Ne(Number(BigInt(lr(e,!0))))}throw x.rpc.invalidParams(`Not an integer: ${String(e)}`)}function Et(e){if(e!==null&&(typeof e=="bigint"||ju(e)))return BigInt(e.toString(10));if(typeof e=="number")return BigInt(Ot(e));if(typeof e=="string"){if(Cs.test(e))return BigInt(e);if(hn(e))return BigInt(lr(e,!0))}throw x.rpc.invalidParams(`Not an integer: ${String(e)}`)}function Mu(e){if(typeof e=="string")return JSON.parse(e);if(typeof e=="object")return e;throw x.rpc.invalidParams(`Not a JSON string or an object: ${String(e)}`)}function ju(e){if(e==null||typeof e.constructor!="function")return!1;const{constructor:t}=e;return typeof t.config=="function"&&typeof t.EUCLID=="number"}const Lu=`Coinbase Wallet SDK requires the Cross-Origin-Opener-Policy header to not be set to 'same-origin'. This is to ensure that the SDK can communicate with the Coinbase Smart Wallet app.
3
3
 
4
4
  Please see https://www.smartwallet.dev/guides/tips/popup-tips#cross-origin-opener-policy for more information.`,Ru=()=>{let e;return{getCrossOriginOpenerPolicy:()=>e===void 0?"undefined":e,checkCrossOriginOpenerPolicy:async()=>{if(typeof window>"u"){e="non-browser-env";return}try{const t=`${window.location.origin}${window.location.pathname}`,n=await fetch(t,{method:"HEAD"});if(!n.ok)throw new Error(`HTTP error! status: ${n.status}`);const r=n.headers.get("Cross-Origin-Opener-Policy");e=r??"null",e==="same-origin"&&console.error(Lu)}catch(t){console.error("Error checking Cross-Origin-Opener-Policy:",t.message),e="error"}}}},{checkCrossOriginOpenerPolicy:Du,getCrossOriginOpenerPolicy:Uu}=Ru();async function Pt(e,t){const n=Object.assign(Object.assign({},e),{jsonrpc:"2.0",id:crypto.randomUUID()}),r=await window.fetch(t,{method:"POST",body:JSON.stringify(n),mode:"cors",headers:{"Content-Type":"application/json","X-Cbw-Sdk-Version":kt,"X-Cbw-Sdk-Platform":xs}}),{result:i,error:s}=await r.json();if(s)throw s;return i}function Hu(){return globalThis.coinbaseWalletExtension}function $u(){var e,t;try{const n=globalThis;return(e=n.ethereum)!==null&&e!==void 0?e:(t=n.top)===null||t===void 0?void 0:t.ethereum}catch{return}}function qu({metadata:e,preference:t}){var n,r;const{appName:i,appLogoUrl:s,appChainIds:a}=e;if(t.options!=="smartWalletOnly"){const c=Hu();if(c)return(n=c.setAppInfo)===null||n===void 0||n.call(c,i,s,a,t),c}const o=$u();if(o?.isCoinbaseBrowser)return(r=o.setAppInfo)===null||r===void 0||r.call(o,i,s,a,t),o}function zu(e){if(!e||typeof e!="object"||Array.isArray(e))throw x.rpc.invalidParams({message:"Expected a single, non-array, object argument.",data:e});const{method:t,params:n}=e;if(typeof t!="string"||t.length===0)throw x.rpc.invalidParams({message:"'args.method' must be a non-empty string.",data:e});if(n!==void 0&&!Array.isArray(n)&&(typeof n!="object"||n===null))throw x.rpc.invalidParams({message:"'args.params' must be an object or array if provided.",data:e});switch(t){case"eth_sign":case"eth_signTypedData_v2":case"eth_subscribe":case"eth_unsubscribe":throw x.provider.unsupportedMethod()}}function Wu(e){if(e){if(!["all","smartWalletOnly","eoaOnly"].includes(e.options))throw new Error(`Invalid options: ${e.options}`);if(e.attribution&&e.attribution.auto!==void 0&&e.attribution.dataSuffix!==void 0)throw new Error("Attribution cannot contain both auto and dataSuffix properties");if(e.telemetry&&typeof e.telemetry!="boolean")throw new Error("Telemetry must be a boolean")}}function Wr(e){if(typeof e!="function")throw new Error("toAccount is not a function")}const Fu="https://keys.coinbase.com/connect",Ns="https://rpc.wallet.coinbase.com",Fr="https://www.walletlink.org",Ku="https://go.cb-w.com/walletlink";var j;(function(e){e.unknown="unknown",e.banner="banner",e.button="button",e.card="card",e.chart="chart",e.content_script="content_script",e.dropdown="dropdown",e.link="link",e.page="page",e.modal="modal",e.table="table",e.search_bar="search_bar",e.service_worker="service_worker",e.text="text",e.text_input="text_input",e.tray="tray",e.checkbox="checkbox",e.icon="icon"})(j||(j={}));var L;(function(e){e.unknown="unknown",e.blur="blur",e.click="click",e.change="change",e.dismiss="dismiss",e.focus="focus",e.hover="hover",e.select="select",e.measurement="measurement",e.move="move",e.process="process",e.render="render",e.scroll="scroll",e.view="view",e.search="search",e.keyPress="keyPress",e.error="error"})(L||(L={}));var R;(function(e){e.low="low",e.high="high"})(R||(R={}));function U(e,t,n){var r,i,s,a;window.ClientAnalytics&&((r=window.ClientAnalytics)===null||r===void 0||r.logEvent(e,Object.assign(Object.assign({},t),{sdkVersion:kt,appName:(s=(i=E.config.get().metadata)===null||i===void 0?void 0:i.appName)!==null&&s!==void 0?s:"",appOrigin:window.location.origin,appPreferredSigner:(a=E.config.get().preference)===null||a===void 0?void 0:a.options}),n))}const Vu=()=>{U("communicator.popup_setup.started",{action:L.unknown,componentType:j.unknown},R.high)},Gu=()=>{U("communicator.popup_setup.completed",{action:L.unknown,componentType:j.unknown},R.high)},Zu=()=>{U("communicator.popup_unload.received",{action:L.unknown,componentType:j.unknown},R.high)},dr=({snackbarContext:e})=>{U(`snackbar.${e}.shown`,{action:L.render,componentType:j.modal,snackbarContext:e},R.high)},pt=({snackbarContext:e,snackbarAction:t})=>{U(`snackbar.${e}.action_clicked`,{action:L.click,componentType:j.button,snackbarContext:e,snackbarAction:t},R.high)},Yu='@namespace svg "http://www.w3.org/2000/svg";.-cbwsdk-css-reset,.-cbwsdk-css-reset *{animation:none;animation-delay:0;animation-direction:normal;animation-duration:0;animation-fill-mode:none;animation-iteration-count:1;animation-name:none;animation-play-state:running;animation-timing-function:ease;backface-visibility:visible;background:0;background-attachment:scroll;background-clip:border-box;background-color:rgba(0,0,0,0);background-image:none;background-origin:padding-box;background-position:0 0;background-position-x:0;background-position-y:0;background-repeat:repeat;background-size:auto auto;border:0;border-style:none;border-width:medium;border-color:inherit;border-bottom:0;border-bottom-color:inherit;border-bottom-left-radius:0;border-bottom-right-radius:0;border-bottom-style:none;border-bottom-width:medium;border-collapse:separate;border-image:none;border-left:0;border-left-color:inherit;border-left-style:none;border-left-width:medium;border-radius:0;border-right:0;border-right-color:inherit;border-right-style:none;border-right-width:medium;border-spacing:0;border-top:0;border-top-color:inherit;border-top-left-radius:0;border-top-right-radius:0;border-top-style:none;border-top-width:medium;box-shadow:none;box-sizing:border-box;caption-side:top;clear:none;clip:auto;color:inherit;columns:auto;column-count:auto;column-fill:balance;column-gap:normal;column-rule:medium none currentColor;column-rule-color:currentColor;column-rule-style:none;column-rule-width:none;column-span:1;column-width:auto;counter-increment:none;counter-reset:none;direction:ltr;empty-cells:show;float:none;font:normal;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif;font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;height:auto;hyphens:none;letter-spacing:normal;line-height:normal;list-style:none;list-style-image:none;list-style-position:outside;list-style-type:disc;margin:0;margin-bottom:0;margin-left:0;margin-right:0;margin-top:0;opacity:1;orphans:0;outline:0;outline-color:invert;outline-style:none;outline-width:medium;overflow:visible;overflow-x:visible;overflow-y:visible;padding:0;padding-bottom:0;padding-left:0;padding-right:0;padding-top:0;page-break-after:auto;page-break-before:auto;page-break-inside:auto;perspective:none;perspective-origin:50% 50%;pointer-events:auto;position:static;quotes:"\\201C" "\\201D" "\\2018" "\\2019";tab-size:8;table-layout:auto;text-align:inherit;text-align-last:auto;text-decoration:none;text-decoration-color:inherit;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-shadow:none;text-transform:none;transform:none;transform-style:flat;transition:none;transition-delay:0s;transition-duration:0s;transition-property:none;transition-timing-function:ease;unicode-bidi:normal;vertical-align:baseline;visibility:visible;white-space:normal;widows:0;word-spacing:normal;z-index:auto}.-cbwsdk-css-reset strong{font-weight:bold}.-cbwsdk-css-reset *{box-sizing:border-box;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif;line-height:1}.-cbwsdk-css-reset [class*=container]{margin:0;padding:0}.-cbwsdk-css-reset style{display:none}';function Ms(){const e=document.createElement("style");e.type="text/css",e.appendChild(document.createTextNode(Yu)),document.documentElement.appendChild(e)}function Ju(){try{return window.frameElement!==null}catch{return!1}}function Qu(){try{return Ju()&&window.top?window.top.location:window.location}catch{return window.location}}function Xu(){var e;return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test((e=window?.navigator)===null||e===void 0?void 0:e.userAgent)}function js(){var e,t;return(t=(e=window?.matchMedia)===null||e===void 0?void 0:e.call(window,"(prefers-color-scheme: dark)").matches)!==null&&t!==void 0?t:!1}const el=".-cbwsdk-css-reset .-gear-container{margin-left:16px !important;margin-right:9px !important;display:flex;align-items:center;justify-content:center;width:24px;height:24px;transition:opacity .25s}.-cbwsdk-css-reset .-gear-container *{user-select:none}.-cbwsdk-css-reset .-gear-container svg{opacity:0;position:absolute}.-cbwsdk-css-reset .-gear-icon{height:12px;width:12px;z-index:10000}.-cbwsdk-css-reset .-cbwsdk-snackbar{align-items:flex-end;display:flex;flex-direction:column;position:fixed;right:0;top:0;z-index:2147483647}.-cbwsdk-css-reset .-cbwsdk-snackbar *{user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance{display:flex;flex-direction:column;margin:8px 16px 0 16px;overflow:visible;text-align:left;transform:translateX(0);transition:opacity .25s,transform .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header:hover .-gear-container svg{opacity:1}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header{display:flex;align-items:center;background:#fff;overflow:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-cblogo{margin:8px 8px 8px 8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-message{color:#000;font-size:13px;line-height:1.5;user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu{background:#fff;transition:opacity .25s ease-in-out,transform .25s linear,visibility 0s;visibility:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;opacity:0;flex-direction:column;padding-left:8px;padding-right:8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:last-child{margin-bottom:8px !important}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover{background:#f5f7f8;border-radius:6px;transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover span{color:#050f19;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover svg path{fill:#000;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item{visibility:inherit;height:35px;margin-top:8px;margin-bottom:0;display:flex;flex-direction:row;align-items:center;padding:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item *{visibility:inherit;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover{background:rgba(223,95,103,.2);transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover svg path{fill:#df5f67;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover span{color:#df5f67;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-info{color:#aaa;font-size:13px;margin:0 8px 0 32px;position:absolute}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-hidden{opacity:0;text-align:left;transform:translateX(25%);transition:opacity .5s linear}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-expanded .-cbwsdk-snackbar-instance-menu{opacity:1;display:flex;transform:translateY(8px);visibility:visible}",tl="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEuNDkyIDEwLjQxOWE4LjkzIDguOTMgMCAwMTguOTMtOC45M2gxMS4xNjNhOC45MyA4LjkzIDAgMDE4LjkzIDguOTN2MTEuMTYzYTguOTMgOC45MyAwIDAxLTguOTMgOC45M0gxMC40MjJhOC45MyA4LjkzIDAgMDEtOC45My04LjkzVjEwLjQxOXoiIGZpbGw9IiMxNjUyRjAiLz48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTEwLjQxOSAwSDIxLjU4QzI3LjMzNSAwIDMyIDQuNjY1IDMyIDEwLjQxOVYyMS41OEMzMiAyNy4zMzUgMjcuMzM1IDMyIDIxLjU4MSAzMkgxMC40MkM0LjY2NSAzMiAwIDI3LjMzNSAwIDIxLjU4MVYxMC40MkMwIDQuNjY1IDQuNjY1IDAgMTAuNDE5IDB6bTAgMS40ODhhOC45MyA4LjkzIDAgMDAtOC45MyA4LjkzdjExLjE2M2E4LjkzIDguOTMgMCAwMDguOTMgOC45M0gyMS41OGE4LjkzIDguOTMgMCAwMDguOTMtOC45M1YxMC40MmE4LjkzIDguOTMgMCAwMC04LjkzLTguOTNIMTAuNDJ6IiBmaWxsPSIjZmZmIi8+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xNS45OTggMjYuMDQ5Yy01LjU0OSAwLTEwLjA0Ny00LjQ5OC0xMC4wNDctMTAuMDQ3IDAtNS41NDggNC40OTgtMTAuMDQ2IDEwLjA0Ny0xMC4wNDYgNS41NDggMCAxMC4wNDYgNC40OTggMTAuMDQ2IDEwLjA0NiAwIDUuNTQ5LTQuNDk4IDEwLjA0Ny0xMC4wNDYgMTAuMDQ3eiIgZmlsbD0iI2ZmZiIvPjxwYXRoIGQ9Ik0xMi43NjIgMTQuMjU0YzAtLjgyMi42NjctMS40ODkgMS40ODktMS40ODloMy40OTdjLjgyMiAwIDEuNDg4LjY2NiAxLjQ4OCAxLjQ4OXYzLjQ5N2MwIC44MjItLjY2NiAxLjQ4OC0xLjQ4OCAxLjQ4OGgtMy40OTdhMS40ODggMS40ODggMCAwMS0xLjQ4OS0xLjQ4OHYtMy40OTh6IiBmaWxsPSIjMTY1MkYwIi8+PC9zdmc+",nl="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iMTIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEyIDYuNzV2LTEuNWwtMS43Mi0uNTdjLS4wOC0uMjctLjE5LS41Mi0uMzItLjc3bC44MS0xLjYyLTEuMDYtMS4wNi0xLjYyLjgxYy0uMjQtLjEzLS41LS4yNC0uNzctLjMyTDYuNzUgMGgtMS41bC0uNTcgMS43MmMtLjI3LjA4LS41My4xOS0uNzcuMzJsLTEuNjItLjgxLTEuMDYgMS4wNi44MSAxLjYyYy0uMTMuMjQtLjI0LjUtLjMyLjc3TDAgNS4yNXYxLjVsMS43Mi41N2MuMDguMjcuMTkuNTMuMzIuNzdsLS44MSAxLjYyIDEuMDYgMS4wNiAxLjYyLS44MWMuMjQuMTMuNS4yMy43Ny4zMkw1LjI1IDEyaDEuNWwuNTctMS43MmMuMjctLjA4LjUyLS4xOS43Ny0uMzJsMS42Mi44MSAxLjA2LTEuMDYtLjgxLTEuNjJjLjEzLS4yNC4yMy0uNS4zMi0uNzdMMTIgNi43NXpNNiA4LjVhMi41IDIuNSAwIDAxMC01IDIuNSAyLjUgMCAwMTAgNXoiIGZpbGw9IiMwNTBGMTkiLz48L3N2Zz4=";class Ls{constructor(){this.items=new Map,this.nextItemKey=0,this.root=null,this.darkMode=js()}attach(t){this.root=document.createElement("div"),this.root.className="-cbwsdk-snackbar-root",t.appendChild(this.root),this.render()}presentItem(t){const n=this.nextItemKey++;return this.items.set(n,t),this.render(),()=>{this.items.delete(n),this.render()}}clear(){this.items.clear(),this.render()}render(){this.root&&Mn(q("div",null,q(Rs,{darkMode:this.darkMode},Array.from(this.items.entries()).map(([t,n])=>q(rl,Object.assign({},n,{key:t}))))),this.root)}}const Rs=e=>q("div",{class:Tt("-cbwsdk-snackbar-container")},q("style",null,el),q("div",{class:"-cbwsdk-snackbar"},e.children)),rl=({autoExpand:e,message:t,menuItems:n})=>{const[r,i]=wr(!0),[s,a]=wr(e??!1);to(()=>{const c=[window.setTimeout(()=>{i(!1)},1),window.setTimeout(()=>{a(!0)},1e4)];return()=>{c.forEach(window.clearTimeout)}});const o=()=>{a(!s)};return q("div",{class:Tt("-cbwsdk-snackbar-instance",r&&"-cbwsdk-snackbar-instance-hidden",s&&"-cbwsdk-snackbar-instance-expanded")},q("div",{class:"-cbwsdk-snackbar-instance-header",onClick:o},q("img",{src:tl,class:"-cbwsdk-snackbar-instance-header-cblogo"})," ",q("div",{class:"-cbwsdk-snackbar-instance-header-message"},t),q("div",{class:"-gear-container"},!s&&q("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},q("circle",{cx:"12",cy:"12",r:"12",fill:"#F5F7F8"})),q("img",{src:nl,class:"-gear-icon",title:"Expand"}))),n&&n.length>0&&q("div",{class:"-cbwsdk-snackbar-instance-menu"},n.map((c,u)=>q("div",{class:Tt("-cbwsdk-snackbar-instance-menu-item",c.isRed&&"-cbwsdk-snackbar-instance-menu-item-is-red"),onClick:c.onClick,key:u},q("svg",{width:c.svgWidth,height:c.svgHeight,viewBox:"0 0 10 11",fill:"none",xmlns:"http://www.w3.org/2000/svg"},q("path",{"fill-rule":c.defaultFillRule,"clip-rule":c.defaultClipRule,d:c.path,fill:"#AAAAAA"})),q("span",{class:Tt("-cbwsdk-snackbar-instance-menu-item-info",c.isRed&&"-cbwsdk-snackbar-instance-menu-item-info-is-red")},c.info)))))},Ds="M5.00008 0.96875C6.73133 0.96875 8.23758 1.94375 9.00008 3.375L10.0001 2.375V5.5H9.53133H7.96883H6.87508L7.80633 4.56875C7.41258 3.3875 6.31258 2.53125 5.00008 2.53125C3.76258 2.53125 2.70633 3.2875 2.25633 4.36875L0.812576 3.76875C1.50008 2.125 3.11258 0.96875 5.00008 0.96875ZM2.19375 6.43125C2.5875 7.6125 3.6875 8.46875 5 8.46875C6.2375 8.46875 7.29375 7.7125 7.74375 6.63125L9.1875 7.23125C8.5 8.875 6.8875 10.0312 5 10.0312C3.26875 10.0312 1.7625 9.05625 1 7.625L0 8.625V5.5H0.46875H2.03125H3.125L2.19375 6.43125Z";class il{constructor(){this.attached=!1,this.snackbar=new Ls}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");const t=document.documentElement,n=document.createElement("div");n.className="-cbwsdk-css-reset",t.appendChild(n),this.snackbar.attach(n),this.attached=!0,Ms()}showConnecting(t){let n;return t.isUnlinkedErrorState?n={autoExpand:!0,message:"Connection lost",menuItems:[{isRed:!1,info:"Reset connection",svgWidth:"10",svgHeight:"11",path:"M5.00008 0.96875C6.73133 0.96875 8.23758 1.94375 9.00008 3.375L10.0001 2.375V5.5H9.53133H7.96883H6.87508L7.80633 4.56875C7.41258 3.3875 6.31258 2.53125 5.00008 2.53125C3.76258 2.53125 2.70633 3.2875 2.25633 4.36875L0.812576 3.76875C1.50008 2.125 3.11258 0.96875 5.00008 0.96875ZM2.19375 6.43125C2.5875 7.6125 3.6875 8.46875 5 8.46875C6.2375 8.46875 7.29375 7.7125 7.74375 6.63125L9.1875 7.23125C8.5 8.875 6.8875 10.0312 5 10.0312C3.26875 10.0312 1.7625 9.05625 1 7.625L0 8.625V5.5H0.46875H2.03125H3.125L2.19375 6.43125Z",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:t.onResetConnection}]}:n={message:"Confirm on phone",menuItems:[{isRed:!0,info:"Cancel transaction",svgWidth:"11",svgHeight:"11",path:"M10.3711 1.52346L9.21775 0.370117L5.37109 4.21022L1.52444 0.370117L0.371094 1.52346L4.2112 5.37012L0.371094 9.21677L1.52444 10.3701L5.37109 6.53001L9.21775 10.3701L10.3711 9.21677L6.53099 5.37012L10.3711 1.52346Z",defaultFillRule:"inherit",defaultClipRule:"inherit",onClick:t.onCancel},{isRed:!1,info:"Reset connection",svgWidth:"10",svgHeight:"11",path:Ds,defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:t.onResetConnection}]},this.snackbar.presentItem(n)}}const Kr=420,Vr=700,sl={isRed:!1,info:"Retry",svgWidth:"10",svgHeight:"11",path:Ds,defaultFillRule:"evenodd",defaultClipRule:"evenodd"},al="Popup was blocked. Try again.";let Ft=null;function ol(e){const t=(window.innerWidth-Kr)/2+window.screenX,n=(window.innerHeight-Vr)/2+window.screenY;ul(e);function r(){const s=`wallet_${crypto.randomUUID()}`,a=window.open(e,s,`width=${Kr}, height=${Vr}, left=${t}, top=${n}`);return a?.focus(),a||null}let i=r();if(!i){const s=fr();return new Promise((a,o)=>{dr({snackbarContext:"popup_blocked"}),s.presentItem({autoExpand:!0,message:al,menuItems:[Object.assign(Object.assign({},sl),{onClick:()=>{pt({snackbarContext:"popup_blocked",snackbarAction:"confirm"}),i=r(),i?a(i):o(x.rpc.internal("Popup window was blocked")),s.clear()}})]})})}return Promise.resolve(i)}function cl(e){e&&!e.closed&&e.close()}function ul(e){const t={sdkName:xs,sdkVersion:kt,origin:window.location.origin,coop:Uu()};for(const[n,r]of Object.entries(t))e.searchParams.has(n)||e.searchParams.append(n,r.toString())}function fr(){if(!Ft){const e=document.createElement("div");e.className="-cbwsdk-css-reset",document.body.appendChild(e),Ft=new Ls,Ft.attach(e)}return Ft}class ll{constructor({url:t=Fu,metadata:n,preference:r}){this.popup=null,this.listeners=new Map,this.postMessage=async i=>{(await this.waitForPopupLoaded()).postMessage(i,this.url.origin)},this.postRequestAndWaitForResponse=async i=>{const s=this.onMessage(({requestId:a})=>a===i.id);return this.postMessage(i),await s},this.onMessage=async i=>new Promise((s,a)=>{const o=c=>{if(c.origin!==this.url.origin)return;const u=c.data;i(u)&&(s(u),window.removeEventListener("message",o),this.listeners.delete(o))};window.addEventListener("message",o),this.listeners.set(o,{reject:a})}),this.disconnect=()=>{cl(this.popup),this.popup=null,this.listeners.forEach(({reject:i},s)=>{i(x.provider.userRejectedRequest("Request rejected")),window.removeEventListener("message",s)}),this.listeners.clear()},this.waitForPopupLoaded=async()=>this.popup&&!this.popup.closed?(this.popup.focus(),this.popup):(Vu(),this.popup=await ol(this.url),this.onMessage(({event:i})=>i==="PopupUnload").then(()=>{this.disconnect(),Zu()}).catch(()=>{}),this.onMessage(({event:i})=>i==="PopupLoaded").then(i=>{this.postMessage({requestId:i.id,data:{version:kt,metadata:this.metadata,preference:this.preference,location:window.location.toString()}})}).then(()=>{if(!this.popup)throw x.rpc.internal();return Gu(),this.popup})),this.url=new URL(t),this.metadata=n,this.preference=r}}function ne(e){return e.errorMessage!==void 0}function dl(e){const t=Ou(fl(e),{shouldIncludeStack:!0}),n=new URL("https://docs.cloud.coinbase.com/wallet-sdk/docs/errors");return n.searchParams.set("version",kt),n.searchParams.set("code",t.code.toString()),n.searchParams.set("message",t.message),Object.assign(Object.assign({},t),{docUrl:n.href})}function fl(e){var t;if(typeof e=="string")return{message:e,code:G.rpc.internal};if(ne(e)){const n=e.errorMessage,r=(t=e.errorCode)!==null&&t!==void 0?t:n.match(/(denied|rejected)/i)?G.provider.userRejectedRequest:void 0;return Object.assign(Object.assign({},e),{message:n,code:r,data:{method:e.method}})}return e}class hl extends no{}class nt{constructor(t,n){this.scope=t,this.module=n}storeObject(t,n){this.setItem(t,JSON.stringify(n))}loadObject(t){const n=this.getItem(t);return n?JSON.parse(n):void 0}setItem(t,n){localStorage.setItem(this.scopedKey(t),n)}getItem(t){return localStorage.getItem(this.scopedKey(t))}removeItem(t){localStorage.removeItem(this.scopedKey(t))}clear(){const t=this.scopedKey(""),n=[];for(let r=0;r<localStorage.length;r++){const i=localStorage.key(r);typeof i=="string"&&i.startsWith(t)&&n.push(i)}n.forEach(r=>localStorage.removeItem(r))}scopedKey(t){return`-${this.scope}${this.module?`:${this.module}`:""}:${t}`}static clearAll(){new nt("CBWSDK").clear(),new nt("walletlink").clear()}}const pl=({signerType:e})=>{U("provider.signer.loaded_from_storage",{action:L.measurement,componentType:j.unknown,signerType:e},R.low)},ml=({method:e,correlationId:t})=>{U("provider.request.started",{action:L.unknown,componentType:j.unknown,method:e,correlationId:t},R.high)},bl=({method:e,correlationId:t,signerType:n,errorMessage:r})=>{U("provider.request.error",{action:L.error,componentType:j.unknown,method:e,signerType:n,correlationId:t,errorMessage:r},R.high)},gl=({method:e,signerType:t,correlationId:n})=>{U("provider.request.responded",{action:L.unknown,componentType:j.unknown,method:e,signerType:t,correlationId:n},R.high)},yl=()=>{U("provider.enable_function.called",{action:L.measurement,componentType:j.unknown},R.high)},wl=()=>{U("signer.selection.requested",{action:L.unknown,componentType:j.unknown},R.high)},vl=e=>{U("signer.selection.responded",{action:L.unknown,componentType:j.unknown,signerType:e},R.high)},Kt=Gn(()=>({correlationIds:new Map})),ve={get:e=>Kt.getState().correlationIds.get(e),set:(e,t)=>{Kt.setState(n=>{const r=new Map(n.correlationIds);return r.set(e,t),{correlationIds:r}})},delete:e=>{Kt.setState(t=>{const n=new Map(t.correlationIds);return n.delete(e),{correlationIds:n}})},clear:()=>{Kt.setState({correlationIds:new Map})}},xl=({method:e,correlationId:t})=>{var n;U("scw_signer.handshake.started",{action:L.unknown,componentType:j.unknown,method:e,correlationId:t,enableAutoSubAccounts:(n=E.subAccountsConfig.get())===null||n===void 0?void 0:n.enableAutoSubAccounts},R.high)},kl=({method:e,correlationId:t,errorMessage:n})=>{var r;U("scw_signer.handshake.error",{action:L.error,componentType:j.unknown,method:e,correlationId:t,errorMessage:n,enableAutoSubAccounts:(r=E.subAccountsConfig.get())===null||r===void 0?void 0:r.enableAutoSubAccounts},R.high)},El=({method:e,correlationId:t})=>{var n;U("scw_signer.handshake.completed",{action:L.unknown,componentType:j.unknown,method:e,correlationId:t,enableAutoSubAccounts:(n=E.subAccountsConfig.get())===null||n===void 0?void 0:n.enableAutoSubAccounts},R.high)},Sl=({method:e,correlationId:t})=>{var n;U("scw_signer.request.started",{action:L.unknown,componentType:j.unknown,method:e,correlationId:t,enableAutoSubAccounts:(n=E.subAccountsConfig.get())===null||n===void 0?void 0:n.enableAutoSubAccounts},R.high)},_l=({method:e,correlationId:t,errorMessage:n})=>{var r;U("scw_signer.request.error",{action:L.error,componentType:j.unknown,method:e,correlationId:t,errorMessage:n,enableAutoSubAccounts:(r=E.subAccountsConfig.get())===null||r===void 0?void 0:r.enableAutoSubAccounts},R.high)},Al=({method:e,correlationId:t})=>{var n;U("scw_signer.request.completed",{action:L.unknown,componentType:j.unknown,method:e,correlationId:t,enableAutoSubAccounts:(n=E.subAccountsConfig.get())===null||n===void 0?void 0:n.enableAutoSubAccounts},R.high)},Il=({method:e,correlationId:t})=>{var n;U("scw_sub_account.request.started",{action:L.unknown,componentType:j.unknown,method:e,correlationId:t,enableAutoSubAccounts:(n=E.subAccountsConfig.get())===null||n===void 0?void 0:n.enableAutoSubAccounts},R.high)},Tl=({method:e,correlationId:t})=>{var n;U("scw_sub_account.request.completed",{action:L.unknown,componentType:j.unknown,method:e,correlationId:t,enableAutoSubAccounts:(n=E.subAccountsConfig.get())===null||n===void 0?void 0:n.enableAutoSubAccounts},R.high)},Cl=({method:e,correlationId:t,errorMessage:n})=>{var r;U("scw_sub_account.request.error",{action:L.error,componentType:j.unknown,method:e,correlationId:t,errorMessage:n,enableAutoSubAccounts:(r=E.subAccountsConfig.get())===null||r===void 0?void 0:r.enableAutoSubAccounts},R.high)},Ol=({method:e,correlationId:t})=>{var n;U("scw_sub_account.add_owner.started",{action:L.unknown,componentType:j.unknown,method:e,correlationId:t,enableAutoSubAccounts:(n=E.subAccountsConfig.get())===null||n===void 0?void 0:n.enableAutoSubAccounts},R.high)},Pl=({method:e,correlationId:t})=>{var n;U("scw_sub_account.add_owner.completed",{action:L.unknown,componentType:j.unknown,method:e,correlationId:t,enableAutoSubAccounts:(n=E.subAccountsConfig.get())===null||n===void 0?void 0:n.enableAutoSubAccounts},R.high)},Bl=({method:e,correlationId:t,errorMessage:n})=>{var r;U("scw_sub_account.add_owner.error",{action:L.error,componentType:j.unknown,method:e,correlationId:t,errorMessage:n,enableAutoSubAccounts:(r=E.subAccountsConfig.get())===null||r===void 0?void 0:r.enableAutoSubAccounts},R.high)},Nl=({method:e,correlationId:t})=>{var n;U("scw_sub_account.insufficient_balance.error_handling.started",{action:L.unknown,componentType:j.unknown,method:e,correlationId:t,enableAutoSubAccounts:(n=E.subAccountsConfig.get())===null||n===void 0?void 0:n.enableAutoSubAccounts},R.high)},Ml=({method:e,correlationId:t})=>{var n;U("scw_sub_account.insufficient_balance.error_handling.completed",{action:L.unknown,componentType:j.unknown,method:e,correlationId:t,enableAutoSubAccounts:(n=E.subAccountsConfig.get())===null||n===void 0?void 0:n.enableAutoSubAccounts},R.high)},jl=({method:e,correlationId:t,errorMessage:n})=>{var r;U("scw_sub_account.insufficient_balance.error_handling.error",{action:L.error,componentType:j.unknown,method:e,correlationId:t,errorMessage:n,enableAutoSubAccounts:(r=E.subAccountsConfig.get())===null||r===void 0?void 0:r.enableAutoSubAccounts},R.high)},Je=e=>"message"in e&&typeof e.message=="string"?e.message:"",Us=Gn(()=>({})),{createPublicClient:Ll,defineChain:Rl,http:Gr}=await pe("viem");function Zr(e){e.forEach(t=>{var n,r,i,s,a,o,c,u;if(!t.rpcUrl)return;const h=Rl({id:t.id,rpcUrls:{default:{http:[t.rpcUrl]}},name:(r=(n=t.nativeCurrency)===null||n===void 0?void 0:n.name)!==null&&r!==void 0?r:"",nativeCurrency:{name:(s=(i=t.nativeCurrency)===null||i===void 0?void 0:i.name)!==null&&s!==void 0?s:"",symbol:(o=(a=t.nativeCurrency)===null||a===void 0?void 0:a.symbol)!==null&&o!==void 0?o:"",decimals:(u=(c=t.nativeCurrency)===null||c===void 0?void 0:c.decimal)!==null&&u!==void 0?u:18}}),d=Ll({chain:h,transport:Gr(t.rpcUrl)}),l=Ya({client:d,transport:Gr(t.rpcUrl)});Us.setState({[t.id]:{client:d,bundlerClient:l}})})}function Hs(e){var t;return(t=Us.getState()[e])===null||t===void 0?void 0:t.client}function he(e,t,n){if(e==null)throw t??x.rpc.invalidParams({message:"value must be present",data:e})}function Fe(e,t){if(!Array.isArray(e))throw x.rpc.invalidParams({message:t??"value must be an array",data:e})}const{isAddress:Yr,isHex:Dl}=await pe("viem");function Vt(e){if(typeof e!="object"||e===null)throw x.rpc.internal("sub account info is not an object");if(!("address"in e))throw x.rpc.internal("sub account is invalid");if("address"in e&&typeof e.address=="string"&&!Yr(e.address))throw x.rpc.internal("sub account address is invalid");if("factory"in e&&typeof e.factory=="string"&&!Yr(e.factory))throw x.rpc.internal("sub account factory address is invalid");if("factoryData"in e&&typeof e.factoryData=="string"&&!Dl(e.factoryData))throw x.rpc.internal("sub account factory data is invalid")}async function Ul(){return crypto.subtle.generateKey({name:"ECDH",namedCurve:"P-256"},!0,["deriveKey"])}async function Hl(e,t){return crypto.subtle.deriveKey({name:"ECDH",public:t},e,{name:"AES-GCM",length:256},!1,["encrypt","decrypt"])}async function $l(e,t){const n=crypto.getRandomValues(new Uint8Array(12)),r=await crypto.subtle.encrypt({name:"AES-GCM",iv:n},e,new TextEncoder().encode(t));return{iv:n,cipherText:r}}async function ql(e,{iv:t,cipherText:n}){const r=await crypto.subtle.decrypt({name:"AES-GCM",iv:t},e,n);return new TextDecoder().decode(r)}function $s(e){switch(e){case"public":return"spki";case"private":return"pkcs8"}}async function qs(e,t){const n=$s(e),r=await crypto.subtle.exportKey(n,t);return cr(new Uint8Array(r))}async function zs(e,t){const n=$s(e),r=tn(t).buffer;return await crypto.subtle.importKey(n,new Uint8Array(r),{name:"ECDH",namedCurve:"P-256"},!0,e==="private"?["deriveKey"]:[])}async function zl(e,t){const n=JSON.stringify(e,(r,i)=>{if(!(i instanceof Error))return i;const s=i;return Object.assign(Object.assign({},s.code?{code:s.code}:{}),{message:s.message})});return $l(t,n)}async function Wl(e,t){return JSON.parse(await ql(t,e))}function Fl(e,t){const n=typeof indexedDB<"u"?ro(e,t):void 0;return{getItem:async r=>{const i=await io(r,n);return i||null},removeItem:async r=>so(r,n),setItem:async(r,i)=>ao(r,i,n)}}const{hashMessage:Kl,hashTypedData:Vl}=await pe("viem"),Gl="cbwsdk",Zl="keys",hr="activeId",xt=Fl(Gl,Zl);async function Yl(){const e=await uu({extractable:!1}),t=be(nr(e.publicKey),1);return await xt.setItem(t,e),await xt.setItem(hr,t),e}async function Jl(){const e=await xt.getItem(hr);if(!e)return null;const t=await xt.getItem(e);return t||null}async function Ql(){const e=await Jl();if(!e){const t=await Yl(),n=be(nr(t.publicKey),1);return await xt.setItem(n,t),await xt.setItem(hr,n),t}return e}async function Xl(){const e=await Ql(),t=be(nr(e.publicKey),1),n=async r=>{const{payload:i,metadata:s}=cu({challenge:r,origin:"https://keys.coinbase.com",userVerification:"preferred"}),a=await lu({payload:i,privateKey:e.privateKey});return{signature:Kc(a),raw:{},webauthn:s}};return{id:t,publicKey:t,async sign({hash:r}){return n(r)},async signMessage({message:r}){return n(Kl(r))},async signTypedData(r){return n(Vl(r))},type:"webAuthn"}}async function Wn(){return{account:await Xl()}}const Jr={storageKey:"ownPrivateKey",keyType:"private"},Qr={storageKey:"ownPublicKey",keyType:"public"},Xr={storageKey:"peerPublicKey",keyType:"public"};class ed{constructor(){this.ownPrivateKey=null,this.ownPublicKey=null,this.peerPublicKey=null,this.sharedSecret=null}async getOwnPublicKey(){return await this.loadKeysIfNeeded(),this.ownPublicKey}async getSharedSecret(){return await this.loadKeysIfNeeded(),this.sharedSecret}async setPeerPublicKey(t){this.sharedSecret=null,this.peerPublicKey=t,await this.storeKey(Xr,t),await this.loadKeysIfNeeded()}async clear(){this.ownPrivateKey=null,this.ownPublicKey=null,this.peerPublicKey=null,this.sharedSecret=null,E.keys.clear()}async generateKeyPair(){const t=await Ul();this.ownPrivateKey=t.privateKey,this.ownPublicKey=t.publicKey,await this.storeKey(Jr,t.privateKey),await this.storeKey(Qr,t.publicKey)}async loadKeysIfNeeded(){if(this.ownPrivateKey===null&&(this.ownPrivateKey=await this.loadKey(Jr)),this.ownPublicKey===null&&(this.ownPublicKey=await this.loadKey(Qr)),(this.ownPrivateKey===null||this.ownPublicKey===null)&&await this.generateKeyPair(),this.peerPublicKey===null&&(this.peerPublicKey=await this.loadKey(Xr)),this.sharedSecret===null){if(this.ownPrivateKey===null||this.peerPublicKey===null)return;this.sharedSecret=await Hl(this.ownPrivateKey,this.peerPublicKey)}}async loadKey(t){const n=E.keys.get(t.storageKey);return n?zs(t.keyType,n):null}async storeKey(t,n){const r=await qs(t.keyType,n);E.keys.set(t.storageKey,r)}}function It(e,t){if(!(typeof e!="object"||e===null))return t.split(/[.[\]]+/).filter(Boolean).reduce((n,r)=>{if(typeof n=="object"&&n!==null)return n[r]},e)}const Ws="0x0ba5ed0c6aa8c49038f819e587e2633c4a9f428a",Fs="0xf85210B21cC50302F477BA56686d2019dC9b67Ad",xe=[{inputs:[],stateMutability:"nonpayable",type:"constructor"},{inputs:[{name:"owner",type:"bytes"}],name:"AlreadyOwner",type:"error"},{inputs:[],name:"Initialized",type:"error"},{inputs:[{name:"owner",type:"bytes"}],name:"InvalidEthereumAddressOwner",type:"error"},{inputs:[{name:"key",type:"uint256"}],name:"InvalidNonceKey",type:"error"},{inputs:[{name:"owner",type:"bytes"}],name:"InvalidOwnerBytesLength",type:"error"},{inputs:[],name:"LastOwner",type:"error"},{inputs:[{name:"index",type:"uint256"}],name:"NoOwnerAtIndex",type:"error"},{inputs:[{name:"ownersRemaining",type:"uint256"}],name:"NotLastOwner",type:"error"},{inputs:[{name:"selector",type:"bytes4"}],name:"SelectorNotAllowed",type:"error"},{inputs:[],name:"Unauthorized",type:"error"},{inputs:[],name:"UnauthorizedCallContext",type:"error"},{inputs:[],name:"UpgradeFailed",type:"error"},{inputs:[{name:"index",type:"uint256"},{name:"expectedOwner",type:"bytes"},{name:"actualOwner",type:"bytes"}],name:"WrongOwnerAtIndex",type:"error"},{anonymous:!1,inputs:[{indexed:!0,name:"index",type:"uint256"},{indexed:!1,name:"owner",type:"bytes"}],name:"AddOwner",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"index",type:"uint256"},{indexed:!1,name:"owner",type:"bytes"}],name:"RemoveOwner",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"implementation",type:"address"}],name:"Upgraded",type:"event"},{stateMutability:"payable",type:"fallback"},{inputs:[],name:"REPLAYABLE_NONCE_KEY",outputs:[{name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"owner",type:"address"}],name:"addOwnerAddress",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{name:"x",type:"bytes32"},{name:"y",type:"bytes32"}],name:"addOwnerPublicKey",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{name:"functionSelector",type:"bytes4"}],name:"canSkipChainIdValidation",outputs:[{name:"",type:"bool"}],stateMutability:"pure",type:"function"},{inputs:[],name:"domainSeparator",outputs:[{name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"eip712Domain",outputs:[{name:"fields",type:"bytes1"},{name:"name",type:"string"},{name:"version",type:"string"},{name:"chainId",type:"uint256"},{name:"verifyingContract",type:"address"},{name:"salt",type:"bytes32"},{name:"extensions",type:"uint256[]"}],stateMutability:"view",type:"function"},{inputs:[],name:"entryPoint",outputs:[{name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{name:"target",type:"address"},{name:"value",type:"uint256"},{name:"data",type:"bytes"}],name:"execute",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{components:[{name:"target",type:"address"},{name:"value",type:"uint256"},{name:"data",type:"bytes"}],name:"calls",type:"tuple[]"}],name:"executeBatch",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{name:"calls",type:"bytes[]"}],name:"executeWithoutChainIdValidation",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{components:[{name:"sender",type:"address"},{name:"nonce",type:"uint256"},{name:"initCode",type:"bytes"},{name:"callData",type:"bytes"},{name:"callGasLimit",type:"uint256"},{name:"verificationGasLimit",type:"uint256"},{name:"preVerificationGas",type:"uint256"},{name:"maxFeePerGas",type:"uint256"},{name:"maxPriorityFeePerGas",type:"uint256"},{name:"paymasterAndData",type:"bytes"},{name:"signature",type:"bytes"}],name:"userOp",type:"tuple"}],name:"getUserOpHashWithoutChainId",outputs:[{name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"implementation",outputs:[{name:"$",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{name:"owners",type:"bytes[]"}],name:"initialize",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{name:"account",type:"address"}],name:"isOwnerAddress",outputs:[{name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{name:"account",type:"bytes"}],name:"isOwnerBytes",outputs:[{name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{name:"x",type:"bytes32"},{name:"y",type:"bytes32"}],name:"isOwnerPublicKey",outputs:[{name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{name:"hash",type:"bytes32"},{name:"signature",type:"bytes"}],name:"isValidSignature",outputs:[{name:"result",type:"bytes4"}],stateMutability:"view",type:"function"},{inputs:[],name:"nextOwnerIndex",outputs:[{name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"index",type:"uint256"}],name:"ownerAtIndex",outputs:[{name:"",type:"bytes"}],stateMutability:"view",type:"function"},{inputs:[],name:"ownerCount",outputs:[{name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"proxiableUUID",outputs:[{name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{name:"index",type:"uint256"},{name:"owner",type:"bytes"}],name:"removeLastOwner",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{name:"index",type:"uint256"},{name:"owner",type:"bytes"}],name:"removeOwnerAtIndex",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"removedOwnersCount",outputs:[{name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"hash",type:"bytes32"}],name:"replaySafeHash",outputs:[{name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{name:"newImplementation",type:"address"},{name:"data",type:"bytes"}],name:"upgradeToAndCall",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{components:[{name:"sender",type:"address"},{name:"nonce",type:"uint256"},{name:"initCode",type:"bytes"},{name:"callData",type:"bytes"},{name:"callGasLimit",type:"uint256"},{name:"verificationGasLimit",type:"uint256"},{name:"preVerificationGas",type:"uint256"},{name:"maxFeePerGas",type:"uint256"},{name:"maxPriorityFeePerGas",type:"uint256"},{name:"paymasterAndData",type:"bytes"},{name:"signature",type:"bytes"}],name:"userOp",type:"tuple"},{name:"userOpHash",type:"bytes32"},{name:"missingAccountFunds",type:"uint256"}],name:"validateUserOp",outputs:[{name:"validationData",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{stateMutability:"payable",type:"receive"}],Ks=[{inputs:[{name:"implementation_",type:"address"}],stateMutability:"payable",type:"constructor"},{inputs:[],name:"OwnerRequired",type:"error"},{inputs:[{name:"owners",type:"bytes[]"},{name:"nonce",type:"uint256"}],name:"createAccount",outputs:[{name:"account",type:"address"}],stateMutability:"payable",type:"function"},{inputs:[{name:"owners",type:"bytes[]"},{name:"nonce",type:"uint256"}],name:"getAddress",outputs:[{name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"implementation",outputs:[{name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"initCodeHash",outputs:[{name:"",type:"bytes32"}],stateMutability:"view",type:"function"}],{hexToBigInt:An,isAddress:td}=await pe("viem"),{keccak256:nd,numberToHex:Vs,slice:rd,toHex:id}=await pe("viem");function ei(e){var t;if(!Array.isArray(e.params))return null;switch(e.method){case"personal_sign":return e.params[1];case"eth_signTypedData_v4":return e.params[0];case"eth_signTransaction":case"eth_sendTransaction":case"wallet_sendCalls":return(t=e.params[0])===null||t===void 0?void 0:t.from;default:return null}}function sd(e,t){if(!Array.isArray(e.params))throw x.rpc.invalidParams();const n=[...e.params];switch(e.method){case"eth_signTransaction":case"eth_sendTransaction":case"wallet_sendCalls":n[0].from=t;break;case"eth_signTypedData_v4":n[0]=t;break;case"personal_sign":n[1]=t;break}return Object.assign(Object.assign({},e),{params:n})}function ti(e){var t;if(!e||!Array.isArray(e)||!(!((t=e[0])===null||t===void 0)&&t.chainId)||typeof e[0].chainId!="string"&&typeof e[0].chainId!="number")throw x.rpc.invalidParams()}function ad(e){if(!e||!Array.isArray(e)||e.length!==1&&e.length!==2||typeof e[0]!="string"||!td(e[0]))throw x.rpc.invalidParams();if(e.length===2){if(!Array.isArray(e[1]))throw x.rpc.invalidParams();for(const t of e[1])if(typeof t!="string"||!t.startsWith("0x"))throw x.rpc.invalidParams()}}function on(e,t){const n=Object.assign({},e);if(t&&e.method.startsWith("wallet_")){let r=It(n,"params.0.capabilities");if(typeof r>"u"&&(r={}),typeof r!="object")throw x.rpc.invalidParams();r=Object.assign(Object.assign({},t),r),n.params&&Array.isArray(n.params)&&(n.params[0]=Object.assign(Object.assign({},n.params[0]),{capabilities:r}))}return n}async function In(){var e;const t=(e=E.subAccountsConfig.get())!==null&&e!==void 0?e:{},n={};if(t.enableAutoSubAccounts){const{account:r}=t.toOwnerAccount?await t.toOwnerAccount():await Wn();if(!r)throw x.provider.unauthorized("No owner account found");n.addSubAccount={account:{type:"create",keys:[{type:r.address?"address":"webauthn-p256",publicKey:r.address||r.publicKey}]}}}E.subAccountsConfig.set({capabilities:n})}function od(e){if(!(e.method==="coinbase_fetchPermissions"&&e.params===void 0)){if(e.method==="coinbase_fetchPermissions"&&Array.isArray(e.params)&&e.params.length===1&&typeof e.params[0]=="object"){if(typeof e.params[0].account!="string"||!e.params[0].chainId.startsWith("0x"))throw x.rpc.invalidParams("FetchPermissions - Invalid params: params[0].account must be a hex string");if(typeof e.params[0].chainId!="string"||!e.params[0].chainId.startsWith("0x"))throw x.rpc.invalidParams("FetchPermissions - Invalid params: params[0].chainId must be a hex string");if(typeof e.params[0].spender!="string"||!e.params[0].spender.startsWith("0x"))throw x.rpc.invalidParams("FetchPermissions - Invalid params: params[0].spender must be a hex string");return}throw x.rpc.invalidParams()}}function cd(e){var t,n,r;if(e.params!==void 0)return e;const i=(t=E.getState().account.accounts)===null||t===void 0?void 0:t[0],s=(n=E.getState().account.chain)===null||n===void 0?void 0:n.id,a=(r=E.getState().subAccount)===null||r===void 0?void 0:r.address;if(!i||!a||!s)throw x.rpc.invalidParams("FetchPermissions - one or more of account, sub account, or chain id is missing, connect to sub account via wallet_connect first");return{method:"coinbase_fetchPermissions",params:[{account:i,chainId:Vs(s),spender:a}]}}function ud({spendPermission:e,chainId:t}){return{domain:{name:"Spend Permission Manager",version:"1",chainId:t,verifyingContract:Fs},types:{SpendPermission:[{name:"account",type:"address"},{name:"spender",type:"address"},{name:"token",type:"address"},{name:"allowance",type:"uint160"},{name:"period",type:"uint48"},{name:"start",type:"uint48"},{name:"end",type:"uint48"},{name:"salt",type:"uint256"},{name:"extraData",type:"bytes"}]},primaryType:"SpendPermission",message:{account:e.account,spender:e.spender,token:e.token,allowance:e.allowance,period:e.period,start:e.start,end:e.end,salt:e.salt,extraData:e.extraData}}}function ld({spendPermissionBatch:e,chainId:t}){return{domain:{name:"Spend Permission Manager",version:"1",chainId:t,verifyingContract:Fs},types:{SpendPermissionBatch:[{name:"account",type:"address"},{name:"period",type:"uint48"},{name:"start",type:"uint48"},{name:"end",type:"uint48"},{name:"permissions",type:"PermissionDetails[]"}],PermissionDetails:[{name:"spender",type:"address"},{name:"token",type:"address"},{name:"allowance",type:"uint160"},{name:"salt",type:"uint256"},{name:"extraData",type:"bytes"}]},primaryType:"SpendPermissionBatch",message:{account:e.account,period:e.period,start:e.start,end:e.end,permissions:e.permissions.map(n=>({spender:n.spender,token:n.token,allowance:n.allowance,salt:n.salt,extraData:n.extraData}))}}}async function Gs({client:e,id:t}){var n;const r=await Ai(e,{id:t});if(r.status==="success")return(n=r.receipts)===null||n===void 0?void 0:n[0].transactionHash;throw x.rpc.internal("failed to send transaction")}function Zs({calls:e,from:t,chainId:n,capabilities:r}){const i=ks.get().paymasterUrls;let s={method:"wallet_sendCalls",params:[{version:"1.0",calls:e,chainId:Vs(n),from:t,atomicRequired:!0,capabilities:r}]};return i?.[n]&&(s=on(s,{paymasterService:{url:i?.[n]}})),s}async function dd(){const e=fr();return await new Promise(n=>{dr({snackbarContext:"sub_account_insufficient_balance"}),e.presentItem({autoExpand:!0,message:"Insufficient spend permission. Choose how to proceed:",menuItems:[{isRed:!1,info:"Create new Spend Permission",svgWidth:"10",svgHeight:"11",path:"",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:()=>{pt({snackbarContext:"sub_account_insufficient_balance",snackbarAction:"create_permission"}),e.clear(),n("update_permission")}},{isRed:!1,info:"Continue in Popup",svgWidth:"10",svgHeight:"11",path:"",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:()=>{pt({snackbarContext:"sub_account_insufficient_balance",snackbarAction:"continue_in_popup"}),e.clear(),n("continue_popup")}},{isRed:!0,info:"Cancel",svgWidth:"10",svgHeight:"11",path:"",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:()=>{pt({snackbarContext:"sub_account_insufficient_balance",snackbarAction:"cancel"}),e.clear(),n("cancel")}}]})})}function fd({errorData:e,sourceAddress:t}){var n;const r=[];for(const[i,{amount:s,sources:a}]of Object.entries((n=e?.required)!==null&&n!==void 0?n:{})){if(a.filter(c=>An(c.balance)>=An(s)&&c.address.toLowerCase()===t?.toLowerCase()).length===0)throw new Error("Source address has insufficient balance for a token");r.push({token:i,requiredAmount:An(s)})}return r}function hd(e){return typeof e=="object"&&e!==null&&"calls"in e}function pd(e){return Array.isArray(e)&&e.length===1&&typeof e[0]=="object"&&e[0]!==null&&"to"in e[0]}function md(e){return rd(nd(id(e)),0,16)}function bd({attribution:e,dappOrigin:t}){if(e){if("auto"in e&&e.auto&&t)return md(t);if("dataSuffix"in e)return e.dataSuffix}}function gd(e,t){var n;if(!Array.isArray(e?.params))return!1;const r=(n=e.params[0])===null||n===void 0?void 0:n.capabilities;return!r||typeof r!="object"?!1:t in r}function Gt(e,t){const n=e.filter(r=>r!==t);return[t,...n]}function Zt(e,t){return[...e.filter(r=>r!==t),t]}async function yd(){const e=E.spendPermissions.get(),t=E.subAccounts.get(),n=E.account.get().accounts;return n?{accounts:n?.map(i=>({address:i,capabilities:{subAccounts:t?[t]:void 0,spendPermissions:e.length>0?{permissions:e}:void 0}}))}:null}const{hexToBytes:Fn,numberToHex:ni,stringToBytes:ri,trim:ii}=await pe("viem");function wd(e){return e.replaceAll("+","-").replaceAll("/","_").replace(/=+$/,"")}function Yt(e){const t=btoa(String.fromCharCode(...new Uint8Array(e)));return wd(t)}function vd({webauthn:e,signature:t,id:n}){const r=gs(t);return{id:n,rawId:Yt(ri(n)),response:{authenticatorData:Yt(Fn(e.authenticatorData)),clientDataJSON:Yt(ri(e.clientDataJSON)),signature:Yt(xd(r.r,r.s))},type:JSON.parse(e.clientDataJSON).type}}function xd(e,t){const n=Fn(ii(ni(e))),r=Fn(ii(ni(t))),i=n.length,s=r.length,a=i+s+4,o=new Uint8Array(a+2);return o[0]=48,o[1]=a,o[2]=2,o[3]=i,o.set(n,4),o[i+4]=2,o[i+5]=s,o.set(r,i+6),o}var kd=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n};const{BaseError:Ys,decodeFunctionData:Ed,encodeAbiParameters:Js,encodeFunctionData:si,encodePacked:Sd,hashMessage:_d,hashTypedData:Qs,parseSignature:Ad,size:Id,stringToHex:Td}=await pe("viem");async function Cd(e){const{owner:t,ownerIndex:n,address:r,client:i,factoryData:s}=e,a={abi:Xa,address:eo,version:"0.6"},o={abi:Ks,address:Ws};return Ja({client:i,entryPoint:a,extend:{abi:xe,factory:o},async decodeCalls(c){const u=Ed({abi:xe,data:c});if(u.functionName==="execute")return[{to:u.args[0],value:u.args[1],data:u.args[2]}];if(u.functionName==="executeBatch")return u.args[0].map(h=>({to:h.target,value:h.value,data:h.data}));throw new Ys(`unable to decode calls for "${u.functionName}"`)},async encodeCalls(c){var u,h;return c.length===1?si({abi:xe,functionName:"execute",args:[c[0].to,(u=c[0].value)!==null&&u!==void 0?u:BigInt(0),(h=c[0].data)!==null&&h!==void 0?h:"0x"]}):si({abi:xe,functionName:"executeBatch",args:[c.map(d=>{var l,f;return{data:(l=d.data)!==null&&l!==void 0?l:"0x",target:d.to,value:(f=d.value)!==null&&f!==void 0?f:BigInt(0)}})]})},async getAddress(){return r},async getFactoryArgs(){return s?{factory:o.address,factoryData:s}:{factory:o.address,factoryData:s}},async getStubSignature(){return t.type==="webAuthn"?"0x0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000000170000000000000000000000000000000000000000000000000000000000000001949fc7c88032b9fcb5f6efc7a7b8c63668eae9871b765e23123bb473ff57aa831a7c0d9276168ebcc29f2875a0239cffdf2a9cd1c2007c5c77c071db9264df1d000000000000000000000000000000000000000000000000000000000000002549960de5880e8c687434170f6476605b8fe4aeb9a28632c7995cf3ba831d97630500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008a7b2274797065223a22776562617574686e2e676574222c226368616c6c656e6765223a2273496a396e6164474850596759334b7156384f7a4a666c726275504b474f716d59576f4d57516869467773222c226f726967696e223a2268747470733a2f2f7369676e2e636f696e626173652e636f6d222c2263726f73734f726967696e223a66616c73657d00000000000000000000000000000000000000000000":St({ownerIndex:n,signature:"0xfffffffffffffffffffffffffffffff0000000000000000000000000000000007aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1c"})},async sign(c){const u=await this.getAddress(),h=Tn({address:u,chainId:i.chain.id,hash:c.hash}),d=await Jt({hash:h,owner:t});return St({ownerIndex:n,signature:d})},async signMessage(c){const{message:u}=c,h=await this.getAddress(),d=Tn({address:h,chainId:i.chain.id,hash:_d(u)}),l=await Jt({hash:d,owner:t});return St({ownerIndex:n,signature:l})},async signTypedData(c){const{domain:u,types:h,primaryType:d,message:l}=c,f=await this.getAddress(),y=Tn({address:f,chainId:i.chain.id,hash:Qs({domain:u,message:l,primaryType:d,types:h})}),w=await Jt({hash:y,owner:t});return St({ownerIndex:n,signature:w})},async signUserOperation(c){const{chainId:u=i.chain.id}=c,h=kd(c,["chainId"]),d=await this.getAddress(),l=Qa({chainId:u,entryPointAddress:a.address,entryPointVersion:a.version,userOperation:Object.assign(Object.assign({},h),{sender:d})}),f=await Jt({hash:l,owner:t});return St({ownerIndex:n,signature:f})},userOperation:{async estimateGas(c){var u;if(t.type==="webAuthn")return{verificationGasLimit:BigInt(Math.max(Number((u=c.verificationGasLimit)!==null&&u!==void 0?u:BigInt(0)),8e5))}}}})}async function Jt({hash:e,owner:t}){if(t.type==="webAuthn"){const{signature:n,webauthn:r}=await t.sign({hash:e});return Od({signature:n,webauthn:r})}if(t.sign)return t.sign({hash:e});throw new Ys("`owner` does not support raw sign.")}function Tn({address:e,chainId:t,hash:n}){return Qs({domain:{chainId:t,name:"Coinbase Smart Wallet",verifyingContract:e,version:"1"},types:{CoinbaseSmartWalletMessage:[{name:"hash",type:"bytes32"}]},primaryType:"CoinbaseSmartWalletMessage",message:{hash:n}})}function Od({webauthn:e,signature:t}){const{r:n,s:r}=gs(t);return Js([{components:[{name:"authenticatorData",type:"bytes"},{name:"clientDataJSON",type:"bytes"},{name:"challengeIndex",type:"uint256"},{name:"typeIndex",type:"uint256"},{name:"r",type:"uint256"},{name:"s",type:"uint256"}],type:"tuple"}],[{authenticatorData:e.authenticatorData,clientDataJSON:Td(e.clientDataJSON),challengeIndex:BigInt(e.challengeIndex),typeIndex:BigInt(e.typeIndex),r:n,s:r}])}function St(e){const{ownerIndex:t=0}=e,n=(()=>{if(Id(e.signature)!==65)return e.signature;const r=Ad(e.signature);return Sd(["bytes32","bytes32","uint8"],[r.r,r.s,r.yParity===0?27:28])})();return Js([{components:[{name:"ownerIndex",type:"uint8"},{name:"signatureData",type:"bytes"}],type:"tuple"}],[{ownerIndex:t,signatureData:n}])}const{hexToString:ai,isHex:_t,numberToHex:Pd}=await pe("viem");async function Bd({address:e,client:t,factory:n,factoryData:r,owner:i,ownerIndex:s,parentAddress:a,attribution:o}){var c;const u={address:e,factory:n,factoryData:r},h=(c=t.chain)===null||c===void 0?void 0:c.id;if(!h)throw x.rpc.internal("chainId not found");const d=await Cd({owner:i,ownerIndex:s??1,address:e,client:t,factoryData:r}),l=async f=>{var y,w,k,_,$,S;try{switch(f.method){case"wallet_addSubAccount":return u;case"eth_accounts":return[u.address];case"eth_coinbase":return u.address;case"net_version":return h.toString();case"eth_chainId":return Pd(h);case"eth_sendTransaction":{Fe(f.params);const T=f.params[0];he(T.to,x.rpc.invalidParams("to is required"));const D={to:T.to,data:qn((y=T.data)!==null&&y!==void 0?y:"0x",!0),value:qn((w=T.value)!==null&&w!==void 0?w:"0x",!0),from:(k=T.from)!==null&&k!==void 0?k:u.address},ee=Zs({calls:[D],chainId:h,from:D.from}),te=await l(ee);return Gs({client:t,id:te})}case"wallet_sendCalls":{Fe(f.params);const T=It(f.params[0],"chainId");if(!T)throw x.rpc.invalidParams("chainId is required");if(!_t(T))throw x.rpc.invalidParams("chainId must be a hex encoded integer");if(!f.params[0])throw x.rpc.invalidParams("params are required");if(!("calls"in f.params[0]))throw x.rpc.invalidParams("calls are required");let D={method:"wallet_prepareCalls",params:[{version:"1.0",calls:f.params[0].calls,chainId:T,from:u.address,capabilities:"capabilities"in f.params[0]?f.params[0].capabilities:{}}]};a&&(D=on(D,{funding:[{type:"spendPermission",data:{autoApply:!0,sources:[a],preference:"PREFER_DIRECT_BALANCE"}}]}));let ee=await l(D);const te=await(($=(_=i).sign)===null||$===void 0?void 0:$.call(_,{hash:ai(ee.signatureRequest.hash)}));let F;if(!te)throw x.rpc.internal("signature not found");return _t(te)?F={type:"secp256k1",data:{address:i.address,signature:te}}:F={type:"webauthn",data:{signature:JSON.stringify(vd(Object.assign({id:(S=i.id)!==null&&S!==void 0?S:"1"},te))),publicKey:i.publicKey}},(await l({method:"wallet_sendPreparedCalls",params:[{version:"1.0",type:ee.type,data:ee.userOp,chainId:ee.chainId,signature:F}]}))[0]}case"wallet_sendPreparedCalls":{Fe(f.params);const T=It(f.params[0],"chainId");if(!T)throw x.rpc.invalidParams("chainId is required");if(!_t(T))throw x.rpc.invalidParams("chainId must be a hex encoded integer");return await t.request({method:"wallet_sendPreparedCalls",params:f.params})}case"wallet_prepareCalls":{Fe(f.params);const T=It(f.params[0],"chainId");if(!T)throw x.rpc.invalidParams("chainId is required");if(!_t(T))throw x.rpc.invalidParams("chainId must be a hex encoded integer");if(!f.params[0])throw x.rpc.invalidParams("params are required");if(!It(f.params[0],"calls"))throw x.rpc.invalidParams("calls are required");const D=f.params[0];return o&&D.capabilities&&!("attribution"in D.capabilities)&&(D.capabilities.attribution=o),await t.request({method:"wallet_prepareCalls",params:[Object.assign(Object.assign({},f.params[0]),{chainId:T})]})}case"personal_sign":{if(Fe(f.params),!_t(f.params[0]))throw x.rpc.invalidParams("message must be a hex encoded string");const T=ai(f.params[0]);return d.signMessage({message:T})}case"eth_signTypedData_v4":{Fe(f.params);const T=typeof f.params[1]=="string"?JSON.parse(f.params[1]):f.params[1];return d.signTypedData(T)}case"eth_signTypedData_v1":case"eth_signTypedData_v3":case"wallet_addEthereumChain":case"wallet_switchEthereumChain":default:throw x.rpc.methodNotSupported()}}catch(T){if(Is(T)){const D=Bu(T);if(D)throw D}throw T}};return{request:l}}const{decodeFunctionData:Nd,getAddress:oi,isAddress:Md,pad:jd}=await pe("viem");async function Xs({address:e,client:t,publicKey:n,factory:r,factoryData:i}){if(!await oo(t,{address:e})&&r&&i){if(oi(r)!==oi(Ws))throw x.rpc.internal("unknown factory address");const o=Nd({abi:Ks,data:i});if(o.functionName!=="createAccount")throw x.rpc.internal("unknown factory function");const[c]=o.args;return c.findIndex(u=>u.toLowerCase()===ci(n).toLowerCase())}const a=await vr(t,{address:e,abi:xe,functionName:"ownerCount"});for(let o=Number(a)-1;o>=0;o--){const c=await vr(t,{address:e,abi:xe,functionName:"ownerAtIndex",args:[BigInt(o)]}),u=ci(n);if(c.toLowerCase()===u.toLowerCase())return o}return-1}function ci(e){return Md(e)?jd(e):e}async function Ld(){const e=fr();return new Promise(t=>{dr({snackbarContext:"sub_account_add_owner"}),e.presentItem({autoExpand:!0,message:"App requires a signer update",menuItems:[{isRed:!1,info:"Confirm",svgWidth:"10",svgHeight:"11",path:"",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:()=>{pt({snackbarContext:"sub_account_add_owner",snackbarAction:"confirm"}),e.clear(),t("authenticate")}},{isRed:!0,info:"Cancel",svgWidth:"10",svgHeight:"11",path:"",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:()=>{pt({snackbarContext:"sub_account_add_owner",snackbarAction:"cancel"}),e.clear(),t("cancel")}}]})})}const{decodeAbiParameters:Rd,encodeFunctionData:ui,numberToHex:Dd,toHex:li}=await pe("viem");async function Ud({ownerAccount:e,globalAccountRequest:t}){var n,r;const i=E.account.get(),s=E.subAccounts.get(),a=(n=i.accounts)===null||n===void 0?void 0:n.find(y=>y.toLowerCase()!==s?.address.toLowerCase());he(a,x.provider.unauthorized("no global account")),he((r=i.chain)===null||r===void 0?void 0:r.id,x.provider.unauthorized("no chain id")),he(s?.address,x.provider.unauthorized("no sub account"));const o=[];if(e.type==="local"&&e.address&&o.push({to:s.address,data:ui({abi:xe,functionName:"addOwnerAddress",args:[e.address]}),value:li(0)}),e.publicKey){const[y,w]=Rd([{type:"bytes32"},{type:"bytes32"}],e.publicKey);o.push({to:s.address,data:ui({abi:xe,functionName:"addOwnerPublicKey",args:[y,w]}),value:li(0)})}const c={method:"wallet_sendCalls",params:[{version:"1",calls:o,chainId:Dd(84532),from:a}]};if(await Ld()==="cancel")throw x.provider.unauthorized("user cancelled");const h=await t(c),d=Hs(i.chain.id);if(he(d,x.rpc.internal(`client not found for chainId ${i.chain.id}`)),(await Ai(d,{id:h})).status!=="success")throw x.rpc.internal("add owner call failed");const f=await Xs({address:s.address,publicKey:e.type==="local"&&e.address?e.address:e.publicKey,client:d});if(f===-1)throw x.rpc.internal("failed to find owner index");return f}const{encodeFunctionData:di,erc20Abi:Hd,hexToBigInt:$d,numberToHex:Qt}=await pe("viem");async function qd({errorData:e,globalAccountAddress:t,subAccountAddress:n,client:r,request:i,subAccountRequest:s,globalAccountRequest:a}){var o;const c=(o=r.chain)===null||o===void 0?void 0:o.id;he(c,x.rpc.internal("invalid chainId"));const u=fd({errorData:e,sourceAddress:t}),h=await dd();if(h==="cancel")throw new Error("User cancelled funding");let d;const l=60*60*24,f=3;if(h==="update_permission"){if(u.length===1){const S=u[0],T=ud({spendPermission:{token:S.token,allowance:Qt(S.requiredAmount*BigInt(f)),period:l,account:t,spender:n,start:0,end:0xffffffffffff,salt:Qt(BigInt(Math.floor(Math.random()*Number.MAX_SAFE_INTEGER))),extraData:"0x"},chainId:c});d={method:"eth_signTypedData_v4",params:[t,T]}}else{const S=ld({spendPermissionBatch:{account:t,period:l,start:0,end:0xffffffffffff,permissions:u.map(T=>({token:T.token,allowance:Qt(T.requiredAmount*BigInt(f)),period:l,account:t,spender:n,salt:"0x0",extraData:"0x"}))},chainId:c});d={method:"eth_signTypedData_v4",params:[t,S]}}try{await a(d)}catch(S){throw console.error(S),new Error("User denied spend permission request")}return s(i)}const y=u.map(S=>S.token.toLowerCase()==="0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE".toLowerCase()?{to:n,value:Qt(S.requiredAmount),data:"0x"}:{to:S.token,value:"0x0",data:di({abi:Hd,functionName:"transfer",args:[n,S.requiredAmount]})});let w;if(i.method==="wallet_sendCalls"&&hd(i.params))w=i.params[0];else if(i.method==="eth_sendTransaction"&&pd(i.params))w=Zs({calls:[i.params[0]],chainId:c,from:i.params[0].from}).params[0];else throw new Error("Could not get original call");const k=di({abi:xe,functionName:"executeBatch",args:[w.calls.map(S=>{var T,D;return{target:S.to,value:$d((T=S.value)!==null&&T!==void 0?T:"0x0"),data:(D=S.data)!==null&&D!==void 0?D:"0x"}})]}),_=[...y,{data:k,to:n,value:"0x0"}],$=await a({method:"wallet_sendCalls",params:[Object.assign(Object.assign({},w),{calls:_,from:t})]});return i.method==="eth_sendTransaction"?Gs({client:r,id:$}):$}const{hexToNumber:Cn,isAddressEqual:zd,numberToHex:On}=await pe("viem");class ea{constructor(t){var n,r,i,s;this.communicator=t.communicator,this.callback=t.callback,this.keyManager=new ed;const{account:a,chains:o}=E.getState();this.accounts=(n=a.accounts)!==null&&n!==void 0?n:[],this.chain=(r=a.chain)!==null&&r!==void 0?r:{id:(s=(i=t.metadata.appChainIds)===null||i===void 0?void 0:i[0])!==null&&s!==void 0?s:1},o&&Zr(o)}async handshake(t){var n,r,i;const s=ve.get(t);xl({method:t.method,correlationId:s});try{await((r=(n=this.communicator).waitForPopupLoaded)===null||r===void 0?void 0:r.call(n));const a=await this.createRequestMessage({handshake:{method:t.method,params:(i=t.params)!==null&&i!==void 0?i:[]}},s),o=await this.communicator.postRequestAndWaitForResponse(a);if("failure"in o.content)throw o.content.failure;const c=await zs("public",o.sender);await this.keyManager.setPeerPublicKey(c);const u=await this.decryptResponseMessage(o);this.handleResponse(t,u),El({method:t.method,correlationId:s})}catch(a){throw kl({method:t.method,correlationId:s,errorMessage:Je(a)}),a}}async request(t){const n=ve.get(t);Sl({method:t.method,correlationId:n});try{const r=await this._request(t);return Al({method:t.method,correlationId:n}),r}catch(r){throw _l({method:t.method,correlationId:n,errorMessage:Je(r)}),r}}async _request(t){var n,r,i,s,a,o,c,u,h,d,l,f,y,w;if(this.accounts.length===0)switch(t.method){case"eth_requestAccounts":return await((r=(n=this.communicator).waitForPopupLoaded)===null||r===void 0?void 0:r.call(n)),await In(),await this.request({method:"wallet_connect",params:[{version:"1",capabilities:Object.assign({},(s=(i=E.subAccountsConfig.get())===null||i===void 0?void 0:i.capabilities)!==null&&s!==void 0?s:{})}]}),this.accounts;case"wallet_switchEthereumChain":{ti(t.params),this.chain.id=Number(t.params[0].chainId);return}case"wallet_connect":{await((o=(a=this.communicator).waitForPopupLoaded)===null||o===void 0?void 0:o.call(a)),await In();let k={};gd(t,"addSubAccount")&&(k=(u=(c=E.subAccountsConfig.get())===null||c===void 0?void 0:c.capabilities)!==null&&u!==void 0?u:{});const _=on(t,k);return this.sendRequestToPopup(_)}case"wallet_sendCalls":case"wallet_sign":return this.sendRequestToPopup(t);default:throw x.provider.unauthorized()}if(this.shouldRequestUseSubAccountSigner(t)){const k=ve.get(t);Il({method:t.method,correlationId:k});try{const _=await this.sendRequestToSubAccountSigner(t);return Tl({method:t.method,correlationId:k}),_}catch(_){throw Cl({method:t.method,correlationId:k,errorMessage:Je(_)}),_}}switch(t.method){case"eth_requestAccounts":case"eth_accounts":{const k=E.subAccounts.get(),_=E.subAccountsConfig.get();return k?.address&&(this.accounts=_?.enableAutoSubAccounts?Gt(this.accounts,k.address):Zt(this.accounts,k.address)),(h=this.callback)===null||h===void 0||h.call(this,"connect",{chainId:On(this.chain.id)}),this.accounts}case"eth_coinbase":return this.accounts[0];case"net_version":return this.chain.id;case"eth_chainId":return On(this.chain.id);case"wallet_getCapabilities":return this.handleGetCapabilitiesRequest(t);case"wallet_switchEthereumChain":return this.handleSwitchChainRequest(t);case"eth_ecRecover":case"personal_sign":case"wallet_sign":case"personal_ecRecover":case"eth_signTransaction":case"eth_sendTransaction":case"eth_signTypedData_v1":case"eth_signTypedData_v3":case"eth_signTypedData_v4":case"eth_signTypedData":case"wallet_addEthereumChain":case"wallet_watchAsset":case"wallet_sendCalls":case"wallet_showCallsStatus":case"wallet_grantPermissions":return this.sendRequestToPopup(t);case"wallet_connect":{const k=await yd();if(k)return k;await((l=(d=this.communicator).waitForPopupLoaded)===null||l===void 0?void 0:l.call(d)),await In();const _=E.subAccountsConfig.get(),$=on(t,(f=_?.capabilities)!==null&&f!==void 0?f:{});return(y=this.callback)===null||y===void 0||y.call(this,"connect",{chainId:On(this.chain.id)}),this.sendRequestToPopup($)}case"wallet_getSubAccounts":{const k=E.subAccounts.get();if(k?.address)return{subAccounts:[k]};if(!this.chain.rpcUrl)throw x.rpc.internal("No RPC URL set for chain");const _=await Pt(t,this.chain.rpcUrl);if(Fe(_.subAccounts,"subAccounts"),_.subAccounts.length>0){Vt(_.subAccounts[0]);const $=_.subAccounts[0];E.subAccounts.set({address:$.address,factory:$.factory,factoryData:$.factoryData})}return _}case"wallet_addSubAccount":return this.addSubAccount(t);case"coinbase_fetchPermissions":{od(t);const k=cd(t),_=await Pt(k,Ns),$=Cn((w=k.params)===null||w===void 0?void 0:w[0].chainId);return E.spendPermissions.set(_.permissions.map(S=>Object.assign(Object.assign({},S),{chainId:$}))),_}default:if(!this.chain.rpcUrl)throw x.rpc.internal("No RPC URL set for chain");return Pt(t,this.chain.rpcUrl)}}async sendRequestToPopup(t){var n,r;await((r=(n=this.communicator).waitForPopupLoaded)===null||r===void 0?void 0:r.call(n));const i=await this.sendEncryptedRequest(t),s=await this.decryptResponseMessage(i);return this.handleResponse(t,s)}async handleResponse(t,n){var r,i,s,a,o;const c=n.result;if("error"in c)throw c.error;switch(t.method){case"eth_requestAccounts":{const u=c.value;this.accounts=u,E.account.set({accounts:u,chain:this.chain}),(r=this.callback)===null||r===void 0||r.call(this,"accountsChanged",u);break}case"wallet_connect":{const u=c.value,h=u.accounts.map(_=>_.address);this.accounts=h,E.account.set({accounts:h});const d=u.accounts.at(0),l=d?.capabilities;if(l?.subAccounts){const _=l?.subAccounts;Fe(_,"subAccounts"),Vt(_[0]),E.subAccounts.set({address:_[0].address,factory:_[0].factory,factoryData:_[0].factoryData})}let f=[this.accounts[0]];const y=E.subAccounts.get(),w=E.subAccountsConfig.get();y?.address&&(this.accounts=w?.enableAutoSubAccounts?Gt(this.accounts,y.address):Zt(this.accounts,y.address));const k=(s=(i=u?.accounts)===null||i===void 0?void 0:i[0].capabilities)===null||s===void 0?void 0:s.spendPermissions;k&&"permissions"in k&&E.spendPermissions.set(k?.permissions),(a=this.callback)===null||a===void 0||a.call(this,"accountsChanged",f);break}case"wallet_addSubAccount":{Vt(c.value);const u=c.value;E.subAccounts.set(u);const h=E.subAccountsConfig.get();this.accounts=h?.enableAutoSubAccounts?Gt(this.accounts,u.address):Zt(this.accounts,u.address),(o=this.callback)===null||o===void 0||o.call(this,"accountsChanged",this.accounts);break}}return c.value}async cleanup(){var t,n;const r=E.config.get().metadata;await this.keyManager.clear(),E.account.clear(),E.subAccounts.clear(),E.spendPermissions.clear(),E.chains.clear(),this.accounts=[],this.chain={id:(n=(t=r?.appChainIds)===null||t===void 0?void 0:t[0])!==null&&n!==void 0?n:1}}async handleSwitchChainRequest(t){ti(t.params);const n=Ot(t.params[0].chainId);if(this.updateChain(n))return null;const i=await this.sendRequestToPopup(t);return i===null&&this.updateChain(n),i}async handleGetCapabilitiesRequest(t){ad(t.params);const n=t.params[0],r=t.params[1];if(!this.accounts.some(o=>zd(o,n)))throw x.provider.unauthorized("no active account found when getting capabilities");const i=E.getState().account.capabilities;if(!i)return{};if(!r||r.length===0)return i;const s=new Set(r.map(o=>Cn(o)));return Object.fromEntries(Object.entries(i).filter(([o])=>{try{const c=Cn(o);return s.has(c)}catch{return!1}}))}async sendEncryptedRequest(t){const n=await this.keyManager.getSharedSecret();if(!n)throw x.provider.unauthorized("No shared secret found when encrypting request");const r=await zl({action:t,chainId:this.chain.id},n),i=ve.get(t),s=await this.createRequestMessage({encrypted:r},i);return this.communicator.postRequestAndWaitForResponse(s)}async createRequestMessage(t,n){const r=await qs("public",await this.keyManager.getOwnPublicKey());return{id:crypto.randomUUID(),correlationId:n,sender:r,content:t,timestamp:new Date}}async decryptResponseMessage(t){var n,r,i;const s=t.content;if("failure"in s)throw s.failure;const a=await this.keyManager.getSharedSecret();if(!a)throw x.provider.unauthorized("Invalid session: no shared secret found when decrypting response");const o=await Wl(s.encrypted,a),c=(n=o.data)===null||n===void 0?void 0:n.chains;if(c){const h=(r=o.data)===null||r===void 0?void 0:r.nativeCurrencies,d=Object.entries(c).map(([l,f])=>{const y=h?.[Number(l)];return Object.assign({id:Number(l),rpcUrl:f},y?{nativeCurrency:y}:{})});E.chains.set(d),this.updateChain(this.chain.id,d),Zr(d)}const u=(i=o.data)===null||i===void 0?void 0:i.capabilities;return u&&E.account.set({capabilities:u}),o}updateChain(t,n){var r;const i=E.getState(),s=n??i.chains,a=s?.find(o=>o.id===t);return a?(a!==this.chain&&(this.chain=a,E.account.set({chain:a}),(r=this.callback)===null||r===void 0||r.call(this,"chainChanged",dt(a.id))),!0):!1}async addSubAccount(t){var n,r,i,s;const o=E.getState().subAccount,c=E.subAccountsConfig.get();if(o?.address)return this.accounts=c?.enableAutoSubAccounts?Gt(this.accounts,o.address):Zt(this.accounts,o.address),(n=this.callback)===null||n===void 0||n.call(this,"accountsChanged",this.accounts),o;if(await((i=(r=this.communicator).waitForPopupLoaded)===null||i===void 0?void 0:i.call(r)),Array.isArray(t.params)&&t.params.length>0&&t.params[0].account&&t.params[0].account.type==="create"){let h;if(t.params[0].account.keys&&t.params[0].account.keys.length>0)h=t.params[0].account.keys;else{const d=(s=E.subAccountsConfig.get())!==null&&s!==void 0?s:{},{account:l}=d.toOwnerAccount?await d.toOwnerAccount():await Wn();if(!l)throw x.provider.unauthorized("could not get subaccount owner account when adding sub account");h=[{type:l.address?"address":"webauthn-p256",publicKey:l.address||l.publicKey}]}t.params[0].account.keys=h}const u=await this.sendRequestToPopup(t);return Vt(u),u}shouldRequestUseSubAccountSigner(t){const n=ei(t),r=E.subAccounts.get();return n?n.toLowerCase()===r?.address.toLowerCase():!1}async sendRequestToSubAccountSigner(t){var n;const r=E.subAccounts.get(),i=E.subAccountsConfig.get(),s=E.config.get();he(r?.address,x.provider.unauthorized("no active sub account when sending request to sub account signer"));const a=i?.toOwnerAccount?await i.toOwnerAccount():await Wn();he(a?.account,x.provider.unauthorized("no active sub account owner when sending request to sub account signer")),ei(t)===void 0&&(t=sd(t,r.address));const c=Hs(this.chain.id);he(c,x.rpc.internal(`client not found for chainId ${this.chain.id} when sending request to sub account signer`));const u=this.accounts.find(y=>y.toLowerCase()!==r.address.toLowerCase());he(u,x.provider.unauthorized("no global account found when sending request to sub account signer"));const h=bd({attribution:(n=s.preference)===null||n===void 0?void 0:n.attribution,dappOrigin:window.location.origin}),d=a.account.type==="local"?a.account.address:a.account.publicKey;let l=await Xs({address:r.address,factory:r.factory,factoryData:r.factoryData,publicKey:d,client:c});if(l===-1){const y=ve.get(t);Ol({method:t.method,correlationId:y});try{l=await Ud({ownerAccount:a.account,globalAccountRequest:this.sendRequestToPopup.bind(this)}),Pl({method:t.method,correlationId:y})}catch(w){return Bl({method:t.method,correlationId:y,errorMessage:Je(w)}),x.provider.unauthorized("failed to add sub account owner when sending request to sub account signer")}}const{request:f}=await Bd({address:r.address,owner:a.account,client:c,factory:r.factory,factoryData:r.factoryData,parentAddress:u,attribution:h?{suffix:h}:void 0,ownerIndex:l});try{return await f(t)}catch(y){let w;if(Is(y))w=JSON.parse(y.details);else if(zr(y))w=y;else throw y;if(!(zr(w)&&w.data)||!w.data)throw y;const k=ve.get(t);Nl({method:t.method,correlationId:k});try{const _=await qd({errorData:w.data,globalAccountAddress:u,subAccountAddress:r.address,client:c,request:t,subAccountRequest:f,globalAccountRequest:this.request.bind(this)});return Ml({method:t.method,correlationId:k}),_}catch(_){throw console.error(_),jl({method:t.method,correlationId:k,errorMessage:Je(_)}),y}}}}const Wd=({method:e,correlationId:t})=>{U("walletlink_signer.handshake.started",{action:L.unknown,componentType:j.unknown,method:e,correlationId:t},R.high)},Fd=({method:e,correlationId:t,errorMessage:n})=>{U("walletlink_signer.handshake.error",{action:L.error,componentType:j.unknown,method:e,correlationId:t,errorMessage:n},R.high)},Kd=({method:e,correlationId:t})=>{U("walletlink_signer.handshake.completed",{action:L.unknown,componentType:j.unknown,method:e,correlationId:t},R.high)},Vd=({method:e,correlationId:t})=>{U("walletlink_signer.request.started",{action:L.unknown,componentType:j.unknown,method:e,correlationId:t},R.high)},Gd=({method:e,correlationId:t,errorMessage:n})=>{U("walletlink_signer.request.error",{action:L.error,componentType:j.unknown,method:e,correlationId:t,errorMessage:n},R.high)},Zd=({method:e,correlationId:t})=>{U("walletlink_signer.request.completed",{action:L.unknown,componentType:j.unknown,method:e,correlationId:t},R.high)},fi=()=>{U("walletlink_signer.walletlink_connection.connection_failed",{action:L.measurement,componentType:j.unknown},R.high)},Yd=()=>{U("walletlink_signer.walletlink_connection.fetch_unseen_events_failed",{action:L.measurement,componentType:j.unknown},R.high)};var z={},X={};Object.defineProperty(X,"__esModule",{value:!0});X.output=X.exists=X.hash=X.bytes=X.bool=X.number=X.isBytes=void 0;function cn(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`positive integer expected, not ${e}`)}X.number=cn;function ta(e){if(typeof e!="boolean")throw new Error(`boolean expected, not ${e}`)}X.bool=ta;function na(e){return e instanceof Uint8Array||e!=null&&typeof e=="object"&&e.constructor.name==="Uint8Array"}X.isBytes=na;function pr(e,...t){if(!na(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error(`Uint8Array expected of length ${t}, not of length=${e.length}`)}X.bytes=pr;function ra(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");cn(e.outputLen),cn(e.blockLen)}X.hash=ra;function ia(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}X.exists=ia;function sa(e,t){pr(e);const n=t.outputLen;if(e.length<n)throw new Error(`digestInto() expects output buffer of length at least ${n}`)}X.output=sa;const Jd={number:cn,bool:ta,bytes:pr,hash:ra,exists:ia,output:sa};X.default=Jd;var P={};Object.defineProperty(P,"__esModule",{value:!0});P.add5L=P.add5H=P.add4H=P.add4L=P.add3H=P.add3L=P.add=P.rotlBL=P.rotlBH=P.rotlSL=P.rotlSH=P.rotr32L=P.rotr32H=P.rotrBL=P.rotrBH=P.rotrSL=P.rotrSH=P.shrSL=P.shrSH=P.toBig=P.split=P.fromBig=void 0;const Xt=BigInt(2**32-1),Kn=BigInt(32);function mr(e,t=!1){return t?{h:Number(e&Xt),l:Number(e>>Kn&Xt)}:{h:Number(e>>Kn&Xt)|0,l:Number(e&Xt)|0}}P.fromBig=mr;function aa(e,t=!1){let n=new Uint32Array(e.length),r=new Uint32Array(e.length);for(let i=0;i<e.length;i++){const{h:s,l:a}=mr(e[i],t);[n[i],r[i]]=[s,a]}return[n,r]}P.split=aa;const oa=(e,t)=>BigInt(e>>>0)<<Kn|BigInt(t>>>0);P.toBig=oa;const ca=(e,t,n)=>e>>>n;P.shrSH=ca;const ua=(e,t,n)=>e<<32-n|t>>>n;P.shrSL=ua;const la=(e,t,n)=>e>>>n|t<<32-n;P.rotrSH=la;const da=(e,t,n)=>e<<32-n|t>>>n;P.rotrSL=da;const fa=(e,t,n)=>e<<64-n|t>>>n-32;P.rotrBH=fa;const ha=(e,t,n)=>e>>>n-32|t<<64-n;P.rotrBL=ha;const pa=(e,t)=>t;P.rotr32H=pa;const ma=(e,t)=>e;P.rotr32L=ma;const ba=(e,t,n)=>e<<n|t>>>32-n;P.rotlSH=ba;const ga=(e,t,n)=>t<<n|e>>>32-n;P.rotlSL=ga;const ya=(e,t,n)=>t<<n-32|e>>>64-n;P.rotlBH=ya;const wa=(e,t,n)=>e<<n-32|t>>>64-n;P.rotlBL=wa;function va(e,t,n,r){const i=(t>>>0)+(r>>>0);return{h:e+n+(i/2**32|0)|0,l:i|0}}P.add=va;const xa=(e,t,n)=>(e>>>0)+(t>>>0)+(n>>>0);P.add3L=xa;const ka=(e,t,n,r)=>t+n+r+(e/2**32|0)|0;P.add3H=ka;const Ea=(e,t,n,r)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0);P.add4L=Ea;const Sa=(e,t,n,r,i)=>t+n+r+i+(e/2**32|0)|0;P.add4H=Sa;const _a=(e,t,n,r,i)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0)+(i>>>0);P.add5L=_a;const Aa=(e,t,n,r,i,s)=>t+n+r+i+s+(e/2**32|0)|0;P.add5H=Aa;const Qd={fromBig:mr,split:aa,toBig:oa,shrSH:ca,shrSL:ua,rotrSH:la,rotrSL:da,rotrBH:fa,rotrBL:ha,rotr32H:pa,rotr32L:ma,rotlSH:ba,rotlSL:ga,rotlBH:ya,rotlBL:wa,add:va,add3L:xa,add3H:ka,add4L:Ea,add4H:Sa,add5H:Aa,add5L:_a};P.default=Qd;var Ia={},pn={};Object.defineProperty(pn,"__esModule",{value:!0});pn.crypto=void 0;pn.crypto=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;(function(e){/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */Object.defineProperty(e,"__esModule",{value:!0}),e.randomBytes=e.wrapXOFConstructorWithOpts=e.wrapConstructorWithOpts=e.wrapConstructor=e.checkOpts=e.Hash=e.concatBytes=e.toBytes=e.utf8ToBytes=e.asyncLoop=e.nextTick=e.hexToBytes=e.bytesToHex=e.byteSwap32=e.byteSwapIfBE=e.byteSwap=e.isLE=e.rotl=e.rotr=e.createView=e.u32=e.u8=e.isBytes=void 0;const t=pn,n=X;function r(b){return b instanceof Uint8Array||b!=null&&typeof b=="object"&&b.constructor.name==="Uint8Array"}e.isBytes=r;const i=b=>new Uint8Array(b.buffer,b.byteOffset,b.byteLength);e.u8=i;const s=b=>new Uint32Array(b.buffer,b.byteOffset,Math.floor(b.byteLength/4));e.u32=s;const a=b=>new DataView(b.buffer,b.byteOffset,b.byteLength);e.createView=a;const o=(b,p)=>b<<32-p|b>>>p;e.rotr=o;const c=(b,p)=>b<<p|b>>>32-p>>>0;e.rotl=c,e.isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;const u=b=>b<<24&4278190080|b<<8&16711680|b>>>8&65280|b>>>24&255;e.byteSwap=u,e.byteSwapIfBE=e.isLE?b=>b:b=>(0,e.byteSwap)(b);function h(b){for(let p=0;p<b.length;p++)b[p]=(0,e.byteSwap)(b[p])}e.byteSwap32=h;const d=Array.from({length:256},(b,p)=>p.toString(16).padStart(2,"0"));function l(b){(0,n.bytes)(b);let p="";for(let g=0;g<b.length;g++)p+=d[b[g]];return p}e.bytesToHex=l;const f={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function y(b){if(b>=f._0&&b<=f._9)return b-f._0;if(b>=f._A&&b<=f._F)return b-(f._A-10);if(b>=f._a&&b<=f._f)return b-(f._a-10)}function w(b){if(typeof b!="string")throw new Error("hex string expected, got "+typeof b);const p=b.length,g=p/2;if(p%2)throw new Error("padded hex string expected, got unpadded hex of length "+p);const m=new Uint8Array(g);for(let v=0,A=0;v<g;v++,A+=2){const O=y(b.charCodeAt(A)),C=y(b.charCodeAt(A+1));if(O===void 0||C===void 0){const I=b[A]+b[A+1];throw new Error('hex string expected, got non-hex character "'+I+'" at index '+A)}m[v]=O*16+C}return m}e.hexToBytes=w;const k=async()=>{};e.nextTick=k;async function _(b,p,g){let m=Date.now();for(let v=0;v<b;v++){g(v);const A=Date.now()-m;A>=0&&A<p||(await(0,e.nextTick)(),m+=A)}}e.asyncLoop=_;function $(b){if(typeof b!="string")throw new Error(`utf8ToBytes expected string, got ${typeof b}`);return new Uint8Array(new TextEncoder().encode(b))}e.utf8ToBytes=$;function S(b){return typeof b=="string"&&(b=$(b)),(0,n.bytes)(b),b}e.toBytes=S;function T(...b){let p=0;for(let m=0;m<b.length;m++){const v=b[m];(0,n.bytes)(v),p+=v.length}const g=new Uint8Array(p);for(let m=0,v=0;m<b.length;m++){const A=b[m];g.set(A,v),v+=A.length}return g}e.concatBytes=T;class D{clone(){return this._cloneInto()}}e.Hash=D;const ee={}.toString;function te(b,p){if(p!==void 0&&ee.call(p)!=="[object Object]")throw new Error("Options should be object or undefined");return Object.assign(b,p)}e.checkOpts=te;function F(b){const p=m=>b().update(S(m)).digest(),g=b();return p.outputLen=g.outputLen,p.blockLen=g.blockLen,p.create=()=>b(),p}e.wrapConstructor=F;function B(b){const p=(m,v)=>b(v).update(S(m)).digest(),g=b({});return p.outputLen=g.outputLen,p.blockLen=g.blockLen,p.create=m=>b(m),p}e.wrapConstructorWithOpts=B;function ge(b){const p=(m,v)=>b(v).update(S(m)).digest(),g=b({});return p.outputLen=g.outputLen,p.blockLen=g.blockLen,p.create=m=>b(m),p}e.wrapXOFConstructorWithOpts=ge;function le(b=32){if(t.crypto&&typeof t.crypto.getRandomValues=="function")return t.crypto.getRandomValues(new Uint8Array(b));throw new Error("crypto.getRandomValues must be defined")}e.randomBytes=le})(Ia);Object.defineProperty(z,"__esModule",{value:!0});z.shake256=z.shake128=z.keccak_512=z.keccak_384=z.keccak_256=z.keccak_224=z.sha3_512=z.sha3_384=z.sha3_256=z.sha3_224=z.Keccak=z.keccakP=void 0;const ut=X,Mt=P,Pe=Ia,Ta=[],Ca=[],Oa=[],Xd=BigInt(0),At=BigInt(1),ef=BigInt(2),tf=BigInt(7),nf=BigInt(256),rf=BigInt(113);for(let e=0,t=At,n=1,r=0;e<24;e++){[n,r]=[r,(2*n+3*r)%5],Ta.push(2*(5*r+n)),Ca.push((e+1)*(e+2)/2%64);let i=Xd;for(let s=0;s<7;s++)t=(t<<At^(t>>tf)*rf)%nf,t&ef&&(i^=At<<(At<<BigInt(s))-At);Oa.push(i)}const[sf,af]=(0,Mt.split)(Oa,!0),hi=(e,t,n)=>n>32?(0,Mt.rotlBH)(e,t,n):(0,Mt.rotlSH)(e,t,n),pi=(e,t,n)=>n>32?(0,Mt.rotlBL)(e,t,n):(0,Mt.rotlSL)(e,t,n);function Pa(e,t=24){const n=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let a=0;a<10;a++)n[a]=e[a]^e[a+10]^e[a+20]^e[a+30]^e[a+40];for(let a=0;a<10;a+=2){const o=(a+8)%10,c=(a+2)%10,u=n[c],h=n[c+1],d=hi(u,h,1)^n[o],l=pi(u,h,1)^n[o+1];for(let f=0;f<50;f+=10)e[a+f]^=d,e[a+f+1]^=l}let i=e[2],s=e[3];for(let a=0;a<24;a++){const o=Ca[a],c=hi(i,s,o),u=pi(i,s,o),h=Ta[a];i=e[h],s=e[h+1],e[h]=c,e[h+1]=u}for(let a=0;a<50;a+=10){for(let o=0;o<10;o++)n[o]=e[a+o];for(let o=0;o<10;o++)e[a+o]^=~n[(o+2)%10]&n[(o+4)%10]}e[0]^=sf[r],e[1]^=af[r]}n.fill(0)}z.keccakP=Pa;class Lt extends Pe.Hash{constructor(t,n,r,i=!1,s=24){if(super(),this.blockLen=t,this.suffix=n,this.outputLen=r,this.enableXOF=i,this.rounds=s,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,(0,ut.number)(r),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=(0,Pe.u32)(this.state)}keccak(){Pe.isLE||(0,Pe.byteSwap32)(this.state32),Pa(this.state32,this.rounds),Pe.isLE||(0,Pe.byteSwap32)(this.state32),this.posOut=0,this.pos=0}update(t){(0,ut.exists)(this);const{blockLen:n,state:r}=this;t=(0,Pe.toBytes)(t);const i=t.length;for(let s=0;s<i;){const a=Math.min(n-this.pos,i-s);for(let o=0;o<a;o++)r[this.pos++]^=t[s++];this.pos===n&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:t,suffix:n,pos:r,blockLen:i}=this;t[r]^=n,n&128&&r===i-1&&this.keccak(),t[i-1]^=128,this.keccak()}writeInto(t){(0,ut.exists)(this,!1),(0,ut.bytes)(t),this.finish();const n=this.state,{blockLen:r}=this;for(let i=0,s=t.length;i<s;){this.posOut>=r&&this.keccak();const a=Math.min(r-this.posOut,s-i);t.set(n.subarray(this.posOut,this.posOut+a),i),this.posOut+=a,i+=a}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return(0,ut.number)(t),this.xofInto(new Uint8Array(t))}digestInto(t){if((0,ut.output)(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,this.state.fill(0)}_cloneInto(t){const{blockLen:n,suffix:r,outputLen:i,rounds:s,enableXOF:a}=this;return t||(t=new Lt(n,r,i,a,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=a,t.destroyed=this.destroyed,t}}z.Keccak=Lt;const Ze=(e,t,n)=>(0,Pe.wrapConstructor)(()=>new Lt(t,e,n));z.sha3_224=Ze(6,144,224/8);z.sha3_256=Ze(6,136,256/8);z.sha3_384=Ze(6,104,384/8);z.sha3_512=Ze(6,72,512/8);z.keccak_224=Ze(1,144,224/8);z.keccak_256=Ze(1,136,256/8);z.keccak_384=Ze(1,104,384/8);z.keccak_512=Ze(1,72,512/8);const Ba=(e,t,n)=>(0,Pe.wrapXOFConstructorWithOpts)((r={})=>new Lt(t,e,r.dkLen===void 0?n:r.dkLen,!0));z.shake128=Ba(31,168,128/8);z.shake256=Ba(31,136,256/8);const{keccak_256:of}=z;function Na(e){return Buffer.allocUnsafe(e).fill(0)}function cf(e){return`0x${e.toString(16)}`}function uf(e){const t=cf(e);return new Buffer(La(t.slice(2)),"hex")}function lf(e){return e.toString(2).length}function Ma(e,t){let n=e.toString(16);n.length%2!==0&&(n="0"+n);const r=n.match(/.{1,2}/g).map(i=>parseInt(i,16));for(;r.length<t;)r.unshift(0);return Buffer.from(r)}function df(e,t){const n=e<0n;let r;if(n){const i=(1n<<BigInt(t))-1n;r=(~e&i)+1n}else r=e;return r&=(1n<<BigInt(t))-1n,r}function ja(e,t,n){const r=Na(t);return e=mn(e),n?e.length<t?(e.copy(r),r):e.slice(0,t):e.length<t?(e.copy(r,t-e.length),r):e.slice(-t)}function ff(e,t){return ja(e,t,!0)}function mn(e){if(!Buffer.isBuffer(e))if(Array.isArray(e))e=Buffer.from(e);else if(typeof e=="string")Ra(e)?e=Buffer.from(La(Da(e)),"hex"):e=Buffer.from(e);else if(typeof e=="number")e=uf(e);else if(e==null)e=Buffer.allocUnsafe(0);else if(typeof e=="bigint")e=Ma(e);else if(e.toArray)e=Buffer.from(e.toArray());else throw new Error("invalid type");return e}function hf(e){return e=mn(e),"0x"+e.toString("hex")}function pf(e,t){if(e=mn(e),t||(t=256),t!==256)throw new Error("unsupported");return Buffer.from(of(new Uint8Array(e)))}function La(e){return e.length%2?"0"+e:e}function Ra(e){return typeof e=="string"&&e.match(/^0x[0-9A-Fa-f]*$/)}function Da(e){return typeof e=="string"&&e.startsWith("0x")?e.slice(2):e}var Ua={zeros:Na,setLength:ja,setLengthRight:ff,isHexString:Ra,stripHexPrefix:Da,toBuffer:mn,bufferToHex:hf,keccak:pf,bitLengthFromBigInt:lf,bufferBEFromBigInt:Ma,twosFromBigInt:df};const ae=Ua;function Ha(e){return e.startsWith("int[")?"int256"+e.slice(3):e==="int"?"int256":e.startsWith("uint[")?"uint256"+e.slice(4):e==="uint"?"uint256":e.startsWith("fixed[")?"fixed128x128"+e.slice(5):e==="fixed"?"fixed128x128":e.startsWith("ufixed[")?"ufixed128x128"+e.slice(6):e==="ufixed"?"ufixed128x128":e}function mt(e){return Number.parseInt(/^\D+(\d+)$/.exec(e)[1],10)}function mi(e){var t=/^\D+(\d+)x(\d+)$/.exec(e);return[Number.parseInt(t[1],10),Number.parseInt(t[2],10)]}function $a(e){var t=e.match(/(.*)\[(.*?)\]$/);return t?t[2]===""?"dynamic":Number.parseInt(t[2],10):null}function Qe(e){var t=typeof e;if(t==="string"||t==="number")return BigInt(e);if(t==="bigint")return e;throw new Error("Argument is not a number")}function Ae(e,t){var n,r,i,s;if(e==="address")return Ae("uint160",Qe(t));if(e==="bool")return Ae("uint8",t?1:0);if(e==="string")return Ae("bytes",new Buffer(t,"utf8"));if(bf(e)){if(typeof t.length>"u")throw new Error("Not an array?");if(n=$a(e),n!=="dynamic"&&n!==0&&t.length>n)throw new Error("Elements exceed array size: "+n);i=[],e=e.slice(0,e.lastIndexOf("[")),typeof t=="string"&&(t=JSON.parse(t));for(s in t)i.push(Ae(e,t[s]));if(n==="dynamic"){var a=Ae("uint256",t.length);i.unshift(a)}return Buffer.concat(i)}else{if(e==="bytes")return t=new Buffer(t),i=Buffer.concat([Ae("uint256",t.length),t]),t.length%32!==0&&(i=Buffer.concat([i,ae.zeros(32-t.length%32)])),i;if(e.startsWith("bytes")){if(n=mt(e),n<1||n>32)throw new Error("Invalid bytes<N> width: "+n);return ae.setLengthRight(t,32)}else if(e.startsWith("uint")){if(n=mt(e),n%8||n<8||n>256)throw new Error("Invalid uint<N> width: "+n);r=Qe(t);const o=ae.bitLengthFromBigInt(r);if(o>n)throw new Error("Supplied uint exceeds width: "+n+" vs "+o);if(r<0)throw new Error("Supplied uint is negative");return ae.bufferBEFromBigInt(r,32)}else if(e.startsWith("int")){if(n=mt(e),n%8||n<8||n>256)throw new Error("Invalid int<N> width: "+n);r=Qe(t);const o=ae.bitLengthFromBigInt(r);if(o>n)throw new Error("Supplied int exceeds width: "+n+" vs "+o);const c=ae.twosFromBigInt(r,256);return ae.bufferBEFromBigInt(c,32)}else if(e.startsWith("ufixed")){if(n=mi(e),r=Qe(t),r<0)throw new Error("Supplied ufixed is negative");return Ae("uint256",r*BigInt(2)**BigInt(n[1]))}else if(e.startsWith("fixed"))return n=mi(e),Ae("int256",Qe(t)*BigInt(2)**BigInt(n[1]))}throw new Error("Unsupported or invalid type: "+e)}function mf(e){return e==="string"||e==="bytes"||$a(e)==="dynamic"}function bf(e){return e.lastIndexOf("]")===e.length-1}function gf(e,t){var n=[],r=[],i=32*e.length;for(var s in e){var a=Ha(e[s]),o=t[s],c=Ae(a,o);mf(a)?(n.push(Ae("uint256",i)),r.push(c),i+=c.length):n.push(c)}return Buffer.concat(n.concat(r))}function qa(e,t){if(e.length!==t.length)throw new Error("Number of types are not matching the values");for(var n,r,i=[],s=0;s<e.length;s++){var a=Ha(e[s]),o=t[s];if(a==="bytes")i.push(o);else if(a==="string")i.push(new Buffer(o,"utf8"));else if(a==="bool")i.push(new Buffer(o?"01":"00","hex"));else if(a==="address")i.push(ae.setLength(o,20));else if(a.startsWith("bytes")){if(n=mt(a),n<1||n>32)throw new Error("Invalid bytes<N> width: "+n);i.push(ae.setLengthRight(o,n))}else if(a.startsWith("uint")){if(n=mt(a),n%8||n<8||n>256)throw new Error("Invalid uint<N> width: "+n);r=Qe(o);const c=ae.bitLengthFromBigInt(r);if(c>n)throw new Error("Supplied uint exceeds width: "+n+" vs "+c);i.push(ae.bufferBEFromBigInt(r,n/8))}else if(a.startsWith("int")){if(n=mt(a),n%8||n<8||n>256)throw new Error("Invalid int<N> width: "+n);r=Qe(o);const c=ae.bitLengthFromBigInt(r);if(c>n)throw new Error("Supplied int exceeds width: "+n+" vs "+c);const u=ae.twosFromBigInt(r,n);i.push(ae.bufferBEFromBigInt(u,n/8))}else throw new Error("Unsupported or invalid type: "+a)}return Buffer.concat(i)}function yf(e,t){return ae.keccak(qa(e,t))}var wf={rawEncode:gf,solidityPack:qa,soliditySHA3:yf};const ye=Ua,Bt=wf,za={type:"object",properties:{types:{type:"object",additionalProperties:{type:"array",items:{type:"object",properties:{name:{type:"string"},type:{type:"string"}},required:["name","type"]}}},primaryType:{type:"string"},domain:{type:"object"},message:{type:"object"}},required:["types","primaryType","domain","message"]},Pn={encodeData(e,t,n,r=!0){const i=["bytes32"],s=[this.hashType(e,n)];if(r){const a=(o,c,u)=>{if(n[c]!==void 0)return["bytes32",u==null?"0x0000000000000000000000000000000000000000000000000000000000000000":ye.keccak(this.encodeData(c,u,n,r))];if(u===void 0)throw new Error(`missing value for field ${o} of type ${c}`);if(c==="bytes")return["bytes32",ye.keccak(u)];if(c==="string")return typeof u=="string"&&(u=Buffer.from(u,"utf8")),["bytes32",ye.keccak(u)];if(c.lastIndexOf("]")===c.length-1){const h=c.slice(0,c.lastIndexOf("[")),d=u.map(l=>a(o,h,l));return["bytes32",ye.keccak(Bt.rawEncode(d.map(([l])=>l),d.map(([,l])=>l)))]}return[c,u]};for(const o of n[e]){const[c,u]=a(o.name,o.type,t[o.name]);i.push(c),s.push(u)}}else for(const a of n[e]){let o=t[a.name];if(o!==void 0)if(a.type==="bytes")i.push("bytes32"),o=ye.keccak(o),s.push(o);else if(a.type==="string")i.push("bytes32"),typeof o=="string"&&(o=Buffer.from(o,"utf8")),o=ye.keccak(o),s.push(o);else if(n[a.type]!==void 0)i.push("bytes32"),o=ye.keccak(this.encodeData(a.type,o,n,r)),s.push(o);else{if(a.type.lastIndexOf("]")===a.type.length-1)throw new Error("Arrays currently unimplemented in encodeData");i.push(a.type),s.push(o)}}return Bt.rawEncode(i,s)},encodeType(e,t){let n="",r=this.findTypeDependencies(e,t).filter(i=>i!==e);r=[e].concat(r.sort());for(const i of r){if(!t[i])throw new Error("No type definition specified: "+i);n+=i+"("+t[i].map(({name:a,type:o})=>o+" "+a).join(",")+")"}return n},findTypeDependencies(e,t,n=[]){if(e=e.match(/^\w*/)[0],n.includes(e)||t[e]===void 0)return n;n.push(e);for(const r of t[e])for(const i of this.findTypeDependencies(r.type,t,n))!n.includes(i)&&n.push(i);return n},hashStruct(e,t,n,r=!0){return ye.keccak(this.encodeData(e,t,n,r))},hashType(e,t){return ye.keccak(this.encodeType(e,t))},sanitizeData(e){const t={};for(const n in za.properties)e[n]&&(t[n]=e[n]);return t.types&&(t.types=Object.assign({EIP712Domain:[]},t.types)),t},hash(e,t=!0){const n=this.sanitizeData(e),r=[Buffer.from("1901","hex")];return r.push(this.hashStruct("EIP712Domain",n.domain,n.types,t)),n.primaryType!=="EIP712Domain"&&r.push(this.hashStruct(n.primaryType,n.message,n.types,t)),ye.keccak(Buffer.concat(r))}};var vf={TYPED_MESSAGE_SCHEMA:za,TypedDataUtils:Pn,hashForSignTypedDataLegacy:function(e){return xf(e.data)},hashForSignTypedData_v3:function(e){return Pn.hash(e.data,!1)},hashForSignTypedData_v4:function(e){return Pn.hash(e.data)}};function xf(e){const t=new Error("Expect argument to be non-empty array");if(typeof e!="object"||!e.length)throw t;const n=e.map(function(s){return s.type==="bytes"?ye.toBuffer(s.value):s.value}),r=e.map(function(s){return s.type}),i=e.map(function(s){if(!s.name)throw t;return s.type+" "+s.name});return Bt.soliditySHA3(["bytes32","bytes32"],[Bt.soliditySHA3(new Array(e.length).fill("string"),i),Bt.soliditySHA3(r,n)])}const en=co(vf),kf="walletUsername",Vn="Addresses",Ef="AppVersion";class Sf{constructor(t){this.secret=t}async encrypt(t){const n=this.secret;if(n.length!==64)throw new Error("secret must be 256 bits");const r=crypto.getRandomValues(new Uint8Array(12)),i=await crypto.subtle.importKey("raw",tn(n),{name:"aes-gcm"},!1,["encrypt","decrypt"]),s=new TextEncoder,a=await window.crypto.subtle.encrypt({name:"AES-GCM",iv:r},i,s.encode(t)),o=16,c=a.slice(a.byteLength-o),u=a.slice(0,a.byteLength-o),h=new Uint8Array(c),d=new Uint8Array(u),l=new Uint8Array([...r,...h,...d]);return cr(l)}async decrypt(t){const n=this.secret;if(n.length!==64)throw new Error("secret must be 256 bits");return new Promise((r,i)=>{(async()=>{const s=await crypto.subtle.importKey("raw",tn(n),{name:"aes-gcm"},!1,["encrypt","decrypt"]),a=tn(t),o=a.slice(0,12),c=a.slice(12,28),u=a.slice(28),h=new Uint8Array([...u,...c]),d={name:"AES-GCM",iv:new Uint8Array(o)};try{const l=await window.crypto.subtle.decrypt(d,s,h),f=new TextDecoder;r(f.decode(l))}catch(l){i(l)}})()})}}class _f{constructor(t,n,r){this.linkAPIUrl=t,this.sessionId=n;const i=`${n}:${r}`;this.auth=`Basic ${btoa(i)}`}async markUnseenEventsAsSeen(t){return Promise.all(t.map(n=>fetch(`${this.linkAPIUrl}/events/${n.eventId}/seen`,{method:"POST",headers:{Authorization:this.auth}}))).catch(n=>console.error("Unable to mark events as seen:",n))}async fetchUnseenEvents(){var t;const n=await fetch(`${this.linkAPIUrl}/events?unseen=true`,{headers:{Authorization:this.auth}});if(n.ok){const{events:r,error:i}=await n.json();if(i)throw new Error(`Check unseen events failed: ${i}`);const s=(t=r?.filter(a=>a.event==="Web3Response").map(a=>({type:"Event",sessionId:this.sessionId,eventId:a.id,event:a.event,data:a.data})))!==null&&t!==void 0?t:[];return this.markUnseenEventsAsSeen(s),s}throw new Error(`Check unseen events failed: ${n.status}`)}}var Ie;(function(e){e[e.DISCONNECTED=0]="DISCONNECTED",e[e.CONNECTING=1]="CONNECTING",e[e.CONNECTED=2]="CONNECTED"})(Ie||(Ie={}));class de{setConnectionStateListener(t){this.connectionStateListener=t}setIncomingDataListener(t){this.incomingDataListener=t}constructor(t,n=WebSocket){this.WebSocketClass=n,this.webSocket=null,this.isDisconnecting=!1,this.url=t.replace(/^http/,"ws"),this.instanceId=de.instanceCounter++,de.activeInstances.add(this.instanceId)}async connect(){if(this.webSocket)throw new Error("webSocket object is not null");if(this.isDisconnecting)throw new Error("WebSocket is disconnecting, cannot reconnect on same instance");return new Promise((t,n)=>{var r;let i;try{this.webSocket=i=new this.WebSocketClass(this.url)}catch(s){n(s);return}(r=this.connectionStateListener)===null||r===void 0||r.call(this,Ie.CONNECTING),i.onclose=s=>{var a;this.clearWebSocket(),i.readyState!==WebSocket.OPEN&&n(new Error(`websocket error ${s.code}: ${s.reason}`)),(a=this.connectionStateListener)===null||a===void 0||a.call(this,Ie.DISCONNECTED)},i.onopen=s=>{var a;t(),(a=this.connectionStateListener)===null||a===void 0||a.call(this,Ie.CONNECTED),de.pendingData.length>0&&([...de.pendingData].forEach(c=>this.sendData(c)),de.pendingData=[])},i.onmessage=s=>{var a,o;if(s.data==="h")(a=this.incomingDataListener)===null||a===void 0||a.call(this,{type:"Heartbeat"});else try{const c=JSON.parse(s.data);(o=this.incomingDataListener)===null||o===void 0||o.call(this,c)}catch{}}})}disconnect(){var t;const{webSocket:n}=this;if(n){this.isDisconnecting=!0,this.clearWebSocket(),(t=this.connectionStateListener)===null||t===void 0||t.call(this,Ie.DISCONNECTED),this.connectionStateListener=void 0,this.incomingDataListener=void 0;try{n.close()}catch{}}}sendData(t){const{webSocket:n}=this;if(!n){de.pendingData.push(t),this.isDisconnecting||this.connect();return}if(n.readyState!==WebSocket.OPEN){de.pendingData.push(t);return}n.send(t)}clearWebSocket(){const{webSocket:t}=this;t&&(this.webSocket=null,t.onclose=null,t.onerror=null,t.onmessage=null,t.onopen=null)}cleanup(){de.activeInstances.delete(this.instanceId)}}de.instanceCounter=0;de.activeInstances=new Set;de.pendingData=[];const bi=1e4,Af=6e4;class If{constructor({session:t,linkAPIUrl:n,listener:r}){this.destroyed=!1,this.lastHeartbeatResponse=0,this.nextReqId=Ne(1),this.reconnectAttempts=0,this.isReconnecting=!1,this._connected=!1,this._linked=!1,this.requestResolutions=new Map,this.handleSessionMetadataUpdated=s=>{if(!s)return;new Map([["__destroyed",this.handleDestroyed],["EthereumAddress",this.handleAccountUpdated],["WalletUsername",this.handleWalletUsernameUpdated],["AppVersion",this.handleAppVersionUpdated],["ChainId",o=>s.JsonRpcUrl&&this.handleChainUpdated(o,s.JsonRpcUrl)]]).forEach((o,c)=>{const u=s[c];u!==void 0&&o(u)})},this.handleDestroyed=s=>{var a;s==="1"&&((a=this.listener)===null||a===void 0||a.resetAndReload())},this.handleAccountUpdated=async s=>{var a;try{const o=await this.cipher.decrypt(s);(a=this.listener)===null||a===void 0||a.accountUpdated(o)}catch{}},this.handleMetadataUpdated=async(s,a)=>{var o;try{const c=await this.cipher.decrypt(a);(o=this.listener)===null||o===void 0||o.metadataUpdated(s,c)}catch{}},this.handleWalletUsernameUpdated=async s=>{this.handleMetadataUpdated(kf,s)},this.handleAppVersionUpdated=async s=>{this.handleMetadataUpdated(Ef,s)},this.handleChainUpdated=async(s,a)=>{var o;try{const c=await this.cipher.decrypt(s),u=await this.cipher.decrypt(a);(o=this.listener)===null||o===void 0||o.chainUpdated(c,u)}catch{}},this.session=t,this.cipher=new Sf(t.secret),this.listener=r,this.linkAPIUrl=n,this.WebSocketClass=WebSocket;const i=this.createWebSocket();this.ws=i,this.http=new _f(n,t.id,t.key),this.setupVisibilityChangeHandler()}createWebSocket(){const t=new de(`${this.linkAPIUrl}/rpc`,this.WebSocketClass);return this.activeWsInstance=t,t.setConnectionStateListener(async n=>{if(t!==this.activeWsInstance)return;let r=!1;switch(n){case Ie.DISCONNECTED:this.heartbeatIntervalId&&(clearInterval(this.heartbeatIntervalId),this.heartbeatIntervalId=void 0),this.lastHeartbeatResponse=0,r=!1,this.destroyed||(async()=>{if(this.isReconnecting)return;this.isReconnecting=!0;const s=this.reconnectAttempts===0?0:3e3;await new Promise(a=>setTimeout(a,s)),!this.destroyed&&t===this.activeWsInstance?(this.reconnectAttempts++,"cleanup"in this.ws&&typeof this.ws.cleanup=="function"&&this.ws.cleanup(),this.ws=this.createWebSocket(),this.ws.connect().catch(()=>{fi()}).finally(()=>{this.isReconnecting=!1})):this.isReconnecting=!1})();break;case Ie.CONNECTED:this.reconnectAttempts=0;try{r=await this.handleConnected(),this.fetchUnseenEventsAPI().catch(()=>{})}catch{break}this.connected=r,this.updateLastHeartbeat(),this.heartbeatIntervalId&&clearInterval(this.heartbeatIntervalId),this.heartbeatIntervalId=window.setInterval(()=>{this.heartbeat()},bi),setTimeout(()=>{this.heartbeat()},100);break;case Ie.CONNECTING:break}n!==Ie.CONNECTED&&(this.connected=r)}),t.setIncomingDataListener(n=>{var r;switch(n.type){case"Heartbeat":this.updateLastHeartbeat();return;case"IsLinkedOK":case"Linked":{const i=n.type==="IsLinkedOK"?n.linked:void 0;this.linked=i||n.onlineGuests>0;break}case"GetSessionConfigOK":case"SessionConfigUpdated":{this.handleSessionMetadataUpdated(n.metadata);break}case"Event":{this.handleIncomingEvent(n);break}}n.id!==void 0&&((r=this.requestResolutions.get(n.id))===null||r===void 0||r(n))}),t}setupVisibilityChangeHandler(){this.visibilityChangeHandler=()=>{!document.hidden&&!this.destroyed&&(this.connected?this.heartbeat():this.reconnectWithFreshWebSocket())},this.focusHandler=()=>{!this.destroyed&&!this.connected&&this.reconnectWithFreshWebSocket()},document.addEventListener("visibilitychange",this.visibilityChangeHandler),window.addEventListener("focus",this.focusHandler),window.addEventListener("pageshow",t=>{t.persisted&&this.focusHandler&&this.focusHandler()})}reconnectWithFreshWebSocket(){if(this.destroyed)return;const t=this.ws;this.activeWsInstance=void 0,t.disconnect(),"cleanup"in t&&typeof t.cleanup=="function"&&t.cleanup(),this.ws=this.createWebSocket(),this.ws.connect().catch(()=>{fi()})}connect(){if(this.destroyed)throw new Error("instance is destroyed");this.ws.connect()}async destroy(){this.destroyed||(await this.makeRequest({type:"SetSessionConfig",id:Ne(this.nextReqId++),sessionId:this.session.id,metadata:{__destroyed:"1"}},{timeout:1e3}),this.destroyed=!0,this.activeWsInstance=void 0,this.heartbeatIntervalId&&(clearInterval(this.heartbeatIntervalId),this.heartbeatIntervalId=void 0),this.visibilityChangeHandler&&document.removeEventListener("visibilitychange",this.visibilityChangeHandler),this.focusHandler&&window.removeEventListener("focus",this.focusHandler),this.ws.disconnect(),"cleanup"in this.ws&&typeof this.ws.cleanup=="function"&&this.ws.cleanup(),this.listener=void 0)}get connected(){return this._connected}set connected(t){this._connected=t}get linked(){return this._linked}set linked(t){var n,r;this._linked=t,t&&((n=this.onceLinked)===null||n===void 0||n.call(this)),(r=this.listener)===null||r===void 0||r.linkedUpdated(t)}setOnceLinked(t){return new Promise(n=>{this.linked?t().then(n):this.onceLinked=()=>{t().then(n),this.onceLinked=void 0}})}async handleIncomingEvent(t){var n;if(!(t.type!=="Event"||t.event!=="Web3Response"))try{const r=await this.cipher.decrypt(t.data),i=JSON.parse(r);if(i.type!=="WEB3_RESPONSE")return;(n=this.listener)===null||n===void 0||n.handleWeb3ResponseMessage(i.id,i.response)}catch{}}async checkUnseenEvents(){await new Promise(t=>setTimeout(t,250));try{await this.fetchUnseenEventsAPI()}catch(t){console.error("Unable to check for unseen events",t)}}async fetchUnseenEventsAPI(){try{(await this.http.fetchUnseenEvents()).forEach(n=>{this.handleIncomingEvent(n)})}catch{Yd()}}async publishEvent(t,n,r=!1){const i=await this.cipher.encrypt(JSON.stringify(Object.assign(Object.assign({},n),{origin:location.origin,location:location.href,relaySource:"coinbaseWalletExtension"in window&&window.coinbaseWalletExtension?"injected_sdk":"sdk"}))),s={type:"PublishEvent",id:Ne(this.nextReqId++),sessionId:this.session.id,event:t,data:i,callWebhook:r};return this.setOnceLinked(async()=>{const a=await this.makeRequest(s);if(a.type==="Fail")throw new Error(a.error||"failed to publish event");return a.eventId})}sendData(t){this.ws.sendData(JSON.stringify(t))}updateLastHeartbeat(){this.lastHeartbeatResponse=Date.now()}heartbeat(){if(Date.now()-this.lastHeartbeatResponse>bi*2){this.ws.disconnect();return}if(this.connected)try{this.ws.sendData("h")}catch{}}async makeRequest(t,n={timeout:Af}){const r=t.id;this.sendData(t);let i;return Promise.race([new Promise((s,a)=>{i=window.setTimeout(()=>{a(new Error(`request ${r} timed out`))},n.timeout)}),new Promise(s=>{this.requestResolutions.set(r,a=>{clearTimeout(i),s(a),this.requestResolutions.delete(r)})})])}async handleConnected(){return(await this.makeRequest({type:"HostSession",id:Ne(this.nextReqId++),sessionId:this.session.id,sessionKey:this.session.key})).type==="Fail"?!1:(this.sendData({type:"IsLinked",id:Ne(this.nextReqId++),sessionId:this.session.id}),this.sendData({type:"GetSessionConfig",id:Ne(this.nextReqId++),sessionId:this.session.id}),!0)}}class Tf{constructor(){this._nextRequestId=0,this.callbacks=new Map}makeRequestId(){this._nextRequestId=(this._nextRequestId+1)%2147483647;const t=this._nextRequestId,n=Bs(t.toString(16));return this.callbacks.get(n)&&this.callbacks.delete(n),t}}function Cf(e){return e instanceof Uint8Array||e!=null&&typeof e=="object"&&e.constructor.name==="Uint8Array"}function br(e,...t){if(!Cf(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error(`Uint8Array expected of length ${t}, not of length=${e.length}`)}function gi(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function Of(e,t){br(e);const n=t.outputLen;if(e.length<n)throw new Error(`digestInto() expects output buffer of length at least ${n}`)}/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Bn=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),_e=(e,t)=>e<<32-t|e>>>t;new Uint8Array(new Uint32Array([287454020]).buffer)[0];const Pf=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Bf(e){br(e);let t="";for(let n=0;n<e.length;n++)t+=Pf[e[n]];return t}function Nf(e){if(typeof e!="string")throw new Error(`utf8ToBytes expected string, got ${typeof e}`);return new Uint8Array(new TextEncoder().encode(e))}function Wa(e){return typeof e=="string"&&(e=Nf(e)),br(e),e}class Mf{clone(){return this._cloneInto()}}function jf(e){const t=r=>e().update(Wa(r)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function Lf(e,t,n,r){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,n,r);const i=BigInt(32),s=BigInt(4294967295),a=Number(n>>i&s),o=Number(n&s),c=r?4:0,u=r?0:4;e.setUint32(t+c,a,r),e.setUint32(t+u,o,r)}const Rf=(e,t,n)=>e&t^~e&n,Df=(e,t,n)=>e&t^e&n^t&n;class Uf extends Mf{constructor(t,n,r,i){super(),this.blockLen=t,this.outputLen=n,this.padOffset=r,this.isLE=i,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=Bn(this.buffer)}update(t){gi(this);const{view:n,buffer:r,blockLen:i}=this;t=Wa(t);const s=t.length;for(let a=0;a<s;){const o=Math.min(i-this.pos,s-a);if(o===i){const c=Bn(t);for(;i<=s-a;a+=i)this.process(c,a);continue}r.set(t.subarray(a,a+o),this.pos),this.pos+=o,a+=o,this.pos===i&&(this.process(n,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){gi(this),Of(t,this),this.finished=!0;const{buffer:n,view:r,blockLen:i,isLE:s}=this;let{pos:a}=this;n[a++]=128,this.buffer.subarray(a).fill(0),this.padOffset>i-a&&(this.process(r,0),a=0);for(let d=a;d<i;d++)n[d]=0;Lf(r,i-8,BigInt(this.length*8),s),this.process(r,0);const o=Bn(t),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const u=c/4,h=this.get();if(u>h.length)throw new Error("_sha2: outputLen bigger than state");for(let d=0;d<u;d++)o.setUint32(4*d,h[d],s)}digest(){const{buffer:t,outputLen:n}=this;this.digestInto(t);const r=t.slice(0,n);return this.destroy(),r}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:n,buffer:r,length:i,finished:s,destroyed:a,pos:o}=this;return t.length=i,t.pos=o,t.finished=s,t.destroyed=a,i%n&&t.buffer.set(r),t}}const Hf=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]),ze=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),We=new Uint32Array(64);class $f extends Uf{constructor(){super(64,32,8,!1),this.A=ze[0]|0,this.B=ze[1]|0,this.C=ze[2]|0,this.D=ze[3]|0,this.E=ze[4]|0,this.F=ze[5]|0,this.G=ze[6]|0,this.H=ze[7]|0}get(){const{A:t,B:n,C:r,D:i,E:s,F:a,G:o,H:c}=this;return[t,n,r,i,s,a,o,c]}set(t,n,r,i,s,a,o,c){this.A=t|0,this.B=n|0,this.C=r|0,this.D=i|0,this.E=s|0,this.F=a|0,this.G=o|0,this.H=c|0}process(t,n){for(let d=0;d<16;d++,n+=4)We[d]=t.getUint32(n,!1);for(let d=16;d<64;d++){const l=We[d-15],f=We[d-2],y=_e(l,7)^_e(l,18)^l>>>3,w=_e(f,17)^_e(f,19)^f>>>10;We[d]=w+We[d-7]+y+We[d-16]|0}let{A:r,B:i,C:s,D:a,E:o,F:c,G:u,H:h}=this;for(let d=0;d<64;d++){const l=_e(o,6)^_e(o,11)^_e(o,25),f=h+l+Rf(o,c,u)+Hf[d]+We[d]|0,w=(_e(r,2)^_e(r,13)^_e(r,22))+Df(r,i,s)|0;h=u,u=c,c=o,o=a+f|0,a=s,s=i,i=r,r=f+w|0}r=r+this.A|0,i=i+this.B|0,s=s+this.C|0,a=a+this.D|0,o=o+this.E|0,c=c+this.F|0,u=u+this.G|0,h=h+this.H|0,this.set(r,i,s,a,o,c,u,h)}roundClean(){We.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const qf=jf(()=>new $f),yi="session:id",wi="session:secret",vi="session:linked";class bt{constructor(t,n,r,i=!1){this.storage=t,this.id=n,this.secret=r,this.key=Bf(qf(`${n}, ${r} WalletLink`)),this._linked=!!i}static create(t){const n=Ye(16),r=Ye(32);return new bt(t,n,r).save()}static load(t){const n=t.getItem(yi),r=t.getItem(vi),i=t.getItem(wi);return n&&i?new bt(t,n,i,r==="1"):null}get linked(){return this._linked}set linked(t){this._linked=t,this.persistLinked()}save(){return this.storage.setItem(yi,this.id),this.storage.setItem(wi,this.secret),this.persistLinked(),this}persistLinked(){this.storage.setItem(vi,this._linked?"1":"0")}}const zf=".-cbwsdk-css-reset .-cbwsdk-redirect-dialog-backdrop{position:fixed;top:0;left:0;right:0;bottom:0;transition:opacity .25s;background-color:rgba(10,11,13,.5)}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-backdrop-hidden{opacity:0}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box{display:block;position:fixed;top:50%;left:50%;transform:translate(-50%, -50%);padding:20px;border-radius:8px;background-color:#fff;color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box p{display:block;font-weight:400;font-size:14px;line-height:20px;padding-bottom:12px;color:#5b636e}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box button{appearance:none;border:none;background:none;color:#0052ff;padding:0;text-decoration:none;display:block;font-weight:600;font-size:16px;line-height:24px}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.dark{background-color:#0a0b0d;color:#fff}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.dark button{color:#0052ff}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.light{background-color:#fff;color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.light button{color:#0052ff}";class Wf{constructor(){this.root=null,this.darkMode=js()}attach(){const t=document.documentElement;this.root=document.createElement("div"),this.root.className="-cbwsdk-css-reset",t.appendChild(this.root),Ms()}present(t){this.render(t)}clear(){this.render(null)}render(t){this.root&&(Mn(null,this.root),t&&Mn(q(Ff,Object.assign({},t,{onDismiss:()=>{this.clear()},darkMode:this.darkMode})),this.root))}}const Ff=({title:e,buttonText:t,darkMode:n,onButtonClick:r,onDismiss:i})=>{const s=n?"dark":"light";return q(Rs,{darkMode:n},q("div",{class:"-cbwsdk-redirect-dialog"},q("style",null,zf),q("div",{class:"-cbwsdk-redirect-dialog-backdrop",onClick:i}),q("div",{class:Tt("-cbwsdk-redirect-dialog-box",s)},q("p",null,e),q("button",{onClick:r},t))))};class xi{constructor(){this.attached=!1,this.redirectDialog=new Wf}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");this.redirectDialog.attach(),this.attached=!0}redirectToCoinbaseWallet(t){const n=new URL(Ku);n.searchParams.append("redirect_url",Qu().href),t&&n.searchParams.append("wl_url",t);const r=document.createElement("a");r.target="cbw-opener",r.href=n.href,r.rel="noreferrer noopener",r.click()}openCoinbaseWalletDeeplink(t){this.redirectToCoinbaseWallet(t),setTimeout(()=>{this.redirectDialog.present({title:"Redirecting to Coinbase Wallet...",buttonText:"Open",onButtonClick:()=>{this.redirectToCoinbaseWallet(t)}})},99)}showConnecting(t){return()=>{this.redirectDialog.clear()}}}class Me{constructor(t){this.chainCallbackParams={chainId:"",jsonRpcUrl:""},this.isMobileWeb=Xu(),this.linkedUpdated=s=>{this.isLinked=s;const a=this.storage.getItem(Vn);if(s&&(this._session.linked=s),this.isUnlinkedErrorState=!1,a){const o=a.split(" "),c=this.storage.getItem("IsStandaloneSigning")==="true";o[0]!==""&&!s&&this._session.linked&&!c&&(this.isUnlinkedErrorState=!0)}},this.metadataUpdated=(s,a)=>{this.storage.setItem(s,a)},this.chainUpdated=(s,a)=>{this.chainCallbackParams.chainId===s&&this.chainCallbackParams.jsonRpcUrl===a||(this.chainCallbackParams={chainId:s,jsonRpcUrl:a},this.chainCallback&&this.chainCallback(a,Number.parseInt(s,10)))},this.accountUpdated=s=>{this.accountsCallback&&this.accountsCallback([s]),Me.accountRequestCallbackIds.size>0&&(Array.from(Me.accountRequestCallbackIds.values()).forEach(a=>{this.invokeCallback(a,{method:"requestEthereumAccounts",result:[s]})}),Me.accountRequestCallbackIds.clear())},this.resetAndReload=this.resetAndReload.bind(this),this.linkAPIUrl=t.linkAPIUrl,this.storage=t.storage,this.metadata=t.metadata,this.accountsCallback=t.accountsCallback,this.chainCallback=t.chainCallback;const{session:n,ui:r,connection:i}=this.subscribe();this._session=n,this.connection=i,this.relayEventManager=new Tf,this.ui=r,this.ui.attach()}subscribe(){const t=bt.load(this.storage)||bt.create(this.storage),{linkAPIUrl:n}=this,r=new If({session:t,linkAPIUrl:n,listener:this}),i=this.isMobileWeb?new xi:new il;return r.connect(),{session:t,ui:i,connection:r}}resetAndReload(){this.connection.destroy().then(()=>{const t=bt.load(this.storage);t?.id===this._session.id&&nt.clearAll(),document.location.reload()}).catch(t=>{})}signEthereumTransaction(t){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:t.fromAddress,toAddress:t.toAddress,weiValue:Se(t.weiValue),data:Ct(t.data,!0),nonce:t.nonce,gasPriceInWei:t.gasPriceInWei?Se(t.gasPriceInWei):null,maxFeePerGas:t.gasPriceInWei?Se(t.gasPriceInWei):null,maxPriorityFeePerGas:t.gasPriceInWei?Se(t.gasPriceInWei):null,gasLimit:t.gasLimit?Se(t.gasLimit):null,chainId:t.chainId,shouldSubmit:!1}})}signAndSubmitEthereumTransaction(t){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:t.fromAddress,toAddress:t.toAddress,weiValue:Se(t.weiValue),data:Ct(t.data,!0),nonce:t.nonce,gasPriceInWei:t.gasPriceInWei?Se(t.gasPriceInWei):null,maxFeePerGas:t.maxFeePerGas?Se(t.maxFeePerGas):null,maxPriorityFeePerGas:t.maxPriorityFeePerGas?Se(t.maxPriorityFeePerGas):null,gasLimit:t.gasLimit?Se(t.gasLimit):null,chainId:t.chainId,shouldSubmit:!0}})}submitEthereumTransaction(t,n){return this.sendRequest({method:"submitEthereumTransaction",params:{signedTransaction:Ct(t,!0),chainId:n}})}getWalletLinkSession(){return this._session}sendRequest(t){let n=null;const r=Ye(8),i=s=>{this.publishWeb3RequestCanceledEvent(r),this.handleErrorResponse(r,t.method,s),n?.()};return new Promise((s,a)=>{n=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:i,onResetConnection:this.resetAndReload}),this.relayEventManager.callbacks.set(r,o=>{if(n?.(),ne(o))return a(new Error(o.errorMessage));s(o)}),this.publishWeb3RequestEvent(r,t)})}publishWeb3RequestEvent(t,n){const r={type:"WEB3_REQUEST",id:t,request:n};this.publishEvent("Web3Request",r,!0).then(i=>{}).catch(i=>{this.handleWeb3ResponseMessage(r.id,{method:n.method,errorMessage:i.message})}),this.isMobileWeb&&this.openCoinbaseWalletDeeplink(n.method)}openCoinbaseWalletDeeplink(t){if(this.ui instanceof xi)switch(t){case"requestEthereumAccounts":case"switchEthereumChain":return;default:window.addEventListener("blur",()=>{window.addEventListener("focus",()=>{this.connection.checkUnseenEvents()},{once:!0})},{once:!0}),this.ui.openCoinbaseWalletDeeplink();break}}publishWeb3RequestCanceledEvent(t){const n={type:"WEB3_REQUEST_CANCELED",id:t};this.publishEvent("Web3RequestCanceled",n,!1).then()}publishEvent(t,n,r){return this.connection.publishEvent(t,n,r)}handleWeb3ResponseMessage(t,n){if(n.method==="requestEthereumAccounts"){Me.accountRequestCallbackIds.forEach(r=>this.invokeCallback(r,n)),Me.accountRequestCallbackIds.clear();return}this.invokeCallback(t,n)}handleErrorResponse(t,n,r){var i;const s=(i=r?.message)!==null&&i!==void 0?i:"Unspecified error message.";this.handleWeb3ResponseMessage(t,{method:n,errorMessage:s})}invokeCallback(t,n){const r=this.relayEventManager.callbacks.get(t);r&&(r(n),this.relayEventManager.callbacks.delete(t))}requestEthereumAccounts(){const{appName:t,appLogoUrl:n}=this.metadata,r={method:"requestEthereumAccounts",params:{appName:t,appLogoUrl:n}},i=Ye(8);return new Promise((s,a)=>{this.relayEventManager.callbacks.set(i,o=>{if(ne(o))return a(new Error(o.errorMessage));s(o)}),Me.accountRequestCallbackIds.add(i),this.publishWeb3RequestEvent(i,r)})}watchAsset(t,n,r,i,s,a){const o={method:"watchAsset",params:{type:t,options:{address:n,symbol:r,decimals:i,image:s},chainId:a}};let c=null;const u=Ye(8),h=d=>{this.publishWeb3RequestCanceledEvent(u),this.handleErrorResponse(u,o.method,d),c?.()};return c=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:h,onResetConnection:this.resetAndReload}),new Promise((d,l)=>{this.relayEventManager.callbacks.set(u,f=>{if(c?.(),ne(f))return l(new Error(f.errorMessage));d(f)}),this.publishWeb3RequestEvent(u,o)})}addEthereumChain(t,n,r,i,s,a){const o={method:"addEthereumChain",params:{chainId:t,rpcUrls:n,blockExplorerUrls:i,chainName:s,iconUrls:r,nativeCurrency:a}};let c=null;const u=Ye(8),h=d=>{this.publishWeb3RequestCanceledEvent(u),this.handleErrorResponse(u,o.method,d),c?.()};return c=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:h,onResetConnection:this.resetAndReload}),new Promise((d,l)=>{this.relayEventManager.callbacks.set(u,f=>{if(c?.(),ne(f))return l(new Error(f.errorMessage));d(f)}),this.publishWeb3RequestEvent(u,o)})}switchEthereumChain(t,n){const r={method:"switchEthereumChain",params:Object.assign({chainId:t},{address:n})};let i=null;const s=Ye(8),a=o=>{this.publishWeb3RequestCanceledEvent(s),this.handleErrorResponse(s,r.method,o),i?.()};return i=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:a,onResetConnection:this.resetAndReload}),new Promise((o,c)=>{this.relayEventManager.callbacks.set(s,u=>{if(i?.(),ne(u)&&u.errorCode)return c(x.provider.custom({code:u.errorCode,message:"Unrecognized chain ID. Try adding the chain using addEthereumChain first."}));if(ne(u))return c(new Error(u.errorMessage));o(u)}),this.publishWeb3RequestEvent(s,r)})}}Me.accountRequestCallbackIds=new Set;const ki="DefaultChainId",Ei="DefaultJsonRpcUrl";class Fa{constructor(t){this._relay=null,this._addresses=[],this.metadata=t.metadata,this._storage=new nt("walletlink",Fr),this.callback=t.callback||null;const n=this._storage.getItem(Vn);if(n){const r=n.split(" ");r[0]!==""&&(this._addresses=r.map(i=>qe(i)))}this.initializeRelay()}getSession(){const t=this.initializeRelay(),{id:n,secret:r}=t.getWalletLinkSession();return{id:n,secret:r}}async handshake(t){const n="eth_requestAccounts",r=ve.get(t);Wd({method:n,correlationId:r});try{await this._eth_requestAccounts(),Kd({method:n,correlationId:r})}catch(i){throw Fd({method:n,correlationId:r,errorMessage:Je(i)}),i}}get selectedAddress(){return this._addresses[0]||void 0}get jsonRpcUrl(){var t;return(t=this._storage.getItem(Ei))!==null&&t!==void 0?t:void 0}set jsonRpcUrl(t){this._storage.setItem(Ei,t)}updateProviderInfo(t,n){var r;this.jsonRpcUrl=t;const i=this.getChainId();this._storage.setItem(ki,n.toString(10)),Ot(n)!==i&&((r=this.callback)===null||r===void 0||r.call(this,"chainChanged",dt(n)))}async watchAsset(t){const n=Array.isArray(t)?t[0]:t;if(!n.type)throw x.rpc.invalidParams("Type is required");if(n?.type!=="ERC20")throw x.rpc.invalidParams(`Asset of type '${n.type}' is not supported`);if(!n?.options)throw x.rpc.invalidParams("Options are required");if(!n?.options.address)throw x.rpc.invalidParams("Address is required");const r=this.getChainId(),{address:i,symbol:s,image:a,decimals:o}=n.options,u=await this.initializeRelay().watchAsset(n.type,i,s,o,a,r?.toString());return ne(u)?!1:!!u.result}async addEthereumChain(t){var n,r;const i=t[0];if(((n=i.rpcUrls)===null||n===void 0?void 0:n.length)===0)throw x.rpc.invalidParams("please pass in at least 1 rpcUrl");if(!i.chainName||i.chainName.trim()==="")throw x.rpc.invalidParams("chainName is a required field");if(!i.nativeCurrency)throw x.rpc.invalidParams("nativeCurrency is a required field");const s=Number.parseInt(i.chainId,16);if(s===this.getChainId())return!1;const a=this.initializeRelay(),{rpcUrls:o=[],blockExplorerUrls:c=[],chainName:u,iconUrls:h=[],nativeCurrency:d}=i,l=await a.addEthereumChain(s.toString(),o,h,c,u,d);if(ne(l))return!1;if(((r=l.result)===null||r===void 0?void 0:r.isApproved)===!0)return this.updateProviderInfo(o[0],s),null;throw x.rpc.internal("unable to add ethereum chain")}async switchEthereumChain(t){const n=t[0],r=Number.parseInt(n.chainId,16),s=await this.initializeRelay().switchEthereumChain(r.toString(10),this.selectedAddress||void 0);if(ne(s))throw s;const a=s.result;return a.isApproved&&a.rpcUrl.length>0&&this.updateProviderInfo(a.rpcUrl,r),null}async cleanup(){this.callback=null,this._relay&&this._relay.resetAndReload(),this._storage.clear()}_setAddresses(t,n){var r;if(!Array.isArray(t))throw new Error("addresses is not an array");const i=t.map(s=>qe(s));JSON.stringify(i)!==JSON.stringify(this._addresses)&&(this._addresses=i,(r=this.callback)===null||r===void 0||r.call(this,"accountsChanged",i),this._storage.setItem(Vn,i.join(" ")))}async request(t){const n=ve.get(t);Vd({method:t.method,correlationId:n});try{const r=await this._request(t);return Zd({method:t.method,correlationId:n}),r}catch(r){throw Gd({method:t.method,correlationId:n,errorMessage:Je(r)}),r}}async _request(t){const n=t.params||[];switch(t.method){case"eth_accounts":return[...this._addresses];case"eth_coinbase":return this.selectedAddress||null;case"net_version":return this.getChainId().toString(10);case"eth_chainId":return dt(this.getChainId());case"eth_requestAccounts":return this._eth_requestAccounts();case"eth_ecRecover":case"personal_ecRecover":return this.ecRecover(t);case"personal_sign":return this.personalSign(t);case"eth_signTransaction":return this._eth_signTransaction(n);case"eth_sendRawTransaction":return this._eth_sendRawTransaction(n);case"eth_sendTransaction":return this._eth_sendTransaction(n);case"eth_signTypedData_v1":case"eth_signTypedData_v3":case"eth_signTypedData_v4":case"eth_signTypedData":return this.signTypedData(t);case"wallet_addEthereumChain":return this.addEthereumChain(n);case"wallet_switchEthereumChain":return this.switchEthereumChain(n);case"wallet_watchAsset":return this.watchAsset(n);default:if(!this.jsonRpcUrl)throw x.rpc.internal("No RPC URL set for chain");return Pt(t,this.jsonRpcUrl)}}_ensureKnownAddress(t){const n=qe(t);if(!this._addresses.map(i=>qe(i)).includes(n))throw new Error("Unknown Ethereum address")}_prepareTransactionParams(t){const n=t.from?qe(t.from):this.selectedAddress;if(!n)throw new Error("Ethereum address is unavailable");this._ensureKnownAddress(n);const r=t.to?qe(t.to):null,i=t.value!=null?Et(t.value):BigInt(0),s=t.data?zn(t.data):Buffer.alloc(0),a=t.nonce!=null?Ot(t.nonce):null,o=t.gasPrice!=null?Et(t.gasPrice):null,c=t.maxFeePerGas!=null?Et(t.maxFeePerGas):null,u=t.maxPriorityFeePerGas!=null?Et(t.maxPriorityFeePerGas):null,h=t.gas!=null?Et(t.gas):null,d=t.chainId?Ot(t.chainId):this.getChainId();return{fromAddress:n,toAddress:r,weiValue:i,data:s,nonce:a,gasPriceInWei:o,maxFeePerGas:c,maxPriorityFeePerGas:u,gasLimit:h,chainId:d}}async ecRecover(t){const{method:n,params:r}=t;if(!Array.isArray(r))throw x.rpc.invalidParams();const s=await this.initializeRelay().sendRequest({method:"ethereumAddressFromSignedMessage",params:{message:_n(r[0]),signature:_n(r[1]),addPrefix:n==="personal_ecRecover"}});if(ne(s))throw s;return s.result}getChainId(){var t;return Number.parseInt((t=this._storage.getItem(ki))!==null&&t!==void 0?t:"1",10)}async _eth_requestAccounts(){var t,n;if(this._addresses.length>0)return(t=this.callback)===null||t===void 0||t.call(this,"connect",{chainId:dt(this.getChainId())}),this._addresses;const i=await this.initializeRelay().requestEthereumAccounts();if(ne(i))throw i;if(!i.result)throw new Error("accounts received is empty");return this._setAddresses(i.result),(n=this.callback)===null||n===void 0||n.call(this,"connect",{chainId:dt(this.getChainId())}),this._addresses}async personalSign({params:t}){if(!Array.isArray(t))throw x.rpc.invalidParams();const n=t[1],r=t[0];this._ensureKnownAddress(n);const s=await this.initializeRelay().sendRequest({method:"signEthereumMessage",params:{address:qe(n),message:_n(r),addPrefix:!0,typedDataJson:null}});if(ne(s))throw s;return s.result}async _eth_signTransaction(t){const n=this._prepareTransactionParams(t[0]||{}),i=await this.initializeRelay().signEthereumTransaction(n);if(ne(i))throw i;return i.result}async _eth_sendRawTransaction(t){const n=zn(t[0]),i=await this.initializeRelay().submitEthereumTransaction(n,this.getChainId());if(ne(i))throw i;return i.result}async _eth_sendTransaction(t){const n=this._prepareTransactionParams(t[0]||{}),i=await this.initializeRelay().signAndSubmitEthereumTransaction(n);if(ne(i))throw i;return i.result}async signTypedData(t){const{method:n,params:r}=t;if(!Array.isArray(r))throw x.rpc.invalidParams();const i=u=>{const h={eth_signTypedData_v1:en.hashForSignTypedDataLegacy,eth_signTypedData_v3:en.hashForSignTypedData_v3,eth_signTypedData_v4:en.hashForSignTypedData_v4,eth_signTypedData:en.hashForSignTypedData_v4};return Ct(h[n]({data:Mu(u)}),!0)},s=r[n==="eth_signTypedData_v1"?1:0],a=r[n==="eth_signTypedData_v1"?0:1];this._ensureKnownAddress(s);const c=await this.initializeRelay().sendRequest({method:"signEthereumMessage",params:{address:qe(s),message:i(a),typedDataJson:JSON.stringify(a,null,2),addPrefix:!1}});if(ne(c))throw c;return c.result}initializeRelay(){return this._relay||(this._relay=new Me({linkAPIUrl:Fr,storage:this._storage,metadata:this.metadata,accountsCallback:this._setAddresses.bind(this),chainCallback:this.updateProviderInfo.bind(this)})),this._relay}}const Ka="SignerType",Va=new nt("CBWSDK","SignerConfigurator");function Kf(){return Va.getItem(Ka)}function Vf(e){Va.setItem(Ka,e)}function Si(e){if(e)return e instanceof ea?"scw":"walletlink"}async function Gf(e){const{communicator:t,metadata:n,handshakeRequest:r,callback:i}=e;Yf(t,n,i,r).catch(()=>{});const s={id:crypto.randomUUID(),event:"selectSignerType",data:Object.assign(Object.assign({},e.preference),{handshakeRequest:r})},{data:a}=await t.postRequestAndWaitForResponse(s);return a}function Zf(e){const{signerType:t,metadata:n,communicator:r,callback:i}=e;switch(t){case"scw":return new ea({metadata:n,callback:i,communicator:r});case"walletlink":return new Fa({metadata:n,callback:i})}}async function Yf(e,t,n,r){await e.onMessage(({event:s})=>s==="WalletLinkSessionRequest");const i=new Fa({metadata:t,callback:n});e.postMessage({event:"WalletLinkUpdate",data:{session:i.getSession()}}),await i.handshake(r),e.postMessage({event:"WalletLinkUpdate",data:{connected:!0}})}var Jf=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n};class Qf extends hl{constructor(t){var{metadata:n}=t,r=t.preference,{keysUrl:i}=r,s=Jf(r,["keysUrl"]);super(),this.signer=null,this.isCoinbaseWallet=!0,this.metadata=n,this.preference=s,this.communicator=new ll({url:i,metadata:n,preference:s});const a=Kf();a&&(this.signer=this.initSigner(a),pl({signerType:a}))}async request(t){const n=crypto.randomUUID();ve.set(t,n),ml({method:t.method,correlationId:n});try{const r=await this._request(t);return gl({method:t.method,signerType:Si(this.signer),correlationId:n}),r}catch(r){throw bl({method:t.method,correlationId:n,signerType:Si(this.signer),errorMessage:r instanceof Error?r.message:""}),r}finally{ve.delete(t)}}async _request(t){try{if(zu(t),!this.signer)switch(t.method){case"eth_requestAccounts":{let r;const i=E.subAccountsConfig.get();i?.enableAutoSubAccounts?r="scw":r=await this.requestSignerSelection(t);const s=this.initSigner(r);r==="scw"&&i?.enableAutoSubAccounts?(await s.handshake({method:"handshake"}),await s.request(t)):await s.handshake(t),this.signer=s,Vf(r);break}case"wallet_connect":{const r=this.initSigner("scw");await r.handshake({method:"handshake"});const i=await r.request(t);return this.signer=r,i}case"wallet_sendCalls":case"wallet_sign":{const r=this.initSigner("scw");await r.handshake({method:"handshake"});const i=await r.request(t);return await r.cleanup(),i}case"wallet_getCallsStatus":return await Pt(t,Ns);case"net_version":return 1;case"eth_chainId":return dt(1);default:throw x.provider.unauthorized("Must call 'eth_requestAccounts' before other methods")}return await this.signer.request(t)}catch(n){const{code:r}=n;return r===G.provider.unauthorized&&this.disconnect(),Promise.reject(dl(n))}}async enable(){return console.warn('.enable() has been deprecated. Please use .request({ method: "eth_requestAccounts" }) instead.'),yl(),await this.request({method:"eth_requestAccounts"})}async disconnect(){var t;await((t=this.signer)===null||t===void 0?void 0:t.cleanup()),this.signer=null,nt.clearAll(),ve.clear(),this.emit("disconnect",x.provider.disconnected("User initiated disconnection"))}async requestSignerSelection(t){wl();const n=await Gf({communicator:this.communicator,preference:this.preference,metadata:this.metadata,handshakeRequest:t,callback:this.emit.bind(this)});return vl(n),n}initSigner(t){return Zf({signerType:t,metadata:this.metadata,communicator:this.communicator,callback:this.emit.bind(this)})}}function Xf(e){var t;const n={metadata:e.metadata,preference:e.preference};return(t=qu(n))!==null&&t!==void 0?t:new Qf(n)}const{decodeAbiParameters:eh,encodeFunctionData:_i,toHex:Nn}=await pe("viem"),th={options:"all"};function yh(e){var t,n,r,i;const s={metadata:{appName:e.appName||"Dapp",appLogoUrl:e.appLogoUrl||"",appChainIds:e.appChainIds||[]},preference:Object.assign(th,(t=e.preference)!==null&&t!==void 0?t:{}),paymasterUrls:e.paymasterUrls};!((n=e.subAccounts)===null||n===void 0)&&n.toOwnerAccount&&Wr(e.subAccounts.toOwnerAccount),E.subAccountsConfig.set({toOwnerAccount:(r=e.subAccounts)===null||r===void 0?void 0:r.toOwnerAccount,enableAutoSubAccounts:(i=e.subAccounts)===null||i===void 0?void 0:i.enableAutoSubAccounts}),E.config.set(s),E.persist.rehydrate(),Du(),s.preference.telemetry!==!1&&Au(),Wu(s.preference);let a=null;const o={getProvider(){return a||(a=Xf(s)),a.sdk=o,a},subAccount:{async create(c){var u,h;const d=E.getState();return he((u=d.subAccount)===null||u===void 0?void 0:u.address,new Error("subaccount already exists")),await((h=o.getProvider())===null||h===void 0?void 0:h.request({method:"wallet_addSubAccount",params:[{version:"1",account:c}]}))},async get(){var c,u;const h=E.subAccounts.get();if(h?.address)return h;const l=(u=(await((c=o.getProvider())===null||c===void 0?void 0:c.request({method:"wallet_connect",params:[{version:"1",capabilities:{}}]}))).accounts[0].capabilities)===null||u===void 0?void 0:u.subAccounts;return Array.isArray(l)?l[0]:null},async addOwner({address:c,publicKey:u,chainId:h}){var d,l;const f=E.subAccounts.get(),y=E.account.get();he(y,new Error("account does not exist")),he(f?.address,new Error("subaccount does not exist"));const w=[];if(u){const[k,_]=eh([{type:"bytes32"},{type:"bytes32"}],u);w.push({to:f.address,data:_i({abi:xe,functionName:"addOwnerPublicKey",args:[k,_]}),value:Nn(0)})}return c&&w.push({to:f.address,data:_i({abi:xe,functionName:"addOwnerAddress",args:[c]}),value:Nn(0)}),await((d=o.getProvider())===null||d===void 0?void 0:d.request({method:"wallet_sendCalls",params:[{calls:w,chainId:Nn(h),from:(l=y.accounts)===null||l===void 0?void 0:l[0],version:"1"}]}))},setToOwnerAccount(c){Wr(c),E.subAccountsConfig.set({toOwnerAccount:c})}}};return o}export{yh as createCoinbaseWalletSDK,Wn as getCryptoKeyAccount};