@dcl/shop 0.1.0-29337358135.commit-2e4bf7e → 0.1.0-29340836575.commit-42b06a2

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 (207) hide show
  1. package/assets/{AnimatedBackground-DimPo0o6.js → AnimatedBackground-BJT6SNQ-.js} +1 -1
  2. package/assets/{Assets-0rXRECQy.js → Assets-BbxH_ajc.js} +1 -1
  3. package/assets/Button-CbIdTKGq.js +74 -0
  4. package/assets/{Cart-DfisnztS.js → Cart-B75u5mr6.js} +1 -1
  5. package/assets/CircularProgress-Bb7X2tGG.js +28 -0
  6. package/assets/Collection-BfwKvSKq.js +1 -0
  7. package/assets/{ConstantsUtil-CiDezLbv.js → ConstantsUtil-ACwd_9jk.js} +1 -1
  8. package/assets/{Creator-DXuvF7aY.js → Creator-BhojoAb6.js} +1 -1
  9. package/assets/{ExchangeController-DKuss9DL.js → ExchangeController-cjGmwZkn.js} +1 -1
  10. package/assets/{FilterBar-CdU8B66A.js → FilterBar-SMt4LPR3.js} +1 -1
  11. package/assets/GetCredits-BIr2IoRx.js +2 -0
  12. package/assets/{HelpersUtil-BIYA4n9B.js → HelpersUtil-CKZAJVRF.js} +1 -1
  13. package/assets/{ImportListings-CZkdcWaF.js → ImportListings-DHGrAPrQ.js} +1 -1
  14. package/assets/ItemDetail-CST4l0Yr.js +2 -0
  15. package/assets/{LoadMore-BOCtgPLI.js → LoadMore-XFaiIbYi.js} +1 -1
  16. package/assets/Market-Bi1QC-8t.js +1 -0
  17. package/assets/{MenuItem-Ci7Oxa0S.js → MenuItem-dpDClIr2.js} +2 -2
  18. package/assets/MyAssets-DcYeO_rz.js +1 -0
  19. package/assets/{MyFavorites-BzUnpL59.js → MyFavorites-DADI2Z9R.js} +1 -1
  20. package/assets/{MyPurchases-C-MppIV4.js → MyPurchases-qcUrS1KZ.js} +1 -1
  21. package/assets/{NetworkUtil-DDES604E.js → NetworkUtil-DjnLk0yv.js} +1 -1
  22. package/assets/{NotFound-stjqjmfW.js → NotFound-0QuXU6Lt.js} +1 -1
  23. package/assets/{RealCheckout-BXu8QwUw.js → RealCheckout-BKfIbLM5.js} +1 -1
  24. package/assets/{ShopFooterInner-Bw0tZ5jz.js → ShopFooterInner-Cg4meaND.js} +3 -3
  25. package/assets/{SkeletonCards-BysJEVmg.js → SkeletonCards-D-gEhGqV.js} +1 -1
  26. package/assets/{Success-BmFgC1Fj.js → Success-CYidtfRd.js} +1 -1
  27. package/assets/{SwapController-Daflx-KH.js → SwapController-DV1ke3ir.js} +1 -1
  28. package/assets/{TradeService-mwlprIfz.js → TradeService-DwvDhMXL.js} +1 -1
  29. package/assets/{W3MFrameProviderSingleton-OCCNZtGo.js → W3MFrameProviderSingleton-ConR5N7Q.js} +3 -3
  30. package/assets/{WebCryptoP256-DcxhTaIn.js → WebCryptoP256-D8wskqBq.js} +1 -1
  31. package/assets/{basic-DokGV68e.js → basic-BdoC_4UK.js} +1 -1
  32. package/assets/{biconomy-BFplpB0T.js → biconomy-BxUL0Sy9.js} +1 -1
  33. package/assets/{browser-DHYOtFa8.js → browser-D9mB_4O0.js} +1 -1
  34. package/assets/{browser-ponyfill-rND5WOqr.js → browser-ponyfill-BVDAxqNP.js} +1 -1
  35. package/assets/{buy-Cei5j8eO.js → buy-CvV1hrMv.js} +1 -1
  36. package/assets/{buy-gasless-B5QPf-sE.js → buy-gasless-bwypVo2l.js} +1 -1
  37. package/assets/{ccip-n6rH3sVb.js → ccip-C0q-bt9M.js} +1 -1
  38. package/assets/{ccip-38EHg6W8.js → ccip-FbktUcwa.js} +1 -1
  39. package/assets/{chains-Bk629xE3.js → chains-DH0bfsas.js} +1 -1
  40. package/assets/{collection-dxCKqLM-.js → collection-Ctw0QAmS.js} +1 -1
  41. package/assets/{common-CEkVtB9E.js → common-DOWgY5NB.js} +1 -1
  42. package/assets/{controller-DG_iRQPR.js → controller-CrdLqteO.js} +2 -2
  43. package/assets/{core-CIi4Ex77.js → core-BivmCj3q.js} +4 -4
  44. package/assets/{custom-Cjfua0Ef.js → custom-D6JXv2u-.js} +1 -1
  45. package/assets/{data-capture-DXahe72x.js → data-capture-BZosna2M.js} +1 -1
  46. package/assets/{decimals-teeH97v6.js → decimals-Bq0n5t5Q.js} +1 -1
  47. package/assets/decimals-LEmdHeeV.js +1 -0
  48. package/assets/{detectExtension-DX1a8DfW.js → detectExtension-btmjA4FO.js} +1 -1
  49. package/assets/{email-CPaGg29O.js → email-BW478xE_.js} +1 -1
  50. package/assets/{embedded-wallet-BhVpPp0v.js → embedded-wallet-BfM11k_z.js} +1 -1
  51. package/assets/emotion-styled.browser.esm-Q1W1tHJu.js +1 -0
  52. package/assets/{engine-CwdwAsnd.js → engine-DpbzrHw7.js} +1 -1
  53. package/assets/{estimate-l1-fee-BnSv7s_G.js → estimate-l1-fee-BL7s-Hdb.js} +1 -1
  54. package/assets/eth_estimateGas-DxarRY3q.js +1 -0
  55. package/assets/{eth_getStorageAt-DIueLfGz.js → eth_getStorageAt-BS7O7daL.js} +1 -1
  56. package/assets/eth_getTransactionCount-DxKpHM0b.js +1 -0
  57. package/assets/{ethereum-CdeRZR9J.js → ethereum-DR7YR7E0.js} +1 -1
  58. package/assets/{ethers-JeCAM1sd.js → ethers-Da-Ao_qK.js} +1 -1
  59. package/assets/{extractIPFS-BrP7LeOr.js → extractIPFS-C1F-i_xX.js} +1 -1
  60. package/assets/{features-KCpkg70J.js → features-DV9-iVU4.js} +1 -1
  61. package/assets/{fetchTokenMetadata-ZA_LtwkO.js → fetchTokenMetadata-DfwJpo_u.js} +2 -2
  62. package/assets/{fortmatic-B9IU5L1m.js → fortmatic-SZ7rzSVw.js} +1 -1
  63. package/assets/get-ecosystem-wallet-info-DQ6CC5qV.js +1 -0
  64. package/assets/{getBalance-DGzGIvMz.js → getBalance-NbINlj75.js} +2 -2
  65. package/assets/{getInstalledModules-Bx09uT4y.js → getInstalledModules-BYXy94_G.js} +1 -1
  66. package/assets/{getNFT-Zd5KGmRs.js → getNFT-9EcnOuoJ.js} +1 -1
  67. package/assets/{getNFT-tiy4hesk.js → getNFT-SbHQnmww.js} +2 -2
  68. package/assets/{hashTypedData-CtOt2WpE.js → hashTypedData-D3a74WBD.js} +1 -1
  69. package/assets/{hashTypedData-CvnNX2YB.js → hashTypedData-Zum136tW.js} +1 -1
  70. package/assets/{import-Ct60HkEi.js → import-0P_hoA1O.js} +1 -1
  71. package/assets/{in-app-wallet-calls-nAqAaeZM.js → in-app-wallet-calls-C8Q6y1g4.js} +1 -1
  72. package/assets/{index-DZHh5kfE.js → index-1xS0Bm4O.js} +1 -1
  73. package/assets/{index-T0IQCR4g.js → index-6hTlwdzk.js} +1 -1
  74. package/assets/{index-CSh-BHOv.js → index-B6GWtvET.js} +1 -1
  75. package/assets/{index-Bg4LriAo.js → index-B9Fw4Ep3.js} +1 -1
  76. package/assets/{index-DvhSyBnM.js → index-BHN8EEgL.js} +2 -2
  77. package/assets/{index-B8kuIs26.js → index-BMB3NK3d.js} +1 -1
  78. package/assets/{index-Bqxd3bRY.js → index-BSJ14YsY.js} +1 -1
  79. package/assets/{index-CmD3WgD4.js → index-BTbIbxLi.js} +1 -1
  80. package/assets/{index-CmJ_3H94.js → index-BXDmfwwr.js} +1 -1
  81. package/assets/index-Ba1UDc1K.js +4 -0
  82. package/assets/{index-U6KrdqpT.js → index-BaudpEC4.js} +1 -1
  83. package/assets/{index-Bgq0v2Vw.js → index-Bc9cpCsq.js} +2 -2
  84. package/assets/index-BfX0Iuek.js +1 -0
  85. package/assets/{index-Doasr1W7.js → index-BhOBwctB.js} +1 -1
  86. package/assets/{index-CYwcDn0L.js → index-BhrRPEpc.js} +2 -2
  87. package/assets/{index-qVJufJAm.js → index-BlyOq4fH.js} +1 -1
  88. package/assets/{index-C0sZ2G0D.js → index-BxWOVKh-.js} +1 -1
  89. package/assets/index-C0xdJx_z.js +103 -0
  90. package/assets/{index-DXaR1qC5.js → index-CC13YAbK.js} +1 -1
  91. package/assets/{index-9GLN8yqL.js → index-CC4qaKWP.js} +1 -1
  92. package/assets/{index-CUREiiKP.js → index-CKloXofb.js} +1 -1
  93. package/assets/{index-DW9-slpM.js → index-CLOIrTtm.js} +3 -3
  94. package/assets/{index-ChvdYvQ4.js → index-CTmVpGtZ.js} +1 -1
  95. package/assets/{index-Ds5QdmMB.js → index-CXOYo7oq.js} +1 -1
  96. package/assets/{index-Zhfk6Aoz.js → index-CXkvjnsE.js} +1 -1
  97. package/assets/{index-CqQ8Hs5j.js → index-Cfnh9CTE.js} +1 -1
  98. package/assets/index-Cg-lbodg.js +1 -0
  99. package/assets/{index-CCamfLVz.js → index-CklijPAR.js} +1 -1
  100. package/assets/{index-O4fffv47.js → index-CmaXr0F1.js} +1 -1
  101. package/assets/{index-D5Mm7yXQ.js → index-Co3b0xUH.js} +1 -1
  102. package/assets/{index-CIpCj8f1.js → index-CpKwBU2L.js} +1 -1
  103. package/assets/{index-DGRE-ml6.js → index-CpYMcPqd.js} +1 -1
  104. package/assets/{index-CbNdOGip.js → index-CujIBQsu.js} +1 -1
  105. package/assets/{index-Ca3Sav7N.js → index-CwhfvOxd.js} +1 -1
  106. package/assets/{index-Bz7iJIvj.js → index-D5OY3XFL.js} +1 -1
  107. package/assets/index-DC4HR9fs.js +1 -0
  108. package/assets/{index-BLmKUFKr.js → index-DGHmemmg.js} +1 -1
  109. package/assets/{index-BFVyBGs8.js → index-DJgW7J3G.js} +1 -1
  110. package/assets/{index-DssZGhOb.js → index-DOaiFAxt.js} +1 -1
  111. package/assets/{index-Bt1JjNoo.js → index-DViaNBsJ.js} +1 -1
  112. package/assets/{index-RyQIoZwA.js → index-Db4LtK6M.js} +1 -1
  113. package/assets/{index-CtPBA1jA.js → index-DbIP1rx5.js} +1 -1
  114. package/assets/index-DfvjGWsW.js +1 -0
  115. package/assets/{index-ChQKLd7_.js → index-DgVX6Sbk.js} +1 -1
  116. package/assets/{index-t3MAsdpb.js → index-DkyohT42.js} +1 -1
  117. package/assets/{index-BKUufNAr.js → index-DpUGdy7y.js} +1 -1
  118. package/assets/{index-B_xrDWUL.js → index-DswOfqw-.js} +1 -1
  119. package/assets/{index-BTe18ABT.js → index-DwaPQrCP.js} +1 -1
  120. package/assets/{index-eOTACaIJ.js → index-DxuFKp_j.js} +1 -1
  121. package/assets/{index-CImDhWkL.js → index-DzTC2ziQ.js} +2 -2
  122. package/assets/{index-CM4C6c3v.js → index-Dzx0rvp2.js} +1 -1
  123. package/assets/{index-NMzNXj-b.js → index-IeuP0ICf.js} +1 -1
  124. package/assets/{index-fOgQisFj.css → index-Kb_kdzXZ.css} +1 -1
  125. package/assets/{index-U2hrSY35.js → index-L9ytJsVy.js} +1 -1
  126. package/assets/{index-xd5vYVHb.js → index-MZ922Rr9.js} +1 -1
  127. package/assets/{index-BcyJUD4U.js → index-OcdcIxPc.js} +1 -1
  128. package/assets/{index-OFpebMSe.js → index-OmYojNyX.js} +3 -3
  129. package/assets/{index-ClaWRN-y.js → index-SG0VKsUY.js} +1 -1
  130. package/assets/index-Uh870_JT.js +1 -0
  131. package/assets/{index-B9fMKYcR.js → index-iCeMrK9M.js} +1 -1
  132. package/assets/{index.es-CBUy80x9.js → index.es-DCNSZRPv.js} +4 -4
  133. package/assets/{index.es-1m0x5CpA.js → index.es-DnmenyEf.js} +1 -1
  134. package/assets/{index.es-sLZupOx6.js → index.es-dnnBw-vJ.js} +1 -1
  135. package/assets/{localBatchGatewayRequest-Bwch9V5u.js → localBatchGatewayRequest-CDXawD1v.js} +1 -1
  136. package/assets/{mana-rate-BrvfDold.js → mana-rate-N-v6x0qz.js} +1 -1
  137. package/assets/{native-C_y7cRlS.js → native-CRwKvIFQ.js} +1 -1
  138. package/assets/network-CNUk9d-U.js +1 -0
  139. package/assets/{networks-KNRT4yhl.js → networks-CzZJ25bj.js} +1 -1
  140. package/assets/{onramp-vni5tJjM.js → onramp-CESgld-D.js} +1 -1
  141. package/assets/{openzeppelin-Dm8mC4Oq.js → openzeppelin-DixW8ZNo.js} +1 -1
  142. package/assets/{ownerOf-lof10XBl.js → ownerOf-Cn9nz5bP.js} +1 -1
  143. package/assets/{parseNft-COV0EcO6.js → parseNft-f2X47e9d.js} +2 -2
  144. package/assets/{parseSignature-Dx8_igyj.js → parseSignature-CppIaRA5.js} +1 -1
  145. package/assets/{parseSignature-DH_zPldG.js → parseSignature-McHpEr0n.js} +3 -3
  146. package/assets/{pay-with-exchange-D7fz03Hw.js → pay-with-exchange-Bz9JnKT7.js} +1 -1
  147. package/assets/{qr-overlay-B_s_8Smu.js → qr-overlay-BZ2ZuTji.js} +3 -3
  148. package/assets/{react-Vu6nbGi5.js → react-CsaE3SwW.js} +1 -1
  149. package/assets/{receive-Cm4r3Dka.js → receive-npbDk4pC.js} +1 -1
  150. package/assets/{resolveImplementation-DG9O52l9.js → resolveImplementation-BlUu62GJ.js} +1 -1
  151. package/assets/{rpc-BA6d-g1R.js → rpc-DdACnuB3.js} +1 -1
  152. package/assets/{secp256k1-K3jrkFCF.js → secp256k1-CZR5Fxz4.js} +1 -1
  153. package/assets/{secp256k1-zTnesHEt.js → secp256k1-D3x8o48L.js} +1 -1
  154. package/assets/{secp256k1-DqnVksGc.js → secp256k1-TbDPKKLQ.js} +1 -1
  155. package/assets/{send-batch-transaction-D8RkjDD6.js → send-batch-transaction-wv1jzgxZ.js} +1 -1
  156. package/assets/{send-D-iD-Eqx.js → send-cWauCK4u.js} +1 -1
  157. package/assets/{send-eip712-transaction-D224ueJ-.js → send-eip712-transaction-BQ1Jh0dj.js} +2 -2
  158. package/assets/{send-gasless-transaction-B_0JoAQE.js → send-gasless-transaction-Cxum3V3W.js} +2 -2
  159. package/assets/{sendRawTransaction-CA5sPEMX.js → sendRawTransaction-CuIcV-IH.js} +3 -3
  160. package/assets/{serializeTransaction-DoiqxhWF.js → serializeTransaction-CTMmG7wg.js} +1 -1
  161. package/assets/{session-proposal-gostBQZ3.js → session-proposal-DlfPHqdx.js} +1 -1
  162. package/assets/{session-request-CTrIE5mc.js → session-request-Bu2Ik6Mh.js} +2 -2
  163. package/assets/{sha256-DvVglGNs.js → sha256-BUe9Q0c_.js} +1 -1
  164. package/assets/{signing-BNXs2XCn.js → signing-B3Sjg_g9.js} +5 -5
  165. package/assets/{socials-B0f9Npjf.js → socials-Bk9elnPL.js} +1 -1
  166. package/assets/{swaps-CrDXCLmL.js → swaps-beoCSNlb.js} +1 -1
  167. package/assets/{thirdweb-BHHkLfZd.js → thirdweb-B4qZM6uq.js} +3 -3
  168. package/assets/{totalSupply-OMptbxGo.js → totalSupply-DdpNCyrm.js} +1 -1
  169. package/assets/{trade-encoding-Dbk3clLx.js → trade-encoding-Dvpuinzl.js} +1 -1
  170. package/assets/{transactionReceipt-wg3yR0Lm.js → transactionReceipt-B73S0_Of.js} +1 -1
  171. package/assets/{transactions-7oX42CZi.js → transactions-DtrS-H7Q.js} +1 -1
  172. package/assets/useInfiniteGrid-D56AG3-z.js +1 -0
  173. package/assets/{utils-BmX8TqzP.js → utils-B4mWdtoU.js} +1 -1
  174. package/assets/{verifyHash-D-LCgkGR.js → verifyHash-BJmKXlOz.js} +1 -1
  175. package/assets/{w3m-modal-ZsakVEYv.js → w3m-modal-BUYhQlp4.js} +1 -1
  176. package/assets/{w3m-modal-BUd4eWHh.js → w3m-modal-Cy1dZm26.js} +1 -1
  177. package/assets/{wait-for-tx-receipt-gZ6Dq1Eb.js → wait-for-tx-receipt-DccLQgL9.js} +1 -1
  178. package/assets/{wallet-kind-DtWrr4AZ.js → wallet-kind-Bl1SYx87.js} +1 -1
  179. package/assets/{wallets-C7iol5XW.js → wallets-D-cw5_G0.js} +6 -6
  180. package/assets/{web-connector-Dgg6xNHV.js → web-connector-bpLkDDIf.js} +3 -3
  181. package/assets/{writeContract-Bue8cAhq.js → writeContract-TJzHuhGT.js} +1 -1
  182. package/assets/{zora-sepolia-kNKNf7Kl.js → zora-sepolia-C6KXT9LD.js} +1 -1
  183. package/assets/{zoraTestnet-CrA1iIe2.js → zoraTestnet-DYTax4Wr.js} +1 -1
  184. package/index.html +8 -8
  185. package/package.json +2 -2
  186. package/assets/Button-C5iun1df.js +0 -74
  187. package/assets/CircularProgress-e_Dj0fmx.js +0 -28
  188. package/assets/Collection-CAJMA4Fe.js +0 -1
  189. package/assets/GetCredits-DrLnYOdO.js +0 -2
  190. package/assets/ItemDetail-BMgOoWU8.js +0 -2
  191. package/assets/Market-B6NMpu2_.js +0 -1
  192. package/assets/MyAssets-DGLbKyUN.js +0 -1
  193. package/assets/SvgIcon-CBDCsycQ.js +0 -1
  194. package/assets/decimals-CN9Xxdem.js +0 -1
  195. package/assets/eth_estimateGas-Ds0QjpUA.js +0 -1
  196. package/assets/eth_getTransactionCount-joBCO4C6.js +0 -1
  197. package/assets/generateUtilityClasses-uRdMg1ON.js +0 -9
  198. package/assets/get-ecosystem-wallet-info-DezSaPim.js +0 -1
  199. package/assets/index-CKwxO0xv.js +0 -95
  200. package/assets/index-CLIR3TTD.js +0 -1
  201. package/assets/index-CQB-2hib.js +0 -1
  202. package/assets/index-CWxLUWXU.js +0 -4
  203. package/assets/index-CmIVXtjA.js +0 -1
  204. package/assets/index-GZKxkqGp.js +0 -1
  205. package/assets/index-l6x72Ai4.js +0 -1
  206. package/assets/network-DjfG_0s1.js +0 -1
  207. package/assets/useInfiniteGrid-D88R70KF.js +0 -1
@@ -1,4 +1,4 @@
1
- import{r as l,j as v}from"./react-Vu6nbGi5.js";const w="https://cdn.decentraland.org/@dcl/shop/0.1.0-29337358135.commit-2e4bf7e/assets/custom-welcome-background-BxlFQma9.webp",S="https://cdn.decentraland.org/@dcl/shop/0.1.0-29337358135.commit-2e4bf7e/assets/DCL_LogoPattern-BryBPc3d.png",b=`
1
+ import{r as l,j as v}from"./react-CsaE3SwW.js";const w="https://cdn.decentraland.org/@dcl/shop/0.1.0-29340836575.commit-42b06a2/assets/custom-welcome-background-BxlFQma9.webp",S="https://cdn.decentraland.org/@dcl/shop/0.1.0-29340836575.commit-42b06a2/assets/DCL_LogoPattern-BryBPc3d.png",b=`
2
2
  attribute vec2 a_position;
3
3
  varying vec2 v_uv;
4
4
  void main() {
@@ -1 +1 @@
1
- import{r as i,j as e,b as D}from"./react-Vu6nbGi5.js";import{j as P,k as I,A as K,l as J}from"./index-CKwxO0xv.js";import{S as F,F as W,a as Y}from"./FilterBar-CdU8B66A.js";import{S as A}from"./SkeletonCards-BysJEVmg.js";import{L as Z}from"./LoadMore-BOCtgPLI.js";import{u as z}from"./useInfiniteGrid-D88R70KF.js";import"./ethers-JeCAM1sd.js";const Q=[{key:"all",label:"Shop All"},{key:"wearable",label:"Wearables",expandable:!0,subs:[{key:"Head",label:"Head",icon:"cat-head"},{key:"Upper Body",label:"Upper Body",icon:"cat-upper"},{key:"Handwear",label:"Handwear",icon:"cat-handwear"},{key:"Lower Body",label:"Lower Body",icon:"cat-lower"},{key:"Feet",label:"Feet",icon:"cat-feet"},{key:"Accessories",label:"Accessories",icon:"cat-accessories"},{key:"Skins",label:"Skins",icon:"cat-skins"}]},{key:"emote",label:"Emotes",expandable:!0,subs:[{key:"Dance",label:"Dance",icon:"emote-dance"},{key:"Stunt",label:"Stunt",icon:"emote-stunt"},{key:"Greetings",label:"Greetings",icon:"emote-greetings"},{key:"Fun",label:"Fun",icon:"emote-fun"},{key:"Poses",label:"Poses",icon:"emote-poses"},{key:"Reactions",label:"Reactions",icon:"emote-reactions"},{key:"Horror",label:"Horror",icon:"emote-horror"},{key:"Miscellaneous",label:"Miscellaneous",icon:"emote-misc"}]}];function V({category:f,subCategory:n,onCategory:l,onSub:x}){const[c,p]=i.useState(()=>f==="wearable"?"wearable":null);function o(s){s.subs?p(t=>{const u=t!==s.key;return u&&l(s.key),u?s.key:null}):(l(s.key),p(null))}return e.jsx("div",{className:"catfilter",children:Q.map(s=>{const t=c===s.key&&!!s.subs,u=s.key===f;return e.jsxs("div",{className:"catfilter__group",children:[e.jsxs("button",{type:"button",className:`catfilter__cat${t?" is-expanded":""}${u?" is-selected":""}`,onClick:()=>o(s),children:[e.jsx("span",{className:"catfilter__cat-label",children:s.label}),s.expandable?e.jsx("span",{className:`ico ico-chevron catfilter__chev${t?" is-up":""}`,"aria-hidden":!0}):null]}),s.subs?e.jsx("div",{className:`catfilter__subs${t?" is-open":""}`,children:e.jsx("div",{className:"catfilter__subs-inner",children:s.subs.map(r=>e.jsx("button",{type:"button",className:`catfilter__sub${n===r.key?" is-active":""}`,onClick:()=>x(n===r.key?null:r.key),children:e.jsxs("span",{className:"catfilter__sub-left",children:[e.jsx("span",{className:`ico ico-${r.icon} catfilter__sub-ico`,"aria-hidden":!0}),e.jsx("span",{className:"catfilter__sub-label",children:r.label})]})},r.key))})}):null]},s.key)})})}const X=48,ee={Head:["head","hat","hair","facial_hair","eyes","eyebrows","mouth","mask","helmet","tiara","top_head"],"Upper Body":["upper_body"],Handwear:["hands_wear"],"Lower Body":["lower_body"],Feet:["feet"],Accessories:["earring","eyewear"],Skins:["skin"],Dance:["dance"],Stunt:["stunt"],Greetings:["greetings"],Fun:["fun"],Poses:["poses"],Reactions:["reactions"],Horror:["horror"],Miscellaneous:["miscellaneous"]};function ce(){const[f]=D(),n=(f.get("q")??"").trim().toLowerCase(),[l,x]=i.useState("wearable"),[c,p]=i.useState(null),[o,s]=i.useState([]),[t,u]=i.useState(""),[r,N]=i.useState(""),[b,M]=i.useState("newest"),y=t&&!Number.isNaN(Number(t))?Number(t):void 0,h=r&&!Number.isNaN(Number(r))?Number(r):void 0,R=c?ee[c]:void 0,E=(F.find(a=>a.key===b)??F[0]).server,j={category:l,rarities:o.length?o:void 0,wearableCategories:R,minPriceCredits:y,maxPriceCredits:h,search:n||void 0,sortBy:E},{items:S,total:w,isLoading:d,error:L,hasNextPage:B,isFetchingNextPage:v,fetchNextPage:H}=z(["listings",j],a=>J({...j,first:X,skip:a})),_=w,C=i.useRef(null);i.useEffect(()=>{d||!n||C.current===n||(C.current=n,P("Shop Searched",{query:n,result_count:_}))},[n,d,_]);const g=i.useRef("__init__");i.useEffect(()=>{if(d)return;const a=JSON.stringify({category:l,subCategory:c,rarities:o,min:y,max:h,sort:b});if(g.current==="__init__"||g.current===a){g.current=a;return}g.current=a,P("Shop Applied Filter",{filters:{category:l,sub_category:c,rarities:o,min_price_credits:y??null,max_price_credits:h??null,sort:b},result_count:_})},[l,c,o,y,h,b,d,_]);function $(a){x(a),p(null)}function G(a){s(m=>m.includes(a)?m.filter(O=>O!==a):[...m,a])}function T(){x("wearable"),p(null),s([]),u(""),N("")}const k=!!(y||h),U=k?`${t||"0"}–${r||"∞"}`:"Price",q=l!=="wearable"||!!c||o.length>0||k;return e.jsxs("div",{className:"browse browse--sidebar",children:[e.jsx("aside",{className:"browse__sidebar",children:e.jsx(V,{category:l,subCategory:c,onCategory:$,onSub:p})}),e.jsxs("div",{className:"browse__main",children:[e.jsx(W,{rarities:o,onToggleRarity:G,sort:b,onSort:M,total:w,loading:d,query:n,anyActive:q,onClear:T,renderTrailing:a=>e.jsx(Y,{panelKey:"price",label:U,active:k,panel:a,children:e.jsxs("div",{className:"filter-pop filter-pop--price",children:[e.jsxs("div",{className:"filter-pop__price-row",children:[e.jsx("input",{type:"number",min:"0","aria-label":"Minimum price",placeholder:"Min",value:t,onChange:m=>u(m.target.value)}),e.jsx("span",{children:"–"}),e.jsx("input",{type:"number",min:"0","aria-label":"Maximum price",placeholder:"Max",value:r,onChange:m=>N(m.target.value)})]}),e.jsxs("p",{className:"filter-pop__hint",children:["Price in ",I.name]})]})})}),L?e.jsx("p",{className:"error",children:"Couldn’t load items — please try again."}):null,e.jsx("div",{className:"grid",children:d?e.jsx(A,{count:15}):e.jsxs(e.Fragment,{children:[S.map(a=>e.jsx(K,{item:a},a.id)),v?e.jsx(A,{count:6}):null]})}),e.jsx(Z,{hasNextPage:B,isFetching:v,onLoadMore:()=>H()}),!d&&S.length===0?e.jsx("p",{className:"muted",children:"No items match your filters."}):null]})]})}export{ce as Assets};
1
+ import{r as i,j as e,b as D}from"./react-CsaE3SwW.js";import{k as P,l as I,A as K,m as J}from"./index-C0xdJx_z.js";import{S as F,F as W,a as Y}from"./FilterBar-SMt4LPR3.js";import{S as A}from"./SkeletonCards-D-gEhGqV.js";import{L as Z}from"./LoadMore-XFaiIbYi.js";import{u as z}from"./useInfiniteGrid-D56AG3-z.js";import"./ethers-Da-Ao_qK.js";const Q=[{key:"all",label:"Shop All"},{key:"wearable",label:"Wearables",expandable:!0,subs:[{key:"Head",label:"Head",icon:"cat-head"},{key:"Upper Body",label:"Upper Body",icon:"cat-upper"},{key:"Handwear",label:"Handwear",icon:"cat-handwear"},{key:"Lower Body",label:"Lower Body",icon:"cat-lower"},{key:"Feet",label:"Feet",icon:"cat-feet"},{key:"Accessories",label:"Accessories",icon:"cat-accessories"},{key:"Skins",label:"Skins",icon:"cat-skins"}]},{key:"emote",label:"Emotes",expandable:!0,subs:[{key:"Dance",label:"Dance",icon:"emote-dance"},{key:"Stunt",label:"Stunt",icon:"emote-stunt"},{key:"Greetings",label:"Greetings",icon:"emote-greetings"},{key:"Fun",label:"Fun",icon:"emote-fun"},{key:"Poses",label:"Poses",icon:"emote-poses"},{key:"Reactions",label:"Reactions",icon:"emote-reactions"},{key:"Horror",label:"Horror",icon:"emote-horror"},{key:"Miscellaneous",label:"Miscellaneous",icon:"emote-misc"}]}];function V({category:f,subCategory:n,onCategory:l,onSub:x}){const[c,p]=i.useState(()=>f==="wearable"?"wearable":null);function o(s){s.subs?p(t=>{const u=t!==s.key;return u&&l(s.key),u?s.key:null}):(l(s.key),p(null))}return e.jsx("div",{className:"catfilter",children:Q.map(s=>{const t=c===s.key&&!!s.subs,u=s.key===f;return e.jsxs("div",{className:"catfilter__group",children:[e.jsxs("button",{type:"button",className:`catfilter__cat${t?" is-expanded":""}${u?" is-selected":""}`,onClick:()=>o(s),children:[e.jsx("span",{className:"catfilter__cat-label",children:s.label}),s.expandable?e.jsx("span",{className:`ico ico-chevron catfilter__chev${t?" is-up":""}`,"aria-hidden":!0}):null]}),s.subs?e.jsx("div",{className:`catfilter__subs${t?" is-open":""}`,children:e.jsx("div",{className:"catfilter__subs-inner",children:s.subs.map(r=>e.jsx("button",{type:"button",className:`catfilter__sub${n===r.key?" is-active":""}`,onClick:()=>x(n===r.key?null:r.key),children:e.jsxs("span",{className:"catfilter__sub-left",children:[e.jsx("span",{className:`ico ico-${r.icon} catfilter__sub-ico`,"aria-hidden":!0}),e.jsx("span",{className:"catfilter__sub-label",children:r.label})]})},r.key))})}):null]},s.key)})})}const X=48,ee={Head:["head","hat","hair","facial_hair","eyes","eyebrows","mouth","mask","helmet","tiara","top_head"],"Upper Body":["upper_body"],Handwear:["hands_wear"],"Lower Body":["lower_body"],Feet:["feet"],Accessories:["earring","eyewear"],Skins:["skin"],Dance:["dance"],Stunt:["stunt"],Greetings:["greetings"],Fun:["fun"],Poses:["poses"],Reactions:["reactions"],Horror:["horror"],Miscellaneous:["miscellaneous"]};function ce(){const[f]=D(),n=(f.get("q")??"").trim().toLowerCase(),[l,x]=i.useState("wearable"),[c,p]=i.useState(null),[o,s]=i.useState([]),[t,u]=i.useState(""),[r,N]=i.useState(""),[b,M]=i.useState("newest"),y=t&&!Number.isNaN(Number(t))?Number(t):void 0,h=r&&!Number.isNaN(Number(r))?Number(r):void 0,R=c?ee[c]:void 0,E=(F.find(a=>a.key===b)??F[0]).server,j={category:l,rarities:o.length?o:void 0,wearableCategories:R,minPriceCredits:y,maxPriceCredits:h,search:n||void 0,sortBy:E},{items:S,total:w,isLoading:d,error:L,hasNextPage:B,isFetchingNextPage:v,fetchNextPage:H}=z(["listings",j],a=>J({...j,first:X,skip:a})),_=w,C=i.useRef(null);i.useEffect(()=>{d||!n||C.current===n||(C.current=n,P("Shop Searched",{query:n,result_count:_}))},[n,d,_]);const g=i.useRef("__init__");i.useEffect(()=>{if(d)return;const a=JSON.stringify({category:l,subCategory:c,rarities:o,min:y,max:h,sort:b});if(g.current==="__init__"||g.current===a){g.current=a;return}g.current=a,P("Shop Applied Filter",{filters:{category:l,sub_category:c,rarities:o,min_price_credits:y??null,max_price_credits:h??null,sort:b},result_count:_})},[l,c,o,y,h,b,d,_]);function $(a){x(a),p(null)}function G(a){s(m=>m.includes(a)?m.filter(O=>O!==a):[...m,a])}function T(){x("wearable"),p(null),s([]),u(""),N("")}const k=!!(y||h),U=k?`${t||"0"}–${r||"∞"}`:"Price",q=l!=="wearable"||!!c||o.length>0||k;return e.jsxs("div",{className:"browse browse--sidebar",children:[e.jsx("aside",{className:"browse__sidebar",children:e.jsx(V,{category:l,subCategory:c,onCategory:$,onSub:p})}),e.jsxs("div",{className:"browse__main",children:[e.jsx(W,{rarities:o,onToggleRarity:G,sort:b,onSort:M,total:w,loading:d,query:n,anyActive:q,onClear:T,renderTrailing:a=>e.jsx(Y,{panelKey:"price",label:U,active:k,panel:a,children:e.jsxs("div",{className:"filter-pop filter-pop--price",children:[e.jsxs("div",{className:"filter-pop__price-row",children:[e.jsx("input",{type:"number",min:"0","aria-label":"Minimum price",placeholder:"Min",value:t,onChange:m=>u(m.target.value)}),e.jsx("span",{children:"–"}),e.jsx("input",{type:"number",min:"0","aria-label":"Maximum price",placeholder:"Max",value:r,onChange:m=>N(m.target.value)})]}),e.jsxs("p",{className:"filter-pop__hint",children:["Price in ",I.name]})]})})}),L?e.jsx("p",{className:"error",children:"Couldn’t load items — please try again."}):null,e.jsx("div",{className:"grid",children:d?e.jsx(A,{count:15}):e.jsxs(e.Fragment,{children:[S.map(a=>e.jsx(K,{item:a},a.id)),v?e.jsx(A,{count:6}):null]})}),e.jsx(Z,{hasNextPage:B,isFetching:v,onLoadMore:()=>H()}),!d&&S.length===0?e.jsx("p",{className:"muted",children:"No items match your filters."}):null]})]})}export{ce as Assets};
@@ -0,0 +1,74 @@
1
+ import{a4 as Ge,ax as Xe,ay as Ye,az as qe,aA as Je,U as Y,V as b,X as z,S as ee,T as se,aB as Ze,$ as H,a1 as le,R as Ce,aC as be,aD as we,aE as Z,Z as Re,aF as Qe,aG as et,aH as tt,aI as ot,Y as T,aJ as nt,aK as w}from"./index-C0xdJx_z.js";import{r as l,j as B,R as X}from"./react-CsaE3SwW.js";function it(e){return Object.keys(e).length===0}function at(e=null){const t=l.useContext(Ge);return!t||it(t)?e:t}const rt=Xe();function st(e=rt){return at(e)}function Me(e){var t,o,i="";if(typeof e=="string"||typeof e=="number")i+=e;else if(typeof e=="object")if(Array.isArray(e)){var n=e.length;for(t=0;t<n;t++)e[t]&&(o=Me(e[t]))&&(i&&(i+=" "),i+=o)}else for(o in e)e[o]&&(i&&(i+=" "),i+=o);return i}function lt(){for(var e,t,o=0,i="",n=arguments.length;o<n;o++)(e=arguments[o])&&(t=Me(e))&&(i&&(i+=" "),i+=t);return i}const ct=["className","component"];function ut(e={}){const{themeId:t,defaultTheme:o,defaultClassName:i="MuiBox-root",generateClassName:n}=e,a=Ye("div",{shouldForwardProp:u=>u!=="theme"&&u!=="sx"&&u!=="as"})(qe);return l.forwardRef(function(c,p){const f=st(o),g=Je(c),{className:m,component:v="div"}=g,h=Y(g,ct);return B.jsx(a,b({as:v,ref:p,className:lt(m,n?n(i):i),theme:t&&f[t]||f},h))})}function ae(e,t){return ae=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(o,i){return o.__proto__=i,o},ae(e,t)}function pt(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,ae(e,t)}const ge=X.createContext(null);function dt(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ce(e,t){var o=function(a){return t&&l.isValidElement(a)?t(a):a},i=Object.create(null);return e&&l.Children.map(e,function(n){return n}).forEach(function(n){i[n.key]=o(n)}),i}function ft(e,t){e=e||{},t=t||{};function o(f){return f in t?t[f]:e[f]}var i=Object.create(null),n=[];for(var a in e)a in t?n.length&&(i[a]=n,n=[]):n.push(a);var r,u={};for(var c in t){if(i[c])for(r=0;r<i[c].length;r++){var p=i[c][r];u[i[c][r]]=o(p)}u[c]=o(c)}for(r=0;r<n.length;r++)u[n[r]]=o(n[r]);return u}function A(e,t,o){return o[t]!=null?o[t]:e.props[t]}function ht(e,t){return ce(e.children,function(o){return l.cloneElement(o,{onExited:t.bind(null,o),in:!0,appear:A(o,"appear",e),enter:A(o,"enter",e),exit:A(o,"exit",e)})})}function bt(e,t,o){var i=ce(e.children),n=ft(t,i);return Object.keys(n).forEach(function(a){var r=n[a];if(l.isValidElement(r)){var u=a in t,c=a in i,p=t[a],f=l.isValidElement(p)&&!p.props.in;c&&(!u||f)?n[a]=l.cloneElement(r,{onExited:o.bind(null,r),in:!0,exit:A(r,"exit",e),enter:A(r,"enter",e)}):!c&&u&&!f?n[a]=l.cloneElement(r,{in:!1}):c&&u&&l.isValidElement(p)&&(n[a]=l.cloneElement(r,{onExited:o.bind(null,r),in:p.props.in,exit:A(r,"exit",e),enter:A(r,"enter",e)}))}}),n}var gt=Object.values||function(e){return Object.keys(e).map(function(t){return e[t]})},mt={component:"div",childFactory:function(t){return t}},ue=(function(e){pt(t,e);function t(i,n){var a;a=e.call(this,i,n)||this;var r=a.handleExited.bind(dt(a));return a.state={contextValue:{isMounting:!0},handleExited:r,firstRender:!0},a}var o=t.prototype;return o.componentDidMount=function(){this.mounted=!0,this.setState({contextValue:{isMounting:!1}})},o.componentWillUnmount=function(){this.mounted=!1},t.getDerivedStateFromProps=function(n,a){var r=a.children,u=a.handleExited,c=a.firstRender;return{children:c?ht(n,u):bt(n,r,u),firstRender:!1}},o.handleExited=function(n,a){var r=ce(this.props.children);n.key in r||(n.props.onExited&&n.props.onExited(a),this.mounted&&this.setState(function(u){var c=b({},u.children);return delete c[n.key],{children:c}}))},o.render=function(){var n=this.props,a=n.component,r=n.childFactory,u=Y(n,["component","childFactory"]),c=this.state.contextValue,p=gt(this.state.children).map(r);return delete u.appear,delete u.enter,delete u.exit,a===null?X.createElement(ge.Provider,{value:c},p):X.createElement(ge.Provider,{value:c},X.createElement(a,u,p))},t})(X.Component);ue.propTypes={};ue.defaultProps=mt;function xt(e){const{className:t,classes:o,pulsate:i=!1,rippleX:n,rippleY:a,rippleSize:r,in:u,onExited:c,timeout:p}=e,[f,g]=l.useState(!1),m=z(t,o.ripple,o.rippleVisible,i&&o.ripplePulsate),v={width:r,height:r,top:-(r/2)+a,left:-(r/2)+n},h=z(o.child,f&&o.childLeaving,i&&o.childPulsate);return!u&&!f&&g(!0),l.useEffect(()=>{if(!u&&c!=null){const C=setTimeout(c,p);return()=>{clearTimeout(C)}}},[c,u,p]),B.jsx("span",{className:m,style:v,children:B.jsx("span",{className:h})})}const E=ee("MuiTouchRipple",["root","ripple","rippleVisible","ripplePulsate","child","childLeaving","childPulsate"]),vt=["center","classes","className"];let te=e=>e,me,xe,ve,ye;const re=550,yt=80,Ct=le(me||(me=te`
2
+ 0% {
3
+ transform: scale(0);
4
+ opacity: 0.1;
5
+ }
6
+
7
+ 100% {
8
+ transform: scale(1);
9
+ opacity: 0.3;
10
+ }
11
+ `)),Rt=le(xe||(xe=te`
12
+ 0% {
13
+ opacity: 1;
14
+ }
15
+
16
+ 100% {
17
+ opacity: 0;
18
+ }
19
+ `)),Mt=le(ve||(ve=te`
20
+ 0% {
21
+ transform: scale(1);
22
+ }
23
+
24
+ 50% {
25
+ transform: scale(0.92);
26
+ }
27
+
28
+ 100% {
29
+ transform: scale(1);
30
+ }
31
+ `)),zt=H("span",{name:"MuiTouchRipple",slot:"Root"})({overflow:"hidden",pointerEvents:"none",position:"absolute",zIndex:0,top:0,right:0,bottom:0,left:0,borderRadius:"inherit"}),Et=H(xt,{name:"MuiTouchRipple",slot:"Ripple"})(ye||(ye=te`
32
+ opacity: 0;
33
+ position: absolute;
34
+
35
+ &.${0} {
36
+ opacity: 0.3;
37
+ transform: scale(1);
38
+ animation-name: ${0};
39
+ animation-duration: ${0}ms;
40
+ animation-timing-function: ${0};
41
+ }
42
+
43
+ &.${0} {
44
+ animation-duration: ${0}ms;
45
+ }
46
+
47
+ & .${0} {
48
+ opacity: 1;
49
+ display: block;
50
+ width: 100%;
51
+ height: 100%;
52
+ border-radius: 50%;
53
+ background-color: currentColor;
54
+ }
55
+
56
+ & .${0} {
57
+ opacity: 0;
58
+ animation-name: ${0};
59
+ animation-duration: ${0}ms;
60
+ animation-timing-function: ${0};
61
+ }
62
+
63
+ & .${0} {
64
+ position: absolute;
65
+ /* @noflip */
66
+ left: 0px;
67
+ top: 0;
68
+ animation-name: ${0};
69
+ animation-duration: 2500ms;
70
+ animation-timing-function: ${0};
71
+ animation-iteration-count: infinite;
72
+ animation-delay: 200ms;
73
+ }
74
+ `),E.rippleVisible,Ct,re,({theme:e})=>e.transitions.easing.easeInOut,E.ripplePulsate,({theme:e})=>e.transitions.duration.shorter,E.child,E.childLeaving,Rt,re,({theme:e})=>e.transitions.easing.easeInOut,E.childPulsate,Mt,({theme:e})=>e.transitions.easing.easeInOut),Tt=l.forwardRef(function(t,o){const i=se({props:t,name:"MuiTouchRipple"}),{center:n=!1,classes:a={},className:r}=i,u=Y(i,vt),[c,p]=l.useState([]),f=l.useRef(0),g=l.useRef(null);l.useEffect(()=>{g.current&&(g.current(),g.current=null)},[c]);const m=l.useRef(!1),v=Ze(),h=l.useRef(null),C=l.useRef(null),_=l.useCallback(d=>{const{pulsate:R,rippleX:x,rippleY:y,rippleSize:L,cb:O}=d;p(M=>[...M,B.jsx(Et,{classes:{ripple:z(a.ripple,E.ripple),rippleVisible:z(a.rippleVisible,E.rippleVisible),ripplePulsate:z(a.ripplePulsate,E.ripplePulsate),child:z(a.child,E.child),childLeaving:z(a.childLeaving,E.childLeaving),childPulsate:z(a.childPulsate,E.childPulsate)},timeout:re,pulsate:R,rippleX:x,rippleY:y,rippleSize:L},f.current)]),f.current+=1,g.current=O},[a]),V=l.useCallback((d={},R={},x=()=>{})=>{const{pulsate:y=!1,center:L=n||R.pulsate,fakeElement:O=!1}=R;if((d==null?void 0:d.type)==="mousedown"&&m.current){m.current=!1;return}(d==null?void 0:d.type)==="touchstart"&&(m.current=!0);const M=O?null:C.current,D=M?M.getBoundingClientRect():{width:0,height:0,left:0,top:0};let P,j,F;if(L||d===void 0||d.clientX===0&&d.clientY===0||!d.clientX&&!d.touches)P=Math.round(D.width/2),j=Math.round(D.height/2);else{const{clientX:W,clientY:k}=d.touches&&d.touches.length>0?d.touches[0]:d;P=Math.round(W-D.left),j=Math.round(k-D.top)}if(L)F=Math.sqrt((2*D.width**2+D.height**2)/3),F%2===0&&(F+=1);else{const W=Math.max(Math.abs((M?M.clientWidth:0)-P),P)*2+2,k=Math.max(Math.abs((M?M.clientHeight:0)-j),j)*2+2;F=Math.sqrt(W**2+k**2)}d!=null&&d.touches?h.current===null&&(h.current=()=>{_({pulsate:y,rippleX:P,rippleY:j,rippleSize:F,cb:x})},v.start(yt,()=>{h.current&&(h.current(),h.current=null)})):_({pulsate:y,rippleX:P,rippleY:j,rippleSize:F,cb:x})},[n,_,v]),S=l.useCallback(()=>{V({},{pulsate:!0})},[V]),I=l.useCallback((d,R)=>{if(v.clear(),(d==null?void 0:d.type)==="touchend"&&h.current){h.current(),h.current=null,v.start(0,()=>{I(d,R)});return}h.current=null,p(x=>x.length>0?x.slice(1):x),g.current=R},[v]);return l.useImperativeHandle(o,()=>({pulsate:S,start:V,stop:I}),[S,V,I]),B.jsx(zt,b({className:z(E.root,a.root,r),ref:C},u,{children:B.jsx(ue,{component:null,exit:!0,children:c})}))});function Bt(e){return Ce("MuiButtonBase",e)}const $t=ee("MuiButtonBase",["root","disabled","focusVisible"]),It=["action","centerRipple","children","className","component","disabled","disableRipple","disableTouchRipple","focusRipple","focusVisibleClassName","LinkComponent","onBlur","onClick","onContextMenu","onDragLeave","onFocus","onFocusVisible","onKeyDown","onKeyUp","onMouseDown","onMouseLeave","onMouseUp","onTouchEnd","onTouchMove","onTouchStart","tabIndex","TouchRippleProps","touchRippleRef","type"],Pt=e=>{const{disabled:t,focusVisible:o,focusVisibleClassName:i,classes:n}=e,r=Re({root:["root",t&&"disabled",o&&"focusVisible"]},Bt,n);return o&&i&&(r.root+=` ${i}`),r},kt=H("button",{name:"MuiButtonBase",slot:"Root",overridesResolver:(e,t)=>t.root})({display:"inline-flex",alignItems:"center",justifyContent:"center",position:"relative",boxSizing:"border-box",WebkitTapHighlightColor:"transparent",backgroundColor:"transparent",outline:0,border:0,margin:0,borderRadius:0,padding:0,cursor:"pointer",userSelect:"none",verticalAlign:"middle",MozAppearance:"none",WebkitAppearance:"none",textDecoration:"none",color:"inherit","&::-moz-focus-inner":{borderStyle:"none"},[`&.${$t.disabled}`]:{pointerEvents:"none",cursor:"default"},"@media print":{colorAdjust:"exact"}}),Nt=l.forwardRef(function(t,o){const i=se({props:t,name:"MuiButtonBase"}),{action:n,centerRipple:a=!1,children:r,className:u,component:c="button",disabled:p=!1,disableRipple:f=!1,disableTouchRipple:g=!1,focusRipple:m=!1,LinkComponent:v="a",onBlur:h,onClick:C,onContextMenu:_,onDragLeave:V,onFocus:S,onFocusVisible:I,onKeyDown:d,onKeyUp:R,onMouseDown:x,onMouseLeave:y,onMouseUp:L,onTouchEnd:O,onTouchMove:M,onTouchStart:D,tabIndex:P=0,TouchRippleProps:j,touchRippleRef:F,type:W}=i,k=Y(i,It),K=l.useRef(null),$=l.useRef(null),Ee=be($,F),{isFocusVisibleRef:pe,onFocus:Te,onBlur:Be,ref:$e}=we(),[U,q]=l.useState(!1);p&&U&&q(!1),l.useImperativeHandle(n,()=>({focusVisible:()=>{q(!0),K.current.focus()}}),[]);const[oe,Ie]=l.useState(!1);l.useEffect(()=>{Ie(!0)},[]);const Pe=oe&&!f&&!p;l.useEffect(()=>{U&&m&&!f&&oe&&$.current.pulsate()},[f,m,U,oe]);function N(s,fe,Ke=g){return Z(he=>(fe&&fe(he),!Ke&&$.current&&$.current[s](he),!0))}const ke=N("start",x),Ne=N("stop",_),Ve=N("stop",V),Se=N("stop",L),Le=N("stop",s=>{U&&s.preventDefault(),y&&y(s)}),De=N("start",D),je=N("stop",O),Fe=N("stop",M),_e=N("stop",s=>{Be(s),pe.current===!1&&q(!1),h&&h(s)},!1),Oe=Z(s=>{K.current||(K.current=s.currentTarget),Te(s),pe.current===!0&&(q(!0),I&&I(s)),S&&S(s)}),ne=()=>{const s=K.current;return c&&c!=="button"&&!(s.tagName==="A"&&s.href)},ie=l.useRef(!1),We=Z(s=>{m&&!ie.current&&U&&$.current&&s.key===" "&&(ie.current=!0,$.current.stop(s,()=>{$.current.start(s)})),s.target===s.currentTarget&&ne()&&s.key===" "&&s.preventDefault(),d&&d(s),s.target===s.currentTarget&&ne()&&s.key==="Enter"&&!p&&(s.preventDefault(),C&&C(s))}),Ue=Z(s=>{m&&s.key===" "&&$.current&&U&&!s.defaultPrevented&&(ie.current=!1,$.current.stop(s,()=>{$.current.pulsate(s)})),R&&R(s),C&&s.target===s.currentTarget&&ne()&&s.key===" "&&!s.defaultPrevented&&C(s)});let J=c;J==="button"&&(k.href||k.to)&&(J=v);const G={};J==="button"?(G.type=W===void 0?"button":W,G.disabled=p):(!k.href&&!k.to&&(G.role="button"),p&&(G["aria-disabled"]=p));const Ae=be(o,$e,K),de=b({},i,{centerRipple:a,component:c,disabled:p,disableRipple:f,disableTouchRipple:g,focusRipple:m,tabIndex:P,focusVisible:U}),He=Pt(de);return B.jsxs(kt,b({as:J,className:z(He.root,u),ownerState:de,onBlur:_e,onClick:C,onContextMenu:Ne,onFocus:Oe,onKeyDown:We,onKeyUp:Ue,onMouseDown:ke,onMouseLeave:Le,onMouseUp:Se,onDragLeave:Ve,onTouchEnd:je,onTouchMove:Fe,onTouchStart:De,ref:Ae,tabIndex:p?-1:P,type:W},G,k,{children:[r,Pe?B.jsx(Tt,b({ref:Ee,center:a},j)):null]}))}),Vt=ee("MuiBox",["root"]),St=tt(),Gt=ut({themeId:et,defaultTheme:St,defaultClassName:Vt.root,generateClassName:Qe.generate});function Lt(e){return Ce("MuiButton",e)}const Q=ee("MuiButton",["root","text","textInherit","textPrimary","textSecondary","textSuccess","textError","textInfo","textWarning","outlined","outlinedInherit","outlinedPrimary","outlinedSecondary","outlinedSuccess","outlinedError","outlinedInfo","outlinedWarning","contained","containedInherit","containedPrimary","containedSecondary","containedSuccess","containedError","containedInfo","containedWarning","disableElevation","focusVisible","disabled","colorInherit","colorPrimary","colorSecondary","colorSuccess","colorError","colorInfo","colorWarning","textSizeSmall","textSizeMedium","textSizeLarge","outlinedSizeSmall","outlinedSizeMedium","outlinedSizeLarge","containedSizeSmall","containedSizeMedium","containedSizeLarge","sizeMedium","sizeSmall","sizeLarge","fullWidth","startIcon","endIcon","icon","iconSizeSmall","iconSizeMedium","iconSizeLarge"]),Dt=l.createContext({}),jt=l.createContext(void 0),Ft=["children","color","component","className","disabled","disableElevation","disableFocusRipple","endIcon","focusVisibleClassName","fullWidth","size","startIcon","type","variant"],_t=e=>{const{color:t,disableElevation:o,fullWidth:i,size:n,variant:a,classes:r}=e,u={root:["root",a,`${a}${T(t)}`,`size${T(n)}`,`${a}Size${T(n)}`,`color${T(t)}`,o&&"disableElevation",i&&"fullWidth"],label:["label"],startIcon:["icon","startIcon",`iconSize${T(n)}`],endIcon:["icon","endIcon",`iconSize${T(n)}`]},c=Re(u,Lt,r);return b({},r,c)},ze=e=>b({},e.size==="small"&&{"& > *:nth-of-type(1)":{fontSize:18}},e.size==="medium"&&{"& > *:nth-of-type(1)":{fontSize:20}},e.size==="large"&&{"& > *:nth-of-type(1)":{fontSize:22}}),Ot=H(Nt,{shouldForwardProp:e=>nt(e)||e==="classes",name:"MuiButton",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:o}=e;return[t.root,t[o.variant],t[`${o.variant}${T(o.color)}`],t[`size${T(o.size)}`],t[`${o.variant}Size${T(o.size)}`],o.color==="inherit"&&t.colorInherit,o.disableElevation&&t.disableElevation,o.fullWidth&&t.fullWidth]}})(({theme:e,ownerState:t})=>{var o,i;const n=e.palette.mode==="light"?e.palette.grey[300]:e.palette.grey[800],a=e.palette.mode==="light"?e.palette.grey.A100:e.palette.grey[700];return b({},e.typography.button,{minWidth:64,padding:"6px 16px",borderRadius:(e.vars||e).shape.borderRadius,transition:e.transitions.create(["background-color","box-shadow","border-color","color"],{duration:e.transitions.duration.short}),"&:hover":b({textDecoration:"none",backgroundColor:e.vars?`rgba(${e.vars.palette.text.primaryChannel} / ${e.vars.palette.action.hoverOpacity})`:w.alpha(e.palette.text.primary,e.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:"transparent"}},t.variant==="text"&&t.color!=="inherit"&&{backgroundColor:e.vars?`rgba(${e.vars.palette[t.color].mainChannel} / ${e.vars.palette.action.hoverOpacity})`:w.alpha(e.palette[t.color].main,e.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:"transparent"}},t.variant==="outlined"&&t.color!=="inherit"&&{border:`1px solid ${(e.vars||e).palette[t.color].main}`,backgroundColor:e.vars?`rgba(${e.vars.palette[t.color].mainChannel} / ${e.vars.palette.action.hoverOpacity})`:w.alpha(e.palette[t.color].main,e.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:"transparent"}},t.variant==="contained"&&{backgroundColor:e.vars?e.vars.palette.Button.inheritContainedHoverBg:a,boxShadow:(e.vars||e).shadows[4],"@media (hover: none)":{boxShadow:(e.vars||e).shadows[2],backgroundColor:(e.vars||e).palette.grey[300]}},t.variant==="contained"&&t.color!=="inherit"&&{backgroundColor:(e.vars||e).palette[t.color].dark,"@media (hover: none)":{backgroundColor:(e.vars||e).palette[t.color].main}}),"&:active":b({},t.variant==="contained"&&{boxShadow:(e.vars||e).shadows[8]}),[`&.${Q.focusVisible}`]:b({},t.variant==="contained"&&{boxShadow:(e.vars||e).shadows[6]}),[`&.${Q.disabled}`]:b({color:(e.vars||e).palette.action.disabled},t.variant==="outlined"&&{border:`1px solid ${(e.vars||e).palette.action.disabledBackground}`},t.variant==="contained"&&{color:(e.vars||e).palette.action.disabled,boxShadow:(e.vars||e).shadows[0],backgroundColor:(e.vars||e).palette.action.disabledBackground})},t.variant==="text"&&{padding:"6px 8px"},t.variant==="text"&&t.color!=="inherit"&&{color:(e.vars||e).palette[t.color].main},t.variant==="outlined"&&{padding:"5px 15px",border:"1px solid currentColor"},t.variant==="outlined"&&t.color!=="inherit"&&{color:(e.vars||e).palette[t.color].main,border:e.vars?`1px solid rgba(${e.vars.palette[t.color].mainChannel} / 0.5)`:`1px solid ${w.alpha(e.palette[t.color].main,.5)}`},t.variant==="contained"&&{color:e.vars?e.vars.palette.text.primary:(o=(i=e.palette).getContrastText)==null?void 0:o.call(i,e.palette.grey[300]),backgroundColor:e.vars?e.vars.palette.Button.inheritContainedBg:n,boxShadow:(e.vars||e).shadows[2]},t.variant==="contained"&&t.color!=="inherit"&&{color:(e.vars||e).palette[t.color].contrastText,backgroundColor:(e.vars||e).palette[t.color].main},t.color==="inherit"&&{color:"inherit",borderColor:"currentColor"},t.size==="small"&&t.variant==="text"&&{padding:"4px 5px",fontSize:e.typography.pxToRem(13)},t.size==="large"&&t.variant==="text"&&{padding:"8px 11px",fontSize:e.typography.pxToRem(15)},t.size==="small"&&t.variant==="outlined"&&{padding:"3px 9px",fontSize:e.typography.pxToRem(13)},t.size==="large"&&t.variant==="outlined"&&{padding:"7px 21px",fontSize:e.typography.pxToRem(15)},t.size==="small"&&t.variant==="contained"&&{padding:"4px 10px",fontSize:e.typography.pxToRem(13)},t.size==="large"&&t.variant==="contained"&&{padding:"8px 22px",fontSize:e.typography.pxToRem(15)},t.fullWidth&&{width:"100%"})},({ownerState:e})=>e.disableElevation&&{boxShadow:"none","&:hover":{boxShadow:"none"},[`&.${Q.focusVisible}`]:{boxShadow:"none"},"&:active":{boxShadow:"none"},[`&.${Q.disabled}`]:{boxShadow:"none"}}),Wt=H("span",{name:"MuiButton",slot:"StartIcon",overridesResolver:(e,t)=>{const{ownerState:o}=e;return[t.startIcon,t[`iconSize${T(o.size)}`]]}})(({ownerState:e})=>b({display:"inherit",marginRight:8,marginLeft:-4},e.size==="small"&&{marginLeft:-2},ze(e))),Ut=H("span",{name:"MuiButton",slot:"EndIcon",overridesResolver:(e,t)=>{const{ownerState:o}=e;return[t.endIcon,t[`iconSize${T(o.size)}`]]}})(({ownerState:e})=>b({display:"inherit",marginRight:-4,marginLeft:8},e.size==="small"&&{marginRight:-2},ze(e))),Xt=l.forwardRef(function(t,o){const i=l.useContext(Dt),n=l.useContext(jt),a=ot(i,t),r=se({props:a,name:"MuiButton"}),{children:u,color:c="primary",component:p="button",className:f,disabled:g=!1,disableElevation:m=!1,disableFocusRipple:v=!1,endIcon:h,focusVisibleClassName:C,fullWidth:_=!1,size:V="medium",startIcon:S,type:I,variant:d="text"}=r,R=Y(r,Ft),x=b({},r,{color:c,component:p,disabled:g,disableElevation:m,disableFocusRipple:v,fullWidth:_,size:V,type:I,variant:d}),y=_t(x),L=S&&B.jsx(Wt,{className:y.startIcon,ownerState:x,children:S}),O=h&&B.jsx(Ut,{className:y.endIcon,ownerState:x,children:h}),M=n||"";return B.jsxs(Ot,b({ownerState:x,className:z(i.className,y.root,f,M),component:p,disabled:g,focusRipple:!v,focusVisibleClassName:z(y.focusVisible,C),ref:o,type:I},R,{classes:y,children:[L,u,O]}))});export{Nt as B,ge as T,pt as _,at as a,Xt as b,Gt as c,Dt as d,jt as e,st as u};
@@ -1 +1 @@
1
- import{a as ee,r as x,j as s,L as A}from"./react-Vu6nbGi5.js";import{v as se,w as te,o as P,a as ae,c as re,x as ne,y as ce,t as R,C as ie,d as I,k as K,A as le,j as F,z as B,D as z,E as oe,F as de,G as D,H as ue,I as he,g as me,J as pe,l as fe}from"./index-CKwxO0xv.js";import{b as O}from"./buy-Cei5j8eO.js";import{g as _e,b as ye,w as ge,S as be,G as xe}from"./buy-gasless-B5QPf-sE.js";import"./ethers-JeCAM1sd.js";import"./trade-encoding-Dbk3clLx.js";import"./index-NMzNXj-b.js";function je(t){return Math.ceil(t/10)}async function ve(t,r,d){var C;const g=[],a=[],j=[];for(const n of t)try{const m=await d(n);if(!m){a.push(n);continue}if(se(m,r)){j.push(n);continue}const c=te((C=m.received[0])==null?void 0:C.amount);if(!Number.isFinite(c)||c<=0){a.push(n);continue}g.push({item:n,trade:m,usdCents:c,priceCredits:je(c)})}catch{a.push(n)}const v=g.reduce((n,m)=>n+m.priceCredits,0),p=a.length>0||j.length>0||g.some(n=>n.priceCredits!==n.item.priceCredits);return{buyable:g,unavailable:a,own:j,liveTotalCredits:v,orderChanged:p}}function Q(t){const r=t,d=(r.message??"").toLowerCase();return r.code===4001||d.includes("reject")||d.includes("denied")||d.includes("cancel")?"You cancelled the request.":d.includes("insufficient")?`You don't have enough ${K.name} — get more first.`:d.includes("no active listing")||d.includes("your own listing")?r.message:"Couldn't complete checkout — please try again."}const Ce=12e4;function Ne(t){const r=[];return t.unavailable.length&&r.push(`${t.unavailable.length} no longer available`),t.own.length&&r.push(`${t.own.length} you can't buy (your own listing)`),`Removed ${r.join(" and ")} from your cart.`}function Ie(){const t=P(e=>e.items),r=P(e=>e.remove),d=P(e=>e.clear),g=P(e=>e.setFittingOpen),{session:a}=ae(),j=t.some(e=>e.category!=="emote"),{data:v}=re({queryKey:["upsell-listings"],queryFn:()=>fe({first:40}),staleTime:6e4}),{data:p}=ne(a),C=ce(),n=ee(),[m,c]=x.useState(null),[q,f]=x.useState(null),[G,S]=x.useState(null),[N,E]=x.useState(!1),[u,w]=x.useState(null),L=x.useRef(0),T=t.reduce((e,i)=>e+i.priceCredits,0),H=u?u.liveTotalCredits:T,V=new Set(t.map(e=>e.id)),M=((v==null?void 0:v.items)??[]).filter(e=>!V.has(e.id)).slice(0,6),J=new Map(u==null?void 0:u.buyable.map(e=>[e.item.id,e])),X=e=>e.tradeId?me(e.tradeId):pe(e.contractAddress,e.itemId??"");function U(e){e(),w(null),S(null),f(null)}async function W(e){if(!a||e.length===0)return;const i=e.map(l=>({...l.item,priceCredits:l.priceCredits})),y=[];let k="authorize",$=!1;try{c("Preparing your order…");const l=[];for(const o of e){const{credit:b,maxCreditedValue:_}=await oe(a.identity,o.usdCents,o.item.tradeId);y.push(b.id),l.push({trade:o.trade,credits:[b],maxCreditedValue:_})}c("Confirming your purchase…"),k="submit";let h=[];if(_e())try{h=await ye({purchases:l,buyer:a.address,signer:a.signer});const b=(await Promise.allSettled(h.map(_=>ge(_)))).flatMap(_=>_.status==="rejected"?[_.reason]:[]);if(b.length&&!b.some(_=>_ instanceof be))throw b[0];$=!0}catch(o){if(!(o instanceof xe))throw o;h=await O({purchases:l,buyer:a.address,signer:a.signer})}else h=await O({purchases:l,buyer:a.address,signer:a.signer});e.forEach(o=>r(o.item.id)),w(null),c("Purchased! 🎉"),F("Shop Completed Purchase",{...de(i),payment_type:"credits",no_crypto_step:$,transaction_hash:h[0]??null}),C.invalidateQueries({queryKey:["usd-balance"]}),n("/success",{state:{items:i,txHash:h[0]}})}catch(l){if(D(l)||z(l,{flow:"cart_checkout",step:k,cart_size:e.length}),F(D(l)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:k,error_code:ue(l),value_usd:B(i.reduce((h,o)=>h+o.priceCredits,0)),cart_size:e.length}),y.length){try{await he(a.identity,y)}catch(h){z(h,{flow:"cart_checkout",step:"release"})}C.invalidateQueries({queryKey:["usd-balance"]})}f(Q(l)),c(null)}}async function Y(){if(!a){f("Sign in to check out.");return}f(null),S(null),E(!0),F("Shop Started Checkout",{cart_size:t.length,cart_value_credits:T,cart_value_usd:B(T),has_sufficient_credits:((p==null?void 0:p.credits)??0)>=T});try{c("Reviewing your cart…");const e=await ve(t,a.address,X),i=[...e.unavailable,...e.own];if(i.length&&(i.forEach(y=>r(y.id)),S(Ne(e))),e.buyable.length===0){f("None of these items are available to buy right now."),w(null),c(null);return}if(e.orderChanged){w(e),L.current=Date.now(),c(null);return}await W(e.buyable)}catch(e){z(e,{flow:"cart_checkout",step:"review",cart_size:t.length}),f(Q(e)),c(null)}finally{E(!1)}}async function Z(){if(u){if(!a){f("Sign in to check out.");return}if(Date.now()-L.current>Ce){w(null),S(null),await Y();return}f(null),E(!0);try{await W(u.buyable)}finally{E(!1)}}}return t.length===0?s.jsxs("div",{className:"cart cart--empty",children:[s.jsx("span",{className:"ico ico-cart cart-empty__ico","aria-hidden":!0}),s.jsx("p",{className:"cart-empty__title",children:R("cart.empty.title")}),s.jsx("p",{className:"muted",children:R("cart.empty.body")}),s.jsx(A,{className:"btn btn--purple",to:"/assets",children:R("cart.empty.cta")})]}):s.jsxs("div",{className:"cart",children:[s.jsxs("h1",{children:["Cart (",t.length,")"]}),s.jsxs("div",{className:"cart__body",children:[s.jsxs("div",{className:"cart__main",children:[s.jsx("div",{className:"cart__list",children:t.map(e=>{const i=J.get(e.id),y=i?i.priceCredits:e.priceCredits,k=!!i&&i.priceCredits!==e.priceCredits;return s.jsxs("div",{className:"cart__row",children:[s.jsx("div",{className:"cart__thumb",children:e.thumbnail?s.jsx("img",{src:e.thumbnail,alt:e.name}):null}),s.jsxs("div",{className:"cart__info",children:[s.jsx("div",{className:"cart__name",children:e.name}),e.creator?s.jsx(ie,{address:e.creator,className:"cart__creator",linkToProfile:!0}):null]}),s.jsxs("div",{className:"cart__price",children:[s.jsx(I,{className:"ccy-mark"})," ",y,k?s.jsx("span",{className:"muted",style:{marginLeft:6,textDecoration:"line-through"},children:e.priceCredits}):null]}),s.jsx("button",{className:"cart__remove",onClick:()=>U(()=>r(e.id)),disabled:N,"aria-label":`Remove ${e.name}`,title:"Remove",children:s.jsx("span",{className:"ico ico-trash","aria-hidden":!0})})]},e.id)})}),s.jsxs("div",{className:"cart__utils",children:[s.jsx("button",{className:"link",onClick:()=>U(d),disabled:N,children:"Clear cart"}),null]})]}),s.jsxs("aside",{className:"cart__summary",children:[s.jsx("h2",{className:"cart__summary-title",children:"Order summary"}),s.jsxs("div",{className:"cart__total",children:[s.jsxs("div",{className:"cart__total-line",children:[s.jsx("span",{children:"Total"}),s.jsxs("strong",{children:[s.jsx(I,{className:"ccy-mark"})," ",H]})]}),a?s.jsxs("div",{className:"muted cart__balance",children:["Your balance: ",s.jsx(I,{className:"ccy-mark"})," ",(p==null?void 0:p.credits)??0]}):null]}),s.jsxs("div",{className:"cart__actions",children:[s.jsx("button",{className:"btn btn--purple cart__checkout",onClick:u?Z:Y,disabled:N,children:N?"Working…":u?"Confirm purchase":"Checkout"}),s.jsxs(A,{className:"btn btn--ghost",to:"/credits",children:["Get ",K.name]}),j?s.jsx("button",{className:"btn btn--ghost",onClick:()=>g(!0),disabled:N,children:"Try on outfit"}):null]}),u?s.jsx("p",{className:"muted cart__msg",children:"Prices or availability changed since you added these — review the updated total and confirm to buy."}):null,G?s.jsx("p",{className:"muted cart__msg",children:G}):null,m?s.jsx("p",{className:"muted cart__msg",children:m}):null,q?s.jsx("p",{className:"error cart__msg",children:q}):null]})]}),M.length>0?s.jsxs("section",{className:"row cart-upsell",children:[s.jsx("div",{className:"row__head",children:s.jsx("h2",{className:"row__title",children:"You might also like"})}),s.jsx("div",{className:"row__track",children:M.map(e=>s.jsx(le,{item:e},e.id))})]}):null]})}export{Ie as Cart};
1
+ import{a as ee,r as x,j as s,L as A}from"./react-CsaE3SwW.js";import{w as se,x as te,q as P,c as ae,u as re,y as ne,z as ce,t as R,C as ie,e as I,l as Q,A as le,k as F,D as B,E as q,F as oe,G as de,H as D,I as ue,J as he,h as me,K as pe,m as fe}from"./index-C0xdJx_z.js";import{b as K}from"./buy-CvV1hrMv.js";import{g as _e,b as ye,w as ge,S as be,G as xe}from"./buy-gasless-bwypVo2l.js";import"./ethers-Da-Ao_qK.js";import"./trade-encoding-Dvpuinzl.js";import"./index-IeuP0ICf.js";function je(t){return Math.ceil(t/10)}async function ve(t,r,d){var C;const g=[],a=[],j=[];for(const n of t)try{const m=await d(n);if(!m){a.push(n);continue}if(se(m,r)){j.push(n);continue}const c=te((C=m.received[0])==null?void 0:C.amount);if(!Number.isFinite(c)||c<=0){a.push(n);continue}g.push({item:n,trade:m,usdCents:c,priceCredits:je(c)})}catch{a.push(n)}const v=g.reduce((n,m)=>n+m.priceCredits,0),p=a.length>0||j.length>0||g.some(n=>n.priceCredits!==n.item.priceCredits);return{buyable:g,unavailable:a,own:j,liveTotalCredits:v,orderChanged:p}}function O(t){const r=t,d=(r.message??"").toLowerCase();return r.code===4001||d.includes("reject")||d.includes("denied")||d.includes("cancel")?"You cancelled the request.":d.includes("insufficient")?`You don't have enough ${Q.name} — get more first.`:d.includes("no active listing")||d.includes("your own listing")?r.message:"Couldn't complete checkout — please try again."}const Ce=12e4;function Ne(t){const r=[];return t.unavailable.length&&r.push(`${t.unavailable.length} no longer available`),t.own.length&&r.push(`${t.own.length} you can't buy (your own listing)`),`Removed ${r.join(" and ")} from your cart.`}function Ie(){const t=P(e=>e.items),r=P(e=>e.remove),d=P(e=>e.clear),g=P(e=>e.setFittingOpen),{session:a}=ae(),j=t.some(e=>e.category!=="emote"),{data:v}=re({queryKey:["upsell-listings"],queryFn:()=>fe({first:40}),staleTime:6e4}),{data:p}=ne(a),C=ce(),n=ee(),[m,c]=x.useState(null),[z,f]=x.useState(null),[G,S]=x.useState(null),[N,E]=x.useState(!1),[u,w]=x.useState(null),L=x.useRef(0),T=t.reduce((e,i)=>e+i.priceCredits,0),H=u?u.liveTotalCredits:T,V=new Set(t.map(e=>e.id)),M=((v==null?void 0:v.items)??[]).filter(e=>!V.has(e.id)).slice(0,6),J=new Map(u==null?void 0:u.buyable.map(e=>[e.item.id,e])),X=e=>e.tradeId?me(e.tradeId):pe(e.contractAddress,e.itemId??"");function U(e){e(),w(null),S(null),f(null)}async function W(e){if(!a||e.length===0)return;const i=e.map(l=>({...l.item,priceCredits:l.priceCredits})),y=[];let k="authorize",$=!1;try{c("Preparing your order…");const l=[];for(const o of e){const{credit:b,maxCreditedValue:_}=await oe(a.identity,o.usdCents,o.item.tradeId);y.push(b.id),l.push({trade:o.trade,credits:[b],maxCreditedValue:_})}c("Confirming your purchase…"),k="submit";let h=[];if(_e())try{h=await ye({purchases:l,buyer:a.address,signer:a.signer});const b=(await Promise.allSettled(h.map(_=>ge(_)))).flatMap(_=>_.status==="rejected"?[_.reason]:[]);if(b.length&&!b.some(_=>_ instanceof be))throw b[0];$=!0}catch(o){if(!(o instanceof xe))throw o;h=await K({purchases:l,buyer:a.address,signer:a.signer})}else h=await K({purchases:l,buyer:a.address,signer:a.signer});e.forEach(o=>r(o.item.id)),w(null),c("Purchased! 🎉"),F("Shop Completed Purchase",{...de(i),payment_type:"credits",no_crypto_step:$,transaction_hash:h[0]??null}),C.invalidateQueries({queryKey:["usd-balance"]}),n("/success",{state:{items:i,txHash:h[0]}})}catch(l){if(D(l)||q(l,{flow:"cart_checkout",step:k,cart_size:e.length}),F(D(l)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:k,error_code:ue(l),value_usd:B(i.reduce((h,o)=>h+o.priceCredits,0)),cart_size:e.length}),y.length){try{await he(a.identity,y)}catch(h){q(h,{flow:"cart_checkout",step:"release"})}C.invalidateQueries({queryKey:["usd-balance"]})}f(O(l)),c(null)}}async function Y(){if(!a){f("Sign in to check out.");return}f(null),S(null),E(!0),F("Shop Started Checkout",{cart_size:t.length,cart_value_credits:T,cart_value_usd:B(T),has_sufficient_credits:((p==null?void 0:p.credits)??0)>=T});try{c("Reviewing your cart…");const e=await ve(t,a.address,X),i=[...e.unavailable,...e.own];if(i.length&&(i.forEach(y=>r(y.id)),S(Ne(e))),e.buyable.length===0){f("None of these items are available to buy right now."),w(null),c(null);return}if(e.orderChanged){w(e),L.current=Date.now(),c(null);return}await W(e.buyable)}catch(e){q(e,{flow:"cart_checkout",step:"review",cart_size:t.length}),f(O(e)),c(null)}finally{E(!1)}}async function Z(){if(u){if(!a){f("Sign in to check out.");return}if(Date.now()-L.current>Ce){w(null),S(null),await Y();return}f(null),E(!0);try{await W(u.buyable)}finally{E(!1)}}}return t.length===0?s.jsxs("div",{className:"cart cart--empty",children:[s.jsx("span",{className:"ico ico-cart cart-empty__ico","aria-hidden":!0}),s.jsx("p",{className:"cart-empty__title",children:R("cart.empty.title")}),s.jsx("p",{className:"muted",children:R("cart.empty.body")}),s.jsx(A,{className:"btn btn--purple",to:"/assets",children:R("cart.empty.cta")})]}):s.jsxs("div",{className:"cart",children:[s.jsxs("h1",{children:["Cart (",t.length,")"]}),s.jsxs("div",{className:"cart__body",children:[s.jsxs("div",{className:"cart__main",children:[s.jsx("div",{className:"cart__list",children:t.map(e=>{const i=J.get(e.id),y=i?i.priceCredits:e.priceCredits,k=!!i&&i.priceCredits!==e.priceCredits;return s.jsxs("div",{className:"cart__row",children:[s.jsx("div",{className:"cart__thumb",children:e.thumbnail?s.jsx("img",{src:e.thumbnail,alt:e.name}):null}),s.jsxs("div",{className:"cart__info",children:[s.jsx("div",{className:"cart__name",children:e.name}),e.creator?s.jsx(ie,{address:e.creator,className:"cart__creator",linkToProfile:!0}):null]}),s.jsxs("div",{className:"cart__price",children:[s.jsx(I,{className:"ccy-mark"})," ",y,k?s.jsx("span",{className:"muted",style:{marginLeft:6,textDecoration:"line-through"},children:e.priceCredits}):null]}),s.jsx("button",{className:"cart__remove",onClick:()=>U(()=>r(e.id)),disabled:N,"aria-label":`Remove ${e.name}`,title:"Remove",children:s.jsx("span",{className:"ico ico-trash","aria-hidden":!0})})]},e.id)})}),s.jsxs("div",{className:"cart__utils",children:[s.jsx("button",{className:"link",onClick:()=>U(d),disabled:N,children:"Clear cart"}),null]})]}),s.jsxs("aside",{className:"cart__summary",children:[s.jsx("h2",{className:"cart__summary-title",children:"Order summary"}),s.jsxs("div",{className:"cart__total",children:[s.jsxs("div",{className:"cart__total-line",children:[s.jsx("span",{children:"Total"}),s.jsxs("strong",{children:[s.jsx(I,{className:"ccy-mark"})," ",H]})]}),a?s.jsxs("div",{className:"muted cart__balance",children:["Your balance: ",s.jsx(I,{className:"ccy-mark"})," ",(p==null?void 0:p.credits)??0]}):null]}),s.jsxs("div",{className:"cart__actions",children:[s.jsx("button",{className:"btn btn--purple cart__checkout",onClick:u?Z:Y,disabled:N,children:N?"Working…":u?"Confirm purchase":"Checkout"}),s.jsxs(A,{className:"btn btn--ghost",to:"/credits",children:["Get ",Q.name]}),j?s.jsx("button",{className:"btn btn--ghost",onClick:()=>g(!0),disabled:N,children:"Try on outfit"}):null]}),u?s.jsx("p",{className:"muted cart__msg",children:"Prices or availability changed since you added these — review the updated total and confirm to buy."}):null,G?s.jsx("p",{className:"muted cart__msg",children:G}):null,m?s.jsx("p",{className:"muted cart__msg",children:m}):null,z?s.jsx("p",{className:"error cart__msg",children:z}):null]})]}),M.length>0?s.jsxs("section",{className:"row cart-upsell",children:[s.jsx("div",{className:"row__head",children:s.jsx("h2",{className:"row__title",children:"You might also like"})}),s.jsx("div",{className:"row__track",children:M.map(e=>s.jsx(le,{item:e},e.id))})]}):null]})}export{Ie as Cart};
@@ -0,0 +1,28 @@
1
+ import{R as N,S as U,T as w,U as z,V as o,X as E,Y as c,Z as I,$ as g,a0 as D,a1 as R}from"./index-C0xdJx_z.js";import{r as F,j as v}from"./react-CsaE3SwW.js";function K(r){return N("MuiCircularProgress",r)}U("MuiCircularProgress",["root","determinate","indeterminate","colorPrimary","colorSecondary","svg","circle","circleDeterminate","circleIndeterminate","circleDisableShrink"]);const V=["className","color","disableShrink","size","style","thickness","value","variant"];let l=r=>r,P,S,b,$;const t=44,W=R(P||(P=l`
2
+ 0% {
3
+ transform: rotate(0deg);
4
+ }
5
+
6
+ 100% {
7
+ transform: rotate(360deg);
8
+ }
9
+ `)),Z=R(S||(S=l`
10
+ 0% {
11
+ stroke-dasharray: 1px, 200px;
12
+ stroke-dashoffset: 0;
13
+ }
14
+
15
+ 50% {
16
+ stroke-dasharray: 100px, 200px;
17
+ stroke-dashoffset: -15px;
18
+ }
19
+
20
+ 100% {
21
+ stroke-dasharray: 100px, 200px;
22
+ stroke-dashoffset: -125px;
23
+ }
24
+ `)),B=r=>{const{classes:e,variant:s,color:a,disableShrink:d}=r,u={root:["root",s,`color${c(a)}`],svg:["svg"],circle:["circle",`circle${c(s)}`,d&&"circleDisableShrink"]};return I(u,K,e)},G=g("span",{name:"MuiCircularProgress",slot:"Root",overridesResolver:(r,e)=>{const{ownerState:s}=r;return[e.root,e[s.variant],e[`color${c(s.color)}`]]}})(({ownerState:r,theme:e})=>o({display:"inline-block"},r.variant==="determinate"&&{transition:e.transitions.create("transform")},r.color!=="inherit"&&{color:(e.vars||e).palette[r.color].main}),({ownerState:r})=>r.variant==="indeterminate"&&D(b||(b=l`
25
+ animation: ${0} 1.4s linear infinite;
26
+ `),W)),L=g("svg",{name:"MuiCircularProgress",slot:"Svg",overridesResolver:(r,e)=>e.svg})({display:"block"}),T=g("circle",{name:"MuiCircularProgress",slot:"Circle",overridesResolver:(r,e)=>{const{ownerState:s}=r;return[e.circle,e[`circle${c(s.variant)}`],s.disableShrink&&e.circleDisableShrink]}})(({ownerState:r,theme:e})=>o({stroke:"currentColor"},r.variant==="determinate"&&{transition:e.transitions.create("stroke-dashoffset")},r.variant==="indeterminate"&&{strokeDasharray:"80px, 200px",strokeDashoffset:0}),({ownerState:r})=>r.variant==="indeterminate"&&!r.disableShrink&&D($||($=l`
27
+ animation: ${0} 1.4s ease-in-out infinite;
28
+ `),Z)),q=F.forwardRef(function(e,s){const a=w({props:e,name:"MuiCircularProgress"}),{className:d,color:u="primary",disableShrink:M=!1,size:m=40,style:_,thickness:i=3.6,value:p=0,variant:k="indeterminate"}=a,j=z(a,V),n=o({},a,{color:u,disableShrink:M,size:m,thickness:i,value:p,variant:k}),f=B(n),h={},x={},y={};if(k==="determinate"){const C=2*Math.PI*((t-i)/2);h.strokeDasharray=C.toFixed(3),y["aria-valuenow"]=Math.round(p),h.strokeDashoffset=`${((100-p)/100*C).toFixed(3)}px`,x.transform="rotate(-90deg)"}return v.jsx(G,o({className:E(f.root,d),style:o({width:m,height:m},x,_),ownerState:n,ref:s,role:"progressbar"},y,j,{children:v.jsx(L,{className:f.svg,ownerState:n,viewBox:`${t/2} ${t/2} ${t} ${t}`,children:v.jsx(T,{className:f.circle,style:h,ownerState:n,cx:t,cy:t,r:(t-i)/2,fill:"none",strokeWidth:i})})}))});export{q as C};
@@ -0,0 +1 @@
1
+ import{u as j,a as _,j as e}from"./react-CsaE3SwW.js";import{u as N,t as u,C as f,A as b,f as C,a as A}from"./index-C0xdJx_z.js";import{A as v}from"./collection-Ctw0QAmS.js";import{S as h}from"./SkeletonCards-D-gEhGqV.js";import{L as y}from"./LoadMore-XFaiIbYi.js";import{u as L}from"./useInfiniteGrid-D56AG3-z.js";import"./ethers-Da-Ao_qK.js";const P=48;function B(){var d;const{contractAddress:a}=j(),p=_(),{items:t,total:o,isLoading:l,error:r,hasNextPage:g,isFetchingNextPage:n,fetchNextPage:x}=L(["collection-page",a],c=>C(a,{first:P,skip:c}),{enabled:!!a}),{data:s}=N({queryKey:["collection-meta",a],queryFn:()=>A(a),enabled:!!a,staleTime:5*6e4}),i=(s==null?void 0:s.name)||u("collection.fallbackTitle"),m=(s==null?void 0:s.creator)||((d=t[0])==null?void 0:d.creator);return e.jsxs("div",{className:"collection-page",children:[e.jsxs("nav",{className:"collection-page__crumbs","aria-label":"Breadcrumb",children:[e.jsx("button",{className:"collection-page__crumb-link",onClick:()=>p("/assets"),children:u("collection.breadcrumb")}),e.jsx("span",{className:"collection-page__crumb-sep",children:"/"}),e.jsx("span",{className:"collection-page__crumb-current",children:i})]}),e.jsxs("header",{className:"collection-page__head",children:[e.jsx("h1",{className:"collection-page__title",children:i}),m?e.jsx(f,{address:m,className:"collection-page__creator"}):null,e.jsx("span",{className:"muted collection-page__count",children:l?"…":`${o.toLocaleString()} item${o===1?"":"s"}`})]}),!l&&t.length>0?e.jsx(v,{items:t,source:"collection"}):null,r?e.jsx("p",{className:"error",children:"Couldn’t load this collection — please try again."}):null,e.jsx("div",{className:"grid",children:l?e.jsx(h,{count:12}):e.jsxs(e.Fragment,{children:[t.map(c=>e.jsx(b,{item:c},c.id)),n?e.jsx(h,{count:6}):null]})}),e.jsx(y,{hasNextPage:g,isFetching:n,onLoadMore:()=>x()}),!l&&!r&&t.length===0?e.jsx("p",{className:"muted",children:"This collection has no items to show."}):null]})}export{B as Collection,B as default};
@@ -1 +1 @@
1
- import{p as t}from"./ethers-JeCAM1sd.js";var e={};const o={ACCOUNT_TABS:[{label:"Tokens"},{label:"Activity"}],SECURE_SITE_ORIGIN:(typeof t<"u"&&typeof e<"u"?e.NEXT_PUBLIC_SECURE_SITE_ORIGIN:void 0)||"https://secure.walletconnect.org",VIEW_DIRECTION:{Next:"next",Prev:"prev"},ANIMATION_DURATIONS:{HeaderText:120},VIEWS_WITH_LEGAL_FOOTER:["Connect","ConnectWallets","OnRampTokenSelect","OnRampFiatSelect","OnRampProviders"],VIEWS_WITH_DEFAULT_FOOTER:["Networks"]};export{o as C};
1
+ import{p as t}from"./ethers-Da-Ao_qK.js";var e={};const o={ACCOUNT_TABS:[{label:"Tokens"},{label:"Activity"}],SECURE_SITE_ORIGIN:(typeof t<"u"&&typeof e<"u"?e.NEXT_PUBLIC_SECURE_SITE_ORIGIN:void 0)||"https://secure.walletconnect.org",VIEW_DIRECTION:{Next:"next",Prev:"prev"},ANIMATION_DURATIONS:{HeaderText:120},VIEWS_WITH_LEGAL_FOOTER:["Connect","ConnectWallets","OnRampTokenSelect","OnRampFiatSelect","OnRampProviders"],VIEWS_WITH_DEFAULT_FOOTER:["Networks"]};export{o as C};
@@ -1 +1 @@
1
- import{j as e,u as g,a as p}from"./react-Vu6nbGi5.js";import{m as i,C as h,A as x,n as j}from"./index-CKwxO0xv.js";import{A as f}from"./collection-dxCKqLM-.js";import{S as m}from"./SkeletonCards-BysJEVmg.js";import{L as N}from"./LoadMore-BOCtgPLI.js";import{u as b}from"./useInfiniteGrid-D88R70KF.js";import"./ethers-JeCAM1sd.js";function _({address:s,className:r=""}){const o=i(t=>t.followed.includes(s.toLowerCase())),a=i(t=>t.toggle);return s?e.jsx("button",{type:"button",className:`btn btn--sm ${o?"btn--ghost":"btn--outline"} ${r}`.trim(),"aria-pressed":o,title:o?"Unfollow creator":"Follow creator",onClick:()=>a(s),children:o?"Following":"Follow"}):null}const C=48;function S(){const{address:s}=g(),r=p(),{items:o,total:a,isLoading:t,error:n,hasNextPage:u,isFetchingNextPage:c,fetchNextPage:d}=b(["creator-page",s],l=>j(s,{first:C,skip:l}),{enabled:!!s});return e.jsxs("div",{className:"collection-page",children:[e.jsxs("nav",{className:"collection-page__crumbs","aria-label":"Breadcrumb",children:[e.jsx("button",{className:"collection-page__crumb-link",onClick:()=>r("/assets"),children:"Collectibles"}),e.jsx("span",{className:"collection-page__crumb-sep",children:"/"}),e.jsx("span",{className:"collection-page__crumb-current",children:"Creator"})]}),e.jsxs("header",{className:"collection-page__head",children:[s?e.jsx(h,{address:s,className:"collection-page__title-creator"}):null,s?e.jsx(_,{address:s}):null,e.jsx("span",{className:"muted collection-page__count",children:t?"…":`${a.toLocaleString()} item${a===1?"":"s"}`})]}),!t&&o.length>0?e.jsx(f,{items:o,source:"creator"}):null,n?e.jsx("p",{className:"error",children:"Couldn’t load this creator — please try again."}):null,e.jsx("div",{className:"grid",children:t?e.jsx(m,{count:12}):e.jsxs(e.Fragment,{children:[o.map(l=>e.jsx(x,{item:l},l.id)),c?e.jsx(m,{count:6}):null]})}),e.jsx(N,{hasNextPage:u,isFetching:c,onLoadMore:()=>d()}),!t&&!n&&o.length===0?e.jsx("p",{className:"muted",children:"This creator has no items to show yet."}):null]})}export{S as Creator,S as default};
1
+ import{j as e,u as g,a as p}from"./react-CsaE3SwW.js";import{n as i,C as h,A as x,o as j}from"./index-C0xdJx_z.js";import{A as f}from"./collection-Ctw0QAmS.js";import{S as m}from"./SkeletonCards-D-gEhGqV.js";import{L as N}from"./LoadMore-XFaiIbYi.js";import{u as b}from"./useInfiniteGrid-D56AG3-z.js";import"./ethers-Da-Ao_qK.js";function _({address:s,className:r=""}){const o=i(t=>t.followed.includes(s.toLowerCase())),a=i(t=>t.toggle);return s?e.jsx("button",{type:"button",className:`btn btn--sm ${o?"btn--ghost":"btn--outline"} ${r}`.trim(),"aria-pressed":o,title:o?"Unfollow creator":"Follow creator",onClick:()=>a(s),children:o?"Following":"Follow"}):null}const C=48;function S(){const{address:s}=g(),r=p(),{items:o,total:a,isLoading:t,error:n,hasNextPage:u,isFetchingNextPage:c,fetchNextPage:d}=b(["creator-page",s],l=>j(s,{first:C,skip:l}),{enabled:!!s});return e.jsxs("div",{className:"collection-page",children:[e.jsxs("nav",{className:"collection-page__crumbs","aria-label":"Breadcrumb",children:[e.jsx("button",{className:"collection-page__crumb-link",onClick:()=>r("/assets"),children:"Collectibles"}),e.jsx("span",{className:"collection-page__crumb-sep",children:"/"}),e.jsx("span",{className:"collection-page__crumb-current",children:"Creator"})]}),e.jsxs("header",{className:"collection-page__head",children:[s?e.jsx(h,{address:s,className:"collection-page__title-creator"}):null,s?e.jsx(_,{address:s}):null,e.jsx("span",{className:"muted collection-page__count",children:t?"…":`${a.toLocaleString()} item${a===1?"":"s"}`})]}),!t&&o.length>0?e.jsx(f,{items:o,source:"creator"}):null,n?e.jsx("p",{className:"error",children:"Couldn’t load this creator — please try again."}):null,e.jsx("div",{className:"grid",children:t?e.jsx(m,{count:12}):e.jsxs(e.Fragment,{children:[o.map(l=>e.jsx(x,{item:l},l.id)),c?e.jsx(m,{count:6}):null]})}),e.jsx(N,{hasNextPage:u,isFetching:c,onLoadMore:()=>d()}),!t&&!n&&o.length===0?e.jsx("p",{className:"muted",children:"This creator has no items to show yet."}):null]})}export{S as Creator,S as default};
@@ -1 +1 @@
1
- import{C as l,E as w,b as E,S as A,d as k,O as U,N as P,g as f,B as x,e as N,i as I,p as L}from"./W3MFrameProviderSingleton-OCCNZtGo.js";import{g as T,a as W,f as b,b as _,c as v}from"./index-OFpebMSe.js";const D=0,C={paymentAsset:null,amount:null,tokenAmount:0,priceLoading:!1,error:null,exchanges:[],isLoading:!1,currentPayment:void 0,isPaymentInProgress:!1,paymentId:"",assets:[]},e=L(C),m={state:e,subscribe(t){return I(e,()=>t(e))},subscribeKey(t,n){return N(e,t,n)},resetState(){Object.assign(e,{...C})},async getAssetsForNetwork(t){const n=v(t),s=await m.getAssetsImageAndPrice(n),r=n.map(a=>{var c,o,p,y;const u=a.asset==="native"?f():`${a.network}:${a.asset}`,i=s.find(S=>{var g,d,h;return((h=(d=(g=S.fungibles)==null?void 0:g[0])==null?void 0:d.address)==null?void 0:h.toLowerCase())===u.toLowerCase()});return{...a,price:((o=(c=i==null?void 0:i.fungibles)==null?void 0:c[0])==null?void 0:o.price)||1,metadata:{...a.metadata,iconUrl:(y=(p=i==null?void 0:i.fungibles)==null?void 0:p[0])==null?void 0:y.iconUrl}}});return e.assets=r,r},async getAssetsImageAndPrice(t){const n=t.map(r=>r.asset==="native"?f():`${r.network}:${r.asset}`);return await Promise.all(n.map(r=>x.fetchTokenPrice({addresses:[r]})))},getTokenAmount(){var s;if(!((s=e==null?void 0:e.paymentAsset)!=null&&s.price))throw new Error("Cannot get token price");const t=P.bigNumber(e.amount??0).round(8),n=P.bigNumber(e.paymentAsset.price).round(8);return t.div(n).round(8).toNumber()},setAmount(t){var n;e.amount=t,(n=e.paymentAsset)!=null&&n.price&&(e.tokenAmount=m.getTokenAmount())},setPaymentAsset(t){e.paymentAsset=t},isPayWithExchangeEnabled(){var t;return(t=U.state.remoteFeatures)==null?void 0:t.payWithExchange},isPayWithExchangeSupported(){return m.isPayWithExchangeEnabled()&&l.state.activeCaipNetwork&&k.PAY_WITH_EXCHANGE_SUPPORTED_CHAIN_NAMESPACES.includes(l.state.activeCaipNetwork.chainNamespace)},async fetchExchanges(){var t;try{const n=m.isPayWithExchangeSupported();if(!e.paymentAsset||!n){e.exchanges=[],e.isLoading=!1;return}e.isLoading=!0;const s=await _({page:D,asset:b(e.paymentAsset.network,e.paymentAsset.asset),amount:((t=e.amount)==null?void 0:t.toString())??"0"});e.exchanges=s.exchanges.slice(0,2)}catch{throw A.showError("Unable to get exchanges"),new Error("Unable to get exchanges")}finally{e.isLoading=!1}},async getPayUrl(t,n){try{const s=Number(n.amount),r=await W({exchangeId:t,asset:b(n.network,n.asset),amount:s.toString(),recipient:`${n.network}:${n.recipient}`});return w.sendEvent({type:"track",event:"PAY_EXCHANGE_SELECTED",properties:{exchange:{id:t},configuration:{network:n.network,asset:n.asset,recipient:n.recipient,amount:s},currentPayment:{type:"exchange",exchangeId:t},source:"fund-from-exchange",headless:!1}}),r}catch(s){throw s instanceof Error&&s.message.includes("is not supported")?new Error("Asset not supported"):new Error(s.message)}},async handlePayWithExchange(t){var n;try{const s=(n=l.getAccountData())==null?void 0:n.address;if(!s)throw new Error("No account connected");if(!e.paymentAsset)throw new Error("No payment asset selected");const r=E.returnOpenHref("","popupWindow","scrollbar=yes,width=480,height=720");if(!r)throw new Error("Could not create popup window");e.isPaymentInProgress=!0,e.paymentId=crypto.randomUUID(),e.currentPayment={type:"exchange",exchangeId:t};const{network:a,asset:u}=e.paymentAsset,i={network:a,asset:u,amount:e.tokenAmount,recipient:s},c=await m.getPayUrl(t,i);if(!c){try{r.close()}catch(o){console.error("Unable to close popup window",o)}throw new Error("Unable to initiate payment")}e.currentPayment.sessionId=c.sessionId,e.currentPayment.status="IN_PROGRESS",e.currentPayment.exchangeId=t,r.location.href=c.url}catch{e.error="Unable to initiate payment",A.showError(e.error)}},async waitUntilComplete({exchangeId:t,sessionId:n,paymentId:s,retries:r=20}){const a=await m.getBuyStatus(t,n,s);if(a.status==="SUCCESS"||a.status==="FAILED")return a;if(r===0)throw new Error("Unable to get deposit status");return await new Promise(u=>{setTimeout(u,5e3)}),m.waitUntilComplete({exchangeId:t,sessionId:n,paymentId:s,retries:r-1})},async getBuyStatus(t,n,s){var r,a,u,i,c;try{if(!e.currentPayment)throw new Error("No current payment");const o=await T({sessionId:n,exchangeId:t});if(e.currentPayment.status=o.status,o.status==="SUCCESS"||o.status==="FAILED"){const p=(r=l.getAccountData())==null?void 0:r.address;e.currentPayment.result=o.txHash,e.isPaymentInProgress=!1,w.sendEvent({type:"track",event:o.status==="SUCCESS"?"PAY_SUCCESS":"PAY_ERROR",properties:{message:o.status==="FAILED"?E.parseError(e.error):void 0,source:"fund-from-exchange",paymentId:s,configuration:{network:((a=e.paymentAsset)==null?void 0:a.network)||"",asset:((u=e.paymentAsset)==null?void 0:u.asset)||"",recipient:p||"",amount:e.amount??0},currentPayment:{type:"exchange",exchangeId:(i=e.currentPayment)==null?void 0:i.exchangeId,sessionId:(c=e.currentPayment)==null?void 0:c.sessionId,result:o.txHash}}})}return o}catch{return{status:"UNKNOWN",txHash:""}}},reset(){e.currentPayment=void 0,e.isPaymentInProgress=!1,e.paymentId="",e.paymentAsset=null,e.amount=0,e.tokenAmount=0,e.priceLoading=!1,e.error=null,e.exchanges=[],e.isLoading=!1}};export{m as E};
1
+ import{C as l,E as w,b as E,S as A,d as k,O as U,N as P,g as f,B as x,e as N,i as I,p as L}from"./W3MFrameProviderSingleton-ConR5N7Q.js";import{g as T,a as W,f as b,b as _,c as v}from"./index-OmYojNyX.js";const D=0,C={paymentAsset:null,amount:null,tokenAmount:0,priceLoading:!1,error:null,exchanges:[],isLoading:!1,currentPayment:void 0,isPaymentInProgress:!1,paymentId:"",assets:[]},e=L(C),m={state:e,subscribe(t){return I(e,()=>t(e))},subscribeKey(t,n){return N(e,t,n)},resetState(){Object.assign(e,{...C})},async getAssetsForNetwork(t){const n=v(t),s=await m.getAssetsImageAndPrice(n),r=n.map(a=>{var c,o,p,y;const u=a.asset==="native"?f():`${a.network}:${a.asset}`,i=s.find(S=>{var g,d,h;return((h=(d=(g=S.fungibles)==null?void 0:g[0])==null?void 0:d.address)==null?void 0:h.toLowerCase())===u.toLowerCase()});return{...a,price:((o=(c=i==null?void 0:i.fungibles)==null?void 0:c[0])==null?void 0:o.price)||1,metadata:{...a.metadata,iconUrl:(y=(p=i==null?void 0:i.fungibles)==null?void 0:p[0])==null?void 0:y.iconUrl}}});return e.assets=r,r},async getAssetsImageAndPrice(t){const n=t.map(r=>r.asset==="native"?f():`${r.network}:${r.asset}`);return await Promise.all(n.map(r=>x.fetchTokenPrice({addresses:[r]})))},getTokenAmount(){var s;if(!((s=e==null?void 0:e.paymentAsset)!=null&&s.price))throw new Error("Cannot get token price");const t=P.bigNumber(e.amount??0).round(8),n=P.bigNumber(e.paymentAsset.price).round(8);return t.div(n).round(8).toNumber()},setAmount(t){var n;e.amount=t,(n=e.paymentAsset)!=null&&n.price&&(e.tokenAmount=m.getTokenAmount())},setPaymentAsset(t){e.paymentAsset=t},isPayWithExchangeEnabled(){var t;return(t=U.state.remoteFeatures)==null?void 0:t.payWithExchange},isPayWithExchangeSupported(){return m.isPayWithExchangeEnabled()&&l.state.activeCaipNetwork&&k.PAY_WITH_EXCHANGE_SUPPORTED_CHAIN_NAMESPACES.includes(l.state.activeCaipNetwork.chainNamespace)},async fetchExchanges(){var t;try{const n=m.isPayWithExchangeSupported();if(!e.paymentAsset||!n){e.exchanges=[],e.isLoading=!1;return}e.isLoading=!0;const s=await _({page:D,asset:b(e.paymentAsset.network,e.paymentAsset.asset),amount:((t=e.amount)==null?void 0:t.toString())??"0"});e.exchanges=s.exchanges.slice(0,2)}catch{throw A.showError("Unable to get exchanges"),new Error("Unable to get exchanges")}finally{e.isLoading=!1}},async getPayUrl(t,n){try{const s=Number(n.amount),r=await W({exchangeId:t,asset:b(n.network,n.asset),amount:s.toString(),recipient:`${n.network}:${n.recipient}`});return w.sendEvent({type:"track",event:"PAY_EXCHANGE_SELECTED",properties:{exchange:{id:t},configuration:{network:n.network,asset:n.asset,recipient:n.recipient,amount:s},currentPayment:{type:"exchange",exchangeId:t},source:"fund-from-exchange",headless:!1}}),r}catch(s){throw s instanceof Error&&s.message.includes("is not supported")?new Error("Asset not supported"):new Error(s.message)}},async handlePayWithExchange(t){var n;try{const s=(n=l.getAccountData())==null?void 0:n.address;if(!s)throw new Error("No account connected");if(!e.paymentAsset)throw new Error("No payment asset selected");const r=E.returnOpenHref("","popupWindow","scrollbar=yes,width=480,height=720");if(!r)throw new Error("Could not create popup window");e.isPaymentInProgress=!0,e.paymentId=crypto.randomUUID(),e.currentPayment={type:"exchange",exchangeId:t};const{network:a,asset:u}=e.paymentAsset,i={network:a,asset:u,amount:e.tokenAmount,recipient:s},c=await m.getPayUrl(t,i);if(!c){try{r.close()}catch(o){console.error("Unable to close popup window",o)}throw new Error("Unable to initiate payment")}e.currentPayment.sessionId=c.sessionId,e.currentPayment.status="IN_PROGRESS",e.currentPayment.exchangeId=t,r.location.href=c.url}catch{e.error="Unable to initiate payment",A.showError(e.error)}},async waitUntilComplete({exchangeId:t,sessionId:n,paymentId:s,retries:r=20}){const a=await m.getBuyStatus(t,n,s);if(a.status==="SUCCESS"||a.status==="FAILED")return a;if(r===0)throw new Error("Unable to get deposit status");return await new Promise(u=>{setTimeout(u,5e3)}),m.waitUntilComplete({exchangeId:t,sessionId:n,paymentId:s,retries:r-1})},async getBuyStatus(t,n,s){var r,a,u,i,c;try{if(!e.currentPayment)throw new Error("No current payment");const o=await T({sessionId:n,exchangeId:t});if(e.currentPayment.status=o.status,o.status==="SUCCESS"||o.status==="FAILED"){const p=(r=l.getAccountData())==null?void 0:r.address;e.currentPayment.result=o.txHash,e.isPaymentInProgress=!1,w.sendEvent({type:"track",event:o.status==="SUCCESS"?"PAY_SUCCESS":"PAY_ERROR",properties:{message:o.status==="FAILED"?E.parseError(e.error):void 0,source:"fund-from-exchange",paymentId:s,configuration:{network:((a=e.paymentAsset)==null?void 0:a.network)||"",asset:((u=e.paymentAsset)==null?void 0:u.asset)||"",recipient:p||"",amount:e.amount??0},currentPayment:{type:"exchange",exchangeId:(i=e.currentPayment)==null?void 0:i.exchangeId,sessionId:(c=e.currentPayment)==null?void 0:c.sessionId,result:o.txHash}}})}return o}catch{return{status:"UNKNOWN",txHash:""}}},reset(){e.currentPayment=void 0,e.isPaymentInProgress=!1,e.paymentId="",e.paymentAsset=null,e.amount=0,e.tokenAmount=0,e.priceLoading=!1,e.error=null,e.exchanges=[],e.isLoading=!1}};export{m as E};
@@ -1 +1 @@
1
- import{r as N,j as e}from"./react-Vu6nbGi5.js";const k=["common","uncommon","rare","epic","legendary","mythic","unique","exotic"],y=[{key:"newest",label:"Newest",server:"newest"},{key:"price-asc",label:"Price: Low to High",server:"cheapest"},{key:"price-desc",label:"Price: High to Low",server:"most_expensive"},{key:"name",label:"Name (A–Z)",server:"name"}];function _({panelKey:a,label:o,active:p,badge:t,align:h="left",panel:c,children:r}){const i=c.open===a,n=h==="right"?"filterbar__sort":"filterbar__trigger";return e.jsxs("div",{className:"filterbar__item",children:[e.jsxs("button",{className:`${n}${i?" is-open":""}${p?" is-active":""}`,onClick:()=>c.toggle(a),children:[o," ",t?e.jsx("span",{className:"filterbar__badge",children:t}):null," ",e.jsx("span",{className:`ico ico-chevron filterbar__chev${i?" is-up":""}`,"aria-hidden":!0})]}),i?r:null]})}function $({rarities:a,onToggleRarity:o,rarityOptions:p=k,sort:t,onSort:h,sortOptions:c=y,total:r,loading:i,query:n,anyActive:f,onClear:d,renderLeading:m,renderTrailing:b}){const[x,u]=N.useState(null),s={open:x,toggle:l=>u(v=>v===l?null:l),close:()=>u(null)},j=c.find(l=>l.key===t)??c[0];return e.jsxs(e.Fragment,{children:[x?e.jsx("div",{className:"filterbar__scrim",onClick:s.close,"aria-hidden":!0}):null,e.jsxs("div",{className:"filterbar",children:[e.jsxs("div",{className:"filterbar__filters",children:[m==null?void 0:m(s),e.jsx(_,{panelKey:"rarity",label:"Rarity",active:a.length>0,badge:a.length||void 0,panel:s,children:e.jsx("div",{className:"filter-pop filter-pop--rarity",children:p.map(l=>e.jsxs("label",{className:"filter-pop__check",children:[e.jsx("input",{type:"checkbox",checked:a.includes(l),onChange:()=>o(l)}),e.jsx("span",{children:l})]},l))})}),b==null?void 0:b(s),f?e.jsx("button",{className:"filterbar__clear",onClick:()=>{d(),s.close()},children:"Clear all"}):null]}),e.jsxs("div",{className:"filterbar__right",children:[e.jsxs("span",{className:"filterbar__count",children:[i?"…":`${r.toLocaleString()} item${r===1?"":"s"}`,n?` for “${n}”`:""]}),e.jsx(_,{panelKey:"sort",label:`Sort by: ${j.label}`,align:"right",panel:s,children:e.jsx("div",{className:"filter-pop filter-pop--sort",children:c.map(l=>e.jsx("button",{className:`filter-pop__sort${l.key===t?" is-active":""}`,onClick:()=>{h(l.key),s.close()},children:l.label},l.key))})})]})]})]})}export{$ as F,y as S,_ as a};
1
+ import{r as N,j as e}from"./react-CsaE3SwW.js";const k=["common","uncommon","rare","epic","legendary","mythic","unique","exotic"],y=[{key:"newest",label:"Newest",server:"newest"},{key:"price-asc",label:"Price: Low to High",server:"cheapest"},{key:"price-desc",label:"Price: High to Low",server:"most_expensive"},{key:"name",label:"Name (A–Z)",server:"name"}];function _({panelKey:a,label:o,active:p,badge:t,align:h="left",panel:c,children:r}){const i=c.open===a,n=h==="right"?"filterbar__sort":"filterbar__trigger";return e.jsxs("div",{className:"filterbar__item",children:[e.jsxs("button",{className:`${n}${i?" is-open":""}${p?" is-active":""}`,onClick:()=>c.toggle(a),children:[o," ",t?e.jsx("span",{className:"filterbar__badge",children:t}):null," ",e.jsx("span",{className:`ico ico-chevron filterbar__chev${i?" is-up":""}`,"aria-hidden":!0})]}),i?r:null]})}function $({rarities:a,onToggleRarity:o,rarityOptions:p=k,sort:t,onSort:h,sortOptions:c=y,total:r,loading:i,query:n,anyActive:f,onClear:d,renderLeading:m,renderTrailing:b}){const[x,u]=N.useState(null),s={open:x,toggle:l=>u(v=>v===l?null:l),close:()=>u(null)},j=c.find(l=>l.key===t)??c[0];return e.jsxs(e.Fragment,{children:[x?e.jsx("div",{className:"filterbar__scrim",onClick:s.close,"aria-hidden":!0}):null,e.jsxs("div",{className:"filterbar",children:[e.jsxs("div",{className:"filterbar__filters",children:[m==null?void 0:m(s),e.jsx(_,{panelKey:"rarity",label:"Rarity",active:a.length>0,badge:a.length||void 0,panel:s,children:e.jsx("div",{className:"filter-pop filter-pop--rarity",children:p.map(l=>e.jsxs("label",{className:"filter-pop__check",children:[e.jsx("input",{type:"checkbox",checked:a.includes(l),onChange:()=>o(l)}),e.jsx("span",{children:l})]},l))})}),b==null?void 0:b(s),f?e.jsx("button",{className:"filterbar__clear",onClick:()=>{d(),s.close()},children:"Clear all"}):null]}),e.jsxs("div",{className:"filterbar__right",children:[e.jsxs("span",{className:"filterbar__count",children:[i?"…":`${r.toLocaleString()} item${r===1?"":"s"}`,n?` for “${n}”`:""]}),e.jsx(_,{panelKey:"sort",label:`Sort by: ${j.label}`,align:"right",panel:s,children:e.jsx("div",{className:"filter-pop filter-pop--sort",children:c.map(l=>e.jsx("button",{className:`filter-pop__sort${l.key===t?" is-active":""}`,onClick:()=>{h(l.key),s.close()},children:l.label},l.key))})})]})]})]})}export{$ as F,y as S,_ as a};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/RealCheckout-BKfIbLM5.js","assets/react-CsaE3SwW.js","assets/index-C0xdJx_z.js","assets/ethers-Da-Ao_qK.js","assets/index-Kb_kdzXZ.css"])))=>i.map(i=>d[i]);
2
+ import{ah as $,i as y,ai as U,c as F,z as L,k as _,E as S,I as E,l as u,e as N,aa as I,_ as V}from"./index-C0xdJx_z.js";import{a as z,r as l,j as e}from"./react-CsaE3SwW.js";import{C as k}from"./CircularProgress-Bb7X2tGG.js";import"./ethers-Da-Ao_qK.js";function R(){return y.shopServerUrl||y.creditsServerUrl}async function K(t,s){const r=await $(`${R()}/credits/checkout`,{method:"POST",identity:s,metadata:{},headers:{"Content-Type":"application/json"},body:JSON.stringify({packId:t})});if(!r.ok)throw new Error(`checkout ${r.status}: ${await r.text()}`);const{orderId:a,clientSecret:n}=await r.json();return{orderId:a,clientSecret:n,mock:!1}}async function Y(t,s,r={}){const{intervalMs:a=1500,timeoutMs:n=6e4,signal:c}=r,i=Date.now()+n;for(;;){if(c!=null&&c.aborted)throw new DOMException("Aborted","AbortError");const m=await q(t,s,c);if(m.status!=="processing")return m;if(Date.now()>i)return{status:"failed",error:"Timed out waiting for your credits."};await W(a,c)}}async function q(t,s,r){const a=await $(`${R()}/credits/orders/${t}`,{method:"GET",identity:s,metadata:{},signal:r});if(!a.ok)throw new Error(`order status ${a.status}`);return a.json()}function W(t,s){return new Promise((r,a)=>{const n=setTimeout(r,t);s==null||s.addEventListener("abort",()=>{clearTimeout(n),a(new DOMException("Aborted","AbortError"))})})}const H=.1,T=[{id:"pack_5",usd:5,credits:f(5)},{id:"pack_10",usd:10,credits:f(10)},{id:"pack_25",usd:25,credits:f(25),bestValue:!0},{id:"pack_50",usd:50,credits:f(50)}];function f(t){return Math.round(t/H)}function G(t){return T.find(s=>s.id===t)}const x="mock_cs_",J=new Set([80002,11155111,1337,31337]);function C(){const t=!y.stripePublishableKey;if(t&&!J.has(y.chainId))throw new Error(`Stripe publishable key is missing on chainId=${y.chainId}, which is not a recognized test network. Refusing to fall back to mock payments in a real-money environment — configure STRIPE_PUBLISHABLE_KEY.`);return t}async function Q(t,s){const r=G(t);if(!r)throw new Error("Unknown pack");if(C())return Z(r);if(!(s!=null&&s.identity))throw new Error("Sign in to get credits.");return K(t,s.identity)}async function X(t,s={}){const{intervalMs:r,timeoutMs:a,signal:n,identity:c}=s;if(C()||t.startsWith(x))return ee(t,s);if(!c)throw new Error("Sign in to get credits.");return Y(t,c,{intervalMs:r,timeoutMs:a,signal:n})}function Z(t){const s=`${x}${t.id}_${Date.now()}`;return M(400).then(()=>({orderId:s,clientSecret:`${x}${t.id}`,mock:!0}))}async function ee(t,s={}){await M(s.intervalMs??900);const r=t.replace(x,"").replace(/_\d+$/,""),a=G(r),n=(a==null?void 0:a.credits)??0;if(s.address&&a)try{const c=await U(s.address,Math.round(a.usd*100));return{status:"credited",creditsGranted:n,newBalance:c.credits}}catch(c){return{status:"failed",error:c.message}}return{status:"credited",creditsGranted:n,newBalance:n}}function M(t,s){return new Promise((r,a)=>{setTimeout(r,t)})}const b=C()?"mock":"stripe",se=l.lazy(()=>V(()=>import("./RealCheckout-BKfIbLM5.js"),__vite__mapDeps([0,1,2,3,4])));function P(t){const s=t;if((s==null?void 0:s.name)==="AbortError")return"You cancelled the request.";const r=((s==null?void 0:s.message)??"").toLowerCase();return r.includes("sign in")?`Sign in to get ${u.name}.`:r.includes("timed out")?`This is taking longer than usual — your ${u.name} will appear shortly.`:"Couldn't complete your purchase — please try again."}function de(){const t=z(),{session:s,signIn:r}=F(),a=L(),[n,c]=l.useState("select"),[i,m]=l.useState(null),[h,w]=l.useState(null),[A,v]=l.useState(null),[D,p]=l.useState(null),g=l.useRef(null);l.useEffect(()=>()=>{var o;return(o=g.current)==null?void 0:o.abort()},[]);const B=l.useCallback(async o=>{if(!s){r();return}p(null),m(o),c("paying"),_("Shop Started Buy Credits",{pack_usd:o.usd,credits:o.credits,provider:b});try{const d=await Q(o.id,{address:s.address,identity:s.identity});w(d)}catch(d){S(d,{flow:"get_credits",step:"checkout",provider:b}),_("Shop Buy Credits Failed",{step:"checkout",error_code:E(d),pack_usd:o.usd}),p(P(d)),c("error")}},[s,r]),O=l.useCallback(async()=>{if(!h)return;c("processing");const o=new AbortController;g.current=o;try{const d=await X(h.orderId,{signal:o.signal,address:s==null?void 0:s.address,identity:s==null?void 0:s.identity});d.status==="credited"?(v(d.creditsGranted??(i==null?void 0:i.credits)??0),c("success"),_("Shop Completed Buy Credits",{order_id:h.orderId,pack_usd:(i==null?void 0:i.usd)??null,credits:d.creditsGranted??(i==null?void 0:i.credits)??0,provider:b}),a.invalidateQueries({queryKey:["usd-balance"]})):(_("Shop Buy Credits Failed",{step:"grant",error_code:"grant_failed",pack_usd:(i==null?void 0:i.usd)??null}),p(d.error??`Couldn't add your ${u.name} — please try again.`),c("error"))}catch(d){S(d,{flow:"get_credits",step:"grant",order_id:h.orderId}),_("Shop Buy Credits Failed",{step:"grant",error_code:E(d),pack_usd:(i==null?void 0:i.usd)??null}),p(P(d)),c("error")}},[h,i,s,a]);function j(){var o;(o=g.current)==null||o.abort(),c("select"),m(null),w(null),v(null),p(null)}return e.jsxs("div",{className:"getcredits",children:[e.jsxs("header",{className:"getcredits__head",children:[e.jsxs("h1",{className:"getcredits__title",children:["Get ",u.name]}),e.jsxs("p",{className:"muted",children:["Add ",u.name," to your account to shop. Pay with any card."]})]}),s?e.jsxs(e.Fragment,{children:[n==="select"&&e.jsx(te,{onSelect:B}),n==="paying"&&i&&e.jsx(re,{pack:i,checkout:h,onPaid:O,onCancel:j}),n==="processing"&&e.jsxs("div",{className:"getcredits__status",role:"status","aria-live":"polite",children:[e.jsx(k,{size:40}),e.jsxs("p",{className:"getcredits__status-title",children:["Adding your ",u.name,"…"]}),e.jsx("p",{className:"muted",children:"Payment received. Just a moment while we top up your balance."})]}),n==="success"&&e.jsxs("div",{className:"getcredits__status getcredits__status--ok",role:"status","aria-live":"polite",children:[e.jsx("div",{className:"getcredits__confetti","aria-hidden":!0,children:"🎉"}),e.jsx("p",{className:"getcredits__status-title",children:"You’re all set!"}),e.jsxs("p",{className:"muted",children:[e.jsxs("strong",{children:[e.jsx(N,{className:"ccy-mark"})," ",A]})," ",u.name," added to your account."]}),e.jsxs("div",{className:"getcredits__status-actions",children:[e.jsx("button",{className:"btn",onClick:()=>t("/cart"),children:"Back to cart"}),e.jsxs("button",{className:"btn btn--ghost",onClick:j,children:["Get more ",u.name]})]})]}),n==="error"&&e.jsxs("div",{className:"getcredits__status getcredits__status--err",role:"alert",children:[e.jsx("p",{className:"getcredits__status-title",children:"Something went wrong"}),e.jsx("p",{className:"error",children:D}),e.jsx("div",{className:"getcredits__status-actions",children:e.jsx("button",{className:"btn",onClick:j,children:"Try again"})})]})]}):e.jsxs("div",{className:"getcredits__status",role:"status",children:[e.jsxs("p",{className:"getcredits__status-title",children:["Sign in to get ",u.name]}),e.jsxs("p",{className:"muted",children:["Connect your account to buy ",u.name," and start shopping."]}),e.jsx("div",{className:"getcredits__status-actions",children:e.jsx("button",{className:"btn btn--purple",onClick:r,children:"Sign in"})})]})]})}function te({onSelect:t}){return e.jsx("div",{className:"packs",children:T.map(s=>e.jsxs("button",{type:"button",className:`pack${s.bestValue?" pack--best":""}`,onClick:()=>t(s),"aria-label":`Get ${I(s.credits)} for $${s.usd}`,children:[s.bestValue&&e.jsx("span",{className:"pack__ribbon",children:"Best value"}),e.jsxs("span",{className:"pack__credits",children:[e.jsx(N,{className:"pack__credits-ico"}),s.credits]}),e.jsx("span",{className:"pack__label",children:u.name}),e.jsxs("span",{className:"pack__price",children:["$",s.usd]}),e.jsxs("span",{className:"pack__cta",children:["Get ",u.name]})]},s.id))})}function re({pack:t,checkout:s,onPaid:r,onCancel:a}){return e.jsxs("div",{className:"pay",children:[e.jsxs("div",{className:"pay__summary",children:[e.jsx("button",{className:"link",onClick:a,children:"← Choose a different pack"}),e.jsxs("div",{className:"pay__summary-row",children:[e.jsx("span",{children:"You’ll get"}),e.jsxs("strong",{children:[e.jsx(N,{className:"ccy-mark"})," ",I(t.credits)]})]}),e.jsxs("div",{className:"pay__summary-row pay__summary-row--total",children:[e.jsx("span",{children:"You pay"}),e.jsxs("strong",{children:["$",t.usd]})]})]}),e.jsx("div",{className:"pay__form",children:s?s.mock?e.jsx(ae,{onPaid:r,amountUsd:t.usd}):e.jsx(l.Suspense,{fallback:e.jsxs("div",{className:"getcredits__status",role:"status","aria-live":"polite",children:[e.jsx(k,{size:32}),e.jsx("p",{className:"muted",children:"Getting the payment form ready…"})]}),children:e.jsx(se,{clientSecret:s.clientSecret,onComplete:r})}):e.jsxs("div",{className:"getcredits__status",role:"status","aria-live":"polite",children:[e.jsx(k,{size:32}),e.jsx("p",{className:"muted",children:"Getting the payment form ready…"})]})})]})}function ae({onPaid:t,amountUsd:s}){const[r,a]=l.useState("4242 4242 4242 4242"),[n,c]=l.useState(!1);function i(){c(!0),setTimeout(()=>t(),700)}return e.jsxs("div",{className:"card-form","aria-label":"Payment details",children:[e.jsx("p",{className:"muted small card-form__note",children:"Demo mode — no real charge is made."}),e.jsxs("label",{className:"field",children:[e.jsx("span",{children:"Card number"}),e.jsx("input",{value:r,onChange:m=>a(m.target.value),disabled:n,inputMode:"numeric"})]}),e.jsxs("div",{className:"card-form__row",children:[e.jsxs("label",{className:"field",children:[e.jsx("span",{children:"Expiry"}),e.jsx("input",{defaultValue:"12 / 34",disabled:n})]}),e.jsxs("label",{className:"field",children:[e.jsx("span",{children:"CVC"}),e.jsx("input",{defaultValue:"123",disabled:n,inputMode:"numeric"})]})]}),e.jsx("button",{className:"btn btn--purple card-form__pay",onClick:i,disabled:n,children:n?"Processing…":`Pay $${s}`})]})}export{de as GetCredits,de as default};
@@ -1,4 +1,4 @@
1
- import{i as f,b as h}from"./lit-element-B3y9oplH.js";import{n as m}from"./class-map-CxwNmq0D.js";import{c as p}from"./index-DZHh5kfE.js";import{d as g,r as v}from"./index-OFpebMSe.js";import{C as c}from"./ConstantsUtil-CiDezLbv.js";import{R as $,O as u}from"./W3MFrameProviderSingleton-OCCNZtGo.js";import{au as y}from"./NetworkUtil-DDES604E.js";const b=g`
1
+ import{i as f,b as h}from"./lit-element-B3y9oplH.js";import{n as m}from"./class-map-CxwNmq0D.js";import{c as p}from"./index-1xS0Bm4O.js";import{d as g,r as v}from"./index-OmYojNyX.js";import{C as c}from"./ConstantsUtil-ACwd_9jk.js";import{R as $,O as u}from"./W3MFrameProviderSingleton-ConR5N7Q.js";import{au as y}from"./NetworkUtil-DjnLk0yv.js";const b=g`
2
2
  :host {
3
3
  display: flex;
4
4
  justify-content: center;
@@ -1 +1 @@
1
- import{a as E,r as p,j as e,L as A}from"./react-Vu6nbGi5.js";import{j as Q,D as L,k as S,d as v,a as R,y as F,c as K,s as P}from"./index-CKwxO0xv.js";import{i as W,R as Y,f as G}from"./import-Ct60HkEi.js";import{s as O}from"./wallet-kind-DtWrr4AZ.js";import"./ethers-JeCAM1sd.js";import"./buy-Cei5j8eO.js";import"./trade-encoding-Dbk3clLx.js";import"./index-NMzNXj-b.js";import"./mana-rate-BrvfDold.js";function B({queue:l,session:I,onClose:g,onDone:h}){const x=E(),c=O(I.providerType),[d,j]=p.useState(()=>l.map(()=>"pending")),[b,C]=p.useState("running"),w=p.useRef(!1);p.useEffect(()=>{if(w.current)return;w.current=!0;let t=!1;return(async()=>{for(let s=0;s<l.length;s++){if(t)return;j(r=>r.map((m,o)=>o===s?"active":m));try{await W(l[s].item,l[s].priceCredits,I),Q("Shop Migrated Listing",{item_id:l[s].item.itemId??l[s].item.oldTradeId??null,contract_address:l[s].item.contractAddress,new_price_credits:l[s].priceCredits,new_price_usd:l[s].priceCredits/10}),t||j(r=>r.map((m,o)=>o===s?"done":m))}catch(r){if(r instanceof Y)L(r,{flow:"import_listing",step:"relist",itemId:l[s].item.itemId??l[s].item.oldTradeId}),t||j(m=>m.map((o,y)=>y===s?"unlisted":o));else{const m=r,o=m.code===4001||/reject|denied|cancel/i.test(m.message??"");o||L(r,{flow:"import_listing",itemId:l[s].item.itemId??l[s].item.oldTradeId}),t||j(y=>y.map((T,a)=>a===s?o?"skipped":"failed":T))}}}t||C("finished")})(),()=>{t=!0}},[]);const u=d.filter(t=>t==="done").length,N=d.findIndex(t=>t==="active"),_=Math.round(d.filter(t=>t!=="pending"&&t!=="active").length/l.length*100);function f(){h(),g()}if(b==="finished"){const t=d.filter(r=>r==="skipped"||r==="failed").length,s=d.filter(r=>r==="unlisted").length;return e.jsx("div",{className:"modal-backdrop",role:"presentation",children:e.jsxs("div",{className:"modal modal--success",role:"dialog","aria-modal":"true",children:[e.jsx("div",{className:"modal-success__check","aria-hidden":!0,children:"✓"}),e.jsx("h2",{className:"modal__title",children:u>0?"You're in the Shop! 🎉":"Nothing listed"}),e.jsxs("p",{className:"muted",style:{margin:0},children:[u>0?`${u} ${u===1?"item is":"items are"} now for sale with ${S.name}.`:"No items were listed.",t>0?` ${t} skipped — you can try those again anytime.`:"",s>0?` ${s} ${s===1?"item was":"items were"} taken off the old marketplace but couldn't be re-listed — re-list ${s===1?"it":"them"} from My Assets.`:""]}),e.jsxs("div",{className:"modal__actions",children:[e.jsx("button",{className:"btn btn--ghost",onClick:f,children:"Done"}),s>0?e.jsx("button",{className:"btn btn--purple",onClick:()=>{h(),g(),x("/my-assets")},children:"Go to My Assets"}):u>0?e.jsx("button",{className:"btn btn--purple",onClick:()=>{h(),g(),x("/assets")},children:"View in Shop"}):null]})]})})}return e.jsx("div",{className:"modal-backdrop",role:"presentation",children:e.jsxs("div",{className:"modal migrate",role:"dialog","aria-modal":"true","aria-live":"polite",children:[e.jsx("h2",{className:"modal__title",children:"Listing your items"}),e.jsxs("p",{className:"muted small",style:{margin:"0 0 4px"},children:[c?"We take down each old listing and re-list it for credits — confirm each step.":"Moving your items to the Shop."," ",N>=0?`${N+1} of ${l.length}`:""]}),e.jsx("div",{className:"migrate__progress",children:e.jsx("div",{className:"migrate__bar",style:{width:`${_}%`}})}),e.jsx("ul",{className:"migrate__list",children:l.map((t,s)=>e.jsxs("li",{className:`migrate__row migrate__row--${d[s]}`,children:[e.jsx("span",{className:"migrate__thumb",children:t.item.thumbnail?e.jsx("img",{src:t.item.thumbnail,alt:""}):null}),e.jsx("span",{className:"migrate__name",title:t.item.name,children:t.item.name||"Item"}),e.jsxs("span",{className:"migrate__price",children:[e.jsx(v,{className:"ccy-mark"})," ",t.priceCredits.toLocaleString()]}),e.jsx("span",{className:"migrate__status",children:d[s]==="active"?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"spinner migrate__spin","aria-hidden":!0})," ",c?"Confirm…":"Adding…"]}):d[s]==="done"?e.jsx("span",{className:"migrate__tick",children:"✓"}):d[s]==="skipped"?e.jsx("span",{className:"migrate__skip",children:"Skipped"}):d[s]==="failed"?e.jsx("span",{className:"migrate__skip",children:"Failed"}):d[s]==="unlisted"?e.jsx("span",{className:"migrate__skip",title:"Removed from the old marketplace but not re-listed — re-list it from My Assets.",children:"Not listed"}):e.jsx("span",{className:"migrate__wait",children:"Waiting"})})]},t.item.oldTradeId))}),e.jsx("p",{className:"muted small migrate__hint",children:c?"A couple of quick confirmations pop up per item (take down + re-list). Keep this open.":"This only takes a moment — keep this open."})]})})}const D=[{key:"creations",title:"Your creations",sub:"Items you made. Put them on sale in the Shop."},{key:"owned",title:"Items you own",sub:"Things you've bought elsewhere — resell them in the Shop."}];function se(){const{session:l,signIn:I,restore:g}=R(),h=F(),x=l==null?void 0:l.address;p.useEffect(()=>{g()},[g]);const{data:c,isLoading:d}=K({queryKey:["importable",x],queryFn:()=>G(x),enabled:!!x}),[j,b]=p.useState({}),[C,w]=p.useState(new Set),[u,N]=p.useState(null),_=p.useMemo(()=>[...(c==null?void 0:c.creations)??[],...(c==null?void 0:c.owned)??[]],[c]);p.useEffect(()=>{_.length&&b(a=>{const n={...a};for(const i of _)n[i.oldTradeId]==null&&(n[i.oldTradeId]=i.suggestedCredits);return n})},[_]);const f=a=>!C.has(a),t=a=>j[a.oldTradeId]??a.suggestedCredits,s=_.filter(a=>f(a.oldTradeId)),r=s.reduce((a,n)=>a+t(n),0);function m(a,n){const i=n.replace(/[^\d]/g,"");b(k=>({...k,[a]:i===""?0:parseInt(i,10)}))}function o(a){w(n=>{const i=new Set(n);return i.has(a)?i.delete(a):i.add(a),i})}function y(a){return a.map(n=>({item:n,priceCredits:Math.max(1,t(n))}))}function T(){h.invalidateQueries({queryKey:["importable"]}),h.invalidateQueries({queryKey:["listings"]}),h.invalidateQueries({queryKey:["my-assets"]}),h.invalidateQueries({queryKey:["collection-sale-state"]}),P.success("Your Shop is updated.")}return l?!d&&_.length===0?e.jsxs("div",{className:"imp-empty",children:[e.jsx("span",{className:"imp-empty__ico","aria-hidden":!0,children:"✨"}),e.jsx("h1",{className:"imp-empty__title",children:"You're all caught up"}),e.jsx("p",{className:"muted",children:"Everything you sell is already in the Shop — nothing to import."}),e.jsx(A,{className:"btn btn--purple",to:"/my-assets",children:"Go to My Assets"})]}):e.jsxs("div",{className:"imp",children:[e.jsxs("header",{className:"imp__head",children:[e.jsx("span",{className:"imp__eyebrow",children:"Import to the Shop"}),e.jsxs("h1",{className:"imp__title",children:["Bring your listings ",e.jsx("span",{className:"imp__grad",children:"into the Shop"})]}),e.jsxs("p",{className:"imp__lede",children:["These items are already for sale elsewhere. We suggested a price in ",S.name," for each — matched to today's rate and rounded up. Adjust anything, then list them."]})]}),e.jsxs("div",{className:"imp__ratebar",children:[e.jsx(v,{className:"ccy-mark imp__diamond"})," 1 ",S.nameSingular," = $0.10 · prices rounded up"]}),d?e.jsx("div",{className:"imp__list",children:Array.from({length:4}).map((a,n)=>e.jsx("div",{className:"imp-row imp-row--skeleton"},n))}):D.map(a=>{const n=(c==null?void 0:c[a.key])??[];return n.length===0?null:e.jsxs("section",{className:"imp__section",children:[e.jsxs("div",{className:"imp__section-head",children:[e.jsx("h2",{className:"imp__section-title",children:a.title}),e.jsx("span",{className:"imp__section-sub",children:a.sub})]}),e.jsx("div",{className:"imp__list",children:n.map(i=>{const k=t(i),M=k!==i.suggestedCredits;return e.jsxs("article",{className:`imp-row${f(i.oldTradeId)?"":" is-off"}`,children:[e.jsx("input",{type:"checkbox",className:"imp-check",checked:f(i.oldTradeId),onChange:()=>o(i.oldTradeId),"aria-label":`Include ${i.name}`}),e.jsx("div",{className:"imp-thumb",children:i.thumbnail?e.jsx("img",{src:i.thumbnail,alt:""}):null}),e.jsxs("div",{className:"imp-meta",children:[e.jsx("div",{className:"imp-name",title:i.name,children:i.name||"Item"}),e.jsx("span",{className:"imp-chip",children:i.rarity})]}),e.jsxs("div",{className:"imp-price",children:[e.jsxs("div",{className:"imp-price__field",children:[e.jsx(v,{className:"ccy-mark imp-price__diamond"}),e.jsx("input",{className:"imp-price__input",inputMode:"numeric",value:k.toLocaleString(),onChange:$=>m(i.oldTradeId,$.target.value),"aria-label":`Price in ${S.name} for ${i.name}`})]}),e.jsxs("div",{className:"imp-price__sub",children:[e.jsxs("span",{children:["$",(k*.1).toFixed(2)]}),M?e.jsxs("button",{className:"imp-price__reset",onClick:()=>b($=>({...$,[i.oldTradeId]:i.suggestedCredits})),children:["Reset to ",e.jsx(v,{className:"ccy-mark"}),i.suggestedCredits.toLocaleString()]}):null]})]}),e.jsx("div",{className:"imp-action",children:e.jsx("button",{className:"btn btn--sm imp-row__list",disabled:!f(i.oldTradeId),onClick:()=>N(y([i])),children:"List"})})]},i.oldTradeId)})})]},a.key)}),e.jsx("div",{className:"imp-dock",children:e.jsxs("div",{className:"imp-dock__inner",children:[e.jsxs("div",{className:"imp-dock__summary",children:[e.jsxs("div",{className:"imp-dock__total",children:[e.jsx(v,{className:"ccy-mark imp__diamond"})," ",r.toLocaleString()]}),e.jsxs("div",{className:"imp-dock__sub",children:[s.length," item",s.length===1?"":"s"," selected · $",(r*.1).toFixed(2)]})]}),e.jsx("span",{className:"imp-dock__spacer"}),e.jsxs("button",{className:"btn btn--purple imp-dock__cta",disabled:s.length===0,onClick:()=>N(y(s)),children:["List all (",s.length,")"]})]})}),u&&l?e.jsx(B,{queue:u,session:l,onClose:()=>N(null),onDone:T}):null]}):e.jsxs("div",{className:"imp-empty",children:[e.jsx("span",{className:"imp-empty__ico","aria-hidden":!0,children:"📦"}),e.jsx("h1",{className:"imp-empty__title",children:"Import your listings"}),e.jsx("p",{className:"muted",children:"Sign in to bring the items you already sell into the Shop."}),e.jsx("button",{className:"btn btn--purple",onClick:()=>I(),children:"Sign in"})]})}export{se as ImportListings};
1
+ import{a as E,r as p,j as e,L as A}from"./react-CsaE3SwW.js";import{k as Q,E as L,l as S,e as v,c as R,z as F,u as K,v as P}from"./index-C0xdJx_z.js";import{i as W,R as Y,f as G}from"./import-0P_hoA1O.js";import{s as O}from"./wallet-kind-Bl1SYx87.js";import"./ethers-Da-Ao_qK.js";import"./buy-CvV1hrMv.js";import"./trade-encoding-Dvpuinzl.js";import"./index-IeuP0ICf.js";import"./mana-rate-N-v6x0qz.js";function z({queue:l,session:I,onClose:g,onDone:h}){const x=E(),c=O(I.providerType),[d,j]=p.useState(()=>l.map(()=>"pending")),[b,C]=p.useState("running"),w=p.useRef(!1);p.useEffect(()=>{if(w.current)return;w.current=!0;let t=!1;return(async()=>{for(let s=0;s<l.length;s++){if(t)return;j(r=>r.map((m,o)=>o===s?"active":m));try{await W(l[s].item,l[s].priceCredits,I),Q("Shop Migrated Listing",{item_id:l[s].item.itemId??l[s].item.oldTradeId??null,contract_address:l[s].item.contractAddress,new_price_credits:l[s].priceCredits,new_price_usd:l[s].priceCredits/10}),t||j(r=>r.map((m,o)=>o===s?"done":m))}catch(r){if(r instanceof Y)L(r,{flow:"import_listing",step:"relist",itemId:l[s].item.itemId??l[s].item.oldTradeId}),t||j(m=>m.map((o,y)=>y===s?"unlisted":o));else{const m=r,o=m.code===4001||/reject|denied|cancel/i.test(m.message??"");o||L(r,{flow:"import_listing",itemId:l[s].item.itemId??l[s].item.oldTradeId}),t||j(y=>y.map((T,a)=>a===s?o?"skipped":"failed":T))}}}t||C("finished")})(),()=>{t=!0}},[]);const u=d.filter(t=>t==="done").length,N=d.findIndex(t=>t==="active"),_=Math.round(d.filter(t=>t!=="pending"&&t!=="active").length/l.length*100);function f(){h(),g()}if(b==="finished"){const t=d.filter(r=>r==="skipped"||r==="failed").length,s=d.filter(r=>r==="unlisted").length;return e.jsx("div",{className:"modal-backdrop",role:"presentation",children:e.jsxs("div",{className:"modal modal--success",role:"dialog","aria-modal":"true",children:[e.jsx("div",{className:"modal-success__check","aria-hidden":!0,children:"✓"}),e.jsx("h2",{className:"modal__title",children:u>0?"You're in the Shop! 🎉":"Nothing listed"}),e.jsxs("p",{className:"muted",style:{margin:0},children:[u>0?`${u} ${u===1?"item is":"items are"} now for sale with ${S.name}.`:"No items were listed.",t>0?` ${t} skipped — you can try those again anytime.`:"",s>0?` ${s} ${s===1?"item was":"items were"} taken off the old marketplace but couldn't be re-listed — re-list ${s===1?"it":"them"} from My Assets.`:""]}),e.jsxs("div",{className:"modal__actions",children:[e.jsx("button",{className:"btn btn--ghost",onClick:f,children:"Done"}),s>0?e.jsx("button",{className:"btn btn--purple",onClick:()=>{h(),g(),x("/my-assets")},children:"Go to My Assets"}):u>0?e.jsx("button",{className:"btn btn--purple",onClick:()=>{h(),g(),x("/assets")},children:"View in Shop"}):null]})]})})}return e.jsx("div",{className:"modal-backdrop",role:"presentation",children:e.jsxs("div",{className:"modal migrate",role:"dialog","aria-modal":"true","aria-live":"polite",children:[e.jsx("h2",{className:"modal__title",children:"Listing your items"}),e.jsxs("p",{className:"muted small",style:{margin:"0 0 4px"},children:[c?"We take down each old listing and re-list it for credits — confirm each step.":"Moving your items to the Shop."," ",N>=0?`${N+1} of ${l.length}`:""]}),e.jsx("div",{className:"migrate__progress",children:e.jsx("div",{className:"migrate__bar",style:{width:`${_}%`}})}),e.jsx("ul",{className:"migrate__list",children:l.map((t,s)=>e.jsxs("li",{className:`migrate__row migrate__row--${d[s]}`,children:[e.jsx("span",{className:"migrate__thumb",children:t.item.thumbnail?e.jsx("img",{src:t.item.thumbnail,alt:""}):null}),e.jsx("span",{className:"migrate__name",title:t.item.name,children:t.item.name||"Item"}),e.jsxs("span",{className:"migrate__price",children:[e.jsx(v,{className:"ccy-mark"})," ",t.priceCredits.toLocaleString()]}),e.jsx("span",{className:"migrate__status",children:d[s]==="active"?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"spinner migrate__spin","aria-hidden":!0})," ",c?"Confirm…":"Adding…"]}):d[s]==="done"?e.jsx("span",{className:"migrate__tick",children:"✓"}):d[s]==="skipped"?e.jsx("span",{className:"migrate__skip",children:"Skipped"}):d[s]==="failed"?e.jsx("span",{className:"migrate__skip",children:"Failed"}):d[s]==="unlisted"?e.jsx("span",{className:"migrate__skip",title:"Removed from the old marketplace but not re-listed — re-list it from My Assets.",children:"Not listed"}):e.jsx("span",{className:"migrate__wait",children:"Waiting"})})]},t.item.oldTradeId))}),e.jsx("p",{className:"muted small migrate__hint",children:c?"A couple of quick confirmations pop up per item (take down + re-list). Keep this open.":"This only takes a moment — keep this open."})]})})}const B=[{key:"creations",title:"Your creations",sub:"Items you made. Put them on sale in the Shop."},{key:"owned",title:"Items you own",sub:"Things you've bought elsewhere — resell them in the Shop."}];function se(){const{session:l,signIn:I,restore:g}=R(),h=F(),x=l==null?void 0:l.address;p.useEffect(()=>{g()},[g]);const{data:c,isLoading:d}=K({queryKey:["importable",x],queryFn:()=>G(x),enabled:!!x}),[j,b]=p.useState({}),[C,w]=p.useState(new Set),[u,N]=p.useState(null),_=p.useMemo(()=>[...(c==null?void 0:c.creations)??[],...(c==null?void 0:c.owned)??[]],[c]);p.useEffect(()=>{_.length&&b(a=>{const n={...a};for(const i of _)n[i.oldTradeId]==null&&(n[i.oldTradeId]=i.suggestedCredits);return n})},[_]);const f=a=>!C.has(a),t=a=>j[a.oldTradeId]??a.suggestedCredits,s=_.filter(a=>f(a.oldTradeId)),r=s.reduce((a,n)=>a+t(n),0);function m(a,n){const i=n.replace(/[^\d]/g,"");b(k=>({...k,[a]:i===""?0:parseInt(i,10)}))}function o(a){w(n=>{const i=new Set(n);return i.has(a)?i.delete(a):i.add(a),i})}function y(a){return a.map(n=>({item:n,priceCredits:Math.max(1,t(n))}))}function T(){h.invalidateQueries({queryKey:["importable"]}),h.invalidateQueries({queryKey:["listings"]}),h.invalidateQueries({queryKey:["my-assets"]}),h.invalidateQueries({queryKey:["collection-sale-state"]}),P.success("Your Shop is updated.")}return l?!d&&_.length===0?e.jsxs("div",{className:"imp-empty",children:[e.jsx("span",{className:"imp-empty__ico","aria-hidden":!0,children:"✨"}),e.jsx("h1",{className:"imp-empty__title",children:"You're all caught up"}),e.jsx("p",{className:"muted",children:"Everything you sell is already in the Shop — nothing to import."}),e.jsx(A,{className:"btn btn--purple",to:"/my-assets",children:"Go to My Assets"})]}):e.jsxs("div",{className:"imp",children:[e.jsxs("header",{className:"imp__head",children:[e.jsx("span",{className:"imp__eyebrow",children:"Import to the Shop"}),e.jsxs("h1",{className:"imp__title",children:["Bring your listings ",e.jsx("span",{className:"imp__grad",children:"into the Shop"})]}),e.jsxs("p",{className:"imp__lede",children:["These items are already for sale elsewhere. We suggested a price in ",S.name," for each — matched to today's rate and rounded up. Adjust anything, then list them."]})]}),e.jsxs("div",{className:"imp__ratebar",children:[e.jsx(v,{className:"ccy-mark imp__diamond"})," 1 ",S.nameSingular," = $0.10 · prices rounded up"]}),d?e.jsx("div",{className:"imp__list",children:Array.from({length:4}).map((a,n)=>e.jsx("div",{className:"imp-row imp-row--skeleton"},n))}):B.map(a=>{const n=(c==null?void 0:c[a.key])??[];return n.length===0?null:e.jsxs("section",{className:"imp__section",children:[e.jsxs("div",{className:"imp__section-head",children:[e.jsx("h2",{className:"imp__section-title",children:a.title}),e.jsx("span",{className:"imp__section-sub",children:a.sub})]}),e.jsx("div",{className:"imp__list",children:n.map(i=>{const k=t(i),M=k!==i.suggestedCredits;return e.jsxs("article",{className:`imp-row${f(i.oldTradeId)?"":" is-off"}`,children:[e.jsx("input",{type:"checkbox",className:"imp-check",checked:f(i.oldTradeId),onChange:()=>o(i.oldTradeId),"aria-label":`Include ${i.name}`}),e.jsx("div",{className:"imp-thumb",children:i.thumbnail?e.jsx("img",{src:i.thumbnail,alt:""}):null}),e.jsxs("div",{className:"imp-meta",children:[e.jsx("div",{className:"imp-name",title:i.name,children:i.name||"Item"}),e.jsx("span",{className:"imp-chip",children:i.rarity})]}),e.jsxs("div",{className:"imp-price",children:[e.jsxs("div",{className:"imp-price__field",children:[e.jsx(v,{className:"ccy-mark imp-price__diamond"}),e.jsx("input",{className:"imp-price__input",inputMode:"numeric",value:k.toLocaleString(),onChange:$=>m(i.oldTradeId,$.target.value),"aria-label":`Price in ${S.name} for ${i.name}`})]}),e.jsxs("div",{className:"imp-price__sub",children:[e.jsxs("span",{children:["$",(k*.1).toFixed(2)]}),M?e.jsxs("button",{className:"imp-price__reset",onClick:()=>b($=>({...$,[i.oldTradeId]:i.suggestedCredits})),children:["Reset to ",e.jsx(v,{className:"ccy-mark"}),i.suggestedCredits.toLocaleString()]}):null]})]}),e.jsx("div",{className:"imp-action",children:e.jsx("button",{className:"btn btn--sm imp-row__list",disabled:!f(i.oldTradeId),onClick:()=>N(y([i])),children:"List"})})]},i.oldTradeId)})})]},a.key)}),e.jsx("div",{className:"imp-dock",children:e.jsxs("div",{className:"imp-dock__inner",children:[e.jsxs("div",{className:"imp-dock__summary",children:[e.jsxs("div",{className:"imp-dock__total",children:[e.jsx(v,{className:"ccy-mark imp__diamond"})," ",r.toLocaleString()]}),e.jsxs("div",{className:"imp-dock__sub",children:[s.length," item",s.length===1?"":"s"," selected · $",(r*.1).toFixed(2)]})]}),e.jsx("span",{className:"imp-dock__spacer"}),e.jsxs("button",{className:"btn btn--purple imp-dock__cta",disabled:s.length===0,onClick:()=>N(y(s)),children:["List all (",s.length,")"]})]})}),u&&l?e.jsx(z,{queue:u,session:l,onClose:()=>N(null),onDone:T}):null]}):e.jsxs("div",{className:"imp-empty",children:[e.jsx("span",{className:"imp-empty__ico","aria-hidden":!0,children:"📦"}),e.jsx("h1",{className:"imp-empty__title",children:"Import your listings"}),e.jsx("p",{className:"muted",children:"Sign in to bring the items you already sell into the Shop."}),e.jsx("button",{className:"btn btn--purple",onClick:()=>I(),children:"Sign in"})]})}export{se as ImportListings};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-DC4HR9fs.js","assets/react-CsaE3SwW.js","assets/index-C0xdJx_z.js","assets/ethers-Da-Ao_qK.js","assets/index-Kb_kdzXZ.css","assets/emotion-styled.browser.esm-Q1W1tHJu.js","assets/Button-CbIdTKGq.js","assets/CircularProgress-Bb7X2tGG.js"])))=>i.map(i=>d[i]);
2
+ import{j as e,r as c,u as fe,d as ve,a as xe,L as je}from"./react-CsaE3SwW.js";import{_ as Ne,c as Q,L as be,O as ye,N as ge,al as Ie,W as we,j as A,i as Z,am as Ce,q as T,e as L,v as Ae,b as K,y as ke,u as P,an as Se,k as V,ao as Ee,ap as Le,s as Pe,C as Te,aq as Y,ar as Fe,h as Re,w as $e,x as Be,F as qe,G as Me,H,E as Oe,J as Ve,D as We,I as Ge,l as Ue,f as De,as as ze,at as Ke,K as Ye}from"./index-C0xdJx_z.js";import{a as J}from"./buy-CvV1hrMv.js";import{g as He,a as Je,w as Qe,S as Ze,G as Xe}from"./buy-gasless-bwypVo2l.js";import"./ethers-Da-Ao_qK.js";import"./trade-encoding-Dvpuinzl.js";import"./index-IeuP0ICf.js";const es=c.lazy(()=>Ne(()=>import("./index-DC4HR9fs.js").then(t=>t.i),__vite__mapDeps([0,1,2,3,4,5,6,7])).then(t=>({default:t.EmoteControls})));function ss(t){return e.jsx(c.Suspense,{fallback:null,children:e.jsx(es,{...t})})}function as({item:t}){const n=Q(I=>{var b;return(b=I.session)==null?void 0:b.address}),{data:r,isLoading:p}=be(n),g=n&&r?n:"default",m=t.category==="emote",[x,l]=c.useState("avatar"),h=!m&&x==="item",[s,i]=c.useState(!0);c.useEffect(()=>{i(!0)},[t.id,h]);const o=!!n&&!!r,f=o&&ye(t,ge(r)),N=Ie(t)[0],_=o&&!f&&!m;return e.jsxs(e.Fragment,{children:[p?null:e.jsx(we,{id:"shop-item-preview",contractAddress:t.contractAddress,tokenId:t.tokenId??void 0,itemId:t.tokenId?void 0:t.itemId??void 0,profile:h?void 0:f?g:"default",bodyShape:h||f?void 0:N,type:m?void 0:h?A.PreviewType.WEARABLE:A.PreviewType.AVATAR,emote:m||h?void 0:A.PreviewEmote.FASHION,disableBackground:!0,wheelZoom:m?1.5:void 0,wheelStart:m?100:void 0,dev:Z.chainId===80002,onLoad:()=>i(!1)},t.id),p||s?e.jsx("div",{className:"item-preview__loading","aria-busy":"true","aria-label":"Loading preview",children:e.jsx("span",{className:"item-preview__spinner","aria-hidden":!0})}):null,_&&!h?e.jsxs("p",{className:"item-preview__note",children:["Shown on a ",Ce(N)," body — this item isn’t made for your avatar’s shape."]}):null,m?e.jsx("div",{className:"item-preview__emote-controls",children:e.jsx(ss,{wearablePreviewId:"shop-item-preview",hideFrameInput:!0})}):e.jsxs("div",{className:"item-preview__toggle",role:"group","aria-label":"Preview mode",children:[e.jsx("button",{type:"button",className:x==="avatar"?"is-active":"","aria-pressed":x==="avatar",onClick:()=>l("avatar"),children:"On avatar"}),e.jsx("button",{type:"button",className:x==="item"?"is-active":"","aria-pressed":x==="item",onClick:()=>l("item"),children:"Item"})]})]})}function ts(t){return t==="male"?"♂":t==="female"?"♀":t==="unisex"?"⚥":""}function is({title:t,items:n,activeId:r,onSelect:p,onViewAll:g}){const m=c.useRef(null),x=T(i=>i.add),l=T(i=>i.items.map(o=>o.id));if(n.length===0)return null;function h(i){x(i,"carousel"),Ae.success(`“${i.name}” added to your cart.`)}function s(i){const o=m.current;o&&o.scrollBy({left:i*Math.round(o.clientWidth*.8),behavior:"smooth"})}return e.jsxs("section",{className:"collection-carousel",children:[e.jsxs("div",{className:"collection-carousel__head",children:[e.jsx("h2",{className:"collection-carousel__title",children:t}),e.jsxs("div",{className:"collection-carousel__head-right",children:[g?e.jsx("button",{className:"collection-carousel__viewall",onClick:g,children:"View all"}):null,e.jsxs("div",{className:"collection-carousel__arrows",children:[e.jsx("button",{className:"collection-carousel__arrow",onClick:()=>s(-1),"aria-label":"Scroll left",children:"‹"}),e.jsx("button",{className:"collection-carousel__arrow",onClick:()=>s(1),"aria-label":"Scroll right",children:"›"})]})]})]}),e.jsx("div",{className:"collection-carousel__track",ref:m,children:n.map(i=>{const o=ts(i.gender),f=i.id===r,N=i.priceCredits>0,_=l.includes(i.id);return e.jsxs("article",{className:`collection-carousel__card${f?" is-active":""}`,children:[e.jsx("button",{className:"collection-carousel__select","aria-label":`View ${i.name}`,"aria-current":f||void 0,onClick:()=>p(i)}),e.jsxs("div",{className:"collection-carousel__media",children:[i.thumbnail?e.jsx("img",{className:"collection-carousel__img",src:i.thumbnail,alt:i.name,loading:"lazy"}):null,N?e.jsx("button",{className:"collection-carousel__add",disabled:_,"aria-label":_?"In cart":`Add ${i.name} to cart`,title:_?"In cart":"Add to cart",onClick:I=>{I.stopPropagation(),_||h(i)},children:e.jsx("span",{className:`ico ${_?"ico-cart-solid":"ico-cart"}`,"aria-hidden":!0})}):null]}),e.jsxs("div",{className:"collection-carousel__body",children:[e.jsx("div",{className:"collection-carousel__name",title:i.name,children:i.name}),e.jsxs("div",{className:"collection-carousel__meta",children:[N?e.jsxs("span",{className:"collection-carousel__price",children:[e.jsx(L,{className:"collection-carousel__diamond"}),i.priceCredits]}):e.jsx("span",{className:"collection-carousel__price collection-carousel__na",children:"Not listed"}),e.jsxs("span",{className:"collection-carousel__chips",children:[e.jsx("span",{className:"chip chip--rarity",children:i.rarity}),o?e.jsx("span",{className:"chip chip--icon",children:o}):null]})]})]})]},i.id)})})]})}function rs(t){return Object.values(A.Rarity).includes(t)}function ns(t){return t==="male"?"Male":t==="female"?"Female":t==="unisex"?"Unisex":null}function cs(t){const n=t,r=(n.message??"").toLowerCase();return n.code===4001||r.includes("reject")||r.includes("denied")||r.includes("cancel")?"You cancelled the request.":r.includes("insufficient")?`You don't have enough ${Ue.name} — get more first.`:r.includes("no active listing")||r.includes("not for sale")?"This item is not for sale right now.":"Couldn't complete checkout — please try again."}function ps(){const{contractAddress:t,tokenId:n}=fe(),{state:r}=ve(),p=xe(),g=T(a=>a.add),m=T(a=>a.items),x=K(a=>a.toggle),{session:l}=Q(),{data:h}=ke(l),[s,i]=c.useState(()=>r!=null&&r.item?{...r.item,tradeId:r.tradeId??r.item.tradeId}:{id:`${t}-${n}`,name:"",creator:"",contractAddress:t??"",itemId:null,category:"wearable",rarity:"common",network:"MATIC",chainId:Z.chainId,thumbnail:"",priceCredits:0,gender:null,tokenId:n??void 0,tradeId:r==null?void 0:r.tradeId}),[o,f]=c.useState(!1),[N,_]=c.useState(null),[I,b]=c.useState(null),{data:w=[],isFetched:X}=P({queryKey:["collection-items",s.contractAddress],enabled:!!s.contractAddress,queryFn:()=>De(s.contractAddress,{first:20}).then(a=>a.items)}),{data:F,isLoading:ee}=P({queryKey:["shop-item",s.contractAddress,n],enabled:!(r!=null&&r.item)&&!!s.contractAddress&&!!n,queryFn:()=>ze(s.contractAddress,n)});c.useEffect(()=>{F&&i(a=>a.tradeId?a:{...F})},[F]);const[W,se]=c.useState(!1),{data:R=""}=P({queryKey:["item-desc",s.contractAddress,s.itemId],enabled:!!s.contractAddress&&!!s.itemId,staleTime:5*6e4,queryFn:()=>Ke(s.contractAddress,s.itemId)});c.useEffect(()=>{if(s.name||w.length===0)return;const a=n&&w.find(d=>d.tokenId===n||d.itemId===n)||w.find(d=>d.contractAddress===s.contractAddress);a&&i(d=>({...a,tradeId:d.tradeId??a.tradeId}))},[w]);const ae=c.useMemo(()=>{const a=new Set,d=[];for(const u of w){if(u.id===s.id||s.itemId&&u.itemId===s.itemId||s.tokenId&&u.tokenId===s.tokenId)continue;const E=`${u.contractAddress}-${u.itemId??u.tokenId??u.id}`;a.has(E)||(a.add(E),d.push(u))}return d},[w,s.id,s.itemId,s.tokenId]),{data:te,isLoading:k}=P({queryKey:["detail-trade",s.id,s.tradeId,s.contractAddress,s.itemId],enabled:!!s.contractAddress,queryFn:async()=>{if(s.tradeId)return s.tradeId;if(s.itemId){const a=await Ye(s.contractAddress,s.itemId);return(a==null?void 0:a.id)??null}return null}}),y=s.tradeId??te??void 0,j=!!y,ie=Se({priceCredits:s.priceCredits,compareAtCredits:s.compareAtCredits,saleEndsAt:s.saleEndsAt}),S=c.useMemo(()=>({...s,tradeId:y,id:y??s.id}),[s,y]),$=m.some(a=>a.id===S.id),B=K(a=>!!a.items[s.id]);c.useEffect(()=>{_(null),b(null)},[s.id]);const G=c.useRef(null);c.useEffect(()=>{!s.name||k||G.current===s.id||(G.current=s.id,V("Shop Viewed Item",{...Ee(s),for_sale:j}),Le(s))},[s.id,s.name,k,j]);function re(a){i(a);const d=a.tokenId??a.itemId;a.contractAddress&&d&&p(`/item/${a.contractAddress}/${d}`,{replace:!0,state:{item:a}}),typeof window<"u"&&window.scrollTo({top:0,behavior:"smooth"})}function ne(){!j||$||D||g(S,"item_detail")}async function ce(){var E;if(!j||!y)return;if(!l){b("Sign in to check out.");return}b(null),f(!0);let a,d="authorize",u=!1;try{_(`Buying ${s.name||"item"}…`);const v=await Re(y);if(!v)throw new Error("not for sale");if($e(v,l.address)){b("You can't buy your own listing."),_(null),f(!1);return}const q=(E=v.received)==null?void 0:E[0],_e=Be(q==null?void 0:q.amount),{credit:z,maxCreditedValue:pe}=await qe(l.identity,_e,y);a=z.id,d="submit";const M={trade:v,buyer:l.address,signer:l.signer,credits:[z],maxCreditedValue:pe};let C;if(He())try{C=await Je(M),await Qe(C),u=!0}catch(O){if(O instanceof Ze)u=!0;else if(O instanceof Xe)C=await J(M);else throw O}else C=await J(M);a=void 0,V("Shop Completed Purchase",{...Me([S]),payment_type:"credits",no_crypto_step:u,transaction_hash:C??null}),p("/success",{state:{items:[S],txHash:C}})}catch(v){H(v)||Oe(v,{flow:"buy",step:d,gasless:u}),a&&Ve(l.identity,[a]).catch(()=>{}),V(H(v)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:d,error_code:Ge(v),value_usd:We(S.priceCredits)}),b(cs(v)),_(null)}finally{f(!1)}}const le=rs(s.rarity)?s.rarity:A.Rarity.COMMON,[de]=A.Rarity.getGradient(le),U=ns(s.gender),oe=j&&ie,ue="More from this collection",D=Pe(s,l==null?void 0:l.address),me=j?$?"In cart":k?"Checking…":"Add to cart":"Not for sale",he=ee||!!s.contractAddress&&!X;return!s.name&&!he?e.jsxs("div",{className:"item-detail item-detail--notfound",children:[e.jsx("span",{className:"ico ico-cart item-detail__notfound-ico","aria-hidden":!0}),e.jsx("h1",{className:"item-detail__notfound-title",children:"This item isn’t available"}),e.jsx("p",{className:"muted",children:"It may have been delisted or moved. Browse Collectibles for something else."}),e.jsx("button",{className:"btn btn--purple",onClick:()=>p("/assets"),children:"Browse Collectibles"})]}):e.jsxs("div",{className:"item-detail",children:[e.jsxs("nav",{className:"item-detail__crumbs","aria-label":"Breadcrumb",children:[e.jsx("button",{className:"item-detail__crumb-link",onClick:()=>p("/assets"),children:"Collectibles"}),e.jsx("span",{className:"item-detail__crumb-sep",children:"/"}),e.jsx("span",{className:"item-detail__crumb-current",children:s.name||"Item"})]}),e.jsxs("div",{className:"item-detail__main",children:[e.jsx("div",{className:"item-detail__preview",style:{background:`radial-gradient(circle at 50% 38%, ${de}33 0%, var(--media) 68%)`},children:s.name?e.jsx(as,{item:s}):e.jsx("div",{className:"item-preview__loading","aria-busy":"true","aria-label":"Loading preview",children:e.jsx("span",{className:"item-preview__spinner","aria-hidden":!0})})}),e.jsxs("div",{className:"item-detail__info",children:[e.jsxs("div",{className:"item-detail__info-head",children:[e.jsx("h1",{className:"item-detail__title",children:s.name||"Loading…"}),e.jsx("button",{className:`item-detail__fav${B?" is-on":""}`,onClick:()=>x(s),"aria-pressed":B,"aria-label":B?"Remove from favorites":"Add to favorites",children:e.jsx("span",{className:"ico ico-heart","aria-hidden":!0})})]}),s.creator?e.jsx(Te,{address:s.creator,className:"item-detail__creator",linkToProfile:!0}):null,e.jsxs("div",{className:"item-detail__chips",children:[e.jsx("span",{className:"chip chip--rarity",children:s.rarity}),e.jsx("span",{className:"chip",children:s.category==="emote"?"Emote":"Wearable"}),U?e.jsx("span",{className:"chip",children:U}):null]}),R?e.jsxs("div",{className:"item-detail__description",children:[e.jsx("p",{className:`item-detail__desc-text${W?" is-expanded":""}`,children:R}),R.length>140?e.jsx("button",{className:"link item-detail__desc-toggle",onClick:()=>se(a=>!a),children:W?"Show less":"Read more"}):null]}):null,e.jsxs("div",{className:"item-detail__card",children:[e.jsxs("div",{className:"item-detail__price-block",children:[e.jsx("div",{className:"item-detail__price-label",children:"Price"}),j?oe?e.jsxs("div",{className:"item-detail__price item-detail__price--sale",children:[e.jsxs("span",{className:"item-detail__price",children:[e.jsx(L,{className:"item-detail__diamond"}),e.jsx("span",{className:"item-detail__price-value",children:s.priceCredits})]}),e.jsxs("span",{className:"item-detail__price-was",children:[e.jsx(L,{className:"item-detail__diamond item-detail__diamond--was"}),s.compareAtCredits]}),Y(s.compareAtCredits,s.priceCredits)>0?e.jsxs("span",{className:"item-detail__sale-badge",children:["SALE -",Y(s.compareAtCredits,s.priceCredits),"%"]}):null,e.jsx(Fe,{endsAt:s.saleEndsAt,className:"item-detail__countdown"})]}):e.jsxs("div",{className:"item-detail__price",children:[e.jsx(L,{className:"item-detail__diamond"}),e.jsx("span",{className:"item-detail__price-value",children:s.priceCredits})]}):e.jsx("div",{className:"item-detail__price item-detail__price--none",children:"Not for sale"}),l?e.jsxs("div",{className:"item-detail__balance muted",children:["Your balance: ",e.jsx(L,{className:"ccy-mark"})," ",(h==null?void 0:h.credits)??0]}):null]}),e.jsx("div",{className:"item-detail__ctas",children:D?e.jsxs("p",{className:"item-detail__own-note muted",children:["This is your item — manage it in ",e.jsx(je,{to:"/my-assets",children:"My Assets"}),"."]}):e.jsxs(e.Fragment,{children:[j?e.jsx("button",{className:"btn btn--purple item-detail__cta",onClick:ce,disabled:o||k,children:o?"Buying…":"Buy now"}):null,e.jsxs("button",{className:"item-detail__addcart",onClick:ne,disabled:!j||$||k||o,children:[e.jsx("span",{className:"ico ico-cart-solid item-detail__addcart-ico","aria-hidden":!0}),me]})]})}),N?e.jsx("p",{className:"muted item-detail__status",children:N}):null,I?e.jsx("p",{className:"error item-detail__status",children:I}):null]})]})]}),e.jsx(is,{title:ue,items:ae,activeId:s.id,onSelect:re,onViewAll:s.contractAddress?()=>p(`/collection/${s.contractAddress}`):void 0})]})}export{ps as ItemDetail,ps as default};
@@ -1 +1 @@
1
- import{r as i,j as l}from"./react-Vu6nbGi5.js";function a({hasNextPage:e,isFetching:r,onLoadMore:n}){const t=i.useRef(null);return i.useEffect(()=>{const s=t.current;if(!s||!e)return;const o=new IntersectionObserver(u=>{var c;(c=u[0])!=null&&c.isIntersecting&&!r&&n()},{rootMargin:"600px 0px"});return o.observe(s),()=>o.disconnect()},[e,r,n]),e?l.jsx("div",{className:"load-more",ref:t,children:l.jsx("button",{className:"btn btn--ghost",onClick:n,disabled:r,children:r?"Loading…":"Load more"})}):null}export{a as L};
1
+ import{r as i,j as l}from"./react-CsaE3SwW.js";function a({hasNextPage:e,isFetching:r,onLoadMore:n}){const t=i.useRef(null);return i.useEffect(()=>{const s=t.current;if(!s||!e)return;const o=new IntersectionObserver(u=>{var c;(c=u[0])!=null&&c.isIntersecting&&!r&&n()},{rootMargin:"600px 0px"});return o.observe(s),()=>o.disconnect()},[e,r,n]),e?l.jsx("div",{className:"load-more",ref:t,children:l.jsx("button",{className:"btn btn--ghost",onClick:n,disabled:r,children:r?"Loading…":"Load more"})}):null}export{a as L};
@@ -0,0 +1 @@
1
+ import{a as ee,r as u,j as e,b as ae}from"./react-CsaE3SwW.js";import{u as te,i as W,c as re,y as se,z as O,h as ie,w as ne,F as oe,J as I,k as M,I as $,H as G,e as T,aa as H,l as U,A as ce,ab as le}from"./index-C0xdJx_z.js";import{r as de,a as q,m as ue}from"./mana-rate-N-v6x0qz.js";import{S as Y,F as me,a as he}from"./FilterBar-SMt4LPR3.js";import{S as K}from"./SkeletonCards-D-gEhGqV.js";import{L as ye}from"./LoadMore-XFaiIbYi.js";import{a as Q}from"./buy-CvV1hrMv.js";import{g as pe,a as fe,w as ke,S as be,G as _e}from"./buy-gasless-bwypVo2l.js";import{u as ge}from"./useInfiniteGrid-D56AG3-z.js";import"./ethers-Da-Ao_qK.js";import"./index-IeuP0ICf.js";import"./trade-encoding-Dvpuinzl.js";function xe(){return te({queryKey:["mana-rate",W.chainId],queryFn:()=>de(W.chainId),staleTime:6e4,refetchInterval:6e4,retry:1})}function z(a){const m=a,l=(m.message??"").toLowerCase();return m.code===4001||l.includes("reject")||l.includes("denied")||l.includes("cancel")?"You cancelled the request.":l.includes("insufficient")?`Not enough ${U.name} — get more first.`:l.includes("not found")||l.includes("no active listing")||l.includes("404")?"This item was just sold or removed. Refreshing the market…":l.includes("your own listing")?"You can't buy your own listing.":"Couldn't complete checkout — please try again."}function Ce(a){return{id:a.tradeId,tradeId:a.tradeId,name:a.name,creator:a.creator,contractAddress:a.contractAddress,itemId:a.itemId,category:a.category,wearableCategory:a.wearableCategory??void 0,rarity:a.rarity,network:a.network,chainId:a.chainId,thumbnail:a.thumbnail,priceCredits:0,gender:null}}function ve({listing:a,rate:m,onClose:l,onSold:p}){const{session:i}=re(),{data:o}=se(i),f=O(),k=ee(),[v,b]=u.useState("confirm"),[j,w]=u.useState("Locking today’s price…"),[x,C]=u.useState(null),[s,E]=u.useState(null),d=u.useRef(null),A=Math.ceil(q(a.manaWei,m)/10);u.useEffect(()=>{let h=!1;if(!i){b("error"),C("Sign in to check out.");return}return(async()=>{try{const r=await ie(a.tradeId);if(!r)throw new Error("not found");if(ne(r,i.address))throw new Error("You can't buy your own listing.");const c=q(a.manaWei,m);if(!Number.isFinite(c)||c<=0)throw new Error("price unavailable");const{credit:y,maxCreditedValue:R,usdCents:P}=await oe(i.identity,c,a.tradeId);if(h){I(i.identity,[y.id]).catch(()=>{});return}d.current=y.id,E({trade:r,credit:y,maxCreditedValue:R,usdCents:P,credits:Math.ceil(P/10)}),w("")}catch(r){if(h)return;console.error("[market] authorize failed",r),M(G(r)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:"authorize",error_code:$(r),value_usd:Math.round(q(a.manaWei,m))/100}),b("error"),C(z(r))}})(),()=>{h=!0,d.current&&i&&(I(i.identity,[d.current]).catch(()=>{}),d.current=null)}},[]);const _=!!s&&((o==null?void 0:o.credits)??0)<s.credits;async function L(){if(!i||!s)return;if(_){I(i.identity,[s.credit.id]).catch(()=>{}),d.current=null,k("/credits");return}b("working"),C(null);let h=!1;try{w("Confirming your purchase…");const r={trade:s.trade,buyer:i.address,signer:i.signer,credits:[s.credit],maxCreditedValue:s.maxCreditedValue};let c;if(pe())try{c=await fe(r),await ke(c),h=!0}catch(y){if(y instanceof be)h=!0;else if(y instanceof _e)c=await Q(r);else throw y}else c=await Q(r);d.current=null,M("Shop Completed Purchase",{items:[{item_id:a.itemId??null,contract_address:a.contractAddress,token_id:null,price_usd:s.usdCents/100}],value_credits:s.credits,value_usd:s.usdCents/100,purchase_type:"item",is_primary:!0,payment_type:"credits",no_crypto_step:h,transaction_hash:c??null}),f.invalidateQueries({queryKey:["usd-balance"]}),k("/success",{state:{items:[Ce(a)],txHash:c}})}catch(r){console.error("[market] buy now failed",r),I(i.identity,[s.credit.id]).catch(()=>{}),d.current=null,M(G(r)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:"submit",error_code:$(r),value_usd:s.usdCents/100}),f.invalidateQueries({queryKey:["usd-balance"]});const c=z(r);C(c),b("error"),/sold or removed/i.test(c)&&p()}}function F(){i&&s&&I(i.identity,[s.credit.id]).catch(()=>{}),d.current=null,l()}const g=v==="working";return e.jsxs("div",{className:"mkt-modal",role:"dialog","aria-modal":"true","aria-label":`Buy ${a.name}`,children:[e.jsx("div",{className:"mkt-modal__scrim",onClick:g?void 0:F,"aria-hidden":!0}),e.jsxs("div",{className:"mkt-modal__card",children:[e.jsxs("div",{className:"mkt-modal__head",children:[e.jsx("div",{className:"mkt-modal__thumb",children:a.thumbnail?e.jsx("img",{src:a.thumbnail,alt:""}):null}),e.jsxs("div",{children:[e.jsx("div",{className:"mkt-modal__name",title:a.name,children:a.name||"Item"}),e.jsx("span",{className:"chip chip--rarity",children:a.rarity})]})]}),e.jsx("div",{className:"mkt-modal__price",children:s?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"mkt-modal__price-label",children:"Final price"}),e.jsxs("div",{className:"mkt-modal__price-value",children:[e.jsx(T,{className:"mkt-modal__diamond"}),H(s.credits)]}),e.jsxs("div",{className:"mkt-modal__price-sub muted",children:["Locked for this purchase · $",(s.usdCents/100).toFixed(2)]})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"mkt-modal__price-label",children:"Today’s price"}),e.jsxs("div",{className:"mkt-modal__price-value mkt-modal__price-value--approx",children:[e.jsx("span",{className:"mkt-modal__approx","aria-hidden":!0,children:"≈"}),e.jsx(T,{className:"mkt-modal__diamond"}),H(A)]}),e.jsx("div",{className:"mkt-modal__price-sub muted",children:j||"Locking today’s price…"})]})}),i?e.jsxs("div",{className:"mkt-modal__balance muted",children:["Your balance: ",e.jsx(T,{className:"ccy-mark"})," ",(o==null?void 0:o.credits)??0]}):null,_?e.jsxs("p",{className:"muted mkt-modal__note",children:["You’ll need a few more ",U.name," to buy this."]}):null,j&&v==="working"?e.jsx("p",{className:"muted mkt-modal__note",children:j}):null,x?e.jsx("p",{className:"error mkt-modal__note",children:x}):null,e.jsxs("div",{className:"mkt-modal__actions",children:[e.jsx("button",{className:"btn btn--ghost",onClick:F,disabled:g,children:"Cancel"}),e.jsx("button",{className:"btn btn--purple",onClick:L,disabled:g||!s,children:g?"Buying…":_?`Get ${U.name}`:"Confirm purchase"})]})]})]})}const je=48,B=[{key:"wearable",label:"Wearables",sub:["Head","Upper Body","Handwear","Lower Body","Feet","Accessories","Skins"]},{key:"emote",label:"Emotes",sub:[]}],we={Head:["head","hat","hair","facial_hair","eyes","eyebrows","mouth","mask","helmet","tiara","top_head"],"Upper Body":["upper_body"],Handwear:["hands_wear"],"Lower Body":["lower_body"],Feet:["feet"],Accessories:["earring","eyewear"],Skins:["skin"]};function Ne(a){return{id:a.tradeId,tradeId:a.tradeId,name:a.name,creator:a.creator,contractAddress:a.contractAddress,itemId:a.itemId,category:a.category,wearableCategory:a.wearableCategory??void 0,rarity:a.rarity,network:a.network,chainId:a.chainId,thumbnail:a.thumbnail,priceCredits:0,gender:null}}function Ue(){const[a]=ae(),m=(a.get("q")??"").trim().toLowerCase(),l=O(),[p,i]=u.useState("wearable"),[o,f]=u.useState(null),[k,v]=u.useState([]),[b,j]=u.useState("newest"),[w,x]=u.useState(null),C=o?we[o]:void 0,s=(Y.find(t=>t.key===b)??Y[0]).server,E={category:p,rarities:k.length?k:void 0,wearableCategories:C,search:m||void 0,sortBy:s},{items:d,total:A,isLoading:_,error:L,hasNextPage:F,isFetchingNextPage:g,fetchNextPage:h}=ge(["legacy-listings",E],t=>le({...E,first:je,skip:t})),{data:r,isError:c}=xe(),y=t=>r?ue(t.manaWei,r):null;function R(t){i(t),f(null)}function P(t){v(n=>n.includes(t)?n.filter(S=>S!==t):[...n,t])}function V(){i("wearable"),f(null),v([])}function J(t){const n=d.find(S=>S.tradeId===t.tradeId);n&&x(n)}function Z(){l.invalidateQueries({queryKey:["legacy-listings"]})}const N=B.find(t=>t.key===p)??B[0],D=o?`${N.label} · ${o}`:N.label,X=p!=="wearable"||!!o||k.length>0;return e.jsxs("div",{className:"browse",children:[e.jsxs("div",{className:"market-banner",children:[e.jsx("span",{className:"market-banner__ico","aria-hidden":!0,children:"✨"}),e.jsx("span",{children:"Prices here follow the live market and may shift slightly at checkout."})]}),c?e.jsx("p",{className:"market-banner market-banner--warn",children:"The market price is temporarily unavailable — buying is paused for a moment. Please try again shortly."}):null,e.jsx(me,{rarities:k,onToggleRarity:P,sort:b,onSort:j,total:A,loading:_,query:m,anyActive:X,onClear:V,renderLeading:t=>e.jsx(he,{panelKey:"section",label:D,active:!!o||p!=="wearable",panel:t,children:e.jsxs("div",{className:"filter-pop filter-pop--section",children:[e.jsx("ul",{className:"filter-pop__cats",children:B.map(n=>e.jsx("li",{children:e.jsx("button",{className:`filter-pop__cat${p===n.key?" is-active":""}`,onClick:()=>R(n.key),children:n.label})},n.key))}),N.sub.length?e.jsxs("ul",{className:"filter-pop__subs",children:[e.jsx("li",{children:e.jsxs("button",{className:`filter-pop__sub${o?"":" is-active"}`,onClick:()=>{f(null),t.close()},children:["All ",N.label]})}),N.sub.map(n=>e.jsx("li",{children:e.jsx("button",{className:`filter-pop__sub${o===n?" is-active":""}`,onClick:()=>{f(S=>S===n?null:n),t.close()},children:n})},n))]}):null]})})}),L?e.jsx("p",{className:"error",children:"Couldn’t load the market — please try again."}):null,e.jsx("div",{className:"grid",children:_?e.jsx(K,{count:15}):e.jsxs(e.Fragment,{children:[d.map(t=>e.jsx(ce,{item:Ne(t),mode:"market",marketPriceCredits:y(t),onBuyNow:J},t.tradeId)),g?e.jsx(K,{count:6}):null]})}),e.jsx(ye,{hasNextPage:F,isFetching:g,onLoadMore:()=>h()}),!_&&d.length===0?e.jsx("p",{className:"muted",children:"No items match your filters."}):null,w&&r?e.jsx(ve,{listing:w,rate:r,onClose:()=>x(null),onSold:()=>{x(null),Z()}}):null]})}export{Ue as Market,Ue as default};