@dcl/shop 0.1.0-30535358248.commit-2722a7f → 0.1.0-30555147117.commit-c0cc5df

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 (175) hide show
  1. package/assets/{Activity-CvucBHHY.js → Activity-DCbV7Dlz.js} +4 -4
  2. package/assets/{AnimatedBackground-RAMrqGx_.js → AnimatedBackground-D7rZFX-y.js} +2 -2
  3. package/assets/{Assets-knlkMAu5.js → Assets-DbLl1p1e.js} +2 -2
  4. package/assets/{Assets.styles-CvuyiKqx.js → Assets.styles-CHGtG3LU.js} +1 -1
  5. package/assets/{Authorizations-6ASyROzc.js → Authorizations-DJNBkPEr.js} +1 -1
  6. package/assets/Cart-BghZZpIP.js +695 -0
  7. package/assets/{CircularProgress-DNgXJHy_.js → CircularProgress-BrEKWj5U.js} +1 -1
  8. package/assets/{Collection-BMVrfLkT.js → Collection-BcOlqkP2.js} +1 -1
  9. package/assets/{CollectionCarousel-CEeV8t-a.js → CollectionCarousel-C3qgLsBY.js} +1 -1
  10. package/assets/{Creator-BpM4S3Hm.js → Creator-CuPJUn5F.js} +2 -2
  11. package/assets/{ErrorNotice-BStoa2Qo.js → ErrorNotice-DwAAnUwA.js} +1 -1
  12. package/assets/{ExchangeController-BYHmUZwM.js → ExchangeController-D02GxCIy.js} +1 -1
  13. package/assets/{GetCredits-BkAuC3jt.js → GetCredits-BLTnXBjj.js} +7 -7
  14. package/assets/{HelpersUtil-DRtQnbop.js → HelpersUtil-BfxyEXTh.js} +1 -1
  15. package/assets/{ImportListings-Dmc9cvXJ.js → ImportListings-CFXHsPKY.js} +6 -6
  16. package/assets/{ItemDetail-DHe174rO.js → ItemDetail-gmzGWkMe.js} +197 -197
  17. package/assets/{LoadMore-D2rhC3FV.js → LoadMore-D8bZTLv8.js} +1 -1
  18. package/assets/{MenuList-BWVPPtBW.js → MenuList-iDFhw9sU.js} +1 -1
  19. package/assets/{MyAssets-BKeT--Ql.js → MyAssets-BRzGjYcN.js} +1 -1
  20. package/assets/{MyFavorites-BHrdEY10.js → MyFavorites-CM49GENl.js} +44 -17
  21. package/assets/{NotFound-vJnWF5cu.js → NotFound-D7aOezUK.js} +1 -1
  22. package/assets/{NotificationsBell-Chozh7TD.js → NotificationsBell-BO0w1qMB.js} +1 -1
  23. package/assets/{StoreSettings-TqML4NDY.js → StoreSettings-Dl8TtNvz.js} +1 -1
  24. package/assets/{Success-D3O1Ladi.js → Success-B8p6G_k7.js} +1 -1
  25. package/assets/{SwapController-Da0gS2ji.js → SwapController-DXYt8eCk.js} +1 -1
  26. package/assets/{Tooltip-DG5HvItw.js → Tooltip-CmtPsxJu.js} +1 -1
  27. package/assets/{TradeService-DZaBK_Qv.js → TradeService-C1yOBoUa.js} +1 -1
  28. package/assets/{W3MFrameProviderSingleton-DAYqclPH.js → W3MFrameProviderSingleton-_nUMMN_r.js} +3 -3
  29. package/assets/{WebCryptoP256-C0lhkhci.js → WebCryptoP256-BOLkPPIP.js} +1 -1
  30. package/assets/{authorizations-BVmXaQeu.js → authorizations-CzNpcwj-.js} +1 -1
  31. package/assets/{basic-DO7LyzkW.js → basic-IpbulmwC.js} +1 -1
  32. package/assets/{biconomy-DmIZbqMf.js → biconomy-C9xwq1iP.js} +1 -1
  33. package/assets/{browseLayout.styles-DBRHDPrA.js → browseLayout.styles-Gi_W6L0Y.js} +8 -8
  34. package/assets/{builder-D-ICo29L.js → builder-BLl0dWNe.js} +1 -1
  35. package/assets/{buy-Ccaxv3lt.js → buy-VVCbwxmX.js} +1 -1
  36. package/assets/{buy-gasless-UjTpzokh.js → buy-gasless-Cw6IFMAC.js} +1 -1
  37. package/assets/{categories-BFgtEsDl.js → categories-D7Zdwanh.js} +1 -1
  38. package/assets/{ccip--AYEzQZX.js → ccip-D3gG15Tx.js} +1 -1
  39. package/assets/{ccip-XSek2mtN.js → ccip-DxAXdNb6.js} +1 -1
  40. package/assets/{clsx-CsyFr0ZL.js → clsx-CWRNqKvL.js} +2 -2
  41. package/assets/{controller-UEFY0vzS.js → controller-z_ubtZAp.js} +2 -2
  42. package/assets/{core-BvM6vAlM.js → core-B3AJ_0ua.js} +4 -4
  43. package/assets/{createSvgIcon-CqEJzhBK.js → createSvgIcon-CPVuPy9d.js} +2 -2
  44. package/assets/{custom-CmDrwoPL.js → custom-Dz8prIE7.js} +1 -1
  45. package/assets/{data-capture-BGpPQSe4.js → data-capture-BB1fv1MC.js} +1 -1
  46. package/assets/{email-MR7l-5-Z.js → email-fbqqGJ2s.js} +1 -1
  47. package/assets/{embedded-wallet-jJ0wwb2F.js → embedded-wallet-BJhLZ3lj.js} +1 -1
  48. package/assets/{emotion-styled.browser.esm-BjI-2U8x.js → emotion-styled.browser.esm-CyKS4j--.js} +1 -1
  49. package/assets/{engine-CLWZ2d9c.js → engine-BGXLTiQ_.js} +1 -1
  50. package/assets/{errors-BfJQR72Z.js → errors-w45osmm9.js} +1 -1
  51. package/assets/{estimate-l1-fee-DZ79UIrf.js → estimate-l1-fee-dybW3PfS.js} +1 -1
  52. package/assets/{execute-DOgqp-6j.js → execute-CbayRz2e.js} +2 -2
  53. package/assets/{features-ChZmqAVE.js → features-94WCX2Ou.js} +1 -1
  54. package/assets/{fetchTokenMetadata-C3VIvOiy.js → fetchTokenMetadata-EsaUgq3p.js} +2 -2
  55. package/assets/{get-ecosystem-wallet-info-1W7jn21T.js → get-ecosystem-wallet-info-DWv-IFz5.js} +1 -1
  56. package/assets/{getBalance-ofifHtS7.js → getBalance-Dz92_v99.js} +1 -1
  57. package/assets/{getNFT-D3I1Pmv7.js → getNFT-B1pdUf6E.js} +1 -1
  58. package/assets/{getNFT-0GUqM1mE.js → getNFT-EyZ4qlqr.js} +1 -1
  59. package/assets/{getThemeProps-DMJMKWz1.js → getThemeProps-CpslPeXJ.js} +1 -1
  60. package/assets/{grid.styles-BdzonCru.js → grid.styles-BT8g6G1w.js} +1 -1
  61. package/assets/{hashTypedData-BQ7YG-GD.js → hashTypedData-BkhJypb9.js} +1 -1
  62. package/assets/{hashTypedData-SMqK0Bvk.js → hashTypedData-VXV11ywt.js} +1 -1
  63. package/assets/{import-BBD0DWIT.js → import-CjcH4cDS.js} +1 -1
  64. package/assets/{in-app-wallet-calls-D8u8Lb5V.js → in-app-wallet-calls-Ymglwrpz.js} +1 -1
  65. package/assets/{in-app-CxfPziwR.js → in-app-x5rZbfaN.js} +1 -1
  66. package/assets/{index-uF4O1HZa.js → index-8ajBsaIg.js} +1 -1
  67. package/assets/{index-DpRFZG3X.js → index-9PvOV8po.js} +1 -1
  68. package/assets/{index-BYWBHUre.js → index-9QCAyhSS.js} +1 -1
  69. package/assets/{index-D7jjeu20.js → index-BBMJuL6J.js} +2 -2
  70. package/assets/{index-pFP2Nx_c.js → index-BFnETbyc.js} +1 -1
  71. package/assets/{index-CF_sMyTl.js → index-BLFM-OTz.js} +2 -2
  72. package/assets/{index-YUVIXaKh.css → index-BMzstP-8.css} +1 -1
  73. package/assets/{index-CwAAZj9L.js → index-BU6KJB83.js} +3 -3
  74. package/assets/{index-DBpv4hR1.js → index-BX6zRkQu.js} +1 -1
  75. package/assets/{index-BIl576Hj.js → index-BcMB9SzQ.js} +1 -1
  76. package/assets/{index-DK6Afp1x.js → index-BfQNtRN2.js} +2 -2
  77. package/assets/{index-CDKfv2bi.js → index-BgtS_WGf.js} +2 -2
  78. package/assets/index-BuQvO-I_.js +2815 -0
  79. package/assets/{index-CufAJ6Dp.js → index-C5sGgO2Z.js} +1 -1
  80. package/assets/{index-BhaRkjyI.js → index-C7ZO8TeQ.js} +1 -1
  81. package/assets/{index-De2dnF3o.js → index-C98Y4Kcd.js} +1 -1
  82. package/assets/{index-DAMK8alV.js → index-CAKt5A1a.js} +1 -1
  83. package/assets/{index-BHA1eBb6.js → index-CE288NDM.js} +1 -1
  84. package/assets/{index-BMX5hUGo.js → index-CEeFcj09.js} +1 -1
  85. package/assets/{index-BumYVyPx.js → index-CLHh2p8J.js} +1 -1
  86. package/assets/{index-_MfLxWCe.js → index-CPgr_tFp.js} +1 -1
  87. package/assets/{index-r9DiwXAN.js → index-CV4-Elfa.js} +1 -1
  88. package/assets/{index-DkzGDwlW.js → index-Ca6u28zB.js} +1 -1
  89. package/assets/{index-CDl1_5Gn.js → index-CdVDWbCf.js} +1 -1
  90. package/assets/{index-C-lIghD5.js → index-CfEIPaZw.js} +3 -3
  91. package/assets/{index-CbdwidXO.js → index-ChJR2Cb6.js} +1 -1
  92. package/assets/{index-B8hqb_ut.js → index-Cif8I2ag.js} +1 -1
  93. package/assets/{index-Dvv2TfLB.js → index-CkmitkFW.js} +1 -1
  94. package/assets/{index-DCo_b6w_.js → index-CtNwLSfQ.js} +1 -1
  95. package/assets/{index-XhO07huK.js → index-CwxnxxLC.js} +1 -1
  96. package/assets/{index-BiuoTYZN.js → index-CxfClWVp.js} +1 -1
  97. package/assets/{index-2vrBl8sT.js → index-D1DRMy8J.js} +1 -1
  98. package/assets/{index-C1nKRU6X.js → index-D5knZcXs.js} +1 -1
  99. package/assets/{index-Bf-t954n.js → index-DEUtIbvw.js} +1 -1
  100. package/assets/{index-DLYns3Ur.js → index-DNn84jht.js} +1 -1
  101. package/assets/{index-CbbvhaCZ.js → index-DRYd17R7.js} +1 -1
  102. package/assets/{index-CheBwFGj.js → index-DVj7ZD_M.js} +1 -1
  103. package/assets/{index-zc0VnW3D.js → index-DfwSZDrU.js} +1 -1
  104. package/assets/{index-BsLfKftk.js → index-DkJikW0i.js} +2 -2
  105. package/assets/{index-m5SntnZ-.js → index-Dl5is3QK.js} +1 -1
  106. package/assets/{index-2cVzfxOB.js → index-Dyl2Q7D5.js} +1 -1
  107. package/assets/{index-CQqiVn6f.js → index-DzvSkfmg.js} +1 -1
  108. package/assets/{index-BTZdGMI1.js → index-ExQbvVoB.js} +1 -1
  109. package/assets/{index-Du25SJyr.js → index-HythI0O3.js} +3 -3
  110. package/assets/{index-_FQ-SV4x.js → index-LKOnauOl.js} +1 -1
  111. package/assets/{index-B56ftAbJ.js → index-RIvQTx8Y.js} +1 -1
  112. package/assets/{index-SqWDQHXX.js → index-R_BTue84.js} +1 -1
  113. package/assets/{index-CfG77Wyl.js → index-cT8CoAgc.js} +1 -1
  114. package/assets/{index-BU6Q-KL3.js → index-m4CDcFCJ.js} +1 -1
  115. package/assets/{index-CEiPmUBh.js → index-mX19fYJK.js} +1 -1
  116. package/assets/{index-Do9Xy8lr.js → index-vhIb1kkg.js} +1 -1
  117. package/assets/{index-C_o1Zom8.js → index-ywZbqGdK.js} +1 -1
  118. package/assets/{index.es-DXmbtBur.js → index.es-9cuw7AIG.js} +1 -1
  119. package/assets/{index.es-D3lybDuO.js → index.es-C3lxlyK0.js} +1 -1
  120. package/assets/{index.es-DXhNuD76.js → index.es-CdIjtqga.js} +4 -4
  121. package/assets/{localBatchGatewayRequest-CExVMgRH.js → localBatchGatewayRequest-D8nesUnT.js} +1 -1
  122. package/assets/{mana-convert-cZR9DTGN.js → mana-convert-CJwIMTsi.js} +1 -1
  123. package/assets/{mana-rate-cSpFrGml.js → mana-rate-BjJ4VPVX.js} +1 -1
  124. package/assets/{networks-DRyUri_T.js → networks-DJ8NMmpk.js} +1 -1
  125. package/assets/{onramp-B1GVlRI3.js → onramp-Dp70skLy.js} +1 -1
  126. package/assets/{openzeppelin-78-FJYh6.js → openzeppelin-o4LserP7.js} +1 -1
  127. package/assets/{parseNft-Ci4sX3gJ.js → parseNft-DyV_faDA.js} +2 -2
  128. package/assets/{parseSignature-uB_1oAEz.js → parseSignature-DcV_CWPU.js} +1 -1
  129. package/assets/{parseSignature-CTZ9pKw7.js → parseSignature-nmdMwQ7H.js} +3 -3
  130. package/assets/{passkeys-CA3YYnAU.js → passkeys-DSmRIXvD.js} +1 -1
  131. package/assets/{pay-with-exchange-DAyDjUqu.js → pay-with-exchange-CMlWCwA-.js} +1 -1
  132. package/assets/{qr-overlay-BTio6zaV.js → qr-overlay-Dr097QQh.js} +1 -1
  133. package/assets/{receive-yChzvN3k.js → receive-BA30V6DG.js} +1 -1
  134. package/assets/{resolveImplementation-CJVJqdzd.js → resolveImplementation-CMn2be6C.js} +1 -1
  135. package/assets/{rpc-DUGIeI5g.js → rpc-DInWGKvF.js} +1 -1
  136. package/assets/{secp256k1-C54GlILm.js → secp256k1-BTduTORI.js} +1 -1
  137. package/assets/{secp256k1-DwMMQidi.js → secp256k1-BUubbbM8.js} +1 -1
  138. package/assets/{secp256k1-B3QC3RZg.js → secp256k1-CfCSXbGA.js} +1 -1
  139. package/assets/{send-XMScNnJu.js → send-C9h_Nq4W.js} +1 -1
  140. package/assets/{send-batch-transaction-ByP9c7mI.js → send-batch-transaction-CxCYZMmx.js} +1 -1
  141. package/assets/{send-eip712-transaction-B6wWlCEV.js → send-eip712-transaction-DtfuXZ3d.js} +2 -2
  142. package/assets/{send-gasless-transaction-CCtF_hMm.js → send-gasless-transaction-DCcHZj4r.js} +2 -2
  143. package/assets/{send-transaction-D8-Foq0N.js → send-transaction-CS28b2D9.js} +2 -2
  144. package/assets/{sendMetaTransaction-CdI6QA-v.js → sendMetaTransaction-BZ7AB8iM.js} +1 -1
  145. package/assets/{sendRawTransaction-BZO-KbQ7.js → sendRawTransaction-DYCcmGM8.js} +3 -3
  146. package/assets/{serializeTransaction-LcE2ddKR.js → serializeTransaction-BURsrWBP.js} +1 -1
  147. package/assets/{session-proposal-BGYLVtWS.js → session-proposal-Fqbqs3BQ.js} +1 -1
  148. package/assets/{session-request-B4DLpo1c.js → session-request-SGm1lg_K.js} +2 -2
  149. package/assets/{signing-D-serK4b.js → signing-DYbMGJXG.js} +3 -3
  150. package/assets/{socials-DOdAv2Kb.js → socials-I4tJUDyJ.js} +1 -1
  151. package/assets/{swaps-DDatq7je.js → swaps-CwWUu5zw.js} +1 -1
  152. package/assets/{thirdweb-tS0phgDU.js → thirdweb-ClhSV9RB.js} +3 -3
  153. package/assets/{to-serializable-transaction-BjLSxJFE.js → to-serializable-transaction-CJKUUbtG.js} +2 -2
  154. package/assets/{trade-encoding-CJDVWYcF.js → trade-encoding-9Q36L1oR.js} +1 -1
  155. package/assets/{transactionReceipt-C1bkyZl1.js → transactionReceipt-D6SA5WI-.js} +1 -1
  156. package/assets/{transactions-BQh9q_5C.js → transactions-B_RyJBLE.js} +1 -1
  157. package/assets/{useCreditPacks-puL7tAtr.js → useCreditPacks-CQLtHnQk.js} +1 -1
  158. package/assets/{useInfiniteGrid-BxfEkchv.js → useInfiniteGrid-CaF2w2LC.js} +1 -1
  159. package/assets/useManaRate-B4xS82Ma.js +1 -0
  160. package/assets/{useSecondarySales-W8e5_GEF.js → useSecondarySales-BL0-GE0K.js} +1 -1
  161. package/assets/{useStore-B7PIu8Uw.js → useStore-GXb9v5v6.js} +1 -1
  162. package/assets/{useTheme-CbnMJ7mn.js → useTheme-JT9c87P9.js} +1 -1
  163. package/assets/{verifyHash-CjYiVJ2q.js → verifyHash-BNsLW48c.js} +1 -1
  164. package/assets/{w3m-modal-q4l3tcYV.js → w3m-modal-C-8IZr2V.js} +1 -1
  165. package/assets/{w3m-modal-BFtxRT9O.js → w3m-modal-Dnehziva.js} +1 -1
  166. package/assets/{wait-for-tx-receipt-DTWTovYR.js → wait-for-tx-receipt-BXVft6N8.js} +1 -1
  167. package/assets/{wallets-Dka8GiAQ.js → wallets-BcnalF0U.js} +5 -5
  168. package/assets/{web-connector-BB8cyTKu.js → web-connector-AcMV6Y4R.js} +3 -3
  169. package/assets/{writeContract-CznbjJyh.js → writeContract-Cnl1Hojy.js} +1 -1
  170. package/assets/{zoraTestnet-DhqU039o.js → zoraTestnet-Dwinu5_g.js} +1 -1
  171. package/index.html +11 -11
  172. package/package.json +2 -2
  173. package/assets/Cart-CktbEy9V.js +0 -676
  174. package/assets/index-D6kQ69Bn.js +0 -2815
  175. package/assets/useManaRate-x5FL9eAV.js +0 -1
@@ -1,676 +0,0 @@
1
- import{j as e,L as ge,r as $,b as Lt,a as Nt}from"./react-vyZjIDcS.js";import{t as ee,s as i,e as a,J as Z,aj as Qt,G as Kt,I as R,z as xt,H as ze,m as Ut,ak as q,Q as Ze,n as Ht,u as Ot,al as Vt,E as Dt,am as Gt,an as Jt,ao as Yt,y as Xt,ap as et,aq as Q,ar as tt,as as Zt,l as V,c as at,h as ea,at as st,au as je,av as ke,aw as ce,ax as nt,a as le,b as ta,C as $e,ay as aa}from"./index-D6kQ69Bn.js";import{M as sa,S as na,C as ia,H as ra,a as oa,T as ca,X as la,b as da,B as ua,c as ha,d as it,e as pa,f as pe,P as gt,m as mt,g as xa,h as ga,i as ma,j as ft,k as xe,L as fa,l as ya,n as rt,o as ot,W as ba,p as va,q as Ca,A as wa,r as ja,s as ka,t as $a,u as Sa,v as Ma,w as Ta,x as Pa,y as za,z as Aa,D as Ia,E as qa,F as Ra,G as _a,I as Ba,J as Ea,K as Se,N as Wa,O as Fa,Q as La,R as Na,U as ct,V as Qa,Y as Ka,Z as Ua,_ as Ha}from"./CollectionCarousel-CEeV8t-a.js";import{u as Oa}from"./useManaRate-x5FL9eAV.js";import{r as Va}from"./mana-rate-cSpFrGml.js";import{i as Da,j as Ga,f as Ja,n as Ya,h as Xa,A as Za}from"./authorizations-BVmXaQeu.js";import{b as Me}from"./buy-Ccaxv3lt.js";import{b as es,w as ts,S as as,G as ss}from"./buy-gasless-UjTpzokh.js";import{u as ns,M as is,R as de,r as rs,c as os}from"./useCreditPacks-puL7tAtr.js";import{i as cs,a as ls}from"./errors-BfJQR72Z.js";import{E as ds}from"./ErrorNotice-BStoa2Qo.js";import{u as lt}from"./mana-convert-cZR9DTGN.js";import"./sentry-B35L1FdR.js";import"./dcl-schemas-BICTSpB5.js";import"./ethers-CXBJm_wN.js";import"./intl-CBcMB1D2.js";import"./trade-encoding-CJDVWYcF.js";import"./sendMetaTransaction-CdI6QA-v.js";const{colors:D,radius:us}=ee,hs=i.div`
2
- display: flex;
3
- align-items: center;
4
- justify-content: center;
5
- gap: 8px;
6
- width: 100%;
7
- `,ps=i.span`
8
- font-size: 16px;
9
- line-height: 22px;
10
- color: ${D.text2};
11
- text-transform: capitalize;
12
- white-space: nowrap;
13
- `,xs=i.div`
14
- display: flex;
15
- flex-direction: column;
16
- gap: 8px;
17
- /* The list is the modal's elastic region: inside a viewport-capped card it gives up height first, so
18
- the pack picker, total and Cancel/Buy below it stay on screen without scrolling. The floor is an
19
- explicit ~one row because a scroll container's automatic minimum size is zero — it would otherwise
20
- collapse to nothing on a short screen. */
21
- min-height: 120px;
22
- max-height: 360px;
23
- overflow-y: auto;
24
- width: 100%;
25
- scrollbar-width: thin;
26
- scrollbar-color: #a2a2a2 ${D.media};
27
-
28
- &::-webkit-scrollbar {
29
- width: 8px;
30
- }
31
- &::-webkit-scrollbar-track {
32
- background: ${D.media};
33
- border-radius: 10px;
34
- }
35
- &::-webkit-scrollbar-thumb {
36
- background: #a2a2a2;
37
- border-radius: ${us.btn};
38
- }
39
- `,gs=i.span`
40
- margin-left: 8px;
41
- font-size: 13px;
42
- font-weight: 600;
43
- color: ${D.muted};
44
- `,ms=i.div`
45
- display: flex;
46
- align-items: center;
47
- justify-content: space-between;
48
- gap: 12px;
49
- padding: 0 0 12px;
50
- font-size: 14px;
51
- color: ${D.muted};
52
-
53
- & strong {
54
- display: inline-flex;
55
- align-items: center;
56
- gap: 6px;
57
- font-size: 20px;
58
- font-weight: 700;
59
- color: ${D.text};
60
- }
61
- `,fs="https://cdn.decentraland.org/@dcl/shop/0.1.0-30535358248.commit-2722a7f/assets/buy-error-22UunaPC.png";function ys(c){const{phase:d,balanceCredits:k,onClose:T}=c,_=d==="processing",W=d==="error"?a("cartCheckout.errorTitle"):d==="nofunds"?a("cartCheckout.titleNoFunds"):d==="choose"?a("buyModal.choosePayment"):a("cartCheckout.titleBuy"),F=d==="processing";return e.jsxs(sa,{role:"dialog","aria-modal":"true","aria-label":a("cartCheckout.dialogAria"),children:[e.jsx(na,{onClick:_?void 0:T,"aria-hidden":!0}),e.jsxs(ia,{"data-tall":F||void 0,children:[e.jsxs(ra,{children:[e.jsxs(oa,{children:[e.jsx(ca,{children:W}),!_&&e.jsx(la,{onClick:T,"aria-label":a("buyModal.close"),children:e.jsx(da,{})})]}),e.jsxs(ua,{children:[e.jsx(ha,{children:d==="nofunds"?a("buyModal.dclBalance"):a("buyModal.myCreditsBalance")}),e.jsx(it,{}),e.jsx(pa,{children:Z(k)})]})]}),d==="choose"&&e.jsxs(pe,{children:[e.jsxs(ms,{children:[e.jsx("span",{children:a("cart.purchaseSummary")}),e.jsxs("strong",{children:[e.jsx(it,{}),Z(c.totalCredits??0)]})]}),e.jsx(gt,{options:c.options??[],totalCents:c.totalCents??0,onPay:c.onPay??(()=>{}),rateNote:(()=>{const z=mt(c.totalCents??0,c.totalManaWei??0n);return z!=null?a("buyModal.manaRate",{mana:z.toLocaleString("en",{maximumFractionDigits:2})}):null})()})]}),d==="processing"&&e.jsx(bs,{stage:c.stage??"reserving",step:c.step??1,total:c.total??1,isSelfCustody:!!c.isSelfCustody}),d==="nofunds"&&e.jsx(vs,{lines:c.lines??[],shortfallCredits:c.shortfallCredits??0,packs:c.packs??[],selectedPack:c.selectedPack??"",onSelectPack:c.onSelectPack??(()=>{}),onBuyPacks:c.onBuyPacks??(()=>{}),onCancel:T}),d==="error"&&e.jsxs(pe,{children:[e.jsxs(xa,{"data-testid":"buy-error",children:[e.jsx(ga,{src:fs,alt:"",width:64,height:80}),e.jsxs(ma,{children:[e.jsx("b",{children:a("cartCheckout.errorHeadline")})," ",a("cartCheckout.errorBody")]})]}),e.jsxs(ft,{children:[e.jsx(xe,{"data-variant":"outline",onClick:T,children:a("buyModal.cancel")}),e.jsx(xe,{"data-variant":"purple",onClick:c.onRetry??T,children:a("cartCheckout.tryAgain")})]})]})]})]})}function bs({stage:c,step:d,total:k,isSelfCustody:T}){const _=c==="reserving",W=k>0?Math.min(100,Math.round(d/k*100)):0,F=c==="awaiting-signature"?T?a("buyModal.confirmToContinue"):a("buyModal.completingTransaction"):c==="settling"?a("buyModal.completingTransaction"):a("cartCheckout.preparing");return e.jsxs(pe,{"data-processing":!0,children:[e.jsx(fa,{src:Qt,alt:"",width:61,height:61}),e.jsx(ya,{children:F}),_?e.jsxs(hs,{children:[e.jsx(rt,{"aria-hidden":!0,children:e.jsx(ot,{"data-step":!0,style:{width:`${W}%`}})}),k>1?e.jsxs(ps,{children:[d,"/",k]}):null]}):e.jsx(rt,{"aria-hidden":!0,children:e.jsx(ot,{})})]})}function vs({lines:c,shortfallCredits:d,packs:k,selectedPack:T,onSelectPack:_,onBuyPacks:W,onCancel:F}){const z=k.find(n=>n.id===T),me=c.reduce((n,I)=>n+(I.quantity??1),0);return e.jsxs(pe,{children:[e.jsxs(ba,{"data-testid":"nofunds-warning",children:[e.jsx(va,{}),e.jsxs(Ca,{children:[e.jsx("b",{children:a("buyModal.insufficientFunds")})," ",a("buyModal.warningNeedToBuy")," ",e.jsx("b",{children:a("buyModal.warningCreditsAmount",{count:Math.max(0,d)})})," ",a("buyModal.warningToPurchase",{count:me})]})]}),e.jsx(xs,{children:c.map(n=>{const I=n.quantity??1;return e.jsxs(wa,{children:[e.jsx(ja,{children:n.item.thumbnail?e.jsx("img",{src:n.item.thumbnail,alt:""}):null}),e.jsxs(ka,{children:[e.jsxs("div",{children:[e.jsxs($a,{title:n.item.name,children:[n.item.name||a("buyModal.itemFallback"),I>1?e.jsx(gs,{children:a("cartCheckout.qty",{count:I})}):null]}),n.item.creator?e.jsx(Sa,{address:n.item.creator}):null]}),e.jsxs(Ma,{children:[e.jsx(Ta,{}),e.jsx("span",{children:Z(n.priceCredits*I)})]})]})]},n.item.id)})}),e.jsx(Pa,{children:k.map(n=>{const I=n.id===T;return e.jsxs(za,{"data-testid":"credit-pack","data-on":I||void 0,onClick:()=>_(n.id),children:[e.jsx(Aa,{}),e.jsx(Ia,{children:Z(n.credits)}),e.jsxs(qa,{children:["($",n.usd.toFixed(2),")"]})]},n.id)})}),e.jsxs(Ra,{children:[e.jsxs(_a,{children:[e.jsx(Ba,{}),e.jsx("span",{children:Z((z==null?void 0:z.credits)??0)})]}),e.jsxs(Ea,{children:["$",((z==null?void 0:z.usd)??0).toFixed(2)]})]}),e.jsxs(ft,{children:[e.jsx(xe,{"data-variant":"outline",onClick:F,children:a("buyModal.cancel")}),e.jsx(xe,{"data-variant":"gradient",onClick:W,children:a("buyModal.buy")})]})]})}const{colors:o,gradients:yt,radius:K}=ee,bt="@media (max-width: 1080px)",S="@media (max-width: 880px)",dt=i.div`
62
- max-width: 1510px;
63
- margin: 0 auto;
64
-
65
- ${S} {
66
- padding-bottom: 188px; /* room for the fixed summary bar */
67
- }
68
- `,ut=i.button`
69
- display: inline-flex;
70
- align-items: center;
71
- gap: 6px;
72
- margin: 0 0 16px;
73
- padding: 0;
74
- border: 0;
75
- background: none;
76
- color: ${o.text2};
77
- font-size: 14px;
78
- font-weight: 600;
79
- letter-spacing: 0.02em;
80
- text-transform: uppercase;
81
- cursor: pointer;
82
- transition: color 0.15s ease;
83
-
84
- &:hover {
85
- color: ${o.accent};
86
- }
87
- & .ico {
88
- width: 18px;
89
- height: 18px;
90
- }
91
-
92
- ${S} {
93
- display: none;
94
- }
95
- `,Cs=i.div`
96
- display: grid;
97
- grid-template-columns: minmax(0, 1fr) 615px;
98
- gap: 24px;
99
- align-items: start;
100
-
101
- ${bt} {
102
- grid-template-columns: 1fr;
103
- }
104
- `,ht=i.div`
105
- position: relative;
106
- `,ws=i.div`
107
- min-width: 0;
108
- display: flex;
109
- flex-direction: column;
110
- gap: 12px;
111
- `,js=i.div`
112
- display: flex;
113
- align-items: center;
114
- justify-content: space-between;
115
- gap: 12px;
116
- background: ${o.white};
117
- border-radius: 16px;
118
- padding: 12px 12px 12px 24px;
119
-
120
- ${S} {
121
- gap: 8px;
122
- padding: 12px;
123
- }
124
- `,vt=i.section`
125
- min-width: 0;
126
- background: ${o.white};
127
- border-radius: 16px;
128
- padding: 24px;
129
-
130
- ${S} {
131
- padding: 16px;
132
- }
133
- `,ks=i(vt)`
134
- display: flex;
135
- flex-direction: column;
136
- align-items: center;
137
- justify-content: center;
138
- gap: 24px;
139
- min-height: 420px;
140
- padding: 48px 16px;
141
- text-align: center;
142
- color: ${o.text};
143
-
144
- ${ee.media.maxWidth("mobile")} {
145
- min-height: 320px;
146
- padding: 32px 16px;
147
- }
148
- `,$s=i.div`
149
- display: flex;
150
- flex-direction: column;
151
- align-items: center;
152
- gap: 12px;
153
- padding-bottom: 16px;
154
- `,Ss=i.p`
155
- margin: 0;
156
- font-size: 24px;
157
- font-weight: 700;
158
- line-height: 1.6;
159
-
160
- ${ee.media.maxWidth("mobile")} {
161
- font-size: 20px;
162
- }
163
- `,Ms=i.p`
164
- margin: 0;
165
- font-size: 20px;
166
- font-weight: 400;
167
- line-height: 1.6;
168
-
169
- ${ee.media.maxWidth("mobile")} {
170
- font-size: 16px;
171
- }
172
- `,Ts=i(ge)`
173
- display: inline-flex;
174
- align-items: center;
175
- justify-content: center;
176
- width: 310px;
177
- max-width: 100%;
178
- height: 56px;
179
- padding: 0 12px;
180
- border-radius: ${K.card};
181
- background: ${o.accent};
182
- color: ${o.softWhite};
183
- font-size: 15px;
184
- font-weight: 600;
185
- line-height: 24px;
186
- letter-spacing: 0.46px;
187
- text-transform: uppercase;
188
- text-decoration: none;
189
- transition: background 0.15s ease;
190
-
191
- &:hover {
192
- background: ${o.accentHover};
193
- }
194
- &:focus-visible {
195
- outline: 2px solid ${o.accent};
196
- outline-offset: 2px;
197
- }
198
- `,Ps=i.button`
199
- display: none;
200
-
201
- ${S} {
202
- display: inline-flex;
203
- align-items: center;
204
- flex-shrink: 0;
205
- border: 0;
206
- background: none;
207
- padding: 0;
208
- color: ${o.text};
209
- cursor: pointer;
210
-
211
- & .ico {
212
- width: 20px;
213
- height: 20px;
214
- }
215
- }
216
- `,zs=i.h1`
217
- margin: 0;
218
- font-size: 14px;
219
- font-weight: 600;
220
- line-height: 1.57;
221
- color: ${o.text};
222
-
223
- ${S} {
224
- flex: 1;
225
- min-width: 0;
226
- font-size: 16px;
227
- }
228
- `,As=i.button`
229
- display: inline-flex;
230
- align-items: center;
231
- justify-content: center;
232
- gap: 8px;
233
- height: 40px;
234
- padding: 0 12px;
235
- border: 2px solid transparent;
236
- border-radius: ${K.btn};
237
- background:
238
- linear-gradient(${o.white}, ${o.white}) padding-box,
239
- ${yt.amethyst} border-box;
240
- color: ${o.accent};
241
- font-size: 13px;
242
- font-weight: 600;
243
- line-height: 24px;
244
- letter-spacing: 0.46px;
245
- text-transform: uppercase;
246
- white-space: nowrap;
247
- cursor: pointer;
248
- transition:
249
- box-shadow 0.15s ease,
250
- filter 0.15s ease;
251
-
252
- &:hover:not(:disabled) {
253
- box-shadow: 0 0 8px 0 rgba(165, 36, 179, 0.35);
254
- }
255
- &:active:not(:disabled) {
256
- filter: brightness(0.97);
257
- }
258
- &:disabled {
259
- opacity: 0.55;
260
- cursor: default;
261
- }
262
-
263
- ${S} {
264
- height: 36px;
265
- padding: 0 10px;
266
- font-size: 12px;
267
- }
268
- `,Is=i.div`
269
- display: flex;
270
- flex-direction: column;
271
- gap: 24px;
272
- `,qs=i.div`
273
- position: relative;
274
- display: flex;
275
- align-items: stretch;
276
- gap: 12px;
277
- background: ${o.white};
278
- border: 1px solid ${o.gray4};
279
- border-radius: ${K.card};
280
- overflow: hidden;
281
-
282
- &[data-unavailable] [data-thumb] {
283
- opacity: 0.5;
284
- }
285
- &[data-unavailable] [data-check] {
286
- display: none;
287
- }
288
- &[data-unavailable] [data-desc] {
289
- opacity: 0.7;
290
- }
291
- `,Rs=i.div`
292
- position: relative;
293
- flex-shrink: 0;
294
- width: 137.5px;
295
- height: 137px;
296
- background: ${o.media};
297
- border-radius: ${K.card};
298
- display: grid;
299
- place-items: center;
300
- overflow: hidden;
301
-
302
- & img {
303
- width: 83%;
304
- height: 83%;
305
- object-fit: contain;
306
- filter: drop-shadow(0.56px 2.25px 2.8px rgba(0, 0, 0, 0.1));
307
- }
308
-
309
- ${S} {
310
- width: 120px;
311
- height: 120px;
312
- }
313
- `,_s=i(ge)`
314
- position: absolute;
315
- inset: 0;
316
- display: grid;
317
- place-items: center;
318
- `,Bs=i.span`
319
- position: absolute;
320
- top: 7.5px;
321
- left: 7.5px;
322
- width: 20px;
323
- height: 20px;
324
- border-radius: 50%;
325
- background: #34ce77;
326
- display: grid;
327
- place-items: center;
328
- `,Es=i.div`
329
- flex: 1;
330
- min-width: 0;
331
- display: flex;
332
- flex-direction: column;
333
- justify-content: space-between;
334
- gap: 8px;
335
- padding: 16px 8px;
336
-
337
- ${S} {
338
- padding: 12px 4px 12px 0;
339
- }
340
- `,Ws=i.div`
341
- display: flex;
342
- flex-direction: column;
343
- gap: 4px;
344
- min-width: 0;
345
- padding-right: 64px; /* clear the top-right favourite + remove group */
346
- `,Ct=ze`
347
- display: block;
348
- font-size: 16px;
349
- font-weight: 600;
350
- line-height: 1.2;
351
- color: ${o.text};
352
- text-decoration: none;
353
- overflow: hidden;
354
- text-overflow: ellipsis;
355
- white-space: nowrap;
356
-
357
- a&:hover {
358
- color: ${o.accent};
359
- }
360
-
361
- ${S} {
362
- white-space: normal;
363
- display: -webkit-box;
364
- -webkit-line-clamp: 2;
365
- line-clamp: 2;
366
- -webkit-box-orient: vertical;
367
- }
368
- `,Fs=i.div`
369
- ${Ct};
370
- `,Ls=i(ge)`
371
- ${Ct};
372
- `,Ns=i(Kt)`
373
- font-size: 10px;
374
- line-height: 1.43;
375
- color: ${o.muted};
376
-
377
- & [data-avatar] {
378
- display: none;
379
- }
380
- & [data-testid='creator-name'] {
381
- font-size: 10px;
382
- line-height: 1.43;
383
- }
384
- `,Qs=i.div`
385
- display: flex;
386
- align-items: center;
387
- justify-content: space-between;
388
- gap: 12px;
389
- padding-right: 8px;
390
- `,Ks=i.div`
391
- display: inline-flex;
392
- align-items: center;
393
- gap: 8px;
394
- padding: 6px;
395
- border: 0.5px solid ${o.muted2};
396
- border-radius: ${K.pill};
397
- `,pt=i.button`
398
- display: grid;
399
- place-items: center;
400
- width: 16px;
401
- height: 16px;
402
- padding: 0;
403
- border: 0;
404
- background: none;
405
- color: ${o.text};
406
- cursor: pointer;
407
-
408
- &:disabled {
409
- color: ${o.muted2};
410
- cursor: default;
411
- }
412
- `,Us=i.span`
413
- min-width: 12px;
414
- font-size: 14px;
415
- font-weight: 500;
416
- line-height: 1.2;
417
- color: ${o.text};
418
- text-align: center;
419
- `,Hs=i.div`
420
- display: inline-flex;
421
- align-items: center;
422
- gap: 4px;
423
- /* Always right-aligned: with a stepper present space-between handles it; for secondary/unique lines
424
- (no stepper) the auto margin keeps the lone price on the right instead of falling to the left. */
425
- margin-left: auto;
426
- font-size: 24px;
427
- font-weight: 600;
428
- color: ${o.text2};
429
-
430
- ${S} {
431
- font-size: 20px;
432
- }
433
- `,Os=i(xt)`
434
- width: 24px;
435
- height: 24px;
436
- background: ${o.text};
437
-
438
- ${S} {
439
- width: 20px;
440
- height: 20px;
441
- }
442
- `,Vs=i.span`
443
- margin-left: 6px;
444
- font-size: 14px;
445
- font-weight: 500;
446
- color: ${o.muted};
447
- text-decoration: line-through;
448
- `,Ds=i.div`
449
- position: absolute;
450
- top: 9px;
451
- right: 7px;
452
- display: flex;
453
- align-items: flex-start;
454
- gap: 12px;
455
- `,Gs=i.span`
456
- display: inline-flex;
457
- align-items: center;
458
- gap: 4px;
459
- font-size: 12px;
460
- font-weight: 600;
461
- line-height: 1;
462
- text-transform: uppercase;
463
- color: ${o.text2};
464
- `,Js=i(R)`
465
- color: #f48221;
466
- `,Ys=i(ge)`
467
- font-size: 12px;
468
- font-weight: 600;
469
- line-height: 24px;
470
- letter-spacing: 0.46px;
471
- text-transform: uppercase;
472
- text-decoration: underline;
473
- color: ${o.accent};
474
-
475
- &:hover {
476
- color: ${o.accentHover};
477
- }
478
- &:focus-visible {
479
- outline: 2px solid ${o.accent};
480
- outline-offset: 2px;
481
- }
482
- `,Xs=i.span`
483
- align-self: flex-start;
484
- display: inline-flex;
485
- align-items: center;
486
- gap: 4px;
487
- padding: 2px 4px;
488
- border-radius: ${K.chip};
489
- background: #f4e9ff;
490
- font-size: 10px;
491
- font-weight: 400;
492
- line-height: 14px;
493
- color: ${o.text};
494
- `,Zs=i(R)`
495
- width: 11.31px;
496
- height: 10.94px;
497
- background: ${o.text};
498
- `,wt=ze`
499
- display: grid;
500
- place-items: center;
501
- width: 24px;
502
- height: 24px;
503
- padding: 0;
504
- border: 0;
505
- background: none;
506
- color: ${o.muted};
507
- cursor: pointer;
508
- transition: color 0.12s ease;
509
-
510
- &:disabled {
511
- opacity: 0.5;
512
- cursor: default;
513
- }
514
- `,en=i.button`
515
- ${wt};
516
-
517
- &:hover:not(:disabled) {
518
- color: ${o.text};
519
- }
520
- &[data-on] {
521
- color: ${o.dclRed};
522
- }
523
- `,tn=i.button`
524
- ${wt};
525
-
526
- &:hover:not(:disabled) {
527
- color: ${o.dclRed};
528
- }
529
- `,an=i.div`
530
- display: flex;
531
- gap: 20px;
532
- margin-top: 16px;
533
-
534
- & .link {
535
- font-size: 13px;
536
- color: ${o.muted};
537
- font-weight: 600;
538
- }
539
- & .link:hover:not(:disabled) {
540
- color: ${o.text};
541
- }
542
- `,sn=i.aside`
543
- position: sticky;
544
- top: 172px;
545
- display: flex;
546
- flex-direction: column;
547
- background: ${o.white};
548
- box-shadow: 0 1px 3px rgba(22, 21, 24, 0.06);
549
- border-radius: 16px;
550
- padding: 16px;
551
-
552
- ${bt} {
553
- position: static;
554
- }
555
- ${S} {
556
- position: fixed;
557
- left: 0;
558
- right: 0;
559
- top: auto;
560
- bottom: 0;
561
- z-index: 30;
562
- border: 0;
563
- border-radius: 16px 16px 0 0;
564
- box-shadow: 0 -4px 20px rgba(22, 21, 24, 0.12);
565
- }
566
- `,nn=i.h2`
567
- margin: 0 0 24px;
568
- padding-bottom: 16px;
569
- border-bottom: 1px solid ${o.gray4};
570
- font-size: 24px;
571
- font-weight: 600;
572
- color: ${o.text};
573
-
574
- ${S} {
575
- margin-bottom: 12px;
576
- padding-bottom: 12px;
577
- }
578
- `,rn=i.div`
579
- display: flex;
580
- flex-direction: column;
581
- gap: 12px;
582
- `,on=i.div`
583
- display: flex;
584
- align-items: flex-start;
585
- justify-content: space-between;
586
- gap: 12px;
587
- `,cn=i.span`
588
- font-size: 14px;
589
- font-weight: 600;
590
- line-height: 1.57;
591
- color: ${o.muted1};
592
- `,ln=i.span`
593
- display: inline-flex;
594
- align-items: center;
595
- gap: 8px;
596
- font-size: 24px;
597
- font-weight: 700;
598
- color: ${o.text};
599
- `,dn=i.span`
600
- display: flex;
601
- flex-direction: column;
602
- align-items: flex-end;
603
- justify-content: center;
604
- gap: 4px;
605
- `,un=i.span`
606
- font-size: 12px;
607
- font-weight: 400;
608
- line-height: 1;
609
- color: ${o.muted};
610
- `,hn=i(xt)`
611
- width: 30px;
612
- height: 30px;
613
- background: ${o.text};
614
- -webkit-mask-size: 24px 24px;
615
- mask-size: 24px 24px;
616
- -webkit-mask-position: left center;
617
- mask-position: left center;
618
- `,pn=i.button`
619
- width: 100%;
620
- height: 56px;
621
- border: 0;
622
- border-radius: ${K.btn};
623
- background: ${yt.amethyst};
624
- color: ${o.softWhite};
625
- font-size: 15px;
626
- font-weight: 600;
627
- letter-spacing: 0.046em;
628
- text-transform: uppercase;
629
- cursor: pointer;
630
- transition:
631
- background 0.15s ease,
632
- filter 0.15s ease;
633
-
634
- &:hover:not(:disabled) {
635
- background: ${o.accent};
636
- }
637
- &:active:not(:disabled) {
638
- filter: brightness(0.95);
639
- }
640
- &:disabled {
641
- opacity: 0.6;
642
- cursor: default;
643
- }
644
- `,jt=ze`
645
- margin: 0;
646
- font-size: 13px;
647
- `,ue=i.p`
648
- ${jt};
649
- `,xn=i(ds)`
650
- ${jt};
651
- `,gn=i.div`
652
- position: relative;
653
- margin-top: 48px;
654
- /* The whole gap from the top of the cross-sell to the "You might also like" heading — the shared
655
- carousel's own top margin is zeroed below so this padding isn't stacked on top of it. */
656
- padding: 47px 0 24px;
657
-
658
- &::before {
659
- content: '';
660
- position: absolute;
661
- top: 0;
662
- bottom: -80px; /* eat .page's bottom padding so the white reaches the footer */
663
- left: 50%;
664
- width: 100vw;
665
- transform: translateX(-50%);
666
- background: ${o.bg};
667
- z-index: 0;
668
- }
669
- & > * {
670
- position: relative;
671
- z-index: 1;
672
- }
673
- & section {
674
- margin-top: 0;
675
- }
676
- `;function Te(c){if(cs(c))return a("errors.rejected");const d=(c.message??"").toLowerCase();return d.includes("insufficient")?a("cart.error.insufficient",{currency:ea.name}):d.includes("no active listing")||d.includes("your own listing")?a("cart.error.listingChanged"):a("marketCheckout.error.generic")}const mn=12e4;function fn(c){const d=[];return c.unavailable.length&&d.push(a("cart.drop.unavailable",{count:c.unavailable.length})),c.own.length&&d.push(a("cart.drop.own",{count:c.own.length})),a("cart.drop.removed",{items:d.join(` ${a("cart.drop.and")} `)})}const Pe=c=>c.reduce((d,k)=>d+k.priceCredits*k.quantity,0),he=c=>c.flatMap(d=>Array.from({length:d.quantity},()=>({...d,quantity:1})));function Bn(){Ut({title:a("nav.cart"),noindex:!0});const c=q(t=>t.items),d=q(t=>t.remove),k=q(t=>t.increment),T=q(t=>t.decrement),_=q(t=>t.clear),W=q(t=>t.restore),F=q(t=>t.setFittingOpen),z=Ze(t=>t.items),me=Ze(t=>t.toggle),{session:n,signIn:I}=Ht(),te=ns().packs.slice(0,is);$.useEffect(()=>(document.body.classList.add("shop-cart-bg"),()=>document.body.classList.remove("shop-cart-bg")),[]);const kt=c.some(t=>t.category!=="emote"),{data:fe}=Ot({queryKey:["upsell-listings"],queryFn:()=>aa({first:40}),staleTime:6e4}),{data:C}=Vt(n),m=Dt(),U=Lt(),{state:L}=Nt(),[$t,G]=$.useState(null),[Ae,ae]=$.useState(null),[St,A]=$.useState(!1),[P,N]=$.useState(null),Ie=$.useRef(0),[p,b]=$.useState(null),{data:J}=Gt(n),{data:Y}=Oa(!0),[ye,qe]=$.useState(""),X=$.useRef(null),Re=Jt(c),_e=t=>et(Re[t.id]),be=c.filter(_e),ve=c.length>0&&be.length===0,Mt=be.reduce((t,s)=>t+s.priceCredits*s.quantity,0),Tt=c.reduce((t,s)=>t+s.quantity,0),Pt=be.reduce((t,s)=>t+s.quantity,0),Be=P?P.liveTotalCredits:Mt,zt=new Set(c.map(t=>t.id)),Ee=((fe==null?void 0:fe.items)??[]).filter(t=>!zt.has(t.id)).slice(0,12),At=new Map(P==null?void 0:P.buyable.map(t=>[t.item.id,t])),se=(C==null?void 0:C.credits)??0,ne=Be*10,We=Y?lt(ne,Y):0n,ie=Se({priceCents:ne,priceManaWei:We,balanceCents:(C==null?void 0:C.balanceCents)??0,manaBalanceWei:J??0n}),Fe=mt(ne,We),Le=Fe!=null?a("buyModal.manaRate",{mana:Fe.toLocaleString("en",{maximumFractionDigits:2})}):null,It=Zt;function re(t){t(),N(null),ae(null),G(null)}function qt(){b(null),A(!1)}function Ne(t){const s=Pe(t),l=Math.max(0,s-se),r=te.find(u=>u.credits>=l)??te[te.length-1];qe(r.id),Q("Shop Buy Credits Prompted",{from:"cart_checkout",credits_needed:s,credits_balance:se,shortfall:l}),b({phase:"nofunds",lines:t.map(u=>({item:u.item,priceCredits:u.priceCredits,quantity:u.quantity})),shortfall:l}),A(!1)}async function Ce(t){if(!n||t.length===0)return;const s=he(t),l=s.map(g=>({...g.item,priceCredits:g.priceCredits})),r=t.map(g=>({...g.item,priceCredits:g.priceCredits,quantity:g.quantity})),u=[];let h="authorize",f=!1;b({phase:"processing",stage:"reserving",step:1,total:s.length});try{const g=[];for(let j=0;j<s.length;j++){const v=s[j];b({phase:"processing",stage:"reserving",step:j+1,total:s.length});try{const{credit:w,maxCreditedValue:O}=await st(n.identity,v.usdCents,v.trade.id);u.push(w.id),g.push({trade:v.trade,credits:[w],maxCreditedValue:O})}catch(w){if(ls(w)){if(u.length){try{await je(n.identity,u)}catch(O){V(O,{flow:"cart_checkout",step:"release"})}m.invalidateQueries({queryKey:["usd-balance"]})}Ne(t);return}throw w}}h="submit";const M=()=>b({phase:"processing",stage:"settling",step:s.length,total:s.length});b({phase:"processing",stage:"awaiting-signature",step:s.length,total:s.length});let y=[];if(Da())try{y=await es({purchases:g,buyer:n.address,signer:n.signer,onSigned:M});const v=(await Promise.allSettled(y.map(w=>ts(w)))).flatMap(w=>w.status==="rejected"?[w.reason]:[]);if(v.length&&!v.some(w=>w instanceof as))throw v[0];f=!0}catch(j){if(!(j instanceof ss))throw j;y=await Me({purchases:g,buyer:n.address,signer:n.signer,onSigned:M})}else y=await Me({purchases:g,buyer:n.address,signer:n.signer});t.forEach(j=>d(j.item.id)),N(null),Q("Shop Completed Purchase",{...ke(l),payment_type:"credits",no_crypto_step:f,transaction_hash:y[0]??null}),Qa(m);const x=X.current;X.current=null,b(null),A(!1);const E={items:r,txHash:y[0]??void 0,settled:!0,...x?{creditsAdded:x}:{}};U("/success",{state:E,replace:!0})}catch(g){if(ce(g)||V(g,{flow:"cart_checkout",step:h,cart_size:t.length}),Q(ce(g)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:h,error_code:nt(g),value_usd:tt(l.reduce((M,y)=>M+y.priceCredits,0)),cart_size:s.length}),u.length){try{await je(n.identity,u)}catch(M){V(M,{flow:"cart_checkout",step:"release"})}m.invalidateQueries({queryKey:["usd-balance"]})}b({phase:"error",message:Te(g)})}}function Qe(t,s){m.invalidateQueries({queryKey:["usd-balance"]}),m.invalidateQueries({queryKey:["detail-trade"]}),m.invalidateQueries({queryKey:["shop-item"]}),m.invalidateQueries({queryKey:["owned-token"]}),m.invalidateQueries({queryKey:["public-token"]}),m.invalidateQueries({queryKey:["item-resales"]}),m.invalidateQueries({queryKey:["shop-items"]}),m.invalidateQueries({queryKey:["catalog-items"]}),m.invalidateQueries({queryKey:["my-assets"]}),m.invalidateQueries({queryKey:["purchases"]}),m.invalidateQueries({queryKey:["owned-item-count"]}),m.invalidateQueries({queryKey:["overview-listings"]}),m.invalidateQueries({queryKey:["upsell-listings"]});const l=X.current;X.current=null,b(null),A(!1);const r={items:t,txHash:s[0]??void 0,settled:!0,...l?{creditsAdded:l}:{}};U("/success",{state:r,replace:!0})}function Ke(t,s){ce(t)||V(t,{flow:s,step:"submit"}),Q(ce(t)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:"submit",error_code:nt(t)}),b({phase:"error",message:Te(t)}),A(!1)}async function Rt(t,s){const l=le($e.MANAToken,s),r=le($e.CreditsManager,s);await Xa({auth:{kind:Za.Allowance,contractAddress:l.address,spenderAddress:r.address,chainId:s},signer:t})}async function Ue(){if(Y)return Y;try{return await m.fetchQuery({queryKey:["mana-rate",at.chainId],queryFn:()=>Va(at.chainId),staleTime:6e4})}catch{return}}async function _t(t){const s=he(t).reduce((h,f)=>h+f.usdCents,0),r=(J??0n)>0n?await Ue():Y,u=r?lt(s,r):0n;return{totalCents:s,manaWei:u}}async function He(t,s){const l=Pe(t),{totalCents:r,manaWei:u}=await _t(t),h=Se({priceCents:r,priceManaWei:u,balanceCents:(C==null?void 0:C.balanceCents)??0,manaBalanceWei:J??0n});if(s&&h.options.some(f=>f.method===s)){if(s==="credits"){Ce(t);return}const{spender:f,chainId:g}=Oe(s,t);await Ve(f,g,()=>s==="mana"?void De(t):void Ge(t,r,u));return}if(h.options.some(f=>f.method==="mana"||f.method==="combined")){b({phase:"choose",lines:t,totalCents:r,manaWei:u}),A(!1);return}if(C!=null&&C.credits<l){Ne(t);return}Ce(t)}function Bt(t){return Se({priceCents:t.totalCents,priceManaWei:t.manaWei,balanceCents:(C==null?void 0:C.balanceCents)??0,manaBalanceWei:J??0n})}const[we,oe]=$.useState(null);function Oe(t,s){const l=s[0].trade;return{spender:t==="mana"?le(ta(l.contract),l.chainId).address:le($e.CreditsManager,l.chainId).address,chainId:l.chainId}}async function Ve(t,s,l){const r=Ga(s,t),u=n?await Ja(r,n.address).catch(()=>!0):!0;if(Ya(n==null?void 0:n.providerType,u)){A(!1),oe({auth:r,run:l});return}l()}function Et(t){if((p==null?void 0:p.phase)!=="choose")return;const{lines:s,totalCents:l,manaWei:r}=p;if(t==="credits"){Ce(s);return}const{spender:u,chainId:h}=Oe(t,s);Ve(u,h,()=>t==="mana"?void De(s):void Ge(s,l,r))}async function De(t){if(!n||t.length===0)return;const s=he(t),l=s.map(h=>({...h.item,priceCredits:h.priceCredits})),r=t.map(h=>({...h.item,priceCredits:h.priceCredits,quantity:h.quantity})),u=()=>b({phase:"processing",stage:"settling",step:s.length,total:s.length});b({phase:"processing",stage:"awaiting-signature",step:s.length,total:s.length});try{const h=await Ka({trades:s.map(f=>f.trade),buyer:n.address,signer:n.signer,onSigned:u});t.forEach(f=>d(f.item.id)),N(null),Q("Shop Completed Purchase",{...ke(l),payment_type:"mana",transaction_hash:h[0]??null}),m.invalidateQueries({queryKey:["mana-balance"]}),Qe(r,h)}catch(h){Ke(h,"buy_cart_mana")}}async function Ge(t,s,l){if(!n||t.length===0)return;const r=he(t),u=r.map(x=>({...x.item,priceCredits:x.priceCredits})),h=t.map(x=>({...x.item,priceCredits:x.priceCredits,quantity:x.quantity})),f=Ua(r.map(x=>x.usdCents),(C==null?void 0:C.balanceCents)??0),g=f.reduce((x,E)=>x+E,0),M=Ha(Math.max(0,s-g),s,l),y=[];b({phase:"processing",stage:"reserving",step:1,total:r.length});try{const x=[];for(let v=0;v<r.length;v++){const w=f[v];if(w<=0)continue;b({phase:"processing",stage:"reserving",step:v+1,total:r.length});const{credit:O,maxCreditedValue:Ft}=await st(n.identity,w,r[v].trade.id);y.push(O.id),x.push({trade:r[v].trade,credits:[O],maxCreditedValue:Ft})}r.forEach((v,w)=>{f[w]<=0&&x.push({trade:v.trade,credits:[],maxCreditedValue:"0"})}),x[0]={...x[0],maxCreditedValue:(BigInt(x[0].maxCreditedValue)+M).toString()},await Rt(n.signer,r[0].trade.chainId);const E=()=>b({phase:"processing",stage:"settling",step:r.length,total:r.length});b({phase:"processing",stage:"awaiting-signature",step:r.length,total:r.length});const j=await Me({purchases:x,buyer:n.address,signer:n.signer,onSigned:E});t.forEach(v=>d(v.item.id)),N(null),Q("Shop Completed Purchase",{...ke(u),payment_type:"credits_and_mana",transaction_hash:j[0]??null}),m.invalidateQueries({queryKey:["mana-balance"]}),Qe(h,j)}catch(x){y.length&&(je(n.identity,y).catch(()=>{}),m.invalidateQueries({queryKey:["usd-balance"]})),Ke(x,"buy_cart_combined")}}async function H(t){if(!n){ct({type:"cart-checkout"}),I();return}const s=q.getState().items.filter(_e);if(s.length===0)return;G(null),ae(null),A(!0);const l=s.reduce((r,u)=>r+u.priceCredits*u.quantity,0);Q("Shop Started Checkout",{cart_size:s.length,cart_value_credits:l,cart_value_usd:tt(l),has_sufficient_credits:se>=l});try{const r=await rs(s,n.address,It,await Ue()),u=[...r.unavailable,...r.own];if(u.length&&(u.forEach(h=>d(h.id)),ae(fn(r))),r.buyable.length===0){G(a("cart.error.noneAvailable")),N(null);return}if(r.orderChanged){N(r),Ie.current=Date.now();return}await He(r.buyable,t)}catch(r){V(r,{flow:"cart_checkout",step:"review",cart_size:s.length}),G(Te(r))}finally{A(!1)}}async function Je(){if(P){if(!n){ct({type:"cart-checkout"}),I();return}if(Date.now()-Ie.current>mn){N(null),ae(null),await H();return}G(null),He(P.buyable)}}async function Wt(){if(ye){try{sessionStorage.setItem(de,JSON.stringify(q.getState().items))}catch{}A(!0);try{const t=await os(ye,n?{address:n.address,identity:n.identity}:void 0);if(t.url){window.location.href=t.url;return}U("/credits")}catch(t){try{sessionStorage.removeItem(de)}catch{}V(t,{flow:"cart_buy_credits"}),b({phase:"error",message:a("buyModal.error.creditsCheckout")})}finally{A(!1)}}}const Ye=$.useRef(!1);$.useEffect(()=>{if(!n||Ye.current||!Wa("cart-checkout"))return;Ye.current=!0;const t=setTimeout(()=>void H(),0);return()=>clearTimeout(t)},[n]);const Xe=$.useRef(!1);$.useEffect(()=>{if(!(L!=null&&L.resumeCheckout)||Xe.current)return;Xe.current=!0,X.current=L.creditsAdded??null;try{const s=sessionStorage.getItem(de);if(s){sessionStorage.removeItem(de);const l=JSON.parse(s);Array.isArray(l)&&l.length&&W(l)}}catch{}m.invalidateQueries({queryKey:["usd-balance"]});const t=setTimeout(()=>void H(),0);return()=>clearTimeout(t)},[L==null?void 0:L.resumeCheckout]);const B=St||(p==null?void 0:p.phase)==="processing";return c.length===0&&!p?e.jsx(dt,{children:e.jsxs(ht,{children:[e.jsxs(ut,{onClick:()=>U(-1),type:"button",children:[e.jsx(R,{name:"arrow-left"}),a("nav.cart")]}),e.jsxs(ks,{"data-testid":"cart-empty",children:[e.jsx(R,{name:"cart-plus",size:110}),e.jsxs($s,{children:[e.jsx(Ss,{children:a("cart.empty.title")}),e.jsx(Ms,{children:a("cart.empty.body")})]}),e.jsx(Ts,{to:"/assets",children:a("cart.empty.cta")})]})]})}):e.jsxs(dt,{children:[e.jsxs(ht,{children:[e.jsxs(ut,{onClick:()=>U(-1),type:"button",children:[e.jsx(R,{name:"arrow-left"}),a("nav.cart")]}),e.jsxs(Cs,{children:[e.jsxs(ws,{children:[e.jsxs(js,{children:[e.jsx(Ps,{onClick:()=>U(-1),type:"button","aria-label":a("cart.goBack"),children:e.jsx(R,{name:"arrow-left"})}),e.jsx(zs,{children:a("cart.panelTitle",{count:Tt})}),kt?e.jsxs(As,{onClick:()=>F(!0),disabled:B,children:[e.jsx(R,{name:"fitting-room"}),a("cart.fittingRoom")]}):null]}),e.jsxs(vt,{children:[e.jsx(Is,{children:c.map(t=>{const s=At.get(t.id),l=s?s.priceCredits:t.priceCredits,r=!!s&&s.priceCredits!==t.priceCredits,u=!t.tokenId,h=t.quantity,f=typeof t.available=="number"&&h>=t.available,g=l*h,M=!!z[t.id],y=Yt(t),x=Re[t.id],E=!et(x),j=x==="sold-out"?a("cart.availability.soldOut"):a("cart.availability.unavailable");return e.jsxs(qs,{"data-unavailable":E||void 0,children:[e.jsxs(Rs,{"data-thumb":!0,children:[y?e.jsx(_s,{to:y,state:{item:t,tradeId:t.tradeId},"aria-label":t.name,children:t.thumbnail?e.jsx("img",{src:t.thumbnail,alt:t.name}):null}):t.thumbnail?e.jsx("img",{src:t.thumbnail,alt:t.name}):null,e.jsx(Bs,{"data-check":!0,"aria-hidden":!0,children:e.jsx("svg",{viewBox:"0 0 20 20",width:"12",height:"12",children:e.jsx("path",{d:"M5 10.5l3 3 7-7.5",fill:"none",stroke:"#fff",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round"})})})]}),e.jsxs(Es,{children:[e.jsxs(Ws,{"data-desc":!0,children:[y?e.jsx(Ls,{to:y,state:{item:t,tradeId:t.tradeId},title:t.name,children:t.name}):e.jsx(Fs,{title:t.name,children:t.name}),t.creator?e.jsx(Ns,{address:t.creator,linkToProfile:!0}):null,u?e.jsxs(Xs,{"data-testid":"cart-creator-tag",children:[e.jsx(Zs,{name:"buy-from-creator"}),a("cart.creatorTag")]}):null]}),e.jsx(Qs,{children:E?e.jsxs(e.Fragment,{children:[e.jsxs(Gs,{children:[e.jsx(Js,{name:"warning-fill",size:24}),j]}),y?e.jsx(Ys,{to:y,state:{item:t,tradeId:t.tradeId},children:a("cart.availability.viewResales")}):null]}):e.jsxs(e.Fragment,{children:[u?e.jsxs(Ks,{children:[e.jsx(pt,{onClick:()=>re(()=>T(t.id)),disabled:B||h<=1,"aria-label":a("cart.decreaseQuantity",{name:t.name}),children:e.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":!0,focusable:"false",children:e.jsx("path",{d:"M3.5 8h9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}),e.jsx(Us,{children:h}),e.jsx(pt,{onClick:()=>re(()=>k(t.id)),disabled:B||f,"aria-label":a("cart.increaseQuantity"),children:e.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":!0,focusable:"false",children:e.jsx("path",{d:"M8 3.5v9M3.5 8h9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]}):null,e.jsxs(Hs,{children:[e.jsx(Os,{})," ",g,r?e.jsx(Vs,{children:t.priceCredits*h}):null]})]})})]}),e.jsxs(Ds,{children:[e.jsx(en,{"data-on":M||void 0,onClick:()=>me(t),"aria-label":M?a("cart.removeFromFavorites",{name:t.name}):a("cart.addToFavorites",{name:t.name}),title:M?a("assetCard.removeFromFavorites"):a("assetCard.addToFavorites"),children:e.jsx(R,{name:M?"heart-solid":"heart"})}),e.jsx(tn,{onClick:()=>re(()=>d(t.id)),disabled:B,"aria-label":a("cart.remove",{name:t.name}),title:a("cart.removeTitle"),children:e.jsx(R,{name:"trash",size:24})})]})]},t.id)})}),e.jsx(an,{children:e.jsx("button",{className:"link",onClick:()=>re(_),disabled:B,children:a("cart.clearCart")})})]})]}),e.jsxs(sn,{children:[e.jsx(nn,{children:a("cart.purchaseSummary")}),e.jsxs(rn,{children:[e.jsxs(on,{children:[e.jsx(cn,{children:a("cart.totalItems",{count:Pt})}),e.jsxs(dn,{children:[e.jsxs(ln,{children:[e.jsx(hn,{})," ",Be]}),Le&&(J??0n)>0n?e.jsx(un,{"data-testid":"cart-mana-rate",children:Le}):null]})]}),ie.options.length>0||ie.manaShortfall?e.jsx(gt,{options:ie.options,totalCents:ne,shortfall:ie.manaShortfall,creditsLabel:P?a("marketCheckout.confirmPurchase"):a("cart.buyWithCredits"),busy:B||ve,onPay:t=>void(P?Je():H(t))}):e.jsx(pn,{onClick:()=>void(P?Je():H()),disabled:B||ve,children:B?a("cart.working"):P?a("marketCheckout.confirmPurchase"):a("assetCard.buyNow")}),ve?e.jsx(ue,{className:"muted",children:a("cart.allUnavailable")}):null,n?null:e.jsx(ue,{className:"muted",children:a("cart.signInHint")}),P?e.jsx(ue,{className:"muted",children:a("cart.priceChanged")}):null,Ae?e.jsx(ue,{className:"muted",children:Ae}):null,e.jsx(xn,{message:$t})]})]})]})]}),Ee.length>0?e.jsx(gn,{children:e.jsx(Fa,{title:a("cart.youMightAlsoLike"),items:Ee})}):null,we&&n?e.jsx(La,{auth:we.auth,signer:n.signer,title:a("authorizeStep.manaTitle"),name:a("authorizeStep.manaName"),reason:a("authorizeStep.manaReason"),icon:e.jsx("img",{src:Na,width:24,height:24,alt:"","aria-hidden":!0}),onAuthorized:()=>{const{run:t}=we;oe(null),t()},onCancel:()=>oe(null),onClose:()=>oe(null)}):null,p?e.jsx(ys,{phase:p.phase,balanceCredits:se,onClose:qt,stage:p.phase==="processing"?p.stage:void 0,step:p.phase==="processing"?p.step:void 0,total:p.phase==="processing"?p.total:void 0,isSelfCustody:Xt(n==null?void 0:n.providerType),options:p.phase==="choose"?Bt(p).options:void 0,onPay:Et,totalCents:p.phase==="choose"?p.totalCents:void 0,totalManaWei:p.phase==="choose"?p.manaWei:void 0,totalCredits:p.phase==="choose"?Pe(p.lines):void 0,lines:p.phase==="nofunds"?p.lines:void 0,shortfallCredits:p.phase==="nofunds"?p.shortfall:void 0,packs:te,selectedPack:ye,onSelectPack:qe,onBuyPacks:()=>void Wt(),message:p.phase==="error"?p.message:void 0,onRetry:()=>void H()}):null]})}export{Bn as Cart};