@dcl/shop 0.1.0-29030398160.commit-dedc8ac → 0.1.0-29111888971.commit-e1b927a

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 (164) hide show
  1. package/assets/{AnimatedBackground-8aI4vJAl.js → AnimatedBackground-XZF9g9Bk.js} +3 -3
  2. package/assets/{Assets-O86HcPf_.js → Assets-CZPTo1jO.js} +1 -1
  3. package/assets/{Button-D1faXtxc.js → Button-B2TDtyup.js} +1 -1
  4. package/assets/{Cart-wT4YY2XB.js → Cart-DhU4_S6H.js} +1 -1
  5. package/assets/{CircularProgress-ByISsJtD.js → CircularProgress-Cf__730y.js} +1 -1
  6. package/assets/{Collection-B-SrzrlP.js → Collection-CRBxkkqX.js} +1 -1
  7. package/assets/{Creator-3SRIb5GI.js → Creator-DO__19RD.js} +1 -1
  8. package/assets/{ExchangeController-CtvD9TxU.js → ExchangeController-txwSQL2Z.js} +1 -1
  9. package/assets/{GetCredits-BntbDm9-.js → GetCredits-DS1z5pyp.js} +2 -2
  10. package/assets/{HelpersUtil-zGctDzqI.js → HelpersUtil-CMysbO5y.js} +1 -1
  11. package/assets/{ImportListings-DvqpDa-s.js → ImportListings-ChNZ2UwM.js} +1 -1
  12. package/assets/{ItemDetail-CjSWRE3L.js → ItemDetail-Do5cjFW8.js} +2 -2
  13. package/assets/{Market-Hqywp2wQ.js → Market-Z4jp-uLb.js} +1 -1
  14. package/assets/{MenuItem-BzIPsU3-.js → MenuItem-B4U0TYKf.js} +1 -1
  15. package/assets/{MyAssets-nfsXXyUv.js → MyAssets-C7QdtDYF.js} +1 -1
  16. package/assets/{MyFavorites-B6_8hr5-.js → MyFavorites-Bu2IDcdJ.js} +1 -1
  17. package/assets/{MyPurchases-33hyTefC.js → MyPurchases-CDUC3XzQ.js} +1 -1
  18. package/assets/{NotFound-DXluG5-7.js → NotFound-D5sXjRPf.js} +1 -1
  19. package/assets/{RealCheckout-tQms6dAo.js → RealCheckout-DBL3uxEj.js} +1 -1
  20. package/assets/{ShopFooterInner-DV3X__jb.js → ShopFooterInner-BHh4OUAv.js} +2 -2
  21. package/assets/{Success-BblXOFEG.js → Success-BrvAPmP4.js} +1 -1
  22. package/assets/{SvgIcon-CVoRZ89M.js → SvgIcon-Cg5l4LDh.js} +1 -1
  23. package/assets/{SwapController-BEHLqATV.js → SwapController-BDZMxnNb.js} +1 -1
  24. package/assets/{TradeService-a9BKe-Oz.js → TradeService-CkLYTYcJ.js} +1 -1
  25. package/assets/{W3MFrameProviderSingleton-HtGM3kiI.js → W3MFrameProviderSingleton-D4DCXtQm.js} +3 -3
  26. package/assets/{WebCryptoP256-bPjiT7wY.js → WebCryptoP256-OE37a6hF.js} +1 -1
  27. package/assets/{basic-awR2CJat.js → basic-SUHSB6nZ.js} +1 -1
  28. package/assets/{biconomy-CBCMLM9k.js → biconomy-C6flCXA4.js} +1 -1
  29. package/assets/{buy-C8v-ou6b.js → buy-YkuLG1h7.js} +1 -1
  30. package/assets/{buy-gasless-CUtIigP0.js → buy-gasless-gRmZHjsE.js} +1 -1
  31. package/assets/{ccip-BMCE_sFa.js → ccip-7fqLW_t2.js} +1 -1
  32. package/assets/{ccip-DiW7RkRR.js → ccip-ByQiZ_aq.js} +1 -1
  33. package/assets/{collection-D-oaSVfu.js → collection-2CKCNH2O.js} +1 -1
  34. package/assets/{controller-CJz3LUjz.js → controller-BO0zre2A.js} +2 -2
  35. package/assets/{core-CGoVaJvD.js → core-D-mQUZ3X.js} +4 -4
  36. package/assets/{custom-CLQCvu9h.js → custom-C6VO1Je_.js} +1 -1
  37. package/assets/{data-capture-C1enk8q3.js → data-capture-DdxbO7dd.js} +1 -1
  38. package/assets/decimals-ByIlBo-2.js +1 -0
  39. package/assets/{decimals-C8GSUqDy.js → decimals-Di7mGY-D.js} +1 -1
  40. package/assets/{detectExtension-Bdev6B_Y.js → detectExtension-DsE82Ej6.js} +1 -1
  41. package/assets/{email-DI1UmfjV.js → email-BTEyDEk6.js} +1 -1
  42. package/assets/{embedded-wallet-CUaCp934.js → embedded-wallet-QGoIGdCB.js} +1 -1
  43. package/assets/{engine-NUwMDIUh.js → engine-Bjifrd8K.js} +1 -1
  44. package/assets/{estimate-l1-fee-CkQ_-gw6.js → estimate-l1-fee-Bqou6JLl.js} +1 -1
  45. package/assets/{eth_estimateGas-DaI_qfS7.js → eth_estimateGas-CarYiSgL.js} +1 -1
  46. package/assets/{eth_getStorageAt-DqNZYObO.js → eth_getStorageAt-B-cqm2CG.js} +1 -1
  47. package/assets/{eth_getTransactionCount-BBYhaRkF.js → eth_getTransactionCount-Dfx3JW2Q.js} +1 -1
  48. package/assets/{extractIPFS-COY4B3_o.js → extractIPFS-C5EI4cZz.js} +1 -1
  49. package/assets/{features-DW4K2ZKu.js → features-U-ULFF0v.js} +1 -1
  50. package/assets/{fetchTokenMetadata-D4vVc_nQ.js → fetchTokenMetadata-DHc2WWGs.js} +2 -2
  51. package/assets/{generateUtilityClasses-D15hK3nM.js → generateUtilityClasses-BAjjhm6X.js} +1 -1
  52. package/assets/{get-ecosystem-wallet-info-QCLNyKk6.js → get-ecosystem-wallet-info-CWcGnKL4.js} +1 -1
  53. package/assets/{getBalance-CndsdQzG.js → getBalance-C8i1-K0c.js} +1 -1
  54. package/assets/{getInstalledModules-BZgUgPCr.js → getInstalledModules-BXhbS0To.js} +1 -1
  55. package/assets/{getNFT-Bw4qn7ry.js → getNFT-CzHwZ4FU.js} +2 -2
  56. package/assets/{getNFT-BQyw29TQ.js → getNFT-D3XSi6wm.js} +1 -1
  57. package/assets/{hashTypedData-Er6Ia-O7.js → hashTypedData-BOc0w62Q.js} +1 -1
  58. package/assets/{hashTypedData-CaO8N883.js → hashTypedData-DX5YrpbP.js} +1 -1
  59. package/assets/{import-NJqh-zgj.js → import-BulayqYM.js} +1 -1
  60. package/assets/{in-app-wallet-calls-BDq_Ik7W.js → in-app-wallet-calls-BI0pU06-.js} +1 -1
  61. package/assets/{index-P5U8LYs6.js → index--_rHc9Od.js} +1 -1
  62. package/assets/{index-BZIVWDQd.js → index-2NUAW7ds.js} +1 -1
  63. package/assets/{index-CDAYsxA6.js → index-BF6unOoT.js} +1 -1
  64. package/assets/{index-Hn-DbSZA.js → index-BKSTjS_b.js} +1 -1
  65. package/assets/{index-LDSpzB15.js → index-BLQJ40Mi.js} +1 -1
  66. package/assets/{index-CfKqUBFA.js → index-BNH6Xzon.js} +2 -2
  67. package/assets/{index-Bo34Cx12.js → index-BOQwd6ZB.js} +1 -1
  68. package/assets/{index-DwQ4pw8v.js → index-BZ5hUBd_.js} +1 -1
  69. package/assets/{index-mLXaZKmk.js → index-BaSqmd6J.js} +1 -1
  70. package/assets/{index-AgzyxgSU.js → index-BlEd83Li.js} +1 -1
  71. package/assets/{index-BqIdYoG8.js → index-Bo6hVxzu.js} +1 -1
  72. package/assets/{index-C6QyIhnE.js → index-C2OMQVG4.js} +1 -1
  73. package/assets/{index-FcUvAZuZ.js → index-C2U9pe20.js} +1 -1
  74. package/assets/{index-DXfwhNfH.js → index-C6FQ8I_Q.js} +2 -2
  75. package/assets/{index-Dmfk0azd.js → index-C7-iTfFV.js} +39 -39
  76. package/assets/{index-CDOPdFEN.js → index-CDMAFM2h.js} +1 -1
  77. package/assets/{index-zGd0k6zk.js → index-CIPKmOlZ.js} +1 -1
  78. package/assets/{index-D-VYD1II.js → index-CMavzzI_.js} +1 -1
  79. package/assets/{index-C1RysQbA.js → index-CbJmVQBN.js} +1 -1
  80. package/assets/{index-BoZx7TrW.js → index-CcQfGUgB.js} +1 -1
  81. package/assets/{index-DieH8QTn.js → index-CiIXwK1P.js} +1 -1
  82. package/assets/{index-DrcFvB51.js → index-CkHNiFzW.js} +1 -1
  83. package/assets/{index-BexyLNIk.js → index-CkVoCPEe.js} +1 -1
  84. package/assets/{index-BABCyrjx.js → index-CxyR8sie.js} +1 -1
  85. package/assets/{index-emGKKyxf.js → index-CzFnbzvY.js} +1 -1
  86. package/assets/{index-Dav5KOrd.js → index-CzfG6alx.js} +1 -1
  87. package/assets/{index-BdBYQDrP.js → index-D3hzhbb8.js} +1 -1
  88. package/assets/{index-PQMQyCqV.js → index-D4VlTBkw.js} +1 -1
  89. package/assets/{index-BRyy9_FL.js → index-D5qOQwpy.js} +1 -1
  90. package/assets/{index-BseAcDfV.js → index-DIMSfymy.js} +3 -3
  91. package/assets/{index-DVQRwKte.js → index-DIw62AgP.js} +1 -1
  92. package/assets/{index-CCxw-foK.js → index-DJyoXp5I.js} +1 -1
  93. package/assets/{index-j1oJp18p.js → index-DOTYPGXa.js} +1 -1
  94. package/assets/{index-Buf412yH.js → index-DQx-sY_c.js} +1 -1
  95. package/assets/{index-Gr3BFRx7.js → index-DS8DYtub.js} +1 -1
  96. package/assets/{index-ccNJtibX.js → index-DShBCYos.js} +3 -3
  97. package/assets/{index-2l5r0dRI.js → index-DV4p99KA.js} +2 -2
  98. package/assets/{index-KUsuHO11.js → index-DacKA042.js} +1 -1
  99. package/assets/{index-Ddmzqmxk.js → index-DhBdPYnK.js} +1 -1
  100. package/assets/{index-CWz8eoAl.js → index-DjPU0-Js.js} +1 -1
  101. package/assets/{index-CRhrr6gN.js → index-DlllSUoB.js} +1 -1
  102. package/assets/{index-BEzzzIlC.js → index-DtrBN21c.js} +1 -1
  103. package/assets/{index-CWHR1ZBn.js → index-Eb-Zd0F2.js} +1 -1
  104. package/assets/{index-C6xmzvY-.js → index-GAmNssSM.js} +1 -1
  105. package/assets/{index-CmcvhZsS.js → index-IfYZnKCO.js} +1 -1
  106. package/assets/{index-FrZezou7.js → index-LSZxonl2.js} +1 -1
  107. package/assets/{index-CyDCPwX2.js → index-Pp2oEhTr.js} +1 -1
  108. package/assets/{index-DRm7xERf.js → index-Qzch3HJ1.js} +1 -1
  109. package/assets/{index-BUaGOTLN.js → index-ULMMROQ0.js} +1 -1
  110. package/assets/{index-Dm67LTtv.js → index-YfJF6hV4.js} +1 -1
  111. package/assets/{index-BKg37Q5D.js → index-jYazATJj.js} +1 -1
  112. package/assets/{index-DJCTaNyE.js → index-kxu93Of2.js} +1 -1
  113. package/assets/{index-Dq7Rlnvq.js → index-n-cFV5ht.js} +1 -1
  114. package/assets/{index.es-DZDKrrOX.js → index.es-Dk6KC5kj.js} +1 -1
  115. package/assets/{index.es-7keraYJG.js → index.es-DnMpNe4m.js} +4 -4
  116. package/assets/{index.es-C2X55s9j.js → index.es-IGCEipYb.js} +1 -1
  117. package/assets/{localBatchGatewayRequest-ntoba0Xt.js → localBatchGatewayRequest-BLJAP4fw.js} +1 -1
  118. package/assets/{mana-rate-D_DTt_S8.js → mana-rate-DkxpKYLQ.js} +1 -1
  119. package/assets/network-DsCGVBhE.js +1 -0
  120. package/assets/{networks-DvMCxuQT.js → networks-Bc_Uf_7y.js} +1 -1
  121. package/assets/{onramp-D4LFsmfg.js → onramp-DnhEoZl6.js} +1 -1
  122. package/assets/{openzeppelin-CJAun2pO.js → openzeppelin-DwFpqgXP.js} +1 -1
  123. package/assets/{ownerOf-DrmYf79A.js → ownerOf-Qq7Or7yc.js} +1 -1
  124. package/assets/{parseNft-Yzo9Plhx.js → parseNft-B-POJxiL.js} +2 -2
  125. package/assets/{parseSignature-3yq9FfJP.js → parseSignature-ClLI6O4f.js} +3 -3
  126. package/assets/{parseSignature-h2iJV3NZ.js → parseSignature-kOoafZEo.js} +1 -1
  127. package/assets/{pay-with-exchange-BWW2tZIp.js → pay-with-exchange-BZR4RMBZ.js} +1 -1
  128. package/assets/{qr-overlay-hYqgRnm0.js → qr-overlay-9WMDd_PO.js} +1 -1
  129. package/assets/{receive-BMHwXxqP.js → receive-CtJWuhGM.js} +1 -1
  130. package/assets/{resolveImplementation-DS1nY4sc.js → resolveImplementation-BJatMhHh.js} +1 -1
  131. package/assets/{rpc-BC6ESxMB.js → rpc-BA0W82l4.js} +1 -1
  132. package/assets/{secp256k1-DNCGSF8O.js → secp256k1-B82Rx-TY.js} +1 -1
  133. package/assets/{secp256k1-BQuyxdaC.js → secp256k1-DFslM7tB.js} +1 -1
  134. package/assets/{secp256k1-CrZRZ9L5.js → secp256k1-DHqlJ8nk.js} +1 -1
  135. package/assets/{send-B62L18Hx.js → send-DXVwWcB5.js} +1 -1
  136. package/assets/{send-batch-transaction-De_pBpa_.js → send-batch-transaction-D1j9aZww.js} +1 -1
  137. package/assets/{send-eip712-transaction-D-GzcP3o.js → send-eip712-transaction-CrryJAyV.js} +2 -2
  138. package/assets/{send-gasless-transaction-Iil1KVOe.js → send-gasless-transaction-B7YcLCGg.js} +2 -2
  139. package/assets/{sendRawTransaction-BqauPPYf.js → sendRawTransaction-DT-ObNx8.js} +3 -3
  140. package/assets/{serializeTransaction-B4qzULZO.js → serializeTransaction-DawhfTu0.js} +1 -1
  141. package/assets/{session-proposal-C4Cz1cln.js → session-proposal-lgMupzDT.js} +1 -1
  142. package/assets/{session-request-De0p90UO.js → session-request-DacijEHD.js} +2 -2
  143. package/assets/{sha256-bg_KfcLv.js → sha256-BxR-wXll.js} +1 -1
  144. package/assets/{signing-BGpVago5.js → signing-CoPa7cSW.js} +4 -4
  145. package/assets/{socials-vOukOtuh.js → socials-CMh8u0Ej.js} +1 -1
  146. package/assets/{swaps-FEWWVCcs.js → swaps-B0Q00kKq.js} +1 -1
  147. package/assets/{thirdweb-C8ToELvu.js → thirdweb-9c12J_EF.js} +3 -3
  148. package/assets/{totalSupply-C5jxuFw1.js → totalSupply-BCZn9Djj.js} +1 -1
  149. package/assets/{transactionReceipt-CbcThGoC.js → transactionReceipt-C2iQ3ozz.js} +1 -1
  150. package/assets/{transactions-CaxBviMm.js → transactions-Dqx74UWQ.js} +1 -1
  151. package/assets/{useInfiniteGrid-BiC1UMEK.js → useInfiniteGrid-DgSsqvQS.js} +1 -1
  152. package/assets/{verifyHash-JbNzrsYR.js → verifyHash-BVbpPoSf.js} +1 -1
  153. package/assets/{w3m-modal-BUwENQ4T.js → w3m-modal-CGHylzdj.js} +1 -1
  154. package/assets/{w3m-modal-BfRGsEzF.js → w3m-modal-DvCL5Oh_.js} +1 -1
  155. package/assets/{wait-for-tx-receipt-BJDKOLGI.js → wait-for-tx-receipt-Dm2aAIs1.js} +1 -1
  156. package/assets/{wallet-kind-CuaDlRao.js → wallet-kind-vciDs8sO.js} +1 -1
  157. package/assets/{wallets-BnBHCJi8.js → wallets-D8labJv_.js} +6 -6
  158. package/assets/{web-connector-CJKlFm6H.js → web-connector-C9MeCxtf.js} +3 -3
  159. package/assets/{writeContract-CtBYiULm.js → writeContract-C3IzBPhR.js} +1 -1
  160. package/assets/{zoraTestnet-CJMxifqR.js → zoraTestnet-CduWQC79.js} +1 -1
  161. package/index.html +8 -8
  162. package/package.json +2 -2
  163. package/assets/decimals-DnNelAv5.js +0 -1
  164. package/assets/network-CFFySFe9.js +0 -1
@@ -1,4 +1,4 @@
1
- import{i as O,b as c}from"./lit-element-B3y9oplH.js";import{n as W,r as l,o as $}from"./class-map-CxwNmq0D.js";import{d as _}from"./index-BseAcDfV.js";import{c as I}from"./index-Bo34Cx12.js";import{O as A}from"./index-DJCTaNyE.js";import{e as T}from"./index-DVQRwKte.js";import{o as S,O as h,z as F,R as f,d as D,b as C,D as N,A as M,C as d,k as P,E as u,t as U,S as v,F as j,M as R,T as x}from"./W3MFrameProviderSingleton-HtGM3kiI.js";import"./index-BdBYQDrP.js";import{C as z}from"./ConstantsUtil-DrWe0yob.js";import"./index-DwQ4pw8v.js";import"./index-CWHR1ZBn.js";import"./index-D-VYD1II.js";import"./index-Dmfk0azd.js";import"./react-Vu6nbGi5.js";import"./ethers-DHDSyreX.js";import"./index-DXfwhNfH.js";import"./index-CyDCPwX2.js";import"./index-CdfeQ7YK.js";import"./index-nibyPLVP.js";import"./index-BKg37Q5D.js";import"./index.es-C2X55s9j.js";import"./browser-ponyfill-rND5WOqr.js";import"./NetworkUtil-Ddexw9-U.js";import"./ref-BsAZ42-h.js";import"./async-directive-BRxn_Py3.js";import"./index-C1RysQbA.js";import"./index-P5U8LYs6.js";import"./browser-DHYOtFa8.js";const q=_`
1
+ import{i as O,b as c}from"./lit-element-B3y9oplH.js";import{n as W,r as l,o as $}from"./class-map-CxwNmq0D.js";import{d as _}from"./index-DIMSfymy.js";import{c as I}from"./index-BOQwd6ZB.js";import{O as A}from"./index-kxu93Of2.js";import{e as T}from"./index-DIw62AgP.js";import{o as S,O as h,z as F,R as f,d as D,b as C,D as N,A as M,C as d,k as P,E as u,t as U,S as v,F as j,M as R,T as x}from"./W3MFrameProviderSingleton-D4DCXtQm.js";import"./index-D3hzhbb8.js";import{C as z}from"./ConstantsUtil-DrWe0yob.js";import"./index-BZ5hUBd_.js";import"./index-Eb-Zd0F2.js";import"./index-CMavzzI_.js";import"./index-C7-iTfFV.js";import"./react-Vu6nbGi5.js";import"./ethers-DHDSyreX.js";import"./index-C6FQ8I_Q.js";import"./index-Pp2oEhTr.js";import"./index-CdfeQ7YK.js";import"./index-nibyPLVP.js";import"./index-jYazATJj.js";import"./index.es-IGCEipYb.js";import"./browser-ponyfill-rND5WOqr.js";import"./NetworkUtil-Ddexw9-U.js";import"./ref-BsAZ42-h.js";import"./async-directive-BRxn_Py3.js";import"./index-CbJmVQBN.js";import"./index--_rHc9Od.js";import"./browser-DHYOtFa8.js";const q=_`
2
2
  :host {
3
3
  margin-top: ${({spacing:t})=>t[1]};
4
4
  }
@@ -1,4 +1,4 @@
1
- import{i as D,b as u}from"./lit-element-B3y9oplH.js";import{r as l,n as m}from"./class-map-CxwNmq0D.js";import{d as C,r as N,e as V}from"./index-BseAcDfV.js";import{c as L}from"./index-Bo34Cx12.js";import"./index-DwQ4pw8v.js";import"./index-BdBYQDrP.js";import"./index-BRyy9_FL.js";import{C as S,N as p,d as F,E as W,R as P,b as M,M as K,l as Q,W as q}from"./W3MFrameProviderSingleton-HtGM3kiI.js";import{S as s}from"./SwapController-BEHLqATV.js";import"./index-D-VYD1II.js";import"./index-FcUvAZuZ.js";import{M as _}from"./MathUtil-BGCe3rZ3.js";import"./index-FrZezou7.js";import"./index-P5U8LYs6.js";import"./index-Dmfk0azd.js";import"./react-Vu6nbGi5.js";import"./ethers-DHDSyreX.js";import"./index-DXfwhNfH.js";import"./index-CyDCPwX2.js";import"./index-CdfeQ7YK.js";import"./index-nibyPLVP.js";import"./index-BKg37Q5D.js";import"./index.es-C2X55s9j.js";import"./browser-ponyfill-rND5WOqr.js";import"./NetworkUtil-Ddexw9-U.js";import"./index-C1RysQbA.js";import"./ref-BsAZ42-h.js";import"./async-directive-BRxn_Py3.js";const H={numericInputKeyDown(e,t,o){const i=["Backspace","Meta","Ctrl","a","A","c","C","x","X","v","V","ArrowLeft","ArrowRight","Tab"],r=e.metaKey||e.ctrlKey,n=e.key,a=n.toLocaleLowerCase(),c=a==="a",x=a==="c",$=a==="v",U=a==="x",A=n===",",R=n===".",B=n>="0"&&n<="9";!r&&(c||x||$||U)&&e.preventDefault(),t==="0"&&!A&&!R&&n==="0"&&e.preventDefault(),t==="0"&&B&&(o(n),e.preventDefault()),(A||R)&&(t||(o("0."),e.preventDefault()),(t!=null&&t.includes(".")||t!=null&&t.includes(","))&&e.preventDefault()),!B&&!i.includes(n)&&!R&&!A&&e.preventDefault()}},G=C`
1
+ import{i as D,b as u}from"./lit-element-B3y9oplH.js";import{r as l,n as m}from"./class-map-CxwNmq0D.js";import{d as C,r as N,e as V}from"./index-DIMSfymy.js";import{c as L}from"./index-BOQwd6ZB.js";import"./index-BZ5hUBd_.js";import"./index-D3hzhbb8.js";import"./index-D5qOQwpy.js";import{C as S,N as p,d as F,E as W,R as P,b as M,M as K,l as Q,W as q}from"./W3MFrameProviderSingleton-D4DCXtQm.js";import{S as s}from"./SwapController-BDZMxnNb.js";import"./index-CMavzzI_.js";import"./index-C2U9pe20.js";import{M as _}from"./MathUtil-BGCe3rZ3.js";import"./index-LSZxonl2.js";import"./index--_rHc9Od.js";import"./index-C7-iTfFV.js";import"./react-Vu6nbGi5.js";import"./ethers-DHDSyreX.js";import"./index-C6FQ8I_Q.js";import"./index-Pp2oEhTr.js";import"./index-CdfeQ7YK.js";import"./index-nibyPLVP.js";import"./index-jYazATJj.js";import"./index.es-IGCEipYb.js";import"./browser-ponyfill-rND5WOqr.js";import"./NetworkUtil-Ddexw9-U.js";import"./index-CbJmVQBN.js";import"./ref-BsAZ42-h.js";import"./async-directive-BRxn_Py3.js";const H={numericInputKeyDown(e,t,o){const i=["Backspace","Meta","Ctrl","a","A","c","C","x","X","v","V","ArrowLeft","ArrowRight","Tab"],r=e.metaKey||e.ctrlKey,n=e.key,a=n.toLocaleLowerCase(),c=a==="a",x=a==="c",$=a==="v",U=a==="x",A=n===",",R=n===".",B=n>="0"&&n<="9";!r&&(c||x||$||U)&&e.preventDefault(),t==="0"&&!A&&!R&&n==="0"&&e.preventDefault(),t==="0"&&B&&(o(n),e.preventDefault()),(A||R)&&(t||(o("0."),e.preventDefault()),(t!=null&&t.includes(".")||t!=null&&t.includes(","))&&e.preventDefault()),!B&&!i.includes(n)&&!R&&!A&&e.preventDefault()}},G=C`
2
2
  :host {
3
3
  width: 100%;
4
4
  }
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/utils-nbkSUjEy.js","assets/ethers-DHDSyreX.js","assets/react-Vu6nbGi5.js","assets/common-GsSQn_vD.js","assets/signing-BGpVago5.js","assets/index-Dmfk0azd.js","assets/index-DCrqkiFN.css","assets/index-C6QyIhnE.js","assets/parseSignature-3yq9FfJP.js","assets/transactionReceipt-CbcThGoC.js","assets/rpc-BC6ESxMB.js","assets/sha256-bg_KfcLv.js","assets/hashTypedData-CaO8N883.js","assets/ccip-BMCE_sFa.js","assets/parseNft-Yzo9Plhx.js","assets/totalSupply-C5jxuFw1.js","assets/detectExtension-Bdev6B_Y.js","assets/estimate-l1-fee-CkQ_-gw6.js"])))=>i.map(i=>d[i]);
2
- import{e as v,d as ee,c as A,w as St,L as Ct,h as Pt,a as Y,f as $t}from"./utils-nbkSUjEy.js";import{j as I,i as xe,o as ie,aq as Ot,ar as Ue,u as Le,as as Me,C as Z,V as qe,t as Fe,x as j,w as re,g as U,b as X,at as Dt,n as F,au as zt,m as Te,av as Ce,aw as he,ax as We,ay as Ve,az as Ze,af as Rt,aA as He,aB as Ie,aC as me,aD as Ke,aE as Je,aF as $,aa as q,aG as Bt,aH as Ge,d as Nt,aI as jt,aJ as xt,aK as Ut,aL as Lt,aM as Mt,aN as qt,Z as Pe,aO as Ft,aP as Wt,aQ as Vt,aR as Zt,aS as Ht,aT as Kt,Y as Jt,aU as Gt,aV as Qt,aW as Yt,aX as Xt,aY as en,aZ as tn,W as nn,a_ as rn,a$ as on,b0 as sn,b1 as an,b2 as cn,h as dn,b3 as un,S as ln,a as fn,ao as hn,q as mn,b4 as pn,b5 as gn,ab as yn,b6 as wn,r as _n,v as bn,s as kn,b7 as Tn,k as In,b8 as An,ac as vn,ad as En}from"./signing-BGpVago5.js";import{_ as k}from"./index-Dmfk0azd.js";import{a as Qe,b as Ye,e as Sn,w as Cn}from"./wait-for-tx-receipt-BJDKOLGI.js";import{eth_estimateGas as Pn}from"./eth_estimateGas-DaI_qfS7.js";import{a as Xe}from"./transactionReceipt-CbcThGoC.js";import{e as $n}from"./eth_getStorageAt-DqNZYObO.js";import{eth_getTransactionCount as On}from"./eth_getTransactionCount-BBYhaRkF.js";import{decimals as pe}from"./decimals-DnNelAv5.js";import{b as Dn,a as zn,o as Rn,c as Bn,z as Nn,d as jn}from"./zora-sepolia-BQEmh41Y.js";import{a as xn,s as Un}from"./send-batch-transaction-De_pBpa_.js";class R extends Error{constructor(t){super(t.message),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"correlationId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"statusCode",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.code=t.code,this.correlationId=t.correlationId,this.statusCode=t.statusCode}toString(){return I({code:this.code,correlationId:this.correlationId,message:this.message,statusCode:this.statusCode})}}async function Ln(e){const{originChainId:t,originTokenAddress:n,destinationChainId:r,destinationTokenAddress:o,client:s,maxSteps:i}=e,a="buyAmountWei"in e?e.buyAmountWei:e.amount,c=A(s),d=new URL(`${v("bridge")}/v1/buy/quote`);d.searchParams.set("originChainId",t.toString()),d.searchParams.set("originTokenAddress",n),d.searchParams.set("destinationChainId",r.toString()),d.searchParams.set("destinationTokenAddress",o),d.searchParams.set("buyAmountWei",a.toString()),d.searchParams.set("amount",a.toString()),i&&d.searchParams.set("maxSteps",i.toString());const p=await c(d.toString());if(!p.ok){const u=await p.json();throw new R({code:u.code||"UNKNOWN_ERROR",correlationId:u.correlationId||void 0,message:u.message||p.statusText,statusCode:p.status})}const{data:f}=await p.json();return{blockNumber:f.blockNumber?BigInt(f.blockNumber):void 0,destinationAmount:BigInt(f.destinationAmount),estimatedExecutionTimeMs:f.estimatedExecutionTimeMs,intent:{amount:a,buyAmountWei:a,destinationChainId:r,destinationTokenAddress:o,originChainId:t,originTokenAddress:n},originAmount:BigInt(f.originAmount),steps:f.steps,timestamp:f.timestamp}}async function et(e){const{originChainId:t,originTokenAddress:n,destinationChainId:r,destinationTokenAddress:o,sender:s,receiver:i,client:a,amount:c,purchaseData:d,maxSteps:p,paymentLinkId:f,slippageToleranceBps:u}=e,l=A(a),h=new URL(`${v("bridge")}/v1/buy/prepare`),m=await l(h.toString(),{body:I({amount:c.toString(),buyAmountWei:c.toString(),destinationChainId:r.toString(),destinationTokenAddress:o,maxSteps:p,originChainId:t.toString(),originTokenAddress:n,paymentLinkId:f,purchaseData:d,receiver:i,sender:s,slippageToleranceBps:u}),headers:{"Content-Type":"application/json"},method:"POST"});if(!m.ok){const _=await m.json();throw new R({code:_.code||"UNKNOWN_ERROR",correlationId:_.correlationId||void 0,message:_.message||m.statusText,statusCode:m.status})}const{data:y}=await m.json();return{blockNumber:y.blockNumber?BigInt(y.blockNumber):void 0,destinationAmount:BigInt(y.destinationAmount),estimatedExecutionTimeMs:y.estimatedExecutionTimeMs,intent:{amount:c,destinationChainId:r,destinationTokenAddress:o,originChainId:t,originTokenAddress:n,receiver:i,sender:s},originAmount:BigInt(y.originAmount),steps:y.steps.map(_=>({..._,transactions:_.transactions.map(g=>({...g,chain:ee(g.chainId),client:a,value:g.value?BigInt(g.value):void 0}))})),timestamp:y.timestamp}}const Mn=Object.freeze(Object.defineProperty({__proto__:null,prepare:et,quote:Ln},Symbol.toStringTag,{value:"Module"}));async function qn(e){const{client:t}=e;return St(async()=>{const n=A(t),r=new URL(`${v("bridge")}/v1/chains`);e.testnet&&r.searchParams.set("testnet",e.testnet.toString()),"type"in e&&e.type?r.searchParams.set("type",e.type):"originChainId"in e&&e.originChainId?r.searchParams.set("originChainId",e.originChainId.toString()):"destinationChainId"in e&&e.destinationChainId&&r.searchParams.set("destinationChainId",e.destinationChainId.toString());const o=await n(r.toString());if(!o.ok){const i=await o.json();throw new R({code:i.code||"UNKNOWN_ERROR",correlationId:i.correlationId||void 0,message:i.message||o.statusText,statusCode:o.status})}const{data:s}=await o.json();return s},{cacheKey:`bridge-chains-${JSON.stringify(e)}`,cacheTime:1e3*60*60*1})}async function Fn(e){const{id:t,client:n}=e,r=A(n),o=new URL(`${v("bridge")}/v1/onramp/status`);o.searchParams.set("id",t);const s=await r(o.toString());if(!s.ok){const a=await s.json();throw new R({code:a.code||"UNKNOWN_ERROR",correlationId:a.correlationId||void 0,message:a.message||s.statusText,statusCode:s.status})}const{data:i}=await s.json();return i}async function Wn(e){const{client:t,onramp:n,chainId:r,tokenAddress:o,receiver:s,amount:i,purchaseData:a,sender:c,onrampTokenAddress:d,onrampChainId:p,currency:f,maxSteps:u,excludeChainIds:l,paymentLinkId:h,country:m}=e,y=A(t),_=`${v("bridge")}/v1/onramp/prepare`,g={chainId:Number(r),onramp:n,receiver:s,tokenAddress:o};i!==void 0&&(g.amount=i.toString()),a!==void 0&&(g.purchaseData=a),c!==void 0&&(g.sender=c),d!==void 0&&(g.onrampTokenAddress=d),p!==void 0&&(g.onrampChainId=Number(p)),f!==void 0&&(g.currency=f),u!==void 0&&(g.maxSteps=u),l!==void 0&&(g.excludeChainIds=Array.isArray(l)?l.join(","):l),h!==void 0&&(g.paymentLinkId=h),m!==void 0&&(g.country=m);const b=await y(_,{body:I(g),headers:{"Content-Type":"application/json"},method:"POST"});if(!b.ok){const P=await b.json();throw new R({code:P.code||"UNKNOWN_ERROR",correlationId:P.correlationId||void 0,message:P.message||b.statusText,statusCode:b.status})}const{data:w}=await b.json(),E=w.steps.map(P=>({...P,destinationAmount:BigInt(P.destinationAmount),originAmount:BigInt(P.originAmount),transactions:P.transactions.map(L=>({...L,chain:ee(L.chainId),client:t,value:L.value?BigInt(L.value):void 0}))})),N={...w.intent,amount:w.intent.amount?w.intent.amount:void 0};return{...w,destinationAmount:BigInt(w.destinationAmount),intent:N,steps:E}}const Vn=Object.freeze(Object.defineProperty({__proto__:null,prepare:Wn,status:Fn},Symbol.toStringTag,{value:"Module"}));async function Zn(e){const{originChainId:t,originTokenAddress:n,destinationChainId:r,destinationTokenAddress:o,amount:s,client:i,maxSteps:a}=e,c=A(i),d=new URL(`${v("bridge")}/v1/sell/quote`);d.searchParams.set("originChainId",t.toString()),d.searchParams.set("originTokenAddress",n),d.searchParams.set("destinationChainId",r.toString()),d.searchParams.set("destinationTokenAddress",o),d.searchParams.set("sellAmountWei",s.toString()),d.searchParams.set("amount",s.toString()),typeof a<"u"&&d.searchParams.set("maxSteps",a.toString());const p=await c(d.toString());if(!p.ok){const u=await p.json();throw new R({code:u.code||"UNKNOWN_ERROR",correlationId:u.correlationId||void 0,message:u.message||p.statusText,statusCode:p.status})}const{data:f}=await p.json();return{blockNumber:f.blockNumber?BigInt(f.blockNumber):void 0,destinationAmount:BigInt(f.destinationAmount),estimatedExecutionTimeMs:f.estimatedExecutionTimeMs,intent:{amount:s,destinationChainId:r,destinationTokenAddress:o,originChainId:t,originTokenAddress:n},originAmount:BigInt(f.originAmount),steps:f.steps,timestamp:f.timestamp}}async function tt(e){const{originChainId:t,originTokenAddress:n,destinationChainId:r,destinationTokenAddress:o,amount:s,sender:i,receiver:a,client:c,purchaseData:d,maxSteps:p,paymentLinkId:f,slippageToleranceBps:u}=e,l=A(c),h=new URL(`${v("bridge")}/v1/sell/prepare`),m=await l(h.toString(),{body:I({amount:s.toString(),destinationChainId:r.toString(),destinationTokenAddress:o,maxSteps:p,originChainId:t.toString(),originTokenAddress:n,paymentLinkId:f,purchaseData:d,receiver:a,sellAmountWei:s.toString(),sender:i,slippageToleranceBps:u}),headers:{"Content-Type":"application/json"},method:"POST"});if(!m.ok){const _=await m.json();throw new R({code:_.code||"UNKNOWN_ERROR",correlationId:_.correlationId||void 0,message:_.message||m.statusText,statusCode:m.status})}const{data:y}=await m.json();return{blockNumber:y.blockNumber?BigInt(y.blockNumber):void 0,destinationAmount:BigInt(y.destinationAmount),estimatedExecutionTimeMs:y.estimatedExecutionTimeMs,expiration:y.expiration,intent:{amount:s,destinationChainId:r,destinationTokenAddress:o,originChainId:t,originTokenAddress:n,purchaseData:d,receiver:a,sender:i},originAmount:BigInt(y.originAmount),steps:y.steps.map(_=>({..._,transactions:_.transactions.map(g=>({...g,chain:ee(g.chainId),client:c,value:g.value?BigInt(g.value):void 0}))})),timestamp:y.timestamp}}const Hn=Object.freeze(Object.defineProperty({__proto__:null,prepare:tt,quote:Zn},Symbol.toStringTag,{value:"Module"}));async function nt(e){const{transactionHash:t,client:n,transactionId:r}=e,o="chainId"in e?e.chainId:e.chain.id,s=A(n),i=new URL(`${v("bridge")}/v1/status`);i.searchParams.set("transactionHash",t),i.searchParams.set("chainId",o.toString()),r&&i.searchParams.set("transactionId",r);const a=await s(i.toString());if(!a.ok){const d=await a.json();throw new R({code:d.code||"UNKNOWN_ERROR",correlationId:d.correlationId||void 0,message:d.message||a.statusText,statusCode:a.status})}const{data:c}=await a.json();return c.status==="FAILED"?{paymentId:c.paymentId,status:"FAILED",transactions:c.transactions}:c.status==="PENDING"?{destinationChainId:c.destinationChainId,destinationToken:c.destinationToken,destinationTokenAddress:c.destinationTokenAddress,originAmount:BigInt(c.originAmount),originChainId:c.originChainId,originToken:c.originToken,originTokenAddress:c.originTokenAddress,paymentId:c.paymentId,purchaseData:c.purchaseData,receiver:c.receiver,sender:c.sender,status:"PENDING",transactions:c.transactions}:c.status==="NOT_FOUND"?{paymentId:c.paymentId,status:"NOT_FOUND",transactions:[]}:{destinationAmount:BigInt(c.destinationAmount),destinationChainId:c.destinationChainId,destinationToken:c.destinationToken,destinationTokenAddress:c.destinationTokenAddress,originAmount:BigInt(c.originAmount),originChainId:c.originChainId,originToken:c.originToken,originTokenAddress:c.originTokenAddress,paymentId:c.paymentId,purchaseData:c.purchaseData,receiver:c.receiver,sender:c.sender,status:"COMPLETED",transactions:c.transactions}}async function Kn(e){const{client:t,chainId:n,tokenAddress:r,symbol:o,name:s,limit:i,offset:a,includePrices:c,sortBy:d,query:p}=e,f=A(t),u=new URL(`${v("bridge")}/v1/tokens`);n!=null&&u.searchParams.set("chainId",n.toString()),r&&u.searchParams.set("tokenAddress",r),o&&u.searchParams.set("symbol",o),s&&u.searchParams.set("name",s),i!==void 0&&u.searchParams.set("limit",i.toString()),a!=null&&u.searchParams.set("offset",a.toString()),c!==void 0&&u.searchParams.set("includePrices",c.toString()),d!==void 0&&u.searchParams.set("sortBy",d),p!==void 0&&u.searchParams.set("query",p);const l=await f(u.toString());if(!l.ok){const m=await l.json();throw new R({code:m.code||"UNKNOWN_ERROR",correlationId:m.correlationId||void 0,message:m.message||l.statusText,statusCode:l.status})}const{data:h}=await l.json();return h}async function rt(e){const{chainId:t,tokenAddress:n,sender:r,receiver:o,client:s,amount:i,purchaseData:a,feePayer:c,paymentLinkId:d}=e,p=A(s),f=new URL(`${v("bridge")}/v1/transfer/prepare`),u=await p(f.toString(),{body:I({amount:i.toString(),chainId:t.toString(),feePayer:c,paymentLinkId:d,purchaseData:a,receiver:o,sender:r,tokenAddress:n,transferAmountWei:i.toString()}),headers:{"Content-Type":"application/json"},method:"POST"});if(!u.ok){const h=await u.json();throw new R({code:h.code||"UNKNOWN_ERROR",correlationId:h.correlationId||void 0,message:h.message||u.statusText,statusCode:u.status})}const{data:l}=await u.json();return{blockNumber:l.blockNumber?BigInt(l.blockNumber):void 0,destinationAmount:BigInt(l.destinationAmount),estimatedExecutionTimeMs:l.estimatedExecutionTimeMs,intent:{amount:i,chainId:t,feePayer:c,receiver:o,sender:r,tokenAddress:n},originAmount:BigInt(l.originAmount),steps:l.steps.map(h=>({...h,transactions:h.transactions.map(m=>({...m,chain:ee(m.chainId),client:s,value:m.value?BigInt(m.value):void 0}))})),timestamp:l.timestamp}}const Jn=Object.freeze(Object.defineProperty({__proto__:null,prepare:rt},Symbol.toStringTag,{value:"Module"}));function T(e,t,n){function r(a,c){var d;Object.defineProperty(a,"_zod",{value:a._zod??{},enumerable:!1}),(d=a._zod).traits??(d.traits=new Set),a._zod.traits.add(e),t(a,c);for(const p in i.prototype)p in a||Object.defineProperty(a,p,{value:i.prototype[p].bind(a)});a._zod.constr=i,a._zod.def=c}const o=(n==null?void 0:n.Parent)??Object;class s extends o{}Object.defineProperty(s,"name",{value:e});function i(a){var c;const d=n!=null&&n.Parent?new s:this;r(d,a),(c=d._zod).deferred??(c.deferred=[]);for(const p of d._zod.deferred)p();return d}return Object.defineProperty(i,"init",{value:r}),Object.defineProperty(i,Symbol.hasInstance,{value:a=>{var c,d;return n!=null&&n.Parent&&a instanceof n.Parent?!0:(d=(c=a==null?void 0:a._zod)==null?void 0:c.traits)==null?void 0:d.has(e)}}),Object.defineProperty(i,"name",{value:e}),i}class oe extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}const ot={};function H(e){return ot}function Gn(e){const t=Object.values(e).filter(r=>typeof r=="number");return Object.entries(e).filter(([r,o])=>t.indexOf(+r)===-1).map(([r,o])=>o)}function Qn(e,t){return typeof t=="bigint"?t.toString():t}function Ae(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function st(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function B(e,t,n){Object.defineProperty(e,t,{get(){{const r=n();return e[t]=r,r}},set(r){Object.defineProperty(e,t,{value:r})},configurable:!0})}function Yn(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function G(e){return JSON.stringify(e)}const it=Error.captureStackTrace?Error.captureStackTrace:(...e)=>{};function se(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const Xn=Ae(()=>{var e;if(typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)!=null&&e.includes("Cloudflare")))return!1;try{const t=Function;return new t(""),!0}catch{return!1}});function er(e){if(se(e)===!1)return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(se(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}const tr=new Set(["string","number","symbol"]);function at(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function nr(e,t,n){const r=new e._zod.constr(t??e._zod.def);return(!t||n!=null&&n.parent)&&(r._zod.parent=e),r}function D(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if((t==null?void 0:t.message)!==void 0){if((t==null?void 0:t.error)!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function rr(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}function de(e,t=0){var n;for(let r=t;r<e.issues.length;r++)if(((n=e.issues[r])==null?void 0:n.continue)!==!0)return!0;return!1}function M(e,t){return t.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function te(e){return typeof e=="string"?e:e==null?void 0:e.message}function K(e,t,n){var o,s,i,a,c,d;const r={...e,path:e.path??[]};if(!e.message){const p=te((i=(s=(o=e.inst)==null?void 0:o._zod.def)==null?void 0:s.error)==null?void 0:i.call(s,e))??te((a=t==null?void 0:t.error)==null?void 0:a.call(t,e))??te((c=n.customError)==null?void 0:c.call(n,e))??te((d=n.localeError)==null?void 0:d.call(n,e))??"Invalid input";r.message=p}return delete r.inst,delete r.continue,t!=null&&t.reportInput||delete r.input,r}function or(...e){const[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:{...t}}const ct=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),Object.defineProperty(e,"message",{get(){return JSON.stringify(t,Qn,2)},enumerable:!0})},sr=T("$ZodError",ct),ae=T("$ZodError",ct,{Parent:Error}),ir=e=>(t,n,r,o)=>{const s=r?Object.assign(r,{async:!1}):{async:!1},i=t._zod.run({value:n,issues:[]},s);if(i instanceof Promise)throw new oe;if(i.issues.length){const a=new((o==null?void 0:o.Err)??e)(i.issues.map(c=>K(c,s,H())));throw it(a,o==null?void 0:o.callee),a}return i.value},ar=ir(ae),cr=e=>async(t,n,r,o)=>{const s=r?Object.assign(r,{async:!0}):{async:!0};let i=t._zod.run({value:n,issues:[]},s);if(i instanceof Promise&&(i=await i),i.issues.length){const a=new((o==null?void 0:o.Err)??e)(i.issues.map(c=>K(c,s,H())));throw it(a,o==null?void 0:o.callee),a}return i.value},dr=cr(ae),ur=e=>(t,n,r)=>{const o=r?{...r,async:!1}:{async:!1},s=t._zod.run({value:n,issues:[]},o);if(s instanceof Promise)throw new oe;return s.issues.length?{success:!1,error:new(e??sr)(s.issues.map(i=>K(i,o,H())))}:{success:!0,data:s.value}},dt=ur(ae),lr=e=>async(t,n,r)=>{const o=r?Object.assign(r,{async:!0}):{async:!0};let s=t._zod.run({value:n,issues:[]},o);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new e(s.issues.map(i=>K(i,o,H())))}:{success:!0,data:s.value}},ut=lr(ae),fr=e=>{const t=e?`[\\s\\S]{${(e==null?void 0:e.minimum)??0},${(e==null?void 0:e.maximum)??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},hr=/^\d+n?$/,mr=/^-?\d+(?:\.\d+)?/i,pr=T("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])});class gr{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const r=t.split(`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/utils-nbkSUjEy.js","assets/ethers-DHDSyreX.js","assets/react-Vu6nbGi5.js","assets/common-GsSQn_vD.js","assets/signing-CoPa7cSW.js","assets/index-C7-iTfFV.js","assets/index-DCrqkiFN.css","assets/index-C2OMQVG4.js","assets/parseSignature-ClLI6O4f.js","assets/transactionReceipt-C2iQ3ozz.js","assets/rpc-BA0W82l4.js","assets/sha256-BxR-wXll.js","assets/hashTypedData-DX5YrpbP.js","assets/ccip-7fqLW_t2.js","assets/parseNft-B-POJxiL.js","assets/totalSupply-BCZn9Djj.js","assets/detectExtension-DsE82Ej6.js","assets/estimate-l1-fee-Bqou6JLl.js"])))=>i.map(i=>d[i]);
2
+ import{e as v,d as ee,c as A,w as St,L as Ct,h as Pt,a as Y,f as $t}from"./utils-nbkSUjEy.js";import{j as I,i as xe,o as ie,aq as Ot,ar as Ue,u as Le,as as Me,C as Z,V as qe,t as Fe,x as j,w as re,g as U,b as X,at as Dt,n as F,au as zt,m as Te,av as Ce,aw as he,ax as We,ay as Ve,az as Ze,af as Rt,aA as He,aB as Ie,aC as me,aD as Ke,aE as Je,aF as $,aa as q,aG as Bt,aH as Ge,d as Nt,aI as jt,aJ as xt,aK as Ut,aL as Lt,aM as Mt,aN as qt,Z as Pe,aO as Ft,aP as Wt,aQ as Vt,aR as Zt,aS as Ht,aT as Kt,Y as Jt,aU as Gt,aV as Qt,aW as Yt,aX as Xt,aY as en,aZ as tn,W as nn,a_ as rn,a$ as on,b0 as sn,b1 as an,b2 as cn,h as dn,b3 as un,S as ln,a as fn,ao as hn,q as mn,b4 as pn,b5 as gn,ab as yn,b6 as wn,r as _n,v as bn,s as kn,b7 as Tn,k as In,b8 as An,ac as vn,ad as En}from"./signing-CoPa7cSW.js";import{_ as k}from"./index-C7-iTfFV.js";import{a as Qe,b as Ye,e as Sn,w as Cn}from"./wait-for-tx-receipt-Dm2aAIs1.js";import{eth_estimateGas as Pn}from"./eth_estimateGas-CarYiSgL.js";import{a as Xe}from"./transactionReceipt-C2iQ3ozz.js";import{e as $n}from"./eth_getStorageAt-B-cqm2CG.js";import{eth_getTransactionCount as On}from"./eth_getTransactionCount-Dfx3JW2Q.js";import{decimals as pe}from"./decimals-ByIlBo-2.js";import{b as Dn,a as zn,o as Rn,c as Bn,z as Nn,d as jn}from"./zora-sepolia-BQEmh41Y.js";import{a as xn,s as Un}from"./send-batch-transaction-D1j9aZww.js";class R extends Error{constructor(t){super(t.message),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"correlationId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"statusCode",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.code=t.code,this.correlationId=t.correlationId,this.statusCode=t.statusCode}toString(){return I({code:this.code,correlationId:this.correlationId,message:this.message,statusCode:this.statusCode})}}async function Ln(e){const{originChainId:t,originTokenAddress:n,destinationChainId:r,destinationTokenAddress:o,client:s,maxSteps:i}=e,a="buyAmountWei"in e?e.buyAmountWei:e.amount,c=A(s),d=new URL(`${v("bridge")}/v1/buy/quote`);d.searchParams.set("originChainId",t.toString()),d.searchParams.set("originTokenAddress",n),d.searchParams.set("destinationChainId",r.toString()),d.searchParams.set("destinationTokenAddress",o),d.searchParams.set("buyAmountWei",a.toString()),d.searchParams.set("amount",a.toString()),i&&d.searchParams.set("maxSteps",i.toString());const p=await c(d.toString());if(!p.ok){const u=await p.json();throw new R({code:u.code||"UNKNOWN_ERROR",correlationId:u.correlationId||void 0,message:u.message||p.statusText,statusCode:p.status})}const{data:f}=await p.json();return{blockNumber:f.blockNumber?BigInt(f.blockNumber):void 0,destinationAmount:BigInt(f.destinationAmount),estimatedExecutionTimeMs:f.estimatedExecutionTimeMs,intent:{amount:a,buyAmountWei:a,destinationChainId:r,destinationTokenAddress:o,originChainId:t,originTokenAddress:n},originAmount:BigInt(f.originAmount),steps:f.steps,timestamp:f.timestamp}}async function et(e){const{originChainId:t,originTokenAddress:n,destinationChainId:r,destinationTokenAddress:o,sender:s,receiver:i,client:a,amount:c,purchaseData:d,maxSteps:p,paymentLinkId:f,slippageToleranceBps:u}=e,l=A(a),h=new URL(`${v("bridge")}/v1/buy/prepare`),m=await l(h.toString(),{body:I({amount:c.toString(),buyAmountWei:c.toString(),destinationChainId:r.toString(),destinationTokenAddress:o,maxSteps:p,originChainId:t.toString(),originTokenAddress:n,paymentLinkId:f,purchaseData:d,receiver:i,sender:s,slippageToleranceBps:u}),headers:{"Content-Type":"application/json"},method:"POST"});if(!m.ok){const _=await m.json();throw new R({code:_.code||"UNKNOWN_ERROR",correlationId:_.correlationId||void 0,message:_.message||m.statusText,statusCode:m.status})}const{data:y}=await m.json();return{blockNumber:y.blockNumber?BigInt(y.blockNumber):void 0,destinationAmount:BigInt(y.destinationAmount),estimatedExecutionTimeMs:y.estimatedExecutionTimeMs,intent:{amount:c,destinationChainId:r,destinationTokenAddress:o,originChainId:t,originTokenAddress:n,receiver:i,sender:s},originAmount:BigInt(y.originAmount),steps:y.steps.map(_=>({..._,transactions:_.transactions.map(g=>({...g,chain:ee(g.chainId),client:a,value:g.value?BigInt(g.value):void 0}))})),timestamp:y.timestamp}}const Mn=Object.freeze(Object.defineProperty({__proto__:null,prepare:et,quote:Ln},Symbol.toStringTag,{value:"Module"}));async function qn(e){const{client:t}=e;return St(async()=>{const n=A(t),r=new URL(`${v("bridge")}/v1/chains`);e.testnet&&r.searchParams.set("testnet",e.testnet.toString()),"type"in e&&e.type?r.searchParams.set("type",e.type):"originChainId"in e&&e.originChainId?r.searchParams.set("originChainId",e.originChainId.toString()):"destinationChainId"in e&&e.destinationChainId&&r.searchParams.set("destinationChainId",e.destinationChainId.toString());const o=await n(r.toString());if(!o.ok){const i=await o.json();throw new R({code:i.code||"UNKNOWN_ERROR",correlationId:i.correlationId||void 0,message:i.message||o.statusText,statusCode:o.status})}const{data:s}=await o.json();return s},{cacheKey:`bridge-chains-${JSON.stringify(e)}`,cacheTime:1e3*60*60*1})}async function Fn(e){const{id:t,client:n}=e,r=A(n),o=new URL(`${v("bridge")}/v1/onramp/status`);o.searchParams.set("id",t);const s=await r(o.toString());if(!s.ok){const a=await s.json();throw new R({code:a.code||"UNKNOWN_ERROR",correlationId:a.correlationId||void 0,message:a.message||s.statusText,statusCode:s.status})}const{data:i}=await s.json();return i}async function Wn(e){const{client:t,onramp:n,chainId:r,tokenAddress:o,receiver:s,amount:i,purchaseData:a,sender:c,onrampTokenAddress:d,onrampChainId:p,currency:f,maxSteps:u,excludeChainIds:l,paymentLinkId:h,country:m}=e,y=A(t),_=`${v("bridge")}/v1/onramp/prepare`,g={chainId:Number(r),onramp:n,receiver:s,tokenAddress:o};i!==void 0&&(g.amount=i.toString()),a!==void 0&&(g.purchaseData=a),c!==void 0&&(g.sender=c),d!==void 0&&(g.onrampTokenAddress=d),p!==void 0&&(g.onrampChainId=Number(p)),f!==void 0&&(g.currency=f),u!==void 0&&(g.maxSteps=u),l!==void 0&&(g.excludeChainIds=Array.isArray(l)?l.join(","):l),h!==void 0&&(g.paymentLinkId=h),m!==void 0&&(g.country=m);const b=await y(_,{body:I(g),headers:{"Content-Type":"application/json"},method:"POST"});if(!b.ok){const P=await b.json();throw new R({code:P.code||"UNKNOWN_ERROR",correlationId:P.correlationId||void 0,message:P.message||b.statusText,statusCode:b.status})}const{data:w}=await b.json(),E=w.steps.map(P=>({...P,destinationAmount:BigInt(P.destinationAmount),originAmount:BigInt(P.originAmount),transactions:P.transactions.map(L=>({...L,chain:ee(L.chainId),client:t,value:L.value?BigInt(L.value):void 0}))})),N={...w.intent,amount:w.intent.amount?w.intent.amount:void 0};return{...w,destinationAmount:BigInt(w.destinationAmount),intent:N,steps:E}}const Vn=Object.freeze(Object.defineProperty({__proto__:null,prepare:Wn,status:Fn},Symbol.toStringTag,{value:"Module"}));async function Zn(e){const{originChainId:t,originTokenAddress:n,destinationChainId:r,destinationTokenAddress:o,amount:s,client:i,maxSteps:a}=e,c=A(i),d=new URL(`${v("bridge")}/v1/sell/quote`);d.searchParams.set("originChainId",t.toString()),d.searchParams.set("originTokenAddress",n),d.searchParams.set("destinationChainId",r.toString()),d.searchParams.set("destinationTokenAddress",o),d.searchParams.set("sellAmountWei",s.toString()),d.searchParams.set("amount",s.toString()),typeof a<"u"&&d.searchParams.set("maxSteps",a.toString());const p=await c(d.toString());if(!p.ok){const u=await p.json();throw new R({code:u.code||"UNKNOWN_ERROR",correlationId:u.correlationId||void 0,message:u.message||p.statusText,statusCode:p.status})}const{data:f}=await p.json();return{blockNumber:f.blockNumber?BigInt(f.blockNumber):void 0,destinationAmount:BigInt(f.destinationAmount),estimatedExecutionTimeMs:f.estimatedExecutionTimeMs,intent:{amount:s,destinationChainId:r,destinationTokenAddress:o,originChainId:t,originTokenAddress:n},originAmount:BigInt(f.originAmount),steps:f.steps,timestamp:f.timestamp}}async function tt(e){const{originChainId:t,originTokenAddress:n,destinationChainId:r,destinationTokenAddress:o,amount:s,sender:i,receiver:a,client:c,purchaseData:d,maxSteps:p,paymentLinkId:f,slippageToleranceBps:u}=e,l=A(c),h=new URL(`${v("bridge")}/v1/sell/prepare`),m=await l(h.toString(),{body:I({amount:s.toString(),destinationChainId:r.toString(),destinationTokenAddress:o,maxSteps:p,originChainId:t.toString(),originTokenAddress:n,paymentLinkId:f,purchaseData:d,receiver:a,sellAmountWei:s.toString(),sender:i,slippageToleranceBps:u}),headers:{"Content-Type":"application/json"},method:"POST"});if(!m.ok){const _=await m.json();throw new R({code:_.code||"UNKNOWN_ERROR",correlationId:_.correlationId||void 0,message:_.message||m.statusText,statusCode:m.status})}const{data:y}=await m.json();return{blockNumber:y.blockNumber?BigInt(y.blockNumber):void 0,destinationAmount:BigInt(y.destinationAmount),estimatedExecutionTimeMs:y.estimatedExecutionTimeMs,expiration:y.expiration,intent:{amount:s,destinationChainId:r,destinationTokenAddress:o,originChainId:t,originTokenAddress:n,purchaseData:d,receiver:a,sender:i},originAmount:BigInt(y.originAmount),steps:y.steps.map(_=>({..._,transactions:_.transactions.map(g=>({...g,chain:ee(g.chainId),client:c,value:g.value?BigInt(g.value):void 0}))})),timestamp:y.timestamp}}const Hn=Object.freeze(Object.defineProperty({__proto__:null,prepare:tt,quote:Zn},Symbol.toStringTag,{value:"Module"}));async function nt(e){const{transactionHash:t,client:n,transactionId:r}=e,o="chainId"in e?e.chainId:e.chain.id,s=A(n),i=new URL(`${v("bridge")}/v1/status`);i.searchParams.set("transactionHash",t),i.searchParams.set("chainId",o.toString()),r&&i.searchParams.set("transactionId",r);const a=await s(i.toString());if(!a.ok){const d=await a.json();throw new R({code:d.code||"UNKNOWN_ERROR",correlationId:d.correlationId||void 0,message:d.message||a.statusText,statusCode:a.status})}const{data:c}=await a.json();return c.status==="FAILED"?{paymentId:c.paymentId,status:"FAILED",transactions:c.transactions}:c.status==="PENDING"?{destinationChainId:c.destinationChainId,destinationToken:c.destinationToken,destinationTokenAddress:c.destinationTokenAddress,originAmount:BigInt(c.originAmount),originChainId:c.originChainId,originToken:c.originToken,originTokenAddress:c.originTokenAddress,paymentId:c.paymentId,purchaseData:c.purchaseData,receiver:c.receiver,sender:c.sender,status:"PENDING",transactions:c.transactions}:c.status==="NOT_FOUND"?{paymentId:c.paymentId,status:"NOT_FOUND",transactions:[]}:{destinationAmount:BigInt(c.destinationAmount),destinationChainId:c.destinationChainId,destinationToken:c.destinationToken,destinationTokenAddress:c.destinationTokenAddress,originAmount:BigInt(c.originAmount),originChainId:c.originChainId,originToken:c.originToken,originTokenAddress:c.originTokenAddress,paymentId:c.paymentId,purchaseData:c.purchaseData,receiver:c.receiver,sender:c.sender,status:"COMPLETED",transactions:c.transactions}}async function Kn(e){const{client:t,chainId:n,tokenAddress:r,symbol:o,name:s,limit:i,offset:a,includePrices:c,sortBy:d,query:p}=e,f=A(t),u=new URL(`${v("bridge")}/v1/tokens`);n!=null&&u.searchParams.set("chainId",n.toString()),r&&u.searchParams.set("tokenAddress",r),o&&u.searchParams.set("symbol",o),s&&u.searchParams.set("name",s),i!==void 0&&u.searchParams.set("limit",i.toString()),a!=null&&u.searchParams.set("offset",a.toString()),c!==void 0&&u.searchParams.set("includePrices",c.toString()),d!==void 0&&u.searchParams.set("sortBy",d),p!==void 0&&u.searchParams.set("query",p);const l=await f(u.toString());if(!l.ok){const m=await l.json();throw new R({code:m.code||"UNKNOWN_ERROR",correlationId:m.correlationId||void 0,message:m.message||l.statusText,statusCode:l.status})}const{data:h}=await l.json();return h}async function rt(e){const{chainId:t,tokenAddress:n,sender:r,receiver:o,client:s,amount:i,purchaseData:a,feePayer:c,paymentLinkId:d}=e,p=A(s),f=new URL(`${v("bridge")}/v1/transfer/prepare`),u=await p(f.toString(),{body:I({amount:i.toString(),chainId:t.toString(),feePayer:c,paymentLinkId:d,purchaseData:a,receiver:o,sender:r,tokenAddress:n,transferAmountWei:i.toString()}),headers:{"Content-Type":"application/json"},method:"POST"});if(!u.ok){const h=await u.json();throw new R({code:h.code||"UNKNOWN_ERROR",correlationId:h.correlationId||void 0,message:h.message||u.statusText,statusCode:u.status})}const{data:l}=await u.json();return{blockNumber:l.blockNumber?BigInt(l.blockNumber):void 0,destinationAmount:BigInt(l.destinationAmount),estimatedExecutionTimeMs:l.estimatedExecutionTimeMs,intent:{amount:i,chainId:t,feePayer:c,receiver:o,sender:r,tokenAddress:n},originAmount:BigInt(l.originAmount),steps:l.steps.map(h=>({...h,transactions:h.transactions.map(m=>({...m,chain:ee(m.chainId),client:s,value:m.value?BigInt(m.value):void 0}))})),timestamp:l.timestamp}}const Jn=Object.freeze(Object.defineProperty({__proto__:null,prepare:rt},Symbol.toStringTag,{value:"Module"}));function T(e,t,n){function r(a,c){var d;Object.defineProperty(a,"_zod",{value:a._zod??{},enumerable:!1}),(d=a._zod).traits??(d.traits=new Set),a._zod.traits.add(e),t(a,c);for(const p in i.prototype)p in a||Object.defineProperty(a,p,{value:i.prototype[p].bind(a)});a._zod.constr=i,a._zod.def=c}const o=(n==null?void 0:n.Parent)??Object;class s extends o{}Object.defineProperty(s,"name",{value:e});function i(a){var c;const d=n!=null&&n.Parent?new s:this;r(d,a),(c=d._zod).deferred??(c.deferred=[]);for(const p of d._zod.deferred)p();return d}return Object.defineProperty(i,"init",{value:r}),Object.defineProperty(i,Symbol.hasInstance,{value:a=>{var c,d;return n!=null&&n.Parent&&a instanceof n.Parent?!0:(d=(c=a==null?void 0:a._zod)==null?void 0:c.traits)==null?void 0:d.has(e)}}),Object.defineProperty(i,"name",{value:e}),i}class oe extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}const ot={};function H(e){return ot}function Gn(e){const t=Object.values(e).filter(r=>typeof r=="number");return Object.entries(e).filter(([r,o])=>t.indexOf(+r)===-1).map(([r,o])=>o)}function Qn(e,t){return typeof t=="bigint"?t.toString():t}function Ae(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function st(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function B(e,t,n){Object.defineProperty(e,t,{get(){{const r=n();return e[t]=r,r}},set(r){Object.defineProperty(e,t,{value:r})},configurable:!0})}function Yn(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function G(e){return JSON.stringify(e)}const it=Error.captureStackTrace?Error.captureStackTrace:(...e)=>{};function se(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const Xn=Ae(()=>{var e;if(typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)!=null&&e.includes("Cloudflare")))return!1;try{const t=Function;return new t(""),!0}catch{return!1}});function er(e){if(se(e)===!1)return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(se(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}const tr=new Set(["string","number","symbol"]);function at(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function nr(e,t,n){const r=new e._zod.constr(t??e._zod.def);return(!t||n!=null&&n.parent)&&(r._zod.parent=e),r}function D(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if((t==null?void 0:t.message)!==void 0){if((t==null?void 0:t.error)!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function rr(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}function de(e,t=0){var n;for(let r=t;r<e.issues.length;r++)if(((n=e.issues[r])==null?void 0:n.continue)!==!0)return!0;return!1}function M(e,t){return t.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function te(e){return typeof e=="string"?e:e==null?void 0:e.message}function K(e,t,n){var o,s,i,a,c,d;const r={...e,path:e.path??[]};if(!e.message){const p=te((i=(s=(o=e.inst)==null?void 0:o._zod.def)==null?void 0:s.error)==null?void 0:i.call(s,e))??te((a=t==null?void 0:t.error)==null?void 0:a.call(t,e))??te((c=n.customError)==null?void 0:c.call(n,e))??te((d=n.localeError)==null?void 0:d.call(n,e))??"Invalid input";r.message=p}return delete r.inst,delete r.continue,t!=null&&t.reportInput||delete r.input,r}function or(...e){const[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:{...t}}const ct=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),Object.defineProperty(e,"message",{get(){return JSON.stringify(t,Qn,2)},enumerable:!0})},sr=T("$ZodError",ct),ae=T("$ZodError",ct,{Parent:Error}),ir=e=>(t,n,r,o)=>{const s=r?Object.assign(r,{async:!1}):{async:!1},i=t._zod.run({value:n,issues:[]},s);if(i instanceof Promise)throw new oe;if(i.issues.length){const a=new((o==null?void 0:o.Err)??e)(i.issues.map(c=>K(c,s,H())));throw it(a,o==null?void 0:o.callee),a}return i.value},ar=ir(ae),cr=e=>async(t,n,r,o)=>{const s=r?Object.assign(r,{async:!0}):{async:!0};let i=t._zod.run({value:n,issues:[]},s);if(i instanceof Promise&&(i=await i),i.issues.length){const a=new((o==null?void 0:o.Err)??e)(i.issues.map(c=>K(c,s,H())));throw it(a,o==null?void 0:o.callee),a}return i.value},dr=cr(ae),ur=e=>(t,n,r)=>{const o=r?{...r,async:!1}:{async:!1},s=t._zod.run({value:n,issues:[]},o);if(s instanceof Promise)throw new oe;return s.issues.length?{success:!1,error:new(e??sr)(s.issues.map(i=>K(i,o,H())))}:{success:!0,data:s.value}},dt=ur(ae),lr=e=>async(t,n,r)=>{const o=r?Object.assign(r,{async:!0}):{async:!0};let s=t._zod.run({value:n,issues:[]},o);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new e(s.issues.map(i=>K(i,o,H())))}:{success:!0,data:s.value}},ut=lr(ae),fr=e=>{const t=e?`[\\s\\S]{${(e==null?void 0:e.minimum)??0},${(e==null?void 0:e.maximum)??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},hr=/^\d+n?$/,mr=/^-?\d+(?:\.\d+)?/i,pr=T("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])});class gr{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const r=t.split(`
3
3
  `).filter(i=>i),o=Math.min(...r.map(i=>i.length-i.trimStart().length)),s=r.map(i=>i.slice(o)).map(i=>" ".repeat(this.indent*2)+i);for(const i of s)this.content.push(i)}compile(){const t=Function,n=this==null?void 0:this.args,o=[...((this==null?void 0:this.content)??[""]).map(s=>` ${s}`)];return new t(...n,o.join(`
4
4
  `))}}const yr={major:4,minor:0,patch:0},C=T("$ZodType",(e,t)=>{var o;var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=yr;const r=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(const s of r)for(const i of s._zod.onattach)i(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),(o=e._zod.deferred)==null||o.push(()=>{e._zod.run=e._zod.parse});else{const s=(i,a,c)=>{let d=de(i),p;for(const f of a){if(f._zod.when){if(!f._zod.when(i))continue}else if(d)continue;const u=i.issues.length,l=f._zod.check(i);if(l instanceof Promise&&(c==null?void 0:c.async)===!1)throw new oe;if(p||l instanceof Promise)p=(p??Promise.resolve()).then(async()=>{await l,i.issues.length!==u&&(d||(d=de(i,u)))});else{if(i.issues.length===u)continue;d||(d=de(i,u))}}return p?p.then(()=>i):i};e._zod.run=(i,a)=>{const c=e._zod.parse(i,a);if(c instanceof Promise){if(a.async===!1)throw new oe;return c.then(d=>s(d,r,a))}return s(c,r,a)}}e["~standard"]={validate:s=>{var i;try{const a=dt(e,s);return a.success?{value:a.data}:{issues:(i=a.error)==null?void 0:i.issues}}catch{return ut(e,s).then(c=>{var d;return c.success?{value:c.data}:{issues:(d=c.error)==null?void 0:d.issues}})}},vendor:"zod",version:1}}),wr=T("$ZodString",(e,t)=>{var n;C.init(e,t),e._zod.pattern=[...((n=e==null?void 0:e._zod.bag)==null?void 0:n.patterns)??[]].pop()??fr(e._zod.bag),e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),_r=T("$ZodNumber",(e,t)=>{C.init(e,t),e._zod.pattern=e._zod.bag.pattern??mr,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}const o=n.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return n;const s=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...s?{received:s}:{}}),n}}),br=T("$ZodBigInt",(e,t)=>{C.init(e,t),e._zod.pattern=hr,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=BigInt(n.value)}catch{}return typeof n.value=="bigint"||n.issues.push({expected:"bigint",code:"invalid_type",input:n.value,inst:e}),n}}),kr=T("$ZodUnknown",(e,t)=>{C.init(e,t),e._zod.parse=n=>n});function $e(e,t,n){e.issues.length&&t.issues.push(...M(n,e.issues)),t.value[n]=e.value}const Tr=T("$ZodArray",(e,t)=>{C.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!Array.isArray(o))return n.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),n;n.value=Array(o.length);const s=[];for(let i=0;i<o.length;i++){const a=o[i],c=t.element._zod.run({value:a,issues:[]},r);c instanceof Promise?s.push(c.then(d=>$e(d,n,i))):$e(c,n,i)}return s.length?Promise.all(s).then(()=>n):n}});function ne(e,t,n){e.issues.length&&t.issues.push(...M(n,e.issues)),t.value[n]=e.value}function Oe(e,t,n,r){e.issues.length?r[n]===void 0?n in r?t.value[n]=void 0:t.value[n]=e.value:t.issues.push(...M(n,e.issues)):e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}const Ir=T("$ZodObject",(e,t)=>{C.init(e,t);const n=Ae(()=>{const f=Object.keys(t.shape);for(const l of f)if(!(t.shape[l]instanceof C))throw new Error(`Invalid element at key "${l}": expected a Zod schema`);const u=rr(t.shape);return{shape:t.shape,keys:f,keySet:new Set(f),numKeys:f.length,optionalKeys:new Set(u)}});B(e._zod,"propValues",()=>{const f=t.shape,u={};for(const l in f){const h=f[l]._zod;if(h.values){u[l]??(u[l]=new Set);for(const m of h.values)u[l].add(m)}}return u});const r=f=>{const u=new gr(["shape","payload","ctx"]),l=n.value,h=g=>{const b=G(g);return`shape[${b}]._zod.run({ value: input[${b}], issues: [] }, ctx)`};u.write("const input = payload.value;");const m=Object.create(null);let y=0;for(const g of l.keys)m[g]=`key_${y++}`;u.write("const newResult = {}");for(const g of l.keys)if(l.optionalKeys.has(g)){const b=m[g];u.write(`const ${b} = ${h(g)};`);const w=G(g);u.write(`
5
5
  if (${b}.issues.length) {
@@ -24,4 +24,4 @@ import{e as v,d as ee,c as A,w as St,L as Ct,h as Pt,a as Y,f as $t}from"./utils
24
24
  if (${b}.issues.length) payload.issues = payload.issues.concat(${b}.issues.map(iss => ({
25
25
  ...iss,
26
26
  path: iss.path ? [${G(g)}, ...iss.path] : [${G(g)}]
27
- })));`),u.write(`newResult[${G(g)}] = ${b}.value`)}u.write("payload.value = newResult;"),u.write("return payload;");const _=u.compile();return(g,b)=>_(f,g,b)};let o;const s=se,i=!ot.jitless,c=i&&Xn.value,d=t.catchall;let p;e._zod.parse=(f,u)=>{p??(p=n.value);const l=f.value;if(!s(l))return f.issues.push({expected:"object",code:"invalid_type",input:l,inst:e}),f;const h=[];if(i&&c&&(u==null?void 0:u.async)===!1&&u.jitless!==!0)o||(o=r(t.shape)),f=o(f,u);else{f.value={};const b=p.shape;for(const w of p.keys){const E=b[w],N=E._zod.run({value:l[w],issues:[]},u),P=E._zod.optin==="optional"&&E._zod.optout==="optional";N instanceof Promise?h.push(N.then(L=>P?Oe(L,f,w,l):ne(L,f,w))):P?Oe(N,f,w,l):ne(N,f,w)}}if(!d)return h.length?Promise.all(h).then(()=>f):f;const m=[],y=p.keySet,_=d._zod,g=_.def.type;for(const b of Object.keys(l)){if(y.has(b))continue;if(g==="never"){m.push(b);continue}const w=_.run({value:l[b],issues:[]},u);w instanceof Promise?h.push(w.then(E=>ne(E,f,b))):ne(w,f,b)}return m.length&&f.issues.push({code:"unrecognized_keys",keys:m,input:l,inst:e}),h.length?Promise.all(h).then(()=>f):f}});function De(e,t,n,r){for(const o of e)if(o.issues.length===0)return t.value=o.value,t;return t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(o=>o.issues.map(s=>K(s,r,H())))}),t}const Ar=T("$ZodUnion",(e,t)=>{C.init(e,t),B(e._zod,"optin",()=>t.options.some(n=>n._zod.optin==="optional")?"optional":void 0),B(e._zod,"optout",()=>t.options.some(n=>n._zod.optout==="optional")?"optional":void 0),B(e._zod,"values",()=>{if(t.options.every(n=>n._zod.values))return new Set(t.options.flatMap(n=>Array.from(n._zod.values)))}),B(e._zod,"pattern",()=>{if(t.options.every(n=>n._zod.pattern)){const n=t.options.map(r=>r._zod.pattern);return new RegExp(`^(${n.map(r=>st(r.source)).join("|")})$`)}}),e._zod.parse=(n,r)=>{let o=!1;const s=[];for(const i of t.options){const a=i._zod.run({value:n.value,issues:[]},r);if(a instanceof Promise)s.push(a),o=!0;else{if(a.issues.length===0)return a;s.push(a)}}return o?Promise.all(s).then(i=>De(i,n,e,r)):De(s,n,e,r)}}),vr=T("$ZodDiscriminatedUnion",(e,t)=>{Ar.init(e,t);const n=e._zod.parse;B(e._zod,"propValues",()=>{const o={};for(const s of t.options){const i=s._zod.propValues;if(!i||Object.keys(i).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(const[a,c]of Object.entries(i)){o[a]||(o[a]=new Set);for(const d of c)o[a].add(d)}}return o});const r=Ae(()=>{const o=t.options,s=new Map;for(const i of o){const a=i._zod.propValues[t.discriminator];if(!a||a.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(const c of a){if(s.has(c))throw new Error(`Duplicate discriminator value "${String(c)}"`);s.set(c,i)}}return s});e._zod.parse=(o,s)=>{const i=o.value;if(!se(i))return o.issues.push({code:"invalid_type",expected:"object",input:i,inst:e}),o;const a=r.value.get(i==null?void 0:i[t.discriminator]);return a?a._zod.run(o,s):t.unionFallback?n(o,s):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",input:i,path:[t.discriminator],inst:e}),o)}}),Er=T("$ZodRecord",(e,t)=>{C.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!er(o))return n.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),n;const s=[];if(t.keyType._zod.values){const i=t.keyType._zod.values;n.value={};for(const c of i)if(typeof c=="string"||typeof c=="number"||typeof c=="symbol"){const d=t.valueType._zod.run({value:o[c],issues:[]},r);d instanceof Promise?s.push(d.then(p=>{p.issues.length&&n.issues.push(...M(c,p.issues)),n.value[c]=p.value})):(d.issues.length&&n.issues.push(...M(c,d.issues)),n.value[c]=d.value)}let a;for(const c in o)i.has(c)||(a=a??[],a.push(c));a&&a.length>0&&n.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:a})}else{n.value={};for(const i of Reflect.ownKeys(o)){if(i==="__proto__")continue;const a=t.keyType._zod.run({value:i,issues:[]},r);if(a instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(a.issues.length){n.issues.push({origin:"record",code:"invalid_key",issues:a.issues.map(d=>K(d,r,H())),input:i,path:[i],inst:e}),n.value[a.value]=a.value;continue}const c=t.valueType._zod.run({value:o[i],issues:[]},r);c instanceof Promise?s.push(c.then(d=>{d.issues.length&&n.issues.push(...M(i,d.issues)),n.value[a.value]=d.value})):(c.issues.length&&n.issues.push(...M(i,c.issues)),n.value[a.value]=c.value)}}return s.length?Promise.all(s).then(()=>n):n}}),Sr=T("$ZodEnum",(e,t)=>{C.init(e,t);const n=Gn(t.entries);e._zod.values=new Set(n),e._zod.pattern=new RegExp(`^(${n.filter(r=>tr.has(typeof r)).map(r=>typeof r=="string"?at(r):r.toString()).join("|")})$`),e._zod.parse=(r,o)=>{const s=r.value;return e._zod.values.has(s)||r.issues.push({code:"invalid_value",values:n,input:s,inst:e}),r}}),Cr=T("$ZodLiteral",(e,t)=>{C.init(e,t),e._zod.values=new Set(t.values),e._zod.pattern=new RegExp(`^(${t.values.map(n=>typeof n=="string"?at(n):n?n.toString():String(n)).join("|")})$`),e._zod.parse=(n,r)=>{const o=n.value;return e._zod.values.has(o)||n.issues.push({code:"invalid_value",values:t.values,input:o,inst:e}),n}}),Pr=T("$ZodOptional",(e,t)=>{C.init(e,t),e._zod.optin="optional",e._zod.optout="optional",B(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),B(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${st(n.source)})?$`):void 0}),e._zod.parse=(n,r)=>t.innerType._zod.optin==="optional"?t.innerType._zod.run(n,r):n.value===void 0?n:t.innerType._zod.run(n,r)}),$r=T("$ZodCustom",(e,t)=>{pr.init(e,t),C.init(e,t),e._zod.parse=(n,r)=>n,e._zod.check=n=>{const r=n.value,o=t.fn(r);if(o instanceof Promise)return o.then(s=>ze(s,n,r,e));ze(o,n,r,e)}});function ze(e,t,n,r){if(!e){const o={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(o.params=r._zod.def.params),t.issues.push(or(o))}}function Or(e,t){return new e({type:"string",...D(t)})}function Dr(e,t){return new e({type:"number",checks:[],...D(t)})}function zr(e,t){return new e({type:"number",coerce:!0,checks:[],...D(t)})}function Rr(e,t){return new e({type:"bigint",coerce:!0,...D(t)})}function Br(e){return new e({type:"unknown"})}function Nr(e,t,n){return new e({type:"custom",check:"custom",fn:t,...D(n)})}const O=T("ZodMiniType",(e,t)=>{if(!e._zod)throw new Error("Uninitialized schema in ZodMiniType.");C.init(e,t),e.def=t,e.parse=(n,r)=>ar(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>dt(e,n,r),e.parseAsync=async(n,r)=>dr(e,n,r,{callee:e.parseAsync}),e.safeParseAsync=async(n,r)=>ut(e,n,r),e.check=(...n)=>e.clone({...t,checks:[...t.checks??[],...n.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),e.clone=(n,r)=>nr(e,n,r),e.brand=()=>e,e.register=((n,r)=>(n.add(e,r),e))}),jr=T("ZodMiniString",(e,t)=>{wr.init(e,t),O.init(e,t)});function S(e){return Or(jr,e)}const lt=T("ZodMiniNumber",(e,t)=>{_r.init(e,t),O.init(e,t)});function xr(e){return Dr(lt,e)}const Ur=T("ZodMiniBigInt",(e,t)=>{br.init(e,t),O.init(e,t)}),Lr=T("ZodMiniUnknown",(e,t)=>{kr.init(e,t),O.init(e,t)});function ft(){return Br(Lr)}const Mr=T("ZodMiniArray",(e,t)=>{Tr.init(e,t),O.init(e,t)});function qr(e,t){return new Mr({type:"array",element:e,...D(t)})}const Fr=T("ZodMiniObject",(e,t)=>{Ir.init(e,t),O.init(e,t),B(e,"shape",()=>t.shape)});function z(e,t){const n={type:"object",get shape(){return Yn(this,"shape",{...e}),this.shape},...D(t)};return new Fr(n)}const Wr=T("ZodMiniDiscriminatedUnion",(e,t)=>{vr.init(e,t),O.init(e,t)});function ve(e,t,n){return new Wr({type:"union",options:t,discriminator:e,...D(n)})}const Vr=T("ZodMiniRecord",(e,t)=>{Er.init(e,t),O.init(e,t)});function Zr(e,t,n){return new Vr({type:"record",keyType:e,valueType:t,...D(n)})}const Hr=T("ZodMiniEnum",(e,t)=>{Sr.init(e,t),O.init(e,t)});function ge(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new Hr({type:"enum",entries:n,...D(t)})}const Kr=T("ZodMiniLiteral",(e,t)=>{Cr.init(e,t),O.init(e,t)});function x(e,t){return new Kr({type:"literal",values:Array.isArray(e)?e:[e],...D(t)})}const Jr=T("ZodMiniOptional",(e,t)=>{Pr.init(e,t),O.init(e,t)});function W(e){return new Jr({type:"optional",innerType:e})}const Gr=T("ZodMiniCustom",(e,t)=>{$r.init(e,t),O.init(e,t)});function ht(e,t={}){return Nr(Gr,e,t)}function Q(e){return zr(lt,e)}function ye(e){return Rr(Ur,e)}const mt=S().check(ht(ie,{message:"Invalid hex string"})),V=S().check(ht(xe,{message:"Invalid address"})),we=z({address:V,chainId:Q(),decimals:Q(),iconUri:W(S()),name:S(),priceUsd:Q(),symbol:S()}),Qr=ve("version",[z({data:z({}),type:x("pay.onchain-transaction"),version:x(1)}),z({data:z({action:ge(["TRANSFER","BUY","SELL"]),clientId:S(),destinationAmount:ye(),destinationToken:we,developerFeeBps:Q(),developerFeeRecipient:V,originAmount:ye(),originToken:we,paymentId:S(),paymentLinkId:W(S()),purchaseData:W(Zr(S(),ft())),receiver:V,sender:V,status:ge(["PENDING","FAILED","COMPLETED"]),transactions:qr(z({chainId:Q(),transactionHash:mt})),type:S()}),type:x("pay.onchain-transaction"),version:x(2)})]),Yr=ve("version",[z({data:z({}),type:x("pay.onramp-transaction"),version:x(1)}),z({data:z({amount:ye(),currency:S(),currencyAmount:xr(),id:S(),onramp:S(),paymentLinkId:W(S()),purchaseData:ft(),receiver:V,sender:W(V),status:ge(["PENDING","COMPLETED","FAILED"]),token:we,transactionHash:W(mt)}),type:x("pay.onramp-transaction"),version:x(2)})]),Xr=ve("type",[Qr,Yr]);async function pt(e,t,n,r=300,o){const s=t["x-payload-signature"]||t["x-pay-signature"],i=t["x-timestamp"]||t["x-pay-timestamp"];if(!s||!i)throw new Error("Missing required webhook headers: signature or timestamp");const a=Math.floor(Date.now()/1e3),c=Number.parseInt(i,10),d=Math.abs(a-c);if(d>r)throw new Error(`Webhook timestamp is too old. Difference: ${d}s, tolerance: ${r}s`);const p=new TextEncoder,f=await crypto.subtle.importKey("raw",p.encode(n),{hash:"SHA-256",name:"HMAC"},!1,["sign"]),u=await crypto.subtle.sign("HMAC",f,p.encode(`${i}.${e}`));if(Array.from(new Uint8Array(u)).map(y=>y.toString(16).padStart(2,"0")).join("")!==s)throw new Error("Invalid webhook signature");let h;try{h=JSON.parse(e)}catch{throw new Error("Invalid webhook payload: not valid JSON")}const m=Xr.parse(h);if(m.version===1)throw new Error("Invalid webhook payload: version 1 is no longer supported, please upgrade to webhook version 2.");if(o){if(o.receiverAddress&&m.data.receiver.toLowerCase()!==o.receiverAddress.toLowerCase())throw new Error(`Verification Failed: receiverAddress mismatch, Expected: ${o.receiverAddress}, Received: ${m.data.receiver}`);if(o.destinationTokenAddress){if("destinationToken"in m.data){if(m.data.destinationToken.address.toLowerCase()!==o.destinationTokenAddress.toLowerCase())throw new Error(`Verification Failed: destinationTokenAddress mismatch, Expected: ${o.destinationTokenAddress}, Received: ${m.data.destinationToken.address}`)}else if("onramp"in m.data&&m.data.token.address.toLowerCase()!==o.destinationTokenAddress.toLowerCase())throw new Error(`Verification Failed: destinationTokenAddress mismatch, Expected: ${o.destinationTokenAddress}, Received: ${m.data.token.address}`)}if(o.destinationChainId){if("destinationToken"in m.data){if(m.data.destinationToken.chainId!==o.destinationChainId)throw new Error(`Verification Failed: destinationChainId mismatch, Expected: ${o.destinationChainId}, Received: ${m.data.destinationToken.chainId}`)}else if("onramp"in m.data&&m.data.token.chainId!==o.destinationChainId)throw new Error(`Verification Failed: destinationChainId mismatch, Expected: ${o.destinationChainId}, Received: ${m.data.token.chainId}`)}if(o.minDestinationAmount){if("destinationAmount"in m.data){if(m.data.destinationAmount<o.minDestinationAmount)throw new Error(`Verification Failed: minDestinationAmount, Expected minimum amount to be ${o.minDestinationAmount}, Received: ${m.data.destinationAmount}`)}else if("onramp"in m.data&&m.data.amount<o.minDestinationAmount)throw new Error(`Verification Failed: minDestinationAmount, Expected minimum amount to be ${o.minDestinationAmount}, Received: ${m.data.amount}`)}}return m}const eo=Object.freeze(Object.defineProperty({__proto__:null,parse:pt},Symbol.toStringTag,{value:"Module"})),to=Object.freeze(Object.defineProperty({__proto__:null,Buy:Mn,Onramp:Vn,Sell:Hn,Transfer:Jn,Webhook:eo,chains:qn,parse:pt,status:nt,tokens:Kn},Symbol.toStringTag,{value:"Module"}));function gt(e,t){const n=Ot(ie(e,{strict:!1})?Ue(e):e);return t==="bytes"?n:Le(n)}const ue=new Ct(4096);function no(e){if(ue.has(e))return ue.get(e);const t=gt(Me(e)).slice(2,34);return ue.set(e,t),t}function ro(e){const{clientId:t,secretKey:n,...r}=e;let o=t;if(n)if(Pt(n)){if(!t)throw new Error("clientId must be provided when using a JWT secretKey")}else o=t??no(n);if(!o)throw new Error("clientId or secretKey must be provided");return{...r,clientId:o,secretKey:n}}const oo={bodySerializer:e=>JSON.stringify(e,(t,n)=>typeof n=="bigint"?n.toString():n)},so=async(e,t)=>{const n=typeof t=="function"?await t(e):t;if(n)return e.scheme==="bearer"?`Bearer ${n}`:e.scheme==="basic"?`Basic ${btoa(n)}`:n},io=e=>{switch(e){case"label":return".";case"matrix":return";";case"simple":return",";default:return"&"}},ao=e=>{switch(e){case"form":return",";case"pipeDelimited":return"|";case"spaceDelimited":return"%20";default:return","}},co=e=>{switch(e){case"label":return".";case"matrix":return";";case"simple":return",";default:return"&"}},yt=({allowReserved:e,explode:t,name:n,style:r,value:o})=>{if(!t){const a=(e?o:o.map(c=>encodeURIComponent(c))).join(ao(r));switch(r){case"label":return`.${a}`;case"matrix":return`;${n}=${a}`;case"simple":return a;default:return`${n}=${a}`}}const s=io(r),i=o.map(a=>r==="label"||r==="simple"?e?a:encodeURIComponent(a):ce({allowReserved:e,name:n,value:a})).join(s);return r==="label"||r==="matrix"?s+i:i},ce=({allowReserved:e,name:t,value:n})=>{if(n==null)return"";if(typeof n=="object")throw new Error("Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these.");return`${t}=${e?n:encodeURIComponent(n)}`},wt=({allowReserved:e,explode:t,name:n,style:r,value:o,valueOnly:s})=>{if(o instanceof Date)return s?o.toISOString():`${n}=${o.toISOString()}`;if(r!=="deepObject"&&!t){let c=[];Object.entries(o).forEach(([p,f])=>{c=[...c,p,e?f:encodeURIComponent(f)]});const d=c.join(",");switch(r){case"form":return`${n}=${d}`;case"label":return`.${d}`;case"matrix":return`;${n}=${d}`;default:return d}}const i=co(r),a=Object.entries(o).map(([c,d])=>ce({allowReserved:e,name:r==="deepObject"?`${n}[${c}]`:c,value:d})).join(i);return r==="label"||r==="matrix"?i+a:a},uo=/\{[^{}]+\}/g,lo=({path:e,url:t})=>{let n=t;const r=t.match(uo);if(r)for(const o of r){let s=!1,i=o.substring(1,o.length-1),a="simple";i.endsWith("*")&&(s=!0,i=i.substring(0,i.length-1)),i.startsWith(".")?(i=i.substring(1),a="label"):i.startsWith(";")&&(i=i.substring(1),a="matrix");const c=e[i];if(c==null)continue;if(Array.isArray(c)){n=n.replace(o,yt({explode:s,name:i,style:a,value:c}));continue}if(typeof c=="object"){n=n.replace(o,wt({explode:s,name:i,style:a,value:c,valueOnly:!0}));continue}if(a==="matrix"){n=n.replace(o,`;${ce({name:i,value:c})}`);continue}const d=encodeURIComponent(a==="label"?`.${c}`:c);n=n.replace(o,d)}return n},_t=({allowReserved:e,array:t,object:n}={})=>o=>{const s=[];if(o&&typeof o=="object")for(const i in o){const a=o[i];if(a!=null)if(Array.isArray(a)){const c=yt({allowReserved:e,explode:!0,name:i,style:"form",value:a,...t});c&&s.push(c)}else if(typeof a=="object"){const c=wt({allowReserved:e,explode:!0,name:i,style:"deepObject",value:a,...n});c&&s.push(c)}else{const c=ce({allowReserved:e,name:i,value:a});c&&s.push(c)}}return s.join("&")},fo=e=>{var n;if(!e)return"stream";const t=(n=e.split(";")[0])==null?void 0:n.trim();if(t){if(t.startsWith("application/json")||t.endsWith("+json"))return"json";if(t==="multipart/form-data")return"formData";if(["application/","audio/","image/","video/"].some(r=>t.startsWith(r)))return"blob";if(t.startsWith("text/"))return"text"}},ho=async({security:e,...t})=>{for(const n of e){const r=await so(n,t.auth);if(!r)continue;const o=n.name??"Authorization";switch(n.in){case"query":t.query||(t.query={}),t.query[o]=r;break;case"cookie":t.headers.append("Cookie",`${o}=${r}`);break;case"header":default:t.headers.set(o,r);break}return}},Re=e=>mo({baseUrl:e.baseUrl,path:e.path,query:e.query,querySerializer:typeof e.querySerializer=="function"?e.querySerializer:_t(e.querySerializer),url:e.url}),mo=({baseUrl:e,path:t,query:n,querySerializer:r,url:o})=>{const s=o.startsWith("/")?o:`/${o}`;let i=(e??"")+s;t&&(i=lo({path:t,url:i}));let a=n?r(n):"";return a.startsWith("?")&&(a=a.substring(1)),a&&(i+=`?${a}`),i},Be=(e,t)=>{var r;const n={...e,...t};return(r=n.baseUrl)!=null&&r.endsWith("/")&&(n.baseUrl=n.baseUrl.substring(0,n.baseUrl.length-1)),n.headers=bt(e.headers,t.headers),n},bt=(...e)=>{const t=new Headers;for(const n of e){if(!n||typeof n!="object")continue;const r=n instanceof Headers?n.entries():Object.entries(n);for(const[o,s]of r)if(s===null)t.delete(o);else if(Array.isArray(s))for(const i of s)t.append(o,i);else s!==void 0&&t.set(o,typeof s=="object"?JSON.stringify(s):s)}return t};class le{constructor(){Object.defineProperty(this,"_fns",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._fns=[]}clear(){this._fns=[]}getInterceptorIndex(t){return typeof t=="number"?this._fns[t]?t:-1:this._fns.indexOf(t)}exists(t){const n=this.getInterceptorIndex(t);return!!this._fns[n]}eject(t){const n=this.getInterceptorIndex(t);this._fns[n]&&(this._fns[n]=null)}update(t,n){const r=this.getInterceptorIndex(t);return this._fns[r]?(this._fns[r]=n,t):!1}use(t){return this._fns=[...this._fns,t],this._fns.length-1}}const po=()=>({error:new le,request:new le,response:new le}),go=_t({allowReserved:!1,array:{explode:!0,style:"form"},object:{explode:!0,style:"deepObject"}}),yo={"Content-Type":"application/json"},kt=(e={})=>({...oo,headers:yo,parseAs:"auto",querySerializer:go,...e}),wo=(e={})=>{let t=Be(kt(),e);const n=()=>({...t}),r=i=>(t=Be(t,i),n()),o=po(),s=async i=>{const a={...t,...i,fetch:i.fetch??t.fetch??globalThis.fetch,headers:bt(t.headers,i.headers)};a.security&&await ho({...a,security:a.security}),a.body&&a.bodySerializer&&(a.body=a.bodySerializer(a.body)),(a.body===void 0||a.body==="")&&a.headers.delete("Content-Type");const c=Re(a),d={redirect:"follow",...a};let p=new Request(c,d);for(const y of o.request._fns)y&&(p=await y(p,a));const f=a.fetch;let u=await f(p);for(const y of o.response._fns)y&&(u=await y(u,p,a));const l={request:p,response:u};if(u.ok){if(u.status===204||u.headers.get("Content-Length")==="0")return a.responseStyle==="data"?{}:{data:{},...l};const y=(a.parseAs==="auto"?fo(u.headers.get("Content-Type")):a.parseAs)??"json";let _;switch(y){case"arrayBuffer":case"blob":case"formData":case"json":case"text":_=await u[y]();break;case"stream":return a.responseStyle==="data"?u.body:{data:u.body,...l}}return y==="json"&&(a.responseValidator&&await a.responseValidator(_),a.responseTransformer&&(_=await a.responseTransformer(_))),a.responseStyle==="data"?_:{data:_,...l}}let h=await u.text();try{h=JSON.parse(h)}catch{}let m=h;for(const y of o.error._fns)y&&(m=await y(h,u,p,a));if(m=m||{},a.throwOnError)throw m;return a.responseStyle==="data"?void 0:{error:m,...l}};return{buildUrl:Re,connect:i=>s({...i,method:"CONNECT"}),delete:i=>s({...i,method:"DELETE"}),get:i=>s({...i,method:"GET"}),getConfig:n,head:i=>s({...i,method:"HEAD"}),interceptors:o,options:i=>s({...i,method:"OPTIONS"}),patch:i=>s({...i,method:"PATCH"}),post:i=>s({...i,method:"POST"}),put:i=>s({...i,method:"PUT"}),request:s,setConfig:r,trace:i=>s({...i,method:"TRACE"})}},J=wo(kt({baseUrl:"https://engine.thirdweb.com"})),_o=e=>(e.client??J).post({security:[{name:"x-secret-key",type:"apiKey"}],url:"/v1/write/transaction",...e,headers:{"Content-Type":"application/json",...e.headers}}),bo=e=>(e.client??J).post({security:[{name:"x-secret-key",type:"apiKey"}],url:"/v1/sign/message",...e,headers:{"Content-Type":"application/json",...e.headers}}),ko=e=>(e.client??J).post({security:[{name:"x-secret-key",type:"apiKey"}],url:"/v1/sign/typed-data",...e,headers:{"Content-Type":"application/json",...e.headers}}),To=e=>((e==null?void 0:e.client)??J).get({security:[{name:"x-secret-key",type:"apiKey"}],url:"/v1/accounts",...e}),Io=e=>((e==null?void 0:e.client)??J).post({security:[{name:"x-secret-key",type:"apiKey"}],url:"/v1/accounts",...e,headers:{"Content-Type":"application/json",...e==null?void 0:e.headers}}),Tt=e=>((e==null?void 0:e.client)??J).post({security:[{name:"x-secret-key",type:"apiKey"}],url:"/v1/transactions/search",...e,headers:{"Content-Type":"application/json",...e==null?void 0:e.headers}});function Ne(e){return"result"in e}async function Ao(e){var s;const{client:t,label:n}=e,r=await Io({baseUrl:v("engineCloud"),body:{label:n},bodySerializer:Z,fetch:A(t)});if(r.error)throw new Error(`Error creating server wallet with label ${n}: ${Z(r.error)}`);const o=(s=r.data)==null?void 0:s.result;if(!o)throw new Error(`No server wallet created with label ${n}`);return o}async function It(e){var i,a,c;const{client:t,transactionId:n}=e,r=await Tt({baseUrl:v("engineCloud"),body:{filters:[{field:"id",operation:"OR",values:[n]}]},bodySerializer:I,fetch:A(t)});if(r.error)throw new Error(`Error searching for transaction ${n}: ${I(r.error)}`);const o=(c=(a=(i=r.data)==null?void 0:i.result)==null?void 0:a.transactions)==null?void 0:c[0];if(!o)throw new Error(`Transaction ${n} not found`);return{...o.executionResult,cancelledAt:o.cancelledAt,chain:Y(Number(o.chainId)),confirmedAt:o.confirmedAt,createdAt:o.createdAt,from:o.from??void 0,id:o.id}}async function vo(e){var o;const{client:t}=e,n=await To({baseUrl:v("engineCloud"),bodySerializer:Z,fetch:A(t),query:{limit:e.limit,page:e.page}});if(n.error)throw new Error(`Error listing server wallets: ${Z(n.error)}`);const r=(o=n.data)==null?void 0:o.result;if(!r)throw new Error("No server wallets found");return r}async function Eo(e){var a;const{client:t,filters:n,pageSize:r=100,page:o=1}=e,s=await Tt({baseUrl:v("engineCloud"),body:{filters:n,limit:r,page:o},bodySerializer:I,fetch:A(t)});if(s.error)throw new Error(`Error searching for transaction with filters ${I(n)}: ${I(s.error)}`);const i=(a=s.data)==null?void 0:a.result;if(!i)throw new Error(`No transactions found with filters ${I(n)}`);return i}async function _e(e){const t=Date.now(),n=e.timeoutInSeconds?e.timeoutInSeconds*1e3:300*1e3;for(;Date.now()-t<n;){const r=await It(e);switch(r.status){case"FAILED":throw new Error(`Transaction failed: ${Z(r.error)||"Unknown error"}`);case"CONFIRMED":{if((r&&"onchainStatus"in r?r.onchainStatus:null)==="REVERTED"){const i="revertData"in r?r.revertData:void 0;throw new Error(`Transaction reverted: ${(i==null?void 0:i.errorName)||"unknown error"} ${i!=null&&i.errorArgs?Z(i.errorArgs):""} - ${r.transactionHash?r.transactionHash:""}`)}return{chain:r.chain,client:e.client,transactionHash:r.transactionHash}}default:await new Promise(s=>setTimeout(s,1e3))}}throw new Error(`Transaction timed out after ${n/1e3} seconds`)}function So(e){const{client:t,vaultAccessToken:n,address:r,chain:o,executionOptions:s}=e,i=n?{"x-vault-access-token":n}:{},a=f=>{if(!s)return{chainId:f,from:r,type:"auto"};switch(s.type){case"auto":return{chainId:f,from:r,type:"auto"};case"ERC4337":return{...s,chainId:f,type:"ERC4337"};case"EOA":return{chainId:f,from:r,type:"EOA"};case"EIP7702":return{...s,chainId:f,type:"EIP7702"}}},c=f=>{if(!f)return{from:r,type:"EOA"};if(!s)return{chainId:f,from:r,type:"auto"};switch(s.type){case"ERC4337":return{chainId:f,...s,type:"ERC4337"};case"auto":return{chainId:f,from:r,type:"auto"};case"EIP7702":case"EOA":return{chainId:f,from:r,type:"EOA"}}},d=async f=>{var _,g,b;if(f.length===0)throw new Error("No transactions to enqueue");const u=f[0];if(!u)throw new Error("No transactions to enqueue");const l=u.chainId;for(let w=1;w<f.length;w++)if(((_=f[w])==null?void 0:_.chainId)!==l)throw new Error(`All transactions in batch must be on the same chain. Expected ${l}, got ${(g=f[w])==null?void 0:g.chainId} at index ${w}`);const h={executionOptions:a(l),params:f.map(w=>{var E;return{data:w.data,to:w.to,gasLimit:w.gas?Number(w.gas):void 0,value:(E=w.value)==null?void 0:E.toString()}})},m=await _o({baseUrl:v("engineCloud"),body:h,bodySerializer:I,fetch:A(t),headers:i});if(m.error)throw new Error(`Error sending transaction: ${I(m.error)}`);const y=(b=m.data)==null?void 0:b.result;if(!y)throw new Error("No data returned from engine");return y.transactions.map(w=>w.id)};return{address:(s==null?void 0:s.type)==="ERC4337"&&s.smartAccountAddress?s.smartAccountAddress:r,enqueueBatchTransaction:async f=>{const u=[];for(const m of f.transactions){const[y,_,g]=await Promise.all([m.to?j(m.to):null,re(m),m.value?j(m.value):null]);u.push({chainId:m.chain.id,data:_,to:y??void 0,value:g??void 0})}const h=(await d(u))[0];if(!h)throw new Error("No transactionId returned from engine");return{transactionId:h}},enqueueTransaction:async f=>{let u;if(f.simulate)u=await Fe({transaction:f.transaction,from:r});else{const[m,y,_]=await Promise.all([f.transaction.to?j(f.transaction.to):null,re(f.transaction),f.transaction.value?j(f.transaction.value):null]);u={chainId:f.transaction.chain.id,data:y,to:m??void 0,value:_??void 0}}const h=(await d([u]))[0];if(!h)throw new Error("No transactionId returned from engine");return{transactionId:h}},sendBatchTransaction:async f=>{const l=(await d(f))[0];if(!l)throw new Error("No transactionId returned from engine");return _e({client:t,transactionId:l})},sendTransaction:async f=>{const l=(await d([f]))[0];if(!l)throw new Error("No transactionId returned from engine");return _e({client:t,transactionId:l})},signMessage:async f=>{var b;const{message:u,chainId:l}=f;let h,m=!1;typeof u=="string"?h=u:(h=qe(u.raw),m=!0);const y=l||(o==null?void 0:o.id);if(!y)throw new Error("Chain ID is required for signing messages");const _=await bo({baseUrl:v("engineCloud"),body:{params:[{format:m?"hex":"text",message:h}],signingOptions:c(y)},bodySerializer:I,fetch:A(t),headers:i});if(_.error)throw new Error(`Error signing message: ${I(_.error)}`);const g=(b=_.data)==null?void 0:b.result[0];if(g&&Ne(g))return g.result.signature;throw new Error(`Failed to sign message: ${I(g==null?void 0:g.error)||"Unknown error"}`)},signTypedData:async f=>{var m;const u=o==null?void 0:o.id;if(!u)throw new Error("Chain ID is required for signing messages");const l=await ko({baseUrl:v("engineCloud"),body:{params:[f],signingOptions:c(u)},bodySerializer:I,fetch:A(t),headers:i});if(l.error)throw new Error(`Error signing message: ${I(l.error)}`);const h=(m=l.data)==null?void 0:m.result[0];if(h&&Ne(h))return h.result.signature;throw new Error(`Failed to sign message: ${I(h==null?void 0:h.error)||"Unknown error"}`)}}}const Co=Object.freeze(Object.defineProperty({__proto__:null,createServerWallet:Ao,getServerWallets:vo,getTransactionStatus:It,searchTransactions:Eo,serverWallet:So,waitForTransactionHash:_e},Symbol.toStringTag,{value:"Module"}));async function Ee(e){var h;const[{getV1EventsByContractAddress:t},{getThirdwebDomains:n},{getClientFetch:r},{assertInsightEnabled:o},{stringify:s}]=await Promise.all([k(()=>import("./thirdweb-DZ2vK6IO.js"),[]),k(()=>import("./utils-nbkSUjEy.js").then(m=>m.q),__vite__mapDeps([0,1,2])),k(()=>import("./utils-nbkSUjEy.js").then(m=>m.r),__vite__mapDeps([0,1,2])),k(()=>import("./common-GsSQn_vD.js"),__vite__mapDeps([3,0,1,2])),k(()=>import("./signing-BGpVago5.js").then(m=>m.cT),__vite__mapDeps([4,0,1,2,5,6]))]),{client:i,chains:a,contractAddress:c,event:d,queryOptions:p,decodeLogs:f}=e;await o(a);const u={chain:a.map(m=>m.id),decode:f,limit:100};d&&(u.filter_topic_0=d.topics[0],u.filter_topic_1=d.topics[1],u.filter_topic_2=d.topics[2],u.filter_topic_3=d.topics[3]);const l=await t({baseUrl:`https://${n().insight}`,fetch:r(i),path:{contractAddress:c},query:{...u,...p}});if(l.error)throw new Error(`${l.response.status} ${l.response.statusText} - ${l.error?s(l.error):"Unknown error"}`);return((h=l.data)==null?void 0:h.data)??[]}async function Po(e){var h;const[{getV1Nfts:t},{getThirdwebDomains:n},{getClientFetch:r},{assertInsightEnabled:o},{stringify:s}]=await Promise.all([k(()=>import("./thirdweb-DZ2vK6IO.js"),[]),k(()=>import("./utils-nbkSUjEy.js").then(m=>m.q),__vite__mapDeps([0,1,2])),k(()=>import("./utils-nbkSUjEy.js").then(m=>m.r),__vite__mapDeps([0,1,2])),k(()=>import("./common-GsSQn_vD.js"),__vite__mapDeps([3,0,1,2])),k(()=>import("./index-C6QyIhnE.js"),__vite__mapDeps([7,8,4,0,1,2,5,6,9,10,11,12,13]))]),{client:i,chains:a,ownerAddress:c,contractAddresses:d,queryOptions:p}=e;await o(a);const f={chain:a.map(m=>m.id),limit:50,owner_address:[c],contract_address:d||void 0},u=await t({baseUrl:`https://${n().insight}`,fetch:r(i),query:{...f,...p}});if(u.error)throw new Error(`${u.response.status} ${u.response.statusText} - ${u.error?s(u.error):"Unknown error"}`);return(await Se(((h=u.data)==null?void 0:h.data)??[],i,c)).map(m=>({...m,quantityOwned:m.quantityOwned??1n}))}async function $o(e){var l;const[{getV1NftsByContractAddress:t},{getThirdwebDomains:n},{getClientFetch:r},{assertInsightEnabled:o},{stringify:s}]=await Promise.all([k(()=>import("./thirdweb-DZ2vK6IO.js"),[]),k(()=>import("./utils-nbkSUjEy.js").then(h=>h.q),__vite__mapDeps([0,1,2])),k(()=>import("./utils-nbkSUjEy.js").then(h=>h.r),__vite__mapDeps([0,1,2])),k(()=>import("./common-GsSQn_vD.js"),__vite__mapDeps([3,0,1,2])),k(()=>import("./signing-BGpVago5.js").then(h=>h.cT),__vite__mapDeps([4,0,1,2,5,6]))]),{client:i,chains:a,contractAddress:c,includeOwners:d=!0,queryOptions:p}=e,f={chain:a.map(h=>h.id),include_owners:d===!0?"true":"false",limit:50};await o(a);const u=await t({baseUrl:`https://${n().insight}`,fetch:r(i),path:{contract_address:c},query:{...f,...p}});if(u.error)throw new Error(`${u.response.status} ${u.response.statusText} - ${u.error?s(u.error):"Unknown error"}`);return Se(((l=u.data)==null?void 0:l.data)??[],i)}async function Oo(e){var m;const[{getV1NftsByContractAddressByTokenId:t},{getThirdwebDomains:n},{getClientFetch:r},{assertInsightEnabled:o},{stringify:s}]=await Promise.all([k(()=>import("./thirdweb-DZ2vK6IO.js"),[]),k(()=>import("./utils-nbkSUjEy.js").then(y=>y.q),__vite__mapDeps([0,1,2])),k(()=>import("./utils-nbkSUjEy.js").then(y=>y.r),__vite__mapDeps([0,1,2])),k(()=>import("./common-GsSQn_vD.js"),__vite__mapDeps([3,0,1,2])),k(()=>import("./signing-BGpVago5.js").then(y=>y.cT),__vite__mapDeps([4,0,1,2,5,6]))]),{client:i,chain:a,contractAddress:c,tokenId:d,includeOwners:p=!0,queryOptions:f}=e;await o([a]);const u={chain_id:[a.id],include_owners:p===!0?"true":"false"},l=await t({baseUrl:`https://${n().insight}`,fetch:r(i),path:{contract_address:c,token_id:d.toString()},query:{...u,...f}});if(l.error)throw new Error(`${l.response.status} ${l.response.statusText} - ${l.error?s(l.error):"Unknown error"}`);const h=await Se(((m=l.data)==null?void 0:m.data)??[],i);return h==null?void 0:h[0]}async function Se(e,t,n){const[{parseNFT:r},{totalSupply:o}]=await Promise.all([k(()=>import("./parseNft-Yzo9Plhx.js"),__vite__mapDeps([14,5,2,1,6,0,4])),k(()=>import("./totalSupply-C5jxuFw1.js"),__vite__mapDeps([15,4,0,1,2,5,6,16]))]);return await Promise.all(e.map(async s=>{var w;let i;const{contract:a,extra_metadata:c,collection:d,metadata_url:p,chain_id:f,token_id:u,status:l,balance:h,token_type:m,...y}=s;let _=y,g=n?[U(n)]:void 0;if("owner_addresses"in y){const{owner_addresses:E,...N}=y;_=N,g=g??(E==null?void 0:E.map(P=>U(P)))}const b=At({attributes:((w=s.extra_metadata)==null?void 0:w.attributes)??void 0,image:s.image_url,uri:s.metadata_url??"",..._});if((a==null?void 0:a.type)==="erc1155"){const E=await o({contract:X({address:a.address,chain:Y(a.chain_id),client:t}),id:BigInt(u)}).catch(()=>0n);i=r(b,{chainId:(a==null?void 0:a.chain_id)??0,owner:g==null?void 0:g[0],supply:E,tokenAddress:(a==null?void 0:a.address)??"",tokenId:BigInt(u),tokenUri:be(p)??"",type:"ERC1155"})}else i=r(b,{chainId:(a==null?void 0:a.chain_id)??0,owner:g==null?void 0:g[0],tokenAddress:(a==null?void 0:a.address)??"",tokenId:BigInt(u),tokenUri:be(p)??"",type:"ERC721"});return{...i,...(a==null?void 0:a.type)==="erc1155"?{quantityOwned:h?BigInt(h):void 0}:{}}}))}function At(e){if(typeof e!="object"||e===null)return e;for(const t in e)typeof e[t]=="string"?e[t]=be(e[t]):At(e[t]);return e}function be(e){if(!e||typeof e!="string")return e;try{const t=new URL(e);if(t.host.endsWith(".ipfscdn.io")){const n=t.pathname.split("/"),r=n.findIndex(s=>s==="ipfs");if(r===-1)return e;const o=n.slice(r+1).join("/");return o?`ipfs://${o}`:e}}catch{return e}return e}async function Do(e){var l;const[{getV1Tokens:t},{getThirdwebDomains:n},{getClientFetch:r},{assertInsightEnabled:o},{stringify:s}]=await Promise.all([k(()=>import("./thirdweb-DZ2vK6IO.js"),[]),k(()=>import("./utils-nbkSUjEy.js").then(h=>h.q),__vite__mapDeps([0,1,2])),k(()=>import("./utils-nbkSUjEy.js").then(h=>h.r),__vite__mapDeps([0,1,2])),k(()=>import("./common-GsSQn_vD.js"),__vite__mapDeps([3,0,1,2])),k(()=>import("./signing-BGpVago5.js").then(h=>h.cT),__vite__mapDeps([4,0,1,2,5,6]))]),{client:i,chains:a,ownerAddress:c,tokenAddresses:d,queryOptions:p}=e;await o(a);const f={chain_id:a.length>0?a.map(h=>h.id):[1],include_native:"true",include_spam:"false",limit:50,metadata:"true",owner_address:[c],token_address:d||void 0,sort_by:"balance",sort_order:"desc"},u=await t({baseUrl:`https://${n().insight}`,fetch:r(i),query:{...f,...p}});if(u.error)throw new Error(`${u.response.status} ${u.response.statusText} - ${u.error?s(u.error):"Unknown error"}`);return zo(((l=u.data)==null?void 0:l.data)??[])}async function zo(e){const{toTokens:t}=await k(async()=>{const{toTokens:n}=await import("./signing-BGpVago5.js").then(r=>r.cU);return{toTokens:n}},__vite__mapDeps([4,0,1,2,5,6]));return e.map(n=>{const r=n.decimals??18,o=BigInt(n.balance);return{chainId:n.chain_id,decimals:r,displayValue:t(o,r),name:n.name??"",symbol:n.symbol??"",tokenAddress:n.token_address,value:o}})}async function Ro(e){const[{getV1WalletsByWalletAddressTransactions:t},{getThirdwebDomains:n},{getClientFetch:r},{assertInsightEnabled:o},{stringify:s}]=await Promise.all([k(()=>import("./thirdweb-DZ2vK6IO.js"),[]),k(()=>import("./utils-nbkSUjEy.js").then(l=>l.q),__vite__mapDeps([0,1,2])),k(()=>import("./utils-nbkSUjEy.js").then(l=>l.r),__vite__mapDeps([0,1,2])),k(()=>import("./common-GsSQn_vD.js"),__vite__mapDeps([3,0,1,2])),k(()=>import("./signing-BGpVago5.js").then(l=>l.cT),__vite__mapDeps([4,0,1,2,5,6]))]);await o(e.chains);const i=Math.floor((Date.now()-2160*60*60*1e3)/1e3),{client:a,walletAddress:c,chains:d,queryOptions:p}=e,f={chain:d.map(l=>l.id),filter_block_timestamp_gte:i,limit:100},u=await t({baseUrl:`https://${n().insight}`,fetch:r(a),path:{wallet_address:c},query:{...f,...p}});if(u.error)throw new Error(`${u.response.status} ${u.response.statusText} - ${u.error?s(u.error):"Unknown error"}`);return u.data.data||[]}const Bo=Object.freeze(Object.defineProperty({__proto__:null,getContractEvents:Ee,getContractNFTs:$o,getNFT:Oo,getOwnedNFTs:Po,getOwnedTokens:Do,getTransactions:Ro},Symbol.toStringTag,{value:"Module"}));async function No(e,t){const n=t.includeTransactions??!1,r=await e({method:"eth_getBlockByHash",params:[t.blockHash,n]});if(!r)throw new Error("Block not found");return Dt(r)}async function ke(e,t={}){const n=t.topics??[];let r;if(t.blockHash){const o={blockHash:t.blockHash,topics:n};t.address&&(o.address=U(t.address)),r=await e({method:"eth_getLogs",params:[o]})}else{const o={topics:n};t.address&&(o.address=t.address),t.fromBlock&&(o.fromBlock=typeof t.fromBlock=="bigint"?F(t.fromBlock):t.fromBlock),t.toBlock&&(o.toBlock=typeof t.toBlock=="bigint"?F(t.toBlock):t.toBlock),r=await e({method:"eth_getLogs",params:[o]})}return r.map(o=>Xe(o))}async function jo(e,t){const n=await e({method:"eth_getTransactionByHash",params:[t.hash]});if(!n)throw new Error("Transaction not found.");return zt(n)}async function vt(e){var u;const{contract:t,events:n,blockRange:r,useIndexer:o=!0,...s}=e,i=Te(t);if(s.blockHash&&(r||s.fromBlock||s.toBlock))throw new Error("Cannot specify blockHash and range simultaneously,");const a=await Qe(i);if(r){const{fromBlock:l,toBlock:h}=s;if(l!==void 0&&h!==void 0&&BigInt(h)-BigInt(l)!==BigInt(r))throw new Error("Incompatible blockRange with specified fromBlock and toBlock. Please only define fromBlock or toBlock when specifying blockRange.");l!==void 0?s.toBlock=BigInt(l)+BigInt(r)-1n:h!==void 0?s.fromBlock=BigInt(h)-BigInt(r)+1n:(s.toBlock=a,s.fromBlock=a-BigInt(r)+1n)}let c=n??[];if(!(n!=null&&n.length)&&t){if(o){const l=await Ee({chains:[t.chain],client:t.client,contractAddress:t.address,decodeLogs:!0,queryOptions:{filter_block_hash:s.blockHash,filter_block_number_gte:s.fromBlock,filter_block_number_lte:s.toBlock,limit:500}}).catch(()=>null);if(l)return Et(l)}(u=t.abi)!=null&&u.length?c=t.abi.filter(Ce).map(l=>he({signature:l})):c=(await We(t)).filter(Ce).map(h=>he({signature:h}))}const d=n&&n.length>0?n.map(l=>({...s,address:U(t.address),topics:l.topics})):[{...s,address:U(t.address)}];let p=[];if(o)try{p=await Promise.all(d.map(l=>xo({contract:t,params:l})))}catch(l){console.warn("Error fetching from insight, falling back to rpc",l),p=await Promise.all(d.map(h=>ke(i,h)))}else p=await Promise.all(d.map(l=>ke(i,l)));const f=p.flat().sort((l,h)=>Number((l.blockNumber??0n)-(h.blockNumber??0n)));return Ve({events:c,logs:f})}async function xo(e){var i,a,c,d;const{params:t,contract:n}=e,r=typeof t.fromBlock=="bigint"?Number(t.fromBlock):void 0,o=typeof t.toBlock=="bigint"?Number(t.toBlock):void 0,s=await Ee({chains:[n.chain],client:n.client,contractAddress:n.address,queryOptions:{filter_block_hash:t.blockHash,filter_block_number_gte:r,filter_block_number_lte:o,filter_topic_0:(i=t.topics)==null?void 0:i[0],filter_topic_1:(a=t.topics)==null?void 0:a[1],filter_topic_2:(c=t.topics)==null?void 0:c[2],filter_topic_3:(d=t.topics)==null?void 0:d[3],limit:500}});return Et(s)}function Et(e){return e.map(n=>({address:n.address,blockHash:n.block_hash,blockNumber:F(Number(n.block_number)),blockTimestamp:n.block_timestamp,chainId:n.chain_id,data:n.data,logIndex:F(n.log_index),topics:n.topics,transactionHash:n.transaction_hash,transactionIndex:F(n.transaction_index),...n.decoded?{args:{...n.decoded.indexed_params,...n.decoded.non_indexed_params},eventName:n.decoded.name}:{}})).map(n=>Xe(n)).sort((n,r)=>Number((n.blockNumber??0n)-(r.blockNumber??0n)))}async function Uo(e,t){const n=t.retries,r=t.delay;let o=null;for(let s=0;s<n;s++)try{return await e()}catch(i){o=i,await new Promise(a=>setTimeout(a,r))}throw o}function Lo(e){return Ye({...e.contract,latestBlockNumber:e.latestBlockNumber,onNewBlockNumber:async t=>{const n=await Uo(async()=>vt({...e,fromBlock:t,toBlock:t,useIndexer:!1}),{delay:500,retries:3});n.length&&e.onEvents(n)}})}const Mo=()=>{const e=$t().pay;return e.startsWith("localhost")?`http://${e}`:`https://${e}`},qo=()=>`${Mo()}/buy-with-crypto/history/v1`;async function Fo(e){try{const t=new URLSearchParams;t.append("walletAddress",e.walletAddress),t.append("start",e.start.toString()),t.append("count",e.count.toString());const n=t.toString(),r=`${qo()}?${n}`,o=await A(e.client)(r);if(!o.ok){const i=await o.text().catch(()=>null);throw new Error(`HTTP error! status: ${o.status} - ${o.statusText}: ${i||"unknown error"}`)}return(await o.json()).result}catch(t){throw new Error(`Fetch failed: ${t}`)}}const Wo=[Dn.id,zn.id,Rn.id,Bn.id,Nn.id,jn.id,34443,919,42220,44787,204,5611];async function Vo(e){if(e.id===1337||e.id===31337)return!1;if(Wo.includes(e.id))return!0;try{const{getChainMetadata:t}=await k(async()=>{const{getChainMetadata:r}=await import("./utils-nbkSUjEy.js").then(o=>o.u);return{getChainMetadata:r}},__vite__mapDeps([0,1,2]));return(await t(e)).stackType==="optimism_bedrock"}catch{return!1}}async function Zo(e){var c;const{transaction:t}=e,n=e.from??((c=e.account)==null?void 0:c.address)??void 0,r=await j(t.gas)||await Ze({from:n,transaction:t}),o=await Rt(t.client,t.chain),s=o.maxFeePerGas||o.gasPrice;if(s===void 0)throw new Error(`Unable to determine gas price for chain ${t.chain.id}`);let i;if(await Vo(t.chain)){const{estimateL1Fee:d}=await k(async()=>{const{estimateL1Fee:p}=await import("./estimate-l1-fee-CkQ_-gw6.js");return{estimateL1Fee:p}},__vite__mapDeps([17,4,0,1,2,5,6]));i=await d({transaction:t})}else i=0n;const a=r*s+i;return{ether:He(a),wei:a}}async function Ho(e){try{const t=await(async()=>{if(e.toAmount){const d=X({address:e.toTokenAddress,chain:Y(e.toChainId),client:e.client}),p=d.address.toLowerCase()===Ie?18:await pe({contract:d}),f=me(e.toAmount,p);return et({amount:f,client:e.client,destinationChainId:e.toChainId,destinationTokenAddress:e.toTokenAddress,originChainId:e.fromChainId,originTokenAddress:e.fromTokenAddress,paymentLinkId:e.paymentLinkId,purchaseData:e.purchaseData,receiver:e.toAddress,sender:e.fromAddress})}else if(e.fromAmount){const d=X({address:e.fromTokenAddress,chain:Y(e.fromChainId),client:e.client}),p=await pe({contract:d}),f=me(e.fromAmount,p);return tt({amount:f,client:e.client,destinationChainId:e.toChainId,destinationTokenAddress:e.toTokenAddress,originChainId:e.fromChainId,originTokenAddress:e.fromTokenAddress,paymentLinkId:e.paymentLinkId,purchaseData:e.purchaseData,receiver:e.toAddress,sender:e.fromAddress})}throw new Error("Invalid quote request, must provide either `fromAmount` or `toAmount`")})(),n=t.steps[0];if(!n)throw new Error("This quote is incompatible with getBuyWithCryptoQuote. Please use Bridge.Buy.prepare instead.");const r=n.transactions.filter(d=>d.action==="approval");if(r.length>1)throw new Error("This quote is incompatible with getBuyWithCryptoQuote. Please use Bridge.Buy.prepare instead.");const o=r[0],s=n.transactions.filter(d=>d.action!=="approval");if(s.length>1)throw new Error("This quote is incompatible with getBuyWithCryptoQuote. Please use Bridge.Buy.prepare instead.");const i=s[0];if(!i)throw new Error("This quote is incompatible with getBuyWithCryptoQuote. Please use Bridge.Buy.prepare instead.");let a;if(o){const d=Ke(["function approve(address spender, uint256 amount)"]),[p,f]=Je(d,o.data);a={amountWei:f.toString(),chainId:n.originToken.chainId,spenderAddress:p,tokenAddress:n.originToken.address}}return{approvalData:a,client:e.client,paymentTokens:[{amount:$(t.originAmount,n.originToken.decimals).toString(),amountUSDCents:Number($(t.originAmount,n.originToken.decimals))*(n.originToken.prices.USD||0)*100,amountWei:t.originAmount.toString(),token:{chainId:n.originToken.chainId,decimals:n.originToken.decimals,name:n.originToken.name,priceUSDCents:(n.originToken.prices.USD||0)*100,symbol:n.originToken.symbol,tokenAddress:n.originToken.address}}],processingFees:[{amount:"0",amountUSDCents:0,amountWei:"0",token:{chainId:n.originToken.chainId,decimals:n.originToken.decimals,name:n.originToken.name,priceUSDCents:(n.originToken.prices.USD||0)*100,symbol:n.originToken.symbol,tokenAddress:n.originToken.address}}],swapDetails:{estimated:{durationSeconds:n.estimatedExecutionTimeMs/1e3,feesUSDCents:0,fromAmountUSDCents:Number($(t.originAmount,n.originToken.decimals))*(n.originToken.prices.USD||0)*100,gasCostUSDCents:0,slippageBPS:0,toAmountMinUSDCents:Number($(t.destinationAmount,n.destinationToken.decimals))*(n.destinationToken.prices.USD||0)*100,toAmountUSDCents:Number($(t.destinationAmount,n.destinationToken.decimals))*(n.destinationToken.prices.USD||0)*100},fromAddress:t.intent.sender,fromAmount:$(t.originAmount,n.originToken.decimals).toString(),fromAmountWei:t.originAmount.toString(),fromToken:{chainId:n.originToken.chainId,decimals:n.originToken.decimals,name:n.originToken.name,priceUSDCents:(n.originToken.prices.USD||0)*100,symbol:n.originToken.symbol,tokenAddress:n.originToken.address},maxSlippageBPS:0,toAddress:t.intent.receiver,toAmount:$(t.destinationAmount,n.destinationToken.decimals).toString(),toAmountMin:$(t.destinationAmount,n.destinationToken.decimals).toString(),toAmountMinWei:t.destinationAmount.toString(),toAmountWei:t.destinationAmount.toString(),toToken:{chainId:n.destinationToken.chainId,decimals:n.destinationToken.decimals,name:n.destinationToken.name,priceUSDCents:(n.destinationToken.prices.USD||0)*100,symbol:n.destinationToken.symbol,tokenAddress:n.destinationToken.address}},transactionRequest:{...i,extraGas:50000n}}}catch(t){throw console.error("Error getting buy with crypto quote",t),t}}async function Ko(e){var t,n,r,o;try{if(!e.transactionHash)throw new Error("Transaction hash is required");const s=await nt({chainId:e.chainId,client:e.client,transactionHash:e.transactionHash});switch(s.status){case"COMPLETED":{const i=(t=s.transactions)==null?void 0:t.find(c=>c.chainId===e.chainId),a=(n=s.transactions)==null?void 0:n.find(c=>c.chainId!==e.chainId);return fe({destinationAmount:s.destinationAmount,destinationChainId:s.destinationChainId,destinationToken:s.destinationToken,destinationTokenAddress:s.destinationTokenAddress,destinationTransaction:a,originAmount:s.originAmount,originChainId:s.originChainId,originToken:s.originToken,originTokenAddress:s.originTokenAddress,originTransaction:i,paymentId:s.paymentId,purchaseData:s.purchaseData,receiver:s.receiver,sender:s.sender,status:s.status})}case"PENDING":return fe({destinationChainId:s.destinationChainId,destinationToken:s.destinationToken,destinationTokenAddress:s.destinationTokenAddress,originAmount:s.originAmount,originChainId:s.originChainId,originToken:s.originToken,originTokenAddress:s.originTokenAddress,paymentId:s.paymentId,purchaseData:s.purchaseData,receiver:s.receiver,sender:s.sender,status:s.status});case"FAILED":{const i=(r=s.transactions)==null?void 0:r.find(c=>c.chainId===e.chainId),a=(o=s.transactions)==null?void 0:o.find(c=>c.chainId!==e.chainId);return fe({destinationChainId:0,destinationToken:void 0,destinationTokenAddress:"",destinationTransaction:a,originAmount:BigInt(0),originChainId:0,originToken:void 0,originTokenAddress:"",originTransaction:i,paymentId:"",purchaseData:s.purchaseData,receiver:"",sender:"",status:s.status})}default:return{status:"NOT_FOUND"}}}catch(s){throw console.error("Fetch error:",s),new Error(`Fetch failed: ${s}`)}}function fe(e){const{originTransaction:t,destinationTransaction:n,status:r,purchaseData:o,originAmount:s,destinationAmount:i,originTokenAddress:a,destinationTokenAddress:c,originChainId:d,destinationChainId:p,sender:f,receiver:u,originToken:l,destinationToken:h}=e;return{bridge:"STARPORT",destination:{amount:h?q(i??BigInt(0),h.decimals).toString():"",amountUSDCents:0,amountWei:(i==null?void 0:i.toString())??"",completedAt:new Date().toISOString(),explorerLink:"",token:{chainId:p,decimals:(h==null?void 0:h.decimals)??18,name:(h==null?void 0:h.name)??"",priceUSDCents:0,symbol:(h==null?void 0:h.symbol)??"",tokenAddress:c},transactionHash:(n==null?void 0:n.transactionHash)??""},fromAddress:f,purchaseData:o,quote:{createdAt:new Date().toISOString(),estimated:{durationSeconds:0,feesUSDCents:0,fromAmountUSDCents:0,gasCostUSDCents:0,slippageBPS:0,toAmountMinUSDCents:0,toAmountUSDCents:0},fromAmount:l?q(s,l.decimals).toString():"",fromAmountWei:s.toString(),fromToken:{chainId:d,decimals:(l==null?void 0:l.decimals)??18,name:(l==null?void 0:l.name)??"",priceUSDCents:0,symbol:(l==null?void 0:l.symbol)??"",tokenAddress:a},toAmount:h&&i?q(i,h.decimals).toString():"",toAmountMin:h?q(i??BigInt(0),h.decimals).toString():"",toAmountMinWei:i?i.toString():"",toAmountWei:i?i.toString():"",toToken:{chainId:p,decimals:(h==null?void 0:h.decimals)??18,name:(h==null?void 0:h.name)??"",priceUSDCents:0,symbol:(h==null?void 0:h.symbol)??"",tokenAddress:c}},source:{amount:l?q(s,l.decimals).toString():"",amountUSDCents:0,amountWei:s.toString(),completedAt:new Date().toISOString(),explorerLink:"",token:{chainId:d,decimals:(l==null?void 0:l.decimals)??18,name:(l==null?void 0:l.name)??"",priceUSDCents:0,symbol:(l==null?void 0:l.symbol)??"",tokenAddress:a},transactionHash:(t==null?void 0:t.transactionHash)??""},status:r,subStatus:r==="COMPLETED"?"SUCCESS":"NONE",swapType:(t==null?void 0:t.chainId)===(n==null?void 0:n.chainId)?"SAME_CHAIN":"CROSS_CHAIN",toAddress:u}}async function Jo(e){try{const t=X({address:e.tokenAddress,chain:Y(e.chainId),client:e.client}),n=t.address.toLowerCase()===Ie?18:await pe({contract:t}),r=me(e.amount,n),o=await rt({amount:r,chainId:e.chainId,client:e.client,feePayer:e.feePayer,paymentLinkId:e.paymentLinkId,purchaseData:e.purchaseData,receiver:e.toAddress,sender:e.fromAddress,tokenAddress:e.tokenAddress}),s=o.steps[0];if(!s)throw new Error("This quote is incompatible with getBuyWithCryptoTransfer. Please use Bridge.Transfer.prepare instead.");const i=s.transactions.filter(u=>u.action==="approval");if(i.length>1)throw new Error("This quote is incompatible with getBuyWithCryptoTransfer. Please use Bridge.Transfer.prepare instead.");const a=i[0];let c;if(a){const u=Ke(["function approve(address spender, uint256 amount)"]),[l,h]=Je(u,a.data);c={amountWei:h.toString(),chainId:s.originToken.chainId,spenderAddress:l,tokenAddress:s.originToken.address}}const d=s.transactions.filter(u=>u.action!=="approval");if(d.length>1)throw new Error("This quote is incompatible with getBuyWithCryptoTransfer. Please use Bridge.Transfer.prepare instead.");const p=d[0];if(!p)throw new Error("This quote is incompatible with getBuyWithCryptoTransfer. Please use Bridge.Transfer.prepare instead.");return{approvalData:c,client:e.client,estimatedGasCostUSDCents:0,fromAddress:e.fromAddress,paymentToken:{amount:$(o.originAmount,s.originToken.decimals).toString(),amountUSDCents:Number($(o.originAmount,s.originToken.decimals))*(s.originToken.prices.USD||0)*100,amountWei:o.originAmount.toString(),token:{chainId:s.originToken.chainId,decimals:s.originToken.decimals,name:s.originToken.name,priceUSDCents:(s.originToken.prices.USD||0)*100,symbol:s.originToken.symbol,tokenAddress:s.originToken.address}},processingFee:{amount:e.feePayer==="sender"?$(o.originAmount-o.destinationAmount,s.originToken.decimals).toString():"0",amountUSDCents:e.feePayer==="sender"?Number($(o.originAmount-o.destinationAmount,s.originToken.decimals))*(s.originToken.prices.USD||0)*100:0,amountWei:e.feePayer==="sender"?(o.originAmount-o.destinationAmount).toString():"0",token:{chainId:s.originToken.chainId,decimals:s.originToken.decimals,name:s.originToken.name,priceUSDCents:(s.originToken.prices.USD||0)*100,symbol:s.originToken.symbol,tokenAddress:s.originToken.address}},toAddress:e.toAddress,transactionRequest:{...p,extraGas:50000n}}}catch(t){throw console.error("Error getting buy with crypto transfer",t),t}}async function Go(e){var c;const[t,n,r,o]=await Promise.all([re(e.transaction),j(e.transaction.to),j(e.transaction.accessList),j(e.transaction.value)]),s=e.from??((c=e.account)==null?void 0:c.address)??void 0,i=Bt({accessList:r,data:t,from:s?U(s):void 0,to:n?U(n):void 0,value:o}),a=Te(e.transaction);try{const d=await Ge(a,i);if(!e.transaction.__preparedMethod)return d;const p=await e.transaction.__preparedMethod(),f=Nt(p[2],d);return Array.isArray(f)&&f.length===1?f[0]:f}catch(d){throw await jt({contract:e.transaction.__contract,error:d,fromAddress:s})}}function Qo(e){return async t=>{var o;if(typeof e=="string"&&e.startsWith("function "))return xt(e);const r=((o=t.abi)!=null&&o.length?t.abi:await We(t)).find(s=>s.type!=="function"?!1:s.name===e);if(!r)throw new Error(`could not find function with name "${e}" in abi`);return r}}function Yo(e){return typeof e=="object"&&e!==null}function je(e,t=[]){return Yo(e)&&t.every(n=>n in e)}function Xo(e){return je(e,["__contract"])&&je(e.__contract,["address","chain"])&&typeof e.__contract.address=="string"}async function es({address:e,signature:t,client:n,chain:r,accountFactory:o,message:s,domain:i,primaryType:a,types:c}){const d=Ut({domain:i,message:s,primaryType:a,types:c});if(!ie(t))return!1;try{if(Lt({payload:d,signature:Mt(t)}).toLowerCase()===e.toLowerCase())return!0}catch{}return qt({accountFactory:o,address:e,chain:r,client:n,hash:d,signature:t})}async function ts(e){const{account:t,request:n}=e;if(typeof t.signAuthorization>"u")throw new Error("This account type does not yet support signing EIP-7702 authorizations");return t.signAuthorization(n)}const hs=Object.freeze(Object.defineProperty({__proto__:null,ADDRESS_ZERO:Pe,Bridge:to,Engine:Co,Insight:Bo,NATIVE_TOKEN_ADDRESS:Ie,ZERO_ADDRESS:Pe,boolToBytes:Ft,boolToHex:Wt,bytesToBigInt:Vt,bytesToBool:Zt,bytesToNumber:Ht,bytesToString:Kt,concatHex:Jt,createThirdwebClient:ro,defineChain:ee,deploySmartAccount:Gt,encode:re,estimateGas:Ze,estimateGasCost:Zo,eth_blockNumber:Qe,eth_call:Ge,eth_estimateGas:Pn,eth_gasPrice:Qt,eth_getBalance:Yt,eth_getBlockByHash:No,eth_getBlockByNumber:Xt,eth_getCode:en,eth_getLogs:ke,eth_getStorageAt:$n,eth_getTransactionByHash:jo,eth_getTransactionCount:On,eth_getTransactionReceipt:Sn,eth_maxPriorityFeePerGas:tn,eth_sendRawTransaction:nn,fromBytes:rn,fromGwei:on,fromHex:sn,getAddress:U,getBuyWithCryptoHistory:Fo,getBuyWithCryptoQuote:Ho,getBuyWithCryptoStatus:Ko,getBuyWithCryptoTransfer:Jo,getContract:X,getContractEvents:vt,getGasPrice:an,getRpcClient:Te,getUser:cn,hexToBigInt:dn,hexToBool:un,hexToBytes:ln,hexToNumber:fn,hexToString:hn,hexToUint8Array:Ue,isAddress:xe,isBaseTransactionOptions:Xo,isHex:ie,keccak256:mn,numberToBytes:pn,numberToHex:F,padHex:gn,parseEventLogs:Ve,prepareContractCall:yn,prepareEvent:he,prepareTransaction:wn,readContract:_n,resolveMethod:Qo,sendAndConfirmTransaction:xn,sendBatchTransaction:Un,sendTransaction:bn,serializeTransaction:kn,sha256:gt,signAuthorization:ts,signTransaction:Tn,simulateTransaction:Go,stringToBytes:Me,stringToHex:In,toBytes:An,toEther:He,toHex:qe,toSerializableTransaction:Fe,toTokens:q,toUnits:vn,toWei:En,uint8ArrayToHex:Le,verifyTypedData:es,waitForReceipt:Cn,watchBlockNumber:Ye,watchContractEvents:Lo},Symbol.toStringTag,{value:"Module"}));export{Oo as g,hs as t};
27
+ })));`),u.write(`newResult[${G(g)}] = ${b}.value`)}u.write("payload.value = newResult;"),u.write("return payload;");const _=u.compile();return(g,b)=>_(f,g,b)};let o;const s=se,i=!ot.jitless,c=i&&Xn.value,d=t.catchall;let p;e._zod.parse=(f,u)=>{p??(p=n.value);const l=f.value;if(!s(l))return f.issues.push({expected:"object",code:"invalid_type",input:l,inst:e}),f;const h=[];if(i&&c&&(u==null?void 0:u.async)===!1&&u.jitless!==!0)o||(o=r(t.shape)),f=o(f,u);else{f.value={};const b=p.shape;for(const w of p.keys){const E=b[w],N=E._zod.run({value:l[w],issues:[]},u),P=E._zod.optin==="optional"&&E._zod.optout==="optional";N instanceof Promise?h.push(N.then(L=>P?Oe(L,f,w,l):ne(L,f,w))):P?Oe(N,f,w,l):ne(N,f,w)}}if(!d)return h.length?Promise.all(h).then(()=>f):f;const m=[],y=p.keySet,_=d._zod,g=_.def.type;for(const b of Object.keys(l)){if(y.has(b))continue;if(g==="never"){m.push(b);continue}const w=_.run({value:l[b],issues:[]},u);w instanceof Promise?h.push(w.then(E=>ne(E,f,b))):ne(w,f,b)}return m.length&&f.issues.push({code:"unrecognized_keys",keys:m,input:l,inst:e}),h.length?Promise.all(h).then(()=>f):f}});function De(e,t,n,r){for(const o of e)if(o.issues.length===0)return t.value=o.value,t;return t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(o=>o.issues.map(s=>K(s,r,H())))}),t}const Ar=T("$ZodUnion",(e,t)=>{C.init(e,t),B(e._zod,"optin",()=>t.options.some(n=>n._zod.optin==="optional")?"optional":void 0),B(e._zod,"optout",()=>t.options.some(n=>n._zod.optout==="optional")?"optional":void 0),B(e._zod,"values",()=>{if(t.options.every(n=>n._zod.values))return new Set(t.options.flatMap(n=>Array.from(n._zod.values)))}),B(e._zod,"pattern",()=>{if(t.options.every(n=>n._zod.pattern)){const n=t.options.map(r=>r._zod.pattern);return new RegExp(`^(${n.map(r=>st(r.source)).join("|")})$`)}}),e._zod.parse=(n,r)=>{let o=!1;const s=[];for(const i of t.options){const a=i._zod.run({value:n.value,issues:[]},r);if(a instanceof Promise)s.push(a),o=!0;else{if(a.issues.length===0)return a;s.push(a)}}return o?Promise.all(s).then(i=>De(i,n,e,r)):De(s,n,e,r)}}),vr=T("$ZodDiscriminatedUnion",(e,t)=>{Ar.init(e,t);const n=e._zod.parse;B(e._zod,"propValues",()=>{const o={};for(const s of t.options){const i=s._zod.propValues;if(!i||Object.keys(i).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(const[a,c]of Object.entries(i)){o[a]||(o[a]=new Set);for(const d of c)o[a].add(d)}}return o});const r=Ae(()=>{const o=t.options,s=new Map;for(const i of o){const a=i._zod.propValues[t.discriminator];if(!a||a.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(const c of a){if(s.has(c))throw new Error(`Duplicate discriminator value "${String(c)}"`);s.set(c,i)}}return s});e._zod.parse=(o,s)=>{const i=o.value;if(!se(i))return o.issues.push({code:"invalid_type",expected:"object",input:i,inst:e}),o;const a=r.value.get(i==null?void 0:i[t.discriminator]);return a?a._zod.run(o,s):t.unionFallback?n(o,s):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",input:i,path:[t.discriminator],inst:e}),o)}}),Er=T("$ZodRecord",(e,t)=>{C.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!er(o))return n.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),n;const s=[];if(t.keyType._zod.values){const i=t.keyType._zod.values;n.value={};for(const c of i)if(typeof c=="string"||typeof c=="number"||typeof c=="symbol"){const d=t.valueType._zod.run({value:o[c],issues:[]},r);d instanceof Promise?s.push(d.then(p=>{p.issues.length&&n.issues.push(...M(c,p.issues)),n.value[c]=p.value})):(d.issues.length&&n.issues.push(...M(c,d.issues)),n.value[c]=d.value)}let a;for(const c in o)i.has(c)||(a=a??[],a.push(c));a&&a.length>0&&n.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:a})}else{n.value={};for(const i of Reflect.ownKeys(o)){if(i==="__proto__")continue;const a=t.keyType._zod.run({value:i,issues:[]},r);if(a instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(a.issues.length){n.issues.push({origin:"record",code:"invalid_key",issues:a.issues.map(d=>K(d,r,H())),input:i,path:[i],inst:e}),n.value[a.value]=a.value;continue}const c=t.valueType._zod.run({value:o[i],issues:[]},r);c instanceof Promise?s.push(c.then(d=>{d.issues.length&&n.issues.push(...M(i,d.issues)),n.value[a.value]=d.value})):(c.issues.length&&n.issues.push(...M(i,c.issues)),n.value[a.value]=c.value)}}return s.length?Promise.all(s).then(()=>n):n}}),Sr=T("$ZodEnum",(e,t)=>{C.init(e,t);const n=Gn(t.entries);e._zod.values=new Set(n),e._zod.pattern=new RegExp(`^(${n.filter(r=>tr.has(typeof r)).map(r=>typeof r=="string"?at(r):r.toString()).join("|")})$`),e._zod.parse=(r,o)=>{const s=r.value;return e._zod.values.has(s)||r.issues.push({code:"invalid_value",values:n,input:s,inst:e}),r}}),Cr=T("$ZodLiteral",(e,t)=>{C.init(e,t),e._zod.values=new Set(t.values),e._zod.pattern=new RegExp(`^(${t.values.map(n=>typeof n=="string"?at(n):n?n.toString():String(n)).join("|")})$`),e._zod.parse=(n,r)=>{const o=n.value;return e._zod.values.has(o)||n.issues.push({code:"invalid_value",values:t.values,input:o,inst:e}),n}}),Pr=T("$ZodOptional",(e,t)=>{C.init(e,t),e._zod.optin="optional",e._zod.optout="optional",B(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),B(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${st(n.source)})?$`):void 0}),e._zod.parse=(n,r)=>t.innerType._zod.optin==="optional"?t.innerType._zod.run(n,r):n.value===void 0?n:t.innerType._zod.run(n,r)}),$r=T("$ZodCustom",(e,t)=>{pr.init(e,t),C.init(e,t),e._zod.parse=(n,r)=>n,e._zod.check=n=>{const r=n.value,o=t.fn(r);if(o instanceof Promise)return o.then(s=>ze(s,n,r,e));ze(o,n,r,e)}});function ze(e,t,n,r){if(!e){const o={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(o.params=r._zod.def.params),t.issues.push(or(o))}}function Or(e,t){return new e({type:"string",...D(t)})}function Dr(e,t){return new e({type:"number",checks:[],...D(t)})}function zr(e,t){return new e({type:"number",coerce:!0,checks:[],...D(t)})}function Rr(e,t){return new e({type:"bigint",coerce:!0,...D(t)})}function Br(e){return new e({type:"unknown"})}function Nr(e,t,n){return new e({type:"custom",check:"custom",fn:t,...D(n)})}const O=T("ZodMiniType",(e,t)=>{if(!e._zod)throw new Error("Uninitialized schema in ZodMiniType.");C.init(e,t),e.def=t,e.parse=(n,r)=>ar(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>dt(e,n,r),e.parseAsync=async(n,r)=>dr(e,n,r,{callee:e.parseAsync}),e.safeParseAsync=async(n,r)=>ut(e,n,r),e.check=(...n)=>e.clone({...t,checks:[...t.checks??[],...n.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),e.clone=(n,r)=>nr(e,n,r),e.brand=()=>e,e.register=((n,r)=>(n.add(e,r),e))}),jr=T("ZodMiniString",(e,t)=>{wr.init(e,t),O.init(e,t)});function S(e){return Or(jr,e)}const lt=T("ZodMiniNumber",(e,t)=>{_r.init(e,t),O.init(e,t)});function xr(e){return Dr(lt,e)}const Ur=T("ZodMiniBigInt",(e,t)=>{br.init(e,t),O.init(e,t)}),Lr=T("ZodMiniUnknown",(e,t)=>{kr.init(e,t),O.init(e,t)});function ft(){return Br(Lr)}const Mr=T("ZodMiniArray",(e,t)=>{Tr.init(e,t),O.init(e,t)});function qr(e,t){return new Mr({type:"array",element:e,...D(t)})}const Fr=T("ZodMiniObject",(e,t)=>{Ir.init(e,t),O.init(e,t),B(e,"shape",()=>t.shape)});function z(e,t){const n={type:"object",get shape(){return Yn(this,"shape",{...e}),this.shape},...D(t)};return new Fr(n)}const Wr=T("ZodMiniDiscriminatedUnion",(e,t)=>{vr.init(e,t),O.init(e,t)});function ve(e,t,n){return new Wr({type:"union",options:t,discriminator:e,...D(n)})}const Vr=T("ZodMiniRecord",(e,t)=>{Er.init(e,t),O.init(e,t)});function Zr(e,t,n){return new Vr({type:"record",keyType:e,valueType:t,...D(n)})}const Hr=T("ZodMiniEnum",(e,t)=>{Sr.init(e,t),O.init(e,t)});function ge(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new Hr({type:"enum",entries:n,...D(t)})}const Kr=T("ZodMiniLiteral",(e,t)=>{Cr.init(e,t),O.init(e,t)});function x(e,t){return new Kr({type:"literal",values:Array.isArray(e)?e:[e],...D(t)})}const Jr=T("ZodMiniOptional",(e,t)=>{Pr.init(e,t),O.init(e,t)});function W(e){return new Jr({type:"optional",innerType:e})}const Gr=T("ZodMiniCustom",(e,t)=>{$r.init(e,t),O.init(e,t)});function ht(e,t={}){return Nr(Gr,e,t)}function Q(e){return zr(lt,e)}function ye(e){return Rr(Ur,e)}const mt=S().check(ht(ie,{message:"Invalid hex string"})),V=S().check(ht(xe,{message:"Invalid address"})),we=z({address:V,chainId:Q(),decimals:Q(),iconUri:W(S()),name:S(),priceUsd:Q(),symbol:S()}),Qr=ve("version",[z({data:z({}),type:x("pay.onchain-transaction"),version:x(1)}),z({data:z({action:ge(["TRANSFER","BUY","SELL"]),clientId:S(),destinationAmount:ye(),destinationToken:we,developerFeeBps:Q(),developerFeeRecipient:V,originAmount:ye(),originToken:we,paymentId:S(),paymentLinkId:W(S()),purchaseData:W(Zr(S(),ft())),receiver:V,sender:V,status:ge(["PENDING","FAILED","COMPLETED"]),transactions:qr(z({chainId:Q(),transactionHash:mt})),type:S()}),type:x("pay.onchain-transaction"),version:x(2)})]),Yr=ve("version",[z({data:z({}),type:x("pay.onramp-transaction"),version:x(1)}),z({data:z({amount:ye(),currency:S(),currencyAmount:xr(),id:S(),onramp:S(),paymentLinkId:W(S()),purchaseData:ft(),receiver:V,sender:W(V),status:ge(["PENDING","COMPLETED","FAILED"]),token:we,transactionHash:W(mt)}),type:x("pay.onramp-transaction"),version:x(2)})]),Xr=ve("type",[Qr,Yr]);async function pt(e,t,n,r=300,o){const s=t["x-payload-signature"]||t["x-pay-signature"],i=t["x-timestamp"]||t["x-pay-timestamp"];if(!s||!i)throw new Error("Missing required webhook headers: signature or timestamp");const a=Math.floor(Date.now()/1e3),c=Number.parseInt(i,10),d=Math.abs(a-c);if(d>r)throw new Error(`Webhook timestamp is too old. Difference: ${d}s, tolerance: ${r}s`);const p=new TextEncoder,f=await crypto.subtle.importKey("raw",p.encode(n),{hash:"SHA-256",name:"HMAC"},!1,["sign"]),u=await crypto.subtle.sign("HMAC",f,p.encode(`${i}.${e}`));if(Array.from(new Uint8Array(u)).map(y=>y.toString(16).padStart(2,"0")).join("")!==s)throw new Error("Invalid webhook signature");let h;try{h=JSON.parse(e)}catch{throw new Error("Invalid webhook payload: not valid JSON")}const m=Xr.parse(h);if(m.version===1)throw new Error("Invalid webhook payload: version 1 is no longer supported, please upgrade to webhook version 2.");if(o){if(o.receiverAddress&&m.data.receiver.toLowerCase()!==o.receiverAddress.toLowerCase())throw new Error(`Verification Failed: receiverAddress mismatch, Expected: ${o.receiverAddress}, Received: ${m.data.receiver}`);if(o.destinationTokenAddress){if("destinationToken"in m.data){if(m.data.destinationToken.address.toLowerCase()!==o.destinationTokenAddress.toLowerCase())throw new Error(`Verification Failed: destinationTokenAddress mismatch, Expected: ${o.destinationTokenAddress}, Received: ${m.data.destinationToken.address}`)}else if("onramp"in m.data&&m.data.token.address.toLowerCase()!==o.destinationTokenAddress.toLowerCase())throw new Error(`Verification Failed: destinationTokenAddress mismatch, Expected: ${o.destinationTokenAddress}, Received: ${m.data.token.address}`)}if(o.destinationChainId){if("destinationToken"in m.data){if(m.data.destinationToken.chainId!==o.destinationChainId)throw new Error(`Verification Failed: destinationChainId mismatch, Expected: ${o.destinationChainId}, Received: ${m.data.destinationToken.chainId}`)}else if("onramp"in m.data&&m.data.token.chainId!==o.destinationChainId)throw new Error(`Verification Failed: destinationChainId mismatch, Expected: ${o.destinationChainId}, Received: ${m.data.token.chainId}`)}if(o.minDestinationAmount){if("destinationAmount"in m.data){if(m.data.destinationAmount<o.minDestinationAmount)throw new Error(`Verification Failed: minDestinationAmount, Expected minimum amount to be ${o.minDestinationAmount}, Received: ${m.data.destinationAmount}`)}else if("onramp"in m.data&&m.data.amount<o.minDestinationAmount)throw new Error(`Verification Failed: minDestinationAmount, Expected minimum amount to be ${o.minDestinationAmount}, Received: ${m.data.amount}`)}}return m}const eo=Object.freeze(Object.defineProperty({__proto__:null,parse:pt},Symbol.toStringTag,{value:"Module"})),to=Object.freeze(Object.defineProperty({__proto__:null,Buy:Mn,Onramp:Vn,Sell:Hn,Transfer:Jn,Webhook:eo,chains:qn,parse:pt,status:nt,tokens:Kn},Symbol.toStringTag,{value:"Module"}));function gt(e,t){const n=Ot(ie(e,{strict:!1})?Ue(e):e);return t==="bytes"?n:Le(n)}const ue=new Ct(4096);function no(e){if(ue.has(e))return ue.get(e);const t=gt(Me(e)).slice(2,34);return ue.set(e,t),t}function ro(e){const{clientId:t,secretKey:n,...r}=e;let o=t;if(n)if(Pt(n)){if(!t)throw new Error("clientId must be provided when using a JWT secretKey")}else o=t??no(n);if(!o)throw new Error("clientId or secretKey must be provided");return{...r,clientId:o,secretKey:n}}const oo={bodySerializer:e=>JSON.stringify(e,(t,n)=>typeof n=="bigint"?n.toString():n)},so=async(e,t)=>{const n=typeof t=="function"?await t(e):t;if(n)return e.scheme==="bearer"?`Bearer ${n}`:e.scheme==="basic"?`Basic ${btoa(n)}`:n},io=e=>{switch(e){case"label":return".";case"matrix":return";";case"simple":return",";default:return"&"}},ao=e=>{switch(e){case"form":return",";case"pipeDelimited":return"|";case"spaceDelimited":return"%20";default:return","}},co=e=>{switch(e){case"label":return".";case"matrix":return";";case"simple":return",";default:return"&"}},yt=({allowReserved:e,explode:t,name:n,style:r,value:o})=>{if(!t){const a=(e?o:o.map(c=>encodeURIComponent(c))).join(ao(r));switch(r){case"label":return`.${a}`;case"matrix":return`;${n}=${a}`;case"simple":return a;default:return`${n}=${a}`}}const s=io(r),i=o.map(a=>r==="label"||r==="simple"?e?a:encodeURIComponent(a):ce({allowReserved:e,name:n,value:a})).join(s);return r==="label"||r==="matrix"?s+i:i},ce=({allowReserved:e,name:t,value:n})=>{if(n==null)return"";if(typeof n=="object")throw new Error("Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these.");return`${t}=${e?n:encodeURIComponent(n)}`},wt=({allowReserved:e,explode:t,name:n,style:r,value:o,valueOnly:s})=>{if(o instanceof Date)return s?o.toISOString():`${n}=${o.toISOString()}`;if(r!=="deepObject"&&!t){let c=[];Object.entries(o).forEach(([p,f])=>{c=[...c,p,e?f:encodeURIComponent(f)]});const d=c.join(",");switch(r){case"form":return`${n}=${d}`;case"label":return`.${d}`;case"matrix":return`;${n}=${d}`;default:return d}}const i=co(r),a=Object.entries(o).map(([c,d])=>ce({allowReserved:e,name:r==="deepObject"?`${n}[${c}]`:c,value:d})).join(i);return r==="label"||r==="matrix"?i+a:a},uo=/\{[^{}]+\}/g,lo=({path:e,url:t})=>{let n=t;const r=t.match(uo);if(r)for(const o of r){let s=!1,i=o.substring(1,o.length-1),a="simple";i.endsWith("*")&&(s=!0,i=i.substring(0,i.length-1)),i.startsWith(".")?(i=i.substring(1),a="label"):i.startsWith(";")&&(i=i.substring(1),a="matrix");const c=e[i];if(c==null)continue;if(Array.isArray(c)){n=n.replace(o,yt({explode:s,name:i,style:a,value:c}));continue}if(typeof c=="object"){n=n.replace(o,wt({explode:s,name:i,style:a,value:c,valueOnly:!0}));continue}if(a==="matrix"){n=n.replace(o,`;${ce({name:i,value:c})}`);continue}const d=encodeURIComponent(a==="label"?`.${c}`:c);n=n.replace(o,d)}return n},_t=({allowReserved:e,array:t,object:n}={})=>o=>{const s=[];if(o&&typeof o=="object")for(const i in o){const a=o[i];if(a!=null)if(Array.isArray(a)){const c=yt({allowReserved:e,explode:!0,name:i,style:"form",value:a,...t});c&&s.push(c)}else if(typeof a=="object"){const c=wt({allowReserved:e,explode:!0,name:i,style:"deepObject",value:a,...n});c&&s.push(c)}else{const c=ce({allowReserved:e,name:i,value:a});c&&s.push(c)}}return s.join("&")},fo=e=>{var n;if(!e)return"stream";const t=(n=e.split(";")[0])==null?void 0:n.trim();if(t){if(t.startsWith("application/json")||t.endsWith("+json"))return"json";if(t==="multipart/form-data")return"formData";if(["application/","audio/","image/","video/"].some(r=>t.startsWith(r)))return"blob";if(t.startsWith("text/"))return"text"}},ho=async({security:e,...t})=>{for(const n of e){const r=await so(n,t.auth);if(!r)continue;const o=n.name??"Authorization";switch(n.in){case"query":t.query||(t.query={}),t.query[o]=r;break;case"cookie":t.headers.append("Cookie",`${o}=${r}`);break;case"header":default:t.headers.set(o,r);break}return}},Re=e=>mo({baseUrl:e.baseUrl,path:e.path,query:e.query,querySerializer:typeof e.querySerializer=="function"?e.querySerializer:_t(e.querySerializer),url:e.url}),mo=({baseUrl:e,path:t,query:n,querySerializer:r,url:o})=>{const s=o.startsWith("/")?o:`/${o}`;let i=(e??"")+s;t&&(i=lo({path:t,url:i}));let a=n?r(n):"";return a.startsWith("?")&&(a=a.substring(1)),a&&(i+=`?${a}`),i},Be=(e,t)=>{var r;const n={...e,...t};return(r=n.baseUrl)!=null&&r.endsWith("/")&&(n.baseUrl=n.baseUrl.substring(0,n.baseUrl.length-1)),n.headers=bt(e.headers,t.headers),n},bt=(...e)=>{const t=new Headers;for(const n of e){if(!n||typeof n!="object")continue;const r=n instanceof Headers?n.entries():Object.entries(n);for(const[o,s]of r)if(s===null)t.delete(o);else if(Array.isArray(s))for(const i of s)t.append(o,i);else s!==void 0&&t.set(o,typeof s=="object"?JSON.stringify(s):s)}return t};class le{constructor(){Object.defineProperty(this,"_fns",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._fns=[]}clear(){this._fns=[]}getInterceptorIndex(t){return typeof t=="number"?this._fns[t]?t:-1:this._fns.indexOf(t)}exists(t){const n=this.getInterceptorIndex(t);return!!this._fns[n]}eject(t){const n=this.getInterceptorIndex(t);this._fns[n]&&(this._fns[n]=null)}update(t,n){const r=this.getInterceptorIndex(t);return this._fns[r]?(this._fns[r]=n,t):!1}use(t){return this._fns=[...this._fns,t],this._fns.length-1}}const po=()=>({error:new le,request:new le,response:new le}),go=_t({allowReserved:!1,array:{explode:!0,style:"form"},object:{explode:!0,style:"deepObject"}}),yo={"Content-Type":"application/json"},kt=(e={})=>({...oo,headers:yo,parseAs:"auto",querySerializer:go,...e}),wo=(e={})=>{let t=Be(kt(),e);const n=()=>({...t}),r=i=>(t=Be(t,i),n()),o=po(),s=async i=>{const a={...t,...i,fetch:i.fetch??t.fetch??globalThis.fetch,headers:bt(t.headers,i.headers)};a.security&&await ho({...a,security:a.security}),a.body&&a.bodySerializer&&(a.body=a.bodySerializer(a.body)),(a.body===void 0||a.body==="")&&a.headers.delete("Content-Type");const c=Re(a),d={redirect:"follow",...a};let p=new Request(c,d);for(const y of o.request._fns)y&&(p=await y(p,a));const f=a.fetch;let u=await f(p);for(const y of o.response._fns)y&&(u=await y(u,p,a));const l={request:p,response:u};if(u.ok){if(u.status===204||u.headers.get("Content-Length")==="0")return a.responseStyle==="data"?{}:{data:{},...l};const y=(a.parseAs==="auto"?fo(u.headers.get("Content-Type")):a.parseAs)??"json";let _;switch(y){case"arrayBuffer":case"blob":case"formData":case"json":case"text":_=await u[y]();break;case"stream":return a.responseStyle==="data"?u.body:{data:u.body,...l}}return y==="json"&&(a.responseValidator&&await a.responseValidator(_),a.responseTransformer&&(_=await a.responseTransformer(_))),a.responseStyle==="data"?_:{data:_,...l}}let h=await u.text();try{h=JSON.parse(h)}catch{}let m=h;for(const y of o.error._fns)y&&(m=await y(h,u,p,a));if(m=m||{},a.throwOnError)throw m;return a.responseStyle==="data"?void 0:{error:m,...l}};return{buildUrl:Re,connect:i=>s({...i,method:"CONNECT"}),delete:i=>s({...i,method:"DELETE"}),get:i=>s({...i,method:"GET"}),getConfig:n,head:i=>s({...i,method:"HEAD"}),interceptors:o,options:i=>s({...i,method:"OPTIONS"}),patch:i=>s({...i,method:"PATCH"}),post:i=>s({...i,method:"POST"}),put:i=>s({...i,method:"PUT"}),request:s,setConfig:r,trace:i=>s({...i,method:"TRACE"})}},J=wo(kt({baseUrl:"https://engine.thirdweb.com"})),_o=e=>(e.client??J).post({security:[{name:"x-secret-key",type:"apiKey"}],url:"/v1/write/transaction",...e,headers:{"Content-Type":"application/json",...e.headers}}),bo=e=>(e.client??J).post({security:[{name:"x-secret-key",type:"apiKey"}],url:"/v1/sign/message",...e,headers:{"Content-Type":"application/json",...e.headers}}),ko=e=>(e.client??J).post({security:[{name:"x-secret-key",type:"apiKey"}],url:"/v1/sign/typed-data",...e,headers:{"Content-Type":"application/json",...e.headers}}),To=e=>((e==null?void 0:e.client)??J).get({security:[{name:"x-secret-key",type:"apiKey"}],url:"/v1/accounts",...e}),Io=e=>((e==null?void 0:e.client)??J).post({security:[{name:"x-secret-key",type:"apiKey"}],url:"/v1/accounts",...e,headers:{"Content-Type":"application/json",...e==null?void 0:e.headers}}),Tt=e=>((e==null?void 0:e.client)??J).post({security:[{name:"x-secret-key",type:"apiKey"}],url:"/v1/transactions/search",...e,headers:{"Content-Type":"application/json",...e==null?void 0:e.headers}});function Ne(e){return"result"in e}async function Ao(e){var s;const{client:t,label:n}=e,r=await Io({baseUrl:v("engineCloud"),body:{label:n},bodySerializer:Z,fetch:A(t)});if(r.error)throw new Error(`Error creating server wallet with label ${n}: ${Z(r.error)}`);const o=(s=r.data)==null?void 0:s.result;if(!o)throw new Error(`No server wallet created with label ${n}`);return o}async function It(e){var i,a,c;const{client:t,transactionId:n}=e,r=await Tt({baseUrl:v("engineCloud"),body:{filters:[{field:"id",operation:"OR",values:[n]}]},bodySerializer:I,fetch:A(t)});if(r.error)throw new Error(`Error searching for transaction ${n}: ${I(r.error)}`);const o=(c=(a=(i=r.data)==null?void 0:i.result)==null?void 0:a.transactions)==null?void 0:c[0];if(!o)throw new Error(`Transaction ${n} not found`);return{...o.executionResult,cancelledAt:o.cancelledAt,chain:Y(Number(o.chainId)),confirmedAt:o.confirmedAt,createdAt:o.createdAt,from:o.from??void 0,id:o.id}}async function vo(e){var o;const{client:t}=e,n=await To({baseUrl:v("engineCloud"),bodySerializer:Z,fetch:A(t),query:{limit:e.limit,page:e.page}});if(n.error)throw new Error(`Error listing server wallets: ${Z(n.error)}`);const r=(o=n.data)==null?void 0:o.result;if(!r)throw new Error("No server wallets found");return r}async function Eo(e){var a;const{client:t,filters:n,pageSize:r=100,page:o=1}=e,s=await Tt({baseUrl:v("engineCloud"),body:{filters:n,limit:r,page:o},bodySerializer:I,fetch:A(t)});if(s.error)throw new Error(`Error searching for transaction with filters ${I(n)}: ${I(s.error)}`);const i=(a=s.data)==null?void 0:a.result;if(!i)throw new Error(`No transactions found with filters ${I(n)}`);return i}async function _e(e){const t=Date.now(),n=e.timeoutInSeconds?e.timeoutInSeconds*1e3:300*1e3;for(;Date.now()-t<n;){const r=await It(e);switch(r.status){case"FAILED":throw new Error(`Transaction failed: ${Z(r.error)||"Unknown error"}`);case"CONFIRMED":{if((r&&"onchainStatus"in r?r.onchainStatus:null)==="REVERTED"){const i="revertData"in r?r.revertData:void 0;throw new Error(`Transaction reverted: ${(i==null?void 0:i.errorName)||"unknown error"} ${i!=null&&i.errorArgs?Z(i.errorArgs):""} - ${r.transactionHash?r.transactionHash:""}`)}return{chain:r.chain,client:e.client,transactionHash:r.transactionHash}}default:await new Promise(s=>setTimeout(s,1e3))}}throw new Error(`Transaction timed out after ${n/1e3} seconds`)}function So(e){const{client:t,vaultAccessToken:n,address:r,chain:o,executionOptions:s}=e,i=n?{"x-vault-access-token":n}:{},a=f=>{if(!s)return{chainId:f,from:r,type:"auto"};switch(s.type){case"auto":return{chainId:f,from:r,type:"auto"};case"ERC4337":return{...s,chainId:f,type:"ERC4337"};case"EOA":return{chainId:f,from:r,type:"EOA"};case"EIP7702":return{...s,chainId:f,type:"EIP7702"}}},c=f=>{if(!f)return{from:r,type:"EOA"};if(!s)return{chainId:f,from:r,type:"auto"};switch(s.type){case"ERC4337":return{chainId:f,...s,type:"ERC4337"};case"auto":return{chainId:f,from:r,type:"auto"};case"EIP7702":case"EOA":return{chainId:f,from:r,type:"EOA"}}},d=async f=>{var _,g,b;if(f.length===0)throw new Error("No transactions to enqueue");const u=f[0];if(!u)throw new Error("No transactions to enqueue");const l=u.chainId;for(let w=1;w<f.length;w++)if(((_=f[w])==null?void 0:_.chainId)!==l)throw new Error(`All transactions in batch must be on the same chain. Expected ${l}, got ${(g=f[w])==null?void 0:g.chainId} at index ${w}`);const h={executionOptions:a(l),params:f.map(w=>{var E;return{data:w.data,to:w.to,gasLimit:w.gas?Number(w.gas):void 0,value:(E=w.value)==null?void 0:E.toString()}})},m=await _o({baseUrl:v("engineCloud"),body:h,bodySerializer:I,fetch:A(t),headers:i});if(m.error)throw new Error(`Error sending transaction: ${I(m.error)}`);const y=(b=m.data)==null?void 0:b.result;if(!y)throw new Error("No data returned from engine");return y.transactions.map(w=>w.id)};return{address:(s==null?void 0:s.type)==="ERC4337"&&s.smartAccountAddress?s.smartAccountAddress:r,enqueueBatchTransaction:async f=>{const u=[];for(const m of f.transactions){const[y,_,g]=await Promise.all([m.to?j(m.to):null,re(m),m.value?j(m.value):null]);u.push({chainId:m.chain.id,data:_,to:y??void 0,value:g??void 0})}const h=(await d(u))[0];if(!h)throw new Error("No transactionId returned from engine");return{transactionId:h}},enqueueTransaction:async f=>{let u;if(f.simulate)u=await Fe({transaction:f.transaction,from:r});else{const[m,y,_]=await Promise.all([f.transaction.to?j(f.transaction.to):null,re(f.transaction),f.transaction.value?j(f.transaction.value):null]);u={chainId:f.transaction.chain.id,data:y,to:m??void 0,value:_??void 0}}const h=(await d([u]))[0];if(!h)throw new Error("No transactionId returned from engine");return{transactionId:h}},sendBatchTransaction:async f=>{const l=(await d(f))[0];if(!l)throw new Error("No transactionId returned from engine");return _e({client:t,transactionId:l})},sendTransaction:async f=>{const l=(await d([f]))[0];if(!l)throw new Error("No transactionId returned from engine");return _e({client:t,transactionId:l})},signMessage:async f=>{var b;const{message:u,chainId:l}=f;let h,m=!1;typeof u=="string"?h=u:(h=qe(u.raw),m=!0);const y=l||(o==null?void 0:o.id);if(!y)throw new Error("Chain ID is required for signing messages");const _=await bo({baseUrl:v("engineCloud"),body:{params:[{format:m?"hex":"text",message:h}],signingOptions:c(y)},bodySerializer:I,fetch:A(t),headers:i});if(_.error)throw new Error(`Error signing message: ${I(_.error)}`);const g=(b=_.data)==null?void 0:b.result[0];if(g&&Ne(g))return g.result.signature;throw new Error(`Failed to sign message: ${I(g==null?void 0:g.error)||"Unknown error"}`)},signTypedData:async f=>{var m;const u=o==null?void 0:o.id;if(!u)throw new Error("Chain ID is required for signing messages");const l=await ko({baseUrl:v("engineCloud"),body:{params:[f],signingOptions:c(u)},bodySerializer:I,fetch:A(t),headers:i});if(l.error)throw new Error(`Error signing message: ${I(l.error)}`);const h=(m=l.data)==null?void 0:m.result[0];if(h&&Ne(h))return h.result.signature;throw new Error(`Failed to sign message: ${I(h==null?void 0:h.error)||"Unknown error"}`)}}}const Co=Object.freeze(Object.defineProperty({__proto__:null,createServerWallet:Ao,getServerWallets:vo,getTransactionStatus:It,searchTransactions:Eo,serverWallet:So,waitForTransactionHash:_e},Symbol.toStringTag,{value:"Module"}));async function Ee(e){var h;const[{getV1EventsByContractAddress:t},{getThirdwebDomains:n},{getClientFetch:r},{assertInsightEnabled:o},{stringify:s}]=await Promise.all([k(()=>import("./thirdweb-DZ2vK6IO.js"),[]),k(()=>import("./utils-nbkSUjEy.js").then(m=>m.q),__vite__mapDeps([0,1,2])),k(()=>import("./utils-nbkSUjEy.js").then(m=>m.r),__vite__mapDeps([0,1,2])),k(()=>import("./common-GsSQn_vD.js"),__vite__mapDeps([3,0,1,2])),k(()=>import("./signing-CoPa7cSW.js").then(m=>m.cT),__vite__mapDeps([4,0,1,2,5,6]))]),{client:i,chains:a,contractAddress:c,event:d,queryOptions:p,decodeLogs:f}=e;await o(a);const u={chain:a.map(m=>m.id),decode:f,limit:100};d&&(u.filter_topic_0=d.topics[0],u.filter_topic_1=d.topics[1],u.filter_topic_2=d.topics[2],u.filter_topic_3=d.topics[3]);const l=await t({baseUrl:`https://${n().insight}`,fetch:r(i),path:{contractAddress:c},query:{...u,...p}});if(l.error)throw new Error(`${l.response.status} ${l.response.statusText} - ${l.error?s(l.error):"Unknown error"}`);return((h=l.data)==null?void 0:h.data)??[]}async function Po(e){var h;const[{getV1Nfts:t},{getThirdwebDomains:n},{getClientFetch:r},{assertInsightEnabled:o},{stringify:s}]=await Promise.all([k(()=>import("./thirdweb-DZ2vK6IO.js"),[]),k(()=>import("./utils-nbkSUjEy.js").then(m=>m.q),__vite__mapDeps([0,1,2])),k(()=>import("./utils-nbkSUjEy.js").then(m=>m.r),__vite__mapDeps([0,1,2])),k(()=>import("./common-GsSQn_vD.js"),__vite__mapDeps([3,0,1,2])),k(()=>import("./index-C2OMQVG4.js"),__vite__mapDeps([7,8,4,0,1,2,5,6,9,10,11,12,13]))]),{client:i,chains:a,ownerAddress:c,contractAddresses:d,queryOptions:p}=e;await o(a);const f={chain:a.map(m=>m.id),limit:50,owner_address:[c],contract_address:d||void 0},u=await t({baseUrl:`https://${n().insight}`,fetch:r(i),query:{...f,...p}});if(u.error)throw new Error(`${u.response.status} ${u.response.statusText} - ${u.error?s(u.error):"Unknown error"}`);return(await Se(((h=u.data)==null?void 0:h.data)??[],i,c)).map(m=>({...m,quantityOwned:m.quantityOwned??1n}))}async function $o(e){var l;const[{getV1NftsByContractAddress:t},{getThirdwebDomains:n},{getClientFetch:r},{assertInsightEnabled:o},{stringify:s}]=await Promise.all([k(()=>import("./thirdweb-DZ2vK6IO.js"),[]),k(()=>import("./utils-nbkSUjEy.js").then(h=>h.q),__vite__mapDeps([0,1,2])),k(()=>import("./utils-nbkSUjEy.js").then(h=>h.r),__vite__mapDeps([0,1,2])),k(()=>import("./common-GsSQn_vD.js"),__vite__mapDeps([3,0,1,2])),k(()=>import("./signing-CoPa7cSW.js").then(h=>h.cT),__vite__mapDeps([4,0,1,2,5,6]))]),{client:i,chains:a,contractAddress:c,includeOwners:d=!0,queryOptions:p}=e,f={chain:a.map(h=>h.id),include_owners:d===!0?"true":"false",limit:50};await o(a);const u=await t({baseUrl:`https://${n().insight}`,fetch:r(i),path:{contract_address:c},query:{...f,...p}});if(u.error)throw new Error(`${u.response.status} ${u.response.statusText} - ${u.error?s(u.error):"Unknown error"}`);return Se(((l=u.data)==null?void 0:l.data)??[],i)}async function Oo(e){var m;const[{getV1NftsByContractAddressByTokenId:t},{getThirdwebDomains:n},{getClientFetch:r},{assertInsightEnabled:o},{stringify:s}]=await Promise.all([k(()=>import("./thirdweb-DZ2vK6IO.js"),[]),k(()=>import("./utils-nbkSUjEy.js").then(y=>y.q),__vite__mapDeps([0,1,2])),k(()=>import("./utils-nbkSUjEy.js").then(y=>y.r),__vite__mapDeps([0,1,2])),k(()=>import("./common-GsSQn_vD.js"),__vite__mapDeps([3,0,1,2])),k(()=>import("./signing-CoPa7cSW.js").then(y=>y.cT),__vite__mapDeps([4,0,1,2,5,6]))]),{client:i,chain:a,contractAddress:c,tokenId:d,includeOwners:p=!0,queryOptions:f}=e;await o([a]);const u={chain_id:[a.id],include_owners:p===!0?"true":"false"},l=await t({baseUrl:`https://${n().insight}`,fetch:r(i),path:{contract_address:c,token_id:d.toString()},query:{...u,...f}});if(l.error)throw new Error(`${l.response.status} ${l.response.statusText} - ${l.error?s(l.error):"Unknown error"}`);const h=await Se(((m=l.data)==null?void 0:m.data)??[],i);return h==null?void 0:h[0]}async function Se(e,t,n){const[{parseNFT:r},{totalSupply:o}]=await Promise.all([k(()=>import("./parseNft-B-POJxiL.js"),__vite__mapDeps([14,5,2,1,6,0,4])),k(()=>import("./totalSupply-BCZn9Djj.js"),__vite__mapDeps([15,4,0,1,2,5,6,16]))]);return await Promise.all(e.map(async s=>{var w;let i;const{contract:a,extra_metadata:c,collection:d,metadata_url:p,chain_id:f,token_id:u,status:l,balance:h,token_type:m,...y}=s;let _=y,g=n?[U(n)]:void 0;if("owner_addresses"in y){const{owner_addresses:E,...N}=y;_=N,g=g??(E==null?void 0:E.map(P=>U(P)))}const b=At({attributes:((w=s.extra_metadata)==null?void 0:w.attributes)??void 0,image:s.image_url,uri:s.metadata_url??"",..._});if((a==null?void 0:a.type)==="erc1155"){const E=await o({contract:X({address:a.address,chain:Y(a.chain_id),client:t}),id:BigInt(u)}).catch(()=>0n);i=r(b,{chainId:(a==null?void 0:a.chain_id)??0,owner:g==null?void 0:g[0],supply:E,tokenAddress:(a==null?void 0:a.address)??"",tokenId:BigInt(u),tokenUri:be(p)??"",type:"ERC1155"})}else i=r(b,{chainId:(a==null?void 0:a.chain_id)??0,owner:g==null?void 0:g[0],tokenAddress:(a==null?void 0:a.address)??"",tokenId:BigInt(u),tokenUri:be(p)??"",type:"ERC721"});return{...i,...(a==null?void 0:a.type)==="erc1155"?{quantityOwned:h?BigInt(h):void 0}:{}}}))}function At(e){if(typeof e!="object"||e===null)return e;for(const t in e)typeof e[t]=="string"?e[t]=be(e[t]):At(e[t]);return e}function be(e){if(!e||typeof e!="string")return e;try{const t=new URL(e);if(t.host.endsWith(".ipfscdn.io")){const n=t.pathname.split("/"),r=n.findIndex(s=>s==="ipfs");if(r===-1)return e;const o=n.slice(r+1).join("/");return o?`ipfs://${o}`:e}}catch{return e}return e}async function Do(e){var l;const[{getV1Tokens:t},{getThirdwebDomains:n},{getClientFetch:r},{assertInsightEnabled:o},{stringify:s}]=await Promise.all([k(()=>import("./thirdweb-DZ2vK6IO.js"),[]),k(()=>import("./utils-nbkSUjEy.js").then(h=>h.q),__vite__mapDeps([0,1,2])),k(()=>import("./utils-nbkSUjEy.js").then(h=>h.r),__vite__mapDeps([0,1,2])),k(()=>import("./common-GsSQn_vD.js"),__vite__mapDeps([3,0,1,2])),k(()=>import("./signing-CoPa7cSW.js").then(h=>h.cT),__vite__mapDeps([4,0,1,2,5,6]))]),{client:i,chains:a,ownerAddress:c,tokenAddresses:d,queryOptions:p}=e;await o(a);const f={chain_id:a.length>0?a.map(h=>h.id):[1],include_native:"true",include_spam:"false",limit:50,metadata:"true",owner_address:[c],token_address:d||void 0,sort_by:"balance",sort_order:"desc"},u=await t({baseUrl:`https://${n().insight}`,fetch:r(i),query:{...f,...p}});if(u.error)throw new Error(`${u.response.status} ${u.response.statusText} - ${u.error?s(u.error):"Unknown error"}`);return zo(((l=u.data)==null?void 0:l.data)??[])}async function zo(e){const{toTokens:t}=await k(async()=>{const{toTokens:n}=await import("./signing-CoPa7cSW.js").then(r=>r.cU);return{toTokens:n}},__vite__mapDeps([4,0,1,2,5,6]));return e.map(n=>{const r=n.decimals??18,o=BigInt(n.balance);return{chainId:n.chain_id,decimals:r,displayValue:t(o,r),name:n.name??"",symbol:n.symbol??"",tokenAddress:n.token_address,value:o}})}async function Ro(e){const[{getV1WalletsByWalletAddressTransactions:t},{getThirdwebDomains:n},{getClientFetch:r},{assertInsightEnabled:o},{stringify:s}]=await Promise.all([k(()=>import("./thirdweb-DZ2vK6IO.js"),[]),k(()=>import("./utils-nbkSUjEy.js").then(l=>l.q),__vite__mapDeps([0,1,2])),k(()=>import("./utils-nbkSUjEy.js").then(l=>l.r),__vite__mapDeps([0,1,2])),k(()=>import("./common-GsSQn_vD.js"),__vite__mapDeps([3,0,1,2])),k(()=>import("./signing-CoPa7cSW.js").then(l=>l.cT),__vite__mapDeps([4,0,1,2,5,6]))]);await o(e.chains);const i=Math.floor((Date.now()-2160*60*60*1e3)/1e3),{client:a,walletAddress:c,chains:d,queryOptions:p}=e,f={chain:d.map(l=>l.id),filter_block_timestamp_gte:i,limit:100},u=await t({baseUrl:`https://${n().insight}`,fetch:r(a),path:{wallet_address:c},query:{...f,...p}});if(u.error)throw new Error(`${u.response.status} ${u.response.statusText} - ${u.error?s(u.error):"Unknown error"}`);return u.data.data||[]}const Bo=Object.freeze(Object.defineProperty({__proto__:null,getContractEvents:Ee,getContractNFTs:$o,getNFT:Oo,getOwnedNFTs:Po,getOwnedTokens:Do,getTransactions:Ro},Symbol.toStringTag,{value:"Module"}));async function No(e,t){const n=t.includeTransactions??!1,r=await e({method:"eth_getBlockByHash",params:[t.blockHash,n]});if(!r)throw new Error("Block not found");return Dt(r)}async function ke(e,t={}){const n=t.topics??[];let r;if(t.blockHash){const o={blockHash:t.blockHash,topics:n};t.address&&(o.address=U(t.address)),r=await e({method:"eth_getLogs",params:[o]})}else{const o={topics:n};t.address&&(o.address=t.address),t.fromBlock&&(o.fromBlock=typeof t.fromBlock=="bigint"?F(t.fromBlock):t.fromBlock),t.toBlock&&(o.toBlock=typeof t.toBlock=="bigint"?F(t.toBlock):t.toBlock),r=await e({method:"eth_getLogs",params:[o]})}return r.map(o=>Xe(o))}async function jo(e,t){const n=await e({method:"eth_getTransactionByHash",params:[t.hash]});if(!n)throw new Error("Transaction not found.");return zt(n)}async function vt(e){var u;const{contract:t,events:n,blockRange:r,useIndexer:o=!0,...s}=e,i=Te(t);if(s.blockHash&&(r||s.fromBlock||s.toBlock))throw new Error("Cannot specify blockHash and range simultaneously,");const a=await Qe(i);if(r){const{fromBlock:l,toBlock:h}=s;if(l!==void 0&&h!==void 0&&BigInt(h)-BigInt(l)!==BigInt(r))throw new Error("Incompatible blockRange with specified fromBlock and toBlock. Please only define fromBlock or toBlock when specifying blockRange.");l!==void 0?s.toBlock=BigInt(l)+BigInt(r)-1n:h!==void 0?s.fromBlock=BigInt(h)-BigInt(r)+1n:(s.toBlock=a,s.fromBlock=a-BigInt(r)+1n)}let c=n??[];if(!(n!=null&&n.length)&&t){if(o){const l=await Ee({chains:[t.chain],client:t.client,contractAddress:t.address,decodeLogs:!0,queryOptions:{filter_block_hash:s.blockHash,filter_block_number_gte:s.fromBlock,filter_block_number_lte:s.toBlock,limit:500}}).catch(()=>null);if(l)return Et(l)}(u=t.abi)!=null&&u.length?c=t.abi.filter(Ce).map(l=>he({signature:l})):c=(await We(t)).filter(Ce).map(h=>he({signature:h}))}const d=n&&n.length>0?n.map(l=>({...s,address:U(t.address),topics:l.topics})):[{...s,address:U(t.address)}];let p=[];if(o)try{p=await Promise.all(d.map(l=>xo({contract:t,params:l})))}catch(l){console.warn("Error fetching from insight, falling back to rpc",l),p=await Promise.all(d.map(h=>ke(i,h)))}else p=await Promise.all(d.map(l=>ke(i,l)));const f=p.flat().sort((l,h)=>Number((l.blockNumber??0n)-(h.blockNumber??0n)));return Ve({events:c,logs:f})}async function xo(e){var i,a,c,d;const{params:t,contract:n}=e,r=typeof t.fromBlock=="bigint"?Number(t.fromBlock):void 0,o=typeof t.toBlock=="bigint"?Number(t.toBlock):void 0,s=await Ee({chains:[n.chain],client:n.client,contractAddress:n.address,queryOptions:{filter_block_hash:t.blockHash,filter_block_number_gte:r,filter_block_number_lte:o,filter_topic_0:(i=t.topics)==null?void 0:i[0],filter_topic_1:(a=t.topics)==null?void 0:a[1],filter_topic_2:(c=t.topics)==null?void 0:c[2],filter_topic_3:(d=t.topics)==null?void 0:d[3],limit:500}});return Et(s)}function Et(e){return e.map(n=>({address:n.address,blockHash:n.block_hash,blockNumber:F(Number(n.block_number)),blockTimestamp:n.block_timestamp,chainId:n.chain_id,data:n.data,logIndex:F(n.log_index),topics:n.topics,transactionHash:n.transaction_hash,transactionIndex:F(n.transaction_index),...n.decoded?{args:{...n.decoded.indexed_params,...n.decoded.non_indexed_params},eventName:n.decoded.name}:{}})).map(n=>Xe(n)).sort((n,r)=>Number((n.blockNumber??0n)-(r.blockNumber??0n)))}async function Uo(e,t){const n=t.retries,r=t.delay;let o=null;for(let s=0;s<n;s++)try{return await e()}catch(i){o=i,await new Promise(a=>setTimeout(a,r))}throw o}function Lo(e){return Ye({...e.contract,latestBlockNumber:e.latestBlockNumber,onNewBlockNumber:async t=>{const n=await Uo(async()=>vt({...e,fromBlock:t,toBlock:t,useIndexer:!1}),{delay:500,retries:3});n.length&&e.onEvents(n)}})}const Mo=()=>{const e=$t().pay;return e.startsWith("localhost")?`http://${e}`:`https://${e}`},qo=()=>`${Mo()}/buy-with-crypto/history/v1`;async function Fo(e){try{const t=new URLSearchParams;t.append("walletAddress",e.walletAddress),t.append("start",e.start.toString()),t.append("count",e.count.toString());const n=t.toString(),r=`${qo()}?${n}`,o=await A(e.client)(r);if(!o.ok){const i=await o.text().catch(()=>null);throw new Error(`HTTP error! status: ${o.status} - ${o.statusText}: ${i||"unknown error"}`)}return(await o.json()).result}catch(t){throw new Error(`Fetch failed: ${t}`)}}const Wo=[Dn.id,zn.id,Rn.id,Bn.id,Nn.id,jn.id,34443,919,42220,44787,204,5611];async function Vo(e){if(e.id===1337||e.id===31337)return!1;if(Wo.includes(e.id))return!0;try{const{getChainMetadata:t}=await k(async()=>{const{getChainMetadata:r}=await import("./utils-nbkSUjEy.js").then(o=>o.u);return{getChainMetadata:r}},__vite__mapDeps([0,1,2]));return(await t(e)).stackType==="optimism_bedrock"}catch{return!1}}async function Zo(e){var c;const{transaction:t}=e,n=e.from??((c=e.account)==null?void 0:c.address)??void 0,r=await j(t.gas)||await Ze({from:n,transaction:t}),o=await Rt(t.client,t.chain),s=o.maxFeePerGas||o.gasPrice;if(s===void 0)throw new Error(`Unable to determine gas price for chain ${t.chain.id}`);let i;if(await Vo(t.chain)){const{estimateL1Fee:d}=await k(async()=>{const{estimateL1Fee:p}=await import("./estimate-l1-fee-Bqou6JLl.js");return{estimateL1Fee:p}},__vite__mapDeps([17,4,0,1,2,5,6]));i=await d({transaction:t})}else i=0n;const a=r*s+i;return{ether:He(a),wei:a}}async function Ho(e){try{const t=await(async()=>{if(e.toAmount){const d=X({address:e.toTokenAddress,chain:Y(e.toChainId),client:e.client}),p=d.address.toLowerCase()===Ie?18:await pe({contract:d}),f=me(e.toAmount,p);return et({amount:f,client:e.client,destinationChainId:e.toChainId,destinationTokenAddress:e.toTokenAddress,originChainId:e.fromChainId,originTokenAddress:e.fromTokenAddress,paymentLinkId:e.paymentLinkId,purchaseData:e.purchaseData,receiver:e.toAddress,sender:e.fromAddress})}else if(e.fromAmount){const d=X({address:e.fromTokenAddress,chain:Y(e.fromChainId),client:e.client}),p=await pe({contract:d}),f=me(e.fromAmount,p);return tt({amount:f,client:e.client,destinationChainId:e.toChainId,destinationTokenAddress:e.toTokenAddress,originChainId:e.fromChainId,originTokenAddress:e.fromTokenAddress,paymentLinkId:e.paymentLinkId,purchaseData:e.purchaseData,receiver:e.toAddress,sender:e.fromAddress})}throw new Error("Invalid quote request, must provide either `fromAmount` or `toAmount`")})(),n=t.steps[0];if(!n)throw new Error("This quote is incompatible with getBuyWithCryptoQuote. Please use Bridge.Buy.prepare instead.");const r=n.transactions.filter(d=>d.action==="approval");if(r.length>1)throw new Error("This quote is incompatible with getBuyWithCryptoQuote. Please use Bridge.Buy.prepare instead.");const o=r[0],s=n.transactions.filter(d=>d.action!=="approval");if(s.length>1)throw new Error("This quote is incompatible with getBuyWithCryptoQuote. Please use Bridge.Buy.prepare instead.");const i=s[0];if(!i)throw new Error("This quote is incompatible with getBuyWithCryptoQuote. Please use Bridge.Buy.prepare instead.");let a;if(o){const d=Ke(["function approve(address spender, uint256 amount)"]),[p,f]=Je(d,o.data);a={amountWei:f.toString(),chainId:n.originToken.chainId,spenderAddress:p,tokenAddress:n.originToken.address}}return{approvalData:a,client:e.client,paymentTokens:[{amount:$(t.originAmount,n.originToken.decimals).toString(),amountUSDCents:Number($(t.originAmount,n.originToken.decimals))*(n.originToken.prices.USD||0)*100,amountWei:t.originAmount.toString(),token:{chainId:n.originToken.chainId,decimals:n.originToken.decimals,name:n.originToken.name,priceUSDCents:(n.originToken.prices.USD||0)*100,symbol:n.originToken.symbol,tokenAddress:n.originToken.address}}],processingFees:[{amount:"0",amountUSDCents:0,amountWei:"0",token:{chainId:n.originToken.chainId,decimals:n.originToken.decimals,name:n.originToken.name,priceUSDCents:(n.originToken.prices.USD||0)*100,symbol:n.originToken.symbol,tokenAddress:n.originToken.address}}],swapDetails:{estimated:{durationSeconds:n.estimatedExecutionTimeMs/1e3,feesUSDCents:0,fromAmountUSDCents:Number($(t.originAmount,n.originToken.decimals))*(n.originToken.prices.USD||0)*100,gasCostUSDCents:0,slippageBPS:0,toAmountMinUSDCents:Number($(t.destinationAmount,n.destinationToken.decimals))*(n.destinationToken.prices.USD||0)*100,toAmountUSDCents:Number($(t.destinationAmount,n.destinationToken.decimals))*(n.destinationToken.prices.USD||0)*100},fromAddress:t.intent.sender,fromAmount:$(t.originAmount,n.originToken.decimals).toString(),fromAmountWei:t.originAmount.toString(),fromToken:{chainId:n.originToken.chainId,decimals:n.originToken.decimals,name:n.originToken.name,priceUSDCents:(n.originToken.prices.USD||0)*100,symbol:n.originToken.symbol,tokenAddress:n.originToken.address},maxSlippageBPS:0,toAddress:t.intent.receiver,toAmount:$(t.destinationAmount,n.destinationToken.decimals).toString(),toAmountMin:$(t.destinationAmount,n.destinationToken.decimals).toString(),toAmountMinWei:t.destinationAmount.toString(),toAmountWei:t.destinationAmount.toString(),toToken:{chainId:n.destinationToken.chainId,decimals:n.destinationToken.decimals,name:n.destinationToken.name,priceUSDCents:(n.destinationToken.prices.USD||0)*100,symbol:n.destinationToken.symbol,tokenAddress:n.destinationToken.address}},transactionRequest:{...i,extraGas:50000n}}}catch(t){throw console.error("Error getting buy with crypto quote",t),t}}async function Ko(e){var t,n,r,o;try{if(!e.transactionHash)throw new Error("Transaction hash is required");const s=await nt({chainId:e.chainId,client:e.client,transactionHash:e.transactionHash});switch(s.status){case"COMPLETED":{const i=(t=s.transactions)==null?void 0:t.find(c=>c.chainId===e.chainId),a=(n=s.transactions)==null?void 0:n.find(c=>c.chainId!==e.chainId);return fe({destinationAmount:s.destinationAmount,destinationChainId:s.destinationChainId,destinationToken:s.destinationToken,destinationTokenAddress:s.destinationTokenAddress,destinationTransaction:a,originAmount:s.originAmount,originChainId:s.originChainId,originToken:s.originToken,originTokenAddress:s.originTokenAddress,originTransaction:i,paymentId:s.paymentId,purchaseData:s.purchaseData,receiver:s.receiver,sender:s.sender,status:s.status})}case"PENDING":return fe({destinationChainId:s.destinationChainId,destinationToken:s.destinationToken,destinationTokenAddress:s.destinationTokenAddress,originAmount:s.originAmount,originChainId:s.originChainId,originToken:s.originToken,originTokenAddress:s.originTokenAddress,paymentId:s.paymentId,purchaseData:s.purchaseData,receiver:s.receiver,sender:s.sender,status:s.status});case"FAILED":{const i=(r=s.transactions)==null?void 0:r.find(c=>c.chainId===e.chainId),a=(o=s.transactions)==null?void 0:o.find(c=>c.chainId!==e.chainId);return fe({destinationChainId:0,destinationToken:void 0,destinationTokenAddress:"",destinationTransaction:a,originAmount:BigInt(0),originChainId:0,originToken:void 0,originTokenAddress:"",originTransaction:i,paymentId:"",purchaseData:s.purchaseData,receiver:"",sender:"",status:s.status})}default:return{status:"NOT_FOUND"}}}catch(s){throw console.error("Fetch error:",s),new Error(`Fetch failed: ${s}`)}}function fe(e){const{originTransaction:t,destinationTransaction:n,status:r,purchaseData:o,originAmount:s,destinationAmount:i,originTokenAddress:a,destinationTokenAddress:c,originChainId:d,destinationChainId:p,sender:f,receiver:u,originToken:l,destinationToken:h}=e;return{bridge:"STARPORT",destination:{amount:h?q(i??BigInt(0),h.decimals).toString():"",amountUSDCents:0,amountWei:(i==null?void 0:i.toString())??"",completedAt:new Date().toISOString(),explorerLink:"",token:{chainId:p,decimals:(h==null?void 0:h.decimals)??18,name:(h==null?void 0:h.name)??"",priceUSDCents:0,symbol:(h==null?void 0:h.symbol)??"",tokenAddress:c},transactionHash:(n==null?void 0:n.transactionHash)??""},fromAddress:f,purchaseData:o,quote:{createdAt:new Date().toISOString(),estimated:{durationSeconds:0,feesUSDCents:0,fromAmountUSDCents:0,gasCostUSDCents:0,slippageBPS:0,toAmountMinUSDCents:0,toAmountUSDCents:0},fromAmount:l?q(s,l.decimals).toString():"",fromAmountWei:s.toString(),fromToken:{chainId:d,decimals:(l==null?void 0:l.decimals)??18,name:(l==null?void 0:l.name)??"",priceUSDCents:0,symbol:(l==null?void 0:l.symbol)??"",tokenAddress:a},toAmount:h&&i?q(i,h.decimals).toString():"",toAmountMin:h?q(i??BigInt(0),h.decimals).toString():"",toAmountMinWei:i?i.toString():"",toAmountWei:i?i.toString():"",toToken:{chainId:p,decimals:(h==null?void 0:h.decimals)??18,name:(h==null?void 0:h.name)??"",priceUSDCents:0,symbol:(h==null?void 0:h.symbol)??"",tokenAddress:c}},source:{amount:l?q(s,l.decimals).toString():"",amountUSDCents:0,amountWei:s.toString(),completedAt:new Date().toISOString(),explorerLink:"",token:{chainId:d,decimals:(l==null?void 0:l.decimals)??18,name:(l==null?void 0:l.name)??"",priceUSDCents:0,symbol:(l==null?void 0:l.symbol)??"",tokenAddress:a},transactionHash:(t==null?void 0:t.transactionHash)??""},status:r,subStatus:r==="COMPLETED"?"SUCCESS":"NONE",swapType:(t==null?void 0:t.chainId)===(n==null?void 0:n.chainId)?"SAME_CHAIN":"CROSS_CHAIN",toAddress:u}}async function Jo(e){try{const t=X({address:e.tokenAddress,chain:Y(e.chainId),client:e.client}),n=t.address.toLowerCase()===Ie?18:await pe({contract:t}),r=me(e.amount,n),o=await rt({amount:r,chainId:e.chainId,client:e.client,feePayer:e.feePayer,paymentLinkId:e.paymentLinkId,purchaseData:e.purchaseData,receiver:e.toAddress,sender:e.fromAddress,tokenAddress:e.tokenAddress}),s=o.steps[0];if(!s)throw new Error("This quote is incompatible with getBuyWithCryptoTransfer. Please use Bridge.Transfer.prepare instead.");const i=s.transactions.filter(u=>u.action==="approval");if(i.length>1)throw new Error("This quote is incompatible with getBuyWithCryptoTransfer. Please use Bridge.Transfer.prepare instead.");const a=i[0];let c;if(a){const u=Ke(["function approve(address spender, uint256 amount)"]),[l,h]=Je(u,a.data);c={amountWei:h.toString(),chainId:s.originToken.chainId,spenderAddress:l,tokenAddress:s.originToken.address}}const d=s.transactions.filter(u=>u.action!=="approval");if(d.length>1)throw new Error("This quote is incompatible with getBuyWithCryptoTransfer. Please use Bridge.Transfer.prepare instead.");const p=d[0];if(!p)throw new Error("This quote is incompatible with getBuyWithCryptoTransfer. Please use Bridge.Transfer.prepare instead.");return{approvalData:c,client:e.client,estimatedGasCostUSDCents:0,fromAddress:e.fromAddress,paymentToken:{amount:$(o.originAmount,s.originToken.decimals).toString(),amountUSDCents:Number($(o.originAmount,s.originToken.decimals))*(s.originToken.prices.USD||0)*100,amountWei:o.originAmount.toString(),token:{chainId:s.originToken.chainId,decimals:s.originToken.decimals,name:s.originToken.name,priceUSDCents:(s.originToken.prices.USD||0)*100,symbol:s.originToken.symbol,tokenAddress:s.originToken.address}},processingFee:{amount:e.feePayer==="sender"?$(o.originAmount-o.destinationAmount,s.originToken.decimals).toString():"0",amountUSDCents:e.feePayer==="sender"?Number($(o.originAmount-o.destinationAmount,s.originToken.decimals))*(s.originToken.prices.USD||0)*100:0,amountWei:e.feePayer==="sender"?(o.originAmount-o.destinationAmount).toString():"0",token:{chainId:s.originToken.chainId,decimals:s.originToken.decimals,name:s.originToken.name,priceUSDCents:(s.originToken.prices.USD||0)*100,symbol:s.originToken.symbol,tokenAddress:s.originToken.address}},toAddress:e.toAddress,transactionRequest:{...p,extraGas:50000n}}}catch(t){throw console.error("Error getting buy with crypto transfer",t),t}}async function Go(e){var c;const[t,n,r,o]=await Promise.all([re(e.transaction),j(e.transaction.to),j(e.transaction.accessList),j(e.transaction.value)]),s=e.from??((c=e.account)==null?void 0:c.address)??void 0,i=Bt({accessList:r,data:t,from:s?U(s):void 0,to:n?U(n):void 0,value:o}),a=Te(e.transaction);try{const d=await Ge(a,i);if(!e.transaction.__preparedMethod)return d;const p=await e.transaction.__preparedMethod(),f=Nt(p[2],d);return Array.isArray(f)&&f.length===1?f[0]:f}catch(d){throw await jt({contract:e.transaction.__contract,error:d,fromAddress:s})}}function Qo(e){return async t=>{var o;if(typeof e=="string"&&e.startsWith("function "))return xt(e);const r=((o=t.abi)!=null&&o.length?t.abi:await We(t)).find(s=>s.type!=="function"?!1:s.name===e);if(!r)throw new Error(`could not find function with name "${e}" in abi`);return r}}function Yo(e){return typeof e=="object"&&e!==null}function je(e,t=[]){return Yo(e)&&t.every(n=>n in e)}function Xo(e){return je(e,["__contract"])&&je(e.__contract,["address","chain"])&&typeof e.__contract.address=="string"}async function es({address:e,signature:t,client:n,chain:r,accountFactory:o,message:s,domain:i,primaryType:a,types:c}){const d=Ut({domain:i,message:s,primaryType:a,types:c});if(!ie(t))return!1;try{if(Lt({payload:d,signature:Mt(t)}).toLowerCase()===e.toLowerCase())return!0}catch{}return qt({accountFactory:o,address:e,chain:r,client:n,hash:d,signature:t})}async function ts(e){const{account:t,request:n}=e;if(typeof t.signAuthorization>"u")throw new Error("This account type does not yet support signing EIP-7702 authorizations");return t.signAuthorization(n)}const hs=Object.freeze(Object.defineProperty({__proto__:null,ADDRESS_ZERO:Pe,Bridge:to,Engine:Co,Insight:Bo,NATIVE_TOKEN_ADDRESS:Ie,ZERO_ADDRESS:Pe,boolToBytes:Ft,boolToHex:Wt,bytesToBigInt:Vt,bytesToBool:Zt,bytesToNumber:Ht,bytesToString:Kt,concatHex:Jt,createThirdwebClient:ro,defineChain:ee,deploySmartAccount:Gt,encode:re,estimateGas:Ze,estimateGasCost:Zo,eth_blockNumber:Qe,eth_call:Ge,eth_estimateGas:Pn,eth_gasPrice:Qt,eth_getBalance:Yt,eth_getBlockByHash:No,eth_getBlockByNumber:Xt,eth_getCode:en,eth_getLogs:ke,eth_getStorageAt:$n,eth_getTransactionByHash:jo,eth_getTransactionCount:On,eth_getTransactionReceipt:Sn,eth_maxPriorityFeePerGas:tn,eth_sendRawTransaction:nn,fromBytes:rn,fromGwei:on,fromHex:sn,getAddress:U,getBuyWithCryptoHistory:Fo,getBuyWithCryptoQuote:Ho,getBuyWithCryptoStatus:Ko,getBuyWithCryptoTransfer:Jo,getContract:X,getContractEvents:vt,getGasPrice:an,getRpcClient:Te,getUser:cn,hexToBigInt:dn,hexToBool:un,hexToBytes:ln,hexToNumber:fn,hexToString:hn,hexToUint8Array:Ue,isAddress:xe,isBaseTransactionOptions:Xo,isHex:ie,keccak256:mn,numberToBytes:pn,numberToHex:F,padHex:gn,parseEventLogs:Ve,prepareContractCall:yn,prepareEvent:he,prepareTransaction:wn,readContract:_n,resolveMethod:Qo,sendAndConfirmTransaction:xn,sendBatchTransaction:Un,sendTransaction:bn,serializeTransaction:kn,sha256:gt,signAuthorization:ts,signTransaction:Tn,simulateTransaction:Go,stringToBytes:Me,stringToHex:In,toBytes:An,toEther:He,toHex:qe,toSerializableTransaction:Fe,toTokens:q,toUnits:vn,toWei:En,uint8ArrayToHex:Le,verifyTypedData:es,waitForReceipt:Cn,watchBlockNumber:Ye,watchContractEvents:Lo},Symbol.toStringTag,{value:"Module"}));export{Oo as g,hs as t};
@@ -1 +1 @@
1
- import{d as n,e as a,r as c}from"./signing-BGpVago5.js";import{d as p}from"./detectExtension-Bdev6B_Y.js";import"./utils-nbkSUjEy.js";import"./ethers-DHDSyreX.js";import"./react-Vu6nbGi5.js";import"./index-Dmfk0azd.js";const e="0xbd85b039",o=[{name:"id",type:"uint256"}],r=[{type:"uint256"}];function y(t){return p({availableSelectors:t,method:[e,o,r]})}function d(t){return a(o,[t.id])}function T(t){return e+d(t).slice(2)}function f(t){return n(r,t)[0]}async function P(t){return c({contract:t.contract,method:[e,o,r],params:[t.id]})}export{e as FN_SELECTOR,f as decodeTotalSupplyResult,T as encodeTotalSupply,d as encodeTotalSupplyParams,y as isTotalSupplySupported,P as totalSupply};
1
+ import{d as n,e as a,r as c}from"./signing-CoPa7cSW.js";import{d as p}from"./detectExtension-DsE82Ej6.js";import"./utils-nbkSUjEy.js";import"./ethers-DHDSyreX.js";import"./react-Vu6nbGi5.js";import"./index-C7-iTfFV.js";const e="0xbd85b039",o=[{name:"id",type:"uint256"}],r=[{type:"uint256"}];function y(t){return p({availableSelectors:t,method:[e,o,r]})}function d(t){return a(o,[t.id])}function T(t){return e+d(t).slice(2)}function f(t){return n(r,t)[0]}async function P(t){return c({contract:t.contract,method:[e,o,r],params:[t.id]})}export{e as FN_SELECTOR,f as decodeTotalSupplyResult,T as encodeTotalSupply,d as encodeTotalSupplyParams,y as isTotalSupplySupported,P as totalSupply};
@@ -1 +1 @@
1
- import{y as d,z as r,A as e}from"./signing-BGpVago5.js";function n(s,{args:u,eventName:l}={}){return{...s,blockHash:s.blockHash?s.blockHash:null,blockNumber:s.blockNumber?BigInt(s.blockNumber):null,logIndex:s.logIndex?Number(s.logIndex):null,transactionHash:s.transactionHash?s.transactionHash:null,transactionIndex:s.transactionIndex?Number(s.transactionIndex):null,...l?{args:u,eventName:l}:{}}}const a={"0x0":"reverted","0x1":"success"};function o(s,u){const l={...s,blockNumber:s.blockNumber?BigInt(s.blockNumber):null,contractAddress:s.contractAddress?s.contractAddress:null,cumulativeGasUsed:s.cumulativeGasUsed?BigInt(s.cumulativeGasUsed):null,effectiveGasPrice:s.effectiveGasPrice?BigInt(s.effectiveGasPrice):null,gasUsed:s.gasUsed?BigInt(s.gasUsed):null,logs:s.logs?s.logs.map(b=>n(b)):null,to:s.to?s.to:null,transactionIndex:s.transactionIndex?e(s.transactionIndex):null,status:s.status?a[s.status]:null,type:s.type?r[s.type]||s.type:null};return s.blobGasPrice&&(l.blobGasPrice=BigInt(s.blobGasPrice)),s.blobGasUsed&&(l.blobGasUsed=BigInt(s.blobGasUsed)),l}const f=d("transactionReceipt",o);export{n as a,f as d,o as f,a as r};
1
+ import{y as d,z as r,A as e}from"./signing-CoPa7cSW.js";function n(s,{args:u,eventName:l}={}){return{...s,blockHash:s.blockHash?s.blockHash:null,blockNumber:s.blockNumber?BigInt(s.blockNumber):null,logIndex:s.logIndex?Number(s.logIndex):null,transactionHash:s.transactionHash?s.transactionHash:null,transactionIndex:s.transactionIndex?Number(s.transactionIndex):null,...l?{args:u,eventName:l}:{}}}const a={"0x0":"reverted","0x1":"success"};function o(s,u){const l={...s,blockNumber:s.blockNumber?BigInt(s.blockNumber):null,contractAddress:s.contractAddress?s.contractAddress:null,cumulativeGasUsed:s.cumulativeGasUsed?BigInt(s.cumulativeGasUsed):null,effectiveGasPrice:s.effectiveGasPrice?BigInt(s.effectiveGasPrice):null,gasUsed:s.gasUsed?BigInt(s.gasUsed):null,logs:s.logs?s.logs.map(b=>n(b)):null,to:s.to?s.to:null,transactionIndex:s.transactionIndex?e(s.transactionIndex):null,status:s.status?a[s.status]:null,type:s.type?r[s.type]||s.type:null};return s.blobGasPrice&&(l.blobGasPrice=BigInt(s.blobGasPrice)),s.blobGasUsed&&(l.blobGasUsed=BigInt(s.blobGasUsed)),l}const f=d("transactionReceipt",o);export{n as a,f as d,o as f,a as r};
@@ -1,4 +1,4 @@
1
- import{a as c,i as s,b as f}from"./lit-element-B3y9oplH.js";import"./index-BseAcDfV.js";import{c as a}from"./index-Bo34Cx12.js";import"./index-BZIVWDQd.js";import"./index-Dmfk0azd.js";import"./react-Vu6nbGi5.js";import"./ethers-DHDSyreX.js";import"./W3MFrameProviderSingleton-HtGM3kiI.js";import"./index-CdfeQ7YK.js";import"./index-DXfwhNfH.js";import"./browser-ponyfill-rND5WOqr.js";import"./NetworkUtil-Ddexw9-U.js";import"./index-CyDCPwX2.js";import"./index-nibyPLVP.js";import"./index-BKg37Q5D.js";import"./index.es-C2X55s9j.js";import"./class-map-CxwNmq0D.js";import"./index-BdBYQDrP.js";import"./index-CDOPdFEN.js";import"./index-P5U8LYs6.js";import"./index-D-VYD1II.js";const d=c`
1
+ import{a as c,i as s,b as f}from"./lit-element-B3y9oplH.js";import"./index-DIMSfymy.js";import{c as a}from"./index-BOQwd6ZB.js";import"./index-2NUAW7ds.js";import"./index-C7-iTfFV.js";import"./react-Vu6nbGi5.js";import"./ethers-DHDSyreX.js";import"./W3MFrameProviderSingleton-D4DCXtQm.js";import"./index-CdfeQ7YK.js";import"./index-C6FQ8I_Q.js";import"./browser-ponyfill-rND5WOqr.js";import"./NetworkUtil-Ddexw9-U.js";import"./index-Pp2oEhTr.js";import"./index-nibyPLVP.js";import"./index-jYazATJj.js";import"./index.es-IGCEipYb.js";import"./class-map-CxwNmq0D.js";import"./index-D3hzhbb8.js";import"./index-CDMAFM2h.js";import"./index--_rHc9Od.js";import"./index-CMavzzI_.js";const d=c`
2
2
  :host > wui-flex:first-child {
3
3
  height: 500px;
4
4
  overflow-y: auto;
@@ -1 +1 @@
1
- import{Q as x,M as N,N as p,O as v,P as b}from"./index-Dmfk0azd.js";var m=class extends x{constructor(e,r){super(e,r)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type="infinite",super.setOptions(e)}getOptimisticResult(e){return e._type="infinite",super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"backward"}}})}createResult(e,r){var d,l;const{state:i}=e,t=super.createResult(e,r),{isFetching:o,isRefetching:P,isError:c,isRefetchError:h}=t,a=(l=(d=i.fetchMeta)==null?void 0:d.fetchMore)==null?void 0:l.direction,s=c&&a==="forward",u=o&&a==="forward",n=c&&a==="backward",g=o&&a==="backward";return{...t,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:p(r,i.data),hasPreviousPage:N(r,i.data),isFetchNextPageError:s,isFetchingNextPage:u,isFetchPreviousPageError:n,isFetchingPreviousPage:g,isRefetchError:h&&!s&&!n,isRefetching:P&&!u&&!g}}};function R(e,r){return v(e,m)}function F(e,r,i={}){var c,h,a;const t=R({queryKey:e,enabled:i.enabled,queryFn:({pageParam:s})=>r(s),initialPageParam:0,getNextPageParam:(s,u)=>{const n=u.reduce((g,f)=>g+f.items.length,0);return n<s.total?n:void 0},placeholderData:b}),o=(((c=t.data)==null?void 0:c.pages)??[]).flatMap(s=>s.items),P=((a=(h=t.data)==null?void 0:h.pages[0])==null?void 0:a.total)??0;return{items:o,total:P,isLoading:t.isLoading,isError:t.isError,error:t.error,hasNextPage:t.hasNextPage,isFetchingNextPage:t.isFetchingNextPage,fetchNextPage:t.fetchNextPage}}export{F as u};
1
+ import{Q as x,M as N,N as p,O as v,P as b}from"./index-C7-iTfFV.js";var m=class extends x{constructor(e,r){super(e,r)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type="infinite",super.setOptions(e)}getOptimisticResult(e){return e._type="infinite",super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"backward"}}})}createResult(e,r){var d,l;const{state:i}=e,t=super.createResult(e,r),{isFetching:o,isRefetching:P,isError:c,isRefetchError:h}=t,a=(l=(d=i.fetchMeta)==null?void 0:d.fetchMore)==null?void 0:l.direction,s=c&&a==="forward",u=o&&a==="forward",n=c&&a==="backward",g=o&&a==="backward";return{...t,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:p(r,i.data),hasPreviousPage:N(r,i.data),isFetchNextPageError:s,isFetchingNextPage:u,isFetchPreviousPageError:n,isFetchingPreviousPage:g,isRefetchError:h&&!s&&!n,isRefetching:P&&!u&&!g}}};function R(e,r){return v(e,m)}function F(e,r,i={}){var c,h,a;const t=R({queryKey:e,enabled:i.enabled,queryFn:({pageParam:s})=>r(s),initialPageParam:0,getNextPageParam:(s,u)=>{const n=u.reduce((g,f)=>g+f.items.length,0);return n<s.total?n:void 0},placeholderData:b}),o=(((c=t.data)==null?void 0:c.pages)??[]).flatMap(s=>s.items),P=((a=(h=t.data)==null?void 0:h.pages[0])==null?void 0:a.total)??0;return{items:o,total:P,isLoading:t.isLoading,isError:t.isError,error:t.error,hasNextPage:t.hasNextPage,isFetchingNextPage:t.isFetchingNextPage,fetchNextPage:t.fetchNextPage}}export{F as u};